index 228c81d29e0bdc26365ebe694bf4600778f901f3..307d59d1f5f2efad35e2068b78e710424d0b71f3 100644 (file)
* Gobbling away all duplicates after the current can occasionally result
* in the path lagging behind the mouse cursor if it is no longer being
* dragged.
* Gobbling away all duplicates after the current can occasionally result
* in the path lagging behind the mouse cursor if it is no longer being
* dragged.
- * o Fix up libavoid's representation after undo actions. It doesn't see
+ * o Fix up libavoid's representation after undo actions. It doesn't see
* any transform signals and hence doesn't know shapes have moved back to
* there earlier positions.
* o Decide whether drawing/editing mode should be an Inkscape preference
* any transform signals and hence doesn't know shapes have moved back to
* there earlier positions.
* o Decide whether drawing/editing mode should be an Inkscape preference
* ----------------------------------------------------------------------------
*
* mjwybrow's observations on acracan's Summer of Code connector work:
* ----------------------------------------------------------------------------
*
* mjwybrow's observations on acracan's Summer of Code connector work:
- *
+ *
* - GUI comments:
* - GUI comments:
- *
+ *
* - Buttons for adding and removing user-specified connection
* points should probably have "+" and "-" symbols on them so they
* are consistent with the similar buttons for the node tool.
* - Buttons for adding and removing user-specified connection
* points should probably have "+" and "-" symbols on them so they
* are consistent with the similar buttons for the node tool.
- * - Controls on the connector tool be should be reordered logically,
+ * - Controls on the connector tool be should be reordered logically,
* possibly as follows:
* possibly as follows:
- *
- * *Connector*: [Polyline-radio-button] [Orthgonal-radio-button]
+ *
+ * *Connector*: [Polyline-radio-button] [Orthgonal-radio-button]
* [Curvature-control] | *Shape*: [Avoid-button] [Dont-avoid-button]
* [Spacing-control] | *Connection pts*: [Edit-mode] [Add-pt] [Rm-pt]
* [Curvature-control] | *Shape*: [Avoid-button] [Dont-avoid-button]
* [Spacing-control] | *Connection pts*: [Edit-mode] [Add-pt] [Rm-pt]
- *
- * I think that the network layout controls be moved to the
- * Align and Distribute dialog (there is already the layout button
+ *
+ * I think that the network layout controls be moved to the
+ * Align and Distribute dialog (there is already the layout button
* there, but no options are exposed).
* there, but no options are exposed).
- *
+ *
* I think that the style change between polyline and orthogonal
* would be much clearer with two buttons (radio behaviour -- just
* one is true).
* I think that the style change between polyline and orthogonal
* would be much clearer with two buttons (radio behaviour -- just
* one is true).
- *
- * The other tools show a label change from "New:" to "Change:"
+ *
+ * The other tools show a label change from "New:" to "Change:"
* depending on whether an object is selected. We could consider
* this but there may not be space.
* depending on whether an object is selected. We could consider
* this but there may not be space.
- *
+ *
* The Add-pt and Rm-pt buttons should be greyed out (inactive) if
* we are not in connection point editing mode. And probably also
* if there is no shape selected, i.e. at the times they have no
* effect when clicked.
* The Add-pt and Rm-pt buttons should be greyed out (inactive) if
* we are not in connection point editing mode. And probably also
* if there is no shape selected, i.e. at the times they have no
* effect when clicked.
- *
- * Likewise for the avoid/ignore shapes buttons. These should be
+ *
+ * Likewise for the avoid/ignore shapes buttons. These should be
* inactive when a shape is not selected in the connector context.
* inactive when a shape is not selected in the connector context.
- *
+ *
* - When creating/editing connection points:
* - When creating/editing connection points:
- *
+ *
* - Strange things can happen if you have connectors selected, or
* - Strange things can happen if you have connectors selected, or
- * try rerouting connectors by dragging their endpoints when in
+ * try rerouting connectors by dragging their endpoints when in
* connection point editing mode.
* connection point editing mode.
- *
+ *
* - Possibly the selected shape's connection points should always
* be shown (i.e., have knots) when in editing mode.
* - Possibly the selected shape's connection points should always
* be shown (i.e., have knots) when in editing mode.
- *
+ *
* - It is a little strange to be able to place connection points
* competely outside shapes. Especially when you later can't draw
* connectors to them since the knots are only visible when you
* are over the shape. I think that you should only be able to
* - It is a little strange to be able to place connection points
* competely outside shapes. Especially when you later can't draw
* connectors to them since the knots are only visible when you
* are over the shape. I think that you should only be able to
- * place connection points inside or on the boundary of the shape
+ * place connection points inside or on the boundary of the shape
* itself.
* itself.
- *
- * - The intended ability to place a new point at the current cursor
+ *
+ * - The intended ability to place a new point at the current cursor
* position by pressing RETURN does not seem to work.
* position by pressing RETURN does not seem to work.
- *
+ *
* - The Status bar tooltip should change to reflect editing mode
* and tell the user about RETURN and how to use the tool.
* - The Status bar tooltip should change to reflect editing mode
* and tell the user about RETURN and how to use the tool.
- *
+ *
* - Connection points general:
* - Connection points general:
- *
- * - Connection points that were inside the shape can end up outside
+ *
+ * - Connection points that were inside the shape can end up outside
* after a rotation is applied to the shape in the select tool.
* It doesn't seem like the correct transform is being applied to
* these, or it is being applied at the wrong time. I'd expect
* connection points to rotate with the shape, and stay at the
* same position "on the shape"
* after a rotation is applied to the shape in the select tool.
* It doesn't seem like the correct transform is being applied to
* these, or it is being applied at the wrong time. I'd expect
* connection points to rotate with the shape, and stay at the
* same position "on the shape"
- *
+ *
* - I was able to make the connectors attached to a shape fall off
* the shape after scaling it. Not sure the exact cause, but may
* require more investigation/debugging.
* - I was able to make the connectors attached to a shape fall off
* the shape after scaling it. Not sure the exact cause, but may
* require more investigation/debugging.
- *
+ *
* - The user-defined connection points should be either absolute
* (as the current ones are) or defined as a percentage of the
* shape. These would be based on a toggle setting on the
* toolbar, and they would be placed in exactly the same way by
* the user. The only difference would be that they would be
* store as percentage positions in the SVG connection-points
* - The user-defined connection points should be either absolute
* (as the current ones are) or defined as a percentage of the
* shape. These would be based on a toggle setting on the
* toolbar, and they would be placed in exactly the same way by
* the user. The only difference would be that they would be
* store as percentage positions in the SVG connection-points
- * property and that they would update/move automatically if the
+ * property and that they would update/move automatically if the
* object was resized or scaled.
* object was resized or scaled.
- *
+ *
* - Thinking more, I think you always want to store and think about
* the positions of connection points to be pre-transform, but
* obviously the shape transform is applied to them. That way,
* - Thinking more, I think you always want to store and think about
* the positions of connection points to be pre-transform, but
* obviously the shape transform is applied to them. That way,
* the shape transform is altered. The Percentage version would
* compute their position from the pre-transform dimensions and
* then have the transform applied to them, for example.
* the shape transform is altered. The Percentage version would
* compute their position from the pre-transform dimensions and
* then have the transform applied to them, for example.
- *
+ *
* - The connection points in the test_connection_points.svg file
* seem to follow the shape when it is moved, but connection
* points I add to new shapes, do not follow the shape, either
* when the shape is just moved or transformed. There is
* - The connection points in the test_connection_points.svg file
* seem to follow the shape when it is moved, but connection
* points I add to new shapes, do not follow the shape, either
* when the shape is just moved or transformed. There is
- * something wrong here. What exactly should the behaviour be
+ * something wrong here. What exactly should the behaviour be
* currently?
* currently?
- *
+ *
* - I see that connection points are specified at absolute canvas
* positions. I really think that they should be specified in
* shape coordinated relative to the shapes. There may be
* - I see that connection points are specified at absolute canvas
* positions. I really think that they should be specified in
* shape coordinated relative to the shapes. There may be
cc->clickedhandle = NULL;
new (&cc->connpthandles) ConnectionPointMap();
cc->clickedhandle = NULL;
new (&cc->connpthandles) ConnectionPointMap();
-
+
for (int i = 0; i < 2; ++i) {
cc->endpt_handle[i] = NULL;
cc->endpt_handler_id[i] = 0;
for (int i = 0; i < 2; ++i) {
cc->endpt_handle[i] = NULL;
cc->endpt_handler_id[i] = 0;
cc->sel_changed_connection.disconnect();
if (!cc->connpthandles.empty()) {
cc->sel_changed_connection.disconnect();
if (!cc->connpthandles.empty()) {
- for (ConnectionPointMap::iterator it = cc->connpthandles.begin();
+ for (ConnectionPointMap::iterator it = cc->connpthandles.begin();
it != cc->connpthandles.end(); ++it) {
g_object_unref(it->first);
}
it != cc->connpthandles.end(); ++it) {
g_object_unref(it->first);
}
cc_selection_changed(cc->selection, (gpointer) cc);
cc->within_tolerance = false;
cc_selection_changed(cc->selection, (gpointer) cc);
cc->within_tolerance = false;
-
+
sp_event_context_read(ec, "curvature");
sp_event_context_read(ec, "orthogonal");
sp_event_context_read(ec, "mode");
sp_event_context_read(ec, "curvature");
sp_event_context_read(ec, "orthogonal");
sp_event_context_read(ec, "mode");
{
cc->selection->set( SP_OBJECT( cc->active_shape ) );
}
{
cc->selection->set( SP_OBJECT( cc->active_shape ) );
}
- else
+ else
{
SPItem* item = cc->selection->singleItem();
if ( item )
{
SPItem* item = cc->selection->singleItem();
if ( item )
// Hide the connection points if they exist.
if (cc->connpthandles.size()) {
// Hide the connection points if they exist.
if (cc->connpthandles.size()) {
- for (ConnectionPointMap::iterator it = cc->connpthandles.begin();
+ for (ConnectionPointMap::iterator it = cc->connpthandles.begin();
it != cc->connpthandles.end(); ++it) {
sp_knot_hide(it->first);
}
it != cc->connpthandles.end(); ++it) {
sp_knot_hide(it->first);
}
@@ -616,7 +616,7 @@ sp_connector_context_item_handler(SPEventContext *event_context, SPItem *item, G
SPConnectorContext *cc = SP_CONNECTOR_CONTEXT(event_context);
Geom::Point p(event->button.x, event->button.y);
SPConnectorContext *cc = SP_CONNECTOR_CONTEXT(event_context);
Geom::Point p(event->button.x, event->button.y);
-
+
switch (event->type) {
case GDK_BUTTON_RELEASE:
if (event->button.button == 1 && !event_context->space_panning) {
switch (event->type) {
case GDK_BUTTON_RELEASE:
if (event->button.button == 1 && !event_context->space_panning) {
@@ -660,11 +660,11 @@ sp_connector_context_item_handler(SPEventContext *event_context, SPItem *item, G
if (cc->mode == SP_CONNECTOR_CONTEXT_DRAWING_MODE || (cc->mode == SP_CONNECTOR_CONTEXT_EDITING_MODE && !cc->selected_handle))
{
if (cc_item_is_shape(item)) {
if (cc->mode == SP_CONNECTOR_CONTEXT_DRAWING_MODE || (cc->mode == SP_CONNECTOR_CONTEXT_EDITING_MODE && !cc->selected_handle))
{
if (cc_item_is_shape(item)) {
-
+
// I don't really understand what the above does,
// so I commented it.
// This is a shape, so show connection point(s).
// I don't really understand what the above does,
// so I commented it.
// This is a shape, so show connection point(s).
- /* if (!(cc->active_shape)
+ /* if (!(cc->active_shape)
// Don't show handle for another handle.
// || (cc->connpthandles.find((SPKnot*) item) != cc->connpthandles.end())
)
// Don't show handle for another handle.
// || (cc->connpthandles.find((SPKnot*) item) != cc->connpthandles.end())
)
@@ -847,7 +847,7 @@ connector_handle_button_press(SPConnectorContext *const cc, GdkEventButton const
cc->xp = bevent.x;
cc->yp = bevent.y;
cc->within_tolerance = true;
cc->xp = bevent.x;
cc->yp = bevent.y;
cc->within_tolerance = true;
-
+
ConnectionPointMap::iterator const& active_knot_it = cc->connpthandles.find( cc->active_handle );
switch (cc->state)
ConnectionPointMap::iterator const& active_knot_it = cc->connpthandles.find( cc->active_handle );
switch (cc->state)
@@ -934,7 +934,7 @@ connector_handle_motion_notify(SPConnectorContext *const cc, GdkEventMotion cons
{
SnapManager &m = dt->namedview->snap_manager;
m.setup(dt);
{
SnapManager &m = dt->namedview->snap_manager;
m.setup(dt);
-
+
switch (cc->state) {
case SP_CONNECTOR_CONTEXT_DRAGGING:
{
switch (cc->state) {
case SP_CONNECTOR_CONTEXT_DRAGGING:
{
@@ -1074,7 +1074,7 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con
switch ( cc->state )
{
case SP_CONNECTOR_CONTEXT_DRAGGING:
switch ( cc->state )
{
case SP_CONNECTOR_CONTEXT_DRAGGING:
-
+
if (!cc->within_tolerance)
{
// sp_event_context_snap_window_open(event_context);
if (!cc->within_tolerance)
{
// sp_event_context_snap_window_open(event_context);
@@ -1094,7 +1094,7 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con
case SP_CONNECTOR_CONTEXT_NEWCONNPOINT:
// sp_event_context_snap_window_open( event_context );
m.freeSnapReturnByRef(Inkscape::SnapPreferences::SNAPPOINT_NODE, p, Inkscape::SNAPSOURCE_HANDLE);
case SP_CONNECTOR_CONTEXT_NEWCONNPOINT:
// sp_event_context_snap_window_open( event_context );
m.freeSnapReturnByRef(Inkscape::SnapPreferences::SNAPPOINT_NODE, p, Inkscape::SNAPSOURCE_HANDLE);
-
+
sp_knot_set_position(cc->selected_handle, p, 0);
// sp_event_context_snap_window_closed(event_context);
sp_knot_set_position(cc->selected_handle, p, 0);
// sp_event_context_snap_window_closed(event_context);
@@ -1118,7 +1118,7 @@ connector_handle_button_release(SPConnectorContext *const cc, GdkEventButton con
}
}
}
}
}
}
-
+
return ret;
}
return ret;
}
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop);
Geom::Point p = cc->selected_handle->pos;
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop);
Geom::Point p = cc->selected_handle->pos;
- SPEventContext* event_context = SP_EVENT_CONTEXT( cc );
-
+// SPEventContext* event_context = SP_EVENT_CONTEXT( cc );
+
if (!cc->within_tolerance)
{
// sp_event_context_snap_window_open(event_context);
if (!cc->within_tolerance)
{
// sp_event_context_snap_window_open(event_context);
@@ -1229,11 +1229,11 @@ connector_handle_key_press(SPConnectorContext *const cc, guint const keyval)
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop);
Geom::Point p = cc->selected_handle->pos;
SnapManager &m = desktop->namedview->snap_manager;
m.setup(desktop);
Geom::Point p = cc->selected_handle->pos;
- SPEventContext* event_context = SP_EVENT_CONTEXT( cc );
-
+// SPEventContext* event_context = SP_EVENT_CONTEXT( cc );
+
// sp_event_context_snap_window_open( event_context );
m.freeSnapReturnByRef(Inkscape::SnapPreferences::SNAPPOINT_NODE, p, Inkscape::SNAPSOURCE_HANDLE);
// sp_event_context_snap_window_open( event_context );
m.freeSnapReturnByRef(Inkscape::SnapPreferences::SNAPPOINT_NODE, p, Inkscape::SNAPSOURCE_HANDLE);
-
+
sp_knot_set_position(cc->selected_handle, p, 0);
// sp_event_context_snap_window_closed(event_context);
sp_knot_set_position(cc->selected_handle, p, 0);
// sp_event_context_snap_window_closed(event_context);
cc->selected_handle = NULL;
ret = TRUE;
}
cc->selected_handle = NULL;
ret = TRUE;
}
-
+
break;
}
}
break;
}
}
// Process pending updates.
cc->newconn->updateRepr();
sp_document_ensure_up_to_date(doc);
// Process pending updates.
cc->newconn->updateRepr();
sp_document_ensure_up_to_date(doc);
-
+
if (connection) {
// Adjust endpoints to shape edge.
sp_conn_reroute_path_immediate(SP_PATH(cc->newconn));
if (connection) {
// Adjust endpoints to shape edge.
sp_conn_reroute_path_immediate(SP_PATH(cc->newconn));
}
// Only set the selection after we are finished with creating the attributes of
}
// Only set the selection after we are finished with creating the attributes of
- // the connector. Otherwise, the selection change may alter the defaults for
+ // the connector. Otherwise, the selection change may alter the defaults for
// values like curvature in the connector context, preventing subsequent lookup
// of their original values.
cc->selection->set(repr);
// values like curvature in the connector context, preventing subsequent lookup
// of their original values.
cc->selection->set(repr);
@@ -1630,7 +1630,7 @@ static void cc_active_shape_add_knot(SPDesktop* desktop, SPItem* item, Connectio
static void cc_set_active_shape(SPConnectorContext *cc, SPItem *item)
{
g_assert(item != NULL );
static void cc_set_active_shape(SPConnectorContext *cc, SPItem *item)
{
g_assert(item != NULL );
-
+
std::map<int, ConnectionPoint>* connpts = &item->avoidRef->connection_points;
if (cc->active_shape != item)
std::map<int, ConnectionPoint>* connpts = &item->avoidRef->connection_points;
if (cc->active_shape != item)
if ( connpts->size() )
for (std::map<int, ConnectionPoint>::iterator it = connpts->begin(); it != connpts->end(); ++it)
cc_active_shape_add_knot(cc->desktop, item, cc->connpthandles, it->second);
if ( connpts->size() )
for (std::map<int, ConnectionPoint>::iterator it = connpts->begin(); it != connpts->end(); ++it)
cc_active_shape_add_knot(cc->desktop, item, cc->connpthandles, it->second);
-
+
// Also add default connection points
// For now, only centre default connection point will
// be available
// Also add default connection points
// For now, only centre default connection point will
// be available