Move FileNamePopUp to dialogs.c
[xboard.git] / dialogs.c
index 525ce71..046fbc6 100644 (file)
--- a/dialogs.c
+++ b/dialogs.c
@@ -204,7 +204,7 @@ GenericReadout (Option *opts, int selected)
                    break;
                case ComboBox:
                    if(opts[i].min & COMBO_CALLBACK) break;
-                   if(!opts[i].textValue) { *(int*)opts[i].target == opts[i].value; break; } // numeric
+                   if(!opts[i].textValue) { *(int*)opts[i].target = values[i]; break; } // numeric
                    val = ((char**)opts[i].textValue)[values[i]];
                    if(currentCps) {
                        if(opts[i].value == values[i]) break; // not changed
@@ -1078,7 +1078,7 @@ ICSInputSendText ()
     GetWidgetText(&boxOptions[0], &val);
     SaveInHistory(val);
     SendMultiLineToICS(val);
-    SetWidgetText(&boxOptions[0], val, InputBoxDlg);
+    SetWidgetText(&boxOptions[0], "", InputBoxDlg);
 }
 
 void
@@ -2296,4 +2296,26 @@ Browse (DialogClass dlg, char *label, char *proposed, char *ext, Boolean pathFla
     SetWidgetLabel(&browseOptions[9], FileTypes[j]);
 }
 
+static char *openName;
+FileProc fileProc;
+char *fileOpenMode;
+FILE *openFP;
+
+void
+DelayedLoad ()
+{
+  (void) (*fileProc)(openFP, 0, openName);
+}
+
+void
+FileNamePopUp (char *label, char *def, char *filter, FileProc proc, char *openMode)
+{
+    fileProc = proc;           /* I can't see a way not */
+    fileOpenMode = openMode;   /*   to use globals here */
+    {   // [HGM] use file-selector dialog stolen from Ghostview
+       // int index; // this is not supported yet
+       Browse(BoardWindow, label, (def[0] ? def : NULL), filter, False, openMode, &openName, &openFP);
+    }
+}
+