node-context.cpp revision 10850f5b20a7a7818087e474a8915f521aafe5dd
#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 "preferences.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);
delete ec->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 (canvasitem) {
}
}
}
/**
\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
{
return ret;
}
}
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
{
event_context->tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); // read every time, to make prefs changes really live
nc->flashed_item = NULL; // also reset this one, so the next time the same object is hovered over it shows again the highlight
} else {
}
sp_event_context_snap_window_open(event_context, false); // Just put the snap window open, bluntly. Will be closed when we have left the context
case GDK_BUTTON_PRESS:
// save drag origin
event_context->within_tolerance = true;
se->cancel_hit();
// save drag origin
//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 (se->has_nodepath()) {
}
if (item_clicked || over_stroke) {
case GDK_BUTTON_RELEASE:
//add a node
} else {
nc->added_node = false;
break;
}
//select the segment
se->select_segment_near_point(true);
} else {
se->select_segment_near_point(false);
}
}
break;
case GDK_2BUTTON_PRESS:
//add a node
nc->added_node = true;
break;
default:
break;
}
} else {
}
break;
}
}
se->finish_drag();
} else {
if (se->has_selection())
else
}
}
nc->rb_escaped = false;
se->cancel_hit();
}
}
break;
case GDK_KEY_PRESS:
case GDK_Insert:
case GDK_KP_Insert:
// with any modifiers
break;
case GDK_I:
case GDK_i:
// apple keyboards have no Insert
if (MOD__SHIFT_ONLY) {
}
break;
case GDK_Delete:
case GDK_KP_Delete:
case GDK_BackSpace:
if (MOD__CTRL_ONLY) {
se->delete_nodes();
} 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_A:
case GDK_a:
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) {
se->break_at_nodes();
}
break;
case GDK_J:
case GDK_j:
if (MOD__SHIFT_ONLY) {
se->join_nodes();
}
break;
case GDK_D:
case GDK_d:
if (MOD__SHIFT_ONLY) {
se->duplicate_nodes();
}
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 {
if (se->has_selection()) {
} 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 :