{
int r, f;
if(!appData.markers || !appData.highlightDragging) return;
- for(r=0; r<BOARD_HEIGHT; r++) for(f=BOARD_LEFT; f<BOARD_RGHT; f++) marker[r][f] = legal[r][f] = 0;
+ for(r=0; r<BOARD_HEIGHT; r++) for(f=BOARD_LEFT; f<BOARD_RGHT; f++) legal[r][f] = 0;
r=BOARD_HEIGHT-1; f=BOARD_LEFT;
while(*fen) {
int s = 0;
if(*fen == '/' && f > BOARD_LEFT) f = BOARD_LEFT, r--; else
if(*fen == 'T') marker[r][f++] = 0; else
if(*fen == 'Y') marker[r][f++] = 1; else
+ if(*fen == 'G') marker[r][f++] = 3; else
+ if(*fen == 'B') marker[r][f++] = 4; else
+ if(*fen == 'C') marker[r][f++] = 5; else
+ if(*fen == 'M') marker[r][f++] = 6; else
+ if(*fen == 'W') marker[r][f++] = 7; else
+ if(*fen == 'D') marker[r][f++] = 8; else
if(*fen == 'R') marker[r][f++] = 2; else {
while(*fen <= '9' && *fen >= '0') s = 10*s + *fen++ - '0';
f += s; fen -= s>0;
{
char buf[MSG_SIZ]; // Inform engine of what user does
int r, f;
- if(action[0] == 'l') // mark any target square of a lifted piece as legal to-square
- for(r=0; r<BOARD_HEIGHT; r++) for(f=BOARD_LEFT; f<BOARD_RGHT; f++) legal[r][f] = 1;
+ if(action[0] == 'l') // mark any target square of a lifted piece as legal to-square, clear markers
+ for(r=0; r<BOARD_HEIGHT; r++) for(f=BOARD_LEFT; f<BOARD_RGHT; f++) legal[r][f] = 1, marker[r][f] = 0;
if(!first.highlight || gameMode == EditPosition) return;
snprintf(buf, MSG_SIZ, "%s %c%d%s\n", action, x+AAA, y+ONE-'0', controlKey && action[0]=='p' ? "," : "");
SendToProgram(buf, &first);
cairo_destroy (cr);
}
+static char *markerColor[8] = { "#FFFF00", "#FF0000", "#00FF00", "#0000FF", "#00FFFF", "#FF00FF", "#FFFFFF", "#000000" };
+
void
DoDrawDot (cairo_surface_t *cs, int marker, int x, int y, int r)
{
cairo_stroke_preserve(cr);
SetPen(cr, 2, marker == 2 ? "#FFFFFF" : "#000000", 0);
} else {
- SetPen(cr, 2, marker == 2 ? "#FF0000" : "#FFFF00", 0);
+ SetPen(cr, 2, markerColor[marker-1], 0);
}
cairo_fill(cr);
RECT boardRect;\r
COLORREF lightSquareColor, darkSquareColor, whitePieceColor, \r
blackPieceColor, highlightSquareColor, premoveHighlightColor;\r
+COLORREF markerColor[8] = { 0x00FFFF, 0x0000FF, 0x00FF00, 0xFF0000, 0xFFFF00, 0xFF00FF, 0xFFFFFF, 0x000000 };\r
HPALETTE hPal;\r
ColorClass currentColorClass;\r
\r
static HBRUSH lightSquareBrush, darkSquareBrush,\r
blackSquareBrush, /* [HGM] for band between board and holdings */\r
explodeBrush, /* [HGM] atomic */\r
- markerBrush, /* [HGM] markers */\r
+ markerBrush[8], /* [HGM] markers */\r
whitePieceBrush, blackPieceBrush, iconBkgndBrush /*, outlineBrush*/;\r
static POINT gridEndpoints[(BOARD_RANKS + BOARD_FILES + 2) * 2];\r
static DWORD gridVertexCounts[BOARD_RANKS + BOARD_FILES + 2];\r
VOID\r
InitDrawingColors()\r
{\r
+ int i;\r
if (pLogPal == NULL) {\r
/* Allocate enough memory for a logical palette with\r
* PALETTESIZE entries and set the size and version fields\r
blackPieceBrush = CreateSolidBrush(blackPieceColor);\r
iconBkgndBrush = CreateSolidBrush(GetSysColor(COLOR_BACKGROUND));\r
explodeBrush = CreateSolidBrush(highlightSquareColor); // [HGM] atomic\r
- markerBrush = CreateSolidBrush(premoveHighlightColor); // [HGM] markers\r
- /* [AS] Force rendering of the font-based pieces */\r
+ for(i=0; i<8;i++) markerBrush[i] = CreateSolidBrush(markerColor[i]); // [HGM] markers\r
+\r
+ /* [AS] Force rendering of the font-based pieces */\r
if( fontBitmapSquareSize > 0 ) {\r
fontBitmapSquareSize = 0;\r
}\r
{\r
int square = color & 0x80;\r
HBRUSH oldBrush = SelectObject(hdcSeek, \r
- color == 0 ? markerBrush : color == 1 ? darkSquareBrush : explodeBrush);\r
+ color == 0 ? markerBrush[1] : color == 1 ? darkSquareBrush : explodeBrush);\r
color &= 0x7F;\r
if(square)\r
Rectangle(hdcSeek, boardRect.left+x - squareSize/9, boardRect.top+y - squareSize/9,\r
for (row = 0; row < BOARD_HEIGHT; row++) {\r
for (column = 0; column < BOARD_WIDTH; column++) {\r
if (marker[row][column]) { // marker changes only occur with full repaint!\r
- HBRUSH oldBrush = SelectObject(hdcmem, \r
- marker[row][column] == 2 ? markerBrush : explodeBrush);\r
+ HBRUSH oldBrush = SelectObject(hdcmem, markerBrush[marker[row][column]-1]);\r
SquareToPos(row, column, &x, &y);\r
Ellipse(hdcmem, x + squareSize/4, y + squareSize/4,\r
x + 3*squareSize/4, y + 3*squareSize/4);\r