Code

Mnemonics in "Input devices", and LPE dialogs (Bug 170765)
[inkscape.git] / src / verbs.cpp
index 378d812814de68d3247701338db5e6ecb5b2a0fe..33c52706bc77aaf178acdeda3c11471c7cb40682 100644 (file)
@@ -1,4 +1,3 @@
-#define __SP_VERBS_C__
 /**
  * \file verbs.cpp
  *
@@ -17,6 +16,7 @@
  *   David Turner <novalis@gnu.org>
  *   bulia byak <buliabyak@users.sf.net>
  *   Jon A. Cruz <jon@joncruz.org>
+ *   Abhishek Sharma
  *
  * Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>
  * Copyright (C) (date unspecified) Authors
@@ -82,6 +82,8 @@
 #include "ui/icon-names.h"
 #include "ui/tool/node-tool.h"
 
+using Inkscape::DocumentUndo;
+
 //#ifdef WITH_INKBOARD
 //#include "jabber_whiteboard/session-manager.h"
 //#endif
@@ -655,7 +657,7 @@ gchar const *Verb::get_tip(void)
                 g_free(shortcutString);
                 shortcutString = 0;
             } else {
-               _full_tip = g_strdup(_(_tip));
+                _full_tip = g_strdup(_(_tip));
             }
         }
         result = _full_tip;
@@ -1128,8 +1130,8 @@ LayerVerb::perform(SPAction *action, void *data, void */*pdata*/)
             SPObject *next=Inkscape::next_layer(dt->currentRoot(), dt->currentLayer());
             if (next) {
                 dt->setCurrentLayer(next);
-                sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_NEXT,
-                                 _("Switch to next layer"));
+                DocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_NEXT,
+                                   _("Switch to next layer"));
                 dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Switched to next layer."));
             } else {
                 dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Cannot go past last layer."));
@@ -1140,8 +1142,8 @@ LayerVerb::perform(SPAction *action, void *data, void */*pdata*/)
             SPObject *prev=Inkscape::previous_layer(dt->currentRoot(), dt->currentLayer());
             if (prev) {
                 dt->setCurrentLayer(prev);
-                sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_PREV,
-                                 _("Switch to previous layer"));
+                DocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_PREV,
+                                   _("Switch to previous layer"));
                 dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Switched to previous layer."));
             } else {
                 dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Cannot go before first layer."));
@@ -1168,7 +1170,7 @@ LayerVerb::perform(SPAction *action, void *data, void */*pdata*/)
             SPItem *layer=SP_ITEM(dt->currentLayer());
             g_return_if_fail(layer != NULL);
 
-            SPObject *old_pos=SP_OBJECT_NEXT(layer);
+            SPObject *old_pos = layer->getNext();
 
             switch (verb) {
                 case SP_VERB_LAYER_TO_TOP:
@@ -1185,7 +1187,7 @@ LayerVerb::perform(SPAction *action, void *data, void */*pdata*/)
                     break;
             }
 
-            if ( SP_OBJECT_NEXT(layer) != old_pos ) {
+            if ( layer->getNext() != old_pos ) {
                 char const *message = NULL;
                 Glib::ustring description = "";
                 switch (verb) {
@@ -1206,7 +1208,7 @@ LayerVerb::perform(SPAction *action, void *data, void */*pdata*/)
                         description = _("Lower layer");
                         break;
                 };
-                sp_document_done(sp_desktop_document(dt), verb, description);
+                DocumentUndo::done(sp_desktop_document(dt), verb, description);
                 if (message) {
                     dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, message);
                     g_free((void *) message);
@@ -1237,7 +1239,8 @@ LayerVerb::perform(SPAction *action, void *data, void */*pdata*/)
                 sp_edit_select_all(dt);
 #else
                 // Copies everything, regardless of locks, visibility, sublayers.
-                Inkscape::XML::Node *selected = dt->currentLayer()->repr;
+                //XML Tree being directly used here while it shouldn't be.
+                Inkscape::XML::Node *selected = dt->currentLayer()->getRepr();
                 Inkscape::XML::Node *parent = sp_repr_parent(selected);
                 Inkscape::XML::Node *dup = selected->duplicate(parent->document());
                 parent->addChild(dup, selected);
@@ -1251,8 +1254,8 @@ LayerVerb::perform(SPAction *action, void *data, void */*pdata*/)
                     dt->setCurrentLayer(new_layer);
                 }
 #endif
-                sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_DUPLICATE,
-                                 _("Duplicate layer"));
+                DocumentUndo::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."));
@@ -1283,8 +1286,8 @@ LayerVerb::perform(SPAction *action, void *data, void */*pdata*/)
                     dt->setCurrentLayer(survivor);
                 }
 
-                sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_DELETE,
-                                 _("Delete layer"));
+                DocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_DELETE,
+                                   _("Delete layer"));
 
                 // TRANSLATORS: this means "The layer has been deleted."
                 dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Deleted layer."));
@@ -1298,7 +1301,7 @@ LayerVerb::perform(SPAction *action, void *data, void */*pdata*/)
                 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"));
+                DocumentUndo::maybeDone(sp_desktop_document(dt), "layer:solo", SP_VERB_LAYER_SOLO, _("Toggle layer solo"));
             }
             break;
         }
@@ -1358,13 +1361,13 @@ ObjectVerb::perform( SPAction *action, void *data, void */*pdata*/ )
             break;
         case SP_VERB_OBJECT_FLIP_HORIZONTAL:
             sp_selection_scale_relative(sel, center, Geom::Scale(-1.0, 1.0));
-            sp_document_done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_HORIZONTAL,
-                             _("Flip horizontally"));
+            DocumentUndo::done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_HORIZONTAL,
+                               _("Flip horizontally"));
             break;
         case SP_VERB_OBJECT_FLIP_VERTICAL:
             sp_selection_scale_relative(sel, center, Geom::Scale(1.0, -1.0));
-            sp_document_done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_VERTICAL,
-                             _("Flip vertically"));
+            DocumentUndo::done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_VERTICAL,
+                               _("Flip vertically"));
             break;
         case SP_VERB_OBJECT_SET_MASK:
             sp_selection_set_mask(dt, false, false);
@@ -2192,19 +2195,19 @@ LockAndHideVerb::perform(SPAction *action, void *data, void */*pdata*/)
     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"));
+            DocumentUndo::done(doc, SP_VERB_UNLOCK_ALL, _("Unlock all objects in the current layer"));
             break;
         case SP_VERB_UNLOCK_ALL_IN_ALL_LAYERS:
             unlock_all_in_all_layers(dt);
-            sp_document_done(doc, SP_VERB_UNLOCK_ALL_IN_ALL_LAYERS, _("Unlock all objects in all layers"));
+            DocumentUndo::done(doc, SP_VERB_UNLOCK_ALL_IN_ALL_LAYERS, _("Unlock all objects in all layers"));
             break;
         case SP_VERB_UNHIDE_ALL:
             unhide_all(dt);
-            sp_document_done(doc, SP_VERB_UNHIDE_ALL, _("Unhide all objects in the current layer"));
+            DocumentUndo::done(doc, SP_VERB_UNHIDE_ALL, _("Unhide all objects in the current layer"));
             break;
         case SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS:
             unhide_all_in_all_layers(dt);
-            sp_document_done(doc, SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS, _("Unhide all objects in all layers"));
+            DocumentUndo::done(doc, SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS, _("Unhide all objects in all layers"));
             break;
         default:
             return;
@@ -2411,7 +2414,7 @@ Verb *Verb::_base_verbs[] = {
     // Advanced tutorial for more info
     new SelectionVerb(SP_VERB_SELECTION_BREAK_APART, "SelectionBreakApart", N_("Break _Apart"),
                       N_("Break selected paths into subpaths"), INKSCAPE_ICON_PATH_BREAK_APART),
-    new SelectionVerb(SP_VERB_SELECTION_GRIDTILE, "DialogGridArrange", N_("Rows and Columns..."),
+    new SelectionVerb(SP_VERB_SELECTION_GRIDTILE, "DialogGridArrange", N_("Ro_ws and Columns..."),
                       N_("Arrange selected objects in a table"), INKSCAPE_ICON_DIALOG_ROWS_AND_COLUMNS),
     /* Layer */
     new LayerVerb(SP_VERB_LAYER_NEW, "LayerNew", N_("_Add Layer..."),
@@ -2434,7 +2437,7 @@ Verb *Verb::_base_verbs[] = {
                   N_("Raise the current layer"), INKSCAPE_ICON_LAYER_RAISE),
     new LayerVerb(SP_VERB_LAYER_LOWER, "LayerLower", N_("_Lower Layer"),
                   N_("Lower the current layer"), INKSCAPE_ICON_LAYER_LOWER),
-    new LayerVerb(SP_VERB_LAYER_DUPLICATE, "LayerDuplicate", N_("Duplicate Current Layer"),
+    new LayerVerb(SP_VERB_LAYER_DUPLICATE, "LayerDuplicate", N_("D_uplicate Current Layer"),
                   N_("Duplicate an existing layer"), NULL),
     new LayerVerb(SP_VERB_LAYER_DELETE, "LayerDelete", N_("_Delete Current Layer"),
                   N_("Delete the current layer"), INKSCAPE_ICON_LAYER_DELETE),
@@ -2670,7 +2673,7 @@ Verb *Verb::_base_verbs[] = {
                    N_("Query information about extensions"), NULL),
     new DialogVerb(SP_VERB_DIALOG_LAYERS, "DialogLayers", N_("Layer_s..."),
                    N_("View Layers"), INKSCAPE_ICON_DIALOG_LAYERS),
-    new DialogVerb(SP_VERB_DIALOG_LIVE_PATH_EFFECT, "DialogLivePathEffect", N_("Path Effect Editor..."),
+    new DialogVerb(SP_VERB_DIALOG_LIVE_PATH_EFFECT, "DialogLivePathEffect", N_("Path E_ffect Editor..."),
                    N_("Manage, edit, and apply path effects"), NULL),
     new DialogVerb(SP_VERB_DIALOG_FILTER_EFFECTS, "DialogFilterEffects", N_("Filter Editor..."),
                    N_("Manage, edit, and apply SVG filters"), NULL),
@@ -2768,4 +2771,4 @@ Verb::list (void) {
   fill-column:99
   End:
 */
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :