X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=dialogs.c;h=8de450d1e2d72b2f1658c01836c62dc0fec364ec;hb=73419c47f539f4f6d0700fe8ec89bb0f6259c94e;hp=922fb493d8ba80e1a8f580c25788b2165a75ac07;hpb=02de46755f727ffb565f7c855f37c344eee925ff;p=xboard.git diff --git a/dialogs.c b/dialogs.c index 922fb49..8de450d 100644 --- a/dialogs.c +++ b/dialogs.c @@ -611,10 +611,16 @@ static Option loadOptions[] = { }; void -LoadOptionsProc () +LoadOptionsPopUp (DialogClass parent) { ASSIGN(searchMode, modeValues[appData.searchMode-1]); - GenericPopUp(loadOptions, _("Load Game Options"), TransientDlg, BoardWindow, MODAL, 0); + GenericPopUp(loadOptions, _("Load Game Options"), TransientDlg, parent, MODAL, 0); +} + +void +LoadOptionsProc () +{ // called from menu + LoadOptionsPopUp(BoardWindow); } //------------------------------------------- Save Game Options -------------------------------------------- @@ -1472,6 +1478,100 @@ OutputChatMessage (int partner, char *mess) return; // dummy } +//--------------------------------- Game-List options dialog ------------------------------------------ + +char *strings[LPUSERGLT_SIZE]; +int stringPtr; + +void +GLT_ClearList () +{ + strings[0] = NULL; + stringPtr = 0; +} + +void +GLT_AddToList (char *name) +{ + strings[stringPtr++] = name; + strings[stringPtr] = NULL; +} + +Boolean +GLT_GetFromList (int index, char *name) +{ + safeStrCpy(name, strings[index], MSG_SIZ); + return TRUE; +} + +void +GLT_DeSelectList () +{ +} + +static void GLT_Button P((int n)); +static int GLT_OK P((int n)); + +static Option listOptions[] = { +{ 0, LR|TB, 200, NULL, (void*) strings, "", NULL, ListBox, "" }, +{ 0, 0, 0, NULL, (void*) &GLT_Button, NULL, NULL, Button, N_("factory") }, +{ 0, SAME_ROW, 0, NULL, (void*) &GLT_Button, NULL, NULL, Button, N_("up") }, +{ 0, SAME_ROW, 0, NULL, (void*) &GLT_Button, NULL, NULL, Button, N_("down") }, +{ 0, SAME_ROW, 0, NULL, (void*) &GLT_OK, "", NULL, EndMark , "" } +}; + +static int +GLT_OK (int n) +{ + GLT_ParseList(); + appData.gameListTags = strdup(lpUserGLT); + return 1; +} + +static void +GLT_Button (int n) +{ + int index = SelectedListBoxItem (&listOptions[0]); + char *p; + if (index < 0) { + DisplayError(_("No tag selected"), 0); + return; + } + p = strings[index]; + if (n == 3) { + if(index >= strlen(GLT_ALL_TAGS)) return; + strings[index] = strings[index+1]; + strings[++index] = p; + } else + if (n == 2) { + if(index == 0) return; + strings[index] = strings[index-1]; + strings[--index] = p; + } else + if (n == 1) { + safeStrCpy(lpUserGLT, GLT_DEFAULT_TAGS, LPUSERGLT_SIZE); + GLT_TagsToList(lpUserGLT); + index = 0; + LoadListBox(&listOptions[0], "?"); // Note: the others don't need this, as the highlight switching redraws the change items + } + HighlightListBoxItem(&listOptions[0], index); +} + +void +GameListOptionsPopUp (DialogClass parent) +{ + safeStrCpy(lpUserGLT, appData.gameListTags, LPUSERGLT_SIZE); + GLT_TagsToList(lpUserGLT); + + GenericPopUp(listOptions, _("Game-list options"), TransientDlg, parent, MODAL, 0); +} + +void +GameListOptionsProc () +{ + GameListOptionsPopUp(BoardWindow); +} + //----------------------------- Error popup in various uses ----------------------------- /*