X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fconnector-context.h;h=640a03aaea67d8848439fc9009ed91fbaf17590b;hb=11c5de79de3c200331e168a745b0505a50aeffea;hp=49c4c2a814c2e970cc1792caeef0cb8a97aefe2b;hpb=6b15695578f07a3f72c4c9475c1a261a3021472a;p=inkscape.git diff --git a/src/connector-context.h b/src/connector-context.h index 49c4c2a81..640a03aae 100644 --- a/src/connector-context.h +++ b/src/connector-context.h @@ -14,13 +14,13 @@ #include #include -#include "display/curve.h" #include "event-context.h" #include #include -#include +#include <2geom/point.h> #include "libavoid/connector.h" - +#include "connection-points.h" +#include #define SP_TYPE_CONNECTOR_CONTEXT (sp_connector_context_get_type()) #define SP_CONNECTOR_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_CAST((o), SP_TYPE_CONNECTOR_CONTEXT, SPConnectorContext)) @@ -39,20 +39,33 @@ enum { SP_CONNECTOR_CONTEXT_DRAGGING, SP_CONNECTOR_CONTEXT_CLOSE, SP_CONNECTOR_CONTEXT_STOP, - SP_CONNECTOR_CONTEXT_REROUTING + SP_CONNECTOR_CONTEXT_REROUTING, + SP_CONNECTOR_CONTEXT_NEWCONNPOINT +}; + +enum { + SP_CONNECTOR_CONTEXT_DRAWING_MODE, + SP_CONNECTOR_CONTEXT_EDITING_MODE }; +static char* cc_knot_tips[] = { _("Connection point: click or drag to create a new connector"), + _("Connection point: click to select, drag to move") }; +typedef std::map ConnectionPointMap; struct SPConnectorContext : public SPEventContext { Inkscape::Selection *selection; - NR::Point p[5]; + Geom::Point p[5]; /** \invar npoints in {0, 2}. */ gint npoints; - + /* The tool mode can be connector drawing or + connection points editing. + */ unsigned int mode : 1; unsigned int state : 4; + gchar* knot_tip; + // Red curve SPCanvasItem *red_bpath; SPCurve *red_curve; @@ -64,6 +77,8 @@ struct SPConnectorContext : public SPEventContext { // The new connector SPItem *newconn; Avoid::ConnRef *newConnRef; + gdouble curvature; + bool isOrthogonal; // The active shape SPItem *active_shape; @@ -79,10 +94,13 @@ struct SPConnectorContext : public SPEventContext { // The activehandle SPKnot *active_handle; + // The selected handle, used in editing mode + SPKnot *selected_handle; + SPItem *clickeditem; SPKnot *clickedhandle; - SPKnot *connpthandle; + ConnectionPointMap connpthandles; SPKnot *endpt_handle[2]; guint endpt_handler_id[2]; gchar *sid; @@ -94,7 +112,10 @@ struct SPConnectorContextClass : public SPEventContextClass { }; GType sp_connector_context_get_type(); +void sp_connector_context_switch_mode(SPEventContext* ec, unsigned int newMode); void cc_selection_set_avoid(bool const set_ignore); +void cc_create_connection_point(SPConnectorContext* cc); +void cc_remove_connection_point(SPConnectorContext* cc); bool cc_item_is_connector(SPItem *item);