summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f487c6e)
raw | patch | inline | side by side (parent: f487c6e)
author | joncruz <joncruz@users.sourceforge.net> | |
Sat, 26 Apr 2008 09:07:28 +0000 (09:07 +0000) | ||
committer | joncruz <joncruz@users.sourceforge.net> | |
Sat, 26 Apr 2008 09:07:28 +0000 (09:07 +0000) |
diff --git a/share/icons/icons.svg b/share/icons/icons.svg
index 566796c2aada0d668b5271abf08c9938f8fc1cb5..c743768ac1957c6a919cfa4905229fb4a77b5345 100644 (file)
--- a/share/icons/icons.svg
+++ b/share/icons/icons.svg
offset="1"
id="stop7700" />
</linearGradient>
+ <linearGradient
+ id="eraserFill">
+ <stop
+ id="stop5742_1"
+ offset="0.0000000"
+ style="stop-color:#ffffff;stop-opacity:1.0000000;" />
+ <stop
+ id="stop5744_1"
+ offset="1.0000000"
+ style="stop-color:#f3b698;stop-opacity:1.0000000;" />
+ </linearGradient>
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#eraserFill"
+ id="linearGradient7424"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(1.13356,0,0,1.133368,339.5737,-131.407)"
+ x1="101.09393"
+ y1="221.06877"
+ x2="112.20101"
+ y2="234.00311" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#eraserFill"
+ id="linearGradient7426"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.809546,0,0,0.809417,342.9983,-4.125322)"
+ x1="144.08243"
+ y1="157.82079"
+ x2="176.86269"
+ y2="188.41277" />
</defs>
<sodipodi:namedview
inkscape:guide-bbox="true"
- inkscape:current-layer="svg1"
+ inkscape:current-layer="draw_erase"
inkscape:grid-bbox="true"
inkscape:pageopacity="1.0000000"
pagecolor="#e8e8e4"
snaptoguides="true"
showguides="true"
- inkscape:window-y="1"
+ inkscape:window-y="25"
inkscape:window-x="0"
- inkscape:window-height="736"
+ inkscape:window-height="738"
inkscape:window-width="1024"
- inkscape:cy="1158.7494"
- inkscape:cx="363.21262"
+ inkscape:cy="797.23533"
+ inkscape:cx="497.81067"
inkscape:zoom="2.5780463"
gridtolerance="6"
snaptogrid="false"
transform="translate(94.91614,59)"
id="rect10884" />
</g>
+ <g
+ id="delete_object"
+ transform="translate(-79.87527,156.0)"
+ inkscape:label="#delete_object">
+ <rect
+ style="opacity:1;color:none;fill:none;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:0;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:inline"
+ id="rect10920"
+ width="16"
+ height="16"
+ x="314"
+ y="210" />
+ <path
+ style="opacity:1;color:black;fill:none;fill-opacity:0.70196078;fill-rule:evenodd;stroke:#c80000;stroke-width:1.00000024;stroke-linecap:butt;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:0;stroke-dasharray:1, 1;stroke-dashoffset:0;stroke-opacity:1;display:inline"
+ d="M 220.5,155.5625 L 220.5,165.5 L 230.59375,165.5 L 230.59375,161.375 C 230.38772,161.39844 230.21227,161.5 230,161.5 C 226.964,161.5 224.5,159.036 224.5,156 C 224.5,155.84348 224.58091,155.71572 224.59375,155.5625 L 220.5,155.5625 z "
+ transform="translate(94.91614,59)" />
+ <use
+ transform="translate(-652,41)"
+ x="0"
+ y="0"
+ xlink:href="#g5771"
+ id="use5777"
+ width="12"
+ height="12" />
+ </g>
<g
id="cut_path"
transform="translate(-79.87527,-23.96088)"
width="1250"
height="1250" />
</g>
+ <g
+ id="draw_erase"
+ transform="translate(1.5,359.5)">
+ <rect
+ style="color:#000000;fill:none;stroke:none;stroke-width:1.00000012;marker:none;marker-start:none;marker-mid:none;marker-end:none;display:inline"
+ id="rect7418"
+ width="24"
+ height="24"
+ x="450"
+ y="115" />
+<g transform="rotate(30 462 127)">
+ <rect
+ style="color:#000000;fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;marker-start:none;marker-mid:none;marker-end:none;display:inline"
+ id="rect7420"
+ width="10.991669"
+ height="18.991783"
+ x="456.50833"
+ y="117.50822" />
+ <rect
+ style="color:#000000;fill:url(#linearGradient7424);fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient7426);stroke-width:0.99999982;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:0;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;marker-start:none;marker-mid:none;marker-end:none;display:inline"
+ id="rect7422"
+ width="9"
+ height="17"
+ x="457.5"
+ y="118.5" />
+</g>
+ </g>
</svg>
diff --git a/src/Makefile_insert b/src/Makefile_insert
index c4f196dd5cd82e754a178c31ee96ad459bc569f7..48201344e545949ea35ef84d63c70ef4e6225a7d 100644 (file)
--- a/src/Makefile_insert
+++ b/src/Makefile_insert
dropper-context.cpp dropper-context.h \
dyna-draw-context.cpp dyna-draw-context.h \
enums.h \
+ eraser-context.cpp eraser-context.h \
event-context.cpp event-context.h \
event-log.cpp event-log.h event.h \
extract-uri.cpp extract-uri.h \
index f60101b4c9ec8a18697536d5d3ae1a1cd27ec2ae..939be9a821c59c6a89d164947957cc0936db06b1 100644 (file)
" <group id=\"cp4\" name=\"Mad brush\" usetilt=\"1\" tracebackground=\"0\" usepressure=\"1\" width=\"15\" cap_rounding=\"0.1\" flatness=\"0.16\" tremor=\"0.18\" thinning=\"-0.3\" angle=\"30\" wiggle=\"0.48\" mass=\"0.02\" />\n"
" </group>\n"
" </eventcontext>\n"
+" <eventcontext id=\"eraser\" mode=\"0\" style=\"fill:black;fill-opacity:1;fill-rule:nonzero;stroke:none;\"\n"
+" mass=\"0.02\" drag=\"1\" angle=\"30\" width=\"0.15\" thinning=\"0.1\" flatness=\"0.9\" cap_rounding=\"0.0\" usecurrent=\"1\"\n"
+" tracebackground=\"0\" usepressure=\"1\" usetilt=\"0\" selcue=\"1\">\n"
+" </eventcontext>\n"
" <eventcontext id=\"text\" usecurrent=\"0\" gradientdrag=\"1\"\n"
" font_sample=\"AaBbCcIiPpQq12369$\342\202\254\302\242?.;/()\"\n"
" style=\"fill:black;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;font-style:normal;font-weight:normal;font-size:40px;\" selcue=\"1\"/>\n"
diff --git a/src/tools-switch.cpp b/src/tools-switch.cpp
index 11e3ff5b4ae97a7c76dd26980a936393a9e42a78..e32d8d13d27610869513e3455b97b084443a8a2a 100644 (file)
--- a/src/tools-switch.cpp
+++ b/src/tools-switch.cpp
#include "spiral-context.h"
#include "sp-spiral.h"
#include "dyna-draw-context.h"
+#include "eraser-context.h"
#include "pen-context.h"
#include "pencil-context.h"
#include "text-context.h"
"tools.dropper",
"tools.connector",
"tools.paintbucket",
+ "tools.eraser",
NULL
};
"dropper",
"connector",
"paintbucket",
+ "eraser",
NULL
};
inkscape_eventcontext_set(sp_desktop_event_context(dt));
dt->tipsMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("<b>Click</b> to paint a bounded area, <b>Shift+click</b> to union the new fill with the current selection, <b>Ctrl+click</b> to change the clicked object's fill and stroke to the current setting."));
break;
+ case TOOLS_ERASER:
+ dt->set_event_context(SP_TYPE_ERASER_CONTEXT, tool_names[num]);
+ dt->activate_guides(false);
+ inkscape_eventcontext_set(sp_desktop_event_context(dt));
+ dt->tipsMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("<b>Drag</b> to erase."));
+ break;
}
}
diff --git a/src/tools-switch.h b/src/tools-switch.h
index 8107984a88a9477b1154f49d8d9578700c63db5e..f5a3220ca32b012b865fb92b211ce48fa5d41999 100644 (file)
--- a/src/tools-switch.h
+++ b/src/tools-switch.h
TOOLS_ZOOM,
TOOLS_DROPPER,
TOOLS_CONNECTOR,
- TOOLS_PAINTBUCKET
+ TOOLS_PAINTBUCKET,
+ TOOLS_ERASER
};
int tools_isactive(SPDesktop *dt, unsigned num);
index fbcdc665bf6799f215dfc0f7c67dae50f88dda42..6660e6273f58643a09dcbbcc89cc0dc2c5562e5e 100644 (file)
this->AddPage(_page_paintbucket, _("Paint Bucket"), iter_tools, PREFS_PAGE_TOOLS_PAINTBUCKET);
this->AddSelcueCheckbox(_page_paintbucket, "tools.paintbucket", false);
this->AddNewObjectsStyle(_page_paintbucket, "tools.paintbucket");
+ //Calligraphy
+ this->AddPage(_page_eraser, _("Eraser"), iter_tools, PREFS_PAGE_TOOLS_ERASER);
//Text
this->AddPage(_page_text, _("Text"), iter_tools, PREFS_PAGE_TOOLS_TEXT);
this->AddSelcueCheckbox(_page_text, "tools.text", true);
index 6e8b6d0001b0d18d9c41f78089abb594d4fe134b..a1a577b95710165057b284ed72f9eddad53fa0af 100644 (file)
PREFS_PAGE_TOOLS_PEN,
PREFS_PAGE_TOOLS_CALLIGRAPHY,
PREFS_PAGE_TOOLS_PAINTBUCKET,
+ PREFS_PAGE_TOOLS_ERASER,
PREFS_PAGE_TOOLS_TEXT,
PREFS_PAGE_TOOLS_GRADIENT,
PREFS_PAGE_TOOLS_CONNECTOR,
_page_importexport, _page_cms, _page_grids, _page_misc;
DialogPage _page_selector, _page_node, _page_tweak, _page_zoom, _page_shapes, _page_pencil, _page_pen,
_page_calligraphy, _page_text, _page_gradient, _page_connector, _page_dropper;
- DialogPage _page_rectangle, _page_3dbox, _page_ellipse, _page_star, _page_spiral, _page_paintbucket;
+ DialogPage _page_rectangle, _page_3dbox, _page_ellipse, _page_star, _page_spiral, _page_paintbucket, _page_eraser;
PrefSpinButton _mouse_sens, _mouse_thres;
PrefCheckButton _mouse_use_ext_input;
diff --git a/src/verbs.cpp b/src/verbs.cpp
index 1068472bdd6efc89ba9407b661038da2ce9498b5..60982e0360b3a8d42378f0537ba8151060c65a99 100644 (file)
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
case SP_VERB_CONTEXT_PAINTBUCKET:
tools_switch_current(TOOLS_PAINTBUCKET);
break;
+ case SP_VERB_CONTEXT_ERASER:
+ tools_switch_current(TOOLS_ERASER);
+ break;
case SP_VERB_CONTEXT_SELECT_PREFS:
prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SELECTOR);
prefs_set_int_attribute ("dialogs.preferences", "page", PREFS_PAGE_TOOLS_PAINTBUCKET);
dt->_dlg_mgr->showDialog("InkscapePreferences");
break;
+ case SP_VERB_CONTEXT_ERASER_PREFS:
+ prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_ERASER);
+ dt->_dlg_mgr->showDialog("InkscapePreferences");
+ break;
default:
break;
N_("Fill bounded areas"), "draw_paintbucket"),
new ContextVerb(SP_VERB_CONTEXT_LPE, "ToolLPE", N_("LPE Edit"),
N_("Edit Live Path Effect parameters"), "draw_lpe"),
+ new ContextVerb(SP_VERB_CONTEXT_ERASER, "ToolEraser", N_("Eraser"),
+ N_("Erase existing paths"), "draw_erase"),
/* Tool prefs */
new ContextVerb(SP_VERB_CONTEXT_SELECT_PREFS, "SelectPrefs", N_("Selector Preferences"),
N_("Open Preferences for the Selector tool"), NULL),
N_("Open Preferences for the Connector tool"), NULL),
new ContextVerb(SP_VERB_CONTEXT_PAINTBUCKET_PREFS, "PaintBucketPrefs", N_("Paint Bucket Preferences"),
N_("Open Preferences for the Paint Bucket tool"), NULL),
+ new ContextVerb(SP_VERB_CONTEXT_ERASER_PREFS, "EraserPrefs", N_("Eraser Preferences"),
+ N_("Open Preferences for the Eraser tool"), NULL),
/* Zoom/View */
new ZoomVerb(SP_VERB_ZOOM_IN, "ZoomIn", N_("Zoom In"), N_("Zoom in"), "zoom_in"),
diff --git a/src/verbs.h b/src/verbs.h
index 0a1826580c30b48774f6436bfbfebc10760cd7be..605cc732b4f45dd18d22482b1de6f1c7c14b4549 100644 (file)
--- a/src/verbs.h
+++ b/src/verbs.h
SP_VERB_CONTEXT_CONNECTOR,
SP_VERB_CONTEXT_PAINTBUCKET,
SP_VERB_CONTEXT_LPE, /* not really a tool but used for editing LPE parameters on-canvas for example */
+ SP_VERB_CONTEXT_ERASER,
/* Tool preferences */
SP_VERB_CONTEXT_SELECT_PREFS,
SP_VERB_CONTEXT_NODE_PREFS,
SP_VERB_CONTEXT_DROPPER_PREFS,
SP_VERB_CONTEXT_CONNECTOR_PREFS,
SP_VERB_CONTEXT_PAINTBUCKET_PREFS,
+ SP_VERB_CONTEXT_ERASER_PREFS,
/* Zooming and desktop settings */
SP_VERB_ZOOM_IN,
SP_VERB_ZOOM_OUT,
index 17d45e41f72038c59e58af9cc2047413a7f0acc9..e01d1687582cea886ee7817dc12619100b82a4a8 100644 (file)
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
static GtkWidget *sp_empty_toolbox_new(SPDesktop *desktop);
static void sp_connector_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
static void sp_paintbucket_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
+static void sp_eraser_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder);
namespace { GtkWidget *sp_text_toolbox_new (SPDesktop *desktop); }
{ "SPPencilContext", "pencil_tool", SP_VERB_CONTEXT_PENCIL, SP_VERB_CONTEXT_PENCIL_PREFS },
{ "SPPenContext", "pen_tool", SP_VERB_CONTEXT_PEN, SP_VERB_CONTEXT_PEN_PREFS },
{ "SPDynaDrawContext", "dyna_draw_tool", SP_VERB_CONTEXT_CALLIGRAPHIC, SP_VERB_CONTEXT_CALLIGRAPHIC_PREFS },
+ { "SPEraserContext", "eraser_tool", SP_VERB_CONTEXT_ERASER, SP_VERB_CONTEXT_ERASER_PREFS },
{ "SPFloodContext", "paintbucket_tool", SP_VERB_CONTEXT_PAINTBUCKET, SP_VERB_CONTEXT_PAINTBUCKET_PREFS },
{ "SPTextContext", "text_tool", SP_VERB_CONTEXT_TEXT, SP_VERB_CONTEXT_TEXT_PREFS },
{ "SPConnectorContext","connector_tool", SP_VERB_CONTEXT_CONNECTOR, SP_VERB_CONTEXT_CONNECTOR_PREFS },
SP_VERB_CONTEXT_PEN_PREFS, "tools.freehand.pen", N_("Style of new paths created by Pen")},
{ "SPDynaDrawContext", "calligraphy_toolbox", 0, sp_calligraphy_toolbox_prep,"CalligraphyToolbar",
SP_VERB_CONTEXT_CALLIGRAPHIC_PREFS, "tools.calligraphic", N_("Style of new calligraphic strokes")},
+ { "SPEraserContext", "eraser_toolbox", 0, sp_eraser_toolbox_prep,"EraserToolbar",
+ SP_VERB_CONTEXT_ERASER_PREFS, "tools.eraser", _("TBD")},
{ "SPTextContext", "text_toolbox", sp_text_toolbox_new, 0, 0,
SP_VERB_INVALID, 0, 0},
{ "SPDropperContext", "dropper_toolbox", 0, sp_dropper_toolbox_prep, "DropperToolbar",
" <toolitem action='PaintbucketResetAction' />"
" </toolbar>"
+ " <toolbar name='EraserToolbar'>"
+ " <toolitem action='EraserWidthAction' />"
+ " <separator />"
+ " <toolitem action='EraserModeAction' />"
+ " </toolbar>"
+
" <toolbar name='DropperToolbar'>"
" <toolitem action='DropperOpacityAction' />"
" <toolitem action='DropperPickAlphaAction' />"
sp_arctb_startend_value_changed(adj, tbl, "end", "start");
}
+
+static void sp_erasertb_mode_changed( EgeSelectOneAction *act, GObject *tbl )
+{
+ SPDesktop *desktop = (SPDesktop *) g_object_get_data( tbl, "desktop" );
+ gint eraserMode = (ege_select_one_action_get_active( act ) != 0) ? 1 : 0;
+ if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) {
+ prefs_set_int_attribute( "tools.eraser", "mode", eraserMode );
+ }
+
+ // only take action if run by the attr_changed listener
+ if (!g_object_get_data( tbl, "freeze" )) {
+ // in turn, prevent listener from responding
+ g_object_set_data( tbl, "freeze", GINT_TO_POINTER(TRUE) );
+
+ if ( eraserMode != 0 ) {
+ } else {
+ }
+ // TODO finish implementation
+
+ g_object_set_data( tbl, "freeze", GINT_TO_POINTER(FALSE) );
+ }
+}
+
static void sp_arctb_open_state_changed( EgeSelectOneAction *act, GObject *tbl )
{
SPDesktop *desktop = (SPDesktop *) g_object_get_data( tbl, "desktop" );
@@ -4203,6 +4236,60 @@ static void sp_dropper_toolbox_prep(SPDesktop */*desktop*/, GtkActionGroup* main
}
+
+static void sp_eraser_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions, GObject* holder)
+{
+ {
+ /* Width */
+ gchar const* labels[] = {_("(hairline)"), 0, 0, 0, _("(default)"), 0, 0, 0, 0, _("(broad stroke)")};
+ gdouble values[] = {1, 3, 5, 10, 15, 20, 30, 50, 75, 100};
+ EgeAdjustmentAction *eact = create_adjustment_action( "EraserWidthAction",
+ _("Pen Width"), _("Width:"),
+ _("The width of the eraser pen (relative to the visible canvas area)"),
+ "tools.eraser", "width", 15,
+ GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "altx-eraser",
+ 1, 100, 1.0, 10.0,
+ labels, values, G_N_ELEMENTS(labels),
+ sp_ddc_width_value_changed, 0.01, 0, 100 );
+ gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
+ gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
+ }
+
+ {
+ GtkListStore* model = gtk_list_store_new( 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING );
+
+ GtkTreeIter iter;
+ gtk_list_store_append( model, &iter );
+ gtk_list_store_set( model, &iter,
+ 0, _("Delete"),
+ 1, _("Delete objects touched by the eraser"),
+ 2, "delete_object",
+ -1 );
+
+ gtk_list_store_append( model, &iter );
+ gtk_list_store_set( model, &iter,
+ 0, _("Cut"),
+ 1, _("Cut out from objects"),
+ 2, "difference",
+ -1 );
+
+ EgeSelectOneAction* act = ege_select_one_action_new( "EraserModeAction", (""), (""), NULL, GTK_TREE_MODEL(model) );
+ gtk_action_group_add_action( mainActions, GTK_ACTION(act) );
+ g_object_set_data( holder, "eraser_mode_action", act );
+
+ ege_select_one_action_set_appearance( act, "full" );
+ ege_select_one_action_set_radio_action_type( act, INK_RADIO_ACTION_TYPE );
+ g_object_set( G_OBJECT(act), "icon-property", "iconId", NULL );
+ ege_select_one_action_set_icon_column( act, 2 );
+ ege_select_one_action_set_tooltip_column( act, 1 );
+
+ gint eraserMode = (prefs_get_int_attribute("tools.eraser", "mode", 0) != 0) ? 1 : 0;
+ ege_select_one_action_set_active( act, eraserMode );
+ g_signal_connect_after( G_OBJECT(act), "changed", G_CALLBACK(sp_erasertb_mode_changed), holder );
+ }
+
+}
+
//########################
//## Text Toolbox ##
//########################