\r
/* [AS] Arrow highlighting support */\r
\r
-static int A_WIDTH = 5; /* Width of arrow body */\r
+static double A_WIDTH = 5; /* Width of arrow body */\r
\r
#define A_HEIGHT_FACTOR 6 /* Length of arrow "point", relative to body width */\r
#define A_WIDTH_FACTOR 3 /* Width of arrow "point", relative to body width */\r
if( d_x == s_x ) {\r
int h = (d_y > s_y) ? +A_WIDTH*A_HEIGHT_FACTOR : -A_WIDTH*A_HEIGHT_FACTOR;\r
\r
- arrow[0].x = s_x + A_WIDTH;\r
+ arrow[0].x = s_x + A_WIDTH + 0.5;\r
arrow[0].y = s_y;\r
\r
- arrow[1].x = s_x + A_WIDTH;\r
+ arrow[1].x = s_x + A_WIDTH + 0.5;\r
arrow[1].y = d_y - h;\r
\r
- arrow[2].x = s_x + A_WIDTH*A_WIDTH_FACTOR;\r
+ arrow[2].x = arrow[1].x + A_WIDTH*(A_WIDTH_FACTOR-1) + 0.5;\r
arrow[2].y = d_y - h;\r
\r
arrow[3].x = d_x;\r
arrow[3].y = d_y;\r
\r
- arrow[4].x = s_x - A_WIDTH*A_WIDTH_FACTOR;\r
- arrow[4].y = d_y - h;\r
-\r
- arrow[5].x = s_x - A_WIDTH;\r
+ arrow[5].x = arrow[1].x - 2*A_WIDTH + 0.5;\r
arrow[5].y = d_y - h;\r
\r
- arrow[6].x = s_x - A_WIDTH;\r
+ arrow[4].x = arrow[5].x - A_WIDTH*(A_WIDTH_FACTOR-1) + 0.5;\r
+ arrow[4].y = d_y - h;\r
+\r
+ arrow[6].x = arrow[1].x - 2*A_WIDTH + 0.5;\r
arrow[6].y = s_y;\r
}\r
else if( d_y == s_y ) {\r
int w = (d_x > s_x) ? +A_WIDTH*A_HEIGHT_FACTOR : -A_WIDTH*A_HEIGHT_FACTOR;\r
\r
arrow[0].x = s_x;\r
- arrow[0].y = s_y + A_WIDTH;\r
+ arrow[0].y = s_y + A_WIDTH + 0.5;\r
\r
arrow[1].x = d_x - w;\r
- arrow[1].y = s_y + A_WIDTH;\r
+ arrow[1].y = s_y + A_WIDTH + 0.5;\r
\r
arrow[2].x = d_x - w;\r
- arrow[2].y = s_y + A_WIDTH*A_WIDTH_FACTOR;\r
+ arrow[2].y = arrow[1].y + A_WIDTH*(A_WIDTH_FACTOR-1) + 0.5;\r
\r
arrow[3].x = d_x;\r
arrow[3].y = d_y;\r
\r
- arrow[4].x = d_x - w;\r
- arrow[4].y = s_y - A_WIDTH*A_WIDTH_FACTOR;\r
-\r
arrow[5].x = d_x - w;\r
- arrow[5].y = s_y - A_WIDTH;\r
+ arrow[5].y = arrow[1].y - 2*A_WIDTH + 0.5;\r
+\r
+ arrow[4].x = d_x - w;\r
+ arrow[4].y = arrow[5].y - A_WIDTH*(A_WIDTH_FACTOR-1) + 0.5;\r
\r
arrow[6].x = s_x;\r
- arrow[6].y = s_y - A_WIDTH;\r
+ arrow[6].y = arrow[1].y - 2*A_WIDTH + 0.5;\r
}\r
else {\r
/* [AS] Needed a lot of paper for this! :-) */\r
arrow[0].x = Round(x - j);\r
arrow[0].y = Round(y + j*dx);\r
\r
- arrow[1].x = Round(x + j);\r
- arrow[1].y = Round(y - j*dx);\r
+ arrow[1].x = Round(arrow[0].x + 2*j); // [HGM] prevent width to be affected by rounding twice\r
+ arrow[1].y = Round(arrow[0].y - 2*j*dx);\r
\r
if( d_x > s_x ) {\r
x = (double) d_x - k;\r
y = (double) d_y + k*dy;\r
}\r
\r
- arrow[2].x = Round(x + j);\r
- arrow[2].y = Round(y - j*dx);\r
+ x = Round(x); y = Round(y); // [HGM] make sure width of shaft is rounded the same way on both ends\r
\r
- arrow[3].x = Round(x + j*A_WIDTH_FACTOR);\r
- arrow[3].y = Round(y - j*A_WIDTH_FACTOR*dx);\r
+ arrow[6].x = Round(x - j);\r
+ arrow[6].y = Round(y + j*dx);\r
+\r
+ arrow[2].x = Round(arrow[6].x + 2*j);\r
+ arrow[2].y = Round(arrow[6].y - 2*j*dx);\r
+\r
+ arrow[3].x = Round(arrow[2].x + j*(A_WIDTH_FACTOR-1));\r
+ arrow[3].y = Round(arrow[2].y - j*(A_WIDTH_FACTOR-1)*dx);\r
\r
arrow[4].x = d_x;\r
arrow[4].y = d_y;\r
\r
- arrow[5].x = Round(x - j*A_WIDTH_FACTOR);\r
- arrow[5].y = Round(y + j*A_WIDTH_FACTOR*dx);\r
-\r
- arrow[6].x = Round(x - j);\r
- arrow[6].y = Round(y + j*dx);\r
+ arrow[5].x = Round(arrow[6].x - j*(A_WIDTH_FACTOR-1));\r
+ arrow[5].y = Round(arrow[6].y + j*(A_WIDTH_FACTOR-1)*dx);\r
}\r
\r
Polygon( hdc, arrow, 7 );\r
SquareToPos( d_row, d_col, &d_x, &d_y);\r
\r
if( d_y > s_y ) {\r
- d_y += squareSize / 4;\r
+ d_y += squareSize / 2 - squareSize / 4; // [HGM] round towards same centers on all sides!\r
}\r
else if( d_y < s_y ) {\r
- d_y += 3 * squareSize / 4;\r
+ d_y += squareSize / 2 + squareSize / 4;\r
}\r
else {\r
d_y += squareSize / 2;\r
}\r
\r
if( d_x > s_x ) {\r
- d_x += squareSize / 4;\r
+ d_x += squareSize / 2 - squareSize / 4;\r
}\r
else if( d_x < s_x ) {\r
- d_x += 3 * squareSize / 4;\r
+ d_x += squareSize / 2 + squareSize / 4;\r
}\r
else {\r
d_x += squareSize / 2;\r
s_y += squareSize / 2;\r
\r
/* Adjust width */\r
- A_WIDTH = squareSize / 14;\r
+ A_WIDTH = squareSize / 14.; //[HGM] make float\r
\r
/* Draw */\r
stLB.lbStyle = BS_SOLID;\r