Code

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