annotate src/integration.c @ 2089:fd8864aeb52a v7.2.373

updated for version 7.2.373 Problem: Gcc 4.5 adds more error messages. (Chris Indy) Solution: Update default 'errorformat'.
author Bram Moolenaar <bram@zimbu.org>
date Wed, 24 Feb 2010 15:25:25 +0100
parents 07de57cbcb25
children cccb71c2c5c1
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 <errno.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 #include <sys/types.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 #include <sys/socket.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 #include <sys/param.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 #ifdef HAVE_LIBGEN_H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 # include <libgen.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 #include <unistd.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 #include <string.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 #include <X11/Intrinsic.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 #include <Xm/Xm.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 #include <Xm/AtomMgr.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 #include <Xm/PushB.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 #ifdef HAVE_X11_XPM_H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 # include <X11/xpm.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 # ifdef HAVE_XM_XPMP_H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 # include <Xm/XpmP.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 #ifdef HAVE_UTIL_DEBUG_H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 # include <util/debug.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 #ifdef HAVE_UTIL_MSGI18N_H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 # include <util/msgi18n.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 #include "integration.h" /* <EditPlugin/integration.h> */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 #ifdef HAVE_FRAME_H
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 # include <frame.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 #ifndef MAX
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 # define MAX(a, b) (a) > (b) ? (a) : (b)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 #ifndef NOCATGETS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 # define NOCATGETS(x) x
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 /* Functions private to this file */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 static void workshop_connection_closed(void);
2031
07de57cbcb25 updated for version 7.2.327
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
81 static void messageFromEserve(XtPointer clientData, int *dum1, XtInputId *dum2);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 static void workshop_disconnect(void);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 static void workshop_sensitivity(int num, char *table);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 static void adjust_sign_name(char *filename);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 static void process_menuItem(char *);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 static void process_toolbarButton(char *);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 static void workshop_set_option_first(char *name, char *value);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88
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);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 write(sd, buf, strlen(buf));
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);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283 write(sd, buf, strlen(buf));
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);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
394 WHAT DO I DO HERE?
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 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
665 memset((char *)&server, '\0', sizeof(server));
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());
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
732 write(sd, buf, strlen(buf));
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"));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
735 write(sd, buf, strlen(buf));
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
2031
07de57cbcb25 updated for version 7.2.327
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
756 #if 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
757 /* Set icon for the window */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
758 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
759 workshop_set_icon(Display *display, Widget shell, char **xpmdata,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
760 int width, int height)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
761 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
762 Pixel bgPixel;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
763 XpmAttributes xpmAttributes;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
764 XSetWindowAttributes attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
765 Window iconWindow;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
766 int depth;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
767 int screenNum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
768 Pixmap pixmap;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
769
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
770 /* Create the pixmap/icon window which is shown when you
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
771 * iconify the sccs viewer
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
772 * This code snipped was adapted from Sun WorkShop's source base,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
773 * setIcon.cc.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
774 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
775 XtVaGetValues(shell, XmNbackground, &bgPixel, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
776 screenNum = XScreenNumberOfScreen(XtScreen(shell));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
777 depth = DisplayPlanes(display, screenNum);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
778 xpmAttributes.valuemask = XpmColorSymbols;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
779 xpmAttributes.numsymbols = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
780 xpmAttributes.colorsymbols =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
781 (XpmColorSymbol *)XtMalloc(sizeof (XpmColorSymbol) *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
782 xpmAttributes.numsymbols);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
783 xpmAttributes.colorsymbols[0].name = NOCATGETS("BgColor");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
784 xpmAttributes.colorsymbols[0].value = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
785 xpmAttributes.colorsymbols[0].pixel = bgPixel;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
786 if (XpmCreatePixmapFromData(display,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
787 RootWindow(display, screenNum), xpmdata, &pixmap,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
788 NULL, &xpmAttributes) >= 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
789 attr.background_pixmap = pixmap;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
790 iconWindow = XCreateWindow(display, RootWindow(display,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
791 screenNum), 0, 0, width, height, 0, depth,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
792 (unsigned int)CopyFromParent,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
793 CopyFromParent, CWBackPixmap, &attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
794
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
795 XtVaSetValues(shell,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
796 XtNiconWindow, iconWindow, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
797 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
798 XtFree((char *)xpmAttributes.colorsymbols);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
799 }
2031
07de57cbcb25 updated for version 7.2.327
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
800 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
801
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
802 /* Minimize and maximize shells. From libutil's shell.cc. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
803
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
804 /* utility functions from libutil's shell.cc */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
805 static Boolean
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
806 isWindowMapped(Display *display, Window win)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
807 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
808 XWindowAttributes winAttrs;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
809 XGetWindowAttributes(display,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
810 win,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
811 &winAttrs);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
812 if (winAttrs.map_state == IsViewable) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
813 return(True);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
814 } else {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
815 return(False);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
816 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
817 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
818
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
819 static Boolean
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
820 isMapped(Widget widget)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
821 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
822 if (widget == NULL) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
823 return(False);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
824 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
825
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
826 if (XtIsRealized(widget) == False) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
827 return(False);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
828 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
829
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
830 return(isWindowMapped(XtDisplay(widget), XtWindow(widget)));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
831 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
832
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
833 static Boolean
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
834 widgetIsIconified(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
835 Widget w)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
836 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
837 Atom wm_state;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
838 Atom act_type; /* actual Atom type returned */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
839 int act_fmt; /* actual format returned */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
840 u_long nitems_ret; /* number of items returned */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
841 u_long bytes_after; /* number of bytes remaining */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
842 u_long *property; /* actual property returned */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
843
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
844 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
845 * If a window is iconified its WM_STATE is set to IconicState. See
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
846 * ICCCM Version 2.0, section 4.1.3.1 for more details.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
847 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
848
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
849 wm_state = XmInternAtom(XtDisplay(w), NOCATGETS("WM_STATE"), False);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
850 if (XtWindow(w) != 0) { /* only check if window exists! */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
851 XGetWindowProperty(XtDisplay(w), XtWindow(w), wm_state, 0L, 2L,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
852 False, AnyPropertyType, &act_type, &act_fmt, &nitems_ret,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
853 &bytes_after, (u_char **) &property);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
854 if (nitems_ret == 2 && property[0] == IconicState) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
855 return True;
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 return False;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
860
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
861 } /* end widgetIsIconified */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
862
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
863 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
864 workshop_minimize_shell(Widget shell)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
865 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
866 if (shell != NULL &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
867 XtIsObject(shell) &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
868 XtIsRealized(shell) == True) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
869 if (isMapped(shell) == True) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
870 XIconifyWindow(XtDisplay(shell), XtWindow(shell),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
871 XScreenNumberOfScreen(XtScreen(shell)));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
872 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
873 XtVaSetValues(shell,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
874 XmNiconic, True,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
875 NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
876 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
877 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
878
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
879 void workshop_maximize_shell(Widget shell)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
880 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
881 if (shell != NULL &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
882 XtIsRealized(shell) == True &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
883 widgetIsIconified(shell) == True &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
884 isMapped(shell) == False) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
885 XtMapWidget(shell);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
886 /* This used to be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
887 XtPopdown(shell);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
888 XtPopup(shell, XtGrabNone);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
889 However, I found that that would drop any transient
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
890 windows that had been iconified with the window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
891 According to the ICCCM, XtMapWidget should be used
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
892 to bring a window from Iconic to Normal state.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
893 However, Rich Mauri did a lot of work on this during
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
894 Bart, and found that XtPopDown,XtPopup was required
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
895 to fix several bugs involving multiple CDE workspaces.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
896 I've tested it now and things seem to work fine but
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
897 I'm leaving this note for history in case this needs
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
898 to be revisited.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
899 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
900 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
901 }
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 Boolean workshop_get_width_height(int *width, int *height)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
905 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
906 static int wid = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
907 static int hgt = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
908 static Boolean firstTime = True;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
909 static Boolean success = False;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
910
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
911 if (firstTime) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
912 char *settings;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
913
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
914 settings = getenv(NOCATGETS("SPRO_GUI_WIDTH_HEIGHT"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
915 if (settings != NULL) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
916 wid = atoi(settings);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
917 settings = strrchr(settings, ':');
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
918 if (settings++ != NULL) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
919 hgt = atoi(settings);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
920 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
921 if (wid > 0 && hgt > 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
922 success = True;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
923 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
924 firstTime = False;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
925 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
926 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
927
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
928 if (success) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
929 *width = wid;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
930 *height = hgt;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
931 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
932 return success;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
933 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
934
2031
07de57cbcb25 updated for version 7.2.327
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
935 #if 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
936 Boolean workshop_get_rows_cols(int *rows, int *cols)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
937 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
938 static int r = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
939 static int c = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
940 static Boolean firstTime = True;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
941 static Boolean success = False;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
942
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
943 if (firstTime) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
944 char *settings;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
945
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
946 settings = getenv(NOCATGETS("SPRO_GUI_ROWS_COLS"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
947 if (settings != NULL) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
948 r = atoi(settings);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
949 settings = strrchr(settings, ':');
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
950 if (settings++ != NULL) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
951 c = atoi(settings);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
952 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
953 if (r > 0 && c > 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
954 success = True;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
955 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
956 firstTime = False;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
957 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
958 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
959
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
960 if (success) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
961 *rows = r;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
962 *cols = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
963 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
964 return success;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
965 }
2031
07de57cbcb25 updated for version 7.2.327
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
966 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
967
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
968 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
969 * Toolbar code
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 void workshop_sensitivity(int num, char *table)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
973 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
974 /* build up a verb table */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
975 VerbSense *vs;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
976 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
977 char *s;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
978 if ((num < 1) || (num > 500)) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
979 return;
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 vs = (VerbSense *)malloc((num+1)*sizeof(VerbSense));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
983
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
984 /* Point to the individual names (destroys the table string, but
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
985 * that's okay -- this is more efficient than duplicating strings) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
986 s = table;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
987 for (i = 0; i < num; i++) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
988 while (*s == ' ') {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
989 s++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
990 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
991 vs[i].verb = s;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
992 while (*s && (*s != ' ') && (*s != '\001')) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
993 s++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
994 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
995 if (*s == 0) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
996 vs[i].verb = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
997 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
998 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
999 if (*s == '\001') {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1000 *s = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1001 s++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1002 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1003 *s = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1004 s++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1005 while (*s == ' ') {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1006 s++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1007 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1008 if (*s == '1') {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1009 vs[i].sense = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1010 } else {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1011 vs[i].sense = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1012 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1013 s++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1014 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1015 vs[i].verb = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1016
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1017 workshop_frame_sensitivities(vs);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1018
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1019 free(vs);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1020 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1021
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1022 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1023 * Options code
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1024 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1025 /* Set an editor option.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1026 * IGNORE an option if you do not recognize it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1027 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1028 void workshop_set_option_first(char *name, char *value)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1029 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1030 /* Currently value can only be on/off. This may change later (for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1031 * example to set an option like "balloon evaluate delay", but
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1032 * for now just convert it into a boolean */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1033 Boolean on = !strcmp(value, "on");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1034
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1035 if (!strcmp(name, "workshopkeys")) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1036 workshop_hotkeys(on);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1037 } else if (!strcmp(name, "savefiles")) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1038 save_files = on;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1039 } else if (!strcmp(name, "balloon")) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1040 workshop_balloon_mode(on);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1041 } else if (!strcmp(name, "balloondelay")) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1042 int delay = atoi(value);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1043 /* Should I validate the number here?? */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1044 workshop_balloon_delay(delay);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1045 } else {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1046 /* Let editor interpret it */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1047 workshop_set_option(name, value);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1048 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1049 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1050
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1051
2031
07de57cbcb25 updated for version 7.2.327
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
1052 #if 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1053 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1054 * Send information to eserve on certain editor events
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1055 * You must make sure these are called when necessary
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1056 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1057 void workshop_file_closed(char *filename)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1058 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1059 char buffer[2*MAXPATHLEN];
272
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
1060 vim_snprintf(buffer, sizeof(buffer),
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
1061 NOCATGETS("deletedFile %s\n"), filename);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1062 write(sd, buffer, strlen(buffer));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1063 }
2031
07de57cbcb25 updated for version 7.2.327
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
1064 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1065
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1066 void workshop_file_closed_lineno(char *filename, int lineno)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1067 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1068 char buffer[2*MAXPATHLEN];
272
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
1069 vim_snprintf(buffer, sizeof(buffer),
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
1070 NOCATGETS("deletedFile %s %d\n"), filename, lineno);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1071 write(sd, buffer, strlen(buffer));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1072 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1073
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1074 void workshop_file_opened(char *filename, int readOnly)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1075 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1076 char buffer[2*MAXPATHLEN];
272
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
1077 vim_snprintf(buffer, sizeof(buffer),
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
1078 NOCATGETS("loadedFile %s %d\n"), filename, readOnly);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1079 write(sd, buffer, strlen(buffer));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1080 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1081
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1082
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1083 void workshop_file_saved(char *filename)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1084 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1085 char buffer[2*MAXPATHLEN];
272
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
1086 vim_snprintf(buffer, sizeof(buffer),
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
1087 NOCATGETS("savedFile %s\n"), filename);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1088 write(sd, buffer, strlen(buffer));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1089
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1090 /* Let editor report any moved marks that the eserve client
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1091 * should deal with (for example, moving location-based breakpoints) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1092 workshop_moved_marks(filename);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1093 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1094
2031
07de57cbcb25 updated for version 7.2.327
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
1095 #if 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1096 void workshop_file_modified(char *filename)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1097 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1098 char buffer[2*MAXPATHLEN];
272
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
1099 vim_snprintf(buffer, sizeof(buffer),
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
1100 NOCATGETS("modifiedFile %s\n"), filename);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1101 write(sd, buffer, strlen(buffer));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1102 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1103
2031
07de57cbcb25 updated for version 7.2.327
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
1104 void workshop_move_mark(char *filename, int markId, int newLineno)
07de57cbcb25 updated for version 7.2.327
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
1105 {
07de57cbcb25 updated for version 7.2.327
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
1106 char buffer[2*MAXPATHLEN];
07de57cbcb25 updated for version 7.2.327
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
1107 vim_snprintf(buffer, sizeof(buffer),
07de57cbcb25 updated for version 7.2.327
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
1108 NOCATGETS("moveMark %s %d %d\n"), filename, markId, newLineno);
07de57cbcb25 updated for version 7.2.327
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
1109 write(sd, buffer, strlen(buffer));
07de57cbcb25 updated for version 7.2.327
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
1110 }
07de57cbcb25 updated for version 7.2.327
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
1111 #endif
07de57cbcb25 updated for version 7.2.327
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
1112
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1113 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
1114 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1115 char buffer[200];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1116
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1117 if (sd >= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1118 {
272
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
1119 vim_snprintf(buffer, sizeof(buffer),
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
1120 NOCATGETS("frameAt %d %d %d %d\n"),
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1121 new_x, new_y, new_w, new_h);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1122 write(sd, buffer, strlen(buffer));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1123 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1124 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1125
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1126 /* A button in the toolbar has been pushed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1127 * Clientdata is a pointer used by the editor code to figure out the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1128 * positions for this toolbar (probably by storing a window pointer,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1129 * and then fetching the current buffer for that window and looking up
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1130 * cursor and selection positions etc.) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1131 void workshop_perform_verb(char *verb, void *clientData)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1132 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1133 char *filename;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1134 int curLine;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1135 int curCol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1136 int selStartLine;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1137 int selStartCol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1138 int selEndLine;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1139 int selEndCol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1140 int selLength;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1141 char *selection;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1142
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1143 char buf[2*MAXPATHLEN];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1144 /* Later: needsFilePos indicates whether or not we need to fetch all this
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1145 * info for this verb... for now, however, it looks as if
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1146 * eserve parsing routines depend on it always being present */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1147
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1148 if (workshop_get_positions(clientData,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1149 &filename,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1150 &curLine,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1151 &curCol,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1152 &selStartLine,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1153 &selStartCol,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1154 &selEndLine,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1155 &selEndCol,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1156 &selLength,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1157 &selection)) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1158 if (selection == NULL) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1159 selection = NOCATGETS("");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1160 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1161
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1162 /* Should I save the files??? This is currently done by checking
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1163 if the verb is one of a few recognized ones. Later we can pass
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1164 this list from eserve to the editor (it's currently hardcoded in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1165 vi and emacs as well). */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1166 if (save_files) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1167 if (!strcmp(verb, "build.build") || !strcmp(verb, "build.build-file") ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1168 !strcmp(verb, "debug.fix") || !strcmp(verb, "debug.fix-all")) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1169 workshop_save_files();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1170 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1171 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1172
272
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
1173 vim_snprintf(buf, sizeof(buf),
ddada568db54 updated for version 7.0073
vimboss
parents: 7
diff changeset
1174 NOCATGETS("toolVerb %s %s %d,%d %d,%d %d,%d %d %s\n"),
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1175 verb,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1176 filename,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1177 curLine, curCol,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1178 selStartLine, selStartCol,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1179 selEndLine, selEndCol,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1180 selLength,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1181 selection);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1182 write(sd, buf, strlen(buf));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1183 if (*selection) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1184 free(selection);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1185 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1186 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1187 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1188
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1189 /* Send a message to eserve */
2031
07de57cbcb25 updated for version 7.2.327
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
1190 #if defined(NOHANDS_SUPPORT_FUNCTIONS) || defined(FEAT_BEVAL)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1191 void workshop_send_message(char *buf)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1192 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1193 write(sd, buf, strlen(buf));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1194 }
2031
07de57cbcb25 updated for version 7.2.327
Bram Moolenaar <bram@zimbu.org>
parents: 1619
diff changeset
1195 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1196
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1197 /* Some methods, like currentFile, cursorPos, etc. are missing here.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1198 * But it looks like these are used for NoHands testing only so we
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1199 * won't bother requiring editors to implement these
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1200 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1201
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1202
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1203 #ifdef DEBUG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1204
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1205 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1206 pldebug(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1207 char *fmt, /* a printf style format line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1208 ...)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1209 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1210 va_list ap;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1211
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1212 if (dfd != NULL) {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1213 va_start(ap, fmt);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1214 vfprintf(dfd, fmt, ap);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1215 va_end(ap);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1216 fflush(dfd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1217 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1218
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1219 } /* end pldebug */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1220
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1221 #endif