From d2fbb90171b5e595c2258d3f44645d2d109e869d Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Sun, 16 Dec 2012 11:57:38 +0000 Subject: Migrate PageSizer to Gtk::Grid (bzr r11957) --- src/ui/widget/page-sizer.cpp | 52 ++++++++++++++++++++++++++++++++++++++++++-- src/ui/widget/page-sizer.h | 24 +++++++++++++++++++- 2 files changed, 73 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index 2ab72d6c7..fa3f8e3a1 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -330,14 +330,36 @@ PageSizer::PageSizer(Registry & _wr) pack_start (_customFrame, false, false, 0); _customFrame.add(_customDimTable); - _customDimTable.resize(3, 2); _customDimTable.set_border_width(4); + +#if WITH_GTKMM_3_0 + _customDimTable.set_row_spacing(4); + _customDimTable.set_column_spacing(4); + + _dimensionWidth.set_hexpand(); + _dimensionWidth.set_vexpand(); + _customDimTable.attach(_dimensionWidth, 0, 0, 1, 1); + + _dimensionUnits.set_hexpand(); + _dimensionUnits.set_vexpand(); + _customDimTable.attach(_dimensionUnits, 1, 0, 1, 1); + + _dimensionHeight.set_hexpand(); + _dimensionHeight.set_vexpand(); + _customDimTable.attach(_dimensionHeight, 0, 1, 1, 1); + + _fitPageMarginExpander.set_hexpand(); + _fitPageMarginExpander.set_vexpand(); + _customDimTable.attach(_fitPageMarginExpander, 0, 2, 2, 1); +#else + _customDimTable.resize(3, 2); _customDimTable.set_row_spacings(4); _customDimTable.set_col_spacings(4); _customDimTable.attach(_dimensionWidth, 0,1, 0,1); _customDimTable.attach(_dimensionUnits, 1,2, 0,1); _customDimTable.attach(_dimensionHeight, 0,1, 1,2); _customDimTable.attach(_fitPageMarginExpander, 0,2, 2,3); +#endif _dimTabOrderGList = NULL; _dimTabOrderGList = g_list_append(_dimTabOrderGList, _dimensionWidth.gobj()); @@ -353,7 +375,32 @@ PageSizer::PageSizer(Registry & _wr) _fitPageMarginExpander.add(_marginTable); //## Set up margin settings - _marginTable.resize(4, 2); + _marginTable.set_border_width(4); + +#if WITH_GTKMM_3_0 + _marginTable.set_row_spacing(4); + _marginTable.set_column_spacing(4); + + _marginTopAlign.set_hexpand(); + _marginTopAlign.set_vexpand(); + _marginTable.attach(_marginTopAlign, 0, 0, 2, 1); + + _marginLeftAlign.set_hexpand(); + _marginLeftAlign.set_vexpand(); + _marginTable.attach(_marginLeftAlign, 0, 1, 1, 1); + + _marginRightAlign.set_hexpand(); + _marginRightAlign.set_vexpand(); + _marginTable.attach(_marginRightAlign, 1, 1, 1, 1); + + _marginBottomAlign.set_hexpand(); + _marginBottomAlign.set_vexpand(); + _marginTable.attach(_marginBottomAlign, 0, 2, 2, 1); + + _fitPageButtonAlign.set_hexpand(); + _fitPageButtonAlign.set_vexpand(); + _marginTable.attach(_fitPageButtonAlign, 0, 3, 2, 1); +#else _marginTable.set_border_width(4); _marginTable.set_row_spacings(4); _marginTable.set_col_spacings(4); @@ -362,6 +409,7 @@ PageSizer::PageSizer(Registry & _wr) _marginTable.attach(_marginRightAlign, 1,2, 1,2); _marginTable.attach(_marginBottomAlign, 0,2, 2,3); _marginTable.attach(_fitPageButtonAlign, 0,2, 3,4); +#endif _marginTopAlign.set(0.5, 0.5, 0.0, 1.0); _marginTopAlign.add(_marginTop); diff --git a/src/ui/widget/page-sizer.h b/src/ui/widget/page-sizer.h index 17fd7b1ea..d1fbb56e0 100644 --- a/src/ui/widget/page-sizer.h +++ b/src/ui/widget/page-sizer.h @@ -10,6 +10,10 @@ #ifndef INKSCAPE_UI_WIDGET_PAGE_SIZER_H #define INKSCAPE_UI_WIDGET_PAGE_SIZER_H +#ifdef HAVE_CONFIG_H +# include +#endif + #include #include "ui/widget/registered-widget.h" #include @@ -21,7 +25,13 @@ #include #include #include -#include + +#if WITH_GTKMM_3_0 +# include +#else +# include +#endif + #include namespace Inkscape { @@ -207,7 +217,13 @@ protected: //### Custom size frame Gtk::Frame _customFrame; + +#if WITH_GTKMM_3_0 + Gtk::Grid _customDimTable; +#else Gtk::Table _customDimTable; +#endif + RegisteredUnitMenu _dimensionUnits; RegisteredScalarUnit _dimensionWidth; RegisteredScalarUnit _dimensionHeight; @@ -215,7 +231,13 @@ protected: //### Fit Page options Gtk::Expander _fitPageMarginExpander; + +#if WITH_GTKMM_3_0 + Gtk::Grid _marginTable; +#else Gtk::Table _marginTable; +#endif + Gtk::Alignment _marginTopAlign; Gtk::Alignment _marginLeftAlign; Gtk::Alignment _marginRightAlign; -- cgit v1.2.3