annotate src/gui_at_fs.c @ 11343:049857c9b1c4 v8.0.0557

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