Code

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