Play move right-clicked in Edit Book dialog
[xboard.git] / dialogs.c
index df53d8a..5a904e5 100644 (file)
--- a/dialogs.c
+++ b/dialogs.c
@@ -1034,7 +1034,7 @@ SendString (char *p)
 }
 
 void
-IcsTextProc ()
+IcsTextPopUp ()
 {
    int i=0, j;
    char *p, *q, *r;
@@ -1066,6 +1066,13 @@ IcsTextProc ()
    GenericPopUp(textOptions, _("ICS text menu"), TextMenuDlg, BoardWindow, NONMODAL, appData.topLevel);
 }
 
+void
+IcsTextProc ()
+{
+    if(shellUp[TextMenuDlg]) PopDown(TextMenuDlg);
+    else IcsTextPopUp();
+}
+
 //---------------------------------------------------- Edit Comment -----------------------------------
 
 static char *commentText;
@@ -1164,6 +1171,8 @@ EditCommentProc ()
 static void changeTags P((int n));
 static char *tagsText, **resPtr;
 
+static int TagsClick P((Option *opt, int n, int x, int y, char *val, int index));
+
 static int
 NewTagsCallback (int n)
 {
@@ -1175,11 +1184,18 @@ NewTagsCallback (int n)
 
 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, "", NULL, TextBox, "" },
+{ 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,SAME_ROW, 0, NULL, (void*) &NewTagsCallback, "", NULL, EndMark , "" }
 };
 
+static int TagsClick (Option *opt, int n, int x, int y, char *val, int index)
+{
+    if(!bookUp || n != 3) return FALSE; // only button-3 press in Edit Book is of interest
+    PlayBookMove(val, index);
+    return TRUE;
+}
+
 static void
 changeTags (int n)
 {
@@ -1786,7 +1802,7 @@ ContextMenu (Option *opt, int button, int x, int y, char *text, int index)
   if(wpTextMenu.x < 0) wpTextMenu.x = 0;
   if(wpTextMenu.y < 0) wpTextMenu.y = 0;
   wpTextMenu.width = wpTextMenu.height = -1;
-  IcsTextProc();
+  IcsTextPopUp();
   return TRUE;
 }
 
@@ -2008,7 +2024,7 @@ ConsoleWrite(char *message, int count)
 }
 
 void
-ChatProc ()
+ChatPopUp ()
 {
     if(GenericPopUp(chatOptions, _("ICS Interaction"), ChatDlg, BoardWindow, NONMODAL, appData.topLevel))
        AddHandler(&chatOptions[CHAT_PARTNER], ChatDlg, 2), AddHandler(&chatOptions[CHAT_IN], ChatDlg, 2); // treats return as OK
@@ -2019,6 +2035,13 @@ ChatProc ()
 }
 
 void
+ChatProc ()
+{
+    if(shellUp[ChatDlg]) PopDown(ChatDlg);
+    else ChatPopUp();
+}
+
+void
 ConsoleAutoPopUp (char *buf)
 {
        if(!appData.autoBox) return;
@@ -2030,7 +2053,7 @@ ConsoleAutoPopUp (char *buf)
                SetWidgetText(&chatOptions[CHAT_IN], newText, ChatDlg);
                if(shellUp[ChatDlg]) HardSetFocus (&chatOptions[CHAT_IN], ChatDlg); //why???
            } else { ASSIGN(line, buf); } // box did not exist: make sure it pops up with char in it
-           ChatProc();
+           ChatPopUp();
        } else PopUpMoveDialog(*buf);
 }