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