From: H.G. Muller Date: Thu, 5 Apr 2012 19:56:52 +0000 (+0200) Subject: Add -dialogColor and -buttonColor options X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=24f7a493a2d030011b0a4f883eaeeb6cbf991414;p=xboard.git Add -dialogColor and -buttonColor options These only override system defaults if they are non-empty strings. --- diff --git a/args.h b/args.h index 0e91101..a08d49b 100644 --- a/args.h +++ b/args.h @@ -651,6 +651,8 @@ ArgDescriptor argDescriptors[] = { { "viewerOptions", ArgString, (void *) &appData.viewerOptions, TRUE, (ArgIniType) "-ncp -engineOutputUp false -saveSettingsOnExit false" }, { "autoCopyPV", ArgBoolean, (void *) &appData.autoCopyPV, TRUE, FALSE }, { "topLevel", ArgBoolean, (void *) &appData.topLevel, XBOARD, (ArgIniType) TOPLEVEL }, + { "dialogColor", ArgString, (void *) &appData.dialogColor, XBOARD, (ArgIniType) "" }, + { "buttonColor", ArgString, (void *) &appData.buttonColor, XBOARD, (ArgIniType) "" }, #if ZIPPY { "zippyTalk", ArgBoolean, (void *) &appData.zippyTalk, FALSE, (ArgIniType) ZIPPY_TALK }, diff --git a/common.h b/common.h index 236a69d..2d8162b 100644 --- a/common.h +++ b/common.h @@ -384,6 +384,8 @@ typedef struct { char *jailSquareColor; char *highlightSquareColor; char *premoveHighlightColor; + char *dialogColor; + char *buttonColor; #else int whitePieceColor; int blackPieceColor; diff --git a/xboard.c b/xboard.c index 81477c5..ada34c2 100644 --- a/xboard.c +++ b/xboard.c @@ -301,7 +301,7 @@ int xScreen; Display *xDisplay; Window xBoardWindow; Pixel lightSquareColor, darkSquareColor, whitePieceColor, blackPieceColor, - highlightSquareColor, premoveHighlightColor; + highlightSquareColor, premoveHighlightColor, dialogColor, buttonColor; Pixel lowTimeWarningColor; GC lightSquareGC, darkSquareGC, lineGC, wdPieceGC, wlPieceGC, bdPieceGC, blPieceGC, wbPieceGC, bwPieceGC, coordGC, highlineGC, @@ -1258,6 +1258,8 @@ MakeColors () forceMono |= MakeOneColor(appData.blackPieceColor, &blackPieceColor); forceMono |= MakeOneColor(appData.highlightSquareColor, &highlightSquareColor); forceMono |= MakeOneColor(appData.premoveHighlightColor, &premoveHighlightColor); + if(appData.dialogColor[0]) MakeOneColor(appData.dialogColor, &dialogColor); + if(appData.buttonColor[0]) MakeOneColor(appData.buttonColor, &buttonColor); return forceMono; } diff --git a/xboard.h b/xboard.h index 7f12900..188e507 100644 --- a/xboard.h +++ b/xboard.h @@ -159,7 +159,7 @@ extern int squareSize; extern Pixmap xMarkPixmap, wIconPixmap, bIconPixmap; extern char *layoutName; extern Arg layoutArgs[2], formArgs[2], messageArgs[4]; -extern Pixel timerForegroundPixel, timerBackgroundPixel; +extern Pixel timerForegroundPixel, timerBackgroundPixel, dialogColor, buttonColor; extern int searchTime; extern Atom wm_delete_window; extern int squareSize, lineGap, defaultLineGap, useImages, useImageSqs; diff --git a/xoptions.c b/xoptions.c index 1c711bb..528ab3a 100644 --- a/xoptions.c +++ b/xoptions.c @@ -676,6 +676,12 @@ SetPositionAndSize (Arg *args, Widget leftNeigbor, Widget topNeigbor, int b, int // set size (if given) if(w) XtSetArg(args[j], XtNwidth, w), j++; if(h) XtSetArg(args[j], XtNheight, h), j++; + // color + if(!appData.monoMode) { + if(!b && appData.dialogColor[0]) XtSetArg(args[j], XtNbackground, dialogColor), j++; + if(b == 3 && appData.buttonColor[0]) XtSetArg(args[j], XtNbackground, buttonColor), j++; + if(b == 3) b = 1; + } // border XtSetArg(args[j], XtNborderWidth, b); j++; return j; @@ -726,6 +732,9 @@ GenericPopUp (Option *option, char *title, DialogClass dlgNr, DialogClass parent layout = XtCreateManagedWidget(layoutName, formWidgetClass, popup, layoutArgs, XtNumber(layoutArgs)); + if(!appData.monoMode && appData.dialogColor[0]) XtSetArg(args[0], XtNbackground, dialogColor); + XtSetValues(layout, args, 1); + for(c=0; c