Code

* Implement node snapping.
[inkscape.git] / src / verbs.cpp
1 #define __SP_VERBS_C__
2 /**
3  * \file verbs.cpp
4  *
5  * \brief Actions for inkscape
6  *
7  * This file implements routines necessary to deal with verbs.  A verb
8  * is a numeric identifier used to retrieve standard SPActions for particular
9  * views.
10  */
12 /*
13  * Authors:
14  *   Lauris Kaplinski <lauris@kaplinski.com>
15  *   Ted Gould <ted@gould.cx>
16  *   MenTaLguY <mental@rydia.net>
17  *   David Turner <novalis@gnu.org>
18  *   bulia byak <buliabyak@users.sf.net>
19  *
20  * Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>
21  * Copyright (C) (date unspecified) Authors
22  * This code is in public domain.
23  */
26 #ifdef HAVE_CONFIG_H
27 # include "config.h"
28 #endif
30 #include <cstring>
31 #include <gtk/gtkstock.h>
32 #include <gtkmm/filechooserdialog.h>
33 #include <gtkmm/messagedialog.h>
34 #include <gtkmm/stock.h>
35 #include <string>
37 #include "bind/javabind.h"
38 #include "desktop.h"
39 #include "desktop-handles.h"
40 #include "dialogs/clonetiler.h"
41 #include "dialogs/find.h"
42 #include "dialogs/input.h"
43 #include "dialogs/item-properties.h"
44 #include "dialogs/spellcheck.h"
45 #include "dialogs/text-edit.h"
46 #include "dialogs/xml-tree.h"
47 #include "display/curve.h"
48 #include "document.h"
49 #include "draw-context.h"
50 #include "extension/effect.h"
51 #include "file.h"
52 #include "gradient-context.h"
53 #include "gradient-drag.h"
54 #include "helper/action.h"
55 #include "help.h"
56 #include "inkscape-private.h"
57 #include "interface.h"
58 #include "layer-fns.h"
59 #include "layer-manager.h"
60 #include "message-stack.h"
61 #include "path-chemistry.h"
62 #include "preferences.h"
63 #include "select-context.h"
64 #include "selection-chemistry.h"
65 #include "seltrans.h"
66 #include "shape-editor.h"
67 #include "sp-flowtext.h"
68 #include "sp-guide.h"
69 #include "splivarot.h"
70 #include "sp-namedview.h"
71 #include "text-chemistry.h"
72 #include "tools-switch.h"
73 #include "ui/dialog/dialog-manager.h"
74 #include "ui/dialog/document-properties.h"
75 #include "ui/dialog/extensions.h"
76 #include "ui/dialog/icon-preview.h"
77 #include "ui/dialog/inkscape-preferences.h"
78 #include "ui/dialog/layer-properties.h"
79 #include "ui/dialog/layers.h"
80 #include "ui/dialog/swatches.h"
81 #include "ui/icon-names.h"
82 #include "ui/tool/control-point-selection.h"
83 #include "ui/tool/multi-path-manipulator.h"
84 #include "ui/tool/node-tool.h"
86 //#ifdef WITH_INKBOARD
87 //#include "jabber_whiteboard/session-manager.h"
88 //#endif
90 /**
91  * \brief Return the name without underscores and ellipsis, for use in dialog
92  * titles, etc. Allocated memory must be freed by caller.
93  */
94 gchar *
95 sp_action_get_title(SPAction const *action)
96 {
97     char const *src = action->name;
98     gchar *ret = g_new(gchar, strlen(src) + 1);
99     unsigned ri = 0;
101     for (unsigned si = 0 ; ; si++)  {
102         int const c = src[si];
103         if ( c != '_' && c != '.' ) {
104             ret[ri] = c;
105             ri++;
106             if (c == '\0') {
107                 return ret;
108             }
109         }
110     }
112 } // end of sp_action_get_title()
114 namespace Inkscape {
116 /** \brief A class to encompass all of the verbs which deal with
117            file operations. */
118 class FileVerb : public Verb {
119 private:
120     static void perform(SPAction *action, void *mydata, void *otherdata);
121     static SPActionEventVector vector;
122 protected:
123     virtual SPAction *make_action(Inkscape::UI::View::View *view);
124 public:
125     /** \brief Use the Verb initializer with the same parameters. */
126     FileVerb(unsigned int const code,
127              gchar const *id,
128              gchar const *name,
129              gchar const *tip,
130              gchar const *image) :
131         Verb(code, id, name, tip, image)
132     { }
133 }; /* FileVerb class */
135 /** \brief A class to encompass all of the verbs which deal with
136            edit operations. */
137 class EditVerb : public Verb {
138 private:
139     static void perform(SPAction *action, void *mydata, void *otherdata);
140     static SPActionEventVector vector;
141 protected:
142     virtual SPAction *make_action(Inkscape::UI::View::View *view);
143 public:
144     /** \brief Use the Verb initializer with the same parameters. */
145     EditVerb(unsigned int const code,
146              gchar const *id,
147              gchar const *name,
148              gchar const *tip,
149              gchar const *image) :
150         Verb(code, id, name, tip, image)
151     { }
152 }; /* EditVerb class */
154 /** \brief A class to encompass all of the verbs which deal with
155            selection operations. */
156 class SelectionVerb : public Verb {
157 private:
158     static void perform(SPAction *action, void *mydata, void *otherdata);
159     static SPActionEventVector vector;
160 protected:
161     virtual SPAction *make_action(Inkscape::UI::View::View *view);
162 public:
163     /** \brief Use the Verb initializer with the same parameters. */
164     SelectionVerb(unsigned int const code,
165                   gchar const *id,
166                   gchar const *name,
167                   gchar const *tip,
168                   gchar const *image) :
169         Verb(code, id, name, tip, image)
170     { }
171 }; /* SelectionVerb class */
173 /** \brief A class to encompass all of the verbs which deal with
174            layer operations. */
175 class LayerVerb : public Verb {
176 private:
177     static void perform(SPAction *action, void *mydata, void *otherdata);
178     static SPActionEventVector vector;
179 protected:
180     virtual SPAction *make_action(Inkscape::UI::View::View *view);
181 public:
182     /** \brief Use the Verb initializer with the same parameters. */
183     LayerVerb(unsigned int const code,
184               gchar const *id,
185               gchar const *name,
186               gchar const *tip,
187               gchar const *image) :
188         Verb(code, id, name, tip, image)
189     { }
190 }; /* LayerVerb class */
192 /** \brief A class to encompass all of the verbs which deal with
193            operations related to objects. */
194 class ObjectVerb : public Verb {
195 private:
196     static void perform(SPAction *action, void *mydata, void *otherdata);
197     static SPActionEventVector vector;
198 protected:
199     virtual SPAction *make_action(Inkscape::UI::View::View *view);
200 public:
201     /** \brief Use the Verb initializer with the same parameters. */
202     ObjectVerb(unsigned int const code,
203                gchar const *id,
204                gchar const *name,
205                gchar const *tip,
206                gchar const *image) :
207         Verb(code, id, name, tip, image)
208     { }
209 }; /* ObjectVerb class */
211 /** \brief A class to encompass all of the verbs which deal with
212            operations relative to context. */
213 class ContextVerb : public Verb {
214 private:
215     static void perform(SPAction *action, void *mydata, void *otherdata);
216     static SPActionEventVector vector;
217 protected:
218     virtual SPAction *make_action(Inkscape::UI::View::View *view);
219 public:
220     /** \brief Use the Verb initializer with the same parameters. */
221     ContextVerb(unsigned int const code,
222                 gchar const *id,
223                 gchar const *name,
224                 gchar const *tip,
225                 gchar const *image) :
226         Verb(code, id, name, tip, image)
227     { }
228 }; /* ContextVerb class */
230 /** \brief A class to encompass all of the verbs which deal with
231            zoom operations. */
232 class ZoomVerb : public Verb {
233 private:
234     static void perform(SPAction *action, void *mydata, void *otherdata);
235     static SPActionEventVector vector;
236 protected:
237     virtual SPAction *make_action(Inkscape::UI::View::View *view);
238 public:
239     /** \brief Use the Verb initializer with the same parameters. */
240     ZoomVerb(unsigned int const code,
241              gchar const *id,
242              gchar const *name,
243              gchar const *tip,
244              gchar const *image) :
245         Verb(code, id, name, tip, image)
246     { }
247 }; /* ZoomVerb class */
250 /** \brief A class to encompass all of the verbs which deal with
251            dialog operations. */
252 class DialogVerb : public Verb {
253 private:
254     static void perform(SPAction *action, void *mydata, void *otherdata);
255     static SPActionEventVector vector;
256 protected:
257     virtual SPAction *make_action(Inkscape::UI::View::View *view);
258 public:
259     /** \brief Use the Verb initializer with the same parameters. */
260     DialogVerb(unsigned int const code,
261                gchar const *id,
262                gchar const *name,
263                gchar const *tip,
264                gchar const *image) :
265         Verb(code, id, name, tip, image)
266     { }
267 }; /* DialogVerb class */
269 /** \brief A class to encompass all of the verbs which deal with
270            help operations. */
271 class HelpVerb : public Verb {
272 private:
273     static void perform(SPAction *action, void *mydata, void *otherdata);
274     static SPActionEventVector vector;
275 protected:
276     virtual SPAction *make_action(Inkscape::UI::View::View *view);
277 public:
278     /** \brief Use the Verb initializer with the same parameters. */
279     HelpVerb(unsigned int const code,
280              gchar const *id,
281              gchar const *name,
282              gchar const *tip,
283              gchar const *image) :
284         Verb(code, id, name, tip, image)
285     { }
286 }; /* HelpVerb class */
288 /** \brief A class to encompass all of the verbs which deal with
289            tutorial operations. */
290 class TutorialVerb : public Verb {
291 private:
292     static void perform(SPAction *action, void *mydata, void *otherdata);
293     static SPActionEventVector vector;
294 protected:
295     virtual SPAction *make_action(Inkscape::UI::View::View *view);
296 public:
297     /** \brief Use the Verb initializer with the same parameters. */
298     TutorialVerb(unsigned int const code,
299                  gchar const *id,
300                  gchar const *name,
301                  gchar const *tip,
302                  gchar const *image) :
303         Verb(code, id, name, tip, image)
304     { }
305 }; /* TutorialVerb class */
307 /** \brief A class to encompass all of the verbs which deal with
308            text operations. */
309 class TextVerb : public Verb {
310 private:
311     static void perform(SPAction *action, void *mydata, void *otherdata);
312     static SPActionEventVector vector;
313 protected:
314     virtual SPAction *make_action(Inkscape::UI::View::View *view);
315 public:
316     /** \brief Use the Verb initializer with the same parameters. */
317     TextVerb(unsigned int const code,
318               gchar const *id,
319               gchar const *name,
320               gchar const *tip,
321               gchar const *image) :
322         Verb(code, id, name, tip, image)
323     { }
324 }; //TextVerb : public Verb
326 Verb::VerbTable Verb::_verbs;
327 Verb::VerbIDTable Verb::_verb_ids;
329 /** \brief  Create a verb without a code.
331     This function calls the other constructor for all of the parameters,
332     but generates the code.  It is important to READ THE OTHER DOCUMENTATION
333     it has important details in it.  To generate the code a static is
334     used which starts at the last static value: \c SP_VERB_LAST.  For
335     each call it is incremented.  The list of allocated verbs is kept
336     in the \c _verbs hashtable which is indexed by the \c code.
337 */
338 Verb::Verb(gchar const *id, gchar const *name, gchar const *tip, gchar const *image) :
339     _actions(NULL), _id(id), _name(name), _tip(tip), _image(image)
341     static int count = SP_VERB_LAST;
343     count++;
344     _code = count;
345     _verbs.insert(VerbTable::value_type(count, this));
346     _verb_ids.insert(VerbIDTable::value_type(_id, this));
348     return;
351 /** \brief  Destroy a verb.
353       The only allocated variable is the _actions variable.  If it has
354     been allocated it is deleted.
355 */
356 Verb::~Verb(void)
358     /// \todo all the actions need to be cleaned up first.
359     if (_actions != NULL) {
360         delete _actions;
361     }
363     return;
366 /** \brief  Verbs are no good without actions.  This is a place holder
367             for a function that every subclass should write.  Most
368             can be written using \c make_action_helper.
369     \param  view  Which view the action should be created for.
370     \return NULL to represent error (this function shouldn't ever be called)
371 */
372 SPAction *
373 Verb::make_action(Inkscape::UI::View::View */*view*/)
375     //std::cout << "make_action" << std::endl;
376     return NULL;
379 /** \brief  Create an action for a \c FileVerb
380     \param  view  Which view the action should be created for
381     \return The built action.
383     Calls \c make_action_helper with the \c vector.
384 */
385 SPAction *
386 FileVerb::make_action(Inkscape::UI::View::View *view)
388     //std::cout << "fileverb: make_action: " << &vector << std::endl;
389     return make_action_helper(view, &vector);
392 /** \brief  Create an action for a \c EditVerb
393     \param  view  Which view the action should be created for
394     \return The built action.
396     Calls \c make_action_helper with the \c vector.
397 */
398 SPAction *
399 EditVerb::make_action(Inkscape::UI::View::View *view)
401     //std::cout << "editverb: make_action: " << &vector << std::endl;
402     return make_action_helper(view, &vector);
405 /** \brief  Create an action for a \c SelectionVerb
406     \param  view  Which view the action should be created for
407     \return The built action.
409     Calls \c make_action_helper with the \c vector.
410 */
411 SPAction *
412 SelectionVerb::make_action(Inkscape::UI::View::View *view)
414     return make_action_helper(view, &vector);
417 /** \brief  Create an action for a \c LayerVerb
418     \param  view  Which view the action should be created for
419     \return The built action.
421     Calls \c make_action_helper with the \c vector.
422 */
423 SPAction *
424 LayerVerb::make_action(Inkscape::UI::View::View *view)
426     return make_action_helper(view, &vector);
429 /** \brief  Create an action for a \c ObjectVerb
430     \param  view  Which view the action should be created for
431     \return The built action.
433     Calls \c make_action_helper with the \c vector.
434 */
435 SPAction *
436 ObjectVerb::make_action(Inkscape::UI::View::View *view)
438     return make_action_helper(view, &vector);
441 /** \brief  Create an action for a \c ContextVerb
442     \param  view  Which view the action should be created for
443     \return The built action.
445     Calls \c make_action_helper with the \c vector.
446 */
447 SPAction *
448 ContextVerb::make_action(Inkscape::UI::View::View *view)
450     return make_action_helper(view, &vector);
453 /** \brief  Create an action for a \c ZoomVerb
454     \param  view  Which view the action should be created for
455     \return The built action.
457     Calls \c make_action_helper with the \c vector.
458 */
459 SPAction *
460 ZoomVerb::make_action(Inkscape::UI::View::View *view)
462     return make_action_helper(view, &vector);
465 /** \brief  Create an action for a \c DialogVerb
466     \param  view  Which view the action should be created for
467     \return The built action.
469     Calls \c make_action_helper with the \c vector.
470 */
471 SPAction *
472 DialogVerb::make_action(Inkscape::UI::View::View *view)
474     return make_action_helper(view, &vector);
477 /** \brief  Create an action for a \c HelpVerb
478     \param  view  Which view the action should be created for
479     \return The built action.
481     Calls \c make_action_helper with the \c vector.
482 */
483 SPAction *
484 HelpVerb::make_action(Inkscape::UI::View::View *view)
486     return make_action_helper(view, &vector);
489 /** \brief  Create an action for a \c TutorialVerb
490     \param  view  Which view the action should be created for
491     \return The built action.
493     Calls \c make_action_helper with the \c vector.
494 */
495 SPAction *
496 TutorialVerb::make_action(Inkscape::UI::View::View *view)
498     return make_action_helper(view, &vector);
501 /** \brief  Create an action for a \c TextVerb
502     \param  view  Which view the action should be created for
503     \return The built action.
505     Calls \c make_action_helper with the \c vector.
506 */
507 SPAction *
508 TextVerb::make_action(Inkscape::UI::View::View *view)
510     return make_action_helper(view, &vector);
513 /** \brief A quick little convience function to make building actions
514            a little bit easier.
515     \param  view    Which view the action should be created for.
516     \param  vector  The function vector for the verb.
517     \return The created action.
519     This function does a couple of things.  The most obvious is that
520     it allocates and creates the action.  When it does this it
521     translates the \c _name and \c _tip variables.  This allows them
522     to be staticly allocated easily, and get translated in the end.  Then,
523     if the action gets crated, a listener is added to the action with
524     the vector that is passed in.
525 */
526 SPAction *
527 Verb::make_action_helper(Inkscape::UI::View::View *view, SPActionEventVector *vector, void *in_pntr)
529     SPAction *action;
531     //std::cout << "Adding action: " << _code << std::endl;
532     action = sp_action_new(view, _id, _(_name),
533                            _(_tip), _image, this);
535     if (action != NULL) {
536         if (in_pntr == NULL) {
537             nr_active_object_add_listener(
538                 (NRActiveObject *) action,
539                 (NRObjectEventVector *) vector,
540                 sizeof(SPActionEventVector),
541                 reinterpret_cast<void *>(_code)
542             );
543         } else {
544             nr_active_object_add_listener(
545                 (NRActiveObject *) action,
546                 (NRObjectEventVector *) vector,
547                 sizeof(SPActionEventVector),
548                 in_pntr
549             );
550         }
551     }
553     return action;
556 /** \brief  A function to get an action if it exists, or otherwise to
557             build it.
558     \param  view  The view which this action would relate to
559     \return The action, or NULL if there is an error.
561     This function will get the action for a given view for this verb.  It
562     will create the verb if it can't be found in the ActionTable.  Also,
563     if the \c ActionTable has not been created, it gets created by this
564     function.
566     If the action is created, it's sensitivity must be determined.  The
567     default for a new action is that it is sensitive.  If the value in
568     \c _default_sensitive is \c false, then the sensitivity must be
569     removed.  Also, if the view being created is based on the same
570     document as a view already created, the sensitivity should be the
571     same as views on that document.  A view with the same document is
572     looked for, and the sensitivity is matched.  Unfortunately, this is
573     currently a linear search.
574 */
575 SPAction *
576 Verb::get_action(Inkscape::UI::View::View *view)
578     SPAction *action = NULL;
580     if ( _actions == NULL ) {
581         _actions = new ActionTable;
582     }
583     ActionTable::iterator action_found = _actions->find(view);
585     if (action_found != _actions->end()) {
586         action = action_found->second;
587     } else {
588         action = this->make_action(view);
590         // if (action == NULL) printf("Hmm, NULL in %s\n", _name);
591         if (action == NULL) printf("Hmm, NULL in %s\n", _name);
592         if (!_default_sensitive) {
593             sp_action_set_sensitive(action, 0);
594         } else {
595             for (ActionTable::iterator cur_action = _actions->begin();
596                  cur_action != _actions->end() && view != NULL;
597                  cur_action++) {
598                 if (cur_action->first != NULL && cur_action->first->doc() == view->doc()) {
599                     sp_action_set_sensitive(action, cur_action->second->sensitive);
600                     break;
601                 }
602             }
603         }
605         _actions->insert(ActionTable::value_type(view, action));
606     }
608     return action;
611 void
612 Verb::sensitive(SPDocument *in_doc, bool in_sensitive)
614     // printf("Setting sensitivity of \"%s\" to %d\n", _name, in_sensitive);
615     if (_actions != NULL) {
616         for (ActionTable::iterator cur_action = _actions->begin();
617              cur_action != _actions->end();
618              cur_action++) {
619             if (in_doc == NULL || (cur_action->first != NULL && cur_action->first->doc() == in_doc)) {
620                 sp_action_set_sensitive(cur_action->second, in_sensitive ? 1 : 0);
621             }
622         }
623     }
625     if (in_doc == NULL) {
626         _default_sensitive = in_sensitive;
627     }
629     return;
632 /** \brief Accessor to get the tooltip for verb as localised string */
633 gchar const *
634 Verb::get_tip (void)
636         return _(_tip);
639 void
640 Verb::name(SPDocument *in_doc, Glib::ustring in_name)
642     if (_actions != NULL) {
643         for (ActionTable::iterator cur_action = _actions->begin();
644              cur_action != _actions->end();
645              cur_action++) {
646             if (in_doc == NULL || (cur_action->first != NULL && cur_action->first->doc() == in_doc)) {
647                 sp_action_set_name(cur_action->second, in_name);
648             }
649         }
650     }
653 /** \brief  A function to remove the action associated with a view.
654     \param  view  Which view's actions should be removed.
655     \return None
657     This function looks for the action in \c _actions.  If it is
658     found then it is unreferenced and the entry in the action
659     table is erased.
660 */
661 void
662 Verb::delete_view(Inkscape::UI::View::View *view)
664     if (_actions == NULL) return;
665     if (_actions->empty()) return;
667 #if 0
668     static int count = 0;
669     std::cout << count++ << std::endl;
670 #endif
672     ActionTable::iterator action_found = _actions->find(view);
674     if (action_found != _actions->end()) {
675         SPAction *action = action_found->second;
676         nr_object_unref(NR_OBJECT(action));
677         _actions->erase(action_found);
678     }
680     return;
683 /** \brief  A function to delete a view from all verbs
684     \param  view  Which view's actions should be removed.
685     \return None
687     This function first looks through _base_verbs and deteles
688     the view from all of those views.  If \c _verbs is not empty
689     then all of the entries in that table have all of the views
690     deleted also.
691 */
692 void
693 Verb::delete_all_view(Inkscape::UI::View::View *view)
695     for (int i = 0; i <= SP_VERB_LAST; i++) {
696         if (_base_verbs[i])
697           _base_verbs[i]->delete_view(view);
698     }
700     if (!_verbs.empty()) {
701         for (VerbTable::iterator thisverb = _verbs.begin();
702              thisverb != _verbs.end(); thisverb++) {
703             Inkscape::Verb *verbpntr = thisverb->second;
704             // std::cout << "Delete In Verb: " << verbpntr->_name << std::endl;
705             verbpntr->delete_view(view);
706         }
707     }
709     return;
712 /** \brief  A function to turn a \c code into a Verb for dynamically
713             created Verbs.
714     \param  code  What code is being looked for
715     \return The found Verb of NULL if none is found.
717     This function basically just looks through the \c _verbs hash
718     table.  STL does all the work.
719 */
720 Verb *
721 Verb::get_search(unsigned int code)
723     Verb *verb = NULL;
724     VerbTable::iterator verb_found = _verbs.find(code);
726     if (verb_found != _verbs.end()) {
727         verb = verb_found->second;
728     }
730     return verb;
733 /** \brief  Find a Verb using it's ID
734     \param  id  Which id to search for
736     This function uses the \c _verb_ids has table to find the
737     verb by it's id.  Should be much faster than previous
738     implementations.
739 */
740 Verb *
741 Verb::getbyid(gchar const *id)
743     Verb *verb = NULL;
744     VerbIDTable::iterator verb_found = _verb_ids.find(id);
746     if (verb_found != _verb_ids.end()) {
747         verb = verb_found->second;
748     }
750     if (verb == NULL)
751         printf("Unable to find: %s\n", id);
753     return verb;
756 /** \brief  Decode the verb code and take appropriate action */
757 void
758 FileVerb::perform(SPAction *action, void *data, void */*pdata*/)
760 #if 0
761     /* These aren't used, but are here to remind people not to use
762        the CURRENT_DOCUMENT macros unless they really have to. */
763     Inkscape::UI::View::View *current_view = sp_action_get_view(action);
764     SPDocument *current_document = current_view->doc();
765 #endif
767     SPDesktop *desktop = dynamic_cast<SPDesktop*>(sp_action_get_view(action));
768     g_assert(desktop != NULL);
769     Gtk::Window *parent = desktop->getToplevel();
770     g_assert(parent != NULL);
772     switch ((long) data) {
773         case SP_VERB_FILE_NEW:
774             sp_file_new_default();
775             break;
776         case SP_VERB_FILE_OPEN:
777             sp_file_open_dialog(*parent, NULL, NULL);
778             break;
779         case SP_VERB_FILE_REVERT:
780             sp_file_revert_dialog();
781             break;
782         case SP_VERB_FILE_SAVE:
783             sp_file_save(*parent, NULL, NULL);
784             break;
785         case SP_VERB_FILE_SAVE_AS:
786             sp_file_save_as(*parent, NULL, NULL);
787             break;
788         case SP_VERB_FILE_SAVE_A_COPY:
789             sp_file_save_a_copy(*parent, NULL, NULL);
790             break;
791         case SP_VERB_FILE_PRINT:
792             sp_file_print(*parent);
793             break;
794         case SP_VERB_FILE_VACUUM:
795             sp_file_vacuum();
796             break;
797         case SP_VERB_FILE_PRINT_PREVIEW:
798             sp_file_print_preview(NULL, NULL);
799             break;
800         case SP_VERB_FILE_IMPORT:
801             sp_file_import(*parent);
802             break;
803         case SP_VERB_FILE_EXPORT:
804             sp_file_export_dialog(*parent);
805             break;
806         case SP_VERB_FILE_IMPORT_FROM_OCAL:
807             sp_file_import_from_ocal(*parent);
808             break;
809 //        case SP_VERB_FILE_EXPORT_TO_OCAL:
810 //            sp_file_export_to_ocal(*parent);
811 //            break;
812         case SP_VERB_FILE_NEXT_DESKTOP:
813             inkscape_switch_desktops_next();
814             break;
815         case SP_VERB_FILE_PREV_DESKTOP:
816             inkscape_switch_desktops_prev();
817             break;
818         case SP_VERB_FILE_CLOSE_VIEW:
819             sp_ui_close_view(NULL);
820             break;
821         case SP_VERB_FILE_QUIT:
822             sp_file_exit();
823             break;
824         default:
825             break;
826     }
829 } // end of sp_verb_action_file_perform()
831 /** \brief  Decode the verb code and take appropriate action */
832 void
833 EditVerb::perform(SPAction *action, void *data, void */*pdata*/)
835     SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
836     if (!dt)
837         return;
838     SPEventContext *ec = dt->event_context;
840     switch (reinterpret_cast<std::size_t>(data)) {
841         case SP_VERB_EDIT_UNDO:
842             sp_undo(dt, sp_desktop_document(dt));
843             break;
844         case SP_VERB_EDIT_REDO:
845             sp_redo(dt, sp_desktop_document(dt));
846             break;
847         case SP_VERB_EDIT_CUT:
848             sp_selection_cut(dt);
849             break;
850         case SP_VERB_EDIT_COPY:
851             sp_selection_copy();
852             break;
853         case SP_VERB_EDIT_PASTE:
854             sp_selection_paste(dt, false);
855             break;
856         case SP_VERB_EDIT_PASTE_STYLE:
857             sp_selection_paste_style(dt);
858             break;
859         case SP_VERB_EDIT_PASTE_SIZE:
860             sp_selection_paste_size(dt, true, true);
861             break;
862         case SP_VERB_EDIT_PASTE_SIZE_X:
863             sp_selection_paste_size(dt, true, false);
864             break;
865         case SP_VERB_EDIT_PASTE_SIZE_Y:
866             sp_selection_paste_size(dt, false, true);
867             break;
868         case SP_VERB_EDIT_PASTE_SIZE_SEPARATELY:
869             sp_selection_paste_size_separately(dt, true, true);
870             break;
871         case SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_X:
872             sp_selection_paste_size_separately(dt, true, false);
873             break;
874         case SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_Y:
875             sp_selection_paste_size_separately(dt, false, true);
876             break;
877         case SP_VERB_EDIT_PASTE_IN_PLACE:
878             sp_selection_paste(dt, true);
879             break;
880         case SP_VERB_EDIT_PASTE_LIVEPATHEFFECT:
881             sp_selection_paste_livepatheffect(dt);
882             break;
883         case SP_VERB_EDIT_REMOVE_LIVEPATHEFFECT:
884             sp_selection_remove_livepatheffect(dt);
885             break;
886         case SP_VERB_EDIT_REMOVE_FILTER:
887             sp_selection_remove_filter(dt);
888             break;
889         case SP_VERB_EDIT_DELETE:
890             sp_selection_delete(dt);
891             break;
892         case SP_VERB_EDIT_DUPLICATE:
893             sp_selection_duplicate(dt);
894             break;
895         case SP_VERB_EDIT_CLONE:
896             sp_selection_clone(dt);
897             break;
898         case SP_VERB_EDIT_UNLINK_CLONE:
899             sp_selection_unlink(dt);
900             break;
901         case SP_VERB_EDIT_RELINK_CLONE:
902             sp_selection_relink(dt);
903             break;
904         case SP_VERB_EDIT_CLONE_SELECT_ORIGINAL:
905             sp_select_clone_original(dt);
906             break;
907         case SP_VERB_EDIT_SELECTION_2_MARKER:
908             sp_selection_to_marker(dt);
909             break;
910         case SP_VERB_EDIT_SELECTION_2_GUIDES:
911             sp_selection_to_guides(dt);
912             break;
913         case SP_VERB_EDIT_TILE:
914             sp_selection_tile(dt);
915             break;
916         case SP_VERB_EDIT_UNTILE:
917             sp_selection_untile(dt);
918             break;
919         case SP_VERB_EDIT_CLEAR_ALL:
920             sp_edit_clear_all(dt);
921             break;
922         case SP_VERB_EDIT_SELECT_ALL:
923             if (tools_isactive(dt, TOOLS_NODES)) {
924                 InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
925                 nt->_multipath->selectSubpaths();
926             } else {
927                 sp_edit_select_all(dt);
928             }
929             break;
930         case SP_VERB_EDIT_INVERT:
931             if (tools_isactive(dt, TOOLS_NODES)) {
932                 InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
933                 nt->_multipath->invertSelectionInSubpaths();
934             } else {
935                 sp_edit_invert(dt);
936             }
937             break;
938         case SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS:
939             if (tools_isactive(dt, TOOLS_NODES)) {
940                 InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
941                 nt->_selected_nodes->selectAll();
942             } else {
943                 sp_edit_select_all_in_all_layers(dt);
944             }
945             break;
946         case SP_VERB_EDIT_INVERT_IN_ALL_LAYERS:
947             if (tools_isactive(dt, TOOLS_NODES)) {
948                 InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
949                 nt->_selected_nodes->invertSelection();
950             } else {
951                 sp_edit_invert_in_all_layers(dt);
952             }
953             break;
955         case SP_VERB_EDIT_SELECT_NEXT:
956             if (tools_isactive(dt, TOOLS_NODES)) {
957                 InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
958                 nt->_multipath->shiftSelection(1);
959             } else if (tools_isactive(dt, TOOLS_GRADIENT)
960                        && ec->_grdrag->isNonEmpty()) {
961                 sp_gradient_context_select_next (ec);
962             } else {
963                 sp_selection_item_next(dt);
964             }
965             break;
966         case SP_VERB_EDIT_SELECT_PREV:
967             if (tools_isactive(dt, TOOLS_NODES)) {
968                 InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
969                 nt->_multipath->shiftSelection(-1);
970             } else if (tools_isactive(dt, TOOLS_GRADIENT)
971                        && ec->_grdrag->isNonEmpty()) {
972                 sp_gradient_context_select_prev (ec);
973             } else {
974                 sp_selection_item_prev(dt);
975             }
976             break;
978         case SP_VERB_EDIT_DESELECT:
979             if (tools_isactive(dt, TOOLS_NODES)) {
980                 InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
981                 nt->_selected_nodes->clear();
982             } else {
983                 sp_desktop_selection(dt)->clear();
984             }
985             break;
987         case SP_VERB_EDIT_GUIDES_AROUND_PAGE:
988             sp_guide_create_guides_around_page(dt);
989             break;
991         case SP_VERB_EDIT_NEXT_PATHEFFECT_PARAMETER:
992             sp_selection_next_patheffect_param(dt);
993             break;
994         case SP_VERB_EDIT_LINK_COLOR_PROFILE:
995             break;
996         case SP_VERB_EDIT_REMOVE_COLOR_PROFILE:
997             break;
998         default:
999             break;
1000     }
1002 } // end of sp_verb_action_edit_perform()
1004 /** \brief  Decode the verb code and take appropriate action */
1005 void
1006 SelectionVerb::perform(SPAction *action, void *data, void */*pdata*/)
1008     SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1010     if (!dt)
1011         return;
1013     g_assert(dt->_dlg_mgr != NULL);
1015     switch (reinterpret_cast<std::size_t>(data)) {
1016         case SP_VERB_SELECTION_TO_FRONT:
1017             sp_selection_raise_to_top(dt);
1018             break;
1019         case SP_VERB_SELECTION_TO_BACK:
1020             sp_selection_lower_to_bottom(dt);
1021             break;
1022         case SP_VERB_SELECTION_RAISE:
1023             sp_selection_raise(dt);
1024             break;
1025         case SP_VERB_SELECTION_LOWER:
1026             sp_selection_lower(dt);
1027             break;
1028         case SP_VERB_SELECTION_GROUP:
1029             sp_selection_group(dt);
1030             break;
1031         case SP_VERB_SELECTION_UNGROUP:
1032             sp_selection_ungroup(dt);
1033             break;
1035         case SP_VERB_SELECTION_TEXTTOPATH:
1036             text_put_on_path();
1037             break;
1038         case SP_VERB_SELECTION_TEXTFROMPATH:
1039             text_remove_from_path();
1040             break;
1041         case SP_VERB_SELECTION_REMOVE_KERNS:
1042             text_remove_all_kerns();
1043             break;
1045         case SP_VERB_SELECTION_UNION:
1046             sp_selected_path_union(dt);
1047             break;
1048         case SP_VERB_SELECTION_INTERSECT:
1049             sp_selected_path_intersect(dt);
1050             break;
1051         case SP_VERB_SELECTION_DIFF:
1052             sp_selected_path_diff(dt);
1053             break;
1054         case SP_VERB_SELECTION_SYMDIFF:
1055             sp_selected_path_symdiff(dt);
1056             break;
1058         case SP_VERB_SELECTION_CUT:
1059             sp_selected_path_cut(dt);
1060             break;
1061         case SP_VERB_SELECTION_SLICE:
1062             sp_selected_path_slice(dt);
1063             break;
1065         case SP_VERB_SELECTION_OFFSET:
1066             sp_selected_path_offset(dt);
1067             break;
1068         case SP_VERB_SELECTION_OFFSET_SCREEN:
1069             sp_selected_path_offset_screen(dt, 1);
1070             break;
1071         case SP_VERB_SELECTION_OFFSET_SCREEN_10:
1072             sp_selected_path_offset_screen(dt, 10);
1073             break;
1074         case SP_VERB_SELECTION_INSET:
1075             sp_selected_path_inset(dt);
1076             break;
1077         case SP_VERB_SELECTION_INSET_SCREEN:
1078             sp_selected_path_inset_screen(dt, 1);
1079             break;
1080         case SP_VERB_SELECTION_INSET_SCREEN_10:
1081             sp_selected_path_inset_screen(dt, 10);
1082             break;
1083         case SP_VERB_SELECTION_DYNAMIC_OFFSET:
1084             sp_selected_path_create_offset_object_zero(dt);
1085             tools_switch(dt, TOOLS_NODES);
1086             break;
1087         case SP_VERB_SELECTION_LINKED_OFFSET:
1088             sp_selected_path_create_updating_offset_object_zero(dt);
1089             tools_switch(dt, TOOLS_NODES);
1090             break;
1091         case SP_VERB_SELECTION_OUTLINE:
1092             sp_selected_path_outline(dt);
1093             break;
1094         case SP_VERB_SELECTION_SIMPLIFY:
1095             sp_selected_path_simplify(dt);
1096             break;
1097         case SP_VERB_SELECTION_REVERSE:
1098             // TODO make this a virtual method of event context!
1099             if (tools_isactive(dt, TOOLS_NODES)) {
1100                 InkNodeTool *nt = static_cast<InkNodeTool*>(dt->event_context);
1101                 nt->_multipath->reverseSubpaths();
1102             } else {
1103                 sp_selected_path_reverse(dt);
1104             }
1105             break;
1106         case SP_VERB_SELECTION_TRACE:
1107             inkscape_dialogs_unhide();
1108             dt->_dlg_mgr->showDialog("Trace");
1109             break;
1110         case SP_VERB_SELECTION_CREATE_BITMAP:
1111             sp_selection_create_bitmap_copy(dt);
1112             break;
1114         case SP_VERB_SELECTION_COMBINE:
1115             sp_selected_path_combine(dt);
1116             break;
1117         case SP_VERB_SELECTION_BREAK_APART:
1118             sp_selected_path_break_apart(dt);
1119             break;
1120         case SP_VERB_SELECTION_GRIDTILE:
1121             inkscape_dialogs_unhide();
1122             dt->_dlg_mgr->showDialog("TileDialog");
1123             break;
1124         default:
1125             break;
1126     }
1128 } // end of sp_verb_action_selection_perform()
1130 /** \brief  Decode the verb code and take appropriate action */
1131 void
1132 LayerVerb::perform(SPAction *action, void *data, void */*pdata*/)
1134     SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1135     unsigned int verb = reinterpret_cast<std::size_t>(data);
1137     if ( !dt || !dt->currentLayer() ) {
1138         return;
1139     }
1141     switch (verb) {
1142         case SP_VERB_LAYER_NEW: {
1143             Inkscape::UI::Dialogs::LayerPropertiesDialog::showCreate(dt, dt->currentLayer());
1144             break;
1145         }
1146         case SP_VERB_LAYER_RENAME: {
1147             Inkscape::UI::Dialogs::LayerPropertiesDialog::showRename(dt, dt->currentLayer());
1148             break;
1149         }
1150         case SP_VERB_LAYER_NEXT: {
1151             SPObject *next=Inkscape::next_layer(dt->currentRoot(), dt->currentLayer());
1152             if (next) {
1153                 dt->setCurrentLayer(next);
1154                 sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_NEXT,
1155                                  _("Switch to next layer"));
1156                 dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Switched to next layer."));
1157             } else {
1158                 dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Cannot go past last layer."));
1159             }
1160             break;
1161         }
1162         case SP_VERB_LAYER_PREV: {
1163             SPObject *prev=Inkscape::previous_layer(dt->currentRoot(), dt->currentLayer());
1164             if (prev) {
1165                 dt->setCurrentLayer(prev);
1166                 sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_PREV,
1167                                  _("Switch to previous layer"));
1168                 dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Switched to previous layer."));
1169             } else {
1170                 dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Cannot go before first layer."));
1171             }
1172             break;
1173         }
1174         case SP_VERB_LAYER_MOVE_TO_NEXT: {
1175             sp_selection_to_next_layer(dt);
1176             break;
1177         }
1178         case SP_VERB_LAYER_MOVE_TO_PREV: {
1179             sp_selection_to_prev_layer(dt);
1180             break;
1181         }
1182         case SP_VERB_LAYER_TO_TOP:
1183         case SP_VERB_LAYER_TO_BOTTOM:
1184         case SP_VERB_LAYER_RAISE:
1185         case SP_VERB_LAYER_LOWER: {
1186             if ( dt->currentLayer() == dt->currentRoot() ) {
1187                 dt->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No current layer."));
1188                 return;
1189             }
1191             SPItem *layer=SP_ITEM(dt->currentLayer());
1192             g_return_if_fail(layer != NULL);
1194             SPObject *old_pos=SP_OBJECT_NEXT(layer);
1196             switch (verb) {
1197                 case SP_VERB_LAYER_TO_TOP:
1198                     layer->raiseToTop();
1199                     break;
1200                 case SP_VERB_LAYER_TO_BOTTOM:
1201                     layer->lowerToBottom();
1202                     break;
1203                 case SP_VERB_LAYER_RAISE:
1204                     layer->raiseOne();
1205                     break;
1206                 case SP_VERB_LAYER_LOWER:
1207                     layer->lowerOne();
1208                     break;
1209             }
1211             if ( SP_OBJECT_NEXT(layer) != old_pos ) {
1212                 char const *message = NULL;
1213                 Glib::ustring description = "";
1214                 switch (verb) {
1215                     case SP_VERB_LAYER_TO_TOP:
1216                         message = g_strdup_printf(_("Raised layer <b>%s</b>."), layer->defaultLabel());
1217                         description = _("Layer to top");
1218                         break;
1219                     case SP_VERB_LAYER_RAISE:
1220                         message = g_strdup_printf(_("Raised layer <b>%s</b>."), layer->defaultLabel());
1221                         description = _("Raise layer");
1222                         break;
1223                     case SP_VERB_LAYER_TO_BOTTOM:
1224                         message = g_strdup_printf(_("Lowered layer <b>%s</b>."), layer->defaultLabel());
1225                         description = _("Layer to bottom");
1226                         break;
1227                     case SP_VERB_LAYER_LOWER:
1228                         message = g_strdup_printf(_("Lowered layer <b>%s</b>."), layer->defaultLabel());
1229                         description = _("Lower layer");
1230                         break;
1231                 };
1232                 sp_document_done(sp_desktop_document(dt), verb, description);
1233                 if (message) {
1234                     dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, message);
1235                     g_free((void *) message);
1236                 }
1237             } else {
1238                 dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Cannot move layer any further."));
1239             }
1241             break;
1242         }
1243         case SP_VERB_LAYER_DUPLICATE: {
1244             if ( dt->currentLayer() != dt->currentRoot() ) {
1245                 // Note with either approach:
1246                 // Any clone masters are duplicated, their clones use the *original*,
1247                 // but the duplicated master is not linked up as master nor clone of the original.
1248 #if 0
1249                 // Only copies selectable things, honoring locks, visibility, avoids sublayers.
1250                 SPObject *new_layer = Inkscape::create_layer(dt->currentRoot(), dt->currentLayer(), LPOS_BELOW);
1251                 if ( dt->currentLayer()->label() ) {
1252                     gchar* name = g_strdup_printf(_("%s copy"), dt->currentLayer()->label());
1253                     dt->layer_manager->renameLayer( new_layer, name, TRUE );
1254                     g_free(name);
1255                 }
1256                 sp_edit_select_all(dt);
1257                 sp_selection_duplicate(dt, true);
1258                 sp_selection_to_prev_layer(dt, true);
1259                 dt->setCurrentLayer(new_layer);
1260                 sp_edit_select_all(dt);
1261 #else
1262                 // Copies everything, regardless of locks, visibility, sublayers.
1263                 Inkscape::XML::Node *selected = dt->currentLayer()->repr;
1264                 Inkscape::XML::Node *parent = sp_repr_parent(selected);
1265                 Inkscape::XML::Node *dup = selected->duplicate(parent->document());
1266                 parent->addChild(dup, selected);
1267                 SPObject *new_layer = dt->currentLayer()->next;
1268                 if (new_layer) {
1269                     if (new_layer->label()) {
1270                         gchar* name = g_strdup_printf(_("%s copy"), new_layer->label());
1271                         dt->layer_manager->renameLayer( new_layer, name, TRUE );
1272                         g_free(name);
1273                     }
1274                     dt->setCurrentLayer(new_layer);
1275                 }
1276 #endif
1277                 sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_DUPLICATE,
1278                                  _("Duplicate layer"));
1280                 // TRANSLATORS: this means "The layer has been duplicated."
1281                 dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Duplicated layer."));
1282             } else {
1283                 dt->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No current layer."));
1284             }
1285             break;
1286         }
1287         case SP_VERB_LAYER_DELETE: {
1288             if ( dt->currentLayer() != dt->currentRoot() ) {
1289                 sp_desktop_selection(dt)->clear();
1290                 SPObject *old_layer=dt->currentLayer();
1292                 sp_object_ref(old_layer, NULL);
1293                 SPObject *survivor=Inkscape::next_layer(dt->currentRoot(), old_layer);
1294                 if (!survivor) {
1295                     survivor = Inkscape::previous_layer(dt->currentRoot(), old_layer);
1296                 }
1298                 /* Deleting the old layer before switching layers is a hack to trigger the
1299                  * listeners of the deletion event (as happens when old_layer is deleted using the
1300                  * xml editor).  See
1301                  * http://sourceforge.net/tracker/index.php?func=detail&aid=1339397&group_id=93438&atid=604306
1302                  */
1303                 old_layer->deleteObject();
1304                 sp_object_unref(old_layer, NULL);
1305                 if (survivor) {
1306                     dt->setCurrentLayer(survivor);
1307                 }
1309                 sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_DELETE,
1310                                  _("Delete layer"));
1312                 // TRANSLATORS: this means "The layer has been deleted."
1313                 dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Deleted layer."));
1314             } else {
1315                 dt->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No current layer."));
1316             }
1317             break;
1318         }
1319         case SP_VERB_LAYER_SOLO: {
1320             if ( dt->currentLayer() == dt->currentRoot() ) {
1321                 dt->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No current layer."));
1322             } else {
1323                 dt->toggleLayerSolo( dt->currentLayer() );
1324                 sp_document_maybe_done(sp_desktop_document(dt), "layer:solo", SP_VERB_LAYER_SOLO, _("Toggle layer solo"));
1325             }
1326             break;
1327         }
1328     }
1330     return;
1331 } // end of sp_verb_action_layer_perform()
1333 /** \brief  Decode the verb code and take appropriate action */
1334 void
1335 ObjectVerb::perform( SPAction *action, void *data, void */*pdata*/ )
1337     SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1338     if (!dt)
1339         return;
1341     SPEventContext *ec = dt->event_context;
1343     Inkscape::Selection *sel = sp_desktop_selection(dt);
1345     if (sel->isEmpty())
1346         return;
1348     Geom::OptRect bbox = sel->bounds();
1349     if (!bbox) {
1350         return;
1351     }
1352     // If the rotation center of the selection is visible, choose it as reference point
1353     // for horizontal and vertical flips. Otherwise, take the center of the bounding box.
1354     Geom::Point center;
1355     if (tools_isactive(dt, TOOLS_SELECT) && sel->center() && SP_SELECT_CONTEXT(ec)->_seltrans->centerIsVisible())
1356         center = *sel->center();
1357     else
1358         center = bbox->midpoint();
1360     switch (reinterpret_cast<std::size_t>(data)) {
1361         case SP_VERB_OBJECT_ROTATE_90_CW:
1362             sp_selection_rotate_90(dt, false);
1363             break;
1364         case SP_VERB_OBJECT_ROTATE_90_CCW:
1365             sp_selection_rotate_90(dt, true);
1366             break;
1367         case SP_VERB_OBJECT_FLATTEN:
1368             sp_selection_remove_transform(dt);
1369             break;
1370         case SP_VERB_OBJECT_TO_CURVE:
1371             sp_selected_path_to_curves(dt);
1372             break;
1373         case SP_VERB_OBJECT_FLOW_TEXT:
1374             text_flow_into_shape();
1375             break;
1376         case SP_VERB_OBJECT_UNFLOW_TEXT:
1377             text_unflow();
1378             break;
1379         case SP_VERB_OBJECT_FLOWTEXT_TO_TEXT:
1380             flowtext_to_text();
1381             break;
1382         case SP_VERB_OBJECT_FLIP_HORIZONTAL:
1383             sp_selection_scale_relative(sel, center, Geom::Scale(-1.0, 1.0));
1384             sp_document_done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_HORIZONTAL,
1385                              _("Flip horizontally"));
1386             break;
1387         case SP_VERB_OBJECT_FLIP_VERTICAL:
1388             sp_selection_scale_relative(sel, center, Geom::Scale(1.0, -1.0));
1389             sp_document_done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_VERTICAL,
1390                              _("Flip vertically"));
1391             break;
1392         case SP_VERB_OBJECT_SET_MASK:
1393             sp_selection_set_mask(dt, false, false);
1394             break;
1395         case SP_VERB_OBJECT_EDIT_MASK:
1396             sp_selection_edit_clip_or_mask(dt, false);
1397             break;
1398         case SP_VERB_OBJECT_UNSET_MASK:
1399             sp_selection_unset_mask(dt, false);
1400             break;
1401         case SP_VERB_OBJECT_SET_CLIPPATH:
1402             sp_selection_set_mask(dt, true, false);
1403             break;
1404         case SP_VERB_OBJECT_EDIT_CLIPPATH:
1405             sp_selection_edit_clip_or_mask(dt, true);
1406             break;
1407         case SP_VERB_OBJECT_UNSET_CLIPPATH:
1408             sp_selection_unset_mask(dt, true);
1409             break;
1410         default:
1411             break;
1412     }
1414 } // end of sp_verb_action_object_perform()
1416 /** \brief  Decode the verb code and take appropriate action */
1417 void
1418 ContextVerb::perform(SPAction *action, void *data, void */*pdata*/)
1420     SPDesktop *dt;
1421     sp_verb_t verb;
1422     int vidx;
1424     dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1426     if (!dt)
1427         return;
1429     verb = (sp_verb_t)GPOINTER_TO_INT((gpointer)data);
1431     /** \todo !!! hopefully this can go away soon and actions can look after
1432      * themselves
1433      */
1434     for (vidx = SP_VERB_CONTEXT_SELECT; vidx <= SP_VERB_CONTEXT_PAINTBUCKET_PREFS; vidx++)
1435     {
1436         SPAction *tool_action= get((sp_verb_t)vidx)->get_action(dt);
1437         if (tool_action) {
1438             sp_action_set_active(tool_action, vidx == (int)verb);
1439         }
1440     }
1442     Inkscape::Preferences *prefs = Inkscape::Preferences::get();
1443     switch (verb) {
1444         case SP_VERB_CONTEXT_SELECT:
1445             tools_switch(dt, TOOLS_SELECT);
1446             break;
1447         case SP_VERB_CONTEXT_NODE:
1448             tools_switch(dt, TOOLS_NODES);
1449             break;
1450         case SP_VERB_CONTEXT_TWEAK:
1451             tools_switch(dt, TOOLS_TWEAK);
1452             break;
1453         case SP_VERB_CONTEXT_RECT:
1454             tools_switch(dt, TOOLS_SHAPES_RECT);
1455             break;
1456         case SP_VERB_CONTEXT_3DBOX:
1457             tools_switch(dt, TOOLS_SHAPES_3DBOX);
1458             break;
1459         case SP_VERB_CONTEXT_ARC:
1460             tools_switch(dt, TOOLS_SHAPES_ARC);
1461             break;
1462         case SP_VERB_CONTEXT_STAR:
1463             tools_switch(dt, TOOLS_SHAPES_STAR);
1464             break;
1465         case SP_VERB_CONTEXT_SPIRAL:
1466             tools_switch(dt, TOOLS_SHAPES_SPIRAL);
1467             break;
1468         case SP_VERB_CONTEXT_PENCIL:
1469             tools_switch(dt, TOOLS_FREEHAND_PENCIL);
1470             break;
1471         case SP_VERB_CONTEXT_PEN:
1472             tools_switch(dt, TOOLS_FREEHAND_PEN);
1473             break;
1474         case SP_VERB_CONTEXT_CALLIGRAPHIC:
1475             tools_switch(dt, TOOLS_CALLIGRAPHIC);
1476             break;
1477         case SP_VERB_CONTEXT_TEXT:
1478             tools_switch(dt, TOOLS_TEXT);
1479             break;
1480         case SP_VERB_CONTEXT_GRADIENT:
1481             tools_switch(dt, TOOLS_GRADIENT);
1482             break;
1483         case SP_VERB_CONTEXT_ZOOM:
1484             tools_switch(dt, TOOLS_ZOOM);
1485             break;
1486         case SP_VERB_CONTEXT_DROPPER:
1487             tools_switch(dt, TOOLS_DROPPER);
1488             break;
1489         case SP_VERB_CONTEXT_CONNECTOR:
1490             tools_switch(dt,  TOOLS_CONNECTOR);
1491             break;
1492         case SP_VERB_CONTEXT_PAINTBUCKET:
1493             tools_switch(dt, TOOLS_PAINTBUCKET);
1494             break;
1495         case SP_VERB_CONTEXT_ERASER:
1496             tools_switch(dt, TOOLS_ERASER);
1497             break;
1498         case SP_VERB_CONTEXT_LPETOOL:
1499             tools_switch(dt, TOOLS_LPETOOL);
1500             break;
1502         case SP_VERB_CONTEXT_SELECT_PREFS:
1503             prefs->setInt("/dialogs/preferences/page", PREFS_PAGE_TOOLS_SELECTOR);
1504             dt->_dlg_mgr->showDialog("InkscapePreferences");
1505             break;
1506         case SP_VERB_CONTEXT_NODE_PREFS:
1507             prefs->setInt("/dialogs/preferences/page", PREFS_PAGE_TOOLS_NODE);
1508             dt->_dlg_mgr->showDialog("InkscapePreferences");
1509             break;
1510         case SP_VERB_CONTEXT_TWEAK_PREFS:
1511             prefs->setInt("/dialogs/preferences/page", PREFS_PAGE_TOOLS_TWEAK);
1512             dt->_dlg_mgr->showDialog("InkscapePreferences");
1513             break;
1514         case SP_VERB_CONTEXT_RECT_PREFS:
1515             prefs->setInt("/dialogs/preferences/page", PREFS_PAGE_TOOLS_SHAPES_RECT);
1516             dt->_dlg_mgr->showDialog("InkscapePreferences");
1517             break;
1518         case SP_VERB_CONTEXT_3DBOX_PREFS:
1519             prefs->setInt("/dialogs/preferences/page", PREFS_PAGE_TOOLS_SHAPES_3DBOX);
1520             dt->_dlg_mgr->showDialog("InkscapePreferences");
1521             break;
1522         case SP_VERB_CONTEXT_ARC_PREFS:
1523             prefs->setInt("/dialogs/preferences/page", PREFS_PAGE_TOOLS_SHAPES_ELLIPSE);
1524             dt->_dlg_mgr->showDialog("InkscapePreferences");
1525             break;
1526         case SP_VERB_CONTEXT_STAR_PREFS:
1527             prefs->setInt("/dialogs/preferences/page", PREFS_PAGE_TOOLS_SHAPES_STAR);
1528             dt->_dlg_mgr->showDialog("InkscapePreferences");
1529             break;
1530         case SP_VERB_CONTEXT_SPIRAL_PREFS:
1531             prefs->setInt("/dialogs/preferences/page", PREFS_PAGE_TOOLS_SHAPES_SPIRAL);
1532             dt->_dlg_mgr->showDialog("InkscapePreferences");
1533             break;
1534         case SP_VERB_CONTEXT_PENCIL_PREFS:
1535             prefs->setInt("/dialogs/preferences/page", PREFS_PAGE_TOOLS_PENCIL);
1536             dt->_dlg_mgr->showDialog("InkscapePreferences");
1537             break;
1538         case SP_VERB_CONTEXT_PEN_PREFS:
1539             prefs->setInt("/dialogs/preferences/page", PREFS_PAGE_TOOLS_PEN);
1540             dt->_dlg_mgr->showDialog("InkscapePreferences");
1541             break;
1542         case SP_VERB_CONTEXT_CALLIGRAPHIC_PREFS:
1543             prefs->setInt("/dialogs/preferences/page", PREFS_PAGE_TOOLS_CALLIGRAPHY);
1544             dt->_dlg_mgr->showDialog("InkscapePreferences");
1545             break;
1546         case SP_VERB_CONTEXT_TEXT_PREFS:
1547             prefs->setInt("/dialogs/preferences/page", PREFS_PAGE_TOOLS_TEXT);
1548             dt->_dlg_mgr->showDialog("InkscapePreferences");
1549             break;
1550         case SP_VERB_CONTEXT_GRADIENT_PREFS:
1551             prefs->setInt("/dialogs/preferences/page", PREFS_PAGE_TOOLS_GRADIENT);
1552             dt->_dlg_mgr->showDialog("InkscapePreferences");
1553             break;
1554         case SP_VERB_CONTEXT_ZOOM_PREFS:
1555             prefs->setInt("/dialogs/preferences/page", PREFS_PAGE_TOOLS_ZOOM);
1556             dt->_dlg_mgr->showDialog("InkscapePreferences");
1557             break;
1558         case SP_VERB_CONTEXT_DROPPER_PREFS:
1559             prefs->setInt("/dialogs/preferences/page", PREFS_PAGE_TOOLS_DROPPER);
1560             dt->_dlg_mgr->showDialog("InkscapePreferences");
1561             break;
1562         case SP_VERB_CONTEXT_CONNECTOR_PREFS:
1563             prefs->setInt("/dialogs/preferences/page", PREFS_PAGE_TOOLS_CONNECTOR);
1564             dt->_dlg_mgr->showDialog("InkscapePreferences");
1565             break;
1566         case SP_VERB_CONTEXT_PAINTBUCKET_PREFS:
1567             prefs->setInt("/dialogs/preferences/page", PREFS_PAGE_TOOLS_PAINTBUCKET);
1568             dt->_dlg_mgr->showDialog("InkscapePreferences");
1569             break;
1570         case SP_VERB_CONTEXT_ERASER_PREFS:
1571             prefs->setInt("/dialogs/preferences/page", PREFS_PAGE_TOOLS_ERASER);
1572             dt->_dlg_mgr->showDialog("InkscapePreferences");
1573             break;
1574         case SP_VERB_CONTEXT_LPETOOL_PREFS:
1575             g_print ("TODO: Create preferences page for LPETool\n");
1576             prefs->setInt("/dialogs/preferences/page", PREFS_PAGE_TOOLS_LPETOOL);
1577             dt->_dlg_mgr->showDialog("InkscapePreferences");
1578             break;
1580         default:
1581             break;
1582     }
1584 } // end of sp_verb_action_ctx_perform()
1586 /** \brief  Decode the verb code and take appropriate action */
1587 void
1588 TextVerb::perform(SPAction *action, void */*data*/, void */*pdata*/)
1590     SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1591     if (!dt)
1592         return;
1594     SPDocument *doc = sp_desktop_document(dt);
1595     (void)doc;
1596     Inkscape::XML::Node *repr = SP_OBJECT_REPR(dt->namedview);
1597     (void)repr;
1600 /** \brief  Decode the verb code and take appropriate action */
1601 void
1602 ZoomVerb::perform(SPAction *action, void *data, void */*pdata*/)
1604     SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1605     if (!dt)
1606         return;
1607     SPEventContext *ec = dt->event_context;
1609     SPDocument *doc = sp_desktop_document(dt);
1611     Inkscape::XML::Node *repr = SP_OBJECT_REPR(dt->namedview);
1613     Inkscape::Preferences *prefs = Inkscape::Preferences::get();
1614     gdouble zoom_inc =
1615         prefs->getDoubleLimited( "/options/zoomincrement/value", 1.414213562, 1.01, 10 );
1617     switch (GPOINTER_TO_INT(data)) {
1618         case SP_VERB_ZOOM_IN:
1619         {
1620             gint mul = 1 + gobble_key_events(
1621                  GDK_KP_Add, 0); // with any mask
1622             // While drawing with the pen/pencil tool, zoom towards the end of the unfinished path
1623             if (tools_isactive(dt, TOOLS_FREEHAND_PENCIL) || tools_isactive(dt, TOOLS_FREEHAND_PEN)) {
1624                 SPCurve *rc = SP_DRAW_CONTEXT(ec)->red_curve;
1625                 if (!rc->is_empty()) {
1626                     Geom::Point const zoom_to (*rc->last_point());
1627                     dt->zoom_relative_keep_point(zoom_to, mul*zoom_inc);
1628                     break;
1629                 }
1630             }
1632             Geom::Rect const d = dt->get_display_area();
1633             dt->zoom_relative( d.midpoint()[Geom::X], d.midpoint()[Geom::Y], mul*zoom_inc);
1634             break;
1635         }
1636         case SP_VERB_ZOOM_OUT:
1637         {
1638             gint mul = 1 + gobble_key_events(
1639                  GDK_KP_Subtract, 0); // with any mask
1640             // While drawing with the pen/pencil tool, zoom away from the end of the unfinished path
1641             if (tools_isactive(dt, TOOLS_FREEHAND_PENCIL) || tools_isactive(dt, TOOLS_FREEHAND_PEN)) {
1642                 SPCurve *rc = SP_DRAW_CONTEXT(ec)->red_curve;
1643                 if (!rc->is_empty()) {
1644                     Geom::Point const zoom_to (*rc->last_point());
1645                     dt->zoom_relative_keep_point(zoom_to, 1 / (mul*zoom_inc));
1646                     break;
1647                 }
1648             }
1650             Geom::Rect const d = dt->get_display_area();
1651             dt->zoom_relative( d.midpoint()[Geom::X], d.midpoint()[Geom::Y], 1 / (mul*zoom_inc) );
1652             break;
1653         }
1654         case SP_VERB_ZOOM_1_1:
1655         {
1656             double zcorr = prefs->getDouble("/options/zoomcorrection/value", 1.0);
1657             Geom::Rect const d = dt->get_display_area();
1658             dt->zoom_absolute( d.midpoint()[Geom::X], d.midpoint()[Geom::Y], 1.0 * zcorr );
1659             break;
1660         }
1661         case SP_VERB_ZOOM_1_2:
1662         {
1663             double zcorr = prefs->getDouble("/options/zoomcorrection/value", 1.0);
1664             Geom::Rect const d = dt->get_display_area();
1665             dt->zoom_absolute( d.midpoint()[Geom::X], d.midpoint()[Geom::Y], 0.5 * zcorr );
1666             break;
1667         }
1668         case SP_VERB_ZOOM_2_1:
1669         {
1670             double zcorr = prefs->getDouble("/options/zoomcorrection/value", 1.0);
1671             Geom::Rect const d = dt->get_display_area();
1672             dt->zoom_absolute( d.midpoint()[Geom::X], d.midpoint()[Geom::Y], 2.0 * zcorr );
1673             break;
1674         }
1675         case SP_VERB_ZOOM_PAGE:
1676             dt->zoom_page();
1677             break;
1678         case SP_VERB_ZOOM_PAGE_WIDTH:
1679             dt->zoom_page_width();
1680             break;
1681         case SP_VERB_ZOOM_DRAWING:
1682             dt->zoom_drawing();
1683             break;
1684         case SP_VERB_ZOOM_SELECTION:
1685             dt->zoom_selection();
1686             break;
1687         case SP_VERB_ZOOM_NEXT:
1688             dt->next_zoom();
1689             break;
1690         case SP_VERB_ZOOM_PREV:
1691             dt->prev_zoom();
1692             break;
1693         case SP_VERB_TOGGLE_RULERS:
1694             dt->toggleRulers();
1695             break;
1696         case SP_VERB_TOGGLE_SCROLLBARS:
1697             dt->toggleScrollbars();
1698             break;
1699         case SP_VERB_TOGGLE_GUIDES:
1700             sp_namedview_toggle_guides(doc, repr);
1701             break;
1702         case SP_VERB_TOGGLE_SNAPPING:
1703             dt->toggleSnapGlobal();
1704             break;
1705         case SP_VERB_TOGGLE_GRID:
1706             dt->toggleGrids();
1707             break;
1708 #ifdef HAVE_GTK_WINDOW_FULLSCREEN
1709         case SP_VERB_FULLSCREEN:
1710             dt->fullscreen();
1711             break;
1712 #endif /* HAVE_GTK_WINDOW_FULLSCREEN */
1713         case SP_VERB_FOCUSTOGGLE:
1714             dt->focusMode(!dt->is_focusMode());
1715             break;
1716         case SP_VERB_VIEW_NEW:
1717             sp_ui_new_view();
1718             break;
1719         case SP_VERB_VIEW_NEW_PREVIEW:
1720             sp_ui_new_view_preview();
1721             break;
1722         case SP_VERB_VIEW_MODE_NORMAL:
1723             dt->setDisplayModeNormal();
1724             break;
1725         case SP_VERB_VIEW_MODE_NO_FILTERS:
1726             dt->setDisplayModeNoFilters();
1727             break;
1728         case SP_VERB_VIEW_MODE_OUTLINE:
1729             dt->setDisplayModeOutline();
1730             break;
1731         case SP_VERB_VIEW_MODE_TOGGLE:
1732             dt->displayModeToggle();
1733             break;
1734         case SP_VERB_VIEW_CMS_TOGGLE:
1735             dt->toggleColorProfAdjust();
1736             break;
1737         case SP_VERB_VIEW_ICON_PREVIEW:
1738             inkscape_dialogs_unhide();
1739             dt->_dlg_mgr->showDialog("IconPreviewPanel");
1740             break;
1741         default:
1742             break;
1743     }
1745     dt->updateNow();
1747 } // end of sp_verb_action_zoom_perform()
1749 /** \brief  Decode the verb code and take appropriate action */
1750 void
1751 DialogVerb::perform(SPAction *action, void *data, void */*pdata*/)
1753     if (reinterpret_cast<std::size_t>(data) != SP_VERB_DIALOG_TOGGLE) {
1754         // unhide all when opening a new dialog
1755         inkscape_dialogs_unhide();
1756     }
1758     SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1759     g_assert(dt->_dlg_mgr != NULL);
1761     switch (reinterpret_cast<std::size_t>(data)) {
1762         case SP_VERB_DIALOG_DISPLAY:
1763             //sp_display_dialog();
1764             dt->_dlg_mgr->showDialog("InkscapePreferences");
1765             break;
1766         case SP_VERB_DIALOG_METADATA:
1767             // sp_desktop_dialog();
1768             dt->_dlg_mgr->showDialog("DocumentMetadata");
1769             break;
1770         case SP_VERB_DIALOG_NAMEDVIEW:
1771             // sp_desktop_dialog();
1772             dt->_dlg_mgr->showDialog("DocumentProperties");
1773             break;
1774         case SP_VERB_DIALOG_FILL_STROKE:
1775             dt->_dlg_mgr->showDialog("FillAndStroke");
1776             break;
1777         case SP_VERB_DIALOG_SWATCHES:
1778             dt->_dlg_mgr->showDialog("Swatches");
1779             break;
1780         case SP_VERB_DIALOG_TRANSFORM:
1781             dt->_dlg_mgr->showDialog("Transformation");
1782             break;
1783         case SP_VERB_DIALOG_ALIGN_DISTRIBUTE:
1784             dt->_dlg_mgr->showDialog("AlignAndDistribute");
1785             break;
1786         case SP_VERB_DIALOG_TEXT:
1787             sp_text_edit_dialog();
1788             break;
1789         case SP_VERB_DIALOG_XML_EDITOR:
1790             sp_xml_tree_dialog();
1791             break;
1792         case SP_VERB_DIALOG_FIND:
1793             sp_find_dialog();
1794 //              Please test the new find dialog if you have time:
1795 //            dt->_dlg_mgr->showDialog("Find");
1796             break;
1797         case SP_VERB_DIALOG_FINDREPLACE:
1798             // not implemented yet
1799             break;
1800         case SP_VERB_DIALOG_SPELLCHECK:
1801             sp_spellcheck_dialog();
1802             break;
1803         case SP_VERB_DIALOG_DEBUG:
1804             dt->_dlg_mgr->showDialog("Messages");
1805             break;
1806         case SP_VERB_DIALOG_SCRIPT:
1807             //dt->_dlg_mgr->showDialog("Script");
1808             Inkscape::Bind::JavaBindery::getInstance()->showConsole();
1809             break;
1810         case SP_VERB_DIALOG_UNDO_HISTORY:
1811             dt->_dlg_mgr->showDialog("UndoHistory");
1812             break;
1813         case SP_VERB_DIALOG_TOGGLE:
1814             inkscape_dialogs_toggle();
1815             break;
1816         case SP_VERB_DIALOG_CLONETILER:
1817             clonetiler_dialog();
1818             break;
1819         case SP_VERB_DIALOG_ITEM:
1820             sp_item_dialog();
1821             break;
1822 /*#ifdef WITH_INKBOARD
1823         case SP_VERB_XMPP_CLIENT:
1824         {
1825             Inkscape::Whiteboard::SessionManager::showClient();
1826             break;
1827         }
1828 #endif*/
1829         case SP_VERB_DIALOG_INPUT:
1830             sp_input_dialog();
1831             break;
1832         case SP_VERB_DIALOG_INPUT2:
1833             dt->_dlg_mgr->showDialog("InputDevices");
1834             break;
1835         case SP_VERB_DIALOG_EXTENSIONEDITOR:
1836             dt->_dlg_mgr->showDialog("ExtensionEditor");
1837             break;
1838         case SP_VERB_DIALOG_LAYERS:
1839             dt->_dlg_mgr->showDialog("LayersPanel");
1840             break;
1841         case SP_VERB_DIALOG_LIVE_PATH_EFFECT:
1842             dt->_dlg_mgr->showDialog("LivePathEffect");
1843             break;
1844         case SP_VERB_DIALOG_FILTER_EFFECTS:
1845             dt->_dlg_mgr->showDialog("FilterEffectsDialog");
1846             break;
1847         case SP_VERB_DIALOG_SVG_FONTS:
1848             dt->_dlg_mgr->showDialog("SvgFontsDialog");
1849             break;
1850         default:
1851             break;
1852     }
1853 } // end of sp_verb_action_dialog_perform()
1855 /** \brief  Decode the verb code and take appropriate action */
1856 void
1857 HelpVerb::perform(SPAction *action, void *data, void */*pdata*/)
1859     SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1860     g_assert(dt->_dlg_mgr != NULL);
1862     switch (reinterpret_cast<std::size_t>(data)) {
1863         case SP_VERB_HELP_ABOUT:
1864             sp_help_about();
1865             break;
1866         case SP_VERB_HELP_ABOUT_EXTENSIONS: {
1867             // Inkscape::UI::Dialogs::ExtensionsPanel *panel = new Inkscape::UI::Dialogs::ExtensionsPanel();
1868             // panel->set_full(true);
1869             // show_panel( *panel, "dialogs.aboutextensions", SP_VERB_HELP_ABOUT_EXTENSIONS );
1870             break;
1871         }
1873         /*
1874         case SP_VERB_SHOW_LICENSE:
1875             // TRANSLATORS: See "tutorial-basic.svg" comment.
1876             sp_help_open_tutorial(NULL, (gpointer) _("gpl-2.svg"));
1877             break;
1878         */
1880         case SP_VERB_HELP_MEMORY:
1881             inkscape_dialogs_unhide();
1882             dt->_dlg_mgr->showDialog("Memory");
1883             break;
1884         default:
1885             break;
1886     }
1887 } // end of sp_verb_action_help_perform()
1889 /** \brief  Decode the verb code and take appropriate action */
1890 void
1891 TutorialVerb::perform(SPAction */*action*/, void *data, void */*pdata*/)
1893     switch (reinterpret_cast<std::size_t>(data)) {
1894         case SP_VERB_TUTORIAL_BASIC:
1895             /* TRANSLATORS: If you have translated the tutorial-basic.svg file to your language,
1896                then translate this string as "tutorial-basic.LANG.svg" (where LANG is your language
1897                code); otherwise leave as "tutorial-basic.svg". */
1898             sp_help_open_tutorial(NULL, (gpointer)_("tutorial-basic.svg"));
1899             break;
1900         case SP_VERB_TUTORIAL_SHAPES:
1901             // TRANSLATORS: See "tutorial-basic.svg" comment.
1902             sp_help_open_tutorial(NULL, (gpointer)_("tutorial-shapes.svg"));
1903             break;
1904         case SP_VERB_TUTORIAL_ADVANCED:
1905             // TRANSLATORS: See "tutorial-basic.svg" comment.
1906             sp_help_open_tutorial(NULL, (gpointer)_("tutorial-advanced.svg"));
1907             break;
1908         case SP_VERB_TUTORIAL_TRACING:
1909             // TRANSLATORS: See "tutorial-basic.svg" comment.
1910             sp_help_open_tutorial(NULL, (gpointer)_("tutorial-tracing.svg"));
1911             break;
1912         case SP_VERB_TUTORIAL_CALLIGRAPHY:
1913             // TRANSLATORS: See "tutorial-basic.svg" comment.
1914             sp_help_open_tutorial(NULL, (gpointer)_("tutorial-calligraphy.svg"));
1915             break;
1916         case SP_VERB_TUTORIAL_DESIGN:
1917             // TRANSLATORS: See "tutorial-basic.svg" comment.
1918             sp_help_open_tutorial(NULL, (gpointer)_("tutorial-elements.svg"));
1919             break;
1920         case SP_VERB_TUTORIAL_TIPS:
1921             // TRANSLATORS: See "tutorial-basic.svg" comment.
1922             sp_help_open_tutorial(NULL, (gpointer)_("tutorial-tips.svg"));
1923             break;
1924         default:
1925             break;
1926     }
1927 } // end of sp_verb_action_tutorial_perform()
1930 /**
1931  * Action vector to define functions called if a staticly defined file verb
1932  * is called.
1933  */
1934 SPActionEventVector FileVerb::vector =
1935             {{NULL},FileVerb::perform, NULL, NULL, NULL, NULL};
1936 /**
1937  * Action vector to define functions called if a staticly defined edit verb is
1938  * called.
1939  */
1940 SPActionEventVector EditVerb::vector =
1941             {{NULL},EditVerb::perform, NULL, NULL, NULL, NULL};
1943 /**
1944  * Action vector to define functions called if a staticly defined selection
1945  * verb is called
1946  */
1947 SPActionEventVector SelectionVerb::vector =
1948             {{NULL},SelectionVerb::perform, NULL, NULL, NULL, NULL};
1950 /**
1951  * Action vector to define functions called if a staticly defined layer
1952  * verb is called
1953  */
1954 SPActionEventVector LayerVerb::vector =
1955             {{NULL}, LayerVerb::perform, NULL, NULL, NULL, NULL};
1957 /**
1958  * Action vector to define functions called if a staticly defined object
1959  * editing verb is called
1960  */
1961 SPActionEventVector ObjectVerb::vector =
1962             {{NULL},ObjectVerb::perform, NULL, NULL, NULL, NULL};
1964 /**
1965  * Action vector to define functions called if a staticly defined context
1966  * verb is called
1967  */
1968 SPActionEventVector ContextVerb::vector =
1969             {{NULL},ContextVerb::perform, NULL, NULL, NULL, NULL};
1971 /**
1972  * Action vector to define functions called if a staticly defined zoom verb
1973  * is called
1974  */
1975 SPActionEventVector ZoomVerb::vector =
1976             {{NULL},ZoomVerb::perform, NULL, NULL, NULL, NULL};
1979 /**
1980  * Action vector to define functions called if a staticly defined dialog verb
1981  * is called
1982  */
1983 SPActionEventVector DialogVerb::vector =
1984             {{NULL},DialogVerb::perform, NULL, NULL, NULL, NULL};
1986 /**
1987  * Action vector to define functions called if a staticly defined help verb
1988  * is called
1989  */
1990 SPActionEventVector HelpVerb::vector =
1991             {{NULL},HelpVerb::perform, NULL, NULL, NULL, NULL};
1993 /**
1994  * Action vector to define functions called if a staticly defined tutorial verb
1995  * is called
1996  */
1997 SPActionEventVector TutorialVerb::vector =
1998             {{NULL},TutorialVerb::perform, NULL, NULL, NULL, NULL};
2000 /**
2001  * Action vector to define functions called if a staticly defined tutorial verb
2002  * is called
2003  */
2004 SPActionEventVector TextVerb::vector =
2005             {{NULL},TextVerb::perform, NULL, NULL, NULL, NULL};
2008 /* *********** Effect Last ********** */
2010 /** \brief A class to represent the last effect issued */
2011 class EffectLastVerb : public Verb {
2012 private:
2013     static void perform(SPAction *action, void *mydata, void *otherdata);
2014     static SPActionEventVector vector;
2015 protected:
2016     virtual SPAction *make_action(Inkscape::UI::View::View *view);
2017 public:
2018     /** \brief Use the Verb initializer with the same parameters. */
2019     EffectLastVerb(unsigned int const code,
2020                    gchar const *id,
2021                    gchar const *name,
2022                    gchar const *tip,
2023                    gchar const *image) :
2024         Verb(code, id, name, tip, image)
2025     {
2026         set_default_sensitive(false);
2027     }
2028 }; /* EffectLastVerb class */
2030 /**
2031  * The vector to attach in the last effect verb.
2032  */
2033 SPActionEventVector EffectLastVerb::vector =
2034             {{NULL},EffectLastVerb::perform, NULL, NULL, NULL, NULL};
2036 /** \brief  Create an action for a \c EffectLastVerb
2037     \param  view  Which view the action should be created for
2038     \return The built action.
2040     Calls \c make_action_helper with the \c vector.
2041 */
2042 SPAction *
2043 EffectLastVerb::make_action(Inkscape::UI::View::View *view)
2045     return make_action_helper(view, &vector);
2048 /** \brief  Decode the verb code and take appropriate action */
2049 void
2050 EffectLastVerb::perform(SPAction *action, void *data, void */*pdata*/)
2052     /* These aren't used, but are here to remind people not to use
2053        the CURRENT_DOCUMENT macros unless they really have to. */
2054     Inkscape::UI::View::View *current_view = sp_action_get_view(action);
2055     // SPDocument *current_document = SP_VIEW_DOCUMENT(current_view);
2056     Inkscape::Extension::Effect *effect = Inkscape::Extension::Effect::get_last_effect();
2058     if (effect == NULL) return;
2059     if (current_view == NULL) return;
2061     switch ((long) data) {
2062         case SP_VERB_EFFECT_LAST_PREF:
2063             effect->prefs(current_view);
2064             break;
2065         case SP_VERB_EFFECT_LAST:
2066             effect->effect(current_view);
2067             break;
2068         default:
2069             return;
2070     }
2072     return;
2074 /* *********** End Effect Last ********** */
2076 /* *********** Fit Canvas ********** */
2078 /** \brief A class to represent the canvas fitting verbs */
2079 class FitCanvasVerb : public Verb {
2080 private:
2081     static void perform(SPAction *action, void *mydata, void *otherdata);
2082     static SPActionEventVector vector;
2083 protected:
2084     virtual SPAction *make_action(Inkscape::UI::View::View *view);
2085 public:
2086     /** \brief Use the Verb initializer with the same parameters. */
2087     FitCanvasVerb(unsigned int const code,
2088                    gchar const *id,
2089                    gchar const *name,
2090                    gchar const *tip,
2091                    gchar const *image) :
2092         Verb(code, id, name, tip, image)
2093     {
2094         set_default_sensitive(false);
2095     }
2096 }; /* FitCanvasVerb class */
2098 /**
2099  * The vector to attach in the fit canvas verb.
2100  */
2101 SPActionEventVector FitCanvasVerb::vector =
2102             {{NULL},FitCanvasVerb::perform, NULL, NULL, NULL, NULL};
2104 /** \brief  Create an action for a \c FitCanvasVerb
2105     \param  view  Which view the action should be created for
2106     \return The built action.
2108     Calls \c make_action_helper with the \c vector.
2109 */
2110 SPAction *
2111 FitCanvasVerb::make_action(Inkscape::UI::View::View *view)
2113     SPAction *action = make_action_helper(view, &vector);
2114     return action;
2117 /** \brief  Decode the verb code and take appropriate action */
2118 void
2119 FitCanvasVerb::perform(SPAction *action, void *data, void */*pdata*/)
2121     SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
2122     if (!dt) return;
2123     SPDocument *doc = sp_desktop_document(dt);
2124     if (!doc) return;
2126     switch ((long) data) {
2127         case SP_VERB_FIT_CANVAS_TO_SELECTION:
2128             verb_fit_canvas_to_selection(dt);
2129             break;
2130         case SP_VERB_FIT_CANVAS_TO_DRAWING:
2131             verb_fit_canvas_to_drawing(dt);
2132             break;
2133         case SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING:
2134             fit_canvas_to_selection_or_drawing(dt);
2135             break;
2136         default:
2137             return;
2138     }
2140     return;
2142 /* *********** End Fit Canvas ********** */
2145 /* *********** Lock'N'Hide ********** */
2147 /** \brief A class to represent the object unlocking and unhiding verbs */
2148 class LockAndHideVerb : public Verb {
2149 private:
2150     static void perform(SPAction *action, void *mydata, void *otherdata);
2151     static SPActionEventVector vector;
2152 protected:
2153     virtual SPAction *make_action(Inkscape::UI::View::View *view);
2154 public:
2155     /** \brief Use the Verb initializer with the same parameters. */
2156     LockAndHideVerb(unsigned int const code,
2157                    gchar const *id,
2158                    gchar const *name,
2159                    gchar const *tip,
2160                    gchar const *image) :
2161         Verb(code, id, name, tip, image)
2162     {
2163         set_default_sensitive(true);
2164     }
2165 }; /* LockAndHideVerb class */
2167 /**
2168  * The vector to attach in the lock'n'hide verb.
2169  */
2170 SPActionEventVector LockAndHideVerb::vector =
2171             {{NULL},LockAndHideVerb::perform, NULL, NULL, NULL, NULL};
2173 /** \brief  Create an action for a \c LockAndHideVerb
2174     \param  view  Which view the action should be created for
2175     \return The built action.
2177     Calls \c make_action_helper with the \c vector.
2178 */
2179 SPAction *
2180 LockAndHideVerb::make_action(Inkscape::UI::View::View *view)
2182     SPAction *action = make_action_helper(view, &vector);
2183     return action;
2186 /** \brief  Decode the verb code and take appropriate action */
2187 void
2188 LockAndHideVerb::perform(SPAction *action, void *data, void */*pdata*/)
2190     SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
2191     if (!dt) return;
2192     SPDocument *doc = sp_desktop_document(dt);
2193     if (!doc) return;
2195     switch ((long) data) {
2196         case SP_VERB_UNLOCK_ALL:
2197             unlock_all(dt);
2198             sp_document_done(doc, SP_VERB_UNLOCK_ALL, _("Unlock all objects in the current layer"));
2199             break;
2200         case SP_VERB_UNLOCK_ALL_IN_ALL_LAYERS:
2201             unlock_all_in_all_layers(dt);
2202             sp_document_done(doc, SP_VERB_UNLOCK_ALL_IN_ALL_LAYERS, _("Unlock all objects in all layers"));
2203             break;
2204         case SP_VERB_UNHIDE_ALL:
2205             unhide_all(dt);
2206             sp_document_done(doc, SP_VERB_UNHIDE_ALL, _("Unhide all objects in the current layer"));
2207             break;
2208         case SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS:
2209             unhide_all_in_all_layers(dt);
2210             sp_document_done(doc, SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS, _("Unhide all objects in all layers"));
2211             break;
2212         default:
2213             return;
2214     }
2216     return;
2218 /* *********** End Lock'N'Hide ********** */
2221 /* these must be in the same order as the SP_VERB_* enum in "verbs.h" */
2222 Verb *Verb::_base_verbs[] = {
2223     /* Header */
2224     new Verb(SP_VERB_INVALID, NULL, NULL, NULL, NULL),
2225     new Verb(SP_VERB_NONE, "None", N_("None"), N_("Does nothing"), NULL),
2227     /* File */
2228     new FileVerb(SP_VERB_FILE_NEW, "FileNew", N_("Default"), N_("Create new document from the default template"),
2229                  GTK_STOCK_NEW ),
2230     new FileVerb(SP_VERB_FILE_OPEN, "FileOpen", N_("_Open..."),
2231                  N_("Open an existing document"), GTK_STOCK_OPEN ),
2232     new FileVerb(SP_VERB_FILE_REVERT, "FileRevert", N_("Re_vert"),
2233                  N_("Revert to the last saved version of document (changes will be lost)"), GTK_STOCK_REVERT_TO_SAVED ),
2234     new FileVerb(SP_VERB_FILE_SAVE, "FileSave", N_("_Save"), N_("Save document"),
2235                  GTK_STOCK_SAVE ),
2236     new FileVerb(SP_VERB_FILE_SAVE_AS, "FileSaveAs", N_("Save _As..."),
2237                  N_("Save document under a new name"), GTK_STOCK_SAVE_AS ),
2238     new FileVerb(SP_VERB_FILE_SAVE_A_COPY, "FileSaveACopy", N_("Save a Cop_y..."),
2239                  N_("Save a copy of the document under a new name"), NULL ),
2240     new FileVerb(SP_VERB_FILE_PRINT, "FilePrint", N_("_Print..."), N_("Print document"),
2241                  GTK_STOCK_PRINT ),
2242     // TRANSLATORS: "Vacuum Defs" means "Clean up defs" (so as to remove unused definitions)
2243     new FileVerb(SP_VERB_FILE_VACUUM, "FileVacuum", N_("Vac_uum Defs"), N_("Remove unused definitions (such as gradients or clipping paths) from the &lt;defs&gt; of the document"),
2244                  INKSCAPE_ICON_DOCUMENT_CLEANUP ),
2245     new FileVerb(SP_VERB_FILE_PRINT_PREVIEW, "FilePrintPreview", N_("Print Previe_w"),
2246                  N_("Preview document printout"), GTK_STOCK_PRINT_PREVIEW ),
2247     new FileVerb(SP_VERB_FILE_IMPORT, "FileImport", N_("_Import..."),
2248                  N_("Import a bitmap or SVG image into this document"), INKSCAPE_ICON_DOCUMENT_IMPORT),
2249     new FileVerb(SP_VERB_FILE_EXPORT, "FileExport", N_("_Export Bitmap..."),
2250                  N_("Export this document or a selection as a bitmap image"), INKSCAPE_ICON_DOCUMENT_EXPORT),
2251     new FileVerb(SP_VERB_FILE_IMPORT_FROM_OCAL, "FileImportFromOCAL", N_("Import From Open Clip Art Library"), N_("Import a document from Open Clip Art Library"), INKSCAPE_ICON_DOCUMENT_IMPORT_OCAL),
2252 //    new FileVerb(SP_VERB_FILE_EXPORT_TO_OCAL, "FileExportToOCAL", N_("Export To Open Clip Art Library"), N_("Export this document to Open Clip Art Library"), INKSCAPE_ICON_DOCUMENT_EXPORT_OCAL),
2253     new FileVerb(SP_VERB_FILE_NEXT_DESKTOP, "NextWindow", N_("N_ext Window"),
2254                  N_("Switch to the next document window"), INKSCAPE_ICON_WINDOW_NEXT),
2255     new FileVerb(SP_VERB_FILE_PREV_DESKTOP, "PrevWindow", N_("P_revious Window"),
2256                  N_("Switch to the previous document window"), INKSCAPE_ICON_WINDOW_PREVIOUS),
2257     new FileVerb(SP_VERB_FILE_CLOSE_VIEW, "FileClose", N_("_Close"),
2258                  N_("Close this document window"), GTK_STOCK_CLOSE),
2259     new FileVerb(SP_VERB_FILE_QUIT, "FileQuit", N_("_Quit"), N_("Quit Inkscape"), GTK_STOCK_QUIT),
2261     /* Edit */
2262     new EditVerb(SP_VERB_EDIT_UNDO, "EditUndo", N_("_Undo"), N_("Undo last action"),
2263                  GTK_STOCK_UNDO),
2264     new EditVerb(SP_VERB_EDIT_REDO, "EditRedo", N_("_Redo"),
2265                  N_("Do again the last undone action"), GTK_STOCK_REDO),
2266     new EditVerb(SP_VERB_EDIT_CUT, "EditCut", N_("Cu_t"),
2267                  N_("Cut selection to clipboard"), GTK_STOCK_CUT),
2268     new EditVerb(SP_VERB_EDIT_COPY, "EditCopy", N_("_Copy"),
2269                  N_("Copy selection to clipboard"), GTK_STOCK_COPY),
2270     new EditVerb(SP_VERB_EDIT_PASTE, "EditPaste", N_("_Paste"),
2271                  N_("Paste objects from clipboard to mouse point, or paste text"), GTK_STOCK_PASTE),
2272     new EditVerb(SP_VERB_EDIT_PASTE_STYLE, "EditPasteStyle", N_("Paste _Style"),
2273                  N_("Apply the style of the copied object to selection"), INKSCAPE_ICON_EDIT_PASTE_STYLE),
2274     new EditVerb(SP_VERB_EDIT_PASTE_SIZE, "EditPasteSize", N_("Paste Si_ze"),
2275                  N_("Scale selection to match the size of the copied object"), NULL),
2276     new EditVerb(SP_VERB_EDIT_PASTE_SIZE_X, "EditPasteWidth", N_("Paste _Width"),
2277                  N_("Scale selection horizontally to match the width of the copied object"), NULL),
2278     new EditVerb(SP_VERB_EDIT_PASTE_SIZE_Y, "EditPasteHeight", N_("Paste _Height"),
2279                  N_("Scale selection vertically to match the height of the copied object"), NULL),
2280     new EditVerb(SP_VERB_EDIT_PASTE_SIZE_SEPARATELY, "EditPasteSizeSeparately", N_("Paste Size Separately"),
2281                  N_("Scale each selected object to match the size of the copied object"), NULL),
2282     new EditVerb(SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_X, "EditPasteWidthSeparately", N_("Paste Width Separately"),
2283                  N_("Scale each selected object horizontally to match the width of the copied object"), NULL),
2284     new EditVerb(SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_Y, "EditPasteHeightSeparately", N_("Paste Height Separately"),
2285                  N_("Scale each selected object vertically to match the height of the copied object"), NULL),
2286     new EditVerb(SP_VERB_EDIT_PASTE_IN_PLACE, "EditPasteInPlace", N_("Paste _In Place"),
2287                  N_("Paste objects from clipboard to the original location"), INKSCAPE_ICON_EDIT_PASTE_IN_PLACE),
2288     new EditVerb(SP_VERB_EDIT_PASTE_LIVEPATHEFFECT, "PasteLivePathEffect", N_("Paste Path _Effect"),
2289                  N_("Apply the path effect of the copied object to selection"), NULL),
2290     new EditVerb(SP_VERB_EDIT_REMOVE_LIVEPATHEFFECT, "RemoveLivePathEffect", N_("Remove Path _Effect"),
2291                  N_("Remove any path effects from selected objects"), NULL),
2292     new EditVerb(SP_VERB_EDIT_REMOVE_FILTER, "RemoveFilter", N_("Remove Filters"),
2293                  N_("Remove any filters from selected objects"), NULL),
2294     new EditVerb(SP_VERB_EDIT_DELETE, "EditDelete", N_("_Delete"),
2295                  N_("Delete selection"), GTK_STOCK_DELETE),
2296     new EditVerb(SP_VERB_EDIT_DUPLICATE, "EditDuplicate", N_("Duplic_ate"),
2297                  N_("Duplicate selected objects"), INKSCAPE_ICON_EDIT_DUPLICATE),
2298     new EditVerb(SP_VERB_EDIT_CLONE, "EditClone", N_("Create Clo_ne"),
2299                  N_("Create a clone (a copy linked to the original) of selected object"), INKSCAPE_ICON_EDIT_CLONE),
2300     new EditVerb(SP_VERB_EDIT_UNLINK_CLONE, "EditUnlinkClone", N_("Unlin_k Clone"),
2301                  N_("Cut the selected clones' links to the originals, turning them into standalone objects"), INKSCAPE_ICON_EDIT_CLONE_UNLINK),
2302     new EditVerb(SP_VERB_EDIT_RELINK_CLONE, "EditRelinkClone", N_("Relink to Copied"),
2303                  N_("Relink the selected clones to the object currently on the clipboard"), NULL),
2304     new EditVerb(SP_VERB_EDIT_CLONE_SELECT_ORIGINAL, "EditCloneSelectOriginal", N_("Select _Original"),
2305                  N_("Select the object to which the selected clone is linked"), INKSCAPE_ICON_EDIT_SELECT_ORIGINAL),
2306     new EditVerb(SP_VERB_EDIT_SELECTION_2_MARKER, "ObjectsToMarker", N_("Objects to _Marker"),
2307                  N_("Convert selection to a line marker"), NULL),
2308     new EditVerb(SP_VERB_EDIT_SELECTION_2_GUIDES, "ObjectsToGuides", N_("Objects to Gu_ides"),
2309                  N_("Convert selected objects to a collection of guidelines aligned with their edges"), NULL),
2310     new EditVerb(SP_VERB_EDIT_TILE, "ObjectsToPattern", N_("Objects to Patter_n"),
2311                  N_("Convert selection to a rectangle with tiled pattern fill"), NULL),
2312     new EditVerb(SP_VERB_EDIT_UNTILE, "ObjectsFromPattern", N_("Pattern to _Objects"),
2313                  N_("Extract objects from a tiled pattern fill"), NULL),
2314     new EditVerb(SP_VERB_EDIT_CLEAR_ALL, "EditClearAll", N_("Clea_r All"),
2315                  N_("Delete all objects from document"), NULL),
2316     new EditVerb(SP_VERB_EDIT_SELECT_ALL, "EditSelectAll", N_("Select Al_l"),
2317                  N_("Select all objects or all nodes"), GTK_STOCK_SELECT_ALL),
2318     new EditVerb(SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS, "EditSelectAllInAllLayers", N_("Select All in All La_yers"),
2319                  N_("Select all objects in all visible and unlocked layers"), INKSCAPE_ICON_EDIT_SELECT_ALL_LAYERS),
2320     new EditVerb(SP_VERB_EDIT_INVERT, "EditInvert", N_("In_vert Selection"),
2321                  N_("Invert selection (unselect what is selected and select everything else)"), INKSCAPE_ICON_EDIT_SELECT_INVERT),
2322     new EditVerb(SP_VERB_EDIT_INVERT_IN_ALL_LAYERS, "EditInvertInAllLayers", N_("Invert in All Layers"),
2323                  N_("Invert selection in all visible and unlocked layers"), NULL),
2324     new EditVerb(SP_VERB_EDIT_SELECT_NEXT, "EditSelectNext", N_("Select Next"),
2325                  N_("Select next object or node"), NULL),
2326     new EditVerb(SP_VERB_EDIT_SELECT_PREV, "EditSelectPrev", N_("Select Previous"),
2327                  N_("Select previous object or node"), NULL),
2328     new EditVerb(SP_VERB_EDIT_DESELECT, "EditDeselect", N_("D_eselect"),
2329                  N_("Deselect any selected objects or nodes"), INKSCAPE_ICON_EDIT_SELECT_NONE),
2330     new EditVerb(SP_VERB_EDIT_GUIDES_AROUND_PAGE, "EditGuidesAroundPage", N_("_Guides Around Page"),
2331                  N_("Create four guides aligned with the page borders"), NULL),
2332     new EditVerb(SP_VERB_EDIT_NEXT_PATHEFFECT_PARAMETER, "EditNextPathEffectParameter", N_("Next Path Effect Parameter"),
2333                  N_("Show next Path Effect parameter for editing"), INKSCAPE_ICON_PATH_EFFECT_PARAMETER_NEXT),
2335     /* Selection */
2336     new SelectionVerb(SP_VERB_SELECTION_TO_FRONT, "SelectionToFront", N_("Raise to _Top"),
2337                       N_("Raise selection to top"), INKSCAPE_ICON_SELECTION_TOP),
2338     new SelectionVerb(SP_VERB_SELECTION_TO_BACK, "SelectionToBack", N_("Lower to _Bottom"),
2339                       N_("Lower selection to bottom"), INKSCAPE_ICON_SELECTION_BOTTOM),
2340     new SelectionVerb(SP_VERB_SELECTION_RAISE, "SelectionRaise", N_("_Raise"),
2341                       N_("Raise selection one step"), INKSCAPE_ICON_SELECTION_RAISE),
2342     new SelectionVerb(SP_VERB_SELECTION_LOWER, "SelectionLower", N_("_Lower"),
2343                       N_("Lower selection one step"), INKSCAPE_ICON_SELECTION_LOWER),
2344     new SelectionVerb(SP_VERB_SELECTION_GROUP, "SelectionGroup", N_("_Group"),
2345                       N_("Group selected objects"), INKSCAPE_ICON_OBJECT_GROUP),
2346     new SelectionVerb(SP_VERB_SELECTION_UNGROUP, "SelectionUnGroup", N_("_Ungroup"),
2347                       N_("Ungroup selected groups"), INKSCAPE_ICON_OBJECT_UNGROUP),
2349     new SelectionVerb(SP_VERB_SELECTION_TEXTTOPATH, "SelectionTextToPath", N_("_Put on Path"),
2350                       N_("Put text on path"), INKSCAPE_ICON_TEXT_PUT_ON_PATH),
2351     new SelectionVerb(SP_VERB_SELECTION_TEXTFROMPATH, "SelectionTextFromPath", N_("_Remove from Path"),
2352                       N_("Remove text from path"), INKSCAPE_ICON_TEXT_REMOVE_FROM_PATH),
2353     new SelectionVerb(SP_VERB_SELECTION_REMOVE_KERNS, "SelectionTextRemoveKerns", N_("Remove Manual _Kerns"),
2354                       // TRANSLATORS: "glyph": An image used in the visual representation of characters;
2355                       //  roughly speaking, how a character looks. A font is a set of glyphs.
2356                       N_("Remove all manual kerns and glyph rotations from a text object"), INKSCAPE_ICON_TEXT_UNKERN),
2358     new SelectionVerb(SP_VERB_SELECTION_UNION, "SelectionUnion", N_("_Union"),
2359                       N_("Create union of selected paths"), INKSCAPE_ICON_PATH_UNION),
2360     new SelectionVerb(SP_VERB_SELECTION_INTERSECT, "SelectionIntersect", N_("_Intersection"),
2361                       N_("Create intersection of selected paths"), INKSCAPE_ICON_PATH_INTERSECTION),
2362     new SelectionVerb(SP_VERB_SELECTION_DIFF, "SelectionDiff", N_("_Difference"),
2363                       N_("Create difference of selected paths (bottom minus top)"), INKSCAPE_ICON_PATH_DIFFERENCE),
2364     new SelectionVerb(SP_VERB_SELECTION_SYMDIFF, "SelectionSymDiff", N_("E_xclusion"),
2365                       N_("Create exclusive OR of selected paths (those parts that belong to only one path)"), INKSCAPE_ICON_PATH_EXCLUSION),
2366     new SelectionVerb(SP_VERB_SELECTION_CUT, "SelectionDivide", N_("Di_vision"),
2367                       N_("Cut the bottom path into pieces"), INKSCAPE_ICON_PATH_DIVISION),
2368     // TRANSLATORS: "to cut a path" is not the same as "to break a path apart" - see the
2369     // Advanced tutorial for more info
2370     new SelectionVerb(SP_VERB_SELECTION_SLICE, "SelectionCutPath", N_("Cut _Path"),
2371                       N_("Cut the bottom path's stroke into pieces, removing fill"), INKSCAPE_ICON_PATH_CUT),
2372     // TRANSLATORS: "outset": expand a shape by offsetting the object's path,
2373     // i.e. by displacing it perpendicular to the path in each point.
2374     // See also the Advanced Tutorial for explanation.
2375     new SelectionVerb(SP_VERB_SELECTION_OFFSET, "SelectionOffset", N_("Outs_et"),
2376                       N_("Outset selected paths"), INKSCAPE_ICON_PATH_OUTSET),
2377     new SelectionVerb(SP_VERB_SELECTION_OFFSET_SCREEN, "SelectionOffsetScreen",
2378                       N_("O_utset Path by 1 px"),
2379                       N_("Outset selected paths by 1 px"), NULL),
2380     new SelectionVerb(SP_VERB_SELECTION_OFFSET_SCREEN_10, "SelectionOffsetScreen10",
2381                       N_("O_utset Path by 10 px"),
2382                       N_("Outset selected paths by 10 px"), NULL),
2383     // TRANSLATORS: "inset": contract a shape by offsetting the object's path,
2384     // i.e. by displacing it perpendicular to the path in each point.
2385     // See also the Advanced Tutorial for explanation.
2386     new SelectionVerb(SP_VERB_SELECTION_INSET, "SelectionInset", N_("I_nset"),
2387                       N_("Inset selected paths"), INKSCAPE_ICON_PATH_INSET),
2388     new SelectionVerb(SP_VERB_SELECTION_INSET_SCREEN, "SelectionInsetScreen",
2389                       N_("I_nset Path by 1 px"),
2390                       N_("Inset selected paths by 1 px"), NULL),
2391     new SelectionVerb(SP_VERB_SELECTION_INSET_SCREEN_10, "SelectionInsetScreen10",
2392                       N_("I_nset Path by 10 px"),
2393                       N_("Inset selected paths by 10 px"), NULL),
2394     new SelectionVerb(SP_VERB_SELECTION_DYNAMIC_OFFSET, "SelectionDynOffset",
2395                       N_("D_ynamic Offset"), N_("Create a dynamic offset object"), INKSCAPE_ICON_PATH_OFFSET_DYNAMIC),
2396     new SelectionVerb(SP_VERB_SELECTION_LINKED_OFFSET, "SelectionLinkedOffset",
2397                       N_("_Linked Offset"),
2398                       N_("Create a dynamic offset object linked to the original path"),
2399                       INKSCAPE_ICON_PATH_OFFSET_LINKED),
2400     new SelectionVerb(SP_VERB_SELECTION_OUTLINE, "StrokeToPath", N_("_Stroke to Path"),
2401                       N_("Convert selected object's stroke to paths"), INKSCAPE_ICON_STROKE_TO_PATH),
2402     new SelectionVerb(SP_VERB_SELECTION_SIMPLIFY, "SelectionSimplify", N_("Si_mplify"),
2403                       N_("Simplify selected paths (remove extra nodes)"), INKSCAPE_ICON_PATH_SIMPLIFY),
2404     new SelectionVerb(SP_VERB_SELECTION_REVERSE, "SelectionReverse", N_("_Reverse"),
2405                       N_("Reverse the direction of selected paths (useful for flipping markers)"), INKSCAPE_ICON_PATH_REVERSE),
2406     // TRANSLATORS: "to trace" means "to convert a bitmap to vector graphics" (to vectorize)
2407     new SelectionVerb(SP_VERB_SELECTION_TRACE, "SelectionTrace", N_("_Trace Bitmap..."),
2408                       N_("Create one or more paths from a bitmap by tracing it"), INKSCAPE_ICON_BITMAP_TRACE),
2409     new SelectionVerb(SP_VERB_SELECTION_CREATE_BITMAP, "SelectionCreateBitmap", N_("_Make a Bitmap Copy"),
2410                       N_("Export selection to a bitmap and insert it into document"), INKSCAPE_ICON_SELECTION_MAKE_BITMAP_COPY ),
2411     new SelectionVerb(SP_VERB_SELECTION_COMBINE, "SelectionCombine", N_("_Combine"),
2412                       N_("Combine several paths into one"), INKSCAPE_ICON_PATH_COMBINE),
2413     // TRANSLATORS: "to cut a path" is not the same as "to break a path apart" - see the
2414     // Advanced tutorial for more info
2415     new SelectionVerb(SP_VERB_SELECTION_BREAK_APART, "SelectionBreakApart", N_("Break _Apart"),
2416                       N_("Break selected paths into subpaths"), INKSCAPE_ICON_PATH_BREAK_APART),
2417     new SelectionVerb(SP_VERB_SELECTION_GRIDTILE, "DialogGridArrange", N_("Rows and Columns..."),
2418                       N_("Arrange selected objects in a table"), INKSCAPE_ICON_DIALOG_ROWS_AND_COLUMNS),
2419     /* Layer */
2420     new LayerVerb(SP_VERB_LAYER_NEW, "LayerNew", N_("_Add Layer..."),
2421                   N_("Create a new layer"), INKSCAPE_ICON_LAYER_NEW),
2422     new LayerVerb(SP_VERB_LAYER_RENAME, "LayerRename", N_("Re_name Layer..."),
2423                   N_("Rename the current layer"), INKSCAPE_ICON_LAYER_RENAME),
2424     new LayerVerb(SP_VERB_LAYER_NEXT, "LayerNext", N_("Switch to Layer Abov_e"),
2425                   N_("Switch to the layer above the current"), INKSCAPE_ICON_LAYER_PREVIOUS),
2426     new LayerVerb(SP_VERB_LAYER_PREV, "LayerPrev", N_("Switch to Layer Belo_w"),
2427                   N_("Switch to the layer below the current"), INKSCAPE_ICON_LAYER_NEXT),
2428     new LayerVerb(SP_VERB_LAYER_MOVE_TO_NEXT, "LayerMoveToNext", N_("Move Selection to Layer Abo_ve"),
2429                   N_("Move selection to the layer above the current"), INKSCAPE_ICON_SELECTION_MOVE_TO_LAYER_ABOVE),
2430     new LayerVerb(SP_VERB_LAYER_MOVE_TO_PREV, "LayerMoveToPrev", N_("Move Selection to Layer Bel_ow"),
2431                   N_("Move selection to the layer below the current"), INKSCAPE_ICON_SELECTION_MOVE_TO_LAYER_BELOW),
2432     new LayerVerb(SP_VERB_LAYER_TO_TOP, "LayerToTop", N_("Layer to _Top"),
2433                   N_("Raise the current layer to the top"), INKSCAPE_ICON_LAYER_TOP),
2434     new LayerVerb(SP_VERB_LAYER_TO_BOTTOM, "LayerToBottom", N_("Layer to _Bottom"),
2435                   N_("Lower the current layer to the bottom"), INKSCAPE_ICON_LAYER_BOTTOM),
2436     new LayerVerb(SP_VERB_LAYER_RAISE, "LayerRaise", N_("_Raise Layer"),
2437                   N_("Raise the current layer"), INKSCAPE_ICON_LAYER_RAISE),
2438     new LayerVerb(SP_VERB_LAYER_LOWER, "LayerLower", N_("_Lower Layer"),
2439                   N_("Lower the current layer"), INKSCAPE_ICON_LAYER_LOWER),
2440     new LayerVerb(SP_VERB_LAYER_DUPLICATE, "LayerDuplicate", N_("Duplicate Current Layer"),
2441                   N_("Duplicate an existing layer"), NULL),
2442     new LayerVerb(SP_VERB_LAYER_DELETE, "LayerDelete", N_("_Delete Current Layer"),
2443                   N_("Delete the current layer"), INKSCAPE_ICON_LAYER_DELETE),
2444     new LayerVerb(SP_VERB_LAYER_SOLO, "LayerSolo", N_("_Show/hide other layers"),
2445                   N_("Solo the current layer"), NULL),
2447     /* Object */
2448     new ObjectVerb(SP_VERB_OBJECT_ROTATE_90_CW, "ObjectRotate90", N_("Rotate _90&#176; CW"),
2449                    // This is shared between tooltips and statusbar, so they
2450                    // must use UTF-8, not HTML entities for special characters.
2451                    N_("Rotate selection 90\xc2\xb0 clockwise"), INKSCAPE_ICON_OBJECT_ROTATE_RIGHT),
2452     new ObjectVerb(SP_VERB_OBJECT_ROTATE_90_CCW, "ObjectRotate90CCW", N_("Rotate 9_0&#176; CCW"),
2453                    // This is shared between tooltips and statusbar, so they
2454                    // must use UTF-8, not HTML entities for special characters.
2455                    N_("Rotate selection 90\xc2\xb0 counter-clockwise"), INKSCAPE_ICON_OBJECT_ROTATE_LEFT),
2456     new ObjectVerb(SP_VERB_OBJECT_FLATTEN, "ObjectRemoveTransform", N_("Remove _Transformations"),
2457                    N_("Remove transformations from object"), NULL),
2458     new ObjectVerb(SP_VERB_OBJECT_TO_CURVE, "ObjectToPath", N_("_Object to Path"),
2459                    N_("Convert selected object to path"), INKSCAPE_ICON_OBJECT_TO_PATH),
2460     new ObjectVerb(SP_VERB_OBJECT_FLOW_TEXT, "ObjectFlowText", N_("_Flow into Frame"),
2461                    N_("Put text into a frame (path or shape), creating a flowed text linked to the frame object"), "text-flow-into-frame"),
2462     new ObjectVerb(SP_VERB_OBJECT_UNFLOW_TEXT, "ObjectUnFlowText", N_("_Unflow"),
2463                    N_("Remove text from frame (creates a single-line text object)"), INKSCAPE_ICON_TEXT_UNFLOW),
2464     new ObjectVerb(SP_VERB_OBJECT_FLOWTEXT_TO_TEXT, "ObjectFlowtextToText", N_("_Convert to Text"),
2465                    N_("Convert flowed text to regular text object (preserves appearance)"), INKSCAPE_ICON_TEXT_CONVERT_TO_REGULAR),
2466     new ObjectVerb(SP_VERB_OBJECT_FLIP_HORIZONTAL, "ObjectFlipHorizontally",
2467                    N_("Flip _Horizontal"), N_("Flip selected objects horizontally"),
2468                    INKSCAPE_ICON_OBJECT_FLIP_HORIZONTAL),
2469     new ObjectVerb(SP_VERB_OBJECT_FLIP_VERTICAL, "ObjectFlipVertically",
2470                    N_("Flip _Vertical"), N_("Flip selected objects vertically"),
2471                    INKSCAPE_ICON_OBJECT_FLIP_VERTICAL),
2472     new ObjectVerb(SP_VERB_OBJECT_SET_MASK, "ObjectSetMask", N_("_Set"),
2473                  N_("Apply mask to selection (using the topmost object as mask)"), NULL),
2474     new ObjectVerb(SP_VERB_OBJECT_EDIT_MASK, "ObjectEditMask", N_("_Edit"),
2475                  N_("Edit mask"), INKSCAPE_ICON_PATH_MASK_EDIT),
2476     new ObjectVerb(SP_VERB_OBJECT_UNSET_MASK, "ObjectUnSetMask", N_("_Release"),
2477                  N_("Remove mask from selection"), NULL),
2478     new ObjectVerb(SP_VERB_OBJECT_SET_CLIPPATH, "ObjectSetClipPath", N_("_Set"),
2479                  N_("Apply clipping path to selection (using the topmost object as clipping path)"), NULL),
2480     new ObjectVerb(SP_VERB_OBJECT_EDIT_CLIPPATH, "ObjectEditClipPath", N_("_Edit"),
2481                  N_("Edit clipping path"), INKSCAPE_ICON_PATH_CLIP_EDIT),
2482     new ObjectVerb(SP_VERB_OBJECT_UNSET_CLIPPATH, "ObjectUnSetClipPath", N_("_Release"),
2483                  N_("Remove clipping path from selection"), NULL),
2485     /* Tools */
2486     new ContextVerb(SP_VERB_CONTEXT_SELECT, "ToolSelector", N_("Select"),
2487                     N_("Select and transform objects"), INKSCAPE_ICON_TOOL_POINTER),
2488     new ContextVerb(SP_VERB_CONTEXT_NODE, "ToolNode", N_("Node Edit"),
2489                     N_("Edit paths by nodes"), INKSCAPE_ICON_TOOL_NODE_EDITOR),
2490     new ContextVerb(SP_VERB_CONTEXT_TWEAK, "ToolTweak", N_("Tweak"),
2491                     N_("Tweak objects by sculpting or painting"), INKSCAPE_ICON_TOOL_TWEAK),
2492     new ContextVerb(SP_VERB_CONTEXT_RECT, "ToolRect", N_("Rectangle"),
2493                     N_("Create rectangles and squares"), INKSCAPE_ICON_DRAW_RECTANGLE),
2494     new ContextVerb(SP_VERB_CONTEXT_3DBOX, "Tool3DBox", N_("3D Box"),
2495                     N_("Create 3D boxes"), INKSCAPE_ICON_DRAW_CUBOID),
2496     new ContextVerb(SP_VERB_CONTEXT_ARC, "ToolArc", N_("Ellipse"),
2497                     N_("Create circles, ellipses, and arcs"), INKSCAPE_ICON_DRAW_ELLIPSE),
2498     new ContextVerb(SP_VERB_CONTEXT_STAR, "ToolStar", N_("Star"),
2499                     N_("Create stars and polygons"), INKSCAPE_ICON_DRAW_POLYGON_STAR),
2500     new ContextVerb(SP_VERB_CONTEXT_SPIRAL, "ToolSpiral", N_("Spiral"),
2501                     N_("Create spirals"), INKSCAPE_ICON_DRAW_SPIRAL),
2502     new ContextVerb(SP_VERB_CONTEXT_PENCIL, "ToolPencil", N_("Pencil"),
2503                     N_("Draw freehand lines"), INKSCAPE_ICON_DRAW_FREEHAND),
2504     new ContextVerb(SP_VERB_CONTEXT_PEN, "ToolPen", N_("Pen"),
2505                     N_("Draw Bezier curves and straight lines"), INKSCAPE_ICON_DRAW_PATH),
2506     new ContextVerb(SP_VERB_CONTEXT_CALLIGRAPHIC, "ToolCalligraphic", N_("Calligraphy"),
2507                     N_("Draw calligraphic or brush strokes"), INKSCAPE_ICON_DRAW_CALLIGRAPHIC),
2508     new ContextVerb(SP_VERB_CONTEXT_TEXT, "ToolText", N_("Text"),
2509                     N_("Create and edit text objects"), INKSCAPE_ICON_DRAW_TEXT),
2510     new ContextVerb(SP_VERB_CONTEXT_GRADIENT, "ToolGradient", N_("Gradient"),
2511                     N_("Create and edit gradients"), INKSCAPE_ICON_COLOR_GRADIENT),
2512     new ContextVerb(SP_VERB_CONTEXT_ZOOM, "ToolZoom", N_("Zoom"),
2513                     N_("Zoom in or out"), INKSCAPE_ICON_ZOOM),
2514     new ContextVerb(SP_VERB_CONTEXT_DROPPER, "ToolDropper", N_("Dropper"),
2515                     N_("Pick colors from image"), INKSCAPE_ICON_COLOR_PICKER),
2516     new ContextVerb(SP_VERB_CONTEXT_CONNECTOR, "ToolConnector", N_("Connector"),
2517                     N_("Create diagram connectors"), INKSCAPE_ICON_DRAW_CONNECTOR),
2518     new ContextVerb(SP_VERB_CONTEXT_PAINTBUCKET, "ToolPaintBucket", N_("Paint Bucket"),
2519                     N_("Fill bounded areas"), INKSCAPE_ICON_COLOR_FILL),
2520     new ContextVerb(SP_VERB_CONTEXT_LPE, "ToolLPE", N_("LPE Edit"),
2521                     N_("Edit Path Effect parameters"), NULL),
2522     new ContextVerb(SP_VERB_CONTEXT_ERASER, "ToolEraser", N_("Eraser"),
2523                     N_("Erase existing paths"), INKSCAPE_ICON_DRAW_ERASER),
2524     new ContextVerb(SP_VERB_CONTEXT_LPETOOL, "ToolLPETool", N_("LPE Tool"),
2525                     N_("Do geometric constructions"), "draw-geometry"),
2526     /* Tool prefs */
2527     new ContextVerb(SP_VERB_CONTEXT_SELECT_PREFS, "SelectPrefs", N_("Selector Preferences"),
2528                     N_("Open Preferences for the Selector tool"), NULL),
2529     new ContextVerb(SP_VERB_CONTEXT_NODE_PREFS, "NodePrefs", N_("Node Tool Preferences"),
2530                     N_("Open Preferences for the Node tool"), NULL),
2531     new ContextVerb(SP_VERB_CONTEXT_TWEAK_PREFS, "TweakPrefs", N_("Tweak Tool Preferences"),
2532                     N_("Open Preferences for the Tweak tool"), NULL),
2533     new ContextVerb(SP_VERB_CONTEXT_RECT_PREFS, "RectPrefs", N_("Rectangle Preferences"),
2534                     N_("Open Preferences for the Rectangle tool"), NULL),
2535     new ContextVerb(SP_VERB_CONTEXT_3DBOX_PREFS, "3DBoxPrefs", N_("3D Box Preferences"),
2536                     N_("Open Preferences for the 3D Box tool"), NULL),
2537     new ContextVerb(SP_VERB_CONTEXT_ARC_PREFS, "ArcPrefs", N_("Ellipse Preferences"),
2538                     N_("Open Preferences for the Ellipse tool"), NULL),
2539     new ContextVerb(SP_VERB_CONTEXT_STAR_PREFS, "StarPrefs", N_("Star Preferences"),
2540                     N_("Open Preferences for the Star tool"), NULL),
2541     new ContextVerb(SP_VERB_CONTEXT_SPIRAL_PREFS, "SpiralPrefs", N_("Spiral Preferences"),
2542                     N_("Open Preferences for the Spiral tool"), NULL),
2543     new ContextVerb(SP_VERB_CONTEXT_PENCIL_PREFS, "PencilPrefs", N_("Pencil Preferences"),
2544                     N_("Open Preferences for the Pencil tool"), NULL),
2545     new ContextVerb(SP_VERB_CONTEXT_PEN_PREFS, "PenPrefs", N_("Pen Preferences"),
2546                     N_("Open Preferences for the Pen tool"), NULL),
2547     new ContextVerb(SP_VERB_CONTEXT_CALLIGRAPHIC_PREFS, "CalligraphicPrefs", N_("Calligraphic Preferences"),
2548                     N_("Open Preferences for the Calligraphy tool"), NULL),
2549     new ContextVerb(SP_VERB_CONTEXT_TEXT_PREFS, "TextPrefs", N_("Text Preferences"),
2550                     N_("Open Preferences for the Text tool"), NULL),
2551     new ContextVerb(SP_VERB_CONTEXT_GRADIENT_PREFS, "GradientPrefs", N_("Gradient Preferences"),
2552                     N_("Open Preferences for the Gradient tool"), NULL),
2553     new ContextVerb(SP_VERB_CONTEXT_ZOOM_PREFS, "ZoomPrefs", N_("Zoom Preferences"),
2554                     N_("Open Preferences for the Zoom tool"), NULL),
2555     new ContextVerb(SP_VERB_CONTEXT_DROPPER_PREFS, "DropperPrefs", N_("Dropper Preferences"),
2556                     N_("Open Preferences for the Dropper tool"), NULL),
2557     new ContextVerb(SP_VERB_CONTEXT_CONNECTOR_PREFS, "ConnectorPrefs", N_("Connector Preferences"),
2558                     N_("Open Preferences for the Connector tool"), NULL),
2559     new ContextVerb(SP_VERB_CONTEXT_PAINTBUCKET_PREFS, "PaintBucketPrefs", N_("Paint Bucket Preferences"),
2560                     N_("Open Preferences for the Paint Bucket tool"), NULL),
2561     new ContextVerb(SP_VERB_CONTEXT_ERASER_PREFS, "EraserPrefs", N_("Eraser Preferences"),
2562                     N_("Open Preferences for the Eraser tool"), NULL),
2563     new ContextVerb(SP_VERB_CONTEXT_LPETOOL_PREFS, "LPEToolPrefs", N_("LPE Tool Preferences"),
2564                     N_("Open Preferences for the LPETool tool"), NULL),
2566     /* Zoom/View */
2567     new ZoomVerb(SP_VERB_ZOOM_IN, "ZoomIn", N_("Zoom In"), N_("Zoom in"), INKSCAPE_ICON_ZOOM_IN),
2568     new ZoomVerb(SP_VERB_ZOOM_OUT, "ZoomOut", N_("Zoom Out"), N_("Zoom out"), INKSCAPE_ICON_ZOOM_OUT),
2569     new ZoomVerb(SP_VERB_TOGGLE_RULERS, "ToggleRulers", N_("_Rulers"), N_("Show or hide the canvas rulers"), NULL),
2570     new ZoomVerb(SP_VERB_TOGGLE_SCROLLBARS, "ToggleScrollbars", N_("Scroll_bars"), N_("Show or hide the canvas scrollbars"), NULL),
2571     new ZoomVerb(SP_VERB_TOGGLE_GRID, "ToggleGrid", N_("_Grid"), N_("Show or hide the grid"), INKSCAPE_ICON_SHOW_GRID),
2572     new ZoomVerb(SP_VERB_TOGGLE_GUIDES, "ToggleGuides", N_("G_uides"), N_("Show or hide guides (drag from a ruler to create a guide)"), INKSCAPE_ICON_SHOW_GUIDES),
2573     new ZoomVerb(SP_VERB_TOGGLE_SNAPPING, "ToggleSnapGlobal", N_("Snap"), N_("Toggle snapping on or off"), INKSCAPE_ICON_SNAP),
2574     new ZoomVerb(SP_VERB_ZOOM_NEXT, "ZoomNext", N_("Nex_t Zoom"), N_("Next zoom (from the history of zooms)"),
2575                  INKSCAPE_ICON_ZOOM_NEXT),
2576     new ZoomVerb(SP_VERB_ZOOM_PREV, "ZoomPrev", N_("Pre_vious Zoom"), N_("Previous zoom (from the history of zooms)"),
2577                  INKSCAPE_ICON_ZOOM_PREVIOUS),
2578     new ZoomVerb(SP_VERB_ZOOM_1_1, "Zoom1:0", N_("Zoom 1:_1"), N_("Zoom to 1:1"),
2579                  INKSCAPE_ICON_ZOOM_ORIGINAL),
2580     new ZoomVerb(SP_VERB_ZOOM_1_2, "Zoom1:2", N_("Zoom 1:_2"), N_("Zoom to 1:2"),
2581                  INKSCAPE_ICON_ZOOM_HALF_SIZE),
2582     new ZoomVerb(SP_VERB_ZOOM_2_1, "Zoom2:1", N_("_Zoom 2:1"), N_("Zoom to 2:1"),
2583                  INKSCAPE_ICON_ZOOM_DOUBLE_SIZE),
2584 #ifdef HAVE_GTK_WINDOW_FULLSCREEN
2585     new ZoomVerb(SP_VERB_FULLSCREEN, "FullScreen", N_("_Fullscreen"), N_("Stretch this document window to full screen"),
2586                  INKSCAPE_ICON_VIEW_FULLSCREEN),
2587 #endif /* HAVE_GTK_WINDOW_FULLSCREEN */
2588     new ZoomVerb(SP_VERB_FOCUSTOGGLE, "FocusToggle", N_("Toggle _Focus Mode"), N_("Remove excess toolbars to focus on drawing"),
2589                  NULL),
2590     new ZoomVerb(SP_VERB_VIEW_NEW, "ViewNew", N_("Duplic_ate Window"), N_("Open a new window with the same document"),
2591                  INKSCAPE_ICON_WINDOW_NEW),
2592     new ZoomVerb(SP_VERB_VIEW_NEW_PREVIEW, "ViewNewPreview", N_("_New View Preview"),
2593                  N_("New View Preview"), NULL/*"view_new_preview"*/),
2595     new ZoomVerb(SP_VERB_VIEW_MODE_NORMAL, "ViewModeNormal", N_("_Normal"),
2596                  N_("Switch to normal display mode"), NULL),
2597     new ZoomVerb(SP_VERB_VIEW_MODE_NO_FILTERS, "ViewModeNoFilters", N_("No _Filters"),
2598                  N_("Switch to normal display without filters"), NULL),
2599     new ZoomVerb(SP_VERB_VIEW_MODE_OUTLINE, "ViewModeOutline", N_("_Outline"),
2600                  N_("Switch to outline (wireframe) display mode"), NULL),
2601     new ZoomVerb(SP_VERB_VIEW_MODE_TOGGLE, "ViewModeToggle", N_("_Toggle"),
2602                  N_("Toggle between normal and outline display modes"), NULL),
2604     new ZoomVerb(SP_VERB_VIEW_CMS_TOGGLE, "ViewCmsToggle", N_("Color-managed view"),
2605                  N_("Toggle color-managed display for this document window"), INKSCAPE_ICON_COLOR_MANAGEMENT),
2607     new ZoomVerb(SP_VERB_VIEW_ICON_PREVIEW, "ViewIconPreview", N_("Ico_n Preview..."),
2608                  N_("Open a window to preview objects at different icon resolutions"), INKSCAPE_ICON_DIALOG_ICON_PREVIEW),
2609     new ZoomVerb(SP_VERB_ZOOM_PAGE, "ZoomPage", N_("_Page"),
2610                  N_("Zoom to fit page in window"), INKSCAPE_ICON_ZOOM_FIT_PAGE),
2611     new ZoomVerb(SP_VERB_ZOOM_PAGE_WIDTH, "ZoomPageWidth", N_("Page _Width"),
2612                  N_("Zoom to fit page width in window"), INKSCAPE_ICON_ZOOM_FIT_WIDTH),
2613     new ZoomVerb(SP_VERB_ZOOM_DRAWING, "ZoomDrawing", N_("_Drawing"),
2614                  N_("Zoom to fit drawing in window"), INKSCAPE_ICON_ZOOM_FIT_DRAWING),
2615     new ZoomVerb(SP_VERB_ZOOM_SELECTION, "ZoomSelection", N_("_Selection"),
2616                  N_("Zoom to fit selection in window"), INKSCAPE_ICON_ZOOM_FIT_SELECTION),
2618     /* Dialogs */
2619     new DialogVerb(SP_VERB_DIALOG_DISPLAY, "DialogPreferences", N_("In_kscape Preferences..."),
2620                    N_("Edit global Inkscape preferences"), GTK_STOCK_PREFERENCES ),
2621     new DialogVerb(SP_VERB_DIALOG_NAMEDVIEW, "DialogDocumentProperties", N_("_Document Properties..."),
2622                    N_("Edit properties of this document (to be saved with the document)"), GTK_STOCK_PROPERTIES ),
2623     new DialogVerb(SP_VERB_DIALOG_METADATA, "DialogMetadata", N_("Document _Metadata..."),
2624                    N_("Edit document metadata (to be saved with the document)"), INKSCAPE_ICON_DOCUMENT_METADATA ),
2625     new DialogVerb(SP_VERB_DIALOG_FILL_STROKE, "DialogFillStroke", N_("_Fill and Stroke..."),
2626                    N_("Edit objects' colors, gradients, stroke width, arrowheads, dash patterns..."), INKSCAPE_ICON_DIALOG_FILL_AND_STROKE),
2627     // TRANSLATORS: "Swatches" means: color samples
2628     new DialogVerb(SP_VERB_DIALOG_SWATCHES, "DialogSwatches", N_("S_watches..."),
2629                    N_("Select colors from a swatches palette"), GTK_STOCK_SELECT_COLOR),
2630     new DialogVerb(SP_VERB_DIALOG_TRANSFORM, "DialogTransform", N_("Transfor_m..."),
2631                    N_("Precisely control objects' transformations"), INKSCAPE_ICON_DIALOG_TRANSFORM),
2632     new DialogVerb(SP_VERB_DIALOG_ALIGN_DISTRIBUTE, "DialogAlignDistribute", N_("_Align and Distribute..."),
2633                    N_("Align and distribute objects"), INKSCAPE_ICON_DIALOG_ALIGN_AND_DISTRIBUTE),
2634     new DialogVerb(SP_VERB_DIALOG_UNDO_HISTORY, "DialogUndoHistory", N_("Undo _History..."),
2635                    N_("Undo History"), INKSCAPE_ICON_EDIT_UNDO_HISTORY),
2636     new DialogVerb(SP_VERB_DIALOG_TEXT, "DialogText", N_("_Text and Font..."),
2637                    N_("View and select font family, font size and other text properties"), INKSCAPE_ICON_DIALOG_TEXT_AND_FONT),
2638     new DialogVerb(SP_VERB_DIALOG_XML_EDITOR, "DialogXMLEditor", N_("_XML Editor..."),
2639                    N_("View and edit the XML tree of the document"), INKSCAPE_ICON_DIALOG_XML_EDITOR),
2640     new DialogVerb(SP_VERB_DIALOG_FIND, "DialogFind", N_("_Find..."),
2641                    N_("Find objects in document"), GTK_STOCK_FIND ),
2642     new DialogVerb(SP_VERB_DIALOG_FINDREPLACE, "DialogFindReplace", N_("Find and _Replace Text..."),
2643                    N_("Find and replace text in document"), GTK_STOCK_FIND_AND_REPLACE ),
2644     new DialogVerb(SP_VERB_DIALOG_SPELLCHECK, "DialogSpellcheck", N_("Check Spellin_g..."),
2645                    N_("Check spelling of text in document"), GTK_STOCK_SPELL_CHECK ),
2646     new DialogVerb(SP_VERB_DIALOG_DEBUG, "DialogDebug", N_("_Messages..."),
2647                    N_("View debug messages"), INKSCAPE_ICON_DIALOG_MESSAGES),
2648     new DialogVerb(SP_VERB_DIALOG_SCRIPT, "DialogScript", N_("S_cripts..."),
2649                    N_("Run scripts"), INKSCAPE_ICON_DIALOG_SCRIPTS),
2650     new DialogVerb(SP_VERB_DIALOG_TOGGLE, "DialogsToggle", N_("Show/Hide D_ialogs"),
2651                    N_("Show or hide all open dialogs"), INKSCAPE_ICON_SHOW_DIALOGS),
2652     new DialogVerb(SP_VERB_DIALOG_CLONETILER, "DialogClonetiler", N_("Create Tiled Clones..."),
2653                    N_("Create multiple clones of selected object, arranging them into a pattern or scattering"), INKSCAPE_ICON_DIALOG_TILE_CLONES),
2654     new DialogVerb(SP_VERB_DIALOG_ITEM, "DialogObjectProperties", N_("_Object Properties..."),
2655                    N_("Edit the ID, locked and visible status, and other object properties"), INKSCAPE_ICON_DIALOG_OBJECT_PROPERTIES),
2656 /*#ifdef WITH_INKBOARD
2657     new DialogVerb(SP_VERB_XMPP_CLIENT, "DialogXmppClient",
2658                    N_("_Instant Messaging..."), N_("Jabber Instant Messaging Client"), NULL),
2659 #endif*/
2660     new DialogVerb(SP_VERB_DIALOG_INPUT, "DialogInput", N_("_Input Devices..."),
2661                    N_("Configure extended input devices, such as a graphics tablet"), INKSCAPE_ICON_DIALOG_INPUT_DEVICES),
2662     new DialogVerb(SP_VERB_DIALOG_INPUT2, "DialogInput2", N_("_Input Devices (new)..."),
2663                    N_("Configure extended input devices, such as a graphics tablet"), INKSCAPE_ICON_DIALOG_INPUT_DEVICES),
2664     new DialogVerb(SP_VERB_DIALOG_EXTENSIONEDITOR, "org.inkscape.dialogs.extensioneditor", N_("_Extensions..."),
2665                    N_("Query information about extensions"), NULL),
2666     new DialogVerb(SP_VERB_DIALOG_LAYERS, "DialogLayers", N_("Layer_s..."),
2667                    N_("View Layers"), INKSCAPE_ICON_DIALOG_LAYERS),
2668     new DialogVerb(SP_VERB_DIALOG_LIVE_PATH_EFFECT, "DialogLivePathEffect", N_("Path Effect Editor..."),
2669                    N_("Manage, edit, and apply path effects"), NULL),
2670     new DialogVerb(SP_VERB_DIALOG_FILTER_EFFECTS, "DialogFilterEffects", N_("Filter Editor..."),
2671                    N_("Manage, edit, and apply SVG filters"), NULL),
2672     new DialogVerb(SP_VERB_DIALOG_SVG_FONTS, "DialogSVGFonts", N_("SVG Font Editor..."),
2673                    N_("Edit SVG fonts"), NULL),
2675     /* Help */
2676     new HelpVerb(SP_VERB_HELP_ABOUT_EXTENSIONS, "HelpAboutExtensions", N_("About E_xtensions"),
2677                  N_("Information on Inkscape extensions"), NULL),
2678     new HelpVerb(SP_VERB_HELP_MEMORY, "HelpAboutMemory", N_("About _Memory"),
2679                  N_("Memory usage information"), INKSCAPE_ICON_DIALOG_MEMORY),
2680     new HelpVerb(SP_VERB_HELP_ABOUT, "HelpAbout", N_("_About Inkscape"),
2681                  N_("Inkscape version, authors, license"), INKSCAPE_ICON_INKSCAPE),
2682     //new HelpVerb(SP_VERB_SHOW_LICENSE, "ShowLicense", N_("_License"),
2683     //           N_("Distribution terms"), /*"show_license"*/"inkscape_options"),
2685     /* Tutorials */
2686     new TutorialVerb(SP_VERB_TUTORIAL_BASIC, "TutorialsBasic", N_("Inkscape: _Basic"),
2687                      N_("Getting started with Inkscape"), NULL/*"tutorial_basic"*/),
2688     new TutorialVerb(SP_VERB_TUTORIAL_SHAPES, "TutorialsShapes", N_("Inkscape: _Shapes"),
2689                      N_("Using shape tools to create and edit shapes"), NULL),
2690     new TutorialVerb(SP_VERB_TUTORIAL_ADVANCED, "TutorialsAdvanced", N_("Inkscape: _Advanced"),
2691                      N_("Advanced Inkscape topics"), NULL/*"tutorial_advanced"*/),
2692     // TRANSLATORS: "to trace" means "to convert a bitmap to vector graphics" (to vectorize)
2693     new TutorialVerb(SP_VERB_TUTORIAL_TRACING, "TutorialsTracing", N_("Inkscape: T_racing"),
2694                      N_("Using bitmap tracing"), NULL/*"tutorial_tracing"*/),
2695     new TutorialVerb(SP_VERB_TUTORIAL_CALLIGRAPHY, "TutorialsCalligraphy", N_("Inkscape: _Calligraphy"),
2696                      N_("Using the Calligraphy pen tool"), NULL),
2697     new TutorialVerb(SP_VERB_TUTORIAL_DESIGN, "TutorialsDesign", N_("_Elements of Design"),
2698                      N_("Principles of design in the tutorial form"), NULL/*"tutorial_design"*/),
2699     new TutorialVerb(SP_VERB_TUTORIAL_TIPS, "TutorialsTips", N_("_Tips and Tricks"),
2700                      N_("Miscellaneous tips and tricks"), NULL/*"tutorial_tips"*/),
2702     /* Effect -- renamed Extension */
2703     new EffectLastVerb(SP_VERB_EFFECT_LAST, "EffectLast", N_("Previous Extension"),
2704                        N_("Repeat the last extension with the same settings"), NULL),
2705     new EffectLastVerb(SP_VERB_EFFECT_LAST_PREF, "EffectLastPref", N_("Previous Extension Settings..."),
2706                        N_("Repeat the last extension with new settings"), NULL),
2708     /* Fit Page */
2709     new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_SELECTION, "FitCanvasToSelection", N_("Fit Page to Selection"),
2710                        N_("Fit the page to the current selection"), NULL),
2711     new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_DRAWING, "FitCanvasToDrawing", N_("Fit Page to Drawing"),
2712                        N_("Fit the page to the drawing"), NULL),
2713     new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING, "FitCanvasToSelectionOrDrawing", N_("Fit Page to Selection or Drawing"),
2714                        N_("Fit the page to the current selection or the drawing if there is no selection"), NULL),
2715     /* LockAndHide */
2716     new LockAndHideVerb(SP_VERB_UNLOCK_ALL, "UnlockAll", N_("Unlock All"),
2717                        N_("Unlock all objects in the current layer"), NULL),
2718     new LockAndHideVerb(SP_VERB_UNLOCK_ALL_IN_ALL_LAYERS, "UnlockAllInAllLayers", N_("Unlock All in All Layers"),
2719                        N_("Unlock all objects in all layers"), NULL),
2720     new LockAndHideVerb(SP_VERB_UNHIDE_ALL, "UnhideAll", N_("Unhide All"),
2721                        N_("Unhide all objects in the current layer"), NULL),
2722     new LockAndHideVerb(SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS, "UnhideAllInAllLayers", N_("Unhide All in All Layers"),
2723                        N_("Unhide all objects in all layers"), NULL),
2724     /*Color Management*/
2725     new EditVerb(SP_VERB_EDIT_LINK_COLOR_PROFILE, "LinkColorProfile", N_("Link Color Profile"),
2726                  N_("Link an ICC color profile"), NULL),
2727     new EditVerb(SP_VERB_EDIT_REMOVE_COLOR_PROFILE, "RemoveColorProfile", N_("Remove Color Profile"),
2728                  N_("Remove a linked ICC color profile"), NULL),
2729     /* Footer */
2730     new Verb(SP_VERB_LAST, " '\"invalid id", NULL, NULL, NULL)
2731 };
2734 void
2735 Verb::list (void) {
2736     // Go through the dynamic verb table
2737     for (VerbTable::iterator iter = _verbs.begin(); iter != _verbs.end(); iter++) {
2738         Verb * verb = iter->second;
2739         if (verb->get_code() == SP_VERB_INVALID ||
2740                 verb->get_code() == SP_VERB_NONE ||
2741                 verb->get_code() == SP_VERB_LAST) {
2742             continue;
2743         }
2745         printf("%s: %s\n", verb->get_id(), verb->get_tip()? verb->get_tip() : verb->get_name());
2746     }
2748     return;
2749 };
2751 }  /* namespace Inkscape */
2753 /*
2754   Local Variables:
2755   mode:c++
2756   c-file-style:"stroustrup"
2757   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
2758   indent-tabs-mode:nil
2759   fill-column:99
2760   End:
2761 */
2762 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :