tools-switch.cpp revision 304f51846342812ceea2b6d1f69c57585a5e412e
/*
* Utility functions for switching tools (= contexts)
*
* Authors:
* bulia byak <buliabyak@users.sf.net>
* Josh Andler <scislac@users.sf.net>
*
* Copyright (C) 2003-2007 authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <cstring>
#include <string>
#include "inkscape-private.h"
#include "desktop.h"
#include "desktop-handles.h"
#include "select-context.h"
#include "node-context.h"
#include "tweak-context.h"
#include "sp-path.h"
#include "rect-context.h"
#include "sp-rect.h"
#include "box3d-context.h"
#include "box3d.h"
#include "arc-context.h"
#include "sp-ellipse.h"
#include "star-context.h"
#include "sp-star.h"
#include "spiral-context.h"
#include "sp-spiral.h"
#include "dyna-draw-context.h"
#include "eraser-context.h"
#include "pen-context.h"
#include "pencil-context.h"
#include "lpe-tool-context.h"
#include "text-context.h"
#include "sp-text.h"
#include "sp-flowtext.h"
#include "gradient-context.h"
#include "zoom-context.h"
#include "dropper-context.h"
#include "connector-context.h"
#include "flood-context.h"
#include "sp-offset.h"
#include "message-context.h"
#include "tools-switch.h"
static char const *const tool_names[] = {
NULL,
"tools.select",
"tools.nodes",
"tools.tweak",
"tools.shapes.rect",
"tools.shapes.3dbox",
"tools.shapes.arc",
"tools.shapes.star",
"tools.shapes.spiral",
"tools.freehand.pencil",
"tools.freehand.pen",
"tools.calligraphic",
"tools.text",
"tools.gradient",
"tools.zoom",
"tools.dropper",
"tools.connector",
"tools.paintbucket",
"tools.eraser",
"tools.lpetool",
};
static char const *const tool_ids[] = {
NULL,
"select",
"nodes",
"tweak",
"rect",
"3dbox",
"arc",
"star",
"spiral",
"pencil",
"pen",
"calligraphic",
"text",
"gradient",
"zoom",
"dropper",
"connector",
"paintbucket",
"eraser",
"lpetool",
};
static int
tools_id2num(char const *id)
{
int i = 1;
while (tool_ids[i]) {
return i;
else i++;
}
g_assert( 0 == TOOLS_INVALID );
return 0; //nothing found
}
int
{
else return FALSE;
}
int
{
}
void
{
if (dt) {
}
switch (num) {
case TOOLS_SELECT:
/* fixme: This is really ugly hack. We should bind and unbind class methods */
dt->activate_guides(true);
break;
case TOOLS_NODES:
dt->activate_guides(true);
dt->tipsMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("To edit a path, <b>click</b>, <b>Shift+click</b>, or <b>drag around</b> nodes to select them, then <b>drag</b> nodes and handles. <b>Click</b> on an object to select."));
break;
case TOOLS_TWEAK:
dt->activate_guides(true);
dt->tipsMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("To tweak a path by pushing, select it and drag over it."));
break;
case TOOLS_SHAPES_RECT:
dt->activate_guides(false);
dt->tipsMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("<b>Drag</b> to create a rectangle. <b>Drag controls</b> to round corners and resize. <b>Click</b> to select."));
break;
case TOOLS_SHAPES_3DBOX:
dt->activate_guides(false);
dt->tipsMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("<b>Drag</b> to create a 3D box. <b>Drag controls</b> to resize in perspective. <b>Click</b> to select (with <b>Ctrl+Alt</b> for single faces)."));
break;
case TOOLS_SHAPES_ARC:
dt->activate_guides(false);
dt->tipsMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("<b>Drag</b> to create an ellipse. <b>Drag controls</b> to make an arc or segment. <b>Click</b> to select."));
break;
case TOOLS_SHAPES_STAR:
dt->activate_guides(false);
dt->tipsMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("<b>Drag</b> to create a star. <b>Drag controls</b> to edit the star shape. <b>Click</b> to select."));
break;
case TOOLS_SHAPES_SPIRAL:
dt->activate_guides(false);
dt->tipsMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("<b>Drag</b> to create a spiral. <b>Drag controls</b> to edit the spiral shape. <b>Click</b> to select."));
break;
case TOOLS_FREEHAND_PENCIL:
dt->activate_guides(false);
dt->tipsMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("<b>Drag</b> to create a freehand line. Start drawing with <b>Shift</b> to append to selected path. <b>Ctrl+click</b> to create single dots."));
break;
case TOOLS_FREEHAND_PEN:
dt->activate_guides(false);
dt->tipsMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("<b>Click</b> or <b>click and drag</b> to start a path; with <b>Shift</b> to append to selected path. <b>Ctrl+click</b> to create single dots."));
break;
case TOOLS_CALLIGRAPHIC:
dt->activate_guides(false);
dt->tipsMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("<b>Drag</b> to draw a calligraphic stroke; with <b>Ctrl</b> to track a guide path. <b>Arrow keys</b> adjust width (left/right) and angle (up/down)."));
break;
case TOOLS_TEXT:
dt->activate_guides(false);
dt->tipsMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("<b>Click</b> to select or create text, <b>drag</b> to create flowed text; then type."));
break;
case TOOLS_GRADIENT:
dt->activate_guides(false);
dt->tipsMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("<b>Drag</b> or <b>double click</b> to create a gradient on selected objects, <b>drag handles</b> to adjust gradients."));
break;
case TOOLS_ZOOM:
dt->activate_guides(false);
dt->tipsMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("<b>Click</b> or <b>drag around an area</b> to zoom in, <b>Shift+click</b> to zoom out."));
break;
case TOOLS_DROPPER:
dt->activate_guides(false);
dt->tipsMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("<b>Click</b> to set fill, <b>Shift+click</b> to set stroke; <b>drag</b> to average color in area; with <b>Alt</b> to pick inverse color; <b>Ctrl+C</b> to copy the color under mouse to clipboard"));
break;
case TOOLS_CONNECTOR:
dt->activate_guides(false);
dt->tipsMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("<b>Click and drag</b> between shapes to create a connector."));
break;
case TOOLS_PAINTBUCKET:
dt->activate_guides(false);
dt->tipsMessageContext()->set(Inkscape::NORMAL_MESSAGE, _("<b>Click</b> to paint a bounded area, <b>Shift+click</b> to union the new fill with the current selection, <b>Ctrl+click</b> to change the clicked object's fill and stroke to the current setting."));
break;
case TOOLS_ERASER:
dt->activate_guides(false);
break;
case TOOLS_LPETOOL:
dt->activate_guides(false);
break;
}
}
void
tools_switch_current(int num)
{
}
{
if (SP_IS_RECT(item)) {
} else if (SP_IS_BOX3D(item)) {
} else if (SP_IS_GENERICELLIPSE(item)) {
} else if (SP_IS_STAR(item)) {
} else if (SP_IS_SPIRAL(item)) {
} else if (SP_IS_PATH(item)) {
if (cc_item_is_connector(item)) {
}
else {
}
} else if (SP_IS_OFFSET(item)) {
}
}
/*
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 :