diff --git a/src/node-context.cpp b/src/node-context.cpp
index b85e08b689c06163f090a82262b37405d539a32e..9ff7257cef1646c91c8226a69cf1e7f8858c5a49 100644 (file)
--- a/src/node-context.cpp
+++ b/src/node-context.cpp
#include "message-context.h"
#include "node-context.h"
#include "pixmaps/cursor-node-d.xpm"
-#include "prefs-utils.h"
+#include "preferences.h"
#include "xml/node-event-vector.h"
#include "style.h"
#include "splivarot.h"
nc->sel_changed_connection.disconnect();
nc->sel_changed_connection.~connection();
- // TODO: should this be here?
- SPItem *item = sp_desktop_selection(ec->desktop)->singleItem();
- if (item && SP_IS_LPE_ITEM(item)) {
- sp_lpe_item_remove_temporary_canvasitems(SP_LPE_ITEM(item), ec->desktop);
- }
-
delete nc->shape_editor;
if (nc->_node_message_context) {
nc->current_state = SP_NODE_CONTEXT_INACTIVE;
if (item) {
- nc->shape_editor->set_item(item);
+ nc->shape_editor->set_item(item, SH_NODEPATH);
+ nc->shape_editor->set_item(item, SH_KNOTHOLDER);
}
- if (prefs_get_int_attribute("tools.nodes", "selcue", 0) != 0) {
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ if (prefs->getBool("/tools/nodes/selcue")) {
ec->enableSelectionCue();
}
-
- if (prefs_get_int_attribute("tools.nodes", "gradientdrag", 0) != 0) {
+ if (prefs->getBool("/tools/nodes/gradientdrag")) {
ec->enableGrDrag();
}
@@ -194,8 +189,14 @@ sp_node_context_flash_path(SPEventContext *event_context, SPItem *item, guint ti
nc->flash_tempitem = NULL;
}
+ SPCanvasItem *canvasitem = NULL;
if (SP_IS_PATH(item)) {
- SPCanvasItem *canvasitem = sp_nodepath_generate_helperpath(desktop, SP_PATH(item));
+ canvasitem = sp_nodepath_helperpath_from_path(desktop, SP_PATH(item));
+ } else {
+ g_print ("-----> sp_node_context_flash_path(): TODO: generate the helper path!!\n");
+ }
+
+ if (canvasitem) {
nc->flash_tempitem = desktop->add_temporary_canvasitem (canvasitem, timeout);
}
}
@@ -211,9 +212,11 @@ sp_node_context_selection_changed(Inkscape::Selection *selection, gpointer data)
SPNodeContext *nc = SP_NODE_CONTEXT(data);
// TODO: update ShapeEditorsCollective instead
- nc->shape_editor->unset_item();
+ nc->shape_editor->unset_item(SH_NODEPATH);
+ nc->shape_editor->unset_item(SH_KNOTHOLDER);
SPItem *item = selection->singleItem();
- nc->shape_editor->set_item(item);
+ nc->shape_editor->set_item(item, SH_NODEPATH);
+ nc->shape_editor->set_item(item, SH_KNOTHOLDER);
nc->shape_editor->update_statusbar();
}
sp_node_context_item_handler(SPEventContext *event_context, SPItem *item, GdkEvent *event)
{
gint ret = FALSE;
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- if (prefs_get_int_attribute ("tools.nodes", "pathflash_enabled", 0) == 1) {
- guint timeout = prefs_get_int_attribute("tools.nodes", "pathflash_timeout", 500);
+ if (prefs->getBool("/tools/nodes/pathflash_enabled")) {
+ guint timeout = prefs->getInt("/tools/nodes/pathflash_timeout", 500);
if (SP_IS_LPE_ITEM(item)) {
Inkscape::LivePathEffect::Effect *lpe = sp_lpe_item_get_current_lpe(SP_LPE_ITEM(item));
- if (lpe) {
- if (lpe->pathFlashType() == Inkscape::LivePathEffect::SUPPRESS_FLASH) {
- // suppressed and permanent flashes for LPE items are handled in
- // sp_node_context_selection_changed()
- return ret;
- }
- if (lpe->pathFlashType() == Inkscape::LivePathEffect::PERMANENT_FLASH) {
- timeout = 0;
- }
+ if (lpe && (lpe->providesOwnFlashPaths() ||
+ lpe->pathFlashType() == Inkscape::LivePathEffect::SUPPRESS_FLASH)) {
+ // path should be suppressed or permanent; this is handled in
+ // sp_node_context_selection_changed()
+ return ret;
}
}
sp_node_context_flash_path(event_context, item, timeout);
{
SPDesktop *desktop = event_context->desktop;
Inkscape::Selection *selection = sp_desktop_selection (desktop);
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
SPNodeContext *nc = SP_NODE_CONTEXT(event_context);
- 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
- int const snaps = prefs_get_int_attribute("options.rotationsnapsperpi", "value", 12);
- double const offset = prefs_get_double_attribute_limited("options.defaultscale", "value", 2, 0, 1000);
+ double const nudge = prefs->getDoubleLimited("/options/nudgedistance/value", 2, 0, 1000); // in px
+ event_context->tolerance = prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); // read every time, to make prefs changes really live
+ int const snaps = prefs->getInt("/options/rotationsnapsperpi/value", 12);
+ double const offset = prefs->getDoubleLimited("/options/defaultscale/value", 2, 0, 1000);
if ( (nc->flash_tempitem) && (nc->remove_flash_counter <= 0) ) {
desktop->remove_temporary_canvasitem(nc->flash_tempitem);
NR::Point const button_w(event->button.x,
event->button.y);
NR::Point const button_dt(desktop->w2d(button_w));
- Inkscape::Rubberband::get()->start(desktop, button_dt);
+ Inkscape::Rubberband::get(desktop)->start(desktop, button_dt);
nc->current_state = SP_NODE_CONTEXT_INACTIVE;
desktop->updateNow();
ret = TRUE;
break;
}
case SP_NODE_CONTEXT_RUBBERBAND_DRAGGING:
- if (Inkscape::Rubberband::get()->is_started()) {
+ if (Inkscape::Rubberband::get(desktop)->is_started()) {
NR::Point const motion_w(event->motion.x,
event->motion.y);
NR::Point const motion_dt(desktop->w2d(motion_w));
- Inkscape::Rubberband::get()->move(motion_dt);
+ Inkscape::Rubberband::get(desktop)->move(motion_dt);
}
break;
}
selection->set(item_clicked);
desktop->updateNow();
}
- Inkscape::Rubberband::get()->stop();
+ Inkscape::Rubberband::get(desktop)->stop();
ret = TRUE;
break;
}
if (event->type == GDK_BUTTON_RELEASE) {
event_context->xp = event_context->yp = 0;
if (event->button.button == 1) {
- NR::Maybe<NR::Rect> b = Inkscape::Rubberband::get()->getRectangle();
+ boost::optional<Geom::Rect> b = Inkscape::Rubberband::get(desktop)->getRectangle();
if (nc->shape_editor->hits_curve() && !event_context->within_tolerance) { //drag curve
nc->shape_editor->finish_drag();
}
}
ret = TRUE;
- Inkscape::Rubberband::get()->stop();
+ Inkscape::Rubberband::get(desktop)->stop();
desktop->updateNow();
nc->rb_escaped = false;
nc->drag = FALSE;
ret = TRUE;
}
break;
+ case GDK_A:
+ case GDK_a:
+ if (MOD__SHIFT_ONLY) {
+ nc->shape_editor->set_node_type(Inkscape::NodePath::NODE_AUTO);
+ ret = TRUE;
+ }
+ break;
case GDK_Y:
case GDK_y:
if (MOD__SHIFT_ONLY) {
case GDK_r:
if (MOD__SHIFT_ONLY) {
// FIXME: add top panel button
- sp_selected_path_reverse();
+ sp_selected_path_reverse(desktop);
ret = TRUE;
}
break;
gint mul = 1 + gobble_key_events(
get_group0_keyval(&event->key), 0); // with any mask
if (MOD__ALT) { // alt
- if (MOD__SHIFT) nc->shape_editor->move_nodes_screen(mul*-10, 0); // shift
- else nc->shape_editor->move_nodes_screen(mul*-1, 0); // no shift
+ if (MOD__SHIFT) nc->shape_editor->move_nodes_screen(desktop, mul*-10, 0); // shift
+ else nc->shape_editor->move_nodes_screen(desktop, mul*-1, 0); // no shift
}
else { // no alt
if (MOD__SHIFT) nc->shape_editor->move_nodes(mul*-10*nudge, 0); // shift
gint mul = 1 + gobble_key_events(
get_group0_keyval(&event->key), 0); // with any mask
if (MOD__ALT) { // alt
- if (MOD__SHIFT) nc->shape_editor->move_nodes_screen(0, mul*10); // shift
- else nc->shape_editor->move_nodes_screen(0, mul*1); // no shift
+ if (MOD__SHIFT) nc->shape_editor->move_nodes_screen(desktop, 0, mul*10); // shift
+ else nc->shape_editor->move_nodes_screen(desktop, 0, mul*1); // no shift
}
else { // no alt
if (MOD__SHIFT) nc->shape_editor->move_nodes(0, mul*10*nudge); // shift
gint mul = 1 + gobble_key_events(
get_group0_keyval(&event->key), 0); // with any mask
if (MOD__ALT) { // alt
- if (MOD__SHIFT) nc->shape_editor->move_nodes_screen(mul*10, 0); // shift
- else nc->shape_editor->move_nodes_screen(mul*1, 0); // no shift
+ if (MOD__SHIFT) nc->shape_editor->move_nodes_screen(desktop, mul*10, 0); // shift
+ else nc->shape_editor->move_nodes_screen(desktop, mul*1, 0); // no shift
}
else { // no alt
if (MOD__SHIFT) nc->shape_editor->move_nodes(mul*10*nudge, 0); // shift
gint mul = 1 + gobble_key_events(
get_group0_keyval(&event->key), 0); // with any mask
if (MOD__ALT) { // alt
- if (MOD__SHIFT) nc->shape_editor->move_nodes_screen(0, mul*-10); // shift
- else nc->shape_editor->move_nodes_screen(0, mul*-1); // no shift
+ if (MOD__SHIFT) nc->shape_editor->move_nodes_screen(desktop, 0, mul*-10); // shift
+ else nc->shape_editor->move_nodes_screen(desktop, 0, mul*-1); // no shift
}
else { // no alt
if (MOD__SHIFT) nc->shape_editor->move_nodes(0, mul*-10*nudge); // shift
break;
case GDK_Escape:
{
- NR::Maybe<NR::Rect> const b = Inkscape::Rubberband::get()->getRectangle();
+ boost::optional<Geom::Rect> const b = Inkscape::Rubberband::get(desktop)->getRectangle();
if (b) {
- Inkscape::Rubberband::get()->stop();
+ Inkscape::Rubberband::get(desktop)->stop();
nc->current_state = SP_NODE_CONTEXT_INACTIVE;
nc->rb_escaped = true;
} else {