summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorEricSeynaeve <github@nosperse.com>2013-03-28 07:10:54 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-04-02 08:44:27 +0000
commitcd5f0475372ffea2770e48aead82eaee2136a8d6 (patch)
tree9f2cf5a7725e055cf895bfd792f3c2797c248dfc /chart2
parenta808497dbb9e9022bf04c984be19176f99fa3683 (diff)
Converting Smooth Lines dialog to glade
Change-Id: I098267a4b11322df84f4a10e83f3c47a69418371 Reviewed-on: https://gerrit.libreoffice.org/3103 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.cxx84
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.hrc11
-rw-r--r--chart2/source/controller/dialogs/tp_ChartType.src87
-rw-r--r--chart2/uiconfig/ui/smoothlinesdlg.ui77
4 files changed, 64 insertions, 195 deletions
diff --git a/chart2/source/controller/dialogs/tp_ChartType.cxx b/chart2/source/controller/dialogs/tp_ChartType.cxx
index 3907494c5385..449c45e45060 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.cxx
+++ b/chart2/source/controller/dialogs/tp_ChartType.cxx
@@ -438,14 +438,16 @@ public:
virtual void StateChanged( StateChangedType nType );
private:
- DECL_LINK( SplineModeRadioHdl, void* );
+ DECL_LINK( SplineTypeListBoxHdl, void* );
void adjustControlPositions();
void adjustSize();
+ const sal_uInt16 CUBIC_SPLINE_POS = 0;
+ const sal_uInt16 B_SPLINE_POS = 1;
+
private:
- RadioButton* m_pRB_Splines_Cubic;
- RadioButton* m_pRB_Splines_B;
+ ListBox* m_pLB_Spline_Type;
NumericField* m_pMF_SplineResolution;
FixedText* m_pFT_SplineOrder;
@@ -455,16 +457,14 @@ private:
SplinePropertiesDialog::SplinePropertiesDialog( Window* pParent )
: ModalDialog( pParent, "SmoothLinesDialog", "modules/chart2/ui/smoothlinesdlg.ui")
{
- get(m_pRB_Splines_Cubic, "CubicSplineRadioButton");
- get(m_pRB_Splines_B, "BSplineRadioButton");
+ get(m_pLB_Spline_Type, "SplineTypeComboBox");
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_pRB_Splines_Cubic->SetToggleHdl( LINK( this, SplinePropertiesDialog, SplineModeRadioHdl ) );
- m_pRB_Splines_B->SetToggleHdl( LINK( this, SplinePropertiesDialog, SplineModeRadioHdl ) );
+ m_pLB_Spline_Type->SetSelectHdl( LINK (this, SplinePropertiesDialog, SplineTypeListBoxHdl ) );
}
SplinePropertiesDialog::~SplinePropertiesDialog()
@@ -474,95 +474,45 @@ SplinePropertiesDialog::~SplinePropertiesDialog()
void SplinePropertiesDialog::StateChanged( StateChangedType nType )
{
Dialog::StateChanged( nType );
-
- if( nType == STATE_CHANGE_INITSHOW )
- {
- adjustControlPositions();
- adjustSize();
- }
}
-void SplinePropertiesDialog::adjustControlPositions()
-{
-/// //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_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_pRB_Splines_Cubic->Check();
+ m_pLB_Spline_Type->SelectEntryPos(CUBIC_SPLINE_POS);
break;
case CurveStyle_B_SPLINES:
- m_pRB_Splines_B->Check();
+ m_pLB_Spline_Type->SelectEntryPos(B_SPLINE_POS);
break;
default:
- m_pRB_Splines_Cubic->Check();
+ m_pLB_Spline_Type->SelectEntryPos(CUBIC_SPLINE_POS);
break;
}
m_pMF_SplineOrder->SetValue( rParameter.nSplineOrder );
m_pMF_SplineResolution->SetValue( rParameter.nCurveResolution );
//dis/enabling
- m_pFT_SplineOrder->Enable(m_pRB_Splines_B->IsChecked());
- m_pMF_SplineOrder->Enable(m_pRB_Splines_B->IsChecked());
+ m_pFT_SplineOrder->Enable(B_SPLINE_POS == m_pLB_Spline_Type->GetSelectEntryPos());
+ m_pMF_SplineOrder->Enable(B_SPLINE_POS == m_pLB_Spline_Type->GetSelectEntryPos());
}
void SplinePropertiesDialog::fillParameter( ChartTypeParameter& rParameter, bool bSmoothLines )
{
if(!bSmoothLines)
rParameter.eCurveStyle=CurveStyle_LINES;
- else if(m_pRB_Splines_Cubic->IsChecked())
+ else if(CUBIC_SPLINE_POS == m_pLB_Spline_Type->GetSelectEntryPos())
rParameter.eCurveStyle=CurveStyle_CUBIC_SPLINES;
- else if(m_pRB_Splines_B->IsChecked())
+ else if(B_SPLINE_POS == m_pLB_Spline_Type->GetSelectEntryPos())
rParameter.eCurveStyle=CurveStyle_B_SPLINES;
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)
+IMPL_LINK_NOARG(SplinePropertiesDialog, SplineTypeListBoxHdl)
{
- m_pFT_SplineOrder->Enable(m_pRB_Splines_B->IsChecked());
- m_pMF_SplineOrder->Enable(m_pRB_Splines_B->IsChecked());
+ m_pFT_SplineOrder->Enable(B_SPLINE_POS == m_pLB_Spline_Type->GetSelectEntryPos());
+ m_pMF_SplineOrder->Enable(B_SPLINE_POS == m_pLB_Spline_Type->GetSelectEntryPos());
return 0;
}
diff --git a/chart2/source/controller/dialogs/tp_ChartType.hrc b/chart2/source/controller/dialogs/tp_ChartType.hrc
index 4082373c83ee..2c1aacc5736d 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.hrc
+++ b/chart2/source/controller/dialogs/tp_ChartType.hrc
@@ -27,12 +27,7 @@
#define LB_CHARTTYPE 2
#define CT_CHARTVARIANT 3
-#define FL_SPLINE_SEPARATOR 2
-#define FL_SPLINE_DIALOGBUTTONS 3
-
#define FT_CHARTTYPE 1
-#define FT_SPLINE_ORDER 3
-#define FT_SPLINE_RESOLUTION 4
#define CB_X_AXIS_CATEGORIES 1
#define CB_3D_LOOK 2
@@ -46,10 +41,4 @@
#define RB_STACK_Y_PERCENT 3
#define RB_STACK_Z 4
-#define RB_SPLINES_CUBIC 5
-#define RB_SPLINES_B 6
-
-#define MF_SPLINE_ORDER 1
-#define MF_SPLINE_RESOLUTION 2
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/tp_ChartType.src b/chart2/source/controller/dialogs/tp_ChartType.src
index c1d62a6a0a94..1782e6bb9375 100644
--- a/chart2/source/controller/dialogs/tp_ChartType.src
+++ b/chart2/source/controller/dialogs/tp_ChartType.src
@@ -173,91 +173,4 @@ TabPage TP_CHARTTYPE
};
-ModalDialog DLG_SPLINE_PROPERTIES
-{
- HelpID = HID_SCH_DLG_SPLINE_PROPERTIES;
- Size = MAP_APPFONT ( SPLINE_DIALOG_WIDTH , SPLINE_DIALOG_HEIGHT ) ;
- OutputSize = TRUE ;
- SVLook = TRUE ;
- Moveable = TRUE ;
- Closeable = TRUE;
- RadioButton RB_SPLINES_CUBIC
- {
- HelpID = "chart2:RadioButton:DLG_SPLINE_PROPERTIES:RB_SPLINES_CUBIC";
- Pos = MAP_APPFONT ( POS_X_SPLINES_1, POS_Y_SPLINES_2 ) ;
- Size = MAP_APPFONT ( SPLINES_WIDTH_RADIO , 10 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "Cubic spline";
- };
- RadioButton RB_SPLINES_B
- {
- HelpID = "chart2:RadioButton:DLG_SPLINE_PROPERTIES:RB_SPLINES_B";
- Pos = MAP_APPFONT ( POS_X_SPLINES_1, POS_Y_SPLINES_3 ) ;
- Size = MAP_APPFONT ( SPLINES_WIDTH_RADIO , 10 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "B-Spline";
- };
-
- FixedLine FL_SPLINE_SEPARATOR
- {
- Pos = MAP_APPFONT ( POS_X_SPLINE_EXTRAS-RSC_CD_FIXEDLINE_WIDTH-RSC_SP_FLGR_SPACE_X , POS_Y_SPLINES_2 ) ;
- Size = MAP_APPFONT ( RSC_CD_FIXEDLINE_WIDTH , 2*12 ) ;
- Vert = TRUE ;
- };
-
- FixedText FT_SPLINE_RESOLUTION
- {
- Pos = MAP_APPFONT ( POS_X_SPLINE_EXTRAS , POS_Y_SPLINES_2 ) ;
- Size = MAP_APPFONT ( SPLINES_WIDTH_METRIC_TEXT , 10 ) ;
- Text [ en-US ] = "~Resolution" ;
- };
- MetricField MF_SPLINE_RESOLUTION
- {
- HelpID = "chart2:MetricField:DLG_SPLINE_PROPERTIES:MF_SPLINE_RESOLUTION";
- Border = TRUE ;
- Pos = MAP_APPFONT ( POS_X_SPLINE_EXTRAS+SPLINES_WIDTH_METRIC_TEXT+RSC_SP_FLGR_SPACE_X , POS_Y_SPLINES_2-2 ) ;
- Size = MAP_APPFONT ( 25 , 12 ) ;
- TabStop = TRUE ;
- Repeat = TRUE ;
- Spin = TRUE ;
- Minimum = 1 ;
- Maximum = 100 ;
- StrictFormat = TRUE ;
- Unit = FUNIT_CUSTOM ;
- First = 1 ;
- Last = 100 ;
- SpinSize = 1 ;
- };
-
- FixedText FT_SPLINE_ORDER
- {
- Pos = MAP_APPFONT ( POS_X_SPLINE_EXTRAS , POS_Y_SPLINES_3 ) ;
- Size = MAP_APPFONT ( SPLINES_WIDTH_METRIC_TEXT , 10 ) ;
- Text [ en-US ] = "~Degree of polynomials" ;
- };
- MetricField MF_SPLINE_ORDER
- {
- HelpID = "chart2:MetricField:DLG_SPLINE_PROPERTIES:MF_SPLINE_ORDER";
- Border = TRUE ;
- Pos = MAP_APPFONT ( POS_X_SPLINE_EXTRAS+SPLINES_WIDTH_METRIC_TEXT+RSC_SP_FLGR_SPACE_X , POS_Y_SPLINES_3-2 ) ;
- Size = MAP_APPFONT ( 25 , 12 ) ;
- TabStop = TRUE ;
- Repeat = TRUE ;
- Spin = TRUE ;
- Minimum = 1 ;
- Maximum = 15 ;
- StrictFormat = TRUE ;
- Unit = FUNIT_CUSTOM ;
- First = 1 ;
- Last = 15 ;
- SpinSize = 1 ;
- };
- FixedLine FL_SPLINE_DIALOGBUTTONS
- {
- Pos = MAP_APPFONT ( 0 , POS_Y_SPLINES_4 ) ;
- Size = MAP_APPFONT ( SPLINE_DIALOG_WIDTH , RSC_CD_FIXEDTEXT_HEIGHT ) ;
- };
- BUTTONS_OK_CANCEL_HELP( POS_X_SPLINES_1, POS_Y_SPLINES_5, 53, 0 )
-};
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/uiconfig/ui/smoothlinesdlg.ui b/chart2/uiconfig/ui/smoothlinesdlg.ui
index 26fe81d44746..d6ca52340a62 100644
--- a/chart2/uiconfig/ui/smoothlinesdlg.ui
+++ b/chart2/uiconfig/ui/smoothlinesdlg.ui
@@ -30,22 +30,18 @@
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="orientation">vertical</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>
+ <object class="GtkLabel" id="TypeLabel">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
+ <property name="can_focus">False</property>
+ <property name="margin_right">12</property>
+ <property name="label" translatable="yes">Line _Type:</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>
@@ -54,15 +50,14 @@
</packing>
</child>
<child>
- <object class="GtkRadioButton" id="BSplineRadioButton">
- <property name="label" translatable="yes">_B-Spline</property>
+ <object class="GtkComboBoxText" id="SplineTypeComboBox">
<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>
+ <property name="can_focus">False</property>
+ <property name="active">0</property>
+ <items>
+ <item translatable="yes">Cubic spline</item>
+ <item translatable="yes">B-spline</item>
+ </items>
</object>
<packing>
<property name="expand">False</property>
@@ -74,13 +69,10 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
- <placeholder/>
- </child>
- <child>
<object class="GtkGrid" id="grid2">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -89,7 +81,9 @@
<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="margin_left">6</property>
+ <property name="margin_right">12</property>
+ <property name="label" translatable="yes">_Resolution:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">ResolutionSpinbutton</property>
</object>
@@ -105,7 +99,9 @@
<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="margin_left">6</property>
+ <property name="margin_right">12</property>
+ <property name="label" translatable="yes">_Degree of polynomials:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">PolynomialsSpinButton</property>
</object>
@@ -122,6 +118,7 @@
<property name="can_focus">True</property>
<property name="halign">start</property>
<property name="invisible_char">●</property>
+ <property name="invisible_char_set">True</property>
<property name="adjustment">ResolutionAdjustment</property>
</object>
<packing>
@@ -137,6 +134,7 @@
<property name="can_focus">True</property>
<property name="halign">start</property>
<property name="invisible_char">●</property>
+ <property name="invisible_char_set">True</property>
<property name="adjustment">PolynomialsAdjustment</property>
</object>
<packing>
@@ -163,10 +161,11 @@
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
+ <property name="margin_top">12</property>
<property name="homogeneous">True</property>
- <property name="layout_style">spread</property>
+ <property name="layout_style">end</property>
<child>
- <object class="GtkButton" id="OKButton">
+ <object class="GtkButton" id="ok">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -182,7 +181,7 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="CancelButton">
+ <object class="GtkButton" id="cancel">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -196,7 +195,7 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="HelpButton">
+ <object class="GtkButton" id="help">
<property name="label">gtk-help</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -220,9 +219,27 @@
</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-widget response="0">ok</action-widget>
+ <action-widget response="0">cancel</action-widget>
+ <action-widget response="0">help</action-widget>
</action-widgets>
</object>
+ <object class="GtkListStore" id="SplineTypeModel">
+ <columns>
+ <!-- column-name TypeName -->
+ <column type="gchararray"/>
+ <!-- column-name TypeInt -->
+ <column type="gint"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">Cubic Spline</col>
+ <col id="1">0</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">B-Spline</col>
+ <col id="1">1</col>
+ </row>
+ </data>
+ </object>
</interface>