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;
849 SPEventContext *ec = dt->event_context;
851 switch (reinterpret_cast<std::size_t>(data)) {
852 case SP_VERB_EDIT_UNDO:
853 sp_undo(dt, sp_desktop_document(dt));
854 break;
855 case SP_VERB_EDIT_REDO:
856 sp_redo(dt, sp_desktop_document(dt));
857 break;
858 case SP_VERB_EDIT_CUT:
859 sp_selection_cut();
860 break;
861 case SP_VERB_EDIT_COPY:
862 sp_selection_copy();
863 break;
864 case SP_VERB_EDIT_PASTE:
865 sp_selection_paste(false);
866 break;
867 case SP_VERB_EDIT_PASTE_STYLE:
868 sp_selection_paste_style();
869 break;
870 case SP_VERB_EDIT_PASTE_SIZE:
871 sp_selection_paste_size(true, true);
872 break;
873 case SP_VERB_EDIT_PASTE_SIZE_X:
874 sp_selection_paste_size(true, false);
875 break;
876 case SP_VERB_EDIT_PASTE_SIZE_Y:
877 sp_selection_paste_size(false, true);
878 break;
879 case SP_VERB_EDIT_PASTE_SIZE_SEPARATELY:
880 sp_selection_paste_size_separately(true, true);
881 break;
882 case SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_X:
883 sp_selection_paste_size_separately(true, false);
884 break;
885 case SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_Y:
886 sp_selection_paste_size_separately(false, true);
887 break;
888 case SP_VERB_EDIT_PASTE_IN_PLACE:
889 sp_selection_paste(true);
890 break;
891 case SP_VERB_EDIT_DELETE:
892 sp_selection_delete();
893 break;
894 case SP_VERB_EDIT_DUPLICATE:
895 sp_selection_duplicate();
896 break;
897 case SP_VERB_EDIT_CLONE:
898 sp_selection_clone();
899 break;
900 case SP_VERB_EDIT_UNLINK_CLONE:
901 sp_selection_unlink();
902 break;
903 case SP_VERB_EDIT_CLONE_ORIGINAL:
904 sp_select_clone_original();
905 break;
906 case SP_VERB_EDIT_TILE:
907 sp_selection_tile();
908 break;
909 case SP_VERB_EDIT_UNTILE:
910 sp_selection_untile();
911 break;
912 case SP_VERB_EDIT_CLEAR_ALL:
913 sp_edit_clear_all();
914 break;
915 case SP_VERB_EDIT_SELECT_ALL:
916 if (tools_isactive(dt, TOOLS_NODES)) {
917 sp_nodepath_select_all_from_subpath(SP_NODE_CONTEXT(ec)->nodepath, false);
918 } else {
919 sp_edit_select_all();
920 }
921 break;
922 case SP_VERB_EDIT_INVERT:
923 if (tools_isactive(dt, TOOLS_NODES)) {
924 sp_nodepath_select_all_from_subpath(SP_NODE_CONTEXT(ec)->nodepath, true);
925 } else {
926 sp_edit_invert();
927 }
928 break;
929 case SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS:
930 if (tools_isactive(dt, TOOLS_NODES)) {
931 sp_nodepath_select_all(SP_NODE_CONTEXT(ec)->nodepath, false);
932 } else {
933 sp_edit_select_all_in_all_layers();
934 }
935 break;
936 case SP_VERB_EDIT_INVERT_IN_ALL_LAYERS:
937 if (tools_isactive(dt, TOOLS_NODES)) {
938 sp_nodepath_select_all(SP_NODE_CONTEXT(ec)->nodepath, true);
939 } else {
940 sp_edit_invert_in_all_layers();
941 }
942 break;
944 case SP_VERB_EDIT_SELECT_NEXT:
945 if (tools_isactive(dt, TOOLS_NODES)) {
946 sp_nodepath_select_next(SP_NODE_CONTEXT(ec)->nodepath);
947 } else {
948 sp_selection_item_next();
949 }
950 break;
951 case SP_VERB_EDIT_SELECT_PREV:
952 if (tools_isactive(dt, TOOLS_NODES)) {
953 sp_nodepath_select_prev(SP_NODE_CONTEXT(ec)->nodepath);
954 } else {
955 sp_selection_item_prev();
956 }
957 break;
959 case SP_VERB_EDIT_DESELECT:
960 if (tools_isactive(dt, TOOLS_NODES)) {
961 sp_nodepath_deselect(SP_NODE_CONTEXT(ec)->nodepath);
962 } else {
963 sp_desktop_selection(dt)->clear();
964 }
965 break;
966 default:
967 break;
968 }
970 } // end of sp_verb_action_edit_perform()
972 /** \brief Decode the verb code and take appropriate action */
973 void
974 SelectionVerb::perform(SPAction *action, void *data, void *pdata)
975 {
976 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
978 if (!dt)
979 return;
981 switch (reinterpret_cast<std::size_t>(data)) {
982 case SP_VERB_SELECTION_TO_FRONT:
983 sp_selection_raise_to_top();
984 break;
985 case SP_VERB_SELECTION_TO_BACK:
986 sp_selection_lower_to_bottom();
987 break;
988 case SP_VERB_SELECTION_RAISE:
989 sp_selection_raise();
990 break;
991 case SP_VERB_SELECTION_LOWER:
992 sp_selection_lower();
993 break;
994 case SP_VERB_SELECTION_GROUP:
995 sp_selection_group();
996 break;
997 case SP_VERB_SELECTION_UNGROUP:
998 sp_selection_ungroup();
999 break;
1001 case SP_VERB_SELECTION_TEXTTOPATH:
1002 text_put_on_path();
1003 break;
1004 case SP_VERB_SELECTION_TEXTFROMPATH:
1005 text_remove_from_path();
1006 break;
1007 case SP_VERB_SELECTION_REMOVE_KERNS:
1008 text_remove_all_kerns();
1009 break;
1011 case SP_VERB_SELECTION_UNION:
1012 sp_selected_path_union();
1013 break;
1014 case SP_VERB_SELECTION_INTERSECT:
1015 sp_selected_path_intersect();
1016 break;
1017 case SP_VERB_SELECTION_DIFF:
1018 sp_selected_path_diff();
1019 break;
1020 case SP_VERB_SELECTION_SYMDIFF:
1021 sp_selected_path_symdiff();
1022 break;
1024 case SP_VERB_SELECTION_CUT:
1025 sp_selected_path_cut();
1026 break;
1027 case SP_VERB_SELECTION_SLICE:
1028 sp_selected_path_slice();
1029 break;
1031 case SP_VERB_SELECTION_OFFSET:
1032 sp_selected_path_offset();
1033 break;
1034 case SP_VERB_SELECTION_OFFSET_SCREEN:
1035 sp_selected_path_offset_screen(1);
1036 break;
1037 case SP_VERB_SELECTION_OFFSET_SCREEN_10:
1038 sp_selected_path_offset_screen(10);
1039 break;
1040 case SP_VERB_SELECTION_INSET:
1041 sp_selected_path_inset();
1042 break;
1043 case SP_VERB_SELECTION_INSET_SCREEN:
1044 sp_selected_path_inset_screen(1);
1045 break;
1046 case SP_VERB_SELECTION_INSET_SCREEN_10:
1047 sp_selected_path_inset_screen(10);
1048 break;
1049 case SP_VERB_SELECTION_DYNAMIC_OFFSET:
1050 sp_selected_path_create_offset_object_zero();
1051 break;
1052 case SP_VERB_SELECTION_LINKED_OFFSET:
1053 sp_selected_path_create_updating_offset_object_zero();
1054 break;
1056 case SP_VERB_SELECTION_OUTLINE:
1057 sp_selected_path_outline();
1058 break;
1059 case SP_VERB_SELECTION_SIMPLIFY:
1060 sp_selected_path_simplify();
1061 break;
1062 case SP_VERB_SELECTION_REVERSE:
1063 sp_selected_path_reverse();
1064 break;
1065 case SP_VERB_SELECTION_TRACE:
1066 dt->_dlg_mgr->showDialog("Trace");
1067 break;
1068 case SP_VERB_SELECTION_CREATE_BITMAP:
1069 sp_selection_create_bitmap_copy();
1070 break;
1072 case SP_VERB_SELECTION_COMBINE:
1073 sp_selected_path_combine();
1074 break;
1075 case SP_VERB_SELECTION_BREAK_APART:
1076 sp_selected_path_break_apart();
1077 break;
1078 case SP_VERB_SELECTION_GRIDTILE:
1079 dt->_dlg_mgr->showDialog("TileDialog");
1080 break;
1081 default:
1082 break;
1083 }
1085 } // end of sp_verb_action_selection_perform()
1087 /** \brief Decode the verb code and take appropriate action */
1088 void
1089 LayerVerb::perform(SPAction *action, void *data, void *pdata)
1090 {
1091 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1092 unsigned int verb = reinterpret_cast<std::size_t>(data);
1094 if ( !dt || !dt->currentLayer() ) {
1095 return;
1096 }
1098 switch (verb) {
1099 case SP_VERB_LAYER_NEW: {
1100 Inkscape::UI::Dialogs::LayerPropertiesDialog::showCreate(dt, dt->currentLayer());
1101 break;
1102 }
1103 case SP_VERB_LAYER_RENAME: {
1104 Inkscape::UI::Dialogs::LayerPropertiesDialog::showRename(dt, dt->currentLayer());
1105 break;
1106 }
1107 case SP_VERB_LAYER_NEXT: {
1108 SPObject *next=Inkscape::next_layer(dt->currentRoot(), dt->currentLayer());
1109 if (next) {
1110 dt->setCurrentLayer(next);
1111 sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_NEXT,
1112 _("Move to next layer"));
1113 dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Moved to next layer."));
1114 } else {
1115 dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Cannot move past last layer."));
1116 }
1117 break;
1118 }
1119 case SP_VERB_LAYER_PREV: {
1120 SPObject *prev=Inkscape::previous_layer(dt->currentRoot(), dt->currentLayer());
1121 if (prev) {
1122 dt->setCurrentLayer(prev);
1123 sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_PREV,
1124 _("Move to previous layer"));
1125 dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Moved to previous layer."));
1126 } else {
1127 dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Cannot move past first layer."));
1128 }
1129 break;
1130 }
1131 case SP_VERB_LAYER_MOVE_TO_NEXT: {
1132 sp_selection_to_next_layer();
1133 break;
1134 }
1135 case SP_VERB_LAYER_MOVE_TO_PREV: {
1136 sp_selection_to_prev_layer();
1137 break;
1138 }
1139 case SP_VERB_LAYER_TO_TOP:
1140 case SP_VERB_LAYER_TO_BOTTOM:
1141 case SP_VERB_LAYER_RAISE:
1142 case SP_VERB_LAYER_LOWER: {
1143 if ( dt->currentLayer() == dt->currentRoot() ) {
1144 dt->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No current layer."));
1145 return;
1146 }
1148 SPItem *layer=SP_ITEM(dt->currentLayer());
1149 g_return_if_fail(layer != NULL);
1151 SPObject *old_pos=SP_OBJECT_NEXT(layer);
1153 switch (verb) {
1154 case SP_VERB_LAYER_TO_TOP:
1155 layer->raiseToTop();
1156 break;
1157 case SP_VERB_LAYER_TO_BOTTOM:
1158 layer->lowerToBottom();
1159 break;
1160 case SP_VERB_LAYER_RAISE:
1161 layer->raiseOne();
1162 break;
1163 case SP_VERB_LAYER_LOWER:
1164 layer->lowerOne();
1165 break;
1166 }
1168 if ( SP_OBJECT_NEXT(layer) != old_pos ) {
1169 char const *message = NULL;
1170 Glib::ustring description = "";
1171 switch (verb) {
1172 case SP_VERB_LAYER_TO_TOP:
1173 message = g_strdup_printf(_("Raised layer <b>%s</b>."), layer->defaultLabel());
1174 description = _("Layer to top");
1175 break;
1176 case SP_VERB_LAYER_RAISE:
1177 message = g_strdup_printf(_("Raised layer <b>%s</b>."), layer->defaultLabel());
1178 description = _("Raise layer");
1179 break;
1180 case SP_VERB_LAYER_TO_BOTTOM:
1181 message = g_strdup_printf(_("Lowered layer <b>%s</b>."), layer->defaultLabel());
1182 description = _("Layer to bottom");
1183 break;
1184 case SP_VERB_LAYER_LOWER:
1185 message = g_strdup_printf(_("Lowered layer <b>%s</b>."), layer->defaultLabel());
1186 description = _("Lower layer");
1187 break;
1188 };
1189 sp_document_done(sp_desktop_document(dt), verb, description);
1190 if (message) {
1191 dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, message);
1192 g_free((void *) message);
1193 }
1194 } else {
1195 dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Cannot move layer any further."));
1196 }
1198 break;
1199 }
1200 case SP_VERB_LAYER_DELETE: {
1201 if ( dt->currentLayer() != dt->currentRoot() ) {
1202 sp_desktop_selection(dt)->clear();
1203 SPObject *old_layer=dt->currentLayer();
1205 sp_object_ref(old_layer, NULL);
1206 SPObject *survivor=Inkscape::next_layer(dt->currentRoot(), old_layer);
1207 if (!survivor) {
1208 survivor = Inkscape::previous_layer(dt->currentRoot(), old_layer);
1209 }
1211 /* Deleting the old layer before switching layers is a hack to trigger the
1212 * listeners of the deletion event (as happens when old_layer is deleted using the
1213 * xml editor). See
1214 * http://sourceforge.net/tracker/index.php?func=detail&aid=1339397&group_id=93438&atid=604306
1215 */
1216 old_layer->deleteObject();
1217 sp_object_unref(old_layer, NULL);
1218 if (survivor) {
1219 dt->setCurrentLayer(survivor);
1220 }
1222 sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_DELETE,
1223 _("Delete layer"));
1225 // TRANSLATORS: this means "The layer has been deleted."
1226 dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Deleted layer."));
1227 } else {
1228 dt->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No current layer."));
1229 }
1230 break;
1231 }
1232 }
1234 return;
1235 } // end of sp_verb_action_layer_perform()
1237 /** \brief Decode the verb code and take appropriate action */
1238 void
1239 ObjectVerb::perform( SPAction *action, void *data, void *pdata )
1240 {
1241 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1242 if (!dt)
1243 return;
1245 SPEventContext *ec = dt->event_context;
1247 Inkscape::Selection *sel = sp_desktop_selection(dt);
1249 if (sel->isEmpty())
1250 return;
1252 NR::Point const center(sel->bounds().midpoint());
1254 switch (reinterpret_cast<std::size_t>(data)) {
1255 case SP_VERB_OBJECT_ROTATE_90_CW:
1256 sp_selection_rotate_90_cw();
1257 break;
1258 case SP_VERB_OBJECT_ROTATE_90_CCW:
1259 sp_selection_rotate_90_ccw();
1260 break;
1261 case SP_VERB_OBJECT_FLATTEN:
1262 sp_selection_remove_transform();
1263 break;
1264 case SP_VERB_OBJECT_TO_CURVE:
1265 sp_selected_path_to_curves();
1266 break;
1267 case SP_VERB_OBJECT_FLOW_TEXT:
1268 text_flow_into_shape();
1269 break;
1270 case SP_VERB_OBJECT_UNFLOW_TEXT:
1271 text_unflow();
1272 break;
1273 case SP_VERB_OBJECT_FLOWTEXT_TO_TEXT:
1274 SPFlowtext::convert_to_text();
1275 break;
1276 case SP_VERB_OBJECT_FLIP_HORIZONTAL:
1277 if (tools_isactive(dt, TOOLS_NODES)) {
1278 sp_nodepath_flip(SP_NODE_CONTEXT(ec)->nodepath, NR::X);
1279 } else {
1280 sp_selection_scale_relative(sel, center, NR::scale(-1.0, 1.0));
1281 }
1282 sp_document_done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_HORIZONTAL,
1283 _("Flip horizontally"));
1284 break;
1285 case SP_VERB_OBJECT_FLIP_VERTICAL:
1286 if (tools_isactive(dt, TOOLS_NODES)) {
1287 sp_nodepath_flip(SP_NODE_CONTEXT(ec)->nodepath, NR::Y);
1288 } else {
1289 sp_selection_scale_relative(sel, center, NR::scale(1.0, -1.0));
1290 }
1291 sp_document_done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_VERTICAL,
1292 _("Flip vertically"));
1293 break;
1294 case SP_VERB_OBJECT_SET_MASK:
1295 sp_selection_set_mask(false, false);
1296 break;
1297 case SP_VERB_OBJECT_UNSET_MASK:
1298 sp_selection_unset_mask(false);
1299 break;
1300 case SP_VERB_OBJECT_SET_CLIPPATH:
1301 sp_selection_set_mask(true, false);
1302 break;
1303 case SP_VERB_OBJECT_UNSET_CLIPPATH:
1304 sp_selection_unset_mask(true);
1305 break;
1306 default:
1307 break;
1308 }
1310 } // end of sp_verb_action_object_perform()
1312 /** \brief Decode the verb code and take appropriate action */
1313 void
1314 ContextVerb::perform(SPAction *action, void *data, void *pdata)
1315 {
1316 SPDesktop *dt;
1317 sp_verb_t verb;
1318 int vidx;
1320 dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1322 if (!dt)
1323 return;
1325 verb = (sp_verb_t)GPOINTER_TO_INT((gpointer)data);
1327 /** \todo !!! hopefully this can go away soon and actions can look after
1328 * themselves
1329 */
1330 for (vidx = SP_VERB_CONTEXT_SELECT; vidx <= SP_VERB_CONTEXT_DROPPER_PREFS; vidx++)
1331 {
1332 SPAction *tool_action= get((sp_verb_t)vidx)->get_action(dt);
1333 if (tool_action) {
1334 sp_action_set_active(tool_action, vidx == (int)verb);
1335 }
1336 }
1338 switch (verb) {
1339 case SP_VERB_CONTEXT_SELECT:
1340 tools_switch_current(TOOLS_SELECT);
1341 break;
1342 case SP_VERB_CONTEXT_NODE:
1343 tools_switch_current(TOOLS_NODES);
1344 break;
1345 case SP_VERB_CONTEXT_RECT:
1346 tools_switch_current(TOOLS_SHAPES_RECT);
1347 break;
1348 case SP_VERB_CONTEXT_ARC:
1349 tools_switch_current(TOOLS_SHAPES_ARC);
1350 break;
1351 case SP_VERB_CONTEXT_STAR:
1352 tools_switch_current(TOOLS_SHAPES_STAR);
1353 break;
1354 case SP_VERB_CONTEXT_SPIRAL:
1355 tools_switch_current(TOOLS_SHAPES_SPIRAL);
1356 break;
1357 case SP_VERB_CONTEXT_PENCIL:
1358 tools_switch_current(TOOLS_FREEHAND_PENCIL);
1359 break;
1360 case SP_VERB_CONTEXT_PEN:
1361 tools_switch_current(TOOLS_FREEHAND_PEN);
1362 break;
1363 case SP_VERB_CONTEXT_CALLIGRAPHIC:
1364 tools_switch_current(TOOLS_CALLIGRAPHIC);
1365 break;
1366 case SP_VERB_CONTEXT_TEXT:
1367 tools_switch_current(TOOLS_TEXT);
1368 break;
1369 case SP_VERB_CONTEXT_GRADIENT:
1370 tools_switch_current(TOOLS_GRADIENT);
1371 break;
1372 case SP_VERB_CONTEXT_ZOOM:
1373 tools_switch_current(TOOLS_ZOOM);
1374 break;
1375 case SP_VERB_CONTEXT_DROPPER:
1376 tools_switch_current(TOOLS_DROPPER);
1377 break;
1378 case SP_VERB_CONTEXT_CONNECTOR:
1379 tools_switch_current (TOOLS_CONNECTOR);
1380 break;
1382 case SP_VERB_CONTEXT_SELECT_PREFS:
1383 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SELECTOR);
1384 dt->_dlg_mgr->showDialog("InkscapePreferences");
1385 break;
1386 case SP_VERB_CONTEXT_NODE_PREFS:
1387 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_NODE);
1388 dt->_dlg_mgr->showDialog("InkscapePreferences");
1389 break;
1390 case SP_VERB_CONTEXT_RECT_PREFS:
1391 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SHAPES_RECT);
1392 dt->_dlg_mgr->showDialog("InkscapePreferences");
1393 break;
1394 case SP_VERB_CONTEXT_ARC_PREFS:
1395 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SHAPES_ELLIPSE);
1396 dt->_dlg_mgr->showDialog("InkscapePreferences");
1397 break;
1398 case SP_VERB_CONTEXT_STAR_PREFS:
1399 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SHAPES_STAR);
1400 dt->_dlg_mgr->showDialog("InkscapePreferences");
1401 break;
1402 case SP_VERB_CONTEXT_SPIRAL_PREFS:
1403 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SHAPES_SPIRAL);
1404 dt->_dlg_mgr->showDialog("InkscapePreferences");
1405 break;
1406 case SP_VERB_CONTEXT_PENCIL_PREFS:
1407 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_PENCIL);
1408 dt->_dlg_mgr->showDialog("InkscapePreferences");
1409 break;
1410 case SP_VERB_CONTEXT_PEN_PREFS:
1411 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_PEN);
1412 dt->_dlg_mgr->showDialog("InkscapePreferences");
1413 break;
1414 case SP_VERB_CONTEXT_CALLIGRAPHIC_PREFS:
1415 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_CALLIGRAPHY);
1416 dt->_dlg_mgr->showDialog("InkscapePreferences");
1417 break;
1418 case SP_VERB_CONTEXT_TEXT_PREFS:
1419 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_TEXT);
1420 dt->_dlg_mgr->showDialog("InkscapePreferences");
1421 break;
1422 case SP_VERB_CONTEXT_GRADIENT_PREFS:
1423 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_GRADIENT);
1424 dt->_dlg_mgr->showDialog("InkscapePreferences");
1425 break;
1426 case SP_VERB_CONTEXT_ZOOM_PREFS:
1427 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_ZOOM);
1428 dt->_dlg_mgr->showDialog("InkscapePreferences");
1429 break;
1430 case SP_VERB_CONTEXT_DROPPER_PREFS:
1431 prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_DROPPER);
1432 dt->_dlg_mgr->showDialog("InkscapePreferences");
1433 break;
1434 case SP_VERB_CONTEXT_CONNECTOR_PREFS:
1435 prefs_set_int_attribute ("dialogs.preferences", "page", PREFS_PAGE_TOOLS_CONNECTOR);
1436 dt->_dlg_mgr->showDialog("InkscapePreferences");
1437 break;
1439 default:
1440 break;
1441 }
1443 } // end of sp_verb_action_ctx_perform()
1445 /** \brief Decode the verb code and take appropriate action */
1446 void
1447 TextVerb::perform(SPAction *action, void *data, void *pdata)
1448 {
1449 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1450 if (!dt)
1451 return;
1453 SPDocument *doc = sp_desktop_document(dt);
1454 (void)doc;
1455 Inkscape::XML::Node *repr = SP_OBJECT_REPR(dt->namedview);
1456 (void)repr;
1457 }
1459 /** \brief Decode the verb code and take appropriate action */
1460 void
1461 ZoomVerb::perform(SPAction *action, void *data, void *pdata)
1462 {
1463 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1464 if (!dt)
1465 return;
1467 SPDocument *doc = sp_desktop_document(dt);
1469 Inkscape::XML::Node *repr = SP_OBJECT_REPR(dt->namedview);
1471 gdouble zoom_inc =
1472 prefs_get_double_attribute_limited( "options.zoomincrement",
1473 "value", 1.414213562, 1.01, 10 );
1475 switch (GPOINTER_TO_INT(data)) {
1476 case SP_VERB_ZOOM_IN:
1477 {
1478 NR::Rect const d = dt->get_display_area();
1479 dt->zoom_relative( d.midpoint()[NR::X], d.midpoint()[NR::Y], zoom_inc);
1480 break;
1481 }
1482 case SP_VERB_ZOOM_OUT:
1483 {
1484 NR::Rect const d = dt->get_display_area();
1485 dt->zoom_relative( d.midpoint()[NR::X], d.midpoint()[NR::Y], 1 / zoom_inc );
1486 break;
1487 }
1488 case SP_VERB_ZOOM_1_1:
1489 {
1490 NR::Rect const d = dt->get_display_area();
1491 dt->zoom_absolute( d.midpoint()[NR::X], d.midpoint()[NR::Y], 1.0 );
1492 break;
1493 }
1494 case SP_VERB_ZOOM_1_2:
1495 {
1496 NR::Rect const d = dt->get_display_area();
1497 dt->zoom_absolute( d.midpoint()[NR::X], d.midpoint()[NR::Y], 0.5);
1498 break;
1499 }
1500 case SP_VERB_ZOOM_2_1:
1501 {
1502 NR::Rect const d = dt->get_display_area();
1503 dt->zoom_absolute( d.midpoint()[NR::X], d.midpoint()[NR::Y], 2.0 );
1504 break;
1505 }
1506 case SP_VERB_ZOOM_PAGE:
1507 dt->zoom_page();
1508 break;
1509 case SP_VERB_ZOOM_PAGE_WIDTH:
1510 dt->zoom_page_width();
1511 break;
1512 case SP_VERB_ZOOM_DRAWING:
1513 dt->zoom_drawing();
1514 break;
1515 case SP_VERB_ZOOM_SELECTION:
1516 dt->zoom_selection();
1517 break;
1518 case SP_VERB_ZOOM_NEXT:
1519 dt->next_zoom();
1520 break;
1521 case SP_VERB_ZOOM_PREV:
1522 dt->prev_zoom();
1523 break;
1524 case SP_VERB_TOGGLE_RULERS:
1525 dt->toggleRulers();
1526 break;
1527 case SP_VERB_TOGGLE_SCROLLBARS:
1528 dt->toggleScrollbars();
1529 break;
1530 case SP_VERB_TOGGLE_GUIDES:
1531 sp_namedview_toggle_guides(doc, repr);
1532 break;
1533 case SP_VERB_TOGGLE_GRID:
1534 sp_namedview_toggle_grid(doc, repr);
1535 break;
1536 #ifdef HAVE_GTK_WINDOW_FULLSCREEN
1537 case SP_VERB_FULLSCREEN:
1538 dt->fullscreen();
1539 break;
1540 #endif /* HAVE_GTK_WINDOW_FULLSCREEN */
1541 case SP_VERB_VIEW_NEW:
1542 sp_ui_new_view();
1543 break;
1544 case SP_VERB_VIEW_NEW_PREVIEW:
1545 sp_ui_new_view_preview();
1546 break;
1547 case SP_VERB_VIEW_MODE_NORMAL:
1548 dt->setDisplayModeNormal();
1549 break;
1550 case SP_VERB_VIEW_MODE_OUTLINE:
1551 dt->setDisplayModeOutline();
1552 break;
1553 case SP_VERB_VIEW_MODE_TOGGLE:
1554 dt->displayModeToggle();
1555 break;
1556 case SP_VERB_VIEW_ICON_PREVIEW:
1557 show_panel( Inkscape::UI::Dialogs::IconPreviewPanel::getInstance(), "dialogs.iconpreview", SP_VERB_VIEW_ICON_PREVIEW );
1558 break;
1559 default:
1560 break;
1561 }
1563 dt->updateNow();
1565 } // end of sp_verb_action_zoom_perform()
1567 /** \brief Decode the verb code and take appropriate action */
1568 void
1569 DialogVerb::perform(SPAction *action, void *data, void *pdata)
1570 {
1571 if (reinterpret_cast<std::size_t>(data) != SP_VERB_DIALOG_TOGGLE) {
1572 // unhide all when opening a new dialog
1573 inkscape_dialogs_unhide();
1574 }
1576 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1577 g_assert(dt->_dlg_mgr != NULL);
1579 switch (reinterpret_cast<std::size_t>(data)) {
1580 case SP_VERB_DIALOG_DISPLAY:
1581 //sp_display_dialog();
1582 dt->_dlg_mgr->showDialog("InkscapePreferences");
1583 break;
1584 case SP_VERB_DIALOG_METADATA:
1585 // sp_desktop_dialog();
1586 dt->_dlg_mgr->showDialog("DocumentMetadata");
1587 break;
1588 case SP_VERB_DIALOG_NAMEDVIEW:
1589 // sp_desktop_dialog();
1590 dt->_dlg_mgr->showDialog("DocumentProperties");
1591 break;
1592 case SP_VERB_DIALOG_FILL_STROKE:
1593 sp_object_properties_dialog();
1594 break;
1595 case SP_VERB_DIALOG_SWATCHES:
1596 show_panel( Inkscape::UI::Dialogs::SwatchesPanel::getInstance(), "dialogs.swatches", SP_VERB_DIALOG_SWATCHES);
1597 break;
1598 case SP_VERB_DIALOG_TRANSFORM:
1599 dt->_dlg_mgr->showDialog("Transformation");
1600 break;
1601 case SP_VERB_DIALOG_ALIGN_DISTRIBUTE:
1602 dt->_dlg_mgr->showDialog("AlignAndDistribute");
1603 break;
1604 case SP_VERB_DIALOG_TEXT:
1605 sp_text_edit_dialog();
1606 break;
1607 case SP_VERB_DIALOG_XML_EDITOR:
1608 sp_xml_tree_dialog();
1609 break;
1610 case SP_VERB_DIALOG_FIND:
1611 sp_find_dialog();
1612 break;
1613 case SP_VERB_DIALOG_DEBUG:
1614 dt->_dlg_mgr->showDialog("Messages");
1615 break;
1616 case SP_VERB_DIALOG_SCRIPT:
1617 dt->_dlg_mgr->showDialog("Script");
1618 break;
1619 case SP_VERB_DIALOG_UNDO_HISTORY:
1620 dt->_dlg_mgr->showDialog("UndoHistory");
1621 break;
1622 case SP_VERB_DIALOG_TOGGLE:
1623 inkscape_dialogs_toggle();
1624 break;
1625 case SP_VERB_DIALOG_CLONETILER:
1626 clonetiler_dialog();
1627 break;
1628 case SP_VERB_DIALOG_ITEM:
1629 sp_item_dialog();
1630 break;
1631 #ifdef WITH_INKBOARD
1632 case SP_VERB_XMPP_CLIENT:
1633 {
1634 Inkscape::Whiteboard::SessionManager::showClient();
1635 break;
1636 }
1637 #endif
1638 case SP_VERB_DIALOG_INPUT:
1639 sp_input_dialog();
1640 break;
1641 case SP_VERB_DIALOG_EXTENSIONEDITOR:
1642 dt->_dlg_mgr->showDialog("ExtensionEditor");
1643 break;
1644 case SP_VERB_DIALOG_LAYERS:
1645 show_panel( Inkscape::UI::Dialogs::LayersPanel::getInstance(), "dialogs.layers", SP_VERB_DIALOG_LAYERS );
1646 break;
1647 default:
1648 break;
1649 }
1650 } // end of sp_verb_action_dialog_perform()
1652 /** \brief Decode the verb code and take appropriate action */
1653 void
1654 HelpVerb::perform(SPAction *action, void *data, void *pdata)
1655 {
1656 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1657 g_assert(dt->_dlg_mgr != NULL);
1659 switch (reinterpret_cast<std::size_t>(data)) {
1660 case SP_VERB_HELP_KEYS:
1661 /* TRANSLATORS: If you have translated the keys.svg file to your language, then
1662 translate this string as "keys.LANG.svg" (where LANG is your language code);
1663 otherwise leave as "keys.svg". */
1664 sp_help_open_screen(_("keys.svg"));
1665 break;
1666 case SP_VERB_HELP_ABOUT:
1667 sp_help_about();
1668 break;
1669 case SP_VERB_HELP_ABOUT_EXTENSIONS: {
1670 Inkscape::UI::Dialogs::ExtensionsPanel *panel = new Inkscape::UI::Dialogs::ExtensionsPanel();
1671 panel->set_full(true);
1672 show_panel( *panel, "dialogs.aboutextensions", SP_VERB_HELP_ABOUT_EXTENSIONS );
1673 break;
1674 }
1676 /*
1677 case SP_VERB_SHOW_LICENSE:
1678 // TRANSLATORS: See "tutorial-basic.svg" comment.
1679 sp_help_open_tutorial(NULL, (gpointer) _("gpl-2.svg"));
1680 break;
1681 */
1683 case SP_VERB_HELP_MEMORY:
1684 dt->_dlg_mgr->showDialog("Memory");
1685 break;
1686 default:
1687 break;
1688 }
1689 } // end of sp_verb_action_help_perform()
1691 /** \brief Decode the verb code and take appropriate action */
1692 void
1693 TutorialVerb::perform(SPAction *action, void *data, void *pdata)
1694 {
1695 switch (reinterpret_cast<std::size_t>(data)) {
1696 case SP_VERB_TUTORIAL_BASIC:
1697 /* TRANSLATORS: If you have translated the tutorial-basic.svg file to your language,
1698 then translate this string as "tutorial-basic.LANG.svg" (where LANG is your language
1699 code); otherwise leave as "tutorial-basic.svg". */
1700 sp_help_open_tutorial(NULL, (gpointer)_("tutorial-basic.svg"));
1701 break;
1702 case SP_VERB_TUTORIAL_SHAPES:
1703 // TRANSLATORS: See "tutorial-basic.svg" comment.
1704 sp_help_open_tutorial(NULL, (gpointer)_("tutorial-shapes.svg"));
1705 break;
1706 case SP_VERB_TUTORIAL_ADVANCED:
1707 // TRANSLATORS: See "tutorial-basic.svg" comment.
1708 sp_help_open_tutorial(NULL, (gpointer)_("tutorial-advanced.svg"));
1709 break;
1710 case SP_VERB_TUTORIAL_TRACING:
1711 // TRANSLATORS: See "tutorial-basic.svg" comment.
1712 sp_help_open_tutorial(NULL, (gpointer)_("tutorial-tracing.svg"));
1713 break;
1714 case SP_VERB_TUTORIAL_CALLIGRAPHY:
1715 // TRANSLATORS: See "tutorial-basic.svg" comment.
1716 sp_help_open_tutorial(NULL, (gpointer)_("tutorial-calligraphy.svg"));
1717 break;
1718 case SP_VERB_TUTORIAL_DESIGN:
1719 // TRANSLATORS: See "tutorial-basic.svg" comment.
1720 sp_help_open_tutorial(NULL, (gpointer)_("tutorial-elements.svg"));
1721 break;
1722 case SP_VERB_TUTORIAL_TIPS:
1723 // TRANSLATORS: See "tutorial-basic.svg" comment.
1724 sp_help_open_tutorial(NULL, (gpointer)_("tutorial-tips.svg"));
1725 break;
1726 default:
1727 break;
1728 }
1729 } // end of sp_verb_action_tutorial_perform()
1732 /**
1733 * Action vector to define functions called if a staticly defined file verb
1734 * is called.
1735 */
1736 SPActionEventVector FileVerb::vector =
1737 {{NULL},FileVerb::perform, NULL, NULL, NULL, NULL};
1738 /**
1739 * Action vector to define functions called if a staticly defined edit verb is
1740 * called.
1741 */
1742 SPActionEventVector EditVerb::vector =
1743 {{NULL},EditVerb::perform, NULL, NULL, NULL, NULL};
1745 /**
1746 * Action vector to define functions called if a staticly defined selection
1747 * verb is called
1748 */
1749 SPActionEventVector SelectionVerb::vector =
1750 {{NULL},SelectionVerb::perform, NULL, NULL, NULL, NULL};
1752 /**
1753 * Action vector to define functions called if a staticly defined layer
1754 * verb is called
1755 */
1756 SPActionEventVector LayerVerb::vector =
1757 {{NULL}, LayerVerb::perform, NULL, NULL, NULL, NULL};
1759 /**
1760 * Action vector to define functions called if a staticly defined object
1761 * editing verb is called
1762 */
1763 SPActionEventVector ObjectVerb::vector =
1764 {{NULL},ObjectVerb::perform, NULL, NULL, NULL, NULL};
1766 /**
1767 * Action vector to define functions called if a staticly defined context
1768 * verb is called
1769 */
1770 SPActionEventVector ContextVerb::vector =
1771 {{NULL},ContextVerb::perform, NULL, NULL, NULL, NULL};
1773 /**
1774 * Action vector to define functions called if a staticly defined zoom verb
1775 * is called
1776 */
1777 SPActionEventVector ZoomVerb::vector =
1778 {{NULL},ZoomVerb::perform, NULL, NULL, NULL, NULL};
1781 /**
1782 * Action vector to define functions called if a staticly defined dialog verb
1783 * is called
1784 */
1785 SPActionEventVector DialogVerb::vector =
1786 {{NULL},DialogVerb::perform, NULL, NULL, NULL, NULL};
1788 /**
1789 * Action vector to define functions called if a staticly defined help verb
1790 * is called
1791 */
1792 SPActionEventVector HelpVerb::vector =
1793 {{NULL},HelpVerb::perform, NULL, NULL, NULL, NULL};
1795 /**
1796 * Action vector to define functions called if a staticly defined tutorial verb
1797 * is called
1798 */
1799 SPActionEventVector TutorialVerb::vector =
1800 {{NULL},TutorialVerb::perform, NULL, NULL, NULL, NULL};
1802 /**
1803 * Action vector to define functions called if a staticly defined tutorial verb
1804 * is called
1805 */
1806 SPActionEventVector TextVerb::vector =
1807 {{NULL},TextVerb::perform, NULL, NULL, NULL, NULL};
1810 /* *********** Effect Last ********** */
1812 /** \brief A class to represent the last effect issued */
1813 class EffectLastVerb : public Verb {
1814 private:
1815 static void perform(SPAction *action, void *mydata, void *otherdata);
1816 static SPActionEventVector vector;
1817 protected:
1818 virtual SPAction *make_action(Inkscape::UI::View::View *view);
1819 public:
1820 /** \brief Use the Verb initializer with the same parameters. */
1821 EffectLastVerb(unsigned int const code,
1822 gchar const *id,
1823 gchar const *name,
1824 gchar const *tip,
1825 gchar const *image) :
1826 Verb(code, id, name, tip, image)
1827 {
1828 set_default_sensitive(false);
1829 }
1830 }; /* EffectLastVerb class */
1832 /**
1833 * The vector to attach in the last effect verb.
1834 */
1835 SPActionEventVector EffectLastVerb::vector =
1836 {{NULL},EffectLastVerb::perform, NULL, NULL, NULL, NULL};
1838 /** \brief Create an action for a \c EffectLastVerb
1839 \param view Which view the action should be created for
1840 \return The built action.
1842 Calls \c make_action_helper with the \c vector.
1843 */
1844 SPAction *
1845 EffectLastVerb::make_action(Inkscape::UI::View::View *view)
1846 {
1847 return make_action_helper(view, &vector);
1848 }
1850 /** \brief Decode the verb code and take appropriate action */
1851 void
1852 EffectLastVerb::perform(SPAction *action, void *data, void *pdata)
1853 {
1854 /* These aren't used, but are here to remind people not to use
1855 the CURRENT_DOCUMENT macros unless they really have to. */
1856 Inkscape::UI::View::View *current_view = sp_action_get_view(action);
1857 // SPDocument *current_document = SP_VIEW_DOCUMENT(current_view);
1858 Inkscape::Extension::Effect *effect = Inkscape::Extension::Effect::get_last_effect();
1860 if (effect == NULL) return;
1861 if (current_view == NULL) return;
1863 switch ((long) data) {
1864 case SP_VERB_EFFECT_LAST_PREF:
1865 if (!effect->prefs(current_view))
1866 return;
1867 /* Note: fall through */
1868 case SP_VERB_EFFECT_LAST:
1869 effect->effect(current_view);
1870 break;
1871 default:
1872 return;
1873 }
1875 return;
1876 }
1877 /* *********** End Effect Last ********** */
1879 /* *********** Fit Canvas ********** */
1881 /** \brief A class to represent the canvas fitting verbs */
1882 class FitCanvasVerb : public Verb {
1883 private:
1884 static void perform(SPAction *action, void *mydata, void *otherdata);
1885 static SPActionEventVector vector;
1886 protected:
1887 virtual SPAction *make_action(Inkscape::UI::View::View *view);
1888 public:
1889 /** \brief Use the Verb initializer with the same parameters. */
1890 FitCanvasVerb(unsigned int const code,
1891 gchar const *id,
1892 gchar const *name,
1893 gchar const *tip,
1894 gchar const *image) :
1895 Verb(code, id, name, tip, image)
1896 {
1897 set_default_sensitive(false);
1898 }
1899 }; /* FitCanvasVerb class */
1901 /**
1902 * The vector to attach in the fit canvas verb.
1903 */
1904 SPActionEventVector FitCanvasVerb::vector =
1905 {{NULL},FitCanvasVerb::perform, NULL, NULL, NULL, NULL};
1907 /** \brief Create an action for a \c FitCanvasVerb
1908 \param view Which view the action should be created for
1909 \return The built action.
1911 Calls \c make_action_helper with the \c vector.
1912 */
1913 SPAction *
1914 FitCanvasVerb::make_action(Inkscape::UI::View::View *view)
1915 {
1916 SPAction *action = make_action_helper(view, &vector);
1917 return action;
1918 }
1920 /** \brief Decode the verb code and take appropriate action */
1921 void
1922 FitCanvasVerb::perform(SPAction *action, void *data, void *pdata)
1923 {
1924 SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
1925 if (!dt) return;
1926 SPDocument *doc = sp_desktop_document(dt);
1927 if (!doc) return;
1929 switch ((long) data) {
1930 case SP_VERB_FIT_CANVAS_TO_SELECTION:
1931 fit_canvas_to_selection(dt);
1932 break;
1933 case SP_VERB_FIT_CANVAS_TO_DRAWING:
1934 fit_canvas_to_drawing(doc);
1935 break;
1936 case SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING:
1937 fit_canvas_to_selection_or_drawing(dt);
1938 break;
1939 default:
1940 return;
1941 }
1943 return;
1944 }
1945 /* *********** End Fit Canvas ********** */
1952 /* these must be in the same order as the SP_VERB_* enum in "verbs.h" */
1953 Verb *Verb::_base_verbs[] = {
1954 /* Header */
1955 new Verb(SP_VERB_INVALID, NULL, NULL, NULL, NULL),
1956 new Verb(SP_VERB_NONE, "None", N_("None"), N_("Does nothing"), NULL),
1958 /* File */
1959 new FileVerb(SP_VERB_FILE_NEW, "FileNew", N_("Default"), N_("Create new document from the default template"),
1960 GTK_STOCK_NEW ),
1961 new FileVerb(SP_VERB_FILE_OPEN, "FileOpen", N_("_Open..."),
1962 N_("Open an existing document"), GTK_STOCK_OPEN ),
1963 new FileVerb(SP_VERB_FILE_REVERT, "FileRevert", N_("Re_vert"),
1964 N_("Revert to the last saved version of document (changes will be lost)"), GTK_STOCK_REVERT_TO_SAVED ),
1965 new FileVerb(SP_VERB_FILE_SAVE, "FileSave", N_("_Save"), N_("Save document"),
1966 GTK_STOCK_SAVE ),
1967 new FileVerb(SP_VERB_FILE_SAVE_AS, "FileSaveAs", N_("Save _As..."),
1968 N_("Save document under a new name"), GTK_STOCK_SAVE_AS ),
1969 new FileVerb(SP_VERB_FILE_SAVE_A_COPY, "FileSaveACopy", N_("Save a Cop_y..."),
1970 N_("Save a copy of the document under a new name"), NULL ),
1971 new FileVerb(SP_VERB_FILE_PRINT, "FilePrint", N_("_Print..."), N_("Print document"),
1972 GTK_STOCK_PRINT ),
1973 // TRANSLATORS: "Vacuum Defs" means "Clean up defs" (so as to remove unused definitions)
1974 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"),
1975 "file_vacuum" ),
1976 new FileVerb(SP_VERB_FILE_PRINT_DIRECT, "FilePrintDirect", N_("Print _Direct"),
1977 N_("Print directly without prompting to a file or pipe"), NULL ),
1978 new FileVerb(SP_VERB_FILE_PRINT_PREVIEW, "FilePrintPreview", N_("Print Previe_w"),
1979 N_("Preview document printout"), GTK_STOCK_PRINT_PREVIEW ),
1980 new FileVerb(SP_VERB_FILE_IMPORT, "FileImport", N_("_Import..."),
1981 N_("Import a bitmap or SVG image into this document"), "file_import"),
1982 new FileVerb(SP_VERB_FILE_EXPORT, "FileExport", N_("_Export Bitmap..."),
1983 N_("Export this document or a selection as a bitmap image"), "file_export"),
1984 new FileVerb(SP_VERB_FILE_NEXT_DESKTOP, "NextWindow", N_("N_ext Window"),
1985 N_("Switch to the next document window"), "window_next"),
1986 new FileVerb(SP_VERB_FILE_PREV_DESKTOP, "PrevWindow", N_("P_revious Window"),
1987 N_("Switch to the previous document window"), "window_previous"),
1988 new FileVerb(SP_VERB_FILE_CLOSE_VIEW, "FileClose", N_("_Close"),
1989 N_("Close this document window"), GTK_STOCK_CLOSE),
1990 new FileVerb(SP_VERB_FILE_QUIT, "FileQuit", N_("_Quit"), N_("Quit Inkscape"), GTK_STOCK_QUIT),
1992 /* Edit */
1993 new EditVerb(SP_VERB_EDIT_UNDO, "EditUndo", N_("_Undo"), N_("Undo last action"),
1994 GTK_STOCK_UNDO),
1995 new EditVerb(SP_VERB_EDIT_REDO, "EditRedo", N_("_Redo"),
1996 N_("Do again the last undone action"), GTK_STOCK_REDO),
1997 new EditVerb(SP_VERB_EDIT_CUT, "EditCut", N_("Cu_t"),
1998 N_("Cut selection to clipboard"), GTK_STOCK_CUT),
1999 new EditVerb(SP_VERB_EDIT_COPY, "EditCopy", N_("_Copy"),
2000 N_("Copy selection to clipboard"), GTK_STOCK_COPY),
2001 new EditVerb(SP_VERB_EDIT_PASTE, "EditPaste", N_("_Paste"),
2002 N_("Paste objects from clipboard to mouse point, or paste text"), GTK_STOCK_PASTE),
2003 new EditVerb(SP_VERB_EDIT_PASTE_STYLE, "EditPasteStyle", N_("Paste _Style"),
2004 N_("Apply the style of the copied object to selection"), "selection_paste_style"),
2005 new EditVerb(SP_VERB_EDIT_PASTE_SIZE, "EditPasteSize", N_("Paste Si_ze"),
2006 N_("Scale selection to match the size of the copied object"), NULL),
2007 new EditVerb(SP_VERB_EDIT_PASTE_SIZE_X, "EditPasteWidth", N_("Paste _Width"),
2008 N_("Scale selection horizontally to match the width of the copied object"), NULL),
2009 new EditVerb(SP_VERB_EDIT_PASTE_SIZE_Y, "EditPasteHeight", N_("Paste _Height"),
2010 N_("Scale selection vertically to match the height of the copied object"), NULL),
2011 new EditVerb(SP_VERB_EDIT_PASTE_SIZE_SEPARATELY, "EditPasteSizeSeparately", N_("Paste Size Separately"),
2012 N_("Scale each selected object to match the size of the copied object"), NULL),
2013 new EditVerb(SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_X, "EditPasteWidthSeparately", N_("Paste Width Separately"),
2014 N_("Scale each selected object horizontally to match the width of the copied object"), NULL),
2015 new EditVerb(SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_Y, "EditPasteHeightSeparately", N_("Paste Height Separately"),
2016 N_("Scale each selected object vertically to match the height of the copied object"), NULL),
2017 new EditVerb(SP_VERB_EDIT_PASTE_IN_PLACE, "EditPasteInPlace", N_("Paste _In Place"),
2018 N_("Paste objects from clipboard to the original location"), "selection_paste_in_place"),
2019 new EditVerb(SP_VERB_EDIT_DELETE, "EditDelete", N_("_Delete"),
2020 N_("Delete selection"), GTK_STOCK_DELETE),
2021 new EditVerb(SP_VERB_EDIT_DUPLICATE, "EditDuplicate", N_("Duplic_ate"),
2022 N_("Duplicate selected objects"), "edit_duplicate"),
2023 new EditVerb(SP_VERB_EDIT_CLONE, "EditClone", N_("Create Clo_ne"),
2024 N_("Create a clone (a copy linked to the original) of selected object"), "edit_clone"),
2025 new EditVerb(SP_VERB_EDIT_UNLINK_CLONE, "EditUnlinkClone", N_("Unlin_k Clone"),
2026 N_("Cut the selected clone's link to its original, turning it into a standalone object"), "edit_unlink_clone"),
2027 new EditVerb(SP_VERB_EDIT_CLONE_ORIGINAL, "EditCloneOriginal", N_("Select _Original"),
2028 N_("Select the object to which the selected clone is linked"), "edit_select_original"),
2029 // TRANSLATORS: Convert selection to a rectangle with tiled pattern fill
2030 new EditVerb(SP_VERB_EDIT_TILE, "ObjectsToPattern", N_("Objects to Patter_n"),
2031 N_("Convert selection to a rectangle with tiled pattern fill"), NULL),
2032 // TRANSLATORS: Extract objects from a tiled pattern fill
2033 new EditVerb(SP_VERB_EDIT_UNTILE, "ObjectsFromPattern", N_("Pattern to _Objects"),
2034 N_("Extract objects from a tiled pattern fill"), NULL),
2035 new EditVerb(SP_VERB_EDIT_CLEAR_ALL, "EditClearAll", N_("Clea_r All"),
2036 N_("Delete all objects from document"), NULL),
2037 new EditVerb(SP_VERB_EDIT_SELECT_ALL, "EditSelectAll", N_("Select Al_l"),
2038 N_("Select all objects or all nodes"), "selection_select_all"),
2039 new EditVerb(SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS, "EditSelectAllInAllLayers", N_("Select All in All La_yers"),
2040 N_("Select all objects in all visible and unlocked layers"), "selection_select_all_in_all_layers"),
2041 new EditVerb(SP_VERB_EDIT_INVERT, "EditInvert", N_("In_vert Selection"),
2042 N_("Invert selection (unselect what is selected and select everything else)"), "selection_invert"),
2043 new EditVerb(SP_VERB_EDIT_INVERT_IN_ALL_LAYERS, "EditInvertInAllLayers", N_("Invert in All Layers"),
2044 N_("Invert selection in all visible and unlocked layers"), NULL),
2045 new EditVerb(SP_VERB_EDIT_SELECT_NEXT, "EditSelectNext", N_("Select Next"),
2046 N_("Select next object or node"), NULL),
2047 new EditVerb(SP_VERB_EDIT_SELECT_PREV, "EditSelectPrev", N_("Select Previous"),
2048 N_("Select previous object or node"), NULL),
2049 new EditVerb(SP_VERB_EDIT_DESELECT, "EditDeselect", N_("D_eselect"),
2050 N_("Deselect any selected objects or nodes"), "selection_deselect"),
2052 /* Selection */
2053 new SelectionVerb(SP_VERB_SELECTION_TO_FRONT, "SelectionToFront", N_("Raise to _Top"),
2054 N_("Raise selection to top"), "selection_top"),
2055 new SelectionVerb(SP_VERB_SELECTION_TO_BACK, "SelectionToBack", N_("Lower to _Bottom"),
2056 N_("Lower selection to bottom"), "selection_bot"),
2057 new SelectionVerb(SP_VERB_SELECTION_RAISE, "SelectionRaise", N_("_Raise"),
2058 N_("Raise selection one step"), "selection_up"),
2059 new SelectionVerb(SP_VERB_SELECTION_LOWER, "SelectionLower", N_("_Lower"),
2060 N_("Lower selection one step"), "selection_down"),
2061 new SelectionVerb(SP_VERB_SELECTION_GROUP, "SelectionGroup", N_("_Group"),
2062 N_("Group selected objects"), "selection_group"),
2063 new SelectionVerb(SP_VERB_SELECTION_UNGROUP, "SelectionUnGroup", N_("_Ungroup"),
2064 N_("Ungroup selected groups"), "selection_ungroup"),
2066 new SelectionVerb(SP_VERB_SELECTION_TEXTTOPATH, "SelectionTextToPath", N_("_Put on Path"),
2067 N_("Put text on path"), "put_on_path"),
2068 new SelectionVerb(SP_VERB_SELECTION_TEXTFROMPATH, "SelectionTextFromPath", N_("_Remove from Path"),
2069 N_("Remove text from path"), "remove_from_path"),
2070 new SelectionVerb(SP_VERB_SELECTION_REMOVE_KERNS, "SelectionTextRemoveKerns", N_("Remove Manual _Kerns"),
2071 // TRANSLATORS: "glyph": An image used in the visual representation of characters;
2072 // roughly speaking, how a character looks. A font is a set of glyphs.
2073 N_("Remove all manual kerns and glyph rotations from a text object"), "remove_manual_kerns"),
2075 new SelectionVerb(SP_VERB_SELECTION_UNION, "SelectionUnion", N_("_Union"),
2076 N_("Create union of selected paths"), "union"),
2077 new SelectionVerb(SP_VERB_SELECTION_INTERSECT, "SelectionIntersect", N_("_Intersection"),
2078 N_("Create intersection of selected paths"), "intersection"),
2079 new SelectionVerb(SP_VERB_SELECTION_DIFF, "SelectionDiff", N_("_Difference"),
2080 N_("Create difference of selected paths (bottom minus top)"), "difference"),
2081 new SelectionVerb(SP_VERB_SELECTION_SYMDIFF, "SelectionSymDiff", N_("E_xclusion"),
2082 N_("Create exclusive OR of selected paths (those parts that belong to only one path)"), "exclusion"),
2083 new SelectionVerb(SP_VERB_SELECTION_CUT, "SelectionDivide", N_("Di_vision"),
2084 N_("Cut the bottom path into pieces"), "division"),
2085 // TRANSLATORS: "to cut a path" is not the same as "to break a path apart" - see the
2086 // Advanced tutorial for more info
2087 new SelectionVerb(SP_VERB_SELECTION_SLICE, "SelectionCutPath", N_("Cut _Path"),
2088 N_("Cut the bottom path's stroke into pieces, removing fill"), "cut_path"),
2089 // TRANSLATORS: "outset": expand a shape by offsetting the object's path,
2090 // i.e. by displacing it perpendicular to the path in each point.
2091 // See also the Advanced Tutorial for explanation.
2092 new SelectionVerb(SP_VERB_SELECTION_OFFSET, "SelectionOffset", N_("Outs_et"),
2093 N_("Outset selected paths"), "outset_path"),
2094 new SelectionVerb(SP_VERB_SELECTION_OFFSET_SCREEN, "SelectionOffsetScreen",
2095 N_("O_utset Path by 1 px"),
2096 N_("Outset selected paths by 1 px"), NULL),
2097 new SelectionVerb(SP_VERB_SELECTION_OFFSET_SCREEN_10, "SelectionOffsetScreen10",
2098 N_("O_utset Path by 10 px"),
2099 N_("Outset selected paths by 10 px"), NULL),
2100 // TRANSLATORS: "inset": contract a shape by offsetting the object's path,
2101 // i.e. by displacing it perpendicular to the path in each point.
2102 // See also the Advanced Tutorial for explanation.
2103 new SelectionVerb(SP_VERB_SELECTION_INSET, "SelectionInset", N_("I_nset"),
2104 N_("Inset selected paths"), "inset_path"),
2105 new SelectionVerb(SP_VERB_SELECTION_INSET_SCREEN, "SelectionInsetScreen",
2106 N_("I_nset Path by 1 px"),
2107 N_("Inset selected paths by 1 px"), NULL),
2108 new SelectionVerb(SP_VERB_SELECTION_INSET_SCREEN_10, "SelectionInsetScreen10",
2109 N_("I_nset Path by 10 px"),
2110 N_("Inset selected paths by 10 px"), NULL),
2111 new SelectionVerb(SP_VERB_SELECTION_DYNAMIC_OFFSET, "SelectionDynOffset",
2112 N_("D_ynamic Offset"), N_("Create a dynamic offset object"), "dynamic_offset"),
2113 new SelectionVerb(SP_VERB_SELECTION_LINKED_OFFSET, "SelectionLinkedOffset",
2114 N_("_Linked Offset"),
2115 N_("Create a dynamic offset object linked to the original path"),
2116 "linked_offset"),
2117 new SelectionVerb(SP_VERB_SELECTION_OUTLINE, "StrokeToPath", N_("_Stroke to Path"),
2118 N_("Convert selected object's stroke to paths"), "stroke_tocurve"),
2119 new SelectionVerb(SP_VERB_SELECTION_SIMPLIFY, "SelectionSimplify", N_("Si_mplify"),
2120 N_("Simplify selected paths (remove extra nodes)"), "simplify"),
2121 new SelectionVerb(SP_VERB_SELECTION_REVERSE, "SelectionReverse", N_("_Reverse"),
2122 N_("Reverse the direction of selected paths (useful for flipping markers)"), "selection_reverse"),
2123 // TRANSLATORS: "to trace" means "to convert a bitmap to vector graphics" (to vectorize)
2124 new SelectionVerb(SP_VERB_SELECTION_TRACE, "SelectionTrace", N_("_Trace Bitmap..."),
2125 N_("Create one or more paths from a bitmap by tracing it"), "selection_trace"),
2126 new SelectionVerb(SP_VERB_SELECTION_CREATE_BITMAP, "SelectionCreateBitmap", N_("_Make a Bitmap Copy"),
2127 N_("Export selection to a bitmap and insert it into document"), "selection_bitmap" ),
2128 new SelectionVerb(SP_VERB_SELECTION_COMBINE, "SelectionCombine", N_("_Combine"),
2129 N_("Combine several paths into one"), "selection_combine"),
2130 // TRANSLATORS: "to cut a path" is not the same as "to break a path apart" - see the
2131 // Advanced tutorial for more info
2132 new SelectionVerb(SP_VERB_SELECTION_BREAK_APART, "SelectionBreakApart", N_("Break _Apart"),
2133 N_("Break selected paths into subpaths"), "selection_break"),
2134 new SelectionVerb(SP_VERB_SELECTION_GRIDTILE, "DialogGridArrange", N_("Gri_d Arrange..."),
2135 N_("Arrange selected objects in a grid pattern"), "grid_arrange"),
2136 /* Layer */
2137 new LayerVerb(SP_VERB_LAYER_NEW, "LayerNew", N_("_Add Layer..."),
2138 N_("Create a new layer"), "new_layer"),
2139 new LayerVerb(SP_VERB_LAYER_RENAME, "LayerRename", N_("Re_name Layer..."),
2140 N_("Rename the current layer"), "rename_layer"),
2141 new LayerVerb(SP_VERB_LAYER_NEXT, "LayerNext", N_("Switch to Layer Abov_e"),
2142 N_("Switch to the layer above the current"), "switch_to_layer_above"),
2143 new LayerVerb(SP_VERB_LAYER_PREV, "LayerPrev", N_("Switch to Layer Belo_w"),
2144 N_("Switch to the layer below the current"), "switch_to_layer_below"),
2145 new LayerVerb(SP_VERB_LAYER_MOVE_TO_NEXT, "LayerMoveToNext", N_("Move Selection to Layer Abo_ve"),
2146 N_("Move selection to the layer above the current"), "move_selection_above"),
2147 new LayerVerb(SP_VERB_LAYER_MOVE_TO_PREV, "LayerMoveToPrev", N_("Move Selection to Layer Bel_ow"),
2148 N_("Move selection to the layer below the current"), "move_selection_below"),
2149 new LayerVerb(SP_VERB_LAYER_TO_TOP, "LayerToTop", N_("Layer to _Top"),
2150 N_("Raise the current layer to the top"), "layer_to_top"),
2151 new LayerVerb(SP_VERB_LAYER_TO_BOTTOM, "LayerToBottom", N_("Layer to _Bottom"),
2152 N_("Lower the current layer to the bottom"), "layer_to_bottom"),
2153 new LayerVerb(SP_VERB_LAYER_RAISE, "LayerRaise", N_("_Raise Layer"),
2154 N_("Raise the current layer"), "raise_layer"),
2155 new LayerVerb(SP_VERB_LAYER_LOWER, "LayerLower", N_("_Lower Layer"),
2156 N_("Lower the current layer"), "lower_layer"),
2157 new LayerVerb(SP_VERB_LAYER_DELETE, "LayerDelete", N_("_Delete Current Layer"),
2158 N_("Delete the current layer"), "delete_layer"),
2160 /* Object */
2161 new ObjectVerb(SP_VERB_OBJECT_ROTATE_90_CW, "ObjectRotate90", N_("Rotate _90° CW"),
2162 N_("Rotate selection 90° clockwise"), "object_rotate_90_CW"),
2163 new ObjectVerb(SP_VERB_OBJECT_ROTATE_90_CCW, "ObjectRotate90CCW", N_("Rotate 9_0° CCW"),
2164 N_("Rotate selection 90° counter-clockwise"), "object_rotate_90_CCW"),
2165 new ObjectVerb(SP_VERB_OBJECT_FLATTEN, "ObjectRemoveTransform", N_("Remove _Transformations"),
2166 N_("Remove transformations from object"), "object_reset"),
2167 new ObjectVerb(SP_VERB_OBJECT_TO_CURVE, "ObjectToPath", N_("_Object to Path"),
2168 N_("Convert selected object to path"), "object_tocurve"),
2169 new ObjectVerb(SP_VERB_OBJECT_FLOW_TEXT, "ObjectFlowText", N_("_Flow into Frame"),
2170 N_("Put text into a frame (path or shape), creating a flowed text linked to the frame object"), "flow_into_frame"),
2171 new ObjectVerb(SP_VERB_OBJECT_UNFLOW_TEXT, "ObjectUnFlowText", N_("_Unflow"),
2172 N_("Remove text from frame (creates a single-line text object)"), "unflow"),
2173 new ObjectVerb(SP_VERB_OBJECT_FLOWTEXT_TO_TEXT, "ObjectFlowtextToText", N_("_Convert to Text"),
2174 N_("Convert flowed text to regular text object (preserves appearance)"), "convert_to_text"),
2175 new ObjectVerb(SP_VERB_OBJECT_FLIP_HORIZONTAL, "ObjectFlipHorizontally",
2176 N_("Flip _Horizontal"), N_("Flip selected objects horizontally"),
2177 "object_flip_hor"),
2178 new ObjectVerb(SP_VERB_OBJECT_FLIP_VERTICAL, "ObjectFlipVertically",
2179 N_("Flip _Vertical"), N_("Flip selected objects vertically"),
2180 "object_flip_ver"),
2181 new ObjectVerb(SP_VERB_OBJECT_SET_MASK, "ObjectSetMask", N_("_Set"),
2182 N_("Apply mask to selection (using the topmost object as mask)"), NULL),
2183 new ObjectVerb(SP_VERB_OBJECT_UNSET_MASK, "ObjectUnSetMask", N_("_Release"),
2184 N_("Remove mask from selection"), NULL),
2185 new ObjectVerb(SP_VERB_OBJECT_SET_CLIPPATH, "ObjectSetClipPath", N_("_Set"),
2186 N_("Apply clipping path to selection (using the topmost object as clipping path)"), NULL),
2187 new ObjectVerb(SP_VERB_OBJECT_UNSET_CLIPPATH, "ObjectUnSetClipPath", N_("_Release"),
2188 N_("Remove clipping path from selection"), NULL),
2190 /* Tools */
2191 new ContextVerb(SP_VERB_CONTEXT_SELECT, "ToolSelector", N_("Select"),
2192 N_("Select and transform objects"), "draw_select"),
2193 new ContextVerb(SP_VERB_CONTEXT_NODE, "ToolNode", N_("Node Edit"),
2194 N_("Edit path nodes or control handles"), "draw_node"),
2195 new ContextVerb(SP_VERB_CONTEXT_RECT, "ToolRect", N_("Rectangle"),
2196 N_("Create rectangles and squares"), "draw_rect"),
2197 new ContextVerb(SP_VERB_CONTEXT_ARC, "ToolArc", N_("Ellipse"),
2198 N_("Create circles, ellipses, and arcs"), "draw_arc"),
2199 new ContextVerb(SP_VERB_CONTEXT_STAR, "ToolStar", N_("Star"),
2200 N_("Create stars and polygons"), "draw_star"),
2201 new ContextVerb(SP_VERB_CONTEXT_SPIRAL, "ToolSpiral", N_("Spiral"),
2202 N_("Create spirals"), "draw_spiral"),
2203 new ContextVerb(SP_VERB_CONTEXT_PENCIL, "ToolPencil", N_("Pencil"),
2204 N_("Draw freehand lines"), "draw_freehand"),
2205 new ContextVerb(SP_VERB_CONTEXT_PEN, "ToolPen", N_("Pen"),
2206 N_("Draw Bezier curves and straight lines"), "draw_pen"),
2207 new ContextVerb(SP_VERB_CONTEXT_CALLIGRAPHIC, "ToolCalligrphic", N_("Calligraphy"),
2208 N_("Draw calligraphic lines"), "draw_calligraphic"),
2209 new ContextVerb(SP_VERB_CONTEXT_TEXT, "ToolText", N_("Text"),
2210 N_("Create and edit text objects"), "draw_text"),
2211 new ContextVerb(SP_VERB_CONTEXT_GRADIENT, "ToolGradient", N_("Gradient"),
2212 N_("Create and edit gradients"), "draw_gradient"),
2213 new ContextVerb(SP_VERB_CONTEXT_ZOOM, "ToolZoom", N_("Zoom"),
2214 N_("Zoom in or out"), "draw_zoom"),
2215 new ContextVerb(SP_VERB_CONTEXT_DROPPER, "ToolDropper", N_("Dropper"),
2216 N_("Pick averaged colors from image"), "draw_dropper"),
2217 new ContextVerb(SP_VERB_CONTEXT_CONNECTOR, "ToolConnector", N_("Connector"),
2218 N_("Create connectors"), "draw_connector"),
2220 /* Tool prefs */
2221 new ContextVerb(SP_VERB_CONTEXT_SELECT_PREFS, "SelectPrefs", N_("Selector Preferences"),
2222 N_("Open Preferences for the Selector tool"), NULL),
2223 new ContextVerb(SP_VERB_CONTEXT_NODE_PREFS, "NodePrefs", N_("Node Tool Preferences"),
2224 N_("Open Preferences for the Node tool"), NULL),
2225 new ContextVerb(SP_VERB_CONTEXT_RECT_PREFS, "RectPrefs", N_("Rectangle Preferences"),
2226 N_("Open Preferences for the Rectangle tool"), NULL),
2227 new ContextVerb(SP_VERB_CONTEXT_ARC_PREFS, "ArcPrefs", N_("Ellipse Preferences"),
2228 N_("Open Preferences for the Ellipse tool"), NULL),
2229 new ContextVerb(SP_VERB_CONTEXT_STAR_PREFS, "StarPrefs", N_("Star Preferences"),
2230 N_("Open Preferences for the Star tool"), NULL),
2231 new ContextVerb(SP_VERB_CONTEXT_SPIRAL_PREFS, "SpiralPrefs", N_("Spiral Preferences"),
2232 N_("Open Preferences for the Spiral tool"), NULL),
2233 new ContextVerb(SP_VERB_CONTEXT_PENCIL_PREFS, "PencilPrefs", N_("Pencil Preferences"),
2234 N_("Open Preferences for the Pencil tool"), NULL),
2235 new ContextVerb(SP_VERB_CONTEXT_PEN_PREFS, "PenPrefs", N_("Pen Preferences"),
2236 N_("Open Preferences for the Pen tool"), NULL),
2237 new ContextVerb(SP_VERB_CONTEXT_CALLIGRAPHIC_PREFS, "CalligraphicPrefs", N_("Calligraphic Preferences"),
2238 N_("Open Preferences for the Calligraphy tool"), NULL),
2239 new ContextVerb(SP_VERB_CONTEXT_TEXT_PREFS, "TextPrefs", N_("Text Preferences"),
2240 N_("Open Preferences for the Text tool"), NULL),
2241 new ContextVerb(SP_VERB_CONTEXT_GRADIENT_PREFS, "GradientPrefs", N_("Gradient Preferences"),
2242 N_("Open Preferences for the Gradient tool"), NULL),
2243 new ContextVerb(SP_VERB_CONTEXT_ZOOM_PREFS, "ZoomPrefs", N_("Zoom Preferences"),
2244 N_("Open Preferences for the Zoom tool"), NULL),
2245 new ContextVerb(SP_VERB_CONTEXT_DROPPER_PREFS, "DropperPrefs", N_("Dropper Preferences"),
2246 N_("Open Preferences for the Dropper tool"), NULL),
2247 new ContextVerb(SP_VERB_CONTEXT_CONNECTOR_PREFS, "ConnectorPrefs", N_("Connector Preferences"),
2248 N_("Open Preferences for the Connector tool"), NULL),
2250 /* Zoom/View */
2251 new ZoomVerb(SP_VERB_ZOOM_IN, "ZoomIn", N_("Zoom In"), N_("Zoom in"), "zoom_in"),
2252 new ZoomVerb(SP_VERB_ZOOM_OUT, "ZoomOut", N_("Zoom Out"), N_("Zoom out"), "zoom_out"),
2253 new ZoomVerb(SP_VERB_TOGGLE_RULERS, "ToggleRulers", N_("_Rulers"), N_("Show or hide the canvas rulers"), "rulers"),
2254 new ZoomVerb(SP_VERB_TOGGLE_SCROLLBARS, "ToggleScrollbars", N_("Scroll_bars"), N_("Show or hide the canvas scrollbars"), "scrollbars"),
2255 new ZoomVerb(SP_VERB_TOGGLE_GRID, "ToggleGrid", N_("_Grid"), N_("Show or hide the grid"), "grid"),
2256 new ZoomVerb(SP_VERB_TOGGLE_GUIDES, "ToggleGuides", N_("G_uides"), N_("Show or hide guides (drag from a ruler to create a guide)"), "guides"),
2257 new ZoomVerb(SP_VERB_ZOOM_NEXT, "ZoomNext", N_("Nex_t Zoom"), N_("Next zoom (from the history of zooms)"),
2258 "zoom_next"),
2259 new ZoomVerb(SP_VERB_ZOOM_PREV, "ZoomPrev", N_("Pre_vious Zoom"), N_("Previous zoom (from the history of zooms)"),
2260 "zoom_previous"),
2261 new ZoomVerb(SP_VERB_ZOOM_1_1, "Zoom1:0", N_("Zoom 1:_1"), N_("Zoom to 1:1"),
2262 "zoom_1_to_1"),
2263 new ZoomVerb(SP_VERB_ZOOM_1_2, "Zoom1:2", N_("Zoom 1:_2"), N_("Zoom to 1:2"),
2264 "zoom_1_to_2"),
2265 new ZoomVerb(SP_VERB_ZOOM_2_1, "Zoom2:1", N_("_Zoom 2:1"), N_("Zoom to 2:1"),
2266 "zoom_2_to_1"),
2267 #ifdef HAVE_GTK_WINDOW_FULLSCREEN
2268 new ZoomVerb(SP_VERB_FULLSCREEN, "FullScreen", N_("_Fullscreen"), N_("Stretch this document window to full screen"),
2269 "fullscreen"),
2270 #endif /* HAVE_GTK_WINDOW_FULLSCREEN */
2271 new ZoomVerb(SP_VERB_VIEW_NEW, "ViewNew", N_("Duplic_ate Window"), N_("Open a new window with the same document"),
2272 "view_new"),
2273 new ZoomVerb(SP_VERB_VIEW_NEW_PREVIEW, "ViewNewPreview", N_("_New View Preview"),
2274 N_("New View Preview"), NULL/*"view_new_preview"*/),
2276 new ZoomVerb(SP_VERB_VIEW_MODE_NORMAL, "ViewModeNormal", N_("_Normal"),
2277 N_("Switch to normal display mode"), NULL),
2278 new ZoomVerb(SP_VERB_VIEW_MODE_OUTLINE, "ViewModeOutline", N_("_Outline"),
2279 N_("Switch to outline (wireframe) display mode"), NULL),
2280 new ZoomVerb(SP_VERB_VIEW_MODE_TOGGLE, "ViewModeToggle", N_("_Toggle"),
2281 N_("Toggle between normal and outline display modes"), NULL),
2283 new ZoomVerb(SP_VERB_VIEW_ICON_PREVIEW, "ViewIconPreview", N_("Ico_n Preview..."),
2284 N_("Open a window to preview objects at different icon resolutions"), "view_icon_preview"),
2285 new ZoomVerb(SP_VERB_ZOOM_PAGE, "ZoomPage", N_("_Page"),
2286 N_("Zoom to fit page in window"), "zoom_page"),
2287 new ZoomVerb(SP_VERB_ZOOM_PAGE_WIDTH, "ZoomPageWidth", N_("Page _Width"),
2288 N_("Zoom to fit page width in window"), "zoom_pagewidth"),
2289 new ZoomVerb(SP_VERB_ZOOM_DRAWING, "ZoomDrawing", N_("_Drawing"),
2290 N_("Zoom to fit drawing in window"), "zoom_draw"),
2291 new ZoomVerb(SP_VERB_ZOOM_SELECTION, "ZoomSelection", N_("_Selection"),
2292 N_("Zoom to fit selection in window"), "zoom_select"),
2294 /* Dialogs */
2295 new DialogVerb(SP_VERB_DIALOG_DISPLAY, "DialogPreferences", N_("In_kscape Preferences..."),
2296 N_("Edit global Inkscape preferences"), GTK_STOCK_PREFERENCES ),
2297 new DialogVerb(SP_VERB_DIALOG_NAMEDVIEW, "DialogDocumentProperties", N_("_Document Properties..."),
2298 N_("Edit properties of this document (to be saved with the document)"), GTK_STOCK_PROPERTIES ),
2299 new DialogVerb(SP_VERB_DIALOG_METADATA, "DialogMetadata", N_("Document _Metadata..."),
2300 N_("Edit document metadata (to be saved with the document)"), "document_metadata" ),
2301 new DialogVerb(SP_VERB_DIALOG_FILL_STROKE, "DialogFillStroke", N_("_Fill and Stroke..."),
2302 N_("Edit objects' style, such as color or stroke width"), "fill_and_stroke"),
2303 // TRANSLATORS: "Swatches" means: color samples
2304 new DialogVerb(SP_VERB_DIALOG_SWATCHES, "DialogSwatches", N_("S_watches..."),
2305 N_("Select colors from a swatches palette"), GTK_STOCK_SELECT_COLOR),
2306 new DialogVerb(SP_VERB_DIALOG_TRANSFORM, "DialogTransform", N_("Transfor_m..."),
2307 N_("Precisely control objects' transformations"), "object_trans"),
2308 new DialogVerb(SP_VERB_DIALOG_ALIGN_DISTRIBUTE, "DialogAlignDistribute", N_("_Align and Distribute..."),
2309 N_("Align and distribute objects"), "object_align"),
2310 new DialogVerb(SP_VERB_DIALOG_UNDO_HISTORY, "DialogUndoHistory", N_("Undo _History..."),
2311 N_("Undo History"), "edit_undo_history"),
2312 new DialogVerb(SP_VERB_DIALOG_TEXT, "DialogText", N_("_Text and Font..."),
2313 N_("View and select font family, font size and other text properties"), "object_font"),
2314 new DialogVerb(SP_VERB_DIALOG_XML_EDITOR, "DialogXMLEditor", N_("_XML Editor..."),
2315 N_("View and edit the XML tree of the document"), "xml_editor"),
2316 new DialogVerb(SP_VERB_DIALOG_FIND, "DialogFind", N_("_Find..."),
2317 N_("Find objects in document"), GTK_STOCK_FIND ),
2318 new DialogVerb(SP_VERB_DIALOG_DEBUG, "DialogDebug", N_("_Messages..."),
2319 N_("View debug messages"), "messages"),
2320 new DialogVerb(SP_VERB_DIALOG_SCRIPT, "DialogScript", N_("S_cripts..."),
2321 N_("Run scripts"), "scripts"),
2322 new DialogVerb(SP_VERB_DIALOG_TOGGLE, "DialogsToggle", N_("Show/Hide D_ialogs"),
2323 N_("Show or hide all open dialogs"), "dialog_toggle"),
2324 // TRANSLATORS: "Tile Clones" means: "Create tiled clones"
2325 new DialogVerb(SP_VERB_DIALOG_CLONETILER, "DialogClonetiler", N_("Create Tiled Clones..."),
2326 N_("Create multiple clones of selected object, arranging them into a pattern or scattering"), "edit_create_tiled_clones"),
2327 new DialogVerb(SP_VERB_DIALOG_ITEM, "DialogObjectProperties", N_("_Object Properties..."),
2328 N_("Edit the ID, locked and visible status, and other object properties"), "dialog_item_properties"),
2329 #ifdef WITH_INKBOARD
2330 new DialogVerb(SP_VERB_XMPP_CLIENT, "DialogXmppClient",
2331 N_("_Instant Messaging..."), N_("Jabber Instant Messaging Client"), NULL),
2332 #endif
2333 new DialogVerb(SP_VERB_DIALOG_INPUT, "DialogInput", N_("_Input Devices..."),
2334 N_("Configure extended input devices, such as a graphics tablet"), "input_devices"),
2335 new DialogVerb(SP_VERB_DIALOG_EXTENSIONEDITOR, "org.inkscape.dialogs.extensioneditor", N_("_Extensions..."),
2336 N_("Query information about extensions"), NULL),
2337 new DialogVerb(SP_VERB_DIALOG_LAYERS, "DialogLayers", N_("Layer_s..."),
2338 N_("View Layers"), "layers"),
2340 /* Help */
2341 new HelpVerb(SP_VERB_HELP_KEYS, "HelpKeys", N_("_Keys and Mouse"),
2342 N_("Keys and mouse shortcuts reference"), "help_keys"),
2343 new HelpVerb(SP_VERB_HELP_ABOUT_EXTENSIONS, "HelpAboutExtensions", N_("About E_xtensions"),
2344 N_("Information on Inkscape extensions"), NULL),
2345 new HelpVerb(SP_VERB_HELP_MEMORY, "HelpAboutMemory", N_("About _Memory"),
2346 N_("Memory usage information"), "about_memory"),
2347 new HelpVerb(SP_VERB_HELP_ABOUT, "HelpAbout", N_("_About Inkscape"),
2348 N_("Inkscape version, authors, license"), /*"help_about"*/"inkscape_options"),
2349 //new HelpVerb(SP_VERB_SHOW_LICENSE, "ShowLicense", N_("_License"),
2350 // N_("Distribution terms"), /*"show_license"*/"inkscape_options"),
2352 /* Tutorials */
2353 new TutorialVerb(SP_VERB_TUTORIAL_BASIC, "TutorialsBasic", N_("Inkscape: _Basic"),
2354 N_("Getting started with Inkscape"), NULL/*"tutorial_basic"*/),
2355 new TutorialVerb(SP_VERB_TUTORIAL_SHAPES, "TutorialsShapes", N_("Inkscape: _Shapes"),
2356 N_("Using shape tools to create and edit shapes"), NULL),
2357 new TutorialVerb(SP_VERB_TUTORIAL_ADVANCED, "TutorialsAdvanced", N_("Inkscape: _Advanced"),
2358 N_("Advanced Inkscape topics"), NULL/*"tutorial_advanced"*/),
2359 // TRANSLATORS: "to trace" means "to convert a bitmap to vector graphics" (to vectorize)
2360 new TutorialVerb(SP_VERB_TUTORIAL_TRACING, "TutorialsTracing", N_("Inkscape: T_racing"),
2361 N_("Using bitmap tracing"), NULL/*"tutorial_tracing"*/),
2362 new TutorialVerb(SP_VERB_TUTORIAL_CALLIGRAPHY, "TutorialsCalligraphy", N_("Inkscape: _Calligraphy"),
2363 N_("Using the Calligraphy pen tool"), NULL),
2364 new TutorialVerb(SP_VERB_TUTORIAL_DESIGN, "TutorialsDesign", N_("_Elements of Design"),
2365 N_("Principles of design in the tutorial form"), NULL/*"tutorial_design"*/),
2366 new TutorialVerb(SP_VERB_TUTORIAL_TIPS, "TutorialsTips", N_("_Tips and Tricks"),
2367 N_("Miscellaneous tips and tricks"), NULL/*"tutorial_tips"*/),
2369 /* Effect */
2370 new EffectLastVerb(SP_VERB_EFFECT_LAST, "EffectLast", N_("Previous Effect"),
2371 N_("Repeat the last effect with the same settings"), NULL),
2372 new EffectLastVerb(SP_VERB_EFFECT_LAST_PREF, "EffectLastPref", N_("Previous Effect Settings..."),
2373 N_("Repeat the last effect with new settings"), NULL),
2375 /* Fit Page */
2376 new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_SELECTION, "FitCanvasToSelection", N_("Fit Page to Selection"),
2377 N_("Fit the page to the current selection"), NULL),
2378 new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_DRAWING, "FitCanvasToDrawing", N_("Fit Page to Drawing"),
2379 N_("Fit the page to the drawing"), NULL),
2380 new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING, "FitCanvasToSelectionOrDrawing", N_("Fit Page to Selection or Drawing"),
2381 N_("Fit the page to the current selection or the drawing if there is no selection"), NULL),
2382 /* Footer */
2383 new Verb(SP_VERB_LAST, " '\"invalid id", NULL, NULL, NULL)
2384 };
2387 } /* namespace Inkscape */
2389 /*
2390 Local Variables:
2391 mode:c++
2392 c-file-style:"stroustrup"
2393 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
2394 indent-tabs-mode:nil
2395 fill-column:99
2396 End:
2397 */
2398 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :