Code

show more axonometric grid lines
[inkscape.git] / src / verbs.cpp
index 37f4da4d6f30d48646393cc8bb41ec88fa2d169c..24c17aad8fd93f4035f486201cd626324c8b396b 100644 (file)
@@ -16,6 +16,7 @@
  *   MenTaLguY <mental@rydia.net>
  *   David Turner <novalis@gnu.org>
  *   bulia byak <buliabyak@users.sf.net>
+ *   Jon A. Cruz <jon@joncruz.org>
  *
  * Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>
  * Copyright (C) (date unspecified) Authors
@@ -39,7 +40,6 @@
 #include "desktop-handles.h"
 #include "dialogs/clonetiler.h"
 #include "dialogs/find.h"
-#include "dialogs/input.h"
 #include "dialogs/item-properties.h"
 #include "dialogs/spellcheck.h"
 #include "dialogs/text-edit.h"
@@ -49,7 +49,6 @@
 #include "draw-context.h"
 #include "extension/effect.h"
 #include "file.h"
-#include "gradient-context.h"
 #include "gradient-drag.h"
 #include "helper/action.h"
 #include "help.h"
 #include "ui/dialog/dialog-manager.h"
 #include "ui/dialog/document-properties.h"
 #include "ui/dialog/extensions.h"
+#include "ui/dialog/glyphs.h"
 #include "ui/dialog/icon-preview.h"
 #include "ui/dialog/inkscape-preferences.h"
 #include "ui/dialog/layer-properties.h"
 #include "ui/dialog/layers.h"
 #include "ui/dialog/swatches.h"
 #include "ui/icon-names.h"
-#include "ui/tool/control-point-selection.h"
-#include "ui/tool/multi-path-manipulator.h"
 #include "ui/tool/node-tool.h"
 
 //#ifdef WITH_INKBOARD
@@ -769,7 +767,7 @@ FileVerb::perform(SPAction *action, void *data, void */*pdata*/)
     Gtk::Window *parent = desktop->getToplevel();
     g_assert(parent != NULL);
 
-    switch ((long) data) {
+    switch (reinterpret_cast<std::size_t>(data)) {
         case SP_VERB_FILE_NEW:
             sp_file_new_default();
             break;
@@ -835,7 +833,6 @@ EditVerb::perform(SPAction *action, void *data, void */*pdata*/)
     SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
     if (!dt)
         return;
-    SPEventContext *ec = dt->event_context;
 
     switch (reinterpret_cast<std::size_t>(data)) {
         case SP_VERB_EDIT_UNDO:
@@ -848,7 +845,7 @@ EditVerb::perform(SPAction *action, void *data, void */*pdata*/)
             sp_selection_cut(dt);
             break;
         case SP_VERB_EDIT_COPY:
-            sp_selection_copy();
+            sp_selection_copy(dt);
             break;
         case SP_VERB_EDIT_PASTE:
             sp_selection_paste(dt, false);
@@ -920,70 +917,26 @@ EditVerb::perform(SPAction *action, void *data, void */*pdata*/)
             sp_edit_clear_all(dt);
             break;
         case SP_VERB_EDIT_SELECT_ALL:
-            if (tools_isactive(dt, TOOLS_NODES)) {
-                InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
-                nt->_multipath->selectSubpaths();
-            } else {
-                sp_edit_select_all(dt);
-            }
+            SelectionHelper::selectAll(dt);
             break;
         case SP_VERB_EDIT_INVERT:
-            if (tools_isactive(dt, TOOLS_NODES)) {
-                InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
-                nt->_multipath->invertSelectionInSubpaths();
-            } else {
-                sp_edit_invert(dt);
-            }
+            SelectionHelper::invert(dt);
             break;
         case SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS:
-            if (tools_isactive(dt, TOOLS_NODES)) {
-                InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
-                nt->_selected_nodes->selectAll();
-            } else {
-                sp_edit_select_all_in_all_layers(dt);
-            }
+            SelectionHelper::selectAllInAll(dt);
             break;
         case SP_VERB_EDIT_INVERT_IN_ALL_LAYERS:
-            if (tools_isactive(dt, TOOLS_NODES)) {
-                InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
-                nt->_selected_nodes->invertSelection();
-            } else {
-                sp_edit_invert_in_all_layers(dt);
-            }
+            SelectionHelper::invertAllInAll(dt);
             break;
-
         case SP_VERB_EDIT_SELECT_NEXT:
-            if (tools_isactive(dt, TOOLS_NODES)) {
-                InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
-                nt->_multipath->shiftSelection(1);
-            } else if (tools_isactive(dt, TOOLS_GRADIENT)
-                       && ec->_grdrag->isNonEmpty()) {
-                sp_gradient_context_select_next (ec);
-            } else {
-                sp_selection_item_next(dt);
-            }
+            SelectionHelper::selectNext(dt);
             break;
         case SP_VERB_EDIT_SELECT_PREV:
-            if (tools_isactive(dt, TOOLS_NODES)) {
-                InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
-                nt->_multipath->shiftSelection(-1);
-            } else if (tools_isactive(dt, TOOLS_GRADIENT)
-                       && ec->_grdrag->isNonEmpty()) {
-                sp_gradient_context_select_prev (ec);
-            } else {
-                sp_selection_item_prev(dt);
-            }
+            SelectionHelper::selectPrev(dt);
             break;
-
         case SP_VERB_EDIT_DESELECT:
-            if (tools_isactive(dt, TOOLS_NODES)) {
-                InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
-                nt->_selected_nodes->clear();
-            } else {
-                sp_desktop_selection(dt)->clear();
-            }
+            SelectionHelper::selectNone(dt);
             break;
-
         case SP_VERB_EDIT_GUIDES_AROUND_PAGE:
             sp_guide_create_guides_around_page(dt);
             break;
@@ -1095,13 +1048,7 @@ SelectionVerb::perform(SPAction *action, void *data, void */*pdata*/)
             sp_selected_path_simplify(dt);
             break;
         case SP_VERB_SELECTION_REVERSE:
-            // TODO make this a virtual method of event context!
-            if (tools_isactive(dt, TOOLS_NODES)) {
-                InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
-                nt->_multipath->reverseSubpaths();
-            } else {
-                sp_selected_path_reverse(dt);
-            }
+            SelectionHelper::reverse(dt);
             break;
         case SP_VERB_SELECTION_TRACE:
             inkscape_dialogs_unhide();
@@ -1132,7 +1079,7 @@ void
 LayerVerb::perform(SPAction *action, void *data, void */*pdata*/)
 {
     SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
-    unsigned int verb = reinterpret_cast<std::size_t>(data);
+    size_t verb = reinterpret_cast<std::size_t>(data);
 
     if ( !dt || !dt->currentLayer() ) {
         return;
@@ -1621,7 +1568,7 @@ ZoomVerb::perform(SPAction *action, void *data, void */*pdata*/)
     gdouble zoom_inc =
         prefs->getDoubleLimited( "/options/zoomincrement/value", 1.414213562, 1.01, 10 );
 
-    switch (GPOINTER_TO_INT(data)) {
+    switch (reinterpret_cast<std::size_t>(data)) {
         case SP_VERB_ZOOM_IN:
         {
             gint mul = 1 + gobble_key_events(
@@ -1784,6 +1731,9 @@ DialogVerb::perform(SPAction *action, void *data, void */*pdata*/)
         case SP_VERB_DIALOG_FILL_STROKE:
             dt->_dlg_mgr->showDialog("FillAndStroke");
             break;
+        case SP_VERB_DIALOG_GLYPHS:
+            dt->_dlg_mgr->showDialog("Glyphs");
+            break;
         case SP_VERB_DIALOG_SWATCHES:
             dt->_dlg_mgr->showDialog("Swatches");
             break;
@@ -1840,9 +1790,6 @@ DialogVerb::perform(SPAction *action, void *data, void */*pdata*/)
         }
 #endif*/
         case SP_VERB_DIALOG_INPUT:
-            sp_input_dialog();
-            break;
-        case SP_VERB_DIALOG_INPUT2:
             dt->_dlg_mgr->showDialog("InputDevices");
             break;
         case SP_VERB_DIALOG_EXTENSIONEDITOR:
@@ -1908,8 +1855,8 @@ TutorialVerb::perform(SPAction */*action*/, void *data, void */*pdata*/)
 {
     switch (reinterpret_cast<std::size_t>(data)) {
         case SP_VERB_TUTORIAL_BASIC:
-            /* TRANSLATORS: If you have translated the tutorial-basic.svg file to your language,
-               then translate this string as "tutorial-basic.LANG.svg" (where LANG is your language
+            /* TRANSLATORS: If you have translated the tutorial-basic.en.svgz file to your language,
+               then translate this string as "tutorial-basic.LANG.svgz" (where LANG is your language
                code); otherwise leave as "tutorial-basic.svg". */
             sp_help_open_tutorial(NULL, (gpointer)_("tutorial-basic.svg"));
             break;
@@ -1929,6 +1876,10 @@ TutorialVerb::perform(SPAction */*action*/, void *data, void */*pdata*/)
             // TRANSLATORS: See "tutorial-basic.svg" comment.
             sp_help_open_tutorial(NULL, (gpointer)_("tutorial-calligraphy.svg"));
             break;
+        case SP_VERB_TUTORIAL_INTERPOLATE:
+            // TRANSLATORS: See "tutorial-basic.svg" comment.
+            sp_help_open_tutorial(NULL, (gpointer)_("tutorial-interpolate.svg"));
+            break;
         case SP_VERB_TUTORIAL_DESIGN:
             // TRANSLATORS: See "tutorial-basic.svg" comment.
             sp_help_open_tutorial(NULL, (gpointer)_("tutorial-elements.svg"));
@@ -2074,7 +2025,7 @@ EffectLastVerb::perform(SPAction *action, void *data, void */*pdata*/)
     if (effect == NULL) return;
     if (current_view == NULL) return;
 
-    switch ((long) data) {
+    switch (reinterpret_cast<std::size_t>(data)) {
         case SP_VERB_EFFECT_LAST_PREF:
             effect->prefs(current_view);
             break;
@@ -2139,7 +2090,7 @@ FitCanvasVerb::perform(SPAction *action, void *data, void */*pdata*/)
     SPDocument *doc = sp_desktop_document(dt);
     if (!doc) return;
 
-    switch ((long) data) {
+    switch (reinterpret_cast<std::size_t>(data)) {
         case SP_VERB_FIT_CANVAS_TO_SELECTION:
             verb_fit_canvas_to_selection(dt);
             break;
@@ -2208,7 +2159,7 @@ LockAndHideVerb::perform(SPAction *action, void *data, void */*pdata*/)
     SPDocument *doc = sp_desktop_document(dt);
     if (!doc) return;
 
-    switch ((long) data) {
+    switch (reinterpret_cast<std::size_t>(data)) {
         case SP_VERB_UNLOCK_ALL:
             unlock_all(dt);
             sp_document_done(doc, SP_VERB_UNLOCK_ALL, _("Unlock all objects in the current layer"));
@@ -2646,6 +2597,8 @@ Verb *Verb::_base_verbs[] = {
                    N_("Edit document metadata (to be saved with the document)"), INKSCAPE_ICON_DOCUMENT_METADATA ),
     new DialogVerb(SP_VERB_DIALOG_FILL_STROKE, "DialogFillStroke", N_("_Fill and Stroke..."),
                    N_("Edit objects' colors, gradients, stroke width, arrowheads, dash patterns..."), INKSCAPE_ICON_DIALOG_FILL_AND_STROKE),
+    new DialogVerb(SP_VERB_DIALOG_GLYPHS, "DialogGlyphs", N_("Glyphs..."),
+                   N_("Select characters from a glyphs palette"), GTK_STOCK_SELECT_FONT),
     // 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),
@@ -2683,8 +2636,6 @@ 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"), INKSCAPE_ICON_DIALOG_INPUT_DEVICES),
-    new DialogVerb(SP_VERB_DIALOG_INPUT2, "DialogInput2", N_("_Input Devices (new)..."),
-                   N_("Configure extended input devices, such as a graphics tablet"), INKSCAPE_ICON_DIALOG_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..."),
@@ -2720,6 +2671,8 @@ Verb *Verb::_base_verbs[] = {
                      N_("Using bitmap tracing"), NULL/*"tutorial_tracing"*/),
     new TutorialVerb(SP_VERB_TUTORIAL_CALLIGRAPHY, "TutorialsCalligraphy", N_("Inkscape: _Calligraphy"),
                      N_("Using the Calligraphy pen tool"), NULL),
+    new TutorialVerb(SP_VERB_TUTORIAL_INTERPOLATE, "TutorialsInterpolate", N_("Inkscape: _Interpolate"),
+                     N_("Using the interpolate extension"), NULL/*"tutorial_interpolate"*/),
     new TutorialVerb(SP_VERB_TUTORIAL_DESIGN, "TutorialsDesign", N_("_Elements of Design"),
                      N_("Principles of design in the tutorial form"), NULL/*"tutorial_design"*/),
     new TutorialVerb(SP_VERB_TUTORIAL_TIPS, "TutorialsTips", N_("_Tips and Tricks"),