Code

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