annotate src/gui_at_fs.c @ 1772:42ac369bd824 v7.2.070

updated for version 7.2-070
author vimboss
date Tue, 23 Dec 2008 22:52:58 +0000
parents 0c0a2b25d10a
children fc89a4f98a8b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 /* vi:set ts=8 sts=4 sw=4: */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 * Copyright 1989 Software Research Associates, Inc., Tokyo, Japan
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 * Permission to use, copy, modify, and distribute this software and its
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 * documentation for any purpose and without fee is hereby granted, provided
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 * that the above copyright notice appear in all copies and that both that
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 * copyright notice and this permission notice appear in supporting
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 * documentation, and that the name of Software Research Associates not be used
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 * in advertising or publicity pertaining to distribution of the software
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 * without specific, written prior permission. Software Research Associates
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 * makes no representations about the suitability of this software for any
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 * purpose. It is provided "as is" without express or implied warranty.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 * SOFTWARE RESEARCH ASSOCIATES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 * IN NO EVENT SHALL SOFTWARE RESEARCH ASSOCIATES BE LIABLE FOR ANY SPECIAL,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 * PERFORMANCE OF THIS SOFTWARE.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 * Author: Erik M. van der Poel
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 * Software Research Associates, Inc., Tokyo, Japan
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 * erik@sra.co.jp
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 * Author's addresses:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 * erik@sra.co.jp
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 * erik%sra.co.jp@uunet.uu.net
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 * erik%sra.co.jp@mcvax.uucp
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 * try junet instead of co.jp
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 * Erik M. van der Poel
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 * Software Research Associates, Inc.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 * 1-1-1 Hirakawa-cho, Chiyoda-ku
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 * Tokyo 102 Japan. TEL +81-3-234-2692
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 * Heavely modified for Vim by Bram Moolenaar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 #include "vim.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 /* Only include this when using the file browser */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 #ifdef FEAT_BROWSE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 /* Weird complication: for "make lint" Text.h doesn't combine with Xm.h */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 #if defined(FEAT_GUI_MOTIF) && defined(FMT8BIT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 # undef FMT8BIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 #ifndef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 # include "gui_at_sb.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 /***************** SFinternal.h */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 #include <X11/Intrinsic.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 #include <X11/StringDefs.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 #include <X11/Xos.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 # include <X11/neXtaw/Text.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 # include <X11/neXtaw/AsciiText.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 # include <X11/neXtaw/Scrollbar.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 # include <X11/Xaw/Text.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 # include <X11/Xaw/AsciiText.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 #define SEL_FILE_CANCEL -1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 #define SEL_FILE_OK 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 #define SEL_FILE_NULL 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 #define SEL_FILE_TEXT 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 #define SF_DO_SCROLL 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 #define SF_DO_NOT_SCROLL 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 typedef struct
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 int statDone;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 char *real;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 char *shown;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 } SFEntry;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 typedef struct
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 char *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 char *path;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 SFEntry *entries;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 int nEntries;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 int vOrigin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 int nChars;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 int hOrigin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 int changed;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 int beginSelection;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 int endSelection;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 time_t mtime;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 } SFDir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 static char SFstartDir[MAXPATHL],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 SFcurrentPath[MAXPATHL],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 SFcurrentDir[MAXPATHL];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 static Widget selFile,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 selFileField,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 selFileForm,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 selFileHScroll,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 selFileHScrolls[3],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 selFileLists[3],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 selFileOK,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 selFileCancel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 selFilePrompt,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 selFileVScrolls[3];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 static Display *SFdisplay;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 static int SFcharWidth, SFcharAscent, SFcharHeight;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 static SFDir *SFdirs = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 static int SFdirEnd;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 static int SFdirPtr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 static Pixel SFfore, SFback;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 static Atom SFwmDeleteWindow;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 static XSegment SFsegs[2], SFcompletionSegs[2];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 static XawTextPosition SFtextPos;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 static int SFupperX, SFlowerY, SFupperY;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 static int SFtextX, SFtextYoffset;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 static int SFentryWidth, SFentryHeight;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 static int SFlineToTextH = 3;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 static int SFlineToTextV = 3;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 static int SFbesideText = 3;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 static int SFaboveAndBelowText = 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 static int SFcharsPerEntry = 15;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 static int SFlistSize = 10;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 static int SFcurrentInvert[3] = { -1, -1, -1 };
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 static int SFworkProcAdded = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 static XtAppContext SFapp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 static int SFpathScrollWidth, SFvScrollHeight, SFhScrollWidth;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 #ifdef FEAT_XFONTSET
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 static char SFtextBuffer[MAXPATHL*sizeof(wchar_t)];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
161 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 static char SFtextBuffer[MAXPATHL];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 static int SFbuttonPressed = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 static XtIntervalId SFdirModTimerId;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 static int (*SFfunc)();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 static int SFstatus = SEL_FILE_NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 /***************** static functions */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175 static void SFsetText __ARGS((char *path));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176 static void SFtextChanged __ARGS((void));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 static char *SFgetText __ARGS((void));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 static void SFupdatePath __ARGS((void));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 static int SFgetDir __ARGS((SFDir *dir));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 static void SFdrawLists __ARGS((int doScroll));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 static void SFdrawList __ARGS((int n, int doScroll));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 static void SFclearList __ARGS((int n, int doScroll));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183 static void SFbuttonPressList __ARGS((Widget w, int n, XButtonPressedEvent *event));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 static void SFbuttonReleaseList __ARGS((Widget w, int n, XButtonReleasedEvent *event));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 static void SFdirModTimer __ARGS((XtPointer cl, XtIntervalId *id));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 static char SFstatChar __ARGS((struct stat *statBuf));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 static void SFdrawStrings __ARGS((Window w, SFDir *dir, int from, int to));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 static int SFnewInvertEntry __ARGS((int n, XMotionEvent *event));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 static void SFinvertEntry __ARGS((int n));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 static void SFenterList __ARGS((Widget w, int n, XEnterWindowEvent *event));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 static void SFleaveList __ARGS((Widget w, int n, XEvent *event));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 static void SFmotionList __ARGS((Widget w, int n, XMotionEvent *event));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 static void SFvFloatSliderMovedCallback __ARGS((Widget w, XtPointer n, XtPointer fnew));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 static void SFvSliderMovedCallback __ARGS((Widget w, int n, int nw));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 static void SFvAreaSelectedCallback __ARGS((Widget w, XtPointer n, XtPointer pnew));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 static void SFhSliderMovedCallback __ARGS((Widget w, XtPointer n, XtPointer nw));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 static void SFhAreaSelectedCallback __ARGS((Widget w, XtPointer n, XtPointer pnew));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 static void SFpathSliderMovedCallback __ARGS((Widget w, XtPointer client_data, XtPointer nw));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 static void SFpathAreaSelectedCallback __ARGS((Widget w, XtPointer client_data, XtPointer pnew));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 static Boolean SFworkProc __ARGS((void));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 static int SFcompareEntries __ARGS((const void *p, const void *q));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 static void SFprepareToReturn __ARGS((void));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 static void SFcreateWidgets __ARGS((Widget toplevel, char *prompt, char *ok, char *cancel));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 static void SFsetColors __ARGS((guicolor_T bg, guicolor_T fg, guicolor_T scroll_bg, guicolor_T scrollfg));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 /***************** xstat.h */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208 #ifndef S_IXUSR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 # define S_IXUSR 0100
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 #ifndef S_IXGRP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 # define S_IXGRP 0010
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 #ifndef S_IXOTH
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215 # define S_IXOTH 0001
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218 #define S_ISXXX(m) ((m) & (S_IXUSR | S_IXGRP | S_IXOTH))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220 /***************** Path.c */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222 #include <pwd.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224 typedef struct
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226 char *name;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 char *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228 } SFLogin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 static int SFdoNotTouchDirPtr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232 static int SFdoNotTouchVorigin = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 static SFDir SFrootDir, SFhomeDir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 static SFLogin *SFlogins;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238 static int SFtwiddle = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240 static int SFchdir __ARGS((char *path));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 SFchdir(path)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244 char *path;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246 int result;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248 result = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 if (strcmp(path, SFcurrentDir))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252 result = mch_chdir(path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 if (!result)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254 (void) strcpy(SFcurrentDir, path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 return result;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 static void SFfree __ARGS((int i));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 SFfree(i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267 int j;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269 dir = &(SFdirs[i]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271 for (j = dir->nEntries - 1; j >= 0; j--)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273 if (dir->entries[j].shown != dir->entries[j].real)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274 XtFree(dir->entries[j].shown);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275 XtFree(dir->entries[j].real);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278 XtFree((char *)dir->entries);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279 XtFree(dir->dir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281 dir->dir = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284 static void SFstrdup __ARGS((char **s1, char *s2));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 SFstrdup(s1, s2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288 char **s1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289 char *s2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291 *s1 = strcpy(XtMalloc((unsigned)(strlen(s2) + 1)), s2);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
293
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294 static void SFunreadableDir __ARGS((SFDir *dir));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297 SFunreadableDir(dir)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
300 char *cannotOpen = _("<cannot open> ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
301
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
302 dir->entries = (SFEntry *) XtMalloc(sizeof(SFEntry));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303 dir->entries[0].statDone = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
304 SFstrdup(&dir->entries[0].real, cannotOpen);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
305 dir->entries[0].shown = dir->entries[0].real;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
306 dir->nEntries = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
307 dir->nChars = strlen(cannotOpen);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
308 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
309
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
310 static void SFreplaceText __ARGS((SFDir *dir, char *str));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
311
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
312 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
313 SFreplaceText(dir, str)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
314 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
315 char *str;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
316 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
317 int len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
318
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
319 *(dir->path) = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
320 len = strlen(str);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
321 if (str[len - 1] == '/')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322 (void) strcat(SFcurrentPath, str);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
323 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324 (void) strncat(SFcurrentPath, str, len - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325 if (strncmp(SFcurrentPath, SFstartDir, strlen(SFstartDir)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
326 SFsetText(SFcurrentPath);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
327 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
328 SFsetText(&(SFcurrentPath[strlen(SFstartDir)]));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
329
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
330 SFtextChanged();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
331 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
332
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
333 static void SFexpand __ARGS((char *str));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
334
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
335 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
336 SFexpand(str)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
337 char *str;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
338 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
339 int len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
340 int cmp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
341 char *name, *growing;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
342 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
343 SFEntry *entry, *max;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
344
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
345 len = strlen(str);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
346
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
347 dir = &(SFdirs[SFdirEnd - 1]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
348
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
349 if (dir->beginSelection == -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
350 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
351 SFstrdup(&str, str);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
352 SFreplaceText(dir, str);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
353 XtFree(str);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
354 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
355 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
356 else if (dir->beginSelection == dir->endSelection)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
357 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
358 SFreplaceText(dir, dir->entries[dir->beginSelection].shown);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
359 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
360 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
361
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
362 max = &(dir->entries[dir->endSelection + 1]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
363
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
364 name = dir->entries[dir->beginSelection].shown;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
365 SFstrdup(&growing, name);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
366
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
367 cmp = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
368 while (!cmp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
369 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
370 entry = &(dir->entries[dir->beginSelection]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
371 while (entry < max)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
372 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
373 if ((cmp = strncmp(growing, entry->shown, len)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
374 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
375 entry++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
376 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
377 len++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
378 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
379
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
380 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
381 * SFreplaceText() expects filename
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
382 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
383 growing[len - 2] = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
385 growing[len - 1] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
386 SFreplaceText(dir, growing);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
387 XtFree(growing);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
388 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
389
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
390 static int SFfindFile __ARGS((SFDir *dir, char *str));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
391
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
392 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
393 SFfindFile(dir, str)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
394 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
395 char *str;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
396 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
397 int i, last, max;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
398 char *name, save;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
399 SFEntry *entries;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
400 int len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
401 int begin, end;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
402 int result;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
403
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
404 len = strlen(str);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
405
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
406 if (str[len - 1] == ' ')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
407 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
408 SFexpand(str);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
409 return 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
410 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
411 else if (str[len - 1] == '/')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
412 len--;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
413
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
414 max = dir->nEntries;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
415
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
416 entries = dir->entries;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
417
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
418 i = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
419 while (i < max)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
420 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
421 name = entries[i].shown;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
422 last = strlen(name) - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
423 save = name[last];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
424 name[last] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
425
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
426 result = strncmp(str, name, len);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
427
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
428 name[last] = save;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
429 if (result <= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
430 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
431 i++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
432 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
433 begin = i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
434 while (i < max)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
435 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
436 name = entries[i].shown;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
437 last = strlen(name) - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
438 save = name[last];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
439 name[last] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
440
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
441 result = strncmp(str, name, len);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
442
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
443 name[last] = save;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
444 if (result)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
445 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
446 i++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
447 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
448 end = i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
449
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
450 if (begin != end)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
451 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
452 if ((dir->beginSelection != begin) || (dir->endSelection != end - 1))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
453 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
454 dir->changed = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
455 dir->beginSelection = begin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
456 if (str[strlen(str) - 1] == '/')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
457 dir->endSelection = begin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
458 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
459 dir->endSelection = end - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
460 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
461 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
462 else if (dir->beginSelection != -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
463 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
464 dir->changed = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
465 dir->beginSelection = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
466 dir->endSelection = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
467 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
468
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
469 if (SFdoNotTouchVorigin
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
470 || ((begin > dir->vOrigin) && (end < dir->vOrigin + SFlistSize)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
471 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
472 SFdoNotTouchVorigin = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
473 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
474 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
475
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
476 i = begin - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
477 if (i > max - SFlistSize)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
478 i = max - SFlistSize;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
479 if (i < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
480 i = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
481
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
482 if (dir->vOrigin != i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
483 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
484 dir->vOrigin = i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
485 dir->changed = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
486 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
487
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
488 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
489 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
490
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
491 static void SFunselect __ARGS((void));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
492
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
493 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
494 SFunselect()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
495 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
496 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
497
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
498 dir = &(SFdirs[SFdirEnd - 1]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
499 if (dir->beginSelection != -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
500 dir->changed = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
501 dir->beginSelection = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
502 dir->endSelection = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
503 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
504
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
505 static int SFcompareLogins __ARGS((const void *p, const void *q));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
506
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
507 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
508 SFcompareLogins(p, q)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
509 const void *p, *q;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
510 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
511 return strcmp(((SFLogin *)p)->name, ((SFLogin *)q)->name);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
512 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
513
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
514 static void SFgetHomeDirs __ARGS((void));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
515
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
516 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
517 SFgetHomeDirs()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
518 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
519 struct passwd *pw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
520 int Alloc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
521 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
522 SFEntry *entries = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
523 int len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
524 int maxChars;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
525
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
526 Alloc = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
527 i = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
528 entries = (SFEntry *)XtMalloc(sizeof(SFEntry));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
529 SFlogins = (SFLogin *)XtMalloc(sizeof(SFLogin));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
530 entries[0].real = XtMalloc(3);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
531 (void) strcpy(entries[0].real, "~");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
532 entries[0].shown = entries[0].real;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
533 entries[0].statDone = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
534 SFlogins[0].name = "";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
535 pw = getpwuid((int) getuid());
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
536 SFstrdup(&SFlogins[0].dir, pw ? pw->pw_dir : "/");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
537 maxChars = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
538
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
539 (void) setpwent();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
540
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
541 while ((pw = getpwent()) && (*(pw->pw_name)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
542 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
543 if (i >= Alloc)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
544 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
545 Alloc *= 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
546 entries = (SFEntry *) XtRealloc((char *)entries,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
547 (unsigned)(Alloc * sizeof(SFEntry)));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
548 SFlogins = (SFLogin *) XtRealloc((char *)SFlogins,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
549 (unsigned)(Alloc * sizeof(SFLogin)));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
550 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
551 len = strlen(pw->pw_name);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
552 entries[i].real = XtMalloc((unsigned) (len + 3));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
553 (void) strcat(strcpy(entries[i].real, "~"), pw->pw_name);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
554 entries[i].shown = entries[i].real;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
555 entries[i].statDone = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
556 if (len > maxChars)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
557 maxChars = len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
558 SFstrdup(&SFlogins[i].name, pw->pw_name);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
559 SFstrdup(&SFlogins[i].dir, pw->pw_dir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
560 i++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
561 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
562
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
563 SFhomeDir.dir = XtMalloc(1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
564 SFhomeDir.dir[0] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
565 SFhomeDir.path = SFcurrentPath;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
566 SFhomeDir.entries = entries;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
567 SFhomeDir.nEntries = i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
568 SFhomeDir.vOrigin = 0; /* :-) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
569 SFhomeDir.nChars = maxChars + 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
570 SFhomeDir.hOrigin = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
571 SFhomeDir.changed = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
572 SFhomeDir.beginSelection = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
573 SFhomeDir.endSelection = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
574
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
575 qsort((char *)entries, (size_t)i, sizeof(SFEntry), SFcompareEntries);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
576 qsort((char *)SFlogins, (size_t)i, sizeof(SFLogin), SFcompareLogins);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
577
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
578 for (i--; i >= 0; i--)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
579 (void)strcat(entries[i].real, "/");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
580 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
581
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
582 static int SFfindHomeDir __ARGS((char *begin, char *end));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
583
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
584 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
585 SFfindHomeDir(begin, end)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
586 char *begin, *end;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
587 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
588 char save;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
589 char *theRest;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
590 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
591
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
592 save = *end;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
593 *end = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
594
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
595 for (i = SFhomeDir.nEntries - 1; i >= 0; i--)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
596 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
597 if (!strcmp(SFhomeDir.entries[i].real, begin))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
598 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
599 *end = save;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
600 SFstrdup(&theRest, end);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
601 (void) strcat(strcat(strcpy(SFcurrentPath,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
602 SFlogins[i].dir), "/"), theRest);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
603 XtFree(theRest);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
604 SFsetText(SFcurrentPath);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
605 SFtextChanged();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
606 return 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
607 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
608 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
609
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
610 *end = save;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
611
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
612 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
613 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
614
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
615 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
616 SFupdatePath()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
617 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
618 static int Alloc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
619 static int wasTwiddle = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
620 char *begin, *end;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
621 int i, j;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
622 int prevChange;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
623 int SFdirPtrSave, SFdirEndSave;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
624 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
625
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
626 if (!SFdirs)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
627 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
628 SFdirs = (SFDir *) XtMalloc((Alloc = 10) * sizeof(SFDir));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
629 dir = &(SFdirs[0]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
630 SFstrdup(&dir->dir, "/");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
631 (void) SFchdir("/");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
632 (void) SFgetDir(dir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
633 for (j = 1; j < Alloc; j++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
634 SFdirs[j].dir = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
635 dir->path = SFcurrentPath + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
636 dir->vOrigin = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
637 dir->hOrigin = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
638 dir->changed = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
639 dir->beginSelection = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
640 dir->endSelection = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
641 SFhomeDir.dir = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
642 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
643
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
644 SFdirEndSave = SFdirEnd;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
645 SFdirEnd = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
646
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
647 SFdirPtrSave = SFdirPtr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
648 SFdirPtr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
649
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
650 begin = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
651
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
652 if (SFcurrentPath[0] == '~')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
653 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
654 if (!SFtwiddle)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
655 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
656 SFtwiddle = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
657 dir = &(SFdirs[0]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
658 SFrootDir = *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
659 if (!SFhomeDir.dir)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
660 SFgetHomeDirs();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
661 *dir = SFhomeDir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
662 dir->changed = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
663 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
664 end = SFcurrentPath;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
665 SFdoNotTouchDirPtr = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
666 wasTwiddle = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
667 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
668 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
669 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
670 if (SFtwiddle)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
671 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
672 SFtwiddle = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
673 dir = &(SFdirs[0]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
674 *dir = SFrootDir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
675 dir->changed = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
676 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
677 end = SFcurrentPath + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
678 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
679
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
680 i = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
681
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
682 prevChange = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
683
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
684 while (*end)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
685 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
686 while (*end++ == '/')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
687 ;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
688 end--;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
689 begin = end;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
690 while ((*end) && (*end++ != '/'))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
691 ;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
692 if ((end - SFcurrentPath <= SFtextPos) && (*(end - 1) == '/'))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
693 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
694 SFdirPtr = i - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
695 if (SFdirPtr < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
696 SFdirPtr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
697 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
698 if (*begin)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
699 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
700 if (*(end - 1) == '/')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
701 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
702 char save = *end;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
703
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
704 if (SFtwiddle)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
705 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
706 if (SFfindHomeDir(begin, end))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
707 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
708 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
709 *end = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
710 i++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
711 SFdirEnd++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
712 if (i >= Alloc)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
713 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
714 SFdirs = (SFDir *) XtRealloc((char *) SFdirs,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
715 (unsigned)((Alloc *= 2) * sizeof(SFDir)));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
716 for (j = Alloc / 2; j < Alloc; j++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
717 SFdirs[j].dir = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
718 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
719 dir = &(SFdirs[i]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
720 if ((!(dir->dir)) || prevChange || strcmp(dir->dir, begin))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
721 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
722 if (dir->dir)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
723 SFfree(i);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
724 prevChange = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
725 SFstrdup(&dir->dir, begin);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
726 dir->path = end;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
727 dir->vOrigin = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
728 dir->hOrigin = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
729 dir->changed = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
730 dir->beginSelection = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
731 dir->endSelection = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
732 (void)SFfindFile(dir - 1, begin);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
733 if (SFchdir(SFcurrentPath) || SFgetDir(dir))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
734 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
735 SFunreadableDir(dir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
736 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
737 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
738 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
739 *end = save;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
740 if (!save)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
741 SFunselect();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
742 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
743 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
744 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
745 if (SFfindFile(&(SFdirs[SFdirEnd-1]), begin))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
746 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
747 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
748 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
749 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
750 SFunselect();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
751 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
752
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
753 if ((end == SFcurrentPath + 1) && (!SFtwiddle))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
754 SFunselect();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
755
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
756 for (i = SFdirEnd; i < Alloc; i++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
757 if (SFdirs[i].dir)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
758 SFfree(i);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
759
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
760 if (SFdoNotTouchDirPtr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
761 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
762 if (wasTwiddle)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
763 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
764 wasTwiddle = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
765 SFdirPtr = SFdirEnd - 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
766 if (SFdirPtr < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
767 SFdirPtr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
768 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
769 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
770 SFdirPtr = SFdirPtrSave;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
771 SFdoNotTouchDirPtr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
772 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
773
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
774 if ((SFdirPtr != SFdirPtrSave) || (SFdirEnd != SFdirEndSave))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
775 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
776 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
777 XawScrollbarSetThumb( selFileHScroll,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
778 (float) (((double) SFdirPtr) / SFdirEnd),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
779 (float) (((double) ((SFdirEnd < 3) ? SFdirEnd : 3)) /
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
780 SFdirEnd));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
781 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
782 vim_XawScrollbarSetThumb( selFileHScroll,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
783 (float) (((double) SFdirPtr) / SFdirEnd),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
784 (float) (((double) ((SFdirEnd < 3) ? SFdirEnd : 3)) /
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
785 SFdirEnd),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
786 (double)SFdirEnd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
787 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
788 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
789
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
790 if (SFdirPtr != SFdirPtrSave)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
791 SFdrawLists(SF_DO_SCROLL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
792 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
793 for (i = 0; i < 3; i++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
794 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
795 if (SFdirPtr + i < SFdirEnd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
796 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
797 if (SFdirs[SFdirPtr + i].changed)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
798 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
799 SFdirs[SFdirPtr + i].changed = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
800 SFdrawList(i, SF_DO_SCROLL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
801 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
802 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
803 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
804 SFclearList(i, SF_DO_SCROLL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
805 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
806 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
807
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
808 #ifdef XtNinternational
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
809 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
810 WcsLen(p)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
811 wchar_t *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
812 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
813 int i = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
814 while (*p++ != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
815 i++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
816 return i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
817 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
818 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
819
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
820 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
821 SFsetText(path)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
822 char *path;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
823 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
824 XawTextBlock text;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
825
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
826 text.firstPos = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
827 text.length = strlen(path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
828 text.ptr = path;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
829 text.format = FMT8BIT;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
830
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
831 #ifdef XtNinternational
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
832 if (_XawTextFormat((TextWidget)selFileField) == XawFmtWide)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
833 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
834 XawTextReplace(selFileField, (XawTextPosition)0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
835 (XawTextPosition)WcsLen((wchar_t *)&SFtextBuffer[0]), &text);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
836 XawTextSetInsertionPoint(selFileField,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
837 (XawTextPosition)WcsLen((wchar_t *)&SFtextBuffer[0]));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
838 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
839 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
840 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
841 XawTextReplace(selFileField, (XawTextPosition)0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
842 (XawTextPosition)strlen(SFtextBuffer), &text);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
843 XawTextSetInsertionPoint(selFileField,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
844 (XawTextPosition)strlen(SFtextBuffer));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
845 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
846 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
847 XawTextReplace(selFileField, (XawTextPosition)0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
848 (XawTextPosition)strlen(SFtextBuffer), &text);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
849 XawTextSetInsertionPoint(selFileField,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
850 (XawTextPosition)strlen(SFtextBuffer));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
851 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
852 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
853
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
854 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
855 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
856 SFbuttonPressList(w, n, event)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
857 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
858 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
859 XButtonPressedEvent *event;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
860 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
861 SFbuttonPressed = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
862 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
863
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
864 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
865 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
866 SFbuttonReleaseList(w, n, event)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
867 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
868 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
869 XButtonReleasedEvent *event;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
870 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
871 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
872
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
873 SFbuttonPressed = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
874
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
875 if (SFcurrentInvert[n] != -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
876 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
877 if (n < 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
878 SFdoNotTouchDirPtr = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
879 SFdoNotTouchVorigin = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
880 dir = &(SFdirs[SFdirPtr + n]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
881 SFreplaceText(dir,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
882 dir->entries[dir->vOrigin + SFcurrentInvert[n]].shown);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
883 SFmotionList(w, n, (XMotionEvent *) event);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
884 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
885 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
886
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
887 static int SFcheckDir __ARGS((int n, SFDir *dir));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
888
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
889 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
890 SFcheckDir(n, dir)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
891 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
892 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
893 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
894 struct stat statBuf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
895 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
896
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
897 if ((!mch_stat(".", &statBuf)) && (statBuf.st_mtime != dir->mtime))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
898 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
899 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
900 * If the pointer is currently in the window that we are about
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
901 * to update, we must warp it to prevent the user from
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
902 * accidentally selecting the wrong file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
903 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
904 if (SFcurrentInvert[n] != -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
905 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
906 XWarpPointer(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
907 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
908 None,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
909 XtWindow(selFileLists[n]),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
910 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
911 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
912 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
913 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
914 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
915 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
916 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
917
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
918 for (i = dir->nEntries - 1; i >= 0; i--)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
919 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
920 if (dir->entries[i].shown != dir->entries[i].real)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
921 XtFree(dir->entries[i].shown);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
922 XtFree(dir->entries[i].real);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
923 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
924 XtFree((char *) dir->entries);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
925 if (SFgetDir(dir))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
926 SFunreadableDir(dir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
927 if (dir->vOrigin > dir->nEntries - SFlistSize)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
928 dir->vOrigin = dir->nEntries - SFlistSize;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
929 if (dir->vOrigin < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
930 dir->vOrigin = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
931 if (dir->hOrigin > dir->nChars - SFcharsPerEntry)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
932 dir->hOrigin = dir->nChars - SFcharsPerEntry;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
933 if (dir->hOrigin < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
934 dir->hOrigin = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
935 dir->beginSelection = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
936 dir->endSelection = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
937 SFdoNotTouchVorigin = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
938 if ((dir + 1)->dir)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
939 (void) SFfindFile(dir, (dir + 1)->dir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
940 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
941 (void) SFfindFile(dir, dir->path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
942
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
943 if (!SFworkProcAdded)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
944 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
945 (void) XtAppAddWorkProc(SFapp, (XtWorkProc)SFworkProc, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
946 SFworkProcAdded = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
947 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
948 return 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
949 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
950 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
951 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
952
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
953 static int SFcheckFiles __ARGS((SFDir *dir));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
954
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
955 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
956 SFcheckFiles(dir)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
957 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
958 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
959 int from, to;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
960 int result;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
961 char oldc, newc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
962 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
963 char *str;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
964 int last;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
965 struct stat statBuf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
966
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
967 result = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
968
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
969 from = dir->vOrigin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
970 to = dir->vOrigin + SFlistSize;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
971 if (to > dir->nEntries)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
972 to = dir->nEntries;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
973
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
974 for (i = from; i < to; i++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
975 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
976 str = dir->entries[i].real;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
977 last = strlen(str) - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
978 oldc = str[last];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
979 str[last] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
980 if (mch_stat(str, &statBuf))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
981 newc = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
982 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
983 newc = SFstatChar(&statBuf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
984 str[last] = newc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
985 if (newc != oldc)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
986 result = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
987 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
988
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
989 return result;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
990 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
991
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
992 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
993 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
994 SFdirModTimer(cl, id)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
995 XtPointer cl;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
996 XtIntervalId *id;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
997 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
998 static int n = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
999 static int f = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1000 char save;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1001 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1002
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1003 if ((!SFtwiddle) && (SFdirPtr < SFdirEnd))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1004 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1005 n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1006 if ((n > 2) || (SFdirPtr + n >= SFdirEnd))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1007 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1008 n = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1009 f++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1010 if ((f > 2) || (SFdirPtr + f >= SFdirEnd))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1011 f = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1012 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1013 dir = &(SFdirs[SFdirPtr + n]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1014 save = *(dir->path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1015 *(dir->path) = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1016 if (SFchdir(SFcurrentPath))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1017 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1018 *(dir->path) = save;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1019
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1020 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1021 * force a re-read
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1022 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1023 *(dir->dir) = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1025 SFupdatePath();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1026 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1027 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1028 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1029 *(dir->path) = save;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1030 if (SFcheckDir(n, dir) || ((f == n) && SFcheckFiles(dir)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1031 SFdrawList(n, SF_DO_SCROLL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1032 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1033 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1034
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1035 SFdirModTimerId = XtAppAddTimeOut(SFapp, (unsigned long) 1000,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1036 SFdirModTimer, (XtPointer) NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1037 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1038
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1039 /* Return a single character describing what kind of file STATBUF is. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1040
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1041 static char
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1042 SFstatChar(statBuf)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1043 struct stat *statBuf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1044 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1045 if (S_ISDIR (statBuf->st_mode))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1046 return '/';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1047 if (S_ISREG (statBuf->st_mode))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1048 return S_ISXXX (statBuf->st_mode) ? '*' : ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1049 #ifdef S_ISSOCK
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1050 if (S_ISSOCK (statBuf->st_mode))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1051 return '=';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1052 #endif /* S_ISSOCK */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1053 return ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1054 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1055
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1056 /***************** Draw.c */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1057
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1058 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1059 # include <X11/neXtaw/Cardinals.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1060 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1061 # include <X11/Xaw/Cardinals.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1062 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1063
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1064 #ifdef FEAT_XFONTSET
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1065 # define SF_DEFAULT_FONT "-misc-fixed-medium-r-normal--14-*"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1066 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1067 # define SF_DEFAULT_FONT "9x15"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1068 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1069
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1070 #ifdef ABS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1071 # undef ABS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1072 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1073 #define ABS(x) (((x) < 0) ? (-(x)) : (x))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1074
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1075 typedef struct
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1076 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1077 char *fontname;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1078 } TextData;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1079
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1080 static GC SFlineGC, SFscrollGC, SFinvertGC, SFtextGC;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1081
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1082 static XtResource textResources[] =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1083 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1084 #ifdef FEAT_XFONTSET
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1085 {XtNfontSet, XtCFontSet, XtRString, sizeof (char *),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1086 XtOffsetOf(TextData, fontname), XtRString, SF_DEFAULT_FONT},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1087 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1088 {XtNfont, XtCFont, XtRString, sizeof (char *),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1089 XtOffsetOf(TextData, fontname), XtRString, SF_DEFAULT_FONT},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1090 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1091 };
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1092
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1093 #ifdef FEAT_XFONTSET
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1094 static XFontSet SFfont;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1095 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1096 static XFontStruct *SFfont;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1097 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1098
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1099 static int SFcurrentListY;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1100
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1101 static XtIntervalId SFscrollTimerId;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1102
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1103 static void SFinitFont __ARGS((void));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1104
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1105 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1106 SFinitFont()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1107 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1108 TextData *data;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1109 #ifdef FEAT_XFONTSET
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1110 XFontSetExtents *extents;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1111 char **missing, *def_str;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1112 int num_missing;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1113 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1114
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1115 data = XtNew(TextData);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1116
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1117 XtGetApplicationResources(selFileForm, (XtPointer) data, textResources,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1118 XtNumber(textResources), (Arg *) NULL, ZERO);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1119
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1120 #ifdef FEAT_XFONTSET
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1121 SFfont = XCreateFontSet(SFdisplay, data->fontname,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1122 &missing, &num_missing, &def_str);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1123 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1124 SFfont = XLoadQueryFont(SFdisplay, data->fontname);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1125 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1126 if (!SFfont)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1127 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1128 #ifdef FEAT_XFONTSET
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1129 SFfont = XCreateFontSet(SFdisplay, SF_DEFAULT_FONT,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1130 &missing, &num_missing, &def_str);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1131 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1132 SFfont = XLoadQueryFont(SFdisplay, SF_DEFAULT_FONT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1133 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1134 if (!SFfont)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1135 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1136 EMSG2(_("E616: vim_SelFile: can't get font %s"), SF_DEFAULT_FONT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1137 SFstatus = SEL_FILE_CANCEL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1138 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1139 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1140 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1141
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1142 #ifdef FEAT_XFONTSET
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1143 extents = XExtentsOfFontSet(SFfont);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1144 SFcharWidth = extents->max_logical_extent.width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1145 SFcharAscent = -extents->max_logical_extent.y;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1146 SFcharHeight = extents->max_logical_extent.height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1147 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1148 SFcharWidth = (SFfont->max_bounds.width + SFfont->min_bounds.width) / 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1149 SFcharAscent = SFfont->max_bounds.ascent;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1150 SFcharHeight = SFcharAscent + SFfont->max_bounds.descent;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1151 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1152 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1153
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1154 static void SFcreateGC __ARGS((void));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1155
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1156 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1157 SFcreateGC()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1158 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1159 XGCValues gcValues;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1160 XRectangle rectangles[1];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1161
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1162 gcValues.foreground = SFfore;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1163
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1164 SFlineGC = XtGetGC(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1165 selFileLists[0],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1166 (XtGCMask)GCForeground,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1167 &gcValues);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1168
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1169 SFscrollGC = XtGetGC(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1170 selFileLists[0],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1171 (XtGCMask)0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1172 &gcValues);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1173
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1174 gcValues.function = GXxor;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1175 gcValues.foreground = SFfore ^ SFback;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1176 gcValues.background = SFfore ^ SFback;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1177
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1178 SFinvertGC = XtGetGC(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1179 selFileLists[0],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1180 (XtGCMask)GCFunction | GCForeground | GCBackground,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1181 &gcValues);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1182
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1183 gcValues.foreground = SFfore;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1184 gcValues.background = SFback;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1185 #ifndef FEAT_XFONTSET
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1186 gcValues.font = SFfont->fid;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1187 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1188
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1189 SFtextGC = XCreateGC(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1190 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1191 XtWindow(selFileLists[0]),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1192 #ifdef FEAT_XFONTSET
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1193 (unsigned long)GCForeground | GCBackground,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1194 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1195 (unsigned long)GCForeground | GCBackground | GCFont,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1196 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1197 &gcValues);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1198
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1199 rectangles[0].x = SFlineToTextH + SFbesideText;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1200 rectangles[0].y = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1201 rectangles[0].width = SFcharsPerEntry * SFcharWidth;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1202 rectangles[0].height = SFupperY + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1203
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1204 XSetClipRectangles(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1205 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1206 SFtextGC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1207 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1208 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1209 rectangles,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1210 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1211 Unsorted);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1212 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1213
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1214 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1215 SFclearList(n, doScroll)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1216 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1217 int doScroll;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1218 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1219 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1220
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1221 SFcurrentInvert[n] = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1222
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1223 XClearWindow(SFdisplay, XtWindow(selFileLists[n]));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1224
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1225 XDrawSegments(SFdisplay, XtWindow(selFileLists[n]), SFlineGC, SFsegs, 2);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1226
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1227 if (doScroll)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1228 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1229 dir = &(SFdirs[SFdirPtr + n]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1230
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1231 if ((SFdirPtr + n < SFdirEnd) && dir->nEntries && dir->nChars)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1232 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1233 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1234 XawScrollbarSetThumb(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1235 selFileVScrolls[n],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1236 (float) (((double) dir->vOrigin) /
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1237 dir->nEntries),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1238 (float) (((double) ((dir->nEntries < SFlistSize)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1239 ? dir->nEntries : SFlistSize)) /
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1240 dir->nEntries));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1241 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1242 vim_XawScrollbarSetThumb(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1243 selFileVScrolls[n],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1244 (float) (((double) dir->vOrigin) /
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1245 dir->nEntries),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1246 (float) (((double) ((dir->nEntries < SFlistSize)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1247 ? dir->nEntries : SFlistSize)) /
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1248 dir->nEntries),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1249 (double)dir->nEntries);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1250 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1251
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1252 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1253 XawScrollbarSetThumb(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1254 selFileHScrolls[n],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1255 (float) (((double) dir->hOrigin) / dir->nChars),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1256 (float) (((double) ((dir->nChars <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1257 SFcharsPerEntry) ? dir->nChars :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1258 SFcharsPerEntry)) / dir->nChars));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1259 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1260 vim_XawScrollbarSetThumb(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1261 selFileHScrolls[n],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1262 (float) (((double) dir->hOrigin) / dir->nChars),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1263 (float) (((double) ((dir->nChars <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1264 SFcharsPerEntry) ? dir->nChars :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1265 SFcharsPerEntry)) / dir->nChars),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1266 (double)dir->nChars);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1267 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1268 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1269 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1270 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1271 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1272 XawScrollbarSetThumb(selFileVScrolls[n], (float) 0.0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1273 (float) 1.0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1274 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1275 vim_XawScrollbarSetThumb(selFileVScrolls[n], (float) 0.0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1276 (float) 1.0, 1.0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1277 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1278 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1279 XawScrollbarSetThumb(selFileHScrolls[n], (float) 0.0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1280 (float) 1.0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1281 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1282 vim_XawScrollbarSetThumb(selFileHScrolls[n], (float) 0.0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1283 (float) 1.0, 1.0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1284 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1285 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1286 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1287 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1288
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1289 static void SFdeleteEntry __ARGS((SFDir *dir, SFEntry *entry));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1290
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1291 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1292 SFdeleteEntry(dir, entry)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1293 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1294 SFEntry *entry;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1295 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1296 SFEntry *e;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1297 SFEntry *end;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1298 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1299 int idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1300
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1301 idx = entry - dir->entries;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1302
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1303 if (idx < dir->beginSelection)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1304 dir->beginSelection--;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1305 if (idx <= dir->endSelection)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1306 dir->endSelection--;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1307 if (dir->beginSelection > dir->endSelection)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1308 dir->beginSelection = dir->endSelection = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1309
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1310 if (idx < dir->vOrigin)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1311 dir->vOrigin--;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1312
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1313 XtFree(entry->real);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1314
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1315 end = &(dir->entries[dir->nEntries - 1]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1316
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1317 for (e = entry; e < end; e++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1318 *e = *(e + 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1319
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1320 if (!(--dir->nEntries))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1321 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1322
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1323 n = dir - &(SFdirs[SFdirPtr]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1324 if ((n < 0) || (n > 2))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1325 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1326
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1327 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1328 XawScrollbarSetThumb(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1329 selFileVScrolls[n],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1330 (float) (((double) dir->vOrigin) / dir->nEntries),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1331 (float) (((double) ((dir->nEntries < SFlistSize) ?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1332 dir->nEntries : SFlistSize)) / dir->nEntries));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1333 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1334 vim_XawScrollbarSetThumb(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1335 selFileVScrolls[n],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1336 (float) (((double) dir->vOrigin) / dir->nEntries),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1337 (float) (((double) ((dir->nEntries < SFlistSize) ?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1338 dir->nEntries : SFlistSize)) / dir->nEntries),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1339 (double)dir->nEntries);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1340 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1341 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1342
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1343 static void SFwriteStatChar __ARGS((char *name, int last, struct stat *statBuf));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1344
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1345 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1346 SFwriteStatChar(name, last, statBuf)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1347 char *name;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1348 int last;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1349 struct stat *statBuf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1350 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1351 name[last] = SFstatChar(statBuf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1352 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1353
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1354 static int SFstatAndCheck __ARGS((SFDir *dir, SFEntry *entry));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1355
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1356 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1357 SFstatAndCheck(dir, entry)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1358 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1359 SFEntry *entry;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1360 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1361 struct stat statBuf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1362 char save;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1363 int last;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1364
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1365 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1366 * must be restored before returning
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1367 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1368 save = *(dir->path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1369 *(dir->path) = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1370
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1371 if (!SFchdir(SFcurrentPath))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1372 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1373 last = strlen(entry->real) - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1374 entry->real[last] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1375 entry->statDone = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1376 if ((!mch_stat(entry->real, &statBuf))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1377 #ifdef S_IFLNK
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1378 || (!mch_lstat(entry->real, &statBuf))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1379 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1380 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1381 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1382 if (SFfunc)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1383 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1384 char *shown;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1385
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1386 shown = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1387 if (SFfunc(entry->real, &shown, &statBuf))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1388 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1389 if (shown)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1390 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1391 int len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1392
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1393 len = strlen(shown);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1394 entry->shown = XtMalloc((unsigned) (len + 2));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1395 (void) strcpy(entry->shown, shown);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1396 SFwriteStatChar(entry->shown, len, &statBuf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1397 entry->shown[len + 1] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1398 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1399 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1400 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1401 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1402 SFdeleteEntry(dir, entry);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1403
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1404 *(dir->path) = save;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1405 return 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1406 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1407 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1408 SFwriteStatChar(entry->real, last, &statBuf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1409 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1410 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1411 entry->real[last] = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1412 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1413
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1414 *(dir->path) = save;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1415 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1416 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1417
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1418
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1419 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1420 SFdrawStrings(w, dir, from, to)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1421 Window w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1422 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1423 int from;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1424 int to;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1425 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1426 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1427 SFEntry *entry;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1428 int x;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1429
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1430 x = SFtextX - dir->hOrigin * SFcharWidth;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1431
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1432 if (dir->vOrigin + to >= dir->nEntries)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1433 to = dir->nEntries - dir->vOrigin - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1434 for (i = from; i <= to; i++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1435 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1436 entry = &(dir->entries[dir->vOrigin + i]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1437 if (!(entry->statDone))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1438 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1439 if (SFstatAndCheck(dir, entry))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1440 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1441 if (dir->vOrigin + to >= dir->nEntries)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1442 to = dir->nEntries - dir->vOrigin - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1443 i--;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1444 continue;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1445 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1446 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1447 #ifdef FEAT_XFONTSET
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1448 XmbDrawImageString(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1449 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1450 w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1451 SFfont,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1452 SFtextGC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1453 x,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1454 SFtextYoffset + i * SFentryHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1455 entry->shown,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1456 strlen(entry->shown));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1457 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1458 XDrawImageString(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1459 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1460 w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1461 SFtextGC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1462 x,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1463 SFtextYoffset + i * SFentryHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1464 entry->shown,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1465 strlen(entry->shown));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1466 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1467 if (dir->vOrigin + i == dir->beginSelection)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1468 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1469 XDrawLine(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1470 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1471 w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1472 SFlineGC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1473 SFlineToTextH + 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1474 SFlowerY + i * SFentryHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1475 SFlineToTextH + SFentryWidth - 2,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1476 SFlowerY + i * SFentryHeight);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1477 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1478 if ((dir->vOrigin + i >= dir->beginSelection) &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1479 (dir->vOrigin + i <= dir->endSelection))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1480 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1481 SFcompletionSegs[0].y1 = SFcompletionSegs[1].y1 =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1482 SFlowerY + i * SFentryHeight;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1483 SFcompletionSegs[0].y2 = SFcompletionSegs[1].y2 =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1484 SFlowerY + (i + 1) * SFentryHeight - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1485 XDrawSegments(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1486 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1487 w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1488 SFlineGC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1489 SFcompletionSegs,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1490 2);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1491 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1492 if (dir->vOrigin + i == dir->endSelection)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1493 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1494 XDrawLine(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1495 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1496 w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1497 SFlineGC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1498 SFlineToTextH + 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1499 SFlowerY + (i + 1) * SFentryHeight - 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1500 SFlineToTextH + SFentryWidth - 2,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1501 SFlowerY + (i + 1) * SFentryHeight - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1502 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1503 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1504 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1505
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1506 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1507 SFdrawList(n, doScroll)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1508 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1509 int doScroll;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1510 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1511 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1512 Window w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1513
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1514 SFclearList(n, doScroll);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1515
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1516 if (SFdirPtr + n < SFdirEnd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1517 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1518 dir = &(SFdirs[SFdirPtr + n]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1519 w = XtWindow(selFileLists[n]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1520 #ifdef FEAT_XFONTSET
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1521 XmbDrawImageString(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1522 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1523 w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1524 SFfont,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1525 SFtextGC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1526 SFtextX - dir->hOrigin * SFcharWidth,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1527 SFlineToTextV + SFaboveAndBelowText + SFcharAscent,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1528 dir->dir,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1529 strlen(dir->dir));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1530 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1531 XDrawImageString(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1532 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1533 w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1534 SFtextGC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1535 SFtextX - dir->hOrigin * SFcharWidth,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1536 SFlineToTextV + SFaboveAndBelowText + SFcharAscent,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1537 dir->dir,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1538 strlen(dir->dir));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1539 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1540 SFdrawStrings(w, dir, 0, SFlistSize - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1541 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1542 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1543
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1544 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1545 SFdrawLists(doScroll)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1546 int doScroll;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1547 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1548 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1549
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1550 for (i = 0; i < 3; i++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1551 SFdrawList(i, doScroll);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1552 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1553
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1554 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1555 SFinvertEntry(n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1556 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1557 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1558 XFillRectangle(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1559 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1560 XtWindow(selFileLists[n]),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1561 SFinvertGC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1562 SFlineToTextH,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1563 SFcurrentInvert[n] * SFentryHeight + SFlowerY,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1564 SFentryWidth,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1565 SFentryHeight);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1566 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1567
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1568 static unsigned long SFscrollTimerInterval __ARGS((void));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1569
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1570 static unsigned long
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1571 SFscrollTimerInterval()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1572 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1573 static int maxVal = 200;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1574 static int varyDist = 50;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1575 static int minDist = 50;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1576 int t;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1577 int dist;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1578
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1579 if (SFcurrentListY < SFlowerY)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1580 dist = SFlowerY - SFcurrentListY;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1581 else if (SFcurrentListY > SFupperY)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1582 dist = SFcurrentListY - SFupperY;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1583 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1584 return (unsigned long) 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1585
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1586 t = maxVal - ((maxVal / varyDist) * (dist - minDist));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1587
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1588 if (t < 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1589 t = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1590
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1591 if (t > maxVal)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1592 t = maxVal;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1593
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1594 return (unsigned long)t;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1595 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1596
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1597 static void SFscrollTimer __ARGS((XtPointer p, XtIntervalId *id));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1598
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1599 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1600 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1601 SFscrollTimer(p, id)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1602 XtPointer p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1603 XtIntervalId *id;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1604 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1605 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1606 int save;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1607 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1609 n = (long)p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1610
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1611 dir = &(SFdirs[SFdirPtr + n]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1612 save = dir->vOrigin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1613
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1614 if (SFcurrentListY < SFlowerY)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1615 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1616 if (dir->vOrigin > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1617 SFvSliderMovedCallback(selFileVScrolls[n], n, dir->vOrigin - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1618 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1619 else if (SFcurrentListY > SFupperY)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1620 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1621 if (dir->vOrigin < dir->nEntries - SFlistSize)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1622 SFvSliderMovedCallback(selFileVScrolls[n], n, dir->vOrigin + 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1623 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1624
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1625 if (dir->vOrigin != save)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1626 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1627 if (dir->nEntries)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1628 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1629 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1630 XawScrollbarSetThumb(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1631 selFileVScrolls[n],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1632 (float) (((double) dir->vOrigin) / dir->nEntries),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1633 (float) (((double) ((dir->nEntries < SFlistSize) ?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1634 dir->nEntries : SFlistSize)) / dir->nEntries));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1635 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1636 vim_XawScrollbarSetThumb(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1637 selFileVScrolls[n],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1638 (float) (((double) dir->vOrigin) / dir->nEntries),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1639 (float) (((double) ((dir->nEntries < SFlistSize) ?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1640 dir->nEntries : SFlistSize)) / dir->nEntries),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1641 (double)dir->nEntries);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1642 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1643 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1644 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1645
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1646 if (SFbuttonPressed)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1647 SFscrollTimerId = XtAppAddTimeOut(SFapp,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1648 SFscrollTimerInterval(), SFscrollTimer, (XtPointer) n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1649 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1650
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1651 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1652 SFnewInvertEntry(n, event)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1653 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1654 XMotionEvent *event;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1655 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1656 int x, y;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1657 int nw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1658 static int SFscrollTimerAdded = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1659
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1660 x = event->x;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1661 y = event->y;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1662
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1663 if (SFdirPtr + n >= SFdirEnd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1664 return -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1665
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1666 if ((x >= 0) && (x <= SFupperX) && (y >= SFlowerY) && (y <= SFupperY))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1667 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1668 SFDir *dir = &(SFdirs[SFdirPtr + n]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1669
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1670 if (SFscrollTimerAdded)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1671 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1672 SFscrollTimerAdded = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1673 XtRemoveTimeOut(SFscrollTimerId);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1674 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1675
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1676 nw = (y - SFlowerY) / SFentryHeight;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1677 if (dir->vOrigin + nw >= dir->nEntries)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1678 return -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1679 return nw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1680 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1681 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1682 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1683 if (SFbuttonPressed)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1684 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1685 SFcurrentListY = y;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1686 if (!SFscrollTimerAdded)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1687 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1688 SFscrollTimerAdded = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1689 SFscrollTimerId = XtAppAddTimeOut(SFapp,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1690 SFscrollTimerInterval(), SFscrollTimer,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1691 (XtPointer) n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1692 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1693 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1694 return -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1695 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1696 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1697
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1698 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1699 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1700 SFenterList(w, n, event)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1701 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1702 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1703 XEnterWindowEvent *event;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1704 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1705 int nw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1706
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1707 /* sanity */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1708 if (SFcurrentInvert[n] != -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1709 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1710 SFinvertEntry(n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1711 SFcurrentInvert[n] = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1712 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1713
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1714 nw = SFnewInvertEntry(n, (XMotionEvent *) event);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1715 if (nw != -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1716 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1717 SFcurrentInvert[n] = nw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1718 SFinvertEntry(n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1719 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1720 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1721
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1722 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1723 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1724 SFleaveList(w, n, event)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1725 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1726 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1727 XEvent *event;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1728 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1729 if (SFcurrentInvert[n] != -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1730 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1731 SFinvertEntry(n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1732 SFcurrentInvert[n] = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1733 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1734 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1735
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1736 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1737 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1738 SFmotionList(w, n, event)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1739 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1740 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1741 XMotionEvent *event;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1742 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1743 int nw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1744
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1745 nw = SFnewInvertEntry(n, event);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1746
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1747 if (nw != SFcurrentInvert[n])
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1748 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1749 if (SFcurrentInvert[n] != -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1750 SFinvertEntry(n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1751 SFcurrentInvert[n] = nw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1752 if (nw != -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1753 SFinvertEntry(n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1754 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1755 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1756
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1757 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1758 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1759 SFvFloatSliderMovedCallback(w, n, fnew)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1760 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1761 XtPointer n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1762 XtPointer fnew;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1763 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1764 int nw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1765
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1766 nw = (*(float *)fnew) * SFdirs[SFdirPtr + (int)(long)n].nEntries;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1767 SFvSliderMovedCallback(w, (int)(long)n, nw);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1768 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1769
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1770 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1771 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1772 SFvSliderMovedCallback(w, n, nw)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1773 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1774 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1775 int nw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1776 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1777 int old;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1778 Window win;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1779 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1780
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1781 dir = &(SFdirs[SFdirPtr + n]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1782
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1783 old = dir->vOrigin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1784 dir->vOrigin = nw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1785
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1786 if (old == nw)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1787 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1788
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1789 win = XtWindow(selFileLists[n]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1790
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1791 if (ABS(nw - old) < SFlistSize)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1792 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1793 if (nw > old)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1794 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1795 XCopyArea(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1796 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1797 win,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1798 win,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1799 SFscrollGC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1800 SFlineToTextH,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1801 SFlowerY + (nw - old) * SFentryHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1802 SFentryWidth + SFlineToTextH,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1803 (SFlistSize - (nw - old)) * SFentryHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1804 SFlineToTextH,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1805 SFlowerY);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1806 XClearArea(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1807 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1808 win,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1809 SFlineToTextH,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1810 SFlowerY + (SFlistSize - (nw - old)) *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1811 SFentryHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1812 SFentryWidth + SFlineToTextH,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1813 (nw - old) * SFentryHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1814 False);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1815 SFdrawStrings(win, dir, SFlistSize - (nw - old),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1816 SFlistSize - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1817 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1818 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1819 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1820 XCopyArea(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1821 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1822 win,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1823 win,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1824 SFscrollGC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1825 SFlineToTextH,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1826 SFlowerY,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1827 SFentryWidth + SFlineToTextH,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1828 (SFlistSize - (old - nw)) * SFentryHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1829 SFlineToTextH,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1830 SFlowerY + (old - nw) * SFentryHeight);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1831 XClearArea(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1832 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1833 win,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1834 SFlineToTextH,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1835 SFlowerY,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1836 SFentryWidth + SFlineToTextH,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1837 (old - nw) * SFentryHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1838 False);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1839 SFdrawStrings(win, dir, 0, old - nw);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1840 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1841 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1842 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1843 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1844 XClearArea(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1845 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1846 win,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1847 SFlineToTextH,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1848 SFlowerY,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1849 SFentryWidth + SFlineToTextH,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1850 SFlistSize * SFentryHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1851 False);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1852 SFdrawStrings(win, dir, 0, SFlistSize - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1853 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1854 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1855
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1856 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1857 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1858 SFvAreaSelectedCallback(w, n, pnew)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1859 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1860 XtPointer n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1861 XtPointer pnew;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1862 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1863 SFDir *dir;
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1864 int nw = (int)(long)pnew;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1865
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1866 dir = &(SFdirs[SFdirPtr + (int)(long)n]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1867
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1868 #ifdef FEAT_GUI_NEXTAW
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1869 if (nw < 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1870 {
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1871 if (nw > -SFvScrollHeight)
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1872 nw = -1;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1873 else
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1874 nw = -SFlistSize;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1875 }
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1876 else if (nw > 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1877 {
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1878 if (nw < SFvScrollHeight)
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1879 nw = 1;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1880 else
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1881 nw = SFlistSize;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1882 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1883 #endif
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1884 nw += dir->vOrigin;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1885
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1886 if (nw > dir->nEntries - SFlistSize)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1887 nw = dir->nEntries - SFlistSize;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1888
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1889 if (nw < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1890 nw = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1891
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1892 if (dir->nEntries)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1893 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1894 float f;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1895
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1896 f = ((double) nw) / dir->nEntries;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1897
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1898 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1899 XawScrollbarSetThumb(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1900 w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1901 f,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1902 (float) (((double) ((dir->nEntries < SFlistSize) ?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1903 dir->nEntries : SFlistSize)) / dir->nEntries));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1904 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1905 vim_XawScrollbarSetThumb(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1906 w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1907 f,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1908 (float) (((double) ((dir->nEntries < SFlistSize) ?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1909 dir->nEntries : SFlistSize)) / dir->nEntries),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1910 (double)dir->nEntries);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1911 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1912 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1913
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1914 SFvSliderMovedCallback(w, (int)(long)n, nw);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1915 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1916
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1917 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1918 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1919 SFhSliderMovedCallback(w, n, nw)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1920 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1921 XtPointer n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1922 XtPointer nw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1923 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1924 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1925 int save;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1926
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1927 dir = &(SFdirs[SFdirPtr + (int)(long)n]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1928 save = dir->hOrigin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1929 dir->hOrigin = (*(float *)nw) * dir->nChars;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1930 if (dir->hOrigin == save)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1931 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1932
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1933 SFdrawList((int)(long)n, SF_DO_NOT_SCROLL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1934 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1935
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1936 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1937 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1938 SFhAreaSelectedCallback(w, n, pnew)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1939 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1940 XtPointer n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1941 XtPointer pnew;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1942 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1943 SFDir *dir;
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1944 int nw = (int)(long)pnew;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1945
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1946 dir = &(SFdirs[SFdirPtr + (int)(long)n]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1947
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1948 #ifdef FEAT_GUI_NEXTAW
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1949 if (nw < 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1950 {
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1951 if (nw > -SFhScrollWidth)
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1952 nw = -1;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1953 else
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1954 nw = -SFcharsPerEntry;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1955 }
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1956 else if (nw > 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1957 {
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1958 if (nw < SFhScrollWidth)
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1959 nw = 1;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1960 else
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1961 nw = SFcharsPerEntry;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1962 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1963 #endif
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1964 nw += dir->hOrigin;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1965
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1966 if (nw > dir->nChars - SFcharsPerEntry)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1967 nw = dir->nChars - SFcharsPerEntry;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1968
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1969 if (nw < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1970 nw = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1971
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1972 if (dir->nChars)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1973 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1974 float f;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1975
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1976 f = ((double) nw) / dir->nChars;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1977
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1978 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1979 XawScrollbarSetThumb(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1980 w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1981 f,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1982 (float) (((double) ((dir->nChars < SFcharsPerEntry) ?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1983 dir->nChars : SFcharsPerEntry)) / dir->nChars));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1984 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1985 vim_XawScrollbarSetThumb(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1986 w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1987 f,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1988 (float) (((double) ((dir->nChars < SFcharsPerEntry) ?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1989 dir->nChars : SFcharsPerEntry)) / dir->nChars),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1990 (double)dir->nChars);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1991 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1992
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1993 SFhSliderMovedCallback(w, n, (XtPointer)&f);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1994 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1995 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1996
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1997 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1998 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1999 SFpathSliderMovedCallback(w, client_data, nw)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2000 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2001 XtPointer client_data;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2002 XtPointer nw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2003 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2004 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2005 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2006 XawTextPosition pos;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2007 int SFdirPtrSave;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2008
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2009 SFdirPtrSave = SFdirPtr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2010 SFdirPtr = (*(float *)nw) * SFdirEnd;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2011 if (SFdirPtr == SFdirPtrSave)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2012 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2013
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2014 SFdrawLists(SF_DO_SCROLL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2015
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2016 n = 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2017 while (SFdirPtr + n >= SFdirEnd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2018 n--;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2019
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2020 dir = &(SFdirs[SFdirPtr + n]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2021
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2022 pos = dir->path - SFcurrentPath;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2023
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2024 if (!strncmp(SFcurrentPath, SFstartDir, strlen(SFstartDir)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2025 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2026 pos -= strlen(SFstartDir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2027 if (pos < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2028 pos = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2029 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2030
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2031 XawTextSetInsertionPoint(selFileField, pos);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2032 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2033
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2034 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2035 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2036 SFpathAreaSelectedCallback(w, client_data, pnew)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2037 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2038 XtPointer client_data;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2039 XtPointer pnew;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2040 {
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
2041 int nw = (int)(long)pnew;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2042 float f;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2043
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2044 #ifdef FEAT_GUI_NEXTAW
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
2045 if (nw < 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2046 {
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
2047 if (nw > -SFpathScrollWidth)
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
2048 nw = -1;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2049 else
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
2050 nw = -3;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2051 }
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
2052 else if (nw > 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2053 {
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
2054 if (nw < SFpathScrollWidth)
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
2055 nw = 1;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2056 else
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
2057 nw = 3;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2058 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2059 #endif
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
2060 nw += SFdirPtr;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2061
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2062 if (nw > SFdirEnd - 3)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2063 nw = SFdirEnd - 3;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2064
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2065 if (nw < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2066 nw = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2067
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2068 f = ((double) nw) / SFdirEnd;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2069
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2070 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2071 XawScrollbarSetThumb(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2072 w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2073 f,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2074 (float) (((double) ((SFdirEnd < 3) ? SFdirEnd : 3)) / SFdirEnd));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2075 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2076 vim_XawScrollbarSetThumb(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2077 w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2078 f,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2079 (float) (((double) ((SFdirEnd < 3) ? SFdirEnd : 3)) / SFdirEnd),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2080 (double)SFdirEnd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2081 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2082
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2083 SFpathSliderMovedCallback(w, (XtPointer) NULL, (XtPointer)&f);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2084 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2085
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2086 static Boolean
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2087 SFworkProc()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2088 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2089 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2090 SFEntry *entry;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2091
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2092 for (dir = &(SFdirs[SFdirEnd - 1]); dir >= SFdirs; dir--)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2093 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2094 if (!(dir->nEntries))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2095 continue;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2096 for (entry = &(dir->entries[dir->nEntries - 1]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2097 entry >= dir->entries;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2098 entry--)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2099 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2100 if (!(entry->statDone))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2101 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2102 (void)SFstatAndCheck(dir, entry);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2103 return False;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2104 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2105 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2106 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2107
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2108 SFworkProcAdded = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2109
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2110 return True;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2111 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2112
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2113 /***************** Dir.c */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2114
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2115 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2116 SFcompareEntries(p, q)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2117 const void *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2118 const void *q;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2119 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2120 return strcmp(((SFEntry *)p)->real, ((SFEntry *)q)->real);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2121 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2122
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2123 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2124 SFgetDir(dir)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2125 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2126 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2127 SFEntry *result = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2128 int Alloc = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2129 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2130 DIR *dirp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2131 struct dirent *dp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2132 char *str;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2133 int len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2134 int maxChars;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2135 struct stat statBuf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2136
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2137 maxChars = strlen(dir->dir) - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2138
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2139 dir->entries = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2140 dir->nEntries = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2141 dir->nChars = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2142
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2143 result = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2144 i = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2145
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2146 dirp = opendir(".");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2147 if (!dirp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2148 return 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2149
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2150 (void)mch_stat(".", &statBuf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2151 dir->mtime = statBuf.st_mtime;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2153 while ((dp = readdir(dirp)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2154 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2155 /* Ignore "." and ".." */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2156 if (strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2157 continue;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2158 if (i >= Alloc)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2159 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2160 Alloc = 2 * (Alloc + 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2161 result = (SFEntry *) XtRealloc((char *) result,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2162 (unsigned) (Alloc * sizeof(SFEntry)));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2163 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2164 result[i].statDone = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2165 str = dp->d_name;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2166 len = strlen(str);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2167 result[i].real = XtMalloc((unsigned) (len + 2));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2168 (void) strcat(strcpy(result[i].real, str), " ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2169 if (len > maxChars)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2170 maxChars = len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2171 result[i].shown = result[i].real;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2172 i++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2173 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2174
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2175 qsort((char *) result, (size_t) i, sizeof(SFEntry), SFcompareEntries);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2176
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2177 dir->entries = result;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2178 dir->nEntries = i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2179 dir->nChars = maxChars + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2180
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2181 closedir(dirp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2182
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2183 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2184 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2185
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2186 /***************** SFinternal.h */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2187
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2188 #include <sys/param.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2189 #include <X11/cursorfont.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2190 #include <X11/Composite.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2191 #include <X11/Shell.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2192 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2193 # include <X11/neXtaw/Form.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2194 # include <X11/neXtaw/Command.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2195 # include <X11/neXtaw/Label.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2196 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2197 #include <X11/Xaw/Form.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2198 #include <X11/Xaw/Command.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2199 #include <X11/Xaw/Label.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2200 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2201
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2202 static char *oneLineTextEditTranslations = "\
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2203 <Key>Return: redraw-display()\n\
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2204 Ctrl<Key>M: redraw-display()\n\
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2205 ";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2206
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2207 static void SFexposeList __ARGS((Widget w, XtPointer n, XEvent *event, Boolean *cont));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2208
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2209 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2210 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2211 SFexposeList(w, n, event, cont)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2212 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2213 XtPointer n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2214 XEvent *event;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2215 Boolean *cont;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2216 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2217 if ((event->type == NoExpose) || event->xexpose.count)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2218 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2219
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2220 SFdrawList((int)(long)n, SF_DO_NOT_SCROLL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2221 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2222
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2223 static void SFmodVerifyCallback __ARGS((Widget w, XtPointer client_data, XEvent *event, Boolean *cont));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2224
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2225 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2226 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2227 SFmodVerifyCallback(w, client_data, event, cont)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2228 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2229 XtPointer client_data;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2230 XEvent *event;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2231 Boolean *cont;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2232 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2233 char buf[2];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2234
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2235 if ((XLookupString(&(event->xkey), buf, 2, NULL, NULL) == 1) &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2236 ((*buf) == '\r'))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2237 SFstatus = SEL_FILE_OK;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2238 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2239 SFstatus = SEL_FILE_TEXT;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2240 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2241
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2242 static void SFokCallback __ARGS((Widget w, XtPointer cl, XtPointer cd));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2243
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2244 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2245 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2246 SFokCallback(w, cl, cd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2247 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2248 XtPointer cl, cd;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2249 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2250 SFstatus = SEL_FILE_OK;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2251 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2252
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2253 static XtCallbackRec SFokSelect[] =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2254 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2255 { SFokCallback, (XtPointer) NULL },
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2256 { NULL, (XtPointer) NULL },
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2257 };
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2258
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2259 static void SFcancelCallback __ARGS((Widget w, XtPointer cl, XtPointer cd));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2260
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2261 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2262 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2263 SFcancelCallback(w, cl, cd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2264 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2265 XtPointer cl, cd;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2266 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2267 SFstatus = SEL_FILE_CANCEL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2268 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2269
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2270 static XtCallbackRec SFcancelSelect[] =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2271 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2272 { SFcancelCallback, (XtPointer) NULL },
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2273 { NULL, (XtPointer) NULL },
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2274 };
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2275
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2276 static void SFdismissAction __ARGS((Widget w, XEvent *event, String *params, Cardinal *num_params));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2277
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2278 /* ARGSUSED */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2279 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2280 SFdismissAction(w, event, params, num_params)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2281 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2282 XEvent *event;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2283 String *params;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2284 Cardinal *num_params;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2285 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2286 if (event->type == ClientMessage &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2287 event->xclient.data.l[0] != SFwmDeleteWindow)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2288 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2289
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2290 SFstatus = SEL_FILE_CANCEL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2291 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2292
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2293 static char *wmDeleteWindowTranslation = "\
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2294 <Message>WM_PROTOCOLS: SelFileDismiss()\n\
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2295 ";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2296
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2297 static XtActionsRec actions[] =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2298 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2299 {"SelFileDismiss", SFdismissAction},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2300 };
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2301
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2302 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2303 SFsetColors(bg, fg, scroll_bg, scroll_fg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2304 guicolor_T bg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2305 guicolor_T fg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2306 guicolor_T scroll_bg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2307 guicolor_T scroll_fg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2308 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2309 if (selFileForm)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2310 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2311 XtVaSetValues(selFileForm, XtNbackground, bg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2312 XtNforeground, fg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2313 XtNborderColor, bg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2314 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2315 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2316 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2317 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2318
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2319 for (i = 0; i < 3; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2320 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2321 if (selFileLists[i])
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2322 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2323 XtVaSetValues(selFileLists[i], XtNbackground, bg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2324 XtNforeground, fg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2325 XtNborderColor, fg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2326 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2327 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2328 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2329 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2330 if (selFileOK)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2331 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2332 XtVaSetValues(selFileOK, XtNbackground, bg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2333 XtNforeground, fg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2334 XtNborderColor, fg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2335 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2336 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2337 if (selFileCancel)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2338 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2339 XtVaSetValues(selFileCancel, XtNbackground, bg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2340 XtNforeground, fg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2341 XtNborderColor, fg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2342 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2343 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2344 if (selFilePrompt)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2345 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2346 XtVaSetValues(selFilePrompt, XtNbackground, bg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2347 XtNforeground, fg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2348 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2349 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2350 if (gui.dpy)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2351 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2352 XSetBackground(gui.dpy, SFtextGC, bg);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2353 XSetForeground(gui.dpy, SFtextGC, fg);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2354 XSetForeground(gui.dpy, SFlineGC, fg);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2355
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2356 /* This is an xor GC, so combine the fg and background */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2357 XSetBackground(gui.dpy, SFinvertGC, fg ^ bg);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2358 XSetForeground(gui.dpy, SFinvertGC, fg ^ bg);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2359 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2360 if (selFileHScroll)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2361 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2362 XtVaSetValues(selFileHScroll, XtNbackground, scroll_bg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2363 XtNforeground, scroll_fg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2364 XtNborderColor, fg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2365 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2366 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2367 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2368 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2369
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2370 for (i = 0; i < 3; i++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2371 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2372 XtVaSetValues(selFileVScrolls[i], XtNbackground, scroll_bg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2373 XtNforeground, scroll_fg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2374 XtNborderColor, fg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2375 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2376 XtVaSetValues(selFileHScrolls[i], XtNbackground, scroll_bg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2377 XtNforeground, scroll_fg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2378 XtNborderColor, fg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2379 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2380 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2381 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2382 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2383
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2384 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2385 SFcreateWidgets(toplevel, prompt, ok, cancel)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2386 Widget toplevel;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2387 char *prompt;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2388 char *ok;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2389 char *cancel;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2390 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2391 Cardinal n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2392 int listWidth, listHeight;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2393 int listSpacing = 10;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2394 int scrollThickness = 15;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2395 int hScrollX, hScrollY;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2396 int vScrollX, vScrollY;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2397
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2398 selFile = XtVaAppCreateShell("selFile", "SelFile",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2399 transientShellWidgetClass, SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2400 XtNtransientFor, toplevel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2401 XtNtitle, prompt,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2402 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2403
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2404 /* Add WM_DELETE_WINDOW protocol */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2405 XtAppAddActions(XtWidgetToApplicationContext(selFile),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2406 actions, XtNumber(actions));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2407 XtOverrideTranslations(selFile,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2408 XtParseTranslationTable(wmDeleteWindowTranslation));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2409
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2410 selFileForm = XtVaCreateManagedWidget("selFileForm",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2411 formWidgetClass, selFile,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2412 XtNdefaultDistance, 30,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2413 XtNforeground, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2414 XtNbackground, SFback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2415 XtNborderColor, SFback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2416 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2417
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2418 selFilePrompt = XtVaCreateManagedWidget("selFilePrompt",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2419 labelWidgetClass, selFileForm,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2420 XtNlabel, prompt,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2421 XtNresizable, True,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2422 XtNtop, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2423 XtNbottom, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2424 XtNleft, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2425 XtNright, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2426 XtNborderWidth, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2427 XtNforeground, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2428 XtNbackground, SFback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2429 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2430
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2431 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2432 XtVaGetValues(selFilePrompt,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2433 XtNforeground, &SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2434 XtNbackground, &SFback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2435 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2436 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2437
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2438 SFinitFont();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2439
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2440 SFentryWidth = SFbesideText + SFcharsPerEntry * SFcharWidth +
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2441 SFbesideText;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2442 SFentryHeight = SFaboveAndBelowText + SFcharHeight +
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2443 SFaboveAndBelowText;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2444
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2445 listWidth = SFlineToTextH + SFentryWidth + SFlineToTextH + 1 +
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2446 scrollThickness;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2447 listHeight = SFlineToTextV + SFentryHeight + SFlineToTextV + 1 +
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2448 SFlineToTextV + SFlistSize * SFentryHeight +
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2449 SFlineToTextV + 1 + scrollThickness;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2450
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2451 SFpathScrollWidth = 3 * listWidth + 2 * listSpacing + 4;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2452
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2453 hScrollX = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2454 hScrollY = SFlineToTextV + SFentryHeight + SFlineToTextV + 1 +
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2455 SFlineToTextV + SFlistSize * SFentryHeight +
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2456 SFlineToTextV;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2457 SFhScrollWidth = SFlineToTextH + SFentryWidth + SFlineToTextH;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2458
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2459 vScrollX = SFlineToTextH + SFentryWidth + SFlineToTextH;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2460 vScrollY = SFlineToTextV + SFentryHeight + SFlineToTextV;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2461 SFvScrollHeight = SFlineToTextV + SFlistSize * SFentryHeight +
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2462 SFlineToTextV;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2463
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2464 SFupperX = SFlineToTextH + SFentryWidth + SFlineToTextH - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2465 SFlowerY = SFlineToTextV + SFentryHeight + SFlineToTextV + 1 +
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2466 SFlineToTextV;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2467 SFupperY = SFlineToTextV + SFentryHeight + SFlineToTextV + 1 +
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2468 SFlineToTextV + SFlistSize * SFentryHeight - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2469
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2470 SFtextX = SFlineToTextH + SFbesideText;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2471 SFtextYoffset = SFlowerY + SFaboveAndBelowText + SFcharAscent;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2472
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2473 SFsegs[0].x1 = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2474 SFsegs[0].y1 = vScrollY;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2475 SFsegs[0].x2 = vScrollX - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2476 SFsegs[0].y2 = vScrollY;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2477 SFsegs[1].x1 = vScrollX;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2478 SFsegs[1].y1 = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2479 SFsegs[1].x2 = vScrollX;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2480 SFsegs[1].y2 = vScrollY - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2481
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2482 SFcompletionSegs[0].x1 = SFcompletionSegs[0].x2 = SFlineToTextH;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2483 SFcompletionSegs[1].x1 = SFcompletionSegs[1].x2 =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2484 SFlineToTextH + SFentryWidth - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2485
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2486 selFileField = XtVaCreateManagedWidget("selFileField",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2487 asciiTextWidgetClass, selFileForm,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2488 XtNwidth, 3 * listWidth + 2 * listSpacing + 4,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2489 XtNborderColor, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2490 XtNfromVert, selFilePrompt,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2491 XtNvertDistance, 10,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2492 XtNresizable, True,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2493 XtNtop, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2494 XtNbottom, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2495 XtNleft, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2496 XtNright, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2497 XtNstring, SFtextBuffer,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2498 XtNlength, MAXPATHL,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2499 XtNeditType, XawtextEdit,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2500 XtNwrap, XawtextWrapWord,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2501 XtNresize, XawtextResizeHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2502 XtNuseStringInPlace, True,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2503 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2504
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2505 XtOverrideTranslations(selFileField,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2506 XtParseTranslationTable(oneLineTextEditTranslations));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2507 XtSetKeyboardFocus(selFileForm, selFileField);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2508
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2509 selFileHScroll = XtVaCreateManagedWidget("selFileHScroll",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2510 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2511 scrollbarWidgetClass, selFileForm,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2512 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2513 vim_scrollbarWidgetClass, selFileForm,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2514 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2515 XtNorientation, XtorientHorizontal,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2516 XtNwidth, SFpathScrollWidth,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2517 XtNheight, scrollThickness,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2518 XtNborderColor, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2519 XtNfromVert, selFileField,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2520 XtNvertDistance, 30,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2521 XtNtop, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2522 XtNbottom, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2523 XtNleft, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2524 XtNright, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2525 XtNforeground, gui.scroll_fg_pixel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2526 XtNbackground, gui.scroll_bg_pixel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2527 #ifndef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2528 XtNlimitThumb, 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2529 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2530 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2531
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2532 XtAddCallback(selFileHScroll, XtNjumpProc,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2533 (XtCallbackProc) SFpathSliderMovedCallback, (XtPointer)NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2534 XtAddCallback(selFileHScroll, XtNscrollProc,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2535 (XtCallbackProc) SFpathAreaSelectedCallback, (XtPointer)NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2537 selFileLists[0] = XtVaCreateManagedWidget("selFileList1",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2538 compositeWidgetClass, selFileForm,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2539 XtNwidth, listWidth,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2540 XtNheight, listHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2541 XtNforeground, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2542 XtNbackground, SFback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2543 XtNborderColor, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2544 XtNfromVert, selFileHScroll,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2545 XtNvertDistance, 10,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2546 XtNtop, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2547 XtNbottom, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2548 XtNleft, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2549 XtNright, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2550 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2551
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2552 selFileLists[1] = XtVaCreateManagedWidget("selFileList2",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2553 compositeWidgetClass, selFileForm,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2554 XtNwidth, listWidth,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2555 XtNheight, listHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2556 XtNforeground, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2557 XtNbackground, SFback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2558 XtNborderColor, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2559 XtNfromHoriz, selFileLists[0],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2560 XtNfromVert, selFileHScroll,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2561 XtNhorizDistance, listSpacing,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2562 XtNvertDistance, 10,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2563 XtNtop, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2564 XtNbottom, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2565 XtNleft, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2566 XtNright, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2567 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2568
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2569 selFileLists[2] = XtVaCreateManagedWidget("selFileList3",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2570 compositeWidgetClass, selFileForm,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2571 XtNwidth, listWidth,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2572 XtNheight, listHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2573 XtNforeground, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2574 XtNbackground, SFback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2575 XtNborderColor, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2576 XtNfromHoriz, selFileLists[1],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2577 XtNfromVert, selFileHScroll,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2578 XtNhorizDistance, listSpacing,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2579 XtNvertDistance, 10,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2580 XtNtop, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2581 XtNbottom, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2582 XtNleft, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2583 XtNright, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2584 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2585
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2586 for (n = 0; n < 3; n++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2587 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2588 selFileVScrolls[n] = XtVaCreateManagedWidget("selFileVScroll",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2589 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2590 scrollbarWidgetClass, selFileLists[n],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2591 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2592 vim_scrollbarWidgetClass, selFileLists[n],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2593 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2594 XtNx, vScrollX,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2595 XtNy, vScrollY,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2596 XtNwidth, scrollThickness,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2597 XtNheight, SFvScrollHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2598 XtNborderColor, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2599 XtNforeground, gui.scroll_fg_pixel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2600 XtNbackground, gui.scroll_bg_pixel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2601 #ifndef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2602 XtNlimitThumb, 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2603 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2604 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2605
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2606 XtAddCallback(selFileVScrolls[n], XtNjumpProc,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2607 (XtCallbackProc)SFvFloatSliderMovedCallback, (XtPointer)n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2608 XtAddCallback(selFileVScrolls[n], XtNscrollProc,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2609 (XtCallbackProc)SFvAreaSelectedCallback, (XtPointer)n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2610
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2611 selFileHScrolls[n] = XtVaCreateManagedWidget("selFileHScroll",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2612 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2613 scrollbarWidgetClass, selFileLists[n],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2614 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2615 vim_scrollbarWidgetClass, selFileLists[n],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2616 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2617 XtNorientation, XtorientHorizontal,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2618 XtNx, hScrollX,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2619 XtNy, hScrollY,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2620 XtNwidth, SFhScrollWidth,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2621 XtNheight, scrollThickness,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2622 XtNborderColor, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2623 XtNforeground, gui.scroll_fg_pixel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2624 XtNbackground, gui.scroll_bg_pixel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2625 #ifndef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2626 XtNlimitThumb, 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2627 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2628 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2629
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2630 XtAddCallback(selFileHScrolls[n], XtNjumpProc,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2631 (XtCallbackProc)SFhSliderMovedCallback, (XtPointer)n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2632 XtAddCallback(selFileHScrolls[n], XtNscrollProc,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2633 (XtCallbackProc)SFhAreaSelectedCallback, (XtPointer)n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2634 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2635
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2636 selFileOK = XtVaCreateManagedWidget("selFileOK",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2637 commandWidgetClass, selFileForm,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2638 XtNlabel, ok,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2639 XtNresizable, True,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2640 XtNcallback, SFokSelect,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2641 XtNforeground, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2642 XtNbackground, SFback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2643 XtNborderColor, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2644 XtNfromHoriz, selFileLists[0],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2645 XtNfromVert, selFileLists[0],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2646 XtNvertDistance, 30,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2647 XtNtop, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2648 XtNbottom, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2649 XtNleft, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2650 XtNright, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2651 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2652
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2653 selFileCancel = XtVaCreateManagedWidget("selFileCancel",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2654 commandWidgetClass, selFileForm,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2655 XtNlabel, cancel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2656 XtNresizable, True,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2657 XtNcallback, SFcancelSelect,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2658 XtNforeground, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2659 XtNbackground, SFback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2660 XtNborderColor, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2661 XtNfromHoriz, selFileOK,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2662 XtNfromVert, selFileLists[0],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2663 XtNhorizDistance, 30,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2664 XtNvertDistance, 30,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2665 XtNtop, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2666 XtNbottom, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2667 XtNleft, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2668 XtNright, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2669 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2670
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2671 XtSetMappedWhenManaged(selFile, False);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2672 XtRealizeWidget(selFile);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2673
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2674 /* Add WM_DELETE_WINDOW protocol */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2675 SFwmDeleteWindow = XInternAtom(SFdisplay, "WM_DELETE_WINDOW", False);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2676 XSetWMProtocols(SFdisplay, XtWindow(selFile), &SFwmDeleteWindow, 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2677
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2678 SFcreateGC();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2679
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2680 for (n = 0; n < 3; n++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2681 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2682 XtAddEventHandler(selFileLists[n], ExposureMask, True,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2683 (XtEventHandler)SFexposeList, (XtPointer)n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2684 XtAddEventHandler(selFileLists[n], EnterWindowMask, False,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2685 (XtEventHandler)SFenterList, (XtPointer)n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2686 XtAddEventHandler(selFileLists[n], LeaveWindowMask, False,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2687 (XtEventHandler)SFleaveList, (XtPointer)n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2688 XtAddEventHandler(selFileLists[n], PointerMotionMask, False,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2689 (XtEventHandler)SFmotionList, (XtPointer)n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2690 XtAddEventHandler(selFileLists[n], ButtonPressMask, False,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2691 (XtEventHandler)SFbuttonPressList, (XtPointer)n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2692 XtAddEventHandler(selFileLists[n], ButtonReleaseMask, False,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2693 (XtEventHandler)SFbuttonReleaseList, (XtPointer)n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2694 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2695
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2696 XtAddEventHandler(selFileField, KeyPressMask, False,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2697 SFmodVerifyCallback, (XtPointer)NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2698
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2699 SFapp = XtWidgetToApplicationContext(selFile);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2700 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2701
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2702 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2703 SFtextChanged()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2704 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2705 #if defined(FEAT_XFONTSET) && defined(XtNinternational)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2706 if (_XawTextFormat((TextWidget)selFileField) == XawFmtWide)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2707 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2708 wchar_t *wcbuf=(wchar_t *)SFtextBuffer;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2709
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2710 if ((wcbuf[0] == L'/') || (wcbuf[0] == L'~'))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2711 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2712 (void) wcstombs(SFcurrentPath, wcbuf, MAXPATHL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2713 SFtextPos = XawTextGetInsertionPoint(selFileField);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2714 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2715 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2716 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2717 strcpy(SFcurrentPath, SFstartDir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2718 (void) wcstombs(SFcurrentPath + strlen(SFcurrentPath), wcbuf, MAXPATHL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2719
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2720 SFtextPos = XawTextGetInsertionPoint(selFileField) + strlen(SFstartDir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2721 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2722 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2723 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2724 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2725 if ((SFtextBuffer[0] == '/') || (SFtextBuffer[0] == '~'))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2726 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2727 (void) strcpy(SFcurrentPath, SFtextBuffer);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2728 SFtextPos = XawTextGetInsertionPoint(selFileField);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2729 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2730 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2731 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2732 (void) strcat(strcpy(SFcurrentPath, SFstartDir), SFtextBuffer);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2733
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2734 SFtextPos = XawTextGetInsertionPoint(selFileField) + strlen(SFstartDir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2735 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2736
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2737 if (!SFworkProcAdded)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2738 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2739 (void) XtAppAddWorkProc(SFapp, (XtWorkProc)SFworkProc, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2740 SFworkProcAdded = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2741 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2742
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2743 SFupdatePath();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2744 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2745
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2746 static char *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2747 SFgetText()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2748 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2749 #if defined(FEAT_XFONTSET) && defined(XtNinternational)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2750 char *buf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2751
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2752 if (_XawTextFormat((TextWidget)selFileField) == XawFmtWide)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2753 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2754 wchar_t *wcbuf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2755 int mbslength;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2756
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2757 XtVaGetValues(selFileField,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2758 XtNstring, &wcbuf,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2759 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2760 mbslength = wcstombs(NULL, wcbuf, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2761 /* Hack: some broken wcstombs() returns zero, just get a large buffer */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2762 if (mbslength == 0 && wcbuf != NULL && wcbuf[0] != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2763 mbslength = MAXPATHL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2764 buf=(char *)XtMalloc(mbslength + 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2765 wcstombs(buf, wcbuf, mbslength +1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2766 return buf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2767 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2768 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2769 return (char *)vim_strsave((char_u *)SFtextBuffer);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2770 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2771
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2772 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2773 SFprepareToReturn()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2774 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2775 SFstatus = SEL_FILE_NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2776 XtRemoveGrab(selFile);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2777 XtUnmapWidget(selFile);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2778 XtRemoveTimeOut(SFdirModTimerId);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2779 if (SFchdir(SFstartDir))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2780 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2781 EMSG(_("E614: vim_SelFile: can't return to current directory"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2782 SFstatus = SEL_FILE_CANCEL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2783 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2784 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2785
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2786 char *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2787 vim_SelFile(toplevel, prompt, init_path, show_entry, x, y, fg, bg, scroll_fg, scroll_bg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2788 Widget toplevel;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2789 char *prompt;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2790 char *init_path;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2791 int (*show_entry)();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2792 int x, y;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2793 guicolor_T fg, bg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2794 guicolor_T scroll_fg, scroll_bg; /* The "Scrollbar" group colors */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2795 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2796 static int firstTime = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2797 XEvent event;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2798 char *name_return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2799
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2800 if (prompt == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2801 prompt = _("Pathname:");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2802 SFfore = fg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2803 SFback = bg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2804
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2805 if (mch_dirname((char_u *)SFstartDir, MAXPATHL) == FAIL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2806 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2807 EMSG(_("E615: vim_SelFile: can't get current directory"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2808 return NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2809 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2810
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2811 if (firstTime)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2812 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2813 firstTime = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2814 SFdisplay = XtDisplay(toplevel);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2815 SFcreateWidgets(toplevel, prompt, _("OK"), _("Cancel"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2816 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2817 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2818 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2819 XtVaSetValues(selFilePrompt, XtNlabel, prompt, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2820 XtVaSetValues(selFile, XtNtitle, prompt, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2821 SFsetColors(bg, fg, scroll_bg, scroll_fg);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2822 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2823
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2824 XtVaSetValues(selFile, XtNx, x, XtNy, y, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2825 XtMapWidget(selFile);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2826
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2827 (void)strcat(SFstartDir, "/");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2828 (void)strcpy(SFcurrentDir, SFstartDir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2829
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2830 if (init_path)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2831 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2832 if (init_path[0] == '/')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2833 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2834 (void)strcpy(SFcurrentPath, init_path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2835 if (strncmp(SFcurrentPath, SFstartDir, strlen(SFstartDir)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2836 SFsetText(SFcurrentPath);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2837 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2838 SFsetText(&(SFcurrentPath[strlen(SFstartDir)]));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2839 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2840 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2841 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2842 (void)strcat(strcpy(SFcurrentPath, SFstartDir), init_path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2843 SFsetText(&(SFcurrentPath[strlen(SFstartDir)]));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2844 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2845 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2846 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2847 (void)strcpy(SFcurrentPath, SFstartDir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2848
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2849 SFfunc = show_entry;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2850
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2851 SFtextChanged();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2852
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2853 XtAddGrab(selFile, True, True);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2854
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2855 SFdirModTimerId = XtAppAddTimeOut(SFapp, (unsigned long) 1000,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2856 SFdirModTimer, (XtPointer) NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2857
406
aa550d9d2403 updated for version 7.0106
vimboss
parents: 7
diff changeset
2858 for (;;)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2859 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2860 XtAppNextEvent(SFapp, &event);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2861 XtDispatchEvent(&event);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2862 switch (SFstatus)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2863 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2864 case SEL_FILE_TEXT:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2865 SFstatus = SEL_FILE_NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2866 SFtextChanged();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2867 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2868 case SEL_FILE_OK:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2869 name_return = SFgetText();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2870 SFprepareToReturn();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2871 return name_return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2872 case SEL_FILE_CANCEL:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2873 SFprepareToReturn();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2874 return NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2875 case SEL_FILE_NULL:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2876 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2877 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2878 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2879 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2880 #endif /* FEAT_BROWSE */