Code

Base implementation of a layers dialog.
[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  * This code is in public domain.
21  */
26 #include <gtk/gtkstock.h>
28 #ifdef HAVE_CONFIG_H
29 # include "config.h"
30 #endif
32 #include "helper/action.h"
34 #include <gtkmm/messagedialog.h>
35 #include <gtkmm/filechooserdialog.h>
36 #include <gtkmm/stock.h>
38 #include "dialogs/text-edit.h"
39 #include "dialogs/xml-tree.h"
40 #include "dialogs/object-properties.h"
41 #include "dialogs/item-properties.h"
42 #include "dialogs/find.h"
43 #include "dialogs/layer-properties.h"
44 #include "dialogs/clonetiler.h"
45 #include "dialogs/iconpreview.h"
46 #include "dialogs/extensions.h"
47 #include "dialogs/swatches.h"
48 #include "dialogs/layers-panel.h"
49 #include "dialogs/input.h"
51 #ifdef WITH_INKBOARD
52 #include "ui/dialog/whiteboard-connect.h"
53 #include "ui/dialog/whiteboard-sharewithuser.h"
54 #include "ui/dialog/whiteboard-sharewithchat.h"
55 #include "jabber_whiteboard/session-manager.h"
56 #include "jabber_whiteboard/node-tracker.h"
57 #endif
59 #include "extension/effect.h"
61 #include "tools-switch.h"
62 #include "inkscape-private.h"
63 #include "file.h"
64 #include "help.h"
65 #include "document.h"
66 #include "desktop.h"
67 #include "message-stack.h"
68 #include "desktop-handles.h"
69 #include "selection-chemistry.h"
70 #include "path-chemistry.h"
71 #include "text-chemistry.h"
72 #include "ui/dialog/dialog-manager.h"
73 #include "ui/dialog/inkscape-preferences.h"
74 #include "interface.h"
75 #include "prefs-utils.h"
76 #include "splivarot.h"
77 #include "sp-namedview.h"
78 #include "sp-flowtext.h"
79 #include "layer-fns.h"
80 #include "node-context.h"
83 /**
84  * \brief Return the name without underscores and ellipsis, for use in dialog
85  * titles, etc. Allocated memory must be freed by caller.
86  */
87 gchar *
88 sp_action_get_title(SPAction const *action)
89 {
90     char const *src = action->name;
91     gchar *ret = g_new(gchar, strlen(src) + 1);
92     unsigned ri = 0;
94     for (unsigned si = 0 ; ; si++)  {
95         int const c = src[si];
96         if ( c != '_' && c != '.' ) {
97             ret[ri] = c;
98             ri++;
99             if (c == '\0') {
100                 return ret;
101             }
102         }
103     }
105 } // end of sp_action_get_title()
108 namespace Inkscape {
110 /// \todo !!!FIXME:: kill this, use DialogManager instead!!!
112 class PanelDialog : public Inkscape::UI::Dialog::Dialog
114 public:
115     PanelDialog(char const *prefs_path, int const verb_num) : Dialog(prefs_path, verb_num) {}
116 /*
117     virtual Glib::ustring getName() const {return "foo";}
118     virtual Glib::ustring getDesc() const {return "bar";}
119 */
120 };
122 /** \brief Utility function to get a panel displayed. */
123 static void show_panel( Inkscape::UI::Widget::Panel &panel, char const *prefs_path, int const verb_num )
125     Gtk::Container *container = panel.get_toplevel();
126     if ( &panel == container ) { // safe check?
127         //g_message("Creating new dialog to hold it");
128         PanelDialog *dia = new PanelDialog(prefs_path, verb_num);
129         Gtk::VBox *mainVBox = dia->get_vbox();
130         mainVBox->pack_start(panel);
131         dia->show_all_children();
132         dia->present();
133         dia->read_geometry();
134     } else {
135         Gtk::Dialog *dia = dynamic_cast<Gtk::Dialog*>(container);
136         if ( dia ) {
137             //g_message("Found an existing dialog");
138             dia->present();
139         } else {
140             g_message("Failed to find an existing dialog");
141         }
142     }
145 /** \brief A class to encompass all of the verbs which deal with
146            file operations. */
147 class FileVerb : public Verb {
148 private:
149     static void perform(SPAction *action, void *mydata, void *otherdata);
150     static SPActionEventVector vector;
151 protected:
152     virtual SPAction *make_action(Inkscape::UI::View::View *view);
153 public:
154     /** \brief Use the Verb initializer with the same parameters. */
155     FileVerb(unsigned int const code,
156              gchar const *id,
157              gchar const *name,
158              gchar const *tip,
159              gchar const *image) :
160         Verb(code, id, name, tip, image)
161     { }
162 }; /* FileVerb class */
164 /** \brief A class to encompass all of the verbs which deal with
165            edit operations. */
166 class EditVerb : public Verb {
167 private:
168     static void perform(SPAction *action, void *mydata, void *otherdata);
169     static SPActionEventVector vector;
170 protected:
171     virtual SPAction *make_action(Inkscape::UI::View::View *view);
172 public:
173     /** \brief Use the Verb initializer with the same parameters. */
174     EditVerb(unsigned int const code,
175              gchar const *id,
176              gchar const *name,
177              gchar const *tip,
178              gchar const *image) :
179         Verb(code, id, name, tip, image)
180     { }
181 }; /* EditVerb class */
183 /** \brief A class to encompass all of the verbs which deal with
184            selection operations. */
185 class SelectionVerb : public Verb {
186 private:
187     static void perform(SPAction *action, void *mydata, void *otherdata);
188     static SPActionEventVector vector;
189 protected:
190     virtual SPAction *make_action(Inkscape::UI::View::View *view);
191 public:
192     /** \brief Use the Verb initializer with the same parameters. */
193     SelectionVerb(unsigned int const code,
194                   gchar const *id,
195                   gchar const *name,
196                   gchar const *tip,
197                   gchar const *image) :
198         Verb(code, id, name, tip, image)
199     { }
200 }; /* SelectionVerb class */
202 /** \brief A class to encompass all of the verbs which deal with
203            layer operations. */
204 class LayerVerb : public Verb {
205 private:
206     static void perform(SPAction *action, void *mydata, void *otherdata);
207     static SPActionEventVector vector;
208 protected:
209     virtual SPAction *make_action(Inkscape::UI::View::View *view);
210 public:
211     /** \brief Use the Verb initializer with the same parameters. */
212     LayerVerb(unsigned int const code,
213               gchar const *id,
214               gchar const *name,
215               gchar const *tip,
216               gchar const *image) :
217         Verb(code, id, name, tip, image)
218     { }
219 }; /* LayerVerb class */
221 /** \brief A class to encompass all of the verbs which deal with
222            operations related to objects. */
223 class ObjectVerb : public Verb {
224 private:
225     static void perform(SPAction *action, void *mydata, void *otherdata);
226     static SPActionEventVector vector;
227 protected:
228     virtual SPAction *make_action(Inkscape::UI::View::View *view);
229 public:
230     /** \brief Use the Verb initializer with the same parameters. */
231     ObjectVerb(unsigned int const code,
232                gchar const *id,
233                gchar const *name,
234                gchar const *tip,
235                gchar const *image) :
236         Verb(code, id, name, tip, image)
237     { }
238 }; /* ObjectVerb class */
240 /** \brief A class to encompass all of the verbs which deal with
241            operations relative to context. */
242 class ContextVerb : public Verb {
243 private:
244     static void perform(SPAction *action, void *mydata, void *otherdata);
245     static SPActionEventVector vector;
246 protected:
247     virtual SPAction *make_action(Inkscape::UI::View::View *view);
248 public:
249     /** \brief Use the Verb initializer with the same parameters. */
250     ContextVerb(unsigned int const code,
251                 gchar const *id,
252                 gchar const *name,
253                 gchar const *tip,
254                 gchar const *image) :
255         Verb(code, id, name, tip, image)
256     { }
257 }; /* ContextVerb class */
259 /** \brief A class to encompass all of the verbs which deal with
260            zoom operations. */
261 class ZoomVerb : public Verb {
262 private:
263     static void perform(SPAction *action, void *mydata, void *otherdata);
264     static SPActionEventVector vector;
265 protected:
266     virtual SPAction *make_action(Inkscape::UI::View::View *view);
267 public:
268     /** \brief Use the Verb initializer with the same parameters. */
269     ZoomVerb(unsigned int const code,
270              gchar const *id,
271              gchar const *name,
272              gchar const *tip,
273              gchar const *image) :
274         Verb(code, id, name, tip, image)
275     { }
276 }; /* ZoomVerb class */
279 /** \brief A class to encompass all of the verbs which deal with
280            dialog operations. */
281 class DialogVerb : public Verb {
282 private:
283     static void perform(SPAction *action, void *mydata, void *otherdata);
284     static SPActionEventVector vector;
285 protected:
286     virtual SPAction *make_action(Inkscape::UI::View::View *view);
287 public:
288     /** \brief Use the Verb initializer with the same parameters. */
289     DialogVerb(unsigned int const code,
290                gchar const *id,
291                gchar const *name,
292                gchar const *tip,
293                gchar const *image) :
294         Verb(code, id, name, tip, image)
295     { }
296 }; /* DialogVerb class */
298 /** \brief A class to encompass all of the verbs which deal with
299            help operations. */
300 class HelpVerb : public Verb {
301 private:
302     static void perform(SPAction *action, void *mydata, void *otherdata);
303     static SPActionEventVector vector;
304 protected:
305     virtual SPAction *make_action(Inkscape::UI::View::View *view);
306 public:
307     /** \brief Use the Verb initializer with the same parameters. */
308     HelpVerb(unsigned int const code,
309              gchar const *id,
310              gchar const *name,
311              gchar const *tip,
312              gchar const *image) :
313         Verb(code, id, name, tip, image)
314     { }
315 }; /* HelpVerb class */
317 /** \brief A class to encompass all of the verbs which deal with
318            tutorial operations. */
319 class TutorialVerb : public Verb {
320 private:
321     static void perform(SPAction *action, void *mydata, void *otherdata);
322     static SPActionEventVector vector;
323 protected:
324     virtual SPAction *make_action(Inkscape::UI::View::View *view);
325 public:
326     /** \brief Use the Verb initializer with the same parameters. */
327     TutorialVerb(unsigned int const code,
328                  gchar const *id,
329                  gchar const *name,
330                  gchar const *tip,
331                  gchar const *image) :
332         Verb(code, id, name, tip, image)
333     { }
334 }; /* TutorialVerb class */
337 Verb::VerbTable Verb::_verbs;
338 Verb::VerbIDTable Verb::_verb_ids;
340 /** \brief  Create a verb without a code.
342     This function calls the other constructor for all of the parameters,
343     but generates the code.  It is important to READ THE OTHER DOCUMENTATION
344     it has important details in it.  To generate the code a static is
345     used which starts at the last static value: \c SP_VERB_LAST.  For
346     each call it is incremented.  The list of allocated verbs is kept
347     in the \c _verbs hashtable which is indexed by the \c code.
348 */
349 Verb::Verb(gchar const *id, gchar const *name, gchar const *tip, gchar const *image) :
350     _actions(NULL), _id(id), _name(name), _tip(tip), _image(image)
352     static int count = SP_VERB_LAST;
354     count++;
355     _code = count;
356     _verbs.insert(VerbTable::value_type(count, this));
357     _verb_ids.insert(VerbIDTable::value_type(_id, this));
359     return;
362 /** \brief  Destroy a verb.
364       The only allocated variable is the _actions variable.  If it has
365     been allocated it is deleted.
366 */
367 Verb::~Verb(void)
369     /// \todo all the actions need to be cleaned up first.
370     if (_actions != NULL) {
371         delete _actions;
372     }
374     return;
377 /** \brief  Verbs are no good without actions.  This is a place holder
378             for a function that every subclass should write.  Most
379             can be written using \c make_action_helper.
380     \param  view  Which view the action should be created for.
381     \return NULL to represent error (this function shouldn't ever be called)
382 */
383 SPAction *
384 Verb::make_action(Inkscape::UI::View::View *view)
386     //std::cout << "make_action" << std::endl;
387     return NULL;
390 /** \brief  Create an action for a \c FileVerb
391     \param  view  Which view the action should be created for
392     \return The built action.
394     Calls \c make_action_helper with the \c vector.
395 */
396 SPAction *
397 FileVerb::make_action(Inkscape::UI::View::View *view)
399     //std::cout << "fileverb: make_action: " << &vector << std::endl;
400     return make_action_helper(view, &vector);
403 /** \brief  Create an action for a \c EditVerb
404     \param  view  Which view the action should be created for
405     \return The built action.
407     Calls \c make_action_helper with the \c vector.
408 */
409 SPAction *
410 EditVerb::make_action(Inkscape::UI::View::View *view)
412     //std::cout << "editverb: make_action: " << &vector << std::endl;
413     return make_action_helper(view, &vector);
416 /** \brief  Create an action for a \c SelectionVerb
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 SelectionVerb::make_action(Inkscape::UI::View::View *view)
425     return make_action_helper(view, &vector);
428 /** \brief  Create an action for a \c LayerVerb
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 LayerVerb::make_action(Inkscape::UI::View::View *view)
437     return make_action_helper(view, &vector);
440 /** \brief  Create an action for a \c ObjectVerb
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 ObjectVerb::make_action(Inkscape::UI::View::View *view)
449     return make_action_helper(view, &vector);
452 /** \brief  Create an action for a \c ContextVerb
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 ContextVerb::make_action(Inkscape::UI::View::View *view)
461     return make_action_helper(view, &vector);
464 /** \brief  Create an action for a \c ZoomVerb
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 ZoomVerb::make_action(Inkscape::UI::View::View *view)
473     return make_action_helper(view, &vector);
476 /** \brief  Create an action for a \c DialogVerb
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 DialogVerb::make_action(Inkscape::UI::View::View *view)
485     return make_action_helper(view, &vector);
488 /** \brief  Create an action for a \c HelpVerb
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 HelpVerb::make_action(Inkscape::UI::View::View *view)
497     return make_action_helper(view, &vector);
500 /** \brief  Create an action for a \c TutorialVerb
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 TutorialVerb::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  A function to remove the action associated with a view.
632     \param  view  Which view's actions should be removed.
633     \return None
635     This function looks for the action in \c _actions.  If it is
636     found then it is unreferenced and the entry in the action
637     table is erased.
638 */
639 void
640 Verb::delete_view(Inkscape::UI::View::View *view)
642     if (_actions == NULL) return;
643     if (_actions->empty()) return;
645 #if 0
646     static int count = 0;
647     std::cout << count++ << std::endl;
648 #endif
650     ActionTable::iterator action_found = _actions->find(view);
652     if (action_found != _actions->end()) {
653         SPAction *action = action_found->second;
654         nr_object_unref(NR_OBJECT(action));
655         _actions->erase(action_found);
656     }
658     return;
661 /** \brief  A function to delete a view from all verbs
662     \param  view  Which view's actions should be removed.
663     \return None
665     This function first looks through _base_verbs and deteles
666     the view from all of those views.  If \c _verbs is not empty
667     then all of the entries in that table have all of the views
668     deleted also.
669 */
670 void
671 Verb::delete_all_view(Inkscape::UI::View::View *view)
673     for (int i = 0; i <= SP_VERB_LAST; i++) {
674         if (_base_verbs[i])
675           _base_verbs[i]->delete_view(view);
676     }
678     if (!_verbs.empty()) {
679         for (VerbTable::iterator thisverb = _verbs.begin();
680              thisverb != _verbs.end(); thisverb++) {
681             Inkscape::Verb *verbpntr = thisverb->second;
682             // std::cout << "Delete In Verb: " << verbpntr->_name << std::endl;
683             verbpntr->delete_view(view);
684         }
685     }
687     return;
690 /** \brief  A function to turn a \c code into a Verb for dynamically
691             created Verbs.
692     \param  code  What code is being looked for
693     \return The found Verb of NULL if none is found.
695     This function basically just looks through the \c _verbs hash
696     table.  STL does all the work.
697 */
698 Verb *
699 Verb::get_search(unsigned int code)
701     Verb *verb = NULL;
702     VerbTable::iterator verb_found = _verbs.find(code);
704     if (verb_found != _verbs.end()) {
705         verb = verb_found->second;
706     }
708     return verb;
711 /** \brief  Find a Verb using it's ID
712     \param  id  Which id to search for
714     This function uses the \c _verb_ids has table to find the
715     verb by it's id.  Should be much faster than previous
716     implementations.
717 */
718 Verb *
719 Verb::getbyid(gchar const *id)
721     Verb *verb = NULL;
722     VerbIDTable::iterator verb_found = _verb_ids.find(id);
724     if (verb_found != _verb_ids.end()) {
725         verb = verb_found->second;
726     }
728     if (verb == NULL)
729         printf("Unable to find: %s\n", id);
731     return verb;
734 /** \brief  Decode the verb code and take appropriate action */
735 void
736 FileVerb::perform(SPAction *action, void *data, void *pdata)
738 #if 0
739     /* These aren't used, but are here to remind people not to use
740        the CURRENT_DOCUMENT macros unless they really have to. */
741     Inkscape::UI::View::View *current_view = sp_action_get_view(action);
742     SPDocument *current_document = current_view->doc();
743 #endif
744     switch ((long) data) {
745         case SP_VERB_FILE_NEW:
746             sp_file_new_default();
747             break;
748         case SP_VERB_FILE_OPEN:
749             sp_file_open_dialog(NULL, NULL);
750             break;
751         case SP_VERB_FILE_REVERT:
752             sp_file_revert_dialog();
753             break;
754         case SP_VERB_FILE_SAVE:
755             sp_file_save(NULL, NULL);
756             break;
757         case SP_VERB_FILE_SAVE_AS:
758             sp_file_save_as(NULL, NULL);
759             break;
760         case SP_VERB_FILE_PRINT:
761             sp_file_print();
762             break;
763         case SP_VERB_FILE_VACUUM:
764             sp_file_vacuum();
765             break;
766         case SP_VERB_FILE_PRINT_DIRECT:
767             sp_file_print_direct();
768             break;
769         case SP_VERB_FILE_PRINT_PREVIEW:
770             sp_file_print_preview(NULL, NULL);
771             break;
772         case SP_VERB_FILE_IMPORT:
773             sp_file_import(NULL);
774             break;
775         case SP_VERB_FILE_EXPORT:
776             sp_file_export_dialog(NULL);
777             break;
778         case SP_VERB_FILE_NEXT_DESKTOP:
779             inkscape_switch_desktops_next();
780             break;
781         case SP_VERB_FILE_PREV_DESKTOP:
782             inkscape_switch_desktops_prev();
783             break;
784         case SP_VERB_FILE_CLOSE_VIEW:
785             sp_ui_close_view(NULL);
786             break;
787         case SP_VERB_FILE_QUIT:
788             sp_file_exit();
789             break;
790         default:
791             break;
792     }
794 } // end of sp_verb_action_file_perform()
796 /** \brief  Decode the verb code and take appropriate action */
797 void
798 EditVerb::perform(SPAction *action, void *data, void *pdata)
800     SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
801     if (!dt)
802         return;
804     SPEventContext *ec = dt->event_context;
806     switch (reinterpret_cast<std::size_t>(data)) {
807         case SP_VERB_EDIT_UNDO:
808             sp_undo(dt, sp_desktop_document(dt));
809             break;
810         case SP_VERB_EDIT_REDO:
811             sp_redo(dt, sp_desktop_document(dt));
812             break;
813         case SP_VERB_EDIT_CUT:
814             sp_selection_cut();
815             break;
816         case SP_VERB_EDIT_COPY:
817             sp_selection_copy();
818             break;
819         case SP_VERB_EDIT_PASTE:
820             sp_selection_paste(false);
821             break;
822         case SP_VERB_EDIT_PASTE_STYLE:
823             sp_selection_paste_style();
824             break;
825         case SP_VERB_EDIT_PASTE_SIZE:
826             sp_selection_paste_size(true, true);
827             break;
828         case SP_VERB_EDIT_PASTE_SIZE_X:
829             sp_selection_paste_size(true, false);
830             break;
831         case SP_VERB_EDIT_PASTE_SIZE_Y:
832             sp_selection_paste_size(false, true);
833             break;
834         case SP_VERB_EDIT_PASTE_SIZE_SEPARATELY:
835             sp_selection_paste_size_separately(true, true);
836             break;
837         case SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_X:
838             sp_selection_paste_size_separately(true, false);
839             break;
840         case SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_Y:
841             sp_selection_paste_size_separately(false, true);
842             break;
843         case SP_VERB_EDIT_PASTE_IN_PLACE:
844             sp_selection_paste(true);
845             break;
846         case SP_VERB_EDIT_DELETE:
847             sp_selection_delete();
848             break;
849         case SP_VERB_EDIT_DUPLICATE:
850             sp_selection_duplicate();
851             break;
852         case SP_VERB_EDIT_CLONE:
853             sp_selection_clone();
854             break;
855         case SP_VERB_EDIT_UNLINK_CLONE:
856             sp_selection_unlink();
857             break;
858         case SP_VERB_EDIT_CLONE_ORIGINAL:
859             sp_select_clone_original();
860             break;
861         case SP_VERB_EDIT_TILE:
862             sp_selection_tile();
863             break;
864         case SP_VERB_EDIT_UNTILE:
865             sp_selection_untile();
866             break;
867         case SP_VERB_EDIT_CLEAR_ALL:
868             sp_edit_clear_all();
869             break;
870         case SP_VERB_EDIT_SELECT_ALL:
871             if (tools_isactive(dt, TOOLS_NODES)) {
872                 sp_nodepath_select_all_from_subpath(SP_NODE_CONTEXT(ec)->nodepath, false);
873             } else {
874                 sp_edit_select_all();
875             }
876             break;
877         case SP_VERB_EDIT_INVERT:
878             if (tools_isactive(dt, TOOLS_NODES)) {
879                 sp_nodepath_select_all_from_subpath(SP_NODE_CONTEXT(ec)->nodepath, true);
880             } else {
881                 sp_edit_invert();
882             }
883             break;
884         case SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS:
885             if (tools_isactive(dt, TOOLS_NODES)) {
886                 sp_nodepath_select_all(SP_NODE_CONTEXT(ec)->nodepath, false);
887             } else {
888                 sp_edit_select_all_in_all_layers();
889             }
890             break;
891         case SP_VERB_EDIT_INVERT_IN_ALL_LAYERS:
892             if (tools_isactive(dt, TOOLS_NODES)) {
893                 sp_nodepath_select_all(SP_NODE_CONTEXT(ec)->nodepath, true);
894             } else {
895                 sp_edit_invert_in_all_layers();
896             }
897             break;
898         case SP_VERB_EDIT_DESELECT:
899             if (tools_isactive(dt, TOOLS_NODES)) {
900                 sp_nodepath_deselect(SP_NODE_CONTEXT(ec)->nodepath);
901             } else {
902                 sp_desktop_selection(dt)->clear();
903             }
904             break;
905         default:
906             break;
907     }
909 } // end of sp_verb_action_edit_perform()
911 /** \brief  Decode the verb code and take appropriate action */
912 void
913 SelectionVerb::perform(SPAction *action, void *data, void *pdata)
915     SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
917     if (!dt)
918         return;
920     switch (reinterpret_cast<std::size_t>(data)) {
921         case SP_VERB_SELECTION_TO_FRONT:
922             sp_selection_raise_to_top();
923             break;
924         case SP_VERB_SELECTION_TO_BACK:
925             sp_selection_lower_to_bottom();
926             break;
927         case SP_VERB_SELECTION_RAISE:
928             sp_selection_raise();
929             break;
930         case SP_VERB_SELECTION_LOWER:
931             sp_selection_lower();
932             break;
933         case SP_VERB_SELECTION_GROUP:
934             sp_selection_group();
935             break;
936         case SP_VERB_SELECTION_UNGROUP:
937             sp_selection_ungroup();
938             break;
940         case SP_VERB_SELECTION_TEXTTOPATH:
941             text_put_on_path();
942             break;
943         case SP_VERB_SELECTION_TEXTFROMPATH:
944             text_remove_from_path();
945             break;
946         case SP_VERB_SELECTION_REMOVE_KERNS:
947             text_remove_all_kerns();
948             break;
950         case SP_VERB_SELECTION_UNION:
951             sp_selected_path_union();
952             break;
953         case SP_VERB_SELECTION_INTERSECT:
954             sp_selected_path_intersect();
955             break;
956         case SP_VERB_SELECTION_DIFF:
957             sp_selected_path_diff();
958             break;
959         case SP_VERB_SELECTION_SYMDIFF:
960             sp_selected_path_symdiff();
961             break;
963         case SP_VERB_SELECTION_CUT:
964             sp_selected_path_cut();
965             break;
966         case SP_VERB_SELECTION_SLICE:
967             sp_selected_path_slice();
968             break;
970         case SP_VERB_SELECTION_OFFSET:
971             sp_selected_path_offset();
972             break;
973         case SP_VERB_SELECTION_OFFSET_SCREEN:
974             sp_selected_path_offset_screen(1);
975             break;
976         case SP_VERB_SELECTION_OFFSET_SCREEN_10:
977             sp_selected_path_offset_screen(10);
978             break;
979         case SP_VERB_SELECTION_INSET:
980             sp_selected_path_inset();
981             break;
982         case SP_VERB_SELECTION_INSET_SCREEN:
983             sp_selected_path_inset_screen(1);
984             break;
985         case SP_VERB_SELECTION_INSET_SCREEN_10:
986             sp_selected_path_inset_screen(10);
987             break;
988         case SP_VERB_SELECTION_DYNAMIC_OFFSET:
989             sp_selected_path_create_offset_object_zero();
990             break;
991         case SP_VERB_SELECTION_LINKED_OFFSET:
992             sp_selected_path_create_updating_offset_object_zero();
993             break;
995         case SP_VERB_SELECTION_OUTLINE:
996             sp_selected_path_outline();
997             break;
998         case SP_VERB_SELECTION_SIMPLIFY:
999             sp_selected_path_simplify();
1000             break;
1001         case SP_VERB_SELECTION_REVERSE:
1002             sp_selected_path_reverse();
1003             break;
1004         case SP_VERB_SELECTION_TRACE:
1005             dt->_dlg_mgr->showDialog("Trace");
1006             break;
1007         case SP_VERB_SELECTION_CREATE_BITMAP:
1008             sp_selection_create_bitmap_copy();
1009             break;
1011         case SP_VERB_SELECTION_COMBINE:
1012             sp_selected_path_combine();
1013             break;
1014         case SP_VERB_SELECTION_BREAK_APART:
1015             sp_selected_path_break_apart();
1016             break;
1017         case SP_VERB_SELECTION_GRIDTILE:
1018             dt->_dlg_mgr->showDialog("TileDialog");
1019             break;
1020         default:
1021             break;
1022     }
1024 } // end of sp_verb_action_selection_perform()
1026 /** \brief  Decode the verb code and take appropriate action */
1027 void
1028 LayerVerb::perform(SPAction *action, void *data, void *pdata)
1030     SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1031     unsigned int verb = reinterpret_cast<std::size_t>(data);
1033     if ( !dt || !dt->currentLayer() ) {
1034         return;
1035     }
1037     switch (verb) {
1038         case SP_VERB_LAYER_NEW: {
1039             Inkscape::UI::Dialogs::LayerPropertiesDialog::showCreate(dt, dt->currentLayer());
1040             break;
1041         }
1042         case SP_VERB_LAYER_RENAME: {
1043             Inkscape::UI::Dialogs::LayerPropertiesDialog::showRename(dt, dt->currentLayer());
1044             break;
1045         }
1046         case SP_VERB_LAYER_NEXT: {
1047             SPObject *next=Inkscape::next_layer(dt->currentRoot(), dt->currentLayer());
1048             if (next) {
1049                 dt->setCurrentLayer(next);
1050                 sp_document_done(sp_desktop_document(dt));
1051                 dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Moved to next layer."));
1052             } else {
1053                 dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Cannot move past last layer."));
1054             }
1055             break;
1056         }
1057         case SP_VERB_LAYER_PREV: {
1058             SPObject *prev=Inkscape::previous_layer(dt->currentRoot(), dt->currentLayer());
1059             if (prev) {
1060                 dt->setCurrentLayer(prev);
1061                 sp_document_done(sp_desktop_document(dt));
1062                 dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Moved to previous layer."));
1063             } else {
1064                 dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Cannot move past first layer."));
1065             }
1066             break;
1067         }
1068         case SP_VERB_LAYER_MOVE_TO_NEXT: {
1069             sp_selection_to_next_layer();
1070             break;
1071         }
1072         case SP_VERB_LAYER_MOVE_TO_PREV: {
1073             sp_selection_to_prev_layer();
1074             break;
1075         }
1076         case SP_VERB_LAYER_TO_TOP:
1077         case SP_VERB_LAYER_TO_BOTTOM:
1078         case SP_VERB_LAYER_RAISE:
1079         case SP_VERB_LAYER_LOWER: {
1080             if ( dt->currentLayer() == dt->currentRoot() ) {
1081                 dt->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No current layer."));
1082                 return;
1083             }
1085             SPItem *layer=SP_ITEM(dt->currentLayer());
1086             g_return_if_fail(layer != NULL);
1088             SPObject *old_pos=SP_OBJECT_NEXT(layer);
1090             switch (verb) {
1091                 case SP_VERB_LAYER_TO_TOP:
1092                     layer->raiseToTop();
1093                     break;
1094                 case SP_VERB_LAYER_TO_BOTTOM:
1095                     layer->lowerToBottom();
1096                     break;
1097                 case SP_VERB_LAYER_RAISE:
1098                     layer->raiseOne();
1099                     break;
1100                 case SP_VERB_LAYER_LOWER:
1101                     layer->lowerOne();
1102                     break;
1103             }
1105             if ( SP_OBJECT_NEXT(layer) != old_pos ) {
1106                 char const *message = NULL;
1107                 switch (verb) {
1108                     case SP_VERB_LAYER_TO_TOP:
1109                     case SP_VERB_LAYER_RAISE:
1110                         message = g_strdup_printf(_("Raised layer <b>%s</b>."), layer->defaultLabel());
1111                         break;
1112                     case SP_VERB_LAYER_TO_BOTTOM:
1113                     case SP_VERB_LAYER_LOWER:
1114                         message = g_strdup_printf(_("Lowered layer <b>%s</b>."), layer->defaultLabel());
1115                         break;
1116                 };
1117                 sp_document_done(sp_desktop_document(dt));
1118                 if (message) {
1119                     dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, message);
1120                     g_free((void *) message);
1121                 }
1122             } else {
1123                 dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Cannot move layer any further."));
1124             }
1126             break;
1127         }
1128         case SP_VERB_LAYER_DELETE: {
1129             if ( dt->currentLayer() != dt->currentRoot() ) {
1130                 sp_desktop_selection(dt)->clear();
1131                 SPObject *old_layer=dt->currentLayer();
1133                 sp_object_ref(old_layer, NULL);
1134                 SPObject *survivor=Inkscape::next_layer(dt->currentRoot(), old_layer);
1135                 if (!survivor) {
1136                     survivor = Inkscape::previous_layer(dt->currentRoot(), old_layer);
1137                 }
1139                 /* Deleting the old layer before switching layers is a hack to trigger the
1140                  * listeners of the deletion event (as happens when old_layer is deleted using the
1141                  * xml editor).  See
1142                  * http://sourceforge.net/tracker/index.php?func=detail&aid=1339397&group_id=93438&atid=604306
1143                  */
1144                 old_layer->deleteObject();
1145                 sp_object_unref(old_layer, NULL);
1146                 if (survivor) {
1147                     dt->setCurrentLayer(survivor);
1148                 }
1150                 sp_document_done(sp_desktop_document(dt));
1152                 // TRANSLATORS: this means "The layer has been deleted."
1153                 dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Deleted layer."));
1154             } else {
1155                 dt->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No current layer."));
1156             }
1157             break;
1158         }
1159     }
1161     return;
1162 } // end of sp_verb_action_layer_perform()
1164 /** \brief  Decode the verb code and take appropriate action */
1165 void
1166 ObjectVerb::perform( SPAction *action, void *data, void *pdata )
1168     SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1169     if (!dt)
1170         return;
1172     SPEventContext *ec = dt->event_context;
1174     Inkscape::Selection *sel = sp_desktop_selection(dt);
1176     if (sel->isEmpty())
1177         return;
1179     NR::Point const center(sel->bounds().midpoint());
1181     switch (reinterpret_cast<std::size_t>(data)) {
1182         case SP_VERB_OBJECT_ROTATE_90_CW:
1183             sp_selection_rotate_90_cw();
1184             break;
1185         case SP_VERB_OBJECT_ROTATE_90_CCW:
1186             sp_selection_rotate_90_ccw();
1187             break;
1188         case SP_VERB_OBJECT_FLATTEN:
1189             sp_selection_remove_transform();
1190             break;
1191         case SP_VERB_OBJECT_TO_CURVE:
1192             sp_selected_path_to_curves();
1193             break;
1194         case SP_VERB_OBJECT_FLOW_TEXT:
1195             text_flow_into_shape();
1196             break;
1197         case SP_VERB_OBJECT_UNFLOW_TEXT:
1198             text_unflow();
1199             break;
1200         case SP_VERB_OBJECT_FLOWTEXT_TO_TEXT:
1201             SPFlowtext::convert_to_text();
1202             break;
1203         case SP_VERB_OBJECT_FLIP_HORIZONTAL:
1204             if (tools_isactive(dt, TOOLS_NODES)) {
1205                 sp_nodepath_flip(SP_NODE_CONTEXT(ec)->nodepath, NR::X);
1206             } else {
1207                 sp_selection_scale_relative(sel, center, NR::scale(-1.0, 1.0));
1208             }
1209             sp_document_done(sp_desktop_document(dt));
1210             break;
1211         case SP_VERB_OBJECT_FLIP_VERTICAL:
1212             if (tools_isactive(dt, TOOLS_NODES)) {
1213                 sp_nodepath_flip(SP_NODE_CONTEXT(ec)->nodepath, NR::Y);
1214             } else {
1215                 sp_selection_scale_relative(sel, center, NR::scale(1.0, -1.0));
1216             }
1217             sp_document_done(sp_desktop_document(dt));
1218             break;
1219         case SP_VERB_OBJECT_SET_MASK:
1220             sp_selection_set_mask(false, false);
1221             break;
1222         case SP_VERB_OBJECT_UNSET_MASK:
1223             sp_selection_unset_mask(false);
1224             break;
1225         case SP_VERB_OBJECT_SET_CLIPPATH:
1226             sp_selection_set_mask(true, false);
1227             break;
1228         case SP_VERB_OBJECT_UNSET_CLIPPATH:
1229             sp_selection_unset_mask(true);
1230             break;
1231         default:
1232             break;
1233     }
1235 } // end of sp_verb_action_object_perform()
1237 /** \brief  Decode the verb code and take appropriate action */
1238 void
1239 ContextVerb::perform(SPAction *action, void *data, void *pdata)
1241     SPDesktop *dt;
1242     sp_verb_t verb;
1243     int vidx;
1245     dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1247     if (!dt)
1248         return;
1250     verb = (sp_verb_t)GPOINTER_TO_INT((gpointer)data);
1252     /** \todo !!! hopefully this can go away soon and actions can look after
1253      * themselves
1254      */
1255     for (vidx = SP_VERB_CONTEXT_SELECT; vidx <= SP_VERB_CONTEXT_DROPPER_PREFS; vidx++)
1256     {
1257         SPAction *tool_action= get((sp_verb_t)vidx)->get_action(dt);
1258         if (tool_action) {
1259             sp_action_set_active(tool_action, vidx == (int)verb);
1260         }
1261     }
1263     switch (verb) {
1264         case SP_VERB_CONTEXT_SELECT:
1265             tools_switch_current(TOOLS_SELECT);
1266             break;
1267         case SP_VERB_CONTEXT_NODE:
1268             tools_switch_current(TOOLS_NODES);
1269             break;
1270         case SP_VERB_CONTEXT_RECT:
1271             tools_switch_current(TOOLS_SHAPES_RECT);
1272             break;
1273         case SP_VERB_CONTEXT_ARC:
1274             tools_switch_current(TOOLS_SHAPES_ARC);
1275             break;
1276         case SP_VERB_CONTEXT_STAR:
1277             tools_switch_current(TOOLS_SHAPES_STAR);
1278             break;
1279         case SP_VERB_CONTEXT_SPIRAL:
1280             tools_switch_current(TOOLS_SHAPES_SPIRAL);
1281             break;
1282         case SP_VERB_CONTEXT_PENCIL:
1283             tools_switch_current(TOOLS_FREEHAND_PENCIL);
1284             break;
1285         case SP_VERB_CONTEXT_PEN:
1286             tools_switch_current(TOOLS_FREEHAND_PEN);
1287             break;
1288         case SP_VERB_CONTEXT_CALLIGRAPHIC:
1289             tools_switch_current(TOOLS_CALLIGRAPHIC);
1290             break;
1291         case SP_VERB_CONTEXT_TEXT:
1292             tools_switch_current(TOOLS_TEXT);
1293             break;
1294         case SP_VERB_CONTEXT_GRADIENT:
1295             tools_switch_current(TOOLS_GRADIENT);
1296             break;
1297         case SP_VERB_CONTEXT_ZOOM:
1298             tools_switch_current(TOOLS_ZOOM);
1299             break;
1300         case SP_VERB_CONTEXT_DROPPER:
1301             tools_switch_current(TOOLS_DROPPER);
1302             break;
1303         case SP_VERB_CONTEXT_CONNECTOR:
1304             tools_switch_current (TOOLS_CONNECTOR);
1305             break;
1307         case SP_VERB_CONTEXT_SELECT_PREFS:
1308             prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SELECTOR);
1309             dt->_dlg_mgr->showDialog("InkscapePreferences");
1310             break;
1311         case SP_VERB_CONTEXT_NODE_PREFS:
1312             prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_NODE);
1313             dt->_dlg_mgr->showDialog("InkscapePreferences");
1314             break;
1315         case SP_VERB_CONTEXT_RECT_PREFS:
1316             prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SHAPES_RECT);
1317             dt->_dlg_mgr->showDialog("InkscapePreferences");
1318             break;
1319         case SP_VERB_CONTEXT_ARC_PREFS:
1320             prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SHAPES_ELLIPSE);
1321             dt->_dlg_mgr->showDialog("InkscapePreferences");
1322             break;
1323         case SP_VERB_CONTEXT_STAR_PREFS:
1324             prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SHAPES_STAR);
1325             dt->_dlg_mgr->showDialog("InkscapePreferences");
1326             break;
1327         case SP_VERB_CONTEXT_SPIRAL_PREFS:
1328             prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SHAPES_SPIRAL);
1329             dt->_dlg_mgr->showDialog("InkscapePreferences");
1330             break;
1331         case SP_VERB_CONTEXT_PENCIL_PREFS:
1332             prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_PENCIL);
1333             dt->_dlg_mgr->showDialog("InkscapePreferences");
1334             break;
1335         case SP_VERB_CONTEXT_PEN_PREFS:
1336             prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_PEN);
1337             dt->_dlg_mgr->showDialog("InkscapePreferences");
1338             break;
1339         case SP_VERB_CONTEXT_CALLIGRAPHIC_PREFS:
1340             prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_CALLIGRAPHY);
1341             dt->_dlg_mgr->showDialog("InkscapePreferences");
1342             break;
1343         case SP_VERB_CONTEXT_TEXT_PREFS:
1344             prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_TEXT);
1345             dt->_dlg_mgr->showDialog("InkscapePreferences");
1346             break;
1347         case SP_VERB_CONTEXT_GRADIENT_PREFS:
1348             prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_GRADIENT);
1349             dt->_dlg_mgr->showDialog("InkscapePreferences");
1350             break;
1351         case SP_VERB_CONTEXT_ZOOM_PREFS:
1352             prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_ZOOM);
1353             dt->_dlg_mgr->showDialog("InkscapePreferences");
1354             break;
1355         case SP_VERB_CONTEXT_DROPPER_PREFS:
1356             prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_DROPPER);
1357             dt->_dlg_mgr->showDialog("InkscapePreferences");
1358             break;
1359         case SP_VERB_CONTEXT_CONNECTOR_PREFS:
1360             prefs_set_int_attribute ("dialogs.preferences", "page", PREFS_PAGE_TOOLS_CONNECTOR);
1361             dt->_dlg_mgr->showDialog("InkscapePreferences");
1362             break;
1364         default:
1365             break;
1366     }
1368 } // end of sp_verb_action_ctx_perform()
1370 /** \brief  Decode the verb code and take appropriate action */
1371 void
1372 ZoomVerb::perform(SPAction *action, void *data, void *pdata)
1374     SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1375     if (!dt)
1376         return;
1378     SPDocument *doc = sp_desktop_document(dt);
1380     Inkscape::XML::Node *repr = SP_OBJECT_REPR(dt->namedview);
1382     gdouble zoom_inc =
1383         prefs_get_double_attribute_limited( "options.zoomincrement",
1384                                             "value", 1.414213562, 1.01, 10 );
1386     switch (GPOINTER_TO_INT(data)) {
1387         case SP_VERB_ZOOM_IN:
1388         {
1389             NR::Rect const d = dt->get_display_area();
1390             dt->zoom_relative( d.midpoint()[NR::X], d.midpoint()[NR::Y], zoom_inc);
1391             break;
1392         }
1393         case SP_VERB_ZOOM_OUT:
1394         {
1395             NR::Rect const d = dt->get_display_area();
1396             dt->zoom_relative( d.midpoint()[NR::X], d.midpoint()[NR::Y], 1 / zoom_inc );
1397             break;
1398         }
1399         case SP_VERB_ZOOM_1_1:
1400         {
1401             NR::Rect const d = dt->get_display_area();
1402             dt->zoom_absolute( d.midpoint()[NR::X], d.midpoint()[NR::Y], 1.0 );
1403             break;
1404         }
1405         case SP_VERB_ZOOM_1_2:
1406         {
1407             NR::Rect const d = dt->get_display_area();
1408             dt->zoom_absolute( d.midpoint()[NR::X], d.midpoint()[NR::Y], 0.5);
1409             break;
1410         }
1411         case SP_VERB_ZOOM_2_1:
1412         {
1413             NR::Rect const d = dt->get_display_area();
1414             dt->zoom_absolute( d.midpoint()[NR::X], d.midpoint()[NR::Y], 2.0 );
1415             break;
1416         }
1417         case SP_VERB_ZOOM_PAGE:
1418             dt->zoom_page();
1419             break;
1420         case SP_VERB_ZOOM_PAGE_WIDTH:
1421             dt->zoom_page_width();
1422             break;
1423         case SP_VERB_ZOOM_DRAWING:
1424             dt->zoom_drawing();
1425             break;
1426         case SP_VERB_ZOOM_SELECTION:
1427             dt->zoom_selection();
1428             break;
1429         case SP_VERB_ZOOM_NEXT:
1430             dt->next_zoom();
1431             break;
1432         case SP_VERB_ZOOM_PREV:
1433             dt->prev_zoom();
1434             break;
1435         case SP_VERB_TOGGLE_RULERS:
1436             dt->toggleRulers();
1437             break;
1438         case SP_VERB_TOGGLE_SCROLLBARS:
1439             dt->toggleScrollbars();
1440             break;
1441         case SP_VERB_TOGGLE_GUIDES:
1442             sp_namedview_toggle_guides(doc, repr);
1443             break;
1444         case SP_VERB_TOGGLE_GRID:
1445             sp_namedview_toggle_grid(doc, repr);
1446             break;
1447 #ifdef HAVE_GTK_WINDOW_FULLSCREEN
1448         case SP_VERB_FULLSCREEN:
1449             dt->fullscreen();
1450             break;
1451 #endif /* HAVE_GTK_WINDOW_FULLSCREEN */
1452         case SP_VERB_VIEW_NEW:
1453             sp_ui_new_view();
1454             break;
1455         case SP_VERB_VIEW_NEW_PREVIEW:
1456             sp_ui_new_view_preview();
1457             break;
1458         case SP_VERB_VIEW_MODE_NORMAL:
1459             dt->setDisplayModeNormal();
1460             break;
1461         case SP_VERB_VIEW_MODE_OUTLINE:
1462             dt->setDisplayModeOutline();
1463             break;
1464         case SP_VERB_VIEW_ICON_PREVIEW:
1465             show_panel( Inkscape::UI::Dialogs::IconPreviewPanel::getInstance(), "dialogs.iconpreview", SP_VERB_VIEW_ICON_PREVIEW );
1466             break;
1467         default:
1468             break;
1469     }
1471 } // end of sp_verb_action_zoom_perform()
1473 /** \brief  Decode the verb code and take appropriate action */
1474 void
1475 DialogVerb::perform(SPAction *action, void *data, void *pdata)
1477     if (reinterpret_cast<std::size_t>(data) != SP_VERB_DIALOG_TOGGLE) {
1478         // unhide all when opening a new dialog
1479         inkscape_dialogs_unhide();
1480     }
1482     SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1483     g_assert(dt->_dlg_mgr != NULL);
1485     switch (reinterpret_cast<std::size_t>(data)) {
1486         case SP_VERB_DIALOG_DISPLAY:
1487             //sp_display_dialog();
1488             dt->_dlg_mgr->showDialog("InkscapePreferences");
1489             break;
1490         case SP_VERB_DIALOG_METADATA:
1491             // sp_desktop_dialog();
1492             dt->_dlg_mgr->showDialog("DocumentMetadata");
1493             break;
1494         case SP_VERB_DIALOG_NAMEDVIEW:
1495             // sp_desktop_dialog();
1496             dt->_dlg_mgr->showDialog("DocumentProperties");
1497             break;
1498         case SP_VERB_DIALOG_FILL_STROKE:
1499             sp_object_properties_dialog();
1500             break;
1501         case SP_VERB_DIALOG_SWATCHES:
1502             show_panel( Inkscape::UI::Dialogs::SwatchesPanel::getInstance(), "dialogs.swatches", SP_VERB_DIALOG_SWATCHES);
1503             break;
1504         case SP_VERB_DIALOG_TRANSFORM:
1505             dt->_dlg_mgr->showDialog("Transformation");
1506             break;
1507         case SP_VERB_DIALOG_ALIGN_DISTRIBUTE:
1508             dt->_dlg_mgr->showDialog("AlignAndDistribute");
1509             break;
1510         case SP_VERB_DIALOG_TEXT:
1511             sp_text_edit_dialog();
1512             break;
1513         case SP_VERB_DIALOG_XML_EDITOR:
1514             sp_xml_tree_dialog();
1515             break;
1516         case SP_VERB_DIALOG_FIND:
1517             sp_find_dialog();
1518             break;
1519         case SP_VERB_DIALOG_DEBUG:
1520             dt->_dlg_mgr->showDialog("Messages");
1521             break;
1522         case SP_VERB_DIALOG_SCRIPT:
1523             dt->_dlg_mgr->showDialog("Script");
1524             break;
1525         case SP_VERB_DIALOG_TOGGLE:
1526             inkscape_dialogs_toggle();
1527             break;
1528         case SP_VERB_DIALOG_CLONETILER:
1529             clonetiler_dialog();
1530             break;
1531         case SP_VERB_DIALOG_ITEM:
1532             sp_item_dialog();
1533             break;
1534 #ifdef WITH_INKBOARD
1535         case SP_VERB_DIALOG_WHITEBOARD_CONNECT: {
1536             // We need to ensure that this dialog is associated with the correct SessionManager,
1537             // since the user may have opened a new document (and hence swapped SessionManager
1538             // instances) sometime before this dialog invocation
1539             Inkscape::UI::Dialog::WhiteboardConnectDialogImpl *dlg = dynamic_cast< Inkscape::UI::Dialog::WhiteboardConnectDialogImpl *>(dt->_dlg_mgr->getDialog("WhiteboardConnect"));
1540             dlg->setSessionManager();
1541             dt->_dlg_mgr->showDialog("WhiteboardConnect");
1542             break;
1543         }
1544         case SP_VERB_DIALOG_WHITEBOARD_SHAREWITHUSER: {
1545             //sp_whiteboard_sharewithuser_dialog(NULL);
1546             Inkscape::Whiteboard::SessionManager *sm = SP_ACTIVE_DESKTOP->whiteboard_session_manager();
1547             if (sm->session_data && sm->session_data->status[Inkscape::Whiteboard::LOGGED_IN]) {
1548                 // We need to ensure that this dialog is associated with the correct SessionManager,
1549                 // since the user may have opened a new document (and hence swapped SessionManager
1550                 // instances) sometime before this dialog invocation
1551                 Inkscape::UI::Dialog::WhiteboardShareWithUserDialogImpl *dlg = dynamic_cast< Inkscape::UI::Dialog::WhiteboardShareWithUserDialogImpl *>(dt->_dlg_mgr->getDialog("WhiteboardShareWithUser"));
1552                 dlg->setSessionManager();
1553                 dt->_dlg_mgr->showDialog("WhiteboardShareWithUser");
1554             } else {
1555                 Gtk::MessageDialog dlg(_("You need to connect to a Jabber server before sharing a document with another user."), true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_CLOSE);
1556                 dlg.run();
1557             }
1558             break;
1559         }
1560         case SP_VERB_DIALOG_WHITEBOARD_SHAREWITHCHAT: {
1561             Inkscape::Whiteboard::SessionManager *sm = SP_ACTIVE_DESKTOP->whiteboard_session_manager();
1562             if (sm->session_data && sm->session_data->status[Inkscape::Whiteboard::LOGGED_IN]) {
1563                 // We need to ensure that this dialog is associated with the correct SessionManager,
1564                 // since the user may have opened a new document (and hence swapped SessionManager
1565                 // instances) sometime before this dialog invocation
1566                 Inkscape::UI::Dialog::WhiteboardShareWithChatroomDialogImpl *dlg = dynamic_cast< Inkscape::UI::Dialog::WhiteboardShareWithChatroomDialogImpl *>(dt->_dlg_mgr->getDialog("WhiteboardShareWithChat"));
1567                 dlg->setSessionManager();
1568                 dt->_dlg_mgr->showDialog("WhiteboardShareWithChat");
1569             } else {
1570                 Gtk::MessageDialog dlg(_("You need to connect to a Jabber server before sharing a document with a chatroom."), true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_CLOSE);
1571                 dlg.run();
1572             }
1573             break;
1574         }
1576         case SP_VERB_DIALOG_WHITEBOARD_DUMPXMLTRACKER:
1577             if (SP_ACTIVE_DESKTOP->whiteboard_session_manager()->node_tracker()) {
1578                 SP_ACTIVE_DESKTOP->whiteboard_session_manager()->node_tracker()->dump();
1579             } else {
1580                 g_log(NULL, G_LOG_LEVEL_DEBUG, _("XML node tracker has not been initialized; nothing to dump"));
1581             }
1582             break;
1583         case SP_VERB_DIALOG_WHITEBOARD_OPENSESSIONFILE: {
1584             Gtk::FileChooserDialog sessionfiledlg(_("Open session file"), Gtk::FILE_CHOOSER_ACTION_OPEN);
1585             sessionfiledlg.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
1586             sessionfiledlg.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);
1588             int result = sessionfiledlg.run();
1589             switch (result) {
1590                 case Gtk::RESPONSE_OK:
1591                 {
1592                     SP_ACTIVE_DESKTOP->whiteboard_session_manager()->clearDocument();
1593                     SP_ACTIVE_DESKTOP->whiteboard_session_manager()->loadSessionFile(sessionfiledlg.get_filename());
1594                     dt->_dlg_mgr->showDialog("SessionPlayer");
1595                     //SP_ACTIVE_DESKTOP->whiteboard_session_manager()->session_player()->start();
1596                     break;
1597                 }
1598                 case Gtk::RESPONSE_CANCEL:
1599                 default:
1600                     break;
1601             }
1602             break;
1603         }
1605                 case SP_VERB_DIALOG_WHITEBOARD_DISCONNECT_FROM_SESSION:
1606                 {
1607             Inkscape::Whiteboard::SessionManager *sm = SP_ACTIVE_DESKTOP->whiteboard_session_manager();
1608             if (sm->session_data && sm->session_data->status[Inkscape::Whiteboard::IN_WHITEBOARD]) {
1609                                 SP_ACTIVE_DESKTOP->whiteboard_session_manager()->disconnectFromDocument();
1610                         }
1611                         break;
1612                 }
1613                 case SP_VERB_DIALOG_WHITEBOARD_DISCONNECT_FROM_SERVER:
1614                 {
1615             Inkscape::Whiteboard::SessionManager *sm = SP_ACTIVE_DESKTOP->whiteboard_session_manager();
1616             if (sm->session_data && sm->session_data->status[Inkscape::Whiteboard::LOGGED_IN]) {
1617                                 SP_ACTIVE_DESKTOP->whiteboard_session_manager()->disconnectFromServer();
1618                         }
1619                         break;
1620                 }
1621 #endif
1622         case SP_VERB_DIALOG_INPUT:
1623             sp_input_dialog();
1624             break;
1625         case SP_VERB_DIALOG_EXTENSIONEDITOR:
1626             dt->_dlg_mgr->showDialog("ExtensionEditor");
1627             break;
1628         case SP_VERB_DIALOG_LAYERS:
1629             show_panel( Inkscape::UI::Dialogs::LayersPanel::getInstance(), "dialogs.layers", SP_VERB_DIALOG_LAYERS );
1630             break;
1631         default:
1632             break;
1633     }
1634 } // end of sp_verb_action_dialog_perform()
1636 /** \brief  Decode the verb code and take appropriate action */
1637 void
1638 HelpVerb::perform(SPAction *action, void *data, void *pdata)
1640     SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1641     g_assert(dt->_dlg_mgr != NULL);
1643     switch (reinterpret_cast<std::size_t>(data)) {
1644         case SP_VERB_HELP_KEYS:
1645             /* TRANSLATORS: If you have translated the keys.svg file to your language, then
1646                translate this string as "keys.LANG.svg" (where LANG is your language code);
1647                otherwise leave as "keys.svg". */
1648             sp_help_open_screen(_("keys.svg"));
1649             break;
1650         case SP_VERB_HELP_ABOUT:
1651             sp_help_about();
1652             break;
1653         case SP_VERB_HELP_ABOUT_EXTENSIONS: {
1654             Inkscape::UI::Dialogs::ExtensionsPanel *panel = new Inkscape::UI::Dialogs::ExtensionsPanel();
1655             panel->set_full(true);
1656             show_panel( *panel, "dialogs.aboutextensions", SP_VERB_HELP_ABOUT_EXTENSIONS );
1657             break;
1658         }
1660         /*
1661         case SP_VERB_SHOW_LICENSE:
1662             // TRANSLATORS: See "tutorial-basic.svg" comment.
1663             sp_help_open_tutorial(NULL, (gpointer) _("gpl-2.svg"));
1664             break;
1665         */
1667         case SP_VERB_HELP_MEMORY:
1668             dt->_dlg_mgr->showDialog("Memory");
1669             break;
1670         default:
1671             break;
1672     }
1673 } // end of sp_verb_action_help_perform()
1675 /** \brief  Decode the verb code and take appropriate action */
1676 void
1677 TutorialVerb::perform(SPAction *action, void *data, void *pdata)
1679     switch (reinterpret_cast<std::size_t>(data)) {
1680         case SP_VERB_TUTORIAL_BASIC:
1681             /* TRANSLATORS: If you have translated the tutorial-basic.svg file to your language,
1682                then translate this string as "tutorial-basic.LANG.svg" (where LANG is your language
1683                code); otherwise leave as "tutorial-basic.svg". */
1684             sp_help_open_tutorial(NULL, (gpointer)_("tutorial-basic.svg"));
1685             break;
1686         case SP_VERB_TUTORIAL_SHAPES:
1687             // TRANSLATORS: See "tutorial-basic.svg" comment.
1688             sp_help_open_tutorial(NULL, (gpointer)_("tutorial-shapes.svg"));
1689             break;
1690         case SP_VERB_TUTORIAL_ADVANCED:
1691             // TRANSLATORS: See "tutorial-basic.svg" comment.
1692             sp_help_open_tutorial(NULL, (gpointer)_("tutorial-advanced.svg"));
1693             break;
1694         case SP_VERB_TUTORIAL_TRACING:
1695             // TRANSLATORS: See "tutorial-basic.svg" comment.
1696             sp_help_open_tutorial(NULL, (gpointer)_("tutorial-tracing.svg"));
1697             break;
1698         case SP_VERB_TUTORIAL_CALLIGRAPHY:
1699             // TRANSLATORS: See "tutorial-basic.svg" comment.
1700             sp_help_open_tutorial(NULL, (gpointer)_("tutorial-calligraphy.svg"));
1701             break;
1702         case SP_VERB_TUTORIAL_DESIGN:
1703             // TRANSLATORS: See "tutorial-basic.svg" comment.
1704             sp_help_open_tutorial(NULL, (gpointer)_("tutorial-elements.svg"));
1705             break;
1706         case SP_VERB_TUTORIAL_TIPS:
1707             // TRANSLATORS: See "tutorial-basic.svg" comment.
1708             sp_help_open_tutorial(NULL, (gpointer)_("tutorial-tips.svg"));
1709             break;
1710         default:
1711             break;
1712     }
1713 } // end of sp_verb_action_tutorial_perform()
1716 /**
1717  * Action vector to define functions called if a staticly defined file verb
1718  * is called.
1719  */
1720 SPActionEventVector FileVerb::vector =
1721             {{NULL},FileVerb::perform, NULL, NULL, NULL};
1722 /**
1723  * Action vector to define functions called if a staticly defined edit verb is
1724  * called.
1725  */
1726 SPActionEventVector EditVerb::vector =
1727             {{NULL},EditVerb::perform, NULL, NULL, NULL};
1729 /**
1730  * Action vector to define functions called if a staticly defined selection
1731  * verb is called
1732  */
1733 SPActionEventVector SelectionVerb::vector =
1734             {{NULL},SelectionVerb::perform, NULL, NULL, NULL};
1736 /**
1737  * Action vector to define functions called if a staticly defined layer
1738  * verb is called
1739  */
1740 SPActionEventVector LayerVerb::vector =
1741             {{NULL}, LayerVerb::perform, NULL, NULL, NULL};
1743 /**
1744  * Action vector to define functions called if a staticly defined object
1745  * editing verb is called
1746  */
1747 SPActionEventVector ObjectVerb::vector =
1748             {{NULL},ObjectVerb::perform, NULL, NULL, NULL};
1750 /**
1751  * Action vector to define functions called if a staticly defined context
1752  * verb is called
1753  */
1754 SPActionEventVector ContextVerb::vector =
1755             {{NULL},ContextVerb::perform, NULL, NULL, NULL};
1757 /**
1758  * Action vector to define functions called if a staticly defined zoom verb
1759  * is called
1760  */
1761 SPActionEventVector ZoomVerb::vector =
1762             {{NULL},ZoomVerb::perform, NULL, NULL, NULL};
1765 /**
1766  * Action vector to define functions called if a staticly defined dialog verb
1767  * is called
1768  */
1769 SPActionEventVector DialogVerb::vector =
1770             {{NULL},DialogVerb::perform, NULL, NULL, NULL};
1772 /**
1773  * Action vector to define functions called if a staticly defined help verb
1774  * is called
1775  */
1776 SPActionEventVector HelpVerb::vector =
1777             {{NULL},HelpVerb::perform, NULL, NULL, NULL};
1779 /**
1780  * Action vector to define functions called if a staticly defined tutorial verb
1781  * is called
1782  */
1783 SPActionEventVector TutorialVerb::vector =
1784             {{NULL},TutorialVerb::perform, NULL, NULL, NULL};
1786 /* *********** Effect Last ********** */
1788 /** \brief A class to represent the last effect issued */
1789 class EffectLastVerb : public Verb {
1790 private:
1791     static void perform(SPAction *action, void *mydata, void *otherdata);
1792     static SPActionEventVector vector;
1793 protected:
1794     virtual SPAction *make_action(Inkscape::UI::View::View *view);
1795 public:
1796     /** \brief Use the Verb initializer with the same parameters. */
1797     EffectLastVerb(unsigned int const code,
1798                    gchar const *id,
1799                    gchar const *name,
1800                    gchar const *tip,
1801                    gchar const *image) :
1802         Verb(code, id, name, tip, image)
1803     {
1804         set_default_sensitive(false);
1805     }
1806 }; /* EffectLastVerb class */
1808 /**
1809  * The vector to attach in the last effect verb.
1810  */
1811 SPActionEventVector EffectLastVerb::vector =
1812             {{NULL},EffectLastVerb::perform, NULL, NULL, NULL};
1814 /** \brief  Create an action for a \c EffectLastVerb
1815     \param  view  Which view the action should be created for
1816     \return The built action.
1818     Calls \c make_action_helper with the \c vector.
1819 */
1820 SPAction *
1821 EffectLastVerb::make_action(Inkscape::UI::View::View *view)
1823     return make_action_helper(view, &vector);
1826 /** \brief  Decode the verb code and take appropriate action */
1827 void
1828 EffectLastVerb::perform(SPAction *action, void *data, void *pdata)
1830     /* These aren't used, but are here to remind people not to use
1831        the CURRENT_DOCUMENT macros unless they really have to. */
1832     Inkscape::UI::View::View *current_view = sp_action_get_view(action);
1833     // SPDocument *current_document = SP_VIEW_DOCUMENT(current_view);
1834     Inkscape::Extension::Effect *effect = Inkscape::Extension::Effect::get_last_effect();
1836     if (effect == NULL) return;
1837     if (current_view == NULL) return;
1839     switch ((long) data) {
1840         case SP_VERB_EFFECT_LAST_PREF:
1841             if (!effect->prefs(current_view))
1842                 return;
1843             /* Note: fall through */
1844         case SP_VERB_EFFECT_LAST:
1845             effect->effect(current_view);
1846             break;
1847         default:
1848             return;
1849     }
1851     return;
1853 /* *********** End Effect Last ********** */
1855 /* *********** Fit Canvas ********** */
1857 /** \brief A class to represent the canvas fitting verbs */
1858 class FitCanvasVerb : public Verb {
1859 private:
1860     static void perform(SPAction *action, void *mydata, void *otherdata);
1861     static SPActionEventVector vector;
1862 protected:
1863     virtual SPAction *make_action(Inkscape::UI::View::View *view);
1864 public:
1865     /** \brief Use the Verb initializer with the same parameters. */
1866     FitCanvasVerb(unsigned int const code,
1867                    gchar const *id,
1868                    gchar const *name,
1869                    gchar const *tip,
1870                    gchar const *image) :
1871         Verb(code, id, name, tip, image)
1872     {
1873         set_default_sensitive(false);
1874     }
1875 }; /* FitCanvasVerb class */
1877 /**
1878  * The vector to attach in the fit canvas verb.
1879  */
1880 SPActionEventVector FitCanvasVerb::vector =
1881             {{NULL},FitCanvasVerb::perform, NULL, NULL, NULL};
1883 /** \brief  Create an action for a \c FitCanvasVerb
1884     \param  view  Which view the action should be created for
1885     \return The built action.
1887     Calls \c make_action_helper with the \c vector.
1888 */
1889 SPAction *
1890 FitCanvasVerb::make_action(Inkscape::UI::View::View *view)
1892     SPAction *action = make_action_helper(view, &vector);
1893     return action;
1896 /** \brief  Decode the verb code and take appropriate action */
1897 void
1898 FitCanvasVerb::perform(SPAction *action, void *data, void *pdata)
1900     SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1901     if (!dt) return;
1902     SPDocument *doc = sp_desktop_document(dt);
1903     if (!doc) return;
1904     
1905     switch ((long) data) {
1906         case SP_VERB_FIT_CANVAS_TO_SELECTION:
1907             fit_canvas_to_selection(dt);
1908             break;
1909         case SP_VERB_FIT_CANVAS_TO_DRAWING:
1910             fit_canvas_to_drawing(doc);
1911             break;
1912         case SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING:
1913             fit_canvas_to_selection_or_drawing(dt);
1914             break;
1915         default:
1916             return;
1917     }
1919     return;
1921 /* *********** End Fit Canvas ********** */
1928 /* these must be in the same order as the SP_VERB_* enum in "verbs.h" */
1929 Verb *Verb::_base_verbs[] = {
1930     /* Header */
1931     new Verb(SP_VERB_INVALID, NULL, NULL, NULL, NULL),
1932     new Verb(SP_VERB_NONE, "None", N_("None"), N_("Does nothing"), NULL),
1934     /* File */
1935     new FileVerb(SP_VERB_FILE_NEW, "FileNew", N_("Default"), N_("Create new document from the default template"),
1936                  GTK_STOCK_NEW ),
1937     new FileVerb(SP_VERB_FILE_OPEN, "FileOpen", N_("_Open..."),
1938                  N_("Open an existing document"), GTK_STOCK_OPEN ),
1939     new FileVerb(SP_VERB_FILE_REVERT, "FileRevert", N_("Re_vert"),
1940                  N_("Revert to the last saved version of document (changes will be lost)"), GTK_STOCK_REVERT_TO_SAVED ),
1941     new FileVerb(SP_VERB_FILE_SAVE, "FileSave", N_("_Save"), N_("Save document"),
1942                  GTK_STOCK_SAVE ),
1943     new FileVerb(SP_VERB_FILE_SAVE_AS, "FileSaveAs", N_("Save _As..."),
1944                  N_("Save document under a new name"), GTK_STOCK_SAVE_AS ),
1945     new FileVerb(SP_VERB_FILE_PRINT, "FilePrint", N_("_Print..."), N_("Print document"),
1946                  GTK_STOCK_PRINT ),
1947     // TRANSLATORS: "Vacuum Defs" means "Clean up defs" (so as to remove unused definitions)
1948     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"),
1949                  "file_vacuum" ),
1950     new FileVerb(SP_VERB_FILE_PRINT_DIRECT, "FilePrintDirect", N_("Print _Direct"),
1951                  N_("Print directly without prompting to a file or pipe"), NULL ),
1952     new FileVerb(SP_VERB_FILE_PRINT_PREVIEW, "FilePrintPreview", N_("Print Previe_w"),
1953                  N_("Preview document printout"), GTK_STOCK_PRINT_PREVIEW ),
1954     new FileVerb(SP_VERB_FILE_IMPORT, "FileImport", N_("_Import..."),
1955                  N_("Import a bitmap or SVG image into this document"), "file_import"),
1956     new FileVerb(SP_VERB_FILE_EXPORT, "FileExport", N_("_Export Bitmap..."),
1957                  N_("Export this document or a selection as a bitmap image"), "file_export"),
1958     new FileVerb(SP_VERB_FILE_NEXT_DESKTOP, "NextWindow", N_("N_ext Window"),
1959                  N_("Switch to the next document window"), "window_next"),
1960     new FileVerb(SP_VERB_FILE_PREV_DESKTOP, "PrevWindow", N_("P_revious Window"),
1961                  N_("Switch to the previous document window"), "window_previous"),
1962     new FileVerb(SP_VERB_FILE_CLOSE_VIEW, "FileClose", N_("_Close"),
1963                  N_("Close this document window"), GTK_STOCK_CLOSE),
1964     new FileVerb(SP_VERB_FILE_QUIT, "FileQuit", N_("_Quit"), N_("Quit Inkscape"), GTK_STOCK_QUIT),
1966     /* Edit */
1967     new EditVerb(SP_VERB_EDIT_UNDO, "EditUndo", N_("_Undo"), N_("Undo last action"),
1968                  GTK_STOCK_UNDO),
1969     new EditVerb(SP_VERB_EDIT_REDO, "EditRedo", N_("_Redo"),
1970                  N_("Do again the last undone action"), GTK_STOCK_REDO),
1971     new EditVerb(SP_VERB_EDIT_CUT, "EditCut", N_("Cu_t"),
1972                  N_("Cut selection to clipboard"), GTK_STOCK_CUT),
1973     new EditVerb(SP_VERB_EDIT_COPY, "EditCopy", N_("_Copy"),
1974                  N_("Copy selection to clipboard"), GTK_STOCK_COPY),
1975     new EditVerb(SP_VERB_EDIT_PASTE, "EditPaste", N_("_Paste"),
1976                  N_("Paste objects from clipboard to mouse point, or paste text"), GTK_STOCK_PASTE),
1977     new EditVerb(SP_VERB_EDIT_PASTE_STYLE, "EditPasteStyle", N_("Paste _Style"),
1978                  N_("Apply the style of the copied object to selection"), "selection_paste_style"),
1979     new EditVerb(SP_VERB_EDIT_PASTE_SIZE, "EditPasteSize", N_("Paste Si_ze"),
1980                  N_("Scale selection to match the size of the copied object"), NULL),
1981     new EditVerb(SP_VERB_EDIT_PASTE_SIZE_X, "EditPasteWidth", N_("Paste _Width"),
1982                  N_("Scale selection horizontally to match the width of the copied object"), NULL),
1983     new EditVerb(SP_VERB_EDIT_PASTE_SIZE_Y, "EditPasteHeight", N_("Paste _Height"),
1984                  N_("Scale selection vertically to match the height of the copied object"), NULL),
1985     new EditVerb(SP_VERB_EDIT_PASTE_SIZE_SEPARATELY, "EditPasteSizeSeparately", N_("Paste Size Separately"),
1986                  N_("Scale each selected object to match the size of the copied object"), NULL),
1987     new EditVerb(SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_X, "EditPasteWidthSeparately", N_("Paste Width Separately"),
1988                  N_("Scale each selected object horizontally to match the width of the copied object"), NULL),
1989     new EditVerb(SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_Y, "EditPasteHeightSeparately", N_("Paste Height Separately"),
1990                  N_("Scale each selected object vertically to match the height of the copied object"), NULL),
1991     new EditVerb(SP_VERB_EDIT_PASTE_IN_PLACE, "EditPasteInPlace", N_("Paste _In Place"),
1992                  N_("Paste objects from clipboard to the original location"), "selection_paste_in_place"),
1993     new EditVerb(SP_VERB_EDIT_DELETE, "EditDelete", N_("_Delete"),
1994                  N_("Delete selection"), GTK_STOCK_DELETE),
1995     new EditVerb(SP_VERB_EDIT_DUPLICATE, "EditDuplicate", N_("Duplic_ate"),
1996                  N_("Duplicate selected objects"), "edit_duplicate"),
1997     new EditVerb(SP_VERB_EDIT_CLONE, "EditClone", N_("Create Clo_ne"),
1998                  N_("Create a clone (a copy linked to the original) of selected object"), "edit_clone"),
1999     new EditVerb(SP_VERB_EDIT_UNLINK_CLONE, "EditUnlinkClone", N_("Unlin_k Clone"),
2000                  N_("Cut the selected clone's link to its original, turning it into a standalone object"), "edit_unlink_clone"),
2001     new EditVerb(SP_VERB_EDIT_CLONE_ORIGINAL, "EditCloneOriginal", N_("Select _Original"),
2002                  N_("Select the object to which the selected clone is linked"), NULL),
2003     // TRANSLATORS: Convert selection to a rectangle with tiled pattern fill
2004     new EditVerb(SP_VERB_EDIT_TILE, "ObjectsToPattern", N_("Objects to Patter_n"),
2005                  N_("Convert selection to a rectangle with tiled pattern fill"), NULL),
2006     // TRANSLATORS: Extract objects from a tiled pattern fill
2007     new EditVerb(SP_VERB_EDIT_UNTILE, "ObjectsFromPattern", N_("Pattern to _Objects"),
2008                  N_("Extract objects from a tiled pattern fill"), NULL),
2009     new EditVerb(SP_VERB_EDIT_CLEAR_ALL, "EditClearAll", N_("Clea_r All"),
2010                  N_("Delete all objects from document"), NULL),
2011     new EditVerb(SP_VERB_EDIT_SELECT_ALL, "EditSelectAll", N_("Select Al_l"),
2012                  N_("Select all objects or all nodes"), "selection_select_all"),
2013     new EditVerb(SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS, "EditSelectAllInAllLayers", N_("Select All in All La_yers"),
2014                  N_("Select all objects in all visible and unlocked layers"), NULL),
2015     new EditVerb(SP_VERB_EDIT_INVERT, "EditInvert", N_("In_vert Selection"),
2016                  N_("Invert selection (unselect what is selected and select everything else)"), NULL),
2017     new EditVerb(SP_VERB_EDIT_INVERT_IN_ALL_LAYERS, "EditInvertInAllLayers", N_("Invert in All Layers"),
2018                  N_("Invert selection in all visible and unlocked layers"), NULL),
2019     new EditVerb(SP_VERB_EDIT_DESELECT, "EditDeselect", N_("D_eselect"),
2020                  N_("Deselect any selected objects or nodes"), NULL),
2022     /* Selection */
2023     new SelectionVerb(SP_VERB_SELECTION_TO_FRONT, "SelectionToFront", N_("Raise to _Top"),
2024                       N_("Raise selection to top"), "selection_top"),
2025     new SelectionVerb(SP_VERB_SELECTION_TO_BACK, "SelectionToBack", N_("Lower to _Bottom"),
2026                       N_("Lower selection to bottom"), "selection_bot"),
2027     new SelectionVerb(SP_VERB_SELECTION_RAISE, "SelectionRaise", N_("_Raise"),
2028                       N_("Raise selection one step"), "selection_up"),
2029     new SelectionVerb(SP_VERB_SELECTION_LOWER, "SelectionLower", N_("_Lower"),
2030                       N_("Lower selection one step"), "selection_down"),
2031     new SelectionVerb(SP_VERB_SELECTION_GROUP, "SelectionGroup", N_("_Group"),
2032                       N_("Group selected objects"), "selection_group"),
2033     new SelectionVerb(SP_VERB_SELECTION_UNGROUP, "SelectionUnGroup", N_("_Ungroup"),
2034                       N_("Ungroup selected groups"), "selection_ungroup"),
2036     new SelectionVerb(SP_VERB_SELECTION_TEXTTOPATH, "SelectionTextToPath", N_("_Put on Path"),
2037                       N_("Put text on path"), NULL),
2038     new SelectionVerb(SP_VERB_SELECTION_TEXTFROMPATH, "SelectionTextFromPath", N_("_Remove from Path"),
2039                       N_("Remove text from path"), NULL),
2040     new SelectionVerb(SP_VERB_SELECTION_REMOVE_KERNS, "SelectionTextRemoveKerns", N_("Remove Manual _Kerns"),
2041                       // TRANSLATORS: "glyph": An image used in the visual representation of characters;
2042                       //  roughly speaking, how a character looks. A font is a set of glyphs.
2043                       N_("Remove all manual kerns and glyph rotations from a text object"), NULL),
2045     new SelectionVerb(SP_VERB_SELECTION_UNION, "SelectionUnion", N_("_Union"),
2046                       N_("Create union of selected paths"), "union"),
2047     new SelectionVerb(SP_VERB_SELECTION_INTERSECT, "SelectionIntersect", N_("_Intersection"),
2048                       N_("Create intersection of selected paths"), "intersection"),
2049     new SelectionVerb(SP_VERB_SELECTION_DIFF, "SelectionDiff", N_("_Difference"),
2050                       N_("Create difference of selected paths (bottom minus top)"), "difference"),
2051     new SelectionVerb(SP_VERB_SELECTION_SYMDIFF, "SelectionSymDiff", N_("E_xclusion"),
2052                       N_("Create exclusive OR of selected paths (those parts that belong to only one path)"), "exclusion"),
2053     new SelectionVerb(SP_VERB_SELECTION_CUT, "SelectionDivide", N_("Di_vision"),
2054                       N_("Cut the bottom path into pieces"), "division"),
2055     // TRANSLATORS: "to cut a path" is not the same as "to break a path apart" - see the
2056     // Advanced tutorial for more info
2057     new SelectionVerb(SP_VERB_SELECTION_SLICE, "SelectionCutPath", N_("Cut _Path"),
2058                       N_("Cut the bottom path's stroke into pieces, removing fill"), "cut_path"),
2059     // TRANSLATORS: "outset": expand a shape by offsetting the object's path,
2060     // i.e. by displacing it perpendicular to the path in each point.
2061     // See also the Advanced Tutorial for explanation.
2062     new SelectionVerb(SP_VERB_SELECTION_OFFSET, "SelectionOffset", N_("Outs_et"),
2063                       N_("Outset selected paths"), "outset_path"),
2064     new SelectionVerb(SP_VERB_SELECTION_OFFSET_SCREEN, "SelectionOffsetScreen",
2065                       N_("O_utset Path by 1 px"),
2066                       N_("Outset selected paths by 1 px"), NULL),
2067     new SelectionVerb(SP_VERB_SELECTION_OFFSET_SCREEN_10, "SelectionOffsetScreen10",
2068                       N_("O_utset Path by 10 px"),
2069                       N_("Outset selected paths by 10 px"), NULL),
2070     // TRANSLATORS: "inset": contract a shape by offsetting the object's path,
2071     // i.e. by displacing it perpendicular to the path in each point.
2072     // See also the Advanced Tutorial for explanation.
2073     new SelectionVerb(SP_VERB_SELECTION_INSET, "SelectionInset", N_("I_nset"),
2074                       N_("Inset selected paths"), "inset_path"),
2075     new SelectionVerb(SP_VERB_SELECTION_INSET_SCREEN, "SelectionInsetScreen",
2076                       N_("I_nset Path by 1 px"),
2077                       N_("Inset selected paths by 1 px"), NULL),
2078     new SelectionVerb(SP_VERB_SELECTION_INSET_SCREEN_10, "SelectionInsetScreen10",
2079                       N_("I_nset Path by 10 px"),
2080                       N_("Inset selected paths by 10 px"), NULL),
2081     new SelectionVerb(SP_VERB_SELECTION_DYNAMIC_OFFSET, "SelectionDynOffset",
2082                       N_("D_ynamic Offset"), N_("Create a dynamic offset object"), "dynamic_offset"),
2083     new SelectionVerb(SP_VERB_SELECTION_LINKED_OFFSET, "SelectionLinkedOffset",
2084                       N_("_Linked Offset"),
2085                       N_("Create a dynamic offset object linked to the original path"),
2086                       "linked_offset"),
2087     new SelectionVerb(SP_VERB_SELECTION_OUTLINE, "StrokeToPath", N_("_Stroke to Path"),
2088                       N_("Convert selected object's stroke to paths"), "stroke_tocurve"),
2089     new SelectionVerb(SP_VERB_SELECTION_SIMPLIFY, "SelectionSimplify", N_("Si_mplify"),
2090                       N_("Simplify selected paths (remove extra nodes)"), "simplify"),
2091     new SelectionVerb(SP_VERB_SELECTION_REVERSE, "SelectionReverse", N_("_Reverse"),
2092                       N_("Reverse the direction of selected paths (useful for flipping markers)"), "selection_reverse"),
2093     // TRANSLATORS: "to trace" means "to convert a bitmap to vector graphics" (to vectorize)
2094     new SelectionVerb(SP_VERB_SELECTION_TRACE, "SelectionTrace", N_("_Trace Bitmap..."),
2095                       N_("Create one or more paths from a bitmap by tracing it"), "selection_trace"),
2096     new SelectionVerb(SP_VERB_SELECTION_CREATE_BITMAP, "SelectionCreateBitmap", N_("_Make a Bitmap Copy"),
2097                       N_("Export selection to a bitmap and insert it into document"), "selection_bitmap" ),
2098     new SelectionVerb(SP_VERB_SELECTION_COMBINE, "SelectionCombine", N_("_Combine"),
2099                       N_("Combine several paths into one"), "selection_combine"),
2100     // TRANSLATORS: "to cut a path" is not the same as "to break a path apart" - see the
2101     // Advanced tutorial for more info
2102     new SelectionVerb(SP_VERB_SELECTION_BREAK_APART, "SelectionBreakApart", N_("Break _Apart"),
2103                       N_("Break selected paths into subpaths"), "selection_break"),
2104     new SelectionVerb(SP_VERB_SELECTION_GRIDTILE, "DialogGridArrange", N_("Gri_d Arrange..."),
2105                       N_("Arrange selected objects in a grid pattern"), "grid_arrange"),
2106     /* Layer */
2107     new LayerVerb(SP_VERB_LAYER_NEW, "LayerNew", N_("_Add Layer..."),
2108                   N_("Create a new layer"), "new_layer"),
2109     new LayerVerb(SP_VERB_LAYER_RENAME, "LayerRename", N_("Re_name Layer..."),
2110                   N_("Rename the current layer"), "rename_layer"),
2111     new LayerVerb(SP_VERB_LAYER_NEXT, "LayerNext", N_("Switch to Layer Abov_e"),
2112                   N_("Switch to the layer above the current"), "switch_to_layer_above"),
2113     new LayerVerb(SP_VERB_LAYER_PREV, "LayerPrev", N_("Switch to Layer Belo_w"),
2114                   N_("Switch to the layer below the current"), "switch_to_layer_below"),
2115     new LayerVerb(SP_VERB_LAYER_MOVE_TO_NEXT, "LayerMoveToNext", N_("Move Selection to Layer Abo_ve"),
2116                   N_("Move selection to the layer above the current"), "move_selection_above"),
2117     new LayerVerb(SP_VERB_LAYER_MOVE_TO_PREV, "LayerMoveToPrev", N_("Move Selection to Layer Bel_ow"),
2118                   N_("Move selection to the layer below the current"), "move_selection_below"),
2119     new LayerVerb(SP_VERB_LAYER_TO_TOP, "LayerToTop", N_("Layer to _Top"),
2120                   N_("Raise the current layer to the top"), "layer_to_top"),
2121     new LayerVerb(SP_VERB_LAYER_TO_BOTTOM, "LayerToBottom", N_("Layer to _Bottom"),
2122                   N_("Lower the current layer to the bottom"), "layer_to_bottom"),
2123     new LayerVerb(SP_VERB_LAYER_RAISE, "LayerRaise", N_("_Raise Layer"),
2124                   N_("Raise the current layer"), "raise_layer"),
2125     new LayerVerb(SP_VERB_LAYER_LOWER, "LayerLower", N_("_Lower Layer"),
2126                   N_("Lower the current layer"), "lower_layer"),
2127     new LayerVerb(SP_VERB_LAYER_DELETE, "LayerDelete", N_("_Delete Current Layer"),
2128                   N_("Delete the current layer"), "delete_layer"),
2130     /* Object */
2131     new ObjectVerb(SP_VERB_OBJECT_ROTATE_90_CW, "ObjectRotate90", N_("Rotate _90&#176; CW"),
2132                    N_("Rotate selection 90&#176; clockwise"), "object_rotate_90_CW"),
2133     new ObjectVerb(SP_VERB_OBJECT_ROTATE_90_CCW, "ObjectRotate90CCW", N_("Rotate 9_0&#176; CCW"),
2134                    N_("Rotate selection 90&#176; counter-clockwise"), "object_rotate_90_CCW"),
2135     new ObjectVerb(SP_VERB_OBJECT_FLATTEN, "ObjectRemoveTransform", N_("Remove _Transformations"),
2136                    N_("Remove transformations from object"), "object_reset"),
2137     new ObjectVerb(SP_VERB_OBJECT_TO_CURVE, "ObjectToPath", N_("_Object to Path"),
2138                    N_("Convert selected object to path"), "object_tocurve"),
2139     new ObjectVerb(SP_VERB_OBJECT_FLOW_TEXT, "ObjectFlowText", N_("_Flow into Frame"),
2140                    N_("Put text into a frame (path or shape), creating a flowed text linked to the frame object"), NULL),
2141     new ObjectVerb(SP_VERB_OBJECT_UNFLOW_TEXT, "ObjectUnFlowText", N_("_Unflow"),
2142                    N_("Remove text from frame (creates a single-line text object)"), NULL),
2143     new ObjectVerb(SP_VERB_OBJECT_FLOWTEXT_TO_TEXT, "ObjectFlowtextToText", N_("_Convert to Text"),
2144                    N_("Convert flowed text to regular text object (preserves appearance)"), NULL),
2145     new ObjectVerb(SP_VERB_OBJECT_FLIP_HORIZONTAL, "ObjectFlipHorizontally",
2146                    N_("Flip _Horizontal"), N_("Flip selected objects horizontally"),
2147                    "object_flip_hor"),
2148     new ObjectVerb(SP_VERB_OBJECT_FLIP_VERTICAL, "ObjectFlipVertically",
2149                    N_("Flip _Vertical"), N_("Flip selected objects vertically"),
2150                    "object_flip_ver"),
2151     new ObjectVerb(SP_VERB_OBJECT_SET_MASK, "ObjectSetMask", N_("_Set"),
2152                  N_("Apply mask to selection (using the topmost object as mask)"), NULL),
2153     new ObjectVerb(SP_VERB_OBJECT_UNSET_MASK, "ObjectUnSetMask", N_("_Release"),
2154                  N_("Remove mask from selection"), NULL),
2155     new ObjectVerb(SP_VERB_OBJECT_SET_CLIPPATH, "ObjectSetClipPath", N_("_Set"),
2156                  N_("Apply clipping path to selection (using the topmost object as clipping path)"), NULL),
2157     new ObjectVerb(SP_VERB_OBJECT_UNSET_CLIPPATH, "ObjectUnSetClipPath", N_("_Release"),
2158                  N_("Remove clipping path from selection"), NULL),
2160     /* Tools */
2161     new ContextVerb(SP_VERB_CONTEXT_SELECT, "ToolSelector", N_("Select"),
2162                     N_("Select and transform objects"), "draw_select"),
2163     new ContextVerb(SP_VERB_CONTEXT_NODE, "ToolNode", N_("Node Edit"),
2164                     N_("Edit path nodes or control handles"), "draw_node"),
2165     new ContextVerb(SP_VERB_CONTEXT_RECT, "ToolRect", N_("Rectangle"),
2166                     N_("Create rectangles and squares"), "draw_rect"),
2167     new ContextVerb(SP_VERB_CONTEXT_ARC, "ToolArc", N_("Ellipse"),
2168                     N_("Create circles, ellipses, and arcs"), "draw_arc"),
2169     new ContextVerb(SP_VERB_CONTEXT_STAR, "ToolStar", N_("Star"),
2170                     N_("Create stars and polygons"), "draw_star"),
2171     new ContextVerb(SP_VERB_CONTEXT_SPIRAL, "ToolSpiral", N_("Spiral"),
2172                     N_("Create spirals"), "draw_spiral"),
2173     new ContextVerb(SP_VERB_CONTEXT_PENCIL, "ToolPencil", N_("Pencil"),
2174                     N_("Draw freehand lines"), "draw_freehand"),
2175     new ContextVerb(SP_VERB_CONTEXT_PEN, "ToolPen", N_("Pen"),
2176                     N_("Draw Bezier curves and straight lines"), "draw_pen"),
2177     new ContextVerb(SP_VERB_CONTEXT_CALLIGRAPHIC, "ToolCalligrphic", N_("Calligraphy"),
2178                     N_("Draw calligraphic lines"), "draw_calligraphic"),
2179     new ContextVerb(SP_VERB_CONTEXT_TEXT, "ToolText", N_("Text"),
2180                     N_("Create and edit text objects"), "draw_text"),
2181     new ContextVerb(SP_VERB_CONTEXT_GRADIENT, "ToolGradient", N_("Gradient"),
2182                     N_("Create and edit gradients"), "draw_gradient"),
2183     new ContextVerb(SP_VERB_CONTEXT_ZOOM, "ToolZoom", N_("Zoom"),
2184                     N_("Zoom in or out"), "draw_zoom"),
2185     new ContextVerb(SP_VERB_CONTEXT_DROPPER, "ToolDropper", N_("Dropper"),
2186                     N_("Pick averaged colors from image"), "draw_dropper"),
2187     new ContextVerb(SP_VERB_CONTEXT_CONNECTOR, "ToolConnector", N_("Connector"),
2188                     N_("Create connectors"), "draw_connector"),
2190     /* Tool prefs */
2191     new ContextVerb(SP_VERB_CONTEXT_SELECT_PREFS, "SelectPrefs", N_("Selector Preferences"),
2192                     N_("Open Preferences for the Selector tool"), NULL),
2193     new ContextVerb(SP_VERB_CONTEXT_NODE_PREFS, "NodePrefs", N_("Node Tool Preferences"),
2194                     N_("Open Preferences for the Node tool"), NULL),
2195     new ContextVerb(SP_VERB_CONTEXT_RECT_PREFS, "RectPrefs", N_("Rectangle Preferences"),
2196                     N_("Open Preferences for the Rectangle tool"), NULL),
2197     new ContextVerb(SP_VERB_CONTEXT_ARC_PREFS, "ArcPrefs", N_("Ellipse Preferences"),
2198                     N_("Open Preferences for the Ellipse tool"), NULL),
2199     new ContextVerb(SP_VERB_CONTEXT_STAR_PREFS, "StarPrefs", N_("Star Preferences"),
2200                     N_("Open Preferences for the Star tool"), NULL),
2201     new ContextVerb(SP_VERB_CONTEXT_SPIRAL_PREFS, "SpiralPrefs", N_("Spiral Preferences"),
2202                     N_("Open Preferences for the Spiral tool"), NULL),
2203     new ContextVerb(SP_VERB_CONTEXT_PENCIL_PREFS, "PencilPrefs", N_("Pencil Preferences"),
2204                     N_("Open Preferences for the Pencil tool"), NULL),
2205     new ContextVerb(SP_VERB_CONTEXT_PEN_PREFS, "PenPrefs", N_("Pen Preferences"),
2206                     N_("Open Preferences for the Pen tool"), NULL),
2207     new ContextVerb(SP_VERB_CONTEXT_CALLIGRAPHIC_PREFS, "CalligraphicPrefs", N_("Calligraphic Preferences"),
2208                     N_("Open Preferences for the Calligraphy tool"), NULL),
2209     new ContextVerb(SP_VERB_CONTEXT_TEXT_PREFS, "TextPrefs", N_("Text Preferences"),
2210                     N_("Open Preferences for the Text tool"), NULL),
2211     new ContextVerb(SP_VERB_CONTEXT_GRADIENT_PREFS, "GradientPrefs", N_("Gradient Preferences"),
2212                     N_("Open Preferences for the Gradient tool"), NULL),
2213     new ContextVerb(SP_VERB_CONTEXT_ZOOM_PREFS, "ZoomPrefs", N_("Zoom Preferences"),
2214                     N_("Open Preferences for the Zoom tool"), NULL),
2215     new ContextVerb(SP_VERB_CONTEXT_DROPPER_PREFS, "DropperPrefs", N_("Dropper Preferences"),
2216                     N_("Open Preferences for the Dropper tool"), NULL),
2217     new ContextVerb(SP_VERB_CONTEXT_CONNECTOR_PREFS, "ConnectorPrefs", N_("Connector Preferences"),
2218                     N_("Open Preferences for the Connector tool"), NULL),
2220     /* Zoom/View */
2221     new ZoomVerb(SP_VERB_ZOOM_IN, "ZoomIn", N_("Zoom In"), N_("Zoom in"), "zoom_in"),
2222     new ZoomVerb(SP_VERB_ZOOM_OUT, "ZoomOut", N_("Zoom Out"), N_("Zoom out"), "zoom_out"),
2223     new ZoomVerb(SP_VERB_TOGGLE_RULERS, "ToggleRulers", N_("_Rulers"), N_("Show or hide the canvas rulers"), "rulers"),
2224     new ZoomVerb(SP_VERB_TOGGLE_SCROLLBARS, "ToggleScrollbars", N_("Scroll_bars"), N_("Show or hide the canvas scrollbars"), "scrollbars"),
2225     new ZoomVerb(SP_VERB_TOGGLE_GRID, "ToggleGrid", N_("_Grid"), N_("Show or hide the grid"), "grid"),
2226     new ZoomVerb(SP_VERB_TOGGLE_GUIDES, "ToggleGuides", N_("G_uides"), N_("Show or hide guides (drag from a ruler to create a guide)"), "guides"),
2227     new ZoomVerb(SP_VERB_ZOOM_NEXT, "ZoomNext", N_("Nex_t Zoom"), N_("Next zoom (from the history of zooms)"),
2228                  "zoom_next"),
2229     new ZoomVerb(SP_VERB_ZOOM_PREV, "ZoomPrev", N_("Pre_vious Zoom"), N_("Previous zoom (from the history of zooms)"),
2230                  "zoom_previous"),
2231     new ZoomVerb(SP_VERB_ZOOM_1_1, "Zoom1:0", N_("Zoom 1:_1"), N_("Zoom to 1:1"),
2232                  "zoom_1_to_1"),
2233     new ZoomVerb(SP_VERB_ZOOM_1_2, "Zoom1:2", N_("Zoom 1:_2"), N_("Zoom to 1:2"),
2234                  "zoom_1_to_2"),
2235     new ZoomVerb(SP_VERB_ZOOM_2_1, "Zoom2:1", N_("_Zoom 2:1"), N_("Zoom to 2:1"),
2236                  "zoom_2_to_1"),
2237 #ifdef HAVE_GTK_WINDOW_FULLSCREEN
2238     new ZoomVerb(SP_VERB_FULLSCREEN, "FullScreen", N_("_Fullscreen"), N_("Stretch this document window to full screen"),
2239                  "fullscreen"),
2240 #endif /* HAVE_GTK_WINDOW_FULLSCREEN */
2241     new ZoomVerb(SP_VERB_VIEW_NEW, "ViewNew", N_("Duplic_ate Window"), N_("Open a new window with the same document"),
2242                  "view_new"),
2243     new ZoomVerb(SP_VERB_VIEW_NEW_PREVIEW, "ViewNewPreview", N_("_New View Preview"),
2244                  N_("New View Preview"), NULL/*"view_new_preview"*/),
2246     new ZoomVerb(SP_VERB_VIEW_MODE_NORMAL, "ViewModeNormal", N_("_Normal"),
2247                  N_("Switch to normal display mode"), NULL),
2248     new ZoomVerb(SP_VERB_VIEW_MODE_OUTLINE, "ViewModeOutline", N_("_Outline"),
2249                  N_("Switch to outline (wireframe) display mode"), NULL),
2251     new ZoomVerb(SP_VERB_VIEW_ICON_PREVIEW, "ViewIconPreview", N_("Ico_n Preview"),
2252                  N_("Open a window to preview objects at different icon resolutions"), NULL/*"view_icon_preview"*/),
2253     new ZoomVerb(SP_VERB_ZOOM_PAGE, "ZoomPage", N_("_Page"),
2254                  N_("Zoom to fit page in window"), "zoom_page"),
2255     new ZoomVerb(SP_VERB_ZOOM_PAGE_WIDTH, "ZoomPageWidth", N_("Page _Width"),
2256                  N_("Zoom to fit page width in window"), "zoom_pagewidth"),
2257     new ZoomVerb(SP_VERB_ZOOM_DRAWING, "ZoomDrawing", N_("_Drawing"),
2258                  N_("Zoom to fit drawing in window"), "zoom_draw"),
2259     new ZoomVerb(SP_VERB_ZOOM_SELECTION, "ZoomSelection", N_("_Selection"),
2260                  N_("Zoom to fit selection in window"), "zoom_select"),
2262     /* Dialogs */
2263     new DialogVerb(SP_VERB_DIALOG_DISPLAY, "DialogPreferences", N_("In_kscape Preferences..."),
2264                    N_("Edit global Inkscape preferences"), GTK_STOCK_PREFERENCES ),
2265     new DialogVerb(SP_VERB_DIALOG_NAMEDVIEW, "DialogDocumentProperties", N_("_Document Properties..."),
2266                    N_("Edit properties of this document (to be saved with the document)"), GTK_STOCK_PROPERTIES ),
2267     new DialogVerb(SP_VERB_DIALOG_METADATA, "DialogMetadata", N_("_Document Metadata..."),
2268                    N_("Edit document metadata (to be saved with the document)"), NULL ),
2269     new DialogVerb(SP_VERB_DIALOG_FILL_STROKE, "DialogFillStroke", N_("_Fill and Stroke..."),
2270                    N_("Edit objects' style, such as color or stroke width"), "fill_and_stroke"),
2271     // TRANSLATORS: "Swatches" means: color samples
2272     new DialogVerb(SP_VERB_DIALOG_SWATCHES, "DialogSwatches", N_("S_watches..."),
2273                    N_("Select colors from a swatches palette"), GTK_STOCK_SELECT_COLOR),
2274     new DialogVerb(SP_VERB_DIALOG_TRANSFORM, "DialogTransform", N_("Transfor_m..."),
2275                    N_("Precisely control objects' transformations"), "object_trans"),
2276     new DialogVerb(SP_VERB_DIALOG_ALIGN_DISTRIBUTE, "DialogAlignDistribute", N_("_Align and Distribute..."),
2277                    N_("Align and distribute objects"), "object_align"),
2278     new DialogVerb(SP_VERB_DIALOG_TEXT, "DialogText", N_("_Text and Font..."),
2279                    N_("View and select font family, font size and other text properties"), "object_font"),
2280     new DialogVerb(SP_VERB_DIALOG_XML_EDITOR, "DialogXMLEditor", N_("_XML Editor..."),
2281                    N_("View and edit the XML tree of the document"), "xml_editor"),
2282     new DialogVerb(SP_VERB_DIALOG_FIND, "DialogFind", N_("_Find..."),
2283                    N_("Find objects in document"), GTK_STOCK_FIND ),
2284     new DialogVerb(SP_VERB_DIALOG_DEBUG, "DialogDebug", N_("_Messages..."),
2285                    N_("View debug messages"), NULL),
2286     new DialogVerb(SP_VERB_DIALOG_SCRIPT, "DialogScript", N_("S_cripts..."),
2287                    N_("Run scripts"), NULL),
2288     new DialogVerb(SP_VERB_DIALOG_TOGGLE, "DialogsToggle", N_("Show/Hide D_ialogs"),
2289                    N_("Show or hide all open dialogs"), "dialog_toggle"),
2290     // TRANSLATORS: "Tile Clones" means: "Create tiled clones"
2291     new DialogVerb(SP_VERB_DIALOG_CLONETILER, "DialogClonetiler", N_("Create Tiled Clones..."),
2292                    N_("Create multiple clones of selected object, arranging them into a pattern or scattering"), NULL),
2293     new DialogVerb(SP_VERB_DIALOG_ITEM, "DialogObjectProperties", N_("_Object Properties..."),
2294                    N_("Edit the ID, locked and visible status, and other object properties"), "dialog_item_properties"),
2295 #ifdef WITH_INKBOARD
2296     new DialogVerb(SP_VERB_DIALOG_WHITEBOARD_CONNECT, "DialogWhiteboardConnect",
2297                    N_("_Connect to Jabber server..."), N_("Connect to a Jabber server"), NULL),
2298     new DialogVerb(SP_VERB_DIALOG_WHITEBOARD_SHAREWITHUSER, "DialogWhiteboardShareWithUser",
2299                    N_("Share with _user..."), N_("Establish a whiteboard session with another Jabber user"), NULL),
2300     new DialogVerb(SP_VERB_DIALOG_WHITEBOARD_SHAREWITHCHAT, "DialogWhiteboardShareWithChat",
2301                    N_("Share with _chatroom..."), N_("Join a chatroom to start a new whiteboard session or join one in progress"), NULL),
2302     new DialogVerb(SP_VERB_DIALOG_WHITEBOARD_DUMPXMLTRACKER, "DialogWhiteboardDumpXMLTracker",
2303                    N_("_Dump XML node tracker"), N_("Dump the contents of the XML tracker to the console"), NULL),
2304     new DialogVerb(SP_VERB_DIALOG_WHITEBOARD_OPENSESSIONFILE, "DialogWhiteboardOpenSessionFile",
2305                    N_("_Open session file..."), N_("Open and browse through records of past whiteboard sessions"), NULL),
2306     new DialogVerb(SP_VERB_DIALOG_WHITEBOARD_SESSIONPLAYBACK, "DialogWhiteboardSessionPlayback",
2307                    N_("Session file playback"), "", NULL),
2308     new DialogVerb(SP_VERB_DIALOG_WHITEBOARD_DISCONNECT_FROM_SESSION, "DialogWhiteboardDisconnectSession",
2309                    N_("_Disconnect from session"), "", NULL),
2310     new DialogVerb(SP_VERB_DIALOG_WHITEBOARD_DISCONNECT_FROM_SERVER, "DialogWhiteboardDisconnectServer",
2311                    N_("Disconnect from _server"), "", NULL),
2312 #endif
2313     new DialogVerb(SP_VERB_DIALOG_INPUT, "DialogInput", N_("_Input Devices..."),
2314                    N_("Configure extended input devices, such as a graphics tablet"), NULL),
2315     new DialogVerb(SP_VERB_DIALOG_EXTENSIONEDITOR, "org.inkscape.dialogs.extensioneditor", N_("_Extensions..."),
2316                    N_("Query information about extensions"), NULL),
2317     new DialogVerb(SP_VERB_DIALOG_LAYERS, "DialogLayers", N_("_Layers..."),
2318                    N_("View Layers"), NULL),
2320     /* Help */
2321     new HelpVerb(SP_VERB_HELP_KEYS, "HelpKeys", N_("_Keys and Mouse"),
2322                  N_("Keys and mouse shortcuts reference"), "help_keys"),
2323     new HelpVerb(SP_VERB_HELP_ABOUT_EXTENSIONS, "HelpAboutExtensions", N_("About E_xtensions"),
2324                  N_("Information on Inkscape extensions"), NULL),
2325     new HelpVerb(SP_VERB_HELP_MEMORY, "HelpAboutMemory", N_("About _Memory"),
2326                  N_("Memory usage information"), NULL),
2327     new HelpVerb(SP_VERB_HELP_ABOUT, "HelpAbout", N_("_About Inkscape"),
2328                  N_("Inkscape version, authors, license"), /*"help_about"*/"inkscape_options"),
2329     //new HelpVerb(SP_VERB_SHOW_LICENSE, "ShowLicense", N_("_License"),
2330     //           N_("Distribution terms"), /*"show_license"*/"inkscape_options"),
2332     /* Tutorials */
2333     new TutorialVerb(SP_VERB_TUTORIAL_BASIC, "TutorialsBasic", N_("Inkscape: _Basic"),
2334                      N_("Getting started with Inkscape"), NULL/*"tutorial_basic"*/),
2335     new TutorialVerb(SP_VERB_TUTORIAL_SHAPES, "TutorialsShapes", N_("Inkscape: _Shapes"),
2336                      N_("Using shape tools to create and edit shapes"), NULL),
2337     new TutorialVerb(SP_VERB_TUTORIAL_ADVANCED, "TutorialsAdvanced", N_("Inkscape: _Advanced"),
2338                      N_("Advanced Inkscape topics"), NULL/*"tutorial_advanced"*/),
2339     // TRANSLATORS: "to trace" means "to convert a bitmap to vector graphics" (to vectorize)
2340     new TutorialVerb(SP_VERB_TUTORIAL_TRACING, "TutorialsTracing", N_("Inkscape: T_racing"),
2341                      N_("Using bitmap tracing"), NULL/*"tutorial_tracing"*/),
2342     new TutorialVerb(SP_VERB_TUTORIAL_CALLIGRAPHY, "TutorialsCalligraphy", N_("Inkscape: _Calligraphy"),
2343                      N_("Using the Calligraphy pen tool"), NULL),
2344     new TutorialVerb(SP_VERB_TUTORIAL_DESIGN, "TutorialsDesign", N_("_Elements of Design"),
2345                      N_("Principles of design in the tutorial form"), NULL/*"tutorial_design"*/),
2346     new TutorialVerb(SP_VERB_TUTORIAL_TIPS, "TutorialsTips", N_("_Tips and Tricks"),
2347                      N_("Miscellaneous tips and tricks"), NULL/*"tutorial_tips"*/),
2349     /* Effect */
2350     new EffectLastVerb(SP_VERB_EFFECT_LAST, "EffectLast", N_("Previous Effect"),
2351                        N_("Repeat the last effect with the same settings"), NULL/*"tutorial_tips"*/),
2352     new EffectLastVerb(SP_VERB_EFFECT_LAST_PREF, "EffectLastPref", N_("Previous Effect Settings..."),
2353                        N_("Repeat the last effect with new settings"), NULL/*"tutorial_tips"*/),
2355     /* Fit Canvas */
2356     new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_SELECTION, "FitCanvasToSelection", N_("Fit Canvas to Selection"),
2357                        N_("Fit the canvas to the current selection"), NULL),
2358     new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_DRAWING, "FitCanvasToDrawing", N_("Fit Canvas to Drawing"),
2359                        N_("Fit the canvas to the drawing"), NULL),
2360     new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING, "FitCanvasToSelectionOrDrawing", N_("Fit Canvas to Selection or Drawing"),
2361                        N_("Fit the canvas to the current selection or the drawing if there is no selection"), NULL),
2362     
2363     /* Footer */
2364     new Verb(SP_VERB_LAST, " '\"invalid id", NULL, NULL, NULL)
2365 };
2368 }  /* namespace Inkscape */
2370 /*
2371   Local Variables:
2372   mode:c++
2373   c-file-style:"stroustrup"
2374   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
2375   indent-tabs-mode:nil
2376   fill-column:99
2377   End:
2378 */
2379 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :