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 #include "dialogs/input.h"
52 #ifdef WITH_INKBOARD
53 #include "jabber_whiteboard/session-manager.h"
54 #endif
56 #include "extension/effect.h"
58 #include "tools-switch.h"
59 #include "inkscape-private.h"
60 #include "file.h"
61 #include "help.h"
62 #include "document.h"
63 #include "desktop.h"
64 #include "message-stack.h"
65 #include "desktop-handles.h"
66 #include "selection-chemistry.h"
67 #include "path-chemistry.h"
68 #include "text-chemistry.h"
69 #include "ui/dialog/dialog-manager.h"
70 #include "ui/dialog/inkscape-preferences.h"
71 #include "interface.h"
72 #include "prefs-utils.h"
73 #include "splivarot.h"
74 #include "sp-namedview.h"
75 #include "sp-flowtext.h"
76 #include "layer-fns.h"
77 #include "node-context.h"
78 #include "select-context.h"
79 #include "seltrans.h"
80 #include "gradient-context.h"
81 #include "shape-editor.h"
82 #include "draw-context.h"
83 #include "gradient-drag.h"
84 #include "sp-guide.h"
87 /**
88 * \brief Return the name without underscores and ellipsis, for use in dialog
89 * titles, etc. Allocated memory must be freed by caller.
90 */
91 gchar *
92 sp_action_get_title(SPAction const *action)
93 {
94 char const *src = action->name;
95 gchar *ret = g_new(gchar, strlen(src) + 1);
96 unsigned ri = 0;
98 for (unsigned si = 0 ; ; si++) {
99 int const c = src[si];
100 if ( c != '_' && c != '.' ) {
101 ret[ri] = c;
102 ri++;
103 if (c == '\0') {
104 return ret;
105 }
106 }
107 }
109 } // end of sp_action_get_title()
111 namespace Inkscape {
113 /** \brief A class to encompass all of the verbs which deal with
114 file operations. */
115 class FileVerb : public Verb {
116 private:
117 static void perform(SPAction *action, void *mydata, void *otherdata);
118 static SPActionEventVector vector;
119 protected:
120 virtual SPAction *make_action(Inkscape::UI::View::View *view);
121 public:
122 /** \brief Use the Verb initializer with the same parameters. */
123 FileVerb(unsigned int const code,
124 gchar const *id,
125 gchar const *name,
126 gchar const *tip,
127 gchar const *image) :
128 Verb(code, id, name, tip, image)
129 { }
130 }; /* FileVerb class */
132 /** \brief A class to encompass all of the verbs which deal with
133 edit operations. */
134 class EditVerb : public Verb {
135 private:
136 static void perform(SPAction *action, void *mydata, void *otherdata);
137 static SPActionEventVector vector;
138 protected:
139 virtual SPAction *make_action(Inkscape::UI::View::View *view);
140 public:
141 /** \brief Use the Verb initializer with the same parameters. */
142 EditVerb(unsigned int const code,
143 gchar const *id,
144 gchar const *name,
145 gchar const *tip,
146 gchar const *image) :
147 Verb(code, id, name, tip, image)
148 { }
149 }; /* EditVerb class */
151 /** \brief A class to encompass all of the verbs which deal with
152 selection operations. */
153 class SelectionVerb : public Verb {
154 private:
155 static void perform(SPAction *action, void *mydata, void *otherdata);
156 static SPActionEventVector vector;
157 protected:
158 virtual SPAction *make_action(Inkscape::UI::View::View *view);
159 public:
160 /** \brief Use the Verb initializer with the same parameters. */
161 SelectionVerb(unsigned int const code,
162 gchar const *id,
163 gchar const *name,
164 gchar const *tip,
165 gchar const *image) :
166 Verb(code, id, name, tip, image)
167 { }
168 }; /* SelectionVerb class */
170 /** \brief A class to encompass all of the verbs which deal with
171 layer operations. */
172 class LayerVerb : public Verb {
173 private:
174 static void perform(SPAction *action, void *mydata, void *otherdata);
175 static SPActionEventVector vector;
176 protected:
177 virtual SPAction *make_action(Inkscape::UI::View::View *view);
178 public:
179 /** \brief Use the Verb initializer with the same parameters. */
180 LayerVerb(unsigned int const code,
181 gchar const *id,
182 gchar const *name,
183 gchar const *tip,
184 gchar const *image) :
185 Verb(code, id, name, tip, image)
186 { }
187 }; /* LayerVerb class */
189 /** \brief A class to encompass all of the verbs which deal with
190 operations related to objects. */
191 class ObjectVerb : public Verb {
192 private:
193 static void perform(SPAction *action, void *mydata, void *otherdata);
194 static SPActionEventVector vector;
195 protected:
196 virtual SPAction *make_action(Inkscape::UI::View::View *view);
197 public:
198 /** \brief Use the Verb initializer with the same parameters. */
199 ObjectVerb(unsigned int const code,
200 gchar const *id,
201 gchar const *name,
202 gchar const *tip,
203 gchar const *image) :
204 Verb(code, id, name, tip, image)
205 { }
206 }; /* ObjectVerb class */
208 /** \brief A class to encompass all of the verbs which deal with
209 operations relative to context. */
210 class ContextVerb : public Verb {
211 private:
212 static void perform(SPAction *action, void *mydata, void *otherdata);
213 static SPActionEventVector vector;
214 protected:
215 virtual SPAction *make_action(Inkscape::UI::View::View *view);
216 public:
217 /** \brief Use the Verb initializer with the same parameters. */
218 ContextVerb(unsigned int const code,
219 gchar const *id,
220 gchar const *name,
221 gchar const *tip,
222 gchar const *image) :
223 Verb(code, id, name, tip, image)
224 { }
225 }; /* ContextVerb class */
227 /** \brief A class to encompass all of the verbs which deal with
228 zoom operations. */
229 class ZoomVerb : public Verb {
230 private:
231 static void perform(SPAction *action, void *mydata, void *otherdata);
232 static SPActionEventVector vector;
233 protected:
234 virtual SPAction *make_action(Inkscape::UI::View::View *view);
235 public:
236 /** \brief Use the Verb initializer with the same parameters. */
237 ZoomVerb(unsigned int const code,
238 gchar const *id,
239 gchar const *name,
240 gchar const *tip,
241 gchar const *image) :
242 Verb(code, id, name, tip, image)
243 { }
244 }; /* ZoomVerb class */
247 /** \brief A class to encompass all of the verbs which deal with
248 dialog operations. */
249 class DialogVerb : public Verb {
250 private:
251 static void perform(SPAction *action, void *mydata, void *otherdata);
252 static SPActionEventVector vector;
253 protected:
254 virtual SPAction *make_action(Inkscape::UI::View::View *view);
255 public:
256 /** \brief Use the Verb initializer with the same parameters. */
257 DialogVerb(unsigned int const code,
258 gchar const *id,
259 gchar const *name,
260 gchar const *tip,
261 gchar const *image) :
262 Verb(code, id, name, tip, image)
263 { }
264 }; /* DialogVerb class */
266 /** \brief A class to encompass all of the verbs which deal with
267 help operations. */
268 class HelpVerb : public Verb {
269 private:
270 static void perform(SPAction *action, void *mydata, void *otherdata);
271 static SPActionEventVector vector;
272 protected:
273 virtual SPAction *make_action(Inkscape::UI::View::View *view);
274 public:
275 /** \brief Use the Verb initializer with the same parameters. */
276 HelpVerb(unsigned int const code,
277 gchar const *id,
278 gchar const *name,
279 gchar const *tip,
280 gchar const *image) :
281 Verb(code, id, name, tip, image)
282 { }
283 }; /* HelpVerb class */
285 /** \brief A class to encompass all of the verbs which deal with
286 tutorial operations. */
287 class TutorialVerb : public Verb {
288 private:
289 static void perform(SPAction *action, void *mydata, void *otherdata);
290 static SPActionEventVector vector;
291 protected:
292 virtual SPAction *make_action(Inkscape::UI::View::View *view);
293 public:
294 /** \brief Use the Verb initializer with the same parameters. */
295 TutorialVerb(unsigned int const code,
296 gchar const *id,
297 gchar const *name,
298 gchar const *tip,
299 gchar const *image) :
300 Verb(code, id, name, tip, image)
301 { }
302 }; /* TutorialVerb class */
304 /** \brief A class to encompass all of the verbs which deal with
305 text operations. */
306 class TextVerb : public Verb {
307 private:
308 static void perform(SPAction *action, void *mydata, void *otherdata);
309 static SPActionEventVector vector;
310 protected:
311 virtual SPAction *make_action(Inkscape::UI::View::View *view);
312 public:
313 /** \brief Use the Verb initializer with the same parameters. */
314 TextVerb(unsigned int const code,
315 gchar const *id,
316 gchar const *name,
317 gchar const *tip,
318 gchar const *image) :
319 Verb(code, id, name, tip, image)
320 { }
321 }; //TextVerb : public Verb
323 Verb::VerbTable Verb::_verbs;
324 Verb::VerbIDTable Verb::_verb_ids;
326 /** \brief Create a verb without a code.
328 This function calls the other constructor for all of the parameters,
329 but generates the code. It is important to READ THE OTHER DOCUMENTATION
330 it has important details in it. To generate the code a static is
331 used which starts at the last static value: \c SP_VERB_LAST. For
332 each call it is incremented. The list of allocated verbs is kept
333 in the \c _verbs hashtable which is indexed by the \c code.
334 */
335 Verb::Verb(gchar const *id, gchar const *name, gchar const *tip, gchar const *image) :
336 _actions(NULL), _id(id), _name(name), _tip(tip), _image(image)
337 {
338 static int count = SP_VERB_LAST;
340 count++;
341 _code = count;
342 _verbs.insert(VerbTable::value_type(count, this));
343 _verb_ids.insert(VerbIDTable::value_type(_id, this));
345 return;
346 }
348 /** \brief Destroy a verb.
350 The only allocated variable is the _actions variable. If it has
351 been allocated it is deleted.
352 */
353 Verb::~Verb(void)
354 {
355 /// \todo all the actions need to be cleaned up first.
356 if (_actions != NULL) {
357 delete _actions;
358 }
360 return;
361 }
363 /** \brief Verbs are no good without actions. This is a place holder
364 for a function that every subclass should write. Most
365 can be written using \c make_action_helper.
366 \param view Which view the action should be created for.
367 \return NULL to represent error (this function shouldn't ever be called)
368 */
369 SPAction *
370 Verb::make_action(Inkscape::UI::View::View */*view*/)
371 {
372 //std::cout << "make_action" << std::endl;
373 return NULL;
374 }
376 /** \brief Create an action for a \c FileVerb
377 \param view Which view the action should be created for
378 \return The built action.
380 Calls \c make_action_helper with the \c vector.
381 */
382 SPAction *
383 FileVerb::make_action(Inkscape::UI::View::View *view)
384 {
385 //std::cout << "fileverb: make_action: " << &vector << std::endl;
386 return make_action_helper(view, &vector);
387 }
389 /** \brief Create an action for a \c EditVerb
390 \param view Which view the action should be created for
391 \return The built action.
393 Calls \c make_action_helper with the \c vector.
394 */
395 SPAction *
396 EditVerb::make_action(Inkscape::UI::View::View *view)
397 {
398 //std::cout << "editverb: make_action: " << &vector << std::endl;
399 return make_action_helper(view, &vector);
400 }
402 /** \brief Create an action for a \c SelectionVerb
403 \param view Which view the action should be created for
404 \return The built action.
406 Calls \c make_action_helper with the \c vector.
407 */
408 SPAction *
409 SelectionVerb::make_action(Inkscape::UI::View::View *view)
410 {
411 return make_action_helper(view, &vector);
412 }
414 /** \brief Create an action for a \c LayerVerb
415 \param view Which view the action should be created for
416 \return The built action.
418 Calls \c make_action_helper with the \c vector.
419 */
420 SPAction *
421 LayerVerb::make_action(Inkscape::UI::View::View *view)
422 {
423 return make_action_helper(view, &vector);
424 }
426 /** \brief Create an action for a \c ObjectVerb
427 \param view Which view the action should be created for
428 \return The built action.
430 Calls \c make_action_helper with the \c vector.
431 */
432 SPAction *
433 ObjectVerb::make_action(Inkscape::UI::View::View *view)
434 {
435 return make_action_helper(view, &vector);
436 }
438 /** \brief Create an action for a \c ContextVerb
439 \param view Which view the action should be created for
440 \return The built action.
442 Calls \c make_action_helper with the \c vector.
443 */
444 SPAction *
445 ContextVerb::make_action(Inkscape::UI::View::View *view)
446 {
447 return make_action_helper(view, &vector);
448 }
450 /** \brief Create an action for a \c ZoomVerb
451 \param view Which view the action should be created for
452 \return The built action.
454 Calls \c make_action_helper with the \c vector.
455 */
456 SPAction *
457 ZoomVerb::make_action(Inkscape::UI::View::View *view)
458 {
459 return make_action_helper(view, &vector);
460 }
462 /** \brief Create an action for a \c DialogVerb
463 \param view Which view the action should be created for
464 \return The built action.
466 Calls \c make_action_helper with the \c vector.
467 */
468 SPAction *
469 DialogVerb::make_action(Inkscape::UI::View::View *view)
470 {
471 return make_action_helper(view, &vector);
472 }
474 /** \brief Create an action for a \c HelpVerb
475 \param view Which view the action should be created for
476 \return The built action.
478 Calls \c make_action_helper with the \c vector.
479 */
480 SPAction *
481 HelpVerb::make_action(Inkscape::UI::View::View *view)
482 {
483 return make_action_helper(view, &vector);
484 }
486 /** \brief Create an action for a \c TutorialVerb
487 \param view Which view the action should be created for
488 \return The built action.
490 Calls \c make_action_helper with the \c vector.
491 */
492 SPAction *
493 TutorialVerb::make_action(Inkscape::UI::View::View *view)
494 {
495 return make_action_helper(view, &vector);
496 }
498 /** \brief Create an action for a \c TextVerb
499 \param view Which view the action should be created for
500 \return The built action.
502 Calls \c make_action_helper with the \c vector.
503 */
504 SPAction *
505 TextVerb::make_action(Inkscape::UI::View::View *view)
506 {
507 return make_action_helper(view, &vector);
508 }
510 /** \brief A quick little convience function to make building actions
511 a little bit easier.
512 \param view Which view the action should be created for.
513 \param vector The function vector for the verb.
514 \return The created action.
516 This function does a couple of things. The most obvious is that
517 it allocates and creates the action. When it does this it
518 translates the \c _name and \c _tip variables. This allows them
519 to be staticly allocated easily, and get translated in the end. Then,
520 if the action gets crated, a listener is added to the action with
521 the vector that is passed in.
522 */
523 SPAction *
524 Verb::make_action_helper(Inkscape::UI::View::View *view, SPActionEventVector *vector, void *in_pntr)
525 {
526 SPAction *action;
528 //std::cout << "Adding action: " << _code << std::endl;
529 action = sp_action_new(view, _id, _(_name),
530 _(_tip), _image, this);
532 if (action != NULL) {
533 if (in_pntr == NULL) {
534 nr_active_object_add_listener(
535 (NRActiveObject *) action,
536 (NRObjectEventVector *) vector,
537 sizeof(SPActionEventVector),
538 reinterpret_cast<void *>(_code)
539 );
540 } else {
541 nr_active_object_add_listener(
542 (NRActiveObject *) action,
543 (NRObjectEventVector *) vector,
544 sizeof(SPActionEventVector),
545 in_pntr
546 );
547 }
548 }
550 return action;
551 }
553 /** \brief A function to get an action if it exists, or otherwise to
554 build it.
555 \param view The view which this action would relate to
556 \return The action, or NULL if there is an error.
558 This function will get the action for a given view for this verb. It
559 will create the verb if it can't be found in the ActionTable. Also,
560 if the \c ActionTable has not been created, it gets created by this
561 function.
563 If the action is created, it's sensitivity must be determined. The
564 default for a new action is that it is sensitive. If the value in
565 \c _default_sensitive is \c false, then the sensitivity must be
566 removed. Also, if the view being created is based on the same
567 document as a view already created, the sensitivity should be the
568 same as views on that document. A view with the same document is
569 looked for, and the sensitivity is matched. Unfortunately, this is
570 currently a linear search.
571 */
572 SPAction *
573 Verb::get_action(Inkscape::UI::View::View *view)
574 {
575 SPAction *action = NULL;
577 if ( _actions == NULL ) {
578 _actions = new ActionTable;
579 }
580 ActionTable::iterator action_found = _actions->find(view);
582 if (action_found != _actions->end()) {
583 action = action_found->second;
584 } else {
585 action = this->make_action(view);
587 // if (action == NULL) printf("Hmm, NULL in %s\n", _name);
588 if (action == NULL) printf("Hmm, NULL in %s\n", _name);
589 if (!_default_sensitive) {
590 sp_action_set_sensitive(action, 0);
591 } else {
592 for (ActionTable::iterator cur_action = _actions->begin();
593 cur_action != _actions->end() && view != NULL;
594 cur_action++) {
595 if (cur_action->first != NULL && cur_action->first->doc() == view->doc()) {
596 sp_action_set_sensitive(action, cur_action->second->sensitive);
597 break;
598 }
599 }
600 }
602 _actions->insert(ActionTable::value_type(view, action));
603 }
605 return action;
606 }
608 void
609 Verb::sensitive(SPDocument *in_doc, bool in_sensitive)
610 {
611 // printf("Setting sensitivity of \"%s\" to %d\n", _name, in_sensitive);
612 if (_actions != NULL) {
613 for (ActionTable::iterator cur_action = _actions->begin();
614 cur_action != _actions->end();
615 cur_action++) {
616 if (in_doc == NULL || (cur_action->first != NULL && cur_action->first->doc() == in_doc)) {
617 sp_action_set_sensitive(cur_action->second, in_sensitive ? 1 : 0);
618 }
619 }
620 }
622 if (in_doc == NULL) {
623 _default_sensitive = in_sensitive;
624 }
626 return;
627 }
629 /** \brief Accessor to get the tooltip for verb as localised string */
630 gchar const *
631 Verb::get_tip (void)
632 {
633 return _(_tip);
634 }
636 void
637 Verb::name(SPDocument *in_doc, Glib::ustring in_name)
638 {
639 if (_actions != NULL) {
640 for (ActionTable::iterator cur_action = _actions->begin();
641 cur_action != _actions->end();
642 cur_action++) {
643 if (in_doc == NULL || (cur_action->first != NULL && cur_action->first->doc() == in_doc)) {
644 sp_action_set_name(cur_action->second, in_name);
645 }
646 }
647 }
648 }
650 /** \brief A function to remove the action associated with a view.
651 \param view Which view's actions should be removed.
652 \return None
654 This function looks for the action in \c _actions. If it is
655 found then it is unreferenced and the entry in the action
656 table is erased.
657 */
658 void
659 Verb::delete_view(Inkscape::UI::View::View *view)
660 {
661 if (_actions == NULL) return;
662 if (_actions->empty()) return;
664 #if 0
665 static int count = 0;
666 std::cout << count++ << std::endl;
667 #endif
669 ActionTable::iterator action_found = _actions->find(view);
671 if (action_found != _actions->end()) {
672 SPAction *action = action_found->second;
673 nr_object_unref(NR_OBJECT(action));
674 _actions->erase(action_found);
675 }
677 return;
678 }
680 /** \brief A function to delete a view from all verbs
681 \param view Which view's actions should be removed.
682 \return None
684 This function first looks through _base_verbs and deteles
685 the view from all of those views. If \c _verbs is not empty
686 then all of the entries in that table have all of the views
687 deleted also.
688 */
689 void
690 Verb::delete_all_view(Inkscape::UI::View::View *view)
691 {
692 for (int i = 0; i <= SP_VERB_LAST; i++) {
693 if (_base_verbs[i])
694 _base_verbs[i]->delete_view(view);
695 }
697 if (!_verbs.empty()) {
698 for (VerbTable::iterator thisverb = _verbs.begin();
699 thisverb != _verbs.end(); thisverb++) {
700 Inkscape::Verb *verbpntr = thisverb->second;
701 // std::cout << "Delete In Verb: " << verbpntr->_name << std::endl;
702 verbpntr->delete_view(view);
703 }
704 }
706 return;
707 }
709 /** \brief A function to turn a \c code into a Verb for dynamically
710 created Verbs.
711 \param code What code is being looked for
712 \return The found Verb of NULL if none is found.
714 This function basically just looks through the \c _verbs hash
715 table. STL does all the work.
716 */
717 Verb *
718 Verb::get_search(unsigned int code)
719 {
720 Verb *verb = NULL;
721 VerbTable::iterator verb_found = _verbs.find(code);
723 if (verb_found != _verbs.end()) {
724 verb = verb_found->second;
725 }
727 return verb;
728 }
730 /** \brief Find a Verb using it's ID
731 \param id Which id to search for
733 This function uses the \c _verb_ids has table to find the
734 verb by it's id. Should be much faster than previous
735 implementations.
736 */
737 Verb *
738 Verb::getbyid(gchar const *id)
739 {
740 Verb *verb = NULL;
741 VerbIDTable::iterator verb_found = _verb_ids.find(id);
743 if (verb_found != _verb_ids.end()) {
744 verb = verb_found->second;
745 }
747 if (verb == NULL)
748 printf("Unable to find: %s\n", id);
750 return verb;
751 }
753 /** \brief Decode the verb code and take appropriate action */
754 void
755 FileVerb::perform(SPAction *action, void *data, void */*pdata*/)
756 {
757 #if 0
758 /* These aren't used, but are here to remind people not to use
759 the CURRENT_DOCUMENT macros unless they really have to. */
760 Inkscape::UI::View::View *current_view = sp_action_get_view(action);
761 SPDocument *current_document = current_view->doc();
762 #endif
764 SPDesktop *desktop = dynamic_cast<SPDesktop*>(sp_action_get_view(action));
765 g_assert(desktop != NULL);
766 Gtk::Window *parent = desktop->getToplevel();
767 g_assert(parent != NULL);
769 switch ((long) data) {
770 case SP_VERB_FILE_NEW:
771 sp_file_new_default();
772 break;
773 case SP_VERB_FILE_OPEN:
774 sp_file_open_dialog(*parent, NULL, NULL);
775 break;
776 case SP_VERB_FILE_REVERT:
777 sp_file_revert_dialog();
778 break;
779 case SP_VERB_FILE_SAVE:
780 sp_file_save(*parent, NULL, NULL);
781 break;
782 case SP_VERB_FILE_SAVE_AS:
783 sp_file_save_as(*parent, NULL, NULL);
784 break;
785 case SP_VERB_FILE_SAVE_A_COPY:
786 sp_file_save_a_copy(*parent, NULL, NULL);
787 break;
788 case SP_VERB_FILE_PRINT:
789 sp_file_print(*parent);
790 break;
791 case SP_VERB_FILE_VACUUM:
792 sp_file_vacuum();
793 break;
794 case SP_VERB_FILE_PRINT_PREVIEW:
795 sp_file_print_preview(NULL, NULL);
796 break;
797 case SP_VERB_FILE_IMPORT:
798 sp_file_import(*parent);
799 break;
800 case SP_VERB_FILE_EXPORT:
801 sp_file_export_dialog(NULL);
802 break;
803 case SP_VERB_FILE_IMPORT_FROM_OCAL:
804 sp_file_import_from_ocal(*parent);
805 break;
806 case SP_VERB_FILE_EXPORT_TO_OCAL:
807 sp_file_export_to_ocal(*parent);
808 break;
809 case SP_VERB_FILE_NEXT_DESKTOP:
810 inkscape_switch_desktops_next();
811 break;
812 case SP_VERB_FILE_PREV_DESKTOP:
813 inkscape_switch_desktops_prev();
814 break;
815 case SP_VERB_FILE_CLOSE_VIEW:
816 sp_ui_close_view(NULL);
817 break;
818 case SP_VERB_FILE_QUIT:
819 sp_file_exit();
820 break;
821 default:
822 break;
823 }
826 } // end of sp_verb_action_file_perform()
828 /** \brief Decode the verb code and take appropriate action */
829 void
830 EditVerb::perform(SPAction *action, void *data, void */*pdata*/)
831 {
832 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
833 if (!dt)
834 return;
835 SPEventContext *ec = dt->event_context;
837 switch (reinterpret_cast<std::size_t>(data)) {
838 case SP_VERB_EDIT_UNDO:
839 sp_undo(dt, sp_desktop_document(dt));
840 break;
841 case SP_VERB_EDIT_REDO:
842 sp_redo(dt, sp_desktop_document(dt));
843 break;
844 case SP_VERB_EDIT_CUT:
845 sp_selection_cut();
846 break;
847 case SP_VERB_EDIT_COPY:
848 sp_selection_copy();
849 break;
850 case SP_VERB_EDIT_PASTE:
851 sp_selection_paste(false);
852 break;
853 case SP_VERB_EDIT_PASTE_STYLE:
854 sp_selection_paste_style();
855 break;
856 case SP_VERB_EDIT_PASTE_SIZE:
857 sp_selection_paste_size(true, true);
858 break;
859 case SP_VERB_EDIT_PASTE_SIZE_X:
860 sp_selection_paste_size(true, false);
861 break;
862 case SP_VERB_EDIT_PASTE_SIZE_Y:
863 sp_selection_paste_size(false, true);
864 break;
865 case SP_VERB_EDIT_PASTE_SIZE_SEPARATELY:
866 sp_selection_paste_size_separately(true, true);
867 break;
868 case SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_X:
869 sp_selection_paste_size_separately(true, false);
870 break;
871 case SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_Y:
872 sp_selection_paste_size_separately(false, true);
873 break;
874 case SP_VERB_EDIT_PASTE_IN_PLACE:
875 sp_selection_paste(true);
876 break;
877 case SP_VERB_EDIT_PASTE_LIVEPATHEFFECT:
878 sp_selection_paste_livepatheffect();
879 break;
880 case SP_VERB_EDIT_REMOVE_LIVEPATHEFFECT:
881 sp_selection_remove_livepatheffect();
882 break;
883 case SP_VERB_EDIT_DELETE:
884 sp_selection_delete();
885 break;
886 case SP_VERB_EDIT_DUPLICATE:
887 sp_selection_duplicate();
888 break;
889 case SP_VERB_EDIT_CLONE:
890 sp_selection_clone();
891 break;
892 case SP_VERB_EDIT_UNLINK_CLONE:
893 sp_selection_unlink();
894 break;
895 case SP_VERB_EDIT_CLONE_SELECT_ORIGINAL:
896 sp_select_clone_original();
897 break;
898 case SP_VERB_EDIT_SELECTION_2_MARKER:
899 sp_selection_to_marker();
900 break;
901 case SP_VERB_EDIT_SELECTION_2_GUIDES:
902 sp_selection_to_guides();
903 break;
904 case SP_VERB_EDIT_TILE:
905 sp_selection_tile();
906 break;
907 case SP_VERB_EDIT_UNTILE:
908 sp_selection_untile();
909 break;
910 case SP_VERB_EDIT_CLEAR_ALL:
911 sp_edit_clear_all();
912 break;
913 case SP_VERB_EDIT_SELECT_ALL:
914 if (tools_isactive(dt, TOOLS_NODES)) {
915 SP_NODE_CONTEXT(ec)->shape_editor->select_all_from_subpath(false);
916 } else {
917 sp_edit_select_all();
918 }
919 break;
920 case SP_VERB_EDIT_INVERT:
921 if (tools_isactive(dt, TOOLS_NODES)) {
922 SP_NODE_CONTEXT(ec)->shape_editor->select_all_from_subpath(true);
923 } else {
924 sp_edit_invert();
925 }
926 break;
927 case SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS:
928 if (tools_isactive(dt, TOOLS_NODES)) {
929 SP_NODE_CONTEXT(ec)->shape_editor->select_all(false);
930 } else {
931 sp_edit_select_all_in_all_layers();
932 }
933 break;
934 case SP_VERB_EDIT_INVERT_IN_ALL_LAYERS:
935 if (tools_isactive(dt, TOOLS_NODES)) {
936 SP_NODE_CONTEXT(ec)->shape_editor->select_all(true);
937 } else {
938 sp_edit_invert_in_all_layers();
939 }
940 break;
942 case SP_VERB_EDIT_SELECT_NEXT:
943 if (tools_isactive(dt, TOOLS_NODES)) {
944 SP_NODE_CONTEXT(ec)->shape_editor->select_next();
945 } else if (tools_isactive(dt, TOOLS_GRADIENT)
946 && ec->_grdrag->isNonEmpty()) {
947 sp_gradient_context_select_next (ec);
948 } else {
949 sp_selection_item_next();
950 }
951 break;
952 case SP_VERB_EDIT_SELECT_PREV:
953 if (tools_isactive(dt, TOOLS_NODES)) {
954 SP_NODE_CONTEXT(ec)->shape_editor->select_prev();
955 } else if (tools_isactive(dt, TOOLS_GRADIENT)
956 && ec->_grdrag->isNonEmpty()) {
957 sp_gradient_context_select_prev (ec);
958 } else {
959 sp_selection_item_prev();
960 }
961 break;
963 case SP_VERB_EDIT_DESELECT:
964 if (tools_isactive(dt, TOOLS_NODES)) {
965 SP_NODE_CONTEXT(ec)->shape_editor->deselect();
966 } else {
967 sp_desktop_selection(dt)->clear();
968 }
969 break;
971 case SP_VERB_EDIT_GUIDES_AROUND_PAGE:
972 sp_guide_create_guides_around_page(sp_desktop_document(dt));
973 break;
975 case SP_VERB_EDIT_NEXT_PATHEFFECT_PARAMETER:
976 sp_selection_next_patheffect_param(dt);
977 break;
978 default:
979 break;
980 }
982 } // end of sp_verb_action_edit_perform()
984 /** \brief Decode the verb code and take appropriate action */
985 void
986 SelectionVerb::perform(SPAction *action, void *data, void */*pdata*/)
987 {
988 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
990 if (!dt)
991 return;
993 g_assert(dt->_dlg_mgr != NULL);
995 switch (reinterpret_cast<std::size_t>(data)) {
996 case SP_VERB_SELECTION_TO_FRONT:
997 sp_selection_raise_to_top();
998 break;
999 case SP_VERB_SELECTION_TO_BACK:
1000 sp_selection_lower_to_bottom();
1001 break;
1002 case SP_VERB_SELECTION_RAISE:
1003 sp_selection_raise();
1004 break;
1005 case SP_VERB_SELECTION_LOWER:
1006 sp_selection_lower();
1007 break;
1008 case SP_VERB_SELECTION_GROUP:
1009 sp_selection_group();
1010 break;
1011 case SP_VERB_SELECTION_UNGROUP:
1012 sp_selection_ungroup();
1013 break;
1015 case SP_VERB_SELECTION_TEXTTOPATH:
1016 text_put_on_path();
1017 break;
1018 case SP_VERB_SELECTION_TEXTFROMPATH:
1019 text_remove_from_path();
1020 break;
1021 case SP_VERB_SELECTION_REMOVE_KERNS:
1022 text_remove_all_kerns();
1023 break;
1025 case SP_VERB_SELECTION_UNION:
1026 sp_selected_path_union();
1027 break;
1028 case SP_VERB_SELECTION_INTERSECT:
1029 sp_selected_path_intersect();
1030 break;
1031 case SP_VERB_SELECTION_DIFF:
1032 sp_selected_path_diff();
1033 break;
1034 case SP_VERB_SELECTION_SYMDIFF:
1035 sp_selected_path_symdiff();
1036 break;
1038 case SP_VERB_SELECTION_CUT:
1039 sp_selected_path_cut();
1040 break;
1041 case SP_VERB_SELECTION_SLICE:
1042 sp_selected_path_slice();
1043 break;
1045 case SP_VERB_SELECTION_OFFSET:
1046 sp_selected_path_offset();
1047 break;
1048 case SP_VERB_SELECTION_OFFSET_SCREEN:
1049 sp_selected_path_offset_screen(1);
1050 break;
1051 case SP_VERB_SELECTION_OFFSET_SCREEN_10:
1052 sp_selected_path_offset_screen(10);
1053 break;
1054 case SP_VERB_SELECTION_INSET:
1055 sp_selected_path_inset();
1056 break;
1057 case SP_VERB_SELECTION_INSET_SCREEN:
1058 sp_selected_path_inset_screen(1);
1059 break;
1060 case SP_VERB_SELECTION_INSET_SCREEN_10:
1061 sp_selected_path_inset_screen(10);
1062 break;
1063 case SP_VERB_SELECTION_DYNAMIC_OFFSET:
1064 sp_selected_path_create_offset_object_zero();
1065 tools_switch_current(TOOLS_NODES);
1066 break;
1067 case SP_VERB_SELECTION_LINKED_OFFSET:
1068 sp_selected_path_create_updating_offset_object_zero();
1069 tools_switch_current(TOOLS_NODES);
1070 break;
1072 case SP_VERB_SELECTION_OUTLINE:
1073 sp_selected_path_outline();
1074 break;
1075 case SP_VERB_SELECTION_SIMPLIFY:
1076 sp_selected_path_simplify();
1077 break;
1078 case SP_VERB_SELECTION_REVERSE:
1079 sp_selected_path_reverse();
1080 break;
1081 case SP_VERB_SELECTION_TRACE:
1082 inkscape_dialogs_unhide();
1083 dt->_dlg_mgr->showDialog("Trace");
1084 break;
1085 case SP_VERB_SELECTION_CREATE_BITMAP:
1086 sp_selection_create_bitmap_copy();
1087 break;
1089 case SP_VERB_SELECTION_COMBINE:
1090 sp_selected_path_combine();
1091 break;
1092 case SP_VERB_SELECTION_BREAK_APART:
1093 sp_selected_path_break_apart();
1094 break;
1095 case SP_VERB_SELECTION_GRIDTILE:
1096 inkscape_dialogs_unhide();
1097 dt->_dlg_mgr->showDialog("TileDialog");
1098 break;
1099 default:
1100 break;
1101 }
1103 } // end of sp_verb_action_selection_perform()
1105 /** \brief Decode the verb code and take appropriate action */
1106 void
1107 LayerVerb::perform(SPAction *action, void *data, void */*pdata*/)
1108 {
1109 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1110 unsigned int verb = reinterpret_cast<std::size_t>(data);
1112 if ( !dt || !dt->currentLayer() ) {
1113 return;
1114 }
1116 switch (verb) {
1117 case SP_VERB_LAYER_NEW: {
1118 Inkscape::UI::Dialogs::LayerPropertiesDialog::showCreate(dt, dt->currentLayer());
1119 break;
1120 }
1121 case SP_VERB_LAYER_RENAME: {
1122 Inkscape::UI::Dialogs::LayerPropertiesDialog::showRename(dt, dt->currentLayer());
1123 break;
1124 }
1125 case SP_VERB_LAYER_NEXT: {
1126 SPObject *next=Inkscape::next_layer(dt->currentRoot(), dt->currentLayer());
1127 if (next) {
1128 dt->setCurrentLayer(next);
1129 sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_NEXT,
1130 _("Switch to next layer"));
1131 dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Switched to next layer."));
1132 } else {
1133 dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Cannot go past last layer."));
1134 }
1135 break;
1136 }
1137 case SP_VERB_LAYER_PREV: {
1138 SPObject *prev=Inkscape::previous_layer(dt->currentRoot(), dt->currentLayer());
1139 if (prev) {
1140 dt->setCurrentLayer(prev);
1141 sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_PREV,
1142 _("Switch to previous layer"));
1143 dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Switched to previous layer."));
1144 } else {
1145 dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Cannot go before first layer."));
1146 }
1147 break;
1148 }
1149 case SP_VERB_LAYER_MOVE_TO_NEXT: {
1150 sp_selection_to_next_layer();
1151 break;
1152 }
1153 case SP_VERB_LAYER_MOVE_TO_PREV: {
1154 sp_selection_to_prev_layer();
1155 break;
1156 }
1157 case SP_VERB_LAYER_TO_TOP:
1158 case SP_VERB_LAYER_TO_BOTTOM:
1159 case SP_VERB_LAYER_RAISE:
1160 case SP_VERB_LAYER_LOWER: {
1161 if ( dt->currentLayer() == dt->currentRoot() ) {
1162 dt->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No current layer."));
1163 return;
1164 }
1166 SPItem *layer=SP_ITEM(dt->currentLayer());
1167 g_return_if_fail(layer != NULL);
1169 SPObject *old_pos=SP_OBJECT_NEXT(layer);
1171 switch (verb) {
1172 case SP_VERB_LAYER_TO_TOP:
1173 layer->raiseToTop();
1174 break;
1175 case SP_VERB_LAYER_TO_BOTTOM:
1176 layer->lowerToBottom();
1177 break;
1178 case SP_VERB_LAYER_RAISE:
1179 layer->raiseOne();
1180 break;
1181 case SP_VERB_LAYER_LOWER:
1182 layer->lowerOne();
1183 break;
1184 }
1186 if ( SP_OBJECT_NEXT(layer) != old_pos ) {
1187 char const *message = NULL;
1188 Glib::ustring description = "";
1189 switch (verb) {
1190 case SP_VERB_LAYER_TO_TOP:
1191 message = g_strdup_printf(_("Raised layer <b>%s</b>."), layer->defaultLabel());
1192 description = _("Layer to top");
1193 break;
1194 case SP_VERB_LAYER_RAISE:
1195 message = g_strdup_printf(_("Raised layer <b>%s</b>."), layer->defaultLabel());
1196 description = _("Raise layer");
1197 break;
1198 case SP_VERB_LAYER_TO_BOTTOM:
1199 message = g_strdup_printf(_("Lowered layer <b>%s</b>."), layer->defaultLabel());
1200 description = _("Layer to bottom");
1201 break;
1202 case SP_VERB_LAYER_LOWER:
1203 message = g_strdup_printf(_("Lowered layer <b>%s</b>."), layer->defaultLabel());
1204 description = _("Lower layer");
1205 break;
1206 };
1207 sp_document_done(sp_desktop_document(dt), verb, description);
1208 if (message) {
1209 dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, message);
1210 g_free((void *) message);
1211 }
1212 } else {
1213 dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Cannot move layer any further."));
1214 }
1216 break;
1217 }
1218 case SP_VERB_LAYER_DELETE: {
1219 if ( dt->currentLayer() != dt->currentRoot() ) {
1220 sp_desktop_selection(dt)->clear();
1221 SPObject *old_layer=dt->currentLayer();
1223 sp_object_ref(old_layer, NULL);
1224 SPObject *survivor=Inkscape::next_layer(dt->currentRoot(), old_layer);
1225 if (!survivor) {
1226 survivor = Inkscape::previous_layer(dt->currentRoot(), old_layer);
1227 }
1229 /* Deleting the old layer before switching layers is a hack to trigger the
1230 * listeners of the deletion event (as happens when old_layer is deleted using the
1231 * xml editor). See
1232 * http://sourceforge.net/tracker/index.php?func=detail&aid=1339397&group_id=93438&atid=604306
1233 */
1234 old_layer->deleteObject();
1235 sp_object_unref(old_layer, NULL);
1236 if (survivor) {
1237 dt->setCurrentLayer(survivor);
1238 }
1240 sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_DELETE,
1241 _("Delete layer"));
1243 // TRANSLATORS: this means "The layer has been deleted."
1244 dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Deleted layer."));
1245 } else {
1246 dt->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No current layer."));
1247 }
1248 break;
1249 }
1250 }
1252 return;
1253 } // end of sp_verb_action_layer_perform()
1255 /** \brief Decode the verb code and take appropriate action */
1256 void
1257 ObjectVerb::perform( SPAction *action, void *data, void */*pdata*/ )
1258 {
1259 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1260 if (!dt)
1261 return;
1263 SPEventContext *ec = dt->event_context;
1265 Inkscape::Selection *sel = sp_desktop_selection(dt);
1267 if (sel->isEmpty())
1268 return;
1270 NR::Maybe<NR::Rect> bbox = sel->bounds();
1271 if (!bbox) {
1272 return;
1273 }
1274 // If the rotation center of the selection is visible, choose it as reference point
1275 // for horizontal and vertical flips. Otherwise, take the center of the bounding box.
1276 NR::Point center;
1277 if (tools_isactive(dt, TOOLS_SELECT) && sel->center() && SP_SELECT_CONTEXT(ec)->_seltrans->centerIsVisible())
1278 center = *sel->center();
1279 else
1280 center = bbox->midpoint();
1282 switch (reinterpret_cast<std::size_t>(data)) {
1283 case SP_VERB_OBJECT_ROTATE_90_CW:
1284 sp_selection_rotate_90_cw();
1285 break;
1286 case SP_VERB_OBJECT_ROTATE_90_CCW:
1287 sp_selection_rotate_90_ccw();
1288 break;
1289 case SP_VERB_OBJECT_FLATTEN:
1290 sp_selection_remove_transform();
1291 break;
1292 case SP_VERB_OBJECT_TO_CURVE:
1293 sp_selected_path_to_curves();
1294 break;
1295 case SP_VERB_OBJECT_FLOW_TEXT:
1296 text_flow_into_shape();
1297 break;
1298 case SP_VERB_OBJECT_UNFLOW_TEXT:
1299 text_unflow();
1300 break;
1301 case SP_VERB_OBJECT_FLOWTEXT_TO_TEXT:
1302 flowtext_to_text();
1303 break;
1304 case SP_VERB_OBJECT_FLIP_HORIZONTAL:
1305 // When working with the node tool ...
1306 if (tools_isactive(dt, TOOLS_NODES)) {
1307 Inkscape::NodePath::Node *active_node = Inkscape::NodePath::Path::active_node;
1309 // ... and one of the nodes is currently mouseovered ...
1310 if (active_node) {
1312 // ... flip the selected nodes about that node
1313 SP_NODE_CONTEXT(ec)->shape_editor->flip(NR::X, active_node->pos);
1314 } else {
1316 // ... or else about the center of their bounding box.
1317 SP_NODE_CONTEXT(ec)->shape_editor->flip(NR::X);
1318 }
1320 // When working with the selector tool, flip the selection about its rotation center
1321 // (if it is visible) or about the center of the bounding box.
1322 } else {
1323 sp_selection_scale_relative(sel, center, NR::scale(-1.0, 1.0));
1324 }
1325 sp_document_done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_HORIZONTAL,
1326 _("Flip horizontally"));
1327 break;
1328 case SP_VERB_OBJECT_FLIP_VERTICAL:
1329 // The behaviour is analogous to flipping horizontally
1330 if (tools_isactive(dt, TOOLS_NODES)) {
1331 Inkscape::NodePath::Node *active_node = Inkscape::NodePath::Path::active_node;
1332 if (active_node) {
1333 SP_NODE_CONTEXT(ec)->shape_editor->flip(NR::Y, active_node->pos);
1334 } else {
1335 SP_NODE_CONTEXT(ec)->shape_editor->flip(NR::Y);
1336 }
1337 } else {
1338 sp_selection_scale_relative(sel, center, NR::scale(1.0, -1.0));
1339 }
1340 sp_document_done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_VERTICAL,
1341 _("Flip vertically"));
1342 break;
1343 case SP_VERB_OBJECT_SET_MASK:
1344 sp_selection_set_mask(false, false);
1345 break;
1346 case SP_VERB_OBJECT_EDIT_MASK:
1347 sp_selection_edit_clip_or_mask(dt, false);
1348 break;
1349 case SP_VERB_OBJECT_UNSET_MASK:
1350 sp_selection_unset_mask(false);
1351 break;
1352 case SP_VERB_OBJECT_SET_CLIPPATH:
1353 sp_selection_set_mask(true, false);
1354 break;
1355 case SP_VERB_OBJECT_EDIT_CLIPPATH:
1356 sp_selection_edit_clip_or_mask(dt, true);
1357 break;
1358 case SP_VERB_OBJECT_UNSET_CLIPPATH:
1359 sp_selection_unset_mask(true);
1360 break;
1361 default:
1362 break;
1363 }
1365 } // end of sp_verb_action_object_perform()
1367 /** \brief Decode the verb code and take appropriate action */
1368 void
1369 ContextVerb::perform(SPAction *action, void *data, void */*pdata*/)
1370 {
1371 SPDesktop *dt;
1372 sp_verb_t verb;
1373 int vidx;
1375 dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1377 if (!dt)
1378 return;
1380 verb = (sp_verb_t)GPOINTER_TO_INT((gpointer)data);
1382 /** \todo !!! hopefully this can go away soon and actions can look after
1383 * themselves
1384 */
1385 for (vidx = SP_VERB_CONTEXT_SELECT; vidx <= SP_VERB_CONTEXT_PAINTBUCKET_PREFS; vidx++)
1386 {
1387 SPAction *tool_action= get((sp_verb_t)vidx)->get_action(dt);
1388 if (tool_action) {
1389 sp_action_set_active(tool_action, vidx == (int)verb);
1390 }
1391 }
1393 switch (verb) {
1394 case SP_VERB_CONTEXT_SELECT:
1395 tools_switch_current(TOOLS_SELECT);
1396 break;
1397 case SP_VERB_CONTEXT_NODE:
1398 tools_switch_current(TOOLS_NODES);
1399 break;
1400 case SP_VERB_CONTEXT_TWEAK:
1401 tools_switch_current(TOOLS_TWEAK);
1402 break;
1403 case SP_VERB_CONTEXT_RECT:
1404 tools_switch_current(TOOLS_SHAPES_RECT);
1405 break;
1406 case SP_VERB_CONTEXT_3DBOX:
1407 tools_switch_current(TOOLS_SHAPES_3DBOX);
1408 break;
1409 case SP_VERB_CONTEXT_ARC:
1410 tools_switch_current(TOOLS_SHAPES_ARC);
1411 break;
1412 case SP_VERB_CONTEXT_STAR:
1413 tools_switch_current(TOOLS_SHAPES_STAR);
1414 break;
1415 case SP_VERB_CONTEXT_SPIRAL:
1416 tools_switch_current(TOOLS_SHAPES_SPIRAL);
1417 break;
1418 case SP_VERB_CONTEXT_PENCIL:
1419 tools_switch_current(TOOLS_FREEHAND_PENCIL);
1420 break;
1421 case SP_VERB_CONTEXT_PEN:
1422 tools_switch_current(TOOLS_FREEHAND_PEN);
1423 break;
1424 case SP_VERB_CONTEXT_CALLIGRAPHIC:
1425 tools_switch_current(TOOLS_CALLIGRAPHIC);
1426 break;
1427 case SP_VERB_CONTEXT_TEXT:
1428 tools_switch_current(TOOLS_TEXT);
1429 break;
1430 case SP_VERB_CONTEXT_GRADIENT:
1431 tools_switch_current(TOOLS_GRADIENT);
1432 break;
1433 case SP_VERB_CONTEXT_ZOOM:
1434 tools_switch_current(TOOLS_ZOOM);
1435 break;
1436 case SP_VERB_CONTEXT_DROPPER:
1437 tools_switch_current(TOOLS_DROPPER);
1438 break;
1439 case SP_VERB_CONTEXT_CONNECTOR:
1440 tools_switch_current (TOOLS_CONNECTOR);
1441 break;
1442 case SP_VERB_CONTEXT_PAINTBUCKET:
1443 tools_switch_current(TOOLS_PAINTBUCKET);
1444 break;
1446 case SP_VERB_CONTEXT_SELECT_PREFS:
1447 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SELECTOR);
1448 dt->_dlg_mgr->showDialog("InkscapePreferences");
1449 break;
1450 case SP_VERB_CONTEXT_NODE_PREFS:
1451 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_NODE);
1452 dt->_dlg_mgr->showDialog("InkscapePreferences");
1453 break;
1454 case SP_VERB_CONTEXT_TWEAK_PREFS:
1455 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_TWEAK);
1456 dt->_dlg_mgr->showDialog("InkscapePreferences");
1457 break;
1458 case SP_VERB_CONTEXT_RECT_PREFS:
1459 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SHAPES_RECT);
1460 dt->_dlg_mgr->showDialog("InkscapePreferences");
1461 break;
1462 case SP_VERB_CONTEXT_3DBOX_PREFS:
1463 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SHAPES_3DBOX);
1464 dt->_dlg_mgr->showDialog("InkscapePreferences");
1465 break;
1466 case SP_VERB_CONTEXT_ARC_PREFS:
1467 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SHAPES_ELLIPSE);
1468 dt->_dlg_mgr->showDialog("InkscapePreferences");
1469 break;
1470 case SP_VERB_CONTEXT_STAR_PREFS:
1471 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SHAPES_STAR);
1472 dt->_dlg_mgr->showDialog("InkscapePreferences");
1473 break;
1474 case SP_VERB_CONTEXT_SPIRAL_PREFS:
1475 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SHAPES_SPIRAL);
1476 dt->_dlg_mgr->showDialog("InkscapePreferences");
1477 break;
1478 case SP_VERB_CONTEXT_PENCIL_PREFS:
1479 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_PENCIL);
1480 dt->_dlg_mgr->showDialog("InkscapePreferences");
1481 break;
1482 case SP_VERB_CONTEXT_PEN_PREFS:
1483 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_PEN);
1484 dt->_dlg_mgr->showDialog("InkscapePreferences");
1485 break;
1486 case SP_VERB_CONTEXT_CALLIGRAPHIC_PREFS:
1487 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_CALLIGRAPHY);
1488 dt->_dlg_mgr->showDialog("InkscapePreferences");
1489 break;
1490 case SP_VERB_CONTEXT_TEXT_PREFS:
1491 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_TEXT);
1492 dt->_dlg_mgr->showDialog("InkscapePreferences");
1493 break;
1494 case SP_VERB_CONTEXT_GRADIENT_PREFS:
1495 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_GRADIENT);
1496 dt->_dlg_mgr->showDialog("InkscapePreferences");
1497 break;
1498 case SP_VERB_CONTEXT_ZOOM_PREFS:
1499 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_ZOOM);
1500 dt->_dlg_mgr->showDialog("InkscapePreferences");
1501 break;
1502 case SP_VERB_CONTEXT_DROPPER_PREFS:
1503 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_DROPPER);
1504 dt->_dlg_mgr->showDialog("InkscapePreferences");
1505 break;
1506 case SP_VERB_CONTEXT_CONNECTOR_PREFS:
1507 prefs_set_int_attribute ("dialogs.preferences", "page", PREFS_PAGE_TOOLS_CONNECTOR);
1508 dt->_dlg_mgr->showDialog("InkscapePreferences");
1509 break;
1510 case SP_VERB_CONTEXT_PAINTBUCKET_PREFS:
1511 prefs_set_int_attribute ("dialogs.preferences", "page", PREFS_PAGE_TOOLS_PAINTBUCKET);
1512 dt->_dlg_mgr->showDialog("InkscapePreferences");
1513 break;
1515 default:
1516 break;
1517 }
1519 } // end of sp_verb_action_ctx_perform()
1521 /** \brief Decode the verb code and take appropriate action */
1522 void
1523 TextVerb::perform(SPAction *action, void */*data*/, void */*pdata*/)
1524 {
1525 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1526 if (!dt)
1527 return;
1529 SPDocument *doc = sp_desktop_document(dt);
1530 (void)doc;
1531 Inkscape::XML::Node *repr = SP_OBJECT_REPR(dt->namedview);
1532 (void)repr;
1533 }
1535 /** \brief Decode the verb code and take appropriate action */
1536 void
1537 ZoomVerb::perform(SPAction *action, void *data, void */*pdata*/)
1538 {
1539 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1540 if (!dt)
1541 return;
1542 SPEventContext *ec = dt->event_context;
1544 SPDocument *doc = sp_desktop_document(dt);
1546 Inkscape::XML::Node *repr = SP_OBJECT_REPR(dt->namedview);
1548 gdouble zoom_inc =
1549 prefs_get_double_attribute_limited( "options.zoomincrement",
1550 "value", 1.414213562, 1.01, 10 );
1552 switch (GPOINTER_TO_INT(data)) {
1553 case SP_VERB_ZOOM_IN:
1554 {
1555 gint mul = 1 + gobble_key_events(
1556 GDK_KP_Add, 0); // with any mask
1557 // While drawing with the pen/pencil tool, zoom towards the end of the unfinished path
1558 if (tools_isactive(dt, TOOLS_FREEHAND_PENCIL) || tools_isactive(dt, TOOLS_FREEHAND_PEN)) {
1559 SPCurve *rc = SP_DRAW_CONTEXT(ec)->red_curve;
1560 if (sp_curve_last_bpath(rc)) {
1561 NR::Point const zoom_to (sp_curve_last_point(rc));
1562 dt->zoom_relative_keep_point(zoom_to, mul*zoom_inc);
1563 break;
1564 }
1565 }
1567 NR::Rect const d = dt->get_display_area();
1568 dt->zoom_relative( d.midpoint()[NR::X], d.midpoint()[NR::Y], mul*zoom_inc);
1569 break;
1570 }
1571 case SP_VERB_ZOOM_OUT:
1572 {
1573 gint mul = 1 + gobble_key_events(
1574 GDK_KP_Subtract, 0); // with any mask
1575 // While drawing with the pen/pencil tool, zoom away from the end of the unfinished path
1576 if (tools_isactive(dt, TOOLS_FREEHAND_PENCIL) || tools_isactive(dt, TOOLS_FREEHAND_PEN)) {
1577 SPCurve *rc = SP_DRAW_CONTEXT(ec)->red_curve;
1578 if (sp_curve_last_bpath(rc)) {
1579 NR::Point const zoom_to (sp_curve_last_point(rc));
1580 dt->zoom_relative_keep_point(zoom_to, 1 / (mul*zoom_inc));
1581 break;
1582 }
1583 }
1585 NR::Rect const d = dt->get_display_area();
1586 dt->zoom_relative( d.midpoint()[NR::X], d.midpoint()[NR::Y], 1 / (mul*zoom_inc) );
1587 break;
1588 }
1589 case SP_VERB_ZOOM_1_1:
1590 {
1591 NR::Rect const d = dt->get_display_area();
1592 dt->zoom_absolute( d.midpoint()[NR::X], d.midpoint()[NR::Y], 1.0 );
1593 break;
1594 }
1595 case SP_VERB_ZOOM_1_2:
1596 {
1597 NR::Rect const d = dt->get_display_area();
1598 dt->zoom_absolute( d.midpoint()[NR::X], d.midpoint()[NR::Y], 0.5);
1599 break;
1600 }
1601 case SP_VERB_ZOOM_2_1:
1602 {
1603 NR::Rect const d = dt->get_display_area();
1604 dt->zoom_absolute( d.midpoint()[NR::X], d.midpoint()[NR::Y], 2.0 );
1605 break;
1606 }
1607 case SP_VERB_ZOOM_PAGE:
1608 dt->zoom_page();
1609 break;
1610 case SP_VERB_ZOOM_PAGE_WIDTH:
1611 dt->zoom_page_width();
1612 break;
1613 case SP_VERB_ZOOM_DRAWING:
1614 dt->zoom_drawing();
1615 break;
1616 case SP_VERB_ZOOM_SELECTION:
1617 dt->zoom_selection();
1618 break;
1619 case SP_VERB_ZOOM_NEXT:
1620 dt->next_zoom();
1621 break;
1622 case SP_VERB_ZOOM_PREV:
1623 dt->prev_zoom();
1624 break;
1625 case SP_VERB_TOGGLE_RULERS:
1626 dt->toggleRulers();
1627 break;
1628 case SP_VERB_TOGGLE_SCROLLBARS:
1629 dt->toggleScrollbars();
1630 break;
1631 case SP_VERB_TOGGLE_GUIDES:
1632 sp_namedview_toggle_guides(doc, repr);
1633 break;
1634 case SP_VERB_TOGGLE_SNAPPING:
1635 dt->toggleSnapping();
1636 break;
1637 case SP_VERB_TOGGLE_GRID:
1638 dt->toggleGrids();
1639 break;
1640 #ifdef HAVE_GTK_WINDOW_FULLSCREEN
1641 case SP_VERB_FULLSCREEN:
1642 dt->fullscreen();
1643 break;
1644 #endif /* HAVE_GTK_WINDOW_FULLSCREEN */
1645 case SP_VERB_VIEW_NEW:
1646 sp_ui_new_view();
1647 break;
1648 case SP_VERB_VIEW_NEW_PREVIEW:
1649 sp_ui_new_view_preview();
1650 break;
1651 case SP_VERB_VIEW_MODE_NORMAL:
1652 dt->setDisplayModeNormal();
1653 break;
1654 case SP_VERB_VIEW_MODE_NO_FILTERS:
1655 dt->setDisplayModeNoFilters();
1656 break;
1657 case SP_VERB_VIEW_MODE_OUTLINE:
1658 dt->setDisplayModeOutline();
1659 break;
1660 case SP_VERB_VIEW_MODE_TOGGLE:
1661 dt->displayModeToggle();
1662 break;
1663 case SP_VERB_VIEW_CMS_TOGGLE:
1664 dt->toggleColorProfAdjust();
1665 break;
1666 case SP_VERB_VIEW_ICON_PREVIEW:
1667 inkscape_dialogs_unhide();
1668 dt->_dlg_mgr->showDialog("IconPreviewPanel");
1669 break;
1670 default:
1671 break;
1672 }
1674 dt->updateNow();
1676 } // end of sp_verb_action_zoom_perform()
1678 /** \brief Decode the verb code and take appropriate action */
1679 void
1680 DialogVerb::perform(SPAction *action, void *data, void */*pdata*/)
1681 {
1682 if (reinterpret_cast<std::size_t>(data) != SP_VERB_DIALOG_TOGGLE) {
1683 // unhide all when opening a new dialog
1684 inkscape_dialogs_unhide();
1685 }
1687 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1688 g_assert(dt->_dlg_mgr != NULL);
1690 switch (reinterpret_cast<std::size_t>(data)) {
1691 case SP_VERB_DIALOG_DISPLAY:
1692 //sp_display_dialog();
1693 dt->_dlg_mgr->showDialog("InkscapePreferences");
1694 break;
1695 case SP_VERB_DIALOG_METADATA:
1696 // sp_desktop_dialog();
1697 dt->_dlg_mgr->showDialog("DocumentMetadata");
1698 break;
1699 case SP_VERB_DIALOG_NAMEDVIEW:
1700 // sp_desktop_dialog();
1701 dt->_dlg_mgr->showDialog("DocumentProperties");
1702 break;
1703 case SP_VERB_DIALOG_FILL_STROKE:
1704 dt->_dlg_mgr->showDialog("FillAndStroke");
1705 break;
1706 case SP_VERB_DIALOG_SWATCHES:
1707 dt->_dlg_mgr->showDialog("Swatches");
1708 break;
1709 case SP_VERB_DIALOG_TRANSFORM:
1710 dt->_dlg_mgr->showDialog("Transformation");
1711 break;
1712 case SP_VERB_DIALOG_ALIGN_DISTRIBUTE:
1713 dt->_dlg_mgr->showDialog("AlignAndDistribute");
1714 break;
1715 case SP_VERB_DIALOG_TEXT:
1716 sp_text_edit_dialog();
1717 break;
1718 case SP_VERB_DIALOG_XML_EDITOR:
1719 sp_xml_tree_dialog();
1720 break;
1721 case SP_VERB_DIALOG_FIND:
1722 sp_find_dialog();
1723 // Please test the new find dialog if you have time:
1724 // dt->_dlg_mgr->showDialog("Find");
1725 break;
1726 case SP_VERB_DIALOG_DEBUG:
1727 dt->_dlg_mgr->showDialog("Messages");
1728 break;
1729 case SP_VERB_DIALOG_SCRIPT:
1730 dt->_dlg_mgr->showDialog("Script");
1731 break;
1732 case SP_VERB_DIALOG_UNDO_HISTORY:
1733 dt->_dlg_mgr->showDialog("UndoHistory");
1734 break;
1735 case SP_VERB_DIALOG_TOGGLE:
1736 inkscape_dialogs_toggle();
1737 break;
1738 case SP_VERB_DIALOG_CLONETILER:
1739 clonetiler_dialog();
1740 break;
1741 case SP_VERB_DIALOG_ITEM:
1742 sp_item_dialog();
1743 break;
1744 #ifdef WITH_INKBOARD
1745 case SP_VERB_XMPP_CLIENT:
1746 {
1747 Inkscape::Whiteboard::SessionManager::showClient();
1748 break;
1749 }
1750 #endif
1751 case SP_VERB_DIALOG_INPUT:
1752 sp_input_dialog();
1753 break;
1754 case SP_VERB_DIALOG_INPUT2:
1755 dt->_dlg_mgr->showDialog("InputDevices");
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"),
2435 new ContextVerb(SP_VERB_CONTEXT_LPE, "ToolLPE", N_("LPE Edit"),
2436 N_("Edit Live Path Effect parameters"), "draw_lpe"),
2437 /* Tool prefs */
2438 new ContextVerb(SP_VERB_CONTEXT_SELECT_PREFS, "SelectPrefs", N_("Selector Preferences"),
2439 N_("Open Preferences for the Selector tool"), NULL),
2440 new ContextVerb(SP_VERB_CONTEXT_NODE_PREFS, "NodePrefs", N_("Node Tool Preferences"),
2441 N_("Open Preferences for the Node tool"), NULL),
2442 new ContextVerb(SP_VERB_CONTEXT_TWEAK_PREFS, "TweakPrefs", N_("Tweak Tool Preferences"),
2443 N_("Open Preferences for the Tweak tool"), NULL),
2444 new ContextVerb(SP_VERB_CONTEXT_RECT_PREFS, "RectPrefs", N_("Rectangle Preferences"),
2445 N_("Open Preferences for the Rectangle tool"), NULL),
2446 new ContextVerb(SP_VERB_CONTEXT_3DBOX_PREFS, "3DBoxPrefs", N_("3D Box Preferences"),
2447 N_("Open Preferences for the 3D Box tool"), NULL),
2448 new ContextVerb(SP_VERB_CONTEXT_ARC_PREFS, "ArcPrefs", N_("Ellipse Preferences"),
2449 N_("Open Preferences for the Ellipse tool"), NULL),
2450 new ContextVerb(SP_VERB_CONTEXT_STAR_PREFS, "StarPrefs", N_("Star Preferences"),
2451 N_("Open Preferences for the Star tool"), NULL),
2452 new ContextVerb(SP_VERB_CONTEXT_SPIRAL_PREFS, "SpiralPrefs", N_("Spiral Preferences"),
2453 N_("Open Preferences for the Spiral tool"), NULL),
2454 new ContextVerb(SP_VERB_CONTEXT_PENCIL_PREFS, "PencilPrefs", N_("Pencil Preferences"),
2455 N_("Open Preferences for the Pencil tool"), NULL),
2456 new ContextVerb(SP_VERB_CONTEXT_PEN_PREFS, "PenPrefs", N_("Pen Preferences"),
2457 N_("Open Preferences for the Pen tool"), NULL),
2458 new ContextVerb(SP_VERB_CONTEXT_CALLIGRAPHIC_PREFS, "CalligraphicPrefs", N_("Calligraphic Preferences"),
2459 N_("Open Preferences for the Calligraphy tool"), NULL),
2460 new ContextVerb(SP_VERB_CONTEXT_TEXT_PREFS, "TextPrefs", N_("Text Preferences"),
2461 N_("Open Preferences for the Text tool"), NULL),
2462 new ContextVerb(SP_VERB_CONTEXT_GRADIENT_PREFS, "GradientPrefs", N_("Gradient Preferences"),
2463 N_("Open Preferences for the Gradient tool"), NULL),
2464 new ContextVerb(SP_VERB_CONTEXT_ZOOM_PREFS, "ZoomPrefs", N_("Zoom Preferences"),
2465 N_("Open Preferences for the Zoom tool"), NULL),
2466 new ContextVerb(SP_VERB_CONTEXT_DROPPER_PREFS, "DropperPrefs", N_("Dropper Preferences"),
2467 N_("Open Preferences for the Dropper tool"), NULL),
2468 new ContextVerb(SP_VERB_CONTEXT_CONNECTOR_PREFS, "ConnectorPrefs", N_("Connector Preferences"),
2469 N_("Open Preferences for the Connector tool"), NULL),
2470 new ContextVerb(SP_VERB_CONTEXT_PAINTBUCKET_PREFS, "PaintBucketPrefs", N_("Paint Bucket Preferences"),
2471 N_("Open Preferences for the Paint Bucket tool"), NULL),
2473 /* Zoom/View */
2474 new ZoomVerb(SP_VERB_ZOOM_IN, "ZoomIn", N_("Zoom In"), N_("Zoom in"), "zoom_in"),
2475 new ZoomVerb(SP_VERB_ZOOM_OUT, "ZoomOut", N_("Zoom Out"), N_("Zoom out"), "zoom_out"),
2476 new ZoomVerb(SP_VERB_TOGGLE_RULERS, "ToggleRulers", N_("_Rulers"), N_("Show or hide the canvas rulers"), "rulers"),
2477 new ZoomVerb(SP_VERB_TOGGLE_SCROLLBARS, "ToggleScrollbars", N_("Scroll_bars"), N_("Show or hide the canvas scrollbars"), "scrollbars"),
2478 new ZoomVerb(SP_VERB_TOGGLE_GRID, "ToggleGrid", N_("_Grid"), N_("Show or hide the grid"), "grid"),
2479 new ZoomVerb(SP_VERB_TOGGLE_GUIDES, "ToggleGuides", N_("G_uides"), N_("Show or hide guides (drag from a ruler to create a guide)"), "guides"),
2480 new ZoomVerb(SP_VERB_TOGGLE_SNAPPING, "ToggleSnapping", N_("Snap"), N_("Toggle snapping on or off"), NULL),
2481 new ZoomVerb(SP_VERB_ZOOM_NEXT, "ZoomNext", N_("Nex_t Zoom"), N_("Next zoom (from the history of zooms)"),
2482 "zoom_next"),
2483 new ZoomVerb(SP_VERB_ZOOM_PREV, "ZoomPrev", N_("Pre_vious Zoom"), N_("Previous zoom (from the history of zooms)"),
2484 "zoom_previous"),
2485 new ZoomVerb(SP_VERB_ZOOM_1_1, "Zoom1:0", N_("Zoom 1:_1"), N_("Zoom to 1:1"),
2486 "zoom_1_to_1"),
2487 new ZoomVerb(SP_VERB_ZOOM_1_2, "Zoom1:2", N_("Zoom 1:_2"), N_("Zoom to 1:2"),
2488 "zoom_1_to_2"),
2489 new ZoomVerb(SP_VERB_ZOOM_2_1, "Zoom2:1", N_("_Zoom 2:1"), N_("Zoom to 2:1"),
2490 "zoom_2_to_1"),
2491 #ifdef HAVE_GTK_WINDOW_FULLSCREEN
2492 new ZoomVerb(SP_VERB_FULLSCREEN, "FullScreen", N_("_Fullscreen"), N_("Stretch this document window to full screen"),
2493 "fullscreen"),
2494 #endif /* HAVE_GTK_WINDOW_FULLSCREEN */
2495 new ZoomVerb(SP_VERB_VIEW_NEW, "ViewNew", N_("Duplic_ate Window"), N_("Open a new window with the same document"),
2496 "view_new"),
2497 new ZoomVerb(SP_VERB_VIEW_NEW_PREVIEW, "ViewNewPreview", N_("_New View Preview"),
2498 N_("New View Preview"), NULL/*"view_new_preview"*/),
2500 new ZoomVerb(SP_VERB_VIEW_MODE_NORMAL, "ViewModeNormal", N_("_Normal"),
2501 N_("Switch to normal display mode"), NULL),
2502 new ZoomVerb(SP_VERB_VIEW_MODE_NO_FILTERS, "ViewModeNoFilters", N_("No _Filters"),
2503 N_("Switch to normal display without filters"), NULL),
2504 new ZoomVerb(SP_VERB_VIEW_MODE_OUTLINE, "ViewModeOutline", N_("_Outline"),
2505 N_("Switch to outline (wireframe) display mode"), NULL),
2506 new ZoomVerb(SP_VERB_VIEW_MODE_TOGGLE, "ViewModeToggle", N_("_Toggle"),
2507 N_("Toggle between normal and outline display modes"), NULL),
2509 new ZoomVerb(SP_VERB_VIEW_CMS_TOGGLE, "ViewCmsToggle", N_("Color-managed view"),
2510 N_("Toggle color-managed display for this document window"), "color_management"),
2512 new ZoomVerb(SP_VERB_VIEW_ICON_PREVIEW, "ViewIconPreview", N_("Ico_n Preview..."),
2513 N_("Open a window to preview objects at different icon resolutions"), "view_icon_preview"),
2514 new ZoomVerb(SP_VERB_ZOOM_PAGE, "ZoomPage", N_("_Page"),
2515 N_("Zoom to fit page in window"), "zoom_page"),
2516 new ZoomVerb(SP_VERB_ZOOM_PAGE_WIDTH, "ZoomPageWidth", N_("Page _Width"),
2517 N_("Zoom to fit page width in window"), "zoom_pagewidth"),
2518 new ZoomVerb(SP_VERB_ZOOM_DRAWING, "ZoomDrawing", N_("_Drawing"),
2519 N_("Zoom to fit drawing in window"), "zoom_draw"),
2520 new ZoomVerb(SP_VERB_ZOOM_SELECTION, "ZoomSelection", N_("_Selection"),
2521 N_("Zoom to fit selection in window"), "zoom_select"),
2523 /* Dialogs */
2524 new DialogVerb(SP_VERB_DIALOG_DISPLAY, "DialogPreferences", N_("In_kscape Preferences..."),
2525 N_("Edit global Inkscape preferences"), GTK_STOCK_PREFERENCES ),
2526 new DialogVerb(SP_VERB_DIALOG_NAMEDVIEW, "DialogDocumentProperties", N_("_Document Properties..."),
2527 N_("Edit properties of this document (to be saved with the document)"), GTK_STOCK_PROPERTIES ),
2528 new DialogVerb(SP_VERB_DIALOG_METADATA, "DialogMetadata", N_("Document _Metadata..."),
2529 N_("Edit document metadata (to be saved with the document)"), "document_metadata" ),
2530 new DialogVerb(SP_VERB_DIALOG_FILL_STROKE, "DialogFillStroke", N_("_Fill and Stroke..."),
2531 N_("Edit objects' colors, gradients, stroke width, arrowheads, dash patterns..."), "fill_and_stroke"),
2532 // TRANSLATORS: "Swatches" means: color samples
2533 new DialogVerb(SP_VERB_DIALOG_SWATCHES, "DialogSwatches", N_("S_watches..."),
2534 N_("Select colors from a swatches palette"), GTK_STOCK_SELECT_COLOR),
2535 new DialogVerb(SP_VERB_DIALOG_TRANSFORM, "DialogTransform", N_("Transfor_m..."),
2536 N_("Precisely control objects' transformations"), "object_trans"),
2537 new DialogVerb(SP_VERB_DIALOG_ALIGN_DISTRIBUTE, "DialogAlignDistribute", N_("_Align and Distribute..."),
2538 N_("Align and distribute objects"), "object_align"),
2539 new DialogVerb(SP_VERB_DIALOG_UNDO_HISTORY, "DialogUndoHistory", N_("Undo _History..."),
2540 N_("Undo History"), "edit_undo_history"),
2541 new DialogVerb(SP_VERB_DIALOG_TEXT, "DialogText", N_("_Text and Font..."),
2542 N_("View and select font family, font size and other text properties"), "object_font"),
2543 new DialogVerb(SP_VERB_DIALOG_XML_EDITOR, "DialogXMLEditor", N_("_XML Editor..."),
2544 N_("View and edit the XML tree of the document"), "xml_editor"),
2545 new DialogVerb(SP_VERB_DIALOG_FIND, "DialogFind", N_("_Find..."),
2546 N_("Find objects in document"), GTK_STOCK_FIND ),
2547 new DialogVerb(SP_VERB_DIALOG_DEBUG, "DialogDebug", N_("_Messages..."),
2548 N_("View debug messages"), "messages"),
2549 new DialogVerb(SP_VERB_DIALOG_SCRIPT, "DialogScript", N_("S_cripts..."),
2550 N_("Run scripts"), "scripts"),
2551 new DialogVerb(SP_VERB_DIALOG_TOGGLE, "DialogsToggle", N_("Show/Hide D_ialogs"),
2552 N_("Show or hide all open dialogs"), "dialog_toggle"),
2553 new DialogVerb(SP_VERB_DIALOG_CLONETILER, "DialogClonetiler", N_("Create Tiled Clones..."),
2554 N_("Create multiple clones of selected object, arranging them into a pattern or scattering"), "edit_create_tiled_clones"),
2555 new DialogVerb(SP_VERB_DIALOG_ITEM, "DialogObjectProperties", N_("_Object Properties..."),
2556 N_("Edit the ID, locked and visible status, and other object properties"), "dialog_item_properties"),
2557 #ifdef WITH_INKBOARD
2558 new DialogVerb(SP_VERB_XMPP_CLIENT, "DialogXmppClient",
2559 N_("_Instant Messaging..."), N_("Jabber Instant Messaging Client"), NULL),
2560 #endif
2561 new DialogVerb(SP_VERB_DIALOG_INPUT, "DialogInput", N_("_Input Devices..."),
2562 N_("Configure extended input devices, such as a graphics tablet"), "input_devices"),
2563 new DialogVerb(SP_VERB_DIALOG_INPUT2, "DialogInput2", N_("_Input Devices (new)..."),
2564 N_("Configure extended input devices, such as a graphics tablet"), "input_devices"),
2565 new DialogVerb(SP_VERB_DIALOG_EXTENSIONEDITOR, "org.inkscape.dialogs.extensioneditor", N_("_Extensions..."),
2566 N_("Query information about extensions"), NULL),
2567 new DialogVerb(SP_VERB_DIALOG_LAYERS, "DialogLayers", N_("Layer_s..."),
2568 N_("View Layers"), "layers"),
2569 new DialogVerb(SP_VERB_DIALOG_LIVE_PATH_EFFECT, "DialogLivePathEffect", N_("Path Effects..."),
2570 N_("Manage path effects"), NULL),
2571 new DialogVerb(SP_VERB_DIALOG_FILTER_EFFECTS, "DialogFilterEffects", N_("Filter Effects..."),
2572 N_("Manage SVG filter effects"), NULL),
2574 /* Help */
2575 new HelpVerb(SP_VERB_HELP_ABOUT_EXTENSIONS, "HelpAboutExtensions", N_("About E_xtensions"),
2576 N_("Information on Inkscape extensions"), NULL),
2577 new HelpVerb(SP_VERB_HELP_MEMORY, "HelpAboutMemory", N_("About _Memory"),
2578 N_("Memory usage information"), "about_memory"),
2579 new HelpVerb(SP_VERB_HELP_ABOUT, "HelpAbout", N_("_About Inkscape"),
2580 N_("Inkscape version, authors, license"), /*"help_about"*/"inkscape_options"),
2581 //new HelpVerb(SP_VERB_SHOW_LICENSE, "ShowLicense", N_("_License"),
2582 // N_("Distribution terms"), /*"show_license"*/"inkscape_options"),
2584 /* Tutorials */
2585 new TutorialVerb(SP_VERB_TUTORIAL_BASIC, "TutorialsBasic", N_("Inkscape: _Basic"),
2586 N_("Getting started with Inkscape"), NULL/*"tutorial_basic"*/),
2587 new TutorialVerb(SP_VERB_TUTORIAL_SHAPES, "TutorialsShapes", N_("Inkscape: _Shapes"),
2588 N_("Using shape tools to create and edit shapes"), NULL),
2589 new TutorialVerb(SP_VERB_TUTORIAL_ADVANCED, "TutorialsAdvanced", N_("Inkscape: _Advanced"),
2590 N_("Advanced Inkscape topics"), NULL/*"tutorial_advanced"*/),
2591 // TRANSLATORS: "to trace" means "to convert a bitmap to vector graphics" (to vectorize)
2592 new TutorialVerb(SP_VERB_TUTORIAL_TRACING, "TutorialsTracing", N_("Inkscape: T_racing"),
2593 N_("Using bitmap tracing"), NULL/*"tutorial_tracing"*/),
2594 new TutorialVerb(SP_VERB_TUTORIAL_CALLIGRAPHY, "TutorialsCalligraphy", N_("Inkscape: _Calligraphy"),
2595 N_("Using the Calligraphy pen tool"), NULL),
2596 new TutorialVerb(SP_VERB_TUTORIAL_DESIGN, "TutorialsDesign", N_("_Elements of Design"),
2597 N_("Principles of design in the tutorial form"), NULL/*"tutorial_design"*/),
2598 new TutorialVerb(SP_VERB_TUTORIAL_TIPS, "TutorialsTips", N_("_Tips and Tricks"),
2599 N_("Miscellaneous tips and tricks"), NULL/*"tutorial_tips"*/),
2601 /* Effect */
2602 new EffectLastVerb(SP_VERB_EFFECT_LAST, "EffectLast", N_("Previous Effect"),
2603 N_("Repeat the last effect with the same settings"), NULL),
2604 new EffectLastVerb(SP_VERB_EFFECT_LAST_PREF, "EffectLastPref", N_("Previous Effect Settings..."),
2605 N_("Repeat the last effect with new settings"), NULL),
2607 /* Fit Page */
2608 new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_SELECTION, "FitCanvasToSelection", N_("Fit Page to Selection"),
2609 N_("Fit the page to the current selection"), NULL),
2610 new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_DRAWING, "FitCanvasToDrawing", N_("Fit Page to Drawing"),
2611 N_("Fit the page to the drawing"), NULL),
2612 new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING, "FitCanvasToSelectionOrDrawing", N_("Fit Page to Selection or Drawing"),
2613 N_("Fit the page to the current selection or the drawing if there is no selection"), NULL),
2614 /* LockAndHide */
2615 new LockAndHideVerb(SP_VERB_UNLOCK_ALL, "UnlockAll", N_("Unlock All"),
2616 N_("Unlock all objects in the current layer"), NULL),
2617 new LockAndHideVerb(SP_VERB_UNLOCK_ALL_IN_ALL_LAYERS, "UnlockAllInAllLayers", N_("Unlock All in All Layers"),
2618 N_("Unlock all objects in all layers"), NULL),
2619 new LockAndHideVerb(SP_VERB_UNHIDE_ALL, "UnhideAll", N_("Unhide All"),
2620 N_("Unhide all objects in the current layer"), NULL),
2621 new LockAndHideVerb(SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS, "UnhideAllInAllLayers", N_("Unhide All in All Layers"),
2622 N_("Unhide all objects in all layers"), NULL),
2623 /* Footer */
2624 new Verb(SP_VERB_LAST, " '\"invalid id", NULL, NULL, NULL)
2625 };
2628 void
2629 Verb::list (void) {
2630 // Go through the dynamic verb table
2631 for (VerbTable::iterator iter = _verbs.begin(); iter != _verbs.end(); iter++) {
2632 Verb * verb = iter->second;
2633 if (verb->get_code() == SP_VERB_INVALID ||
2634 verb->get_code() == SP_VERB_NONE ||
2635 verb->get_code() == SP_VERB_LAST) {
2636 continue;
2637 }
2639 printf("%s: %s\n", verb->get_id(), verb->get_tip()? verb->get_tip() : verb->get_name());
2640 }
2642 return;
2643 };
2645 } /* namespace Inkscape */
2647 /*
2648 Local Variables:
2649 mode:c++
2650 c-file-style:"stroustrup"
2651 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
2652 indent-tabs-mode:nil
2653 fill-column:99
2654 End:
2655 */
2656 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :