From bb5018e116c7323c2ae54618135174891ffbe7fc Mon Sep 17 00:00:00 2001 From: Peter Moulder Date: Mon, 13 Jul 2009 03:24:24 +0000 Subject: sp-star.cpp, star-context.cpp: s/CLAMP/NR_CLAMP/, to make clear (and ensure) that we're using the libnr version rather than the glib version. (This change is probably desirable in most of Inkscape, but star-related code in particular is known to be sensitive to the difference.) (bzr r8273) --- src/star-context.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/star-context.cpp') diff --git a/src/star-context.cpp b/src/star-context.cpp index c5eff3c6a..f0c64e875 100644 --- a/src/star-context.cpp +++ b/src/star-context.cpp @@ -34,6 +34,7 @@ #include "desktop.h" #include "desktop-style.h" #include "message-context.h" +#include "libnr/nr-macros.h" #include "pixmaps/cursor-star.xpm" #include "sp-metrics.h" #include @@ -204,9 +205,9 @@ sp_star_context_set (SPEventContext *ec, Inkscape::Preferences::Entry *val) Glib::ustring path = val->getEntryName(); if (path == "magnitude") { - sc->magnitude = CLAMP (val->getInt(5), 3, 1024); + sc->magnitude = NR_CLAMP(val->getInt(5), 3, 1024); } else if (path == "proportion") { - sc->proportion = CLAMP (val->getDouble(0.5), 0.01, 2.0); + sc->proportion = NR_CLAMP(val->getDouble(0.5), 0.01, 2.0); } else if (path == "isflatsided") { sc->isflatsided = val->getBool(); } else if (path == "rounded") { -- cgit v1.2.3 From eae8322c8b968bbf076323eb68707124bfc810d9 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sat, 18 Jul 2009 12:56:25 +0000 Subject: Make the snap delay mechanism easier to implement for the devs, and get rid of the related warning messages (bzr r8302) --- src/star-context.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/star-context.cpp') diff --git a/src/star-context.cpp b/src/star-context.cpp index f0c64e875..80d378f27 100644 --- a/src/star-context.cpp +++ b/src/star-context.cpp @@ -236,7 +236,6 @@ static gint sp_star_context_root_handler(SPEventContext *event_context, GdkEvent if (event->button.button == 1 && !event_context->space_panning) { dragging = TRUE; - sp_event_context_snap_window_open(event_context); sc->center = Inkscape::setup_for_drag_start(desktop, event_context, event); @@ -283,7 +282,7 @@ static gint sp_star_context_root_handler(SPEventContext *event_context, GdkEvent event_context->xp = event_context->yp = 0; if (event->button.button == 1 && !event_context->space_panning) { dragging = FALSE; - sp_event_context_snap_window_closed(event_context, false); //button release will also occur on a double-click; in that case suppress warnings + sp_event_context_discard_delayed_snap_event(event_context); if (!event_context->within_tolerance) { // we've been dragging, finish the star sp_star_finish (sc); @@ -336,7 +335,7 @@ static gint sp_star_context_root_handler(SPEventContext *event_context, GdkEvent case GDK_Escape: if (dragging) { dragging = false; - sp_event_context_snap_window_closed(event_context); + sp_event_context_discard_delayed_snap_event(event_context); // if drawing, cancel, otherwise pass it up for deselecting sp_star_cancel(sc); ret = TRUE; @@ -347,7 +346,7 @@ static gint sp_star_context_root_handler(SPEventContext *event_context, GdkEvent sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), event->button.time); dragging = false; - sp_event_context_snap_window_closed(event_context); + sp_event_context_discard_delayed_snap_event(event_context); if (!event_context->within_tolerance) { // we've been dragging, finish the star sp_star_finish(sc); -- cgit v1.2.3 From 1619e274a9d9193fbd6df1b7817beaa96d030e6a Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Sat, 1 Aug 2009 12:29:37 +0000 Subject: When switching context by pressing a key, while dragging to create a new shape, the original context should be finished properly and sp_canvas_item_ungrab should be called. set_event_context() was looking for e.g. sp_rect_context_finish, but this wasn't implemented for any of the shape tools. This closes bug #195101 (bzr r8375) --- src/star-context.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/star-context.cpp') diff --git a/src/star-context.cpp b/src/star-context.cpp index 80d378f27..3d6825e31 100644 --- a/src/star-context.cpp +++ b/src/star-context.cpp @@ -52,6 +52,7 @@ static void sp_star_context_init (SPStarContext * star_context); static void sp_star_context_dispose (GObject *object); static void sp_star_context_setup (SPEventContext *ec); +static void sp_star_context_finish(SPEventContext *ec); static void sp_star_context_set (SPEventContext *ec, Inkscape::Preferences::Entry *val); static gint sp_star_context_root_handler (SPEventContext *ec, GdkEvent *event); @@ -92,6 +93,7 @@ sp_star_context_class_init (SPStarContextClass * klass) object_class->dispose = sp_star_context_dispose; event_context_class->setup = sp_star_context_setup; + event_context_class->finish = sp_star_context_finish; event_context_class->set = sp_star_context_set; event_context_class->root_handler = sp_star_context_root_handler; } @@ -119,6 +121,21 @@ sp_star_context_init (SPStarContext * star_context) new (&star_context->sel_changed_connection) sigc::connection(); } +static void sp_star_context_finish(SPEventContext *ec) +{ + SPStarContext *sc = SP_STAR_CONTEXT(ec); + SPDesktop *desktop = ec->desktop; + + sp_canvas_item_ungrab(SP_CANVAS_ITEM(desktop->acetate), GDK_CURRENT_TIME); + sp_star_finish(sc); + sc->sel_changed_connection.disconnect(); + + if (((SPEventContextClass *) parent_class)->finish) { + ((SPEventContextClass *) parent_class)->finish(ec); + } +} + + static void sp_star_context_dispose (GObject *object) { -- cgit v1.2.3