X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fverbs.cpp;h=cc01706eacd3ba47297a1fa7373c2066946eb313;hb=ac63672b8bd0ad9539384d4eac6e27875d4d2693;hp=476170e994e4c94926db73c7dc56e67f37b86f13;hpb=e7a5f3e4a4758ac8353e070265e9bf03ed7228c9;p=inkscape.git diff --git a/src/verbs.cpp b/src/verbs.cpp index 476170e99..cc01706ea 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -77,6 +77,7 @@ #include "layer-fns.h" #include "node-context.h" #include "gradient-context.h" +#include "shape-editor.h" /** @@ -915,28 +916,28 @@ EditVerb::perform(SPAction *action, void *data, void *pdata) break; case SP_VERB_EDIT_SELECT_ALL: if (tools_isactive(dt, TOOLS_NODES)) { - sp_nodepath_select_all_from_subpath(SP_NODE_CONTEXT(ec)->nodepath, false); + SP_NODE_CONTEXT(ec)->shape_editor->select_all_from_subpath(false); } else { sp_edit_select_all(); } break; case SP_VERB_EDIT_INVERT: if (tools_isactive(dt, TOOLS_NODES)) { - sp_nodepath_select_all_from_subpath(SP_NODE_CONTEXT(ec)->nodepath, true); + SP_NODE_CONTEXT(ec)->shape_editor->select_all_from_subpath(true); } else { sp_edit_invert(); } break; case SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS: if (tools_isactive(dt, TOOLS_NODES)) { - sp_nodepath_select_all(SP_NODE_CONTEXT(ec)->nodepath, false); + SP_NODE_CONTEXT(ec)->shape_editor->select_all(false); } else { sp_edit_select_all_in_all_layers(); } break; case SP_VERB_EDIT_INVERT_IN_ALL_LAYERS: if (tools_isactive(dt, TOOLS_NODES)) { - sp_nodepath_select_all(SP_NODE_CONTEXT(ec)->nodepath, true); + SP_NODE_CONTEXT(ec)->shape_editor->select_all(true); } else { sp_edit_invert_in_all_layers(); } @@ -944,7 +945,7 @@ EditVerb::perform(SPAction *action, void *data, void *pdata) case SP_VERB_EDIT_SELECT_NEXT: if (tools_isactive(dt, TOOLS_NODES)) { - sp_nodepath_select_next(SP_NODE_CONTEXT(ec)->nodepath); + SP_NODE_CONTEXT(ec)->shape_editor->select_next(); } else if (tools_isactive(dt, TOOLS_GRADIENT)) { sp_gradient_context_select_next (ec); } else { @@ -953,7 +954,7 @@ EditVerb::perform(SPAction *action, void *data, void *pdata) break; case SP_VERB_EDIT_SELECT_PREV: if (tools_isactive(dt, TOOLS_NODES)) { - sp_nodepath_select_prev(SP_NODE_CONTEXT(ec)->nodepath); + SP_NODE_CONTEXT(ec)->shape_editor->select_prev(); } else if (tools_isactive(dt, TOOLS_GRADIENT)) { sp_gradient_context_select_prev (ec); } else { @@ -963,7 +964,7 @@ EditVerb::perform(SPAction *action, void *data, void *pdata) case SP_VERB_EDIT_DESELECT: if (tools_isactive(dt, TOOLS_NODES)) { - sp_nodepath_deselect(SP_NODE_CONTEXT(ec)->nodepath); + SP_NODE_CONTEXT(ec)->shape_editor->deselect(); } else { sp_desktop_selection(dt)->clear(); } @@ -1053,9 +1054,11 @@ SelectionVerb::perform(SPAction *action, void *data, void *pdata) break; case SP_VERB_SELECTION_DYNAMIC_OFFSET: sp_selected_path_create_offset_object_zero(); + tools_switch_current(TOOLS_NODES); break; case SP_VERB_SELECTION_LINKED_OFFSET: sp_selected_path_create_updating_offset_object_zero(); + tools_switch_current(TOOLS_NODES); break; case SP_VERB_SELECTION_OUTLINE: @@ -1254,7 +1257,11 @@ ObjectVerb::perform( SPAction *action, void *data, void *pdata ) if (sel->isEmpty()) return; - NR::Point const center(sel->bounds().midpoint()); + NR::Maybe bbox = sel->bounds(); + if (!bbox) { + return; + } + NR::Point const center(bbox->midpoint()); switch (reinterpret_cast(data)) { case SP_VERB_OBJECT_ROTATE_90_CW: @@ -1280,7 +1287,7 @@ ObjectVerb::perform( SPAction *action, void *data, void *pdata ) break; case SP_VERB_OBJECT_FLIP_HORIZONTAL: if (tools_isactive(dt, TOOLS_NODES)) { - sp_nodepath_flip(SP_NODE_CONTEXT(ec)->nodepath, NR::X); + SP_NODE_CONTEXT(ec)->shape_editor->flip(NR::X); } else { sp_selection_scale_relative(sel, center, NR::scale(-1.0, 1.0)); } @@ -1289,7 +1296,7 @@ ObjectVerb::perform( SPAction *action, void *data, void *pdata ) break; case SP_VERB_OBJECT_FLIP_VERTICAL: if (tools_isactive(dt, TOOLS_NODES)) { - sp_nodepath_flip(SP_NODE_CONTEXT(ec)->nodepath, NR::Y); + SP_NODE_CONTEXT(ec)->shape_editor->flip(NR::Y); } else { sp_selection_scale_relative(sel, center, NR::scale(1.0, -1.0)); } @@ -1332,7 +1339,7 @@ ContextVerb::perform(SPAction *action, void *data, void *pdata) /** \todo !!! hopefully this can go away soon and actions can look after * themselves */ - for (vidx = SP_VERB_CONTEXT_SELECT; vidx <= SP_VERB_CONTEXT_DROPPER_PREFS; vidx++) + for (vidx = SP_VERB_CONTEXT_SELECT; vidx <= SP_VERB_CONTEXT_PAINTBUCKET_PREFS; vidx++) { SPAction *tool_action= get((sp_verb_t)vidx)->get_action(dt); if (tool_action) { @@ -1383,6 +1390,9 @@ ContextVerb::perform(SPAction *action, void *data, void *pdata) case SP_VERB_CONTEXT_CONNECTOR: tools_switch_current (TOOLS_CONNECTOR); break; + case SP_VERB_CONTEXT_PAINTBUCKET: + tools_switch_current(TOOLS_PAINTBUCKET); + break; case SP_VERB_CONTEXT_SELECT_PREFS: prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SELECTOR); @@ -1440,6 +1450,10 @@ ContextVerb::perform(SPAction *action, void *data, void *pdata) prefs_set_int_attribute ("dialogs.preferences", "page", PREFS_PAGE_TOOLS_CONNECTOR); dt->_dlg_mgr->showDialog("InkscapePreferences"); break; + case SP_VERB_CONTEXT_PAINTBUCKET_PREFS: + prefs_set_int_attribute ("dialogs.preferences", "page", PREFS_PAGE_TOOLS_PAINTBUCKET); + dt->_dlg_mgr->showDialog("InkscapePreferences"); + break; default: break; @@ -2220,9 +2234,11 @@ Verb *Verb::_base_verbs[] = { new ContextVerb(SP_VERB_CONTEXT_ZOOM, "ToolZoom", N_("Zoom"), N_("Zoom in or out"), "draw_zoom"), new ContextVerb(SP_VERB_CONTEXT_DROPPER, "ToolDropper", N_("Dropper"), - N_("Pick averaged colors from image"), "draw_dropper"), + N_("Pick colors from image"), "draw_dropper"), new ContextVerb(SP_VERB_CONTEXT_CONNECTOR, "ToolConnector", N_("Connector"), N_("Create connectors"), "draw_connector"), + new ContextVerb(SP_VERB_CONTEXT_PAINTBUCKET, "ToolPaintBucket", N_("Paint Bucket"), + N_("Fill bounded areas"), "draw_paintbucket"), /* Tool prefs */ new ContextVerb(SP_VERB_CONTEXT_SELECT_PREFS, "SelectPrefs", N_("Selector Preferences"), @@ -2253,6 +2269,8 @@ Verb *Verb::_base_verbs[] = { N_("Open Preferences for the Dropper tool"), NULL), new ContextVerb(SP_VERB_CONTEXT_CONNECTOR_PREFS, "ConnectorPrefs", N_("Connector Preferences"), 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), /* Zoom/View */ new ZoomVerb(SP_VERB_ZOOM_IN, "ZoomIn", N_("Zoom In"), N_("Zoom in"), "zoom_in"), @@ -2306,7 +2324,7 @@ Verb *Verb::_base_verbs[] = { new DialogVerb(SP_VERB_DIALOG_METADATA, "DialogMetadata", N_("Document _Metadata..."), N_("Edit document metadata (to be saved with the document)"), "document_metadata" ), new DialogVerb(SP_VERB_DIALOG_FILL_STROKE, "DialogFillStroke", N_("_Fill and Stroke..."), - N_("Edit objects' style, such as color or stroke width"), "fill_and_stroke"), + N_("Edit objects' colors, gradients, stroke width, arrowheads, dash patterns..."), "fill_and_stroke"), // TRANSLATORS: "Swatches" means: color samples new DialogVerb(SP_VERB_DIALOG_SWATCHES, "DialogSwatches", N_("S_watches..."), N_("Select colors from a swatches palette"), GTK_STOCK_SELECT_COLOR), @@ -2390,6 +2408,23 @@ Verb *Verb::_base_verbs[] = { }; +void +Verb::list (void) { + // Go through the dynamic verb table + for (VerbTable::iterator iter = _verbs.begin(); iter != _verbs.end(); iter++) { + Verb * verb = iter->second; + if (verb->get_code() == SP_VERB_INVALID || + verb->get_code() == SP_VERB_NONE || + verb->get_code() == SP_VERB_LAST) { + continue; + } + + printf("%s: %s\n", verb->get_id(), verb->get_tip()? verb->get_tip() : verb->get_name()); + } + + return; +}; + } /* namespace Inkscape */ /*