node-tool.cpp revision 6520245b19ffa80f32384a9e187e21d3e0272726
/** @file
* @brief New node tool - implementation
*/
/* Authors:
* Krzysztof KosiĆski <tweenk@gmail.com>
*
* Copyright (C) 2009 Authors
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <glib.h>
#include "desktop.h"
#include "desktop-handles.h"
#include "display/canvas-bpath.h"
#include "display/sp-canvas.h"
#include "document.h"
#include "live_effects/lpeobject.h"
#include "message-context.h"
#include "selection.h"
#include "shape-editor.h" // temporary!
#include "sp-clippath.h"
#include "sp-item-group.h"
#include "sp-mask.h"
#include "sp-object-group.h"
#include "sp-path.h"
#include "ui/tool/node-tool.h"
#include "ui/tool/control-point-selection.h"
#include "ui/tool/curve-drag-point.h"
#include "ui/tool/event-utils.h"
#include "ui/tool/manipulator.h"
#include "ui/tool/multi-path-manipulator.h"
#include "ui/tool/path-manipulator.h"
#include "ui/tool/selector.h"
#include "ui/tool/shape-record.h"
#include "pixmaps/cursor-node.xpm"
#include "pixmaps/cursor-node-d.xpm"
namespace {
} // anonymous namespace
{
if (!type) {
sizeof(InkNodeToolClass),
sizeof(InkNodeTool),
4,
NULL, /* value_table */
};
}
return type;
}
namespace {
{
return reinterpret_cast<SPCanvasGroup*>(sp_canvas_item_new(
}
void destroy_group(SPCanvasGroup *g)
{
}
{
}
{
//new (&nt->_mgroup) Inkscape::UI::ManipulatorGroup(nt->desktop);
}
{
nt->enableGrDrag(false);
if (nt->_node_message_context) {
delete nt->_node_message_context;
}
if (nt->shape_editor) {
delete nt->shape_editor;
}
}
{
SPEventContextClass *parent = (SPEventContextClass *) g_type_class_peek(g_type_parent(INK_TYPE_NODE_TOOL));
// selector has to be created here, so that its hidden control point is on the bottom
// Prepare canvas groups for controls. This guarantees correct z-order, so that
// for example a dragpoint won't obscure a node
nt));
/*nt->_selection_modified_connection.disconnect();
nt->_selection_modified_connection =
selection->connectModified(
sigc::hide(sigc::bind<0>(
sigc::ptr_fun(&ink_node_tool_selection_modified),
nt)));*/
nt));
nt));
nt));
(void*) 0));
(GdkEvent*)0),
nt))));
nt->cursor_drag = false;
nt->show_transform_handles = true;
nt->single_node_transform_handles = false;
// TODO remove this!
// read prefs before adding items to selection to prevent momentarily showing the outline
ec->enableSelectionCue();
}
ec->enableGrDrag();
}
}
{
if (entry_name == "show_handles") {
} else if (entry_name == "show_outline") {
} else if (entry_name == "show_path_direction") {
} else if (entry_name == "show_transform_handles") {
} else if (entry_name == "single_node_transform_handles") {
} else if (entry_name == "edit_clipping_paths") {
} else if (entry_name == "edit_masks") {
} else {
if (parent_class->set)
}
}
/** Recursively collect ShapeRecords */
{
if (!obj) return;
ShapeRecord r;
r.role = SHAPE_ROLE_LPE_PARAM;
s.insert(r);
}
} else if (SP_IS_ITEM(obj)) {
ShapeRecord r;
// TODO add support for objectBoundingBox
// this item was encountered the first time
}
}
}
}
}
struct IsPath {
bool operator()(SPItem *i) const { return SP_IS_PATH(i); }
};
{
// TODO this is ugly!!!
//typedef std::map<SPItem*, std::pair<Geom::Matrix, guint32> > TransMap;
//typedef std::map<SPPath*, std::pair<Geom::Matrix, guint32> > PathMap;
if (SP_IS_ITEM(obj)) {
}
}
// ugly hack: set the first editable non-path item for knotholder
// maybe use multiple ShapeEditors for now, to allow editing many shapes at once?
bool something_set = false;
ShapeRecord const &r = *i;
something_set = true;
break;
}
}
if (!something_set) {
}
}
{
/* things to handle here:
* 1. selection of items
* 2. passing events to manipulators
* 3. some keybindings
*/
{
case GDK_MOTION_NOTIFY:
// create outline
if (nt->flash_tempitem) {
}
c->unref();
}
return true;
case GDK_KEY_PRESS:
{
case GDK_Escape: // deselect everything
} else {
}
return TRUE;
case GDK_a:
} else {
// select all nodes in subpaths that have something selected
// if nothing is selected, select everything
}
return TRUE;
}
break;
default:
break;
}
break;
case GDK_KEY_RELEASE:
break;
default: break;
}
SPEventContextClass *parent_class = (SPEventContextClass *) g_type_class_peek(g_type_parent(INK_TYPE_NODE_TOOL));
if (parent_class->root_handler)
return FALSE;
}
{
if (state_held_shift(new_state)) {
"click to toggle object selection"));
return;
}
}
if (sz != 0) {
"Selected <b>%d nodes</b>. Drag to select nodes, click to select a single object "
"or unselect all objects"), sz);
} else {
"or clear the selection"));
}
}
{
if (parent_class->item_handler)
return FALSE;
}
{
// if multipath is empty, select rubberbanded items rather than nodes
} else {
}
}
{
if (!event) return;
// if no Shift, deselect
}
return;
}
if (held_shift(*event)) {
} else {
}
}
{
nt->cursor_drag = true;
nt->cursor_drag = false;
}
}
} // anonymous namespace
/*
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 :