Interface XBoard to GhostView file-browser dialog
[xboard.git] / filebrowser / selfile.h
1 /*
2  * File-Selector dialog of GhostView 1.5, incorporated in XBoard by H.G.Muller
3  *
4  * Copyright 1989 Software Research Associates, Inc., Tokyo, Japan
5  *
6  * Permission to use, copy, modify, and distribute this software and its
7  * documentation for any purpose and without fee is hereby granted, provided
8  * that the above copyright notice appear in all copies and that both that
9  * copyright notice and this permission notice appear in supporting
10  * documentation, and that the name of Software Research Associates not be used
11  * in advertising or publicity pertaining to distribution of the software
12  * without specific, written prior permission.  Software Research Associates
13  * makes no representations about the suitability of this software for any
14  * purpose.  It is provided "as is" without express or implied warranty.
15  *
16  * SOFTWARE RESEARCH ASSOCIATES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
17  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
18  * IN NO EVENT SHALL SOFTWARE RESEARCH ASSOCIATES BE LIABLE FOR ANY SPECIAL,
19  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
20  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
21  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22  * PERFORMANCE OF THIS SOFTWARE.
23  *
24  * Author: Erik M. van der Poel
25  *         Software Research Associates, Inc., Tokyo, Japan
26  *         erik@sra.co.jp
27  */
28
29 #include <X11/Intrinsic.h>
30 #include <X11/StringDefs.h>
31 #include <X11/Xos.h>
32 #include <X11/Xaw/Text.h>
33 #include <X11/Xaw/AsciiText.h>
34
35 #define SEL_FILE_CANCEL         -1
36 #define SEL_FILE_OK             0
37 #define SEL_FILE_NULL           1
38 #define SEL_FILE_TEXT           2
39
40 #define SF_DO_SCROLL            1
41 #define SF_DO_NOT_SCROLL        0
42
43 #define NR 3 /* [HGM] (so far failed) attempt to suppress some of the director listings */
44
45 typedef struct {
46         int     statDone;
47         char    *real;
48         char    *shown;
49 } SFEntry;
50
51 typedef struct {
52         char    *dir;
53         char    *path;
54         SFEntry *entries;
55         int     nEntries;
56         int     vOrigin;
57         int     nChars;
58         int     hOrigin;
59         int     changed;
60         int     beginSelection;
61         int     endSelection;
62         time_t  mtime;
63 } SFDir;
64
65 extern int SFstatus;
66
67 extern char SFcurrentPath[], SFstartDir[], SFcurrentDir[];
68
69 extern Widget
70                 selFile,
71                 selFileCancel,
72                 selFileField,
73                 selFileForm,
74                 selFileHScroll,
75                 selFileHScrolls[],
76                 selFileLists[],
77                 selFileOK,
78                 selFilePrompt,
79                 selFileVScrolls[];
80
81 extern Display *SFdisplay;
82
83 extern int SFcharWidth, SFcharHeight, SFcharAscent;
84
85 extern SFDir *SFdirs;
86
87 extern int SFdirEnd, SFdirPtr;
88
89 extern Pixel SFfore, SFback;
90
91 extern Atom SFwmDeleteWindow;
92
93 extern XSegment SFsegs[], SFcompletionSegs[];
94
95 extern XawTextPosition SFtextPos;
96
97 extern void
98         SFenterList(),
99         SFleaveList(),
100         SFmotionList(),
101         SFbuttonPressList(),
102         SFbuttonReleaseList();
103
104 extern void
105         SFvSliderMovedCallback(),
106         SFvFloatSliderMovedCallback(),
107         SFhSliderMovedCallback(),
108         SFpathSliderMovedCallback(),
109         SFvAreaSelectedCallback(),
110         SFhAreaSelectedCallback(),
111         SFpathAreaSelectedCallback();
112
113 extern int SFupperX, SFlowerY, SFupperY;
114
115 extern int SFtextX, SFtextYoffset;
116
117 extern int SFentryWidth, SFentryHeight;
118
119 extern int SFlineToTextH, SFlineToTextV;
120
121 extern int SFbesideText, SFaboveAndBelowText;
122
123 extern int SFcharsPerEntry;
124
125 extern int SFlistSize;
126
127 extern int SFcurrentInvert[];
128
129 extern int SFworkProcAdded;
130
131 extern Boolean SFworkProc();
132
133 extern XtAppContext SFapp;
134
135 extern int SFpathScrollWidth, SFvScrollHeight, SFhScrollWidth;
136
137 extern char SFtextBuffer[];
138
139 extern int SFbuttonPressed;
140
141 extern int SFcompareEntries();
142
143 extern void SFdirModTimer();
144
145 extern char SFstatChar();
146
147 extern XtIntervalId SFdirModTimerId;
148
149 extern int (*SFfunc)();