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