summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4ded9bd)
raw | patch | inline | side by side (parent: 4ded9bd)
author | cilix42 <cilix42@users.sourceforge.net> | |
Wed, 13 Aug 2008 15:06:50 +0000 (15:06 +0000) | ||
committer | cilix42 <cilix42@users.sourceforge.net> | |
Wed, 13 Aug 2008 15:06:50 +0000 (15:06 +0000) |
diff --git a/src/node-context.cpp b/src/node-context.cpp
index d8a1ec1d7deb953f20517561dfd35d78ff8b5d2b..96b562a3fb2e46b70a001d164454b60dafa497fb 100644 (file)
--- a/src/node-context.cpp
+++ b/src/node-context.cpp
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
diff --git a/src/nodepath.cpp b/src/nodepath.cpp
index 4132cc5babc716715e1c04bb018c463993f24aec..4260d03c88964ed8bde179eab95b80ee390d4b13 100644 (file)
--- a/src/nodepath.cpp
+++ b/src/nodepath.cpp
return typestr;
}
-/**
- * Returns current path in context. // later eliminate this function at all!
- */
-static Inkscape::NodePath::Path *sp_nodepath_current()
-{
- if (!SP_ACTIVE_DESKTOP) {
- return NULL;
- }
-
- SPEventContext *event_context = (SP_ACTIVE_DESKTOP)->event_context;
-
- if (!SP_IS_NODE_CONTEXT(event_context)) {
- return NULL;
- }
-
- return SP_NODE_CONTEXT(event_context)->shape_editor->get_nodepath();
-}
-
-
-
/**
\brief Fills node and handle positions for three nodes, splitting line
marked by end at distance t.
@@ -1576,11 +1556,10 @@ sp_node_selected_move(Inkscape::NodePath::Path *nodepath, gdouble dx, gdouble dy
* Move node selection off screen and commit the change.
*/
void
-sp_node_selected_move_screen(Inkscape::NodePath::Path *nodepath, gdouble dx, gdouble dy)
+sp_node_selected_move_screen(SPDesktop *desktop, Inkscape::NodePath::Path *nodepath, gdouble dx, gdouble dy)
{
// borrowed from sp_selection_move_screen in selection-chemistry.c
// we find out the current zoom factor and divide deltas by it
- SPDesktop *desktop = SP_ACTIVE_DESKTOP;
gdouble zoom = desktop->current_zoom();
gdouble zdx = dx / zoom;
@@ -1952,7 +1931,7 @@ sp_nodepath_select_segment_near_point(Inkscape::NodePath::Path *nodepath, NR::Po
curve->unref();
//find segment to segment
- Inkscape::NodePath::Node *e = sp_nodepath_get_node_by_index(segment_index);
+ Inkscape::NodePath::Node *e = sp_nodepath_get_node_by_index(nodepath, segment_index);
//fixme: this can return NULL, so check before proceeding.
g_return_if_fail(e != NULL);
@@ -1998,7 +1977,7 @@ sp_nodepath_add_node_near_point(Inkscape::NodePath::Path *nodepath, NR::Point p)
curve->unref();
//find segment to split
- Inkscape::NodePath::Node *e = sp_nodepath_get_node_by_index(segment_index);
+ Inkscape::NodePath::Node *e = sp_nodepath_get_node_by_index(nodepath, segment_index);
//don't know why but t seems to flip for lines
if (sp_node_path_code_from_side(e, sp_node_get_side(e, -1)) == NR_LINETO) {
@@ -2024,9 +2003,9 @@ sp_nodepath_add_node_near_point(Inkscape::NodePath::Path *nodepath, NR::Point p)
* cf. app/vectors/gimpbezierstroke.c, gimp_bezier_stroke_point_move_relative()
*/
void
-sp_nodepath_curve_drag(int node, double t, NR::Point delta)
+sp_nodepath_curve_drag(Inkscape::NodePath::Path *nodepath, int node, double t, NR::Point delta)
{
- Inkscape::NodePath::Node *e = sp_nodepath_get_node_by_index(node);
+ Inkscape::NodePath::Node *e = sp_nodepath_get_node_by_index(nodepath, node);
//fixme: e and e->p can be NULL, so check for those before proceeding
g_return_if_fail(e != NULL);
@@ -4643,11 +4622,10 @@ static NRPathcode sp_node_path_code_from_side(Inkscape::NodePath::Node *node,Ink
* Return node with the given index
*/
Inkscape::NodePath::Node *
-sp_nodepath_get_node_by_index(int index)
+sp_nodepath_get_node_by_index(Inkscape::NodePath::Path *nodepath, int index)
{
Inkscape::NodePath::Node *e = NULL;
- Inkscape::NodePath::Path *nodepath = sp_nodepath_current();
if (!nodepath) {
return e;
}
@@ -4745,7 +4723,7 @@ sp_nodepath_update_statusbar(Inkscape::NodePath::Path *nodepath)//!!!move to Sha
if (nodepath) {
desktop = nodepath->desktop;
} else {
- desktop = SP_ACTIVE_DESKTOP;
+ desktop = SP_ACTIVE_DESKTOP; // when this is eliminated also remove #include "inkscape.h" above
}
SPEventContext *ec = desktop->event_context;
diff --git a/src/nodepath.h b/src/nodepath.h
index b330ff96415b9ca8a75f8b2f9e7e324e77ed24df..39eb10b4f9220c5d382d326161d6f22c011a08ac 100644 (file)
--- a/src/nodepath.h
+++ b/src/nodepath.h
@@ -295,8 +295,8 @@ void sp_nodepath_selected_align(Inkscape::NodePath::Path *nodepath, NR::Dim2 axi
void sp_nodepath_selected_distribute(Inkscape::NodePath::Path *nodepath, NR::Dim2 axis);
void sp_nodepath_select_segment_near_point(Inkscape::NodePath::Path *nodepath, NR::Point p, bool toggle);
void sp_nodepath_add_node_near_point(Inkscape::NodePath::Path *nodepath, NR::Point p);
-void sp_nodepath_curve_drag(int node, double t, NR::Point delta);
-Inkscape::NodePath::Node * sp_nodepath_get_node_by_index(int index);
+void sp_nodepath_curve_drag(Inkscape::NodePath::Path *nodepath, int node, double t, NR::Point delta);
+Inkscape::NodePath::Node * sp_nodepath_get_node_by_index(Inkscape::NodePath::Path *np, int index);
/* possibly private functions */
void sp_node_selected_add_node (Inkscape::NodePath::Path *nodepath);
void sp_node_selected_set_type (Inkscape::NodePath::Path *nodepath, Inkscape::NodePath::NodeType type);
void sp_node_selected_set_line_type (Inkscape::NodePath::Path *nodepath, NRPathcode code);
void sp_node_selected_move (Inkscape::NodePath::Path *nodepath, gdouble dx, gdouble dy);
-void sp_node_selected_move_screen (Inkscape::NodePath::Path *nodepath, gdouble dx, gdouble dy);
+void sp_node_selected_move_screen (SPDesktop *desktop, Inkscape::NodePath::Path *nodepath, gdouble dx, gdouble dy);
void sp_node_selected_move_absolute (Inkscape::NodePath::Path *nodepath, Geom::Coord val, Geom::Dim2 axis);
Geom::Rect sp_node_selected_bbox (Inkscape::NodePath::Path *nodepath);
boost::optional<Geom::Coord> sp_node_selected_common_coord (Inkscape::NodePath::Path *nodepath, Geom::Dim2 axis);
diff --git a/src/shape-editor.cpp b/src/shape-editor.cpp
index bfb0e3c0c61ae905ce78730dc83bdca39e31a205..3575d3405148372ad10240780cc37e8cac58c91c 100644 (file)
--- a/src/shape-editor.cpp
+++ b/src/shape-editor.cpp
eventy - this->curvepoint_event[NR::Y]);
NR::Point const delta_dt(this->desktop->w2d(delta_w));
- sp_nodepath_curve_drag (this->grab_node, this->grab_t, delta_dt); //!!! FIXME: which nodepath?!!! also uses current!!!
+ sp_nodepath_curve_drag (this->nodepath, this->grab_node, this->grab_t, delta_dt);
this->curvepoint_event[NR::X] = x;
this->curvepoint_event[NR::Y] = y;
sp_node_selected_set_line_type(this->nodepath, code);
}
-void ShapeEditor::move_nodes_screen(gdouble dx, gdouble dy) {
- sp_node_selected_move_screen(this->nodepath, dx, dy);
+void ShapeEditor::move_nodes_screen(SPDesktop *desktop, gdouble dx, gdouble dy) {
+ sp_node_selected_move_screen(desktop, this->nodepath, dx, dy);
}
void ShapeEditor::move_nodes(gdouble dx, gdouble dy) {
sp_node_selected_move(this->nodepath, dx, dy);
diff --git a/src/shape-editor.h b/src/shape-editor.h
index fe95aca8fd85ad7686c4ba9c6cf807429780205b..c8f5aa4191d0e6dd399612ef92a00c439477fa32 100644 (file)
--- a/src/shape-editor.h
+++ b/src/shape-editor.h
void set_type_of_segments(NRPathcode code);
void move_nodes(gdouble dx, gdouble dy);
- void move_nodes_screen(gdouble dx, gdouble dy);
+ void move_nodes_screen(SPDesktop *desktop, gdouble dx, gdouble dy);
void rotate_nodes(gdouble angle, int which, bool screen);