Implement Grand Chess
[xboard.git] / filebrowser / path.c
index 5aac90c..66c9ab5 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <stdio.h>
 #include <stdlib.h> /* for qsort */
-#include "../config.h"
+#include "config.h"
 
 #ifdef SEL_FILE_IGNORE_CASE
 #include <ctype.h>
@@ -34,8 +34,8 @@
 
 #include <X11/Xos.h>
 #include <pwd.h>
-#include "selfile.h"
 #include "xstat.h"
+#include "selfile.h"
 #include <X11/Xaw/Scrollbar.h>
 
 #ifndef MAXPATHLEN
 extern uid_t getuid();
 #endif /* def HAS_DIRENT_H */
 
-/* added missing prototypes */
-extern void SFtextChanged();
-extern int SFgetDir(SFDir *);
-extern void SFdrawLists(int);
-extern void SFdrawList(int, int);
-extern void SFclearList(int, int);
-extern void SFmotionList(Widget, int, XMotionEvent*);
-
 typedef struct {
        char    *name;
        char    *dir;
@@ -77,6 +69,8 @@ static SFLogin *SFlogins;
 
 static int SFtwiddle = 0;
 
+void SFsetText(char *path);
+
 int
 SFchdir(path)
        char    *path;
@@ -188,23 +182,6 @@ SFstrncmp(p, q, n)
 }
 #endif /* def SEL_FILE_IGNORE_CASE */
 
-void
-SFsetText(path)
-       char    *path;
-{
-       XawTextBlock    text;
-
-       text.firstPos = 0;
-       text.length = strlen(path);
-       text.ptr = path;
-       text.format = FMT8BIT;
-
-       XawTextReplace(selFileField, 0, strlen(SFtextBuffer), &text);
-       XawTextSetInsertionPoint(selFileField, strlen(SFtextBuffer));
-
-       return;
-}
-
 static void
 SFreplaceText(dir, str)
        SFDir   *dir;
@@ -713,6 +690,10 @@ SFbuttonPressList(w, n, event)
        int                     n;
        XButtonPressedEvent     *event;
 {
+       int dir = 0;
+       if(event->button == Button4) dir = -2; // kludge to indicate relative motion
+       if(event->button == Button5) dir = -1;
+       if(dir) SFvSliderMovedCallback(w, n, dir); else
        SFbuttonPressed = 1;
 }
 
@@ -724,7 +705,9 @@ SFbuttonReleaseList(w, n, event)
        XButtonReleasedEvent    *event;
 {
        SFDir   *dir;
+       static int lastClick;
 
+       if(event->button == Button4 || event->button == Button5) return; // [HGM] mouse wheel does not select
        SFbuttonPressed = 0;
 
        if (SFcurrentInvert[n] != -1) {
@@ -738,7 +721,9 @@ SFbuttonReleaseList(w, n, event)
                        dir->entries[dir->vOrigin + SFcurrentInvert[n]].shown
                );
                SFmotionList(w, n, (XMotionEvent *) event);
+               if(lastClick == 256*n + SFcurrentInvert[n]) SFstatus = SEL_FILE_OK; // [HGM] double click implies OK
        }
+       lastClick = 256*n + SFcurrentInvert[n];
 }
 
 static int