annotate src/gui_at_fs.c @ 17779:87a8760babec v8.1.1886

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