annotate src/gui_at_fs.c @ 3857:34aa94a421b7 v7.3.685

updated for version 7.3.685 Problem: No test for what patch 7.3.673 fixes. Solution: Add a test. (Christian Brabandt)
author Bram Moolenaar <bram@vim.org>
date Thu, 11 Oct 2012 03:35:45 +0200
parents e5265e4d4725
children f8d307ebd74a
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
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
832 if ((unsigned long)_XawTextFormat((TextWidget)selFileField) == XawFmtWide)
7
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 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
855 SFbuttonPressList(w, n, event)
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
856 Widget w UNUSED;
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
857 int n UNUSED;
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
858 XButtonPressedEvent *event UNUSED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
859 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
860 SFbuttonPressed = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
861 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
862
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
863 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
864 SFbuttonReleaseList(w, n, event)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
865 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
866 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
867 XButtonReleasedEvent *event;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
868 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
869 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
870
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
871 SFbuttonPressed = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
872
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
873 if (SFcurrentInvert[n] != -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
874 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
875 if (n < 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
876 SFdoNotTouchDirPtr = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
877 SFdoNotTouchVorigin = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
878 dir = &(SFdirs[SFdirPtr + n]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
879 SFreplaceText(dir,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
880 dir->entries[dir->vOrigin + SFcurrentInvert[n]].shown);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
881 SFmotionList(w, n, (XMotionEvent *) event);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
882 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
883 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
884
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
885 static int SFcheckDir __ARGS((int n, SFDir *dir));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
886
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
887 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
888 SFcheckDir(n, dir)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
889 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
890 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
891 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
892 struct stat statBuf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
893 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
894
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
895 if ((!mch_stat(".", &statBuf)) && (statBuf.st_mtime != dir->mtime))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
896 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
897 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
898 * If the pointer is currently in the window that we are about
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
899 * to update, we must warp it to prevent the user from
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
900 * accidentally selecting the wrong file.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
901 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
902 if (SFcurrentInvert[n] != -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
903 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
904 XWarpPointer(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
905 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
906 None,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
907 XtWindow(selFileLists[n]),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
908 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
909 0,
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 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
915
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
916 for (i = dir->nEntries - 1; i >= 0; i--)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
917 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
918 if (dir->entries[i].shown != dir->entries[i].real)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
919 XtFree(dir->entries[i].shown);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
920 XtFree(dir->entries[i].real);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
921 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
922 XtFree((char *) dir->entries);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
923 if (SFgetDir(dir))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
924 SFunreadableDir(dir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
925 if (dir->vOrigin > dir->nEntries - SFlistSize)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
926 dir->vOrigin = dir->nEntries - SFlistSize;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
927 if (dir->vOrigin < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
928 dir->vOrigin = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
929 if (dir->hOrigin > dir->nChars - SFcharsPerEntry)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
930 dir->hOrigin = dir->nChars - SFcharsPerEntry;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
931 if (dir->hOrigin < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
932 dir->hOrigin = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
933 dir->beginSelection = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
934 dir->endSelection = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
935 SFdoNotTouchVorigin = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
936 if ((dir + 1)->dir)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
937 (void) SFfindFile(dir, (dir + 1)->dir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
938 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
939 (void) SFfindFile(dir, dir->path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
940
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
941 if (!SFworkProcAdded)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
942 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
943 (void) XtAppAddWorkProc(SFapp, (XtWorkProc)SFworkProc, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
944 SFworkProcAdded = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
945 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
946 return 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
947 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
948 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
949 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
950
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
951 static int SFcheckFiles __ARGS((SFDir *dir));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
952
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
953 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
954 SFcheckFiles(dir)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
955 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
956 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
957 int from, to;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
958 int result;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
959 char oldc, newc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
960 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
961 char *str;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
962 int last;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
963 struct stat statBuf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
964
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
965 result = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
966
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
967 from = dir->vOrigin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
968 to = dir->vOrigin + SFlistSize;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
969 if (to > dir->nEntries)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
970 to = dir->nEntries;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
971
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
972 for (i = from; i < to; i++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
973 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
974 str = dir->entries[i].real;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
975 last = strlen(str) - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
976 oldc = str[last];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
977 str[last] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
978 if (mch_stat(str, &statBuf))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
979 newc = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
980 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
981 newc = SFstatChar(&statBuf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
982 str[last] = newc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
983 if (newc != oldc)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
984 result = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
985 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
986
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
987 return result;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
988 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
989
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
990 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
991 SFdirModTimer(cl, id)
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
992 XtPointer cl UNUSED;
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
993 XtIntervalId *id UNUSED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
994 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
995 static int n = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
996 static int f = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
997 char save;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
998 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
999
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1000 if ((!SFtwiddle) && (SFdirPtr < SFdirEnd))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1001 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1002 n++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1003 if ((n > 2) || (SFdirPtr + n >= SFdirEnd))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1004 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1005 n = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1006 f++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1007 if ((f > 2) || (SFdirPtr + f >= SFdirEnd))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1008 f = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1009 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1010 dir = &(SFdirs[SFdirPtr + n]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1011 save = *(dir->path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1012 *(dir->path) = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1013 if (SFchdir(SFcurrentPath))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1014 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1015 *(dir->path) = save;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1016
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1017 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1018 * force a re-read
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1019 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1020 *(dir->dir) = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1021
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1022 SFupdatePath();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1023 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1024 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1025 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1026 *(dir->path) = save;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1027 if (SFcheckDir(n, dir) || ((f == n) && SFcheckFiles(dir)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1028 SFdrawList(n, SF_DO_SCROLL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1029 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1030 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1031
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1032 SFdirModTimerId = XtAppAddTimeOut(SFapp, (unsigned long) 1000,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1033 SFdirModTimer, (XtPointer) NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1034 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1035
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1036 /* Return a single character describing what kind of file STATBUF is. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1037
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1038 static char
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1039 SFstatChar(statBuf)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1040 struct stat *statBuf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1041 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1042 if (S_ISDIR (statBuf->st_mode))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1043 return '/';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1044 if (S_ISREG (statBuf->st_mode))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1045 return S_ISXXX (statBuf->st_mode) ? '*' : ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1046 #ifdef S_ISSOCK
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1047 if (S_ISSOCK (statBuf->st_mode))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1048 return '=';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1049 #endif /* S_ISSOCK */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1050 return ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1051 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1052
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1053 /***************** Draw.c */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1054
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1055 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1056 # include <X11/neXtaw/Cardinals.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1057 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1058 # include <X11/Xaw/Cardinals.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1059 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1060
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1061 #ifdef FEAT_XFONTSET
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1062 # define SF_DEFAULT_FONT "-misc-fixed-medium-r-normal--14-*"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1063 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1064 # define SF_DEFAULT_FONT "9x15"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1065 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1066
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1067 #ifdef ABS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1068 # undef ABS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1069 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1070 #define ABS(x) (((x) < 0) ? (-(x)) : (x))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1071
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1072 typedef struct
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1073 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1074 char *fontname;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1075 } TextData;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1076
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1077 static GC SFlineGC, SFscrollGC, SFinvertGC, SFtextGC;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1078
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1079 static XtResource textResources[] =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1080 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1081 #ifdef FEAT_XFONTSET
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1082 {XtNfontSet, XtCFontSet, XtRString, sizeof (char *),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1083 XtOffsetOf(TextData, fontname), XtRString, SF_DEFAULT_FONT},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1084 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1085 {XtNfont, XtCFont, 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 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1088 };
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1089
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1090 #ifdef FEAT_XFONTSET
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1091 static XFontSet SFfont;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1092 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1093 static XFontStruct *SFfont;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1094 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1095
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1096 static int SFcurrentListY;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1097
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1098 static XtIntervalId SFscrollTimerId;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1099
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1100 static void SFinitFont __ARGS((void));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1101
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1102 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1103 SFinitFont()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1104 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1105 TextData *data;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1106 #ifdef FEAT_XFONTSET
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1107 XFontSetExtents *extents;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1108 char **missing, *def_str;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1109 int num_missing;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1110 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1111
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1112 data = XtNew(TextData);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1113
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1114 XtGetApplicationResources(selFileForm, (XtPointer) data, textResources,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1115 XtNumber(textResources), (Arg *) NULL, ZERO);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1116
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1117 #ifdef FEAT_XFONTSET
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1118 SFfont = XCreateFontSet(SFdisplay, data->fontname,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1119 &missing, &num_missing, &def_str);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1120 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1121 SFfont = XLoadQueryFont(SFdisplay, data->fontname);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1122 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1123 if (!SFfont)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1124 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1125 #ifdef FEAT_XFONTSET
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1126 SFfont = XCreateFontSet(SFdisplay, SF_DEFAULT_FONT,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1127 &missing, &num_missing, &def_str);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1128 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1129 SFfont = XLoadQueryFont(SFdisplay, SF_DEFAULT_FONT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1130 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1131 if (!SFfont)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1132 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1133 EMSG2(_("E616: vim_SelFile: can't get font %s"), SF_DEFAULT_FONT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1134 SFstatus = SEL_FILE_CANCEL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1135 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1136 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1137 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1138
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1139 #ifdef FEAT_XFONTSET
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1140 extents = XExtentsOfFontSet(SFfont);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1141 SFcharWidth = extents->max_logical_extent.width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1142 SFcharAscent = -extents->max_logical_extent.y;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1143 SFcharHeight = extents->max_logical_extent.height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1144 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1145 SFcharWidth = (SFfont->max_bounds.width + SFfont->min_bounds.width) / 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1146 SFcharAscent = SFfont->max_bounds.ascent;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1147 SFcharHeight = SFcharAscent + SFfont->max_bounds.descent;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1148 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1149 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1150
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1151 static void SFcreateGC __ARGS((void));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1152
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1153 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1154 SFcreateGC()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1155 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1156 XGCValues gcValues;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1157 XRectangle rectangles[1];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1158
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1159 gcValues.foreground = SFfore;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1160
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1161 SFlineGC = XtGetGC(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1162 selFileLists[0],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1163 (XtGCMask)GCForeground,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1164 &gcValues);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1165
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1166 SFscrollGC = XtGetGC(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1167 selFileLists[0],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1168 (XtGCMask)0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1169 &gcValues);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1170
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1171 gcValues.function = GXxor;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1172 gcValues.foreground = SFfore ^ SFback;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1173 gcValues.background = SFfore ^ SFback;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1174
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1175 SFinvertGC = XtGetGC(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1176 selFileLists[0],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1177 (XtGCMask)GCFunction | GCForeground | GCBackground,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1178 &gcValues);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1179
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1180 gcValues.foreground = SFfore;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1181 gcValues.background = SFback;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1182 #ifndef FEAT_XFONTSET
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1183 gcValues.font = SFfont->fid;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1184 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1185
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1186 SFtextGC = XCreateGC(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1187 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1188 XtWindow(selFileLists[0]),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1189 #ifdef FEAT_XFONTSET
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1190 (unsigned long)GCForeground | GCBackground,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1191 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1192 (unsigned long)GCForeground | GCBackground | GCFont,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1193 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1194 &gcValues);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1195
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1196 rectangles[0].x = SFlineToTextH + SFbesideText;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1197 rectangles[0].y = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1198 rectangles[0].width = SFcharsPerEntry * SFcharWidth;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1199 rectangles[0].height = SFupperY + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1200
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1201 XSetClipRectangles(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1202 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1203 SFtextGC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1204 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1205 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1206 rectangles,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1207 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1208 Unsorted);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1209 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1210
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1211 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1212 SFclearList(n, doScroll)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1213 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1214 int doScroll;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1215 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1216 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1217
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1218 SFcurrentInvert[n] = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1219
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1220 XClearWindow(SFdisplay, XtWindow(selFileLists[n]));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1221
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1222 XDrawSegments(SFdisplay, XtWindow(selFileLists[n]), SFlineGC, SFsegs, 2);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1223
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1224 if (doScroll)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1225 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1226 dir = &(SFdirs[SFdirPtr + n]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1227
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1228 if ((SFdirPtr + n < SFdirEnd) && dir->nEntries && dir->nChars)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1229 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1230 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1231 XawScrollbarSetThumb(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1232 selFileVScrolls[n],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1233 (float) (((double) dir->vOrigin) /
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1234 dir->nEntries),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1235 (float) (((double) ((dir->nEntries < SFlistSize)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1236 ? dir->nEntries : SFlistSize)) /
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1237 dir->nEntries));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1238 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1239 vim_XawScrollbarSetThumb(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1240 selFileVScrolls[n],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1241 (float) (((double) dir->vOrigin) /
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1242 dir->nEntries),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1243 (float) (((double) ((dir->nEntries < SFlistSize)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1244 ? dir->nEntries : SFlistSize)) /
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1245 dir->nEntries),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1246 (double)dir->nEntries);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1247 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1248
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1249 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1250 XawScrollbarSetThumb(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1251 selFileHScrolls[n],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1252 (float) (((double) dir->hOrigin) / dir->nChars),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1253 (float) (((double) ((dir->nChars <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1254 SFcharsPerEntry) ? dir->nChars :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1255 SFcharsPerEntry)) / dir->nChars));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1256 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1257 vim_XawScrollbarSetThumb(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1258 selFileHScrolls[n],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1259 (float) (((double) dir->hOrigin) / dir->nChars),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1260 (float) (((double) ((dir->nChars <
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1261 SFcharsPerEntry) ? dir->nChars :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1262 SFcharsPerEntry)) / dir->nChars),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1263 (double)dir->nChars);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1264 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1265 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1266 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1267 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1268 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1269 XawScrollbarSetThumb(selFileVScrolls[n], (float) 0.0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1270 (float) 1.0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1271 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1272 vim_XawScrollbarSetThumb(selFileVScrolls[n], (float) 0.0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1273 (float) 1.0, 1.0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1274 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1275 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1276 XawScrollbarSetThumb(selFileHScrolls[n], (float) 0.0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1277 (float) 1.0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1278 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1279 vim_XawScrollbarSetThumb(selFileHScrolls[n], (float) 0.0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1280 (float) 1.0, 1.0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1281 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1282 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1283 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1284 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1285
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1286 static void SFdeleteEntry __ARGS((SFDir *dir, SFEntry *entry));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1287
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1288 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1289 SFdeleteEntry(dir, entry)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1290 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1291 SFEntry *entry;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1292 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1293 SFEntry *e;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1294 SFEntry *end;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1295 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1296 int idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1297
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1298 idx = entry - dir->entries;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1299
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1300 if (idx < dir->beginSelection)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1301 dir->beginSelection--;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1302 if (idx <= dir->endSelection)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1303 dir->endSelection--;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1304 if (dir->beginSelection > dir->endSelection)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1305 dir->beginSelection = dir->endSelection = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1306
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1307 if (idx < dir->vOrigin)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1308 dir->vOrigin--;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1309
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1310 XtFree(entry->real);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1311
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1312 end = &(dir->entries[dir->nEntries - 1]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1313
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1314 for (e = entry; e < end; e++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1315 *e = *(e + 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1316
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1317 if (!(--dir->nEntries))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1318 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1319
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1320 n = dir - &(SFdirs[SFdirPtr]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1321 if ((n < 0) || (n > 2))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1322 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1323
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1324 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1325 XawScrollbarSetThumb(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1326 selFileVScrolls[n],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1327 (float) (((double) dir->vOrigin) / dir->nEntries),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1328 (float) (((double) ((dir->nEntries < SFlistSize) ?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1329 dir->nEntries : SFlistSize)) / dir->nEntries));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1330 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1331 vim_XawScrollbarSetThumb(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1332 selFileVScrolls[n],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1333 (float) (((double) dir->vOrigin) / dir->nEntries),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1334 (float) (((double) ((dir->nEntries < SFlistSize) ?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1335 dir->nEntries : SFlistSize)) / dir->nEntries),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1336 (double)dir->nEntries);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1337 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1338 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1339
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1340 static void SFwriteStatChar __ARGS((char *name, int last, struct stat *statBuf));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1341
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1342 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1343 SFwriteStatChar(name, last, statBuf)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1344 char *name;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1345 int last;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1346 struct stat *statBuf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1347 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1348 name[last] = SFstatChar(statBuf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1349 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1350
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1351 static int SFstatAndCheck __ARGS((SFDir *dir, SFEntry *entry));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1352
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1353 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1354 SFstatAndCheck(dir, entry)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1355 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1356 SFEntry *entry;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1357 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1358 struct stat statBuf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1359 char save;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1360 int last;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1361
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1362 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1363 * must be restored before returning
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1364 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1365 save = *(dir->path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1366 *(dir->path) = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1367
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1368 if (!SFchdir(SFcurrentPath))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1369 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1370 last = strlen(entry->real) - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1371 entry->real[last] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1372 entry->statDone = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1373 if ((!mch_stat(entry->real, &statBuf))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1374 #ifdef S_IFLNK
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1375 || (!mch_lstat(entry->real, &statBuf))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1376 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1377 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1378 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1379 if (SFfunc)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1380 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1381 char *shown;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1382
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1383 shown = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1384 if (SFfunc(entry->real, &shown, &statBuf))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1385 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1386 if (shown)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1387 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1388 int len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1389
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1390 len = strlen(shown);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1391 entry->shown = XtMalloc((unsigned) (len + 2));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1392 (void) strcpy(entry->shown, shown);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1393 SFwriteStatChar(entry->shown, len, &statBuf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1394 entry->shown[len + 1] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1395 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1396 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1397 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1398 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1399 SFdeleteEntry(dir, entry);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1400
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1401 *(dir->path) = save;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1402 return 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1403 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1404 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1405 SFwriteStatChar(entry->real, last, &statBuf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1406 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1407 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1408 entry->real[last] = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1409 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1410
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1411 *(dir->path) = save;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1412 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1413 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1414
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1415
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1416 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1417 SFdrawStrings(w, dir, from, to)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1418 Window w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1419 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1420 int from;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1421 int to;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1422 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1423 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1424 SFEntry *entry;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1425 int x;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1426
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1427 x = SFtextX - dir->hOrigin * SFcharWidth;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1428
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1429 if (dir->vOrigin + to >= dir->nEntries)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1430 to = dir->nEntries - dir->vOrigin - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1431 for (i = from; i <= to; i++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1432 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1433 entry = &(dir->entries[dir->vOrigin + i]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1434 if (!(entry->statDone))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1435 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1436 if (SFstatAndCheck(dir, entry))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1437 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1438 if (dir->vOrigin + to >= dir->nEntries)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1439 to = dir->nEntries - dir->vOrigin - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1440 i--;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1441 continue;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1442 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1443 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1444 #ifdef FEAT_XFONTSET
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1445 XmbDrawImageString(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1446 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1447 w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1448 SFfont,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1449 SFtextGC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1450 x,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1451 SFtextYoffset + i * SFentryHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1452 entry->shown,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1453 strlen(entry->shown));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1454 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1455 XDrawImageString(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1456 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1457 w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1458 SFtextGC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1459 x,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1460 SFtextYoffset + i * SFentryHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1461 entry->shown,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1462 strlen(entry->shown));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1463 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1464 if (dir->vOrigin + i == dir->beginSelection)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1465 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1466 XDrawLine(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1467 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1468 w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1469 SFlineGC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1470 SFlineToTextH + 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1471 SFlowerY + i * SFentryHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1472 SFlineToTextH + SFentryWidth - 2,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1473 SFlowerY + i * SFentryHeight);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1474 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1475 if ((dir->vOrigin + i >= dir->beginSelection) &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1476 (dir->vOrigin + i <= dir->endSelection))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1477 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1478 SFcompletionSegs[0].y1 = SFcompletionSegs[1].y1 =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1479 SFlowerY + i * SFentryHeight;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1480 SFcompletionSegs[0].y2 = SFcompletionSegs[1].y2 =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1481 SFlowerY + (i + 1) * SFentryHeight - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1482 XDrawSegments(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1483 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1484 w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1485 SFlineGC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1486 SFcompletionSegs,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1487 2);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1488 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1489 if (dir->vOrigin + i == dir->endSelection)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1490 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1491 XDrawLine(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1492 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1493 w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1494 SFlineGC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1495 SFlineToTextH + 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1496 SFlowerY + (i + 1) * SFentryHeight - 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1497 SFlineToTextH + SFentryWidth - 2,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1498 SFlowerY + (i + 1) * SFentryHeight - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1499 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1500 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1501 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1502
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1503 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1504 SFdrawList(n, doScroll)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1505 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1506 int doScroll;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1507 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1508 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1509 Window w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1510
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1511 SFclearList(n, doScroll);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1513 if (SFdirPtr + n < SFdirEnd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1514 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1515 dir = &(SFdirs[SFdirPtr + n]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1516 w = XtWindow(selFileLists[n]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1517 #ifdef FEAT_XFONTSET
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1518 XmbDrawImageString(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1519 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1520 w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1521 SFfont,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1522 SFtextGC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1523 SFtextX - dir->hOrigin * SFcharWidth,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1524 SFlineToTextV + SFaboveAndBelowText + SFcharAscent,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1525 dir->dir,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1526 strlen(dir->dir));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1527 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1528 XDrawImageString(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1529 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1530 w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1531 SFtextGC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1532 SFtextX - dir->hOrigin * SFcharWidth,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1533 SFlineToTextV + SFaboveAndBelowText + SFcharAscent,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1534 dir->dir,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1535 strlen(dir->dir));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1536 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1537 SFdrawStrings(w, dir, 0, SFlistSize - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1538 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1539 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1540
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1541 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1542 SFdrawLists(doScroll)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1543 int doScroll;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1544 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1545 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1546
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1547 for (i = 0; i < 3; i++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1548 SFdrawList(i, doScroll);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1549 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1550
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1551 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1552 SFinvertEntry(n)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1553 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1554 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1555 XFillRectangle(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1556 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1557 XtWindow(selFileLists[n]),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1558 SFinvertGC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1559 SFlineToTextH,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1560 SFcurrentInvert[n] * SFentryHeight + SFlowerY,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1561 SFentryWidth,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1562 SFentryHeight);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1563 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1564
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1565 static unsigned long SFscrollTimerInterval __ARGS((void));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1566
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1567 static unsigned long
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1568 SFscrollTimerInterval()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1569 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1570 static int maxVal = 200;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1571 static int varyDist = 50;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1572 static int minDist = 50;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1573 int t;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1574 int dist;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1575
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1576 if (SFcurrentListY < SFlowerY)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1577 dist = SFlowerY - SFcurrentListY;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1578 else if (SFcurrentListY > SFupperY)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1579 dist = SFcurrentListY - SFupperY;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1580 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1581 return (unsigned long) 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1582
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1583 t = maxVal - ((maxVal / varyDist) * (dist - minDist));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1584
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1585 if (t < 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1586 t = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1587
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1588 if (t > maxVal)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1589 t = maxVal;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1590
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1591 return (unsigned long)t;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1592 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1593
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1594 static void SFscrollTimer __ARGS((XtPointer p, XtIntervalId *id));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1595
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1596 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1597 SFscrollTimer(p, id)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1598 XtPointer p;
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
1599 XtIntervalId *id UNUSED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1600 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1601 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1602 int save;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1603 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1604
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1605 n = (long)p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1606
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1607 dir = &(SFdirs[SFdirPtr + n]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1608 save = dir->vOrigin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1609
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1610 if (SFcurrentListY < SFlowerY)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1611 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1612 if (dir->vOrigin > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1613 SFvSliderMovedCallback(selFileVScrolls[n], n, dir->vOrigin - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1614 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1615 else if (SFcurrentListY > SFupperY)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1616 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1617 if (dir->vOrigin < dir->nEntries - SFlistSize)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1618 SFvSliderMovedCallback(selFileVScrolls[n], n, dir->vOrigin + 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1619 }
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 != save)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1622 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1623 if (dir->nEntries)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1624 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1625 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1626 XawScrollbarSetThumb(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1627 selFileVScrolls[n],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1628 (float) (((double) dir->vOrigin) / dir->nEntries),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1629 (float) (((double) ((dir->nEntries < SFlistSize) ?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1630 dir->nEntries : SFlistSize)) / dir->nEntries));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1631 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1632 vim_XawScrollbarSetThumb(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1633 selFileVScrolls[n],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1634 (float) (((double) dir->vOrigin) / dir->nEntries),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1635 (float) (((double) ((dir->nEntries < SFlistSize) ?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1636 dir->nEntries : SFlistSize)) / dir->nEntries),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1637 (double)dir->nEntries);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1638 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1639 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1640 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1641
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1642 if (SFbuttonPressed)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1643 SFscrollTimerId = XtAppAddTimeOut(SFapp,
2255
e5265e4d4725 Avoid compiler warnings.
Bram Moolenaar <bram@vim.org>
parents: 1887
diff changeset
1644 SFscrollTimerInterval(), SFscrollTimer,
e5265e4d4725 Avoid compiler warnings.
Bram Moolenaar <bram@vim.org>
parents: 1887
diff changeset
1645 (XtPointer)(long_u)n);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1646 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1647
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1648 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1649 SFnewInvertEntry(n, event)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1650 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1651 XMotionEvent *event;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1652 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1653 int x, y;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1654 int nw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1655 static int SFscrollTimerAdded = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1656
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1657 x = event->x;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1658 y = event->y;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1659
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1660 if (SFdirPtr + n >= SFdirEnd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1661 return -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1662
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1663 if ((x >= 0) && (x <= SFupperX) && (y >= SFlowerY) && (y <= SFupperY))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1664 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1665 SFDir *dir = &(SFdirs[SFdirPtr + n]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1666
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1667 if (SFscrollTimerAdded)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1668 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1669 SFscrollTimerAdded = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1670 XtRemoveTimeOut(SFscrollTimerId);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1671 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1672
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1673 nw = (y - SFlowerY) / SFentryHeight;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1674 if (dir->vOrigin + nw >= dir->nEntries)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1675 return -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1676 return nw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1677 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1678 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1679 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1680 if (SFbuttonPressed)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1681 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1682 SFcurrentListY = y;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1683 if (!SFscrollTimerAdded)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1684 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1685 SFscrollTimerAdded = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1686 SFscrollTimerId = XtAppAddTimeOut(SFapp,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1687 SFscrollTimerInterval(), SFscrollTimer,
2255
e5265e4d4725 Avoid compiler warnings.
Bram Moolenaar <bram@vim.org>
parents: 1887
diff changeset
1688 (XtPointer)(long_u)n);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1689 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1690 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1691 return -1;
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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1695 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1696 SFenterList(w, n, event)
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
1697 Widget w UNUSED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1698 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1699 XEnterWindowEvent *event;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1700 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1701 int nw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1702
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1703 /* sanity */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1704 if (SFcurrentInvert[n] != -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1705 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1706 SFinvertEntry(n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1707 SFcurrentInvert[n] = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1708 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1709
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1710 nw = SFnewInvertEntry(n, (XMotionEvent *) event);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1711 if (nw != -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1712 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1713 SFcurrentInvert[n] = nw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1714 SFinvertEntry(n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1715 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1716 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1717
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1718 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1719 SFleaveList(w, n, event)
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
1720 Widget w UNUSED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1721 int n;
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
1722 XEvent *event UNUSED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1723 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1724 if (SFcurrentInvert[n] != -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1725 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1726 SFinvertEntry(n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1727 SFcurrentInvert[n] = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1728 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1729 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1730
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1731 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1732 SFmotionList(w, n, event)
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
1733 Widget w UNUSED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1734 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1735 XMotionEvent *event;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1736 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1737 int nw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1738
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1739 nw = SFnewInvertEntry(n, event);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1740
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1741 if (nw != SFcurrentInvert[n])
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1742 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1743 if (SFcurrentInvert[n] != -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1744 SFinvertEntry(n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1745 SFcurrentInvert[n] = nw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1746 if (nw != -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1747 SFinvertEntry(n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1748 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1749 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1750
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1751 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1752 SFvFloatSliderMovedCallback(w, n, fnew)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1753 Widget w;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1754 XtPointer n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1755 XtPointer fnew;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1756 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1757 int nw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1758
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1759 nw = (*(float *)fnew) * SFdirs[SFdirPtr + (int)(long)n].nEntries;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1760 SFvSliderMovedCallback(w, (int)(long)n, nw);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1761 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1762
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1763 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1764 SFvSliderMovedCallback(w, n, nw)
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
1765 Widget w UNUSED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1766 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1767 int nw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1768 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1769 int old;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1770 Window win;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1771 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1772
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1773 dir = &(SFdirs[SFdirPtr + n]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1774
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1775 old = dir->vOrigin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1776 dir->vOrigin = nw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1777
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1778 if (old == nw)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1779 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1780
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1781 win = XtWindow(selFileLists[n]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1782
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1783 if (ABS(nw - old) < SFlistSize)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1784 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1785 if (nw > old)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1786 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1787 XCopyArea(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1788 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1789 win,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1790 win,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1791 SFscrollGC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1792 SFlineToTextH,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1793 SFlowerY + (nw - old) * SFentryHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1794 SFentryWidth + SFlineToTextH,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1795 (SFlistSize - (nw - old)) * SFentryHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1796 SFlineToTextH,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1797 SFlowerY);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1798 XClearArea(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1799 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1800 win,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1801 SFlineToTextH,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1802 SFlowerY + (SFlistSize - (nw - old)) *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1803 SFentryHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1804 SFentryWidth + SFlineToTextH,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1805 (nw - old) * SFentryHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1806 False);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1807 SFdrawStrings(win, dir, SFlistSize - (nw - old),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1808 SFlistSize - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1809 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1810 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1811 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1812 XCopyArea(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1813 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1814 win,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1815 win,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1816 SFscrollGC,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1817 SFlineToTextH,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1818 SFlowerY,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1819 SFentryWidth + SFlineToTextH,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1820 (SFlistSize - (old - nw)) * SFentryHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1821 SFlineToTextH,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1822 SFlowerY + (old - nw) * SFentryHeight);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1823 XClearArea(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1824 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1825 win,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1826 SFlineToTextH,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1827 SFlowerY,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1828 SFentryWidth + SFlineToTextH,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1829 (old - nw) * SFentryHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1830 False);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1831 SFdrawStrings(win, dir, 0, old - nw);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1832 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1833 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1834 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1835 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1836 XClearArea(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1837 SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1838 win,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1839 SFlineToTextH,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1840 SFlowerY,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1841 SFentryWidth + SFlineToTextH,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1842 SFlistSize * SFentryHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1843 False);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1844 SFdrawStrings(win, dir, 0, SFlistSize - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1845 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1846 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1847
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1848 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1849 SFvAreaSelectedCallback(w, n, pnew)
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
1850 Widget w;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1851 XtPointer n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1852 XtPointer pnew;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1853 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1854 SFDir *dir;
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1855 int nw = (int)(long)pnew;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1856
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1857 dir = &(SFdirs[SFdirPtr + (int)(long)n]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1858
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1859 #ifdef FEAT_GUI_NEXTAW
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1860 if (nw < 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1861 {
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1862 if (nw > -SFvScrollHeight)
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1863 nw = -1;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1864 else
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1865 nw = -SFlistSize;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1866 }
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1867 else if (nw > 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1868 {
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1869 if (nw < SFvScrollHeight)
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1870 nw = 1;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1871 else
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1872 nw = SFlistSize;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1873 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1874 #endif
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1875 nw += dir->vOrigin;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1876
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1877 if (nw > dir->nEntries - SFlistSize)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1878 nw = dir->nEntries - SFlistSize;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1879
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1880 if (nw < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1881 nw = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1882
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1883 if (dir->nEntries)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1884 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1885 float f;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1886
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1887 f = ((double) nw) / dir->nEntries;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1888
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1889 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1890 XawScrollbarSetThumb(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1891 w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1892 f,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1893 (float) (((double) ((dir->nEntries < SFlistSize) ?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1894 dir->nEntries : SFlistSize)) / dir->nEntries));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1895 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1896 vim_XawScrollbarSetThumb(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1897 w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1898 f,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1899 (float) (((double) ((dir->nEntries < SFlistSize) ?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1900 dir->nEntries : SFlistSize)) / dir->nEntries),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1901 (double)dir->nEntries);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1902 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1903 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1904
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1905 SFvSliderMovedCallback(w, (int)(long)n, nw);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1906 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1907
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1908 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1909 SFhSliderMovedCallback(w, n, nw)
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
1910 Widget w UNUSED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1911 XtPointer n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1912 XtPointer nw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1913 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1914 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1915 int save;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1916
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1917 dir = &(SFdirs[SFdirPtr + (int)(long)n]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1918 save = dir->hOrigin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1919 dir->hOrigin = (*(float *)nw) * dir->nChars;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1920 if (dir->hOrigin == save)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1921 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1922
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1923 SFdrawList((int)(long)n, SF_DO_NOT_SCROLL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1924 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1925
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1926 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1927 SFhAreaSelectedCallback(w, n, pnew)
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
1928 Widget w;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1929 XtPointer n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1930 XtPointer pnew;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1931 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1932 SFDir *dir;
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1933 int nw = (int)(long)pnew;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1934
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1935 dir = &(SFdirs[SFdirPtr + (int)(long)n]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1936
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1937 #ifdef FEAT_GUI_NEXTAW
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1938 if (nw < 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1939 {
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1940 if (nw > -SFhScrollWidth)
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1941 nw = -1;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1942 else
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1943 nw = -SFcharsPerEntry;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1944 }
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1945 else if (nw > 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1946 {
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1947 if (nw < SFhScrollWidth)
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1948 nw = 1;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1949 else
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1950 nw = SFcharsPerEntry;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1951 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1952 #endif
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
1953 nw += dir->hOrigin;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1954
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1955 if (nw > dir->nChars - SFcharsPerEntry)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1956 nw = dir->nChars - SFcharsPerEntry;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1957
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1958 if (nw < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1959 nw = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1960
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1961 if (dir->nChars)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1962 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1963 float f;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1964
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1965 f = ((double) nw) / dir->nChars;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1966
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1967 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1968 XawScrollbarSetThumb(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1969 w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1970 f,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1971 (float) (((double) ((dir->nChars < SFcharsPerEntry) ?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1972 dir->nChars : SFcharsPerEntry)) / dir->nChars));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1973 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1974 vim_XawScrollbarSetThumb(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1975 w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1976 f,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1977 (float) (((double) ((dir->nChars < SFcharsPerEntry) ?
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1978 dir->nChars : SFcharsPerEntry)) / dir->nChars),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1979 (double)dir->nChars);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1980 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1981
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1982 SFhSliderMovedCallback(w, n, (XtPointer)&f);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1983 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1984 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1985
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1986 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1987 SFpathSliderMovedCallback(w, client_data, nw)
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
1988 Widget w UNUSED;
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
1989 XtPointer client_data UNUSED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1990 XtPointer nw;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1991 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1992 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1993 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1994 XawTextPosition pos;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1995 int SFdirPtrSave;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1996
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1997 SFdirPtrSave = SFdirPtr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1998 SFdirPtr = (*(float *)nw) * SFdirEnd;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1999 if (SFdirPtr == SFdirPtrSave)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2000 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2001
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2002 SFdrawLists(SF_DO_SCROLL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2003
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2004 n = 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2005 while (SFdirPtr + n >= SFdirEnd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2006 n--;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2007
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2008 dir = &(SFdirs[SFdirPtr + n]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2009
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2010 pos = dir->path - SFcurrentPath;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2011
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2012 if (!strncmp(SFcurrentPath, SFstartDir, strlen(SFstartDir)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2013 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2014 pos -= strlen(SFstartDir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2015 if (pos < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2016 pos = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2017 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2018
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2019 XawTextSetInsertionPoint(selFileField, pos);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2020 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2021
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2022 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2023 SFpathAreaSelectedCallback(w, client_data, pnew)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2024 Widget w;
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
2025 XtPointer client_data UNUSED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2026 XtPointer pnew;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2027 {
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
2028 int nw = (int)(long)pnew;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2029 float f;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2030
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2031 #ifdef FEAT_GUI_NEXTAW
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
2032 if (nw < 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2033 {
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
2034 if (nw > -SFpathScrollWidth)
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
2035 nw = -1;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2036 else
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
2037 nw = -3;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2038 }
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
2039 else if (nw > 0)
7
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 if (nw < SFpathScrollWidth)
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
2042 nw = 1;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2043 else
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
2044 nw = 3;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2045 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2046 #endif
889
0c0a2b25d10a updated for version 7.0-015
vimboss
parents: 406
diff changeset
2047 nw += SFdirPtr;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2049 if (nw > SFdirEnd - 3)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2050 nw = SFdirEnd - 3;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2051
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2052 if (nw < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2053 nw = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2054
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2055 f = ((double) nw) / SFdirEnd;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2056
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2057 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2058 XawScrollbarSetThumb(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2059 w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2060 f,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2061 (float) (((double) ((SFdirEnd < 3) ? SFdirEnd : 3)) / SFdirEnd));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2062 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2063 vim_XawScrollbarSetThumb(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2064 w,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2065 f,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2066 (float) (((double) ((SFdirEnd < 3) ? SFdirEnd : 3)) / SFdirEnd),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2067 (double)SFdirEnd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2068 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2069
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2070 SFpathSliderMovedCallback(w, (XtPointer) NULL, (XtPointer)&f);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2071 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2073 static Boolean
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2074 SFworkProc()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2075 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2076 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2077 SFEntry *entry;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2078
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2079 for (dir = &(SFdirs[SFdirEnd - 1]); dir >= SFdirs; dir--)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2080 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2081 if (!(dir->nEntries))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2082 continue;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2083 for (entry = &(dir->entries[dir->nEntries - 1]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2084 entry >= dir->entries;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2085 entry--)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2086 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2087 if (!(entry->statDone))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2088 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2089 (void)SFstatAndCheck(dir, entry);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2090 return False;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2091 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2092 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2093 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2094
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2095 SFworkProcAdded = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2097 return True;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2098 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2099
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2100 /***************** Dir.c */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2101
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2102 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2103 SFcompareEntries(p, q)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2104 const void *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2105 const void *q;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2106 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2107 return strcmp(((SFEntry *)p)->real, ((SFEntry *)q)->real);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2108 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2109
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2110 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2111 SFgetDir(dir)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2112 SFDir *dir;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2113 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2114 SFEntry *result = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2115 int Alloc = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2116 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2117 DIR *dirp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2118 struct dirent *dp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2119 char *str;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2120 int len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2121 int maxChars;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2122 struct stat statBuf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2123
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2124 maxChars = strlen(dir->dir) - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2125
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2126 dir->entries = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2127 dir->nEntries = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2128 dir->nChars = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2129
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2130 result = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2131 i = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2132
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2133 dirp = opendir(".");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2134 if (!dirp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2135 return 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2136
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2137 (void)mch_stat(".", &statBuf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2138 dir->mtime = statBuf.st_mtime;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2139
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2140 while ((dp = readdir(dirp)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2141 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2142 /* Ignore "." and ".." */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2143 if (strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2144 continue;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2145 if (i >= Alloc)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2146 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2147 Alloc = 2 * (Alloc + 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2148 result = (SFEntry *) XtRealloc((char *) result,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2149 (unsigned) (Alloc * sizeof(SFEntry)));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2150 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2151 result[i].statDone = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2152 str = dp->d_name;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2153 len = strlen(str);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2154 result[i].real = XtMalloc((unsigned) (len + 2));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2155 (void) strcat(strcpy(result[i].real, str), " ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2156 if (len > maxChars)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2157 maxChars = len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2158 result[i].shown = result[i].real;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2159 i++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2160 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2161
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2162 qsort((char *) result, (size_t) i, sizeof(SFEntry), SFcompareEntries);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2163
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2164 dir->entries = result;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2165 dir->nEntries = i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2166 dir->nChars = maxChars + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2167
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2168 closedir(dirp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2169
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2170 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2171 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2172
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2173 /***************** SFinternal.h */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2174
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2175 #include <sys/param.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2176 #include <X11/cursorfont.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2177 #include <X11/Composite.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2178 #include <X11/Shell.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2179 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2180 # include <X11/neXtaw/Form.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2181 # include <X11/neXtaw/Command.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2182 # include <X11/neXtaw/Label.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2183 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2184 #include <X11/Xaw/Form.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2185 #include <X11/Xaw/Command.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2186 #include <X11/Xaw/Label.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2187 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2188
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2189 static char *oneLineTextEditTranslations = "\
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2190 <Key>Return: redraw-display()\n\
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2191 Ctrl<Key>M: redraw-display()\n\
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2192 ";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2193
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2194 static void SFexposeList __ARGS((Widget w, XtPointer n, XEvent *event, Boolean *cont));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2195
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2196 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2197 SFexposeList(w, n, event, cont)
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
2198 Widget w UNUSED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2199 XtPointer n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2200 XEvent *event;
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
2201 Boolean *cont UNUSED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2202 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2203 if ((event->type == NoExpose) || event->xexpose.count)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2204 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2205
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2206 SFdrawList((int)(long)n, SF_DO_NOT_SCROLL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2207 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2208
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2209 static void SFmodVerifyCallback __ARGS((Widget w, XtPointer client_data, XEvent *event, Boolean *cont));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2210
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2211 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2212 SFmodVerifyCallback(w, client_data, event, cont)
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
2213 Widget w UNUSED;
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
2214 XtPointer client_data UNUSED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2215 XEvent *event;
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
2216 Boolean *cont UNUSED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2217 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2218 char buf[2];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2219
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2220 if ((XLookupString(&(event->xkey), buf, 2, NULL, NULL) == 1) &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2221 ((*buf) == '\r'))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2222 SFstatus = SEL_FILE_OK;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2223 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2224 SFstatus = SEL_FILE_TEXT;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2225 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2226
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2227 static void SFokCallback __ARGS((Widget w, XtPointer cl, XtPointer cd));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2228
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2229 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2230 SFokCallback(w, cl, cd)
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
2231 Widget w UNUSED;
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
2232 XtPointer cl UNUSED;
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
2233 XtPointer cd UNUSED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2234 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2235 SFstatus = SEL_FILE_OK;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2236 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2237
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2238 static XtCallbackRec SFokSelect[] =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2239 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2240 { SFokCallback, (XtPointer) NULL },
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2241 { NULL, (XtPointer) NULL },
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2242 };
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2243
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2244 static void SFcancelCallback __ARGS((Widget w, XtPointer cl, XtPointer cd));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2245
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2246 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2247 SFcancelCallback(w, cl, cd)
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
2248 Widget w UNUSED;
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
2249 XtPointer cl UNUSED;
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
2250 XtPointer cd UNUSED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2251 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2252 SFstatus = SEL_FILE_CANCEL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2253 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2254
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2255 static XtCallbackRec SFcancelSelect[] =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2256 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2257 { SFcancelCallback, (XtPointer) NULL },
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2258 { NULL, (XtPointer) NULL },
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2259 };
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2260
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2261 static void SFdismissAction __ARGS((Widget w, XEvent *event, String *params, Cardinal *num_params));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2262
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2263 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2264 SFdismissAction(w, event, params, num_params)
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
2265 Widget w UNUSED;
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
2266 XEvent *event;
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
2267 String *params UNUSED;
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
2268 Cardinal *num_params UNUSED;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2269 {
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
2270 if (event->type == ClientMessage
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
2271 && (Atom)event->xclient.data.l[0] != SFwmDeleteWindow)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2272 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2273
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2274 SFstatus = SEL_FILE_CANCEL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2275 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2276
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2277 static char *wmDeleteWindowTranslation = "\
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2278 <Message>WM_PROTOCOLS: SelFileDismiss()\n\
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2279 ";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2280
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2281 static XtActionsRec actions[] =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2282 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2283 {"SelFileDismiss", SFdismissAction},
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2284 };
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2285
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2286 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2287 SFsetColors(bg, fg, scroll_bg, scroll_fg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2288 guicolor_T bg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2289 guicolor_T fg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2290 guicolor_T scroll_bg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2291 guicolor_T scroll_fg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2292 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2293 if (selFileForm)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2294 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2295 XtVaSetValues(selFileForm, XtNbackground, bg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2296 XtNforeground, fg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2297 XtNborderColor, bg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2298 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2299 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2300 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2301 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2302
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2303 for (i = 0; i < 3; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2304 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2305 if (selFileLists[i])
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2306 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2307 XtVaSetValues(selFileLists[i], XtNbackground, bg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2308 XtNforeground, fg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2309 XtNborderColor, fg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2310 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2311 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2312 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2313 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2314 if (selFileOK)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2315 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2316 XtVaSetValues(selFileOK, XtNbackground, bg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2317 XtNforeground, fg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2318 XtNborderColor, fg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2319 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2320 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2321 if (selFileCancel)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2322 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2323 XtVaSetValues(selFileCancel, 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 if (selFilePrompt)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2329 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2330 XtVaSetValues(selFilePrompt, XtNbackground, bg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2331 XtNforeground, fg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2332 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2333 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2334 if (gui.dpy)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2335 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2336 XSetBackground(gui.dpy, SFtextGC, bg);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2337 XSetForeground(gui.dpy, SFtextGC, fg);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2338 XSetForeground(gui.dpy, SFlineGC, fg);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2339
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2340 /* This is an xor GC, so combine the fg and background */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2341 XSetBackground(gui.dpy, SFinvertGC, fg ^ bg);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2342 XSetForeground(gui.dpy, SFinvertGC, fg ^ bg);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2343 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2344 if (selFileHScroll)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2345 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2346 XtVaSetValues(selFileHScroll, XtNbackground, scroll_bg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2347 XtNforeground, scroll_fg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2348 XtNborderColor, fg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2349 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2350 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2351 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2352 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2353
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2354 for (i = 0; i < 3; i++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2355 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2356 XtVaSetValues(selFileVScrolls[i], XtNbackground, scroll_bg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2357 XtNforeground, scroll_fg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2358 XtNborderColor, fg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2359 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2360 XtVaSetValues(selFileHScrolls[i], XtNbackground, scroll_bg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2361 XtNforeground, scroll_fg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2362 XtNborderColor, fg,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2363 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2364 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2365 }
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 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2369 SFcreateWidgets(toplevel, prompt, ok, cancel)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2370 Widget toplevel;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2371 char *prompt;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2372 char *ok;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2373 char *cancel;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2374 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2375 Cardinal n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2376 int listWidth, listHeight;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2377 int listSpacing = 10;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2378 int scrollThickness = 15;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2379 int hScrollX, hScrollY;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2380 int vScrollX, vScrollY;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2381
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2382 selFile = XtVaAppCreateShell("selFile", "SelFile",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2383 transientShellWidgetClass, SFdisplay,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2384 XtNtransientFor, toplevel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2385 XtNtitle, prompt,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2386 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2387
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2388 /* Add WM_DELETE_WINDOW protocol */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2389 XtAppAddActions(XtWidgetToApplicationContext(selFile),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2390 actions, XtNumber(actions));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2391 XtOverrideTranslations(selFile,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2392 XtParseTranslationTable(wmDeleteWindowTranslation));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2393
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2394 selFileForm = XtVaCreateManagedWidget("selFileForm",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2395 formWidgetClass, selFile,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2396 XtNdefaultDistance, 30,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2397 XtNforeground, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2398 XtNbackground, SFback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2399 XtNborderColor, SFback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2400 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2401
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2402 selFilePrompt = XtVaCreateManagedWidget("selFilePrompt",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2403 labelWidgetClass, selFileForm,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2404 XtNlabel, prompt,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2405 XtNresizable, True,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2406 XtNtop, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2407 XtNbottom, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2408 XtNleft, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2409 XtNright, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2410 XtNborderWidth, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2411 XtNforeground, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2412 XtNbackground, SFback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2413 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2414
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2415 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2416 XtVaGetValues(selFilePrompt,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2417 XtNforeground, &SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2418 XtNbackground, &SFback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2419 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2420 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2421
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2422 SFinitFont();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2423
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2424 SFentryWidth = SFbesideText + SFcharsPerEntry * SFcharWidth +
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2425 SFbesideText;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2426 SFentryHeight = SFaboveAndBelowText + SFcharHeight +
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2427 SFaboveAndBelowText;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2428
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2429 listWidth = SFlineToTextH + SFentryWidth + SFlineToTextH + 1 +
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2430 scrollThickness;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2431 listHeight = SFlineToTextV + SFentryHeight + SFlineToTextV + 1 +
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2432 SFlineToTextV + SFlistSize * SFentryHeight +
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2433 SFlineToTextV + 1 + scrollThickness;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2434
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2435 SFpathScrollWidth = 3 * listWidth + 2 * listSpacing + 4;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2436
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2437 hScrollX = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2438 hScrollY = SFlineToTextV + SFentryHeight + SFlineToTextV + 1 +
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2439 SFlineToTextV + SFlistSize * SFentryHeight +
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2440 SFlineToTextV;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2441 SFhScrollWidth = SFlineToTextH + SFentryWidth + SFlineToTextH;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2442
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2443 vScrollX = SFlineToTextH + SFentryWidth + SFlineToTextH;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2444 vScrollY = SFlineToTextV + SFentryHeight + SFlineToTextV;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2445 SFvScrollHeight = SFlineToTextV + SFlistSize * SFentryHeight +
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2446 SFlineToTextV;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2447
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2448 SFupperX = SFlineToTextH + SFentryWidth + SFlineToTextH - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2449 SFlowerY = SFlineToTextV + SFentryHeight + SFlineToTextV + 1 +
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2450 SFlineToTextV;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2451 SFupperY = SFlineToTextV + SFentryHeight + SFlineToTextV + 1 +
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2452 SFlineToTextV + SFlistSize * SFentryHeight - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2453
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2454 SFtextX = SFlineToTextH + SFbesideText;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2455 SFtextYoffset = SFlowerY + SFaboveAndBelowText + SFcharAscent;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2457 SFsegs[0].x1 = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2458 SFsegs[0].y1 = vScrollY;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2459 SFsegs[0].x2 = vScrollX - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2460 SFsegs[0].y2 = vScrollY;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2461 SFsegs[1].x1 = vScrollX;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2462 SFsegs[1].y1 = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2463 SFsegs[1].x2 = vScrollX;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2464 SFsegs[1].y2 = vScrollY - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2465
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2466 SFcompletionSegs[0].x1 = SFcompletionSegs[0].x2 = SFlineToTextH;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2467 SFcompletionSegs[1].x1 = SFcompletionSegs[1].x2 =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2468 SFlineToTextH + SFentryWidth - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2469
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2470 selFileField = XtVaCreateManagedWidget("selFileField",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2471 asciiTextWidgetClass, selFileForm,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2472 XtNwidth, 3 * listWidth + 2 * listSpacing + 4,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2473 XtNborderColor, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2474 XtNfromVert, selFilePrompt,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2475 XtNvertDistance, 10,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2476 XtNresizable, True,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2477 XtNtop, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2478 XtNbottom, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2479 XtNleft, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2480 XtNright, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2481 XtNstring, SFtextBuffer,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2482 XtNlength, MAXPATHL,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2483 XtNeditType, XawtextEdit,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2484 XtNwrap, XawtextWrapWord,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2485 XtNresize, XawtextResizeHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2486 XtNuseStringInPlace, True,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2487 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2488
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2489 XtOverrideTranslations(selFileField,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2490 XtParseTranslationTable(oneLineTextEditTranslations));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2491 XtSetKeyboardFocus(selFileForm, selFileField);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2492
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2493 selFileHScroll = XtVaCreateManagedWidget("selFileHScroll",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2494 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2495 scrollbarWidgetClass, selFileForm,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2496 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2497 vim_scrollbarWidgetClass, selFileForm,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2498 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2499 XtNorientation, XtorientHorizontal,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2500 XtNwidth, SFpathScrollWidth,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2501 XtNheight, scrollThickness,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2502 XtNborderColor, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2503 XtNfromVert, selFileField,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2504 XtNvertDistance, 30,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2505 XtNtop, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2506 XtNbottom, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2507 XtNleft, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2508 XtNright, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2509 XtNforeground, gui.scroll_fg_pixel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2510 XtNbackground, gui.scroll_bg_pixel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2511 #ifndef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2512 XtNlimitThumb, 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2513 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2514 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2515
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2516 XtAddCallback(selFileHScroll, XtNjumpProc,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2517 (XtCallbackProc) SFpathSliderMovedCallback, (XtPointer)NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2518 XtAddCallback(selFileHScroll, XtNscrollProc,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2519 (XtCallbackProc) SFpathAreaSelectedCallback, (XtPointer)NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2520
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2521 selFileLists[0] = XtVaCreateManagedWidget("selFileList1",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2522 compositeWidgetClass, selFileForm,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2523 XtNwidth, listWidth,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2524 XtNheight, listHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2525 XtNforeground, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2526 XtNbackground, SFback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2527 XtNborderColor, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2528 XtNfromVert, selFileHScroll,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2529 XtNvertDistance, 10,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2530 XtNtop, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2531 XtNbottom, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2532 XtNleft, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2533 XtNright, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2534 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2535
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2536 selFileLists[1] = XtVaCreateManagedWidget("selFileList2",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2537 compositeWidgetClass, selFileForm,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2538 XtNwidth, listWidth,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2539 XtNheight, listHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2540 XtNforeground, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2541 XtNbackground, SFback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2542 XtNborderColor, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2543 XtNfromHoriz, selFileLists[0],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2544 XtNfromVert, selFileHScroll,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2545 XtNhorizDistance, listSpacing,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2546 XtNvertDistance, 10,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2547 XtNtop, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2548 XtNbottom, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2549 XtNleft, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2550 XtNright, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2551 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2552
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2553 selFileLists[2] = XtVaCreateManagedWidget("selFileList3",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2554 compositeWidgetClass, selFileForm,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2555 XtNwidth, listWidth,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2556 XtNheight, listHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2557 XtNforeground, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2558 XtNbackground, SFback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2559 XtNborderColor, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2560 XtNfromHoriz, selFileLists[1],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2561 XtNfromVert, selFileHScroll,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2562 XtNhorizDistance, listSpacing,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2563 XtNvertDistance, 10,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2564 XtNtop, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2565 XtNbottom, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2566 XtNleft, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2567 XtNright, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2568 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2569
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2570 for (n = 0; n < 3; n++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2571 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2572 selFileVScrolls[n] = XtVaCreateManagedWidget("selFileVScroll",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2573 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2574 scrollbarWidgetClass, selFileLists[n],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2575 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2576 vim_scrollbarWidgetClass, selFileLists[n],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2577 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2578 XtNx, vScrollX,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2579 XtNy, vScrollY,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2580 XtNwidth, scrollThickness,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2581 XtNheight, SFvScrollHeight,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2582 XtNborderColor, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2583 XtNforeground, gui.scroll_fg_pixel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2584 XtNbackground, gui.scroll_bg_pixel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2585 #ifndef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2586 XtNlimitThumb, 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2587 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2588 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2589
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2590 XtAddCallback(selFileVScrolls[n], XtNjumpProc,
2255
e5265e4d4725 Avoid compiler warnings.
Bram Moolenaar <bram@vim.org>
parents: 1887
diff changeset
2591 (XtCallbackProc)SFvFloatSliderMovedCallback,
e5265e4d4725 Avoid compiler warnings.
Bram Moolenaar <bram@vim.org>
parents: 1887
diff changeset
2592 (XtPointer)(long_u)n);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2593 XtAddCallback(selFileVScrolls[n], XtNscrollProc,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2594 (XtCallbackProc)SFvAreaSelectedCallback, (XtPointer)n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2595
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2596 selFileHScrolls[n] = XtVaCreateManagedWidget("selFileHScroll",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2597 #ifdef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2598 scrollbarWidgetClass, selFileLists[n],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2599 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2600 vim_scrollbarWidgetClass, selFileLists[n],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2601 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2602 XtNorientation, XtorientHorizontal,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2603 XtNx, hScrollX,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2604 XtNy, hScrollY,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2605 XtNwidth, SFhScrollWidth,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2606 XtNheight, scrollThickness,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2607 XtNborderColor, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2608 XtNforeground, gui.scroll_fg_pixel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2609 XtNbackground, gui.scroll_bg_pixel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2610 #ifndef FEAT_GUI_NEXTAW
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2611 XtNlimitThumb, 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2612 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2613 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2614
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2615 XtAddCallback(selFileHScrolls[n], XtNjumpProc,
2255
e5265e4d4725 Avoid compiler warnings.
Bram Moolenaar <bram@vim.org>
parents: 1887
diff changeset
2616 (XtCallbackProc)SFhSliderMovedCallback,
e5265e4d4725 Avoid compiler warnings.
Bram Moolenaar <bram@vim.org>
parents: 1887
diff changeset
2617 (XtPointer)(long_u)n);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2618 XtAddCallback(selFileHScrolls[n], XtNscrollProc,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2619 (XtCallbackProc)SFhAreaSelectedCallback, (XtPointer)n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2620 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2621
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2622 selFileOK = XtVaCreateManagedWidget("selFileOK",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2623 commandWidgetClass, selFileForm,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2624 XtNlabel, ok,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2625 XtNresizable, True,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2626 XtNcallback, SFokSelect,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2627 XtNforeground, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2628 XtNbackground, SFback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2629 XtNborderColor, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2630 XtNfromHoriz, selFileLists[0],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2631 XtNfromVert, selFileLists[0],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2632 XtNvertDistance, 30,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2633 XtNtop, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2634 XtNbottom, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2635 XtNleft, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2636 XtNright, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2637 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2638
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2639 selFileCancel = XtVaCreateManagedWidget("selFileCancel",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2640 commandWidgetClass, selFileForm,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2641 XtNlabel, cancel,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2642 XtNresizable, True,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2643 XtNcallback, SFcancelSelect,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2644 XtNforeground, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2645 XtNbackground, SFback,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2646 XtNborderColor, SFfore,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2647 XtNfromHoriz, selFileOK,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2648 XtNfromVert, selFileLists[0],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2649 XtNhorizDistance, 30,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2650 XtNvertDistance, 30,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2651 XtNtop, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2652 XtNbottom, XtChainTop,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2653 XtNleft, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2654 XtNright, XtChainLeft,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2655 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2656
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2657 XtSetMappedWhenManaged(selFile, False);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2658 XtRealizeWidget(selFile);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2659
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2660 /* Add WM_DELETE_WINDOW protocol */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2661 SFwmDeleteWindow = XInternAtom(SFdisplay, "WM_DELETE_WINDOW", False);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2662 XSetWMProtocols(SFdisplay, XtWindow(selFile), &SFwmDeleteWindow, 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2663
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2664 SFcreateGC();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2665
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2666 for (n = 0; n < 3; n++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2667 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2668 XtAddEventHandler(selFileLists[n], ExposureMask, True,
2255
e5265e4d4725 Avoid compiler warnings.
Bram Moolenaar <bram@vim.org>
parents: 1887
diff changeset
2669 (XtEventHandler)SFexposeList, (XtPointer)(long_u)n);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2670 XtAddEventHandler(selFileLists[n], EnterWindowMask, False,
2255
e5265e4d4725 Avoid compiler warnings.
Bram Moolenaar <bram@vim.org>
parents: 1887
diff changeset
2671 (XtEventHandler)SFenterList, (XtPointer)(long_u)n);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2672 XtAddEventHandler(selFileLists[n], LeaveWindowMask, False,
2255
e5265e4d4725 Avoid compiler warnings.
Bram Moolenaar <bram@vim.org>
parents: 1887
diff changeset
2673 (XtEventHandler)SFleaveList, (XtPointer)(long_u)n);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2674 XtAddEventHandler(selFileLists[n], PointerMotionMask, False,
2255
e5265e4d4725 Avoid compiler warnings.
Bram Moolenaar <bram@vim.org>
parents: 1887
diff changeset
2675 (XtEventHandler)SFmotionList, (XtPointer)(long_u)n);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2676 XtAddEventHandler(selFileLists[n], ButtonPressMask, False,
2255
e5265e4d4725 Avoid compiler warnings.
Bram Moolenaar <bram@vim.org>
parents: 1887
diff changeset
2677 (XtEventHandler)SFbuttonPressList, (XtPointer)(long_u)n);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2678 XtAddEventHandler(selFileLists[n], ButtonReleaseMask, False,
2255
e5265e4d4725 Avoid compiler warnings.
Bram Moolenaar <bram@vim.org>
parents: 1887
diff changeset
2679 (XtEventHandler)SFbuttonReleaseList, (XtPointer)(long_u)n);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2680 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2681
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2682 XtAddEventHandler(selFileField, KeyPressMask, False,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2683 SFmodVerifyCallback, (XtPointer)NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2684
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2685 SFapp = XtWidgetToApplicationContext(selFile);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2686 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2687
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2688 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2689 SFtextChanged()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2690 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2691 #if defined(FEAT_XFONTSET) && defined(XtNinternational)
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
2692 if ((unsigned long)_XawTextFormat((TextWidget)selFileField) == XawFmtWide)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2693 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2694 wchar_t *wcbuf=(wchar_t *)SFtextBuffer;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2695
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2696 if ((wcbuf[0] == L'/') || (wcbuf[0] == L'~'))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2697 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2698 (void) wcstombs(SFcurrentPath, wcbuf, MAXPATHL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2699 SFtextPos = XawTextGetInsertionPoint(selFileField);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2700 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2701 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2702 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2703 strcpy(SFcurrentPath, SFstartDir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2704 (void) wcstombs(SFcurrentPath + strlen(SFcurrentPath), wcbuf, MAXPATHL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2705
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2706 SFtextPos = XawTextGetInsertionPoint(selFileField) + strlen(SFstartDir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2707 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2708 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2709 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2710 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2711 if ((SFtextBuffer[0] == '/') || (SFtextBuffer[0] == '~'))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2712 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2713 (void) strcpy(SFcurrentPath, SFtextBuffer);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2714 SFtextPos = XawTextGetInsertionPoint(selFileField);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2715 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2716 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2717 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2718 (void) strcat(strcpy(SFcurrentPath, SFstartDir), SFtextBuffer);
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 if (!SFworkProcAdded)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2724 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2725 (void) XtAppAddWorkProc(SFapp, (XtWorkProc)SFworkProc, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2726 SFworkProcAdded = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2727 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2729 SFupdatePath();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2730 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2731
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2732 static char *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2733 SFgetText()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2734 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2735 #if defined(FEAT_XFONTSET) && defined(XtNinternational)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2736 char *buf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2737
1887
fc89a4f98a8b updated for version 7.2-184
vimboss
parents: 889
diff changeset
2738 if ((unsigned long)_XawTextFormat((TextWidget)selFileField) == XawFmtWide)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2739 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2740 wchar_t *wcbuf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2741 int mbslength;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2742
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2743 XtVaGetValues(selFileField,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2744 XtNstring, &wcbuf,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2745 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2746 mbslength = wcstombs(NULL, wcbuf, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2747 /* Hack: some broken wcstombs() returns zero, just get a large buffer */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2748 if (mbslength == 0 && wcbuf != NULL && wcbuf[0] != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2749 mbslength = MAXPATHL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2750 buf=(char *)XtMalloc(mbslength + 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2751 wcstombs(buf, wcbuf, mbslength +1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2752 return buf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2753 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2754 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2755 return (char *)vim_strsave((char_u *)SFtextBuffer);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2756 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2757
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2758 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2759 SFprepareToReturn()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2760 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2761 SFstatus = SEL_FILE_NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2762 XtRemoveGrab(selFile);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2763 XtUnmapWidget(selFile);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2764 XtRemoveTimeOut(SFdirModTimerId);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2765 if (SFchdir(SFstartDir))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2766 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2767 EMSG(_("E614: vim_SelFile: can't return to current directory"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2768 SFstatus = SEL_FILE_CANCEL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2769 }
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 char *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2773 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
2774 Widget toplevel;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2775 char *prompt;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2776 char *init_path;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2777 int (*show_entry)();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2778 int x, y;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2779 guicolor_T fg, bg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2780 guicolor_T scroll_fg, scroll_bg; /* The "Scrollbar" group colors */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2781 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2782 static int firstTime = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2783 XEvent event;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2784 char *name_return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2785
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2786 if (prompt == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2787 prompt = _("Pathname:");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2788 SFfore = fg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2789 SFback = bg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2790
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2791 if (mch_dirname((char_u *)SFstartDir, MAXPATHL) == FAIL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2792 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2793 EMSG(_("E615: vim_SelFile: can't get current directory"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2794 return NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2795 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2796
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2797 if (firstTime)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2798 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2799 firstTime = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2800 SFdisplay = XtDisplay(toplevel);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2801 SFcreateWidgets(toplevel, prompt, _("OK"), _("Cancel"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2802 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2803 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2804 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2805 XtVaSetValues(selFilePrompt, XtNlabel, prompt, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2806 XtVaSetValues(selFile, XtNtitle, prompt, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2807 SFsetColors(bg, fg, scroll_bg, scroll_fg);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2808 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2809
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2810 XtVaSetValues(selFile, XtNx, x, XtNy, y, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2811 XtMapWidget(selFile);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2812
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2813 (void)strcat(SFstartDir, "/");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2814 (void)strcpy(SFcurrentDir, SFstartDir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2815
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2816 if (init_path)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2817 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2818 if (init_path[0] == '/')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2819 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2820 (void)strcpy(SFcurrentPath, init_path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2821 if (strncmp(SFcurrentPath, SFstartDir, strlen(SFstartDir)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2822 SFsetText(SFcurrentPath);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2823 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2824 SFsetText(&(SFcurrentPath[strlen(SFstartDir)]));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2825 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2826 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2827 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2828 (void)strcat(strcpy(SFcurrentPath, SFstartDir), init_path);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2829 SFsetText(&(SFcurrentPath[strlen(SFstartDir)]));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2830 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2831 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2832 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2833 (void)strcpy(SFcurrentPath, SFstartDir);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2834
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2835 SFfunc = show_entry;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2836
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2837 SFtextChanged();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2838
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2839 XtAddGrab(selFile, True, True);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2840
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2841 SFdirModTimerId = XtAppAddTimeOut(SFapp, (unsigned long) 1000,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2842 SFdirModTimer, (XtPointer) NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2843
406
aa550d9d2403 updated for version 7.0106
vimboss
parents: 7
diff changeset
2844 for (;;)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2845 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2846 XtAppNextEvent(SFapp, &event);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2847 XtDispatchEvent(&event);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2848 switch (SFstatus)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2849 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2850 case SEL_FILE_TEXT:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2851 SFstatus = SEL_FILE_NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2852 SFtextChanged();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2853 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2854 case SEL_FILE_OK:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2855 name_return = SFgetText();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2856 SFprepareToReturn();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2857 return name_return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2858 case SEL_FILE_CANCEL:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2859 SFprepareToReturn();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2860 return NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2861 case SEL_FILE_NULL:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2862 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2863 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2864 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2865 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2866 #endif /* FEAT_BROWSE */