diff options
| author | Adrian Boguszewski <adrbogus1@student.pg.gda.pl> | 2016-08-09 09:33:34 +0000 |
|---|---|---|
| committer | Adrian Boguszewski <adrbogus1@student.pg.gda.pl> | 2016-08-09 09:33:34 +0000 |
| commit | 577a95c2028790cbb856feda6ac6880ddd1aaad2 (patch) | |
| tree | 4ff78f6fa8f0c1b740fd43b0ade2b91dbf9226d0 /src/ui | |
| parent | Merged trunk (diff) | |
| parent | Remove deprecated Autotools and btool files. Please use CMake instead (diff) | |
| download | inkscape-577a95c2028790cbb856feda6ac6880ddd1aaad2.tar.gz inkscape-577a95c2028790cbb856feda6ac6880ddd1aaad2.zip | |
Merged trunk
(bzr r14954.1.30)
Diffstat (limited to 'src/ui')
141 files changed, 186 insertions, 6708 deletions
diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index 587974b90..edcc41cd2 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -130,8 +130,6 @@ set(ui_SRC widget/filter-effect-chooser.cpp widget/font-variants.cpp widget/frame.cpp - widget/gimpcolorwheel.c - widget/gimpspinscale.c widget/highlight-picker.cpp widget/imageicon.cpp widget/imagetoggler.cpp @@ -314,8 +312,6 @@ set(ui_SRC widget/filter-effect-chooser.h widget/font-variants.h widget/frame.h - widget/gimpspinscale.h - widget/gimpcolorwheel.h widget/highlight-picker.h widget/insertordericon.h widget/imageicon.h diff --git a/src/ui/Makefile_insert b/src/ui/Makefile_insert deleted file mode 100644 index bbfdb532c..000000000 --- a/src/ui/Makefile_insert +++ /dev/null @@ -1,31 +0,0 @@ -## Makefile.am fragment sourced by src/Makefile.am. - -ink_common_sources += \ - ui/clipboard.cpp \ - ui/clipboard.h \ - ui/control-manager.cpp \ - ui/control-manager.h \ - ui/control-types.h \ - ui/dialog-events.cpp \ - ui/dialog-events.h \ - ui/draw-anchor.cpp \ - ui/draw-anchor.h \ - ui/icon-names.h \ - ui/interface.cpp \ - ui/interface.h \ - ui/object-edit.cpp \ - ui/object-edit.h \ - ui/previewable.h \ - ui/previewfillable.h \ - ui/previewholder.cpp \ - ui/previewholder.h \ - ui/selected-color.h \ - ui/selected-color.cpp \ - ui/shape-editor.cpp \ - ui/shape-editor.h \ - ui/tool-factory.cpp \ - ui/tool-factory.h \ - ui/tools-switch.cpp \ - ui/tools-switch.h \ - ui/uxmanager.cpp \ - ui/uxmanager.h diff --git a/src/ui/cache/Makefile_insert b/src/ui/cache/Makefile_insert deleted file mode 100644 index c648777f8..000000000 --- a/src/ui/cache/Makefile_insert +++ /dev/null @@ -1,6 +0,0 @@ -## Makefile.am fragment sourced by src/Makefile.am. - -ink_common_sources += \ - ui/cache/svg_preview_cache.h \ - ui/cache/svg_preview_cache.cpp - diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 265f672ad..66b13ed9d 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -1288,11 +1288,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 /* @@ -1351,12 +1347,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-events.h b/src/ui/dialog-events.h index b4a5d7c35..547cfb95d 100644 --- a/src/ui/dialog-events.h +++ b/src/ui/dialog-events.h @@ -12,6 +12,7 @@ #ifndef SEEN_DIALOG_EVENTS_H #define SEEN_DIALOG_EVENTS_H +#include <gtk/gtk.h> /* * event callback can only accept one argument, but we need two, diff --git a/src/ui/dialog/Makefile_insert b/src/ui/dialog/Makefile_insert deleted file mode 100644 index 71628973e..000000000 --- a/src/ui/dialog/Makefile_insert +++ /dev/null @@ -1,133 +0,0 @@ -## Makefile.am fragment sourced by src/Makefile.am. - -ink_common_sources += \ - ui/dialog/aboutbox.cpp \ - ui/dialog/aboutbox.h \ - ui/dialog/align-and-distribute.cpp \ - ui/dialog/align-and-distribute.h \ - ui/dialog/arrange-tab.h \ - ui/dialog/behavior.h \ - ui/dialog/calligraphic-profile-rename.h \ - ui/dialog/calligraphic-profile-rename.cpp \ - ui/dialog/clonetiler.cpp \ - ui/dialog/clonetiler.h \ - ui/dialog/color-item.cpp \ - ui/dialog/color-item.h \ - ui/dialog/debug.cpp \ - ui/dialog/debug.h \ - ui/dialog/desktop-tracker.cpp \ - ui/dialog/desktop-tracker.h \ - ui/dialog/dialog.cpp \ - ui/dialog/dialog.h \ - ui/dialog/dialog-manager.cpp \ - ui/dialog/dialog-manager.h \ - ui/dialog/dock-behavior.cpp \ - ui/dialog/dock-behavior.h \ - ui/dialog/document-metadata.cpp \ - ui/dialog/document-metadata.h \ - ui/dialog/document-properties.cpp \ - ui/dialog/document-properties.h \ - ui/dialog/export.cpp \ - ui/dialog/export.h \ - ui/dialog/extension-editor.cpp \ - ui/dialog/extension-editor.h \ - ui/dialog/extensions.cpp \ - ui/dialog/extensions.h \ - ui/dialog/filedialog.cpp \ - ui/dialog/filedialog.h \ - ui/dialog/filedialogimpl-gtkmm.cpp \ - ui/dialog/filedialogimpl-gtkmm.h \ - ui/dialog/filedialogimpl-win32.cpp \ - ui/dialog/filedialogimpl-win32.h \ - ui/dialog/fill-and-stroke.cpp \ - ui/dialog/fill-and-stroke.h \ - ui/dialog/filter-effects-dialog.cpp \ - ui/dialog/filter-effects-dialog.h \ - ui/dialog/find.cpp \ - ui/dialog/find.h \ - ui/dialog/font-substitution.cpp \ - ui/dialog/font-substitution.h \ - ui/dialog/floating-behavior.cpp \ - ui/dialog/floating-behavior.h \ - ui/dialog/glyphs.cpp \ - ui/dialog/glyphs.h \ - ui/dialog/grid-arrange-tab.h \ - ui/dialog/grid-arrange-tab.cpp \ - ui/dialog/guides.cpp \ - ui/dialog/guides.h \ - ui/dialog/icon-preview.cpp \ - ui/dialog/icon-preview.h \ - ui/dialog/inkscape-preferences.cpp \ - ui/dialog/inkscape-preferences.h \ - ui/dialog/input.cpp \ - ui/dialog/input.h \ - ui/dialog/knot-properties.cpp \ - ui/dialog/knot-properties.h \ - ui/dialog/layer-properties.cpp \ - ui/dialog/layer-properties.h \ - ui/dialog/layers.cpp \ - ui/dialog/layers.h \ - ui/dialog/livepatheffect-add.cpp \ - ui/dialog/livepatheffect-add.h \ - ui/dialog/livepatheffect-editor.cpp \ - ui/dialog/livepatheffect-editor.h \ - ui/dialog/memory.cpp \ - ui/dialog/memory.h \ - ui/dialog/messages.cpp \ - ui/dialog/messages.h \ - ui/dialog/new-from-template.cpp \ - ui/dialog/new-from-template.h \ - ui/dialog/ocaldialogs.cpp \ - ui/dialog/ocaldialogs.h \ - ui/dialog/object-attributes.cpp \ - ui/dialog/object-attributes.h \ - ui/dialog/object-properties.cpp \ - ui/dialog/object-properties.h \ - ui/dialog/panel-dialog.h \ - ui/dialog/polar-arrange-tab.cpp \ - ui/dialog/polar-arrange-tab.h \ - ui/dialog/print.cpp \ - ui/dialog/print.h \ - ui/dialog/print-colors-preview-dialog.cpp \ - ui/dialog/print-colors-preview-dialog.h \ - ui/dialog/spellcheck.cpp \ - ui/dialog/spellcheck.h \ - ui/dialog/svg-fonts-dialog.cpp \ - ui/dialog/svg-fonts-dialog.h \ - ui/dialog/swatches.cpp \ - ui/dialog/swatches.h \ - ui/dialog/symbols.cpp \ - ui/dialog/symbols.h \ - ui/dialog/template-load-tab.cpp \ - ui/dialog/template-load-tab.h \ - ui/dialog/template-widget.cpp \ - ui/dialog/template-widget.h \ - ui/dialog/tags.cpp \ - ui/dialog/tags.h \ - ui/dialog/text-edit.cpp \ - ui/dialog/text-edit.h \ - ui/dialog/tile.cpp \ - ui/dialog/tile.h \ - ui/dialog/pixelartdialog.cpp \ - ui/dialog/pixelartdialog.h \ - ui/dialog/transformation.cpp \ - ui/dialog/transformation.h \ - ui/dialog/undo-history.cpp \ - ui/dialog/undo-history.h \ - ui/dialog/xml-tree.cpp \ - ui/dialog/xml-tree.h \ - ui/dialog/lpe-powerstroke-properties.cpp \ - ui/dialog/lpe-powerstroke-properties.h \ - ui/dialog/objects.cpp \ - ui/dialog/objects.h \ - ui/dialog/lpe-fillet-chamfer-properties.cpp \ - ui/dialog/lpe-fillet-chamfer-properties.h \ - $(inkboard_dialogs) - -if HAVE_POTRACE - -ink_common_sources += \ - ui/dialog/tracedialog.cpp \ - ui/dialog/tracedialog.h - -endif diff --git a/src/ui/dialog/aboutbox.cpp b/src/ui/dialog/aboutbox.cpp index 6276d3391..04cf9d02a 100644 --- a/src/ui/dialog/aboutbox.cpp +++ b/src/ui/dialog/aboutbox.cpp @@ -98,11 +98,7 @@ AboutBox::AboutBox() : Gtk::Dialog(_("About Inkscape")) { tabs->append_page(*manage( make_scrolled_text(license_text)), _("_License"), true); -#if WITH_GTKMM_3_0 get_content_area()->pack_end(*manage(tabs), true, true); -#else - get_vbox()->pack_end(*manage(tabs), true, true); -#endif tabs->show_all(); @@ -130,23 +126,16 @@ AboutBox::AboutBox() : Gtk::Dialog(_("About Inkscape")) { link->set_selectable(true); link->show(); -#if WITH_GTKMM_3_0 get_content_area()->pack_start(*manage(label), false, false); get_content_area()->pack_start(*manage(link), false, false); -#else - get_vbox()->pack_start(*manage(label), false, false); - get_vbox()->pack_start(*manage(link), false, false); -#endif - Gtk::Requisition requisition; -#if GTK_CHECK_VERSION(3,0,0) - gtk_widget_get_preferred_size(reinterpret_cast<GtkWidget*>(gobj()), &requisition, NULL); -#else - gtk_widget_size_request (reinterpret_cast<GtkWidget*>(gobj()), &requisition); -#endif + Gtk::Requisition minimum_size; + Gtk::Requisition natural_size; + get_preferred_size(minimum_size, natural_size); + // allow window to shrink set_size_request(0, 0); - set_default_size(requisition.width, requisition.height); + set_default_size(minimum_size.width, minimum_size.height); } diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index 2e5c74706..ed9ec3b0a 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -58,11 +58,7 @@ namespace Dialog { Action::Action(const Glib::ustring &id, const Glib::ustring &tiptext, guint row, guint column, -#if WITH_GTKMM_3_0 - Gtk::Grid &parent, -#else - Gtk::Table &parent, -#endif + Gtk::Grid &parent, AlignAndDistribute &dialog): _dialog(dialog), _id(id), @@ -78,11 +74,7 @@ Action::Action(const Glib::ustring &id, pButton->signal_clicked() .connect(sigc::mem_fun(*this, &Action::on_button_click)); pButton->set_tooltip_text(tiptext); -#if WITH_GTKMM_3_0 parent.attach(*pButton, column, row, 1, 1); -#else - parent.attach(*pButton, column, column+1, row, row+1, Gtk::FILL, Gtk::FILL); -#endif } @@ -444,11 +436,7 @@ public: Action(id, tiptext, row, column + 4, dialog.removeOverlap_table(), dialog) { -#if WITH_GTKMM_3_0 dialog.removeOverlap_table().set_column_spacing(3); -#else - dialog.removeOverlap_table().set_col_spacings(3); -#endif removeOverlapXGap.set_digits(1); removeOverlapXGap.set_size_request(60, -1); @@ -470,17 +458,10 @@ public: removeOverlapYGapLabel.set_text_with_mnemonic(C_("Gap", "_V:")); removeOverlapYGapLabel.set_mnemonic_widget(removeOverlapYGap); -#if WITH_GTKMM_3_0 dialog.removeOverlap_table().attach(removeOverlapXGapLabel, column, row, 1, 1); dialog.removeOverlap_table().attach(removeOverlapXGap, column+1, row, 1, 1); dialog.removeOverlap_table().attach(removeOverlapYGapLabel, column+2, row, 1, 1); dialog.removeOverlap_table().attach(removeOverlapYGap, column+3, row, 1, 1); -#else - dialog.removeOverlap_table().attach(removeOverlapXGapLabel, column, column+1, row, row+1, Gtk::FILL, Gtk::FILL); - dialog.removeOverlap_table().attach(removeOverlapXGap, column+1, column+2, row, row+1, Gtk::FILL, Gtk::FILL); - dialog.removeOverlap_table().attach(removeOverlapYGapLabel, column+2, column+3, row, row+1, Gtk::FILL, Gtk::FILL); - dialog.removeOverlap_table().attach(removeOverlapYGap, column+3, column+4, row, row+1, Gtk::FILL, Gtk::FILL); -#endif } private : @@ -763,11 +744,7 @@ public : guint row, guint column, AlignAndDistribute &dialog, -#if WITH_GTKMM_3_0 Gtk::Grid &table, -#else - Gtk::Table &table, -#endif Geom::Dim2 orientation, bool distribute): Action(id, tiptext, row, column, table, dialog), @@ -940,19 +917,11 @@ AlignAndDistribute::AlignAndDistribute() _rearrangeFrame(_("Rearrange")), _removeOverlapFrame(_("Remove overlaps")), _nodesFrame(_("Nodes")), -#if WITH_GTKMM_3_0 _alignTable(), _distributeTable(), _rearrangeTable(), _removeOverlapTable(), _nodesTable(), -#else - _alignTable(2, 6, true), - _distributeTable(2, 6, true), - _rearrangeTable(1, 5, false), - _removeOverlapTable(1, 5, false), - _nodesTable(1, 4, true), -#endif _anchorLabel(_("Relative to: ")), _anchorLabelNode(_("Relative to: ")), _selgrpLabel(_("_Treat selection as group: "), 1) @@ -1317,13 +1286,8 @@ void AlignAndDistribute::addRandomizeButton(const Glib::ustring &id, const Glib: ); } -#if WITH_GTKMM_3_0 void AlignAndDistribute::addBaselineButton(const Glib::ustring &id, const Glib::ustring tiptext, guint row, guint col, Gtk::Grid &table, Geom::Dim2 orientation, bool distribute) -#else -void AlignAndDistribute::addBaselineButton(const Glib::ustring &id, const Glib::ustring tiptext, - guint row, guint col, Gtk::Table &table, Geom::Dim2 orientation, bool distribute) -#endif { _actionList.push_back( new ActionBaseline( diff --git a/src/ui/dialog/align-and-distribute.h b/src/ui/dialog/align-and-distribute.h index f8cc61af2..acb3d02ed 100644 --- a/src/ui/dialog/align-and-distribute.h +++ b/src/ui/dialog/align-and-distribute.h @@ -22,15 +22,11 @@ #include <gtkmm/frame.h> #include <gtkmm/comboboxtext.h> #include <gtkmm/label.h> -#include "2geom/rect.h" -#include "ui/dialog/desktop-tracker.h" - -#if WITH_GTKMM_3_0 #include <gtkmm/checkbutton.h> #include <gtkmm/grid.h> -#else -#include <gtkmm/table.h> -#endif + +#include "2geom/rect.h" +#include "ui/dialog/desktop-tracker.h" class SPItem; @@ -51,19 +47,11 @@ public: static AlignAndDistribute &getInstance() { return *new AlignAndDistribute(); } -#if WITH_GTKMM_3_0 Gtk::Grid &align_table(){return _alignTable;} Gtk::Grid &distribute_table(){return _distributeTable;} Gtk::Grid &rearrange_table(){return _rearrangeTable;} Gtk::Grid &removeOverlap_table(){return _removeOverlapTable;} Gtk::Grid &nodes_table(){return _nodesTable;} -#else - Gtk::Table &align_table(){return _alignTable;} - Gtk::Table &distribute_table(){return _distributeTable;} - Gtk::Table &rearrange_table(){return _rearrangeTable;} - Gtk::Table &removeOverlap_table(){return _removeOverlapTable;} - Gtk::Table &nodes_table(){return _nodesTable;} -#endif void setMode(bool nodeEdit); @@ -100,22 +88,13 @@ protected: guint row, guint col); void addRandomizeButton(const Glib::ustring &id, const Glib::ustring tiptext, guint row, guint col); -#if WITH_GTKMM_3_0 void addBaselineButton(const Glib::ustring &id, const Glib::ustring tiptext, guint row, guint col, Gtk::Grid &table, Geom::Dim2 orientation, bool distribute); -#else - void addBaselineButton(const Glib::ustring &id, const Glib::ustring tiptext, - guint row, guint col, Gtk::Table &table, Geom::Dim2 orientation, bool distribute); -#endif void setTargetDesktop(SPDesktop *desktop); std::list<Action *> _actionList; UI::Widget::Frame _alignFrame, _distributeFrame, _rearrangeFrame, _removeOverlapFrame, _nodesFrame; -#if WITH_GTKMM_3_0 Gtk::Grid _alignTable, _distributeTable, _rearrangeTable, _removeOverlapTable, _nodesTable; -#else - Gtk::Table _alignTable, _distributeTable, _rearrangeTable, _removeOverlapTable, _nodesTable; -#endif Gtk::HBox _anchorBox; Gtk::HBox _selgrpBox; Gtk::VBox _alignBox; @@ -163,11 +142,7 @@ public : Action(const Glib::ustring &id, const Glib::ustring &tiptext, guint row, guint column, - #if WITH_GTKMM_3_0 - Gtk::Grid &parent, - #else - Gtk::Table &parent, - #endif + Gtk::Grid &parent, AlignAndDistribute &dialog); virtual ~Action(){} @@ -178,12 +153,7 @@ private : virtual void on_button_click(){} Glib::ustring _id; - -#if WITH_GTKMM_3_0 Gtk::Grid &_parent; -#else - Gtk::Table &_parent; -#endif }; diff --git a/src/ui/dialog/calligraphic-profile-rename.cpp b/src/ui/dialog/calligraphic-profile-rename.cpp index 9ae22db2d..50dae0fd8 100644 --- a/src/ui/dialog/calligraphic-profile-rename.cpp +++ b/src/ui/dialog/calligraphic-profile-rename.cpp @@ -16,12 +16,7 @@ #include "calligraphic-profile-rename.h" #include <glibmm/i18n.h> #include <gtkmm/stock.h> - -#if WITH_GTKMM_3_0 -# include <gtkmm/grid.h> -#else -# include <gtkmm/table.h> -#endif +#include <gtkmm/grid.h> #include "desktop.h" @@ -30,40 +25,24 @@ namespace UI { namespace Dialog { CalligraphicProfileRename::CalligraphicProfileRename() : -#if WITH_GTKMM_3_0 _layout_table(Gtk::manage(new Gtk::Grid())), -#else - _layout_table(Gtk::manage(new Gtk::Table(1, 2))), -#endif _applied(false) { set_title(_("Edit profile")); -#if WITH_GTKMM_3_0 - Gtk::Box *mainVBox = get_content_area(); + auto mainVBox = get_content_area(); _layout_table->set_column_spacing(4); _layout_table->set_row_spacing(4); -#else - Gtk::Box *mainVBox = get_vbox(); - _layout_table->set_spacings(4); -#endif _profile_name_entry.set_activates_default(true); _profile_name_label.set_label(_("Profile name:")); _profile_name_label.set_alignment(1.0, 0.5); -#if WITH_GTKMM_3_0 _layout_table->attach(_profile_name_label, 0, 0, 1, 1); _profile_name_entry.set_hexpand(); _layout_table->attach(_profile_name_entry, 1, 0, 1, 1); -#else - _layout_table->attach(_profile_name_label, - 0, 1, 0, 1, Gtk::FILL, Gtk::FILL); - _layout_table->attach(_profile_name_entry, - 1, 2, 0, 1, Gtk::FILL | Gtk::EXPAND, Gtk::FILL); -#endif mainVBox->pack_start(*_layout_table, false, false, 4); // Buttons diff --git a/src/ui/dialog/calligraphic-profile-rename.h b/src/ui/dialog/calligraphic-profile-rename.h index 4ef71900b..b7a97a1e7 100644 --- a/src/ui/dialog/calligraphic-profile-rename.h +++ b/src/ui/dialog/calligraphic-profile-rename.h @@ -20,11 +20,7 @@ #include <gtkmm/label.h> namespace Gtk { -#if WITH_GTKMM_3_0 class Grid; -#else -class Table; -#endif } class SPDesktop; @@ -59,12 +55,7 @@ protected: Gtk::Label _profile_name_label; Gtk::Entry _profile_name_entry; - -#if WITH_GTKMM_3_0 Gtk::Grid* _layout_table; -#else - Gtk::Table* _layout_table; -#endif Gtk::Button _close_button; Gtk::Button _delete_button; diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp index 23d72bce8..1fa7a6c71 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -79,12 +79,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); @@ -639,12 +635,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); @@ -765,12 +757,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")); @@ -785,12 +773,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); @@ -799,15 +783,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); @@ -883,15 +861,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); @@ -932,15 +904,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); { @@ -988,12 +954,8 @@ CloneTiler::CloneTiler () : } { -#if GTK_CHECK_VERSION(3,0,0) - GtkWidget *hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN); + auto hb = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, VB_MARGIN); gtk_box_set_homogeneous(GTK_BOX(hb), FALSE); -#else - GtkWidget *hb = gtk_hbox_new(FALSE, VB_MARGIN); -#endif gtk_box_pack_start (GTK_BOX (mainbox), hb, FALSE, FALSE, 0); GtkWidget *l = gtk_label_new(_("")); gtk_label_set_markup (GTK_LABEL(l), _("Apply to tiled clones:")); @@ -1001,42 +963,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); @@ -1049,28 +993,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); @@ -1084,12 +1016,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 @@ -1100,59 +1028,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); @@ -1194,12 +1102,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")); @@ -1214,12 +1118,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); @@ -1228,12 +1128,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); { @@ -1247,12 +1143,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); { @@ -2661,12 +2553,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; @@ -2681,12 +2569,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); @@ -2713,44 +2597,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); @@ -2774,12 +2637,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); } @@ -2855,38 +2714,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); @@ -2899,12 +2742,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 d5ce6a160..d062bf863 100644 --- a/src/ui/dialog/debug.cpp +++ b/src/ui/dialog/debug.cpp @@ -67,12 +67,7 @@ DebugDialogImpl::DebugDialogImpl() { set_title(_("Messages")); set_size_request(300, 400); - -#if WITH_GTKMM_3_0 - Gtk::Box *mainVBox = get_content_area(); -#else - Gtk::Box *mainVBox = get_vbox(); -#endif + auto mainVBox = get_content_area(); //## Add a menu for clear() Gtk::MenuItem* item = Gtk::manage(new Gtk::MenuItem(_("_File"), true)); diff --git a/src/ui/dialog/document-metadata.cpp b/src/ui/dialog/document-metadata.cpp index 40495456b..dc1958434 100644 --- a/src/ui/dialog/document-metadata.cpp +++ b/src/ui/dialog/document-metadata.cpp @@ -60,12 +60,7 @@ DocumentMetadata::getInstance() DocumentMetadata::DocumentMetadata() -#if WITH_GTKMM_3_0 : UI::Widget::Panel ("", "/dialogs/documentmetadata", SP_VERB_DIALOG_METADATA) -#else - : UI::Widget::Panel ("", "/dialogs/documentmetadata", SP_VERB_DIALOG_METADATA), - _page_metadata1(1, 1), _page_metadata2(1, 1) -#endif { hide(); _getContents()->set_spacing (4); @@ -74,15 +69,10 @@ DocumentMetadata::DocumentMetadata() _page_metadata1.set_border_width(2); _page_metadata2.set_border_width(2); -#if WITH_GTKMM_3_0 _page_metadata1.set_column_spacing(2); _page_metadata2.set_column_spacing(2); _page_metadata1.set_row_spacing(2); _page_metadata2.set_row_spacing(2); -#else - _page_metadata1.set_spacings(2); - _page_metadata2.set_spacings(2); -#endif _notebook.append_page(_page_metadata1, _("Metadata")); _notebook.append_page(_page_metadata2, _("License")); @@ -125,12 +115,8 @@ DocumentMetadata::build_metadata() label->set_markup (_("<b>Dublin Core Entities</b>")); label->set_alignment (0.0); -#if WITH_GTKMM_3_0 label->set_valign(Gtk::ALIGN_CENTER); _page_metadata1.attach(*label, 0, 0, 3, 1); -#else - _page_metadata1.attach(*label, 0,3,0,1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); -#endif /* add generic metadata entry areas */ struct rdf_work_entity_t * entity; @@ -142,7 +128,6 @@ DocumentMetadata::build_metadata() Gtk::HBox *space = Gtk::manage (new Gtk::HBox); space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y); -#if WITH_GTKMM_3_0 space->set_valign(Gtk::ALIGN_CENTER); _page_metadata1.attach(*space, 0, row, 1, 1); @@ -152,11 +137,6 @@ DocumentMetadata::build_metadata() w->_packable->set_hexpand(); w->_packable->set_valign(Gtk::ALIGN_CENTER); _page_metadata1.attach(*w->_packable, 2, row, 1, 1); -#else - _page_metadata1.attach(*space, 0,1, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); - _page_metadata1.attach(w->_label, 1,2, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); - _page_metadata1.attach(*w->_packable, 2,3, row, row+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); -#endif } } @@ -166,31 +146,20 @@ DocumentMetadata::build_metadata() Gtk::Label *llabel = Gtk::manage (new Gtk::Label); llabel->set_markup (_("<b>License</b>")); llabel->set_alignment (0.0); - -#if WITH_GTKMM_3_0 llabel->set_valign(Gtk::ALIGN_CENTER); _page_metadata2.attach(*llabel, 0, row, 3, 1); -#else - _page_metadata2.attach(*llabel, 0,3, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); -#endif /* add license selector pull-down and URI */ ++row; _licensor.init (_wr); Gtk::HBox *space = Gtk::manage (new Gtk::HBox); space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y); - -#if WITH_GTKMM_3_0 space->set_valign(Gtk::ALIGN_CENTER); _page_metadata2.attach(*space, 0, row, 1, 1); _licensor.set_hexpand(); _licensor.set_valign(Gtk::ALIGN_CENTER); _page_metadata2.attach(_licensor, 1, row, 2, 1); -#else - _page_metadata2.attach(*space, 0,1, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); - _page_metadata2.attach(_licensor, 1,3, row, row+1, Gtk::EXPAND|Gtk::FILL, (Gtk::AttachOptions)0,0,0); -#endif } /** diff --git a/src/ui/dialog/document-metadata.h b/src/ui/dialog/document-metadata.h index cde5d92fd..2c56e9317 100644 --- a/src/ui/dialog/document-metadata.h +++ b/src/ui/dialog/document-metadata.h @@ -21,12 +21,7 @@ #include <stddef.h> #include "ui/widget/panel.h" #include <gtkmm/notebook.h> - -#if WITH_GTKMM_3_0 -# include <gtkmm/grid.h> -#else -# include <gtkmm/table.h> -#endif +#include <gtkmm/grid.h> #include "inkscape.h" #include "ui/widget/licensor.h" @@ -62,13 +57,8 @@ protected: Gtk::Notebook _notebook; -#if WITH_GTKMM_3_0 Gtk::Grid _page_metadata1; Gtk::Grid _page_metadata2; -#else - Gtk::Table _page_metadata1; - Gtk::Table _page_metadata2; -#endif //--------------------------------------------------------------- RDElist _rdflist; diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 9a1b39ac8..053549b73 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -211,25 +211,16 @@ DocumentProperties::~DocumentProperties() * widget in columns 2-3; (non-0, 0) means label in columns 1-3; and * (non-0, non-0) means two widgets in columns 2 and 3. */ -#if WITH_GTKMM_3_0 inline void attach_all(Gtk::Grid &table, Gtk::Widget *const arr[], unsigned const n, int start = 0, int docum_prop_flag = 0) -#else -inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned const n, int start = 0, int docum_prop_flag = 0) -#endif { for (unsigned i = 0, r = start; i < n; i += 2) { if (arr[i] && arr[i+1]) { -#if WITH_GTKMM_3_0 arr[i]->set_hexpand(); arr[i+1]->set_hexpand(); arr[i]->set_valign(Gtk::ALIGN_CENTER); arr[i+1]->set_valign(Gtk::ALIGN_CENTER); table.attach(*arr[i], 1, r, 1, 1); table.attach(*arr[i+1], 2, r, 1, 1); -#else - table.attach(*arr[i], 1, 2, r, r+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); - table.attach(*arr[i+1], 2, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); -#endif } else { if (arr[i+1]) { Gtk::AttachOptions yoptions = (Gtk::AttachOptions)0; @@ -240,7 +231,6 @@ inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned con if (docum_prop_flag) { // this sets the padding for subordinate widgets on the "Page" page if( i==(n-8) || i==(n-10) ) { -#if WITH_GTKMM_3_0 arr[i+1]->set_hexpand(); arr[i+1]->set_margin_left(20); arr[i+1]->set_margin_right(20); @@ -251,11 +241,7 @@ inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned con arr[i+1]->set_valign(Gtk::ALIGN_CENTER); table.attach(*arr[i+1], 1, r, 2, 1); -#else - table.attach(*arr[i+1], 1, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, yoptions, 20,0); -#endif } else { -#if WITH_GTKMM_3_0 arr[i+1]->set_hexpand(); if (yoptions & Gtk::EXPAND) @@ -264,12 +250,8 @@ inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned con arr[i+1]->set_valign(Gtk::ALIGN_CENTER); table.attach(*arr[i+1], 1, r, 2, 1); -#else - table.attach(*arr[i+1], 1, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, yoptions, 0,0); -#endif } } else { -#if WITH_GTKMM_3_0 arr[i+1]->set_hexpand(); if (yoptions & Gtk::EXPAND) @@ -278,32 +260,21 @@ inline void attach_all(Gtk::Table &table, Gtk::Widget *const arr[], unsigned con arr[i+1]->set_valign(Gtk::ALIGN_CENTER); table.attach(*arr[i+1], 1, r, 2, 1); -#else - table.attach(*arr[i+1], 1, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, yoptions, 0,0); -#endif } } else if (arr[i]) { Gtk::Label& label = reinterpret_cast<Gtk::Label&>(*arr[i]); label.set_alignment (0.0); -#if WITH_GTKMM_3_0 label.set_hexpand(); label.set_valign(Gtk::ALIGN_CENTER); table.attach(label, 0, r, 3, 1); -#else - table.attach (label, 0, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); -#endif } else { Gtk::HBox *space = Gtk::manage (new Gtk::HBox); space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y); -#if WITH_GTKMM_3_0 space->set_halign(Gtk::ALIGN_CENTER); space->set_valign(Gtk::ALIGN_CENTER); table.attach(*space, 0, r, 1, 1); -#else - table.attach (*space, 0, 1, r, r+1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0,0,0); -#endif } } ++r; @@ -673,52 +644,35 @@ void DocumentProperties::build_cms() label_link->set_alignment(0.0); -#if WITH_GTKMM_3_0 label_link->set_hexpand(); label_link->set_valign(Gtk::ALIGN_CENTER); _page_cms->table().attach(*label_link, 0, row, 3, 1); -#else - _page_cms->table().attach(*label_link, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); -#endif row++; -#if WITH_GTKMM_3_0 _LinkedProfilesListScroller.set_hexpand(); _LinkedProfilesListScroller.set_valign(Gtk::ALIGN_CENTER); _page_cms->table().attach(_LinkedProfilesListScroller, 0, row, 3, 1); -#else - _page_cms->table().attach(_LinkedProfilesListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); -#endif row++; Gtk::HBox* spacer = Gtk::manage(new Gtk::HBox()); spacer->set_size_request(SPACE_SIZE_X, SPACE_SIZE_Y); -#if WITH_GTKMM_3_0 spacer->set_hexpand(); spacer->set_valign(Gtk::ALIGN_CENTER); _page_cms->table().attach(*spacer, 0, row, 3, 1); -#else - _page_cms->table().attach(*spacer, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); -#endif row++; label_avail->set_alignment(0.0); -#if WITH_GTKMM_3_0 label_avail->set_hexpand(); label_avail->set_valign(Gtk::ALIGN_CENTER); _page_cms->table().attach(*label_avail, 0, row, 3, 1); -#else - _page_cms->table().attach(*label_avail, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); -#endif row++; -#if WITH_GTKMM_3_0 _AvailableProfilesList.set_hexpand(); _AvailableProfilesList.set_valign(Gtk::ALIGN_CENTER); _page_cms->table().attach(_AvailableProfilesList, 0, row, 1, 1); @@ -732,11 +686,6 @@ void DocumentProperties::build_cms() _unlink_btn.set_halign(Gtk::ALIGN_CENTER); _unlink_btn.set_valign(Gtk::ALIGN_CENTER); _page_cms->table().attach(_unlink_btn, 2, row, 1, 1); -#else - _page_cms->table().attach(_AvailableProfilesList, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); - _page_cms->table().attach(_link_btn, 1, 2, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 2, 0); - _page_cms->table().attach(_unlink_btn, 2, 3, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 0, 0); -#endif // Set up the Avialable Profiles combo box _AvailableProfilesListStore = Gtk::ListStore::create(_AvailableProfilesListColumns); @@ -803,41 +752,27 @@ void DocumentProperties::build_scripting() gint row = 0; label_external->set_alignment(0.0); - -#if WITH_GTKMM_3_0 label_external->set_hexpand(); label_external->set_valign(Gtk::ALIGN_CENTER); _page_external_scripts->table().attach(*label_external, 0, row, 3, 1); -#else - _page_external_scripts->table().attach(*label_external, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); -#endif row++; -#if WITH_GTKMM_3_0 _ExternalScriptsListScroller.set_hexpand(); _ExternalScriptsListScroller.set_valign(Gtk::ALIGN_CENTER); _page_external_scripts->table().attach(_ExternalScriptsListScroller, 0, row, 3, 1); -#else - _page_external_scripts->table().attach(_ExternalScriptsListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); -#endif row++; Gtk::HBox* spacer_external = Gtk::manage(new Gtk::HBox()); spacer_external->set_size_request(SPACE_SIZE_X, SPACE_SIZE_Y); -#if WITH_GTKMM_3_0 spacer_external->set_hexpand(); spacer_external->set_valign(Gtk::ALIGN_CENTER); _page_external_scripts->table().attach(*spacer_external, 0, row, 3, 1); -#else - _page_external_scripts->table().attach(*spacer_external, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); -#endif row++; -#if WITH_GTKMM_3_0 _script_entry.set_hexpand(); _script_entry.set_valign(Gtk::ALIGN_CENTER); _page_external_scripts->table().attach(_script_entry, 0, row, 1, 1); @@ -851,11 +786,6 @@ void DocumentProperties::build_scripting() _external_remove_btn.set_halign(Gtk::ALIGN_CENTER); _external_remove_btn.set_valign(Gtk::ALIGN_CENTER); _page_external_scripts->table().attach(_external_remove_btn, 2, row, 1, 1); -#else - _page_external_scripts->table().attach(_script_entry, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); - _page_external_scripts->table().attach(_external_add_btn, 1, 2, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 2, 0); - _page_external_scripts->table().attach(_external_remove_btn, 2, 3, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, 0, 0); -#endif //# Set up the External Scripts box _ExternalScriptsListStore = Gtk::ListStore::create(_ExternalScriptsListColumns); @@ -876,12 +806,6 @@ void DocumentProperties::build_scripting() _embed_remove_btn.set_tooltip_text(_("Remove")); docprops_style_button(_embed_remove_btn, INKSCAPE_ICON("list-remove")); -#if !WITH_GTKMM_3_0 - // TODO: This has been removed from Gtkmm 3.0. Check that - // everything still looks OK! - _embed_button_box.set_child_min_width( 16 ); - _embed_button_box.set_spacing( 4 ); -#endif _embed_button_box.set_layout (Gtk::BUTTONBOX_START); _embed_button_box.add(_embed_new_btn); _embed_button_box.add(_embed_remove_btn); @@ -890,47 +814,29 @@ void DocumentProperties::build_scripting() row = 0; label_embedded->set_alignment(0.0); - -#if WITH_GTKMM_3_0 label_embedded->set_hexpand(); label_embedded->set_valign(Gtk::ALIGN_CENTER); _page_embedded_scripts->table().attach(*label_embedded, 0, row, 3, 1); -#else - _page_embedded_scripts->table().attach(*label_embedded, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); -#endif row++; -#if WITH_GTKMM_3_0 _EmbeddedScriptsListScroller.set_hexpand(); _EmbeddedScriptsListScroller.set_valign(Gtk::ALIGN_CENTER); _page_embedded_scripts->table().attach(_EmbeddedScriptsListScroller, 0, row, 3, 1); -#else - _page_embedded_scripts->table().attach(_EmbeddedScriptsListScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); -#endif row++; -#if WITH_GTKMM_3_0 _embed_button_box.set_hexpand(); _embed_button_box.set_valign(Gtk::ALIGN_CENTER); _page_embedded_scripts->table().attach(_embed_button_box, 0, row, 1, 1); -#else - _page_embedded_scripts->table().attach(_embed_button_box, 0, 1, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); -#endif row++; Gtk::HBox* spacer_embedded = Gtk::manage(new Gtk::HBox()); spacer_embedded->set_size_request(SPACE_SIZE_X, SPACE_SIZE_Y); - -#if WITH_GTKMM_3_0 spacer_embedded->set_hexpand(); spacer_embedded->set_valign(Gtk::ALIGN_CENTER); _page_embedded_scripts->table().attach(*spacer_embedded, 0, row, 3, 1); -#else - _page_embedded_scripts->table().attach(*spacer_embedded, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); -#endif row++; @@ -946,24 +852,15 @@ void DocumentProperties::build_scripting() label_embedded_content->set_markup (_("<b>Content:</b>")); label_embedded_content->set_alignment(0.0); - -#if WITH_GTKMM_3_0 label_embedded_content->set_hexpand(); label_embedded_content->set_valign(Gtk::ALIGN_CENTER); _page_embedded_scripts->table().attach(*label_embedded_content, 0, row, 3, 1); -#else - _page_embedded_scripts->table().attach(*label_embedded_content, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); -#endif row++; -#if WITH_GTKMM_3_0 _EmbeddedContentScroller.set_hexpand(); _EmbeddedContentScroller.set_valign(Gtk::ALIGN_CENTER); _page_embedded_scripts->table().attach(_EmbeddedContentScroller, 0, row, 3, 1); -#else - _page_embedded_scripts->table().attach(_EmbeddedContentScroller, 0, 3, row, row + 1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0, 0, 0); -#endif _EmbeddedContentScroller.add(_EmbeddedContent); _EmbeddedContentScroller.set_shadow_type(Gtk::SHADOW_IN); @@ -1025,12 +922,8 @@ void DocumentProperties::build_metadata() label->set_markup (_("<b>Dublin Core Entities</b>")); label->set_alignment (0.0); -#if WITH_GTKMM_3_0 label->set_valign(Gtk::ALIGN_CENTER); _page_metadata1->table().attach (*label, 0,0,3,1); -#else - _page_metadata1->table().attach (*label, 0,3,0,1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); -#endif /* add generic metadata entry areas */ struct rdf_work_entity_t * entity; @@ -1041,8 +934,6 @@ void DocumentProperties::build_metadata() _rdflist.push_back (w); Gtk::HBox *space = Gtk::manage (new Gtk::HBox); space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y); - -#if WITH_GTKMM_3_0 space->set_valign(Gtk::ALIGN_CENTER); _page_metadata1->table().attach(*space, 0, row, 1, 1); @@ -1052,11 +943,6 @@ void DocumentProperties::build_metadata() w->_packable->set_hexpand(); w->_packable->set_valign(Gtk::ALIGN_CENTER); _page_metadata1->table().attach(*w->_packable, 2, row, 1, 1); -#else - _page_metadata1->table().attach (*space, 0,1, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); - _page_metadata1->table().attach (w->_label, 1,2, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); - _page_metadata1->table().attach (*w->_packable, 2,3, row, row+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); -#endif } } @@ -1065,11 +951,7 @@ void DocumentProperties::build_metadata() Gtk::Button *button_load = Gtk::manage (new Gtk::Button(_("Use _default"),1)); button_load->set_tooltip_text(_("Use the previously saved default metadata here")); -#if WITH_GTKMM_3_0 - Gtk::ButtonBox *box_buttons = Gtk::manage (new Gtk::ButtonBox); -#else - Gtk::HButtonBox *box_buttons = Gtk::manage (new Gtk::HButtonBox); -#endif + auto box_buttons = Gtk::manage (new Gtk::ButtonBox); box_buttons->set_layout(Gtk::BUTTONBOX_END); box_buttons->set_spacing(4); @@ -1087,12 +969,8 @@ void DocumentProperties::build_metadata() llabel->set_markup (_("<b>License</b>")); llabel->set_alignment (0.0); -#if WITH_GTKMM_3_0 llabel->set_valign(Gtk::ALIGN_CENTER); _page_metadata2->table().attach(*llabel, 0, row, 3, 1); -#else - _page_metadata2->table().attach (*llabel, 0,3, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); -#endif /* add license selector pull-down and URI */ ++row; @@ -1100,17 +978,12 @@ void DocumentProperties::build_metadata() Gtk::HBox *space = Gtk::manage (new Gtk::HBox); space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y); -#if WITH_GTKMM_3_0 space->set_valign(Gtk::ALIGN_CENTER); _page_metadata2->table().attach(*space, 0, row, 1, 1); _licensor.set_hexpand(); _licensor.set_valign(Gtk::ALIGN_CENTER); _page_metadata2->table().attach(_licensor, 1, row, 3, 1); -#else - _page_metadata2->table().attach (*space, 0,1, row, row+1, Gtk::FILL, (Gtk::AttachOptions)0,0,0); - _page_metadata2->table().attach (_licensor, 1,3, row, row+1, Gtk::EXPAND|Gtk::FILL, (Gtk::AttachOptions)0,0,0); -#endif } void DocumentProperties::addExternalScript(){ 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 0a6afccf4..670e4c8b5 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -24,15 +24,10 @@ #include <gtkmm/buttonbox.h> #include <gtkmm/dialog.h> #include <gtkmm/entry.h> +#include <gtkmm/grid.h> #include <gtkmm/spinbutton.h> #include <gtkmm/stock.h> -#if WITH_GTKMM_3_0 -# include <gtkmm/grid.h> -#else -# include <gtkmm/table.h> -#endif - #ifdef WITH_GNOME_VFS # include <libgnomevfs/gnome-vfs-init.h> // gnome_vfs_initialized #endif @@ -63,12 +58,7 @@ #include "helper/png-write.h" -#if WITH_EXT_GDL #include <gdl/gdl-dock-item.h> -#else -#include "libgdl/gdl-dock-item.h" -#endif - // required to set status message after export #include "desktop.h" @@ -205,15 +195,9 @@ Export::Export (void) : selectiontype_buttons[i]->signal_clicked().connect(sigc::mem_fun(*this, &Export::onAreaToggled)); } -#if WITH_GTKMM_3_0 - Gtk::Grid* t = new Gtk::Grid(); + auto t = new Gtk::Grid(); t->set_row_spacing(4); t->set_column_spacing(4); -#else - Gtk::Table* t = new Gtk::Table(3, 4, false); - t->set_row_spacings (4); - t->set_col_spacings (4); -#endif x0_adj = createSpinbutton ( "x0", 0.0, -1000000.0, 1000000.0, 0.1, 1.0, t, 0, 0, _("_x0:"), "", EXPORT_COORD_PRECISION, 1, @@ -255,15 +239,9 @@ Export::Export (void) : bm_label->set_use_markup(true); size_box.pack_start(*bm_label, false, false, 0); -#if WITH_GTKMM_3_0 - Gtk::Grid *t = new Gtk::Grid(); + auto t = new Gtk::Grid(); t->set_row_spacing(4); t->set_column_spacing(4); -#else - Gtk::Table *t = new Gtk::Table(2, 5, false); - t->set_row_spacings (4); - t->set_col_spacings (4); -#endif size_box.pack_start(*t); @@ -471,27 +449,14 @@ void Export::set_default_filename () { } } -#if WITH_GTKMM_3_0 Glib::RefPtr<Gtk::Adjustment> Export::createSpinbutton( gchar const * /*key*/, float val, float min, float max, float step, float page, Gtk::Grid *t, int x, int y, const Glib::ustring& ll, const Glib::ustring& lr, int digits, unsigned int sensitive, void (Export::*cb)() ) -#else -Gtk::Adjustment * Export::createSpinbutton( gchar const * /*key*/, float val, float min, float max, - float step, float page, - Gtk::Table *t, int x, int y, - const Glib::ustring& ll, const Glib::ustring& lr, - int digits, unsigned int sensitive, - void (Export::*cb)() ) -#endif { -#if WITH_GTKMM_3_0 - Glib::RefPtr<Gtk::Adjustment> adj = Gtk::Adjustment::create(val, min, max, step, page, 0); -#else - Gtk::Adjustment *adj = new Gtk::Adjustment ( val, min, max, step, page, 0 ); -#endif + auto adj = Gtk::Adjustment::create(val, min, max, step, page, 0); int pos = 0; Gtk::Label *l = NULL; @@ -499,28 +464,17 @@ Gtk::Adjustment * Export::createSpinbutton( gchar const * /*key*/, float val, fl if (!ll.empty()) { l = new Gtk::Label(ll,true); l->set_alignment (1.0, 0.5); - -#if WITH_GTKMM_3_0 l->set_hexpand(); l->set_vexpand(); t->attach(*l, x + pos, y, 1, 1); -#else - t->attach (*l, x + pos, x + pos + 1, y, y + 1, Gtk::EXPAND, Gtk::EXPAND, 0, 0 ); -#endif - l->set_sensitive(sensitive); pos++; } -#if WITH_GTKMM_3_0 - Gtk::SpinButton *sb = new Gtk::SpinButton(adj, 1.0, digits); + auto sb = new Gtk::SpinButton(adj, 1.0, digits); sb->set_hexpand(); sb->set_vexpand(); t->attach(*sb, x + pos, y, 1, 1); -#else - Gtk::SpinButton *sb = new Gtk::SpinButton(*adj, 1.0, digits); - t->attach (*sb, x + pos, x + pos + 1, y, y + 1, Gtk::EXPAND, Gtk::EXPAND, 0, 0 ); -#endif sb->set_width_chars(7); sb->set_sensitive (sensitive); @@ -533,15 +487,9 @@ Gtk::Adjustment * Export::createSpinbutton( gchar const * /*key*/, float val, fl if (!lr.empty()) { l = new Gtk::Label(lr,true); l->set_alignment (0.0, 0.5); - -#if WITH_GTKMM_3_0 l->set_hexpand(); l->set_vexpand(); t->attach(*l, x + pos, y, 1, 1); -#else - t->attach (*l, x + pos, x + pos + 1, y, y + 1, Gtk::EXPAND, Gtk::EXPAND, 0, 0 ); -#endif - l->set_sensitive (sensitive); pos++; l->set_mnemonic_widget (*sb); @@ -919,11 +867,7 @@ Gtk::Dialog * Export::create_progress_dialog (Glib::ustring progress_text) { Gtk::ProgressBar *prg = new Gtk::ProgressBar (); prg->set_text(progress_text); dlg->set_data ("progress", prg); -#if GTK_CHECK_VERSION(3,0,0) - Gtk::Box* CA = dlg->get_content_area(); -#else - Gtk::Box* CA = dlg->get_vbox(); -#endif + auto CA = dlg->get_content_area(); CA->pack_start(*prg, FALSE, FALSE, 4); Gtk::Button* btn = dlg->add_button (Gtk::Stock::CANCEL,Gtk::RESPONSE_CANCEL ); @@ -1345,11 +1289,7 @@ void Export::onBrowse () Glib::RefPtr<const Gdk::Window> parentWindow = desktop->getToplevel()->get_window(); g_assert(parentWindow->gobj() != NULL); -#if WITH_GTKMM_3_0 opf.hwndOwner = (HWND)gdk_win32_window_get_handle((GdkWindow*)parentWindow->gobj()); -#else - opf.hwndOwner = (HWND)gdk_win32_drawable_get_handle((GdkDrawable*)parentWindow->gobj()); -#endif opf.lpstrFilter = filter_string; opf.lpstrCustomFilter = 0; opf.nMaxCustFilter = 0L; @@ -1509,11 +1449,7 @@ void Export::detectSize() { } /* sp_export_detect_size */ /// Called when area x0 value is changed -#if WITH_GTKMM_3_0 void Export::areaXChange(Glib::RefPtr<Gtk::Adjustment>& adj) -#else -void Export::areaXChange (Gtk::Adjustment *adj) -#endif { float x0, x1, xdpi, width; @@ -1552,11 +1488,7 @@ void Export::areaXChange (Gtk::Adjustment *adj) } // end of sp_export_area_x_value_changed() /// Called when area y0 value is changed. -#if WITH_GTKMM_3_0 void Export::areaYChange(Glib::RefPtr<Gtk::Adjustment>& adj) -#else -void Export::areaYChange (Gtk::Adjustment *adj) -#endif { float y0, y1, ydpi, height; @@ -1863,11 +1795,7 @@ void Export::setArea( double x0, double y0, double x1, double y1 ) * @param adj The adjustment widget * @param val What value to set it to. */ -#if WITH_GTKMM_3_0 void Export::setValue(Glib::RefPtr<Gtk::Adjustment>& adj, double val ) -#else -void Export::setValue( Gtk::Adjustment *adj, double val ) -#endif { if (adj) { adj->set_value(val); @@ -1885,11 +1813,7 @@ void Export::setValue( Gtk::Adjustment *adj, double val ) * @param adj The adjustment widget * @param val What the value should be in points. */ -#if WITH_GTKMM_3_0 void Export::setValuePx(Glib::RefPtr<Gtk::Adjustment>& adj, double val) -#else -void Export::setValuePx( Gtk::Adjustment *adj, double val) -#endif { Unit const *unit = unit_selector.getUnit(); @@ -1908,11 +1832,7 @@ void Export::setValuePx( Gtk::Adjustment *adj, double val) * * @return The value in the specified adjustment. */ -#if WITH_GTKMM_3_0 float Export::getValue(Glib::RefPtr<Gtk::Adjustment>& adj) -#else -float Export::getValue( Gtk::Adjustment *adj ) -#endif { if (!adj) { g_message("sp_export_value_get : adj is NULL"); @@ -1934,11 +1854,7 @@ float Export::getValue( Gtk::Adjustment *adj ) * * @return The value in the adjustment in points. */ -#if WITH_GTKMM_3_0 float Export::getValuePx(Glib::RefPtr<Gtk::Adjustment>& adj) -#else -float Export::getValuePx( Gtk::Adjustment *adj ) -#endif { float value = getValue( adj); Unit const *unit = unit_selector.getUnit(); diff --git a/src/ui/dialog/export.h b/src/ui/dialog/export.h index 23af0109b..a1c44714b 100644 --- a/src/ui/dialog/export.h +++ b/src/ui/dialog/export.h @@ -79,17 +79,10 @@ private: /* * Getter/setter style functions for the spinbuttons */ -#if WITH_GTKMM_3_0 void setValue(Glib::RefPtr<Gtk::Adjustment>& adj, double val); void setValuePx(Glib::RefPtr<Gtk::Adjustment>& adj, double val); float getValue(Glib::RefPtr<Gtk::Adjustment>& adj); float getValuePx(Glib::RefPtr<Gtk::Adjustment>& adj); -#else - void setValue (Gtk::Adjustment *adj, double val); - void setValuePx (Gtk::Adjustment *adj, double val); - float getValue (Gtk::Adjustment *adj); - float getValuePx (Gtk::Adjustment *adj); -#endif /** * Helper function to create, style and pack spinbuttons for the export dialog. @@ -112,21 +105,12 @@ private: * * No unit_selector is stored in the created spinbutton, relies on external unit management */ -#if WITH_GTKMM_3_0 Glib::RefPtr<Gtk::Adjustment> createSpinbutton( gchar const *key, float val, float min, float max, float step, float page, Gtk::Grid *t, int x, int y, const Glib::ustring& ll, const Glib::ustring& lr, int digits, unsigned int sensitive, void (Export::*cb)() ); -#else - Gtk::Adjustment * createSpinbutton( gchar const *key, float val, float min, float max, - float step, float page, - Gtk::Table *t, int x, int y, - const Glib::ustring& ll, const Glib::ustring& lr, - int digits, unsigned int sensitive, - void (Export::*cb)() ); -#endif /** * One of the area select radio buttons was pressed @@ -152,11 +136,7 @@ private: void onAreaX1Change() { areaXChange(x1_adj); } ; -#if WITH_GTKMM_3_0 void areaXChange(Glib::RefPtr<Gtk::Adjustment>& adj); -#else - void areaXChange ( Gtk::Adjustment *adj); -#endif /** * Area Y value changed callback @@ -167,11 +147,7 @@ private: void onAreaY1Change() { areaYChange(y1_adj); } ; -#if WITH_GTKMM_3_0 void areaYChange(Glib::RefPtr<Gtk::Adjustment>& adj); -#else - void areaYChange ( Gtk::Adjustment *adj); -#endif /** * Unit changed callback @@ -298,7 +274,6 @@ private: Gtk::VBox area_box; Gtk::VBox singleexport_box; -#if WITH_GTKMM_3_0 /* Custom size widgets */ Glib::RefPtr<Gtk::Adjustment> x0_adj; Glib::RefPtr<Gtk::Adjustment> x1_adj; @@ -312,21 +287,6 @@ private: Glib::RefPtr<Gtk::Adjustment> bmheight_adj; Glib::RefPtr<Gtk::Adjustment> xdpi_adj; Glib::RefPtr<Gtk::Adjustment> ydpi_adj; -#else - /* Custom size widgets */ - Gtk::Adjustment *x0_adj; - Gtk::Adjustment *x1_adj; - Gtk::Adjustment *y0_adj; - Gtk::Adjustment *y1_adj; - Gtk::Adjustment *width_adj; - Gtk::Adjustment *height_adj; - - /* Bitmap size widgets */ - Gtk::Adjustment *bmwidth_adj; - Gtk::Adjustment *bmheight_adj; - Gtk::Adjustment *xdpi_adj; - Gtk::Adjustment *ydpi_adj; -#endif Gtk::VBox size_box; Gtk::Label* bm_label; diff --git a/src/ui/dialog/filedialog.cpp b/src/ui/dialog/filedialog.cpp index ee673aecf..df3c4a307 100644 --- a/src/ui/dialog/filedialog.cpp +++ b/src/ui/dialog/filedialog.cpp @@ -15,12 +15,18 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ -#include "filedialogimpl-win32.h" +#ifdef WIN32 +# include "filedialogimpl-win32.h" +# include "preferences.h" +#endif + #include "filedialogimpl-gtkmm.h" #include "ui/dialog-events.h" #include "extension/output.h" +#include <glibmm/convert.h> + namespace Inkscape { namespace UI diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp index 042637d22..e8c1bf723 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.cpp +++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp @@ -754,16 +754,9 @@ FileOpenDialogImplGtk::~FileOpenDialogImplGtk() void FileOpenDialogImplGtk::addFilterMenu(Glib::ustring name, Glib::ustring pattern) { - -#if WITH_GTKMM_3_0 - Glib::RefPtr<Gtk::FileFilter> allFilter = Gtk::FileFilter::create(); + auto allFilter = Gtk::FileFilter::create(); allFilter->set_name(_(name.c_str())); allFilter->add_pattern(pattern); -#else - Gtk::FileFilter allFilter; - allFilter.set_name(_(name.c_str())); - allFilter.add_pattern(pattern); -#endif extensionMap[Glib::ustring(_("All Files"))] = NULL; add_filter(allFilter); } @@ -775,51 +768,27 @@ void FileOpenDialogImplGtk::createFilterMenu() } if (_dialogType == EXE_TYPES) { -#if WITH_GTKMM_3_0 - Glib::RefPtr<Gtk::FileFilter> allFilter = Gtk::FileFilter::create(); + auto allFilter = Gtk::FileFilter::create(); allFilter->set_name(_("All Files")); allFilter->add_pattern("*"); -#else - Gtk::FileFilter allFilter; - allFilter.set_name(_("All Files")); - allFilter.add_pattern("*"); -#endif extensionMap[Glib::ustring(_("All Files"))] = NULL; add_filter(allFilter); } else { -#if WITH_GTKMM_3_0 - Glib::RefPtr<Gtk::FileFilter> allInkscapeFilter = Gtk::FileFilter::create(); + auto allInkscapeFilter = Gtk::FileFilter::create(); allInkscapeFilter->set_name(_("All Inkscape Files")); - Glib::RefPtr<Gtk::FileFilter> allFilter = Gtk::FileFilter::create(); + auto allFilter = Gtk::FileFilter::create(); allFilter->set_name(_("All Files")); allFilter->add_pattern("*"); - Glib::RefPtr<Gtk::FileFilter> allImageFilter = Gtk::FileFilter::create(); + auto allImageFilter = Gtk::FileFilter::create(); allImageFilter->set_name(_("All Images")); - Glib::RefPtr<Gtk::FileFilter> allVectorFilter = Gtk::FileFilter::create(); + auto allVectorFilter = Gtk::FileFilter::create(); allVectorFilter->set_name(_("All Vectors")); - Glib::RefPtr<Gtk::FileFilter> allBitmapFilter = Gtk::FileFilter::create(); + auto allBitmapFilter = Gtk::FileFilter::create(); allBitmapFilter->set_name(_("All Bitmaps")); -#else - Gtk::FileFilter allInkscapeFilter; - allInkscapeFilter.set_name(_("All Inkscape Files")); - - Gtk::FileFilter allFilter; - allFilter.set_name(_("All Files")); - allFilter.add_pattern("*"); - - Gtk::FileFilter allImageFilter; - allImageFilter.set_name(_("All Images")); - - Gtk::FileFilter allVectorFilter; - allVectorFilter.set_name(_("All Vectors")); - - Gtk::FileFilter allBitmapFilter; - allBitmapFilter.set_name(_("All Bitmaps")); -#endif extensionMap[Glib::ustring(_("All Inkscape Files"))] = NULL; add_filter(allInkscapeFilter); @@ -854,29 +823,16 @@ void FileOpenDialogImplGtk::createFilterMenu() Glib::ustring uname(_(imod->get_filetypename())); -#if WITH_GTKMM_3_0 - Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create(); + auto filter = Gtk::FileFilter::create(); filter->set_name(uname); filter->add_pattern(upattern); -#else - Gtk::FileFilter filter; - filter.set_name(uname); - filter.add_pattern(upattern); -#endif - add_filter(filter); extensionMap[uname] = imod; // g_message("ext %s:%s '%s'\n", ioext->name, ioext->mimetype, upattern.c_str()); -#if WITH_GTKMM_3_0 allInkscapeFilter->add_pattern(upattern); if (strncmp("image", imod->get_mimetype(), 5) == 0) allImageFilter->add_pattern(upattern); -#else - allInkscapeFilter.add_pattern(upattern); - if (strncmp("image", imod->get_mimetype(), 5) == 0) - allImageFilter.add_pattern(upattern); -#endif // uncomment this to find out all mime types supported by Inkscape import/open // g_print ("%s\n", imod->get_mimetype()); @@ -896,17 +852,9 @@ void FileOpenDialogImplGtk::createFilterMenu() strncmp("image/x-tga", imod->get_mimetype(), 11) == 0 || strncmp("image/x-pcx", imod->get_mimetype(), 11) == 0) { -#if WITH_GTKMM_3_0 allBitmapFilter->add_pattern(upattern); -#else - allBitmapFilter.add_pattern(upattern); -#endif } else { -#if WITH_GTKMM_3_0 allVectorFilter->add_pattern(upattern); -#else - allVectorFilter.add_pattern(upattern); -#endif } } } @@ -972,18 +920,13 @@ Glib::ustring FileOpenDialogImplGtk::getFilename(void) */ std::vector<Glib::ustring> FileOpenDialogImplGtk::getFilenames() { -#if WITH_GTKMM_3_0 - std::vector<std::string> result_tmp = get_filenames(); + auto result_tmp = get_filenames(); // Copy filenames to a vector of type Glib::ustring std::vector<Glib::ustring> result; - for (std::vector<std::string>::iterator it = result_tmp.begin(); it != result_tmp.end(); ++it) - result.push_back(*it); - -#else - std::vector<Glib::ustring> result = get_filenames(); -#endif + for (auto it : result_tmp) + result.push_back(it); #ifdef WITH_GNOME_VFS if (result.empty() && gnome_vfs_initialized()) @@ -1170,13 +1113,8 @@ void FileSaveDialogImplGtk::fileTypeChangedCallback() // g_message("selected: %s\n", type.name.c_str()); extension = type.extension; -#if WITH_GTKMM_3_0 - Glib::RefPtr<Gtk::FileFilter> filter = Gtk::FileFilter::create(); + auto filter = Gtk::FileFilter::create(); filter->add_pattern(type.pattern); -#else - Gtk::FileFilter filter; - filter.add_pattern(type.pattern); -#endif set_filter(filter); updateNameAndExtension(); diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp index cafc3be4f..02d77cba1 100644 --- a/src/ui/dialog/filedialogimpl-win32.cpp +++ b/src/ui/dialog/filedialogimpl-win32.cpp @@ -128,11 +128,7 @@ FileDialogBaseWin32::FileDialogBaseWin32(Gtk::Window &parent, Glib::RefPtr<const Gdk::Window> parentWindow = parent.get_window(); g_assert(parentWindow->gobj() != NULL); -#if WITH_GTKMM_3_0 _ownerHwnd = (HWND)gdk_win32_window_get_handle((GdkWindow*)parentWindow->gobj()); -#else - _ownerHwnd = (HWND)gdk_win32_drawable_get_handle((GdkDrawable*)parentWindow->gobj()); -#endif } FileDialogBaseWin32::~FileDialogBaseWin32() diff --git a/src/ui/dialog/fill-and-stroke.cpp b/src/ui/dialog/fill-and-stroke.cpp index fa69851e4..0b3b468e9 100644 --- a/src/ui/dialog/fill-and-stroke.cpp +++ b/src/ui/dialog/fill-and-stroke.cpp @@ -107,11 +107,7 @@ void FillAndStroke::setTargetDesktop(SPDesktop *desktop) } } -#if WITH_GTKMM_3_0 void FillAndStroke::_onSwitchPage(Gtk::Widget * /*page*/, guint pagenum) -#else -void FillAndStroke::_onSwitchPage(GtkNotebookPage * /*page*/, guint pagenum) -#endif { _savePagePref(pagenum); } @@ -128,24 +124,14 @@ void FillAndStroke::_layoutPageFill() { fillWdgt = Gtk::manage(sp_fill_style_widget_new()); - -#if WITH_GTKMM_3_0 _page_fill->table().attach(*fillWdgt, 0, 0, 1, 1); -#else - _page_fill->table().attach(*fillWdgt, 0, 1, 0, 1); -#endif } void FillAndStroke::_layoutPageStrokePaint() { strokeWdgt = Gtk::manage(sp_stroke_style_paint_widget_new()); - -#if WITH_GTKMM_3_0 _page_stroke_paint->table().attach(*strokeWdgt, 0, 0, 1, 1); -#else - _page_stroke_paint->table().attach(*strokeWdgt, 0, 1, 0, 1); -#endif } void @@ -154,12 +140,7 @@ FillAndStroke::_layoutPageStrokeStyle() //Gtk::Widget *strokeStyleWdgt = manage(Glib::wrap(sp_stroke_style_line_widget_new())); //Gtk::Widget *strokeStyleWdgt = static_cast<Gtk::Widget *>(sp_stroke_style_line_widget_new()); strokeStyleWdgt = sp_stroke_style_line_widget_new(); - -#if WITH_GTKMM_3_0 _page_stroke_style->table().attach(*strokeStyleWdgt, 0, 0, 1, 1); -#else - _page_stroke_style->table().attach(*strokeStyleWdgt, 0, 1, 0, 1); -#endif } void diff --git a/src/ui/dialog/fill-and-stroke.h b/src/ui/dialog/fill-and-stroke.h index f2a6bf39d..67e9d60ed 100644 --- a/src/ui/dialog/fill-and-stroke.h +++ b/src/ui/dialog/fill-and-stroke.h @@ -64,11 +64,7 @@ protected: void _layoutPageStrokePaint(); void _layoutPageStrokeStyle(); void _savePagePref(guint page_num); -#if WITH_GTKMM_3_0 void _onSwitchPage(Gtk::Widget *page, guint pagenum); -#else - void _onSwitchPage(GtkNotebookPage *page, guint pagenum); -#endif private: FillAndStroke(FillAndStroke const &d); diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index f2a6f8b95..8dbc90cc5 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" @@ -300,15 +298,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. @@ -317,13 +309,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(); } @@ -340,15 +327,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 } }; @@ -1710,7 +1691,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 @@ -1744,27 +1724,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) @@ -1772,13 +1731,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); @@ -1940,25 +1894,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 @@ -1966,7 +1904,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); @@ -1984,9 +1922,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(); @@ -2005,25 +1940,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(); @@ -2040,24 +1965,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); @@ -2080,17 +1997,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); @@ -2116,17 +2026,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); @@ -2149,17 +2052,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); @@ -2195,8 +2091,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); @@ -2206,9 +2101,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); @@ -2224,11 +2116,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); @@ -2651,8 +2539,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) @@ -2661,25 +2548,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) @@ -2688,18 +2563,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(); } @@ -2741,13 +2604,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 5ac3a25ad..fa8e11dfd 100644 --- a/src/ui/dialog/floating-behavior.cpp +++ b/src/ui/dialog/floating-behavior.cpp @@ -138,11 +138,7 @@ FloatingBehavior::create(Dialog &dialog) inline FloatingBehavior::operator Gtk::Widget &() { return *_d; } inline GtkWidget *FloatingBehavior::gobj() { return GTK_WIDGET(_d->gobj()); } inline Gtk::Box* FloatingBehavior::get_vbox() { -#if WITH_GTKMM_3_0 return _d->get_content_area(); -#else - return _d->get_vbox(); -#endif } inline void FloatingBehavior::present() { _d->present(); } inline void FloatingBehavior::hide() { _d->hide(); } @@ -153,12 +149,8 @@ inline void FloatingBehavior::move(int x, int y) { _d-> inline void FloatingBehavior::set_position(Gtk::WindowPosition position) { _d->set_position(position); } inline void FloatingBehavior::set_size_request(int width, int height) { _d->set_size_request(width, height); } inline void FloatingBehavior::size_request(Gtk::Requisition &requisition) { -#if WITH_GTKMM_3_0 Gtk::Requisition requisition_natural; _d->get_preferred_size(requisition, requisition_natural); -#else - requisition = _d->size_request(); -#endif } inline void FloatingBehavior::get_position(int &x, int &y) { _d->get_position(x, y); } inline void FloatingBehavior::get_size(int &width, int &height) { _d->get_size(width, height); } diff --git a/src/ui/dialog/font-substitution.cpp b/src/ui/dialog/font-substitution.cpp index 0b85c8c0d..abae8ea70 100644 --- a/src/ui/dialog/font-substitution.cpp +++ b/src/ui/dialog/font-substitution.cpp @@ -101,11 +101,7 @@ FontSubstitution::show(Glib::ustring out, std::vector<SPItem*> &l) cbWarning->set_label(_("Don't show this warning again")); cbWarning->show(); -#if GTK_CHECK_VERSION(3,0,0) - Gtk::Box * box = warning.get_content_area(); -#else - Gtk::Box * box = warning.get_vbox(); -#endif + auto box = warning.get_content_area(); box->set_spacing(2); box->pack_start(*scrollwindow, true, true, 4); box->pack_start(*cbSelect, false, false, 0); diff --git a/src/ui/dialog/glyphs.cpp b/src/ui/dialog/glyphs.cpp index 502f49894..9c1236ca9 100644 --- a/src/ui/dialog/glyphs.cpp +++ b/src/ui/dialog/glyphs.cpp @@ -14,16 +14,11 @@ #include <glibmm/i18n.h> #include <gtkmm/alignment.h> #include <gtkmm/comboboxtext.h> +#include <gtkmm/grid.h> #include <gtkmm/iconview.h> #include <gtkmm/liststore.h> #include <gtkmm/scrolledwindow.h> -#if WITH_GTKMM_3_0 -# include <gtkmm/grid.h> -#else -# include <gtkmm/table.h> -#endif - #include "desktop.h" #include "document.h" // for SPDocumentUndo::done() #include "document-undo.h" @@ -337,12 +332,7 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : instanceConns(), desktopConns() { -#if WITH_GTKMM_3_0 - Gtk::Grid *table = new Gtk::Grid(); -#else - Gtk::Table *table = new Gtk::Table(3, 1, false); -#endif - + auto table = new Gtk::Grid(); _getContents()->pack_start(*Gtk::manage(table), Gtk::PACK_EXPAND_WIDGET); guint row = 0; @@ -355,29 +345,16 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : gtk_widget_set_size_request (fontsel, 0, 150); g_signal_connect( G_OBJECT(fontsel), "font_set", G_CALLBACK(fontChangeCB), this ); -#if WITH_GTKMM_3_0 table->attach(*Gtk::manage(Glib::wrap(fontsel)), 0, row, 3, 1); -#else - table->attach(*Gtk::manage(Glib::wrap(fontsel)), - 0, 3, row, row + 1, - Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL); -#endif - row++; // ------------------------------- { - Gtk::Label *label = new Gtk::Label(_("Script: ")); + auto label = new Gtk::Label(_("Script: ")); -#if WITH_GTKMM_3_0 table->attach( *Gtk::manage(label), 0, row, 1, 1); -#else - table->attach( *Gtk::manage(label), - 0, 1, row, row + 1, - Gtk::SHRINK, Gtk::SHRINK); -#endif scriptCombo = new Gtk::ComboBoxText(); for (std::map<GUnicodeScript, Glib::ustring>::iterator it = getScriptToName().begin(); it != getScriptToName().end(); ++it) @@ -391,14 +368,8 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : Gtk::Alignment *align = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_START, Gtk::ALIGN_START, 0.0, 0.0)); align->add(*Gtk::manage(scriptCombo)); -#if WITH_GTKMM_3_0 align->set_hexpand(); table->attach( *align, 1, row, 1, 1); -#else - table->attach( *align, - 1, 2, row, row + 1, - Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK); -#endif } row++; @@ -406,15 +377,8 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : // ------------------------------- { - Gtk::Label *label = new Gtk::Label(_("Range: ")); - -#if WITH_GTKMM_3_0 + auto label = new Gtk::Label(_("Range: ")); table->attach( *Gtk::manage(label), 0, row, 1, 1); -#else - table->attach( *Gtk::manage(label), - 0, 1, row, row + 1, - Gtk::SHRINK, Gtk::SHRINK); -#endif rangeCombo = new Gtk::ComboBoxText(); for ( std::vector<NamedRange>::iterator it = getRanges().begin(); it != getRanges().end(); ++it ) { @@ -426,15 +390,8 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : instanceConns.push_back(conn); Gtk::Alignment *align = new Gtk::Alignment(Gtk::ALIGN_START, Gtk::ALIGN_START, 0.0, 0.0); align->add(*Gtk::manage(rangeCombo)); - -#if WITH_GTKMM_3_0 align->set_hexpand(); table->attach( *Gtk::manage(align), 1, row, 1, 1); -#else - table->attach( *Gtk::manage(align), - 1, 2, row, row + 1, - Gtk::FILL|Gtk::EXPAND, Gtk::SHRINK); -#endif } row++; @@ -457,16 +414,9 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : Gtk::ScrolledWindow *scroller = new Gtk::ScrolledWindow(); scroller->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_ALWAYS); scroller->add(*Gtk::manage(iconView)); - -#if WITH_GTKMM_3_0 scroller->set_hexpand(); scroller->set_vexpand(); table->attach(*Gtk::manage(scroller), 0, row, 3, 1); -#else - table->attach(*Gtk::manage(scroller), - 0, 3, row, row + 1, - Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL); -#endif row++; @@ -496,15 +446,8 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : insertBtn->set_sensitive(false); box->pack_end(*Gtk::manage(insertBtn), Gtk::PACK_SHRINK); - -#if WITH_GTKMM_3_0 box->set_hexpand(); table->attach( *Gtk::manage(box), 0, row, 3, 1); -#else - table->attach( *Gtk::manage(box), - 0, 3, row, row + 1, - Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK); -#endif row++; @@ -586,12 +529,7 @@ void GlyphsPanel::insertText() if (entry->get_text_length() > 0) { glyphs = entry->get_text(); } else { - -#if WITH_GTKMM_3_0 - std::vector<Gtk::TreePath> itemArray = iconView->get_selected_items(); -#else - Gtk::IconView::ArrayHandle_TreePaths itemArray = iconView->get_selected_items(); -#endif + auto itemArray = iconView->get_selected_items(); if (!itemArray.empty()) { Gtk::TreeModel::Path const & path = *itemArray.begin(); @@ -636,11 +574,7 @@ void GlyphsPanel::glyphActivated(Gtk::TreeModel::Path const & path) void GlyphsPanel::glyphSelectionChanged() { -#if WITH_GTKMM_3_0 - std::vector<Gtk::TreePath> itemArray = iconView->get_selected_items(); -#else - Gtk::IconView::ArrayHandle_TreePaths itemArray = iconView->get_selected_items(); -#endif + auto itemArray = iconView->get_selected_items(); if (itemArray.empty()) { label->set_text(" "); diff --git a/src/ui/dialog/grid-arrange-tab.cpp b/src/ui/dialog/grid-arrange-tab.cpp index 692a2fac0..5872393ae 100644 --- a/src/ui/dialog/grid-arrange-tab.cpp +++ b/src/ui/dialog/grid-arrange-tab.cpp @@ -17,12 +17,9 @@ #include "ui/dialog/grid-arrange-tab.h" #include <glibmm/i18n.h> -#include <gtkmm/stock.h> -#if WITH_GTKMM_3_0 -# include <gtkmm/grid.h> -#else -#endif +#include <gtkmm/grid.h> +#include <gtkmm/stock.h> #include <2geom/transforms.h> @@ -572,11 +569,7 @@ GridArrangeTab::GridArrangeTab(ArrangeDialog *parent) : Parent(parent), XPadding(_("X:"), _("Horizontal spacing between columns."), UNIT_TYPE_LINEAR, "", "object-columns", &PaddingUnitMenu), YPadding(_("Y:"), _("Vertical spacing between rows."), XPadding, "", "object-rows", &PaddingUnitMenu), -#if WITH_GTKMM_3_0 PaddingTable(Gtk::manage(new Gtk::Grid())) -#else - PaddingTable(Gtk::manage(new Gtk::Table(2, 2, false))) -#endif { // bool used by spin button callbacks to stop loops where they change each other. updating = false; @@ -738,20 +731,11 @@ GridArrangeTab::GridArrangeTab(ArrangeDialog *parent) } PaddingTable->set_border_width(MARGIN); - -#if WITH_GTKMM_3_0 PaddingTable->set_row_spacing(MARGIN); PaddingTable->set_column_spacing(MARGIN); PaddingTable->attach(XPadding, 0, 0, 1, 1); PaddingTable->attach(PaddingUnitMenu, 1, 0, 1, 1); PaddingTable->attach(YPadding, 0, 1, 1, 1); -#else - PaddingTable->set_row_spacings(MARGIN); - PaddingTable->set_col_spacings(MARGIN); - PaddingTable->attach(XPadding, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK); - PaddingTable->attach(PaddingUnitMenu, 1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK); - PaddingTable->attach(YPadding, 0, 1, 1, 2, Gtk::SHRINK, Gtk::SHRINK); -#endif TileBox.pack_start(*PaddingTable, false, false, MARGIN); diff --git a/src/ui/dialog/grid-arrange-tab.h b/src/ui/dialog/grid-arrange-tab.h index a137d1694..891849f1a 100644 --- a/src/ui/dialog/grid-arrange-tab.h +++ b/src/ui/dialog/grid-arrange-tab.h @@ -111,12 +111,7 @@ private: Inkscape::UI::Widget::UnitMenu PaddingUnitMenu; Inkscape::UI::Widget::ScalarUnit XPadding; Inkscape::UI::Widget::ScalarUnit YPadding; - -#if WITH_GTKMM_3_0 Gtk::Grid *PaddingTable; -#else - Gtk::Table *PaddingTable; -#endif // BBox or manual spacing Gtk::VBox SpacingVBox; diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp index 469bd5155..8d6ca4143 100644 --- a/src/ui/dialog/guides.cpp +++ b/src/ui/dialog/guides.cpp @@ -120,13 +120,8 @@ void GuidelinePropertiesDialog::_onOK() g_free((gpointer) name); -#if WITH_GTKMM_3_0 - const Gdk::RGBA c = _color.get_rgba(); + const auto c = _color.get_rgba(); unsigned r = c.get_red_u()/257, g = c.get_green_u()/257, b = c.get_blue_u()/257; -#else - const Gdk::Color c = _color.get_color(); - unsigned r = c.get_red()/257, g = c.get_green()/257, b = c.get_blue()/257; -#endif //TODO: why 257? verify this! _guide->set_color(r, g, b, true); @@ -167,15 +162,9 @@ void GuidelinePropertiesDialog::_setup() { add_button(Gtk::Stock::DELETE, -12); add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); -#if WITH_GTKMM_3_0 - Gtk::Box *mainVBox = get_content_area(); + auto mainVBox = get_content_area(); _layout_table.set_row_spacing(4); _layout_table.set_column_spacing(4); -#else - Gtk::Box *mainVBox = get_vbox(); - _layout_table.set_spacings(4); - _layout_table.resize (3, 4); -#endif mainVBox->pack_start(_layout_table, false, false, 0); @@ -185,7 +174,6 @@ void GuidelinePropertiesDialog::_setup() { _label_descr.set_label("foo1"); _label_descr.set_alignment(0, 0.5); -#if WITH_GTKMM_3_0 _label_name.set_halign(Gtk::ALIGN_FILL); _label_name.set_valign(Gtk::ALIGN_FILL); _layout_table.attach(_label_name, 0, 0, 3, 1); @@ -203,19 +191,6 @@ void GuidelinePropertiesDialog::_setup() { _color.set_valign(Gtk::ALIGN_FILL); _color.set_hexpand(); _layout_table.attach(_color, 1, 3, 2, 1); -#else - _layout_table.attach(_label_name, - 0, 3, 0, 1, Gtk::FILL, Gtk::FILL); - - _layout_table.attach(_label_descr, - 0, 3, 1, 2, Gtk::FILL, Gtk::FILL); - - _layout_table.attach(_label_entry, - 1, 3, 2, 3, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); - - _layout_table.attach(_color, - 1, 3, 3, 4, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); -#endif // unitmenus /* fixme: We should allow percents here too, as percents of the canvas size */ @@ -234,7 +209,6 @@ void GuidelinePropertiesDialog::_setup() { _spin_button_y.setIncrements(1.0, 10.0); _spin_button_y.setRange(-1e6, 1e6); -#if WITH_GTKMM_3_0 _spin_button_x.set_halign(Gtk::ALIGN_FILL); _spin_button_x.set_valign(Gtk::ALIGN_FILL); _spin_button_x.set_hexpand(); @@ -248,22 +222,12 @@ void GuidelinePropertiesDialog::_setup() { _unit_menu.set_halign(Gtk::ALIGN_FILL); _unit_menu.set_valign(Gtk::ALIGN_FILL); _layout_table.attach(_unit_menu, 2, 4, 1, 1); -#else - _layout_table.attach(_spin_button_x, - 1, 2, 4, 5, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); - _layout_table.attach(_spin_button_y, - 1, 2, 5, 6, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); - - _layout_table.attach(_unit_menu, - 2, 3, 4, 5, Gtk::FILL, Gtk::FILL); -#endif // angle spinbutton _spin_angle.setDigits(3); _spin_angle.setIncrements(1.0, 10.0); _spin_angle.setRange(-3600., 3600.); -#if WITH_GTKMM_3_0 _spin_angle.set_halign(Gtk::ALIGN_FILL); _spin_angle.set_valign(Gtk::ALIGN_FILL); _spin_angle.set_hexpand(); @@ -280,18 +244,6 @@ void GuidelinePropertiesDialog::_setup() { _locked_toggle.set_valign(Gtk::ALIGN_FILL); _locked_toggle.set_hexpand(); _layout_table.attach(_locked_toggle, 1, 8, 2, 1); -#else - _layout_table.attach(_spin_angle, - 1, 3, 6, 7, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); - - // mode radio button - _layout_table.attach(_relative_toggle, - 1, 3, 7, 8, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); - - // locked radio button - _layout_table.attach(_locked_toggle, - 1, 3, 8, 9, Gtk::EXPAND | Gtk::FILL, Gtk::FILL); -#endif _relative_toggle.signal_toggled().connect(sigc::mem_fun(*this, &GuidelinePropertiesDialog::_modeChanged)); _relative_toggle.set_active(_relative_toggle_status); @@ -344,15 +296,9 @@ void GuidelinePropertiesDialog::_setup() { // init name entry _label_entry.getEntry()->set_text(_guide->getLabel() ? _guide->getLabel() : ""); -#if WITH_GTKMM_3_0 Gdk::RGBA c; c.set_rgba(((_guide->getColor()>>24)&0xff) / 255.0, ((_guide->getColor()>>16)&0xff) / 255.0, ((_guide->getColor()>>8)&0xff) / 255.0); _color.set_rgba(c); -#else - Gdk::Color c; - c.set_rgb_p(((_guide->getColor()>>24)&0xff) / 255.0, ((_guide->getColor()>>16)&0xff) / 255.0, ((_guide->getColor()>>8)&0xff) / 255.0); - _color.set_color(c); -#endif _modeChanged(); // sets values of spinboxes. diff --git a/src/ui/dialog/guides.h b/src/ui/dialog/guides.h index 5dce0d6ed..25d32015c 100644 --- a/src/ui/dialog/guides.h +++ b/src/ui/dialog/guides.h @@ -16,12 +16,7 @@ #endif #include <gtkmm/dialog.h> - -#if WITH_GTKMM_3_0 #include <gtkmm/grid.h> -#else -#include <gtkmm/table.h> -#endif #include <gtkmm/label.h> #include <gtkmm/colorbutton.h> @@ -71,12 +66,7 @@ private: SPDesktop *_desktop; SPGuide *_guide; -#if WITH_GTKMM_3_0 - Gtk::Grid _layout_table; -#else - Gtk::Table _layout_table; -#endif - + Gtk::Grid _layout_table; Gtk::Label _label_name; Gtk::Label _label_descr; Inkscape::UI::Widget::CheckButton _locked_toggle; diff --git a/src/ui/dialog/icon-preview.h b/src/ui/dialog/icon-preview.h index 8a6e19a25..caec7e3b5 100644 --- a/src/ui/dialog/icon-preview.h +++ b/src/ui/dialog/icon-preview.h @@ -66,13 +66,7 @@ private: gdouble minDelay; Gtk::VBox iconBox; - -#if WITH_GTKMM_3_0 Gtk::Paned splitter; -#else - Gtk::HPaned splitter; -#endif - Glib::ustring targetId; int hot; int numEntries; diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 2f4ac8606..4574e93fe 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -78,12 +78,8 @@ InkscapePreferences::InkscapePreferences() _getContents()->add(*sb); show_all_children(); Gtk::Requisition sreq; -#if WITH_GTKMM_3_0 Gtk::Requisition sreq_natural; sb->get_preferred_size(sreq_natural, sreq); -#else - sreq = sb->size_request(); -#endif _sb_width = sreq.width; _getContents()->remove(*sb); delete sb; @@ -855,17 +851,10 @@ static void proofComboChanged( Gtk::ComboBoxText* combo ) } static void gamutColorChanged( Gtk::ColorButton* btn ) { -#if WITH_GTKMM_3_0 - Gdk::RGBA rgba = btn->get_rgba(); - gushort r = rgba.get_red_u(); - gushort g = rgba.get_green_u(); - gushort b = rgba.get_blue_u(); -#else - Gdk::Color color = btn->get_color(); - gushort r = color.get_red(); - gushort g = color.get_green(); - gushort b = color.get_blue(); -#endif + auto rgba = btn->get_rgba(); + auto r = rgba.get_red_u(); + auto g = rgba.get_green_u(); + auto b = rgba.get_blue_u(); gchar* tmp = g_strdup_printf("#%02x%02x%02x", (r >> 8), (g >> 8), (b >> 8) ); @@ -1035,13 +1024,8 @@ void InkscapePreferences::initPageIO() Glib::ustring colorStr = prefs->getString("/options/softproof/gamutcolor"); -#if WITH_GTKMM_3_0 Gdk::RGBA tmpColor( colorStr.empty() ? "#00ff00" : colorStr); _cms_gamutcolor.set_rgba( tmpColor ); -#else - Gdk::Color tmpColor( colorStr.empty() ? "#00ff00" : colorStr); - _cms_gamutcolor.set_color( tmpColor ); -#endif _page_cms.add_line( true, _("Out of gamut warning color:"), _cms_gamutcolor, "", _("Selects the color used for out of gamut warning"), false); @@ -1586,31 +1570,19 @@ void InkscapePreferences::initKeyboardShortcuts(Gtk::TreeModel::iterator iter_ui int row = 3; -#if WITH_GTKMM_3_0 scroller->set_hexpand(); scroller->set_vexpand(); _page_keyshortcuts.attach(*scroller, 0, row, 2, 1); -#else - _page_keyshortcuts.attach(*scroller, 0, 2, row, row+1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL); -#endif row++; -#if WITH_GTKMM_3_0 - Gtk::ButtonBox *box_buttons = Gtk::manage(new Gtk::ButtonBox); -#else - Gtk::HButtonBox *box_buttons = Gtk::manage (new Gtk::HButtonBox); -#endif + auto box_buttons = Gtk::manage(new Gtk::ButtonBox); box_buttons->set_layout(Gtk::BUTTONBOX_END); box_buttons->set_spacing(4); -#if WITH_GTKMM_3_0 box_buttons->set_hexpand(); _page_keyshortcuts.attach(*box_buttons, 0, row, 3, 1); -#else - _page_keyshortcuts.attach(*box_buttons, 0, 3, row, row+1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK); -#endif UI::Widget::Button *kb_reset = Gtk::manage(new UI::Widget::Button(_("Reset"), _("Remove all your customized keyboard shortcuts, and revert to the shortcuts in the shortcut file listed above"))); box_buttons->pack_start(*kb_reset, true, true, 6); @@ -2043,12 +2015,8 @@ bool InkscapePreferences::SetMaxDialogSize(const Gtk::TreeModel::iterator& iter) _page_frame.add(*page); this->show_all_children(); Gtk::Requisition sreq; -#if WITH_GTKMM_3_0 Gtk::Requisition sreq_natural; this->get_preferred_size(sreq_natural, sreq); -#else - sreq = this->size_request(); -#endif _max_dialog_width=std::max(_max_dialog_width, sreq.width); _max_dialog_height=std::max(_max_dialog_height, sreq.height); _page_frame.remove(); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index d1abcfc58..781b5e48e 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -97,11 +97,7 @@ enum { }; namespace Gtk { -#if WITH_GTKMM_3_0 class Scale; -#else -class HScale; -#endif } namespace Inkscape { @@ -206,11 +202,7 @@ protected: UI::Widget::PrefCheckButton _scroll_space; UI::Widget::PrefCheckButton _wheel_zoom; -#if WITH_GTKMM_3_0 Gtk::Scale *_slider_snapping_delay; -#else - Gtk::HScale *_slider_snapping_delay; -#endif UI::Widget::PrefCheckButton _snap_indicator; UI::Widget::PrefCheckButton _snap_closest_only; diff --git a/src/ui/dialog/input.cpp b/src/ui/dialog/input.cpp index 1bfb59ae5..9fd2288e7 100644 --- a/src/ui/dialog/input.cpp +++ b/src/ui/dialog/input.cpp @@ -21,19 +21,13 @@ #include <gtkmm/cellrenderercombo.h> #include <gtkmm/checkbutton.h> #include <gtkmm/comboboxtext.h> +#include <gtkmm/grid.h> #include <gtkmm/liststore.h> #include <gtkmm/menubar.h> #include <gtkmm/notebook.h> #include <gtkmm/paned.h> #include <gtkmm/progressbar.h> #include <gtkmm/scrolledwindow.h> - -#if WITH_GTKMM_3_0 -# include <gtkmm/grid.h> -#else -# include <gtkmm/table.h> -#endif - #include <gtkmm/treestore.h> #include "device-manager.h" @@ -422,13 +416,7 @@ private: Blink watcher; Gtk::CheckButton useExt; Gtk::Button save; - -#if WITH_GTKMM_3_0 Gtk::Paned pane; -#else - Gtk::HPaned pane; -#endif - Gtk::VBox detailsBox; Gtk::HBox titleFrame; Gtk::Label titleLabel; @@ -489,27 +477,14 @@ private: Inkscape::UI::Widget::Frame axisFrame; Gtk::ScrolledWindow treeScroller; Gtk::ScrolledWindow detailScroller; - -#if WITH_GTKMM_3_0 Gtk::Paned splitter; Gtk::Paned split2; -#else - Gtk::HPaned splitter; - Gtk::VPaned split2; -#endif - Gtk::Label devName; Gtk::Label devKeyCount; Gtk::Label devAxesCount; Gtk::ComboBoxText axesCombo; Gtk::ProgressBar axesValues[6]; - -#if WITH_GTKMM_3_0 Gtk::Grid axisTable; -#else - Gtk::Table axisTable; -#endif - Gtk::ComboBoxText buttonCombo; Gtk::ComboBoxText linkCombo; sigc::connection linkConnection; @@ -519,13 +494,7 @@ private: Gtk::Image testThumb; Gtk::Image testButtons[24]; Gtk::Image testAxes[8]; - -#if WITH_GTKMM_3_0 Gtk::Grid imageTable; -#else - Gtk::Table imageTable; -#endif - Gtk::EventBox testDetector; ConfPanel cfgPanel; @@ -611,20 +580,11 @@ InputDialogImpl::InputDialogImpl() : treeScroller(), detailScroller(), splitter(), -#if WITH_GTKMM_3_0 split2(Gtk::ORIENTATION_VERTICAL), axisTable(), -#else - split2(), - axisTable(11, 2), -#endif linkCombo(), topHolder(), -#if WITH_GTKMM_3_0 imageTable(), -#else - imageTable(8, 7), -#endif testDetector(), cfgPanel() { @@ -646,27 +606,16 @@ InputDialogImpl::InputDialogImpl() : testFrame.add(testDetector); testThumb.set(getPix(PIX_TABLET)); testThumb.set_padding(24, 24); - -#if WITH_GTKMM_3_0 testThumb.set_hexpand(); testThumb.set_vexpand(); imageTable.attach(testThumb, 0, 0, 8, 1); -#else - imageTable.attach(testThumb, 0, 8, 0, 1, ::Gtk::EXPAND, ::Gtk::EXPAND); -#endif { guint col = 0; guint row = 1; for ( guint num = 0; num < G_N_ELEMENTS(testButtons); num++ ) { testButtons[num].set(getPix(PIX_BUTTONS_NONE)); - -#if WITH_GTKMM_3_0 imageTable.attach(testButtons[num], col, row, 1, 1); -#else - imageTable.attach(testButtons[num], col, col + 1, row, row + 1, ::Gtk::FILL, ::Gtk::FILL); -#endif - col++; if (col > 7) { col = 0; @@ -677,13 +626,7 @@ InputDialogImpl::InputDialogImpl() : col = 0; for ( guint num = 0; num < G_N_ELEMENTS(testAxes); num++ ) { testAxes[num].set(getPix(PIX_AXIS_NONE)); - -#if WITH_GTKMM_3_0 imageTable.attach(testAxes[num], col * 2, row, 2, 1); -#else - imageTable.attach(testAxes[num], col * 2, (col + 1) * 2, row, row + 1, ::Gtk::FILL, ::Gtk::FILL); -#endif - col++; if (col > 3) { col = 0; @@ -721,45 +664,17 @@ InputDialogImpl::InputDialogImpl() : axisFrame.add(axisTable); Gtk::Label *lbl = Gtk::manage(new Gtk::Label(_("Link:"))); - -#if WITH_GTKMM_3_0 axisTable.attach(*lbl, 0, rowNum, 1, 1); -#else - axisTable.attach(*lbl, 0, 1, rowNum, rowNum+ 1, - ::Gtk::FILL, - ::Gtk::SHRINK); -#endif - linkCombo.append(_("None")); linkCombo.set_active_text(_("None")); linkCombo.set_sensitive(false); linkConnection = linkCombo.signal_changed().connect(sigc::mem_fun(*this, &InputDialogImpl::linkComboChanged)); - -#if WITH_GTKMM_3_0 axisTable.attach(linkCombo, 1, rowNum, 1, 1); -#else - axisTable.attach(linkCombo, 1, 2, rowNum, rowNum + 1, - ::Gtk::FILL, - ::Gtk::SHRINK); -#endif - rowNum++; - lbl = Gtk::manage(new Gtk::Label(_("Axes count:"))); - -#if WITH_GTKMM_3_0 axisTable.attach(*lbl, 0, rowNum, 1, 1); axisTable.attach(devAxesCount, 1, rowNum, 1, 1); -#else - axisTable.attach(*lbl, 0, 1, rowNum, rowNum+ 1, - ::Gtk::FILL, - ::Gtk::SHRINK); - axisTable.attach(devAxesCount, 1, 2, rowNum, rowNum + 1, - ::Gtk::SHRINK, - ::Gtk::SHRINK); -#endif - rowNum++; @@ -777,22 +692,11 @@ InputDialogImpl::InputDialogImpl() : for ( guint barNum = 0; barNum < static_cast<guint>(G_N_ELEMENTS(axesValues)); barNum++ ) { lbl = Gtk::manage(new Gtk::Label(_("axis:"))); - -#if WITH_GTKMM_3_0 lbl->set_hexpand(); axisTable.attach(*lbl, 0, rowNum, 1, 1); axesValues[barNum].set_hexpand(); axisTable.attach(axesValues[barNum], 1, rowNum, 1, 1); -#else - axisTable.attach(*lbl, 0, 1, rowNum, rowNum+ 1, - ::Gtk::EXPAND, - ::Gtk::SHRINK); - axisTable.attach(axesValues[barNum], 1, 2, rowNum, rowNum + 1, - ::Gtk::EXPAND, - ::Gtk::SHRINK); -#endif - axesValues[barNum].set_sensitive(false); rowNum++; @@ -802,17 +706,8 @@ InputDialogImpl::InputDialogImpl() : lbl = Gtk::manage(new Gtk::Label(_("Button count:"))); -#if WITH_GTKMM_3_0 axisTable.attach(*lbl, 0, rowNum, 1, 1); axisTable.attach(devKeyCount, 1, rowNum, 1, 1); -#else - axisTable.attach(*lbl, 0, 1, rowNum, rowNum+ 1, - ::Gtk::FILL, - ::Gtk::SHRINK); - axisTable.attach(devKeyCount, 1, 2, rowNum, rowNum + 1, - ::Gtk::SHRINK, - ::Gtk::SHRINK); -#endif rowNum++; @@ -828,13 +723,7 @@ InputDialogImpl::InputDialogImpl() : rowNum++; */ -#if WITH_GTKMM_3_0 axisTable.attach(keyVal, 0, rowNum, 2, 1); -#else - axisTable.attach(keyVal, 0, 2, rowNum, rowNum + 1, - ::Gtk::FILL, - ::Gtk::SHRINK); -#endif rowNum++; @@ -848,18 +737,9 @@ InputDialogImpl::InputDialogImpl() : // TODO: Extension event stuff has been removed from public API in GTK+ 3 // Need to check that this hasn't broken anything -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_set_extension_events( GTK_WIDGET(testDetector.gobj()), GDK_EXTENSION_EVENTS_ALL ); -#endif testDetector.add_events(Gdk::POINTER_MOTION_MASK|Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK |Gdk::PROXIMITY_IN_MASK|Gdk::PROXIMITY_OUT_MASK|Gdk::SCROLL_MASK); -#if WITH_GTKMM_3_0 axisTable.attach(keyEntry, 0, rowNum, 2, 1); -#else - axisTable.attach(keyEntry, 0, 2, rowNum, rowNum + 1, - ::Gtk::FILL, - ::Gtk::SHRINK); -#endif rowNum++; @@ -1141,12 +1021,7 @@ InputDialogImpl::ConfPanel::ConfPanel() : useExt.set_active(Preferences::get()->getBool("/options/useextinput/value")); useExt.signal_toggled().connect(sigc::mem_fun(*this, &InputDialogImpl::ConfPanel::useExtToggled)); -#if WITH_GTKMM_3_0 - Gtk::ButtonBox *buttonBox = Gtk::manage(new Gtk::ButtonBox); -#else - Gtk::HButtonBox *buttonBox = Gtk::manage (new Gtk::HButtonBox); -#endif - + auto buttonBox = Gtk::manage(new Gtk::ButtonBox); buttonBox->set_layout (Gtk::BUTTONBOX_END); //Gtk::Alignment *align = new Gtk::Alignment(Gtk::ALIGN_END, Gtk::ALIGN_START, 0, 0); buttonBox->add(save); @@ -1930,7 +1805,6 @@ bool InputDialogImpl::eventSnoop(GdkEvent* event) testThumb.set(getPix(PIX_ERASER)); break; } -#if WITH_GTKMM_3_0 /// \fixme GTK3 added new GDK_SOURCEs that should be handled here! case GDK_SOURCE_KEYBOARD: case GDK_SOURCE_TOUCHSCREEN: @@ -1938,7 +1812,6 @@ bool InputDialogImpl::eventSnoop(GdkEvent* event) g_warning("InputDialogImpl::eventSnoop : unhandled GDK_SOURCE type!"); break; } -#endif } updateTestButtons(key, hotButton); diff --git a/src/ui/dialog/layer-properties.cpp b/src/ui/dialog/layer-properties.cpp index 9cfc21e18..4aa86cc48 100644 --- a/src/ui/dialog/layer-properties.cpp +++ b/src/ui/dialog/layer-properties.cpp @@ -38,22 +38,15 @@ namespace Dialogs { LayerPropertiesDialog::LayerPropertiesDialog() : _strategy(NULL), _desktop(NULL), _layer(NULL), _position_visible(false) { -#if WITH_GTKMM_3_0 - Gtk::Box *mainVBox = get_content_area(); + auto mainVBox = get_content_area(); _layout_table.set_row_spacing(4); _layout_table.set_column_spacing(4); -#else - Gtk::Box *mainVBox = get_vbox(); - _layout_table.set_spacings(4); - _layout_table.resize (1, 2); -#endif // Layer name widgets _layer_name_entry.set_activates_default(true); _layer_name_label.set_label(_("Layer name:")); _layer_name_label.set_alignment(1.0, 0.5); -#if WITH_GTKMM_3_0 _layer_name_label.set_halign(Gtk::ALIGN_FILL); _layer_name_label.set_valign(Gtk::ALIGN_FILL); _layout_table.attach(_layer_name_label, 0, 0, 1, 1); @@ -62,12 +55,6 @@ LayerPropertiesDialog::LayerPropertiesDialog() _layer_name_entry.set_valign(Gtk::ALIGN_FILL); _layer_name_entry.set_hexpand(); _layout_table.attach(_layer_name_entry, 1, 0, 1, 1); -#else - _layout_table.attach(_layer_name_label, - 0, 1, 0, 1, Gtk::FILL, Gtk::FILL); - _layout_table.attach(_layer_name_entry, - 1, 2, 0, 1, Gtk::FILL | Gtk::EXPAND, Gtk::FILL); -#endif mainVBox->pack_start(_layout_table, true, true, 4); @@ -164,10 +151,6 @@ LayerPropertiesDialog::_setup_position_controls() { _layer_position_combo.set_cell_data_func(_label_renderer, sigc::mem_fun(*this, &LayerPropertiesDialog::_prepareLabelRenderer)); -#if !WITH_GTKMM_3_0 - _layout_table.resize (2, 2); -#endif - Gtk::ListStore::iterator row; row = _dropdown_list->append(); row->set_value(_dropdown_columns.position, LPOS_ABOVE); @@ -183,7 +166,6 @@ LayerPropertiesDialog::_setup_position_controls() { _layer_position_label.set_label(_("Position:")); _layer_position_label.set_alignment(1.0, 0.5); -#if WITH_GTKMM_3_0 _layer_position_combo.set_halign(Gtk::ALIGN_FILL); _layer_position_combo.set_valign(Gtk::ALIGN_FILL); _layer_position_combo.set_hexpand(); @@ -192,12 +174,6 @@ LayerPropertiesDialog::_setup_position_controls() { _layer_position_label.set_halign(Gtk::ALIGN_FILL); _layer_position_label.set_valign(Gtk::ALIGN_FILL); _layout_table.attach(_layer_position_label, 0, 1, 1, 1); -#else - _layout_table.attach(_layer_position_combo, - 1, 2, 1, 2, Gtk::FILL | Gtk::EXPAND, Gtk::FILL); - _layout_table.attach(_layer_position_label, - 0, 1, 1, 2, Gtk::FILL, Gtk::FILL); -#endif show_all_children(); } @@ -252,16 +228,11 @@ LayerPropertiesDialog::_setup_layers_controls() { _layout_table.remove(_layer_name_entry); _layout_table.remove(_layer_name_label); -#if WITH_GTKMM_3_0 _scroller.set_halign(Gtk::ALIGN_FILL); _scroller.set_valign(Gtk::ALIGN_FILL); _scroller.set_hexpand(); _scroller.set_vexpand(); _layout_table.attach(_scroller, 0, 1, 2, 1); -#else - _layout_table.attach(_scroller, - 0, 2, 1, 2, Gtk::FILL | Gtk::EXPAND, Gtk::FILL | Gtk::EXPAND); -#endif show_all_children(); } diff --git a/src/ui/dialog/layer-properties.h b/src/ui/dialog/layer-properties.h index c75a7f190..f62f22782 100644 --- a/src/ui/dialog/layer-properties.h +++ b/src/ui/dialog/layer-properties.h @@ -19,12 +19,7 @@ #include <gtkmm/dialog.h> #include <gtkmm/entry.h> #include <gtkmm/label.h> - -#if WITH_GTKMM_3_0 #include <gtkmm/grid.h> -#else -#include <gtkmm/table.h> -#endif #include <gtkmm/combobox.h> #include <gtkmm/liststore.h> @@ -102,12 +97,7 @@ protected: Gtk::Entry _layer_name_entry; Gtk::Label _layer_position_label; Gtk::ComboBox _layer_position_combo; - -#if WITH_GTKMM_3_0 Gtk::Grid _layout_table; -#else - Gtk::Table _layout_table; -#endif bool _position_visible; diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp index c75c631d7..dd9d7ec25 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -858,12 +858,8 @@ LayersPanel::LayersPanel() : _scroller.set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC ); _scroller.set_shadow_type(Gtk::SHADOW_IN); Gtk::Requisition sreq; -#if WITH_GTKMM_3_0 Gtk::Requisition sreq_natural; _scroller.get_preferred_size(sreq_natural, sreq); -#else - sreq = _scroller.size_request(); -#endif int minHeight = 70; if (sreq.height < minHeight) { // Set a min height to see the layers when used with Ubuntu liboverlay-scrollbar diff --git a/src/ui/dialog/layers.h b/src/ui/dialog/layers.h index 9cd2c3b92..893b31557 100644 --- a/src/ui/dialog/layers.h +++ b/src/ui/dialog/layers.h @@ -124,15 +124,9 @@ private: Gtk::TreeView _tree; Gtk::CellRendererText *_text_renderer; Gtk::TreeView::Column *_name_column; -#if WITH_GTKMM_3_0 Gtk::Box _buttonsRow; Gtk::Box _buttonsPrimary; Gtk::Box _buttonsSecondary; -#else - Gtk::HBox _buttonsRow; - Gtk::HBox _buttonsPrimary; - Gtk::HBox _buttonsSecondary; -#endif Gtk::ScrolledWindow _scroller; Gtk::Menu _popupMenu; Inkscape::UI::Widget::SpinButton _spinBtn; diff --git a/src/ui/dialog/livepatheffect-add.cpp b/src/ui/dialog/livepatheffect-add.cpp index 3602b04df..917e48ac6 100644 --- a/src/ui/dialog/livepatheffect-add.cpp +++ b/src/ui/dialog/livepatheffect-add.cpp @@ -73,11 +73,7 @@ LivePathEffectAdd::LivePathEffectAdd() : add_button.set_use_underline(true); add_button.set_can_default(); -#if WITH_GTKMM_3_0 - Gtk::Box *mainVBox = get_content_area(); -#else - Gtk::Box *mainVBox = get_vbox(); -#endif + auto mainVBox = get_content_area(); mainVBox->pack_start(scrolled_window, true, true); add_action_widget(close_button, Gtk::RESPONSE_CLOSE); diff --git a/src/ui/dialog/livepatheffect-editor.cpp b/src/ui/dialog/livepatheffect-editor.cpp index ac64143f1..459d8d4ee 100644 --- a/src/ui/dialog/livepatheffect-editor.cpp +++ b/src/ui/dialog/livepatheffect-editor.cpp @@ -125,13 +125,6 @@ LivePathEffectEditor::LivePathEffectEditor() // Add toolbar items to toolbar toolbar_hbox.set_layout (Gtk::BUTTONBOX_END); - -#if !WITH_GTKMM_3_0 - // TODO: This has been removed from Gtkmm 3.0. Check that - // everything still looks OK! - toolbar_hbox.set_child_min_width( 16 ); -#endif - toolbar_hbox.add( button_add ); toolbar_hbox.set_child_secondary( button_add , true); toolbar_hbox.add( button_remove ); diff --git a/src/ui/dialog/livepatheffect-editor.h b/src/ui/dialog/livepatheffect-editor.h index 4aac25eaa..b69ee007a 100644 --- a/src/ui/dialog/livepatheffect-editor.h +++ b/src/ui/dialog/livepatheffect-editor.h @@ -112,11 +112,7 @@ private: void on_visibility_toggled( Glib::ustring const& str ); -#if WITH_GTKMM_3_0 Gtk::ButtonBox toolbar_hbox; -#else - Gtk::HButtonBox toolbar_hbox; -#endif Gtk::Button button_add; Gtk::Button button_remove; Gtk::Button button_up; diff --git a/src/ui/dialog/new-from-template.cpp b/src/ui/dialog/new-from-template.cpp index 96fa72791..2b33fd54d 100644 --- a/src/ui/dialog/new-from-template.cpp +++ b/src/ui/dialog/new-from-template.cpp @@ -30,20 +30,12 @@ NewFromTemplate::NewFromTemplate() _main_widget = new TemplateLoadTab(this); -#if WITH_GTKMM_3_0 get_content_area()->pack_start(*_main_widget); -#else - get_vbox()->pack_start(*_main_widget); -#endif Gtk::Alignment *align; align = Gtk::manage(new Gtk::Alignment(Gtk::ALIGN_END, Gtk::ALIGN_CENTER, 0.0, 0.0)); -#if WITH_GTKMM_3_0 get_content_area()->pack_end(*align, Gtk::PACK_SHRINK); -#else - get_vbox()->pack_end(*align, Gtk::PACK_SHRINK); -#endif align->set_padding(0, 0, 0, 15); align->add(_create_template_button); diff --git a/src/ui/dialog/object-properties.cpp b/src/ui/dialog/object-properties.cpp index 545c240fc..191216eea 100644 --- a/src/ui/dialog/object-properties.cpp +++ b/src/ui/dialog/object-properties.cpp @@ -37,12 +37,7 @@ #include "sp-image.h" #include <glibmm/i18n.h> -#if WITH_GTKMM_3_0 -# include <gtkmm/grid.h> -#else -# include <gtkmm/table.h> -#endif - +#include <gtkmm/grid.h> namespace Inkscape { namespace UI { @@ -103,16 +98,9 @@ void ObjectProperties::_init() Gtk::Box *contents = _getContents(); contents->set_spacing(0); -#if WITH_GTKMM_3_0 - Gtk::Grid *grid_top = Gtk::manage(new Gtk::Grid()); + auto grid_top = Gtk::manage(new Gtk::Grid()); grid_top->set_row_spacing(4); grid_top->set_column_spacing(0); -#else - Gtk::Table *grid_top = Gtk::manage(new Gtk::Table(4, 4)); - grid_top->set_row_spacings(4); - grid_top->set_col_spacings(0); -#endif - grid_top->set_border_width(4); contents->pack_start(*grid_top, false, false, 0); @@ -121,29 +109,14 @@ void ObjectProperties::_init() /* Create the label for the object id */ _label_id.set_label(_label_id.get_label() + " "); _label_id.set_alignment(1, 0.5); - -#if WITH_GTKMM_3_0 _label_id.set_valign(Gtk::ALIGN_CENTER); grid_top->attach(_label_id, 0, 0, 1, 1); -#else - grid_top->attach(_label_id, 0, 1, 0, 1, - Gtk::SHRINK | Gtk::FILL, - Gtk::AttachOptions(), 0, 0 ); -#endif - /* Create the entry box for the object id */ _entry_id.set_tooltip_text(_("The id= attribute (only letters, digits, and the characters .-_: allowed)")); _entry_id.set_max_length(64); - -#if WITH_GTKMM_3_0 _entry_id.set_valign(Gtk::ALIGN_CENTER); grid_top->attach(_entry_id, 1, 0, 1, 1); -#else - grid_top->attach(_entry_id, 1, 2, 0, 1, - Gtk::EXPAND | Gtk::FILL, - Gtk::AttachOptions(), 0, 0 ); -#endif _label_id.set_mnemonic_widget(_entry_id); @@ -157,29 +130,16 @@ void ObjectProperties::_init() _label_label.set_label(_label_label.get_label() + " "); _label_label.set_alignment(1, 0.5); -#if WITH_GTKMM_3_0 _label_label.set_valign(Gtk::ALIGN_CENTER); grid_top->attach(_label_label, 0, 1, 1, 1); -#else - grid_top->attach(_label_label, 0, 1, 1, 2, - Gtk::SHRINK | Gtk::FILL, - Gtk::AttachOptions(), 0, 0 ); -#endif - /* Create the entry box for the object label */ _entry_label.set_tooltip_text(_("A freeform label for the object")); _entry_label.set_max_length(256); -#if WITH_GTKMM_3_0 _entry_label.set_hexpand(); _entry_label.set_valign(Gtk::ALIGN_CENTER); grid_top->attach(_entry_label, 1, 1, 1, 1); -#else - grid_top->attach(_entry_label, 1, 2, 1, 2, - Gtk::EXPAND | Gtk::FILL, - Gtk::AttachOptions(), 0, 0 ); -#endif _label_label.set_mnemonic_widget(_entry_label); @@ -191,28 +151,16 @@ void ObjectProperties::_init() _label_title.set_label(_label_title.get_label() + " "); _label_title.set_alignment (1, 0.5); -#if WITH_GTKMM_3_0 _label_title.set_valign(Gtk::ALIGN_CENTER); grid_top->attach(_label_title, 0, 2, 1, 1); -#else - grid_top->attach(_label_title, 0, 1, 2, 3, - Gtk::SHRINK | Gtk::FILL, - Gtk::AttachOptions(), 0, 0 ); -#endif /* Create the entry box for the object title */ _entry_title.set_sensitive (FALSE); _entry_title.set_max_length (256); -#if WITH_GTKMM_3_0 _entry_title.set_hexpand(); _entry_title.set_valign(Gtk::ALIGN_CENTER); grid_top->attach(_entry_title, 1, 2, 1, 1); -#else - grid_top->attach(_entry_title, 1, 2, 2, 3, - Gtk::EXPAND | Gtk::FILL, - Gtk::AttachOptions(), 0, 0 ); -#endif _label_title.set_mnemonic_widget(_entry_title); // pressing enter in the label field is the same as clicking Set: @@ -241,14 +189,8 @@ void ObjectProperties::_init() _label_image_rendering.set_label(_label_image_rendering.get_label() + " "); _label_image_rendering.set_alignment(1, 0.5); -#if WITH_GTKMM_3_0 _label_image_rendering.set_valign(Gtk::ALIGN_CENTER); grid_top->attach(_label_image_rendering, 0, 3, 1, 1); -#else - grid_top->attach(_label_image_rendering, 0, 1, 3, 4, - Gtk::SHRINK | Gtk::FILL, - Gtk::AttachOptions(), 0, 0 ); -#endif /* Create the combo box text for the 'image-rendering' property */ _combo_image_rendering.append( "auto" ); @@ -256,14 +198,8 @@ void ObjectProperties::_init() _combo_image_rendering.append( "optimizeSpeed" ); _combo_image_rendering.set_tooltip_text(_("The 'image-rendering' property can influence how a bitmap is up-scaled:\n\t'auto' no preference;\n\t'optimizeQuality' smooth;\n\t'optimizeSpeed' blocky.\nNote that this behaviour is not defined in the SVG 1.1 specification and not all browsers follow this interpretation.")); -#if WITH_GTKMM_3_0 _combo_image_rendering.set_valign(Gtk::ALIGN_CENTER); grid_top->attach(_combo_image_rendering, 1, 3, 1, 1); -#else - grid_top->attach(_combo_image_rendering, 1, 2, 3, 4, - Gtk::EXPAND | Gtk::FILL, - Gtk::AttachOptions(), 0, 0 ); -#endif _label_image_rendering.set_mnemonic_widget(_combo_image_rendering); @@ -275,60 +211,36 @@ void ObjectProperties::_init() Gtk::HBox *hb_checkboxes = Gtk::manage(new Gtk::HBox()); contents->pack_start(*hb_checkboxes, FALSE, FALSE, 0); -#if WITH_GTKMM_3_0 - Gtk::Grid *grid_cb = Gtk::manage(new Gtk::Grid()); + auto grid_cb = Gtk::manage(new Gtk::Grid()); grid_cb->set_row_homogeneous(); grid_cb->set_column_homogeneous(true); -#else - Gtk::Table *grid_cb = Gtk::manage(new Gtk::Table(1, 2, true)); -#endif grid_cb->set_border_width(4); hb_checkboxes->pack_start(*grid_cb, true, true, 0); /* Hide */ _cb_hide.set_tooltip_text (_("Check to make the object invisible")); - -#if WITH_GTKMM_3_0 _cb_hide.set_hexpand(); _cb_hide.set_valign(Gtk::ALIGN_CENTER); grid_cb->attach(_cb_hide, 0, 0, 1, 1); -#else - grid_cb->attach(_cb_hide, 0, 1, 0, 1, - Gtk::EXPAND | Gtk::FILL, - Gtk::AttachOptions(), 0, 0 ); -#endif _cb_hide.signal_toggled().connect(sigc::mem_fun(this, &ObjectProperties::_hiddenToggled)); /* Lock */ // TRANSLATORS: "Lock" is a verb here _cb_lock.set_tooltip_text(_("Check to make the object insensitive (not selectable by mouse)")); - -#if WITH_GTKMM_3_0 _cb_lock.set_hexpand(); _cb_lock.set_valign(Gtk::ALIGN_CENTER); grid_cb->attach(_cb_lock, 1, 0, 1, 1); -#else - grid_cb->attach(_cb_lock, 1, 2, 0, 1, - Gtk::EXPAND | Gtk::FILL, - Gtk::AttachOptions(), 0, 0 ); -#endif _cb_lock.signal_toggled().connect(sigc::mem_fun(this, &ObjectProperties::_sensitivityToggled)); /* Button for setting the object's id, label, title and description. */ Gtk::Button *btn_set = Gtk::manage(new Gtk::Button(_("_Set"), 1)); -#if WITH_GTKMM_3_0 btn_set->set_hexpand(); btn_set->set_valign(Gtk::ALIGN_CENTER); grid_cb->attach(*btn_set, 2, 0, 1, 1); -#else - grid_cb->attach(*btn_set, 2, 3, 0, 1, - Gtk::EXPAND | Gtk::FILL, - Gtk::AttachOptions(), 0, 0 ); -#endif btn_set->signal_clicked().connect(sigc::mem_fun(this, &ObjectProperties::_labelChanged)); diff --git a/src/ui/dialog/object-properties.h b/src/ui/dialog/object-properties.h index dc28c0bad..8551d5fca 100644 --- a/src/ui/dialog/object-properties.h +++ b/src/ui/dialog/object-properties.h @@ -50,11 +50,7 @@ class SPDesktop; class SPItem; namespace Gtk { -#if WITH_GTKMM_3_0 class Grid; -#else -class Table; -#endif } namespace Inkscape { diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp index 72cbc5ecc..09ffc9c4c 100644 --- a/src/ui/dialog/objects.cpp +++ b/src/ui/dialog/objects.cpp @@ -499,11 +499,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()) @@ -1473,11 +1469,7 @@ void ObjectsPanel::_opacityChangedIter(const Gtk::TreeIter& iter) if (item) { item->style->opacity.set = TRUE; -#if WITH_GTKMM_3_0 item->style->opacity.value = SP_SCALE24_FROM_FLOAT(_opacity_adjustment->get_value() / _opacity_adjustment->get_upper()); -#else - item->style->opacity.value = SP_SCALE24_FROM_FLOAT(_opacity_adjustment.get_value() / _opacity_adjustment.get_upper()); -#endif item->updateRepr(SP_OBJECT_WRITE_NO_CHILDREN | SP_OBJECT_WRITE_EXT); } } @@ -1629,11 +1621,7 @@ ObjectsPanel::ObjectsPanel() : _opacity_vbox(false, 0), _opacity_label(_("Opacity:")), _opacity_label_unit(_("%")), -#if WITH_GTKMM_3_0 _opacity_adjustment(Gtk::Adjustment::create(100.0, 0.0, 100.0, 1.0, 1.0, 0.0)), -#else - _opacity_adjustment(100.0, 0.0, 100.0, 1.0, 1.0, 0.0), -#endif _opacity_hscale(_opacity_adjustment), _opacity_spin_button(_opacity_adjustment, 0.01, 1), _fe_cb(UI::Widget::SimpleFilterModifier::BLEND), @@ -1763,12 +1751,8 @@ ObjectsPanel::ObjectsPanel() : _scroller.set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC ); _scroller.set_shadow_type(Gtk::SHADOW_IN); Gtk::Requisition sreq; -#if WITH_GTKMM_3_0 Gtk::Requisition sreq_natural; _scroller.get_preferred_size(sreq_natural, sreq); -#else - sreq = _scroller.size_request(); -#endif int minHeight = 70; if (sreq.height < minHeight) { // Set a min height to see the layers when used with Ubuntu liboverlay-scrollbar @@ -1801,13 +1785,8 @@ ObjectsPanel::ObjectsPanel() : _opacity_hbox.pack_start(_opacity_spin_button, false, false, 0); _opacity_hbox.pack_start(_opacity_label_unit, false, false, 3); _opacity_hscale.set_draw_value(false); -#if WITH_GTKMM_3_0 _opacityConnection = _opacity_adjustment->signal_value_changed().connect(sigc::mem_fun(*this, &ObjectsPanel::_opacityValueChanged)); _opacity_label.set_mnemonic_widget(_opacity_hscale); -#else - _opacityConnection = _opacity_adjustment.signal_value_changed().connect(sigc::mem_fun(*this, &ObjectsPanel::_opacityValueChanged)); - _opacity_label.set_mnemonic_widget(_opacity_hscale); -#endif //Keep the labels aligned GtkSizeGroup *labels = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); diff --git a/src/ui/dialog/objects.h b/src/ui/dialog/objects.h index 9b9a6025a..018f9191f 100644 --- a/src/ui/dialog/objects.h +++ b/src/ui/dialog/objects.h @@ -134,15 +134,9 @@ private: Gtk::TreeView _tree; Gtk::CellRendererText *_text_renderer; Gtk::TreeView::Column *_name_column; -#if WITH_GTKMM_3_0 Gtk::Box _buttonsRow; Gtk::Box _buttonsPrimary; Gtk::Box _buttonsSecondary; -#else - Gtk::HBox _buttonsRow; - Gtk::HBox _buttonsPrimary; - Gtk::HBox _buttonsSecondary; -#endif Gtk::ScrolledWindow _scroller; Gtk::Menu _popupMenu; Inkscape::UI::Widget::SpinButton _spinBtn; @@ -161,11 +155,7 @@ private: Gtk::HBox _opacity_hbox; Gtk::Label _opacity_label; Gtk::Label _opacity_label_unit; -#if WITH_GTKMM_3_0 Glib::RefPtr<Gtk::Adjustment> _opacity_adjustment; -#else - Gtk::Adjustment _opacity_adjustment; -#endif Gtk::HScale _opacity_hscale; Inkscape::UI::Widget::SpinButton _opacity_spin_button; diff --git a/src/ui/dialog/ocaldialogs.cpp b/src/ui/dialog/ocaldialogs.cpp index 3353d2878..878b68d55 100644 --- a/src/ui/dialog/ocaldialogs.cpp +++ b/src/ui/dialog/ocaldialogs.cpp @@ -311,27 +311,10 @@ LoadingBox::LoadingBox() : Gtk::EventBox() draw_spinner = false; spinner_step = 0; -#if WITH_GTKMM_3_0 signal_draw().connect(sigc::mem_fun(*this, &LoadingBox::_on_draw), false); -#else - signal_expose_event().connect(sigc::mem_fun(*this, &LoadingBox::_on_expose_event), false); -#endif -} - -#if !WITH_GTKMM_3_0 -bool LoadingBox::_on_expose_event(GdkEventExpose* /*event*/) -{ - Cairo::RefPtr<Cairo::Context> cr = get_window()->create_cairo_context(); - - return _on_draw(cr); } -#endif -bool LoadingBox::_on_draw(const Cairo::RefPtr<Cairo::Context> & -#if WITH_GTKMM_3_0 -cr -#endif -) +bool LoadingBox::_on_draw(const Cairo::RefPtr<Cairo::Context> &cr) { // Draw shadow int x = get_allocation().get_x(); @@ -339,27 +322,14 @@ cr int width = get_allocation().get_width(); int height = get_allocation().get_height(); -#if WITH_GTKMM_3_0 get_style_context()->render_frame(cr, x, y, width, height); -#else - get_style()->paint_shadow(get_window(), get_state(), Gtk::SHADOW_IN, - Gdk::Rectangle(x, y, width, height), - *this, Glib::ustring("viewport"), x, y, width, height); -#endif if (draw_spinner) { int spinner_size = 16; int spinner_x = x + (width - spinner_size) / 2; int spinner_y = y + (height - spinner_size) / 2; -#if WITH_GTKMM_3_0 get_style_context()->render_activity(cr, spinner_x, spinner_y, spinner_size, spinner_size); -#else - gtk_paint_spinner(gtk_widget_get_style(GTK_WIDGET(gobj())), - gtk_widget_get_window(GTK_WIDGET(gobj())), - gtk_widget_get_state(GTK_WIDGET(gobj())), NULL, GTK_WIDGET(gobj()), - NULL, spinner_step, spinner_x, spinner_y, spinner_size, spinner_size); -#endif } return false; @@ -429,11 +399,7 @@ PreviewWidget::PreviewWidget() : Gtk::VBox(false, 12) box_loading->set_size_request(90, 90); set_border_width(12); -#if WITH_GTKMM_3_0 signal_draw().connect(sigc::mem_fun(*this, &PreviewWidget::_on_draw), false); -#else - signal_expose_event().connect(sigc::mem_fun(*this, &PreviewWidget::_on_expose_event), false); -#endif clear(); } @@ -477,15 +443,6 @@ void PreviewWidget::clear() image->hide(); } -#if !WITH_GTKMM_3_0 -bool PreviewWidget::_on_expose_event(GdkEventExpose* /*event*/) -{ - Cairo::RefPtr<Cairo::Context> cr = get_window()->create_cairo_context(); - - return _on_draw(cr); -} -#endif - bool PreviewWidget::_on_draw(const Cairo::RefPtr<Cairo::Context>& cr) { // Draw background @@ -494,16 +451,10 @@ bool PreviewWidget::_on_draw(const Cairo::RefPtr<Cairo::Context>& cr) int width = get_allocation().get_width(); int height = get_allocation().get_height(); -#if WITH_GTKMM_3_0 Gdk::RGBA background_fill; get_style_context()->lookup_color("base_color", background_fill); cr->rectangle(x, y, width, height); Gdk::Cairo::set_source_rgba(cr, background_fill); -#else - Gdk::Color background_fill = get_style()->get_base(get_state()); - cr->rectangle(x, y, width, height); - Gdk::Cairo::set_source_color(cr, background_fill); -#endif cr->fill(); @@ -568,57 +519,12 @@ void StatusWidget::end_process() clear(); } -#if !GTK_CHECK_VERSION(3,0,0) -SearchEntry::SearchEntry() : Gtk::Entry() -{ - signal_changed().connect(sigc::mem_fun(*this, &SearchEntry::_on_changed)); - signal_icon_press().connect(sigc::mem_fun(*this, &SearchEntry::_on_icon_pressed)); - - set_icon_from_icon_name(INKSCAPE_ICON("edit-find"), Gtk::ENTRY_ICON_PRIMARY); - gtk_entry_set_icon_from_icon_name(gobj(), GTK_ENTRY_ICON_SECONDARY, NULL); -} - -void SearchEntry::_on_icon_pressed(Gtk::EntryIconPosition icon_position, const GdkEventButton* /*event*/) -{ - if (icon_position == Gtk::ENTRY_ICON_SECONDARY) { - grab_focus(); - delete_text(0, -1); - } else if (icon_position == Gtk::ENTRY_ICON_PRIMARY) { - select_region(0, -1); - grab_focus(); - } -} - -void SearchEntry::_on_changed() -{ - if (get_text().empty()) { - gtk_entry_set_icon_from_icon_name(gobj(), GTK_ENTRY_ICON_SECONDARY, NULL); - } else { - set_icon_from_icon_name(INKSCAPE_ICON("edit-clear"), Gtk::ENTRY_ICON_SECONDARY); - } -} -#endif - - BaseBox::BaseBox() : Gtk::EventBox() { -#if WITH_GTKMM_3_0 signal_draw().connect(sigc::mem_fun(*this, &BaseBox::_on_draw), false); -#else - signal_expose_event().connect(sigc::mem_fun(*this, &BaseBox::_on_expose_event), false); -#endif set_visible_window(false); } -#if !WITH_GTKMM_3_0 -bool BaseBox::_on_expose_event(GdkEventExpose* /*event*/) -{ - Cairo::RefPtr<Cairo::Context> cr = get_window()->create_cairo_context(); - - return _on_draw(cr); -} -#endif - bool BaseBox::_on_draw(const Cairo::RefPtr<Cairo::Context>& cr) { // Draw background and shadow @@ -627,23 +533,12 @@ bool BaseBox::_on_draw(const Cairo::RefPtr<Cairo::Context>& cr) int width = get_allocation().get_width(); int height = get_allocation().get_height(); -#if WITH_GTKMM_3_0 Gdk::RGBA background_fill; get_style_context()->lookup_color("base_color", background_fill); cr->rectangle(x, y, width, height); Gdk::Cairo::set_source_rgba(cr, background_fill); cr->fill(); get_style_context()->render_frame(cr, x, y, width, height); -#else - Gdk::Color background_fill = get_style()->get_base(get_state()); - cr->rectangle(x, y, width, height); - Gdk::Cairo::set_source_color(cr, background_fill); - cr->fill(); - - get_style()->paint_shadow(get_window(), get_state(), Gtk::SHADOW_IN, - Gdk::Rectangle(x, y, width, height), - *this, Glib::ustring("viewport"), x, y, width, height); -#endif return false; } @@ -660,23 +555,10 @@ LogoArea::LogoArea() : Gtk::EventBox() draw_logo = false; } -#if WITH_GTKMM_3_0 signal_draw().connect(sigc::mem_fun(*this, &LogoArea::_on_draw)); -#else - signal_expose_event().connect(sigc::mem_fun(*this, &LogoArea::_on_expose_event)); -#endif set_visible_window(false); } -#if !WITH_GTKMM_3_0 -bool LogoArea::_on_expose_event(GdkEventExpose* /*event*/) -{ - Cairo::RefPtr<Cairo::Context> cr = get_window()->create_cairo_context(); - - return _on_draw(cr); -} -#endif - bool LogoArea::_on_draw(const Cairo::RefPtr<Cairo::Context>& cr) { if (draw_logo) { @@ -687,16 +569,9 @@ bool LogoArea::_on_draw(const Cairo::RefPtr<Cairo::Context>& cr) int x_logo = x + (width - 220) / 2; int y_logo = y + (height - 76) / 2; - // Draw logo, we mask [read fill] it with the mid colour from the - // user's GTK theme -#if WITH_GTKMM_3_0 - // For GTK+ 3, use grey + // Draw logo, we mask [read fill] it with grey Gdk::RGBA logo_fill("grey"); Gdk::Cairo::set_source_rgba(cr, logo_fill); -#else - Gdk::Color logo_fill = get_style()->get_mid(get_state()); - Gdk::Cairo::set_source_color(cr, logo_fill); -#endif cr->mask(logo_mask, x_logo, y_logo); } @@ -1174,16 +1049,9 @@ void ImportDialog::update_label_no_search_results() Glib::ustring msg_two = _("Please make sure all keywords are spelled correctly," " or try again with different keywords."); -#if WITH_GTKMM_3_0 - Glib::ustring markup = Glib::ustring::compose( + auto markup = Glib::ustring::compose( "<span size=\"large\">%1</span>\n<span>%2</span>", msg_one, msg_two); -#else - Gdk::Color grey = entry_search->get_style()->get_text_aa(entry_search->get_state()); - Glib::ustring markup = Glib::ustring::compose( - "<span size=\"large\">%1</span>\n<span color=\"%2\">%3</span>", - msg_one, grey.to_string(), msg_two); -#endif label_not_found->set_markup(markup); } @@ -1203,33 +1071,17 @@ ImportDialog::ImportDialog(Gtk::Window& parent_window, FileDialogType file_types dialogType = file_types; // Creation - Gtk::VBox *vbox = new Gtk::VBox(false, 0); - -#if WITH_GTKMM_3_0 - Gtk::ButtonBox *hbuttonbox_bottom = new Gtk::ButtonBox(); -#else - Gtk::HButtonBox *hbuttonbox_bottom = new Gtk::HButtonBox(); -#endif - - Gtk::HBox *hbox_bottom = new Gtk::HBox(false, 12); + auto vbox = new Gtk::VBox(false, 0); + auto hbuttonbox_bottom = new Gtk::ButtonBox(); + auto hbox_bottom = new Gtk::HBox(false, 12); BaseBox *basebox_logo = new BaseBox(); BaseBox *basebox_no_search_results = new BaseBox(); label_not_found = new Gtk::Label(); label_description = new Gtk::Label(); - -#if GTK_CHECK_VERSION(3,0,0) entry_search = new Gtk::SearchEntry(); -#else - entry_search = new SearchEntry(); -#endif - button_search = new Gtk::Button(_("Search")); -#if WITH_GTKMM_3_0 - Gtk::ButtonBox* hbuttonbox_search = new Gtk::ButtonBox(); -#else - Gtk::HButtonBox* hbuttonbox_search = new Gtk::HButtonBox(); -#endif + auto hbuttonbox_search = new Gtk::ButtonBox(); Gtk::ScrolledWindow* scrolledwindow_preview = new Gtk::ScrolledWindow(); preview_files = new PreviewWidget(); diff --git a/src/ui/dialog/ocaldialogs.h b/src/ui/dialog/ocaldialogs.h index 9de24d821..db3c60786 100644 --- a/src/ui/dialog/ocaldialogs.h +++ b/src/ui/dialog/ocaldialogs.h @@ -17,19 +17,16 @@ # include <config.h> #endif -//Gtk includes +// Gtkmm includes #include <gtkmm/box.h> #include <gtkmm/eventbox.h> #include <gtkmm/listviewtext.h> #include <gtkmm/scrolledwindow.h> +#include <gtkmm/searchentry.h> #include <gtkmm/window.h> #include <cairomm/refptr.h> -#if GTK_CHECK_VERSION(3,0,0) -# include <gtkmm/searchentry.h> -#endif - #include <giomm/file.h> //Inkscape includes @@ -283,10 +280,6 @@ private: sigc::connection timeout; bool draw_spinner; -#if !WITH_GTKMM_3_0 - bool _on_expose_event(GdkEventExpose* event); -#endif - bool _on_draw(const Cairo::RefPtr<Cairo::Context>& cr); bool on_timeout(); }; @@ -310,10 +303,6 @@ private: WrapLabel* label_description; WrapLabel* label_time; -#if !WITH_GTKMM_3_0 - bool _on_expose_event(GdkEventExpose* event); -#endif - bool _on_draw(const Cairo::RefPtr<Cairo::Context>& cr); }; @@ -336,21 +325,6 @@ public: Gtk::Label* label; }; -#if !GTK_CHECK_VERSION(3,0,0) -/** - * A Gtk::Entry with search & clear icons - */ -class SearchEntry : public Gtk::Entry -{ -public: - SearchEntry(); - -private: - void _on_icon_pressed(Gtk::EntryIconPosition icon_position, const GdkEventButton* event); - void _on_changed(); -}; -#endif - /** * A box which paints an overlay of the OCAL logo */ @@ -359,9 +333,6 @@ class LogoArea : public Gtk::EventBox public: LogoArea(); private: -#if !WITH_GTKMM_3_0 - bool _on_expose_event(GdkEventExpose* event); -#endif bool _on_draw(const Cairo::RefPtr<Cairo::Context>& cr); bool draw_logo; Cairo::RefPtr<Cairo::ImageSurface> logo_mask; @@ -375,9 +346,6 @@ class BaseBox : public Gtk::EventBox public: BaseBox(); private: -#if !WITH_GTKMM_3_0 - bool _on_expose_event(GdkEventExpose* event); -#endif bool _on_draw(const Cairo::RefPtr<Cairo::Context>& cr); }; @@ -459,12 +427,7 @@ protected: private: Glib::ustring filename_image; Glib::ustring filename_thumbnail; - -#if GTK_CHECK_VERSION(3,0,0) Gtk::SearchEntry *entry_search; -#else - SearchEntry *entry_search; -#endif LogoArea *drawingarea_logo; SearchResultList *list_results; diff --git a/src/ui/dialog/polar-arrange-tab.cpp b/src/ui/dialog/polar-arrange-tab.cpp index 8e7f2d48b..c51881a96 100644 --- a/src/ui/dialog/polar-arrange-tab.cpp +++ b/src/ui/dialog/polar-arrange-tab.cpp @@ -31,11 +31,7 @@ namespace Dialog { PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_) : parent(parent_), -#if WITH_GTKMM_3_0 parametersTable(), -#else - parametersTable(3, 3, false), -#endif centerY("", C_("Polar arrange tab", "Y coordinate of the center"), UNIT_TYPE_LINEAR), centerX("", C_("Polar arrange tab", "X coordinate of the center"), centerY), radiusY("", C_("Polar arrange tab", "Y coordinate of the radius"), UNIT_TYPE_LINEAR), @@ -79,11 +75,7 @@ PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_) pack_start(arrangeOnParametersRadio, false, false); centerLabel.set_text(C_("Polar arrange tab", "Center X/Y:")); -#if WITH_GTKMM_3_0 parametersTable.attach(centerLabel, 0, 0, 1, 1); -#else - parametersTable.attach(centerLabel, 0, 1, 0, 1, Gtk::FILL); -#endif centerX.setDigits(2); centerX.setIncrements(0.2, 0); centerX.setRange(-10000, 10000); @@ -92,20 +84,11 @@ PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_) centerY.setIncrements(0.2, 0); centerY.setRange(-10000, 10000); centerY.setValue(0, "px"); -#if WITH_GTKMM_3_0 parametersTable.attach(centerX, 1, 0, 1, 1); parametersTable.attach(centerY, 2, 0, 1, 1); -#else - parametersTable.attach(centerX, 1, 2, 0, 1, Gtk::FILL); - parametersTable.attach(centerY, 2, 3, 0, 1, Gtk::FILL); -#endif radiusLabel.set_text(C_("Polar arrange tab", "Radius X/Y:")); -#if WITH_GTKMM_3_0 parametersTable.attach(radiusLabel, 0, 1, 1, 1); -#else - parametersTable.attach(radiusLabel, 0, 1, 1, 2, Gtk::FILL); -#endif radiusX.setDigits(2); radiusX.setIncrements(0.2, 0); radiusX.setRange(0.001, 10000); @@ -114,20 +97,11 @@ PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_) radiusY.setIncrements(0.2, 0); radiusY.setRange(0.001, 10000); radiusY.setValue(100, "px"); -#if WITH_GTKMM_3_0 parametersTable.attach(radiusX, 1, 1, 1, 1); parametersTable.attach(radiusY, 2, 1, 1, 1); -#else - parametersTable.attach(radiusX, 1, 2, 1, 2, Gtk::FILL); - parametersTable.attach(radiusY, 2, 3, 1, 2, Gtk::FILL); -#endif angleLabel.set_text(_("Angle X/Y:")); -#if WITH_GTKMM_3_0 parametersTable.attach(angleLabel, 0, 2, 1, 1); -#else - parametersTable.attach(angleLabel, 0, 1, 2, 3, Gtk::FILL); -#endif angleX.setDigits(2); angleX.setIncrements(0.2, 0); angleX.setRange(-10000, 10000); @@ -136,13 +110,8 @@ PolarArrangeTab::PolarArrangeTab(ArrangeDialog *parent_) angleY.setIncrements(0.2, 0); angleY.setRange(-10000, 10000); angleY.setValue(180, "°"); -#if WITH_GTKMM_3_0 parametersTable.attach(angleX, 1, 2, 1, 1); parametersTable.attach(angleY, 2, 2, 1, 1); -#else - parametersTable.attach(angleX, 1, 2, 2, 3, Gtk::FILL); - parametersTable.attach(angleY, 2, 3, 2, 3, Gtk::FILL); -#endif pack_start(parametersTable, false, false); rotateObjectsCheckBox.set_label(_("Rotate objects")); 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 1dd3fd60c..6a87f3714 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -882,12 +882,7 @@ void SvgFontsDialog::add_font(){ SvgFontsDialog::SvgFontsDialog() : UI::Widget::Panel("", "/dialogs/svgfonts", SP_VERB_DIALOG_SVG_FONTS), _add(Gtk::Stock::NEW) { -#if WITH_GTKMM_3_0 kerning_slider = Gtk::manage(new Gtk::Scale(Gtk::ORIENTATION_HORIZONTAL)); -#else - kerning_slider = Gtk::manage(new Gtk::HScale); -#endif - _add.signal_clicked().connect(sigc::mem_fun(*this, &SvgFontsDialog::add_font)); Gtk::HBox* hbox = Gtk::manage(new Gtk::HBox()); diff --git a/src/ui/dialog/svg-fonts-dialog.h b/src/ui/dialog/svg-fonts-dialog.h index e80bbfd39..1588c0fc2 100644 --- a/src/ui/dialog/svg-fonts-dialog.h +++ b/src/ui/dialog/svg-fonts-dialog.h @@ -27,11 +27,7 @@ #include "xml/helper-observer.h" namespace Gtk { -#if WITH_GTKMM_3_0 class Scale; -#else -class HScale; -#endif } class SPGlyph; @@ -216,12 +212,7 @@ private: GlyphComboBox first_glyph, second_glyph; SPGlyphKerning* kerning_pair; Inkscape::UI::Widget::SpinButton setwidth_spin; - -#if WITH_GTKMM_3_0 Gtk::Scale* kerning_slider; -#else - Gtk::HScale* kerning_slider; -#endif class EntryWidget : public Gtk::HBox { diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index 07769ced9..3012c5c26 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -649,12 +649,8 @@ SwatchesPanel::SwatchesPanel(gchar const* prefsPath) : if (Glib::ustring(prefsPath) == "/dialogs/swatches") { Gtk::Requisition sreq; -#if WITH_GTKMM_3_0 Gtk::Requisition sreq_natural; get_preferred_size(sreq_natural, sreq); -#else - sreq = size_request(); -#endif int minHeight = 60; if (sreq.height < minHeight) { set_size_request(70, minHeight); diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index 8bd841bb5..4840b897b 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -19,14 +19,8 @@ #include <gtkmm/buttonbox.h> #include <gtkmm/label.h> - -#if WITH_GTKMM_3_0 -# include <gtkmm/togglebutton.h> -# include <gtkmm/grid.h> -#else -# include <gtkmm/table.h> -#endif - +#include <gtkmm/togglebutton.h> +#include <gtkmm/grid.h> #include <gtkmm/scrolledwindow.h> #include <gtkmm/comboboxtext.h> #include <gtkmm/iconview.h> @@ -116,11 +110,7 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : { /******************** Table *************************/ -#if WITH_GTKMM_3_0 - Gtk::Grid *table = new Gtk::Grid(); -#else - Gtk::Table *table = new Gtk::Table(2, 4, false); -#endif + auto table = new Gtk::Grid(); // panel is a cloked Gtk::VBox _getContents()->pack_start(*Gtk::manage(table), Gtk::PACK_EXPAND_WIDGET); @@ -128,24 +118,12 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : /******************** Symbol Sets *************************/ Gtk::Label* labelSet = new Gtk::Label(_("Symbol set: ")); - -#if WITH_GTKMM_3_0 table->attach(*Gtk::manage(labelSet),0,row,1,1); -#else - table->attach(*Gtk::manage(labelSet),0,1,row,row+1,Gtk::SHRINK,Gtk::SHRINK); -#endif - symbolSet = new Gtk::ComboBoxText(); // Fill in later symbolSet->append(_("Current Document")); symbolSet->set_active_text(_("Current Document")); - -#if WITH_GTKMM_3_0 symbolSet->set_hexpand(); table->attach(*Gtk::manage(symbolSet),1,row,1,1); -#else - table->attach(*Gtk::manage(symbolSet),1,2,row,row+1,Gtk::FILL|Gtk::EXPAND,Gtk::SHRINK); -#endif - sigc::connection connSet = symbolSet->signal_changed().connect( sigc::mem_fun(*this, &SymbolsDialog::rebuild)); instanceConns.push_back(connSet); @@ -178,14 +156,9 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : Gtk::ScrolledWindow *scroller = new Gtk::ScrolledWindow(); scroller->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_ALWAYS); scroller->add(*Gtk::manage(iconView)); - -#if WITH_GTKMM_3_0 scroller->set_hexpand(); scroller->set_vexpand(); table->attach(*Gtk::manage(scroller),0,row,2,1); -#else - table->attach(*Gtk::manage(scroller),0,2,row,row+1,Gtk::EXPAND|Gtk::FILL,Gtk::EXPAND|Gtk::FILL); -#endif ++row; @@ -194,12 +167,8 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : Gtk::HBox* tools = new Gtk::HBox(); //tools->set_layout( Gtk::BUTTONBOX_END ); -#if WITH_GTKMM_3_0 scroller->set_hexpand(); table->attach(*Gtk::manage(tools),0,row,2,1); -#else - table->attach(*Gtk::manage(tools),0,2,row,row+1,Gtk::EXPAND|Gtk::FILL,Gtk::FILL); -#endif addSymbol = Gtk::manage(new Gtk::Button()); addSymbol->add(*Gtk::manage(Glib::wrap( @@ -393,11 +362,7 @@ void SymbolsDialog::revertSymbol() { void SymbolsDialog::iconDragDataGet(const Glib::RefPtr<Gdk::DragContext>& /*context*/, Gtk::SelectionData& data, guint /*info*/, guint /*time*/) { -#if WITH_GTKMM_3_0 - std::vector<Gtk::TreePath> iconArray = iconView->get_selected_items(); -#else - Gtk::IconView::ArrayHandle_TreePaths iconArray = iconView->get_selected_items(); -#endif + auto iconArray = iconView->get_selected_items(); if( iconArray.empty() ) { //std::cout << " iconArray empty: huh? " << std::endl; @@ -450,11 +415,7 @@ SPDocument* SymbolsDialog::selectedSymbols() { Glib::ustring SymbolsDialog::selectedSymbolId() { -#if WITH_GTKMM_3_0 - std::vector<Gtk::TreePath> iconArray = iconView->get_selected_items(); -#else - Gtk::IconView::ArrayHandle_TreePaths iconArray = iconView->get_selected_items(); -#endif + auto iconArray = iconView->get_selected_items(); if( !iconArray.empty() ) { Gtk::TreeModel::Path const & path = *iconArray.begin(); diff --git a/src/ui/dialog/tags.cpp b/src/ui/dialog/tags.cpp index c04ab7b4b..dfe71bddb 100644 --- a/src/ui/dialog/tags.cpp +++ b/src/ui/dialog/tags.cpp @@ -966,12 +966,8 @@ TagsPanel::TagsPanel() : _scroller.set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC ); _scroller.set_shadow_type(Gtk::SHADOW_IN); Gtk::Requisition sreq; -#if WITH_GTKMM_3_0 Gtk::Requisition sreq_natural; _scroller.get_preferred_size(sreq_natural, sreq); -#else - sreq = _scroller.size_request(); -#endif int minHeight = 70; if (sreq.height < minHeight) { // Set a min height to see the layers when used with Ubuntu liboverlay-scrollbar diff --git a/src/ui/dialog/tags.h b/src/ui/dialog/tags.h index 3576bd111..bdda22dd4 100644 --- a/src/ui/dialog/tags.h +++ b/src/ui/dialog/tags.h @@ -141,15 +141,9 @@ private: Gtk::TreeView _tree; Gtk::CellRendererText *_text_renderer; Gtk::TreeView::Column *_name_column; -#if WITH_GTKMM_3_0 Gtk::Box _buttonsRow; Gtk::Box _buttonsPrimary; Gtk::Box _buttonsSecondary; -#else - Gtk::HBox _buttonsRow; - Gtk::HBox _buttonsPrimary; - Gtk::HBox _buttonsSecondary; -#endif Gtk::ScrolledWindow _scroller; Gtk::Menu _popupMenu; Inkscape::UI::Widget::SpinButton _spinBtn; diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp index e4216d001..50c6c1553 100644 --- a/src/ui/dialog/text-edit.cpp +++ b/src/ui/dialog/text-edit.cpp @@ -92,9 +92,7 @@ TextEdit::TextEdit() styleButton(&align_right, _("Align right"), INKSCAPE_ICON("format-justify-right"), &align_left); styleButton(&align_justify, _("Justify (only flowed text)"), INKSCAPE_ICON("format-justify-fill"), &align_left); -#if WITH_GTKMM_3_0 align_sep.set_orientation(Gtk::ORIENTATION_VERTICAL); -#endif layout_hbox.pack_start(align_sep, false, false, 10); @@ -102,9 +100,7 @@ TextEdit::TextEdit() styleButton(&text_horizontal, _("Horizontal text"), INKSCAPE_ICON("format-text-direction-horizontal"), NULL); styleButton(&text_vertical, _("Vertical text"), INKSCAPE_ICON("format-text-direction-vertical"), &text_horizontal); -#if WITH_GTKMM_3_0 text_sep.set_orientation(Gtk::ORIENTATION_VERTICAL); -#endif layout_hbox.pack_start(text_sep, false, false, 10); @@ -139,12 +135,8 @@ TextEdit::TextEdit() gtk_widget_set_tooltip_text(startOffset, _("Text path offset")); -#if WITH_GTKMM_3_0 - Gtk::Separator *sep = Gtk::manage(new Gtk::Separator()); + auto sep = Gtk::manage(new Gtk::Separator()); sep->set_orientation(Gtk::ORIENTATION_VERTICAL); -#else - Gtk::VSeparator *sep = Gtk::manage(new Gtk::VSeparator); -#endif layout_hbox.pack_start(*sep, false, false, 10); layout_hbox.pack_start(*Gtk::manage(Glib::wrap(startOffset)), false, false); @@ -168,7 +160,6 @@ TextEdit::TextEdit() gtk_text_view_set_wrap_mode ((GtkTextView *) text_view, GTK_WRAP_WORD); #ifdef WITH_GTKSPELL -#ifdef WITH_GTKMM_3_0 /* TODO: Use computed xml:lang attribute of relevant element, if present, to specify the language (either as 2nd arg of gtkspell_new_attach, or with explicit @@ -180,20 +171,6 @@ TextEdit::TextEdit() if (! gtk_spell_checker_attach(speller, GTK_TEXT_VIEW(text_view))) { g_print("gtkspell error:\n"); } -#else - GError *error = NULL; - -/* - TODO: Use computed xml:lang attribute of relevant element, if present, to specify the - language (either as 2nd arg of gtkspell_new_attach, or with explicit - gtkspell_set_language call in; see advanced.c example in gtkspell docs). - onReadSelection looks like a suitable place. -*/ - if (gtkspell_new_attach(GTK_TEXT_VIEW(text_view), NULL, &error) == NULL) { - g_print("gtkspell error: %s\n", error->message); - g_error_free(error); - } -#endif #endif gtk_widget_set_size_request (text_view, -1, 64); 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 b7312814f..7f1492cd7 100644 --- a/src/ui/dialog/transformation.cpp +++ b/src/ui/dialog/transformation.cpp @@ -212,38 +212,20 @@ void Transformation::layoutPageMove() //_scalar_move_vertical.set_label_image( INKSCAPE_STOCK_ARROWS_HOR ); -#if WITH_GTKMM_3_0 _page_move.table().attach(_scalar_move_horizontal, 0, 0, 2, 1); _page_move.table().attach(_units_move, 2, 0, 1, 1); -#else - _page_move.table() - .attach(_scalar_move_horizontal, 0, 2, 0, 1, Gtk::FILL, Gtk::SHRINK); - - _page_move.table() - .attach(_units_move, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK); -#endif _scalar_move_horizontal.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onMoveValueChanged)); //_scalar_move_vertical.set_label_image( INKSCAPE_STOCK_ARROWS_VER ); -#if WITH_GTKMM_3_0 _page_move.table().attach(_scalar_move_vertical, 0, 1, 2, 1); -#else - _page_move.table() - .attach(_scalar_move_vertical, 0, 2, 1, 2, Gtk::FILL, Gtk::SHRINK); -#endif _scalar_move_vertical.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onMoveValueChanged)); // Relative moves -#if WITH_GTKMM_3_0 _page_move.table().attach(_check_move_relative, 0, 2, 2, 1); -#else - _page_move.table() - .attach(_check_move_relative, 0, 2, 2, 3, Gtk::FILL, Gtk::SHRINK); -#endif _check_move_relative.set_active(true); _check_move_relative.signal_toggled() @@ -269,36 +251,18 @@ void Transformation::layoutPageScale() _scalar_scale_vertical.setAbsoluteIsIncrement(true); _scalar_scale_vertical.setPercentageIsIncrement(true); -#if WITH_GTKMM_3_0 _page_scale.table().attach(_scalar_scale_horizontal, 0, 0, 2, 1); -#else - _page_scale.table() - .attach(_scalar_scale_horizontal, 0, 2, 0, 1, Gtk::FILL, Gtk::SHRINK); -#endif _scalar_scale_horizontal.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onScaleXValueChanged)); -#if WITH_GTKMM_3_0 _page_scale.table().attach(_units_scale, 2, 0, 1, 1); _page_scale.table().attach(_scalar_scale_vertical, 0, 1, 2, 1); -#else - _page_scale.table() - .attach(_units_scale, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK); - - _page_scale.table() - .attach(_scalar_scale_vertical, 0, 2, 1, 2, Gtk::FILL, Gtk::SHRINK); -#endif _scalar_scale_vertical.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onScaleYValueChanged)); -#if WITH_GTKMM_3_0 _page_scale.table().attach(_check_scale_proportional, 0, 2, 2, 1); -#else - _page_scale.table() - .attach(_check_scale_proportional, 0, 2, 2, 3, Gtk::FILL, Gtk::SHRINK); -#endif _check_scale_proportional.set_active(false); _check_scale_proportional.signal_toggled() @@ -330,24 +294,10 @@ void Transformation::layoutPageRotate() Gtk::RadioButton::Group group = _counterclockwise_rotate.get_group(); _clockwise_rotate.set_group(group); -#if WITH_GTKMM_3_0 _page_rotate.table().attach(_scalar_rotate, 0, 0, 2, 1); _page_rotate.table().attach(_units_rotate, 2, 0, 1, 1); _page_rotate.table().attach(_counterclockwise_rotate, 3, 0, 1, 1); _page_rotate.table().attach(_clockwise_rotate, 4, 0, 1, 1); -#else - _page_rotate.table() - .attach(_scalar_rotate, 0, 2, 0, 1, Gtk::FILL, Gtk::SHRINK); - - _page_rotate.table() - .attach(_units_rotate, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK); - - _page_rotate.table() - .attach(_counterclockwise_rotate, 3, 4, 0, 1, Gtk::SHRINK, Gtk::SHRINK); - - _page_rotate.table() - .attach(_clockwise_rotate, 4, 5, 0, 1, Gtk::SHRINK, Gtk::SHRINK); -#endif Inkscape::Preferences *prefs = Inkscape::Preferences::get(); if (prefs->getBool("/dialogs/transformation/rotateCounterClockwise", TRUE)) { @@ -381,26 +331,13 @@ void Transformation::layoutPageSkew() _scalar_skew_vertical.setDigits(3); _scalar_skew_vertical.setIncrements(0.1, 1.0); -#if WITH_GTKMM_3_0 _page_skew.table().attach(_scalar_skew_horizontal, 0, 0, 2, 1); -#else - _page_skew.table() - .attach(_scalar_skew_horizontal, 0, 2, 0, 1, Gtk::FILL, Gtk::SHRINK); -#endif _scalar_skew_horizontal.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onSkewValueChanged)); -#if WITH_GTKMM_3_0 _page_skew.table().attach(_units_skew, 2, 0, 1, 1); _page_skew.table().attach(_scalar_skew_vertical, 0, 1, 2, 1); -#else - _page_skew.table() - .attach(_units_skew, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK); - - _page_skew.table() - .attach(_scalar_skew_vertical, 0, 2, 1, 2, Gtk::FILL, Gtk::SHRINK); -#endif _scalar_skew_vertical.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onSkewValueChanged)); @@ -418,12 +355,7 @@ void Transformation::layoutPageTransform() _scalar_transform_a.setIncrements(0.1, 1.0); _scalar_transform_a.setValue(1.0); -#if WITH_GTKMM_3_0 _page_transform.table().attach(_scalar_transform_a, 0, 0, 1, 1); -#else - _page_transform.table() - .attach(_scalar_transform_a, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK); -#endif _scalar_transform_a.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onTransformValueChanged)); @@ -434,12 +366,7 @@ void Transformation::layoutPageTransform() _scalar_transform_b.setIncrements(0.1, 1.0); _scalar_transform_b.setValue(0.0); -#if WITH_GTKMM_3_0 _page_transform.table().attach(_scalar_transform_b, 0, 1, 1, 1); -#else - _page_transform.table() - .attach(_scalar_transform_b, 0, 1, 1, 2, Gtk::SHRINK, Gtk::SHRINK); -#endif _scalar_transform_b.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onTransformValueChanged)); @@ -450,12 +377,7 @@ void Transformation::layoutPageTransform() _scalar_transform_c.setIncrements(0.1, 1.0); _scalar_transform_c.setValue(0.0); -#if WITH_GTKMM_3_0 _page_transform.table().attach(_scalar_transform_c, 1, 0, 1, 1); -#else - _page_transform.table() - .attach(_scalar_transform_c, 1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK); -#endif _scalar_transform_c.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onTransformValueChanged)); @@ -467,12 +389,7 @@ void Transformation::layoutPageTransform() _scalar_transform_d.setIncrements(0.1, 1.0); _scalar_transform_d.setValue(1.0); -#if WITH_GTKMM_3_0 _page_transform.table().attach(_scalar_transform_d, 1, 1, 1, 1); -#else - _page_transform.table() - .attach(_scalar_transform_d, 1, 2, 1, 2, Gtk::SHRINK, Gtk::SHRINK); -#endif _scalar_transform_d.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onTransformValueChanged)); @@ -484,12 +401,7 @@ void Transformation::layoutPageTransform() _scalar_transform_e.setIncrements(0.1, 1.0); _scalar_transform_e.setValue(0.0); -#if WITH_GTKMM_3_0 _page_transform.table().attach(_scalar_transform_e, 2, 0, 1, 1); -#else - _page_transform.table() - .attach(_scalar_transform_e, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK); -#endif _scalar_transform_e.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onTransformValueChanged)); @@ -501,23 +413,13 @@ void Transformation::layoutPageTransform() _scalar_transform_f.setIncrements(0.1, 1.0); _scalar_transform_f.setValue(0.0); -#if WITH_GTKMM_3_0 _page_transform.table().attach(_scalar_transform_f, 2, 1, 1, 1); -#else - _page_transform.table() - .attach(_scalar_transform_f, 2, 3, 1, 2, Gtk::SHRINK, Gtk::SHRINK); -#endif _scalar_transform_f.signal_value_changed() .connect(sigc::mem_fun(*this, &Transformation::onTransformValueChanged)); // Edit existing matrix -#if WITH_GTKMM_3_0 _page_transform.table().attach(_check_replace_matrix, 0, 2, 2, 1); -#else - _page_transform.table() - .attach(_check_replace_matrix, 0, 2, 2, 3, Gtk::FILL, Gtk::SHRINK); -#endif _check_replace_matrix.set_active(false); _check_replace_matrix.signal_toggled() @@ -564,11 +466,7 @@ void Transformation::updateSelection(PageType page, Inkscape::Selection *selecti selection && !selection->isEmpty()); } -#if WITH_GTKMM_3_0 void Transformation::onSwitchPage(Gtk::Widget * /*page*/, guint pagenum) -#else -void Transformation::onSwitchPage(GtkNotebookPage * /*page*/, guint pagenum) -#endif { updateSelection((PageType)pagenum, getDesktop()->getSelection()); } diff --git a/src/ui/dialog/transformation.h b/src/ui/dialog/transformation.h index 89aa95d90..9595e87bc 100644 --- a/src/ui/dialog/transformation.h +++ b/src/ui/dialog/transformation.h @@ -169,11 +169,7 @@ protected: virtual void _apply(); void presentPage(PageType page); -#if WITH_GTKMM_3_0 void onSwitchPage(Gtk::Widget *page, guint pagenum); -#else - void onSwitchPage(GtkNotebookPage *page, guint pagenum); -#endif /** * Callbacks for when a user changes values on the panels diff --git a/src/ui/dialog/undo-history.cpp b/src/ui/dialog/undo-history.cpp index 38fab8f07..53aa7e6ff 100644 --- a/src/ui/dialog/undo-history.cpp +++ b/src/ui/dialog/undo-history.cpp @@ -31,20 +31,11 @@ namespace UI { namespace Dialog { /* Rendering functions for custom cell renderers */ -#if WITH_GTKMM_3_0 void CellRendererSPIcon::render_vfunc(const Cairo::RefPtr<Cairo::Context>& cr, Gtk::Widget& widget, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, Gtk::CellRendererState flags) -#else -void CellRendererSPIcon::render_vfunc(const Glib::RefPtr<Gdk::Drawable>& window, - Gtk::Widget& widget, - const Gdk::Rectangle& background_area, - const Gdk::Rectangle& cell_area, - const Gdk::Rectangle& expose_area, - Gtk::CellRendererState flags) -#endif { // if this event type doesn't have an icon... if ( !Inkscape::Verb::get(_property_event_type)->get_image() ) return; @@ -63,13 +54,8 @@ void CellRendererSPIcon::render_vfunc(const Glib::RefPtr<Gdk::Drawable>& window, sp_icon_fetch_pixbuf(sp_icon); _property_icon = Glib::wrap(sp_icon->pb, true); } else if ( GTK_IS_IMAGE(icon->gobj()) ) { -#if WITH_GTKMM_3_0 _property_icon = Gtk::Invisible().render_icon_pixbuf(Gtk::StockID(image), Gtk::ICON_SIZE_MENU); -#else - _property_icon = Gtk::Invisible().render_icon(Gtk::StockID(image), - Gtk::ICON_SIZE_MENU); -#endif } else { delete icon; return; @@ -83,42 +69,23 @@ void CellRendererSPIcon::render_vfunc(const Glib::RefPtr<Gdk::Drawable>& window, property_pixbuf() = _icon_cache[_property_event_type]; } -#if WITH_GTKMM_3_0 Gtk::CellRendererPixbuf::render_vfunc(cr, widget, background_area, cell_area, flags); -#else - Gtk::CellRendererPixbuf::render_vfunc(window, widget, background_area, - cell_area, expose_area, flags); -#endif } -#if WITH_GTKMM_3_0 void CellRendererInt::render_vfunc(const Cairo::RefPtr<Cairo::Context>& cr, Gtk::Widget& widget, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, Gtk::CellRendererState flags) -#else -void CellRendererInt::render_vfunc(const Glib::RefPtr<Gdk::Drawable>& window, - Gtk::Widget& widget, - const Gdk::Rectangle& background_area, - const Gdk::Rectangle& cell_area, - const Gdk::Rectangle& expose_area, - Gtk::CellRendererState flags) -#endif { if( _filter(_property_number) ) { std::ostringstream s; s << _property_number << std::flush; property_text() = s.str(); -#if WITH_GTKMM_3_0 Gtk::CellRendererText::render_vfunc(cr, widget, background_area, cell_area, flags); -#else - Gtk::CellRendererText::render_vfunc(window, widget, background_area, - cell_area, expose_area, flags); -#endif } } diff --git a/src/ui/dialog/undo-history.h b/src/ui/dialog/undo-history.h index b0cc283cf..48929a0d0 100644 --- a/src/ui/dialog/undo-history.h +++ b/src/ui/dialog/undo-history.h @@ -50,20 +50,11 @@ public: property_event_type() { return _property_event_type.get_proxy(); } protected: -#if WITH_GTKMM_3_0 virtual void render_vfunc(const Cairo::RefPtr<Cairo::Context>& cr, Gtk::Widget& widget, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, Gtk::CellRendererState flags); -#else - virtual void render_vfunc(const Glib::RefPtr<Gdk::Drawable>& window, - Gtk::Widget& widget, - const Gdk::Rectangle& background_area, - const Gdk::Rectangle& cell_area, - const Gdk::Rectangle& expose_area, - Gtk::CellRendererState flags); -#endif private: Glib::Property<Glib::RefPtr<Gdk::Pixbuf> > _property_icon; @@ -95,20 +86,11 @@ public: static const Filter& no_filter; protected: -#if WITH_GTKMM_3_0 virtual void render_vfunc(const Cairo::RefPtr<Cairo::Context>& cr, Gtk::Widget& widget, const Gdk::Rectangle& background_area, const Gdk::Rectangle& cell_area, Gtk::CellRendererState flags); -#else - virtual void render_vfunc(const Glib::RefPtr<Gdk::Drawable>& window, - Gtk::Widget& widget, - const Gdk::Rectangle& background_area, - const Gdk::Rectangle& cell_area, - const Gdk::Rectangle& expose_area, - Gtk::CellRendererState flags); -#endif private: diff --git a/src/ui/dialog/xml-tree.cpp b/src/ui/dialog/xml-tree.cpp index c2711bb02..eae33ff83 100644 --- a/src/ui/dialog/xml-tree.cpp +++ b/src/ui/dialog/xml-tree.cpp @@ -74,11 +74,7 @@ XmlTree::XmlTree (void) : xml_attribute_delete_button (_("Delete attribute")), text_container (), attr_container (), -#if WITH_GTKMM_3_0 attr_subpaned_container(Gtk::ORIENTATION_VERTICAL), -#else - attr_subpaned_container(), -#endif set_attr (_("Set")), new_window(NULL) { @@ -95,9 +91,7 @@ XmlTree::XmlTree (void) : status.set_alignment( 0.0, 0.5); status.set_size_request(1, -1); status.set_markup(""); -#if WITH_GTKMM_3_0 status.set_line_wrap(true); -#endif status_box.pack_start( status, TRUE, TRUE, 0); contents->pack_end(status_box, false, false, 2); @@ -876,31 +870,19 @@ void XmlTree::cmd_new_element_node() g_signal_connect(G_OBJECT(new_window), "destroy", gtk_main_quit, NULL); g_signal_connect(G_OBJECT(new_window), "key-press-event", G_CALLBACK(quit_on_esc), new_window); -#if GTK_CHECK_VERSION(3,0,0) vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4); gtk_box_set_homogeneous(GTK_BOX(vbox), FALSE); -#else - vbox = gtk_vbox_new(FALSE, 4); -#endif gtk_container_add(GTK_CONTAINER(new_window), vbox); name_entry = new Gtk::Entry(); gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(name_entry->gobj()), FALSE, TRUE, 0); -#if GTK_CHECK_VERSION(3,0,0) sep = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL); -#else - sep = gtk_hseparator_new(); -#endif gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, TRUE, 0); -#if GTK_CHECK_VERSION(3,0,0) bbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL); -#else - bbox = gtk_hbutton_box_new(); -#endif gtk_container_set_border_width(GTK_CONTAINER(bbox), 4); gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); diff --git a/src/ui/dialog/xml-tree.h b/src/ui/dialog/xml-tree.h index 58ef3aef8..a4c3fffcb 100644 --- a/src/ui/dialog/xml-tree.h +++ b/src/ui/dialog/xml-tree.h @@ -218,13 +218,7 @@ private: Gtk::Button *create_button; Gtk::Entry *name_entry; - -#if WITH_GTKMM_3_0 Gtk::Paned paned; -#else - Gtk::HPaned paned; -#endif - Gtk::VBox left_box; Gtk::VBox right_box; Gtk::HBox status_box; @@ -248,12 +242,7 @@ private: Gtk::ScrolledWindow text_container; Gtk::HBox attr_hbox; Gtk::VBox attr_container; - -#if WITH_GTKMM_3_0 Gtk::Paned attr_subpaned_container; -#else - Gtk::VPaned attr_subpaned_container; -#endif Gtk::Button set_attr; diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp index 42142f665..b47e66451 100644 --- a/src/ui/interface.cpp +++ b/src/ui/interface.cpp @@ -73,9 +73,7 @@ #include "message-stack.h" #include "ui/dialog/layer-properties.h" -#if GTK_CHECK_VERSION(3,0,0) - #include "widgets/image-menu-item.h" -#endif +#include "widgets/image-menu-item.h" using Inkscape::DocumentUndo; @@ -407,11 +405,7 @@ sp_ui_menuitem_add_icon( GtkWidget *item, gchar *icon_name ) icon = sp_icon_new( Inkscape::ICON_SIZE_MENU, icon_name ); gtk_widget_show(icon); -#if GTK_CHECK_VERSION(3,0,0) image_menu_item_set_image((ImageMenuItem *) item, icon); -#else - gtk_image_menu_item_set_image((GtkImageMenuItem *) item, icon); -#endif } // end of sp_ui_menu_add_icon void @@ -465,11 +459,7 @@ static GtkWidget *sp_ui_menu_append_item_from_verb(GtkMenu *menu, Inkscape::Verb if (radio) { item = gtk_radio_menu_item_new_with_mnemonic(group, action->name); } else { -#if GTK_CHECK_VERSION(3,0,0) item = image_menu_item_new_with_mnemonic(action->name); -#else - item = gtk_image_menu_item_new_with_mnemonic(action->name); -#endif } gtk_label_set_markup_with_mnemonic( GTK_LABEL(gtk_bin_get_child(GTK_BIN (item))), action->name); @@ -560,11 +550,7 @@ static bool getViewStateFromPref(Inkscape::UI::View::View *view, gchar const *pr return prefs->getBool(pref_path, true); } -#if GTK_CHECK_VERSION(3,0,0) static gboolean checkitem_update(GtkWidget *widget, cairo_t * /*cr*/, gpointer user_data) -#else -static gboolean checkitem_update(GtkWidget *widget, GdkEventExpose * /*event*/, gpointer user_data) -#endif { GtkCheckMenuItem *menuitem=GTK_CHECK_MENU_ITEM(widget); @@ -621,11 +607,7 @@ static void taskToggled(GtkCheckMenuItem *menuitem, gpointer userData) /** * Callback function to update the status of the radio buttons in the View -> Display mode menu (Normal, No Filters, Outline) and Color display mode. */ -#if GTK_CHECK_VERSION(3,0,0) static gboolean update_view_menu(GtkWidget *widget, cairo_t * /*cr*/, gpointer user_data) -#else -static gboolean update_view_menu(GtkWidget *widget, GdkEventExpose * /*event*/, gpointer user_data) -#endif { SPAction *action = (SPAction *) user_data; g_assert(action->id != NULL); @@ -669,11 +651,7 @@ static gboolean update_view_menu(GtkWidget *widget, GdkEventExpose * /*event*/, static void sp_ui_menu_append_check_item_from_verb(GtkMenu *menu, Inkscape::UI::View::View *view, gchar const *label, gchar const *tip, gchar const *pref, void (*callback_toggle)(GtkCheckMenuItem *, gpointer user_data), -#if GTK_CHECK_VERSION(3,0,0) gboolean (*callback_update)(GtkWidget *widget, cairo_t *cr, gpointer user_data), -#else - gboolean (*callback_update)(GtkWidget *widget, GdkEventExpose *event, gpointer user_data), -#endif Inkscape::Verb *verb) { unsigned int shortcut = (verb) ? sp_shortcut_get_primary(verb) : 0; @@ -697,11 +675,7 @@ sp_ui_menu_append_check_item_from_verb(GtkMenu *menu, Inkscape::UI::View::View * g_signal_connect( G_OBJECT(item), "toggled", (GCallback) callback_toggle, (void *) pref); -#if GTK_CHECK_VERSION(3,0,0) g_signal_connect( G_OBJECT(item), "draw", (GCallback) callback_update, (void *) pref); -#else - g_signal_connect( G_OBJECT(item), "expose_event", (GCallback) callback_update, (void *) pref); -#endif (*callback_update)(item, NULL, (void *)pref); @@ -844,11 +818,7 @@ static void sp_ui_build_dyn_menus(Inkscape::XML::Node *menus, GtkWidget *menu, I } if (verb->get_code() != SP_VERB_NONE) { SPAction *action = verb->get_action(Inkscape::ActionContext(view)); -#if GTK_CHECK_VERSION(3,0,0) g_signal_connect( G_OBJECT(item), "draw", (GCallback) update_view_menu, (void *) action); -#else - g_signal_connect( G_OBJECT(item), "expose_event", (GCallback) update_view_menu, (void *) action); -#endif } } else if (menu_pntr->attribute("check") != NULL) { if (verb->get_code() != SP_VERB_NONE) { diff --git a/src/ui/previewholder.cpp b/src/ui/previewholder.cpp index ac1369ced..ef11daa3b 100644 --- a/src/ui/previewholder.cpp +++ b/src/ui/previewholder.cpp @@ -17,12 +17,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 @@ -54,7 +49,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); @@ -65,21 +59,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); } @@ -92,11 +74,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; @@ -140,7 +118,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); @@ -148,10 +125,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; @@ -167,44 +140,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); } } @@ -304,12 +258,8 @@ void PreviewHolder::on_size_allocate( Gtk::Allocation& allocation ) if ( _insides && !_wrap && (_view != VIEW_TYPE_LIST) && (_anchor == SP_ANCHOR_NORTH || _anchor == SP_ANCHOR_SOUTH) ) { Gtk::Requisition req; -#if GTK_CHECK_VERSION(3,0,0) Gtk::Requisition req_natural; _insides->get_preferred_size(req, req_natural); -#else - req = _insides->size_request(); -#endif gint delta = allocation.get_width() - req.width; if ( (delta > 4) && req.height < allocation.get_height() ) { @@ -351,43 +301,27 @@ void PreviewHolder::calcGridSize( const Gtk::Widget* thing, int itemCount, int& if ( _anchor == SP_ANCHOR_SOUTH || _anchor == SP_ANCHOR_NORTH ) { Gtk::Requisition req; -#if GTK_CHECK_VERSION(3,0,0) Gtk::Requisition req_natural; _scroller->get_preferred_size(req, req_natural); -#else - req = _scroller->size_request(); -#endif int currW = _scroller->get_width(); if ( currW > req.width ) { req.width = currW; } -#if GTK_CHECK_VERSION(3,0,0) - Gtk::Scrollbar* hs = dynamic_cast<Gtk::ScrolledWindow*>(_scroller)->get_hscrollbar(); -#else - Gtk::HScrollbar* hs = dynamic_cast<Gtk::ScrolledWindow*>(_scroller)->get_hscrollbar(); -#endif + auto hs = dynamic_cast<Gtk::ScrolledWindow*>(_scroller)->get_hscrollbar(); if ( hs ) { Gtk::Requisition scrollReq; -#if GTK_CHECK_VERSION(3,0,0) Gtk::Requisition scrollReq_natural; hs->get_preferred_size(scrollReq, scrollReq_natural); -#else - scrollReq = hs->size_request(); -#endif // the +8 is a temporary hack req.height -= scrollReq.height + 8; } Gtk::Requisition req2; -#if GTK_CHECK_VERSION(3,0,0) Gtk::Requisition req2_natural; const_cast<Gtk::Widget*>(thing)->get_preferred_size(req2, req2_natural); -#else - req2 = const_cast<Gtk::Widget*>(thing)->size_request(); -#endif int h2 = ((req2.height > 0) && (req.height > req2.height)) ? (req.height / req2.height) : 1; int w2 = ((req2.width > 0) && (req.width > req2.width)) ? (req.width / req2.width) : 1; @@ -415,21 +349,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++ ) { @@ -438,7 +362,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); @@ -446,10 +369,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 ); @@ -472,28 +391,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; @@ -501,11 +408,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/tool/Makefile_insert b/src/ui/tool/Makefile_insert deleted file mode 100644 index f46f48b72..000000000 --- a/src/ui/tool/Makefile_insert +++ /dev/null @@ -1,30 +0,0 @@ -## Makefile.am fragment sourced by src/Makefile.am. - -ink_common_sources += \ - ui/tool/control-point.cpp \ - ui/tool/control-point.h \ - ui/tool/control-point-selection.cpp \ - ui/tool/control-point-selection.h \ - ui/tool/commit-events.h \ - ui/tool/curve-drag-point.cpp \ - ui/tool/curve-drag-point.h \ - ui/tool/event-utils.cpp \ - ui/tool/event-utils.h \ - ui/tool/manipulator.cpp \ - ui/tool/manipulator.h \ - ui/tool/modifier-tracker.cpp \ - ui/tool/modifier-tracker.h \ - ui/tool/multi-path-manipulator.cpp \ - ui/tool/multi-path-manipulator.h \ - ui/tool/node.cpp \ - ui/tool/node.h \ - ui/tool/node-types.h \ - ui/tool/path-manipulator.cpp \ - ui/tool/path-manipulator.h \ - ui/tool/selectable-control-point.cpp \ - ui/tool/selectable-control-point.h \ - ui/tool/selector.cpp \ - ui/tool/selector.h \ - ui/tool/shape-record.h \ - ui/tool/transform-handle-set.cpp \ - ui/tool/transform-handle-set.h diff --git a/src/ui/tools/Makefile_insert b/src/ui/tools/Makefile_insert deleted file mode 100644 index 686dfedd8..000000000 --- a/src/ui/tools/Makefile_insert +++ /dev/null @@ -1,34 +0,0 @@ -## Makefile.am fragment sourced by src/Makefile.am. - -ink_common_sources += \ - ui/tools/arc-tool.cpp ui/tools/arc-tool.h \ - ui/tools/box3d-tool.cpp ui/tools/box3d-tool.h \ - ui/tools/calligraphic-tool.cpp ui/tools/calligraphic-tool.h \ - ui/tools/connector-tool.cpp ui/tools/connector-tool.h \ - ui/tools/dropper-tool.cpp ui/tools/dropper-tool.h \ - ui/tools/dynamic-base.cpp ui/tools/dynamic-base.h \ - ui/tools/eraser-tool.cpp ui/tools/eraser-tool.h \ - ui/tools/freehand-base.cpp ui/tools/freehand-base.h \ - ui/tools/gradient-tool.cpp ui/tools/gradient-tool.h \ - ui/tools/lpe-tool.cpp ui/tools/lpe-tool.h \ - ui/tools/measure-tool.cpp ui/tools/measure-tool.h \ - ui/tools/mesh-tool.cpp ui/tools/mesh-tool.h \ - ui/tools/node-tool.cpp ui/tools/node-tool.h \ - ui/tools/pen-tool.cpp ui/tools/pen-tool.h \ - ui/tools/pencil-tool.cpp ui/tools/pencil-tool.h \ - ui/tools/rect-tool.cpp ui/tools/rect-tool.h \ - ui/tools/select-tool.cpp ui/tools/select-tool.h \ - ui/tools/spiral-tool.cpp ui/tools/spiral-tool.h \ - ui/tools/spray-tool.cpp ui/tools/spray-tool.h \ - ui/tools/star-tool.cpp ui/tools/star-tool.h \ - ui/tools/text-tool.cpp ui/tools/text-tool.h \ - ui/tools/tool-base.cpp ui/tools/tool-base.h \ - ui/tools/tweak-tool.cpp ui/tools/tweak-tool.h \ - ui/tools/zoom-tool.cpp ui/tools/zoom-tool.h - -if HAVE_POTRACE - -ink_common_sources += \ - ui/tools/flood-tool.cpp ui/tools/flood-tool.h - -endif diff --git a/src/ui/tools/dropper-tool.cpp b/src/ui/tools/dropper-tool.cpp index 4db720686..99177dc75 100644 --- a/src/ui/tools/dropper-tool.cpp +++ b/src/ui/tools/dropper-tool.cpp @@ -118,20 +118,12 @@ void DropperTool::finish() { } if (cursor_dropper_fill) { -#if GTK_CHECK_VERSION(3,0,0) g_object_unref(cursor_dropper_fill); -#else - gdk_cursor_unref (cursor_dropper_fill); -#endif cursor_dropper_fill = NULL; } if (cursor_dropper_stroke) { -#if GTK_CHECK_VERSION(3,0,0) g_object_unref(cursor_dropper_stroke); -#else - gdk_cursor_unref (cursor_dropper_stroke); -#endif cursor_dropper_fill = NULL; } diff --git a/src/ui/tools/select-tool.cpp b/src/ui/tools/select-tool.cpp index 28ede7cb2..86a2dbed3 100644 --- a/src/ui/tools/select-tool.cpp +++ b/src/ui/tools/select-tool.cpp @@ -126,20 +126,12 @@ SelectTool::~SelectTool() { this->_describer = NULL; if (CursorSelectDragging) { -#if GTK_CHECK_VERSION(3,0,0) g_object_unref(CursorSelectDragging); -#else - gdk_cursor_unref (CursorSelectDragging); -#endif CursorSelectDragging = NULL; } if (CursorSelectMouseover) { -#if GTK_CHECK_VERSION(3,0,0) g_object_unref(CursorSelectMouseover); -#else - gdk_cursor_unref (CursorSelectMouseover); -#endif CursorSelectMouseover = NULL; } } diff --git a/src/ui/tools/tool-base.cpp b/src/ui/tools/tool-base.cpp index 3d41bf417..8a35882b9 100644 --- a/src/ui/tools/tool-base.cpp +++ b/src/ui/tools/tool-base.cpp @@ -110,11 +110,7 @@ ToolBase::~ToolBase() { } if (this->cursor != NULL) { -#if GTK_CHECK_VERSION(3,0,0) g_object_unref(this->cursor); -#else - gdk_cursor_unref(this->cursor); -#endif this->cursor = NULL; } @@ -141,16 +137,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 - } /** @@ -180,11 +170,7 @@ void ToolBase::sp_event_context_update_cursor() { ); if (pixbuf != NULL) { if (this->cursor) { -#if GTK_CHECK_VERSION(3,0,0) g_object_unref(this->cursor); -#else - gdk_cursor_unref(this->cursor); -#endif } this->cursor = gdk_cursor_new_from_pixbuf(display, pixbuf, this->hot_x, this->hot_y); g_object_unref(pixbuf); @@ -194,11 +180,7 @@ void ToolBase::sp_event_context_update_cursor() { if (pixbuf) { if (this->cursor) { -#if GTK_CHECK_VERSION(3,0,0) g_object_unref(this->cursor); -#else - gdk_cursor_unref(this->cursor); -#endif } this->cursor = gdk_cursor_new_from_pixbuf(display, pixbuf, this->hot_x, this->hot_y); @@ -769,11 +751,9 @@ bool ToolBase::root_handler(GdkEvent* event) { int const wheel_scroll = prefs->getIntLimited( "/options/wheelscroll/value", 40, 0, 1000); -#if GTK_CHECK_VERSION(3,0,0) // Size of smooth-scrolls (only used in GTK+ 3) gdouble delta_x = 0; gdouble delta_y = 0; -#endif /* shift + wheel, pan left--right */ if (event->scroll.state & GDK_SHIFT_MASK) { @@ -834,12 +814,10 @@ bool ToolBase::root_handler(GdkEvent* event) { desktop->scroll_world(-wheel_scroll, 0); break; -#if GTK_CHECK_VERSION(3,0,0) case GDK_SCROLL_SMOOTH: gdk_event_get_scroll_deltas(event, &delta_x, &delta_y); desktop->scroll_world(delta_x, delta_y); break; -#endif } } break; diff --git a/src/ui/view/Makefile_insert b/src/ui/view/Makefile_insert deleted file mode 100644 index b3ab598d4..000000000 --- a/src/ui/view/Makefile_insert +++ /dev/null @@ -1,9 +0,0 @@ -## Makefile.am fragment sourced by src/Makefile.am. - -ink_common_sources += \ - ui/view/edit-widget-interface.h \ - ui/view/view.h \ - ui/view/view.cpp \ - ui/view/view-widget.cpp \ - ui/view/view-widget.h - diff --git a/src/ui/widget/Makefile_insert b/src/ui/widget/Makefile_insert deleted file mode 100644 index eb98e6872..000000000 --- a/src/ui/widget/Makefile_insert +++ /dev/null @@ -1,110 +0,0 @@ -## Makefile.am fragment sourced by src/Makefile.am. - -ink_common_sources += \ - ui/widget/anchor-selector.h \ - ui/widget/anchor-selector.cpp \ - ui/widget/attr-widget.h \ - ui/widget/button.h \ - ui/widget/button.cpp \ - ui/widget/color-entry.cpp \ - ui/widget/color-entry.h \ - ui/widget/color-icc-selector.cpp \ - ui/widget/color-icc-selector.h \ - ui/widget/color-notebook.cpp \ - ui/widget/color-notebook.h \ - ui/widget/color-wheel-selector.cpp \ - ui/widget/color-wheel-selector.h \ - ui/widget/color-picker.cpp \ - ui/widget/color-picker.h \ - ui/widget/color-preview.cpp \ - ui/widget/color-preview.h \ - ui/widget/color-slider.cpp \ - ui/widget/color-slider.h \ - ui/widget/color-scales.cpp \ - ui/widget/color-scales.h \ - ui/widget/combo-enums.h \ - ui/widget/dock.h \ - ui/widget/dock.cpp \ - ui/widget/dock-item.h \ - ui/widget/dock-item.cpp \ - ui/widget/entity-entry.cpp \ - ui/widget/entity-entry.h \ - ui/widget/entry.cpp \ - ui/widget/entry.h \ - ui/widget/filter-effect-chooser.h \ - ui/widget/filter-effect-chooser.cpp \ - ui/widget/font-variants.h \ - ui/widget/font-variants.cpp \ - ui/widget/gimpspinscale.c \ - ui/widget/gimpspinscale.h \ - ui/widget/gimpcolorwheel.c \ - ui/widget/gimpcolorwheel.h \ - ui/widget/frame.cpp \ - ui/widget/frame.h \ - ui/widget/imageicon.cpp \ - ui/widget/imageicon.h \ - ui/widget/imagetoggler.cpp \ - ui/widget/imagetoggler.h \ - ui/widget/labelled.cpp \ - ui/widget/labelled.h \ - ui/widget/layer-selector.cpp \ - ui/widget/layer-selector.h \ - ui/widget/licensor.cpp \ - ui/widget/licensor.h \ - ui/widget/notebook-page.cpp \ - ui/widget/notebook-page.h \ - ui/widget/object-composite-settings.cpp \ - ui/widget/object-composite-settings.h \ - ui/widget/page-sizer.cpp \ - ui/widget/page-sizer.h \ - ui/widget/panel.cpp \ - ui/widget/panel.h \ - ui/widget/point.cpp \ - ui/widget/point.h \ - ui/widget/preferences-widget.cpp \ - ui/widget/preferences-widget.h \ - ui/widget/random.cpp \ - ui/widget/random.h \ - ui/widget/registered-widget.cpp \ - ui/widget/registered-widget.h \ - ui/widget/registered-enums.h \ - ui/widget/registry.cpp \ - ui/widget/registry.h \ - ui/widget/rendering-options.cpp \ - ui/widget/rendering-options.h \ - ui/widget/rotateable.h \ - ui/widget/rotateable.cpp \ - ui/widget/scalar-unit.cpp \ - ui/widget/scalar-unit.h \ - ui/widget/scalar.cpp \ - ui/widget/scalar.h \ - ui/widget/selected-style.h \ - ui/widget/selected-style.cpp \ - ui/widget/spinbutton.h \ - ui/widget/spinbutton.cpp \ - ui/widget/spin-scale.h \ - ui/widget/spin-scale.cpp \ - ui/widget/spin-slider.h \ - ui/widget/spin-slider.cpp \ - ui/widget/style-subject.h \ - ui/widget/style-subject.cpp \ - ui/widget/style-swatch.h \ - ui/widget/style-swatch.cpp \ - ui/widget/text.cpp \ - ui/widget/text.h \ - ui/widget/tolerance-slider.cpp \ - ui/widget/tolerance-slider.h \ - ui/widget/unit-menu.cpp \ - ui/widget/unit-menu.h \ - ui/widget/unit-tracker.h \ - ui/widget/unit-tracker.cpp \ - ui/widget/clipmaskicon.cpp \ - ui/widget/clipmaskicon.h \ - ui/widget/highlight-picker.cpp \ - ui/widget/highlight-picker.h \ - ui/widget/layertypeicon.cpp \ - ui/widget/layertypeicon.h \ - ui/widget/insertordericon.cpp \ - ui/widget/insertordericon.h \ - ui/widget/addtoicon.cpp \ - ui/widget/addtoicon.h diff --git a/src/ui/widget/addtoicon.cpp b/src/ui/widget/addtoicon.cpp index 465423fc2..70516ed00 100644 --- a/src/ui/widget/addtoicon.cpp +++ b/src/ui/widget/addtoicon.cpp @@ -49,8 +49,6 @@ AddToIcon::AddToIcon() : set_pixbuf(); } - -#if WITH_GTKMM_3_0 void AddToIcon::get_preferred_height_vfunc(Gtk::Widget& widget, int& min_h, int& nat_h) const @@ -80,47 +78,16 @@ void AddToIcon::get_preferred_width_vfunc(Gtk::Widget& widget, nat_w += (nat_w) >> 1; } } -#else -void AddToIcon::get_size_vfunc(Gtk::Widget& widget, - const Gdk::Rectangle* cell_area, - int* x_offset, - int* y_offset, - int* width, - int* height ) const -{ - Gtk::CellRendererPixbuf::get_size_vfunc( widget, cell_area, x_offset, y_offset, width, height ); - - if ( width ) { - *width = phys;//+= (*width) >> 1; - } - if ( height ) { - *height =phys;//+= (*height) >> 1; - } -} -#endif -#if WITH_GTKMM_3_0 void AddToIcon::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 AddToIcon::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 { set_pixbuf(); -#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 } bool AddToIcon::activate_vfunc(GdkEvent* /*event*/, diff --git a/src/ui/widget/addtoicon.h b/src/ui/widget/addtoicon.h index a8d900d1f..3b2228754 100644 --- a/src/ui/widget/addtoicon.h +++ b/src/ui/widget/addtoicon.h @@ -31,8 +31,6 @@ public: Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixbuf> > property_pixbuf_off(); protected: - -#if WITH_GTKMM_3_0 virtual void render_vfunc( const Cairo::RefPtr<Cairo::Context>& cr, Gtk::Widget& widget, const Gdk::Rectangle& background_area, @@ -46,18 +44,6 @@ protected: virtual void get_preferred_height_vfunc(Gtk::Widget& widget, int& min_h, int& nat_h) const; -#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 ); - - virtual void get_size_vfunc( Gtk::Widget &widget, - Gdk::Rectangle const *cell_area, - int *x_offset, int *y_offset, int *width, int *height ) const; -#endif virtual bool activate_vfunc(GdkEvent *event, Gtk::Widget &widget, diff --git a/src/ui/widget/anchor-selector.cpp b/src/ui/widget/anchor-selector.cpp index acf8aff79..087e7375e 100644 --- a/src/ui/widget/anchor-selector.cpp +++ b/src/ui/widget/anchor-selector.cpp @@ -27,11 +27,7 @@ void AnchorSelector::setupButton(const Glib::ustring& icon, Gtk::ToggleButton& b AnchorSelector::AnchorSelector() : Gtk::Alignment(0.5, 0, 0, 0), -#if WITH_GTKMM_3_0 _container() -#else - _container(3, 3, true) -#endif { setupButton(INKSCAPE_ICON("boundingbox_top_left"), _buttons[0]); setupButton(INKSCAPE_ICON("boundingbox_top"), _buttons[1]); @@ -43,20 +39,14 @@ AnchorSelector::AnchorSelector() setupButton(INKSCAPE_ICON("boundingbox_bottom"), _buttons[7]); setupButton(INKSCAPE_ICON("boundingbox_bottom_right"), _buttons[8]); -#if WITH_GTKMM_3_0 _container.set_row_homogeneous(); _container.set_column_homogeneous(true); -#endif for(int i = 0; i < 9; ++i) { _buttons[i].signal_clicked().connect( sigc::bind(sigc::mem_fun(*this, &AnchorSelector::btn_activated), i)); -#if WITH_GTKMM_3_0 _container.attach(_buttons[i], i % 3, i / 3, 1, 1); -#else - _container.attach(_buttons[i], i % 3, i % 3+1, i / 3, i / 3+1, Gtk::FILL, Gtk::FILL); -#endif } _selection = 4; _buttons[4].set_active(); diff --git a/src/ui/widget/anchor-selector.h b/src/ui/widget/anchor-selector.h index 0a702d296..96331fae3 100644 --- a/src/ui/widget/anchor-selector.h +++ b/src/ui/widget/anchor-selector.h @@ -16,12 +16,7 @@ #include <gtkmm/alignment.h> #include <gtkmm/togglebutton.h> - -#if WITH_GTKMM_3_0 - #include <gtkmm/grid.h> -#else - #include <gtkmm/table.h> -#endif +#include <gtkmm/grid.h> namespace Inkscape { namespace UI { @@ -32,12 +27,7 @@ class AnchorSelector : public Gtk::Alignment private: Gtk::ToggleButton _buttons[9]; int _selection; - -#if WITH_GTKMM_3_0 Gtk::Grid _container; -#else - Gtk::Table _container; -#endif sigc::signal<void> _selectionChanged; diff --git a/src/ui/widget/clipmaskicon.cpp b/src/ui/widget/clipmaskicon.cpp index 8715fdede..4f791042a 100644 --- a/src/ui/widget/clipmaskicon.cpp +++ b/src/ui/widget/clipmaskicon.cpp @@ -63,8 +63,6 @@ ClipMaskIcon::ClipMaskIcon() : property_pixbuf() = Glib::RefPtr<Gdk::Pixbuf>(0); } - -#if WITH_GTKMM_3_0 void ClipMaskIcon::get_preferred_height_vfunc(Gtk::Widget& widget, int& min_h, int& nat_h) const @@ -94,39 +92,12 @@ void ClipMaskIcon::get_preferred_width_vfunc(Gtk::Widget& widget, nat_w += (nat_w) >> 1; } } -#else -void ClipMaskIcon::get_size_vfunc(Gtk::Widget& widget, - const Gdk::Rectangle* cell_area, - int* x_offset, - int* y_offset, - int* width, - int* height ) const -{ - Gtk::CellRendererPixbuf::get_size_vfunc( widget, cell_area, x_offset, y_offset, width, height ); - - if ( width ) { - *width = phys;//+= (*width) >> 1; - } - if ( height ) { - *height =phys;//+= (*height) >> 1; - } -} -#endif -#if WITH_GTKMM_3_0 void ClipMaskIcon::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 ClipMaskIcon::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 { switch (_property_active.get_value()) { @@ -143,11 +114,7 @@ void ClipMaskIcon::render_vfunc( const Glib::RefPtr<Gdk::Drawable>& window, property_pixbuf() = Glib::RefPtr<Gdk::Pixbuf>(0); break; } -#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 } bool ClipMaskIcon::activate_vfunc(GdkEvent* /*event*/, diff --git a/src/ui/widget/clipmaskicon.h b/src/ui/widget/clipmaskicon.h index eca852a83..0d149edb8 100644 --- a/src/ui/widget/clipmaskicon.h +++ b/src/ui/widget/clipmaskicon.h @@ -32,7 +32,6 @@ public: protected: -#if WITH_GTKMM_3_0 virtual void render_vfunc( const Cairo::RefPtr<Cairo::Context>& cr, Gtk::Widget& widget, const Gdk::Rectangle& background_area, @@ -46,18 +45,6 @@ protected: virtual void get_preferred_height_vfunc(Gtk::Widget& widget, int& min_h, int& nat_h) const; -#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 ); - - virtual void get_size_vfunc( Gtk::Widget &widget, - Gdk::Rectangle const *cell_area, - int *x_offset, int *y_offset, int *width, int *height ) const; -#endif virtual bool activate_vfunc(GdkEvent *event, Gtk::Widget &widget, diff --git a/src/ui/widget/color-icc-selector.cpp b/src/ui/widget/color-icc-selector.cpp index 52c6ed2e3..616e9afa8 100644 --- a/src/ui/widget/color-icc-selector.cpp +++ b/src/ui/widget/color-icc-selector.cpp @@ -5,7 +5,6 @@ #include <gtkmm/adjustment.h> #include <glibmm/i18n.h> -#include <gtk/gtk.h> #include <set> #include "ui/dialog-events.h" @@ -84,7 +83,6 @@ GtkAttachOptions operator|(GtkAttachOptions lhs, GtkAttachOptions rhs) void attachToGridOrTable(GtkWidget *parent, GtkWidget *child, guint left, guint top, guint width, guint height, bool hexpand = false, bool centered = false, guint xpadding = XPAD, guint ypadding = YPAD) { -#if GTK_CHECK_VERSION(3, 0, 0) #if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_start(child, xpadding); gtk_widget_set_margin_end(child, xpadding); @@ -103,14 +101,6 @@ void attachToGridOrTable(GtkWidget *parent, GtkWidget *child, guint left, guint gtk_widget_set_valign(child, GTK_ALIGN_CENTER); } gtk_grid_attach(GTK_GRID(parent), child, left, top, width, height); -#else - GtkAttachOptions xoptions = - centered ? static_cast<GtkAttachOptions>(0) : hexpand ? (GTK_EXPAND | GTK_FILL) : GTK_FILL; - GtkAttachOptions yoptions = centered ? static_cast<GtkAttachOptions>(0) : GTK_FILL; - - gtk_table_attach(GTK_TABLE(parent), child, left, left + width, top, top + height, xoptions, yoptions, xpadding, - ypadding); -#endif } } // namespace @@ -428,12 +418,7 @@ void ColorICCSelector::init() _impl->_compUI[i]._label = gtk_label_new_with_mnemonic(labelStr.c_str()); -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_set_halign(_impl->_compUI[i]._label, GTK_ALIGN_END); -#else - gtk_misc_set_alignment(GTK_MISC(_impl->_compUI[i]._label), 1.0, 0.5); -#endif - gtk_widget_show(_impl->_compUI[i]._label); gtk_widget_set_no_show_all(_impl->_compUI[i]._label, TRUE); @@ -492,12 +477,7 @@ void ColorICCSelector::init() // Label _impl->_label = gtk_label_new_with_mnemonic(_("_A:")); -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_set_halign(_impl->_label, GTK_ALIGN_END); -#else - gtk_misc_set_alignment(GTK_MISC(_impl->_label), 1.0, 0.5); -#endif - gtk_widget_show(_impl->_label); attachToGridOrTable(t, _impl->_label, 0, row, 1, 1); @@ -724,11 +704,7 @@ void ColorICCSelectorImpl::_profilesChanged(std::string const & /*name*/) {} void ColorICCSelector::on_show() { -#if GTK_CHECK_VERSION(3, 0, 0) Gtk::Grid::on_show(); -#else - Gtk::Table::on_show(); -#endif _colorChanged(); } diff --git a/src/ui/widget/color-icc-selector.h b/src/ui/widget/color-icc-selector.h index 1bcb0a540..aaa8372b8 100644 --- a/src/ui/widget/color-icc-selector.h +++ b/src/ui/widget/color-icc-selector.h @@ -6,11 +6,7 @@ #endif #include <gtkmm/widget.h> -#if WITH_GTKMM_3_0 #include <gtkmm/grid.h> -#else -#include <gtkmm/table.h> -#endif #include "ui/selected-color.h" @@ -24,11 +20,7 @@ namespace Widget { class ColorICCSelectorImpl; class ColorICCSelector -#if GTK_CHECK_VERSION(3, 0, 0) : public Gtk::Grid -#else - : public Gtk::Table -#endif { public: static const gchar *MODE_NAME; diff --git a/src/ui/widget/color-notebook.cpp b/src/ui/widget/color-notebook.cpp index 6634d8dad..33e22b59d 100644 --- a/src/ui/widget/color-notebook.cpp +++ b/src/ui/widget/color-notebook.cpp @@ -52,13 +52,8 @@ namespace Widget { ColorNotebook::ColorNotebook(SelectedColor &color) -#if GTK_CHECK_VERSION(3, 0, 0) : Gtk::Grid() -#else - : Gtk::Table(2, 3, false) -#endif , _selected_color(color) - { Page *page; @@ -106,12 +101,8 @@ void ColorNotebook::_initUI() notebook->set_show_tabs(false); _book = GTK_WIDGET(notebook->gobj()); -#if GTK_CHECK_VERSION(3, 0, 0) _buttonbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2); gtk_box_set_homogeneous(GTK_BOX(_buttonbox), TRUE); -#else - _buttonbox = gtk_hbox_new(TRUE, 2); -#endif gtk_widget_show(_buttonbox); _buttons = new GtkWidget *[_available_pages.size()]; @@ -122,7 +113,6 @@ void ColorNotebook::_initUI() sp_set_font_size_smaller(_buttonbox); -#if GTK_CHECK_VERSION(3, 0, 0) #if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_start(_buttonbox, XPAD); gtk_widget_set_margin_end(_buttonbox, XPAD); @@ -135,14 +125,9 @@ void ColorNotebook::_initUI() gtk_widget_set_hexpand(_buttonbox, TRUE); gtk_widget_set_valign(_buttonbox, GTK_ALIGN_CENTER); attach(*Glib::wrap(_buttonbox), 0, row, 2, 1); -#else - attach(*Glib::wrap(_buttonbox), 0, 2, row, row + 1, Gtk::EXPAND | Gtk::FILL, static_cast<Gtk::AttachOptions>(0), - XPAD, YPAD); -#endif row++; -#if GTK_CHECK_VERSION(3, 0, 0) #if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_start(_book, XPAD * 2); gtk_widget_set_margin_end(_book, XPAD * 2); @@ -155,20 +140,13 @@ void ColorNotebook::_initUI() gtk_widget_set_hexpand(_book, TRUE); gtk_widget_set_vexpand(_book, TRUE); attach(*notebook, 0, row, 2, 1); -#else - attach(*notebook, 0, 2, row, row + 1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL, XPAD * 2, YPAD); -#endif // restore the last active page Inkscape::Preferences *prefs = Inkscape::Preferences::get(); _setCurrentPage(prefs->getInt("/colorselector/page", 0)); row++; -#if GTK_CHECK_VERSION(3, 0, 0) GtkWidget *rgbabox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); -#else - GtkWidget *rgbabox = gtk_hbox_new(FALSE, 0); -#endif #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) /* Create color management icons */ @@ -206,11 +184,7 @@ void ColorNotebook::_initUI() /* Create RGBA entry and color preview */ _rgbal = gtk_label_new_with_mnemonic(_("RGBA_:")); -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_set_halign(_rgbal, GTK_ALIGN_END); -#else - gtk_misc_set_alignment(GTK_MISC(_rgbal), 1.0, 0.5); -#endif gtk_box_pack_start(GTK_BOX(rgbabox), _rgbal, TRUE, TRUE, 2); ColorEntry *rgba_entry = Gtk::manage(new ColorEntry(_selected_color)); @@ -226,7 +200,6 @@ void ColorNotebook::_initUI() gtk_widget_hide(GTK_WIDGET(_box_toomuchink)); #endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) -#if GTK_CHECK_VERSION(3, 0, 0) #if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_start(rgbabox, XPAD); gtk_widget_set_margin_end(rgbabox, XPAD); @@ -237,9 +210,6 @@ void ColorNotebook::_initUI() gtk_widget_set_margin_top(rgbabox, YPAD); gtk_widget_set_margin_bottom(rgbabox, YPAD); attach(*Glib::wrap(rgbabox), 0, row, 2, 1); -#else - attach(*Glib::wrap(rgbabox), 0, 2, row, row + 1, Gtk::FILL, Gtk::SHRINK, XPAD, YPAD); -#endif #ifdef SPCS_PREVIEW _p = sp_color_preview_new(0xffffffff); diff --git a/src/ui/widget/color-notebook.h b/src/ui/widget/color-notebook.h index d28028c72..0948e3d46 100644 --- a/src/ui/widget/color-notebook.h +++ b/src/ui/widget/color-notebook.h @@ -19,12 +19,7 @@ #endif #include <boost/ptr_container/ptr_vector.hpp> -#if WITH_GTKMM_3_0 #include <gtkmm/grid.h> -#else -#include <gtkmm/table.h> -#endif -#include <gtk/gtk.h> #include <glib.h> #include "color.h" @@ -35,11 +30,7 @@ namespace UI { namespace Widget { class ColorNotebook -#if GTK_CHECK_VERSION(3, 0, 0) : public Gtk::Grid -#else - : public Gtk::Table -#endif { public: ColorNotebook(SelectedColor &color); diff --git a/src/ui/widget/color-picker.cpp b/src/ui/widget/color-picker.cpp index a66fbfc9c..5a62c3c98 100644 --- a/src/ui/widget/color-picker.cpp +++ b/src/ui/widget/color-picker.cpp @@ -59,13 +59,8 @@ void ColorPicker::setupDialog(const Glib::ustring &title) _color_selector = Gtk::manage(new ColorNotebook(_selected_color)); -#if WITH_GTKMM_3_0 _colorSelectorDialog.get_content_area()->pack_start ( *_color_selector, true, true, 0); -#else - _colorSelectorDialog.get_vbox()->pack_start ( - *_color_selector, true, true, 0); -#endif _color_selector->show(); } diff --git a/src/ui/widget/color-preview.cpp b/src/ui/widget/color-preview.cpp index 62c7cca1d..c9b6e56d2 100644 --- a/src/ui/widget/color-preview.cpp +++ b/src/ui/widget/color-preview.cpp @@ -34,7 +34,6 @@ ColorPreview::on_size_allocate (Gtk::Allocation &all) queue_draw(); } -#if WITH_GTKMM_3_0 void ColorPreview::get_preferred_height_vfunc(int& minimum_height, int& natural_height) const { @@ -58,31 +57,6 @@ ColorPreview::get_preferred_width_for_height_vfunc(int /* height */, int& minimu { minimum_width = natural_width = SPCP_DEFAULT_WIDTH; } -#else -void -ColorPreview::on_size_request (Gtk::Requisition *req) -{ - req->width = SPCP_DEFAULT_WIDTH; - req->height = SPCP_DEFAULT_HEIGHT; -} - -bool -ColorPreview::on_expose_event (GdkEventExpose *event) -{ - bool result = true; - - if (get_is_drawable()) - { - Cairo::RefPtr<Cairo::Context> cr = get_window()->create_cairo_context(); - cr->rectangle(event->area.x, event->area.y, - event->area.width, event->area.height); - cr->clip(); - result = on_draw(cr); - } - - return result; -} -#endif void ColorPreview::setRgba32 (guint32 rgba) diff --git a/src/ui/widget/color-preview.h b/src/ui/widget/color-preview.h index caddfb9a2..1276cf42b 100644 --- a/src/ui/widget/color-preview.h +++ b/src/ui/widget/color-preview.h @@ -33,16 +33,10 @@ public: protected: virtual void on_size_allocate (Gtk::Allocation &all); -#if WITH_GTKMM_3_0 virtual void get_preferred_height_vfunc(int& minimum_height, int& natural_height) const; virtual void get_preferred_height_for_width_vfunc(int width, int& minimum_height, int& natural_height) const; virtual void get_preferred_width_vfunc(int& minimum_width, int& natural_width) const; virtual void get_preferred_width_for_height_vfunc(int height, int& minimum_width, int& natural_width) const; -#else - virtual void on_size_request (Gtk::Requisition *req); - virtual bool on_expose_event(GdkEventExpose *event); -#endif - virtual bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr); guint32 _rgba; diff --git a/src/ui/widget/color-scales.cpp b/src/ui/widget/color-scales.cpp index 832bc3a62..89913b01b 100644 --- a/src/ui/widget/color-scales.cpp +++ b/src/ui/widget/color-scales.cpp @@ -8,7 +8,6 @@ #include <gtkmm/adjustment.h> #include <glibmm/i18n.h> -#include <gtk/gtk.h> #include "ui/dialog-events.h" #include "ui/widget/color-scales.h" @@ -44,11 +43,7 @@ static const gchar *sp_color_scales_hue_map(); const gchar *ColorScales::SUBMODE_NAMES[] = { N_("None"), N_("RGB"), N_("HSL"), N_("CMYK") }; ColorScales::ColorScales(SelectedColor &color, SPColorScalesMode mode) -#if GTK_CHECK_VERSION(3, 0, 0) : Gtk::Grid() -#else - : Gtk::Table(5, 3, false) -#endif , _color(color) , _rangeLimit(255.0) , _updating(FALSE) @@ -91,15 +86,9 @@ void ColorScales::_initUI(SPColorScalesMode mode) /* Label */ _l[i] = gtk_label_new(""); -#if GTK_CHECK_VERSION(3,0,0) gtk_widget_set_halign(_l[i], GTK_ALIGN_END); -#else - gtk_misc_set_alignment(GTK_MISC(_l[i]), 1.0, 0.5); -#endif - gtk_widget_show(_l[i]); -#if GTK_CHECK_VERSION(3, 0, 0) #if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_start(_l[i], XPAD); gtk_widget_set_margin_end(_l[i], XPAD); @@ -110,9 +99,6 @@ void ColorScales::_initUI(SPColorScalesMode mode) gtk_widget_set_margin_top(_l[i], YPAD); gtk_widget_set_margin_bottom(_l[i], YPAD); gtk_grid_attach(GTK_GRID(t), _l[i], 0, i, 1, 1); -#else - gtk_table_attach(GTK_TABLE(t), _l[i], 0, 1, i, i + 1, GTK_FILL, GTK_FILL, XPAD, YPAD); -#endif /* Adjustment */ _a[i] = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, _rangeLimit, 1.0, 10.0, 10.0)); @@ -120,7 +106,6 @@ void ColorScales::_initUI(SPColorScalesMode mode) _s[i] = Gtk::manage(new Inkscape::UI::Widget::ColorSlider(Glib::wrap(_a[i], true))); _s[i]->show(); -#if GTK_CHECK_VERSION(3, 0, 0) #if GTK_CHECK_VERSION(3, 12, 0) _s[i]->set_margin_start(XPAD); _s[i]->set_margin_end(XPAD); @@ -132,10 +117,6 @@ void ColorScales::_initUI(SPColorScalesMode mode) _s[i]->set_margin_bottom(YPAD); _s[i]->set_hexpand(true); gtk_grid_attach(GTK_GRID(t), _s[i]->gobj(), 1, i, 1, 1); -#else - gtk_table_attach(GTK_TABLE(t), _s[i]->gobj(), 1, 2, i, i + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), - GTK_FILL, XPAD, YPAD); -#endif /* Spinbutton */ _b[i] = gtk_spin_button_new(GTK_ADJUSTMENT(_a[i]), 1.0, 0); @@ -143,7 +124,6 @@ void ColorScales::_initUI(SPColorScalesMode mode) gtk_label_set_mnemonic_widget(GTK_LABEL(_l[i]), _b[i]); gtk_widget_show(_b[i]); -#if GTK_CHECK_VERSION(3, 0, 0) #if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_start(_b[i], XPAD); gtk_widget_set_margin_end(_b[i], XPAD); @@ -156,9 +136,6 @@ void ColorScales::_initUI(SPColorScalesMode mode) gtk_widget_set_halign(_b[i], GTK_ALIGN_CENTER); gtk_widget_set_valign(_b[i], GTK_ALIGN_CENTER); gtk_grid_attach(GTK_GRID(t), _b[i], 2, i, 1, 1); -#else - gtk_table_attach(GTK_TABLE(t), _b[i], 2, 3, i, i + 1, (GtkAttachOptions)0, (GtkAttachOptions)0, XPAD, YPAD); -#endif /* Attach channel value to adjustment */ g_object_set_data(G_OBJECT(_a[i]), "channel", GINT_TO_POINTER(i)); @@ -270,7 +247,6 @@ void ColorScales::_setRangeLimit(gdouble upper) _rangeLimit = upper; for (gint i = 0; i < static_cast<gint>(G_N_ELEMENTS(_a)); i++) { gtk_adjustment_set_upper(_a[i], upper); - gtk_adjustment_changed(_a[i]); } } @@ -284,11 +260,7 @@ void ColorScales::_onColorChanged() void ColorScales::on_show() { -#if GTK_CHECK_VERSION(3, 0, 0) Gtk::Grid::on_show(); -#else - Gtk::Table::on_show(); -#endif _updateDisplay(); } diff --git a/src/ui/widget/color-scales.h b/src/ui/widget/color-scales.h index aeacfbcc1..1e86d762d 100644 --- a/src/ui/widget/color-scales.h +++ b/src/ui/widget/color-scales.h @@ -5,11 +5,7 @@ #include <config.h> #endif -#if WITH_GTKMM_3_0 #include <gtkmm/grid.h> -#else -#include <gtkmm/table.h> -#endif #include "ui/selected-color.h" @@ -27,11 +23,7 @@ typedef enum { } SPColorScalesMode; class ColorScales -#if GTK_CHECK_VERSION(3, 0, 0) : public Gtk::Grid -#else - : public Gtk::Table -#endif { public: static const gchar *SUBMODE_NAMES[]; diff --git a/src/ui/widget/color-slider.cpp b/src/ui/widget/color-slider.cpp index bf2156628..2e665dbec 100644 --- a/src/ui/widget/color-slider.cpp +++ b/src/ui/widget/color-slider.cpp @@ -18,12 +18,7 @@ #include <gdkmm/cursor.h> #include <gdkmm/general.h> #include <gtkmm/adjustment.h> -#if WITH_GTKMM_3_0 #include <gtkmm/stylecontext.h> -#else -#include <gtkmm/style.h> -#endif -#include <gtk/gtk.h> #include "ui/widget/color-scales.h" #include "ui/widget/color-slider.h" @@ -42,14 +37,8 @@ namespace Inkscape { namespace UI { namespace Widget { -#if GTK_CHECK_VERSION(3, 0, 0) ColorSlider::ColorSlider(Glib::RefPtr<Gtk::Adjustment> adjustment) : _dragging(false) -#else -ColorSlider::ColorSlider(Gtk::Adjustment *adjustment) - : _dragging(false) - , _adjustment(NULL) -#endif , _value(0.0) , _oldvalue(0.0) , _mapsize(0) @@ -82,12 +71,7 @@ ColorSlider::~ColorSlider() if (_adjustment) { _adjustment_changed_connection.disconnect(); _adjustment_value_changed_connection.disconnect(); -#if GTK_CHECK_VERSION(3, 0, 0) _adjustment.reset(); -#else - _adjustment->unreference(); - _adjustment = NULL; -#endif } } @@ -108,26 +92,15 @@ void ColorSlider::on_realize() attributes.window_type = GDK_WINDOW_CHILD; attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gdk_screen_get_system_visual(gdk_screen_get_default()); -#if !GTK_CHECK_VERSION(3, 0, 0) - attributes.colormap = gdk_screen_get_system_colormap(gdk_screen_get_default()); -#endif attributes.event_mask = get_events(); attributes.event_mask |= (Gdk::EXPOSURE_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::POINTER_MOTION_MASK | Gdk::ENTER_NOTIFY_MASK | Gdk::LEAVE_NOTIFY_MASK); -#if GTK_CHECK_VERSION(3, 0, 0) attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL; -#else - attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; -#endif _gdk_window = Gdk::Window::create(get_parent_window(), &attributes, attributes_mask); set_window(_gdk_window); _gdk_window->set_user_data(gobj()); - -#if !GTK_CHECK_VERSION(3, 0, 0) - style_attach(); -#endif } } @@ -148,8 +121,6 @@ void ColorSlider::on_size_allocate(Gtk::Allocation &allocation) } } -#if GTK_CHECK_VERSION(3, 0, 0) - void ColorSlider::get_preferred_width_vfunc(int &minimum_width, int &natural_width) const { Glib::RefPtr<Gtk::StyleContext> style_context = get_style_context(); @@ -176,38 +147,12 @@ void ColorSlider::get_preferred_height_for_width_vfunc(int /*width*/, int &minim get_preferred_height(minimum_height, natural_height); } -#else - -void ColorSlider::on_size_request(Gtk::Requisition *requisition) -{ - GtkStyle *style = gtk_widget_get_style(gobj()); - requisition->width = SLIDER_WIDTH + style->xthickness * 2; - requisition->height = SLIDER_HEIGHT + style->ythickness * 2; -} - -bool ColorSlider::on_expose_event(GdkEventExpose *event) -{ - bool result = false; - - if (get_is_drawable()) { - Cairo::RefPtr<Cairo::Context> cr = _gdk_window->create_cairo_context(); - result = on_draw(cr); - } - return result; -} - -#endif - bool ColorSlider::on_button_press_event(GdkEventButton *event) { if (event->button == 1) { Gtk::Allocation allocation = get_allocation(); gint cx, cw; -#if GTK_CHECK_VERSION(3, 0, 0) cx = get_style_context()->get_padding(get_state_flags()).get_left(); -#else - cx = get_style()->get_xthickness(); -#endif cw = allocation.get_width() - 2 * cx; signal_grabbed.emit(); _dragging = true; @@ -215,15 +160,9 @@ bool ColorSlider::on_button_press_event(GdkEventButton *event) ColorScales::setScaled(_adjustment->gobj(), CLAMP((gfloat)(event->x - cx) / cw, 0.0, 1.0)); signal_dragged.emit(); -#if GTK_CHECK_VERSION(3, 0, 0) gdk_device_grab( gdk_event_get_device(reinterpret_cast<GdkEvent *>(event)), _gdk_window->gobj(), GDK_OWNERSHIP_NONE, FALSE, static_cast<GdkEventMask>(GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK), NULL, event->time); -#else - gdk_pointer_grab(get_window()->gobj(), FALSE, - static_cast<GdkEventMask>(GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK), NULL, NULL, - event->time); -#endif } return false; @@ -232,13 +171,8 @@ bool ColorSlider::on_button_press_event(GdkEventButton *event) bool ColorSlider::on_button_release_event(GdkEventButton *event) { if (event->button == 1) { - -#if GTK_CHECK_VERSION(3, 0, 0) gdk_device_ungrab(gdk_event_get_device(reinterpret_cast<GdkEvent *>(event)), gdk_event_get_time(reinterpret_cast<GdkEvent *>(event))); -#else - get_window()->pointer_ungrab(event->time); -#endif _dragging = false; signal_released.emit(); @@ -255,11 +189,7 @@ bool ColorSlider::on_motion_notify_event(GdkEventMotion *event) if (_dragging) { gint cx, cw; Gtk::Allocation allocation = get_allocation(); -#if GTK_CHECK_VERSION(3, 0, 0) cx = get_style_context()->get_padding(get_state_flags()).get_left(); -#else - cx = get_style()->get_xthickness(); -#endif cw = allocation.get_width() - 2 * cx; ColorScales::setScaled(_adjustment->gobj(), CLAMP((gfloat)(event->x - cx) / cw, 0.0, 1.0)); signal_dragged.emit(); @@ -268,19 +198,10 @@ bool ColorSlider::on_motion_notify_event(GdkEventMotion *event) return false; } -#if GTK_CHECK_VERSION(3, 0, 0) void ColorSlider::setAdjustment(Glib::RefPtr<Gtk::Adjustment> adjustment) { -#else -void ColorSlider::setAdjustment(Gtk::Adjustment *adjustment) -{ -#endif if (!adjustment) { -#if GTK_CHECK_VERSION(3, 0, 0) _adjustment = Gtk::Adjustment::create(0.0, 0.0, 1.0, 0.01, 0.0, 0.0); -#else - _adjustment = Gtk::manage(new Gtk::Adjustment(0.0, 0.0, 1.0, 0.01, 0.0, 0.0)); -#endif } else { adjustment->set_page_increment(0.0); @@ -291,9 +212,6 @@ void ColorSlider::setAdjustment(Gtk::Adjustment *adjustment) if (_adjustment) { _adjustment_changed_connection.disconnect(); _adjustment_value_changed_connection.disconnect(); -#if !GTK_CHECK_VERSION(3, 0, 0) - _adjustment->unreference(); -#endif } _adjustment = adjustment; @@ -314,18 +232,11 @@ void ColorSlider::_onAdjustmentValueChanged() { if (_value != ColorScales::getScaled(_adjustment->gobj())) { gint cx, cy, cw, ch; -#if GTK_CHECK_VERSION(3, 0, 0) - Glib::RefPtr<Gtk::StyleContext> style_context = get_style_context(); - Gtk::Allocation allocation = get_allocation(); - Gtk::Border padding = style_context->get_padding(get_state_flags()); + auto style_context = get_style_context(); + auto allocation = get_allocation(); + auto padding = style_context->get_padding(get_state_flags()); cx = padding.get_left(); cy = padding.get_top(); -#else - Glib::RefPtr<Gtk::Style> style = get_style(); - Gtk::Allocation allocation = get_allocation(); - cx = style->get_xthickness(); - cy = style->get_ythickness(); -#endif cw = allocation.get_width() - 2 * cx; ch = allocation.get_height() - 2 * cy; if ((gint)(ColorScales::getScaled(_adjustment->gobj()) * cw) != (gint)(_value * cw)) { @@ -389,40 +300,22 @@ bool ColorSlider::on_draw(const Cairo::RefPtr<Cairo::Context> &cr) { gboolean colorsOnTop = Inkscape::Preferences::get()->getBool("/options/workarounds/colorsontop", false); - Gtk::Allocation allocation = get_allocation(); - -#if GTK_CHECK_VERSION(3, 0, 0) - Glib::RefPtr<Gtk::StyleContext> style_context = get_style_context(); -#else - Glib::RefPtr<Gdk::Window> window = get_window(); - Glib::RefPtr<Gtk::Style> style = get_style(); -#endif + auto allocation = get_allocation(); + auto style_context = get_style_context(); // Draw shadow if (colorsOnTop) { -#if GTK_CHECK_VERSION(3, 0, 0) style_context->render_frame(cr, 0, 0, allocation.get_width(), allocation.get_height()); -#else - gtk_paint_shadow(style->gobj(), window->gobj(), gtk_widget_get_state(gobj()), GTK_SHADOW_IN, NULL, gobj(), - "colorslider", 0, 0, allocation.get_width(), allocation.get_height()); -#endif } /* Paintable part of color gradient area */ Gdk::Rectangle carea; - -#if GTK_CHECK_VERSION(3, 0, 0) Gtk::Border padding; padding = style_context->get_padding(get_state_flags()); carea.set_x(padding.get_left()); carea.set_y(padding.get_top()); - ; -#else - carea.set_x(style->get_xthickness()); - carea.set_y(style->get_ythickness()); -#endif carea.set_width(allocation.get_width() - 2 * carea.get_x()); carea.set_height(allocation.get_height() - 2 * carea.get_y()); @@ -490,12 +383,7 @@ bool ColorSlider::on_draw(const Cairo::RefPtr<Cairo::Context> &cr) /* Draw shadow */ if (!colorsOnTop) { -#if GTK_CHECK_VERSION(3, 0, 0) style_context->render_frame(cr, 0, 0, allocation.get_width(), allocation.get_height()); -#else - gtk_paint_shadow(style->gobj(), window->gobj(), gtk_widget_get_state(gobj()), GTK_SHADOW_IN, NULL, gobj(), - "colorslider", 0, 0, allocation.get_width(), allocation.get_height()); -#endif } /* Draw arrow */ diff --git a/src/ui/widget/color-slider.h b/src/ui/widget/color-slider.h index 253f3123c..9be6c356a 100644 --- a/src/ui/widget/color-slider.h +++ b/src/ui/widget/color-slider.h @@ -24,18 +24,10 @@ namespace Widget { */ class ColorSlider : public Gtk::Widget { public: -#if GTK_CHECK_VERSION(3, 0, 0) ColorSlider(Glib::RefPtr<Gtk::Adjustment> adjustment); -#else - ColorSlider(Gtk::Adjustment *adjustment); -#endif ~ColorSlider(); -#if GTK_CHECK_VERSION(3, 0, 0) void setAdjustment(Glib::RefPtr<Gtk::Adjustment> adjustment); -#else - void setAdjustment(Gtk::Adjustment *adjustment); -#endif void setColors(guint32 start, guint32 mid, guint32 end); @@ -56,16 +48,10 @@ protected: bool on_button_release_event(GdkEventButton *event); bool on_motion_notify_event(GdkEventMotion *event); bool on_draw(const Cairo::RefPtr<Cairo::Context> &cr); - -#if GTK_CHECK_VERSION(3, 0, 0) void get_preferred_width_vfunc(int &minimum_width, int &natural_width) const; void get_preferred_width_for_height_vfunc(int height, int &minimum_width, int &natural_width) const; void get_preferred_height_vfunc(int &minimum_height, int &natural_height) const; void get_preferred_height_for_width_vfunc(int width, int &minimum_height, int &natural_height) const; -#else - void on_size_request(Gtk::Requisition *requisition); - bool on_expose_event(GdkEventExpose *event); -#endif private: void _onAdjustmentChanged(); @@ -73,11 +59,7 @@ private: bool _dragging; -#if GTK_CHECK_VERSION(3, 0, 0) Glib::RefPtr<Gtk::Adjustment> _adjustment; -#else - Gtk::Adjustment *_adjustment; -#endif sigc::connection _adjustment_changed_connection; sigc::connection _adjustment_value_changed_connection; diff --git a/src/ui/widget/color-wheel-selector.cpp b/src/ui/widget/color-wheel-selector.cpp index decb02b4f..4f011c6c3 100644 --- a/src/ui/widget/color-wheel-selector.cpp +++ b/src/ui/widget/color-wheel-selector.cpp @@ -11,7 +11,7 @@ #include "ui/dialog-events.h" #include "ui/widget/color-scales.h" #include "ui/widget/color-slider.h" -#include "ui/widget/gimpcolorwheel.h" +#include "widgets/gimp/gimpcolorwheel.h" namespace Inkscape { namespace UI { @@ -25,16 +25,9 @@ namespace Widget { const gchar *ColorWheelSelector::MODE_NAME = N_("Wheel"); ColorWheelSelector::ColorWheelSelector(SelectedColor &color) -#if GTK_CHECK_VERSION(3, 0, 0) : Gtk::Grid() -#else - : Gtk::Table(5, 3, false) -#endif , _color(color) , _updating(false) -#if !GTK_CHECK_VERSION(3, 0, 0) - , _alpha_adjustment(NULL) -#endif , _wheel(0) , _slider(0) { @@ -46,9 +39,6 @@ ColorWheelSelector::ColorWheelSelector(SelectedColor &color) ColorWheelSelector::~ColorWheelSelector() { _wheel = 0; -#if !GTK_CHECK_VERSION(3, 0, 0) - delete _alpha_adjustment; -#endif _color_changed_connection.disconnect(); _color_dragged_connection.disconnect(); @@ -62,16 +52,11 @@ void ColorWheelSelector::_initUI() _wheel = gimp_color_wheel_new(); gtk_widget_show(_wheel); -#if GTK_CHECK_VERSION(3, 0, 0) gtk_widget_set_halign(_wheel, GTK_ALIGN_FILL); gtk_widget_set_valign(_wheel, GTK_ALIGN_FILL); gtk_widget_set_hexpand(_wheel, TRUE); gtk_widget_set_vexpand(_wheel, TRUE); gtk_grid_attach(GTK_GRID(gobj()), _wheel, 0, row, 3, 1); -#else - gtk_table_attach(GTK_TABLE(gobj()), _wheel, 0, 3, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), - (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 0, 0); -#endif row++; @@ -80,7 +65,6 @@ void ColorWheelSelector::_initUI() label->set_alignment(1.0, 0.5); label->show(); -#if GTK_CHECK_VERSION(3, 0, 0) #if GTK_CHECK_VERSION(3, 12, 0) label->set_margin_start(XPAD); label->set_margin_end(XPAD); @@ -93,22 +77,15 @@ void ColorWheelSelector::_initUI() label->set_halign(Gtk::ALIGN_FILL); label->set_valign(Gtk::ALIGN_FILL); attach(*label, 0, row, 1, 1); -#else - attach(*label, 0, 1, row, row + 1, Gtk::FILL, Gtk::FILL, XPAD, YPAD); -#endif -/* Adjustment */ -#if GTK_CHECK_VERSION(3, 0, 0) + /* Adjustment */ _alpha_adjustment = Gtk::Adjustment::create(0.0, 0.0, 255.0, 1.0, 10.0, 10.0); -#else - _alpha_adjustment = new Gtk::Adjustment(0.0, 0.0, 255.0, 1.0, 10.0, 10.0); -#endif + /* Slider */ _slider = Gtk::manage(new Inkscape::UI::Widget::ColorSlider(_alpha_adjustment)); _slider->set_tooltip_text(_("Alpha (opacity)")); _slider->show(); -#if GTK_CHECK_VERSION(3, 0, 0) #if GTK_CHECK_VERSION(3, 12, 0) _slider->set_margin_start(XPAD); _slider->set_margin_end(XPAD); @@ -122,25 +99,17 @@ void ColorWheelSelector::_initUI() _slider->set_halign(Gtk::ALIGN_FILL); _slider->set_valign(Gtk::ALIGN_FILL); attach(*_slider, 1, row, 1, 1); -#else - attach(*_slider, 1, 2, row, row + 1, Gtk::EXPAND | Gtk::FILL, Gtk::FILL, XPAD, YPAD); -#endif _slider->setColors(SP_RGBA32_F_COMPOSE(1.0, 1.0, 1.0, 0.0), SP_RGBA32_F_COMPOSE(1.0, 1.0, 1.0, 0.5), SP_RGBA32_F_COMPOSE(1.0, 1.0, 1.0, 1.0)); -/* Spinbutton */ -#if GTK_CHECK_VERSION(3, 0, 0) - Gtk::SpinButton *spin_button = Gtk::manage(new Gtk::SpinButton(_alpha_adjustment, 1.0, 0)); -#else - Gtk::SpinButton *spin_button = Gtk::manage(new Gtk::SpinButton(*_alpha_adjustment, 1.0, 0)); -#endif + /* Spinbutton */ + auto spin_button = Gtk::manage(new Gtk::SpinButton(_alpha_adjustment, 1.0, 0)); spin_button->set_tooltip_text(_("Alpha (opacity)")); sp_dialog_defocus_on_enter(GTK_WIDGET(spin_button->gobj())); label->set_mnemonic_widget(*spin_button); spin_button->show(); -#if GTK_CHECK_VERSION(3, 0, 0) #if GTK_CHECK_VERSION(3, 12, 0) spin_button->set_margin_start(XPAD); spin_button->set_margin_end(XPAD); @@ -153,9 +122,6 @@ void ColorWheelSelector::_initUI() spin_button->set_halign(Gtk::ALIGN_CENTER); spin_button->set_valign(Gtk::ALIGN_CENTER); attach(*spin_button, 2, row, 1, 1); -#else - attach(*spin_button, 2, 3, row, row + 1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0, XPAD, YPAD); -#endif /* Signals */ _alpha_adjustment->signal_value_changed().connect(sigc::mem_fun(this, &ColorWheelSelector::_adjustmentChanged)); @@ -168,11 +134,7 @@ void ColorWheelSelector::_initUI() void ColorWheelSelector::on_show() { -#if GTK_CHECK_VERSION(3, 0, 0) Gtk::Grid::on_show(); -#else - Gtk::Table::on_show(); -#endif _updateDisplay(); } diff --git a/src/ui/widget/color-wheel-selector.h b/src/ui/widget/color-wheel-selector.h index 5711d417c..ee7bd9b83 100644 --- a/src/ui/widget/color-wheel-selector.h +++ b/src/ui/widget/color-wheel-selector.h @@ -16,11 +16,7 @@ #include <config.h> #endif -#if WITH_GTKMM_3_0 #include <gtkmm/grid.h> -#else -#include <gtkmm/table.h> -#endif #include "ui/selected-color.h" @@ -33,11 +29,7 @@ namespace Widget { class ColorSlider; class ColorWheelSelector -#if GTK_CHECK_VERSION(3, 0, 0) : public Gtk::Grid -#else - : public Gtk::Table -#endif { public: static const gchar *MODE_NAME; @@ -61,11 +53,7 @@ protected: SelectedColor &_color; bool _updating; -#if GTK_CHECK_VERSION(3, 0, 0) Glib::RefPtr<Gtk::Adjustment> _alpha_adjustment; -#else - Gtk::Adjustment *_alpha_adjustment; -#endif GtkWidget *_wheel; Inkscape::UI::Widget::ColorSlider *_slider; diff --git a/src/ui/widget/dock-item.cpp b/src/ui/widget/dock-item.cpp index 1b3490ffe..979c09d2f 100644 --- a/src/ui/widget/dock-item.cpp +++ b/src/ui/widget/dock-item.cpp @@ -57,11 +57,7 @@ DockItem::DockItem(Dock& dock, const Glib::ustring& name, const Glib::ustring& l Gtk::StockItem item; Gtk::StockID stockId(icon_name); if ( Gtk::StockItem::lookup(stockId, item) ) { -#if WITH_GTKMM_3_0 _icon_pixbuf = _dock.getWidget().render_icon_pixbuf( stockId, Gtk::ICON_SIZE_MENU ); -#else - _icon_pixbuf = _dock.getWidget().render_icon( stockId, Gtk::ICON_SIZE_MENU ); -#endif } } } @@ -173,12 +169,8 @@ DockItem::set_size_request(int width, int height) void DockItem::size_request(Gtk::Requisition& requisition) { -#if WITH_GTKMM_3_0 Gtk::Requisition req_natural; getWidget().get_preferred_size(req_natural, requisition); -#else - requisition = getWidget().size_request(); -#endif } void diff --git a/src/ui/widget/dock-item.h b/src/ui/widget/dock-item.h index 25a69d94c..2df45b207 100644 --- a/src/ui/widget/dock-item.h +++ b/src/ui/widget/dock-item.h @@ -19,11 +19,7 @@ #include <gtkmm/frame.h> #include <gtkmm/window.h> -#if WITH_EXT_GDL #include <gdl/gdl.h> -#else -#include "libgdl/gdl.h" -#endif namespace Gtk { class HButtonBox; diff --git a/src/ui/widget/dock.cpp b/src/ui/widget/dock.cpp index fda647182..7744cb695 100644 --- a/src/ui/widget/dock.cpp +++ b/src/ui/widget/dock.cpp @@ -65,7 +65,6 @@ Dock::Dock(Gtk::Orientation orientation) static_cast<GtkOrientation>(orientation)); #endif -#if WITH_GTKMM_3_0 switch(orientation) { case Gtk::ORIENTATION_VERTICAL: _dock_box = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL)); @@ -75,17 +74,6 @@ Dock::Dock(Gtk::Orientation orientation) } _paned = Gtk::manage(new Gtk::Paned(orientation)); -#else - switch (orientation) { - case Gtk::ORIENTATION_VERTICAL: - _dock_box = Gtk::manage(new Gtk::HBox()); - _paned = Gtk::manage(new Gtk::VPaned()); - break; - case Gtk::ORIENTATION_HORIZONTAL: - _dock_box = Gtk::manage(new Gtk::VBox()); - _paned = Gtk::manage(new Gtk::HPaned()); - } -#endif _scrolled_window->add(*_dock_box); _scrolled_window->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); diff --git a/src/ui/widget/gimpcolorwheel.c b/src/ui/widget/gimpcolorwheel.c deleted file mode 100644 index d54486505..000000000 --- a/src/ui/widget/gimpcolorwheel.c +++ /dev/null @@ -1,1604 +0,0 @@ -/* HSV color selector for GTK+ - * - * Copyright (C) 1999 The Free Software Foundation - * - * Authors: Simon Budig <Simon.Budig@unix-ag.org> (original code) - * Federico Mena-Quintero <federico@gimp.org> (cleanup for GTK+) - * Jonathan Blandford <jrb@redhat.com> (cleanup for GTK+) - * Michael Natterer <mitch@gimp.org> (ported back to GIMP) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GTK+ Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. - */ - -/* - * This widget was adopted by Inkscape by Alex Valavanis <valavanisalex@gmail.com> - * on 2013-01-08. Last merges with GIMP code were applied using the following - * commits from the GIMP git repository at - * http://git.gnome.org/browse/gimp/tree/modules/gimpcolorwheel.c - * - * Gtk+ 2 code merge: commit 632c5 (2013-01-06) - * Gtk+ 3 code merge: commit bcfc6, gtk3-port branch (2013-01-06) - */ - -#include "config.h" - -#include <gtk/gtk.h> -#include <gdk/gdkkeysyms.h> - -#include "gimpcolorwheel.h" -#include <math.h> - - -/* Default ring fraction */ -#define DEFAULT_FRACTION 0.1 - -/* Default width/height */ -#define DEFAULT_SIZE 100 - -/* Default ring width */ -#define DEFAULT_RING_WIDTH 10 - - -/* Dragging modes */ -typedef enum -{ - DRAG_NONE, - DRAG_H, - DRAG_SV -} DragMode; - -/* Private part of the GimpColorWheel structure */ -typedef struct -{ - /* Color value */ - gdouble h; - gdouble s; - gdouble v; - - /* ring_width is this fraction of size */ - gdouble ring_fraction; - - /* Size and ring width */ - gint size; - gint ring_width; - - /* Window for capturing events */ - GdkWindow *window; - - /* Dragging mode */ - DragMode mode; - - guint focus_on_ring : 1; -} GimpColorWheelPrivate; - -enum -{ - CHANGED, - MOVE, - LAST_SIGNAL -}; - -static void gimp_color_wheel_map (GtkWidget *widget); -static void gimp_color_wheel_unmap (GtkWidget *widget); -static void gimp_color_wheel_realize (GtkWidget *widget); -static void gimp_color_wheel_unrealize (GtkWidget *widget); -static void gimp_color_wheel_size_allocate (GtkWidget *widget, - GtkAllocation *allocation); -static gboolean gimp_color_wheel_button_press (GtkWidget *widget, - GdkEventButton *event); -static gboolean gimp_color_wheel_button_release (GtkWidget *widget, - GdkEventButton *event); -static gboolean gimp_color_wheel_motion (GtkWidget *widget, - GdkEventMotion *event); -#if GTK_CHECK_VERSION(3,0,0) -static gboolean gimp_color_wheel_draw (GtkWidget *widget, - cairo_t *cr); -static void gimp_color_wheel_get_preferred_width (GtkWidget *widget, - gint *minimum_width, - gint *natural_width); -static void gimp_color_wheel_get_preferred_height (GtkWidget *widget, - gint *minimum_height, - gint *natural_height); -#else -static gboolean gimp_color_wheel_expose (GtkWidget *widget, - GdkEventExpose *event); -static void gimp_color_wheel_size_request (GtkWidget *widget, - GtkRequisition *requisition); -#endif - -static gboolean gimp_color_wheel_grab_broken (GtkWidget *widget, - GdkEventGrabBroken *event); -static gboolean gimp_color_wheel_focus (GtkWidget *widget, - GtkDirectionType direction); -static void gimp_color_wheel_move (GimpColorWheel *wheel, - GtkDirectionType dir); - - -static guint wheel_signals[LAST_SIGNAL]; - -G_DEFINE_TYPE (GimpColorWheel, gimp_color_wheel, GTK_TYPE_WIDGET) - -#define parent_class gimp_color_wheel_parent_class - - -static void -gimp_color_wheel_class_init (GimpColorWheelClass *class) -{ - GObjectClass *object_class = G_OBJECT_CLASS (class); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class); - GimpColorWheelClass *wheel_class = GIMP_COLOR_WHEEL_CLASS (class); - GtkBindingSet *binding_set; - - widget_class->map = gimp_color_wheel_map; - widget_class->unmap = gimp_color_wheel_unmap; - widget_class->realize = gimp_color_wheel_realize; - widget_class->unrealize = gimp_color_wheel_unrealize; - widget_class->size_allocate = gimp_color_wheel_size_allocate; - widget_class->button_press_event = gimp_color_wheel_button_press; - widget_class->button_release_event = gimp_color_wheel_button_release; - widget_class->motion_notify_event = gimp_color_wheel_motion; - -#if GTK_CHECK_VERSION(3,0,0) - widget_class->get_preferred_width = gimp_color_wheel_get_preferred_width; - widget_class->get_preferred_height = gimp_color_wheel_get_preferred_height; - widget_class->draw = gimp_color_wheel_draw; -#else - widget_class->size_request = gimp_color_wheel_size_request; - widget_class->expose_event = gimp_color_wheel_expose; -#endif - - widget_class->focus = gimp_color_wheel_focus; - widget_class->grab_broken_event = gimp_color_wheel_grab_broken; - - wheel_class->move = gimp_color_wheel_move; - - wheel_signals[CHANGED] = - g_signal_new ("changed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (GimpColorWheelClass, changed), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - wheel_signals[MOVE] = - g_signal_new ("move", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, - G_STRUCT_OFFSET (GimpColorWheelClass, move), - NULL, NULL, - g_cclosure_marshal_VOID__ENUM, - G_TYPE_NONE, 1, - GTK_TYPE_DIRECTION_TYPE); - - binding_set = gtk_binding_set_by_class (class); - - gtk_binding_entry_add_signal (binding_set, GDK_KEY_Up, 0, - "move", 1, - G_TYPE_ENUM, GTK_DIR_UP); - gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Up, 0, - "move", 1, - G_TYPE_ENUM, GTK_DIR_UP); - - gtk_binding_entry_add_signal (binding_set, GDK_KEY_Down, 0, - "move", 1, - G_TYPE_ENUM, GTK_DIR_DOWN); - gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Down, 0, - "move", 1, - G_TYPE_ENUM, GTK_DIR_DOWN); - - - gtk_binding_entry_add_signal (binding_set, GDK_KEY_Right, 0, - "move", 1, - G_TYPE_ENUM, GTK_DIR_RIGHT); - gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Right, 0, - "move", 1, - G_TYPE_ENUM, GTK_DIR_RIGHT); - - gtk_binding_entry_add_signal (binding_set, GDK_KEY_Left, 0, - "move", 1, - G_TYPE_ENUM, GTK_DIR_LEFT); - gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Left, 0, - "move", 1, - G_TYPE_ENUM, GTK_DIR_LEFT); - - g_type_class_add_private (object_class, sizeof (GimpColorWheelPrivate)); -} - -static void -gimp_color_wheel_init (GimpColorWheel *wheel) -{ - GimpColorWheelPrivate *priv; - - priv = G_TYPE_INSTANCE_GET_PRIVATE (wheel, GIMP_TYPE_COLOR_WHEEL, - GimpColorWheelPrivate); - - wheel->priv = priv; - - gtk_widget_set_has_window (GTK_WIDGET (wheel), FALSE); - gtk_widget_set_can_focus (GTK_WIDGET (wheel), TRUE); - - priv->ring_fraction = DEFAULT_FRACTION; - priv->size = DEFAULT_SIZE; - priv->ring_width = DEFAULT_RING_WIDTH; -} - -static void -gimp_color_wheel_map (GtkWidget *widget) -{ - GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget); - GimpColorWheelPrivate *priv = wheel->priv; - - GTK_WIDGET_CLASS (parent_class)->map (widget); - - gdk_window_show (priv->window); -} - -static void -gimp_color_wheel_unmap (GtkWidget *widget) -{ - GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget); - GimpColorWheelPrivate *priv = wheel->priv; - - gdk_window_hide (priv->window); - - GTK_WIDGET_CLASS (parent_class)->unmap (widget); -} - -static void -gimp_color_wheel_realize (GtkWidget *widget) -{ - GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget); - GimpColorWheelPrivate *priv = wheel->priv; - GtkAllocation allocation; - GdkWindowAttr attr; - gint attr_mask; - GdkWindow *parent_window; - - gtk_widget_get_allocation (widget, &allocation); - - gtk_widget_set_realized (widget, TRUE); - - attr.window_type = GDK_WINDOW_CHILD; - attr.x = allocation.x; - attr.y = allocation.y; - attr.width = allocation.width; - attr.height = allocation.height; - attr.wclass = GDK_INPUT_ONLY; - attr.event_mask = (gtk_widget_get_events (widget) | - GDK_KEY_PRESS_MASK | - GDK_BUTTON_PRESS_MASK | - GDK_BUTTON_RELEASE_MASK | - GDK_POINTER_MOTION_MASK | - GDK_ENTER_NOTIFY_MASK | - GDK_LEAVE_NOTIFY_MASK); - - attr_mask = GDK_WA_X | GDK_WA_Y; - - parent_window = gtk_widget_get_parent_window (widget); - - gtk_widget_set_window (widget, parent_window); - g_object_ref (parent_window); - - priv->window = gdk_window_new (parent_window, &attr, attr_mask); - gdk_window_set_user_data (priv->window, wheel); - -#if !GTK_CHECK_VERSION(3,0,0) - gtk_widget_style_attach (widget); -#endif -} - -static void -gimp_color_wheel_unrealize (GtkWidget *widget) -{ - GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget); - GimpColorWheelPrivate *priv = wheel->priv; - - gdk_window_set_user_data (priv->window, NULL); - gdk_window_destroy (priv->window); - priv->window = NULL; - - GTK_WIDGET_CLASS (parent_class)->unrealize (widget); -} - -#if GTK_CHECK_VERSION(3,0,0) -static void -gimp_color_wheel_get_preferred_width (GtkWidget *widget, - gint *minimum_width, - gint *natural_width) -{ - gint focus_width; - gint focus_pad; - - gtk_widget_style_get (widget, - "focus-line-width", &focus_width, - "focus-padding", &focus_pad, - NULL); - - *minimum_width = *natural_width = DEFAULT_SIZE + 2 * (focus_width + focus_pad); -} - -static void -gimp_color_wheel_get_preferred_height (GtkWidget *widget, - gint *minimum_height, - gint *natural_height) -{ - gint focus_width; - gint focus_pad; - - gtk_widget_style_get (widget, - "focus-line-width", &focus_width, - "focus-padding", &focus_pad, - NULL); - - *minimum_height = *natural_height = DEFAULT_SIZE + 2 * (focus_width + focus_pad); -} -#else -static void -gimp_color_wheel_size_request (GtkWidget *widget, - GtkRequisition *requisition) -{ - gint focus_width; - gint focus_pad; - - gtk_widget_style_get (widget, - "focus-line-width", &focus_width, - "focus-padding", &focus_pad, - NULL); - - requisition->width = DEFAULT_SIZE + 2 * (focus_width + focus_pad); - requisition->height = DEFAULT_SIZE + 2 * (focus_width + focus_pad); -} -#endif - -static void -gimp_color_wheel_size_allocate (GtkWidget *widget, - GtkAllocation *allocation) -{ - GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget); - GimpColorWheelPrivate *priv = wheel->priv; - gint focus_width; - gint focus_pad; - - gtk_widget_set_allocation (widget, allocation); - - gtk_widget_style_get (widget, - "focus-line-width", &focus_width, - "focus-padding", &focus_pad, - NULL); - - priv->size = MIN (allocation->width - 2 * (focus_width + focus_pad), - allocation->height - 2 * (focus_width + focus_pad)); - - priv->ring_width = priv->size * priv->ring_fraction; - - if (gtk_widget_get_realized (widget)) - gdk_window_move_resize (priv->window, - allocation->x, - allocation->y, - allocation->width, - allocation->height); -} - - -/* Utility functions */ - -#define INTENSITY(r, g, b) ((r) * 0.30 + (g) * 0.59 + (b) * 0.11) - -/* Converts from HSV to RGB */ -static void -hsv_to_rgb (gdouble *h, - gdouble *s, - gdouble *v) -{ - gdouble hue, saturation, value; - gdouble f, p, q, t; - - if (*s == 0.0) - { - *h = *v; - *s = *v; - *v = *v; /* heh */ - } - else - { - hue = *h * 6.0; - saturation = *s; - value = *v; - - if (hue == 6.0) - hue = 0.0; - - f = hue - (int) hue; - p = value * (1.0 - saturation); - q = value * (1.0 - saturation * f); - t = value * (1.0 - saturation * (1.0 - f)); - - switch ((int) hue) - { - case 0: - *h = value; - *s = t; - *v = p; - break; - - case 1: - *h = q; - *s = value; - *v = p; - break; - - case 2: - *h = p; - *s = value; - *v = t; - break; - - case 3: - *h = p; - *s = q; - *v = value; - break; - - case 4: - *h = t; - *s = p; - *v = value; - break; - - case 5: - *h = value; - *s = p; - *v = q; - break; - - default: - g_assert_not_reached (); - } - } -} - -/* Computes the vertices of the saturation/value triangle */ -static void -compute_triangle (GimpColorWheel *wheel, - gint *hx, - gint *hy, - gint *sx, - gint *sy, - gint *vx, - gint *vy) -{ - GimpColorWheelPrivate *priv = wheel->priv; - GtkAllocation allocation; - gdouble center_x; - gdouble center_y; - gdouble inner, outer; - gdouble angle; - - gtk_widget_get_allocation (GTK_WIDGET (wheel), &allocation); - - center_x = allocation.width / 2.0; - center_y = allocation.height / 2.0; - - outer = priv->size / 2.0; - inner = outer - priv->ring_width; - angle = priv->h * 2.0 * G_PI; - - *hx = floor (center_x + cos (angle) * inner + 0.5); - *hy = floor (center_y - sin (angle) * inner + 0.5); - *sx = floor (center_x + cos (angle + 2.0 * G_PI / 3.0) * inner + 0.5); - *sy = floor (center_y - sin (angle + 2.0 * G_PI / 3.0) * inner + 0.5); - *vx = floor (center_x + cos (angle + 4.0 * G_PI / 3.0) * inner + 0.5); - *vy = floor (center_y - sin (angle + 4.0 * G_PI / 3.0) * inner + 0.5); -} - -/* Computes whether a point is inside the hue ring */ -static gboolean -is_in_ring (GimpColorWheel *wheel, - gdouble x, - gdouble y) -{ - GimpColorWheelPrivate *priv = wheel->priv; - GtkAllocation allocation; - gdouble dx, dy, dist; - gdouble center_x; - gdouble center_y; - gdouble inner, outer; - - gtk_widget_get_allocation (GTK_WIDGET (wheel), &allocation); - - center_x = allocation.width / 2.0; - center_y = allocation.height / 2.0; - - outer = priv->size / 2.0; - inner = outer - priv->ring_width; - - dx = x - center_x; - dy = center_y - y; - dist = dx * dx + dy * dy; - - return (dist >= inner * inner && dist <= outer * outer); -} - -/* Computes a saturation/value pair based on the mouse coordinates */ -static void -compute_sv (GimpColorWheel *wheel, - gdouble x, - gdouble y, - gdouble *s, - gdouble *v) -{ - GtkAllocation allocation; - gint ihx, ihy, isx, isy, ivx, ivy; - gdouble hx, hy, sx, sy, vx, vy; - gdouble center_x; - gdouble center_y; - - gtk_widget_get_allocation (GTK_WIDGET (wheel), &allocation); - - compute_triangle (wheel, &ihx, &ihy, &isx, &isy, &ivx, &ivy); - - center_x = allocation.width / 2.0; - center_y = allocation.height / 2.0; - - hx = ihx - center_x; - hy = center_y - ihy; - sx = isx - center_x; - sy = center_y - isy; - vx = ivx - center_x; - vy = center_y - ivy; - x -= center_x; - y = center_y - y; - - if (vx * (x - sx) + vy * (y - sy) < 0.0) - { - *s = 1.0; - *v = (((x - sx) * (hx - sx) + (y - sy) * (hy-sy)) - / ((hx - sx) * (hx - sx) + (hy - sy) * (hy - sy))); - - if (*v < 0.0) - *v = 0.0; - else if (*v > 1.0) - *v = 1.0; - } - else if (hx * (x - sx) + hy * (y - sy) < 0.0) - { - *s = 0.0; - *v = (((x - sx) * (vx - sx) + (y - sy) * (vy - sy)) - / ((vx - sx) * (vx - sx) + (vy - sy) * (vy - sy))); - - if (*v < 0.0) - *v = 0.0; - else if (*v > 1.0) - *v = 1.0; - } - else if (sx * (x - hx) + sy * (y - hy) < 0.0) - { - *v = 1.0; - *s = (((x - vx) * (hx - vx) + (y - vy) * (hy - vy)) / - ((hx - vx) * (hx - vx) + (hy - vy) * (hy - vy))); - - if (*s < 0.0) - *s = 0.0; - else if (*s > 1.0) - *s = 1.0; - } - else - { - *v = (((x - sx) * (hy - vy) - (y - sy) * (hx - vx)) - / ((vx - sx) * (hy - vy) - (vy - sy) * (hx - vx))); - - if (*v<= 0.0) - { - *v = 0.0; - *s = 0.0; - } - else - { - if (*v > 1.0) - *v = 1.0; - - if (fabs (hy - vy) < fabs (hx - vx)) - *s = (x - sx - *v * (vx - sx)) / (*v * (hx - vx)); - else - *s = (y - sy - *v * (vy - sy)) / (*v * (hy - vy)); - - if (*s < 0.0) - *s = 0.0; - else if (*s > 1.0) - *s = 1.0; - } - } -} - -/* Computes whether a point is inside the saturation/value triangle */ -static gboolean -is_in_triangle (GimpColorWheel *wheel, - gdouble x, - gdouble y) -{ - gint hx, hy, sx, sy, vx, vy; - gdouble det, s, v; - - compute_triangle (wheel, &hx, &hy, &sx, &sy, &vx, &vy); - - det = (vx - sx) * (hy - sy) - (vy - sy) * (hx - sx); - - s = ((x - sx) * (hy - sy) - (y - sy) * (hx - sx)) / det; - v = ((vx - sx) * (y - sy) - (vy - sy) * (x - sx)) / det; - - return (s >= 0.0 && v >= 0.0 && s + v <= 1.0); -} - -/* Computes a value based on the mouse coordinates */ -static double -compute_v (GimpColorWheel *wheel, - gdouble x, - gdouble y) -{ - GtkAllocation allocation; - gdouble center_x; - gdouble center_y; - gdouble dx, dy; - gdouble angle; - - gtk_widget_get_allocation (GTK_WIDGET (wheel), &allocation); - - center_x = allocation.width / 2.0; - center_y = allocation.height / 2.0; - - dx = x - center_x; - dy = center_y - y; - - angle = atan2 (dy, dx); - if (angle < 0.0) - angle += 2.0 * G_PI; - - return angle / (2.0 * G_PI); -} - -static void -set_cross_grab (GimpColorWheel *wheel, - guint32 time) -{ - GimpColorWheelPrivate *priv = wheel->priv; - GdkCursor *cursor; - - cursor = - gdk_cursor_new_for_display (gtk_widget_get_display (GTK_WIDGET (wheel)), - GDK_CROSSHAIR); - -#if GTK_CHECK_VERSION(3,0,0) - gdk_device_grab (gtk_get_current_event_device(), - priv->window, - GDK_OWNERSHIP_NONE, - FALSE, - GDK_POINTER_MOTION_MASK | - GDK_POINTER_MOTION_HINT_MASK | - GDK_BUTTON_RELEASE_MASK, - cursor, time); - g_object_unref (cursor); -#else - gdk_pointer_grab (priv->window, FALSE, - GDK_POINTER_MOTION_MASK | - GDK_POINTER_MOTION_HINT_MASK | - GDK_BUTTON_RELEASE_MASK, - NULL, cursor, time); - gdk_cursor_unref (cursor); -#endif -} - -static gboolean gimp_color_wheel_grab_broken(GtkWidget *widget, GdkEventGrabBroken *event) -{ - (void)event; - GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget); - GimpColorWheelPrivate *priv = wheel->priv; - - priv->mode = DRAG_NONE; - - return TRUE; -} - -static gboolean -gimp_color_wheel_button_press (GtkWidget *widget, - GdkEventButton *event) -{ - GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget); - GimpColorWheelPrivate *priv = wheel->priv; - gdouble x, y; - - if (priv->mode != DRAG_NONE || event->button != 1) - return FALSE; - - x = event->x; - y = event->y; - - if (is_in_ring (wheel, x, y)) - { - priv->mode = DRAG_H; - set_cross_grab (wheel, event->time); - - gimp_color_wheel_set_color (wheel, - compute_v (wheel, x, y), - priv->s, - priv->v); - - gtk_widget_grab_focus (widget); - priv->focus_on_ring = TRUE; - - return TRUE; - } - - if (is_in_triangle (wheel, x, y)) - { - gdouble s, v; - - priv->mode = DRAG_SV; - set_cross_grab (wheel, event->time); - - compute_sv (wheel, x, y, &s, &v); - gimp_color_wheel_set_color (wheel, priv->h, s, v); - - gtk_widget_grab_focus (widget); - priv->focus_on_ring = FALSE; - - return TRUE; - } - - return FALSE; -} - -static gboolean -gimp_color_wheel_button_release (GtkWidget *widget, - GdkEventButton *event) -{ - GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget); - GimpColorWheelPrivate *priv = wheel->priv; - DragMode mode; - gdouble x, y; - - if (priv->mode == DRAG_NONE || event->button != 1) - return FALSE; - - /* Set the drag mode to DRAG_NONE so that signal handlers for "catched" - * can see that this is the final color state. - */ - - mode = priv->mode; - priv->mode = DRAG_NONE; - - x = event->x; - y = event->y; - - if (mode == DRAG_H) - { - gimp_color_wheel_set_color (wheel, - compute_v (wheel, x, y), priv->s, priv->v); - } - else if (mode == DRAG_SV) - { - gdouble s, v; - - compute_sv (wheel, x, y, &s, &v); - gimp_color_wheel_set_color (wheel, priv->h, s, v); - } - else - g_assert_not_reached (); - -#if GTK_CHECK_VERSION(3,0,0) - gdk_device_ungrab (gtk_get_current_event_device(), - event->time); -#else - gdk_display_pointer_ungrab (gdk_window_get_display (event->window), - event->time); -#endif - - return TRUE; -} - -static gboolean -gimp_color_wheel_motion (GtkWidget *widget, - GdkEventMotion *event) -{ - GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget); - GimpColorWheelPrivate *priv = wheel->priv; - gdouble x, y; - - if (priv->mode == DRAG_NONE) - return FALSE; - - gdk_event_request_motions (event); - x = event->x; - y = event->y; - - if (priv->mode == DRAG_H) - { - gimp_color_wheel_set_color (wheel, - compute_v (wheel, x, y), priv->s, priv->v); - return TRUE; - } - else if (priv->mode == DRAG_SV) - { - gdouble s, v; - - compute_sv (wheel, x, y, &s, &v); - gimp_color_wheel_set_color (wheel, priv->h, s, v); - return TRUE; - } - - g_assert_not_reached (); - - return FALSE; -} - - -/* Redrawing */ - -/* Paints the hue ring */ -static void -paint_ring (GimpColorWheel *wheel, - cairo_t *cr) -{ -#if GTK_CHECK_VERSION(3,0,0) - GtkWidget *widget = GTK_WIDGET (wheel); -#else - GtkAllocation allocation; -#endif - GimpColorWheelPrivate *priv = wheel->priv; - gint width, height; - gint xx, yy; - gdouble dx, dy, dist; - gdouble center_x; - gdouble center_y; - gdouble inner, outer; - guint32 *buf, *p; - gdouble angle; - gdouble hue; - gdouble r, g, b; - cairo_surface_t *source; - cairo_t *source_cr; - gint stride; - -#if GTK_CHECK_VERSION(3,0,0) - width = gtk_widget_get_allocated_width (widget); - height = gtk_widget_get_allocated_height (widget); -#else - gtk_widget_get_allocation (GTK_WIDGET (wheel), &allocation); - width = allocation.width; - height = allocation.height; -#endif - - center_x = width / 2.0; - center_y = height / 2.0; - - outer = priv->size / 2.0; - inner = outer - priv->ring_width; - - /* Create an image initialized with the ring colors */ - - stride = cairo_format_stride_for_width (CAIRO_FORMAT_RGB24, width); - buf = g_new (guint32, height * stride / 4); - - for (yy = 0; yy < height; yy++) - { - p = buf + yy * width; - dy = -(yy - center_y); - - for (xx = 0; xx < width; xx++) - { - dx = xx - center_x; - - dist = dx * dx + dy * dy; - if (dist < ((inner-1) * (inner-1)) || dist > ((outer+1) * (outer+1))) - { - *p++ = 0; - continue; - } - - angle = atan2 (dy, dx); - if (angle < 0.0) - angle += 2.0 * G_PI; - - hue = angle / (2.0 * G_PI); - - r = hue; - g = 1.0; - b = 1.0; - hsv_to_rgb (&r, &g, &b); - - *p++ = (((int)floor (r * 255 + 0.5) << 16) | - ((int)floor (g * 255 + 0.5) << 8) | - (int)floor (b * 255 + 0.5)); - } - } - - source = cairo_image_surface_create_for_data ((unsigned char *)buf, - CAIRO_FORMAT_RGB24, - width, height, stride); - - /* Now draw the value marker onto the source image, so that it - * will get properly clipped at the edges of the ring - */ - source_cr = cairo_create (source); - - r = priv->h; - g = 1.0; - b = 1.0; - hsv_to_rgb (&r, &g, &b); - - if (INTENSITY (r, g, b) > 0.5) - cairo_set_source_rgb (source_cr, 0.0, 0.0, 0.0); - else - cairo_set_source_rgb (source_cr, 1.0, 1.0, 1.0); - - cairo_move_to (source_cr, center_x, center_y); - cairo_line_to (source_cr, - center_x + cos (priv->h * 2.0 * G_PI) * priv->size / 2, - center_y - sin (priv->h * 2.0 * G_PI) * priv->size / 2); - cairo_stroke (source_cr); - cairo_destroy (source_cr); - - /* Draw the ring using the source image */ - - cairo_save (cr); - - cairo_set_source_surface (cr, source, 0, 0); - cairo_surface_destroy (source); - - cairo_set_line_width (cr, priv->ring_width); - cairo_new_path (cr); - cairo_arc (cr, - center_x, center_y, - priv->size / 2.0 - priv->ring_width / 2.0, - 0, 2 * G_PI); - cairo_stroke (cr); - - cairo_restore (cr); - - g_free (buf); -} - -/* Converts an HSV triplet to an integer RGB triplet */ -static void -get_color (gdouble h, - gdouble s, - gdouble v, - gint *r, - gint *g, - gint *b) -{ - hsv_to_rgb (&h, &s, &v); - - *r = floor (h * 255 + 0.5); - *g = floor (s * 255 + 0.5); - *b = floor (v * 255 + 0.5); -} - -#define SWAP(a, b, t) ((t) = (a), (a) = (b), (b) = (t)) - -#define LERP(a, b, v1, v2, i) (((v2) - (v1) != 0) \ - ? ((a) + ((b) - (a)) * ((i) - (v1)) / ((v2) - (v1))) \ - : (a)) - -/* Number of pixels we extend out from the edges when creating - * color source to avoid artifacts - */ -#define PAD 3 - -/* Paints the HSV triangle */ -static void -paint_triangle (GimpColorWheel *wheel, - cairo_t *cr, - gboolean draw_focus) -{ - GtkWidget *widget = GTK_WIDGET (wheel); - GimpColorWheelPrivate *priv = wheel->priv; - gint hx, hy, sx, sy, vx, vy; /* HSV vertices */ - gint x1, y1, r1, g1, b1; /* First vertex in scanline order */ - gint x2, y2, r2, g2, b2; /* Second vertex */ - gint x3, y3, r3, g3, b3; /* Third vertex */ - gint t; - guint32 *buf, *p, c; - gint xl, xr, rl, rr, gl, gr, bl, br; /* Scanline data */ - gint xx, yy; - gint x_interp, y_interp; - gint x_start, x_end; - cairo_surface_t *source; - gdouble r, g, b; - gint stride; - gint width, height; -#if GTK_CHECK_VERSION(3,0,0) - GtkStyleContext *context; - - width = gtk_widget_get_allocated_width (widget); - height = gtk_widget_get_allocated_height (widget); -#else - gchar *detail; - - GtkAllocation allocation; - gtk_widget_get_allocation (widget, &allocation); - width = allocation.width; - height = allocation.height; -#endif - - /* Compute triangle's vertices */ - - compute_triangle (wheel, &hx, &hy, &sx, &sy, &vx, &vy); - - x1 = hx; - y1 = hy; - get_color (priv->h, 1.0, 1.0, &r1, &g1, &b1); - - x2 = sx; - y2 = sy; - get_color (priv->h, 1.0, 0.0, &r2, &g2, &b2); - - x3 = vx; - y3 = vy; - get_color (priv->h, 0.0, 1.0, &r3, &g3, &b3); - - if (y2 > y3) - { - SWAP (x2, x3, t); - SWAP (y2, y3, t); - SWAP (r2, r3, t); - SWAP (g2, g3, t); - SWAP (b2, b3, t); - } - - if (y1 > y3) - { - SWAP (x1, x3, t); - SWAP (y1, y3, t); - SWAP (r1, r3, t); - SWAP (g1, g3, t); - SWAP (b1, b3, t); - } - - if (y1 > y2) - { - SWAP (x1, x2, t); - SWAP (y1, y2, t); - SWAP (r1, r2, t); - SWAP (g1, g2, t); - SWAP (b1, b2, t); - } - - /* Shade the triangle */ - - stride = cairo_format_stride_for_width (CAIRO_FORMAT_RGB24, width); - buf = g_new (guint32, height * stride / 4); - - for (yy = 0; yy < height; yy++) - { - p = buf + yy * width; - - if (yy >= y1 - PAD && yy < y3 + PAD) - { - y_interp = CLAMP (yy, y1, y3); - - if (y_interp < y2) - { - xl = LERP (x1, x2, y1, y2, y_interp); - - rl = LERP (r1, r2, y1, y2, y_interp); - gl = LERP (g1, g2, y1, y2, y_interp); - bl = LERP (b1, b2, y1, y2, y_interp); - } - else - { - xl = LERP (x2, x3, y2, y3, y_interp); - - rl = LERP (r2, r3, y2, y3, y_interp); - gl = LERP (g2, g3, y2, y3, y_interp); - bl = LERP (b2, b3, y2, y3, y_interp); - } - - xr = LERP (x1, x3, y1, y3, y_interp); - - rr = LERP (r1, r3, y1, y3, y_interp); - gr = LERP (g1, g3, y1, y3, y_interp); - br = LERP (b1, b3, y1, y3, y_interp); - - if (xl > xr) - { - SWAP (xl, xr, t); - SWAP (rl, rr, t); - SWAP (gl, gr, t); - SWAP (bl, br, t); - } - - x_start = MAX (xl - PAD, 0); - x_end = MIN (xr + PAD, width); - x_start = MIN (x_start, x_end); - - c = (rl << 16) | (gl << 8) | bl; - - for (xx = 0; xx < x_start; xx++) - *p++ = c; - - for (; xx < x_end; xx++) - { - x_interp = CLAMP (xx, xl, xr); - - *p++ = ((LERP (rl, rr, xl, xr, x_interp) << 16) | - (LERP (gl, gr, xl, xr, x_interp) << 8) | - LERP (bl, br, xl, xr, x_interp)); - } - - c = (rr << 16) | (gr << 8) | br; - - for (; xx < width; xx++) - *p++ = c; - } - } - - source = cairo_image_surface_create_for_data ((unsigned char *)buf, - CAIRO_FORMAT_RGB24, - width, height, stride); - - /* Draw a triangle with the image as a source */ - - cairo_set_source_surface (cr, source, 0, 0); - cairo_surface_destroy (source); - - cairo_move_to (cr, x1, y1); - cairo_line_to (cr, x2, y2); - cairo_line_to (cr, x3, y3); - cairo_close_path (cr); - cairo_fill (cr); - - g_free (buf); - - /* Draw value marker */ - - xx = floor (sx + (vx - sx) * priv->v + (hx - vx) * priv->s * priv->v + 0.5); - yy = floor (sy + (vy - sy) * priv->v + (hy - vy) * priv->s * priv->v + 0.5); - - r = priv->h; - g = priv->s; - b = priv->v; - hsv_to_rgb (&r, &g, &b); - -#if GTK_CHECK_VERSION(3,0,0) - context = gtk_widget_get_style_context (widget); - - gtk_style_context_save (context); -#endif - - if (INTENSITY (r, g, b) > 0.5) - { -#if GTK_CHECK_VERSION(3,0,0) - gtk_style_context_add_class (context, "light-area-focus"); -#else - detail = "colorwheel_light"; -#endif - cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); - } - else - { -#if GTK_CHECK_VERSION(3,0,0) - gtk_style_context_add_class (context, "dark-area-focus"); -#else - detail = "colorwheel_dark"; -#endif - cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); - } - -#define RADIUS 4 -#define FOCUS_RADIUS 6 - - cairo_new_path (cr); - cairo_arc (cr, xx, yy, RADIUS, 0, 2 * G_PI); - cairo_stroke (cr); - - /* Draw focus outline */ - - if (draw_focus && ! priv->focus_on_ring) - { - gint focus_width; - gint focus_pad; - - gtk_widget_style_get (widget, - "focus-line-width", &focus_width, - "focus-padding", &focus_pad, - NULL); - -#if GTK_CHECK_VERSION(3,0,0) - gtk_render_focus (context, cr, - xx - FOCUS_RADIUS - focus_width - focus_pad, - yy - FOCUS_RADIUS - focus_width - focus_pad, - 2 * (FOCUS_RADIUS + focus_width + focus_pad), - 2 * (FOCUS_RADIUS + focus_width + focus_pad)); -#else - gtk_widget_get_allocation (widget, &allocation); - gtk_paint_focus (gtk_widget_get_style (widget), - gtk_widget_get_window (widget), - gtk_widget_get_state (widget), - NULL, widget, detail, - allocation.x + xx - FOCUS_RADIUS - focus_width - focus_pad, - allocation.y + yy - FOCUS_RADIUS - focus_width - focus_pad, - 2 * (FOCUS_RADIUS + focus_width + focus_pad), - 2 * (FOCUS_RADIUS + focus_width + focus_pad)); -#endif - } - -#if GTK_CHECK_VERSION(3,0,0) - gtk_style_context_restore (context); -#endif -} - -#if GTK_CHECK_VERSION(3,0,0) -static gboolean -gimp_color_wheel_draw (GtkWidget *widget, - cairo_t *cr) -{ - GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget); - GimpColorWheelPrivate *priv = wheel->priv; - gboolean draw_focus; - - draw_focus = gtk_widget_has_visible_focus (widget); - - paint_ring (wheel, cr); - paint_triangle (wheel, cr, draw_focus); - - if (draw_focus && priv->focus_on_ring) - { - GtkStyleContext *context = gtk_widget_get_style_context (widget); - - gtk_render_focus (context, cr, 0, 0, - gtk_widget_get_allocated_width (widget), - gtk_widget_get_allocated_height (widget)); - } - - return FALSE; -} -#else -static gint -gimp_color_wheel_expose (GtkWidget *widget, - GdkEventExpose *event) -{ - cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget)); - - GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget); - GimpColorWheelPrivate *priv = wheel->priv; - gboolean draw_focus; - GtkAllocation allocation; - - if (! (event->window == gtk_widget_get_window (widget) && - gtk_widget_is_drawable (widget))) - return FALSE; - - gdk_cairo_region (cr, event->region); - cairo_clip (cr); - - gtk_widget_get_allocation (widget, &allocation); - cairo_translate (cr, allocation.x, allocation.y); - - draw_focus = gtk_widget_has_focus (widget); - - paint_ring (wheel, cr); - paint_triangle (wheel, cr, draw_focus); - - cairo_destroy (cr); - - if (draw_focus && priv->focus_on_ring) - gtk_paint_focus (gtk_widget_get_style (widget), - gtk_widget_get_window (widget), - gtk_widget_get_state (widget), - &event->area, widget, NULL, - allocation.x, - allocation.y, - allocation.width, - allocation.height); - - return FALSE; -} -#endif - -static gboolean -gimp_color_wheel_focus (GtkWidget *widget, - GtkDirectionType dir) -{ - GimpColorWheel *wheel = GIMP_COLOR_WHEEL (widget); - GimpColorWheelPrivate *priv = wheel->priv; - - if (!gtk_widget_has_focus (widget)) - { - if (dir == GTK_DIR_TAB_BACKWARD) - priv->focus_on_ring = FALSE; - else - priv->focus_on_ring = TRUE; - - gtk_widget_grab_focus (widget); - return TRUE; - } - - switch (dir) - { - case GTK_DIR_UP: - if (priv->focus_on_ring) - return FALSE; - else - priv->focus_on_ring = TRUE; - break; - - case GTK_DIR_DOWN: - if (priv->focus_on_ring) - priv->focus_on_ring = FALSE; - else - return FALSE; - break; - - case GTK_DIR_LEFT: - case GTK_DIR_TAB_BACKWARD: - if (priv->focus_on_ring) - return FALSE; - else - priv->focus_on_ring = TRUE; - break; - - case GTK_DIR_RIGHT: - case GTK_DIR_TAB_FORWARD: - if (priv->focus_on_ring) - priv->focus_on_ring = FALSE; - else - return FALSE; - break; - } - - gtk_widget_queue_draw (widget); - - return TRUE; -} - -/** - * gimp_color_wheel_new: - * - * Creates a new HSV color selector. - * - * Return value: A newly-created HSV color selector. - * - * Since: 2.14 - */ -GtkWidget* -gimp_color_wheel_new (void) -{ - return g_object_new (GIMP_TYPE_COLOR_WHEEL, NULL); -} - -/** - * gimp_color_wheel_set_color: - * @hsv: An HSV color selector - * @h: Hue - * @s: Saturation - * @v: Value - * - * Sets the current color in an HSV color selector. - * Color component values must be in the [0.0, 1.0] range. - * - * Since: 2.14 - */ -void -gimp_color_wheel_set_color (GimpColorWheel *wheel, - gdouble h, - gdouble s, - gdouble v) -{ - GimpColorWheelPrivate *priv; - - g_return_if_fail (GIMP_IS_COLOR_WHEEL (wheel)); - g_return_if_fail (h >= 0.0 && h <= 1.0); - g_return_if_fail (s >= 0.0 && s <= 1.0); - g_return_if_fail (v >= 0.0 && v <= 1.0); - - priv = wheel->priv; - - if(h == 0.0 && s == 0.0) { - h = priv->h; - } - - priv->h = h; - priv->s = s; - priv->v = v; - - g_signal_emit (wheel, wheel_signals[CHANGED], 0); - - gtk_widget_queue_draw (GTK_WIDGET (wheel)); -} - -/** - * gimp_color_wheel_get_color: - * @hsv: An HSV color selector - * @h: (out): Return value for the hue - * @s: (out): Return value for the saturation - * @v: (out): Return value for the value - * - * Queries the current color in an HSV color selector. - * Returned values will be in the [0.0, 1.0] range. - * - * Since: 2.14 - */ -void -gimp_color_wheel_get_color (GimpColorWheel *wheel, - gdouble *h, - gdouble *s, - gdouble *v) -{ - GimpColorWheelPrivate *priv; - - g_return_if_fail (GIMP_IS_COLOR_WHEEL (wheel)); - - priv = wheel->priv; - - if (h) *h = priv->h; - if (s) *s = priv->s; - if (v) *v = priv->v; -} - -/** - * gimp_color_wheel_set_ring_fraction: - * @ring: A wheel color selector - * @fraction: Ring fraction - * - * Sets the ring fraction of a wheel color selector. - * - * Since: GIMP 2.10 - */ -void -gimp_color_wheel_set_ring_fraction (GimpColorWheel *hsv, - gdouble fraction) -{ - GimpColorWheelPrivate *priv; - - g_return_if_fail (GIMP_IS_COLOR_WHEEL (hsv)); - - priv = hsv->priv; - - priv->ring_fraction = CLAMP (fraction, 0.01, 0.99); - - gtk_widget_queue_draw (GTK_WIDGET (hsv)); -} - -/** - * gimp_color_wheel_get_ring_fraction: - * @ring: A wheel color selector - * - * Returns value: The ring fraction of the wheel color selector. - * - * Since: GIMP 2.10 - */ -gdouble -gimp_color_wheel_get_ring_fraction (GimpColorWheel *wheel) -{ - GimpColorWheelPrivate *priv; - - g_return_val_if_fail (GIMP_IS_COLOR_WHEEL (wheel), DEFAULT_FRACTION); - - priv = wheel->priv; - - return priv->ring_fraction; -} - -/** - * gimp_color_wheel_is_adjusting: - * @hsv: A #GimpColorWheel - * - * An HSV color selector can be said to be adjusting if multiple rapid - * changes are being made to its value, for example, when the user is - * adjusting the value with the mouse. This function queries whether - * the HSV color selector is being adjusted or not. - * - * Return value: %TRUE if clients can ignore changes to the color value, - * since they may be transitory, or %FALSE if they should consider - * the color value status to be final. - * - * Since: 2.14 - */ -gboolean -gimp_color_wheel_is_adjusting (GimpColorWheel *wheel) -{ - GimpColorWheelPrivate *priv; - - g_return_val_if_fail (GIMP_IS_COLOR_WHEEL (wheel), FALSE); - - priv = wheel->priv; - - return priv->mode != DRAG_NONE; -} - -static void -gimp_color_wheel_move (GimpColorWheel *wheel, - GtkDirectionType dir) -{ - GimpColorWheelPrivate *priv = wheel->priv; - gdouble hue, sat, val; - gint hx, hy, sx, sy, vx, vy; /* HSV vertices */ - gint x, y; /* position in triangle */ - - hue = priv->h; - sat = priv->s; - val = priv->v; - - compute_triangle (wheel, &hx, &hy, &sx, &sy, &vx, &vy); - - x = floor (sx + (vx - sx) * priv->v + (hx - vx) * priv->s * priv->v + 0.5); - y = floor (sy + (vy - sy) * priv->v + (hy - vy) * priv->s * priv->v + 0.5); - -#define HUE_DELTA 0.002 - switch (dir) - { - case GTK_DIR_UP: - if (priv->focus_on_ring) - hue += HUE_DELTA; - else - { - y -= 1; - compute_sv (wheel, x, y, &sat, &val); - } - break; - - case GTK_DIR_DOWN: - if (priv->focus_on_ring) - hue -= HUE_DELTA; - else - { - y += 1; - compute_sv (wheel, x, y, &sat, &val); - } - break; - - case GTK_DIR_LEFT: - if (priv->focus_on_ring) - hue += HUE_DELTA; - else - { - x -= 1; - compute_sv (wheel, x, y, &sat, &val); - } - break; - - case GTK_DIR_RIGHT: - if (priv->focus_on_ring) - hue -= HUE_DELTA - ; - else - { - x += 1; - compute_sv (wheel, x, y, &sat, &val); - } - break; - - default: - /* we don't care about the tab directions */ - break; - } - - /* Wrap */ - if (hue < 0.0) - hue = 1.0; - else if (hue > 1.0) - hue = 0.0; - - gimp_color_wheel_set_color (wheel, hue, sat, val); -} diff --git a/src/ui/widget/gimpcolorwheel.h b/src/ui/widget/gimpcolorwheel.h deleted file mode 100644 index 016fb593f..000000000 --- a/src/ui/widget/gimpcolorwheel.h +++ /dev/null @@ -1,95 +0,0 @@ -/* HSV color selector for GTK+ - * - * Copyright (C) 1999 The Free Software Foundation - * - * Authors: Simon Budig <Simon.Budig@unix-ag.org> (original code) - * Federico Mena-Quintero <federico@gimp.org> (cleanup for GTK+) - * Jonathan Blandford <jrb@redhat.com> (cleanup for GTK+) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -/* - * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GTK+ Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GTK+ at ftp://ftp.gtk.org/pub/gtk/. - */ - -#ifndef __GIMP_COLOR_WHEEL_H__ -#define __GIMP_COLOR_WHEEL_H__ - -G_BEGIN_DECLS - -#define GIMP_TYPE_COLOR_WHEEL (gimp_color_wheel_get_type ()) -#define GIMP_COLOR_WHEEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COLOR_WHEEL, GimpColorWheel)) -#define GIMP_COLOR_WHEEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_WHEEL, GimpColorWheelClass)) -#define GIMP_IS_COLOR_WHEEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_COLOR_WHEEL)) -#define GIMP_IS_COLOR_WHEEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_WHEEL)) -#define GIMP_COLOR_WHEEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_WHEEL, GimpColorWheelClass)) - - -typedef struct _GimpColorWheel GimpColorWheel; -typedef struct _GimpColorWheelClass GimpColorWheelClass; - -struct _GimpColorWheel -{ - GtkWidget parent_instance; - - /* Private data */ - gpointer priv; -}; - -struct _GimpColorWheelClass -{ - GtkWidgetClass parent_class; - - /* Notification signals */ - void (* changed) (GimpColorWheel *wheel); - - /* Keybindings */ - void (* move) (GimpColorWheel *wheel, - GtkDirectionType type); - - /* Padding for future expansion */ - void (*_gimp_reserved1) (void); - void (*_gimp_reserved2) (void); - void (*_gimp_reserved3) (void); - void (*_gimp_reserved4) (void); -}; - - -GType gimp_color_wheel_get_type (void) G_GNUC_CONST; -GtkWidget * gimp_color_wheel_new (void); - -void gimp_color_wheel_set_color (GimpColorWheel *wheel, - double h, - double s, - double v); -void gimp_color_wheel_get_color (GimpColorWheel *wheel, - gdouble *h, - gdouble *s, - gdouble *v); - -void gimp_color_wheel_set_ring_fraction (GimpColorWheel *wheel, - gdouble fraction); -gdouble gimp_color_wheel_get_ring_fraction (GimpColorWheel *wheel); - -gboolean gimp_color_wheel_is_adjusting (GimpColorWheel *wheel); - -G_END_DECLS - -#endif /* __GIMP_COLOR_WHEEL_H__ */ diff --git a/src/ui/widget/gimpspinscale.c b/src/ui/widget/gimpspinscale.c deleted file mode 100644 index d99646a64..000000000 --- a/src/ui/widget/gimpspinscale.c +++ /dev/null @@ -1,1225 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpspinscale.c - * Copyright (C) 2010 Michael Natterer <mitch@gimp.org> - * 2012 Øyvind KolÃ¥s <pippin@gimp.org> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include <math.h> -#include <string.h> -#include <gdk/gdkkeysyms.h> - -#include "gimpspinscale.h" - - -enum -{ - PROP_0, - PROP_LABEL, - PROP_FOCUS_WIDGET -}; - -typedef enum -{ - TARGET_NUMBER, - TARGET_UPPER, - TARGET_LOWER -#if WITH_GTKMM_3_0 - ,TARGET_NONE -#endif -} SpinScaleTarget; - -typedef enum -{ - APPEARANCE_FULL = 1, /* Full size suitable for tablets */ - APPEARANCE_COMPACT, /* Compact, suitable for desktops with mouse control */ -} SpinScaleAppearance; - -typedef struct _GimpSpinScalePrivate GimpSpinScalePrivate; - -struct _GimpSpinScalePrivate -{ - gchar *label; - - gboolean scale_limits_set; - gdouble scale_lower; - gdouble scale_upper; - gdouble gamma; - - PangoLayout *layout; - gboolean changing_value; - gboolean relative_change; - gdouble start_x; - gdouble start_value; - - GtkWidget* focusWidget; - gboolean transferFocus; - SpinScaleAppearance appearanceMode; -}; - -#define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ - GIMP_TYPE_SPIN_SCALE, \ - GimpSpinScalePrivate)) - - -static void gimp_spin_scale_dispose (GObject *object); -static void gimp_spin_scale_finalize (GObject *object); -static void gimp_spin_scale_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec); -static void gimp_spin_scale_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec); - -static void gimp_spin_scale_style_set (GtkWidget *widget, - GtkStyle *prev_style); - -#if WITH_GTKMM_3_0 -static void gimp_spin_scale_get_preferred_width (GtkWidget *widget, - gint *minimum_width, - gint *natural_width); -static void gimp_spin_scale_get_preferred_height (GtkWidget *widget, - gint *minimum_width, - gint *natural_width); -static gboolean gimp_spin_scale_draw (GtkWidget *widget, - cairo_t *cr); -#else -static void gimp_spin_scale_size_request (GtkWidget *widget, - GtkRequisition *requisition); - -static gboolean gimp_spin_scale_expose (GtkWidget *widget, - GdkEventExpose *event); -#endif - -static gboolean gimp_spin_scale_button_press (GtkWidget *widget, - GdkEventButton *event); -static gboolean gimp_spin_scale_button_release (GtkWidget *widget, - GdkEventButton *event); -static gboolean gimp_spin_scale_motion_notify (GtkWidget *widget, - GdkEventMotion *event); -static gboolean gimp_spin_scale_leave_notify (GtkWidget *widget, - GdkEventCrossing *event); -static gboolean gimp_spin_scale_keypress( GtkWidget *widget, - GdkEventKey *event); - -static void gimp_spin_scale_defocus( GtkSpinButton *spin_button ); - -static void gimp_spin_scale_value_changed (GtkSpinButton *spin_button); - - -G_DEFINE_TYPE (GimpSpinScale, gimp_spin_scale, GTK_TYPE_SPIN_BUTTON); - -#define parent_class gimp_spin_scale_parent_class - - -static void -gimp_spin_scale_class_init (GimpSpinScaleClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - GtkSpinButtonClass *spin_button_class = GTK_SPIN_BUTTON_CLASS (klass); - - object_class->dispose = gimp_spin_scale_dispose; - object_class->finalize = gimp_spin_scale_finalize; - object_class->set_property = gimp_spin_scale_set_property; - object_class->get_property = gimp_spin_scale_get_property; - - widget_class->style_set = gimp_spin_scale_style_set; -#if WITH_GTKMM_3_0 - widget_class->get_preferred_width = gimp_spin_scale_get_preferred_width; - widget_class->get_preferred_height = gimp_spin_scale_get_preferred_height; - widget_class->draw = gimp_spin_scale_draw; -#else - widget_class->size_request = gimp_spin_scale_size_request; - widget_class->expose_event = gimp_spin_scale_expose; -#endif - widget_class->button_press_event = gimp_spin_scale_button_press; - widget_class->button_release_event = gimp_spin_scale_button_release; - widget_class->motion_notify_event = gimp_spin_scale_motion_notify; - widget_class->leave_notify_event = gimp_spin_scale_leave_notify; - widget_class->key_press_event = gimp_spin_scale_keypress; - - spin_button_class->value_changed = gimp_spin_scale_value_changed; - - g_object_class_install_property (object_class, PROP_LABEL, - g_param_spec_string ("label", NULL, NULL, - NULL, - G_PARAM_READWRITE)); - - g_type_class_add_private (klass, sizeof (GimpSpinScalePrivate)); -} - -static void -gimp_spin_scale_init (GimpSpinScale *scale) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (scale); - - gtk_widget_add_events (GTK_WIDGET (scale), - GDK_BUTTON_PRESS_MASK | - GDK_BUTTON_RELEASE_MASK | - GDK_POINTER_MOTION_MASK | - GDK_BUTTON1_MOTION_MASK | - GDK_LEAVE_NOTIFY_MASK); - - gtk_entry_set_alignment (GTK_ENTRY (scale), 1.0); - gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (scale), TRUE); - - private->gamma = 1.0; - private->focusWidget = NULL; - private->transferFocus = FALSE; - private->appearanceMode = APPEARANCE_COMPACT; -} - -static void -gimp_spin_scale_dispose (GObject *object) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (object); - - if (private->layout) - { - g_object_unref (private->layout); - private->layout = NULL; - } - - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -static void -gimp_spin_scale_finalize (GObject *object) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (object); - - if (private->label) - { - g_free (private->label); - private->label = NULL; - } - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -static void -gimp_spin_scale_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (object); - GimpSpinScale *scale = GIMP_SPIN_SCALE (object); - - switch (property_id) - { - case PROP_LABEL: - gimp_spin_scale_set_label (scale, g_value_get_string (value)); - break; - - case PROP_FOCUS_WIDGET: - { - /* TODO unhook prior */ - private->focusWidget = GTK_WIDGET (g_value_get_pointer (value)); - } - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -static void -gimp_spin_scale_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (object); - GimpSpinScale *scale = GIMP_SPIN_SCALE (object); - - switch (property_id) - { - case PROP_LABEL: - g_value_set_string (value, gimp_spin_scale_get_label (scale)); - break; - - case PROP_FOCUS_WIDGET: - g_value_set_pointer (value, private->focusWidget); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - - -void -gimp_spin_scale_set_focuswidget( GtkWidget *scale, GtkWidget* widget ) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (scale); - - /* TODO unhook prior */ - - private->focusWidget = widget; -} - -void -gimp_spin_scale_set_appearance( GtkWidget *widget, const gchar *appearance) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (widget); - - if ( strcmp("full", appearance) == 0 ) { - private->appearanceMode = APPEARANCE_FULL; - } else if ( strcmp("compact", appearance) == 0 ) { - private->appearanceMode = APPEARANCE_COMPACT; - } -} - -#if GTK_CHECK_VERSION(3,0,0) -static void -gimp_spin_scale_get_preferred_width (GtkWidget *widget, - gint *minimum_width, - gint *natural_width) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (widget); - PangoContext *context = gtk_widget_get_pango_context (widget); - PangoFontMetrics *metrics; - - GTK_WIDGET_CLASS (parent_class)->get_preferred_width (widget, - minimum_width, - natural_width); - - metrics = pango_context_get_metrics (context, - pango_context_get_font_description (context), - pango_context_get_language (context)); - - if (private->label) - { - gint char_width; - gint digit_width; - gint char_pixels; - - char_width = pango_font_metrics_get_approximate_char_width (metrics); - digit_width = pango_font_metrics_get_approximate_digit_width (metrics); - char_pixels = PANGO_PIXELS (MAX (char_width, digit_width)); - - /* ~3 chars for the ellipse */ - *minimum_width += char_pixels * 3; - *natural_width += char_pixels * 3; - } - - pango_font_metrics_unref (metrics); -} - -static void -gimp_spin_scale_get_preferred_height (GtkWidget *widget, - gint *minimum_height, - gint *natural_height) -{ - PangoContext *context = gtk_widget_get_pango_context (widget); - PangoFontMetrics *metrics; - //gint height; - - GTK_WIDGET_CLASS (parent_class)->get_preferred_height (widget, - minimum_height, - natural_height); - - metrics = pango_context_get_metrics (context, - pango_context_get_font_description (context), - pango_context_get_language (context)); - - //height = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) + - // pango_font_metrics_get_descent (metrics)); - - *minimum_height += 1; - *natural_height += 1; - - pango_font_metrics_unref (metrics); -} -#else -static void -gimp_spin_scale_size_request (GtkWidget *widget, - GtkRequisition *requisition) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (widget); - GtkStyle *style = gtk_widget_get_style (widget); - PangoContext *context = gtk_widget_get_pango_context (widget); - PangoFontMetrics *metrics; - gint height; - - GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition); - - metrics = pango_context_get_metrics (context, style->font_desc, - pango_context_get_language (context)); - - height = PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) + - pango_font_metrics_get_descent (metrics)); - - if (private->appearanceMode == APPEARANCE_COMPACT) { - requisition->height += 1; - } else { - requisition->height += height; - } - - if (private->label) - { - gint char_width; - gint digit_width; - gint char_pixels; - - char_width = pango_font_metrics_get_approximate_char_width (metrics); - digit_width = pango_font_metrics_get_approximate_digit_width (metrics); - char_pixels = PANGO_PIXELS (MAX (char_width, digit_width)); - - /* ~3 chars for the ellipses */ - requisition->width += char_pixels * 3; - } - - pango_font_metrics_unref (metrics); -} -#endif - -static void -gimp_spin_scale_style_set (GtkWidget *widget, - GtkStyle *prev_style) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (widget); - - GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style); - - if (private->layout) - { - g_object_unref (private->layout); - private->layout = NULL; - } -} - - -static gboolean -#if GTK_CHECK_VERSION(3,0,0) - gimp_spin_scale_draw (GtkWidget *widget, - cairo_t *cr) -#else - gimp_spin_scale_expose (GtkWidget *widget, - GdkEventExpose *event) -#endif -{ - GimpSpinScalePrivate *private = GET_PRIVATE (widget); -#if GTK_CHECK_VERSION(3,0,0) - GtkStyleContext *style = gtk_widget_get_style_context(widget); - GtkAllocation allocation; - GdkRGBA color; - - cairo_save (cr); - GTK_WIDGET_CLASS (parent_class)->draw (widget, cr); - cairo_restore (cr); - - gtk_widget_get_allocation (widget, &allocation); -#else - GtkStyle *style = gtk_widget_get_style (widget); - cairo_t *cr; - gint w; - - GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event); - - cr = gdk_cairo_create (event->window); - gdk_cairo_region (cr, event->region); - cairo_clip (cr); - - w = gdk_window_get_width (event->window); -#endif - - cairo_set_line_width (cr, 1.0); - -#if GTK_CHECK_VERSION(3,0,0) - if (private->label) - { - GdkRectangle text_area; - gint minimum_width; - gint natural_width; -#else - if (private->label && - gtk_widget_is_drawable (widget) && - event->window == gtk_entry_get_text_window (GTK_ENTRY (widget))) - { - GtkRequisition requisition; - GtkAllocation allocation; -#endif - PangoRectangle logical; - gint layout_offset_x; - gint layout_offset_y; -#if GTK_CHECK_VERSION(3,0,0) - GtkStateFlags state; - GdkRGBA text_color; - GdkRGBA bar_text_color; -#else - GtkStateType state; - GdkColor text_color; - GdkColor bar_text_color; - gint window_width; - gint window_height; -#endif - gdouble progress_fraction; - gint progress_x; - gint progress_y; - gint progress_width; - gint progress_height; - -#if GTK_CHECK_VERSION(3,0,0) - gtk_entry_get_text_area (GTK_ENTRY (widget), &text_area); - - GTK_WIDGET_CLASS (parent_class)->get_preferred_width (widget, - &minimum_width, - &natural_width); -#else - GTK_WIDGET_CLASS (parent_class)->size_request (widget, &requisition); - gtk_widget_get_allocation (widget, &allocation); -#endif - - if (! private->layout) - { - private->layout = gtk_widget_create_pango_layout (widget, - private->label); - pango_layout_set_ellipsize (private->layout, PANGO_ELLIPSIZE_END); - } - - pango_layout_set_width (private->layout, - PANGO_SCALE * -#if GTK_CHECK_VERSION(3,0,0) - (allocation.width - minimum_width)); -#else - (allocation.width - requisition.width)); -#endif - pango_layout_get_pixel_extents (private->layout, NULL, &logical); - - gtk_entry_get_layout_offsets (GTK_ENTRY (widget), NULL, &layout_offset_y); - - if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) -#if GTK_CHECK_VERSION(3,0,0) - layout_offset_x = text_area.x + text_area.width - logical.width - 4; -#else - layout_offset_x = w - logical.width - 4; -#endif - else - layout_offset_x = 4; - - layout_offset_x -= logical.x; - -#if GTK_CHECK_VERSION(3,0,0) - state = gtk_widget_get_state_flags (widget); - - gtk_style_context_get_color (style, state, &text_color); - - gtk_style_context_save (style); - gtk_style_context_add_class (style, GTK_STYLE_CLASS_PROGRESSBAR); - gtk_style_context_get_color (style, state, &bar_text_color); - gtk_style_context_restore (style); -#else - state = GTK_STATE_SELECTED; - if (! gtk_widget_get_sensitive (widget)) - state = GTK_STATE_INSENSITIVE; - text_color = style->text[gtk_widget_get_state (widget)]; - bar_text_color = style->fg[state]; - - window_width = gdk_window_get_width (event->window); - window_height = gdk_window_get_height (event->window); -#endif - - progress_fraction = gtk_entry_get_progress_fraction (GTK_ENTRY (widget)); - - if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) - { - progress_fraction = 1.0 - progress_fraction; - -#if GTK_CHECK_VERSION(3,0,0) - progress_x = text_area.width * progress_fraction; -#else - progress_x = window_width * progress_fraction; -#endif - progress_y = 0; -#if GTK_CHECK_VERSION(3,0,0) - progress_width = text_area.width - progress_x; - progress_height = text_area.height; -#else - progress_width = window_width - progress_x; - progress_height = window_height; -#endif - } - else - { - progress_x = 0; - progress_y = 0; -#if GTK_CHECK_VERSION(3,0,0) - progress_width = text_area.width * progress_fraction; - progress_height = text_area.height; -#else - progress_width = window_width * progress_fraction; - progress_height = window_height; -#endif - } - - cairo_save (cr); - - cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD); -#if GTK_CHECK_VERSION(3,0,0) - cairo_rectangle (cr, 0, 0, text_area.width, text_area.height); -#else - cairo_rectangle (cr, 0, 0, window_width, window_height); -#endif - cairo_rectangle (cr, progress_x, progress_y, - progress_width, progress_height); - cairo_clip (cr); - cairo_set_fill_rule (cr, CAIRO_FILL_RULE_WINDING); - -#if GTK_CHECK_VERSION(3,0,0) - cairo_move_to (cr, layout_offset_x, text_area.y + layout_offset_y-3); - gdk_cairo_set_source_rgba (cr, &text_color); -#else - cairo_move_to (cr, layout_offset_x, layout_offset_y-3); - gdk_cairo_set_source_color (cr, &text_color); -#endif - pango_cairo_show_layout (cr, private->layout); - cairo_restore (cr); - - cairo_rectangle (cr, progress_x, progress_y, - progress_width, progress_height); - cairo_clip (cr); - -#if GTK_CHECK_VERSION(3,0,0) - cairo_move_to (cr, layout_offset_x, text_area.y + layout_offset_y-3); - gdk_cairo_set_source_rgba (cr, &bar_text_color); -#else - cairo_move_to (cr, layout_offset_x, layout_offset_y-3); - gdk_cairo_set_source_color (cr, &bar_text_color); -#endif - pango_cairo_show_layout (cr, private->layout); - } - -#if !GTK_CHECK_VERSION(3,0,0) - cairo_destroy (cr); -#endif - - return FALSE; -} - -#if WITH_GTKMM_3_0 -/* Returns TRUE if a translation should be done */ -static gboolean -gtk_widget_get_translation_to_window (GtkWidget *widget, - GdkWindow *window, - int *x, - int *y) -{ - GdkWindow *w, *widget_window; - - if (!gtk_widget_get_has_window (widget)) - { - GtkAllocation allocation; - - gtk_widget_get_allocation (widget, &allocation); - - *x = -allocation.x; - *y = -allocation.y; - } - else - { - *x = 0; - *y = 0; - } - - widget_window = gtk_widget_get_window (widget); - - for (w = window; w && w != widget_window; w = gdk_window_get_parent (w)) - { - int wx, wy; - gdk_window_get_position (w, &wx, &wy); - *x += wx; - *y += wy; - } - - if (w == NULL) - { - *x = 0; - *y = 0; - return FALSE; - } - - return TRUE; -} - -static void -gimp_spin_scale_event_to_widget_coords (GtkWidget *widget, - GdkWindow *window, - gdouble event_x, - gdouble event_y, - gint *widget_x, - gint *widget_y) -{ - gint tx, ty; - - if (gtk_widget_get_translation_to_window (widget, window, &tx, &ty)) - { - event_x += tx; - event_y += ty; - } - - *widget_x = event_x; - *widget_y = event_y; -} -#endif - -static SpinScaleTarget -gimp_spin_scale_get_target (GtkWidget *widget, - gdouble x, - gdouble y) -{ - GtkAllocation allocation; - PangoRectangle logical; - gint layout_x; - gint layout_y; - - gtk_widget_get_allocation (widget, &allocation); - gtk_entry_get_layout_offsets (GTK_ENTRY (widget), &layout_x, &layout_y); - pango_layout_get_pixel_extents (gtk_entry_get_layout (GTK_ENTRY (widget)), - NULL, &logical); - -#if WITH_GTKMM_3_0 - GdkRectangle text_area; - gtk_entry_get_text_area (GTK_ENTRY (widget), &text_area); - - if (x >= text_area.x && x < text_area.width && - y >= text_area.y && y < text_area.height) - { - x -= text_area.x; - y -= text_area.y; - - if (x > layout_x && x < layout_x + logical.width && - y > layout_y && y < layout_y + logical.height) - { - return TARGET_NUMBER; - } - else if (y > text_area.height / 2) - { - return TARGET_LOWER; - } - - return TARGET_UPPER; - } - - return TARGET_NONE; -#else - if (x > layout_x && x < layout_x + logical.width && - y > layout_y && y < layout_y + logical.height) - { - return TARGET_NUMBER; - } - - else if (y > allocation.height / 2) - { - return TARGET_LOWER; - } - return TARGET_UPPER; -#endif -} - -static void -gimp_spin_scale_get_limits (GimpSpinScale *scale, - gdouble *lower, - gdouble *upper) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (scale); - - if (private->scale_limits_set) - { - *lower = private->scale_lower; - *upper = private->scale_upper; - } - else - { - GtkSpinButton *spin_button = GTK_SPIN_BUTTON (scale); - GtkAdjustment *adjustment = gtk_spin_button_get_adjustment (spin_button); - - *lower = gtk_adjustment_get_lower (adjustment); - *upper = gtk_adjustment_get_upper (adjustment); - } -} - -static void -gimp_spin_scale_change_value (GtkWidget *widget, - gdouble x) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (widget); - GtkSpinButton *spin_button = GTK_SPIN_BUTTON (widget); - GtkAdjustment *adjustment = gtk_spin_button_get_adjustment (spin_button); - gdouble lower; - gdouble upper; - gdouble value; -#if WITH_GTKMM_3_0 -#else -#endif -#if WITH_GTKMM_3_0 - GdkRectangle text_area; - gtk_entry_get_text_area (GTK_ENTRY (widget), &text_area); - gimp_spin_scale_get_limits (GIMP_SPIN_SCALE (widget), &lower, &upper); -#else - GdkWindow *text_window = gtk_entry_get_text_window (GTK_ENTRY (widget)); - gint width; - - gimp_spin_scale_get_limits (GIMP_SPIN_SCALE (widget), &lower, &upper); - - width = gdk_window_get_width (text_window); -#endif - - - if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) -#if WITH_GTKMM_3_0 - x = text_area.width - x; -#else - x = width - x; -#endif - - - if (private->relative_change) - { - gdouble diff; - gdouble step; - - -#if WITH_GTKMM_3_0 - step = (upper - lower) / text_area.width / 10.0; -#else - step = (upper - lower) / width / 10.0; -#endif - if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) - -#if WITH_GTKMM_3_0 - diff = x - (text_area.width - private->start_x); -#else - diff = x - (width - private->start_x); -#endif - else - diff = x - private->start_x; - - value = (private->start_value + diff * step); - } - else - { - gdouble fraction; - - -#if WITH_GTKMM_3_0 - fraction = x / (gdouble) text_area.width; -#else - fraction = x / (gdouble) width; -#endif - if (fraction > 0.0) - fraction = pow (fraction, private->gamma); - - value = fraction * (upper - lower) + lower; - } - - gtk_adjustment_set_value (adjustment, value); -} - -static gboolean -gimp_spin_scale_button_press (GtkWidget *widget, - GdkEventButton *event) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (widget); - - private->changing_value = FALSE; - private->relative_change = FALSE; - -#if WITH_GTKMM_3_0 - gint x, y; - gimp_spin_scale_event_to_widget_coords (widget, event->window, - event->x, event->y, - &x, &y); - switch (gimp_spin_scale_get_target (widget, x, y)) - { - case TARGET_UPPER: - private->changing_value = TRUE; - - gtk_widget_grab_focus (widget); - - gimp_spin_scale_change_value (widget, x); - - return TRUE; - - case TARGET_LOWER: - private->changing_value = TRUE; - - gtk_widget_grab_focus (widget); - - private->relative_change = TRUE; - private->start_x = x; - private->start_value = gtk_adjustment_get_value (gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget))); - - return TRUE; - - default: - break; - } -#else - if (event->window == gtk_entry_get_text_window (GTK_ENTRY (widget))) - { - switch (gimp_spin_scale_get_target (widget, event->x, event->y)) - { - case TARGET_UPPER: - private->changing_value = TRUE; - - gtk_widget_grab_focus (widget); - - gimp_spin_scale_change_value (widget, event->x); - - return TRUE; - - case TARGET_LOWER: - private->changing_value = TRUE; - - gtk_widget_grab_focus (widget); - - private->relative_change = TRUE; - private->start_x = event->x; - private->start_value = gtk_adjustment_get_value (gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (widget))); - - return TRUE; - - default: - break; - } - } -#endif - - return GTK_WIDGET_CLASS (parent_class)->button_press_event (widget, event); -} - -static gboolean -gimp_spin_scale_button_release (GtkWidget *widget, - GdkEventButton *event) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (widget); -#if WITH_GTKMM_3_0 - gint x, y; - - gimp_spin_scale_event_to_widget_coords (widget, event->window, - event->x, event->y, - &x, &y); -#endif - - if (private->changing_value) - { - private->changing_value = FALSE; -#if WITH_GTKMM_3_0 - gimp_spin_scale_change_value (widget, x); -#else - gimp_spin_scale_change_value (widget, event->x); -#endif - return TRUE; - } - - return GTK_WIDGET_CLASS (parent_class)->button_release_event (widget, event); -} - -static gboolean -gimp_spin_scale_motion_notify (GtkWidget *widget, - GdkEventMotion *event) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (widget); - - gdk_event_request_motions (event); - -#if WITH_GTKMM_3_0 - gint x, y; - - gimp_spin_scale_event_to_widget_coords (widget, event->window, - event->x, event->y, - &x, &y); -#endif - - if (private->changing_value) - { -#if WITH_GTKMM_3_0 - gimp_spin_scale_change_value (widget, x); -#else - gimp_spin_scale_change_value (widget, event->x); -#endif - - return TRUE; - } - - GTK_WIDGET_CLASS (parent_class)->motion_notify_event (widget, event); - - if (! (event->state & - (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK)) -#if WITH_GTKMM_3_0 -#else - && event->window == gtk_entry_get_text_window (GTK_ENTRY (widget)) -#endif - ) - { - GdkDisplay *display = gtk_widget_get_display (widget); - GdkCursor *cursor = NULL; - -#if WITH_GTKMM_3_0 - switch (gimp_spin_scale_get_target (widget, x, y)) -#else - switch (gimp_spin_scale_get_target (widget, event->x, event->y)) -#endif - { - case TARGET_NUMBER: - cursor = gdk_cursor_new_for_display (display, GDK_XTERM); - break; - - case TARGET_UPPER: - cursor = gdk_cursor_new_for_display (display, GDK_SB_UP_ARROW); - break; - - case TARGET_LOWER: - cursor = gdk_cursor_new_for_display (display, GDK_SB_H_DOUBLE_ARROW); - break; - - default: - break; - } - - -#if WITH_GTKMM_3_0 - if (cursor) - { - gdk_window_set_cursor (event->window, cursor); - g_object_unref (cursor); - } -#else - gdk_window_set_cursor (event->window, cursor); - gdk_cursor_unref (cursor); -#endif - } - - return FALSE; -} - -static gboolean -gimp_spin_scale_leave_notify (GtkWidget *widget, - GdkEventCrossing *event) -{ - gdk_window_set_cursor (event->window, NULL); - - return GTK_WIDGET_CLASS (parent_class)->leave_notify_event (widget, event); -} - -gboolean gimp_spin_scale_keypress( GtkWidget *widget, GdkEventKey *event) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (widget); - guint key = 0; - gdk_keymap_translate_keyboard_state( gdk_keymap_get_for_display( gdk_display_get_default() ), - event->hardware_keycode, (GdkModifierType)event->state, - 0, &key, 0, 0, 0 ); - - switch ( key ) { - - case GDK_KEY_Escape: - case GDK_KEY_Return: - case GDK_KEY_KP_Enter: - { - private->transferFocus = TRUE; - gimp_spin_scale_defocus( GTK_SPIN_BUTTON(widget) ); - } - break; - - } - - return GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event); -} - -static void -gimp_spin_scale_defocus( GtkSpinButton *spin_button ) -{ - GimpSpinScalePrivate *private = GET_PRIVATE (spin_button); - - if ( private->transferFocus ) { - if ( private->focusWidget ) { - gtk_widget_grab_focus( private->focusWidget ); - } - } -} - -static void -gimp_spin_scale_value_changed (GtkSpinButton *spin_button) -{ - GtkAdjustment *adjustment = gtk_spin_button_get_adjustment (spin_button); - GimpSpinScalePrivate *private = GET_PRIVATE (spin_button); - gdouble lower; - gdouble upper; - gdouble value; - - gimp_spin_scale_get_limits (GIMP_SPIN_SCALE (spin_button), &lower, &upper); - - value = CLAMP (gtk_adjustment_get_value (adjustment), lower, upper); - - gtk_entry_set_progress_fraction (GTK_ENTRY (spin_button), - pow ((value - lower) / (upper - lower), - 1.0 / private->gamma)); - - // TODO - Allow scrollwheel to change value then return focus, - // but clicks/keypress should keep focus in the control - //if ( gtk_widget_has_focus( GTK_WIDGET(spin_button) ) ) { - // gimp_spin_scale_defocus( spin_button ); - //} -} - - -/* public functions */ - -GtkWidget * -gimp_spin_scale_new (GtkAdjustment *adjustment, - const gchar *label, - gint digits) -{ - g_return_val_if_fail (GTK_IS_ADJUSTMENT (adjustment), NULL); - - return g_object_new (GIMP_TYPE_SPIN_SCALE, - "adjustment", adjustment, - "label", label, - "digits", digits, - NULL); -} - -void -gimp_spin_scale_set_label (GimpSpinScale *scale, - const gchar *label) -{ - GimpSpinScalePrivate *private; - - g_return_if_fail (GIMP_IS_SPIN_SCALE (scale)); - - private = GET_PRIVATE (scale); - - if (label == private->label) - return; - - g_free (private->label); - private->label = g_strdup (label); - - if (private->layout) - { - g_object_unref (private->layout); - private->layout = NULL; - } - - gtk_widget_queue_resize (GTK_WIDGET (scale)); - - g_object_notify (G_OBJECT (scale), "label"); -} - -const gchar * -gimp_spin_scale_get_label (GimpSpinScale *scale) -{ - g_return_val_if_fail (GIMP_IS_SPIN_SCALE (scale), NULL); - - return GET_PRIVATE (scale)->label; -} - -void -gimp_spin_scale_set_scale_limits (GimpSpinScale *scale, - gdouble lower, - gdouble upper) -{ - GimpSpinScalePrivate *private; - GtkSpinButton *spin_button; - GtkAdjustment *adjustment; - - g_return_if_fail (GIMP_IS_SPIN_SCALE (scale)); - - private = GET_PRIVATE (scale); - spin_button = GTK_SPIN_BUTTON (scale); - adjustment = gtk_spin_button_get_adjustment (spin_button); - - g_return_if_fail (lower >= gtk_adjustment_get_lower (adjustment)); - g_return_if_fail (upper <= gtk_adjustment_get_upper (adjustment)); - - private->scale_limits_set = TRUE; - private->scale_lower = lower; - private->scale_upper = upper; - private->gamma = 1.0; - - gimp_spin_scale_value_changed (spin_button); -} - -void -gimp_spin_scale_unset_scale_limits (GimpSpinScale *scale) -{ - GimpSpinScalePrivate *private; - - g_return_if_fail (GIMP_IS_SPIN_SCALE (scale)); - - private = GET_PRIVATE (scale); - - private->scale_limits_set = FALSE; - private->scale_lower = 0.0; - private->scale_upper = 0.0; - - gimp_spin_scale_value_changed (GTK_SPIN_BUTTON (scale)); -} - -gboolean -gimp_spin_scale_get_scale_limits (GimpSpinScale *scale, - gdouble *lower, - gdouble *upper) -{ - GimpSpinScalePrivate *private; - - g_return_val_if_fail (GIMP_IS_SPIN_SCALE (scale), FALSE); - - private = GET_PRIVATE (scale); - - if (lower) - *lower = private->scale_lower; - - if (upper) - *upper = private->scale_upper; - - return private->scale_limits_set; -} - -void -gimp_spin_scale_set_gamma (GimpSpinScale *scale, - gdouble gamma) -{ - GimpSpinScalePrivate *private; - - g_return_if_fail (GIMP_IS_SPIN_SCALE (scale)); - - private = GET_PRIVATE (scale); - - private->gamma = gamma; - - gimp_spin_scale_value_changed (GTK_SPIN_BUTTON (scale)); -} - -gdouble -gimp_spin_scale_get_gamma (GimpSpinScale *scale) -{ - g_return_val_if_fail (GIMP_IS_SPIN_SCALE (scale), 1.0); - - return GET_PRIVATE(scale)->gamma; -} diff --git a/src/ui/widget/gimpspinscale.h b/src/ui/widget/gimpspinscale.h deleted file mode 100644 index b42a0faf8..000000000 --- a/src/ui/widget/gimpspinscale.h +++ /dev/null @@ -1,82 +0,0 @@ -/* GIMP - The GNU Image Manipulation Program - * Copyright (C) 1995 Spencer Kimball and Peter Mattis - * - * gimpspinscale.h - * Copyright (C) 2010 Michael Natterer <mitch@gimp.org> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef __GIMP_SPIN_SCALE_H__ -#define __GIMP_SPIN_SCALE_H__ - -#ifndef WITH_GIMP -#include <gtk/gtk.h> -#endif - -G_BEGIN_DECLS - -#define GIMP_TYPE_SPIN_SCALE (gimp_spin_scale_get_type ()) -#define GIMP_SPIN_SCALE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_SPIN_SCALE, GimpSpinScale)) -#define GIMP_SPIN_SCALE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_SPIN_SCALE, GimpSpinScaleClass)) -#define GIMP_IS_SPIN_SCALE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_SPIN_SCALE)) -#define GIMP_IS_SPIN_SCALE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_SPIN_SCALE)) -#define GIMP_SPIN_SCALE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_SPIN_SCALE, GimpSpinScaleClass)) - - -typedef struct _GimpSpinScale GimpSpinScale; -typedef struct _GimpSpinScaleClass GimpSpinScaleClass; - -struct _GimpSpinScale -{ - GtkSpinButton parent_instance; -}; - -struct _GimpSpinScaleClass -{ - GtkSpinButtonClass parent_class; -}; - - -GType gimp_spin_scale_get_type (void) G_GNUC_CONST; - -GtkWidget * gimp_spin_scale_new (GtkAdjustment *adjustment, - const gchar *label, - gint digits); - -void gimp_spin_scale_set_label (GimpSpinScale *scale, - const gchar *label); -const gchar * gimp_spin_scale_get_label (GimpSpinScale *scale); - -void gimp_spin_scale_set_scale_limits (GimpSpinScale *scale, - gdouble lower, - gdouble upper); -void gimp_spin_scale_unset_scale_limits (GimpSpinScale *scale); -gboolean gimp_spin_scale_get_scale_limits (GimpSpinScale *scale, - gdouble *lower, - gdouble *upper); - -void gimp_spin_scale_set_gamma (GimpSpinScale *scale, - gdouble gamma); -gdouble gimp_spin_scale_get_gamma (GimpSpinScale *scale); - -void gimp_spin_scale_set_focuswidget (GtkWidget *scale, - GtkWidget *widget); - -void gimp_spin_scale_set_appearance (GtkWidget *scale, - const gchar *appearance); - -G_END_DECLS - -#endif /* __GIMP_SPIN_SCALE_H__ */ diff --git a/src/ui/widget/highlight-picker.cpp b/src/ui/widget/highlight-picker.cpp index c1068c9b2..561c1332a 100644 --- a/src/ui/widget/highlight-picker.cpp +++ b/src/ui/widget/highlight-picker.cpp @@ -32,8 +32,6 @@ HighlightPicker::~HighlightPicker() { } - -#if WITH_GTKMM_3_0 void HighlightPicker::get_preferred_height_vfunc(Gtk::Widget& widget, int& min_h, int& nat_h) const @@ -63,39 +61,12 @@ void HighlightPicker::get_preferred_width_vfunc(Gtk::Widget& widget, nat_w += (nat_w) >> 1; } } -#else -void HighlightPicker::get_size_vfunc(Gtk::Widget& widget, - const Gdk::Rectangle* cell_area, - int* x_offset, - int* y_offset, - int* width, - int* height ) const -{ - Gtk::CellRendererPixbuf::get_size_vfunc( widget, cell_area, x_offset, y_offset, width, height ); - - if ( width ) { - *width = 10;//+= (*width) >> 1; - } - if ( height ) { - *height = 20; //cell_area ? cell_area->get_height() / 2 : 50; //+= (*height) >> 1; - } -} -#endif -#if WITH_GTKMM_3_0 void HighlightPicker::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 HighlightPicker::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 { GdkRectangle carea; @@ -137,11 +108,7 @@ void HighlightPicker::render_vfunc( const Glib::RefPtr<Gdk::Drawable>& window, convert_pixbuf_argb32_to_normal(pixbuf); property_pixbuf() = Glib::wrap(pixbuf); -#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 } bool HighlightPicker::activate_vfunc(GdkEvent* /*event*/, diff --git a/src/ui/widget/highlight-picker.h b/src/ui/widget/highlight-picker.h index c5fe4c02c..c459b0dcd 100644 --- a/src/ui/widget/highlight-picker.h +++ b/src/ui/widget/highlight-picker.h @@ -29,8 +29,6 @@ public: Glib::PropertyProxy<guint32> property_active() { return _property_active.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, @@ -44,18 +42,6 @@ protected: virtual void get_preferred_height_vfunc(Gtk::Widget& widget, int& min_h, int& nat_h) const; -#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 ); - - virtual void get_size_vfunc( Gtk::Widget &widget, - Gdk::Rectangle const *cell_area, - int *x_offset, int *y_offset, int *width, int *height ) const; -#endif virtual bool activate_vfunc(GdkEvent *event, Gtk::Widget &widget, diff --git a/src/ui/widget/imagetoggler.cpp b/src/ui/widget/imagetoggler.cpp index 29907f4c9..987cc67bb 100644 --- a/src/ui/widget/imagetoggler.cpp +++ b/src/ui/widget/imagetoggler.cpp @@ -53,8 +53,6 @@ ImageToggler::ImageToggler( char const* on, char const* off) : property_pixbuf() = _property_pixbuf_off.get_value(); } - -#if WITH_GTKMM_3_0 void ImageToggler::get_preferred_height_vfunc(Gtk::Widget& widget, int& min_h, int& nat_h) const @@ -84,46 +82,15 @@ void ImageToggler::get_preferred_width_vfunc(Gtk::Widget& widget, nat_w += (nat_w) >> 1; } } -#else -void ImageToggler::get_size_vfunc(Gtk::Widget& widget, - const Gdk::Rectangle* cell_area, - int* x_offset, - int* y_offset, - int* width, - int* height ) const -{ - Gtk::CellRendererPixbuf::get_size_vfunc( widget, cell_area, x_offset, y_offset, width, height ); - - if ( width ) { - *width += (*width) >> 1; - } - if ( height ) { - *height += (*height) >> 1; - } -} -#endif -#if WITH_GTKMM_3_0 void ImageToggler::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 ImageToggler::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 { property_pixbuf() = _property_active.get_value() ? _property_pixbuf_on : _property_pixbuf_off; -#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 } bool diff --git a/src/ui/widget/imagetoggler.h b/src/ui/widget/imagetoggler.h index 7b02fa4dc..d4f27cf11 100644 --- a/src/ui/widget/imagetoggler.h +++ b/src/ui/widget/imagetoggler.h @@ -36,8 +36,6 @@ public: Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixbuf> > property_pixbuf_off(); protected: - -#if WITH_GTKMM_3_0 virtual void render_vfunc( const Cairo::RefPtr<Cairo::Context>& cr, Gtk::Widget& widget, const Gdk::Rectangle& background_area, @@ -51,18 +49,6 @@ protected: virtual void get_preferred_height_vfunc(Gtk::Widget& widget, int& min_h, int& nat_h) const; -#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 ); - - virtual void get_size_vfunc( Gtk::Widget &widget, - Gdk::Rectangle const *cell_area, - int *x_offset, int *y_offset, int *width, int *height ) const; -#endif virtual bool activate_vfunc(GdkEvent *event, Gtk::Widget &widget, diff --git a/src/ui/widget/insertordericon.cpp b/src/ui/widget/insertordericon.cpp index 9aec7d135..7ed1ed2e2 100644 --- a/src/ui/widget/insertordericon.cpp +++ b/src/ui/widget/insertordericon.cpp @@ -52,7 +52,6 @@ InsertOrderIcon::InsertOrderIcon() : } -#if WITH_GTKMM_3_0 void InsertOrderIcon::get_preferred_height_vfunc(Gtk::Widget& widget, int& min_h, int& nat_h) const @@ -82,39 +81,12 @@ void InsertOrderIcon::get_preferred_width_vfunc(Gtk::Widget& widget, nat_w += (nat_w) >> 1; } } -#else -void InsertOrderIcon::get_size_vfunc(Gtk::Widget& widget, - const Gdk::Rectangle* cell_area, - int* x_offset, - int* y_offset, - int* width, - int* height ) const -{ - Gtk::CellRendererPixbuf::get_size_vfunc( widget, cell_area, x_offset, y_offset, width, height ); - - if ( width ) { - *width = phys;//+= (*width) >> 1; - } - if ( height ) { - *height =phys;//+= (*height) >> 1; - } -} -#endif -#if WITH_GTKMM_3_0 void InsertOrderIcon::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 InsertOrderIcon::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 { switch (_property_active.get_value()) { @@ -128,11 +100,7 @@ void InsertOrderIcon::render_vfunc( const Glib::RefPtr<Gdk::Drawable>& window, property_pixbuf() = Glib::RefPtr<Gdk::Pixbuf>(0); break; } -#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 } bool InsertOrderIcon::activate_vfunc(GdkEvent* /*event*/, diff --git a/src/ui/widget/insertordericon.h b/src/ui/widget/insertordericon.h index bf8ac4fa7..43188fa5b 100644 --- a/src/ui/widget/insertordericon.h +++ b/src/ui/widget/insertordericon.h @@ -33,7 +33,6 @@ public: protected: -#if WITH_GTKMM_3_0 virtual void render_vfunc( const Cairo::RefPtr<Cairo::Context>& cr, Gtk::Widget& widget, const Gdk::Rectangle& background_area, @@ -47,18 +46,6 @@ protected: virtual void get_preferred_height_vfunc(Gtk::Widget& widget, int& min_h, int& nat_h) const; -#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 ); - - virtual void get_size_vfunc( Gtk::Widget &widget, - Gdk::Rectangle const *cell_area, - int *x_offset, int *y_offset, int *width, int *height ) const; -#endif virtual bool activate_vfunc(GdkEvent *event, Gtk::Widget &widget, diff --git a/src/ui/widget/layertypeicon.cpp b/src/ui/widget/layertypeicon.cpp index e281d982a..df85f271a 100644 --- a/src/ui/widget/layertypeicon.cpp +++ b/src/ui/widget/layertypeicon.cpp @@ -63,8 +63,6 @@ LayerTypeIcon::LayerTypeIcon() : property_pixbuf() = _property_pixbuf_path.get_value(); } - -#if WITH_GTKMM_3_0 void LayerTypeIcon::get_preferred_height_vfunc(Gtk::Widget& widget, int& min_h, int& nat_h) const @@ -94,46 +92,15 @@ void LayerTypeIcon::get_preferred_width_vfunc(Gtk::Widget& widget, nat_w += (nat_w) >> 1; } } -#else -void LayerTypeIcon::get_size_vfunc(Gtk::Widget& widget, - const Gdk::Rectangle* cell_area, - int* x_offset, - int* y_offset, - int* width, - int* height ) const -{ - Gtk::CellRendererPixbuf::get_size_vfunc( widget, cell_area, x_offset, y_offset, width, height ); - - if ( width ) { - *width += (*width) >> 1; - } - if ( height ) { - *height += (*height) >> 1; - } -} -#endif -#if WITH_GTKMM_3_0 void LayerTypeIcon::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 LayerTypeIcon::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 { property_pixbuf() = _property_active.get_value() == 1 ? _property_pixbuf_group : (_property_active.get_value() == 2 ? _property_pixbuf_layer : _property_pixbuf_path); -#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 } bool diff --git a/src/ui/widget/layertypeicon.h b/src/ui/widget/layertypeicon.h index 6c71ce361..f12029c12 100644 --- a/src/ui/widget/layertypeicon.h +++ b/src/ui/widget/layertypeicon.h @@ -35,8 +35,6 @@ public: Glib::PropertyProxy< Glib::RefPtr<Gdk::Pixbuf> > property_pixbuf_off(); protected: - -#if WITH_GTKMM_3_0 virtual void render_vfunc( const Cairo::RefPtr<Cairo::Context>& cr, Gtk::Widget& widget, const Gdk::Rectangle& background_area, @@ -50,18 +48,6 @@ protected: virtual void get_preferred_height_vfunc(Gtk::Widget& widget, int& min_h, int& nat_h) const; -#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 ); - - virtual void get_size_vfunc( Gtk::Widget &widget, - Gdk::Rectangle const *cell_area, - int *x_offset, int *y_offset, int *width, int *height ) const; -#endif virtual bool activate_vfunc(GdkEvent *event, Gtk::Widget &widget, diff --git a/src/ui/widget/licensor.cpp b/src/ui/widget/licensor.cpp index 09f3fac8d..1e9ee361d 100644 --- a/src/ui/widget/licensor.cpp +++ b/src/ui/widget/licensor.cpp @@ -134,18 +134,10 @@ void Licensor::update (SPDocument *doc) for (i=0; rdf_licenses[i].name; i++) if (license == &rdf_licenses[i]) break; -#if WITH_GTKMM_3_0 static_cast<LicenseItem*>(get_children()[i+1])->set_active(); -#else - static_cast<LicenseItem*>(children()[i+1].get_widget())->set_active(); -#endif } else { -#if WITH_GTKMM_3_0 static_cast<LicenseItem*>(get_children()[0])->set_active(); -#else - static_cast<LicenseItem*>(children()[0].get_widget())->set_active(); -#endif } /* update the URI */ diff --git a/src/ui/widget/notebook-page.cpp b/src/ui/widget/notebook-page.cpp index 2f03ed23b..6d8ff1d75 100644 --- a/src/ui/widget/notebook-page.cpp +++ b/src/ui/widget/notebook-page.cpp @@ -11,31 +11,19 @@ #include "notebook-page.h" -#if WITH_GTKMM_3_0 # include <gtkmm/grid.h> -#else -# include <gtkmm/table.h> -#endif namespace Inkscape { namespace UI { namespace Widget { NotebookPage::NotebookPage(int n_rows, int n_columns, bool expand, bool fill, guint padding) -#if WITH_GTKMM_3_0 :_table(Gtk::manage(new Gtk::Grid())) -#else - :_table(Gtk::manage(new Gtk::Table(n_rows, n_columns))) -#endif { set_border_width(2); -#if WITH_GTKMM_3_0 _table->set_row_spacing(2); _table->set_column_spacing(2); -#else - _table->set_spacings(2); -#endif pack_start(*_table, expand, fill, padding); } diff --git a/src/ui/widget/notebook-page.h b/src/ui/widget/notebook-page.h index c11de1b5b..6eb23907c 100644 --- a/src/ui/widget/notebook-page.h +++ b/src/ui/widget/notebook-page.h @@ -17,11 +17,7 @@ #include <gtkmm/box.h> namespace Gtk { -#if WITH_GTKMM_3_0 class Grid; -#else -class Table; -#endif } namespace Inkscape { @@ -42,19 +38,10 @@ public: */ NotebookPage(int n_rows, int n_columns, bool expand=false, bool fill=false, guint padding=0); -#if WITH_GTKMM_3_0 Gtk::Grid& table() { return *_table; } -#else - Gtk::Table& table() { return *_table; } -#endif protected: - -#if WITH_GTKMM_3_0 Gtk::Grid *_table; -#else - Gtk::Table *_table; -#endif }; } // namespace Widget diff --git a/src/ui/widget/page-sizer.cpp b/src/ui/widget/page-sizer.cpp index 4a1fe9ac6..578b6855a 100644 --- a/src/ui/widget/page-sizer.cpp +++ b/src/ui/widget/page-sizer.cpp @@ -336,7 +336,6 @@ PageSizer::PageSizer(Registry & _wr) _customDimTable.set_border_width(4); -#if WITH_GTKMM_3_0 _customDimTable.set_row_spacing(4); _customDimTable.set_column_spacing(4); @@ -355,15 +354,6 @@ PageSizer::PageSizer(Registry & _wr) _fitPageMarginExpander.set_hexpand(); _fitPageMarginExpander.set_vexpand(); _customDimTable.attach(_fitPageMarginExpander, 0, 2, 2, 1); -#else - _customDimTable.resize(3, 2); - _customDimTable.set_row_spacings(4); - _customDimTable.set_col_spacings(4); - _customDimTable.attach(_dimensionWidth, 0,1, 0,1); - _customDimTable.attach(_dimensionUnits, 1,2, 0,1); - _customDimTable.attach(_dimensionHeight, 0,1, 1,2); - _customDimTable.attach(_fitPageMarginExpander, 0,2, 2,3); -#endif _dimTabOrderGList = NULL; _dimTabOrderGList = g_list_append(_dimTabOrderGList, _dimensionWidth.gobj()); @@ -381,7 +371,6 @@ PageSizer::PageSizer(Registry & _wr) //## Set up margin settings _marginTable.set_border_width(4); -#if WITH_GTKMM_3_0 _marginTable.set_row_spacing(4); _marginTable.set_column_spacing(4); @@ -404,16 +393,6 @@ PageSizer::PageSizer(Registry & _wr) _fitPageButtonAlign.set_hexpand(); _fitPageButtonAlign.set_vexpand(); _marginTable.attach(_fitPageButtonAlign, 0, 3, 2, 1); -#else - _marginTable.set_border_width(4); - _marginTable.set_row_spacings(4); - _marginTable.set_col_spacings(4); - _marginTable.attach(_marginTopAlign, 0,2, 0,1); - _marginTable.attach(_marginLeftAlign, 0,1, 1,2); - _marginTable.attach(_marginRightAlign, 1,2, 1,2); - _marginTable.attach(_marginBottomAlign, 0,2, 2,3); - _marginTable.attach(_fitPageButtonAlign, 0,2, 3,4); -#endif _marginTopAlign.set(0.5, 0.5, 0.0, 1.0); _marginTopAlign.add(_marginTop); @@ -436,7 +415,6 @@ PageSizer::PageSizer(Registry & _wr) _scaleTable.set_border_width(4); -#if WITH_GTKMM_3_0 _scaleTable.set_row_spacing(4); _scaleTable.set_column_spacing(4); @@ -448,16 +426,6 @@ PageSizer::PageSizer(Registry & _wr) _viewboxExpander.set_hexpand(); _viewboxExpander.set_vexpand(); _scaleTable.attach(_viewboxExpander, 0, 2, 2, 1); -#else - _scaleTable.resize(3, 2); - _scaleTable.set_row_spacings(4); - _scaleTable.set_col_spacings(4); - _scaleTable.attach(_scaleX, 0,1, 0,1); - _scaleTable.attach(_scaleY, 1,2, 0,1); - _scaleTable.attach(_scaleLabel, 2,3, 0,1); - _scaleTable.attach(_scaleWarning, 0,3, 1,2, Gtk::FILL); - _scaleTable.attach(_viewboxExpander, 0,3, 2,3); -#endif _scaleWarning.set_label(_("While SVG allows non-uniform scaling it is recommended to use only uniform scaling in Inkscape. To set a non-uniform scaling, set the 'viewBox' directly.")); _scaleWarning.set_line_wrap( true ); @@ -466,7 +434,6 @@ PageSizer::PageSizer(Registry & _wr) _viewboxExpander.set_label(_("_Viewbox...")); _viewboxExpander.add(_viewboxTable); -#if WITH_GTKMM_3_0 _viewboxTable.set_row_spacing(2); _viewboxTable.set_column_spacing(2); @@ -486,16 +453,6 @@ PageSizer::PageSizer(Registry & _wr) _viewboxH.set_vexpand(); _viewboxTable.attach(_viewboxH, 1, 1, 1, 1); -#else - _viewboxTable.set_border_width(4); - _viewboxTable.set_row_spacings(2); - _viewboxTable.set_col_spacings(2); - _viewboxTable.attach(_viewboxX, 0,1, 0,1); - _viewboxTable.attach(_viewboxY, 1,2, 0,1); - _viewboxTable.attach(_viewboxW, 0,1, 1,2); - _viewboxTable.attach(_viewboxH, 1,2, 1,2); -#endif - _wr.setUpdating (true); updateScaleUI(); _wr.setUpdating (false); diff --git a/src/ui/widget/page-sizer.h b/src/ui/widget/page-sizer.h index 0eea28e61..f1966f848 100644 --- a/src/ui/widget/page-sizer.h +++ b/src/ui/widget/page-sizer.h @@ -23,15 +23,9 @@ #include <gtkmm/alignment.h> #include <gtkmm/expander.h> #include <gtkmm/frame.h> +#include <gtkmm/grid.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/radiobutton.h> namespace Inkscape { @@ -222,12 +216,7 @@ protected: //### Custom size frame Gtk::Frame _customFrame; - -#if WITH_GTKMM_3_0 Gtk::Grid _customDimTable; -#else - Gtk::Table _customDimTable; -#endif RegisteredUnitMenu _dimensionUnits; RegisteredScalarUnit _dimensionWidth; @@ -237,12 +226,7 @@ protected: //### Fit Page options Gtk::Expander _fitPageMarginExpander; -#if WITH_GTKMM_3_0 Gtk::Grid _marginTable; -#else - Gtk::Table _marginTable; -#endif - Gtk::Alignment _marginTopAlign; Gtk::Alignment _marginLeftAlign; Gtk::Alignment _marginRightAlign; @@ -257,11 +241,7 @@ protected: // Document scale Gtk::Frame _scaleFrame; -#if WITH_GTKMM_3_0 Gtk::Grid _scaleTable; -#else - Gtk::Table _scaleTable; -#endif Gtk::Label _scaleLabel; Gtk::Label _scaleWarning; @@ -271,11 +251,7 @@ protected: // Viewbox Gtk::Expander _viewboxExpander; -#if WITH_GTKMM_3_0 Gtk::Grid _viewboxTable; -#else - Gtk::Table _viewboxTable; -#endif RegisteredScalar _viewboxX; RegisteredScalar _viewboxY; diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index 98d9d41f3..6e6e6c527 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -72,9 +72,7 @@ Panel::Panel(Glib::ustring const &label, gchar const *prefs_path, _fillable(0) { set_name( "InkscapePanel" ); -#if WITH_GTKMM_3_0 set_orientation( Gtk::ORIENTATION_VERTICAL ); -#endif _init(); } @@ -596,13 +594,9 @@ void Panel::_addResponseButton(Gtk::Button *button, int response_id, bool pack_s { // Create a button box for the response buttons if it's the first button to be added if (!_action_area) { -#if WITH_GTKMM_3_0 _action_area = new Gtk::ButtonBox(); _action_area->set_layout(Gtk::BUTTONBOX_END); _action_area->set_spacing(6); -#else - _action_area = new Gtk::HButtonBox(Gtk::BUTTONBOX_END, 6); -#endif _action_area->set_border_width(4); pack_end(*_action_area, Gtk::PACK_SHRINK, 0); } diff --git a/src/ui/widget/panel.h b/src/ui/widget/panel.h index 7b2836fe8..370779586 100644 --- a/src/ui/widget/panel.h +++ b/src/ui/widget/panel.h @@ -31,13 +31,7 @@ class SPDocument; namespace Gtk { class CheckMenuItem; - -#if WITH_GTKMM_3_0 class ButtonBox; -#else - class HButtonBox; -#endif - class MenuItem; } @@ -64,12 +58,7 @@ namespace Widget { * @see UI::Dialog::DesktopTracker to handle desktop change, selection change and selected object modifications. * @see UI::Dialog::DialogManager manages the dialogs within inkscape. */ -#if WITH_GTKMM_3_0 class Panel : public Gtk::Box { -#else -class Panel : public Gtk::VBox { -#endif - public: static void prep(); @@ -172,12 +161,7 @@ private: Gtk::EventBox _menu_popper; Gtk::Button _close_button; Gtk::Menu *_menu; - -#if WITH_GTKMM_3_0 - Gtk::ButtonBox *_action_area; //< stores response buttons -#else - Gtk::HButtonBox *_action_area; //< stores response buttons -#endif + Gtk::ButtonBox *_action_area; //< stores response buttons std::vector<Gtk::Widget *> _non_horizontal; std::vector<Gtk::Widget *> _non_vertical; diff --git a/src/ui/widget/point.cpp b/src/ui/widget/point.cpp index 2c2eb5e8a..6b31b1856 100644 --- a/src/ui/widget/point.cpp +++ b/src/ui/widget/point.cpp @@ -50,11 +50,7 @@ Point::Point(Glib::ustring const &label, Glib::ustring const &tooltip, } Point::Point(Glib::ustring const &label, Glib::ustring const &tooltip, -#if WITH_GTKMM_3_0 Glib::RefPtr<Gtk::Adjustment> &adjust, -#else - Gtk::Adjustment &adjust, -#endif unsigned digits, Glib::ustring const &suffix, Glib::ustring const &icon, diff --git a/src/ui/widget/point.h b/src/ui/widget/point.h index 17078df8f..71bfd8473 100644 --- a/src/ui/widget/point.h +++ b/src/ui/widget/point.h @@ -82,11 +82,7 @@ public: */ Point( Glib::ustring const &label, Glib::ustring const &tooltip, -#if WITH_GTKMM_3_0 Glib::RefPtr<Gtk::Adjustment> &adjust, -#else - Gtk::Adjustment &adjust, -#endif unsigned digits = 0, Glib::ustring const &suffix = "", Glib::ustring const &icon = "", diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index e0eba3934..1205cd012 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -51,14 +51,9 @@ DialogPage::DialogPage() { set_border_width(12); -#if WITH_GTKMM_3_0 set_orientation(Gtk::ORIENTATION_VERTICAL); set_column_spacing(12); set_row_spacing(6); -#else - set_col_spacings(12); - set_row_spacings(6); -#endif } /** @@ -97,12 +92,7 @@ void DialogPage::add_line(bool indent, // be indented if desired Gtk::Alignment* w_alignment = Gtk::manage(new Gtk::Alignment()); w_alignment->add(*hb); - -#if WITH_GTKMM_3_0 w_alignment->set_valign(Gtk::ALIGN_CENTER); -#else - guint row = property_n_rows(); -#endif // Add a label in the first column if provided if (label != "") @@ -118,17 +108,12 @@ void DialogPage::add_line(bool indent, if (indent) label_alignment->set_padding(0, 0, 12, 0); -#if WITH_GTKMM_3_0 label_alignment->set_valign(Gtk::ALIGN_CENTER); add(*label_alignment); attach_next_to(*w_alignment, *label_alignment, Gtk::POS_RIGHT, 1, 1); -#else - attach(*label_alignment, 0, 1, row, row + 1, Gtk::FILL, Gtk::AttachOptions(), 0, 0); -#endif } // Now add the widget to the bottom of the dialog -#if WITH_GTKMM_3_0 if (label == "") { if (indent) @@ -141,17 +126,6 @@ void DialogPage::add_line(bool indent, g_value_set_int(&width, 2); gtk_container_child_set_property(GTK_CONTAINER(gobj()), GTK_WIDGET(w_alignment->gobj()), "width", &width); } -#else - // The widget should span two columns if there is no label - int w_col_span = 1; - if (label == "") - w_col_span = 2; - - attach(*w_alignment, 2 - w_col_span, 2, row, row + 1, - Gtk::FILL | Gtk::EXPAND, - Gtk::AttachOptions(), - 0, 0); -#endif // Add a label on the right of the widget if desired if (suffix != "") @@ -170,18 +144,8 @@ void DialogPage::add_group_header(Glib::ustring name) Glib::ustring("</b>"/*</span>"*/) , Gtk::ALIGN_START , Gtk::ALIGN_CENTER, true)); label_widget->set_use_markup(true); - -#if WITH_GTKMM_3_0 label_widget->set_valign(Gtk::ALIGN_CENTER); add(*label_widget); -// if (row != 1) - // set_row_spacing(row - 1, 18); -#else - int row = property_n_rows(); - attach(*label_widget , 0, 4, row, row + 1, Gtk::FILL, Gtk::AttachOptions(), 0, 0); - if (row != 1) - set_row_spacing(row - 1, 18); -#endif } } @@ -423,24 +387,6 @@ ZoomCorrRuler::draw_marks(Cairo::RefPtr<Cairo::Context> cr, double dist, int maj } } -#if !WITH_GTKMM_3_0 -bool -ZoomCorrRuler::on_expose_event(GdkEventExpose *event) { - bool result = false; - - if(get_is_drawable()) - { - Cairo::RefPtr<Cairo::Context> cr = get_window()->create_cairo_context(); - cr->rectangle(event->area.x, event->area.y, - event->area.width, event->area.height); - cr->clip(); - result = on_draw(cr); - } - - return result; -} -#endif - bool ZoomCorrRuler::on_draw(const Cairo::RefPtr<Cairo::Context>& cr) { Glib::RefPtr<Gdk::Window> window = get_window(); @@ -544,11 +490,7 @@ ZoomCorrRulerSlider::init(int ruler_width, int ruler_height, double lower, doubl _ruler.set_size(ruler_width, ruler_height); -#if WITH_GTKMM_3_0 _slider = Gtk::manage(new Gtk::Scale(Gtk::ORIENTATION_HORIZONTAL)); -#else - _slider = Gtk::manage(new Gtk::HScale()); -#endif _slider->set_size_request(_ruler.width(), -1); _slider->set_range (lower, upper); @@ -575,21 +517,13 @@ ZoomCorrRulerSlider::init(int ruler_width, int ruler_height, double lower, doubl alignment1->add(_sb); alignment2->add(_unit); -#if WITH_GTKMM_3_0 - Gtk::Grid *table = Gtk::manage(new Gtk::Grid()); + auto table = Gtk::manage(new Gtk::Grid()); table->attach(*_slider, 0, 0, 1, 1); alignment1->set_halign(Gtk::ALIGN_CENTER); table->attach(*alignment1, 1, 0, 1, 1); table->attach(_ruler, 0, 1, 1, 1); alignment2->set_halign(Gtk::ALIGN_CENTER); table->attach(*alignment2, 1, 1, 1, 1); -#else - Gtk::Table *table = Gtk::manage(new Gtk::Table()); - table->attach(*_slider, 0, 1, 0, 1); - table->attach(*alignment1, 1, 2, 0, 1, static_cast<Gtk::AttachOptions>(0)); - table->attach(_ruler, 0, 1, 1, 2); - table->attach(*alignment2, 1, 2, 1, 2, static_cast<Gtk::AttachOptions>(0)); -#endif pack_start(*table, Gtk::PACK_SHRINK); } @@ -636,11 +570,7 @@ PrefSlider::init(Glib::ustring const &prefs_path, freeze = false; -#if WITH_GTKMM_3_0 _slider = Gtk::manage(new Gtk::Scale(Gtk::ORIENTATION_HORIZONTAL)); -#else - _slider = Gtk::manage(new Gtk::HScale()); -#endif _slider->set_range (lower, upper); _slider->set_increments (step_increment, page_increment); @@ -657,17 +587,11 @@ PrefSlider::init(Glib::ustring const &prefs_path, Gtk::Alignment *alignment1 = Gtk::manage(new Gtk::Alignment(0.5,1,0,0)); alignment1->add(_sb); -#if WITH_GTKMM_3_0 - Gtk::Grid *table = Gtk::manage(new Gtk::Grid()); + auto table = Gtk::manage(new Gtk::Grid()); _slider->set_hexpand(); table->attach(*_slider, 0, 0, 1, 1); alignment1->set_halign(Gtk::ALIGN_CENTER); table->attach(*alignment1, 1, 0, 1, 1); -#else - Gtk::Table *table = Gtk::manage(new Gtk::Table()); - table->attach(*_slider, 0, 1, 0, 1); - table->attach(*alignment1, 1, 2, 0, 1, static_cast<Gtk::AttachOptions>(0)); -#endif this->pack_start(*table, Gtk::PACK_EXPAND_WIDGET); } diff --git a/src/ui/widget/preferences-widget.h b/src/ui/widget/preferences-widget.h index 1d2d77699..142793509 100644 --- a/src/ui/widget/preferences-widget.h +++ b/src/ui/widget/preferences-widget.h @@ -30,12 +30,7 @@ #include <gtkmm/radiobutton.h> #include <gtkmm/comboboxtext.h> #include <gtkmm/drawingarea.h> - -#if WITH_GTKMM_3_0 #include <gtkmm/grid.h> -#else -#include <gtkmm/table.h> -#endif #include "ui/widget/color-picker.h" #include "ui/widget/unit-menu.h" @@ -43,11 +38,7 @@ #include "ui/widget/scalar-unit.h" namespace Gtk { -#if WITH_GTKMM_3_0 class Scale; -#else -class HScale; -#endif } namespace Inkscape { @@ -126,10 +117,6 @@ public: static const double textpadding; private: -#if !WITH_GTKMM_3_0 - bool on_expose_event(GdkEventExpose *event); -#endif - bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr); void draw_marks(Cairo::RefPtr<Cairo::Context> cr, double dist, int major_interval); @@ -155,11 +142,7 @@ private: Inkscape::UI::Widget::SpinButton _sb; UnitMenu _unit; -#if WITH_GTKMM_3_0 Gtk::Scale* _slider; -#else - Gtk::HScale* _slider; -#endif ZoomCorrRuler _ruler; bool freeze; // used to block recursive updates of slider and spinbutton }; @@ -178,11 +161,7 @@ private: Glib::ustring _prefs_path; Inkscape::UI::Widget::SpinButton _sb; -#if WITH_GTKMM_3_0 Gtk::Scale* _slider; -#else - Gtk::HScale* _slider; -#endif bool freeze; // used to block recursive updates of slider and spinbutton }; @@ -279,11 +258,7 @@ protected: void on_changed(); }; -#if WITH_GTKMM_3_0 class DialogPage : public Gtk::Grid -#else -class DialogPage : public Gtk::Table -#endif { public: DialogPage(); diff --git a/src/ui/widget/random.cpp b/src/ui/widget/random.cpp index b6ea16b89..ba3b025ba 100644 --- a/src/ui/widget/random.cpp +++ b/src/ui/widget/random.cpp @@ -47,11 +47,7 @@ Random::Random(Glib::ustring const &label, Glib::ustring const &tooltip, } Random::Random(Glib::ustring const &label, Glib::ustring const &tooltip, -#if WITH_GTKMM_3_0 Glib::RefPtr<Gtk::Adjustment> &adjust, -#else - Gtk::Adjustment &adjust, -#endif unsigned digits, Glib::ustring const &suffix, Glib::ustring const &icon, diff --git a/src/ui/widget/random.h b/src/ui/widget/random.h index dc2b457c2..d86ab6246 100644 --- a/src/ui/widget/random.h +++ b/src/ui/widget/random.h @@ -75,11 +75,7 @@ public: */ Random(Glib::ustring const &label, Glib::ustring const &tooltip, -#if WITH_GTKMM_3_0 Glib::RefPtr<Gtk::Adjustment> &adjust, -#else - Gtk::Adjustment &adjust, -#endif unsigned digits = 0, Glib::ustring const &suffix = "", Glib::ustring const &icon = "", diff --git a/src/ui/widget/scalar.cpp b/src/ui/widget/scalar.cpp index fca8a7974..434c2c0bb 100644 --- a/src/ui/widget/scalar.cpp +++ b/src/ui/widget/scalar.cpp @@ -43,11 +43,7 @@ Scalar::Scalar(Glib::ustring const &label, Glib::ustring const &tooltip, } Scalar::Scalar(Glib::ustring const &label, Glib::ustring const &tooltip, -#if WITH_GTKMM_3_0 Glib::RefPtr<Gtk::Adjustment> &adjust, -#else - Gtk::Adjustment &adjust, -#endif unsigned digits, Glib::ustring const &suffix, Glib::ustring const &icon, @@ -141,11 +137,7 @@ void Scalar::update() void Scalar::addSlider() { -#if WITH_GTKMM_3_0 - Gtk::Scale *scale = new Gtk::Scale(static_cast<SpinButton*>(_widget)->get_adjustment()); -#else - Gtk::HScale *scale = new Gtk::HScale( * static_cast<SpinButton*>(_widget)->get_adjustment() ); -#endif + auto scale = new Gtk::Scale(static_cast<SpinButton*>(_widget)->get_adjustment()); scale->set_draw_value(false); add (*manage (scale)); } diff --git a/src/ui/widget/scalar.h b/src/ui/widget/scalar.h index 86d7aee28..847790b96 100644 --- a/src/ui/widget/scalar.h +++ b/src/ui/widget/scalar.h @@ -73,11 +73,7 @@ public: */ Scalar(Glib::ustring const &label, Glib::ustring const &tooltip, -#if WITH_GTKMM_3_0 Glib::RefPtr<Gtk::Adjustment> &adjust, -#else - Gtk::Adjustment &adjust, -#endif unsigned digits = 0, Glib::ustring const &suffix = "", Glib::ustring const &icon = "", diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp index 7bbfa08db..fd83a62c9 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -118,11 +118,7 @@ SelectedStyle::SelectedStyle(bool /*layout*/) current_stroke_width(0), _desktop (NULL), -#if WITH_GTKMM_3_0 _table(), -#else - _table(2, 6), -#endif _fill_label (_("Fill:")), _stroke_label (_("Stroke:")), _opacity_label (_("O:")), @@ -134,11 +130,7 @@ SelectedStyle::SelectedStyle(bool /*layout*/) _stroke_flag_place (), _opacity_place (), -#if WITH_GTKMM_3_0 _opacity_adjustment(Gtk::Adjustment::create(100, 0.0, 100, 1.0, 10.0)), -#else - _opacity_adjustment (100, 0.0, 100, 1.0, 10.0), -#endif _opacity_sb (0.02, 0), _stroke (), @@ -161,13 +153,8 @@ SelectedStyle::SelectedStyle(bool /*layout*/) _opacity_label.set_alignment(0.0, 0.5); _opacity_label.set_padding(0, 0); -#if WITH_GTKMM_3_0 _table.set_column_spacing(2); _table.set_row_spacing(0); -#else - _table.set_col_spacings (2); - _table.set_row_spacings (0); -#endif for (int i = SS_FILL; i <= SS_STROKE; i++) { @@ -374,7 +361,6 @@ SelectedStyle::SelectedStyle(bool /*layout*/) _opacity_sb.set_size_request (SELECTED_STYLE_SB_WIDTH, -1); _opacity_sb.set_sensitive (false); -#if WITH_GTKMM_3_0 _table.attach(_fill_label, 0, 0, 1, 1); _table.attach(_stroke_label, 0, 1, 1, 1); @@ -383,26 +369,11 @@ SelectedStyle::SelectedStyle(bool /*layout*/) _table.attach(_fill_place, 2, 0, 1, 1); _table.attach(_stroke, 2, 1, 1, 1); -#else - _table.attach(_fill_label, 0,1, 0,1, Gtk::FILL, Gtk::SHRINK); - _table.attach(_stroke_label, 0,1, 1,2, Gtk::FILL, Gtk::SHRINK); - - _table.attach(_fill_flag_place, 1,2, 0,1, Gtk::SHRINK, Gtk::SHRINK); - _table.attach(_stroke_flag_place, 1,2, 1,2, Gtk::SHRINK, Gtk::SHRINK); - - _table.attach(_fill_place, 2,3, 0,1); - _table.attach(_stroke, 2,3, 1,2); -#endif _opacity_place.add(_opacity_label); -#if WITH_GTKMM_3_0 _table.attach(_opacity_place, 4, 0, 1, 2); _table.attach(_opacity_sb, 5, 0, 1, 2); -#else - _table.attach(_opacity_place, 4,5, 0,2, Gtk::SHRINK, Gtk::SHRINK); - _table.attach(_opacity_sb, 5,6, 0,2, Gtk::SHRINK, Gtk::SHRINK); -#endif pack_start(_table, true, true, 2); @@ -1115,11 +1086,7 @@ SelectedStyle::update() if (_opacity_blocked) break; _opacity_blocked = true; _opacity_sb.set_sensitive(true); -#if WITH_GTKMM_3_0 _opacity_adjustment->set_value(SP_SCALE24_TO_FLOAT(query.opacity.value) * 100); -#else - _opacity_adjustment.set_value(SP_SCALE24_TO_FLOAT(query.opacity.value) * 100); -#endif _opacity_blocked = false; break; } @@ -1219,11 +1186,7 @@ void SelectedStyle::on_opacity_changed () _opacity_blocked = true; SPCSSAttr *css = sp_repr_css_attr_new (); Inkscape::CSSOStringStream os; -#if WITH_GTKMM_3_0 os << CLAMP ((_opacity_adjustment->get_value() / 100), 0.0, 1.0); -#else - os << CLAMP ((_opacity_adjustment.get_value() / 100), 0.0, 1.0); -#endif sp_repr_css_set_property (css, "opacity", os.str().c_str()); // FIXME: workaround for GTK breakage: display interruptibility sometimes results in GTK // sending multiple value-changed events. As if when Inkscape interrupts redraw for main loop @@ -1352,11 +1315,7 @@ RotateableSwatch::do_motion(double by, guint modifier) { g_object_unref(pixbuf); gdk_window_set_cursor(gtk_widget_get_window(w), cr); -#if GTK_CHECK_VERSION(3,0,0) g_object_unref(cr); -#else - gdk_cursor_unref(cr); -#endif cr = NULL; cr_set = true; } @@ -1420,11 +1379,7 @@ RotateableSwatch::do_release(double by, guint modifier) { GtkWidget *w = GTK_WIDGET(gobj()); gdk_window_set_cursor(gtk_widget_get_window(w), NULL); if (cr) { -#if GTK_CHECK_VERSION(3,0,0) g_object_unref(cr); -#else - gdk_cursor_unref (cr); -#endif cr = NULL; } cr_set = false; diff --git a/src/ui/widget/selected-style.h b/src/ui/widget/selected-style.h index 804a6fef6..efac29f73 100644 --- a/src/ui/widget/selected-style.h +++ b/src/ui/widget/selected-style.h @@ -16,12 +16,7 @@ #endif #include <gtkmm/box.h> - -#if WITH_GTKMM_3_0 -# include <gtkmm/grid.h> -#else -# include <gtkmm/table.h> -#endif +#include <gtkmm/grid.h> #include <gtkmm/label.h> #include <gtkmm/eventbox.h> @@ -140,11 +135,7 @@ public: protected: SPDesktop *_desktop; -#if WITH_GTKMM_3_0 Gtk::Grid _table; -#else - Gtk::Table _table; -#endif Gtk::Label _fill_label; Gtk::Label _stroke_label; @@ -157,11 +148,7 @@ protected: Gtk::EventBox _stroke_flag_place; Gtk::EventBox _opacity_place; -#if WITH_GTKMM_3_0 Glib::RefPtr<Gtk::Adjustment> _opacity_adjustment; -#else - Gtk::Adjustment _opacity_adjustment; -#endif Inkscape::UI::Widget::SpinButton _opacity_sb; Gtk::Label _na[2]; diff --git a/src/ui/widget/spin-scale.cpp b/src/ui/widget/spin-scale.cpp index d6b34a5b4..f74626d9b 100644 --- a/src/ui/widget/spin-scale.cpp +++ b/src/ui/widget/spin-scale.cpp @@ -11,7 +11,7 @@ #include <glibmm/i18n.h> #include <glibmm/stringutils.h> -#include "ui/widget/gimpspinscale.h" +#include "widgets/gimp/gimpspinscale.h" namespace Inkscape { namespace UI { @@ -21,13 +21,8 @@ SpinScale::SpinScale(const char* label, double value, double lower, double upper double /*climb_rate*/, int digits, const SPAttributeEnum a, const char* tip_text) : AttrWidget(a, value) { -#if WITH_GTKMM_3_0 _adjustment = Gtk::Adjustment::create(value, lower, upper, step_inc); _spinscale = gimp_spin_scale_new (_adjustment->gobj(), label, digits); -#else - _adjustment = new Gtk::Adjustment(value, lower, upper, step_inc); - _spinscale = gimp_spin_scale_new (_adjustment->gobj(), label, digits); -#endif signal_value_changed().connect(signal_attr_changed().make_slot()); @@ -41,12 +36,10 @@ SpinScale::SpinScale(const char* label, double value, double lower, double upper } SpinScale::SpinScale(const char* label, -#if WITH_GTKMM_3_0 - Glib::RefPtr<Gtk::Adjustment> adj, -#else - Gtk::Adjustment *adj, -#endif - int digits, const SPAttributeEnum a, const char* tip_text) + Glib::RefPtr<Gtk::Adjustment> adj, + int digits, + const SPAttributeEnum a, + const char* tip_text) : AttrWidget(a, 0.0), _adjustment(adj) @@ -110,19 +103,12 @@ void SpinScale::set_appearance(const gchar* appearance) gimp_spin_scale_set_appearance(_spinscale, appearance); } -#if WITH_GTKMM_3_0 -const Glib::RefPtr<Gtk::Adjustment> SpinScale::get_adjustment() const -#else -const Gtk::Adjustment *SpinScale::get_adjustment() const -#endif +const decltype(SpinScale::_adjustment) SpinScale::get_adjustment() const { return _adjustment; } -#if WITH_GTKMM_3_0 -Glib::RefPtr<Gtk::Adjustment> SpinScale::get_adjustment() -#else -Gtk::Adjustment *SpinScale::get_adjustment() -#endif + +decltype(SpinScale::_adjustment) SpinScale::get_adjustment() { return _adjustment; } diff --git a/src/ui/widget/spin-scale.h b/src/ui/widget/spin-scale.h index 50e4fc953..d7030bed3 100644 --- a/src/ui/widget/spin-scale.h +++ b/src/ui/widget/spin-scale.h @@ -36,12 +36,8 @@ public: int digits, const SPAttributeEnum a = SP_ATTR_INVALID, const char* tip_text = NULL); SpinScale(const char* label, -#if WITH_GTKMM_3_0 - Glib::RefPtr<Gtk::Adjustment> adj, -#else - Gtk::Adjustment *adj, -#endif - int digits, const SPAttributeEnum a = SP_ATTR_INVALID, const char* tip_text = NULL); + Glib::RefPtr<Gtk::Adjustment> adj, + int digits, const SPAttributeEnum a = SP_ATTR_INVALID, const char* tip_text = NULL); virtual Glib::ustring get_as_attribute() const; virtual void set_from_attribute(SPObject*); @@ -52,23 +48,14 @@ public: void set_value(const double); void set_focuswidget(GtkWidget *widget); void set_appearance(const gchar* appearance); - -#if WITH_GTKMM_3_0 - const Glib::RefPtr<Gtk::Adjustment> get_adjustment() const; - Glib::RefPtr<Gtk::Adjustment> get_adjustment(); -#else - const Gtk::Adjustment *get_adjustment() const; - Gtk::Adjustment *get_adjustment(); -#endif private: -#if WITH_GTKMM_3_0 Glib::RefPtr<Gtk::Adjustment> _adjustment; -#else - Gtk::Adjustment *_adjustment; -#endif - GtkWidget *_spinscale; + +public: + const decltype(_adjustment) get_adjustment() const; + decltype(_adjustment) get_adjustment(); }; diff --git a/src/ui/widget/spin-slider.cpp b/src/ui/widget/spin-slider.cpp index 9b361ae78..f17b9b26c 100644 --- a/src/ui/widget/spin-slider.cpp +++ b/src/ui/widget/spin-slider.cpp @@ -20,11 +20,7 @@ namespace Widget { SpinSlider::SpinSlider(double value, double lower, double upper, double step_inc, double climb_rate, int digits, const SPAttributeEnum a, const char* tip_text) : AttrWidget(a, value), -#if WITH_GTKMM_3_0 _adjustment(Gtk::Adjustment::create(value, lower, upper, step_inc)), -#else - _adjustment(value, lower, upper, step_inc), -#endif _scale(_adjustment), _spin(_adjustment, climb_rate, digits) { signal_value_changed().connect(signal_attr_changed().make_slot()); @@ -43,11 +39,7 @@ SpinSlider::SpinSlider(double value, double lower, double upper, double step_inc Glib::ustring SpinSlider::get_as_attribute() const { -#if WITH_GTKMM_3_0 - const double val = _adjustment->get_value(); -#else - const double val = _adjustment.get_value(); -#endif + const auto val = _adjustment->get_value(); if(_spin.get_digits() == 0) return Glib::Ascii::dtostr((int)val); @@ -58,77 +50,43 @@ Glib::ustring SpinSlider::get_as_attribute() const void SpinSlider::set_from_attribute(SPObject* o) { const gchar* val = attribute_value(o); -#if WITH_GTKMM_3_0 if(val) _adjustment->set_value(Glib::Ascii::strtod(val)); else _adjustment->set_value(get_default()->as_double()); -#else - if(val) - _adjustment.set_value(Glib::Ascii::strtod(val)); - else - _adjustment.set_value(get_default()->as_double()); -#endif } Glib::SignalProxy0<void> SpinSlider::signal_value_changed() { -#if WITH_GTKMM_3_0 return _adjustment->signal_value_changed(); -#else - return _adjustment.signal_value_changed(); -#endif } double SpinSlider::get_value() const { -#if WITH_GTKMM_3_0 return _adjustment->get_value(); -#else - return _adjustment.get_value(); -#endif } void SpinSlider::set_value(const double val) { -#if WITH_GTKMM_3_0 _adjustment->set_value(val); -#else - _adjustment.set_value(val); -#endif } -#if WITH_GTKMM_3_0 -const Glib::RefPtr<Gtk::Adjustment> SpinSlider::get_adjustment() const -#else -const Gtk::Adjustment& SpinSlider::get_adjustment() const -#endif +const decltype(SpinSlider::_adjustment) SpinSlider::get_adjustment() const { return _adjustment; } -#if WITH_GTKMM_3_0 -Glib::RefPtr<Gtk::Adjustment> SpinSlider::get_adjustment() -#else -Gtk::Adjustment& SpinSlider::get_adjustment() -#endif + +decltype(SpinSlider::_adjustment) SpinSlider::get_adjustment() { return _adjustment; } -#if WITH_GTKMM_3_0 const Gtk::Scale& SpinSlider::get_scale() const -#else -const Gtk::HScale& SpinSlider::get_scale() const -#endif { return _scale; } -#if WITH_GTKMM_3_0 Gtk::Scale& SpinSlider::get_scale() -#else -Gtk::HScale& SpinSlider::get_scale() -#endif { return _scale; } @@ -157,15 +115,9 @@ DualSpinSlider::DualSpinSlider(double value, double lower, double upper, double { signal_value_changed().connect(signal_attr_changed().make_slot()); -#if WITH_GTKMM_3_0 _s1.get_adjustment()->signal_value_changed().connect(_signal_value_changed.make_slot()); _s2.get_adjustment()->signal_value_changed().connect(_signal_value_changed.make_slot()); _s1.get_adjustment()->signal_value_changed().connect(sigc::mem_fun(*this, &DualSpinSlider::update_linked)); -#else - _s1.get_adjustment().signal_value_changed().connect(_signal_value_changed.make_slot()); - _s2.get_adjustment().signal_value_changed().connect(_signal_value_changed.make_slot()); - _s1.get_adjustment().signal_value_changed().connect(sigc::mem_fun(*this, &DualSpinSlider::update_linked)); -#endif _link.signal_toggled().connect(sigc::mem_fun(*this, &DualSpinSlider::link_toggled)); Gtk::VBox* vb = Gtk::manage(new Gtk::VBox); @@ -202,13 +154,8 @@ void DualSpinSlider::set_from_attribute(SPObject* o) _link.set_active(toks[1] == 0); -#if WITH_GTKMM_3_0 _s1.get_adjustment()->set_value(v1); _s2.get_adjustment()->set_value(v2); -#else - _s1.get_adjustment().set_value(v1); - _s2.get_adjustment().set_value(v2); -#endif g_strfreev(toks); } diff --git a/src/ui/widget/spin-slider.h b/src/ui/widget/spin-slider.h index a5999f14f..5a29c1b67 100644 --- a/src/ui/widget/spin-slider.h +++ b/src/ui/widget/spin-slider.h @@ -42,17 +42,8 @@ public: double get_value() const; void set_value(const double); -#if WITH_GTKMM_3_0 - const Glib::RefPtr<Gtk::Adjustment> get_adjustment() const; - Glib::RefPtr<Gtk::Adjustment> get_adjustment(); const Gtk::Scale& get_scale() const; Gtk::Scale& get_scale(); -#else - const Gtk::Adjustment& get_adjustment() const; - Gtk::Adjustment& get_adjustment(); - const Gtk::HScale& get_scale() const; - Gtk::HScale& get_scale(); -#endif const Inkscape::UI::Widget::SpinButton& get_spin_button() const; Inkscape::UI::Widget::SpinButton& get_spin_button(); @@ -60,14 +51,13 @@ public: // Change the SpinSlider into a SpinButton with AttrWidget support) void remove_scale(); private: -#if WITH_GTKMM_3_0 Glib::RefPtr<Gtk::Adjustment> _adjustment; Gtk::Scale _scale; -#else - Gtk::Adjustment _adjustment; - Gtk::HScale _scale; -#endif Inkscape::UI::Widget::SpinButton _spin; + +public: + const decltype(_adjustment) get_adjustment() const; + decltype(_adjustment) get_adjustment(); }; /** diff --git a/src/ui/widget/spinbutton.h b/src/ui/widget/spinbutton.h index 30ffc7d77..ae571994b 100644 --- a/src/ui/widget/spinbutton.h +++ b/src/ui/widget/spinbutton.h @@ -36,11 +36,7 @@ public: { connect_signals(); }; -#if GTK_CHECK_VERSION(3,0,0) explicit SpinButton(Glib::RefPtr<Gtk::Adjustment>& adjustment, double climb_rate = 0.0, guint digits = 0) -#else - explicit SpinButton(Gtk::Adjustment& adjustment, double climb_rate = 0.0, guint digits = 0) -#endif : Gtk::SpinButton(adjustment, climb_rate, digits), _unit_menu(NULL), _unit_tracker(NULL), diff --git a/src/ui/widget/style-swatch.cpp b/src/ui/widget/style-swatch.cpp index 2952a3f97..f8eac1c78 100644 --- a/src/ui/widget/style-swatch.cpp +++ b/src/ui/widget/style-swatch.cpp @@ -28,11 +28,7 @@ #include "verbs.h" #include <glibmm/i18n.h> -#if WITH_GTKMM_3_0 -# include <gtkmm/grid.h> -#else -# include <gtkmm/table.h> -#endif +#include <gtkmm/grid.h> enum { SS_FILL, @@ -111,11 +107,7 @@ StyleSwatch::StyleSwatch(SPCSSAttr *css, gchar const *main_tip) _css(NULL), _tool_obs(NULL), _style_obs(NULL), -#if WITH_GTKMM_3_0 _table(Gtk::manage(new Gtk::Grid())), -#else - _table(Gtk::manage(new Gtk::Table(2, 6))), -#endif _sw_unit(NULL) { set_name("StyleSwatch"); @@ -133,13 +125,8 @@ StyleSwatch::StyleSwatch(SPCSSAttr *css, gchar const *main_tip) _opacity_value.set_alignment(0.0, 0.5); _opacity_value.set_padding(0, 0); -#if WITH_GTKMM_3_0 _table->set_column_spacing(2); _table->set_row_spacing(0); -#else - _table->set_col_spacings(2); - _table->set_row_spacings(0); -#endif _stroke.pack_start(_place[SS_STROKE]); _stroke_width_place.add(_stroke_width); @@ -147,19 +134,11 @@ StyleSwatch::StyleSwatch(SPCSSAttr *css, gchar const *main_tip) _opacity_place.add(_opacity_value); -#if WITH_GTKMM_3_0 _table->attach(_label[SS_FILL], 0, 0, 1, 1); _table->attach(_label[SS_STROKE], 0, 1, 1, 1); _table->attach(_place[SS_FILL], 1, 0, 1, 1); _table->attach(_stroke, 1, 1, 1, 1); _table->attach(_opacity_place, 2, 0, 1, 2); -#else - _table->attach(_label[SS_FILL], 0,1, 0,1, Gtk::FILL, Gtk::SHRINK); - _table->attach(_label[SS_STROKE], 0,1, 1,2, Gtk::FILL, Gtk::SHRINK); - _table->attach(_place[SS_FILL], 1,2, 0,1); - _table->attach(_stroke, 1,2, 1,2); - _table->attach(_opacity_place, 2,3, 0,2, Gtk::SHRINK, Gtk::SHRINK); -#endif _swatch.add(*_table); pack_start(_swatch, true, true, 0); diff --git a/src/ui/widget/style-swatch.h b/src/ui/widget/style-swatch.h index 0016e0256..81a907d16 100644 --- a/src/ui/widget/style-swatch.h +++ b/src/ui/widget/style-swatch.h @@ -29,11 +29,7 @@ class SPStyle; class SPCSSAttr; namespace Gtk { -#if WITH_GTKMM_3_0 class Grid; -#else -class Table; -#endif } namespace Inkscape { @@ -75,11 +71,7 @@ private: Gtk::EventBox _swatch; -#if WITH_GTKMM_3_0 Gtk::Grid *_table; -#else - Gtk::Table *_table; -#endif Gtk::Label _label[2]; Gtk::EventBox _place[2]; diff --git a/src/ui/widget/tolerance-slider.cpp b/src/ui/widget/tolerance-slider.cpp index e904666cc..dea14585d 100644 --- a/src/ui/widget/tolerance-slider.cpp +++ b/src/ui/widget/tolerance-slider.cpp @@ -76,12 +76,8 @@ void ToleranceSlider::init (const Glib::ustring& label1, const Glib::ustring& la // align the label with the checkbox text above by indenting 22 px. _hbox->pack_start(*theLabel1, Gtk::PACK_EXPAND_WIDGET, 22); -#if WITH_GTKMM_3_0 _hscale = Gtk::manage(new Gtk::Scale(Gtk::ORIENTATION_HORIZONTAL)); _hscale->set_range(1.0, 51.0); -#else - _hscale = Gtk::manage (new Gtk::HScale (1.0, 51, 1.0)); -#endif theLabel1->set_mnemonic_widget (*_hscale); _hscale->set_draw_value (true); @@ -121,11 +117,7 @@ void ToleranceSlider::init (const Glib::ustring& label1, const Glib::ustring& la void ToleranceSlider::setValue (double val) { -#if WITH_GTKMM_3_0 - Glib::RefPtr<Gtk::Adjustment> adj = _hscale->get_adjustment(); -#else - Gtk::Adjustment *adj = _hscale->get_adjustment(); -#endif + auto adj = _hscale->get_adjustment(); adj->set_lower (1.0); adj->set_upper (51.0); diff --git a/src/ui/widget/tolerance-slider.h b/src/ui/widget/tolerance-slider.h index 7ae8e4712..3d2548ebe 100644 --- a/src/ui/widget/tolerance-slider.h +++ b/src/ui/widget/tolerance-slider.h @@ -14,11 +14,7 @@ namespace Gtk { class RadioButton; -#if WITH_GTKMM_3_0 class Scale; -#else -class HScale; -#endif } namespace Inkscape { @@ -60,13 +56,7 @@ protected: void on_toggled(); void update (double val); Gtk::HBox *_hbox; - -#if WITH_GTKMM_3_0 Gtk::Scale *_hscale; -#else - Gtk::HScale *_hscale; -#endif - Gtk::RadioButtonGroup _radio_button_group; Gtk::RadioButton *_button1; Gtk::RadioButton *_button2; |
