summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4a148d6)
raw | patch | inline | side by side (parent: 4a148d6)
author | cilix42 <cilix42@users.sourceforge.net> | |
Thu, 14 Aug 2008 14:11:18 +0000 (14:11 +0000) | ||
committer | cilix42 <cilix42@users.sourceforge.net> | |
Thu, 14 Aug 2008 14:11:18 +0000 (14:11 +0000) |
src/eraser-context.cpp | patch | blob | history |
diff --git a/src/eraser-context.cpp b/src/eraser-context.cpp
index 559ce28667e7ba224aaf630fd69d367caa3b74ae..f6df71dc29f73d5436e89ca78bd02ace6b1e62cf 100644 (file)
--- a/src/eraser-context.cpp
+++ b/src/eraser-context.cpp
sp_eraser_context_setup(SPEventContext *ec)
{
SPEraserContext *erc = SP_ERASER_CONTEXT(ec);
+ SPDesktop *desktop = ec->desktop;
if (((SPEventContextClass *) eraser_parent_class)->setup)
((SPEventContextClass *) eraser_parent_class)->setup(ec);
erc->cal1 = new SPCurve();
erc->cal2 = new SPCurve();
- erc->currentshape = sp_canvas_item_new(sp_desktop_sketch(ec->desktop), SP_TYPE_CANVAS_BPATH, NULL);
+ erc->currentshape = sp_canvas_item_new(sp_desktop_sketch(desktop), SP_TYPE_CANVAS_BPATH, NULL);
sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(erc->currentshape), ERC_RED_RGBA, SP_WIND_RULE_EVENODD);
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(erc->currentshape), 0x00000000, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
/* fixme: Cannot we cascade it to root more clearly? */
- g_signal_connect(G_OBJECT(erc->currentshape), "event", G_CALLBACK(sp_desktop_root_handler), ec->desktop);
+ g_signal_connect(G_OBJECT(erc->currentshape), "event", G_CALLBACK(sp_desktop_root_handler), desktop);
/*
static ProfileFloatElement f_profile[PROFILE_FLOAT_SIZE] = {
erc->is_drawing = false;
- erc->_message_context = new Inkscape::MessageContext((ec->desktop)->messageStack());
+ erc->_message_context = new Inkscape::MessageContext(desktop->messageStack());
if (prefs_get_int_attribute("tools.eraser", "selcue", 0) != 0) {
ec->enableSelectionCue();
case GDK_BUTTON_PRESS:
if (event->button.button == 1 && !event_context->space_panning) {
- SPDesktop *desktop = SP_EVENT_CONTEXT_DESKTOP(dc);
-
if (Inkscape::have_viable_layer(desktop, dc->_message_context) == false) {
return TRUE;
}
static void
fit_and_split(SPEraserContext *dc, gboolean release)
{
- double const tolerance_sq = square( NR::expansion(SP_EVENT_CONTEXT(dc)->desktop->w2d()) * TOLERANCE_ERASER );
+ SPDesktop *desktop = SP_EVENT_CONTEXT(dc)->desktop;
+
+ double const tolerance_sq = square( NR::expansion(desktop->w2d()) * TOLERANCE_ERASER );
#ifdef ERASER_VERBOSE
g_print("[F&S:R=%c]", release?'T':'F');
gint eraserMode = (prefs_get_int_attribute("tools.eraser", "mode", 0) != 0) ? 1 : 0;
g_assert(!dc->currentcurve->is_empty());
- SPCanvasItem *cbp = sp_canvas_item_new(sp_desktop_sketch(SP_EVENT_CONTEXT(dc)->desktop),
+ SPCanvasItem *cbp = sp_canvas_item_new(sp_desktop_sketch(desktop),
SP_TYPE_CANVAS_BPATH,
NULL);
SPCurve *curve = dc->currentcurve->copy();
sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH (cbp), curve);
curve->unref();
- guint32 fillColor = sp_desktop_get_color_tool (SP_ACTIVE_DESKTOP, "tools.eraser", true);
- //guint32 strokeColor = sp_desktop_get_color_tool (SP_ACTIVE_DESKTOP, "tools.eraser", false);
- double opacity = sp_desktop_get_master_opacity_tool (SP_ACTIVE_DESKTOP, "tools.eraser");
- double fillOpacity = sp_desktop_get_opacity_tool (SP_ACTIVE_DESKTOP, "tools.eraser", true);
- //double strokeOpacity = sp_desktop_get_opacity_tool (SP_ACTIVE_DESKTOP, "tools.eraser", false);
+ guint32 fillColor = sp_desktop_get_color_tool (desktop, "tools.eraser", true);
+ //guint32 strokeColor = sp_desktop_get_color_tool (desktop, "tools.eraser", false);
+ double opacity = sp_desktop_get_master_opacity_tool (desktop, "tools.eraser");
+ double fillOpacity = sp_desktop_get_opacity_tool (desktop, "tools.eraser", true);
+ //double strokeOpacity = sp_desktop_get_opacity_tool (desktop, "tools.eraser", false);
sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(cbp), ((fillColor & 0xffffff00) | SP_COLOR_F_TO_U(opacity*fillOpacity)), SP_WIND_RULE_EVENODD);
//on second thougtht don't do stroke yet because we don't have stoke-width yet and because stoke appears between segments while drawing
//sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(cbp), ((strokeColor & 0xffffff00) | SP_COLOR_F_TO_U(opacity*strokeOpacity)), 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(cbp), 0x00000000, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
/* fixme: Cannot we cascade it to root more clearly? */
- g_signal_connect(G_OBJECT(cbp), "event", G_CALLBACK(sp_desktop_root_handler), SP_EVENT_CONTEXT(dc)->desktop);
+ g_signal_connect(G_OBJECT(cbp), "event", G_CALLBACK(sp_desktop_root_handler), desktop);
dc->segments = g_slist_prepend(dc->segments, cbp);