Code

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