node-context.cpp revision 3567021c833341b50efa625b193c8e9123d06ec3
#define __SP_NODE_CONTEXT_C__
/*
* Node editing context
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
*
* This code is in public domain
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <cstring>
#include <string>
#include <gdk/gdkkeysyms.h>
#include "macros.h"
#include "display/sp-canvas-util.h"
#include "object-edit.h"
#include "sp-path.h"
#include "path-chemistry.h"
#include "rubberband.h"
#include "desktop.h"
#include "desktop-handles.h"
#include "selection.h"
#include "pixmaps/cursor-node.xpm"
#include "message-context.h"
#include "node-context.h"
#include "pixmaps/cursor-node-d.xpm"
#include "prefs-utils.h"
#include "xml/node-event-vector.h"
#include "style.h"
#include "splivarot.h"
#include "shape-editor.h"
#include "live_effects/effect.h"
#include "sp-lpe-item.h"
// needed for flash nodepath upon mouseover:
#include "display/canvas-bpath.h"
static SPEventContextClass *parent_class;
{
if (!type) {
sizeof(SPNodeContextClass),
sizeof(SPNodeContext),
4,
NULL, /* value_table */
};
}
return type;
}
static void
{
}
static void
{
}
static void
{
ec->enableGrDrag(false);
// TODO: should this be here?
}
delete nc->shape_editor;
if (nc->_node_message_context) {
delete nc->_node_message_context;
}
}
static void
{
selection->connectChanged(sigc::bind(sigc::ptr_fun(&sp_node_context_selection_changed), (gpointer)nc));
nc->rb_escaped = false;
nc->cursor_drag = false;
nc->added_node = false;
if (item) {
}
ec->enableSelectionCue();
}
ec->enableGrDrag();
}
}
static void
nc->remove_flash_counter = 3; // for some reason root_handler is called twice after each item_handler...
// we entered a new item
if (nc->flash_tempitem) {
}
if (SP_IS_PATH(item)) {
}
}
}
/**
\brief Callback that processes the "changed" signal on the selection;
destroys old and creates new nodepath and reassigns listeners to the new selected item's repr
*/
void
{
// TODO: update ShapeEditorsCollective instead
}
void
{
_("<b>Ctrl</b>: toggle node type, snap handle angle, move hor/vert; <b>Ctrl+Alt</b>: move along handles"),
_("<b>Shift</b>: toggle node selection, disable snapping, rotate both handles"),
_("<b>Alt</b>: lock handle length; <b>Ctrl+Alt</b>: move along handles"));
}
static gint
{
if (SP_IS_LPE_ITEM(item)) {
// path should be suppressed or permanent; this is handled in
// sp_node_context_selection_changed()
return ret;
}
}
}
return ret;
}
static gint
{
double const nudge = prefs_get_double_attribute_limited("options.nudgedistance", "value", 2, 0, 1000); // in px
event_context->tolerance = prefs_get_int_attribute_limited("options.dragtolerance", "value", 0, 0, 100); // read every time, to make prefs changes really live
double const offset = prefs_get_double_attribute_limited("options.defaultscale", "value", 2, 0, 1000);
nc->flashed_item = NULL; // also reset this one, so the next time the same object is hovered over it shows again the highlight
} else {
}
case GDK_BUTTON_PRESS:
// save drag origin
event_context->within_tolerance = true;
// save drag origin
bool over_stroke = nc->shape_editor->is_over_stroke(NR::Point(event->button.x, event->button.y), true);
//only dragging curves
if (over_stroke) {
break;
}
}
}
}
}
break;
case GDK_MOTION_NOTIFY:
break; // do not drag if we're within tolerance from origin
}
// The path went away while dragging; throw away any further motion
// events until the mouse pointer is released.
break;
}
// Once the user has moved farther than tolerance from the original location
// (indicating they intend to move the object, not click), then always process the
// motion notify coordinates as given (no snapping back to origin)
event_context->within_tolerance = false;
// Once we determine what the user is doing (dragging either a node or the
// selection rubberband), make sure we continue to perform that operation
// until the mouse pointer is lifted.
} else {
}
}
switch (nc->current_state) {
{
break;
}
}
break;
}
} else {
break;
}
bool over_stroke = false;
nc->cursor_drag = false;
nc->cursor_drag = true;
}
}
break;
case GDK_2BUTTON_PRESS:
case GDK_BUTTON_RELEASE:
// find out clicked item, disregarding groups, honoring Alt
bool over_stroke = false;
}
if (item_clicked || over_stroke) {
case GDK_BUTTON_RELEASE:
//add a node
} else {
nc->added_node = false;
break;
}
//select the segment
} else {
}
}
break;
case GDK_2BUTTON_PRESS:
//add a node
nc->added_node = true;
break;
default:
break;
}
} else {
}
break;
}
}
} else {
else
}
}
nc->rb_escaped = false;
}
}
break;
case GDK_KEY_PRESS:
case GDK_Insert:
case GDK_KP_Insert:
// with any modifiers
break;
case GDK_Delete:
case GDK_KP_Delete:
case GDK_BackSpace:
if (MOD__CTRL_ONLY) {
} else {
}
break;
case GDK_C:
case GDK_c:
if (MOD__SHIFT_ONLY) {
}
break;
case GDK_S:
case GDK_s:
if (MOD__SHIFT_ONLY) {
}
break;
case GDK_Y:
case GDK_y:
if (MOD__SHIFT_ONLY) {
}
break;
case GDK_B:
case GDK_b:
if (MOD__SHIFT_ONLY) {
}
break;
case GDK_J:
case GDK_j:
if (MOD__SHIFT_ONLY) {
}
break;
case GDK_D:
case GDK_d:
if (MOD__SHIFT_ONLY) {
}
break;
case GDK_L:
case GDK_l:
if (MOD__SHIFT_ONLY) {
}
break;
case GDK_U:
case GDK_u:
if (MOD__SHIFT_ONLY) {
}
break;
case GDK_R:
case GDK_r:
if (MOD__SHIFT_ONLY) {
// FIXME: add top panel button
}
break;
case GDK_x:
case GDK_X:
if (MOD__ALT_ONLY) {
}
break;
case GDK_Left: // move selection left
case GDK_KP_Left:
case GDK_KP_4:
if (!MOD__CTRL) { // not ctrl
if (MOD__ALT) { // alt
}
else { // no alt
}
}
break;
case GDK_Up: // move selection up
case GDK_KP_Up:
case GDK_KP_8:
if (!MOD__CTRL) { // not ctrl
if (MOD__ALT) { // alt
}
else { // no alt
}
}
break;
case GDK_Right: // move selection right
case GDK_KP_Right:
case GDK_KP_6:
if (!MOD__CTRL) { // not ctrl
if (MOD__ALT) { // alt
}
else { // no alt
}
}
break;
case GDK_Down: // move selection down
case GDK_KP_Down:
case GDK_KP_2:
if (!MOD__CTRL) { // not ctrl
if (MOD__ALT) { // alt
}
else { // no alt
}
}
break;
case GDK_Escape:
{
if (b) {
nc->rb_escaped = true;
} else {
} else {
}
}
break;
}
case GDK_bracketleft:
else {
}
} else if ( snaps != 0 ) {
}
break;
case GDK_bracketright:
else {
}
} else if ( snaps != 0 ) {
}
break;
case GDK_less:
case GDK_comma:
if (MOD__CTRL) {
} else if (MOD__ALT) {
else {
}
} else {
}
break;
case GDK_greater:
case GDK_period:
if (MOD__CTRL) {
} else if (MOD__ALT) {
else {
}
} else {
}
break;
case GDK_Alt_L:
break;
case GDK_Alt_R:
break;
case GDK_Control_L:
break;
case GDK_Control_R:
break;
case GDK_Shift_L:
case GDK_Shift_R:
case GDK_Meta_L:
case GDK_Meta_R:
break;
default:
break;
}
break;
case GDK_KEY_RELEASE:
case GDK_Alt_L:
break;
case GDK_Alt_R:
break;
case GDK_Control_L:
break;
case GDK_Control_R:
break;
case GDK_Shift_L:
case GDK_Shift_R:
case GDK_Meta_L:
case GDK_Meta_R:
break;
}
break;
default:
break;
}
if (!ret) {
}
return ret;
}
/*
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 :