verbs.cpp revision 8d121ffcc393b384d025e8c3fbf950a1411d21b6
/**
* \file verbs.cpp
*
* Actions for inkscape.
*
* This file implements routines necessary to deal with verbs. A verb
* is a numeric identifier used to retrieve standard SPActions for particular
* views.
*/
/*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Ted Gould <ted@gould.cx>
* MenTaLguY <mental@rydia.net>
* David Turner <novalis@gnu.org>
* bulia byak <buliabyak@users.sf.net>
* Jon A. Cruz <jon@joncruz.org>
* Abhishek Sharma
*
* Copyright (C) 2006 Johan Engelen <johan@shouraizou.nl>
* Copyright (C) 2012 Kris De Gussem <Kris.DeGussem@gmail.com>
* Copyright (C) (date unspecified) Authors
* This code is in public domain.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <cstring>
#include <string>
#endif
#include <gtkmm/filechooserdialog.h>
#include <gtkmm/messagedialog.h>
#include "bind/javabind.h"
#include "desktop.h"
#include "desktop-handles.h"
#include "document.h"
#include "draw-context.h"
#include "event-context.h"
#include "file.h"
#include "gradient-drag.h"
#include "help.h"
#include "inkscape-private.h"
#include "interface.h"
#include "layer-fns.h"
#include "layer-manager.h"
#include "message-stack.h"
#include "path-chemistry.h"
#include "preferences.h"
#include "select-context.h"
#include "selection-chemistry.h"
#include "seltrans.h"
#include "shape-editor.h"
#include "shortcuts.h"
#include "sp-flowtext.h"
#include "sp-guide.h"
#include "splivarot.h"
#include "sp-namedview.h"
#include "text-chemistry.h"
#include "tools-switch.h"
#include "ui/dialog/align-and-distribute.h"
#include "ui/dialog/clonetiler.h"
#include "ui/dialog/dialog-manager.h"
#include "ui/dialog/document-properties.h"
#include "ui/dialog/extensions.h"
#include "ui/dialog/icon-preview.h"
#include "ui/dialog/inkscape-preferences.h"
#include "ui/dialog/layer-properties.h"
#include "ui/dialog/object-properties.h"
#include "ui/dialog/swatches.h"
#include "ui/dialog/spellcheck.h"
#include "ui/icon-names.h"
#include "ui/tool/node-tool.h"
#include "selection.h"
using Inkscape::DocumentUndo;
/**
* Return the name without underscores and ellipsis, for use in dialog
* titles, etc. Allocated memory must be freed by caller.
*/
{
unsigned ri = 0;
if ( c != '_' && c != '.' ) {
ri++;
if (c == '\0') {
return ret;
}
}
}
} // end of sp_action_get_title()
namespace Inkscape {
/**
* A class to encompass all of the verbs which deal with file operations.
*/
private:
protected:
public:
/** Use the Verb initializer with the same parameters. */
{ }
}; // FileVerb class
/**
* A class to encompass all of the verbs which deal with edit operations.
*/
private:
protected:
public:
/** Use the Verb initializer with the same parameters. */
{ }
}; // EditVerb class
/**
* A class to encompass all of the verbs which deal with selection operations.
*/
class SelectionVerb : public Verb {
private:
protected:
public:
/** Use the Verb initializer with the same parameters. */
SelectionVerb(unsigned int const code,
{ }
}; // SelectionVerb class
/**
* A class to encompass all of the verbs which deal with layer operations.
*/
private:
protected:
public:
/** Use the Verb initializer with the same parameters. */
{ }
}; // LayerVerb class
/**
* A class to encompass all of the verbs which deal with operations related to objects.
*/
class ObjectVerb : public Verb {
private:
protected:
public:
/** Use the Verb initializer with the same parameters. */
ObjectVerb(unsigned int const code,
{ }
}; // ObjectVerb class
/**
* A class to encompass all of the verbs which deal with operations relative to context.
*/
class ContextVerb : public Verb {
private:
protected:
public:
/** Use the Verb initializer with the same parameters. */
ContextVerb(unsigned int const code,
{ }
}; // ContextVerb class
/**
* A class to encompass all of the verbs which deal with zoom operations.
*/
private:
protected:
public:
/** Use the Verb initializer with the same parameters. */
{ }
}; // ZoomVerb class
/**
* A class to encompass all of the verbs which deal with dialog operations.
*/
class DialogVerb : public Verb {
private:
protected:
public:
/** Use the Verb initializer with the same parameters. */
DialogVerb(unsigned int const code,
{ }
}; // DialogVerb class
/**
* A class to encompass all of the verbs which deal with help operations.
*/
private:
protected:
public:
/** Use the Verb initializer with the same parameters. */
{ }
}; // HelpVerb class
/**
* A class to encompass all of the verbs which deal with tutorial operations.
*/
class TutorialVerb : public Verb {
private:
protected:
public:
/** Use the Verb initializer with the same parameters. */
TutorialVerb(unsigned int const code,
{ }
}; // TutorialVerb class
/**
* A class to encompass all of the verbs which deal with text operations.
*/
private:
protected:
public:
/** Use the Verb initializer with the same parameters. */
{ }
}; //TextVerb : public Verb
/**
* Create a verb without a code.
*
* This function calls the other constructor for all of the parameters,
* but generates the code. It is important to READ THE OTHER DOCUMENTATION
* it has important details in it. To generate the code a static is
* used which starts at the last static value: \c SP_VERB_LAST. For
* each call it is incremented. The list of allocated verbs is kept
* in the \c _verbs hashtable which is indexed by the \c code.
*/
Verb::Verb(gchar const *id, gchar const *name, gchar const *tip, gchar const *image, gchar const *group) :
_actions(0),
_full_tip(0),
_shortcut(0),
_code(0),
_default_sensitive(false)
{
static int count = SP_VERB_LAST;
count++;
}
/**
* Destroy a verb.
*
* The only allocated variable is the _actions variable. If it has
* been allocated it is deleted.
*/
{
/// \todo all the actions need to be cleaned up first.
delete _actions;
if (_full_tip) {
_full_tip = 0;
}
}
/**
* Verbs are no good without actions. This is a place holder
* for a function that every subclass should write. Most
* can be written using \c make_action_helper.
*
* @param view Which view the action should be created for.
* @return NULL to represent error (this function shouldn't ever be called)
*/
{
//std::cout << "make_action" << std::endl;
return NULL;
}
/**
* Create an action for a \c FileVerb.
* Calls \c make_action_helper with the \c vector.
*
* @param view Which view the action should be created for.
* @return The built action.
*/
{
//std::cout << "fileverb: make_action: " << &perform << std::endl;
}
/**
* Create an action for a \c EditVerb.
*
* Calls \c make_action_helper with the \c vector.
*
* @param view Which view the action should be created for.
* @return The built action.
*/
{
//std::cout << "editverb: make_action: " << &perform << std::endl;
}
/**
* Create an action for a \c SelectionVerb.
*
* Calls \c make_action_helper with the \c vector.
*
* @param view Which view the action should be created for.
* @return The built action.
*/
{
}
/**
* Create an action for a \c LayerVerb.
*
* Calls \c make_action_helper with the \c vector.
*
* @param view Which view the action should be created for.
* @return The built action.
*/
{
}
/**
* Create an action for a \c ObjectVerb.
*
* Calls \c make_action_helper with the \c vector.
*
* @param view Which view the action should be created for.
* @return The built action.
*/
{
}
/**
* Create an action for a \c ContextVerb.
*
* Calls \c make_action_helper with the \c vector.
*
* @param view Which view the action should be created for.
* @return The built action.
*/
{
}
/**
* Create an action for a \c ZoomVerb.
*
* Calls \c make_action_helper with the \c vector.
*
* @param view Which view the action should be created for.
* @return The built action.
*/
{
}
/**
* Create an action for a \c DialogVerb.
*
* Calls \c make_action_helper with the \c vector.
*
* @param view Which view the action should be created for.
* @return The built action.
*/
{
}
/**
* Create an action for a \c HelpVerb.
*
* Calls \c make_action_helper with the \c vector.
*
* @param view Which view the action should be created for.
* @return The built action.
*/
{
}
/**
* Create an action for a \c TutorialVerb.
*
* Calls \c make_action_helper with the \c vector.
*
* @param view Which view the action should be created for.
* @return The built action.
*/
{
}
/**
* Create an action for a \c TextVerb.
*
* Calls \c make_action_helper with the \c vector.
*
* @param view Which view the action should be created for.
* @return The built action.
*/
{
}
/**
* A quick little convience function to make building actions
* a little bit easier.
*
* This function does a couple of things. The most obvious is that
* it allocates and creates the action. When it does this it
* translates the \c _name and \c _tip variables. This allows them
* to be staticly allocated easily, and get translated in the end. Then,
* if the action gets crated, a listener is added to the action with
* the vector that is passed in.
*
* @param view Which view the action should be created for.
* @param vector The function vector for the verb.
* @return The created action.
*/
SPAction *Verb::make_action_helper(Inkscape::UI::View::View *view, void (*perform_fun)(SPAction *, void *), void *in_pntr)
{
//std::cout << "Adding action: " << _code << std::endl;
action));
return action;
}
/**
* A function to get an action if it exists, or otherwise to build it.
*
* This function will get the action for a given view for this verb. It
* will create the verb if it can't be found in the ActionTable. Also,
* if the \c ActionTable has not been created, it gets created by this
* function.
*
* If the action is created, it's sensitivity must be determined. The
* default for a new action is that it is sensitive. If the value in
* \c _default_sensitive is \c false, then the sensitivity must be
* removed. Also, if the view being created is based on the same
* document as a view already created, the sensitivity should be the
* same as views on that document. A view with the same document is
* looked for, and the sensitivity is matched. Unfortunately, this is
* currently a linear search.
*
* @param view The view which this action would relate to.
* @return The action, or NULL if there is an error.
*/
{
_actions = new ActionTable;
}
} else {
// if (action == NULL) printf("Hmm, NULL in %s\n", _name);
if (!_default_sensitive) {
} else {
++cur_action) {
break;
}
}
}
}
return action;
}
{
// printf("Setting sensitivity of \"%s\" to %d\n", _name, in_sensitive);
++cur_action) {
}
}
}
}
return;
}
/**
* Accessor to get the tooltip for verb as localised string.
*/
{
if (_tip) {
unsigned int shortcut = sp_shortcut_get_primary(this);
if (_full_tip) {
_full_tip = 0;
}
if (shortcutString) {
shortcutString = 0;
} else {
}
}
}
return result;
}
void
{
++cur_action) {
}
}
}
}
/**
* A function to remove the action associated with a view.
*
* This function looks for the action in \c _actions. If it is
* found then it is unreferenced and the entry in the action
* table is erased.
*
* @param view Which view's actions should be removed.
* @return None
*/
{
#if 0
static int count = 0;
#endif
}
return;
}
/**
* A function to delete a view from all verbs.
*
* This function first looks through _base_verbs and deteles
* the view from all of those views. If \c _verbs is not empty
* then all of the entries in that table have all of the views
* deleted also.
*
* @param view Which view's actions should be removed.
* @return None
*/
{
for (int i = 0; i <= SP_VERB_LAST; i++) {
if (_base_verbs[i])
}
// std::cout << "Delete In Verb: " << verbpntr->_name << std::endl;
}
}
return;
}
/**
* A function to turn a \c code into a Verb for dynamically created Verbs.
*
* This function basically just looks through the \c _verbs hash
* table. STL does all the work.
*
* @param code What code is being looked for.
* @return The found Verb of NULL if none is found.
*/
{
}
return verb;
}
/**
* Find a Verb using it's ID.
*
* This function uses the \c _verb_ids has table to find the
* verb by it's id. Should be much faster than previous
* implementations.
*
* @param id Which id to search for.
*/
{
}
return verb;
}
/**
* Decode the verb code and take appropriate action.
*/
{
#if 0
// These aren't used, but are here to remind people not to use
// the CURRENT_DOCUMENT macros unless they really have to.
#endif
case SP_VERB_FILE_NEW:
break;
case SP_VERB_FILE_OPEN:
break;
case SP_VERB_FILE_REVERT:
break;
case SP_VERB_FILE_SAVE:
break;
case SP_VERB_FILE_SAVE_AS:
break;
case SP_VERB_FILE_SAVE_A_COPY:
break;
case SP_VERB_FILE_PRINT:
break;
case SP_VERB_FILE_VACUUM:
break;
case SP_VERB_FILE_IMPORT:
break;
// case SP_VERB_FILE_EXPORT:
// sp_file_export_dialog(*parent);
// break;
break;
// case SP_VERB_FILE_EXPORT_TO_OCAL:
// sp_file_export_to_ocal(*parent);
// break;
break;
break;
case SP_VERB_FILE_CLOSE_VIEW:
break;
case SP_VERB_FILE_QUIT:
sp_file_exit();
break;
default:
break;
}
} // end of sp_verb_action_file_perform()
/**
* Decode the verb code and take appropriate action.
*/
{
if (!dt)
return;
case SP_VERB_EDIT_UNDO:
break;
case SP_VERB_EDIT_REDO:
break;
case SP_VERB_EDIT_CUT:
break;
case SP_VERB_EDIT_COPY:
break;
case SP_VERB_EDIT_PASTE:
sp_selection_paste(dt, false);
break;
case SP_VERB_EDIT_PASTE_STYLE:
break;
case SP_VERB_EDIT_PASTE_SIZE:
sp_selection_paste_size(dt, true, true);
break;
sp_selection_paste_size(dt, true, false);
break;
sp_selection_paste_size(dt, false, true);
break;
sp_selection_paste_size_separately(dt, true, true);
break;
sp_selection_paste_size_separately(dt, true, false);
break;
sp_selection_paste_size_separately(dt, false, true);
break;
sp_selection_paste(dt, true);
break;
break;
break;
break;
case SP_VERB_EDIT_DELETE:
break;
case SP_VERB_EDIT_DUPLICATE:
break;
case SP_VERB_EDIT_CLONE:
break;
break;
break;
break;
break;
break;
break;
case SP_VERB_EDIT_TILE:
break;
case SP_VERB_EDIT_UNTILE:
break;
case SP_VERB_EDIT_SYMBOL:
break;
case SP_VERB_EDIT_UNSYMBOL:
break;
case SP_VERB_EDIT_CLEAR_ALL:
break;
case SP_VERB_EDIT_SELECT_ALL:
break;
break;
break;
break;
break;
break;
case SP_VERB_EDIT_INVERT:
break;
break;
break;
case SP_VERB_EDIT_SELECT_NEXT:
break;
case SP_VERB_EDIT_SELECT_PREV:
break;
case SP_VERB_EDIT_DESELECT:
break;
break;
break;
break;
break;
break;
default:
break;
}
} // end of sp_verb_action_edit_perform()
/**
* Decode the verb code and take appropriate action.
*/
{
if (!dt)
return;
break;
break;
case SP_VERB_SELECTION_RAISE:
break;
case SP_VERB_SELECTION_LOWER:
break;
case SP_VERB_SELECTION_GROUP:
break;
break;
break;
break;
break;
case SP_VERB_SELECTION_UNION:
break;
break;
case SP_VERB_SELECTION_DIFF:
break;
break;
case SP_VERB_SELECTION_CUT:
break;
case SP_VERB_SELECTION_SLICE:
break;
case SP_VERB_SELECTION_OFFSET:
break;
break;
break;
case SP_VERB_SELECTION_INSET:
break;
break;
break;
break;
break;
break;
break;
break;
case SP_VERB_SELECTION_TRACE:
break;
break;
break;
break;
break;
default:
break;
}
} // end of sp_verb_action_selection_perform()
/**
* Decode the verb code and take appropriate action.
*/
{
return;
}
switch (verb) {
case SP_VERB_LAYER_NEW: {
break;
}
case SP_VERB_LAYER_RENAME: {
break;
}
case SP_VERB_LAYER_NEXT: {
if (next) {
_("Switch to next layer"));
} else {
}
break;
}
case SP_VERB_LAYER_PREV: {
if (prev) {
_("Switch to previous layer"));
} else {
}
break;
}
case SP_VERB_LAYER_MOVE_TO_NEXT: {
break;
}
case SP_VERB_LAYER_MOVE_TO_PREV: {
break;
}
case SP_VERB_LAYER_MOVE_TO: {
break;
}
case SP_VERB_LAYER_TO_TOP:
case SP_VERB_LAYER_TO_BOTTOM:
case SP_VERB_LAYER_RAISE:
case SP_VERB_LAYER_LOWER: {
return;
}
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:
break;
case SP_VERB_LAYER_LOWER:
break;
}
switch (verb) {
case SP_VERB_LAYER_TO_TOP:
description = _("Layer to top");
break;
case SP_VERB_LAYER_RAISE:
description = _("Raise layer");
break;
case SP_VERB_LAYER_TO_BOTTOM:
description = _("Layer to bottom");
break;
case SP_VERB_LAYER_LOWER:
description = _("Lower layer");
break;
};
if (message) {
}
} else {
}
break;
}
case SP_VERB_LAYER_DUPLICATE: {
// Note with either approach:
// Any clone masters are duplicated, their clones use the *original*,
// but the duplicated master is not linked up as master nor clone of the original.
#if 0
// Only copies selectable things, honoring locks, visibility, avoids sublayers.
}
sp_selection_duplicate(dt, true);
sp_selection_to_prev_layer(dt, true);
#else
// Copies everything, regardless of locks, visibility, sublayers.
//XML Tree being directly used here while it shouldn't be.
if (new_layer) {
}
}
#endif
_("Duplicate layer"));
// TRANSLATORS: this means "The layer has been duplicated."
} else {
}
break;
}
case SP_VERB_LAYER_DELETE: {
if (!survivor) {
}
// 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
//
if (survivor) {
}
_("Delete layer"));
// TRANSLATORS: this means "The layer has been deleted."
} else {
}
break;
}
case SP_VERB_LAYER_SOLO: {
} else {
DocumentUndo::maybeDone(sp_desktop_document(dt), "layer:solo", SP_VERB_LAYER_SOLO, _("Toggle layer solo"));
}
break;
}
case SP_VERB_LAYER_SHOW_ALL: {
dt->toggleHideAllLayers( false );
DocumentUndo::maybeDone(sp_desktop_document(dt), "layer:showall", SP_VERB_LAYER_SHOW_ALL, _("Show all layers"));
break;
}
case SP_VERB_LAYER_HIDE_ALL: {
dt->toggleHideAllLayers( true );
DocumentUndo::maybeDone(sp_desktop_document(dt), "layer:hideall", SP_VERB_LAYER_HIDE_ALL, _("Hide all layers"));
break;
}
case SP_VERB_LAYER_LOCK_ALL: {
dt->toggleLockAllLayers( true );
DocumentUndo::maybeDone(sp_desktop_document(dt), "layer:lockall", SP_VERB_LAYER_LOCK_ALL, _("Lock all layers"));
break;
}
case SP_VERB_LAYER_LOCK_OTHERS: {
} else {
DocumentUndo::maybeDone(sp_desktop_document(dt), "layer:lockothers", SP_VERB_LAYER_LOCK_OTHERS, _("Lock other layers"));
}
break;
}
case SP_VERB_LAYER_UNLOCK_ALL: {
dt->toggleLockAllLayers( false );
DocumentUndo::maybeDone(sp_desktop_document(dt), "layer:unlockall", SP_VERB_LAYER_UNLOCK_ALL, _("Unlock all layers"));
break;
}
case SP_VERB_LAYER_TOGGLE_HIDE: {
} else {
if ( verb == SP_VERB_LAYER_TOGGLE_HIDE ){
} else {
}
}
}
}
return;
} // end of sp_verb_action_layer_perform()
/**
* Decode the verb code and take appropriate action.
*/
{
if (!dt)
return;
return;
if (!bbox) {
return;
}
// If the rotation center of the selection is visible, choose it as reference point
// for horizontal and vertical flips. Otherwise, take the center of the bounding box.
if (tools_isactive(dt, TOOLS_SELECT) && sel->center() && SP_SELECT_CONTEXT(ec)->_seltrans->centerIsVisible())
else
sp_selection_rotate_90(dt, false);
break;
sp_selection_rotate_90(dt, true);
break;
case SP_VERB_OBJECT_FLATTEN:
break;
case SP_VERB_OBJECT_TO_CURVE:
break;
case SP_VERB_OBJECT_FLOW_TEXT:
break;
text_unflow();
break;
break;
_("Flip horizontally"));
break;
_("Flip vertically"));
break;
case SP_VERB_OBJECT_SET_MASK:
sp_selection_set_mask(dt, false, false);
break;
case SP_VERB_OBJECT_EDIT_MASK:
sp_selection_edit_clip_or_mask(dt, false);
break;
sp_selection_unset_mask(dt, false);
break;
sp_selection_set_mask(dt, true, false);
break;
sp_selection_edit_clip_or_mask(dt, true);
break;
sp_selection_unset_mask(dt, true);
break;
default:
break;
}
} // end of sp_verb_action_object_perform()
/**
* Decode the verb code and take appropriate action.
*/
{
int vidx;
if (!dt)
return;
/** \todo !!! hopefully this can go away soon and actions can look after
* themselves
*/
{
if (tool_action) {
}
}
switch (verb) {
case SP_VERB_CONTEXT_SELECT:
break;
case SP_VERB_CONTEXT_NODE:
break;
case SP_VERB_CONTEXT_TWEAK:
break;
case SP_VERB_CONTEXT_SPRAY:
break;
case SP_VERB_CONTEXT_RECT:
break;
case SP_VERB_CONTEXT_3DBOX:
break;
case SP_VERB_CONTEXT_ARC:
break;
case SP_VERB_CONTEXT_STAR:
break;
case SP_VERB_CONTEXT_SPIRAL:
break;
case SP_VERB_CONTEXT_PENCIL:
break;
case SP_VERB_CONTEXT_PEN:
break;
break;
case SP_VERB_CONTEXT_TEXT:
break;
case SP_VERB_CONTEXT_GRADIENT:
break;
case SP_VERB_CONTEXT_MESH:
break;
case SP_VERB_CONTEXT_ZOOM:
break;
case SP_VERB_CONTEXT_MEASURE:
break;
case SP_VERB_CONTEXT_DROPPER:
break;
break;
break;
case SP_VERB_CONTEXT_ERASER:
break;
case SP_VERB_CONTEXT_LPETOOL:
break;
break;
break;
break;
break;
break;
break;
break;
break;
break;
break;
break;
break;
break;
break;
break;
break;
break;
break;
break;
break;
break;
g_print ("TODO: Create preferences page for LPETool\n");
break;
break;
default:
break;
}
} // end of sp_verb_action_ctx_perform()
/**
* Decode the verb code and take appropriate action.
*/
{
if (!dt)
return;
(void)doc;
(void)repr;
}
/**
* Decode the verb code and take appropriate action.
*/
{
if (!dt)
return;
case SP_VERB_ZOOM_IN:
{
GDK_KEY_KP_Add, 0); // with any mask
break;
}
}
break;
}
case SP_VERB_ZOOM_OUT:
{
GDK_KEY_KP_Subtract, 0); // with any mask
break;
}
}
break;
}
case SP_VERB_ZOOM_1_1:
{
break;
}
case SP_VERB_ZOOM_1_2:
{
break;
}
case SP_VERB_ZOOM_2_1:
{
break;
}
case SP_VERB_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:
break;
case SP_VERB_ZOOM_PREV:
break;
case SP_VERB_TOGGLE_RULERS:
dt->toggleRulers();
break;
dt->toggleScrollbars();
break;
break;
break;
break;
case SP_VERB_TOGGLE_TOOLBOX:
break;
case SP_VERB_TOGGLE_PALETTE:
break;
case SP_VERB_TOGGLE_STATUSBAR:
break;
case SP_VERB_TOGGLE_GUIDES:
break;
case SP_VERB_TOGGLE_SNAPPING:
dt->toggleSnapGlobal();
break;
case SP_VERB_TOGGLE_GRID:
dt->toggleGrids();
break;
#ifdef HAVE_GTK_WINDOW_FULLSCREEN
case SP_VERB_FULLSCREEN:
dt->fullscreen();
break;
case SP_VERB_FULLSCREENFOCUS:
dt->fullscreen();
break;
#endif // HAVE_GTK_WINDOW_FULLSCREEN
case SP_VERB_FOCUSTOGGLE:
break;
case SP_VERB_VIEW_NEW:
break;
case SP_VERB_VIEW_NEW_PREVIEW:
break;
case SP_VERB_VIEW_MODE_NORMAL:
break;
break;
break;
case SP_VERB_VIEW_MODE_TOGGLE:
dt->displayModeToggle();
break;
break;
break;
// case SP_VERB_VIEW_COLOR_MODE_PRINT_COLORS_PREVIEW:
// dt->setDisplayColorModePrintColorsPreview();
// break;
break;
case SP_VERB_VIEW_CMS_TOGGLE:
break;
break;
default:
break;
}
} // end of sp_verb_action_zoom_perform()
/**
* Decode the verb code and take appropriate action.
*/
{
// unhide all when opening a new dialog
}
case SP_VERB_DIALOG_DISPLAY:
//sp_display_dialog();
break;
case SP_VERB_DIALOG_METADATA:
// sp_desktop_dialog();
break;
case SP_VERB_DIALOG_NAMEDVIEW:
// sp_desktop_dialog();
break;
break;
case SP_VERB_DIALOG_GLYPHS:
break;
case SP_VERB_DIALOG_SWATCHES:
break;
case SP_VERB_DIALOG_SYMBOLS:
break;
case SP_VERB_DIALOG_TRANSFORM:
break;
break;
break;
case SP_VERB_DIALOG_TEXT:
break;
break;
case SP_VERB_DIALOG_FIND:
break;
// not implemented yet
break;
break;
case SP_VERB_DIALOG_DEBUG:
break;
case SP_VERB_DIALOG_SCRIPT:
//dt->_dlg_mgr->showDialog("Script");
break;
break;
case SP_VERB_DIALOG_TOGGLE:
break;
//clonetiler_dialog();
break;
case SP_VERB_DIALOG_ATTR:
//sp_item_dialog();
break;
case SP_VERB_DIALOG_ITEM:
//sp_item_dialog();
break;
case SP_VERB_DIALOG_INPUT:
break;
case SP_VERB_DIALOG_EXPORT:
break;
break;
case SP_VERB_DIALOG_LAYERS:
break;
break;
break;
case SP_VERB_DIALOG_SVG_FONTS:
break;
break;
default:
break;
}
} // end of sp_verb_action_dialog_perform()
/**
* Decode the verb code and take appropriate action.
*/
{
case SP_VERB_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:
break;
default:
break;
}
} // end of sp_verb_action_help_perform()
/**
* Decode the verb code and take appropriate action.
*/
{
case SP_VERB_TUTORIAL_BASIC:
// TRANSLATORS: If you have translated the tutorial-basic.en.svgz file to your language,
// then translate this string as "tutorial-basic.LANG.svgz" (where LANG is your language
// code); otherwise leave as "tutorial-basic.svg".
break;
case SP_VERB_TUTORIAL_SHAPES:
// TRANSLATORS: See "tutorial-basic.svg" comment.
break;
// TRANSLATORS: See "tutorial-basic.svg" comment.
break;
case SP_VERB_TUTORIAL_TRACING:
// TRANSLATORS: See "tutorial-basic.svg" comment.
break;
// TRANSLATORS: See "tutorial-basic.svg" comment.
break;
// TRANSLATORS: See "tutorial-basic.svg" comment.
break;
case SP_VERB_TUTORIAL_DESIGN:
// TRANSLATORS: See "tutorial-basic.svg" comment.
break;
case SP_VERB_TUTORIAL_TIPS:
// TRANSLATORS: See "tutorial-basic.svg" comment.
break;
default:
break;
}
} // end of sp_verb_action_tutorial_perform()
// *********** Effect Last **********
/**
* A class to represent the last effect issued.
*/
class EffectLastVerb : public Verb {
private:
protected:
public:
/** Use the Verb initializer with the same parameters. */
EffectLastVerb(unsigned int const code,
{
set_default_sensitive(false);
}
}; // EffectLastVerb class
/**
* Create an action for a \c EffectLastVerb.
*
* Calls \c make_action_helper with the \c vector.
*
* @param view Which view the action should be created for.
* @return The built action.
*/
{
}
/**
* Decode the verb code and take appropriate action.
*/
{
// These aren't used, but are here to remind people not to use
// the CURRENT_DOCUMENT macros unless they really have to.
// SPDocument *current_document = SP_VIEW_DOCUMENT(current_view);
if (current_view == NULL) return;
case SP_VERB_EFFECT_LAST_PREF:
break;
case SP_VERB_EFFECT_LAST:
break;
default:
return;
}
return;
}
// *********** End Effect Last **********
// *********** Fit Canvas **********
/**
* A class to represent the canvas fitting verbs.
*/
class FitCanvasVerb : public Verb {
private:
protected:
public:
/** Use the Verb initializer with the same parameters. */
FitCanvasVerb(unsigned int const code,
{
set_default_sensitive(false);
}
}; // FitCanvasVerb class
/**
* Create an action for a \c FitCanvasVerb.
*
* Calls \c make_action_helper with the \c vector.
*
* @param view Which view the action should be created for.
* @return The built action.
*/
{
return action;
}
/**
* Decode the verb code and take appropriate action.
*/
{
if (!dt) return;
if (!doc) return;
break;
break;
break;
default:
return;
}
return;
}
// *********** End Fit Canvas **********
// *********** Lock'N'Hide **********
/**
* A class to represent the object unlocking and unhiding verbs.
*/
class LockAndHideVerb : public Verb {
private:
protected:
public:
/** Use the Verb initializer with the same parameters. */
LockAndHideVerb(unsigned int const code,
{
set_default_sensitive(true);
}
}; // LockAndHideVerb class
/**
* Create an action for a \c LockAndHideVerb.
*
* Calls \c make_action_helper with the \c vector.
*
* @param view Which view the action should be created for.
* @return The built action.
*/
{
return action;
}
/**
* Decode the verb code and take appropriate action.
*/
{
if (!dt) return;
if (!doc) return;
case SP_VERB_UNLOCK_ALL:
unlock_all(dt);
break;
break;
case SP_VERB_UNHIDE_ALL:
unhide_all(dt);
break;
break;
default:
return;
}
return;
}
// *********** End Lock'N'Hide **********
// these must be in the same order as the SP_VERB_* enum in "verbs.h"
// Header
// File
new FileVerb(SP_VERB_FILE_NEW, "FileNew", N_("Default"), N_("Create new document from the default template"),
N_("Revert to the last saved version of document (changes will be lost)"), GTK_STOCK_REVERT_TO_SAVED ),
// TRANSLATORS: "Vacuum Defs" means "Clean up defs" (so as to remove unused definitions)
new FileVerb(SP_VERB_FILE_VACUUM, "FileVacuum", N_("Clean _up document"), N_("Remove unused definitions (such as gradients or clipping paths) from the <defs> of the document"),
INKSCAPE_ICON("document-cleanup") ),
// new FileVerb(SP_VERB_FILE_EXPORT_TO_OCAL, "FileExportToOCAL", N_("Export To Open Clip Art Library"), N_("Export this document to Open Clip Art Library"), INKSCAPE_ICON_DOCUMENT_EXPORT_OCAL),
// Edit
new EditVerb(SP_VERB_EDIT_PASTE_SIZE_SEPARATELY, "EditPasteSizeSeparately", N_("Paste Size Separately"),
new EditVerb(SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_X, "EditPasteWidthSeparately", N_("Paste Width Separately"),
new EditVerb(SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_Y, "EditPasteHeightSeparately", N_("Paste Height Separately"),
N_("Create a clone (a copy linked to the original) of selected object"), INKSCAPE_ICON("edit-clone")),
N_("Cut the selected clones' links to the originals, turning them into standalone objects"), INKSCAPE_ICON("edit-clone-unlink")),
N_("Select the object to which the selected clone is linked"), INKSCAPE_ICON("edit-select-original")),
new EditVerb(SP_VERB_EDIT_CLONE_ORIGINAL_PATH_LPE, "EditCloneOriginalPathLPE", N_("Clone original path (LPE)"),
N_("Creates a new path, applies the Clone original LPE, and refers it to the selected path"), NULL),
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"), INKSCAPE_ICON("edit-select-all-layers")),
new EditVerb(SP_VERB_EDIT_SELECT_SAME_FILL_STROKE, "EditSelectSameFillStroke", N_("Fill _and Stroke"),
N_("Select all objects with the same fill and stroke as the selected objects"), GTK_STOCK_SELECT_ALL),
new EditVerb(SP_VERB_EDIT_SELECT_SAME_STROKE_COLOR, "EditSelectSameStrokeColor", N_("_Stroke Color"),
new EditVerb(SP_VERB_EDIT_SELECT_SAME_STROKE_STYLE, "EditSelectSameStrokeStyle", N_("Stroke St_yle"),
N_("Select all objects with the same stroke style (width, dash, markers) as the selected objects"), GTK_STOCK_SELECT_ALL),
N_("Select all objects with the same object type (rect, arc, text, path, bitmap etc) as the selected objects"), GTK_STOCK_SELECT_ALL),
N_("Invert selection (unselect what is selected and select everything else)"), INKSCAPE_ICON("edit-select-invert")),
new EditVerb(SP_VERB_EDIT_INVERT_IN_ALL_LAYERS, "EditInvertInAllLayers", N_("Invert in All Layers"),
new EditVerb(SP_VERB_EDIT_GUIDES_AROUND_PAGE, "EditGuidesAroundPage", N_("Create _Guides Around the Page"),
new EditVerb(SP_VERB_EDIT_NEXT_PATHEFFECT_PARAMETER, "EditNextPathEffectParameter", N_("Next path effect parameter"),
// Selection
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"), INKSCAPE_ICON("text-unkern")),
N_("Create exclusive OR of selected paths (those parts that belong to only one path)"), INKSCAPE_ICON("path-exclusion")),
// TRANSLATORS: "to cut a path" is not the same as "to break a path apart" - see the
// Advanced tutorial for more info
// 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.
N_("O_utset Path by 1 px"),
N_("O_utset Path by 10 px"),
// 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.
N_("I_nset Path by 1 px"),
N_("I_nset Path by 10 px"),
N_("_Linked Offset"),
N_("Create a dynamic offset object linked to the original path"),
INKSCAPE_ICON("path-offset-linked")),
N_("Reverse the direction of selected paths (useful for flipping markers)"), INKSCAPE_ICON("path-reverse")),
// TRANSLATORS: "to trace" means "to convert a bitmap to vector graphics" (to vectorize)
new SelectionVerb(SP_VERB_SELECTION_CREATE_BITMAP, "SelectionCreateBitmap", N_("Make a _Bitmap Copy"),
N_("Export selection to a bitmap and insert it into document"), INKSCAPE_ICON("selection-make-bitmap-copy") ),
// TRANSLATORS: "to cut a path" is not the same as "to break a path apart" - see the
// Advanced tutorial for more info
// Layer
N_("Move selection to the layer above the current"), INKSCAPE_ICON("selection-move-to-layer-above")),
N_("Move selection to the layer below the current"), INKSCAPE_ICON("selection-move-to-layer-below")),
// Object
// This is shared between tooltips and statusbar, so they
// must use UTF-8, not HTML entities for special characters.
// This is shared between tooltips and statusbar, so they
// must use UTF-8, not HTML entities for special characters.
N_("Put text into a frame (path or shape), creating a flowed text linked to the frame object"), "text-flow-into-frame"),
N_("Convert flowed text to regular text object (preserves appearance)"), INKSCAPE_ICON("text-convert-to-regular")),
INKSCAPE_ICON("object-flip-horizontal")),
INKSCAPE_ICON("object-flip-vertical")),
// Tools
new ContextVerb(SP_VERB_CONTEXT_CALLIGRAPHIC, "ToolCalligraphic", NC_("ContextVerb", "Calligraphy"),
// Tool prefs
new ContextVerb(SP_VERB_CONTEXT_CALLIGRAPHIC_PREFS, "CalligraphicPrefs", N_("Calligraphic Preferences"),
new ContextVerb(SP_VERB_CONTEXT_PAINTBUCKET_PREFS, "PaintBucketPrefs", N_("Paint Bucket Preferences"),
new ZoomVerb(SP_VERB_ZOOM_OUT, "ZoomOut", N_("Zoom Out"), N_("Zoom out"), INKSCAPE_ICON("zoom-out")),
new ZoomVerb(SP_VERB_TOGGLE_RULERS, "ToggleRulers", N_("_Rulers"), N_("Show or hide the canvas rulers"), NULL),
new ZoomVerb(SP_VERB_TOGGLE_SCROLLBARS, "ToggleScrollbars", N_("Scroll_bars"), N_("Show or hide the canvas scrollbars"), NULL),
new ZoomVerb(SP_VERB_TOGGLE_GRID, "ToggleGrid", N_("_Grid"), N_("Show or hide the grid"), INKSCAPE_ICON("show-grid")),
new ZoomVerb(SP_VERB_TOGGLE_GUIDES, "ToggleGuides", N_("G_uides"), N_("Show or hide guides (drag from a ruler to create a guide)"), INKSCAPE_ICON("show-guides")),
new ZoomVerb(SP_VERB_TOGGLE_SNAPPING, "ToggleSnapGlobal", N_("Snap"), N_("Enable snapping"), INKSCAPE_ICON("snap")),
new ZoomVerb(SP_VERB_TOGGLE_COMMANDS_TOOLBAR, "ToggleCommandsToolbar", N_("_Commands Bar"), N_("Show or hide the Commands bar (under the menu)"), NULL),
new ZoomVerb(SP_VERB_TOGGLE_SNAP_TOOLBAR, "ToggleSnapToolbar", N_("Sn_ap Controls Bar"), N_("Show or hide the snapping controls"), NULL),
new ZoomVerb(SP_VERB_TOGGLE_TOOL_TOOLBAR, "ToggleToolToolbar", N_("T_ool Controls Bar"), N_("Show or hide the Tool Controls bar"), NULL),
new ZoomVerb(SP_VERB_TOGGLE_TOOLBOX, "ToggleToolbox", N_("_Toolbox"), N_("Show or hide the main toolbox (on the left)"), NULL),
new ZoomVerb(SP_VERB_TOGGLE_PALETTE, "TogglePalette", N_("_Palette"), N_("Show or hide the color palette"), NULL),
new ZoomVerb(SP_VERB_TOGGLE_STATUSBAR, "ToggleStatusbar", N_("_Statusbar"), N_("Show or hide the statusbar (at the bottom of the window)"), NULL),
new ZoomVerb(SP_VERB_ZOOM_NEXT, "ZoomNext", N_("Nex_t Zoom"), N_("Next zoom (from the history of zooms)"),
INKSCAPE_ICON("zoom-next")),
new ZoomVerb(SP_VERB_ZOOM_PREV, "ZoomPrev", N_("Pre_vious Zoom"), N_("Previous zoom (from the history of zooms)"),
INKSCAPE_ICON("zoom-previous")),
INKSCAPE_ICON("zoom-original")),
INKSCAPE_ICON("zoom-half-size")),
INKSCAPE_ICON("zoom-double-size")),
#ifdef HAVE_GTK_WINDOW_FULLSCREEN
new ZoomVerb(SP_VERB_FULLSCREEN, "FullScreen", N_("_Fullscreen"), N_("Stretch this document window to full screen"),
INKSCAPE_ICON("view-fullscreen")),
new ZoomVerb(SP_VERB_FULLSCREENFOCUS, "FullScreenFocus", N_("Fullscreen & Focus Mode"), N_("Stretch this document window to full screen"),
INKSCAPE_ICON("view-fullscreen")),
#endif // HAVE_GTK_WINDOW_FULLSCREEN
new ZoomVerb(SP_VERB_FOCUSTOGGLE, "FocusToggle", N_("Toggle _Focus Mode"), N_("Remove excess toolbars to focus on drawing"),
NULL),
new ZoomVerb(SP_VERB_VIEW_NEW, "ViewNew", N_("Duplic_ate Window"), N_("Open a new window with the same document"),
INKSCAPE_ICON("window-new")),
// new ZoomVerb(SP_VERB_VIEW_COLOR_MODE_PRINT_COLORS_PREVIEW, "ViewColorModePrintColorsPreview", N_("_Print Colors Preview"),
// N_("Switch to print colors preview mode"), NULL),
N_("Open a window to preview objects at different icon resolutions"), INKSCAPE_ICON("dialog-icon-preview")),
// Dialogs
N_("Edit objects' colors, gradients, arrowheads, and other fill and stroke properties..."), INKSCAPE_ICON("dialog-fill-and-stroke")),
// TRANSLATORS: "Swatches" means: color samples
new DialogVerb(SP_VERB_DIALOG_ALIGN_DISTRIBUTE, "DialogAlignDistribute", N_("_Align and Distribute..."),
N_("View and select font family, font size and other text properties"), INKSCAPE_ICON("dialog-text-and-font")),
N_("Create multiple clones of selected object, arranging them into a pattern or scattering"), INKSCAPE_ICON("dialog-tile-clones")),
N_("Edit the ID, locked and visible status, and other object properties"), INKSCAPE_ICON("dialog-object-properties")),
N_("Configure extended input devices, such as a graphics tablet"), INKSCAPE_ICON("dialog-input-devices")),
new DialogVerb(SP_VERB_DIALOG_EXTENSIONEDITOR, "org.inkscape.dialogs.extensioneditor", N_("_Extensions..."),
new DialogVerb(SP_VERB_DIALOG_PRINT_COLORS_PREVIEW, "DialogPrintColorsPreview", N_("Print Colors..."),
// Help
//new HelpVerb(SP_VERB_SHOW_LICENSE, "ShowLicense", N_("_License"),
// N_("Distribution terms"), /*"show_license"*/"inkscape_options"),
// Tutorials
// TRANSLATORS: "to trace" means "to convert a bitmap to vector graphics" (to vectorize)
new TutorialVerb(SP_VERB_TUTORIAL_CALLIGRAPHY, "TutorialsCalligraphy", N_("Inkscape: _Calligraphy"),
new TutorialVerb(SP_VERB_TUTORIAL_INTERPOLATE, "TutorialsInterpolate", N_("Inkscape: _Interpolate"),
// Effect -- renamed Extension
new EffectLastVerb(SP_VERB_EFFECT_LAST_PREF, "EffectLastPref", N_("_Previous Extension Settings..."),
// Fit Page
new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_SELECTION, "FitCanvasToSelection", N_("Fit Page to Selection"),
new FitCanvasVerb(SP_VERB_FIT_CANVAS_TO_SELECTION_OR_DRAWING, "FitCanvasToSelectionOrDrawing", N_("Fit Page to Selection or Drawing"),
// LockAndHide
new LockAndHideVerb(SP_VERB_UNLOCK_ALL_IN_ALL_LAYERS, "UnlockAllInAllLayers", N_("Unlock All in All Layers"),
new LockAndHideVerb(SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS, "UnhideAllInAllLayers", N_("Unhide All in All Layers"),
// Color Management
// Align
new ContextVerb(SP_VERB_ALIGN_HORIZONTAL_RIGHT_TO_ANCHOR, "AlignHorizontalRightToAnchor", N_("Align right edges of objects to the left edge of the anchor"),
N_("Align right edges of objects to the left edge of the anchor"), INKSCAPE_ICON("align-horizontal-right-to-anchor")),
new ContextVerb(SP_VERB_ALIGN_HORIZONTAL_CENTER, "AlignHorizontalCenter", N_("Center on vertical axis"),
new ContextVerb(SP_VERB_ALIGN_HORIZONTAL_LEFT_TO_ANCHOR, "AlignHorizontalLeftToAnchor", N_("Align left edges of objects to the right edge of the anchor"),
N_("Align left edges of objects to the right edge of the anchor"), INKSCAPE_ICON("align-horizontal-left-to-anchor")),
new ContextVerb(SP_VERB_ALIGN_VERTICAL_BOTTOM_TO_ANCHOR, "AlignVerticalBottomToAnchor", N_("Align bottom edges of objects to the top edge of the anchor"),
N_("Align bottom edges of objects to the top edge of the anchor"), INKSCAPE_ICON("align-vertical-bottom-to-anchor")),
new ContextVerb(SP_VERB_ALIGN_VERTICAL_CENTER, "AlignVerticalCenter", N_("Center on horizontal axis"),
new ContextVerb(SP_VERB_ALIGN_VERTICAL_TOP_TO_ANCHOR, "AlignVerticalTopToAnchor", N_("Align top edges of objects to the bottom edge of the anchor"),
N_("Align top edges of objects to the bottom edge of the anchor"), INKSCAPE_ICON("align-vertical-top-to-anchor")),
new ContextVerb(SP_VERB_ALIGN_VERTICAL_HORIZONTAL_CENTER, "AlignVerticalHorizontalCenter", N_("Center on horizontal and vertical axis"),
// Footer
};
// Go through the dynamic verb table
continue;
}
}
return verbs;
};
void
// Go through the dynamic verb table
continue;
}
}
return;
};
} // 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:fileencoding=utf-8:textwidth=99 :