Code

replace single toggle button with less confusing pick-alpha and set-alpha options
[inkscape.git] / src / arc-context.cpp
index 48e1536385ec22daf26cea4f15734a1a98f28930..0b0aad79e563890d2fcea8120b8a992e920f0593 100644 (file)
@@ -30,6 +30,7 @@
 #include "desktop-handles.h"
 #include "snap.h"
 #include "pixmaps/cursor-ellipse.xpm"
+#include "pixmaps/cursor-ellipse.pixbuf"
 #include "sp-metrics.h"
 #include "xml/repr.h"
 #include "xml/node-event-vector.h"
@@ -39,6 +40,7 @@
 #include "desktop.h"
 #include "desktop-style.h"
 #include "context-fns.h"
+#include "verbs.h"
 
 #include "arc-context.h"
 
@@ -94,6 +96,11 @@ static void sp_arc_context_init(SPArcContext *arc_context)
     SPEventContext *event_context = SP_EVENT_CONTEXT(arc_context);
 
     event_context->cursor_shape = cursor_ellipse_xpm;
+    event_context->cursor_pixbuf = gdk_pixbuf_new_from_inline(
+            -1,
+            cursor_ellipse_pixbuf,
+            FALSE,
+            NULL);  
     event_context->hot_x = 4;
     event_context->hot_y = 4;
     event_context->xp = 0;
@@ -177,7 +184,6 @@ void sp_arc_context_selection_changed(Inkscape::Selection * selection, gpointer
             ec->shape_repr = shape_repr;
             Inkscape::GC::anchor(shape_repr);
             sp_repr_add_listener(shape_repr, &ec_shape_repr_events, ec);
-            sp_repr_synthesize_events(shape_repr, &ec_shape_repr_events, ec);
         }
     }
 }
@@ -185,7 +191,7 @@ void sp_arc_context_selection_changed(Inkscape::Selection * selection, gpointer
 static void sp_arc_context_setup(SPEventContext *ec)
 {
     SPArcContext *ac = SP_ARC_CONTEXT(ec);
-    Inkscape::Selection *selection = SP_DT_SELECTION(ec->desktop);
+    Inkscape::Selection *selection = sp_desktop_selection(ec->desktop);
 
     if (((SPEventContextClass *) parent_class)->setup) {
         ((SPEventContextClass *) parent_class)->setup(ec);
@@ -200,7 +206,6 @@ static void sp_arc_context_setup(SPEventContext *ec)
             ec->shape_repr = shape_repr;
             Inkscape::GC::anchor(shape_repr);
             sp_repr_add_listener(shape_repr, &ec_shape_repr_events, ec);
-            sp_repr_synthesize_events(shape_repr, &ec_shape_repr_events, ec);
         }
     }
 
@@ -249,7 +254,7 @@ static gint sp_arc_context_root_handler(SPEventContext *event_context, GdkEvent
     static bool dragging;
 
     SPDesktop *desktop = event_context->desktop;
-    Inkscape::Selection *selection = SP_DT_SELECTION(desktop);
+    Inkscape::Selection *selection = sp_desktop_selection(desktop);
     SPArcContext *ac = SP_ARC_CONTEXT(event_context);
 
     event_context->tolerance = prefs_get_int_attribute_limited("options.dragtolerance", "value", 0, 0, 100);
@@ -263,7 +268,7 @@ static gint sp_arc_context_root_handler(SPEventContext *event_context, GdkEvent
                 dragging = true;
                 ac->center = Inkscape::setup_for_drag_start(desktop, event_context, event);
 
-                SnapManager const m(desktop->namedview);
+                SnapManager const &m = desktop->namedview->snap_manager;
                 ac->center = m.freeSnap(Inkscape::Snapper::SNAP_POINT, ac->center, ac->item).getPoint();
                 sp_canvas_item_grab(SP_CANVAS_ITEM(desktop->acetate),
                                     GDK_KEY_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
@@ -347,7 +352,7 @@ static gint sp_arc_context_root_handler(SPEventContext *event_context, GdkEvent
                     }
                     break;
                 case GDK_Escape:
-                    SP_DT_SELECTION(desktop)->clear();
+                    sp_desktop_selection(desktop)->clear();
                     //TODO: make dragging escapable by Esc
                 default:
                     break;
@@ -427,8 +432,9 @@ static void sp_arc_finish(SPArcContext *ac)
 
         SP_OBJECT(ac->item)->updateRepr();
 
-        SP_DT_SELECTION(desktop)->set(ac->item);
-        sp_document_done(SP_DT_DOCUMENT(desktop));
+        sp_desktop_selection(desktop)->set(ac->item);
+        sp_document_done(sp_desktop_document(desktop), SP_VERB_CONTEXT_ARC, 
+                         _("Create ellipse"));
 
         ac->item = NULL;
     }