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 "dialogs/text-edit.h"
41 #include "dialogs/xml-tree.h"
42 #include "dialogs/item-properties.h"
43 #include "dialogs/find.h"
44 #include "dialogs/layer-properties.h"
45 #include "dialogs/clonetiler.h"
46 #include "dialogs/iconpreview.h"
47 #include "dialogs/extensions.h"
48 #include "dialogs/swatches.h"
49 #include "dialogs/layers-panel.h"
50 #ifndef USE_NEW_INPUT_DEVICES
51 #include "dialogs/input.h"
52 #endif
54 #ifdef WITH_INKBOARD
55 #include "jabber_whiteboard/session-manager.h"
56 #endif
58 #include "extension/effect.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"
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_DELETE:
886 sp_selection_delete();
887 break;
888 case SP_VERB_EDIT_DUPLICATE:
889 sp_selection_duplicate();
890 break;
891 case SP_VERB_EDIT_CLONE:
892 sp_selection_clone();
893 break;
894 case SP_VERB_EDIT_UNLINK_CLONE:
895 sp_selection_unlink();
896 break;
897 case SP_VERB_EDIT_CLONE_SELECT_ORIGINAL:
898 sp_select_clone_original();
899 break;
900 case SP_VERB_EDIT_SELECTION_2_MARKER:
901 sp_selection_to_marker();
902 break;
903 case SP_VERB_EDIT_SELECTION_2_GUIDES:
904 sp_selection_to_guides();
905 break;
906 case SP_VERB_EDIT_TILE:
907 sp_selection_tile();
908 break;
909 case SP_VERB_EDIT_UNTILE:
910 sp_selection_untile();
911 break;
912 case SP_VERB_EDIT_CLEAR_ALL:
913 sp_edit_clear_all();
914 break;
915 case SP_VERB_EDIT_SELECT_ALL:
916 if (tools_isactive(dt, TOOLS_NODES)) {
917 SP_NODE_CONTEXT(ec)->shape_editor->select_all_from_subpath(false);
918 } else {
919 sp_edit_select_all();
920 }
921 break;
922 case SP_VERB_EDIT_INVERT:
923 if (tools_isactive(dt, TOOLS_NODES)) {
924 SP_NODE_CONTEXT(ec)->shape_editor->select_all_from_subpath(true);
925 } else {
926 sp_edit_invert();
927 }
928 break;
929 case SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS:
930 if (tools_isactive(dt, TOOLS_NODES)) {
931 SP_NODE_CONTEXT(ec)->shape_editor->select_all(false);
932 } else {
933 sp_edit_select_all_in_all_layers();
934 }
935 break;
936 case SP_VERB_EDIT_INVERT_IN_ALL_LAYERS:
937 if (tools_isactive(dt, TOOLS_NODES)) {
938 SP_NODE_CONTEXT(ec)->shape_editor->select_all(true);
939 } else {
940 sp_edit_invert_in_all_layers();
941 }
942 break;
944 case SP_VERB_EDIT_SELECT_NEXT:
945 if (tools_isactive(dt, TOOLS_NODES)) {
946 SP_NODE_CONTEXT(ec)->shape_editor->select_next();
947 } else if (tools_isactive(dt, TOOLS_GRADIENT)
948 && ec->_grdrag->isNonEmpty()) {
949 sp_gradient_context_select_next (ec);
950 } else {
951 sp_selection_item_next();
952 }
953 break;
954 case SP_VERB_EDIT_SELECT_PREV:
955 if (tools_isactive(dt, TOOLS_NODES)) {
956 SP_NODE_CONTEXT(ec)->shape_editor->select_prev();
957 } else if (tools_isactive(dt, TOOLS_GRADIENT)
958 && ec->_grdrag->isNonEmpty()) {
959 sp_gradient_context_select_prev (ec);
960 } else {
961 sp_selection_item_prev();
962 }
963 break;
965 case SP_VERB_EDIT_DESELECT:
966 if (tools_isactive(dt, TOOLS_NODES)) {
967 SP_NODE_CONTEXT(ec)->shape_editor->deselect();
968 } else {
969 sp_desktop_selection(dt)->clear();
970 }
971 break;
973 case SP_VERB_EDIT_GUIDES_AROUND_PAGE:
974 sp_guide_create_guides_around_page(sp_desktop_document(dt));
975 break;
977 case SP_VERB_EDIT_NEXT_PATHEFFECT_PARAMETER:
978 sp_selection_next_patheffect_param(dt);
979 break;
980 default:
981 break;
982 }
984 } // end of sp_verb_action_edit_perform()
986 /** \brief Decode the verb code and take appropriate action */
987 void
988 SelectionVerb::perform(SPAction *action, void *data, void */*pdata*/)
989 {
990 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
992 if (!dt)
993 return;
995 g_assert(dt->_dlg_mgr != NULL);
997 switch (reinterpret_cast<std::size_t>(data)) {
998 case SP_VERB_SELECTION_TO_FRONT:
999 sp_selection_raise_to_top();
1000 break;
1001 case SP_VERB_SELECTION_TO_BACK:
1002 sp_selection_lower_to_bottom();
1003 break;
1004 case SP_VERB_SELECTION_RAISE:
1005 sp_selection_raise();
1006 break;
1007 case SP_VERB_SELECTION_LOWER:
1008 sp_selection_lower();
1009 break;
1010 case SP_VERB_SELECTION_GROUP:
1011 sp_selection_group();
1012 break;
1013 case SP_VERB_SELECTION_UNGROUP:
1014 sp_selection_ungroup();
1015 break;
1017 case SP_VERB_SELECTION_TEXTTOPATH:
1018 text_put_on_path();
1019 break;
1020 case SP_VERB_SELECTION_TEXTFROMPATH:
1021 text_remove_from_path();
1022 break;
1023 case SP_VERB_SELECTION_REMOVE_KERNS:
1024 text_remove_all_kerns();
1025 break;
1027 case SP_VERB_SELECTION_UNION:
1028 sp_selected_path_union();
1029 break;
1030 case SP_VERB_SELECTION_INTERSECT:
1031 sp_selected_path_intersect();
1032 break;
1033 case SP_VERB_SELECTION_DIFF:
1034 sp_selected_path_diff();
1035 break;
1036 case SP_VERB_SELECTION_SYMDIFF:
1037 sp_selected_path_symdiff();
1038 break;
1040 case SP_VERB_SELECTION_CUT:
1041 sp_selected_path_cut();
1042 break;
1043 case SP_VERB_SELECTION_SLICE:
1044 sp_selected_path_slice();
1045 break;
1047 case SP_VERB_SELECTION_OFFSET:
1048 sp_selected_path_offset();
1049 break;
1050 case SP_VERB_SELECTION_OFFSET_SCREEN:
1051 sp_selected_path_offset_screen(1);
1052 break;
1053 case SP_VERB_SELECTION_OFFSET_SCREEN_10:
1054 sp_selected_path_offset_screen(10);
1055 break;
1056 case SP_VERB_SELECTION_INSET:
1057 sp_selected_path_inset();
1058 break;
1059 case SP_VERB_SELECTION_INSET_SCREEN:
1060 sp_selected_path_inset_screen(1);
1061 break;
1062 case SP_VERB_SELECTION_INSET_SCREEN_10:
1063 sp_selected_path_inset_screen(10);
1064 break;
1065 case SP_VERB_SELECTION_DYNAMIC_OFFSET:
1066 sp_selected_path_create_offset_object_zero();
1067 tools_switch_current(TOOLS_NODES);
1068 break;
1069 case SP_VERB_SELECTION_LINKED_OFFSET:
1070 sp_selected_path_create_updating_offset_object_zero();
1071 tools_switch_current(TOOLS_NODES);
1072 break;
1074 case SP_VERB_SELECTION_OUTLINE:
1075 sp_selected_path_outline();
1076 break;
1077 case SP_VERB_SELECTION_SIMPLIFY:
1078 sp_selected_path_simplify();
1079 break;
1080 case SP_VERB_SELECTION_REVERSE:
1081 sp_selected_path_reverse();
1082 break;
1083 case SP_VERB_SELECTION_TRACE:
1084 inkscape_dialogs_unhide();
1085 dt->_dlg_mgr->showDialog("Trace");
1086 break;
1087 case SP_VERB_SELECTION_CREATE_BITMAP:
1088 sp_selection_create_bitmap_copy();
1089 break;
1091 case SP_VERB_SELECTION_COMBINE:
1092 sp_selected_path_combine();
1093 break;
1094 case SP_VERB_SELECTION_BREAK_APART:
1095 sp_selected_path_break_apart();
1096 break;
1097 case SP_VERB_SELECTION_GRIDTILE:
1098 inkscape_dialogs_unhide();
1099 dt->_dlg_mgr->showDialog("TileDialog");
1100 break;
1101 default:
1102 break;
1103 }
1105 } // end of sp_verb_action_selection_perform()
1107 /** \brief Decode the verb code and take appropriate action */
1108 void
1109 LayerVerb::perform(SPAction *action, void *data, void */*pdata*/)
1110 {
1111 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1112 unsigned int verb = reinterpret_cast<std::size_t>(data);
1114 if ( !dt || !dt->currentLayer() ) {
1115 return;
1116 }
1118 switch (verb) {
1119 case SP_VERB_LAYER_NEW: {
1120 Inkscape::UI::Dialogs::LayerPropertiesDialog::showCreate(dt, dt->currentLayer());
1121 break;
1122 }
1123 case SP_VERB_LAYER_RENAME: {
1124 Inkscape::UI::Dialogs::LayerPropertiesDialog::showRename(dt, dt->currentLayer());
1125 break;
1126 }
1127 case SP_VERB_LAYER_NEXT: {
1128 SPObject *next=Inkscape::next_layer(dt->currentRoot(), dt->currentLayer());
1129 if (next) {
1130 dt->setCurrentLayer(next);
1131 sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_NEXT,
1132 _("Switch to next layer"));
1133 dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Switched to next layer."));
1134 } else {
1135 dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Cannot go past last layer."));
1136 }
1137 break;
1138 }
1139 case SP_VERB_LAYER_PREV: {
1140 SPObject *prev=Inkscape::previous_layer(dt->currentRoot(), dt->currentLayer());
1141 if (prev) {
1142 dt->setCurrentLayer(prev);
1143 sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_PREV,
1144 _("Switch to previous layer"));
1145 dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Switched to previous layer."));
1146 } else {
1147 dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Cannot go before first layer."));
1148 }
1149 break;
1150 }
1151 case SP_VERB_LAYER_MOVE_TO_NEXT: {
1152 sp_selection_to_next_layer();
1153 break;
1154 }
1155 case SP_VERB_LAYER_MOVE_TO_PREV: {
1156 sp_selection_to_prev_layer();
1157 break;
1158 }
1159 case SP_VERB_LAYER_TO_TOP:
1160 case SP_VERB_LAYER_TO_BOTTOM:
1161 case SP_VERB_LAYER_RAISE:
1162 case SP_VERB_LAYER_LOWER: {
1163 if ( dt->currentLayer() == dt->currentRoot() ) {
1164 dt->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No current layer."));
1165 return;
1166 }
1168 SPItem *layer=SP_ITEM(dt->currentLayer());
1169 g_return_if_fail(layer != NULL);
1171 SPObject *old_pos=SP_OBJECT_NEXT(layer);
1173 switch (verb) {
1174 case SP_VERB_LAYER_TO_TOP:
1175 layer->raiseToTop();
1176 break;
1177 case SP_VERB_LAYER_TO_BOTTOM:
1178 layer->lowerToBottom();
1179 break;
1180 case SP_VERB_LAYER_RAISE:
1181 layer->raiseOne();
1182 break;
1183 case SP_VERB_LAYER_LOWER:
1184 layer->lowerOne();
1185 break;
1186 }
1188 if ( SP_OBJECT_NEXT(layer) != old_pos ) {
1189 char const *message = NULL;
1190 Glib::ustring description = "";
1191 switch (verb) {
1192 case SP_VERB_LAYER_TO_TOP:
1193 message = g_strdup_printf(_("Raised layer <b>%s</b>."), layer->defaultLabel());
1194 description = _("Layer to top");
1195 break;
1196 case SP_VERB_LAYER_RAISE:
1197 message = g_strdup_printf(_("Raised layer <b>%s</b>."), layer->defaultLabel());
1198 description = _("Raise layer");
1199 break;
1200 case SP_VERB_LAYER_TO_BOTTOM:
1201 message = g_strdup_printf(_("Lowered layer <b>%s</b>."), layer->defaultLabel());
1202 description = _("Layer to bottom");
1203 break;
1204 case SP_VERB_LAYER_LOWER:
1205 message = g_strdup_printf(_("Lowered layer <b>%s</b>."), layer->defaultLabel());
1206 description = _("Lower layer");
1207 break;
1208 };
1209 sp_document_done(sp_desktop_document(dt), verb, description);
1210 if (message) {
1211 dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, message);
1212 g_free((void *) message);
1213 }
1214 } else {
1215 dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Cannot move layer any further."));
1216 }
1218 break;
1219 }
1220 case SP_VERB_LAYER_DELETE: {
1221 if ( dt->currentLayer() != dt->currentRoot() ) {
1222 sp_desktop_selection(dt)->clear();
1223 SPObject *old_layer=dt->currentLayer();
1225 sp_object_ref(old_layer, NULL);
1226 SPObject *survivor=Inkscape::next_layer(dt->currentRoot(), old_layer);
1227 if (!survivor) {
1228 survivor = Inkscape::previous_layer(dt->currentRoot(), old_layer);
1229 }
1231 /* Deleting the old layer before switching layers is a hack to trigger the
1232 * listeners of the deletion event (as happens when old_layer is deleted using the
1233 * xml editor). See
1234 * http://sourceforge.net/tracker/index.php?func=detail&aid=1339397&group_id=93438&atid=604306
1235 */
1236 old_layer->deleteObject();
1237 sp_object_unref(old_layer, NULL);
1238 if (survivor) {
1239 dt->setCurrentLayer(survivor);
1240 }
1242 sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_DELETE,
1243 _("Delete layer"));
1245 // TRANSLATORS: this means "The layer has been deleted."
1246 dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Deleted layer."));
1247 } else {
1248 dt->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No current layer."));
1249 }
1250 break;
1251 }
1252 }
1254 return;
1255 } // end of sp_verb_action_layer_perform()
1257 /** \brief Decode the verb code and take appropriate action */
1258 void
1259 ObjectVerb::perform( SPAction *action, void *data, void */*pdata*/ )
1260 {
1261 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1262 if (!dt)
1263 return;
1265 SPEventContext *ec = dt->event_context;
1267 Inkscape::Selection *sel = sp_desktop_selection(dt);
1269 if (sel->isEmpty())
1270 return;
1272 NR::Maybe<NR::Rect> bbox = sel->bounds();
1273 if (!bbox) {
1274 return;
1275 }
1276 // If the rotation center of the selection is visible, choose it as reference point
1277 // for horizontal and vertical flips. Otherwise, take the center of the bounding box.
1278 NR::Point center;
1279 if (tools_isactive(dt, TOOLS_SELECT) && sel->center() && SP_SELECT_CONTEXT(ec)->_seltrans->centerIsVisible())
1280 center = *sel->center();
1281 else
1282 center = bbox->midpoint();
1284 switch (reinterpret_cast<std::size_t>(data)) {
1285 case SP_VERB_OBJECT_ROTATE_90_CW:
1286 sp_selection_rotate_90_cw();
1287 break;
1288 case SP_VERB_OBJECT_ROTATE_90_CCW:
1289 sp_selection_rotate_90_ccw();
1290 break;
1291 case SP_VERB_OBJECT_FLATTEN:
1292 sp_selection_remove_transform();
1293 break;
1294 case SP_VERB_OBJECT_TO_CURVE:
1295 sp_selected_path_to_curves();
1296 break;
1297 case SP_VERB_OBJECT_FLOW_TEXT:
1298 text_flow_into_shape();
1299 break;
1300 case SP_VERB_OBJECT_UNFLOW_TEXT:
1301 text_unflow();
1302 break;
1303 case SP_VERB_OBJECT_FLOWTEXT_TO_TEXT:
1304 flowtext_to_text();
1305 break;
1306 case SP_VERB_OBJECT_FLIP_HORIZONTAL:
1307 // When working with the node tool ...
1308 if (tools_isactive(dt, TOOLS_NODES)) {
1309 Inkscape::NodePath::Node *active_node = Inkscape::NodePath::Path::active_node;
1311 // ... and one of the nodes is currently mouseovered ...
1312 if (active_node) {
1314 // ... flip the selected nodes about that node
1315 SP_NODE_CONTEXT(ec)->shape_editor->flip(NR::X, active_node->pos);
1316 } else {
1318 // ... or else about the center of their bounding box.
1319 SP_NODE_CONTEXT(ec)->shape_editor->flip(NR::X);
1320 }
1322 // When working with the selector tool, flip the selection about its rotation center
1323 // (if it is visible) or about the center of the bounding box.
1324 } else {
1325 sp_selection_scale_relative(sel, center, NR::scale(-1.0, 1.0));
1326 }
1327 sp_document_done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_HORIZONTAL,
1328 _("Flip horizontally"));
1329 break;
1330 case SP_VERB_OBJECT_FLIP_VERTICAL:
1331 // The behaviour is analogous to flipping horizontally
1332 if (tools_isactive(dt, TOOLS_NODES)) {
1333 Inkscape::NodePath::Node *active_node = Inkscape::NodePath::Path::active_node;
1334 if (active_node) {
1335 SP_NODE_CONTEXT(ec)->shape_editor->flip(NR::Y, active_node->pos);
1336 } else {
1337 SP_NODE_CONTEXT(ec)->shape_editor->flip(NR::Y);
1338 }
1339 } else {
1340 sp_selection_scale_relative(sel, center, NR::scale(1.0, -1.0));
1341 }
1342 sp_document_done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_VERTICAL,
1343 _("Flip vertically"));
1344 break;
1345 case SP_VERB_OBJECT_SET_MASK:
1346 sp_selection_set_mask(false, false);
1347 break;
1348 case SP_VERB_OBJECT_EDIT_MASK:
1349 sp_selection_edit_clip_or_mask(dt, false);
1350 break;
1351 case SP_VERB_OBJECT_UNSET_MASK:
1352 sp_selection_unset_mask(false);
1353 break;
1354 case SP_VERB_OBJECT_SET_CLIPPATH:
1355 sp_selection_set_mask(true, false);
1356 break;
1357 case SP_VERB_OBJECT_EDIT_CLIPPATH:
1358 sp_selection_edit_clip_or_mask(dt, true);
1359 break;
1360 case SP_VERB_OBJECT_UNSET_CLIPPATH:
1361 sp_selection_unset_mask(true);
1362 break;
1363 default:
1364 break;
1365 }
1367 } // end of sp_verb_action_object_perform()
1369 /** \brief Decode the verb code and take appropriate action */
1370 void
1371 ContextVerb::perform(SPAction *action, void *data, void */*pdata*/)
1372 {
1373 SPDesktop *dt;
1374 sp_verb_t verb;
1375 int vidx;
1377 dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1379 if (!dt)
1380 return;
1382 verb = (sp_verb_t)GPOINTER_TO_INT((gpointer)data);
1384 /** \todo !!! hopefully this can go away soon and actions can look after
1385 * themselves
1386 */
1387 for (vidx = SP_VERB_CONTEXT_SELECT; vidx <= SP_VERB_CONTEXT_PAINTBUCKET_PREFS; vidx++)
1388 {
1389 SPAction *tool_action= get((sp_verb_t)vidx)->get_action(dt);
1390 if (tool_action) {
1391 sp_action_set_active(tool_action, vidx == (int)verb);
1392 }
1393 }
1395 switch (verb) {
1396 case SP_VERB_CONTEXT_SELECT:
1397 tools_switch_current(TOOLS_SELECT);
1398 break;
1399 case SP_VERB_CONTEXT_NODE:
1400 tools_switch_current(TOOLS_NODES);
1401 break;
1402 case SP_VERB_CONTEXT_TWEAK:
1403 tools_switch_current(TOOLS_TWEAK);
1404 break;
1405 case SP_VERB_CONTEXT_RECT:
1406 tools_switch_current(TOOLS_SHAPES_RECT);
1407 break;
1408 case SP_VERB_CONTEXT_3DBOX:
1409 tools_switch_current(TOOLS_SHAPES_3DBOX);
1410 break;
1411 case SP_VERB_CONTEXT_ARC:
1412 tools_switch_current(TOOLS_SHAPES_ARC);
1413 break;
1414 case SP_VERB_CONTEXT_STAR:
1415 tools_switch_current(TOOLS_SHAPES_STAR);
1416 break;
1417 case SP_VERB_CONTEXT_SPIRAL:
1418 tools_switch_current(TOOLS_SHAPES_SPIRAL);
1419 break;
1420 case SP_VERB_CONTEXT_PENCIL:
1421 tools_switch_current(TOOLS_FREEHAND_PENCIL);
1422 break;
1423 case SP_VERB_CONTEXT_PEN:
1424 tools_switch_current(TOOLS_FREEHAND_PEN);
1425 break;
1426 case SP_VERB_CONTEXT_CALLIGRAPHIC:
1427 tools_switch_current(TOOLS_CALLIGRAPHIC);
1428 break;
1429 case SP_VERB_CONTEXT_TEXT:
1430 tools_switch_current(TOOLS_TEXT);
1431 break;
1432 case SP_VERB_CONTEXT_GRADIENT:
1433 tools_switch_current(TOOLS_GRADIENT);
1434 break;
1435 case SP_VERB_CONTEXT_ZOOM:
1436 tools_switch_current(TOOLS_ZOOM);
1437 break;
1438 case SP_VERB_CONTEXT_DROPPER:
1439 tools_switch_current(TOOLS_DROPPER);
1440 break;
1441 case SP_VERB_CONTEXT_CONNECTOR:
1442 tools_switch_current (TOOLS_CONNECTOR);
1443 break;
1444 case SP_VERB_CONTEXT_PAINTBUCKET:
1445 tools_switch_current(TOOLS_PAINTBUCKET);
1446 break;
1448 case SP_VERB_CONTEXT_SELECT_PREFS:
1449 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SELECTOR);
1450 dt->_dlg_mgr->showDialog("InkscapePreferences");
1451 break;
1452 case SP_VERB_CONTEXT_NODE_PREFS:
1453 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_NODE);
1454 dt->_dlg_mgr->showDialog("InkscapePreferences");
1455 break;
1456 case SP_VERB_CONTEXT_TWEAK_PREFS:
1457 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_TWEAK);
1458 dt->_dlg_mgr->showDialog("InkscapePreferences");
1459 break;
1460 case SP_VERB_CONTEXT_RECT_PREFS:
1461 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SHAPES_RECT);
1462 dt->_dlg_mgr->showDialog("InkscapePreferences");
1463 break;
1464 case SP_VERB_CONTEXT_3DBOX_PREFS:
1465 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SHAPES_3DBOX);
1466 dt->_dlg_mgr->showDialog("InkscapePreferences");
1467 break;
1468 case SP_VERB_CONTEXT_ARC_PREFS:
1469 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SHAPES_ELLIPSE);
1470 dt->_dlg_mgr->showDialog("InkscapePreferences");
1471 break;
1472 case SP_VERB_CONTEXT_STAR_PREFS:
1473 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SHAPES_STAR);
1474 dt->_dlg_mgr->showDialog("InkscapePreferences");
1475 break;
1476 case SP_VERB_CONTEXT_SPIRAL_PREFS:
1477 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SHAPES_SPIRAL);
1478 dt->_dlg_mgr->showDialog("InkscapePreferences");
1479 break;
1480 case SP_VERB_CONTEXT_PENCIL_PREFS:
1481 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_PENCIL);
1482 dt->_dlg_mgr->showDialog("InkscapePreferences");
1483 break;
1484 case SP_VERB_CONTEXT_PEN_PREFS:
1485 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_PEN);
1486 dt->_dlg_mgr->showDialog("InkscapePreferences");
1487 break;
1488 case SP_VERB_CONTEXT_CALLIGRAPHIC_PREFS:
1489 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_CALLIGRAPHY);
1490 dt->_dlg_mgr->showDialog("InkscapePreferences");
1491 break;
1492 case SP_VERB_CONTEXT_TEXT_PREFS:
1493 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_TEXT);
1494 dt->_dlg_mgr->showDialog("InkscapePreferences");
1495 break;
1496 case SP_VERB_CONTEXT_GRADIENT_PREFS:
1497 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_GRADIENT);
1498 dt->_dlg_mgr->showDialog("InkscapePreferences");
1499 break;
1500 case SP_VERB_CONTEXT_ZOOM_PREFS:
1501 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_ZOOM);
1502 dt->_dlg_mgr->showDialog("InkscapePreferences");
1503 break;
1504 case SP_VERB_CONTEXT_DROPPER_PREFS:
1505 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_DROPPER);
1506 dt->_dlg_mgr->showDialog("InkscapePreferences");
1507 break;
1508 case SP_VERB_CONTEXT_CONNECTOR_PREFS:
1509 prefs_set_int_attribute ("dialogs.preferences", "page", PREFS_PAGE_TOOLS_CONNECTOR);
1510 dt->_dlg_mgr->showDialog("InkscapePreferences");
1511 break;
1512 case SP_VERB_CONTEXT_PAINTBUCKET_PREFS:
1513 prefs_set_int_attribute ("dialogs.preferences", "page", PREFS_PAGE_TOOLS_PAINTBUCKET);
1514 dt->_dlg_mgr->showDialog("InkscapePreferences");
1515 break;
1517 default:
1518 break;
1519 }
1521 } // end of sp_verb_action_ctx_perform()
1523 /** \brief Decode the verb code and take appropriate action */
1524 void
1525 TextVerb::perform(SPAction *action, void */*data*/, void */*pdata*/)
1526 {
1527 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1528 if (!dt)
1529 return;
1531 SPDocument *doc = sp_desktop_document(dt);
1532 (void)doc;
1533 Inkscape::XML::Node *repr = SP_OBJECT_REPR(dt->namedview);
1534 (void)repr;
1535 }
1537 /** \brief Decode the verb code and take appropriate action */
1538 void
1539 ZoomVerb::perform(SPAction *action, void *data, void */*pdata*/)
1540 {
1541 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1542 if (!dt)
1543 return;
1544 SPEventContext *ec = dt->event_context;
1546 SPDocument *doc = sp_desktop_document(dt);
1548 Inkscape::XML::Node *repr = SP_OBJECT_REPR(dt->namedview);
1550 gdouble zoom_inc =
1551 prefs_get_double_attribute_limited( "options.zoomincrement",
1552 "value", 1.414213562, 1.01, 10 );
1554 switch (GPOINTER_TO_INT(data)) {
1555 case SP_VERB_ZOOM_IN:
1556 {
1557 gint mul = 1 + gobble_key_events(
1558 GDK_KP_Add, 0); // with any mask
1559 // While drawing with the pen/pencil tool, zoom towards the end of the unfinished path
1560 if (tools_isactive(dt, TOOLS_FREEHAND_PENCIL) || tools_isactive(dt, TOOLS_FREEHAND_PEN)) {
1561 SPCurve *rc = SP_DRAW_CONTEXT(ec)->red_curve;
1562 if (sp_curve_last_bpath(rc)) {
1563 NR::Point const zoom_to (sp_curve_last_point(rc));
1564 dt->zoom_relative_keep_point(zoom_to, mul*zoom_inc);
1565 break;
1566 }
1567 }
1569 NR::Rect const d = dt->get_display_area();
1570 dt->zoom_relative( d.midpoint()[NR::X], d.midpoint()[NR::Y], mul*zoom_inc);
1571 break;
1572 }
1573 case SP_VERB_ZOOM_OUT:
1574 {
1575 gint mul = 1 + gobble_key_events(
1576 GDK_KP_Subtract, 0); // with any mask
1577 // While drawing with the pen/pencil tool, zoom away from the end of the unfinished path
1578 if (tools_isactive(dt, TOOLS_FREEHAND_PENCIL) || tools_isactive(dt, TOOLS_FREEHAND_PEN)) {
1579 SPCurve *rc = SP_DRAW_CONTEXT(ec)->red_curve;
1580 if (sp_curve_last_bpath(rc)) {
1581 NR::Point const zoom_to (sp_curve_last_point(rc));
1582 dt->zoom_relative_keep_point(zoom_to, 1 / (mul*zoom_inc));
1583 break;
1584 }
1585 }
1587 NR::Rect const d = dt->get_display_area();
1588 dt->zoom_relative( d.midpoint()[NR::X], d.midpoint()[NR::Y], 1 / (mul*zoom_inc) );
1589 break;
1590 }
1591 case SP_VERB_ZOOM_1_1:
1592 {
1593 NR::Rect const d = dt->get_display_area();
1594 dt->zoom_absolute( d.midpoint()[NR::X], d.midpoint()[NR::Y], 1.0 );
1595 break;
1596 }
1597 case SP_VERB_ZOOM_1_2:
1598 {
1599 NR::Rect const d = dt->get_display_area();
1600 dt->zoom_absolute( d.midpoint()[NR::X], d.midpoint()[NR::Y], 0.5);
1601 break;
1602 }
1603 case SP_VERB_ZOOM_2_1:
1604 {
1605 NR::Rect const d = dt->get_display_area();
1606 dt->zoom_absolute( d.midpoint()[NR::X], d.midpoint()[NR::Y], 2.0 );
1607 break;
1608 }
1609 case SP_VERB_ZOOM_PAGE:
1610 dt->zoom_page();
1611 break;
1612 case SP_VERB_ZOOM_PAGE_WIDTH:
1613 dt->zoom_page_width();
1614 break;
1615 case SP_VERB_ZOOM_DRAWING:
1616 dt->zoom_drawing();
1617 break;
1618 case SP_VERB_ZOOM_SELECTION:
1619 dt->zoom_selection();
1620 break;
1621 case SP_VERB_ZOOM_NEXT:
1622 dt->next_zoom();
1623 break;
1624 case SP_VERB_ZOOM_PREV:
1625 dt->prev_zoom();
1626 break;
1627 case SP_VERB_TOGGLE_RULERS:
1628 dt->toggleRulers();
1629 break;
1630 case SP_VERB_TOGGLE_SCROLLBARS:
1631 dt->toggleScrollbars();
1632 break;
1633 case SP_VERB_TOGGLE_GUIDES:
1634 sp_namedview_toggle_guides(doc, repr);
1635 break;
1636 case SP_VERB_TOGGLE_SNAPPING:
1637 dt->toggleSnapping();
1638 break;
1639 case SP_VERB_TOGGLE_GRID:
1640 dt->toggleGrids();
1641 break;
1642 #ifdef HAVE_GTK_WINDOW_FULLSCREEN
1643 case SP_VERB_FULLSCREEN:
1644 dt->fullscreen();
1645 break;
1646 #endif /* HAVE_GTK_WINDOW_FULLSCREEN */
1647 case SP_VERB_VIEW_NEW:
1648 sp_ui_new_view();
1649 break;
1650 case SP_VERB_VIEW_NEW_PREVIEW:
1651 sp_ui_new_view_preview();
1652 break;
1653 case SP_VERB_VIEW_MODE_NORMAL:
1654 dt->setDisplayModeNormal();
1655 break;
1656 case SP_VERB_VIEW_MODE_OUTLINE:
1657 dt->setDisplayModeOutline();
1658 break;
1659 case SP_VERB_VIEW_MODE_TOGGLE:
1660 dt->displayModeToggle();
1661 break;
1662 case SP_VERB_VIEW_CMS_TOGGLE:
1663 dt->toggleColorProfAdjust();
1664 break;
1665 case SP_VERB_VIEW_ICON_PREVIEW:
1666 inkscape_dialogs_unhide();
1667 dt->_dlg_mgr->showDialog("IconPreviewPanel");
1668 break;
1669 default:
1670 break;
1671 }
1673 dt->updateNow();
1675 } // end of sp_verb_action_zoom_perform()
1677 /** \brief Decode the verb code and take appropriate action */
1678 void
1679 DialogVerb::perform(SPAction *action, void *data, void */*pdata*/)
1680 {
1681 if (reinterpret_cast<std::size_t>(data) != SP_VERB_DIALOG_TOGGLE) {
1682 // unhide all when opening a new dialog
1683 inkscape_dialogs_unhide();
1684 }
1686 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1687 g_assert(dt->_dlg_mgr != NULL);
1689 switch (reinterpret_cast<std::size_t>(data)) {
1690 case SP_VERB_DIALOG_DISPLAY:
1691 //sp_display_dialog();
1692 dt->_dlg_mgr->showDialog("InkscapePreferences");
1693 break;
1694 case SP_VERB_DIALOG_METADATA:
1695 // sp_desktop_dialog();
1696 dt->_dlg_mgr->showDialog("DocumentMetadata");
1697 break;
1698 case SP_VERB_DIALOG_NAMEDVIEW:
1699 // sp_desktop_dialog();
1700 dt->_dlg_mgr->showDialog("DocumentProperties");
1701 break;
1702 case SP_VERB_DIALOG_FILL_STROKE:
1703 dt->_dlg_mgr->showDialog("FillAndStroke");
1704 break;
1705 case SP_VERB_DIALOG_SWATCHES:
1706 dt->_dlg_mgr->showDialog("Swatches");
1707 break;
1708 case SP_VERB_DIALOG_TRANSFORM:
1709 dt->_dlg_mgr->showDialog("Transformation");
1710 break;
1711 case SP_VERB_DIALOG_ALIGN_DISTRIBUTE:
1712 dt->_dlg_mgr->showDialog("AlignAndDistribute");
1713 break;
1714 case SP_VERB_DIALOG_TEXT:
1715 sp_text_edit_dialog();
1716 break;
1717 case SP_VERB_DIALOG_XML_EDITOR:
1718 sp_xml_tree_dialog();
1719 break;
1720 case SP_VERB_DIALOG_FIND:
1721 sp_find_dialog();
1722 // Please test the new find dialog if you have time:
1723 // dt->_dlg_mgr->showDialog("Find");
1724 break;
1725 case SP_VERB_DIALOG_DEBUG:
1726 dt->_dlg_mgr->showDialog("Messages");
1727 break;
1728 case SP_VERB_DIALOG_SCRIPT:
1729 dt->_dlg_mgr->showDialog("Script");
1730 break;
1731 case SP_VERB_DIALOG_UNDO_HISTORY:
1732 dt->_dlg_mgr->showDialog("UndoHistory");
1733 break;
1734 case SP_VERB_DIALOG_TOGGLE:
1735 inkscape_dialogs_toggle();
1736 break;
1737 case SP_VERB_DIALOG_CLONETILER:
1738 clonetiler_dialog();
1739 break;
1740 case SP_VERB_DIALOG_ITEM:
1741 sp_item_dialog();
1742 break;
1743 #ifdef WITH_INKBOARD
1744 case SP_VERB_XMPP_CLIENT:
1745 {
1746 Inkscape::Whiteboard::SessionManager::showClient();
1747 break;
1748 }
1749 #endif
1750 case SP_VERB_DIALOG_INPUT:
1751 #ifdef USE_NEW_INPUT_DEVICES
1752 dt->_dlg_mgr->showDialog("InputDevices");
1753 #else
1754 sp_input_dialog();
1755 #endif
1756 break;
1757 case SP_VERB_DIALOG_EXTENSIONEDITOR:
1758 dt->_dlg_mgr->showDialog("ExtensionEditor");
1759 break;
1760 case SP_VERB_DIALOG_LAYERS:
1761 dt->_dlg_mgr->showDialog("LayersPanel");
1762 break;
1763 case SP_VERB_DIALOG_LIVE_PATH_EFFECT:
1764 dt->_dlg_mgr->showDialog("LivePathEffect");
1765 break;
1766 case SP_VERB_DIALOG_FILTER_EFFECTS:
1767 dt->_dlg_mgr->showDialog("FilterEffectsDialog");
1768 break;
1769 default:
1770 break;
1771 }
1772 } // end of sp_verb_action_dialog_perform()
1774 /** \brief Decode the verb code and take appropriate action */
1775 void
1776 HelpVerb::perform(SPAction *action, void *data, void */*pdata*/)
1777 {
1778 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1779 g_assert(dt->_dlg_mgr != NULL);
1781 switch (reinterpret_cast<std::size_t>(data)) {
1782 case SP_VERB_HELP_ABOUT:
1783 sp_help_about();
1784 break;
1785 case SP_VERB_HELP_ABOUT_EXTENSIONS: {
1786 // Inkscape::UI::Dialogs::ExtensionsPanel *panel = new Inkscape::UI::Dialogs::ExtensionsPanel();
1787 // panel->set_full(true);
1788 // show_panel( *panel, "dialogs.aboutextensions", SP_VERB_HELP_ABOUT_EXTENSIONS );
1789 break;
1790 }
1792 /*
1793 case SP_VERB_SHOW_LICENSE:
1794 // TRANSLATORS: See "tutorial-basic.svg" comment.
1795 sp_help_open_tutorial(NULL, (gpointer) _("gpl-2.svg"));
1796 break;
1797 */
1799 case SP_VERB_HELP_MEMORY:
1800 inkscape_dialogs_unhide();
1801 dt->_dlg_mgr->showDialog("Memory");
1802 break;
1803 default:
1804 break;
1805 }
1806 } // end of sp_verb_action_help_perform()
1808 /** \brief Decode the verb code and take appropriate action */
1809 void
1810 TutorialVerb::perform(SPAction */*action*/, void *data, void */*pdata*/)
1811 {
1812 switch (reinterpret_cast<std::size_t>(data)) {
1813 case SP_VERB_TUTORIAL_BASIC:
1814 /* TRANSLATORS: If you have translated the tutorial-basic.svg file to your language,
1815 then translate this string as "tutorial-basic.LANG.svg" (where LANG is your language
1816 code); otherwise leave as "tutorial-basic.svg". */
1817 sp_help_open_tutorial(NULL, (gpointer)_("tutorial-basic.svg"));
1818 break;
1819 case SP_VERB_TUTORIAL_SHAPES:
1820 // TRANSLATORS: See "tutorial-basic.svg" comment.
1821 sp_help_open_tutorial(NULL, (gpointer)_("tutorial-shapes.svg"));
1822 break;
1823 case SP_VERB_TUTORIAL_ADVANCED:
1824 // TRANSLATORS: See "tutorial-basic.svg" comment.
1825 sp_help_open_tutorial(NULL, (gpointer)_("tutorial-advanced.svg"));
1826 break;
1827 case SP_VERB_TUTORIAL_TRACING:
1828 // TRANSLATORS: See "tutorial-basic.svg" comment.
1829 sp_help_open_tutorial(NULL, (gpointer)_("tutorial-tracing.svg"));
1830 break;
1831 case SP_VERB_TUTORIAL_CALLIGRAPHY:
1832 // TRANSLATORS: See "tutorial-basic.svg" comment.
1833 sp_help_open_tutorial(NULL, (gpointer)_("tutorial-calligraphy.svg"));
1834 break;
1835 case SP_VERB_TUTORIAL_DESIGN:
1836 // TRANSLATORS: See "tutorial-basic.svg" comment.
1837 sp_help_open_tutorial(NULL, (gpointer)_("tutorial-elements.svg"));
1838 break;
1839 case SP_VERB_TUTORIAL_TIPS:
1840 // TRANSLATORS: See "tutorial-basic.svg" comment.
1841 sp_help_open_tutorial(NULL, (gpointer)_("tutorial-tips.svg"));
1842 break;
1843 default:
1844 break;
1845 }
1846 } // end of sp_verb_action_tutorial_perform()
1849 /**
1850 * Action vector to define functions called if a staticly defined file verb
1851 * is called.
1852 */
1853 SPActionEventVector FileVerb::vector =
1854 {{NULL},FileVerb::perform, NULL, NULL, NULL, NULL};
1855 /**
1856 * Action vector to define functions called if a staticly defined edit verb is
1857 * called.
1858 */
1859 SPActionEventVector EditVerb::vector =
1860 {{NULL},EditVerb::perform, NULL, NULL, NULL, NULL};
1862 /**
1863 * Action vector to define functions called if a staticly defined selection
1864 * verb is called
1865 */
1866 SPActionEventVector SelectionVerb::vector =
1867 {{NULL},SelectionVerb::perform, NULL, NULL, NULL, NULL};
1869 /**
1870 * Action vector to define functions called if a staticly defined layer
1871 * verb is called
1872 */
1873 SPActionEventVector LayerVerb::vector =
1874 {{NULL}, LayerVerb::perform, NULL, NULL, NULL, NULL};
1876 /**
1877 * Action vector to define functions called if a staticly defined object
1878 * editing verb is called
1879 */
1880 SPActionEventVector ObjectVerb::vector =
1881 {{NULL},ObjectVerb::perform, NULL, NULL, NULL, NULL};
1883 /**
1884 * Action vector to define functions called if a staticly defined context
1885 * verb is called
1886 */
1887 SPActionEventVector ContextVerb::vector =
1888 {{NULL},ContextVerb::perform, NULL, NULL, NULL, NULL};
1890 /**
1891 * Action vector to define functions called if a staticly defined zoom verb
1892 * is called
1893 */
1894 SPActionEventVector ZoomVerb::vector =
1895 {{NULL},ZoomVerb::perform, NULL, NULL, NULL, NULL};
1898 /**
1899 * Action vector to define functions called if a staticly defined dialog verb
1900 * is called
1901 */
1902 SPActionEventVector DialogVerb::vector =
1903 {{NULL},DialogVerb::perform, NULL, NULL, NULL, NULL};
1905 /**
1906 * Action vector to define functions called if a staticly defined help verb
1907 * is called
1908 */
1909 SPActionEventVector HelpVerb::vector =
1910 {{NULL},HelpVerb::perform, NULL, NULL, NULL, NULL};
1912 /**
1913 * Action vector to define functions called if a staticly defined tutorial verb
1914 * is called
1915 */
1916 SPActionEventVector TutorialVerb::vector =
1917 {{NULL},TutorialVerb::perform, NULL, NULL, NULL, NULL};
1919 /**
1920 * Action vector to define functions called if a staticly defined tutorial verb
1921 * is called
1922 */
1923 SPActionEventVector TextVerb::vector =
1924 {{NULL},TextVerb::perform, NULL, NULL, NULL, NULL};
1927 /* *********** Effect Last ********** */
1929 /** \brief A class to represent the last effect issued */
1930 class EffectLastVerb : public Verb {
1931 private:
1932 static void perform(SPAction *action, void *mydata, void *otherdata);
1933 static SPActionEventVector vector;
1934 protected:
1935 virtual SPAction *make_action(Inkscape::UI::View::View *view);
1936 public:
1937 /** \brief Use the Verb initializer with the same parameters. */
1938 EffectLastVerb(unsigned int const code,
1939 gchar const *id,
1940 gchar const *name,
1941 gchar const *tip,
1942 gchar const *image) :
1943 Verb(code, id, name, tip, image)
1944 {
1945 set_default_sensitive(false);
1946 }
1947 }; /* EffectLastVerb class */
1949 /**
1950 * The vector to attach in the last effect verb.
1951 */
1952 SPActionEventVector EffectLastVerb::vector =
1953 {{NULL},EffectLastVerb::perform, NULL, NULL, NULL, NULL};
1955 /** \brief Create an action for a \c EffectLastVerb
1956 \param view Which view the action should be created for
1957 \return The built action.
1959 Calls \c make_action_helper with the \c vector.
1960 */
1961 SPAction *
1962 EffectLastVerb::make_action(Inkscape::UI::View::View *view)
1963 {
1964 return make_action_helper(view, &vector);
1965 }
1967 /** \brief Decode the verb code and take appropriate action */
1968 void
1969 EffectLastVerb::perform(SPAction *action, void *data, void */*pdata*/)
1970 {
1971 /* These aren't used, but are here to remind people not to use
1972 the CURRENT_DOCUMENT macros unless they really have to. */
1973 Inkscape::UI::View::View *current_view = sp_action_get_view(action);
1974 // SPDocument *current_document = SP_VIEW_DOCUMENT(current_view);
1975 Inkscape::Extension::Effect *effect = Inkscape::Extension::Effect::get_last_effect();
1977 if (effect == NULL) return;
1978 if (current_view == NULL) return;
1980 switch ((long) data) {
1981 case SP_VERB_EFFECT_LAST_PREF:
1982 effect->prefs(current_view);
1983 break;
1984 case SP_VERB_EFFECT_LAST:
1985 effect->effect(current_view);
1986 break;
1987 default:
1988 return;
1989 }
1991 return;
1992 }
1993 /* *********** End Effect Last ********** */
1995 /* *********** Fit Canvas ********** */
1997 /** \brief A class to represent the canvas fitting verbs */
1998 class FitCanvasVerb : public Verb {
1999 private:
2000 static void perform(SPAction *action, void *mydata, void *otherdata);
2001 static SPActionEventVector vector;
2002 protected:
2003 virtual SPAction *make_action(Inkscape::UI::View::View *view);
2004 public:
2005 /** \brief Use the Verb initializer with the same parameters. */
2006 FitCanvasVerb(unsigned int const code,
2007 gchar const *id,
2008 gchar const *name,
2009 gchar const *tip,
2010 gchar const *image) :
2011 Verb(code, id, name, tip, image)
2012 {
2013 set_default_sensitive(false);
2014 }
2015 }; /* FitCanvasVerb class */
2017 /**
2018 * The vector to attach in the fit canvas verb.
2019 */
2020 SPActionEventVector FitCanvasVerb::vector =
2021 {{NULL},FitCanvasVerb::perform, NULL, NULL, NULL, NULL};
2023 /** \brief Create an action for a \c FitCanvasVerb
2024 \param view Which view the action should be created for
2025 \return The built action.
2027 Calls \c make_action_helper with the \c vector.
2028 */
2029 SPAction *
2030 FitCanvasVerb::make_action(Inkscape::UI::View::View *view)
2031 {
2032 SPAction *action = make_action_helper(view, &vector);
2033 return action;
2034 }
2036 /** \brief Decode the verb code and take appropriate action */
2037 void
2038 FitCanvasVerb::perform(SPAction *action, void *data, void */*pdata*/)
2039 {
2040 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
2041 if (!dt) return;
2042 SPDocument *doc = sp_desktop_document(dt);
2043 if (!doc) return;
2045 switch ((long) data) {
2046 case SP_VERB_FIT_CANVAS_TO_SELECTION:
2047 fit_canvas_to_selection(dt);
2048 break;
2049 case SP_VERB_FIT_CANVAS_TO_DRAWING:
2050 fit_canvas_to_drawing(doc);
2051 break;
2052 case SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING:
2053 fit_canvas_to_selection_or_drawing(dt);
2054 break;
2055 default:
2056 return;
2057 }
2059 return;
2060 }
2061 /* *********** End Fit Canvas ********** */
2064 /* *********** Lock'N'Hide ********** */
2066 /** \brief A class to represent the object unlocking and unhiding verbs */
2067 class LockAndHideVerb : public Verb {
2068 private:
2069 static void perform(SPAction *action, void *mydata, void *otherdata);
2070 static SPActionEventVector vector;
2071 protected:
2072 virtual SPAction *make_action(Inkscape::UI::View::View *view);
2073 public:
2074 /** \brief Use the Verb initializer with the same parameters. */
2075 LockAndHideVerb(unsigned int const code,
2076 gchar const *id,
2077 gchar const *name,
2078 gchar const *tip,
2079 gchar const *image) :
2080 Verb(code, id, name, tip, image)
2081 {
2082 set_default_sensitive(true);
2083 }
2084 }; /* LockAndHideVerb class */
2086 /**
2087 * The vector to attach in the lock'n'hide verb.
2088 */
2089 SPActionEventVector LockAndHideVerb::vector =
2090 {{NULL},LockAndHideVerb::perform, NULL, NULL, NULL, NULL};
2092 /** \brief Create an action for a \c LockAndHideVerb
2093 \param view Which view the action should be created for
2094 \return The built action.
2096 Calls \c make_action_helper with the \c vector.
2097 */
2098 SPAction *
2099 LockAndHideVerb::make_action(Inkscape::UI::View::View *view)
2100 {
2101 SPAction *action = make_action_helper(view, &vector);
2102 return action;
2103 }
2105 /** \brief Decode the verb code and take appropriate action */
2106 void
2107 LockAndHideVerb::perform(SPAction *action, void *data, void */*pdata*/)
2108 {
2109 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
2110 if (!dt) return;
2111 SPDocument *doc = sp_desktop_document(dt);
2112 if (!doc) return;
2114 switch ((long) data) {
2115 case SP_VERB_UNLOCK_ALL:
2116 unlock_all(dt);
2117 sp_document_done(doc, SP_VERB_UNLOCK_ALL, _("Unlock all objects in the current layer"));
2118 break;
2119 case SP_VERB_UNLOCK_ALL_IN_ALL_LAYERS:
2120 unlock_all_in_all_layers(dt);
2121 sp_document_done(doc, SP_VERB_UNLOCK_ALL_IN_ALL_LAYERS, _("Unlock all objects in all layers"));
2122 break;
2123 case SP_VERB_UNHIDE_ALL:
2124 unhide_all(dt);
2125 sp_document_done(doc, SP_VERB_UNHIDE_ALL, _("Unhide all objects in the current layer"));
2126 break;
2127 case SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS:
2128 unhide_all_in_all_layers(dt);
2129 sp_document_done(doc, SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS, _("Unhide all objects in all layers"));
2130 break;
2131 default:
2132 return;
2133 }
2135 return;
2136 }
2137 /* *********** End Lock'N'Hide ********** */
2140 /* these must be in the same order as the SP_VERB_* enum in "verbs.h" */
2141 Verb *Verb::_base_verbs[] = {
2142 /* Header */
2143 new Verb(SP_VERB_INVALID, NULL, NULL, NULL, NULL),
2144 new Verb(SP_VERB_NONE, "None", N_("None"), N_("Does nothing"), NULL),
2146 /* File */
2147 new FileVerb(SP_VERB_FILE_NEW, "FileNew", N_("Default"), N_("Create new document from the default template"),
2148 GTK_STOCK_NEW ),
2149 new FileVerb(SP_VERB_FILE_OPEN, "FileOpen", N_("_Open..."),
2150 N_("Open an existing document"), GTK_STOCK_OPEN ),
2151 new FileVerb(SP_VERB_FILE_REVERT, "FileRevert", N_("Re_vert"),
2152 N_("Revert to the last saved version of document (changes will be lost)"), GTK_STOCK_REVERT_TO_SAVED ),
2153 new FileVerb(SP_VERB_FILE_SAVE, "FileSave", N_("_Save"), N_("Save document"),
2154 GTK_STOCK_SAVE ),
2155 new FileVerb(SP_VERB_FILE_SAVE_AS, "FileSaveAs", N_("Save _As..."),
2156 N_("Save document under a new name"), GTK_STOCK_SAVE_AS ),
2157 new FileVerb(SP_VERB_FILE_SAVE_A_COPY, "FileSaveACopy", N_("Save a Cop_y..."),
2158 N_("Save a copy of the document under a new name"), NULL ),
2159 new FileVerb(SP_VERB_FILE_PRINT, "FilePrint", N_("_Print..."), N_("Print document"),
2160 GTK_STOCK_PRINT ),
2161 // TRANSLATORS: "Vacuum Defs" means "Clean up defs" (so as to remove unused definitions)
2162 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"),
2163 "file_vacuum" ),
2164 new FileVerb(SP_VERB_FILE_PRINT_PREVIEW, "FilePrintPreview", N_("Print Previe_w"),
2165 N_("Preview document printout"), GTK_STOCK_PRINT_PREVIEW ),
2166 new FileVerb(SP_VERB_FILE_IMPORT, "FileImport", N_("_Import..."),
2167 N_("Import a bitmap or SVG image into this document"), "file_import"),
2168 new FileVerb(SP_VERB_FILE_EXPORT, "FileExport", N_("_Export Bitmap..."),
2169 N_("Export this document or a selection as a bitmap image"), "file_export"),
2170 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"),
2171 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"),
2172 new FileVerb(SP_VERB_FILE_NEXT_DESKTOP, "NextWindow", N_("N_ext Window"),
2173 N_("Switch to the next document window"), "window_next"),
2174 new FileVerb(SP_VERB_FILE_PREV_DESKTOP, "PrevWindow", N_("P_revious Window"),
2175 N_("Switch to the previous document window"), "window_previous"),
2176 new FileVerb(SP_VERB_FILE_CLOSE_VIEW, "FileClose", N_("_Close"),
2177 N_("Close this document window"), GTK_STOCK_CLOSE),
2178 new FileVerb(SP_VERB_FILE_QUIT, "FileQuit", N_("_Quit"), N_("Quit Inkscape"), GTK_STOCK_QUIT),
2180 /* Edit */
2181 new EditVerb(SP_VERB_EDIT_UNDO, "EditUndo", N_("_Undo"), N_("Undo last action"),
2182 GTK_STOCK_UNDO),
2183 new EditVerb(SP_VERB_EDIT_REDO, "EditRedo", N_("_Redo"),
2184 N_("Do again the last undone action"), GTK_STOCK_REDO),
2185 new EditVerb(SP_VERB_EDIT_CUT, "EditCut", N_("Cu_t"),
2186 N_("Cut selection to clipboard"), GTK_STOCK_CUT),
2187 new EditVerb(SP_VERB_EDIT_COPY, "EditCopy", N_("_Copy"),
2188 N_("Copy selection to clipboard"), GTK_STOCK_COPY),
2189 new EditVerb(SP_VERB_EDIT_PASTE, "EditPaste", N_("_Paste"),
2190 N_("Paste objects from clipboard to mouse point, or paste text"), GTK_STOCK_PASTE),
2191 new EditVerb(SP_VERB_EDIT_PASTE_STYLE, "EditPasteStyle", N_("Paste _Style"),
2192 N_("Apply the style of the copied object to selection"), "selection_paste_style"),
2193 new EditVerb(SP_VERB_EDIT_PASTE_SIZE, "EditPasteSize", N_("Paste Si_ze"),
2194 N_("Scale selection to match the size of the copied object"), NULL),
2195 new EditVerb(SP_VERB_EDIT_PASTE_SIZE_X, "EditPasteWidth", N_("Paste _Width"),
2196 N_("Scale selection horizontally to match the width of the copied object"), NULL),
2197 new EditVerb(SP_VERB_EDIT_PASTE_SIZE_Y, "EditPasteHeight", N_("Paste _Height"),
2198 N_("Scale selection vertically to match the height of the copied object"), NULL),
2199 new EditVerb(SP_VERB_EDIT_PASTE_SIZE_SEPARATELY, "EditPasteSizeSeparately", N_("Paste Size Separately"),
2200 N_("Scale each selected object to match the size of the copied object"), NULL),
2201 new EditVerb(SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_X, "EditPasteWidthSeparately", N_("Paste Width Separately"),
2202 N_("Scale each selected object horizontally to match the width of the copied object"), NULL),
2203 new EditVerb(SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_Y, "EditPasteHeightSeparately", N_("Paste Height Separately"),
2204 N_("Scale each selected object vertically to match the height of the copied object"), NULL),
2205 new EditVerb(SP_VERB_EDIT_PASTE_IN_PLACE, "EditPasteInPlace", N_("Paste _In Place"),
2206 N_("Paste objects from clipboard to the original location"), "selection_paste_in_place"),
2207 new EditVerb(SP_VERB_EDIT_PASTE_LIVEPATHEFFECT, "PasteLivePathEffect", N_("Paste Path _Effect"),
2208 N_("Apply the path effect of the copied object to selection"), NULL),
2209 new EditVerb(SP_VERB_EDIT_REMOVE_LIVEPATHEFFECT, "RemoveLivePathEffect", N_("Remove Path _Effect"),
2210 N_("Remove any path effects from selected objects"), NULL),
2211 new EditVerb(SP_VERB_EDIT_DELETE, "EditDelete", N_("_Delete"),
2212 N_("Delete selection"), GTK_STOCK_DELETE),
2213 new EditVerb(SP_VERB_EDIT_DUPLICATE, "EditDuplicate", N_("Duplic_ate"),
2214 N_("Duplicate selected objects"), "edit_duplicate"),
2215 new EditVerb(SP_VERB_EDIT_CLONE, "EditClone", N_("Create Clo_ne"),
2216 N_("Create a clone (a copy linked to the original) of selected object"), "edit_clone"),
2217 new EditVerb(SP_VERB_EDIT_UNLINK_CLONE, "EditUnlinkClone", N_("Unlin_k Clone"),
2218 N_("Cut the selected clone's link to its original, turning it into a standalone object"), "edit_unlink_clone"),
2219 new EditVerb(SP_VERB_EDIT_CLONE_SELECT_ORIGINAL, "EditCloneSelectOriginal", N_("Select _Original"),
2220 N_("Select the object to which the selected clone is linked"), "edit_select_original"),
2221 // TRANSLATORS: Convert selection to a line marker
2222 new EditVerb(SP_VERB_EDIT_SELECTION_2_MARKER, "ObjectsToMarker", N_("Objects to _Marker"),
2223 N_("Convert selection to a line marker"), NULL),
2224 // TRANSLATORS: Convert selection to a collection of guidelines
2225 new EditVerb(SP_VERB_EDIT_SELECTION_2_GUIDES, "ObjectsToGuides", N_("Objects to Gu_ides"),
2226 N_("Convert selected objects to a collection of guidelines aligned with their edges"), NULL),
2227 // TRANSLATORS: Convert selection to a rectangle with tiled pattern fill
2228 new EditVerb(SP_VERB_EDIT_TILE, "ObjectsToPattern", N_("Objects to Patter_n"),
2229 N_("Convert selection to a rectangle with tiled pattern fill"), NULL),
2230 // TRANSLATORS: Extract objects from a tiled pattern fill
2231 new EditVerb(SP_VERB_EDIT_UNTILE, "ObjectsFromPattern", N_("Pattern to _Objects"),
2232 N_("Extract objects from a tiled pattern fill"), NULL),
2233 new EditVerb(SP_VERB_EDIT_CLEAR_ALL, "EditClearAll", N_("Clea_r All"),
2234 N_("Delete all objects from document"), NULL),
2235 new EditVerb(SP_VERB_EDIT_SELECT_ALL, "EditSelectAll", N_("Select Al_l"),
2236 N_("Select all objects or all nodes"), "selection_select_all"),
2237 new EditVerb(SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS, "EditSelectAllInAllLayers", N_("Select All in All La_yers"),
2238 N_("Select all objects in all visible and unlocked layers"), "selection_select_all_in_all_layers"),
2239 new EditVerb(SP_VERB_EDIT_INVERT, "EditInvert", N_("In_vert Selection"),
2240 N_("Invert selection (unselect what is selected and select everything else)"), "selection_invert"),
2241 new EditVerb(SP_VERB_EDIT_INVERT_IN_ALL_LAYERS, "EditInvertInAllLayers", N_("Invert in All Layers"),
2242 N_("Invert selection in all visible and unlocked layers"), NULL),
2243 new EditVerb(SP_VERB_EDIT_SELECT_NEXT, "EditSelectNext", N_("Select Next"),
2244 N_("Select next object or node"), NULL),
2245 new EditVerb(SP_VERB_EDIT_SELECT_PREV, "EditSelectPrev", N_("Select Previous"),
2246 N_("Select previous object or node"), NULL),
2247 new EditVerb(SP_VERB_EDIT_DESELECT, "EditDeselect", N_("D_eselect"),
2248 N_("Deselect any selected objects or nodes"), "selection_deselect"),
2249 new EditVerb(SP_VERB_EDIT_GUIDES_AROUND_PAGE, "EditGuidesAroundPage", N_("_Guides around page"),
2250 N_("Create four guides aligned with the page borders"), NULL),
2251 new EditVerb(SP_VERB_EDIT_NEXT_PATHEFFECT_PARAMETER, "EditNextPathEffectParameter", N_("Next Path Effect Parameter"),
2252 N_("Show next Path Effect parameter for editing"), "edit_next_parameter"),
2254 /* Selection */
2255 new SelectionVerb(SP_VERB_SELECTION_TO_FRONT, "SelectionToFront", N_("Raise to _Top"),
2256 N_("Raise selection to top"), "selection_top"),
2257 new SelectionVerb(SP_VERB_SELECTION_TO_BACK, "SelectionToBack", N_("Lower to _Bottom"),
2258 N_("Lower selection to bottom"), "selection_bot"),
2259 new SelectionVerb(SP_VERB_SELECTION_RAISE, "SelectionRaise", N_("_Raise"),
2260 N_("Raise selection one step"), "selection_up"),
2261 new SelectionVerb(SP_VERB_SELECTION_LOWER, "SelectionLower", N_("_Lower"),
2262 N_("Lower selection one step"), "selection_down"),
2263 new SelectionVerb(SP_VERB_SELECTION_GROUP, "SelectionGroup", N_("_Group"),
2264 N_("Group selected objects"), "selection_group"),
2265 new SelectionVerb(SP_VERB_SELECTION_UNGROUP, "SelectionUnGroup", N_("_Ungroup"),
2266 N_("Ungroup selected groups"), "selection_ungroup"),
2268 new SelectionVerb(SP_VERB_SELECTION_TEXTTOPATH, "SelectionTextToPath", N_("_Put on Path"),
2269 N_("Put text on path"), "put_on_path"),
2270 new SelectionVerb(SP_VERB_SELECTION_TEXTFROMPATH, "SelectionTextFromPath", N_("_Remove from Path"),
2271 N_("Remove text from path"), "remove_from_path"),
2272 new SelectionVerb(SP_VERB_SELECTION_REMOVE_KERNS, "SelectionTextRemoveKerns", N_("Remove Manual _Kerns"),
2273 // TRANSLATORS: "glyph": An image used in the visual representation of characters;
2274 // roughly speaking, how a character looks. A font is a set of glyphs.
2275 N_("Remove all manual kerns and glyph rotations from a text object"), "remove_manual_kerns"),
2277 new SelectionVerb(SP_VERB_SELECTION_UNION, "SelectionUnion", N_("_Union"),
2278 N_("Create union of selected paths"), "union"),
2279 new SelectionVerb(SP_VERB_SELECTION_INTERSECT, "SelectionIntersect", N_("_Intersection"),
2280 N_("Create intersection of selected paths"), "intersection"),
2281 new SelectionVerb(SP_VERB_SELECTION_DIFF, "SelectionDiff", N_("_Difference"),
2282 N_("Create difference of selected paths (bottom minus top)"), "difference"),
2283 new SelectionVerb(SP_VERB_SELECTION_SYMDIFF, "SelectionSymDiff", N_("E_xclusion"),
2284 N_("Create exclusive OR of selected paths (those parts that belong to only one path)"), "exclusion"),
2285 new SelectionVerb(SP_VERB_SELECTION_CUT, "SelectionDivide", N_("Di_vision"),
2286 N_("Cut the bottom path into pieces"), "division"),
2287 // TRANSLATORS: "to cut a path" is not the same as "to break a path apart" - see the
2288 // Advanced tutorial for more info
2289 new SelectionVerb(SP_VERB_SELECTION_SLICE, "SelectionCutPath", N_("Cut _Path"),
2290 N_("Cut the bottom path's stroke into pieces, removing fill"), "cut_path"),
2291 // TRANSLATORS: "outset": expand a shape by offsetting the object's path,
2292 // i.e. by displacing it perpendicular to the path in each point.
2293 // See also the Advanced Tutorial for explanation.
2294 new SelectionVerb(SP_VERB_SELECTION_OFFSET, "SelectionOffset", N_("Outs_et"),
2295 N_("Outset selected paths"), "outset_path"),
2296 new SelectionVerb(SP_VERB_SELECTION_OFFSET_SCREEN, "SelectionOffsetScreen",
2297 N_("O_utset Path by 1 px"),
2298 N_("Outset selected paths by 1 px"), NULL),
2299 new SelectionVerb(SP_VERB_SELECTION_OFFSET_SCREEN_10, "SelectionOffsetScreen10",
2300 N_("O_utset Path by 10 px"),
2301 N_("Outset selected paths by 10 px"), NULL),
2302 // TRANSLATORS: "inset": contract a shape by offsetting the object's path,
2303 // i.e. by displacing it perpendicular to the path in each point.
2304 // See also the Advanced Tutorial for explanation.
2305 new SelectionVerb(SP_VERB_SELECTION_INSET, "SelectionInset", N_("I_nset"),
2306 N_("Inset selected paths"), "inset_path"),
2307 new SelectionVerb(SP_VERB_SELECTION_INSET_SCREEN, "SelectionInsetScreen",
2308 N_("I_nset Path by 1 px"),
2309 N_("Inset selected paths by 1 px"), NULL),
2310 new SelectionVerb(SP_VERB_SELECTION_INSET_SCREEN_10, "SelectionInsetScreen10",
2311 N_("I_nset Path by 10 px"),
2312 N_("Inset selected paths by 10 px"), NULL),
2313 new SelectionVerb(SP_VERB_SELECTION_DYNAMIC_OFFSET, "SelectionDynOffset",
2314 N_("D_ynamic Offset"), N_("Create a dynamic offset object"), "dynamic_offset"),
2315 new SelectionVerb(SP_VERB_SELECTION_LINKED_OFFSET, "SelectionLinkedOffset",
2316 N_("_Linked Offset"),
2317 N_("Create a dynamic offset object linked to the original path"),
2318 "linked_offset"),
2319 new SelectionVerb(SP_VERB_SELECTION_OUTLINE, "StrokeToPath", N_("_Stroke to Path"),
2320 N_("Convert selected object's stroke to paths"), "stroke_tocurve"),
2321 new SelectionVerb(SP_VERB_SELECTION_SIMPLIFY, "SelectionSimplify", N_("Si_mplify"),
2322 N_("Simplify selected paths (remove extra nodes)"), "simplify"),
2323 new SelectionVerb(SP_VERB_SELECTION_REVERSE, "SelectionReverse", N_("_Reverse"),
2324 N_("Reverse the direction of selected paths (useful for flipping markers)"), "selection_reverse"),
2325 // TRANSLATORS: "to trace" means "to convert a bitmap to vector graphics" (to vectorize)
2326 new SelectionVerb(SP_VERB_SELECTION_TRACE, "SelectionTrace", N_("_Trace Bitmap..."),
2327 N_("Create one or more paths from a bitmap by tracing it"), "selection_trace"),
2328 new SelectionVerb(SP_VERB_SELECTION_CREATE_BITMAP, "SelectionCreateBitmap", N_("_Make a Bitmap Copy"),
2329 N_("Export selection to a bitmap and insert it into document"), "selection_bitmap" ),
2330 new SelectionVerb(SP_VERB_SELECTION_COMBINE, "SelectionCombine", N_("_Combine"),
2331 N_("Combine several paths into one"), "selection_combine"),
2332 // TRANSLATORS: "to cut a path" is not the same as "to break a path apart" - see the
2333 // Advanced tutorial for more info
2334 new SelectionVerb(SP_VERB_SELECTION_BREAK_APART, "SelectionBreakApart", N_("Break _Apart"),
2335 N_("Break selected paths into subpaths"), "selection_break"),
2336 new SelectionVerb(SP_VERB_SELECTION_GRIDTILE, "DialogGridArrange", N_("Rows and Columns..."),
2337 N_("Arrange selected objects in a table"), "grid_arrange"),
2338 /* Layer */
2339 new LayerVerb(SP_VERB_LAYER_NEW, "LayerNew", N_("_Add Layer..."),
2340 N_("Create a new layer"), "new_layer"),
2341 new LayerVerb(SP_VERB_LAYER_RENAME, "LayerRename", N_("Re_name Layer..."),
2342 N_("Rename the current layer"), "rename_layer"),
2343 new LayerVerb(SP_VERB_LAYER_NEXT, "LayerNext", N_("Switch to Layer Abov_e"),
2344 N_("Switch to the layer above the current"), "switch_to_layer_above"),
2345 new LayerVerb(SP_VERB_LAYER_PREV, "LayerPrev", N_("Switch to Layer Belo_w"),
2346 N_("Switch to the layer below the current"), "switch_to_layer_below"),
2347 new LayerVerb(SP_VERB_LAYER_MOVE_TO_NEXT, "LayerMoveToNext", N_("Move Selection to Layer Abo_ve"),
2348 N_("Move selection to the layer above the current"), "move_selection_above"),
2349 new LayerVerb(SP_VERB_LAYER_MOVE_TO_PREV, "LayerMoveToPrev", N_("Move Selection to Layer Bel_ow"),
2350 N_("Move selection to the layer below the current"), "move_selection_below"),
2351 new LayerVerb(SP_VERB_LAYER_TO_TOP, "LayerToTop", N_("Layer to _Top"),
2352 N_("Raise the current layer to the top"), "layer_to_top"),
2353 new LayerVerb(SP_VERB_LAYER_TO_BOTTOM, "LayerToBottom", N_("Layer to _Bottom"),
2354 N_("Lower the current layer to the bottom"), "layer_to_bottom"),
2355 new LayerVerb(SP_VERB_LAYER_RAISE, "LayerRaise", N_("_Raise Layer"),
2356 N_("Raise the current layer"), "raise_layer"),
2357 new LayerVerb(SP_VERB_LAYER_LOWER, "LayerLower", N_("_Lower Layer"),
2358 N_("Lower the current layer"), "lower_layer"),
2359 new LayerVerb(SP_VERB_LAYER_DELETE, "LayerDelete", N_("_Delete Current Layer"),
2360 N_("Delete the current layer"), "delete_layer"),
2362 /* Object */
2363 new ObjectVerb(SP_VERB_OBJECT_ROTATE_90_CW, "ObjectRotate90", N_("Rotate _90° CW"),
2364 // This is shared between tooltips and statusbar, so they
2365 // must use UTF-8, not HTML entities for special characters.
2366 N_("Rotate selection 90\xc2\xb0 clockwise"), "object_rotate_90_CW"),
2367 new ObjectVerb(SP_VERB_OBJECT_ROTATE_90_CCW, "ObjectRotate90CCW", N_("Rotate 9_0° CCW"),
2368 // This is shared between tooltips and statusbar, so they
2369 // must use UTF-8, not HTML entities for special characters.
2370 N_("Rotate selection 90\xc2\xb0 counter-clockwise"), "object_rotate_90_CCW"),
2371 new ObjectVerb(SP_VERB_OBJECT_FLATTEN, "ObjectRemoveTransform", N_("Remove _Transformations"),
2372 N_("Remove transformations from object"), "object_reset"),
2373 new ObjectVerb(SP_VERB_OBJECT_TO_CURVE, "ObjectToPath", N_("_Object to Path"),
2374 N_("Convert selected object to path"), "object_tocurve"),
2375 new ObjectVerb(SP_VERB_OBJECT_FLOW_TEXT, "ObjectFlowText", N_("_Flow into Frame"),
2376 N_("Put text into a frame (path or shape), creating a flowed text linked to the frame object"), "flow_into_frame"),
2377 new ObjectVerb(SP_VERB_OBJECT_UNFLOW_TEXT, "ObjectUnFlowText", N_("_Unflow"),
2378 N_("Remove text from frame (creates a single-line text object)"), "unflow"),
2379 new ObjectVerb(SP_VERB_OBJECT_FLOWTEXT_TO_TEXT, "ObjectFlowtextToText", N_("_Convert to Text"),
2380 N_("Convert flowed text to regular text object (preserves appearance)"), "convert_to_text"),
2381 new ObjectVerb(SP_VERB_OBJECT_FLIP_HORIZONTAL, "ObjectFlipHorizontally",
2382 N_("Flip _Horizontal"), N_("Flip selected objects horizontally"),
2383 "object_flip_hor"),
2384 new ObjectVerb(SP_VERB_OBJECT_FLIP_VERTICAL, "ObjectFlipVertically",
2385 N_("Flip _Vertical"), N_("Flip selected objects vertically"),
2386 "object_flip_ver"),
2387 new ObjectVerb(SP_VERB_OBJECT_SET_MASK, "ObjectSetMask", N_("_Set"),
2388 N_("Apply mask to selection (using the topmost object as mask)"), NULL),
2389 new ObjectVerb(SP_VERB_OBJECT_EDIT_MASK, "ObjectEditMask", N_("_Edit"),
2390 N_("Edit mask"), "nodeedit-mask"),
2391 new ObjectVerb(SP_VERB_OBJECT_UNSET_MASK, "ObjectUnSetMask", N_("_Release"),
2392 N_("Remove mask from selection"), NULL),
2393 new ObjectVerb(SP_VERB_OBJECT_SET_CLIPPATH, "ObjectSetClipPath", N_("_Set"),
2394 N_("Apply clipping path to selection (using the topmost object as clipping path)"), NULL),
2395 new ObjectVerb(SP_VERB_OBJECT_EDIT_CLIPPATH, "ObjectEditClipPath", N_("_Edit"),
2396 N_("Edit clipping path"), "nodeedit-clippath"),
2397 new ObjectVerb(SP_VERB_OBJECT_UNSET_CLIPPATH, "ObjectUnSetClipPath", N_("_Release"),
2398 N_("Remove clipping path from selection"), NULL),
2400 /* Tools */
2401 new ContextVerb(SP_VERB_CONTEXT_SELECT, "ToolSelector", N_("Select"),
2402 N_("Select and transform objects"), "draw_select"),
2403 new ContextVerb(SP_VERB_CONTEXT_NODE, "ToolNode", N_("Node Edit"),
2404 N_("Edit paths by nodes"), "draw_node"),
2405 new ContextVerb(SP_VERB_CONTEXT_TWEAK, "ToolTweak", N_("Tweak"),
2406 N_("Tweak objects by sculpting or painting"), "draw_tweak"),
2407 new ContextVerb(SP_VERB_CONTEXT_RECT, "ToolRect", N_("Rectangle"),
2408 N_("Create rectangles and squares"), "draw_rect"),
2409 new ContextVerb(SP_VERB_CONTEXT_3DBOX, "Tool3DBox", N_("3D Box"),
2410 N_("Create 3D boxes"), "draw_3dbox"),
2411 new ContextVerb(SP_VERB_CONTEXT_ARC, "ToolArc", N_("Ellipse"),
2412 N_("Create circles, ellipses, and arcs"), "draw_arc"),
2413 new ContextVerb(SP_VERB_CONTEXT_STAR, "ToolStar", N_("Star"),
2414 N_("Create stars and polygons"), "draw_star"),
2415 new ContextVerb(SP_VERB_CONTEXT_SPIRAL, "ToolSpiral", N_("Spiral"),
2416 N_("Create spirals"), "draw_spiral"),
2417 new ContextVerb(SP_VERB_CONTEXT_PENCIL, "ToolPencil", N_("Pencil"),
2418 N_("Draw freehand lines"), "draw_freehand"),
2419 new ContextVerb(SP_VERB_CONTEXT_PEN, "ToolPen", N_("Pen"),
2420 N_("Draw Bezier curves and straight lines"), "draw_pen"),
2421 new ContextVerb(SP_VERB_CONTEXT_CALLIGRAPHIC, "ToolCalligraphic", N_("Calligraphy"),
2422 N_("Draw calligraphic or brush strokes"), "draw_calligraphic"),
2423 new ContextVerb(SP_VERB_CONTEXT_TEXT, "ToolText", N_("Text"),
2424 N_("Create and edit text objects"), "draw_text"),
2425 new ContextVerb(SP_VERB_CONTEXT_GRADIENT, "ToolGradient", N_("Gradient"),
2426 N_("Create and edit gradients"), "draw_gradient"),
2427 new ContextVerb(SP_VERB_CONTEXT_ZOOM, "ToolZoom", N_("Zoom"),
2428 N_("Zoom in or out"), "draw_zoom"),
2429 new ContextVerb(SP_VERB_CONTEXT_DROPPER, "ToolDropper", N_("Dropper"),
2430 N_("Pick colors from image"), "draw_dropper"),
2431 new ContextVerb(SP_VERB_CONTEXT_CONNECTOR, "ToolConnector", N_("Connector"),
2432 N_("Create diagram connectors"), "draw_connector"),
2433 new ContextVerb(SP_VERB_CONTEXT_PAINTBUCKET, "ToolPaintBucket", N_("Paint Bucket"),
2434 N_("Fill bounded areas"), "draw_paintbucket"),
2436 /* Tool prefs */
2437 new ContextVerb(SP_VERB_CONTEXT_SELECT_PREFS, "SelectPrefs", N_("Selector Preferences"),
2438 N_("Open Preferences for the Selector tool"), NULL),
2439 new ContextVerb(SP_VERB_CONTEXT_NODE_PREFS, "NodePrefs", N_("Node Tool Preferences"),
2440 N_("Open Preferences for the Node tool"), NULL),
2441 new ContextVerb(SP_VERB_CONTEXT_TWEAK_PREFS, "TweakPrefs", N_("Tweak Tool Preferences"),
2442 N_("Open Preferences for the Tweak tool"), NULL),
2443 new ContextVerb(SP_VERB_CONTEXT_RECT_PREFS, "RectPrefs", N_("Rectangle Preferences"),
2444 N_("Open Preferences for the Rectangle tool"), NULL),
2445 new ContextVerb(SP_VERB_CONTEXT_3DBOX_PREFS, "3DBoxPrefs", N_("3D Box Preferences"),
2446 N_("Open Preferences for the 3D Box tool"), NULL),
2447 new ContextVerb(SP_VERB_CONTEXT_ARC_PREFS, "ArcPrefs", N_("Ellipse Preferences"),
2448 N_("Open Preferences for the Ellipse tool"), NULL),
2449 new ContextVerb(SP_VERB_CONTEXT_STAR_PREFS, "StarPrefs", N_("Star Preferences"),
2450 N_("Open Preferences for the Star tool"), NULL),
2451 new ContextVerb(SP_VERB_CONTEXT_SPIRAL_PREFS, "SpiralPrefs", N_("Spiral Preferences"),
2452 N_("Open Preferences for the Spiral tool"), NULL),
2453 new ContextVerb(SP_VERB_CONTEXT_PENCIL_PREFS, "PencilPrefs", N_("Pencil Preferences"),
2454 N_("Open Preferences for the Pencil tool"), NULL),
2455 new ContextVerb(SP_VERB_CONTEXT_PEN_PREFS, "PenPrefs", N_("Pen Preferences"),
2456 N_("Open Preferences for the Pen tool"), NULL),
2457 new ContextVerb(SP_VERB_CONTEXT_CALLIGRAPHIC_PREFS, "CalligraphicPrefs", N_("Calligraphic Preferences"),
2458 N_("Open Preferences for the Calligraphy tool"), NULL),
2459 new ContextVerb(SP_VERB_CONTEXT_TEXT_PREFS, "TextPrefs", N_("Text Preferences"),
2460 N_("Open Preferences for the Text tool"), NULL),
2461 new ContextVerb(SP_VERB_CONTEXT_GRADIENT_PREFS, "GradientPrefs", N_("Gradient Preferences"),
2462 N_("Open Preferences for the Gradient tool"), NULL),
2463 new ContextVerb(SP_VERB_CONTEXT_ZOOM_PREFS, "ZoomPrefs", N_("Zoom Preferences"),
2464 N_("Open Preferences for the Zoom tool"), NULL),
2465 new ContextVerb(SP_VERB_CONTEXT_DROPPER_PREFS, "DropperPrefs", N_("Dropper Preferences"),
2466 N_("Open Preferences for the Dropper tool"), NULL),
2467 new ContextVerb(SP_VERB_CONTEXT_CONNECTOR_PREFS, "ConnectorPrefs", N_("Connector Preferences"),
2468 N_("Open Preferences for the Connector tool"), NULL),
2469 new ContextVerb(SP_VERB_CONTEXT_PAINTBUCKET_PREFS, "PaintBucketPrefs", N_("Paint Bucket Preferences"),
2470 N_("Open Preferences for the Paint Bucket tool"), NULL),
2472 /* Zoom/View */
2473 new ZoomVerb(SP_VERB_ZOOM_IN, "ZoomIn", N_("Zoom In"), N_("Zoom in"), "zoom_in"),
2474 new ZoomVerb(SP_VERB_ZOOM_OUT, "ZoomOut", N_("Zoom Out"), N_("Zoom out"), "zoom_out"),
2475 new ZoomVerb(SP_VERB_TOGGLE_RULERS, "ToggleRulers", N_("_Rulers"), N_("Show or hide the canvas rulers"), "rulers"),
2476 new ZoomVerb(SP_VERB_TOGGLE_SCROLLBARS, "ToggleScrollbars", N_("Scroll_bars"), N_("Show or hide the canvas scrollbars"), "scrollbars"),
2477 new ZoomVerb(SP_VERB_TOGGLE_GRID, "ToggleGrid", N_("_Grid"), N_("Show or hide the grid"), "grid"),
2478 new ZoomVerb(SP_VERB_TOGGLE_GUIDES, "ToggleGuides", N_("G_uides"), N_("Show or hide guides (drag from a ruler to create a guide)"), "guides"),
2479 new ZoomVerb(SP_VERB_TOGGLE_SNAPPING, "ToggleSnapping", N_("Snap"), N_("Toggle snapping on or off"), NULL),
2480 new ZoomVerb(SP_VERB_ZOOM_NEXT, "ZoomNext", N_("Nex_t Zoom"), N_("Next zoom (from the history of zooms)"),
2481 "zoom_next"),
2482 new ZoomVerb(SP_VERB_ZOOM_PREV, "ZoomPrev", N_("Pre_vious Zoom"), N_("Previous zoom (from the history of zooms)"),
2483 "zoom_previous"),
2484 new ZoomVerb(SP_VERB_ZOOM_1_1, "Zoom1:0", N_("Zoom 1:_1"), N_("Zoom to 1:1"),
2485 "zoom_1_to_1"),
2486 new ZoomVerb(SP_VERB_ZOOM_1_2, "Zoom1:2", N_("Zoom 1:_2"), N_("Zoom to 1:2"),
2487 "zoom_1_to_2"),
2488 new ZoomVerb(SP_VERB_ZOOM_2_1, "Zoom2:1", N_("_Zoom 2:1"), N_("Zoom to 2:1"),
2489 "zoom_2_to_1"),
2490 #ifdef HAVE_GTK_WINDOW_FULLSCREEN
2491 new ZoomVerb(SP_VERB_FULLSCREEN, "FullScreen", N_("_Fullscreen"), N_("Stretch this document window to full screen"),
2492 "fullscreen"),
2493 #endif /* HAVE_GTK_WINDOW_FULLSCREEN */
2494 new ZoomVerb(SP_VERB_VIEW_NEW, "ViewNew", N_("Duplic_ate Window"), N_("Open a new window with the same document"),
2495 "view_new"),
2496 new ZoomVerb(SP_VERB_VIEW_NEW_PREVIEW, "ViewNewPreview", N_("_New View Preview"),
2497 N_("New View Preview"), NULL/*"view_new_preview"*/),
2499 new ZoomVerb(SP_VERB_VIEW_MODE_NORMAL, "ViewModeNormal", N_("_Normal"),
2500 N_("Switch to normal display mode"), NULL),
2501 new ZoomVerb(SP_VERB_VIEW_MODE_OUTLINE, "ViewModeOutline", N_("_Outline"),
2502 N_("Switch to outline (wireframe) display mode"), NULL),
2503 new ZoomVerb(SP_VERB_VIEW_MODE_TOGGLE, "ViewModeToggle", N_("_Toggle"),
2504 N_("Toggle between normal and outline display modes"), NULL),
2506 new ZoomVerb(SP_VERB_VIEW_CMS_TOGGLE, "ViewCmsToggle", N_("Color-managed view"),
2507 N_("Toggle color-managed display for this document window"), "color_management"),
2509 new ZoomVerb(SP_VERB_VIEW_ICON_PREVIEW, "ViewIconPreview", N_("Ico_n Preview..."),
2510 N_("Open a window to preview objects at different icon resolutions"), "view_icon_preview"),
2511 new ZoomVerb(SP_VERB_ZOOM_PAGE, "ZoomPage", N_("_Page"),
2512 N_("Zoom to fit page in window"), "zoom_page"),
2513 new ZoomVerb(SP_VERB_ZOOM_PAGE_WIDTH, "ZoomPageWidth", N_("Page _Width"),
2514 N_("Zoom to fit page width in window"), "zoom_pagewidth"),
2515 new ZoomVerb(SP_VERB_ZOOM_DRAWING, "ZoomDrawing", N_("_Drawing"),
2516 N_("Zoom to fit drawing in window"), "zoom_draw"),
2517 new ZoomVerb(SP_VERB_ZOOM_SELECTION, "ZoomSelection", N_("_Selection"),
2518 N_("Zoom to fit selection in window"), "zoom_select"),
2520 /* Dialogs */
2521 new DialogVerb(SP_VERB_DIALOG_DISPLAY, "DialogPreferences", N_("In_kscape Preferences..."),
2522 N_("Edit global Inkscape preferences"), GTK_STOCK_PREFERENCES ),
2523 new DialogVerb(SP_VERB_DIALOG_NAMEDVIEW, "DialogDocumentProperties", N_("_Document Properties..."),
2524 N_("Edit properties of this document (to be saved with the document)"), GTK_STOCK_PROPERTIES ),
2525 new DialogVerb(SP_VERB_DIALOG_METADATA, "DialogMetadata", N_("Document _Metadata..."),
2526 N_("Edit document metadata (to be saved with the document)"), "document_metadata" ),
2527 new DialogVerb(SP_VERB_DIALOG_FILL_STROKE, "DialogFillStroke", N_("_Fill and Stroke..."),
2528 N_("Edit objects' colors, gradients, stroke width, arrowheads, dash patterns..."), "fill_and_stroke"),
2529 // TRANSLATORS: "Swatches" means: color samples
2530 new DialogVerb(SP_VERB_DIALOG_SWATCHES, "DialogSwatches", N_("S_watches..."),
2531 N_("Select colors from a swatches palette"), GTK_STOCK_SELECT_COLOR),
2532 new DialogVerb(SP_VERB_DIALOG_TRANSFORM, "DialogTransform", N_("Transfor_m..."),
2533 N_("Precisely control objects' transformations"), "object_trans"),
2534 new DialogVerb(SP_VERB_DIALOG_ALIGN_DISTRIBUTE, "DialogAlignDistribute", N_("_Align and Distribute..."),
2535 N_("Align and distribute objects"), "object_align"),
2536 new DialogVerb(SP_VERB_DIALOG_UNDO_HISTORY, "DialogUndoHistory", N_("Undo _History..."),
2537 N_("Undo History"), "edit_undo_history"),
2538 new DialogVerb(SP_VERB_DIALOG_TEXT, "DialogText", N_("_Text and Font..."),
2539 N_("View and select font family, font size and other text properties"), "object_font"),
2540 new DialogVerb(SP_VERB_DIALOG_XML_EDITOR, "DialogXMLEditor", N_("_XML Editor..."),
2541 N_("View and edit the XML tree of the document"), "xml_editor"),
2542 new DialogVerb(SP_VERB_DIALOG_FIND, "DialogFind", N_("_Find..."),
2543 N_("Find objects in document"), GTK_STOCK_FIND ),
2544 new DialogVerb(SP_VERB_DIALOG_DEBUG, "DialogDebug", N_("_Messages..."),
2545 N_("View debug messages"), "messages"),
2546 new DialogVerb(SP_VERB_DIALOG_SCRIPT, "DialogScript", N_("S_cripts..."),
2547 N_("Run scripts"), "scripts"),
2548 new DialogVerb(SP_VERB_DIALOG_TOGGLE, "DialogsToggle", N_("Show/Hide D_ialogs"),
2549 N_("Show or hide all open dialogs"), "dialog_toggle"),
2550 new DialogVerb(SP_VERB_DIALOG_CLONETILER, "DialogClonetiler", N_("Create Tiled Clones..."),
2551 N_("Create multiple clones of selected object, arranging them into a pattern or scattering"), "edit_create_tiled_clones"),
2552 new DialogVerb(SP_VERB_DIALOG_ITEM, "DialogObjectProperties", N_("_Object Properties..."),
2553 N_("Edit the ID, locked and visible status, and other object properties"), "dialog_item_properties"),
2554 #ifdef WITH_INKBOARD
2555 new DialogVerb(SP_VERB_XMPP_CLIENT, "DialogXmppClient",
2556 N_("_Instant Messaging..."), N_("Jabber Instant Messaging Client"), NULL),
2557 #endif
2558 new DialogVerb(SP_VERB_DIALOG_INPUT, "DialogInput", N_("_Input Devices..."),
2559 N_("Configure extended input devices, such as a graphics tablet"), "input_devices"),
2560 new DialogVerb(SP_VERB_DIALOG_EXTENSIONEDITOR, "org.inkscape.dialogs.extensioneditor", N_("_Extensions..."),
2561 N_("Query information about extensions"), NULL),
2562 new DialogVerb(SP_VERB_DIALOG_LAYERS, "DialogLayers", N_("Layer_s..."),
2563 N_("View Layers"), "layers"),
2564 new DialogVerb(SP_VERB_DIALOG_LIVE_PATH_EFFECT, "DialogLivePathEffect", N_("Path Effects..."),
2565 N_("Manage path effects"), NULL),
2566 new DialogVerb(SP_VERB_DIALOG_FILTER_EFFECTS, "DialogFilterEffects", N_("Filter Effects..."),
2567 N_("Manage SVG filter effects"), NULL),
2569 /* Help */
2570 new HelpVerb(SP_VERB_HELP_ABOUT_EXTENSIONS, "HelpAboutExtensions", N_("About E_xtensions"),
2571 N_("Information on Inkscape extensions"), NULL),
2572 new HelpVerb(SP_VERB_HELP_MEMORY, "HelpAboutMemory", N_("About _Memory"),
2573 N_("Memory usage information"), "about_memory"),
2574 new HelpVerb(SP_VERB_HELP_ABOUT, "HelpAbout", N_("_About Inkscape"),
2575 N_("Inkscape version, authors, license"), /*"help_about"*/"inkscape_options"),
2576 //new HelpVerb(SP_VERB_SHOW_LICENSE, "ShowLicense", N_("_License"),
2577 // N_("Distribution terms"), /*"show_license"*/"inkscape_options"),
2579 /* Tutorials */
2580 new TutorialVerb(SP_VERB_TUTORIAL_BASIC, "TutorialsBasic", N_("Inkscape: _Basic"),
2581 N_("Getting started with Inkscape"), NULL/*"tutorial_basic"*/),
2582 new TutorialVerb(SP_VERB_TUTORIAL_SHAPES, "TutorialsShapes", N_("Inkscape: _Shapes"),
2583 N_("Using shape tools to create and edit shapes"), NULL),
2584 new TutorialVerb(SP_VERB_TUTORIAL_ADVANCED, "TutorialsAdvanced", N_("Inkscape: _Advanced"),
2585 N_("Advanced Inkscape topics"), NULL/*"tutorial_advanced"*/),
2586 // TRANSLATORS: "to trace" means "to convert a bitmap to vector graphics" (to vectorize)
2587 new TutorialVerb(SP_VERB_TUTORIAL_TRACING, "TutorialsTracing", N_("Inkscape: T_racing"),
2588 N_("Using bitmap tracing"), NULL/*"tutorial_tracing"*/),
2589 new TutorialVerb(SP_VERB_TUTORIAL_CALLIGRAPHY, "TutorialsCalligraphy", N_("Inkscape: _Calligraphy"),
2590 N_("Using the Calligraphy pen tool"), NULL),
2591 new TutorialVerb(SP_VERB_TUTORIAL_DESIGN, "TutorialsDesign", N_("_Elements of Design"),
2592 N_("Principles of design in the tutorial form"), NULL/*"tutorial_design"*/),
2593 new TutorialVerb(SP_VERB_TUTORIAL_TIPS, "TutorialsTips", N_("_Tips and Tricks"),
2594 N_("Miscellaneous tips and tricks"), NULL/*"tutorial_tips"*/),
2596 /* Effect */
2597 new EffectLastVerb(SP_VERB_EFFECT_LAST, "EffectLast", N_("Previous Effect"),
2598 N_("Repeat the last effect with the same settings"), NULL),
2599 new EffectLastVerb(SP_VERB_EFFECT_LAST_PREF, "EffectLastPref", N_("Previous Effect Settings..."),
2600 N_("Repeat the last effect with new settings"), NULL),
2602 /* Fit Page */
2603 new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_SELECTION, "FitCanvasToSelection", N_("Fit Page to Selection"),
2604 N_("Fit the page to the current selection"), NULL),
2605 new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_DRAWING, "FitCanvasToDrawing", N_("Fit Page to Drawing"),
2606 N_("Fit the page to the drawing"), NULL),
2607 new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING, "FitCanvasToSelectionOrDrawing", N_("Fit Page to Selection or Drawing"),
2608 N_("Fit the page to the current selection or the drawing if there is no selection"), NULL),
2609 /* LockAndHide */
2610 new LockAndHideVerb(SP_VERB_UNLOCK_ALL, "UnlockAll", N_("Unlock All"),
2611 N_("Unlock all objects in the current layer"), NULL),
2612 new LockAndHideVerb(SP_VERB_UNLOCK_ALL_IN_ALL_LAYERS, "UnlockAllInAllLayers", N_("Unlock All in All Layers"),
2613 N_("Unlock all objects in all layers"), NULL),
2614 new LockAndHideVerb(SP_VERB_UNHIDE_ALL, "UnhideAll", N_("Unhide All"),
2615 N_("Unhide all objects in the current layer"), NULL),
2616 new LockAndHideVerb(SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS, "UnhideAllInAllLayers", N_("Unhide All in All Layers"),
2617 N_("Unhide all objects in all layers"), NULL),
2618 /* Footer */
2619 new Verb(SP_VERB_LAST, " '\"invalid id", NULL, NULL, NULL)
2620 };
2623 void
2624 Verb::list (void) {
2625 // Go through the dynamic verb table
2626 for (VerbTable::iterator iter = _verbs.begin(); iter != _verbs.end(); iter++) {
2627 Verb * verb = iter->second;
2628 if (verb->get_code() == SP_VERB_INVALID ||
2629 verb->get_code() == SP_VERB_NONE ||
2630 verb->get_code() == SP_VERB_LAST) {
2631 continue;
2632 }
2634 printf("%s: %s\n", verb->get_id(), verb->get_tip()? verb->get_tip() : verb->get_name());
2635 }
2637 return;
2638 };
2640 } /* namespace Inkscape */
2642 /*
2643 Local Variables:
2644 mode:c++
2645 c-file-style:"stroustrup"
2646 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
2647 indent-tabs-mode:nil
2648 fill-column:99
2649 End:
2650 */
2651 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :