Code

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