Code

snap indicator: try a diamond shaped indicator for snapping to nodes. see how we...
[inkscape.git] / src / event-context.h
index 400fde5e379e4bafe085a8e57dd70934b829424a..37b0ea75be45136e401788b71f0c530b6a49a069 100644 (file)
 #include <glib-object.h>
 #include <gdk/gdktypes.h>
 #include <gdk/gdkevents.h>
-#include <gdk/gdkpixbuf.h>
+
+#include "2geom/forward.h"
+#include "preferences.h"
 
 struct GrDrag;
 struct SPDesktop;
 struct SPItem;
-struct SPKnotHolder;
-
-namespace NR {
-    class Point;
-}
+class KnotHolder;
+class ShapeEditor;
 
 namespace Inkscape {
     class MessageContext;
@@ -50,10 +49,9 @@ struct SPEventContext : public GObject {
     SPEventContext *next;
     unsigned key;
     SPDesktop *desktop;
-    Inkscape::XML::Node *prefs_repr;
-    gchar **cursor_shape;
-    GdkPixbuf *cursor_pixbuf;
-    gint hot_x, hot_y;
+    Inkscape::Preferences::Observer *pref_observer;
+    gchar const *const *cursor_shape;
+    gint hot_x, hot_y; ///< indicates the cursor's hot spot
     GdkCursor *cursor;
 
     gint xp, yp;           ///< where drag started
@@ -74,8 +72,9 @@ struct SPEventContext : public GObject {
     GrDrag *_grdrag;
     GrDrag *get_drag () {return _grdrag;}
 
-    SPKnotHolder *shape_knot_holder;
-    Inkscape::XML::Node *shape_repr;
+    ShapeEditor* shape_editor;
+
+    bool space_panning;
 };
 
 /**
@@ -84,7 +83,7 @@ struct SPEventContext : public GObject {
 struct SPEventContextClass : public GObjectClass {
     void (* setup)(SPEventContext *ec);
     void (* finish)(SPEventContext *ec);
-    void (* set)(SPEventContext *ec, gchar const *key, gchar const *val);
+    void (* set)(SPEventContext *ec, Inkscape::Preferences::Entry *val);
     void (* activate)(SPEventContext *ec);
     void (* deactivate)(SPEventContext *ec);
     gint (* root_handler)(SPEventContext *ec, GdkEvent *event);
@@ -92,10 +91,11 @@ struct SPEventContextClass : public GObjectClass {
 };
 
 #define SP_EVENT_CONTEXT_DESKTOP(e) (SP_EVENT_CONTEXT(e)->desktop)
+#define SP_EVENT_CONTEXT_DOCUMENT(e) ((SP_EVENT_CONTEXT_DESKTOP(e))->doc())
 
 #define SP_EVENT_CONTEXT_STATIC 0
 
-SPEventContext *sp_event_context_new(GType type, SPDesktop *desktop, Inkscape::XML::Node *prefs_repr, unsigned key);
+SPEventContext *sp_event_context_new(GType type, SPDesktop *desktop, gchar const *pref_path, unsigned key);
 void sp_event_context_finish(SPEventContext *ec);
 void sp_event_context_read(SPEventContext *ec, gchar const *key);
 void sp_event_context_activate(SPEventContext *ec);
@@ -116,13 +116,17 @@ void sp_event_show_modifier_tip(Inkscape::MessageContext *message_context, GdkEv
 
 guint get_group0_keyval(GdkEventKey *event);
 
-SPItem *sp_event_context_find_item (SPDesktop *desktop, NR::Point const p, bool select_under, bool into_groups);
-SPItem *sp_event_context_over_item (SPDesktop *desktop, SPItem *item, NR::Point const p);
+SPItem *sp_event_context_find_item (SPDesktop *desktop, Geom::Point const &p, bool select_under, bool into_groups);
+SPItem *sp_event_context_over_item (SPDesktop *desktop, SPItem *item, Geom::Point const &p);
+
+ShapeEditor *sp_event_context_get_shape_editor (SPEventContext *ec);
 
 void ec_shape_event_attr_changed(Inkscape::XML::Node *shape_repr,
                                      gchar const *name, gchar const *old_value, gchar const *new_value,
                                  bool const is_interactive, gpointer const data);
 
+void event_context_print_event_info(GdkEvent *event, bool print_return = true);
+
 #endif