Code

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