annotate src/gui_at_fs.c @ 26509:f08a4040f26d

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