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