From 12aa75f73fc4de4f4d504085cd32a80983eab623 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Wed, 5 Sep 2012 18:06:23 +0200 Subject: Freehand. Fix for Bug #597136 (dots are created with wrong cy value). (bzr r11653) --- src/draw-context.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/draw-context.cpp') diff --git a/src/draw-context.cpp b/src/draw-context.cpp index 2e490d184..e33c94bda 100644 --- a/src/draw-context.cpp +++ b/src/draw-context.cpp @@ -808,7 +808,7 @@ void spdc_create_single_dot(SPEventContext *ec, Geom::Point const &pt, char cons Inkscape::Preferences *prefs = Inkscape::Preferences::get(); Geom::Affine const i2d (item->i2dt_affine ()); - Geom::Point pp = pt; + Geom::Point pp = pt * i2d.inverse(); double rad = 0.5 * prefs->getDouble(tool_path + "/dot-size", 3.0); if (event_state & GDK_MOD1_MASK) { // TODO: We vary the dot size between 0.5*rad and 1.5*rad, where rad is the dot size @@ -827,7 +827,6 @@ void spdc_create_single_dot(SPEventContext *ec, Geom::Point const &pt, char cons sp_repr_set_svg_double (repr, "sodipodi:rx", rad * stroke_width); sp_repr_set_svg_double (repr, "sodipodi:ry", rad * stroke_width); item->updateRepr(); - item->set_item_transform(i2d.inverse()); sp_desktop_selection(desktop)->set(item); -- cgit v1.2.3 From 370a3f5cc9e39352a081e5d5dd8c43676547a6e6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 4 Oct 2012 11:45:44 +1000 Subject: code cleanup: add own includes to cpp files or make the functions static if they are not used elsewhere. (bzr r11735) --- src/draw-context.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/draw-context.cpp') diff --git a/src/draw-context.cpp b/src/draw-context.cpp index e33c94bda..daff0794a 100644 --- a/src/draw-context.cpp +++ b/src/draw-context.cpp @@ -44,6 +44,7 @@ #include "live_effects/lpe-powerstroke.h" #include "style.h" #include "ui/control-manager.h" +#include "draw-context.h" #include @@ -304,7 +305,7 @@ static void spdc_apply_powerstroke_shape(const std::vector & points lpe->getRepr()->setAttribute("interpolator_beta", "0.2"); } -void spdc_check_for_and_apply_waiting_LPE(SPDrawContext *dc, SPItem *item, SPCurve *curve) +static void spdc_check_for_and_apply_waiting_LPE(SPDrawContext *dc, SPItem *item, SPCurve *curve) { using namespace Inkscape::LivePathEffect; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); -- cgit v1.2.3 From fdf3d28700bcaf1bd678b15d2404ea5580302890 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Sat, 27 Oct 2012 20:43:56 +0100 Subject: cppcheck: get rid of more C-style pointer casts (bzr r11840) --- src/draw-context.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/draw-context.cpp') diff --git a/src/draw-context.cpp b/src/draw-context.cpp index daff0794a..5996d600b 100644 --- a/src/draw-context.cpp +++ b/src/draw-context.cpp @@ -104,9 +104,9 @@ static void sp_draw_context_class_init(SPDrawContextClass *klass) SPEventContextClass *ec_class; object_class = (GObjectClass *)klass; - ec_class = (SPEventContextClass *) klass; + ec_class = SP_EVENT_CONTEXT_CLASS(klass); - draw_parent_class = (SPEventContextClass*)g_type_class_peek_parent(klass); + draw_parent_class = SP_EVENT_CONTEXT_CLASS(g_type_class_peek_parent(klass)); object_class->dispose = sp_draw_context_dispose; @@ -175,8 +175,8 @@ static void sp_draw_context_setup(SPEventContext *ec) SPDrawContext *dc = SP_DRAW_CONTEXT(ec); SPDesktop *dt = ec->desktop; - if (((SPEventContextClass *) draw_parent_class)->setup) { - ((SPEventContextClass *) draw_parent_class)->setup(ec); + if ((SP_EVENT_CONTEXT_CLASS(draw_parent_class))->setup) { + (SP_EVENT_CONTEXT_CLASS(draw_parent_class))->setup(ec); } dc->selection = sp_desktop_selection(dt); @@ -261,8 +261,8 @@ gint sp_draw_context_root_handler(SPEventContext *ec, GdkEvent *event) } if (!ret) { - if (((SPEventContextClass *) draw_parent_class)->root_handler) { - ret = ((SPEventContextClass *) draw_parent_class)->root_handler(ec, event); + if ((SP_EVENT_CONTEXT_CLASS(draw_parent_class))->root_handler) { + ret = (SP_EVENT_CONTEXT_CLASS(draw_parent_class))->root_handler(ec, event); } } @@ -700,7 +700,7 @@ SPDrawAnchor *spdc_test_inside(SPDrawContext *dc, Geom::Point p) } for (GSList *l = dc->white_anchors; l != NULL; l = l->next) { - SPDrawAnchor *na = sp_draw_anchor_test((SPDrawAnchor *) l->data, p, !active); + SPDrawAnchor *na = sp_draw_anchor_test(static_cast(l->data), p, !active); if ( !active && na ) { active = na; } @@ -720,7 +720,7 @@ static void spdc_reset_white(SPDrawContext *dc) dc->white_curves = g_slist_remove(dc->white_curves, dc->white_curves->data); } while (dc->white_anchors) { - sp_draw_anchor_destroy((SPDrawAnchor *) dc->white_anchors->data); + sp_draw_anchor_destroy(static_cast(dc->white_anchors->data)); dc->white_anchors = g_slist_remove(dc->white_anchors, dc->white_anchors->data); } } @@ -767,7 +767,7 @@ static void spdc_free_colors(SPDrawContext *dc) dc->white_curves = g_slist_remove(dc->white_curves, dc->white_curves->data); } while (dc->white_anchors) { - sp_draw_anchor_destroy((SPDrawAnchor *) dc->white_anchors->data); + sp_draw_anchor_destroy(static_cast(dc->white_anchors->data)); dc->white_anchors = g_slist_remove(dc->white_anchors, dc->white_anchors->data); } } -- cgit v1.2.3 From cd0794c0d76a46a0ae47b6c450167015ee41bc35 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Thu, 17 Jan 2013 00:59:37 +0000 Subject: Cleanup more GObject type definitions (bzr r12034) --- src/draw-context.cpp | 36 ++++++------------------------------ 1 file changed, 6 insertions(+), 30 deletions(-) (limited to 'src/draw-context.cpp') diff --git a/src/draw-context.cpp b/src/draw-context.cpp index 5996d600b..e62435004 100644 --- a/src/draw-context.cpp +++ b/src/draw-context.cpp @@ -50,8 +50,6 @@ using Inkscape::DocumentUndo; -static void sp_draw_context_class_init(SPDrawContextClass *klass); -static void sp_draw_context_init(SPDrawContext *dc); static void sp_draw_context_dispose(GObject *object); static void sp_draw_context_setup(SPEventContext *ec); @@ -76,27 +74,7 @@ static void spdc_flush_white(SPDrawContext *dc, SPCurve *gc); static void spdc_reset_white(SPDrawContext *dc); static void spdc_free_colors(SPDrawContext *dc); - -static SPEventContextClass *draw_parent_class; - -GType sp_draw_context_get_type(void) -{ - static GType type = 0; - if (!type) { - GTypeInfo info = { - sizeof(SPDrawContextClass), - NULL, NULL, - (GClassInitFunc) sp_draw_context_class_init, - NULL, NULL, - sizeof(SPDrawContext), - 4, - (GInstanceInitFunc) sp_draw_context_init, - NULL, // value_table - }; - type = g_type_register_static(SP_TYPE_EVENT_CONTEXT, "SPDrawContext", &info, (GTypeFlags)0); - } - return type; -} +G_DEFINE_TYPE(SPDrawContext, sp_draw_context, SP_TYPE_EVENT_CONTEXT); static void sp_draw_context_class_init(SPDrawContextClass *klass) { @@ -106,8 +84,6 @@ static void sp_draw_context_class_init(SPDrawContextClass *klass) object_class = (GObjectClass *)klass; ec_class = SP_EVENT_CONTEXT_CLASS(klass); - draw_parent_class = SP_EVENT_CONTEXT_CLASS(g_type_class_peek_parent(klass)); - object_class->dispose = sp_draw_context_dispose; ec_class->setup = sp_draw_context_setup; @@ -167,7 +143,7 @@ static void sp_draw_context_dispose(GObject *object) spdc_free_colors(dc); - G_OBJECT_CLASS(draw_parent_class)->dispose(object); + G_OBJECT_CLASS(sp_draw_context_parent_class)->dispose(object); } static void sp_draw_context_setup(SPEventContext *ec) @@ -175,8 +151,8 @@ static void sp_draw_context_setup(SPEventContext *ec) SPDrawContext *dc = SP_DRAW_CONTEXT(ec); SPDesktop *dt = ec->desktop; - if ((SP_EVENT_CONTEXT_CLASS(draw_parent_class))->setup) { - (SP_EVENT_CONTEXT_CLASS(draw_parent_class))->setup(ec); + if ((SP_EVENT_CONTEXT_CLASS(sp_draw_context_parent_class))->setup) { + (SP_EVENT_CONTEXT_CLASS(sp_draw_context_parent_class))->setup(ec); } dc->selection = sp_desktop_selection(dt); @@ -261,8 +237,8 @@ gint sp_draw_context_root_handler(SPEventContext *ec, GdkEvent *event) } if (!ret) { - if ((SP_EVENT_CONTEXT_CLASS(draw_parent_class))->root_handler) { - ret = (SP_EVENT_CONTEXT_CLASS(draw_parent_class))->root_handler(ec, event); + if ((SP_EVENT_CONTEXT_CLASS(sp_draw_context_parent_class))->root_handler) { + ret = (SP_EVENT_CONTEXT_CLASS(sp_draw_context_parent_class))->root_handler(ec, event); } } -- cgit v1.2.3