include/sfx2/devtools/DevelopmentToolDockingWindow.hxx | 1 sfx2/source/devtools/DevelopmentToolDockingWindow.cxx | 17 ++++----- sfx2/uiconfig/ui/developmenttool.ui | 31 +++++++++-------- 3 files changed, 27 insertions(+), 22 deletions(-)
New commits: commit 7cd99750a3174c7953d851eb9b5c4b5675aa0d0e Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Wed Mar 17 16:35:19 2021 +0900 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Sun Mar 21 02:35:10 2021 +0100 devtools: change "Current Selection" button to toolbar Change "Current Selection" toggle button and add it to the toolbar instead. Change-Id: Id891c4a324832f23f52449328d0f7eda6a862993 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112639 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/include/sfx2/devtools/DevelopmentToolDockingWindow.hxx b/include/sfx2/devtools/DevelopmentToolDockingWindow.hxx index 171ff96ad5fb..894772a3fd74 100644 --- a/include/sfx2/devtools/DevelopmentToolDockingWindow.hxx +++ b/include/sfx2/devtools/DevelopmentToolDockingWindow.hxx @@ -37,7 +37,6 @@ class SFX2_DLLPUBLIC DevelopmentToolDockingWindow final : public SfxDockingWindo private: std::unique_ptr<ObjectInspectorWidgets> mpObjectInspectorWidgets; std::unique_ptr<weld::TreeView> mpDocumentModelTreeView; - std::unique_ptr<weld::ToggleButton> mpSelectionToggle; std::unique_ptr<weld::Toolbar> mpDomToolbar; // Reference to the root object for the current document diff --git a/sfx2/source/devtools/DevelopmentToolDockingWindow.cxx b/sfx2/source/devtools/DevelopmentToolDockingWindow.cxx index 32ef347eded7..69711cc32b0c 100644 --- a/sfx2/source/devtools/DevelopmentToolDockingWindow.cxx +++ b/sfx2/source/devtools/DevelopmentToolDockingWindow.cxx @@ -29,7 +29,6 @@ DevelopmentToolDockingWindow::DevelopmentToolDockingWindow(SfxBindings* pInputBi "sfx/ui/developmenttool.ui") , mpObjectInspectorWidgets(new ObjectInspectorWidgets(m_xBuilder)) , mpDocumentModelTreeView(m_xBuilder->weld_tree_view("leftside_treeview_id")) - , mpSelectionToggle(m_xBuilder->weld_toggle_button("dom_selection_toggle")) , mpDomToolbar(m_xBuilder->weld_toolbar("dom_toolbar")) , maDocumentModelTreeHandler( mpDocumentModelTreeView, @@ -38,7 +37,6 @@ DevelopmentToolDockingWindow::DevelopmentToolDockingWindow(SfxBindings* pInputBi { mpDocumentModelTreeView->connect_changed( LINK(this, DevelopmentToolDockingWindow, DocumentModelTreeViewSelectionHandler)); - mpSelectionToggle->connect_toggled(LINK(this, DevelopmentToolDockingWindow, SelectionToggled)); mpDomToolbar->connect_clicked( LINK(this, DevelopmentToolDockingWindow, DomToolbarButtonClicked)); @@ -58,7 +56,7 @@ DevelopmentToolDockingWindow::DevelopmentToolDockingWindow(SfxBindings* pInputBi IMPL_LINK(DevelopmentToolDockingWindow, DocumentModelTreeViewSelectionHandler, weld::TreeView&, rView, void) { - if (mpSelectionToggle->get_state() == TRISTATE_TRUE) + if (mpDomToolbar->get_item_active("dom_current_selection_toggle")) return; OUString sID = rView.get_selected_id(); @@ -78,6 +76,10 @@ IMPL_LINK(DevelopmentToolDockingWindow, DomToolbarButtonClicked, const OString&, { maDocumentModelTreeHandler.inspectDocument(); } + else if (rSelectionId == "dom_current_selection_toggle") + { + updateSelection(); + } } DevelopmentToolDockingWindow::~DevelopmentToolDockingWindow() { disposeOnce(); } @@ -96,7 +98,6 @@ void DevelopmentToolDockingWindow::dispose() // dispose welded objects mpObjectInspectorWidgets.reset(); - mpSelectionToggle.reset(); mpDomToolbar.reset(); mpDocumentModelTreeView.reset(); @@ -105,8 +106,8 @@ void DevelopmentToolDockingWindow::dispose() void DevelopmentToolDockingWindow::updateSelection() { - TriState eTriState = mpSelectionToggle->get_state(); - if (eTriState == TRISTATE_TRUE) + bool bActive = mpDomToolbar->get_item_active("dom_current_selection_toggle"); + if (bActive) { maObjectInspectorTreeHandler.introspect(mxCurrentSelection); maDocumentModelTreeHandler.selectObject(mxCurrentSelection); @@ -145,12 +146,12 @@ void DevelopmentToolDockingWindow::changeToCurrentSelection() if (xInterface.is()) { maObjectInspectorTreeHandler.introspect(xInterface); - mpSelectionToggle->set_state(TRISTATE_TRUE); + mpDomToolbar->set_item_active("dom_current_selection_toggle", true); return; } } } - mpSelectionToggle->set_state(TRISTATE_FALSE); + mpDomToolbar->set_item_active("dom_current_selection_toggle", false); maObjectInspectorTreeHandler.introspect(mxRoot); } diff --git a/sfx2/uiconfig/ui/developmenttool.ui b/sfx2/uiconfig/ui/developmenttool.ui index 62df00e9d708..b73ad19bbe68 100644 --- a/sfx2/uiconfig/ui/developmenttool.ui +++ b/sfx2/uiconfig/ui/developmenttool.ui @@ -81,6 +81,7 @@ <property name="vexpand">True</property> <child> <object class="GtkScrolledWindow"> + <property name="width-request">200</property> <property name="visible">True</property> <property name="can-focus">True</property> <property name="hexpand">True</property> @@ -124,27 +125,30 @@ <property name="can-focus">False</property> <property name="border-width">3</property> <property name="spacing">12</property> - <child> - <object class="GtkToggleButton" id="dom_selection_toggle"> - <property name="label" translatable="yes" context="developmenttool|dom_selection_toggle">Current Selection</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">0</property> - </packing> - </child> <child> <object class="GtkToolbar" id="dom_toolbar"> <property name="visible">True</property> <property name="can-focus">False</property> + <property name="toolbar-style">both-horiz</property> + <property name="show-arrow">False</property> + <child> + <object class="GtkToggleToolButton" id="dom_current_selection_toggle"> + <property name="visible">True</property> + <property name="can-focus">False</property> + <property name="tooltip-text" translatable="yes" context="developmenttool|dom_current_selection_toggle-tooltip">Current Selection In Document</property> + <property name="label" translatable="yes" context="developmenttool|dom_current_selection_toggle">Current Selection</property> + <property name="use-underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> <child> <object class="GtkToolButton" id="dom_refresh_button"> <property name="visible">True</property> <property name="can-focus">False</property> + <property name="tooltip-text" translatable="yes" context="developmenttool|dom_refresh_button-tooltip">Refresh Document Model Tree View</property> <property name="label" translatable="yes" context="developmenttool|dom_refresh_button">Refresh</property> <property name="use-underline">True</property> <property name="icon-name">cmd/lc_reload.png</property> @@ -193,6 +197,7 @@ <property name="visible">True</property> <property name="can-focus">False</property> <property name="toolbar-style">icons</property> + <property name="show-arrow">False</property> <child> <object class="GtkToolButton" id="back"> <property name="visible">True</property> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits