da843bbe841b35e5a1eb01c4ae7c3d944c3d5f55
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 */
28 #include <gtk/gtkstock.h>
30 #ifdef HAVE_CONFIG_H
31 # include "config.h"
32 #endif
34 #include "helper/action.h"
36 #include <gtkmm/messagedialog.h>
37 #include <gtkmm/filechooserdialog.h>
38 #include <gtkmm/stock.h>
40 #include "dialogs/text-edit.h"
41 #include "dialogs/xml-tree.h"
42 #include "dialogs/object-properties.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"
59 #include "tools-switch.h"
60 #include "inkscape-private.h"
61 #include "file.h"
62 #include "help.h"
63 #include "document.h"
64 #include "desktop.h"
65 #include "message-stack.h"
66 #include "desktop-handles.h"
67 #include "selection-chemistry.h"
68 #include "path-chemistry.h"
69 #include "text-chemistry.h"
70 #include "ui/dialog/dialog-manager.h"
71 #include "ui/dialog/inkscape-preferences.h"
72 #include "interface.h"
73 #include "prefs-utils.h"
74 #include "splivarot.h"
75 #include "sp-namedview.h"
76 #include "sp-flowtext.h"
77 #include "layer-fns.h"
78 #include "node-context.h"
81 /**
82 * \brief Return the name without underscores and ellipsis, for use in dialog
83 * titles, etc. Allocated memory must be freed by caller.
84 */
85 gchar *
86 sp_action_get_title(SPAction const *action)
87 {
88 char const *src = action->name;
89 gchar *ret = g_new(gchar, strlen(src) + 1);
90 unsigned ri = 0;
92 for (unsigned si = 0 ; ; si++) {
93 int const c = src[si];
94 if ( c != '_' && c != '.' ) {
95 ret[ri] = c;
96 ri++;
97 if (c == '\0') {
98 return ret;
99 }
100 }
101 }
103 } // end of sp_action_get_title()
106 namespace Inkscape {
108 /// \todo !!!FIXME:: kill this, use DialogManager instead!!!
110 class PanelDialog : public Inkscape::UI::Dialog::Dialog
111 {
112 public:
113 PanelDialog(char const *prefs_path, int const verb_num) : Dialog(prefs_path, verb_num) {}
114 /*
115 virtual Glib::ustring getName() const {return "foo";}
116 virtual Glib::ustring getDesc() const {return "bar";}
117 */
118 };
120 /** \brief Utility function to get a panel displayed. */
121 static void show_panel( Inkscape::UI::Widget::Panel &panel, char const *prefs_path, int const verb_num )
122 {
123 Gtk::Container *container = panel.get_toplevel();
124 if ( &panel == container ) { // safe check?
125 //g_message("Creating new dialog to hold it");
126 PanelDialog *dia = new PanelDialog(prefs_path, verb_num);
127 Gtk::VBox *mainVBox = dia->get_vbox();
128 mainVBox->pack_start(panel);
129 dia->show_all_children();
130 dia->present();
131 dia->read_geometry();
132 } else {
133 Gtk::Dialog *dia = dynamic_cast<Gtk::Dialog*>(container);
134 if ( dia ) {
135 //g_message("Found an existing dialog");
136 dia->present();
137 } else {
138 g_message("Failed to find an existing dialog");
139 }
140 }
141 }
143 /** \brief A class to encompass all of the verbs which deal with
144 file operations. */
145 class FileVerb : public Verb {
146 private:
147 static void perform(SPAction *action, void *mydata, void *otherdata);
148 static SPActionEventVector vector;
149 protected:
150 virtual SPAction *make_action(Inkscape::UI::View::View *view);
151 public:
152 /** \brief Use the Verb initializer with the same parameters. */
153 FileVerb(unsigned int const code,
154 gchar const *id,
155 gchar const *name,
156 gchar const *tip,
157 gchar const *image) :
158 Verb(code, id, name, tip, image)
159 { }
160 }; /* FileVerb class */
162 /** \brief A class to encompass all of the verbs which deal with
163 edit operations. */
164 class EditVerb : public Verb {
165 private:
166 static void perform(SPAction *action, void *mydata, void *otherdata);
167 static SPActionEventVector vector;
168 protected:
169 virtual SPAction *make_action(Inkscape::UI::View::View *view);
170 public:
171 /** \brief Use the Verb initializer with the same parameters. */
172 EditVerb(unsigned int const code,
173 gchar const *id,
174 gchar const *name,
175 gchar const *tip,
176 gchar const *image) :
177 Verb(code, id, name, tip, image)
178 { }
179 }; /* EditVerb class */
181 /** \brief A class to encompass all of the verbs which deal with
182 selection operations. */
183 class SelectionVerb : public Verb {
184 private:
185 static void perform(SPAction *action, void *mydata, void *otherdata);
186 static SPActionEventVector vector;
187 protected:
188 virtual SPAction *make_action(Inkscape::UI::View::View *view);
189 public:
190 /** \brief Use the Verb initializer with the same parameters. */
191 SelectionVerb(unsigned int const code,
192 gchar const *id,
193 gchar const *name,
194 gchar const *tip,
195 gchar const *image) :
196 Verb(code, id, name, tip, image)
197 { }
198 }; /* SelectionVerb class */
200 /** \brief A class to encompass all of the verbs which deal with
201 layer operations. */
202 class LayerVerb : public Verb {
203 private:
204 static void perform(SPAction *action, void *mydata, void *otherdata);
205 static SPActionEventVector vector;
206 protected:
207 virtual SPAction *make_action(Inkscape::UI::View::View *view);
208 public:
209 /** \brief Use the Verb initializer with the same parameters. */
210 LayerVerb(unsigned int const code,
211 gchar const *id,
212 gchar const *name,
213 gchar const *tip,
214 gchar const *image) :
215 Verb(code, id, name, tip, image)
216 { }
217 }; /* LayerVerb class */
219 /** \brief A class to encompass all of the verbs which deal with
220 operations related to objects. */
221 class ObjectVerb : public Verb {
222 private:
223 static void perform(SPAction *action, void *mydata, void *otherdata);
224 static SPActionEventVector vector;
225 protected:
226 virtual SPAction *make_action(Inkscape::UI::View::View *view);
227 public:
228 /** \brief Use the Verb initializer with the same parameters. */
229 ObjectVerb(unsigned int const code,
230 gchar const *id,
231 gchar const *name,
232 gchar const *tip,
233 gchar const *image) :
234 Verb(code, id, name, tip, image)
235 { }
236 }; /* ObjectVerb class */
238 /** \brief A class to encompass all of the verbs which deal with
239 operations relative to context. */
240 class ContextVerb : public Verb {
241 private:
242 static void perform(SPAction *action, void *mydata, void *otherdata);
243 static SPActionEventVector vector;
244 protected:
245 virtual SPAction *make_action(Inkscape::UI::View::View *view);
246 public:
247 /** \brief Use the Verb initializer with the same parameters. */
248 ContextVerb(unsigned int const code,
249 gchar const *id,
250 gchar const *name,
251 gchar const *tip,
252 gchar const *image) :
253 Verb(code, id, name, tip, image)
254 { }
255 }; /* ContextVerb class */
257 /** \brief A class to encompass all of the verbs which deal with
258 zoom operations. */
259 class ZoomVerb : public Verb {
260 private:
261 static void perform(SPAction *action, void *mydata, void *otherdata);
262 static SPActionEventVector vector;
263 protected:
264 virtual SPAction *make_action(Inkscape::UI::View::View *view);
265 public:
266 /** \brief Use the Verb initializer with the same parameters. */
267 ZoomVerb(unsigned int const code,
268 gchar const *id,
269 gchar const *name,
270 gchar const *tip,
271 gchar const *image) :
272 Verb(code, id, name, tip, image)
273 { }
274 }; /* ZoomVerb class */
277 /** \brief A class to encompass all of the verbs which deal with
278 dialog operations. */
279 class DialogVerb : public Verb {
280 private:
281 static void perform(SPAction *action, void *mydata, void *otherdata);
282 static SPActionEventVector vector;
283 protected:
284 virtual SPAction *make_action(Inkscape::UI::View::View *view);
285 public:
286 /** \brief Use the Verb initializer with the same parameters. */
287 DialogVerb(unsigned int const code,
288 gchar const *id,
289 gchar const *name,
290 gchar const *tip,
291 gchar const *image) :
292 Verb(code, id, name, tip, image)
293 { }
294 }; /* DialogVerb class */
296 /** \brief A class to encompass all of the verbs which deal with
297 help operations. */
298 class HelpVerb : public Verb {
299 private:
300 static void perform(SPAction *action, void *mydata, void *otherdata);
301 static SPActionEventVector vector;
302 protected:
303 virtual SPAction *make_action(Inkscape::UI::View::View *view);
304 public:
305 /** \brief Use the Verb initializer with the same parameters. */
306 HelpVerb(unsigned int const code,
307 gchar const *id,
308 gchar const *name,
309 gchar const *tip,
310 gchar const *image) :
311 Verb(code, id, name, tip, image)
312 { }
313 }; /* HelpVerb class */
315 /** \brief A class to encompass all of the verbs which deal with
316 tutorial operations. */
317 class TutorialVerb : public Verb {
318 private:
319 static void perform(SPAction *action, void *mydata, void *otherdata);
320 static SPActionEventVector vector;
321 protected:
322 virtual SPAction *make_action(Inkscape::UI::View::View *view);
323 public:
324 /** \brief Use the Verb initializer with the same parameters. */
325 TutorialVerb(unsigned int const code,
326 gchar const *id,
327 gchar const *name,
328 gchar const *tip,
329 gchar const *image) :
330 Verb(code, id, name, tip, image)
331 { }
332 }; /* TutorialVerb class */
334 /** \brief A class to encompass all of the verbs which deal with
335 text operations. */
336 class TextVerb : public Verb {
337 private:
338 static void perform(SPAction *action, void *mydata, void *otherdata);
339 static SPActionEventVector vector;
340 protected:
341 virtual SPAction *make_action(Inkscape::UI::View::View *view);
342 public:
343 /** \brief Use the Verb initializer with the same parameters. */
344 TextVerb(unsigned int const code,
345 gchar const *id,
346 gchar const *name,
347 gchar const *tip,
348 gchar const *image) :
349 Verb(code, id, name, tip, image)
350 { }
351 }; //TextVerb : public Verb
353 Verb::VerbTable Verb::_verbs;
354 Verb::VerbIDTable Verb::_verb_ids;
356 /** \brief Create a verb without a code.
358 This function calls the other constructor for all of the parameters,
359 but generates the code. It is important to READ THE OTHER DOCUMENTATION
360 it has important details in it. To generate the code a static is
361 used which starts at the last static value: \c SP_VERB_LAST. For
362 each call it is incremented. The list of allocated verbs is kept
363 in the \c _verbs hashtable which is indexed by the \c code.
364 */
365 Verb::Verb(gchar const *id, gchar const *name, gchar const *tip, gchar const *image) :
366 _actions(NULL), _id(id), _name(name), _tip(tip), _image(image)
367 {
368 static int count = SP_VERB_LAST;
370 count++;
371 _code = count;
372 _verbs.insert(VerbTable::value_type(count, this));
373 _verb_ids.insert(VerbIDTable::value_type(_id, this));
375 return;
376 }
378 /** \brief Destroy a verb.
380 The only allocated variable is the _actions variable. If it has
381 been allocated it is deleted.
382 */
383 Verb::~Verb(void)
384 {
385 /// \todo all the actions need to be cleaned up first.
386 if (_actions != NULL) {
387 delete _actions;
388 }
390 return;
391 }
393 /** \brief Verbs are no good without actions. This is a place holder
394 for a function that every subclass should write. Most
395 can be written using \c make_action_helper.
396 \param view Which view the action should be created for.
397 \return NULL to represent error (this function shouldn't ever be called)
398 */
399 SPAction *
400 Verb::make_action(Inkscape::UI::View::View *view)
401 {
402 //std::cout << "make_action" << std::endl;
403 return NULL;
404 }
406 /** \brief Create an action for a \c FileVerb
407 \param view Which view the action should be created for
408 \return The built action.
410 Calls \c make_action_helper with the \c vector.
411 */
412 SPAction *
413 FileVerb::make_action(Inkscape::UI::View::View *view)
414 {
415 //std::cout << "fileverb: make_action: " << &vector << std::endl;
416 return make_action_helper(view, &vector);
417 }
419 /** \brief Create an action for a \c EditVerb
420 \param view Which view the action should be created for
421 \return The built action.
423 Calls \c make_action_helper with the \c vector.
424 */
425 SPAction *
426 EditVerb::make_action(Inkscape::UI::View::View *view)
427 {
428 //std::cout << "editverb: make_action: " << &vector << std::endl;
429 return make_action_helper(view, &vector);
430 }
432 /** \brief Create an action for a \c SelectionVerb
433 \param view Which view the action should be created for
434 \return The built action.
436 Calls \c make_action_helper with the \c vector.
437 */
438 SPAction *
439 SelectionVerb::make_action(Inkscape::UI::View::View *view)
440 {
441 return make_action_helper(view, &vector);
442 }
444 /** \brief Create an action for a \c LayerVerb
445 \param view Which view the action should be created for
446 \return The built action.
448 Calls \c make_action_helper with the \c vector.
449 */
450 SPAction *
451 LayerVerb::make_action(Inkscape::UI::View::View *view)
452 {
453 return make_action_helper(view, &vector);
454 }
456 /** \brief Create an action for a \c ObjectVerb
457 \param view Which view the action should be created for
458 \return The built action.
460 Calls \c make_action_helper with the \c vector.
461 */
462 SPAction *
463 ObjectVerb::make_action(Inkscape::UI::View::View *view)
464 {
465 return make_action_helper(view, &vector);
466 }
468 /** \brief Create an action for a \c ContextVerb
469 \param view Which view the action should be created for
470 \return The built action.
472 Calls \c make_action_helper with the \c vector.
473 */
474 SPAction *
475 ContextVerb::make_action(Inkscape::UI::View::View *view)
476 {
477 return make_action_helper(view, &vector);
478 }
480 /** \brief Create an action for a \c ZoomVerb
481 \param view Which view the action should be created for
482 \return The built action.
484 Calls \c make_action_helper with the \c vector.
485 */
486 SPAction *
487 ZoomVerb::make_action(Inkscape::UI::View::View *view)
488 {
489 return make_action_helper(view, &vector);
490 }
492 /** \brief Create an action for a \c DialogVerb
493 \param view Which view the action should be created for
494 \return The built action.
496 Calls \c make_action_helper with the \c vector.
497 */
498 SPAction *
499 DialogVerb::make_action(Inkscape::UI::View::View *view)
500 {
501 return make_action_helper(view, &vector);
502 }
504 /** \brief Create an action for a \c HelpVerb
505 \param view Which view the action should be created for
506 \return The built action.
508 Calls \c make_action_helper with the \c vector.
509 */
510 SPAction *
511 HelpVerb::make_action(Inkscape::UI::View::View *view)
512 {
513 return make_action_helper(view, &vector);
514 }
516 /** \brief Create an action for a \c TutorialVerb
517 \param view Which view the action should be created for
518 \return The built action.
520 Calls \c make_action_helper with the \c vector.
521 */
522 SPAction *
523 TutorialVerb::make_action(Inkscape::UI::View::View *view)
524 {
525 return make_action_helper(view, &vector);
526 }
528 /** \brief Create an action for a \c TextVerb
529 \param view Which view the action should be created for
530 \return The built action.
532 Calls \c make_action_helper with the \c vector.
533 */
534 SPAction *
535 TextVerb::make_action(Inkscape::UI::View::View *view)
536 {
537 return make_action_helper(view, &vector);
538 }
540 /** \brief A quick little convience function to make building actions
541 a little bit easier.
542 \param view Which view the action should be created for.
543 \param vector The function vector for the verb.
544 \return The created action.
546 This function does a couple of things. The most obvious is that
547 it allocates and creates the action. When it does this it
548 translates the \c _name and \c _tip variables. This allows them
549 to be staticly allocated easily, and get translated in the end. Then,
550 if the action gets crated, a listener is added to the action with
551 the vector that is passed in.
552 */
553 SPAction *
554 Verb::make_action_helper(Inkscape::UI::View::View *view, SPActionEventVector *vector, void *in_pntr)
555 {
556 SPAction *action;
558 //std::cout << "Adding action: " << _code << std::endl;
559 action = sp_action_new(view, _id, _(_name),
560 _(_tip), _image, this);
562 if (action != NULL) {
563 if (in_pntr == NULL) {
564 nr_active_object_add_listener(
565 (NRActiveObject *) action,
566 (NRObjectEventVector *) vector,
567 sizeof(SPActionEventVector),
568 reinterpret_cast<void *>(_code)
569 );
570 } else {
571 nr_active_object_add_listener(
572 (NRActiveObject *) action,
573 (NRObjectEventVector *) vector,
574 sizeof(SPActionEventVector),
575 in_pntr
576 );
577 }
578 }
580 return action;
581 }
583 /** \brief A function to get an action if it exists, or otherwise to
584 build it.
585 \param view The view which this action would relate to
586 \return The action, or NULL if there is an error.
588 This function will get the action for a given view for this verb. It
589 will create the verb if it can't be found in the ActionTable. Also,
590 if the \c ActionTable has not been created, it gets created by this
591 function.
593 If the action is created, it's sensitivity must be determined. The
594 default for a new action is that it is sensitive. If the value in
595 \c _default_sensitive is \c false, then the sensitivity must be
596 removed. Also, if the view being created is based on the same
597 document as a view already created, the sensitivity should be the
598 same as views on that document. A view with the same document is
599 looked for, and the sensitivity is matched. Unfortunately, this is
600 currently a linear search.
601 */
602 SPAction *
603 Verb::get_action(Inkscape::UI::View::View *view)
604 {
605 SPAction *action = NULL;
607 if ( _actions == NULL ) {
608 _actions = new ActionTable;
609 }
610 ActionTable::iterator action_found = _actions->find(view);
612 if (action_found != _actions->end()) {
613 action = action_found->second;
614 } else {
615 action = this->make_action(view);
617 // if (action == NULL) printf("Hmm, NULL in %s\n", _name);
618 if (action == NULL) printf("Hmm, NULL in %s\n", _name);
619 if (!_default_sensitive) {
620 sp_action_set_sensitive(action, 0);
621 } else {
622 for (ActionTable::iterator cur_action = _actions->begin();
623 cur_action != _actions->end() && view != NULL;
624 cur_action++) {
625 if (cur_action->first != NULL && cur_action->first->doc() == view->doc()) {
626 sp_action_set_sensitive(action, cur_action->second->sensitive);
627 break;
628 }
629 }
630 }
632 _actions->insert(ActionTable::value_type(view, action));
633 }
635 return action;
636 }
638 void
639 Verb::sensitive(SPDocument *in_doc, bool in_sensitive)
640 {
641 // printf("Setting sensitivity of \"%s\" to %d\n", _name, in_sensitive);
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_sensitive(cur_action->second, in_sensitive ? 1 : 0);
648 }
649 }
650 }
652 if (in_doc == NULL) {
653 _default_sensitive = in_sensitive;
654 }
656 return;
657 }
660 void
661 Verb::name(SPDocument *in_doc, Glib::ustring in_name)
662 {
663 if (_actions != NULL) {
664 for (ActionTable::iterator cur_action = _actions->begin();
665 cur_action != _actions->end();
666 cur_action++) {
667 if (in_doc == NULL || (cur_action->first != NULL && cur_action->first->doc() == in_doc)) {
668 sp_action_set_name(cur_action->second, in_name);
669 }
670 }
671 }
672 }
674 /** \brief A function to remove the action associated with a view.
675 \param view Which view's actions should be removed.
676 \return None
678 This function looks for the action in \c _actions. If it is
679 found then it is unreferenced and the entry in the action
680 table is erased.
681 */
682 void
683 Verb::delete_view(Inkscape::UI::View::View *view)
684 {
685 if (_actions == NULL) return;
686 if (_actions->empty()) return;
688 #if 0
689 static int count = 0;
690 std::cout << count++ << std::endl;
691 #endif
693 ActionTable::iterator action_found = _actions->find(view);
695 if (action_found != _actions->end()) {
696 SPAction *action = action_found->second;
697 nr_object_unref(NR_OBJECT(action));
698 _actions->erase(action_found);
699 }
701 return;
702 }
704 /** \brief A function to delete a view from all verbs
705 \param view Which view's actions should be removed.
706 \return None
708 This function first looks through _base_verbs and deteles
709 the view from all of those views. If \c _verbs is not empty
710 then all of the entries in that table have all of the views
711 deleted also.
712 */
713 void
714 Verb::delete_all_view(Inkscape::UI::View::View *view)
715 {
716 for (int i = 0; i <= SP_VERB_LAST; i++) {
717 if (_base_verbs[i])
718 _base_verbs[i]->delete_view(view);
719 }
721 if (!_verbs.empty()) {
722 for (VerbTable::iterator thisverb = _verbs.begin();
723 thisverb != _verbs.end(); thisverb++) {
724 Inkscape::Verb *verbpntr = thisverb->second;
725 // std::cout << "Delete In Verb: " << verbpntr->_name << std::endl;
726 verbpntr->delete_view(view);
727 }
728 }
730 return;
731 }
733 /** \brief A function to turn a \c code into a Verb for dynamically
734 created Verbs.
735 \param code What code is being looked for
736 \return The found Verb of NULL if none is found.
738 This function basically just looks through the \c _verbs hash
739 table. STL does all the work.
740 */
741 Verb *
742 Verb::get_search(unsigned int code)
743 {
744 Verb *verb = NULL;
745 VerbTable::iterator verb_found = _verbs.find(code);
747 if (verb_found != _verbs.end()) {
748 verb = verb_found->second;
749 }
751 return verb;
752 }
754 /** \brief Find a Verb using it's ID
755 \param id Which id to search for
757 This function uses the \c _verb_ids has table to find the
758 verb by it's id. Should be much faster than previous
759 implementations.
760 */
761 Verb *
762 Verb::getbyid(gchar const *id)
763 {
764 Verb *verb = NULL;
765 VerbIDTable::iterator verb_found = _verb_ids.find(id);
767 if (verb_found != _verb_ids.end()) {
768 verb = verb_found->second;
769 }
771 if (verb == NULL)
772 printf("Unable to find: %s\n", id);
774 return verb;
775 }
777 /** \brief Decode the verb code and take appropriate action */
778 void
779 FileVerb::perform(SPAction *action, void *data, void *pdata)
780 {
781 #if 0
782 /* These aren't used, but are here to remind people not to use
783 the CURRENT_DOCUMENT macros unless they really have to. */
784 Inkscape::UI::View::View *current_view = sp_action_get_view(action);
785 SPDocument *current_document = current_view->doc();
786 #endif
787 switch ((long) data) {
788 case SP_VERB_FILE_NEW:
789 sp_file_new_default();
790 break;
791 case SP_VERB_FILE_OPEN:
792 sp_file_open_dialog(NULL, NULL);
793 break;
794 case SP_VERB_FILE_REVERT:
795 sp_file_revert_dialog();
796 break;
797 case SP_VERB_FILE_SAVE:
798 sp_file_save(NULL, NULL);
799 break;
800 case SP_VERB_FILE_SAVE_AS:
801 sp_file_save_as(NULL, NULL);
802 break;
803 case SP_VERB_FILE_SAVE_A_COPY:
804 sp_file_save_a_copy(NULL, NULL);
805 break;
806 case SP_VERB_FILE_PRINT:
807 sp_file_print();
808 break;
809 case SP_VERB_FILE_VACUUM:
810 sp_file_vacuum();
811 break;
812 case SP_VERB_FILE_PRINT_DIRECT:
813 sp_file_print_direct();
814 break;
815 case SP_VERB_FILE_PRINT_PREVIEW:
816 sp_file_print_preview(NULL, NULL);
817 break;
818 case SP_VERB_FILE_IMPORT:
819 sp_file_import(NULL);
820 break;
821 case SP_VERB_FILE_EXPORT:
822 sp_file_export_dialog(NULL);
823 break;
824 case SP_VERB_FILE_NEXT_DESKTOP:
825 inkscape_switch_desktops_next();
826 break;
827 case SP_VERB_FILE_PREV_DESKTOP:
828 inkscape_switch_desktops_prev();
829 break;
830 case SP_VERB_FILE_CLOSE_VIEW:
831 sp_ui_close_view(NULL);
832 break;
833 case SP_VERB_FILE_QUIT:
834 sp_file_exit();
835 break;
836 default:
837 break;
838 }
840 } // end of sp_verb_action_file_perform()
842 /** \brief Decode the verb code and take appropriate action */
843 void
844 EditVerb::perform(SPAction *action, void *data, void *pdata)
845 {
846 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
847 if (!dt)
848 return;
850 SPEventContext *ec = dt->event_context;
852 switch (reinterpret_cast<std::size_t>(data)) {
853 case SP_VERB_EDIT_UNDO:
854 sp_undo(dt, sp_desktop_document(dt));
855 break;
856 case SP_VERB_EDIT_REDO:
857 sp_redo(dt, sp_desktop_document(dt));
858 break;
859 case SP_VERB_EDIT_CUT:
860 sp_selection_cut();
861 break;
862 case SP_VERB_EDIT_COPY:
863 sp_selection_copy();
864 break;
865 case SP_VERB_EDIT_PASTE:
866 sp_selection_paste(false);
867 break;
868 case SP_VERB_EDIT_PASTE_STYLE:
869 sp_selection_paste_style();
870 break;
871 case SP_VERB_EDIT_PASTE_SIZE:
872 sp_selection_paste_size(true, true);
873 break;
874 case SP_VERB_EDIT_PASTE_SIZE_X:
875 sp_selection_paste_size(true, false);
876 break;
877 case SP_VERB_EDIT_PASTE_SIZE_Y:
878 sp_selection_paste_size(false, true);
879 break;
880 case SP_VERB_EDIT_PASTE_SIZE_SEPARATELY:
881 sp_selection_paste_size_separately(true, true);
882 break;
883 case SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_X:
884 sp_selection_paste_size_separately(true, false);
885 break;
886 case SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_Y:
887 sp_selection_paste_size_separately(false, true);
888 break;
889 case SP_VERB_EDIT_PASTE_IN_PLACE:
890 sp_selection_paste(true);
891 break;
892 case SP_VERB_EDIT_DELETE:
893 sp_selection_delete();
894 break;
895 case SP_VERB_EDIT_DUPLICATE:
896 sp_selection_duplicate();
897 break;
898 case SP_VERB_EDIT_CLONE:
899 sp_selection_clone();
900 break;
901 case SP_VERB_EDIT_UNLINK_CLONE:
902 sp_selection_unlink();
903 break;
904 case SP_VERB_EDIT_CLONE_ORIGINAL:
905 sp_select_clone_original();
906 break;
907 case SP_VERB_EDIT_TILE:
908 sp_selection_tile();
909 break;
910 case SP_VERB_EDIT_UNTILE:
911 sp_selection_untile();
912 break;
913 case SP_VERB_EDIT_CLEAR_ALL:
914 sp_edit_clear_all();
915 break;
916 case SP_VERB_EDIT_SELECT_ALL:
917 if (tools_isactive(dt, TOOLS_NODES)) {
918 sp_nodepath_select_all_from_subpath(SP_NODE_CONTEXT(ec)->nodepath, false);
919 } else {
920 sp_edit_select_all();
921 }
922 break;
923 case SP_VERB_EDIT_INVERT:
924 if (tools_isactive(dt, TOOLS_NODES)) {
925 sp_nodepath_select_all_from_subpath(SP_NODE_CONTEXT(ec)->nodepath, true);
926 } else {
927 sp_edit_invert();
928 }
929 break;
930 case SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS:
931 if (tools_isactive(dt, TOOLS_NODES)) {
932 sp_nodepath_select_all(SP_NODE_CONTEXT(ec)->nodepath, false);
933 } else {
934 sp_edit_select_all_in_all_layers();
935 }
936 break;
937 case SP_VERB_EDIT_INVERT_IN_ALL_LAYERS:
938 if (tools_isactive(dt, TOOLS_NODES)) {
939 sp_nodepath_select_all(SP_NODE_CONTEXT(ec)->nodepath, true);
940 } else {
941 sp_edit_invert_in_all_layers();
942 }
943 break;
944 case SP_VERB_EDIT_DESELECT:
945 if (tools_isactive(dt, TOOLS_NODES)) {
946 sp_nodepath_deselect(SP_NODE_CONTEXT(ec)->nodepath);
947 } else {
948 sp_desktop_selection(dt)->clear();
949 }
950 break;
951 default:
952 break;
953 }
955 } // end of sp_verb_action_edit_perform()
957 /** \brief Decode the verb code and take appropriate action */
958 void
959 SelectionVerb::perform(SPAction *action, void *data, void *pdata)
960 {
961 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
963 if (!dt)
964 return;
966 switch (reinterpret_cast<std::size_t>(data)) {
967 case SP_VERB_SELECTION_TO_FRONT:
968 sp_selection_raise_to_top();
969 break;
970 case SP_VERB_SELECTION_TO_BACK:
971 sp_selection_lower_to_bottom();
972 break;
973 case SP_VERB_SELECTION_RAISE:
974 sp_selection_raise();
975 break;
976 case SP_VERB_SELECTION_LOWER:
977 sp_selection_lower();
978 break;
979 case SP_VERB_SELECTION_GROUP:
980 sp_selection_group();
981 break;
982 case SP_VERB_SELECTION_UNGROUP:
983 sp_selection_ungroup();
984 break;
986 case SP_VERB_SELECTION_TEXTTOPATH:
987 text_put_on_path();
988 break;
989 case SP_VERB_SELECTION_TEXTFROMPATH:
990 text_remove_from_path();
991 break;
992 case SP_VERB_SELECTION_REMOVE_KERNS:
993 text_remove_all_kerns();
994 break;
996 case SP_VERB_SELECTION_UNION:
997 sp_selected_path_union();
998 break;
999 case SP_VERB_SELECTION_INTERSECT:
1000 sp_selected_path_intersect();
1001 break;
1002 case SP_VERB_SELECTION_DIFF:
1003 sp_selected_path_diff();
1004 break;
1005 case SP_VERB_SELECTION_SYMDIFF:
1006 sp_selected_path_symdiff();
1007 break;
1009 case SP_VERB_SELECTION_CUT:
1010 sp_selected_path_cut();
1011 break;
1012 case SP_VERB_SELECTION_SLICE:
1013 sp_selected_path_slice();
1014 break;
1016 case SP_VERB_SELECTION_OFFSET:
1017 sp_selected_path_offset();
1018 break;
1019 case SP_VERB_SELECTION_OFFSET_SCREEN:
1020 sp_selected_path_offset_screen(1);
1021 break;
1022 case SP_VERB_SELECTION_OFFSET_SCREEN_10:
1023 sp_selected_path_offset_screen(10);
1024 break;
1025 case SP_VERB_SELECTION_INSET:
1026 sp_selected_path_inset();
1027 break;
1028 case SP_VERB_SELECTION_INSET_SCREEN:
1029 sp_selected_path_inset_screen(1);
1030 break;
1031 case SP_VERB_SELECTION_INSET_SCREEN_10:
1032 sp_selected_path_inset_screen(10);
1033 break;
1034 case SP_VERB_SELECTION_DYNAMIC_OFFSET:
1035 sp_selected_path_create_offset_object_zero();
1036 break;
1037 case SP_VERB_SELECTION_LINKED_OFFSET:
1038 sp_selected_path_create_updating_offset_object_zero();
1039 break;
1041 case SP_VERB_SELECTION_OUTLINE:
1042 sp_selected_path_outline();
1043 break;
1044 case SP_VERB_SELECTION_SIMPLIFY:
1045 sp_selected_path_simplify();
1046 break;
1047 case SP_VERB_SELECTION_REVERSE:
1048 sp_selected_path_reverse();
1049 break;
1050 case SP_VERB_SELECTION_TRACE:
1051 dt->_dlg_mgr->showDialog("Trace");
1052 break;
1053 case SP_VERB_SELECTION_CREATE_BITMAP:
1054 sp_selection_create_bitmap_copy();
1055 break;
1057 case SP_VERB_SELECTION_COMBINE:
1058 sp_selected_path_combine();
1059 break;
1060 case SP_VERB_SELECTION_BREAK_APART:
1061 sp_selected_path_break_apart();
1062 break;
1063 case SP_VERB_SELECTION_GRIDTILE:
1064 dt->_dlg_mgr->showDialog("TileDialog");
1065 break;
1066 default:
1067 break;
1068 }
1070 } // end of sp_verb_action_selection_perform()
1072 /** \brief Decode the verb code and take appropriate action */
1073 void
1074 LayerVerb::perform(SPAction *action, void *data, void *pdata)
1075 {
1076 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1077 unsigned int verb = reinterpret_cast<std::size_t>(data);
1079 if ( !dt || !dt->currentLayer() ) {
1080 return;
1081 }
1083 switch (verb) {
1084 case SP_VERB_LAYER_NEW: {
1085 Inkscape::UI::Dialogs::LayerPropertiesDialog::showCreate(dt, dt->currentLayer());
1086 break;
1087 }
1088 case SP_VERB_LAYER_RENAME: {
1089 Inkscape::UI::Dialogs::LayerPropertiesDialog::showRename(dt, dt->currentLayer());
1090 break;
1091 }
1092 case SP_VERB_LAYER_NEXT: {
1093 SPObject *next=Inkscape::next_layer(dt->currentRoot(), dt->currentLayer());
1094 if (next) {
1095 dt->setCurrentLayer(next);
1096 sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_NEXT,
1097 _("Move to next layer"));
1098 dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Moved to next layer."));
1099 } else {
1100 dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Cannot move past last layer."));
1101 }
1102 break;
1103 }
1104 case SP_VERB_LAYER_PREV: {
1105 SPObject *prev=Inkscape::previous_layer(dt->currentRoot(), dt->currentLayer());
1106 if (prev) {
1107 dt->setCurrentLayer(prev);
1108 sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_PREV,
1109 _("Move to previous layer"));
1110 dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Moved to previous layer."));
1111 } else {
1112 dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Cannot move past first layer."));
1113 }
1114 break;
1115 }
1116 case SP_VERB_LAYER_MOVE_TO_NEXT: {
1117 sp_selection_to_next_layer();
1118 break;
1119 }
1120 case SP_VERB_LAYER_MOVE_TO_PREV: {
1121 sp_selection_to_prev_layer();
1122 break;
1123 }
1124 case SP_VERB_LAYER_TO_TOP:
1125 case SP_VERB_LAYER_TO_BOTTOM:
1126 case SP_VERB_LAYER_RAISE:
1127 case SP_VERB_LAYER_LOWER: {
1128 if ( dt->currentLayer() == dt->currentRoot() ) {
1129 dt->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No current layer."));
1130 return;
1131 }
1133 SPItem *layer=SP_ITEM(dt->currentLayer());
1134 g_return_if_fail(layer != NULL);
1136 SPObject *old_pos=SP_OBJECT_NEXT(layer);
1138 switch (verb) {
1139 case SP_VERB_LAYER_TO_TOP:
1140 layer->raiseToTop();
1141 break;
1142 case SP_VERB_LAYER_TO_BOTTOM:
1143 layer->lowerToBottom();
1144 break;
1145 case SP_VERB_LAYER_RAISE:
1146 layer->raiseOne();
1147 break;
1148 case SP_VERB_LAYER_LOWER:
1149 layer->lowerOne();
1150 break;
1151 }
1153 if ( SP_OBJECT_NEXT(layer) != old_pos ) {
1154 char const *message = NULL;
1155 Glib::ustring description = "";
1156 switch (verb) {
1157 case SP_VERB_LAYER_TO_TOP:
1158 message = g_strdup_printf(_("Raised layer <b>%s</b>."), layer->defaultLabel());
1159 description = _("Layer to top");
1160 break;
1161 case SP_VERB_LAYER_RAISE:
1162 message = g_strdup_printf(_("Raised layer <b>%s</b>."), layer->defaultLabel());
1163 description = _("Raise layer");
1164 break;
1165 case SP_VERB_LAYER_TO_BOTTOM:
1166 message = g_strdup_printf(_("Lowered layer <b>%s</b>."), layer->defaultLabel());
1167 description = _("Layer to bottom");
1168 break;
1169 case SP_VERB_LAYER_LOWER:
1170 message = g_strdup_printf(_("Lowered layer <b>%s</b>."), layer->defaultLabel());
1171 description = _("Lower layer");
1172 break;
1173 };
1174 sp_document_done(sp_desktop_document(dt), verb, description);
1175 if (message) {
1176 dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, message);
1177 g_free((void *) message);
1178 }
1179 } else {
1180 dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Cannot move layer any further."));
1181 }
1183 break;
1184 }
1185 case SP_VERB_LAYER_DELETE: {
1186 if ( dt->currentLayer() != dt->currentRoot() ) {
1187 sp_desktop_selection(dt)->clear();
1188 SPObject *old_layer=dt->currentLayer();
1190 sp_object_ref(old_layer, NULL);
1191 SPObject *survivor=Inkscape::next_layer(dt->currentRoot(), old_layer);
1192 if (!survivor) {
1193 survivor = Inkscape::previous_layer(dt->currentRoot(), old_layer);
1194 }
1196 /* Deleting the old layer before switching layers is a hack to trigger the
1197 * listeners of the deletion event (as happens when old_layer is deleted using the
1198 * xml editor). See
1199 * http://sourceforge.net/tracker/index.php?func=detail&aid=1339397&group_id=93438&atid=604306
1200 */
1201 old_layer->deleteObject();
1202 sp_object_unref(old_layer, NULL);
1203 if (survivor) {
1204 dt->setCurrentLayer(survivor);
1205 }
1207 sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_DELETE,
1208 _("Delete layer"));
1210 // TRANSLATORS: this means "The layer has been deleted."
1211 dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Deleted layer."));
1212 } else {
1213 dt->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No current layer."));
1214 }
1215 break;
1216 }
1217 }
1219 return;
1220 } // end of sp_verb_action_layer_perform()
1222 /** \brief Decode the verb code and take appropriate action */
1223 void
1224 ObjectVerb::perform( SPAction *action, void *data, void *pdata )
1225 {
1226 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1227 if (!dt)
1228 return;
1230 SPEventContext *ec = dt->event_context;
1232 Inkscape::Selection *sel = sp_desktop_selection(dt);
1234 if (sel->isEmpty())
1235 return;
1237 NR::Point const center(sel->bounds().midpoint());
1239 switch (reinterpret_cast<std::size_t>(data)) {
1240 case SP_VERB_OBJECT_ROTATE_90_CW:
1241 sp_selection_rotate_90_cw();
1242 break;
1243 case SP_VERB_OBJECT_ROTATE_90_CCW:
1244 sp_selection_rotate_90_ccw();
1245 break;
1246 case SP_VERB_OBJECT_FLATTEN:
1247 sp_selection_remove_transform();
1248 break;
1249 case SP_VERB_OBJECT_TO_CURVE:
1250 sp_selected_path_to_curves();
1251 break;
1252 case SP_VERB_OBJECT_FLOW_TEXT:
1253 text_flow_into_shape();
1254 break;
1255 case SP_VERB_OBJECT_UNFLOW_TEXT:
1256 text_unflow();
1257 break;
1258 case SP_VERB_OBJECT_FLOWTEXT_TO_TEXT:
1259 SPFlowtext::convert_to_text();
1260 break;
1261 case SP_VERB_OBJECT_FLIP_HORIZONTAL:
1262 if (tools_isactive(dt, TOOLS_NODES)) {
1263 sp_nodepath_flip(SP_NODE_CONTEXT(ec)->nodepath, NR::X);
1264 } else {
1265 sp_selection_scale_relative(sel, center, NR::scale(-1.0, 1.0));
1266 }
1267 sp_document_done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_HORIZONTAL,
1268 _("Flip horizontally"));
1269 break;
1270 case SP_VERB_OBJECT_FLIP_VERTICAL:
1271 if (tools_isactive(dt, TOOLS_NODES)) {
1272 sp_nodepath_flip(SP_NODE_CONTEXT(ec)->nodepath, NR::Y);
1273 } else {
1274 sp_selection_scale_relative(sel, center, NR::scale(1.0, -1.0));
1275 }
1276 sp_document_done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_VERTICAL,
1277 _("Flip vertically"));
1278 break;
1279 case SP_VERB_OBJECT_SET_MASK:
1280 sp_selection_set_mask(false, false);
1281 break;
1282 case SP_VERB_OBJECT_UNSET_MASK:
1283 sp_selection_unset_mask(false);
1284 break;
1285 case SP_VERB_OBJECT_SET_CLIPPATH:
1286 sp_selection_set_mask(true, false);
1287 break;
1288 case SP_VERB_OBJECT_UNSET_CLIPPATH:
1289 sp_selection_unset_mask(true);
1290 break;
1291 default:
1292 break;
1293 }
1295 } // end of sp_verb_action_object_perform()
1297 /** \brief Decode the verb code and take appropriate action */
1298 void
1299 ContextVerb::perform(SPAction *action, void *data, void *pdata)
1300 {
1301 SPDesktop *dt;
1302 sp_verb_t verb;
1303 int vidx;
1305 dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1307 if (!dt)
1308 return;
1310 verb = (sp_verb_t)GPOINTER_TO_INT((gpointer)data);
1312 /** \todo !!! hopefully this can go away soon and actions can look after
1313 * themselves
1314 */
1315 for (vidx = SP_VERB_CONTEXT_SELECT; vidx <= SP_VERB_CONTEXT_DROPPER_PREFS; vidx++)
1316 {
1317 SPAction *tool_action= get((sp_verb_t)vidx)->get_action(dt);
1318 if (tool_action) {
1319 sp_action_set_active(tool_action, vidx == (int)verb);
1320 }
1321 }
1323 switch (verb) {
1324 case SP_VERB_CONTEXT_SELECT:
1325 tools_switch_current(TOOLS_SELECT);
1326 break;
1327 case SP_VERB_CONTEXT_NODE:
1328 tools_switch_current(TOOLS_NODES);
1329 break;
1330 case SP_VERB_CONTEXT_RECT:
1331 tools_switch_current(TOOLS_SHAPES_RECT);
1332 break;
1333 case SP_VERB_CONTEXT_ARC:
1334 tools_switch_current(TOOLS_SHAPES_ARC);
1335 break;
1336 case SP_VERB_CONTEXT_STAR:
1337 tools_switch_current(TOOLS_SHAPES_STAR);
1338 break;
1339 case SP_VERB_CONTEXT_SPIRAL:
1340 tools_switch_current(TOOLS_SHAPES_SPIRAL);
1341 break;
1342 case SP_VERB_CONTEXT_PENCIL:
1343 tools_switch_current(TOOLS_FREEHAND_PENCIL);
1344 break;
1345 case SP_VERB_CONTEXT_PEN:
1346 tools_switch_current(TOOLS_FREEHAND_PEN);
1347 break;
1348 case SP_VERB_CONTEXT_CALLIGRAPHIC:
1349 tools_switch_current(TOOLS_CALLIGRAPHIC);
1350 break;
1351 case SP_VERB_CONTEXT_TEXT:
1352 tools_switch_current(TOOLS_TEXT);
1353 break;
1354 case SP_VERB_CONTEXT_GRADIENT:
1355 tools_switch_current(TOOLS_GRADIENT);
1356 break;
1357 case SP_VERB_CONTEXT_ZOOM:
1358 tools_switch_current(TOOLS_ZOOM);
1359 break;
1360 case SP_VERB_CONTEXT_DROPPER:
1361 tools_switch_current(TOOLS_DROPPER);
1362 break;
1363 case SP_VERB_CONTEXT_CONNECTOR:
1364 tools_switch_current (TOOLS_CONNECTOR);
1365 break;
1367 case SP_VERB_CONTEXT_SELECT_PREFS:
1368 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SELECTOR);
1369 dt->_dlg_mgr->showDialog("InkscapePreferences");
1370 break;
1371 case SP_VERB_CONTEXT_NODE_PREFS:
1372 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_NODE);
1373 dt->_dlg_mgr->showDialog("InkscapePreferences");
1374 break;
1375 case SP_VERB_CONTEXT_RECT_PREFS:
1376 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SHAPES_RECT);
1377 dt->_dlg_mgr->showDialog("InkscapePreferences");
1378 break;
1379 case SP_VERB_CONTEXT_ARC_PREFS:
1380 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SHAPES_ELLIPSE);
1381 dt->_dlg_mgr->showDialog("InkscapePreferences");
1382 break;
1383 case SP_VERB_CONTEXT_STAR_PREFS:
1384 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SHAPES_STAR);
1385 dt->_dlg_mgr->showDialog("InkscapePreferences");
1386 break;
1387 case SP_VERB_CONTEXT_SPIRAL_PREFS:
1388 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SHAPES_SPIRAL);
1389 dt->_dlg_mgr->showDialog("InkscapePreferences");
1390 break;
1391 case SP_VERB_CONTEXT_PENCIL_PREFS:
1392 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_PENCIL);
1393 dt->_dlg_mgr->showDialog("InkscapePreferences");
1394 break;
1395 case SP_VERB_CONTEXT_PEN_PREFS:
1396 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_PEN);
1397 dt->_dlg_mgr->showDialog("InkscapePreferences");
1398 break;
1399 case SP_VERB_CONTEXT_CALLIGRAPHIC_PREFS:
1400 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_CALLIGRAPHY);
1401 dt->_dlg_mgr->showDialog("InkscapePreferences");
1402 break;
1403 case SP_VERB_CONTEXT_TEXT_PREFS:
1404 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_TEXT);
1405 dt->_dlg_mgr->showDialog("InkscapePreferences");
1406 break;
1407 case SP_VERB_CONTEXT_GRADIENT_PREFS:
1408 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_GRADIENT);
1409 dt->_dlg_mgr->showDialog("InkscapePreferences");
1410 break;
1411 case SP_VERB_CONTEXT_ZOOM_PREFS:
1412 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_ZOOM);
1413 dt->_dlg_mgr->showDialog("InkscapePreferences");
1414 break;
1415 case SP_VERB_CONTEXT_DROPPER_PREFS:
1416 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_DROPPER);
1417 dt->_dlg_mgr->showDialog("InkscapePreferences");
1418 break;
1419 case SP_VERB_CONTEXT_CONNECTOR_PREFS:
1420 prefs_set_int_attribute ("dialogs.preferences", "page", PREFS_PAGE_TOOLS_CONNECTOR);
1421 dt->_dlg_mgr->showDialog("InkscapePreferences");
1422 break;
1424 default:
1425 break;
1426 }
1428 } // end of sp_verb_action_ctx_perform()
1430 /** \brief Decode the verb code and take appropriate action */
1431 void
1432 TextVerb::perform(SPAction *action, void *data, void *pdata)
1433 {
1434 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1435 if (!dt)
1436 return;
1438 SPDocument *doc = sp_desktop_document(dt);
1439 (void)doc;
1440 Inkscape::XML::Node *repr = SP_OBJECT_REPR(dt->namedview);
1441 (void)repr;
1442 }
1444 /** \brief Decode the verb code and take appropriate action */
1445 void
1446 ZoomVerb::perform(SPAction *action, void *data, void *pdata)
1447 {
1448 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1449 if (!dt)
1450 return;
1452 SPDocument *doc = sp_desktop_document(dt);
1454 Inkscape::XML::Node *repr = SP_OBJECT_REPR(dt->namedview);
1456 gdouble zoom_inc =
1457 prefs_get_double_attribute_limited( "options.zoomincrement",
1458 "value", 1.414213562, 1.01, 10 );
1460 switch (GPOINTER_TO_INT(data)) {
1461 case SP_VERB_ZOOM_IN:
1462 {
1463 NR::Rect const d = dt->get_display_area();
1464 dt->zoom_relative( d.midpoint()[NR::X], d.midpoint()[NR::Y], zoom_inc);
1465 break;
1466 }
1467 case SP_VERB_ZOOM_OUT:
1468 {
1469 NR::Rect const d = dt->get_display_area();
1470 dt->zoom_relative( d.midpoint()[NR::X], d.midpoint()[NR::Y], 1 / zoom_inc );
1471 break;
1472 }
1473 case SP_VERB_ZOOM_1_1:
1474 {
1475 NR::Rect const d = dt->get_display_area();
1476 dt->zoom_absolute( d.midpoint()[NR::X], d.midpoint()[NR::Y], 1.0 );
1477 break;
1478 }
1479 case SP_VERB_ZOOM_1_2:
1480 {
1481 NR::Rect const d = dt->get_display_area();
1482 dt->zoom_absolute( d.midpoint()[NR::X], d.midpoint()[NR::Y], 0.5);
1483 break;
1484 }
1485 case SP_VERB_ZOOM_2_1:
1486 {
1487 NR::Rect const d = dt->get_display_area();
1488 dt->zoom_absolute( d.midpoint()[NR::X], d.midpoint()[NR::Y], 2.0 );
1489 break;
1490 }
1491 case SP_VERB_ZOOM_PAGE:
1492 dt->zoom_page();
1493 break;
1494 case SP_VERB_ZOOM_PAGE_WIDTH:
1495 dt->zoom_page_width();
1496 break;
1497 case SP_VERB_ZOOM_DRAWING:
1498 dt->zoom_drawing();
1499 break;
1500 case SP_VERB_ZOOM_SELECTION:
1501 dt->zoom_selection();
1502 break;
1503 case SP_VERB_ZOOM_NEXT:
1504 dt->next_zoom();
1505 break;
1506 case SP_VERB_ZOOM_PREV:
1507 dt->prev_zoom();
1508 break;
1509 case SP_VERB_TOGGLE_RULERS:
1510 dt->toggleRulers();
1511 break;
1512 case SP_VERB_TOGGLE_SCROLLBARS:
1513 dt->toggleScrollbars();
1514 break;
1515 case SP_VERB_TOGGLE_GUIDES:
1516 sp_namedview_toggle_guides(doc, repr);
1517 break;
1518 case SP_VERB_TOGGLE_GRID:
1519 sp_namedview_toggle_grid(doc, repr);
1520 break;
1521 #ifdef HAVE_GTK_WINDOW_FULLSCREEN
1522 case SP_VERB_FULLSCREEN:
1523 dt->fullscreen();
1524 break;
1525 #endif /* HAVE_GTK_WINDOW_FULLSCREEN */
1526 case SP_VERB_VIEW_NEW:
1527 sp_ui_new_view();
1528 break;
1529 case SP_VERB_VIEW_NEW_PREVIEW:
1530 sp_ui_new_view_preview();
1531 break;
1532 case SP_VERB_VIEW_MODE_NORMAL:
1533 dt->setDisplayModeNormal();
1534 break;
1535 case SP_VERB_VIEW_MODE_OUTLINE:
1536 dt->setDisplayModeOutline();
1537 break;
1538 case SP_VERB_VIEW_MODE_TOGGLE:
1539 dt->displayModeToggle();
1540 break;
1541 case SP_VERB_VIEW_ICON_PREVIEW:
1542 show_panel( Inkscape::UI::Dialogs::IconPreviewPanel::getInstance(), "dialogs.iconpreview", SP_VERB_VIEW_ICON_PREVIEW );
1543 break;
1544 default:
1545 break;
1546 }
1548 dt->updateNow();
1550 } // end of sp_verb_action_zoom_perform()
1552 /** \brief Decode the verb code and take appropriate action */
1553 void
1554 DialogVerb::perform(SPAction *action, void *data, void *pdata)
1555 {
1556 if (reinterpret_cast<std::size_t>(data) != SP_VERB_DIALOG_TOGGLE) {
1557 // unhide all when opening a new dialog
1558 inkscape_dialogs_unhide();
1559 }
1561 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1562 g_assert(dt->_dlg_mgr != NULL);
1564 switch (reinterpret_cast<std::size_t>(data)) {
1565 case SP_VERB_DIALOG_DISPLAY:
1566 //sp_display_dialog();
1567 dt->_dlg_mgr->showDialog("InkscapePreferences");
1568 break;
1569 case SP_VERB_DIALOG_METADATA:
1570 // sp_desktop_dialog();
1571 dt->_dlg_mgr->showDialog("DocumentMetadata");
1572 break;
1573 case SP_VERB_DIALOG_NAMEDVIEW:
1574 // sp_desktop_dialog();
1575 dt->_dlg_mgr->showDialog("DocumentProperties");
1576 break;
1577 case SP_VERB_DIALOG_FILL_STROKE:
1578 sp_object_properties_dialog();
1579 break;
1580 case SP_VERB_DIALOG_SWATCHES:
1581 show_panel( Inkscape::UI::Dialogs::SwatchesPanel::getInstance(), "dialogs.swatches", SP_VERB_DIALOG_SWATCHES);
1582 break;
1583 case SP_VERB_DIALOG_TRANSFORM:
1584 dt->_dlg_mgr->showDialog("Transformation");
1585 break;
1586 case SP_VERB_DIALOG_ALIGN_DISTRIBUTE:
1587 dt->_dlg_mgr->showDialog("AlignAndDistribute");
1588 break;
1589 case SP_VERB_DIALOG_TEXT:
1590 sp_text_edit_dialog();
1591 break;
1592 case SP_VERB_DIALOG_XML_EDITOR:
1593 sp_xml_tree_dialog();
1594 break;
1595 case SP_VERB_DIALOG_FIND:
1596 sp_find_dialog();
1597 break;
1598 case SP_VERB_DIALOG_DEBUG:
1599 dt->_dlg_mgr->showDialog("Messages");
1600 break;
1601 case SP_VERB_DIALOG_SCRIPT:
1602 dt->_dlg_mgr->showDialog("Script");
1603 break;
1604 case SP_VERB_DIALOG_UNDO_HISTORY:
1605 dt->_dlg_mgr->showDialog("UndoHistory");
1606 break;
1607 case SP_VERB_DIALOG_TOGGLE:
1608 inkscape_dialogs_toggle();
1609 break;
1610 case SP_VERB_DIALOG_CLONETILER:
1611 clonetiler_dialog();
1612 break;
1613 case SP_VERB_DIALOG_ITEM:
1614 sp_item_dialog();
1615 break;
1616 #ifdef WITH_INKBOARD
1617 case SP_VERB_XMPP_CLIENT:
1618 {
1619 Inkscape::Whiteboard::SessionManager::showClient();
1620 break;
1621 }
1622 #endif
1623 case SP_VERB_DIALOG_INPUT:
1624 sp_input_dialog();
1625 break;
1626 case SP_VERB_DIALOG_EXTENSIONEDITOR:
1627 dt->_dlg_mgr->showDialog("ExtensionEditor");
1628 break;
1629 case SP_VERB_DIALOG_LAYERS:
1630 show_panel( Inkscape::UI::Dialogs::LayersPanel::getInstance(), "dialogs.layers", SP_VERB_DIALOG_LAYERS );
1631 break;
1632 default:
1633 break;
1634 }
1635 } // end of sp_verb_action_dialog_perform()
1637 /** \brief Decode the verb code and take appropriate action */
1638 void
1639 HelpVerb::perform(SPAction *action, void *data, void *pdata)
1640 {
1641 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1642 g_assert(dt->_dlg_mgr != NULL);
1644 switch (reinterpret_cast<std::size_t>(data)) {
1645 case SP_VERB_HELP_KEYS:
1646 /* TRANSLATORS: If you have translated the keys.svg file to your language, then
1647 translate this string as "keys.LANG.svg" (where LANG is your language code);
1648 otherwise leave as "keys.svg". */
1649 sp_help_open_screen(_("keys.svg"));
1650 break;
1651 case SP_VERB_HELP_ABOUT:
1652 sp_help_about();
1653 break;
1654 case SP_VERB_HELP_ABOUT_EXTENSIONS: {
1655 Inkscape::UI::Dialogs::ExtensionsPanel *panel = new Inkscape::UI::Dialogs::ExtensionsPanel();
1656 panel->set_full(true);
1657 show_panel( *panel, "dialogs.aboutextensions", SP_VERB_HELP_ABOUT_EXTENSIONS );
1658 break;
1659 }
1661 /*
1662 case SP_VERB_SHOW_LICENSE:
1663 // TRANSLATORS: See "tutorial-basic.svg" comment.
1664 sp_help_open_tutorial(NULL, (gpointer) _("gpl-2.svg"));
1665 break;
1666 */
1668 case SP_VERB_HELP_MEMORY:
1669 dt->_dlg_mgr->showDialog("Memory");
1670 break;
1671 default:
1672 break;
1673 }
1674 } // end of sp_verb_action_help_perform()
1676 /** \brief Decode the verb code and take appropriate action */
1677 void
1678 TutorialVerb::perform(SPAction *action, void *data, void *pdata)
1679 {
1680 switch (reinterpret_cast<std::size_t>(data)) {
1681 case SP_VERB_TUTORIAL_BASIC:
1682 /* TRANSLATORS: If you have translated the tutorial-basic.svg file to your language,
1683 then translate this string as "tutorial-basic.LANG.svg" (where LANG is your language
1684 code); otherwise leave as "tutorial-basic.svg". */
1685 sp_help_open_tutorial(NULL, (gpointer)_("tutorial-basic.svg"));
1686 break;
1687 case SP_VERB_TUTORIAL_SHAPES:
1688 // TRANSLATORS: See "tutorial-basic.svg" comment.
1689 sp_help_open_tutorial(NULL, (gpointer)_("tutorial-shapes.svg"));
1690 break;
1691 case SP_VERB_TUTORIAL_ADVANCED:
1692 // TRANSLATORS: See "tutorial-basic.svg" comment.
1693 sp_help_open_tutorial(NULL, (gpointer)_("tutorial-advanced.svg"));
1694 break;
1695 case SP_VERB_TUTORIAL_TRACING:
1696 // TRANSLATORS: See "tutorial-basic.svg" comment.
1697 sp_help_open_tutorial(NULL, (gpointer)_("tutorial-tracing.svg"));
1698 break;
1699 case SP_VERB_TUTORIAL_CALLIGRAPHY:
1700 // TRANSLATORS: See "tutorial-basic.svg" comment.
1701 sp_help_open_tutorial(NULL, (gpointer)_("tutorial-calligraphy.svg"));
1702 break;
1703 case SP_VERB_TUTORIAL_DESIGN:
1704 // TRANSLATORS: See "tutorial-basic.svg" comment.
1705 sp_help_open_tutorial(NULL, (gpointer)_("tutorial-elements.svg"));
1706 break;
1707 case SP_VERB_TUTORIAL_TIPS:
1708 // TRANSLATORS: See "tutorial-basic.svg" comment.
1709 sp_help_open_tutorial(NULL, (gpointer)_("tutorial-tips.svg"));
1710 break;
1711 default:
1712 break;
1713 }
1714 } // end of sp_verb_action_tutorial_perform()
1717 /**
1718 * Action vector to define functions called if a staticly defined file verb
1719 * is called.
1720 */
1721 SPActionEventVector FileVerb::vector =
1722 {{NULL},FileVerb::perform, NULL, NULL, NULL, NULL};
1723 /**
1724 * Action vector to define functions called if a staticly defined edit verb is
1725 * called.
1726 */
1727 SPActionEventVector EditVerb::vector =
1728 {{NULL},EditVerb::perform, NULL, NULL, NULL, NULL};
1730 /**
1731 * Action vector to define functions called if a staticly defined selection
1732 * verb is called
1733 */
1734 SPActionEventVector SelectionVerb::vector =
1735 {{NULL},SelectionVerb::perform, NULL, NULL, NULL, NULL};
1737 /**
1738 * Action vector to define functions called if a staticly defined layer
1739 * verb is called
1740 */
1741 SPActionEventVector LayerVerb::vector =
1742 {{NULL}, LayerVerb::perform, NULL, NULL, NULL, NULL};
1744 /**
1745 * Action vector to define functions called if a staticly defined object
1746 * editing verb is called
1747 */
1748 SPActionEventVector ObjectVerb::vector =
1749 {{NULL},ObjectVerb::perform, NULL, NULL, NULL, NULL};
1751 /**
1752 * Action vector to define functions called if a staticly defined context
1753 * verb is called
1754 */
1755 SPActionEventVector ContextVerb::vector =
1756 {{NULL},ContextVerb::perform, NULL, NULL, NULL, NULL};
1758 /**
1759 * Action vector to define functions called if a staticly defined zoom verb
1760 * is called
1761 */
1762 SPActionEventVector ZoomVerb::vector =
1763 {{NULL},ZoomVerb::perform, NULL, NULL, NULL, NULL};
1766 /**
1767 * Action vector to define functions called if a staticly defined dialog verb
1768 * is called
1769 */
1770 SPActionEventVector DialogVerb::vector =
1771 {{NULL},DialogVerb::perform, NULL, NULL, NULL, NULL};
1773 /**
1774 * Action vector to define functions called if a staticly defined help verb
1775 * is called
1776 */
1777 SPActionEventVector HelpVerb::vector =
1778 {{NULL},HelpVerb::perform, NULL, NULL, NULL, NULL};
1780 /**
1781 * Action vector to define functions called if a staticly defined tutorial verb
1782 * is called
1783 */
1784 SPActionEventVector TutorialVerb::vector =
1785 {{NULL},TutorialVerb::perform, NULL, NULL, NULL, NULL};
1787 /**
1788 * Action vector to define functions called if a staticly defined tutorial verb
1789 * is called
1790 */
1791 SPActionEventVector TextVerb::vector =
1792 {{NULL},TextVerb::perform, NULL, NULL, NULL, NULL};
1795 /* *********** Effect Last ********** */
1797 /** \brief A class to represent the last effect issued */
1798 class EffectLastVerb : public Verb {
1799 private:
1800 static void perform(SPAction *action, void *mydata, void *otherdata);
1801 static SPActionEventVector vector;
1802 protected:
1803 virtual SPAction *make_action(Inkscape::UI::View::View *view);
1804 public:
1805 /** \brief Use the Verb initializer with the same parameters. */
1806 EffectLastVerb(unsigned int const code,
1807 gchar const *id,
1808 gchar const *name,
1809 gchar const *tip,
1810 gchar const *image) :
1811 Verb(code, id, name, tip, image)
1812 {
1813 set_default_sensitive(false);
1814 }
1815 }; /* EffectLastVerb class */
1817 /**
1818 * The vector to attach in the last effect verb.
1819 */
1820 SPActionEventVector EffectLastVerb::vector =
1821 {{NULL},EffectLastVerb::perform, NULL, NULL, NULL, NULL};
1823 /** \brief Create an action for a \c EffectLastVerb
1824 \param view Which view the action should be created for
1825 \return The built action.
1827 Calls \c make_action_helper with the \c vector.
1828 */
1829 SPAction *
1830 EffectLastVerb::make_action(Inkscape::UI::View::View *view)
1831 {
1832 return make_action_helper(view, &vector);
1833 }
1835 /** \brief Decode the verb code and take appropriate action */
1836 void
1837 EffectLastVerb::perform(SPAction *action, void *data, void *pdata)
1838 {
1839 /* These aren't used, but are here to remind people not to use
1840 the CURRENT_DOCUMENT macros unless they really have to. */
1841 Inkscape::UI::View::View *current_view = sp_action_get_view(action);
1842 // SPDocument *current_document = SP_VIEW_DOCUMENT(current_view);
1843 Inkscape::Extension::Effect *effect = Inkscape::Extension::Effect::get_last_effect();
1845 if (effect == NULL) return;
1846 if (current_view == NULL) return;
1848 switch ((long) data) {
1849 case SP_VERB_EFFECT_LAST_PREF:
1850 if (!effect->prefs(current_view))
1851 return;
1852 /* Note: fall through */
1853 case SP_VERB_EFFECT_LAST:
1854 effect->effect(current_view);
1855 break;
1856 default:
1857 return;
1858 }
1860 return;
1861 }
1862 /* *********** End Effect Last ********** */
1864 /* *********** Fit Canvas ********** */
1866 /** \brief A class to represent the canvas fitting verbs */
1867 class FitCanvasVerb : public Verb {
1868 private:
1869 static void perform(SPAction *action, void *mydata, void *otherdata);
1870 static SPActionEventVector vector;
1871 protected:
1872 virtual SPAction *make_action(Inkscape::UI::View::View *view);
1873 public:
1874 /** \brief Use the Verb initializer with the same parameters. */
1875 FitCanvasVerb(unsigned int const code,
1876 gchar const *id,
1877 gchar const *name,
1878 gchar const *tip,
1879 gchar const *image) :
1880 Verb(code, id, name, tip, image)
1881 {
1882 set_default_sensitive(false);
1883 }
1884 }; /* FitCanvasVerb class */
1886 /**
1887 * The vector to attach in the fit canvas verb.
1888 */
1889 SPActionEventVector FitCanvasVerb::vector =
1890 {{NULL},FitCanvasVerb::perform, NULL, NULL, NULL, NULL};
1892 /** \brief Create an action for a \c FitCanvasVerb
1893 \param view Which view the action should be created for
1894 \return The built action.
1896 Calls \c make_action_helper with the \c vector.
1897 */
1898 SPAction *
1899 FitCanvasVerb::make_action(Inkscape::UI::View::View *view)
1900 {
1901 SPAction *action = make_action_helper(view, &vector);
1902 return action;
1903 }
1905 /** \brief Decode the verb code and take appropriate action */
1906 void
1907 FitCanvasVerb::perform(SPAction *action, void *data, void *pdata)
1908 {
1909 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1910 if (!dt) return;
1911 SPDocument *doc = sp_desktop_document(dt);
1912 if (!doc) return;
1914 switch ((long) data) {
1915 case SP_VERB_FIT_CANVAS_TO_SELECTION:
1916 fit_canvas_to_selection(dt);
1917 break;
1918 case SP_VERB_FIT_CANVAS_TO_DRAWING:
1919 fit_canvas_to_drawing(doc);
1920 break;
1921 case SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING:
1922 fit_canvas_to_selection_or_drawing(dt);
1923 break;
1924 default:
1925 return;
1926 }
1928 return;
1929 }
1930 /* *********** End Fit Canvas ********** */
1937 /* these must be in the same order as the SP_VERB_* enum in "verbs.h" */
1938 Verb *Verb::_base_verbs[] = {
1939 /* Header */
1940 new Verb(SP_VERB_INVALID, NULL, NULL, NULL, NULL),
1941 new Verb(SP_VERB_NONE, "None", N_("None"), N_("Does nothing"), NULL),
1943 /* File */
1944 new FileVerb(SP_VERB_FILE_NEW, "FileNew", N_("Default"), N_("Create new document from the default template"),
1945 GTK_STOCK_NEW ),
1946 new FileVerb(SP_VERB_FILE_OPEN, "FileOpen", N_("_Open..."),
1947 N_("Open an existing document"), GTK_STOCK_OPEN ),
1948 new FileVerb(SP_VERB_FILE_REVERT, "FileRevert", N_("Re_vert"),
1949 N_("Revert to the last saved version of document (changes will be lost)"), GTK_STOCK_REVERT_TO_SAVED ),
1950 new FileVerb(SP_VERB_FILE_SAVE, "FileSave", N_("_Save"), N_("Save document"),
1951 GTK_STOCK_SAVE ),
1952 new FileVerb(SP_VERB_FILE_SAVE_AS, "FileSaveAs", N_("Save _As..."),
1953 N_("Save document under a new name"), GTK_STOCK_SAVE_AS ),
1954 new FileVerb(SP_VERB_FILE_SAVE_A_COPY, "FileSaveACopy", N_("Save a Cop_y..."),
1955 N_("Save a copy of the document under a new name"), NULL ),
1956 new FileVerb(SP_VERB_FILE_PRINT, "FilePrint", N_("_Print..."), N_("Print document"),
1957 GTK_STOCK_PRINT ),
1958 // TRANSLATORS: "Vacuum Defs" means "Clean up defs" (so as to remove unused definitions)
1959 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"),
1960 "file_vacuum" ),
1961 new FileVerb(SP_VERB_FILE_PRINT_DIRECT, "FilePrintDirect", N_("Print _Direct"),
1962 N_("Print directly without prompting to a file or pipe"), NULL ),
1963 new FileVerb(SP_VERB_FILE_PRINT_PREVIEW, "FilePrintPreview", N_("Print Previe_w"),
1964 N_("Preview document printout"), GTK_STOCK_PRINT_PREVIEW ),
1965 new FileVerb(SP_VERB_FILE_IMPORT, "FileImport", N_("_Import..."),
1966 N_("Import a bitmap or SVG image into this document"), "file_import"),
1967 new FileVerb(SP_VERB_FILE_EXPORT, "FileExport", N_("_Export Bitmap..."),
1968 N_("Export this document or a selection as a bitmap image"), "file_export"),
1969 new FileVerb(SP_VERB_FILE_NEXT_DESKTOP, "NextWindow", N_("N_ext Window"),
1970 N_("Switch to the next document window"), "window_next"),
1971 new FileVerb(SP_VERB_FILE_PREV_DESKTOP, "PrevWindow", N_("P_revious Window"),
1972 N_("Switch to the previous document window"), "window_previous"),
1973 new FileVerb(SP_VERB_FILE_CLOSE_VIEW, "FileClose", N_("_Close"),
1974 N_("Close this document window"), GTK_STOCK_CLOSE),
1975 new FileVerb(SP_VERB_FILE_QUIT, "FileQuit", N_("_Quit"), N_("Quit Inkscape"), GTK_STOCK_QUIT),
1977 /* Edit */
1978 new EditVerb(SP_VERB_EDIT_UNDO, "EditUndo", N_("_Undo"), N_("Undo last action"),
1979 GTK_STOCK_UNDO),
1980 new EditVerb(SP_VERB_EDIT_REDO, "EditRedo", N_("_Redo"),
1981 N_("Do again the last undone action"), GTK_STOCK_REDO),
1982 new EditVerb(SP_VERB_EDIT_CUT, "EditCut", N_("Cu_t"),
1983 N_("Cut selection to clipboard"), GTK_STOCK_CUT),
1984 new EditVerb(SP_VERB_EDIT_COPY, "EditCopy", N_("_Copy"),
1985 N_("Copy selection to clipboard"), GTK_STOCK_COPY),
1986 new EditVerb(SP_VERB_EDIT_PASTE, "EditPaste", N_("_Paste"),
1987 N_("Paste objects from clipboard to mouse point, or paste text"), GTK_STOCK_PASTE),
1988 new EditVerb(SP_VERB_EDIT_PASTE_STYLE, "EditPasteStyle", N_("Paste _Style"),
1989 N_("Apply the style of the copied object to selection"), "selection_paste_style"),
1990 new EditVerb(SP_VERB_EDIT_PASTE_SIZE, "EditPasteSize", N_("Paste Si_ze"),
1991 N_("Scale selection to match the size of the copied object"), NULL),
1992 new EditVerb(SP_VERB_EDIT_PASTE_SIZE_X, "EditPasteWidth", N_("Paste _Width"),
1993 N_("Scale selection horizontally to match the width of the copied object"), NULL),
1994 new EditVerb(SP_VERB_EDIT_PASTE_SIZE_Y, "EditPasteHeight", N_("Paste _Height"),
1995 N_("Scale selection vertically to match the height of the copied object"), NULL),
1996 new EditVerb(SP_VERB_EDIT_PASTE_SIZE_SEPARATELY, "EditPasteSizeSeparately", N_("Paste Size Separately"),
1997 N_("Scale each selected object to match the size of the copied object"), NULL),
1998 new EditVerb(SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_X, "EditPasteWidthSeparately", N_("Paste Width Separately"),
1999 N_("Scale each selected object horizontally to match the width of the copied object"), NULL),
2000 new EditVerb(SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_Y, "EditPasteHeightSeparately", N_("Paste Height Separately"),
2001 N_("Scale each selected object vertically to match the height of the copied object"), NULL),
2002 new EditVerb(SP_VERB_EDIT_PASTE_IN_PLACE, "EditPasteInPlace", N_("Paste _In Place"),
2003 N_("Paste objects from clipboard to the original location"), "selection_paste_in_place"),
2004 new EditVerb(SP_VERB_EDIT_DELETE, "EditDelete", N_("_Delete"),
2005 N_("Delete selection"), GTK_STOCK_DELETE),
2006 new EditVerb(SP_VERB_EDIT_DUPLICATE, "EditDuplicate", N_("Duplic_ate"),
2007 N_("Duplicate selected objects"), "edit_duplicate"),
2008 new EditVerb(SP_VERB_EDIT_CLONE, "EditClone", N_("Create Clo_ne"),
2009 N_("Create a clone (a copy linked to the original) of selected object"), "edit_clone"),
2010 new EditVerb(SP_VERB_EDIT_UNLINK_CLONE, "EditUnlinkClone", N_("Unlin_k Clone"),
2011 N_("Cut the selected clone's link to its original, turning it into a standalone object"), "edit_unlink_clone"),
2012 new EditVerb(SP_VERB_EDIT_CLONE_ORIGINAL, "EditCloneOriginal", N_("Select _Original"),
2013 N_("Select the object to which the selected clone is linked"), "edit_select_original"),
2014 // TRANSLATORS: Convert selection to a rectangle with tiled pattern fill
2015 new EditVerb(SP_VERB_EDIT_TILE, "ObjectsToPattern", N_("Objects to Patter_n"),
2016 N_("Convert selection to a rectangle with tiled pattern fill"), NULL),
2017 // TRANSLATORS: Extract objects from a tiled pattern fill
2018 new EditVerb(SP_VERB_EDIT_UNTILE, "ObjectsFromPattern", N_("Pattern to _Objects"),
2019 N_("Extract objects from a tiled pattern fill"), NULL),
2020 new EditVerb(SP_VERB_EDIT_CLEAR_ALL, "EditClearAll", N_("Clea_r All"),
2021 N_("Delete all objects from document"), NULL),
2022 new EditVerb(SP_VERB_EDIT_SELECT_ALL, "EditSelectAll", N_("Select Al_l"),
2023 N_("Select all objects or all nodes"), "selection_select_all"),
2024 new EditVerb(SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS, "EditSelectAllInAllLayers", N_("Select All in All La_yers"),
2025 N_("Select all objects in all visible and unlocked layers"), "selection_select_all_in_all_layers"),
2026 new EditVerb(SP_VERB_EDIT_INVERT, "EditInvert", N_("In_vert Selection"),
2027 N_("Invert selection (unselect what is selected and select everything else)"), "selection_invert"),
2028 new EditVerb(SP_VERB_EDIT_INVERT_IN_ALL_LAYERS, "EditInvertInAllLayers", N_("Invert in All Layers"),
2029 N_("Invert selection in all visible and unlocked layers"), NULL),
2030 new EditVerb(SP_VERB_EDIT_DESELECT, "EditDeselect", N_("D_eselect"),
2031 N_("Deselect any selected objects or nodes"), "selection_deselect"),
2033 /* Selection */
2034 new SelectionVerb(SP_VERB_SELECTION_TO_FRONT, "SelectionToFront", N_("Raise to _Top"),
2035 N_("Raise selection to top"), "selection_top"),
2036 new SelectionVerb(SP_VERB_SELECTION_TO_BACK, "SelectionToBack", N_("Lower to _Bottom"),
2037 N_("Lower selection to bottom"), "selection_bot"),
2038 new SelectionVerb(SP_VERB_SELECTION_RAISE, "SelectionRaise", N_("_Raise"),
2039 N_("Raise selection one step"), "selection_up"),
2040 new SelectionVerb(SP_VERB_SELECTION_LOWER, "SelectionLower", N_("_Lower"),
2041 N_("Lower selection one step"), "selection_down"),
2042 new SelectionVerb(SP_VERB_SELECTION_GROUP, "SelectionGroup", N_("_Group"),
2043 N_("Group selected objects"), "selection_group"),
2044 new SelectionVerb(SP_VERB_SELECTION_UNGROUP, "SelectionUnGroup", N_("_Ungroup"),
2045 N_("Ungroup selected groups"), "selection_ungroup"),
2047 new SelectionVerb(SP_VERB_SELECTION_TEXTTOPATH, "SelectionTextToPath", N_("_Put on Path"),
2048 N_("Put text on path"), "put_on_path"),
2049 new SelectionVerb(SP_VERB_SELECTION_TEXTFROMPATH, "SelectionTextFromPath", N_("_Remove from Path"),
2050 N_("Remove text from path"), "remove_from_path"),
2051 new SelectionVerb(SP_VERB_SELECTION_REMOVE_KERNS, "SelectionTextRemoveKerns", N_("Remove Manual _Kerns"),
2052 // TRANSLATORS: "glyph": An image used in the visual representation of characters;
2053 // roughly speaking, how a character looks. A font is a set of glyphs.
2054 N_("Remove all manual kerns and glyph rotations from a text object"), "remove_manual_kerns"),
2056 new SelectionVerb(SP_VERB_SELECTION_UNION, "SelectionUnion", N_("_Union"),
2057 N_("Create union of selected paths"), "union"),
2058 new SelectionVerb(SP_VERB_SELECTION_INTERSECT, "SelectionIntersect", N_("_Intersection"),
2059 N_("Create intersection of selected paths"), "intersection"),
2060 new SelectionVerb(SP_VERB_SELECTION_DIFF, "SelectionDiff", N_("_Difference"),
2061 N_("Create difference of selected paths (bottom minus top)"), "difference"),
2062 new SelectionVerb(SP_VERB_SELECTION_SYMDIFF, "SelectionSymDiff", N_("E_xclusion"),
2063 N_("Create exclusive OR of selected paths (those parts that belong to only one path)"), "exclusion"),
2064 new SelectionVerb(SP_VERB_SELECTION_CUT, "SelectionDivide", N_("Di_vision"),
2065 N_("Cut the bottom path into pieces"), "division"),
2066 // TRANSLATORS: "to cut a path" is not the same as "to break a path apart" - see the
2067 // Advanced tutorial for more info
2068 new SelectionVerb(SP_VERB_SELECTION_SLICE, "SelectionCutPath", N_("Cut _Path"),
2069 N_("Cut the bottom path's stroke into pieces, removing fill"), "cut_path"),
2070 // TRANSLATORS: "outset": expand a shape by offsetting the object's path,
2071 // i.e. by displacing it perpendicular to the path in each point.
2072 // See also the Advanced Tutorial for explanation.
2073 new SelectionVerb(SP_VERB_SELECTION_OFFSET, "SelectionOffset", N_("Outs_et"),
2074 N_("Outset selected paths"), "outset_path"),
2075 new SelectionVerb(SP_VERB_SELECTION_OFFSET_SCREEN, "SelectionOffsetScreen",
2076 N_("O_utset Path by 1 px"),
2077 N_("Outset selected paths by 1 px"), NULL),
2078 new SelectionVerb(SP_VERB_SELECTION_OFFSET_SCREEN_10, "SelectionOffsetScreen10",
2079 N_("O_utset Path by 10 px"),
2080 N_("Outset selected paths by 10 px"), NULL),
2081 // TRANSLATORS: "inset": contract a shape by offsetting the object's path,
2082 // i.e. by displacing it perpendicular to the path in each point.
2083 // See also the Advanced Tutorial for explanation.
2084 new SelectionVerb(SP_VERB_SELECTION_INSET, "SelectionInset", N_("I_nset"),
2085 N_("Inset selected paths"), "inset_path"),
2086 new SelectionVerb(SP_VERB_SELECTION_INSET_SCREEN, "SelectionInsetScreen",
2087 N_("I_nset Path by 1 px"),
2088 N_("Inset selected paths by 1 px"), NULL),
2089 new SelectionVerb(SP_VERB_SELECTION_INSET_SCREEN_10, "SelectionInsetScreen10",
2090 N_("I_nset Path by 10 px"),
2091 N_("Inset selected paths by 10 px"), NULL),
2092 new SelectionVerb(SP_VERB_SELECTION_DYNAMIC_OFFSET, "SelectionDynOffset",
2093 N_("D_ynamic Offset"), N_("Create a dynamic offset object"), "dynamic_offset"),
2094 new SelectionVerb(SP_VERB_SELECTION_LINKED_OFFSET, "SelectionLinkedOffset",
2095 N_("_Linked Offset"),
2096 N_("Create a dynamic offset object linked to the original path"),
2097 "linked_offset"),
2098 new SelectionVerb(SP_VERB_SELECTION_OUTLINE, "StrokeToPath", N_("_Stroke to Path"),
2099 N_("Convert selected object's stroke to paths"), "stroke_tocurve"),
2100 new SelectionVerb(SP_VERB_SELECTION_SIMPLIFY, "SelectionSimplify", N_("Si_mplify"),
2101 N_("Simplify selected paths (remove extra nodes)"), "simplify"),
2102 new SelectionVerb(SP_VERB_SELECTION_REVERSE, "SelectionReverse", N_("_Reverse"),
2103 N_("Reverse the direction of selected paths (useful for flipping markers)"), "selection_reverse"),
2104 // TRANSLATORS: "to trace" means "to convert a bitmap to vector graphics" (to vectorize)
2105 new SelectionVerb(SP_VERB_SELECTION_TRACE, "SelectionTrace", N_("_Trace Bitmap..."),
2106 N_("Create one or more paths from a bitmap by tracing it"), "selection_trace"),
2107 new SelectionVerb(SP_VERB_SELECTION_CREATE_BITMAP, "SelectionCreateBitmap", N_("_Make a Bitmap Copy"),
2108 N_("Export selection to a bitmap and insert it into document"), "selection_bitmap" ),
2109 new SelectionVerb(SP_VERB_SELECTION_COMBINE, "SelectionCombine", N_("_Combine"),
2110 N_("Combine several paths into one"), "selection_combine"),
2111 // TRANSLATORS: "to cut a path" is not the same as "to break a path apart" - see the
2112 // Advanced tutorial for more info
2113 new SelectionVerb(SP_VERB_SELECTION_BREAK_APART, "SelectionBreakApart", N_("Break _Apart"),
2114 N_("Break selected paths into subpaths"), "selection_break"),
2115 new SelectionVerb(SP_VERB_SELECTION_GRIDTILE, "DialogGridArrange", N_("Gri_d Arrange..."),
2116 N_("Arrange selected objects in a grid pattern"), "grid_arrange"),
2117 /* Layer */
2118 new LayerVerb(SP_VERB_LAYER_NEW, "LayerNew", N_("_Add Layer..."),
2119 N_("Create a new layer"), "new_layer"),
2120 new LayerVerb(SP_VERB_LAYER_RENAME, "LayerRename", N_("Re_name Layer..."),
2121 N_("Rename the current layer"), "rename_layer"),
2122 new LayerVerb(SP_VERB_LAYER_NEXT, "LayerNext", N_("Switch to Layer Abov_e"),
2123 N_("Switch to the layer above the current"), "switch_to_layer_above"),
2124 new LayerVerb(SP_VERB_LAYER_PREV, "LayerPrev", N_("Switch to Layer Belo_w"),
2125 N_("Switch to the layer below the current"), "switch_to_layer_below"),
2126 new LayerVerb(SP_VERB_LAYER_MOVE_TO_NEXT, "LayerMoveToNext", N_("Move Selection to Layer Abo_ve"),
2127 N_("Move selection to the layer above the current"), "move_selection_above"),
2128 new LayerVerb(SP_VERB_LAYER_MOVE_TO_PREV, "LayerMoveToPrev", N_("Move Selection to Layer Bel_ow"),
2129 N_("Move selection to the layer below the current"), "move_selection_below"),
2130 new LayerVerb(SP_VERB_LAYER_TO_TOP, "LayerToTop", N_("Layer to _Top"),
2131 N_("Raise the current layer to the top"), "layer_to_top"),
2132 new LayerVerb(SP_VERB_LAYER_TO_BOTTOM, "LayerToBottom", N_("Layer to _Bottom"),
2133 N_("Lower the current layer to the bottom"), "layer_to_bottom"),
2134 new LayerVerb(SP_VERB_LAYER_RAISE, "LayerRaise", N_("_Raise Layer"),
2135 N_("Raise the current layer"), "raise_layer"),
2136 new LayerVerb(SP_VERB_LAYER_LOWER, "LayerLower", N_("_Lower Layer"),
2137 N_("Lower the current layer"), "lower_layer"),
2138 new LayerVerb(SP_VERB_LAYER_DELETE, "LayerDelete", N_("_Delete Current Layer"),
2139 N_("Delete the current layer"), "delete_layer"),
2141 /* Object */
2142 new ObjectVerb(SP_VERB_OBJECT_ROTATE_90_CW, "ObjectRotate90", N_("Rotate _90° CW"),
2143 N_("Rotate selection 90° clockwise"), "object_rotate_90_CW"),
2144 new ObjectVerb(SP_VERB_OBJECT_ROTATE_90_CCW, "ObjectRotate90CCW", N_("Rotate 9_0° CCW"),
2145 N_("Rotate selection 90° counter-clockwise"), "object_rotate_90_CCW"),
2146 new ObjectVerb(SP_VERB_OBJECT_FLATTEN, "ObjectRemoveTransform", N_("Remove _Transformations"),
2147 N_("Remove transformations from object"), "object_reset"),
2148 new ObjectVerb(SP_VERB_OBJECT_TO_CURVE, "ObjectToPath", N_("_Object to Path"),
2149 N_("Convert selected object to path"), "object_tocurve"),
2150 new ObjectVerb(SP_VERB_OBJECT_FLOW_TEXT, "ObjectFlowText", N_("_Flow into Frame"),
2151 N_("Put text into a frame (path or shape), creating a flowed text linked to the frame object"), "flow_into_frame"),
2152 new ObjectVerb(SP_VERB_OBJECT_UNFLOW_TEXT, "ObjectUnFlowText", N_("_Unflow"),
2153 N_("Remove text from frame (creates a single-line text object)"), "unflow"),
2154 new ObjectVerb(SP_VERB_OBJECT_FLOWTEXT_TO_TEXT, "ObjectFlowtextToText", N_("_Convert to Text"),
2155 N_("Convert flowed text to regular text object (preserves appearance)"), "convert_to_text"),
2156 new ObjectVerb(SP_VERB_OBJECT_FLIP_HORIZONTAL, "ObjectFlipHorizontally",
2157 N_("Flip _Horizontal"), N_("Flip selected objects horizontally"),
2158 "object_flip_hor"),
2159 new ObjectVerb(SP_VERB_OBJECT_FLIP_VERTICAL, "ObjectFlipVertically",
2160 N_("Flip _Vertical"), N_("Flip selected objects vertically"),
2161 "object_flip_ver"),
2162 new ObjectVerb(SP_VERB_OBJECT_SET_MASK, "ObjectSetMask", N_("_Set"),
2163 N_("Apply mask to selection (using the topmost object as mask)"), NULL),
2164 new ObjectVerb(SP_VERB_OBJECT_UNSET_MASK, "ObjectUnSetMask", N_("_Release"),
2165 N_("Remove mask from selection"), NULL),
2166 new ObjectVerb(SP_VERB_OBJECT_SET_CLIPPATH, "ObjectSetClipPath", N_("_Set"),
2167 N_("Apply clipping path to selection (using the topmost object as clipping path)"), NULL),
2168 new ObjectVerb(SP_VERB_OBJECT_UNSET_CLIPPATH, "ObjectUnSetClipPath", N_("_Release"),
2169 N_("Remove clipping path from selection"), NULL),
2171 /* Tools */
2172 new ContextVerb(SP_VERB_CONTEXT_SELECT, "ToolSelector", N_("Select"),
2173 N_("Select and transform objects"), "draw_select"),
2174 new ContextVerb(SP_VERB_CONTEXT_NODE, "ToolNode", N_("Node Edit"),
2175 N_("Edit path nodes or control handles"), "draw_node"),
2176 new ContextVerb(SP_VERB_CONTEXT_RECT, "ToolRect", N_("Rectangle"),
2177 N_("Create rectangles and squares"), "draw_rect"),
2178 new ContextVerb(SP_VERB_CONTEXT_ARC, "ToolArc", N_("Ellipse"),
2179 N_("Create circles, ellipses, and arcs"), "draw_arc"),
2180 new ContextVerb(SP_VERB_CONTEXT_STAR, "ToolStar", N_("Star"),
2181 N_("Create stars and polygons"), "draw_star"),
2182 new ContextVerb(SP_VERB_CONTEXT_SPIRAL, "ToolSpiral", N_("Spiral"),
2183 N_("Create spirals"), "draw_spiral"),
2184 new ContextVerb(SP_VERB_CONTEXT_PENCIL, "ToolPencil", N_("Pencil"),
2185 N_("Draw freehand lines"), "draw_freehand"),
2186 new ContextVerb(SP_VERB_CONTEXT_PEN, "ToolPen", N_("Pen"),
2187 N_("Draw Bezier curves and straight lines"), "draw_pen"),
2188 new ContextVerb(SP_VERB_CONTEXT_CALLIGRAPHIC, "ToolCalligrphic", N_("Calligraphy"),
2189 N_("Draw calligraphic lines"), "draw_calligraphic"),
2190 new ContextVerb(SP_VERB_CONTEXT_TEXT, "ToolText", N_("Text"),
2191 N_("Create and edit text objects"), "draw_text"),
2192 new ContextVerb(SP_VERB_CONTEXT_GRADIENT, "ToolGradient", N_("Gradient"),
2193 N_("Create and edit gradients"), "draw_gradient"),
2194 new ContextVerb(SP_VERB_CONTEXT_ZOOM, "ToolZoom", N_("Zoom"),
2195 N_("Zoom in or out"), "draw_zoom"),
2196 new ContextVerb(SP_VERB_CONTEXT_DROPPER, "ToolDropper", N_("Dropper"),
2197 N_("Pick averaged colors from image"), "draw_dropper"),
2198 new ContextVerb(SP_VERB_CONTEXT_CONNECTOR, "ToolConnector", N_("Connector"),
2199 N_("Create connectors"), "draw_connector"),
2201 /* Tool prefs */
2202 new ContextVerb(SP_VERB_CONTEXT_SELECT_PREFS, "SelectPrefs", N_("Selector Preferences"),
2203 N_("Open Preferences for the Selector tool"), NULL),
2204 new ContextVerb(SP_VERB_CONTEXT_NODE_PREFS, "NodePrefs", N_("Node Tool Preferences"),
2205 N_("Open Preferences for the Node tool"), NULL),
2206 new ContextVerb(SP_VERB_CONTEXT_RECT_PREFS, "RectPrefs", N_("Rectangle Preferences"),
2207 N_("Open Preferences for the Rectangle tool"), NULL),
2208 new ContextVerb(SP_VERB_CONTEXT_ARC_PREFS, "ArcPrefs", N_("Ellipse Preferences"),
2209 N_("Open Preferences for the Ellipse tool"), NULL),
2210 new ContextVerb(SP_VERB_CONTEXT_STAR_PREFS, "StarPrefs", N_("Star Preferences"),
2211 N_("Open Preferences for the Star tool"), NULL),
2212 new ContextVerb(SP_VERB_CONTEXT_SPIRAL_PREFS, "SpiralPrefs", N_("Spiral Preferences"),
2213 N_("Open Preferences for the Spiral tool"), NULL),
2214 new ContextVerb(SP_VERB_CONTEXT_PENCIL_PREFS, "PencilPrefs", N_("Pencil Preferences"),
2215 N_("Open Preferences for the Pencil tool"), NULL),
2216 new ContextVerb(SP_VERB_CONTEXT_PEN_PREFS, "PenPrefs", N_("Pen Preferences"),
2217 N_("Open Preferences for the Pen tool"), NULL),
2218 new ContextVerb(SP_VERB_CONTEXT_CALLIGRAPHIC_PREFS, "CalligraphicPrefs", N_("Calligraphic Preferences"),
2219 N_("Open Preferences for the Calligraphy tool"), NULL),
2220 new ContextVerb(SP_VERB_CONTEXT_TEXT_PREFS, "TextPrefs", N_("Text Preferences"),
2221 N_("Open Preferences for the Text tool"), NULL),
2222 new ContextVerb(SP_VERB_CONTEXT_GRADIENT_PREFS, "GradientPrefs", N_("Gradient Preferences"),
2223 N_("Open Preferences for the Gradient tool"), NULL),
2224 new ContextVerb(SP_VERB_CONTEXT_ZOOM_PREFS, "ZoomPrefs", N_("Zoom Preferences"),
2225 N_("Open Preferences for the Zoom tool"), NULL),
2226 new ContextVerb(SP_VERB_CONTEXT_DROPPER_PREFS, "DropperPrefs", N_("Dropper Preferences"),
2227 N_("Open Preferences for the Dropper tool"), NULL),
2228 new ContextVerb(SP_VERB_CONTEXT_CONNECTOR_PREFS, "ConnectorPrefs", N_("Connector Preferences"),
2229 N_("Open Preferences for the Connector tool"), NULL),
2231 /* Zoom/View */
2232 new ZoomVerb(SP_VERB_ZOOM_IN, "ZoomIn", N_("Zoom In"), N_("Zoom in"), "zoom_in"),
2233 new ZoomVerb(SP_VERB_ZOOM_OUT, "ZoomOut", N_("Zoom Out"), N_("Zoom out"), "zoom_out"),
2234 new ZoomVerb(SP_VERB_TOGGLE_RULERS, "ToggleRulers", N_("_Rulers"), N_("Show or hide the canvas rulers"), "rulers"),
2235 new ZoomVerb(SP_VERB_TOGGLE_SCROLLBARS, "ToggleScrollbars", N_("Scroll_bars"), N_("Show or hide the canvas scrollbars"), "scrollbars"),
2236 new ZoomVerb(SP_VERB_TOGGLE_GRID, "ToggleGrid", N_("_Grid"), N_("Show or hide the grid"), "grid"),
2237 new ZoomVerb(SP_VERB_TOGGLE_GUIDES, "ToggleGuides", N_("G_uides"), N_("Show or hide guides (drag from a ruler to create a guide)"), "guides"),
2238 new ZoomVerb(SP_VERB_ZOOM_NEXT, "ZoomNext", N_("Nex_t Zoom"), N_("Next zoom (from the history of zooms)"),
2239 "zoom_next"),
2240 new ZoomVerb(SP_VERB_ZOOM_PREV, "ZoomPrev", N_("Pre_vious Zoom"), N_("Previous zoom (from the history of zooms)"),
2241 "zoom_previous"),
2242 new ZoomVerb(SP_VERB_ZOOM_1_1, "Zoom1:0", N_("Zoom 1:_1"), N_("Zoom to 1:1"),
2243 "zoom_1_to_1"),
2244 new ZoomVerb(SP_VERB_ZOOM_1_2, "Zoom1:2", N_("Zoom 1:_2"), N_("Zoom to 1:2"),
2245 "zoom_1_to_2"),
2246 new ZoomVerb(SP_VERB_ZOOM_2_1, "Zoom2:1", N_("_Zoom 2:1"), N_("Zoom to 2:1"),
2247 "zoom_2_to_1"),
2248 #ifdef HAVE_GTK_WINDOW_FULLSCREEN
2249 new ZoomVerb(SP_VERB_FULLSCREEN, "FullScreen", N_("_Fullscreen"), N_("Stretch this document window to full screen"),
2250 "fullscreen"),
2251 #endif /* HAVE_GTK_WINDOW_FULLSCREEN */
2252 new ZoomVerb(SP_VERB_VIEW_NEW, "ViewNew", N_("Duplic_ate Window"), N_("Open a new window with the same document"),
2253 "view_new"),
2254 new ZoomVerb(SP_VERB_VIEW_NEW_PREVIEW, "ViewNewPreview", N_("_New View Preview"),
2255 N_("New View Preview"), NULL/*"view_new_preview"*/),
2257 new ZoomVerb(SP_VERB_VIEW_MODE_NORMAL, "ViewModeNormal", N_("_Normal"),
2258 N_("Switch to normal display mode"), NULL),
2259 new ZoomVerb(SP_VERB_VIEW_MODE_OUTLINE, "ViewModeOutline", N_("_Outline"),
2260 N_("Switch to outline (wireframe) display mode"), NULL),
2261 new ZoomVerb(SP_VERB_VIEW_MODE_TOGGLE, "ViewModeToggle", N_("_Toggle"),
2262 N_("Toggle between normal and outline display modes"), NULL),
2264 new ZoomVerb(SP_VERB_VIEW_ICON_PREVIEW, "ViewIconPreview", N_("Ico_n Preview..."),
2265 N_("Open a window to preview objects at different icon resolutions"), "view_icon_preview"),
2266 new ZoomVerb(SP_VERB_ZOOM_PAGE, "ZoomPage", N_("_Page"),
2267 N_("Zoom to fit page in window"), "zoom_page"),
2268 new ZoomVerb(SP_VERB_ZOOM_PAGE_WIDTH, "ZoomPageWidth", N_("Page _Width"),
2269 N_("Zoom to fit page width in window"), "zoom_pagewidth"),
2270 new ZoomVerb(SP_VERB_ZOOM_DRAWING, "ZoomDrawing", N_("_Drawing"),
2271 N_("Zoom to fit drawing in window"), "zoom_draw"),
2272 new ZoomVerb(SP_VERB_ZOOM_SELECTION, "ZoomSelection", N_("_Selection"),
2273 N_("Zoom to fit selection in window"), "zoom_select"),
2275 /* Dialogs */
2276 new DialogVerb(SP_VERB_DIALOG_DISPLAY, "DialogPreferences", N_("In_kscape Preferences..."),
2277 N_("Edit global Inkscape preferences"), GTK_STOCK_PREFERENCES ),
2278 new DialogVerb(SP_VERB_DIALOG_NAMEDVIEW, "DialogDocumentProperties", N_("_Document Properties..."),
2279 N_("Edit properties of this document (to be saved with the document)"), GTK_STOCK_PROPERTIES ),
2280 new DialogVerb(SP_VERB_DIALOG_METADATA, "DialogMetadata", N_("Document _Metadata..."),
2281 N_("Edit document metadata (to be saved with the document)"), "document_metadata" ),
2282 new DialogVerb(SP_VERB_DIALOG_FILL_STROKE, "DialogFillStroke", N_("_Fill and Stroke..."),
2283 N_("Edit objects' style, such as color or stroke width"), "fill_and_stroke"),
2284 // TRANSLATORS: "Swatches" means: color samples
2285 new DialogVerb(SP_VERB_DIALOG_SWATCHES, "DialogSwatches", N_("S_watches..."),
2286 N_("Select colors from a swatches palette"), GTK_STOCK_SELECT_COLOR),
2287 new DialogVerb(SP_VERB_DIALOG_TRANSFORM, "DialogTransform", N_("Transfor_m..."),
2288 N_("Precisely control objects' transformations"), "object_trans"),
2289 new DialogVerb(SP_VERB_DIALOG_ALIGN_DISTRIBUTE, "DialogAlignDistribute", N_("_Align and Distribute..."),
2290 N_("Align and distribute objects"), "object_align"),
2291 new DialogVerb(SP_VERB_DIALOG_UNDO_HISTORY, "DialogUndoHistory", N_("Undo _History..."),
2292 N_("Undo History"), "edit_undo_history"),
2293 new DialogVerb(SP_VERB_DIALOG_TEXT, "DialogText", N_("_Text and Font..."),
2294 N_("View and select font family, font size and other text properties"), "object_font"),
2295 new DialogVerb(SP_VERB_DIALOG_XML_EDITOR, "DialogXMLEditor", N_("_XML Editor..."),
2296 N_("View and edit the XML tree of the document"), "xml_editor"),
2297 new DialogVerb(SP_VERB_DIALOG_FIND, "DialogFind", N_("_Find..."),
2298 N_("Find objects in document"), GTK_STOCK_FIND ),
2299 new DialogVerb(SP_VERB_DIALOG_DEBUG, "DialogDebug", N_("_Messages..."),
2300 N_("View debug messages"), "messages"),
2301 new DialogVerb(SP_VERB_DIALOG_SCRIPT, "DialogScript", N_("S_cripts..."),
2302 N_("Run scripts"), "scripts"),
2303 new DialogVerb(SP_VERB_DIALOG_TOGGLE, "DialogsToggle", N_("Show/Hide D_ialogs"),
2304 N_("Show or hide all open dialogs"), "dialog_toggle"),
2305 // TRANSLATORS: "Tile Clones" means: "Create tiled clones"
2306 new DialogVerb(SP_VERB_DIALOG_CLONETILER, "DialogClonetiler", N_("Create Tiled Clones..."),
2307 N_("Create multiple clones of selected object, arranging them into a pattern or scattering"), "edit_create_tiled_clones"),
2308 new DialogVerb(SP_VERB_DIALOG_ITEM, "DialogObjectProperties", N_("_Object Properties..."),
2309 N_("Edit the ID, locked and visible status, and other object properties"), "dialog_item_properties"),
2310 #ifdef WITH_INKBOARD
2311 new DialogVerb(SP_VERB_XMPP_CLIENT, "DialogXmppClient",
2312 N_("_Instant Messaging..."), N_("Jabber Instant Messaging Client"), NULL),
2313 #endif
2314 new DialogVerb(SP_VERB_DIALOG_INPUT, "DialogInput", N_("_Input Devices..."),
2315 N_("Configure extended input devices, such as a graphics tablet"), "input_devices"),
2316 new DialogVerb(SP_VERB_DIALOG_EXTENSIONEDITOR, "org.inkscape.dialogs.extensioneditor", N_("_Extensions..."),
2317 N_("Query information about extensions"), NULL),
2318 new DialogVerb(SP_VERB_DIALOG_LAYERS, "DialogLayers", N_("Layer_s..."),
2319 N_("View Layers"), "layers"),
2321 /* Help */
2322 new HelpVerb(SP_VERB_HELP_KEYS, "HelpKeys", N_("_Keys and Mouse"),
2323 N_("Keys and mouse shortcuts reference"), "help_keys"),
2324 new HelpVerb(SP_VERB_HELP_ABOUT_EXTENSIONS, "HelpAboutExtensions", N_("About E_xtensions"),
2325 N_("Information on Inkscape extensions"), NULL),
2326 new HelpVerb(SP_VERB_HELP_MEMORY, "HelpAboutMemory", N_("About _Memory"),
2327 N_("Memory usage information"), "about_memory"),
2328 new HelpVerb(SP_VERB_HELP_ABOUT, "HelpAbout", N_("_About Inkscape"),
2329 N_("Inkscape version, authors, license"), /*"help_about"*/"inkscape_options"),
2330 //new HelpVerb(SP_VERB_SHOW_LICENSE, "ShowLicense", N_("_License"),
2331 // N_("Distribution terms"), /*"show_license"*/"inkscape_options"),
2333 /* Tutorials */
2334 new TutorialVerb(SP_VERB_TUTORIAL_BASIC, "TutorialsBasic", N_("Inkscape: _Basic"),
2335 N_("Getting started with Inkscape"), NULL/*"tutorial_basic"*/),
2336 new TutorialVerb(SP_VERB_TUTORIAL_SHAPES, "TutorialsShapes", N_("Inkscape: _Shapes"),
2337 N_("Using shape tools to create and edit shapes"), NULL),
2338 new TutorialVerb(SP_VERB_TUTORIAL_ADVANCED, "TutorialsAdvanced", N_("Inkscape: _Advanced"),
2339 N_("Advanced Inkscape topics"), NULL/*"tutorial_advanced"*/),
2340 // TRANSLATORS: "to trace" means "to convert a bitmap to vector graphics" (to vectorize)
2341 new TutorialVerb(SP_VERB_TUTORIAL_TRACING, "TutorialsTracing", N_("Inkscape: T_racing"),
2342 N_("Using bitmap tracing"), NULL/*"tutorial_tracing"*/),
2343 new TutorialVerb(SP_VERB_TUTORIAL_CALLIGRAPHY, "TutorialsCalligraphy", N_("Inkscape: _Calligraphy"),
2344 N_("Using the Calligraphy pen tool"), NULL),
2345 new TutorialVerb(SP_VERB_TUTORIAL_DESIGN, "TutorialsDesign", N_("_Elements of Design"),
2346 N_("Principles of design in the tutorial form"), NULL/*"tutorial_design"*/),
2347 new TutorialVerb(SP_VERB_TUTORIAL_TIPS, "TutorialsTips", N_("_Tips and Tricks"),
2348 N_("Miscellaneous tips and tricks"), NULL/*"tutorial_tips"*/),
2350 /* Effect */
2351 new EffectLastVerb(SP_VERB_EFFECT_LAST, "EffectLast", N_("Previous Effect"),
2352 N_("Repeat the last effect with the same settings"), NULL),
2353 new EffectLastVerb(SP_VERB_EFFECT_LAST_PREF, "EffectLastPref", N_("Previous Effect Settings..."),
2354 N_("Repeat the last effect with new settings"), NULL),
2356 /* Fit Page */
2357 new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_SELECTION, "FitCanvasToSelection", N_("Fit Page to Selection"),
2358 N_("Fit the page to the current selection"), NULL),
2359 new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_DRAWING, "FitCanvasToDrawing", N_("Fit Page to Drawing"),
2360 N_("Fit the page to the drawing"), NULL),
2361 new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING, "FitCanvasToSelectionOrDrawing", N_("Fit Page to Selection or Drawing"),
2362 N_("Fit the page to the current selection or the drawing if there is no selection"), NULL),
2363 /* Footer */
2364 new Verb(SP_VERB_LAST, " '\"invalid id", NULL, NULL, NULL)
2365 };
2368 } /* namespace Inkscape */
2370 /*
2371 Local Variables:
2372 mode:c++
2373 c-file-style:"stroustrup"
2374 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
2375 indent-tabs-mode:nil
2376 fill-column:99
2377 End:
2378 */
2379 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :