diff --git a/src/pen-context.cpp b/src/pen-context.cpp
index c1d7af150f53aed7d56b9e3a19a48134a148aae7..0f8a4204a928b19217d7138eb31138e82466feb2 100644 (file)
--- a/src/pen-context.cpp
+++ b/src/pen-context.cpp
#include "sp-path.h"
#include "pixmaps/cursor-pen.xpm"
#include "sp-path.h"
#include "pixmaps/cursor-pen.xpm"
-#include "pixmaps/cursor-pen.pixbuf"
#include "display/canvas-bpath.h"
#include "display/sp-ctrlline.h"
#include "display/sodipodi-ctrl.h"
#include "display/canvas-bpath.h"
#include "display/sp-ctrlline.h"
#include "display/sodipodi-ctrl.h"
static gint pen_handle_key_press(SPPenContext *const pc, GdkEvent *event);
static void spdc_reset_colors(SPPenContext *pc);
static gint pen_handle_key_press(SPPenContext *const pc, GdkEvent *event);
static void spdc_reset_colors(SPPenContext *pc);
+static void pen_disable_events(SPPenContext *const pc);
+static void pen_enable_events(SPPenContext *const pc);
static NR::Point pen_drag_origin_w(0, 0);
static bool pen_within_tolerance = false;
static NR::Point pen_drag_origin_w(0, 0);
static bool pen_within_tolerance = false;
SPEventContext *event_context = SP_EVENT_CONTEXT(pc);
event_context->cursor_shape = cursor_pen_xpm;
SPEventContext *event_context = SP_EVENT_CONTEXT(pc);
event_context->cursor_shape = cursor_pen_xpm;
- event_context->cursor_pixbuf = gdk_pixbuf_new_from_inline(
- -1,
- cursor_pen_pixbuf,
- FALSE,
- NULL);
event_context->hot_x = 4;
event_context->hot_y = 4;
event_context->hot_x = 4;
event_context->hot_y = 4;
pc->c1 = NULL;
pc->cl0 = NULL;
pc->cl1 = NULL;
pc->c1 = NULL;
pc->cl0 = NULL;
pc->cl1 = NULL;
+
+ pc->events_disabled = 0;
}
/**
}
/**
sp_canvas_item_hide(pc->cl1);
pc->_message_context->clear();
pc->_message_context->flash(Inkscape::NORMAL_MESSAGE, _("Drawing cancelled"));
sp_canvas_item_hide(pc->cl1);
pc->_message_context->clear();
pc->_message_context->flash(Inkscape::NORMAL_MESSAGE, _("Drawing cancelled"));
+
+ sp_canvas_end_forced_full_redraws(pc->desktop->canvas);
}
/**
}
/**
*/
static gint pen_handle_button_press(SPPenContext *const pc, GdkEventButton const &bevent)
{
*/
static gint pen_handle_button_press(SPPenContext *const pc, GdkEventButton const &bevent)
{
+ if (pc->events_disabled) {
+ // skip event processing if events are disabled
+ return FALSE;
+ }
+
gint ret = FALSE;
if (bevent.button == 1) {
gint ret = FALSE;
if (bevent.button == 1) {
// allow middle-button scrolling
return FALSE;
}
// allow middle-button scrolling
return FALSE;
}
+
+ if (pc->events_disabled) {
+ // skip motion events if pen events are disabled
+ return FALSE;
+ }
NR::Point const event_w(mevent.x,
mevent.y);
NR::Point const event_w(mevent.x,
mevent.y);
static gint
pen_handle_button_release(SPPenContext *const pc, GdkEventButton const &revent)
{
static gint
pen_handle_button_release(SPPenContext *const pc, GdkEventButton const &revent)
{
+ if (pc->events_disabled) {
+ // skip event processing if events are disabled
+ return FALSE;
+ }
+
gint ret = FALSE;
if ( revent.button == 1 ) {
gint ret = FALSE;
if ( revent.button == 1 ) {
pc->p[1] = p;
pc->npoints = 2;
sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), NULL);
pc->p[1] = p;
pc->npoints = 2;
sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), NULL);
+
+ sp_canvas_force_full_redraw_after_interruptions(pc->desktop->canvas, 5);
}
static void
}
static void
@@ -1031,6 +1048,7 @@ spdc_pen_set_subsequent_point(SPPenContext *const pc, NR::Point const p, bool st
sp_curve_lineto(pc->red_curve, p);
is_curve = false;
}
sp_curve_lineto(pc->red_curve, p);
is_curve = false;
}
+
sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), pc->red_curve);
if (statusbar) {
sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), pc->red_curve);
if (statusbar) {
@@ -1128,6 +1146,8 @@ spdc_pen_finish_segment(SPPenContext *const pc, NR::Point const p, guint const s
static void
spdc_pen_finish(SPPenContext *const pc, gboolean const closed)
{
static void
spdc_pen_finish(SPPenContext *const pc, gboolean const closed)
{
+ pen_disable_events(pc);
+
SPDesktop *const desktop = pc->desktop;
pc->_message_context->clear();
desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Drawing finished"));
SPDesktop *const desktop = pc->desktop;
pc->_message_context->clear();
desktop->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Drawing finished"));
if (pc->green_anchor) {
pc->green_anchor = sp_draw_anchor_destroy(pc->green_anchor);
}
if (pc->green_anchor) {
pc->green_anchor = sp_draw_anchor_destroy(pc->green_anchor);
}
+
+
+ sp_canvas_end_forced_full_redraws(pc->desktop->canvas);
+
+ pen_enable_events(pc);
}
}
+static void
+pen_disable_events(SPPenContext *const pc) {
+ pc->events_disabled++;
+}
+
+static void
+pen_enable_events(SPPenContext *const pc) {
+ g_return_if_fail(pc->events_disabled != 0);
+
+ pc->events_disabled--;
+}
/*
Local Variables:
/*
Local Variables: