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