[Libreoffice-commits] core.git: basctl/source basctl/uiconfig basctl/UIConfig_basicide.mk

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Feb 17 14:26:58 UTC 2020


 basctl/UIConfig_basicide.mk                     |    1 
 basctl/source/basicide/baside2.hxx              |    8 +-
 basctl/source/basicide/baside2b.cxx             |   55 +++++++++---------
 basctl/uiconfig/basicide/ui/dockingorganizer.ui |    2 
 basctl/uiconfig/basicide/ui/dockingstack.ui     |   73 ++++++++++++++++++++++++
 5 files changed, 111 insertions(+), 28 deletions(-)

New commits:
commit 30ed8bedee2f1858b965cb0b2109ee711764fd08
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Feb 17 12:01:49 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Feb 17 15:26:23 2020 +0100

    weld StackWindow DockingWindow
    
    Change-Id: I46626fdbfcaeabed48da9ae14fe5d351c335df55
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88859
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/basctl/UIConfig_basicide.mk b/basctl/UIConfig_basicide.mk
index c87e39c77001..411223416500 100644
--- a/basctl/UIConfig_basicide.mk
+++ b/basctl/UIConfig_basicide.mk
@@ -41,6 +41,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/BasicIDE,\
 	basctl/uiconfig/basicide/ui/deletelangdialog \
 	basctl/uiconfig/basicide/ui/dialogpage \
 	basctl/uiconfig/basicide/ui/dockingorganizer \
+	basctl/uiconfig/basicide/ui/dockingstack \
 	basctl/uiconfig/basicide/ui/exportdialog \
 	basctl/uiconfig/basicide/ui/gotolinedialog \
 	basctl/uiconfig/basicide/ui/importlibdialog \
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index 0ce8fda57041..312b2765c105 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -33,6 +33,7 @@
 #include <basic/sbstar.hxx>
 #include <vcl/lstbox.hxx>
 #include <vcl/idle.hxx>
+#include <vcl/weld.hxx>
 
 #include <svtools/colorcfg.hxx>
 #include <o3tl/enumarray.hxx>
@@ -244,8 +245,11 @@ public:
 class StackWindow : public DockingWindow
 {
 private:
-    VclPtr<SvTreeListBox>  aTreeListBox;
-    OUString               aStackStr;
+    std::unique_ptr<weld::Builder> m_xBuilder;
+    VclPtr<vcl::Window> m_xVclContentArea;
+    std::unique_ptr<weld::Container> m_xContainer;
+    std::unique_ptr<weld::Label> m_xTitle;
+    std::unique_ptr<weld::TreeView> m_xTreeListBox;
 
 protected:
     virtual void    Resize() override;
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index c510e621bf56..1d52ce1160b8 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -42,6 +42,7 @@
 #include <sfx2/dispatch.hxx>
 #include <sfx2/progress.hxx>
 #include <sfx2/viewfrm.hxx>
+#include <vcl/layout.hxx>
 #include <vcl/weld.hxx>
 #include <svl/urihelper.hxx>
 #include <svx/svxids.hrc>
@@ -1834,22 +1835,24 @@ void WatchWindow::UpdateWatches( bool bBasicStopped )
     aTreeListBox->UpdateWatches( bBasicStopped );
 }
 
-
 // StackWindow
+StackWindow::StackWindow(Layout* pParent)
+    : DockingWindow(pParent, "DockingWindow", "sfx/ui/dockingwindow.ui")
+{
+    m_xVclContentArea = VclPtr<VclVBox>::Create(this);
+    m_xVclContentArea->Show();
+    m_xBuilder.reset(Application::CreateInterimBuilder(m_xVclContentArea,
+                                                       "modules/BasicIDE/ui/dockingstack.ui"));
+    m_xContainer = m_xBuilder->weld_container("DockingStack");
 
+    m_xTitle = m_xBuilder->weld_label("title");
+    m_xTitle->set_label(IDEResId(RID_STR_STACK));
+    m_xTreeListBox = m_xBuilder->weld_tree_view("stack");
 
-StackWindow::StackWindow (Layout* pParent) :
-    DockingWindow(pParent),
-    aTreeListBox( VclPtr<SvTreeListBox>::Create(this, WB_BORDER | WB_3DLOOK | WB_HSCROLL | WB_TABSTOP) ),
-    aStackStr( IDEResId( RID_STR_STACK ) )
-{
-    aTreeListBox->SetHelpId(HID_BASICIDE_STACKWINDOW_LIST);
-    aTreeListBox->SetAccessibleName(IDEResId(RID_STR_STACKNAME));
-    aTreeListBox->SetPosPixel( Point( DWBORDER, nVirtToolBoxHeight ) );
-    aTreeListBox->SetHighlightRange();
-    aTreeListBox->SetSelectionMode( SelectionMode::NONE );
-    aTreeListBox->InsertEntry( OUString() );
-    aTreeListBox->Show();
+    m_xTreeListBox->set_help_id(HID_BASICIDE_STACKWINDOW_LIST);
+    m_xTreeListBox->set_accessible_name(IDEResId(RID_STR_STACKNAME));
+    m_xTreeListBox->set_selection_mode(SelectionMode::NONE);
+    m_xTreeListBox->append_text(OUString());
 
     SetText(IDEResId(RID_STR_STACKNAME));
 
@@ -1859,7 +1862,6 @@ StackWindow::StackWindow (Layout* pParent) :
     GetSystemWindow()->GetTaskPaneList()->AddWindow( this );
 }
 
-
 StackWindow::~StackWindow()
 {
     disposeOnce();
@@ -1869,40 +1871,43 @@ void StackWindow::dispose()
 {
     if (!IsDisposed())
         GetSystemWindow()->GetTaskPaneList()->RemoveWindow( this );
-    aTreeListBox.disposeAndClear();
+    m_xTitle.reset();
+    m_xTreeListBox.reset();
+    m_xContainer.reset();
+    m_xBuilder.reset();
+    m_xVclContentArea.disposeAndClear();
     DockingWindow::dispose();
 }
 
 void StackWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&)
 {
-    rRenderContext.DrawText(Point(DWBORDER, 7), aStackStr);
     lcl_DrawIDEWindowFrame(this, rRenderContext);
 }
 
 void StackWindow::Resize()
 {
     Size aSz = GetOutputSizePixel();
-    Size aBoxSz(aSz.Width() - 2*DWBORDER, aSz.Height() - nVirtToolBoxHeight - DWBORDER);
+    Size aBoxSz(aSz.Width() - 2*DWBORDER, aSz.Height() - 2*DWBORDER);
 
     if ( aBoxSz.Width() < 4 )
         aBoxSz.setWidth( 0 );
     if ( aBoxSz.Height() < 4 )
         aBoxSz.setHeight( 0 );
 
-    aTreeListBox->SetSizePixel( aBoxSz );
+    m_xVclContentArea->SetPosSizePixel(Point(DWBORDER, DWBORDER), aBoxSz);
 
     Invalidate();
 }
 
 void StackWindow::UpdateCalls()
 {
-    aTreeListBox->SetUpdateMode(false);
-    aTreeListBox->Clear();
+    m_xTreeListBox->freeze();
+    m_xTreeListBox->clear();
 
     if (StarBASIC::IsRunning())
     {
         ErrCode eOld = SbxBase::GetError();
-        aTreeListBox->SetSelectionMode( SelectionMode::Single );
+        m_xTreeListBox->set_selection_mode(SelectionMode::Single);
 
         sal_Int32 nScope = 0;
         SbMethod* pMethod = StarBASIC::GetActiveMethod( nScope );
@@ -1952,7 +1957,7 @@ void StackWindow::UpdateCalls()
                 }
                 aEntry.append(")");
             }
-            aTreeListBox->InsertEntry( aEntry.makeStringAndClear() );
+            m_xTreeListBox->append_text(aEntry.makeStringAndClear());
             nScope++;
             pMethod = StarBASIC::GetActiveMethod( nScope );
         }
@@ -1963,11 +1968,11 @@ void StackWindow::UpdateCalls()
     }
     else
     {
-        aTreeListBox->SetSelectionMode( SelectionMode::NONE );
-        aTreeListBox->InsertEntry( OUString() );
+        m_xTreeListBox->set_selection_mode(SelectionMode::NONE);
+        m_xTreeListBox->append_text(OUString());
     }
 
-    aTreeListBox->SetUpdateMode(true);
+    m_xTreeListBox->thaw();
 }
 
 ComplexEditorWindow::ComplexEditorWindow( ModulWindow* pParent ) :
diff --git a/basctl/uiconfig/basicide/ui/dockingorganizer.ui b/basctl/uiconfig/basicide/ui/dockingorganizer.ui
index 94144738c1a5..cce4a12c10d5 100644
--- a/basctl/uiconfig/basicide/ui/dockingorganizer.ui
+++ b/basctl/uiconfig/basicide/ui/dockingorganizer.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- Generated with glade 3.22.1 -->
 <interface domain="basctl">
-  <requires lib="gtk+" version="3.0"/>
+  <requires lib="gtk+" version="3.18"/>
   <object class="GtkTreeStore" id="liststore1">
     <columns>
       <!-- column-name expander -->
diff --git a/basctl/uiconfig/basicide/ui/dockingstack.ui b/basctl/uiconfig/basicide/ui/dockingstack.ui
new file mode 100644
index 000000000000..cdb07c491c6e
--- /dev/null
+++ b/basctl/uiconfig/basicide/ui/dockingstack.ui
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface domain="basctl">
+  <requires lib="gtk+" version="3.18"/>
+  <object class="GtkTreeStore" id="liststore1">
+    <columns>
+      <!-- column-name text -->
+      <column type="gchararray"/>
+      <!-- column-name id -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
+  <object class="GtkGrid" id="DockingStack">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="hexpand">True</property>
+    <property name="vexpand">True</property>
+    <property name="row_spacing">6</property>
+    <property name="column_spacing">12</property>
+    <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="stack">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">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">1</property>
+            <property name="enable_tree_lines">True</property>
+            <child internal-child="selection">
+              <object class="GtkTreeSelection"/>
+            </child>
+            <child>
+              <object class="GtkTreeViewColumn" id="treeviewcolumn2">
+                <child>
+                  <object class="GtkCellRendererText" id="cellrenderertext2"/>
+                  <attributes>
+                    <attribute name="text">0</attribute>
+                  </attributes>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="title">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="use_underline">True</property>
+        <property name="mnemonic_widget">stack</property>
+        <property name="xalign">0</property>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+  </object>
+</interface>


More information about the Libreoffice-commits mailing list