starmath/source/ElementsDockingWindow.cxx | 8 - starmath/uiconfig/smath/ui/sidebarelements_math.ui | 144 ++++++--------------- 2 files changed, 46 insertions(+), 106 deletions(-)
New commits: commit f208a4bcbbadc40d92a32bef9afba487bb539fe3 Author: Mike Kaganski <[email protected]> AuthorDate: Tue May 17 11:55:11 2022 +0300 Commit: Mike Kaganski <[email protected]> CommitDate: Sun Jun 5 07:52:20 2022 +0200 Simplify the UI Remove the intermediary containers, keeping those that are really needed to create the necessary structure. I'm curious, how much CPU could be wasted by the unused container layers when calculating the layout. Change-Id: I56bf13c52b4e14dcef6595d00223cd36f48793d0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134463 Tested-by: Jenkins Tested-by: Caolán McNamara <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135409 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Mike Kaganski <[email protected]> diff --git a/starmath/uiconfig/smath/ui/sidebarelements_math.ui b/starmath/uiconfig/smath/ui/sidebarelements_math.ui index c645e7f8d349..3b18a2a9e301 100644 --- a/starmath/uiconfig/smath/ui/sidebarelements_math.ui +++ b/starmath/uiconfig/smath/ui/sidebarelements_math.ui @@ -8,146 +8,86 @@ <column type="gchararray"/> </columns> </object> - <!-- n-columns=1 n-rows=1 --> - <object class="GtkGrid" id="MathElementsPanel"> + <object class="GtkPaned" id="MathElementsPanel"> <property name="visible">True</property> <property name="can-focus">False</property> + <property name="orientation">vertical</property> <property name="hexpand">True</property> <property name="vexpand">True</property> <property name="border-width">6</property> + <property name="wide-handle">True</property> <child> - <!-- n-columns=1 n-rows=1 --> - <object class="GtkGrid" id="container"> + <object class="GtkScrolledWindow"> <property name="visible">True</property> - <property name="can-focus">False</property> + <property name="can-focus">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <property name="row-spacing">3</property> - <property name="column-spacing">6</property> + <property name="shadow-type">in</property> <child> - <object class="GtkPaned" id="splitter"> + <object class="GtkTreeView" id="categorylist"> <property name="visible">True</property> <property name="can-focus">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <property name="orientation">vertical</property> - <property name="wide-handle">True</property> + <property name="model">liststore1</property> + <property name="headers-visible">False</property> + <property name="search-column">0</property> + <property name="show-expanders">False</property> + <child internal-child="selection"> + <object class="GtkTreeSelection" id="treeview-selection2"/> + </child> <child> - <!-- n-columns=1 n-rows=1 --> - <object class="GtkGrid"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> + <object class="GtkTreeViewColumn" id="treeviewcolumn0"> <child> - <object class="GtkScrolledWindow"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <property name="shadow-type">in</property> - <child> - <object class="GtkTreeView" id="categorylist"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <property name="model">liststore1</property> - <property name="headers-visible">False</property> - <property name="search-column">0</property> - <property name="show-expanders">False</property> - <child internal-child="selection"> - <object class="GtkTreeSelection" id="treeview-selection2"/> - </child> - <child> - <object class="GtkTreeViewColumn" id="treeviewcolumn0"> - <child> - <object class="GtkCellRendererText" id="cellrenderertext1"/> - <attributes> - <attribute name="text">1</attribute> - </attributes> - </child> - </object> - </child> - </object> - </child> - </object> - <packing> - <property name="left-attach">0</property> - <property name="top-attach">0</property> - </packing> + <object class="GtkCellRendererText" id="cellrenderertext1"/> + <attributes> + <attribute name="text">1</attribute> + </attributes> </child> </object> - <packing> - <property name="resize">False</property> - <property name="shrink">True</property> - </packing> </child> + </object> + </child> + </object> + </child> + <child> + <object class="GtkScrolledWindow" id="scrolledwindow"> + <property name="visible">True</property> + <property name="can-focus">True</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="shadow-type">in</property> + <child> + <object class="GtkViewport"> + <property name="visible">True</property> + <property name="can-focus">False</property> <child> - <!-- n-columns=1 n-rows=1 --> - <object class="GtkGrid"> + <object class="GtkBox"> <property name="visible">True</property> <property name="can-focus">False</property> + <property name="orientation">vertical</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <property name="row-spacing">6</property> <child> - <!-- n-columns=1 n-rows=1 --> - <object class="GtkGrid"> + <object class="GtkDrawingArea" id="element_selector"> <property name="visible">True</property> - <property name="can-focus">False</property> + <property name="can-focus">True</property> + <property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_STRUCTURE_MASK | GDK_SCROLL_MASK | GDK_SMOOTH_SCROLL_MASK</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <child> - <object class="GtkScrolledWindow" id="scrolledwindow"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - <property name="shadow-type">in</property> - <child> - <object class="GtkViewport"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <child> - <object class="GtkDrawingArea" id="element_selector"> - <property name="visible">True</property> - <property name="can-focus">True</property> - <property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_STRUCTURE_MASK | GDK_SCROLL_MASK | GDK_SMOOTH_SCROLL_MASK</property> - <property name="hexpand">True</property> - <property name="vexpand">True</property> - </object> - </child> - </object> - </child> - </object> - <packing> - <property name="left-attach">0</property> - <property name="top-attach">0</property> - </packing> - </child> </object> <packing> - <property name="left-attach">0</property> - <property name="top-attach">0</property> + <property name="position">0</property> </packing> </child> </object> - <packing> - <property name="resize">True</property> - <property name="shrink">True</property> - </packing> </child> </object> - <packing> - <property name="left-attach">0</property> - <property name="top-attach">0</property> - </packing> </child> </object> <packing> - <property name="left-attach">0</property> - <property name="top-attach">0</property> + <property name="resize">True</property> + <property name="shrink">True</property> </packing> </child> </object> commit 48b10bb5bac0f64df5e281142762fa1890819c59 Author: Mike Kaganski <[email protected]> AuthorDate: Tue May 17 16:02:52 2022 +0200 Commit: Mike Kaganski <[email protected]> CommitDate: Sun Jun 5 07:52:00 2022 +0200 Use structured binding to clarify the code Change-Id: I6b1c0532a64a18d961b7ab112675213eea2fd121 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134438 Tested-by: Jenkins Reviewed-by: Mike Kaganski <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135408 Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx index 1ba5c0d991ec..2f4bc80de14f 100644 --- a/starmath/source/ElementsDockingWindow.cxx +++ b/starmath/source/ElementsDockingWindow.cxx @@ -1041,15 +1041,15 @@ void SmElementsControl::build() { case 5: { - for (sal_uInt16 n = 0; n < m_a5CategoriesSize; ++n) + for (const auto& [rSetId, rElementsArray, rElementsArraySize] : m_a5Categories) { - if (msCurrentSetId == std::get<0>(m_a5Categories[n])) + if (msCurrentSetId == rSetId) { - addElements(std::get<1>(m_a5Categories[n]), std::get<2>(m_a5Categories[n])); + addElements(rElementsArray, rElementsArraySize); break; } else - m_nCurrentOffset += std::get<2>(m_a5Categories[n]); + m_nCurrentOffset += rElementsArraySize; } break; }
