This patch adds stuff in the header files that allow the various front-end files
to share information on which windows exist, are up, and how they are positioned.
The EngineOutput, MoveHistory and GameList windows now all remember their
position and size, even when they are closed when XBoard exits.
commentShell, promotionShell, whitePieceMenu, blackPieceMenu, dropMenu,
menuBarWidget, buttonBarWidget, editShell, errorShell, analysisShell,
ICSInputShell, fileNameShell, askQuestionShell;
+Widget historyShell, evalGraphShell, gameListShell;
XSegment gridSegments[BOARD_RANKS + BOARD_FILES + 2];
XSegment jailGridSegments[BOARD_RANKS + BOARD_FILES + 6];
Font clockFontID, coordFontID, countFontID;
// these two must some day move to frontend.h, when they are implemented
Boolean EvalGraphIsUp();
Boolean MoveHistoryIsUp();
+Boolean GameListIsUp();
// The option definition and parsing code common to XBoard and WinBoard is collected in this file
#include "args.h"
{ // no such option in XBoard (yet)
}
+extern Widget engineOutputShell;
+extern Widget tagsShell, editTagsShell;
+void
+GetActualPlacement(Widget wg, WindowPlacement *wp)
+{
+ Arg args[16];
+ Dimension w, h;
+ Position x, y;
+ int i;
+
+ if(!wg) return;
+
+ i = 0;
+ XtSetArg(args[i], XtNx, &x); i++;
+ XtSetArg(args[i], XtNy, &y); i++;
+ XtSetArg(args[i], XtNwidth, &w); i++;
+ XtSetArg(args[i], XtNheight, &h); i++;
+ XtGetValues(wg, args, i);
+ wp->x = x - 4;
+ wp->y = y - 23;
+ wp->height = h;
+ wp->width = w;
+}
+
void
GetWindowCoords()
{ // wrapper to shield use of window handles from back-end (make addressible by number?)
-#if 0
// In XBoard this will have to wait until awareness of window parameters is implemented
- GetActualPlacement(hwndMain, &wpMain);
+ GetActualPlacement(shellWidget, &wpMain);
+ if(EngineOutputIsUp()) GetActualPlacement(engineOutputShell, &wpEngineOutput); else
+ if(MoveHistoryIsUp()) GetActualPlacement(historyShell, &wpMoveHistory);
+ if(GameListIsUp()) GetActualPlacement(gameListShell, &wpGameList);
+ if(commentShell) GetActualPlacement(commentShell, &wpComment);
+ else GetActualPlacement(editShell, &wpComment);
+ if(tagsShell) GetActualPlacement(tagsShell, &wpTags);
+ else GetActualPlacement(editTagsShell, &wpTags);
+#if 0
GetActualPlacement(hwndConsole, &wpConsole);
- GetActualPlacement(commentDialog, &wpComment);
- GetActualPlacement(editTagsDialog, &wpTags);
- GetActualPlacement(gameListDialog, &wpGameList);
- GetActualPlacement(moveHistoryDialog, &wpMoveHistory);
GetActualPlacement(evalGraphDialog, &wpEvalGraph);
- GetActualPlacement(engineOutputDialog, &wpEngineOutput);
#endif
}
}
Boolean
-MoveHistoryIsUp()
-{
- return True; // still have to fix this *****************************************************************************
-}
-
-Boolean
EvalGraphIsUp()
{
return False;
XtRealizeWidget(shellWidget);
+ if(wpMain.x > 0) {
+ XtSetArg(args[0], XtNx, wpMain.x);
+ XtSetArg(args[1], XtNy, wpMain.y);
+ XtSetValues(shellWidget, args, 2);
+ }
+
/*
* Correct the width of the message and title widgets.
* It is not known why some systems need the extra fudge term.
#endif /*!NOTDEF*/
if (commentY < 0) commentY = 0; /*avoid positioning top offscreen*/
}
+
+ if(wpComment.width > 0) {
+ commentX = wpComment.x;
+ commentY = wpComment.y;
+ commentW = wpComment.width;
+ commentH = wpComment.height;
+ }
+
j = 0;
XtSetArg(args[j], XtNheight, commentH); j++;
XtSetArg(args[j], XtNwidth, commentW); j++;
void EditTagsProc P((Widget w, XEvent *event,
String *prms, Cardinal *nprms));
+extern Widget editTagsShell, tagsShell;
#endif
XtRealizeWidget(shell);
+ if(wpEngineOutput.width > 0) {
+ engineOutputW = wpEngineOutput.width;
+ engineOutputH = wpEngineOutput.height;
+ engineOutputX = wpEngineOutput.x;
+ engineOutputY = wpEngineOutput.y;
+ }
+
if (engineOutputX == -1) {
int xx, yy;
Window junk;
XtSetArg(args[j], XtNwidth, &engineOutputW); j++;
XtSetArg(args[j], XtNheight, &engineOutputH); j++;
XtGetValues(engineOutputShell, args, j);
+ wpEngineOutput.x = engineOutputX - 4;
+ wpEngineOutput.y = engineOutputY - 23;
+ wpEngineOutput.width = engineOutputW;
+ wpEngineOutput.height = engineOutputH;
XtPopdown(engineOutputShell);
XSync(xDisplay, False);
j=0;
#endif
-extern Widget formWidget, shellWidget, boardWidget, menuBarWidget;
+extern Widget formWidget, shellWidget, boardWidget, menuBarWidget, gameListShell;
extern Display *xDisplay;
extern int squareSize;
extern Pixmap xMarkPixmap;
XtSetArg(args[j], XtNresizable, True); j++;
XtSetArg(args[j], XtNallowShellResize, True); j++;
#if TOPLEVEL
- shell =
+ shell = gameListShell =
XtCreatePopupShell(name, topLevelShellWidgetClass,
shellWidget, args, j);
#else
- shell =
+ shell = gameListShell =
XtCreatePopupShell(name, transientShellWidgetClass,
shellWidget, args, j);
#endif
XtCreateManagedWidget(_("close"), commandWidgetClass, form, args, j);
XtAddCallback(b_close, XtNcallback, callback, client_data);
+ if(wpGameList.width > 0) {
+ glc->x = wpGameList.x;
+ glc->y = wpGameList.y;
+ glc->w = wpGameList.width;
+ glc->h = wpGameList.height;
+ }
+
if (glc->x == -1) {
Position y1;
Dimension h1;
XtSetArg(args[j], XtNheight, &glc->h); j++;
XtSetArg(args[j], XtNwidth, &glc->w); j++;
XtGetValues(glc->shell, args, j);
+ wpGameList.x = glc->x - 4;
+ wpGameList.y = glc->y - 23;
+ wpGameList.width = glc->w;
+ wpGameList.height = glc->h;
XtPopdown(glc->shell);
XtSetKeyboardFocus(shellWidget, formWidget);
glc->up = False;
listwidg = XtNameToWidget(glc->shell, "*form.viewport.list");
XawListHighlight(listwidg, index - 1);
}
+
+Boolean
+GameListIsUp()
+{
+ return glc && glc->up;
+}
void LoadSelectedProc P((Widget w, XEvent *event,
String *prms, Cardinal *nprms));
+extern Widget gameListShell;
#endif /* _XGAMEL_H */
#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;
struct History *hist=0;
String dots=" ... ";
Position gameHistoryX, gameHistoryY;
-Dimension gameHistoryW;
+Dimension gameHistoryW, gameHistoryH;
void
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;
}
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
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++;
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++;
- XtGetValues(shellWidget, args, j);
- j = 0;
- XtSetArg(args[j], XtNx, gameHistoryX + gameHistoryW); j++;
+ 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;
ToNrEvent(currentMove);
}
+Boolean
+MoveHistoryIsUp()
+{
+ return hist && hist->Up;
+}
String *prms, Cardinal *nprms));
void HistoryPopDown P((Widget w, XtPointer client_data,
XtPointer call_data));
+Boolean MoveHistoryIsUp P((void));
+extern Widget historyShell;
#endif /* _XHISTL_H */