X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=winboard%2Fwedittags.c;h=79f4edcbca19406f28480f709214720a14db06d2;hb=59e3a9e715601e65d6a208b2bf8fc0b9c7c0fee8;hp=6a8b1c62287853dd50cc2161f5f94abb7a6c26e5;hpb=f1549d478be5058606811dac414d79492d1ebe5c;p=xboard.git diff --git a/winboard/wedittags.c b/winboard/wedittags.c index 6a8b1c6..79f4edc 100644 --- a/winboard/wedittags.c +++ b/winboard/wedittags.c @@ -26,6 +26,7 @@ #include "config.h" #include /* required for all Windows applications */ +#include #include #include #include @@ -43,6 +44,7 @@ /* Module globals */ static char *editTagsText, **resPtr; +static HWND memo; BOOL editTagsUp = FALSE; BOOL canEditTags = FALSE; @@ -66,14 +68,15 @@ EditTagsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) case WM_INITDIALOG: /* message: initialize dialog box */ /* Initialize the dialog items */ Translate(hDlg, DLG_EditTags); - hwndText = GetDlgItem(hDlg, OPT_TagsText); + hwndText = memo = GetDlgItem(hDlg, OPT_TagsText); SendMessage(hwndText, WM_SETFONT, (WPARAM)font[boardSize][EDITTAGS_FONT]->hf, MAKELPARAM(FALSE, 0)); SetDlgItemText(hDlg, OPT_TagsText, editTagsText); EnableWindow(GetDlgItem(hDlg, OPT_TagsCancel), canEditTags); - EnableWindow(GetDlgItem(hDlg, OPT_EditTags), !canEditTags); + EnableWindow(GetDlgItem(hDlg, OPT_EditTags), !canEditTags || bookUp); SendMessage(hwndText, EM_SETREADONLY, !canEditTags, 0); if (bookUp) { + SetDlgItemText(hDlg, OPT_EditTags, _("&Play Move")); SetWindowText(hDlg, _("Edit Book")); SetFocus(hwndText); } else @@ -150,6 +153,7 @@ EditTagsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) return TRUE; case OPT_EditTags: + if(bookUp) addToBookFlag = !addToBookFlag; else EditTagsEvent(); return TRUE; @@ -204,11 +208,17 @@ EditTagsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) return FALSE; } +VOID AddBookMove(char *text) +{ + SendMessage( memo, EM_SETSEL, 999999, 999999 ); // [HGM] multivar: choose insertion point + SendMessage( memo, EM_REPLACESEL, (WPARAM) FALSE, (LPARAM) text ); +} + VOID TagsPopDown(void) { if (editTagsDialog) ShowWindow(editTagsDialog, SW_HIDE); CheckMenuItem(GetMenu(hwndMain), IDM_Tags, MF_UNCHECKED); - editTagsUp = bookUp = FALSE; + editTagsUp = bookUp = addToBookFlag = FALSE; }