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