annotate src/integration.c @ 15089:e428882d6ffb v8.1.0555

patch 8.1.0555: crash when last search pat is set but not last substitute pat commit https://github.com/vim/vim/commit/2fb8f684d888ad68b283ba8f9505106b5fb725be Author: Bram Moolenaar <Bram@vim.org> Date: Sat Dec 1 13:14:45 2018 +0100 patch 8.1.0555: crash when last search pat is set but not last substitute pat Problem: Crash when last search pat is set but not last substitute pat. Solution: Do not mix up last search pattern and last subtitute pattern. (closes #3647)
author Bram Moolenaar <Bram@vim.org>
date Sat, 01 Dec 2018 13:15:04 +0100
parents 27b9a84395b5
children 0fcc1315c061
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: 8247
diff changeset
1 /* vi:set ts=8 sw=8 noet:
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 * VIM - Vi IMproved by Bram Moolenaar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 * Visual Workshop integration by Gordon Prieur
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 * Do ":help uganda" in Vim to read copying and usage conditions.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 * Do ":help credits" in Vim to see a list of people who contributed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 * See README.txt for an overview of the Vim source code.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 * Integration with Sun Workshop.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 * This file should not change much, it's also used by other editors that
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 * connect to Workshop. Consider changing workshop.c instead.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 -> consider using MakeSelectionVisible instead of gotoLine hacks
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 to show the line properly
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 -> consider using glue instead of our own message wrapping functions
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 (but can only use glue if we don't have to distribute source)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 #include "vim.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 #include <stdio.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 #include <stdlib.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 #ifdef INET_SOCKETS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 #include <netdb.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 #include <netinet/in.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 #include <sys/un.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 #include <sys/types.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 #include <sys/socket.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 #include <sys/param.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 #ifdef HAVE_LIBGEN_H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 # include <libgen.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 #include <unistd.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 #include <string.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 #include <X11/Intrinsic.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 #include <Xm/Xm.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 #include <Xm/AtomMgr.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 #include <Xm/PushB.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 #ifdef HAVE_X11_XPM_H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 # include <X11/xpm.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 # ifdef HAVE_XM_XPMP_H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 # include <Xm/XpmP.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 #ifdef HAVE_UTIL_DEBUG_H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 # include <util/debug.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 #ifdef HAVE_UTIL_MSGI18N_H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 # include <util/msgi18n.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 #include "integration.h" /* <EditPlugin/integration.h> */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 #ifdef HAVE_FRAME_H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 # include <frame.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 #ifndef MAX
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 # define MAX(a, b) (a) > (b) ? (a) : (b)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 #ifndef NOCATGETS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 # define NOCATGETS(x) x
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 /* Functions private to this file */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 static void workshop_disconnect(void);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 static void workshop_sensitivity(int num, char *table);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 static void adjust_sign_name(char *filename);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 static void process_menuItem(char *);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 static void process_toolbarButton(char *);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 static void workshop_set_option_first(char *name, char *value);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2245
diff changeset
86 static size_t dummy; /* to ignore return value of write() */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 #define CMDBUFSIZ 2048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 #ifdef DEBUG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 static FILE *dfd;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 static void pldebug(char *, ...);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 static void unrecognised_message(char *);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 #define HANDLE_ERRORS(cmd) else unrecognised_message(cmd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 #define HANDLE_ERRORS(cmd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 * Version number of the protocol between an editor and eserve.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 * This number should be incremented when the protocol
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 * is changed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 #define PROTOCOL_VERSION "4.0.0"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 static int sd = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 static XtInputId inputHandler; /* Cookie for input */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 Boolean save_files = True; /* When true, save all files before build actions */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111
14862
27b9a84395b5 patch 8.1.0443: unnecessary static function prototypes
Christian Brabandt <cb@256bit.org>
parents: 12871
diff changeset
112 static void
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 workshop_connection_closed(void)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 * socket closed on other end
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 XtRemoveInput(inputHandler);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 inputHandler = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 sd = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 static char *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 getCommand(void)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 int len; /* length of this command */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 char lenbuf[7]; /* get the length string here */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 char *newcb; /* used to realloc cmdbuf */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 static char *cmdbuf;/* get the command string here */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 static int cbsize;/* size of cmdbuf */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 if ((len = read(sd, &lenbuf, 6)) == 6) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 lenbuf[6] = 0; /* Terminate buffer such that atoi() works right */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 len = atoi(lenbuf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 if (cbsize < (len + 1)) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
136 newcb = (char *) realloc(cmdbuf,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 MAX((len + 256), CMDBUFSIZ));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 if (newcb != NULL) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 cmdbuf = newcb;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 cbsize = MAX((len + 256), CMDBUFSIZ);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 if (cbsize >= len && (len = read(sd, cmdbuf, len)) > 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 cmdbuf[len] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 return cmdbuf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 } else {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 return NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 } else {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 if (len == 0) { /* EOF */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 workshop_connection_closed();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 return NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157
14862
27b9a84395b5 patch 8.1.0443: unnecessary static function prototypes
Christian Brabandt <cb@256bit.org>
parents: 12871
diff changeset
158 static void
2031
07de57cbcb25 updated for version 7.2.327
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
159 messageFromEserve(XtPointer clientData UNUSED,
07de57cbcb25 updated for version 7.2.327
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
160 int *dum1 UNUSED,
07de57cbcb25 updated for version 7.2.327
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
161 XtInputId *dum2 UNUSED)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 char *cmd; /* the 1st word of the command */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 cmd = getCommand();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 if (cmd == NULL) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 /* We're being shut down by eserve and the "quit" message
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168 * didn't arrive before the socket connection got closed */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 #ifdef DEBUG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172 pldebug("%s\n", cmd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 switch (*cmd) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175 case 'a':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176 if (cmd[1] == 'c' &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 strncmp(cmd, NOCATGETS("ack "), 4) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 int ackNum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 char buf[20];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 ackNum = atoi(&cmd[4]);
272
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
182 vim_snprintf(buf, sizeof(buf),
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
183 NOCATGETS("ack %d\n"), ackNum);
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2245
diff changeset
184 dummy = write(sd, buf, strlen(buf));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 } else if (strncmp(cmd,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 NOCATGETS("addMarkType "), 12) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 int idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 char *color;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 char *sign;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 idx = atoi(strtok(&cmd[12], " "));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 color = strtok(NULL, NOCATGETS("\001"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 sign = strtok(NULL, NOCATGETS("\001"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 /* Skip space that separates names */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 if (color) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 color++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 if (sign) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 sign++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 }
2031
07de57cbcb25 updated for version 7.2.327
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
201 /* Change sign name to accommodate a different size? */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 adjust_sign_name(sign);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 workshop_add_mark_type(idx, color, sign);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 HANDLE_ERRORS(cmd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208 case 'b':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 if (strncmp(cmd,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 NOCATGETS("balloon "), 8) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 char *tip;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 tip = strtok(&cmd[8], NOCATGETS("\001"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 workshop_show_balloon_tip(tip);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 HANDLE_ERRORS(cmd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
217 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
218
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
219 case 'c':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
220 if (strncmp(cmd,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
221 NOCATGETS("changeMarkType "), 15) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
222 char *file;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
223 int markId;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224 int type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226 file = strtok(&cmd[15], " ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 markId = atoi(strtok(NULL, " "));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228 type = atoi(strtok(NULL, " "));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229 workshop_change_mark_type(file, markId, type);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 HANDLE_ERRORS(cmd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 case 'd':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235 if (strncmp(cmd, NOCATGETS("deleteMark "), 11) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 char *file;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 int markId;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 file = strtok(&cmd[11], " ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240 markId = atoi(strtok(NULL, " "));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 workshop_delete_mark(file, markId);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 HANDLE_ERRORS(cmd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246 case 'f':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247 if (cmd[1] == 'o' &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248 strncmp(cmd, NOCATGETS("footerMsg "), 10) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 int severity;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 char *message;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252 severity =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 atoi(strtok(&cmd[10], " "));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254 message = strtok(NULL, NOCATGETS("\001"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 workshop_footer_message(message, severity);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 } else if (strncmp(cmd,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 NOCATGETS("frontFile "), 10) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 char *file;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261 file = strtok(&cmd[10], " ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262 workshop_front_file(file);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264 HANDLE_ERRORS(cmd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267 case 'g':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268 if (cmd[1] == 'e' &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269 strncmp(cmd, NOCATGETS("getMarkLine "), 12) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270 char *file;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271 int markid;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272 int line;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273 char buf[100];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275 file = strtok(&cmd[12], " ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276 markid = atoi(strtok(NULL, " "));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277 line = workshop_get_mark_lineno(file, markid);
272
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
278 vim_snprintf(buf, sizeof(buf),
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
279 NOCATGETS("markLine %s %d %d\n"),
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280 file, markid, line);
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2245
diff changeset
281 dummy = write(sd, buf, strlen(buf));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282 } else if (cmd[1] == 'o' && cmd[4] == 'L' &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283 strncmp(cmd, NOCATGETS("gotoLine "), 9) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284 char *file;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285 int lineno;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 file = strtok(&cmd[9], " ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288 lineno = atoi(strtok(NULL, " "));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289 workshop_goto_line(file, lineno);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 } else if (strncmp(cmd,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291 NOCATGETS("gotoMark "), 9) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292 char *file;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
293 int markId;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294 char *message;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296 file = strtok(&cmd[9], " ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297 markId = atoi(strtok(NULL, " "));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298 message = strtok(NULL, NOCATGETS("\001"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299 workshop_goto_mark(file, markId, message);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
300 #ifdef NOHANDS_SUPPORT_FUNCTIONS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
301 } else if (strcmp(cmd, NOCATGETS("getCurrentFile")) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
302 char *f = workshop_test_getcurrentfile();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303 char buffer[2*MAXPATHLEN];
272
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
304 vim_snprintf(buffer, sizeof(buffer),
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
305 NOCATGETS("currentFile %d %s"),
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
306 f ? strlen(f) : 0, f ? f : "");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
307 workshop_send_message(buffer);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
308 } else if (strcmp(cmd, NOCATGETS("getCursorRow")) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
309 int row = workshop_test_getcursorrow();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
310 char buffer[2*MAXPATHLEN];
272
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
311 vim_snprintf(buffer, sizeof(buffer),
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
312 NOCATGETS("cursorRow %d"), row);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
313 workshop_send_message(buffer);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
314 } else if (strcmp(cmd, NOCATGETS("getCursorCol")) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
315 int col = workshop_test_getcursorcol();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
316 char buffer[2*MAXPATHLEN];
272
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
317 vim_snprintf(buffer, sizeof(buffer),
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
318 NOCATGETS("cursorCol %d"), col);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
319 workshop_send_message(buffer);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
320 } else if (strcmp(cmd, NOCATGETS("getCursorRowText")) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
321 char *t = workshop_test_getcursorrowtext();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322 char buffer[2*MAXPATHLEN];
272
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
323 vim_snprintf(buffer, sizeof(buffer),
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
324 NOCATGETS("cursorRowText %d %s"),
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325 t ? strlen(t) : 0, t ? t : "");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
326 workshop_send_message(buffer);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
327 } else if (strcmp(cmd, NOCATGETS("getSelectedText")) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
328 char *t = workshop_test_getselectedtext();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
329 char buffer[2*MAXPATHLEN];
272
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
330 vim_snprintf(buffer, sizeof(buffer),
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
331 NOCATGETS("selectedText %d %s"),
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
332 t ? strlen(t) : 0, t ? t : "");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
333 workshop_send_message(buffer);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
334 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
335 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
336 HANDLE_ERRORS(cmd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
337 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
338
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
339 case 'l':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
340 if (strncmp(cmd, NOCATGETS("loadFile "), 9) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
341 char *file;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
342 int line;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
343 char *frameid;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
344
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
345 file = strtok(&cmd[9], " ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
346 line = atoi(strtok(NULL, " "));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
347 frameid = strtok(NULL, " ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
348 workshop_load_file(file, line, frameid);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
349 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
350 HANDLE_ERRORS(cmd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
351 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
352
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
353 case 'm': /* Menu, minimize, maximize */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
354 if (cmd[1] == 'e' && cmd[4] == 'B' &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
355 strncmp(cmd, NOCATGETS("menuBegin "), 10) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
356 workshop_menu_begin(&cmd[10]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
357 } else if (cmd[1] == 'e' && cmd[4] == 'I' &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
358 strncmp(cmd, NOCATGETS("menuItem "), 9) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
359 process_menuItem(cmd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
360 } else if (cmd[1] == 'e' && cmd[4] == 'E' &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
361 strcmp(cmd, NOCATGETS("menuEnd")) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
362 workshop_menu_end();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
363 } else if (cmd[1] == 'a' &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
364 strcmp(cmd, NOCATGETS("maximize")) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
365 workshop_maximize();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
366 } else if (strcmp(cmd, NOCATGETS("minimize")) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
367 workshop_minimize();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
368 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
369 HANDLE_ERRORS(cmd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
370 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
371
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
372 case 'o':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
373 if (cmd[1] == 'p' &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
374 strcmp(cmd, NOCATGETS("option"))) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
375 char *name;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
376 char *value;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
377
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
378 name = strtok(&cmd[7], " ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
379 value = strtok(NULL, " ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
380 workshop_set_option_first(name, value);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
381 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
382 HANDLE_ERRORS(cmd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
383 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
384
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
385 case 'p':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
386 if (strcmp(cmd, NOCATGETS("ping")) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
387 #if 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
388 int pingNum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
389
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
390 pingNum = atoi(&cmd[5]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
391 workshop_send_ack(ackNum);
2520
6768ebd0bc04 Remove unused code.
Bram Moolenaar <bram@vim.org>
parents: 2250
diff changeset
392 /* WHAT DO I DO HERE? */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
393 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
394 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
395 HANDLE_ERRORS(cmd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
396 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
397
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
398 case 'q':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
399 if (strncmp(cmd, NOCATGETS("quit"), 4) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
400
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
401 /* Close the connection. It's important to do
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
402 * that now, since workshop_quit might be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
403 * looking at open files. For example, if you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
404 * have modified one of the files without
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
405 * saving, NEdit will ask you what you want to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
406 * do, and spin loop by calling
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
407 * XtAppProcessEvent while waiting for your
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
408 * reply. In this case, if we still have an
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
409 * input handler and the socket has been
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
410 * closed on the other side when eserve
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
411 * expired, we will hang in IoWait.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
412 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
413 workshop_disconnect();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
414
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
415 workshop_quit();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
416 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
417 HANDLE_ERRORS(cmd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
418 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
419
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
420 case 'r':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
421 if (cmd[1] == 'e' &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
422 strncmp(cmd, NOCATGETS("reloadFile "), 11) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
423 char *file;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
424 int line;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
425
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
426 file = strtok(&cmd[11], " ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
427 line = atoi(strtok(NULL, " "));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
428 workshop_reload_file(file, line);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
429 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
430 HANDLE_ERRORS(cmd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
431 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
433 case 's':
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
434 if (cmd[1] == 'e' && cmd[2] == 't' &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
435 strncmp(cmd, NOCATGETS("setMark "), 8) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
436 char *file;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
437 int line;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
438 int markId;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
439 int type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
440
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
441 file = strtok(&cmd[8], " ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
442 line = atoi(strtok(NULL, " "));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
443 markId = atoi(strtok(NULL, " "));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
444 type = atoi(strtok(NULL, " "));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
445 workshop_set_mark(file, line, markId, type);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
446 } else if (cmd[1] == 'h' &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
447 strncmp(cmd, NOCATGETS("showFile "), 9) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
448 workshop_show_file(&cmd[9]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
449 } else if (cmd[1] == 'u' &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
450 strncmp(cmd, NOCATGETS("subMenu "), 8) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
451 char *label;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
452
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
453 label = strtok(&cmd[8], NOCATGETS("\001"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
454 workshop_submenu_begin(label);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
455 } else if (cmd[1] == 'u' &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
456 strcmp(cmd, NOCATGETS("subMenuEnd")) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
457 workshop_submenu_end();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
458 } else if (cmd[1] == 'e' && cmd[2] == 'n' &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
459 strncmp(cmd, NOCATGETS("sensitivity "), 12) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
460 int num;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
461 char *bracket;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
462 char *table;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
463
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
464 num = atoi(strtok(&cmd[12], " "));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
465 bracket = strtok(NULL, " ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
466 if (*bracket != '[') {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
467 fprintf(stderr, NOCATGETS("Parsing "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
468 "error for sensitivity\n"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
469 } else {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
470 table = strtok(NULL, NOCATGETS("]"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
471 workshop_sensitivity(num, table);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
472 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
473 } else if (cmd[1] == 'e' && cmd[2] == 'n' && cmd[3] == 'd' &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
474 strncmp(cmd, NOCATGETS("sendVerb "), 9) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
475 /* Send the given verb back (used for the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
476 * debug.lineno callback (such that other tools
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
477 * can obtain the position coordinates or the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
478 * selection) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
479 char *verb;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
480
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
481 verb = strtok(&cmd[9], " ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
482 workshop_perform_verb(verb, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
483 } else if (cmd[1] == 'a' &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
484 strncmp(cmd, NOCATGETS("saveFile "), 9) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
485 workshop_save_file(&cmd[9]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
486 #ifdef NOHANDS_SUPPORT_FUNCTIONS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
487 } else if (strncmp(cmd, NOCATGETS("saveSensitivity "), 16) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
488 char *file;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
489
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
490 file = strtok(&cmd[16], " ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
491 workshop_save_sensitivity(file);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
492 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
493 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
494 HANDLE_ERRORS(cmd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
495 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
496
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
497 case 't': /* Toolbar */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
498 if (cmd[8] == 'e' &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
499 strncmp(cmd, NOCATGETS("toolbarBegin"), 12) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
500 workshop_toolbar_begin();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
501 } else if (cmd[8] == 'u' &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
502 strncmp(cmd, NOCATGETS("toolbarButton"), 13) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
503 process_toolbarButton(cmd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
504 } else if (cmd[7] == 'E' &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
505 strcmp(cmd, NOCATGETS("toolbarEnd")) == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
506 workshop_toolbar_end();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
507 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
508 HANDLE_ERRORS(cmd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
509 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
510
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
511 #ifdef DEBUG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
512 default:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
513 unrecognised_message(cmd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
514 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
515 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
516 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
517 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
518
14862
27b9a84395b5 patch 8.1.0443: unnecessary static function prototypes
Christian Brabandt <cb@256bit.org>
parents: 12871
diff changeset
519 static void
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
520 process_menuItem(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
521 char *cmd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
522 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
523 char *label = strtok(&cmd[9], NOCATGETS("\001"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
524 char *verb = strtok(NULL, NOCATGETS("\001"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
525 char *acc = strtok(NULL, NOCATGETS("\001"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
526 char *accText = strtok(NULL, NOCATGETS("\001"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
527 char *name = strtok(NULL, NOCATGETS("\001"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
528 char *sense = strtok(NULL, NOCATGETS("\n"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
529 char *filepos = strtok(NULL, NOCATGETS("\n"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
530 if (*acc == '-') {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
531 acc = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
532 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
533 if (*accText == '-') {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
534 accText = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
535 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
536 workshop_menu_item(label, verb, acc, accText, name, filepos, sense);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
537
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
538 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
539
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
540
14862
27b9a84395b5 patch 8.1.0443: unnecessary static function prototypes
Christian Brabandt <cb@256bit.org>
parents: 12871
diff changeset
541 static void
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
542 process_toolbarButton(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
543 char *cmd) /* button definition */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
544 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
545 char *label = strtok(&cmd[14], NOCATGETS("\001"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
546 char *verb = strtok(NULL, NOCATGETS("\001"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
547 char *senseVerb = strtok(NULL, NOCATGETS("\001"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
548 char *filepos = strtok(NULL, NOCATGETS("\001"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
549 char *help = strtok(NULL, NOCATGETS("\001"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
550 char *sense = strtok(NULL, NOCATGETS("\001"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
551 char *file = strtok(NULL, NOCATGETS("\001"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
552 char *left = strtok(NULL, NOCATGETS("\n"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
553
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
554 if (!strcmp(label, NOCATGETS("-"))) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
555 label = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
556 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
557 if (!strcmp(help, NOCATGETS("-"))) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
558 help = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
559 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
560 if (!strcmp(file, NOCATGETS("-"))) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
561 file = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
562 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
563 if (!strcmp(senseVerb, NOCATGETS("-"))) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
564 senseVerb = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
565 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
566 workshop_toolbar_button(label, verb, senseVerb, filepos, help,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
567 sense, file, left);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
568 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
569
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
570
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
571 #ifdef DEBUG
14862
27b9a84395b5 patch 8.1.0443: unnecessary static function prototypes
Christian Brabandt <cb@256bit.org>
parents: 12871
diff changeset
572 static void
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
573 unrecognised_message(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
574 char *cmd)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
575 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
576 pldebug("Unrecognised eserve message:\n\t%s\n", cmd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
577 /* abort(); */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
578 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
579 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
580
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
581
2031
07de57cbcb25 updated for version 7.2.327
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
582 /* Change sign name to accommodate a different size:
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
583 * Create the filename based on the height. The filename format
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
584 * of multisize icons are:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
585 * x.xpm : largest icon
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
586 * x1.xpm : smaller icon
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
587 * x2.xpm : smallest icon */
14862
27b9a84395b5 patch 8.1.0443: unnecessary static function prototypes
Christian Brabandt <cb@256bit.org>
parents: 12871
diff changeset
588 static void
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
589 adjust_sign_name(char *filename)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
590 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
591 char *s;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
592 static int fontSize = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
593
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
594 if (fontSize == -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
595 fontSize = workshop_get_font_height();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
596 if (fontSize == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
597 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
598 if (filename[0] == '-')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
599 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
600
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
601 /* This is ugly: later we should instead pass the fontheight over
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
602 * to eserve on startup and let eserve just send the right filenames
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
603 * to us in the first place
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
604
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
605 * I know that the filename will end with 1.xpm (see
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
606 * GuiEditor.cc`LispPrintSign if you wonder why) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
607 s = filename+strlen(filename)-5;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
608 if (fontSize <= 11)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
609 strcpy(s, "2.xpm");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
610 else if (fontSize <= 15)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
611 strcpy(s, "1.xpm");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
612 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
613 strcpy(s, ".xpm");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
614 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
615
2031
07de57cbcb25 updated for version 7.2.327
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
616 #if 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
617 /* Were we invoked by WorkShop? This function can be used early during startup
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
618 if you want to do things differently if the editor is started standalone
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
619 or in WorkShop mode. For example, in standalone mode you may not want to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
620 add a footer/message area or a sign gutter. */
7823
bcef391c101c commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents: 2668
diff changeset
621 int
bcef391c101c commit https://github.com/vim/vim/commit/68c2f638e65d914dc6e84eb7ce2624f08af525c0
Christian Brabandt <cb@256bit.org>
parents: 2668
diff changeset
622 workshop_invoked(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
623 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
624 static int result = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
625 if (result == -1) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
626 result = (getenv(NOCATGETS("SPRO_EDITOR_SOCKET")) != NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
627 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
628 return result;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
629 }
2031
07de57cbcb25 updated for version 7.2.327
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
630 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
631
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
632 /* Connect back to eserve */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
633 void workshop_connect(XtAppContext context)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
634 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
635 #ifdef INET_SOCKETS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
636 struct sockaddr_in server;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
637 struct hostent * host;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
638 int port;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
639 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
640 struct sockaddr_un server;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
641 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
642 char buf[32];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
643 char * address;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
644 #ifdef DEBUG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
645 char *file;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
646 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
647
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
648 address = getenv(NOCATGETS("SPRO_EDITOR_SOCKET"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
649 if (address == NULL) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
650 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
651 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
652
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
653 #ifdef INET_SOCKETS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
654 port = atoi(address);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
655
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
656 if ((sd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
657 PERROR(NOCATGETS("workshop_connect"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
658 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
659 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
660
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
661 /* Get the server internet address and put into addr structure */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
662 /* fill in the socket address structure and connect to server */
2215
cccb71c2c5c1 Fix uninit memory read in undo code. Fix uint32_t in proto file.
Bram Moolenaar <bram@vim.org>
parents: 2031
diff changeset
663 vim_memset((char *)&server, '\0', sizeof(server));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
664 server.sin_family = AF_INET;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
665 server.sin_port = port;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
666 if ((host = gethostbyname(NOCATGETS("localhost"))) == NULL) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
667 PERROR(NOCATGETS("gethostbyname"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
668 sd = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
669 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
670 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
671 memcpy((char *)&server.sin_addr, host->h_addr, host->h_length);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
672 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
673 if ((sd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
674 PERROR(NOCATGETS("workshop_connect"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
675 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
676 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
677
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
678 server.sun_family = AF_UNIX;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
679 strcpy(server.sun_path, address);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
680 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
681 /* Connect to server */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
682 if (connect(sd, (struct sockaddr *)&server, sizeof(server))) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
683 if (errno == ECONNREFUSED) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
684 close(sd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
685 #ifdef INET_SOCKETS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
686 if ((sd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
687 PERROR(NOCATGETS("workshop_connect"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
688 return;
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 if ((sd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
692 PERROR(NOCATGETS("workshop_connect"));
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 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
696 if (connect(sd, (struct sockaddr *)&server,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
697 sizeof(server))) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
698 PERROR(NOCATGETS("workshop_connect"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
699 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
700 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
701
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
702 } else {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
703 PERROR(NOCATGETS("workshop_connect"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
704 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
705 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
706 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
707
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
708 /* tell notifier we are interested in being called
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
709 * when there is input on the editor connection socket
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
710 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
711 inputHandler = XtAppAddInput(context, sd, (XtPointer) XtInputReadMask,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
712 messageFromEserve, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
713 #ifdef DEBUG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
714 if ((file = getenv(NOCATGETS("SPRO_PLUGIN_DEBUG"))) != NULL) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
715 char buf[BUFSIZ];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
716
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
717 unlink(file);
272
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
718 vim_snprintf(buf, sizeof(buf), "date > %s", file);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
719 system(buf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
720 dfd = fopen(file, "a");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
721 } else {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
722 dfd = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
723 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
724 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
725
272
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
726 vim_snprintf(buf, sizeof(buf), NOCATGETS("connected %s %s %s\n"),
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
727 workshop_get_editor_name(),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
728 PROTOCOL_VERSION,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
729 workshop_get_editor_version());
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2245
diff changeset
730 dummy = write(sd, buf, strlen(buf));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
731
272
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
732 vim_snprintf(buf, sizeof(buf), NOCATGETS("ack 1\n"));
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2245
diff changeset
733 dummy = write(sd, buf, strlen(buf));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
734 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
735
14862
27b9a84395b5 patch 8.1.0443: unnecessary static function prototypes
Christian Brabandt <cb@256bit.org>
parents: 12871
diff changeset
736 static void
27b9a84395b5 patch 8.1.0443: unnecessary static function prototypes
Christian Brabandt <cb@256bit.org>
parents: 12871
diff changeset
737 workshop_disconnect(void)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
738 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
739 /* Probably need to send some message here */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
740
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
741 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
742 * socket closed on other end
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
743 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
744 XtRemoveInput(inputHandler);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
745 close(sd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
746 inputHandler = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
747 sd = -1;
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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
751 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
752 * Utility functions
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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
756 /* Minimize and maximize shells. From libutil's shell.cc. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
757
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
758 /* utility functions from libutil's shell.cc */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
759 static Boolean
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
760 isWindowMapped(Display *display, Window win)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
761 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
762 XWindowAttributes winAttrs;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
763 XGetWindowAttributes(display,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
764 win,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
765 &winAttrs);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
766 if (winAttrs.map_state == IsViewable) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
767 return(True);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
768 } else {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
769 return(False);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
770 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
771 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
772
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
773 static Boolean
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
774 isMapped(Widget widget)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
775 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
776 if (widget == NULL) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
777 return(False);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
778 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
779
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
780 if (XtIsRealized(widget) == False) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
781 return(False);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
782 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
783
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
784 return(isWindowMapped(XtDisplay(widget), XtWindow(widget)));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
785 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
786
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
787 static Boolean
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
788 widgetIsIconified(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
789 Widget w)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
790 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
791 Atom wm_state;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
792 Atom act_type; /* actual Atom type returned */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
793 int act_fmt; /* actual format returned */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
794 u_long nitems_ret; /* number of items returned */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
795 u_long bytes_after; /* number of bytes remaining */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
796 u_long *property; /* actual property returned */
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 * If a window is iconified its WM_STATE is set to IconicState. See
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
800 * ICCCM Version 2.0, section 4.1.3.1 for more details.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
801 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
802
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
803 wm_state = XmInternAtom(XtDisplay(w), NOCATGETS("WM_STATE"), False);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
804 if (XtWindow(w) != 0) { /* only check if window exists! */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
805 XGetWindowProperty(XtDisplay(w), XtWindow(w), wm_state, 0L, 2L,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
806 False, AnyPropertyType, &act_type, &act_fmt, &nitems_ret,
8247
6ee794dc950e commit https://github.com/vim/vim/commit/669cac0a805333e69b9e1176425083914eada659
Christian Brabandt <cb@256bit.org>
parents: 7823
diff changeset
807 &bytes_after, (char_u **) &property);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
808 if (nitems_ret == 2 && property[0] == IconicState) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
809 return True;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
810 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
811 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
812
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
813 return False;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
814
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
815 } /* end widgetIsIconified */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
816
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
817 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
818 workshop_minimize_shell(Widget shell)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
819 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
820 if (shell != NULL &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
821 XtIsObject(shell) &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
822 XtIsRealized(shell) == True) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
823 if (isMapped(shell) == True) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
824 XIconifyWindow(XtDisplay(shell), XtWindow(shell),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
825 XScreenNumberOfScreen(XtScreen(shell)));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
826 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
827 XtVaSetValues(shell,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
828 XmNiconic, True,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
829 NULL);
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 void workshop_maximize_shell(Widget shell)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
834 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
835 if (shell != NULL &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
836 XtIsRealized(shell) == True &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
837 widgetIsIconified(shell) == True &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
838 isMapped(shell) == False) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
839 XtMapWidget(shell);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
840 /* This used to be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
841 XtPopdown(shell);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
842 XtPopup(shell, XtGrabNone);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
843 However, I found that that would drop any transient
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
844 windows that had been iconified with the window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
845 According to the ICCCM, XtMapWidget should be used
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
846 to bring a window from Iconic to Normal state.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
847 However, Rich Mauri did a lot of work on this during
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
848 Bart, and found that XtPopDown,XtPopup was required
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
849 to fix several bugs involving multiple CDE workspaces.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
850 I've tested it now and things seem to work fine but
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
851 I'm leaving this note for history in case this needs
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
852 to be revisited.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
853 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
854 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
855 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
856
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
857
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
858 Boolean workshop_get_width_height(int *width, int *height)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
859 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
860 static int wid = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
861 static int hgt = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
862 static Boolean firstTime = True;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
863 static Boolean success = False;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
865 if (firstTime) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
866 char *settings;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
867
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
868 settings = getenv(NOCATGETS("SPRO_GUI_WIDTH_HEIGHT"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
869 if (settings != NULL) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
870 wid = atoi(settings);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
871 settings = strrchr(settings, ':');
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
872 if (settings++ != NULL) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
873 hgt = atoi(settings);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
874 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
875 if (wid > 0 && hgt > 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
876 success = True;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
877 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
878 firstTime = False;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
879 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
880 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
881
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
882 if (success) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
883 *width = wid;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
884 *height = hgt;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
885 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
886 return success;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
887 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
888
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
889 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
890 * Toolbar code
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
891 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
892
14862
27b9a84395b5 patch 8.1.0443: unnecessary static function prototypes
Christian Brabandt <cb@256bit.org>
parents: 12871
diff changeset
893 static void
27b9a84395b5 patch 8.1.0443: unnecessary static function prototypes
Christian Brabandt <cb@256bit.org>
parents: 12871
diff changeset
894 workshop_sensitivity(int num, char *table)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
895 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
896 /* build up a verb table */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
897 VerbSense *vs;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
898 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
899 char *s;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
900 if ((num < 1) || (num > 500)) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
901 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
902 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
903
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
904 vs = (VerbSense *)malloc((num+1)*sizeof(VerbSense));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
905
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
906 /* Point to the individual names (destroys the table string, but
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
907 * that's okay -- this is more efficient than duplicating strings) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
908 s = table;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
909 for (i = 0; i < num; i++) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
910 while (*s == ' ') {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
911 s++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
912 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
913 vs[i].verb = s;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
914 while (*s && (*s != ' ') && (*s != '\001')) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
915 s++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
916 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
917 if (*s == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
918 vs[i].verb = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
919 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
920 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
921 if (*s == '\001') {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
922 *s = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
923 s++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
924 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
925 *s = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
926 s++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
927 while (*s == ' ') {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
928 s++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
929 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
930 if (*s == '1') {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
931 vs[i].sense = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
932 } else {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
933 vs[i].sense = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
934 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
935 s++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
936 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
937 vs[i].verb = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
938
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
939 workshop_frame_sensitivities(vs);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
940
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
941 free(vs);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
942 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
943
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
944 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
945 * Options code
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
946 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
947 /* Set an editor option.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
948 * IGNORE an option if you do not recognize it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
949 */
14862
27b9a84395b5 patch 8.1.0443: unnecessary static function prototypes
Christian Brabandt <cb@256bit.org>
parents: 12871
diff changeset
950 static void
27b9a84395b5 patch 8.1.0443: unnecessary static function prototypes
Christian Brabandt <cb@256bit.org>
parents: 12871
diff changeset
951 workshop_set_option_first(char *name, char *value)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
952 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
953 /* Currently value can only be on/off. This may change later (for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
954 * example to set an option like "balloon evaluate delay", but
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
955 * for now just convert it into a boolean */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
956 Boolean on = !strcmp(value, "on");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
957
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
958 if (!strcmp(name, "workshopkeys")) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
959 workshop_hotkeys(on);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
960 } else if (!strcmp(name, "savefiles")) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
961 save_files = on;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
962 } else if (!strcmp(name, "balloon")) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
963 workshop_balloon_mode(on);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
964 } else if (!strcmp(name, "balloondelay")) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
965 int delay = atoi(value);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
966 /* Should I validate the number here?? */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
967 workshop_balloon_delay(delay);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
968 } else {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
969 /* Let editor interpret it */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
970 workshop_set_option(name, value);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
971 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
972 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
973
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
974
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
975 void workshop_file_closed_lineno(char *filename, int lineno)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
976 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
977 char buffer[2*MAXPATHLEN];
272
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
978 vim_snprintf(buffer, sizeof(buffer),
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
979 NOCATGETS("deletedFile %s %d\n"), filename, lineno);
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2245
diff changeset
980 dummy = write(sd, buffer, strlen(buffer));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
981 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
982
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
983 void workshop_file_opened(char *filename, int readOnly)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
984 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
985 char buffer[2*MAXPATHLEN];
272
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
986 vim_snprintf(buffer, sizeof(buffer),
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
987 NOCATGETS("loadedFile %s %d\n"), filename, readOnly);
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2245
diff changeset
988 dummy = write(sd, buffer, strlen(buffer));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
989 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
990
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
991
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
992 void workshop_file_saved(char *filename)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
993 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
994 char buffer[2*MAXPATHLEN];
272
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
995 vim_snprintf(buffer, sizeof(buffer),
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
996 NOCATGETS("savedFile %s\n"), filename);
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2245
diff changeset
997 dummy = write(sd, buffer, strlen(buffer));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
998
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
999 /* Let editor report any moved marks that the eserve client
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1000 * should deal with (for example, moving location-based breakpoints) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1001 workshop_moved_marks(filename);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1002 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1003
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1004 void workshop_frame_moved(int new_x, int new_y, int new_w, int new_h)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1005 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1006 char buffer[200];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1007
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1008 if (sd >= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1009 {
272
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
1010 vim_snprintf(buffer, sizeof(buffer),
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
1011 NOCATGETS("frameAt %d %d %d %d\n"),
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1012 new_x, new_y, new_w, new_h);
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2245
diff changeset
1013 dummy = write(sd, buffer, strlen(buffer));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1014 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1015 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1016
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1017 /* A button in the toolbar has been pushed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1018 * Clientdata is a pointer used by the editor code to figure out the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1019 * positions for this toolbar (probably by storing a window pointer,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1020 * and then fetching the current buffer for that window and looking up
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1021 * cursor and selection positions etc.) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1022 void workshop_perform_verb(char *verb, void *clientData)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1023 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1024 char *filename;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1025 int curLine;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1026 int curCol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1027 int selStartLine;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1028 int selStartCol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1029 int selEndLine;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1030 int selEndCol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1031 int selLength;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1032 char *selection;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1033
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1034 char buf[2*MAXPATHLEN];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1035 /* Later: needsFilePos indicates whether or not we need to fetch all this
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1036 * info for this verb... for now, however, it looks as if
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1037 * eserve parsing routines depend on it always being present */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1038
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1039 if (workshop_get_positions(clientData,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1040 &filename,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1041 &curLine,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1042 &curCol,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1043 &selStartLine,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1044 &selStartCol,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1045 &selEndLine,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1046 &selEndCol,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1047 &selLength,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1048 &selection)) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1049 if (selection == NULL) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1050 selection = NOCATGETS("");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1051 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1052
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1053 /* Should I save the files??? This is currently done by checking
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1054 if the verb is one of a few recognized ones. Later we can pass
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1055 this list from eserve to the editor (it's currently hardcoded in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1056 vi and emacs as well). */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1057 if (save_files) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1058 if (!strcmp(verb, "build.build") || !strcmp(verb, "build.build-file") ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1059 !strcmp(verb, "debug.fix") || !strcmp(verb, "debug.fix-all")) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1060 workshop_save_files();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1061 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1062 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1063
272
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
1064 vim_snprintf(buf, sizeof(buf),
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
1065 NOCATGETS("toolVerb %s %s %d,%d %d,%d %d,%d %d %s\n"),
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1066 verb,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1067 filename,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1068 curLine, curCol,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1069 selStartLine, selStartCol,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1070 selEndLine, selEndCol,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1071 selLength,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1072 selection);
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2245
diff changeset
1073 dummy = write(sd, buf, strlen(buf));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1074 if (*selection) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1075 free(selection);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1076 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1077 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1078 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1079
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1080 /* Send a message to eserve */
12871
1a450ce6980c patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
1081 #if defined(NOHANDS_SUPPORT_FUNCTIONS) || defined(FEAT_BEVAL_GUI)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1082 void workshop_send_message(char *buf)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1083 {
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2245
diff changeset
1084 dummy = write(sd, buf, strlen(buf));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1085 }
2031
07de57cbcb25 updated for version 7.2.327
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
1086 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1087
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1088 /* Some methods, like currentFile, cursorPos, etc. are missing here.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1089 * But it looks like these are used for NoHands testing only so we
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1090 * won't bother requiring editors to implement these
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1091 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1092
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1093
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1094 #ifdef DEBUG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1095
14862
27b9a84395b5 patch 8.1.0443: unnecessary static function prototypes
Christian Brabandt <cb@256bit.org>
parents: 12871
diff changeset
1096 static void
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1097 pldebug(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1098 char *fmt, /* a printf style format line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1099 ...)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1100 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1101 va_list ap;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1102
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1103 if (dfd != NULL) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1104 va_start(ap, fmt);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1105 vfprintf(dfd, fmt, ap);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1106 va_end(ap);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1107 fflush(dfd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1108 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1109
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1110 } /* end pldebug */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1111
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1112 #endif