verbs.cpp revision 2197aaeb5cbd6bb675e264602fc92b2d613be298
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen#define __SP_VERBS_C__
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen/**
e942c741056732f50da2074b36fe59805d370650slive * \file verbs.cpp
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen *
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen * \brief Actions for inkscape
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen *
75569f53579b42dc17cf097015b6b055c01e6875slive * This file implements routines necessary to deal with verbs. A verb
75569f53579b42dc17cf097015b6b055c01e6875slive * is a numeric identifier used to retrieve standard SPActions for particular
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen * views.
c3fcea07965f59723831e23da647a77518285b8eslive */
c3fcea07965f59723831e23da647a77518285b8eslive
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen/*
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen * Authors:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen * Lauris Kaplinski <lauris@kaplinski.com>
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen * Ted Gould <ted@gould.cx>
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen * MenTaLguY <mental@rydia.net>
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen * David Turner <novalis@gnu.org>
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen * bulia byak <buliabyak@users.sf.net>
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen *
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen * This code is in public domain.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
75569f53579b42dc17cf097015b6b055c01e6875slive#include <gtk/gtkstock.h>
75569f53579b42dc17cf097015b6b055c01e6875slive
75569f53579b42dc17cf097015b6b055c01e6875slive#ifdef HAVE_CONFIG_H
75569f53579b42dc17cf097015b6b055c01e6875slive# include "config.h"
75569f53579b42dc17cf097015b6b055c01e6875slive#endif
75569f53579b42dc17cf097015b6b055c01e6875slive
75569f53579b42dc17cf097015b6b055c01e6875slive#include "helper/action.h"
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive#include <gtkmm/messagedialog.h>
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive#include <gtkmm/filechooserdialog.h>
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen#include <gtkmm/stock.h>
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive#include "dialogs/text-edit.h"
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive#include "dialogs/xml-tree.h"
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive#include "dialogs/object-properties.h"
75569f53579b42dc17cf097015b6b055c01e6875slive#include "dialogs/item-properties.h"
75569f53579b42dc17cf097015b6b055c01e6875slive#include "dialogs/find.h"
75569f53579b42dc17cf097015b6b055c01e6875slive#include "dialogs/layer-properties.h"
75569f53579b42dc17cf097015b6b055c01e6875slive#include "dialogs/clonetiler.h"
75569f53579b42dc17cf097015b6b055c01e6875slive#include "dialogs/iconpreview.h"
75569f53579b42dc17cf097015b6b055c01e6875slive#include "dialogs/extensions.h"
f794e11d17dcdae9f5f2944a5bfd06a7ded6a579yoshiki#include "dialogs/swatches.h"
75569f53579b42dc17cf097015b6b055c01e6875slive#include "dialogs/layers-panel.h"
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive#include "dialogs/input.h"
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive#ifdef WITH_INKBOARD
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive#include "jabber_whiteboard/session-manager.h"
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive#endif
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive#include "extension/effect.h"
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive#include "tools-switch.h"
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive#include "inkscape-private.h"
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive#include "file.h"
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive#include "help.h"
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive#include "document.h"
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive#include "desktop.h"
75569f53579b42dc17cf097015b6b055c01e6875slive#include "message-stack.h"
75569f53579b42dc17cf097015b6b055c01e6875slive#include "desktop-handles.h"
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen#include "selection-chemistry.h"
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen#include "path-chemistry.h"
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen#include "text-chemistry.h"
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen#include "ui/dialog/dialog-manager.h"
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen#include "ui/dialog/inkscape-preferences.h"
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen#include "interface.h"
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen#include "prefs-utils.h"
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen#include "splivarot.h"
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen#include "sp-namedview.h"
75569f53579b42dc17cf097015b6b055c01e6875slive#include "sp-flowtext.h"
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen#include "layer-fns.h"
75569f53579b42dc17cf097015b6b055c01e6875slive#include "node-context.h"
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive
75569f53579b42dc17cf097015b6b055c01e6875slive/**
75569f53579b42dc17cf097015b6b055c01e6875slive * \brief Return the name without underscores and ellipsis, for use in dialog
75569f53579b42dc17cf097015b6b055c01e6875slive * titles, etc. Allocated memory must be freed by caller.
75569f53579b42dc17cf097015b6b055c01e6875slive */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowengchar *
c3fcea07965f59723831e23da647a77518285b8eslivesp_action_get_title(SPAction const *action)
c3fcea07965f59723831e23da647a77518285b8eslive{
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen char const *src = action->name;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar *ret = g_new(gchar, strlen(src) + 1);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen unsigned ri = 0;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen for (unsigned si = 0 ; ; si++) {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen int const c = src[si];
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen if ( c != '_' && c != '.' ) {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen ret[ri] = c;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen ri++;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen if (c == '\0') {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen return ret;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen }
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen }
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen }
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen} // end of sp_action_get_title()
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowennamespace Inkscape {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen/// \todo !!!FIXME:: kill this, use DialogManager instead!!!
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenclass PanelDialog : public Inkscape::UI::Dialog::Dialog
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen{
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenpublic:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen PanelDialog(char const *prefs_path, int const verb_num) : Dialog(prefs_path, verb_num) {}
c3fcea07965f59723831e23da647a77518285b8eslive/*
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen virtual Glib::ustring getName() const {return "foo";}
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen virtual Glib::ustring getDesc() const {return "bar";}
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen*/
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen};
c3fcea07965f59723831e23da647a77518285b8eslive
c3fcea07965f59723831e23da647a77518285b8eslive/** \brief Utility function to get a panel displayed. */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenstatic void show_panel( Inkscape::UI::Widget::Panel &panel, char const *prefs_path, int const verb_num )
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen{
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen Gtk::Container *container = panel.get_toplevel();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen if ( &panel == container ) { // safe check?
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen //g_message("Creating new dialog to hold it");
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen PanelDialog *dia = new PanelDialog(prefs_path, verb_num);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen Gtk::VBox *mainVBox = dia->get_vbox();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen mainVBox->pack_start(panel);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen dia->show_all_children();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen dia->present();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen dia->read_geometry();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen } else {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen Gtk::Dialog *dia = dynamic_cast<Gtk::Dialog*>(container);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen if ( dia ) {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen //g_message("Found an existing dialog");
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen dia->present();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen } else {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen g_message("Failed to find an existing dialog");
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen }
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen }
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen}
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen/** \brief A class to encompass all of the verbs which deal with
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen file operations. */
c3fcea07965f59723831e23da647a77518285b8esliveclass FileVerb : public Verb {
c3fcea07965f59723831e23da647a77518285b8esliveprivate:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen static void perform(SPAction *action, void *mydata, void *otherdata);
c3fcea07965f59723831e23da647a77518285b8eslive static SPActionEventVector vector;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenprotected:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen virtual SPAction *make_action(Inkscape::UI::View::View *view);
c3fcea07965f59723831e23da647a77518285b8eslivepublic:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen /** \brief Use the Verb initializer with the same parameters. */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen FileVerb(unsigned int const code,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *id,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *name,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *tip,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *image) :
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen Verb(code, id, name, tip, image)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen { }
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen}; /* FileVerb class */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen/** \brief A class to encompass all of the verbs which deal with
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen edit operations. */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenclass EditVerb : public Verb {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenprivate:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen static void perform(SPAction *action, void *mydata, void *otherdata);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen static SPActionEventVector vector;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenprotected:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen virtual SPAction *make_action(Inkscape::UI::View::View *view);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenpublic:
dd6c631a85bd0659226ed0406143aeba179846d3yoshiki /** \brief Use the Verb initializer with the same parameters. */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen EditVerb(unsigned int const code,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *id,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *name,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *tip,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *image) :
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen Verb(code, id, name, tip, image)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen { }
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen}; /* EditVerb class */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen/** \brief A class to encompass all of the verbs which deal with
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen selection operations. */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenclass SelectionVerb : public Verb {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenprivate:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen static void perform(SPAction *action, void *mydata, void *otherdata);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen static SPActionEventVector vector;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenprotected:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen virtual SPAction *make_action(Inkscape::UI::View::View *view);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenpublic:
c3fcea07965f59723831e23da647a77518285b8eslive /** \brief Use the Verb initializer with the same parameters. */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen SelectionVerb(unsigned int const code,
c3fcea07965f59723831e23da647a77518285b8eslive gchar const *id,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *name,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *tip,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *image) :
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen Verb(code, id, name, tip, image)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen { }
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen}; /* SelectionVerb class */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen/** \brief A class to encompass all of the verbs which deal with
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen layer operations. */
c3fcea07965f59723831e23da647a77518285b8esliveclass LayerVerb : public Verb {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenprivate:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen static void perform(SPAction *action, void *mydata, void *otherdata);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen static SPActionEventVector vector;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenprotected:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen virtual SPAction *make_action(Inkscape::UI::View::View *view);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenpublic:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen /** \brief Use the Verb initializer with the same parameters. */
c3fcea07965f59723831e23da647a77518285b8eslive LayerVerb(unsigned int const code,
c3fcea07965f59723831e23da647a77518285b8eslive gchar const *id,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *name,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *tip,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *image) :
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen Verb(code, id, name, tip, image)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen { }
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen}; /* LayerVerb class */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen/** \brief A class to encompass all of the verbs which deal with
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen operations related to objects. */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenclass ObjectVerb : public Verb {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenprivate:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen static void perform(SPAction *action, void *mydata, void *otherdata);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen static SPActionEventVector vector;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenprotected:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen virtual SPAction *make_action(Inkscape::UI::View::View *view);
c3fcea07965f59723831e23da647a77518285b8eslivepublic:
c3fcea07965f59723831e23da647a77518285b8eslive /** \brief Use the Verb initializer with the same parameters. */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen ObjectVerb(unsigned int const code,
c3fcea07965f59723831e23da647a77518285b8eslive gchar const *id,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *name,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *tip,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *image) :
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen Verb(code, id, name, tip, image)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen { }
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen}; /* ObjectVerb class */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen/** \brief A class to encompass all of the verbs which deal with
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen operations relative to context. */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenclass ContextVerb : public Verb {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenprivate:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen static void perform(SPAction *action, void *mydata, void *otherdata);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen static SPActionEventVector vector;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenprotected:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen virtual SPAction *make_action(Inkscape::UI::View::View *view);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenpublic:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen /** \brief Use the Verb initializer with the same parameters. */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen ContextVerb(unsigned int const code,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *id,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *name,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *tip,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *image) :
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen Verb(code, id, name, tip, image)
c3fcea07965f59723831e23da647a77518285b8eslive { }
75569f53579b42dc17cf097015b6b055c01e6875slive}; /* ContextVerb class */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen/** \brief A class to encompass all of the verbs which deal with
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen zoom operations. */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenclass ZoomVerb : public Verb {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenprivate:
c3fcea07965f59723831e23da647a77518285b8eslive static void perform(SPAction *action, void *mydata, void *otherdata);
c3fcea07965f59723831e23da647a77518285b8eslive static SPActionEventVector vector;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenprotected:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen virtual SPAction *make_action(Inkscape::UI::View::View *view);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenpublic:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen /** \brief Use the Verb initializer with the same parameters. */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen ZoomVerb(unsigned int const code,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *id,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *name,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *tip,
c3fcea07965f59723831e23da647a77518285b8eslive gchar const *image) :
c3fcea07965f59723831e23da647a77518285b8eslive Verb(code, id, name, tip, image)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen { }
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen}; /* ZoomVerb class */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen/** \brief A class to encompass all of the verbs which deal with
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen dialog operations. */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenclass DialogVerb : public Verb {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenprivate:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen static void perform(SPAction *action, void *mydata, void *otherdata);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen static SPActionEventVector vector;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenprotected:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen virtual SPAction *make_action(Inkscape::UI::View::View *view);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenpublic:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen /** \brief Use the Verb initializer with the same parameters. */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen DialogVerb(unsigned int const code,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *id,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *name,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *tip,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *image) :
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen Verb(code, id, name, tip, image)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen { }
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen}; /* DialogVerb class */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen/** \brief A class to encompass all of the verbs which deal with
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen help operations. */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenclass HelpVerb : public Verb {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenprivate:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen static void perform(SPAction *action, void *mydata, void *otherdata);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen static SPActionEventVector vector;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenprotected:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen virtual SPAction *make_action(Inkscape::UI::View::View *view);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenpublic:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen /** \brief Use the Verb initializer with the same parameters. */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen HelpVerb(unsigned int const code,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *id,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *name,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *tip,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *image) :
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen Verb(code, id, name, tip, image)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen { }
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen}; /* HelpVerb class */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen/** \brief A class to encompass all of the verbs which deal with
75569f53579b42dc17cf097015b6b055c01e6875slive tutorial operations. */
75569f53579b42dc17cf097015b6b055c01e6875sliveclass TutorialVerb : public Verb {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenprivate:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen static void perform(SPAction *action, void *mydata, void *otherdata);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen static SPActionEventVector vector;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenprotected:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen virtual SPAction *make_action(Inkscape::UI::View::View *view);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenpublic:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen /** \brief Use the Verb initializer with the same parameters. */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen TutorialVerb(unsigned int const code,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *id,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *name,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *tip,
f794e11d17dcdae9f5f2944a5bfd06a7ded6a579yoshiki gchar const *image) :
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive Verb(code, id, name, tip, image)
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive { }
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive}; /* TutorialVerb class */
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive/** \brief A class to encompass all of the verbs which deal with
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen text operations. */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenclass TextVerb : public Verb {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenprivate:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen static void perform(SPAction *action, void *mydata, void *otherdata);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen static SPActionEventVector vector;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenprotected:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen virtual SPAction *make_action(Inkscape::UI::View::View *view);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenpublic:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen /** \brief Use the Verb initializer with the same parameters. */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen TextVerb(unsigned int const code,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *id,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *name,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen gchar const *tip,
75569f53579b42dc17cf097015b6b055c01e6875slive gchar const *image) :
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen Verb(code, id, name, tip, image)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen { }
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen}; //TextVerb : public Verb
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
75569f53579b42dc17cf097015b6b055c01e6875sliveVerb::VerbTable Verb::_verbs;
75569f53579b42dc17cf097015b6b055c01e6875sliveVerb::VerbIDTable Verb::_verb_ids;
c3fcea07965f59723831e23da647a77518285b8eslive
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen/** \brief Create a verb without a code.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen This function calls the other constructor for all of the parameters,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen but generates the code. It is important to READ THE OTHER DOCUMENTATION
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen it has important details in it. To generate the code a static is
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen used which starts at the last static value: \c SP_VERB_LAST. For
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen each call it is incremented. The list of allocated verbs is kept
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen in the \c _verbs hashtable which is indexed by the \c code.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen*/
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenVerb::Verb(gchar const *id, gchar const *name, gchar const *tip, gchar const *image) :
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen _actions(NULL), _id(id), _name(name), _tip(tip), _image(image)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen{
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen static int count = SP_VERB_LAST;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive count++;
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive _code = count;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen _verbs.insert(VerbTable::value_type(count, this));
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen _verb_ids.insert(VerbIDTable::value_type(_id, this));
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen return;
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive}
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen/** \brief Destroy a verb.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen The only allocated variable is the _actions variable. If it has
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen been allocated it is deleted.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen*/
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenVerb::~Verb(void)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen{
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen /// \todo all the actions need to be cleaned up first.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen if (_actions != NULL) {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen delete _actions;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen }
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen return;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen}
c3fcea07965f59723831e23da647a77518285b8eslive
c3fcea07965f59723831e23da647a77518285b8eslive/** \brief Verbs are no good without actions. This is a place holder
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen for a function that every subclass should write. Most
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen can be written using \c make_action_helper.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen \param view Which view the action should be created for.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen \return NULL to represent error (this function shouldn't ever be called)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen*/
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenSPAction *
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenVerb::make_action(Inkscape::UI::View::View *view)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen{
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen //std::cout << "make_action" << std::endl;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen return NULL;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen}
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen/** \brief Create an action for a \c FileVerb
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen \param view Which view the action should be created for
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen \return The built action.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen Calls \c make_action_helper with the \c vector.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen*/
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenSPAction *
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenFileVerb::make_action(Inkscape::UI::View::View *view)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen{
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen //std::cout << "fileverb: make_action: " << &vector << std::endl;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen return make_action_helper(view, &vector);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen}
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen/** \brief Create an action for a \c EditVerb
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen \param view Which view the action should be created for
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen \return The built action.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen Calls \c make_action_helper with the \c vector.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen*/
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenSPAction *
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenEditVerb::make_action(Inkscape::UI::View::View *view)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen{
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen //std::cout << "editverb: make_action: " << &vector << std::endl;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen return make_action_helper(view, &vector);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen}
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen/** \brief Create an action for a \c SelectionVerb
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen \param view Which view the action should be created for
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen \return The built action.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen Calls \c make_action_helper with the \c vector.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen*/
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenSPAction *
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenSelectionVerb::make_action(Inkscape::UI::View::View *view)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen{
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen return make_action_helper(view, &vector);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen}
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen/** \brief Create an action for a \c LayerVerb
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen \param view Which view the action should be created for
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen \return The built action.
c3fcea07965f59723831e23da647a77518285b8eslive
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen Calls \c make_action_helper with the \c vector.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen*/
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenSPAction *
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenLayerVerb::make_action(Inkscape::UI::View::View *view)
15ba1801088da1aad6d20609cf3f7b0b1eefce8aslive{
c3fcea07965f59723831e23da647a77518285b8eslive return make_action_helper(view, &vector);
c3fcea07965f59723831e23da647a77518285b8eslive}
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen/** \brief Create an action for a \c ObjectVerb
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen \param view Which view the action should be created for
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen \return The built action.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen Calls \c make_action_helper with the \c vector.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen*/
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenSPAction *
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenObjectVerb::make_action(Inkscape::UI::View::View *view)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen{
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen return make_action_helper(view, &vector);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen}
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen/** \brief Create an action for a \c ContextVerb
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen \param view Which view the action should be created for
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive \return The built action.
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive Calls \c make_action_helper with the \c vector.
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive*/
eabaccd4bdeaafc3d0c21886863bd9acefea99bbsliveSPAction *
eabaccd4bdeaafc3d0c21886863bd9acefea99bbsliveContextVerb::make_action(Inkscape::UI::View::View *view)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen{
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen return make_action_helper(view, &vector);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen}
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen/** \brief Create an action for a \c ZoomVerb
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive \param view Which view the action should be created for
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive \return The built action.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen Calls \c make_action_helper with the \c vector.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen*/
eabaccd4bdeaafc3d0c21886863bd9acefea99bbsliveSPAction *
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenZoomVerb::make_action(Inkscape::UI::View::View *view)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen{
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen return make_action_helper(view, &vector);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen}
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen/** \brief Create an action for a \c DialogVerb
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen \param view Which view the action should be created for
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen \return The built action.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
44c61920e384b819aba8ad43310c67c71fa64a48rbowen Calls \c make_action_helper with the \c vector.
44c61920e384b819aba8ad43310c67c71fa64a48rbowen*/
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenSPAction *
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenDialogVerb::make_action(Inkscape::UI::View::View *view)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen{
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen return make_action_helper(view, &vector);
c3fcea07965f59723831e23da647a77518285b8eslive}
c3fcea07965f59723831e23da647a77518285b8eslive
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen/** \brief Create an action for a \c HelpVerb
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen \param view Which view the action should be created for
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen \return The built action.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen Calls \c make_action_helper with the \c vector.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen*/
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenSPAction *
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenHelpVerb::make_action(Inkscape::UI::View::View *view)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen{
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen return make_action_helper(view, &vector);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen}
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive/** \brief Create an action for a \c TutorialVerb
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive \param view Which view the action should be created for
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive \return The built action.
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive Calls \c make_action_helper with the \c vector.
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive*/
eabaccd4bdeaafc3d0c21886863bd9acefea99bbsliveSPAction *
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenTutorialVerb::make_action(Inkscape::UI::View::View *view)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen{
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen return make_action_helper(view, &vector);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen}
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen/** \brief Create an action for a \c TextVerb
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen \param view Which view the action should be created for
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen \return The built action.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen Calls \c make_action_helper with the \c vector.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen*/
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenSPAction *
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenTextVerb::make_action(Inkscape::UI::View::View *view)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen{
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen return make_action_helper(view, &vector);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen}
75569f53579b42dc17cf097015b6b055c01e6875slive
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive/** \brief A quick little convience function to make building actions
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen a little bit easier.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen \param view Which view the action should be created for.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen \param vector The function vector for the verb.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen \return The created action.
75569f53579b42dc17cf097015b6b055c01e6875slive
75569f53579b42dc17cf097015b6b055c01e6875slive This function does a couple of things. The most obvious is that
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen it allocates and creates the action. When it does this it
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen translates the \c _name and \c _tip variables. This allows them
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen to be staticly allocated easily, and get translated in the end. Then,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen if the action gets crated, a listener is added to the action with
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen the vector that is passed in.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen*/
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenSPAction *
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenVerb::make_action_helper(Inkscape::UI::View::View *view, SPActionEventVector *vector, void *in_pntr)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen{
75569f53579b42dc17cf097015b6b055c01e6875slive SPAction *action;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen //std::cout << "Adding action: " << _code << std::endl;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen action = sp_action_new(view, _id, _(_name),
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen _(_tip), _image, this);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen if (action != NULL) {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen if (in_pntr == NULL) {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen nr_active_object_add_listener(
7ded39cfde416fb4458dc08afc64bfe6274dfb1dslive (NRActiveObject *) action,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen (NRObjectEventVector *) vector,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sizeof(SPActionEventVector),
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen reinterpret_cast<void *>(_code)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen );
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen } else {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen nr_active_object_add_listener(
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen (NRActiveObject *) action,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen (NRObjectEventVector *) vector,
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sizeof(SPActionEventVector),
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen in_pntr
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen );
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen }
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen }
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen return action;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen}
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen/** \brief A function to get an action if it exists, or otherwise to
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen build it.
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive \param view The view which this action would relate to
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive \return The action, or NULL if there is an error.
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive This function will get the action for a given view for this verb. It
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive will create the verb if it can't be found in the ActionTable. Also,
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive if the \c ActionTable has not been created, it gets created by this
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive function.
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen If the action is created, it's sensitivity must be determined. The
75569f53579b42dc17cf097015b6b055c01e6875slive default for a new action is that it is sensitive. If the value in
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen \c _default_sensitive is \c false, then the sensitivity must be
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen removed. Also, if the view being created is based on the same
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen document as a view already created, the sensitivity should be the
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen same as views on that document. A view with the same document is
c3fcea07965f59723831e23da647a77518285b8eslive looked for, and the sensitivity is matched. Unfortunately, this is
c3fcea07965f59723831e23da647a77518285b8eslive currently a linear search.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen*/
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenSPAction *
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenVerb::get_action(Inkscape::UI::View::View *view)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen{
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen SPAction *action = NULL;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen if ( _actions == NULL ) {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen _actions = new ActionTable;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen }
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen ActionTable::iterator action_found = _actions->find(view);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen if (action_found != _actions->end()) {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen action = action_found->second;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen } else {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen action = this->make_action(view);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen // if (action == NULL) printf("Hmm, NULL in %s\n", _name);
c3fcea07965f59723831e23da647a77518285b8eslive if (action == NULL) printf("Hmm, NULL in %s\n", _name);
c3fcea07965f59723831e23da647a77518285b8eslive if (!_default_sensitive) {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_action_set_sensitive(action, 0);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen } else {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen for (ActionTable::iterator cur_action = _actions->begin();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen cur_action != _actions->end() && view != NULL;
c3fcea07965f59723831e23da647a77518285b8eslive cur_action++) {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen if (cur_action->first != NULL && cur_action->first->doc() == view->doc()) {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_action_set_sensitive(action, cur_action->second->sensitive);
c3fcea07965f59723831e23da647a77518285b8eslive break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen }
c3fcea07965f59723831e23da647a77518285b8eslive }
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen }
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive _actions->insert(ActionTable::value_type(view, action));
7ded39cfde416fb4458dc08afc64bfe6274dfb1dslive }
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive return action;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen}
c3fcea07965f59723831e23da647a77518285b8eslive
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenvoid
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenVerb::sensitive(SPDocument *in_doc, bool in_sensitive)
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz{
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz // printf("Setting sensitivity of \"%s\" to %d\n", _name, in_sensitive);
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz if (_actions != NULL) {
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz for (ActionTable::iterator cur_action = _actions->begin();
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz cur_action != _actions->end();
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz cur_action++) {
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz if (in_doc == NULL || (cur_action->first != NULL && cur_action->first->doc() == in_doc)) {
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz sp_action_set_sensitive(cur_action->second, in_sensitive ? 1 : 0);
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz }
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz }
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz }
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz if (in_doc == NULL) {
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz _default_sensitive = in_sensitive;
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz }
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz return;
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz}
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantzvoid
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantzVerb::name(SPDocument *in_doc, Glib::ustring in_name)
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz{
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz if (_actions != NULL) {
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz for (ActionTable::iterator cur_action = _actions->begin();
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz cur_action != _actions->end();
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz cur_action++) {
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz if (in_doc == NULL || (cur_action->first != NULL && cur_action->first->doc() == in_doc)) {
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz sp_action_set_name(cur_action->second, in_name);
7a6426ac44b6c9b92a6c9f616a0b4c127742445ajerenkrantz }
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz }
7a6426ac44b6c9b92a6c9f616a0b4c127742445ajerenkrantz }
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz}
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz/** \brief A function to remove the action associated with a view.
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz \param view Which view's actions should be removed.
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz \return None
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz
21b70e758d670601065db7b05e16441226e4e9b4jerenkrantz This function looks for the action in \c _actions. If it is
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen found then it is unreferenced and the entry in the action
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen table is erased.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen*/
75569f53579b42dc17cf097015b6b055c01e6875slivevoid
75569f53579b42dc17cf097015b6b055c01e6875sliveVerb::delete_view(Inkscape::UI::View::View *view)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen{
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen if (_actions == NULL) return;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen if (_actions->empty()) return;
0741d76bec779f3ec7b03834bebf4b4cbabe3630kess
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen#if 0
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen static int count = 0;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen std::cout << count++ << std::endl;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen#endif
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen ActionTable::iterator action_found = _actions->find(view);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c3fcea07965f59723831e23da647a77518285b8eslive if (action_found != _actions->end()) {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen SPAction *action = action_found->second;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen nr_object_unref(NR_OBJECT(action));
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen _actions->erase(action_found);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen }
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen return;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen}
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive/** \brief A function to delete a view from all verbs
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive \param view Which view's actions should be removed.
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive \return None
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen This function first looks through _base_verbs and deteles
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen the view from all of those views. If \c _verbs is not empty
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen then all of the entries in that table have all of the views
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen deleted also.
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen*/
75569f53579b42dc17cf097015b6b055c01e6875slivevoid
75569f53579b42dc17cf097015b6b055c01e6875sliveVerb::delete_all_view(Inkscape::UI::View::View *view)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen{
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen for (int i = 0; i <= SP_VERB_LAST; i++) {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen if (_base_verbs[i])
0741d76bec779f3ec7b03834bebf4b4cbabe3630kess _base_verbs[i]->delete_view(view);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen }
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen if (!_verbs.empty()) {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen for (VerbTable::iterator thisverb = _verbs.begin();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen thisverb != _verbs.end(); thisverb++) {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen Inkscape::Verb *verbpntr = thisverb->second;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen // std::cout << "Delete In Verb: " << verbpntr->_name << std::endl;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen verbpntr->delete_view(view);
c3fcea07965f59723831e23da647a77518285b8eslive }
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen }
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen return;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen}
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen/** \brief A function to turn a \c code into a Verb for dynamically
97a9a944b5887e91042b019776c41d5dd74557aferikabele created Verbs.
97a9a944b5887e91042b019776c41d5dd74557aferikabele \param code What code is being looked for
97a9a944b5887e91042b019776c41d5dd74557aferikabele \return The found Verb of NULL if none is found.
97a9a944b5887e91042b019776c41d5dd74557aferikabele
97a9a944b5887e91042b019776c41d5dd74557aferikabele This function basically just looks through the \c _verbs hash
97a9a944b5887e91042b019776c41d5dd74557aferikabele table. STL does all the work.
97a9a944b5887e91042b019776c41d5dd74557aferikabele*/
97a9a944b5887e91042b019776c41d5dd74557aferikabeleVerb *
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenVerb::get_search(unsigned int code)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen{
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen Verb *verb = NULL;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen VerbTable::iterator verb_found = _verbs.find(code);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c3fcea07965f59723831e23da647a77518285b8eslive if (verb_found != _verbs.end()) {
c3fcea07965f59723831e23da647a77518285b8eslive verb = verb_found->second;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen }
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen return verb;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen}
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen/** \brief Find a Verb using it's ID
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen \param id Which id to search for
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen This function uses the \c _verb_ids has table to find the
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen verb by it's id. Should be much faster than previous
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen implementations.
75569f53579b42dc17cf097015b6b055c01e6875slive*/
75569f53579b42dc17cf097015b6b055c01e6875sliveVerb *
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenVerb::getbyid(gchar const *id)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen{
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen Verb *verb = NULL;
0741d76bec779f3ec7b03834bebf4b4cbabe3630kess VerbIDTable::iterator verb_found = _verb_ids.find(id);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen if (verb_found != _verb_ids.end()) {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen verb = verb_found->second;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen }
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen if (verb == NULL)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen printf("Unable to find: %s\n", id);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c3fcea07965f59723831e23da647a77518285b8eslive return verb;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen}
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen/** \brief Decode the verb code and take appropriate action */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenvoid
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenFileVerb::perform(SPAction *action, void *data, void *pdata)
97a9a944b5887e91042b019776c41d5dd74557aferikabele{
97a9a944b5887e91042b019776c41d5dd74557aferikabele#if 0
97a9a944b5887e91042b019776c41d5dd74557aferikabele /* These aren't used, but are here to remind people not to use
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen the CURRENT_DOCUMENT macros unless they really have to. */
97a9a944b5887e91042b019776c41d5dd74557aferikabele Inkscape::UI::View::View *current_view = sp_action_get_view(action);
97a9a944b5887e91042b019776c41d5dd74557aferikabele SPDocument *current_document = current_view->doc();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen#endif
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen switch ((long) data) {
c3fcea07965f59723831e23da647a77518285b8eslive case SP_VERB_FILE_NEW:
c3fcea07965f59723831e23da647a77518285b8eslive sp_file_new_default();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
c3fcea07965f59723831e23da647a77518285b8eslive case SP_VERB_FILE_OPEN:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_file_open_dialog(NULL, NULL);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_FILE_REVERT:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_file_revert_dialog();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_FILE_SAVE:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_file_save(NULL, NULL);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_FILE_SAVE_AS:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_file_save_as(NULL, NULL);
75569f53579b42dc17cf097015b6b055c01e6875slive break;
75569f53579b42dc17cf097015b6b055c01e6875slive case SP_VERB_FILE_PRINT:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_file_print();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_FILE_VACUUM:
0741d76bec779f3ec7b03834bebf4b4cbabe3630kess sp_file_vacuum();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_FILE_PRINT_DIRECT:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_file_print_direct();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_FILE_PRINT_PREVIEW:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_file_print_preview(NULL, NULL);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_FILE_IMPORT:
c3fcea07965f59723831e23da647a77518285b8eslive sp_file_import(NULL);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_FILE_EXPORT:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_file_export_dialog(NULL);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_FILE_NEXT_DESKTOP:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen inkscape_switch_desktops_next();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive case SP_VERB_FILE_PREV_DESKTOP:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen inkscape_switch_desktops_prev();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_FILE_CLOSE_VIEW:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_ui_close_view(NULL);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
75569f53579b42dc17cf097015b6b055c01e6875slive case SP_VERB_FILE_QUIT:
75569f53579b42dc17cf097015b6b055c01e6875slive sp_file_exit();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen default:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
0741d76bec779f3ec7b03834bebf4b4cbabe3630kess }
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen} // end of sp_verb_action_file_perform()
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen/** \brief Decode the verb code and take appropriate action */
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenvoid
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowenEditVerb::perform(SPAction *action, void *data, void *pdata)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen{
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen if (!dt)
c3fcea07965f59723831e23da647a77518285b8eslive return;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen SPEventContext *ec = dt->event_context;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen switch (reinterpret_cast<std::size_t>(data)) {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_EDIT_UNDO:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_undo(dt, sp_desktop_document(dt));
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_EDIT_REDO:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_redo(dt, sp_desktop_document(dt));
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_EDIT_CUT:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_selection_cut();
75569f53579b42dc17cf097015b6b055c01e6875slive break;
75569f53579b42dc17cf097015b6b055c01e6875slive case SP_VERB_EDIT_COPY:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_selection_copy();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_EDIT_PASTE:
0741d76bec779f3ec7b03834bebf4b4cbabe3630kess sp_selection_paste(false);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_EDIT_PASTE_STYLE:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_selection_paste_style();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_EDIT_PASTE_SIZE:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_selection_paste_size(true, true);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_EDIT_PASTE_SIZE_X:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_selection_paste_size(true, false);
c3fcea07965f59723831e23da647a77518285b8eslive break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_EDIT_PASTE_SIZE_Y:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_selection_paste_size(false, true);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_EDIT_PASTE_SIZE_SEPARATELY:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_selection_paste_size_separately(true, true);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_X:
44c61920e384b819aba8ad43310c67c71fa64a48rbowen sp_selection_paste_size_separately(true, false);
44c61920e384b819aba8ad43310c67c71fa64a48rbowen break;
44c61920e384b819aba8ad43310c67c71fa64a48rbowen case SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_Y:
44c61920e384b819aba8ad43310c67c71fa64a48rbowen sp_selection_paste_size_separately(false, true);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
44c61920e384b819aba8ad43310c67c71fa64a48rbowen case SP_VERB_EDIT_PASTE_IN_PLACE:
44c61920e384b819aba8ad43310c67c71fa64a48rbowen sp_selection_paste(true);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_EDIT_DELETE:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_selection_delete();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_EDIT_DUPLICATE:
75569f53579b42dc17cf097015b6b055c01e6875slive sp_selection_duplicate();
75569f53579b42dc17cf097015b6b055c01e6875slive break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_EDIT_CLONE:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_selection_clone();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
0741d76bec779f3ec7b03834bebf4b4cbabe3630kess case SP_VERB_EDIT_UNLINK_CLONE:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_selection_unlink();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_EDIT_CLONE_ORIGINAL:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_select_clone_original();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_EDIT_TILE:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_selection_tile();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_EDIT_UNTILE:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_selection_untile();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_EDIT_CLEAR_ALL:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_edit_clear_all();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
97a9a944b5887e91042b019776c41d5dd74557aferikabele case SP_VERB_EDIT_SELECT_ALL:
97a9a944b5887e91042b019776c41d5dd74557aferikabele if (tools_isactive(dt, TOOLS_NODES)) {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_nodepath_select_all_from_subpath(SP_NODE_CONTEXT(ec)->nodepath, false);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen } else {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_edit_select_all();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen }
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_EDIT_INVERT:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen if (tools_isactive(dt, TOOLS_NODES)) {
f794e11d17dcdae9f5f2944a5bfd06a7ded6a579yoshiki sp_nodepath_select_all_from_subpath(SP_NODE_CONTEXT(ec)->nodepath, true);
f794e11d17dcdae9f5f2944a5bfd06a7ded6a579yoshiki } else {
c3fcea07965f59723831e23da647a77518285b8eslive sp_edit_invert();
c3fcea07965f59723831e23da647a77518285b8eslive }
c3fcea07965f59723831e23da647a77518285b8eslive break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen if (tools_isactive(dt, TOOLS_NODES)) {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_nodepath_select_all(SP_NODE_CONTEXT(ec)->nodepath, false);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen } else {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_edit_select_all_in_all_layers();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen }
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_EDIT_INVERT_IN_ALL_LAYERS:
75569f53579b42dc17cf097015b6b055c01e6875slive if (tools_isactive(dt, TOOLS_NODES)) {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_nodepath_select_all(SP_NODE_CONTEXT(ec)->nodepath, true);
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen } else {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_edit_invert_in_all_layers();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen }
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_EDIT_DESELECT:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen if (tools_isactive(dt, TOOLS_NODES)) {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_nodepath_deselect(SP_NODE_CONTEXT(ec)->nodepath);
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive } else {
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive sp_desktop_selection(dt)->clear();
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive }
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive break;
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive default:
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive break;
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive }
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive} // end of sp_verb_action_edit_perform()
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive/** \brief Decode the verb code and take appropriate action */
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslivevoid
eabaccd4bdeaafc3d0c21886863bd9acefea99bbsliveSelectionVerb::perform(SPAction *action, void *data, void *pdata)
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive{
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive if (!dt)
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen return;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen switch (reinterpret_cast<std::size_t>(data)) {
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_SELECTION_TO_FRONT:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_selection_raise_to_top();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive case SP_VERB_SELECTION_TO_BACK:
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen sp_selection_lower_to_bottom();
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive break;
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive case SP_VERB_SELECTION_RAISE:
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive sp_selection_raise();
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive break;
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive case SP_VERB_SELECTION_LOWER:
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive sp_selection_lower();
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive break;
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive case SP_VERB_SELECTION_GROUP:
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive sp_selection_group();
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_SELECTION_UNGROUP:
eabaccd4bdeaafc3d0c21886863bd9acefea99bbslive sp_selection_ungroup();
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen break;
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen
c053576cdcd7389a1e11dd9c656f1f723ae854bcrbowen case SP_VERB_SELECTION_TEXTTOPATH:
text_put_on_path();
break;
case SP_VERB_SELECTION_TEXTFROMPATH:
text_remove_from_path();
break;
case SP_VERB_SELECTION_REMOVE_KERNS:
text_remove_all_kerns();
break;
case SP_VERB_SELECTION_UNION:
sp_selected_path_union();
break;
case SP_VERB_SELECTION_INTERSECT:
sp_selected_path_intersect();
break;
case SP_VERB_SELECTION_DIFF:
sp_selected_path_diff();
break;
case SP_VERB_SELECTION_SYMDIFF:
sp_selected_path_symdiff();
break;
case SP_VERB_SELECTION_CUT:
sp_selected_path_cut();
break;
case SP_VERB_SELECTION_SLICE:
sp_selected_path_slice();
break;
case SP_VERB_SELECTION_OFFSET:
sp_selected_path_offset();
break;
case SP_VERB_SELECTION_OFFSET_SCREEN:
sp_selected_path_offset_screen(1);
break;
case SP_VERB_SELECTION_OFFSET_SCREEN_10:
sp_selected_path_offset_screen(10);
break;
case SP_VERB_SELECTION_INSET:
sp_selected_path_inset();
break;
case SP_VERB_SELECTION_INSET_SCREEN:
sp_selected_path_inset_screen(1);
break;
case SP_VERB_SELECTION_INSET_SCREEN_10:
sp_selected_path_inset_screen(10);
break;
case SP_VERB_SELECTION_DYNAMIC_OFFSET:
sp_selected_path_create_offset_object_zero();
break;
case SP_VERB_SELECTION_LINKED_OFFSET:
sp_selected_path_create_updating_offset_object_zero();
break;
case SP_VERB_SELECTION_OUTLINE:
sp_selected_path_outline();
break;
case SP_VERB_SELECTION_SIMPLIFY:
sp_selected_path_simplify();
break;
case SP_VERB_SELECTION_REVERSE:
sp_selected_path_reverse();
break;
case SP_VERB_SELECTION_TRACE:
dt->_dlg_mgr->showDialog("Trace");
break;
case SP_VERB_SELECTION_CREATE_BITMAP:
sp_selection_create_bitmap_copy();
break;
case SP_VERB_SELECTION_COMBINE:
sp_selected_path_combine();
break;
case SP_VERB_SELECTION_BREAK_APART:
sp_selected_path_break_apart();
break;
case SP_VERB_SELECTION_GRIDTILE:
dt->_dlg_mgr->showDialog("TileDialog");
break;
default:
break;
}
} // end of sp_verb_action_selection_perform()
/** \brief Decode the verb code and take appropriate action */
void
LayerVerb::perform(SPAction *action, void *data, void *pdata)
{
SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
unsigned int verb = reinterpret_cast<std::size_t>(data);
if ( !dt || !dt->currentLayer() ) {
return;
}
switch (verb) {
case SP_VERB_LAYER_NEW: {
Inkscape::UI::Dialogs::LayerPropertiesDialog::showCreate(dt, dt->currentLayer());
break;
}
case SP_VERB_LAYER_RENAME: {
Inkscape::UI::Dialogs::LayerPropertiesDialog::showRename(dt, dt->currentLayer());
break;
}
case SP_VERB_LAYER_NEXT: {
SPObject *next=Inkscape::next_layer(dt->currentRoot(), dt->currentLayer());
if (next) {
dt->setCurrentLayer(next);
sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_NEXT,
/* TODO: annotate */ "verbs.cpp:1077");
dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Moved to next layer."));
} else {
dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Cannot move past last layer."));
}
break;
}
case SP_VERB_LAYER_PREV: {
SPObject *prev=Inkscape::previous_layer(dt->currentRoot(), dt->currentLayer());
if (prev) {
dt->setCurrentLayer(prev);
sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_PREV,
/* TODO: annotate */ "verbs.cpp:1089");
dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Moved to previous layer."));
} else {
dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Cannot move past first layer."));
}
break;
}
case SP_VERB_LAYER_MOVE_TO_NEXT: {
sp_selection_to_next_layer();
break;
}
case SP_VERB_LAYER_MOVE_TO_PREV: {
sp_selection_to_prev_layer();
break;
}
case SP_VERB_LAYER_TO_TOP:
case SP_VERB_LAYER_TO_BOTTOM:
case SP_VERB_LAYER_RAISE:
case SP_VERB_LAYER_LOWER: {
if ( dt->currentLayer() == dt->currentRoot() ) {
dt->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No current layer."));
return;
}
SPItem *layer=SP_ITEM(dt->currentLayer());
g_return_if_fail(layer != NULL);
SPObject *old_pos=SP_OBJECT_NEXT(layer);
switch (verb) {
case SP_VERB_LAYER_TO_TOP:
layer->raiseToTop();
break;
case SP_VERB_LAYER_TO_BOTTOM:
layer->lowerToBottom();
break;
case SP_VERB_LAYER_RAISE:
layer->raiseOne();
break;
case SP_VERB_LAYER_LOWER:
layer->lowerOne();
break;
}
if ( SP_OBJECT_NEXT(layer) != old_pos ) {
char const *message = NULL;
Glib::ustring description = "";
switch (verb) {
case SP_VERB_LAYER_TO_TOP:
message = g_strdup_printf(_("Raised layer <b>%s</b>."), layer->defaultLabel());
description = _("Layer to Top");
break;
case SP_VERB_LAYER_RAISE:
message = g_strdup_printf(_("Raised layer <b>%s</b>."), layer->defaultLabel());
description = _("Raise Layer");
break;
case SP_VERB_LAYER_TO_BOTTOM:
message = g_strdup_printf(_("Lowered layer <b>%s</b>."), layer->defaultLabel());
description = _("Layer to Bottom");
break;
case SP_VERB_LAYER_LOWER:
message = g_strdup_printf(_("Lowered layer <b>%s</b>."), layer->defaultLabel());
description = _("Lower Layer");
break;
};
sp_document_done(sp_desktop_document(dt), verb, description);
if (message) {
dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, message);
g_free((void *) message);
}
} else {
dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Cannot move layer any further."));
}
break;
}
case SP_VERB_LAYER_DELETE: {
if ( dt->currentLayer() != dt->currentRoot() ) {
sp_desktop_selection(dt)->clear();
SPObject *old_layer=dt->currentLayer();
sp_object_ref(old_layer, NULL);
SPObject *survivor=Inkscape::next_layer(dt->currentRoot(), old_layer);
if (!survivor) {
survivor = Inkscape::previous_layer(dt->currentRoot(), old_layer);
}
/* Deleting the old layer before switching layers is a hack to trigger the
* listeners of the deletion event (as happens when old_layer is deleted using the
* xml editor). See
* http://sourceforge.net/tracker/index.php?func=detail&aid=1339397&group_id=93438&atid=604306
*/
old_layer->deleteObject();
sp_object_unref(old_layer, NULL);
if (survivor) {
dt->setCurrentLayer(survivor);
}
sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_DELETE,
_("Delete layer"));
// TRANSLATORS: this means "The layer has been deleted."
dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Deleted layer."));
} else {
dt->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No current layer."));
}
break;
}
}
return;
} // end of sp_verb_action_layer_perform()
/** \brief Decode the verb code and take appropriate action */
void
ObjectVerb::perform( SPAction *action, void *data, void *pdata )
{
SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
if (!dt)
return;
SPEventContext *ec = dt->event_context;
Inkscape::Selection *sel = sp_desktop_selection(dt);
if (sel->isEmpty())
return;
NR::Point const center(sel->bounds().midpoint());
switch (reinterpret_cast<std::size_t>(data)) {
case SP_VERB_OBJECT_ROTATE_90_CW:
sp_selection_rotate_90_cw();
break;
case SP_VERB_OBJECT_ROTATE_90_CCW:
sp_selection_rotate_90_ccw();
break;
case SP_VERB_OBJECT_FLATTEN:
sp_selection_remove_transform();
break;
case SP_VERB_OBJECT_TO_CURVE:
sp_selected_path_to_curves();
break;
case SP_VERB_OBJECT_FLOW_TEXT:
text_flow_into_shape();
break;
case SP_VERB_OBJECT_UNFLOW_TEXT:
text_unflow();
break;
case SP_VERB_OBJECT_FLOWTEXT_TO_TEXT:
SPFlowtext::convert_to_text();
break;
case SP_VERB_OBJECT_FLIP_HORIZONTAL:
if (tools_isactive(dt, TOOLS_NODES)) {
sp_nodepath_flip(SP_NODE_CONTEXT(ec)->nodepath, NR::X);
} else {
sp_selection_scale_relative(sel, center, NR::scale(-1.0, 1.0));
}
sp_document_done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_HORIZONTAL,
_("Flip horizontally"));
break;
case SP_VERB_OBJECT_FLIP_VERTICAL:
if (tools_isactive(dt, TOOLS_NODES)) {
sp_nodepath_flip(SP_NODE_CONTEXT(ec)->nodepath, NR::Y);
} else {
sp_selection_scale_relative(sel, center, NR::scale(1.0, -1.0));
}
sp_document_done(sp_desktop_document(dt), SP_VERB_OBJECT_FLIP_VERTICAL,
_("Flip vertically"));
break;
case SP_VERB_OBJECT_SET_MASK:
sp_selection_set_mask(false, false);
break;
case SP_VERB_OBJECT_UNSET_MASK:
sp_selection_unset_mask(false);
break;
case SP_VERB_OBJECT_SET_CLIPPATH:
sp_selection_set_mask(true, false);
break;
case SP_VERB_OBJECT_UNSET_CLIPPATH:
sp_selection_unset_mask(true);
break;
default:
break;
}
} // end of sp_verb_action_object_perform()
/** \brief Decode the verb code and take appropriate action */
void
ContextVerb::perform(SPAction *action, void *data, void *pdata)
{
SPDesktop *dt;
sp_verb_t verb;
int vidx;
dt = static_cast<SPDesktop*>(sp_action_get_view(action));
if (!dt)
return;
verb = (sp_verb_t)GPOINTER_TO_INT((gpointer)data);
/** \todo !!! hopefully this can go away soon and actions can look after
* themselves
*/
for (vidx = SP_VERB_CONTEXT_SELECT; vidx <= SP_VERB_CONTEXT_DROPPER_PREFS; vidx++)
{
SPAction *tool_action= get((sp_verb_t)vidx)->get_action(dt);
if (tool_action) {
sp_action_set_active(tool_action, vidx == (int)verb);
}
}
switch (verb) {
case SP_VERB_CONTEXT_SELECT:
tools_switch_current(TOOLS_SELECT);
break;
case SP_VERB_CONTEXT_NODE:
tools_switch_current(TOOLS_NODES);
break;
case SP_VERB_CONTEXT_RECT:
tools_switch_current(TOOLS_SHAPES_RECT);
break;
case SP_VERB_CONTEXT_ARC:
tools_switch_current(TOOLS_SHAPES_ARC);
break;
case SP_VERB_CONTEXT_STAR:
tools_switch_current(TOOLS_SHAPES_STAR);
break;
case SP_VERB_CONTEXT_SPIRAL:
tools_switch_current(TOOLS_SHAPES_SPIRAL);
break;
case SP_VERB_CONTEXT_PENCIL:
tools_switch_current(TOOLS_FREEHAND_PENCIL);
break;
case SP_VERB_CONTEXT_PEN:
tools_switch_current(TOOLS_FREEHAND_PEN);
break;
case SP_VERB_CONTEXT_CALLIGRAPHIC:
tools_switch_current(TOOLS_CALLIGRAPHIC);
break;
case SP_VERB_CONTEXT_TEXT:
tools_switch_current(TOOLS_TEXT);
break;
case SP_VERB_CONTEXT_GRADIENT:
tools_switch_current(TOOLS_GRADIENT);
break;
case SP_VERB_CONTEXT_ZOOM:
tools_switch_current(TOOLS_ZOOM);
break;
case SP_VERB_CONTEXT_DROPPER:
tools_switch_current(TOOLS_DROPPER);
break;
case SP_VERB_CONTEXT_CONNECTOR:
tools_switch_current (TOOLS_CONNECTOR);
break;
case SP_VERB_CONTEXT_SELECT_PREFS:
prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SELECTOR);
dt->_dlg_mgr->showDialog("InkscapePreferences");
break;
case SP_VERB_CONTEXT_NODE_PREFS:
prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_NODE);
dt->_dlg_mgr->showDialog("InkscapePreferences");
break;
case SP_VERB_CONTEXT_RECT_PREFS:
prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SHAPES_RECT);
dt->_dlg_mgr->showDialog("InkscapePreferences");
break;
case SP_VERB_CONTEXT_ARC_PREFS:
prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SHAPES_ELLIPSE);
dt->_dlg_mgr->showDialog("InkscapePreferences");
break;
case SP_VERB_CONTEXT_STAR_PREFS:
prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SHAPES_STAR);
dt->_dlg_mgr->showDialog("InkscapePreferences");
break;
case SP_VERB_CONTEXT_SPIRAL_PREFS:
prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_SHAPES_SPIRAL);
dt->_dlg_mgr->showDialog("InkscapePreferences");
break;
case SP_VERB_CONTEXT_PENCIL_PREFS:
prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_PENCIL);
dt->_dlg_mgr->showDialog("InkscapePreferences");
break;
case SP_VERB_CONTEXT_PEN_PREFS:
prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_PEN);
dt->_dlg_mgr->showDialog("InkscapePreferences");
break;
case SP_VERB_CONTEXT_CALLIGRAPHIC_PREFS:
prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_CALLIGRAPHY);
dt->_dlg_mgr->showDialog("InkscapePreferences");
break;
case SP_VERB_CONTEXT_TEXT_PREFS:
prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_TEXT);
dt->_dlg_mgr->showDialog("InkscapePreferences");
break;
case SP_VERB_CONTEXT_GRADIENT_PREFS:
prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_GRADIENT);
dt->_dlg_mgr->showDialog("InkscapePreferences");
break;
case SP_VERB_CONTEXT_ZOOM_PREFS:
prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_ZOOM);
dt->_dlg_mgr->showDialog("InkscapePreferences");
break;
case SP_VERB_CONTEXT_DROPPER_PREFS:
prefs_set_int_attribute("dialogs.preferences", "page", PREFS_PAGE_TOOLS_DROPPER);
dt->_dlg_mgr->showDialog("InkscapePreferences");
break;
case SP_VERB_CONTEXT_CONNECTOR_PREFS:
prefs_set_int_attribute ("dialogs.preferences", "page", PREFS_PAGE_TOOLS_CONNECTOR);
dt->_dlg_mgr->showDialog("InkscapePreferences");
break;
default:
break;
}
} // end of sp_verb_action_ctx_perform()
/** \brief Decode the verb code and take appropriate action */
void
TextVerb::perform(SPAction *action, void *data, void *pdata)
{
SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
if (!dt)
return;
SPDocument *doc = sp_desktop_document(dt);
(void)doc;
Inkscape::XML::Node *repr = SP_OBJECT_REPR(dt->namedview);
(void)repr;
}
/** \brief Decode the verb code and take appropriate action */
void
ZoomVerb::perform(SPAction *action, void *data, void *pdata)
{
SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
if (!dt)
return;
SPDocument *doc = sp_desktop_document(dt);
Inkscape::XML::Node *repr = SP_OBJECT_REPR(dt->namedview);
gdouble zoom_inc =
prefs_get_double_attribute_limited( "options.zoomincrement",
"value", 1.414213562, 1.01, 10 );
switch (GPOINTER_TO_INT(data)) {
case SP_VERB_ZOOM_IN:
{
NR::Rect const d = dt->get_display_area();
dt->zoom_relative( d.midpoint()[NR::X], d.midpoint()[NR::Y], zoom_inc);
break;
}
case SP_VERB_ZOOM_OUT:
{
NR::Rect const d = dt->get_display_area();
dt->zoom_relative( d.midpoint()[NR::X], d.midpoint()[NR::Y], 1 / zoom_inc );
break;
}
case SP_VERB_ZOOM_1_1:
{
NR::Rect const d = dt->get_display_area();
dt->zoom_absolute( d.midpoint()[NR::X], d.midpoint()[NR::Y], 1.0 );
break;
}
case SP_VERB_ZOOM_1_2:
{
NR::Rect const d = dt->get_display_area();
dt->zoom_absolute( d.midpoint()[NR::X], d.midpoint()[NR::Y], 0.5);
break;
}
case SP_VERB_ZOOM_2_1:
{
NR::Rect const d = dt->get_display_area();
dt->zoom_absolute( d.midpoint()[NR::X], d.midpoint()[NR::Y], 2.0 );
break;
}
case SP_VERB_ZOOM_PAGE:
dt->zoom_page();
break;
case SP_VERB_ZOOM_PAGE_WIDTH:
dt->zoom_page_width();
break;
case SP_VERB_ZOOM_DRAWING:
dt->zoom_drawing();
break;
case SP_VERB_ZOOM_SELECTION:
dt->zoom_selection();
break;
case SP_VERB_ZOOM_NEXT:
dt->next_zoom();
break;
case SP_VERB_ZOOM_PREV:
dt->prev_zoom();
break;
case SP_VERB_TOGGLE_RULERS:
dt->toggleRulers();
break;
case SP_VERB_TOGGLE_SCROLLBARS:
dt->toggleScrollbars();
break;
case SP_VERB_TOGGLE_GUIDES:
sp_namedview_toggle_guides(doc, repr);
break;
case SP_VERB_TOGGLE_GRID:
sp_namedview_toggle_grid(doc, repr);
break;
#ifdef HAVE_GTK_WINDOW_FULLSCREEN
case SP_VERB_FULLSCREEN:
dt->fullscreen();
break;
#endif /* HAVE_GTK_WINDOW_FULLSCREEN */
case SP_VERB_VIEW_NEW:
sp_ui_new_view();
break;
case SP_VERB_VIEW_NEW_PREVIEW:
sp_ui_new_view_preview();
break;
case SP_VERB_VIEW_MODE_NORMAL:
dt->setDisplayModeNormal();
break;
case SP_VERB_VIEW_MODE_OUTLINE:
dt->setDisplayModeOutline();
break;
case SP_VERB_VIEW_ICON_PREVIEW:
show_panel( Inkscape::UI::Dialogs::IconPreviewPanel::getInstance(), "dialogs.iconpreview", SP_VERB_VIEW_ICON_PREVIEW );
break;
default:
break;
}
dt->updateNow();
} // end of sp_verb_action_zoom_perform()
/** \brief Decode the verb code and take appropriate action */
void
DialogVerb::perform(SPAction *action, void *data, void *pdata)
{
if (reinterpret_cast<std::size_t>(data) != SP_VERB_DIALOG_TOGGLE) {
// unhide all when opening a new dialog
inkscape_dialogs_unhide();
}
SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
g_assert(dt->_dlg_mgr != NULL);
switch (reinterpret_cast<std::size_t>(data)) {
case SP_VERB_DIALOG_DISPLAY:
//sp_display_dialog();
dt->_dlg_mgr->showDialog("InkscapePreferences");
break;
case SP_VERB_DIALOG_METADATA:
// sp_desktop_dialog();
dt->_dlg_mgr->showDialog("DocumentMetadata");
break;
case SP_VERB_DIALOG_NAMEDVIEW:
// sp_desktop_dialog();
dt->_dlg_mgr->showDialog("DocumentProperties");
break;
case SP_VERB_DIALOG_FILL_STROKE:
sp_object_properties_dialog();
break;
case SP_VERB_DIALOG_SWATCHES:
show_panel( Inkscape::UI::Dialogs::SwatchesPanel::getInstance(), "dialogs.swatches", SP_VERB_DIALOG_SWATCHES);
break;
case SP_VERB_DIALOG_TRANSFORM:
dt->_dlg_mgr->showDialog("Transformation");
break;
case SP_VERB_DIALOG_ALIGN_DISTRIBUTE:
dt->_dlg_mgr->showDialog("AlignAndDistribute");
break;
case SP_VERB_DIALOG_TEXT:
sp_text_edit_dialog();
break;
case SP_VERB_DIALOG_XML_EDITOR:
sp_xml_tree_dialog();
break;
case SP_VERB_DIALOG_FIND:
sp_find_dialog();
break;
case SP_VERB_DIALOG_DEBUG:
dt->_dlg_mgr->showDialog("Messages");
break;
case SP_VERB_DIALOG_SCRIPT:
dt->_dlg_mgr->showDialog("Script");
break;
case SP_VERB_DIALOG_UNDO_HISTORY:
dt->_dlg_mgr->showDialog("UndoHistory");
break;
case SP_VERB_DIALOG_TOGGLE:
inkscape_dialogs_toggle();
break;
case SP_VERB_DIALOG_CLONETILER:
clonetiler_dialog();
break;
case SP_VERB_DIALOG_ITEM:
sp_item_dialog();
break;
#ifdef WITH_INKBOARD
case SP_VERB_XMPP_CLIENT:
{
Inkscape::Whiteboard::SessionManager::showClient();
break;
}
#endif
case SP_VERB_DIALOG_INPUT:
sp_input_dialog();
break;
case SP_VERB_DIALOG_EXTENSIONEDITOR:
dt->_dlg_mgr->showDialog("ExtensionEditor");
break;
case SP_VERB_DIALOG_LAYERS:
show_panel( Inkscape::UI::Dialogs::LayersPanel::getInstance(), "dialogs.layers", SP_VERB_DIALOG_LAYERS );
break;
default:
break;
}
} // end of sp_verb_action_dialog_perform()
/** \brief Decode the verb code and take appropriate action */
void
HelpVerb::perform(SPAction *action, void *data, void *pdata)
{
SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
g_assert(dt->_dlg_mgr != NULL);
switch (reinterpret_cast<std::size_t>(data)) {
case SP_VERB_HELP_KEYS:
/* TRANSLATORS: If you have translated the keys.svg file to your language, then
translate this string as "keys.LANG.svg" (where LANG is your language code);
otherwise leave as "keys.svg". */
sp_help_open_screen(_("keys.svg"));
break;
case SP_VERB_HELP_ABOUT:
sp_help_about();
break;
case SP_VERB_HELP_ABOUT_EXTENSIONS: {
Inkscape::UI::Dialogs::ExtensionsPanel *panel = new Inkscape::UI::Dialogs::ExtensionsPanel();
panel->set_full(true);
show_panel( *panel, "dialogs.aboutextensions", SP_VERB_HELP_ABOUT_EXTENSIONS );
break;
}
/*
case SP_VERB_SHOW_LICENSE:
// TRANSLATORS: See "tutorial-basic.svg" comment.
sp_help_open_tutorial(NULL, (gpointer) _("gpl-2.svg"));
break;
*/
case SP_VERB_HELP_MEMORY:
dt->_dlg_mgr->showDialog("Memory");
break;
default:
break;
}
} // end of sp_verb_action_help_perform()
/** \brief Decode the verb code and take appropriate action */
void
TutorialVerb::perform(SPAction *action, void *data, void *pdata)
{
switch (reinterpret_cast<std::size_t>(data)) {
case SP_VERB_TUTORIAL_BASIC:
/* TRANSLATORS: If you have translated the tutorial-basic.svg file to your language,
then translate this string as "tutorial-basic.LANG.svg" (where LANG is your language
code); otherwise leave as "tutorial-basic.svg". */
sp_help_open_tutorial(NULL, (gpointer)_("tutorial-basic.svg"));
break;
case SP_VERB_TUTORIAL_SHAPES:
// TRANSLATORS: See "tutorial-basic.svg" comment.
sp_help_open_tutorial(NULL, (gpointer)_("tutorial-shapes.svg"));
break;
case SP_VERB_TUTORIAL_ADVANCED:
// TRANSLATORS: See "tutorial-basic.svg" comment.
sp_help_open_tutorial(NULL, (gpointer)_("tutorial-advanced.svg"));
break;
case SP_VERB_TUTORIAL_TRACING:
// TRANSLATORS: See "tutorial-basic.svg" comment.
sp_help_open_tutorial(NULL, (gpointer)_("tutorial-tracing.svg"));
break;
case SP_VERB_TUTORIAL_CALLIGRAPHY:
// TRANSLATORS: See "tutorial-basic.svg" comment.
sp_help_open_tutorial(NULL, (gpointer)_("tutorial-calligraphy.svg"));
break;
case SP_VERB_TUTORIAL_DESIGN:
// TRANSLATORS: See "tutorial-basic.svg" comment.
sp_help_open_tutorial(NULL, (gpointer)_("tutorial-elements.svg"));
break;
case SP_VERB_TUTORIAL_TIPS:
// TRANSLATORS: See "tutorial-basic.svg" comment.
sp_help_open_tutorial(NULL, (gpointer)_("tutorial-tips.svg"));
break;
default:
break;
}
} // end of sp_verb_action_tutorial_perform()
/**
* Action vector to define functions called if a staticly defined file verb
* is called.
*/
SPActionEventVector FileVerb::vector =
{{NULL},FileVerb::perform, NULL, NULL, NULL, NULL};
/**
* Action vector to define functions called if a staticly defined edit verb is
* called.
*/
SPActionEventVector EditVerb::vector =
{{NULL},EditVerb::perform, NULL, NULL, NULL, NULL};
/**
* Action vector to define functions called if a staticly defined selection
* verb is called
*/
SPActionEventVector SelectionVerb::vector =
{{NULL},SelectionVerb::perform, NULL, NULL, NULL, NULL};
/**
* Action vector to define functions called if a staticly defined layer
* verb is called
*/
SPActionEventVector LayerVerb::vector =
{{NULL}, LayerVerb::perform, NULL, NULL, NULL, NULL};
/**
* Action vector to define functions called if a staticly defined object
* editing verb is called
*/
SPActionEventVector ObjectVerb::vector =
{{NULL},ObjectVerb::perform, NULL, NULL, NULL, NULL};
/**
* Action vector to define functions called if a staticly defined context
* verb is called
*/
SPActionEventVector ContextVerb::vector =
{{NULL},ContextVerb::perform, NULL, NULL, NULL, NULL};
/**
* Action vector to define functions called if a staticly defined zoom verb
* is called
*/
SPActionEventVector ZoomVerb::vector =
{{NULL},ZoomVerb::perform, NULL, NULL, NULL, NULL};
/**
* Action vector to define functions called if a staticly defined dialog verb
* is called
*/
SPActionEventVector DialogVerb::vector =
{{NULL},DialogVerb::perform, NULL, NULL, NULL, NULL};
/**
* Action vector to define functions called if a staticly defined help verb
* is called
*/
SPActionEventVector HelpVerb::vector =
{{NULL},HelpVerb::perform, NULL, NULL, NULL, NULL};
/**
* Action vector to define functions called if a staticly defined tutorial verb
* is called
*/
SPActionEventVector TutorialVerb::vector =
{{NULL},TutorialVerb::perform, NULL, NULL, NULL, NULL};
/**
* Action vector to define functions called if a staticly defined tutorial verb
* is called
*/
SPActionEventVector TextVerb::vector =
{{NULL},TextVerb::perform, NULL, NULL, NULL, NULL};
/* *********** Effect Last ********** */
/** \brief A class to represent the last effect issued */
class EffectLastVerb : public Verb {
private:
static void perform(SPAction *action, void *mydata, void *otherdata);
static SPActionEventVector vector;
protected:
virtual SPAction *make_action(Inkscape::UI::View::View *view);
public:
/** \brief Use the Verb initializer with the same parameters. */
EffectLastVerb(unsigned int const code,
gchar const *id,
gchar const *name,
gchar const *tip,
gchar const *image) :
Verb(code, id, name, tip, image)
{
set_default_sensitive(false);
}
}; /* EffectLastVerb class */
/**
* The vector to attach in the last effect verb.
*/
SPActionEventVector EffectLastVerb::vector =
{{NULL},EffectLastVerb::perform, NULL, NULL, NULL, NULL};
/** \brief Create an action for a \c EffectLastVerb
\param view Which view the action should be created for
\return The built action.
Calls \c make_action_helper with the \c vector.
*/
SPAction *
EffectLastVerb::make_action(Inkscape::UI::View::View *view)
{
return make_action_helper(view, &vector);
}
/** \brief Decode the verb code and take appropriate action */
void
EffectLastVerb::perform(SPAction *action, void *data, void *pdata)
{
/* These aren't used, but are here to remind people not to use
the CURRENT_DOCUMENT macros unless they really have to. */
Inkscape::UI::View::View *current_view = sp_action_get_view(action);
// SPDocument *current_document = SP_VIEW_DOCUMENT(current_view);
Inkscape::Extension::Effect *effect = Inkscape::Extension::Effect::get_last_effect();
if (effect == NULL) return;
if (current_view == NULL) return;
switch ((long) data) {
case SP_VERB_EFFECT_LAST_PREF:
if (!effect->prefs(current_view))
return;
/* Note: fall through */
case SP_VERB_EFFECT_LAST:
effect->effect(current_view);
break;
default:
return;
}
return;
}
/* *********** End Effect Last ********** */
/* *********** Fit Canvas ********** */
/** \brief A class to represent the canvas fitting verbs */
class FitCanvasVerb : public Verb {
private:
static void perform(SPAction *action, void *mydata, void *otherdata);
static SPActionEventVector vector;
protected:
virtual SPAction *make_action(Inkscape::UI::View::View *view);
public:
/** \brief Use the Verb initializer with the same parameters. */
FitCanvasVerb(unsigned int const code,
gchar const *id,
gchar const *name,
gchar const *tip,
gchar const *image) :
Verb(code, id, name, tip, image)
{
set_default_sensitive(false);
}
}; /* FitCanvasVerb class */
/**
* The vector to attach in the fit canvas verb.
*/
SPActionEventVector FitCanvasVerb::vector =
{{NULL},FitCanvasVerb::perform, NULL, NULL, NULL, NULL};
/** \brief Create an action for a \c FitCanvasVerb
\param view Which view the action should be created for
\return The built action.
Calls \c make_action_helper with the \c vector.
*/
SPAction *
FitCanvasVerb::make_action(Inkscape::UI::View::View *view)
{
SPAction *action = make_action_helper(view, &vector);
return action;
}
/** \brief Decode the verb code and take appropriate action */
void
FitCanvasVerb::perform(SPAction *action, void *data, void *pdata)
{
SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
if (!dt) return;
SPDocument *doc = sp_desktop_document(dt);
if (!doc) return;
switch ((long) data) {
case SP_VERB_FIT_CANVAS_TO_SELECTION:
fit_canvas_to_selection(dt);
break;
case SP_VERB_FIT_CANVAS_TO_DRAWING:
fit_canvas_to_drawing(doc);
break;
case SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING:
fit_canvas_to_selection_or_drawing(dt);
break;
default:
return;
}
return;
}
/* *********** End Fit Canvas ********** */
/* these must be in the same order as the SP_VERB_* enum in "verbs.h" */
Verb *Verb::_base_verbs[] = {
/* Header */
new Verb(SP_VERB_INVALID, NULL, NULL, NULL, NULL),
new Verb(SP_VERB_NONE, "None", N_("None"), N_("Does nothing"), NULL),
/* File */
new FileVerb(SP_VERB_FILE_NEW, "FileNew", N_("Default"), N_("Create new document from the default template"),
GTK_STOCK_NEW ),
new FileVerb(SP_VERB_FILE_OPEN, "FileOpen", N_("_Open..."),
N_("Open an existing document"), GTK_STOCK_OPEN ),
new FileVerb(SP_VERB_FILE_REVERT, "FileRevert", N_("Re_vert"),
N_("Revert to the last saved version of document (changes will be lost)"), GTK_STOCK_REVERT_TO_SAVED ),
new FileVerb(SP_VERB_FILE_SAVE, "FileSave", N_("_Save"), N_("Save document"),
GTK_STOCK_SAVE ),
new FileVerb(SP_VERB_FILE_SAVE_AS, "FileSaveAs", N_("Save _As..."),
N_("Save document under a new name"), GTK_STOCK_SAVE_AS ),
new FileVerb(SP_VERB_FILE_PRINT, "FilePrint", N_("_Print..."), N_("Print document"),
GTK_STOCK_PRINT ),
// TRANSLATORS: "Vacuum Defs" means "Clean up defs" (so as to remove unused definitions)
new FileVerb(SP_VERB_FILE_VACUUM, "FileVacuum", N_("Vac_uum Defs"), N_("Remove unused definitions (such as gradients or clipping paths) from the &lt;defs&gt; of the document"),
"file_vacuum" ),
new FileVerb(SP_VERB_FILE_PRINT_DIRECT, "FilePrintDirect", N_("Print _Direct"),
N_("Print directly without prompting to a file or pipe"), NULL ),
new FileVerb(SP_VERB_FILE_PRINT_PREVIEW, "FilePrintPreview", N_("Print Previe_w"),
N_("Preview document printout"), GTK_STOCK_PRINT_PREVIEW ),
new FileVerb(SP_VERB_FILE_IMPORT, "FileImport", N_("_Import..."),
N_("Import a bitmap or SVG image into this document"), "file_import"),
new FileVerb(SP_VERB_FILE_EXPORT, "FileExport", N_("_Export Bitmap..."),
N_("Export this document or a selection as a bitmap image"), "file_export"),
new FileVerb(SP_VERB_FILE_NEXT_DESKTOP, "NextWindow", N_("N_ext Window"),
N_("Switch to the next document window"), "window_next"),
new FileVerb(SP_VERB_FILE_PREV_DESKTOP, "PrevWindow", N_("P_revious Window"),
N_("Switch to the previous document window"), "window_previous"),
new FileVerb(SP_VERB_FILE_CLOSE_VIEW, "FileClose", N_("_Close"),
N_("Close this document window"), GTK_STOCK_CLOSE),
new FileVerb(SP_VERB_FILE_QUIT, "FileQuit", N_("_Quit"), N_("Quit Inkscape"), GTK_STOCK_QUIT),
/* Edit */
new EditVerb(SP_VERB_EDIT_UNDO, "EditUndo", N_("_Undo"), N_("Undo last action"),
GTK_STOCK_UNDO),
new EditVerb(SP_VERB_EDIT_REDO, "EditRedo", N_("_Redo"),
N_("Do again the last undone action"), GTK_STOCK_REDO),
new EditVerb(SP_VERB_EDIT_CUT, "EditCut", N_("Cu_t"),
N_("Cut selection to clipboard"), GTK_STOCK_CUT),
new EditVerb(SP_VERB_EDIT_COPY, "EditCopy", N_("_Copy"),
N_("Copy selection to clipboard"), GTK_STOCK_COPY),
new EditVerb(SP_VERB_EDIT_PASTE, "EditPaste", N_("_Paste"),
N_("Paste objects from clipboard to mouse point, or paste text"), GTK_STOCK_PASTE),
new EditVerb(SP_VERB_EDIT_PASTE_STYLE, "EditPasteStyle", N_("Paste _Style"),
N_("Apply the style of the copied object to selection"), "selection_paste_style"),
new EditVerb(SP_VERB_EDIT_PASTE_SIZE, "EditPasteSize", N_("Paste Si_ze"),
N_("Scale selection to match the size of the copied object"), NULL),
new EditVerb(SP_VERB_EDIT_PASTE_SIZE_X, "EditPasteWidth", N_("Paste _Width"),
N_("Scale selection horizontally to match the width of the copied object"), NULL),
new EditVerb(SP_VERB_EDIT_PASTE_SIZE_Y, "EditPasteHeight", N_("Paste _Height"),
N_("Scale selection vertically to match the height of the copied object"), NULL),
new EditVerb(SP_VERB_EDIT_PASTE_SIZE_SEPARATELY, "EditPasteSizeSeparately", N_("Paste Size Separately"),
N_("Scale each selected object to match the size of the copied object"), NULL),
new EditVerb(SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_X, "EditPasteWidthSeparately", N_("Paste Width Separately"),
N_("Scale each selected object horizontally to match the width of the copied object"), NULL),
new EditVerb(SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_Y, "EditPasteHeightSeparately", N_("Paste Height Separately"),
N_("Scale each selected object vertically to match the height of the copied object"), NULL),
new EditVerb(SP_VERB_EDIT_PASTE_IN_PLACE, "EditPasteInPlace", N_("Paste _In Place"),
N_("Paste objects from clipboard to the original location"), "selection_paste_in_place"),
new EditVerb(SP_VERB_EDIT_DELETE, "EditDelete", N_("_Delete"),
N_("Delete selection"), GTK_STOCK_DELETE),
new EditVerb(SP_VERB_EDIT_DUPLICATE, "EditDuplicate", N_("Duplic_ate"),
N_("Duplicate selected objects"), "edit_duplicate"),
new EditVerb(SP_VERB_EDIT_CLONE, "EditClone", N_("Create Clo_ne"),
N_("Create a clone (a copy linked to the original) of selected object"), "edit_clone"),
new EditVerb(SP_VERB_EDIT_UNLINK_CLONE, "EditUnlinkClone", N_("Unlin_k Clone"),
N_("Cut the selected clone's link to its original, turning it into a standalone object"), "edit_unlink_clone"),
new EditVerb(SP_VERB_EDIT_CLONE_ORIGINAL, "EditCloneOriginal", N_("Select _Original"),
N_("Select the object to which the selected clone is linked"), NULL),
// TRANSLATORS: Convert selection to a rectangle with tiled pattern fill
new EditVerb(SP_VERB_EDIT_TILE, "ObjectsToPattern", N_("Objects to Patter_n"),
N_("Convert selection to a rectangle with tiled pattern fill"), NULL),
// TRANSLATORS: Extract objects from a tiled pattern fill
new EditVerb(SP_VERB_EDIT_UNTILE, "ObjectsFromPattern", N_("Pattern to _Objects"),
N_("Extract objects from a tiled pattern fill"), NULL),
new EditVerb(SP_VERB_EDIT_CLEAR_ALL, "EditClearAll", N_("Clea_r All"),
N_("Delete all objects from document"), NULL),
new EditVerb(SP_VERB_EDIT_SELECT_ALL, "EditSelectAll", N_("Select Al_l"),
N_("Select all objects or all nodes"), "selection_select_all"),
new EditVerb(SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS, "EditSelectAllInAllLayers", N_("Select All in All La_yers"),
N_("Select all objects in all visible and unlocked layers"), NULL),
new EditVerb(SP_VERB_EDIT_INVERT, "EditInvert", N_("In_vert Selection"),
N_("Invert selection (unselect what is selected and select everything else)"), NULL),
new EditVerb(SP_VERB_EDIT_INVERT_IN_ALL_LAYERS, "EditInvertInAllLayers", N_("Invert in All Layers"),
N_("Invert selection in all visible and unlocked layers"), NULL),
new EditVerb(SP_VERB_EDIT_DESELECT, "EditDeselect", N_("D_eselect"),
N_("Deselect any selected objects or nodes"), NULL),
/* Selection */
new SelectionVerb(SP_VERB_SELECTION_TO_FRONT, "SelectionToFront", N_("Raise to _Top"),
N_("Raise selection to top"), "selection_top"),
new SelectionVerb(SP_VERB_SELECTION_TO_BACK, "SelectionToBack", N_("Lower to _Bottom"),
N_("Lower selection to bottom"), "selection_bot"),
new SelectionVerb(SP_VERB_SELECTION_RAISE, "SelectionRaise", N_("_Raise"),
N_("Raise selection one step"), "selection_up"),
new SelectionVerb(SP_VERB_SELECTION_LOWER, "SelectionLower", N_("_Lower"),
N_("Lower selection one step"), "selection_down"),
new SelectionVerb(SP_VERB_SELECTION_GROUP, "SelectionGroup", N_("_Group"),
N_("Group selected objects"), "selection_group"),
new SelectionVerb(SP_VERB_SELECTION_UNGROUP, "SelectionUnGroup", N_("_Ungroup"),
N_("Ungroup selected groups"), "selection_ungroup"),
new SelectionVerb(SP_VERB_SELECTION_TEXTTOPATH, "SelectionTextToPath", N_("_Put on Path"),
N_("Put text on path"), NULL),
new SelectionVerb(SP_VERB_SELECTION_TEXTFROMPATH, "SelectionTextFromPath", N_("_Remove from Path"),
N_("Remove text from path"), NULL),
new SelectionVerb(SP_VERB_SELECTION_REMOVE_KERNS, "SelectionTextRemoveKerns", N_("Remove Manual _Kerns"),
// TRANSLATORS: "glyph": An image used in the visual representation of characters;
// roughly speaking, how a character looks. A font is a set of glyphs.
N_("Remove all manual kerns and glyph rotations from a text object"), NULL),
new SelectionVerb(SP_VERB_SELECTION_UNION, "SelectionUnion", N_("_Union"),
N_("Create union of selected paths"), "union"),
new SelectionVerb(SP_VERB_SELECTION_INTERSECT, "SelectionIntersect", N_("_Intersection"),
N_("Create intersection of selected paths"), "intersection"),
new SelectionVerb(SP_VERB_SELECTION_DIFF, "SelectionDiff", N_("_Difference"),
N_("Create difference of selected paths (bottom minus top)"), "difference"),
new SelectionVerb(SP_VERB_SELECTION_SYMDIFF, "SelectionSymDiff", N_("E_xclusion"),
N_("Create exclusive OR of selected paths (those parts that belong to only one path)"), "exclusion"),
new SelectionVerb(SP_VERB_SELECTION_CUT, "SelectionDivide", N_("Di_vision"),
N_("Cut the bottom path into pieces"), "division"),
// TRANSLATORS: "to cut a path" is not the same as "to break a path apart" - see the
// Advanced tutorial for more info
new SelectionVerb(SP_VERB_SELECTION_SLICE, "SelectionCutPath", N_("Cut _Path"),
N_("Cut the bottom path's stroke into pieces, removing fill"), "cut_path"),
// TRANSLATORS: "outset": expand a shape by offsetting the object's path,
// i.e. by displacing it perpendicular to the path in each point.
// See also the Advanced Tutorial for explanation.
new SelectionVerb(SP_VERB_SELECTION_OFFSET, "SelectionOffset", N_("Outs_et"),
N_("Outset selected paths"), "outset_path"),
new SelectionVerb(SP_VERB_SELECTION_OFFSET_SCREEN, "SelectionOffsetScreen",
N_("O_utset Path by 1 px"),
N_("Outset selected paths by 1 px"), NULL),
new SelectionVerb(SP_VERB_SELECTION_OFFSET_SCREEN_10, "SelectionOffsetScreen10",
N_("O_utset Path by 10 px"),
N_("Outset selected paths by 10 px"), NULL),
// TRANSLATORS: "inset": contract a shape by offsetting the object's path,
// i.e. by displacing it perpendicular to the path in each point.
// See also the Advanced Tutorial for explanation.
new SelectionVerb(SP_VERB_SELECTION_INSET, "SelectionInset", N_("I_nset"),
N_("Inset selected paths"), "inset_path"),
new SelectionVerb(SP_VERB_SELECTION_INSET_SCREEN, "SelectionInsetScreen",
N_("I_nset Path by 1 px"),
N_("Inset selected paths by 1 px"), NULL),
new SelectionVerb(SP_VERB_SELECTION_INSET_SCREEN_10, "SelectionInsetScreen10",
N_("I_nset Path by 10 px"),
N_("Inset selected paths by 10 px"), NULL),
new SelectionVerb(SP_VERB_SELECTION_DYNAMIC_OFFSET, "SelectionDynOffset",
N_("D_ynamic Offset"), N_("Create a dynamic offset object"), "dynamic_offset"),
new SelectionVerb(SP_VERB_SELECTION_LINKED_OFFSET, "SelectionLinkedOffset",
N_("_Linked Offset"),
N_("Create a dynamic offset object linked to the original path"),
"linked_offset"),
new SelectionVerb(SP_VERB_SELECTION_OUTLINE, "StrokeToPath", N_("_Stroke to Path"),
N_("Convert selected object's stroke to paths"), "stroke_tocurve"),
new SelectionVerb(SP_VERB_SELECTION_SIMPLIFY, "SelectionSimplify", N_("Si_mplify"),
N_("Simplify selected paths (remove extra nodes)"), "simplify"),
new SelectionVerb(SP_VERB_SELECTION_REVERSE, "SelectionReverse", N_("_Reverse"),
N_("Reverse the direction of selected paths (useful for flipping markers)"), "selection_reverse"),
// TRANSLATORS: "to trace" means "to convert a bitmap to vector graphics" (to vectorize)
new SelectionVerb(SP_VERB_SELECTION_TRACE, "SelectionTrace", N_("_Trace Bitmap..."),
N_("Create one or more paths from a bitmap by tracing it"), "selection_trace"),
new SelectionVerb(SP_VERB_SELECTION_CREATE_BITMAP, "SelectionCreateBitmap", N_("_Make a Bitmap Copy"),
N_("Export selection to a bitmap and insert it into document"), "selection_bitmap" ),
new SelectionVerb(SP_VERB_SELECTION_COMBINE, "SelectionCombine", N_("_Combine"),
N_("Combine several paths into one"), "selection_combine"),
// TRANSLATORS: "to cut a path" is not the same as "to break a path apart" - see the
// Advanced tutorial for more info
new SelectionVerb(SP_VERB_SELECTION_BREAK_APART, "SelectionBreakApart", N_("Break _Apart"),
N_("Break selected paths into subpaths"), "selection_break"),
new SelectionVerb(SP_VERB_SELECTION_GRIDTILE, "DialogGridArrange", N_("Gri_d Arrange..."),
N_("Arrange selected objects in a grid pattern"), "grid_arrange"),
/* Layer */
new LayerVerb(SP_VERB_LAYER_NEW, "LayerNew", N_("_Add Layer..."),
N_("Create a new layer"), "new_layer"),
new LayerVerb(SP_VERB_LAYER_RENAME, "LayerRename", N_("Re_name Layer..."),
N_("Rename the current layer"), "rename_layer"),
new LayerVerb(SP_VERB_LAYER_NEXT, "LayerNext", N_("Switch to Layer Abov_e"),
N_("Switch to the layer above the current"), "switch_to_layer_above"),
new LayerVerb(SP_VERB_LAYER_PREV, "LayerPrev", N_("Switch to Layer Belo_w"),
N_("Switch to the layer below the current"), "switch_to_layer_below"),
new LayerVerb(SP_VERB_LAYER_MOVE_TO_NEXT, "LayerMoveToNext", N_("Move Selection to Layer Abo_ve"),
N_("Move selection to the layer above the current"), "move_selection_above"),
new LayerVerb(SP_VERB_LAYER_MOVE_TO_PREV, "LayerMoveToPrev", N_("Move Selection to Layer Bel_ow"),
N_("Move selection to the layer below the current"), "move_selection_below"),
new LayerVerb(SP_VERB_LAYER_TO_TOP, "LayerToTop", N_("Layer to _Top"),
N_("Raise the current layer to the top"), "layer_to_top"),
new LayerVerb(SP_VERB_LAYER_TO_BOTTOM, "LayerToBottom", N_("Layer to _Bottom"),
N_("Lower the current layer to the bottom"), "layer_to_bottom"),
new LayerVerb(SP_VERB_LAYER_RAISE, "LayerRaise", N_("_Raise Layer"),
N_("Raise the current layer"), "raise_layer"),
new LayerVerb(SP_VERB_LAYER_LOWER, "LayerLower", N_("_Lower Layer"),
N_("Lower the current layer"), "lower_layer"),
new LayerVerb(SP_VERB_LAYER_DELETE, "LayerDelete", N_("_Delete Current Layer"),
N_("Delete the current layer"), "delete_layer"),
/* Object */
new ObjectVerb(SP_VERB_OBJECT_ROTATE_90_CW, "ObjectRotate90", N_("Rotate _90&#176; CW"),
N_("Rotate selection 90&#176; clockwise"), "object_rotate_90_CW"),
new ObjectVerb(SP_VERB_OBJECT_ROTATE_90_CCW, "ObjectRotate90CCW", N_("Rotate 9_0&#176; CCW"),
N_("Rotate selection 90&#176; counter-clockwise"), "object_rotate_90_CCW"),
new ObjectVerb(SP_VERB_OBJECT_FLATTEN, "ObjectRemoveTransform", N_("Remove _Transformations"),
N_("Remove transformations from object"), "object_reset"),
new ObjectVerb(SP_VERB_OBJECT_TO_CURVE, "ObjectToPath", N_("_Object to Path"),
N_("Convert selected object to path"), "object_tocurve"),
new ObjectVerb(SP_VERB_OBJECT_FLOW_TEXT, "ObjectFlowText", N_("_Flow into Frame"),
N_("Put text into a frame (path or shape), creating a flowed text linked to the frame object"), NULL),
new ObjectVerb(SP_VERB_OBJECT_UNFLOW_TEXT, "ObjectUnFlowText", N_("_Unflow"),
N_("Remove text from frame (creates a single-line text object)"), NULL),
new ObjectVerb(SP_VERB_OBJECT_FLOWTEXT_TO_TEXT, "ObjectFlowtextToText", N_("_Convert to Text"),
N_("Convert flowed text to regular text object (preserves appearance)"), NULL),
new ObjectVerb(SP_VERB_OBJECT_FLIP_HORIZONTAL, "ObjectFlipHorizontally",
N_("Flip _Horizontal"), N_("Flip selected objects horizontally"),
"object_flip_hor"),
new ObjectVerb(SP_VERB_OBJECT_FLIP_VERTICAL, "ObjectFlipVertically",
N_("Flip _Vertical"), N_("Flip selected objects vertically"),
"object_flip_ver"),
new ObjectVerb(SP_VERB_OBJECT_SET_MASK, "ObjectSetMask", N_("_Set"),
N_("Apply mask to selection (using the topmost object as mask)"), NULL),
new ObjectVerb(SP_VERB_OBJECT_UNSET_MASK, "ObjectUnSetMask", N_("_Release"),
N_("Remove mask from selection"), NULL),
new ObjectVerb(SP_VERB_OBJECT_SET_CLIPPATH, "ObjectSetClipPath", N_("_Set"),
N_("Apply clipping path to selection (using the topmost object as clipping path)"), NULL),
new ObjectVerb(SP_VERB_OBJECT_UNSET_CLIPPATH, "ObjectUnSetClipPath", N_("_Release"),
N_("Remove clipping path from selection"), NULL),
/* Tools */
new ContextVerb(SP_VERB_CONTEXT_SELECT, "ToolSelector", N_("Select"),
N_("Select and transform objects"), "draw_select"),
new ContextVerb(SP_VERB_CONTEXT_NODE, "ToolNode", N_("Node Edit"),
N_("Edit path nodes or control handles"), "draw_node"),
new ContextVerb(SP_VERB_CONTEXT_RECT, "ToolRect", N_("Rectangle"),
N_("Create rectangles and squares"), "draw_rect"),
new ContextVerb(SP_VERB_CONTEXT_ARC, "ToolArc", N_("Ellipse"),
N_("Create circles, ellipses, and arcs"), "draw_arc"),
new ContextVerb(SP_VERB_CONTEXT_STAR, "ToolStar", N_("Star"),
N_("Create stars and polygons"), "draw_star"),
new ContextVerb(SP_VERB_CONTEXT_SPIRAL, "ToolSpiral", N_("Spiral"),
N_("Create spirals"), "draw_spiral"),
new ContextVerb(SP_VERB_CONTEXT_PENCIL, "ToolPencil", N_("Pencil"),
N_("Draw freehand lines"), "draw_freehand"),
new ContextVerb(SP_VERB_CONTEXT_PEN, "ToolPen", N_("Pen"),
N_("Draw Bezier curves and straight lines"), "draw_pen"),
new ContextVerb(SP_VERB_CONTEXT_CALLIGRAPHIC, "ToolCalligrphic", N_("Calligraphy"),
N_("Draw calligraphic lines"), "draw_calligraphic"),
new ContextVerb(SP_VERB_CONTEXT_TEXT, "ToolText", N_("Text"),
N_("Create and edit text objects"), "draw_text"),
new ContextVerb(SP_VERB_CONTEXT_GRADIENT, "ToolGradient", N_("Gradient"),
N_("Create and edit gradients"), "draw_gradient"),
new ContextVerb(SP_VERB_CONTEXT_ZOOM, "ToolZoom", N_("Zoom"),
N_("Zoom in or out"), "draw_zoom"),
new ContextVerb(SP_VERB_CONTEXT_DROPPER, "ToolDropper", N_("Dropper"),
N_("Pick averaged colors from image"), "draw_dropper"),
new ContextVerb(SP_VERB_CONTEXT_CONNECTOR, "ToolConnector", N_("Connector"),
N_("Create connectors"), "draw_connector"),
/* Tool prefs */
new ContextVerb(SP_VERB_CONTEXT_SELECT_PREFS, "SelectPrefs", N_("Selector Preferences"),
N_("Open Preferences for the Selector tool"), NULL),
new ContextVerb(SP_VERB_CONTEXT_NODE_PREFS, "NodePrefs", N_("Node Tool Preferences"),
N_("Open Preferences for the Node tool"), NULL),
new ContextVerb(SP_VERB_CONTEXT_RECT_PREFS, "RectPrefs", N_("Rectangle Preferences"),
N_("Open Preferences for the Rectangle tool"), NULL),
new ContextVerb(SP_VERB_CONTEXT_ARC_PREFS, "ArcPrefs", N_("Ellipse Preferences"),
N_("Open Preferences for the Ellipse tool"), NULL),
new ContextVerb(SP_VERB_CONTEXT_STAR_PREFS, "StarPrefs", N_("Star Preferences"),
N_("Open Preferences for the Star tool"), NULL),
new ContextVerb(SP_VERB_CONTEXT_SPIRAL_PREFS, "SpiralPrefs", N_("Spiral Preferences"),
N_("Open Preferences for the Spiral tool"), NULL),
new ContextVerb(SP_VERB_CONTEXT_PENCIL_PREFS, "PencilPrefs", N_("Pencil Preferences"),
N_("Open Preferences for the Pencil tool"), NULL),
new ContextVerb(SP_VERB_CONTEXT_PEN_PREFS, "PenPrefs", N_("Pen Preferences"),
N_("Open Preferences for the Pen tool"), NULL),
new ContextVerb(SP_VERB_CONTEXT_CALLIGRAPHIC_PREFS, "CalligraphicPrefs", N_("Calligraphic Preferences"),
N_("Open Preferences for the Calligraphy tool"), NULL),
new ContextVerb(SP_VERB_CONTEXT_TEXT_PREFS, "TextPrefs", N_("Text Preferences"),
N_("Open Preferences for the Text tool"), NULL),
new ContextVerb(SP_VERB_CONTEXT_GRADIENT_PREFS, "GradientPrefs", N_("Gradient Preferences"),
N_("Open Preferences for the Gradient tool"), NULL),
new ContextVerb(SP_VERB_CONTEXT_ZOOM_PREFS, "ZoomPrefs", N_("Zoom Preferences"),
N_("Open Preferences for the Zoom tool"), NULL),
new ContextVerb(SP_VERB_CONTEXT_DROPPER_PREFS, "DropperPrefs", N_("Dropper Preferences"),
N_("Open Preferences for the Dropper tool"), NULL),
new ContextVerb(SP_VERB_CONTEXT_CONNECTOR_PREFS, "ConnectorPrefs", N_("Connector Preferences"),
N_("Open Preferences for the Connector tool"), NULL),
/* Zoom/View */
new ZoomVerb(SP_VERB_ZOOM_IN, "ZoomIn", N_("Zoom In"), N_("Zoom in"), "zoom_in"),
new ZoomVerb(SP_VERB_ZOOM_OUT, "ZoomOut", N_("Zoom Out"), N_("Zoom out"), "zoom_out"),
new ZoomVerb(SP_VERB_TOGGLE_RULERS, "ToggleRulers", N_("_Rulers"), N_("Show or hide the canvas rulers"), "rulers"),
new ZoomVerb(SP_VERB_TOGGLE_SCROLLBARS, "ToggleScrollbars", N_("Scroll_bars"), N_("Show or hide the canvas scrollbars"), "scrollbars"),
new ZoomVerb(SP_VERB_TOGGLE_GRID, "ToggleGrid", N_("_Grid"), N_("Show or hide the grid"), "grid"),
new ZoomVerb(SP_VERB_TOGGLE_GUIDES, "ToggleGuides", N_("G_uides"), N_("Show or hide guides (drag from a ruler to create a guide)"), "guides"),
new ZoomVerb(SP_VERB_ZOOM_NEXT, "ZoomNext", N_("Nex_t Zoom"), N_("Next zoom (from the history of zooms)"),
"zoom_next"),
new ZoomVerb(SP_VERB_ZOOM_PREV, "ZoomPrev", N_("Pre_vious Zoom"), N_("Previous zoom (from the history of zooms)"),
"zoom_previous"),
new ZoomVerb(SP_VERB_ZOOM_1_1, "Zoom1:0", N_("Zoom 1:_1"), N_("Zoom to 1:1"),
"zoom_1_to_1"),
new ZoomVerb(SP_VERB_ZOOM_1_2, "Zoom1:2", N_("Zoom 1:_2"), N_("Zoom to 1:2"),
"zoom_1_to_2"),
new ZoomVerb(SP_VERB_ZOOM_2_1, "Zoom2:1", N_("_Zoom 2:1"), N_("Zoom to 2:1"),
"zoom_2_to_1"),
#ifdef HAVE_GTK_WINDOW_FULLSCREEN
new ZoomVerb(SP_VERB_FULLSCREEN, "FullScreen", N_("_Fullscreen"), N_("Stretch this document window to full screen"),
"fullscreen"),
#endif /* HAVE_GTK_WINDOW_FULLSCREEN */
new ZoomVerb(SP_VERB_VIEW_NEW, "ViewNew", N_("Duplic_ate Window"), N_("Open a new window with the same document"),
"view_new"),
new ZoomVerb(SP_VERB_VIEW_NEW_PREVIEW, "ViewNewPreview", N_("_New View Preview"),
N_("New View Preview"), NULL/*"view_new_preview"*/),
new ZoomVerb(SP_VERB_VIEW_MODE_NORMAL, "ViewModeNormal", N_("_Normal"),
N_("Switch to normal display mode"), NULL),
new ZoomVerb(SP_VERB_VIEW_MODE_OUTLINE, "ViewModeOutline", N_("_Outline"),
N_("Switch to outline (wireframe) display mode"), NULL),
new ZoomVerb(SP_VERB_VIEW_ICON_PREVIEW, "ViewIconPreview", N_("Ico_n Preview..."),
N_("Open a window to preview objects at different icon resolutions"), NULL/*"view_icon_preview"*/),
new ZoomVerb(SP_VERB_ZOOM_PAGE, "ZoomPage", N_("_Page"),
N_("Zoom to fit page in window"), "zoom_page"),
new ZoomVerb(SP_VERB_ZOOM_PAGE_WIDTH, "ZoomPageWidth", N_("Page _Width"),
N_("Zoom to fit page width in window"), "zoom_pagewidth"),
new ZoomVerb(SP_VERB_ZOOM_DRAWING, "ZoomDrawing", N_("_Drawing"),
N_("Zoom to fit drawing in window"), "zoom_draw"),
new ZoomVerb(SP_VERB_ZOOM_SELECTION, "ZoomSelection", N_("_Selection"),
N_("Zoom to fit selection in window"), "zoom_select"),
/* Dialogs */
new DialogVerb(SP_VERB_DIALOG_DISPLAY, "DialogPreferences", N_("In_kscape Preferences..."),
N_("Edit global Inkscape preferences"), GTK_STOCK_PREFERENCES ),
new DialogVerb(SP_VERB_DIALOG_NAMEDVIEW, "DialogDocumentProperties", N_("_Document Properties..."),
N_("Edit properties of this document (to be saved with the document)"), GTK_STOCK_PROPERTIES ),
new DialogVerb(SP_VERB_DIALOG_METADATA, "DialogMetadata", N_("Document _Metadata..."),
N_("Edit document metadata (to be saved with the document)"), NULL ),
new DialogVerb(SP_VERB_DIALOG_FILL_STROKE, "DialogFillStroke", N_("_Fill and Stroke..."),
N_("Edit objects' style, such as color or stroke width"), "fill_and_stroke"),
// TRANSLATORS: "Swatches" means: color samples
new DialogVerb(SP_VERB_DIALOG_SWATCHES, "DialogSwatches", N_("S_watches..."),
N_("Select colors from a swatches palette"), GTK_STOCK_SELECT_COLOR),
new DialogVerb(SP_VERB_DIALOG_TRANSFORM, "DialogTransform", N_("Transfor_m..."),
N_("Precisely control objects' transformations"), "object_trans"),
new DialogVerb(SP_VERB_DIALOG_ALIGN_DISTRIBUTE, "DialogAlignDistribute", N_("_Align and Distribute..."),
N_("Align and distribute objects"), "object_align"),
new DialogVerb(SP_VERB_DIALOG_UNDO_HISTORY, "DialogUndoHistory", N_("Undo _History..."),
N_("Undo History"), "edit_undo_history"),
new DialogVerb(SP_VERB_DIALOG_TEXT, "DialogText", N_("_Text and Font..."),
N_("View and select font family, font size and other text properties"), "object_font"),
new DialogVerb(SP_VERB_DIALOG_XML_EDITOR, "DialogXMLEditor", N_("_XML Editor..."),
N_("View and edit the XML tree of the document"), "xml_editor"),
new DialogVerb(SP_VERB_DIALOG_FIND, "DialogFind", N_("_Find..."),
N_("Find objects in document"), GTK_STOCK_FIND ),
new DialogVerb(SP_VERB_DIALOG_DEBUG, "DialogDebug", N_("_Messages..."),
N_("View debug messages"), NULL),
new DialogVerb(SP_VERB_DIALOG_SCRIPT, "DialogScript", N_("S_cripts..."),
N_("Run scripts"), NULL),
new DialogVerb(SP_VERB_DIALOG_TOGGLE, "DialogsToggle", N_("Show/Hide D_ialogs"),
N_("Show or hide all open dialogs"), "dialog_toggle"),
// TRANSLATORS: "Tile Clones" means: "Create tiled clones"
new DialogVerb(SP_VERB_DIALOG_CLONETILER, "DialogClonetiler", N_("Create Tiled Clones..."),
N_("Create multiple clones of selected object, arranging them into a pattern or scattering"), NULL),
new DialogVerb(SP_VERB_DIALOG_ITEM, "DialogObjectProperties", N_("_Object Properties..."),
N_("Edit the ID, locked and visible status, and other object properties"), "dialog_item_properties"),
#ifdef WITH_INKBOARD
new DialogVerb(SP_VERB_XMPP_CLIENT, "DialogXmppClient",
N_("_Instant Messaging..."), N_("Jabber Instant Messaging Client"), NULL),
#endif
new DialogVerb(SP_VERB_DIALOG_INPUT, "DialogInput", N_("_Input Devices..."),
N_("Configure extended input devices, such as a graphics tablet"), NULL),
new DialogVerb(SP_VERB_DIALOG_EXTENSIONEDITOR, "org.inkscape.dialogs.extensioneditor", N_("_Extensions..."),
N_("Query information about extensions"), NULL),
new DialogVerb(SP_VERB_DIALOG_LAYERS, "DialogLayers", N_("Layer_s..."),
N_("View Layers"), NULL),
/* Help */
new HelpVerb(SP_VERB_HELP_KEYS, "HelpKeys", N_("_Keys and Mouse"),
N_("Keys and mouse shortcuts reference"), "help_keys"),
new HelpVerb(SP_VERB_HELP_ABOUT_EXTENSIONS, "HelpAboutExtensions", N_("About E_xtensions"),
N_("Information on Inkscape extensions"), NULL),
new HelpVerb(SP_VERB_HELP_MEMORY, "HelpAboutMemory", N_("About _Memory"),
N_("Memory usage information"), NULL),
new HelpVerb(SP_VERB_HELP_ABOUT, "HelpAbout", N_("_About Inkscape"),
N_("Inkscape version, authors, license"), /*"help_about"*/"inkscape_options"),
//new HelpVerb(SP_VERB_SHOW_LICENSE, "ShowLicense", N_("_License"),
// N_("Distribution terms"), /*"show_license"*/"inkscape_options"),
/* Tutorials */
new TutorialVerb(SP_VERB_TUTORIAL_BASIC, "TutorialsBasic", N_("Inkscape: _Basic"),
N_("Getting started with Inkscape"), NULL/*"tutorial_basic"*/),
new TutorialVerb(SP_VERB_TUTORIAL_SHAPES, "TutorialsShapes", N_("Inkscape: _Shapes"),
N_("Using shape tools to create and edit shapes"), NULL),
new TutorialVerb(SP_VERB_TUTORIAL_ADVANCED, "TutorialsAdvanced", N_("Inkscape: _Advanced"),
N_("Advanced Inkscape topics"), NULL/*"tutorial_advanced"*/),
// TRANSLATORS: "to trace" means "to convert a bitmap to vector graphics" (to vectorize)
new TutorialVerb(SP_VERB_TUTORIAL_TRACING, "TutorialsTracing", N_("Inkscape: T_racing"),
N_("Using bitmap tracing"), NULL/*"tutorial_tracing"*/),
new TutorialVerb(SP_VERB_TUTORIAL_CALLIGRAPHY, "TutorialsCalligraphy", N_("Inkscape: _Calligraphy"),
N_("Using the Calligraphy pen tool"), NULL),
new TutorialVerb(SP_VERB_TUTORIAL_DESIGN, "TutorialsDesign", N_("_Elements of Design"),
N_("Principles of design in the tutorial form"), NULL/*"tutorial_design"*/),
new TutorialVerb(SP_VERB_TUTORIAL_TIPS, "TutorialsTips", N_("_Tips and Tricks"),
N_("Miscellaneous tips and tricks"), NULL/*"tutorial_tips"*/),
/* Effect */
new EffectLastVerb(SP_VERB_EFFECT_LAST, "EffectLast", N_("Previous Effect"),
N_("Repeat the last effect with the same settings"), NULL),
new EffectLastVerb(SP_VERB_EFFECT_LAST_PREF, "EffectLastPref", N_("Previous Effect Settings..."),
N_("Repeat the last effect with new settings"), NULL),
/* Fit Page */
new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_SELECTION, "FitCanvasToSelection", N_("Fit Page to Selection"),
N_("Fit the page to the current selection"), NULL),
new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_DRAWING, "FitCanvasToDrawing", N_("Fit Page to Drawing"),
N_("Fit the page to the drawing"), NULL),
new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING, "FitCanvasToSelectionOrDrawing", N_("Fit Page to Selection or Drawing"),
N_("Fit the page to the current selection or the drawing if there is no selection"), NULL),
/* Footer */
new Verb(SP_VERB_LAST, " '\"invalid id", NULL, NULL, NULL)
};
} /* namespace Inkscape */
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :