summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDenis Declara <declara91@gmail.com>2012-05-05 13:32:42 +0000
committerDenis Declara <declara91@gmail.com>2012-05-05 13:32:42 +0000
commitaeb9c1bde66de096910757abb17dedb94ad74207 (patch)
treec0adf97685b0fa8af1553b14d20601f280492762 /src
parentFixed some math, so that the objects now line up correctly (diff)
parentAdding checks to prevent null pointer dereferences (diff)
downloadinkscape-aeb9c1bde66de096910757abb17dedb94ad74207.tar.gz
inkscape-aeb9c1bde66de096910757abb17dedb94ad74207.zip
Trunk merge
(bzr r11073.1.29)
Diffstat (limited to 'src')
-rw-r--r--src/2geom/piecewise.h11
-rw-r--r--src/Makefile_insert1
-rw-r--r--src/arc-context.cpp17
-rw-r--r--src/box3d-context.cpp23
-rw-r--r--src/compat-key-syms.h144
-rw-r--r--src/connector-context.cpp5
-rw-r--r--src/desktop-events.cpp64
-rw-r--r--src/desktop.cpp2
-rw-r--r--src/dialogs/dialog-events.cpp101
-rw-r--r--src/dialogs/dialog-events.h4
-rw-r--r--src/dialogs/find.cpp10
-rw-r--r--src/display/guideline.cpp7
-rw-r--r--src/display/sp-canvas-item.h29
-rw-r--r--src/display/sp-canvas.cpp33
-rw-r--r--src/display/sp-ctrlline.cpp125
-rw-r--r--src/display/sp-ctrlline.h25
-rw-r--r--src/document-undo.cpp2
-rw-r--r--src/document-undo.h4
-rw-r--r--src/draw-anchor.cpp18
-rw-r--r--src/draw-context.cpp267
-rw-r--r--src/draw-context.h42
-rw-r--r--src/dropper-context.cpp6
-rw-r--r--src/dyna-draw-context.cpp20
-rw-r--r--src/ege-adjustment-action.cpp68
-rw-r--r--src/eraser-context.cpp20
-rw-r--r--src/event-context.cpp94
-rw-r--r--src/event-context.h8
-rw-r--r--src/extension/dependency.cpp30
-rw-r--r--src/extension/error-file.cpp2
-rw-r--r--src/extension/implementation/script.cpp12
-rw-r--r--src/extension/internal/emf-win32-inout.cpp6
-rw-r--r--src/extension/internal/pdf-input-cairo.cpp11
-rw-r--r--src/extension/internal/pdf-input-cairo.h4
-rw-r--r--src/extension/internal/pdfinput/pdf-input.cpp11
-rw-r--r--src/extension/internal/pdfinput/pdf-input.h4
-rw-r--r--src/extension/param/bool.cpp1
-rw-r--r--src/extension/param/float.cpp15
-rw-r--r--src/extension/param/int.cpp15
-rw-r--r--src/extension/param/radiobutton.cpp8
-rw-r--r--src/extension/prefdialog.cpp2
-rw-r--r--src/extension/system.cpp25
-rw-r--r--src/flood-context.cpp85
-rw-r--r--src/gradient-chemistry.cpp10
-rw-r--r--src/gradient-context.cpp47
-rw-r--r--src/gradient-drag.cpp26
-rw-r--r--src/inkview.cpp107
-rw-r--r--src/interface.cpp86
-rw-r--r--src/knot-holder-entity.cpp15
-rw-r--r--src/knot-holder-entity.h12
-rw-r--r--src/knot.cpp2
-rw-r--r--src/knotholder.cpp63
-rw-r--r--src/knotholder.h9
-rw-r--r--src/libnrtype/font-lister.h1
-rw-r--r--src/line-geometry.cpp9
-rw-r--r--src/live_effects/lpe-angle_bisector.cpp10
-rw-r--r--src/live_effects/lpe-copy_rotate.cpp13
-rw-r--r--src/live_effects/lpe-knot.cpp15
-rw-r--r--src/live_effects/lpe-parallel.cpp13
-rw-r--r--src/live_effects/lpe-perp_bisector.cpp10
-rw-r--r--src/live_effects/lpe-perspective_path.cpp14
-rw-r--r--src/live_effects/lpe-powerstroke.cpp9
-rw-r--r--src/live_effects/lpe-tangent_to_curve.cpp15
-rw-r--r--src/live_effects/parameter/point.cpp2
-rw-r--r--src/live_effects/parameter/powerstrokepointarray.cpp13
-rw-r--r--src/live_effects/parameter/vector.cpp4
-rw-r--r--src/main.cpp3
-rw-r--r--src/measure-context.cpp17
-rw-r--r--src/object-edit.cpp82
-rw-r--r--src/object-edit.h14
-rw-r--r--src/object-snapper.cpp4
-rw-r--r--src/pen-context.cpp304
-rw-r--r--src/pen-context.h8
-rw-r--r--src/pencil-context.cpp49
-rw-r--r--src/preferences-skeleton.h1
-rw-r--r--src/rect-context.cpp54
-rw-r--r--src/select-context.cpp64
-rw-r--r--src/selection-chemistry.cpp113
-rw-r--r--src/seltrans.cpp8
-rw-r--r--src/seltrans.h3
-rw-r--r--src/shape-editor.cpp4
-rw-r--r--src/shortcuts.cpp4
-rw-r--r--src/sp-item-group.cpp2
-rw-r--r--src/sp-item.cpp22
-rw-r--r--src/sp-use.cpp10
-rw-r--r--src/spiral-context.cpp64
-rw-r--r--src/spray-context.cpp90
-rw-r--r--src/star-context.cpp64
-rw-r--r--src/style.cpp91
-rw-r--r--src/style.h20
-rw-r--r--src/text-context.cpp113
-rw-r--r--src/text-context.h3
-rw-r--r--src/tweak-context.cpp57
-rw-r--r--src/ui/CMakeLists.txt2
-rw-r--r--src/ui/Makefile_insert2
-rw-r--r--src/ui/clipboard.cpp37
-rw-r--r--src/ui/control-manager.cpp260
-rw-r--r--src/ui/control-manager.h61
-rw-r--r--src/ui/dialog/behavior.h2
-rw-r--r--src/ui/dialog/calligraphic-profile-rename.cpp2
-rw-r--r--src/ui/dialog/clonetiler.cpp57
-rw-r--r--src/ui/dialog/debug.cpp2
-rw-r--r--src/ui/dialog/dialog.cpp8
-rw-r--r--src/ui/dialog/dialog.h4
-rw-r--r--src/ui/dialog/export.cpp41
-rw-r--r--src/ui/dialog/export.h41
-rw-r--r--src/ui/dialog/filedialogimpl-gtkmm.h1
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp20
-rw-r--r--src/ui/dialog/find.cpp27
-rw-r--r--src/ui/dialog/floating-behavior.cpp19
-rw-r--r--src/ui/dialog/floating-behavior.h5
-rw-r--r--src/ui/dialog/guides.cpp2
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp45
-rw-r--r--src/ui/dialog/inkscape-preferences.h1
-rw-r--r--src/ui/dialog/layer-properties.cpp2
-rw-r--r--src/ui/dialog/livepatheffect-add.cpp2
-rw-r--r--src/ui/dialog/messages.h1
-rw-r--r--src/ui/dialog/panel-dialog.h4
-rw-r--r--src/ui/dialog/undo-history.h1
-rw-r--r--src/ui/dialog/xml-tree.cpp3
-rw-r--r--src/ui/previewholder.cpp27
-rw-r--r--src/ui/tool/control-point-selection.cpp101
-rw-r--r--src/ui/tool/control-point.cpp4
-rw-r--r--src/ui/tool/event-utils.cpp64
-rw-r--r--src/ui/tool/modifier-tracker.cpp64
-rw-r--r--src/ui/tool/multi-path-manipulator.cpp107
-rw-r--r--src/ui/tool/node-tool.cpp6
-rw-r--r--src/ui/tool/node.cpp21
-rw-r--r--src/ui/tool/node.h3
-rw-r--r--src/ui/tool/selector.cpp2
-rw-r--r--src/ui/widget/imagetoggler.h1
-rw-r--r--src/ui/widget/licensor.cpp1
-rw-r--r--src/ui/widget/object-composite-settings.cpp17
-rw-r--r--src/ui/widget/object-composite-settings.h4
-rw-r--r--src/ui/widget/page-sizer.h1
-rw-r--r--src/ui/widget/panel.cpp3
-rw-r--r--src/ui/widget/point.cpp4
-rw-r--r--src/ui/widget/point.h4
-rw-r--r--src/ui/widget/preferences-widget.h2
-rw-r--r--src/ui/widget/random.cpp4
-rw-r--r--src/ui/widget/random.h4
-rw-r--r--src/ui/widget/registered-widget.cpp1
-rw-r--r--src/ui/widget/scalar.cpp8
-rw-r--r--src/ui/widget/scalar.h4
-rw-r--r--src/ui/widget/selected-style.cpp13
-rw-r--r--src/ui/widget/selected-style.h6
-rw-r--r--src/ui/widget/spin-slider.cpp50
-rw-r--r--src/ui/widget/spin-slider.h10
-rw-r--r--src/ui/widget/spinbutton.cpp4
-rw-r--r--src/ui/widget/spinbutton.h4
-rw-r--r--src/ui/widget/tolerance-slider.cpp4
-rw-r--r--src/ui/widget/zoom-status.cpp12
-rw-r--r--src/ui/widget/zoom-status.h8
-rw-r--r--src/vanishing-point.cpp18
-rw-r--r--src/verbs.cpp3
-rw-r--r--src/widgets/dash-selector.cpp10
-rw-r--r--src/widgets/dash-selector.h4
-rw-r--r--src/widgets/desktop-widget.cpp29
-rw-r--r--src/widgets/font-selector.cpp2
-rw-r--r--src/widgets/gradient-toolbar.cpp223
-rw-r--r--src/widgets/paint-selector.cpp6
-rw-r--r--src/widgets/ruler.cpp91
-rw-r--r--src/widgets/ruler.h10
-rw-r--r--src/widgets/select-toolbar.cpp5
-rw-r--r--src/widgets/stroke-style.cpp18
-rw-r--r--src/widgets/toolbox.cpp7
-rw-r--r--src/zoom-context.cpp8
166 files changed, 2068 insertions, 2740 deletions
diff --git a/src/2geom/piecewise.h b/src/2geom/piecewise.h
index 837f33ea7..e3b4d3456 100644
--- a/src/2geom/piecewise.h
+++ b/src/2geom/piecewise.h
@@ -783,10 +783,13 @@ Piecewise<T> compose(Piecewise<T> const &f, SBasis const &g){
double t0=(*cut).first;
double t1=(*next).first;
- SBasis sub_g=compose(g, Linear(t0,t1));
- sub_g=compose(Linear(-f.cuts[idx]/(f.cuts[idx+1]-f.cuts[idx]),
- (1-f.cuts[idx])/(f.cuts[idx+1]-f.cuts[idx])),sub_g);
- result.push(compose(f[idx],sub_g),t1);
+ if (!are_near(t0,t1,EPSILON*EPSILON)) { // prevent adding cuts that are extremely close together and that may cause trouble with rounding e.g. when reversing the path
+ SBasis sub_g=compose(g, Linear(t0,t1));
+ sub_g=compose(Linear(-f.cuts[idx]/(f.cuts[idx+1]-f.cuts[idx]),
+ (1-f.cuts[idx])/(f.cuts[idx+1]-f.cuts[idx])),sub_g);
+ result.push(compose(f[idx],sub_g),t1);
+ }
+
cut++;
next++;
}
diff --git a/src/Makefile_insert b/src/Makefile_insert
index 15659152c..e9c149cb2 100644
--- a/src/Makefile_insert
+++ b/src/Makefile_insert
@@ -22,6 +22,7 @@ ink_common_sources += \
color-profile-cms-fns.h \
color-rgba.h \
common-context.cpp common-context.h \
+ compat-key-syms.h \
composite-undo-stack-observer.cpp \
composite-undo-stack-observer.h \
conditions.cpp conditions.h \
diff --git a/src/arc-context.cpp b/src/arc-context.cpp
index ceea63c05..b913ab9f0 100644
--- a/src/arc-context.cpp
+++ b/src/arc-context.cpp
@@ -50,22 +50,7 @@
// Define new form of key macros if we're using an old GTK+ version
#if !GTK_CHECK_VERSION(2,22,0)
-#define GDK_KEY_Alt_L 0xffe9
-#define GDK_KEY_Alt_R 0xffea
-#define GDK_KEY_Control_L 0xffe3
-#define GDK_KEY_Control_R 0xffe4
-#define GDK_KEY_Meta_L 0xffe7
-#define GDK_KEY_Meta_R 0xffe8
-#define GDK_KEY_Shift_L 0xffe1
-#define GDK_KEY_Shift_R 0xffe2
-#define GDK_KEY_Up 0xff52
-#define GDK_KEY_Down 0xff54
-#define GDK_KEY_KP_Up 0xff97
-#define GDK_KEY_KP_Down 0xff99
-#define GDK_KEY_x 0x078
-#define GDK_KEY_X 0x058
-#define GDK_KEY_Escape 0xff1b
-#define GDK_KEY_space 0x020
+#include "compat-key-syms.h"
#endif
using Inkscape::DocumentUndo;
diff --git a/src/box3d-context.cpp b/src/box3d-context.cpp
index 2ffef98e1..5a94e3c68 100644
--- a/src/box3d-context.cpp
+++ b/src/box3d-context.cpp
@@ -52,28 +52,7 @@
#include "verbs.h"
#if !GTK_CHECK_VERSION(2,22,0)
-#define GDK_KEY_Up 0xff52
-#define GDK_KEY_Down 0xff54
-#define GDK_KEY_KP_Up 0xff97
-#define GDK_KEY_KP_Down 0xff99
-#define GDK_KEY_bracketright 0x05d
-#define GDK_KEY_bracketleft 0x05b
-#define GDK_KEY_parenright 0x029
-#define GDK_KEY_parenleft 0x028
-#define GDK_KEY_braceright 0x07d
-#define GDK_KEY_braceleft 0x07b
-#define GDK_KEY_G 0x047
-#define GDK_KEY_g 0x067
-#define GDK_KEY_p 0x070
-#define GDK_KEY_P 0x050
-#define GDK_KEY_X 0x058
-#define GDK_KEY_x 0x078
-#define GDK_KEY_y 0x079
-#define GDK_KEY_Y 0x059
-#define GDK_KEY_Z 0x05a
-#define GDK_KEY_z 0x07a
-#define GDK_KEY_Escape 0xff1b
-#define GDK_KEY_space 0x020
+#include "compat-key-syms.h"
#endif
using Inkscape::DocumentUndo;
diff --git a/src/compat-key-syms.h b/src/compat-key-syms.h
new file mode 100644
index 000000000..5a4b470ba
--- /dev/null
+++ b/src/compat-key-syms.h
@@ -0,0 +1,144 @@
+/*
+ * Compatible key defines for earlier GTK+.
+ *
+ *
+ * Authors:
+ * Jon A. Cruz <jon@joncruz.org>
+ *
+ * Copyright (C) 20012 Authors
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+#ifndef COMPAT_KEY_SYMS_H_SEEN
+#define COMPAT_KEY_SYMS_H_SEEN
+
+#if !GTK_CHECK_VERSION(2,22,0)
+
+#define GDK_KEY_Up 0xff52
+#define GDK_KEY_KP_Up 0xff97
+#define GDK_KEY_Page_Up 0xff55
+#define GDK_KEY_KP_Page_Up 0xff9a
+#define GDK_KEY_Down 0xff54
+#define GDK_KEY_KP_Down 0xff99
+#define GDK_KEY_Page_Down 0xff56
+#define GDK_KEY_KP_Page_Down 0xff9b
+#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_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_M 0x04d
+#define GDK_KEY_m 0x06d
+
+#define GDK_KEY_P 0x050
+#define GDK_KEY_p 0x070
+#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_Add 0xffab
+#define GDK_KEY_KP_Subtract 0xffad
+#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_parenright 0x029
+#define GDK_KEY_parenleft 0x028
+#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_0 0x030
+#define GDK_KEY_1 0x031
+#define GDK_KEY_2 0x032
+#define GDK_KEY_3 0x033
+#define GDK_KEY_4 0x034
+#define GDK_KEY_5 0x035
+#define GDK_KEY_6 0x036
+#define GDK_KEY_7 0x037
+#define GDK_KEY_8 0x038
+#define GDK_KEY_9 0x039
+
+#define GDK_KEY_VoidSymbol 0xffffff
+
+#endif // !GTK_CHECK_VERSION(2,22,0)
+
+#endif // COMPAT_KEY_SYMS_H_SEEN
diff --git a/src/connector-context.cpp b/src/connector-context.cpp
index d3ad81134..daea4a0ac 100644
--- a/src/connector-context.cpp
+++ b/src/connector-context.cpp
@@ -195,10 +195,7 @@
using Inkscape::DocumentUndo;
#if !GTK_CHECK_VERSION(2,22,0)
-#define GDK_KEY_Return 0xff0d
-#define GDK_KEY_KP_Enter 0xff8d
-#define GDK_KEY_Escape 0xff1b
-#define GDK_KEY_Delete 0xffff
+#include "compat-key-syms.h"
#endif
static void sp_connector_context_class_init(SPConnectorContextClass *klass);
diff --git a/src/desktop-events.cpp b/src/desktop-events.cpp
index 15c04fa1f..513e8347b 100644
--- a/src/desktop-events.cpp
+++ b/src/desktop-events.cpp
@@ -48,69 +48,7 @@
#include "xml/repr.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
using Inkscape::DocumentUndo;
diff --git a/src/desktop.cpp b/src/desktop.cpp
index f7a060670..10bf355c7 100644
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
@@ -1403,7 +1403,7 @@ void SPDesktop::setWaitingCursor()
GdkCursor *waiting = gdk_cursor_new(GDK_WATCH);
gdk_window_set_cursor(gtk_widget_get_window(GTK_WIDGET(sp_desktop_canvas(this))), waiting);
#if GTK_CHECK_VERSION(3,0,0)
- g_cursor_unref(waiting);
+ g_object_unref(waiting);
#else
gdk_cursor_unref(waiting);
#endif
diff --git a/src/dialogs/dialog-events.cpp b/src/dialogs/dialog-events.cpp
index 70899d4d7..fe897974c 100644
--- a/src/dialogs/dialog-events.cpp
+++ b/src/dialogs/dialog-events.cpp
@@ -28,102 +28,7 @@
#include "dialog-events.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_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_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
@@ -315,7 +220,7 @@ void on_dialog_unhide (GtkWidget *w)
}
gboolean
-sp_dialog_hide (GtkObject */*object*/, gpointer data)
+sp_dialog_hide(GObject * /*object*/, gpointer data)
{
GtkWidget *dlg = (GtkWidget *) data;
@@ -328,7 +233,7 @@ sp_dialog_hide (GtkObject */*object*/, gpointer data)
gboolean
-sp_dialog_unhide (GtkObject */*object*/, gpointer data)
+sp_dialog_unhide(GObject * /*object*/, gpointer data)
{
GtkWidget *dlg = (GtkWidget *) data;
diff --git a/src/dialogs/dialog-events.h b/src/dialogs/dialog-events.h
index 50c3eaabb..5ba2d62c9 100644
--- a/src/dialogs/dialog-events.h
+++ b/src/dialogs/dialog-events.h
@@ -61,8 +61,8 @@ void sp_transientize_callback ( Inkscape::Application *inkscape,
void on_dialog_hide (GtkWidget *w);
void on_dialog_unhide (GtkWidget *w);
-gboolean sp_dialog_hide (GtkObject *object, gpointer data);
-gboolean sp_dialog_unhide (GtkObject *object, gpointer data);
+gboolean sp_dialog_hide (GObject *object, gpointer data);
+gboolean sp_dialog_unhide (GObject *object, gpointer data);
#endif
diff --git a/src/dialogs/find.cpp b/src/dialogs/find.cpp
index 3bd22b8eb..8653e42ae 100644
--- a/src/dialogs/find.cpp
+++ b/src/dialogs/find.cpp
@@ -555,7 +555,7 @@ sp_find_types ()
{
#if GTK_CHECK_VERSION(3,0,0)
GtkWidget *vb = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
- gtk_box_new(GTK_BOX(vb), FALSE);
+ gtk_box_set_homogeneous(GTK_BOX(vb), FALSE);
#else
GtkWidget *vb = gtk_vbox_new (FALSE, 4);
#endif
@@ -587,7 +587,7 @@ sp_find_types ()
{
#if GTK_CHECK_VERSION(3,0,0)
GtkWidget *vb_all = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
- gtk_box_new(GTK_BOX(vb_all), FALSE);
+ gtk_box_set_homogeneous(GTK_BOX(vb_all), FALSE);
#else
GtkWidget *vb_all = gtk_vbox_new (FALSE, 0);
#endif
@@ -735,7 +735,7 @@ sp_find_dialog_old (void)
/* Toplevel vbox */
#if GTK_CHECK_VERSION(3,0,0)
GtkWidget *vb = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
- gtk_box_new(GTK_BOX(vb), FALSE);
+ gtk_box_set_homogeneous(GTK_BOX(vb), FALSE);
#else
GtkWidget *vb = gtk_vbox_new (FALSE, 0);
#endif
@@ -753,7 +753,11 @@ sp_find_dialog_old (void)
gtk_box_pack_start (GTK_BOX (vb), types, FALSE, FALSE, 0);
{
+#if GTK_CHECK_VERSION(3,0,0)
+ GtkWidget *w = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL);
+#else
GtkWidget *w = gtk_hseparator_new ();
+#endif
gtk_widget_show (w);
gtk_box_pack_start (GTK_BOX (vb), w, FALSE, FALSE, 3);
diff --git a/src/display/guideline.cpp b/src/display/guideline.cpp
index dad989655..652f4e2d7 100644
--- a/src/display/guideline.cpp
+++ b/src/display/guideline.cpp
@@ -5,6 +5,7 @@
* Lauris Kaplinski <lauris@kaplinski.com>
* Johan Engelen
* Maximilian Albert <maximilian.albert@gmail.com>
+ * Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 2000-2002 Lauris Kaplinski
* Copyright (C) 2007 Johan Engelen
@@ -24,6 +25,9 @@
#include "desktop.h"
#include "sp-namedview.h"
#include "display/sp-canvas.h"
+#include "ui/control-manager.h"
+
+using Inkscape::ControlManager;
static void sp_guideline_class_init(SPGuideLineClass *c);
static void sp_guideline_init(SPGuideLine *guideline);
@@ -228,7 +232,8 @@ static double sp_guideline_point(SPCanvasItem *item, Geom::Point p, SPCanvasItem
SPCanvasItem *sp_guideline_new(SPCanvasGroup *parent, char* label, Geom::Point point_on_line, Geom::Point normal)
{
SPCanvasItem *item = sp_canvas_item_new(parent, SP_TYPE_GUIDELINE, NULL);
- SPCanvasItem *origin = sp_canvas_item_new(parent, SP_TYPE_CTRLPOINT, NULL);
+ SPCanvasItem *origin = ControlManager::getManager().createControl(parent, Inkscape::CTRL_TYPE_ORIGIN);
+ ControlManager::getManager().track(origin);
SPGuideLine *gl = SP_GUIDELINE(item);
SPCtrlPoint *cp = SP_CTRLPOINT(origin);
diff --git a/src/display/sp-canvas-item.h b/src/display/sp-canvas-item.h
index 0a6d343b2..8baa09401 100644
--- a/src/display/sp-canvas-item.h
+++ b/src/display/sp-canvas-item.h
@@ -41,6 +41,23 @@ typedef struct _SPCanvasItemClass SPCanvasItemClass;
#define SP_IS_CANVAS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), SP_TYPE_CANVAS_ITEM))
#define SP_CANVAS_ITEM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), SP_TYPE_CANVAS_ITEM, SPCanvasItemClass))
+namespace Inkscape
+{
+
+// Rough initial set. Most likely needs refinement.
+enum ControlType {
+ CTRL_TYPE_UNKNOWN,
+ CTRL_TYPE_ADJ_HANDLE,
+ CTRL_TYPE_ANCHOR,
+ CTRL_TYPE_POINT,
+ CTRL_TYPE_ROTATE,
+ CTRL_TYPE_SIZER,
+ CTRL_TYPE_SHAPER,
+ CTRL_TYPE_ORIGIN
+};
+
+} // namespace Inkscape
+
/**
* An SPCanvasItem refers to a SPCanvas and to its parent item; it has
* four coordinates, a bounding rectangle, and a transformation matrix.
@@ -51,10 +68,15 @@ struct SPCanvasItem : public GtkObject {
SPCanvas *canvas;
SPCanvasItem *parent;
- double x1, y1, x2, y2;
+ double x1;
+ double y1;
+ double x2;
+ double y2;
Geom::Rect bounds;
Geom::Affine xform;
-
+
+ Inkscape::ControlType ctrlType;
+
// Replacement for custom GtkObject flag enumeration
gboolean visible;
gboolean need_update;
@@ -74,6 +96,9 @@ struct _SPCanvasItemClass : public GtkObjectClass {
void (* viewbox_changed) (SPCanvasItem *item, Geom::IntRect const &new_area);
};
+/**
+ * Constructs new SPCanvasItem on SPCanvasGroup.
+ */
SPCanvasItem *sp_canvas_item_new(SPCanvasGroup *parent, GType type, const gchar *first_arg_name, ...);
G_END_DECLS
diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp
index 0f650bf4a..22aad2442 100644
--- a/src/display/sp-canvas.cpp
+++ b/src/display/sp-canvas.cpp
@@ -405,31 +405,30 @@ void sp_canvas_item_class_init(SPCanvasItemClass *klass)
void sp_canvas_item_init(SPCanvasItem *item)
{
+ item->xform = Geom::Affine(Geom::identity());
+ item->ctrlType = Inkscape::CTRL_TYPE_UNKNOWN;
+
// TODO items should not be visible on creation - this causes kludges with items
// that should be initially invisible; examples of such items: node handles, the CtrlRect
// used for rubberbanding, path outline, etc.
item->visible = TRUE;
- item->xform = Geom::Affine(Geom::identity());
}
} // namespace
-/**
- * Constructs new SPCanvasItem on SPCanvasGroup.
- */
SPCanvasItem *sp_canvas_item_new(SPCanvasGroup *parent, GType type, gchar const *first_arg_name, ...)
{
va_list args;
g_return_val_if_fail(parent != NULL, NULL);
- g_return_val_if_fail(SP_IS_CANVAS_GROUP (parent), NULL);
+ g_return_val_if_fail(SP_IS_CANVAS_GROUP(parent), NULL);
g_return_val_if_fail(g_type_is_a(type, SPCanvasItem::getType()), NULL);
- SPCanvasItem *item = SP_CANVAS_ITEM (g_object_new (type, NULL));
+ SPCanvasItem *item = SP_CANVAS_ITEM(g_object_new(type, NULL));
- va_start (args, first_arg_name);
- sp_canvas_item_construct (item, parent, first_arg_name, args);
- va_end (args);
+ va_start(args, first_arg_name);
+ sp_canvas_item_construct(item, parent, first_arg_name, args);
+ va_end(args);
return item;
}
@@ -438,17 +437,17 @@ namespace {
void sp_canvas_item_construct(SPCanvasItem *item, SPCanvasGroup *parent, gchar const *first_arg_name, va_list args)
{
- g_return_if_fail (SP_IS_CANVAS_GROUP (parent));
- g_return_if_fail (SP_IS_CANVAS_ITEM (item));
+ g_return_if_fail(SP_IS_CANVAS_GROUP(parent));
+ g_return_if_fail(SP_IS_CANVAS_ITEM(item));
- item->parent = SP_CANVAS_ITEM (parent);
+ item->parent = SP_CANVAS_ITEM(parent);
item->canvas = item->parent->canvas;
- g_object_set_valist (G_OBJECT (item), first_arg_name, args);
+ g_object_set_valist(G_OBJECT(item), first_arg_name, args);
SP_CANVAS_GROUP(item->parent)->add(item);
- sp_canvas_item_request_update (item);
+ sp_canvas_item_request_update(item);
}
} // namespace
@@ -458,7 +457,7 @@ void sp_canvas_item_construct(SPCanvasItem *item, SPCanvasGroup *parent, gchar c
*/
static void redraw_if_visible(SPCanvasItem *item)
{
- if(item->visible) {
+ if (item->visible) {
int x0 = (int)(item->x1);
int x1 = (int)(item->x2);
int y0 = (int)(item->y1);
@@ -528,11 +527,11 @@ static void sp_canvas_item_invoke_update(SPCanvasItem *item, Geom::Affine const
// apply object flags to child flags
int child_flags = flags & ~SP_CANVAS_UPDATE_REQUESTED;
- if(item->need_update) {
+ if (item->need_update) {
child_flags |= SP_CANVAS_UPDATE_REQUESTED;
}
- if(item->need_affine) {
+ if (item->need_affine) {
child_flags |= SP_CANVAS_UPDATE_AFFINE;
}
diff --git a/src/display/sp-ctrlline.cpp b/src/display/sp-ctrlline.cpp
index 3175baf96..11d0b34f8 100644
--- a/src/display/sp-ctrlline.cpp
+++ b/src/display/sp-ctrlline.cpp
@@ -28,82 +28,82 @@
#include "color.h"
#include "display/sp-canvas.h"
+namespace {
-static void sp_ctrlline_class_init (SPCtrlLineClass *klass);
-static void sp_ctrlline_init (SPCtrlLine *ctrlline);
-static void sp_ctrlline_destroy (GtkObject *object);
+void sp_ctrlline_class_init(SPCtrlLineClass *klass, gpointer data);
+void sp_ctrlline_init(SPCtrlLine *ctrlline, gpointer g_class);
+void sp_ctrlline_destroy(GtkObject *object);
-static void sp_ctrlline_update (SPCanvasItem *item, Geom::Affine const &affine, unsigned int flags);
-static void sp_ctrlline_render (SPCanvasItem *item, SPCanvasBuf *buf);
+void sp_ctrlline_update(SPCanvasItem *item, Geom::Affine const &affine, unsigned int flags);
+void sp_ctrlline_render(SPCanvasItem *item, SPCanvasBuf *buf);
-static SPCanvasItemClass *parent_class;
+SPCanvasItemClass *parent_class = 0;
-GType
-sp_ctrlline_get_type (void)
+} // namespace
+
+GType SPCtrlLine::getType()
{
static GType type = 0;
if (!type) {
GTypeInfo info = {
sizeof(SPCtrlLineClass),
NULL, NULL,
- (GClassInitFunc) sp_ctrlline_class_init,
+ reinterpret_cast<GClassInitFunc>(sp_ctrlline_class_init),
NULL, NULL,
sizeof(SPCtrlLine),
0,
- (GInstanceInitFunc) sp_ctrlline_init,
+ reinterpret_cast<GInstanceInitFunc>(sp_ctrlline_init),
NULL
};
- type = g_type_register_static(SP_TYPE_CANVAS_ITEM, "SPCtrlLine", &info, (GTypeFlags)0);
+ type = g_type_register_static(SP_TYPE_CANVAS_ITEM, "SPCtrlLine", &info, static_cast<GTypeFlags>(0));
}
return type;
}
-static void
-sp_ctrlline_class_init (SPCtrlLineClass *klass)
-{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
- SPCanvasItemClass *item_class = (SPCanvasItemClass *) klass;
+namespace {
- parent_class = (SPCanvasItemClass*)g_type_class_peek_parent (klass);
+void sp_ctrlline_class_init(SPCtrlLineClass *klass, gpointer /*data*/)
+{
+ parent_class = reinterpret_cast<SPCanvasItemClass*>(g_type_class_peek_parent(klass));
- object_class->destroy = sp_ctrlline_destroy;
+ klass->destroy = sp_ctrlline_destroy;
- item_class->update = sp_ctrlline_update;
- item_class->render = sp_ctrlline_render;
+ klass->update = sp_ctrlline_update;
+ klass->render = sp_ctrlline_render;
}
-static void
-sp_ctrlline_init (SPCtrlLine *ctrlline)
+void sp_ctrlline_init(SPCtrlLine *ctrlline, gpointer /*g_class*/)
{
ctrlline->rgba = 0x0000ff7f;
ctrlline->s[Geom::X] = ctrlline->s[Geom::Y] = ctrlline->e[Geom::X] = ctrlline->e[Geom::Y] = 0.0;
ctrlline->item=NULL;
}
-static void
-sp_ctrlline_destroy (GtkObject *object)
+void sp_ctrlline_destroy(GtkObject *object)
{
- g_return_if_fail (object != NULL);
- g_return_if_fail (SP_IS_CTRLLINE (object));
+ g_return_if_fail(object != NULL);
+ g_return_if_fail(SP_IS_CTRLLINE(object));
- SPCtrlLine *ctrlline = SP_CTRLLINE (object);
+ SPCtrlLine *ctrlline = SP_CTRLLINE(object);
- ctrlline->item=NULL;
+ ctrlline->item = NULL;
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+ if (GTK_OBJECT_CLASS (parent_class)->destroy) {
+ (* GTK_OBJECT_CLASS (parent_class)->destroy)(object);
+ }
}
-static void
-sp_ctrlline_render (SPCanvasItem *item, SPCanvasBuf *buf)
+void sp_ctrlline_render(SPCanvasItem *item, SPCanvasBuf *buf)
{
- SPCtrlLine *cl = SP_CTRLLINE (item);
+ SPCtrlLine *cl = SP_CTRLLINE(item);
- if (!buf->ct)
+ if (!buf->ct) {
return;
+ }
- if (cl->s == cl->e)
+ if (cl->s == cl->e) {
return;
+ }
ink_cairo_set_source_rgba32(buf->ct, cl->rgba);
cairo_set_line_width(buf->ct, 1);
@@ -118,17 +118,17 @@ sp_ctrlline_render (SPCanvasItem *item, SPCanvasBuf *buf)
cairo_stroke(buf->ct);
}
-static void
-sp_ctrlline_update (SPCanvasItem *item, Geom::Affine const &affine, unsigned int flags)
+void sp_ctrlline_update(SPCanvasItem *item, Geom::Affine const &affine, unsigned int flags)
{
- SPCtrlLine *cl = SP_CTRLLINE (item);
+ SPCtrlLine *cl = SP_CTRLLINE(item);
- item->canvas->requestRedraw((int)item->x1, (int)item->y1, (int)item->x2, (int)item->y2);
+ item->canvas->requestRedraw(item->x1, item->y1, item->x2, item->y2);
- if (parent_class->update)
- (* parent_class->update) (item, affine, flags);
+ if (parent_class->update) {
+ (* parent_class->update)(item, affine, flags);
+ }
- sp_canvas_item_reset_bounds (item);
+ sp_canvas_item_reset_bounds(item);
cl->affine = affine;
@@ -144,46 +144,37 @@ sp_ctrlline_update (SPCanvasItem *item, Geom::Affine const &affine, unsigned int
item->x2 = round(MAX(s[Geom::X], e[Geom::X]) + 1);
item->y2 = round(MAX(s[Geom::Y], e[Geom::Y]) + 1);
- item->canvas->requestRedraw((int)item->x1, (int)item->y1, (int)item->x2, (int)item->y2);
+ item->canvas->requestRedraw(item->x1, item->y1, item->x2, item->y2);
}
}
-void
-sp_ctrlline_set_rgba32 (SPCtrlLine *cl, guint32 rgba)
+} // namespace
+
+void SPCtrlLine::setRgba32(guint32 rgba)
{
- g_return_if_fail (cl != NULL);
- g_return_if_fail (SP_IS_CTRLLINE (cl));
-
- if (rgba != cl->rgba) {
- SPCanvasItem *item;
- cl->rgba = rgba;
- item = SP_CANVAS_ITEM (cl);
- item->canvas->requestRedraw((int)item->x1, (int)item->y1, (int)item->x2, (int)item->y2);
+ if (rgba != this->rgba) {
+ this->rgba = rgba;
+ canvas->requestRedraw(x1, y1, x2, y2);
}
}
#define EPSILON 1e-6
#define DIFFER(a,b) (fabs ((a) - (b)) > EPSILON)
-void
-sp_ctrlline_set_coords (SPCtrlLine *cl, gdouble x0, gdouble y0, gdouble x1, gdouble y1)
+void SPCtrlLine::setCoords(gdouble x0, gdouble y0, gdouble x1, gdouble y1)
{
- g_return_if_fail (cl != NULL);
- g_return_if_fail (SP_IS_CTRLLINE (cl));
-
- if (DIFFER (x0, cl->s[Geom::X]) || DIFFER (y0, cl->s[Geom::Y]) || DIFFER (x1, cl->e[Geom::X]) || DIFFER (y1, cl->e[Geom::Y])) {
- cl->s[Geom::X] = x0;
- cl->s[Geom::Y] = y0;
- cl->e[Geom::X] = x1;
- cl->e[Geom::Y] = y1;
- sp_canvas_item_request_update (SP_CANVAS_ITEM (cl));
+ if (DIFFER(x0, s[Geom::X]) || DIFFER(y0, s[Geom::Y]) || DIFFER(x1, e[Geom::X]) || DIFFER(y1, e[Geom::Y])) {
+ s[Geom::X] = x0;
+ s[Geom::Y] = y0;
+ e[Geom::X] = x1;
+ e[Geom::Y] = y1;
+ sp_canvas_item_request_update(this);
}
}
-void
-sp_ctrlline_set_coords (SPCtrlLine *cl, const Geom::Point start, const Geom::Point end)
+void SPCtrlLine::setCoords(Geom::Point const &start, Geom::Point const &end)
{
- sp_ctrlline_set_coords(cl, start[0], start[1], end[0], end[1]);
+ setCoords(start[0], start[1], end[0], end[1]);
}
/*
diff --git a/src/display/sp-ctrlline.h b/src/display/sp-ctrlline.h
index 4bfe50a77..12be03ca5 100644
--- a/src/display/sp-ctrlline.h
+++ b/src/display/sp-ctrlline.h
@@ -7,7 +7,9 @@
* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
* Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
+ * Jon A. Cruz <jon@joncruz.org>
*
+ * Copyright (C) 2012 Authors
* Copyright (C) 2007 Johan Engelen
* Copyright (C) 1999-2002 Lauris Kaplinski
*
@@ -18,23 +20,28 @@
class SPItem;
-#define SP_TYPE_CTRLLINE (sp_ctrlline_get_type ())
+#define SP_TYPE_CTRLLINE (SPCtrlLine::getType())
#define SP_CTRLLINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SP_TYPE_CTRLLINE, SPCtrlLine))
#define SP_IS_CTRLLINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_CTRLLINE))
-struct SPCtrlLine : public SPCanvasItem{
+struct SPCtrlLine : public SPCanvasItem {
+ static GType getType();
+
+ void setRgba32(guint32 rgba);
+
+ void setCoords(gdouble x0, gdouble y0, gdouble x1, gdouble y1);
+
+ void setCoords(Geom::Point const &start, Geom::Point const &end);
+
+
SPItem *item; // the item to which this line belongs in some sense; may be NULL for some users
guint32 rgba;
- Geom::Point s, e;
+ Geom::Point s;
+ Geom::Point e;
Geom::Affine affine;
};
-struct SPCtrlLineClass : public SPCanvasItemClass{};
-GType sp_ctrlline_get_type (void);
-
-void sp_ctrlline_set_rgba32 (SPCtrlLine *cl, guint32 rgba);
-void sp_ctrlline_set_coords (SPCtrlLine *cl, gdouble x0, gdouble y0, gdouble x1, gdouble y1);
-void sp_ctrlline_set_coords (SPCtrlLine *cl, const Geom::Point start, const Geom::Point end);
+struct SPCtrlLineClass : public SPCanvasItemClass{};
diff --git a/src/document-undo.cpp b/src/document-undo.cpp
index 61c78fe8a..312ccb7f8 100644
--- a/src/document-undo.cpp
+++ b/src/document-undo.cpp
@@ -112,7 +112,7 @@ void Inkscape::DocumentUndo::done(SPDocument *doc, const unsigned int event_type
maybeDone(doc, NULL, event_type, event_description);
}
-void Inkscape::DocumentUndo::resetKey( Inkscape::Application * /*inkscape*/, SPDesktop * /*desktop*/, GtkObject *base )
+void Inkscape::DocumentUndo::resetKey( Inkscape::Application * /*inkscape*/, SPDesktop * /*desktop*/, GObject *base )
{
SPDocument *doc = reinterpret_cast<SPDocument *>(base);
doc->actionkey.clear();
diff --git a/src/document-undo.h b/src/document-undo.h
index 7ff45c269..087e12b5a 100644
--- a/src/document-undo.h
+++ b/src/document-undo.h
@@ -1,7 +1,7 @@
#ifndef SEEN_SP_DOCUMENT_UNDO_H
#define SEEN_SP_DOCUMENT_UNDO_H
-typedef struct _GtkObject GtkObject;
+typedef struct _GObject GObject;
class SPDesktop;
@@ -37,7 +37,7 @@ public:
static void maybeDone(SPDocument *document, const gchar *keyconst, unsigned int event_type, Glib::ustring const &event_description);
- static void resetKey(Inkscape::Application *inkscape, SPDesktop *desktop, GtkObject *base);
+ static void resetKey(Inkscape::Application *inkscape, SPDesktop *desktop, GObject *base);
static void cancel(SPDocument *document);
diff --git a/src/draw-anchor.cpp b/src/draw-anchor.cpp
index d11ac462f..62a091608 100644
--- a/src/draw-anchor.cpp
+++ b/src/draw-anchor.cpp
@@ -20,6 +20,9 @@
#include "lpe-tool-context.h"
#include "display/sodipodi-ctrl.h"
#include "display/curve.h"
+#include "ui/control-manager.h"
+
+using Inkscape::ControlManager;
#define FILL_COLOR_NORMAL 0xffffff7f
#define FILL_COLOR_MOUSEOVER 0xff0000ff
@@ -44,16 +47,12 @@ SPDrawAnchor *sp_draw_anchor_new(SPDrawContext *dc, SPCurve *curve, gboolean sta
a->start = start;
a->active = FALSE;
a->dp = delta;
- a->ctrl = sp_canvas_item_new(sp_desktop_controls(dt), SP_TYPE_CTRL,
- "size", 6.0,
- "filled", 1,
- "fill_color", FILL_COLOR_NORMAL,
- "stroked", 1,
- "stroke_color", 0x000000ff,
- NULL);
+ a->ctrl = ControlManager::getManager().createControl(sp_desktop_controls(dt), Inkscape::CTRL_TYPE_ANCHOR);
SP_CTRL(a->ctrl)->moveto(delta);
+ ControlManager::getManager().track(a->ctrl);
+
return a;
}
@@ -72,8 +71,6 @@ SPDrawAnchor *sp_draw_anchor_destroy(SPDrawAnchor *anchor)
return NULL;
}
-#define A_SNAP 4.0
-
/**
* Test if point is near anchor, if so fill anchor on canvas and return
* pointer to it or NULL.
@@ -81,8 +78,9 @@ SPDrawAnchor *sp_draw_anchor_destroy(SPDrawAnchor *anchor)
SPDrawAnchor *sp_draw_anchor_test(SPDrawAnchor *anchor, Geom::Point w, gboolean activate)
{
SPDesktop *dt = SP_EVENT_CONTEXT_DESKTOP(anchor->dc);
+ SPCtrl *ctrl = SP_CTRL(anchor->ctrl);
- if ( activate && ( Geom::LInfty( w - dt->d2w(anchor->dp) ) <= A_SNAP ) ) {
+ if ( activate && ( Geom::LInfty( w - dt->d2w(anchor->dp) ) <= (ctrl->box.width() / 2.0) ) ) {
if (!anchor->active) {
sp_canvas_item_set((GtkObject *) anchor->ctrl, "fill_color", FILL_COLOR_MOUSEOVER, NULL);
anchor->active = TRUE;
diff --git a/src/draw-context.cpp b/src/draw-context.cpp
index d8ce2729d..cf47fed29 100644
--- a/src/draw-context.cpp
+++ b/src/draw-context.cpp
@@ -4,6 +4,7 @@
* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
* Abhishek Sharma
+ * Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 2000 Lauris Kaplinski
* Copyright (C) 2000-2001 Ximian, Inc.
@@ -42,77 +43,12 @@
#include "sp-namedview.h"
#include "live_effects/lpe-powerstroke.h"
#include "style.h"
+#include "ui/control-manager.h"
#include <gdk/gdkkeysyms.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_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_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
using Inkscape::DocumentUndo;
@@ -132,6 +68,12 @@ static void spdc_selection_modified(Inkscape::Selection *sel, guint flags, SPDra
static void spdc_attach_selection(SPDrawContext *dc, Inkscape::Selection *sel);
+/**
+ * Flushes white curve(s) and additional curve into object.
+ *
+ * No cleaning of colored curves - this has to be done by caller
+ * No rereading of white data, so if you cannot rely on ::modified, do it in caller
+ */
static void spdc_flush_white(SPDrawContext *dc, SPCurve *gc);
static void spdc_reset_white(SPDrawContext *dc);
@@ -140,9 +82,7 @@ static void spdc_free_colors(SPDrawContext *dc);
static SPEventContextClass *draw_parent_class;
-
-GType
-sp_draw_context_get_type(void)
+GType sp_draw_context_get_type(void)
{
static GType type = 0;
if (!type) {
@@ -154,15 +94,14 @@ sp_draw_context_get_type(void)
sizeof(SPDrawContext),
4,
(GInstanceInitFunc) sp_draw_context_init,
- NULL, /* value_table */
+ NULL, // value_table
};
type = g_type_register_static(SP_TYPE_EVENT_CONTEXT, "SPDrawContext", &info, (GTypeFlags)0);
}
return type;
}
-static void
-sp_draw_context_class_init(SPDrawContextClass *klass)
+static void sp_draw_context_class_init(SPDrawContextClass *klass)
{
GObjectClass *object_class;
SPEventContextClass *ec_class;
@@ -180,8 +119,7 @@ sp_draw_context_class_init(SPDrawContextClass *klass)
ec_class->root_handler = sp_draw_context_root_handler;
}
-static void
-sp_draw_context_init(SPDrawContext *dc)
+static void sp_draw_context_init(SPDrawContext *dc)
{
dc->attach = FALSE;
@@ -214,8 +152,7 @@ sp_draw_context_init(SPDrawContext *dc)
new (&dc->sel_modified_connection) sigc::connection();
}
-static void
-sp_draw_context_dispose(GObject *object)
+static void sp_draw_context_dispose(GObject *object)
{
SPDrawContext *dc = SP_DRAW_CONTEXT(object);
@@ -236,8 +173,7 @@ sp_draw_context_dispose(GObject *object)
G_OBJECT_CLASS(draw_parent_class)->dispose(object);
}
-static void
-sp_draw_context_setup(SPEventContext *ec)
+static void sp_draw_context_setup(SPEventContext *ec)
{
SPDrawContext *dc = SP_DRAW_CONTEXT(ec);
SPDesktop *dt = ec->desktop;
@@ -248,7 +184,7 @@ sp_draw_context_setup(SPEventContext *ec)
dc->selection = sp_desktop_selection(dt);
- /* Connect signals to track selection changes */
+ // Connect signals to track selection changes
dc->sel_changed_connection = dc->selection->connectChanged(
sigc::bind(sigc::ptr_fun(&spdc_selection_changed), dc)
);
@@ -256,21 +192,24 @@ sp_draw_context_setup(SPEventContext *ec)
sigc::bind(sigc::ptr_fun(&spdc_selection_modified), dc)
);
- /* Create red bpath */
+ // Create red bpath
dc->red_bpath = sp_canvas_bpath_new(sp_desktop_sketch(ec->desktop), NULL);
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(dc->red_bpath), dc->red_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
- /* Create red curve */
+
+ // Create red curve
dc->red_curve = new SPCurve();
- /* Create blue bpath */
+ // Create blue bpath
dc->blue_bpath = sp_canvas_bpath_new(sp_desktop_sketch(ec->desktop), NULL);
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(dc->blue_bpath), dc->blue_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
- /* Create blue curve */
+
+ // Create blue curve
dc->blue_curve = new SPCurve();
- /* Create green curve */
+ // Create green curve
dc->green_curve = new SPCurve();
- /* No green anchor by default */
+
+ // No green anchor by default
dc->green_anchor = NULL;
dc->green_closed = FALSE;
@@ -278,8 +217,7 @@ sp_draw_context_setup(SPEventContext *ec)
spdc_attach_selection(dc, dc->selection);
}
-static void
-sp_draw_context_finish(SPEventContext *ec)
+static void sp_draw_context_finish(SPEventContext *ec)
{
SPDrawContext *dc = SP_DRAW_CONTEXT(ec);
@@ -297,13 +235,11 @@ sp_draw_context_finish(SPEventContext *ec)
spdc_free_colors(dc);
}
-static void
-sp_draw_context_set(SPEventContext */*ec*/, Inkscape::Preferences::Entry */*val*/)
+static void sp_draw_context_set(SPEventContext */*ec*/, Inkscape::Preferences::Entry */*val*/)
{
}
-gint
-sp_draw_context_root_handler(SPEventContext *ec, GdkEvent *event)
+gint sp_draw_context_root_handler(SPEventContext *ec, GdkEvent *event)
{
gint ret = FALSE;
@@ -336,16 +272,14 @@ sp_draw_context_root_handler(SPEventContext *ec, GdkEvent *event)
return ret;
}
-static Glib::ustring const
-tool_name(SPDrawContext *dc)
+static Glib::ustring const tool_name(SPDrawContext *dc)
{
return ( SP_IS_PEN_CONTEXT(dc)
? "/tools/freehand/pen"
: "/tools/freehand/pencil" );
}
-static void
-spdc_paste_curve_as_freehand_shape(const SPCurve *c, SPDrawContext *dc, SPItem *item)
+static void spdc_paste_curve_as_freehand_shape(const SPCurve *c, SPDrawContext *dc, SPItem *item)
{
using namespace Inkscape::LivePathEffect;
@@ -357,8 +291,7 @@ spdc_paste_curve_as_freehand_shape(const SPCurve *c, SPDrawContext *dc, SPItem *
static_cast<LPEPatternAlongPath*>(lpe)->pattern.paste_param_path(svgd);
}
-static void
-spdc_apply_powerstroke_shape(const std::vector<Geom::Point> & points, SPDrawContext *dc, SPItem *item)
+static void spdc_apply_powerstroke_shape(const std::vector<Geom::Point> & points, SPDrawContext *dc, SPItem *item)
{
using namespace Inkscape::LivePathEffect;
@@ -375,12 +308,7 @@ spdc_apply_powerstroke_shape(const std::vector<Geom::Point> & points, SPDrawCont
lpe->getRepr()->setAttribute("interpolator_beta", "0.2");
}
-/*
- * If we have an item and a waiting LPE, apply the effect to the item
- * (spiro spline mode is treated separately)
- */
-void
-spdc_check_for_and_apply_waiting_LPE(SPDrawContext *dc, SPItem *item, SPCurve *curve)
+void spdc_check_for_and_apply_waiting_LPE(SPDrawContext *dc, SPItem *item, SPCurve *curve)
{
using namespace Inkscape::LivePathEffect;
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
@@ -486,8 +414,7 @@ spdc_check_for_and_apply_waiting_LPE(SPDrawContext *dc, SPItem *item, SPCurve *c
* Selection handlers
*/
-static void
-spdc_selection_changed(Inkscape::Selection *sel, SPDrawContext *dc)
+static void spdc_selection_changed(Inkscape::Selection *sel, SPDrawContext *dc)
{
if (dc->attach) {
spdc_attach_selection(dc, sel);
@@ -496,18 +423,16 @@ spdc_selection_changed(Inkscape::Selection *sel, SPDrawContext *dc)
/* fixme: We have to ensure this is not delayed (Lauris) */
-static void
-spdc_selection_modified(Inkscape::Selection *sel, guint /*flags*/, SPDrawContext *dc)
+static void spdc_selection_modified(Inkscape::Selection *sel, guint /*flags*/, SPDrawContext *dc)
{
if (dc->attach) {
spdc_attach_selection(dc, sel);
}
}
-static void
-spdc_attach_selection(SPDrawContext *dc, Inkscape::Selection */*sel*/)
+static void spdc_attach_selection(SPDrawContext *dc, Inkscape::Selection */*sel*/)
{
- /* We reset white and forget white/start/end anchors */
+ // We reset white and forget white/start/end anchors
spdc_reset_white(dc);
dc->sa = NULL;
dc->ea = NULL;
@@ -515,17 +440,19 @@ spdc_attach_selection(SPDrawContext *dc, Inkscape::Selection */*sel*/)
SPItem *item = dc->selection ? dc->selection->singleItem() : NULL;
if ( item && SP_IS_PATH(item) ) {
- /* Create new white data */
- /* Item */
+ // Create new white data
+ // Item
dc->white_item = item;
- /* Curve list */
- /* We keep it in desktop coordinates to eliminate calculation errors */
+
+ // Curve list
+ // We keep it in desktop coordinates to eliminate calculation errors
SPCurve *norm = SP_PATH(item)->get_curve_for_edit();
norm->transform((dc->white_item)->i2dt_affine());
g_return_if_fail( norm != NULL );
dc->white_curves = g_slist_reverse(norm->split());
norm->unref();
- /* Anchor list */
+
+ // Anchor list
for (GSList *l = dc->white_curves; l != NULL; l = l->next) {
SPCurve *c;
c = static_cast<SPCurve*>(l->data);
@@ -540,20 +467,11 @@ spdc_attach_selection(SPDrawContext *dc, Inkscape::Selection */*sel*/)
dc->white_anchors = g_slist_prepend(dc->white_anchors, a);
}
}
- /* fixme: recalculate active anchor? */
+ // fixme: recalculate active anchor?
}
}
-/**
- * Snaps node or handle to PI/rotationsnapsperpi degree increments.
- *
- * \param dc draw context
- * \param p cursor point (to be changed by snapping)
- * \param o origin point
- * \param state keyboard state to check if ctrl or shift was pressed
-*/
-
void spdc_endpoint_snap_rotation(SPEventContext const *const ec, Geom::Point &p, Geom::Point const &o,
guint state)
{
@@ -604,36 +522,31 @@ void spdc_endpoint_snap_free(SPEventContext const * const ec, Geom::Point& p, bo
m.unSetup();
}
-static SPCurve *
-reverse_then_unref(SPCurve *orig)
+static SPCurve *reverse_then_unref(SPCurve *orig)
{
SPCurve *ret = orig->create_reverse();
orig->unref();
return ret;
}
-/**
- * Concats red, blue and green.
- * If any anchors are defined, process these, optionally removing curves from white list
- * Invoke _flush_white to write result back to object.
- */
-void
-spdc_concat_colors_and_flush(SPDrawContext *dc, gboolean forceclosed)
+void spdc_concat_colors_and_flush(SPDrawContext *dc, gboolean forceclosed)
{
- /* Concat RBG */
+ // Concat RBG
SPCurve *c = dc->green_curve;
- /* Green */
+ // Green
dc->green_curve = new SPCurve();
while (dc->green_bpaths) {
gtk_object_destroy(GTK_OBJECT(dc->green_bpaths->data));
dc->green_bpaths = g_slist_remove(dc->green_bpaths, dc->green_bpaths->data);
}
- /* Blue */
+
+ // Blue
c->append_continuous(dc->blue_curve, 0.0625);
dc->blue_curve->reset();
sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(dc->blue_bpath), NULL);
- /* Red */
+
+ // Red
if (dc->red_curve_is_valid) {
c->append_continuous(dc->red_curve, 0.0625);
}
@@ -645,18 +558,18 @@ spdc_concat_colors_and_flush(SPDrawContext *dc, gboolean forceclosed)
return;
}
- /* Step A - test, whether we ended on green anchor */
+ // Step A - test, whether we ended on green anchor
if ( forceclosed || ( dc->green_anchor && dc->green_anchor->active ) ) {
// We hit green anchor, closing Green-Blue-Red
SP_EVENT_CONTEXT_DESKTOP(dc)->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Path is closed."));
c->closepath_current();
- /* Closed path, just flush */
+ // Closed path, just flush
spdc_flush_white(dc, c);
c->unref();
return;
}
- /* Step B - both start and end anchored to same curve */
+ // Step B - both start and end anchored to same curve
if ( dc->sa && dc->ea
&& ( dc->sa->curve == dc->ea->curve )
&& ( ( dc->sa != dc->ea )
@@ -674,7 +587,7 @@ spdc_concat_colors_and_flush(SPDrawContext *dc, gboolean forceclosed)
return;
}
- /* Step C - test start */
+ // Step C - test start
if (dc->sa) {
SPCurve *s = dc->sa->curve;
dc->white_curves = g_slist_remove(dc->white_curves, s);
@@ -700,16 +613,7 @@ spdc_concat_colors_and_flush(SPDrawContext *dc, gboolean forceclosed)
c->unref();
}
-/*
- * Flushes white curve(s) and additional curve into object
- *
- * No cleaning of colored curves - this has to be done by caller
- * No rereading of white data, so if you cannot rely on ::modified, do it in caller
- *
- */
-
-static void
-spdc_flush_white(SPDrawContext *dc, SPCurve *gc)
+static void spdc_flush_white(SPDrawContext *dc, SPCurve *gc)
{
SPCurve *c;
@@ -728,7 +632,7 @@ spdc_flush_white(SPDrawContext *dc, SPCurve *gc)
return;
}
- /* Now we have to go back to item coordinates at last */
+ // Now we have to go back to item coordinates at last
c->transform( dc->white_item
? (dc->white_item)->dt2i_affine()
: SP_EVENT_CONTEXT_DESKTOP(dc)->dt2doc() );
@@ -738,7 +642,7 @@ spdc_flush_white(SPDrawContext *dc, SPCurve *gc)
Inkscape::XML::Document *xml_doc = doc->getReprDoc();
if ( c && !c->is_empty() ) {
- /* We actually have something to write */
+ // We actually have something to write
bool has_lpe = false;
Inkscape::XML::Node *repr;
@@ -747,7 +651,7 @@ spdc_flush_white(SPDrawContext *dc, SPCurve *gc)
has_lpe = sp_lpe_item_has_path_effect_recursive(SP_LPE_ITEM(dc->white_item));
} else {
repr = xml_doc->createElement("svg:path");
- /* Set style */
+ // Set style
sp_desktop_apply_style_tool(desktop, repr, tool_name(dc).data(), false);
}
@@ -760,7 +664,7 @@ spdc_flush_white(SPDrawContext *dc, SPCurve *gc)
g_free(str);
if (!dc->white_item) {
- /* Attach repr */
+ // Attach repr
SPItem *item = SP_ITEM(desktop->currentLayer()->appendChildRepr(repr));
// we finished the path; now apply any waiting LPEs or freehand shapes
@@ -785,19 +689,15 @@ spdc_flush_white(SPDrawContext *dc, SPCurve *gc)
c->unref();
- /* Flush pending updates */
+ // Flush pending updates
doc->ensureUpToDate();
}
-/**
- * Returns FIRST active anchor (the activated one).
- */
-SPDrawAnchor *
-spdc_test_inside(SPDrawContext *dc, Geom::Point p)
+SPDrawAnchor *spdc_test_inside(SPDrawContext *dc, Geom::Point p)
{
SPDrawAnchor *active = NULL;
- /* Test green anchor */
+ // Test green anchor
if (dc->green_anchor) {
active = sp_draw_anchor_test(dc->green_anchor, p, TRUE);
}
@@ -812,11 +712,10 @@ spdc_test_inside(SPDrawContext *dc, Geom::Point p)
return active;
}
-static void
-spdc_reset_white(SPDrawContext *dc)
+static void spdc_reset_white(SPDrawContext *dc)
{
if (dc->white_item) {
- /* We do not hold refcount */
+ // We do not hold refcount
dc->white_item = NULL;
}
while (dc->white_curves) {
@@ -829,10 +728,9 @@ spdc_reset_white(SPDrawContext *dc)
}
}
-static void
-spdc_free_colors(SPDrawContext *dc)
+static void spdc_free_colors(SPDrawContext *dc)
{
- /* Red */
+ // Red
if (dc->red_bpath) {
gtk_object_destroy(GTK_OBJECT(dc->red_bpath));
dc->red_bpath = NULL;
@@ -840,7 +738,8 @@ spdc_free_colors(SPDrawContext *dc)
if (dc->red_curve) {
dc->red_curve = dc->red_curve->unref();
}
- /* Blue */
+
+ // Blue
if (dc->blue_bpath) {
gtk_object_destroy(GTK_OBJECT(dc->blue_bpath));
dc->blue_bpath = NULL;
@@ -848,7 +747,8 @@ spdc_free_colors(SPDrawContext *dc)
if (dc->blue_curve) {
dc->blue_curve = dc->blue_curve->unref();
}
- /* Green */
+
+ // Green
while (dc->green_bpaths) {
gtk_object_destroy(GTK_OBJECT(dc->green_bpaths->data));
dc->green_bpaths = g_slist_remove(dc->green_bpaths, dc->green_bpaths->data);
@@ -859,9 +759,10 @@ spdc_free_colors(SPDrawContext *dc)
if (dc->green_anchor) {
dc->green_anchor = sp_draw_anchor_destroy(dc->green_anchor);
}
- /* White */
+
+ // White
if (dc->white_item) {
- /* We do not hold refcount */
+ // We do not hold refcount
dc->white_item = NULL;
}
while (dc->white_curves) {
@@ -874,7 +775,6 @@ spdc_free_colors(SPDrawContext *dc)
}
}
-/* Create a single dot represented by a circle */
void spdc_create_single_dot(SPEventContext *ec, Geom::Point const &pt, char const *tool, guint event_state) {
g_return_if_fail(!strcmp(tool, "/tools/freehand/pen") || !strcmp(tool, "/tools/freehand/pencil"));
Glib::ustring tool_path = tool;
@@ -886,10 +786,10 @@ void spdc_create_single_dot(SPEventContext *ec, Geom::Point const &pt, char cons
SPItem *item = SP_ITEM(desktop->currentLayer()->appendChildRepr(repr));
Inkscape::GC::release(repr);
- /* apply the tool's current style */
+ // apply the tool's current style
sp_desktop_apply_style_tool(desktop, repr, tool, false);
- /* find out stroke width (TODO: is there an easier way??) */
+ // find out stroke width (TODO: is there an easier way??)
double stroke_width = 3.0;
gchar const *style_str = NULL;
style_str = repr->attribute("style");
@@ -900,23 +800,24 @@ void spdc_create_single_dot(SPEventContext *ec, Geom::Point const &pt, char cons
style->stroke_width.computed = 0;
sp_style_unref(style);
}
- /* unset stroke and set fill color to former stroke color */
+
+ // unset stroke and set fill color to former stroke color
gchar * str;
str = g_strdup_printf("fill:#%06x;stroke:none;", sp_desktop_get_color_tool(desktop, tool, false) >> 8);
repr->setAttribute("style", str);
g_free(str);
- /* put the circle where the mouse click occurred and set the diameter to the
- current stroke width, multiplied by the amount specified in the preferences */
+ // put the circle where the mouse click occurred and set the diameter to the
+ // current stroke width, multiplied by the amount specified in the preferences
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
Geom::Affine const i2d (item->i2dt_affine ());
Geom::Point pp = pt;
double rad = 0.5 * prefs->getDouble(tool_path + "/dot-size", 3.0);
if (event_state & GDK_MOD1_MASK) {
- /* TODO: We vary the dot size between 0.5*rad and 1.5*rad, where rad is the dot size
- as specified in prefs. Very simple, but it might be sufficient in practice. If not,
- we need to devise something more sophisticated. */
+ // TODO: We vary the dot size between 0.5*rad and 1.5*rad, where rad is the dot size
+ // as specified in prefs. Very simple, but it might be sufficient in practice. If not,
+ // we need to devise something more sophisticated.
double s = g_random_double_range(-0.5, 0.5);
rad *= (1 + s);
}
diff --git a/src/draw-context.h b/src/draw-context.h
index 98e4982dd..202dd85b2 100644
--- a/src/draw-context.h
+++ b/src/draw-context.h
@@ -44,28 +44,29 @@ struct SPDrawContext : public SPEventContext{
guint32 blue_color;
guint32 green_color;
- /* Red */
+ // Red
SPCanvasItem *red_bpath;
SPCurve *red_curve;
- /* Blue */
+ // Blue
SPCanvasItem *blue_bpath;
SPCurve *blue_curve;
- /* Green */
+ // Green
GSList *green_bpaths;
SPCurve *green_curve;
SPDrawAnchor *green_anchor;
gboolean green_closed; // a flag meaning we hit the green anchor, so close the path on itself
- /* White */
+ // White
SPItem *white_item;
GSList *white_curves;
GSList *white_anchors;
- /* Start anchor */
+ // Start anchor
SPDrawAnchor *sa;
- /* End anchor */
+
+ // End anchor
SPDrawAnchor *ea;
/* type of the LPE that is to be applied automatically to a finished path (if any) */
@@ -82,11 +83,40 @@ struct SPDrawContext : public SPEventContext{
struct SPDrawContextClass : public SPEventContextClass{};
GType sp_draw_context_get_type(void);
+
+/**
+ * Returns FIRST active anchor (the activated one).
+ */
SPDrawAnchor *spdc_test_inside(SPDrawContext *dc, Geom::Point p);
+
+/**
+ * Concats red, blue and green.
+ * If any anchors are defined, process these, optionally removing curves from white list
+ * Invoke _flush_white to write result back to object.
+ */
void spdc_concat_colors_and_flush(SPDrawContext *dc, gboolean forceclosed);
+
+/**
+ * Snaps node or handle to PI/rotationsnapsperpi degree increments.
+ *
+ * @param dc draw context.
+ * @param p cursor point (to be changed by snapping).
+ * @param o origin point.
+ * @param state keyboard state to check if ctrl or shift was pressed.
+ */
void spdc_endpoint_snap_rotation(SPEventContext const *const ec, Geom::Point &p, Geom::Point const &o, guint state);
+
void spdc_endpoint_snap_free(SPEventContext const *ec, Geom::Point &p, boost::optional<Geom::Point> &start_of_line, guint state);
+
+/**
+ * If we have an item and a waiting LPE, apply the effect to the item
+ * (spiro spline mode is treated separately).
+ */
void spdc_check_for_and_apply_waiting_LPE(SPDrawContext *dc, SPItem *item);
+
+/**
+ * Create a single dot represented by a circle.
+ */
void spdc_create_single_dot(SPEventContext *ec, Geom::Point const &pt, char const *tool, guint event_state);
#endif // SEEN_SP_DRAW_CONTEXT_H
diff --git a/src/dropper-context.cpp b/src/dropper-context.cpp
index 336314c4f..be0379813 100644
--- a/src/dropper-context.cpp
+++ b/src/dropper-context.cpp
@@ -45,11 +45,7 @@
#include "verbs.h"
#if !GTK_CHECK_VERSION(2,22,0)
-#define GDK_KEY_Up 0xff52
-#define GDK_KEY_Down 0xff54
-#define GDK_KEY_KP_Up 0xff97
-#define GDK_KEY_KP_Down 0xff99
-#define GDK_KEY_Escape 0xff1b
+#include "compat-key-syms.h"
#endif
using Inkscape::DocumentUndo;
diff --git a/src/dyna-draw-context.cpp b/src/dyna-draw-context.cpp
index c737b8d29..9e204cc14 100644
--- a/src/dyna-draw-context.cpp
+++ b/src/dyna-draw-context.cpp
@@ -82,25 +82,7 @@ using Inkscape::DocumentUndo;
#define DYNA_MIN_WIDTH 1.0e-6
#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_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
+#include "compat-key-syms.h"
#endif
static void sp_dyna_draw_context_class_init(SPDynaDrawContextClass *klass);
diff --git a/src/ege-adjustment-action.cpp b/src/ege-adjustment-action.cpp
index 181d63d8f..858b129b8 100644
--- a/src/ege-adjustment-action.cpp
+++ b/src/ege-adjustment-action.cpp
@@ -49,73 +49,7 @@
#include "ege-adjustment-action.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_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_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
diff --git a/src/eraser-context.cpp b/src/eraser-context.cpp
index 3b309899b..07e28ec20 100644
--- a/src/eraser-context.cpp
+++ b/src/eraser-context.cpp
@@ -84,25 +84,7 @@ using Inkscape::DocumentUndo;
#define DRAG_MAX 1.0
#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_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
+#include "compat-key-syms.h"
#endif
diff --git a/src/event-context.cpp b/src/event-context.cpp
index db7b29640..63a77ec58 100644
--- a/src/event-context.cpp
+++ b/src/event-context.cpp
@@ -14,15 +14,6 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
-/** \class SPEventContext
- * SPEventContext is an abstract base class of all tools. As the name
- * indicates, event context implementations process UI events (mouse
- * movements and keypresses) and take actions (like creating or modifying
- * objects). There is one event context implementation for each tool,
- * plus few abstract base classes. Writing a new tool involves
- * subclassing SPEventContext.
- */
-
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
@@ -65,90 +56,7 @@
#include "color.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_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_d 0x064
-#define GDK_KEY_D 0x044
-#define GDK_KEY_g 0x067
-#define GDK_KEY_G 0x047
-#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_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_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
static void sp_event_context_class_init(SPEventContextClass *klass);
diff --git a/src/event-context.h b/src/event-context.h
index 1e641e6ef..fdc6dd136 100644
--- a/src/event-context.h
+++ b/src/event-context.h
@@ -89,11 +89,19 @@ private:
void sp_event_context_snap_delay_handler(SPEventContext *ec, gpointer const dse_item, gpointer const dse_item2, GdkEventMotion *event, DelayedSnapEvent::DelayedSnapEventOrigin origin);
+
/**
* Base class for Event processors.
*
* This is per desktop object, which (its derivatives) implements
* different actions bound to mouse events.
+ *
+ * SPEventContext is an abstract base class of all tools. As the name
+ * indicates, event context implementations process UI events (mouse
+ * movements and keypresses) and take actions (like creating or modifying
+ * objects). There is one event context implementation for each tool,
+ * plus few abstract base classes. Writing a new tool involves
+ * subclassing SPEventContext.
*/
struct SPEventContext : public GObject {
void enableSelectionCue (bool enable=true);
diff --git a/src/extension/dependency.cpp b/src/extension/dependency.cpp
index e4073a00b..f53dc93b4 100644
--- a/src/extension/dependency.cpp
+++ b/src/extension/dependency.cpp
@@ -141,7 +141,7 @@ Dependency::check (void) const
filetest |= Glib::FILE_TEST_IS_EXECUTABLE;
}
- std::string location(_string);
+ Glib::ustring location(_string);
switch (_location) {
case LOCATION_EXTENSIONS: {
for (unsigned int i=0; i<Inkscape::Extension::Extension::search_path.size(); i++) {
@@ -173,55 +173,43 @@ Dependency::check (void) const
gchar * orig_path = path;
for (; path != NULL;) {
- gchar * local_path;
- gchar * final_name;
+ gchar * local_path; // to have the path after detection of the separator
+ Glib::ustring final_name;
local_path = path;
path = g_utf8_strchr(path, -1, G_SEARCHPATH_SEPARATOR);
/* Not sure whether this is UTF8 happy, but it would seem
like it considering that I'm searching (and finding)
the ':' character */
- if (path != local_path && path != NULL) {
+ if (path != NULL) {
path[0] = '\0';
path++;
- } else {
- path = NULL;
}
- if (local_path == '\0') {
- final_name = g_strdup(_string);
+ if (*local_path == '\0') {
+ final_name = _string;
} else {
- final_name = g_build_filename(local_path, _string, NULL);
+ final_name = Glib::build_filename(local_path, _string);
}
if (Glib::file_test(final_name, filetest)) {
- g_free(final_name);
g_free(orig_path);
return TRUE;
}
// give it a 2nd try with ".exe" added
- gchar * final_name_exe = g_strdup_printf("%s.exe", final_name);
+ Glib::ustring final_name_exe = final_name + ".exe";
if (Glib::file_test(final_name_exe, filetest)) {
- g_free(final_name);
- g_free(final_name_exe);
g_free(orig_path);
return TRUE;
}
- g_free(final_name_exe);
// and a 3rd try with ".cmd" added (mainly for UniConvertor)
- gchar * final_name_cmd = g_strdup_printf("%s.cmd", final_name);
+ Glib::ustring final_name_cmd = final_name + ".cmd";
if (Glib::file_test(final_name_cmd, filetest)) {
- g_free(final_name);
- g_free(final_name_cmd);
g_free(orig_path);
return TRUE;
}
- g_free(final_name_cmd);
-
- // give up
- g_free(final_name);
}
g_free(orig_path);
diff --git a/src/extension/error-file.cpp b/src/extension/error-file.cpp
index 5a3f8dcd2..2a56f55e8 100644
--- a/src/extension/error-file.cpp
+++ b/src/extension/error-file.cpp
@@ -56,7 +56,7 @@ ErrorFileNotice::ErrorFileNotice (void) :
g_free(ext_error_file);
set_message(dialog_text, true);
- Gtk::VBox * vbox = get_vbox();
+ Gtk::Box * vbox = get_vbox();
/* This is some filler text, needs to change before relase */
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp
index d7dd641b0..432b25bb9 100644
--- a/src/extension/implementation/script.cpp
+++ b/src/extension/implementation/script.cpp
@@ -738,10 +738,12 @@ void Script::effect(Inkscape::Extension::Effect *module,
SPNamedView *nv = (SPNamedView *) obj;
//Check if it has a default layer set up
- if ( nv != NULL and nv->default_layer_id != 0 ) {
- SPDocument *document = desktop->doc();
- //If so, get that layer
- layer = document->getObjectById(g_quark_to_string(nv->default_layer_id));
+ if ( nv != NULL){
+ if( nv->default_layer_id != 0 ) {
+ SPDocument *document = desktop->doc();
+ //If so, get that layer
+ layer = document->getObjectById(g_quark_to_string(nv->default_layer_id));
+ }
}
sp_namedview_update_layers_from_document(desktop);
@@ -851,7 +853,7 @@ void Script::checkStderr (const Glib::ustring &data,
GtkWidget *dlg = GTK_WIDGET(warning.gobj());
sp_transientize(dlg);
- Gtk::VBox * vbox = warning.get_vbox();
+ Gtk::Box * vbox = warning.get_vbox();
/* Gtk::TextView * textview = new Gtk::TextView(Gtk::TextBuffer::create()); */
Gtk::TextView * textview = new Gtk::TextView();
diff --git a/src/extension/internal/emf-win32-inout.cpp b/src/extension/internal/emf-win32-inout.cpp
index bb7f22a70..f54bfc6ea 100644
--- a/src/extension/internal/emf-win32-inout.cpp
+++ b/src/extension/internal/emf-win32-inout.cpp
@@ -1757,8 +1757,14 @@ myEnhMetaFileProc(HDC /*hDC*/, HANDLETABLE * /*lpHTable*/, ENHMETARECORD const *
dbg_str << "<!-- EMR_PAINTRGN -->\n";
break;
case EMR_EXTSELECTCLIPRGN:
+ {
dbg_str << "<!-- EMR_EXTSELECTCLIPRGN -->\n";
+
+ PEMREXTSELECTCLIPRGN pEmr = (PEMREXTSELECTCLIPRGN) lpEMFR;
+ if (pEmr->iMode == RGN_COPY)
+ clipset = false;
break;
+ }
case EMR_BITBLT:
{
dbg_str << "<!-- EMR_BITBLT -->\n";
diff --git a/src/extension/internal/pdf-input-cairo.cpp b/src/extension/internal/pdf-input-cairo.cpp
index 0a89c6661..5cb4f96c3 100644
--- a/src/extension/internal/pdf-input-cairo.cpp
+++ b/src/extension/internal/pdf-input-cairo.cpp
@@ -71,8 +71,13 @@ PdfImportCairoDialog::PdfImportCairoDialog(PopplerDocument *doc)
// Page number
int num_pages = poppler_document_get_n_pages(_poppler_doc);
+#if WITH_GTKMM_3_0
+ Glib::RefPtr<Gtk::Adjustment> _pageNumberSpin_adj( Gtk::Adjustment::create(1, 1, num_pages, 1, 10, 0) );
+ _pageNumberSpin = Gtk::manage(new class Inkscape::UI::Widget::SpinButton(_pageNumberSpin_adj, 1, 1));
+#else
Gtk::Adjustment *_pageNumberSpin_adj = Gtk::manage(new class Gtk::Adjustment(1, 1, num_pages, 1, 10, 0));
_pageNumberSpin = Gtk::manage(new class Inkscape::UI::Widget::SpinButton(*_pageNumberSpin_adj, 1, 1));
+#endif
_labelTotalPages = Gtk::manage(new class Gtk::Label());
hbox2 = Gtk::manage(new class Gtk::HBox(false, 0));
// Disable the page selector when there's only one page
@@ -105,8 +110,13 @@ PdfImportCairoDialog::PdfImportCairoDialog(PopplerDocument *doc)
_labelPrecision = Gtk::manage(new class Gtk::Label(_("Precision of approximating gradient meshes:")));
_labelPrecisionWarning = Gtk::manage(new class Gtk::Label(_("<b>Note</b>: setting the precision too high may result in a large SVG file and slow performance.")));
+#if WITH_GTKMM_3_0
+ _fallbackPrecisionSlider_adj = Gtk::Adjustment::create(2, 1, 256, 1, 10, 10);
+ _fallbackPrecisionSlider = Gtk::manage(new Gtk::HScale(_fallbackPrecisionSlider_adj));
+#else
_fallbackPrecisionSlider_adj = Gtk::manage(new class Gtk::Adjustment(2, 1, 256, 1, 10, 10));
_fallbackPrecisionSlider = Gtk::manage(new class Gtk::HScale(*_fallbackPrecisionSlider_adj));
+#endif
_fallbackPrecisionSlider->set_value(2.0);
_labelPrecisionComment = Gtk::manage(new class Gtk::Label(_("rough")));
hbox6 = Gtk::manage(new class Gtk::HBox(false, 4));
@@ -231,7 +241,6 @@ PdfImportCairoDialog::PdfImportCairoDialog(PopplerDocument *doc)
this->property_window_position().set_value(Gtk::WIN_POS_NONE);
this->set_resizable(true);
this->property_destroy_with_parent().set_value(false);
- this->set_has_separator(true);
this->add_action_widget(*cancelbutton, -6);
this->add_action_widget(*okbutton, -5);
cancelbutton->show();
diff --git a/src/extension/internal/pdf-input-cairo.h b/src/extension/internal/pdf-input-cairo.h
index cc3ed975e..15235ee19 100644
--- a/src/extension/internal/pdf-input-cairo.h
+++ b/src/extension/internal/pdf-input-cairo.h
@@ -82,7 +82,11 @@ private:
class Gtk::Label * _labelPrecision;
class Gtk::Label * _labelPrecisionWarning;
class Gtk::HScale * _fallbackPrecisionSlider;
+#if WITH_GTKMM_3_0
+ Glib::RefPtr<Gtk::Adjustment> _fallbackPrecisionSlider_adj;
+#else
class Gtk::Adjustment *_fallbackPrecisionSlider_adj;
+#endif
class Gtk::Label * _labelPrecisionComment;
class Gtk::HBox * hbox6;
class Gtk::Label * _labelText;
diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp
index 8802ce2ba..d4fc6a8a2 100644
--- a/src/extension/internal/pdfinput/pdf-input.cpp
+++ b/src/extension/internal/pdfinput/pdf-input.cpp
@@ -85,9 +85,14 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/)
_labelSelect = Gtk::manage(new class Gtk::Label(_("Select page:")));
// Page number
+#if WITH_GTKMM_3_0
+ Glib::RefPtr<Gtk::Adjustment> _pageNumberSpin_adj = Gtk::Adjustment::create(1, 1, _pdf_doc->getNumPages(), 1, 10, 0);
+ _pageNumberSpin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(_pageNumberSpin_adj, 1, 1));
+#else
Gtk::Adjustment *_pageNumberSpin_adj = Gtk::manage(
new class Gtk::Adjustment(1, 1, _pdf_doc->getNumPages(), 1, 10, 0));
_pageNumberSpin = Gtk::manage(new class Inkscape::UI::Widget::SpinButton(*_pageNumberSpin_adj, 1, 1));
+#endif
_labelTotalPages = Gtk::manage(new class Gtk::Label());
hbox2 = Gtk::manage(new class Gtk::HBox(false, 0));
// Disable the page selector when there's only one page
@@ -121,8 +126,13 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/)
_labelPrecision = Gtk::manage(new class Gtk::Label(_("Precision of approximating gradient meshes:")));
_labelPrecisionWarning = Gtk::manage(new class Gtk::Label(_("<b>Note</b>: setting the precision too high may result in a large SVG file and slow performance.")));
+#if WITH_GTKMM_3_0
+ _fallbackPrecisionSlider_adj = Gtk::Adjustment::create(2, 1, 256, 1, 10, 10);
+ _fallbackPrecisionSlider = Gtk::manage(new class Gtk::HScale(_fallbackPrecisionSlider_adj));
+#else
_fallbackPrecisionSlider_adj = Gtk::manage(new class Gtk::Adjustment(2, 1, 256, 1, 10, 10));
_fallbackPrecisionSlider = Gtk::manage(new class Gtk::HScale(*_fallbackPrecisionSlider_adj));
+#endif
_fallbackPrecisionSlider->set_value(2.0);
_labelPrecisionComment = Gtk::manage(new class Gtk::Label(_("rough")));
hbox6 = Gtk::manage(new class Gtk::HBox(false, 4));
@@ -247,7 +257,6 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gchar */*uri*/)
this->property_window_position().set_value(Gtk::WIN_POS_NONE);
this->set_resizable(true);
this->property_destroy_with_parent().set_value(false);
- this->set_has_separator(true);
this->add_action_widget(*cancelbutton, -6);
this->add_action_widget(*okbutton, -5);
cancelbutton->show();
diff --git a/src/extension/internal/pdfinput/pdf-input.h b/src/extension/internal/pdfinput/pdf-input.h
index 8334fd2f3..3b79e6f29 100644
--- a/src/extension/internal/pdfinput/pdf-input.h
+++ b/src/extension/internal/pdfinput/pdf-input.h
@@ -92,7 +92,11 @@ private:
class Gtk::Label * _labelPrecision;
class Gtk::Label * _labelPrecisionWarning;
class Gtk::HScale * _fallbackPrecisionSlider;
+#if WITH_GTKMM_3_0
+ Glib::RefPtr<Gtk::Adjustment> _fallbackPrecisionSlider_adj;
+#else
class Gtk::Adjustment *_fallbackPrecisionSlider_adj;
+#endif
class Gtk::Label * _labelPrecisionComment;
class Gtk::HBox * hbox6;
class Gtk::Label * _labelText;
diff --git a/src/extension/param/bool.cpp b/src/extension/param/bool.cpp
index f7c4e6c0c..abef8d8f3 100644
--- a/src/extension/param/bool.cpp
+++ b/src/extension/param/bool.cpp
@@ -13,6 +13,7 @@
#include <gtkmm/adjustment.h>
#include <gtkmm/box.h>
#include <gtkmm/spinbutton.h>
+#include <gtkmm/checkbutton.h>
#include "xml/node.h"
#include "../extension.h"
diff --git a/src/extension/param/float.cpp b/src/extension/param/float.cpp
index 0e1d1c22a..2f1c77d4e 100644
--- a/src/extension/param/float.cpp
+++ b/src/extension/param/float.cpp
@@ -184,17 +184,30 @@ Gtk::Widget * ParamFloat::get_widget(SPDocument * doc, Inkscape::XML::Node * nod
label->show();
hbox->pack_start(*label, true, true, _indent);
+#if WITH_GTKMM_3_0
+ ParamFloatAdjustment * pfa = new ParamFloatAdjustment(this, doc, node, changeSignal);
+ Glib::RefPtr<Gtk::Adjustment> fadjust(pfa);
+#else
ParamFloatAdjustment * fadjust = Gtk::manage(new ParamFloatAdjustment(this, doc, node, changeSignal));
+#endif
if (_mode == FULL) {
+#if WITH_GTKMM_3_0
+ Gtk::HScale * scale = Gtk::manage(new Gtk::HScale(fadjust));
+#else
Gtk::HScale * scale = Gtk::manage(new Gtk::HScale(*fadjust));
+#endif
scale->set_draw_value(false);
scale->set_size_request(200, -1);
scale->show();
hbox->pack_start(*scale, false, false);
}
-
+
+#if WITH_GTKMM_3_0
+ Inkscape::UI::Widget::SpinButton * spin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(fadjust, 0.1, _precision));
+#else
Inkscape::UI::Widget::SpinButton * spin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(*fadjust, 0.1, _precision));
+#endif
spin->show();
hbox->pack_start(*spin, false, false);
diff --git a/src/extension/param/int.cpp b/src/extension/param/int.cpp
index 440693eb1..fe29f1230 100644
--- a/src/extension/param/int.cpp
+++ b/src/extension/param/int.cpp
@@ -165,17 +165,30 @@ ParamInt::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal
label->show();
hbox->pack_start(*label, true, true, _indent);
+#if WITH_GTKMM_3_0
+ ParamIntAdjustment * pia = new ParamIntAdjustment(this, doc, node, changeSignal);
+ Glib::RefPtr<Gtk::Adjustment> fadjust(pia);
+#else
ParamIntAdjustment * fadjust = Gtk::manage(new ParamIntAdjustment(this, doc, node, changeSignal));
+#endif
if (_mode == FULL) {
+#if WITH_GTKMM_3_0
+ Gtk::HScale * scale = Gtk::manage(new Gtk::HScale(fadjust));
+#else
Gtk::HScale * scale = Gtk::manage(new Gtk::HScale(*fadjust));
+#endif
scale->set_draw_value(false);
scale->set_size_request(200, -1);
scale->show();
hbox->pack_start(*scale, false, false);
}
-
+
+#if WITH_GTKMM_3_0
+ Inkscape::UI::Widget::SpinButton * spin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(fadjust, 1.0, 0));
+#else
Inkscape::UI::Widget::SpinButton * spin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(*fadjust, 1.0, 0));
+#endif
spin->show();
hbox->pack_start(*spin, false, false);
diff --git a/src/extension/param/radiobutton.cpp b/src/extension/param/radiobutton.cpp
index 9c8475e2d..d71d60ebd 100644
--- a/src/extension/param/radiobutton.cpp
+++ b/src/extension/param/radiobutton.cpp
@@ -20,6 +20,7 @@
#include <gtkmm/box.h>
#include <gtkmm/comboboxtext.h>
+#include <gtkmm/radiobutton.h>
#include <glibmm/i18n.h>
#include "xml/node.h"
@@ -273,8 +274,15 @@ Gtk::Widget * ParamRadioButton::get_widget(SPDocument * doc, Inkscape::XML::Node
return NULL;
}
+#if WITH_GTKMM_3_0
+ Gtk::Box * hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 4));
+ hbox->set_homogeneous(false);
+ Gtk::Box * vbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 0));
+ vbox->set_homogeneous(false);
+#else
Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
Gtk::VBox * vbox = Gtk::manage(new Gtk::VBox(false, 0));
+#endif
#if WITH_GTKMM_2_22
Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START, Gtk::ALIGN_START));
diff --git a/src/extension/prefdialog.cpp b/src/extension/prefdialog.cpp
index 7d42c109a..4fd5680aa 100644
--- a/src/extension/prefdialog.cpp
+++ b/src/extension/prefdialog.cpp
@@ -95,7 +95,7 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co
hbox->show();
this->get_vbox()->pack_start(*hbox, true, true, 6);
- Gtk::HBox * hbox = dynamic_cast<Gtk::HBox *>(_button_preview);
+ Gtk::Box * hbox = dynamic_cast<Gtk::Box *>(_button_preview);
if (hbox != NULL) {
Gtk::Widget * back = hbox->children().back().get_widget();
Gtk::CheckButton * cb = dynamic_cast<Gtk::CheckButton *>(back);
diff --git a/src/extension/system.cpp b/src/extension/system.cpp
index ebad0c050..476499385 100644
--- a/src/extension/system.cpp
+++ b/src/extension/system.cpp
@@ -68,7 +68,26 @@ static Extension *build_from_reprdoc(Inkscape::XML::Document *doc, Implementatio
*/
SPDocument *open(Extension *key, gchar const *filename)
{
+ // Convert to absolute pathname to tolerate chdir().
+ bool relpath = (filename[0] != '/');
+#ifdef WIN32
+ relpath &= (filename[0] != '\\') && !(isalpha(filename[0]) && (filename[1] == ':'));
+#endif
+
+ if (relpath) {
+ gchar * curdir = NULL;
+#ifndef WIN32
+ curdir = getcwd(NULL, 0);
+#else
+ curdir = _getcwd(NULL, 0);
+#endif
+
+ filename = g_build_filename(curdir, filename, NULL);
+ free(curdir);
+ }
+
Input *imod = NULL;
+
if (key == NULL) {
gpointer parray[2];
parray[0] = (gpointer)filename;
@@ -108,6 +127,9 @@ SPDocument *open(Extension *key, gchar const *filename)
}
if (!imod->prefs(filename)) {
+ if (relpath){
+ free((void *) filename);
+ }
return NULL;
}
@@ -129,6 +151,9 @@ SPDocument *open(Extension *key, gchar const *filename)
imod->set_gui(true);
}
+ if (relpath){
+ free((void *) filename);
+ }
return doc;
}
diff --git a/src/flood-context.cpp b/src/flood-context.cpp
index 7d798a93e..c906ffdab 100644
--- a/src/flood-context.cpp
+++ b/src/flood-context.cpp
@@ -71,90 +71,7 @@
#include "pixmaps/cursor-paintbucket.xpm"
#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_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_d 0x064
-#define GDK_KEY_D 0x044
-#define GDK_KEY_g 0x067
-#define GDK_KEY_G 0x047
-#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_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_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
using Inkscape::DocumentUndo;
diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp
index a0da1e430..6983849fa 100644
--- a/src/gradient-chemistry.cpp
+++ b/src/gradient-chemistry.cpp
@@ -77,10 +77,12 @@ SPGradient *sp_gradient_ensure_vector_normalized(SPGradient *gr)
}
/* If gr hrefs some other gradient, remove the href */
- if (gr->ref->getObject()) {
- // We are hrefing someone, so require flattening
- gr->updateRepr(SP_OBJECT_WRITE_EXT | SP_OBJECT_WRITE_ALL);
- sp_gradient_repr_set_link(gr->getRepr(), NULL);
+ if (gr->ref){
+ if (gr->ref->getObject()) {
+ // We are hrefing someone, so require flattening
+ gr->updateRepr(SP_OBJECT_WRITE_EXT | SP_OBJECT_WRITE_ALL);
+ sp_gradient_repr_set_link(gr->getRepr(), NULL);
+ }
}
/* Everything is OK, set state flag */
diff --git a/src/gradient-context.cpp b/src/gradient-context.cpp
index 54f4bdfc1..c4c1bc0f3 100644
--- a/src/gradient-context.cpp
+++ b/src/gradient-context.cpp
@@ -49,52 +49,7 @@
#include "verbs.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_l 0x06c
-#define GDK_KEY_L 0x04c
-#define GDK_KEY_r 0x072
-#define GDK_KEY_R 0x052
-#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
+#include "compat-key-syms.h"
#endif
using Inkscape::DocumentUndo;
diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp
index c1f9251df..629659208 100644
--- a/src/gradient-drag.cpp
+++ b/src/gradient-drag.cpp
@@ -453,17 +453,16 @@ bool GrDrag::dropColor(SPItem */*item*/, gchar const *c, Geom::Point p)
// now see if we're over line and create a new stop
bool over_line = false;
- SPCtrlLine *line = NULL;
if (lines) {
for (GSList *l = lines; (l != NULL) && (!over_line); l = l->next) {
- line = (SPCtrlLine*) l->data;
+ SPCtrlLine *line = (SPCtrlLine*) l->data;
Geom::LineSegment ls(line->s, line->e);
Geom::Point nearest = ls.pointAt(ls.nearestPoint(p));
- double dist_screen = Geom::L2 (p - nearest) * desktop->current_zoom();
+ double dist_screen = Geom::L2(p - nearest) * desktop->current_zoom();
if (line->item && dist_screen < 5) {
- SPStop *stop = addStopNearPoint (line->item, p, 5/desktop->current_zoom());
+ SPStop *stop = addStopNearPoint(line->item, p, 5/desktop->current_zoom());
if (stop) {
- SPCSSAttr *css = sp_repr_css_attr_new ();
+ SPCSSAttr *css = sp_repr_css_attr_new();
sp_repr_css_set_property( css, "stop-color", stopIsNull ? 0 : toUse.c_str() );
sp_repr_css_set_property( css, "stop-opacity", "1" );
sp_repr_css_change(stop->getRepr(), css, "style");
@@ -1576,15 +1575,16 @@ void GrDrag::setDeselected(GrDragger *dragger)
*/
void GrDrag::addLine(SPItem *item, Geom::Point p1, Geom::Point p2, guint32 rgba)
{
- SPCanvasItem *line = sp_canvas_item_new(sp_desktop_controls(this->desktop),
- SP_TYPE_CTRLLINE, NULL);
+ SPCtrlLine *line = SP_CTRLLINE(sp_canvas_item_new(sp_desktop_controls(this->desktop), SP_TYPE_CTRLLINE, NULL));
+
sp_canvas_item_move_to_z(line, 0);
- SP_CTRLLINE(line)->item = item;
- sp_ctrlline_set_coords(SP_CTRLLINE(line), p1, p2);
- if (rgba != GR_LINE_COLOR_FILL) // fill is the default, so don't set color for it to speed up redraw
- sp_ctrlline_set_rgba32 (SP_CTRLLINE(line), rgba);
- sp_canvas_item_show (line);
- this->lines = g_slist_append (this->lines, line);
+ line->item = item;
+ line->setCoords(p1, p2);
+ if (rgba != GR_LINE_COLOR_FILL) { // fill is the default, so don't set color for it to speed up redraw
+ line->setRgba32(rgba);
+ }
+ sp_canvas_item_show(line);
+ this->lines = g_slist_append(this->lines, line);
}
/**
diff --git a/src/inkview.cpp b/src/inkview.cpp
index 76d12aa46..1ddd36965 100644
--- a/src/inkview.cpp
+++ b/src/inkview.cpp
@@ -71,112 +71,7 @@ Inkscape::Application *inkscape;
#endif
#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
extern char *optarg;
diff --git a/src/interface.cpp b/src/interface.cpp
index d43662317..fb4e5cf8f 100644
--- a/src/interface.cpp
+++ b/src/interface.cpp
@@ -84,91 +84,7 @@
#include <gtk/gtk.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_d 0x064
-#define GDK_KEY_D 0x044
-#define GDK_KEY_g 0x067
-#define GDK_KEY_G 0x047
-#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_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_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
using Inkscape::DocumentUndo;
diff --git a/src/knot-holder-entity.cpp b/src/knot-holder-entity.cpp
index c556195d6..9f072d8f5 100644
--- a/src/knot-holder-entity.cpp
+++ b/src/knot-holder-entity.cpp
@@ -29,9 +29,9 @@
int KnotHolderEntity::counter = 0;
-void
-KnotHolderEntity::create(SPDesktop *desktop, SPItem *item, KnotHolder *parent, const gchar *tip,
- SPKnotShapeType shape, SPKnotModeType mode, guint32 color)
+void KnotHolderEntity::create(SPDesktop *desktop, SPItem *item, KnotHolder *parent, Inkscape::ControlType type,
+ const gchar *tip,
+ SPKnotShapeType shape, SPKnotModeType mode, guint32 color)
{
knot = sp_knot_new(desktop, tip);
@@ -41,11 +41,14 @@ KnotHolderEntity::create(SPDesktop *desktop, SPItem *item, KnotHolder *parent, c
my_counter = KnotHolderEntity::counter++;
- g_object_set(G_OBJECT (knot->item), "shape", shape, NULL);
- g_object_set(G_OBJECT (knot->item), "mode", mode, NULL);
+ g_object_set(G_OBJECT(knot->item), "shape", shape, NULL);
+ g_object_set(G_OBJECT(knot->item), "mode", mode, NULL);
+
+ // TODO base more appearance from this type instead of passing in arbitrary values.
+ knot->item->ctrlType = type;
knot->fill [SP_KNOT_STATE_NORMAL] = color;
- g_object_set (G_OBJECT (knot->item), "fill_color", color, NULL);
+ g_object_set (G_OBJECT(knot->item), "fill_color", color, NULL);
update_knot();
sp_knot_show(knot);
diff --git a/src/knot-holder-entity.h b/src/knot-holder-entity.h
index ec936d464..07bd628fc 100644
--- a/src/knot-holder-entity.h
+++ b/src/knot-holder-entity.h
@@ -18,6 +18,7 @@
#include "knot.h"
#include <2geom/forward.h>
#include "snapper.h"
+#include "display/sp-canvas-item.h"
class SPItem;
struct SPKnot;
@@ -28,8 +29,8 @@ class KnotHolder;
namespace Inkscape {
namespace LivePathEffect {
class Effect;
-}
-}
+} // namespace LivePathEffect
+} // namespace Inkscape
typedef void (* SPKnotHolderSetFunc) (SPItem *item, Geom::Point const &p, Geom::Point const &origin, guint state);
typedef Geom::Point (* SPKnotHolderGetFunc) (SPItem *item);
@@ -43,11 +44,14 @@ class KnotHolderEntity {
public:
KnotHolderEntity() {}
virtual ~KnotHolderEntity();
- virtual void create(SPDesktop *desktop, SPItem *item, KnotHolder *parent, const gchar *tip = "",
+
+ virtual void create(SPDesktop *desktop, SPItem *item, KnotHolder *parent,
+ Inkscape::ControlType type = Inkscape::CTRL_TYPE_UNKNOWN,
+ const gchar *tip = "",
SPKnotShapeType shape = SP_KNOT_SHAPE_DIAMOND,
SPKnotModeType mode = SP_KNOT_MODE_XOR,
guint32 color = 0xffffff00);
-
+
/* the get/set/click handlers are virtual functions; each handler class for a knot
should be derived from KnotHolderEntity and override these functions */
virtual void knot_set(Geom::Point const &p, Geom::Point const &origin, guint state) = 0;
diff --git a/src/knot.cpp b/src/knot.cpp
index 770618470..27a4c83d9 100644
--- a/src/knot.cpp
+++ b/src/knot.cpp
@@ -37,7 +37,7 @@ using Inkscape::DocumentUndo;
GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK)
#if !GTK_CHECK_VERSION(2,22,0)
-#define GDK_KEY_Escape 0xff1b
+#include "compat-key-syms.h"
#endif
static bool nograb = false;
diff --git a/src/knotholder.cpp b/src/knotholder.cpp
index 947f7c92a..81c7e3890 100644
--- a/src/knotholder.cpp
+++ b/src/knotholder.cpp
@@ -35,33 +35,36 @@
#include "live_effects/effect.h"
#include "desktop.h"
#include "display/sp-canvas.h"
+#include "display/sp-canvas-item.h"
#include "verbs.h"
+#include "ui/control-manager.h"
#include "xml/repr.h" // for debugging only
+using Inkscape::ControlManager;
using Inkscape::DocumentUndo;
class SPDesktop;
-KnotHolder::KnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderReleasedFunc relhandler)
+KnotHolder::KnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderReleasedFunc relhandler) :
+ desktop(desktop),
+ item(item),
+ //XML Tree being used directly for item->getRepr() while it shouldn't be...
+ repr(item ? item->getRepr() : 0),
+ entity(),
+ sizeUpdatedConn(),
+ released(relhandler),
+ local_change(FALSE),
+ dragging(false)
{
- //XML Tree being used directly here while it shouldn't be...
- Inkscape::XML::Node *repr = item->getRepr();
if (!desktop || !item || !SP_IS_ITEM(item)) {
g_print ("Error! Throw an exception, please!\n");
}
- this->desktop = desktop;
- this->item = item;
g_object_ref(G_OBJECT(item)); // TODO: is this still needed after C++-ification?
- this->released = relhandler;
-
- this->repr = repr;
- this->local_change = FALSE;
-
- this->dragging = false;
+ sizeUpdatedConn = ControlManager::getManager().connectCtrlSizeChanged(sigc::mem_fun(*this, &KnotHolder::updateControlSizes));
}
KnotHolder::~KnotHolder() {
@@ -72,16 +75,22 @@ KnotHolder::~KnotHolder() {
(*i) = NULL;
}
entity.clear(); // is this necessary?
+ sizeUpdatedConn.disconnect();
}
-/**
- * \param p In desktop coordinates.
- */
+void KnotHolder::updateControlSizes()
+{
+ ControlManager &mgr = ControlManager::getManager();
-void
-KnotHolder::update_knots()
+ for (std::list<KnotHolderEntity *>::iterator it = entity.begin(); it != entity.end(); ++it) {
+ KnotHolderEntity *e = *it;
+ mgr.updateItem(e->knot->item);
+ }
+}
+
+void KnotHolder::update_knots()
{
- for(std::list<KnotHolderEntity *>::iterator i = entity.begin(); i != entity.end(); ++i) {
+ for (std::list<KnotHolderEntity *>::iterator i = entity.begin(); i != entity.end(); ++i) {
KnotHolderEntity *e = *i;
e->update_knot();
}
@@ -106,7 +115,7 @@ void
KnotHolder::knot_clicked_handler(SPKnot *knot, guint state)
{
KnotHolder *knot_holder = this;
- SPItem *saved_item = this->item;
+ SPItem *saved_item = this->item;
for(std::list<KnotHolderEntity *>::iterator i = knot_holder->entity.begin(); i != knot_holder->entity.end(); ++i) {
KnotHolderEntity *e = *i;
@@ -227,14 +236,14 @@ KnotHolder::knot_ungrabbed_handler(SPKnot */*knot*/)
}
}
-void
-KnotHolder::add(KnotHolderEntity *e)
+void KnotHolder::add(KnotHolderEntity *e)
{
+ g_message("Adding a knot at %p", e);
entity.push_back(e);
+ updateControlSizes();
}
-void
-KnotHolder::add_pattern_knotholder()
+void KnotHolder::add_pattern_knotholder()
{
if ((item->style->fill.isPaintserver())
&& SP_IS_PATTERN(item->style->getFillPaintServer()))
@@ -242,20 +251,24 @@ KnotHolder::add_pattern_knotholder()
PatternKnotHolderEntityXY *entity_xy = new PatternKnotHolderEntityXY();
PatternKnotHolderEntityAngle *entity_angle = new PatternKnotHolderEntityAngle();
PatternKnotHolderEntityScale *entity_scale = new PatternKnotHolderEntityScale();
- entity_xy->create(desktop, item, this,
+ entity_xy->create(desktop, item, this, Inkscape::CTRL_TYPE_POINT,
// TRANSLATORS: This refers to the pattern that's inside the object
_("<b>Move</b> the pattern fill inside the object"),
SP_KNOT_SHAPE_CROSS);
- entity_scale->create(desktop, item, this,
+
+ entity_scale->create(desktop, item, this, Inkscape::CTRL_TYPE_SIZER,
_("<b>Scale</b> the pattern fill; uniformly if with <b>Ctrl</b>"),
SP_KNOT_SHAPE_SQUARE, SP_KNOT_MODE_XOR);
- entity_angle->create(desktop, item, this,
+
+ entity_angle->create(desktop, item, this, Inkscape::CTRL_TYPE_ROTATE,
_("<b>Rotate</b> the pattern fill; with <b>Ctrl</b> to snap angle"),
SP_KNOT_SHAPE_CIRCLE, SP_KNOT_MODE_XOR);
+
entity.push_back(entity_xy);
entity.push_back(entity_angle);
entity.push_back(entity_scale);
}
+ updateControlSizes();
}
/*
diff --git a/src/knotholder.h b/src/knotholder.h
index 463436be6..2d195e7b4 100644
--- a/src/knotholder.h
+++ b/src/knotholder.h
@@ -34,7 +34,6 @@ class PowerStrokePointArrayParamKnotHolderEntity;
class KnotHolder {
public:
- KnotHolder() {} // do nothing in the default constructor
KnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderReleasedFunc relhandler);
virtual ~KnotHolder();
@@ -56,16 +55,24 @@ public:
friend class Inkscape::LivePathEffect::PowerStrokePointArrayParamKnotHolderEntity;
protected:
+
+ void updateControlSizes();
+
SPDesktop *desktop;
SPItem *item; // TODO: Remove this and keep the actual item (e.g., SPRect etc.) in the item-specific knotholders
Inkscape::XML::Node *repr; ///< repr of the item, for setting and releasing listeners.
std::list<KnotHolderEntity *> entity;
+ sigc::connection sizeUpdatedConn;
+
SPKnotHolderReleasedFunc released;
gboolean local_change; ///< if true, no need to recreate knotholder if repr was changed.
bool dragging;
+
+private:
+ KnotHolder(); // declared but not defined
};
/**
diff --git a/src/libnrtype/font-lister.h b/src/libnrtype/font-lister.h
index 117a2cad9..c9ab7b21d 100644
--- a/src/libnrtype/font-lister.h
+++ b/src/libnrtype/font-lister.h
@@ -14,6 +14,7 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
+#include <map>
#include <gtkmm/liststore.h>
#include <gtkmm/treemodelcolumn.h>
#include <gtkmm/treepath.h>
diff --git a/src/line-geometry.cpp b/src/line-geometry.cpp
index 2e528f3af..39f18dca4 100644
--- a/src/line-geometry.cpp
+++ b/src/line-geometry.cpp
@@ -211,11 +211,10 @@ void create_canvas_point(Geom::Point const &pos, double size, guint32 rgba)
void create_canvas_line(Geom::Point const &p1, Geom::Point const &p2, guint32 rgba)
{
SPDesktop *desktop = inkscape_active_desktop();
- SPCanvasItem *line = sp_canvas_item_new(sp_desktop_controls(desktop),
- SP_TYPE_CTRLLINE, NULL);
- sp_ctrlline_set_coords(SP_CTRLLINE(line), p1, p2);
- sp_ctrlline_set_rgba32 (SP_CTRLLINE(line), rgba);
- sp_canvas_item_show (line);
+ SPCtrlLine *line = SP_CTRLLINE(sp_canvas_item_new(sp_desktop_controls(desktop), SP_TYPE_CTRLLINE, NULL));
+ line->setCoords(p1, p2);
+ line->setRgba32(rgba);
+ sp_canvas_item_show(line);
}
} // namespace Box3D
diff --git a/src/live_effects/lpe-angle_bisector.cpp b/src/live_effects/lpe-angle_bisector.cpp
index 99110c51e..b337f71d8 100644
--- a/src/live_effects/lpe-angle_bisector.cpp
+++ b/src/live_effects/lpe-angle_bisector.cpp
@@ -83,16 +83,14 @@ void
LPEAngleBisector::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) {
{
KnotHolderEntity *e = new AB::KnotHolderEntityLeftEnd(this);
- e->create( desktop, item, knotholder,
- _("Adjust the \"left\" end of the bisector")
- /*optional: knot_shape, knot_mode, knot_color*/);
+ e->create( desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN,
+ _("Adjust the \"left\" end of the bisector") );
knotholder->add(e);
}
{
KnotHolderEntity *e = new AB::KnotHolderEntityRightEnd(this);
- e->create( desktop, item, knotholder,
- _("Adjust the \"right\" of the bisector")
- /*optional: knot_shape, knot_mode, knot_color*/);
+ e->create( desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN,
+ _("Adjust the \"right\" of the bisector") );
knotholder->add(e);
}
};
diff --git a/src/live_effects/lpe-copy_rotate.cpp b/src/live_effects/lpe-copy_rotate.cpp
index c61f4c3c1..bddd65be6 100644
--- a/src/live_effects/lpe-copy_rotate.cpp
+++ b/src/live_effects/lpe-copy_rotate.cpp
@@ -127,20 +127,17 @@ LPECopyRotate::addCanvasIndicators(SPLPEItem */*lpeitem*/, std::vector<Geom::Pat
hp_vec.push_back(pathv);
}
-void
-LPECopyRotate::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) {
+void LPECopyRotate::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) {
{
KnotHolderEntity *e = new CR::KnotHolderEntityStartingAngle(this);
- e->create( desktop, item, knotholder,
- _("Adjust the starting angle")
- /*optional: knot_shape, knot_mode, knot_color*/);
+ e->create( desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN,
+ _("Adjust the starting angle") );
knotholder->add(e);
}
{
KnotHolderEntity *e = new CR::KnotHolderEntityRotationAngle(this);
- e->create( desktop, item, knotholder,
- _("Adjust the rotation angle")
- /*optional: knot_shape, knot_mode, knot_color*/);
+ e->create( desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN,
+ _("Adjust the rotation angle") );
knotholder->add(e);
}
};
diff --git a/src/live_effects/lpe-knot.cpp b/src/live_effects/lpe-knot.cpp
index 7ec103a85..3a9b036d8 100644
--- a/src/live_effects/lpe-knot.cpp
+++ b/src/live_effects/lpe-knot.cpp
@@ -607,15 +607,12 @@ LPEKnot::addCanvasIndicators(SPLPEItem */*lpeitem*/, std::vector<Geom::PathVecto
hp_vec.push_back(pathv);
}
-void
-LPEKnot::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) {
- {
- KnotHolderEntity *e = new KnotHolderEntityCrossingSwitcher(this);
- e->create( desktop, item, knotholder,
- _("Drag to select a crossing, click to flip it")
- /*optional: knot_shape, knot_mode, knot_color*/);
- knotholder->add(e);
- }
+void LPEKnot::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item)
+{
+ KnotHolderEntity *e = new KnotHolderEntityCrossingSwitcher(this);
+ e->create( desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN,
+ _("Drag to select a crossing, click to flip it") );
+ knotholder->add(e);
};
diff --git a/src/live_effects/lpe-parallel.cpp b/src/live_effects/lpe-parallel.cpp
index 4d15bf13e..95340fcf4 100644
--- a/src/live_effects/lpe-parallel.cpp
+++ b/src/live_effects/lpe-parallel.cpp
@@ -94,20 +94,17 @@ LPEParallel::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd
return output + dir;
}
-void
-LPEParallel::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) {
+void LPEParallel::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) {
{
KnotHolderEntity *e = new Pl::KnotHolderEntityLeftEnd(this);
- e->create( desktop, item, knotholder,
- _("Adjust the \"left\" end of the parallel")
- /*optional: knot_shape, knot_mode, knot_color*/);
+ e->create( desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN,
+ _("Adjust the \"left\" end of the parallel") );
knotholder->add(e);
}
{
KnotHolderEntity *e = new Pl::KnotHolderEntityRightEnd(this);
- e->create( desktop, item, knotholder,
- _("Adjust the \"right\" end of the parallel")
- /*optional: knot_shape, knot_mode, knot_color*/);
+ e->create( desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN,
+ _("Adjust the \"right\" end of the parallel") );
knotholder->add(e);
}
};
diff --git a/src/live_effects/lpe-perp_bisector.cpp b/src/live_effects/lpe-perp_bisector.cpp
index ddf16cc9a..f6d69f03c 100644
--- a/src/live_effects/lpe-perp_bisector.cpp
+++ b/src/live_effects/lpe-perp_bisector.cpp
@@ -154,16 +154,14 @@ void
LPEPerpBisector::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) {
{
KnotHolderEntity *e = new PB::KnotHolderEntityLeftEnd(this);
- e->create( desktop, item, knotholder,
- _("Adjust the bisector's \"left\" end")
- /*optional: knot_shape, knot_mode, knot_color*/);
+ e->create( desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN,
+ _("Adjust the bisector's \"left\" end") );
knotholder->add(e);
}
{
KnotHolderEntity *e = new PB::KnotHolderEntityRightEnd(this);
- e->create( desktop, item, knotholder,
- _("Adjust the bisector's \"right\" end")
- /*optional: knot_shape, knot_mode, knot_color*/);
+ e->create( desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN,
+ _("Adjust the bisector's \"right\" end") );
knotholder->add(e);
}
};
diff --git a/src/live_effects/lpe-perspective_path.cpp b/src/live_effects/lpe-perspective_path.cpp
index d9df32076..c8048f74b 100644
--- a/src/live_effects/lpe-perspective_path.cpp
+++ b/src/live_effects/lpe-perspective_path.cpp
@@ -137,15 +137,11 @@ LPEPerspectivePath::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > cons
return output;
}
-void
-LPEPerspectivePath::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) {
- {
- KnotHolderEntity *e = new PP::KnotHolderEntityOffset(this);
- e->create( desktop, item, knotholder,
- _("Adjust the origin")
- /*optional: knot_shape, knot_mode, knot_color*/);
- knotholder->add(e);
- }
+void LPEPerspectivePath::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) {
+ KnotHolderEntity *e = new PP::KnotHolderEntityOffset(this);
+ e->create( desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN,
+ _("Adjust the origin") );
+ knotholder->add(e);
};
namespace PP {
diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp
index 44f9b9eb0..048742452 100644
--- a/src/live_effects/lpe-powerstroke.cpp
+++ b/src/live_effects/lpe-powerstroke.cpp
@@ -269,6 +269,15 @@ Geom::Path path_from_piecewise_fix_cusps( Geom::Piecewise<Geom::D2<Geom::SBasis>
break;
}
+ // check if ellipse.ray is within 'sane' range.
+ if ( ( fabs(ellipse.ray(Geom::X)) > 1e6 ) ||
+ ( fabs(ellipse.ray(Geom::Y)) > 1e6 ) )
+ {
+ // do bevel, and break
+ pb.lineTo(B[i].at0());
+ break;
+ }
+
pb.arcTo( ellipse.ray(Geom::X), ellipse.ray(Geom::Y), ellipse.rot_angle(),
false, width < 0, B[i].at0() );
diff --git a/src/live_effects/lpe-tangent_to_curve.cpp b/src/live_effects/lpe-tangent_to_curve.cpp
index 04cc3335f..633a36860 100644
--- a/src/live_effects/lpe-tangent_to_curve.cpp
+++ b/src/live_effects/lpe-tangent_to_curve.cpp
@@ -100,23 +100,20 @@ void
LPETangentToCurve::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item) {
{
KnotHolderEntity *e = new TtC::KnotHolderEntityAttachPt(this);
- e->create( desktop, item, knotholder,
- _("Adjust the point of attachment of the tangent")
- /*optional: knot_shape, knot_mode, knot_color*/);
+ e->create( desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN,
+ _("Adjust the point of attachment of the tangent") );
knotholder->add(e);
}
{
KnotHolderEntity *e = new TtC::KnotHolderEntityLeftEnd(this);
- e->create( desktop, item, knotholder,
- _("Adjust the \"left\" end of the tangent")
- /*optional: knot_shape, knot_mode, knot_color*/);
+ e->create( desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN,
+ _("Adjust the \"left\" end of the tangent") );
knotholder->add(e);
}
{
KnotHolderEntity *e = new TtC::KnotHolderEntityRightEnd(this);
- e->create( desktop, item, knotholder,
- _("Adjust the \"right\" end of the tangent")
- /*optional: knot_shape, knot_mode, knot_color*/);
+ e->create( desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN,
+ _("Adjust the \"right\" end of the tangent") );
knotholder->add(e);
}
};
diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp
index eb2543ac7..c192cd6d6 100644
--- a/src/live_effects/parameter/point.cpp
+++ b/src/live_effects/parameter/point.cpp
@@ -165,7 +165,7 @@ PointParam::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SP
{
PointParamKnotHolderEntity *e = new PointParamKnotHolderEntity(this);
// TODO: can we ditch handleTip() etc. because we have access to handle_tip etc. itself???
- e->create(desktop, item, knotholder, handleTip(), knot_shape, knot_mode, knot_color);
+ e->create(desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, handleTip(), knot_shape, knot_mode, knot_color);
knotholder->add(e);
}
diff --git a/src/live_effects/parameter/powerstrokepointarray.cpp b/src/live_effects/parameter/powerstrokepointarray.cpp
index 06048cb32..07cc71245 100644
--- a/src/live_effects/parameter/powerstrokepointarray.cpp
+++ b/src/live_effects/parameter/powerstrokepointarray.cpp
@@ -222,22 +222,21 @@ PowerStrokePointArrayParamKnotHolderEntity::knot_click(guint state)
};
// add knot to knotholder
PowerStrokePointArrayParamKnotHolderEntity *e = new PowerStrokePointArrayParamKnotHolderEntity(_pparam, _index+1);
- e->create( this->desktop, this->item, parent_holder,
- _("<b>Stroke width control point</b>: drag to alter the stroke width. <b>Ctrl+click</b> adds a control point, <b>Ctrl+Alt+click</b> deletes it."),
+ e->create( this->desktop, this->item, parent_holder, Inkscape::CTRL_TYPE_UNKNOWN,
+ _("<b>Stroke width control point</b>: drag to alter the stroke width. <b>Ctrl+click</b> adds a control point, <b>Ctrl+Alt+click</b> deletes it."),
_pparam->knot_shape, _pparam->knot_mode, _pparam->knot_color);
parent_holder->add(e);
}
}
}
-void
-PowerStrokePointArrayParam::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item)
+void PowerStrokePointArrayParam::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item)
{
for (unsigned int i = 0; i < _vector.size(); ++i) {
PowerStrokePointArrayParamKnotHolderEntity *e = new PowerStrokePointArrayParamKnotHolderEntity(this, i);
- e->create( desktop, item, knotholder,
- _("<b>Stroke width control point</b>: drag to alter the stroke width. <b>Ctrl+click</b> adds a control point, <b>Ctrl+Alt+click</b> deletes it."),
- knot_shape, knot_mode, knot_color);
+ e->create( desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN,
+ _("<b>Stroke width control point</b>: drag to alter the stroke width. <b>Ctrl+click</b> adds a control point, <b>Ctrl+Alt+click</b> deletes it."),
+ knot_shape, knot_mode, knot_color);
knotholder->add(e);
}
}
diff --git a/src/live_effects/parameter/vector.cpp b/src/live_effects/parameter/vector.cpp
index 3e0ac9092..3348670dd 100644
--- a/src/live_effects/parameter/vector.cpp
+++ b/src/live_effects/parameter/vector.cpp
@@ -191,11 +191,11 @@ void
VectorParam::addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item)
{
VectorParamKnotHolderEntity_Origin *origin_e = new VectorParamKnotHolderEntity_Origin(this);
- origin_e->create(desktop, item, knotholder, handleTip(), ori_knot_shape, ori_knot_mode, ori_knot_color);
+ origin_e->create(desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, handleTip(), ori_knot_shape, ori_knot_mode, ori_knot_color);
knotholder->add(origin_e);
VectorParamKnotHolderEntity_Vector *vector_e = new VectorParamKnotHolderEntity_Vector(this);
- vector_e->create(desktop, item, knotholder, handleTip(), vec_knot_shape, vec_knot_mode, vec_knot_color);
+ vector_e->create(desktop, item, knotholder, Inkscape::CTRL_TYPE_UNKNOWN, handleTip(), vec_knot_shape, vec_knot_mode, vec_knot_color);
knotholder->add(vector_e);
}
diff --git a/src/main.cpp b/src/main.cpp
index a22295424..261df9145 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -118,8 +118,7 @@
#include <gdk/gdkkeysyms.h>
#if !GTK_CHECK_VERSION(2,22,0)
-#define GDK_KEY_Alt_L 0xffe9
-#define GDK_KEY_Alt_R 0xffea
+#include "compat-key-syms.h"
#endif
enum {
diff --git a/src/measure-context.cpp b/src/measure-context.cpp
index 3237bb3fb..e522c44a5 100644
--- a/src/measure-context.cpp
+++ b/src/measure-context.cpp
@@ -260,9 +260,8 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv
//draw control line
- SPCanvasItem * control_line = NULL;
- control_line = sp_canvas_item_new(sp_desktop_tempgroup(desktop), SP_TYPE_CTRLLINE, NULL);
- sp_ctrlline_set_coords(SP_CTRLLINE(control_line), start_point, end_point);
+ SPCtrlLine *control_line = SP_CTRLLINE(sp_canvas_item_new(sp_desktop_tempgroup(desktop), SP_TYPE_CTRLLINE, NULL));
+ control_line->setCoords(start_point, end_point);
measure_tmp_items.push_back(desktop->add_temporary_canvasitem(control_line, 0));
Geom::PathVector lineseg;
@@ -433,16 +432,16 @@ static gint sp_measure_context_root_handler(SPEventContext *event_context, GdkEv
Geom::Point normal = desktop->w2d(Geom::unit_vector(Geom::rot90(desktop->d2w(end_point - start_point))));
if (intersections.size() > 2) {
- control_line = sp_canvas_item_new(sp_desktop_tempgroup (desktop), SP_TYPE_CTRLLINE, NULL);
- sp_ctrlline_set_coords(SP_CTRLLINE(control_line), desktop->doc2dt(intersections[0]) + normal*60, desktop->doc2dt(intersections[intersections.size()-1]) + normal*60);
+ control_line = SP_CTRLLINE(sp_canvas_item_new(sp_desktop_tempgroup (desktop), SP_TYPE_CTRLLINE, NULL));
+ control_line->setCoords(desktop->doc2dt(intersections[0]) + normal*60, desktop->doc2dt(intersections[intersections.size()-1]) + normal*60);
measure_tmp_items.push_back(desktop->add_temporary_canvasitem(control_line, 0));
- control_line = sp_canvas_item_new(sp_desktop_tempgroup (desktop), SP_TYPE_CTRLLINE, NULL);
- sp_ctrlline_set_coords(SP_CTRLLINE(control_line), desktop->doc2dt(intersections[0]), desktop->doc2dt(intersections[0]) + normal*65);
+ control_line = SP_CTRLLINE(sp_canvas_item_new(sp_desktop_tempgroup (desktop), SP_TYPE_CTRLLINE, NULL));
+ control_line->setCoords(desktop->doc2dt(intersections[0]), desktop->doc2dt(intersections[0]) + normal*65);
measure_tmp_items.push_back(desktop->add_temporary_canvasitem(control_line, 0));
- control_line = sp_canvas_item_new(sp_desktop_tempgroup (desktop), SP_TYPE_CTRLLINE, NULL);
- sp_ctrlline_set_coords(SP_CTRLLINE(control_line), desktop->doc2dt(intersections[intersections.size()-1]), desktop->doc2dt(intersections[intersections.size()-1]) + normal*65);
+ control_line = SP_CTRLLINE(sp_canvas_item_new(sp_desktop_tempgroup (desktop), SP_TYPE_CTRLLINE, NULL));
+ control_line->setCoords(desktop->doc2dt(intersections[intersections.size()-1]), desktop->doc2dt(intersections[intersections.size()-1]) + normal*65);
measure_tmp_items.push_back(desktop->add_temporary_canvasitem(control_line, 0));
double totallengthval = (intersections[intersections.size()-1] - intersections[0]).length();
diff --git a/src/object-edit.cpp b/src/object-edit.cpp
index 528f202ab..773bd48e6 100644
--- a/src/object-edit.cpp
+++ b/src/object-edit.cpp
@@ -17,6 +17,7 @@
#include "sp-item.h"
+#include "display/sp-canvas-item.h"
#include "sp-rect.h"
#include "box3d.h"
#include "sp-ellipse.h"
@@ -39,6 +40,8 @@
#define sp_round(v,m) (((v) < 0.0) ? ((ceil((v) / (m) - 0.5)) * (m)) : ((floor((v) / (m) + 0.5)) * (m)))
+namespace {
+
static KnotHolder *sp_lpe_knot_holder(SPItem *item, SPDesktop *desktop)
{
KnotHolder *knot_holder = new KnotHolder(desktop, item, NULL);
@@ -49,8 +52,11 @@ static KnotHolder *sp_lpe_knot_holder(SPItem *item, SPDesktop *desktop)
return knot_holder;
}
-KnotHolder *
-sp_item_knot_holder(SPItem *item, SPDesktop *desktop)
+} // namespace
+
+namespace Inkscape {
+
+KnotHolder *createKnotHolder(SPItem *item, SPDesktop *desktop)
{
KnotHolder *knotholder = NULL;
@@ -82,6 +88,8 @@ sp_item_knot_holder(SPItem *item, SPDesktop *desktop)
return knotholder;
}
+} // Inkscape
+
/* SPRect */
/* handle for horizontal rounding radius */
@@ -426,22 +434,27 @@ RectKnotHolder::RectKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderRel
RectKnotHolderEntityRY *entity_ry = new RectKnotHolderEntityRY();
RectKnotHolderEntityWH *entity_wh = new RectKnotHolderEntityWH();
RectKnotHolderEntityXY *entity_xy = new RectKnotHolderEntityXY();
- entity_rx->create(desktop, item, this,
+
+ entity_rx->create(desktop, item, this, Inkscape::CTRL_TYPE_ROTATE,
_("Adjust the <b>horizontal rounding</b> radius; with <b>Ctrl</b> "
"to make the vertical radius the same"),
- SP_KNOT_SHAPE_CIRCLE, SP_KNOT_MODE_XOR);
- entity_ry->create(desktop, item, this,
+ SP_KNOT_SHAPE_CIRCLE, SP_KNOT_MODE_XOR);
+
+ entity_ry->create(desktop, item, this, Inkscape::CTRL_TYPE_ROTATE,
_("Adjust the <b>vertical rounding</b> radius; with <b>Ctrl</b> "
"to make the horizontal radius the same"),
SP_KNOT_SHAPE_CIRCLE, SP_KNOT_MODE_XOR);
- entity_wh->create(desktop, item, this,
+
+ entity_wh->create(desktop, item, this, Inkscape::CTRL_TYPE_SIZER,
_("Adjust the <b>width and height</b> of the rectangle; with <b>Ctrl</b> "
"to lock ratio or stretch in one dimension only"),
SP_KNOT_SHAPE_SQUARE, SP_KNOT_MODE_XOR);
- entity_xy->create(desktop, item, this,
+
+ entity_xy->create(desktop, item, this, Inkscape::CTRL_TYPE_SIZER,
_("Adjust the <b>width and height</b> of the rectangle; with <b>Ctrl</b> "
"to lock ratio or stretch in one dimension only"),
SP_KNOT_SHAPE_SQUARE, SP_KNOT_MODE_XOR);
+
entity.push_back(entity_rx);
entity.push_back(entity_ry);
entity.push_back(entity_wh);
@@ -672,31 +685,39 @@ Box3DKnotHolder::Box3DKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderR
Box3DKnotHolderEntity7 *entity_corner7 = new Box3DKnotHolderEntity7();
Box3DKnotHolderEntityCenter *entity_center = new Box3DKnotHolderEntityCenter();
- entity_corner0->create(desktop, item, this,
+ entity_corner0->create(desktop, item, this, Inkscape::CTRL_TYPE_SHAPER,
_("Resize box in X/Y direction; with <b>Shift</b> along the Z axis; "
"with <b>Ctrl</b> to constrain to the directions of edges or diagonals"));
- entity_corner1->create(desktop, item, this,
+
+ entity_corner1->create(desktop, item, this, Inkscape::CTRL_TYPE_SHAPER,
_("Resize box in X/Y direction; with <b>Shift</b> along the Z axis; "
"with <b>Ctrl</b> to constrain to the directions of edges or diagonals"));
- entity_corner2->create(desktop, item, this,
+
+ entity_corner2->create(desktop, item, this, Inkscape::CTRL_TYPE_SHAPER,
_("Resize box in X/Y direction; with <b>Shift</b> along the Z axis; "
"with <b>Ctrl</b> to constrain to the directions of edges or diagonals"));
- entity_corner3->create(desktop, item, this,
+
+ entity_corner3->create(desktop, item, this, Inkscape::CTRL_TYPE_SHAPER,
_("Resize box in X/Y direction; with <b>Shift</b> along the Z axis; "
"with <b>Ctrl</b> to constrain to the directions of edges or diagonals"));
- entity_corner4->create(desktop, item, this,
+
+ entity_corner4->create(desktop, item, this, Inkscape::CTRL_TYPE_SHAPER,
_("Resize box along the Z axis; with <b>Shift</b> in X/Y direction; "
"with <b>Ctrl</b> to constrain to the directions of edges or diagonals"));
- entity_corner5->create(desktop, item, this,
+
+ entity_corner5->create(desktop, item, this, Inkscape::CTRL_TYPE_SHAPER,
_("Resize box along the Z axis; with <b>Shift</b> in X/Y direction; "
"with <b>Ctrl</b> to constrain to the directions of edges or diagonals"));
- entity_corner6->create(desktop, item, this,
+
+ entity_corner6->create(desktop, item, this, Inkscape::CTRL_TYPE_SHAPER,
_("Resize box along the Z axis; with <b>Shift</b> in X/Y direction; "
"with <b>Ctrl</b> to constrain to the directions of edges or diagonals"));
- entity_corner7->create(desktop, item, this,
+
+ entity_corner7->create(desktop, item, this, Inkscape::CTRL_TYPE_SHAPER,
_("Resize box along the Z axis; with <b>Shift</b> in X/Y direction; "
"with <b>Ctrl</b> to constrain to the directions of edges or diagonals"));
- entity_center->create(desktop, item, this,
+
+ entity_center->create(desktop, item, this, Inkscape::CTRL_TYPE_POINT,
_("Move the box in perspective"),
SP_KNOT_SHAPE_CROSS);
@@ -926,20 +947,25 @@ ArcKnotHolder::ArcKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderRelea
ArcKnotHolderEntityRY *entity_ry = new ArcKnotHolderEntityRY();
ArcKnotHolderEntityStart *entity_start = new ArcKnotHolderEntityStart();
ArcKnotHolderEntityEnd *entity_end = new ArcKnotHolderEntityEnd();
- entity_rx->create(desktop, item, this,
+
+ entity_rx->create(desktop, item, this, Inkscape::CTRL_TYPE_SIZER,
_("Adjust ellipse <b>width</b>, with <b>Ctrl</b> to make circle"),
SP_KNOT_SHAPE_SQUARE, SP_KNOT_MODE_XOR);
- entity_ry->create(desktop, item, this,
+
+ entity_ry->create(desktop, item, this, Inkscape::CTRL_TYPE_SIZER,
_("Adjust ellipse <b>height</b>, with <b>Ctrl</b> to make circle"),
SP_KNOT_SHAPE_SQUARE, SP_KNOT_MODE_XOR);
- entity_start->create(desktop, item, this,
+
+ entity_start->create(desktop, item, this, Inkscape::CTRL_TYPE_ROTATE,
_("Position the <b>start point</b> of the arc or segment; with <b>Ctrl</b> "
"to snap angle; drag <b>inside</b> the ellipse for arc, <b>outside</b> for segment"),
SP_KNOT_SHAPE_CIRCLE, SP_KNOT_MODE_XOR);
- entity_end->create(desktop, item, this,
+
+ entity_end->create(desktop, item, this, Inkscape::CTRL_TYPE_ROTATE,
_("Position the <b>end point</b> of the arc or segment; with <b>Ctrl</b> to snap angle; "
"drag <b>inside</b> the ellipse for arc, <b>outside</b> for segment"),
SP_KNOT_SHAPE_CIRCLE, SP_KNOT_MODE_XOR);
+
entity.push_back(entity_rx);
entity.push_back(entity_ry);
entity.push_back(entity_start);
@@ -1075,14 +1101,15 @@ StarKnotHolder::StarKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderRel
SPStar *star = SP_STAR(item);
StarKnotHolderEntity1 *entity1 = new StarKnotHolderEntity1();
- entity1->create(desktop, item, this,
+ entity1->create(desktop, item, this, Inkscape::CTRL_TYPE_SHAPER,
_("Adjust the <b>tip radius</b> of the star or polygon; "
"with <b>Shift</b> to round; with <b>Alt</b> to randomize"));
+
entity.push_back(entity1);
if (star->flatsided == false) {
StarKnotHolderEntity2 *entity2 = new StarKnotHolderEntity2();
- entity2->create(desktop, item, this,
+ entity2->create(desktop, item, this, Inkscape::CTRL_TYPE_SHAPER,
_("Adjust the <b>base radius</b> of the star; with <b>Ctrl</b> to keep star rays "
"radial (no skew); with <b>Shift</b> to round; with <b>Alt</b> to randomize"));
entity.push_back(entity2);
@@ -1271,12 +1298,15 @@ SpiralKnotHolder::SpiralKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolde
{
SpiralKnotHolderEntityInner *entity_inner = new SpiralKnotHolderEntityInner();
SpiralKnotHolderEntityOuter *entity_outer = new SpiralKnotHolderEntityOuter();
- entity_inner->create(desktop, item, this,
+
+ entity_inner->create(desktop, item, this, Inkscape::CTRL_TYPE_SHAPER,
_("Roll/unroll the spiral from <b>inside</b>; with <b>Ctrl</b> to snap angle; "
"with <b>Alt</b> to converge/diverge"));
- entity_outer->create(desktop, item, this,
+
+ entity_outer->create(desktop, item, this, Inkscape::CTRL_TYPE_SHAPER,
_("Roll/unroll the spiral from <b>outside</b>; with <b>Ctrl</b> to snap angle; "
"with <b>Shift</b> to scale/rotate"));
+
entity.push_back(entity_inner);
entity.push_back(entity_outer);
@@ -1318,7 +1348,7 @@ OffsetKnotHolder::OffsetKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolde
KnotHolder(desktop, item, relhandler)
{
OffsetKnotHolderEntity *entity_offset = new OffsetKnotHolderEntity();
- entity_offset->create(desktop, item, this,
+ entity_offset->create(desktop, item, this, Inkscape::CTRL_TYPE_SHAPER,
_("Adjust the <b>offset distance</b>"));
entity.push_back(entity_offset);
@@ -1354,7 +1384,7 @@ FlowtextKnotHolder::FlowtextKnotHolder(SPDesktop *desktop, SPItem *item, SPKnotH
g_assert(item != NULL);
FlowtextKnotHolderEntity *entity_flowtext = new FlowtextKnotHolderEntity();
- entity_flowtext->create(desktop, item, this,
+ entity_flowtext->create(desktop, item, this, Inkscape::CTRL_TYPE_SHAPER,
_("Drag to resize the <b>flowed text frame</b>"));
entity.push_back(entity_flowtext);
}
diff --git a/src/object-edit.h b/src/object-edit.h
index ad63e92e2..ba59e46cd 100644
--- a/src/object-edit.h
+++ b/src/object-edit.h
@@ -1,5 +1,5 @@
-#ifndef __SP_OBJECT_EDIT_H__
-#define __SP_OBJECT_EDIT_H__
+#ifndef OBJECT_EDIT_H_SEEN
+#define OBJECT_EDIT_H_SEEN
/*
* Node editing extension to objects
@@ -7,13 +7,19 @@
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Mitsuru Oka
+ * Jon A. Cruz <jon@joncruz.org>
*
* Licensed under GNU GPL
*/
#include "knotholder.h"
-KnotHolder *sp_item_knot_holder (SPItem *item, SPDesktop *desktop);
+namespace Inkscape
+{
+
+KnotHolder *createKnotHolder(SPItem *item, SPDesktop *desktop);
+
+}
class RectKnotHolder : public KnotHolder {
public:
@@ -63,7 +69,7 @@ public:
virtual ~MiscKnotHolder() {};
};
-#endif
+#endif // OBJECT_EDIT_H_SEEN
/*
Local Variables:
diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp
index bda856914..e6f6d87db 100644
--- a/src/object-snapper.cpp
+++ b/src/object-snapper.cpp
@@ -111,11 +111,11 @@ void Inkscape::ObjectSnapper::_findCandidates(SPObject* parent,
// The current item is not a clipping path or a mask, but might
// still be the subject of clipping or masking itself ; if so, then
// we should also consider that path or mask for snapping to
- obj = SP_OBJECT(item->clip_ref->getObject());
+ obj = SP_OBJECT(item->clip_ref ? item->clip_ref->getObject() : NULL);
if (obj && _snapmanager->snapprefs.isTargetSnappable(SNAPTARGET_PATH_CLIP)) {
_findCandidates(obj, it, false, bbox_to_snap, true, item->i2doc_affine());
}
- obj = SP_OBJECT(item->mask_ref->getObject());
+ obj = SP_OBJECT(item->mask_ref ? item->mask_ref->getObject() : NULL);
if (obj && _snapmanager->snapprefs.isTargetSnappable(SNAPTARGET_PATH_MASK)) {
_findCandidates(obj, it, false, bbox_to_snap, true, item->i2doc_affine());
}
diff --git a/src/pen-context.cpp b/src/pen-context.cpp
index dbfd436f0..2fe510416 100644
--- a/src/pen-context.cpp
+++ b/src/pen-context.cpp
@@ -43,62 +43,15 @@
#include "macros.h"
#include "context-fns.h"
#include "tools-switch.h"
+#include "ui/control-manager.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_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
+#include "compat-key-syms.h"
#endif
+using Inkscape::ControlManager;
+
+
static void sp_pen_context_class_init(SPPenContextClass *klass);
static void sp_pen_context_init(SPPenContext *pc);
static void sp_pen_context_dispose(GObject *object);
@@ -136,11 +89,11 @@ static void pen_set_to_nearest_horiz_vert(const SPPenContext *const pc, Geom::Po
static int pen_last_paraxial_dir = 0; // last used direction in horizontal/vertical mode; 0 = horizontal, 1 = vertical
+
/**
* Register SPPenContext with Gdk and return its type.
*/
-GType
-sp_pen_context_get_type(void)
+GType sp_pen_context_get_type(void)
{
static GType type = 0;
if (!type) {
@@ -152,7 +105,7 @@ sp_pen_context_get_type(void)
sizeof(SPPenContext),
4,
(GInstanceInitFunc) sp_pen_context_init,
- NULL, /* value_table */
+ NULL, // value_table
};
type = g_type_register_static(SP_TYPE_DRAW_CONTEXT, "SPPenContext", &info, (GTypeFlags)0);
}
@@ -162,8 +115,7 @@ sp_pen_context_get_type(void)
/**
* Initialize the SPPenContext vtable.
*/
-static void
-sp_pen_context_class_init(SPPenContextClass *klass)
+static void sp_pen_context_class_init(SPPenContextClass *klass)
{
GObjectClass *object_class;
SPEventContextClass *event_context_class;
@@ -185,10 +137,8 @@ sp_pen_context_class_init(SPPenContextClass *klass)
/**
* Callback to initialize SPPenContext object.
*/
-static void
-sp_pen_context_init(SPPenContext *pc)
+static void sp_pen_context_init(SPPenContext *pc)
{
-
SPEventContext *event_context = SP_EVENT_CONTEXT(pc);
event_context->cursor_shape = cursor_pen_xpm;
@@ -214,12 +164,9 @@ sp_pen_context_init(SPPenContext *pc)
/**
* Callback to destroy the SPPenContext object's members and itself.
*/
-static void
-sp_pen_context_dispose(GObject *object)
+static void sp_pen_context_dispose(GObject *object)
{
- SPPenContext *pc;
-
- pc = SP_PEN_CONTEXT(object);
+ SPPenContext *pc = SP_PEN_CONTEXT(object);
if (pc->c0) {
gtk_object_destroy(GTK_OBJECT(pc->c0));
@@ -246,8 +193,7 @@ sp_pen_context_dispose(GObject *object)
}
}
-void
-sp_pen_context_set_polyline_mode(SPPenContext *const pc) {
+void sp_pen_context_set_polyline_mode(SPPenContext *const pc) {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
guint mode = prefs->getInt("/tools/freehand/pen/freehand-mode", 0);
pc->polylines_only = (mode == 2 || mode == 3);
@@ -257,26 +203,25 @@ sp_pen_context_set_polyline_mode(SPPenContext *const pc) {
/**
* Callback to initialize SPPenContext object.
*/
-static void
-sp_pen_context_setup(SPEventContext *ec)
+static void sp_pen_context_setup(SPEventContext *ec)
{
- SPPenContext *pc;
-
- pc = SP_PEN_CONTEXT(ec);
+ SPPenContext *pc = SP_PEN_CONTEXT(ec);
if (((SPEventContextClass *) pen_parent_class)->setup) {
((SPEventContextClass *) pen_parent_class)->setup(ec);
}
- /* Pen indicators */
- pc->c0 = sp_canvas_item_new(sp_desktop_controls(SP_EVENT_CONTEXT_DESKTOP(ec)), SP_TYPE_CTRL, "shape", SP_CTRL_SHAPE_CIRCLE,
- "size", 4.0, "filled", 0, "fill_color", 0xff00007f, "stroked", 1, "stroke_color", 0x0000ff7f, NULL);
- pc->c1 = sp_canvas_item_new(sp_desktop_controls(SP_EVENT_CONTEXT_DESKTOP(ec)), SP_TYPE_CTRL, "shape", SP_CTRL_SHAPE_CIRCLE,
- "size", 4.0, "filled", 0, "fill_color", 0xff00007f, "stroked", 1, "stroke_color", 0x0000ff7f, NULL);
- pc->cl0 = sp_canvas_item_new(sp_desktop_controls(SP_EVENT_CONTEXT_DESKTOP(ec)), SP_TYPE_CTRLLINE, NULL);
- sp_ctrlline_set_rgba32(SP_CTRLLINE(pc->cl0), 0x0000007f);
- pc->cl1 = sp_canvas_item_new(sp_desktop_controls(SP_EVENT_CONTEXT_DESKTOP(ec)), SP_TYPE_CTRLLINE, NULL);
- sp_ctrlline_set_rgba32(SP_CTRLLINE(pc->cl1), 0x0000007f);
+ // Pen indicators
+ pc->c0 = ControlManager::getManager().createControl(sp_desktop_controls(SP_EVENT_CONTEXT_DESKTOP(ec)), Inkscape::CTRL_TYPE_ADJ_HANDLE);
+ ControlManager::getManager().track(pc->c0);
+
+ pc->c1 = ControlManager::getManager().createControl(sp_desktop_controls(SP_EVENT_CONTEXT_DESKTOP(ec)), Inkscape::CTRL_TYPE_ADJ_HANDLE);
+ ControlManager::getManager().track(pc->c1);
+
+ pc->cl0 = SP_CTRLLINE(sp_canvas_item_new(sp_desktop_controls(SP_EVENT_CONTEXT_DESKTOP(ec)), SP_TYPE_CTRLLINE, NULL));
+ pc->cl0->setRgba32(0x0000007f);
+ pc->cl1 = SP_CTRLLINE(sp_canvas_item_new(sp_desktop_controls(SP_EVENT_CONTEXT_DESKTOP(ec)), SP_TYPE_CTRLLINE, NULL));
+ pc->cl1->setRgba32(0x0000007f);
sp_canvas_item_hide(pc->c0);
sp_canvas_item_hide(pc->c1);
@@ -295,8 +240,7 @@ sp_pen_context_setup(SPEventContext *ec)
}
}
-static void
-pen_cancel (SPPenContext *const pc)
+static void pen_cancel (SPPenContext *const pc)
{
pc->num_clicks = 0;
pc->state = SP_PEN_CONTEXT_STOP;
@@ -314,8 +258,7 @@ pen_cancel (SPPenContext *const pc)
/**
* Finalization callback.
*/
-static void
-sp_pen_context_finish(SPEventContext *ec)
+static void sp_pen_context_finish(SPEventContext *ec)
{
SPPenContext *pc = SP_PEN_CONTEXT(ec);
@@ -333,8 +276,7 @@ sp_pen_context_finish(SPEventContext *ec)
/**
* Callback that sets key to value in pen context.
*/
-static void
-sp_pen_context_set(SPEventContext *ec, Inkscape::Preferences::Entry *val)
+static void sp_pen_context_set(SPEventContext *ec, Inkscape::Preferences::Entry *val)
{
SPPenContext *pc = SP_PEN_CONTEXT(ec);
Glib::ustring name = val->getEntryName();
@@ -351,8 +293,7 @@ sp_pen_context_set(SPEventContext *ec, Inkscape::Preferences::Entry *val)
/**
* Snaps new node relative to the previous node.
*/
-static void
-spdc_endpoint_snap(SPPenContext const *const pc, Geom::Point &p, guint const state)
+static void spdc_endpoint_snap(SPPenContext const *const pc, Geom::Point &p, guint const state)
{
if ((state & GDK_CONTROL_MASK) && !pc->polylines_paraxial) { //CTRL enables angular snapping
if (pc->npoints > 0) {
@@ -376,8 +317,7 @@ spdc_endpoint_snap(SPPenContext const *const pc, Geom::Point &p, guint const sta
/**
* Snaps new node's handle relative to the new node.
*/
-static void
-spdc_endpoint_snap_handle(SPPenContext const *const pc, Geom::Point &p, guint const state)
+static void spdc_endpoint_snap_handle(SPPenContext const *const pc, Geom::Point &p, guint const state)
{
g_return_if_fail(( pc->npoints == 2 ||
pc->npoints == 5 ));
@@ -392,8 +332,7 @@ spdc_endpoint_snap_handle(SPPenContext const *const pc, Geom::Point &p, guint co
}
}
-static gint
-sp_pen_context_item_handler(SPEventContext *ec, SPItem *item, GdkEvent *event)
+static gint sp_pen_context_item_handler(SPEventContext *ec, SPItem *item, GdkEvent *event)
{
SPPenContext *const pc = SP_PEN_CONTEXT(ec);
@@ -421,8 +360,7 @@ sp_pen_context_item_handler(SPEventContext *ec, SPItem *item, GdkEvent *event)
/**
* Callback to handle all pen events.
*/
-static gint
-sp_pen_context_root_handler(SPEventContext *ec, GdkEvent *event)
+static gint sp_pen_context_root_handler(SPEventContext *ec, GdkEvent *event)
{
SPPenContext *const pc = SP_PEN_CONTEXT(ec);
@@ -490,7 +428,7 @@ static gint pen_handle_button_press(SPPenContext *const pc, GdkEventButton const
}
if (!pc->grab ) {
- /* Grab mouse, so release will not pass unnoticed */
+ // Grab mouse, so release will not pass unnoticed
pc->grab = SP_CANVAS_ITEM(desktop->acetate);
sp_canvas_item_grab(pc->grab, ( GDK_KEY_PRESS_MASK | GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
@@ -501,19 +439,19 @@ static gint pen_handle_button_press(SPPenContext *const pc, GdkEventButton const
pen_drag_origin_w = event_w;
pen_within_tolerance = true;
- /* Test whether we hit any anchor. */
+ // Test whether we hit any anchor.
SPDrawAnchor * const anchor = spdc_test_inside(pc, event_w);
switch (pc->mode) {
case SP_PEN_CONTEXT_MODE_CLICK:
- /* In click mode we add point on release */
+ // In click mode we add point on release
switch (pc->state) {
case SP_PEN_CONTEXT_POINT:
case SP_PEN_CONTEXT_CONTROL:
case SP_PEN_CONTEXT_CLOSE:
break;
case SP_PEN_CONTEXT_STOP:
- /* This is allowed, if we just canceled curve */
+ // This is allowed, if we just canceled curve
pc->state = SP_PEN_CONTEXT_POINT;
break;
default:
@@ -523,7 +461,7 @@ static gint pen_handle_button_press(SPPenContext *const pc, GdkEventButton const
case SP_PEN_CONTEXT_MODE_DRAG:
switch (pc->state) {
case SP_PEN_CONTEXT_STOP:
- /* This is allowed, if we just canceled curve */
+ // This is allowed, if we just canceled curve
case SP_PEN_CONTEXT_POINT:
if (pc->npoints == 0) {
@@ -544,11 +482,11 @@ static gint pen_handle_button_press(SPPenContext *const pc, GdkEventButton const
// TODO: Perhaps it would be nicer to rearrange the following case
// distinction so that the case of a waiting LPE is treated separately
- /* Set start anchor */
+ // Set start anchor
pc->sa = anchor;
if (anchor && !sp_pen_context_has_waiting_LPE(pc)) {
- /* Adjust point to anchor if needed; if we have a waiting LPE, we need
- a fresh path to be created so don't continue an existing one */
+ // Adjust point to anchor if needed; if we have a waiting LPE, we need
+ // a fresh path to be created so don't continue an existing one
p = anchor->dp;
desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Continuing selected path"));
} else {
@@ -557,15 +495,15 @@ static gint pen_handle_button_press(SPPenContext *const pc, GdkEventButton const
// anchor, which is handled by the sibling branch above)
Inkscape::Selection * const selection = sp_desktop_selection(desktop);
if (!(bevent.state & GDK_SHIFT_MASK) || sp_pen_context_has_waiting_LPE(pc)) {
- /* if we have a waiting LPE, we need a fresh path to be created
- so don't append to an existing one */
+ // if we have a waiting LPE, we need a fresh path to be created
+ // so don't append to an existing one
selection->clear();
desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Creating new path"));
} else if (selection->singleItem() && SP_IS_PATH(selection->singleItem())) {
desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Appending to selected path"));
}
- /* Create green anchor */
+ // Create green anchor
p = event_dt;
spdc_endpoint_snap(pc, p, bevent.state);
pc->green_anchor = sp_draw_anchor_new(pc, pc->green_curve, TRUE, p);
@@ -573,7 +511,7 @@ static gint pen_handle_button_press(SPPenContext *const pc, GdkEventButton const
spdc_pen_set_initial_point(pc, p);
} else {
- /* Set end anchor */
+ // Set end anchor
pc->ea = anchor;
Geom::Point p;
if (anchor) {
@@ -592,7 +530,7 @@ static gint pen_handle_button_press(SPPenContext *const pc, GdkEventButton const
} else {
p = event_dt;
- spdc_endpoint_snap(pc, p, bevent.state); /* Snap node only if not hitting anchor. */
+ spdc_endpoint_snap(pc, p, bevent.state); // Snap node only if not hitting anchor.
spdc_pen_set_subsequent_point(pc, p, true);
}
}
@@ -641,8 +579,7 @@ static gint pen_handle_button_press(SPPenContext *const pc, GdkEventButton const
/**
* Handle motion_notify event.
*/
-static gint
-pen_handle_motion_notify(SPPenContext *const pc, GdkEventMotion const &mevent)
+static gint pen_handle_motion_notify(SPPenContext *const pc, GdkEventMotion const &mevent)
{
gint ret = FALSE;
@@ -673,10 +610,10 @@ pen_handle_motion_notify(SPPenContext *const pc, GdkEventMotion const &mevent)
// motion notify coordinates as given (no snapping back to origin)
pen_within_tolerance = false;
- /* Find desktop coordinates */
+ // Find desktop coordinates
Geom::Point p = dt->w2d(event_w);
- /* Test, whether we hit any anchor */
+ // Test, whether we hit any anchor
SPDrawAnchor *anchor = spdc_test_inside(pc, event_w);
switch (pc->mode) {
@@ -684,7 +621,7 @@ pen_handle_motion_notify(SPPenContext *const pc, GdkEventMotion const &mevent)
switch (pc->state) {
case SP_PEN_CONTEXT_POINT:
if ( pc->npoints != 0 ) {
- /* Only set point, if we are already appending */
+ // Only set point, if we are already appending
spdc_endpoint_snap(pc, p, mevent.state);
spdc_pen_set_subsequent_point(pc, p, true);
ret = TRUE;
@@ -697,13 +634,13 @@ pen_handle_motion_notify(SPPenContext *const pc, GdkEventMotion const &mevent)
break;
case SP_PEN_CONTEXT_CONTROL:
case SP_PEN_CONTEXT_CLOSE:
- /* Placing controls is last operation in CLOSE state */
+ // Placing controls is last operation in CLOSE state
spdc_endpoint_snap(pc, p, mevent.state);
spdc_pen_set_ctrl(pc, p, mevent.state);
ret = TRUE;
break;
case SP_PEN_CONTEXT_STOP:
- /* This is perfectly valid */
+ // This is perfectly valid
break;
default:
break;
@@ -713,9 +650,9 @@ pen_handle_motion_notify(SPPenContext *const pc, GdkEventMotion const &mevent)
switch (pc->state) {
case SP_PEN_CONTEXT_POINT:
if ( pc->npoints > 0 ) {
- /* Only set point, if we are already appending */
+ // Only set point, if we are already appending
- if (!anchor) { /* Snap node only if not hitting anchor */
+ if (!anchor) { // Snap node only if not hitting anchor
spdc_endpoint_snap(pc, p, mevent.state);
spdc_pen_set_subsequent_point(pc, p, true, mevent.state);
} else {
@@ -749,7 +686,7 @@ pen_handle_motion_notify(SPPenContext *const pc, GdkEventMotion const &mevent)
break;
case SP_PEN_CONTEXT_CONTROL:
case SP_PEN_CONTEXT_CLOSE:
- /* Placing controls is last operation in CLOSE state */
+ // Placing controls is last operation in CLOSE state
// snap the handle
spdc_endpoint_snap_handle(pc, p, mevent.state);
@@ -763,7 +700,7 @@ pen_handle_motion_notify(SPPenContext *const pc, GdkEventMotion const &mevent)
ret = TRUE;
break;
case SP_PEN_CONTEXT_STOP:
- /* This is perfectly valid */
+ // This is perfectly valid
break;
default:
if (!sp_event_context_knot_mouseover(pc)) {
@@ -784,8 +721,7 @@ pen_handle_motion_notify(SPPenContext *const pc, GdkEventMotion const &mevent)
/**
* Handle mouse button release event.
*/
-static gint
-pen_handle_button_release(SPPenContext *const pc, GdkEventButton const &revent)
+static gint pen_handle_button_release(SPPenContext *const pc, GdkEventButton const &revent)
{
if (pc->events_disabled) {
// skip event processing if events are disabled
@@ -800,10 +736,10 @@ pen_handle_button_release(SPPenContext *const pc, GdkEventButton const &revent)
Geom::Point const event_w(revent.x,
revent.y);
- /* Find desktop coordinates */
+ // Find desktop coordinates
Geom::Point p = pc->desktop->w2d(event_w);
- /* Test whether we hit any anchor. */
+ // Test whether we hit any anchor.
SPDrawAnchor *anchor = spdc_test_inside(pc, event_w);
switch (pc->mode) {
@@ -811,14 +747,14 @@ pen_handle_button_release(SPPenContext *const pc, GdkEventButton const &revent)
switch (pc->state) {
case SP_PEN_CONTEXT_POINT:
if ( pc->npoints == 0 ) {
- /* Start new thread only with button release */
+ // Start new thread only with button release
if (anchor) {
p = anchor->dp;
}
pc->sa = anchor;
spdc_pen_set_initial_point(pc, p);
} else {
- /* Set end anchor here */
+ // Set end anchor here
pc->ea = anchor;
if (anchor) {
p = anchor->dp;
@@ -828,15 +764,15 @@ pen_handle_button_release(SPPenContext *const pc, GdkEventButton const &revent)
ret = TRUE;
break;
case SP_PEN_CONTEXT_CONTROL:
- /* End current segment */
+ // End current segment
spdc_endpoint_snap(pc, p, revent.state);
spdc_pen_finish_segment(pc, p, revent.state);
pc->state = SP_PEN_CONTEXT_POINT;
ret = TRUE;
break;
case SP_PEN_CONTEXT_CLOSE:
- /* End current segment */
- if (!anchor) { /* Snap node only if not hitting anchor */
+ // End current segment
+ if (!anchor) { // Snap node only if not hitting anchor
spdc_endpoint_snap(pc, p, revent.state);
}
spdc_pen_finish_segment(pc, p, revent.state);
@@ -845,7 +781,7 @@ pen_handle_button_release(SPPenContext *const pc, GdkEventButton const &revent)
ret = TRUE;
break;
case SP_PEN_CONTEXT_STOP:
- /* This is allowed, if we just canceled curve */
+ // This is allowed, if we just canceled curve
pc->state = SP_PEN_CONTEXT_POINT;
ret = TRUE;
break;
@@ -872,7 +808,7 @@ pen_handle_button_release(SPPenContext *const pc, GdkEventButton const &revent)
}
break;
case SP_PEN_CONTEXT_STOP:
- /* This is allowed, if we just cancelled curve */
+ // This is allowed, if we just cancelled curve
break;
default:
break;
@@ -885,7 +821,7 @@ pen_handle_button_release(SPPenContext *const pc, GdkEventButton const &revent)
}
if (pc->grab) {
- /* Release grab now */
+ // Release grab now
sp_canvas_item_ungrab(pc->grab, revent.time);
pc->grab = NULL;
}
@@ -917,8 +853,7 @@ pen_handle_button_release(SPPenContext *const pc, GdkEventButton const &revent)
return ret;
}
-static gint
-pen_handle_2button_press(SPPenContext *const pc, GdkEventButton const &bevent)
+static gint pen_handle_2button_press(SPPenContext *const pc, GdkEventButton const &bevent)
{
gint ret = FALSE;
// only end on LMB double click. Otherwise horizontal scrolling causes ending of the path
@@ -929,8 +864,7 @@ pen_handle_2button_press(SPPenContext *const pc, GdkEventButton const &bevent)
return ret;
}
-void
-pen_redraw_all (SPPenContext *const pc)
+void pen_redraw_all (SPPenContext *const pc)
{
// green
if (pc->green_bpaths) {
@@ -958,12 +892,12 @@ pen_redraw_all (SPPenContext *const pc)
// handles
if (pc->p[0] != pc->p[1]) {
SP_CTRL(pc->c1)->moveto(pc->p[1]);
- sp_ctrlline_set_coords(SP_CTRLLINE(pc->cl1), pc->p[0], pc->p[1]);
- sp_canvas_item_show (pc->c1);
- sp_canvas_item_show (pc->cl1);
+ pc->cl1->setCoords(pc->p[0], pc->p[1]);
+ sp_canvas_item_show(pc->c1);
+ sp_canvas_item_show(pc->cl1);
} else {
- sp_canvas_item_hide (pc->c1);
- sp_canvas_item_hide (pc->cl1);
+ sp_canvas_item_hide(pc->c1);
+ sp_canvas_item_hide(pc->cl1);
}
Geom::Curve const * last_seg = pc->green_curve->last_segment();
@@ -974,18 +908,17 @@ pen_redraw_all (SPPenContext *const pc)
{
Geom::Point p2 = (*cubic)[2];
SP_CTRL(pc->c0)->moveto(p2);
- sp_ctrlline_set_coords(SP_CTRLLINE(pc->cl0), p2, pc->p[0]);
- sp_canvas_item_show (pc->c0);
- sp_canvas_item_show (pc->cl0);
+ pc->cl0->setCoords(p2, pc->p[0]);
+ sp_canvas_item_show(pc->c0);
+ sp_canvas_item_show(pc->cl0);
} else {
- sp_canvas_item_hide (pc->c0);
- sp_canvas_item_hide (pc->cl0);
+ sp_canvas_item_hide(pc->c0);
+ sp_canvas_item_hide(pc->cl0);
}
}
}
-void
-pen_lastpoint_move (SPPenContext *const pc, gdouble x, gdouble y)
+void pen_lastpoint_move (SPPenContext *const pc, gdouble x, gdouble y)
{
if (pc->npoints != 5)
return;
@@ -1006,14 +939,12 @@ pen_lastpoint_move (SPPenContext *const pc, gdouble x, gdouble y)
pen_redraw_all(pc);
}
-void
-pen_lastpoint_move_screen (SPPenContext *const pc, gdouble x, gdouble y)
+void pen_lastpoint_move_screen (SPPenContext *const pc, gdouble x, gdouble y)
{
pen_lastpoint_move (pc, x / pc->desktop->current_zoom(), y / pc->desktop->current_zoom());
}
-void
-pen_lastpoint_tocurve (SPPenContext *const pc)
+void pen_lastpoint_tocurve (SPPenContext *const pc)
{
if (pc->npoints != 5)
return;
@@ -1028,8 +959,7 @@ pen_lastpoint_tocurve (SPPenContext *const pc)
pen_redraw_all(pc);
}
-void
-pen_lastpoint_toline (SPPenContext *const pc)
+void pen_lastpoint_toline (SPPenContext *const pc)
{
if (pc->npoints != 5)
return;
@@ -1040,8 +970,7 @@ pen_lastpoint_toline (SPPenContext *const pc)
}
-static gint
-pen_handle_key_press(SPPenContext *const pc, GdkEvent *event)
+static gint pen_handle_key_press(SPPenContext *const pc, GdkEvent *event)
{
gint ret = FALSE;
@@ -1111,7 +1040,7 @@ pen_handle_key_press(SPPenContext *const pc, GdkEvent *event)
}
break;
-/* TODO: this is not yet enabled?? looks like some traces of the Geometry tool
+/*TODO: this is not yet enabled?? looks like some traces of the Geometry tool
case GDK_KEY_P:
case GDK_KEY_p:
if (MOD__SHIFT_ONLY) {
@@ -1200,15 +1129,15 @@ pen_handle_key_press(SPPenContext *const pc, GdkEvent *event)
// do nothing; this event should be handled upstream
}
} else {
- /* Reset red curve */
+ // Reset red curve
pc->red_curve->reset();
- /* Destroy topmost green bpath */
+ // Destroy topmost green bpath
if (pc->green_bpaths) {
if (pc->green_bpaths->data)
gtk_object_destroy(GTK_OBJECT(pc->green_bpaths->data));
pc->green_bpaths = g_slist_remove(pc->green_bpaths, pc->green_bpaths->data);
}
- /* Get last segment */
+ // Get last segment
if ( pc->green_curve->is_empty() ) {
g_warning("pen_handle_key_press, case GDK_KP_Delete: Green curve is empty");
break;
@@ -1242,16 +1171,15 @@ pen_handle_key_press(SPPenContext *const pc, GdkEvent *event)
return ret;
}
-static void
-spdc_reset_colors(SPPenContext *pc)
+static void spdc_reset_colors(SPPenContext *pc)
{
- /* Red */
+ // Red
pc->red_curve->reset();
sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), NULL);
- /* Blue */
+ // Blue
pc->blue_curve->reset();
sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->blue_bpath), NULL);
- /* Green */
+ // Green
while (pc->green_bpaths) {
gtk_object_destroy(GTK_OBJECT(pc->green_bpaths->data));
pc->green_bpaths = g_slist_remove(pc->green_bpaths, pc->green_bpaths->data);
@@ -1267,8 +1195,7 @@ spdc_reset_colors(SPPenContext *pc)
}
-static void
-spdc_pen_set_initial_point(SPPenContext *const pc, Geom::Point const p)
+static void spdc_pen_set_initial_point(SPPenContext *const pc, Geom::Point const p)
{
g_assert( pc->npoints == 0 );
@@ -1285,8 +1212,7 @@ spdc_pen_set_initial_point(SPPenContext *const pc, Geom::Point const p)
* This type of message always shows angle/distance as the last
* two parameters ("angle %3.2f&#176;, distance %s").
*/
-static void
-spdc_pen_set_angle_distance_status_message(SPPenContext *const pc, Geom::Point const p, int pc_point_to_compare, gchar const *message)
+static void spdc_pen_set_angle_distance_status_message(SPPenContext *const pc, Geom::Point const p, int pc_point_to_compare, gchar const *message)
{
g_assert(pc != NULL);
g_assert((pc_point_to_compare == 0) || (pc_point_to_compare == 3)); // exclude control handles
@@ -1304,11 +1230,10 @@ spdc_pen_set_angle_distance_status_message(SPPenContext *const pc, Geom::Point c
g_string_free(dist, FALSE);
}
-static void
-spdc_pen_set_subsequent_point(SPPenContext *const pc, Geom::Point const p, bool statusbar, guint status)
+static void spdc_pen_set_subsequent_point(SPPenContext *const pc, Geom::Point const p, bool statusbar, guint status)
{
g_assert( pc->npoints != 0 );
- /* todo: Check callers to see whether 2 <= npoints is guaranteed. */
+ // todo: Check callers to see whether 2 <= npoints is guaranteed.
pc->p[2] = p;
pc->p[3] = p;
@@ -1350,8 +1275,7 @@ spdc_pen_set_subsequent_point(SPPenContext *const pc, Geom::Point const p, bool
}
}
-static void
-spdc_pen_set_ctrl(SPPenContext *const pc, Geom::Point const p, guint const state)
+static void spdc_pen_set_ctrl(SPPenContext *const pc, Geom::Point const p, guint const state)
{
sp_canvas_item_show(pc->c1);
sp_canvas_item_show(pc->cl1);
@@ -1361,7 +1285,7 @@ spdc_pen_set_ctrl(SPPenContext *const pc, Geom::Point const p, guint const state
sp_canvas_item_hide(pc->c0);
sp_canvas_item_hide(pc->cl0);
SP_CTRL(pc->c1)->moveto(pc->p[1]);
- sp_ctrlline_set_coords(SP_CTRLLINE(pc->cl1), pc->p[0], pc->p[1]);
+ pc->cl1->setCoords(pc->p[0], pc->p[1]);
spdc_pen_set_angle_distance_status_message(pc, p, 0, _("<b>Curve handle</b>: angle %3.2f&#176;, length %s; with <b>Ctrl</b> to snap angle"));
} else if ( pc->npoints == 5 ) {
@@ -1380,9 +1304,9 @@ spdc_pen_set_ctrl(SPPenContext *const pc, Geom::Point const p, guint const state
sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), pc->red_curve);
}
SP_CTRL(pc->c0)->moveto(pc->p[2]);
- sp_ctrlline_set_coords(SP_CTRLLINE(pc->cl0), pc->p[3], pc->p[2]);
+ pc->cl0 ->setCoords(pc->p[3], pc->p[2]);
SP_CTRL(pc->c1)->moveto(pc->p[4]);
- sp_ctrlline_set_coords(SP_CTRLLINE(pc->cl1), pc->p[3], pc->p[4]);
+ pc->cl1->setCoords(pc->p[3], pc->p[4]);
gchar *message = is_symm ?
_("<b>Curve handle, symmetric</b>: angle %3.2f&#176;, length %s; with <b>Ctrl</b> to snap angle, with <b>Shift</b> to move this handle only") :
@@ -1393,8 +1317,7 @@ spdc_pen_set_ctrl(SPPenContext *const pc, Geom::Point const p, guint const state
}
}
-static void
-spdc_pen_finish_segment(SPPenContext *const pc, Geom::Point const p, guint const state)
+static void spdc_pen_finish_segment(SPPenContext *const pc, Geom::Point const p, guint const state)
{
if (pc->polylines_paraxial) {
pen_last_paraxial_dir = pen_next_paraxial_direction(pc, p, pc->p[0], state);
@@ -1420,8 +1343,7 @@ spdc_pen_finish_segment(SPPenContext *const pc, Geom::Point const p, guint const
}
}
-static void
-spdc_pen_finish(SPPenContext *const pc, gboolean const closed)
+static void spdc_pen_finish(SPPenContext *const pc, gboolean const closed)
{
if (pc->expecting_clicks_for_LPE > 1) {
// don't let the path be finished before we have collected the required number of mouse clicks
@@ -1459,20 +1381,17 @@ spdc_pen_finish(SPPenContext *const pc, gboolean const closed)
pen_enable_events(pc);
}
-static void
-pen_disable_events(SPPenContext *const pc) {
+static void pen_disable_events(SPPenContext *const pc) {
pc->events_disabled++;
}
-static void
-pen_enable_events(SPPenContext *const pc) {
+static void pen_enable_events(SPPenContext *const pc) {
g_return_if_fail(pc->events_disabled != 0);
pc->events_disabled--;
}
-void
-sp_pen_context_wait_for_LPE_mouse_clicks(SPPenContext *pc, Inkscape::LivePathEffect::EffectType effect_type,
+void sp_pen_context_wait_for_LPE_mouse_clicks(SPPenContext *pc, Inkscape::LivePathEffect::EffectType effect_type,
unsigned int num_clicks, bool use_polylines)
{
if (effect_type == Inkscape::LivePathEffect::INVALID_LPE)
@@ -1484,8 +1403,7 @@ sp_pen_context_wait_for_LPE_mouse_clicks(SPPenContext *pc, Inkscape::LivePathEff
pc->polylines_paraxial = false; // TODO: think if this is correct for all cases
}
-void
-sp_pen_context_cancel_waiting_for_LPE(SPPenContext *pc)
+void sp_pen_context_cancel_waiting_for_LPE(SPPenContext *pc)
{
pc->waiting_LPE_type = Inkscape::LivePathEffect::INVALID_LPE;
pc->expecting_clicks_for_LPE = 0;
@@ -1494,11 +1412,11 @@ sp_pen_context_cancel_waiting_for_LPE(SPPenContext *pc)
static int pen_next_paraxial_direction(const SPPenContext *const pc,
Geom::Point const &pt, Geom::Point const &origin, guint state) {
- /*
- * after the first mouse click we determine whether the mouse pointer is closest to a
- * horizontal or vertical segment; for all subsequent mouse clicks, we use the direction
- * orthogonal to the last one; pressing Shift toggles the direction
- */
+ //
+ // after the first mouse click we determine whether the mouse pointer is closest to a
+ // horizontal or vertical segment; for all subsequent mouse clicks, we use the direction
+ // orthogonal to the last one; pressing Shift toggles the direction
+ //
// num_clicks is not reliable because spdc_pen_finish_segment is sometimes called too early
// (on first mouse release), in which case num_clicks immediately becomes 1.
// if (pc->num_clicks == 0) {
diff --git a/src/pen-context.h b/src/pen-context.h
index 1026369d1..a68b76ff5 100644
--- a/src/pen-context.h
+++ b/src/pen-context.h
@@ -26,6 +26,8 @@ enum {
SP_PEN_CONTEXT_MODE_DRAG
};
+struct SPCtrlLine;
+
/**
* SPPenContext: a context for pen tool events.
*/
@@ -47,7 +49,11 @@ struct SPPenContext : public SPDrawContext {
Inkscape::LivePathEffect::Effect *waiting_LPE; // if NULL, waiting_LPE_type in SPDrawContext is taken into account
SPLPEItem *waiting_item;
- SPCanvasItem *c0, *c1, *cl0, *cl1;
+ SPCanvasItem *c0;
+ SPCanvasItem *c1;
+
+ SPCtrlLine *cl0;
+ SPCtrlLine *cl1;
unsigned int events_disabled : 1;
};
diff --git a/src/pencil-context.cpp b/src/pencil-context.cpp
index 6db7c8ae2..c93feb4d4 100644
--- a/src/pencil-context.cpp
+++ b/src/pencil-context.cpp
@@ -46,54 +46,7 @@
#include "livarot/Path.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_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
+#include "compat-key-syms.h"
#endif
diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h
index 2b674d015..8935d7ace 100644
--- a/src/preferences-skeleton.h
+++ b/src/preferences-skeleton.h
@@ -243,6 +243,7 @@ static char const preferences_skeleton[] =
" <group id=\"rotationsnapsperpi\" value=\"12\"/>\n"
" <group id=\"cursortolerance\" value=\"8.0\"/>\n"
" <group id=\"dragtolerance\" value=\"4.0\"/>\n"
+" <group id=\"grabsize\" value=\"3\"/>\n"
" <group\n"
" id=\"displayprofile\"\n"
" enable=\"0\"\n"
diff --git a/src/rect-context.cpp b/src/rect-context.cpp
index d1f10d1ec..86c466df7 100644
--- a/src/rect-context.cpp
+++ b/src/rect-context.cpp
@@ -47,59 +47,7 @@
#include "display/sp-canvas-item.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_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
+#include "compat-key-syms.h"
#endif
using Inkscape::DocumentUndo;
diff --git a/src/select-context.cpp b/src/select-context.cpp
index 37d0e79ec..ec90d3e53 100644
--- a/src/select-context.cpp
+++ b/src/select-context.cpp
@@ -50,69 +50,7 @@
#include "display/drawing-item.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
using Inkscape::DocumentUndo;
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index 953e7c8d9..d70435df6 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -260,8 +260,8 @@ void sp_selection_copy_one(Inkscape::XML::Node *repr, Geom::Affine full_t, GSLis
void sp_selection_copy_impl(GSList const *items, GSList **clip, Inkscape::XML::Document* xml_doc)
{
// Sort items:
- GSList *sorted_items = g_slist_copy((GSList *) items);
- sorted_items = g_slist_sort((GSList *) sorted_items, (GCompareFunc) sp_object_compare_position);
+ GSList *sorted_items = g_slist_copy(const_cast<GSList *>(items));
+ sorted_items = g_slist_sort(static_cast<GSList *>(sorted_items), (GCompareFunc) sp_object_compare_position);
// Copy item reprs:
for (GSList *i = (GSList *) sorted_items; i != NULL; i = i->next) {
@@ -269,7 +269,7 @@ void sp_selection_copy_impl(GSList const *items, GSList **clip, Inkscape::XML::D
}
*clip = g_slist_reverse(*clip);
- g_slist_free((GSList *) sorted_items);
+ g_slist_free(static_cast<GSList *>(sorted_items));
}
GSList *sp_selection_paste_impl(SPDocument *doc, SPObject *parent, GSList **clip)
@@ -279,7 +279,7 @@ GSList *sp_selection_paste_impl(SPDocument *doc, SPObject *parent, GSList **clip
GSList *copied = NULL;
// add objects to document
for (GSList *l = *clip; l != NULL; l = l->next) {
- Inkscape::XML::Node *repr = (Inkscape::XML::Node *) l->data;
+ Inkscape::XML::Node *repr = static_cast<Inkscape::XML::Node *>(l->data);
Inkscape::XML::Node *copy = repr->duplicate(xml_doc);
// premultiply the item transform by the accumulated parent transform in the paste layer
@@ -340,7 +340,7 @@ void sp_selection_delete(SPDesktop *desktop)
GSList const *selected = g_slist_copy(const_cast<GSList *>(selection->itemList()));
selection->clear();
sp_selection_delete_impl(selected);
- g_slist_free((GSList *) selected);
+ g_slist_free(const_cast<GSList *>(selected));
/* a tool may have set up private information in it's selection context
* that depends on desktop items. I think the only sane way to deal with
@@ -383,7 +383,7 @@ void sp_selection_duplicate(SPDesktop *desktop, bool suppressDone)
return;
}
- GSList *reprs = g_slist_copy((GSList *) selection->reprList());
+ GSList *reprs = g_slist_copy(const_cast<GSList *>(selection->reprList()));
selection->clear();
@@ -400,7 +400,7 @@ void sp_selection_duplicate(SPDesktop *desktop, bool suppressDone)
const bool fork_livepatheffects = prefs->getBool("/options/forklpeonduplicate/value", true);
while (reprs) {
- Inkscape::XML::Node *old_repr = (Inkscape::XML::Node *) reprs->data;
+ Inkscape::XML::Node *old_repr = static_cast<Inkscape::XML::Node *>(reprs->data);
Inkscape::XML::Node *parent = old_repr->parent();
Inkscape::XML::Node *copy = old_repr->duplicate(xml_doc);
@@ -508,7 +508,7 @@ GSList *get_all_items(GSList *list, SPObject *from, SPDesktop *desktop, bool onl
!desktop->isLayer(SP_ITEM(child)) &&
(!onlysensitive || !SP_ITEM(child)->isLocked()) &&
(!onlyvisible || !desktop->itemIsHidden(SP_ITEM(child))) &&
- (!exclude || !g_slist_find((GSList *) exclude, child))
+ (!exclude || !g_slist_find(const_cast<GSList *>(exclude), child))
)
{
list = g_slist_prepend(list, SP_ITEM(child));
@@ -560,7 +560,7 @@ void sp_edit_select_all_full(SPDesktop *dt, bool force_all_layers, bool invert)
if (item && (!onlysensitive || !item->isLocked())) {
if (!onlyvisible || !dt->itemIsHidden(item)) {
if (!dt->isLayer(item)) {
- if (!invert || !g_slist_find((GSList *) exclude, item)) {
+ if (!invert || !g_slist_find(const_cast<GSList *>(exclude), item)) {
items = g_slist_prepend(items, item); // leave it in the list
}
}
@@ -613,11 +613,11 @@ void sp_selection_group_impl(GSList *p, Inkscape::XML::Node *group, Inkscape::XM
p = g_slist_sort(p, (GCompareFunc) sp_repr_compare_position);
// Remember the position and parent of the topmost object.
- gint topmost = ((Inkscape::XML::Node *) g_slist_last(p)->data)->position();
- Inkscape::XML::Node *topmost_parent = ((Inkscape::XML::Node *) g_slist_last(p)->data)->parent();
+ gint topmost = (static_cast<Inkscape::XML::Node *>(g_slist_last(p)->data))->position();
+ Inkscape::XML::Node *topmost_parent = (static_cast<Inkscape::XML::Node *>(g_slist_last(p)->data))->parent();
while (p) {
- Inkscape::XML::Node *current = (Inkscape::XML::Node *) p->data;
+ Inkscape::XML::Node *current = static_cast<Inkscape::XML::Node *>(p->data);
if (current->parent() == topmost_parent) {
Inkscape::XML::Node *spnew = current->duplicate(xml_doc);
@@ -650,7 +650,7 @@ void sp_selection_group_impl(GSList *p, Inkscape::XML::Node *group, Inkscape::XM
if (temp_clip) g_slist_free(temp_clip);
if (copied) { // if success,
// take pasted object (now in topmost_parent)
- Inkscape::XML::Node *in_topmost = (Inkscape::XML::Node *) copied->data;
+ Inkscape::XML::Node *in_topmost = static_cast<Inkscape::XML::Node *>(copied->data);
// make a copy
Inkscape::XML::Node *spnew = in_topmost->duplicate(xml_doc);
// remove pasted
@@ -688,9 +688,9 @@ void sp_selection_group(SPDesktop *desktop)
return;
}
- GSList const *l = (GSList *) selection->reprList();
+ GSList const *l = const_cast<GSList *>(selection->reprList());
- GSList *p = g_slist_copy((GSList *) l);
+ GSList *p = g_slist_copy(const_cast<GSList *>(l));
selection->clear();
@@ -717,7 +717,7 @@ void sp_selection_ungroup(SPDesktop *desktop)
return;
}
- GSList *items = g_slist_copy((GSList *) selection->itemList());
+ GSList *items = g_slist_copy(const_cast<GSList *>(selection->itemList()));
selection->clear();
// Get a copy of current selection.
@@ -727,7 +727,7 @@ void sp_selection_ungroup(SPDesktop *desktop)
i != NULL;
i = i->next)
{
- SPItem *group = (SPItem *) i->data;
+ SPItem *group = static_cast<SPItem *>(i->data);
// when ungrouping cloned groups with their originals, some objects that were selected may no more exist due to unlinking
if (!SP_IS_OBJECT(group)) {
@@ -821,7 +821,7 @@ enclose_items(GSList const *items)
Geom::OptRect r;
for (GSList const *i = items; i; i = i->next) {
- r.unionWith(((SPItem *) i->data)->desktopVisualBounds());
+ r.unionWith(static_cast<SPItem *>(i->data)->desktopVisualBounds());
}
return r;
}
@@ -844,7 +844,7 @@ sp_selection_raise(SPDesktop *desktop)
Inkscape::Selection *selection = sp_desktop_selection(desktop);
- GSList const *items = (GSList *) selection->itemList();
+ GSList const *items = const_cast<GSList *>(selection->itemList());
if (!items) {
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to raise."));
return;
@@ -859,7 +859,7 @@ sp_selection_raise(SPDesktop *desktop)
Inkscape::XML::Node *grepr = const_cast<Inkscape::XML::Node *>(group->getRepr());
/* Construct reverse-ordered list of selected children. */
- GSList *rev = g_slist_copy((GSList *) items);
+ GSList *rev = g_slist_copy(const_cast<GSList *>(items));
rev = g_slist_sort(rev, (GCompareFunc) sp_item_repr_compare_position);
// Determine the common bbox of the selected items.
@@ -876,7 +876,7 @@ sp_selection_raise(SPDesktop *desktop)
Geom::OptRect newref_bbox = SP_ITEM(newref)->desktopVisualBounds();
if ( newref_bbox && selected->intersects(*newref_bbox) ) {
// AND if it's not one of our selected objects,
- if (!g_slist_find((GSList *) items, newref)) {
+ if (!g_slist_find(const_cast<GSList *>(items), newref)) {
// move the selected object after that sibling
grepr->changeOrder(child->getRepr(), newref->getRepr());
}
@@ -908,7 +908,7 @@ void sp_selection_raise_to_top(SPDesktop *desktop)
return;
}
- GSList const *items = (GSList *) selection->itemList();
+ GSList const *items = const_cast<GSList *>(selection->itemList());
SPGroup const *group = sp_item_list_common_parent_group(items);
if (!group) {
@@ -916,11 +916,11 @@ void sp_selection_raise_to_top(SPDesktop *desktop)
return;
}
- GSList *rl = g_slist_copy((GSList *) selection->reprList());
+ GSList *rl = g_slist_copy(const_cast<GSList *>(selection->reprList()));
rl = g_slist_sort(rl, (GCompareFunc) sp_repr_compare_position);
for (GSList *l = rl; l != NULL; l = l->next) {
- Inkscape::XML::Node *repr = (Inkscape::XML::Node *) l->data;
+ Inkscape::XML::Node *repr = static_cast<Inkscape::XML::Node *>(l->data);
repr->setPosition(-1);
}
@@ -930,15 +930,14 @@ void sp_selection_raise_to_top(SPDesktop *desktop)
_("Raise to top"));
}
-void
-sp_selection_lower(SPDesktop *desktop)
+void sp_selection_lower(SPDesktop *desktop)
{
if (desktop == NULL)
return;
Inkscape::Selection *selection = sp_desktop_selection(desktop);
- GSList const *items = (GSList *) selection->itemList();
+ GSList const *items = const_cast<GSList *>(selection->itemList());
if (!items) {
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to lower."));
return;
@@ -956,7 +955,7 @@ sp_selection_lower(SPDesktop *desktop)
Geom::OptRect selected = enclose_items(items);
/* Construct direct-ordered list of selected children. */
- GSList *rev = g_slist_copy((GSList *) items);
+ GSList *rev = g_slist_copy(const_cast<GSList *>(items));
rev = g_slist_sort(rev, (GCompareFunc) sp_item_repr_compare_position);
rev = g_slist_reverse(rev);
@@ -971,7 +970,7 @@ sp_selection_lower(SPDesktop *desktop)
Geom::OptRect ref_bbox = SP_ITEM(newref)->desktopVisualBounds();
if ( ref_bbox && selected->intersects(*ref_bbox) ) {
// AND if it's not one of our selected objects,
- if (!g_slist_find((GSList *) items, newref)) {
+ if (!g_slist_find(const_cast<GSList *>(items), newref)) {
// move the selected object before that sibling
SPObject *put_after = prev_sibling(newref);
if (put_after)
@@ -1006,7 +1005,7 @@ void sp_selection_lower_to_bottom(SPDesktop *desktop)
return;
}
- GSList const *items = (GSList *) selection->itemList();
+ GSList const *items = const_cast<GSList *>(selection->itemList());
SPGroup const *group = sp_item_list_common_parent_group(items);
if (!group) {
@@ -1015,14 +1014,14 @@ void sp_selection_lower_to_bottom(SPDesktop *desktop)
}
GSList *rl;
- rl = g_slist_copy((GSList *) selection->reprList());
+ rl = g_slist_copy(const_cast<GSList *>(selection->reprList()));
rl = g_slist_sort(rl, (GCompareFunc) sp_repr_compare_position);
rl = g_slist_reverse(rl);
for (GSList *l = rl; l != NULL; l = l->next) {
gint minpos;
SPObject *pp, *pc;
- Inkscape::XML::Node *repr = (Inkscape::XML::Node *) l->data;
+ Inkscape::XML::Node *repr = static_cast<Inkscape::XML::Node *>(l->data);
pp = document->getObjectByRepr(repr->parent());
minpos = 0;
g_assert(SP_IS_GROUP(pp));
@@ -1217,7 +1216,7 @@ void sp_selection_to_next_layer(SPDesktop *dt, bool suppressDone)
return;
}
- GSList const *items = g_slist_copy((GSList *) selection->itemList());
+ GSList const *items = g_slist_copy(const_cast<GSList *>(selection->itemList()));
bool no_more = false; // Set to true, if no more layers above
SPObject *next=Inkscape::next_layer(dt->currentRoot(), dt->currentLayer());
@@ -1249,7 +1248,7 @@ void sp_selection_to_next_layer(SPDesktop *dt, bool suppressDone)
dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("No more layers above."));
}
- g_slist_free((GSList *) items);
+ g_slist_free(const_cast<GSList *>(items));
}
void sp_selection_to_prev_layer(SPDesktop *dt, bool suppressDone)
@@ -1262,7 +1261,7 @@ void sp_selection_to_prev_layer(SPDesktop *dt, bool suppressDone)
return;
}
- GSList const *items = g_slist_copy((GSList *) selection->itemList());
+ GSList const *items = g_slist_copy(const_cast<GSList *>(selection->itemList()));
bool no_more = false; // Set to true, if no more layers below
SPObject *next=Inkscape::previous_layer(dt->currentRoot(), dt->currentLayer());
@@ -1294,7 +1293,7 @@ void sp_selection_to_prev_layer(SPDesktop *dt, bool suppressDone)
dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("No more layers below."));
}
- g_slist_free((GSList *) items);
+ g_slist_free(const_cast<GSList *>(items));
}
bool
@@ -1507,7 +1506,7 @@ void sp_selection_remove_transform(SPDesktop *desktop)
Inkscape::Selection *selection = sp_desktop_selection(desktop);
- GSList const *l = (GSList *) selection->reprList();
+ GSList const *l = const_cast<GSList *>(selection->reprList());
while (l != NULL) {
((Inkscape::XML::Node*)l->data)->setAttribute("transform", NULL, false);
l = l->next;
@@ -2327,7 +2326,7 @@ void sp_selection_clone(SPDesktop *desktop)
return;
}
- GSList *reprs = g_slist_copy((GSList *) selection->reprList());
+ GSList *reprs = g_slist_copy(const_cast<GSList *>(selection->reprList()));
selection->clear();
@@ -2337,7 +2336,7 @@ void sp_selection_clone(SPDesktop *desktop)
GSList *newsel = NULL;
while (reprs) {
- Inkscape::XML::Node *sel_repr = (Inkscape::XML::Node *) reprs->data;
+ Inkscape::XML::Node *sel_repr = static_cast<Inkscape::XML::Node *>(reprs->data);
Inkscape::XML::Node *parent = sel_repr->parent();
Inkscape::XML::Node *clone = xml_doc->createElement("svg:use");
@@ -2387,11 +2386,11 @@ sp_selection_relink(SPDesktop *desktop)
// Get a copy of current selection.
bool relinked = false;
- for (GSList *items = (GSList *) selection->itemList();
+ for (GSList *items = const_cast<GSList *>(selection->itemList());
items != NULL;
items = items->next)
{
- SPItem *item = (SPItem *) items->data;
+ SPItem *item = static_cast<SPItem *>(items->data);
if (!SP_IS_USE(item))
continue;
@@ -2428,11 +2427,11 @@ sp_selection_unlink(SPDesktop *desktop)
// Get a copy of current selection.
GSList *new_select = NULL;
bool unlinked = false;
- for (GSList *items = g_slist_copy((GSList *) selection->itemList());
+ for (GSList *items = g_slist_copy(const_cast<GSList *>(selection->itemList()));
items != NULL;
items = items->next)
{
- SPItem *item = (SPItem *) items->data;
+ SPItem *item = static_cast<SPItem *>(items->data);
if (SP_IS_TEXT(item)) {
SPObject *tspan = sp_tref_convert_to_tspan(item);
@@ -2495,7 +2494,7 @@ sp_select_clone_original(SPDesktop *desktop)
gchar const *error = _("Select a <b>clone</b> to go to its original. Select a <b>linked offset</b> to go to its source. Select a <b>text on path</b> to go to the path. Select a <b>flowed text</b> to go to its frame.");
// Check if other than two objects are selected
- if (g_slist_length((GSList *) selection->itemList()) != 1 || !item) {
+ if (g_slist_length(const_cast<GSList *>(selection->itemList())) != 1 || !item) {
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, error);
return;
}
@@ -2575,7 +2574,7 @@ void sp_selection_clone_original_path_lpe(SPDesktop *desktop)
Inkscape::Selection *selection = sp_desktop_selection(desktop);
SPItem *item = selection->singleItem();
- if (g_slist_length((GSList *) selection->itemList()) != 1 || !item) {
+ if (g_slist_length(const_cast<GSList *>(selection->itemList())) != 1 || !item) {
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>one</b> path to clone."));
return;
}
@@ -2651,7 +2650,7 @@ void sp_selection_to_marker(SPDesktop *desktop, bool apply)
move_p[Geom::Y] = -move_p[Geom::Y];
Geom::Affine move = Geom::Affine(Geom::Translate(move_p));
- GSList *items = g_slist_copy((GSList *) selection->itemList());
+ GSList *items = g_slist_copy(const_cast<GSList *>(selection->itemList()));
items = g_slist_sort(items, (GCompareFunc) sp_object_compare_position);
@@ -2728,7 +2727,7 @@ void sp_selection_to_guides(SPDesktop *desktop)
SPDocument *doc = sp_desktop_document(desktop);
Inkscape::Selection *selection = sp_desktop_selection(desktop);
// we need to copy the list because it gets reset when objects are deleted
- GSList *items = g_slist_copy((GSList *) selection->itemList());
+ GSList *items = g_slist_copy(const_cast<GSList *>(selection->itemList()));
if (!items) {
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to convert to guides."));
@@ -2775,7 +2774,7 @@ sp_selection_tile(SPDesktop *desktop, bool apply)
move_p[Geom::Y] = -move_p[Geom::Y];
Geom::Affine move = Geom::Affine(Geom::Translate(move_p));
- GSList *items = g_slist_copy((GSList *) selection->itemList());
+ GSList *items = g_slist_copy(const_cast<GSList *>(selection->itemList()));
items = g_slist_sort(items, (GCompareFunc) sp_object_compare_position);
@@ -2837,7 +2836,7 @@ sp_selection_tile(SPDesktop *desktop, bool apply)
// restore parent and position
parent->getRepr()->appendChild(rect);
rect->setPosition(pos > 0 ? pos : 0);
- SPItem *rectangle = (SPItem *) sp_desktop_document(desktop)->getObjectByRepr(rect);
+ SPItem *rectangle = static_cast<SPItem *>(sp_desktop_document(desktop)->getObjectByRepr(rect));
Inkscape::GC::release(rect);
@@ -2872,11 +2871,11 @@ void sp_selection_untile(SPDesktop *desktop)
bool did = false;
- for (GSList *items = g_slist_copy((GSList *) selection->itemList());
+ for (GSList *items = g_slist_copy(const_cast<GSList *>(selection->itemList()));
items != NULL;
items = items->next) {
- SPItem *item = (SPItem *) items->data;
+ SPItem *item = static_cast<SPItem *>(items->data);
SPStyle *style = item->style;
@@ -2942,7 +2941,7 @@ void sp_selection_get_export_hints(Inkscape::Selection *selection, Glib::ustring
ydpi_search;
reprlst = reprlst->next) {
gchar const *dpi_string;
- Inkscape::XML::Node * repr = (Inkscape::XML::Node *)reprlst->data;
+ Inkscape::XML::Node * repr = static_cast<Inkscape::XML::Node *>(reprlst->data);
if (filename_search) {
const gchar* tmp = repr->attribute("inkscape:export-filename");
@@ -3028,7 +3027,7 @@ void sp_selection_create_bitmap_copy(SPDesktop *desktop)
}
// List of the items to show; all others will be hidden
- GSList *items = g_slist_copy((GSList *) selection->itemList());
+ GSList *items = g_slist_copy(const_cast<GSList *>(selection->itemList()));
// Sort items so that the topmost comes last
items = g_slist_sort(items, (GCompareFunc) sp_item_repr_compare_position);
@@ -3238,7 +3237,7 @@ void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_
doc->ensureUpToDate();
- GSList *items = g_slist_copy((GSList *) selection->itemList());
+ GSList *items = g_slist_copy(const_cast<GSList *>(selection->itemList()));
items = g_slist_sort(items, (GCompareFunc) sp_object_compare_position);
@@ -3434,7 +3433,7 @@ void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path) {
gchar const *attributeName = apply_clip_path ? "clip-path" : "mask";
std::map<SPObject*,SPItem*> referenced_objects;
- GSList *items = g_slist_copy((GSList *) selection->itemList());
+ GSList *items = g_slist_copy(const_cast<GSList *>(selection->itemList()));
selection->clear();
GSList *items_to_ungroup = NULL;
@@ -3499,13 +3498,13 @@ void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path) {
// Iterate through all clipped paths / masks
for (GSList *i = items_to_move; NULL != i; i = i->next) {
- Inkscape::XML::Node *repr = (Inkscape::XML::Node *)i->data;
+ Inkscape::XML::Node *repr = static_cast<Inkscape::XML::Node *>(i->data);
// insert into parent, restore pos
parent->appendChild(repr);
repr->setPosition((pos + 1) > 0 ? (pos + 1) : 0);
- SPItem *mask_item = (SPItem *) sp_desktop_document(desktop)->getObjectByRepr(repr);
+ SPItem *mask_item = static_cast<SPItem *>(sp_desktop_document(desktop)->getObjectByRepr(repr));
items_to_select = g_slist_prepend(items_to_select, mask_item);
// transform mask, so it is moved the same spot where mask was applied
diff --git a/src/seltrans.cpp b/src/seltrans.cpp
index 246dd82e0..ca190e5ad 100644
--- a/src/seltrans.cpp
+++ b/src/seltrans.cpp
@@ -48,7 +48,7 @@
#include "display/snap-indicator.h"
#if !GTK_CHECK_VERSION(2,22,0)
-#define GDK_KEY_space 0x020
+#include "compat-key-syms.h"
#endif
using Inkscape::DocumentUndo;
@@ -157,7 +157,7 @@ Inkscape::SelTrans::SelTrans(SPDesktop *desktop) :
sp_canvas_item_hide(_norm);
for (int i = 0; i < 4; i++) {
- _l[i] = sp_canvas_item_new(sp_desktop_controls(desktop), SP_TYPE_CTRLLINE, NULL);
+ _l[i] = SP_CTRLLINE(sp_canvas_item_new(sp_desktop_controls(desktop), SP_TYPE_CTRLLINE, NULL));
sp_canvas_item_hide(_l[i]);
}
@@ -202,7 +202,7 @@ Inkscape::SelTrans::~SelTrans()
}
for (int i = 0; i < 4; i++) {
if (_l[i]) {
- gtk_object_destroy(GTK_OBJECT(_l[i]));
+ gtk_object_destroy(_l[i]);
_l[i] = NULL;
}
}
@@ -404,7 +404,7 @@ void Inkscape::SelTrans::transform(Geom::Affine const &rel_affine, Geom::Point c
p[i] = _bbox->corner(i) * affine;
}
for (unsigned i = 0 ; i < 4 ; i++) {
- sp_ctrlline_set_coords(SP_CTRLLINE(_l[i]), p[i], p[(i+1)%4]);
+ _l[i]->setCoords(p[i], p[(i+1)%4]);
}
}
}
diff --git a/src/seltrans.h b/src/seltrans.h
index 122e7a522..55c109ed7 100644
--- a/src/seltrans.h
+++ b/src/seltrans.h
@@ -29,6 +29,7 @@
struct SPKnot;
class SPDesktop;
struct SPCanvasItem;
+struct SPCtrlLine;
class SPSelTransHandle;
namespace Inkscape
@@ -167,7 +168,7 @@ private:
SPKnot *_chandle;
SPCanvasItem *_norm;
SPCanvasItem *_grip;
- SPCanvasItem *_l[4];
+ SPCtrlLine *_l[4];
guint _sel_changed_id;
guint _sel_modified_id;
GSList *_stamp_cache;
diff --git a/src/shape-editor.cpp b/src/shape-editor.cpp
index 2034b9d2d..f2339770c 100644
--- a/src/shape-editor.cpp
+++ b/src/shape-editor.cpp
@@ -33,6 +33,8 @@
#include "shape-editor.h"
+using Inkscape::createKnotHolder;
+
ShapeEditor::ShapeEditor(SPDesktop *dt) {
this->desktop = dt;
this->knotholder = NULL;
@@ -184,7 +186,7 @@ void ShapeEditor::set_item(SPItem *item, SubType type, bool keep_knotholder) {
case SH_KNOTHOLDER:
if (!this->knotholder) {
// only recreate knotholder if none is present
- this->knotholder = sp_item_knot_holder(item, desktop);
+ this->knotholder = createKnotHolder(item, desktop);
}
if (this->knotholder) {
this->knotholder->update_knots();
diff --git a/src/shortcuts.cpp b/src/shortcuts.cpp
index 57fc59614..07685e0e9 100644
--- a/src/shortcuts.cpp
+++ b/src/shortcuts.cpp
@@ -1,5 +1,3 @@
-#define __SP_SHORTCUTS_C__
-
/** \file
* Keyboard shortcut processing.
*/
@@ -40,7 +38,7 @@
#include "xml/repr.h"
#if !GTK_CHECK_VERSION(2,22,0)
-#define GDK_KEY_VoidSymbol 0xffffff
+#include "compat-key-syms.h"
#endif
using namespace Inkscape;
diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp
index 9b8bf71de..b54ec65e2 100644
--- a/src/sp-item-group.cpp
+++ b/src/sp-item-group.cpp
@@ -486,7 +486,7 @@ sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done)
repr->setPosition(pos > 0 ? pos : 0);
// fill in the children list if non-null
- SPItem *item = (SPItem *) doc->getObjectByRepr(repr);
+ SPItem *item = static_cast<SPItem *>(doc->getObjectByRepr(repr));
item->doWriteTransform(repr, item->transform, NULL, false);
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index d6395cfee..e0a9b97f2 100644
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
@@ -660,15 +660,19 @@ Inkscape::XML::Node *SPItem::sp_item_write(SPObject *const object, Inkscape::XML
repr->setAttribute ("inkscape:transform-center-y", NULL);
}
- if (item->clip_ref->getObject()) {
- const gchar *value = g_strdup_printf ("url(%s)", item->clip_ref->getURI()->toString());
- repr->setAttribute ("clip-path", value);
- g_free ((void *) value);
- }
- if (item->mask_ref->getObject()) {
- const gchar *value = g_strdup_printf ("url(%s)", item->mask_ref->getURI()->toString());
- repr->setAttribute ("mask", value);
- g_free ((void *) value);
+ if (item->clip_ref){
+ if (item->clip_ref->getObject()) {
+ const gchar *value = g_strdup_printf ("url(%s)", item->clip_ref->getURI()->toString());
+ repr->setAttribute ("clip-path", value);
+ g_free ((void *) value);
+ }
+ }
+ if (item->mask_ref){
+ if (item->mask_ref->getObject()) {
+ const gchar *value = g_strdup_printf ("url(%s)", item->mask_ref->getURI()->toString());
+ repr->setAttribute ("mask", value);
+ g_free ((void *) value);
+ }
}
if (((SPObjectClass *) (SPItemClass::static_parent_class))->write) {
diff --git a/src/sp-use.cpp b/src/sp-use.cpp
index 5bbb1c1a8..e39f560c3 100644
--- a/src/sp-use.cpp
+++ b/src/sp-use.cpp
@@ -741,10 +741,14 @@ SPItem *sp_use_unlink(SPUse *use)
return item;
}
-SPItem *
-sp_use_get_original(SPUse *use)
+SPItem *sp_use_get_original(SPUse *use)
{
- SPItem *ref = use->ref->getObject();
+ SPItem *ref = NULL;
+ if (use){
+ if (use->ref){
+ ref = use->ref->getObject();
+ }
+ }
return ref;
}
diff --git a/src/spiral-context.cpp b/src/spiral-context.cpp
index 17d46ec2b..8bef16d87 100644
--- a/src/spiral-context.cpp
+++ b/src/spiral-context.cpp
@@ -46,69 +46,7 @@
#include "display/sp-canvas-item.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
using Inkscape::DocumentUndo;
diff --git a/src/spray-context.cpp b/src/spray-context.cpp
index b10c486c7..a575affc4 100644
--- a/src/spray-context.cpp
+++ b/src/spray-context.cpp
@@ -73,95 +73,7 @@
#include <glibmm/i18n.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_d 0x064
-#define GDK_KEY_D 0x044
-#define GDK_KEY_g 0x067
-#define GDK_KEY_G 0x047
-#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_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_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
using Inkscape::DocumentUndo;
diff --git a/src/star-context.cpp b/src/star-context.cpp
index 226721cfc..3520bdb53 100644
--- a/src/star-context.cpp
+++ b/src/star-context.cpp
@@ -50,69 +50,7 @@
#include "star-context.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
using Inkscape::DocumentUndo;
diff --git a/src/style.cpp b/src/style.cpp
index 93bd5ac76..40cd1663e 100644
--- a/src/style.cpp
+++ b/src/style.cpp
@@ -8,10 +8,12 @@
* bulia byak <buliabyak@users.sf.net>
* Abhishek Sharma
* Tavmjong Bah <tavmjong@free.fr>
+ * Kris De Gussem <Kris.DeGussem@gmail.com>
*
* Copyright (C) 2001-2002 Lauris Kaplinski
* Copyright (C) 2001 Ximian, Inc.
* Copyright (C) 2005 Monash University
+ * Copyright (C) 2012 Kris De Gussem
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
@@ -1169,7 +1171,7 @@ sp_style_merge_property(SPStyle *style, gint id, gchar const *val)
*/
g_warning("attribute 'clip-path' given as CSS");
- //XML Tree being directly used here.
+ //XML Tree being directly used here.
style->object->getRepr()->setAttribute("clip-path", val);
break;
case SP_PROP_CLIP_RULE:
@@ -1182,8 +1184,8 @@ sp_style_merge_property(SPStyle *style, gint id, gchar const *val)
* See comment for SP_PROP_CLIP_PATH
*/
g_warning("attribute 'mask' given as CSS");
-
- //XML Tree being directly used here.
+
+ //XML Tree being directly used here.
style->object->getRepr()->setAttribute("mask", val);
break;
case SP_PROP_OPACITY:
@@ -2407,8 +2409,11 @@ sp_style_set_ipaint_to_uri(SPStyle *style, SPIPaint *paint, const Inkscape::URI
paint->value.href->changedSignal().connect(sigc::bind(sigc::ptr_fun((paint == &style->fill)? sp_style_fill_paint_server_ref_changed : sp_style_stroke_paint_server_ref_changed), style));
}
- if (paint->value.href && paint->value.href->getObject())
- paint->value.href->detach();
+ if (paint->value.href){
+ if (paint->value.href->getObject()){
+ paint->value.href->detach();
+ }
+ }
if (paint->value.href) {
try {
@@ -2486,21 +2491,29 @@ sp_style_merge_ifilter(SPStyle *style, SPIFilter const *parent)
style->filter.set = parent->set;
style->filter.inherit = parent->inherit;
- if (style->filter.href && style->filter.href->getObject())
- style->filter.href->detach();
-
- // it may be that this style has not yet created its SPFilterReference
- if (!style->filter.href && style->object && style->object->document) {
- style->filter.href = new SPFilterReference(style->object->document);
- style->filter.href->changedSignal().connect(sigc::bind(sigc::ptr_fun(sp_style_filter_ref_changed), style));
+ if (style->filter.href){
+ if (style->filter.href->getObject()){
+ style->filter.href->detach();
+ }
+ }
+ else{
+ // it may be that this style has not yet created its SPFilterReference
+ if (style->object){
+ if (style->object->document) {
+ style->filter.href = new SPFilterReference(style->object->document);
+ style->filter.href->changedSignal().connect(sigc::bind(sigc::ptr_fun(sp_style_filter_ref_changed), style));
+ }
+ }
}
- if (style->filter.href && parent->href && parent->href->getObject()) {
- try {
- style->filter.href->attach(*parent->href->getURI());
- } catch (Inkscape::BadURIException &e) {
- g_warning("%s", e.what());
- style->filter.href->detach();
+ if (style->filter.href && parent->href){
+ if (parent->href->getObject()) {
+ try {
+ style->filter.href->attach(*parent->href->getURI());
+ } catch (Inkscape::BadURIException &e) {
+ g_warning("%s", e.what());
+ style->filter.href->detach();
+ }
}
}
}
@@ -3595,13 +3608,19 @@ sp_style_read_ifilter(gchar const *str, SPStyle * style, SPDocument *document)
if (streq(str, "inherit")) {
f->set = TRUE;
f->inherit = TRUE;
- if (f->href && f->href->getObject())
- f->href->detach();
+ if (f->href){
+ if (f->href->getObject()){
+ f->href->detach();
+ }
+ }
} else if(streq(str, "none")) {
f->set = TRUE;
f->inherit = FALSE;
- if (f->href && f->href->getObject())
- f->href->detach();
+ if (f->href){
+ if (f->href->getObject()){
+ f->href->detach();
+ }
+ }
} else if (strneq(str, "url", 3)) {
char *uri = extract_uri(str);
if(uri == NULL || uri[0] == '\0') {
@@ -3612,8 +3631,11 @@ sp_style_read_ifilter(gchar const *str, SPStyle * style, SPDocument *document)
}
f->set = TRUE;
f->inherit = FALSE;
- if (f->href && f->href->getObject())
- f->href->detach();
+ if (f->href){
+ if (f->href->getObject()){
+ f->href->detach();
+ }
+ }
// it may be that this style has not yet created its SPFilterReference;
// now that we have a document, we can create it here
@@ -3634,8 +3656,11 @@ sp_style_read_ifilter(gchar const *str, SPStyle * style, SPDocument *document)
/* We shouldn't reach this if SVG input is well-formed */
f->set = FALSE;
f->inherit = FALSE;
- if (f->href && f->href->getObject())
- f->href->detach();
+ if (f->href){
+ if (f->href->getObject()){
+ f->href->detach();
+ }
+ }
}
}
@@ -4258,9 +4283,10 @@ void SPIPaint::clear()
colorSet = false;
noneSet = false;
value.color.set( 0 );
- if ( value.href && value.href->getObject() )
- {
- value.href->detach();
+ if (value.href){
+ if (value.href->getObject()){
+ value.href->detach();
+ }
}
}
@@ -4271,8 +4297,11 @@ void SPIPaint::clear()
static void
sp_style_filter_clear(SPStyle *style)
{
- if (style->filter.href && style->filter.href->getObject())
- style->filter.href->detach();
+ if (style->filter.href){
+ if (style->filter.href->getObject()){
+ style->filter.href->detach();
+ }
+ }
}
diff --git a/src/style.h b/src/style.h
index 9a3d7309e..bdea441a6 100644
--- a/src/style.h
+++ b/src/style.h
@@ -168,7 +168,7 @@ struct SPIPaint {
bool isNone() const {return !currentcolor && !colorSet && !isPaintserver();} // TODO refine
bool isColor() const {return colorSet && !isPaintserver();}
- bool isPaintserver() const {return value.href && value.href->getObject();}
+ bool isPaintserver() const {return (value.href) ? value.href->getObject():0;}
void clear();
@@ -404,17 +404,17 @@ struct SPStyle {
sigc::connection fill_ps_modified_connection;
sigc::connection stroke_ps_modified_connection;
- SPObject *getFilter() { return (filter.href) ? filter.href->getObject() : 0; }
- SPObject const *getFilter() const { return (filter.href) ? filter.href->getObject() : 0; }
- gchar const *getFilterURI() const { return (filter.href) ? filter.href->getURI()->toString() : 0; }
+ SPObject *getFilter() { return (filter.href) ? filter.href->getObject() : NULL; }
+ SPObject const *getFilter() const { return (filter.href) ? filter.href->getObject() : NULL; }
+ gchar const *getFilterURI() const { return (filter.href) ? filter.href->getURI()->toString() : NULL; }
- SPPaintServer *getFillPaintServer() { return (fill.value.href) ? fill.value.href->getObject() : 0; }
- SPPaintServer const *getFillPaintServer() const { return (fill.value.href) ? fill.value.href->getObject() : 0; }
- gchar const *getFillURI() const { return (fill.value.href) ? fill.value.href->getURI()->toString() : 0; }
+ SPPaintServer *getFillPaintServer() { return (fill.value.href) ? fill.value.href->getObject() : NULL; }
+ SPPaintServer const *getFillPaintServer() const { return (fill.value.href) ? fill.value.href->getObject() : NULL; }
+ gchar const *getFillURI() const { return (fill.value.href) ? fill.value.href->getURI()->toString() : NULL; }
- SPPaintServer *getStrokePaintServer() { return (stroke.value.href) ? stroke.value.href->getObject() : 0; }
- SPPaintServer const *getStrokePaintServer() const { return (stroke.value.href) ? stroke.value.href->getObject() : 0; }
- gchar const *getStrokeURI() const { return (stroke.value.href) ? stroke.value.href->getURI()->toString() : 0; }
+ SPPaintServer *getStrokePaintServer() { return (stroke.value.href) ? stroke.value.href->getObject() : NULL; }
+ SPPaintServer const *getStrokePaintServer() const { return (stroke.value.href) ? stroke.value.href->getObject() : NULL; }
+ gchar const *getStrokeURI() const { return (stroke.value.href) ? stroke.value.href->getURI()->toString() : NULL; }
};
SPStyle *sp_style_new(SPDocument *document);
diff --git a/src/text-context.cpp b/src/text-context.cpp
index c2a9b6a24..2bf172f43 100644
--- a/src/text-context.cpp
+++ b/src/text-context.cpp
@@ -55,102 +55,7 @@
#include <gtk/gtk.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_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_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
using Inkscape::DocumentUndo;
@@ -295,9 +200,9 @@ static void sp_text_context_setup(SPEventContext *ec)
timeout /= 2;
}
- tc->cursor = sp_canvas_item_new(sp_desktop_controls(desktop), SP_TYPE_CTRLLINE, NULL);
- sp_ctrlline_set_coords(SP_CTRLLINE(tc->cursor), 100, 0, 100, 100);
- sp_ctrlline_set_rgba32(SP_CTRLLINE(tc->cursor), 0x000000ff);
+ tc->cursor = SP_CTRLLINE(sp_canvas_item_new(sp_desktop_controls(desktop), SP_TYPE_CTRLLINE, NULL));
+ tc->cursor->setCoords(100, 0, 100, 100);
+ tc->cursor->setRgba32(0x000000ff);
sp_canvas_item_hide(tc->cursor);
tc->indicator = sp_canvas_item_new(sp_desktop_controls(desktop), SP_TYPE_CTRLRECT, NULL);
@@ -397,7 +302,7 @@ static void sp_text_context_finish(SPEventContext *ec)
}
if (tc->cursor) {
- gtk_object_destroy(GTK_OBJECT(tc->cursor));
+ gtk_object_destroy(tc->cursor);
tc->cursor = NULL;
}
@@ -803,7 +708,7 @@ static gint sp_text_context_root_handler(SPEventContext *const event_context, Gd
// Cursor height is defined by the new text object's font size; it needs to be set
// artificially here, for the text object does not exist yet:
double cursor_height = sp_desktop_get_font_size_tool(desktop);
- sp_ctrlline_set_coords(SP_CTRLLINE(tc->cursor), p1, p1 + Geom::Point(0, cursor_height));
+ tc->cursor->setCoords(p1, p1 + Geom::Point(0, cursor_height));
if (tc->imc) {
GdkRectangle im_cursor;
Geom::Point const top_left = SP_EVENT_CONTEXT(tc)->desktop->get_display_area().corner(3);
@@ -1703,7 +1608,7 @@ static void sp_text_context_update_cursor(SPTextContext *tc, bool scroll_to_see
}
sp_canvas_item_show(tc->cursor);
- sp_ctrlline_set_coords(SP_CTRLLINE(tc->cursor), d0, d1);
+ tc->cursor->setCoords(d0, d1);
/* fixme: ... need another transformation to get canvas widget coordinate space? */
if (tc->imc) {
@@ -1794,10 +1699,10 @@ static gint sp_text_context_timeout(SPTextContext *tc)
sp_canvas_item_show(tc->cursor);
if (tc->phase) {
tc->phase = 0;
- sp_ctrlline_set_rgba32(SP_CTRLLINE(tc->cursor), 0x000000ff);
+ tc->cursor->setRgba32(0x000000ff);
} else {
tc->phase = 1;
- sp_ctrlline_set_rgba32(SP_CTRLLINE(tc->cursor), 0xffffffff);
+ tc->cursor->setRgba32(0xffffffff);
}
}
diff --git a/src/text-context.h b/src/text-context.h
index 50a738ca0..9915583eb 100644
--- a/src/text-context.h
+++ b/src/text-context.h
@@ -29,6 +29,7 @@
#define SP_IS_TEXT_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SP_TYPE_TEXT_CONTEXT))
#define SP_IS_TEXT_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SP_TYPE_TEXT_CONTEXT))
+struct SPCtrlLine;
class SPTextContext;
class SPTextContextClass;
@@ -53,7 +54,7 @@ struct SPTextContext : public SPEventContext {
bool unimode;
guint unipos;
- SPCanvasItem *cursor;
+ SPCtrlLine *cursor;
SPCanvasItem *indicator;
SPCanvasItem *frame; // hiliting the first frame of flowtext; FIXME: make this a list to accommodate arbitrarily many chained shapes
std::vector<SPCanvasItem*> text_selection_quads;
diff --git a/src/tweak-context.cpp b/src/tweak-context.cpp
index 112711d3b..b0395bcf1 100644
--- a/src/tweak-context.cpp
+++ b/src/tweak-context.cpp
@@ -82,62 +82,7 @@ using Inkscape::DocumentUndo;
#define DYNA_MIN_WIDTH 1.0e-6
#if !GTK_CHECK_VERSION(2,22,0)
-#define GDK_KEY_M 0x04d
-#define GDK_KEY_m 0x06d
-#define GDK_KEY_0 0x030
-#define GDK_KEY_1 0x031
-#define GDK_KEY_2 0x032
-#define GDK_KEY_3 0x033
-#define GDK_KEY_4 0x034
-#define GDK_KEY_5 0x035
-#define GDK_KEY_6 0x036
-#define GDK_KEY_7 0x037
-#define GDK_KEY_8 0x038
-#define GDK_KEY_9 0x039
-#define GDK_KEY_I 0x049
-#define GDK_KEY_i 0x069
-#define GDK_KEY_Z 0x05a
-#define GDK_KEY_z 0x07a
-#define GDK_KEY_less 0x03c
-#define GDK_KEY_comma 0x02c
-#define GDK_KEY_greater 0x03e
-#define GDK_KEY_period 0x02e
-#define GDK_KEY_bracketleft 0x05b
-#define GDK_KEY_bracketright 0x05d
-#define GDK_KEY_d 0x064
-#define GDK_KEY_D 0x044
-#define GDK_KEY_P 0x050
-#define GDK_KEY_p 0x070
-#define GDK_KEY_S 0x053
-#define GDK_KEY_s 0x073
-#define GDK_KEY_a 0x061
-#define GDK_KEY_A 0x041
-#define GDK_KEY_R 0x052
-#define GDK_KEY_r 0x072
-#define GDK_KEY_c 0x063
-#define GDK_KEY_C 0x043
-#define GDK_KEY_J 0x04a
-#define GDK_KEY_j 0x06a
-#define GDK_KEY_b 0x062
-#define GDK_KEY_B 0x042
-#define GDK_KEY_Up 0xff52
-#define GDK_KEY_Left 0xff51
-#define GDK_KEY_Right 0xff53
-#define GDK_KEY_Down 0xff54
-#define GDK_KEY_KP_Left 0xff96
-#define GDK_KEY_KP_Up 0xff97
-#define GDK_KEY_KP_Right 0xff98
-#define GDK_KEY_KP_Down 0xff99
-#define GDK_KEY_KP_Home 0xff95
-#define GDK_KEY_KP_End 0xff9c
-#define GDK_KEY_Home 0xff50
-#define GDK_KEY_End 0xff57
-#define GDK_KEY_X 0x058
-#define GDK_KEY_x 0x078
-#define GDK_KEY_Shift_L 0xffe1
-#define GDK_KEY_Shift_R 0xffe2
-#define GDK_KEY_Control_L 0xffe3
-#define GDK_KEY_Control_R 0xffe4
+#include "compat-key-syms.h"
#endif
static void sp_tweak_context_class_init(SPTweakContextClass *klass);
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;
diff --git a/src/vanishing-point.cpp b/src/vanishing-point.cpp
index fb48fb2d9..f90966578 100644
--- a/src/vanishing-point.cpp
+++ b/src/vanishing-point.cpp
@@ -766,17 +766,17 @@ VPDrag::swap_perspectives_of_VPs(Persp3D *persp2, Persp3D *persp1)
}
/**
-Create a line from p1 to p2 and add it to the lines list
+ * Create a line from p1 to p2 and add it to the lines list.
*/
-void
-VPDrag::addLine (Geom::Point p1, Geom::Point p2, guint32 rgba)
+void VPDrag::addLine(Geom::Point p1, Geom::Point p2, guint32 rgba)
{
- SPCanvasItem *line = sp_canvas_item_new(sp_desktop_controls(inkscape_active_desktop()), SP_TYPE_CTRLLINE, NULL);
- sp_ctrlline_set_coords(SP_CTRLLINE(line), p1, p2);
- if (rgba != VP_LINE_COLOR_FILL) // fill is the default, so don't set color for it to speed up redraw
- sp_ctrlline_set_rgba32 (SP_CTRLLINE(line), rgba);
- sp_canvas_item_show (line);
- this->lines = g_slist_append (this->lines, line);
+ SPCtrlLine *line = SP_CTRLLINE(sp_canvas_item_new(sp_desktop_controls(inkscape_active_desktop()), SP_TYPE_CTRLLINE, NULL));
+ line->setCoords(p1, p2);
+ if (rgba != VP_LINE_COLOR_FILL) { // fill is the default, so don't set color for it to speed up redraw
+ line->setRgba32(rgba);
+ }
+ sp_canvas_item_show(line);
+ this->lines = g_slist_append(this->lines, line);
}
} // namespace Box3D
diff --git a/src/verbs.cpp b/src/verbs.cpp
index 5d5414213..185efc1ac 100644
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
@@ -85,8 +85,7 @@
#include <gtk/gtk.h>
#if !GTK_CHECK_VERSION(2,22,0)
-#define GDK_KEY_KP_Add 0xffab
-#define GDK_KEY_KP_Subtract 0xffad
+#include "compat-key-syms.h"
#endif
using Inkscape::DocumentUndo;
diff --git a/src/widgets/dash-selector.cpp b/src/widgets/dash-selector.cpp
index 7f36b91f5..901d3b68c 100644
--- a/src/widgets/dash-selector.cpp
+++ b/src/widgets/dash-selector.cpp
@@ -61,9 +61,17 @@ SPDashSelector::SPDashSelector()
this->pack_start(dash_combo, false, false, 0);
+#if WITH_GTKMM_3_0
+ offset = Gtk::Adjustment::create(0.0, 0.0, 10.0, 0.1, 1.0, 0.0);
+#else
offset = new Gtk::Adjustment(0.0, 0.0, 10.0, 0.1, 1.0, 0.0);
+#endif
offset->signal_value_changed().connect(sigc::mem_fun(*this, &SPDashSelector::offset_value_changed));
+#if WITH_GTKMM_3_0
+ Inkscape::UI::Widget::SpinButton *sb = new Inkscape::UI::Widget::SpinButton(offset, 0.1, 2);
+#else
Inkscape::UI::Widget::SpinButton *sb = new Inkscape::UI::Widget::SpinButton(*offset, 0.1, 2);
+#endif
sb->set_tooltip_text(_("Pattern offset"));
sp_dialog_defocus_on_enter_cpp(sb);
sb->show();
@@ -84,7 +92,9 @@ SPDashSelector::SPDashSelector()
SPDashSelector::~SPDashSelector() {
// FIXME: for some reason this doesn't get called; does the call to manage() in
// sp_stroke_style_line_widget_new() not processed correctly?
+#if !WITH_GTKMM_3_0
delete offset;
+#endif
}
void SPDashSelector::prepareImageRenderer( Gtk::TreeModel::const_iterator const &row ) {
diff --git a/src/widgets/dash-selector.h b/src/widgets/dash-selector.h
index 875d8e9d5..0a572f4de 100644
--- a/src/widgets/dash-selector.h
+++ b/src/widgets/dash-selector.h
@@ -77,7 +77,11 @@ private:
Gtk::ComboBox dash_combo;
Gtk::CellRendererPixbuf image_renderer;
+#if WITH_GTKMM_3_0
+ Glib::RefPtr<Gtk::Adjustment> offset;
+#else
Gtk::Adjustment *offset;
+#endif
static gchar const *const _prefs_path;
int preview_width;
diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp
index 996f116e2..6aecc4ada 100644
--- a/src/widgets/desktop-widget.cpp
+++ b/src/widgets/desktop-widget.cpp
@@ -334,7 +334,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw )
/* Main table */
#if GTK_CHECK_VERSION(3,0,0)
dtw->vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
- gtk_box_new(GTK_BOX(dtw->vbox), FALSE);
+ gtk_box_set_homogeneous(GTK_BOX(dtw->vbox), FALSE);
#else
dtw->vbox = gtk_vbox_new (FALSE, 0);
#endif
@@ -413,13 +413,17 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw )
/* Horizontal scrollbar */
dtw->hadj = (GtkAdjustment *) gtk_adjustment_new (0.0, -4000.0, 4000.0, 10.0, 100.0, 4.0);
+#if GTK_CHECK_VERSION(3,0,0)
+ dtw->hscrollbar = gtk_scrollbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_ADJUSTMENT (dtw->hadj));
+#else
dtw->hscrollbar = gtk_hscrollbar_new (GTK_ADJUSTMENT (dtw->hadj));
+#endif
gtk_table_attach (GTK_TABLE (canvas_tbl), dtw->hscrollbar, 1, 2, 2, 3, (GtkAttachOptions)(GTK_FILL), (GtkAttachOptions)(GTK_SHRINK), 0, 0);
/* Vertical scrollbar and the sticky zoom button */
#if GTK_CHECK_VERSION(3,0,0)
dtw->vscrollbar_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
- gtk_box_new(GTK_BOX(dtw->vscrollbar_box), FALSE);
+ gtk_box_set_homogeneous(GTK_BOX(dtw->vscrollbar_box), FALSE);
#else
dtw->vscrollbar_box = gtk_vbox_new (FALSE, 0);
#endif
@@ -432,7 +436,11 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw )
gtk_box_pack_start (GTK_BOX (dtw->vscrollbar_box), dtw->sticky_zoom, FALSE, FALSE, 0);
g_signal_connect (G_OBJECT (dtw->sticky_zoom), "toggled", G_CALLBACK (sp_dtw_sticky_zoom_toggled), dtw);
dtw->vadj = (GtkAdjustment *) gtk_adjustment_new (0.0, -4000.0, 4000.0, 10.0, 100.0, 4.0);
+#if GTK_CHECK_VERSION(3,0,0)
+ dtw->vscrollbar = gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, GTK_ADJUSTMENT(dtw->vadj));
+#else
dtw->vscrollbar = gtk_vscrollbar_new (GTK_ADJUSTMENT (dtw->vadj));
+#endif
gtk_box_pack_start (GTK_BOX (dtw->vscrollbar_box), dtw->vscrollbar, TRUE, TRUE, 0);
gtk_table_attach (GTK_TABLE (canvas_tbl), dtw->vscrollbar_box, 2, 3, 0, 2, (GtkAttachOptions)(GTK_SHRINK), (GtkAttachOptions)(GTK_FILL), 0, 0);
@@ -517,7 +525,14 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw )
dtw->selected_style = new Inkscape::UI::Widget::SelectedStyle(true);
GtkHBox *ss_ = dtw->selected_style->gobj();
gtk_box_pack_start (GTK_BOX (dtw->statusbar), GTK_WIDGET(ss_), FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (dtw->statusbar), gtk_vseparator_new(), FALSE, FALSE, 0);
+
+ gtk_box_pack_start(GTK_BOX(dtw->statusbar),
+#if GTK_CHECK_VERSION(3,0,0)
+ gtk_separator_new(GTK_ORIENTATION_VERTICAL),
+#else
+ gtk_vseparator_new(),
+#endif
+ FALSE, FALSE, 0);
// connect scrollbar signals
g_signal_connect (G_OBJECT (dtw->hadj), "value-changed", G_CALLBACK (sp_desktop_widget_adjustment_value_changed), dtw);
@@ -546,7 +561,13 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw )
dtw->coord_status = gtk_table_new (5, 2, FALSE);
gtk_table_set_row_spacings(GTK_TABLE(dtw->coord_status), 0);
gtk_table_set_col_spacings(GTK_TABLE(dtw->coord_status), 2);
- gtk_table_attach(GTK_TABLE(dtw->coord_status), gtk_vseparator_new(), 0,1, 0,2, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_table_attach(GTK_TABLE(dtw->coord_status),
+#if GTK_CHECK_VERSION(3,0,0)
+ gtk_separator_new(GTK_ORIENTATION_VERTICAL),
+#else
+ gtk_vseparator_new(),
+#endif
+ 0,1, 0,2, GTK_FILL, GTK_FILL, 0, 0);
eventbox = gtk_event_box_new ();
gtk_container_add (GTK_CONTAINER (eventbox), dtw->coord_status);
gtk_widget_set_tooltip_text (eventbox, _("Cursor coordinates"));
diff --git a/src/widgets/font-selector.cpp b/src/widgets/font-selector.cpp
index ff361a6b8..affc6bed9 100644
--- a/src/widgets/font-selector.cpp
+++ b/src/widgets/font-selector.cpp
@@ -178,7 +178,7 @@ static void sp_font_selector_init(SPFontSelector *fsel)
#if GTK_CHECK_VERSION(3,0,0)
GtkWidget *vb = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
- gtk_box_new(GTK_BOX(vb), FALSE);
+ gtk_box_set_homogeneous(GTK_BOX(vb), FALSE);
#else
GtkWidget *vb = gtk_vbox_new(FALSE, 4);
#endif
diff --git a/src/widgets/gradient-toolbar.cpp b/src/widgets/gradient-toolbar.cpp
index a7b97c21a..92ed82845 100644
--- a/src/widgets/gradient-toolbar.cpp
+++ b/src/widgets/gradient-toolbar.cpp
@@ -62,17 +62,17 @@ using Inkscape::DocumentUndo;
using Inkscape::UI::ToolboxFactory;
void gr_apply_gradient_to_item( SPItem *item, SPGradient *gr, SPGradientType new_type, guint new_fill, bool do_fill, bool do_stroke );
-void gr_apply_gradient (Inkscape::Selection *selection, GrDrag *drag, SPGradient *gr);
+void gr_apply_gradient(Inkscape::Selection *selection, GrDrag *drag, SPGradient *gr);
gboolean gr_vector_list(GtkWidget *combo_box, SPDesktop *desktop, bool selection_empty, SPGradient *gr_selected, bool gr_multi);
-void gr_get_dt_selected_gradient (Inkscape::Selection *selection, SPGradient *&gr_selected);
+void gr_get_dt_selected_gradient(Inkscape::Selection *selection, SPGradient *&gr_selected);
void gr_read_selection( Inkscape::Selection *selection, GrDrag *drag, SPGradient *&gr_selected, bool &gr_multi, SPGradientSpread &spr_selected, bool &spr_multi );
static gboolean update_stop_list( GtkWidget *stop_combo, SPGradient *gradient, SPStop *new_stop, GtkWidget *widget, bool gr_multi);
static void sp_gradient_vector_widget_load_gradient(GtkWidget *widget, SPGradient *gradient);
static void select_stop_in_list( GtkWidget *combo_box, SPGradient *gradient, SPStop *new_stop, GtkWidget *data, gboolean block);
static void select_stop_by_drag( GtkWidget *combo_box, SPGradient *gradient, SPEventContext *ev, GtkWidget *data);
static void select_drag_by_stop( GtkWidget *combo_box, SPGradient *gradient, SPEventContext *ev);
-static SPGradient *gr_get_selected_gradient (GtkWidget *widget);
-static void gr_stop_set_offset (GtkComboBox *widget, GtkWidget *data);
+static SPGradient *gr_get_selected_gradient(GtkWidget *widget);
+static void gr_stop_set_offset(GtkComboBox *widget, GtkWidget *data);
void add_toolbar_widget(GtkWidget *tbl, GtkWidget *widget);
static GtkWidget * gr_ege_select_one_get_combo(GtkWidget *widget, const gchar *name);
void check_renderer(GtkWidget *combo);
@@ -123,7 +123,7 @@ to all objects in selection. If there was no previous gradient on an item, uses
fill/stroke setting from preferences to create new default (linear: left/right; radial: centered)
gradient.
*/
-void gr_apply_gradient (Inkscape::Selection *selection, GrDrag *drag, SPGradient *gr)
+void gr_apply_gradient(Inkscape::Selection *selection, GrDrag *drag, SPGradient *gr)
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
SPGradientType new_type = static_cast<SPGradientType>(prefs->getInt("/tools/gradient/newgradient", SP_GRADIENT_TYPE_LINEAR));
@@ -136,14 +136,14 @@ void gr_apply_gradient (Inkscape::Selection *selection, GrDrag *drag, SPGradient
GrDragger *dragger = static_cast<GrDragger*>(drag->selected->data);
for (GSList const* i = dragger->draggables; i != NULL; i = i->next) { // for all draggables of dragger
GrDraggable *draggable = (GrDraggable *) i->data;
- gr_apply_gradient_to_item (draggable->item, gr, new_type, new_fill, draggable->fill_or_stroke, !draggable->fill_or_stroke);
+ gr_apply_gradient_to_item(draggable->item, gr, new_type, new_fill, draggable->fill_or_stroke, !draggable->fill_or_stroke);
}
return;
}
// If no drag or no dragger selected, act on selection
for (GSList const* i = selection->itemList(); i != NULL; i = i->next) {
- gr_apply_gradient_to_item (SP_ITEM(i->data), gr, new_type, new_fill, new_fill, !new_fill);
+ gr_apply_gradient_to_item(SP_ITEM(i->data), gr, new_type, new_fill, new_fill, !new_fill);
}
}
@@ -154,10 +154,10 @@ gboolean gr_vector_list(GtkWidget *combo_box, SPDesktop *desktop, bool selection
return sensitive;
}
- SPDocument *document = sp_desktop_document (desktop);
+ SPDocument *document = sp_desktop_document(desktop);
GtkTreeIter iter;
- GtkListStore *store = (GtkListStore *)gtk_combo_box_get_model (GTK_COMBO_BOX(combo_box));
+ GtkListStore *store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(combo_box));
blocked = TRUE;
@@ -169,51 +169,49 @@ gboolean gr_vector_list(GtkWidget *combo_box, SPDesktop *desktop, bool selection
for (const GSList *i = gradients; i != NULL; i = i->next) {
SPGradient *grad = SP_GRADIENT(i->data);
if ( grad->hasStops() && !grad->isSolid() ) {
- gl = g_slist_prepend (gl, i->data);
+ gl = g_slist_prepend(gl, i->data);
}
}
- gl = g_slist_reverse (gl);
+ gl = g_slist_reverse(gl);
guint pos = 0;
if (!gl) {
// The document has no gradients
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, _("No gradient"), 1, NULL, 2, NULL, -1);
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter, 0, _("No gradient"), 1, NULL, 2, NULL, -1);
sensitive = FALSE;
} else if (selection_empty) {
// Document has gradients, but nothing is currently selected.
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, _("Nothing selected"), 1, NULL, 2, NULL, -1);
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter, 0, _("Nothing selected"), 1, NULL, 2, NULL, -1);
sensitive = FALSE;
} else {
if (gr_selected == NULL) {
-
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, _("No gradient"), 1, NULL, 2, NULL, -1);
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter, 0, _("No gradient"), 1, NULL, 2, NULL, -1);
sensitive = FALSE;
}
if (gr_multi) {
-
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, _("Multiple gradients"), 1, NULL, 2, NULL, -1);
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter, 0, _("Multiple gradients"), 1, NULL, 2, NULL, -1);
sensitive = FALSE;
}
guint idx = 0;
while (gl) {
- SPGradient *gradient = SP_GRADIENT (gl->data);
- gl = g_slist_remove (gl, gradient);
+ SPGradient *gradient = SP_GRADIENT(gl->data);
+ gl = g_slist_remove(gl, gradient);
gchar *label = gr_prepare_label(gradient);
- GdkPixbuf *pixb = sp_gradient_to_pixbuf (gradient, 64, 16);
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, label, 1, pixb, 2, gradient, -1);
- g_free (label);
+ GdkPixbuf *pixb = sp_gradient_to_pixbuf(gradient, 64, 16);
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter, 0, label, 1, pixb, 2, gradient, -1);
+ g_free(label);
if (gradient == gr_selected) {
pos = idx;
@@ -226,10 +224,10 @@ gboolean gr_vector_list(GtkWidget *combo_box, SPDesktop *desktop, bool selection
/* Select the current gradient, or the Multi/Nothing line */
if (gr_multi || gr_selected == NULL) {
- gtk_combo_box_set_active (GTK_COMBO_BOX(combo_box) , 0);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box) , 0);
}
else {
- gtk_combo_box_set_active (GTK_COMBO_BOX(combo_box) , pos);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box) , pos);
}
blocked = FALSE;
@@ -240,7 +238,7 @@ gboolean gr_vector_list(GtkWidget *combo_box, SPDesktop *desktop, bool selection
* Get the gradient of the selected desktop item
* This is gradient containing the repeat settings, not the underlying "getVector" href linked gradient.
*/
-void gr_get_dt_selected_gradient (Inkscape::Selection *selection, SPGradient *&gr_selected)
+void gr_get_dt_selected_gradient(Inkscape::Selection *selection, SPGradient *&gr_selected)
{
SPGradient *gradient = 0;
@@ -456,28 +454,28 @@ static GtkWidget * gr_ege_select_one_get_combo(GtkWidget *widget, const gchar *n
return combo_box;
}
-static void gr_tb_selection_modified (Inkscape::Selection *selection, guint /*flags*/, gpointer data)
+static void gr_tb_selection_modified(Inkscape::Selection *selection, guint /*flags*/, gpointer data)
{
- gr_tb_selection_changed (selection, data);
+ gr_tb_selection_changed(selection, data);
}
-static void gr_drag_selection_changed (gpointer /*dragger*/, gpointer data)
+static void gr_drag_selection_changed(gpointer /*dragger*/, gpointer data)
{
- gr_tb_selection_changed (NULL, data);
+ gr_tb_selection_changed(NULL, data);
}
-static void gr_defs_release (SPObject */*defs*/, GtkWidget *widget)
+static void gr_defs_release(SPObject * /*defs*/, GtkWidget *widget)
{
- gr_tb_selection_changed (NULL, (gpointer) widget);
+ gr_tb_selection_changed(NULL, (gpointer) widget);
}
-static void gr_defs_modified (SPObject */*defs*/, guint /*flags*/, GtkWidget *widget)
+static void gr_defs_modified(SPObject * /*defs*/, guint /*flags*/, GtkWidget *widget)
{
- gr_tb_selection_changed (NULL, (gpointer) widget);
+ gr_tb_selection_changed(NULL, (gpointer) widget);
}
-static void gr_disconnect_sigc (GObject */*obj*/, sigc::connection *connection) {
+static void gr_disconnect_sigc(GObject * /*obj*/, sigc::connection *connection) {
connection->disconnect();
delete connection;
}
@@ -489,9 +487,9 @@ static SPStop *get_selected_stop( GtkWidget *vb)
GtkWidget *cb = gr_ege_select_one_get_combo(vb, "gradient_stops_combo_action");
if ( cb ) {
GtkTreeIter iter;
- if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX(cb), &iter)) {
- GtkListStore *store = (GtkListStore *)gtk_combo_box_get_model (GTK_COMBO_BOX(cb));
- gtk_tree_model_get (GTK_TREE_MODEL(store), &iter, 2, &stop, -1);
+ if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(cb), &iter)) {
+ GtkListStore *store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(cb));
+ gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 2, &stop, -1);
}
}
@@ -499,7 +497,7 @@ static SPStop *get_selected_stop( GtkWidget *vb)
}
-static void sp_gradient_vector_gradient_release(SPObject */*object*/, GtkWidget *widget)
+static void sp_gradient_vector_gradient_release(SPObject * /*object*/, GtkWidget *widget)
{
sp_gradient_vector_widget_load_gradient(widget, NULL);
}
@@ -587,8 +585,7 @@ static void sp_gradient_vector_widget_load_gradient(GtkWidget *widget, SPGradien
blocked = FALSE;
}
-static void
-gr_add_stop (GtkWidget */*button*/,GtkWidget *vb)
+static void gr_add_stop(GtkWidget * /*button*/, GtkWidget *vb)
{
SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data(G_OBJECT(vb), "desktop"));
if (!desktop) {
@@ -604,13 +601,12 @@ gr_add_stop (GtkWidget */*button*/,GtkWidget *vb)
SPGradientContext *rc = SP_GRADIENT_CONTEXT(ev);
if (rc) {
- sp_gradient_context_add_stops_between_selected_stops (rc);
+ sp_gradient_context_add_stops_between_selected_stops(rc);
}
}
-static void
-gr_remove_stop (GtkWidget */*button*/, GtkWidget *vb)
+static void gr_remove_stop(GtkWidget * /*button*/, GtkWidget *vb)
{
SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data(G_OBJECT(vb), "desktop"));
@@ -635,8 +631,7 @@ gr_remove_stop (GtkWidget */*button*/, GtkWidget *vb)
}
-static void
-gr_linked_changed (GtkToggleAction *act, gpointer data)
+static void gr_linked_changed(GtkToggleAction *act, gpointer /*data*/)
{
gboolean active = gtk_toggle_action_get_active( act );
if ( active ) {
@@ -649,12 +644,11 @@ gr_linked_changed (GtkToggleAction *act, gpointer data)
prefs->setBool("/options/forkgradientvectors/value", !active);
}
-static void
-gr_reverse (GtkWidget */*button*/, gpointer data)
+static void gr_reverse(GtkWidget * /*button*/, gpointer data)
{
SPDesktop *desktop = static_cast<SPDesktop *>(data);
- Inkscape::Selection *selection = sp_desktop_selection (desktop);
- SPEventContext *ev = sp_desktop_event_context (desktop);
+ Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ SPEventContext *ev = sp_desktop_event_context(desktop);
if (!ev) {
return;
@@ -667,12 +661,12 @@ gr_reverse (GtkWidget */*button*/, gpointer data)
drag->selected_reverse_vector();
} else { // If no drag or no dragger selected, act on selection (both fill and stroke gradients)
for (GSList const* i = selection->itemList(); i != NULL; i = i->next) {
- sp_item_gradient_reverse_vector (SP_ITEM(i->data), true);
- sp_item_gradient_reverse_vector (SP_ITEM(i->data), false);
+ sp_item_gradient_reverse_vector(SP_ITEM(i->data), true);
+ sp_item_gradient_reverse_vector(SP_ITEM(i->data), false);
}
}
// we did an undoable action
- DocumentUndo::done(sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT,
+ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_GRADIENT,
_("Invert gradient"));
}
@@ -718,7 +712,7 @@ static void select_stop_by_drag(GtkWidget *combo_box, SPGradient *gradient, SPEv
if (!drag || !drag->selected) {
blocked = TRUE;
- gtk_combo_box_set_active (GTK_COMBO_BOX(combo_box) , 0);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box) , 0);
gr_stop_set_offset(GTK_COMBO_BOX(combo_box), data);
blocked = FALSE;
return;
@@ -739,14 +733,14 @@ static void select_stop_by_drag(GtkWidget *combo_box, SPGradient *gradient, SPEv
if (n > 1) {
// Mulitple stops selected
- GtkListStore *store = (GtkListStore *)gtk_combo_box_get_model (GTK_COMBO_BOX(combo_box));
+ GtkListStore *store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(combo_box));
if (!store) {
return;
}
GtkTreeIter iter;
- gtk_list_store_prepend (store, &iter);
- gtk_list_store_set (store, &iter, 0, _("Multiple stops"), 1, NULL, 2, NULL, -1);
- gtk_combo_box_set_active (GTK_COMBO_BOX(combo_box) , 0);
+ gtk_list_store_prepend(store, &iter);
+ gtk_list_store_set(store, &iter, 0, _("Multiple stops"), 1, NULL, 2, NULL, -1);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box) , 0);
EgeAdjustmentAction* act = (EgeAdjustmentAction *)g_object_get_data( G_OBJECT(data), "offset_action");
if (act) {
@@ -794,7 +788,7 @@ static void select_stop_in_list( GtkWidget *combo_box, SPGradient *gradient, SPS
if (SP_IS_STOP(ochild)) {
if (ochild == new_stop) {
blocked = block;
- gtk_combo_box_set_active (GTK_COMBO_BOX(combo_box) , i);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box) , i);
gr_stop_set_offset(GTK_COMBO_BOX(combo_box), data);
blocked = FALSE;
return;
@@ -812,7 +806,7 @@ static gboolean update_stop_list( GtkWidget *stop_combo, SPGradient *gradient, S
return sensitive;
}
- GtkListStore *store = (GtkListStore *)gtk_combo_box_get_model (GTK_COMBO_BOX(stop_combo));
+ GtkListStore *store = (GtkListStore *)gtk_combo_box_get_model(GTK_COMBO_BOX(stop_combo));
if (!store) {
return sensitive;
}
@@ -824,9 +818,9 @@ static gboolean update_stop_list( GtkWidget *stop_combo, SPGradient *gradient, S
GtkTreeIter iter;
if (!SP_IS_GRADIENT(gradient)) {
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, _("No gradient"), 1, NULL, 2, NULL, -1);
- gtk_combo_box_set_active (GTK_COMBO_BOX(stop_combo) , 0);
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter, 0, _("No gradient"), 1, NULL, 2, NULL, -1);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(stop_combo) , 0);
sensitive = FALSE;
blocked = FALSE;
return sensitive;
@@ -842,8 +836,8 @@ static gboolean update_stop_list( GtkWidget *stop_combo, SPGradient *gradient, S
}
}
if (!sl) {
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, _("No stops in gradient"), 1, NULL, 2, NULL, -1);
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter, 0, _("No stops in gradient"), 1, NULL, 2, NULL, -1);
sensitive = FALSE;
} else {
@@ -855,8 +849,8 @@ static gboolean update_stop_list( GtkWidget *stop_combo, SPGradient *gradient, S
Inkscape::UI::Widget::ColorPreview *cpv = Gtk::manage(new Inkscape::UI::Widget::ColorPreview(sp_stop_get_rgba32(stop)));
GdkPixbuf *pb = cpv->toPixbuf(32, 16);
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, repr->attribute("id"), 1, pb, 2, stop, -1);
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter, 0, repr->attribute("id"), 1, pb, 2, stop, -1);
sensitive = FALSE;
}
}
@@ -869,7 +863,7 @@ static gboolean update_stop_list( GtkWidget *stop_combo, SPGradient *gradient, S
}
if (new_stop == NULL) {
- gtk_combo_box_set_active (GTK_COMBO_BOX(stop_combo) , 0);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(stop_combo) , 0);
} else {
select_stop_in_list(stop_combo, gradient, new_stop, widget, TRUE);
}
@@ -879,7 +873,7 @@ static gboolean update_stop_list( GtkWidget *stop_combo, SPGradient *gradient, S
return sensitive;
}
-static SPGradient *gr_get_selected_gradient (GtkWidget *widget)
+static SPGradient *gr_get_selected_gradient(GtkWidget *widget)
{
SPGradient *gr = NULL;
EgeSelectOneAction* act1 = (EgeSelectOneAction *)g_object_get_data( G_OBJECT(widget), "gradient_select_combo_action");
@@ -887,8 +881,8 @@ static SPGradient *gr_get_selected_gradient (GtkWidget *widget)
gint n = ege_select_one_action_get_active(act1);
GtkTreeModel *model = ege_select_one_action_get_model(act1);
GtkTreeIter iter;
- if (gtk_tree_model_iter_nth_child (model ,&iter, NULL, n)) {
- gtk_tree_model_get (model, &iter, 2, &gr, -1);
+ if (gtk_tree_model_iter_nth_child(model, &iter, NULL, n)) {
+ gtk_tree_model_get(model, &iter, 2, &gr, -1);
return gr;
}
}
@@ -896,17 +890,18 @@ static SPGradient *gr_get_selected_gradient (GtkWidget *widget)
return gr;
}
-/*static void
-gr_edit (GtkWidget *button, GtkWidget *widget)
+/*
+static void gr_edit(GtkWidget *button, GtkWidget *widget)
{
SPGradient *gr = gr_get_selected_gradient(widget);
if (gr) {
- GtkWidget *dialog = sp_gradient_vector_editor_new (gr);
- gtk_widget_show (dialog);
+ GtkWidget *dialog = sp_gradient_vector_editor_new(gr);
+ gtk_widget_show(dialog);
}
-}*/
+}
+*/
-static void gr_stop_set_offset (GtkComboBox */*widget*/, GtkWidget *data)
+static void gr_stop_set_offset(GtkComboBox * /*widget*/, GtkWidget *data)
{
SPStop *stop = get_selected_stop(data);
if (!stop) {
@@ -925,19 +920,19 @@ static void gr_stop_set_offset (GtkComboBox */*widget*/, GtkWidget *data)
SPStop *prev = NULL;
prev = stop->getPrevStop();
if (prev != NULL ) {
- gtk_adjustment_set_lower (adj, prev->offset);
+ gtk_adjustment_set_lower(adj, prev->offset);
} else {
isEndStop = true;
- gtk_adjustment_set_lower (adj, 0);
+ gtk_adjustment_set_lower(adj, 0);
}
SPStop *next = NULL;
next = stop->getNextStop();
if (next != NULL ) {
- gtk_adjustment_set_upper (adj, next->offset);
+ gtk_adjustment_set_upper(adj, next->offset);
} else {
isEndStop = true;
- gtk_adjustment_set_upper (adj, 1.0);
+ gtk_adjustment_set_upper(adj, 1.0);
}
blocked = TRUE;
@@ -970,7 +965,7 @@ static void gr_new_fillstroke_changed( EgeSelectOneAction *act, GObject * /*tbl*
/*
* User selected a gradient from the combobox
*/
-void gr_gradient_combo_changed (EgeSelectOneAction *act, gpointer data)
+void gr_gradient_combo_changed(EgeSelectOneAction *act, gpointer data)
{
if (blocked) {
return;
@@ -980,42 +975,42 @@ void gr_gradient_combo_changed (EgeSelectOneAction *act, gpointer data)
gint n = ege_select_one_action_get_active(act);
GtkTreeModel *model = ege_select_one_action_get_model(act);
GtkTreeIter iter;
- if (gtk_tree_model_iter_nth_child (model ,&iter, NULL, n)) {
- gtk_tree_model_get (model, &iter, 2, &gr, -1);
+ if (gtk_tree_model_iter_nth_child(model, &iter, NULL, n)) {
+ gtk_tree_model_get(model, &iter, 2, &gr, -1);
}
if (gr) {
gr = sp_gradient_ensure_vector_normalized(gr);
SPDesktop *desktop = static_cast<SPDesktop *>(data);
- Inkscape::Selection *selection = sp_desktop_selection (desktop);
- SPEventContext *ev = sp_desktop_event_context (desktop);
+ Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ SPEventContext *ev = sp_desktop_event_context(desktop);
- gr_apply_gradient (selection, ev? ev->get_drag() : NULL, gr);
+ gr_apply_gradient(selection, ev? ev->get_drag() : NULL, gr);
- DocumentUndo::done(sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT,
+ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_GRADIENT,
_("Assign gradient to object"));
}
}
-void gr_spread_change (EgeSelectOneAction *act, GtkWidget *widget)
+void gr_spread_change(EgeSelectOneAction *act, GtkWidget *widget)
{
if (blocked) {
return;
}
SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data(G_OBJECT(widget), "desktop"));
- Inkscape::Selection *selection = sp_desktop_selection (desktop);
+ Inkscape::Selection *selection = sp_desktop_selection(desktop);
SPGradient *gradient = 0;
gr_get_dt_selected_gradient(selection, gradient);
if (gradient) {
- SPGradientSpread spread = (SPGradientSpread) ege_select_one_action_get_active (act);
+ SPGradientSpread spread = (SPGradientSpread) ege_select_one_action_get_active(act);
gradient->setSpread(spread);
gradient->updateRepr();
- DocumentUndo::done(sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT,
+ DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_GRADIENT,
_("Set gradient repeat"));
}
}
@@ -1024,14 +1019,14 @@ void gr_spread_change (EgeSelectOneAction *act, GtkWidget *widget)
/*
* User selected a stop from the combobox
*/
-static void gr_stop_combo_changed (GtkComboBox * /*widget*/, GtkWidget *data)
+static void gr_stop_combo_changed(GtkComboBox * /*widget*/, GtkWidget *data)
{
if (blocked) {
return;
}
SPDesktop *desktop = static_cast<SPDesktop *>(g_object_get_data(G_OBJECT(data), "desktop"));
- SPEventContext *ev = sp_desktop_event_context (desktop);
+ SPEventContext *ev = sp_desktop_event_context(desktop);
SPGradient *gr = gr_get_selected_gradient(data);
select_drag_by_stop(data, gr, ev);
@@ -1050,7 +1045,7 @@ static void gr_stop_offset_adjustment_changed(GtkAdjustment *adj, GObject *tbl)
SPStop *stop = get_selected_stop(GTK_WIDGET(tbl));
if (stop) {
- stop->offset = gtk_adjustment_get_value (adj);
+ stop->offset = gtk_adjustment_get_value(adj);
sp_repr_set_css_double(stop->getRepr(), "offset", stop->offset);
DocumentUndo::maybeDone(stop->document, "gradient:stop:offset", SP_VERB_CONTEXT_GRADIENT,
@@ -1069,16 +1064,16 @@ void check_renderer(GtkWidget *combo)
gpointer rendered = g_object_get_data( G_OBJECT(combo), "renderers" );
if (!rendered) {
- gtk_cell_layout_clear(GTK_CELL_LAYOUT (combo));
+ gtk_cell_layout_clear(GTK_CELL_LAYOUT(combo));
- GtkCellRenderer *renderer = gtk_cell_renderer_pixbuf_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, FALSE);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer, "pixbuf", 1, NULL);
+ GtkCellRenderer *renderer = gtk_cell_renderer_pixbuf_new();
+ gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), renderer, FALSE);
+ gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), renderer, "pixbuf", 1, NULL);
gtk_cell_renderer_set_padding(renderer, 5, 0);
- renderer = gtk_cell_renderer_text_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), renderer, "text", 0, NULL);
+ renderer = gtk_cell_renderer_text_new();
+ gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), renderer, TRUE);
+ gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), renderer, "text", 0, NULL);
g_object_set_data(G_OBJECT(combo), "renderers", renderer);
}
@@ -1155,11 +1150,11 @@ void sp_gradient_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions,
/* Gradient Select list*/
{
- GtkListStore *store = gtk_list_store_new (3, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_POINTER);
+ GtkListStore *store = gtk_list_store_new(3, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_POINTER);
GtkTreeIter iter;
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, _("No gradient"), 1, NULL, 2, NULL, -1);
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter, 0, _("No gradient"), 1, NULL, 2, NULL, -1);
EgeSelectOneAction* act1 = ege_select_one_action_new( "GradientSelectGradientAction", _("Select"), ("Choose a gradient"), NULL, GTK_TREE_MODEL(store) );
g_object_set( act1, "short_label", _("Select:"), NULL );
@@ -1202,11 +1197,11 @@ void sp_gradient_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions,
/* Gradient Stop list */
{
- GtkListStore *store = gtk_list_store_new (3, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_POINTER);
+ GtkListStore *store = gtk_list_store_new(3, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_POINTER);
GtkTreeIter iter;
- gtk_list_store_append (store, &iter);
- gtk_list_store_set (store, &iter, 0, _("No gradient"), 1, NULL, 2, NULL, -1);
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter, 0, _("No gradient"), 1, NULL, 2, NULL, -1);
EgeSelectOneAction* act1 = ege_select_one_action_new( "GradientEditStopsAction", _("Stops"), _("Select a stop for the current gradient"), NULL, GTK_TREE_MODEL(store) );
g_object_set( act1, "short_label", _("Edit:"), NULL );
@@ -1294,8 +1289,8 @@ void sp_gradient_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions,
gtk_toggle_action_set_active( GTK_TOGGLE_ACTION(itact), !linkedmode );
}
- Inkscape::Selection *selection = sp_desktop_selection (desktop);
- SPDocument *document = sp_desktop_document (desktop);
+ Inkscape::Selection *selection = sp_desktop_selection(desktop);
+ SPDocument *document = sp_desktop_document(desktop);
g_object_set_data(holder, "desktop", desktop);
diff --git a/src/widgets/paint-selector.cpp b/src/widgets/paint-selector.cpp
index 075308321..c1147f9b0 100644
--- a/src/widgets/paint-selector.cpp
+++ b/src/widgets/paint-selector.cpp
@@ -290,7 +290,7 @@ sp_paint_selector_init(SPPaintSelector *psel)
#if GTK_CHECK_VERSION(3,0,0)
psel->frame = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
- gtk_box_new(GTK_BOX(psel->frame), FALSE);
+ gtk_box_set_homogeneous(GTK_BOX(psel->frame), FALSE);
#else
psel->frame = gtk_vbox_new(FALSE, 4);
#endif
@@ -664,7 +664,7 @@ static void sp_paint_selector_set_mode_color(SPPaintSelector *psel, SPPaintSelec
/* Create vbox */
#if GTK_CHECK_VERSION(3,0,0)
GtkWidget *vb = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
- gtk_box_new(GTK_BOX(vb), FALSE);
+ gtk_box_set_homogeneous(GTK_BOX(vb), FALSE);
#else
GtkWidget *vb = gtk_vbox_new(FALSE, 4);
#endif
@@ -1003,7 +1003,7 @@ static void sp_paint_selector_set_mode_pattern(SPPaintSelector *psel, SPPaintSel
/* Create vbox */
#if GTK_CHECK_VERSION(3,0,0)
tbl = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
- gtk_box_new(GTK_BOX(tbl), FALSE);
+ gtk_box_set_homogeneous(GTK_BOX(tbl), FALSE);
#else
tbl = gtk_vbox_new(FALSE, 4);
#endif
diff --git a/src/widgets/ruler.cpp b/src/widgets/ruler.cpp
index b4fbb13c5..845d56e1c 100644
--- a/src/widgets/ruler.cpp
+++ b/src/widgets/ruler.cpp
@@ -83,14 +83,22 @@ static void gtk_deprecated_ruler_real_draw_ticks (GtkDeprecatedRuler *
static void gtk_deprecated_ruler_real_draw_pos (GtkDeprecatedRuler *ruler);
-static const GtkDeprecatedRulerMetric ruler_metrics[] =
-{
- { "Pixel", "Pi", 1.0, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }},
- { "Inches", "In", 72.0, { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 }, { 1, 2, 4, 8, 16 }},
- { "Centimeters", "Cn", 28.35, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }},
-};
#define GTK_DEPRECATED_RULER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_DEPRECATED_TYPE_RULER, GtkDeprecatedRulerPrivate))
+// Note: const casts are due to GtkDeprecatedRuler being const-broken and not scheduled for any more fixes.
+/// Ruler metrics.
+static GtkDeprecatedRulerMetric const sp_ruler_metrics[] = {
+ // NOTE: the order of records in this struct must correspond to the SPMetric enum.
+ {const_cast<gchar*>("NONE"), const_cast<gchar*>(""), 1, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }},
+ {const_cast<gchar*>("millimeters"), const_cast<gchar*>("mm"), PX_PER_MM, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }},
+ {const_cast<gchar*>("centimeters"), const_cast<gchar*>("cm"), PX_PER_CM, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }},
+ {const_cast<gchar*>("inches"), const_cast<gchar*>("in"), PX_PER_IN, { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 }, { 1, 2, 4, 8, 16 }},
+ {const_cast<gchar*>("feet"), const_cast<gchar*>("ft"), PX_PER_FT, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }},
+ {const_cast<gchar*>("points"), const_cast<gchar*>("pt"), PX_PER_PT, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }},
+ {const_cast<gchar*>("picas"), const_cast<gchar*>("pc"), PX_PER_PC, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }},
+ {const_cast<gchar*>("pixels"), const_cast<gchar*>("px"), PX_PER_PX, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }},
+ {const_cast<gchar*>("meters"), const_cast<gchar*>("m"), PX_PER_M, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }},
+};
G_DEFINE_TYPE_WITH_CODE (GtkDeprecatedRuler, gtk_deprecated_ruler, GTK_TYPE_WIDGET,
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE,
@@ -167,14 +175,16 @@ gtk_deprecated_ruler_class_init (GtkDeprecatedRulerClass *klass)
* GtkDeprecatedRuler:metric:
*
* The metric used for the ruler.
+ *
+ * TODO: This should probably use g_param_spec_enum
*/
g_object_class_install_property (gobject_class,
PROP_METRIC,
- g_param_spec_enum ("metric",
+ g_param_spec_uint("metric",
_("Metric"),
_("The metric used for the ruler"),
- GTK_TYPE_METRIC_TYPE,
- GTK_PIXELS,
+ 0, 8,
+ SP_PX,
static_cast<GParamFlags>(GTK_PARAM_READWRITE)));
g_type_class_add_private (gobject_class, sizeof (GtkDeprecatedRulerPrivate));
@@ -196,7 +206,7 @@ gtk_deprecated_ruler_init (GtkDeprecatedRuler *ruler)
ruler->position = 0;
ruler->max_size = 0;
- gtk_deprecated_ruler_set_metric (ruler, GTK_PIXELS);
+ sp_ruler_set_metric(ruler, SP_PX);
}
@@ -310,7 +320,7 @@ gtk_deprecated_ruler_set_property (GObject *object,
ruler->position, g_value_get_double (value));
break;
case PROP_METRIC:
- gtk_deprecated_ruler_set_metric (ruler, static_cast<GtkMetricType>(g_value_get_enum (value)));
+ sp_ruler_set_metric(ruler, static_cast<SPMetric>(g_value_get_enum (value)));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -345,7 +355,7 @@ gtk_deprecated_ruler_get_property (GObject *object,
g_value_set_double (value, ruler->max_size);
break;
case PROP_METRIC:
- g_value_set_enum (value, gtk_deprecated_ruler_get_metric (ruler));
+ g_value_set_enum(value, sp_ruler_get_metric(ruler));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -353,41 +363,28 @@ gtk_deprecated_ruler_get_property (GObject *object,
}
}
-void
-gtk_deprecated_ruler_set_metric (GtkDeprecatedRuler *ruler,
- GtkMetricType metric)
-{
- g_return_if_fail (GTK_DEPRECATED_IS_RULER (ruler));
-
- ruler->metric = (GtkDeprecatedRulerMetric *) &ruler_metrics[metric];
-
- if (gtk_widget_is_drawable (GTK_WIDGET (ruler)))
- gtk_widget_queue_draw (GTK_WIDGET (ruler));
-
- g_object_notify (G_OBJECT (ruler), "metric");
-}
/**
- * gtk_deprecated_ruler_get_metric:
+ * sp_ruler_get_metric:
* @ruler: a #GtkDeprecatedRuler
*
- * Gets the units used for a #GtkDeprecatedRuler. See gtk_deprecated_ruler_set_metric().
+ * Gets the units used for a #GtkDeprecatedRuler. See sp_ruler_set_metric().
*
* Return value: the units currently used for @ruler
**/
-GtkMetricType gtk_deprecated_ruler_get_metric (GtkDeprecatedRuler *ruler)
+SPMetric sp_ruler_get_metric(GtkDeprecatedRuler *ruler)
{
- g_return_val_if_fail(GTK_DEPRECATED_IS_RULER(ruler), static_cast<GtkMetricType>(0));
+ g_return_val_if_fail(GTK_DEPRECATED_IS_RULER(ruler), static_cast<SPMetric>(0));
- for (size_t i = 0; i < G_N_ELEMENTS(ruler_metrics); i++) {
- if (ruler->metric == &ruler_metrics[i]) {
- return static_cast<GtkMetricType>(i);
+ for (size_t i = 0; i < G_N_ELEMENTS(sp_ruler_metrics); i++) {
+ if (ruler->metric == &sp_ruler_metrics[i]) {
+ return static_cast<SPMetric>(i);
}
}
g_assert_not_reached ();
- return static_cast<GtkMetricType>(0);
+ return static_cast<SPMetric>(0);
}
@@ -1317,27 +1314,11 @@ sp_ruler_common_draw_ticks(GtkDeprecatedRuler *ruler)
}
}
-// Note: const casts are due to GtkDeprecatedRuler being const-broken and not scheduled for any more fixes.
-/// Ruler metrics.
-static GtkDeprecatedRulerMetric const sp_ruler_metrics[] = {
- // NOTE: the order of records in this struct must correspond to the SPMetric enum.
- {const_cast<gchar*>("NONE"), const_cast<gchar*>(""), 1, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }},
- {const_cast<gchar*>("millimeters"), const_cast<gchar*>("mm"), PX_PER_MM, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }},
- {const_cast<gchar*>("centimeters"), const_cast<gchar*>("cm"), PX_PER_CM, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }},
- {const_cast<gchar*>("inches"), const_cast<gchar*>("in"), PX_PER_IN, { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 }, { 1, 2, 4, 8, 16 }},
- {const_cast<gchar*>("feet"), const_cast<gchar*>("ft"), PX_PER_FT, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }},
- {const_cast<gchar*>("points"), const_cast<gchar*>("pt"), PX_PER_PT, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }},
- {const_cast<gchar*>("picas"), const_cast<gchar*>("pc"), PX_PER_PC, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }},
- {const_cast<gchar*>("pixels"), const_cast<gchar*>("px"), PX_PER_PX, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }},
- {const_cast<gchar*>("meters"), const_cast<gchar*>("m"), PX_PER_M, { 1, 2, 5, 10, 25, 50, 100, 250, 500, 1000 }, { 1, 5, 10, 50, 100 }},
-};
-void
-sp_ruler_set_metric (GtkDeprecatedRuler *ruler,
- SPMetric metric)
+void sp_ruler_set_metric(GtkDeprecatedRuler *ruler, SPMetric metric)
{
- g_return_if_fail (ruler != NULL);
- g_return_if_fail (GTK_DEPRECATED_IS_RULER (ruler));
+ g_return_if_fail(ruler != NULL);
+ g_return_if_fail(GTK_DEPRECATED_IS_RULER (ruler));
g_return_if_fail((unsigned) metric < G_N_ELEMENTS(sp_ruler_metrics));
if (metric == 0)
@@ -1345,6 +1326,8 @@ sp_ruler_set_metric (GtkDeprecatedRuler *ruler,
ruler->metric = const_cast<GtkDeprecatedRulerMetric *>(&sp_ruler_metrics[metric]);
- if (gtk_widget_is_drawable (GTK_WIDGET (ruler)))
- gtk_widget_queue_draw (GTK_WIDGET (ruler));
+ if (gtk_widget_is_drawable(GTK_WIDGET(ruler)))
+ gtk_widget_queue_draw(GTK_WIDGET(ruler));
+
+ g_object_notify(G_OBJECT(ruler), "metric");
}
diff --git a/src/widgets/ruler.h b/src/widgets/ruler.h
index 0e7d32b2a..210a65bed 100644
--- a/src/widgets/ruler.h
+++ b/src/widgets/ruler.h
@@ -81,9 +81,6 @@ struct _GtkDeprecatedRulerMetric
GType gtk_deprecated_ruler_get_type (void) G_GNUC_CONST;
-void gtk_deprecated_ruler_set_metric (GtkDeprecatedRuler *ruler,
- GtkMetricType metric);
-GtkMetricType gtk_deprecated_ruler_get_metric (GtkDeprecatedRuler *ruler);
void gtk_deprecated_ruler_set_range (GtkDeprecatedRuler *ruler,
gdouble lower,
gdouble upper,
@@ -99,11 +96,8 @@ void gtk_deprecated_ruler_draw_ticks (GtkDeprecatedRuler *ruler
void gtk_deprecated_ruler_draw_pos (GtkDeprecatedRuler *ruler);
-
-
-
-
-void sp_ruler_set_metric (GtkDeprecatedRuler * ruler, SPMetric metric);
+void sp_ruler_set_metric (GtkDeprecatedRuler * ruler, SPMetric metric);
+SPMetric sp_ruler_get_metric (GtkDeprecatedRuler *ruler);
#define SP_HRULER(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, sp_hruler_get_type (), SPHRuler)
diff --git a/src/widgets/select-toolbar.cpp b/src/widgets/select-toolbar.cpp
index e23d4f84b..4378bc19d 100644
--- a/src/widgets/select-toolbar.cpp
+++ b/src/widgets/select-toolbar.cpp
@@ -270,7 +270,12 @@ sp_object_layout_any_value_changed(GtkAdjustment *adj, SPWidget *spw)
static GtkWidget* createCustomSlider( GtkAdjustment *adjustment, gdouble climbRate, guint digits )
{
+#if WITH_GTKMM_3_0
+ Glib::RefPtr<Gtk::Adjustment> adj = Glib::wrap(adjustment, true);
+ Inkscape::UI::Widget::SpinButton *inkSpinner = new Inkscape::UI::Widget::SpinButton(adj, climbRate, digits);
+#else
Inkscape::UI::Widget::SpinButton *inkSpinner = new Inkscape::UI::Widget::SpinButton(*Glib::wrap(adjustment, true), climbRate, digits);
+#endif
inkSpinner = Gtk::manage( inkSpinner );
GtkWidget *widget = GTK_WIDGET( inkSpinner->gobj() );
return widget;
diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp
index 2e56dd696..90bd62847 100644
--- a/src/widgets/stroke-style.cpp
+++ b/src/widgets/stroke-style.cpp
@@ -18,6 +18,7 @@
#define noSP_SS_VERBOSE
#include "widgets/dash-selector.h"
+#include <gtkmm/radiobutton.h>
#include <gtkmm/table.h>
#include <glibmm/i18n.h>
@@ -295,7 +296,6 @@ Gtk::Container *sp_stroke_style_line_widget_new(void)
GtkWidget *us_old, *spw_old;
Gtk::Container *spw;
Gtk::Table *t;
- Gtk::Adjustment *a;
Inkscape::UI::Widget::SpinButton *sb;
Gtk::RadioButton *tb;
Gtk::HBox *f, *hb;
@@ -327,9 +327,15 @@ Gtk::Container *sp_stroke_style_line_widget_new(void)
// with it, the two remaining calls of stroke_average_width, allowing us to get rid of that
// function in desktop-style.
- a = new Gtk::Adjustment(1.0, 0.0, 1000.0, 0.1, 10.0, 0.0);
+#if WITH_GTKMM_3_0
+ Glib::RefPtr<Gtk::Adjustment> a = Gtk::Adjustment::create(1.0, 0.0, 1000.0, 0.1, 10.0, 0.0);
+ spw->set_data("width", &a);
+ sb = new Inkscape::UI::Widget::SpinButton(a, 0.1, 3);
+#else
+ Gtk::Adjustment *a = new Gtk::Adjustment(1.0, 0.0, 1000.0, 0.1, 10.0, 0.0);
spw->set_data("width", a);
sb = new Inkscape::UI::Widget::SpinButton(*a, 0.1, 3);
+#endif
sb->set_tooltip_text(_("Stroke width"));
sb->show();
spw_label(t, C_("Stroke width", "_Width:"), 0, i, sb);
@@ -403,10 +409,16 @@ Gtk::Container *sp_stroke_style_line_widget_new(void)
hb = spw_hbox(t, 3, 1, i);
+#if WITH_GTKMM_3_0
+ a = Gtk::Adjustment::create(4.0, 0.0, 100.0, 0.1, 10.0, 0.0);
+ spw->set_data("miterlimit", &a);
+ sb = new Inkscape::UI::Widget::SpinButton(a, 0.1, 2);
+#else
a = new Gtk::Adjustment(4.0, 0.0, 100.0, 0.1, 10.0, 0.0);
spw->set_data("miterlimit", a);
-
sb = new Inkscape::UI::Widget::SpinButton(*a, 0.1, 2);
+#endif
+
sb->set_tooltip_text(_("Maximum length of the miter (in units of stroke width)"));
sb->show();
spw_label(t, _("Miter _limit:"), 0, i, sb);
diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp
index 7d73c042b..f29ac581d 100644
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
@@ -114,7 +114,7 @@
#include <gtk/gtk.h>
#if !GTK_CHECK_VERSION(2,22,0)
-#define GDK_KEY_VoidSymbol 0xffffff
+#include "compat-key-syms.h"
#endif
//#define DEBUG_TEXT
@@ -1119,7 +1119,12 @@ GtkWidget *ToolboxFactory::createSnapToolbox()
static GtkWidget* createCustomSlider( GtkAdjustment *adjustment, gdouble climbRate, guint digits )
{
+#if WITH_GTKMM_3_0
+ Glib::RefPtr<Gtk::Adjustment> adj = Glib::wrap(adjustment, true);
+ Inkscape::UI::Widget::SpinButton *inkSpinner = new Inkscape::UI::Widget::SpinButton(adj, climbRate, digits);
+#else
Inkscape::UI::Widget::SpinButton *inkSpinner = new Inkscape::UI::Widget::SpinButton(*Glib::wrap(adjustment, true), climbRate, digits);
+#endif
inkSpinner = Gtk::manage( inkSpinner );
GtkWidget *widget = GTK_WIDGET( inkSpinner->gobj() );
return widget;
diff --git a/src/zoom-context.cpp b/src/zoom-context.cpp
index 6676733d7..21b27df4f 100644
--- a/src/zoom-context.cpp
+++ b/src/zoom-context.cpp
@@ -26,13 +26,7 @@
#include "zoom-context.h"
#if !GTK_CHECK_VERSION(2,22,0)
-#define GDK_KEY_Escape 0xff1b
-#define GDK_KEY_Up 0xff52
-#define GDK_KEY_Down 0xff54
-#define GDK_KEY_KP_Up 0xff97
-#define GDK_KEY_KP_Down 0xff99
-#define GDK_KEY_Shift_L 0xffe1
-#define GDK_KEY_Shift_R 0xffe2
+#include "compat-key-syms.h"
#endif
static void sp_zoom_context_class_init(SPZoomContextClass *klass);