summaryrefslogtreecommitdiffstats
path: root/src/ui/dialog
diff options
context:
space:
mode:
authorkamalpreetgrewal <grewalkamal005@gmail.com>2016-08-15 03:59:18 +0000
committerkamalpreetgrewal <grewalkamal005@gmail.com>2016-08-15 03:59:18 +0000
commit25a9ed4f38121eeb59cf15dbf19391aaef45bba3 (patch)
treee123aeae50d98a52e1ad4575b29bf3c199619e33 /src/ui/dialog
parentSolve crash when deleting CSS property (diff)
parentinkview: Convert to ApplicationWindow (diff)
downloadinkscape-25a9ed4f38121eeb59cf15dbf19391aaef45bba3.tar.gz
inkscape-25a9ed4f38121eeb59cf15dbf19391aaef45bba3.zip
Merge changes from trunk
(bzr r14949.1.64)
Diffstat (limited to 'src/ui/dialog')
-rw-r--r--src/ui/dialog/Makefile_insert.THIS (renamed from src/ui/dialog/Makefile_insert)0
-rw-r--r--src/ui/dialog/aboutbox.cpp21
-rw-r--r--src/ui/dialog/align-and-distribute.cpp60
-rw-r--r--src/ui/dialog/align-and-distribute.h38
-rw-r--r--src/ui/dialog/calligraphic-profile-rename.cpp25
-rw-r--r--src/ui/dialog/calligraphic-profile-rename.h9
-rw-r--r--src/ui/dialog/clonetiler.cpp1240
-rw-r--r--src/ui/dialog/clonetiler.h132
-rw-r--r--src/ui/dialog/debug.cpp7
-rw-r--r--src/ui/dialog/document-metadata.cpp31
-rw-r--r--src/ui/dialog/document-metadata.h12
-rw-r--r--src/ui/dialog/document-properties.cpp143
-rw-r--r--src/ui/dialog/document-properties.h6
-rw-r--r--src/ui/dialog/export.cpp121
-rw-r--r--src/ui/dialog/export.h40
-rw-r--r--src/ui/dialog/filedialog.cpp8
-rw-r--r--src/ui/dialog/filedialogimpl-gtkmm.cpp86
-rw-r--r--src/ui/dialog/filedialogimpl-win32.cpp4
-rw-r--r--src/ui/dialog/fill-and-stroke.cpp19
-rw-r--r--src/ui/dialog/fill-and-stroke.h4
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp255
-rw-r--r--src/ui/dialog/filter-effects-dialog.h12
-rw-r--r--src/ui/dialog/find.cpp14
-rw-r--r--src/ui/dialog/find.h6
-rw-r--r--src/ui/dialog/floating-behavior.cpp8
-rw-r--r--src/ui/dialog/font-substitution.cpp8
-rw-r--r--src/ui/dialog/glyphs.cpp86
-rw-r--r--src/ui/dialog/grid-arrange-tab.cpp40
-rw-r--r--src/ui/dialog/grid-arrange-tab.h5
-rw-r--r--src/ui/dialog/guides.cpp58
-rw-r--r--src/ui/dialog/guides.h12
-rw-r--r--src/ui/dialog/icon-preview.cpp4
-rw-r--r--src/ui/dialog/icon-preview.h6
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp42
-rw-r--r--src/ui/dialog/inkscape-preferences.h8
-rw-r--r--src/ui/dialog/input.cpp131
-rw-r--r--src/ui/dialog/layer-properties.cpp31
-rw-r--r--src/ui/dialog/layer-properties.h10
-rw-r--r--src/ui/dialog/layers.cpp4
-rw-r--r--src/ui/dialog/layers.h6
-rw-r--r--src/ui/dialog/livepatheffect-add.cpp6
-rw-r--r--src/ui/dialog/livepatheffect-editor.cpp7
-rw-r--r--src/ui/dialog/livepatheffect-editor.h4
-rw-r--r--src/ui/dialog/new-from-template.cpp8
-rw-r--r--src/ui/dialog/object-properties.cpp94
-rw-r--r--src/ui/dialog/object-properties.h4
-rw-r--r--src/ui/dialog/objects.cpp114
-rw-r--r--src/ui/dialog/objects.h10
-rw-r--r--src/ui/dialog/ocaldialogs.cpp162
-rw-r--r--src/ui/dialog/ocaldialogs.h41
-rw-r--r--src/ui/dialog/pixelartdialog.cpp4
-rw-r--r--src/ui/dialog/polar-arrange-tab.cpp33
-rw-r--r--src/ui/dialog/polar-arrange-tab.h11
-rw-r--r--src/ui/dialog/spellcheck.cpp12
-rw-r--r--src/ui/dialog/spellcheck.h15
-rw-r--r--src/ui/dialog/svg-fonts-dialog.cpp93
-rw-r--r--src/ui/dialog/svg-fonts-dialog.h9
-rw-r--r--src/ui/dialog/swatches.cpp6
-rw-r--r--src/ui/dialog/symbols.cpp62
-rw-r--r--src/ui/dialog/tags.cpp57
-rw-r--r--src/ui/dialog/tags.h6
-rw-r--r--src/ui/dialog/text-edit.cpp37
-rw-r--r--src/ui/dialog/text-edit.h11
-rw-r--r--src/ui/dialog/tile.h5
-rw-r--r--src/ui/dialog/transformation.cpp146
-rw-r--r--src/ui/dialog/transformation.h4
-rw-r--r--src/ui/dialog/undo-history.cpp33
-rw-r--r--src/ui/dialog/undo-history.h18
-rw-r--r--src/ui/dialog/xml-tree.cpp18
-rw-r--r--src/ui/dialog/xml-tree.h11
70 files changed, 944 insertions, 2849 deletions
diff --git a/src/ui/dialog/Makefile_insert b/src/ui/dialog/Makefile_insert.THIS
index 3add3f214..3add3f214 100644
--- a/src/ui/dialog/Makefile_insert
+++ b/src/ui/dialog/Makefile_insert.THIS
diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp
index 6276d3391..04cf9d02a 100644
--- a/src/ui/dialog/aboutbox.cpp
+++ b/src/ui/dialog/aboutbox.cpp
@@ -98,11 +98,7 @@ AboutBox::AboutBox() : Gtk::Dialog(_("About Inkscape")) {
tabs->append_page(*manage(
make_scrolled_text(license_text)), _("_License"), true);
-#if WITH_GTKMM_3_0
get_content_area()->pack_end(*manage(tabs), true, true);
-#else
- get_vbox()->pack_end(*manage(tabs), true, true);
-#endif
tabs->show_all();
@@ -130,23 +126,16 @@ AboutBox::AboutBox() : Gtk::Dialog(_("About Inkscape")) {
link->set_selectable(true);
link->show();
-#if WITH_GTKMM_3_0
get_content_area()->pack_start(*manage(label), false, false);
get_content_area()->pack_start(*manage(link), false, false);
-#else
- get_vbox()->pack_start(*manage(label), false, false);
- get_vbox()->pack_start(*manage(link), false, false);
-#endif
- Gtk::Requisition requisition;
-#if GTK_CHECK_VERSION(3,0,0)
- gtk_widget_get_preferred_size(reinterpret_cast<GtkWidget*>(gobj()), &requisition, NULL);
-#else
- gtk_widget_size_request (reinterpret_cast<GtkWidget*>(gobj()), &requisition);
-#endif
+ Gtk::Requisition minimum_size;
+ Gtk::Requisition natural_size;
+ get_preferred_size(minimum_size, natural_size);
+
// allow window to shrink
set_size_request(0, 0);
- set_default_size(requisition.width, requisition.height);
+ set_default_size(minimum_size.width, minimum_size.height);
}
diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp
index f269d1cb9..ed9ec3b0a 100644
--- a/src/ui/dialog/align-and-distribute.cpp
+++ b/src/ui/dialog/align-and-distribute.cpp
@@ -58,11 +58,7 @@ namespace Dialog {
Action::Action(const Glib::ustring &id,
const Glib::ustring &tiptext,
guint row, guint column,
-#if WITH_GTKMM_3_0
- Gtk::Grid &parent,
-#else
- Gtk::Table &parent,
-#endif
+ Gtk::Grid &parent,
AlignAndDistribute &dialog):
_dialog(dialog),
_id(id),
@@ -78,11 +74,7 @@ Action::Action(const Glib::ustring &id,
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
}
@@ -130,7 +122,7 @@ void ActionAlign::do_action(SPDesktop *desktop, int index)
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
bool sel_as_group = prefs->getBool("/dialogs/align/sel-as-groups");
- std::vector<SPItem*> selected(selection->itemList());
+ std::vector<SPItem*> selected(selection->items().begin(), selection->items().end());
if (selected.empty()) return;
const Coeffs &a = _allCoeffs[index];
@@ -290,7 +282,7 @@ private :
Inkscape::Selection *selection = desktop->getSelection();
if (!selection) return;
- std::vector<SPItem*> selected(selection->itemList());
+ std::vector<SPItem*> selected(selection->items().begin(), selection->items().end());
if (selected.empty()) return;
//Check 2 or more selected objects
@@ -444,11 +436,7 @@ 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);
@@ -470,17 +458,10 @@ 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 :
@@ -496,7 +477,9 @@ private :
// xGap and yGap are the minimum space required between bounding rectangles.
double const xGap = removeOverlapXGap.get_value();
double const yGap = removeOverlapYGap.get_value();
- removeoverlap(_dialog.getDesktop()->getSelection()->itemList(), xGap, yGap);
+ auto tmp = _dialog.getDesktop()->getSelection()->items();
+ std::vector<SPItem *> vec(tmp.begin(), tmp.end());
+ removeoverlap(vec, xGap, yGap);
// restore compensation setting
prefs->setInt("/options/clonecompensation/value", saved_compensation);
@@ -527,8 +510,9 @@ private :
int saved_compensation = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED);
prefs->setInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED);
- graphlayout(_dialog.getDesktop()->getSelection()->itemList());
-
+ auto tmp = _dialog.getDesktop()->getSelection()->items();
+ std::vector<SPItem *> vec(tmp.begin(), tmp.end());
+ graphlayout(vec);
// restore compensation setting
prefs->setInt("/options/clonecompensation/value", saved_compensation);
@@ -587,7 +571,7 @@ private :
Inkscape::Selection *selection = desktop->getSelection();
if (!selection) return;
- std::vector<SPItem*> selected(selection->itemList());
+ std::vector<SPItem*> selected(selection->items().begin(), selection->items().end());
if (selected.empty()) return;
//Check 2 or more selected objects
@@ -653,7 +637,8 @@ private :
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
int saved_compensation = prefs->getInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED);
prefs->setInt("/options/clonecompensation/value", SP_CLONE_COMPENSATION_UNMOVED);
- std::vector<SPItem*> x(_dialog.getDesktop()->getSelection()->itemList());
+ auto tmp = _dialog.getDesktop()->getSelection()->items();
+ std::vector<SPItem*> x(tmp.begin(), tmp.end());
unclump (x);
// restore compensation setting
@@ -684,7 +669,7 @@ private :
Inkscape::Selection *selection = desktop->getSelection();
if (!selection) return;
- std::vector<SPItem*> selected(selection->itemList());
+ std::vector<SPItem*> selected(selection->items().begin(), selection->items().end());
if (selected.empty()) return;
//Check 2 or more selected objects
@@ -759,11 +744,7 @@ 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),
@@ -782,7 +763,7 @@ private :
Inkscape::Selection *selection = desktop->getSelection();
if (!selection) return;
- std::vector<SPItem*> selected(selection->itemList());
+ std::vector<SPItem*> selected(selection->items().begin(), selection->items().end());
//Check 2 or more selected objects
if (selected.size() < 2) return;
@@ -936,19 +917,11 @@ 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: ")),
_anchorLabelNode(_("Relative to: ")),
_selgrpLabel(_("_Treat selection as group: "), 1)
@@ -1313,13 +1286,8 @@ 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 f8cc61af2..acb3d02ed 100644
--- a/src/ui/dialog/align-and-distribute.h
+++ b/src/ui/dialog/align-and-distribute.h
@@ -22,15 +22,11 @@
#include <gtkmm/frame.h>
#include <gtkmm/comboboxtext.h>
#include <gtkmm/label.h>
-#include "2geom/rect.h"
-#include "ui/dialog/desktop-tracker.h"
-
-#if WITH_GTKMM_3_0
#include <gtkmm/checkbutton.h>
#include <gtkmm/grid.h>
-#else
-#include <gtkmm/table.h>
-#endif
+
+#include "2geom/rect.h"
+#include "ui/dialog/desktop-tracker.h"
class SPItem;
@@ -51,19 +47,11 @@ public:
static AlignAndDistribute &getInstance() { return *new AlignAndDistribute(); }
-#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
void setMode(bool nodeEdit);
@@ -100,22 +88,13 @@ 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
void setTargetDesktop(SPDesktop *desktop);
std::list<Action *> _actionList;
UI::Widget::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;
@@ -163,11 +142,7 @@ public :
Action(const Glib::ustring &id,
const Glib::ustring &tiptext,
guint row, guint column,
- #if WITH_GTKMM_3_0
- Gtk::Grid &parent,
- #else
- Gtk::Table &parent,
- #endif
+ Gtk::Grid &parent,
AlignAndDistribute &dialog);
virtual ~Action(){}
@@ -178,12 +153,7 @@ private :
virtual void on_button_click(){}
Glib::ustring _id;
-
-#if WITH_GTKMM_3_0
Gtk::Grid &_parent;
-#else
- Gtk::Table &_parent;
-#endif
};
diff --git a/src/ui/dialog/calligraphic-profile-rename.cpp b/src/ui/dialog/calligraphic-profile-rename.cpp
index 9ae22db2d..50dae0fd8 100644
--- a/src/ui/dialog/calligraphic-profile-rename.cpp
+++ b/src/ui/dialog/calligraphic-profile-rename.cpp
@@ -16,12 +16,7 @@
#include "calligraphic-profile-rename.h"
#include <glibmm/i18n.h>
#include <gtkmm/stock.h>
-
-#if WITH_GTKMM_3_0
-# include <gtkmm/grid.h>
-#else
-# include <gtkmm/table.h>
-#endif
+#include <gtkmm/grid.h>
#include "desktop.h"
@@ -30,40 +25,24 @@ namespace UI {
namespace Dialog {
CalligraphicProfileRename::CalligraphicProfileRename() :
-#if WITH_GTKMM_3_0
_layout_table(Gtk::manage(new Gtk::Grid())),
-#else
- _layout_table(Gtk::manage(new Gtk::Table(1, 2))),
-#endif
_applied(false)
{
set_title(_("Edit profile"));
-#if WITH_GTKMM_3_0
- Gtk::Box *mainVBox = get_content_area();
+ auto mainVBox = get_content_area();
_layout_table->set_column_spacing(4);
_layout_table->set_row_spacing(4);
-#else
- Gtk::Box *mainVBox = get_vbox();
- _layout_table->set_spacings(4);
-#endif
_profile_name_entry.set_activates_default(true);
_profile_name_label.set_label(_("Profile name:"));
_profile_name_label.set_alignment(1.0, 0.5);
-#if WITH_GTKMM_3_0
_layout_table->attach(_profile_name_label, 0, 0, 1, 1);
_profile_name_entry.set_hexpand();
_layout_table->attach(_profile_name_entry, 1, 0, 1, 1);
-#else
- _layout_table->attach(_profile_name_label,
- 0, 1, 0, 1, Gtk::FILL, Gtk::FILL);
- _layout_table->attach(_profile_name_entry,
- 1, 2, 0, 1, Gtk::FILL | Gtk::EXPAND, Gtk::FILL);
-#endif
mainVBox->pack_start(*_layout_table, false, false, 4);
// Buttons
diff --git a/src/ui/dialog/calligraphic-profile-rename.h b/src/ui/dialog/calligraphic-profile-rename.h
index 4ef71900b..b7a97a1e7 100644
--- a/src/ui/dialog/calligraphic-profile-rename.h
+++ b/src/ui/dialog/calligraphic-profile-rename.h
@@ -20,11 +20,7 @@
#include <gtkmm/label.h>
namespace Gtk {
-#if WITH_GTKMM_3_0
class Grid;
-#else
-class Table;
-#endif
}
class SPDesktop;
@@ -59,12 +55,7 @@ protected:
Gtk::Label _profile_name_label;
Gtk::Entry _profile_name_entry;
-
-#if WITH_GTKMM_3_0
Gtk::Grid* _layout_table;
-#else
- Gtk::Table* _layout_table;
-#endif
Gtk::Button _close_button;
Gtk::Button _delete_button;
diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp
index bdb826384..8e9d3dbbf 100644
--- a/src/ui/dialog/clonetiler.cpp
+++ b/src/ui/dialog/clonetiler.cpp
@@ -22,7 +22,12 @@
#include <glibmm/i18n.h>
#include <2geom/transforms.h>
+
#include <gtkmm/adjustment.h>
+#include <gtkmm/checkbutton.h>
+#include <gtkmm/combobox.h>
+#include <gtkmm/liststore.h>
+#include <gtkmm/radiobutton.h>
#include "desktop.h"
@@ -63,10 +68,8 @@ static unsigned trace_visionkey;
static gdouble trace_zoom;
static SPDocument *trace_doc = NULL;
-
CloneTiler::CloneTiler () :
UI::Widget::Panel ("", "/dialogs/clonetiler/", SP_VERB_DIALOG_CLONETILER),
- dlg(NULL),
desktop(NULL),
deskTrack(),
table_row_labels(NULL)
@@ -75,16 +78,10 @@ CloneTiler::CloneTiler () :
contents->set_spacing(0);
{
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ auto prefs = Inkscape::Preferences::get();
- dlg = GTK_WIDGET(gobj());
-
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *mainbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
+ auto mainbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
gtk_box_set_homogeneous(GTK_BOX(mainbox), FALSE);
-#else
- GtkWidget *mainbox = gtk_vbox_new(FALSE, 4);
-#endif
gtk_container_set_border_width (GTK_CONTAINER (mainbox), 6);
contents->pack_start (*Gtk::manage(Glib::wrap(mainbox)), true, true, 0);
@@ -95,7 +92,7 @@ CloneTiler::CloneTiler () :
// Symmetry
{
- GtkWidget *vb = clonetiler_new_tab (nb, _("_Symmetry"));
+ GtkWidget *vb = new_tab (nb, _("_Symmetry"));
/* TRANSLATORS: For the following 17 symmetry groups, see
* http://www.bib.ulb.ac.be/coursmath/doc/17.htm (visual examples);
@@ -104,7 +101,7 @@ CloneTiler::CloneTiler () :
*/
struct SymGroups {
gint group;
- gchar const *label;
+ Glib::ustring label;
} const sym_groups[] = {
// TRANSLATORS: "translation" means "shift" / "displacement" here.
{TILE_P1, _("<b>P1</b>: simple translation")},
@@ -130,42 +127,36 @@ CloneTiler::CloneTiler () :
gint current = prefs->getInt(prefs_path + "symmetrygroup", 0);
- // Create a list structure containing all the data to be displayed in
- // the symmetry group combo box.
- GtkListStore *store = gtk_list_store_new (1, G_TYPE_STRING);
- GtkTreeIter iter;
+ // Add a new combo box widget with the list of symmetry groups to the vbox
+ auto combo = Gtk::manage(new Gtk::ComboBoxText());
+ combo->set_tooltip_text(_("Select one of the 17 symmetry groups for the tiling"));
- for (unsigned j = 0; j < G_N_ELEMENTS(sym_groups); ++j) {
- SymGroups const &sg = sym_groups[j];
+ // Hack to add markup support
+ auto cell_list = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(combo->gobj()));
+ gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo->gobj()),
+ GTK_CELL_RENDERER(cell_list->data),
+ "markup", 0, NULL);
- // Add the description of the symgroup to a new row
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter, 0, sg.label, -1);
- }
-
- // Add a new combo box widget with the list of symmetry groups to the vbox
- GtkWidget *combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store));
- gtk_widget_set_tooltip_text (combo, _("Select one of the 17 symmetry groups for the tiling"));
- gtk_box_pack_start (GTK_BOX (vb), combo, FALSE, FALSE, SB_MARGIN);
+ for (unsigned j = 0; j < G_N_ELEMENTS(sym_groups); ++j) {
+ SymGroups const &sg = sym_groups[j];
- // Specify the rendering of data from the list in a combo box cell
- GtkCellRenderer *renderer = gtk_cell_renderer_text_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, FALSE);
- gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), renderer, "markup", 0, NULL);
+ // Add the description of the symgroup to a new row
+ combo->append(sg.label);
+ }
- gtk_combo_box_set_active (GTK_COMBO_BOX (combo), current);
+ gtk_box_pack_start (GTK_BOX (vb), GTK_WIDGET(combo->gobj()), FALSE, FALSE, SB_MARGIN);
- g_signal_connect(G_OBJECT(combo), "changed",
- G_CALLBACK(clonetiler_symgroup_changed), NULL);
+ combo->set_active(current);
+ combo->signal_changed().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::symgroup_changed), combo));
}
table_row_labels = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
// Shift
{
- GtkWidget *vb = clonetiler_new_tab (nb, _("S_hift"));
+ GtkWidget *vb = new_tab (nb, _("S_hift"));
- GtkWidget *table = clonetiler_table_x_y_rand (3);
+ GtkWidget *table = table_x_y_rand (3);
gtk_box_pack_start (GTK_BOX (vb), table, FALSE, FALSE, 0);
// X
@@ -175,29 +166,29 @@ CloneTiler::CloneTiler () :
// xgettext:no-c-format
gtk_label_set_markup (GTK_LABEL(l), _("<b>Shift X:</b>"));
gtk_size_group_add_widget(table_row_labels, l);
- clonetiler_table_attach (table, l, 1, 2, 1);
+ table_attach (table, l, 1, 2, 1);
}
{
- GtkWidget *l = clonetiler_spinbox (
+ auto l = spinbox (
// xgettext:no-c-format
_("Horizontal shift per row (in % of tile width)"), "shiftx_per_j",
-10000, 10000, "%");
- clonetiler_table_attach (table, l, 0, 2, 2);
+ table_attach (table, l, 0, 2, 2);
}
{
- GtkWidget *l = clonetiler_spinbox (
+ auto l = spinbox (
// xgettext:no-c-format
_("Horizontal shift per column (in % of tile width)"), "shiftx_per_i",
-10000, 10000, "%");
- clonetiler_table_attach (table, l, 0, 2, 3);
+ table_attach (table, l, 0, 2, 3);
}
{
- GtkWidget *l = clonetiler_spinbox (_("Randomize the horizontal shift by this percentage"), "shiftx_rand",
+ auto l = spinbox (_("Randomize the horizontal shift by this percentage"), "shiftx_rand",
0, 1000, "%");
- clonetiler_table_attach (table, l, 0, 2, 4);
+ table_attach (table, l, 0, 2, 4);
}
// Y
@@ -207,30 +198,30 @@ CloneTiler::CloneTiler () :
// xgettext:no-c-format
gtk_label_set_markup (GTK_LABEL(l), _("<b>Shift Y:</b>"));
gtk_size_group_add_widget(table_row_labels, l);
- clonetiler_table_attach (table, l, 1, 3, 1);
+ table_attach (table, l, 1, 3, 1);
}
{
- GtkWidget *l = clonetiler_spinbox (
+ auto l = spinbox (
// xgettext:no-c-format
_("Vertical shift per row (in % of tile height)"), "shifty_per_j",
-10000, 10000, "%");
- clonetiler_table_attach (table, l, 0, 3, 2);
+ table_attach (table, l, 0, 3, 2);
}
{
- GtkWidget *l = clonetiler_spinbox (
+ auto l = spinbox (
// xgettext:no-c-format
_("Vertical shift per column (in % of tile height)"), "shifty_per_i",
-10000, 10000, "%");
- clonetiler_table_attach (table, l, 0, 3, 3);
+ table_attach (table, l, 0, 3, 3);
}
{
- GtkWidget *l = clonetiler_spinbox (
+ auto l = spinbox (
_("Randomize the vertical shift by this percentage"), "shifty_rand",
0, 1000, "%");
- clonetiler_table_attach (table, l, 0, 3, 4);
+ table_attach (table, l, 0, 3, 4);
}
// Exponent
@@ -238,21 +229,21 @@ CloneTiler::CloneTiler () :
GtkWidget *l = gtk_label_new ("");
gtk_label_set_markup (GTK_LABEL(l), _("<b>Exponent:</b>"));
gtk_size_group_add_widget(table_row_labels, l);
- clonetiler_table_attach (table, l, 1, 4, 1);
+ table_attach (table, l, 1, 4, 1);
}
{
- GtkWidget *l = clonetiler_spinbox (
+ auto l = spinbox (
_("Whether rows are spaced evenly (1), converge (<1) or diverge (>1)"), "shifty_exp",
0, 10, "", true);
- clonetiler_table_attach (table, l, 0, 4, 2);
+ table_attach (table, l, 0, 4, 2);
}
{
- GtkWidget *l = clonetiler_spinbox (
+ auto l = spinbox (
_("Whether columns are spaced evenly (1), converge (<1) or diverge (>1)"), "shiftx_exp",
0, 10, "", true);
- clonetiler_table_attach (table, l, 0, 4, 3);
+ table_attach (table, l, 0, 4, 3);
}
{ // alternates
@@ -260,17 +251,17 @@ CloneTiler::CloneTiler () :
// TRANSLATORS: "Alternate" is a verb here
gtk_label_set_markup (GTK_LABEL(l), _("<small>Alternate:</small>"));
gtk_size_group_add_widget(table_row_labels, l);
- clonetiler_table_attach (table, l, 1, 5, 1);
+ table_attach (table, l, 1, 5, 1);
}
{
- GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of shifts for each row"), "shifty_alternate");
- clonetiler_table_attach (table, l, 0, 5, 2);
+ auto l = checkbox (_("Alternate the sign of shifts for each row"), "shifty_alternate");
+ table_attach (table, l, 0, 5, 2);
}
{
- GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of shifts for each column"), "shiftx_alternate");
- clonetiler_table_attach (table, l, 0, 5, 3);
+ auto l = checkbox (_("Alternate the sign of shifts for each column"), "shiftx_alternate");
+ table_attach (table, l, 0, 5, 3);
}
{ // Cumulate
@@ -278,17 +269,17 @@ CloneTiler::CloneTiler () :
// TRANSLATORS: "Cumulate" is a verb here
gtk_label_set_markup (GTK_LABEL(l), _("<small>Cumulate:</small>"));
gtk_size_group_add_widget(table_row_labels, l);
- clonetiler_table_attach (table, l, 1, 6, 1);
+ table_attach (table, l, 1, 6, 1);
}
{
- GtkWidget *l = clonetiler_checkbox (_("Cumulate the shifts for each row"), "shifty_cumulate");
- clonetiler_table_attach (table, l, 0, 6, 2);
+ auto l = checkbox (_("Cumulate the shifts for each row"), "shifty_cumulate");
+ table_attach (table, l, 0, 6, 2);
}
{
- GtkWidget *l = clonetiler_checkbox (_("Cumulate the shifts for each column"), "shiftx_cumulate");
- clonetiler_table_attach (table, l, 0, 6, 3);
+ auto l = checkbox (_("Cumulate the shifts for each column"), "shiftx_cumulate");
+ table_attach (table, l, 0, 6, 3);
}
{ // Exclude tile width and height in shift
@@ -296,17 +287,17 @@ CloneTiler::CloneTiler () :
// TRANSLATORS: "Cumulate" is a verb here
gtk_label_set_markup (GTK_LABEL(l), _("<small>Exclude tile:</small>"));
gtk_size_group_add_widget(table_row_labels, l);
- clonetiler_table_attach (table, l, 1, 7, 1);
+ table_attach (table, l, 1, 7, 1);
}
{
- GtkWidget *l = clonetiler_checkbox (_("Exclude tile height in shift"), "shifty_excludeh");
- clonetiler_table_attach (table, l, 0, 7, 2);
+ auto l = checkbox (_("Exclude tile height in shift"), "shifty_excludeh");
+ table_attach (table, l, 0, 7, 2);
}
{
- GtkWidget *l = clonetiler_checkbox (_("Exclude tile width in shift"), "shiftx_excludew");
- clonetiler_table_attach (table, l, 0, 7, 3);
+ auto l = checkbox (_("Exclude tile width in shift"), "shiftx_excludew");
+ table_attach (table, l, 0, 7, 3);
}
}
@@ -314,9 +305,9 @@ CloneTiler::CloneTiler () :
// Scale
{
- GtkWidget *vb = clonetiler_new_tab (nb, _("Sc_ale"));
+ GtkWidget *vb = new_tab (nb, _("Sc_ale"));
- GtkWidget *table = clonetiler_table_x_y_rand (2);
+ GtkWidget *table = table_x_y_rand (2);
gtk_box_pack_start (GTK_BOX (vb), table, FALSE, FALSE, 0);
// X
@@ -324,29 +315,29 @@ CloneTiler::CloneTiler () :
GtkWidget *l = gtk_label_new ("");
gtk_label_set_markup (GTK_LABEL(l), _("<b>Scale X:</b>"));
gtk_size_group_add_widget(table_row_labels, l);
- clonetiler_table_attach (table, l, 1, 2, 1);
+ table_attach (table, l, 1, 2, 1);
}
{
- GtkWidget *l = clonetiler_spinbox (
+ auto l = spinbox (
// xgettext:no-c-format
_("Horizontal scale per row (in % of tile width)"), "scalex_per_j",
-100, 1000, "%");
- clonetiler_table_attach (table, l, 0, 2, 2);
+ table_attach (table, l, 0, 2, 2);
}
{
- GtkWidget *l = clonetiler_spinbox (
+ auto l = spinbox (
// xgettext:no-c-format
_("Horizontal scale per column (in % of tile width)"), "scalex_per_i",
-100, 1000, "%");
- clonetiler_table_attach (table, l, 0, 2, 3);
+ table_attach (table, l, 0, 2, 3);
}
{
- GtkWidget *l = clonetiler_spinbox (_("Randomize the horizontal scale by this percentage"), "scalex_rand",
+ auto l = spinbox (_("Randomize the horizontal scale by this percentage"), "scalex_rand",
0, 1000, "%");
- clonetiler_table_attach (table, l, 0, 2, 4);
+ table_attach (table, l, 0, 2, 4);
}
// Y
@@ -354,29 +345,29 @@ CloneTiler::CloneTiler () :
GtkWidget *l = gtk_label_new ("");
gtk_label_set_markup (GTK_LABEL(l), _("<b>Scale Y:</b>"));
gtk_size_group_add_widget(table_row_labels, l);
- clonetiler_table_attach (table, l, 1, 3, 1);
+ table_attach (table, l, 1, 3, 1);
}
{
- GtkWidget *l = clonetiler_spinbox (
+ auto l = spinbox (
// xgettext:no-c-format
_("Vertical scale per row (in % of tile height)"), "scaley_per_j",
-100, 1000, "%");
- clonetiler_table_attach (table, l, 0, 3, 2);
+ table_attach (table, l, 0, 3, 2);
}
{
- GtkWidget *l = clonetiler_spinbox (
+ auto l = spinbox (
// xgettext:no-c-format
_("Vertical scale per column (in % of tile height)"), "scaley_per_i",
-100, 1000, "%");
- clonetiler_table_attach (table, l, 0, 3, 3);
+ table_attach (table, l, 0, 3, 3);
}
{
- GtkWidget *l = clonetiler_spinbox (_("Randomize the vertical scale by this percentage"), "scaley_rand",
+ auto l = spinbox (_("Randomize the vertical scale by this percentage"), "scaley_rand",
0, 1000, "%");
- clonetiler_table_attach (table, l, 0, 3, 4);
+ table_attach (table, l, 0, 3, 4);
}
// Exponent
@@ -384,19 +375,19 @@ CloneTiler::CloneTiler () :
GtkWidget *l = gtk_label_new ("");
gtk_label_set_markup (GTK_LABEL(l), _("<b>Exponent:</b>"));
gtk_size_group_add_widget(table_row_labels, l);
- clonetiler_table_attach (table, l, 1, 4, 1);
+ table_attach (table, l, 1, 4, 1);
}
{
- GtkWidget *l = clonetiler_spinbox (_("Whether row scaling is uniform (1), converge (<1) or diverge (>1)"), "scaley_exp",
+ auto l = spinbox (_("Whether row scaling is uniform (1), converge (<1) or diverge (>1)"), "scaley_exp",
0, 10, "", true);
- clonetiler_table_attach (table, l, 0, 4, 2);
+ table_attach (table, l, 0, 4, 2);
}
{
- GtkWidget *l = clonetiler_spinbox (_("Whether column scaling is uniform (1), converge (<1) or diverge (>1)"), "scalex_exp",
+ auto l = spinbox (_("Whether column scaling is uniform (1), converge (<1) or diverge (>1)"), "scalex_exp",
0, 10, "", true);
- clonetiler_table_attach (table, l, 0, 4, 3);
+ table_attach (table, l, 0, 4, 3);
}
// Logarithmic (as in logarithmic spiral)
@@ -404,19 +395,19 @@ CloneTiler::CloneTiler () :
GtkWidget *l = gtk_label_new ("");
gtk_label_set_markup (GTK_LABEL(l), _("<b>Base:</b>"));
gtk_size_group_add_widget(table_row_labels, l);
- clonetiler_table_attach (table, l, 1, 5, 1);
+ table_attach (table, l, 1, 5, 1);
}
{
- GtkWidget *l = clonetiler_spinbox (_("Base for a logarithmic spiral: not used (0), converge (<1), or diverge (>1)"), "scaley_log",
+ auto l = spinbox (_("Base for a logarithmic spiral: not used (0), converge (<1), or diverge (>1)"), "scaley_log",
0, 10, "", false);
- clonetiler_table_attach (table, l, 0, 5, 2);
+ table_attach (table, l, 0, 5, 2);
}
{
- GtkWidget *l = clonetiler_spinbox (_("Base for a logarithmic spiral: not used (0), converge (<1), or diverge (>1)"), "scalex_log",
+ auto l = spinbox (_("Base for a logarithmic spiral: not used (0), converge (<1), or diverge (>1)"), "scalex_log",
0, 10, "", false);
- clonetiler_table_attach (table, l, 0, 5, 3);
+ table_attach (table, l, 0, 5, 3);
}
{ // alternates
@@ -424,17 +415,17 @@ CloneTiler::CloneTiler () :
// TRANSLATORS: "Alternate" is a verb here
gtk_label_set_markup (GTK_LABEL(l), _("<small>Alternate:</small>"));
gtk_size_group_add_widget(table_row_labels, l);
- clonetiler_table_attach (table, l, 1, 6, 1);
+ table_attach (table, l, 1, 6, 1);
}
{
- GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of scales for each row"), "scaley_alternate");
- clonetiler_table_attach (table, l, 0, 6, 2);
+ auto l = checkbox (_("Alternate the sign of scales for each row"), "scaley_alternate");
+ table_attach (table, l, 0, 6, 2);
}
{
- GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of scales for each column"), "scalex_alternate");
- clonetiler_table_attach (table, l, 0, 6, 3);
+ auto l = checkbox (_("Alternate the sign of scales for each column"), "scalex_alternate");
+ table_attach (table, l, 0, 6, 3);
}
{ // Cumulate
@@ -442,17 +433,17 @@ CloneTiler::CloneTiler () :
// TRANSLATORS: "Cumulate" is a verb here
gtk_label_set_markup (GTK_LABEL(l), _("<small>Cumulate:</small>"));
gtk_size_group_add_widget(table_row_labels, l);
- clonetiler_table_attach (table, l, 1, 7, 1);
+ table_attach (table, l, 1, 7, 1);
}
{
- GtkWidget *l = clonetiler_checkbox (_("Cumulate the scales for each row"), "scaley_cumulate");
- clonetiler_table_attach (table, l, 0, 7, 2);
+ auto l = checkbox (_("Cumulate the scales for each row"), "scaley_cumulate");
+ table_attach (table, l, 0, 7, 2);
}
{
- GtkWidget *l = clonetiler_checkbox (_("Cumulate the scales for each column"), "scalex_cumulate");
- clonetiler_table_attach (table, l, 0, 7, 3);
+ auto l = checkbox (_("Cumulate the scales for each column"), "scalex_cumulate");
+ table_attach (table, l, 0, 7, 3);
}
}
@@ -460,9 +451,9 @@ CloneTiler::CloneTiler () :
// Rotation
{
- GtkWidget *vb = clonetiler_new_tab (nb, _("_Rotation"));
+ GtkWidget *vb = new_tab (nb, _("_Rotation"));
- GtkWidget *table = clonetiler_table_x_y_rand (1);
+ GtkWidget *table = table_x_y_rand (1);
gtk_box_pack_start (GTK_BOX (vb), table, FALSE, FALSE, 0);
// Angle
@@ -470,29 +461,29 @@ CloneTiler::CloneTiler () :
GtkWidget *l = gtk_label_new ("");
gtk_label_set_markup (GTK_LABEL(l), _("<b>Angle:</b>"));
gtk_size_group_add_widget(table_row_labels, l);
- clonetiler_table_attach (table, l, 1, 2, 1);
+ table_attach (table, l, 1, 2, 1);
}
{
- GtkWidget *l = clonetiler_spinbox (
+ auto l = spinbox (
// xgettext:no-c-format
_("Rotate tiles by this angle for each row"), "rotate_per_j",
-180, 180, "&#176;");
- clonetiler_table_attach (table, l, 0, 2, 2);
+ table_attach (table, l, 0, 2, 2);
}
{
- GtkWidget *l = clonetiler_spinbox (
+ auto l = spinbox (
// xgettext:no-c-format
_("Rotate tiles by this angle for each column"), "rotate_per_i",
-180, 180, "&#176;");
- clonetiler_table_attach (table, l, 0, 2, 3);
+ table_attach (table, l, 0, 2, 3);
}
{
- GtkWidget *l = clonetiler_spinbox (_("Randomize the rotation angle by this percentage"), "rotate_rand",
+ auto l = spinbox (_("Randomize the rotation angle by this percentage"), "rotate_rand",
0, 100, "%");
- clonetiler_table_attach (table, l, 0, 2, 4);
+ table_attach (table, l, 0, 2, 4);
}
{ // alternates
@@ -500,17 +491,17 @@ CloneTiler::CloneTiler () :
// TRANSLATORS: "Alternate" is a verb here
gtk_label_set_markup (GTK_LABEL(l), _("<small>Alternate:</small>"));
gtk_size_group_add_widget(table_row_labels, l);
- clonetiler_table_attach (table, l, 1, 3, 1);
+ table_attach (table, l, 1, 3, 1);
}
{
- GtkWidget *l = clonetiler_checkbox (_("Alternate the rotation direction for each row"), "rotate_alternatej");
- clonetiler_table_attach (table, l, 0, 3, 2);
+ auto l = checkbox (_("Alternate the rotation direction for each row"), "rotate_alternatej");
+ table_attach (table, l, 0, 3, 2);
}
{
- GtkWidget *l = clonetiler_checkbox (_("Alternate the rotation direction for each column"), "rotate_alternatei");
- clonetiler_table_attach (table, l, 0, 3, 3);
+ auto l = checkbox (_("Alternate the rotation direction for each column"), "rotate_alternatei");
+ table_attach (table, l, 0, 3, 3);
}
{ // Cumulate
@@ -518,17 +509,17 @@ CloneTiler::CloneTiler () :
// TRANSLATORS: "Cumulate" is a verb here
gtk_label_set_markup (GTK_LABEL(l), _("<small>Cumulate:</small>"));
gtk_size_group_add_widget(table_row_labels, l);
- clonetiler_table_attach (table, l, 1, 4, 1);
+ table_attach (table, l, 1, 4, 1);
}
{
- GtkWidget *l = clonetiler_checkbox (_("Cumulate the rotation for each row"), "rotate_cumulatej");
- clonetiler_table_attach (table, l, 0, 4, 2);
+ auto l = checkbox (_("Cumulate the rotation for each row"), "rotate_cumulatej");
+ table_attach (table, l, 0, 4, 2);
}
{
- GtkWidget *l = clonetiler_checkbox (_("Cumulate the rotation for each column"), "rotate_cumulatei");
- clonetiler_table_attach (table, l, 0, 4, 3);
+ auto l = checkbox (_("Cumulate the rotation for each column"), "rotate_cumulatei");
+ table_attach (table, l, 0, 4, 3);
}
}
@@ -536,9 +527,9 @@ CloneTiler::CloneTiler () :
// Blur and opacity
{
- GtkWidget *vb = clonetiler_new_tab (nb, _("_Blur & opacity"));
+ GtkWidget *vb = new_tab (nb, _("_Blur & opacity"));
- GtkWidget *table = clonetiler_table_x_y_rand (1);
+ GtkWidget *table = table_x_y_rand (1);
gtk_box_pack_start (GTK_BOX (vb), table, FALSE, FALSE, 0);
@@ -547,25 +538,25 @@ CloneTiler::CloneTiler () :
GtkWidget *l = gtk_label_new ("");
gtk_label_set_markup (GTK_LABEL(l), _("<b>Blur:</b>"));
gtk_size_group_add_widget(table_row_labels, l);
- clonetiler_table_attach (table, l, 1, 2, 1);
+ table_attach (table, l, 1, 2, 1);
}
{
- GtkWidget *l = clonetiler_spinbox (_("Blur tiles by this percentage for each row"), "blur_per_j",
+ auto l = spinbox (_("Blur tiles by this percentage for each row"), "blur_per_j",
0, 100, "%");
- clonetiler_table_attach (table, l, 0, 2, 2);
+ table_attach (table, l, 0, 2, 2);
}
{
- GtkWidget *l = clonetiler_spinbox (_("Blur tiles by this percentage for each column"), "blur_per_i",
+ auto l = spinbox (_("Blur tiles by this percentage for each column"), "blur_per_i",
0, 100, "%");
- clonetiler_table_attach (table, l, 0, 2, 3);
+ table_attach (table, l, 0, 2, 3);
}
{
- GtkWidget *l = clonetiler_spinbox (_("Randomize the tile blur by this percentage"), "blur_rand",
+ auto l = spinbox (_("Randomize the tile blur by this percentage"), "blur_rand",
0, 100, "%");
- clonetiler_table_attach (table, l, 0, 2, 4);
+ table_attach (table, l, 0, 2, 4);
}
{ // alternates
@@ -573,17 +564,17 @@ CloneTiler::CloneTiler () :
// TRANSLATORS: "Alternate" is a verb here
gtk_label_set_markup (GTK_LABEL(l), _("<small>Alternate:</small>"));
gtk_size_group_add_widget(table_row_labels, l);
- clonetiler_table_attach (table, l, 1, 3, 1);
+ table_attach (table, l, 1, 3, 1);
}
{
- GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of blur change for each row"), "blur_alternatej");
- clonetiler_table_attach (table, l, 0, 3, 2);
+ auto l = checkbox (_("Alternate the sign of blur change for each row"), "blur_alternatej");
+ table_attach (table, l, 0, 3, 2);
}
{
- GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of blur change for each column"), "blur_alternatei");
- clonetiler_table_attach (table, l, 0, 3, 3);
+ auto l = checkbox (_("Alternate the sign of blur change for each column"), "blur_alternatei");
+ table_attach (table, l, 0, 3, 3);
}
@@ -593,25 +584,25 @@ CloneTiler::CloneTiler () :
GtkWidget *l = gtk_label_new ("");
gtk_label_set_markup (GTK_LABEL(l), _("<b>Opacity:</b>"));
gtk_size_group_add_widget(table_row_labels, l);
- clonetiler_table_attach (table, l, 1, 4, 1);
+ table_attach (table, l, 1, 4, 1);
}
{
- GtkWidget *l = clonetiler_spinbox (_("Decrease tile opacity by this percentage for each row"), "opacity_per_j",
+ auto l = spinbox (_("Decrease tile opacity by this percentage for each row"), "opacity_per_j",
0, 100, "%");
- clonetiler_table_attach (table, l, 0, 4, 2);
+ table_attach (table, l, 0, 4, 2);
}
{
- GtkWidget *l = clonetiler_spinbox (_("Decrease tile opacity by this percentage for each column"), "opacity_per_i",
+ auto l = spinbox (_("Decrease tile opacity by this percentage for each column"), "opacity_per_i",
0, 100, "%");
- clonetiler_table_attach (table, l, 0, 4, 3);
+ table_attach (table, l, 0, 4, 3);
}
{
- GtkWidget *l = clonetiler_spinbox (_("Randomize the tile opacity by this percentage"), "opacity_rand",
+ auto l = spinbox (_("Randomize the tile opacity by this percentage"), "opacity_rand",
0, 100, "%");
- clonetiler_table_attach (table, l, 0, 4, 4);
+ table_attach (table, l, 0, 4, 4);
}
{ // alternates
@@ -619,39 +610,35 @@ CloneTiler::CloneTiler () :
// TRANSLATORS: "Alternate" is a verb here
gtk_label_set_markup (GTK_LABEL(l), _("<small>Alternate:</small>"));
gtk_size_group_add_widget(table_row_labels, l);
- clonetiler_table_attach (table, l, 1, 5, 1);
+ table_attach (table, l, 1, 5, 1);
}
{
- GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of opacity change for each row"), "opacity_alternatej");
- clonetiler_table_attach (table, l, 0, 5, 2);
+ auto l = checkbox (_("Alternate the sign of opacity change for each row"), "opacity_alternatej");
+ table_attach (table, l, 0, 5, 2);
}
{
- GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of opacity change for each column"), "opacity_alternatei");
- clonetiler_table_attach (table, l, 0, 5, 3);
+ auto l = checkbox (_("Alternate the sign of opacity change for each column"), "opacity_alternatei");
+ table_attach (table, l, 0, 5, 3);
}
}
// Color
{
- GtkWidget *vb = clonetiler_new_tab (nb, _("Co_lor"));
+ GtkWidget *vb = new_tab (nb, _("Co_lor"));
{
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
+ auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_set_homogeneous(GTK_BOX(hb), FALSE);
-#else
- GtkWidget *hb = gtk_hbox_new (FALSE, 0);
-#endif
GtkWidget *l = gtk_label_new (_("Initial color: "));
gtk_box_pack_start (GTK_BOX (hb), l, FALSE, FALSE, 0);
guint32 rgba = 0x000000ff | sp_svg_read_color (prefs->getString(prefs_path + "initial_color").data(), 0x000000ff);
color_picker = new Inkscape::UI::Widget::ColorPicker (*new Glib::ustring(_("Initial color of tiled clones")), *new Glib::ustring(_("Initial color for clones (works only if the original has unset fill or stroke or on spray tool in copy mode)")), rgba, false);
- color_changed_connection = color_picker->connectChanged (sigc::ptr_fun(on_picker_color_changed));
+ color_changed_connection = color_picker->connectChanged(sigc::mem_fun(*this, &CloneTiler::on_picker_color_changed));
gtk_box_pack_start (GTK_BOX (hb), reinterpret_cast<GtkWidget*>(color_picker->gobj()), FALSE, FALSE, 0);
@@ -659,7 +646,7 @@ CloneTiler::CloneTiler () :
}
- GtkWidget *table = clonetiler_table_x_y_rand (3);
+ GtkWidget *table = table_x_y_rand (3);
gtk_box_pack_start (GTK_BOX (vb), table, FALSE, FALSE, 0);
// Hue
@@ -667,25 +654,25 @@ CloneTiler::CloneTiler () :
GtkWidget *l = gtk_label_new ("");
gtk_label_set_markup (GTK_LABEL(l), _("<b>H:</b>"));
gtk_size_group_add_widget(table_row_labels, l);
- clonetiler_table_attach (table, l, 1, 2, 1);
+ table_attach (table, l, 1, 2, 1);
}
{
- GtkWidget *l = clonetiler_spinbox (_("Change the tile hue by this percentage for each row"), "hue_per_j",
+ auto l = spinbox (_("Change the tile hue by this percentage for each row"), "hue_per_j",
-100, 100, "%");
- clonetiler_table_attach (table, l, 0, 2, 2);
+ table_attach (table, l, 0, 2, 2);
}
{
- GtkWidget *l = clonetiler_spinbox (_("Change the tile hue by this percentage for each column"), "hue_per_i",
+ auto l = spinbox (_("Change the tile hue by this percentage for each column"), "hue_per_i",
-100, 100, "%");
- clonetiler_table_attach (table, l, 0, 2, 3);
+ table_attach (table, l, 0, 2, 3);
}
{
- GtkWidget *l = clonetiler_spinbox (_("Randomize the tile hue by this percentage"), "hue_rand",
+ auto l = spinbox (_("Randomize the tile hue by this percentage"), "hue_rand",
0, 100, "%");
- clonetiler_table_attach (table, l, 0, 2, 4);
+ table_attach (table, l, 0, 2, 4);
}
@@ -694,25 +681,25 @@ CloneTiler::CloneTiler () :
GtkWidget *l = gtk_label_new ("");
gtk_label_set_markup (GTK_LABEL(l), _("<b>S:</b>"));
gtk_size_group_add_widget(table_row_labels, l);
- clonetiler_table_attach (table, l, 1, 3, 1);
+ table_attach (table, l, 1, 3, 1);
}
{
- GtkWidget *l = clonetiler_spinbox (_("Change the color saturation by this percentage for each row"), "saturation_per_j",
+ auto l = spinbox (_("Change the color saturation by this percentage for each row"), "saturation_per_j",
-100, 100, "%");
- clonetiler_table_attach (table, l, 0, 3, 2);
+ table_attach (table, l, 0, 3, 2);
}
{
- GtkWidget *l = clonetiler_spinbox (_("Change the color saturation by this percentage for each column"), "saturation_per_i",
+ auto l = spinbox (_("Change the color saturation by this percentage for each column"), "saturation_per_i",
-100, 100, "%");
- clonetiler_table_attach (table, l, 0, 3, 3);
+ table_attach (table, l, 0, 3, 3);
}
{
- GtkWidget *l = clonetiler_spinbox (_("Randomize the color saturation by this percentage"), "saturation_rand",
+ auto l = spinbox (_("Randomize the color saturation by this percentage"), "saturation_rand",
0, 100, "%");
- clonetiler_table_attach (table, l, 0, 3, 4);
+ table_attach (table, l, 0, 3, 4);
}
// Lightness
@@ -720,25 +707,25 @@ CloneTiler::CloneTiler () :
GtkWidget *l = gtk_label_new ("");
gtk_label_set_markup (GTK_LABEL(l), _("<b>L:</b>"));
gtk_size_group_add_widget(table_row_labels, l);
- clonetiler_table_attach (table, l, 1, 4, 1);
+ table_attach (table, l, 1, 4, 1);
}
{
- GtkWidget *l = clonetiler_spinbox (_("Change the color lightness by this percentage for each row"), "lightness_per_j",
+ auto l = spinbox (_("Change the color lightness by this percentage for each row"), "lightness_per_j",
-100, 100, "%");
- clonetiler_table_attach (table, l, 0, 4, 2);
+ table_attach (table, l, 0, 4, 2);
}
{
- GtkWidget *l = clonetiler_spinbox (_("Change the color lightness by this percentage for each column"), "lightness_per_i",
+ auto l = spinbox (_("Change the color lightness by this percentage for each column"), "lightness_per_i",
-100, 100, "%");
- clonetiler_table_attach (table, l, 0, 4, 3);
+ table_attach (table, l, 0, 4, 3);
}
{
- GtkWidget *l = clonetiler_spinbox (_("Randomize the color lightness by this percentage"), "lightness_rand",
+ auto l = spinbox (_("Randomize the color lightness by this percentage"), "lightness_rand",
0, 100, "%");
- clonetiler_table_attach (table, l, 0, 4, 4);
+ table_attach (table, l, 0, 4, 4);
}
@@ -746,135 +733,109 @@ CloneTiler::CloneTiler () :
GtkWidget *l = gtk_label_new ("");
gtk_label_set_markup (GTK_LABEL(l), _("<small>Alternate:</small>"));
gtk_size_group_add_widget(table_row_labels, l);
- clonetiler_table_attach (table, l, 1, 5, 1);
+ table_attach (table, l, 1, 5, 1);
}
{
- GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of color changes for each row"), "color_alternatej");
- clonetiler_table_attach (table, l, 0, 5, 2);
+ auto l = checkbox (_("Alternate the sign of color changes for each row"), "color_alternatej");
+ table_attach (table, l, 0, 5, 2);
}
{
- GtkWidget *l = clonetiler_checkbox (_("Alternate the sign of color changes for each column"), "color_alternatei");
- clonetiler_table_attach (table, l, 0, 5, 3);
+ auto l = checkbox (_("Alternate the sign of color changes for each column"), "color_alternatei");
+ table_attach (table, l, 0, 5, 3);
}
}
// Trace
{
- GtkWidget *vb = clonetiler_new_tab (nb, _("_Trace"));
+ GtkWidget *vb = new_tab (nb, _("_Trace"));
{
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN);
+ auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN);
gtk_box_set_homogeneous(GTK_BOX(hb), FALSE);
-#else
- GtkWidget *hb = gtk_hbox_new(FALSE, VB_MARGIN);
-#endif
gtk_box_pack_start (GTK_BOX (vb), hb, FALSE, FALSE, 0);
- b = gtk_check_button_new_with_label (_("Trace the drawing under the clones/sprayed items"));
- g_object_set_data (G_OBJECT(b), "uncheckable", GINT_TO_POINTER(TRUE));
+ _b = Gtk::manage(new Gtk::CheckButton(_("Trace the drawing under the clones/sprayed items")));
+ _b->set_data("uncheckable", GINT_TO_POINTER(TRUE));
bool old = prefs->getBool(prefs_path + "dotrace");
- gtk_toggle_button_set_active ((GtkToggleButton *) b, old);
- gtk_widget_set_tooltip_text (b, _("For each clone/sprayed item, pick a value from the drawing in its location and apply it"));
- gtk_box_pack_start (GTK_BOX (hb), b, FALSE, FALSE, 0);
-
- g_signal_connect(G_OBJECT(b), "toggled",
- G_CALLBACK(clonetiler_do_pick_toggled), (gpointer)dlg);
+ _b->set_active(old);
+ _b->set_tooltip_text(_("For each clone/sprayed item, pick a value from the drawing in its location and apply it"));
+ gtk_box_pack_start (GTK_BOX (hb), GTK_WIDGET(_b->gobj()), FALSE, FALSE, 0);
+ _b->signal_toggled().connect(sigc::mem_fun(*this, &CloneTiler::do_pick_toggled));
}
{
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *vvb = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
+ auto vvb = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_box_set_homogeneous(GTK_BOX(vvb), FALSE);
-#else
- GtkWidget *vvb = gtk_vbox_new (FALSE, 0);
-#endif
gtk_box_pack_start (GTK_BOX (vb), vvb, FALSE, FALSE, 0);
- g_object_set_data (G_OBJECT(dlg), "dotrace", (gpointer) vvb);
-
+ _dotrace = vvb;
{
GtkWidget *frame = gtk_frame_new (_("1. Pick from the drawing:"));
gtk_box_pack_start (GTK_BOX (vvb), frame, FALSE, FALSE, 0);
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *table = gtk_grid_new();
+ auto table = gtk_grid_new();
gtk_grid_set_row_spacing(GTK_GRID(table), 4);
gtk_grid_set_column_spacing(GTK_GRID(table), 6);
-#else
- GtkWidget *table = gtk_table_new (3, 3, FALSE);
- gtk_table_set_row_spacings (GTK_TABLE (table), 4);
- gtk_table_set_col_spacings (GTK_TABLE (table), 6);
-#endif
gtk_container_add(GTK_CONTAINER(frame), table);
-
- GtkWidget* radio;
+ Gtk::RadioButtonGroup rb_group;
{
- radio = gtk_radio_button_new_with_label (NULL, _("Color"));
- gtk_widget_set_tooltip_text (radio, _("Pick the visible color and opacity"));
- clonetiler_table_attach (table, radio, 0.0, 1, 1);
- g_signal_connect (G_OBJECT (radio), "toggled",
- G_CALLBACK (clonetiler_pick_switched), GINT_TO_POINTER(PICK_COLOR));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_COLOR);
+ auto radio = Gtk::manage(new Gtk::RadioButton(rb_group, _("Color")));
+ radio->set_tooltip_text(_("Pick the visible color and opacity"));
+ table_attach(table, radio, 0.0, 1, 1);
+ radio->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::pick_switched), PICK_COLOR));
+ radio->set_active(prefs->getInt(prefs_path + "pick", 0) == PICK_COLOR);
}
{
- radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), _("Opacity"));
- gtk_widget_set_tooltip_text (radio, _("Pick the total accumulated opacity"));
- clonetiler_table_attach (table, radio, 0.0, 2, 1);
- g_signal_connect (G_OBJECT (radio), "toggled",
- G_CALLBACK (clonetiler_pick_switched), GINT_TO_POINTER(PICK_OPACITY));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_OPACITY);
+ auto radio = Gtk::manage(new Gtk::RadioButton(rb_group, _("Opacity")));
+ radio->set_tooltip_text(_("Pick the total accumulated opacity"));
+ table_attach (table, radio, 0.0, 2, 1);
+ radio->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::pick_switched), PICK_OPACITY));
+ radio->set_active(prefs->getInt(prefs_path + "pick", 0) == PICK_OPACITY);
}
{
- radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), _("R"));
- gtk_widget_set_tooltip_text (radio, _("Pick the Red component of the color"));
- clonetiler_table_attach (table, radio, 0.0, 1, 2);
- g_signal_connect (G_OBJECT (radio), "toggled",
- G_CALLBACK (clonetiler_pick_switched), GINT_TO_POINTER(PICK_R));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_R);
+ auto radio = Gtk::manage(new Gtk::RadioButton(rb_group, _("R")));
+ radio->set_tooltip_text(_("Pick the Red component of the color"));
+ table_attach (table, radio, 0.0, 1, 2);
+ radio->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::pick_switched), PICK_R));
+ radio->set_active(prefs->getInt(prefs_path + "pick", 0) == PICK_R);
}
{
- radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), _("G"));
- gtk_widget_set_tooltip_text (radio, _("Pick the Green component of the color"));
- clonetiler_table_attach (table, radio, 0.0, 2, 2);
- g_signal_connect (G_OBJECT (radio), "toggled",
- G_CALLBACK (clonetiler_pick_switched), GINT_TO_POINTER(PICK_G));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_G);
+ auto radio = Gtk::manage(new Gtk::RadioButton(rb_group, _("G")));
+ radio->set_tooltip_text(_("Pick the Green component of the color"));
+ table_attach (table, radio, 0.0, 2, 2);
+ radio->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::pick_switched), PICK_G));
+ radio->set_active(prefs->getInt(prefs_path + "pick", 0) == PICK_G);
}
{
- radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), _("B"));
- gtk_widget_set_tooltip_text (radio, _("Pick the Blue component of the color"));
- clonetiler_table_attach (table, radio, 0.0, 3, 2);
- g_signal_connect (G_OBJECT (radio), "toggled",
- G_CALLBACK (clonetiler_pick_switched), GINT_TO_POINTER(PICK_B));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_B);
+ auto radio = Gtk::manage(new Gtk::RadioButton(rb_group, _("B")));
+ radio->set_tooltip_text(_("Pick the Blue component of the color"));
+ table_attach (table, radio, 0.0, 3, 2);
+ radio->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::pick_switched), PICK_B));
+ radio->set_active(prefs->getInt(prefs_path + "pick", 0) == PICK_B);
}
{
- radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), C_("Clonetiler color hue", "H"));
- gtk_widget_set_tooltip_text (radio, _("Pick the hue of the color"));
- clonetiler_table_attach (table, radio, 0.0, 1, 3);
- g_signal_connect (G_OBJECT (radio), "toggled",
- G_CALLBACK (clonetiler_pick_switched), GINT_TO_POINTER(PICK_H));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_H);
+ auto radio = Gtk::manage(new Gtk::RadioButton(rb_group, C_("Clonetiler color hue", "H")));
+ radio->set_tooltip_text(_("Pick the hue of the color"));
+ table_attach (table, radio, 0.0, 1, 3);
+ radio->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::pick_switched), PICK_H));
+ radio->set_active(prefs->getInt(prefs_path + "pick", 0) == PICK_H);
}
{
- radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), C_("Clonetiler color saturation", "S"));
- gtk_widget_set_tooltip_text (radio, _("Pick the saturation of the color"));
- clonetiler_table_attach (table, radio, 0.0, 2, 3);
- g_signal_connect (G_OBJECT (radio), "toggled",
- G_CALLBACK (clonetiler_pick_switched), GINT_TO_POINTER(PICK_S));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_S);
+ auto radio = Gtk::manage(new Gtk::RadioButton(rb_group, C_("Clonetiler color saturation", "S")));
+ radio->set_tooltip_text(_("Pick the saturation of the color"));
+ table_attach (table, radio, 0.0, 2, 3);
+ radio->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::pick_switched), PICK_S));
+ radio->set_active(prefs->getInt(prefs_path + "pick", 0) == PICK_S);
}
{
- radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), C_("Clonetiler color lightness", "L"));
- gtk_widget_set_tooltip_text (radio, _("Pick the lightness of the color"));
- clonetiler_table_attach (table, radio, 0.0, 3, 3);
- g_signal_connect (G_OBJECT (radio), "toggled",
- G_CALLBACK (clonetiler_pick_switched), GINT_TO_POINTER(PICK_L));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), prefs->getInt(prefs_path + "pick", 0) == PICK_L);
+ auto radio = Gtk::manage(new Gtk::RadioButton(rb_group, C_("Clonetiler color lightness", "L")));
+ radio->set_tooltip_text(_("Pick the lightness of the color"));
+ table_attach (table, radio, 0.0, 3, 3);
+ radio->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::pick_switched), PICK_L));
+ radio->set_active(prefs->getInt(prefs_path + "pick", 0) == PICK_L);
}
}
@@ -883,48 +844,42 @@ CloneTiler::CloneTiler () :
GtkWidget *frame = gtk_frame_new (_("2. Tweak the picked value:"));
gtk_box_pack_start (GTK_BOX (vvb), frame, FALSE, FALSE, VB_MARGIN);
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *table = gtk_grid_new();
+ auto table = gtk_grid_new();
gtk_grid_set_row_spacing(GTK_GRID(table), 4);
gtk_grid_set_column_spacing(GTK_GRID(table), 6);
-#else
- GtkWidget *table = gtk_table_new (4, 2, FALSE);
- gtk_table_set_row_spacings (GTK_TABLE (table), 4);
- gtk_table_set_col_spacings (GTK_TABLE (table), 6);
-#endif
gtk_container_add(GTK_CONTAINER(frame), table);
{
GtkWidget *l = gtk_label_new ("");
gtk_label_set_markup (GTK_LABEL(l), _("Gamma-correct:"));
- clonetiler_table_attach (table, l, 1.0, 1, 1);
+ table_attach (table, l, 1.0, 1, 1);
}
{
- GtkWidget *l = clonetiler_spinbox (_("Shift the mid-range of the picked value upwards (>0) or downwards (<0)"), "gamma_picked",
+ auto l = spinbox (_("Shift the mid-range of the picked value upwards (>0) or downwards (<0)"), "gamma_picked",
-10, 10, "");
- clonetiler_table_attach (table, l, 0.0, 1, 2);
+ table_attach (table, l, 0.0, 1, 2);
}
{
GtkWidget *l = gtk_label_new ("");
gtk_label_set_markup (GTK_LABEL(l), _("Randomize:"));
- clonetiler_table_attach (table, l, 1.0, 1, 3);
+ table_attach (table, l, 1.0, 1, 3);
}
{
- GtkWidget *l = clonetiler_spinbox (_("Randomize the picked value by this percentage"), "rand_picked",
+ auto l = spinbox (_("Randomize the picked value by this percentage"), "rand_picked",
0, 100, "%");
- clonetiler_table_attach (table, l, 0.0, 1, 4);
+ table_attach (table, l, 0.0, 1, 4);
}
{
GtkWidget *l = gtk_label_new ("");
gtk_label_set_markup (GTK_LABEL(l), _("Invert:"));
- clonetiler_table_attach (table, l, 1.0, 2, 1);
+ table_attach (table, l, 1.0, 2, 1);
}
{
- GtkWidget *l = clonetiler_checkbox (_("Invert the picked value"), "invert_picked");
- clonetiler_table_attach (table, l, 0.0, 2, 2);
+ auto l = checkbox (_("Invert the picked value"), "invert_picked");
+ table_attach (table, l, 0.0, 2, 2);
}
}
@@ -932,55 +887,45 @@ CloneTiler::CloneTiler () :
GtkWidget *frame = gtk_frame_new (_("3. Apply the value to the clones':"));
gtk_box_pack_start (GTK_BOX (vvb), frame, FALSE, FALSE, 0);
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *table = gtk_grid_new();
+ auto table = gtk_grid_new();
gtk_grid_set_row_spacing(GTK_GRID(table), 4);
gtk_grid_set_column_spacing(GTK_GRID(table), 6);
-#else
- GtkWidget *table = gtk_table_new (2, 2, FALSE);
- gtk_table_set_row_spacings (GTK_TABLE (table), 4);
- gtk_table_set_col_spacings (GTK_TABLE (table), 6);
-#endif
gtk_container_add(GTK_CONTAINER(frame), table);
{
- GtkWidget *b = gtk_check_button_new_with_label (_("Presence"));
+ auto b = Gtk::manage(new Gtk::CheckButton(_("Presence")));
bool old = prefs->getBool(prefs_path + "pick_to_presence", true);
- gtk_toggle_button_set_active ((GtkToggleButton *) b, old);
- gtk_widget_set_tooltip_text (b, _("Each clone is created with the probability determined by the picked value in that point"));
- clonetiler_table_attach (table, b, 0.0, 1, 1);
- g_signal_connect(G_OBJECT(b), "toggled",
- G_CALLBACK(clonetiler_pick_to), (gpointer) "pick_to_presence");
+ b->set_active(old);
+ b->set_tooltip_text(_("Each clone is created with the probability determined by the picked value in that point"));
+ table_attach (table, b, 0.0, 1, 1);
+ b->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::pick_to), b, "pick_to_presence"));
}
{
- GtkWidget *b = gtk_check_button_new_with_label (_("Size"));
+ auto b = Gtk::manage(new Gtk::CheckButton(_("Size")));
bool old = prefs->getBool(prefs_path + "pick_to_size");
- gtk_toggle_button_set_active ((GtkToggleButton *) b, old);
- gtk_widget_set_tooltip_text (b, _("Each clone's size is determined by the picked value in that point"));
- clonetiler_table_attach (table, b, 0.0, 2, 1);
- g_signal_connect(G_OBJECT(b), "toggled",
- G_CALLBACK(clonetiler_pick_to), (gpointer) "pick_to_size");
+ b->set_active(old);
+ b->set_tooltip_text(_("Each clone's size is determined by the picked value in that point"));
+ table_attach (table, b, 0.0, 2, 1);
+ b->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::pick_to), b, "pick_to_size"));
}
{
- GtkWidget *b = gtk_check_button_new_with_label (_("Color"));
+ auto b = Gtk::manage(new Gtk::CheckButton(_("Color")));
bool old = prefs->getBool(prefs_path + "pick_to_color", 0);
- gtk_toggle_button_set_active ((GtkToggleButton *) b, old);
- gtk_widget_set_tooltip_text (b, _("Each clone is painted by the picked color (the original must have unset fill or stroke)"));
- clonetiler_table_attach (table, b, 0.0, 1, 2);
- g_signal_connect(G_OBJECT(b), "toggled",
- G_CALLBACK(clonetiler_pick_to), (gpointer) "pick_to_color");
+ b->set_active(old);
+ b->set_tooltip_text(_("Each clone is painted by the picked color (the original must have unset fill or stroke)"));
+ table_attach (table, b, 0.0, 1, 2);
+ b->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::pick_to), b, "pick_to_color"));
}
{
- GtkWidget *b = gtk_check_button_new_with_label (_("Opacity"));
+ auto b = Gtk::manage(new Gtk::CheckButton(_("Opacity")));
bool old = prefs->getBool(prefs_path + "pick_to_opacity", 0);
- gtk_toggle_button_set_active ((GtkToggleButton *) b, old);
- gtk_widget_set_tooltip_text (b, _("Each clone's opacity is determined by the picked value in that point"));
- clonetiler_table_attach (table, b, 0.0, 2, 2);
- g_signal_connect(G_OBJECT(b), "toggled",
- G_CALLBACK(clonetiler_pick_to), (gpointer) "pick_to_opacity");
+ b->set_active(old);
+ b->set_tooltip_text(_("Each clone's opacity is determined by the picked value in that point"));
+ table_attach (table, b, 0.0, 2, 2);
+ b->signal_toggled().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::pick_to), b, "pick_to_opacity"));
}
}
gtk_widget_set_sensitive (vvb, prefs->getBool(prefs_path + "dotrace"));
@@ -988,12 +933,8 @@ CloneTiler::CloneTiler () :
}
{
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN);
+ auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN);
gtk_box_set_homogeneous(GTK_BOX(hb), FALSE);
-#else
- GtkWidget *hb = gtk_hbox_new(FALSE, VB_MARGIN);
-#endif
gtk_box_pack_start (GTK_BOX (mainbox), hb, FALSE, FALSE, 0);
GtkWidget *l = gtk_label_new(_(""));
gtk_label_set_markup (GTK_LABEL(l), _("Apply to tiled clones:"));
@@ -1001,296 +942,211 @@ CloneTiler::CloneTiler () :
}
// Rows/columns, width/height
{
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *table = gtk_grid_new();
+ auto table = gtk_grid_new();
gtk_grid_set_row_spacing(GTK_GRID(table), 4);
gtk_grid_set_column_spacing(GTK_GRID(table), 6);
-#else
- GtkWidget *table = gtk_table_new (2, 2, FALSE);
- gtk_table_set_row_spacings (GTK_TABLE (table), 4);
- gtk_table_set_col_spacings (GTK_TABLE (table), 6);
-#endif
gtk_container_set_border_width (GTK_CONTAINER (table), VB_MARGIN);
gtk_box_pack_start (GTK_BOX (mainbox), table, FALSE, FALSE, 0);
{
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN);
- gtk_box_set_homogeneous(GTK_BOX(hb), FALSE);
-#else
- GtkWidget *hb = gtk_hbox_new(FALSE, VB_MARGIN);
-#endif
- g_object_set_data (G_OBJECT(dlg), "rowscols", (gpointer) hb);
+ _rowscols = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, VB_MARGIN));
{
-#if WITH_GTKMM_3_0
- Glib::RefPtr<Gtk::Adjustment>a = Gtk::Adjustment::create(0.0, 1, 500, 1, 10, 0);
-#else
- Gtk::Adjustment *a = new Gtk::Adjustment (0.0, 1, 500, 1, 10, 0);
-#endif
+ auto a = Gtk::Adjustment::create(0.0, 1, 500, 1, 10, 0);
int value = prefs->getInt(prefs_path + "jmax", 2);
a->set_value (value);
-#if WITH_GTKMM_3_0
- Inkscape::UI::Widget::SpinButton *sb = new Inkscape::UI::Widget::SpinButton(a, 1.0, 0);
-#else
- Inkscape::UI::Widget::SpinButton *sb = new Inkscape::UI::Widget::SpinButton (*a, 1.0, 0);
-#endif
+ auto sb = new Inkscape::UI::Widget::SpinButton(a, 1.0, 0);
sb->set_tooltip_text (_("How many rows in the tiling"));
sb->set_width_chars (7);
- gtk_box_pack_start (GTK_BOX (hb), GTK_WIDGET(sb->gobj()), TRUE, TRUE, 0);
+ _rowscols->pack_start(*sb, true, true, 0);
- // TODO: C++ification
- g_signal_connect(G_OBJECT(a->gobj()), "value_changed",
- G_CALLBACK(clonetiler_xy_changed), (gpointer) "jmax");
+ a->signal_value_changed().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::xy_changed), a, "jmax"));
}
{
- GtkWidget *l = gtk_label_new ("");
- gtk_label_set_markup (GTK_LABEL(l), "&#215;");
-#if GTK_CHECK_VERSION(3,0,0)
- gtk_widget_set_halign(l, GTK_ALIGN_END);
-#else
- gtk_misc_set_alignment (GTK_MISC (l), 1.0, 0.5);
-#endif
- gtk_box_pack_start (GTK_BOX (hb), l, TRUE, TRUE, 0);
+ auto l = Gtk::manage(new Gtk::Label(""));
+ l->set_markup("&#215;");
+ l->set_halign(Gtk::ALIGN_END);
+ _rowscols->pack_start(*l, true, true, 0);
}
{
-#if WITH_GTKMM_3_0
- Glib::RefPtr<Gtk::Adjustment> a = Gtk::Adjustment::create(0.0, 1, 500, 1, 10, 0);
-#else
- Gtk::Adjustment *a = new Gtk::Adjustment (0.0, 1, 500, 1, 10, 0);
-#endif
+ auto a = Gtk::Adjustment::create(0.0, 1, 500, 1, 10, 0);
int value = prefs->getInt(prefs_path + "imax", 2);
a->set_value (value);
-#if WITH_GTKMM_3_0
- Inkscape::UI::Widget::SpinButton *sb = new Inkscape::UI::Widget::SpinButton(a, 1.0, 0);
-#else
- Inkscape::UI::Widget::SpinButton *sb = new Inkscape::UI::Widget::SpinButton (*a, 1.0, 0);
-#endif
+ auto sb = new Inkscape::UI::Widget::SpinButton(a, 1.0, 0);
sb->set_tooltip_text (_("How many columns in the tiling"));
sb->set_width_chars (7);
- gtk_box_pack_start (GTK_BOX (hb), GTK_WIDGET(sb->gobj()), TRUE, TRUE, 0);
+ _rowscols->pack_start(*sb, true, true, 0);
- // TODO: C++ification
- g_signal_connect(G_OBJECT(a->gobj()), "value_changed",
- G_CALLBACK(clonetiler_xy_changed), (gpointer) "imax");
+ a->signal_value_changed().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::xy_changed), a, "imax"));
}
- clonetiler_table_attach (table, hb, 0.0, 1, 2);
+ table_attach (table, GTK_WIDGET(_rowscols->gobj()), 0.0, 1, 2);
}
{
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN);
- gtk_box_set_homogeneous(GTK_BOX(hb), FALSE);
-#else
- GtkWidget *hb = gtk_hbox_new(FALSE, VB_MARGIN);
-#endif
- g_object_set_data (G_OBJECT(dlg), "widthheight", (gpointer) hb);
+ _widthheight = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, VB_MARGIN));
// unitmenu
unit_menu = new Inkscape::UI::Widget::UnitMenu();
unit_menu->setUnitType(Inkscape::Util::UNIT_TYPE_LINEAR);
unit_menu->setUnit(SP_ACTIVE_DESKTOP->getNamedView()->display_units->abbr);
- unitChangedConn = unit_menu->signal_changed().connect(sigc::mem_fun(*this, &CloneTiler::clonetiler_unit_changed));
+ unitChangedConn = unit_menu->signal_changed().connect(sigc::mem_fun(*this, &CloneTiler::unit_changed));
{
// Width spinbutton
-#if WITH_GTKMM_3_0
fill_width = Gtk::Adjustment::create(0.0, -1e6, 1e6, 1.0, 10.0, 0);
-#else
- fill_width = new Gtk::Adjustment (0.0, -1e6, 1e6, 1.0, 10.0, 0);
-#endif
double value = prefs->getDouble(prefs_path + "fillwidth", 50.0);
Inkscape::Util::Unit const *unit = unit_menu->getUnit();
gdouble const units = Inkscape::Util::Quantity::convert(value, "px", unit);
fill_width->set_value (units);
-#if WITH_GTKMM_3_0
- Inkscape::UI::Widget::SpinButton *e = new Inkscape::UI::Widget::SpinButton(fill_width, 1.0, 2);
-#else
- Inkscape::UI::Widget::SpinButton *e = new Inkscape::UI::Widget::SpinButton (*fill_width, 1.0, 2);
-#endif
+ auto e = new Inkscape::UI::Widget::SpinButton(fill_width, 1.0, 2);
e->set_tooltip_text (_("Width of the rectangle to be filled"));
e->set_width_chars (7);
e->set_digits (4);
- gtk_box_pack_start (GTK_BOX (hb), GTK_WIDGET(e->gobj()), TRUE, TRUE, 0);
- // TODO: C++ification
- g_signal_connect(G_OBJECT(fill_width->gobj()), "value_changed",
- G_CALLBACK(clonetiler_fill_width_changed), unit_menu);
+ _widthheight->pack_start(*e, true, true, 0);
+ fill_width->signal_value_changed().connect(sigc::mem_fun(*this, &CloneTiler::fill_width_changed));
}
{
- GtkWidget *l = gtk_label_new ("");
- gtk_label_set_markup (GTK_LABEL(l), "&#215;");
-#if GTK_CHECK_VERSION(3,0,0)
- gtk_widget_set_halign(l, GTK_ALIGN_END);
-#else
- gtk_misc_set_alignment (GTK_MISC (l), 1.0, 0.5);
-#endif
- gtk_box_pack_start (GTK_BOX (hb), l, TRUE, TRUE, 0);
+ auto l = Gtk::manage(new Gtk::Label(""));
+ l->set_markup("&#215;");
+ l->set_halign(Gtk::ALIGN_END);
+ _widthheight->pack_start(*l, true, true, 0);
}
{
// Height spinbutton
-#if WITH_GTKMM_3_0
fill_height = Gtk::Adjustment::create(0.0, -1e6, 1e6, 1.0, 10.0, 0);
-#else
- fill_height = new Gtk::Adjustment (0.0, -1e6, 1e6, 1.0, 10.0, 0);
-#endif
double value = prefs->getDouble(prefs_path + "fillheight", 50.0);
Inkscape::Util::Unit const *unit = unit_menu->getUnit();
gdouble const units = Inkscape::Util::Quantity::convert(value, "px", unit);
fill_height->set_value (units);
-#if WITH_GTKMM_3_0
- Inkscape::UI::Widget::SpinButton *e = new Inkscape::UI::Widget::SpinButton(fill_height, 1.0, 2);
-#else
- Inkscape::UI::Widget::SpinButton *e = new Inkscape::UI::Widget::SpinButton (*fill_height, 1.0, 2);
-#endif
+ auto e = new Inkscape::UI::Widget::SpinButton(fill_height, 1.0, 2);
e->set_tooltip_text (_("Height of the rectangle to be filled"));
e->set_width_chars (7);
e->set_digits (4);
- gtk_box_pack_start (GTK_BOX (hb), GTK_WIDGET(e->gobj()), TRUE, TRUE, 0);
- // TODO: C++ification
- g_signal_connect(G_OBJECT(fill_height->gobj()), "value_changed",
- G_CALLBACK(clonetiler_fill_height_changed), unit_menu);
+ _widthheight->pack_start(*e, true, true, 0);
+ fill_height->signal_value_changed().connect(sigc::mem_fun(*this, &CloneTiler::fill_height_changed));
}
- gtk_box_pack_start (GTK_BOX (hb), (GtkWidget*) unit_menu->gobj(), TRUE, TRUE, 0);
- clonetiler_table_attach (table, hb, 0.0, 2, 2);
+ _widthheight->pack_start(*unit_menu, true, true, 0);
+ table_attach (table, GTK_WIDGET(_widthheight->gobj()), 0.0, 2, 2);
}
// Switch
- GtkWidget* radio;
+ Gtk::RadioButtonGroup rb_group;
{
- radio = gtk_radio_button_new_with_label (NULL, _("Rows, columns: "));
- gtk_widget_set_tooltip_text (radio, _("Create the specified number of rows and columns"));
- clonetiler_table_attach (table, radio, 0.0, 1, 1);
- g_signal_connect (G_OBJECT (radio), "toggled", G_CALLBACK (clonetiler_switch_to_create), (gpointer) dlg);
- }
- if (!prefs->getBool(prefs_path + "fillrect")) {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE);
- gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON (radio));
+ auto radio = Gtk::manage(new Gtk::RadioButton(rb_group, _("Rows, columns: ")));
+ radio->set_tooltip_text(_("Create the specified number of rows and columns"));
+ table_attach (table, GTK_WIDGET(radio->gobj()), 0.0, 1, 1);
+ radio->signal_toggled().connect(sigc::mem_fun(*this, &CloneTiler::switch_to_create));
+
+ if (!prefs->getBool(prefs_path + "fillrect")) {
+ radio->set_active(true);
+ }
}
{
- radio = gtk_radio_button_new_with_label (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), _("Width, height: "));
- gtk_widget_set_tooltip_text (radio, _("Fill the specified width and height with the tiling"));
- clonetiler_table_attach (table, radio, 0.0, 2, 1);
- g_signal_connect (G_OBJECT (radio), "toggled", G_CALLBACK (clonetiler_switch_to_fill), (gpointer) dlg);
- }
- if (prefs->getBool(prefs_path + "fillrect")) {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio), TRUE);
- gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON (radio));
+ auto radio = Gtk::manage(new Gtk::RadioButton(rb_group, _("Width, height: ")));
+ radio->set_tooltip_text(_("Fill the specified width and height with the tiling"));
+ table_attach (table, GTK_WIDGET(radio->gobj()), 0.0, 2, 1);
+ radio->signal_toggled().connect(sigc::mem_fun(*this, &CloneTiler::switch_to_fill));
+
+ if (prefs->getBool(prefs_path + "fillrect")) {
+ radio->set_active(true);
+ }
}
}
// Use saved pos
{
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN);
- gtk_box_set_homogeneous(GTK_BOX(hb), FALSE);
-#else
- GtkWidget *hb = gtk_hbox_new(FALSE, VB_MARGIN);
-#endif
- gtk_box_pack_start (GTK_BOX (mainbox), hb, FALSE, FALSE, 0);
-
- GtkWidget *b = gtk_check_button_new_with_label (_("Use saved size and position of the tile"));
- bool keepbbox = prefs->getBool(prefs_path + "keepbbox", true);
- gtk_toggle_button_set_active ((GtkToggleButton *) b, keepbbox);
- gtk_widget_set_tooltip_text (b, _("Pretend that the size and position of the tile are the same as the last time you tiled it (if any), instead of using the current size"));
- gtk_box_pack_start (GTK_BOX (hb), b, FALSE, FALSE, 0);
-
- g_signal_connect(G_OBJECT(b), "toggled",
- G_CALLBACK(clonetiler_keep_bbox_toggled), NULL);
+ auto hb = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, VB_MARGIN));
+ gtk_box_pack_start (GTK_BOX (mainbox), GTK_WIDGET(hb->gobj()), FALSE, FALSE, 0);
+
+ _cb_keep_bbox = Gtk::manage(new Gtk::CheckButton(_("Use saved size and position of the tile")));
+ auto keepbbox = prefs->getBool(prefs_path + "keepbbox", true);
+ _cb_keep_bbox->set_active(keepbbox);
+ _cb_keep_bbox->set_tooltip_text(_("Pretend that the size and position of the tile are the same "
+ "as the last time you tiled it (if any), instead of using the "
+ "current size"));
+ hb->pack_start(*_cb_keep_bbox, false, false, 0);
+ _cb_keep_bbox->signal_toggled().connect(sigc::mem_fun(*this, &CloneTiler::keep_bbox_toggled));
}
// Statusbar
{
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN);
+ auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN);
gtk_box_set_homogeneous(GTK_BOX(hb), FALSE);
-#else
- GtkWidget *hb = gtk_hbox_new(FALSE, VB_MARGIN);
-#endif
gtk_box_pack_end (GTK_BOX (mainbox), hb, FALSE, FALSE, 0);
GtkWidget *l = gtk_label_new("");
- g_object_set_data (G_OBJECT(dlg), "status", (gpointer) l);
+ _status = l;
gtk_box_pack_start (GTK_BOX (hb), l, FALSE, FALSE, 0);
}
// Buttons
{
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN);
+ auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN);
gtk_box_set_homogeneous(GTK_BOX(hb), FALSE);
-#else
- GtkWidget *hb = gtk_hbox_new(FALSE, VB_MARGIN);
-#endif
gtk_box_pack_start (GTK_BOX (mainbox), hb, FALSE, FALSE, 0);
{
- GtkWidget *b = gtk_button_new ();
- GtkWidget *l = gtk_label_new ("");
- gtk_label_set_markup_with_mnemonic (GTK_LABEL(l), _(" <b>_Create</b> "));
- gtk_container_add (GTK_CONTAINER(b), l);
- gtk_widget_set_tooltip_text (b, _("Create and tile the clones of the selection"));
- g_signal_connect (G_OBJECT (b), "clicked", G_CALLBACK (clonetiler_apply), dlg);
- gtk_box_pack_end (GTK_BOX (hb), b, FALSE, FALSE, 0);
+ auto b = Gtk::manage(new Gtk::Button());
+ auto l = Gtk::manage(new Gtk::Label(""));
+ l->set_markup_with_mnemonic(_(" <b>_Create</b> "));
+ b->add(*l);
+ b->set_tooltip_text(_("Create and tile the clones of the selection"));
+ b->signal_clicked().connect(sigc::mem_fun(*this, &CloneTiler::apply));
+ gtk_box_pack_end (GTK_BOX (hb), GTK_WIDGET(b->gobj()), FALSE, FALSE, 0);
}
{ // buttons which are enabled only when there are tiled clones
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *sb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
+ auto sb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_set_homogeneous(GTK_BOX(sb), FALSE);
-#else
- GtkWidget *sb = gtk_hbox_new(FALSE, 0);
-#endif
gtk_box_pack_end (GTK_BOX (hb), sb, FALSE, FALSE, 0);
- g_object_set_data (G_OBJECT(dlg), "buttons_on_tiles", (gpointer) sb);
+ _buttons_on_tiles = sb;
{
// TRANSLATORS: if a group of objects are "clumped" together, then they
// are unevenly spread in the given amount of space - as shown in the
// diagrams on the left in the following screenshot:
// http://www.inkscape.org/screenshots/gallery/inkscape-0.42-CVS-tiles-unclump.png
// So unclumping is the process of spreading a number of objects out more evenly.
- GtkWidget *b = gtk_button_new_with_mnemonic (_(" _Unclump "));
- gtk_widget_set_tooltip_text (b, _("Spread out clones to reduce clumping; can be applied repeatedly"));
- g_signal_connect (G_OBJECT (b), "clicked", G_CALLBACK (clonetiler_unclump), NULL);
- gtk_box_pack_end (GTK_BOX (sb), b, FALSE, FALSE, 0);
+ auto b = Gtk::manage(new Gtk::Button(_(" _Unclump "), true));
+ b->set_tooltip_text(_("Spread out clones to reduce clumping; can be applied repeatedly"));
+ b->signal_clicked().connect(sigc::mem_fun(*this, &CloneTiler::unclump));
+ gtk_box_pack_end (GTK_BOX (sb), GTK_WIDGET(b->gobj()), FALSE, FALSE, 0);
}
{
- GtkWidget *b = gtk_button_new_with_mnemonic (_(" Re_move "));
- gtk_widget_set_tooltip_text (b, _("Remove existing tiled clones of the selected object (siblings only)"));
- g_signal_connect (G_OBJECT (b), "clicked", G_CALLBACK (clonetiler_remove), gpointer(dlg));
- gtk_box_pack_end (GTK_BOX (sb), b, FALSE, FALSE, 0);
+ auto b = Gtk::manage(new Gtk::Button(_(" Re_move "), true));
+ b->set_tooltip_text(_("Remove existing tiled clones of the selected object (siblings only)"));
+ b->signal_clicked().connect(sigc::mem_fun(*this, &CloneTiler::on_remove_button_clicked));
+ gtk_box_pack_end (GTK_BOX (sb), GTK_WIDGET(b->gobj()), FALSE, FALSE, 0);
}
// connect to global selection changed signal (so we can change desktops) and
// external_change (so we're not fooled by undo)
- selectChangedConn = INKSCAPE.signal_selection_changed.connect(sigc::bind(sigc::ptr_fun(&CloneTiler::clonetiler_change_selection), dlg));
- externChangedConn = INKSCAPE.signal_external_change.connect (sigc::bind(sigc::ptr_fun(&CloneTiler::clonetiler_external_change), dlg));
-
- g_signal_connect(G_OBJECT(dlg), "destroy", G_CALLBACK(clonetiler_disconnect_gsignal), this);
+ selectChangedConn = INKSCAPE.signal_selection_changed.connect(sigc::mem_fun(*this, &CloneTiler::change_selection));
+ externChangedConn = INKSCAPE.signal_external_change.connect(sigc::mem_fun(*this, &CloneTiler::external_change));
// update now
- clonetiler_change_selection (SP_ACTIVE_DESKTOP->getSelection(), dlg);
+ change_selection(SP_ACTIVE_DESKTOP->getSelection());
}
{
- GtkWidget *b = gtk_button_new_with_mnemonic (_(" R_eset "));
+ auto b = Gtk::manage(new Gtk::Button(_(" R_eset "), true));
// TRANSLATORS: "change" is a noun here
- gtk_widget_set_tooltip_text (b, _("Reset all shifts, scales, rotates, opacity and color changes in the dialog to zero"));
- g_signal_connect (G_OBJECT (b), "clicked", G_CALLBACK (clonetiler_reset), dlg);
- gtk_box_pack_start (GTK_BOX (hb), b, FALSE, FALSE, 0);
+ b->set_tooltip_text(_("Reset all shifts, scales, rotates, opacity and color changes in the dialog to zero"));
+ b->signal_clicked().connect(sigc::mem_fun(*this, &CloneTiler::reset));
+ gtk_box_pack_start (GTK_BOX (hb), GTK_WIDGET(b->gobj()), FALSE, FALSE, 0);
}
}
@@ -1307,8 +1163,9 @@ CloneTiler::CloneTiler () :
CloneTiler::~CloneTiler (void)
{
//subselChangedConn.disconnect();
- //selectChangedConn.disconnect();
//selectModifiedConn.disconnect();
+ selectChangedConn.disconnect();
+ externChangedConn.disconnect();
desktopChangeConn.disconnect();
deskTrack.disconnect();
color_changed_connection.disconnect();
@@ -1323,17 +1180,7 @@ void CloneTiler::setDesktop(SPDesktop *desktop)
void CloneTiler::setTargetDesktop(SPDesktop *desktop)
{
if (this->desktop != desktop) {
- if (this->desktop) {
- //selectModifiedConn.disconnect();
- //subselChangedConn.disconnect();
- //selectChangedConn.disconnect();
- }
this->desktop = desktop;
- if (desktop && desktop->selection) {
- //selectChangedConn = desktop->selection->connectChanged(sigc::hide(sigc::mem_fun(*this, &CloneTiler::clonetiler_change_selection)));
- //subselChangedConn = desktop->connectToolSubselectionChanged(sigc::hide(sigc::mem_fun(*this, &CloneTiler::clonetiler_change_selection)));
- //selectModifiedConn = desktop->selection->connectModified(sigc::hide<0>(sigc::mem_fun(*this, &CloneTiler::clonetiler_change_selection)));
- }
}
}
@@ -1353,50 +1200,38 @@ void CloneTiler::on_picker_color_changed(guint rgba)
is_updating = false;
}
-void CloneTiler::clonetiler_change_selection(Inkscape::Selection *selection, GtkWidget *dlg)
+void CloneTiler::change_selection(Inkscape::Selection *selection)
{
- GtkWidget *buttons = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "buttons_on_tiles"));
- GtkWidget *status = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "status"));
-
if (selection->isEmpty()) {
- gtk_widget_set_sensitive (buttons, FALSE);
- gtk_label_set_markup (GTK_LABEL(status), _("<small>Nothing selected.</small>"));
+ gtk_widget_set_sensitive (_buttons_on_tiles, FALSE);
+ gtk_label_set_markup (GTK_LABEL(_status), _("<small>Nothing selected.</small>"));
return;
}
- if (selection->itemList().size() > 1) {
- gtk_widget_set_sensitive (buttons, FALSE);
- gtk_label_set_markup (GTK_LABEL(status), _("<small>More than one object selected.</small>"));
+ if (boost::distance(selection->items()) > 1) {
+ gtk_widget_set_sensitive (_buttons_on_tiles, FALSE);
+ gtk_label_set_markup (GTK_LABEL(_status), _("<small>More than one object selected.</small>"));
return;
}
- guint n = clonetiler_number_of_clones(selection->singleItem());
+ guint n = number_of_clones(selection->singleItem());
if (n > 0) {
- gtk_widget_set_sensitive (buttons, TRUE);
+ gtk_widget_set_sensitive (_buttons_on_tiles, TRUE);
gchar *sta = g_strdup_printf (_("<small>Object has <b>%d</b> tiled clones.</small>"), n);
- gtk_label_set_markup (GTK_LABEL(status), sta);
+ gtk_label_set_markup (GTK_LABEL(_status), sta);
g_free (sta);
} else {
- gtk_widget_set_sensitive (buttons, FALSE);
- gtk_label_set_markup (GTK_LABEL(status), _("<small>Object has no tiled clones.</small>"));
+ gtk_widget_set_sensitive (_buttons_on_tiles, FALSE);
+ gtk_label_set_markup (GTK_LABEL(_status), _("<small>Object has no tiled clones.</small>"));
}
}
-void CloneTiler::clonetiler_external_change(GtkWidget *dlg)
-{
- clonetiler_change_selection (SP_ACTIVE_DESKTOP->getSelection(), dlg);
-}
-
-void CloneTiler::clonetiler_disconnect_gsignal(GObject *, gpointer source)
+void CloneTiler::external_change()
{
- g_return_if_fail(source != NULL);
-
- CloneTiler* dlg = reinterpret_cast<CloneTiler*>(source);
- dlg->selectChangedConn.disconnect();
- dlg->externChangedConn.disconnect();
+ change_selection(SP_ACTIVE_DESKTOP->getSelection());
}
-Geom::Affine CloneTiler::clonetiler_get_transform(
+Geom::Affine CloneTiler::get_transform(
// symmetry group
int type,
@@ -1998,7 +1833,7 @@ Geom::Affine CloneTiler::clonetiler_get_transform(
return Geom::identity();
}
-bool CloneTiler::clonetiler_is_a_clone_of(SPObject *tile, SPObject *obj)
+bool CloneTiler::is_a_clone_of(SPObject *tile, SPObject *obj)
{
bool result = false;
char *id_href = NULL;
@@ -2025,21 +1860,21 @@ bool CloneTiler::clonetiler_is_a_clone_of(SPObject *tile, SPObject *obj)
return result;
}
-void CloneTiler::clonetiler_trace_hide_tiled_clones_recursively(SPObject *from)
+void CloneTiler::trace_hide_tiled_clones_recursively(SPObject *from)
{
if (!trace_drawing)
return;
- for (SPObject *o = from->firstChild(); o != NULL; o = o->next) {
- SPItem *item = dynamic_cast<SPItem *>(o);
- if (item && clonetiler_is_a_clone_of(o, NULL)) {
+ for (auto& o: from->children) {
+ SPItem *item = dynamic_cast<SPItem *>(&o);
+ if (item && is_a_clone_of(&o, NULL)) {
item->invoke_hide(trace_visionkey); // FIXME: hide each tiled clone's original too!
}
- clonetiler_trace_hide_tiled_clones_recursively (o);
+ trace_hide_tiled_clones_recursively (&o);
}
}
-void CloneTiler::clonetiler_trace_setup(SPDocument *doc, gdouble zoom, SPItem *original)
+void CloneTiler::trace_setup(SPDocument *doc, gdouble zoom, SPItem *original)
{
trace_drawing = new Inkscape::Drawing();
/* Create ArenaItem and set transform */
@@ -2049,7 +1884,7 @@ void CloneTiler::clonetiler_trace_setup(SPDocument *doc, gdouble zoom, SPItem *o
// hide the (current) original and any tiled clones, we only want to pick the background
original->invoke_hide(trace_visionkey);
- clonetiler_trace_hide_tiled_clones_recursively(trace_doc->getRoot());
+ trace_hide_tiled_clones_recursively(trace_doc->getRoot());
trace_doc->getRoot()->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
trace_doc->ensureUpToDate();
@@ -2057,7 +1892,7 @@ void CloneTiler::clonetiler_trace_setup(SPDocument *doc, gdouble zoom, SPItem *o
trace_zoom = zoom;
}
-guint32 CloneTiler::clonetiler_trace_pick(Geom::Rect box)
+guint32 CloneTiler::trace_pick(Geom::Rect box)
{
if (!trace_drawing) {
return 0;
@@ -2081,7 +1916,7 @@ guint32 CloneTiler::clonetiler_trace_pick(Geom::Rect box)
return SP_RGBA32_F_COMPOSE (R, G, B, A);
}
-void CloneTiler::clonetiler_trace_finish()
+void CloneTiler::trace_finish()
{
if (trace_doc) {
trace_doc->getRoot()->invoke_hide(trace_visionkey);
@@ -2091,48 +1926,48 @@ void CloneTiler::clonetiler_trace_finish()
}
}
-void CloneTiler::clonetiler_unclump(GtkWidget */*widget*/, void *)
+void CloneTiler::unclump()
{
- SPDesktop *desktop = SP_ACTIVE_DESKTOP;
+ auto desktop = SP_ACTIVE_DESKTOP;
if (desktop == NULL) {
return;
}
- Inkscape::Selection *selection = desktop->getSelection();
+ auto selection = desktop->getSelection();
// check if something is selected
- if (selection->isEmpty() || selection->itemList().size() > 1) {
+ if (selection->isEmpty() || boost::distance(selection->items()) > 1) {
desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>one object</b> whose tiled clones to unclump."));
return;
}
- SPObject *obj = selection->singleItem();
- SPObject *parent = obj->parent;
+ auto obj = selection->singleItem();
+ auto parent = obj->parent;
std::vector<SPItem*> to_unclump; // not including the original
- for (SPObject *child = parent->firstChild(); child != NULL; child = child->next) {
- if (clonetiler_is_a_clone_of (child, obj)) {
- to_unclump.push_back((SPItem*)child);
+ for (auto& child: parent->children) {
+ if (is_a_clone_of (&child, obj)) {
+ to_unclump.push_back((SPItem*)&child);
}
}
desktop->getDocument()->ensureUpToDate();
reverse(to_unclump.begin(),to_unclump.end());
- unclump (to_unclump);
+ ::unclump (to_unclump);
DocumentUndo::done(desktop->getDocument(), SP_VERB_DIALOG_CLONETILER,
_("Unclump tiled clones"));
}
-guint CloneTiler::clonetiler_number_of_clones(SPObject *obj)
+guint CloneTiler::number_of_clones(SPObject *obj)
{
SPObject *parent = obj->parent;
guint n = 0;
- for (SPObject *child = parent->firstChild(); child != NULL; child = child->next) {
- if (clonetiler_is_a_clone_of (child, obj)) {
+ for (auto& child: parent->children) {
+ if (is_a_clone_of (&child, obj)) {
n ++;
}
}
@@ -2140,7 +1975,7 @@ guint CloneTiler::clonetiler_number_of_clones(SPObject *obj)
return n;
}
-void CloneTiler::clonetiler_remove(GtkWidget */*widget*/, GtkWidget *dlg, bool do_undo/* = true*/)
+void CloneTiler::remove(bool do_undo/* = true*/)
{
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
if (desktop == NULL) {
@@ -2150,7 +1985,7 @@ void CloneTiler::clonetiler_remove(GtkWidget */*widget*/, GtkWidget *dlg, bool d
Inkscape::Selection *selection = desktop->getSelection();
// check if something is selected
- if (selection->isEmpty() || selection->itemList().size() > 1) {
+ if (selection->isEmpty() || boost::distance(selection->items()) > 1) {
desktop->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>one object</b> whose tiled clones to remove."));
return;
}
@@ -2160,9 +1995,9 @@ void CloneTiler::clonetiler_remove(GtkWidget */*widget*/, GtkWidget *dlg, bool d
// remove old tiling
GSList *to_delete = NULL;
- for (SPObject *child = parent->firstChild(); child != NULL; child = child->next) {
- if (clonetiler_is_a_clone_of (child, obj)) {
- to_delete = g_slist_prepend (to_delete, child);
+ for (auto& child: parent->children) {
+ if (is_a_clone_of (&child, obj)) {
+ to_delete = g_slist_prepend (to_delete, &child);
}
}
for (GSList *i = to_delete; i; i = i->next) {
@@ -2172,7 +2007,7 @@ void CloneTiler::clonetiler_remove(GtkWidget */*widget*/, GtkWidget *dlg, bool d
}
g_slist_free (to_delete);
- clonetiler_change_selection (selection, dlg);
+ change_selection (selection);
if (do_undo) {
DocumentUndo::done(desktop->getDocument(), SP_VERB_DIALOG_CLONETILER,
@@ -2212,7 +2047,7 @@ double CloneTiler::randomize01(double val, double rand)
}
-void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg)
+void CloneTiler::apply()
{
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
if (desktop == NULL) {
@@ -2228,7 +2063,7 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg)
}
// Check if more than one object is selected.
- if (selection->itemList().size() > 1) {
+ if (boost::distance(selection->items()) > 1) {
desktop->getMessageStack()->flash(Inkscape::ERROR_MESSAGE, _("If you want to clone several objects, <b>group</b> them and <b>clone the group</b>."));
return;
}
@@ -2237,9 +2072,8 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg)
desktop->setWaitingCursor();
// set statusbar text
- GtkWidget *status = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "status"));
- gtk_label_set_markup (GTK_LABEL(status), _("<small>Creating tiled clones...</small>"));
- gtk_widget_queue_draw(GTK_WIDGET(status));
+ gtk_label_set_markup (GTK_LABEL(_status), _("<small>Creating tiled clones...</small>"));
+ gtk_widget_queue_draw(GTK_WIDGET(_status));
gdk_window_process_all_updates();
SPObject *obj = selection->singleItem();
@@ -2252,7 +2086,7 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg)
const char *id_href = g_strdup_printf("#%s", obj_repr->attribute("id"));
SPObject *parent = obj->parent;
- clonetiler_remove (NULL, dlg, false);
+ remove(false);
Geom::Scale scale = desktop->getDocument()->getDocumentScale().inverse();
double scale_units = scale[Geom::X]; // Use just x direction....
@@ -2341,7 +2175,7 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg)
SPItem *item = dynamic_cast<SPItem *>(obj);
if (dotrace) {
- clonetiler_trace_setup (desktop->getDocument(), 1.0, item);
+ trace_setup(desktop->getDocument(), 1.0, item);
}
Geom::Point center;
@@ -2413,7 +2247,7 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg)
// Note: We create a clone at 0,0 too, right over the original, in case our clones are colored
// Get transform from symmetry, shift, scale, rotation
- Geom::Affine orig_t = clonetiler_get_transform (type, i, j, center[Geom::X], center[Geom::Y], w, h,
+ Geom::Affine orig_t = get_transform (type, i, j, center[Geom::X], center[Geom::Y], w, h,
shiftx_per_i, shifty_per_i,
shiftx_per_j, shifty_per_j,
shiftx_rand, shifty_rand,
@@ -2487,7 +2321,7 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg)
if (dotrace) {
Geom::Rect bbox_t = transform_rect (bbox_original, t*Geom::Scale(1.0/scale_units));
- guint32 rgba = clonetiler_trace_pick (bbox_t);
+ guint32 rgba = trace_pick (bbox_t);
float r = SP_RGBA32_R_F(rgba);
float g = SP_RGBA32_G_F(rgba);
float b = SP_RGBA32_B_F(rgba);
@@ -2647,10 +2481,10 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg)
}
if (dotrace) {
- clonetiler_trace_finish ();
+ trace_finish ();
}
- clonetiler_change_selection (selection, dlg);
+ change_selection(selection);
desktop->clearWaitingCursor();
@@ -2658,111 +2492,84 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg)
_("Create tiled clones"));
}
-GtkWidget * CloneTiler::clonetiler_new_tab(GtkWidget *nb, const gchar *label)
+GtkWidget * CloneTiler::new_tab(GtkWidget *nb, const gchar *label)
{
GtkWidget *l = gtk_label_new_with_mnemonic (label);
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *vb = gtk_box_new(GTK_ORIENTATION_VERTICAL, VB_MARGIN);
+ auto vb = gtk_box_new(GTK_ORIENTATION_VERTICAL, VB_MARGIN);
gtk_box_set_homogeneous(GTK_BOX(vb), FALSE);
-#else
- GtkWidget *vb = gtk_vbox_new (FALSE, VB_MARGIN);
-#endif
gtk_container_set_border_width (GTK_CONTAINER (vb), VB_MARGIN);
gtk_notebook_append_page (GTK_NOTEBOOK (nb), vb, l);
return vb;
}
-void CloneTiler::clonetiler_checkbox_toggled(GtkToggleButton *tb, gpointer *data)
+void CloneTiler::checkbox_toggled(Gtk::ToggleButton *tb,
+ const Glib::ustring &attr)
{
- const gchar *attr = (const gchar *) data;
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- prefs->setBool(prefs_path + attr, gtk_toggle_button_get_active(tb));
+ auto prefs = Inkscape::Preferences::get();
+ prefs->setBool(prefs_path + attr, tb->get_active());
}
-GtkWidget * CloneTiler::clonetiler_checkbox(const char *tip, const char *attr)
+Gtk::Widget * CloneTiler::checkbox(const char *tip,
+ const Glib::ustring &attr)
{
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN);
- gtk_box_set_homogeneous(GTK_BOX(hb), FALSE);
-#else
- GtkWidget *hb = gtk_hbox_new(FALSE, VB_MARGIN);
-#endif
-
- GtkWidget *b = gtk_check_button_new ();
- gtk_widget_set_tooltip_text (b, tip);
+ auto hb = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, VB_MARGIN));
+ auto b = Gtk::manage(new Gtk::CheckButton());
+ b->set_tooltip_text(tip);
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- bool value = prefs->getBool(prefs_path + attr);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(b), value);
+ auto const prefs = Inkscape::Preferences::get();
+ auto const value = prefs->getBool(prefs_path + attr);
+ b->set_active(value);
- gtk_box_pack_end (GTK_BOX (hb), b, FALSE, TRUE, 0);
- g_signal_connect ( G_OBJECT (b), "clicked",
- G_CALLBACK (clonetiler_checkbox_toggled), (gpointer) attr);
+ hb->pack_end(*b, false, true);
+ b->signal_clicked().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::checkbox_toggled), b, attr));
- g_object_set_data (G_OBJECT(b), "uncheckable", GINT_TO_POINTER(TRUE));
+ b->set_data("uncheckable", GINT_TO_POINTER(true));
return hb;
}
-void CloneTiler::clonetiler_value_changed(GtkAdjustment *adj, gpointer data)
+void CloneTiler::value_changed(Glib::RefPtr<Gtk::Adjustment> &adj,
+ Glib::ustring const &pref)
{
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- const gchar *pref = (const gchar *) data;
- prefs->setDouble(prefs_path + pref, gtk_adjustment_get_value (adj));
+ auto prefs = Inkscape::Preferences::get();
+ prefs->setDouble(prefs_path + pref, adj->get_value());
}
-GtkWidget * CloneTiler::clonetiler_spinbox(const char *tip, const char *attr, double lower, double upper, const gchar *suffix, bool exponent/* = false*/)
+Gtk::Widget * CloneTiler::spinbox(const char *tip,
+ const Glib::ustring &attr,
+ double lower,
+ double upper,
+ const gchar *suffix,
+ bool exponent/* = false*/)
{
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_box_set_homogeneous(GTK_BOX(hb), FALSE);
-#else
- GtkWidget *hb = gtk_hbox_new(FALSE, 0);
-#endif
+ auto hb = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 0));
{
-#if WITH_GTKMM_3_0
- Glib::RefPtr<Gtk::Adjustment> a;
- if (exponent) {
- a = Gtk::Adjustment::create(1.0, lower, upper, 0.01, 0.05, 0);
- } else {
- a = Gtk::Adjustment::create(0.0, lower, upper, 0.1, 0.5, 0);
- }
-#else
- Gtk::Adjustment *a;
- if (exponent) {
- a = new Gtk::Adjustment (1.0, lower, upper, 0.01, 0.05, 0);
- } else {
- a = new Gtk::Adjustment (0.0, lower, upper, 0.1, 0.5, 0);
- }
-#endif
+ // Parameters for adjustment
+ auto const initial_value = (exponent ? 1.0 : 0.0);
+ auto const step_increment = (exponent ? 0.01 : 0.1);
+ auto const page_increment = (exponent ? 0.05 : 0.4);
- Inkscape::UI::Widget::SpinButton *sb;
-#if WITH_GTKMM_3_0
- if (exponent) {
- sb = new Inkscape::UI::Widget::SpinButton(a, 0.01, 2);
- } else {
- sb = new Inkscape::UI::Widget::SpinButton(a, 0.1, 1);
- }
-#else
- if (exponent) {
- sb = new Inkscape::UI::Widget::SpinButton (*a, 0.01, 2);
- } else {
- sb = new Inkscape::UI::Widget::SpinButton (*a, 0.1, 1);
- }
-#endif
+ auto a = Gtk::Adjustment::create(initial_value,
+ lower,
+ upper,
+ step_increment,
+ page_increment);
+
+ auto const climb_rate = (exponent ? 0.01 : 0.1);
+ auto const digits = (exponent ? 2 : 1);
+
+ auto sb = new Inkscape::UI::Widget::SpinButton(a, climb_rate, digits);
sb->set_tooltip_text (tip);
sb->set_width_chars (5);
sb->set_digits(3);
- gtk_box_pack_start (GTK_BOX (hb), GTK_WIDGET(sb->gobj()), FALSE, FALSE, SB_MARGIN);
+ hb->pack_start(*sb, false, false, SB_MARGIN);
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- double value = prefs->getDoubleLimited(prefs_path + attr, exponent? 1.0 : 0.0, lower, upper);
+ auto prefs = Inkscape::Preferences::get();
+ auto value = prefs->getDoubleLimited(prefs_path + attr, exponent? 1.0 : 0.0, lower, upper);
a->set_value (value);
- // TODO: C++ification
- g_signal_connect(G_OBJECT(a->gobj()), "value_changed",
- G_CALLBACK(clonetiler_value_changed), (gpointer) attr);
+ a->signal_value_changed().connect(sigc::bind(sigc::mem_fun(*this, &CloneTiler::value_changed), a, attr));
if (exponent) {
sb->set_data ("oneable", GINT_TO_POINTER(TRUE));
@@ -2772,49 +2579,43 @@ GtkWidget * CloneTiler::clonetiler_spinbox(const char *tip, const char *attr, do
}
{
- GtkWidget *l = gtk_label_new ("");
- gtk_label_set_markup (GTK_LABEL(l), suffix);
-#if GTK_CHECK_VERSION(3,0,0)
- gtk_widget_set_halign(l, GTK_ALIGN_END);
- gtk_widget_set_valign(l, GTK_ALIGN_START);
-#else
- gtk_misc_set_alignment (GTK_MISC (l), 1.0, 0);
-#endif
- gtk_box_pack_start (GTK_BOX (hb), l, FALSE, FALSE, 0);
+ auto l = Gtk::manage(new Gtk::Label(""));
+ l->set_markup(suffix);
+ l->set_halign(Gtk::ALIGN_END);
+ l->set_valign(Gtk::ALIGN_START);
+ hb->pack_start(*l);
}
return hb;
}
-void CloneTiler::clonetiler_symgroup_changed(GtkComboBox *cb, gpointer /*data*/)
+void CloneTiler::symgroup_changed(Gtk::ComboBox *cb)
{
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- gint group_new = gtk_combo_box_get_active (cb);
+ auto prefs = Inkscape::Preferences::get();
+ auto group_new = cb->get_active_row_number();
prefs->setInt(prefs_path + "symmetrygroup", group_new);
}
-void CloneTiler::clonetiler_xy_changed(GtkAdjustment *adj, gpointer data)
+void CloneTiler::xy_changed(Glib::RefPtr<Gtk::Adjustment> &adj, Glib::ustring const &pref)
{
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- const gchar *pref = (const gchar *) data;
- prefs->setInt(prefs_path + pref, (int) floor(gtk_adjustment_get_value (adj) + 0.5));
+ auto prefs = Inkscape::Preferences::get();
+ prefs->setInt(prefs_path + pref, (int) floor(adj->get_value() + 0.5));
}
-void CloneTiler::clonetiler_keep_bbox_toggled(GtkToggleButton *tb, gpointer /*data*/)
+void CloneTiler::keep_bbox_toggled()
{
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- prefs->setBool(prefs_path + "keepbbox", gtk_toggle_button_get_active(tb));
+ auto prefs = Inkscape::Preferences::get();
+ prefs->setBool(prefs_path + "keepbbox", _cb_keep_bbox->get_active());
}
-void CloneTiler::clonetiler_pick_to(GtkToggleButton *tb, gpointer data)
+void CloneTiler::pick_to(Gtk::ToggleButton *tb, Glib::ustring const &pref)
{
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- const gchar *pref = (const gchar *) data;
- prefs->setBool(prefs_path + pref, gtk_toggle_button_get_active(tb));
+ auto prefs = Inkscape::Preferences::get();
+ prefs->setBool(prefs_path + pref, tb->get_active());
}
-void CloneTiler::clonetiler_reset_recursive(GtkWidget *w)
+void CloneTiler::reset_recursive(GtkWidget *w)
{
if (w && G_IS_OBJECT(w)) {
{
@@ -2842,51 +2643,40 @@ void CloneTiler::clonetiler_reset_recursive(GtkWidget *w)
if (GTK_IS_CONTAINER(w)) {
GList *ch = gtk_container_get_children (GTK_CONTAINER(w));
for (GList *i = ch; i != NULL; i = i->next) {
- clonetiler_reset_recursive (GTK_WIDGET(i->data));
+ reset_recursive (GTK_WIDGET(i->data));
}
g_list_free (ch);
}
}
-void CloneTiler::clonetiler_reset(GtkWidget */*widget*/, GtkWidget *dlg)
+void CloneTiler::reset()
{
- clonetiler_reset_recursive (dlg);
+ reset_recursive(GTK_WIDGET(this->gobj()));
}
-void CloneTiler::clonetiler_table_attach(GtkWidget *table, GtkWidget *widget, float align, int row, int col)
+void CloneTiler::table_attach(GtkWidget *table, Gtk::Widget *widget, float align, int row, int col)
+{
+ table_attach(table, GTK_WIDGET(widget->gobj()), align, row, col);
+}
+
+void CloneTiler::table_attach(GtkWidget *table, GtkWidget *widget, float align, int row, int col)
{
-#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_set_halign(widget, GTK_ALIGN_FILL);
gtk_widget_set_valign(widget, GTK_ALIGN_START);
gtk_grid_attach(GTK_GRID(table), widget, col, row, 1, 1);
-#else
- GtkWidget *a = gtk_alignment_new (align, 0, 0, 0);
- gtk_container_add(GTK_CONTAINER(a), widget);
- gtk_table_attach ( GTK_TABLE (table), a, col, col + 1, row, row + 1, GTK_FILL, (GtkAttachOptions)0, 0, 0 );
-#endif
}
-GtkWidget * CloneTiler::clonetiler_table_x_y_rand(int values)
+GtkWidget * CloneTiler::table_x_y_rand(int values)
{
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *table = gtk_grid_new();
+ auto table = gtk_grid_new();
gtk_grid_set_row_spacing(GTK_GRID(table), 6);
gtk_grid_set_column_spacing(GTK_GRID(table), 8);
-#else
- GtkWidget *table = gtk_table_new (values + 2, 5, FALSE);
- gtk_table_set_row_spacings (GTK_TABLE (table), 6);
- gtk_table_set_col_spacings (GTK_TABLE (table), 8);
-#endif
gtk_container_set_border_width (GTK_CONTAINER (table), VB_MARGIN);
{
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
+ auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_set_homogeneous(GTK_BOX(hb), FALSE);
-#else
- GtkWidget *hb = gtk_hbox_new (FALSE, 0);
-#endif
GtkWidget *i = sp_icon_new (Inkscape::ICON_SIZE_DECORATION, INKSCAPE_ICON("object-rows"));
gtk_box_pack_start (GTK_BOX (hb), i, FALSE, FALSE, 2);
@@ -2895,16 +2685,12 @@ GtkWidget * CloneTiler::clonetiler_table_x_y_rand(int values)
gtk_label_set_markup (GTK_LABEL(l), _("<small>Per row:</small>"));
gtk_box_pack_start (GTK_BOX (hb), l, FALSE, FALSE, 2);
- clonetiler_table_attach (table, hb, 0, 1, 2);
+ table_attach (table, hb, 0, 1, 2);
}
{
-#if GTK_CHECK_VERSION(3,0,0)
- GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
+ auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_set_homogeneous(GTK_BOX(hb), FALSE);
-#else
- GtkWidget *hb = gtk_hbox_new (FALSE, 0);
-#endif
GtkWidget *i = sp_icon_new (Inkscape::ICON_SIZE_DECORATION, INKSCAPE_ICON("object-columns"));
gtk_box_pack_start (GTK_BOX (hb), i, FALSE, FALSE, 2);
@@ -2913,83 +2699,72 @@ GtkWidget * CloneTiler::clonetiler_table_x_y_rand(int values)
gtk_label_set_markup (GTK_LABEL(l), _("<small>Per column:</small>"));
gtk_box_pack_start (GTK_BOX (hb), l, FALSE, FALSE, 2);
- clonetiler_table_attach (table, hb, 0, 1, 3);
+ table_attach (table, hb, 0, 1, 3);
}
{
GtkWidget *l = gtk_label_new ("");
gtk_label_set_markup (GTK_LABEL(l), _("<small>Randomize:</small>"));
- clonetiler_table_attach (table, l, 0, 1, 4);
+ table_attach (table, l, 0, 1, 4);
}
return table;
}
-void CloneTiler::clonetiler_pick_switched(GtkToggleButton */*tb*/, gpointer data)
+void CloneTiler::pick_switched(PickType v)
{
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- guint v = GPOINTER_TO_INT (data);
+ auto prefs = Inkscape::Preferences::get();
prefs->setInt(prefs_path + "pick", v);
}
-
-void CloneTiler::clonetiler_switch_to_create(GtkToggleButton * /*tb*/, GtkWidget *dlg)
+void CloneTiler::switch_to_create()
{
- GtkWidget *rowscols = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "rowscols"));
- GtkWidget *widthheight = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "widthheight"));
-
- if (rowscols) {
- gtk_widget_set_sensitive (rowscols, TRUE);
+ if (_rowscols) {
+ _rowscols->set_sensitive(true);
}
- if (widthheight) {
- gtk_widget_set_sensitive (widthheight, FALSE);
+ if (_widthheight) {
+ _widthheight->set_sensitive(false);
}
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ auto prefs = Inkscape::Preferences::get();
prefs->setBool(prefs_path + "fillrect", false);
}
-void CloneTiler::clonetiler_switch_to_fill(GtkToggleButton * /*tb*/, GtkWidget *dlg)
+void CloneTiler::switch_to_fill()
{
- GtkWidget *rowscols = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "rowscols"));
- GtkWidget *widthheight = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "widthheight"));
-
- if (rowscols) {
- gtk_widget_set_sensitive (rowscols, FALSE);
+ if (_rowscols) {
+ _rowscols->set_sensitive(false);
}
- if (widthheight) {
- gtk_widget_set_sensitive (widthheight, TRUE);
+ if (_widthheight) {
+ _widthheight->set_sensitive(true);
}
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ auto prefs = Inkscape::Preferences::get();
prefs->setBool(prefs_path + "fillrect", true);
}
-
-
-
-void CloneTiler::clonetiler_fill_width_changed(GtkAdjustment *adj, Inkscape::UI::Widget::UnitMenu *u)
+void CloneTiler::fill_width_changed()
{
- gdouble const raw_dist = gtk_adjustment_get_value (adj);
- Inkscape::Util::Unit const *unit = u->getUnit();
- gdouble const pixels = Inkscape::Util::Quantity::convert(raw_dist, unit, "px");
+ auto const raw_dist = fill_width->get_value();
+ auto const unit = unit_menu->getUnit();
+ auto const pixels = Inkscape::Util::Quantity::convert(raw_dist, unit, "px");
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ auto prefs = Inkscape::Preferences::get();
prefs->setDouble(prefs_path + "fillwidth", pixels);
}
-void CloneTiler::clonetiler_fill_height_changed(GtkAdjustment *adj, Inkscape::UI::Widget::UnitMenu *u)
+void CloneTiler::fill_height_changed()
{
- gdouble const raw_dist = gtk_adjustment_get_value (adj);
- Inkscape::Util::Unit const *unit = u->getUnit();
- gdouble const pixels = Inkscape::Util::Quantity::convert(raw_dist, unit, "px");
+ auto const raw_dist = fill_height->get_value();
+ auto const unit = unit_menu->getUnit();
+ auto const pixels = Inkscape::Util::Quantity::convert(raw_dist, unit, "px");
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ auto prefs = Inkscape::Preferences::get();
prefs->setDouble(prefs_path + "fillheight", pixels);
}
-void CloneTiler::clonetiler_unit_changed()
+void CloneTiler::unit_changed()
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
gdouble width_pixels = prefs->getDouble(prefs_path + "fillwidth");
@@ -3003,22 +2778,21 @@ void CloneTiler::clonetiler_unit_changed()
gtk_adjustment_set_value(fill_height->gobj(), height_value);
}
-void CloneTiler::clonetiler_do_pick_toggled(GtkToggleButton *tb, GtkWidget *dlg)
+void CloneTiler::do_pick_toggled()
{
- GtkWidget *vvb = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "dotrace"));
-
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- prefs->setBool(prefs_path + "dotrace", gtk_toggle_button_get_active (tb));
+ auto prefs = Inkscape::Preferences::get();
+ auto active = _b->get_active();
+ prefs->setBool(prefs_path + "dotrace", active);
- if (vvb) {
- gtk_widget_set_sensitive (vvb, gtk_toggle_button_get_active (tb));
+ if (_dotrace) {
+ gtk_widget_set_sensitive (_dotrace, active);
}
}
void CloneTiler::show_page_trace()
{
gtk_notebook_set_current_page(GTK_NOTEBOOK(nb),6);
- gtk_toggle_button_set_active ((GtkToggleButton *) b, false);
+ _b->set_active(false);
}
diff --git a/src/ui/dialog/clonetiler.h b/src/ui/dialog/clonetiler.h
index a8f1df0a0..db3049ef1 100644
--- a/src/ui/dialog/clonetiler.h
+++ b/src/ui/dialog/clonetiler.h
@@ -16,6 +16,12 @@
#include "ui/widget/color-picker.h"
#include "sp-root.h"
+namespace Gtk {
+ class CheckButton;
+ class ComboBox;
+ class ToggleButton;
+}
+
namespace Inkscape {
namespace UI {
@@ -33,45 +39,66 @@ public:
static CloneTiler &getInstance() { return *new CloneTiler(); }
void show_page_trace();
protected:
-
- GtkWidget * clonetiler_new_tab(GtkWidget *nb, const gchar *label);
- GtkWidget * clonetiler_table_x_y_rand(int values);
- GtkWidget * clonetiler_spinbox(const char *tip, const char *attr, double lower, double upper, const gchar *suffix, bool exponent = false);
- GtkWidget * clonetiler_checkbox(const char *tip, const char *attr);
- void clonetiler_table_attach(GtkWidget *table, GtkWidget *widget, float align, int row, int col);
-
- static void clonetiler_symgroup_changed(GtkComboBox *cb, gpointer /*data*/);
- static void clonetiler_remove(GtkWidget */*widget*/, GtkWidget *dlg, bool do_undo = true);
- static void on_picker_color_changed(guint rgba);
- static void clonetiler_trace_hide_tiled_clones_recursively(SPObject *from);
- static void clonetiler_checkbox_toggled(GtkToggleButton *tb, gpointer *data);
- static void clonetiler_pick_switched(GtkToggleButton */*tb*/, gpointer data);
- static void clonetiler_do_pick_toggled(GtkToggleButton *tb, GtkWidget *dlg);
- static void clonetiler_pick_to(GtkToggleButton *tb, gpointer data);
- static void clonetiler_xy_changed(GtkAdjustment *adj, gpointer data);
- static void clonetiler_fill_width_changed(GtkAdjustment *adj, Inkscape::UI::Widget::UnitMenu *u);
- static void clonetiler_fill_height_changed(GtkAdjustment *adj, Inkscape::UI::Widget::UnitMenu *u);
- void clonetiler_unit_changed();
- static void clonetiler_switch_to_create(GtkToggleButton */*tb*/, GtkWidget *dlg);
- static void clonetiler_switch_to_fill(GtkToggleButton */*tb*/, GtkWidget *dlg);
- static void clonetiler_keep_bbox_toggled(GtkToggleButton *tb, gpointer /*data*/);
- static void clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg);
- static void clonetiler_unclump(GtkWidget */*widget*/, void *);
- static void clonetiler_change_selection(Inkscape::Selection *selection, GtkWidget *dlg);
- static void clonetiler_external_change(GtkWidget *dlg);
- static void clonetiler_disconnect_gsignal(GObject *widget, gpointer source);
- static void clonetiler_reset(GtkWidget */*widget*/, GtkWidget *dlg);
- static guint clonetiler_number_of_clones(SPObject *obj);
- static void clonetiler_trace_setup(SPDocument *doc, gdouble zoom, SPItem *original);
- static guint32 clonetiler_trace_pick(Geom::Rect box);
- static void clonetiler_trace_finish();
- static bool clonetiler_is_a_clone_of(SPObject *tile, SPObject *obj);
- static Geom::Rect transform_rect(Geom::Rect const &r, Geom::Affine const &m);
- static double randomize01(double val, double rand);
- static void clonetiler_value_changed(GtkAdjustment *adj, gpointer data);
- static void clonetiler_reset_recursive(GtkWidget *w);
-
- static Geom::Affine clonetiler_get_transform( // symmetry group
+ enum PickType {
+ PICK_COLOR,
+ PICK_OPACITY,
+ PICK_R,
+ PICK_G,
+ PICK_B,
+ PICK_H,
+ PICK_S,
+ PICK_L
+ };
+
+ GtkWidget * new_tab(GtkWidget *nb, const gchar *label);
+ GtkWidget * table_x_y_rand(int values);
+ Gtk::Widget * spinbox(const char *tip,
+ const Glib::ustring &attr,
+ double lower,
+ double upper,
+ const gchar *suffix,
+ bool exponent = false);
+ Gtk::Widget * checkbox(const char *tip,
+ const Glib::ustring &attr);
+ void table_attach(GtkWidget *table, GtkWidget *widget, float align, int row, int col);
+ void table_attach(GtkWidget *table, Gtk::Widget *widget, float align, int row, int col);
+
+ void symgroup_changed(Gtk::ComboBox *cb);
+ void on_picker_color_changed(guint rgba);
+ void trace_hide_tiled_clones_recursively(SPObject *from);
+ guint number_of_clones(SPObject *obj);
+ void trace_setup(SPDocument *doc, gdouble zoom, SPItem *original);
+ guint32 trace_pick(Geom::Rect box);
+ void trace_finish();
+ bool is_a_clone_of(SPObject *tile, SPObject *obj);
+ Geom::Rect transform_rect(Geom::Rect const &r, Geom::Affine const &m);
+ double randomize01(double val, double rand);
+
+ void apply();
+ void change_selection(Inkscape::Selection *selection);
+ void checkbox_toggled(Gtk::ToggleButton *tb,
+ Glib::ustring const &attr);
+ void do_pick_toggled();
+ void external_change();
+ void fill_width_changed();
+ void fill_height_changed();
+ void keep_bbox_toggled();
+ void on_remove_button_clicked() {remove();}
+ void pick_switched(PickType);
+ void pick_to(Gtk::ToggleButton *tb,
+ Glib::ustring const &pref);
+ void remove(bool do_undo = true);
+ void reset();
+ void reset_recursive(GtkWidget *w);
+ void switch_to_create();
+ void switch_to_fill();
+ void unclump();
+ void unit_changed();
+ void value_changed(Glib::RefPtr<Gtk::Adjustment> &adj, Glib::ustring const &pref);
+ void xy_changed(Glib::RefPtr<Gtk::Adjustment> &adj, Glib::ustring const &pref);
+
+ Geom::Affine get_transform(
+ // symmetry group
int type,
// row, column
@@ -112,22 +139,17 @@ private:
CloneTiler(CloneTiler const &d);
CloneTiler& operator=(CloneTiler const &d);
- GtkWidget *dlg;
+ Gtk::CheckButton *_b;
+ Gtk::CheckButton *_cb_keep_bbox;
GtkWidget *nb;
- GtkWidget *b;
SPDesktop *desktop;
DesktopTracker deskTrack;
Inkscape::UI::Widget::ColorPicker *color_picker;
GtkSizeGroup* table_row_labels;
Inkscape::UI::Widget::UnitMenu *unit_menu;
-#if WITH_GTKMM_3_0
Glib::RefPtr<Gtk::Adjustment> fill_width;
Glib::RefPtr<Gtk::Adjustment> fill_height;
-#else
- Gtk::Adjustment *fill_width;
- Gtk::Adjustment *fill_height;
-#endif
sigc::connection desktopChangeConn;
sigc::connection selectChangedConn;
@@ -147,21 +169,17 @@ private:
*/
void setTargetDesktop(SPDesktop *desktop);
+ // Variables that used to be set using GObject
+ GtkWidget *_buttons_on_tiles;
+ GtkWidget *_dotrace;
+ GtkWidget *_status;
+ Gtk::Box *_rowscols;
+ Gtk::Box *_widthheight;
+
};
enum {
- PICK_COLOR,
- PICK_OPACITY,
- PICK_R,
- PICK_G,
- PICK_B,
- PICK_H,
- PICK_S,
- PICK_L
-};
-
-enum {
TILE_P1,
TILE_P2,
TILE_PM,
diff --git a/src/ui/dialog/debug.cpp b/src/ui/dialog/debug.cpp
index d5ce6a160..d062bf863 100644
--- a/src/ui/dialog/debug.cpp
+++ b/src/ui/dialog/debug.cpp
@@ -67,12 +67,7 @@ DebugDialogImpl::DebugDialogImpl()
{
set_title(_("Messages"));
set_size_request(300, 400);
-
-#if WITH_GTKMM_3_0
- Gtk::Box *mainVBox = get_content_area();
-#else
- Gtk::Box *mainVBox = get_vbox();
-#endif
+ auto mainVBox = get_content_area();
//## Add a menu for clear()
Gtk::MenuItem* item = Gtk::manage(new Gtk::MenuItem(_("_File"), true));
diff --git a/src/ui/dialog/document-metadata.cpp b/src/ui/dialog/document-metadata.cpp
index 40495456b..dc1958434 100644
--- a/src/ui/dialog/document-metadata.cpp
+++ b/src/ui/dialog/document-metadata.cpp
@@ -60,12 +60,7 @@ DocumentMetadata::getInstance()
DocumentMetadata::DocumentMetadata()
-#if WITH_GTKMM_3_0
: UI::Widget::Panel ("", "/dialogs/documentmetadata", SP_VERB_DIALOG_METADATA)
-#else
- : UI::Widget::Panel ("", "/dialogs/documentmetadata", SP_VERB_DIALOG_METADATA),
- _page_metadata1(1, 1), _page_metadata2(1, 1)
-#endif
{
hide();
_getContents()->set_spacing (4);
@@ -74,15 +69,10 @@ DocumentMetadata::DocumentMetadata()
_page_metadata1.set_border_width(2);
_page_metadata2.set_border_width(2);
-#if WITH_GTKMM_3_0
_page_metadata1.set_column_spacing(2);
_page_metadata2.set_column_spacing(2);
_page_metadata1.set_row_spacing(2);
_page_metadata2.set_row_spacing(2);
-#else
- _page_metadata1.set_spacings(2);
- _page_metadata2.set_spacings(2);
-#endif
_notebook.append_page(_page_metadata1, _("Metadata"));
_notebook.append_page(_page_metadata2, _("License"));
@@ -125,12 +115,8 @@ DocumentMetadata::build_metadata()
label->set_markup (_("<b>Dublin Core Entities</b>"));
label->set_alignment (0.0);
-#if WITH_GTKMM_3_0
label->set_valign(Gtk::ALIGN_CENTER);
_page_metadata1.attach(*label, 0, 0, 3, 1);
-#else
- _page_metadata1.attach(*label, 0,3,0,1, Gtk::FILL, (Gtk::AttachOptions)0,0,0);
-#endif
/* add generic metadata entry areas */
struct rdf_work_entity_t * entity;
@@ -142,7 +128,6 @@ DocumentMetadata::build_metadata()
Gtk::HBox *space = Gtk::manage (new Gtk::HBox);
space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y);
-#if WITH_GTKMM_3_0
space->set_valign(Gtk::ALIGN_CENTER);
_page_metadata1.attach(*space, 0, row, 1, 1);
@@ -152,11 +137,6 @@ DocumentMetadata::build_metadata()
w->_packable->set_hexpand();
w->_packable->set_valign(Gtk::ALIGN_CENTER);
_page_metadata1.attach(*w->_packable, 2, row, 1, 1);
-#else
- _page_metadata1.attach(*space, 0,1, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0);
- _page_metadata1.attach(w->_label, 1,2, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0);
- _page_metadata1.attach(*w->_packable, 2,3, row, row+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0);
-#endif
}
}
@@ -166,31 +146,20 @@ DocumentMetadata::build_metadata()
Gtk::Label *llabel = Gtk::manage (new Gtk::Label);
llabel->set_markup (_("<b>License</b>"));
llabel->set_alignment (0.0);
-
-#if WITH_GTKMM_3_0
llabel->set_valign(Gtk::ALIGN_CENTER);
_page_metadata2.attach(*llabel, 0, row, 3, 1);
-#else
- _page_metadata2.attach(*llabel, 0,3, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0);
-#endif
/* add license selector pull-down and URI */
++row;
_licensor.init (_wr);
Gtk::HBox *space = Gtk::manage (new Gtk::HBox);
space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y);
-
-#if WITH_GTKMM_3_0
space->set_valign(Gtk::ALIGN_CENTER);
_page_metadata2.attach(*space, 0, row, 1, 1);
_licensor.set_hexpand();
_licensor.set_valign(Gtk::ALIGN_CENTER);
_page_metadata2.attach(_licensor, 1, row, 2, 1);
-#else
- _page_metadata2.attach(*space, 0,1, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0);
- _page_metadata2.attach(_licensor, 1,3, row, row+1, Gtk::EXPAND|Gtk::FILL, (Gtk::AttachOptions)0,0,0);
-#endif
}
/**
diff --git a/src/ui/dialog/document-metadata.h b/src/ui/dialog/document-metadata.h
index cde5d92fd..2c56e9317 100644
--- a/src/ui/dialog/document-metadata.h
+++ b/src/ui/dialog/document-metadata.h
@@ -21,12 +21,7 @@
#include <stddef.h>
#include "ui/widget/panel.h"
#include <gtkmm/notebook.h>
-
-#if WITH_GTKMM_3_0
-# include <gtkmm/grid.h>
-#else
-# include <gtkmm/table.h>
-#endif
+#include <gtkmm/grid.h>
#include "inkscape.h"
#include "ui/widget/licensor.h"
@@ -62,13 +57,8 @@ protected:
Gtk::Notebook _notebook;
-#if WITH_GTKMM_3_0
Gtk::Grid _page_metadata1;
Gtk::Grid _page_metadata2;
-#else
- Gtk::Table _page_metadata1;
- Gtk::Table _page_metadata2;
-#endif
//---------------------------------------------------------------
RDElist _rdflist;
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index 5b7887b35..053549b73 100644
--- a/src/ui/dialog/document-properties.cpp
+++ b/src/ui/dialog/document-properties.cpp
@@ -211,25 +211,16 @@ DocumentProperties::~DocumentProperties()
* widget in columns 2-3; (non-0, 0) means label in columns 1-3; and
* (non-0, non-0) means two widgets in columns 2 and 3.
*/
-#if WITH_GTKMM_3_0
inline void attach_all(Gtk::Grid &table, Gtk::Widget *const arr[], unsigned const n, int start = 0, int docum_prop_flag = 0)
-#else
-inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned const n, int start = 0, int docum_prop_flag = 0)
-#endif
{
for (unsigned i = 0, r = start; i < n; i += 2) {
if (arr[i] && arr[i+1]) {
-#if WITH_GTKMM_3_0
arr[i]->set_hexpand();
arr[i+1]->set_hexpand();
arr[i]->set_valign(Gtk::ALIGN_CENTER);
arr[i+1]->set_valign(Gtk::ALIGN_CENTER);
table.attach(*arr[i], 1, r, 1, 1);
table.attach(*arr[i+1], 2, r, 1, 1);
-#else
- table.attach(*arr[i], 1, 2, r, r+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0);
- table.attach(*arr[i+1], 2, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0);
-#endif
} else {
if (arr[i+1]) {
Gtk::AttachOptions yoptions = (Gtk::AttachOptions)0;
@@ -240,7 +231,6 @@ inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned con
if (docum_prop_flag) {
// this sets the padding for subordinate widgets on the "Page" page
if( i==(n-8) || i==(n-10) ) {
-#if WITH_GTKMM_3_0
arr[i+1]->set_hexpand();
arr[i+1]->set_margin_left(20);
arr[i+1]->set_margin_right(20);
@@ -251,11 +241,7 @@ inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned con
arr[i+1]->set_valign(Gtk::ALIGN_CENTER);
table.attach(*arr[i+1], 1, r, 2, 1);
-#else
- table.attach(*arr[i+1], 1, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, yoptions, 20,0);
-#endif
} else {
-#if WITH_GTKMM_3_0
arr[i+1]->set_hexpand();
if (yoptions & Gtk::EXPAND)
@@ -264,12 +250,8 @@ inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned con
arr[i+1]->set_valign(Gtk::ALIGN_CENTER);
table.attach(*arr[i+1], 1, r, 2, 1);
-#else
- table.attach(*arr[i+1], 1, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, yoptions, 0,0);
-#endif
}
} else {
-#if WITH_GTKMM_3_0
arr[i+1]->set_hexpand();
if (yoptions & Gtk::EXPAND)
@@ -278,32 +260,21 @@ inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned con
arr[i+1]->set_valign(Gtk::ALIGN_CENTER);
table.attach(*arr[i+1], 1, r, 2, 1);
-#else
- table.attach(*arr[i+1], 1, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, yoptions, 0,0);
-#endif
}
} else if (arr[i]) {
Gtk::Label& label = reinterpret_cast<Gtk::Label&>(*arr[i]);
label.set_alignment (0.0);
-#if WITH_GTKMM_3_0
label.set_hexpand();
label.set_valign(Gtk::ALIGN_CENTER);
table.attach(label, 0, r, 3, 1);
-#else
- table.attach (label, 0, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0);
-#endif
} else {
Gtk::HBox *space = Gtk::manage (new Gtk::HBox);
space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y);
-#if WITH_GTKMM_3_0
space->set_halign(Gtk::ALIGN_CENTER);
space->set_valign(Gtk::ALIGN_CENTER);
table.attach(*space, 0, r, 1, 1);
-#else
- table.attach (*space, 0, 1, r, r+1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0,0,0);
-#endif
}
}
++r;
@@ -673,52 +644,35 @@ void DocumentProperties::build_cms()
label_link->set_alignment(0.0);
-#if WITH_GTKMM_3_0
label_link->set_hexpand();
label_link->set_valign(Gtk::ALIGN_CENTER);
_page_cms->table().attach(*label_link, 0, row, 3, 1);
-#else
- _page_cms->table().attach(*label_link, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0);
-#endif
row++;
-#if WITH_GTKMM_3_0
_LinkedProfilesListScroller.set_hexpand();
_LinkedProfilesListScroller.set_valign(Gtk::ALIGN_CENTER);
_page_cms->table().attach(_LinkedProfilesListScroller, 0, row, 3, 1);
-#else
- _page_cms->table().attach(_LinkedProfilesListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0);
-#endif
row++;
Gtk::HBox* spacer = Gtk::manage(new Gtk::HBox());
spacer->set_size_request(SPACE_SIZE_X, SPACE_SIZE_Y);
-#if WITH_GTKMM_3_0
spacer->set_hexpand();
spacer->set_valign(Gtk::ALIGN_CENTER);
_page_cms->table().attach(*spacer, 0, row, 3, 1);
-#else
- _page_cms->table().attach(*spacer, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0);
-#endif
row++;
label_avail->set_alignment(0.0);
-#if WITH_GTKMM_3_0
label_avail->set_hexpand();
label_avail->set_valign(Gtk::ALIGN_CENTER);
_page_cms->table().attach(*label_avail, 0, row, 3, 1);
-#else
- _page_cms->table().attach(*label_avail, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0);
-#endif
row++;
-#if WITH_GTKMM_3_0
_AvailableProfilesList.set_hexpand();
_AvailableProfilesList.set_valign(Gtk::ALIGN_CENTER);
_page_cms->table().attach(_AvailableProfilesList, 0, row, 1, 1);
@@ -732,11 +686,6 @@ void DocumentProperties::build_cms()
_unlink_btn.set_halign(Gtk::ALIGN_CENTER);
_unlink_btn.set_valign(Gtk::ALIGN_CENTER);
_page_cms->table().attach(_unlink_btn, 2, row, 1, 1);
-#else
- _page_cms->table().attach(_AvailableProfilesList, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0);
- _page_cms->table().attach(_link_btn, 1, 2, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 2, 0);
- _page_cms->table().attach(_unlink_btn, 2, 3, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 0, 0);
-#endif
// Set up the Avialable Profiles combo box
_AvailableProfilesListStore = Gtk::ListStore::create(_AvailableProfilesListColumns);
@@ -803,41 +752,27 @@ void DocumentProperties::build_scripting()
gint row = 0;
label_external->set_alignment(0.0);
-
-#if WITH_GTKMM_3_0
label_external->set_hexpand();
label_external->set_valign(Gtk::ALIGN_CENTER);
_page_external_scripts->table().attach(*label_external, 0, row, 3, 1);
-#else
- _page_external_scripts->table().attach(*label_external, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0);
-#endif
row++;
-#if WITH_GTKMM_3_0
_ExternalScriptsListScroller.set_hexpand();
_ExternalScriptsListScroller.set_valign(Gtk::ALIGN_CENTER);
_page_external_scripts->table().attach(_ExternalScriptsListScroller, 0, row, 3, 1);
-#else
- _page_external_scripts->table().attach(_ExternalScriptsListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0);
-#endif
row++;
Gtk::HBox* spacer_external = Gtk::manage(new Gtk::HBox());
spacer_external->set_size_request(SPACE_SIZE_X, SPACE_SIZE_Y);
-#if WITH_GTKMM_3_0
spacer_external->set_hexpand();
spacer_external->set_valign(Gtk::ALIGN_CENTER);
_page_external_scripts->table().attach(*spacer_external, 0, row, 3, 1);
-#else
- _page_external_scripts->table().attach(*spacer_external, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0);
-#endif
row++;
-#if WITH_GTKMM_3_0
_script_entry.set_hexpand();
_script_entry.set_valign(Gtk::ALIGN_CENTER);
_page_external_scripts->table().attach(_script_entry, 0, row, 1, 1);
@@ -851,11 +786,6 @@ void DocumentProperties::build_scripting()
_external_remove_btn.set_halign(Gtk::ALIGN_CENTER);
_external_remove_btn.set_valign(Gtk::ALIGN_CENTER);
_page_external_scripts->table().attach(_external_remove_btn, 2, row, 1, 1);
-#else
- _page_external_scripts->table().attach(_script_entry, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0);
- _page_external_scripts->table().attach(_external_add_btn, 1, 2, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 2, 0);
- _page_external_scripts->table().attach(_external_remove_btn, 2, 3, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 0, 0);
-#endif
//# Set up the External Scripts box
_ExternalScriptsListStore = Gtk::ListStore::create(_ExternalScriptsListColumns);
@@ -876,12 +806,6 @@ void DocumentProperties::build_scripting()
_embed_remove_btn.set_tooltip_text(_("Remove"));
docprops_style_button(_embed_remove_btn, INKSCAPE_ICON("list-remove"));
-#if !WITH_GTKMM_3_0
- // TODO: This has been removed from Gtkmm 3.0. Check that
- // everything still looks OK!
- _embed_button_box.set_child_min_width( 16 );
- _embed_button_box.set_spacing( 4 );
-#endif
_embed_button_box.set_layout (Gtk::BUTTONBOX_START);
_embed_button_box.add(_embed_new_btn);
_embed_button_box.add(_embed_remove_btn);
@@ -890,47 +814,29 @@ void DocumentProperties::build_scripting()
row = 0;
label_embedded->set_alignment(0.0);
-
-#if WITH_GTKMM_3_0
label_embedded->set_hexpand();
label_embedded->set_valign(Gtk::ALIGN_CENTER);
_page_embedded_scripts->table().attach(*label_embedded, 0, row, 3, 1);
-#else
- _page_embedded_scripts->table().attach(*label_embedded, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0);
-#endif
row++;
-#if WITH_GTKMM_3_0
_EmbeddedScriptsListScroller.set_hexpand();
_EmbeddedScriptsListScroller.set_valign(Gtk::ALIGN_CENTER);
_page_embedded_scripts->table().attach(_EmbeddedScriptsListScroller, 0, row, 3, 1);
-#else
- _page_embedded_scripts->table().attach(_EmbeddedScriptsListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0);
-#endif
row++;
-#if WITH_GTKMM_3_0
_embed_button_box.set_hexpand();
_embed_button_box.set_valign(Gtk::ALIGN_CENTER);
_page_embedded_scripts->table().attach(_embed_button_box, 0, row, 1, 1);
-#else
- _page_embedded_scripts->table().attach(_embed_button_box, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0);
-#endif
row++;
Gtk::HBox* spacer_embedded = Gtk::manage(new Gtk::HBox());
spacer_embedded->set_size_request(SPACE_SIZE_X, SPACE_SIZE_Y);
-
-#if WITH_GTKMM_3_0
spacer_embedded->set_hexpand();
spacer_embedded->set_valign(Gtk::ALIGN_CENTER);
_page_embedded_scripts->table().attach(*spacer_embedded, 0, row, 3, 1);
-#else
- _page_embedded_scripts->table().attach(*spacer_embedded, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0);
-#endif
row++;
@@ -946,24 +852,15 @@ void DocumentProperties::build_scripting()
label_embedded_content->set_markup (_("<b>Content:</b>"));
label_embedded_content->set_alignment(0.0);
-
-#if WITH_GTKMM_3_0
label_embedded_content->set_hexpand();
label_embedded_content->set_valign(Gtk::ALIGN_CENTER);
_page_embedded_scripts->table().attach(*label_embedded_content, 0, row, 3, 1);
-#else
- _page_embedded_scripts->table().attach(*label_embedded_content, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0);
-#endif
row++;
-#if WITH_GTKMM_3_0
_EmbeddedContentScroller.set_hexpand();
_EmbeddedContentScroller.set_valign(Gtk::ALIGN_CENTER);
_page_embedded_scripts->table().attach(_EmbeddedContentScroller, 0, row, 3, 1);
-#else
- _page_embedded_scripts->table().attach(_EmbeddedContentScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0);
-#endif
_EmbeddedContentScroller.add(_EmbeddedContent);
_EmbeddedContentScroller.set_shadow_type(Gtk::SHADOW_IN);
@@ -1025,12 +922,8 @@ void DocumentProperties::build_metadata()
label->set_markup (_("<b>Dublin Core Entities</b>"));
label->set_alignment (0.0);
-#if WITH_GTKMM_3_0
label->set_valign(Gtk::ALIGN_CENTER);
_page_metadata1->table().attach (*label, 0,0,3,1);
-#else
- _page_metadata1->table().attach (*label, 0,3,0,1, Gtk::FILL, (Gtk::AttachOptions)0,0,0);
-#endif
/* add generic metadata entry areas */
struct rdf_work_entity_t * entity;
@@ -1041,8 +934,6 @@ void DocumentProperties::build_metadata()
_rdflist.push_back (w);
Gtk::HBox *space = Gtk::manage (new Gtk::HBox);
space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y);
-
-#if WITH_GTKMM_3_0
space->set_valign(Gtk::ALIGN_CENTER);
_page_metadata1->table().attach(*space, 0, row, 1, 1);
@@ -1052,11 +943,6 @@ void DocumentProperties::build_metadata()
w->_packable->set_hexpand();
w->_packable->set_valign(Gtk::ALIGN_CENTER);
_page_metadata1->table().attach(*w->_packable, 2, row, 1, 1);
-#else
- _page_metadata1->table().attach (*space, 0,1, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0);
- _page_metadata1->table().attach (w->_label, 1,2, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0);
- _page_metadata1->table().attach (*w->_packable, 2,3, row, row+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0);
-#endif
}
}
@@ -1065,11 +951,7 @@ void DocumentProperties::build_metadata()
Gtk::Button *button_load = Gtk::manage (new Gtk::Button(_("Use _default"),1));
button_load->set_tooltip_text(_("Use the previously saved default metadata here"));
-#if WITH_GTKMM_3_0
- Gtk::ButtonBox *box_buttons = Gtk::manage (new Gtk::ButtonBox);
-#else
- Gtk::HButtonBox *box_buttons = Gtk::manage (new Gtk::HButtonBox);
-#endif
+ auto box_buttons = Gtk::manage (new Gtk::ButtonBox);
box_buttons->set_layout(Gtk::BUTTONBOX_END);
box_buttons->set_spacing(4);
@@ -1087,12 +969,8 @@ void DocumentProperties::build_metadata()
llabel->set_markup (_("<b>License</b>"));
llabel->set_alignment (0.0);
-#if WITH_GTKMM_3_0
llabel->set_valign(Gtk::ALIGN_CENTER);
_page_metadata2->table().attach(*llabel, 0, row, 3, 1);
-#else
- _page_metadata2->table().attach (*llabel, 0,3, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0);
-#endif
/* add license selector pull-down and URI */
++row;
@@ -1100,17 +978,12 @@ void DocumentProperties::build_metadata()
Gtk::HBox *space = Gtk::manage (new Gtk::HBox);
space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y);
-#if WITH_GTKMM_3_0
space->set_valign(Gtk::ALIGN_CENTER);
_page_metadata2->table().attach(*space, 0, row, 1, 1);
_licensor.set_hexpand();
_licensor.set_valign(Gtk::ALIGN_CENTER);
_page_metadata2->table().attach(_licensor, 1, row, 3, 1);
-#else
- _page_metadata2->table().attach (*space, 0,1, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0);
- _page_metadata2->table().attach (_licensor, 1,3, row, row+1, Gtk::EXPAND|Gtk::FILL, (Gtk::AttachOptions)0,0,0);
-#endif
}
void DocumentProperties::addExternalScript(){
@@ -1303,12 +1176,7 @@ void DocumentProperties::changeEmbeddedScript(){
for (std::vector<SPObject *>::const_iterator it = current.begin(); it != current.end(); ++it) {
SPObject* obj = *it;
if (id == obj->getId()){
-
- int count=0;
- for ( SPObject *child = obj->children ; child; child = child->next )
- {
- count++;
- }
+ int count = (int) obj->children.size();
if (count>1)
g_warning("TODO: Found a script element with multiple (%d) child nodes! We must implement support for that!", count);
@@ -1352,8 +1220,11 @@ void DocumentProperties::editEmbeddedScript(){
//XML Tree being used directly here while it shouldn't be.
Inkscape::XML::Node *repr = obj->getRepr();
if (repr){
- SPObject *child;
- while (NULL != (child = obj->firstChild())) child->deleteObject();
+ auto tmp = obj->children | boost::adaptors::transformed([](SPObject& o) { return &o; });
+ std::vector<SPObject*> vec(tmp.begin(), tmp.end());
+ for (auto &child: vec) {
+ child->deleteObject();
+ }
obj->appendChildRepr(xml_doc->createTextNode(_EmbeddedContent.get_buffer()->get_text().c_str()));
//TODO repr->set_content(_EmbeddedContent.get_buffer()->get_text());
diff --git a/src/ui/dialog/document-properties.h b/src/ui/dialog/document-properties.h
index 7f91d9ea0..8d1c6b38a 100644
--- a/src/ui/dialog/document-properties.h
+++ b/src/ui/dialog/document-properties.h
@@ -173,11 +173,7 @@ protected:
Gtk::Button _external_remove_btn;
Gtk::Button _embed_new_btn;
Gtk::Button _embed_remove_btn;
-#if WITH_GTKMM_3_0
- Gtk::ButtonBox _embed_button_box;
-#else
- Gtk::HButtonBox _embed_button_box;
-#endif
+ Gtk::ButtonBox _embed_button_box;
class ExternalScriptsColumns : public Gtk::TreeModel::ColumnRecord
{
diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp
index 28acfdfb5..670e4c8b5 100644
--- a/src/ui/dialog/export.cpp
+++ b/src/ui/dialog/export.cpp
@@ -24,15 +24,10 @@
#include <gtkmm/buttonbox.h>
#include <gtkmm/dialog.h>
#include <gtkmm/entry.h>
+#include <gtkmm/grid.h>
#include <gtkmm/spinbutton.h>
#include <gtkmm/stock.h>
-#if WITH_GTKMM_3_0
-# include <gtkmm/grid.h>
-#else
-# include <gtkmm/table.h>
-#endif
-
#ifdef WITH_GNOME_VFS
# include <libgnomevfs/gnome-vfs-init.h> // gnome_vfs_initialized
#endif
@@ -63,12 +58,7 @@
#include "helper/png-write.h"
-#if WITH_EXT_GDL
#include <gdl/gdl-dock-item.h>
-#else
-#include "libgdl/gdl-dock-item.h"
-#endif
-
// required to set status message after export
#include "desktop.h"
@@ -205,15 +195,9 @@ Export::Export (void) :
selectiontype_buttons[i]->signal_clicked().connect(sigc::mem_fun(*this, &Export::onAreaToggled));
}
-#if WITH_GTKMM_3_0
- Gtk::Grid* t = new Gtk::Grid();
+ auto t = new Gtk::Grid();
t->set_row_spacing(4);
t->set_column_spacing(4);
-#else
- Gtk::Table* t = new Gtk::Table(3, 4, false);
- t->set_row_spacings (4);
- t->set_col_spacings (4);
-#endif
x0_adj = createSpinbutton ( "x0", 0.0, -1000000.0, 1000000.0, 0.1, 1.0,
t, 0, 0, _("_x0:"), "", EXPORT_COORD_PRECISION, 1,
@@ -255,15 +239,9 @@ Export::Export (void) :
bm_label->set_use_markup(true);
size_box.pack_start(*bm_label, false, false, 0);
-#if WITH_GTKMM_3_0
- Gtk::Grid *t = new Gtk::Grid();
+ auto t = new Gtk::Grid();
t->set_row_spacing(4);
t->set_column_spacing(4);
-#else
- Gtk::Table *t = new Gtk::Table(2, 5, false);
- t->set_row_spacings (4);
- t->set_col_spacings (4);
-#endif
size_box.pack_start(*t);
@@ -471,27 +449,14 @@ void Export::set_default_filename () {
}
}
-#if WITH_GTKMM_3_0
Glib::RefPtr<Gtk::Adjustment> Export::createSpinbutton( gchar const * /*key*/, float val, float min, float max,
float step, float page,
Gtk::Grid *t, int x, int y,
const Glib::ustring& ll, const Glib::ustring& lr,
int digits, unsigned int sensitive,
void (Export::*cb)() )
-#else
-Gtk::Adjustment * Export::createSpinbutton( gchar const * /*key*/, float val, float min, float max,
- float step, float page,
- Gtk::Table *t, int x, int y,
- const Glib::ustring& ll, const Glib::ustring& lr,
- int digits, unsigned int sensitive,
- void (Export::*cb)() )
-#endif
{
-#if WITH_GTKMM_3_0
- Glib::RefPtr<Gtk::Adjustment> adj = Gtk::Adjustment::create(val, min, max, step, page, 0);
-#else
- Gtk::Adjustment *adj = new Gtk::Adjustment ( val, min, max, step, page, 0 );
-#endif
+ auto adj = Gtk::Adjustment::create(val, min, max, step, page, 0);
int pos = 0;
Gtk::Label *l = NULL;
@@ -499,28 +464,17 @@ Gtk::Adjustment * Export::createSpinbutton( gchar const * /*key*/, float val, fl
if (!ll.empty()) {
l = new Gtk::Label(ll,true);
l->set_alignment (1.0, 0.5);
-
-#if WITH_GTKMM_3_0
l->set_hexpand();
l->set_vexpand();
t->attach(*l, x + pos, y, 1, 1);
-#else
- t->attach (*l, x + pos, x + pos + 1, y, y + 1, Gtk::EXPAND, Gtk::EXPAND, 0, 0 );
-#endif
-
l->set_sensitive(sensitive);
pos++;
}
-#if WITH_GTKMM_3_0
- Gtk::SpinButton *sb = new Gtk::SpinButton(adj, 1.0, digits);
+ auto sb = new Gtk::SpinButton(adj, 1.0, digits);
sb->set_hexpand();
sb->set_vexpand();
t->attach(*sb, x + pos, y, 1, 1);
-#else
- Gtk::SpinButton *sb = new Gtk::SpinButton(*adj, 1.0, digits);
- t->attach (*sb, x + pos, x + pos + 1, y, y + 1, Gtk::EXPAND, Gtk::EXPAND, 0, 0 );
-#endif
sb->set_width_chars(7);
sb->set_sensitive (sensitive);
@@ -533,15 +487,9 @@ Gtk::Adjustment * Export::createSpinbutton( gchar const * /*key*/, float val, fl
if (!lr.empty()) {
l = new Gtk::Label(lr,true);
l->set_alignment (0.0, 0.5);
-
-#if WITH_GTKMM_3_0
l->set_hexpand();
l->set_vexpand();
t->attach(*l, x + pos, y, 1, 1);
-#else
- t->attach (*l, x + pos, x + pos + 1, y, y + 1, Gtk::EXPAND, Gtk::EXPAND, 0, 0 );
-#endif
-
l->set_sensitive (sensitive);
pos++;
l->set_mnemonic_widget (*sb);
@@ -595,7 +543,7 @@ void Export::onBatchClicked ()
void Export::updateCheckbuttons ()
{
- gint num = SP_ACTIVE_DESKTOP->getSelection()->itemList().size();
+ gint num = (gint) boost::distance(SP_ACTIVE_DESKTOP->getSelection()->items());
if (num >= 2) {
batch_export.set_sensitive(true);
batch_export.set_label(g_strdup_printf (ngettext("B_atch export %d selected object","B_atch export %d selected objects",num), num));
@@ -801,14 +749,14 @@ void Export::onAreaToggled ()
case SELECTION_SELECTION:
if ((SP_ACTIVE_DESKTOP->getSelection())->isEmpty() == false) {
- sp_selection_get_export_hints (SP_ACTIVE_DESKTOP->getSelection(), filename, &xdpi, &ydpi);
+ sp_object_set_get_export_hints(SP_ACTIVE_DESKTOP->getSelection(), filename, &xdpi, &ydpi);
/* If we still don't have a filename -- let's build
one that's nice */
if (filename.empty()) {
const gchar * id = "object";
- const std::vector<XML::Node*> reprlst = SP_ACTIVE_DESKTOP->getSelection()->reprList();
- for(std::vector<XML::Node*>::const_iterator i=reprlst.begin(); reprlst.end() != i; ++i) {
+ auto reprlst = SP_ACTIVE_DESKTOP->getSelection()->xmlNodes();
+ for(auto i=reprlst.begin(); reprlst.end() != i; ++i) {
Inkscape::XML::Node * repr = *i;
if (repr->attribute("id")) {
id = repr->attribute("id");
@@ -919,11 +867,7 @@ Gtk::Dialog * Export::create_progress_dialog (Glib::ustring progress_text) {
Gtk::ProgressBar *prg = new Gtk::ProgressBar ();
prg->set_text(progress_text);
dlg->set_data ("progress", prg);
-#if GTK_CHECK_VERSION(3,0,0)
- Gtk::Box* CA = dlg->get_content_area();
-#else
- Gtk::Box* CA = dlg->get_vbox();
-#endif
+ auto CA = dlg->get_content_area();
CA->pack_start(*prg, FALSE, FALSE, 4);
Gtk::Button* btn = dlg->add_button (Gtk::Stock::CANCEL,Gtk::RESPONSE_CANCEL );
@@ -1002,7 +946,7 @@ void Export::onExport ()
if (batch_export.get_active ()) {
// Batch export of selected objects
- gint num = (desktop->getSelection()->itemList()).size();
+ gint num = (gint) boost::distance(desktop->getSelection()->items());
gint n = 0;
if (num < 1) {
@@ -1016,8 +960,8 @@ void Export::onExport ()
gint export_count = 0;
- std::vector<SPItem*> itemlist=desktop->getSelection()->itemList();
- for(std::vector<SPItem*>::const_iterator i = itemlist.begin();i!=itemlist.end() && !interrupted ;++i){
+ auto itemlist= desktop->getSelection()->items();
+ for(auto i = itemlist.begin();i!=itemlist.end() && !interrupted ;++i){
SPItem *item = *i;
prog_dlg->set_data("current", GINT_TO_POINTER(n));
@@ -1057,12 +1001,13 @@ void Export::onExport ()
MessageCleaner msgFlashCleanup(desktop->messageStack()->flashF(Inkscape::IMMEDIATE_MESSAGE,
_("Exporting file <b>%s</b>..."), safeFile), desktop);
std::vector<SPItem*> x;
+ std::vector<SPItem*> selected(desktop->getSelection()->items().begin(), desktop->getSelection()->items().end());
if (!sp_export_png_file (doc, path.c_str(),
*area, width, height, dpi, dpi,
nv->pagecolor,
onProgressCallback, (void*)prog_dlg,
TRUE, // overwrite without asking
- hide ? (desktop->getSelection()->itemList()) : x
+ hide ? selected : x
)) {
gchar * error = g_strdup_printf(_("Could not export to filename %s.\n"), safeFile);
@@ -1147,12 +1092,13 @@ void Export::onExport ()
/* Do export */
std::vector<SPItem*> x;
+ std::vector<SPItem*> selected(desktop->getSelection()->items().begin(), desktop->getSelection()->items().end());
ExportResult status = sp_export_png_file(desktop->getDocument(), path.c_str(),
Geom::Rect(Geom::Point(x0, y0), Geom::Point(x1, y1)), width, height, xdpi, ydpi,
nv->pagecolor,
onProgressCallback, (void*)prog_dlg,
FALSE,
- hide ? (desktop->getSelection()->itemList()) : x
+ hide ? selected : x
);
if (status == EXPORT_ERROR) {
gchar * safeFile = Inkscape::IO::sanitizeString(path.c_str());
@@ -1218,15 +1164,14 @@ void Export::onExport ()
break;
}
case SELECTION_SELECTION: {
- std::vector<XML::Node*> reprlst;
SPDocument * doc = SP_ACTIVE_DOCUMENT;
bool modified = false;
bool saved = DocumentUndo::getUndoSensitive(doc);
DocumentUndo::setUndoSensitive(doc, false);
- reprlst = desktop->getSelection()->reprList();
+ auto reprlst = desktop->getSelection()->xmlNodes();
- for(std::vector<Inkscape::XML::Node*>::const_iterator i=reprlst.begin(); reprlst.end() != i; ++i) {
+ for(auto i=reprlst.begin(); reprlst.end() != i; ++i) {
Inkscape::XML::Node * repr = *i;
const gchar * temp_string;
Glib::ustring dir = Glib::path_get_dirname(filename.c_str());
@@ -1344,11 +1289,7 @@ void Export::onBrowse ()
Glib::RefPtr<const Gdk::Window> parentWindow = desktop->getToplevel()->get_window();
g_assert(parentWindow->gobj() != NULL);
-#if WITH_GTKMM_3_0
opf.hwndOwner = (HWND)gdk_win32_window_get_handle((GdkWindow*)parentWindow->gobj());
-#else
- opf.hwndOwner = (HWND)gdk_win32_drawable_get_handle((GdkDrawable*)parentWindow->gobj());
-#endif
opf.lpstrFilter = filter_string;
opf.lpstrCustomFilter = 0;
opf.nMaxCustFilter = 0L;
@@ -1508,11 +1449,7 @@ void Export::detectSize() {
} /* sp_export_detect_size */
/// Called when area x0 value is changed
-#if WITH_GTKMM_3_0
void Export::areaXChange(Glib::RefPtr<Gtk::Adjustment>& adj)
-#else
-void Export::areaXChange (Gtk::Adjustment *adj)
-#endif
{
float x0, x1, xdpi, width;
@@ -1551,11 +1488,7 @@ void Export::areaXChange (Gtk::Adjustment *adj)
} // end of sp_export_area_x_value_changed()
/// Called when area y0 value is changed.
-#if WITH_GTKMM_3_0
void Export::areaYChange(Glib::RefPtr<Gtk::Adjustment>& adj)
-#else
-void Export::areaYChange (Gtk::Adjustment *adj)
-#endif
{
float y0, y1, ydpi, height;
@@ -1862,11 +1795,7 @@ void Export::setArea( double x0, double y0, double x1, double y1 )
* @param adj The adjustment widget
* @param val What value to set it to.
*/
-#if WITH_GTKMM_3_0
void Export::setValue(Glib::RefPtr<Gtk::Adjustment>& adj, double val )
-#else
-void Export::setValue( Gtk::Adjustment *adj, double val )
-#endif
{
if (adj) {
adj->set_value(val);
@@ -1884,11 +1813,7 @@ void Export::setValue( Gtk::Adjustment *adj, double val )
* @param adj The adjustment widget
* @param val What the value should be in points.
*/
-#if WITH_GTKMM_3_0
void Export::setValuePx(Glib::RefPtr<Gtk::Adjustment>& adj, double val)
-#else
-void Export::setValuePx( Gtk::Adjustment *adj, double val)
-#endif
{
Unit const *unit = unit_selector.getUnit();
@@ -1907,11 +1832,7 @@ void Export::setValuePx( Gtk::Adjustment *adj, double val)
*
* @return The value in the specified adjustment.
*/
-#if WITH_GTKMM_3_0
float Export::getValue(Glib::RefPtr<Gtk::Adjustment>& adj)
-#else
-float Export::getValue( Gtk::Adjustment *adj )
-#endif
{
if (!adj) {
g_message("sp_export_value_get : adj is NULL");
@@ -1933,11 +1854,7 @@ float Export::getValue( Gtk::Adjustment *adj )
*
* @return The value in the adjustment in points.
*/
-#if WITH_GTKMM_3_0
float Export::getValuePx(Glib::RefPtr<Gtk::Adjustment>& adj)
-#else
-float Export::getValuePx( Gtk::Adjustment *adj )
-#endif
{
float value = getValue( adj);
Unit const *unit = unit_selector.getUnit();
diff --git a/src/ui/dialog/export.h b/src/ui/dialog/export.h
index 23af0109b..a1c44714b 100644
--- a/src/ui/dialog/export.h
+++ b/src/ui/dialog/export.h
@@ -79,17 +79,10 @@ private:
/*
* Getter/setter style functions for the spinbuttons
*/
-#if WITH_GTKMM_3_0
void setValue(Glib::RefPtr<Gtk::Adjustment>& adj, double val);
void setValuePx(Glib::RefPtr<Gtk::Adjustment>& adj, double val);
float getValue(Glib::RefPtr<Gtk::Adjustment>& adj);
float getValuePx(Glib::RefPtr<Gtk::Adjustment>& adj);
-#else
- void setValue (Gtk::Adjustment *adj, double val);
- void setValuePx (Gtk::Adjustment *adj, double val);
- float getValue (Gtk::Adjustment *adj);
- float getValuePx (Gtk::Adjustment *adj);
-#endif
/**
* Helper function to create, style and pack spinbuttons for the export dialog.
@@ -112,21 +105,12 @@ private:
*
* No unit_selector is stored in the created spinbutton, relies on external unit management
*/
-#if WITH_GTKMM_3_0
Glib::RefPtr<Gtk::Adjustment> createSpinbutton( gchar const *key, float val, float min, float max,
float step, float page,
Gtk::Grid *t, int x, int y,
const Glib::ustring& ll, const Glib::ustring& lr,
int digits, unsigned int sensitive,
void (Export::*cb)() );
-#else
- Gtk::Adjustment * createSpinbutton( gchar const *key, float val, float min, float max,
- float step, float page,
- Gtk::Table *t, int x, int y,
- const Glib::ustring& ll, const Glib::ustring& lr,
- int digits, unsigned int sensitive,
- void (Export::*cb)() );
-#endif
/**
* One of the area select radio buttons was pressed
@@ -152,11 +136,7 @@ private:
void onAreaX1Change() {
areaXChange(x1_adj);
} ;
-#if WITH_GTKMM_3_0
void areaXChange(Glib::RefPtr<Gtk::Adjustment>& adj);
-#else
- void areaXChange ( Gtk::Adjustment *adj);
-#endif
/**
* Area Y value changed callback
@@ -167,11 +147,7 @@ private:
void onAreaY1Change() {
areaYChange(y1_adj);
} ;
-#if WITH_GTKMM_3_0
void areaYChange(Glib::RefPtr<Gtk::Adjustment>& adj);
-#else
- void areaYChange ( Gtk::Adjustment *adj);
-#endif
/**
* Unit changed callback
@@ -298,7 +274,6 @@ private:
Gtk::VBox area_box;
Gtk::VBox singleexport_box;
-#if WITH_GTKMM_3_0
/* Custom size widgets */
Glib::RefPtr<Gtk::Adjustment> x0_adj;
Glib::RefPtr<Gtk::Adjustment> x1_adj;
@@ -312,21 +287,6 @@ private:
Glib::RefPtr<Gtk::Adjustment> bmheight_adj;
Glib::RefPtr<Gtk::Adjustment> xdpi_adj;
Glib::RefPtr<Gtk::Adjustment> ydpi_adj;
-#else
- /* Custom size widgets */
- Gtk::Adjustment *x0_adj;
- Gtk::Adjustment *x1_adj;
- Gtk::Adjustment *y0_adj;
- Gtk::Adjustment *y1_adj;
- Gtk::Adjustment *width_adj;
- Gtk::Adjustment *height_adj;
-
- /* Bitmap size widgets */
- Gtk::Adjustment *bmwidth_adj;
- Gtk::Adjustment *bmheight_adj;
- Gtk::Adjustment *xdpi_adj;
- Gtk::Adjustment *ydpi_adj;
-#endif
Gtk::VBox size_box;
Gtk::Label* bm_label;
diff --git a/src/ui/dialog/filedialog.cpp b/src/ui/dialog/filedialog.cpp
index ee673aecf..df3c4a307 100644
--- a/src/ui/dialog/filedialog.cpp
+++ b/src/ui/dialog/filedialog.cpp
@@ -15,12 +15,18 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-#include "filedialogimpl-win32.h"
+#ifdef WIN32
+# include "filedialogimpl-win32.h"
+# include "preferences.h"
+#endif
+
#include "filedialogimpl-gtkmm.h"
#include "ui/dialog-events.h"
#include "extension/output.h"
+#include <glibmm/convert.h>
+
namespace Inkscape
{
namespace UI
diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp
index 042637d22..e8c1bf723 100644
--- a/src/ui/dialog/filedialogimpl-gtkmm.cpp
+++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp
@@ -754,16 +754,9 @@ FileOpenDialogImplGtk::~FileOpenDialogImplGtk()
void FileOpenDialogImplGtk::addFilterMenu(Glib::ustring name, Glib::ustring pattern)
{
-
-#if WITH_GTKMM_3_0
- Glib::RefPtr<Gtk::FileFilter> allFilter = Gtk::FileFilter::create();
+ auto allFilter = Gtk::FileFilter::create();
allFilter->set_name(_(name.c_str()));
allFilter->add_pattern(pattern);
-#else
- Gtk::FileFilter allFilter;
- allFilter.set_name(_(name.c_str()));
- allFilter.add_pattern(pattern);
-#endif
extensionMap[Glib::ustring(_("All Files"))] = NULL;
add_filter(allFilter);
}
@@ -775,51 +768,27 @@ void FileOpenDialogImplGtk::createFilterMenu()
}
if (_dialogType == EXE_TYPES) {
-#if WITH_GTKMM_3_0
- Glib::RefPtr<Gtk::FileFilter> allFilter = Gtk::FileFilter::create();
+ auto allFilter = Gtk::FileFilter::create();
allFilter->set_name(_("All Files"));
allFilter->add_pattern("*");
-#else
- Gtk::FileFilter allFilter;
- allFilter.set_name(_("All Files"));
- allFilter.add_pattern("*");
-#endif
extensionMap[Glib::ustring(_("All Files"))] = NULL;
add_filter(allFilter);
} else {
-#if WITH_GTKMM_3_0
- Glib::RefPtr<Gtk::FileFilter> allInkscapeFilter = Gtk::FileFilter::create();
+ auto allInkscapeFilter = Gtk::FileFilter::create();
allInkscapeFilter->set_name(_("All Inkscape Files"));
- Glib::RefPtr<Gtk::FileFilter> allFilter = Gtk::FileFilter::create();
+ auto allFilter = Gtk::FileFilter::create();
allFilter->set_name(_("All Files"));
allFilter->add_pattern("*");
- Glib::RefPtr<Gtk::FileFilter> allImageFilter = Gtk::FileFilter::create();
+ auto allImageFilter = Gtk::FileFilter::create();
allImageFilter->set_name(_("All Images"));
- Glib::RefPtr<Gtk::FileFilter> allVectorFilter = Gtk::FileFilter::create();
+ auto allVectorFilter = Gtk::FileFilter::create();
allVectorFilter->set_name(_("All Vectors"));
- Glib::RefPtr<Gtk::FileFilter> allBitmapFilter = Gtk::FileFilter::create();
+ auto allBitmapFilter = Gtk::FileFilter::create();
allBitmapFilter->set_name(_("All Bitmaps"));
-#else
- Gtk::FileFilter allInkscapeFilter;
- allInkscapeFilter.set_name(_("All Inkscape Files"));
-
- Gtk::FileFilter allFilter;
- allFilter.set_name(_("All Files"));
- allFilter.add_pattern("*");
-
- Gtk::FileFilter allImageFilter;
- allImageFilter.set_name(_("All Images"));
-
- Gtk::FileFilter allVectorFilter;
- allVectorFilter.set_name(_("All Vectors"));
-
- Gtk::FileFilter allBitmapFilter;
- allBitmapFilter.set_name(_("All Bitmaps"));
-#endif
extensionMap[Glib::ustring(_("All Inkscape Files"))] = NULL;
add_filter(allInkscapeFilter);
@@ -854,29 +823,16 @@ void FileOpenDialogImplGtk::createFilterMenu()
Glib::ustring uname(_(imod->get_filetypename()));
-#if WITH_GTKMM_3_0
- Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create();
+ auto filter = Gtk::FileFilter::create();
filter->set_name(uname);
filter->add_pattern(upattern);
-#else
- Gtk::FileFilter filter;
- filter.set_name(uname);
- filter.add_pattern(upattern);
-#endif
-
add_filter(filter);
extensionMap[uname] = imod;
// g_message("ext %s:%s '%s'\n", ioext->name, ioext->mimetype, upattern.c_str());
-#if WITH_GTKMM_3_0
allInkscapeFilter->add_pattern(upattern);
if (strncmp("image", imod->get_mimetype(), 5) == 0)
allImageFilter->add_pattern(upattern);
-#else
- allInkscapeFilter.add_pattern(upattern);
- if (strncmp("image", imod->get_mimetype(), 5) == 0)
- allImageFilter.add_pattern(upattern);
-#endif
// uncomment this to find out all mime types supported by Inkscape import/open
// g_print ("%s\n", imod->get_mimetype());
@@ -896,17 +852,9 @@ void FileOpenDialogImplGtk::createFilterMenu()
strncmp("image/x-tga", imod->get_mimetype(), 11) == 0 ||
strncmp("image/x-pcx", imod->get_mimetype(), 11) == 0)
{
-#if WITH_GTKMM_3_0
allBitmapFilter->add_pattern(upattern);
-#else
- allBitmapFilter.add_pattern(upattern);
-#endif
} else {
-#if WITH_GTKMM_3_0
allVectorFilter->add_pattern(upattern);
-#else
- allVectorFilter.add_pattern(upattern);
-#endif
}
}
}
@@ -972,18 +920,13 @@ Glib::ustring FileOpenDialogImplGtk::getFilename(void)
*/
std::vector<Glib::ustring> FileOpenDialogImplGtk::getFilenames()
{
-#if WITH_GTKMM_3_0
- std::vector<std::string> result_tmp = get_filenames();
+ auto result_tmp = get_filenames();
// Copy filenames to a vector of type Glib::ustring
std::vector<Glib::ustring> result;
- for (std::vector<std::string>::iterator it = result_tmp.begin(); it != result_tmp.end(); ++it)
- result.push_back(*it);
-
-#else
- std::vector<Glib::ustring> result = get_filenames();
-#endif
+ for (auto it : result_tmp)
+ result.push_back(it);
#ifdef WITH_GNOME_VFS
if (result.empty() && gnome_vfs_initialized())
@@ -1170,13 +1113,8 @@ void FileSaveDialogImplGtk::fileTypeChangedCallback()
// g_message("selected: %s\n", type.name.c_str());
extension = type.extension;
-#if WITH_GTKMM_3_0
- Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create();
+ auto filter = Gtk::FileFilter::create();
filter->add_pattern(type.pattern);
-#else
- Gtk::FileFilter filter;
- filter.add_pattern(type.pattern);
-#endif
set_filter(filter);
updateNameAndExtension();
diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp
index cafc3be4f..02d77cba1 100644
--- a/src/ui/dialog/filedialogimpl-win32.cpp
+++ b/src/ui/dialog/filedialogimpl-win32.cpp
@@ -128,11 +128,7 @@ FileDialogBaseWin32::FileDialogBaseWin32(Gtk::Window &parent,
Glib::RefPtr<const Gdk::Window> parentWindow = parent.get_window();
g_assert(parentWindow->gobj() != NULL);
-#if WITH_GTKMM_3_0
_ownerHwnd = (HWND)gdk_win32_window_get_handle((GdkWindow*)parentWindow->gobj());
-#else
- _ownerHwnd = (HWND)gdk_win32_drawable_get_handle((GdkDrawable*)parentWindow->gobj());
-#endif
}
FileDialogBaseWin32::~FileDialogBaseWin32()
diff --git a/src/ui/dialog/fill-and-stroke.cpp b/src/ui/dialog/fill-and-stroke.cpp
index fa69851e4..0b3b468e9 100644
--- a/src/ui/dialog/fill-and-stroke.cpp
+++ b/src/ui/dialog/fill-and-stroke.cpp
@@ -107,11 +107,7 @@ void FillAndStroke::setTargetDesktop(SPDesktop *desktop)
}
}
-#if WITH_GTKMM_3_0
void FillAndStroke::_onSwitchPage(Gtk::Widget * /*page*/, guint pagenum)
-#else
-void FillAndStroke::_onSwitchPage(GtkNotebookPage * /*page*/, guint pagenum)
-#endif
{
_savePagePref(pagenum);
}
@@ -128,24 +124,14 @@ void
FillAndStroke::_layoutPageFill()
{
fillWdgt = Gtk::manage(sp_fill_style_widget_new());
-
-#if WITH_GTKMM_3_0
_page_fill->table().attach(*fillWdgt, 0, 0, 1, 1);
-#else
- _page_fill->table().attach(*fillWdgt, 0, 1, 0, 1);
-#endif
}
void
FillAndStroke::_layoutPageStrokePaint()
{
strokeWdgt = Gtk::manage(sp_stroke_style_paint_widget_new());
-
-#if WITH_GTKMM_3_0
_page_stroke_paint->table().attach(*strokeWdgt, 0, 0, 1, 1);
-#else
- _page_stroke_paint->table().attach(*strokeWdgt, 0, 1, 0, 1);
-#endif
}
void
@@ -154,12 +140,7 @@ FillAndStroke::_layoutPageStrokeStyle()
//Gtk::Widget *strokeStyleWdgt = manage(Glib::wrap(sp_stroke_style_line_widget_new()));
//Gtk::Widget *strokeStyleWdgt = static_cast<Gtk::Widget *>(sp_stroke_style_line_widget_new());
strokeStyleWdgt = sp_stroke_style_line_widget_new();
-
-#if WITH_GTKMM_3_0
_page_stroke_style->table().attach(*strokeStyleWdgt, 0, 0, 1, 1);
-#else
- _page_stroke_style->table().attach(*strokeStyleWdgt, 0, 1, 0, 1);
-#endif
}
void
diff --git a/src/ui/dialog/fill-and-stroke.h b/src/ui/dialog/fill-and-stroke.h
index f2a6bf39d..67e9d60ed 100644
--- a/src/ui/dialog/fill-and-stroke.h
+++ b/src/ui/dialog/fill-and-stroke.h
@@ -64,11 +64,7 @@ protected:
void _layoutPageStrokePaint();
void _layoutPageStrokeStyle();
void _savePagePref(guint page_num);
-#if WITH_GTKMM_3_0
void _onSwitchPage(Gtk::Widget *page, guint pagenum);
-#else
- void _onSwitchPage(GtkNotebookPage *page, guint pagenum);
-#endif
private:
FillAndStroke(FillAndStroke const &d);
diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp
index cbf6d3516..a0cd786dc 100644
--- a/src/ui/dialog/filter-effects-dialog.cpp
+++ b/src/ui/dialog/filter-effects-dialog.cpp
@@ -22,7 +22,10 @@
#include "dialog-manager.h"
#include <gtkmm/imagemenuitem.h>
-#if GTK_CHECK_VERSION(3,0,0)
+#include <gdkmm/display.h>
+#if GTK_CHECK_VERSION(3, 20, 0)
+# include <gdkmm/seat.h>
+#else
# include <gdkmm/devicemanager.h>
#endif
@@ -86,9 +89,7 @@ static int input_count(const SPFilterPrimitive* prim)
return 2;
else if(SP_IS_FEMERGE(prim)) {
// Return the number of feMergeNode connections plus an extra
- int count = 1;
- for(const SPObject* o = prim->firstChild(); o; o = o->next, ++count){};
- return count;
+ return (int) (prim->children.size() + 1);
}
else
return 1;
@@ -302,15 +303,9 @@ public:
set_tooltip_text(tip_text);
}
-#if WITH_GTKMM_3_0
Gdk::RGBA col;
col.set_rgba_u(65535, 65535, 65535);
set_rgba(col);
-#else
- Gdk::Color col;
- col.set_rgb(65535, 65535, 65535);
- set_color(col);
-#endif
}
// Returns the color in 'rgb(r,g,b)' form.
@@ -319,13 +314,8 @@ public:
// no doubles here, so we can use the standard string stream.
std::ostringstream os;
-#if WITH_GTKMM_3_0
- const Gdk::RGBA c = get_rgba();
- const int r = c.get_red_u() / 257, g = c.get_green_u() / 257, b = c.get_blue_u() / 257;//TO-DO: verify this. This sounds a lot strange! shouldn't it be 256?
-#else
- const Gdk::Color c = get_color();
- const int r = c.get_red() / 257, g = c.get_green() / 257, b = c.get_blue() / 257;//TO-DO: verify this. This sounds a lot strange! shouldn't it be 256?
-#endif
+ const auto c = get_rgba();
+ const int r = c.get_red_u() / 257, g = c.get_green_u() / 257, b = c.get_blue_u() / 257;//TO-DO: verify this. This sounds a lot strange! shouldn't it be 256?
os << "rgb(" << r << "," << g << "," << b << ")";
return os.str();
}
@@ -342,15 +332,9 @@ public:
}
const int r = SP_RGBA32_R_U(i), g = SP_RGBA32_G_U(i), b = SP_RGBA32_B_U(i);
-#if WITH_GTKMM_3_0
Gdk::RGBA col;
col.set_rgba_u(r * 256, g * 256, b * 256);
set_rgba(col);
-#else
- Gdk::Color col;
- col.set_rgb(r * 256, g * 256, b * 256);
- set_color(col);
-#endif
}
};
@@ -674,7 +658,7 @@ private:
void select_svg_element(){
Inkscape::Selection* sel = _desktop->getSelection();
if (sel->isEmpty()) return;
- Inkscape::XML::Node* node = sel->reprList()[0];
+ Inkscape::XML::Node* node = sel->xmlNodes().front();
if (!node || !node->matchAttributeName("id")) return;
std::ostringstream xlikhref;
@@ -1043,11 +1027,10 @@ public:
// FuncNode can be in any order so we must search to find correct one.
SPFeFuncNode* find_node(SPFeComponentTransfer* ct)
{
- SPObject* node = ct->children;
SPFeFuncNode* funcNode = NULL;
bool found = false;
- for(;node;node=node->next){
- funcNode = SP_FEFUNCNODE(node);
+ for(auto& node: ct->children) {
+ funcNode = SP_FEFUNCNODE(&node);
if( funcNode->channel == _channel ) {
found = true;
break;
@@ -1211,7 +1194,7 @@ protected:
_locked = true;
- SPObject* child = o->children;
+ SPObject* child = o->firstChild();
if(SP_IS_FEDISTANTLIGHT(child))
_light_source.set_active(0);
@@ -1236,7 +1219,7 @@ private:
if(prim) {
_locked = true;
- SPObject* child = prim->children;
+ SPObject* child = prim->firstChild();
const int ls = _light_source.get_active_row_number();
// Check if the light source type has changed
if(!(ls == -1 && !child) &&
@@ -1270,8 +1253,8 @@ private:
_light_box.show_all();
SPFilterPrimitive* prim = _dialog._primitive_list.get_selected();
- if(prim && prim->children)
- _settings.show_and_update(_light_source.get_active_data()->id, prim->children);
+ if(prim && prim->firstChild())
+ _settings.show_and_update(_light_source.get_active_data()->id, prim->firstChild());
}
FilterEffectsDialog& _dialog;
@@ -1457,8 +1440,8 @@ void FilterEffectsDialog::FilterModifier::update_selection(Selection *sel)
}
std::set<SPObject*> used;
- std::vector<SPItem*> itemlist=sel->itemList();
- for(std::vector<SPItem*>::const_iterator i=itemlist.begin(); itemlist.end() != i; ++i) {
+ auto itemlist= sel->items();
+ for(auto i=itemlist.begin(); itemlist.end() != i; ++i) {
SPObject *obj = *i;
SPStyle *style = obj->style;
if (!style || !SP_IS_ITEM(obj)) {
@@ -1538,8 +1521,8 @@ void FilterEffectsDialog::FilterModifier::on_selection_toggled(const Glib::ustri
if((*iter)[_columns.sel] == 1)
filter = 0;
- std::vector<SPItem*> itemlist=sel->itemList();
- for(std::vector<SPItem*>::const_iterator i=itemlist.begin(); itemlist.end() != i; ++i) {
+ auto itemlist= sel->items();
+ for(auto i=itemlist.begin(); itemlist.end() != i; ++i) {
SPItem * item = *i;
SPStyle *style = item->style;
g_assert(style != NULL);
@@ -1713,7 +1696,6 @@ Glib::PropertyProxy<void*> FilterEffectsDialog::CellRendererConnection::property
return _primitive.get_proxy();
}
-#if WITH_GTKMM_3_0
void FilterEffectsDialog::CellRendererConnection::get_preferred_width_vfunc(Gtk::Widget& widget,
int& minimum_width,
int& natural_width) const
@@ -1747,27 +1729,6 @@ void FilterEffectsDialog::CellRendererConnection::get_preferred_height_for_width
{
get_preferred_height(widget, minimum_height, natural_height);
}
-#else
-void FilterEffectsDialog::CellRendererConnection::get_size_vfunc(
- Gtk::Widget& widget, const Gdk::Rectangle* /*cell_area*/,
- int* x_offset, int* y_offset, int* width, int* height) const
-{
- PrimitiveList& primlist = dynamic_cast<PrimitiveList&>(widget);
-
- if(x_offset)
- (*x_offset) = 0;
- if(y_offset)
- (*y_offset) = 0;
- if(width)
- (*width) = size * primlist.primitive_count() + (primlist.get_input_type_width()) * 6;
- if(height) {
- // Scale the height depending on the number of inputs, unless it's
- // the first primitive, in which case there are no connections
- SPFilterPrimitive* prim = SP_FILTER_PRIMITIVE(_primitive.get_value());
- (*height) = size * input_count(prim);
- }
-}
-#endif
/*** PrimitiveList ***/
FilterEffectsDialog::PrimitiveList::PrimitiveList(FilterEffectsDialog& d)
@@ -1775,13 +1736,8 @@ FilterEffectsDialog::PrimitiveList::PrimitiveList(FilterEffectsDialog& d)
_in_drag(0),
_observer(new Inkscape::XML::SignalObserver)
{
-#if WITH_GTKMM_3_0
d.signal_draw().connect(sigc::mem_fun(*this, &PrimitiveList::on_draw_signal));
signal_draw().connect(sigc::mem_fun(*this, &PrimitiveList::on_draw_signal));
-#else
- d.signal_expose_event().connect(sigc::mem_fun(*this, &PrimitiveList::on_expose_signal));
- signal_expose_event().connect(sigc::mem_fun(*this, &PrimitiveList::on_expose_signal));
-#endif
add_events(Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK);
@@ -1854,26 +1810,25 @@ void FilterEffectsDialog::PrimitiveList::update()
bool active_found = false;
_dialog._primitive_box->set_sensitive(true);
_dialog.update_filter_general_settings_view();
- for(SPObject *prim_obj = f->children;
- prim_obj && SP_IS_FILTER_PRIMITIVE(prim_obj);
- prim_obj = prim_obj->next) {
- SPFilterPrimitive *prim = SP_FILTER_PRIMITIVE(prim_obj);
- if(prim) {
- Gtk::TreeModel::Row row = *_model->append();
- row[_columns.primitive] = prim;
-
- //XML Tree being used directly here while it shouldn't be.
- row[_columns.type_id] = FPConverter.get_id_from_key(prim->getRepr()->name());
- row[_columns.type] = _(FPConverter.get_label(row[_columns.type_id]).c_str());
-
- if (prim->getId()) {
- row[_columns.id] = Glib::ustring(prim->getId());
- }
-
- if(prim == active_prim) {
- get_selection()->select(row);
- active_found = true;
- }
+ for(auto& prim_obj: f->children) {
+ SPFilterPrimitive *prim = SP_FILTER_PRIMITIVE(&prim_obj);
+ if(!prim) {
+ break;
+ }
+ Gtk::TreeModel::Row row = *_model->append();
+ row[_columns.primitive] = prim;
+
+ //XML Tree being used directly here while it shouldn't be.
+ row[_columns.type_id] = FPConverter.get_id_from_key(prim->getRepr()->name());
+ row[_columns.type] = _(FPConverter.get_label(row[_columns.type_id]).c_str());
+
+ if (prim->getId()) {
+ row[_columns.id] = Glib::ustring(prim->getId());
+ }
+
+ if(prim == active_prim) {
+ get_selection()->select(row);
+ active_found = true;
}
}
@@ -1944,25 +1899,9 @@ void FilterEffectsDialog::PrimitiveList::remove_selected()
}
}
-#if !WITH_GTKMM_3_0
-bool FilterEffectsDialog::PrimitiveList::on_expose_signal(GdkEventExpose * /*evt*/)
-{
- bool result = false;
-
- if (get_is_drawable())
- {
- Cairo::RefPtr<Cairo::Context> cr = get_bin_window()->create_cairo_context();
- result = on_draw_signal(cr);
- }
-
- return result;
-}
-#endif
-
bool FilterEffectsDialog::PrimitiveList::on_draw_signal(const Cairo::RefPtr<Cairo::Context> & cr)
{
cr->set_line_width(1.0);
-#if GTK_CHECK_VERSION(3,0,0)
// In GTK+ 3, the draw function receives the widget window, not the
// bin_window (i.e., just the area under the column headers). We
// therefore translate the origin of our coordinate system to account for this
@@ -1970,7 +1909,7 @@ bool FilterEffectsDialog::PrimitiveList::on_draw_signal(const Cairo::RefPtr<Cair
convert_bin_window_to_widget_coords(0,0,x_origin,y_origin);
cr->translate(x_origin, y_origin);
- GtkStyleContext *sc = gtk_widget_get_style_context(GTK_WIDGET(gobj()));
+ auto sc = gtk_widget_get_style_context(GTK_WIDGET(gobj()));
GdkRGBA bg_color, fg_color;
gtk_style_context_get_background_color(sc, GTK_STATE_FLAG_NORMAL, &bg_color);
gtk_style_context_get_color(sc, GTK_STATE_FLAG_NORMAL, &fg_color);
@@ -1988,9 +1927,6 @@ bool FilterEffectsDialog::PrimitiveList::on_draw_signal(const Cairo::RefPtr<Cair
(bg_color_active.green + fg_color_active.green)/2.0,
(bg_color_active.blue + fg_color_active.blue)/2.0,
(bg_color_active.alpha + fg_color_active.alpha)/2.0};
-#else
- GtkStyle *style = gtk_widget_get_style(GTK_WIDGET(gobj()));
-#endif
SPFilterPrimitive* prim = get_selected();
int row_count = get_model()->children().size();
@@ -2009,25 +1945,15 @@ bool FilterEffectsDialog::PrimitiveList::on_draw_signal(const Cairo::RefPtr<Cair
const int x = text_start_x + get_input_type_width() * i;
cr->save();
cr->rectangle(x, 0, get_input_type_width(), vis.get_height());
-#if GTK_CHECK_VERSION(3,0,0)
gdk_cairo_set_source_rgba(cr->cobj(), &bg_color);
cr->fill_preserve();
gdk_cairo_set_source_rgba(cr->cobj(), &fg_color);
-#else
- gdk_cairo_set_source_color(cr->cobj(), &(style->bg[GTK_STATE_NORMAL]));
- cr->fill_preserve();
- gdk_cairo_set_source_color(cr->cobj(), &(style->text[GTK_STATE_NORMAL]));
-#endif
cr->move_to(x+get_input_type_width(), 0);
cr->rotate_degrees(90);
_vertical_layout->show_in_cairo_context(cr);
-#if GTK_CHECK_VERSION(3,0,0)
gdk_cairo_set_source_rgba(cr->cobj(), &mid_color);
-#else
- gdk_cairo_set_source_color(cr->cobj(), &(style->dark[GTK_STATE_NORMAL]));
-#endif
cr->move_to(x, 0);
cr->line_to(x, vis.get_height());
cr->stroke();
@@ -2044,24 +1970,21 @@ bool FilterEffectsDialog::PrimitiveList::on_draw_signal(const Cairo::RefPtr<Cair
int mx, my;
Gdk::ModifierType mask;
-#if GTK_CHECK_VERSION(3,0,0)
- Glib::RefPtr<Gdk::Display> display = get_bin_window()->get_display();
- Glib::RefPtr<Gdk::DeviceManager> dm = display->get_device_manager();
- Glib::RefPtr<const Gdk::Device> device = dm->get_client_pointer();
- get_bin_window()->get_device_position(device, mx, my, mask);
+ auto display = get_bin_window()->get_display();
+#if GTK_CHECK_VERSION(3, 20, 0)
+ auto seat = display->get_default_seat();
+ auto device = seat->get_pointer();
#else
- get_bin_window()->get_pointer(mx, my, mask);
+ auto dm = display->get_device_manager();
+ auto device = dm->get_client_pointer();
#endif
+ get_bin_window()->get_device_position(device, mx, my, mask);
// Outline the bottom of the connection area
const int outline_x = x + fheight * (row_count - row_index);
cr->save();
-#if GTK_CHECK_VERSION(3,0,0)
gdk_cairo_set_source_rgba(cr->cobj(), &mid_color);
-#else
- gdk_cairo_set_source_color(cr->cobj(), &(style->dark[GTK_STATE_NORMAL]));
-#endif
cr->move_to(x, y + h);
cr->line_to(outline_x, y + h);
@@ -2084,17 +2007,10 @@ bool FilterEffectsDialog::PrimitiveList::on_draw_signal(const Cairo::RefPtr<Cair
cr->save();
-#if GTK_CHECK_VERSION(3,0,0)
gdk_cairo_set_source_rgba(cr->cobj(),
inside && mask & GDK_BUTTON1_MASK ?
&mid_color :
&mid_color_active);
-#else
- gdk_cairo_set_source_color(cr->cobj(),
- inside && mask & GDK_BUTTON1_MASK ?
- &(style->dark[GTK_STATE_NORMAL]) :
- &(style->dark[GTK_STATE_ACTIVE]));
-#endif
draw_connection_node(cr, con_poly, inside);
@@ -2120,17 +2036,10 @@ bool FilterEffectsDialog::PrimitiveList::on_draw_signal(const Cairo::RefPtr<Cair
cr->save();
-#if GTK_CHECK_VERSION(3,0,0)
gdk_cairo_set_source_rgba(cr->cobj(),
inside && mask & GDK_BUTTON1_MASK ?
&mid_color :
&mid_color_active);
-#else
- gdk_cairo_set_source_color(cr->cobj(),
- inside && mask & GDK_BUTTON1_MASK ?
- &(style->dark[GTK_STATE_NORMAL]) :
- &(style->dark[GTK_STATE_ACTIVE]));
-#endif
draw_connection_node(cr, con_poly, inside);
@@ -2153,17 +2062,10 @@ bool FilterEffectsDialog::PrimitiveList::on_draw_signal(const Cairo::RefPtr<Cair
cr->save();
-#if GTK_CHECK_VERSION(3,0,0)
gdk_cairo_set_source_rgba(cr->cobj(),
inside && mask & GDK_BUTTON1_MASK ?
&mid_color :
&mid_color_active);
-#else
- gdk_cairo_set_source_color(cr->cobj(),
- inside && mask & GDK_BUTTON1_MASK ?
- &(style->dark[GTK_STATE_NORMAL]) :
- &(style->dark[GTK_STATE_ACTIVE]));
-#endif
draw_connection_node(cr, con_poly, inside);
@@ -2199,8 +2101,7 @@ void FilterEffectsDialog::PrimitiveList::draw_connection(const Cairo::RefPtr<Cai
{
cr->save();
-#if GTK_CHECK_VERSION(3,0,0)
- GtkStyleContext *sc = gtk_widget_get_style_context(GTK_WIDGET(gobj()));
+ auto sc = gtk_widget_get_style_context(GTK_WIDGET(gobj()));
GdkRGBA bg_color, fg_color;
gtk_style_context_get_background_color(sc, GTK_STATE_FLAG_NORMAL, &bg_color);
@@ -2210,9 +2111,6 @@ void FilterEffectsDialog::PrimitiveList::draw_connection(const Cairo::RefPtr<Cai
(bg_color.green + fg_color.green)/2.0,
(bg_color.blue + fg_color.blue)/2.0,
(bg_color.alpha + fg_color.alpha)/2.0};
-#else
- GtkStyle *style = gtk_widget_get_style(GTK_WIDGET(gobj()));
-#endif
int src_id = 0;
Gtk::TreeIter res = find_result(input, attr, src_id);
@@ -2228,11 +2126,7 @@ void FilterEffectsDialog::PrimitiveList::draw_connection(const Cairo::RefPtr<Cai
gint end_x = text_start_x + tw * src_id + (int)(tw * 0.5f) + 1;
if(use_default && is_first)
-#if GTK_CHECK_VERSION(3,0,0)
gdk_cairo_set_source_rgba(cr->cobj(), &mid_color);
-#else
- gdk_cairo_set_source_color(cr->cobj(), &(style->dark[GTK_STATE_NORMAL]));
-#endif
else
cr->set_source_rgb(0.0, 0.0, 0.0);
@@ -2326,11 +2220,12 @@ const Gtk::TreeIter FilterEffectsDialog::PrimitiveList::find_result(const Gtk::T
if(SP_IS_FEMERGE(prim)) {
int c = 0;
bool found = false;
- for(const SPObject* o = prim->firstChild(); o; o = o->next, ++c) {
- if(c == attr && SP_IS_FEMERGENODE(o)) {
- image = SP_FEMERGENODE(o)->input;
+ for (auto& o: prim->children) {
+ if(c == attr && SP_IS_FEMERGENODE(&o)) {
+ image = SP_FEMERGENODE(&o)->input;
found = true;
}
+ ++c;
}
if(!found)
return target;
@@ -2517,21 +2412,23 @@ bool FilterEffectsDialog::PrimitiveList::on_button_release_event(GdkEventButton*
if(SP_IS_FEMERGE(prim)) {
int c = 1;
bool handled = false;
- for(SPObject* o = prim->firstChild(); o && !handled; o = o->next, ++c) {
- if(c == _in_drag && SP_IS_FEMERGENODE(o)) {
+ for (auto& o: prim->children) {
+ if(c == _in_drag && SP_IS_FEMERGENODE(&o)) {
// If input is null, delete it
if(!in_val) {
//XML Tree being used directly here while it shouldn't be.
- sp_repr_unparent(o->getRepr());
+ sp_repr_unparent(o.getRepr());
DocumentUndo::done(prim->document, SP_VERB_DIALOG_FILTER_EFFECTS,
_("Remove merge node"));
(*get_selection()->get_selected())[_columns.primitive] = prim;
+ } else {
+ _dialog.set_attr(&o, SP_ATTR_IN, in_val);
}
- else
- _dialog.set_attr(o, SP_ATTR_IN, in_val);
handled = true;
+ break;
}
+ ++c;
}
// Add new input?
if(!handled && c == _in_drag && in_val) {
@@ -2652,8 +2549,7 @@ void FilterEffectsDialog::PrimitiveList::on_drag_end(const Glib::RefPtr<Gdk::Dra
bool FilterEffectsDialog::PrimitiveList::on_scroll_timeout()
{
if(_autoscroll_y) {
-#if WITH_GTKMM_3_0
- Glib::RefPtr<Gtk::Adjustment> a = dynamic_cast<Gtk::ScrolledWindow*>(get_parent())->get_vadjustment();
+ auto a = dynamic_cast<Gtk::ScrolledWindow*>(get_parent())->get_vadjustment();
double v = a->get_value() + _autoscroll_y;
if(v < 0)
@@ -2662,25 +2558,13 @@ bool FilterEffectsDialog::PrimitiveList::on_scroll_timeout()
v = a->get_upper() - a->get_page_size();
a->set_value(v);
-#else
- Gtk::Adjustment& a = *dynamic_cast<Gtk::ScrolledWindow*>(get_parent())->get_vadjustment();
- double v = a.get_value() + _autoscroll_y;
-
- if(v < 0)
- v = 0;
- if(v > a.get_upper() - a.get_page_size())
- v = a.get_upper() - a.get_page_size();
-
- a.set_value(v);
-#endif
queue_draw();
}
if(_autoscroll_x) {
-#if WITH_GTKMM_3_0
- Glib::RefPtr<Gtk::Adjustment> a_h = dynamic_cast<Gtk::ScrolledWindow*>(get_parent())->get_hadjustment();
+ auto a_h = dynamic_cast<Gtk::ScrolledWindow*>(get_parent())->get_hadjustment();
double h = a_h->get_value() + _autoscroll_x;
if(h < 0)
@@ -2689,18 +2573,6 @@ bool FilterEffectsDialog::PrimitiveList::on_scroll_timeout()
h = a_h->get_upper() - a_h->get_page_size();
a_h->set_value(h);
-#else
- Gtk::Adjustment& a_h = *dynamic_cast<Gtk::ScrolledWindow*>(get_parent())->get_hadjustment();
- double h = a_h.get_value() + _autoscroll_x;
-
- if(h < 0)
- h = 0;
- if(h > a_h.get_upper() - a_h.get_page_size())
- h = a_h.get_upper() - a_h.get_page_size();
-
- a_h.set_value(h);
-
-#endif
queue_draw();
}
@@ -2742,13 +2614,8 @@ FilterEffectsDialog::FilterEffectsDialog()
_sizegroup->set_ignore_hidden();
// Initialize widget hierarchy
-#if WITH_GTKMM_3_0
- Gtk::Paned* hpaned = Gtk::manage(new Gtk::Paned);
+ auto hpaned = Gtk::manage(new Gtk::Paned);
_primitive_box = Gtk::manage(new Gtk::Paned);
-#else
- Gtk::HPaned* hpaned = Gtk::manage(new Gtk::HPaned);
- _primitive_box = Gtk::manage(new Gtk::VPaned);
-#endif
_sw_infobox = Gtk::manage(new Gtk::ScrolledWindow);
Gtk::ScrolledWindow* sw_prims = Gtk::manage(new Gtk::ScrolledWindow);
@@ -3080,7 +2947,7 @@ void FilterEffectsDialog::set_filternode_attr(const AttrWidget* input)
void FilterEffectsDialog::set_child_attr_direct(const AttrWidget* input)
{
- set_attr(_primitive_list.get_selected()->children, input->get_attribute(), input->get_as_attribute().c_str());
+ set_attr(_primitive_list.get_selected()->firstChild(), input->get_attribute(), input->get_as_attribute().c_str());
}
void FilterEffectsDialog::set_attr(SPObject* o, const SPAttributeEnum attr, const gchar* val)
diff --git a/src/ui/dialog/filter-effects-dialog.h b/src/ui/dialog/filter-effects-dialog.h
index 7c715327e..eae0fc317 100644
--- a/src/ui/dialog/filter-effects-dialog.h
+++ b/src/ui/dialog/filter-effects-dialog.h
@@ -163,7 +163,6 @@ private:
static const int size = 24;
protected:
-#if WITH_GTKMM_3_0
virtual void get_preferred_width_vfunc(Gtk::Widget& widget,
int& minimum_width,
int& natural_width) const;
@@ -181,10 +180,6 @@ private:
int width,
int& minimum_height,
int& natural_height) const;
-#else
- virtual void get_size_vfunc(Gtk::Widget& widget, const Gdk::Rectangle* cell_area,
- int* x_offset, int* y_offset, int* width, int* height) const;
-#endif
private:
// void* should be SPFilterPrimitive*, some weirdness with properties prevents this
Glib::Property<void*> _primitive;
@@ -211,9 +206,6 @@ private:
protected:
bool on_draw_signal(const Cairo::RefPtr<Cairo::Context> &cr);
-#if !WITH_GTKMM_3_0
- bool on_expose_signal(GdkEventExpose*);
-#endif
bool on_button_press_event(GdkEventButton*);
bool on_motion_notify_event(GdkEventMotion*);
@@ -283,11 +275,7 @@ private:
Gtk::ScrolledWindow* _sw_infobox;
// View/add primitives
-#if WITH_GTKMM_3_0
Gtk::Paned* _primitive_box;
-#else
- Gtk::VPaned* _primitive_box;
-#endif
UI::Widget::ComboBoxEnum<Inkscape::Filters::FilterPrimitiveType> _add_primitive_type;
Gtk::Button _add_primitive;
diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp
index 8b6067e82..b4f7902f5 100644
--- a/src/ui/dialog/find.cpp
+++ b/src/ui/dialog/find.cpp
@@ -740,22 +740,22 @@ std::vector<SPItem*> &Find::all_items (SPObject *r, std::vector<SPItem*> &l, boo
return l; // we're not interested in metadata
}
- for (SPObject *child = r->firstChild(); child; child = child->getNext()) {
- SPItem *item = dynamic_cast<SPItem *>(child);
- if (item && !child->cloned && !desktop->isLayer(item)) {
+ for (auto& child: r->children) {
+ SPItem *item = dynamic_cast<SPItem *>(&child);
+ if (item && !child.cloned && !desktop->isLayer(item)) {
if ((hidden || !desktop->itemIsHidden(item)) && (locked || !item->isLocked())) {
- l.insert(l.begin(),(SPItem*)child);
+ l.insert(l.begin(),(SPItem*)&child);
}
}
- l = all_items (child, l, hidden, locked);
+ l = all_items (&child, l, hidden, locked);
}
return l;
}
std::vector<SPItem*> &Find::all_selection_items (Inkscape::Selection *s, std::vector<SPItem*> &l, SPObject *ancestor, bool hidden, bool locked)
{
- std::vector<SPItem*> itemlist=s->itemList();
- for(std::vector<SPItem*>::const_reverse_iterator i=itemlist.rbegin(); itemlist.rend() != i; ++i) {
+ auto itemlist= s->items();
+ for(auto i=boost::rbegin(itemlist); boost::rend(itemlist) != i; ++i) {
SPObject *obj = *i;
SPItem *item = dynamic_cast<SPItem *>(obj);
g_assert(item != NULL);
diff --git a/src/ui/dialog/find.h b/src/ui/dialog/find.h
index 4bcb900b6..94d635037 100644
--- a/src/ui/dialog/find.h
+++ b/src/ui/dialog/find.h
@@ -286,13 +286,7 @@ private:
Gtk::Label status;
UI::Widget::Button button_find;
UI::Widget::Button button_replace;
-
-#if WITH_GTKMM_3_0
Gtk::ButtonBox box_buttons;
-#else
- Gtk::HButtonBox box_buttons;
-#endif
-
Gtk::HBox hboxbutton_row;
/**
diff --git a/src/ui/dialog/floating-behavior.cpp b/src/ui/dialog/floating-behavior.cpp
index 5ac3a25ad..fa8e11dfd 100644
--- a/src/ui/dialog/floating-behavior.cpp
+++ b/src/ui/dialog/floating-behavior.cpp
@@ -138,11 +138,7 @@ FloatingBehavior::create(Dialog &dialog)
inline FloatingBehavior::operator Gtk::Widget &() { return *_d; }
inline GtkWidget *FloatingBehavior::gobj() { return GTK_WIDGET(_d->gobj()); }
inline Gtk::Box* FloatingBehavior::get_vbox() {
-#if WITH_GTKMM_3_0
return _d->get_content_area();
-#else
- return _d->get_vbox();
-#endif
}
inline void FloatingBehavior::present() { _d->present(); }
inline void FloatingBehavior::hide() { _d->hide(); }
@@ -153,12 +149,8 @@ inline void FloatingBehavior::move(int x, int y) { _d->
inline void FloatingBehavior::set_position(Gtk::WindowPosition position) { _d->set_position(position); }
inline void FloatingBehavior::set_size_request(int width, int height) { _d->set_size_request(width, height); }
inline void FloatingBehavior::size_request(Gtk::Requisition &requisition) {
-#if WITH_GTKMM_3_0
Gtk::Requisition requisition_natural;
_d->get_preferred_size(requisition, requisition_natural);
-#else
- requisition = _d->size_request();
-#endif
}
inline void FloatingBehavior::get_position(int &x, int &y) { _d->get_position(x, y); }
inline void FloatingBehavior::get_size(int &width, int &height) { _d->get_size(width, height); }
diff --git a/src/ui/dialog/font-substitution.cpp b/src/ui/dialog/font-substitution.cpp
index 0a88770b9..abae8ea70 100644
--- a/src/ui/dialog/font-substitution.cpp
+++ b/src/ui/dialog/font-substitution.cpp
@@ -101,11 +101,7 @@ FontSubstitution::show(Glib::ustring out, std::vector<SPItem*> &l)
cbWarning->set_label(_("Don't show this warning again"));
cbWarning->show();
-#if GTK_CHECK_VERSION(3,0,0)
- Gtk::Box * box = warning.get_content_area();
-#else
- Gtk::Box * box = warning.get_vbox();
-#endif
+ auto box = warning.get_content_area();
box->set_spacing(2);
box->pack_start(*scrollwindow, true, true, 4);
box->pack_start(*cbSelect, false, false, 0);
@@ -177,7 +173,7 @@ std::vector<SPItem*> FontSubstitution::getFontReplacedItems(SPDocument* doc, Gli
family = SP_TEXT(parent_text)->layout.getFontFamily(0);
// Add all the spans fonts to the set
gint ii = 0;
- for (SPObject *child = parent_text->firstChild() ; child ; child = child->getNext() ) {
+ for (auto& child: parent_text->children) {
family = SP_TEXT(parent_text)->layout.getFontFamily(ii);
setFontSpans.insert(family);
ii++;
diff --git a/src/ui/dialog/glyphs.cpp b/src/ui/dialog/glyphs.cpp
index 7ce3eabfc..9c1236ca9 100644
--- a/src/ui/dialog/glyphs.cpp
+++ b/src/ui/dialog/glyphs.cpp
@@ -14,16 +14,11 @@
#include <glibmm/i18n.h>
#include <gtkmm/alignment.h>
#include <gtkmm/comboboxtext.h>
+#include <gtkmm/grid.h>
#include <gtkmm/iconview.h>
#include <gtkmm/liststore.h>
#include <gtkmm/scrolledwindow.h>
-#if WITH_GTKMM_3_0
-# include <gtkmm/grid.h>
-#else
-# include <gtkmm/table.h>
-#endif
-
#include "desktop.h"
#include "document.h" // for SPDocumentUndo::done()
#include "document-undo.h"
@@ -337,12 +332,7 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) :
instanceConns(),
desktopConns()
{
-#if WITH_GTKMM_3_0
- Gtk::Grid *table = new Gtk::Grid();
-#else
- Gtk::Table *table = new Gtk::Table(3, 1, false);
-#endif
-
+ auto table = new Gtk::Grid();
_getContents()->pack_start(*Gtk::manage(table), Gtk::PACK_EXPAND_WIDGET);
guint row = 0;
@@ -355,29 +345,16 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) :
gtk_widget_set_size_request (fontsel, 0, 150);
g_signal_connect( G_OBJECT(fontsel), "font_set", G_CALLBACK(fontChangeCB), this );
-#if WITH_GTKMM_3_0
table->attach(*Gtk::manage(Glib::wrap(fontsel)), 0, row, 3, 1);
-#else
- table->attach(*Gtk::manage(Glib::wrap(fontsel)),
- 0, 3, row, row + 1,
- Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL);
-#endif
-
row++;
// -------------------------------
{
- Gtk::Label *label = new Gtk::Label(_("Script: "));
+ auto label = new Gtk::Label(_("Script: "));
-#if WITH_GTKMM_3_0
table->attach( *Gtk::manage(label), 0, row, 1, 1);
-#else
- table->attach( *Gtk::manage(label),
- 0, 1, row, row + 1,
- Gtk::SHRINK, Gtk::SHRINK);
-#endif
scriptCombo = new Gtk::ComboBoxText();
for (std::map<GUnicodeScript, Glib::ustring>::iterator it = getScriptToName().begin(); it != getScriptToName().end(); ++it)
@@ -391,14 +368,8 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) :
Gtk::Alignment *align = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_START, Gtk::ALIGN_START, 0.0, 0.0));
align->add(*Gtk::manage(scriptCombo));
-#if WITH_GTKMM_3_0
align->set_hexpand();
table->attach( *align, 1, row, 1, 1);
-#else
- table->attach( *align,
- 1, 2, row, row + 1,
- Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK);
-#endif
}
row++;
@@ -406,15 +377,8 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) :
// -------------------------------
{
- Gtk::Label *label = new Gtk::Label(_("Range: "));
-
-#if WITH_GTKMM_3_0
+ auto label = new Gtk::Label(_("Range: "));
table->attach( *Gtk::manage(label), 0, row, 1, 1);
-#else
- table->attach( *Gtk::manage(label),
- 0, 1, row, row + 1,
- Gtk::SHRINK, Gtk::SHRINK);
-#endif
rangeCombo = new Gtk::ComboBoxText();
for ( std::vector<NamedRange>::iterator it = getRanges().begin(); it != getRanges().end(); ++it ) {
@@ -426,15 +390,8 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) :
instanceConns.push_back(conn);
Gtk::Alignment *align = new Gtk::Alignment(Gtk::ALIGN_START, Gtk::ALIGN_START, 0.0, 0.0);
align->add(*Gtk::manage(rangeCombo));
-
-#if WITH_GTKMM_3_0
align->set_hexpand();
table->attach( *Gtk::manage(align), 1, row, 1, 1);
-#else
- table->attach( *Gtk::manage(align),
- 1, 2, row, row + 1,
- Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK);
-#endif
}
row++;
@@ -457,16 +414,9 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) :
Gtk::ScrolledWindow *scroller = new Gtk::ScrolledWindow();
scroller->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_ALWAYS);
scroller->add(*Gtk::manage(iconView));
-
-#if WITH_GTKMM_3_0
scroller->set_hexpand();
scroller->set_vexpand();
table->attach(*Gtk::manage(scroller), 0, row, 3, 1);
-#else
- table->attach(*Gtk::manage(scroller),
- 0, 3, row, row + 1,
- Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL);
-#endif
row++;
@@ -496,15 +446,8 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) :
insertBtn->set_sensitive(false);
box->pack_end(*Gtk::manage(insertBtn), Gtk::PACK_SHRINK);
-
-#if WITH_GTKMM_3_0
box->set_hexpand();
table->attach( *Gtk::manage(box), 0, row, 3, 1);
-#else
- table->attach( *Gtk::manage(box),
- 0, 3, row, row + 1,
- Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK);
-#endif
row++;
@@ -573,8 +516,8 @@ void GlyphsPanel::setTargetDesktop(SPDesktop *desktop)
void GlyphsPanel::insertText()
{
SPItem *textItem = 0;
- std::vector<SPItem*> itemlist=targetDesktop->selection->itemList();
- for(std::vector<SPItem*>::const_iterator i=itemlist.begin(); itemlist.end() != i; ++i) {
+ auto itemlist= targetDesktop->selection->items();
+ for(auto i=itemlist.begin(); itemlist.end() != i; ++i) {
if (SP_IS_TEXT(*i) || SP_IS_FLOWTEXT(*i)) {
textItem = *i;
break;
@@ -586,12 +529,7 @@ void GlyphsPanel::insertText()
if (entry->get_text_length() > 0) {
glyphs = entry->get_text();
} else {
-
-#if WITH_GTKMM_3_0
- std::vector<Gtk::TreePath> itemArray = iconView->get_selected_items();
-#else
- Gtk::IconView::ArrayHandle_TreePaths itemArray = iconView->get_selected_items();
-#endif
+ auto itemArray = iconView->get_selected_items();
if (!itemArray.empty()) {
Gtk::TreeModel::Path const & path = *itemArray.begin();
@@ -636,11 +574,7 @@ void GlyphsPanel::glyphActivated(Gtk::TreeModel::Path const & path)
void GlyphsPanel::glyphSelectionChanged()
{
-#if WITH_GTKMM_3_0
- std::vector<Gtk::TreePath> itemArray = iconView->get_selected_items();
-#else
- Gtk::IconView::ArrayHandle_TreePaths itemArray = iconView->get_selected_items();
-#endif
+ auto itemArray = iconView->get_selected_items();
if (itemArray.empty()) {
label->set_text(" ");
@@ -683,8 +617,8 @@ void GlyphsPanel::selectionModifiedCB(guint flags)
void GlyphsPanel::calcCanInsert()
{
int items = 0;
- std::vector<SPItem*> itemlist=targetDesktop->selection->itemList();
- for(std::vector<SPItem*>::const_iterator i=itemlist.begin(); itemlist.end() != i; ++i) {
+ auto itemlist= targetDesktop->selection->items();
+ for(auto i=itemlist.begin(); itemlist.end() != i; ++i) {
if (SP_IS_TEXT(*i) || SP_IS_FLOWTEXT(*i)) {
++items;
}
diff --git a/src/ui/dialog/grid-arrange-tab.cpp b/src/ui/dialog/grid-arrange-tab.cpp
index 8d83814b4..5872393ae 100644
--- a/src/ui/dialog/grid-arrange-tab.cpp
+++ b/src/ui/dialog/grid-arrange-tab.cpp
@@ -17,12 +17,9 @@
#include "ui/dialog/grid-arrange-tab.h"
#include <glibmm/i18n.h>
-#include <gtkmm/stock.h>
-#if WITH_GTKMM_3_0
-# include <gtkmm/grid.h>
-#else
-#endif
+#include <gtkmm/grid.h>
+#include <gtkmm/stock.h>
#include <2geom/transforms.h>
@@ -159,7 +156,11 @@ void GridArrangeTab::arrange()
desktop->getDocument()->ensureUpToDate();
Inkscape::Selection *selection = desktop->getSelection();
- const std::vector<SPItem*> items = selection ? selection->itemList() : std::vector<SPItem*>();
+ std::vector<SPItem*> items;
+ if (selection) {
+ items.insert(items.end(), selection->items().begin(), selection->items().end());
+ }
+
for(std::vector<SPItem*>::const_iterator i = items.begin();i!=items.end(); ++i){
SPItem *item = *i;
Geom::OptRect b = item->documentVisualBounds();
@@ -188,7 +189,7 @@ void GridArrangeTab::arrange()
// require the sorting done before we can calculate row heights etc.
g_return_if_fail(selection);
- std::vector<SPItem*> sorted(selection->itemList());
+ std::vector<SPItem*> sorted(selection->items().begin(), selection->items().end());
sort(sorted.begin(),sorted.end(),sp_compare_y_position);
sort(sorted.begin(),sorted.end(),sp_compare_x_position);
@@ -364,8 +365,7 @@ void GridArrangeTab::on_row_spinbutton_changed()
Inkscape::Selection *selection = desktop ? desktop->selection : 0;
g_return_if_fail( selection );
- std::vector<SPItem*> const items = selection->itemList();
- int selcount = items.size();
+ int selcount = (int) boost::distance(selection->items());
double PerCol = ceil(selcount / NoOfColsSpinner.get_value());
NoOfRowsSpinner.set_value(PerCol);
@@ -390,7 +390,7 @@ void GridArrangeTab::on_col_spinbutton_changed()
Inkscape::Selection *selection = desktop ? desktop->selection : 0;
g_return_if_fail(selection);
- int selcount = selection->itemList().size();
+ int selcount = (int) boost::distance(selection->items());
double PerRow = ceil(selcount / NoOfRowsSpinner.get_value());
NoOfColsSpinner.set_value(PerRow);
@@ -527,7 +527,10 @@ void GridArrangeTab::updateSelection()
updating = true;
SPDesktop *desktop = Parent->getDesktop();
Inkscape::Selection *selection = desktop ? desktop->selection : 0;
- std::vector<SPItem*> const items = selection ? selection->itemList() : std::vector<SPItem*>();
+ std::vector<SPItem*> items;
+ if (selection) {
+ items.insert(items.end(), selection->items().begin(), selection->items().end());
+ }
if (!items.empty()) {
int selcount = items.size();
@@ -566,11 +569,7 @@ GridArrangeTab::GridArrangeTab(ArrangeDialog *parent)
: Parent(parent),
XPadding(_("X:"), _("Horizontal spacing between columns."), UNIT_TYPE_LINEAR, "", "object-columns", &PaddingUnitMenu),
YPadding(_("Y:"), _("Vertical spacing between rows."), XPadding, "", "object-rows", &PaddingUnitMenu),
-#if WITH_GTKMM_3_0
PaddingTable(Gtk::manage(new Gtk::Grid()))
-#else
- PaddingTable(Gtk::manage(new Gtk::Table(2, 2, false)))
-#endif
{
// bool used by spin button callbacks to stop loops where they change each other.
updating = false;
@@ -598,7 +597,7 @@ GridArrangeTab::GridArrangeTab(ArrangeDialog *parent)
g_return_if_fail( selection );
int selcount = 1;
if (!selection->isEmpty()) {
- selcount = selection->itemList().size();
+ selcount = (int) boost::distance(selection->items());
}
@@ -732,20 +731,11 @@ GridArrangeTab::GridArrangeTab(ArrangeDialog *parent)
}
PaddingTable->set_border_width(MARGIN);
-
-#if WITH_GTKMM_3_0
PaddingTable->set_row_spacing(MARGIN);
PaddingTable->set_column_spacing(MARGIN);
PaddingTable->attach(XPadding, 0, 0, 1, 1);
PaddingTable->attach(PaddingUnitMenu, 1, 0, 1, 1);
PaddingTable->attach(YPadding, 0, 1, 1, 1);
-#else
- PaddingTable->set_row_spacings(MARGIN);
- PaddingTable->set_col_spacings(MARGIN);
- PaddingTable->attach(XPadding, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK);
- PaddingTable->attach(PaddingUnitMenu, 1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK);
- PaddingTable->attach(YPadding, 0, 1, 1, 2, Gtk::SHRINK, Gtk::SHRINK);
-#endif
TileBox.pack_start(*PaddingTable, false, false, MARGIN);
diff --git a/src/ui/dialog/grid-arrange-tab.h b/src/ui/dialog/grid-arrange-tab.h
index a137d1694..891849f1a 100644
--- a/src/ui/dialog/grid-arrange-tab.h
+++ b/src/ui/dialog/grid-arrange-tab.h
@@ -111,12 +111,7 @@ private:
Inkscape::UI::Widget::UnitMenu PaddingUnitMenu;
Inkscape::UI::Widget::ScalarUnit XPadding;
Inkscape::UI::Widget::ScalarUnit YPadding;
-
-#if WITH_GTKMM_3_0
Gtk::Grid *PaddingTable;
-#else
- Gtk::Table *PaddingTable;
-#endif
// BBox or manual spacing
Gtk::VBox SpacingVBox;
diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp
index 469bd5155..8d6ca4143 100644
--- a/src/ui/dialog/guides.cpp
+++ b/src/ui/dialog/guides.cpp
@@ -120,13 +120,8 @@ void GuidelinePropertiesDialog::_onOK()
g_free((gpointer) name);
-#if WITH_GTKMM_3_0
- const Gdk::RGBA c = _color.get_rgba();
+ const auto c = _color.get_rgba();
unsigned r = c.get_red_u()/257, g = c.get_green_u()/257, b = c.get_blue_u()/257;
-#else
- const Gdk::Color c = _color.get_color();
- unsigned r = c.get_red()/257, g = c.get_green()/257, b = c.get_blue()/257;
-#endif
//TODO: why 257? verify this!
_guide->set_color(r, g, b, true);
@@ -167,15 +162,9 @@ void GuidelinePropertiesDialog::_setup() {
add_button(Gtk::Stock::DELETE, -12);
add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
-#if WITH_GTKMM_3_0
- Gtk::Box *mainVBox = get_content_area();
+ auto mainVBox = get_content_area();
_layout_table.set_row_spacing(4);
_layout_table.set_column_spacing(4);
-#else
- Gtk::Box *mainVBox = get_vbox();
- _layout_table.set_spacings(4);
- _layout_table.resize (3, 4);
-#endif
mainVBox->pack_start(_layout_table, false, false, 0);
@@ -185,7 +174,6 @@ void GuidelinePropertiesDialog::_setup() {
_label_descr.set_label("foo1");
_label_descr.set_alignment(0, 0.5);
-#if WITH_GTKMM_3_0
_label_name.set_halign(Gtk::ALIGN_FILL);
_label_name.set_valign(Gtk::ALIGN_FILL);
_layout_table.attach(_label_name, 0, 0, 3, 1);
@@ -203,19 +191,6 @@ void GuidelinePropertiesDialog::_setup() {
_color.set_valign(Gtk::ALIGN_FILL);
_color.set_hexpand();
_layout_table.attach(_color, 1, 3, 2, 1);
-#else
- _layout_table.attach(_label_name,
- 0, 3, 0, 1, Gtk::FILL, Gtk::FILL);
-
- _layout_table.attach(_label_descr,
- 0, 3, 1, 2, Gtk::FILL, Gtk::FILL);
-
- _layout_table.attach(_label_entry,
- 1, 3, 2, 3, Gtk::EXPAND | Gtk::FILL, Gtk::FILL);
-
- _layout_table.attach(_color,
- 1, 3, 3, 4, Gtk::EXPAND | Gtk::FILL, Gtk::FILL);
-#endif
// unitmenus
/* fixme: We should allow percents here too, as percents of the canvas size */
@@ -234,7 +209,6 @@ void GuidelinePropertiesDialog::_setup() {
_spin_button_y.setIncrements(1.0, 10.0);
_spin_button_y.setRange(-1e6, 1e6);
-#if WITH_GTKMM_3_0
_spin_button_x.set_halign(Gtk::ALIGN_FILL);
_spin_button_x.set_valign(Gtk::ALIGN_FILL);
_spin_button_x.set_hexpand();
@@ -248,22 +222,12 @@ void GuidelinePropertiesDialog::_setup() {
_unit_menu.set_halign(Gtk::ALIGN_FILL);
_unit_menu.set_valign(Gtk::ALIGN_FILL);
_layout_table.attach(_unit_menu, 2, 4, 1, 1);
-#else
- _layout_table.attach(_spin_button_x,
- 1, 2, 4, 5, Gtk::EXPAND | Gtk::FILL, Gtk::FILL);
- _layout_table.attach(_spin_button_y,
- 1, 2, 5, 6, Gtk::EXPAND | Gtk::FILL, Gtk::FILL);
-
- _layout_table.attach(_unit_menu,
- 2, 3, 4, 5, Gtk::FILL, Gtk::FILL);
-#endif
// angle spinbutton
_spin_angle.setDigits(3);
_spin_angle.setIncrements(1.0, 10.0);
_spin_angle.setRange(-3600., 3600.);
-#if WITH_GTKMM_3_0
_spin_angle.set_halign(Gtk::ALIGN_FILL);
_spin_angle.set_valign(Gtk::ALIGN_FILL);
_spin_angle.set_hexpand();
@@ -280,18 +244,6 @@ void GuidelinePropertiesDialog::_setup() {
_locked_toggle.set_valign(Gtk::ALIGN_FILL);
_locked_toggle.set_hexpand();
_layout_table.attach(_locked_toggle, 1, 8, 2, 1);
-#else
- _layout_table.attach(_spin_angle,
- 1, 3, 6, 7, Gtk::EXPAND | Gtk::FILL, Gtk::FILL);
-
- // mode radio button
- _layout_table.attach(_relative_toggle,
- 1, 3, 7, 8, Gtk::EXPAND | Gtk::FILL, Gtk::FILL);
-
- // locked radio button
- _layout_table.attach(_locked_toggle,
- 1, 3, 8, 9, Gtk::EXPAND | Gtk::FILL, Gtk::FILL);
-#endif
_relative_toggle.signal_toggled().connect(sigc::mem_fun(*this, &GuidelinePropertiesDialog::_modeChanged));
_relative_toggle.set_active(_relative_toggle_status);
@@ -344,15 +296,9 @@ void GuidelinePropertiesDialog::_setup() {
// init name entry
_label_entry.getEntry()->set_text(_guide->getLabel() ? _guide->getLabel() : "");
-#if WITH_GTKMM_3_0
Gdk::RGBA c;
c.set_rgba(((_guide->getColor()>>24)&0xff) / 255.0, ((_guide->getColor()>>16)&0xff) / 255.0, ((_guide->getColor()>>8)&0xff) / 255.0);
_color.set_rgba(c);
-#else
- Gdk::Color c;
- c.set_rgb_p(((_guide->getColor()>>24)&0xff) / 255.0, ((_guide->getColor()>>16)&0xff) / 255.0, ((_guide->getColor()>>8)&0xff) / 255.0);
- _color.set_color(c);
-#endif
_modeChanged(); // sets values of spinboxes.
diff --git a/src/ui/dialog/guides.h b/src/ui/dialog/guides.h
index 5dce0d6ed..25d32015c 100644
--- a/src/ui/dialog/guides.h
+++ b/src/ui/dialog/guides.h
@@ -16,12 +16,7 @@
#endif
#include <gtkmm/dialog.h>
-
-#if WITH_GTKMM_3_0
#include <gtkmm/grid.h>
-#else
-#include <gtkmm/table.h>
-#endif
#include <gtkmm/label.h>
#include <gtkmm/colorbutton.h>
@@ -71,12 +66,7 @@ private:
SPDesktop *_desktop;
SPGuide *_guide;
-#if WITH_GTKMM_3_0
- Gtk::Grid _layout_table;
-#else
- Gtk::Table _layout_table;
-#endif
-
+ Gtk::Grid _layout_table;
Gtk::Label _label_name;
Gtk::Label _label_descr;
Inkscape::UI::Widget::CheckButton _locked_toggle;
diff --git a/src/ui/dialog/icon-preview.cpp b/src/ui/dialog/icon-preview.cpp
index 8dd0ae489..a4fcc9947 100644
--- a/src/ui/dialog/icon-preview.cpp
+++ b/src/ui/dialog/icon-preview.cpp
@@ -359,8 +359,8 @@ void IconPreviewPanel::refreshPreview()
if ( sel ) {
//g_message("found a selection to play with");
- std::vector<SPItem*> const items = sel->itemList();
- for(std::vector<SPItem*>::const_iterator i=items.begin();!target && i!=items.end();++i){
+ auto items = sel->items();
+ for(auto i=items.begin();!target && i!=items.end();++i){
SPItem* item = *i;
gchar const *id = item->getId();
if ( id ) {
diff --git a/src/ui/dialog/icon-preview.h b/src/ui/dialog/icon-preview.h
index 8a6e19a25..caec7e3b5 100644
--- a/src/ui/dialog/icon-preview.h
+++ b/src/ui/dialog/icon-preview.h
@@ -66,13 +66,7 @@ private:
gdouble minDelay;
Gtk::VBox iconBox;
-
-#if WITH_GTKMM_3_0
Gtk::Paned splitter;
-#else
- Gtk::HPaned splitter;
-#endif
-
Glib::ustring targetId;
int hot;
int numEntries;
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp
index 2f4ac8606..4574e93fe 100644
--- a/src/ui/dialog/inkscape-preferences.cpp
+++ b/src/ui/dialog/inkscape-preferences.cpp
@@ -78,12 +78,8 @@ InkscapePreferences::InkscapePreferences()
_getContents()->add(*sb);
show_all_children();
Gtk::Requisition sreq;
-#if WITH_GTKMM_3_0
Gtk::Requisition sreq_natural;
sb->get_preferred_size(sreq_natural, sreq);
-#else
- sreq = sb->size_request();
-#endif
_sb_width = sreq.width;
_getContents()->remove(*sb);
delete sb;
@@ -855,17 +851,10 @@ static void proofComboChanged( Gtk::ComboBoxText* combo )
}
static void gamutColorChanged( Gtk::ColorButton* btn ) {
-#if WITH_GTKMM_3_0
- Gdk::RGBA rgba = btn->get_rgba();
- gushort r = rgba.get_red_u();
- gushort g = rgba.get_green_u();
- gushort b = rgba.get_blue_u();
-#else
- Gdk::Color color = btn->get_color();
- gushort r = color.get_red();
- gushort g = color.get_green();
- gushort b = color.get_blue();
-#endif
+ auto rgba = btn->get_rgba();
+ auto r = rgba.get_red_u();
+ auto g = rgba.get_green_u();
+ auto b = rgba.get_blue_u();
gchar* tmp = g_strdup_printf("#%02x%02x%02x", (r >> 8), (g >> 8), (b >> 8) );
@@ -1035,13 +1024,8 @@ void InkscapePreferences::initPageIO()
Glib::ustring colorStr = prefs->getString("/options/softproof/gamutcolor");
-#if WITH_GTKMM_3_0
Gdk::RGBA tmpColor( colorStr.empty() ? "#00ff00" : colorStr);
_cms_gamutcolor.set_rgba( tmpColor );
-#else
- Gdk::Color tmpColor( colorStr.empty() ? "#00ff00" : colorStr);
- _cms_gamutcolor.set_color( tmpColor );
-#endif
_page_cms.add_line( true, _("Out of gamut warning color:"), _cms_gamutcolor, "",
_("Selects the color used for out of gamut warning"), false);
@@ -1586,31 +1570,19 @@ void InkscapePreferences::initKeyboardShortcuts(Gtk::TreeModel::iterator iter_ui
int row = 3;
-#if WITH_GTKMM_3_0
scroller->set_hexpand();
scroller->set_vexpand();
_page_keyshortcuts.attach(*scroller, 0, row, 2, 1);
-#else
- _page_keyshortcuts.attach(*scroller, 0, 2, row, row+1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL);
-#endif
row++;
-#if WITH_GTKMM_3_0
- Gtk::ButtonBox *box_buttons = Gtk::manage(new Gtk::ButtonBox);
-#else
- Gtk::HButtonBox *box_buttons = Gtk::manage (new Gtk::HButtonBox);
-#endif
+ auto box_buttons = Gtk::manage(new Gtk::ButtonBox);
box_buttons->set_layout(Gtk::BUTTONBOX_END);
box_buttons->set_spacing(4);
-#if WITH_GTKMM_3_0
box_buttons->set_hexpand();
_page_keyshortcuts.attach(*box_buttons, 0, row, 3, 1);
-#else
- _page_keyshortcuts.attach(*box_buttons, 0, 3, row, row+1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
-#endif
UI::Widget::Button *kb_reset = Gtk::manage(new UI::Widget::Button(_("Reset"), _("Remove all your customized keyboard shortcuts, and revert to the shortcuts in the shortcut file listed above")));
box_buttons->pack_start(*kb_reset, true, true, 6);
@@ -2043,12 +2015,8 @@ bool InkscapePreferences::SetMaxDialogSize(const Gtk::TreeModel::iterator& iter)
_page_frame.add(*page);
this->show_all_children();
Gtk::Requisition sreq;
-#if WITH_GTKMM_3_0
Gtk::Requisition sreq_natural;
this->get_preferred_size(sreq_natural, sreq);
-#else
- sreq = this->size_request();
-#endif
_max_dialog_width=std::max(_max_dialog_width, sreq.width);
_max_dialog_height=std::max(_max_dialog_height, sreq.height);
_page_frame.remove();
diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h
index d1abcfc58..781b5e48e 100644
--- a/src/ui/dialog/inkscape-preferences.h
+++ b/src/ui/dialog/inkscape-preferences.h
@@ -97,11 +97,7 @@ enum {
};
namespace Gtk {
-#if WITH_GTKMM_3_0
class Scale;
-#else
-class HScale;
-#endif
}
namespace Inkscape {
@@ -206,11 +202,7 @@ protected:
UI::Widget::PrefCheckButton _scroll_space;
UI::Widget::PrefCheckButton _wheel_zoom;
-#if WITH_GTKMM_3_0
Gtk::Scale *_slider_snapping_delay;
-#else
- Gtk::HScale *_slider_snapping_delay;
-#endif
UI::Widget::PrefCheckButton _snap_indicator;
UI::Widget::PrefCheckButton _snap_closest_only;
diff --git a/src/ui/dialog/input.cpp b/src/ui/dialog/input.cpp
index 1bfb59ae5..9fd2288e7 100644
--- a/src/ui/dialog/input.cpp
+++ b/src/ui/dialog/input.cpp
@@ -21,19 +21,13 @@
#include <gtkmm/cellrenderercombo.h>
#include <gtkmm/checkbutton.h>
#include <gtkmm/comboboxtext.h>
+#include <gtkmm/grid.h>
#include <gtkmm/liststore.h>
#include <gtkmm/menubar.h>
#include <gtkmm/notebook.h>
#include <gtkmm/paned.h>
#include <gtkmm/progressbar.h>
#include <gtkmm/scrolledwindow.h>
-
-#if WITH_GTKMM_3_0
-# include <gtkmm/grid.h>
-#else
-# include <gtkmm/table.h>
-#endif
-
#include <gtkmm/treestore.h>
#include "device-manager.h"
@@ -422,13 +416,7 @@ private:
Blink watcher;
Gtk::CheckButton useExt;
Gtk::Button save;
-
-#if WITH_GTKMM_3_0
Gtk::Paned pane;
-#else
- Gtk::HPaned pane;
-#endif
-
Gtk::VBox detailsBox;
Gtk::HBox titleFrame;
Gtk::Label titleLabel;
@@ -489,27 +477,14 @@ private:
Inkscape::UI::Widget::Frame axisFrame;
Gtk::ScrolledWindow treeScroller;
Gtk::ScrolledWindow detailScroller;
-
-#if WITH_GTKMM_3_0
Gtk::Paned splitter;
Gtk::Paned split2;
-#else
- Gtk::HPaned splitter;
- Gtk::VPaned split2;
-#endif
-
Gtk::Label devName;
Gtk::Label devKeyCount;
Gtk::Label devAxesCount;
Gtk::ComboBoxText axesCombo;
Gtk::ProgressBar axesValues[6];
-
-#if WITH_GTKMM_3_0
Gtk::Grid axisTable;
-#else
- Gtk::Table axisTable;
-#endif
-
Gtk::ComboBoxText buttonCombo;
Gtk::ComboBoxText linkCombo;
sigc::connection linkConnection;
@@ -519,13 +494,7 @@ private:
Gtk::Image testThumb;
Gtk::Image testButtons[24];
Gtk::Image testAxes[8];
-
-#if WITH_GTKMM_3_0
Gtk::Grid imageTable;
-#else
- Gtk::Table imageTable;
-#endif
-
Gtk::EventBox testDetector;
ConfPanel cfgPanel;
@@ -611,20 +580,11 @@ InputDialogImpl::InputDialogImpl() :
treeScroller(),
detailScroller(),
splitter(),
-#if WITH_GTKMM_3_0
split2(Gtk::ORIENTATION_VERTICAL),
axisTable(),
-#else
- split2(),
- axisTable(11, 2),
-#endif
linkCombo(),
topHolder(),
-#if WITH_GTKMM_3_0
imageTable(),
-#else
- imageTable(8, 7),
-#endif
testDetector(),
cfgPanel()
{
@@ -646,27 +606,16 @@ InputDialogImpl::InputDialogImpl() :
testFrame.add(testDetector);
testThumb.set(getPix(PIX_TABLET));
testThumb.set_padding(24, 24);
-
-#if WITH_GTKMM_3_0
testThumb.set_hexpand();
testThumb.set_vexpand();
imageTable.attach(testThumb, 0, 0, 8, 1);
-#else
- imageTable.attach(testThumb, 0, 8, 0, 1, ::Gtk::EXPAND, ::Gtk::EXPAND);
-#endif
{
guint col = 0;
guint row = 1;
for ( guint num = 0; num < G_N_ELEMENTS(testButtons); num++ ) {
testButtons[num].set(getPix(PIX_BUTTONS_NONE));
-
-#if WITH_GTKMM_3_0
imageTable.attach(testButtons[num], col, row, 1, 1);
-#else
- imageTable.attach(testButtons[num], col, col + 1, row, row + 1, ::Gtk::FILL, ::Gtk::FILL);
-#endif
-
col++;
if (col > 7) {
col = 0;
@@ -677,13 +626,7 @@ InputDialogImpl::InputDialogImpl() :
col = 0;
for ( guint num = 0; num < G_N_ELEMENTS(testAxes); num++ ) {
testAxes[num].set(getPix(PIX_AXIS_NONE));
-
-#if WITH_GTKMM_3_0
imageTable.attach(testAxes[num], col * 2, row, 2, 1);
-#else
- imageTable.attach(testAxes[num], col * 2, (col + 1) * 2, row, row + 1, ::Gtk::FILL, ::Gtk::FILL);
-#endif
-
col++;
if (col > 3) {
col = 0;
@@ -721,45 +664,17 @@ InputDialogImpl::InputDialogImpl() :
axisFrame.add(axisTable);
Gtk::Label *lbl = Gtk::manage(new Gtk::Label(_("Link:")));
-
-#if WITH_GTKMM_3_0
axisTable.attach(*lbl, 0, rowNum, 1, 1);
-#else
- axisTable.attach(*lbl, 0, 1, rowNum, rowNum+ 1,
- ::Gtk::FILL,
- ::Gtk::SHRINK);
-#endif
-
linkCombo.append(_("None"));
linkCombo.set_active_text(_("None"));
linkCombo.set_sensitive(false);
linkConnection = linkCombo.signal_changed().connect(sigc::mem_fun(*this, &InputDialogImpl::linkComboChanged));
-
-#if WITH_GTKMM_3_0
axisTable.attach(linkCombo, 1, rowNum, 1, 1);
-#else
- axisTable.attach(linkCombo, 1, 2, rowNum, rowNum + 1,
- ::Gtk::FILL,
- ::Gtk::SHRINK);
-#endif
-
rowNum++;
-
lbl = Gtk::manage(new Gtk::Label(_("Axes count:")));
-
-#if WITH_GTKMM_3_0
axisTable.attach(*lbl, 0, rowNum, 1, 1);
axisTable.attach(devAxesCount, 1, rowNum, 1, 1);
-#else
- axisTable.attach(*lbl, 0, 1, rowNum, rowNum+ 1,
- ::Gtk::FILL,
- ::Gtk::SHRINK);
- axisTable.attach(devAxesCount, 1, 2, rowNum, rowNum + 1,
- ::Gtk::SHRINK,
- ::Gtk::SHRINK);
-#endif
-
rowNum++;
@@ -777,22 +692,11 @@ InputDialogImpl::InputDialogImpl() :
for ( guint barNum = 0; barNum < static_cast<guint>(G_N_ELEMENTS(axesValues)); barNum++ ) {
lbl = Gtk::manage(new Gtk::Label(_("axis:")));
-
-#if WITH_GTKMM_3_0
lbl->set_hexpand();
axisTable.attach(*lbl, 0, rowNum, 1, 1);
axesValues[barNum].set_hexpand();
axisTable.attach(axesValues[barNum], 1, rowNum, 1, 1);
-#else
- axisTable.attach(*lbl, 0, 1, rowNum, rowNum+ 1,
- ::Gtk::EXPAND,
- ::Gtk::SHRINK);
- axisTable.attach(axesValues[barNum], 1, 2, rowNum, rowNum + 1,
- ::Gtk::EXPAND,
- ::Gtk::SHRINK);
-#endif
-
axesValues[barNum].set_sensitive(false);
rowNum++;
@@ -802,17 +706,8 @@ InputDialogImpl::InputDialogImpl() :
lbl = Gtk::manage(new Gtk::Label(_("Button count:")));
-#if WITH_GTKMM_3_0
axisTable.attach(*lbl, 0, rowNum, 1, 1);
axisTable.attach(devKeyCount, 1, rowNum, 1, 1);
-#else
- axisTable.attach(*lbl, 0, 1, rowNum, rowNum+ 1,
- ::Gtk::FILL,
- ::Gtk::SHRINK);
- axisTable.attach(devKeyCount, 1, 2, rowNum, rowNum + 1,
- ::Gtk::SHRINK,
- ::Gtk::SHRINK);
-#endif
rowNum++;
@@ -828,13 +723,7 @@ InputDialogImpl::InputDialogImpl() :
rowNum++;
*/
-#if WITH_GTKMM_3_0
axisTable.attach(keyVal, 0, rowNum, 2, 1);
-#else
- axisTable.attach(keyVal, 0, 2, rowNum, rowNum + 1,
- ::Gtk::FILL,
- ::Gtk::SHRINK);
-#endif
rowNum++;
@@ -848,18 +737,9 @@ InputDialogImpl::InputDialogImpl() :
// TODO: Extension event stuff has been removed from public API in GTK+ 3
// Need to check that this hasn't broken anything
-#if !GTK_CHECK_VERSION(3,0,0)
- gtk_widget_set_extension_events( GTK_WIDGET(testDetector.gobj()), GDK_EXTENSION_EVENTS_ALL );
-#endif
testDetector.add_events(Gdk::POINTER_MOTION_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK |Gdk::PROXIMITY_IN_MASK|Gdk::PROXIMITY_OUT_MASK|Gdk::SCROLL_MASK);
-#if WITH_GTKMM_3_0
axisTable.attach(keyEntry, 0, rowNum, 2, 1);
-#else
- axisTable.attach(keyEntry, 0, 2, rowNum, rowNum + 1,
- ::Gtk::FILL,
- ::Gtk::SHRINK);
-#endif
rowNum++;
@@ -1141,12 +1021,7 @@ InputDialogImpl::ConfPanel::ConfPanel() :
useExt.set_active(Preferences::get()->getBool("/options/useextinput/value"));
useExt.signal_toggled().connect(sigc::mem_fun(*this, &InputDialogImpl::ConfPanel::useExtToggled));
-#if WITH_GTKMM_3_0
- Gtk::ButtonBox *buttonBox = Gtk::manage(new Gtk::ButtonBox);
-#else
- Gtk::HButtonBox *buttonBox = Gtk::manage (new Gtk::HButtonBox);
-#endif
-
+ auto buttonBox = Gtk::manage(new Gtk::ButtonBox);
buttonBox->set_layout (Gtk::BUTTONBOX_END);
//Gtk::Alignment *align = new Gtk::Alignment(Gtk::ALIGN_END, Gtk::ALIGN_START, 0, 0);
buttonBox->add(save);
@@ -1930,7 +1805,6 @@ bool InputDialogImpl::eventSnoop(GdkEvent* event)
testThumb.set(getPix(PIX_ERASER));
break;
}
-#if WITH_GTKMM_3_0
/// \fixme GTK3 added new GDK_SOURCEs that should be handled here!
case GDK_SOURCE_KEYBOARD:
case GDK_SOURCE_TOUCHSCREEN:
@@ -1938,7 +1812,6 @@ bool InputDialogImpl::eventSnoop(GdkEvent* event)
g_warning("InputDialogImpl::eventSnoop : unhandled GDK_SOURCE type!");
break;
}
-#endif
}
updateTestButtons(key, hotButton);
diff --git a/src/ui/dialog/layer-properties.cpp b/src/ui/dialog/layer-properties.cpp
index 9cfc21e18..4aa86cc48 100644
--- a/src/ui/dialog/layer-properties.cpp
+++ b/src/ui/dialog/layer-properties.cpp
@@ -38,22 +38,15 @@ namespace Dialogs {
LayerPropertiesDialog::LayerPropertiesDialog()
: _strategy(NULL), _desktop(NULL), _layer(NULL), _position_visible(false)
{
-#if WITH_GTKMM_3_0
- Gtk::Box *mainVBox = get_content_area();
+ auto mainVBox = get_content_area();
_layout_table.set_row_spacing(4);
_layout_table.set_column_spacing(4);
-#else
- Gtk::Box *mainVBox = get_vbox();
- _layout_table.set_spacings(4);
- _layout_table.resize (1, 2);
-#endif
// Layer name widgets
_layer_name_entry.set_activates_default(true);
_layer_name_label.set_label(_("Layer name:"));
_layer_name_label.set_alignment(1.0, 0.5);
-#if WITH_GTKMM_3_0
_layer_name_label.set_halign(Gtk::ALIGN_FILL);
_layer_name_label.set_valign(Gtk::ALIGN_FILL);
_layout_table.attach(_layer_name_label, 0, 0, 1, 1);
@@ -62,12 +55,6 @@ LayerPropertiesDialog::LayerPropertiesDialog()
_layer_name_entry.set_valign(Gtk::ALIGN_FILL);
_layer_name_entry.set_hexpand();
_layout_table.attach(_layer_name_entry, 1, 0, 1, 1);
-#else
- _layout_table.attach(_layer_name_label,
- 0, 1, 0, 1, Gtk::FILL, Gtk::FILL);
- _layout_table.attach(_layer_name_entry,
- 1, 2, 0, 1, Gtk::FILL | Gtk::EXPAND, Gtk::FILL);
-#endif
mainVBox->pack_start(_layout_table, true, true, 4);
@@ -164,10 +151,6 @@ LayerPropertiesDialog::_setup_position_controls() {
_layer_position_combo.set_cell_data_func(_label_renderer,
sigc::mem_fun(*this, &LayerPropertiesDialog::_prepareLabelRenderer));
-#if !WITH_GTKMM_3_0
- _layout_table.resize (2, 2);
-#endif
-
Gtk::ListStore::iterator row;
row = _dropdown_list->append();
row->set_value(_dropdown_columns.position, LPOS_ABOVE);
@@ -183,7 +166,6 @@ LayerPropertiesDialog::_setup_position_controls() {
_layer_position_label.set_label(_("Position:"));
_layer_position_label.set_alignment(1.0, 0.5);
-#if WITH_GTKMM_3_0
_layer_position_combo.set_halign(Gtk::ALIGN_FILL);
_layer_position_combo.set_valign(Gtk::ALIGN_FILL);
_layer_position_combo.set_hexpand();
@@ -192,12 +174,6 @@ LayerPropertiesDialog::_setup_position_controls() {
_layer_position_label.set_halign(Gtk::ALIGN_FILL);
_layer_position_label.set_valign(Gtk::ALIGN_FILL);
_layout_table.attach(_layer_position_label, 0, 1, 1, 1);
-#else
- _layout_table.attach(_layer_position_combo,
- 1, 2, 1, 2, Gtk::FILL | Gtk::EXPAND, Gtk::FILL);
- _layout_table.attach(_layer_position_label,
- 0, 1, 1, 2, Gtk::FILL, Gtk::FILL);
-#endif
show_all_children();
}
@@ -252,16 +228,11 @@ LayerPropertiesDialog::_setup_layers_controls() {
_layout_table.remove(_layer_name_entry);
_layout_table.remove(_layer_name_label);
-#if WITH_GTKMM_3_0
_scroller.set_halign(Gtk::ALIGN_FILL);
_scroller.set_valign(Gtk::ALIGN_FILL);
_scroller.set_hexpand();
_scroller.set_vexpand();
_layout_table.attach(_scroller, 0, 1, 2, 1);
-#else
- _layout_table.attach(_scroller,
- 0, 2, 1, 2, Gtk::FILL | Gtk::EXPAND, Gtk::FILL | Gtk::EXPAND);
-#endif
show_all_children();
}
diff --git a/src/ui/dialog/layer-properties.h b/src/ui/dialog/layer-properties.h
index c75a7f190..f62f22782 100644
--- a/src/ui/dialog/layer-properties.h
+++ b/src/ui/dialog/layer-properties.h
@@ -19,12 +19,7 @@
#include <gtkmm/dialog.h>
#include <gtkmm/entry.h>
#include <gtkmm/label.h>
-
-#if WITH_GTKMM_3_0
#include <gtkmm/grid.h>
-#else
-#include <gtkmm/table.h>
-#endif
#include <gtkmm/combobox.h>
#include <gtkmm/liststore.h>
@@ -102,12 +97,7 @@ protected:
Gtk::Entry _layer_name_entry;
Gtk::Label _layer_position_label;
Gtk::ComboBox _layer_position_combo;
-
-#if WITH_GTKMM_3_0
Gtk::Grid _layout_table;
-#else
- Gtk::Table _layout_table;
-#endif
bool _position_visible;
diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp
index c75c631d7..dd9d7ec25 100644
--- a/src/ui/dialog/layers.cpp
+++ b/src/ui/dialog/layers.cpp
@@ -858,12 +858,8 @@ LayersPanel::LayersPanel() :
_scroller.set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC );
_scroller.set_shadow_type(Gtk::SHADOW_IN);
Gtk::Requisition sreq;
-#if WITH_GTKMM_3_0
Gtk::Requisition sreq_natural;
_scroller.get_preferred_size(sreq_natural, sreq);
-#else
- sreq = _scroller.size_request();
-#endif
int minHeight = 70;
if (sreq.height < minHeight) {
// Set a min height to see the layers when used with Ubuntu liboverlay-scrollbar
diff --git a/src/ui/dialog/layers.h b/src/ui/dialog/layers.h
index 9cd2c3b92..893b31557 100644
--- a/src/ui/dialog/layers.h
+++ b/src/ui/dialog/layers.h
@@ -124,15 +124,9 @@ private:
Gtk::TreeView _tree;
Gtk::CellRendererText *_text_renderer;
Gtk::TreeView::Column *_name_column;
-#if WITH_GTKMM_3_0
Gtk::Box _buttonsRow;
Gtk::Box _buttonsPrimary;
Gtk::Box _buttonsSecondary;
-#else
- Gtk::HBox _buttonsRow;
- Gtk::HBox _buttonsPrimary;
- Gtk::HBox _buttonsSecondary;
-#endif
Gtk::ScrolledWindow _scroller;
Gtk::Menu _popupMenu;
Inkscape::UI::Widget::SpinButton _spinBtn;
diff --git a/src/ui/dialog/livepatheffect-add.cpp b/src/ui/dialog/livepatheffect-add.cpp
index 3602b04df..917e48ac6 100644
--- a/src/ui/dialog/livepatheffect-add.cpp
+++ b/src/ui/dialog/livepatheffect-add.cpp
@@ -73,11 +73,7 @@ LivePathEffectAdd::LivePathEffectAdd() :
add_button.set_use_underline(true);
add_button.set_can_default();
-#if WITH_GTKMM_3_0
- Gtk::Box *mainVBox = get_content_area();
-#else
- Gtk::Box *mainVBox = get_vbox();
-#endif
+ auto mainVBox = get_content_area();
mainVBox->pack_start(scrolled_window, true, true);
add_action_widget(close_button, Gtk::RESPONSE_CLOSE);
diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp
index ac64143f1..459d8d4ee 100644
--- a/src/ui/dialog/livepatheffect-editor.cpp
+++ b/src/ui/dialog/livepatheffect-editor.cpp
@@ -125,13 +125,6 @@ LivePathEffectEditor::LivePathEffectEditor()
// Add toolbar items to toolbar
toolbar_hbox.set_layout (Gtk::BUTTONBOX_END);
-
-#if !WITH_GTKMM_3_0
- // TODO: This has been removed from Gtkmm 3.0. Check that
- // everything still looks OK!
- toolbar_hbox.set_child_min_width( 16 );
-#endif
-
toolbar_hbox.add( button_add );
toolbar_hbox.set_child_secondary( button_add , true);
toolbar_hbox.add( button_remove );
diff --git a/src/ui/dialog/livepatheffect-editor.h b/src/ui/dialog/livepatheffect-editor.h
index 4aac25eaa..b69ee007a 100644
--- a/src/ui/dialog/livepatheffect-editor.h
+++ b/src/ui/dialog/livepatheffect-editor.h
@@ -112,11 +112,7 @@ private:
void on_visibility_toggled( Glib::ustring const& str );
-#if WITH_GTKMM_3_0
Gtk::ButtonBox toolbar_hbox;
-#else
- Gtk::HButtonBox toolbar_hbox;
-#endif
Gtk::Button button_add;
Gtk::Button button_remove;
Gtk::Button button_up;
diff --git a/src/ui/dialog/new-from-template.cpp b/src/ui/dialog/new-from-template.cpp
index 96fa72791..2b33fd54d 100644
--- a/src/ui/dialog/new-from-template.cpp
+++ b/src/ui/dialog/new-from-template.cpp
@@ -30,20 +30,12 @@ NewFromTemplate::NewFromTemplate()
_main_widget = new TemplateLoadTab(this);
-#if WITH_GTKMM_3_0
get_content_area()->pack_start(*_main_widget);
-#else
- get_vbox()->pack_start(*_main_widget);
-#endif
Gtk::Alignment *align;
align = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_END, Gtk::ALIGN_CENTER, 0.0, 0.0));
-#if WITH_GTKMM_3_0
get_content_area()->pack_end(*align, Gtk::PACK_SHRINK);
-#else
- get_vbox()->pack_end(*align, Gtk::PACK_SHRINK);
-#endif
align->set_padding(0, 0, 0, 15);
align->add(_create_template_button);
diff --git a/src/ui/dialog/object-properties.cpp b/src/ui/dialog/object-properties.cpp
index 545c240fc..191216eea 100644
--- a/src/ui/dialog/object-properties.cpp
+++ b/src/ui/dialog/object-properties.cpp
@@ -37,12 +37,7 @@
#include "sp-image.h"
#include <glibmm/i18n.h>
-#if WITH_GTKMM_3_0
-# include <gtkmm/grid.h>
-#else
-# include <gtkmm/table.h>
-#endif
-
+#include <gtkmm/grid.h>
namespace Inkscape {
namespace UI {
@@ -103,16 +98,9 @@ void ObjectProperties::_init()
Gtk::Box *contents = _getContents();
contents->set_spacing(0);
-#if WITH_GTKMM_3_0
- Gtk::Grid *grid_top = Gtk::manage(new Gtk::Grid());
+ auto grid_top = Gtk::manage(new Gtk::Grid());
grid_top->set_row_spacing(4);
grid_top->set_column_spacing(0);
-#else
- Gtk::Table *grid_top = Gtk::manage(new Gtk::Table(4, 4));
- grid_top->set_row_spacings(4);
- grid_top->set_col_spacings(0);
-#endif
-
grid_top->set_border_width(4);
contents->pack_start(*grid_top, false, false, 0);
@@ -121,29 +109,14 @@ void ObjectProperties::_init()
/* Create the label for the object id */
_label_id.set_label(_label_id.get_label() + " ");
_label_id.set_alignment(1, 0.5);
-
-#if WITH_GTKMM_3_0
_label_id.set_valign(Gtk::ALIGN_CENTER);
grid_top->attach(_label_id, 0, 0, 1, 1);
-#else
- grid_top->attach(_label_id, 0, 1, 0, 1,
- Gtk::SHRINK | Gtk::FILL,
- Gtk::AttachOptions(), 0, 0 );
-#endif
-
/* Create the entry box for the object id */
_entry_id.set_tooltip_text(_("The id= attribute (only letters, digits, and the characters .-_: allowed)"));
_entry_id.set_max_length(64);
-
-#if WITH_GTKMM_3_0
_entry_id.set_valign(Gtk::ALIGN_CENTER);
grid_top->attach(_entry_id, 1, 0, 1, 1);
-#else
- grid_top->attach(_entry_id, 1, 2, 0, 1,
- Gtk::EXPAND | Gtk::FILL,
- Gtk::AttachOptions(), 0, 0 );
-#endif
_label_id.set_mnemonic_widget(_entry_id);
@@ -157,29 +130,16 @@ void ObjectProperties::_init()
_label_label.set_label(_label_label.get_label() + " ");
_label_label.set_alignment(1, 0.5);
-#if WITH_GTKMM_3_0
_label_label.set_valign(Gtk::ALIGN_CENTER);
grid_top->attach(_label_label, 0, 1, 1, 1);
-#else
- grid_top->attach(_label_label, 0, 1, 1, 2,
- Gtk::SHRINK | Gtk::FILL,
- Gtk::AttachOptions(), 0, 0 );
-#endif
-
/* Create the entry box for the object label */
_entry_label.set_tooltip_text(_("A freeform label for the object"));
_entry_label.set_max_length(256);
-#if WITH_GTKMM_3_0
_entry_label.set_hexpand();
_entry_label.set_valign(Gtk::ALIGN_CENTER);
grid_top->attach(_entry_label, 1, 1, 1, 1);
-#else
- grid_top->attach(_entry_label, 1, 2, 1, 2,
- Gtk::EXPAND | Gtk::FILL,
- Gtk::AttachOptions(), 0, 0 );
-#endif
_label_label.set_mnemonic_widget(_entry_label);
@@ -191,28 +151,16 @@ void ObjectProperties::_init()
_label_title.set_label(_label_title.get_label() + " ");
_label_title.set_alignment (1, 0.5);
-#if WITH_GTKMM_3_0
_label_title.set_valign(Gtk::ALIGN_CENTER);
grid_top->attach(_label_title, 0, 2, 1, 1);
-#else
- grid_top->attach(_label_title, 0, 1, 2, 3,
- Gtk::SHRINK | Gtk::FILL,
- Gtk::AttachOptions(), 0, 0 );
-#endif
/* Create the entry box for the object title */
_entry_title.set_sensitive (FALSE);
_entry_title.set_max_length (256);
-#if WITH_GTKMM_3_0
_entry_title.set_hexpand();
_entry_title.set_valign(Gtk::ALIGN_CENTER);
grid_top->attach(_entry_title, 1, 2, 1, 1);
-#else
- grid_top->attach(_entry_title, 1, 2, 2, 3,
- Gtk::EXPAND | Gtk::FILL,
- Gtk::AttachOptions(), 0, 0 );
-#endif
_label_title.set_mnemonic_widget(_entry_title);
// pressing enter in the label field is the same as clicking Set:
@@ -241,14 +189,8 @@ void ObjectProperties::_init()
_label_image_rendering.set_label(_label_image_rendering.get_label() + " ");
_label_image_rendering.set_alignment(1, 0.5);
-#if WITH_GTKMM_3_0
_label_image_rendering.set_valign(Gtk::ALIGN_CENTER);
grid_top->attach(_label_image_rendering, 0, 3, 1, 1);
-#else
- grid_top->attach(_label_image_rendering, 0, 1, 3, 4,
- Gtk::SHRINK | Gtk::FILL,
- Gtk::AttachOptions(), 0, 0 );
-#endif
/* Create the combo box text for the 'image-rendering' property */
_combo_image_rendering.append( "auto" );
@@ -256,14 +198,8 @@ void ObjectProperties::_init()
_combo_image_rendering.append( "optimizeSpeed" );
_combo_image_rendering.set_tooltip_text(_("The 'image-rendering' property can influence how a bitmap is up-scaled:\n\t'auto' no preference;\n\t'optimizeQuality' smooth;\n\t'optimizeSpeed' blocky.\nNote that this behaviour is not defined in the SVG 1.1 specification and not all browsers follow this interpretation."));
-#if WITH_GTKMM_3_0
_combo_image_rendering.set_valign(Gtk::ALIGN_CENTER);
grid_top->attach(_combo_image_rendering, 1, 3, 1, 1);
-#else
- grid_top->attach(_combo_image_rendering, 1, 2, 3, 4,
- Gtk::EXPAND | Gtk::FILL,
- Gtk::AttachOptions(), 0, 0 );
-#endif
_label_image_rendering.set_mnemonic_widget(_combo_image_rendering);
@@ -275,60 +211,36 @@ void ObjectProperties::_init()
Gtk::HBox *hb_checkboxes = Gtk::manage(new Gtk::HBox());
contents->pack_start(*hb_checkboxes, FALSE, FALSE, 0);
-#if WITH_GTKMM_3_0
- Gtk::Grid *grid_cb = Gtk::manage(new Gtk::Grid());
+ auto grid_cb = Gtk::manage(new Gtk::Grid());
grid_cb->set_row_homogeneous();
grid_cb->set_column_homogeneous(true);
-#else
- Gtk::Table *grid_cb = Gtk::manage(new Gtk::Table(1, 2, true));
-#endif
grid_cb->set_border_width(4);
hb_checkboxes->pack_start(*grid_cb, true, true, 0);
/* Hide */
_cb_hide.set_tooltip_text (_("Check to make the object invisible"));
-
-#if WITH_GTKMM_3_0
_cb_hide.set_hexpand();
_cb_hide.set_valign(Gtk::ALIGN_CENTER);
grid_cb->attach(_cb_hide, 0, 0, 1, 1);
-#else
- grid_cb->attach(_cb_hide, 0, 1, 0, 1,
- Gtk::EXPAND | Gtk::FILL,
- Gtk::AttachOptions(), 0, 0 );
-#endif
_cb_hide.signal_toggled().connect(sigc::mem_fun(this, &ObjectProperties::_hiddenToggled));
/* Lock */
// TRANSLATORS: "Lock" is a verb here
_cb_lock.set_tooltip_text(_("Check to make the object insensitive (not selectable by mouse)"));
-
-#if WITH_GTKMM_3_0
_cb_lock.set_hexpand();
_cb_lock.set_valign(Gtk::ALIGN_CENTER);
grid_cb->attach(_cb_lock, 1, 0, 1, 1);
-#else
- grid_cb->attach(_cb_lock, 1, 2, 0, 1,
- Gtk::EXPAND | Gtk::FILL,
- Gtk::AttachOptions(), 0, 0 );
-#endif
_cb_lock.signal_toggled().connect(sigc::mem_fun(this, &ObjectProperties::_sensitivityToggled));
/* Button for setting the object's id, label, title and description. */
Gtk::Button *btn_set = Gtk::manage(new Gtk::Button(_("_Set"), 1));
-#if WITH_GTKMM_3_0
btn_set->set_hexpand();
btn_set->set_valign(Gtk::ALIGN_CENTER);
grid_cb->attach(*btn_set, 2, 0, 1, 1);
-#else
- grid_cb->attach(*btn_set, 2, 3, 0, 1,
- Gtk::EXPAND | Gtk::FILL,
- Gtk::AttachOptions(), 0, 0 );
-#endif
btn_set->signal_clicked().connect(sigc::mem_fun(this, &ObjectProperties::_labelChanged));
diff --git a/src/ui/dialog/object-properties.h b/src/ui/dialog/object-properties.h
index dc28c0bad..8551d5fca 100644
--- a/src/ui/dialog/object-properties.h
+++ b/src/ui/dialog/object-properties.h
@@ -50,11 +50,7 @@ class SPDesktop;
class SPItem;
namespace Gtk {
-#if WITH_GTKMM_3_0
class Grid;
-#else
-class Table;
-#endif
}
namespace Inkscape {
diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp
index 43aa663e2..09ffc9c4c 100644
--- a/src/ui/dialog/objects.cpp
+++ b/src/ui/dialog/objects.cpp
@@ -330,12 +330,11 @@ void ObjectsPanel::_objectsChanged(SPObject */*obj*/)
void ObjectsPanel::_addObject(SPObject* obj, Gtk::TreeModel::Row* parentRow)
{
if ( _desktop && obj ) {
- for ( SPObject *child = obj->children; child != NULL; child = child->next) {
-
- if (SP_IS_ITEM(child))
+ for(auto& child: obj->children) {
+ if (SP_IS_ITEM(&child))
{
- SPItem * item = SP_ITEM(child);
- SPGroup * group = SP_IS_GROUP(child) ? SP_GROUP(child) : 0;
+ SPItem * item = SP_ITEM(&child);
+ SPGroup * group = SP_IS_GROUP(&child) ? SP_GROUP(&child) : 0;
//Add the item to the tree and set the column information
Gtk::TreeModel::iterator iter = parentRow ? _store->prepend(parentRow->children()) : _store->prepend();
@@ -362,14 +361,14 @@ void ObjectsPanel::_addObject(SPObject* obj, Gtk::TreeModel::Row* parentRow)
}
//Add an object watcher to the item
- ObjectsPanel::ObjectWatcher *w = new ObjectsPanel::ObjectWatcher(this, child);
- child->getRepr()->addObserver(*w);
+ ObjectsPanel::ObjectWatcher *w = new ObjectsPanel::ObjectWatcher(this, &child);
+ child.getRepr()->addObserver(*w);
_objectWatchers.push_back(w);
//If the item is a group, recursively add its children
if (group)
{
- _addObject( child, &row );
+ _addObject( &child, &row );
}
}
}
@@ -389,9 +388,8 @@ void ObjectsPanel::_updateObject( SPObject *obj, bool recurse ) {
//end mark
if (recurse)
{
- for (SPObject * iter = obj->children; iter != NULL; iter = iter->next)
- {
- _updateObject(iter, recurse);
+ for (auto& iter: obj->children) {
+ _updateObject(&iter, recurse);
}
}
}
@@ -468,8 +466,8 @@ void ObjectsPanel::_objectsSelected( Selection *sel ) {
_selectedConnection.block();
_tree.get_selection()->unselect_all();
SPItem *item = NULL;
- std::vector<SPItem*> const items = sel->itemList();
- for(std::vector<SPItem*>::const_iterator i=items.begin(); i!=items.end(); ++i){
+ auto items = sel->items();
+ for(auto i=items.begin(); i!=items.end(); ++i){
item = *i;
if (setOpacity)
{
@@ -501,28 +499,27 @@ void ObjectsPanel::_setCompositingValues(SPItem *item)
_blurConnection.block();
//Set the opacity
-#if WITH_GTKMM_3_0
_opacity_adjustment->set_value((item->style->opacity.set ? SP_SCALE24_TO_FLOAT(item->style->opacity.value) : 1) * _opacity_adjustment->get_upper());
-#else
- _opacity_adjustment.set_value((item->style->opacity.set ? SP_SCALE24_TO_FLOAT(item->style->opacity.value) : 1) * _opacity_adjustment.get_upper());
-#endif
SPFeBlend *spblend = NULL;
SPGaussianBlur *spblur = NULL;
if (item->style->getFilter())
{
- for(SPObject *primitive_obj = item->style->getFilter()->children; primitive_obj && SP_IS_FILTER_PRIMITIVE(primitive_obj); primitive_obj = primitive_obj->next) {
- if(SP_IS_FEBLEND(primitive_obj) && !spblend) {
- //Get the blend mode
- spblend = SP_FEBLEND(primitive_obj);
- }
-
- if(SP_IS_GAUSSIANBLUR(primitive_obj) && !spblur) {
- //Get the blur value
- spblur = SP_GAUSSIANBLUR(primitive_obj);
- }
+ for (auto& primitive_obj: item->style->getFilter()->children) {
+ if (!SP_IS_FILTER_PRIMITIVE(&primitive_obj)) {
+ break;
+ }
+ if(SP_IS_FEBLEND(&primitive_obj) && !spblend) {
+ //Get the blend mode
+ spblend = SP_FEBLEND(&primitive_obj);
}
+
+ if(SP_IS_GAUSSIANBLUR(&primitive_obj) && !spblur) {
+ //Get the blur value
+ spblur = SP_GAUSSIANBLUR(&primitive_obj);
+ }
+ }
}
-
+
//Set the blend mode
_fe_cb.set_blend_mode(spblend ? spblend->blend_mode : Inkscape::Filters::BLEND_NORMAL);
@@ -1282,9 +1279,9 @@ bool ObjectsPanel::_executeAction()
break;
case BUTTON_COLLAPSE_ALL:
{
- for (SPObject* obj = _document->getRoot()->firstChild(); obj != NULL; obj = obj->next) {
- if (SP_IS_GROUP(obj)) {
- _setCollapsed(SP_GROUP(obj));
+ for (auto& obj: _document->getRoot()->children) {
+ if (SP_IS_GROUP(&obj)) {
+ _setCollapsed(SP_GROUP(&obj));
}
}
_objectsChanged(_document->getRoot());
@@ -1394,9 +1391,10 @@ void ObjectsPanel::_setCollapsed(SPGroup * group)
{
group->setExpanded(false);
group->updateRepr(SP_OBJECT_WRITE_NO_CHILDREN | SP_OBJECT_WRITE_EXT);
- for (SPObject *iter = group->children; iter != NULL; iter = iter->next)
- {
- if (SP_IS_GROUP(iter)) _setCollapsed(SP_GROUP(iter));
+ for (auto& iter: group->children) {
+ if (SP_IS_GROUP(&iter)) {
+ _setCollapsed(SP_GROUP(&iter));
+ }
}
}
@@ -1471,11 +1469,7 @@ void ObjectsPanel::_opacityChangedIter(const Gtk::TreeIter& iter)
if (item)
{
item->style->opacity.set = TRUE;
-#if WITH_GTKMM_3_0
item->style->opacity.value = SP_SCALE24_FROM_FLOAT(_opacity_adjustment->get_value() / _opacity_adjustment->get_upper());
-#else
- item->style->opacity.value = SP_SCALE24_FROM_FLOAT(_opacity_adjustment.get_value() / _opacity_adjustment.get_upper());
-#endif
item->updateRepr(SP_OBJECT_WRITE_NO_CHILDREN | SP_OBJECT_WRITE_EXT);
}
}
@@ -1511,11 +1505,14 @@ void ObjectsPanel::_blendChangedIter(const Gtk::TreeIter& iter, Glib::ustring bl
if (blendmode != "normal") {
gdouble radius = 0;
if (item->style->getFilter()) {
- for (SPObject *primitive = item->style->getFilter()->children; primitive && SP_IS_FILTER_PRIMITIVE(primitive); primitive = primitive->next) {
- if (SP_IS_GAUSSIANBLUR(primitive)) {
+ for (auto& primitive: item->style->getFilter()->children) {
+ if (!SP_IS_FILTER_PRIMITIVE(&primitive)) {
+ break;
+ }
+ if (SP_IS_GAUSSIANBLUR(&primitive)) {
Geom::OptRect bbox = item->bounds(SPItem::GEOMETRIC_BBOX);
if (bbox) {
- radius = SP_GAUSSIANBLUR(primitive)->stdDeviation.getNumber();
+ radius = SP_GAUSSIANBLUR(&primitive)->stdDeviation.getNumber();
}
}
}
@@ -1523,13 +1520,16 @@ void ObjectsPanel::_blendChangedIter(const Gtk::TreeIter& iter, Glib::ustring bl
SPFilter *filter = new_filter_simple_from_item(_document, item, blendmode.c_str(), radius);
sp_style_set_property_url(item, "filter", filter, false);
} else {
- for (SPObject *primitive = item->style->getFilter()->children; primitive && SP_IS_FILTER_PRIMITIVE(primitive); primitive = primitive->next) {
- if (SP_IS_FEBLEND(primitive)) {
- primitive->deleteObject();
+ for (auto& primitive: item->style->getFilter()->children) {
+ if (!SP_IS_FILTER_PRIMITIVE(&primitive)) {
+ break;
+ }
+ if (SP_IS_FEBLEND(&primitive)) {
+ primitive.deleteObject();
break;
}
}
- if (!item->style->getFilter()->children) {
+ if (!item->style->getFilter()->firstChild()) {
remove_filter(item, false);
}
}
@@ -1580,13 +1580,16 @@ void ObjectsPanel::_blurChangedIter(const Gtk::TreeIter& iter, double blur)
SPFilter *filter = modify_filter_gaussian_blur_from_item(_document, item, radius);
sp_style_set_property_url(item, "filter", filter, false);
} else if (item->style->filter.set && item->style->getFilter()) {
- for (SPObject *primitive = item->style->getFilter()->children; primitive && SP_IS_FILTER_PRIMITIVE(primitive); primitive = primitive->next) {
- if (SP_IS_GAUSSIANBLUR(primitive)) {
- primitive->deleteObject();
+ for (auto& primitive: item->style->getFilter()->children) {
+ if (!SP_IS_FILTER_PRIMITIVE(&primitive)) {
+ break;
+ }
+ if (SP_IS_GAUSSIANBLUR(&primitive)) {
+ primitive.deleteObject();
break;
}
}
- if (!item->style->getFilter()->children) {
+ if (!item->style->getFilter()->firstChild()) {
remove_filter(item, false);
}
}
@@ -1618,11 +1621,7 @@ ObjectsPanel::ObjectsPanel() :
_opacity_vbox(false, 0),
_opacity_label(_("Opacity:")),
_opacity_label_unit(_("%")),
-#if WITH_GTKMM_3_0
_opacity_adjustment(Gtk::Adjustment::create(100.0, 0.0, 100.0, 1.0, 1.0, 0.0)),
-#else
- _opacity_adjustment(100.0, 0.0, 100.0, 1.0, 1.0, 0.0),
-#endif
_opacity_hscale(_opacity_adjustment),
_opacity_spin_button(_opacity_adjustment, 0.01, 1),
_fe_cb(UI::Widget::SimpleFilterModifier::BLEND),
@@ -1752,12 +1751,8 @@ ObjectsPanel::ObjectsPanel() :
_scroller.set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC );
_scroller.set_shadow_type(Gtk::SHADOW_IN);
Gtk::Requisition sreq;
-#if WITH_GTKMM_3_0
Gtk::Requisition sreq_natural;
_scroller.get_preferred_size(sreq_natural, sreq);
-#else
- sreq = _scroller.size_request();
-#endif
int minHeight = 70;
if (sreq.height < minHeight) {
// Set a min height to see the layers when used with Ubuntu liboverlay-scrollbar
@@ -1790,13 +1785,8 @@ ObjectsPanel::ObjectsPanel() :
_opacity_hbox.pack_start(_opacity_spin_button, false, false, 0);
_opacity_hbox.pack_start(_opacity_label_unit, false, false, 3);
_opacity_hscale.set_draw_value(false);
-#if WITH_GTKMM_3_0
_opacityConnection = _opacity_adjustment->signal_value_changed().connect(sigc::mem_fun(*this, &ObjectsPanel::_opacityValueChanged));
_opacity_label.set_mnemonic_widget(_opacity_hscale);
-#else
- _opacityConnection = _opacity_adjustment.signal_value_changed().connect(sigc::mem_fun(*this, &ObjectsPanel::_opacityValueChanged));
- _opacity_label.set_mnemonic_widget(_opacity_hscale);
-#endif
//Keep the labels aligned
GtkSizeGroup *labels = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
diff --git a/src/ui/dialog/objects.h b/src/ui/dialog/objects.h
index 9b9a6025a..018f9191f 100644
--- a/src/ui/dialog/objects.h
+++ b/src/ui/dialog/objects.h
@@ -134,15 +134,9 @@ private:
Gtk::TreeView _tree;
Gtk::CellRendererText *_text_renderer;
Gtk::TreeView::Column *_name_column;
-#if WITH_GTKMM_3_0
Gtk::Box _buttonsRow;
Gtk::Box _buttonsPrimary;
Gtk::Box _buttonsSecondary;
-#else
- Gtk::HBox _buttonsRow;
- Gtk::HBox _buttonsPrimary;
- Gtk::HBox _buttonsSecondary;
-#endif
Gtk::ScrolledWindow _scroller;
Gtk::Menu _popupMenu;
Inkscape::UI::Widget::SpinButton _spinBtn;
@@ -161,11 +155,7 @@ private:
Gtk::HBox _opacity_hbox;
Gtk::Label _opacity_label;
Gtk::Label _opacity_label_unit;
-#if WITH_GTKMM_3_0
Glib::RefPtr<Gtk::Adjustment> _opacity_adjustment;
-#else
- Gtk::Adjustment _opacity_adjustment;
-#endif
Gtk::HScale _opacity_hscale;
Inkscape::UI::Widget::SpinButton _opacity_spin_button;
diff --git a/src/ui/dialog/ocaldialogs.cpp b/src/ui/dialog/ocaldialogs.cpp
index 3353d2878..878b68d55 100644
--- a/src/ui/dialog/ocaldialogs.cpp
+++ b/src/ui/dialog/ocaldialogs.cpp
@@ -311,27 +311,10 @@ LoadingBox::LoadingBox() : Gtk::EventBox()
draw_spinner = false;
spinner_step = 0;
-#if WITH_GTKMM_3_0
signal_draw().connect(sigc::mem_fun(*this, &LoadingBox::_on_draw), false);
-#else
- signal_expose_event().connect(sigc::mem_fun(*this, &LoadingBox::_on_expose_event), false);
-#endif
-}
-
-#if !WITH_GTKMM_3_0
-bool LoadingBox::_on_expose_event(GdkEventExpose* /*event*/)
-{
- Cairo::RefPtr<Cairo::Context> cr = get_window()->create_cairo_context();
-
- return _on_draw(cr);
}
-#endif
-bool LoadingBox::_on_draw(const Cairo::RefPtr<Cairo::Context> &
-#if WITH_GTKMM_3_0
-cr
-#endif
-)
+bool LoadingBox::_on_draw(const Cairo::RefPtr<Cairo::Context> &cr)
{
// Draw shadow
int x = get_allocation().get_x();
@@ -339,27 +322,14 @@ cr
int width = get_allocation().get_width();
int height = get_allocation().get_height();
-#if WITH_GTKMM_3_0
get_style_context()->render_frame(cr, x, y, width, height);
-#else
- get_style()->paint_shadow(get_window(), get_state(), Gtk::SHADOW_IN,
- Gdk::Rectangle(x, y, width, height),
- *this, Glib::ustring("viewport"), x, y, width, height);
-#endif
if (draw_spinner) {
int spinner_size = 16;
int spinner_x = x + (width - spinner_size) / 2;
int spinner_y = y + (height - spinner_size) / 2;
-#if WITH_GTKMM_3_0
get_style_context()->render_activity(cr, spinner_x, spinner_y, spinner_size, spinner_size);
-#else
- gtk_paint_spinner(gtk_widget_get_style(GTK_WIDGET(gobj())),
- gtk_widget_get_window(GTK_WIDGET(gobj())),
- gtk_widget_get_state(GTK_WIDGET(gobj())), NULL, GTK_WIDGET(gobj()),
- NULL, spinner_step, spinner_x, spinner_y, spinner_size, spinner_size);
-#endif
}
return false;
@@ -429,11 +399,7 @@ PreviewWidget::PreviewWidget() : Gtk::VBox(false, 12)
box_loading->set_size_request(90, 90);
set_border_width(12);
-#if WITH_GTKMM_3_0
signal_draw().connect(sigc::mem_fun(*this, &PreviewWidget::_on_draw), false);
-#else
- signal_expose_event().connect(sigc::mem_fun(*this, &PreviewWidget::_on_expose_event), false);
-#endif
clear();
}
@@ -477,15 +443,6 @@ void PreviewWidget::clear()
image->hide();
}
-#if !WITH_GTKMM_3_0
-bool PreviewWidget::_on_expose_event(GdkEventExpose* /*event*/)
-{
- Cairo::RefPtr<Cairo::Context> cr = get_window()->create_cairo_context();
-
- return _on_draw(cr);
-}
-#endif
-
bool PreviewWidget::_on_draw(const Cairo::RefPtr<Cairo::Context>& cr)
{
// Draw background
@@ -494,16 +451,10 @@ bool PreviewWidget::_on_draw(const Cairo::RefPtr<Cairo::Context>& cr)
int width = get_allocation().get_width();
int height = get_allocation().get_height();
-#if WITH_GTKMM_3_0
Gdk::RGBA background_fill;
get_style_context()->lookup_color("base_color", background_fill);
cr->rectangle(x, y, width, height);
Gdk::Cairo::set_source_rgba(cr, background_fill);
-#else
- Gdk::Color background_fill = get_style()->get_base(get_state());
- cr->rectangle(x, y, width, height);
- Gdk::Cairo::set_source_color(cr, background_fill);
-#endif
cr->fill();
@@ -568,57 +519,12 @@ void StatusWidget::end_process()
clear();
}
-#if !GTK_CHECK_VERSION(3,0,0)
-SearchEntry::SearchEntry() : Gtk::Entry()
-{
- signal_changed().connect(sigc::mem_fun(*this, &SearchEntry::_on_changed));
- signal_icon_press().connect(sigc::mem_fun(*this, &SearchEntry::_on_icon_pressed));
-
- set_icon_from_icon_name(INKSCAPE_ICON("edit-find"), Gtk::ENTRY_ICON_PRIMARY);
- gtk_entry_set_icon_from_icon_name(gobj(), GTK_ENTRY_ICON_SECONDARY, NULL);
-}
-
-void SearchEntry::_on_icon_pressed(Gtk::EntryIconPosition icon_position, const GdkEventButton* /*event*/)
-{
- if (icon_position == Gtk::ENTRY_ICON_SECONDARY) {
- grab_focus();
- delete_text(0, -1);
- } else if (icon_position == Gtk::ENTRY_ICON_PRIMARY) {
- select_region(0, -1);
- grab_focus();
- }
-}
-
-void SearchEntry::_on_changed()
-{
- if (get_text().empty()) {
- gtk_entry_set_icon_from_icon_name(gobj(), GTK_ENTRY_ICON_SECONDARY, NULL);
- } else {
- set_icon_from_icon_name(INKSCAPE_ICON("edit-clear"), Gtk::ENTRY_ICON_SECONDARY);
- }
-}
-#endif
-
-
BaseBox::BaseBox() : Gtk::EventBox()
{
-#if WITH_GTKMM_3_0
signal_draw().connect(sigc::mem_fun(*this, &BaseBox::_on_draw), false);
-#else
- signal_expose_event().connect(sigc::mem_fun(*this, &BaseBox::_on_expose_event), false);
-#endif
set_visible_window(false);
}
-#if !WITH_GTKMM_3_0
-bool BaseBox::_on_expose_event(GdkEventExpose* /*event*/)
-{
- Cairo::RefPtr<Cairo::Context> cr = get_window()->create_cairo_context();
-
- return _on_draw(cr);
-}
-#endif
-
bool BaseBox::_on_draw(const Cairo::RefPtr<Cairo::Context>& cr)
{
// Draw background and shadow
@@ -627,23 +533,12 @@ bool BaseBox::_on_draw(const Cairo::RefPtr<Cairo::Context>& cr)
int width = get_allocation().get_width();
int height = get_allocation().get_height();
-#if WITH_GTKMM_3_0
Gdk::RGBA background_fill;
get_style_context()->lookup_color("base_color", background_fill);
cr->rectangle(x, y, width, height);
Gdk::Cairo::set_source_rgba(cr, background_fill);
cr->fill();
get_style_context()->render_frame(cr, x, y, width, height);
-#else
- Gdk::Color background_fill = get_style()->get_base(get_state());
- cr->rectangle(x, y, width, height);
- Gdk::Cairo::set_source_color(cr, background_fill);
- cr->fill();
-
- get_style()->paint_shadow(get_window(), get_state(), Gtk::SHADOW_IN,
- Gdk::Rectangle(x, y, width, height),
- *this, Glib::ustring("viewport"), x, y, width, height);
-#endif
return false;
}
@@ -660,23 +555,10 @@ LogoArea::LogoArea() : Gtk::EventBox()
draw_logo = false;
}
-#if WITH_GTKMM_3_0
signal_draw().connect(sigc::mem_fun(*this, &LogoArea::_on_draw));
-#else
- signal_expose_event().connect(sigc::mem_fun(*this, &LogoArea::_on_expose_event));
-#endif
set_visible_window(false);
}
-#if !WITH_GTKMM_3_0
-bool LogoArea::_on_expose_event(GdkEventExpose* /*event*/)
-{
- Cairo::RefPtr<Cairo::Context> cr = get_window()->create_cairo_context();
-
- return _on_draw(cr);
-}
-#endif
-
bool LogoArea::_on_draw(const Cairo::RefPtr<Cairo::Context>& cr)
{
if (draw_logo) {
@@ -687,16 +569,9 @@ bool LogoArea::_on_draw(const Cairo::RefPtr<Cairo::Context>& cr)
int x_logo = x + (width - 220) / 2;
int y_logo = y + (height - 76) / 2;
- // Draw logo, we mask [read fill] it with the mid colour from the
- // user's GTK theme
-#if WITH_GTKMM_3_0
- // For GTK+ 3, use grey
+ // Draw logo, we mask [read fill] it with grey
Gdk::RGBA logo_fill("grey");
Gdk::Cairo::set_source_rgba(cr, logo_fill);
-#else
- Gdk::Color logo_fill = get_style()->get_mid(get_state());
- Gdk::Cairo::set_source_color(cr, logo_fill);
-#endif
cr->mask(logo_mask, x_logo, y_logo);
}
@@ -1174,16 +1049,9 @@ void ImportDialog::update_label_no_search_results()
Glib::ustring msg_two = _("Please make sure all keywords are spelled correctly,"
" or try again with different keywords.");
-#if WITH_GTKMM_3_0
- Glib::ustring markup = Glib::ustring::compose(
+ auto markup = Glib::ustring::compose(
"<span size=\"large\">%1</span>\n<span>%2</span>",
msg_one, msg_two);
-#else
- Gdk::Color grey = entry_search->get_style()->get_text_aa(entry_search->get_state());
- Glib::ustring markup = Glib::ustring::compose(
- "<span size=\"large\">%1</span>\n<span color=\"%2\">%3</span>",
- msg_one, grey.to_string(), msg_two);
-#endif
label_not_found->set_markup(markup);
}
@@ -1203,33 +1071,17 @@ ImportDialog::ImportDialog(Gtk::Window& parent_window, FileDialogType file_types
dialogType = file_types;
// Creation
- Gtk::VBox *vbox = new Gtk::VBox(false, 0);
-
-#if WITH_GTKMM_3_0
- Gtk::ButtonBox *hbuttonbox_bottom = new Gtk::ButtonBox();
-#else
- Gtk::HButtonBox *hbuttonbox_bottom = new Gtk::HButtonBox();
-#endif
-
- Gtk::HBox *hbox_bottom = new Gtk::HBox(false, 12);
+ auto vbox = new Gtk::VBox(false, 0);
+ auto hbuttonbox_bottom = new Gtk::ButtonBox();
+ auto hbox_bottom = new Gtk::HBox(false, 12);
BaseBox *basebox_logo = new BaseBox();
BaseBox *basebox_no_search_results = new BaseBox();
label_not_found = new Gtk::Label();
label_description = new Gtk::Label();
-
-#if GTK_CHECK_VERSION(3,0,0)
entry_search = new Gtk::SearchEntry();
-#else
- entry_search = new SearchEntry();
-#endif
-
button_search = new Gtk::Button(_("Search"));
-#if WITH_GTKMM_3_0
- Gtk::ButtonBox* hbuttonbox_search = new Gtk::ButtonBox();
-#else
- Gtk::HButtonBox* hbuttonbox_search = new Gtk::HButtonBox();
-#endif
+ auto hbuttonbox_search = new Gtk::ButtonBox();
Gtk::ScrolledWindow* scrolledwindow_preview = new Gtk::ScrolledWindow();
preview_files = new PreviewWidget();
diff --git a/src/ui/dialog/ocaldialogs.h b/src/ui/dialog/ocaldialogs.h
index 9de24d821..db3c60786 100644
--- a/src/ui/dialog/ocaldialogs.h
+++ b/src/ui/dialog/ocaldialogs.h
@@ -17,19 +17,16 @@
# include <config.h>
#endif
-//Gtk includes
+// Gtkmm includes
#include <gtkmm/box.h>
#include <gtkmm/eventbox.h>
#include <gtkmm/listviewtext.h>
#include <gtkmm/scrolledwindow.h>
+#include <gtkmm/searchentry.h>
#include <gtkmm/window.h>
#include <cairomm/refptr.h>
-#if GTK_CHECK_VERSION(3,0,0)
-# include <gtkmm/searchentry.h>
-#endif
-
#include <giomm/file.h>
//Inkscape includes
@@ -283,10 +280,6 @@ private:
sigc::connection timeout;
bool draw_spinner;
-#if !WITH_GTKMM_3_0
- bool _on_expose_event(GdkEventExpose* event);
-#endif
-
bool _on_draw(const Cairo::RefPtr<Cairo::Context>& cr);
bool on_timeout();
};
@@ -310,10 +303,6 @@ private:
WrapLabel* label_description;
WrapLabel* label_time;
-#if !WITH_GTKMM_3_0
- bool _on_expose_event(GdkEventExpose* event);
-#endif
-
bool _on_draw(const Cairo::RefPtr<Cairo::Context>& cr);
};
@@ -336,21 +325,6 @@ public:
Gtk::Label* label;
};
-#if !GTK_CHECK_VERSION(3,0,0)
-/**
- * A Gtk::Entry with search & clear icons
- */
-class SearchEntry : public Gtk::Entry
-{
-public:
- SearchEntry();
-
-private:
- void _on_icon_pressed(Gtk::EntryIconPosition icon_position, const GdkEventButton* event);
- void _on_changed();
-};
-#endif
-
/**
* A box which paints an overlay of the OCAL logo
*/
@@ -359,9 +333,6 @@ class LogoArea : public Gtk::EventBox
public:
LogoArea();
private:
-#if !WITH_GTKMM_3_0
- bool _on_expose_event(GdkEventExpose* event);
-#endif
bool _on_draw(const Cairo::RefPtr<Cairo::Context>& cr);
bool draw_logo;
Cairo::RefPtr<Cairo::ImageSurface> logo_mask;
@@ -375,9 +346,6 @@ class BaseBox : public Gtk::EventBox
public:
BaseBox();
private:
-#if !WITH_GTKMM_3_0
- bool _on_expose_event(GdkEventExpose* event);
-#endif
bool _on_draw(const Cairo::RefPtr<Cairo::Context>& cr);
};
@@ -459,12 +427,7 @@ protected:
private:
Glib::ustring filename_image;
Glib::ustring filename_thumbnail;
-
-#if GTK_CHECK_VERSION(3,0,0)
Gtk::SearchEntry *entry_search;
-#else
- SearchEntry *entry_search;
-#endif
LogoArea *drawingarea_logo;
SearchResultList *list_results;
diff --git a/src/ui/dialog/pixelartdialog.cpp b/src/ui/dialog/pixelartdialog.cpp
index 62e6bf591..b838b0842 100644
--- a/src/ui/dialog/pixelartdialog.cpp
+++ b/src/ui/dialog/pixelartdialog.cpp
@@ -366,8 +366,8 @@ void PixelArtDialogImpl::vectorize()
return;
}
- std::vector<SPItem*> const items = desktop->selection->itemList();
- for(std::vector<SPItem*>::const_iterator i=items.begin(); i!=items.end();++i){
+ auto items = desktop->selection->items();
+ for(auto i=items.begin(); i!=items.end();++i){
if ( !SP_IS_IMAGE(*i) )
continue;
diff --git a/src/ui/dialog/polar-arrange-tab.cpp b/src/ui/dialog/polar-arrange-tab.cpp
index da914dcd4..c51881a96 100644
--- a/src/ui/dialog/polar-arrange-tab.cpp
+++ b/src/ui/dialog/polar-arrange-tab.cpp
@@ -31,11 +31,7 @@ namespace Dialog {
PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_)
: parent(parent_),
-#if WITH_GTKMM_3_0
parametersTable(),
-#else
- parametersTable(3, 3, false),
-#endif
centerY("", C_("Polar arrange tab", "Y coordinate of the center"), UNIT_TYPE_LINEAR),
centerX("", C_("Polar arrange tab", "X coordinate of the center"), centerY),
radiusY("", C_("Polar arrange tab", "Y coordinate of the radius"), UNIT_TYPE_LINEAR),
@@ -79,11 +75,7 @@ PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_)
pack_start(arrangeOnParametersRadio, false, false);
centerLabel.set_text(C_("Polar arrange tab", "Center X/Y:"));
-#if WITH_GTKMM_3_0
parametersTable.attach(centerLabel, 0, 0, 1, 1);
-#else
- parametersTable.attach(centerLabel, 0, 1, 0, 1, Gtk::FILL);
-#endif
centerX.setDigits(2);
centerX.setIncrements(0.2, 0);
centerX.setRange(-10000, 10000);
@@ -92,20 +84,11 @@ PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_)
centerY.setIncrements(0.2, 0);
centerY.setRange(-10000, 10000);
centerY.setValue(0, "px");
-#if WITH_GTKMM_3_0
parametersTable.attach(centerX, 1, 0, 1, 1);
parametersTable.attach(centerY, 2, 0, 1, 1);
-#else
- parametersTable.attach(centerX, 1, 2, 0, 1, Gtk::FILL);
- parametersTable.attach(centerY, 2, 3, 0, 1, Gtk::FILL);
-#endif
radiusLabel.set_text(C_("Polar arrange tab", "Radius X/Y:"));
-#if WITH_GTKMM_3_0
parametersTable.attach(radiusLabel, 0, 1, 1, 1);
-#else
- parametersTable.attach(radiusLabel, 0, 1, 1, 2, Gtk::FILL);
-#endif
radiusX.setDigits(2);
radiusX.setIncrements(0.2, 0);
radiusX.setRange(0.001, 10000);
@@ -114,20 +97,11 @@ PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_)
radiusY.setIncrements(0.2, 0);
radiusY.setRange(0.001, 10000);
radiusY.setValue(100, "px");
-#if WITH_GTKMM_3_0
parametersTable.attach(radiusX, 1, 1, 1, 1);
parametersTable.attach(radiusY, 2, 1, 1, 1);
-#else
- parametersTable.attach(radiusX, 1, 2, 1, 2, Gtk::FILL);
- parametersTable.attach(radiusY, 2, 3, 1, 2, Gtk::FILL);
-#endif
angleLabel.set_text(_("Angle X/Y:"));
-#if WITH_GTKMM_3_0
parametersTable.attach(angleLabel, 0, 2, 1, 1);
-#else
- parametersTable.attach(angleLabel, 0, 1, 2, 3, Gtk::FILL);
-#endif
angleX.setDigits(2);
angleX.setIncrements(0.2, 0);
angleX.setRange(-10000, 10000);
@@ -136,13 +110,8 @@ PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_)
angleY.setIncrements(0.2, 0);
angleY.setRange(-10000, 10000);
angleY.setValue(180, "°");
-#if WITH_GTKMM_3_0
parametersTable.attach(angleX, 1, 2, 1, 1);
parametersTable.attach(angleY, 2, 2, 1, 1);
-#else
- parametersTable.attach(angleX, 1, 2, 2, 3, Gtk::FILL);
- parametersTable.attach(angleY, 2, 3, 2, 3, Gtk::FILL);
-#endif
pack_start(parametersTable, false, false);
rotateObjectsCheckBox.set_label(_("Rotate objects"));
@@ -295,7 +264,7 @@ static void moveToPoint(int anchor, SPItem *item, Geom::Point p)
void PolarArrangeTab::arrange()
{
Inkscape::Selection *selection = parent->getDesktop()->getSelection();
- const std::vector<SPItem*> tmp(selection->itemList());
+ const std::vector<SPItem*> tmp(selection->items().begin(), selection->items().end());
SPGenericEllipse *referenceEllipse = NULL; // Last ellipse in selection
bool arrangeOnEllipse = !arrangeOnParametersRadio.get_active();
diff --git a/src/ui/dialog/polar-arrange-tab.h b/src/ui/dialog/polar-arrange-tab.h
index f7d7bf11f..1a4e04eda 100644
--- a/src/ui/dialog/polar-arrange-tab.h
+++ b/src/ui/dialog/polar-arrange-tab.h
@@ -20,12 +20,7 @@
#include <gtkmm/radiobutton.h>
#include <gtkmm/radiobuttongroup.h>
-
-#if WITH_GTKMM_3_0
- #include <gtkmm/grid.h>
-#else
- #include <gtkmm/table.h>
-#endif
+#include <gtkmm/grid.h>
namespace Inkscape {
namespace UI {
@@ -75,11 +70,7 @@ private:
Gtk::RadioButton arrangeOnLastCircleRadio;
Gtk::RadioButton arrangeOnParametersRadio;
-#if WITH_GTKMM_3_0
Gtk::Grid parametersTable;
-#else
- Gtk::Table parametersTable;
-#endif
Gtk::Label centerLabel;
Inkscape::UI::Widget::ScalarUnit centerY;
diff --git a/src/ui/dialog/spellcheck.cpp b/src/ui/dialog/spellcheck.cpp
index 61fa4c22b..045ce3459 100644
--- a/src/ui/dialog/spellcheck.cpp
+++ b/src/ui/dialog/spellcheck.cpp
@@ -227,14 +227,14 @@ GSList *SpellCheck::allTextItems (SPObject *r, GSList *l, bool hidden, bool lock
return l; // we're not interested in metadata
}
- for (SPObject *child = r->firstChild(); child; child = child->next) {
- if (SP_IS_ITEM (child) && !child->cloned && !desktop->isLayer(SP_ITEM(child))) {
- if ((hidden || !desktop->itemIsHidden(SP_ITEM(child))) && (locked || !SP_ITEM(child)->isLocked())) {
- if (SP_IS_TEXT(child) || SP_IS_FLOWTEXT(child))
- l = g_slist_prepend (l, child);
+ for (auto& child: r->children) {
+ if (SP_IS_ITEM (&child) && !child.cloned && !desktop->isLayer(SP_ITEM(&child))) {
+ if ((hidden || !desktop->itemIsHidden(SP_ITEM(&child))) && (locked || !SP_ITEM(&child)->isLocked())) {
+ if (SP_IS_TEXT(&child) || SP_IS_FLOWTEXT(&child))
+ l = g_slist_prepend (l, &child);
}
}
- l = allTextItems (child, l, hidden, locked);
+ l = allTextItems (&child, l, hidden, locked);
}
return l;
}
diff --git a/src/ui/dialog/spellcheck.h b/src/ui/dialog/spellcheck.h
index e98a9d80e..834f23c24 100644
--- a/src/ui/dialog/spellcheck.h
+++ b/src/ui/dialog/spellcheck.h
@@ -225,11 +225,7 @@ private:
* Dialogs widgets
*/
Gtk::Label banner_label;
-#if WITH_GTKMM_3_0
Gtk::ButtonBox banner_hbox;
-#else
- Gtk::HButtonBox banner_hbox;
-#endif
Gtk::ScrolledWindow scrolled_window;
Gtk::TreeView tree_view;
Glib::RefPtr<Gtk::ListStore> model;
@@ -243,21 +239,10 @@ private:
Gtk::Button add_button;
GtkWidget * dictionary_combo;
Gtk::HBox dictionary_hbox;
-
-#if WITH_GTKMM_3_0
Gtk::Separator action_sep;
-#else
- Gtk::HSeparator action_sep;
-#endif
-
Gtk::Button stop_button;
Gtk::Button start_button;
-
-#if WITH_GTKMM_3_0
Gtk::ButtonBox actionbutton_hbox;
-#else
- Gtk::HButtonBox actionbutton_hbox;
-#endif
SPDesktop * desktop;
DesktopTracker deskTrack;
diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp
index 9dd2342f8..6a87f3714 100644
--- a/src/ui/dialog/svg-fonts-dialog.cpp
+++ b/src/ui/dialog/svg-fonts-dialog.cpp
@@ -113,11 +113,11 @@ void SvgFontsDialog::AttrEntry::set_text(char* t){
void SvgFontsDialog::AttrEntry::on_attr_changed(){
SPObject* o = NULL;
- for(SPObject* node = this->dialog->get_selected_spfont()->children; node; node=node->next){
+ for (auto& node: dialog->get_selected_spfont()->children) {
switch(this->attr){
case SP_PROP_FONT_FAMILY:
- if (SP_IS_FONTFACE(node)){
- o = node;
+ if (SP_IS_FONTFACE(&node)){
+ o = &node;
continue;
}
break;
@@ -168,9 +168,9 @@ void GlyphComboBox::update(SPFont* spfont){
this->append(""); //Gtk is refusing to clear the combobox when I comment out this line
this->remove_all();
- for(SPObject* node = spfont->children; node; node=node->next){
- if (SP_IS_GLYPH(node)){
- this->append((static_cast<SPGlyph*>(node))->unicode);
+ for (auto& node: spfont->children) {
+ if (SP_IS_GLYPH(&node)){
+ this->append((static_cast<SPGlyph*>(&node))->unicode);
}
}
}
@@ -306,10 +306,9 @@ void SvgFontsDialog::update_global_settings_tab(){
SPFont* font = get_selected_spfont();
if (!font) return;
- SPObject* obj;
- for (obj=font->children; obj; obj=obj->next){
- if (SP_IS_FONTFACE(obj)){
- _familyname_entry->set_text((SP_FONTFACE(obj))->font_family);
+ for (auto& obj: font->children) {
+ if (SP_IS_FONTFACE(&obj)){
+ _familyname_entry->set_text((SP_FONTFACE(&obj))->font_family);
}
}
}
@@ -412,12 +411,12 @@ SvgFontsDialog::populate_glyphs_box()
SPFont* spfont = this->get_selected_spfont();
_glyphs_observer.set(spfont);
- for(SPObject* node = spfont->children; node; node=node->next){
- if (SP_IS_GLYPH(node)){
+ for (auto& node: spfont->children) {
+ if (SP_IS_GLYPH(&node)){
Gtk::TreeModel::Row row = *(_GlyphsListStore->append());
- row[_GlyphsListColumns.glyph_node] = static_cast<SPGlyph*>(node);
- row[_GlyphsListColumns.glyph_name] = (static_cast<SPGlyph*>(node))->glyph_name;
- row[_GlyphsListColumns.unicode] = (static_cast<SPGlyph*>(node))->unicode;
+ row[_GlyphsListColumns.glyph_node] = static_cast<SPGlyph*>(&node);
+ row[_GlyphsListColumns.glyph_name] = (static_cast<SPGlyph*>(&node))->glyph_name;
+ row[_GlyphsListColumns.unicode] = (static_cast<SPGlyph*>(&node))->unicode;
}
}
}
@@ -430,13 +429,13 @@ SvgFontsDialog::populate_kerning_pairs_box()
SPFont* spfont = this->get_selected_spfont();
- for(SPObject* node = spfont->children; node; node=node->next){
- if (SP_IS_HKERN(node)){
+ for (auto& node: spfont->children) {
+ if (SP_IS_HKERN(&node)){
Gtk::TreeModel::Row row = *(_KerningPairsListStore->append());
- row[_KerningPairsListColumns.first_glyph] = (static_cast<SPGlyphKerning*>(node))->u1->attribute_string().c_str();
- row[_KerningPairsListColumns.second_glyph] = (static_cast<SPGlyphKerning*>(node))->u2->attribute_string().c_str();
- row[_KerningPairsListColumns.kerning_value] = (static_cast<SPGlyphKerning*>(node))->k;
- row[_KerningPairsListColumns.spnode] = static_cast<SPGlyphKerning*>(node);
+ row[_KerningPairsListColumns.first_glyph] = (static_cast<SPGlyphKerning*>(&node))->u1->attribute_string().c_str();
+ row[_KerningPairsListColumns.second_glyph] = (static_cast<SPGlyphKerning*>(&node))->u2->attribute_string().c_str();
+ row[_KerningPairsListColumns.kerning_value] = (static_cast<SPGlyphKerning*>(&node))->k;
+ row[_KerningPairsListColumns.spnode] = static_cast<SPGlyphKerning*>(&node);
}
}
}
@@ -491,11 +490,10 @@ void SvgFontsDialog::add_glyph(){
Geom::PathVector
SvgFontsDialog::flip_coordinate_system(Geom::PathVector pathv){
double units_per_em = 1000;
- SPObject* obj;
- for (obj = get_selected_spfont()->children; obj; obj=obj->next){
- if (SP_IS_FONTFACE(obj)){
+ for (auto& obj: get_selected_spfont()->children) {
+ if (SP_IS_FONTFACE(&obj)){
//XML Tree being directly used here while it shouldn't be.
- sp_repr_get_double(obj->getRepr(), "units-per-em", &units_per_em);
+ sp_repr_get_double(obj.getRepr(), "units-per-em", &units_per_em);
}
}
@@ -522,7 +520,7 @@ void SvgFontsDialog::set_glyph_description_from_selected_path(){
return;
}
- Inkscape::XML::Node* node = sel->reprList().front();
+ Inkscape::XML::Node* node = sel->xmlNodes().front();
if (!node) return;//TODO: should this be an assert?
if (!node->matchAttributeName("d") || !node->attribute("d")){
char *msg = _("The selected object does not have a <b>path</b> description.");
@@ -564,7 +562,7 @@ void SvgFontsDialog::missing_glyph_description_from_selected_path(){
return;
}
- Inkscape::XML::Node* node = sel->reprList().front();
+ Inkscape::XML::Node* node = sel->xmlNodes().front();
if (!node) return;//TODO: should this be an assert?
if (!node->matchAttributeName("d") || !node->attribute("d")){
char *msg = _("The selected object does not have a <b>path</b> description.");
@@ -574,13 +572,12 @@ void SvgFontsDialog::missing_glyph_description_from_selected_path(){
Geom::PathVector pathv = sp_svg_read_pathv(node->attribute("d"));
- SPObject* obj;
- for (obj = get_selected_spfont()->children; obj; obj=obj->next){
- if (SP_IS_MISSING_GLYPH(obj)){
+ for (auto& obj: get_selected_spfont()->children) {
+ if (SP_IS_MISSING_GLYPH(&obj)){
//XML Tree being directly used here while it shouldn't be.
gchar *str = sp_svg_write_path (flip_coordinate_system(pathv));
- obj->getRepr()->setAttribute("d", str);
+ obj.getRepr()->setAttribute("d", str);
g_free(str);
DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph curves"));
}
@@ -597,11 +594,10 @@ void SvgFontsDialog::reset_missing_glyph_description(){
}
SPDocument* doc = desktop->getDocument();
- SPObject* obj;
- for (obj = get_selected_spfont()->children; obj; obj=obj->next){
- if (SP_IS_MISSING_GLYPH(obj)){
+ for (auto& obj: get_selected_spfont()->children) {
+ if (SP_IS_MISSING_GLYPH(&obj)){
//XML Tree being directly used here while it shouldn't be.
- obj->getRepr()->setAttribute("d", (char*) "M0,0h1000v1024h-1000z");
+ obj.getRepr()->setAttribute("d", (char*) "M0,0h1000v1024h-1000z");
DocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Reset missing-glyph"));
}
}
@@ -736,12 +732,12 @@ void SvgFontsDialog::add_kerning_pair(){
//look for this kerning pair on the currently selected font
this->kerning_pair = NULL;
- for(SPObject* node = this->get_selected_spfont()->children; node; node=node->next){
+ for (auto& node: get_selected_spfont()->children) {
//TODO: It is not really correct to get only the first byte of each string.
//TODO: We should also support vertical kerning
- if (SP_IS_HKERN(node) && (static_cast<SPGlyphKerning*>(node))->u1->contains((gchar) first_glyph.get_active_text().c_str()[0])
- && (static_cast<SPGlyphKerning*>(node))->u2->contains((gchar) second_glyph.get_active_text().c_str()[0]) ){
- this->kerning_pair = static_cast<SPGlyphKerning*>(node);
+ if (SP_IS_HKERN(&node) && (static_cast<SPGlyphKerning*>(&node))->u1->contains((gchar) first_glyph.get_active_text().c_str()[0])
+ && (static_cast<SPGlyphKerning*>(&node))->u2->contains((gchar) second_glyph.get_active_text().c_str()[0]) ){
+ this->kerning_pair = static_cast<SPGlyphKerning*>(&node);
continue;
}
}
@@ -850,11 +846,10 @@ SPFont *new_font(SPDocument *document)
void set_font_family(SPFont* font, char* str){
if (!font) return;
- SPObject* obj;
- for (obj=font->children; obj; obj=obj->next){
- if (SP_IS_FONTFACE(obj)){
+ for (auto& obj: font->children) {
+ if (SP_IS_FONTFACE(&obj)){
//XML Tree being directly used here while it shouldn't be.
- obj->getRepr()->setAttribute("font-family", str);
+ obj.getRepr()->setAttribute("font-family", str);
}
}
@@ -871,11 +866,10 @@ void SvgFontsDialog::add_font(){
font->setLabel(os.str().c_str());
os2 << "SVGFont " << count;
- SPObject* obj;
- for (obj=font->children; obj; obj=obj->next){
- if (SP_IS_FONTFACE(obj)){
+ for (auto& obj: font->children) {
+ if (SP_IS_FONTFACE(&obj)){
//XML Tree being directly used here while it shouldn't be.
- obj->getRepr()->setAttribute("font-family", os2.str().c_str());
+ obj.getRepr()->setAttribute("font-family", os2.str().c_str());
}
}
@@ -888,12 +882,7 @@ void SvgFontsDialog::add_font(){
SvgFontsDialog::SvgFontsDialog()
: UI::Widget::Panel("", "/dialogs/svgfonts", SP_VERB_DIALOG_SVG_FONTS), _add(Gtk::Stock::NEW)
{
-#if WITH_GTKMM_3_0
kerning_slider = Gtk::manage(new Gtk::Scale(Gtk::ORIENTATION_HORIZONTAL));
-#else
- kerning_slider = Gtk::manage(new Gtk::HScale);
-#endif
-
_add.signal_clicked().connect(sigc::mem_fun(*this, &SvgFontsDialog::add_font));
Gtk::HBox* hbox = Gtk::manage(new Gtk::HBox());
diff --git a/src/ui/dialog/svg-fonts-dialog.h b/src/ui/dialog/svg-fonts-dialog.h
index e80bbfd39..1588c0fc2 100644
--- a/src/ui/dialog/svg-fonts-dialog.h
+++ b/src/ui/dialog/svg-fonts-dialog.h
@@ -27,11 +27,7 @@
#include "xml/helper-observer.h"
namespace Gtk {
-#if WITH_GTKMM_3_0
class Scale;
-#else
-class HScale;
-#endif
}
class SPGlyph;
@@ -216,12 +212,7 @@ private:
GlyphComboBox first_glyph, second_glyph;
SPGlyphKerning* kerning_pair;
Inkscape::UI::Widget::SpinButton setwidth_spin;
-
-#if WITH_GTKMM_3_0
Gtk::Scale* kerning_slider;
-#else
- Gtk::HScale* kerning_slider;
-#endif
class EntryWidget : public Gtk::HBox
{
diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp
index e7bf96e8b..3012c5c26 100644
--- a/src/ui/dialog/swatches.cpp
+++ b/src/ui/dialog/swatches.cpp
@@ -114,7 +114,7 @@ static void editGradientImpl( SPDesktop* desktop, SPGradient* gr )
bool shown = false;
if ( desktop && desktop->doc() ) {
Inkscape::Selection *selection = desktop->getSelection();
- std::vector<SPItem*> const items = selection->itemList();
+ std::vector<SPItem*> const items(selection->items().begin(), selection->items().end());
if (!items.empty()) {
SPStyle query( desktop->doc() );
int result = objects_query_fillstroke((items), &query, true);
@@ -649,12 +649,8 @@ SwatchesPanel::SwatchesPanel(gchar const* prefsPath) :
if (Glib::ustring(prefsPath) == "/dialogs/swatches") {
Gtk::Requisition sreq;
-#if WITH_GTKMM_3_0
Gtk::Requisition sreq_natural;
get_preferred_size(sreq_natural, sreq);
-#else
- sreq = size_request();
-#endif
int minHeight = 60;
if (sreq.height < minHeight) {
set_size_request(70, minHeight);
diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp
index 92bb5c605..4840b897b 100644
--- a/src/ui/dialog/symbols.cpp
+++ b/src/ui/dialog/symbols.cpp
@@ -19,14 +19,8 @@
#include <gtkmm/buttonbox.h>
#include <gtkmm/label.h>
-
-#if WITH_GTKMM_3_0
-# include <gtkmm/togglebutton.h>
-# include <gtkmm/grid.h>
-#else
-# include <gtkmm/table.h>
-#endif
-
+#include <gtkmm/togglebutton.h>
+#include <gtkmm/grid.h>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/comboboxtext.h>
#include <gtkmm/iconview.h>
@@ -116,11 +110,7 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) :
{
/******************** Table *************************/
-#if WITH_GTKMM_3_0
- Gtk::Grid *table = new Gtk::Grid();
-#else
- Gtk::Table *table = new Gtk::Table(2, 4, false);
-#endif
+ auto table = new Gtk::Grid();
// panel is a cloked Gtk::VBox
_getContents()->pack_start(*Gtk::manage(table), Gtk::PACK_EXPAND_WIDGET);
@@ -128,24 +118,12 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) :
/******************** Symbol Sets *************************/
Gtk::Label* labelSet = new Gtk::Label(_("Symbol set: "));
-
-#if WITH_GTKMM_3_0
table->attach(*Gtk::manage(labelSet),0,row,1,1);
-#else
- table->attach(*Gtk::manage(labelSet),0,1,row,row+1,Gtk::SHRINK,Gtk::SHRINK);
-#endif
-
symbolSet = new Gtk::ComboBoxText(); // Fill in later
symbolSet->append(_("Current Document"));
symbolSet->set_active_text(_("Current Document"));
-
-#if WITH_GTKMM_3_0
symbolSet->set_hexpand();
table->attach(*Gtk::manage(symbolSet),1,row,1,1);
-#else
- table->attach(*Gtk::manage(symbolSet),1,2,row,row+1,Gtk::FILL|Gtk::EXPAND,Gtk::SHRINK);
-#endif
-
sigc::connection connSet = symbolSet->signal_changed().connect(
sigc::mem_fun(*this, &SymbolsDialog::rebuild));
instanceConns.push_back(connSet);
@@ -178,14 +156,9 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) :
Gtk::ScrolledWindow *scroller = new Gtk::ScrolledWindow();
scroller->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_ALWAYS);
scroller->add(*Gtk::manage(iconView));
-
-#if WITH_GTKMM_3_0
scroller->set_hexpand();
scroller->set_vexpand();
table->attach(*Gtk::manage(scroller),0,row,2,1);
-#else
- table->attach(*Gtk::manage(scroller),0,2,row,row+1,Gtk::EXPAND|Gtk::FILL,Gtk::EXPAND|Gtk::FILL);
-#endif
++row;
@@ -194,12 +167,8 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) :
Gtk::HBox* tools = new Gtk::HBox();
//tools->set_layout( Gtk::BUTTONBOX_END );
-#if WITH_GTKMM_3_0
scroller->set_hexpand();
table->attach(*Gtk::manage(tools),0,row,2,1);
-#else
- table->attach(*Gtk::manage(tools),0,2,row,row+1,Gtk::EXPAND|Gtk::FILL,Gtk::FILL);
-#endif
addSymbol = Gtk::manage(new Gtk::Button());
addSymbol->add(*Gtk::manage(Glib::wrap(
@@ -393,11 +362,7 @@ void SymbolsDialog::revertSymbol() {
void SymbolsDialog::iconDragDataGet(const Glib::RefPtr<Gdk::DragContext>& /*context*/, Gtk::SelectionData& data, guint /*info*/, guint /*time*/)
{
-#if WITH_GTKMM_3_0
- std::vector<Gtk::TreePath> iconArray = iconView->get_selected_items();
-#else
- Gtk::IconView::ArrayHandle_TreePaths iconArray = iconView->get_selected_items();
-#endif
+ auto iconArray = iconView->get_selected_items();
if( iconArray.empty() ) {
//std::cout << " iconArray empty: huh? " << std::endl;
@@ -450,11 +415,7 @@ SPDocument* SymbolsDialog::selectedSymbols() {
Glib::ustring SymbolsDialog::selectedSymbolId() {
-#if WITH_GTKMM_3_0
- std::vector<Gtk::TreePath> iconArray = iconView->get_selected_items();
-#else
- Gtk::IconView::ArrayHandle_TreePaths iconArray = iconView->get_selected_items();
-#endif
+ auto iconArray = iconView->get_selected_items();
if( !iconArray.empty() ) {
Gtk::TreeModel::Path const & path = *iconArray.begin();
@@ -471,11 +432,6 @@ void SymbolsDialog::iconChanged() {
SPObject* symbol = symbolDocument->getObjectById(symbol_id);
if( symbol ) {
- if( symbolDocument == currentDocument ) {
- // Select the symbol on the canvas so it can be manipulated
- currentDesktop->selection->set( symbol, false );
- }
-
// Find style for use in <use>
// First look for default style stored in <symbol>
gchar const* style = symbol->getAttribute("inkscape:symbol-style");
@@ -658,8 +614,8 @@ GSList* SymbolsDialog::symbols_in_doc_recursive (SPObject *r, GSList *l)
l = g_slist_prepend (l, r);
}
- for (SPObject *child = r->firstChild(); child; child = child->getNext()) {
- l = symbols_in_doc_recursive( child, l );
+ for (auto& child: r->children) {
+ l = symbols_in_doc_recursive( &child, l );
}
return l;
@@ -680,8 +636,8 @@ GSList* SymbolsDialog::use_in_doc_recursive (SPObject *r, GSList *l)
l = g_slist_prepend (l, r);
}
- for (SPObject *child = r->firstChild(); child; child = child->getNext()) {
- l = use_in_doc_recursive( child, l );
+ for (auto& child: r->children) {
+ l = use_in_doc_recursive( &child, l );
}
return l;
diff --git a/src/ui/dialog/tags.cpp b/src/ui/dialog/tags.cpp
index 2ec710501..dfe71bddb 100644
--- a/src/ui/dialog/tags.cpp
+++ b/src/ui/dialog/tags.cpp
@@ -335,8 +335,8 @@ void TagsPanel::_objectsSelected( Selection *sel ) {
_selectedConnection.block();
_tree.get_selection()->unselect_all();
- std::vector<SPObject*> tmp=sel->list();
- for(std::vector<SPObject*>::const_iterator i=tmp.begin();i!=tmp.end();++i)
+ auto tmp = sel->objects();
+ for(auto i = tmp.begin(); i != tmp.end(); ++i)
{
SPObject *obj = *i;
_store->foreach(sigc::bind<SPObject *>( sigc::mem_fun(*this, &TagsPanel::_checkForSelected), obj));
@@ -386,26 +386,26 @@ void TagsPanel::_objectsChanged(SPObject* root)
void TagsPanel::_addObject( SPDocument* doc, SPObject* obj, Gtk::TreeModel::Row* parentRow )
{
if ( _desktop && obj ) {
- for ( SPObject *child = obj->children; child != NULL; child = child->next) {
- if (SP_IS_TAG(child))
+ for (auto& child: obj->children) {
+ if (SP_IS_TAG(&child))
{
Gtk::TreeModel::iterator iter = parentRow ? _store->prepend(parentRow->children()) : _store->prepend();
Gtk::TreeModel::Row row = *iter;
- row[_model->_colObject] = child;
+ row[_model->_colObject] = &child;
row[_model->_colParentObject] = NULL;
- row[_model->_colLabel] = child->label() ? child->label() : child->getId();
+ row[_model->_colLabel] = child.label() ? child.label() : child.getId();
row[_model->_colAddRemove] = true;
row[_model->_colAllowAddRemove] = true;
_tree.expand_to_path( _store->get_path(iter) );
- TagsPanel::ObjectWatcher *w = new TagsPanel::ObjectWatcher(this, child);
- child->getRepr()->addObserver(*w);
+ TagsPanel::ObjectWatcher *w = new TagsPanel::ObjectWatcher(this, &child);
+ child.getRepr()->addObserver(*w);
_objectWatchers.push_back(w);
- _addObject( doc, child, &row );
+ _addObject( doc, &child, &row );
}
}
- if (SP_IS_TAG(obj) && obj->children)
+ if (SP_IS_TAG(obj) && obj->firstChild())
{
Gtk::TreeModel::iterator iteritems = parentRow ? _store->append(parentRow->children()) : _store->prepend();
Gtk::TreeModel::Row rowitems = *iteritems;
@@ -416,16 +416,16 @@ void TagsPanel::_addObject( SPDocument* doc, SPObject* obj, Gtk::TreeModel::Row*
rowitems[_model->_colAllowAddRemove] = false;
_tree.expand_to_path( _store->get_path(iteritems) );
-
- for ( SPObject *child = obj->children; child != NULL; child = child->next) {
- if (SP_IS_TAG_USE(child))
+
+ for (auto& child: obj->children) {
+ if (SP_IS_TAG_USE(&child))
{
- SPItem *item = SP_TAG_USE(child)->ref->getObject();
+ SPItem *item = SP_TAG_USE(&child)->ref->getObject();
Gtk::TreeModel::iterator iter = _store->prepend(rowitems->children());
Gtk::TreeModel::Row row = *iter;
- row[_model->_colObject] = child;
+ row[_model->_colObject] = &child;
row[_model->_colParentObject] = NULL;
- row[_model->_colLabel] = item ? (item->label() ? item->label() : item->getId()) : SP_TAG_USE(child)->href;
+ row[_model->_colLabel] = item ? (item->label() ? item->label() : item->getId()) : SP_TAG_USE(&child)->href;
row[_model->_colAddRemove] = false;
row[_model->_colAllowAddRemove] = true;
@@ -434,7 +434,7 @@ void TagsPanel::_addObject( SPDocument* doc, SPObject* obj, Gtk::TreeModel::Row*
}
if (item) {
- TagsPanel::ObjectWatcher *w = new TagsPanel::ObjectWatcher(this, child, item->getRepr());
+ TagsPanel::ObjectWatcher *w = new TagsPanel::ObjectWatcher(this, &child, item->getRepr());
item->getRepr()->addObserver(*w);
_objectWatchers.push_back(w);
}
@@ -446,12 +446,11 @@ void TagsPanel::_addObject( SPDocument* doc, SPObject* obj, Gtk::TreeModel::Row*
void TagsPanel::_select_tag( SPTag * tag )
{
- for (SPObject * child = tag->children; child != NULL; child = child->next)
- {
- if (SP_IS_TAG(child)) {
- _select_tag(SP_TAG(child));
- } else if (SP_IS_TAG_USE(child)) {
- SPObject * obj = SP_TAG_USE(child)->ref->getObject();
+ for (auto& child: tag->children) {
+ if (SP_IS_TAG(&child)) {
+ _select_tag(SP_TAG(&child));
+ } else if (SP_IS_TAG_USE(&child)) {
+ SPObject * obj = SP_TAG_USE(&child)->ref->getObject();
if (obj) {
if (_desktop->selection->isEmpty()) _desktop->setCurrentLayer(obj->parent);
_desktop->selection->add(obj);
@@ -633,12 +632,12 @@ bool TagsPanel::_handleButtonEvent(GdkEventButton* event)
if (col == _tree.get_column(COL_ADD - 1) && down_at_add) {
if (SP_IS_TAG(obj)) {
bool wasadded = false;
- std::vector<SPItem*> items=_desktop->selection->itemList();
- for(std::vector<SPItem*>::const_iterator i=items.begin();i!=items.end();++i){
+ auto items= _desktop->selection->items();
+ for(auto i=items.begin();i!=items.end();++i){
SPObject *newobj = *i;
bool addchild = true;
- for ( SPObject *child = obj->children; child != NULL; child = child->next) {
- if (SP_IS_TAG_USE(child) && SP_TAG_USE(child)->ref->getObject() == newobj) {
+ for (auto& child: obj->children) {
+ if (SP_IS_TAG_USE(&child) && SP_TAG_USE(&child)->ref->getObject() == newobj) {
addchild = false;
}
}
@@ -967,12 +966,8 @@ TagsPanel::TagsPanel() :
_scroller.set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC );
_scroller.set_shadow_type(Gtk::SHADOW_IN);
Gtk::Requisition sreq;
-#if WITH_GTKMM_3_0
Gtk::Requisition sreq_natural;
_scroller.get_preferred_size(sreq_natural, sreq);
-#else
- sreq = _scroller.size_request();
-#endif
int minHeight = 70;
if (sreq.height < minHeight) {
// Set a min height to see the layers when used with Ubuntu liboverlay-scrollbar
diff --git a/src/ui/dialog/tags.h b/src/ui/dialog/tags.h
index 3576bd111..bdda22dd4 100644
--- a/src/ui/dialog/tags.h
+++ b/src/ui/dialog/tags.h
@@ -141,15 +141,9 @@ private:
Gtk::TreeView _tree;
Gtk::CellRendererText *_text_renderer;
Gtk::TreeView::Column *_name_column;
-#if WITH_GTKMM_3_0
Gtk::Box _buttonsRow;
Gtk::Box _buttonsPrimary;
Gtk::Box _buttonsSecondary;
-#else
- Gtk::HBox _buttonsRow;
- Gtk::HBox _buttonsPrimary;
- Gtk::HBox _buttonsSecondary;
-#endif
Gtk::ScrolledWindow _scroller;
Gtk::Menu _popupMenu;
Inkscape::UI::Widget::SpinButton _spinBtn;
diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp
index 6ce377419..50c6c1553 100644
--- a/src/ui/dialog/text-edit.cpp
+++ b/src/ui/dialog/text-edit.cpp
@@ -92,9 +92,7 @@ TextEdit::TextEdit()
styleButton(&align_right, _("Align right"), INKSCAPE_ICON("format-justify-right"), &align_left);
styleButton(&align_justify, _("Justify (only flowed text)"), INKSCAPE_ICON("format-justify-fill"), &align_left);
-#if WITH_GTKMM_3_0
align_sep.set_orientation(Gtk::ORIENTATION_VERTICAL);
-#endif
layout_hbox.pack_start(align_sep, false, false, 10);
@@ -102,9 +100,7 @@ TextEdit::TextEdit()
styleButton(&text_horizontal, _("Horizontal text"), INKSCAPE_ICON("format-text-direction-horizontal"), NULL);
styleButton(&text_vertical, _("Vertical text"), INKSCAPE_ICON("format-text-direction-vertical"), &text_horizontal);
-#if WITH_GTKMM_3_0
text_sep.set_orientation(Gtk::ORIENTATION_VERTICAL);
-#endif
layout_hbox.pack_start(text_sep, false, false, 10);
@@ -139,12 +135,8 @@ TextEdit::TextEdit()
gtk_widget_set_tooltip_text(startOffset, _("Text path offset"));
-#if WITH_GTKMM_3_0
- Gtk::Separator *sep = Gtk::manage(new Gtk::Separator());
+ auto sep = Gtk::manage(new Gtk::Separator());
sep->set_orientation(Gtk::ORIENTATION_VERTICAL);
-#else
- Gtk::VSeparator *sep = Gtk::manage(new Gtk::VSeparator);
-#endif
layout_hbox.pack_start(*sep, false, false, 10);
layout_hbox.pack_start(*Gtk::manage(Glib::wrap(startOffset)), false, false);
@@ -168,7 +160,6 @@ TextEdit::TextEdit()
gtk_text_view_set_wrap_mode ((GtkTextView *) text_view, GTK_WRAP_WORD);
#ifdef WITH_GTKSPELL
-#ifdef WITH_GTKMM_3_0
/*
TODO: Use computed xml:lang attribute of relevant element, if present, to specify the
language (either as 2nd arg of gtkspell_new_attach, or with explicit
@@ -180,20 +171,6 @@ TextEdit::TextEdit()
if (! gtk_spell_checker_attach(speller, GTK_TEXT_VIEW(text_view))) {
g_print("gtkspell error:\n");
}
-#else
- GError *error = NULL;
-
-/*
- TODO: Use computed xml:lang attribute of relevant element, if present, to specify the
- language (either as 2nd arg of gtkspell_new_attach, or with explicit
- gtkspell_set_language call in; see advanced.c example in gtkspell docs).
- onReadSelection looks like a suitable place.
-*/
- if (gtkspell_new_attach(GTK_TEXT_VIEW(text_view), NULL, &error) == NULL) {
- g_print("gtkspell error: %s\n", error->message);
- g_error_free(error);
- }
-#endif
#endif
gtk_widget_set_size_request (text_view, -1, 64);
@@ -436,8 +413,8 @@ SPItem *TextEdit::getSelectedTextItem (void)
if (!SP_ACTIVE_DESKTOP)
return NULL;
- std::vector<SPItem*> tmp=SP_ACTIVE_DESKTOP->getSelection()->itemList();
- for(std::vector<SPItem*>::const_iterator i=tmp.begin();i!=tmp.end();++i)
+ auto tmp= SP_ACTIVE_DESKTOP->getSelection()->items();
+ for(auto i=tmp.begin();i!=tmp.end();++i)
{
if (SP_IS_TEXT(*i) || SP_IS_FLOWTEXT(*i))
return *i;
@@ -454,8 +431,8 @@ unsigned TextEdit::getSelectedTextCount (void)
unsigned int items = 0;
- std::vector<SPItem*> tmp=SP_ACTIVE_DESKTOP->getSelection()->itemList();
- for(std::vector<SPItem*>::const_iterator i=tmp.begin();i!=tmp.end();++i)
+ auto tmp= SP_ACTIVE_DESKTOP->getSelection()->items();
+ for(auto i=tmp.begin();i!=tmp.end();++i)
{
if (SP_IS_TEXT(*i) || SP_IS_FLOWTEXT(*i))
++items;
@@ -561,11 +538,11 @@ void TextEdit::onApply()
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
unsigned items = 0;
- const std::vector<SPItem*> item_list = desktop->getSelection()->itemList();
+ auto item_list = desktop->getSelection()->items();
SPCSSAttr *css = fillTextStyle ();
sp_desktop_set_style(desktop, css, true);
- for(std::vector<SPItem*>::const_iterator i=item_list.begin();i!=item_list.end();++i){
+ for(auto i=item_list.begin();i!=item_list.end();++i){
// apply style to the reprs of all text objects in the selection
if (SP_IS_TEXT (*i)) {
diff --git a/src/ui/dialog/text-edit.h b/src/ui/dialog/text-edit.h
index cfe612268..e974874d2 100644
--- a/src/ui/dialog/text-edit.h
+++ b/src/ui/dialog/text-edit.h
@@ -198,21 +198,10 @@ private:
Gtk::RadioButton align_center;
Gtk::RadioButton align_right;
Gtk::RadioButton align_justify;
-
-#if WITH_GTKMM_3_0
Gtk::Separator align_sep;
-#else
- Gtk::VSeparator align_sep;
-#endif
-
Gtk::RadioButton text_vertical;
Gtk::RadioButton text_horizontal;
-
-#if WITH_GTKMM_3_0
Gtk::Separator text_sep;
-#else
- Gtk::VSeparator text_sep;
-#endif
GtkWidget *spacing_combo;
diff --git a/src/ui/dialog/tile.h b/src/ui/dialog/tile.h
index de1d3028b..2c29f85b8 100644
--- a/src/ui/dialog/tile.h
+++ b/src/ui/dialog/tile.h
@@ -29,12 +29,7 @@
namespace Gtk {
class Button;
-
-#if WITH_GTKMM_3_0
class Grid;
-#else
-class Table;
-#endif
}
namespace Inkscape {
diff --git a/src/ui/dialog/transformation.cpp b/src/ui/dialog/transformation.cpp
index 031bc5ae1..7f1492cd7 100644
--- a/src/ui/dialog/transformation.cpp
+++ b/src/ui/dialog/transformation.cpp
@@ -212,38 +212,20 @@ void Transformation::layoutPageMove()
//_scalar_move_vertical.set_label_image( INKSCAPE_STOCK_ARROWS_HOR );
-#if WITH_GTKMM_3_0
_page_move.table().attach(_scalar_move_horizontal, 0, 0, 2, 1);
_page_move.table().attach(_units_move, 2, 0, 1, 1);
-#else
- _page_move.table()
- .attach(_scalar_move_horizontal, 0, 2, 0, 1, Gtk::FILL, Gtk::SHRINK);
-
- _page_move.table()
- .attach(_units_move, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK);
-#endif
_scalar_move_horizontal.signal_value_changed()
.connect(sigc::mem_fun(*this, &Transformation::onMoveValueChanged));
//_scalar_move_vertical.set_label_image( INKSCAPE_STOCK_ARROWS_VER );
-#if WITH_GTKMM_3_0
_page_move.table().attach(_scalar_move_vertical, 0, 1, 2, 1);
-#else
- _page_move.table()
- .attach(_scalar_move_vertical, 0, 2, 1, 2, Gtk::FILL, Gtk::SHRINK);
-#endif
_scalar_move_vertical.signal_value_changed()
.connect(sigc::mem_fun(*this, &Transformation::onMoveValueChanged));
// Relative moves
-#if WITH_GTKMM_3_0
_page_move.table().attach(_check_move_relative, 0, 2, 2, 1);
-#else
- _page_move.table()
- .attach(_check_move_relative, 0, 2, 2, 3, Gtk::FILL, Gtk::SHRINK);
-#endif
_check_move_relative.set_active(true);
_check_move_relative.signal_toggled()
@@ -269,36 +251,18 @@ void Transformation::layoutPageScale()
_scalar_scale_vertical.setAbsoluteIsIncrement(true);
_scalar_scale_vertical.setPercentageIsIncrement(true);
-#if WITH_GTKMM_3_0
_page_scale.table().attach(_scalar_scale_horizontal, 0, 0, 2, 1);
-#else
- _page_scale.table()
- .attach(_scalar_scale_horizontal, 0, 2, 0, 1, Gtk::FILL, Gtk::SHRINK);
-#endif
_scalar_scale_horizontal.signal_value_changed()
.connect(sigc::mem_fun(*this, &Transformation::onScaleXValueChanged));
-#if WITH_GTKMM_3_0
_page_scale.table().attach(_units_scale, 2, 0, 1, 1);
_page_scale.table().attach(_scalar_scale_vertical, 0, 1, 2, 1);
-#else
- _page_scale.table()
- .attach(_units_scale, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK);
-
- _page_scale.table()
- .attach(_scalar_scale_vertical, 0, 2, 1, 2, Gtk::FILL, Gtk::SHRINK);
-#endif
_scalar_scale_vertical.signal_value_changed()
.connect(sigc::mem_fun(*this, &Transformation::onScaleYValueChanged));
-#if WITH_GTKMM_3_0
_page_scale.table().attach(_check_scale_proportional, 0, 2, 2, 1);
-#else
- _page_scale.table()
- .attach(_check_scale_proportional, 0, 2, 2, 3, Gtk::FILL, Gtk::SHRINK);
-#endif
_check_scale_proportional.set_active(false);
_check_scale_proportional.signal_toggled()
@@ -330,24 +294,10 @@ void Transformation::layoutPageRotate()
Gtk::RadioButton::Group group = _counterclockwise_rotate.get_group();
_clockwise_rotate.set_group(group);
-#if WITH_GTKMM_3_0
_page_rotate.table().attach(_scalar_rotate, 0, 0, 2, 1);
_page_rotate.table().attach(_units_rotate, 2, 0, 1, 1);
_page_rotate.table().attach(_counterclockwise_rotate, 3, 0, 1, 1);
_page_rotate.table().attach(_clockwise_rotate, 4, 0, 1, 1);
-#else
- _page_rotate.table()
- .attach(_scalar_rotate, 0, 2, 0, 1, Gtk::FILL, Gtk::SHRINK);
-
- _page_rotate.table()
- .attach(_units_rotate, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK);
-
- _page_rotate.table()
- .attach(_counterclockwise_rotate, 3, 4, 0, 1, Gtk::SHRINK, Gtk::SHRINK);
-
- _page_rotate.table()
- .attach(_clockwise_rotate, 4, 5, 0, 1, Gtk::SHRINK, Gtk::SHRINK);
-#endif
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
if (prefs->getBool("/dialogs/transformation/rotateCounterClockwise", TRUE)) {
@@ -381,26 +331,13 @@ void Transformation::layoutPageSkew()
_scalar_skew_vertical.setDigits(3);
_scalar_skew_vertical.setIncrements(0.1, 1.0);
-#if WITH_GTKMM_3_0
_page_skew.table().attach(_scalar_skew_horizontal, 0, 0, 2, 1);
-#else
- _page_skew.table()
- .attach(_scalar_skew_horizontal, 0, 2, 0, 1, Gtk::FILL, Gtk::SHRINK);
-#endif
_scalar_skew_horizontal.signal_value_changed()
.connect(sigc::mem_fun(*this, &Transformation::onSkewValueChanged));
-#if WITH_GTKMM_3_0
_page_skew.table().attach(_units_skew, 2, 0, 1, 1);
_page_skew.table().attach(_scalar_skew_vertical, 0, 1, 2, 1);
-#else
- _page_skew.table()
- .attach(_units_skew, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK);
-
- _page_skew.table()
- .attach(_scalar_skew_vertical, 0, 2, 1, 2, Gtk::FILL, Gtk::SHRINK);
-#endif
_scalar_skew_vertical.signal_value_changed()
.connect(sigc::mem_fun(*this, &Transformation::onSkewValueChanged));
@@ -418,12 +355,7 @@ void Transformation::layoutPageTransform()
_scalar_transform_a.setIncrements(0.1, 1.0);
_scalar_transform_a.setValue(1.0);
-#if WITH_GTKMM_3_0
_page_transform.table().attach(_scalar_transform_a, 0, 0, 1, 1);
-#else
- _page_transform.table()
- .attach(_scalar_transform_a, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK);
-#endif
_scalar_transform_a.signal_value_changed()
.connect(sigc::mem_fun(*this, &Transformation::onTransformValueChanged));
@@ -434,12 +366,7 @@ void Transformation::layoutPageTransform()
_scalar_transform_b.setIncrements(0.1, 1.0);
_scalar_transform_b.setValue(0.0);
-#if WITH_GTKMM_3_0
_page_transform.table().attach(_scalar_transform_b, 0, 1, 1, 1);
-#else
- _page_transform.table()
- .attach(_scalar_transform_b, 0, 1, 1, 2, Gtk::SHRINK, Gtk::SHRINK);
-#endif
_scalar_transform_b.signal_value_changed()
.connect(sigc::mem_fun(*this, &Transformation::onTransformValueChanged));
@@ -450,12 +377,7 @@ void Transformation::layoutPageTransform()
_scalar_transform_c.setIncrements(0.1, 1.0);
_scalar_transform_c.setValue(0.0);
-#if WITH_GTKMM_3_0
_page_transform.table().attach(_scalar_transform_c, 1, 0, 1, 1);
-#else
- _page_transform.table()
- .attach(_scalar_transform_c, 1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK);
-#endif
_scalar_transform_c.signal_value_changed()
.connect(sigc::mem_fun(*this, &Transformation::onTransformValueChanged));
@@ -467,12 +389,7 @@ void Transformation::layoutPageTransform()
_scalar_transform_d.setIncrements(0.1, 1.0);
_scalar_transform_d.setValue(1.0);
-#if WITH_GTKMM_3_0
_page_transform.table().attach(_scalar_transform_d, 1, 1, 1, 1);
-#else
- _page_transform.table()
- .attach(_scalar_transform_d, 1, 2, 1, 2, Gtk::SHRINK, Gtk::SHRINK);
-#endif
_scalar_transform_d.signal_value_changed()
.connect(sigc::mem_fun(*this, &Transformation::onTransformValueChanged));
@@ -484,12 +401,7 @@ void Transformation::layoutPageTransform()
_scalar_transform_e.setIncrements(0.1, 1.0);
_scalar_transform_e.setValue(0.0);
-#if WITH_GTKMM_3_0
_page_transform.table().attach(_scalar_transform_e, 2, 0, 1, 1);
-#else
- _page_transform.table()
- .attach(_scalar_transform_e, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK);
-#endif
_scalar_transform_e.signal_value_changed()
.connect(sigc::mem_fun(*this, &Transformation::onTransformValueChanged));
@@ -501,23 +413,13 @@ void Transformation::layoutPageTransform()
_scalar_transform_f.setIncrements(0.1, 1.0);
_scalar_transform_f.setValue(0.0);
-#if WITH_GTKMM_3_0
_page_transform.table().attach(_scalar_transform_f, 2, 1, 1, 1);
-#else
- _page_transform.table()
- .attach(_scalar_transform_f, 2, 3, 1, 2, Gtk::SHRINK, Gtk::SHRINK);
-#endif
_scalar_transform_f.signal_value_changed()
.connect(sigc::mem_fun(*this, &Transformation::onTransformValueChanged));
// Edit existing matrix
-#if WITH_GTKMM_3_0
_page_transform.table().attach(_check_replace_matrix, 0, 2, 2, 1);
-#else
- _page_transform.table()
- .attach(_check_replace_matrix, 0, 2, 2, 3, Gtk::FILL, Gtk::SHRINK);
-#endif
_check_replace_matrix.set_active(false);
_check_replace_matrix.signal_toggled()
@@ -564,11 +466,7 @@ void Transformation::updateSelection(PageType page, Inkscape::Selection *selecti
selection && !selection->isEmpty());
}
-#if WITH_GTKMM_3_0
void Transformation::onSwitchPage(Gtk::Widget * /*page*/, guint pagenum)
-#else
-void Transformation::onSwitchPage(GtkNotebookPage * /*page*/, guint pagenum)
-#endif
{
updateSelection((PageType)pagenum, getDesktop()->getSelection());
}
@@ -646,7 +544,7 @@ void Transformation::updatePageTransform(Inkscape::Selection *selection)
{
if (selection && !selection->isEmpty()) {
if (_check_replace_matrix.get_active()) {
- Geom::Affine current (selection->itemList()[0]->transform); // take from the first item in selection
+ Geom::Affine current (selection->items().front()->transform); // take from the first item in selection
Geom::Affine new_displayed = current;
@@ -719,19 +617,19 @@ void Transformation::applyPageMove(Inkscape::Selection *selection)
if (!prefs->getBool("/dialogs/transformation/applyseparately")) {
// move selection as a whole
if (_check_move_relative.get_active()) {
- sp_selection_move_relative(selection, x, y);
+ sp_object_set_move_relative(selection, x, y);
} else {
Geom::OptRect bbox = selection->preferredBounds();
if (bbox) {
- sp_selection_move_relative(selection,
- x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]);
+ sp_object_set_move_relative(selection,
+ x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]);
}
}
} else {
if (_check_move_relative.get_active()) {
// shift each object relatively to the previous one
- std::vector<SPItem*> selected(selection->itemList());
+ std::vector<SPItem*> selected(selection->items().begin(), selection->items().end());
if (selected.empty()) return;
if (fabs(x) > 1e-6) {
@@ -787,8 +685,8 @@ void Transformation::applyPageMove(Inkscape::Selection *selection)
} else {
Geom::OptRect bbox = selection->preferredBounds();
if (bbox) {
- sp_selection_move_relative(selection,
- x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]);
+ sp_object_set_move_relative(selection,
+ x - bbox->min()[Geom::X], y - bbox->min()[Geom::Y]);
}
}
}
@@ -806,8 +704,8 @@ void Transformation::applyPageScale(Inkscape::Selection *selection)
bool transform_stroke = prefs->getBool("/options/transform/stroke", true);
bool preserve = prefs->getBool("/options/preservetransform/value", false);
if (prefs->getBool("/dialogs/transformation/applyseparately")) {
- std::vector<SPItem*> tmp=selection->itemList();
- for(std::vector<SPItem*>::const_iterator i=tmp.begin();i!=tmp.end();++i){
+ auto tmp= selection->items();
+ for(auto i=tmp.begin();i!=tmp.end();++i){
SPItem *item = *i;
Geom::OptRect bbox_pref = item->desktopPreferredBounds();
Geom::OptRect bbox_geom = item->desktopGeometricBounds();
@@ -852,7 +750,7 @@ void Transformation::applyPageScale(Inkscape::Selection *selection)
double y1 = bbox_pref->midpoint()[Geom::Y] + new_height/2;
Geom::Affine scaler = get_scale_transform_for_variable_stroke (*bbox_pref, *bbox_geom, transform_stroke, preserve, x0, y0, x1, y1);
- sp_selection_apply_affine(selection, scaler);
+ sp_object_set_apply_affine(selection, scaler);
}
}
@@ -870,15 +768,15 @@ void Transformation::applyPageRotate(Inkscape::Selection *selection)
}
if (prefs->getBool("/dialogs/transformation/applyseparately")) {
- std::vector<SPItem*> tmp=selection->itemList();
- for(std::vector<SPItem*>::const_iterator i=tmp.begin();i!=tmp.end();++i){
+ auto tmp= selection->items();
+ for(auto i=tmp.begin();i!=tmp.end();++i){
SPItem *item = *i;
sp_item_rotate_rel(item, Geom::Rotate (angle*M_PI/180.0));
}
} else {
boost::optional<Geom::Point> center = selection->center();
if (center) {
- sp_selection_rotate_relative(selection, *center, angle);
+ sp_object_set_rotate_relative(selection, *center, angle);
}
}
@@ -890,8 +788,8 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection)
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
if (prefs->getBool("/dialogs/transformation/applyseparately")) {
- std::vector<SPItem*> items=selection->itemList();
- for(std::vector<SPItem*>::const_iterator i = items.begin();i!=items.end();++i){
+ auto items = selection->items();
+ for(auto i = items.begin();i!=items.end();++i){
SPItem *item = *i;
if (!_units_skew.isAbsolute()) { // percentage
@@ -945,7 +843,7 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection)
getDesktop()->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>."));
return;
}
- sp_selection_skew_relative(selection, *center, 0.01*skewX, 0.01*skewY);
+ sp_object_set_skew_relative(selection, *center, 0.01 * skewX, 0.01 * skewY);
} else if (_units_skew.isRadial()) { //deg or rad
double angleX = _scalar_skew_horizontal.getValue("rad");
double angleY = _scalar_skew_vertical.getValue("rad");
@@ -958,7 +856,7 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection)
}
double skewX = tan(-angleX);
double skewY = tan(angleY);
- sp_selection_skew_relative(selection, *center, skewX, skewY);
+ sp_object_set_skew_relative(selection, *center, skewX, skewY);
} else { // absolute displacement
double skewX = _scalar_skew_horizontal.getValue("px");
double skewY = _scalar_skew_vertical.getValue("px");
@@ -966,7 +864,7 @@ void Transformation::applyPageSkew(Inkscape::Selection *selection)
getDesktop()->getMessageStack()->flash(Inkscape::WARNING_MESSAGE, _("Transform matrix is singular, <b>not used</b>."));
return;
}
- sp_selection_skew_relative(selection, *center, skewX/height, skewY/width);
+ sp_object_set_skew_relative(selection, *center, skewX / height, skewY / width);
}
}
}
@@ -992,14 +890,14 @@ void Transformation::applyPageTransform(Inkscape::Selection *selection)
}
if (_check_replace_matrix.get_active()) {
- std::vector<SPItem*> tmp=selection->itemList();
- for(std::vector<SPItem*>::const_iterator i=tmp.begin();i!=tmp.end();++i){
+ auto tmp = selection->items();
+ for(auto i=tmp.begin();i!=tmp.end();++i){
SPItem *item = *i;
item->set_item_transform(displayed);
item->updateRepr();
}
} else {
- sp_selection_apply_affine(selection, displayed); // post-multiply each object's transform
+ sp_object_set_apply_affine(selection, displayed); // post-multiply each object's transform
}
DocumentUndo::done(selection->desktop()->getDocument(), SP_VERB_DIALOG_TRANSFORM,
@@ -1145,7 +1043,7 @@ void Transformation::onReplaceMatrixToggled()
double f = _scalar_transform_f.getValue();
Geom::Affine displayed (a, b, c, d, e, f);
- Geom::Affine current = selection->itemList()[0]->transform; // take from the first item in selection
+ Geom::Affine current = selection->items().front()->transform; // take from the first item in selection
Geom::Affine new_displayed;
if (_check_replace_matrix.get_active()) {
diff --git a/src/ui/dialog/transformation.h b/src/ui/dialog/transformation.h
index 89aa95d90..9595e87bc 100644
--- a/src/ui/dialog/transformation.h
+++ b/src/ui/dialog/transformation.h
@@ -169,11 +169,7 @@ protected:
virtual void _apply();
void presentPage(PageType page);
-#if WITH_GTKMM_3_0
void onSwitchPage(Gtk::Widget *page, guint pagenum);
-#else
- void onSwitchPage(GtkNotebookPage *page, guint pagenum);
-#endif
/**
* Callbacks for when a user changes values on the panels
diff --git a/src/ui/dialog/undo-history.cpp b/src/ui/dialog/undo-history.cpp
index 38fab8f07..53aa7e6ff 100644
--- a/src/ui/dialog/undo-history.cpp
+++ b/src/ui/dialog/undo-history.cpp
@@ -31,20 +31,11 @@ namespace UI {
namespace Dialog {
/* Rendering functions for custom cell renderers */
-#if WITH_GTKMM_3_0
void CellRendererSPIcon::render_vfunc(const Cairo::RefPtr<Cairo::Context>& cr,
Gtk::Widget& widget,
const Gdk::Rectangle& background_area,
const Gdk::Rectangle& cell_area,
Gtk::CellRendererState flags)
-#else
-void CellRendererSPIcon::render_vfunc(const Glib::RefPtr<Gdk::Drawable>& window,
- Gtk::Widget& widget,
- const Gdk::Rectangle& background_area,
- const Gdk::Rectangle& cell_area,
- const Gdk::Rectangle& expose_area,
- Gtk::CellRendererState flags)
-#endif
{
// if this event type doesn't have an icon...
if ( !Inkscape::Verb::get(_property_event_type)->get_image() ) return;
@@ -63,13 +54,8 @@ void CellRendererSPIcon::render_vfunc(const Glib::RefPtr<Gdk::Drawable>& window,
sp_icon_fetch_pixbuf(sp_icon);
_property_icon = Glib::wrap(sp_icon->pb, true);
} else if ( GTK_IS_IMAGE(icon->gobj()) ) {
-#if WITH_GTKMM_3_0
_property_icon = Gtk::Invisible().render_icon_pixbuf(Gtk::StockID(image),
Gtk::ICON_SIZE_MENU);
-#else
- _property_icon = Gtk::Invisible().render_icon(Gtk::StockID(image),
- Gtk::ICON_SIZE_MENU);
-#endif
} else {
delete icon;
return;
@@ -83,42 +69,23 @@ void CellRendererSPIcon::render_vfunc(const Glib::RefPtr<Gdk::Drawable>& window,
property_pixbuf() = _icon_cache[_property_event_type];
}
-#if WITH_GTKMM_3_0
Gtk::CellRendererPixbuf::render_vfunc(cr, widget, background_area,
cell_area, flags);
-#else
- Gtk::CellRendererPixbuf::render_vfunc(window, widget, background_area,
- cell_area, expose_area, flags);
-#endif
}
-#if WITH_GTKMM_3_0
void CellRendererInt::render_vfunc(const Cairo::RefPtr<Cairo::Context>& cr,
Gtk::Widget& widget,
const Gdk::Rectangle& background_area,
const Gdk::Rectangle& cell_area,
Gtk::CellRendererState flags)
-#else
-void CellRendererInt::render_vfunc(const Glib::RefPtr<Gdk::Drawable>& window,
- Gtk::Widget& widget,
- const Gdk::Rectangle& background_area,
- const Gdk::Rectangle& cell_area,
- const Gdk::Rectangle& expose_area,
- Gtk::CellRendererState flags)
-#endif
{
if( _filter(_property_number) ) {
std::ostringstream s;
s << _property_number << std::flush;
property_text() = s.str();
-#if WITH_GTKMM_3_0
Gtk::CellRendererText::render_vfunc(cr, widget, background_area,
cell_area, flags);
-#else
- Gtk::CellRendererText::render_vfunc(window, widget, background_area,
- cell_area, expose_area, flags);
-#endif
}
}
diff --git a/src/ui/dialog/undo-history.h b/src/ui/dialog/undo-history.h
index b0cc283cf..48929a0d0 100644
--- a/src/ui/dialog/undo-history.h
+++ b/src/ui/dialog/undo-history.h
@@ -50,20 +50,11 @@ public:
property_event_type() { return _property_event_type.get_proxy(); }
protected:
-#if WITH_GTKMM_3_0
virtual void render_vfunc(const Cairo::RefPtr<Cairo::Context>& cr,
Gtk::Widget& widget,
const Gdk::Rectangle& background_area,
const Gdk::Rectangle& cell_area,
Gtk::CellRendererState flags);
-#else
- virtual void render_vfunc(const Glib::RefPtr<Gdk::Drawable>& window,
- Gtk::Widget& widget,
- const Gdk::Rectangle& background_area,
- const Gdk::Rectangle& cell_area,
- const Gdk::Rectangle& expose_area,
- Gtk::CellRendererState flags);
-#endif
private:
Glib::Property<Glib::RefPtr<Gdk::Pixbuf> > _property_icon;
@@ -95,20 +86,11 @@ public:
static const Filter& no_filter;
protected:
-#if WITH_GTKMM_3_0
virtual void render_vfunc(const Cairo::RefPtr<Cairo::Context>& cr,
Gtk::Widget& widget,
const Gdk::Rectangle& background_area,
const Gdk::Rectangle& cell_area,
Gtk::CellRendererState flags);
-#else
- virtual void render_vfunc(const Glib::RefPtr<Gdk::Drawable>& window,
- Gtk::Widget& widget,
- const Gdk::Rectangle& background_area,
- const Gdk::Rectangle& cell_area,
- const Gdk::Rectangle& expose_area,
- Gtk::CellRendererState flags);
-#endif
private:
diff --git a/src/ui/dialog/xml-tree.cpp b/src/ui/dialog/xml-tree.cpp
index c2711bb02..eae33ff83 100644
--- a/src/ui/dialog/xml-tree.cpp
+++ b/src/ui/dialog/xml-tree.cpp
@@ -74,11 +74,7 @@ XmlTree::XmlTree (void) :
xml_attribute_delete_button (_("Delete attribute")),
text_container (),
attr_container (),
-#if WITH_GTKMM_3_0
attr_subpaned_container(Gtk::ORIENTATION_VERTICAL),
-#else
- attr_subpaned_container(),
-#endif
set_attr (_("Set")),
new_window(NULL)
{
@@ -95,9 +91,7 @@ XmlTree::XmlTree (void) :
status.set_alignment( 0.0, 0.5);
status.set_size_request(1, -1);
status.set_markup("");
-#if WITH_GTKMM_3_0
status.set_line_wrap(true);
-#endif
status_box.pack_start( status, TRUE, TRUE, 0);
contents->pack_end(status_box, false, false, 2);
@@ -876,31 +870,19 @@ void XmlTree::cmd_new_element_node()
g_signal_connect(G_OBJECT(new_window), "destroy", gtk_main_quit, NULL);
g_signal_connect(G_OBJECT(new_window), "key-press-event", G_CALLBACK(quit_on_esc), new_window);
-#if GTK_CHECK_VERSION(3,0,0)
vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
gtk_box_set_homogeneous(GTK_BOX(vbox), FALSE);
-#else
- vbox = gtk_vbox_new(FALSE, 4);
-#endif
gtk_container_add(GTK_CONTAINER(new_window), vbox);
name_entry = new Gtk::Entry();
gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(name_entry->gobj()), FALSE, TRUE, 0);
-#if GTK_CHECK_VERSION(3,0,0)
sep = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL);
-#else
- sep = gtk_hseparator_new();
-#endif
gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, TRUE, 0);
-#if GTK_CHECK_VERSION(3,0,0)
bbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
-#else
- bbox = gtk_hbutton_box_new();
-#endif
gtk_container_set_border_width(GTK_CONTAINER(bbox), 4);
gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
diff --git a/src/ui/dialog/xml-tree.h b/src/ui/dialog/xml-tree.h
index 58ef3aef8..a4c3fffcb 100644
--- a/src/ui/dialog/xml-tree.h
+++ b/src/ui/dialog/xml-tree.h
@@ -218,13 +218,7 @@ private:
Gtk::Button *create_button;
Gtk::Entry *name_entry;
-
-#if WITH_GTKMM_3_0
Gtk::Paned paned;
-#else
- Gtk::HPaned paned;
-#endif
-
Gtk::VBox left_box;
Gtk::VBox right_box;
Gtk::HBox status_box;
@@ -248,12 +242,7 @@ private:
Gtk::ScrolledWindow text_container;
Gtk::HBox attr_hbox;
Gtk::VBox attr_container;
-
-#if WITH_GTKMM_3_0
Gtk::Paned attr_subpaned_container;
-#else
- Gtk::VPaned attr_subpaned_container;
-#endif
Gtk::Button set_attr;