From 894916fe72347000731f92313b9c2230fd837247 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Tue, 22 Mar 2016 12:04:12 +0100 Subject: [PATCH] Make startup announcement self-disappearing The startup message is now configurable through an option -startupMessage, and the master config file sets this to announce the help clicks. The message can contain multiple lines. The display of lines that are a sub-string of the option -messageSuppress is suppressed, however. Using a help-click sets this latter option to the help-click announcement, so that people who have used help clicks won't see this message anymoe. Displaying the startup message is now only considered on board draws that ordered a full repaint. --- args.h | 2 ++ board.c | 17 +++++++++++++---- common.h | 2 ++ dialogs.c | 2 ++ xboard.conf | 5 +++++ 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/args.h b/args.h index d7e69af..866a6a9 100644 --- a/args.h +++ b/args.h @@ -712,6 +712,8 @@ ArgDescriptor argDescriptors[] = { { "firstDrawDepth", ArgInt, (void *) &appData.drawDepth[0], FALSE, (ArgIniType) 0 }, { "secondDrawDepth", ArgInt, (void *) &appData.drawDepth[1], FALSE, (ArgIniType) 0 }, { "memoHeaders", ArgBoolean, (void *) &appData.headers, TRUE, (ArgIniType) FALSE }, + { "startupMessage", ArgString, (void *) &appData.message, FALSE, (ArgIniType) "" }, + { "messageSuppress", ArgString, (void *) &appData.suppress, XBOARD, (ArgIniType) "" }, #if ZIPPY { "zippyTalk", ArgBoolean, (void *) &appData.zippyTalk, FALSE, (ArgIniType) ZIPPY_TALK }, diff --git a/board.c b/board.c index d89ff7d..7b3535a 100644 --- a/board.c +++ b/board.c @@ -1052,10 +1052,19 @@ DrawPosition (int repaint, Board board) 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); + if(repaint && SubtractTimeMarks(&now, &programStartTime) < 1000) { + char *p = appData.message, *q; + i = 0; + while(*p) { + q = strchr(p, '\n'); + if(q) *q = NULLCHAR; + if(!strstr(appData.suppress, p)) { + if(i == 0) DrawSeekBackground(2*squareSize, 3*squareSize, 6*squareSize, 5*squareSize); + DrawText(p, 2*squareSize + 5, (int) ((3 + 0.3*i++)*squareSize) + 5, 2); + } + if(q) *q++ = '\n'; else q = ""; + p = q; + } GraphExpose(currBoard, 2*squareSize, 3*squareSize, 4*squareSize, 2*squareSize); messedUp = TRUE; } else messedUp = FALSE; diff --git a/common.h b/common.h index b4f6c3e..c98ba91 100644 --- a/common.h +++ b/common.h @@ -798,6 +798,8 @@ typedef struct { int recentEngines; char *recentEngineList; + char *message; + char *suppress; char *tourneyFile; char *defName; char *processes; diff --git a/dialogs.c b/dialogs.c index 4c2da69..189a869 100644 --- a/dialogs.c +++ b/dialogs.c @@ -2543,6 +2543,8 @@ DisplayHelp (char *name) } else snprintf(buf, MSG_SIZ, "%s", xboardMan); // use xboard man f = fopen(buf, "r"); if(f) { + char *msg = "Right-clicking menu item or dialog text pops up help on it"; + ASSIGN(appData.suppress, msg); if(strstr(buf, ".gz")) { // man file is gzipped if(!manText[n]) { // unzipped text not buffered yet snprintf(tidy, MSG_SIZ, "gunzip -c %s", buf); diff --git a/xboard.conf b/xboard.conf index 8e4fe92..1457551 100644 --- a/xboard.conf +++ b/xboard.conf @@ -140,6 +140,11 @@ Open Chat Box (name);$chat; # end } ; +; Anouncement to make at startup +; +-startupMessage {Right-clicking menu item or +dialog text pops up help on it} +; ; Save user settings. ; Must be last in file to make user options prevail over system-wide settings! ; -- 1.7.0.4