[Libreoffice-commits] core.git: 2 commits - extensions/source extensions/uiconfig vcl/win
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Fri Aug 13 11:35:21 UTC 2021
extensions/source/bibliography/general.cxx | 70 ++------------
extensions/source/bibliography/general.hxx | 6 -
extensions/uiconfig/sbibliography/ui/generalpage.ui | 94 --------------------
vcl/win/window/salframe.cxx | 8 +
4 files changed, 23 insertions(+), 155 deletions(-)
New commits:
commit 282ddcf0bf0893f9a71eef2b1fea3db86b1c3292
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Aug 13 12:13:21 2021 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Aug 13 13:34:55 2021 +0200
extensions bibliography: sync the bibliography database window with sw/
That one has the browse button and page number widgets removed for URL
(keeping them only for local URL), do the same in extensions/ to be
consistent.
Change-Id: I519b2d82ddbb88d2b63f599094c23783c6d719cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120424
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
Tested-by: Jenkins
diff --git a/extensions/source/bibliography/general.cxx b/extensions/source/bibliography/general.cxx
index 9e1145eac490..3992f55e5ebc 100644
--- a/extensions/source/bibliography/general.cxx
+++ b/extensions/source/bibliography/general.cxx
@@ -184,9 +184,6 @@ BibGeneralPage::BibGeneralPage(vcl::Window* pParent, BibDataManager* pMan)
, xNoteED(m_xBuilder->weld_entry("notecontrol"))
, xURLFT(m_xBuilder->weld_label("url"))
, xURLED(m_xBuilder->weld_entry("urlcontrol"))
- , m_xBrowseButton(m_xBuilder->weld_button("browse"))
- , m_xPageCB(m_xBuilder->weld_check_button("pagecb"))
- , m_xPageSB(m_xBuilder->weld_spin_button("pagesb"))
, xCustom1FT(m_xBuilder->weld_label("custom1"))
, xCustom1ED(m_xBuilder->weld_entry("custom1control"))
, xCustom2FT(m_xBuilder->weld_label("custom2"))
@@ -319,9 +316,6 @@ BibGeneralPage::BibGeneralPage(vcl::Window* pParent, BibDataManager* pMan)
xURLFT->get_label(), *xURLED,
sTableErrorString, HID_BIB_URL_POS);
- m_xBrowseButton->connect_clicked(LINK(this, BibGeneralPage, BrowseHdl));
- m_xPageCB->connect_toggled(LINK(this, BibGeneralPage, PageNumHdl));
-
AddControlWithError(lcl_GetColumnName(pMapping, CUSTOM1_POS),
xCustom1FT->get_label(), *xCustom1ED,
sTableErrorString, HID_BIB_CUSTOM1_POS);
@@ -360,11 +354,11 @@ BibGeneralPage::BibGeneralPage(vcl::Window* pParent, BibDataManager* pMan)
set_height_request(aSize.Height());
}
-IMPL_LINK(BibGeneralPage, BrowseHdl, weld::Button&, rButton, void)
+IMPL_LINK_NOARG(BibGeneralPage, BrowseHdl, weld::Button&, void)
{
sfx2::FileDialogHelper aFileDlg(ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
FileDialogFlags::NONE, GetFrameWeld());
- OUString aPath = (&rButton == m_xBrowseButton.get()) ? xURLED->get_text() : m_xLocalURLED->get_text();
+ OUString aPath = m_xLocalURLED->get_text();
if (!aPath.isEmpty())
{
aFileDlg.SetDisplayDirectory(aPath);
@@ -375,13 +369,13 @@ IMPL_LINK(BibGeneralPage, BrowseHdl, weld::Button&, rButton, void)
return;
}
- weld::Entry& rEntry = (&rButton == m_xBrowseButton.get()) ? *xURLED : *m_xLocalURLED;
+ weld::Entry& rEntry = *m_xLocalURLED;
rEntry.set_text(aFileDlg.GetPath());
};
IMPL_LINK(BibGeneralPage, PageNumHdl, weld::Toggleable&, rPageCB, void)
{
- weld::SpinButton& rPageSB = (&rPageCB == m_xPageCB.get()) ? *m_xPageSB : *m_xLocalPageSB;
+ weld::SpinButton& rPageSB = *m_xLocalPageSB;
if (rPageCB.get_active())
{
rPageSB.set_sensitive(true);
@@ -543,26 +537,7 @@ namespace
{
OUString sNewName;
rValue >>= sNewName;
- if (&m_rEntry == &m_rPage.GetURLED())
- {
- OUString aUrl;
- int nPageNumber;
- if (SplitUrlAndPage(sNewName, aUrl, nPageNumber))
- {
- m_rEntry.set_text(aUrl);
- m_rPage.GetPageCB().set_active(true);
- m_rPage.GetPageSB().set_sensitive(true);
- m_rPage.GetPageSB().set_value(nPageNumber);
- }
- else
- {
- m_rEntry.set_text(sNewName);
- m_rPage.GetPageCB().set_active(false);
- m_rPage.GetPageSB().set_sensitive(false);
- m_rPage.GetPageSB().set_value(0);
- }
- }
- else if (&m_rEntry == &m_rPage.GetLocalURLED())
+ if (&m_rEntry == &m_rPage.GetLocalURLED())
{
OUString aUrl;
int nPageNumber;
@@ -587,11 +562,7 @@ namespace
}
m_rEntry.save_value();
- if (&m_rEntry == &m_rPage.GetURLED())
- {
- m_rPage.GetPageSB().save_value();
- }
- else if (&m_rEntry == &m_rPage.GetLocalURLED())
+ if (&m_rEntry == &m_rPage.GetLocalURLED())
{
m_rPage.GetLocalPageSB().save_value();
}
@@ -600,21 +571,15 @@ namespace
/// Updates m_xPropSet based on the UI widget(s).
virtual void WriteBack() override
{
- bool bURL = &m_rEntry == &m_rPage.GetURLED()
- && m_rPage.GetPageSB().get_value_changed_from_saved();
bool bLocalURL = &m_rEntry == &m_rPage.GetLocalURLED()
&& m_rPage.GetLocalPageSB().get_value_changed_from_saved();
- if (!m_rEntry.get_value_changed_from_saved() && !(bURL || bLocalURL))
+ if (!m_rEntry.get_value_changed_from_saved() && !bLocalURL)
return;
m_bSelfChanging = true;
OUString aText;
- if (&m_rEntry == &m_rPage.GetURLED())
- {
- aText = MergeUrlAndPage(m_rEntry.get_text(), m_rPage.GetPageSB());
- }
- else if (&m_rEntry == &m_rPage.GetLocalURLED())
+ if (&m_rEntry == &m_rPage.GetLocalURLED())
{
aText = MergeUrlAndPage(m_rEntry.get_text(), m_rPage.GetLocalPageSB());
}
@@ -630,11 +595,7 @@ namespace
m_bSelfChanging = false;
m_rEntry.save_value();
- if (&m_rEntry == &m_rPage.GetURLED())
- {
- m_rPage.GetPageSB().save_value();
- }
- else if (&m_rEntry == &m_rPage.GetLocalURLED())
+ if (&m_rEntry == &m_rPage.GetLocalURLED())
{
m_rPage.GetLocalPageSB().save_value();
}
@@ -780,9 +741,6 @@ void BibGeneralPage::dispose()
xNoteED.reset();
xURLFT.reset();
xURLED.reset();
- m_xBrowseButton.reset();
- m_xPageCB.reset();
- m_xPageSB.reset();
xCustom1FT.reset();
xCustom1ED.reset();
xCustom2FT.reset();
@@ -801,12 +759,6 @@ void BibGeneralPage::dispose()
InterimItemWindow::dispose();
}
-weld::Entry& BibGeneralPage::GetURLED() { return *xURLED; }
-
-weld::CheckButton& BibGeneralPage::GetPageCB() { return *m_xPageCB; }
-
-weld::SpinButton& BibGeneralPage::GetPageSB() { return *m_xPageSB; }
-
weld::Entry& BibGeneralPage::GetLocalURLED() { return *m_xLocalURLED; }
weld::CheckButton& BibGeneralPage::GetLocalPageCB() { return *m_xLocalPageCB; }
@@ -828,10 +780,10 @@ bool BibGeneralPage::AddXControl(const OUString& rName, weld::Entry& rEntry)
uno::Reference< beans::XPropertySetInfo > xPropInfo = xPropSet->getPropertySetInfo();
maChangeListeners.emplace_back(new EntryChangeListener(rEntry, xPropSet, *this));
maChangeListeners.back()->start();
- if (&rEntry == xURLED.get())
+ if (&rEntry == m_xLocalURLED.get())
{
m_aURLListener = maChangeListeners.back();
- m_xPageSB->connect_focus_out(LINK(this, BibGeneralPage, LosePageFocusHdl));
+ m_xLocalPageSB->connect_focus_out(LINK(this, BibGeneralPage, LosePageFocusHdl));
}
}
}
diff --git a/extensions/source/bibliography/general.hxx b/extensions/source/bibliography/general.hxx
index 958d0efd45c9..ae8d587886ab 100644
--- a/extensions/source/bibliography/general.hxx
+++ b/extensions/source/bibliography/general.hxx
@@ -107,9 +107,6 @@ class BibGeneralPage : public InterimItemWindow
std::unique_ptr<weld::Entry> xNoteED;
std::unique_ptr<weld::Label> xURLFT;
std::unique_ptr<weld::Entry> xURLED;
- std::unique_ptr<weld::Button> m_xBrowseButton;
- std::unique_ptr<weld::CheckButton> m_xPageCB;
- std::unique_ptr<weld::SpinButton> m_xPageSB;
std::unique_ptr<weld::Label> xCustom1FT;
std::unique_ptr<weld::Entry> xCustom1ED;
@@ -160,9 +157,6 @@ public:
return sTableErrorString;
}
- weld::Entry& GetURLED();
- weld::CheckButton& GetPageCB();
- weld::SpinButton& GetPageSB();
weld::Entry& GetLocalURLED();
weld::CheckButton& GetLocalPageCB();
weld::SpinButton& GetLocalPageSB();
diff --git a/extensions/uiconfig/sbibliography/ui/generalpage.ui b/extensions/uiconfig/sbibliography/ui/generalpage.ui
index 5386d84c112b..4c0ebf76d188 100644
--- a/extensions/uiconfig/sbibliography/ui/generalpage.ui
+++ b/extensions/uiconfig/sbibliography/ui/generalpage.ui
@@ -2,11 +2,6 @@
<!-- Generated with glade 3.38.2 -->
<interface domain="pcr">
<requires lib="gtk+" version="3.20"/>
- <object class="GtkAdjustment" id="adjustment1">
- <property name="upper">55535</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
- </object>
<object class="GtkAdjustment" id="adjustment2">
<property name="upper">55535</property>
<property name="step_increment">1</property>
@@ -771,92 +766,11 @@
</packing>
</child>
<child>
- <object class="GtkBox" id="vbox">
+ <object class="GtkEntry" id="urlcontrol">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkBox" id="hbox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkEntry" id="urlcontrol">
- <property name="visible">True</property>
- <property name="can-focus">True</property>
- <property name="truncate-multiline">True</property>
- <property name="hexpand">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="browse">
- <property name="label" translatable="yes" context="generalpage|browse">Browse...</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="hbox2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkCheckButton" id="pagecb">
- <property name="label" translatable="yes" context="generalpage|pagecb">Page</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="draw_indicator">True</property>
- <accessibility>
- <relation type="label-for" target="pagesb"/>
- </accessibility>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkSpinButton" id="pagesb">
- <property name="sensitive">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="adjustment">adjustment1</property>
- <property name="truncate-multiline">True</property>
- <accessibility>
- <relation type="labelled-by" target="pagecb"/>
- </accessibility>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
+ <property name="can-focus">True</property>
+ <property name="truncate-multiline">True</property>
+ <property name="hexpand">True</property>
</object>
<packing>
<property name="left-attach">5</property>
commit d29eb3d715a2bfd37c37e098d4f1c4600332487d
Author: Noel Grandin <noel at peralex.com>
AuthorDate: Fri Aug 13 10:19:17 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Aug 13 13:34:44 2021 +0200
no need to lookup window if cursor has not moved (tdf#105575)
use a single-item cache to avoid calling WindowFromPos
Change-Id: I0d42c9572d28363949e38f3e052973727a44fb4a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120419
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 45361d8baef0..ae19b4a5c5c7 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -5460,6 +5460,14 @@ void SalTestMouseLeave()
{
POINT aPt;
GetCursorPos( &aPt );
+
+ // a one item cache, because this function is sometimes hot - if the cursor has not moved, then
+ // no need to call WindowFromPoint
+ static POINT cachedPoint;
+ if (cachedPoint.x == aPt.x && cachedPoint.y == aPt.y)
+ return;
+ cachedPoint = aPt;
+
if ( pSalData->mhWantLeaveMsg != WindowFromPoint( aPt ) )
SendMessageW( pSalData->mhWantLeaveMsg, SAL_MSG_MOUSELEAVE, 0, MAKELPARAM( aPt.x, aPt.y ) );
}
More information about the Libreoffice-commits
mailing list