summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Owens <doctormo@gmail.com>2013-07-03 16:59:04 +0000
committerMartin Owens <doctormo@gmail.com>2013-07-03 16:59:04 +0000
commit419d9398abf7b8bae74548d5b2bbd8554b36a9b3 (patch)
tree0d2c73472d959a49bb0487f376d715db8fa86f37 /src
parentRefactor resize, rotate, skew handle code (diff)
downloadinkscape-419d9398abf7b8bae74548d5b2bbd8554b36a9b3.tar.gz
inkscape-419d9398abf7b8bae74548d5b2bbd8554b36a9b3.zip
Make handle colour a configurable property.
(bzr r12401)
Diffstat (limited to 'src')
-rw-r--r--src/seltrans-handles.cpp13
-rw-r--r--src/seltrans-handles.h4
-rw-r--r--src/seltrans.cpp13
-rw-r--r--src/seltrans.h2
4 files changed, 16 insertions, 16 deletions
diff --git a/src/seltrans-handles.cpp b/src/seltrans-handles.cpp
index cc11125f6..bacb1301e 100644
--- a/src/seltrans-handles.cpp
+++ b/src/seltrans-handles.cpp
@@ -6,14 +6,16 @@
#endif
SPSelTransTypeInfo const handtypes[] = {
- {N_("<b>Squeeze or stretch</b> selection; with <b>Ctrl</b> to scale uniformly; with <b>Shift</b> to scale around rotation center") },
- {N_("<b>Scale</b> selection; with <b>Ctrl</b> to scale uniformly; with <b>Shift</b> to scale around rotation center") },
- {N_("<b>Skew</b> selection; with <b>Ctrl</b> to snap angle; with <b>Shift</b> to skew around the opposite side") },
- {N_("<b>Rotate</b> selection; with <b>Ctrl</b> to snap angle; with <b>Shift</b> to rotate around the opposite corner") },
- {N_("<b>Center</b> of rotation and skewing: drag to reposition; scaling with Shift also uses this center") }
+ { DEF_COLOR, N_("<b>Squeeze or stretch</b> selection; with <b>Ctrl</b> to scale uniformly; with <b>Shift</b> to scale around rotation center") },
+ { DEF_COLOR, N_("<b>Scale</b> selection; with <b>Ctrl</b> to scale uniformly; with <b>Shift</b> to scale around rotation center") },
+ { DEF_COLOR, N_("<b>Skew</b> selection; with <b>Ctrl</b> to snap angle; with <b>Shift</b> to skew around the opposite side") },
+ { DEF_COLOR, N_("<b>Rotate</b> selection; with <b>Ctrl</b> to snap angle; with <b>Shift</b> to rotate around the opposite corner") },
+ { CEN_COLOR, N_("<b>Center</b> of rotation and skewing: drag to reposition; scaling with Shift also uses this center") }
};
SPSelTransHandle const hands[] = {
+//center handle will be 0 so we can reference it quickly.
+ {HANDLE_CENTER, SP_ANCHOR_CENTER, GDK_CROSSHAIR, 12, 0.5, 0.5},
//handle-type anchor cursor control x y
{HANDLE_STRETCH, SP_ANCHOR_S, GDK_TOP_SIDE, 3, 0.5, 1},
{HANDLE_STRETCH, SP_ANCHOR_W, GDK_RIGHT_SIDE, 2, 1, 0.5},
@@ -31,7 +33,6 @@ SPSelTransHandle const hands[] = {
{HANDLE_ROTATE, SP_ANCHOR_SW, GDK_EXCHANGE, 6, 1, 1},
{HANDLE_ROTATE, SP_ANCHOR_NW, GDK_EXCHANGE, 8, 1, 0},
{HANDLE_ROTATE, SP_ANCHOR_NE, GDK_EXCHANGE, 10, 0, 0},
- {HANDLE_CENTER, SP_ANCHOR_CENTER, GDK_CROSSHAIR, 12, 0.5, 0.5}
};
/*
diff --git a/src/seltrans-handles.h b/src/seltrans-handles.h
index ef285392b..5c3fdd269 100644
--- a/src/seltrans-handles.h
+++ b/src/seltrans-handles.h
@@ -21,6 +21,9 @@ namespace Inkscape
class SelTrans;
}
+guint32 const DEF_COLOR[] = { 0xff, 0xff6600, 0xff6600, 0xff, 0xff, 0xff };
+guint32 const CEN_COLOR[] = { 0x0, 0x0, 0x0, 0xff, 0xff0000b0, 0xff0000b0 };
+
enum SPSelTransType {
HANDLE_STRETCH,
HANDLE_SCALE,
@@ -30,6 +33,7 @@ enum SPSelTransType {
};
struct SPSelTransTypeInfo {
+ uint const *color;
gchar const *tip;
};
// One per handle type in order
diff --git a/src/seltrans.cpp b/src/seltrans.cpp
index 016eba816..33bfe3e4a 100644
--- a/src/seltrans.cpp
+++ b/src/seltrans.cpp
@@ -635,23 +635,18 @@ void Inkscape::SelTrans::_showHandles(SPSelTransType type)
void Inkscape::SelTrans::_makeHandles()
{
for (int i = 0; i < NUMHANDS; i++) {
- knots[i] = sp_knot_new(_desktop, handtypes[hands[i].type].tip);
+ SPSelTransTypeInfo info = handtypes[hands[i].type];
+ knots[i] = sp_knot_new(_desktop, info.tip);
knots[i]->setShape(SP_CTRL_SHAPE_BITMAP);
knots[i]->setSize(13);
knots[i]->setAnchor(hands[i].anchor);
knots[i]->setMode(SP_CTRL_MODE_XOR);
- knots[i]->setFill(0x000000ff, 0x00ff6600, 0x00ff6600); // invert+2*green
- knots[i]->setStroke(0x000000ff, 0x000000ff, 0x000000ff); // 3*invert
+ 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]->setPixbuf(handles[hands[i].control]);
sp_knot_update_ctrl(knots[i]);
- if( hands[i].type == HANDLE_CENTER ) {
- _center_handle = i;
- knots[i]->setFill(0x00000000, 0x00000000, 0x00000000);
- knots[i]->setStroke(0x000000ff, 0xff0000b0, 0xff0000b0);
- }
-
g_signal_connect(G_OBJECT(knots[i]), "request",
G_CALLBACK(sp_sel_trans_handle_request), (gpointer) &hands[i]);
g_signal_connect(G_OBJECT(knots[i]), "moved",
diff --git a/src/seltrans.h b/src/seltrans.h
index 9cf4a7aaf..667dedaf0 100644
--- a/src/seltrans.h
+++ b/src/seltrans.h
@@ -93,7 +93,7 @@ public:
return _grabbed;
}
bool centerIsVisible() {
- return ( _center_handle && SP_KNOT_IS_VISIBLE (knots[_center_handle]) );
+ return ( SP_KNOT_IS_VISIBLE (knots[0]) );
}
void getNextClosestPoint(bool reverse);