From bd9e980c59453168a9d55a093564421b593e186e Mon Sep 17 00:00:00 2001 From: John Smith Date: Mon, 3 Sep 2012 08:44:27 +0900 Subject: Fix for 406044 : Esc with no selection, activates selection tool (bzr r11647) --- src/gradient-context.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/gradient-context.cpp') diff --git a/src/gradient-context.cpp b/src/gradient-context.cpp index cf7d6a26f..05bea14b9 100644 --- a/src/gradient-context.cpp +++ b/src/gradient-context.cpp @@ -47,6 +47,7 @@ #include "rubberband.h" #include "document-undo.h" #include "verbs.h" +#include "selection-chemistry.h" using Inkscape::DocumentUndo; @@ -759,7 +760,7 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event) if (drag->selected) { drag->deselectAll(); } else { - selection->clear(); + Inkscape::SelectionHelper::selectNone(desktop); } ret = TRUE; //TODO: make dragging escapable by Esc -- cgit v1.2.3 From 701002a149020e89d9023dbe56c6d0ccdb5c3aca Mon Sep 17 00:00:00 2001 From: John Smith Date: Thu, 6 Sep 2012 11:25:16 +0900 Subject: Fix for 580160 : Deleting a gradient stop using Shape tools deletes the object (bzr r11655) --- src/gradient-context.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/gradient-context.cpp') diff --git a/src/gradient-context.cpp b/src/gradient-context.cpp index 05bea14b9..aa8c8b929 100644 --- a/src/gradient-context.cpp +++ b/src/gradient-context.cpp @@ -863,10 +863,7 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event) case GDK_KEY_Delete: case GDK_KEY_KP_Delete: case GDK_KEY_BackSpace: - if ( drag->selected ) { - drag->deleteSelected(MOD__CTRL_ONLY); - ret = TRUE; - } + ret = event_context->deleteSelectedDrag(MOD__CTRL_ONLY); break; default: break; -- cgit v1.2.3 From a8e76949f48267a704af633032e33d6982c682cc Mon Sep 17 00:00:00 2001 From: John Smith Date: Sat, 22 Sep 2012 18:59:01 +0900 Subject: Fix for 367548 : Invert doesnt work on objects with gradients (bzr r11694) --- src/gradient-context.cpp | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'src/gradient-context.cpp') diff --git a/src/gradient-context.cpp b/src/gradient-context.cpp index aa8c8b929..356743eed 100644 --- a/src/gradient-context.cpp +++ b/src/gradient-context.cpp @@ -837,18 +837,7 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event) case GDK_KEY_r: case GDK_KEY_R: if (MOD__SHIFT_ONLY) { - // First try selected dragger - if (drag && drag->selected) { - drag->selected_reverse_vector(); - } else { // If no drag or no dragger selected, act on selection (both fill and stroke gradients) - for (GSList const* i = selection->itemList(); i != NULL; i = i->next) { - sp_item_gradient_reverse_vector(SP_ITEM(i->data), Inkscape::FOR_FILL); - sp_item_gradient_reverse_vector(SP_ITEM(i->data), Inkscape::FOR_STROKE); - } - } - // we did an undoable action - DocumentUndo::done(sp_desktop_document (desktop), SP_VERB_CONTEXT_GRADIENT, - _("Invert gradient")); + sp_gradient_invert_selected_gradients(desktop, Inkscape::FOR_FILL_AND_STROKE); ret = TRUE; } break; -- cgit v1.2.3 From a01a3fa9d658218f3afbe5ab9922deb9c3ce38be Mon Sep 17 00:00:00 2001 From: John Smith Date: Sun, 23 Sep 2012 11:19:28 +0900 Subject: Fix for 367548 : Invert doesnt work on objects with gradients (bzr r11696) --- src/gradient-context.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gradient-context.cpp') diff --git a/src/gradient-context.cpp b/src/gradient-context.cpp index 356743eed..5b0e261de 100644 --- a/src/gradient-context.cpp +++ b/src/gradient-context.cpp @@ -837,7 +837,7 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event) case GDK_KEY_r: case GDK_KEY_R: if (MOD__SHIFT_ONLY) { - sp_gradient_invert_selected_gradients(desktop, Inkscape::FOR_FILL_AND_STROKE); + sp_gradient_reverse_selected_gradients(desktop); ret = TRUE; } break; -- cgit v1.2.3 From 370a3f5cc9e39352a081e5d5dd8c43676547a6e6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 4 Oct 2012 11:45:44 +1000 Subject: code cleanup: add own includes to cpp files or make the functions static if they are not used elsewhere. (bzr r11735) --- src/gradient-context.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gradient-context.cpp') diff --git a/src/gradient-context.cpp b/src/gradient-context.cpp index 5b0e261de..231490771 100644 --- a/src/gradient-context.cpp +++ b/src/gradient-context.cpp @@ -266,7 +266,7 @@ sp_gradient_context_is_over_line (SPGradientContext *rc, SPItem *item, Geom::Poi return close; } -std::vector +static std::vector sp_gradient_context_get_stop_intervals (GrDrag *drag, GSList **these_stops, GSList **next_stops) { std::vector coords; @@ -419,7 +419,7 @@ sp_gradient_context_add_stops_between_selected_stops (SPGradientContext *rc) g_slist_free (new_stops); } -double sqr(double x) {return x*x;} +static double sqr(double x) {return x*x;} static void sp_gradient_simplify(SPGradientContext *rc, double tolerance) -- cgit v1.2.3 From 1615436543169f305d1df4d830ed8f5ec5dc75ed Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Sat, 26 Jan 2013 19:33:04 +0000 Subject: More GObject boilerplate reduction (bzr r12065) --- src/gradient-context.cpp | 36 ++++++------------------------------ 1 file changed, 6 insertions(+), 30 deletions(-) (limited to 'src/gradient-context.cpp') diff --git a/src/gradient-context.cpp b/src/gradient-context.cpp index 231490771..8fd002d70 100644 --- a/src/gradient-context.cpp +++ b/src/gradient-context.cpp @@ -51,8 +51,6 @@ using Inkscape::DocumentUndo; -static void sp_gradient_context_class_init(SPGradientContextClass *klass); -static void sp_gradient_context_init(SPGradientContext *gr_context); static void sp_gradient_context_dispose(GObject *object); static void sp_gradient_context_setup(SPEventContext *ec); @@ -61,35 +59,13 @@ static gint sp_gradient_context_root_handler(SPEventContext *event_context, GdkE static void sp_gradient_drag(SPGradientContext &rc, Geom::Point const pt, guint state, guint32 etime); -static SPEventContextClass *parent_class; - - -GType sp_gradient_context_get_type() -{ - static GType type = 0; - if (!type) { - GTypeInfo info = { - sizeof(SPGradientContextClass), - NULL, NULL, - (GClassInitFunc) sp_gradient_context_class_init, - NULL, NULL, - sizeof(SPGradientContext), - 4, - (GInstanceInitFunc) sp_gradient_context_init, - NULL, /* value_table */ - }; - type = g_type_register_static(SP_TYPE_EVENT_CONTEXT, "SPGradientContext", &info, (GTypeFlags) 0); - } - return type; -} +G_DEFINE_TYPE(SPGradientContext, sp_gradient_context, SP_TYPE_EVENT_CONTEXT); static void sp_gradient_context_class_init(SPGradientContextClass *klass) { GObjectClass *object_class = (GObjectClass *) klass; SPEventContextClass *event_context_class = (SPEventContextClass *) klass; - parent_class = (SPEventContextClass *) g_type_class_peek_parent(klass); - object_class->dispose = sp_gradient_context_dispose; event_context_class->setup = sp_gradient_context_setup; @@ -127,7 +103,7 @@ static void sp_gradient_context_dispose(GObject *object) rc->subselcon->disconnect(); delete rc->subselcon; - G_OBJECT_CLASS(parent_class)->dispose(object); + G_OBJECT_CLASS(sp_gradient_context_parent_class)->dispose(object); } const gchar *gr_handle_descr [] = { @@ -204,8 +180,8 @@ static void sp_gradient_context_setup(SPEventContext *ec) { SPGradientContext *rc = SP_GRADIENT_CONTEXT(ec); - if (((SPEventContextClass *) parent_class)->setup) { - ((SPEventContextClass *) parent_class)->setup(ec); + if (((SPEventContextClass *) sp_gradient_context_parent_class)->setup) { + ((SPEventContextClass *) sp_gradient_context_parent_class)->setup(ec); } Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -879,8 +855,8 @@ sp_gradient_context_root_handler(SPEventContext *event_context, GdkEvent *event) } if (!ret) { - if (((SPEventContextClass *) parent_class)->root_handler) { - ret = ((SPEventContextClass *) parent_class)->root_handler(event_context, event); + if (((SPEventContextClass *) sp_gradient_context_parent_class)->root_handler) { + ret = ((SPEventContextClass *) sp_gradient_context_parent_class)->root_handler(event_context, event); } } -- cgit v1.2.3