char lastLoadGameTitle[MSG_SIZ], lastLoadPositionTitle[MSG_SIZ];
ChessMove lastLoadGameStart = EndOfFile;
int doubleClick;
+Boolean addToBookFlag;
void
UserMoveEvent(int fromX, int fromY, int toX, int toY, int promoChar)
return;
}
+ if(addToBookFlag) { // adding moves to book
+ char buf[MSG_SIZ], move[MSG_SIZ];
+ CoordsToAlgebraic(boards[currentMove], PosFlags(currentMove), fromY, fromX, toY, toX, promoChar, move);
+ snprintf(buf, MSG_SIZ, " 0.0%% 1 %s\n", move);
+ AddBookMove(buf);
+ addToBookFlag = FALSE;
+ ClearHighlights();
+ return;
+ }
+
FinishMove(moveType, fromX, fromY, toX, toY, promoChar);
}
extern char marker[BOARD_RANKS][BOARD_FILES];
extern char lastMsg[MSG_SIZ];
extern Boolean bookUp;
+extern Boolean addToBookFlag;
extern int tinyLayout, smallLayout;
extern Boolean mcMode;
extern int dragging;
void EditBookEvent P((void));
Boolean DisplayBook P((int moveNr));
void SaveToBook P((char *text));
+void AddBookMove P((char *text));
void PlayBookMove P((char *text, int index));
void HoverEvent P((int hiX, int hiY, int x, int y));
int PackGame P((Board board));
p = MovesToText(count, entries);
EditTagsPopUp(p, NULL);
free(p);
+ addToBookFlag = FALSE;
return TRUE;
}
return 1;
}
+static void
+NewMove ()
+{
+ addToBookFlag = !addToBookFlag;
+}
+
static Option tagsOptions[] = {
{ 0, 0, 0, NULL, NULL, NULL, NULL, Label, NULL },
{ 200, T_VSCRL | T_FILL | T_WRAP | T_TOP, 200, NULL, (void*) &tagsText, "", (char **) &TagsClick, TextBox, "" },
-{ 0, 0, 100, NULL, (void*) &changeTags, NULL, NULL, Button, N_("save changes") },
+{ 0, 0, 100, NULL, (void*) &NewMove, NULL, NULL, Button, N_("add next move") },
+{ 0,SAME_ROW,100,NULL, (void*) &changeTags, NULL, NULL, Button, N_("save changes") },
{ 0,SAME_ROW, 0, NULL, (void*) &NewTagsCallback, "", NULL, EndMark , "" }
};
{
char *title = bookUp ? _("Edit book") : _("Tags");
+ tagsOptions[2].type = bookUp ? Button : Skip;
if(DialogExists(TagsDlg)) { // if already exists, alter title and content
SetWidgetText(&tagsOptions[1], text, TagsDlg);
SetDialogTitle(TagsDlg, title);
if (bookUp || !PopDown(TagsDlg)) EditTagsEvent();
}
+void
+AddBookMove (char *text)
+{
+ AppendText(&tagsOptions[1], text);
+}
+
//---------------------------------------------- ICS Input Box ----------------------------------
char *icsText;
#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
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
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