diff --git a/src/pen-context.cpp b/src/pen-context.cpp
index 5a60a7b5250fddaa621a1f116f5d2422a30d0be1..3267912752bb8378c1b0895e6f8d40173d8103a9 100644 (file)
--- a/src/pen-context.cpp
+++ b/src/pen-context.cpp
static void sp_pen_context_finish(SPEventContext *ec);
static void sp_pen_context_set(SPEventContext *ec, gchar const *key, gchar const *val);
static gint sp_pen_context_root_handler(SPEventContext *ec, GdkEvent *event);
+static gint sp_pen_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEvent *event);
static void spdc_pen_set_initial_point(SPPenContext *pc, NR::Point const p);
static void spdc_pen_set_subsequent_point(SPPenContext *pc, NR::Point const p, bool statusbar);
event_context_class->finish = sp_pen_context_finish;
event_context_class->set = sp_pen_context_set;
event_context_class->root_handler = sp_pen_context_root_handler;
+ event_context_class->item_handler = sp_pen_context_item_handler;
}
/**
@@ -284,6 +286,29 @@ spdc_endpoint_snap_handle(SPPenContext const *const pc, NR::Point &p, guint cons
spdc_endpoint_snap_free(pc, p, state);
}
+static gint
+sp_pen_context_item_handler(SPEventContext *ec, SPItem *item, GdkEvent *event)
+{
+ SPPenContext *const pc = SP_PEN_CONTEXT(ec);
+
+ gint ret = FALSE;
+
+ switch (event->type) {
+ case GDK_BUTTON_PRESS:
+ ret = pen_handle_button_press(pc, event->button);
+ break;
+ default:
+ break;
+ }
+
+ if (!ret) {
+ if (((SPEventContextClass *) pen_parent_class)->item_handler)
+ ret = ((SPEventContextClass *) pen_parent_class)->item_handler(ec, item, event);
+ }
+
+ return ret;
+}
+
/**
* Callback to handle all pen events.
*/
@@ -344,9 +369,10 @@ static gint pen_handle_button_press(SPPenContext *const pc, GdkEventButton const
SPDesktop * const desktop = SP_EVENT_CONTEXT_DESKTOP(dc);
NR::Point const event_w(bevent.x, bevent.y);
NR::Point const event_dt(desktop->w2d(event_w));
+ SPEventContext *event_context = SP_EVENT_CONTEXT(pc);
gint ret = FALSE;
- if (bevent.button == 1) {
+ if (bevent.button == 1 && !event_context->space_panning) {
if (Inkscape::have_viable_layer(desktop, dc->_message_context) == false) {
return TRUE;
{
gint ret = FALSE;
- if (mevent.state & GDK_BUTTON2_MASK || mevent.state & GDK_BUTTON3_MASK) {
- // allow middle-button scrolling
+ SPEventContext *event_context = SP_EVENT_CONTEXT(pc);
+
+ if (event_context->space_panning || mevent.state & GDK_BUTTON2_MASK || mevent.state & GDK_BUTTON3_MASK) {
+ // allow scrolling
return FALSE;
}
spdc_endpoint_snap_handle(pc, p, mevent.state);
spdc_pen_set_ctrl(pc, p, mevent.state);
+ gobble_motion_events(GDK_BUTTON1_MASK);
ret = TRUE;
break;
case SP_PEN_CONTEXT_STOP:
}
gint ret = FALSE;
- if ( revent.button == 1 ) {
+ SPEventContext *event_context = SP_EVENT_CONTEXT(pc);
+ if ( revent.button == 1 && !event_context->space_panning) {
SPDrawContext *dc = SP_DRAW_CONTEXT (pc);
@@ -1068,7 +1098,7 @@ spdc_pen_set_subsequent_point(SPPenContext *const pc, NR::Point const p, bool st
double angle = atan2(rel[NR::Y], rel[NR::X]) * 180 / M_PI;
if (prefs_get_int_attribute("options.compassangledisplay", "value", 0) != 0)
angle = angle_to_compass (angle);
- pc->_message_context->setF(Inkscape::NORMAL_MESSAGE, _("<b>%s</b>: angle %3.2f°, distance %s; with <b>Ctrl</b> to snap angle, <b>Enter</b> to finish the path"), is_curve? "Curve segment" : "Line segment", angle, dist->str);
+ pc->_message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>%s</b>: angle %3.2f°, distance %s; with <b>Ctrl</b> to snap angle, <b>Enter</b> to finish the path"), is_curve? "Curve segment" : "Line segment", angle, dist->str);
g_string_free(dist, FALSE);
}
}
@@ -1093,7 +1123,7 @@ spdc_pen_set_ctrl(SPPenContext *const pc, NR::Point const p, guint const state)
double angle = atan2(rel[NR::Y], rel[NR::X]) * 180 / M_PI;
if (prefs_get_int_attribute("options.compassangledisplay", "value", 0) != 0)
angle = angle_to_compass (angle);
- pc->_message_context->setF(Inkscape::NORMAL_MESSAGE, _("<b>Curve handle</b>: angle %3.2f°, length %s; with <b>Ctrl</b> to snap angle"), angle, dist->str);
+ pc->_message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>Curve handle</b>: angle %3.2f°, length %s; with <b>Ctrl</b> to snap angle"), angle, dist->str);
g_string_free(dist, FALSE);
} else if ( pc->npoints == 5 ) {
@@ -1123,7 +1153,7 @@ spdc_pen_set_ctrl(SPPenContext *const pc, NR::Point const p, guint const state)
double angle = atan2(rel[NR::Y], rel[NR::X]) * 180 / M_PI;
if (prefs_get_int_attribute("options.compassangledisplay", "value", 0) != 0)
angle = angle_to_compass (angle);
- pc->_message_context->setF(Inkscape::NORMAL_MESSAGE, _("<b>%s</b>: angle %3.2f°, length %s; with <b>Ctrl</b> to snap angle, with <b>Shift</b> to move this handle only"), is_symm? "Curve handle, symmetric" : "Curve handle", angle, dist->str);
+ pc->_message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("<b>%s</b>: angle %3.2f°, length %s; with <b>Ctrl</b> to snap angle, with <b>Shift</b> to move this handle only"), is_symm? "Curve handle, symmetric" : "Curve handle", angle, dist->str);
g_string_free(dist, FALSE);
} else {
@@ -1132,7 +1162,7 @@ spdc_pen_set_ctrl(SPPenContext *const pc, NR::Point const p, guint const state)
}
static void
-spdc_pen_finish_segment(SPPenContext *const pc, NR::Point const p, guint const state)
+spdc_pen_finish_segment(SPPenContext *const pc, NR::Point const /*p*/, guint const /*state*/)
{
if (!sp_curve_empty(pc->red_curve)) {
sp_curve_append_continuous(pc->green_curve, pc->red_curve, 0.0625);