void LoadOptionsProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
void SaveOptionsProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
void EditBookProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));
+void SelectMove P((Widget w, XEvent * event, String * params, Cardinal * nParams));
void GameListOptionsPopDown P(());
-void ShufflePopDown P(());
-void TimeControlPopDown P(());
void GenericPopDown P(());
void update_ics_width P(());
int get_term_width P(());
{N_("Machine Black Ctrl+B"), "Machine Black", MachineBlackProc},
{N_("Two Machines Ctrl+T"), "Two Machines", TwoMachinesProc},
{N_("Analysis Mode Ctrl+A"), "Analysis Mode", AnalyzeModeProc},
- {N_("Analyze File Ctrl+F"), "Analyze File", AnalyzeFileProc },
+ {N_("Analyze Game Ctrl+G"), "Analyze File", AnalyzeFileProc },
{N_("Edit Game Ctrl+E"), "Edit Game", EditGameProc},
{N_("Edit Position Ctrl+Shift+E"), "Edit Position", EditPositionProc},
{N_("Training"), "Training", TrainingProc},
{ "GameListPopDown", (XtActionProc) GameListPopDown },
{ "GameListOptionsPopDown", (XtActionProc) GameListOptionsPopDown },
{ "PromotionPopDown", (XtActionProc) PromotionPopDown },
- { "HistoryPopDown", (XtActionProc) HistoryPopDown },
{ "EngineOutputPopDown", (XtActionProc) EngineOutputPopDown },
{ "EvalGraphPopDown", (XtActionProc) EvalGraphPopDown },
- { "ShufflePopDown", (XtActionProc) ShufflePopDown },
- { "TimeControlPopDown", (XtActionProc) TimeControlPopDown },
{ "GenericPopDown", (XtActionProc) GenericPopDown },
{ "CopyMemoProc", (XtActionProc) CopyMemoProc },
+ { "SelectMove", (XtActionProc) SelectMove },
};
char globalTranslations[] =
:Ctrl<Key>o: LoadGameProc() \n \
:Meta<Key>Next: LoadNextGameProc() \n \
:Meta<Key>Prior: LoadPrevGameProc() \n \
+ :Ctrl<Key>Down: LoadSelectedProc(3) \n \
+ :Ctrl<Key>Up: LoadSelectedProc(-3) \n \
:Ctrl<Key>s: SaveGameProc() \n \
:Ctrl<Key>c: CopyGameProc() \n \
:Ctrl<Key>v: PasteGameProc() \n \
:Ctrl<Key>b: MachineBlackProc() \n \
:Ctrl<Key>t: TwoMachinesProc() \n \
:Ctrl<Key>a: AnalysisModeProc() \n \
- :Ctrl<Key>f: AnalyzeFileProc() \n \
+ :Ctrl<Key>g: AnalyzeFileProc() \n \
:Ctrl<Key>e: EditGameProc() \n \
:Ctrl<Key>E: EditPositionProc() \n \
:Meta<Key>O: EngineOutputProc() \n \
:Meta<Key>Right: ForwardProc() \n \
:Meta<Key>Home: ToStartProc() \n \
:Meta<Key>Left: BackwardProc() \n \
+ :<Key>Left: BackwardProc() \n \
+ :<Key>Right: ForwardProc() \n \
:<Key>Home: RevertProc() \n \
:<Key>End: TruncateGameProc() \n \
:Ctrl<Key>m: MoveNowProc() \n \
Any<Btn3Down>: XawPositionSimpleMenu(menuB) XawPositionSimpleMenu(menuD) \
PieceMenuPopup(menuB) \n";
-char whiteTranslations[] = "<BtnDown>: WhiteClock()\n";
-char blackTranslations[] = "<BtnDown>: BlackClock()\n";
+char whiteTranslations[] =
+ "Shift<BtnDown>: WhiteClock(1)\n \
+ <BtnDown>: WhiteClock(0)\n";
+char blackTranslations[] =
+ "Shift<BtnDown>: BlackClock(1)\n \
+ <BtnDown>: BlackClock(0)\n";
char ICSInputTranslations[] =
"<Key>Up: UpKeyProc() \n "
{ // wrapper to shield use of window handles from back-end (make addressible by number?)
// In XBoard this will have to wait until awareness of window parameters is implemented
GetActualPlacement(shellWidget, &wpMain);
- if(EngineOutputIsUp()) GetActualPlacement(engineOutputShell, &wpEngineOutput); else
- if(MoveHistoryIsUp()) GetActualPlacement(historyShell, &wpMoveHistory);
+ if(EngineOutputIsUp()) GetActualPlacement(engineOutputShell, &wpEngineOutput);
+ if(MoveHistoryIsUp()) GetActualPlacement(shells[7], &wpMoveHistory);
if(EvalGraphIsUp()) GetActualPlacement(evalGraphShell, &wpEvalGraph);
if(GameListIsUp()) GetActualPlacement(gameListShell, &wpGameList);
if(shellUp[1]) GetActualPlacement(shells[1], &wpComment);
line[0] = NULLCHAR;
for(i=1; i<argc; i++)
{
- if( (strchr(argv[i], ' ') || strchr(argv[i], '\n') ||strchr(argv[i], '\t') )
+ if( (strchr(argv[i], ' ') || strchr(argv[i], '\n') ||strchr(argv[i], '\t') || argv[i][0] == NULLCHAR)
&& argv[i][0] != '{' )
snprintf(buf, sizeof(buf)/sizeof(buf[0]), "{%s} ", argv[i]);
else
return 0;
}
+static Boolean noEcho;
+
void
ShutDownFrontEnd()
{
if (saveSettingsOnExit) SaveSettings(settingsFileName);
unlink(gameCopyFilename);
unlink(gamePasteFilename);
+ if(noEcho) EchoOn();
}
RETSIGTYPE TermSizeSigHandler(int sig)
{
XpmAttributes attr;
attr.valuemask = 0;
- if(s == NULL || *s == 0 || *s == '*') { useTexture &= ~(kind+1); return; }
+ if(!appData.useBitmaps || s == NULL || *s == 0 || *s == '*') { useTexture &= ~(kind+1); return; }
if (XpmReadFileToPixmap(xDisplay, xBoardWindow, s, &(xpmBoardBitmap[kind]), NULL, &attr) == 0) {
useTexture |= kind + 1; textureW[kind] = attr.width; textureH[kind] = attr.height;
}
String *prms;
Cardinal *nprms;
{
+ shiftKey = prms[0][0] & 1;
ClockClick(0);
}
String *prms;
Cardinal *nprms;
{
+ shiftKey = prms[0][0] & 1;
ClockClick(1);
}
PopDown(1);
}
+static char *openName;
+FILE *openFP;
+
+void DelayedLoad()
+{
+ (void) (*fileProc)(openFP, 0, openName);
+}
+
void FileNamePopUp(label, def, filter, proc, openMode)
char *label;
char *def;
fileProc = proc; /* I can't see a way not */
fileOpenMode = openMode; /* to use globals here */
{ // [HGM] use file-selector dialog stolen from Ghostview
- char *name;
int index; // this is not supported yet
- FILE *f;
- if(f = XsraSelFile(shellWidget, label, NULL, NULL, "could not open: ",
- (def[0] ? def : NULL), filter, openMode, NULL, &name))
- (void) (*fileProc)(f, index=0, name);
+ if(openFP = XsraSelFile(shellWidget, label, NULL, NULL, "could not open: ",
+ (def[0] ? def : NULL), filter, openMode, NULL, &openName))
+ // [HGM] delay to give expose event opportunity to redraw board after browser-dialog popdown before lengthy load starts
+ ScheduleDelayedEvent(&DelayedLoad, 50);
}
}
(XtPointer) dialog);
XawDialogAddButton(dialog, _("Captain"), PromotionCallback,
(XtPointer) dialog);
- } else {\r
+ } else {
XawDialogAddButton(dialog, _("Queen"), PromotionCallback,
(XtPointer) dialog);
XawDialogAddButton(dialog, _("Rook"), PromotionCallback,
(XtPointer) dialog);
}
if (!appData.testLegality || gameInfo.variant == VariantSuicide ||
- gameInfo.variant == VariantSpartan && !WhiteOnMove(currentMove) ||\r
+ gameInfo.variant == VariantSpartan && !WhiteOnMove(currentMove) ||
gameInfo.variant == VariantGiveaway) {
XawDialogAddButton(dialog, _("King"), PromotionCallback,
(XtPointer) dialog);
void CopySomething()
{
- int ret;
-
/*
* Set both PRIMARY (the selection) and CLIPBOARD, since we don't
* have a notion of a game that is selected but not copied.
DisplayError(buf, 0);
return;
}
- Reset(FALSE, TRUE);
+// Reset(FALSE, TRUE);
#ifndef OPTIONSDIALOG
if (!appData.showThinking)
ShowThinkingProc(w,event,prms,nprms);
#endif
AnalyzeFileEvent();
- FileNamePopUp(_("File to analyze"), "", ".pgn .game", LoadGamePopUp, "rb");
+// FileNamePopUp(_("File to analyze"), "", ".pgn .game", LoadGamePopUp, "rb");
AnalysisPeriodicEvent(1);
}
String *prms;
Cardinal *nprms;
{
- MatchEvent(2);\r
+ MatchEvent(2);
}
void IcsClientProc(w, event, prms, nprms)
XtSetArg(args[i], XtNiconName, (XtArgVal) icon); i++;
XtSetArg(args[i], XtNtitle, (XtArgVal) title); i++;
XtSetValues(shellWidget, args, i);
+ XSync(xDisplay, False);
}
} else {
char buf[2048];
char *prefix = "", *sep = "";
+ if(appData.soundProgram[0] == NULLCHAR) return;
if(!strchr(name, '/')) { prefix = appData.soundDirectory; sep = "/"; }
snprintf(buf, sizeof(buf), "%s '%s%s%s' &", appData.soundProgram, prefix, sep, name);
system(buf);
}
void
+PlayTellSound()
+{
+ PlaySound(appData.soundTell);
+}
+
+void
EchoOn()
{
system("stty echo");
+ noEcho = False;
}
void
EchoOff()
{
system("stty -echo");
+ noEcho = True;
+}
+
+void
+RunCommand(char *buf)
+{
+ system(buf);
}
void
struct addrinfo hints;
struct addrinfo *ais, *ai;
int error;
- int s;
+ int s=0;
ChildProc *cp;
memset(&hints, 0, sizeof(hints));
#endif
+void
+DoSleep(int n)
+{
+ FrameDelay(n);
+}
+
/* Convert board position to corner of screen rect and color */
static void
}
void
-DragPieceBegin(x, y)
- int x; int y;
+DragPieceBegin(x, y, instantly)
+ int x; int y; Boolean instantly;
{
int boardX, boardY, color;
XPoint corner;
if( IsDrawArrowEnabled() && fromX >= 0 && fromY >= 0 && toX >= 0 && toY >= 0)
DrawArrowBetweenSquares(fromX, fromY, toX, toY);
}
+
+void UpdateLogos(int displ)
+{
+ return; // no logos in XBoard yet
+}
+