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