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
MovePV(event->xmotion.x, event->xmotion.y, lineGap + BOARD_HEIGHT * (squareSize + lineGap));
}
-static int savedIndex; /* gross that this is global */
+extern int savedIndex; /* gross that this is global */
void
CommentClick (Widget w, XEvent * event, String * params, Cardinal * nParams)
LoadVariation( index, val ); // [HGM] also does the actual moving to it, now
}
-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);
-}
-
/* Disable all user input other than deleting the window */
static int frozen = 0;
#endif
-static int savedIndex; /* gross that this is global */
-
-#ifdef TODO_GTK
-void
-CommentClick (Widget w, XEvent * event, String * params, Cardinal * nParams)
-{
- String val;
- XawTextPosition index, dummy;
- Arg arg;
-
- XawTextGetSelectionPos(w, &index, &dummy);
- XtSetArg(arg, XtNstring, &val);
- XtGetValues(w, &arg, 1);
- ReplaceComment(savedIndex, val);
- if(savedIndex != currentMove) ToNrEvent(savedIndex);
- LoadVariation( index, val ); // [HGM] also does the actual moving to it, now
-}
-#endif
-
-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);
-}
-
/* Disable all user input other than deleting the window */
static int frozen = 0;