X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=xboard.c;h=a8620227db1aa8ea44074250c6394fc5d644e651;hb=1e39d89485cd604e9008f947a24dde2842100e32;hp=7c8928da0f8de8d859c768630ef8b20140fe3703;hpb=b6a78e6a5c3d571973b43996efc4386d0b55742f;p=xboard.git diff --git a/xboard.c b/xboard.c index 7c8928d..a862022 100644 --- a/xboard.c +++ b/xboard.c @@ -839,23 +839,20 @@ int frameX, frameY; void GetActualPlacement (Widget wg, WindowPlacement *wp) { - Arg args[16]; - Dimension w, h; - Position x, y; XWindowAttributes winAt; Window win, dummy; - int i, rx, ry; + int rx, ry; if(!wg) return; - win = XtWindow(wg); - XGetWindowAttributes(xDisplay, win, &winAt); // this works, where XtGetValues on XtNx, XtNy does not! - XTranslateCoordinates (xDisplay, win, winAt.root, -winAt.border_width, -winAt.border_width, &rx, &ry, &dummy); - wp->x = rx - winAt.x; - wp->y = ry - winAt.y; - wp->height = winAt.height; - wp->width = winAt.width; - frameX = winAt.x; frameY = winAt.y; // remember to decide if windows touch + win = XtWindow(wg); + XGetWindowAttributes(xDisplay, win, &winAt); // this works, where XtGetValues on XtNx, XtNy does not! + XTranslateCoordinates (xDisplay, win, winAt.root, -winAt.border_width, -winAt.border_width, &rx, &ry, &dummy); + wp->x = rx - winAt.x; + wp->y = ry - winAt.y; + wp->height = winAt.height; + wp->width = winAt.width; + frameX = winAt.x; frameY = winAt.y; // remember to decide if windows touch } void @@ -930,16 +927,17 @@ ConvertToLine (int argc, char **argv) void InitDrawingSizes (BoardSize boardSize, int flags) { // [HGM] resize is functional now, but for board format changes only (nr of ranks, files) - Dimension timerWidth, boardWidth, boardHeight, w, h, sep, bor, wr, hr; - Arg args[16]; - XtGeometryResult gres; + Dimension boardWidth, boardHeight, w, h; int i; static Dimension oldWidth, oldHeight; static VariantClass oldVariant; - static int oldMono = -1; + static int oldMono = -1, oldTwoBoards = 0; if(!formWidget) return; + if(oldTwoBoards && !twoBoards) PopDown(DummyDlg); + oldTwoBoards = twoBoards; + if(appData.overrideLineGap >= 0) lineGap = appData.overrideLineGap; boardWidth = lineGap + BOARD_WIDTH * (squareSize + lineGap); boardHeight = lineGap + BOARD_HEIGHT * (squareSize + lineGap); @@ -1111,8 +1109,8 @@ InitDrawingParams () void InitializeFonts (int clockFontPxlSize, int coordFontPxlSize, int fontPxlSize) -{ // determine what fonts to use, and create them - XrmValue vFrom, vTo; +{ // detervtomine what fonts to use, and create them + XrmValue vTo; XrmDatabase xdb; if(!fontIsSet[CLOCK_FONT] && fontValid[CLOCK_FONT][squareSize]) @@ -1167,11 +1165,10 @@ InitializeFonts (int clockFontPxlSize, int coordFontPxlSize, int fontPxlSize) int main (int argc, char **argv) { - int i, j, clockFontPxlSize, coordFontPxlSize, fontPxlSize; + int i, clockFontPxlSize, coordFontPxlSize, fontPxlSize; XSetWindowAttributes window_attributes; Arg args[16]; - Dimension timerWidth, boardWidth, boardHeight, w, h, sep, bor, wr, hr; - XtGeometryResult gres; + Dimension boardWidth, boardHeight, w, h; char *p; int forceMono = False; @@ -1193,6 +1190,11 @@ main (int argc, char **argv) programName++; #ifdef ENABLE_NLS + XtSetLanguageProc(NULL, NULL, NULL); + if (appData.debugMode) { + fprintf(debugFP, "locale = %s\n", setlocale(LC_ALL, NULL)); + } + bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); #endif @@ -1256,12 +1258,6 @@ main (int argc, char **argv) XtAppInitialize(&appContext, "XBoard", shellOptions, XtNumber(shellOptions), &argc, argv, xboardResources, NULL, 0); -#ifdef ENABLE_NLS - XtSetLanguageProc(NULL, NULL, NULL); - if (appData.debugMode) { - fprintf(debugFP, "locale = %s\n", setlocale(LC_ALL, NULL)); - } -#endif XtGetApplicationResources(shellWidget, (XtPointer) &appData, clientResources, XtNumber(clientResources), @@ -1403,18 +1399,18 @@ XBoard square size (hint): %d\n\ #else &clockFonStruct); #endif - boardWidget = optList[22].handle; - menuBarWidget = optList[ 0].handle; - dropMenu = optList[25].handle; - titleWidget = optList[optList[10].type != -1 ? 10 : 13].handle; + boardWidget = optList[W_BOARD].handle; + menuBarWidget = optList[W_MENU].handle; + dropMenu = optList[W_DROP].handle; + titleWidget = optList[optList[W_TITLE].type != -1 ? W_TITLE : W_SMALL].handle; formWidget = XtParent(boardWidget); XtSetArg(args[0], XtNbackground, &timerBackgroundPixel); XtSetArg(args[1], XtNforeground, &timerForegroundPixel); - XtGetValues(optList[11].handle, args, 2); + XtGetValues(optList[W_WHITE].handle, args, 2); if (appData.showButtonBar) { // can't we use timer pixels for this? (Or better yet, just black & white?) XtSetArg(args[0], XtNbackground, &buttonBackgroundPixel); XtSetArg(args[1], XtNforeground, &buttonForegroundPixel); - XtGetValues(optList[18].handle, args, 2); + XtGetValues(optList[W_PAUSE].handle, args, 2); } AppendEnginesToMenu(appData.recentEngineList); @@ -1749,8 +1745,6 @@ CreateOneGC (XGCValues *gc_values, Pixel foreground, Pixel background) static void CreateGCs (int redo) { - XtGCMask value_mask = GCLineWidth | GCLineStyle | GCForeground - | GCBackground | GCFunction | GCPlaneMask; XGCValues gc_values; GC copyInvertedGC; Pixel white = XWhitePixel(xDisplay, xScreen); @@ -2298,7 +2292,7 @@ EnableMenuItem (char *menuRef, int state) void EnableButtonBar (int state) { - XtSetSensitive(optList[15].handle, state); + XtSetSensitive(optList[W_BUTTON].handle, state); } @@ -2314,8 +2308,6 @@ SetMenuEnables (Enables *enab) void KeyBindingProc (Widget w, XEvent *event, String *prms, Cardinal *nprms) { // [HGM] new method of key binding: specify MenuItem(FlipView) in stead of FlipViewProc in translation string - int i; - char *p; MenuItem *item; if(*nprms == 0) return; item = MenuNameToItem(prms[0]); @@ -2339,7 +2331,7 @@ MenuEngineSelect (Widget w, caddr_t addr, caddr_t index) void AppendMenuItem (char *msg, int n) { - CreateMenuItem((Widget) optList[6].textValue, msg, (XtCallbackProc) MenuEngineSelect, n); + CreateMenuItem((Widget) optList[W_ENGIN].textValue, msg, (XtCallbackProc) MenuEngineSelect, n); } void @@ -2832,7 +2824,7 @@ FileNamePopUp (char *label, char *def, char *filter, FileProc proc, char *openMo fileProc = proc; /* I can't see a way not */ fileOpenMode = openMode; /* to use globals here */ { // [HGM] use file-selector dialog stolen from Ghostview - int index; // this is not supported yet + // int index; // this is not supported yet Browse(BoardWindow, label, (def[0] ? def : NULL), filter, False, openMode, &openName, &openFP); } } @@ -2846,7 +2838,7 @@ FreezeUI () { if (frozen) return; /* Grab by a widget that doesn't accept input */ - XtAddGrab(optList[14].handle, TRUE, FALSE); + XtAddGrab(optList[W_MESSG].handle, TRUE, FALSE); frozen = 1; } @@ -2855,7 +2847,7 @@ void ThawUI () { if (!frozen) return; - XtRemoveGrab(optList[14].handle); + XtRemoveGrab(optList[W_MESSG].handle); frozen = 0; } @@ -2881,12 +2873,12 @@ ModeHighlight () Pixel oldbg, oldfg; XtSetArg(args[0], XtNbackground, &oldbg); XtSetArg(args[1], XtNforeground, &oldfg); - XtGetValues(optList[18].handle, + XtGetValues(optList[W_PAUSE].handle, args, 2); XtSetArg(args[0], XtNbackground, oldfg); XtSetArg(args[1], XtNforeground, oldbg); } - XtSetValues(optList[18].handle, args, 2); + XtSetValues(optList[W_PAUSE].handle, args, 2); } }