Code

Switched three verbs/icons over to standard names and thus themed loading
[inkscape.git] / src / verbs.cpp
index 7bd17575506cede95b653d1df062c25c6fac42d0..e40ffe1d69b3cc0e61af7c37504b68ce18e4c3d0 100644 (file)
@@ -37,6 +37,7 @@
 #include <gtkmm/filechooserdialog.h>
 #include <gtkmm/stock.h>
 
+#include "layer-manager.h"
 #include "dialogs/text-edit.h"
 #include "dialogs/xml-tree.h"
 #include "dialogs/item-properties.h"
 #include "dialogs/extensions.h"
 #include "dialogs/swatches.h"
 #include "dialogs/layers-panel.h"
-#ifndef USE_NEW_INPUT_DEVICES
 #include "dialogs/input.h"
-#endif
 
 #ifdef WITH_INKBOARD
 #include "jabber_whiteboard/session-manager.h"
 #endif
 
 #include "extension/effect.h"
+#include "bind/javabind.h"
 
 #include "tools-switch.h"
 #include "inkscape-private.h"
@@ -84,7 +84,7 @@
 #include "draw-context.h"
 #include "gradient-drag.h"
 #include "sp-guide.h"
-
+#include "display/curve.h"
 
 /**
  * \brief Return the name without underscores and ellipsis, for use in dialog
@@ -879,6 +879,12 @@ EditVerb::perform(SPAction *action, void *data, void */*pdata*/)
         case SP_VERB_EDIT_PASTE_LIVEPATHEFFECT:
             sp_selection_paste_livepatheffect();
             break;
+        case SP_VERB_EDIT_REMOVE_LIVEPATHEFFECT:
+            sp_selection_remove_livepatheffect();
+            break;
+        case SP_VERB_EDIT_REMOVE_FILTER:
+            sp_selection_remove_filter();
+            break;
         case SP_VERB_EDIT_DELETE:
             sp_selection_delete();
             break;
@@ -891,6 +897,9 @@ EditVerb::perform(SPAction *action, void *data, void */*pdata*/)
         case SP_VERB_EDIT_UNLINK_CLONE:
             sp_selection_unlink();
             break;
+        case SP_VERB_EDIT_RELINK_CLONE:
+            sp_selection_relink();
+            break;
         case SP_VERB_EDIT_CLONE_SELECT_ORIGINAL:
             sp_select_clone_original();
             break;
@@ -968,7 +977,7 @@ EditVerb::perform(SPAction *action, void *data, void */*pdata*/)
             break;
 
         case SP_VERB_EDIT_GUIDES_AROUND_PAGE:
-            sp_guide_create_guides_around_page(sp_desktop_document(dt));
+            sp_guide_create_guides_around_page(dt);
             break;
 
         case SP_VERB_EDIT_NEXT_PATHEFFECT_PARAMETER:
@@ -1214,6 +1223,31 @@ LayerVerb::perform(SPAction *action, void *data, void */*pdata*/)
 
             break;
         }
+        case SP_VERB_LAYER_DUPLICATE: {
+            if ( dt->currentLayer() != dt->currentRoot() ) {
+                SPObject *new_layer = Inkscape::create_layer(dt->currentRoot(), dt->currentLayer(), LPOS_BELOW);
+                if ( dt->currentLayer()->label() ) {
+                    gchar* name = g_strdup_printf(_("%s copy"), dt->currentLayer()->label());
+                    dt->layer_manager->renameLayer( new_layer, name );
+                    g_free(name);
+                }
+
+                sp_edit_select_all();
+                sp_selection_duplicate(true);
+                sp_selection_to_prev_layer(true);
+                dt->setCurrentLayer(new_layer);
+                sp_edit_select_all();
+
+                sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_DUPLICATE,
+                                 _("Duplicate layer"));
+                
+                // TRANSLATORS: this means "The layer has been duplicated."
+                dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Duplicated layer."));
+            } else {
+                dt->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No current layer."));
+            }
+            break;
+        }
         case SP_VERB_LAYER_DELETE: {
             if ( dt->currentLayer() != dt->currentRoot() ) {
                 sp_desktop_selection(dt)->clear();
@@ -1246,6 +1280,15 @@ LayerVerb::perform(SPAction *action, void *data, void */*pdata*/)
             }
             break;
         }
+        case SP_VERB_LAYER_SOLO: {
+            if ( dt->currentLayer() == dt->currentRoot() ) {
+                dt->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No current layer."));
+            } else {
+                dt->toggleLayerSolo( dt->currentLayer() );
+                sp_document_maybe_done(sp_desktop_document(dt), "layer:solo", SP_VERB_LAYER_SOLO, _("Toggle layer solo"));
+            }
+            break;
+        }
     }
 
     return;
@@ -1441,6 +1484,9 @@ ContextVerb::perform(SPAction *action, void *data, void */*pdata*/)
         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);
@@ -1510,6 +1556,10 @@ ContextVerb::perform(SPAction *action, void *data, void */*pdata*/)
             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;
@@ -1556,8 +1606,8 @@ ZoomVerb::perform(SPAction *action, void *data, void */*pdata*/)
             // While drawing with the pen/pencil tool, zoom towards the end of the unfinished path
             if (tools_isactive(dt, TOOLS_FREEHAND_PENCIL) || tools_isactive(dt, TOOLS_FREEHAND_PEN)) {
                 SPCurve *rc = SP_DRAW_CONTEXT(ec)->red_curve;
-                if (sp_curve_last_bpath(rc)) {
-                    NR::Point const zoom_to (sp_curve_last_point(rc));
+                if (!rc->is_empty()) {
+                    NR::Point const zoom_to (rc->last_point());
                     dt->zoom_relative_keep_point(zoom_to, mul*zoom_inc);
                     break;
                 }
@@ -1574,8 +1624,8 @@ ZoomVerb::perform(SPAction *action, void *data, void */*pdata*/)
             // While drawing with the pen/pencil tool, zoom away from the end of the unfinished path
             if (tools_isactive(dt, TOOLS_FREEHAND_PENCIL) || tools_isactive(dt, TOOLS_FREEHAND_PEN)) {
                 SPCurve *rc = SP_DRAW_CONTEXT(ec)->red_curve;
-                if (sp_curve_last_bpath(rc)) {
-                    NR::Point const zoom_to (sp_curve_last_point(rc));
+                if (!rc->is_empty()) {
+                    NR::Point const zoom_to (rc->last_point());
                     dt->zoom_relative_keep_point(zoom_to, 1 / (mul*zoom_inc));
                     break;
                 }
@@ -1650,6 +1700,9 @@ ZoomVerb::perform(SPAction *action, void *data, void */*pdata*/)
         case SP_VERB_VIEW_MODE_NORMAL:
             dt->setDisplayModeNormal();
             break;
+        case SP_VERB_VIEW_MODE_NO_FILTERS:
+            dt->setDisplayModeNoFilters();
+            break;
         case SP_VERB_VIEW_MODE_OUTLINE:
             dt->setDisplayModeOutline();
             break;
@@ -1723,7 +1776,8 @@ DialogVerb::perform(SPAction *action, void *data, void */*pdata*/)
             dt->_dlg_mgr->showDialog("Messages");
             break;
         case SP_VERB_DIALOG_SCRIPT:
-            dt->_dlg_mgr->showDialog("Script");
+            //dt->_dlg_mgr->showDialog("Script");
+            Inkscape::Bind::JavaBindery::getInstance()->showConsole();
             break;
         case SP_VERB_DIALOG_UNDO_HISTORY:
             dt->_dlg_mgr->showDialog("UndoHistory");
@@ -1745,11 +1799,10 @@ DialogVerb::perform(SPAction *action, void *data, void */*pdata*/)
         }
 #endif
         case SP_VERB_DIALOG_INPUT:
-#ifdef USE_NEW_INPUT_DEVICES
-            dt->_dlg_mgr->showDialog("InputDevices");
-#else
             sp_input_dialog();
-#endif
+            break;
+        case SP_VERB_DIALOG_INPUT2:
+            dt->_dlg_mgr->showDialog("InputDevices");
             break;
         case SP_VERB_DIALOG_EXTENSIONEDITOR:
             dt->_dlg_mgr->showDialog("ExtensionEditor");
@@ -1763,6 +1816,9 @@ DialogVerb::perform(SPAction *action, void *data, void */*pdata*/)
         case SP_VERB_DIALOG_FILTER_EFFECTS:
             dt->_dlg_mgr->showDialog("FilterEffectsDialog");
             break;
+        case SP_VERB_DIALOG_SVG_FONTS:
+            dt->_dlg_mgr->showDialog("SvgFontsDialog");
+            break;
         default:
             break;
     }
@@ -2041,10 +2097,10 @@ FitCanvasVerb::perform(SPAction *action, void *data, void */*pdata*/)
 
     switch ((long) data) {
         case SP_VERB_FIT_CANVAS_TO_SELECTION:
-            fit_canvas_to_selection(dt);
+            verb_fit_canvas_to_selection(dt);
             break;
         case SP_VERB_FIT_CANVAS_TO_DRAWING:
-            fit_canvas_to_drawing(doc);
+            verb_fit_canvas_to_drawing(dt);
             break;
         case SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING:
             fit_canvas_to_selection_or_drawing(dt);
@@ -2201,8 +2257,12 @@ Verb *Verb::_base_verbs[] = {
                  N_("Scale each selected object vertically to match the height of the copied object"), NULL),
     new EditVerb(SP_VERB_EDIT_PASTE_IN_PLACE, "EditPasteInPlace", N_("Paste _In Place"),
                  N_("Paste objects from clipboard to the original location"), "selection_paste_in_place"),
-    new EditVerb(SP_VERB_EDIT_PASTE_LIVEPATHEFFECT, "EditPasteLivePathEffect", N_("Paste Path _Effect"),
+    new EditVerb(SP_VERB_EDIT_PASTE_LIVEPATHEFFECT, "PasteLivePathEffect", N_("Paste Path _Effect"),
                  N_("Apply the path effect of the copied object to selection"), NULL),
+    new EditVerb(SP_VERB_EDIT_REMOVE_LIVEPATHEFFECT, "RemoveLivePathEffect", N_("Remove Path _Effect"),
+                 N_("Remove any path effects from selected objects"), NULL),
+    new EditVerb(SP_VERB_EDIT_REMOVE_FILTER, "RemoveFilter", N_("Remove Filter"),
+                 N_("Remove any filters from selected objects"), NULL),
     new EditVerb(SP_VERB_EDIT_DELETE, "EditDelete", N_("_Delete"),
                  N_("Delete selection"), GTK_STOCK_DELETE),
     new EditVerb(SP_VERB_EDIT_DUPLICATE, "EditDuplicate", N_("Duplic_ate"),
@@ -2210,7 +2270,9 @@ Verb *Verb::_base_verbs[] = {
     new EditVerb(SP_VERB_EDIT_CLONE, "EditClone", N_("Create Clo_ne"),
                  N_("Create a clone (a copy linked to the original) of selected object"), "edit_clone"),
     new EditVerb(SP_VERB_EDIT_UNLINK_CLONE, "EditUnlinkClone", N_("Unlin_k Clone"),
-                 N_("Cut the selected clone's link to its original, turning it into a standalone object"), "edit_unlink_clone"),
+                 N_("Cut the selected clones' links to the originals, turning them into standalone objects"), "edit_unlink_clone"),
+    new EditVerb(SP_VERB_EDIT_RELINK_CLONE, "EditRelinkClone", N_("Relink to Copied"),
+                 N_("Relink the selected clones to the object currently on the clipboard"), NULL),
     new EditVerb(SP_VERB_EDIT_CLONE_SELECT_ORIGINAL, "EditCloneSelectOriginal", N_("Select _Original"),
                  N_("Select the object to which the selected clone is linked"), "edit_select_original"),
     // TRANSLATORS: Convert selection to a line marker
@@ -2228,7 +2290,7 @@ Verb *Verb::_base_verbs[] = {
     new EditVerb(SP_VERB_EDIT_CLEAR_ALL, "EditClearAll", N_("Clea_r All"),
                  N_("Delete all objects from document"), NULL),
     new EditVerb(SP_VERB_EDIT_SELECT_ALL, "EditSelectAll", N_("Select Al_l"),
-                 N_("Select all objects or all nodes"), "selection_select_all"),
+                 N_("Select all objects or all nodes"), "edit-select-all"),
     new EditVerb(SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS, "EditSelectAllInAllLayers", N_("Select All in All La_yers"),
                  N_("Select all objects in all visible and unlocked layers"), "selection_select_all_in_all_layers"),
     new EditVerb(SP_VERB_EDIT_INVERT, "EditInvert", N_("In_vert Selection"),
@@ -2351,8 +2413,12 @@ Verb *Verb::_base_verbs[] = {
                   N_("Raise the current layer"), "raise_layer"),
     new LayerVerb(SP_VERB_LAYER_LOWER, "LayerLower", N_("_Lower Layer"),
                   N_("Lower the current layer"), "lower_layer"),
+    new LayerVerb(SP_VERB_LAYER_DUPLICATE, "LayerDuplicate", N_("Duplicate Current Layer..."),
+                  N_("Duplicate an existing layer"), 0),
     new LayerVerb(SP_VERB_LAYER_DELETE, "LayerDelete", N_("_Delete Current Layer"),
                   N_("Delete the current layer"), "delete_layer"),
+    new LayerVerb(SP_VERB_LAYER_SOLO, "LayerSolo", N_("_Show/hide other layers"),
+                  N_("Solo the current layer"), 0),
 
     /* Object */
     new ObjectVerb(SP_VERB_OBJECT_ROTATE_90_CW, "ObjectRotate90", N_("Rotate _90&#176; CW"),
@@ -2427,7 +2493,10 @@ Verb *Verb::_base_verbs[] = {
                     N_("Create diagram connectors"), "draw_connector"),
     new ContextVerb(SP_VERB_CONTEXT_PAINTBUCKET, "ToolPaintBucket", N_("Paint Bucket"),
                     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),
@@ -2463,6 +2532,8 @@ Verb *Verb::_base_verbs[] = {
                     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"),
@@ -2484,15 +2555,17 @@ Verb *Verb::_base_verbs[] = {
                  "zoom_2_to_1"),
 #ifdef HAVE_GTK_WINDOW_FULLSCREEN
     new ZoomVerb(SP_VERB_FULLSCREEN, "FullScreen", N_("_Fullscreen"), N_("Stretch this document window to full screen"),
-                 "fullscreen"),
+                 "view-fullscreen"),
 #endif /* HAVE_GTK_WINDOW_FULLSCREEN */
     new ZoomVerb(SP_VERB_VIEW_NEW, "ViewNew", N_("Duplic_ate Window"), N_("Open a new window with the same document"),
-                 "view_new"),
+                 "window-new"),
     new ZoomVerb(SP_VERB_VIEW_NEW_PREVIEW, "ViewNewPreview", N_("_New View Preview"),
                  N_("New View Preview"), NULL/*"view_new_preview"*/),
 
     new ZoomVerb(SP_VERB_VIEW_MODE_NORMAL, "ViewModeNormal", N_("_Normal"),
                  N_("Switch to normal display mode"), NULL),
+    new ZoomVerb(SP_VERB_VIEW_MODE_NO_FILTERS, "ViewModeNoFilters", N_("No _Filters"),
+                 N_("Switch to normal display without filters"), NULL),
     new ZoomVerb(SP_VERB_VIEW_MODE_OUTLINE, "ViewModeOutline", N_("_Outline"),
                  N_("Switch to outline (wireframe) display mode"), NULL),
     new ZoomVerb(SP_VERB_VIEW_MODE_TOGGLE, "ViewModeToggle", N_("_Toggle"),
@@ -2552,6 +2625,8 @@ Verb *Verb::_base_verbs[] = {
 #endif
     new DialogVerb(SP_VERB_DIALOG_INPUT, "DialogInput", N_("_Input Devices..."),
                    N_("Configure extended input devices, such as a graphics tablet"), "input_devices"),
+    new DialogVerb(SP_VERB_DIALOG_INPUT2, "DialogInput2", N_("_Input Devices (new)..."),
+                   N_("Configure extended input devices, such as a graphics tablet"), "input_devices"),
     new DialogVerb(SP_VERB_DIALOG_EXTENSIONEDITOR, "org.inkscape.dialogs.extensioneditor", N_("_Extensions..."),
                    N_("Query information about extensions"), NULL),
     new DialogVerb(SP_VERB_DIALOG_LAYERS, "DialogLayers", N_("Layer_s..."),
@@ -2560,6 +2635,8 @@ Verb *Verb::_base_verbs[] = {
                    N_("Manage path effects"), NULL),
     new DialogVerb(SP_VERB_DIALOG_FILTER_EFFECTS, "DialogFilterEffects", N_("Filter Effects..."),
                    N_("Manage SVG filter effects"), NULL),
+    new DialogVerb(SP_VERB_DIALOG_SVG_FONTS, "DialogSVGFonts", N_("SVG Fonts..."),
+                   N_("Manage SVG fonts"), NULL),
 
     /* Help */
     new HelpVerb(SP_VERB_HELP_ABOUT_EXTENSIONS, "HelpAboutExtensions", N_("About E_xtensions"),