Code

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