X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=winboard%2Fwedittags.c;h=b3cf334f722ac0060405a58a7b2f7b81603d562b;hb=e6e38912837a4fe2464356408d10dee950b3121c;hp=f6782bbfde3ec2ec356d16a9920459c1432cb0b4;hpb=039ec08b2e0355d7fdd1cc496f7aa800be51bab3;p=xboard.git diff --git a/winboard/wedittags.c b/winboard/wedittags.c index f6782bb..b3cf334 100644 --- a/winboard/wedittags.c +++ b/winboard/wedittags.c @@ -1,7 +1,7 @@ /* * wedittags.c -- EditTags window for WinBoard * - * Copyright 1995, 2009, 2010 Free Software Foundation, Inc. + * Copyright 1995, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc. * * Enhancements Copyright 2005 Alessandro Scotti * @@ -73,6 +73,10 @@ EditTagsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) EnableWindow(GetDlgItem(hDlg, OPT_TagsCancel), canEditTags); EnableWindow(GetDlgItem(hDlg, OPT_EditTags), !canEditTags); SendMessage(hwndText, EM_SETREADONLY, !canEditTags, 0); + if (bookUp) { + SetWindowText(hDlg, _("Edit Book")); + SetFocus(hwndText); + } else if (canEditTags) { SetWindowText(hDlg, _("Edit Tags")); SetFocus(hwndText); @@ -114,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 */ @@ -127,14 +132,15 @@ EditTagsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) else *p++ = *q++; } - *p = NULLCHAR; - if(resPtr) *resPtr = strdup(str), err = 0; else + *p = NULLCHAR; err = 0; + if(resPtr) *resPtr = strdup(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: @@ -173,7 +179,7 @@ VOID TagsPopDown(void) { if (editTagsDialog) ShowWindow(editTagsDialog, SW_HIDE); CheckMenuItem(GetMenu(hwndMain), IDM_Tags, MF_UNCHECKED); - editTagsUp = FALSE; + editTagsUp = bookUp = FALSE; } @@ -206,6 +212,7 @@ VOID EitherTagsPopUp(char *tags, char *msg, BOOLEAN edit) if (editTagsDialog) { SendMessage(editTagsDialog, WM_INITDIALOG, 0, 0); ShowWindow(editTagsDialog, SW_SHOW); + if(bookUp) SetFocus(hwndMain); } else { lpProc = MakeProcInstance((FARPROC)EditTagsDialog, hInst); CreateDialog(hInst, MAKEINTRESOURCE(DLG_EditTags), @@ -230,7 +237,7 @@ VOID EditTagsPopUp(char *tags, char **dest) VOID EditTagsProc() { - if (editTagsUp) { + if (editTagsUp && !bookUp) { TagsPopDown(); } else { EditTagsEvent();