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