From: H.G. Muller Date: Mon, 26 Aug 2013 10:03:30 +0000 (+0200) Subject: Add Save button to Edit Tags dialog X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=42725c6bc7db8d2e3300d8b00cd71c0a579f8e2d;p=xboard.git Add Save button to Edit Tags dialog When editing an opening book it is very anoying if the Edit Book dialog closes every time you add a move or change a weight, and closing the dialog was (in WB) the only way to save the changes. A separate button now is added for this. Pressing it will also cause a refresh of the list of book moves, so the user can see if his change were accepted, and the consequences for the playing percentages. --- diff --git a/dialogs.c b/dialogs.c index acc75bf..96f85e2 100644 --- a/dialogs.c +++ b/dialogs.c @@ -1028,7 +1028,7 @@ static char *tagsText; static int NewTagsCallback (int n) { - ReplaceTags(tagsText, &gameInfo); + if(!bookUp) ReplaceTags(tagsText, &gameInfo); return 1; } @@ -1043,7 +1043,7 @@ static void changeTags (int n) { GenericReadout(tagsOptions, 1); - if(bookUp) SaveToBook(tagsText); else + if(bookUp) SaveToBook(tagsText), DisplayBook(currentMove); else ReplaceTags(tagsText, &gameInfo); } diff --git a/winboard/resource.h b/winboard/resource.h index d9f2ce4..7bc3e69 100644 --- a/winboard/resource.h +++ b/winboard/resource.h @@ -216,6 +216,7 @@ #define IDC_NFG_Edit 1023 #define IDC_EpDrawMoveCount 1023 #define IDC_PolyglotDir 1023 +#define OPT_TagsSave 1023 #define OPT_ConsoleText 1024 #define OPT_LightSquareColor 1024 #define OPT_CommandInput 1025 diff --git a/winboard/wedittags.c b/winboard/wedittags.c index 2968710..bd34038 100644 --- a/winboard/wedittags.c +++ b/winboard/wedittags.c @@ -118,6 +118,7 @@ EditTagsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: + case OPT_TagsSave: if (canEditTags) { char *p, *q; /* Read changed options from the dialog box */ @@ -133,13 +134,13 @@ EditTagsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) } *p = NULLCHAR; err = 0; if(resPtr) *resPtr = strdup(str); else - if(bookUp) SaveToBook(str); else + if(bookUp) SaveToBook(str), DisplayBook(currentMove); else err = ReplaceTags(str, &gameInfo); if (err) DisplayError(_("Error replacing tags."), err); free(str); } - TagsPopDown(); + if(LOWORD(wParam) == IDOK) TagsPopDown(); return TRUE; case IDCANCEL: diff --git a/winboard/winboard.rc b/winboard/winboard.rc index e75cc19..7c2d4be 100644 --- a/winboard/winboard.rc +++ b/winboard/winboard.rc @@ -275,16 +275,17 @@ BEGIN EDITTEXT IDC_GameListFilter,201,136,78,14,ES_AUTOHSCROLL END -DLG_EditTags DIALOG DISCARDABLE 6, 18, 167, 140 +DLG_EditTags DIALOG DISCARDABLE 6, 18, 223, 140 STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME CAPTION "Edit Tags" FONT 8, "MS Sans Serif" BEGIN - PUSHBUTTON "OK",IDOK,58,122,50,14 - PUSHBUTTON "Cancel",OPT_TagsCancel,114,122,50,14 + PUSHBUTTON "OK",IDOK,114,122,50,14 + PUSHBUTTON "Cancel",OPT_TagsCancel,170,122,50,14 + PUSHBUTTON "Save",OPT_TagsSave,58,122,50,14 CONTROL "",OPT_TagsText,"RICHEDIT",ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN | WS_BORDER | WS_VSCROLL | - WS_HSCROLL | WS_TABSTOP,2,2,162,115 + WS_HSCROLL | WS_TABSTOP,2,2,218,115 PUSHBUTTON "&Edit",OPT_EditTags,2,122,50,14 END