X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=xhistory.c;h=dca93196aa57e829db890ca41c853259ccc6b1c3;hb=97e95c084e4aacf02203d723937579e898d8e9ee;hp=ed338bff526cc39260b92cfc25d7af4775906ae2;hpb=739a44fd95050c7986678c41f655bc89cfce7f0d;p=xboard.git diff --git a/xhistory.c b/xhistory.c index ed338bf..dca9319 100644 --- a/xhistory.c +++ b/xhistory.c @@ -1,6 +1,5 @@ /* * xhistory.c -- Move list window, part of X front end for XBoard - * $Id$ * * Copyright 2000,2009 Free Software Foundation, Inc. * ------------------------------------------------------------------------ @@ -79,7 +78,7 @@ extern char *getenv(); #define _LL_ 100 -extern Widget formWidget, shellWidget, boardWidget, menuBarWidget; +extern Widget formWidget, shellWidget, boardWidget, menuBarWidget, historyShell; extern Display *xDisplay; extern int squareSize; extern Pixmap xMarkPixmap; @@ -95,6 +94,7 @@ struct History{ struct History *hist=0; String dots=" ... "; Position gameHistoryX, gameHistoryY; +Dimension gameHistoryW, gameHistoryH; void HistoryPopDown(w, client_data, call_data) @@ -104,11 +104,18 @@ HistoryPopDown(w, client_data, call_data) Arg args[16]; int j; if(hist) { + // [HGM] remember old position j = 0; XtSetArg(args[j], XtNx, &gameHistoryX); j++; XtSetArg(args[j], XtNy, &gameHistoryY); j++; + XtSetArg(args[j], XtNwidth, &gameHistoryW); j++; + XtSetArg(args[j], XtNheight, &gameHistoryH); j++; XtGetValues(hist->sh, args, j); + wpMoveHistory.x = gameHistoryX - 4; + wpMoveHistory.y = gameHistoryY - 23; + wpMoveHistory.width = gameHistoryW; + wpMoveHistory.height = gameHistoryH; XtPopdown(hist->sh); hist->Up=False; @@ -165,7 +172,6 @@ void HistoryAlloc(int len){ } -#if 1 /* Find empty space inside vbox form widget and redistribute it amongst the list widgets inside it. */ /* This version sort of works */ @@ -214,58 +220,6 @@ HistoryFill() XtSetArg(args[j], XtNwidth, w); j++; XtSetValues(hist->mvb, args, j); } -#else -/* Find empty space inside vbox form widget and redistribute it amongst - the list widgets inside it. */ -/* This version doesn't work */ -void -HistoryFill() -{ - Arg args[16]; - Dimension fw, niw, wiw, biw, nbw, wbw, bbw; - int j, nl, wl, bl, fdd; - long extra; - - j = 0; - XtSetArg(args[j], XtNwidth, &fw); j++; - XtSetArg(args[j], XtNdefaultDistance, &fdd); j++; - XtGetValues(hist->vbox, args, j); - - j = 0; - XtSetArg(args[j], XtNlongest, &nl); j++; - XtSetArg(args[j], XtNinternalWidth, &niw); j++; - XtSetArg(args[j], XtNborderWidth, &nbw); j++; - XtGetValues(hist->mvn, args, j); - - j = 0; - XtSetArg(args[j], XtNlongest, &wl); j++; - XtSetArg(args[j], XtNinternalWidth, &wiw); j++; - XtSetArg(args[j], XtNborderWidth, &wbw); j++; - XtGetValues(hist->mvw, args, j); - - j = 0; - XtSetArg(args[j], XtNlongest, &bl); j++; - XtSetArg(args[j], XtNinternalWidth, &biw); j++; - XtSetArg(args[j], XtNborderWidth, &bbw); j++; - XtGetValues(hist->mvb, args, j); - - extra = fw - 4*fdd - - nl - 1 - 2*niw - 2*nbw - wl - 2*wiw - 2*wbw - bl - 2*biw - 2*bbw; - if (extra < 0) extra = 0; - - j = 0; - XtSetArg(args[j], XtNwidth, nl + 1 + 2*niw); j++; - XtSetValues(hist->mvn, args, j); - - j = 0; - XtSetArg(args[j], XtNwidth, wl + 2*wiw + extra/2); j++; - XtSetValues(hist->mvw, args, j); - - j = 0; - XtSetArg(args[j], XtNwidth, bl + 2*biw + extra/2); j++; - XtSetValues(hist->mvb, args, j); -} -#endif void HistorySet(char movelist[][2*MOVE_LEN],int first,int last,int current){ int i,b,m; @@ -321,6 +275,7 @@ void HistorySet(char movelist[][2*MOVE_LEN],int first,int last,int current){ else XawListUnhighlight(hist->mvb); } } + EvalGraphSet( first, last, current, pvInfoList ); // piggy-backed } Widget HistoryCreate() @@ -342,11 +297,11 @@ Widget HistoryCreate() XtSetArg(args[j], XtNresizable, True); j++; XtSetArg(args[j], XtNallowShellResize, True); j++; #if TOPLEVEL - hist->sh = + hist->sh = historyShell = XtCreatePopupShell(_("Move list"), topLevelShellWidgetClass, shellWidget, args, j); #else - hist->sh = + hist->sh = historyShell = XtCreatePopupShell(_("Move list"), transientShellWidgetClass, shellWidget, args, j); #endif @@ -363,10 +318,8 @@ Widget HistoryCreate() form = XtCreateManagedWidget("form", formWidgetClass, layout, args, j); - j=0; j = 0; - XtSetArg(args[j], XtNtop, XtChainTop); j++; XtSetArg(args[j], XtNbottom, XtChainBottom); j++; XtSetArg(args[j], XtNleft, XtChainLeft); j++; @@ -455,6 +408,24 @@ Widget HistoryCreate() strcpy(hist->black[i],""); } + if(wpMoveHistory.width > 0) { + gameHistoryW = wpMoveHistory.width; + gameHistoryH = wpMoveHistory.height; + gameHistoryX = wpMoveHistory.x; + gameHistoryY = wpMoveHistory.y; + } + + // [HGM] restore old position + if(gameHistoryW > 0) { + j = 0; + XtSetArg(args[j], XtNx, gameHistoryX); j++; + XtSetArg(args[j], XtNy, gameHistoryY); j++; + XtSetArg(args[j], XtNwidth, gameHistoryW); j++; + XtSetArg(args[j], XtNheight, gameHistoryH); j++; + XtSetValues(hist->sh, args, j); + } + XtRealizeWidget(hist->sh); + return hist->sh; } @@ -468,12 +439,6 @@ HistoryPopUp() XtPopup(hist->sh, XtGrabNone); - // [HGM] restore old position - j = 0; - XtSetArg(args[j], XtNx, gameHistoryX); j++; - XtSetArg(args[j], XtNy, gameHistoryY); j++; - XtSetValues(hist->sh, args, j); - j=0; XtSetArg(args[j], XtNleftBitmap, xMarkPixmap); j++; XtSetValues(XtNameToWidget(menuBarWidget, "menuMode.Show Move History"), @@ -500,3 +465,8 @@ HistoryShowProc(w, event, prms, nprms) ToNrEvent(currentMove); } +Boolean +MoveHistoryIsUp() +{ + return hist && hist->Up; +}