diff options
| author | Alex Valavanis <valavanisalex@gmail.com> | 2016-07-28 15:16:18 +0000 |
|---|---|---|
| committer | Alex Valavanis <valavanisalex@gmail.com> | 2016-07-28 15:16:18 +0000 |
| commit | dcd91f59f597ab4af07cee5929ce0e2e1f9104d5 (patch) | |
| tree | 2cf4e55d031d71cc18a213d76d15a4a5a8128fe5 /src/ui | |
| parent | ui/widgets: Drop GTK2 fallbacks (diff) | |
| download | inkscape-dcd91f59f597ab4af07cee5929ce0e2e1f9104d5.tar.gz inkscape-dcd91f59f597ab4af07cee5929ce0e2e1f9104d5.zip | |
Drop remaining GTKMM 2 fallback support
(bzr r15023.2.7)
Diffstat (limited to 'src/ui')
67 files changed, 129 insertions, 2110 deletions
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index d581dbf7e..6b24c5a2d 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -1300,11 +1300,7 @@ Geom::Scale ClipboardManagerImpl::_getScale(SPDesktop *desktop, Geom::Point cons */ Glib::ustring ClipboardManagerImpl::_getBestTarget() { -#if WITH_GTKMM_3_0 - std::vector<Glib::ustring> targets = _clipboard->wait_for_targets(); -#else - std::list<Glib::ustring> targets = _clipboard->wait_for_targets(); -#endif + auto targets = _clipboard->wait_for_targets(); // clipboard target debugging snippet /* @@ -1363,12 +1359,7 @@ void ClipboardManagerImpl::_setClipboardTargets() { Inkscape::Extension::DB::OutputList outlist; Inkscape::Extension::db.get_output_list(outlist); - -#if WITH_GTKMM_3_0 std::vector<Gtk::TargetEntry> target_list; -#else - std::list<Gtk::TargetEntry> target_list; -#endif bool plaintextSet = false; for (Inkscape::Extension::DB::OutputList::const_iterator out = outlist.begin() ; out != outlist.end() ; ++out) { diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp index 6276d3391..ffb46fd1b 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,20 +126,12 @@ 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 + // allow window to shrink set_size_request(0, 0); set_default_size(requisition.width, requisition.height); diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index 8f87932b8..971275e59 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -61,11 +61,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), @@ -81,11 +77,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 } @@ -447,11 +439,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); @@ -473,17 +461,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 : @@ -762,11 +743,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), @@ -939,19 +916,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) @@ -1316,13 +1285,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 b727c87ee..da00b7b00 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -91,12 +91,8 @@ CloneTiler::CloneTiler () : 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); @@ -651,12 +647,8 @@ CloneTiler::CloneTiler () : GtkWidget *vb = clonetiler_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); @@ -777,12 +769,8 @@ CloneTiler::CloneTiler () : { GtkWidget *vb = clonetiler_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")); @@ -797,12 +785,8 @@ CloneTiler::CloneTiler () : } { -#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); @@ -811,15 +795,9 @@ CloneTiler::CloneTiler () : 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); @@ -895,15 +873,9 @@ 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); @@ -944,15 +916,9 @@ 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); { @@ -1000,12 +966,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:")); @@ -1013,42 +975,24 @@ 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); + 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 g_object_set_data (G_OBJECT(dlg), "rowscols", (gpointer) hb); { -#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); @@ -1061,28 +1005,16 @@ CloneTiler::CloneTiler () : { GtkWidget *l = gtk_label_new (""); gtk_label_set_markup (GTK_LABEL(l), "×"); -#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); } { -#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); @@ -1096,12 +1028,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 g_object_set_data (G_OBJECT(dlg), "widthheight", (gpointer) hb); // unitmenu @@ -1112,59 +1040,39 @@ CloneTiler::CloneTiler () : { // 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_signal_connect(G_OBJECT(fill_width->gobj()), "value_changed", G_CALLBACK(clonetiler_fill_width_changed), unit_menu); } { GtkWidget *l = gtk_label_new (""); gtk_label_set_markup (GTK_LABEL(l), "×"); -#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); } { // 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); @@ -1206,12 +1114,8 @@ CloneTiler::CloneTiler () : // Use saved pos { -#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_check_button_new_with_label (_("Use saved size and position of the tile")); @@ -1226,12 +1130,8 @@ CloneTiler::CloneTiler () : // 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); @@ -1240,12 +1140,8 @@ CloneTiler::CloneTiler () : // 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); { @@ -1259,12 +1155,8 @@ CloneTiler::CloneTiler () : } { // 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); { @@ -2673,12 +2565,8 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg) GtkWidget * CloneTiler::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; @@ -2693,12 +2581,8 @@ void CloneTiler::clonetiler_checkbox_toggled(GtkToggleButton *tb, gpointer *data GtkWidget * CloneTiler::clonetiler_checkbox(const char *tip, const char *attr) { -#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 GtkWidget *b = gtk_check_button_new (); gtk_widget_set_tooltip_text (b, tip); @@ -2725,44 +2609,23 @@ void CloneTiler::clonetiler_value_changed(GtkAdjustment *adj, gpointer data) GtkWidget * CloneTiler::clonetiler_spinbox(const char *tip, const char *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); + 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 { -#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 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 sb->set_tooltip_text (tip); sb->set_width_chars (5); @@ -2786,12 +2649,8 @@ 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); } @@ -2867,38 +2726,22 @@ void CloneTiler::clonetiler_reset(GtkWidget */*widget*/, GtkWidget *dlg) void CloneTiler::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) { -#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); @@ -2911,12 +2754,8 @@ GtkWidget * CloneTiler::clonetiler_table_x_y_rand(int values) } { -#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); diff --git a/src/ui/dialog/clonetiler.h b/src/ui/dialog/clonetiler.h index a8f1df0a0..e76ad028e 100644 --- a/src/ui/dialog/clonetiler.h +++ b/src/ui/dialog/clonetiler.h @@ -121,13 +121,8 @@ private: 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; diff --git a/src/ui/dialog/debug.cpp b/src/ui/dialog/debug.cpp index d127261c0..48d7abbdd 100644 --- a/src/ui/dialog/debug.cpp +++ b/src/ui/dialog/debug.cpp @@ -68,12 +68,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 da1facc08..602c3d6be 100644 --- a/src/ui/dialog/document-metadata.cpp +++ b/src/ui/dialog/document-metadata.cpp @@ -61,12 +61,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); @@ -75,15 +70,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")); @@ -126,12 +116,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; @@ -143,7 +129,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); @@ -153,11 +138,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 } } @@ -167,31 +147,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 589973162..33f134c11 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -223,25 +223,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; @@ -252,7 +243,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); @@ -263,11 +253,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) @@ -276,12 +262,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) @@ -290,32 +272,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; @@ -685,52 +656,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); @@ -744,11 +698,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); @@ -815,41 +764,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); @@ -863,11 +798,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); @@ -888,12 +818,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); @@ -902,47 +826,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++; @@ -958,24 +864,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); @@ -1037,12 +934,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; @@ -1053,8 +946,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); @@ -1064,11 +955,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 } } @@ -1077,11 +963,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); @@ -1099,12 +981,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; @@ -1112,17 +990,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(){ 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 2fb5f9e3b..5e7c68985 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -29,11 +29,7 @@ #include <gtkmm/spinbutton.h> #include <gtkmm/stock.h> #include <gtkmm/stockid.h> -#if WITH_GTKMM_3_0 -# include <gtkmm/grid.h> -#else -# include <gtkmm/table.h> -#endif +#include <gtkmm/grid.h> #include <gtkmm/togglebutton.h> #include <gtkmm/widget.h> @@ -218,15 +214,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, @@ -268,15 +258,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); @@ -484,27 +468,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; @@ -512,28 +483,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); @@ -546,15 +506,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); @@ -932,11 +886,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 ); @@ -1357,11 +1307,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; @@ -1521,11 +1467,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; @@ -1564,11 +1506,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; @@ -1875,11 +1813,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); @@ -1897,11 +1831,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(); @@ -1920,11 +1850,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"); @@ -1946,11 +1872,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/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 8141f7696..923993514 100644 --- a/src/ui/dialog/fill-and-stroke.cpp +++ b/src/ui/dialog/fill-and-stroke.cpp @@ -111,11 +111,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); } @@ -132,24 +128,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 @@ -158,12 +144,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 d3ad5d1da..acf230b7f 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -22,9 +22,7 @@ #include "dialog-manager.h" #include <gtkmm/imagemenuitem.h> -#if GTK_CHECK_VERSION(3,0,0) -# include <gdkmm/devicemanager.h> -#endif +#include <gdkmm/devicemanager.h> #include "ui/widget/spinbutton.h" @@ -319,15 +317,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. @@ -336,13 +328,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(); } @@ -359,15 +346,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 } }; @@ -1730,7 +1711,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 @@ -1764,27 +1744,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) @@ -1792,13 +1751,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); @@ -1961,25 +1915,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 @@ -1987,7 +1925,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); @@ -2005,9 +1943,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(); @@ -2026,25 +1961,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(); @@ -2061,24 +1986,16 @@ 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(); + auto display = get_bin_window()->get_display(); + auto dm = display->get_device_manager(); + auto device = dm->get_client_pointer(); get_bin_window()->get_device_position(device, mx, my, mask); -#else - get_bin_window()->get_pointer(mx, my, mask); -#endif // 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); @@ -2101,17 +2018,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); @@ -2137,17 +2047,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); @@ -2170,17 +2073,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); @@ -2216,8 +2112,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); @@ -2227,9 +2122,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); @@ -2245,11 +2137,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); @@ -2669,8 +2557,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) @@ -2679,25 +2566,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) @@ -2706,18 +2581,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(); } @@ -2759,13 +2622,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); 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.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 55ef0c5bb..20209e2c9 100644 --- a/src/ui/dialog/floating-behavior.cpp +++ b/src/ui/dialog/floating-behavior.cpp @@ -140,11 +140,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(); } @@ -155,12 +151,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/glyphs.cpp b/src/ui/dialog/glyphs.cpp index 56b001291..1453797de 100644 --- a/src/ui/dialog/glyphs.cpp +++ b/src/ui/dialog/glyphs.cpp @@ -19,13 +19,7 @@ #include <gtkmm/label.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 <gtkmm/grid.h> #include <gtkmm/treemodelcolumn.h> #include <gtkmm/widget.h> @@ -342,12 +336,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; @@ -360,29 +349,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) @@ -396,14 +372,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++; @@ -411,15 +381,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 ) { @@ -431,15 +394,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++; @@ -462,16 +418,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++; @@ -501,15 +450,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++; @@ -591,12 +533,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(); @@ -641,11 +578,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(" "); diff --git a/src/ui/dialog/grid-arrange-tab.cpp b/src/ui/dialog/grid-arrange-tab.cpp index 639e463ea..eaf4e8ec0 100644 --- a/src/ui/dialog/grid-arrange-tab.cpp +++ b/src/ui/dialog/grid-arrange-tab.cpp @@ -19,12 +19,7 @@ #include <gtk/gtk.h> //for GTK_RESPONSE* types #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 <2geom/transforms.h> @@ -570,11 +565,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; @@ -736,20 +727,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 556d77a28..eb0fce978 100644 --- a/src/ui/dialog/guides.cpp +++ b/src/ui/dialog/guides.cpp @@ -124,13 +124,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); @@ -171,15 +166,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); @@ -189,7 +178,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); @@ -207,19 +195,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 */ @@ -238,7 +213,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(); @@ -252,22 +226,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(); @@ -284,18 +248,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); @@ -348,15 +300,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.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 6dd62d3bb..8a69ef8e1 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -86,12 +86,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; @@ -863,17 +859,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) ); @@ -1043,13 +1032,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); @@ -1594,31 +1578,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); @@ -2051,12 +2023,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 8343cd6fe..e731ed3ff 100644 --- a/src/ui/dialog/input.cpp +++ b/src/ui/dialog/input.cpp @@ -33,13 +33,7 @@ #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/grid.h> #include <gtkmm/treemodel.h> #include <gtkmm/treemodelcolumn.h> #include <gtkmm/treestore.h> @@ -431,13 +425,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; @@ -498,27 +486,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; @@ -528,13 +503,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; @@ -620,20 +589,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() { @@ -655,27 +615,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; @@ -686,13 +635,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; @@ -730,45 +673,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++; @@ -786,22 +701,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++; @@ -811,17 +715,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++; @@ -837,13 +732,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++; @@ -857,18 +746,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++; @@ -1150,12 +1030,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); @@ -1939,7 +1814,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: @@ -1947,7 +1821,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 5d550ed48..6f5def886 100644 --- a/src/ui/dialog/layer-properties.cpp +++ b/src/ui/dialog/layer-properties.cpp @@ -40,22 +40,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); @@ -64,12 +57,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); @@ -166,10 +153,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); @@ -185,7 +168,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(); @@ -194,12 +176,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(); } @@ -254,16 +230,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 1c022ecad..77ced6d71 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -866,12 +866,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 c558eddaf..4346ebd3d 100644 --- a/src/ui/dialog/livepatheffect-add.cpp +++ b/src/ui/dialog/livepatheffect-add.cpp @@ -74,11 +74,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 422ec10ae..f19652746 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -134,13 +134,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 74ec7111e..aed57871a 100644 --- a/src/ui/dialog/new-from-template.cpp +++ b/src/ui/dialog/new-from-template.cpp @@ -31,20 +31,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 be46129c4..9e10bbbeb 100644 --- a/src/ui/dialog/object-properties.cpp +++ b/src/ui/dialog/object-properties.cpp @@ -40,12 +40,7 @@ #include "xml/repr.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 { @@ -106,16 +101,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); @@ -124,29 +112,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); @@ -160,29 +133,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); @@ -194,28 +154,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: @@ -244,14 +192,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" ); @@ -259,14 +201,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); @@ -278,60 +214,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 27694a9ac..e4b48d10b 100644 --- a/src/ui/dialog/objects.cpp +++ b/src/ui/dialog/objects.cpp @@ -511,11 +511,7 @@ 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()) @@ -1481,11 +1477,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); } } @@ -1628,11 +1620,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), @@ -1762,12 +1750,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 @@ -1800,13 +1784,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 f2ee79d06..9e9037fdd 100644 --- a/src/ui/dialog/ocaldialogs.cpp +++ b/src/ui/dialog/ocaldialogs.cpp @@ -316,27 +316,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(); @@ -344,27 +327,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; @@ -434,11 +404,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(); } @@ -482,15 +448,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 @@ -499,16 +456,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(); @@ -573,57 +524,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 @@ -632,23 +538,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; } @@ -665,23 +560,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) { @@ -692,16 +574,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); } @@ -1179,16 +1054,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); } @@ -1208,33 +1076,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/polar-arrange-tab.cpp b/src/ui/dialog/polar-arrange-tab.cpp index 5ec1285c1..5c588ebac 100644 --- a/src/ui/dialog/polar-arrange-tab.cpp +++ b/src/ui/dialog/polar-arrange-tab.cpp @@ -33,11 +33,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), @@ -81,11 +77,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); @@ -94,20 +86,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); @@ -116,20 +99,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); @@ -138,13 +112,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")); 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.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 08ebbcf14..58ac62cb0 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -890,12 +890,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 6577c8d4e..964e844b2 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -658,12 +658,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 06c17611f..597f90e95 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -20,14 +20,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> @@ -121,11 +115,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); @@ -133,24 +123,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); @@ -183,14 +161,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; @@ -199,12 +172,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( @@ -398,11 +367,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; @@ -455,11 +420,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(); diff --git a/src/ui/dialog/tags.cpp b/src/ui/dialog/tags.cpp index c99c1bff3..be91ca8af 100644 --- a/src/ui/dialog/tags.cpp +++ b/src/ui/dialog/tags.cpp @@ -980,12 +980,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 c01da8864..83b636ae2 100644 --- a/src/ui/dialog/text-edit.cpp +++ b/src/ui/dialog/text-edit.cpp @@ -99,9 +99,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); @@ -109,9 +107,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); @@ -146,12 +142,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); @@ -175,7 +167,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 @@ -187,20 +178,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); 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 b7638e8c1..72133f448 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -216,38 +216,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() @@ -273,36 +255,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() @@ -334,24 +298,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)) { @@ -385,26 +335,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)); @@ -422,12 +359,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)); @@ -438,12 +370,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)); @@ -454,12 +381,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)); @@ -471,12 +393,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)); @@ -488,12 +405,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)); @@ -505,23 +417,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() @@ -568,11 +470,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()); } 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 a50a169eb..e7e68ed87 100644 --- a/src/ui/dialog/undo-history.cpp +++ b/src/ui/dialog/undo-history.cpp @@ -35,20 +35,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; @@ -67,13 +58,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; @@ -87,42 +73,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 99a4acc69..714d59c50 100644 --- a/src/ui/dialog/xml-tree.cpp +++ b/src/ui/dialog/xml-tree.cpp @@ -79,11 +79,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) { @@ -100,9 +96,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); @@ -881,31 +875,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; diff --git a/src/ui/previewholder.cpp b/src/ui/previewholder.cpp index 5e75179a3..8336467c4 100644 --- a/src/ui/previewholder.cpp +++ b/src/ui/previewholder.cpp @@ -18,12 +18,7 @@ #include <gtkmm/sizegroup.h> #include <gtkmm/scrollbar.h> #include <gtkmm/adjustment.h> - -#if WITH_GTKMM_3_0 -# include <gtkmm/grid.h> -#else -# include <gtkmm/table.h> -#endif +#include <gtkmm/grid.h> #define COLUMNS_FOR_SMALL 16 #define COLUMNS_FOR_LARGE 8 @@ -55,7 +50,6 @@ PreviewHolder::PreviewHolder() : ((Gtk::ScrolledWindow *)_scroller)->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); -#if WITH_GTKMM_3_0 _insides = Gtk::manage(new Gtk::Grid()); _insides->set_name( "PreviewHolderGrid" ); _insides->set_column_spacing(8); @@ -66,21 +60,9 @@ PreviewHolder::PreviewHolder() : _scroller->set_hexpand(); _scroller->set_vexpand(); -#else - _insides = Gtk::manage(new Gtk::Table( 1, 2 )); - _insides->set_col_spacings( 8 ); - - // Add a container with the scroller and a spacer - Gtk::Table* spaceHolder = Gtk::manage( new Gtk::Table(1, 2) ); -#endif - _scroller->add( *_insides ); -#if WITH_GTKMM_3_0 spaceHolder->attach( *_scroller, 0, 0, 1, 1); -#else - spaceHolder->attach( *_scroller, 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); -#endif pack_start(*spaceHolder, Gtk::PACK_EXPAND_WIDGET); } @@ -93,11 +75,7 @@ PreviewHolder::~PreviewHolder() bool PreviewHolder::on_scroll_event(GdkEventScroll *event) { // Scroll horizontally by page on mouse wheel -#if WITH_GTKMM_3_0 - Glib::RefPtr<Gtk::Adjustment> adj = dynamic_cast<Gtk::ScrolledWindow*>(_scroller)->get_hadjustment(); -#else - Gtk::Adjustment *adj = dynamic_cast<Gtk::ScrolledWindow*>(_scroller)->get_hadjustment(); -#endif + auto adj = dynamic_cast<Gtk::ScrolledWindow*>(_scroller)->get_hadjustment(); if (!adj) { return FALSE; @@ -141,7 +119,6 @@ void PreviewHolder::addPreview( Previewable* preview ) Gtk::Widget* label = Gtk::manage(preview->getPreview(PREVIEW_STYLE_BLURB, VIEW_TYPE_LIST, _baseSize, _ratio, _border)); Gtk::Widget* thing = Gtk::manage(preview->getPreview(PREVIEW_STYLE_PREVIEW, VIEW_TYPE_LIST, _baseSize, _ratio, _border)); -#if WITH_GTKMM_3_0 thing->set_hexpand(); thing->set_vexpand(); _insides->attach(*thing, 0, i, 1, 1); @@ -149,10 +126,6 @@ void PreviewHolder::addPreview( Previewable* preview ) label->set_hexpand(); label->set_valign(Gtk::ALIGN_CENTER); _insides->attach(*label, 1, i, 1, 1); -#else - _insides->attach( *thing, 0, 1, i, i+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); - _insides->attach( *label, 1, 2, i, i+1, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK ); -#endif } break; @@ -168,44 +141,25 @@ void PreviewHolder::addPreview( Previewable* preview ) int col = i % width; int row = i / width; -#if !WITH_GTKMM_3_0 - // If the existing grid isn't wide enough, we need to resize - // it and re-pack the existing widgets - if ( _insides && width > (int)_insides->property_n_columns() ) { - _insides->resize( height, width ); -#endif - std::vector<Gtk::Widget*>kids = _insides->get_children(); - int childCount = (int)kids.size(); - // g_message(" %3d resize from %d to %d (r:%d, c:%d) with %d children", i, oldWidth, width, row, col, childCount ); - - // Loop through the existing widgets and move them to new location - for ( int j = 1; j < childCount; j++ ) { - Gtk::Widget* target = kids[childCount - (j + 1)]; - int col2 = j % width; - int row2 = j / width; - Glib::RefPtr<Gtk::Widget> handle(target); - _insides->remove( *target ); - -#if WITH_GTKMM_3_0 - target->set_hexpand(); - target->set_vexpand(); - _insides->attach( *target, col2, row2, 1, 1); -#else - _insides->attach( *target, col2, col2+1, row2, row2+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); -#endif - } -#if WITH_GTKMM_3_0 - thing->set_hexpand(); - thing->set_vexpand(); - _insides->attach(*thing, col, row, 1, 1); -#else - } else if ( col == 0 ) { - // we just started a new row - _insides->resize( row + 1, width ); - } - - _insides->attach( *thing, col, col+1, row, row+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); -#endif + auto kids = _insides->get_children(); + int childCount = (int)kids.size(); + // g_message(" %3d resize from %d to %d (r:%d, c:%d) with %d children", i, oldWidth, width, row, col, childCount ); + + // Loop through the existing widgets and move them to new location + for ( int j = 1; j < childCount; j++ ) { + auto target = kids[childCount - (j + 1)]; + int col2 = j % width; + int row2 = j / width; + Glib::RefPtr<Gtk::Widget> handle(target); + _insides->remove( *target ); + + target->set_hexpand(); + target->set_vexpand(); + _insides->attach( *target, col2, row2, 1, 1); + } + thing->set_hexpand(); + thing->set_vexpand(); + _insides->attach(*thing, col, row, 1, 1); } } @@ -416,21 +370,11 @@ void PreviewHolder::rebuildUI() switch(_view) { case VIEW_TYPE_LIST: { - -#if WITH_GTKMM_3_0 _insides = Gtk::manage(new Gtk::Grid()); _insides->set_column_spacing(8); -#else - _insides = Gtk::manage(new Gtk::Table( 1, 2 )); - _insides->set_col_spacings( 8 ); -#endif if (_border == BORDER_WIDE) { -#if WITH_GTKMM_3_0 _insides->set_row_spacing(1); -#else - _insides->set_row_spacings( 1 ); -#endif } for ( unsigned int i = 0; i < items.size(); i++ ) { @@ -439,7 +383,6 @@ void PreviewHolder::rebuildUI() Gtk::Widget* thing = Gtk::manage(items[i]->getPreview(PREVIEW_STYLE_PREVIEW, _view, _baseSize, _ratio, _border)); -#if WITH_GTKMM_3_0 thing->set_hexpand(); thing->set_vexpand(); _insides->attach(*thing, 0, i, 1, 1); @@ -447,10 +390,6 @@ void PreviewHolder::rebuildUI() label->set_hexpand(); label->set_valign(Gtk::ALIGN_CENTER); _insides->attach(*label, 1, i, 1, 1); -#else - _insides->attach( *thing, 0, 1, i, i+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); - _insides->attach( *label, 1, 2, i, i+1, Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK ); -#endif } _scroller->add( *_insides ); @@ -473,28 +412,16 @@ void PreviewHolder::rebuildUI() if ( !_insides ) { calcGridSize( thing, items.size(), width, height ); -#if WITH_GTKMM_3_0 _insides = Gtk::manage(new Gtk::Grid()); if (_border == BORDER_WIDE) { _insides->set_column_spacing(1); _insides->set_row_spacing(1); } -#else - _insides = Gtk::manage(new Gtk::Table( height, width )); - if (_border == BORDER_WIDE) { - _insides->set_col_spacings( 1 ); - _insides->set_row_spacings( 1 ); - } -#endif } -#if WITH_GTKMM_3_0 thing->set_hexpand(); thing->set_vexpand(); _insides->attach( *thing, col, row, 1, 1); -#else - _insides->attach( *thing, col, col+1, row, row+1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND ); -#endif if ( ++col >= width ) { col = 0; @@ -502,11 +429,7 @@ void PreviewHolder::rebuildUI() } } if ( !_insides ) { -#if WITH_GTKMM_3_0 _insides = Gtk::manage(new Gtk::Grid()); -#else - _insides = Gtk::manage(new Gtk::Table( 1, 2 )); -#endif } _scroller->add( *_insides ); diff --git a/src/ui/previewholder.h b/src/ui/previewholder.h index 28c0fd865..d370e8fc8 100644 --- a/src/ui/previewholder.h +++ b/src/ui/previewholder.h @@ -21,11 +21,7 @@ #include <gtkmm/bin.h> namespace Gtk { -#if WITH_GTKMM_3_0 class Grid; -#else -class Table; -#endif } #include "previewfillable.h" @@ -68,12 +64,7 @@ private: std::vector<Previewable*> items; Gtk::Bin *_scroller; - -#if WITH_GTKMM_3_0 Gtk::Grid *_insides; -#else - Gtk::Table *_insides; -#endif int _prefCols; bool _updatesFrozen; diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index 72ba499de..17debb59c 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -149,16 +149,10 @@ void ToolBase::sp_event_context_set_cursor(GdkCursorType cursor_type) { GdkDisplay *display = gdk_display_get_default(); GdkCursor *cursor = gdk_cursor_new_for_display(display, cursor_type); -#if WITH_GTKMM_3_0 if (cursor) { gdk_window_set_cursor (gtk_widget_get_window (w), cursor); g_object_unref (cursor); } -#else - gdk_window_set_cursor (gtk_widget_get_window (w), cursor); - gdk_cursor_unref (cursor); -#endif - } /** |
