Refactor menu code, and move it to menu.c
[xboard.git] / xoptions.c
index e2646c1..922db90 100644 (file)
@@ -250,7 +250,7 @@ CreateComboPopup (Widget parent, Option *option, int n)
 
 extern WindowPlacement wpComment, wpTags, wpMoveHistory;
 char *trialSound;
-static int oldCores, oldPonder;
+static int oldCores, oldPonder, oldShow, oldBlind;
 int MakeColors P((void));
 void CreateGCs P((int redo));
 void CreateAnyPieces P((void));
@@ -410,6 +410,8 @@ GeneralOptionsOK (int n)
        int newPonder = appData.ponderNextMove;
        appData.ponderNextMove = oldPonder;
        PonderNextMoveEvent(newPonder);
+       if(!appData.highlightLastMove) ClearHighlights(), ClearPremoveHighlights();
+       if(oldShow != appData.showCoords || oldBlind != appData.blindfold) DrawPosition(TRUE, NULL);
        return 1;
 }
 
@@ -434,6 +436,7 @@ Option generalOptions[] = {
 { 0,  0, 0, NULL, (void*) &appData.showEvalInMoveHistory, "", NULL, CheckBox, N_("Scores in Move List") },
 { 0,  0, 0, NULL, (void*) &appData.showCoords, "", NULL, CheckBox, N_("Show Coordinates") },
 { 0,  0, 0, NULL, (void*) &appData.markers, "", NULL, CheckBox, N_("Show Target Squares") },
+{ 0,  0, 0, NULL, (void*) &appData.useStickyWindows, "", NULL, CheckBox, N_("Sticky Windows") },
 { 0,  0, 0, NULL, (void*) &appData.testLegality, "", NULL, CheckBox, N_("Test Legality") },
 { 0, 0, 10, NULL, (void*) &appData.flashCount, "", NULL, Spin, N_("Flash Moves (0 = no flashing):") },
 { 0, 1, 10, NULL, (void*) &appData.flashRate, "", NULL, Spin, N_("Flash Rate (high = fast):") },
@@ -630,7 +633,7 @@ Option loadOptions[] = {
 { 0, 0, 5000, NULL, (void*) &appData.eloThreshold2, "", NULL, Spin, N_("Elo of weakest player at least:") },
 { 0, 0, 5000, NULL, (void*) &appData.dateThreshold, "", NULL, Spin, N_("No games before year:") },
 { 0, 1, 50, NULL, (void*) &appData.stretch, "", NULL, Spin, N_("Minimum nr consecutive positions:") },
-{ 1, 0, 180, NULL, (void*) &searchMode, (char*) modeNames, modeValues, ComboBox, N_("Seach mode:") },
+{ 1, 0, 180, NULL, (void*) &searchMode, (char*) modeNames, modeValues, ComboBox, N_("Search mode:") },
 { 0, 0, 0, NULL, (void*) &appData.ignoreColors, "", NULL, CheckBox, N_("Also match reversed colors") },
 { 0, 0, 0, NULL, (void*) &appData.findMirror, "", NULL, CheckBox, N_("Also match left-right flipped position") },
 { 0,  0, 0, NULL, (void*) &LoadOptionsOK, "", NULL, EndMark , "" }
@@ -1370,26 +1373,26 @@ GenericPopUp (Option *option, char *title, int dlgNr)
 
 
 void
-IcsOptionsProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
+IcsOptionsProc ()
 {
    GenericPopUp(icsOptions, _("ICS Options"), 0);
 }
 
 void
-LoadOptionsProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
+LoadOptionsProc ()
 {
    ASSIGN(searchMode, modeValues[appData.searchMode-1]);
    GenericPopUp(loadOptions, _("Load Game Options"), 0);
 }
 
 void
-SaveOptionsProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
+SaveOptionsProc ()
 {
    GenericPopUp(saveOptions, _("Save Game Options"), 0);
 }
 
 void
-SoundOptionsProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
+SoundOptionsProc ()
 {
    free(soundFiles[2]);
    soundFiles[2] = strdup("*");
@@ -1397,19 +1400,19 @@ SoundOptionsProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
 }
 
 void
-BoardOptionsProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
+BoardOptionsProc ()
 {
    GenericPopUp(boardOptions, _("Board Options"), 0);
 }
 
 void
-EngineMenuProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
+EngineMenuProc ()
 {
    GenericPopUp(adjudicationOptions, _("Adjudicate non-ICS Games"), 0);
 }
 
 void
-UciMenuProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
+UciMenuProc ()
 {
    oldCores = appData.smpCores;
    oldPonder = appData.ponderNextMove;
@@ -1417,20 +1420,21 @@ UciMenuProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
 }
 
 void
-NewVariantProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
+NewVariantProc ()
 {
    GenericPopUp(variantDescriptors, _("New Variant"), 0);
 }
 
 void
-OptionsProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
+OptionsProc ()
 {
    oldPonder = appData.ponderNextMove;
+   oldShow = appData.showCoords; oldBlind = appData.blindfold;
    GenericPopUp(generalOptions, _("General Options"), 0);
 }
 
 void
-MatchOptionsProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
+MatchOptionsProc ()
 {
    NamesToList(firstChessProgramNames, engineList, engineMnemonic, "all");
    comboCallback = &AddToTourney;
@@ -1488,7 +1492,7 @@ SendText (int n)
 }
 
 void
-IcsTextProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
+IcsTextProc ()
 {
    int i=0, j;
    char *p, *q, *r;
@@ -1715,13 +1719,13 @@ SettingsPopUp (ChessProgramState *cps)
 }
 
 void
-FirstSettingsProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
+FirstSettingsProc ()
 {
     SettingsPopUp(&first);
 }
 
 void
-SecondSettingsProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
+SecondSettingsProc ()
 {
    if(WaitForEngine(&second, SettingsMenuIfReady)) return;
    SettingsPopUp(&second);
@@ -1753,7 +1757,7 @@ Option installOptions[] = {
 };
 
 void
-LoadEngineProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
+LoadEngineProc ()
 {
    isUCI = storeVariant = v1 = useNick = False; addToList = hasBook = True; // defaults
    if(engineChoice) free(engineChoice); engineChoice = strdup(engineNr[0]);
@@ -1766,7 +1770,7 @@ LoadEngineProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
 }
 
 void
-EditBookProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
+EditBookProc ()
 {
     EditBookEvent();
 }
@@ -1799,7 +1803,7 @@ SetRandom (int n)
 }
 
 void
-ShuffleMenuProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
+ShuffleMenuProc ()
 {
     GenericPopUp(shuffleOptions, _("New Shuffle Game"), 0);
 }
@@ -1885,7 +1889,7 @@ SetTcType (int n)
 }
 
 void
-TimeControlProc (Widget w, XEvent *event, String *prms, Cardinal *nprms)
+TimeControlProc ()
 {
    tmpMoves = appData.movesPerSession;
    tmpInc = appData.timeIncrement; if(tmpInc < 0) tmpInc = 0;