From c274048bc7fb9c71372a1d4e197c3d930c1b72bb Mon Sep 17 00:00:00 2001 From: buliabyak Date: Tue, 21 Aug 2007 01:37:25 +0000 Subject: [PATCH] gobble more of motion events; make statusbar messages immediate for better visual feedback --- src/arc-context.cpp | 6 ++++-- src/pen-context.cpp | 7 ++++--- src/rect-context.cpp | 4 ++-- src/spiral-context.cpp | 6 ++++-- src/star-context.cpp | 5 ++++- src/text-context.cpp | 3 ++- src/zoom-context.cpp | 1 + 7 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/arc-context.cpp b/src/arc-context.cpp index 44c85bf0b..d5a25b61b 100644 --- a/src/arc-context.cpp +++ b/src/arc-context.cpp @@ -291,9 +291,11 @@ static gint sp_arc_context_root_handler(SPEventContext *event_context, GdkEvent SnapManager const &m = desktop->namedview->snap_manager; motion_dt = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, motion_dt, ac->item).getPoint(); - sp_arc_drag(ac, motion_dt, event->motion.state); + + gobble_motion_events(GDK_BUTTON1_MASK); + ret = TRUE; } break; @@ -439,7 +441,7 @@ static void sp_arc_drag(SPArcContext *ac, NR::Point pt, guint state) GString *xs = SP_PX_TO_METRIC_STRING(r.dimensions()[NR::X], desktop->namedview->getDefaultMetric()); GString *ys = SP_PX_TO_METRIC_STRING(r.dimensions()[NR::Y], desktop->namedview->getDefaultMetric()); - ac->_message_context->setF(Inkscape::NORMAL_MESSAGE, _("Ellipse: %s × %s; with Ctrl to make circle or integer-ratio ellipse; with Shift to draw around the starting point"), xs->str, ys->str); + ac->_message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("Ellipse: %s × %s; with Ctrl to make circle or integer-ratio ellipse; with Shift to draw around the starting point"), xs->str, ys->str); g_string_free(xs, FALSE); g_string_free(ys, FALSE); } diff --git a/src/pen-context.cpp b/src/pen-context.cpp index 53ee7df6d..76fc3a61b 100644 --- a/src/pen-context.cpp +++ b/src/pen-context.cpp @@ -615,6 +615,7 @@ pen_handle_motion_notify(SPPenContext *const pc, GdkEventMotion const &mevent) 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: @@ -1097,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, _("%s: angle %3.2f°, distance %s; with Ctrl to snap angle, Enter to finish the path"), is_curve? "Curve segment" : "Line segment", angle, dist->str); + pc->_message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("%s: angle %3.2f°, distance %s; with Ctrl to snap angle, Enter to finish the path"), is_curve? "Curve segment" : "Line segment", angle, dist->str); g_string_free(dist, FALSE); } } @@ -1122,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, _("Curve handle: angle %3.2f°, length %s; with Ctrl to snap angle"), angle, dist->str); + pc->_message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("Curve handle: angle %3.2f°, length %s; with Ctrl to snap angle"), angle, dist->str); g_string_free(dist, FALSE); } else if ( pc->npoints == 5 ) { @@ -1152,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, _("%s: angle %3.2f°, length %s; with Ctrl to snap angle, with Shift to move this handle only"), is_symm? "Curve handle, symmetric" : "Curve handle", angle, dist->str); + pc->_message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("%s: angle %3.2f°, length %s; with Ctrl to snap angle, with Shift to move this handle only"), is_symm? "Curve handle, symmetric" : "Curve handle", angle, dist->str); g_string_free(dist, FALSE); } else { diff --git a/src/rect-context.cpp b/src/rect-context.cpp index 71683ec8e..9c25f91c0 100644 --- a/src/rect-context.cpp +++ b/src/rect-context.cpp @@ -333,7 +333,7 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent motion_dt = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, motion_dt, rc->item).getPoint(); sp_rect_drag(*rc, motion_dt, event->motion.state); - + gobble_motion_events(GDK_BUTTON1_MASK); ret = TRUE; } break; @@ -489,7 +489,7 @@ static void sp_rect_drag(SPRectContext &rc, NR::Point const pt, guint state) // status text GString *xs = SP_PX_TO_METRIC_STRING(r.dimensions()[NR::X], desktop->namedview->getDefaultMetric()); GString *ys = SP_PX_TO_METRIC_STRING(r.dimensions()[NR::Y], desktop->namedview->getDefaultMetric()); - rc._message_context->setF(Inkscape::NORMAL_MESSAGE, _("Rectangle: %s × %s; with Ctrl to make square or integer-ratio rectangle; with Shift to draw around the starting point"), xs->str, ys->str); + rc._message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("Rectangle: %s × %s; with Ctrl to make square or integer-ratio rectangle; with Shift to draw around the starting point"), xs->str, ys->str); g_string_free(xs, FALSE); g_string_free(ys, FALSE); } diff --git a/src/spiral-context.cpp b/src/spiral-context.cpp index 4e0fd9878..6dbdb74c9 100644 --- a/src/spiral-context.cpp +++ b/src/spiral-context.cpp @@ -293,8 +293,10 @@ sp_spiral_context_root_handler(SPEventContext *event_context, GdkEvent *event) SnapManager const &m = desktop->namedview->snap_manager; motion_dt = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, motion_dt, sc->item).getPoint(); - sp_spiral_drag(sc, motion_dt, event->motion.state); + + gobble_motion_events(GDK_BUTTON1_MASK); + ret = TRUE; } break; @@ -455,7 +457,7 @@ sp_spiral_drag(SPSpiralContext *sc, NR::Point p, guint state) /* status text */ GString *rads = SP_PX_TO_METRIC_STRING(rad, desktop->namedview->getDefaultMetric()); - sc->_message_context->setF(Inkscape::NORMAL_MESSAGE, + sc->_message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("Spiral: radius %s, angle %5g°; with Ctrl to snap angle"), rads->str, sp_round((arg + 2.0*M_PI*spiral->revo)*180/M_PI, 0.0001)); g_string_free(rads, FALSE); diff --git a/src/star-context.cpp b/src/star-context.cpp index 385d16d0c..73e230deb 100644 --- a/src/star-context.cpp +++ b/src/star-context.cpp @@ -305,6 +305,9 @@ static gint sp_star_context_root_handler(SPEventContext *event_context, GdkEvent motion_dt = m.freeSnap(Inkscape::Snapper::SNAPPOINT_NODE, motion_dt, sc->item).getPoint(); sp_star_drag (sc, motion_dt, event->motion.state); + + gobble_motion_events(GDK_BUTTON1_MASK); + ret = TRUE; } break; @@ -463,7 +466,7 @@ static void sp_star_drag(SPStarContext *sc, NR::Point p, guint state) /* status text */ GString *rads = SP_PX_TO_METRIC_STRING(r1, desktop->namedview->getDefaultMetric()); - sc->_message_context->setF(Inkscape::NORMAL_MESSAGE, + sc->_message_context->setF(Inkscape::IMMEDIATE_MESSAGE, ( sc->isflatsided? _("Polygon: radius %s, angle %5g°; with Ctrl to snap angle") : _("Star: radius %s, angle %5g°; with Ctrl to snap angle") ), diff --git a/src/text-context.cpp b/src/text-context.cpp index 8f6d6f1e3..3bf9dc5a8 100644 --- a/src/text-context.cpp +++ b/src/text-context.cpp @@ -429,6 +429,7 @@ sp_text_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEve sp_text_context_update_cursor(tc); sp_text_context_update_text_selection(tc); } + gobble_motion_events(GDK_BUTTON1_MASK); ret = TRUE; break; } @@ -655,7 +656,7 @@ sp_text_context_root_handler(SPEventContext *const event_context, GdkEvent *cons // status text GString *xs = SP_PX_TO_METRIC_STRING(fabs((p - tc->p0)[NR::X]), desktop->namedview->getDefaultMetric()); GString *ys = SP_PX_TO_METRIC_STRING(fabs((p - tc->p0)[NR::Y]), desktop->namedview->getDefaultMetric()); - event_context->_message_context->setF(Inkscape::NORMAL_MESSAGE, _("Flowed text frame: %s × %s"), xs->str, ys->str); + event_context->_message_context->setF(Inkscape::IMMEDIATE_MESSAGE, _("Flowed text frame: %s × %s"), xs->str, ys->str); g_string_free(xs, FALSE); g_string_free(ys, FALSE); diff --git a/src/zoom-context.cpp b/src/zoom-context.cpp index 64b468e36..71dca4846 100644 --- a/src/zoom-context.cpp +++ b/src/zoom-context.cpp @@ -165,6 +165,7 @@ static gint sp_zoom_context_root_handler(SPEventContext *event_context, GdkEvent NR::Point const motion_w(event->motion.x, event->motion.y); NR::Point const motion_dt(desktop->w2d(motion_w)); Inkscape::Rubberband::get()->move(motion_dt); + gobble_motion_events(GDK_BUTTON1_MASK); } break; -- 2.30.2