Code

removed leftover debug messages. Toggling new grids now works. Almost ready to commen...
[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             dt->toggleGrid();
1556             break;
1557 #ifdef HAVE_GTK_WINDOW_FULLSCREEN
1558         case SP_VERB_FULLSCREEN:
1559             dt->fullscreen();
1560             break;
1561 #endif /* HAVE_GTK_WINDOW_FULLSCREEN */
1562         case SP_VERB_VIEW_NEW:
1563             sp_ui_new_view();
1564             break;
1565         case SP_VERB_VIEW_NEW_PREVIEW:
1566             sp_ui_new_view_preview();
1567             break;
1568         case SP_VERB_VIEW_MODE_NORMAL:
1569             dt->setDisplayModeNormal();
1570             break;
1571         case SP_VERB_VIEW_MODE_OUTLINE:
1572             dt->setDisplayModeOutline();
1573             break;
1574         case SP_VERB_VIEW_MODE_TOGGLE:
1575             dt->displayModeToggle();
1576             break;
1577         case SP_VERB_VIEW_ICON_PREVIEW:
1578             show_panel( Inkscape::UI::Dialogs::IconPreviewPanel::getInstance(), "dialogs.iconpreview", SP_VERB_VIEW_ICON_PREVIEW );
1579             break;
1580         default:
1581             break;
1582     }
1583     
1584     dt->updateNow();
1586 } // end of sp_verb_action_zoom_perform()
1588 /** \brief  Decode the verb code and take appropriate action */
1589 void
1590 DialogVerb::perform(SPAction *action, void *data, void *pdata)
1592     if (reinterpret_cast<std::size_t>(data) != SP_VERB_DIALOG_TOGGLE) {
1593         // unhide all when opening a new dialog
1594         inkscape_dialogs_unhide();
1595     }
1597     SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1598     g_assert(dt->_dlg_mgr != NULL);
1600     switch (reinterpret_cast<std::size_t>(data)) {
1601         case SP_VERB_DIALOG_DISPLAY:
1602             //sp_display_dialog();
1603             dt->_dlg_mgr->showDialog("InkscapePreferences");
1604             break;
1605         case SP_VERB_DIALOG_METADATA:
1606             // sp_desktop_dialog();
1607             dt->_dlg_mgr->showDialog("DocumentMetadata");
1608             break;
1609         case SP_VERB_DIALOG_NAMEDVIEW:
1610             // sp_desktop_dialog();
1611             dt->_dlg_mgr->showDialog("DocumentProperties");
1612             break;
1613         case SP_VERB_DIALOG_FILL_STROKE:
1614             sp_object_properties_dialog();
1615             break;
1616         case SP_VERB_DIALOG_SWATCHES:
1617             show_panel( Inkscape::UI::Dialogs::SwatchesPanel::getInstance(), "dialogs.swatches", SP_VERB_DIALOG_SWATCHES);
1618             break;
1619         case SP_VERB_DIALOG_TRANSFORM:
1620             dt->_dlg_mgr->showDialog("Transformation");
1621             break;
1622         case SP_VERB_DIALOG_ALIGN_DISTRIBUTE:
1623             dt->_dlg_mgr->showDialog("AlignAndDistribute");
1624             break;
1625         case SP_VERB_DIALOG_TEXT:
1626             sp_text_edit_dialog();
1627             break;
1628         case SP_VERB_DIALOG_XML_EDITOR:
1629             sp_xml_tree_dialog();
1630             break;
1631         case SP_VERB_DIALOG_FIND:
1632             sp_find_dialog();
1633 //              Please test the new find dialog if you have time:
1634 //            dt->_dlg_mgr->showDialog("Find");
1635             break;
1636         case SP_VERB_DIALOG_DEBUG:
1637             dt->_dlg_mgr->showDialog("Messages");
1638             break;
1639         case SP_VERB_DIALOG_SCRIPT:
1640             dt->_dlg_mgr->showDialog("Script");
1641             break;
1642         case SP_VERB_DIALOG_UNDO_HISTORY:
1643             dt->_dlg_mgr->showDialog("UndoHistory");
1644             break;
1645         case SP_VERB_DIALOG_TOGGLE:
1646             inkscape_dialogs_toggle();
1647             break;
1648         case SP_VERB_DIALOG_CLONETILER:
1649             clonetiler_dialog();
1650             break;
1651         case SP_VERB_DIALOG_ITEM:
1652             sp_item_dialog();
1653             break;
1654 #ifdef WITH_INKBOARD
1655         case SP_VERB_XMPP_CLIENT:
1656                 {
1657             Inkscape::Whiteboard::SessionManager::showClient();
1658                         break;
1659                 }
1660 #endif
1661         case SP_VERB_DIALOG_INPUT:
1662             sp_input_dialog();
1663             break;
1664         case SP_VERB_DIALOG_EXTENSIONEDITOR:
1665             dt->_dlg_mgr->showDialog("ExtensionEditor");
1666             break;
1667         case SP_VERB_DIALOG_LAYERS:
1668             show_panel( Inkscape::UI::Dialogs::LayersPanel::getInstance(), "dialogs.layers", SP_VERB_DIALOG_LAYERS );
1669             break;
1670         default:
1671             break;
1672     }
1673 } // end of sp_verb_action_dialog_perform()
1675 /** \brief  Decode the verb code and take appropriate action */
1676 void
1677 HelpVerb::perform(SPAction *action, void *data, void *pdata)
1679     SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1680     g_assert(dt->_dlg_mgr != NULL);
1682     switch (reinterpret_cast<std::size_t>(data)) {
1683         case SP_VERB_HELP_KEYS:
1684             /* TRANSLATORS: If you have translated the keys.svg file to your language, then
1685                translate this string as "keys.LANG.svg" (where LANG is your language code);
1686                otherwise leave as "keys.svg". */
1687             sp_help_open_screen(_("keys.svg"));
1688             break;
1689         case SP_VERB_HELP_ABOUT:
1690             sp_help_about();
1691             break;
1692         case SP_VERB_HELP_ABOUT_EXTENSIONS: {
1693             Inkscape::UI::Dialogs::ExtensionsPanel *panel = new Inkscape::UI::Dialogs::ExtensionsPanel();
1694             panel->set_full(true);
1695             show_panel( *panel, "dialogs.aboutextensions", SP_VERB_HELP_ABOUT_EXTENSIONS );
1696             break;
1697         }
1699         /*
1700         case SP_VERB_SHOW_LICENSE:
1701             // TRANSLATORS: See "tutorial-basic.svg" comment.
1702             sp_help_open_tutorial(NULL, (gpointer) _("gpl-2.svg"));
1703             break;
1704         */
1706         case SP_VERB_HELP_MEMORY:
1707             dt->_dlg_mgr->showDialog("Memory");
1708             break;
1709         default:
1710             break;
1711     }
1712 } // end of sp_verb_action_help_perform()
1714 /** \brief  Decode the verb code and take appropriate action */
1715 void
1716 TutorialVerb::perform(SPAction *action, void *data, void *pdata)
1718     switch (reinterpret_cast<std::size_t>(data)) {
1719         case SP_VERB_TUTORIAL_BASIC:
1720             /* TRANSLATORS: If you have translated the tutorial-basic.svg file to your language,
1721                then translate this string as "tutorial-basic.LANG.svg" (where LANG is your language
1722                code); otherwise leave as "tutorial-basic.svg". */
1723             sp_help_open_tutorial(NULL, (gpointer)_("tutorial-basic.svg"));
1724             break;
1725         case SP_VERB_TUTORIAL_SHAPES:
1726             // TRANSLATORS: See "tutorial-basic.svg" comment.
1727             sp_help_open_tutorial(NULL, (gpointer)_("tutorial-shapes.svg"));
1728             break;
1729         case SP_VERB_TUTORIAL_ADVANCED:
1730             // TRANSLATORS: See "tutorial-basic.svg" comment.
1731             sp_help_open_tutorial(NULL, (gpointer)_("tutorial-advanced.svg"));
1732             break;
1733         case SP_VERB_TUTORIAL_TRACING:
1734             // TRANSLATORS: See "tutorial-basic.svg" comment.
1735             sp_help_open_tutorial(NULL, (gpointer)_("tutorial-tracing.svg"));
1736             break;
1737         case SP_VERB_TUTORIAL_CALLIGRAPHY:
1738             // TRANSLATORS: See "tutorial-basic.svg" comment.
1739             sp_help_open_tutorial(NULL, (gpointer)_("tutorial-calligraphy.svg"));
1740             break;
1741         case SP_VERB_TUTORIAL_DESIGN:
1742             // TRANSLATORS: See "tutorial-basic.svg" comment.
1743             sp_help_open_tutorial(NULL, (gpointer)_("tutorial-elements.svg"));
1744             break;
1745         case SP_VERB_TUTORIAL_TIPS:
1746             // TRANSLATORS: See "tutorial-basic.svg" comment.
1747             sp_help_open_tutorial(NULL, (gpointer)_("tutorial-tips.svg"));
1748             break;
1749         default:
1750             break;
1751     }
1752 } // end of sp_verb_action_tutorial_perform()
1755 /**
1756  * Action vector to define functions called if a staticly defined file verb
1757  * is called.
1758  */
1759 SPActionEventVector FileVerb::vector =
1760             {{NULL},FileVerb::perform, NULL, NULL, NULL, NULL};
1761 /**
1762  * Action vector to define functions called if a staticly defined edit verb is
1763  * called.
1764  */
1765 SPActionEventVector EditVerb::vector =
1766             {{NULL},EditVerb::perform, NULL, NULL, NULL, NULL};
1768 /**
1769  * Action vector to define functions called if a staticly defined selection
1770  * verb is called
1771  */
1772 SPActionEventVector SelectionVerb::vector =
1773             {{NULL},SelectionVerb::perform, NULL, NULL, NULL, NULL};
1775 /**
1776  * Action vector to define functions called if a staticly defined layer
1777  * verb is called
1778  */
1779 SPActionEventVector LayerVerb::vector =
1780             {{NULL}, LayerVerb::perform, NULL, NULL, NULL, NULL};
1782 /**
1783  * Action vector to define functions called if a staticly defined object
1784  * editing verb is called
1785  */
1786 SPActionEventVector ObjectVerb::vector =
1787             {{NULL},ObjectVerb::perform, NULL, NULL, NULL, NULL};
1789 /**
1790  * Action vector to define functions called if a staticly defined context
1791  * verb is called
1792  */
1793 SPActionEventVector ContextVerb::vector =
1794             {{NULL},ContextVerb::perform, NULL, NULL, NULL, NULL};
1796 /**
1797  * Action vector to define functions called if a staticly defined zoom verb
1798  * is called
1799  */
1800 SPActionEventVector ZoomVerb::vector =
1801             {{NULL},ZoomVerb::perform, NULL, NULL, NULL, NULL};
1804 /**
1805  * Action vector to define functions called if a staticly defined dialog verb
1806  * is called
1807  */
1808 SPActionEventVector DialogVerb::vector =
1809             {{NULL},DialogVerb::perform, NULL, NULL, NULL, NULL};
1811 /**
1812  * Action vector to define functions called if a staticly defined help verb
1813  * is called
1814  */
1815 SPActionEventVector HelpVerb::vector =
1816             {{NULL},HelpVerb::perform, NULL, NULL, NULL, NULL};
1818 /**
1819  * Action vector to define functions called if a staticly defined tutorial verb
1820  * is called
1821  */
1822 SPActionEventVector TutorialVerb::vector =
1823             {{NULL},TutorialVerb::perform, NULL, NULL, NULL, NULL};
1825 /**
1826  * Action vector to define functions called if a staticly defined tutorial verb
1827  * is called
1828  */
1829 SPActionEventVector TextVerb::vector =
1830             {{NULL},TextVerb::perform, NULL, NULL, NULL, NULL};
1833 /* *********** Effect Last ********** */
1835 /** \brief A class to represent the last effect issued */
1836 class EffectLastVerb : public Verb {
1837 private:
1838     static void perform(SPAction *action, void *mydata, void *otherdata);
1839     static SPActionEventVector vector;
1840 protected:
1841     virtual SPAction *make_action(Inkscape::UI::View::View *view);
1842 public:
1843     /** \brief Use the Verb initializer with the same parameters. */
1844     EffectLastVerb(unsigned int const code,
1845                    gchar const *id,
1846                    gchar const *name,
1847                    gchar const *tip,
1848                    gchar const *image) :
1849         Verb(code, id, name, tip, image)
1850     {
1851         set_default_sensitive(false);
1852     }
1853 }; /* EffectLastVerb class */
1855 /**
1856  * The vector to attach in the last effect verb.
1857  */
1858 SPActionEventVector EffectLastVerb::vector =
1859             {{NULL},EffectLastVerb::perform, NULL, NULL, NULL, NULL};
1861 /** \brief  Create an action for a \c EffectLastVerb
1862     \param  view  Which view the action should be created for
1863     \return The built action.
1865     Calls \c make_action_helper with the \c vector.
1866 */
1867 SPAction *
1868 EffectLastVerb::make_action(Inkscape::UI::View::View *view)
1870     return make_action_helper(view, &vector);
1873 /** \brief  Decode the verb code and take appropriate action */
1874 void
1875 EffectLastVerb::perform(SPAction *action, void *data, void *pdata)
1877     /* These aren't used, but are here to remind people not to use
1878        the CURRENT_DOCUMENT macros unless they really have to. */
1879     Inkscape::UI::View::View *current_view = sp_action_get_view(action);
1880     // SPDocument *current_document = SP_VIEW_DOCUMENT(current_view);
1881     Inkscape::Extension::Effect *effect = Inkscape::Extension::Effect::get_last_effect();
1883     if (effect == NULL) return;
1884     if (current_view == NULL) return;
1886     switch ((long) data) {
1887         case SP_VERB_EFFECT_LAST_PREF:
1888             if (!effect->prefs(current_view))
1889                 return;
1890             /* Note: fall through */
1891         case SP_VERB_EFFECT_LAST:
1892             effect->effect(current_view);
1893             break;
1894         default:
1895             return;
1896     }
1898     return;
1900 /* *********** End Effect Last ********** */
1902 /* *********** Fit Canvas ********** */
1904 /** \brief A class to represent the canvas fitting verbs */
1905 class FitCanvasVerb : public Verb {
1906 private:
1907     static void perform(SPAction *action, void *mydata, void *otherdata);
1908     static SPActionEventVector vector;
1909 protected:
1910     virtual SPAction *make_action(Inkscape::UI::View::View *view);
1911 public:
1912     /** \brief Use the Verb initializer with the same parameters. */
1913     FitCanvasVerb(unsigned int const code,
1914                    gchar const *id,
1915                    gchar const *name,
1916                    gchar const *tip,
1917                    gchar const *image) :
1918         Verb(code, id, name, tip, image)
1919     {
1920         set_default_sensitive(false);
1921     }
1922 }; /* FitCanvasVerb class */
1924 /**
1925  * The vector to attach in the fit canvas verb.
1926  */
1927 SPActionEventVector FitCanvasVerb::vector =
1928             {{NULL},FitCanvasVerb::perform, NULL, NULL, NULL, NULL};
1930 /** \brief  Create an action for a \c FitCanvasVerb
1931     \param  view  Which view the action should be created for
1932     \return The built action.
1934     Calls \c make_action_helper with the \c vector.
1935 */
1936 SPAction *
1937 FitCanvasVerb::make_action(Inkscape::UI::View::View *view)
1939     SPAction *action = make_action_helper(view, &vector);
1940     return action;
1943 /** \brief  Decode the verb code and take appropriate action */
1944 void
1945 FitCanvasVerb::perform(SPAction *action, void *data, void *pdata)
1947     SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1948     if (!dt) return;
1949     SPDocument *doc = sp_desktop_document(dt);
1950     if (!doc) return;
1951     
1952     switch ((long) data) {
1953         case SP_VERB_FIT_CANVAS_TO_SELECTION:
1954             fit_canvas_to_selection(dt);
1955             break;
1956         case SP_VERB_FIT_CANVAS_TO_DRAWING:
1957             fit_canvas_to_drawing(doc);
1958             break;
1959         case SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING:
1960             fit_canvas_to_selection_or_drawing(dt);
1961             break;
1962         default:
1963             return;
1964     }
1966     return;
1968 /* *********** End Fit Canvas ********** */
1971 /* *********** Lock'N'Hide ********** */
1973 /** \brief A class to represent the object unlocking and unhiding verbs */
1974 class LockAndHideVerb : public Verb {
1975 private:
1976     static void perform(SPAction *action, void *mydata, void *otherdata);
1977     static SPActionEventVector vector;
1978 protected:
1979     virtual SPAction *make_action(Inkscape::UI::View::View *view);
1980 public:
1981     /** \brief Use the Verb initializer with the same parameters. */
1982     LockAndHideVerb(unsigned int const code,
1983                    gchar const *id,
1984                    gchar const *name,
1985                    gchar const *tip,
1986                    gchar const *image) :
1987         Verb(code, id, name, tip, image)
1988     {
1989         set_default_sensitive(true);
1990     }
1991 }; /* LockAndHideVerb class */
1993 /**
1994  * The vector to attach in the lock'n'hide verb.
1995  */
1996 SPActionEventVector LockAndHideVerb::vector =
1997             {{NULL},LockAndHideVerb::perform, NULL, NULL, NULL, NULL};
1999 /** \brief  Create an action for a \c LockAndHideVerb
2000     \param  view  Which view the action should be created for
2001     \return The built action.
2003     Calls \c make_action_helper with the \c vector.
2004 */
2005 SPAction *
2006 LockAndHideVerb::make_action(Inkscape::UI::View::View *view)
2008     SPAction *action = make_action_helper(view, &vector);
2009     return action;
2012 /** \brief  Decode the verb code and take appropriate action */
2013 void
2014 LockAndHideVerb::perform(SPAction *action, void *data, void *pdata)
2016     SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
2017     if (!dt) return;
2018     SPDocument *doc = sp_desktop_document(dt);
2019     if (!doc) return;
2020     
2021     switch ((long) data) {
2022         case SP_VERB_UNLOCK_ALL:
2023             unlock_all(dt);
2024             sp_document_done(doc, SP_VERB_UNLOCK_ALL, _("Unlock all objects in the current layer"));
2025             break;
2026         case SP_VERB_UNLOCK_ALL_IN_ALL_LAYERS:
2027             unlock_all_in_all_layers(dt);
2028             sp_document_done(doc, SP_VERB_UNLOCK_ALL_IN_ALL_LAYERS, _("Unlock all objects in all layers"));
2029             break;
2030         case SP_VERB_UNHIDE_ALL:
2031             unhide_all(dt);
2032             sp_document_done(doc, SP_VERB_UNHIDE_ALL, _("Unhide all objects in the current layer"));
2033             break;
2034         case SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS:
2035             unhide_all_in_all_layers(dt);
2036             sp_document_done(doc, SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS, _("Unhide all objects in all layers"));
2037             break;
2038         default:
2039             return;
2040     }
2042     return;
2044 /* *********** End Lock'N'Hide ********** */
2047 /* these must be in the same order as the SP_VERB_* enum in "verbs.h" */
2048 Verb *Verb::_base_verbs[] = {
2049     /* Header */
2050     new Verb(SP_VERB_INVALID, NULL, NULL, NULL, NULL),
2051     new Verb(SP_VERB_NONE, "None", N_("None"), N_("Does nothing"), NULL),
2053     /* File */
2054     new FileVerb(SP_VERB_FILE_NEW, "FileNew", N_("Default"), N_("Create new document from the default template"),
2055                  GTK_STOCK_NEW ),
2056     new FileVerb(SP_VERB_FILE_OPEN, "FileOpen", N_("_Open..."),
2057                  N_("Open an existing document"), GTK_STOCK_OPEN ),
2058     new FileVerb(SP_VERB_FILE_REVERT, "FileRevert", N_("Re_vert"),
2059                  N_("Revert to the last saved version of document (changes will be lost)"), GTK_STOCK_REVERT_TO_SAVED ),
2060     new FileVerb(SP_VERB_FILE_SAVE, "FileSave", N_("_Save"), N_("Save document"),
2061                  GTK_STOCK_SAVE ),
2062     new FileVerb(SP_VERB_FILE_SAVE_AS, "FileSaveAs", N_("Save _As..."),
2063                  N_("Save document under a new name"), GTK_STOCK_SAVE_AS ),
2064     new FileVerb(SP_VERB_FILE_SAVE_A_COPY, "FileSaveACopy", N_("Save a Cop_y..."),
2065                  N_("Save a copy of the document under a new name"), NULL ),
2066     new FileVerb(SP_VERB_FILE_PRINT, "FilePrint", N_("_Print..."), N_("Print document"),
2067                  GTK_STOCK_PRINT ),
2068     // TRANSLATORS: "Vacuum Defs" means "Clean up defs" (so as to remove unused definitions)
2069     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"),
2070                  "file_vacuum" ),
2071     new FileVerb(SP_VERB_FILE_PRINT_DIRECT, "FilePrintDirect", N_("Print _Direct"),
2072                  N_("Print directly without prompting to a file or pipe"), NULL ),
2073     new FileVerb(SP_VERB_FILE_PRINT_PREVIEW, "FilePrintPreview", N_("Print Previe_w"),
2074                  N_("Preview document printout"), GTK_STOCK_PRINT_PREVIEW ),
2075     new FileVerb(SP_VERB_FILE_IMPORT, "FileImport", N_("_Import..."),
2076                  N_("Import a bitmap or SVG image into this document"), "file_import"),
2077     new FileVerb(SP_VERB_FILE_EXPORT, "FileExport", N_("_Export Bitmap..."),
2078                  N_("Export this document or a selection as a bitmap image"), "file_export"),
2079     new FileVerb(SP_VERB_FILE_NEXT_DESKTOP, "NextWindow", N_("N_ext Window"),
2080                  N_("Switch to the next document window"), "window_next"),
2081     new FileVerb(SP_VERB_FILE_PREV_DESKTOP, "PrevWindow", N_("P_revious Window"),
2082                  N_("Switch to the previous document window"), "window_previous"),
2083     new FileVerb(SP_VERB_FILE_CLOSE_VIEW, "FileClose", N_("_Close"),
2084                  N_("Close this document window"), GTK_STOCK_CLOSE),
2085     new FileVerb(SP_VERB_FILE_QUIT, "FileQuit", N_("_Quit"), N_("Quit Inkscape"), GTK_STOCK_QUIT),
2087     /* Edit */
2088     new EditVerb(SP_VERB_EDIT_UNDO, "EditUndo", N_("_Undo"), N_("Undo last action"),
2089                  GTK_STOCK_UNDO),
2090     new EditVerb(SP_VERB_EDIT_REDO, "EditRedo", N_("_Redo"),
2091                  N_("Do again the last undone action"), GTK_STOCK_REDO),
2092     new EditVerb(SP_VERB_EDIT_CUT, "EditCut", N_("Cu_t"),
2093                  N_("Cut selection to clipboard"), GTK_STOCK_CUT),
2094     new EditVerb(SP_VERB_EDIT_COPY, "EditCopy", N_("_Copy"),
2095                  N_("Copy selection to clipboard"), GTK_STOCK_COPY),
2096     new EditVerb(SP_VERB_EDIT_PASTE, "EditPaste", N_("_Paste"),
2097                  N_("Paste objects from clipboard to mouse point, or paste text"), GTK_STOCK_PASTE),
2098     new EditVerb(SP_VERB_EDIT_PASTE_STYLE, "EditPasteStyle", N_("Paste _Style"),
2099                  N_("Apply the style of the copied object to selection"), "selection_paste_style"),
2100     new EditVerb(SP_VERB_EDIT_PASTE_SIZE, "EditPasteSize", N_("Paste Si_ze"),
2101                  N_("Scale selection to match the size of the copied object"), NULL),
2102     new EditVerb(SP_VERB_EDIT_PASTE_SIZE_X, "EditPasteWidth", N_("Paste _Width"),
2103                  N_("Scale selection horizontally to match the width of the copied object"), NULL),
2104     new EditVerb(SP_VERB_EDIT_PASTE_SIZE_Y, "EditPasteHeight", N_("Paste _Height"),
2105                  N_("Scale selection vertically to match the height of the copied object"), NULL),
2106     new EditVerb(SP_VERB_EDIT_PASTE_SIZE_SEPARATELY, "EditPasteSizeSeparately", N_("Paste Size Separately"),
2107                  N_("Scale each selected object to match the size of the copied object"), NULL),
2108     new EditVerb(SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_X, "EditPasteWidthSeparately", N_("Paste Width Separately"),
2109                  N_("Scale each selected object horizontally to match the width of the copied object"), NULL),
2110     new EditVerb(SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_Y, "EditPasteHeightSeparately", N_("Paste Height Separately"),
2111                  N_("Scale each selected object vertically to match the height of the copied object"), NULL),
2112     new EditVerb(SP_VERB_EDIT_PASTE_IN_PLACE, "EditPasteInPlace", N_("Paste _In Place"),
2113                  N_("Paste objects from clipboard to the original location"), "selection_paste_in_place"),
2114     new EditVerb(SP_VERB_EDIT_DELETE, "EditDelete", N_("_Delete"),
2115                  N_("Delete selection"), GTK_STOCK_DELETE),
2116     new EditVerb(SP_VERB_EDIT_DUPLICATE, "EditDuplicate", N_("Duplic_ate"),
2117                  N_("Duplicate selected objects"), "edit_duplicate"),
2118     new EditVerb(SP_VERB_EDIT_CLONE, "EditClone", N_("Create Clo_ne"),
2119                  N_("Create a clone (a copy linked to the original) of selected object"), "edit_clone"),
2120     new EditVerb(SP_VERB_EDIT_UNLINK_CLONE, "EditUnlinkClone", N_("Unlin_k Clone"),
2121                  N_("Cut the selected clone's link to its original, turning it into a standalone object"), "edit_unlink_clone"),
2122     new EditVerb(SP_VERB_EDIT_CLONE_ORIGINAL, "EditCloneOriginal", N_("Select _Original"),
2123                  N_("Select the object to which the selected clone is linked"), "edit_select_original"),
2124     // TRANSLATORS: Convert selection to a rectangle with tiled pattern fill
2125     new EditVerb(SP_VERB_EDIT_TILE, "ObjectsToPattern", N_("Objects to Patter_n"),
2126                  N_("Convert selection to a rectangle with tiled pattern fill"), NULL),
2127     // TRANSLATORS: Extract objects from a tiled pattern fill
2128     new EditVerb(SP_VERB_EDIT_UNTILE, "ObjectsFromPattern", N_("Pattern to _Objects"),
2129                  N_("Extract objects from a tiled pattern fill"), NULL),
2130     new EditVerb(SP_VERB_EDIT_CLEAR_ALL, "EditClearAll", N_("Clea_r All"),
2131                  N_("Delete all objects from document"), NULL),
2132     new EditVerb(SP_VERB_EDIT_SELECT_ALL, "EditSelectAll", N_("Select Al_l"),
2133                  N_("Select all objects or all nodes"), "selection_select_all"),
2134     new EditVerb(SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS, "EditSelectAllInAllLayers", N_("Select All in All La_yers"),
2135                  N_("Select all objects in all visible and unlocked layers"), "selection_select_all_in_all_layers"),
2136     new EditVerb(SP_VERB_EDIT_INVERT, "EditInvert", N_("In_vert Selection"),
2137                  N_("Invert selection (unselect what is selected and select everything else)"), "selection_invert"),
2138     new EditVerb(SP_VERB_EDIT_INVERT_IN_ALL_LAYERS, "EditInvertInAllLayers", N_("Invert in All Layers"),
2139                  N_("Invert selection in all visible and unlocked layers"), NULL),
2140     new EditVerb(SP_VERB_EDIT_SELECT_NEXT, "EditSelectNext", N_("Select Next"),
2141                  N_("Select next object or node"), NULL),
2142     new EditVerb(SP_VERB_EDIT_SELECT_PREV, "EditSelectPrev", N_("Select Previous"),
2143                  N_("Select previous object or node"), NULL),
2144     new EditVerb(SP_VERB_EDIT_DESELECT, "EditDeselect", N_("D_eselect"),
2145                  N_("Deselect any selected objects or nodes"), "selection_deselect"),
2147     /* Selection */
2148     new SelectionVerb(SP_VERB_SELECTION_TO_FRONT, "SelectionToFront", N_("Raise to _Top"),
2149                       N_("Raise selection to top"), "selection_top"),
2150     new SelectionVerb(SP_VERB_SELECTION_TO_BACK, "SelectionToBack", N_("Lower to _Bottom"),
2151                       N_("Lower selection to bottom"), "selection_bot"),
2152     new SelectionVerb(SP_VERB_SELECTION_RAISE, "SelectionRaise", N_("_Raise"),
2153                       N_("Raise selection one step"), "selection_up"),
2154     new SelectionVerb(SP_VERB_SELECTION_LOWER, "SelectionLower", N_("_Lower"),
2155                       N_("Lower selection one step"), "selection_down"),
2156     new SelectionVerb(SP_VERB_SELECTION_GROUP, "SelectionGroup", N_("_Group"),
2157                       N_("Group selected objects"), "selection_group"),
2158     new SelectionVerb(SP_VERB_SELECTION_UNGROUP, "SelectionUnGroup", N_("_Ungroup"),
2159                       N_("Ungroup selected groups"), "selection_ungroup"),
2161     new SelectionVerb(SP_VERB_SELECTION_TEXTTOPATH, "SelectionTextToPath", N_("_Put on Path"),
2162                       N_("Put text on path"), "put_on_path"),
2163     new SelectionVerb(SP_VERB_SELECTION_TEXTFROMPATH, "SelectionTextFromPath", N_("_Remove from Path"),
2164                       N_("Remove text from path"), "remove_from_path"),
2165     new SelectionVerb(SP_VERB_SELECTION_REMOVE_KERNS, "SelectionTextRemoveKerns", N_("Remove Manual _Kerns"),
2166                       // TRANSLATORS: "glyph": An image used in the visual representation of characters;
2167                       //  roughly speaking, how a character looks. A font is a set of glyphs.
2168                       N_("Remove all manual kerns and glyph rotations from a text object"), "remove_manual_kerns"),
2170     new SelectionVerb(SP_VERB_SELECTION_UNION, "SelectionUnion", N_("_Union"),
2171                       N_("Create union of selected paths"), "union"),
2172     new SelectionVerb(SP_VERB_SELECTION_INTERSECT, "SelectionIntersect", N_("_Intersection"),
2173                       N_("Create intersection of selected paths"), "intersection"),
2174     new SelectionVerb(SP_VERB_SELECTION_DIFF, "SelectionDiff", N_("_Difference"),
2175                       N_("Create difference of selected paths (bottom minus top)"), "difference"),
2176     new SelectionVerb(SP_VERB_SELECTION_SYMDIFF, "SelectionSymDiff", N_("E_xclusion"),
2177                       N_("Create exclusive OR of selected paths (those parts that belong to only one path)"), "exclusion"),
2178     new SelectionVerb(SP_VERB_SELECTION_CUT, "SelectionDivide", N_("Di_vision"),
2179                       N_("Cut the bottom path into pieces"), "division"),
2180     // TRANSLATORS: "to cut a path" is not the same as "to break a path apart" - see the
2181     // Advanced tutorial for more info
2182     new SelectionVerb(SP_VERB_SELECTION_SLICE, "SelectionCutPath", N_("Cut _Path"),
2183                       N_("Cut the bottom path's stroke into pieces, removing fill"), "cut_path"),
2184     // TRANSLATORS: "outset": expand a shape by offsetting the object's path,
2185     // i.e. by displacing it perpendicular to the path in each point.
2186     // See also the Advanced Tutorial for explanation.
2187     new SelectionVerb(SP_VERB_SELECTION_OFFSET, "SelectionOffset", N_("Outs_et"),
2188                       N_("Outset selected paths"), "outset_path"),
2189     new SelectionVerb(SP_VERB_SELECTION_OFFSET_SCREEN, "SelectionOffsetScreen",
2190                       N_("O_utset Path by 1 px"),
2191                       N_("Outset selected paths by 1 px"), NULL),
2192     new SelectionVerb(SP_VERB_SELECTION_OFFSET_SCREEN_10, "SelectionOffsetScreen10",
2193                       N_("O_utset Path by 10 px"),
2194                       N_("Outset selected paths by 10 px"), NULL),
2195     // TRANSLATORS: "inset": contract a shape by offsetting the object's path,
2196     // i.e. by displacing it perpendicular to the path in each point.
2197     // See also the Advanced Tutorial for explanation.
2198     new SelectionVerb(SP_VERB_SELECTION_INSET, "SelectionInset", N_("I_nset"),
2199                       N_("Inset selected paths"), "inset_path"),
2200     new SelectionVerb(SP_VERB_SELECTION_INSET_SCREEN, "SelectionInsetScreen",
2201                       N_("I_nset Path by 1 px"),
2202                       N_("Inset selected paths by 1 px"), NULL),
2203     new SelectionVerb(SP_VERB_SELECTION_INSET_SCREEN_10, "SelectionInsetScreen10",
2204                       N_("I_nset Path by 10 px"),
2205                       N_("Inset selected paths by 10 px"), NULL),
2206     new SelectionVerb(SP_VERB_SELECTION_DYNAMIC_OFFSET, "SelectionDynOffset",
2207                       N_("D_ynamic Offset"), N_("Create a dynamic offset object"), "dynamic_offset"),
2208     new SelectionVerb(SP_VERB_SELECTION_LINKED_OFFSET, "SelectionLinkedOffset",
2209                       N_("_Linked Offset"),
2210                       N_("Create a dynamic offset object linked to the original path"),
2211                       "linked_offset"),
2212     new SelectionVerb(SP_VERB_SELECTION_OUTLINE, "StrokeToPath", N_("_Stroke to Path"),
2213                       N_("Convert selected object's stroke to paths"), "stroke_tocurve"),
2214     new SelectionVerb(SP_VERB_SELECTION_SIMPLIFY, "SelectionSimplify", N_("Si_mplify"),
2215                       N_("Simplify selected paths (remove extra nodes)"), "simplify"),
2216     new SelectionVerb(SP_VERB_SELECTION_REVERSE, "SelectionReverse", N_("_Reverse"),
2217                       N_("Reverse the direction of selected paths (useful for flipping markers)"), "selection_reverse"),
2218     // TRANSLATORS: "to trace" means "to convert a bitmap to vector graphics" (to vectorize)
2219     new SelectionVerb(SP_VERB_SELECTION_TRACE, "SelectionTrace", N_("_Trace Bitmap..."),
2220                       N_("Create one or more paths from a bitmap by tracing it"), "selection_trace"),
2221     new SelectionVerb(SP_VERB_SELECTION_CREATE_BITMAP, "SelectionCreateBitmap", N_("_Make a Bitmap Copy"),
2222                       N_("Export selection to a bitmap and insert it into document"), "selection_bitmap" ),
2223     new SelectionVerb(SP_VERB_SELECTION_COMBINE, "SelectionCombine", N_("_Combine"),
2224                       N_("Combine several paths into one"), "selection_combine"),
2225     // TRANSLATORS: "to cut a path" is not the same as "to break a path apart" - see the
2226     // Advanced tutorial for more info
2227     new SelectionVerb(SP_VERB_SELECTION_BREAK_APART, "SelectionBreakApart", N_("Break _Apart"),
2228                       N_("Break selected paths into subpaths"), "selection_break"),
2229     new SelectionVerb(SP_VERB_SELECTION_GRIDTILE, "DialogGridArrange", N_("Gri_d Arrange..."),
2230                       N_("Arrange selected objects in a grid pattern"), "grid_arrange"),
2231     /* Layer */
2232     new LayerVerb(SP_VERB_LAYER_NEW, "LayerNew", N_("_Add Layer..."),
2233                   N_("Create a new layer"), "new_layer"),
2234     new LayerVerb(SP_VERB_LAYER_RENAME, "LayerRename", N_("Re_name Layer..."),
2235                   N_("Rename the current layer"), "rename_layer"),
2236     new LayerVerb(SP_VERB_LAYER_NEXT, "LayerNext", N_("Switch to Layer Abov_e"),
2237                   N_("Switch to the layer above the current"), "switch_to_layer_above"),
2238     new LayerVerb(SP_VERB_LAYER_PREV, "LayerPrev", N_("Switch to Layer Belo_w"),
2239                   N_("Switch to the layer below the current"), "switch_to_layer_below"),
2240     new LayerVerb(SP_VERB_LAYER_MOVE_TO_NEXT, "LayerMoveToNext", N_("Move Selection to Layer Abo_ve"),
2241                   N_("Move selection to the layer above the current"), "move_selection_above"),
2242     new LayerVerb(SP_VERB_LAYER_MOVE_TO_PREV, "LayerMoveToPrev", N_("Move Selection to Layer Bel_ow"),
2243                   N_("Move selection to the layer below the current"), "move_selection_below"),
2244     new LayerVerb(SP_VERB_LAYER_TO_TOP, "LayerToTop", N_("Layer to _Top"),
2245                   N_("Raise the current layer to the top"), "layer_to_top"),
2246     new LayerVerb(SP_VERB_LAYER_TO_BOTTOM, "LayerToBottom", N_("Layer to _Bottom"),
2247                   N_("Lower the current layer to the bottom"), "layer_to_bottom"),
2248     new LayerVerb(SP_VERB_LAYER_RAISE, "LayerRaise", N_("_Raise Layer"),
2249                   N_("Raise the current layer"), "raise_layer"),
2250     new LayerVerb(SP_VERB_LAYER_LOWER, "LayerLower", N_("_Lower Layer"),
2251                   N_("Lower the current layer"), "lower_layer"),
2252     new LayerVerb(SP_VERB_LAYER_DELETE, "LayerDelete", N_("_Delete Current Layer"),
2253                   N_("Delete the current layer"), "delete_layer"),
2255     /* Object */
2256     new ObjectVerb(SP_VERB_OBJECT_ROTATE_90_CW, "ObjectRotate90", N_("Rotate _90&#176; CW"),
2257                    // This is shared between tooltips and statusbar, so they
2258                    // must use UTF-8, not HTML entities for special characters.
2259                    N_("Rotate selection 90\xc2\xb0 clockwise"), "object_rotate_90_CW"),
2260     new ObjectVerb(SP_VERB_OBJECT_ROTATE_90_CCW, "ObjectRotate90CCW", N_("Rotate 9_0&#176; CCW"),
2261                    // This is shared between tooltips and statusbar, so they
2262                    // must use UTF-8, not HTML entities for special characters.
2263                    N_("Rotate selection 90\xc2\xb0 counter-clockwise"), "object_rotate_90_CCW"),
2264     new ObjectVerb(SP_VERB_OBJECT_FLATTEN, "ObjectRemoveTransform", N_("Remove _Transformations"),
2265                    N_("Remove transformations from object"), "object_reset"),
2266     new ObjectVerb(SP_VERB_OBJECT_TO_CURVE, "ObjectToPath", N_("_Object to Path"),
2267                    N_("Convert selected object to path"), "object_tocurve"),
2268     new ObjectVerb(SP_VERB_OBJECT_FLOW_TEXT, "ObjectFlowText", N_("_Flow into Frame"),
2269                    N_("Put text into a frame (path or shape), creating a flowed text linked to the frame object"), "flow_into_frame"),
2270     new ObjectVerb(SP_VERB_OBJECT_UNFLOW_TEXT, "ObjectUnFlowText", N_("_Unflow"),
2271                    N_("Remove text from frame (creates a single-line text object)"), "unflow"),
2272     new ObjectVerb(SP_VERB_OBJECT_FLOWTEXT_TO_TEXT, "ObjectFlowtextToText", N_("_Convert to Text"),
2273                    N_("Convert flowed text to regular text object (preserves appearance)"), "convert_to_text"),
2274     new ObjectVerb(SP_VERB_OBJECT_FLIP_HORIZONTAL, "ObjectFlipHorizontally",
2275                    N_("Flip _Horizontal"), N_("Flip selected objects horizontally"),
2276                    "object_flip_hor"),
2277     new ObjectVerb(SP_VERB_OBJECT_FLIP_VERTICAL, "ObjectFlipVertically",
2278                    N_("Flip _Vertical"), N_("Flip selected objects vertically"),
2279                    "object_flip_ver"),
2280     new ObjectVerb(SP_VERB_OBJECT_SET_MASK, "ObjectSetMask", N_("_Set"),
2281                  N_("Apply mask to selection (using the topmost object as mask)"), NULL),
2282     new ObjectVerb(SP_VERB_OBJECT_UNSET_MASK, "ObjectUnSetMask", N_("_Release"),
2283                  N_("Remove mask from selection"), NULL),
2284     new ObjectVerb(SP_VERB_OBJECT_SET_CLIPPATH, "ObjectSetClipPath", N_("_Set"),
2285                  N_("Apply clipping path to selection (using the topmost object as clipping path)"), NULL),
2286     new ObjectVerb(SP_VERB_OBJECT_UNSET_CLIPPATH, "ObjectUnSetClipPath", N_("_Release"),
2287                  N_("Remove clipping path from selection"), NULL),
2289     /* Tools */
2290     new ContextVerb(SP_VERB_CONTEXT_SELECT, "ToolSelector", N_("Select"),
2291                     N_("Select and transform objects"), "draw_select"),
2292     new ContextVerb(SP_VERB_CONTEXT_NODE, "ToolNode", N_("Node Edit"),
2293                     N_("Edit path nodes or control handles"), "draw_node"),
2294     new ContextVerb(SP_VERB_CONTEXT_RECT, "ToolRect", N_("Rectangle"),
2295                     N_("Create rectangles and squares"), "draw_rect"),
2296     new ContextVerb(SP_VERB_CONTEXT_ARC, "ToolArc", N_("Ellipse"),
2297                     N_("Create circles, ellipses, and arcs"), "draw_arc"),
2298     new ContextVerb(SP_VERB_CONTEXT_STAR, "ToolStar", N_("Star"),
2299                     N_("Create stars and polygons"), "draw_star"),
2300     new ContextVerb(SP_VERB_CONTEXT_SPIRAL, "ToolSpiral", N_("Spiral"),
2301                     N_("Create spirals"), "draw_spiral"),
2302     new ContextVerb(SP_VERB_CONTEXT_PENCIL, "ToolPencil", N_("Pencil"),
2303                     N_("Draw freehand lines"), "draw_freehand"),
2304     new ContextVerb(SP_VERB_CONTEXT_PEN, "ToolPen", N_("Pen"),
2305                     N_("Draw Bezier curves and straight lines"), "draw_pen"),
2306     new ContextVerb(SP_VERB_CONTEXT_CALLIGRAPHIC, "ToolCalligrphic", N_("Calligraphy"),
2307                     N_("Draw calligraphic lines"), "draw_calligraphic"),
2308     new ContextVerb(SP_VERB_CONTEXT_TEXT, "ToolText", N_("Text"),
2309                     N_("Create and edit text objects"), "draw_text"),
2310     new ContextVerb(SP_VERB_CONTEXT_GRADIENT, "ToolGradient", N_("Gradient"),
2311                     N_("Create and edit gradients"), "draw_gradient"),
2312     new ContextVerb(SP_VERB_CONTEXT_ZOOM, "ToolZoom", N_("Zoom"),
2313                     N_("Zoom in or out"), "draw_zoom"),
2314     new ContextVerb(SP_VERB_CONTEXT_DROPPER, "ToolDropper", N_("Dropper"),
2315                     N_("Pick colors from image"), "draw_dropper"),
2316     new ContextVerb(SP_VERB_CONTEXT_CONNECTOR, "ToolConnector", N_("Connector"),
2317                     N_("Create connectors"), "draw_connector"),
2318     new ContextVerb(SP_VERB_CONTEXT_PAINTBUCKET, "ToolPaintBucket", N_("Paint Bucket"),
2319                     N_("Fill bounded areas"), "draw_paintbucket"),
2321     /* Tool prefs */
2322     new ContextVerb(SP_VERB_CONTEXT_SELECT_PREFS, "SelectPrefs", N_("Selector Preferences"),
2323                     N_("Open Preferences for the Selector tool"), NULL),
2324     new ContextVerb(SP_VERB_CONTEXT_NODE_PREFS, "NodePrefs", N_("Node Tool Preferences"),
2325                     N_("Open Preferences for the Node tool"), NULL),
2326     new ContextVerb(SP_VERB_CONTEXT_RECT_PREFS, "RectPrefs", N_("Rectangle Preferences"),
2327                     N_("Open Preferences for the Rectangle tool"), NULL),
2328     new ContextVerb(SP_VERB_CONTEXT_ARC_PREFS, "ArcPrefs", N_("Ellipse Preferences"),
2329                     N_("Open Preferences for the Ellipse tool"), NULL),
2330     new ContextVerb(SP_VERB_CONTEXT_STAR_PREFS, "StarPrefs", N_("Star Preferences"),
2331                     N_("Open Preferences for the Star tool"), NULL),
2332     new ContextVerb(SP_VERB_CONTEXT_SPIRAL_PREFS, "SpiralPrefs", N_("Spiral Preferences"),
2333                     N_("Open Preferences for the Spiral tool"), NULL),
2334     new ContextVerb(SP_VERB_CONTEXT_PENCIL_PREFS, "PencilPrefs", N_("Pencil Preferences"),
2335                     N_("Open Preferences for the Pencil tool"), NULL),
2336     new ContextVerb(SP_VERB_CONTEXT_PEN_PREFS, "PenPrefs", N_("Pen Preferences"),
2337                     N_("Open Preferences for the Pen tool"), NULL),
2338     new ContextVerb(SP_VERB_CONTEXT_CALLIGRAPHIC_PREFS, "CalligraphicPrefs", N_("Calligraphic Preferences"),
2339                     N_("Open Preferences for the Calligraphy tool"), NULL),
2340     new ContextVerb(SP_VERB_CONTEXT_TEXT_PREFS, "TextPrefs", N_("Text Preferences"),
2341                     N_("Open Preferences for the Text tool"), NULL),
2342     new ContextVerb(SP_VERB_CONTEXT_GRADIENT_PREFS, "GradientPrefs", N_("Gradient Preferences"),
2343                     N_("Open Preferences for the Gradient tool"), NULL),
2344     new ContextVerb(SP_VERB_CONTEXT_ZOOM_PREFS, "ZoomPrefs", N_("Zoom Preferences"),
2345                     N_("Open Preferences for the Zoom tool"), NULL),
2346     new ContextVerb(SP_VERB_CONTEXT_DROPPER_PREFS, "DropperPrefs", N_("Dropper Preferences"),
2347                     N_("Open Preferences for the Dropper tool"), NULL),
2348     new ContextVerb(SP_VERB_CONTEXT_CONNECTOR_PREFS, "ConnectorPrefs", N_("Connector Preferences"),
2349                     N_("Open Preferences for the Connector tool"), NULL),
2350     new ContextVerb(SP_VERB_CONTEXT_PAINTBUCKET_PREFS, "PaintBucketPrefs", N_("Paint Bucket Preferences"),
2351                     N_("Open Preferences for the Paint Bucket tool"), NULL),
2353     /* Zoom/View */
2354     new ZoomVerb(SP_VERB_ZOOM_IN, "ZoomIn", N_("Zoom In"), N_("Zoom in"), "zoom_in"),
2355     new ZoomVerb(SP_VERB_ZOOM_OUT, "ZoomOut", N_("Zoom Out"), N_("Zoom out"), "zoom_out"),
2356     new ZoomVerb(SP_VERB_TOGGLE_RULERS, "ToggleRulers", N_("_Rulers"), N_("Show or hide the canvas rulers"), "rulers"),
2357     new ZoomVerb(SP_VERB_TOGGLE_SCROLLBARS, "ToggleScrollbars", N_("Scroll_bars"), N_("Show or hide the canvas scrollbars"), "scrollbars"),
2358     new ZoomVerb(SP_VERB_TOGGLE_GRID, "ToggleGrid", N_("_Grid"), N_("Show or hide the grid"), "grid"),
2359     new ZoomVerb(SP_VERB_TOGGLE_GUIDES, "ToggleGuides", N_("G_uides"), N_("Show or hide guides (drag from a ruler to create a guide)"), "guides"),
2360     new ZoomVerb(SP_VERB_ZOOM_NEXT, "ZoomNext", N_("Nex_t Zoom"), N_("Next zoom (from the history of zooms)"),
2361                  "zoom_next"),
2362     new ZoomVerb(SP_VERB_ZOOM_PREV, "ZoomPrev", N_("Pre_vious Zoom"), N_("Previous zoom (from the history of zooms)"),
2363                  "zoom_previous"),
2364     new ZoomVerb(SP_VERB_ZOOM_1_1, "Zoom1:0", N_("Zoom 1:_1"), N_("Zoom to 1:1"),
2365                  "zoom_1_to_1"),
2366     new ZoomVerb(SP_VERB_ZOOM_1_2, "Zoom1:2", N_("Zoom 1:_2"), N_("Zoom to 1:2"),
2367                  "zoom_1_to_2"),
2368     new ZoomVerb(SP_VERB_ZOOM_2_1, "Zoom2:1", N_("_Zoom 2:1"), N_("Zoom to 2:1"),
2369                  "zoom_2_to_1"),
2370 #ifdef HAVE_GTK_WINDOW_FULLSCREEN
2371     new ZoomVerb(SP_VERB_FULLSCREEN, "FullScreen", N_("_Fullscreen"), N_("Stretch this document window to full screen"),
2372                  "fullscreen"),
2373 #endif /* HAVE_GTK_WINDOW_FULLSCREEN */
2374     new ZoomVerb(SP_VERB_VIEW_NEW, "ViewNew", N_("Duplic_ate Window"), N_("Open a new window with the same document"),
2375                  "view_new"),
2376     new ZoomVerb(SP_VERB_VIEW_NEW_PREVIEW, "ViewNewPreview", N_("_New View Preview"),
2377                  N_("New View Preview"), NULL/*"view_new_preview"*/),
2379     new ZoomVerb(SP_VERB_VIEW_MODE_NORMAL, "ViewModeNormal", N_("_Normal"),
2380                  N_("Switch to normal display mode"), NULL),
2381     new ZoomVerb(SP_VERB_VIEW_MODE_OUTLINE, "ViewModeOutline", N_("_Outline"),
2382                  N_("Switch to outline (wireframe) display mode"), NULL),
2383     new ZoomVerb(SP_VERB_VIEW_MODE_TOGGLE, "ViewModeToggle", N_("_Toggle"),
2384                  N_("Toggle between normal and outline display modes"), NULL),
2386     new ZoomVerb(SP_VERB_VIEW_ICON_PREVIEW, "ViewIconPreview", N_("Ico_n Preview..."),
2387                  N_("Open a window to preview objects at different icon resolutions"), "view_icon_preview"),
2388     new ZoomVerb(SP_VERB_ZOOM_PAGE, "ZoomPage", N_("_Page"),
2389                  N_("Zoom to fit page in window"), "zoom_page"),
2390     new ZoomVerb(SP_VERB_ZOOM_PAGE_WIDTH, "ZoomPageWidth", N_("Page _Width"),
2391                  N_("Zoom to fit page width in window"), "zoom_pagewidth"),
2392     new ZoomVerb(SP_VERB_ZOOM_DRAWING, "ZoomDrawing", N_("_Drawing"),
2393                  N_("Zoom to fit drawing in window"), "zoom_draw"),
2394     new ZoomVerb(SP_VERB_ZOOM_SELECTION, "ZoomSelection", N_("_Selection"),
2395                  N_("Zoom to fit selection in window"), "zoom_select"),
2397     /* Dialogs */
2398     new DialogVerb(SP_VERB_DIALOG_DISPLAY, "DialogPreferences", N_("In_kscape Preferences..."),
2399                    N_("Edit global Inkscape preferences"), GTK_STOCK_PREFERENCES ),
2400     new DialogVerb(SP_VERB_DIALOG_NAMEDVIEW, "DialogDocumentProperties", N_("_Document Properties..."),
2401                    N_("Edit properties of this document (to be saved with the document)"), GTK_STOCK_PROPERTIES ),
2402     new DialogVerb(SP_VERB_DIALOG_METADATA, "DialogMetadata", N_("Document _Metadata..."),
2403                    N_("Edit document metadata (to be saved with the document)"), "document_metadata" ),
2404     new DialogVerb(SP_VERB_DIALOG_FILL_STROKE, "DialogFillStroke", N_("_Fill and Stroke..."),
2405                    N_("Edit objects' colors, gradients, stroke width, arrowheads, dash patterns..."), "fill_and_stroke"),
2406     // TRANSLATORS: "Swatches" means: color samples
2407     new DialogVerb(SP_VERB_DIALOG_SWATCHES, "DialogSwatches", N_("S_watches..."),
2408                    N_("Select colors from a swatches palette"), GTK_STOCK_SELECT_COLOR),
2409     new DialogVerb(SP_VERB_DIALOG_TRANSFORM, "DialogTransform", N_("Transfor_m..."),
2410                    N_("Precisely control objects' transformations"), "object_trans"),
2411     new DialogVerb(SP_VERB_DIALOG_ALIGN_DISTRIBUTE, "DialogAlignDistribute", N_("_Align and Distribute..."),
2412                    N_("Align and distribute objects"), "object_align"),
2413     new DialogVerb(SP_VERB_DIALOG_UNDO_HISTORY, "DialogUndoHistory", N_("Undo _History..."),
2414                    N_("Undo History"), "edit_undo_history"),
2415     new DialogVerb(SP_VERB_DIALOG_TEXT, "DialogText", N_("_Text and Font..."),
2416                    N_("View and select font family, font size and other text properties"), "object_font"),
2417     new DialogVerb(SP_VERB_DIALOG_XML_EDITOR, "DialogXMLEditor", N_("_XML Editor..."),
2418                    N_("View and edit the XML tree of the document"), "xml_editor"),
2419     new DialogVerb(SP_VERB_DIALOG_FIND, "DialogFind", N_("_Find..."),
2420                    N_("Find objects in document"), GTK_STOCK_FIND ),
2421     new DialogVerb(SP_VERB_DIALOG_DEBUG, "DialogDebug", N_("_Messages..."),
2422                    N_("View debug messages"), "messages"),
2423     new DialogVerb(SP_VERB_DIALOG_SCRIPT, "DialogScript", N_("S_cripts..."),
2424                    N_("Run scripts"), "scripts"),
2425     new DialogVerb(SP_VERB_DIALOG_TOGGLE, "DialogsToggle", N_("Show/Hide D_ialogs"),
2426                    N_("Show or hide all open dialogs"), "dialog_toggle"),
2427     new DialogVerb(SP_VERB_DIALOG_CLONETILER, "DialogClonetiler", N_("Create Tiled Clones..."),
2428                    N_("Create multiple clones of selected object, arranging them into a pattern or scattering"), "edit_create_tiled_clones"),
2429     new DialogVerb(SP_VERB_DIALOG_ITEM, "DialogObjectProperties", N_("_Object Properties..."),
2430                    N_("Edit the ID, locked and visible status, and other object properties"), "dialog_item_properties"),
2431 #ifdef WITH_INKBOARD
2432     new DialogVerb(SP_VERB_XMPP_CLIENT, "DialogXmppClient",
2433                    N_("_Instant Messaging..."), N_("Jabber Instant Messaging Client"), NULL),
2434 #endif
2435     new DialogVerb(SP_VERB_DIALOG_INPUT, "DialogInput", N_("_Input Devices..."),
2436                    N_("Configure extended input devices, such as a graphics tablet"), "input_devices"),
2437     new DialogVerb(SP_VERB_DIALOG_EXTENSIONEDITOR, "org.inkscape.dialogs.extensioneditor", N_("_Extensions..."),
2438                    N_("Query information about extensions"), NULL),
2439     new DialogVerb(SP_VERB_DIALOG_LAYERS, "DialogLayers", N_("Layer_s..."),
2440                    N_("View Layers"), "layers"),
2442     /* Help */
2443     new HelpVerb(SP_VERB_HELP_KEYS, "HelpKeys", N_("_Keys and Mouse"),
2444                  N_("Keys and mouse shortcuts reference"), "help_keys"),
2445     new HelpVerb(SP_VERB_HELP_ABOUT_EXTENSIONS, "HelpAboutExtensions", N_("About E_xtensions"),
2446                  N_("Information on Inkscape extensions"), NULL),
2447     new HelpVerb(SP_VERB_HELP_MEMORY, "HelpAboutMemory", N_("About _Memory"),
2448                  N_("Memory usage information"), "about_memory"),
2449     new HelpVerb(SP_VERB_HELP_ABOUT, "HelpAbout", N_("_About Inkscape"),
2450                  N_("Inkscape version, authors, license"), /*"help_about"*/"inkscape_options"),
2451     //new HelpVerb(SP_VERB_SHOW_LICENSE, "ShowLicense", N_("_License"),
2452     //           N_("Distribution terms"), /*"show_license"*/"inkscape_options"),
2454     /* Tutorials */
2455     new TutorialVerb(SP_VERB_TUTORIAL_BASIC, "TutorialsBasic", N_("Inkscape: _Basic"),
2456                      N_("Getting started with Inkscape"), NULL/*"tutorial_basic"*/),
2457     new TutorialVerb(SP_VERB_TUTORIAL_SHAPES, "TutorialsShapes", N_("Inkscape: _Shapes"),
2458                      N_("Using shape tools to create and edit shapes"), NULL),
2459     new TutorialVerb(SP_VERB_TUTORIAL_ADVANCED, "TutorialsAdvanced", N_("Inkscape: _Advanced"),
2460                      N_("Advanced Inkscape topics"), NULL/*"tutorial_advanced"*/),
2461     // TRANSLATORS: "to trace" means "to convert a bitmap to vector graphics" (to vectorize)
2462     new TutorialVerb(SP_VERB_TUTORIAL_TRACING, "TutorialsTracing", N_("Inkscape: T_racing"),
2463                      N_("Using bitmap tracing"), NULL/*"tutorial_tracing"*/),
2464     new TutorialVerb(SP_VERB_TUTORIAL_CALLIGRAPHY, "TutorialsCalligraphy", N_("Inkscape: _Calligraphy"),
2465                      N_("Using the Calligraphy pen tool"), NULL),
2466     new TutorialVerb(SP_VERB_TUTORIAL_DESIGN, "TutorialsDesign", N_("_Elements of Design"),
2467                      N_("Principles of design in the tutorial form"), NULL/*"tutorial_design"*/),
2468     new TutorialVerb(SP_VERB_TUTORIAL_TIPS, "TutorialsTips", N_("_Tips and Tricks"),
2469                      N_("Miscellaneous tips and tricks"), NULL/*"tutorial_tips"*/),
2471     /* Effect */
2472     new EffectLastVerb(SP_VERB_EFFECT_LAST, "EffectLast", N_("Previous Effect"),
2473                        N_("Repeat the last effect with the same settings"), NULL),
2474     new EffectLastVerb(SP_VERB_EFFECT_LAST_PREF, "EffectLastPref", N_("Previous Effect Settings..."),
2475                        N_("Repeat the last effect with new settings"), NULL),
2477     /* Fit Page */
2478     new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_SELECTION, "FitCanvasToSelection", N_("Fit Page to Selection"),
2479                        N_("Fit the page to the current selection"), NULL),
2480     new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_DRAWING, "FitCanvasToDrawing", N_("Fit Page to Drawing"),
2481                        N_("Fit the page to the drawing"), NULL),
2482     new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING, "FitCanvasToSelectionOrDrawing", N_("Fit Page to Selection or Drawing"),
2483                        N_("Fit the page to the current selection or the drawing if there is no selection"), NULL),
2484     /* LockAndHide */
2485     new LockAndHideVerb(SP_VERB_UNLOCK_ALL, "UnlockAll", N_("Unlock All"),
2486                        N_("Unlock all objects in the current layer"), NULL),
2487     new LockAndHideVerb(SP_VERB_UNLOCK_ALL_IN_ALL_LAYERS, "UnlockAllInAllLayers", N_("Unlock All in All Layers"),
2488                        N_("Unlock all objects in all layers"), NULL),
2489     new LockAndHideVerb(SP_VERB_UNHIDE_ALL, "UnhideAll", N_("Unhide All"),
2490                        N_("Unhide all objects in the current layer"), NULL),
2491     new LockAndHideVerb(SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS, "UnhideAllInAllLayers", N_("Unhide All in All Layers"),
2492                        N_("Unhide all objects in all layers"), NULL),
2493     /* Footer */
2494     new Verb(SP_VERB_LAST, " '\"invalid id", NULL, NULL, NULL)
2495 };
2498 void
2499 Verb::list (void) {
2500     // Go through the dynamic verb table
2501     for (VerbTable::iterator iter = _verbs.begin(); iter != _verbs.end(); iter++) {
2502         Verb * verb = iter->second;
2503         if (verb->get_code() == SP_VERB_INVALID ||
2504                 verb->get_code() == SP_VERB_NONE ||
2505                 verb->get_code() == SP_VERB_LAST) {
2506             continue;
2507         }
2509         printf("%s: %s\n", verb->get_id(), verb->get_tip()? verb->get_tip() : verb->get_name());
2510     }
2512     return;
2513 };
2515 }  /* namespace Inkscape */
2517 /*
2518   Local Variables:
2519   mode:c++
2520   c-file-style:"stroustrup"
2521   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
2522   indent-tabs-mode:nil
2523   fill-column:99
2524   End:
2525 */
2526 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :