summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gradient-drag.cpp10
-rw-r--r--src/knot-enums.h4
-rw-r--r--src/knot.cpp43
-rw-r--r--src/knot.h15
-rw-r--r--src/seltrans.cpp4
-rw-r--r--src/ui/tools/connector-tool.cpp10
-rw-r--r--src/ui/tools/measure-tool.cpp8
-rw-r--r--src/vanishing-point.cpp4
8 files changed, 65 insertions, 33 deletions
diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp
index 006e2f790..103a3df9c 100644
--- a/src/gradient-drag.cpp
+++ b/src/gradient-drag.cpp
@@ -1517,7 +1517,7 @@ void GrDragger::updateKnotShape()
// For highlighting mesh handles corresponding to selected corner
if (this->knot->shape == SP_KNOT_SHAPE_TRIANGLE) {
- this->knot->setFill(GR_KNOT_COLOR_HIGHLIGHT, GR_KNOT_COLOR_MOUSEOVER, GR_KNOT_COLOR_MOUSEOVER);
+ this->knot->setFill(GR_KNOT_COLOR_HIGHLIGHT, GR_KNOT_COLOR_MOUSEOVER, GR_KNOT_COLOR_MOUSEOVER, GR_KNOT_COLOR_MOUSEOVER);
if (gr_knot_shapes[last->point_type] == SP_KNOT_SHAPE_CIRCLE) {
g_object_set (G_OBJECT (this->knot->item), "shape", SP_KNOT_SHAPE_TRIANGLE, NULL);
}
@@ -1664,8 +1664,8 @@ GrDragger::GrDragger(GrDrag *parent, Geom::Point p, GrDraggable *draggable)
if (draggable && draggable->point_type == POINT_MG_CORNER) {
fill_color = GR_KNOT_COLOR_MESHCORNER;
}
- this->knot->setFill(fill_color, GR_KNOT_COLOR_MOUSEOVER, GR_KNOT_COLOR_MOUSEOVER);
- this->knot->setStroke(0x0000007f, 0x0000007f, 0x0000007f);
+ this->knot->setFill(fill_color, GR_KNOT_COLOR_MOUSEOVER, GR_KNOT_COLOR_MOUSEOVER, GR_KNOT_COLOR_MOUSEOVER);
+ this->knot->setStroke(0x0000007f, 0x0000007f, 0x0000007f, 0x0000007f);
this->updateControlSizesOverload(this->knot);
this->knot->updateCtrl();
@@ -1837,9 +1837,9 @@ void GrDragger::highlightNode(SPMeshNode* node, bool highlight, Geom::Point corn
SPKnot *knot = d->knot;
if (highlight) {
- knot->setFill(GR_KNOT_COLOR_HIGHLIGHT, GR_KNOT_COLOR_MOUSEOVER, GR_KNOT_COLOR_MOUSEOVER);
+ knot->setFill(GR_KNOT_COLOR_HIGHLIGHT, GR_KNOT_COLOR_MOUSEOVER, GR_KNOT_COLOR_MOUSEOVER, GR_KNOT_COLOR_MOUSEOVER);
} else {
- knot->setFill(GR_KNOT_COLOR_NORMAL, GR_KNOT_COLOR_MOUSEOVER, GR_KNOT_COLOR_MOUSEOVER);
+ knot->setFill(GR_KNOT_COLOR_NORMAL, GR_KNOT_COLOR_MOUSEOVER, GR_KNOT_COLOR_MOUSEOVER, GR_KNOT_COLOR_MOUSEOVER);
}
if (type == POINT_MG_HANDLE) {
diff --git a/src/knot-enums.h b/src/knot-enums.h
index ea23a5a2c..4114967f7 100644
--- a/src/knot-enums.h
+++ b/src/knot-enums.h
@@ -34,6 +34,7 @@ typedef enum {
SP_KNOT_STATE_NORMAL,
SP_KNOT_STATE_MOUSEOVER,
SP_KNOT_STATE_DRAGGING,
+ SP_KNOT_STATE_SELECTED,
SP_KNOT_STATE_HIDDEN
} SPKnotStateType;
@@ -43,7 +44,8 @@ enum {
SP_KNOT_VISIBLE = 1 << 0,
SP_KNOT_MOUSEOVER = 1 << 1,
SP_KNOT_DRAGGING = 1 << 2,
- SP_KNOT_GRABBED = 1 << 3
+ SP_KNOT_GRABBED = 1 << 3,
+ SP_KNOT_SELECTED = 1 << 4
};
diff --git a/src/knot.cpp b/src/knot.cpp
index 50fa73391..2ae1e2cd9 100644
--- a/src/knot.cpp
+++ b/src/knot.cpp
@@ -82,18 +82,22 @@ SPKnot::SPKnot(SPDesktop *desktop, gchar const *tip)
this->fill[SP_KNOT_STATE_NORMAL] = 0xffffff00;
this->fill[SP_KNOT_STATE_MOUSEOVER] = 0xff0000ff;
this->fill[SP_KNOT_STATE_DRAGGING] = 0x0000ffff;
+ this->fill[SP_KNOT_STATE_SELECTED] = 0xff0000ff;
this->stroke[SP_KNOT_STATE_NORMAL] = 0x01000000;
this->stroke[SP_KNOT_STATE_MOUSEOVER] = 0x01000000;
this->stroke[SP_KNOT_STATE_DRAGGING] = 0x01000000;
+ this->stroke[SP_KNOT_STATE_SELECTED] = 0x01000000;
this->image[SP_KNOT_STATE_NORMAL] = NULL;
this->image[SP_KNOT_STATE_MOUSEOVER] = NULL;
this->image[SP_KNOT_STATE_DRAGGING] = NULL;
-
+ this->image[SP_KNOT_STATE_SELECTED] = NULL;
+
this->cursor[SP_KNOT_STATE_NORMAL] = NULL;
this->cursor[SP_KNOT_STATE_MOUSEOVER] = NULL;
this->cursor[SP_KNOT_STATE_DRAGGING] = NULL;
+ this->cursor[SP_KNOT_STATE_SELECTED] = NULL;
this->saved_cursor = NULL;
this->pixbuf = NULL;
@@ -172,12 +176,16 @@ void SPKnot::startDragging(Geom::Point const &p, gint x, gint y, guint32 etime)
if (!nograb) {
sp_canvas_item_grab(this->item, KNOT_EVENT_MASK, this->cursor[SP_KNOT_STATE_DRAGGING], etime);
}
-
this->setFlag(SP_KNOT_GRABBED, TRUE);
grabbed = TRUE;
}
+void SPKnot::selectKnot(bool select){
+ selected = select;
+ setFlag(SP_KNOT_SELECTED, select);
+}
+
/**
* Called to handle events on knots.
*/
@@ -216,6 +224,7 @@ static int sp_knot_handler(SPCanvasItem */*item*/, GdkEvent *event, SPKnot *knot
knot->startDragging(p, (gint) event->button.x, (gint) event->button.y, event->button.time);
knot->mousedown_signal.emit(knot, event->button.state);
consumed = TRUE;
+ knot->selectKnot(!knot->selected);
}
break;
case GDK_BUTTON_RELEASE:
@@ -224,9 +233,10 @@ static int sp_knot_handler(SPCanvasItem */*item*/, GdkEvent *event, SPKnot *knot
if (knot->desktop->event_context->_delayed_snap_event) {
sp_event_context_snap_watchdog_callback(knot->desktop->event_context->_delayed_snap_event);
}
-
sp_event_context_discard_delayed_snap_event(knot->desktop->event_context);
-
+ if(knot->flags & SP_KNOT_MOUSEOVER){
+ knot->selectKnot(!knot->selected);
+ }
knot->pressure = 0;
if (transform_escaped) {
@@ -423,6 +433,7 @@ void SPKnot::setFlag(guint flag, bool set) {
break;
case SP_KNOT_MOUSEOVER:
case SP_KNOT_DRAGGING:
+ case SP_KNOT_SELECTED:
this->_setCtrlState();
break;
case SP_KNOT_GRABBED:
@@ -458,8 +469,9 @@ void SPKnot::_setCtrlState() {
state = SP_KNOT_STATE_DRAGGING;
} else if (this->flags & SP_KNOT_MOUSEOVER) {
state = SP_KNOT_STATE_MOUSEOVER;
+ } else if (this->flags & SP_KNOT_STATE_SELECTED) {
+ state = SP_KNOT_STATE_SELECTED;
}
-
g_object_set(this->item, "fill_color", this->fill[state], NULL);
g_object_set(this->item, "stroke_color", this->stroke[state], NULL);
}
@@ -489,25 +501,28 @@ void SPKnot::setAngle(double i) {
angle = i;
}
-void SPKnot::setFill(guint32 normal, guint32 mouseover, guint32 dragging) {
+void SPKnot::setFill(guint32 normal, guint32 mouseover, guint32 dragging, guint32 selected) {
fill[SP_KNOT_STATE_NORMAL] = normal;
fill[SP_KNOT_STATE_MOUSEOVER] = mouseover;
fill[SP_KNOT_STATE_DRAGGING] = dragging;
+ fill[SP_KNOT_STATE_SELECTED] = selected;
}
-void SPKnot::setStroke(guint32 normal, guint32 mouseover, guint32 dragging) {
+void SPKnot::setStroke(guint32 normal, guint32 mouseover, guint32 dragging, guint32 selected) {
stroke[SP_KNOT_STATE_NORMAL] = normal;
stroke[SP_KNOT_STATE_MOUSEOVER] = mouseover;
stroke[SP_KNOT_STATE_DRAGGING] = dragging;
+ stroke[SP_KNOT_STATE_SELECTED] = selected;
}
-void SPKnot::setImage(guchar* normal, guchar* mouseover, guchar* dragging) {
+void SPKnot::setImage(guchar* normal, guchar* mouseover, guchar* dragging, guchar* selected) {
image[SP_KNOT_STATE_NORMAL] = normal;
image[SP_KNOT_STATE_MOUSEOVER] = mouseover;
image[SP_KNOT_STATE_DRAGGING] = dragging;
+ image[SP_KNOT_STATE_SELECTED] = selected;
}
-void SPKnot::setCursor(GdkCursor* normal, GdkCursor* mouseover, GdkCursor* dragging) {
+void SPKnot::setCursor(GdkCursor* normal, GdkCursor* mouseover, GdkCursor* dragging, GdkCursor* selected) {
if (cursor[SP_KNOT_STATE_NORMAL]) {
g_object_unref(cursor[SP_KNOT_STATE_NORMAL]);
}
@@ -537,6 +552,16 @@ void SPKnot::setCursor(GdkCursor* normal, GdkCursor* mouseover, GdkCursor* dragg
if (dragging) {
g_object_ref(dragging);
}
+
+ if (cursor[SP_KNOT_STATE_SELECTED]) {
+ g_object_unref(cursor[SP_KNOT_STATE_SELECTED]);
+ }
+
+ cursor[SP_KNOT_STATE_SELECTED] = selected;
+
+ if (selected) {
+ g_object_ref(selected);
+ }
}
/*
diff --git a/src/knot.h b/src/knot.h
index 0a0ce73d2..26e24da8f 100644
--- a/src/knot.h
+++ b/src/knot.h
@@ -68,7 +68,7 @@ public:
GdkCursor *saved_cursor;
void* pixbuf;
-
+ bool selected;
char *tip;
unsigned long _event_handler_id;
@@ -96,11 +96,11 @@ public:
void setPixbuf(void* p);
void setAngle(double i);
- void setFill(guint32 normal, guint32 mouseover, guint32 dragging);
- void setStroke(guint32 normal, guint32 mouseover, guint32 dragging);
- void setImage(unsigned char* normal, unsigned char* mouseover, unsigned char* dragging);
+ void setFill(guint32 normal, guint32 mouseover, guint32 dragging, guint32 selected);
+ void setStroke(guint32 normal, guint32 mouseover, guint32 dragging, guint32 selected);
+ void setImage(unsigned char* normal, unsigned char* mouseover, unsigned char* dragging, unsigned char* selected);
- void setCursor(GdkCursor* normal, GdkCursor* mouseover, GdkCursor* dragging);
+ void setCursor(GdkCursor* normal, GdkCursor* mouseover, GdkCursor* dragging, GdkCursor* selected);
/**
* Show knot on its canvas.
@@ -141,6 +141,10 @@ public:
* Move knot to new position, without emitting a MOVED signal.
*/
void moveto(Geom::Point const &p);
+ /**
+ * Select knot.
+ */
+ void selectKnot(bool select);
/**
* Returns position of knot.
@@ -161,6 +165,7 @@ void knot_ref(SPKnot* knot);
void knot_unref(SPKnot* knot);
#define SP_KNOT_IS_VISIBLE(k) ((k->flags & SP_KNOT_VISIBLE) != 0)
+#define SP_KNOT_IS_SELECTED(k) ((k->flags & SP_KNOT_SELECTED) != 0)
#define SP_KNOT_IS_MOUSEOVER(k) ((k->flags & SP_KNOT_MOUSEOVER) != 0)
#define SP_KNOT_IS_DRAGGING(k) ((k->flags & SP_KNOT_DRAGGING) != 0)
#define SP_KNOT_IS_GRABBED(k) ((k->flags & SP_KNOT_GRABBED) != 0)
diff --git a/src/seltrans.cpp b/src/seltrans.cpp
index 10b5b2837..1afb71f68 100644
--- a/src/seltrans.cpp
+++ b/src/seltrans.cpp
@@ -653,8 +653,8 @@ void Inkscape::SelTrans::_makeHandles()
knots[i]->setSize(13);
knots[i]->setAnchor(hands[i].anchor);
knots[i]->setMode(SP_CTRL_MODE_XOR);
- knots[i]->setFill(info.color[0], info.color[1], info.color[2]);
- knots[i]->setStroke(info.color[3], info.color[4], info.color[5]);
+ knots[i]->setFill(info.color[0], info.color[1], info.color[2],info.color[1]);
+ knots[i]->setStroke(info.color[3], info.color[4], info.color[5], info.color[4]);
knots[i]->setPixbuf(handles[hands[i].control]);
knots[i]->updateCtrl();
diff --git a/src/ui/tools/connector-tool.cpp b/src/ui/tools/connector-tool.cpp
index 29be4831a..ad0b9e8ba 100644
--- a/src/ui/tools/connector-tool.cpp
+++ b/src/ui/tools/connector-tool.cpp
@@ -348,7 +348,7 @@ cc_select_handle(SPKnot* knot)
knot->setShape(SP_KNOT_SHAPE_SQUARE);
knot->setSize(10);
knot->setAnchor(SP_ANCHOR_CENTER);
- knot->setFill(0x0000ffff, 0x0000ffff, 0x0000ffff);
+ knot->setFill(0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff);
knot->updateCtrl();
}
@@ -358,7 +358,7 @@ cc_deselect_handle(SPKnot* knot)
knot->setShape(SP_KNOT_SHAPE_SQUARE);
knot->setSize(8);
knot->setAnchor(SP_ANCHOR_CENTER);
- knot->setFill(0xffffff00, 0xff0000ff, 0xff0000ff);
+ knot->setFill(0xffffff00, 0xff0000ff, 0xff0000ff, 0xff0000ff);
knot->updateCtrl();
}
@@ -1058,7 +1058,7 @@ void ConnectorTool::_activeShapeAddKnot(SPItem* item) {
knot->setShape(SP_KNOT_SHAPE_SQUARE);
knot->setSize(8);
knot->setAnchor(SP_ANCHOR_CENTER);
- knot->setFill(0xffffff00, 0xff0000ff, 0xff0000ff);
+ knot->setFill(0xffffff00, 0xff0000ff, 0xff0000ff, 0xff0000ff);
knot->updateCtrl();
// We don't want to use the standard knot handler.
@@ -1176,8 +1176,8 @@ void ConnectorTool::cc_set_active_conn(SPItem *item) {
knot->setShape(SP_KNOT_SHAPE_SQUARE);
knot->setSize(7);
knot->setAnchor(SP_ANCHOR_CENTER);
- knot->setFill(0xffffff00, 0xff0000ff, 0xff0000ff);
- knot->setStroke(0x000000ff, 0x000000ff, 0x000000ff);
+ knot->setFill(0xffffff00, 0xff0000ff, 0xff0000ff, 0xff0000ff);
+ knot->setStroke(0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff);
knot->updateCtrl();
// We don't want to use the standard knot handler,
diff --git a/src/ui/tools/measure-tool.cpp b/src/ui/tools/measure-tool.cpp
index 7f3c99716..0da883891 100644
--- a/src/ui/tools/measure-tool.cpp
+++ b/src/ui/tools/measure-tool.cpp
@@ -332,14 +332,14 @@ MeasureTool::MeasureTool()
// create the knots
this->knot_start = new SPKnot(desktop, _("Measure start, <b>Shift+Click</b> for position dialog"));
this->knot_start->setMode(SP_KNOT_MODE_XOR);
- this->knot_start->setFill(MT_KNOT_COLOR_NORMAL, MT_KNOT_COLOR_MOUSEOVER, MT_KNOT_COLOR_MOUSEOVER);
- this->knot_start->setStroke(0x0000007f, 0x0000007f, 0x0000007f);
+ this->knot_start->setFill(MT_KNOT_COLOR_NORMAL, MT_KNOT_COLOR_MOUSEOVER, MT_KNOT_COLOR_MOUSEOVER, MT_KNOT_COLOR_MOUSEOVER);
+ this->knot_start->setStroke(0x0000007f, 0x0000007f, 0x0000007f, 0x0000007f);
this->knot_start->setShape(SP_KNOT_SHAPE_CIRCLE);
this->knot_start->updateCtrl();
this->knot_end = new SPKnot(desktop, _("Measure end, <b>Shift+Click</b> for position dialog"));
this->knot_end->setMode(SP_KNOT_MODE_XOR);
- this->knot_end->setFill(MT_KNOT_COLOR_NORMAL, MT_KNOT_COLOR_MOUSEOVER, MT_KNOT_COLOR_MOUSEOVER);
- this->knot_end->setStroke(0x0000007f, 0x0000007f, 0x0000007f);
+ this->knot_end->setFill(MT_KNOT_COLOR_NORMAL, MT_KNOT_COLOR_MOUSEOVER, MT_KNOT_COLOR_MOUSEOVER, MT_KNOT_COLOR_MOUSEOVER);
+ this->knot_end->setStroke(0x0000007f, 0x0000007f, 0x0000007f, 0x0000007f);
this->knot_end->setShape(SP_KNOT_SHAPE_CIRCLE);
this->knot_end->updateCtrl();
Geom::Rect display_area = desktop->get_display_area();
diff --git a/src/vanishing-point.cpp b/src/vanishing-point.cpp
index ed4a781cf..416f3673c 100644
--- a/src/vanishing-point.cpp
+++ b/src/vanishing-point.cpp
@@ -275,8 +275,8 @@ VPDragger::VPDragger(VPDrag *parent, Geom::Point p, VanishingPoint &vp)
// create the knot
this->knot = new SPKnot(SP_ACTIVE_DESKTOP, NULL);
this->knot->setMode(SP_KNOT_MODE_XOR);
- this->knot->setFill(VP_KNOT_COLOR_NORMAL, VP_KNOT_COLOR_NORMAL, VP_KNOT_COLOR_NORMAL);
- this->knot->setStroke(0x000000ff, 0x000000ff, 0x000000ff);
+ this->knot->setFill(VP_KNOT_COLOR_NORMAL, VP_KNOT_COLOR_NORMAL, VP_KNOT_COLOR_NORMAL, VP_KNOT_COLOR_NORMAL);
+ this->knot->setStroke(0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff);
this->knot->updateCtrl();
knot->item->ctrlType = CTRL_TYPE_ANCHOR;
ControlManager::getManager().track(knot->item);