Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3102

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/02/3102/1

Converting spline dialog box to glade.

Change-Id: I945445ab703b146b048cd45768d256d8b6a833d5
---
M chart2/source/controller/dialogs/tp_ChartType.cxx
M sc/UI_scalc.mk
A sc/uiconfig/scalc/ui/smoothlinesdlg.ui
3 files changed, 292 insertions(+), 78 deletions(-)



diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx 
b/chart2/source/controller/dialogs/tp_ChartType.cxx
index 7ab0e54..bf24f38 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.cxx
+++ b/chart2/source/controller/dialogs/tp_ChartType.cxx
@@ -444,42 +444,27 @@
     void adjustSize();
 
 private:
-    RadioButton m_aRB_Splines_Cubic;
-    RadioButton m_aRB_Splines_B;
+    RadioButton* m_pRB_Splines_Cubic;
+    RadioButton* m_pRB_Splines_B;
 
-    FixedLine   m_aFL_SplineSeparator;
-
-    FixedText   m_aFT_SplineResolution;
-    MetricField m_aMF_SplineResolution;
-    FixedText   m_aFT_SplineOrder;
-    MetricField m_aMF_SplineOrder;
-
-    FixedLine       m_aFL_DialogButtons;
-    HelpButton      m_aBP_Help;
-    OKButton        m_aBP_OK;
-    CancelButton    m_aBP_Cancel;
+    NumericField* m_pMF_SplineResolution;
+    FixedText*    m_pFT_SplineOrder;
+    NumericField* m_pMF_SplineOrder;
 };
 
 SplinePropertiesDialog::SplinePropertiesDialog( Window* pParent )
-        : ModalDialog( pParent, SchResId( DLG_SPLINE_PROPERTIES ) )
-        , m_aRB_Splines_Cubic( this, SchResId( RB_SPLINES_CUBIC ) )
-        , m_aRB_Splines_B( this, SchResId( RB_SPLINES_B ) )
-        , m_aFL_SplineSeparator( this, SchResId( FL_SPLINE_SEPARATOR ) )
-        , m_aFT_SplineResolution( this, SchResId( FT_SPLINE_RESOLUTION ) )
-        , m_aMF_SplineResolution( this, SchResId( MF_SPLINE_RESOLUTION ) )
-        , m_aFT_SplineOrder( this, SchResId( FT_SPLINE_ORDER ) )
-        , m_aMF_SplineOrder( this, SchResId( MF_SPLINE_ORDER ) )
-        , m_aFL_DialogButtons( this, SchResId( FL_SPLINE_DIALOGBUTTONS ) )
-    , m_aBP_Help( this, SchResId(BTN_HELP) )
-        , m_aBP_OK( this, SchResId(BTN_OK) )
-    , m_aBP_Cancel( this, SchResId(BTN_CANCEL) )
+        : ModalDialog( pParent, "SmoothLinesDialog", "modules/scalc/ui/smoothlinesdlg.ui")
 {
-    FreeResource();
+    get(m_pRB_Splines_Cubic, "CubicSplineRadioButton");
+    get(m_pRB_Splines_B, "BSplineRadioButton");
+    get(m_pMF_SplineResolution, "ResolutionSpinbutton");
+    get(m_pFT_SplineOrder, "PolynomialsLabel");
+    get(m_pMF_SplineOrder, "PolynomialsSpinButton");
 
     this->SetText( String( SchResId( STR_DLG_SMOOTH_LINE_PROPERTIES ) ) );
 
-    m_aRB_Splines_Cubic.SetToggleHdl( LINK( this, SplinePropertiesDialog, SplineModeRadioHdl ) );
-    m_aRB_Splines_B.SetToggleHdl( LINK( this, SplinePropertiesDialog, SplineModeRadioHdl ) );
+    m_pRB_Splines_Cubic->SetToggleHdl( LINK( this, SplinePropertiesDialog, SplineModeRadioHdl ) );
+    m_pRB_Splines_B->SetToggleHdl( LINK( this, SplinePropertiesDialog, SplineModeRadioHdl ) );
 }
 
 SplinePropertiesDialog::~SplinePropertiesDialog()
@@ -499,85 +484,85 @@
 
 void SplinePropertiesDialog::adjustControlPositions()
 {
-    //position of controls:
-    //----------------
-    //fixed line and Fixed texts as near as possible to radio controls
-    long nRBWidth = ::std::max( m_aRB_Splines_Cubic.CalcMinimumSize().Width(), 
m_aRB_Splines_B.CalcMinimumSize().Width());
-    long nFLXPos = m_aRB_Splines_Cubic.GetPosPixel().X()+nRBWidth+m_aFT_SplineOrder.LogicToPixel( 
Size(RSC_SP_CTRL_GROUP_X,0), MapMode(MAP_APPFONT) ).Width();
-    long nFTXPos = nFLXPos + m_aFL_SplineSeparator.GetSizePixel().Width() + 
m_aFT_SplineOrder.LogicToPixel( Size(RSC_SP_CTRL_GROUP_X,0), MapMode(MAP_APPFONT) ).Width();
-
-    m_aRB_Splines_Cubic.SetSizePixel( Size( nRBWidth, m_aRB_Splines_Cubic.GetSizePixel().Height() 
) );
-    m_aRB_Splines_B.SetSizePixel( Size( nRBWidth, m_aRB_Splines_B.GetSizePixel().Height() ) );
-
-    m_aFL_SplineSeparator.SetPosPixel( Point( nFLXPos, m_aFL_SplineSeparator.GetPosPixel().Y() ) );
-
-    m_aFT_SplineOrder.SetPosPixel( Point( nFTXPos, m_aFT_SplineOrder.GetPosPixel().Y() ) );
-    m_aFT_SplineResolution.SetPosPixel( Point( nFTXPos, m_aFT_SplineResolution.GetPosPixel().Y() ) 
);
-
-    //----------------
-    //move metric controls as near to text as possible
-    long nFTWidth = ::std::max( m_aFT_SplineOrder.CalcMinimumSize().Width(), 
m_aFT_SplineResolution.CalcMinimumSize().Width());
-    long nMFXPos = m_aFT_SplineOrder.GetPosPixel().X()+nFTWidth+m_aFT_SplineOrder.LogicToPixel( 
Size(RSC_SP_CTRL_DESC_X,0), MapMode(MAP_APPFONT) ).Width();
-
-    m_aFT_SplineOrder.SetSizePixel( Size( nFTWidth, m_aFT_SplineOrder.GetSizePixel().Height() ) );
-    m_aFT_SplineResolution.SetSizePixel( Size( nFTWidth, 
m_aFT_SplineResolution.GetSizePixel().Height() ) );
-
-    m_aMF_SplineOrder.SetPosPixel( Point( nMFXPos, m_aMF_SplineOrder.GetPosPixel().Y() ) );
-    m_aMF_SplineResolution.SetPosPixel( Point( nMFXPos, m_aMF_SplineResolution.GetPosPixel().Y() ) 
);
+///    //position of controls:
+///    //----------------
+///    //fixed line and Fixed texts as near as possible to radio controls
+///    long nRBWidth = ::std::max( m_pRB_Splines_Cubic->CalcMinimumSize().Width(), 
m_pRB_Splines_B->CalcMinimumSize().Width());
+///    long nFLXPos = 
m_pRB_Splines_Cubic->GetPosPixel().X()+nRBWidth+m_pFT_SplineOrder->LogicToPixel( 
Size(RSC_SP_CTRL_GROUP_X,0), MapMode(MAP_APPFONT) ).Width();
+///    long nFTXPos = nFLXPos + m_pFL_SplineSeparator->GetSizePixel().Width() + 
m_pFT_SplineOrder->LogicToPixel( Size(RSC_SP_CTRL_GROUP_X,0), MapMode(MAP_APPFONT) ).Width();
+///
+///    m_pRB_Splines_Cubic->SetSizePixel( Size( nRBWidth, 
m_pRB_Splines_Cubic->GetSizePixel().Height() ) );
+///    m_pRB_Splines_B->SetSizePixel( Size( nRBWidth, m_pRB_Splines_B->GetSizePixel().Height() ) );
+///
+///    m_pFL_SplineSeparator->SetPosPixel( Point( nFLXPos, 
m_pFL_SplineSeparator->GetPosPixel().Y() ) );
+///
+///    m_pFT_SplineOrder->SetPosPixel( Point( nFTXPos, m_pFT_SplineOrder->GetPosPixel().Y() ) );
+///    m_aFT_SplineResolution.SetPosPixel( Point( nFTXPos, 
m_aFT_SplineResolution.GetPosPixel().Y() ) );
+///
+///    //----------------
+///    //move metric controls as near to text as possible
+///    long nFTWidth = ::std::max( m_pFT_SplineOrder->CalcMinimumSize().Width(), 
m_aFT_SplineResolution.CalcMinimumSize().Width());
+///    long nMFXPos = 
m_pFT_SplineOrder->GetPosPixel().X()+nFTWidth+m_pFT_SplineOrder->LogicToPixel( 
Size(RSC_SP_CTRL_DESC_X,0), MapMode(MAP_APPFONT) ).Width();
+///
+///    m_pFT_SplineOrder->SetSizePixel( Size( nFTWidth, m_pFT_SplineOrder->GetSizePixel().Height() 
) );
+///    m_aFT_SplineResolution.SetSizePixel( Size( nFTWidth, 
m_aFT_SplineResolution.GetSizePixel().Height() ) );
+///
+///    m_pMF_SplineOrder->SetPosPixel( Point( nMFXPos, m_pMF_SplineOrder->GetPosPixel().Y() ) );
+///    m_pMF_SplineResolution->SetPosPixel( Point( nMFXPos, 
m_pMF_SplineResolution->GetPosPixel().Y() ) );
 }
 
 void SplinePropertiesDialog::adjustSize()
 {
-    Size aDlgSize( this->GetSizePixel() );
-    long nBorder = m_aRB_Splines_Cubic.GetPosPixel().X();
-    long nX = m_aMF_SplineOrder.GetPosPixel().X() + m_aMF_SplineOrder.GetSizePixel().Width();
-    if(aDlgSize.Width()< (nX+nBorder) )
-    {
-        aDlgSize.Width() = (nX+nBorder);
-        this->SetSizePixel(aDlgSize);
-
-        Size aLineSize( m_aFL_DialogButtons.GetSizePixel() );
-        aLineSize.Width() = aDlgSize.Width();
-        m_aFL_DialogButtons.SetSizePixel(aLineSize);
-    }
+///    Size aDlgSize( this->GetSizePixel() );
+///    long nBorder = m_pRB_Splines_Cubic->GetPosPixel().X();
+///    long nX = m_pMF_SplineOrder->GetPosPixel().X() + m_pMF_SplineOrder->GetSizePixel().Width();
+///    if(aDlgSize.Width()< (nX+nBorder) )
+///    {
+///        aDlgSize.Width() = (nX+nBorder);
+///        this->SetSizePixel(aDlgSize);
+///
+///        Size aLineSize( m_aFL_DialogButtons.GetSizePixel() );
+///        aLineSize.Width() = aDlgSize.Width();
+///        m_aFL_DialogButtons.SetSizePixel(aLineSize);
+///    }
 }
 void SplinePropertiesDialog::fillControls( const ChartTypeParameter& rParameter )
 {
     switch(rParameter.eCurveStyle)
     {
     case CurveStyle_CUBIC_SPLINES:
-        m_aRB_Splines_Cubic.Check();
+        m_pRB_Splines_Cubic->Check();
         break;
     case CurveStyle_B_SPLINES:
-        m_aRB_Splines_B.Check();
+        m_pRB_Splines_B->Check();
         break;
     default:
-        m_aRB_Splines_Cubic.Check();
+        m_pRB_Splines_Cubic->Check();
         break;
     }
-    m_aMF_SplineOrder.SetValue( rParameter.nSplineOrder );
-    m_aMF_SplineResolution.SetValue( rParameter.nCurveResolution );
+    m_pMF_SplineOrder->SetValue( rParameter.nSplineOrder );
+    m_pMF_SplineResolution->SetValue( rParameter.nCurveResolution );
 
     //dis/enabling
-    m_aFT_SplineOrder.Enable(m_aRB_Splines_B.IsChecked());
-    m_aMF_SplineOrder.Enable(m_aRB_Splines_B.IsChecked());
+    m_pFT_SplineOrder->Enable(m_pRB_Splines_B->IsChecked());
+    m_pMF_SplineOrder->Enable(m_pRB_Splines_B->IsChecked());
 }
 void SplinePropertiesDialog::fillParameter( ChartTypeParameter& rParameter, bool bSmoothLines )
 {
     if(!bSmoothLines)
         rParameter.eCurveStyle=CurveStyle_LINES;
-    else if(m_aRB_Splines_Cubic.IsChecked())
+    else if(m_pRB_Splines_Cubic->IsChecked())
         rParameter.eCurveStyle=CurveStyle_CUBIC_SPLINES;
-    else if(m_aRB_Splines_B.IsChecked())
+    else if(m_pRB_Splines_B->IsChecked())
         rParameter.eCurveStyle=CurveStyle_B_SPLINES;
 
-    rParameter.nCurveResolution = static_cast< sal_Int32 >( m_aMF_SplineResolution.GetValue());
-    rParameter.nSplineOrder = static_cast< sal_Int32 >( m_aMF_SplineOrder.GetValue());
+    rParameter.nCurveResolution = static_cast< sal_Int32 >( m_pMF_SplineResolution->GetValue());
+    rParameter.nSplineOrder = static_cast< sal_Int32 >( m_pMF_SplineOrder->GetValue());
 }
 IMPL_LINK_NOARG(SplinePropertiesDialog, SplineModeRadioHdl)
 {
-    m_aFT_SplineOrder.Enable(m_aRB_Splines_B.IsChecked());
-    m_aMF_SplineOrder.Enable(m_aRB_Splines_B.IsChecked());
+    m_pFT_SplineOrder->Enable(m_pRB_Splines_B->IsChecked());
+    m_pMF_SplineOrder->Enable(m_pRB_Splines_B->IsChecked());
     return 0;
 }
 
diff --git a/sc/UI_scalc.mk b/sc/UI_scalc.mk
index 46afc89..34cdee4 100644
--- a/sc/UI_scalc.mk
+++ b/sc/UI_scalc.mk
@@ -20,6 +20,7 @@
        sc/uiconfig/scalc/ui/sortoptionspage \
        sc/uiconfig/scalc/ui/textimportoptions \
        sc/uiconfig/scalc/ui/textimportcsv \
+       sc/uiconfig/scalc/ui/smoothlinesdlg \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/sc/uiconfig/scalc/ui/smoothlinesdlg.ui b/sc/uiconfig/scalc/ui/smoothlinesdlg.ui
new file mode 100644
index 0000000..26fe81d
--- /dev/null
+++ b/sc/uiconfig/scalc/ui/smoothlinesdlg.ui
@@ -0,0 +1,228 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkAdjustment" id="PolynomialsAdjustment">
+    <property name="lower">1</property>
+    <property name="upper">15</property>
+    <property name="value">3</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="ResolutionAdjustment">
+    <property name="lower">1</property>
+    <property name="upper">100</property>
+    <property name="value">20</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkDialog" id="SmoothLinesDialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">Smooth Lines</property>
+    <property name="modal">True</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialog-vbox1">
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">2</property>
+        <child>
+          <object class="GtkBox" id="box1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <child>
+              <object class="GtkBox" id="box2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="orientation">vertical</property>
+                <child>
+                  <object class="GtkRadioButton" id="CubicSplineRadioButton">
+                    <property name="label" translatable="yes">Cubic _spline</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <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">BSplineRadioButton</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkRadioButton" id="BSplineRadioButton">
+                    <property name="label" translatable="yes">_B-Spline</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_underline">True</property>
+                    <property name="xalign">0</property>
+                    <property name="draw_indicator">True</property>
+                    <property name="group">CubicSplineRadioButton</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>
+              <placeholder/>
+            </child>
+            <child>
+              <object class="GtkGrid" id="grid2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <child>
+                  <object class="GtkLabel" id="ResolutionLabel">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="halign">start</property>
+                    <property name="label" translatable="yes">_Resolution</property>
+                    <property name="use_underline">True</property>
+                    <property name="mnemonic_widget">ResolutionSpinbutton</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="PolynomialsLabel">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="halign">start</property>
+                    <property name="label" translatable="yes">_Degree of polynomials</property>
+                    <property name="use_underline">True</property>
+                    <property name="mnemonic_widget">PolynomialsSpinButton</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">1</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSpinButton" id="ResolutionSpinbutton">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="halign">start</property>
+                    <property name="invisible_char">●</property>
+                    <property name="adjustment">ResolutionAdjustment</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSpinButton" id="PolynomialsSpinButton">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="halign">start</property>
+                    <property name="invisible_char">●</property>
+                    <property name="adjustment">PolynomialsAdjustment</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">1</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area1">
+            <property name="can_focus">False</property>
+            <property name="homogeneous">True</property>
+            <property name="layout_style">spread</property>
+            <child>
+              <object class="GtkButton" id="OKButton">
+                <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>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="CancelButton">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="HelpButton">
+                <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_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="0">OKButton</action-widget>
+      <action-widget response="0">CancelButton</action-widget>
+      <action-widget response="0">HelpButton</action-widget>
+    </action-widgets>
+  </object>
+</interface>

-- 
To view, visit https://gerrit.libreoffice.org/3102
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I945445ab703b146b048cd45768d256d8b6a833d5
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Eric Seynaeve <github@nosperse.com>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.