starmath/inc/dialog.hxx                       |   15 +++----
 starmath/source/dialog.cxx                    |   49 +++++++-------------------
 starmath/source/document.cxx                  |   10 ++---
 starmath/uiconfig/smath/ui/alignmentdialog.ui |   40 +++++++++++----------
 4 files changed, 47 insertions(+), 67 deletions(-)

New commits:
commit 8c72e780694e86f84e1d5b5eab6b724e7ec06754
Author: Caolán McNamara <caol...@redhat.com>
Date:   Mon Apr 9 15:28:19 2018 +0100

    weld SmAlignDialog
    
    Change-Id: Ie17f8da3ee26b366d4c325ff9aa2dbc7b419d8cd
    Reviewed-on: https://gerrit.libreoffice.org/52640
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx
index 2b5556a9ec97..d4452b86a427 100644
--- a/starmath/inc/dialog.hxx
+++ b/starmath/inc/dialog.hxx
@@ -245,19 +245,18 @@ public:
 /**************************************************************************/
 
 
-class SmAlignDialog : public ModalDialog
+class SmAlignDialog : public weld::GenericDialogController
 {
-    VclPtr<RadioButton> m_pLeft;
-    VclPtr<RadioButton> m_pCenter;
-    VclPtr<RadioButton> m_pRight;
-    VclPtr<PushButton>  m_pDefaultButton;
+    std::unique_ptr<weld::RadioButton> m_xLeft;
+    std::unique_ptr<weld::RadioButton> m_xCenter;
+    std::unique_ptr<weld::RadioButton> m_xRight;
+    std::unique_ptr<weld::Button> m_xDefaultButton;
 
-    DECL_LINK(DefaultButtonClickHdl, Button *, void);
+    DECL_LINK(DefaultButtonClickHdl, weld::Button&, void);
 
 public:
-    SmAlignDialog(vcl::Window *pParent);
+    SmAlignDialog(weld::Window *pParent);
     virtual ~SmAlignDialog() override;
-    virtual void dispose() override;
 
     void ReadFrom(const SmFormat &rFormat);
     void WriteTo (SmFormat &rFormat) const;
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index 176ad2352804..ad70b04e3402 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -992,9 +992,9 @@ void SmDistanceDialog::WriteTo(SmFormat &rFormat) /*const*/
     rFormat.RequestApplyChanges();
 }
 
-IMPL_LINK_NOARG( SmAlignDialog, DefaultButtonClickHdl, Button *, void )
+IMPL_LINK_NOARG( SmAlignDialog, DefaultButtonClickHdl, weld::Button&, void )
 {
-    SaveDefaultsQuery aQuery(GetFrameWeld());
+    SaveDefaultsQuery aQuery(m_xDialog.get());
     if (aQuery.run() == RET_YES)
     {
         SmModule *pp = SM_MOD();
@@ -1004,29 +1004,18 @@ IMPL_LINK_NOARG( SmAlignDialog, DefaultButtonClickHdl, 
Button *, void )
     }
 }
 
-SmAlignDialog::SmAlignDialog(vcl::Window * pParent)
-    : ModalDialog(pParent, "AlignmentDialog",
-        "modules/smath/ui/alignmentdialog.ui")
+SmAlignDialog::SmAlignDialog(weld::Window* pParent)
+    : GenericDialogController(pParent, "modules/smath/ui/alignmentdialog.ui", 
"AlignmentDialog")
+    , m_xLeft(m_xBuilder->weld_radio_button("left"))
+    , m_xCenter(m_xBuilder->weld_radio_button("center"))
+    , m_xRight(m_xBuilder->weld_radio_button("right"))
+    , m_xDefaultButton(m_xBuilder->weld_button("default"))
 {
-    get(m_pLeft, "left");
-    get(m_pCenter, "center");
-    get(m_pRight, "right");
-    get(m_pDefaultButton, "default");
-    m_pDefaultButton->SetClickHdl(LINK(this, SmAlignDialog, 
DefaultButtonClickHdl));
+    m_xDefaultButton->connect_clicked(LINK(this, SmAlignDialog, 
DefaultButtonClickHdl));
 }
 
 SmAlignDialog::~SmAlignDialog()
 {
-    disposeOnce();
-}
-
-void SmAlignDialog::dispose()
-{
-    m_pLeft.clear();
-    m_pCenter.clear();
-    m_pRight.clear();
-    m_pDefaultButton.clear();
-    ModalDialog::dispose();
 }
 
 void SmAlignDialog::ReadFrom(const SmFormat &rFormat)
@@ -1034,31 +1023,22 @@ void SmAlignDialog::ReadFrom(const SmFormat &rFormat)
     switch (rFormat.GetHorAlign())
     {
         case SmHorAlign::Left:
-            m_pLeft->Check();
-            m_pCenter->Check(false);
-            m_pRight->Check(false);
+            m_xLeft->set_active(true);
             break;
-
         case SmHorAlign::Center:
-            m_pLeft->Check(false);
-            m_pCenter->Check();
-            m_pRight->Check(false);
+            m_xCenter->set_active(true);
             break;
-
         case SmHorAlign::Right:
-            m_pLeft->Check(false);
-            m_pCenter->Check(false);
-            m_pRight->Check();
+            m_xRight->set_active(true);
             break;
     }
 }
 
-
 void SmAlignDialog::WriteTo(SmFormat &rFormat) const
 {
-    if (m_pLeft->IsChecked())
+    if (m_xLeft->get_active())
         rFormat.SetHorAlign(SmHorAlign::Left);
-    else if (m_pRight->IsChecked())
+    else if (m_xRight->get_active())
         rFormat.SetHorAlign(SmHorAlign::Right);
     else
         rFormat.SetHorAlign(SmHorAlign::Center);
@@ -1066,7 +1046,6 @@ void SmAlignDialog::WriteTo(SmFormat &rFormat) const
     rFormat.RequestApplyChanges();
 }
 
-
 SmShowSymbolSetWindow::SmShowSymbolSetWindow(vcl::Window *pParent, WinBits 
nStyle)
     : Control(pParent, nStyle)
     , m_pVScrollBar(nullptr)
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx
index 686b9b75ef96..c4a312888d0b 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -996,19 +996,19 @@ void SmDocShell::Execute(SfxRequest& rReq)
 
         case SID_ALIGN:
         {
-            VclPtrInstance< SmAlignDialog > xAlignDialog(nullptr);
+            SmAlignDialog aAlignDialog(rReq.GetFrameWeld());
 
             SmFormat aOldFormat  = GetFormat();
-            xAlignDialog->ReadFrom( aOldFormat );
-            if (xAlignDialog->Execute() == RET_OK)
+            aAlignDialog.ReadFrom( aOldFormat );
+            if (aAlignDialog.run() == RET_OK)
             {
                 SmFormat aNewFormat( aOldFormat );
 
-                xAlignDialog->WriteTo(aNewFormat);
+                aAlignDialog.WriteTo(aNewFormat);
 
                 SmModule *pp = SM_MOD();
                 SmFormat aFmt( pp->GetConfig()->GetStandardFormat() );
-                xAlignDialog->WriteTo( aFmt );
+                aAlignDialog.WriteTo( aFmt );
                 pp->GetConfig()->SetStandardFormat( aFmt );
 
                 ::svl::IUndoManager *pTmpUndoMgr = GetUndoManager();
diff --git a/starmath/uiconfig/smath/ui/alignmentdialog.ui 
b/starmath/uiconfig/smath/ui/alignmentdialog.ui
index 5442dbfb405e..de1e9c4627af 100644
--- a/starmath/uiconfig/smath/ui/alignmentdialog.ui
+++ b/starmath/uiconfig/smath/ui/alignmentdialog.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.20.4 -->
 <interface domain="sm">
   <requires lib="gtk+" version="3.18"/>
   <object class="GtkDialog" id="AlignmentDialog">
@@ -12,21 +12,19 @@
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox3">
         <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
         <property name="spacing">12</property>
         <child internal-child="action_area">
           <object class="GtkButtonBox" id="dialog-action_area3">
             <property name="can_focus">False</property>
-            <property name="orientation">vertical</property>
-            <property name="layout_style">start</property>
+            <property name="layout_style">end</property>
             <child>
-              <object class="GtkButton" id="ok">
-                <property name="label">gtk-ok</property>
+              <object class="GtkButton" id="default">
+                <property name="label" translatable="yes" 
context="alignmentdialog|default">_Default</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="has_default">True</property>
                 <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
+                <property name="use_underline">True</property>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -35,10 +33,12 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="cancel">
-                <property name="label">gtk-cancel</property>
+              <object class="GtkButton" id="ok">
+                <property name="label">gtk-ok</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
                 <property name="receives_default">True</property>
                 <property name="use_stock">True</property>
               </object>
@@ -49,8 +49,8 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="help">
-                <property name="label">gtk-help</property>
+              <object class="GtkButton" id="cancel">
+                <property name="label">gtk-cancel</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
@@ -63,17 +63,18 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="default">
-                <property name="label" translatable="yes" 
context="alignmentdialog|default">_Default</property>
+              <object class="GtkButton" id="help">
+                <property name="label">gtk-help</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
-                <property name="use_underline">True</property>
+                <property name="use_stock">True</property>
               </object>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
                 <property name="position">3</property>
+                <property name="secondary">True</property>
               </packing>
             </child>
           </object>
@@ -114,8 +115,8 @@
                         <property name="receives_default">False</property>
                         <property name="use_underline">True</property>
                         <property name="xalign">0</property>
+                        <property name="active">True</property>
                         <property name="draw_indicator">True</property>
-                        <property name="group">center</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -131,9 +132,8 @@
                         <property name="receives_default">False</property>
                         <property name="use_underline">True</property>
                         <property name="xalign">0</property>
-                        <property name="active">True</property>
                         <property name="draw_indicator">True</property>
-                        <property name="group">right</property>
+                        <property name="group">left</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -186,7 +186,9 @@
       <action-widget response="-5">ok</action-widget>
       <action-widget response="-6">cancel</action-widget>
       <action-widget response="-11">help</action-widget>
-      <action-widget response="0">default</action-widget>
     </action-widgets>
+    <child>
+      <placeholder/>
+    </child>
   </object>
 </interface>
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to