annotate src/integration.c @ 6934:be7bd53ad376

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