static int commentIndex;
static void ClearComment P((int n));
static void SaveChanges P((int n));
+int savedIndex; /* gross that this is global (and even across files...) */
+
+static int CommentClick P((Option *opt, int n, int x, int y, char *val, int index));
static int
NewComCallback (int n)
}
Option commentOptions[] = {
-{ 200, T_VSCRL | T_FILL | T_WRAP | T_TOP, 250, NULL, (void*) &commentText, "", NULL, TextBox, "" },
+{ 200, T_VSCRL | T_FILL | T_WRAP | T_TOP, 250, NULL, (void*) &commentText, "", (MemoCallback *) &CommentClick, TextBox, "" },
{ 0, 0, 50, NULL, (void*) &ClearComment, NULL, NULL, Button, N_("clear") },
{ 0, SAME_ROW, 100, NULL, (void*) &SaveChanges, NULL, NULL, Button, N_("save changes") },
{ 0, SAME_ROW, 0, NULL, (void*) &NewComCallback, "", NULL, EndMark , "" }
};
+static int
+CommentClick (Option *opt, int n, int x, int y, char *val, int index)
+{
+ if(n != 3) return FALSE; // only button-3 press is of interest
+ ReplaceComment(savedIndex, val);
+ if(savedIndex != currentMove) ToNrEvent(savedIndex);
+ LoadVariation( index, val ); // [HGM] also does the actual moving to it, now
+ return TRUE;
+}
+
static void
SaveChanges (int n)
{
}
void
+EditCommentPopUp (int index, char *title, char *text)
+{
+ savedIndex = index;
+ if (text == NULL) text = "";
+ NewCommentPopup(title, text, index);
+}
+
+void
+CommentPopUp (char *title, char *text)
+{
+ savedIndex = currentMove; // [HGM] vari
+ NewCommentPopup(title, text, currentMove);
+}
+
+void
+CommentPopDown ()
+{
+ PopDown(CommentDlg);
+}
+
+
+void
EditCommentProc ()
{
if (PopDown(CommentDlg)) { // popdown succesful