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