summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/2geom/Makefile_insert231
-rw-r--r--src/Makefile.am14
-rw-r--r--src/Makefile_insert3
-rw-r--r--src/desktop.cpp1
-rw-r--r--src/display/Makefile_insert3
-rw-r--r--src/display/canvas-arena.cpp8
-rw-r--r--src/display/canvas-grid.cpp6
-rw-r--r--src/display/nr-filter-merge.cpp2
-rw-r--r--src/dropper-context.cpp105
-rw-r--r--src/extension/Makefile_insert1
-rw-r--r--src/extension/effect.h2
-rw-r--r--src/extension/internal/Makefile_insert16
-rw-r--r--src/helper/Makefile_insert1
-rw-r--r--src/interface.cpp12
-rw-r--r--src/libavoid/makepath.cpp2
-rw-r--r--src/libavoid/orthogonal.cpp4
-rw-r--r--src/libcola/connected_components.cpp2
-rw-r--r--src/libcola/shortest_paths.cpp4
-rw-r--r--src/libcola/straightener.cpp2
-rw-r--r--src/libgdl/Makefile_insert4
-rw-r--r--src/libnrtype/FontFactory.cpp4
-rw-r--r--src/libnrtype/Makefile_insert1
-rw-r--r--src/libvpsc/csolve_VPSC.h2
-rw-r--r--src/libvpsc/generate-constraints.cpp6
-rw-r--r--src/libvpsc/remove_rectangle_overlap.cpp1
-rw-r--r--src/livarot/Makefile_insert1
-rw-r--r--src/livarot/PathSimplify.cpp10
-rw-r--r--src/livarot/PathStroke.cpp4
-rw-r--r--src/livarot/ShapeMisc.cpp4
-rw-r--r--src/pixmaps/cursor-dropper-f.xpm38
-rw-r--r--src/pixmaps/cursor-dropper-s.xpm38
-rw-r--r--src/shortcuts.cpp524
-rw-r--r--src/shortcuts.h16
-rw-r--r--src/sp-gradient.cpp25
-rw-r--r--src/sp-image.cpp44
-rw-r--r--src/svg/itos.cpp2
-rw-r--r--src/svg/round.cpp1
-rw-r--r--src/trace/trace.h11
-rw-r--r--src/ui/dialog/align-and-distribute.cpp2
-rw-r--r--src/ui/dialog/align-and-distribute.h2
-rw-r--r--src/ui/dialog/clonetiler.cpp20
-rw-r--r--src/ui/dialog/color-item.cpp2
-rw-r--r--src/ui/dialog/document-properties.cpp4
-rw-r--r--src/ui/dialog/export.cpp22
-rw-r--r--src/ui/dialog/filedialog.cpp3
-rw-r--r--src/ui/dialog/filedialog.h2
-rw-r--r--src/ui/dialog/filedialogimpl-gtkmm.cpp21
-rw-r--r--src/ui/dialog/filedialogimpl-gtkmm.h1
-rw-r--r--src/ui/dialog/filedialogimpl-win32.cpp72
-rw-r--r--src/ui/dialog/filedialogimpl-win32.h2
-rw-r--r--src/ui/dialog/fill-and-stroke.cpp25
-rw-r--r--src/ui/dialog/fill-and-stroke.h6
-rw-r--r--src/ui/dialog/filter-effects-dialog.cpp31
-rw-r--r--src/ui/dialog/font-substitution.cpp4
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp319
-rw-r--r--src/ui/dialog/inkscape-preferences.h62
-rw-r--r--src/ui/dialog/layer-properties.cpp2
-rw-r--r--src/ui/dialog/layers.cpp59
-rw-r--r--src/ui/dialog/layers.h2
-rw-r--r--src/ui/dialog/object-attributes.cpp2
-rw-r--r--src/ui/dialog/ocaldialogs.h2
-rw-r--r--src/ui/dialog/spellcheck.cpp8
-rw-r--r--src/ui/dialog/svg-fonts-dialog.cpp4
-rw-r--r--src/ui/dialog/symbols.cpp27
-rw-r--r--src/ui/dialog/symbols.h1
-rw-r--r--src/ui/widget/color-picker.cpp2
-rw-r--r--src/ui/widget/layer-selector.cpp6
-rw-r--r--src/ui/widget/preferences-widget.cpp2
-rw-r--r--src/ui/widget/selected-style.cpp8
-rw-r--r--src/util/expression-evaluator.cpp2
-rw-r--r--src/verbs.cpp59
-rw-r--r--src/verbs.h19
-rw-r--r--src/widgets/desktop-widget.cpp8
-rw-r--r--src/widgets/font-selector.cpp2
-rw-r--r--src/widgets/gradient-toolbar.cpp10
-rw-r--r--src/widgets/text-toolbar.cpp4
-rw-r--r--src/xml/Makefile_insert3
77 files changed, 1648 insertions, 339 deletions
diff --git a/src/2geom/Makefile_insert b/src/2geom/Makefile_insert
index e3b6fcdab..07e066df5 100644
--- a/src/2geom/Makefile_insert
+++ b/src/2geom/Makefile_insert
@@ -6,112 +6,129 @@
rm -f 2geom/lib2geom.a $(2geom_lib2geom_a_OBJECTS)
2geom_lib2geom_a_SOURCES = \
- 2geom/affine.h \
- 2geom/affine.cpp \
- 2geom/angle.h \
- 2geom/basic-intersection.cpp \
- 2geom/basic-intersection.h \
- 2geom/bezier-clipping.cpp \
- 2geom/bezier-curve.cpp \
- 2geom/bezier-curve.h \
- 2geom/bezier.h \
- 2geom/bezier-to-sbasis.h \
- 2geom/bezier-utils.cpp \
- 2geom/bezier-utils.h \
- 2geom/choose.h \
- 2geom/circle-circle.cpp \
- 2geom/circle.cpp \
- 2geom/circle.h \
- 2geom/circulator.h \
- 2geom/concepts.h \
- 2geom/conjugate_gradient.cpp \
- 2geom/conjugate_gradient.h \
- 2geom/convex-cover.cpp \
- 2geom/convex-cover.h \
- 2geom/coord.h \
- 2geom/crossing.cpp \
- 2geom/crossing.h \
+ 2geom/2geom.h \
+ 2geom/affine.cpp \
+ 2geom/affine.h \
+ 2geom/angle.h \
+ 2geom/basic-intersection.cpp \
+ 2geom/basic-intersection.h \
+ 2geom/bezier-clipping.cpp \
+ 2geom/bezier-curve.cpp \
+ 2geom/bezier-curve.h \
+ 2geom/bezier.h \
+ 2geom/bezier-to-sbasis.h \
+ 2geom/bezier-utils.cpp \
+ 2geom/bezier-utils.h \
+ 2geom/choose.h \
+ 2geom/circle-circle.cpp \
+ 2geom/circle.cpp \
+ 2geom/circle.h \
+ 2geom/circulator.h \
+ 2geom/CMakeLists.txt \
+ 2geom/concepts.h \
+ 2geom/conicsec.cpp \
+ 2geom/conicsec.h \
+ 2geom/conic_section_clipper_cr.h \
+ 2geom/conic_section_clipper.h \
+ 2geom/conic_section_clipper_impl.cpp \
+ 2geom/conic_section_clipper_impl.h \
+ 2geom/conjugate_gradient.cpp \
+ 2geom/conjugate_gradient.h \
+ 2geom/convex-cover.cpp \
+ 2geom/convex-cover.h \
+ 2geom/coord.h \
+ 2geom/crossing.cpp \
+ 2geom/crossing.h \
2geom/curve.cpp \
- 2geom/curve.h \
- 2geom/curves.h \
- 2geom/d2.h \
- 2geom/d2-sbasis.cpp \
- 2geom/d2-sbasis.h \
- 2geom/ellipse.cpp \
- 2geom/ellipse.h \
- 2geom/elliptical-arc.cpp \
- 2geom/elliptical-arc.h \
- 2geom/exception.h \
- 2geom/forward.h \
- 2geom/geom.cpp \
- 2geom/geom.h \
- 2geom/hvlinesegment.h \
- 2geom/interval.h \
- 2geom/isnan.h \
- 2geom/linear.h \
- 2geom/line.cpp \
- 2geom/line.h \
- 2geom/nearest-point.cpp \
- 2geom/nearest-point.h \
- 2geom/numeric/fitting-model.h \
- 2geom/numeric/fitting-tool.h \
- 2geom/numeric/linear_system.h \
- 2geom/numeric/matrix.cpp \
- 2geom/numeric/matrix.h \
- 2geom/numeric/vector.h \
- 2geom/ord.h \
- 2geom/path.cpp \
- 2geom/path.h \
- 2geom/path-intersection.cpp \
- 2geom/path-intersection.h \
- 2geom/pathvector.cpp \
- 2geom/pathvector.h \
- 2geom/piecewise.cpp \
- 2geom/piecewise.h \
- 2geom/point.cpp \
- 2geom/point.h \
- 2geom/point-l.h \
- 2geom/point-ops.h \
- 2geom/poly.cpp \
- 2geom/poly.h \
- 2geom/quadtree.cpp \
- 2geom/quadtree.h \
- 2geom/ray.h \
- 2geom/rect.cpp \
- 2geom/rect.h \
- 2geom/region.cpp \
- 2geom/region.h \
- 2geom/sbasis-2d.cpp \
- 2geom/sbasis-2d.h \
- 2geom/sbasis.cpp \
- 2geom/sbasis-curve.h \
- 2geom/sbasis-geometric.cpp \
- 2geom/sbasis-geometric.h \
- 2geom/sbasis.h \
- 2geom/sbasis-math.cpp \
- 2geom/sbasis-math.h \
- 2geom/sbasis-poly.cpp \
- 2geom/sbasis-poly.h \
- 2geom/sbasis-roots.cpp \
- 2geom/sbasis-to-bezier.cpp \
- 2geom/sbasis-to-bezier.h \
- 2geom/shape.cpp \
- 2geom/shape.h \
- 2geom/solve-bezier.cpp \
- 2geom/solve-bezier-one-d.cpp \
- 2geom/solve-bezier-parametric.cpp \
- 2geom/solver.h \
- 2geom/sturm.h \
- 2geom/svg-elliptical-arc.cpp \
- 2geom/svg-elliptical-arc.h \
- 2geom/svg-path.cpp \
- 2geom/svg-path.h \
- 2geom/svg-path-parser.cpp \
- 2geom/svg-path-parser.h \
- 2geom/sweep.cpp \
- 2geom/sweep.h \
- 2geom/transforms.cpp \
- 2geom/transforms.h \
- 2geom/utils.cpp \
- 2geom/utils.h
+ 2geom/curve.h \
+ 2geom/curves.h \
+ 2geom/d2.h \
+ 2geom/d2-sbasis.cpp \
+ 2geom/d2-sbasis.h \
+ 2geom/ellipse.cpp \
+ 2geom/ellipse.h \
+ 2geom/elliptical-arc.cpp \
+ 2geom/elliptical-arc.h \
+ 2geom/exception.h \
+ 2geom/forward.h \
+ 2geom/generic-interval.h \
+ 2geom/generic-rect.h \
+ 2geom/geom.cpp \
+ 2geom/geom.h \
+ 2geom/hvlinesegment.h \
+ 2geom/interval.h \
+ 2geom/int-interval.h \
+ 2geom/int-point.h \
+ 2geom/int-rect.h \
+ 2geom/linear.h \
+ 2geom/line.cpp \
+ 2geom/line.h \
+ 2geom/math-utils.h \
+ 2geom/nearest-point.cpp \
+ 2geom/nearest-point.h \
+ 2geom/ord.h \
+ 2geom/path.cpp \
+ 2geom/path.h \
+ 2geom/path-intersection.cpp \
+ 2geom/path-intersection.h \
+ 2geom/pathvector.cpp \
+ 2geom/pathvector.h \
+ 2geom/piecewise.cpp \
+ 2geom/piecewise.h \
+ 2geom/point.cpp \
+ 2geom/point.h \
+ 2geom/point-ops.h \
+ 2geom/poly.cpp \
+ 2geom/poly.h \
+ 2geom/quadtree.cpp \
+ 2geom/quadtree.h \
+ 2geom/ray.h \
+ 2geom/rect.cpp \
+ 2geom/rect.h \
+ 2geom/recursive-bezier-intersection.cpp \
+ 2geom/region.cpp \
+ 2geom/region.h \
+ 2geom/sbasis-2d.cpp \
+ 2geom/sbasis-2d.h \
+ 2geom/sbasis.cpp \
+ 2geom/sbasis-curve.h \
+ 2geom/sbasis-geometric.cpp \
+ 2geom/sbasis-geometric.h \
+ 2geom/sbasis.h \
+ 2geom/sbasis-math.cpp \
+ 2geom/sbasis-math.h \
+ 2geom/sbasis-poly.cpp \
+ 2geom/sbasis-poly.h \
+ 2geom/sbasis-roots.cpp \
+ 2geom/sbasis-to-bezier.cpp \
+ 2geom/sbasis-to-bezier.h \
+ 2geom/shape.cpp \
+ 2geom/shape.h \
+ 2geom/solve-bezier.cpp \
+ 2geom/solve-bezier-one-d.cpp \
+ 2geom/solve-bezier-parametric.cpp \
+ 2geom/solver.h \
+ 2geom/svg-elliptical-arc.cpp \
+ 2geom/svg-elliptical-arc.h \
+ 2geom/svg-path.cpp \
+ 2geom/svg-path.h \
+ 2geom/svg-path-parser.cpp \
+ 2geom/svg-path-parser.h \
+ 2geom/sweep.cpp \
+ 2geom/sweep.h \
+ 2geom/toposweep.cpp \
+ 2geom/toposweep.h \
+ 2geom/transforms.cpp \
+ 2geom/transforms.h \
+ 2geom/utils.cpp \
+ 2geom/utils.h \
+ 2geom/numeric/fitting-model.h \
+ 2geom/numeric/fitting-tool.h \
+ 2geom/numeric/linear_system.h \
+ 2geom/numeric/matrix.cpp \
+ 2geom/numeric/matrix.h \
+ 2geom/numeric/symmetric-matrix-fs.h \
+ 2geom/numeric/symmetric-matrix-fs-operation.h \
+ 2geom/numeric/symmetric-matrix-fs-trace.h \
+ 2geom/numeric/vector.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 3a727b8e2..7658ab714 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -16,9 +16,6 @@ bin_PROGRAMS = inkscape inkview
# Libraries which should be compiled by "make" but not installed.
# Use this only for libraries that are really standalone, rather than for
# source tree subdirectories.
-#if WITH_INKBOARD
-#libpedro = pedro/libpedro.a
-#endif
if !WITH_EXT_GDL
internal_GDL = libgdl/libgdl.a
@@ -35,7 +32,6 @@ noinst_LIBRARIES = \
libvpsc/libvpsc.a \
livarot/libvarot.a \
2geom/lib2geom.a \
- $(libpedro) \
libinkversion.a
all_libs = \
@@ -109,11 +105,6 @@ win32ldflags = -lcomdlg32 -lmscms
mwindows = -mwindows
endif
-if INKJAR
-inkjar_dir = inkjar
-inkjar_libs = inkjar/libinkjar.a
-endif
-
# Include all partial makefiles from subdirectories
include Makefile_insert
include bind/Makefile_insert
@@ -157,7 +148,6 @@ EXTRA_DIST += \
$(top_srcdir)/Doxyfile \
sp-skeleton.cpp sp-skeleton.h \
util/makefile.in \
- application/makefile.in \
bind/makefile.in \
debug/makefile.in \
dialogs/makefile.in \
@@ -172,11 +162,8 @@ EXTRA_DIST += \
io/makefile.in \
io/crystalegg.xml \
io/doc2html.xsl \
- pedro/makefile.in \
- jabber_whiteboard/makefile.in \
libgdl/makefile.in \
libcroco/makefile.in \
- libnr/makefile.in \
libnrtype/makefile.in \
libavoid/makefile.in \
livarot/makefile.in \
@@ -200,7 +187,6 @@ EXTRA_DIST += \
helper/sp-marshal.list \
show-preview.bmp \
winconsole.cpp \
- $(jabber_whiteboard_SOURCES) \
$(CXXTEST_TEMPLATE)
# Extra files to remove when doing "make distclean"
diff --git a/src/Makefile_insert b/src/Makefile_insert
index 36e05270a..2d557158b 100644
--- a/src/Makefile_insert
+++ b/src/Makefile_insert
@@ -40,7 +40,7 @@ ink_common_sources += \
dir-util.cpp dir-util.h \
document.cpp document.h document-private.h \
document-subset.cpp document-subset.h \
- document-undo.cpp \
+ document-undo.cpp document-undo.h \
doxygen-main.cpp \
draw-anchor.cpp draw-anchor.h \
draw-context.cpp draw-context.h \
@@ -61,7 +61,6 @@ ink_common_sources += \
filter-enums.cpp filter-enums.h \
fixes.cpp \
flood-context.cpp flood-context.h \
- forward.h \
gc-alloc.h \
gc-anchored.h gc-anchored.cpp \
gc-core.h \
diff --git a/src/desktop.cpp b/src/desktop.cpp
index f10174119..2f8f3e4b6 100644
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
@@ -1903,6 +1903,7 @@ SPDesktop::show_dialogs()
mapVerbPreference.insert(std::make_pair ((int)SP_VERB_DIALOG_CLONETILER, "/dialogs/clonetiler") );
mapVerbPreference.insert(std::make_pair ((int)SP_VERB_DIALOG_ITEM, "/dialogs/object") );
mapVerbPreference.insert(std::make_pair ((int)SP_VERB_DIALOG_SPELLCHECK, "/dialogs/spellcheck") );
+ mapVerbPreference.insert(std::make_pair ((int)SP_VERB_DIALOG_SYMBOLS, "/dialogs/symbols") );
for (iter = mapVerbPreference.begin(); iter != mapVerbPreference.end(); iter++) {
int verbId = iter->first;
diff --git a/src/display/Makefile_insert b/src/display/Makefile_insert
index cf211108f..abbd89a68 100644
--- a/src/display/Makefile_insert
+++ b/src/display/Makefile_insert
@@ -47,7 +47,6 @@ ink_common_sources += \
display/guideline.h \
display/nr-3dutils.cpp \
display/nr-3dutils.h \
- display/nr-arena-forward.h \
display/nr-filter-blend.cpp \
display/nr-filter-blend.h \
display/nr-filter-colormatrix.cpp \
@@ -107,6 +106,8 @@ ink_common_sources += \
display/sodipodi-ctrlrect.h \
display/sp-canvas.cpp \
display/sp-canvas.h \
+ display/sp-canvas-item.h \
+ display/sp-canvas-group.h \
display/sp-canvas-util.cpp \
display/sp-canvas-util.h \
display/sp-ctrlcurve.cpp \
diff --git a/src/display/canvas-arena.cpp b/src/display/canvas-arena.cpp
index 809f14500..8e25c1843 100644
--- a/src/display/canvas-arena.cpp
+++ b/src/display/canvas-arena.cpp
@@ -316,13 +316,17 @@ sp_canvas_arena_event (SPCanvasItem *item, GdkEvent *event)
ret = sp_canvas_arena_send_event (arena, event);
break;
- case GDK_SCROLL:
- if (event->scroll.state & GDK_CONTROL_MASK) {
+ case GDK_SCROLL: {
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ bool wheelzooms = prefs->getBool("/options/wheelzooms/value");
+ bool ctrl = (event->scroll.state & GDK_CONTROL_MASK);
+ if ((ctrl && !wheelzooms) || (!ctrl && wheelzooms)) {
/* Zoom is emitted by the canvas as well, ignore here */
return FALSE;
}
ret = sp_canvas_arena_send_event (arena, event);
break;
+ }
default:
/* Just send event */
diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp
index 42a5ceccc..329b621ae 100644
--- a/src/display/canvas-grid.cpp
+++ b/src/display/canvas-grid.cpp
@@ -274,9 +274,9 @@ CanvasGrid::NewGrid(SPNamedView * nv, Inkscape::XML::Node * repr, SPDocument * d
switch (gridtype) {
case GRID_RECTANGULAR:
- return (CanvasGrid*) new CanvasXYGrid(nv, repr, doc);
+ return dynamic_cast<CanvasGrid*>(new CanvasXYGrid(nv, repr, doc));
case GRID_AXONOMETRIC:
- return (CanvasGrid*) new CanvasAxonomGrid(nv, repr, doc);
+ return dynamic_cast<CanvasGrid*>(new CanvasAxonomGrid(nv, repr, doc));
}
return NULL;
@@ -366,7 +366,7 @@ CanvasGrid::on_repr_attr_changed(Inkscape::XML::Node *repr, gchar const *key, gc
if (!data)
return;
- ((CanvasGrid*) data)->onReprAttrChanged(repr, key, oldval, newval, is_interactive);
+ (static_cast<CanvasGrid*>(data))->onReprAttrChanged(repr, key, oldval, newval, is_interactive);
}
bool CanvasGrid::isEnabled()
diff --git a/src/display/nr-filter-merge.cpp b/src/display/nr-filter-merge.cpp
index f1fbd7d33..759d7d6d1 100644
--- a/src/display/nr-filter-merge.cpp
+++ b/src/display/nr-filter-merge.cpp
@@ -31,7 +31,7 @@ FilterMerge::~FilterMerge()
void FilterMerge::render_cairo(FilterSlot &slot)
{
- if (_input_image.size() == 0) return;
+ if (_input_image.empty()) return;
// output is RGBA if at least one input is RGBA
bool rgba32 = false;
diff --git a/src/dropper-context.cpp b/src/dropper-context.cpp
index 4742f5cff..8b293a9d9 100644
--- a/src/dropper-context.cpp
+++ b/src/dropper-context.cpp
@@ -32,6 +32,7 @@
#include "desktop-style.h"
#include "preferences.h"
#include "sp-namedview.h"
+#include "sp-cursor.h"
#include "desktop.h"
#include "desktop-handles.h"
#include "selection.h"
@@ -39,6 +40,8 @@
#include "document-undo.h"
#include "pixmaps/cursor-dropper.xpm"
+#include "pixmaps/cursor-dropper-f.xpm"
+#include "pixmaps/cursor-dropper-s.xpm"
#include "dropper-context.h"
#include "message-context.h"
@@ -57,6 +60,9 @@ static gint sp_dropper_context_root_handler(SPEventContext *ec, GdkEvent * event
static SPEventContextClass *parent_class;
+static GdkCursor *cursor_dropper_fill = NULL;
+static GdkCursor *cursor_dropper_stroke = NULL;
+
GType sp_dropper_context_get_type()
{
static GType type = 0;
@@ -90,9 +96,13 @@ static void sp_dropper_context_class_init(SPDropperContextClass *klass)
static void sp_dropper_context_init(SPDropperContext *dc)
{
SPEventContext *event_context = SP_EVENT_CONTEXT(dc);
- event_context->cursor_shape = cursor_dropper_xpm;
+ event_context->cursor_shape = cursor_dropper_f_xpm;
event_context->hot_x = 7;
event_context->hot_y = 7;
+
+ cursor_dropper_fill = sp_cursor_new_from_xpm(cursor_dropper_f_xpm , 7, 7);
+ cursor_dropper_stroke = sp_cursor_new_from_xpm(cursor_dropper_s_xpm , 7, 7);
+
}
static void sp_dropper_context_setup(SPEventContext *ec)
@@ -143,6 +153,27 @@ static void sp_dropper_context_finish(SPEventContext *ec)
sp_canvas_item_destroy(dc->area);
dc->area = NULL;
}
+
+ if (cursor_dropper_fill) {
+#if GTK_CHECK_VERSION(3,0,0)
+ g_object_unref(cursor_dropper_fill);
+#else
+ gdk_cursor_unref (cursor_dropper_fill);
+#endif
+ cursor_dropper_fill = NULL;
+ }
+ if (cursor_dropper_stroke) {
+#if GTK_CHECK_VERSION(3,0,0)
+ g_object_unref(cursor_dropper_stroke);
+#else
+ gdk_cursor_unref (cursor_dropper_stroke);
+#endif
+ cursor_dropper_fill = NULL;
+ }
+
+ //Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ //prefs->setBool("/tools/dropper/onetimepick", false);
+
}
@@ -205,6 +236,13 @@ static gint sp_dropper_context_root_handler(SPEventContext *event_context, GdkEv
} else if (!event_context->space_panning) {
// otherwise, constantly calculate color no matter is any button pressed or not
+ // If one time pick with stroke set the pixmap
+ if (prefs->getBool("/tools/dropper/onetimepick", false) && prefs->getInt("/dialogs/fillstroke/page", 0) == 1) {
+ //TODO Only set when not set already
+ GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(sp_desktop_canvas(desktop)));
+ gdk_window_set_cursor(window, cursor_dropper_stroke);
+ }
+
double rw = 0.0;
double R(0), G(0), B(0), A(0);
@@ -310,14 +348,24 @@ static gint sp_dropper_context_root_handler(SPEventContext *event_context, GdkEv
double alpha_to_set = setalpha? dc->alpha : 1.0;
+ bool fill = !(event->button.state & GDK_SHIFT_MASK); // Stroke if Shift key held
+ if (prefs->getBool("/tools/dropper/onetimepick", false)) {
+ // "One time" pick from Fill/Stroke dialog stroke page, always apply fill or stroke (ignore <Shift> key)
+ fill = (prefs->getInt("/dialogs/fillstroke/page", 0) == 0) ? true : false;
+ }
+
// do the actual color setting
sp_desktop_set_color(desktop,
(event->button.state & GDK_MOD1_MASK)?
ColorRGBA(1 - dc->R, 1 - dc->G, 1 - dc->B, alpha_to_set) : ColorRGBA(dc->R, dc->G, dc->B, alpha_to_set),
- false, !(event->button.state & GDK_SHIFT_MASK));
+ false, fill);
// REJON: set aux. toolbar input to hex color!
+ if (event->button.state & GDK_SHIFT_MASK) {
+ GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(sp_desktop_canvas(desktop)));
+ gdk_window_set_cursor(window, cursor_dropper_stroke);
+ }
if (!(sp_desktop_selection(desktop)->isEmpty())) {
DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_DROPPER,
@@ -332,25 +380,46 @@ static gint sp_dropper_context_root_handler(SPEventContext *event_context, GdkEv
ret = TRUE;
}
break;
- case GDK_KEY_PRESS:
- switch (get_group0_keyval(&event->key)) {
- case GDK_KEY_Up:
- case GDK_KEY_Down:
- case GDK_KEY_KP_Up:
- case GDK_KEY_KP_Down:
- // prevent the zoom field from activation
- if (!MOD__CTRL_ONLY) {
- ret = TRUE;
- }
- break;
- case GDK_KEY_Escape:
- sp_desktop_selection(desktop)->clear();
- default:
- break;
+ case GDK_KEY_PRESS:
+ switch (get_group0_keyval(&event->key)) {
+ case GDK_KEY_Up:
+ case GDK_KEY_Down:
+ case GDK_KEY_KP_Up:
+ case GDK_KEY_KP_Down:
+ // prevent the zoom field from activation
+ if (!MOD__CTRL_ONLY) {
+ ret = TRUE;
}
break;
- default:
+ case GDK_KEY_Escape:
+ sp_desktop_selection(desktop)->clear();
+ case GDK_KEY_Shift_L:
+ case GDK_KEY_Shift_R:
+ if (!desktop->isWaitingCursor() && !prefs->getBool("/tools/dropper/onetimepick", false)) {
+ GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(sp_desktop_canvas(desktop)));
+ gdk_window_set_cursor(window, cursor_dropper_stroke);
+ }
+
break;
+ default:
+ break;
+ }
+ break;
+ case GDK_KEY_RELEASE:
+ switch (get_group0_keyval(&event->key)) {
+ case GDK_KEY_Shift_L:
+ case GDK_KEY_Shift_R:
+ if (!desktop->isWaitingCursor() && !prefs->getBool("/tools/dropper/onetimepick", false)) {
+ GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(sp_desktop_canvas(desktop)));
+ gdk_window_set_cursor(window, cursor_dropper_fill);
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
}
if (!ret) {
diff --git a/src/extension/Makefile_insert b/src/extension/Makefile_insert
index ffcee5f9a..4e75de13a 100644
--- a/src/extension/Makefile_insert
+++ b/src/extension/Makefile_insert
@@ -3,7 +3,6 @@
ink_common_sources += \
extension/extension.cpp \
extension/extension.h \
- extension/extension-forward.h \
extension/db.cpp \
extension/db.h \
extension/dependency.cpp \
diff --git a/src/extension/effect.h b/src/extension/effect.h
index bb36b9238..6616a23ec 100644
--- a/src/extension/effect.h
+++ b/src/extension/effect.h
@@ -67,7 +67,7 @@ class Effect : public Extension {
gchar const * image,
Effect * effect,
bool showPrefs) :
- Verb(id, _(name), _(tip), image),
+ Verb(id, _(name), _(tip), image, _("Extensions")),
_effect(effect),
_showPrefs(showPrefs),
_elip_name(NULL) {
diff --git a/src/extension/internal/Makefile_insert b/src/extension/internal/Makefile_insert
index c4dbaa77a..a13c8a6ae 100644
--- a/src/extension/internal/Makefile_insert
+++ b/src/extension/internal/Makefile_insert
@@ -132,12 +132,24 @@ ink_common_sources += \
extension/internal/latex-pstricks.h \
extension/internal/latex-pstricks-out.cpp \
extension/internal/latex-pstricks-out.h \
+ extension/internal/filter/bevels.h \
+ extension/internal/filter/blurs.h \
+ extension/internal/filter/bumps.h \
+ extension/internal/filter/color.h \
+ extension/internal/filter/distort.h \
+ extension/internal/filter/filter.h \
+ extension/internal/filter/image.h \
+ extension/internal/filter/morphology.h \
+ extension/internal/filter/overlays.h \
+ extension/internal/filter/paint.h \
+ extension/internal/filter/protrusions.h \
+ extension/internal/filter/shadows.h \
+ extension/internal/filter/textures.h \
+ extension/internal/filter/transparency.h \
extension/internal/filter/filter-all.cpp \
extension/internal/filter/filter-file.cpp \
extension/internal/filter/filter.cpp \
extension/internal/filter/filter.h \
- extension/internal/filter/drop-shadow.h \
- extension/internal/filter/snow.h \
extension/internal/uemf.c \
extension/internal/uemf.h \
extension/internal/uemf_endian.c \
diff --git a/src/helper/Makefile_insert b/src/helper/Makefile_insert
index 0efb5d6ce..2be40e0e0 100644
--- a/src/helper/Makefile_insert
+++ b/src/helper/Makefile_insert
@@ -12,7 +12,6 @@ ink_common_sources += \
helper/geom-nodetype.h \
helper/gnome-utils.cpp \
helper/gnome-utils.h \
- helper/helper-forward.h \
helper/png-write.cpp \
helper/png-write.h \
helper/sp-marshal.cpp \
diff --git a/src/interface.cpp b/src/interface.cpp
index bad95adc6..823119953 100644
--- a/src/interface.cpp
+++ b/src/interface.cpp
@@ -59,6 +59,7 @@
#include "dialogs/dialog-events.h"
#include "message-context.h"
#include "ui/uxmanager.h"
+#include "ui/clipboard.h"
#include "display/sp-canvas.h"
#include "color.h"
@@ -97,6 +98,7 @@ typedef enum {
APP_X_INKY_COLOR,
APP_X_COLOR,
APP_OSWB_COLOR,
+ APP_X_INK_PASTE
} ui_drop_target_info;
static GtkTargetEntry ui_drop_target_entries [] = {
@@ -109,7 +111,8 @@ static GtkTargetEntry ui_drop_target_entries [] = {
{(gchar *)"application/x-inkscape-color", 0, APP_X_INKY_COLOR},
#endif // ENABLE_MAGIC_COLORS
{(gchar *)"application/x-oswb-color", 0, APP_OSWB_COLOR },
- {(gchar *)"application/x-color", 0, APP_X_COLOR }
+ {(gchar *)"application/x-color", 0, APP_X_COLOR },
+ {(gchar *)"application/x-inkscape-paste", 0, APP_X_INK_PASTE }
};
static GtkTargetEntry *completeDropTargets = 0;
@@ -1430,6 +1433,13 @@ sp_ui_drag_data_received(GtkWidget *widget,
break;
}
+ case APP_X_INK_PASTE: {
+ Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get();
+ cm->paste(desktop);
+ DocumentUndo::done( doc, SP_VERB_NONE, _("Drop Symbol") );
+ break;
+ }
+
case PNG_DATA:
case JPEG_DATA:
case IMAGE_DATA: {
diff --git a/src/libavoid/makepath.cpp b/src/libavoid/makepath.cpp
index 4e15dbca9..774e0d7f5 100644
--- a/src/libavoid/makepath.cpp
+++ b/src/libavoid/makepath.cpp
@@ -82,7 +82,7 @@ class ANode
// it back into a heap) when getting the next node to examine. This way we
// get better complexity -- logarithmic pushs and pops to the heap.
//
-bool operator<(const ANode &a, const ANode &b)
+static bool operator<(const ANode &a, const ANode &b)
{
if (a.f != b.f)
{
diff --git a/src/libavoid/orthogonal.cpp b/src/libavoid/orthogonal.cpp
index e0a30b246..772fc9668 100644
--- a/src/libavoid/orthogonal.cpp
+++ b/src/libavoid/orthogonal.cpp
@@ -204,7 +204,7 @@ class ShiftSegment
};
typedef std::list<ShiftSegment> ShiftSegmentList;
-bool cmpShiftSegment(const ShiftSegment& u, const ShiftSegment& v)
+static bool cmpShiftSegment(const ShiftSegment& u, const ShiftSegment& v)
{
return u < v;
}
@@ -488,7 +488,7 @@ Event **events;
// Used for quicksort. Must return <0, 0, or >0.
-int compare_events(const void *a, const void *b)
+static int compare_events(const void *a, const void *b)
{
Event *ea = *(Event**) a;
Event *eb = *(Event**) b;
diff --git a/src/libcola/connected_components.cpp b/src/libcola/connected_components.cpp
index 0cf6ee45a..1afec55b4 100644
--- a/src/libcola/connected_components.cpp
+++ b/src/libcola/connected_components.cpp
@@ -39,7 +39,7 @@ namespace cola {
Rectangle* r;
};
// Depth first search traversal of graph to find connected component
- void dfs(Node* v,
+ static void dfs(Node* v,
list<Node*>& remaining,
Component* component,
map<unsigned,pair<Component*,unsigned> > &cmap) {
diff --git a/src/libcola/shortest_paths.cpp b/src/libcola/shortest_paths.cpp
index ebc2c93de..514721fb5 100644
--- a/src/libcola/shortest_paths.cpp
+++ b/src/libcola/shortest_paths.cpp
@@ -33,7 +33,7 @@ void floyd_warshall(
}
}
}
-void dijkstra_init(Node* vs, vector<Edge>& es, double* eweights) {
+static void dijkstra_init(Node* vs, vector<Edge>& es, double* eweights) {
for(unsigned i=0;i<es.size();i++) {
unsigned u=es[i].first, v=es[i].second;
vs[u].neighbours.push_back(&vs[v]);
@@ -42,7 +42,7 @@ void dijkstra_init(Node* vs, vector<Edge>& es, double* eweights) {
vs[v].nweights.push_back(eweights[i]);
}
}
-void dijkstra(
+static void dijkstra(
unsigned s,
unsigned n,
Node* vs,
diff --git a/src/libcola/straightener.cpp b/src/libcola/straightener.cpp
index 0ecd82faa..650f41aac 100644
--- a/src/libcola/straightener.cpp
+++ b/src/libcola/straightener.cpp
@@ -109,7 +109,7 @@ namespace straightener {
Event(EventType t, Edge *e, double p) : type(t),v(NULL),e(e),pos(p) {};
};
Event **events;
- int compare_events(const void *a, const void *b) {
+ static int compare_events(const void *a, const void *b) {
Event *ea=*(Event**)a;
Event *eb=*(Event**)b;
if((ea->v!=NULL&&ea->v==eb->v)||(ea->e!=NULL&&ea->e==eb->e)) {
diff --git a/src/libgdl/Makefile_insert b/src/libgdl/Makefile_insert
index 788df0673..3f5228a20 100644
--- a/src/libgdl/Makefile_insert
+++ b/src/libgdl/Makefile_insert
@@ -3,7 +3,6 @@
if WITH_EXT_GDL
EXTRA_DIST += \
- libgdl/gdl-tools.h \
libgdl/gdl-dock-object.h \
libgdl/gdl-dock-master.h \
libgdl/gdl-dock.h \
@@ -13,7 +12,6 @@ EXTRA_DIST += \
libgdl/gdl-dock-tablabel.h \
libgdl/gdl-dock-placeholder.h \
libgdl/gdl-dock-bar.h \
- libgdl/gdl-stock-icons.h \
libgdl/gdl-i18n.h \
libgdl/gdl-i18n.c \
libgdl/gdl-dock-object.c \
@@ -47,7 +45,6 @@ libgdl/clean:
rm -f libgdl/libgdl.a $(libgdl_gdl_a_OBJECTS)
libgdl_libgdl_a_SOURCES = \
- libgdl/gdl-tools.h \
libgdl/gdl-dock-object.h \
libgdl/gdl-dock-master.h \
libgdl/gdl-dock.h \
@@ -57,7 +54,6 @@ libgdl_libgdl_a_SOURCES = \
libgdl/gdl-dock-tablabel.h \
libgdl/gdl-dock-placeholder.h \
libgdl/gdl-dock-bar.h \
- libgdl/gdl-stock-icons.h \
libgdl/gdl-i18n.h \
libgdl/gdl-i18n.c \
libgdl/gdl-dock-object.c \
diff --git a/src/libnrtype/FontFactory.cpp b/src/libnrtype/FontFactory.cpp
index 8de9d4795..76a3df0e8 100644
--- a/src/libnrtype/FontFactory.cpp
+++ b/src/libnrtype/FontFactory.cpp
@@ -276,7 +276,7 @@ family_name_compare(char const *a, char const *b)
#endif
}
-void noop(...) {}
+static void noop(...) {}
//#define PANGO_DEBUG g_print
#define PANGO_DEBUG noop
@@ -285,7 +285,7 @@ void noop(...) {}
///////////////////// FontFactory
#ifndef USE_PANGO_WIN32
// the substitute function to tell fontconfig to enforce outline fonts
-void FactorySubstituteFunc(FcPattern *pattern,gpointer /*data*/)
+static void FactorySubstituteFunc(FcPattern *pattern,gpointer /*data*/)
{
FcPatternAddBool(pattern, "FC_OUTLINE",FcTrue);
//char *fam = NULL;
diff --git a/src/libnrtype/Makefile_insert b/src/libnrtype/Makefile_insert
index 7cd99e1a8..0ce8f1fd5 100644
--- a/src/libnrtype/Makefile_insert
+++ b/src/libnrtype/Makefile_insert
@@ -11,7 +11,6 @@ ink_common_sources += \
libnrtype/nr-type-pos-def.h \
libnrtype/nr-type-primitives.cpp \
libnrtype/nr-type-primitives.h \
- libnrtype/nrtype-forward.h \
libnrtype/FontFactory.cpp \
libnrtype/FontFactory.h \
libnrtype/FontInstance.cpp \
diff --git a/src/libvpsc/csolve_VPSC.h b/src/libvpsc/csolve_VPSC.h
index b0d01e763..edfd16657 100644
--- a/src/libvpsc/csolve_VPSC.h
+++ b/src/libvpsc/csolve_VPSC.h
@@ -60,7 +60,9 @@ int genXConstraints(int n, boxf[], Variable** vs, Constraint*** cs,
int genYConstraints(int n, boxf[], Variable** vs, Constraint*** cs);
void satisfyVPSC(Solver*);
+void deleteVPSC(Solver*);
void solveVPSC(Solver*);
+void splitIncVPSC(IncSolver*);
Solver* newIncSolver(int n, Variable* vs[], int m, Constraint* cs[]);
void splitIncSolver(IncSolver*);
int getSplitCnt(IncSolver *vpsc);
diff --git a/src/libvpsc/generate-constraints.cpp b/src/libvpsc/generate-constraints.cpp
index 8dd2d9331..fabe5217f 100644
--- a/src/libvpsc/generate-constraints.cpp
+++ b/src/libvpsc/generate-constraints.cpp
@@ -105,7 +105,7 @@ bool CmpNodePos::operator() (const Node* u, const Node* v) const {
*/
}
-NodeSet* getLeftNeighbours(NodeSet &scanline,Node *v) {
+static NodeSet* getLeftNeighbours(NodeSet &scanline,Node *v) {
NodeSet *leftv = new NodeSet;
NodeSet::iterator i=scanline.find(v);
while(i--!=scanline.begin()) {
@@ -120,7 +120,7 @@ NodeSet* getLeftNeighbours(NodeSet &scanline,Node *v) {
}
return leftv;
}
-NodeSet* getRightNeighbours(NodeSet &scanline,Node *v) {
+static NodeSet* getRightNeighbours(NodeSet &scanline,Node *v) {
NodeSet *rightv = new NodeSet;
NodeSet::iterator i=scanline.find(v);
for(++i;i!=scanline.end(); ++i) {
@@ -144,7 +144,7 @@ struct Event {
Event(EventType t, Node *v, double p) : type(t),v(v),pos(p) {};
};
Event **events;
-int compare_events(const void *a, const void *b) {
+static int compare_events(const void *a, const void *b) {
Event *ea=*(Event**)a;
Event *eb=*(Event**)b;
if(ea->v->r==eb->v->r) {
diff --git a/src/libvpsc/remove_rectangle_overlap.cpp b/src/libvpsc/remove_rectangle_overlap.cpp
index 381759f3c..d667ffb1e 100644
--- a/src/libvpsc/remove_rectangle_overlap.cpp
+++ b/src/libvpsc/remove_rectangle_overlap.cpp
@@ -15,6 +15,7 @@
#include "solve_VPSC.h"
#include "variable.h"
#include "constraint.h"
+#include "remove_rectangle_overlap.h" /* own include */
#ifdef RECTANGLE_OVERLAP_LOGGING
#include <fstream>
#include "blocks.h"
diff --git a/src/livarot/Makefile_insert b/src/livarot/Makefile_insert
index e4d88efd5..69078d073 100644
--- a/src/livarot/Makefile_insert
+++ b/src/livarot/Makefile_insert
@@ -37,6 +37,5 @@ livarot_libvarot_a_SOURCES = \
livarot/sweep-event.cpp \
livarot/sweep-event.h \
livarot/sweep-event-queue.h \
- livarot/livarot-forward.h \
livarot/path-description.h \
livarot/path-description.cpp
diff --git a/src/livarot/PathSimplify.cpp b/src/livarot/PathSimplify.cpp
index d6e916197..d9f609e87 100644
--- a/src/livarot/PathSimplify.cpp
+++ b/src/livarot/PathSimplify.cpp
@@ -70,10 +70,10 @@ void Path::Simplify(double treshhold)
// dichomtomic method to get distance to curve approximation
// a real polynomial solver would get the minimum more efficiently, but since the polynom
// would likely be of degree >= 5, that would imply using some generic solver, liek using the sturm metod
-double RecDistanceToCubic(Geom::Point const &iS, Geom::Point const &isD,
- Geom::Point const &iE, Geom::Point const &ieD,
- Geom::Point &pt, double current, int lev, double st, double et)
-{
+static double RecDistanceToCubic(Geom::Point const &iS, Geom::Point const &isD,
+ Geom::Point const &iE, Geom::Point const &ieD,
+ Geom::Point &pt, double current, int lev, double st, double et)
+{
if ( lev <= 0 ) {
return current;
}
@@ -116,7 +116,7 @@ double RecDistanceToCubic(Geom::Point const &iS, Geom::Point const &isD,
}
-double DistanceToCubic(Geom::Point const &start, PathDescrCubicTo res, Geom::Point &pt)
+static double DistanceToCubic(Geom::Point const &start, PathDescrCubicTo res, Geom::Point &pt)
{
Geom::Point const sp = pt - start;
Geom::Point const ep = pt - res.p;
diff --git a/src/livarot/PathStroke.cpp b/src/livarot/PathStroke.cpp
index 93280d794..cdd5cae6d 100644
--- a/src/livarot/PathStroke.cpp
+++ b/src/livarot/PathStroke.cpp
@@ -20,7 +20,7 @@
*/
// until i find something better
-Geom::Point StrokeNormalize(const Geom::Point value) {
+static Geom::Point StrokeNormalize(const Geom::Point value) {
double length = L2(value);
if ( length < 0.0000001 ) {
return Geom::Point(0, 0);
@@ -30,7 +30,7 @@ Geom::Point StrokeNormalize(const Geom::Point value) {
}
// faster version if length is known
-Geom::Point StrokeNormalize(const Geom::Point value, double length) {
+static Geom::Point StrokeNormalize(const Geom::Point value, double length) {
if ( length < 0.0000001 ) {
return Geom::Point(0, 0);
} else {
diff --git a/src/livarot/ShapeMisc.cpp b/src/livarot/ShapeMisc.cpp
index 7b170e8a0..a7e5a6cdc 100644
--- a/src/livarot/ShapeMisc.cpp
+++ b/src/livarot/ShapeMisc.cpp
@@ -406,7 +406,7 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int wildPath,in
if (startBord >= 0)
{
// parcours en profondeur pour mettre les leF et riF a leurs valeurs
- swdData[startBord].misc = (void *) (1+nbNest);
+ swdData[startBord].misc = (void *)(intptr_t)(1 + nbNest);
//printf("part de %d\n",startBord);
int curBord = startBord;
bool back = false;
@@ -507,7 +507,7 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int wildPath,in
startBord=nb;
}
}
- swdData[nb].misc = (void *) (1+nbNest);
+ swdData[nb].misc = (void *)(intptr_t)(1 + nbNest);
swdData[nb].ind = searchInd++;
swdData[nb].precParc = curBord;
swdData[curBord].suivParc = nb;
diff --git a/src/pixmaps/cursor-dropper-f.xpm b/src/pixmaps/cursor-dropper-f.xpm
new file mode 100644
index 000000000..3bf1e80e1
--- /dev/null
+++ b/src/pixmaps/cursor-dropper-f.xpm
@@ -0,0 +1,38 @@
+/* XPM */
+static const char * cursor_dropper_f_xpm[] = {
+"32 32 3 1",
+" c None",
+". c #FFFFFF",
+"+ c #000000",
+" ... ............",
+" .+. .++++++++++.",
+" .+. .+........+.",
+" .+. .+........+.",
+".... .... .+........+.",
+".+++ +++. .+........+.",
+".... .... .+........+.",
+" .+. .+........+.",
+" .+. .... .+........+.",
+" .+. .+++. .+........+.",
+" ... .+..+. .++++++++++.",
+" .++..+. ............",
+" .++..+. ",
+" .++..+. ",
+" .++..+. . ",
+" .++..+.+. ",
+" .++..+++. ",
+" .++++.+. ",
+" .++++.+.. ",
+" .++++++.++. ",
+" .++++++..+. ",
+" ..+++++.+. ",
+" .++++++. ",
+" .+++++. ",
+" .+++. ",
+" ... ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" "};
diff --git a/src/pixmaps/cursor-dropper-s.xpm b/src/pixmaps/cursor-dropper-s.xpm
new file mode 100644
index 000000000..1a12934d8
--- /dev/null
+++ b/src/pixmaps/cursor-dropper-s.xpm
@@ -0,0 +1,38 @@
+/* XPM */
+static const char * cursor_dropper_s_xpm[] = {
+"32 32 3 1",
+" c None",
+". c #FFFFFF",
+"+ c #000000",
+" ... ............",
+" .+. .+++.++.+++.",
+" .+. .+........+.",
+" .+. .+. .+.",
+".... .... ... ...",
+".+++ +++. .+. .+.",
+".... .... .+. .+.",
+" .+. ... ...",
+" .+. .... .+. .+.",
+" .+. .+++. .+........+.",
+" ... .+..+. .+++.++.+++.",
+" .++..+. ............",
+" .++..+. ",
+" .++..+. ",
+" .++..+. . ",
+" .++..+.+. ",
+" .++..+++. ",
+" .++++.+. ",
+" .++++.+.. ",
+" .++++++.++. ",
+" .++++++..+. ",
+" ..+++++.+. ",
+" .++++++. ",
+" .+++++. ",
+" .+++. ",
+" ... ",
+" ",
+" ",
+" ",
+" ",
+" ",
+" "};
diff --git a/src/shortcuts.cpp b/src/shortcuts.cpp
index 796962b11..9ececbb3b 100644
--- a/src/shortcuts.cpp
+++ b/src/shortcuts.cpp
@@ -28,6 +28,7 @@
#include <gdk/gdk.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
+#include <glibmm/i18n.h>
#include "helper/action.h"
#include "io/sys.h"
@@ -36,12 +37,24 @@
#include "verbs.h"
#include "xml/node-iterators.h"
#include "xml/repr.h"
+#include "document.h"
+#include "preferences.h"
+#include "event-context.h"
+#include "inkscape.h"
+#include "desktop.h"
+#include "path-prefix.h"
+#include "ui/dialog/filedialog.h"
using namespace Inkscape;
-static void sp_shortcut_set(unsigned int const shortcut, Inkscape::Verb *const verb, bool const is_primary);
+using Inkscape::IO::Resource::get_path;
+using Inkscape::IO::Resource::SYSTEM;
+using Inkscape::IO::Resource::USER;
+using Inkscape::IO::Resource::KEYS;
+
+
static void try_shortcuts_file(char const *filename);
-static void read_shortcuts_file(char const *filename);
+static void read_shortcuts_file(char const *filename, bool const is_user_set=false);
/* Returns true if action was performed */
@@ -61,19 +74,22 @@ sp_shortcut_invoke(unsigned int shortcut, Inkscape::UI::View::View *view)
static std::map<unsigned int, Inkscape::Verb * > *verbs = NULL;
static std::map<Inkscape::Verb *, unsigned int> *primary_shortcuts = NULL;
+static std::map<Inkscape::Verb *, unsigned int> *user_shortcuts = NULL;
-static void
-sp_shortcut_init()
+void sp_shortcut_init()
{
- using Inkscape::IO::Resource::get_path;
- using Inkscape::IO::Resource::SYSTEM;
- using Inkscape::IO::Resource::USER;
- using Inkscape::IO::Resource::KEYS;
verbs = new std::map<unsigned int, Inkscape::Verb * >();
primary_shortcuts = new std::map<Inkscape::Verb *, unsigned int>();
+ user_shortcuts = new std::map<Inkscape::Verb *, unsigned int>();
+
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ Glib::ustring shortcutfile = prefs->getString("/options/kbshortcuts/shortcutfile");
+ if (shortcutfile.empty()) {
+ shortcutfile = Glib::ustring(get_path(SYSTEM, KEYS, "default.xml"));
+ }
- read_shortcuts_file(get_path(SYSTEM, KEYS, "default.xml"));
+ read_shortcuts_file(shortcutfile.c_str());
try_shortcuts_file(get_path(USER, KEYS, "default.xml"));
}
@@ -82,11 +98,451 @@ static void try_shortcuts_file(char const *filename) {
/* ah, if only we had an exception to catch... (permission, forgiveness) */
if (file_test(filename, G_FILE_TEST_EXISTS)) {
- read_shortcuts_file(filename);
+ read_shortcuts_file(filename, true);
}
}
-static void read_shortcuts_file(char const *filename) {
+/*
+ * Inkscape expects to add the Shift modifier to any accel_keys create with Shift
+ * For exmaple on en_US keyboard <Shift>+6 = "&" - in this case return <Shift>+&
+ * See get_group0_keyval() for explanation on why
+ */
+unsigned int sp_gdkmodifier_to_shortcut(guint accel_key, Gdk::ModifierType gdkmodifier, guint hardware_keycode) {
+
+
+ unsigned int shortcut = 0;
+ GdkEventKey event;
+ event.state = gdkmodifier;
+ event.keyval = accel_key;
+ event.hardware_keycode = hardware_keycode;
+ guint keyval = get_group0_keyval (&event);
+
+ shortcut = accel_key |
+ ( (gdkmodifier & GDK_SHIFT_MASK) || ( accel_key != keyval) ?
+ SP_SHORTCUT_SHIFT_MASK : 0 ) |
+ ( gdkmodifier & GDK_CONTROL_MASK ?
+ SP_SHORTCUT_CONTROL_MASK : 0 ) |
+ ( gdkmodifier & GDK_MOD1_MASK ?
+ SP_SHORTCUT_ALT_MASK : 0 );
+
+ return shortcut;
+}
+
+Glib::ustring sp_shortcut_to_label(unsigned int const shortcut) {
+
+ Glib::ustring modifiers = "";
+
+ if (shortcut & SP_SHORTCUT_CONTROL_MASK)
+ modifiers += "Ctrl,";
+ if (shortcut & SP_SHORTCUT_SHIFT_MASK)
+ modifiers += "Shift,";
+ if (shortcut & SP_SHORTCUT_ALT_MASK)
+ modifiers += "Alt,";
+
+ if(modifiers.length() > 0 &&
+ modifiers.find(',',modifiers.length()-1)!=modifiers.npos) {
+ modifiers.erase(modifiers.length()-1, 1);
+ }
+
+ return modifiers;
+}
+
+/*
+ * REmove all shortucts from the users file
+ */
+
+void sp_shortcuts_delete_all_from_file() {
+
+
+ char const *filename = get_path(USER, KEYS, "default.xml");
+
+ XML::Document *doc=sp_repr_read_file(filename, NULL);
+ if (!doc) {
+ g_warning("Unable to read keys file %s", filename);
+ return;
+ }
+
+ XML::Node *root=doc->root();
+ g_return_if_fail(!strcmp(root->name(), "keys"));
+
+ XML::Node *iter=root->firstChild();
+ while (iter) {
+
+ if (strcmp(iter->name(), "bind")) {
+ // some unknown element, do not complain
+ iter = iter->next();
+ continue;
+ }
+
+ // Delete node
+ sp_repr_unparent(iter);
+ iter=root->firstChild();
+ }
+
+
+ sp_repr_save_file(doc, filename, NULL);
+
+ GC::release(doc);
+}
+
+Inkscape::XML::Document *sp_shortcut_create_template_file(char const *filename) {
+
+ gchar const *buffer =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?> "
+ "<keys name=\"My custom shortcuts\">"
+ "</keys>";
+
+ Inkscape::XML::Document *doc = sp_repr_read_mem(buffer, strlen(buffer), NULL);
+ sp_repr_save_file(doc, filename, NULL);
+
+ return sp_repr_read_file(filename, NULL);
+}
+
+/*
+ * Get a list of keyboard shortcut files names and paths from the system and users paths
+ * Dont add the users custom keyboards file
+ */
+void sp_shortcut_get_file_names(std::vector<Glib::ustring> *names, std::vector<Glib::ustring> *paths) {
+
+ std::list<gchar *> sources;
+ sources.push_back( profile_path("keys") );
+ sources.push_back( g_strdup(INKSCAPE_KEYSDIR) );
+
+ // loop through possible keyboard shortcut file locations.
+ while (!sources.empty()) {
+ gchar *dirname = sources.front();
+ if ( Inkscape::IO::file_test( dirname, G_FILE_TEST_EXISTS )
+ && Inkscape::IO::file_test( dirname, G_FILE_TEST_IS_DIR )) {
+ GError *err = 0;
+ GDir *directory = g_dir_open(dirname, 0, &err);
+ if (!directory) {
+ gchar *safeDir = Inkscape::IO::sanitizeString(dirname);
+ g_warning(_("Keyboard directory (%s) is unavailable."), safeDir);
+ g_free(safeDir);
+ } else {
+ gchar *filename = 0;
+ while ((filename = (gchar *) g_dir_read_name(directory)) != NULL) {
+ gchar* lower = g_ascii_strdown(filename, -1);
+ if (!strcmp(dirname, profile_path("keys")) &&
+ !strcmp(lower, "default.xml")) {
+ // Dont add the users custom keys file
+ continue;
+ }
+ if (!strcmp(dirname, INKSCAPE_KEYSDIR) &&
+ !strcmp(lower, "inkscape.xml")) {
+ // Dont add system inkscape.xml (since its a duplicate? of dfefault.xml)
+ continue;
+ }
+ if (g_str_has_suffix(lower, ".xml")) {
+ gchar* full = g_build_filename(dirname, filename, NULL);
+ if (!Inkscape::IO::file_test(full, G_FILE_TEST_IS_DIR)) {
+
+ // Get the "key name" from the root element of each file
+ XML::Document *doc=sp_repr_read_file(full, NULL);
+ if (!doc) {
+ g_warning("Unable to read keyboard shortcut file %s", full);
+ continue;
+ }
+ XML::Node *root=doc->root();
+ if (strcmp(root->name(), "keys")) {
+ g_warning("Not a shortcut keys file %s", full);
+ Inkscape::GC::release(doc);
+ continue;
+ }
+
+ gchar const *name=root->attribute("name");
+ Glib::ustring label(filename);
+ if (name) {
+ label = Glib::ustring(name)+ " (" + filename + ")";
+ }
+
+ if (!strcmp(filename, "default.xml")) {
+ paths->insert(paths->begin(), full);
+ names->insert(names->begin(), label.c_str());
+ } else {
+ paths->push_back(full);
+ names->push_back(label.c_str());
+ }
+
+ Inkscape::GC::release(doc);
+ }
+ g_free(full);
+ }
+ g_free(lower);
+ }
+ g_dir_close(directory);
+ }
+ }
+
+ g_free(dirname);
+ sources.pop_front();
+ }
+
+}
+
+Glib::ustring sp_shortcut_get_file_path()
+{
+ //# Get the current directory for finding files
+ Glib::ustring open_path;
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+
+ Glib::ustring attr = prefs->getString("/dialogs/save_export/path");
+ if (!attr.empty()) open_path = attr;
+
+ //# Test if the open_path directory exists
+ if (!Inkscape::IO::file_test(open_path.c_str(),
+ (GFileTest)(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)))
+ open_path = "";
+
+ if (open_path.empty()) {
+ /* Grab document directory */
+ const gchar* docURI = SP_ACTIVE_DOCUMENT->getURI();
+ if (docURI) {
+ open_path = Glib::path_get_dirname(docURI);
+ open_path.append(G_DIR_SEPARATOR_S);
+ }
+ }
+
+ //# If no open path, default to our home directory
+ if (open_path.empty())
+ {
+ open_path = g_get_home_dir();
+ open_path.append(G_DIR_SEPARATOR_S);
+ }
+
+ return open_path;
+}
+
+//static Inkscape::UI::Dialog::FileSaveDialog * saveDialog = NULL;
+
+void sp_shortcut_file_export()
+{
+ Glib::ustring open_path = sp_shortcut_get_file_path();
+ open_path.append("shortcut_keys.xml");
+
+ SPDesktop *desktop = SP_ACTIVE_DESKTOP;
+ Glib::ustring filename;
+
+ Inkscape::UI::Dialog::FileSaveDialog *saveDialog =
+ Inkscape::UI::Dialog::FileSaveDialog::create(
+ *(desktop->getToplevel()),
+ open_path,
+ Inkscape::UI::Dialog::CUSTOM_TYPE,
+ _("Select a filename for exporting"),
+ "",
+ "",
+ Inkscape::Extension::FILE_SAVE_METHOD_SAVE_AS
+ );
+ saveDialog->addFileType("All Files", "*");
+
+ bool success = saveDialog->show();
+ if (!success) {
+ delete saveDialog;
+ return;
+ }
+
+ Glib::ustring fileName = saveDialog->getFilename();
+ if (fileName.size() > 0) {
+ Glib::ustring newFileName = Glib::filename_to_utf8(fileName);
+ sp_shortcut_file_export_do(newFileName.c_str());
+ }
+
+ delete saveDialog;
+}
+
+bool sp_shortcut_file_import() {
+
+ Glib::ustring open_path = sp_shortcut_get_file_path();
+
+ SPDesktop *desktop = SP_ACTIVE_DESKTOP;
+
+ Inkscape::UI::Dialog::FileOpenDialog *importFileDialog =
+ Inkscape::UI::Dialog::FileOpenDialog::create(
+ *desktop->getToplevel(),
+ open_path,
+ Inkscape::UI::Dialog::CUSTOM_TYPE,
+ _("Select a file to import"));
+ importFileDialog->addFilterMenu("All Files", "*");
+
+ //# Show the dialog
+ bool const success = importFileDialog->show();
+
+ if (!success) {
+ delete importFileDialog;
+ return false;
+ }
+
+ Glib::ustring fileName = importFileDialog->getFilename();
+ sp_shortcut_file_import_do(fileName.c_str());
+
+ delete importFileDialog;
+
+ return true;
+}
+
+void sp_shortcut_file_import_do(char const *importname) {
+
+ XML::Document *doc=sp_repr_read_file(importname, NULL);
+ if (!doc) {
+ g_warning("Unable to read keyboard shortcut file %s", importname);
+ return;
+ }
+
+ char const *filename = get_path(USER, KEYS, "default.xml");
+ sp_repr_save_file(doc, filename, NULL);
+
+ GC::release(doc);
+
+ sp_shortcut_init();
+}
+
+void sp_shortcut_file_export_do(char const *exportname) {
+
+ char const *filename = get_path(USER, KEYS, "default.xml");
+
+ XML::Document *doc=sp_repr_read_file(filename, NULL);
+ if (!doc) {
+ g_warning("Unable to read keyboard shortcut file %s", filename);
+ return;
+ }
+
+ sp_repr_save_file(doc, exportname, NULL);
+
+ GC::release(doc);
+}
+/*
+ * Add or delete a shortcut to the users default.xml keys file
+ * @param addremove - when true add/override a shortcut, when false remove shortcut
+ * @param addshift - when true addthe Shifg modifier to the non-display element
+ *
+ * Shortcut file consists of pairs of bind elements :
+ * Element (a) is used for shortcut display in menus (display="True") and contains the gdk_keyval_name of the shortcut key
+ * Element (b) is used in shortcut lookup and contains an uppercase version of the gdk_keyval_name,
+ * or a gdk_keyval_name name and the "Shift" modifier for Shift altered hardware code keys (see get_group0_keyval() for explanation)
+ */
+void sp_shortcut_delete_from_file(char const *action, unsigned int const shortcut) {
+
+ char const *filename = get_path(USER, KEYS, "default.xml");
+
+ XML::Document *doc=sp_repr_read_file(filename, NULL);
+ if (!doc) {
+ g_warning("Unable to read keyboard shortcut file %s", filename);
+ return;
+ }
+
+ gchar *key = gdk_keyval_name (shortcut & (~SP_SHORTCUT_MODIFIER_MASK));
+ std::string modifiers = sp_shortcut_to_label(shortcut & (SP_SHORTCUT_MODIFIER_MASK));
+
+ if (!key) {
+ g_warning("Unknown key for shortcut %u", shortcut);
+ return;
+ }
+
+ //g_message("Removing key %s, mods %s action %s", key, modifiers.c_str(), action);
+
+ XML::Node *root=doc->root();
+ g_return_if_fail(!strcmp(root->name(), "keys"));
+ XML::Node *iter=root->firstChild();
+ while (iter) {
+
+ if (strcmp(iter->name(), "bind")) {
+ // some unknown element, do not complain
+ iter = iter->next();
+ continue;
+ }
+
+ gchar const *verb_name=iter->attribute("action");
+ if (!verb_name) {
+ iter = iter->next();
+ continue;
+ }
+
+ gchar const *keyval_name = iter->attribute("key");
+ if (!keyval_name || !*keyval_name) {
+ // that's ok, it's just listed for reference without assignment, skip it
+ iter = iter->next();
+ continue;
+ }
+
+ if (Glib::ustring(key).lowercase() != Glib::ustring(keyval_name).lowercase()) {
+ // If deleting, then delete both the upper and lower case versions
+ iter = iter->next();
+ continue;
+ }
+
+ gchar const *modifiers_string = iter->attribute("modifiers");
+ if ((modifiers_string && !strcmp(modifiers.c_str(), modifiers_string)) ||
+ (!modifiers_string && modifiers.empty())) {
+ //Looks like a match
+ // Delete node
+ sp_repr_unparent(iter);
+ iter = root->firstChild();
+ continue;
+ }
+ iter = iter->next();
+ }
+
+ sp_repr_save_file(doc, filename, NULL);
+
+ GC::release(doc);
+
+}
+
+void sp_shortcut_add_to_file(char const *action, unsigned int const shortcut) {
+
+ char const *filename = get_path(USER, KEYS, "default.xml");
+
+ XML::Document *doc=sp_repr_read_file(filename, NULL);
+ if (!doc) {
+ g_warning("Unable to read keyboard shortcut file %s, creating ....", filename);
+ doc = sp_shortcut_create_template_file(filename);
+ if (!doc) {
+ g_warning("Unable to create keyboard shortcut file %s", filename);
+ return;
+ }
+ }
+
+ gchar *key = gdk_keyval_name (shortcut & (~SP_SHORTCUT_MODIFIER_MASK));
+ std::string modifiers = sp_shortcut_to_label(shortcut & (SP_SHORTCUT_MODIFIER_MASK));
+
+ if (!key) {
+ g_warning("Unknown key for shortcut %u", shortcut);
+ return;
+ }
+
+ //g_message("Adding key %s, mods %s action %s", key, modifiers.c_str(), action);
+
+ // Add node
+ Inkscape::XML::Node *newnode;
+ newnode = doc->createElement("bind");
+ newnode->setAttribute("key", key);
+ if (!modifiers.empty()) {
+ newnode->setAttribute("modifiers", modifiers.c_str());
+ }
+ newnode->setAttribute("action", action);
+ newnode->setAttribute("display", "true");
+
+ doc->root()->appendChild(newnode);
+
+ if (strlen(key) == 1) {
+ // Add another uppercase version if a character
+ Inkscape::XML::Node *newnode;
+ newnode = doc->createElement("bind");
+ newnode->setAttribute("key", Glib::ustring(key).uppercase().c_str());
+ if (!modifiers.empty()) {
+ newnode->setAttribute("modifiers", modifiers.c_str());
+ }
+
+ newnode->setAttribute("action", action);
+ doc->root()->appendChild(newnode);
+ }
+
+ sp_repr_save_file(doc, filename, NULL);
+
+ GC::release(doc);
+
+}
+static void read_shortcuts_file(char const *filename, bool const is_user_set) {
XML::Document *doc=sp_repr_read_file(filename, NULL);
if (!doc) {
g_warning("Unable to read keys file %s", filename);
@@ -153,13 +609,37 @@ static void read_shortcuts_file(char const *filename) {
}
}
- sp_shortcut_set(keyval | modifiers, verb, is_primary);
+ sp_shortcut_set(keyval | modifiers, verb, is_primary, is_user_set);
}
GC::release(doc);
}
/**
+ * Removes a keyboard shortcut for the given verb.
+ * (Removes any existing binding for the given shortcut, including appropriately
+ * adjusting sp_shortcut_get_primary if necessary.)*
+ */
+void
+sp_shortcut_unset(unsigned int const shortcut)
+{
+ if (!verbs) sp_shortcut_init();
+
+ Inkscape::Verb *verb = (*verbs)[shortcut];
+
+ /* Maintain the invariant that sp_shortcut_get_primary(v) returns either 0 or a valid shortcut for v. */
+ if (verb) {
+
+ (*verbs)[shortcut] = 0;
+
+ unsigned int const old_primary = (*primary_shortcuts)[verb];
+ if (old_primary == shortcut) {
+ (*primary_shortcuts)[verb] = 0;
+ }
+
+ }
+}
+/**
* Adds a keyboard shortcut for the given verb.
* (Removes any existing binding for the given shortcut, including appropriately
* adjusting sp_shortcut_get_primary if necessary.)
@@ -169,8 +649,8 @@ static void read_shortcuts_file(char const *filename) {
* \post sp_shortcut_get_verb(shortcut) == verb.
* \post !is_primary or sp_shortcut_get_primary(verb) == shortcut.
*/
-static void
-sp_shortcut_set(unsigned int const shortcut, Inkscape::Verb *const verb, bool const is_primary)
+void
+sp_shortcut_set(unsigned int const shortcut, Inkscape::Verb *const verb, bool const is_primary, bool const is_user_set)
{
if (!verbs) sp_shortcut_init();
@@ -183,11 +663,13 @@ sp_shortcut_set(unsigned int const shortcut, Inkscape::Verb *const verb, bool co
if (old_primary == shortcut) {
(*primary_shortcuts)[old_verb] = 0;
+ (*user_shortcuts)[old_verb] = 0;
}
}
if (is_primary) {
(*primary_shortcuts)[verb] = shortcut;
+ (*user_shortcuts)[verb] = is_user_set;
}
}
@@ -211,6 +693,20 @@ unsigned int sp_shortcut_get_primary(Inkscape::Verb *verb)
return result;
}
+bool sp_shortcut_is_user_set(Inkscape::Verb *verb)
+{
+ unsigned int result = false;
+ if (!primary_shortcuts) {
+ sp_shortcut_init();
+ }
+
+ if (primary_shortcuts->count(verb)) {
+ result = (*user_shortcuts)[verb];
+ }
+ return result;
+}
+
+
gchar *sp_shortcut_get_label(unsigned int shortcut)
{
// The comment below was copied from the function sp_ui_shortcut_string in interface.cpp (which was subsequently removed)
diff --git a/src/shortcuts.h b/src/shortcuts.h
index 9d84aa6d1..118909bd3 100644
--- a/src/shortcuts.h
+++ b/src/shortcuts.h
@@ -1,6 +1,8 @@
#ifndef __SP_SHORTCUTS_H__
#define __SP_SHORTCUTS_H__
+#include <gtkmm/cellrendereraccel.h>
+
/*
* Keyboard shortcut processing
*
@@ -29,9 +31,23 @@ namespace Inkscape {
/* Returns true if action was performed */
bool sp_shortcut_invoke (unsigned int shortcut, Inkscape::UI::View::View *view);
+void sp_shortcut_init();
Inkscape::Verb * sp_shortcut_get_verb (unsigned int shortcut);
unsigned int sp_shortcut_get_primary (Inkscape::Verb * verb); // Returns GDK_VoidSymbol if no shortcut is found.
char* sp_shortcut_get_label (unsigned int shortcut); // Returns the human readable form of the shortcut (or NULL), for example Shift+Ctrl+F. Free the returned string with g_free.
+void sp_shortcut_set(unsigned int const shortcut, Inkscape::Verb *const verb, bool const is_primary, bool const is_user_set=false);
+void sp_shortcut_unset(unsigned int const shortcut);
+void sp_shortcut_add_to_file(char const *action, unsigned int const shortcut);
+void sp_shortcut_delete_from_file(char const *action, unsigned int const shortcut);
+void sp_shortcuts_delete_all_from_file();
+Glib::ustring sp_shortcut_to_label(unsigned int const shortcut);
+unsigned int sp_gdkmodifier_to_shortcut(guint accel_key, Gdk::ModifierType gdkmodifier, guint hardware_keycode);
+void sp_shortcut_get_file_names(std::vector<Glib::ustring> *names, std::vector<Glib::ustring> *paths);
+bool sp_shortcut_is_user_set(Inkscape::Verb *verb);
+void sp_shortcut_file_export();
+bool sp_shortcut_file_import();
+void sp_shortcut_file_import_do(char const *importname);
+void sp_shortcut_file_export_do(char const *exportname);
#endif
diff --git a/src/sp-gradient.cpp b/src/sp-gradient.cpp
index f9f9a5015..d7add805d 100644
--- a/src/sp-gradient.cpp
+++ b/src/sp-gradient.cpp
@@ -2051,13 +2051,32 @@ sp_radialgradient_create_pattern(SPPaintServer *ps,
double scale = 1.0;
double tolerance = cairo_get_tolerance(ct);
+ // NOTE: SVG2 will allow the use of a focus circle which can
+ // have its center outside the first circle.
+
// code below suggested by Cairo devs to overcome tolerance problems
// more: https://bugs.freedesktop.org/show_bug.cgi?id=40918
+
+ // Corrected for
+ // https://bugs.launchpad.net/inkscape/+bug/970355
+
+ Geom::Affine gs2user = gr->gradientTransform;
+ Geom::Scale gs2user_scale;
+
+ if (gr->getUnits() == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX && bbox) {
+ Geom::Affine bbox2user(bbox->width(), 0, 0, bbox->height(), bbox->left(), bbox->top());
+ gs2user *= bbox2user;
+ gs2user_scale = Geom::Scale( gs2user[0], gs2user[3] );
+ }
+
Geom::Point d = focus - center;
- if (d.length() + tolerance > radius) {
- scale = radius / d.length();
+ Geom::Point d_user = d * gs2user_scale;
+ Geom::Point r_user( radius, 0 );
+ r_user *= gs2user_scale;
- double dx = d.x(), dy = d.y();
+ if (d_user.length() + tolerance > r_user.length()) {
+ scale = r_user.length() / d_user.length();
+ double dx = d_user.x(), dy = d_user.y();
cairo_user_to_device_distance(ct, &dx, &dy);
if (!Geom::are_near(dx, 0, tolerance) ||
!Geom::are_near(dy, 0, tolerance))
diff --git a/src/sp-image.cpp b/src/sp-image.cpp
index aa16bcdd4..7293c49fa 100644
--- a/src/sp-image.cpp
+++ b/src/sp-image.cpp
@@ -433,10 +433,16 @@ GdkPixbuf* pixbuf_new_from_file( const char *filename, time_t &modTime, gchar*&
modTime = 0;
if ( pixPath ) {
g_free(pixPath);
- pixPath = 0;
+ pixPath = NULL;
+ }
+
+ struct stat stdir;
+ g_stat(filename, &stdir);
+ if (stdir.st_mode & S_IFDIR){
+ //filename is not correct: it is a directory name and hence further code can not return valid results
+ return NULL;
}
- //buf = gdk_pixbuf_new_from_file( filename, error );
dump_fopen_call( filename, "pixbuf_new_from_file" );
FILE* fp = fopen_utf8name( filename, "r" );
if ( fp )
@@ -479,7 +485,6 @@ GdkPixbuf* pixbuf_new_from_file( const char *filename, time_t &modTime, gchar*&
}
} else if ( !latter ) {
latter = TRUE;
- //g_message(" READing latter");
}
// Now clear out the buffer so we can read more.
// (dumping out unused)
@@ -492,23 +497,6 @@ GdkPixbuf* pixbuf_new_from_file( const char *filename, time_t &modTime, gchar*&
buf = gdk_pixbuf_loader_get_pixbuf( loader );
if ( buf ) {
g_object_ref(buf);
-
- if ( dpiX ) {
- gchar *tmp = g_strdup_printf( "%d", dpiX );
- if ( tmp ) {
- //g_message("Need to set DpiX: %s", tmp);
- //gdk_pixbuf_set_option( buf, "Inkscape::DpiX", tmp );
- g_free( tmp );
- }
- }
- if ( dpiY ) {
- gchar *tmp = g_strdup_printf( "%d", dpiY );
- if ( tmp ) {
- //g_message("Need to set DpiY: %s", tmp);
- //gdk_pixbuf_set_option( buf, "Inkscape::DpiY", tmp );
- g_free( tmp );
- }
- }
}
} else {
// do something
@@ -525,22 +513,6 @@ GdkPixbuf* pixbuf_new_from_file( const char *filename, time_t &modTime, gchar*&
g_warning ("Unable to open linked file: %s", filename);
}
-/*
- if ( buf )
- {
- const gchar* bloop = gdk_pixbuf_get_option( buf, "Inkscape::DpiX" );
- if ( bloop )
- {
- g_message("DPI X is [%s]", bloop);
- }
- bloop = gdk_pixbuf_get_option( buf, "Inkscape::DpiY" );
- if ( bloop )
- {
- g_message("DPI Y is [%s]", bloop);
- }
- }
-*/
-
return buf;
}
diff --git a/src/svg/itos.cpp b/src/svg/itos.cpp
index ff7ca516c..78726d068 100644
--- a/src/svg/itos.cpp
+++ b/src/svg/itos.cpp
@@ -18,6 +18,8 @@
#include <string> // for string
#include <cstring>
+#include "../io/ftos.h" /* own include */ /* note - why in different dirs? */
+
using std::string;
string itos(int n)
diff --git a/src/svg/round.cpp b/src/svg/round.cpp
index 9e7b91e4e..0a4ca9d05 100644
--- a/src/svg/round.cpp
+++ b/src/svg/round.cpp
@@ -26,6 +26,7 @@
// on the average.
///////////////////////////////////////////////////////////////////////
#include <math.h>
+#include "../io/ftos.h" /* own include */ /* note - why in different dirs? */
double rround(double x)
{
diff --git a/src/trace/trace.h b/src/trace/trace.h
index f811f4891..9f9f44b14 100644
--- a/src/trace/trace.h
+++ b/src/trace/trace.h
@@ -48,12 +48,11 @@ public:
*/
TracingEngineResult(const std::string &theStyle,
const std::string &thePathData,
- long theNodeCount)
- {
- style = theStyle;
- pathData = thePathData;
- nodeCount = theNodeCount;
- }
+ long theNodeCount) :
+ style(theStyle),
+ pathData(thePathData),
+ nodeCount(theNodeCount)
+ {}
TracingEngineResult(const TracingEngineResult &other)
{ assign(other); }
diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp
index 4b0f773b5..cd1ce1471 100644
--- a/src/ui/dialog/align-and-distribute.cpp
+++ b/src/ui/dialog/align-and-distribute.cpp
@@ -1314,7 +1314,6 @@ std::list<SPItem *>::iterator AlignAndDistribute::find_master( std::list<SPItem
}
}
return master;
- break;
}
case SMALLEST:
@@ -1331,7 +1330,6 @@ std::list<SPItem *>::iterator AlignAndDistribute::find_master( std::list<SPItem
}
}
return master;
- break;
}
default:
diff --git a/src/ui/dialog/align-and-distribute.h b/src/ui/dialog/align-and-distribute.h
index 969703807..c9165a83e 100644
--- a/src/ui/dialog/align-and-distribute.h
+++ b/src/ui/dialog/align-and-distribute.h
@@ -213,7 +213,7 @@ private :
SPDesktop *desktop = _dialog.getDesktop();
if (!desktop) return;
- ActionAlign::do_action(desktop, _index);
+ do_action(desktop, _index);
}
static void do_action(SPDesktop *desktop, int index);
diff --git a/src/ui/dialog/clonetiler.cpp b/src/ui/dialog/clonetiler.cpp
index 47ec03b30..f51470826 100644
--- a/src/ui/dialog/clonetiler.cpp
+++ b/src/ui/dialog/clonetiler.cpp
@@ -1326,8 +1326,8 @@ void CloneTiler::on_picker_color_changed(guint rgba)
void CloneTiler::clonetiler_change_selection(Inkscape::Application * /*inkscape*/, Inkscape::Selection *selection, GtkWidget *dlg)
{
- GtkWidget *buttons = (GtkWidget *) g_object_get_data (G_OBJECT(dlg), "buttons_on_tiles");
- GtkWidget *status = (GtkWidget *) g_object_get_data (G_OBJECT(dlg), "status");
+ GtkWidget *buttons = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "buttons_on_tiles"));
+ GtkWidget *status = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "status"));
if (selection->isEmpty()) {
gtk_widget_set_sensitive (buttons, FALSE);
@@ -2204,7 +2204,7 @@ void CloneTiler::clonetiler_apply(GtkWidget */*widget*/, GtkWidget *dlg)
desktop->setWaitingCursor();
// set statusbar text
- GtkWidget *status = (GtkWidget *) g_object_get_data (G_OBJECT(dlg), "status");
+ GtkWidget *status = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "status"));
gtk_label_set_markup (GTK_LABEL(status), _("<small>Creating tiled clones...</small>"));
gtk_widget_queue_draw(GTK_WIDGET(status));
gdk_window_process_all_updates();
@@ -2870,10 +2870,10 @@ void CloneTiler::clonetiler_pick_switched(GtkToggleButton */*tb*/, gpointer data
}
-void CloneTiler::clonetiler_switch_to_create(GtkToggleButton */*tb*/, GtkWidget *dlg)
+void CloneTiler::clonetiler_switch_to_create(GtkToggleButton * /*tb*/, GtkWidget *dlg)
{
- GtkWidget *rowscols = (GtkWidget *) g_object_get_data (G_OBJECT(dlg), "rowscols");
- GtkWidget *widthheight = (GtkWidget *) g_object_get_data (G_OBJECT(dlg), "widthheight");
+ GtkWidget *rowscols = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "rowscols"));
+ GtkWidget *widthheight = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "widthheight"));
if (rowscols) {
gtk_widget_set_sensitive (rowscols, TRUE);
@@ -2887,10 +2887,10 @@ void CloneTiler::clonetiler_switch_to_create(GtkToggleButton */*tb*/, GtkWidget
}
-void CloneTiler::clonetiler_switch_to_fill(GtkToggleButton */*tb*/, GtkWidget *dlg)
+void CloneTiler::clonetiler_switch_to_fill(GtkToggleButton * /*tb*/, GtkWidget *dlg)
{
- GtkWidget *rowscols = (GtkWidget *) g_object_get_data (G_OBJECT(dlg), "rowscols");
- GtkWidget *widthheight = (GtkWidget *) g_object_get_data (G_OBJECT(dlg), "widthheight");
+ GtkWidget *rowscols = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "rowscols"));
+ GtkWidget *widthheight = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "widthheight"));
if (rowscols) {
gtk_widget_set_sensitive (rowscols, FALSE);
@@ -2929,7 +2929,7 @@ void CloneTiler::clonetiler_fill_height_changed(GtkAdjustment *adj, GtkWidget *u
void CloneTiler::clonetiler_do_pick_toggled(GtkToggleButton *tb, GtkWidget *dlg)
{
- GtkWidget *vvb = (GtkWidget *) g_object_get_data (G_OBJECT(dlg), "dotrace");
+ GtkWidget *vvb = GTK_WIDGET(g_object_get_data (G_OBJECT(dlg), "dotrace"));
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
prefs->setBool(prefs_path + "dotrace", gtk_toggle_button_get_active (tb));
diff --git a/src/ui/dialog/color-item.cpp b/src/ui/dialog/color-item.cpp
index 97f6cc07f..e370a0342 100644
--- a/src/ui/dialog/color-item.cpp
+++ b/src/ui/dialog/color-item.cpp
@@ -144,7 +144,7 @@ static void dieDieDie( GObject *obj, gpointer user_data )
g_message("die die die %p %p", obj, user_data );
}
-static bool getBlock( std::string& dst, guchar ch, std::string const str )
+static bool getBlock( std::string& dst, guchar ch, std::string const & str )
{
bool good = false;
std::string::size_type pos = str.find(ch);
diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp
index 693268b35..e681147aa 100644
--- a/src/ui/dialog/document-properties.cpp
+++ b/src/ui/dialog/document-properties.cpp
@@ -928,7 +928,7 @@ void DocumentProperties::removeExternalScript(){
while ( current ) {
if (current->data && SP_IS_OBJECT(current->data)) {
SPObject* obj = SP_OBJECT(current->data);
- SPScript* script = (SPScript*) obj;
+ SPScript* script = SP_SCRIPT(obj);
if (name == script->xlinkhref){
//XML Tree being used directly here while it shouldn't be.
@@ -1085,7 +1085,7 @@ void DocumentProperties::populate_script_lists(){
if (current) _scripts_observer.set(SP_OBJECT(current->data)->parent);
while ( current ) {
SPObject* obj = SP_OBJECT(current->data);
- SPScript* script = (SPScript*) obj;
+ SPScript* script = SP_SCRIPT(obj);
if (script->xlinkhref)
{
Gtk::TreeModel::Row row = *(_ExternalScriptsListStore->append());
diff --git a/src/ui/dialog/export.cpp b/src/ui/dialog/export.cpp
index e6c8ca107..f267c5ae9 100644
--- a/src/ui/dialog/export.cpp
+++ b/src/ui/dialog/export.cpp
@@ -1260,6 +1260,14 @@ void Export::onBrowse ()
WCHAR* title_string = (WCHAR*)g_utf8_to_utf16(_("Select a filename for exporting"), -1, NULL, NULL, NULL);
WCHAR* extension_string = (WCHAR*)g_utf8_to_utf16("*.png", -1, NULL, NULL, NULL);
// Copy the selected file name, converting from UTF-8 to UTF-16
+ std::string dirname = Glib::path_get_dirname(filename.raw());
+ if ( !Glib::file_test(dirname, Glib::FILE_TEST_EXISTS) ||
+ Glib::file_test(filename, Glib::FILE_TEST_IS_DIR) ||
+ dirname.empty() )
+ {
+ Glib::ustring tmp;
+ filename = create_filepath_from_id(tmp, tmp);
+ }
WCHAR _filename[_MAX_PATH + 1];
memset(_filename, 0, sizeof(_filename));
gunichar2* utf16_path_string = g_utf8_to_utf16(filename.c_str(), -1, NULL, NULL, NULL);
@@ -1438,7 +1446,7 @@ void Export::areaXChange (Gtk::Adjustment *adj)
return;
}
- if (sp_unit_selector_update_test ((SPUnitSelector *)unit_selector->gobj())) {
+ if (sp_unit_selector_update_test(SP_UNIT_SELECTOR(unit_selector->gobj()))) {
return;
}
@@ -1485,7 +1493,7 @@ void Export::areaYChange (Gtk::Adjustment *adj)
return;
}
- if (sp_unit_selector_update_test ((SPUnitSelector *)unit_selector->gobj())) {
+ if (sp_unit_selector_update_test (SP_UNIT_SELECTOR(unit_selector->gobj()))) {
return;
}
@@ -1640,7 +1648,7 @@ void Export::onBitmapWidthChange ()
return;
}
- if (sp_unit_selector_update_test ((SPUnitSelector *)unit_selector->gobj())) {
+ if (sp_unit_selector_update_test(SP_UNIT_SELECTOR(unit_selector->gobj()))) {
return;
}
@@ -1674,7 +1682,7 @@ void Export::onBitmapHeightChange ()
return;
}
- if (sp_unit_selector_update_test ((SPUnitSelector *)unit_selector->gobj())) {
+ if (sp_unit_selector_update_test(SP_UNIT_SELECTOR(unit_selector->gobj()))) {
return;
}
@@ -1734,7 +1742,7 @@ void Export::onExportXdpiChange()
return;
}
- if (sp_unit_selector_update_test ((SPUnitSelector *)unit_selector->gobj())) {
+ if (sp_unit_selector_update_test(SP_UNIT_SELECTOR(unit_selector->gobj()))) {
return;
}
@@ -1836,7 +1844,7 @@ void Export::setValuePx(Glib::RefPtr<Gtk::Adjustment>& adj, double val)
void Export::setValuePx( Gtk::Adjustment *adj, double val)
#endif
{
- const SPUnit *unit = sp_unit_selector_get_unit ((SPUnitSelector *)unit_selector->gobj() );
+ const SPUnit *unit = sp_unit_selector_get_unit(SP_UNIT_SELECTOR(unit_selector->gobj()) );
setValue(adj, sp_pixels_get_units (val, *unit));
@@ -1886,7 +1894,7 @@ float Export::getValuePx( Gtk::Adjustment *adj )
#endif
{
float value = getValue( adj);
- const SPUnit *unit = sp_unit_selector_get_unit ((SPUnitSelector *)unit_selector->gobj());
+ const SPUnit *unit = sp_unit_selector_get_unit(SP_UNIT_SELECTOR(unit_selector->gobj()));
return sp_units_get_pixels (value, *unit);
} // end of sp_export_value_get_px()
diff --git a/src/ui/dialog/filedialog.cpp b/src/ui/dialog/filedialog.cpp
index 47ba6c748..b3af6fc00 100644
--- a/src/ui/dialog/filedialog.cpp
+++ b/src/ui/dialog/filedialog.cpp
@@ -152,6 +152,9 @@ Glib::ustring FileSaveDialog::getDocTitle()
void FileSaveDialog::appendExtension(Glib::ustring& path, Inkscape::Extension::Output* outputExtension)
{
+ if (!outputExtension)
+ return;
+
try {
bool appendExtension = true;
Glib::ustring utf8Name = Glib::filename_to_utf8( path );
diff --git a/src/ui/dialog/filedialog.h b/src/ui/dialog/filedialog.h
index 6a3436aea..63cee6bdc 100644
--- a/src/ui/dialog/filedialog.h
+++ b/src/ui/dialog/filedialog.h
@@ -208,6 +208,8 @@ public:
virtual Glib::ustring getCurrentDirectory() = 0;
+ virtual void addFileType(Glib::ustring name, Glib::ustring pattern) = 0;
+
protected:
/**
diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp
index 8c2a7e056..90d9855ec 100644
--- a/src/ui/dialog/filedialogimpl-gtkmm.cpp
+++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp
@@ -1047,7 +1047,9 @@ FileSaveDialogImplGtk::FileSaveDialogImplGtk( Gtk::Window &parentWindow,
fileTypeCheckbox.set_active(prefs->getBool("/dialogs/save_as/append_extension", true));
}
- createFileTypeMenu();
+ if (_dialogType != CUSTOM_TYPE)
+ createFileTypeMenu();
+
fileTypeComboBox.set_size_request(200,40);
fileTypeComboBox.signal_changed().connect(
sigc::mem_fun(*this, &FileSaveDialogImplGtk::fileTypeChangedCallback) );
@@ -1174,7 +1176,24 @@ void FileSaveDialogImplGtk::fileTypeChangedCallback()
updateNameAndExtension();
}
+void FileSaveDialogImplGtk::addFileType(Glib::ustring name, Glib::ustring pattern)
+{
+ //#Let user choose
+ FileType guessType;
+ guessType.name = name;
+ guessType.pattern = pattern;
+ guessType.extension = NULL;
+ #if WITH_GTKMM_2_24
+ fileTypeComboBox.append(guessType.name);
+ #else
+ fileTypeComboBox.append_text(guessType.name);
+ #endif
+ fileTypes.push_back(guessType);
+
+ fileTypeComboBox.set_active(0);
+ fileTypeChangedCallback(); //call at least once to set the filter
+}
void FileSaveDialogImplGtk::createFileTypeMenu()
{
diff --git a/src/ui/dialog/filedialogimpl-gtkmm.h b/src/ui/dialog/filedialogimpl-gtkmm.h
index 02841a082..7501b5e14 100644
--- a/src/ui/dialog/filedialogimpl-gtkmm.h
+++ b/src/ui/dialog/filedialogimpl-gtkmm.h
@@ -291,6 +291,7 @@ public:
virtual void setSelectionType( Inkscape::Extension::Extension * key );
Glib::ustring getCurrentDirectory();
+ void addFileType(Glib::ustring name, Glib::ustring pattern);
private:
//void change_title(const Glib::ustring& title);
diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp
index 5891f25ac..6425d9fee 100644
--- a/src/ui/dialog/filedialogimpl-win32.cpp
+++ b/src/ui/dialog/filedialogimpl-win32.cpp
@@ -188,7 +188,8 @@ FileOpenDialogImplWin32::FileOpenDialogImplWin32(Gtk::Window &parent,
_mutex = NULL;
- createFilterMenu();
+ if (dialogType != CUSTOM_TYPE)
+ createFilterMenu();
}
@@ -1748,6 +1749,72 @@ void FileSaveDialogImplWin32::createFilterMenu()
_filter_index = 1; // A value of 1 selects the 1st filter - NOT the 2nd
}
+
+void FileSaveDialogImplWin32::addFileType(Glib::ustring name, Glib::ustring pattern)
+{
+ list<Filter> filter_list;
+
+ knownExtensions.clear();
+
+ int extension_index = 0;
+ int filter_length = 1;
+
+ ustring all_exe_files_filter = pattern;
+ Filter all_exe_files;
+
+ const gchar *all_exe_files_filter_name = name.data();
+
+ // Calculate the amount of memory required
+ int filter_count = 1;
+
+
+ // Filter Executable Files
+ all_exe_files.name = g_utf8_to_utf16(all_exe_files_filter_name,
+ -1, NULL, &all_exe_files.name_length, NULL);
+ all_exe_files.filter = g_utf8_to_utf16(all_exe_files_filter.data(),
+ -1, NULL, &all_exe_files.filter_length, NULL);
+ all_exe_files.mod = NULL;
+ filter_list.push_front(all_exe_files);
+
+ knownExtensions.insert( Glib::ustring(all_exe_files_filter).casefold() );
+
+ _extension_map = new Inkscape::Extension::Extension*[filter_count];
+
+ _filter = new wchar_t[filter_length];
+ wchar_t *filterptr = _filter;
+
+ for(list<Filter>::iterator filter_iterator = filter_list.begin();
+ filter_iterator != filter_list.end(); ++filter_iterator)
+ {
+ const Filter &filter = *filter_iterator;
+
+ wcsncpy(filterptr, (wchar_t*)filter.name, filter.name_length);
+ filterptr += filter.name_length;
+ g_free(filter.name);
+
+ *(filterptr++) = L'\0';
+ *(filterptr++) = L'*';
+
+ if(filter.filter != NULL)
+ {
+ wcsncpy(filterptr, (wchar_t*)filter.filter, filter.filter_length);
+ filterptr += filter.filter_length;
+ g_free(filter.filter);
+ }
+
+ *(filterptr++) = L'\0';
+
+ // Associate this input extension with the file type name
+ _extension_map[extension_index++] = filter.mod;
+ }
+ *(filterptr++) = L'\0';
+
+ _filter_count = extension_index;
+ _filter_index = 1; // Select the 1st filter in the list
+
+
+}
+
void FileSaveDialogImplWin32::GetSaveFileName_thread()
{
OPENFILENAMEEXW ofn;
@@ -1814,7 +1881,7 @@ FileSaveDialogImplWin32::show()
if(Glib::Thread::create(sigc::mem_fun(*this, &FileSaveDialogImplWin32::GetSaveFileName_thread), true))
g_main_loop_run(_main_loop);
- if(_result)
+ if(_result && _extension)
appendExtension(myFilename, (Inkscape::Extension::Output*)_extension);
}
@@ -1827,6 +1894,7 @@ void FileSaveDialogImplWin32::setSelectionType( Inkscape::Extension::Extension *
}
+
UINT_PTR CALLBACK FileSaveDialogImplWin32::GetSaveFileName_hookproc(
HWND hdlg, UINT uiMsg, WPARAM, LPARAM lParam)
{
diff --git a/src/ui/dialog/filedialogimpl-win32.h b/src/ui/dialog/filedialogimpl-win32.h
index d016b0a24..15953f9d8 100644
--- a/src/ui/dialog/filedialogimpl-win32.h
+++ b/src/ui/dialog/filedialogimpl-win32.h
@@ -343,6 +343,8 @@ public:
virtual void setSelectionType( Inkscape::Extension::Extension *key );
+ virtual void addFileType(Glib::ustring name, Glib::ustring pattern);
+
private:
/// A handle to the title label and edit box
HWND _title_label;
diff --git a/src/ui/dialog/fill-and-stroke.cpp b/src/ui/dialog/fill-and-stroke.cpp
index c7efd3bf2..5ba4e7e39 100644
--- a/src/ui/dialog/fill-and-stroke.cpp
+++ b/src/ui/dialog/fill-and-stroke.cpp
@@ -22,6 +22,7 @@
#include "filter-chemistry.h"
#include "inkscape.h"
#include "selection.h"
+#include "preferences.h"
#include "style.h"
#include "svg/css-ostringstream.h"
#include "ui/icon-names.h"
@@ -59,6 +60,8 @@ FillAndStroke::FillAndStroke()
_notebook.append_page(_page_stroke_paint, _createPageTabLabel(_("Stroke _paint"), INKSCAPE_ICON("object-stroke")));
_notebook.append_page(_page_stroke_style, _createPageTabLabel(_("Stroke st_yle"), INKSCAPE_ICON("object-stroke-style")));
+ _notebook.signal_switch_page().connect(sigc::mem_fun(this, &FillAndStroke::_onSwitchPage));
+
_layoutPageFill();
_layoutPageStrokePaint();
_layoutPageStrokeStyle();
@@ -105,6 +108,23 @@ void FillAndStroke::setTargetDesktop(SPDesktop *desktop)
}
}
+#if WITH_GTKMM_3_0
+void FillAndStroke::_onSwitchPage(Gtk::Widget * /*page*/, guint pagenum)
+#else
+void FillAndStroke::_onSwitchPage(GtkNotebookPage * /*page*/, guint pagenum)
+#endif
+{
+ _savePagePref(pagenum);
+}
+
+void
+FillAndStroke::_savePagePref(guint page_num)
+{
+ // remember the current page
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ prefs->setInt("/dialogs/fillstroke/page", page_num);
+}
+
void
FillAndStroke::_layoutPageFill()
{
@@ -133,6 +153,8 @@ FillAndStroke::showPageFill()
{
present();
_notebook.set_current_page(0);
+ _savePagePref(0);
+
}
void
@@ -140,6 +162,7 @@ FillAndStroke::showPageStrokePaint()
{
present();
_notebook.set_current_page(1);
+ _savePagePref(1);
}
void
@@ -147,6 +170,8 @@ FillAndStroke::showPageStrokeStyle()
{
present();
_notebook.set_current_page(2);
+ _savePagePref(2);
+
}
Gtk::HBox&
diff --git a/src/ui/dialog/fill-and-stroke.h b/src/ui/dialog/fill-and-stroke.h
index 596205c58..255cea89a 100644
--- a/src/ui/dialog/fill-and-stroke.h
+++ b/src/ui/dialog/fill-and-stroke.h
@@ -60,6 +60,12 @@ protected:
void _layoutPageFill();
void _layoutPageStrokePaint();
void _layoutPageStrokeStyle();
+ void _savePagePref(guint page_num);
+#if WITH_GTKMM_3_0
+ void _onSwitchPage(Gtk::Widget *page, guint pagenum);
+#else
+ void _onSwitchPage(GtkNotebookPage *page, guint pagenum);
+#endif
private:
FillAndStroke(FillAndStroke const &d);
diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp
index 6fab4c504..b00dd042f 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 "selection-chemistry.h"
#include <gtkmm/checkbutton.h>
#include <gtkmm/colorbutton.h>
@@ -1327,7 +1328,7 @@ void FilterEffectsDialog::FilterModifier::update_filters()
for(const GSList *l = filters; l; l = l->next) {
Gtk::TreeModel::Row row = *_model->append();
- SPFilter* f = (SPFilter*)l->data;
+ SPFilter* f = SP_FILTER(l->data);
row[_columns.filter] = f;
const gchar* lbl = f->label();
const gchar* id = f->getId();
@@ -1398,6 +1399,29 @@ void FilterEffectsDialog::FilterModifier::remove_filter()
if(filter) {
SPDocument* doc = filter->document;
+ // Delete all references to this filter
+ GSList *all = get_all_items(NULL, _desktop->currentRoot(), _desktop, false, false, true, NULL);
+ for (GSList *i = all; i != NULL; i = i->next) {
+ if (!SP_IS_ITEM(i->data)) {
+ continue;
+ }
+ SPItem *item = SP_ITEM(i->data);
+ if (!item->style) {
+ continue;
+ }
+
+ const SPIFilter *ifilter = &(item->style->filter);
+ if (ifilter && ifilter->href) {
+ const SPObject *obj = ifilter->href->getObject();
+ if (obj && obj == (SPObject *)filter) {
+ ::remove_filter(item, false);
+ }
+ }
+ }
+ if (all) {
+ g_slist_free(all);
+ }
+
//XML Tree being used directly here while it shouldn't be.
sp_repr_unparent(filter->getRepr());
@@ -1454,7 +1478,7 @@ void FilterEffectsDialog::CellRendererConnection::get_size_vfunc(
if(height) {
// Scale the height depending on the number of inputs, unless it's
// the first primitive, in which case there are no connections
- SPFilterPrimitive* prim = (SPFilterPrimitive*)_primitive.get_value();
+ SPFilterPrimitive* prim = SP_FILTER_PRIMITIVE(_primitive.get_value());
(*height) = size * input_count(prim);
}
}
@@ -1536,11 +1560,10 @@ void FilterEffectsDialog::PrimitiveList::update()
{
SPFilter* f = _dialog._filter_modifier.get_selected_filter();
const SPFilterPrimitive* active_prim = get_selected();
- bool active_found = false;
-
_model->clear();
if(f) {
+ bool active_found = false;
_dialog._primitive_box.set_sensitive(true);
_dialog.update_filter_general_settings_view();
for(SPObject *prim_obj = f->children;
diff --git a/src/ui/dialog/font-substitution.cpp b/src/ui/dialog/font-substitution.cpp
index d449bad67..24588946e 100644
--- a/src/ui/dialog/font-substitution.cpp
+++ b/src/ui/dialog/font-substitution.cpp
@@ -207,7 +207,7 @@ GSList * FontSubstitution::getFontReplacedItems(SPDocument* doc, Glib::ustring *
// Check if any document styles are not in the actual layout
std::map<SPItem *, Glib::ustring>::const_iterator mapIter;
- for (mapIter = mapFontStyles.begin(); mapIter != mapFontStyles.end(); mapIter++) {
+ for (mapIter = mapFontStyles.begin(); mapIter != mapFontStyles.end(); ++mapIter) {
SPItem *item = mapIter->first;
Glib::ustring fonts = mapIter->second;
@@ -241,7 +241,7 @@ GSList * FontSubstitution::getFontReplacedItems(SPDocument* doc, Glib::ustring *
}
std::set<Glib::ustring>::const_iterator setIter;
- for (setIter = setErrors.begin(); setIter != setErrors.end(); setIter++) {
+ for (setIter = setErrors.begin(); setIter != setErrors.end(); ++setIter) {
Glib::ustring err = (*setIter);
out->append(err + "\n");
g_warning("%s", err.c_str());
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp
index 2731b6174..03366a0c3 100644
--- a/src/ui/dialog/inkscape-preferences.cpp
+++ b/src/ui/dialog/inkscape-preferences.cpp
@@ -47,7 +47,11 @@
#include "display/canvas-grid.h"
#include "path-prefix.h"
#include "io/resource.h"
+#include "io/sys.h"
#include "inkscape.h"
+#include "shortcuts.h"
+#include "document.h"
+
#ifdef HAVE_ASPELL
# include <aspell.h>
@@ -137,6 +141,7 @@ InkscapePreferences::InkscapePreferences()
initPageRendering();
initPageSpellcheck();
+
signalPresent().connect(sigc::mem_fun(*this, &InkscapePreferences::_presentPages));
//calculate the size request for this dialog
@@ -741,6 +746,8 @@ void InkscapePreferences::initPageUI()
_grids_axonom.add_line( false, _("Major grid line every:"), _grids_axonom_empspacing, "", "", false);
this->AddPage(_page_grids, _("Grids"), iter_ui, PREFS_PAGE_UI_GRIDS);
+
+ initKeyboardShortcuts(iter_ui);
}
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
@@ -1405,6 +1412,316 @@ void InkscapePreferences::initPageBitmaps()
this->AddPage(_page_bitmaps, _("Bitmaps"), PREFS_PAGE_BITMAPS);
}
+void InkscapePreferences::initKeyboardShortcuts(Gtk::TreeModel::iterator iter_ui)
+{
+ std::vector<Glib::ustring> fileNames;
+ std::vector<Glib::ustring> fileLabels;
+
+ sp_shortcut_get_file_names(&fileLabels, &fileNames);
+
+ _kb_filelist.init( "/options/kbshortcuts/shortcutfile", &fileLabels[0], &fileNames[0], fileLabels.size(), fileNames[0]);
+
+ Glib::ustring tooltip(_("Select a file of predefined shortcuts to use. Any customized shortcuts you create will be added seperately to "));
+ tooltip += Glib::ustring(IO::Resource::get_path(IO::Resource::USER, IO::Resource::KEYS, "default.xml"));
+
+ _page_keyshortcuts.add_line( false, _("Shortcut file:"), _kb_filelist, "", tooltip.c_str(), false);
+
+ _kb_search.init("/options/kbshortcuts/value", true);
+ _page_keyshortcuts.add_line( false, _("Search:"), _kb_search, "", "", true);
+
+ _kb_store = Gtk::TreeStore::create( _kb_columns );
+ _kb_store->set_sort_column (_kb_columns.id, Gtk::SORT_ASCENDING );
+
+ _kb_filter = Gtk::TreeModelFilter::create(_kb_store);
+ _kb_filter->set_visible_func (sigc::mem_fun(*this, &InkscapePreferences::onKBSearchFilter));
+
+ _kb_shortcut_renderer.property_editable() = true;
+
+ _kb_tree.set_model(_kb_filter);
+ _kb_tree.append_column(_("Name"), _kb_columns.name);
+ _kb_tree.append_column(_("Shortcut"), _kb_shortcut_renderer);
+ _kb_tree.append_column(_("Description"), _kb_columns.description);
+ _kb_tree.append_column(_("ID"), _kb_columns.id);
+
+ _kb_tree.set_expander_column(*_kb_tree.get_column(0));
+
+ _kb_tree.get_column(0)->set_resizable(true);
+ _kb_tree.get_column(0)->set_clickable(true);
+ _kb_tree.get_column(0)->set_fixed_width (200);
+
+ _kb_tree.get_column(1)->set_resizable(true);
+ _kb_tree.get_column(1)->set_clickable(true);
+ _kb_tree.get_column(1)->set_fixed_width (150);
+ //_kb_tree.get_column(1)->add_attribute(_kb_shortcut_renderer.property_text(), _kb_columns.shortcut);
+ _kb_tree.get_column(1)->set_cell_data_func(_kb_shortcut_renderer, sigc::ptr_fun(InkscapePreferences::onKBShortcutRenderer));
+
+ _kb_tree.get_column(2)->set_resizable(true);
+ _kb_tree.get_column(2)->set_clickable(true);
+
+ _kb_tree.get_column(3)->set_resizable(true);
+ _kb_tree.get_column(3)->set_clickable(true);
+
+ _kb_shortcut_renderer.signal_accel_edited().connect( sigc::mem_fun(*this, &InkscapePreferences::onKBTreeEdited) );
+ _kb_shortcut_renderer.signal_accel_cleared().connect( sigc::mem_fun(*this, &InkscapePreferences::onKBTreeCleared) );
+
+ Gtk::ScrolledWindow* scroller = new Gtk::ScrolledWindow();
+ scroller->add(_kb_tree);
+
+ int row = 3;
+ _page_keyshortcuts.attach(*scroller, 0, 2, row, row+1, Gtk::EXPAND | Gtk::FILL, Gtk::EXPAND | Gtk::FILL);
+ row++;
+
+ Gtk::HButtonBox *box_buttons = manage (new Gtk::HButtonBox);
+ box_buttons->set_layout(Gtk::BUTTONBOX_END);
+ box_buttons->set_spacing(4);
+ _page_keyshortcuts.attach(*box_buttons, 0, 3, row, row+1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
+
+ UI::Widget::Button *kb_reset = manage(new UI::Widget::Button(_("Reset"), _("Remove all your customized keyboard shortcuts, and revert to the shortcuts in the shortcut file listed above")));
+ box_buttons->pack_start(*kb_reset, true, true, 6);
+ box_buttons->set_child_secondary(*kb_reset);
+
+ UI::Widget::Button *kb_import = manage(new UI::Widget::Button(_("Import ..."), _("Import custom keyboard shortcuts from a file")));
+ box_buttons->pack_end(*kb_import, true, true, 6);
+
+ UI::Widget::Button *kb_export = manage(new UI::Widget::Button(_("Export ..."), _("Export custom keyboard shortcuts to a file")));
+ box_buttons->pack_end(*kb_export, true, true, 6);
+
+ kb_reset->signal_clicked().connect( sigc::mem_fun(*this, &InkscapePreferences::onKBReset) );
+ kb_import->signal_clicked().connect( sigc::mem_fun(*this, &InkscapePreferences::onKBImport) );
+ kb_export->signal_clicked().connect( sigc::mem_fun(*this, &InkscapePreferences::onKBExport) );
+ _kb_search.signal_key_release_event().connect( sigc::mem_fun(*this, &InkscapePreferences::onKBSearchKeyEvent) );
+ _kb_filelist.signal_changed().connect( sigc::mem_fun(*this, &InkscapePreferences::onKBList) );
+ _page_keyshortcuts.signal_realize().connect( sigc::mem_fun(*this, &InkscapePreferences::onKBRealize) );
+
+ this->AddPage(_page_keyshortcuts, _("Keyboard Shortcuts"), iter_ui, PREFS_PAGE_UI_KEYBOARD_SHORTCUTS);
+
+ _kb_shortcuts_loaded = false;
+ Gtk::TreeStore::iterator iter_group = _kb_store->append();
+ (*iter_group)[_kb_columns.name] = "Loading ...";
+ (*iter_group)[_kb_columns.shortcut] = "";
+ (*iter_group)[_kb_columns.id] = "";
+ (*iter_group)[_kb_columns.description] = "";
+ (*iter_group)[_kb_columns.shortcutid] = 0;
+ (*iter_group)[_kb_columns.user_set] = 0;
+
+}
+
+void InkscapePreferences::onKBList()
+{
+ sp_shortcut_init();
+ onKBListKeyboardShortcuts();
+}
+
+void InkscapePreferences::onKBReset()
+{
+ sp_shortcuts_delete_all_from_file();
+ sp_shortcut_init();
+ onKBListKeyboardShortcuts();
+}
+
+void InkscapePreferences::onKBImport()
+{
+ if (sp_shortcut_file_import()) {
+ onKBListKeyboardShortcuts();
+ }
+}
+
+void InkscapePreferences::onKBExport()
+{
+ sp_shortcut_file_export();
+}
+
+bool InkscapePreferences::onKBSearchKeyEvent(GdkEventKey *event)
+{
+ _kb_filter->refilter();
+ return FALSE;
+}
+
+void InkscapePreferences::onKBTreeCleared(const Glib::ustring& path)
+{
+ Gtk::TreeModel::iterator iter = _kb_filter->get_iter(path);
+ Glib::ustring id = (*iter)[_kb_columns.id];
+ unsigned int const current_shortcut_id = (*iter)[_kb_columns.shortcutid];
+
+ // Remove current shortcut from file
+ sp_shortcut_delete_from_file(id.c_str(), current_shortcut_id);
+
+ sp_shortcut_init();
+ onKBListKeyboardShortcuts();
+
+}
+
+void InkscapePreferences::onKBTreeEdited (const Glib::ustring& path, guint accel_key, Gdk::ModifierType accel_mods, guint hardware_keycode)
+{
+ Gtk::TreeModel::iterator iter = _kb_filter->get_iter(path);
+
+ Glib::ustring id = (*iter)[_kb_columns.id];
+ Glib::ustring current_shortcut = (*iter)[_kb_columns.shortcut];
+ unsigned int const current_shortcut_id = (*iter)[_kb_columns.shortcutid];
+
+ Inkscape::Verb *const verb = Inkscape::Verb::getbyid(id.c_str());
+ if (!verb) {
+ return;
+ }
+
+ unsigned int const new_shortcut_id = sp_gdkmodifier_to_shortcut(accel_key, accel_mods, hardware_keycode);
+ if (new_shortcut_id) {
+
+ // Delete current shortcut if it existed
+ sp_shortcut_delete_from_file(id.c_str(), current_shortcut_id);
+ // Delete any references to the new shortcut
+ sp_shortcut_delete_from_file(id.c_str(), new_shortcut_id);
+ // Add the new shortcut
+ sp_shortcut_add_to_file(id.c_str(), new_shortcut_id);
+
+ sp_shortcut_init();
+ onKBListKeyboardShortcuts();
+ }
+}
+
+bool InkscapePreferences::onKBSearchFilter(const Gtk::TreeModel::const_iterator& iter)
+{
+ Glib::ustring search = _kb_search.get_text().lowercase();
+ if (search.empty()) {
+ return TRUE;
+ }
+
+ Glib::ustring name = (*iter)[_kb_columns.name];
+ Glib::ustring desc = (*iter)[_kb_columns.description];
+ Glib::ustring shortcut = (*iter)[_kb_columns.shortcut];
+ Glib::ustring id = (*iter)[_kb_columns.id];
+
+ if (id.empty()) {
+ return TRUE; // Keep all group nodes visible
+ }
+
+ return (name.lowercase().find(search) != name.npos
+ || shortcut.lowercase().find(search) != name.npos
+ || desc.lowercase().find(search) != name.npos
+ || id.lowercase().find(search) != name.npos);
+}
+
+void InkscapePreferences::onKBRealize()
+{
+ if (!_kb_shortcuts_loaded /*&& _current_page == &_page_keyshortcuts*/) {
+ _kb_shortcuts_loaded = true;
+ onKBListKeyboardShortcuts();
+ }
+}
+
+InkscapePreferences::ModelColumns &InkscapePreferences::onKBGetCols()
+{
+ static InkscapePreferences::ModelColumns cols;
+ return cols;
+}
+
+void InkscapePreferences::onKBShortcutRenderer(Gtk::CellRenderer *renderer, Gtk::TreeIter const &iter) {
+
+ Glib::ustring shortcut = (*iter)[onKBGetCols().shortcut];
+ unsigned int user_set = (*iter)[onKBGetCols().user_set];
+ Gtk::CellRendererAccel *accel = dynamic_cast<Gtk::CellRendererAccel *>(renderer);
+ if (user_set) {
+ accel->property_markup() = Glib::ustring("<span foreground=\"blue\"> " + shortcut + " </span>").c_str();
+ } else {
+ accel->property_markup() = Glib::ustring("<span> " + shortcut + " </span>").c_str();
+ }
+}
+
+void InkscapePreferences::onKBListKeyboardShortcuts()
+{
+ // Save the current selection
+ Gtk::TreeStore::iterator iter = _kb_tree.get_selection()->get_selected();
+ Glib::ustring selected_id = "";
+ if (iter) {
+ selected_id = (*iter)[_kb_columns.id];
+ }
+
+ _kb_store->clear();
+
+ std::vector<Verb *>verbs = Inkscape::Verb::getList();
+
+ for (unsigned int i = 0; i < verbs.size(); i++) {
+
+ Inkscape::Verb* verb = verbs[i];
+ if (!verb) {
+ continue;
+ }
+ if (!verb->get_name()){
+ continue;
+ }
+
+ Gtk::TreeStore::Path path;
+ if (_kb_store->iter_is_valid(_kb_store->get_iter("0"))) {
+ path = _kb_store->get_path(_kb_store->get_iter("0"));
+ }
+
+ // Find this group in the tree
+ Glib::ustring group = verb->get_group() ? verb->get_group() : "Misc";
+ Gtk::TreeStore::iterator iter_group;
+ bool found = false;
+ while (path) {
+ iter_group = _kb_store->get_iter(path);
+ if (!_kb_store->iter_is_valid(iter_group)) {
+ break;
+ }
+ Glib::ustring name = (*iter_group)[_kb_columns.name];
+ if ((*iter_group)[_kb_columns.name] == group) {
+ found = true;
+ break;
+ }
+ path.next();
+ }
+
+ if (!found) {
+ // Add the group if not there
+ iter_group = _kb_store->append();
+ (*iter_group)[_kb_columns.name] = group;
+ (*iter_group)[_kb_columns.shortcut] = "";
+ (*iter_group)[_kb_columns.id] = "";
+ (*iter_group)[_kb_columns.description] = "";
+ (*iter_group)[_kb_columns.shortcutid] = 0;
+ (*iter_group)[_kb_columns.user_set] = 0;
+ }
+
+ // Remove the key accelerators from the verb name
+ Glib::ustring name = verb->get_name();
+ std::string::size_type k = 0;
+ while((k=name.find('_',k))!=name.npos) {
+ name.erase(k, 1);
+ }
+
+ // Get the shortcut label
+ unsigned int shortcut_id = sp_shortcut_get_primary(verb);
+ Glib::ustring shortcut_label = "";
+ if (shortcut_id != GDK_KEY_VoidSymbol) {
+ gchar* str = sp_shortcut_get_label(shortcut_id);
+ if (str) {
+ shortcut_label = str;
+ g_free(str);
+ str = 0;
+ }
+ }
+ // Add the verb to the group
+ Gtk::TreeStore::iterator row = _kb_store->append(iter_group->children());
+ (*row)[_kb_columns.name] = name;
+ (*row)[_kb_columns.shortcut] = shortcut_label;
+ (*row)[_kb_columns.description] = verb->get_short_tip() ? verb->get_short_tip() : "";
+ (*row)[_kb_columns.shortcutid] = shortcut_id;
+ (*row)[_kb_columns.id] = verb->get_id();
+ (*row)[_kb_columns.user_set] = sp_shortcut_is_user_set(verb);
+
+ if (selected_id == verb->get_id()) {
+ Gtk::TreeStore::Path sel_path = _kb_filter->convert_child_path_to_path(_kb_store->get_path(row));
+ _kb_tree.expand_to_path(sel_path);
+ _kb_tree.get_selection()->select(sel_path);
+ }
+ }
+
+ if (selected_id.empty()) {
+ _kb_tree.expand_to_path(_kb_store->get_path(_kb_store->get_iter("0:1")));
+ }
+
+}
void InkscapePreferences::initPageSpellcheck()
{
@@ -1609,7 +1926,7 @@ bool InkscapePreferences::PresentPage(const Gtk::TreeModel::iterator& iter)
_page_list.expand_row(_path_tools, false);
if (desired_page >= PREFS_PAGE_TOOLS_SHAPES && desired_page <= PREFS_PAGE_TOOLS_SHAPES_SPIRAL)
_page_list.expand_row(_path_shapes, false);
- if (desired_page >= PREFS_PAGE_UI && desired_page <= PREFS_PAGE_UI_GRIDS)
+ if (desired_page >= PREFS_PAGE_UI && desired_page <= PREFS_PAGE_UI_KEYBOARD_SHORTCUTS)
_page_list.expand_row(_path_ui, false);
if (desired_page >= PREFS_PAGE_BEHAVIOR && desired_page <= PREFS_PAGE_BEHAVIOR_MASKS)
_page_list.expand_row(_path_behavior, false);
diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h
index d60035515..690016556 100644
--- a/src/ui/dialog/inkscape-preferences.h
+++ b/src/ui/dialog/inkscape-preferences.h
@@ -18,15 +18,19 @@
#include <iostream>
#include <vector>
#include "ui/widget/preferences-widget.h"
+#include "ui/widget/button.h"
+#include <stddef.h>
#include <gtkmm/colorbutton.h>
#include <gtkmm/comboboxtext.h>
#include <gtkmm/treestore.h>
#include <gtkmm/treeview.h>
#include <gtkmm/frame.h>
#include <gtkmm/notebook.h>
-#include <stddef.h>
#include <gtkmm/textview.h>
#include <gtkmm/scrolledwindow.h>
+#include <gtkmm/liststore.h>
+#include <gtkmm/treemodel.h>
+#include <gtkmm/treemodelfilter.h>
#include "ui/widget/panel.h"
@@ -60,6 +64,7 @@ enum {
PREFS_PAGE_UI,
PREFS_PAGE_UI_WINDOWS,
PREFS_PAGE_UI_GRIDS,
+ PREFS_PAGE_UI_KEYBOARD_SHORTCUTS,
PREFS_PAGE_BEHAVIOR,
PREFS_PAGE_BEHAVIOR_SELECTING,
PREFS_PAGE_BEHAVIOR_TRANSFORMS,
@@ -79,6 +84,7 @@ enum {
PREFS_PAGE_BITMAPS,
PREFS_PAGE_RENDERING,
PREFS_PAGE_SPELLCHECK
+
};
namespace Inkscape {
@@ -166,6 +172,8 @@ protected:
UI::Widget::DialogPage _page_bitmaps;
UI::Widget::DialogPage _page_spellcheck;
+ UI::Widget::DialogPage _page_keyshortcuts;
+
UI::Widget::PrefSpinButton _mouse_sens;
UI::Widget::PrefSpinButton _mouse_thres;
UI::Widget::PrefSlider _mouse_grabsize;
@@ -337,12 +345,16 @@ protected:
UI::Widget::PrefCheckButton _spell_ignorenumbers;
UI::Widget::PrefCheckButton _spell_ignoreallcaps;
+
UI::Widget::PrefCombo _misc_overs_bitmap;
UI::Widget::PrefEntryFileButtonHBox _misc_bitmap_editor;
UI::Widget::PrefCheckButton _misc_bitmap_autoreload;
UI::Widget::PrefSpinButton _bitmap_copy_res;
UI::Widget::PrefCombo _bitmap_import;
+ UI::Widget::PrefEntry _kb_search;
+ UI::Widget::PrefCombo _kb_filelist;
+
UI::Widget::PrefCheckButton _save_use_current_dir;
UI::Widget::PrefCheckButton _save_autosave_enable;
UI::Widget::PrefSpinButton _save_autosave_interval;
@@ -411,6 +423,37 @@ protected:
UI::Widget::PrefEntry _importexport_ocal_username;
UI::Widget::PrefEntry _importexport_ocal_password;
+ /*
+ * Keyboard shortcut members
+ */
+ class ModelColumns: public Gtk::TreeModel::ColumnRecord {
+ public:
+ ModelColumns() {
+ add(name);
+ add(id);
+ add(shortcut);
+ add(description);
+ add(shortcutid);
+ add(user_set);
+ }
+ virtual ~ModelColumns() {
+ }
+
+ Gtk::TreeModelColumn<Glib::ustring> name;
+ Gtk::TreeModelColumn<Glib::ustring> id;
+ Gtk::TreeModelColumn<Glib::ustring> shortcut;
+ Gtk::TreeModelColumn<Glib::ustring> description;
+ Gtk::TreeModelColumn<unsigned int> shortcutid;
+ Gtk::TreeModelColumn<unsigned int> user_set;
+ };
+ ModelColumns _kb_columns;
+ static ModelColumns &onKBGetCols();
+ Glib::RefPtr<Gtk::TreeStore> _kb_store;
+ Gtk::TreeView _kb_tree;
+ Gtk::CellRendererAccel _kb_shortcut_renderer;
+ Glib::RefPtr<Gtk::TreeModelFilter> _kb_filter;
+ gboolean _kb_shortcuts_loaded;
+
int _max_dialog_width;
int _max_dialog_height;
int _sb_width;
@@ -441,9 +484,26 @@ protected:
void initPageBitmaps();
void initPageSystem();
void initPageI18n(); // Do we still need it?
+ void initKeyboardShortcuts(Gtk::TreeModel::iterator iter_ui);
void _presentPages();
+ /*
+ * Functions for the Keyboard shortcut editor panel
+ */
+ void onKBReset();
+ void onKBImport();
+ void onKBExport();
+ void onKBList();
+ void onKBRealize();
+ void onKBListKeyboardShortcuts();
+ void onKBTreeEdited (const Glib::ustring& path, guint accel_key, Gdk::ModifierType accel_mods, guint hardware_keycode);
+ void onKBTreeCleared(const Glib::ustring& path_string);
+ bool onKBSearchKeyEvent(GdkEventKey *event);
+ bool onKBSearchFilter(const Gtk::TreeModel::const_iterator& iter);
+ static void onKBShortcutRenderer(Gtk::CellRenderer *rndr, Gtk::TreeIter const &iter);
+
+
private:
InkscapePreferences();
InkscapePreferences(InkscapePreferences const &d);
diff --git a/src/ui/dialog/layer-properties.cpp b/src/ui/dialog/layer-properties.cpp
index 4f9edf774..245dac5e0 100644
--- a/src/ui/dialog/layer-properties.cpp
+++ b/src/ui/dialog/layer-properties.cpp
@@ -216,7 +216,7 @@ LayerPropertiesDialog::_setup_layers_controls() {
if ( root ) {
SPObject* target = _desktop->currentLayer();
_store->clear();
- _addLayer( document, (SPObject *)root, 0, target, 0 );
+ _addLayer( document, SP_OBJECT(root), 0, target, 0 );
}
_layout_table.remove(_layer_name_entry);
diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp
index f851f72c1..4f7b8f27c 100644
--- a/src/ui/dialog/layers.cpp
+++ b/src/ui/dialog/layers.cpp
@@ -558,7 +558,8 @@ bool LayersPanel::_handleKeyEvent(GdkEventKey *event)
}
return false;
}
-void LayersPanel::_handleButtonEvent(GdkEventButton* event)
+
+bool LayersPanel::_handleButtonEvent(GdkEventButton* event)
{
static unsigned doubleclick = 0;
@@ -573,9 +574,9 @@ void LayersPanel::_handleButtonEvent(GdkEventButton* event)
}
}
- if ( event->type == GDK_BUTTON_RELEASE && (event->button == 1)
- && (event->state & GDK_SHIFT_MASK)) {
- // Shift left click on the visible/lock columns toggles "solo" mode
+ if ( (event->type == GDK_BUTTON_PRESS) && (event->button == 1)
+ && (event->state & GDK_MOD1_MASK)) {
+ // Alt left click on the visible/lock columns - eat this event to keep row selection
Gtk::TreeModel::Path path;
Gtk::TreeViewColumn* col = 0;
int x = static_cast<int>(event->x);
@@ -583,10 +584,45 @@ void LayersPanel::_handleButtonEvent(GdkEventButton* event)
int x2 = 0;
int y2 = 0;
if ( _tree.get_path_at_pos( x, y, path, col, x2, y2 ) ) {
- if (col == _tree.get_column(COL_VISIBLE-1)) {
- _takeAction(BUTTON_SOLO);
- } else if (col == _tree.get_column(COL_LOCKED-1)) {
- _takeAction(BUTTON_LOCK_OTHERS);
+ if (col == _tree.get_column(COL_VISIBLE-1) ||
+ col == _tree.get_column(COL_LOCKED-1)) {
+ return true;
+ }
+ }
+ }
+
+ // TODO - ImageToggler doesn't seem to handle Shift/Alt clicks - so we deal with them here.
+ if ( (event->type == GDK_BUTTON_RELEASE) && (event->button == 1)
+ && (event->state & (GDK_SHIFT_MASK | GDK_MOD1_MASK))) {
+
+ Gtk::TreeModel::Path path;
+ Gtk::TreeViewColumn* col = 0;
+ int x = static_cast<int>(event->x);
+ int y = static_cast<int>(event->y);
+ int x2 = 0;
+ int y2 = 0;
+ if ( _tree.get_path_at_pos( x, y, path, col, x2, y2 ) ) {
+ if (event->state & GDK_SHIFT_MASK) {
+ // Shift left click on the visible/lock columns toggles "solo" mode
+ if (col == _tree.get_column(COL_VISIBLE - 1)) {
+ _takeAction(BUTTON_SOLO);
+ } else if (col == _tree.get_column(COL_LOCKED - 1)) {
+ _takeAction(BUTTON_LOCK_OTHERS);
+ }
+ } else if (event->state & GDK_MOD1_MASK) {
+ // Alt+left click on the visible/lock columns toggles "solo" mode and preserves selection
+ Gtk::TreeModel::iterator iter = _store->get_iter(path);
+ if (_store->iter_is_valid(iter)) {
+ Gtk::TreeModel::Row row = *iter;
+ SPObject *obj = row[_model->_colObject];
+ if (col == _tree.get_column(COL_VISIBLE - 1)) {
+ _desktop->toggleLayerSolo( obj );
+ DocumentUndo::maybeDone(_desktop->doc(), "layer:solo", SP_VERB_LAYER_SOLO, _("Toggle layer solo"));
+ } else if (col == _tree.get_column(COL_LOCKED - 1)) {
+ _desktop->toggleLockOtherLayers( obj );
+ DocumentUndo::maybeDone(_desktop->doc(), "layer:lockothers", SP_VERB_LAYER_LOCK_OTHERS, _("Lock other layers"));
+ }
+ }
}
}
}
@@ -612,6 +648,7 @@ void LayersPanel::_handleButtonEvent(GdkEventButton* event)
}
}
+ return false;
}
/*
@@ -706,7 +743,7 @@ void LayersPanel::_renameLayer(Gtk::TreeModel::Row row, const Glib::ustring& nam
if ( !name.empty() && (!oldLabel || name != oldLabel) ) {
_desktop->layer_manager->renameLayer( obj, name.c_str(), FALSE );
DocumentUndo::done( _desktop->doc() , SP_VERB_NONE,
- _("Renamed layer"));
+ _("Rename layer"));
}
}
@@ -808,8 +845,8 @@ LayersPanel::LayersPanel() :
_text_renderer->signal_edited().connect( sigc::mem_fun(*this, &LayersPanel::_handleEdited) );
_text_renderer->signal_editing_canceled().connect( sigc::mem_fun(*this, &LayersPanel::_handleEditingCancelled) );
- _tree.signal_button_press_event().connect_notify( sigc::mem_fun(*this, &LayersPanel::_handleButtonEvent) );
- _tree.signal_button_release_event().connect_notify( sigc::mem_fun(*this, &LayersPanel::_handleButtonEvent) );
+ _tree.signal_button_press_event().connect( sigc::mem_fun(*this, &LayersPanel::_handleButtonEvent), false );
+ _tree.signal_button_release_event().connect( sigc::mem_fun(*this, &LayersPanel::_handleButtonEvent), false );
_tree.signal_key_press_event().connect( sigc::mem_fun(*this, &LayersPanel::_handleKeyEvent), false );
_scroller.add( _tree );
diff --git a/src/ui/dialog/layers.h b/src/ui/dialog/layers.h
index cbd9515d7..e9fd9ebc6 100644
--- a/src/ui/dialog/layers.h
+++ b/src/ui/dialog/layers.h
@@ -64,7 +64,7 @@ private:
void _preToggle( GdkEvent const *event );
void _toggled( Glib::ustring const& str, int targetCol );
- void _handleButtonEvent(GdkEventButton *event);
+ bool _handleButtonEvent(GdkEventButton *event);
bool _handleKeyEvent(GdkEventKey *event);
bool _handleDragDrop(const Glib::RefPtr<Gdk::DragContext>& context, int x, int y, guint time);
void _handleEdited(const Glib::ustring& path, const Glib::ustring& new_text);
diff --git a/src/ui/dialog/object-attributes.cpp b/src/ui/dialog/object-attributes.cpp
index f67c4db21..1ae9730d5 100644
--- a/src/ui/dialog/object-attributes.cpp
+++ b/src/ui/dialog/object-attributes.cpp
@@ -123,7 +123,7 @@ void ObjectAttributes::widget_setup (void)
}
blocked = true;
- SPObject *obj = (SPObject*)item; //to get the selected item
+ SPObject *obj = SP_OBJECT(item); //to get the selected item
GObjectClass *klass = G_OBJECT_GET_CLASS(obj); //to deduce the object's type
GType type = G_TYPE_FROM_CLASS(klass);
const SPAttrDesc *desc;
diff --git a/src/ui/dialog/ocaldialogs.h b/src/ui/dialog/ocaldialogs.h
index 0dc61abb3..1cdfa15bb 100644
--- a/src/ui/dialog/ocaldialogs.h
+++ b/src/ui/dialog/ocaldialogs.h
@@ -64,7 +64,7 @@ public:
FileDialogBase(const Glib::ustring &title, Gtk::Window& /*parent*/) : Gtk::Window(Gtk::WINDOW_TOPLEVEL)
{
set_title(title);
- sp_transientize((GtkWidget*) gobj());
+ sp_transientize(GTK_WIDGET(gobj()));
// Allow shrinking of window so labels wrap correctly
set_resizable(true);
diff --git a/src/ui/dialog/spellcheck.cpp b/src/ui/dialog/spellcheck.cpp
index 0da28061e..0f2c53f99 100644
--- a/src/ui/dialog/spellcheck.cpp
+++ b/src/ui/dialog/spellcheck.cpp
@@ -219,8 +219,8 @@ void SpellCheck::setTargetDesktop(SPDesktop *desktop)
void SpellCheck::clearRects()
{
for (GSList *it = _rects; it; it = it->next) {
- sp_canvas_item_hide((SPCanvasItem*) it->data);
- sp_canvas_item_destroy((SPCanvasItem*) it->data);
+ sp_canvas_item_hide(SP_CANVAS_ITEM(it->data));
+ sp_canvas_item_destroy(SP_CANVAS_ITEM(it->data));
}
g_slist_free(_rects);
_rects = NULL;
@@ -330,8 +330,8 @@ SpellCheck::nextText()
_text = getText(_root);
if (_text) {
- _modified_connection = ((SPObject*) _text)->connectModified(sigc::mem_fun(*this, &SpellCheck::onObjModified));
- _release_connection = ((SPObject*) _text)->connectRelease(sigc::mem_fun(*this, &SpellCheck::onObjReleased));
+ _modified_connection = (SP_OBJECT(_text))->connectModified(sigc::mem_fun(*this, &SpellCheck::onObjModified));
+ _release_connection = (SP_OBJECT(_text))->connectRelease(sigc::mem_fun(*this, &SpellCheck::onObjReleased));
_layout = te_get_layout (_text);
_begin_w = _layout->begin();
diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp
index 16bb8222a..f296ad030 100644
--- a/src/ui/dialog/svg-fonts-dialog.cpp
+++ b/src/ui/dialog/svg-fonts-dialog.cpp
@@ -278,7 +278,7 @@ void SvgFontsDialog::update_fonts()
_model->clear();
for(const GSList *l = fonts; l; l = l->next) {
Gtk::TreeModel::Row row = *_model->append();
- SPFont* f = (SPFont*)l->data;
+ SPFont* f = SP_FONT(l->data);
row[_columns.spfont] = f;
row[_columns.svgfont] = new SvgFont(f);
const gchar* lbl = f->label();
@@ -318,7 +318,7 @@ void SvgFontsDialog::update_global_settings_tab(){
SPObject* obj;
for (obj=font->children; obj; obj=obj->next){
if (SP_IS_FONTFACE(obj)){
- _familyname_entry->set_text(((SPFontFace*) obj)->font_family);
+ _familyname_entry->set_text((SP_FONTFACE(obj))->font_family);
}
}
}
diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp
index 4e1b82ebe..8cf48f827 100644
--- a/src/ui/dialog/symbols.cpp
+++ b/src/ui/dialog/symbols.cpp
@@ -123,6 +123,12 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) :
iconView->set_tooltip_column( 1 );
iconView->set_pixbuf_column( columns->symbol_image );
+ std::vector< Gtk::TargetEntry > targets;
+ targets.push_back(Gtk::TargetEntry( "application/x-inkscape-paste"));
+
+ iconView->enable_model_drag_source (targets, Gdk::BUTTON1_MASK, Gdk::ACTION_COPY);
+ iconView->signal_drag_data_get().connect(sigc::mem_fun(*this, &SymbolsDialog::iconDragDataGet));
+
sigc::connection connIconChanged;
connIconChanged =
iconView->signal_selection_changed().connect(sigc::mem_fun(*this, &SymbolsDialog::iconChanged));
@@ -228,6 +234,27 @@ void SymbolsDialog::rebuild() {
draw_symbols( symbolDocument );
}
+void SymbolsDialog::iconDragDataGet(const Glib::RefPtr<Gdk::DragContext>& context, Gtk::SelectionData& data, guint info, guint time) {
+
+#if WITH_GTKMM_3_0
+ std::vector<Gtk::TreePath> iconArray = iconView->get_selected_items();
+#else
+ Gtk::IconView::ArrayHandle_TreePaths iconArray = iconView->get_selected_items();
+#endif
+
+ if( iconArray.empty() ) {
+ //std::cout << " iconArray empty: huh? " << std::endl;
+ } else {
+ Gtk::TreeModel::Path const & path = *iconArray.begin();
+ Gtk::ListStore::iterator row = store->get_iter(path);
+ Glib::ustring symbol_id = (*row)[getColumns()->symbol_id];
+
+ GdkAtom dataAtom = gdk_atom_intern( "application/x-inkscape-paste", FALSE );
+ gtk_selection_data_set( data.gobj(), dataAtom, 9, (guchar*)symbol_id.c_str(), symbol_id.length() );
+ }
+
+}
+
void SymbolsDialog::iconChanged() {
#if WITH_GTKMM_3_0
std::vector<Gtk::TreePath> iconArray = iconView->get_selected_items();
diff --git a/src/ui/dialog/symbols.h b/src/ui/dialog/symbols.h
index c2bb4448e..5486ff546 100644
--- a/src/ui/dialog/symbols.h
+++ b/src/ui/dialog/symbols.h
@@ -54,6 +54,7 @@ private:
void rebuild();
void iconChanged();
+ void iconDragDataGet(const Glib::RefPtr<Gdk::DragContext>& context, Gtk::SelectionData& selection_data, guint info, guint time);
void get_symbols();
void draw_symbols( SPDocument* symbol_document );
diff --git a/src/ui/widget/color-picker.cpp b/src/ui/widget/color-picker.cpp
index e5c542a7c..31fb3096c 100644
--- a/src/ui/widget/color-picker.cpp
+++ b/src/ui/widget/color-picker.cpp
@@ -55,7 +55,7 @@ void ColorPicker::setupDialog(const Glib::ustring &title)
_colorSelectorDialog.hide();
_colorSelectorDialog.set_title (title);
_colorSelectorDialog.set_border_width (4);
- _colorSelector = (SPColorSelector*)sp_color_selector_new(SP_TYPE_COLOR_NOTEBOOK);
+ _colorSelector = SP_COLOR_SELECTOR(sp_color_selector_new(SP_TYPE_COLOR_NOTEBOOK));
_colorSelectorDialog.get_vbox()->pack_start (
*Glib::wrap(&_colorSelector->vbox), true, true, 0);
diff --git a/src/ui/widget/layer-selector.cpp b/src/ui/widget/layer-selector.cpp
index c06f70185..fbb9c0e24 100644
--- a/src/ui/widget/layer-selector.cpp
+++ b/src/ui/widget/layer-selector.cpp
@@ -241,7 +241,11 @@ private:
void LayerSelector::_layersChanged()
{
if (_desktop) {
- _selectLayer(_desktop->currentLayer());
+ /*
+ * This code fixes #166691 but causes issues #1066543 and #1080378.
+ * Comment out until solution found.
+ */
+ //_selectLayer(_desktop->currentLayer());
}
}
diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp
index 07145f5f3..b793893c7 100644
--- a/src/ui/widget/preferences-widget.cpp
+++ b/src/ui/widget/preferences-widget.cpp
@@ -640,7 +640,7 @@ void PrefCombo::on_changed()
if (this->get_visible()) //only take action if user changed value
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- if(_values.size() > 0)
+ if(!_values.empty())
{
prefs->setInt(_prefs_path, _values[this->get_active_row_number()]);
}
diff --git a/src/ui/widget/selected-style.cpp b/src/ui/widget/selected-style.cpp
index ee835216d..41d7c8be2 100644
--- a/src/ui/widget/selected-style.cpp
+++ b/src/ui/widget/selected-style.cpp
@@ -300,7 +300,7 @@ SelectedStyle::SelectedStyle(bool /*layout*/)
// List of units should match with Fill/Stroke dialog stroke style width list
for (GSList *l = sp_unit_get_list(SP_UNIT_ABSOLUTE | SP_UNIT_DEVICE); l != NULL; l = l->next) {
- SPUnit const *u = (SPUnit*)l->data;
+ SPUnit const *u = static_cast<SPUnit*>(l->data);
Gtk::RadioMenuItem *mi = Gtk::manage(new Gtk::RadioMenuItem(_sw_group));
mi->add(*(new Gtk::Label(u->abbr, 0.0, 0.5)));
_unit_mis = g_slist_append(_unit_mis, mi);
@@ -451,7 +451,7 @@ SelectedStyle::setDesktop(SPDesktop *desktop)
this )
));
- _sw_unit = (SPUnit *) sp_desktop_namedview(desktop)->doc_units;
+ _sw_unit = const_cast<SPUnit*>(sp_desktop_namedview(desktop)->doc_units);
// Set the doc default unit active in the units list
gint length = g_slist_length(_unit_mis);
@@ -988,13 +988,13 @@ SelectedStyle::update()
if (SP_IS_LINEARGRADIENT (server)) {
SPGradient *vector = SP_GRADIENT(server)->getVector();
- sp_gradient_image_set_gradient ((SPGradientImage *) _gradient_preview_l[i], vector);
+ sp_gradient_image_set_gradient(SP_GRADIENT_IMAGE(_gradient_preview_l[i]), vector);
place->add(_gradient_box_l[i]);
place->set_tooltip_text(__lgradient[i]);
_mode[i] = SS_LGRADIENT;
} else if (SP_IS_RADIALGRADIENT (server)) {
SPGradient *vector = SP_GRADIENT(server)->getVector();
- sp_gradient_image_set_gradient ((SPGradientImage *) _gradient_preview_r[i], vector);
+ sp_gradient_image_set_gradient(SP_GRADIENT_IMAGE(_gradient_preview_r[i]), vector);
place->add(_gradient_box_r[i]);
place->set_tooltip_text(__rgradient[i]);
_mode[i] = SS_RGRADIENT;
diff --git a/src/util/expression-evaluator.cpp b/src/util/expression-evaluator.cpp
index 37e9d6cc1..3e1bab6bc 100644
--- a/src/util/expression-evaluator.cpp
+++ b/src/util/expression-evaluator.cpp
@@ -75,7 +75,7 @@ typedef struct
/** Unit Resolver...
*/
-bool unitresolverproc (const gchar* identifier, GimpEevlQuantity *result, Unit* unit)
+static bool unitresolverproc (const gchar* identifier, GimpEevlQuantity *result, Unit* unit)
{
static UnitTable unit_table;
diff --git a/src/verbs.cpp b/src/verbs.cpp
index 8c45ce665..bbadb1a25 100644
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
@@ -133,7 +133,7 @@ public:
gchar const *name,
gchar const *tip,
gchar const *image) :
- Verb(code, id, name, tip, image)
+ Verb(code, id, name, tip, image, _("File"))
{ }
}; // FileVerb class
@@ -152,7 +152,7 @@ public:
gchar const *name,
gchar const *tip,
gchar const *image) :
- Verb(code, id, name, tip, image)
+ Verb(code, id, name, tip, image, _("Edit"))
{ }
}; // EditVerb class
@@ -171,7 +171,7 @@ public:
gchar const *name,
gchar const *tip,
gchar const *image) :
- Verb(code, id, name, tip, image)
+ Verb(code, id, name, tip, image, _("Selection"))
{ }
}; // SelectionVerb class
@@ -190,7 +190,7 @@ public:
gchar const *name,
gchar const *tip,
gchar const *image) :
- Verb(code, id, name, tip, image)
+ Verb(code, id, name, tip, image, _("Layer"))
{ }
}; // LayerVerb class
@@ -209,7 +209,7 @@ public:
gchar const *name,
gchar const *tip,
gchar const *image) :
- Verb(code, id, name, tip, image)
+ Verb(code, id, name, tip, image, _("Object"))
{ }
}; // ObjectVerb class
@@ -228,7 +228,7 @@ public:
gchar const *name,
gchar const *tip,
gchar const *image) :
- Verb(code, id, name, tip, image)
+ Verb(code, id, name, tip, image, _("Context"))
{ }
}; // ContextVerb class
@@ -247,7 +247,7 @@ public:
gchar const *name,
gchar const *tip,
gchar const *image) :
- Verb(code, id, name, tip, image)
+ Verb(code, id, name, tip, image, _("View"))
{ }
}; // ZoomVerb class
@@ -267,7 +267,7 @@ public:
gchar const *name,
gchar const *tip,
gchar const *image) :
- Verb(code, id, name, tip, image)
+ Verb(code, id, name, tip, image, _("Dialog"))
{ }
}; // DialogVerb class
@@ -286,7 +286,7 @@ public:
gchar const *name,
gchar const *tip,
gchar const *image) :
- Verb(code, id, name, tip, image)
+ Verb(code, id, name, tip, image, _("Help"))
{ }
}; // HelpVerb class
@@ -305,7 +305,7 @@ public:
gchar const *name,
gchar const *tip,
gchar const *image) :
- Verb(code, id, name, tip, image)
+ Verb(code, id, name, tip, image, _("Help"))
{ }
}; // TutorialVerb class
@@ -324,7 +324,7 @@ public:
gchar const *name,
gchar const *tip,
gchar const *image) :
- Verb(code, id, name, tip, image)
+ Verb(code, id, name, tip, image, _("Text"))
{ }
}; //TextVerb : public Verb
@@ -341,7 +341,7 @@ Verb::VerbIDTable Verb::_verb_ids;
* each call it is incremented. The list of allocated verbs is kept
* in the \c _verbs hashtable which is indexed by the \c code.
*/
-Verb::Verb(gchar const *id, gchar const *name, gchar const *tip, gchar const *image) :
+Verb::Verb(gchar const *id, gchar const *name, gchar const *tip, gchar const *image, gchar const *group) :
_actions(0),
_id(id),
_name(name),
@@ -350,6 +350,7 @@ Verb::Verb(gchar const *id, gchar const *name, gchar const *tip, gchar const *im
_shortcut(0),
_image(image),
_code(0),
+ _group(group),
_default_sensitive(false)
{
static int count = SP_VERB_LAST;
@@ -2002,6 +2003,7 @@ void DialogVerb::perform(SPAction *action, void *data)
case SP_VERB_DIALOG_PRINT_COLORS_PREVIEW:
dt->_dlg_mgr->showDialog("PrintColorsPreviewDialog");
break;
+
default:
break;
}
@@ -2104,7 +2106,7 @@ public:
gchar const *name,
gchar const *tip,
gchar const *image) :
- Verb(code, id, name, tip, image)
+ Verb(code, id, name, tip, image, _("Extensions"))
{
set_default_sensitive(false);
}
@@ -2169,7 +2171,7 @@ public:
gchar const *name,
gchar const *tip,
gchar const *image) :
- Verb(code, id, name, tip, image)
+ Verb(code, id, name, tip, image, _("View"))
{
set_default_sensitive(false);
}
@@ -2235,7 +2237,7 @@ public:
gchar const *name,
gchar const *tip,
gchar const *image) :
- Verb(code, id, name, tip, image)
+ Verb(code, id, name, tip, image, _("Layer"))
{
set_default_sensitive(true);
}
@@ -2294,8 +2296,8 @@ void LockAndHideVerb::perform(SPAction *action, void *data)
// these must be in the same order as the SP_VERB_* enum in "verbs.h"
Verb *Verb::_base_verbs[] = {
// Header
- new Verb(SP_VERB_INVALID, NULL, NULL, NULL, NULL),
- new Verb(SP_VERB_NONE, "None", N_("None"), N_("Does nothing"), NULL),
+ new Verb(SP_VERB_INVALID, NULL, NULL, NULL, NULL, NULL),
+ new Verb(SP_VERB_NONE, "None", N_("None"), N_("Does nothing"), NULL, NULL),
// File
new FileVerb(SP_VERB_FILE_NEW, "FileNew", N_("Default"), N_("Create new document from the default template"),
@@ -2707,7 +2709,7 @@ Verb *Verb::_base_verbs[] = {
#ifdef HAVE_GTK_WINDOW_FULLSCREEN
new ZoomVerb(SP_VERB_FULLSCREEN, "FullScreen", N_("_Fullscreen"), N_("Stretch this document window to full screen"),
INKSCAPE_ICON("view-fullscreen")),
- new ZoomVerb(SP_VERB_FULLSCREENFOCUS, "FullScreenFocus", N_("Fullscreen & Focus Mode"), Glib::ustring::format(N_("Stretch this document window to full screen"), N_(" and "), N_("Remove excess toolbars to focus on drawing")).c_str(),
+ new ZoomVerb(SP_VERB_FULLSCREENFOCUS, "FullScreenFocus", N_("Fullscreen & Focus Mode"), N_("Stretch this document window to full screen"),
INKSCAPE_ICON("view-fullscreen")),
#endif // HAVE_GTK_WINDOW_FULLSCREEN
new ZoomVerb(SP_VERB_FOCUSTOGGLE, "FocusToggle", N_("Toggle _Focus Mode"), N_("Remove excess toolbars to focus on drawing"),
@@ -2814,7 +2816,6 @@ Verb *Verb::_base_verbs[] = {
N_("Select which color separations to render in Print Colors Preview rendermode"), NULL),
new DialogVerb(SP_VERB_DIALOG_EXPORT, "DialogExport", N_("_Export PNG Image..."),
N_("Export this document or a selection as a PNG image"), INKSCAPE_ICON("document-export")),
-
// Help
new HelpVerb(SP_VERB_HELP_ABOUT_EXTENSIONS, "HelpAboutExtensions", N_("About E_xtensions"),
N_("Information on Inkscape extensions"), NULL),
@@ -2898,9 +2899,27 @@ Verb *Verb::_base_verbs[] = {
// Footer
- new Verb(SP_VERB_LAST, " '\"invalid id", NULL, NULL, NULL)
+ new Verb(SP_VERB_LAST, " '\"invalid id", NULL, NULL, NULL, NULL)
};
+std::vector<Inkscape::Verb *>
+Verb::getList (void) {
+
+ std::vector<Verb *> verbs;
+ // Go through the dynamic verb table
+ for (VerbTable::iterator iter = _verbs.begin(); iter != _verbs.end(); ++iter) {
+ Verb * verb = iter->second;
+ if (verb->get_code() == SP_VERB_INVALID ||
+ verb->get_code() == SP_VERB_NONE ||
+ verb->get_code() == SP_VERB_LAST) {
+ continue;
+ }
+
+ verbs.push_back(verb);
+ }
+
+ return verbs;
+};
void
Verb::list (void) {
diff --git a/src/verbs.h b/src/verbs.h
index c47d3ae16..c4a7b67e0 100644
--- a/src/verbs.h
+++ b/src/verbs.h
@@ -348,6 +348,7 @@ enum {
gchar *sp_action_get_title (const SPAction *action);
#include <map>
+#include <vector>
namespace Inkscape {
@@ -418,6 +419,9 @@ private:
*/
unsigned int _code;
+ /** Name of the group the verb belongs to. */
+ gchar const * _group;
+
/**
* Whether this verb is set to default to sensitive or
* insensitive when new actions are created.
@@ -452,17 +456,24 @@ public:
gchar const * get_name (void) { return _name; }
/** Accessor to get the internal variable. */
+ gchar const * get_short_tip (void) { return _tip; };
+
+ /** Accessor to get the internal variable. */
gchar const * get_tip (void) ;
/** Accessor to get the internal variable. */
gchar const * get_image (void) { return _image; }
+ /** Get the verbs group */
+ gchar const * get_group (void) { return _group; }
+
/** Set the name after initialization. */
gchar const * set_name (gchar const * name) { _name = name; return _name; }
/** Set the tooltip after initialization. */
gchar const * set_tip (gchar const * tip) { _tip = tip; return _tip; }
+
protected:
SPAction *make_action_helper (Inkscape::UI::View::View *view, void (*perform_fun)(SPAction *, void *), void *in_pntr = NULL);
virtual SPAction *make_action (Inkscape::UI::View::View *view);
@@ -494,7 +505,8 @@ public:
gchar const * id,
gchar const * name,
gchar const * tip,
- gchar const * image) :
+ gchar const * image,
+ gchar const * group) :
_actions(0),
_id(id),
_name(name),
@@ -503,12 +515,13 @@ public:
_shortcut(0),
_image(image),
_code(code),
+ _group(group),
_default_sensitive(true)
{
_verbs.insert(VerbTable::value_type(_code, this));
_verb_ids.insert(VerbIDTable::value_type(_id, this));
}
- Verb (gchar const * id, gchar const * name, gchar const * tip, gchar const * image);
+ Verb (gchar const * id, gchar const * name, gchar const * tip, gchar const * image, gchar const * group);
virtual ~Verb (void);
SPAction * get_action(Inkscape::UI::View::View * view);
@@ -560,6 +573,8 @@ protected:
public:
static void list (void);
+ static std::vector<Inkscape::Verb *>getList (void);
+
}; /* Verb class */
diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp
index 05053f6fd..cc441cc1c 100644
--- a/src/widgets/desktop-widget.cpp
+++ b/src/widgets/desktop-widget.cpp
@@ -817,10 +817,10 @@ SPDesktopWidget::updateTitle(gchar const* uri)
gchar const *fname = uri;
GString *name = g_string_new ("");
- gchar const *grayscalename = "(grayscale) ";
- gchar const *grayscalenamecomma = ", grayscale";
- gchar const *printcolorsname = "(print colors preview) ";
- gchar const *printcolorsnamecomma = ", print colors preview";
+ gchar const *grayscalename = _("(grayscale) ");
+ gchar const *grayscalenamecomma = _(", grayscale");
+ gchar const *printcolorsname = _("(print colors preview) ");
+ gchar const *printcolorsnamecomma = _(", print colors preview");
gchar const *colormodename = "";
gchar const *colormodenamecomma = "";
gchar const *modifiedname = "";
diff --git a/src/widgets/font-selector.cpp b/src/widgets/font-selector.cpp
index 6a677307e..c7f28fb9c 100644
--- a/src/widgets/font-selector.cpp
+++ b/src/widgets/font-selector.cpp
@@ -133,7 +133,7 @@ static void sp_font_selector_set_size_tooltip(SPFontSelector *fsel)
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
int unit = prefs->getInt("/options/font/unitType", SP_CSS_UNIT_PT);
- Glib::ustring tooltip = Glib::ustring::format("Font size (", sp_style_get_css_unit_string(unit), ")");
+ Glib::ustring tooltip = Glib::ustring::format(_("Font size"), " (", sp_style_get_css_unit_string(unit), ")");
gtk_widget_set_tooltip_text (fsel->size, _(tooltip.c_str()));
}
diff --git a/src/widgets/gradient-toolbar.cpp b/src/widgets/gradient-toolbar.cpp
index 205f5b8ec..ea125a380 100644
--- a/src/widgets/gradient-toolbar.cpp
+++ b/src/widgets/gradient-toolbar.cpp
@@ -1109,7 +1109,7 @@ void sp_gradient_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions,
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) );
+ 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 );
ege_select_one_action_set_appearance( act1, "compact" );
gtk_action_set_sensitive( GTK_ACTION(act1), FALSE );
@@ -1125,13 +1125,13 @@ void sp_gradient_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions,
GtkTreeIter iter;
gtk_list_store_append( model, &iter );
- gtk_list_store_set( model, &iter, 0, _("none"), 1, SP_GRADIENT_SPREAD_PAD, -1 );
+ gtk_list_store_set( model, &iter, 0, _("None"), 1, SP_GRADIENT_SPREAD_PAD, -1 );
gtk_list_store_append( model, &iter );
- gtk_list_store_set( model, &iter, 0, _("reflected"), 1, SP_GRADIENT_SPREAD_REFLECT, -1 );
+ gtk_list_store_set( model, &iter, 0, _("Reflected"), 1, SP_GRADIENT_SPREAD_REFLECT, -1 );
gtk_list_store_append( model, &iter );
- gtk_list_store_set( model, &iter, 0, _("direct"), 1, SP_GRADIENT_SPREAD_REPEAT, -1 );
+ gtk_list_store_set( model, &iter, 0, _("Direct"), 1, SP_GRADIENT_SPREAD_REPEAT, -1 );
EgeSelectOneAction* act1 = ege_select_one_action_new( "GradientSelectRepeatAction", _("Repeat"),
(// TRANSLATORS: for info, see http://www.w3.org/TR/2000/CR-SVG-20000802/pservers.html#LinearGradientSpreadMethodAttribute
@@ -1157,7 +1157,7 @@ void sp_gradient_toolbox_prep(SPDesktop * desktop, GtkActionGroup* mainActions,
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 );
+ g_object_set( act1, "short_label", _("Stops:"), NULL );
ege_select_one_action_set_appearance( act1, "compact" );
gtk_action_set_sensitive( GTK_ACTION(act1), FALSE );
g_signal_connect( G_OBJECT(act1), "changed", G_CALLBACK(gr_stop_combo_changed), holder );
diff --git a/src/widgets/text-toolbar.cpp b/src/widgets/text-toolbar.cpp
index e32f5a42a..9e0977d51 100644
--- a/src/widgets/text-toolbar.cpp
+++ b/src/widgets/text-toolbar.cpp
@@ -1233,7 +1233,7 @@ static void sp_text_toolbox_selection_changed(Inkscape::Selection */*selection*/
sp_text_set_sizes(GTK_LIST_STORE(ink_comboboxentry_action_get_model(fontSizeAction)), unit);
ink_comboboxentry_action_set_active_text( fontSizeAction, os.str().c_str() );
- Glib::ustring tooltip = Glib::ustring::format("Font size (", sp_style_get_css_unit_string(unit), ")");
+ Glib::ustring tooltip = Glib::ustring::format(_("Font size"), " (", sp_style_get_css_unit_string(unit), ")");
ink_comboboxentry_action_set_tooltip ( fontSizeAction, tooltip.c_str());
// Font styles
@@ -1492,7 +1492,7 @@ void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObje
sp_text_set_sizes(model_size, unit);
- Glib::ustring tooltip = Glib::ustring::format("Font size (", sp_style_get_css_unit_string(unit), ")");
+ Glib::ustring tooltip = Glib::ustring::format(_("Font size"), " (", sp_style_get_css_unit_string(unit), ")");
Ink_ComboBoxEntry_Action* act = ink_comboboxentry_action_new( "TextFontSizeAction",
_("Font Size"),
diff --git a/src/xml/Makefile_insert b/src/xml/Makefile_insert
index b10f2448b..da55d7f7e 100644
--- a/src/xml/Makefile_insert
+++ b/src/xml/Makefile_insert
@@ -40,8 +40,7 @@ ink_common_sources += \
xml/subtree.cpp \
xml/subtree.h \
xml/text-node.h \
- xml/invalid-operation-exception.h \
- xml/xml-forward.h
+ xml/invalid-operation-exception.h
# ######################
# ### CxxTest stuff ####