From 385f8b4e934bdc4e426a5c1c9e348119447c90e2 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Mon, 14 Mar 2016 15:18:18 +0100 Subject: [PATCH] Display message on the board at startup Drawing the board in the first second of running will display a short message on top of it, to alert the user to the help-click possibility. --- board.c | 15 ++++++++++++++- draw.c | 2 +- draw.h | 1 + 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/board.c b/board.c index ff5a7f2..a368356 100644 --- a/board.c +++ b/board.c @@ -919,10 +919,12 @@ DrawPosition (int repaint, Board board) static int lastFlipView = 0; static int lastBoardValid[2] = {0, 0}; static Board lastBoard[2]; - static char lastMarker[BOARD_RANKS][BOARD_FILES]; + static char lastMarker[BOARD_RANKS][BOARD_FILES], messedUp; int rrow, rcol; int nr = twoBoards*partnerUp; + repaint |= messedUp; + if(DrawSeekGraph()) return; // [HGM] seekgraph: suppress any drawing if seek graph up if (board == NULL) { @@ -1050,6 +1052,17 @@ DrawPosition (int repaint, Board board) FlashDelay(0); // this flushes drawing queue; if(nr) SwitchWindow(1); + else { + TimeMark now; + GetTimeMark(&now); + if(SubtractTimeMarks(&now, &programStartTime) < 1000) { + DrawSeekBackground(2*squareSize, 3*squareSize, 6*squareSize, 5*squareSize); + DrawText("Right-clicking dialog texts", 2*squareSize + 5, 3*squareSize + 5, 2); + DrawText("pops up help on them", 2*squareSize + 5, (int) (3.3*squareSize) + 5, 2); + GraphExpose(currBoard, 2*squareSize, 3*squareSize, 4*squareSize, 2*squareSize); + messedUp = TRUE; + } else messedUp = FALSE; + } } /* [AS] Arrow highlighting support */ diff --git a/draw.c b/draw.c index 16c4b0d..8d3dbf4 100644 --- a/draw.c +++ b/draw.c @@ -791,7 +791,7 @@ DrawUnicode (cairo_surface_t *canvas, char *string, int x, int y, char id, int f cairo_destroy(cr); } -static void +void DrawText (char *string, int x, int y, int align) { int xx = x, yy = y; diff --git a/draw.h b/draw.h index 94dea75..1d1511f 100644 --- a/draw.h +++ b/draw.h @@ -68,6 +68,7 @@ void CreateGrid P((void)); void DrawSegment P((int x, int y, int *lastX, int *lastY, int p)); void DrawRectangle P((int left, int top, int right, int bottom, int side, int style)); void DrawEvalText P((char *buf, int cbBuf, int y)); +void DrawText P((char *string, int x, int y, int align)); extern Option *disp; extern char svgDir[]; -- 1.7.0.4