diff options
| author | Denis Declara <declara91@gmail.com> | 2012-05-05 13:32:42 +0000 |
|---|---|---|
| committer | Denis Declara <declara91@gmail.com> | 2012-05-05 13:32:42 +0000 |
| commit | aeb9c1bde66de096910757abb17dedb94ad74207 (patch) | |
| tree | c0adf97685b0fa8af1553b14d20601f280492762 /src/ui | |
| parent | Fixed some math, so that the objects now line up correctly (diff) | |
| parent | Adding checks to prevent null pointer dereferences (diff) | |
| download | inkscape-aeb9c1bde66de096910757abb17dedb94ad74207.tar.gz inkscape-aeb9c1bde66de096910757abb17dedb94ad74207.zip | |
Trunk merge
(bzr r11073.1.29)
Diffstat (limited to 'src/ui')
60 files changed, 774 insertions, 446 deletions
diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index b244b7349..22f6b2bab 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -1,6 +1,7 @@ set(ui_SRC clipboard.cpp + control-manager.cpp previewholder.cpp uxmanager.cpp @@ -124,6 +125,7 @@ set(ui_SRC # ------- # Headers clipboard.h + control-manager.h icon-names.h previewable.h previewfillable.h diff --git a/src/ui/Makefile_insert b/src/ui/Makefile_insert index 19ecef0fc..59b290dc4 100644 --- a/src/ui/Makefile_insert +++ b/src/ui/Makefile_insert @@ -3,6 +3,8 @@ ink_common_sources += \ ui/clipboard.cpp \ ui/clipboard.h \ + ui/control-manager.cpp \ + ui/control-manager.h \ ui/icon-names.h \ ui/previewable.h \ ui/previewfillable.h \ diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index b972997e2..8f0652a78 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -698,20 +698,25 @@ void ClipboardManagerImpl::_copyUsedDefs(SPItem *item) _copyTextPath(SP_TEXTPATH(item->firstChild())); } // Copy clipping objects - if (item->clip_ref->getObject()) { - _copyNode(item->clip_ref->getObject()->getRepr(), _doc, _defs); + if (item->clip_ref){ + if (item->clip_ref->getObject()) { + _copyNode(item->clip_ref->getObject()->getRepr(), _doc, _defs); + } } // Copy mask objects - if (item->mask_ref->getObject()) { - SPObject *mask = item->mask_ref->getObject(); - _copyNode(mask->getRepr(), _doc, _defs); - // recurse into the mask for its gradients etc. - for (SPObject *o = mask->children ; o != NULL ; o = o->next) { - if (SP_IS_ITEM(o)) { - _copyUsedDefs(SP_ITEM(o)); + if (item->mask_ref){ + if (item->mask_ref->getObject()) { + SPObject *mask = item->mask_ref->getObject(); + _copyNode(mask->getRepr(), _doc, _defs); + // recurse into the mask for its gradients etc. + for (SPObject *o = mask->children ; o != NULL ; o = o->next) { + if (SP_IS_ITEM(o)) { + _copyUsedDefs(SP_ITEM(o)); + } } } } + // Copy filters if (style->getFilter()) { SPObject *filter = style->getFilter(); @@ -737,7 +742,12 @@ void ClipboardManagerImpl::_copyGradient(SPGradient *gradient) while (gradient) { // climb up the refs, copying each one in the chain _copyNode(gradient->getRepr(), _doc, _defs); - gradient = gradient->ref->getObject(); + if (gradient->ref){ + gradient = gradient->ref->getObject(); + } + else { + gradient = NULL; + } } } @@ -758,7 +768,12 @@ void ClipboardManagerImpl::_copyPattern(SPPattern *pattern) } _copyUsedDefs(SP_ITEM(child)); } - pattern = pattern->ref->getObject(); + if (pattern->ref){ + pattern = pattern->ref->getObject(); + } + else{ + pattern = NULL; + } } } diff --git a/src/ui/control-manager.cpp b/src/ui/control-manager.cpp new file mode 100644 index 000000000..ea9cf175d --- /dev/null +++ b/src/ui/control-manager.cpp @@ -0,0 +1,260 @@ +/* + * Central facade for accessing and managing on-canvas controls. + * + * Author: + * Jon A. Cruz <jon@joncruz.org> + * + * Copyright 2012 Authors + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + +#include "control-manager.h" + +#include <algorithm> +#include <glib.h> +#include <glib-object.h> + +#include "display/sodipodi-ctrl.h" // for SP_TYPE_CTRL +#include "display/sp-ctrlpoint.h" +#include "preferences.h" + +namespace { + +std::map<Inkscape::ControlType, std::vector<int> > sizeTable; + +} // namespace + +#define FILL_COLOR_NORMAL 0xffffff7f +#define FILL_COLOR_MOUSEOVER 0xff0000ff + +namespace Inkscape { + +class ControlManagerImpl +{ +public: + ControlManagerImpl(); + + ~ControlManagerImpl() {} + + void setControlSize(int size, bool force = false); + + void track(SPCanvasItem *anchor); + + sigc::connection connectCtrlSizeChanged(const sigc::slot<void> &slot); + + void updateItem(SPCanvasItem *item); + +private: + static void thingFinalized(gpointer data, GObject *wasObj); + + void thingFinalized(GObject *wasObj); + + class PrefListener : public Inkscape::Preferences::Observer + { + public: + PrefListener(ControlManagerImpl &manager) : Inkscape::Preferences::Observer("/options/grabsize/value"), _mgr(manager) {} + virtual ~PrefListener() {} + + virtual void notify(Inkscape::Preferences::Entry const &val) { + int size = val.getIntLimited(3, 1, 7); + _mgr.setControlSize(size); + } + + ControlManagerImpl &_mgr; + }; + + sigc::signal<void> _sizeChangedSignal; + PrefListener _prefHook; + int _size; + std::vector<SPCanvasItem *> _itemList; + std::map<Inkscape::ControlType, std::vector<int> > _sizeTable; +}; + +ControlManagerImpl::ControlManagerImpl() : + _sizeChangedSignal(), + _prefHook(*this), + _size(3), + _itemList(), + _sizeTable() +{ + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->addObserver(_prefHook); + + _size = prefs->getIntLimited("/options/grabsize/value", 3, 1, 7); + + { + int sizes[] = {8, 8, 8, 8, 8, 8, 8}; + _sizeTable[CTRL_TYPE_UNKNOWN] = std::vector<int>(sizes, sizes + (sizeof(sizes) / sizeof(sizes[0]))); + } + { + int sizes[] = {2, 4, 6, 8, 10, 12, 14}; + _sizeTable[CTRL_TYPE_ANCHOR] = std::vector<int>(sizes, sizes + (sizeof(sizes) / sizeof(sizes[0]))); + } + { + int sizes[] = {2, 3, 4, 7, 8, 9, 10}; + _sizeTable[CTRL_TYPE_ADJ_HANDLE] = std::vector<int>(sizes, sizes + (sizeof(sizes) / sizeof(sizes[0]))); + } + { + int sizes[] = {4, 6, 8, 10, 12, 14, 16}; + _sizeTable[CTRL_TYPE_POINT] = std::vector<int>(sizes, sizes + (sizeof(sizes) / sizeof(sizes[0]))); + _sizeTable[CTRL_TYPE_ROTATE] = std::vector<int>(sizes, sizes + (sizeof(sizes) / sizeof(sizes[0]))); + _sizeTable[CTRL_TYPE_SIZER] = std::vector<int>(sizes, sizes + (sizeof(sizes) / sizeof(sizes[0]))); + _sizeTable[CTRL_TYPE_SHAPER] = std::vector<int>(sizes, sizes + (sizeof(sizes) / sizeof(sizes[0]))); + } + { + int sizes[] = {2, 3, 4, 7, 8, 9, 10}; + _sizeTable[CTRL_TYPE_ORIGIN] = std::vector<int>(sizes, sizes + (sizeof(sizes) / sizeof(sizes[0]))); + } +} + + +void ControlManagerImpl::setControlSize(int size, bool force) +{ + if ((size < 1) || (size > 7)) { + g_warning("Illegal logical size set: %d", size); + } else if (force || (size != _size)) { + _size = size; + + for (std::vector<SPCanvasItem *>::iterator it = _itemList.begin(); it != _itemList.end(); ++it) + { + if (*it) { + updateItem(*it); + } + } + + _sizeChangedSignal.emit(); + } +} + +void ControlManagerImpl::track(SPCanvasItem *item) +{ + g_object_weak_ref( G_OBJECT(item), ControlManagerImpl::thingFinalized, this ); + + _itemList.push_back(item); + + setControlSize(_size, true); +} + +sigc::connection ControlManagerImpl::connectCtrlSizeChanged(const sigc::slot<void> &slot) +{ + return _sizeChangedSignal.connect(slot); +} + +void ControlManagerImpl::updateItem(SPCanvasItem *item) +{ + if (item) { + double target = _sizeTable[item->ctrlType][_size - 1]; + if ((item->ctrlType == CTRL_TYPE_ORIGIN) && SP_IS_CTRLPOINT(item)) { + sp_ctrlpoint_set_radius(SP_CTRLPOINT(item), target / 2.0); + } else { + sp_canvas_item_set(item, "size", target, NULL); + } + sp_canvas_item_request_update(item); + } +} + +void ControlManagerImpl::thingFinalized(gpointer data, GObject *wasObj) +{ + if (data) { + reinterpret_cast<ControlManagerImpl *>(data)->thingFinalized(wasObj); + } +} + +void ControlManagerImpl::thingFinalized(GObject *wasObj) +{ + SPCanvasItem *wasItem = reinterpret_cast<SPCanvasItem *>(wasObj); + if (wasItem) + { + std::vector<SPCanvasItem *>::iterator it = std::find(_itemList.begin(), _itemList.end(), wasItem); + if (it != _itemList.end()) + { + _itemList.erase(it); + } + } +} + + +// ---------------------------------------------------- + +ControlManager::ControlManager() : + _impl(new ControlManagerImpl()) +{ +} + +ControlManager::~ControlManager() +{ +} + +ControlManager &ControlManager::getManager() +{ + static ControlManager instance; + + return instance; +} + + +SPCanvasItem *ControlManager::createControl(SPCanvasGroup *parent, ControlType type) +{ + SPCanvasItem *item = 0; + switch (type) + { + case CTRL_TYPE_ADJ_HANDLE: + item = sp_canvas_item_new(parent, SP_TYPE_CTRL, + "shape", SP_CTRL_SHAPE_CIRCLE, + "size", 4.0, + "filled", 0, + "fill_color", 0xff00007f, + "stroked", 1, + "stroke_color", 0x0000ff7f, + NULL); + break; + case CTRL_TYPE_ANCHOR: + item = sp_canvas_item_new(parent, SP_TYPE_CTRL, + "size", 6.0, + "filled", 1, + "fill_color", FILL_COLOR_NORMAL, + "stroked", 1, + "stroke_color", 0x000000ff, + NULL); + break; + case CTRL_TYPE_ORIGIN: + item = sp_canvas_item_new(parent, SP_TYPE_CTRLPOINT, NULL); + break; + case CTRL_TYPE_UNKNOWN: + default: + item = sp_canvas_item_new(parent, SP_TYPE_CTRL, NULL); + } + if (item) { + item->ctrlType = type; + } + return item; +} + +void ControlManager::track(SPCanvasItem *item) +{ + _impl->track(item); +} + +sigc::connection ControlManager::connectCtrlSizeChanged(const sigc::slot<void> &slot) +{ + return _impl->connectCtrlSizeChanged(slot); +} + +void ControlManager::updateItem(SPCanvasItem *item) +{ + return _impl->updateItem(item); +} + +} // namespace Inkscape + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/control-manager.h b/src/ui/control-manager.h new file mode 100644 index 000000000..1d3e474b3 --- /dev/null +++ b/src/ui/control-manager.h @@ -0,0 +1,61 @@ +/* + * Inkscape::ControlManager - Coordinates creation and styling of nodes, handles, etc. + * + * Author: + * Jon A. Cruz <jon@joncruz.org> + * + * Copyright 2012 Authors + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ +#ifndef SEEN_INKSCAPE_CONTROL_MANAGER_H +#define SEEN_INKSCAPE_CONTROL_MANAGER_H + +#include <memory> +#include <sigc++/sigc++.h> + +#include "display/sp-canvas-item.h" + +struct SPCanvasItem; +struct SPCanvasGroup; + +namespace Inkscape { + +class ControlManagerImpl; + +class ControlManager +{ +public: + static ControlManager &getManager(); + + ~ControlManager(); + + sigc::connection connectCtrlSizeChanged(const sigc::slot<void> &slot); + + SPCanvasItem *createControl(SPCanvasGroup *parent, ControlType type); + + void track(SPCanvasItem *item); + + void updateItem(SPCanvasItem *item); + +private: + ControlManager(); + + std::auto_ptr<ControlManagerImpl> _impl; + + friend class ControlManagerImpl; +}; + +} // namespace Inkscape + +#endif // SEEN_INKSCAPE_CONTROL_MANAGER_H +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/behavior.h b/src/ui/dialog/behavior.h index 385cd05f5..5d5519a03 100644 --- a/src/ui/dialog/behavior.h +++ b/src/ui/dialog/behavior.h @@ -45,7 +45,7 @@ public: virtual operator Gtk::Widget&() =0; virtual GtkWidget *gobj() =0; virtual void present() =0; - virtual Gtk::VBox *get_vbox() =0; + virtual Gtk::Box *get_vbox() =0; virtual void show() =0; virtual void hide() =0; virtual void show_all_children() =0; diff --git a/src/ui/dialog/calligraphic-profile-rename.cpp b/src/ui/dialog/calligraphic-profile-rename.cpp index da3b5a802..c6633df0b 100644 --- a/src/ui/dialog/calligraphic-profile-rename.cpp +++ b/src/ui/dialog/calligraphic-profile-rename.cpp @@ -30,7 +30,7 @@ namespace Dialog { CalligraphicProfileRename::CalligraphicProfileRename() : _applied(false) { - Gtk::VBox *mainVBox = get_vbox(); + Gtk::Box *mainVBox = get_vbox(); _layout_table.set_spacings(4); _layout_table.resize (1, 2); diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp index 7b7c66553..47ec03b30 100644 --- a/src/ui/dialog/clonetiler.cpp +++ b/src/ui/dialog/clonetiler.cpp @@ -95,7 +95,7 @@ CloneTiler::CloneTiler (void) : #if GTK_CHECK_VERSION(3,0,0) GtkWidget *mainbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4); - gtk_box_new(GTK_BOX(mainbox), FALSE); + gtk_box_set_homogeneous(GTK_BOX(mainbox), FALSE); #else GtkWidget *mainbox = gtk_vbox_new(FALSE, 4); #endif @@ -803,7 +803,7 @@ CloneTiler::CloneTiler (void) : { #if GTK_CHECK_VERSION(3,0,0) GtkWidget *vvb = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); - gtk_box_new(GTK_BOX(vvb), FALSE); + gtk_box_set_homogeneous(GTK_BOX(vvb), FALSE); #else GtkWidget *vvb = gtk_vbox_new (FALSE, 0); #endif @@ -1003,11 +1003,19 @@ CloneTiler::CloneTiler (void) : 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 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 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); @@ -1025,11 +1033,19 @@ CloneTiler::CloneTiler (void) : } { +#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 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 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); @@ -1057,7 +1073,11 @@ CloneTiler::CloneTiler (void) : { // Width spinbutton +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> a = Gtk::Adjustment::create(0.0, -1e6, 1e6, 1.0, 10.0, 0); +#else Gtk::Adjustment *a = new Gtk::Adjustment (0.0, -1e6, 1e6, 1.0, 10.0, 0); +#endif sp_unit_selector_add_adjustment (SP_UNIT_SELECTOR (u), GTK_ADJUSTMENT (a->gobj())); double value = prefs->getDouble(prefs_path + "fillwidth", 50.0); @@ -1065,7 +1085,11 @@ CloneTiler::CloneTiler (void) : gdouble const units = sp_pixels_get_units (value, unit); a->set_value (units); +#if WITH_GTKMM_3_0 + Inkscape::UI::Widget::SpinButton *e = new Inkscape::UI::Widget::SpinButton(a, 1.0, 2); +#else Inkscape::UI::Widget::SpinButton *e = new Inkscape::UI::Widget::SpinButton (*a, 1.0, 2); +#endif e->set_tooltip_text (_("Width of the rectangle to be filled")); e->set_width_chars (7); e->set_digits (4); @@ -1083,7 +1107,11 @@ CloneTiler::CloneTiler (void) : { // Height spinbutton +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> a = Gtk::Adjustment::create(0.0, -1e6, 1e6, 1.0, 10.0, 0); +#else Gtk::Adjustment *a = new Gtk::Adjustment (0.0, -1e6, 1e6, 1.0, 10.0, 0); +#endif sp_unit_selector_add_adjustment (SP_UNIT_SELECTOR (u), GTK_ADJUSTMENT (a->gobj())); double value = prefs->getDouble(prefs_path + "fillheight", 50.0); @@ -1091,7 +1119,11 @@ CloneTiler::CloneTiler (void) : gdouble const units = sp_pixels_get_units (value, unit); a->set_value (units); +#if WITH_GTKMM_3_0 + Inkscape::UI::Widget::SpinButton *e = new Inkscape::UI::Widget::SpinButton(a, 1.0, 2); +#else Inkscape::UI::Widget::SpinButton *e = new Inkscape::UI::Widget::SpinButton (*a, 1.0, 2); +#endif e->set_tooltip_text (_("Height of the rectangle to be filled")); e->set_width_chars (7); e->set_digits (4); @@ -2586,7 +2618,7 @@ 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); - gtk_box_new(GTK_BOX(vb), FALSE); + gtk_box_set_homogeneous(GTK_BOX(vb), FALSE); #else GtkWidget *vb = gtk_vbox_new (FALSE, VB_MARGIN); #endif @@ -2644,19 +2676,36 @@ GtkWidget * CloneTiler::clonetiler_spinbox(const char *tip, const char *attr, do #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); @@ -2717,7 +2766,7 @@ void CloneTiler::clonetiler_pick_to(GtkToggleButton *tb, gpointer data) void CloneTiler::clonetiler_reset_recursive(GtkWidget *w) { - if (w && GTK_IS_OBJECT(w)) { + if (w && G_IS_OBJECT(w)) { { int r = GPOINTER_TO_INT (g_object_get_data(G_OBJECT(w), "zeroable")); if (r && GTK_IS_SPIN_BUTTON(w)) { // spinbutton diff --git a/src/ui/dialog/debug.cpp b/src/ui/dialog/debug.cpp index 8ffbd5c52..7095d2611 100644 --- a/src/ui/dialog/debug.cpp +++ b/src/ui/dialog/debug.cpp @@ -69,7 +69,7 @@ DebugDialogImpl::DebugDialogImpl() set_title(_("Messages")); set_size_request(300, 400); - Gtk::VBox *mainVBox = get_vbox(); + Gtk::Box *mainVBox = get_vbox(); //## Add a menu for clear() menuBar.items().push_back( Gtk::Menu_Helpers::MenuElem(_("_File"), fileMenu) ); diff --git a/src/ui/dialog/dialog.cpp b/src/ui/dialog/dialog.cpp index 426e66eeb..14a26b716 100644 --- a/src/ui/dialog/dialog.cpp +++ b/src/ui/dialog/dialog.cpp @@ -54,14 +54,14 @@ gboolean sp_retransientize_again(gpointer dlgPtr) return FALSE; // so that it is only called once } -void sp_dialog_shutdown(GtkObject */*object*/, gpointer dlgPtr) +void sp_dialog_shutdown(GObject * /*object*/, gpointer dlgPtr) { Dialog *dlg = static_cast<Dialog *>(dlgPtr); dlg->onShutdown(); } -void hideCallback(GtkObject */*object*/, gpointer dlgPtr) +void hideCallback(GObject * /*object*/, gpointer dlgPtr) { g_return_if_fail( dlgPtr != NULL ); @@ -69,7 +69,7 @@ void hideCallback(GtkObject */*object*/, gpointer dlgPtr) dlg->onHideF12(); } -void unhideCallback(GtkObject */*object*/, gpointer dlgPtr) +void unhideCallback(GObject * /*object*/, gpointer dlgPtr) { g_return_if_fail( dlgPtr != NULL ); @@ -160,7 +160,7 @@ void Dialog::onShowF12() inline Dialog::operator Gtk::Widget &() { return *_behavior; } inline GtkWidget *Dialog::gobj() { return _behavior->gobj(); } inline void Dialog::present() { _behavior->present(); } -inline Gtk::VBox *Dialog::get_vbox() { return _behavior->get_vbox(); } +inline Gtk::Box *Dialog::get_vbox() { return _behavior->get_vbox(); } inline void Dialog::hide() { _behavior->hide(); } inline void Dialog::show() { _behavior->show(); } inline void Dialog::show_all_children() { _behavior->show_all_children(); } diff --git a/src/ui/dialog/dialog.h b/src/ui/dialog/dialog.h index 43e7dda3b..025e9eb58 100644 --- a/src/ui/dialog/dialog.h +++ b/src/ui/dialog/dialog.h @@ -32,7 +32,7 @@ enum BehaviorType { FLOATING, DOCK }; void sp_retransientize(Inkscape::Application *inkscape, SPDesktop *desktop, gpointer dlgPtr); gboolean sp_retransientize_again(gpointer dlgPtr); -void sp_dialog_shutdown(GtkObject *object, gpointer dlgPtr); +void sp_dialog_shutdown(GObject *object, gpointer dlgPtr); /** * Base class for Inkscape dialogs. @@ -79,7 +79,7 @@ public: virtual operator Gtk::Widget &(); virtual GtkWidget *gobj(); virtual void present(); - virtual Gtk::VBox *get_vbox(); + virtual Gtk::Box *get_vbox(); virtual void show(); virtual void hide(); virtual void show_all_children(); diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp index af5788ac6..e10668473 100644 --- a/src/ui/dialog/export.cpp +++ b/src/ui/dialog/export.cpp @@ -408,14 +408,27 @@ 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, GtkWidget *us, + Gtk::Table *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, GtkWidget *us, 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 if (us) { sp_unit_selector_add_adjustment ( SP_UNIT_SELECTOR (us), GTK_ADJUSTMENT (adj->gobj()) ); } @@ -431,7 +444,11 @@ Gtk::Adjustment * Export::createSpinbutton( gchar const * /*key*/, float val, fl pos++; } +#if WITH_GTKMM_3_0 + Gtk::SpinButton *sb = new Gtk::SpinButton(adj, 1.0, digits); +#else Gtk::SpinButton *sb = new Gtk::SpinButton(*adj, 1.0, digits); +#endif t->attach (*sb, x + pos, x + pos + 1, y, y + 1, Gtk::EXPAND, Gtk::EXPAND, 0, 0 ); sb->set_size_request (80, -1); sb->set_sensitive (sensitive); @@ -1288,7 +1305,11 @@ 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; @@ -1331,7 +1352,11 @@ 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; @@ -1662,7 +1687,11 @@ 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); @@ -1680,7 +1709,11 @@ 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 { const SPUnit *unit = sp_unit_selector_get_unit ((SPUnitSelector *)unit_selector->gobj() ); @@ -1699,7 +1732,11 @@ 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"); @@ -1721,7 +1758,11 @@ 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); const SPUnit *unit = sp_unit_selector_get_unit ((SPUnitSelector *)unit_selector->gobj()); diff --git a/src/ui/dialog/export.h b/src/ui/dialog/export.h index eaab04762..5e421c66b 100644 --- a/src/ui/dialog/export.h +++ b/src/ui/dialog/export.h @@ -94,10 +94,17 @@ 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. @@ -119,12 +126,22 @@ private: * @param sensitive Whether the spin button is sensitive or not * @param cb Callback for when this spin button is changed (optional) */ +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> createSpinbutton( gchar const *key, float val, float min, float max, + float step, float page, GtkWidget *us, + Gtk::Table *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, GtkWidget *us, 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 */ @@ -145,14 +162,22 @@ private: */ void onAreaX0Change() {areaXChange(x0_adj);} ; 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 */ void onAreaY0Change() {areaYChange(y0_adj);} ; void onAreaY1Change() {areaYChange(y1_adj);} ; +#if WITH_GTKMM_3_0 + void areaYChange(Glib::RefPtr<Gtk::Adjustment>& adj); +#else void areaYChange ( Gtk::Adjustment *adj); +#endif /** * Area width value changed callback @@ -261,6 +286,21 @@ 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; + Glib::RefPtr<Gtk::Adjustment> y0_adj; + Glib::RefPtr<Gtk::Adjustment> y1_adj; + Glib::RefPtr<Gtk::Adjustment> width_adj; + Glib::RefPtr<Gtk::Adjustment> height_adj; + + /* Bitmap size widgets */ + Glib::RefPtr<Gtk::Adjustment> bmwidth_adj; + 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; @@ -274,6 +314,7 @@ private: Gtk::Adjustment *bmheight_adj; Gtk::Adjustment *xdpi_adj; Gtk::Adjustment *ydpi_adj; +#endif Gtk::VBox size_box; Gtk::Label* bm_label; diff --git a/src/ui/dialog/filedialogimpl-gtkmm.h b/src/ui/dialog/filedialogimpl-gtkmm.h index d40edd67d..4caa106ad 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.h +++ b/src/ui/dialog/filedialogimpl-gtkmm.h @@ -21,6 +21,7 @@ #include <gtkmm/filechooserdialog.h> #include <glib/gstdio.h> #include <gtkmm/comboboxtext.h> +#include <gtkmm/checkbutton.h> //General includes #include <unistd.h> diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index dd3e90b2c..4af328b49 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -62,6 +62,7 @@ #include "io/sys.h" #include <iostream> +#include <gtkmm/checkbutton.h> #include <gtkmm/colorbutton.h> #include <gtkmm/paned.h> #include <gtkmm/scrolledwindow.h> @@ -2125,16 +2126,27 @@ void FilterEffectsDialog::PrimitiveList::on_drag_end(const Glib::RefPtr<Gdk::Dra bool FilterEffectsDialog::PrimitiveList::on_scroll_timeout() { if(_autoscroll) { - Gtk::Adjustment& a = *dynamic_cast<Gtk::ScrolledWindow*>(get_parent())->get_vadjustment(); - double v; +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> a = dynamic_cast<Gtk::ScrolledWindow*>(get_parent())->get_vadjustment(); + double v = a->get_value() + _autoscroll; + + if(v < 0) + v = 0; + if(v > a->get_upper() - a->get_page_size()) + v = a->get_upper() - a->get_page_size(); - v = a.get_value() + _autoscroll; - if(v < 0) + a->set_value(v); +#else + Gtk::Adjustment& a = *dynamic_cast<Gtk::ScrolledWindow*>(get_parent())->get_vadjustment(); + double v = a.get_value() + _autoscroll; + + 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(); } diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp index 641acd3f3..03a440d5c 100644 --- a/src/ui/dialog/find.cpp +++ b/src/ui/dialog/find.cpp @@ -64,8 +64,8 @@ namespace Dialog { Find::Find() : UI::Widget::Panel("", "/dialogs/find", SP_VERB_DIALOG_FIND), - entry_find(_("F_ind:"), _("Find objects by their content (exact or partial match)")), - entry_replace(_("Re_place:"), _("Replace found objects with this value ")), + entry_find(_("F_ind:"), _("Find objects by their content or properties (exact or partial match)")), + entry_replace(_("Re_place:"), _("Replace match with this value")), check_scope_all(_("_All"), _("Search in all layers")), check_scope_layer(_("Current _layer"), _("Limit search to the current layer")), @@ -84,8 +84,8 @@ Find::Find() frame_options(_("General")), check_ids(_("_ID"), _("Search id name"), true), - check_attributename(_("Attribute _Name"), _("Search attribute name"), false), - check_attributevalue(_("Attribute _Value"), _("Search attribute value"), true), + check_attributename(_("Attribute _name"), _("Search attribute name"), false), + check_attributevalue(_("Attribute _value"), _("Search attribute value"), true), check_style(_("_Style"), _("Search style"), true), check_font(_("_Font"), _("Search fonts"), false), frame_properties(_("Properties")), @@ -104,11 +104,11 @@ Find::Find() check_images(_("Images"), _("Search images"), false), check_offsets(_("Offsets"), _("Search offset objects"), false), - frame_types(_("Object Types")), + frame_types(_("Object types")), status(""), - button_find(_("_Find"), _("Select all objects matching the selected fields ")), - button_replace(_("_Replace All"), _("Replace all the matching objects")), + button_find(_("_Find"), _("Select all objects matching the selection criteria")), + button_replace(_("_Replace All"), _("Replace all matches")), _action_replace(false), blocked(false), desktop(NULL), @@ -825,7 +825,14 @@ Find::onAction() "<b>%d</b> objects found (out of <b>%d</b>), %s match.", count), count, all, exact? _("exact") : _("partial")); - status.set_text(Glib::ustring::compose("%1 %2 %3", count, _("objects"), _action_replace? _("replaced") : _("found") )); + if (_action_replace){ + // TRANSLATORS: "%1" is replaced with the number of matches + status.set_text(Glib::ustring::compose(_("%1 objects replaced"), count)); + } + else { + // TRANSLATORS: "%1" is replaced with the number of matches + status.set_text(Glib::ustring::compose(_("%1 objects found"), count)); + } Inkscape::Selection *selection = sp_desktop_selection (desktop); selection->clear(); @@ -837,7 +844,7 @@ Find::onAction() } } else { - status.set_text(_("Not found")); + status.set_text(_("Nothing found")); if (!check_scope_selection.get_active()) { Inkscape::Selection *selection = sp_desktop_selection (desktop); selection->clear(); @@ -863,7 +870,7 @@ Find::onToggleCheck () } if (!objectok) { - status.set_text(_("Select an object")); + status.set_text(_("Select an object type")); } diff --git a/src/ui/dialog/floating-behavior.cpp b/src/ui/dialog/floating-behavior.cpp index 6748665ad..ba81c6d47 100644 --- a/src/ui/dialog/floating-behavior.cpp +++ b/src/ui/dialog/floating-behavior.cpp @@ -32,30 +32,24 @@ namespace Behavior { FloatingBehavior::FloatingBehavior(Dialog &dialog) : Behavior(dialog), _d (new Gtk::Dialog(_dialog._title)) -#if GTK_VERSION_GE(2, 12) ,_dialog_active(_d->property_is_active()) ,_steps(0) ,_trans_focus(Inkscape::Preferences::get()->getDoubleLimited("/dialogs/transparency/on-focus", 0.95, 0.0, 1.0)) ,_trans_blur(Inkscape::Preferences::get()->getDoubleLimited("/dialogs/transparency/on-blur", 0.50, 0.0, 1.0)) ,_trans_time(Inkscape::Preferences::get()->getIntLimited("/dialogs/transparency/animate-time", 100, 0, 5000)) -#endif { hide(); - _d->set_has_separator(false); signal_delete_event().connect(sigc::mem_fun(_dialog, &Inkscape::UI::Dialog::Dialog::_onDeleteEvent)); sp_transientize(GTK_WIDGET(_d->gobj())); _dialog.retransientize_suppress = false; -#if GTK_VERSION_GE(2, 12) _focus_event(); _dialog_active.signal_changed().connect(sigc::mem_fun(this, &FloatingBehavior::_focus_event)); -#endif } -#if GTK_VERSION_GE(2, 12) /** * A function called when the window gets focus. * @@ -126,8 +120,6 @@ bool FloatingBehavior::_trans_timer (void) { return true; } -#endif - FloatingBehavior::~FloatingBehavior() { delete _d; @@ -142,7 +134,7 @@ FloatingBehavior::create(Dialog &dialog) inline FloatingBehavior::operator Gtk::Widget &() { return *_d; } inline GtkWidget *FloatingBehavior::gobj() { return GTK_WIDGET(_d->gobj()); } -inline Gtk::VBox* FloatingBehavior::get_vbox() { return _d->get_vbox(); } +inline Gtk::Box* FloatingBehavior::get_vbox() { return _d->get_vbox(); } inline void FloatingBehavior::present() { _d->present(); } inline void FloatingBehavior::hide() { _d->hide(); } inline void FloatingBehavior::show() { _d->show(); } @@ -151,7 +143,14 @@ inline void FloatingBehavior::resize(int width, int height) { _d-> inline void FloatingBehavior::move(int x, int y) { _d->move(x, y); } 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) {requisition = _d->size_request(); } +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); } inline void FloatingBehavior::set_title(Glib::ustring title) { _d->set_title(title); } diff --git a/src/ui/dialog/floating-behavior.h b/src/ui/dialog/floating-behavior.h index c6b6a93e9..56ed76b41 100644 --- a/src/ui/dialog/floating-behavior.h +++ b/src/ui/dialog/floating-behavior.h @@ -36,7 +36,7 @@ public: operator Gtk::Widget &(); GtkWidget *gobj(); void present(); - Gtk::VBox *get_vbox(); + Gtk::Box *get_vbox(); void show(); void hide(); void show_all_children(); @@ -66,7 +66,6 @@ private: Gtk::Dialog *_d; //< the actual dialog -#if GTK_VERSION_GE(2, 12) void _focus_event (void); bool _trans_timer (void); @@ -75,8 +74,6 @@ private: float _trans_focus; //< The percentage opacity when the dialog is focused float _trans_blur; //< The percentage opactiy when the dialog is not focused int _trans_time; //< The amount of time (in ms) for the dialog to change it's transparency -#endif - }; } // namespace Behavior diff --git a/src/ui/dialog/guides.cpp b/src/ui/dialog/guides.cpp index ce21f9c6e..d20f2a220 100644 --- a/src/ui/dialog/guides.cpp +++ b/src/ui/dialog/guides.cpp @@ -166,7 +166,7 @@ void GuidelinePropertiesDialog::_setup() { add_button(Gtk::Stock::DELETE, -12); add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); - Gtk::VBox *mainVBox = get_vbox(); + Gtk::Box *mainVBox = get_vbox(); _layout_table.set_spacings(4); _layout_table.resize (3, 4); diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 719e42f16..685ea70e1 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -520,21 +520,22 @@ void InkscapePreferences::initPageUI() _page_ui.add_line( false, _("Language (requires restart):"), _ui_languages, "", _("Set the language for menus and number formats"), false); - Glib::ustring sizeLabels[] = {_("Large"), _("Small"), _("Smaller")}; - int sizeValues[] = {0, 1, 2}; - - _misc_small_tools.init( "/toolbox/tools/small", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), 0 ); - _page_ui.add_line( false, _("Toolbox icon size:"), _misc_small_tools, "", - _("Set the size for the tool icons (requires restart)"), false); + { + Glib::ustring sizeLabels[] = {_("Large"), _("Small"), _("Smaller")}; + int sizeValues[] = {0, 1, 2}; - _misc_small_toolbar.init( "/toolbox/small", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), 0 ); - _page_ui.add_line( false, _("Control bar icon size:"), _misc_small_toolbar, "", - _("Set the size for the icons in tools' control bars to use (requires restart)"), false); + _misc_small_tools.init( "/toolbox/tools/small", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), 0 ); + _page_ui.add_line( false, _("Toolbox icon size:"), _misc_small_tools, "", + _("Set the size for the tool icons (requires restart)"), false); - _misc_small_secondary.init( "/toolbox/secondary", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), 1 ); - _page_ui.add_line( false, _("Secondary toolbar icon size:"), _misc_small_secondary, "", - _("Set the size for the icons in secondary toolbars to use (requires restart)"), false); + _misc_small_toolbar.init( "/toolbox/small", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), 0 ); + _page_ui.add_line( false, _("Control bar icon size:"), _misc_small_toolbar, "", + _("Set the size for the icons in tools' control bars to use (requires restart)"), false); + _misc_small_secondary.init( "/toolbox/secondary", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), 1 ); + _page_ui.add_line( false, _("Secondary toolbar icon size:"), _misc_small_secondary, "", + _("Set the size for the icons in secondary toolbars to use (requires restart)"), false); + } _ui_colorsliders_top.init( _("Work-around color sliders not drawing"), "/options/workarounds/colorsontop", false); _page_ui.add_line( false, "", _ui_colorsliders_top, "", @@ -625,7 +626,6 @@ void InkscapePreferences::initPageUI() _("Same as Normal but may work better with some window managers")); #endif -#if GTK_VERSION_GE(2, 12) _page_windows.add_group_header( _("Dialog Transparency")); _win_trans_focus.init("/dialogs/transparency/on-focus", 0.5, 1.0, 0.01, 0.1, 1.0, false, false); _page_windows.add_line( true, _("Opacity when focused:"), _win_trans_focus, "", ""); @@ -633,7 +633,6 @@ void InkscapePreferences::initPageUI() _page_windows.add_line( true, _("Opacity when unfocused:"), _win_trans_blur, "", ""); _win_trans_time.init("/dialogs/transparency/animate-time", 0, 1000, 10, 100, 100, true, false); _page_windows.add_line( true, _("Time of opacity change animation:"), _win_trans_time, "ms", ""); -#endif _page_windows.add_group_header( _("Miscellaneous")); #ifndef WIN32 // FIXME: Temporary Win32 special code to enable transient dialogs @@ -770,6 +769,10 @@ void InkscapePreferences::initPageIO() _page_mouse.add_line( false, _("Click/drag threshold:"), _mouse_thres, _("pixels"), _("Maximum mouse drag (in screen pixels) which is considered a click, not a drag"), false); + _mouse_grabsize.init("/options/grabsize/value", 1, 7, 1, 2, 3, 0); + _page_mouse.add_line(false, _("Handle size"), _mouse_grabsize, "", + _("Set the relative size of node handles."), true); + _mouse_use_ext_input.init( _("Use pressure-sensitive tablet (requires restart)"), "/options/useextinput/value", true); _page_mouse.add_line(false, "",_mouse_use_ext_input, "", _("Use the capabilities of a tablet or other pressure-sensitive device. Disable this only if you have problems with the tablet (you can still use it as a mouse)")); @@ -815,7 +818,7 @@ void InkscapePreferences::initPageIO() _svgoutput_attrwarn.init( _("Print warnings"), "/options/svgoutput/incorrect_attributes_warn", true); _page_svgoutput.add_line( true, "", _svgoutput_attrwarn, "", _("Print warning if invalid or non-useful attributes found. Database files located in inkscape_data_dir/attributes."), false); _svgoutput_attrremove.init( _("Remove attributes"), "/options/svgoutput/incorrect_attributes_remove", false); - _page_svgoutput.add_line( true, "", _svgoutput_attrremove, "", _("Delete invalid or non-useful attributes from element tag."), false); + _page_svgoutput.add_line( true, "", _svgoutput_attrremove, "", _("Delete invalid or non-useful attributes from element tag"), false); /* Add incorrect style properties options */ _page_svgoutput.add_group_header( _("Inappropriate Style Properties Actions")); @@ -823,7 +826,7 @@ void InkscapePreferences::initPageIO() _svgoutput_stylepropwarn.init( _("Print warnings"), "/options/svgoutput/incorrect_style_properties_warn", true); _page_svgoutput.add_line( true, "", _svgoutput_stylepropwarn, "", _("Print warning if inappropriate style properties found (i.e. 'font-family' set on a <rect>). Database files located in inkscape_data_dir/attributes."), false); _svgoutput_stylepropremove.init( _("Remove style properties"), "/options/svgoutput/incorrect_style_properties_remove", false); - _page_svgoutput.add_line( true, "", _svgoutput_stylepropremove, "", _("Delete inappropriate style properties."), false); + _page_svgoutput.add_line( true, "", _svgoutput_stylepropremove, "", _("Delete inappropriate style properties"), false); /* Add default or inherited style properties options */ _page_svgoutput.add_group_header( _("Non-useful Style Properties Actions")); @@ -831,16 +834,16 @@ void InkscapePreferences::initPageIO() _svgoutput_styledefaultswarn.init( _("Print warnings"), "/options/svgoutput/style_defaults_warn", true); _page_svgoutput.add_line( true, "", _svgoutput_styledefaultswarn, "", _("Print warning if redundant style properties found (i.e. if a property has the default value and a different value is not inherited or if value is the same as would be inherited). Database files located in inkscape_data_dir/attributes."), false); _svgoutput_styledefaultsremove.init( _("Remove style properties"), "/options/svgoutput/style_defaults_remove", false); - _page_svgoutput.add_line( true, "", _svgoutput_styledefaultsremove, "", _("Delete redundant style properties."), false); + _page_svgoutput.add_line( true, "", _svgoutput_styledefaultsremove, "", _("Delete redundant style properties"), false); - _page_svgoutput.add_group_header( _("Check Attributes and Style Properties on:")); + _page_svgoutput.add_group_header( _("Check Attributes and Style Properties on")); _svgoutput_check_reading.init( _("Reading"), "/options/svgoutput/check_on_reading", false); - _page_svgoutput.add_line( true, "", _svgoutput_check_reading, "", _("Check attributes and style properties on reading in SVG files (including those internal to Inkscape which will slow down startup)."), false); + _page_svgoutput.add_line( true, "", _svgoutput_check_reading, "", _("Check attributes and style properties on reading in SVG files (including those internal to Inkscape which will slow down startup)"), false); _svgoutput_check_editing.init( _("Editing"), "/options/svgoutput/check_on_editing", false); - _page_svgoutput.add_line( true, "", _svgoutput_check_editing, "", _("Check attributes and style properties while editing SVG files (may slow down Inkscape, mostly useful for debugging)."), false); + _page_svgoutput.add_line( true, "", _svgoutput_check_editing, "", _("Check attributes and style properties while editing SVG files (may slow down Inkscape, mostly useful for debugging)"), false); _svgoutput_check_writing.init( _("Writing"), "/options/svgoutput/check_on_writing", true); - _page_svgoutput.add_line( true, "", _svgoutput_check_writing, "", _("Check attributes and style properties on writing out SVG files."), false); + _page_svgoutput.add_line( true, "", _svgoutput_check_writing, "", _("Check attributes and style properties on writing out SVG files"), false); this->AddPage(_page_svgoutput, _("SVG output"), iter_io, PREFS_PAGE_IO_SVGOUTPUT); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index 1d03ab706..101831086 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -166,6 +166,7 @@ protected: UI::Widget::PrefSpinButton _mouse_sens; UI::Widget::PrefSpinButton _mouse_thres; + UI::Widget::PrefSlider _mouse_grabsize; UI::Widget::PrefCheckButton _mouse_use_ext_input; UI::Widget::PrefCheckButton _mouse_switch_on_ext_input; diff --git a/src/ui/dialog/layer-properties.cpp b/src/ui/dialog/layer-properties.cpp index f292ad565..4fd792407 100644 --- a/src/ui/dialog/layer-properties.cpp +++ b/src/ui/dialog/layer-properties.cpp @@ -36,7 +36,7 @@ namespace Dialogs { LayerPropertiesDialog::LayerPropertiesDialog() : _strategy(NULL), _desktop(NULL), _layer(NULL), _position_visible(false) { - Gtk::VBox *mainVBox = get_vbox(); + Gtk::Box *mainVBox = get_vbox(); _layout_table.set_spacings(4); _layout_table.resize (1, 2); diff --git a/src/ui/dialog/livepatheffect-add.cpp b/src/ui/dialog/livepatheffect-add.cpp index 36a9f06a3..c22aace37 100644 --- a/src/ui/dialog/livepatheffect-add.cpp +++ b/src/ui/dialog/livepatheffect-add.cpp @@ -72,7 +72,7 @@ LivePathEffectAdd::LivePathEffectAdd() : add_button.set_use_underline(true); add_button.set_can_default(); - Gtk::VBox *mainVBox = get_vbox(); + Gtk::Box *mainVBox = get_vbox(); mainVBox->pack_start(scrolled_window, true, true); add_action_widget(close_button, Gtk::RESPONSE_CLOSE); add_action_widget(add_button, Gtk::RESPONSE_APPLY); diff --git a/src/ui/dialog/messages.h b/src/ui/dialog/messages.h index 350c1feec..6ed246ece 100644 --- a/src/ui/dialog/messages.h +++ b/src/ui/dialog/messages.h @@ -19,6 +19,7 @@ #include <gtkmm/box.h> #include <gtkmm/textview.h> #include <gtkmm/button.h> +#include <gtkmm/checkbutton.h> #include <gtkmm/menubar.h> #include <gtkmm/menu.h> #include <gtkmm/scrolledwindow.h> diff --git a/src/ui/dialog/panel-dialog.h b/src/ui/dialog/panel-dialog.h index 1e44e23a1..1fefd811e 100644 --- a/src/ui/dialog/panel-dialog.h +++ b/src/ui/dialog/panel-dialog.h @@ -154,7 +154,7 @@ PanelDialog<B>::PanelDialog(Widget::Panel &panel, char const *prefs_path, int co PanelDialogBase(panel, prefs_path, verb_num, apply_label), Dialog(&B::create, prefs_path, verb_num, apply_label) { - Gtk::VBox *vbox = get_vbox(); + Gtk::Box *vbox = get_vbox(); _panel.signalResponse().connect(sigc::mem_fun(*this, &PanelDialog::_handleResponse)); _panel.signalPresent().connect(sigc::mem_fun(*this, &PanelDialog::_presentDialog)); @@ -204,7 +204,7 @@ PanelDialog<Behavior::FloatingBehavior>::PanelDialog(UI::Widget::Panel &panel, c PanelDialogBase(panel, prefs_path, verb_num, apply_label), Dialog(&Behavior::FloatingBehavior::create, prefs_path, verb_num, apply_label) { - Gtk::VBox *vbox = get_vbox(); + Gtk::Box *vbox = get_vbox(); _panel.signalResponse().connect(sigc::mem_fun(*this, &PanelDialog::_handleResponse)); vbox->pack_start(_panel, true, true, 0); diff --git a/src/ui/dialog/undo-history.h b/src/ui/dialog/undo-history.h index d94464517..ee7941580 100644 --- a/src/ui/dialog/undo-history.h +++ b/src/ui/dialog/undo-history.h @@ -16,6 +16,7 @@ #include <gtkmm/scrolledwindow.h> #include <gtkmm/treemodel.h> #include <gtkmm/treeselection.h> +#include <glibmm/property.h> #include <functional> #include <sstream> diff --git a/src/ui/dialog/xml-tree.cpp b/src/ui/dialog/xml-tree.cpp index 5c39a2b22..03678d26d 100644 --- a/src/ui/dialog/xml-tree.cpp +++ b/src/ui/dialog/xml-tree.cpp @@ -49,8 +49,7 @@ #include "widgets/sp-xmlview-tree.h" #if !GTK_CHECK_VERSION(2,22,0) -#define GDK_KEY_Escape 0xff1b -#define GDK_KEY_Return 0xff0d +#include "compat-key-syms.h" #endif namespace Inkscape { diff --git a/src/ui/previewholder.cpp b/src/ui/previewholder.cpp index cce7da103..d89df1104 100644 --- a/src/ui/previewholder.cpp +++ b/src/ui/previewholder.cpp @@ -208,8 +208,9 @@ 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 WITH_GTKMM_3_0 - _insides->get_preferred_size(&req, NULL); +#if GTK_CHECK_VERSION(3,0,0) + Gtk::Requisition req_natural; + _insides->get_preferred_size(req, req_natural); #else req = _insides->size_request(); #endif @@ -239,8 +240,9 @@ void PreviewHolder::calcGridSize( const Gtk::Widget* thing, int itemCount, int& if ( _anchor == SP_ANCHOR_SOUTH || _anchor == SP_ANCHOR_NORTH ) { Gtk::Requisition req; -#if WITH_GTKMM_3_0 - _scroller->get_preferred_size(&req, NULL); +#if GTK_CHECK_VERSION(3,0,0) + Gtk::Requisition req_natural; + _scroller->get_preferred_size(req, req_natural); #else req = _scroller->size_request(); #endif @@ -249,13 +251,19 @@ void PreviewHolder::calcGridSize( const Gtk::Widget* thing, int itemCount, int& 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 + if ( hs ) { Gtk::Requisition scrollReq; -#if WITH_GTKMM_3_0 - hs->get_preferred_size(&req, NULL); +#if GTK_CHECK_VERSION(3,0,0) + Gtk::Requisition scrollReq_natural; + hs->get_preferred_size(scrollReq, scrollReq_natural); #else - req = hs->size_request(); + scrollReq = hs->size_request(); #endif // the +8 is a temporary hack @@ -263,8 +271,9 @@ void PreviewHolder::calcGridSize( const Gtk::Widget* thing, int itemCount, int& } Gtk::Requisition req2; -#if WITH_GTKMM_3_0 - const_cast<Gtk::Widget*>(thing)->get_preferred_size(&req2, NULL); +#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 diff --git a/src/ui/tool/control-point-selection.cpp b/src/ui/tool/control-point-selection.cpp index e4899691a..1c66b91b6 100644 --- a/src/ui/tool/control-point-selection.cpp +++ b/src/ui/tool/control-point-selection.cpp @@ -22,106 +22,7 @@ #include <gdk/gdkkeysyms.h> #if !GTK_CHECK_VERSION(2,22,0) -#define GDK_KEY_VoidSymbol 0xffffff -#define GDK_KEY_Up 0xff52 -#define GDK_KEY_KP_Up 0xff97 -#define GDK_KEY_Down 0xff54 -#define GDK_KEY_KP_Down 0xff99 -#define GDK_KEY_Left 0xff51 -#define GDK_KEY_KP_Left 0xff96 -#define GDK_KEY_Right 0xff53 -#define GDK_KEY_KP_Right 0xff98 -#define GDK_KEY_Page_Up 0xff55 -#define GDK_KEY_KP_Page_Up 0xff9a -#define GDK_KEY_Page_Down 0xff56 -#define GDK_KEY_KP_Page_Down 0xff9b -#define GDK_KEY_Home 0xff50 -#define GDK_KEY_KP_Home 0xff95 -#define GDK_KEY_End 0xff57 -#define GDK_KEY_KP_End 0xff9c -#define GDK_KEY_a 0x061 -#define GDK_KEY_A 0x041 -#define GDK_KEY_b 0x062 -#define GDK_KEY_B 0x042 -#define GDK_KEY_d 0x064 -#define GDK_KEY_D 0x044 -#define GDK_KEY_g 0x067 -#define GDK_KEY_G 0x047 -#define GDK_KEY_h 0x068 -#define GDK_KEY_H 0x048 -#define GDK_KEY_i 0x069 -#define GDK_KEY_I 0x049 -#define GDK_KEY_j 0x06a -#define GDK_KEY_J 0x04a -#define GDK_KEY_k 0x06b -#define GDK_KEY_K 0x04b -#define GDK_KEY_l 0x06c -#define GDK_KEY_L 0x04c -#define GDK_KEY_q 0x071 -#define GDK_KEY_Q 0x051 -#define GDK_KEY_r 0x072 -#define GDK_KEY_R 0x052 -#define GDK_KEY_s 0x073 -#define GDK_KEY_S 0x053 -#define GDK_KEY_u 0x075 -#define GDK_KEY_U 0x055 -#define GDK_KEY_v 0x076 -#define GDK_KEY_V 0x056 -#define GDK_KEY_w 0x077 -#define GDK_KEY_W 0x057 -#define GDK_KEY_x 0x078 -#define GDK_KEY_X 0x058 -#define GDK_KEY_z 0x07a -#define GDK_KEY_Z 0x05a -#define GDK_KEY_Escape 0xff1b -#define GDK_KEY_Control_L 0xffe3 -#define GDK_KEY_Control_R 0xffe4 -#define GDK_KEY_Alt_L 0xffe9 -#define GDK_KEY_Alt_R 0xffea -#define GDK_KEY_Shift_L 0xffe1 -#define GDK_KEY_Shift_R 0xffe2 -#define GDK_KEY_Meta_L 0xffe7 -#define GDK_KEY_Meta_R 0xffe8 -#define GDK_KEY_KP_0 0xffb0 -#define GDK_KEY_KP_1 0xffb1 -#define GDK_KEY_KP_2 0xffb2 -#define GDK_KEY_KP_3 0xffb3 -#define GDK_KEY_KP_4 0xffb4 -#define GDK_KEY_KP_5 0xffb5 -#define GDK_KEY_KP_6 0xffb6 -#define GDK_KEY_KP_7 0xffb7 -#define GDK_KEY_KP_8 0xffb8 -#define GDK_KEY_KP_9 0xffb9 -#define GDK_KEY_F1 0xffbe -#define GDK_KEY_F2 0xffbf -#define GDK_KEY_F3 0xffc0 -#define GDK_KEY_F4 0xffc1 -#define GDK_KEY_F5 0xffc2 -#define GDK_KEY_F6 0xffc3 -#define GDK_KEY_F7 0xffc4 -#define GDK_KEY_F8 0xffc5 -#define GDK_KEY_F9 0xffc6 -#define GDK_KEY_F10 0xffc7 -#define GDK_KEY_F11 0xffc8 -#define GDK_KEY_Insert 0xff63 -#define GDK_KEY_KP_Insert 0xff9e -#define GDK_KEY_Delete 0xffff -#define GDK_KEY_KP_Delete 0xff9f -#define GDK_KEY_BackSpace 0xff08 -#define GDK_KEY_Return 0xff0d -#define GDK_KEY_KP_Enter 0xff8d -#define GDK_KEY_space 0x020 -#define GDK_KEY_KP_Space 0xff80 -#define GDK_KEY_Tab 0xff09 -#define GDK_KEY_ISO_Left_Tab 0xfe20 -#define GDK_KEY_bracketleft 0x05b -#define GDK_KEY_bracketright 0x05d -#define GDK_KEY_less 0x03c -#define GDK_KEY_greater 0x03e -#define GDK_KEY_comma 0x02c -#define GDK_KEY_period 0x02e -#define GDK_KEY_KP_Add 0xffab -#define GDK_KEY_KP_Subtract 0xffad +#include "compat-key-syms.h" #endif namespace Inkscape { diff --git a/src/ui/tool/control-point.cpp b/src/ui/tool/control-point.cpp index 15af21777..68749cdff 100644 --- a/src/ui/tool/control-point.cpp +++ b/src/ui/tool/control-point.cpp @@ -28,9 +28,7 @@ #include "ui/tool/transform-handle-set.h" #if !GTK_CHECK_VERSION(2,22,0) -#define GDK_KEY_Escape 0xff1b -#define GDK_KEY_Tab 0xff09 -#define GDK_KEY_ISO_Left_Tab 0xfe20 +#include "compat-key-syms.h" #endif namespace Inkscape { diff --git a/src/ui/tool/event-utils.cpp b/src/ui/tool/event-utils.cpp index 9d4b3e8e7..6b067a3ce 100644 --- a/src/ui/tool/event-utils.cpp +++ b/src/ui/tool/event-utils.cpp @@ -15,69 +15,7 @@ #include "ui/tool/event-utils.h" #if !GTK_CHECK_VERSION(2,22,0) -#define GDK_KEY_Up 0xff52 -#define GDK_KEY_KP_Up 0xff97 -#define GDK_KEY_Down 0xff54 -#define GDK_KEY_KP_Down 0xff99 -#define GDK_KEY_Left 0xff51 -#define GDK_KEY_KP_Left 0xff96 -#define GDK_KEY_Right 0xff53 -#define GDK_KEY_KP_Right 0xff98 -#define GDK_KEY_Home 0xff50 -#define GDK_KEY_KP_Home 0xff95 -#define GDK_KEY_End 0xff57 -#define GDK_KEY_KP_End 0xff9c -#define GDK_KEY_a 0x061 -#define GDK_KEY_A 0x041 -#define GDK_KEY_g 0x067 -#define GDK_KEY_G 0x047 -#define GDK_KEY_l 0x06c -#define GDK_KEY_L 0x04c -#define GDK_KEY_r 0x072 -#define GDK_KEY_R 0x052 -#define GDK_KEY_s 0x073 -#define GDK_KEY_S 0x053 -#define GDK_KEY_u 0x075 -#define GDK_KEY_U 0x055 -#define GDK_KEY_x 0x078 -#define GDK_KEY_X 0x058 -#define GDK_KEY_z 0x07a -#define GDK_KEY_Z 0x05a -#define GDK_KEY_Escape 0xff1b -#define GDK_KEY_Control_L 0xffe3 -#define GDK_KEY_Control_R 0xffe4 -#define GDK_KEY_Alt_L 0xffe9 -#define GDK_KEY_Alt_R 0xffea -#define GDK_KEY_Shift_L 0xffe1 -#define GDK_KEY_Shift_R 0xffe2 -#define GDK_KEY_Meta_L 0xffe7 -#define GDK_KEY_Meta_R 0xffe8 -#define GDK_KEY_KP_0 0xffb0 -#define GDK_KEY_KP_1 0xffb1 -#define GDK_KEY_KP_2 0xffb2 -#define GDK_KEY_KP_3 0xffb3 -#define GDK_KEY_KP_4 0xffb4 -#define GDK_KEY_KP_5 0xffb5 -#define GDK_KEY_KP_6 0xffb6 -#define GDK_KEY_KP_7 0xffb7 -#define GDK_KEY_KP_8 0xffb8 -#define GDK_KEY_KP_9 0xffb9 -#define GDK_KEY_Insert 0xff63 -#define GDK_KEY_KP_Insert 0xff9e -#define GDK_KEY_Delete 0xffff -#define GDK_KEY_KP_Delete 0xff9f -#define GDK_KEY_BackSpace 0xff08 -#define GDK_KEY_Return 0xff0d -#define GDK_KEY_KP_Enter 0xff8d -#define GDK_KEY_space 0x020 -#define GDK_KEY_Tab 0xff09 -#define GDK_KEY_ISO_Left_Tab 0xfe20 -#define GDK_KEY_bracketleft 0x05b -#define GDK_KEY_bracketright 0x05d -#define GDK_KEY_less 0x03c -#define GDK_KEY_greater 0x03e -#define GDK_KEY_comma 0x02c -#define GDK_KEY_period 0x02e +#include "compat-key-syms.h" #endif namespace Inkscape { diff --git a/src/ui/tool/modifier-tracker.cpp b/src/ui/tool/modifier-tracker.cpp index ea247d4fb..601c8334f 100644 --- a/src/ui/tool/modifier-tracker.cpp +++ b/src/ui/tool/modifier-tracker.cpp @@ -15,69 +15,7 @@ #include <gtk/gtk.h> #if !GTK_CHECK_VERSION(2,22,0) -#define GDK_KEY_Up 0xff52 -#define GDK_KEY_KP_Up 0xff97 -#define GDK_KEY_Down 0xff54 -#define GDK_KEY_KP_Down 0xff99 -#define GDK_KEY_Left 0xff51 -#define GDK_KEY_KP_Left 0xff96 -#define GDK_KEY_Right 0xff53 -#define GDK_KEY_KP_Right 0xff98 -#define GDK_KEY_Home 0xff50 -#define GDK_KEY_KP_Home 0xff95 -#define GDK_KEY_End 0xff57 -#define GDK_KEY_KP_End 0xff9c -#define GDK_KEY_a 0x061 -#define GDK_KEY_A 0x041 -#define GDK_KEY_g 0x067 -#define GDK_KEY_G 0x047 -#define GDK_KEY_l 0x06c -#define GDK_KEY_L 0x04c -#define GDK_KEY_r 0x072 -#define GDK_KEY_R 0x052 -#define GDK_KEY_s 0x073 -#define GDK_KEY_S 0x053 -#define GDK_KEY_u 0x075 -#define GDK_KEY_U 0x055 -#define GDK_KEY_x 0x078 -#define GDK_KEY_X 0x058 -#define GDK_KEY_z 0x07a -#define GDK_KEY_Z 0x05a -#define GDK_KEY_Escape 0xff1b -#define GDK_KEY_Control_L 0xffe3 -#define GDK_KEY_Control_R 0xffe4 -#define GDK_KEY_Alt_L 0xffe9 -#define GDK_KEY_Alt_R 0xffea -#define GDK_KEY_Shift_L 0xffe1 -#define GDK_KEY_Shift_R 0xffe2 -#define GDK_KEY_Meta_L 0xffe7 -#define GDK_KEY_Meta_R 0xffe8 -#define GDK_KEY_KP_0 0xffb0 -#define GDK_KEY_KP_1 0xffb1 -#define GDK_KEY_KP_2 0xffb2 -#define GDK_KEY_KP_3 0xffb3 -#define GDK_KEY_KP_4 0xffb4 -#define GDK_KEY_KP_5 0xffb5 -#define GDK_KEY_KP_6 0xffb6 -#define GDK_KEY_KP_7 0xffb7 -#define GDK_KEY_KP_8 0xffb8 -#define GDK_KEY_KP_9 0xffb9 -#define GDK_KEY_Insert 0xff63 -#define GDK_KEY_KP_Insert 0xff9e -#define GDK_KEY_Delete 0xffff -#define GDK_KEY_KP_Delete 0xff9f -#define GDK_KEY_BackSpace 0xff08 -#define GDK_KEY_Return 0xff0d -#define GDK_KEY_KP_Enter 0xff8d -#define GDK_KEY_space 0x020 -#define GDK_KEY_Tab 0xff09 -#define GDK_KEY_ISO_Left_Tab 0xfe20 -#define GDK_KEY_bracketleft 0x05b -#define GDK_KEY_bracketright 0x05d -#define GDK_KEY_less 0x03c -#define GDK_KEY_greater 0x03e -#define GDK_KEY_comma 0x02c -#define GDK_KEY_period 0x02e +#include "compat-key-syms.h" #endif namespace Inkscape { diff --git a/src/ui/tool/multi-path-manipulator.cpp b/src/ui/tool/multi-path-manipulator.cpp index 2be96afad..3fc202b69 100644 --- a/src/ui/tool/multi-path-manipulator.cpp +++ b/src/ui/tool/multi-path-manipulator.cpp @@ -32,112 +32,7 @@ #include <gdk/gdkkeysyms.h> #if !GTK_CHECK_VERSION(2,22,0) -#define GDK_KEY_VoidSymbol 0xffffff -#define GDK_KEY_Up 0xff52 -#define GDK_KEY_KP_Up 0xff97 -#define GDK_KEY_Down 0xff54 -#define GDK_KEY_KP_Down 0xff99 -#define GDK_KEY_Left 0xff51 -#define GDK_KEY_KP_Left 0xff96 -#define GDK_KEY_Right 0xff53 -#define GDK_KEY_KP_Right 0xff98 -#define GDK_KEY_Page_Up 0xff55 -#define GDK_KEY_KP_Page_Up 0xff9a -#define GDK_KEY_Page_Down 0xff56 -#define GDK_KEY_KP_Page_Down 0xff9b -#define GDK_KEY_Home 0xff50 -#define GDK_KEY_KP_Home 0xff95 -#define GDK_KEY_End 0xff57 -#define GDK_KEY_KP_End 0xff9c -#define GDK_KEY_a 0x061 -#define GDK_KEY_A 0x041 -#define GDK_KEY_b 0x062 -#define GDK_KEY_B 0x042 -#define GDK_KEY_c 0x063 -#define GDK_KEY_C 0x043 -#define GDK_KEY_d 0x064 -#define GDK_KEY_D 0x044 -#define GDK_KEY_g 0x067 -#define GDK_KEY_G 0x047 -#define GDK_KEY_h 0x068 -#define GDK_KEY_H 0x048 -#define GDK_KEY_i 0x069 -#define GDK_KEY_I 0x049 -#define GDK_KEY_j 0x06a -#define GDK_KEY_J 0x04a -#define GDK_KEY_k 0x06b -#define GDK_KEY_K 0x04b -#define GDK_KEY_l 0x06c -#define GDK_KEY_L 0x04c -#define GDK_KEY_q 0x071 -#define GDK_KEY_Q 0x051 -#define GDK_KEY_r 0x072 -#define GDK_KEY_R 0x052 -#define GDK_KEY_s 0x073 -#define GDK_KEY_S 0x053 -#define GDK_KEY_u 0x075 -#define GDK_KEY_U 0x055 -#define GDK_KEY_v 0x076 -#define GDK_KEY_V 0x056 -#define GDK_KEY_w 0x077 -#define GDK_KEY_W 0x057 -#define GDK_KEY_x 0x078 -#define GDK_KEY_X 0x058 -#define GDK_KEY_y 0x079 -#define GDK_KEY_Y 0x059 -#define GDK_KEY_z 0x07a -#define GDK_KEY_Z 0x05a -#define GDK_KEY_Escape 0xff1b -#define GDK_KEY_Control_L 0xffe3 -#define GDK_KEY_Control_R 0xffe4 -#define GDK_KEY_Alt_L 0xffe9 -#define GDK_KEY_Alt_R 0xffea -#define GDK_KEY_Shift_L 0xffe1 -#define GDK_KEY_Shift_R 0xffe2 -#define GDK_KEY_Meta_L 0xffe7 -#define GDK_KEY_Meta_R 0xffe8 -#define GDK_KEY_KP_0 0xffb0 -#define GDK_KEY_KP_1 0xffb1 -#define GDK_KEY_KP_2 0xffb2 -#define GDK_KEY_KP_3 0xffb3 -#define GDK_KEY_KP_4 0xffb4 -#define GDK_KEY_KP_5 0xffb5 -#define GDK_KEY_KP_6 0xffb6 -#define GDK_KEY_KP_7 0xffb7 -#define GDK_KEY_KP_8 0xffb8 -#define GDK_KEY_KP_9 0xffb9 -#define GDK_KEY_F1 0xffbe -#define GDK_KEY_F2 0xffbf -#define GDK_KEY_F3 0xffc0 -#define GDK_KEY_F4 0xffc1 -#define GDK_KEY_F5 0xffc2 -#define GDK_KEY_F6 0xffc3 -#define GDK_KEY_F7 0xffc4 -#define GDK_KEY_F8 0xffc5 -#define GDK_KEY_F9 0xffc6 -#define GDK_KEY_F10 0xffc7 -#define GDK_KEY_F11 0xffc8 -#define GDK_KEY_Insert 0xff63 -#define GDK_KEY_KP_Insert 0xff9e -#define GDK_KEY_Delete 0xffff -#define GDK_KEY_KP_Delete 0xff9f -#define GDK_KEY_BackSpace 0xff08 -#define GDK_KEY_Return 0xff0d -#define GDK_KEY_KP_Enter 0xff8d -#define GDK_KEY_space 0x020 -#define GDK_KEY_KP_Space 0xff80 -#define GDK_KEY_Tab 0xff09 -#define GDK_KEY_ISO_Left_Tab 0xfe20 -#define GDK_KEY_bracketleft 0x05b -#define GDK_KEY_bracketright 0x05d -#define GDK_KEY_braceleft 0x07b -#define GDK_KEY_braceright 0x07d -#define GDK_KEY_less 0x03c -#define GDK_KEY_greater 0x03e -#define GDK_KEY_comma 0x02c -#define GDK_KEY_period 0x02e -#define GDK_KEY_KP_Add 0xffab -#define GDK_KEY_KP_Subtract 0xffad +#include "compat-key-syms.h" #endif #ifdef USE_GNU_HASHES diff --git a/src/ui/tool/node-tool.cpp b/src/ui/tool/node-tool.cpp index 95cf7aebb..7127ae968 100644 --- a/src/ui/tool/node-tool.cpp +++ b/src/ui/tool/node-tool.cpp @@ -44,11 +44,7 @@ #include <gdk/gdkkeysyms.h> #if !GTK_CHECK_VERSION(2,22,0) -#define GDK_KEY_Escape 0xff1b -#define GDK_KEY_a 0x061 -#define GDK_KEY_A 0x041 -#define GDK_KEY_h 0x068 -#define GDK_KEY_H 0x048 +#include "compat-key-syms.h" #endif /** @struct InkNodeTool diff --git a/src/ui/tool/node.cpp b/src/ui/tool/node.cpp index 1d3acb4a5..ad48b523b 100644 --- a/src/ui/tool/node.cpp +++ b/src/ui/tool/node.cpp @@ -4,6 +4,7 @@ */ /* Authors: * Krzysztof KosiĆski <tweenk.pl@gmail.com> + * Jon A. Cruz <jon@joncruz.org> * * Copyright (C) 2009 Authors * Released under GNU GPL, read the file 'COPYING' for more information @@ -34,12 +35,7 @@ #include <gdk/gdkkeysyms.h> #if !GTK_CHECK_VERSION(2,22,0) -#define GDK_KEY_s 0x073 -#define GDK_KEY_S 0x053 -#define GDK_KEY_Page_Up 0xff55 -#define GDK_KEY_KP_Page_Up 0xff9a -#define GDK_KEY_Page_Down 0xff56 -#define GDK_KEY_KP_Page_Down 0xff9b +#include "compat-key-syms.h" #endif namespace Inkscape { @@ -96,20 +92,23 @@ Handle::Handle(NodeSharedData const &data, Geom::Point const &initial_pos, Node , _degenerate(true) { _cset = &handle_colors; - _handle_line = sp_canvas_item_new(data.handle_line_group, SP_TYPE_CTRLLINE, NULL); + _handle_line = SP_CTRLLINE(sp_canvas_item_new(data.handle_line_group, SP_TYPE_CTRLLINE, NULL)); setVisible(false); } Handle::~Handle() { //sp_canvas_item_hide(_handle_line); - gtk_object_destroy(GTK_OBJECT(_handle_line)); + gtk_object_destroy(_handle_line); } void Handle::setVisible(bool v) { ControlPoint::setVisible(v); - if (v) sp_canvas_item_show(_handle_line); - else sp_canvas_item_hide(_handle_line); + if (v) { + sp_canvas_item_show(_handle_line); + } else { + sp_canvas_item_hide(_handle_line); + } } void Handle::move(Geom::Point const &new_pos) @@ -186,7 +185,7 @@ void Handle::move(Geom::Point const &new_pos) void Handle::setPosition(Geom::Point const &p) { ControlPoint::setPosition(p); - sp_ctrlline_set_coords(SP_CTRLLINE(_handle_line), _parent->position(), position()); + _handle_line->setCoords(_parent->position(), position()); // update degeneration info and visibility if (Geom::are_near(position(), _parent->position())) diff --git a/src/ui/tool/node.h b/src/ui/tool/node.h index 94b67da59..f2e31e018 100644 --- a/src/ui/tool/node.h +++ b/src/ui/tool/node.h @@ -22,6 +22,7 @@ #include "snapped-point.h" #include "ui/tool/node-types.h" +struct SPCtrlLine; namespace Inkscape { namespace UI { @@ -113,7 +114,7 @@ private: inline PathManipulator &_pm(); Node *_parent; // the handle's lifetime does not extend beyond that of the parent node, // so a naked pointer is OK and allows setting it during Node's construction - SPCanvasItem *_handle_line; + SPCtrlLine *_handle_line; bool _degenerate; // True if the handle is retracted, i.e. has zero length. This is used often internally so it makes sense to cache this static Geom::Point _saved_other_pos; diff --git a/src/ui/tool/selector.cpp b/src/ui/tool/selector.cpp index 6820b7635..364776ce4 100644 --- a/src/ui/tool/selector.cpp +++ b/src/ui/tool/selector.cpp @@ -20,7 +20,7 @@ #include <gdk/gdkkeysyms.h> #if !GTK_CHECK_VERSION(2,22,0) -#define GDK_KEY_Escape 0xff1b +#include "compat-key-syms.h" #endif namespace Inkscape { diff --git a/src/ui/widget/imagetoggler.h b/src/ui/widget/imagetoggler.h index 54446230e..6389ce8af 100644 --- a/src/ui/widget/imagetoggler.h +++ b/src/ui/widget/imagetoggler.h @@ -10,6 +10,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#include <glibmm/property.h> #include <gtkmm/cellrendererpixbuf.h> #include <gtkmm/widget.h> diff --git a/src/ui/widget/licensor.cpp b/src/ui/widget/licensor.cpp index 4a4a67bf3..d31d4b759 100644 --- a/src/ui/widget/licensor.cpp +++ b/src/ui/widget/licensor.cpp @@ -26,6 +26,7 @@ #include "inkscape.h" #include "document-undo.h" #include "verbs.h" +#include <gtkmm/radiobutton.h> namespace Inkscape { diff --git a/src/ui/widget/object-composite-settings.cpp b/src/ui/widget/object-composite-settings.cpp index fd9d71d6a..eb4790990 100644 --- a/src/ui/widget/object-composite-settings.cpp +++ b/src/ui/widget/object-composite-settings.cpp @@ -63,7 +63,11 @@ ObjectCompositeSettings::ObjectCompositeSettings(unsigned int verb_code, char co _opacity_tag(Glib::ustring(history_prefix) + ":opacity"), _opacity_vbox(false, 0), _opacity_label(_("Opacity:")), +#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(flags), @@ -93,8 +97,13 @@ ObjectCompositeSettings::ObjectCompositeSettings(unsigned int verb_code, char co _opacity_hbox.pack_start(_opacity_hscale, true, true, 0); _opacity_hbox.pack_start(_opacity_spin_button, false, false, 0); _opacity_hscale.set_draw_value(false); +#if WITH_GTKMM_3_0 + _opacity_adjustment->signal_value_changed().connect(sigc::mem_fun(*this, &ObjectCompositeSettings::_opacityValueChanged)); + _opacity_label.set_mnemonic_widget(_opacity_hscale); +#else _opacity_adjustment.signal_value_changed().connect(sigc::mem_fun(*this, &ObjectCompositeSettings::_opacityValueChanged)); _opacity_label.set_mnemonic_widget(_opacity_hscale); +#endif /* SizeGroup keeps the blur and opacity labels aligned in Fill & Stroke dlg */ GtkSizeGroup *labels = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); @@ -216,7 +225,11 @@ ObjectCompositeSettings::_opacityValueChanged() 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()); _subject->setCSS(css); @@ -259,7 +272,11 @@ ObjectCompositeSettings::_subjectChanged() { case QUERY_STYLE_MULTIPLE_AVERAGED: // TODO: treat this slightly differently case QUERY_STYLE_MULTIPLE_SAME: _opacity_hbox.set_sensitive(true); +#if WITH_GTKMM_3_0 + _opacity_adjustment->set_value(100 * SP_SCALE24_TO_FLOAT(query->opacity.value)); +#else _opacity_adjustment.set_value(100 * SP_SCALE24_TO_FLOAT(query->opacity.value)); +#endif break; } diff --git a/src/ui/widget/object-composite-settings.h b/src/ui/widget/object-composite-settings.h index d05839a03..9f9b336eb 100644 --- a/src/ui/widget/object-composite-settings.h +++ b/src/ui/widget/object-composite-settings.h @@ -47,7 +47,11 @@ private: Gtk::VBox _opacity_vbox; Gtk::HBox _opacity_hbox; Gtk::Label _opacity_label; +#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/widget/page-sizer.h b/src/ui/widget/page-sizer.h index e52303254..17fd7b1ea 100644 --- a/src/ui/widget/page-sizer.h +++ b/src/ui/widget/page-sizer.h @@ -22,6 +22,7 @@ #include <gtkmm/liststore.h> #include <gtkmm/scrolledwindow.h> #include <gtkmm/table.h> +#include <gtkmm/radiobutton.h> namespace Inkscape { namespace XML { diff --git a/src/ui/widget/panel.cpp b/src/ui/widget/panel.cpp index 45c4e5f07..a1ae6a36d 100644 --- a/src/ui/widget/panel.cpp +++ b/src/ui/widget/panel.cpp @@ -20,6 +20,9 @@ #include <gtkmm/dialog.h> // for Gtk::RESPONSE_* #include <gtkmm/menu.h> #include <gtkmm/stock.h> +#include <gtkmm/radiobutton.h> +#include <gtkmm/radiomenuitem.h> +#include <gtkmm/separatormenuitem.h> #include <gtk/gtk.h> diff --git a/src/ui/widget/point.cpp b/src/ui/widget/point.cpp index 385b60122..6aa6196bb 100644 --- a/src/ui/widget/point.cpp +++ b/src/ui/widget/point.cpp @@ -53,7 +53,11 @@ 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 1d91549d6..15f1a80fb 100644 --- a/src/ui/widget/point.h +++ b/src/ui/widget/point.h @@ -82,7 +82,11 @@ 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.h b/src/ui/widget/preferences-widget.h index aad880ec7..874e0958a 100644 --- a/src/ui/widget/preferences-widget.h +++ b/src/ui/widget/preferences-widget.h @@ -21,6 +21,8 @@ #include "ui/widget/spinbutton.h" #include <stddef.h> #include <sigc++/sigc++.h> +#include <gtkmm/checkbutton.h> +#include <gtkmm/radiobutton.h> #include <gtkmm/comboboxtext.h> #include <gtkmm/drawingarea.h> #include <gtkmm/scale.h> diff --git a/src/ui/widget/random.cpp b/src/ui/widget/random.cpp index e8c84a780..0a646b6fb 100644 --- a/src/ui/widget/random.cpp +++ b/src/ui/widget/random.cpp @@ -47,7 +47,11 @@ 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 cb8c223dc..dc2b457c2 100644 --- a/src/ui/widget/random.h +++ b/src/ui/widget/random.h @@ -75,7 +75,11 @@ 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/registered-widget.cpp b/src/ui/widget/registered-widget.cpp index 747de4681..ea2bac867 100644 --- a/src/ui/widget/registered-widget.cpp +++ b/src/ui/widget/registered-widget.cpp @@ -18,6 +18,7 @@ #endif #include "registered-widget.h" +#include <gtkmm/radiobutton.h> #include "ui/widget/color-picker.h" #include "ui/widget/registry.h" diff --git a/src/ui/widget/scalar.cpp b/src/ui/widget/scalar.cpp index cc051599c..9bbcc80f9 100644 --- a/src/ui/widget/scalar.cpp +++ b/src/ui/widget/scalar.cpp @@ -43,7 +43,11 @@ 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, @@ -137,7 +141,11 @@ void Scalar::update() void Scalar::addSlider() { +#if WITH_GTKMM_3_0 + Gtk::HScale *scale = new Gtk::HScale(static_cast<SpinButton*>(_widget)->get_adjustment()); +#else Gtk::HScale *scale = new Gtk::HScale( * static_cast<SpinButton*>(_widget)->get_adjustment() ); +#endif scale->set_draw_value(false); add (*manage (scale)); } diff --git a/src/ui/widget/scalar.h b/src/ui/widget/scalar.h index 19ccb7ae0..86d7aee28 100644 --- a/src/ui/widget/scalar.h +++ b/src/ui/widget/scalar.h @@ -73,7 +73,11 @@ 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 d26005317..a60e3cc31 100644 --- a/src/ui/widget/selected-style.cpp +++ b/src/ui/widget/selected-style.cpp @@ -14,6 +14,7 @@ #endif #include "selected-style.h" +#include <gtkmm/separatormenuitem.h> #include "widgets/spw-utilities.h" #include "ui/widget/color-preview.h" @@ -129,7 +130,11 @@ 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 (), @@ -1041,7 +1046,11 @@ 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; } @@ -1141,7 +1150,11 @@ 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 diff --git a/src/ui/widget/selected-style.h b/src/ui/widget/selected-style.h index 0fe516321..542983b53 100644 --- a/src/ui/widget/selected-style.h +++ b/src/ui/widget/selected-style.h @@ -19,6 +19,8 @@ #include <gtkmm/menu.h> #include <gtkmm/menuitem.h> #include <gtkmm/adjustment.h> +#include <gtkmm/radiobuttongroup.h> +#include <gtkmm/radiomenuitem.h> #include "ui/widget/spinbutton.h" #include <stddef.h> @@ -134,7 +136,11 @@ 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-slider.cpp b/src/ui/widget/spin-slider.cpp index 3e85f845e..97ae18e20 100644 --- a/src/ui/widget/spin-slider.cpp +++ b/src/ui/widget/spin-slider.cpp @@ -10,6 +10,7 @@ #include <glib.h> #include <glibmm/i18n.h> +#include <glibmm/stringutils.h> #include "spin-slider.h" @@ -19,7 +20,12 @@ 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), _adjustment(value, lower, upper, step_inc), + : 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()); @@ -38,7 +44,11 @@ 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 if(_spin.get_digits() == 0) return Glib::Ascii::dtostr((int)val); @@ -49,32 +59,59 @@ 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 { return _adjustment; } +#if WITH_GTKMM_3_0 +Glib::RefPtr<Gtk::Adjustment> SpinSlider::get_adjustment() +#else Gtk::Adjustment& SpinSlider::get_adjustment() +#endif { return _adjustment; } @@ -112,9 +149,15 @@ 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); @@ -151,8 +194,13 @@ 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 c21b819ca..f4a62107b 100644 --- a/src/ui/widget/spin-slider.h +++ b/src/ui/widget/spin-slider.h @@ -13,6 +13,7 @@ #include <gtkmm/adjustment.h> #include <gtkmm/box.h> #include <gtkmm/scale.h> +#include <gtkmm/togglebutton.h> #include "spinbutton.h" #include "attr-widget.h" @@ -37,8 +38,13 @@ 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(); +#else const Gtk::Adjustment& get_adjustment() const; Gtk::Adjustment& get_adjustment(); +#endif const Gtk::HScale& get_scale() const; Gtk::HScale& get_scale(); @@ -49,7 +55,11 @@ public: // Change the SpinSlider into a SpinButton with AttrWidget support) void remove_scale(); private: +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> _adjustment; +#else Gtk::Adjustment _adjustment; +#endif Gtk::HScale _scale; Inkscape::UI::Widget::SpinButton _spin; }; diff --git a/src/ui/widget/spinbutton.cpp b/src/ui/widget/spinbutton.cpp index 8ba8d413d..7d6479923 100644 --- a/src/ui/widget/spinbutton.cpp +++ b/src/ui/widget/spinbutton.cpp @@ -18,9 +18,7 @@ #include "event-context.h" #if !GTK_CHECK_VERSION(2,22,0) -#define GDK_KEY_Escape 0xff1b -#define GDK_KEY_z 0x07a -#define GDK_KEY_Z 0x05a +#include "compat-key-syms.h" #endif namespace Inkscape { diff --git a/src/ui/widget/spinbutton.h b/src/ui/widget/spinbutton.h index b7764d979..57c48369e 100644 --- a/src/ui/widget/spinbutton.h +++ b/src/ui/widget/spinbutton.h @@ -33,7 +33,11 @@ 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) { diff --git a/src/ui/widget/tolerance-slider.cpp b/src/ui/widget/tolerance-slider.cpp index be710f5e5..16558f0ee 100644 --- a/src/ui/widget/tolerance-slider.cpp +++ b/src/ui/widget/tolerance-slider.cpp @@ -113,7 +113,11 @@ 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 adj->set_lower (1.0); adj->set_upper (51.0); diff --git a/src/ui/widget/zoom-status.cpp b/src/ui/widget/zoom-status.cpp index 579449744..aea1beb17 100644 --- a/src/ui/widget/zoom-status.cpp +++ b/src/ui/widget/zoom-status.cpp @@ -23,7 +23,11 @@ namespace UI { namespace Widget { ZoomStatus::ZoomStatus() +#if WITH_GTKMM_3_0 + : _adj(Gtk::Adjustment::create(0.0, -1.0, 1.0, 0.1, 0.1)) +#else : _adj(0.0, -1.0, 1.0, 0.1, 0.1) +#endif { _dt = 0; _upd_f = false; @@ -43,11 +47,19 @@ ZoomStatus::init(SPDesktop *dt) { _dt = dt; property_digits() = 4; +#if WITH_GTKMM_3_0 + _adj->set_value(0.0); + _adj->set_lower(log(SP_DESKTOP_ZOOM_MIN)/log(2.0)); + _adj->set_upper(log(SP_DESKTOP_ZOOM_MAX)/log(2.0)); + _adj->set_step_increment(0.1); + _adj->set_page_increment(0.1); +#else _adj.set_value(0.0); _adj.set_lower(log(SP_DESKTOP_ZOOM_MIN)/log(2.0)); _adj.set_upper(log(SP_DESKTOP_ZOOM_MAX)/log(2.0)); _adj.set_step_increment(0.1); _adj.set_page_increment(0.1); +#endif set_adjustment(_adj); } diff --git a/src/ui/widget/zoom-status.h b/src/ui/widget/zoom-status.h index b9373589f..8f710300a 100644 --- a/src/ui/widget/zoom-status.h +++ b/src/ui/widget/zoom-status.h @@ -9,6 +9,10 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ +#if HAVE_CONFIG_H +#include "config.h" +#endif + #include <gtkmm/adjustment.h> #include "ui/widget/spinbutton.h" @@ -32,7 +36,11 @@ public: void update(); protected: +#if WITH_GTKMM_3_0 + Glib::RefPtr<Gtk::Adjustment> _adj; +#else Gtk::Adjustment _adj; +#endif SPDesktop *_dt; bool _upd_f; |
