projects
/
xboard.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
removed test for premove
[xboard.git]
/
xhistory.c
diff --git
a/xhistory.c
b/xhistory.c
index
bbdc0bf
..
02c9ec3
100644
(file)
--- a/
xhistory.c
+++ b/
xhistory.c
@@
-1,29
+1,24
@@
/*
* xhistory.c -- Move list window, part of X front end for XBoard
/*
* xhistory.c -- Move list window, part of X front end for XBoard
- * $Id$
*
*
- * Copyright 2000 Free Software Foundation, Inc.
- *
- * The following terms apply to the enhanced version of XBoard distributed
- * by the Free Software Foundation:
+ * Copyright 2000,2009 Free Software Foundation, Inc.
* ------------------------------------------------------------------------
* ------------------------------------------------------------------------
- * This program is free software; you can redistribute it and/or modify
+ *
+ * GNU XBoard is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation
; either version 2 of the License, or
- *
(at
your option) any later version.
+ * the Free Software Foundation
, either version 3 of the License, or (at
+ * your option) any later version.
*
*
- *
This program is distributed in the hope that it will be useful,
- *
but
WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the
- * G
NU G
eneral Public License for more details.
+ *
GNU XBoard is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU
+ * General Public License for more details.
*
* You should have received a copy of the GNU General Public License
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- * ------------------------------------------------------------------------
+ * along with this program. If not, see http://www.gnu.org/licenses/. *
*
*
- *
See the file ChangeLog for a revision history.
- */
+ *
------------------------------------------------------------------------
+ *
* See the file ChangeLog for a revision history. *
/
#include "config.h"
#include "config.h"
@@
-91,13
+86,14
@@
extern char *layoutName;
struct History{
String *Nr,*white,*black;
struct History{
String *Nr,*white,*black;
- int aNr; /* space actually alocated */
+ int aNr; /* space actually alocated */
Widget mvn,mvw,mvb,vbox,viewport,sh;
char Up;
};
struct History *hist=0;
String dots=" ... ";
Widget mvn,mvw,mvb,vbox,viewport,sh;
char Up;
};
struct History *hist=0;
String dots=" ... ";
+Position gameHistoryX, gameHistoryY;
void
HistoryPopDown(w, client_data, call_data)
void
HistoryPopDown(w, client_data, call_data)
@@
-106,14
+102,19
@@
HistoryPopDown(w, client_data, call_data)
{
Arg args[16];
int j;
{
Arg args[16];
int j;
- if(hist)
-
- XtPopdown(hist->sh);
- hist->Up=False;
+ if(hist) {
+ // [HGM] remember old position
+ j = 0;
+ XtSetArg(args[j], XtNx, &gameHistoryX); j++;
+ XtSetArg(args[j], XtNy, &gameHistoryY); j++;
+ XtGetValues(hist->sh, args, j);
+ XtPopdown(hist->sh);
+ hist->Up=False;
+ }
j=0;
XtSetArg(args[j], XtNleftBitmap, None); j++;
j=0;
XtSetArg(args[j], XtNleftBitmap, None); j++;
- XtSetValues(XtNameToWidget(menuBarWidget, "menuMode.Show Move
List
"),
+ XtSetValues(XtNameToWidget(menuBarWidget, "menuMode.Show Move
History
"),
args, j);
}
args, j);
}
@@
-138,13
+139,13
@@
void HistoryAlloc(int len){
free(hist->Nr);free(hist->white);free(hist->black);
}
else{
free(hist->Nr);free(hist->white);free(hist->black);
}
else{
- hist=(struct History*)malloc(sizeof(struct History));
+ hist=(struct History*)malloc(sizeof(struct History));
}
hist->aNr=len;
hist->Nr=(String*)malloc(hist->aNr*sizeof(String*));
hist->white=(String*)malloc(hist->aNr*sizeof(String*));
hist->black=(String*)malloc(hist->aNr*sizeof(String*));
}
hist->aNr=len;
hist->Nr=(String*)malloc(hist->aNr*sizeof(String*));
hist->white=(String*)malloc(hist->aNr*sizeof(String*));
hist->black=(String*)malloc(hist->aNr*sizeof(String*));
-
+
hist->Nr[0]=(String)malloc(hist->aNr*6);
hist->white[0]=(String)malloc(hist->aNr*MOVE_LEN);
hist->black[0]=(String)malloc(hist->aNr*MOVE_LEN);
hist->Nr[0]=(String)malloc(hist->aNr*6);
hist->white[0]=(String)malloc(hist->aNr*MOVE_LEN);
hist->black[0]=(String)malloc(hist->aNr*MOVE_LEN);
@@
-195,7
+196,7
@@
HistoryFill()
} else {
extra = extra/2;
}
} else {
extra = extra/2;
}
-
+
j = 0;
XtSetArg(args[j], XtNwidth, &w); j++;
XtGetValues(hist->mvw, args, j);
j = 0;
XtSetArg(args[j], XtNwidth, &w); j++;
XtGetValues(hist->mvw, args, j);
@@
-270,7
+271,7
@@
void HistorySet(char movelist[][2*MOVE_LEN],int first,int last,int current){
if(hist){
if(last >= hist->aNr) HistoryAlloc(last+_LL_);
for(i=0;i<last;i++) {
if(hist){
if(last >= hist->aNr) HistoryAlloc(last+_LL_);
for(i=0;i<last;i++) {
- if((i%2)==0) {
+ if((i%2)==0) {
if(movelist[i][0]) {
char* p = strchr(movelist[i], ' ');
if (p) {
if(movelist[i][0]) {
char* p = strchr(movelist[i], ' ');
if (p) {
@@
-278,7
+279,7
@@
void HistorySet(char movelist[][2*MOVE_LEN],int first,int last,int current){
hist->white[i/2+1][p-movelist[i]] = NULLCHAR;
} else {
strcpy(hist->white[i/2+1],movelist[i]);
hist->white[i/2+1][p-movelist[i]] = NULLCHAR;
} else {
strcpy(hist->white[i/2+1],movelist[i]);
- }
+ }
} else {
strcpy(hist->white[i/2+1],dots);
}
} else {
strcpy(hist->white[i/2+1],dots);
}
@@
-290,7
+291,7
@@
void HistorySet(char movelist[][2*MOVE_LEN],int first,int last,int current){
hist->black[i/2+1][p-movelist[i]] = NULLCHAR;
} else {
strcpy(hist->black[i/2+1],movelist[i]);
hist->black[i/2+1][p-movelist[i]] = NULLCHAR;
} else {
strcpy(hist->black[i/2+1],movelist[i]);
- }
+ }
} else {
strcpy(hist->black[i/2+1],"");
}
} else {
strcpy(hist->black[i/2+1],"");
}
@@
-334,11
+335,11
@@
Widget HistoryCreate()
<Key>Right: ForwardProc() \n";
/*--- allocate memory for move-strings ---*/
HistoryAlloc(_LL_);
<Key>Right: ForwardProc() \n";
/*--- allocate memory for move-strings ---*/
HistoryAlloc(_LL_);
-
+
/*-------- create the widgets ---------------*/
j = 0;
XtSetArg(args[j], XtNresizable, True); j++;
/*-------- create the widgets ---------------*/
j = 0;
XtSetArg(args[j], XtNresizable, True); j++;
- XtSetArg(args[j], XtNallowShellResize, True); j++;
+ XtSetArg(args[j], XtNallowShellResize, True); j++;
#if TOPLEVEL
hist->sh =
XtCreatePopupShell(_("Move list"), topLevelShellWidgetClass,
#if TOPLEVEL
hist->sh =
XtCreatePopupShell(_("Move list"), topLevelShellWidgetClass,
@@
-347,18
+348,18
@@
Widget HistoryCreate()
hist->sh =
XtCreatePopupShell(_("Move list"), transientShellWidgetClass,
shellWidget, args, j);
hist->sh =
XtCreatePopupShell(_("Move list"), transientShellWidgetClass,
shellWidget, args, j);
-#endif
+#endif
j = 0;
XtSetArg(args[j], XtNborderWidth, 0); j++;
XtSetArg(args[j], XtNdefaultDistance, 0); j++;
layout =
XtCreateManagedWidget(layoutName, formWidgetClass, hist->sh,
args, j);
j = 0;
XtSetArg(args[j], XtNborderWidth, 0); j++;
XtSetArg(args[j], XtNdefaultDistance, 0); j++;
layout =
XtCreateManagedWidget(layoutName, formWidgetClass, hist->sh,
args, j);
-
+
j = 0;
XtSetArg(args[j], XtNborderWidth, 0); j++;
XtSetArg(args[j], XtNresizable, True); j++;
j = 0;
XtSetArg(args[j], XtNborderWidth, 0); j++;
XtSetArg(args[j], XtNresizable, True); j++;
-
+
form =
XtCreateManagedWidget("form", formWidgetClass, layout, args, j);
j=0;
form =
XtCreateManagedWidget("form", formWidgetClass, layout, args, j);
j=0;
@@
-384,13
+385,13
@@
Widget HistoryCreate()
XtSetArg(args[j], XtNorientation,XtorientHorizontal);j++;
hist->vbox =
XtCreateManagedWidget("vbox", formWidgetClass, hist->viewport, args, j);
XtSetArg(args[j], XtNorientation,XtorientHorizontal);j++;
hist->vbox =
XtCreateManagedWidget("vbox", formWidgetClass, hist->viewport, args, j);
-
+
j=0;
XtSetArg(args[j], XtNtop, XtChainTop); j++;
XtSetArg(args[j], XtNbottom, XtChainTop); j++;
XtSetArg(args[j], XtNleft, XtChainLeft); j++;
j=0;
XtSetArg(args[j], XtNtop, XtChainTop); j++;
XtSetArg(args[j], XtNbottom, XtChainTop); j++;
XtSetArg(args[j], XtNleft, XtChainLeft); j++;
- XtSetArg(args[j], XtNright, XtChainLeft); j++;
-
+ XtSetArg(args[j], XtNright, XtChainLeft); j++;
+
XtSetArg(args[j], XtNdefaultColumns, 1); j++;
XtSetArg(args[j], XtNforceColumns, True); j++;
XtSetArg(args[j], XtNverticalList, True); j++;
XtSetArg(args[j], XtNdefaultColumns, 1); j++;
XtSetArg(args[j], XtNforceColumns, True); j++;
XtSetArg(args[j], XtNverticalList, True); j++;
@@
-405,8
+406,8
@@
Widget HistoryCreate()
XtSetArg(args[j], XtNtop, XtChainTop); j++;
XtSetArg(args[j], XtNbottom, XtChainTop); j++;
XtSetArg(args[j], XtNleft, XtChainLeft); j++;
XtSetArg(args[j], XtNtop, XtChainTop); j++;
XtSetArg(args[j], XtNbottom, XtChainTop); j++;
XtSetArg(args[j], XtNleft, XtChainLeft); j++;
- XtSetArg(args[j], XtNright, XtRubber); j++;
-
+ XtSetArg(args[j], XtNright, XtRubber); j++;
+
XtSetArg(args[j], XtNdefaultColumns, 1); j++;
XtSetArg(args[j], XtNforceColumns, True); j++;
XtSetArg(args[j], XtNverticalList, True); j++;
XtSetArg(args[j], XtNdefaultColumns, 1); j++;
XtSetArg(args[j], XtNforceColumns, True); j++;
XtSetArg(args[j], XtNverticalList, True); j++;
@@
-422,7
+423,7
@@
Widget HistoryCreate()
XtSetArg(args[j], XtNbottom, XtChainTop); j++;
XtSetArg(args[j], XtNleft, XtRubber); j++;
XtSetArg(args[j], XtNright, XtRubber); j++;
XtSetArg(args[j], XtNbottom, XtChainTop); j++;
XtSetArg(args[j], XtNleft, XtRubber); j++;
XtSetArg(args[j], XtNright, XtRubber); j++;
-
+
XtSetArg(args[j], XtNdefaultColumns, 1); j++;
XtSetArg(args[j], XtNforceColumns, True); j++;
XtSetArg(args[j], XtNverticalList, True); j++;
XtSetArg(args[j], XtNdefaultColumns, 1); j++;
XtSetArg(args[j], XtNforceColumns, True); j++;
XtSetArg(args[j], XtNverticalList, True); j++;
@@
-440,10
+441,10
@@
Widget HistoryCreate()
XtSetArg(args[j], XtNright, XtChainLeft); j++;
XtSetArg(args[j], XtNfromVert, hist->viewport); j++;
b_close= XtCreateManagedWidget(_("Close"), commandWidgetClass,
XtSetArg(args[j], XtNright, XtChainLeft); j++;
XtSetArg(args[j], XtNfromVert, hist->viewport); j++;
b_close= XtCreateManagedWidget(_("Close"), commandWidgetClass,
- form, args, j);
+ form, args, j);
XtAddCallback(b_close, XtNcallback, HistoryPopDown, (XtPointer) 0);
XtAddCallback(b_close, XtNcallback, HistoryPopDown, (XtPointer) 0);
- XtAugmentTranslations(hist->sh,XtParseTranslationTable (trstr));
+ XtAugmentTranslations(hist->sh,XtParseTranslationTable (trstr));
XtRealizeWidget(hist->sh);
CatchDeleteWindow(hist->sh, "HistoryPopDown");
XtRealizeWidget(hist->sh);
CatchDeleteWindow(hist->sh, "HistoryPopDown");
@@
-452,7
+453,7
@@
Widget HistoryCreate()
strcpy(hist->white[i],dots);
strcpy(hist->black[i],"");
}
strcpy(hist->white[i],dots);
strcpy(hist->black[i],"");
}
-
+
return hist->sh;
}
return hist->sh;
}
@@
-463,15
+464,23
@@
HistoryPopUp()
int j;
if(!hist) HistoryCreate();
int j;
if(!hist) HistoryCreate();
+
XtPopup(hist->sh, XtGrabNone);
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++;
j=0;
XtSetArg(args[j], XtNleftBitmap, xMarkPixmap); j++;
- XtSetValues(XtNameToWidget(menuBarWidget, "menuMode.Show Move
List
"),
+ XtSetValues(XtNameToWidget(menuBarWidget, "menuMode.Show Move
History
"),
args, j);
hist->Up=True;
}
args, j);
hist->Up=True;
}
-
+
void
HistoryShowProc(w, event, prms, nprms)
Widget w;
void
HistoryShowProc(w, event, prms, nprms)
Widget w;
@@
-489,4
+498,4
@@
HistoryShowProc(w, event, prms, nprms)
}
ToNrEvent(currentMove);
}
}
ToNrEvent(currentMove);
}
-
+