summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlex Valavanis <valavanisalex@gmail.com>2012-04-14 20:12:19 +0000
committerAlex Valavanis <valavanisalex@gmail.com>2012-04-14 20:12:19 +0000
commitd7d0b532bab6acd4d9ebf3480257de7945a26626 (patch)
treef89b28bb37dc3c8835d572eef75ad26dd73c2afe /src
parentpowerstroke: more robust method of determining parameters at joins. should fi... (diff)
downloadinkscape-d7d0b532bab6acd4d9ebf3480257de7945a26626.tar.gz
inkscape-d7d0b532bab6acd4d9ebf3480257de7945a26626.zip
Migrate align & dist dialog to Gtk::Grid API
(bzr r11248)
Diffstat (limited to 'src')
-rw-r--r--src/ui/dialog/align-and-distribute.cpp45
-rw-r--r--src/ui/dialog/align-and-distribute.h25
2 files changed, 66 insertions, 4 deletions
diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp
index 062384b52..f8d63aade 100644
--- a/src/ui/dialog/align-and-distribute.cpp
+++ b/src/ui/dialog/align-and-distribute.cpp
@@ -50,6 +50,7 @@
#include <glibmm/i18n.h>
+
namespace Inkscape {
namespace UI {
namespace Dialog {
@@ -61,7 +62,11 @@ public :
Action(const Glib::ustring &id,
const Glib::ustring &tiptext,
guint row, guint column,
- Gtk::Table &parent,
+#if WITH_GTKMM_3_0
+ Gtk::Grid &parent,
+#else
+ Gtk::Table &parent,
+#endif
AlignAndDistribute &dialog):
_dialog(dialog),
_id(id),
@@ -77,7 +82,11 @@ public :
pButton->signal_clicked()
.connect(sigc::mem_fun(*this, &Action::on_button_click));
pButton->set_tooltip_text(tiptext);
+#if WITH_GTKMM_3_0
+ parent.attach(*pButton, column, row, 1, 1);
+#else
parent.attach(*pButton, column, column+1, row, row+1, Gtk::FILL, Gtk::FILL);
+#endif
}
virtual ~Action(){}
@@ -87,7 +96,12 @@ private :
virtual void on_button_click(){}
Glib::ustring _id;
+
+#if WITH_GTKMM_3_0
+ Gtk::Grid &_parent;
+#else
Gtk::Table &_parent;
+#endif
};
@@ -462,7 +476,11 @@ public:
Action(id, tiptext, row, column + 4,
dialog.removeOverlap_table(), dialog)
{
+#if WITH_GTKMM_3_0
+ dialog.removeOverlap_table().set_column_spacing(3);
+#else
dialog.removeOverlap_table().set_col_spacings(3);
+#endif
removeOverlapXGap.set_digits(1);
removeOverlapXGap.set_size_request(60, -1);
@@ -484,11 +502,17 @@ public:
removeOverlapYGapLabel.set_text_with_mnemonic(C_("Gap", "_V:"));
removeOverlapYGapLabel.set_mnemonic_widget(removeOverlapYGap);
+#if WITH_GTKMM_3_0
+ dialog.removeOverlap_table().attach(removeOverlapXGapLabel, column, row, 1, 1);
+ dialog.removeOverlap_table().attach(removeOverlapXGap, column+1, row, 1, 1);
+ dialog.removeOverlap_table().attach(removeOverlapYGapLabel, column+2, row, 1, 1);
+ dialog.removeOverlap_table().attach(removeOverlapYGap, column+3, row, 1, 1);
+#else
dialog.removeOverlap_table().attach(removeOverlapXGapLabel, column, column+1, row, row+1, Gtk::FILL, Gtk::FILL);
dialog.removeOverlap_table().attach(removeOverlapXGap, column+1, column+2, row, row+1, Gtk::FILL, Gtk::FILL);
dialog.removeOverlap_table().attach(removeOverlapYGapLabel, column+2, column+3, row, row+1, Gtk::FILL, Gtk::FILL);
dialog.removeOverlap_table().attach(removeOverlapYGap, column+3, column+4, row, row+1, Gtk::FILL, Gtk::FILL);
-
+#endif
}
private :
@@ -769,7 +793,11 @@ public :
guint row,
guint column,
AlignAndDistribute &dialog,
+#if WITH_GTKMM_3_0
+ Gtk::Grid &table,
+#else
Gtk::Table &table,
+#endif
Geom::Dim2 orientation, bool distribute):
Action(id, tiptext, row, column,
table, dialog),
@@ -896,11 +924,19 @@ AlignAndDistribute::AlignAndDistribute()
_rearrangeFrame(_("Rearrange")),
_removeOverlapFrame(_("Remove overlaps")),
_nodesFrame(_("Nodes")),
+#if WITH_GTKMM_3_0
+ _alignTable(),
+ _distributeTable(),
+ _rearrangeTable(),
+ _removeOverlapTable(),
+ _nodesTable(),
+#else
_alignTable(2, 6, true),
_distributeTable(2, 6, true),
_rearrangeTable(1, 5, false),
_removeOverlapTable(1, 5, false),
_nodesTable(1, 4, true),
+#endif
_anchorLabel(_("Relative to: ")),
_selgrpLabel(_("_Treat selection as group: "), 1)
{
@@ -1238,8 +1274,13 @@ void AlignAndDistribute::addRandomizeButton(const Glib::ustring &id, const Glib:
);
}
+#if WITH_GTKMM_3_0
+void AlignAndDistribute::addBaselineButton(const Glib::ustring &id, const Glib::ustring tiptext,
+ guint row, guint col, Gtk::Grid &table, Geom::Dim2 orientation, bool distribute)
+#else
void AlignAndDistribute::addBaselineButton(const Glib::ustring &id, const Glib::ustring tiptext,
guint row, guint col, Gtk::Table &table, Geom::Dim2 orientation, bool distribute)
+#endif
{
_actionList.push_back(
new ActionBaseline(
diff --git a/src/ui/dialog/align-and-distribute.h b/src/ui/dialog/align-and-distribute.h
index 8cbd48f28..7edf9c30c 100644
--- a/src/ui/dialog/align-and-distribute.h
+++ b/src/ui/dialog/align-and-distribute.h
@@ -19,11 +19,15 @@
#include "ui/widget/panel.h"
#include <gtkmm/frame.h>
#include <gtkmm/comboboxtext.h>
-#include <gtkmm/table.h>
#include <gtkmm/label.h>
-
#include "2geom/rect.h"
+#if WITH_GTKMM_3_0
+#include <gtkmm/checkbutton.h>
+#include <gtkmm/grid.h>
+#else
+#include <gtkmm/table.h>
+#endif
class SPItem;
@@ -45,11 +49,19 @@ public:
AlignTarget getAlignTarget() const;
+#if WITH_GTKMM_3_0
+ Gtk::Grid &align_table(){return _alignTable;}
+ Gtk::Grid &distribute_table(){return _distributeTable;}
+ Gtk::Grid &rearrange_table(){return _rearrangeTable;}
+ Gtk::Grid &removeOverlap_table(){return _removeOverlapTable;}
+ Gtk::Grid &nodes_table(){return _nodesTable;}
+#else
Gtk::Table &align_table(){return _alignTable;}
Gtk::Table &distribute_table(){return _distributeTable;}
Gtk::Table &rearrange_table(){return _rearrangeTable;}
Gtk::Table &removeOverlap_table(){return _removeOverlapTable;}
Gtk::Table &nodes_table(){return _nodesTable;}
+#endif
std::list<SPItem *>::iterator find_master(std::list <SPItem *> &list, bool horizontal);
void setMode(bool nodeEdit);
@@ -86,12 +98,21 @@ protected:
guint row, guint col);
void addRandomizeButton(const Glib::ustring &id, const Glib::ustring tiptext,
guint row, guint col);
+#if WITH_GTKMM_3_0
+ void addBaselineButton(const Glib::ustring &id, const Glib::ustring tiptext,
+ guint row, guint col, Gtk::Grid &table, Geom::Dim2 orientation, bool distribute);
+#else
void addBaselineButton(const Glib::ustring &id, const Glib::ustring tiptext,
guint row, guint col, Gtk::Table &table, Geom::Dim2 orientation, bool distribute);
+#endif
std::list<Action *> _actionList;
Gtk::Frame _alignFrame, _distributeFrame, _rearrangeFrame, _removeOverlapFrame, _nodesFrame;
+#if WITH_GTKMM_3_0
+ Gtk::Grid _alignTable, _distributeTable, _rearrangeTable, _removeOverlapTable, _nodesTable;
+#else
Gtk::Table _alignTable, _distributeTable, _rearrangeTable, _removeOverlapTable, _nodesTable;
+#endif
Gtk::HBox _anchorBox;
Gtk::HBox _selgrpBox;
Gtk::VBox _alignBox;