/*\r
* wedittags.c -- EditTags window for WinBoard\r
*\r
- * Copyright 1995, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc.\r
+ * Copyright 1995, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Free Software Foundation, Inc.\r
*\r
* Enhancements Copyright 2005 Alessandro Scotti\r
*\r
#include "config.h"\r
\r
#include <windows.h> /* required for all Windows applications */\r
+#include <richedit.h>\r
#include <stdio.h>\r
#include <stdlib.h>\r
#include <malloc.h>\r
\r
/* Module globals */\r
static char *editTagsText, **resPtr;\r
+static HWND memo;\r
BOOL editTagsUp = FALSE;\r
BOOL canEditTags = FALSE;\r
\r
{\r
static HANDLE hwndText;\r
static int sizeX, sizeY;\r
- int len, newSizeX, newSizeY, flags;\r
+ int len, newSizeX, newSizeY;\r
char *str;\r
RECT rect;\r
MINMAXINFO *mmi;\r
case WM_INITDIALOG: /* message: initialize dialog box */\r
/* Initialize the dialog items */\r
Translate(hDlg, DLG_EditTags);\r
- hwndText = GetDlgItem(hDlg, OPT_TagsText);\r
+ hwndText = memo = GetDlgItem(hDlg, OPT_TagsText);\r
SendMessage(hwndText, WM_SETFONT, \r
(WPARAM)font[boardSize][EDITTAGS_FONT]->hf, MAKELPARAM(FALSE, 0));\r
SetDlgItemText(hDlg, OPT_TagsText, editTagsText);\r
EnableWindow(GetDlgItem(hDlg, OPT_TagsCancel), canEditTags);\r
- EnableWindow(GetDlgItem(hDlg, OPT_EditTags), !canEditTags);\r
+ EnableWindow(GetDlgItem(hDlg, OPT_EditTags), !canEditTags || bookUp);\r
SendMessage(hwndText, EM_SETREADONLY, !canEditTags, 0);\r
if (bookUp) {\r
+ SetDlgItemText(hDlg, OPT_EditTags, _("&Play Move"));\r
SetWindowText(hDlg, _("Edit Book"));\r
SetFocus(hwndText);\r
} else\r
}\r
if (!editTagsDialog) {\r
editTagsDialog = hDlg;\r
- flags = SWP_NOZORDER;\r
GetClientRect(hDlg, &rect);\r
sizeX = rect.right;\r
sizeY = rect.bottom;\r
return TRUE;\r
\r
case OPT_EditTags:\r
+ if(bookUp) addToBookFlag = !addToBookFlag; else\r
EditTagsEvent();\r
return TRUE;\r
\r
return FALSE;\r
}\r
\r
+VOID AddBookMove(char *text)\r
+{\r
+ SendMessage( memo, EM_SETSEL, 999999, 999999 ); // [HGM] multivar: choose insertion point\r
+ SendMessage( memo, EM_REPLACESEL, (WPARAM) FALSE, (LPARAM) text );\r
+}\r
+\r
VOID TagsPopDown(void)\r
{\r
if (editTagsDialog) ShowWindow(editTagsDialog, SW_HIDE);\r
CheckMenuItem(GetMenu(hwndMain), IDM_Tags, MF_UNCHECKED);\r
- editTagsUp = bookUp = FALSE;\r
+ editTagsUp = bookUp = addToBookFlag = FALSE;\r
}\r
\r
\r