1 /* Hello, Emacs, this is -*- objc -*-
2 * $Id: next.trm,v 1.27 2006/07/21 02:35:47 sfeam Exp $
6 /* GNUPLOT - next.trm */
9 * Copyright 1991 - 1993, 1998, 2004
11 * Permission to use, copy, and distribute this software and its
12 * documentation for any purpose with or without fee is hereby granted,
13 * provided that the above copyright notice appear in all copies and
14 * that both that copyright notice and this permission notice appear
15 * in supporting documentation.
17 * Permission to modify the software is granted, but not the right to
18 * distribute the complete modified source code. Modifications are to
19 * be distributed as patches to the released version. Permission to
20 * distribute binaries produced by compiling modified sources is granted,
22 * 1. distribute the corresponding source modifications from the
23 * released version in the form of a patch file along with the binaries,
24 * 2. add special version identification to distinguish your version
25 * in addition to the base release version number,
26 * 3. provide your name and address as the primary contact for the
27 * support of your modified version, and
28 * 4. retain our contact information in regard to use of the base
30 * Permission to distribute the released version of the source code along
31 * with corresponding source modifications in the form of a patch file is
32 * granted with same provisions 2 through 4 for binary distributions.
34 * This software is provided "as is" without express or implied warranty
35 * to the extent permitted by applicable law.
39 * This file is included by ../term.c via ../term.h.
41 * This terminal driver supports:
45 * Robert Lutwak from Russell Lang's post.trm
46 * 'old' option invokes Nick Strobel's original, single viewport terminal
48 * send your comments or suggestions to (gnuplot-info@lists.sourceforge.net).
50 * This terminal attempts to connect, via the NeXTstep Distributed
51 * Objects system, to the "gnuplotServer." If there is no such
52 * service registered with the OS, the terminal attempts to fire
53 * up GnuTerm.app. If the user has not set the environment variable
54 * GNUTERMPATH, the terminal uses the users ApplicationPaths Workspace
55 * dwrite to search for GnuTerm.app (Note: this is usually something
56 * like ~/Apps, ~/LocalApps, ~/NextApps, etc.).
57 * In order to use this filter, you MUST have GnuTerm.app installed
60 * Once connected to the server, this filter is basically Russell Lang's
61 * Postscript filter, except that the resultant postscript code
62 * is sent, via the D.O. system, to GnuTerm.app, which manages
63 * the windows which produce the postscript output on the screen.
67 * 'set term next new dashed auto "Helvetica" 14'
69 * To change font to Times-Roman and font size to 20pts use
70 * 'set term next "Times-Roman" 20'.
72 * to choose window by title
73 * 'set term next title "Window title"
78 * To invoke Nick Strobel's old terminal
90 /* whether or not to compile support for the old (self-contained)
92 /* #define NEXT_OLDTERMINAL 1 */
94 #import <appkit/appkit.h>
95 #import <remote/NXProxy.h> /* setProtocolForProxy */
96 #import <remote/NXConnection.h> /* setProtocolForProxy */
97 #import <machkit/NXNetNameServer.h>
98 #import <machkit/senderIsInvalid.h>
102 #ifdef NEXT_OLDTERMINAL
103 static void window_create __PROTO((void));
104 @interface EpsViewer:Application
109 -windowCreate:(NXCoord)
110 width Height:(NXCoord) height;
111 -(NXRect *) nextRectForWidth:(NXCoord)
112 width Height:(NXCoord) height;
114 #endif /* NEXT_OLDTERMINAL */
117 TERM_PUBLIC void NEXT_options __PROTO((void));
118 TERM_PUBLIC void NEXT_common_init __PROTO((int uses_fonts, unsigned int xoff, unsigned int yoff, unsigned int xsize, unsigned int ysize, char **dict));
119 TERM_PUBLIC void NEXT_init __PROTO((void));
120 TERM_PUBLIC void NEXT_graphics __PROTO((void));
121 TERM_PUBLIC void NEXT_text __PROTO((void));
122 TERM_PUBLIC void NEXT_reset __PROTO((void));
123 TERM_PUBLIC void NEXT_linetype __PROTO((int linetype));
124 TERM_PUBLIC void NEXT_move __PROTO((unsigned int x, unsigned int y));
125 TERM_PUBLIC void NEXT_vector __PROTO((unsigned int x, unsigned int y));
126 TERM_PUBLIC void NEXT_put_text __PROTO((unsigned int x, unsigned int y, const char *str));
127 TERM_PUBLIC int NEXT_text_angle __PROTO((int ang));
128 TERM_PUBLIC int NEXT_justify_text __PROTO((enum JUSTIFY mode));
129 TERM_PUBLIC void NEXT_point __PROTO((unsigned int x, unsigned int y, int number));
130 TERM_PUBLIC int NEXT_set_font __PROTO((const char *font));
131 TERM_PUBLIC char *NEXT_RememberFont __PROTO((char *fname));
132 TERM_PUBLIC void NEXT_set_pointsize __PROTO((double size));
135 #define NEXT_POINT_TYPES 8 /* div */
136 #define NEXT_XOFF 1 /* page offset in pts */
138 #define NEXT_XMAX 6400
139 #define NEXT_YMAX 4800
140 #define NEXT_XLAST (NEXT_XMAX - 1)
141 #define NEXT_YLAST (NEXT_YMAX - 1)
142 #define NEXT_VTIC (NEXT_YMAX/80)
143 #define NEXT_HTIC (NEXT_YMAX/80)
144 #define NEXT_SC (10) /* scale is 1pt = 10 units */
145 #define NEXT_LW (0.5*NEXT_SC) /* linewidth = 0.5 pts */
146 #define NEXT_VCHAR (14*NEXT_SC) /* default is 14 point characters */
147 #define NEXT_HCHAR (14*NEXT_SC*6/10)
149 #define GOT_NEXT_PROTO
153 #ifndef TERM_PROTO_ONLY
157 @interface GnuTermDriver:Object < NXSenderIsInvalid >
162 -senderIsInvalid:(id) sender;
163 -plot:(char *) PSstr;
168 #define DEFAULTNEXTSIZE 10000
170 static id gnuTermAccess; /* local object manages the D.O. connection */
172 static char *NEXTBuffer, *NEXTBufAt, *NEXTBufEnd;
174 static char NEXTTmpBuf[1000];
175 static void NEXTPrintf(char *,...);
176 static TBOOLEAN NEXT_oldterminal = FALSE;
177 /*static TBOOLEAN NEXT_colordetect();*/
179 static char NEXT_title[MAX_LINE_LEN + 1]; /* name of font */
181 static char NEXT_font[MAX_LINE_LEN + 1] = "Helvetica"; /* name of font */
182 static int NEXT_fontsize = 14; /* size of font in pts */
183 static int NEXT_default_font[MAX_ID_LEN+1] = {'\0'};
184 static TBOOLEAN NEXT_color = FALSE;
185 static TBOOLEAN NEXT_solid = FALSE; /* use dashed lines */
186 static int NEXT_path_count = 0; /* count of lines in path */
187 static int NEXT_ang = 0; /* text angle */
188 static enum JUSTIFY NEXT_justify = LEFT; /* text is flush left */
190 static TBOOLEAN NEXT_duplex_state = FALSE;
191 static TBOOLEAN NEXT_duplex_option = FALSE;
193 static char GPFAR *GPFAR NEXT_header[] =
195 "/M {moveto} bind def\n",
196 "/L {lineto} bind def\n",
197 "/R {rmoveto} bind def\n",
198 "/V {rlineto} bind def\n",
199 "/vpt2 vpt 2 mul def\n",
200 "/hpt2 hpt 2 mul def\n",
201 /* flush left show */
202 "/Lshow { currentpoint stroke M\n",
203 " 0 vshift R show } def\n",
204 /* flush right show */
205 "/Rshow { currentpoint stroke M\n",
206 " dup stringwidth pop neg vshift R show } def\n",
208 "/Cshow { currentpoint stroke M\n",
209 " dup stringwidth pop -2 div vshift R show } def\n",
210 /* Dash or Color Line */
211 "/DL { Color {setrgbcolor Solid {pop []} if 0 setdash }\n",
212 " {pop pop pop Solid {pop []} if 0 setdash} ifelse } def\n",
214 "/BL { stroke gnulinewidth 2 mul setlinewidth } def\n",
216 "/AL { stroke gnulinewidth 2 div setlinewidth } def\n",
218 "/PL { stroke gnulinewidth setlinewidth } def\n",
220 "/LTb { BL [] 0 0 0 DL } def\n", /* border */
221 "/LTa { AL [1 dl 2 dl] 0 setdash 0 0 0 setrgbcolor } def\n", /* axes */
222 "/LT0 { PL [] 0 1 0 DL } def\n",
223 "/LT1 { PL [4 dl 2 dl] 0 0 1 DL } def\n",
224 "/LT2 { PL [2 dl 3 dl] 1 0 0 DL } def\n",
225 "/LT3 { PL [1 dl 1.5 dl] 1 0 1 DL } def\n",
226 "/LT4 { PL [5 dl 2 dl 1 dl 2 dl] 0 1 1 DL } def\n",
227 "/LT5 { PL [4 dl 3 dl 1 dl 3 dl] 1 1 0 DL } def\n",
228 "/LT6 { PL [2 dl 2 dl 2 dl 4 dl] 0 0 0 DL } def\n",
229 "/LT7 { PL [2 dl 2 dl 2 dl 2 dl 2 dl 4 dl] 1 0.3 0 DL } def\n",
230 "/LT8 { PL [2 dl 2 dl 2 dl 2 dl 2 dl 2 dl 2 dl 4 dl] 0.5 0.5 0.5 DL } def\n",
231 /* Point (Round) */ /* Matt Heffron make it round */
232 "/Pnt { stroke [] 0 setdash\n",
233 " gsave 1 setlinecap M 0 0 V stroke grestore } def\n",
236 "/Dia { stroke [] 0 setdash 2 copy vpt add M\n",
237 " hpt neg vpt neg V hpt vpt neg V\n",
238 " hpt vpt V hpt neg vpt V closepath stroke\n",
242 "/Pls { stroke [] 0 setdash vpt sub M 0 vpt2 V\n",
243 " currentpoint stroke M\n",
244 " hpt neg vpt neg R hpt2 0 V stroke\n",
248 "/Box { stroke [] 0 setdash 2 copy exch hpt sub exch vpt add M\n",
249 " 0 vpt2 neg V hpt2 0 V 0 vpt2 V\n",
250 " hpt2 neg 0 V closepath stroke\n",
254 "/Crs { stroke [] 0 setdash exch hpt sub exch vpt add M\n",
255 " hpt2 vpt2 neg V currentpoint stroke M\n",
256 " hpt2 neg 0 R hpt2 vpt2 V stroke } def\n",
259 "/TriU { stroke [] 0 setdash 2 copy vpt 1.12 mul add M\n",
260 " hpt neg vpt -1.62 mul V\n",
262 " hpt neg vpt 1.62 mul V closepath stroke\n",
266 "/Star { 2 copy Pls Crs } def\n",
268 /* div added filed box */
270 "/BoxF { stroke [] 0 setdash exch hpt sub exch vpt add M\n",
271 " 0 vpt2 neg V hpt2 0 V 0 vpt2 V\n",
272 " hpt2 neg 0 V closepath fill } def\n",
274 /* div added filled triangle */
275 /* Triangle Up, Filled */
276 "/TriUF { stroke [] 0 setdash vpt 1.12 mul add M\n",
277 " hpt neg vpt -1.62 mul V\n",
279 " hpt neg vpt 1.62 mul V closepath fill } def\n",
281 /* Matt Heffron: added a few more types */
283 "/TriD { stroke [] 0 setdash 2 copy vpt 1.12 mul sub M\n",
284 " hpt neg vpt 1.62 mul V\n",
286 " hpt neg vpt -1.62 mul V closepath stroke\n",
289 /* Triangle Down, Filled*/
290 "/TriDF { stroke [] 0 setdash vpt 1.12 mul sub M\n",
291 " hpt neg vpt 1.62 mul V\n",
293 " hpt neg vpt -1.62 mul V closepath fill} def\n",
295 /* Diamond, Filled */
296 "/DiaF { stroke [] 0 setdash vpt add M\n",
297 " hpt neg vpt neg V hpt vpt neg V\n",
298 " hpt vpt V hpt neg vpt V closepath fill } def\n",
301 "/Pent { stroke [] 0 setdash 2 copy gsave\n",
302 " translate 0 hpt M 4 {72 rotate 0 hpt L} repeat\n",
303 " closepath stroke grestore Pnt } def\n",
305 /* Pentagon, Filled */
306 "/PentF { stroke [] 0 setdash gsave\n",
307 " translate 0 hpt M 4 {72 rotate 0 hpt L} repeat\n",
308 " closepath fill grestore } def\n",
311 "/Circle { stroke [] 0 setdash 2 copy\n",
312 " hpt 0 360 arc stroke Pnt } def\n",
315 "/CircleF { stroke [] 0 setdash hpt 0 360 arc fill } def\n",
316 /* 16 differently filled circles */
317 "/C0 { BL [] 0 setdash 2 copy moveto vpt 90 450 arc } bind def\n",
318 "/C1 { BL [] 0 setdash 2 copy moveto\n",
319 " 2 copy vpt 0 90 arc closepath fill\n",
320 " vpt 0 360 arc closepath } bind def\n",
321 "/C2 { BL [] 0 setdash 2 copy moveto\n",
322 " 2 copy vpt 90 180 arc closepath fill\n",
323 " vpt 0 360 arc closepath } bind def\n",
324 "/C3 { BL [] 0 setdash 2 copy moveto\n",
325 " 2 copy vpt 0 180 arc closepath fill\n",
326 " vpt 0 360 arc closepath } bind def\n",
327 "/C4 { BL [] 0 setdash 2 copy moveto\n",
328 " 2 copy vpt 180 270 arc closepath fill\n",
329 " vpt 0 360 arc closepath } bind def\n",
330 "/C5 { BL [] 0 setdash 2 copy moveto\n",
331 " 2 copy vpt 0 90 arc\n",
333 " 2 copy vpt 180 270 arc closepath fill\n",
334 " vpt 0 360 arc } bind def\n",
335 "/C6 { BL [] 0 setdash 2 copy moveto\n",
336 " 2 copy vpt 90 270 arc closepath fill\n",
337 " vpt 0 360 arc closepath } bind def\n",
338 "/C7 { BL [] 0 setdash 2 copy moveto\n",
339 " 2 copy vpt 0 270 arc closepath fill\n",
340 " vpt 0 360 arc closepath } bind def\n",
341 "/C8 { BL [] 0 setdash 2 copy moveto\n",
342 " 2 copy vpt 270 360 arc closepath fill\n",
343 " vpt 0 360 arc closepath } bind def\n",
344 "/C9 { BL [] 0 setdash 2 copy moveto\n",
345 " 2 copy vpt 270 450 arc closepath fill\n",
346 " vpt 0 360 arc closepath } bind def\n",
347 "/C10 { BL [] 0 setdash 2 copy 2 copy moveto vpt 270 360 arc closepath fill\n",
349 " 2 copy vpt 90 180 arc closepath fill\n",
350 " vpt 0 360 arc closepath } bind def\n",
351 "/C11 { BL [] 0 setdash 2 copy moveto\n",
352 " 2 copy vpt 0 90 arc closepath fill\n",
354 " 2 copy vpt 180 360 arc closepath fill\n",
355 " vpt 0 360 arc closepath } bind def\n",
356 "/C12 { BL [] 0 setdash 2 copy moveto\n",
357 " 2 copy vpt 180 360 arc closepath fill\n",
358 " vpt 0 360 arc closepath } bind def\n",
359 "/C13 { BL [] 0 setdash 2 copy moveto\n",
360 " 2 copy vpt 0 90 arc closepath fill\n",
362 " 2 copy vpt 180 360 arc closepath fill\n",
363 " vpt 0 360 arc closepath } bind def\n",
364 "/C14 { BL [] 0 setdash 2 copy moveto\n",
365 " 2 copy vpt 90 360 arc closepath fill\n",
366 " vpt 0 360 arc } bind def\n",
367 "/C15 { BL [] 0 setdash 2 copy vpt 0 360 arc closepath fill\n",
368 " vpt 0 360 arc closepath } bind def\n",
370 /* Auxiliary definitions for rectangles */
372 "/Rec { newpath 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto\n",
373 " neg 0 rlineto closepath } bind def\n",
374 "/Square { dup Rec } bind def\n",
375 "/Bsquare { vpt sub exch vpt sub exch vpt2 Square } bind def\n",
377 /* 16 differently filled squares */
379 "/S0 { BL [] 0 setdash 2 copy moveto 0 vpt rlineto BL Bsquare } bind def\n",
380 "/S1 { BL [] 0 setdash 2 copy vpt Square fill Bsquare } bind def\n",
381 "/S2 { BL [] 0 setdash 2 copy exch vpt sub exch vpt Square fill Bsquare } bind def\n",
382 "/S3 { BL [] 0 setdash 2 copy exch vpt sub exch vpt2 vpt Rec fill Bsquare } bind def\n",
383 "/S4 { BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt Square fill Bsquare } bind def\n",
384 "/S5 { BL [] 0 setdash 2 copy 2 copy vpt Square fill\n",
385 " exch vpt sub exch vpt sub vpt Square fill Bsquare } bind def\n",
386 "/S6 { BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill Bsquare } bind def\n",
387 "/S7 { BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill\n",
388 " 2 copy vpt Square fill\n",
389 " Bsquare } bind def\n",
390 "/S8 { BL [] 0 setdash 2 copy vpt sub vpt Square fill Bsquare } bind def\n",
391 "/S9 { BL [] 0 setdash 2 copy vpt sub vpt vpt2 Rec fill Bsquare } bind def\n",
392 "/S10 { BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt Square fill\n",
393 " Bsquare } bind def\n",
394 "/S11 { 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt2 vpt Rec fill\n",
395 " Bsquare } bind def\n",
396 "/S12 { BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill Bsquare } bind def\n",
397 "/S13 { BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill\n",
398 " 2 copy vpt Square fill Bsquare } bind def\n",
399 "/S14 { BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill\n",
400 " 2 copy exch vpt sub exch vpt Square fill Bsquare } bind def\n",
401 "/S15 { BL [] 0 setdash 2 copy Bsquare fill Bsquare } bind def\n",
403 /* 16 different diamonds (actually just rotated squares) */
405 "/D0 { gsave translate 45 rotate 0 0 Box stroke grestore } bind def\n",
406 "/D1 { gsave translate 45 rotate 0 0 S1 stroke grestore } bind def\n",
407 "/D2 { gsave translate 45 rotate 0 0 S2 stroke grestore } bind def\n",
408 "/D3 { gsave translate 45 rotate 0 0 S3 stroke grestore } bind def\n",
409 "/D4 { gsave translate 45 rotate 0 0 S4 stroke grestore } bind def\n",
410 "/D5 { gsave translate 45 rotate 0 0 S5 stroke grestore } bind def\n",
411 "/D6 { gsave translate 45 rotate 0 0 S6 stroke grestore } bind def\n",
412 "/D7 { gsave translate 45 rotate 0 0 S7 stroke grestore } bind def\n",
413 "/D8 { gsave translate 45 rotate 0 0 S8 stroke grestore } bind def\n",
414 "/D9 { gsave translate 45 rotate 0 0 S9 stroke grestore } bind def\n",
415 "/D10 { gsave translate 45 rotate 0 0 S10 stroke grestore } bind def\n",
416 "/D11 { gsave translate 45 rotate 0 0 S11 stroke grestore } bind def\n",
417 "/D12 { gsave translate 45 rotate 0 0 S12 stroke grestore } bind def\n",
418 "/D13 { gsave translate 45 rotate 0 0 S13 stroke grestore } bind def\n",
419 "/D14 { gsave translate 45 rotate 0 0 S14 stroke grestore } bind def\n",
420 "/D15 { gsave translate 45 rotate 0 0 S15 stroke grestore } bind def\n",
425 static char GPFAR *GPFAR ENHNEXT_header[] =
427 /* For MFshow and MFwidth the tos is an array with the string and font info: */
428 /* [<fontname (a string)> <fontsize> <vertical offset> <width significant?> <text string>] */
430 "/MFshow {{dup dup 0 get findfont exch 1 get scalefont setfont\n",
431 " [ currentpoint ] exch dup 2 get 0 exch rmoveto dup 4 get show dup\n",
432 " 3 get {2 get neg 0 exch rmoveto pop} {pop aload pop moveto}ifelse} forall} bind def\n",
433 "/MFwidth {0 exch {dup 3 get{dup dup 0 get findfont exch 1 get scalefont setfont\n",
434 " 4 get stringwidth pop add}\n",
435 " {pop} ifelse} forall} bind def\n",
437 /* flush left show */
438 "/MLshow { currentpoint stroke M\n",
439 " 0 exch R MFshow } bind def\n",
441 /* flush right show */
442 "/MRshow { currentpoint stroke M\n",
443 " exch dup MFwidth neg 3 -1 roll R MFshow } def\n",
446 "/MCshow { currentpoint stroke M\n",
447 " exch dup MFwidth -2 div 3 -1 roll R MFshow } def\n",
451 /* added to post by Matt Heffron <heffron@falstaff.css.beckman.com> */
452 /* moved to post.trm by drd */
454 struct NEXT_FontName {
456 struct NEXT_FontName *next;
457 } *NEXT_DocFonts = NULL;
460 NEXT_DEFAULT, NEXT_MONOCHROME, NEXT_COLOR,
461 NEXT_SOLID, NEXT_DASHED,
462 NEXT_SIMPLEX, NEXT_DUPLEX, NEXT_DEFAULTPLEX,
463 NEXT_OLD, NEXT_NEW, NEXT_TITLE,
467 static struct gen_table NEXT_opts[] =
469 { "d$efault", NEXT_DEFAULT },
470 { "mono$chrome", NEXT_MONOCHROME },
471 { "col$or", NEXT_COLOR },
472 { "col$our", NEXT_COLOR },
473 { "so$lid", NEXT_SOLID },
474 { "da$shed", NEXT_DASHED },
475 { "si$mplex", NEXT_SIMPLEX },
476 { "du$plex", NEXT_DUPLEX },
477 { "defaultp$lex", NEXT_DEFAULTPLEX },
480 { "ti$tle", NEXT_TITLE },
490 while (!END_OF_COMMAND) {
491 switch(lookup_table(&NEXT_opts[0],c_token)) {
493 NEXT_oldterminal = FALSE;
494 /*NEXT_color=NEXT_colordetect(); */
497 NEXT_duplex_option = FALSE;
498 strcpy(NEXT_font, "Helvetica");
500 term->v_char = (unsigned int) (NEXT_fontsize * NEXT_SC);
501 term->h_char = (unsigned int) (NEXT_fontsize * NEXT_SC * 6 / 10);
502 term->put_text = NEXT_put_text;
505 case NEXT_MONOCHROME:
522 NEXT_duplex_state = FALSE;
523 NEXT_duplex_option = TRUE;
527 NEXT_duplex_state = TRUE;
528 NEXT_duplex_option = TRUE;
531 case NEXT_DEFAULTPLEX:
532 NEXT_duplex_option = FALSE;
536 NEXT_oldterminal = TRUE;
540 NEXT_oldterminal = FALSE;
545 if (!isstring(c_token)) {
546 fprintf(stderr, "usage: set term next title \"newtitle\"\n");
548 quote_str(NEXT_title, c_token, MAX_LINE_LEN + 1);
552 if (isstring(c_token)) {
553 quote_str(NEXT_font, c_token, MAX_LINE_LEN + 1);
555 /* We must have font size specified */
556 NEXT_fontsize = (int) real(const_express(&a));
557 term->v_char = (unsigned int) (NEXT_fontsize * NEXT_SC);
558 term->h_char = (unsigned int) (NEXT_fontsize * NEXT_SC * 6 / 10);
559 sprintf(NEXT_default_font, "%s,%d", NEXT_font, NEXT_fontsize);
565 sprintf(term_options, "%s %s %s %s \"%s\" %d title \"%s\"",
566 NEXT_oldterminal ? "old" : "new",
567 NEXT_color ? "color" : "monochrome",
568 NEXT_solid ? "solid" : "dashed",
569 NEXT_duplex_option ? (NEXT_duplex_state ? "duplex" : "simplex")
578 NEXT_RememberFont(char *fname)
580 struct NEXT_FontName *fnp;
582 for (fnp = NEXT_DocFonts; fnp && strcmp(fnp->name, fname); fnp = fnp->next);
584 return fnp->name; /* we must have found it in the list */
586 if (encoding == S_ENC_ISO8859_1) {
587 NEXTPrintf("/%s reencodeISO def\n", fname);
589 fnp = (struct NEXT_FontName *) gp_alloc(sizeof(struct NEXT_FontName), "PostScript Font record");
590 fnp->name = gp_alloc(1 + strlen(fname), "PostScript Font name");
591 strcpy(fnp->name, fname);
592 fnp->next = NEXT_DocFonts;
597 int NEXT_pen_x, NEXT_pen_y;
599 int NEXT_linetype_last;
600 TBOOLEAN NEXT_relative_ok;
602 /* store settings passed to common_init() for use in NEXT_graphics()
603 * are reserved for storing the term options
605 static int NEXT_common_uses_fonts;
606 static unsigned int NEXT_common_xoff, NEXT_common_yoff;
611 int uses_fonts, /* 0 for NEXT(la)tex */
612 unsigned int xoff, unsigned int yoff, /* offset - 50 for /post, 0 for NEXT(la)tex */
613 unsigned int width, unsigned int height, /* for bounding box */
614 char **dict) /* extra entries for the dictionary */
616 static char GPFAR NEXTi1[] = "%%%%Creator: gnuplot\n\
617 %%%%DocumentFonts: %s\n";
618 static char GPFAR NEXTi2[] = "%%%%EndComments\n\
619 /gnudict 120 dict def\ngnudict begin\n\
622 /gnulinewidth %.3f def\n\
627 static char GPFAR *NEXT_iso_8859_1_encoding[] =
630 "dup dup findfont dup length dict begin\n",
631 "{ 1 index /FID ne { def }{ pop pop } ifelse } forall\n",
632 "/Encoding ISOLatin1Encoding def\n",
633 "currentdict end definefont\n",
635 "/ISOLatin1Encoding [\n",
636 "/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n",
637 "/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n",
638 "/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n",
639 "/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n",
640 "/space/exclam/quotedbl/numbersign/dollar/percent/ampersand/quoteright\n",
641 "/parenleft/parenright/asterisk/plus/comma/minus/period/slash\n",
642 "/zero/one/two/three/four/five/six/seven/eight/nine/colon/semicolon\n",
643 "/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N\n",
644 "/O/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright\n",
645 "/asciicircum/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m\n",
646 "/n/o/p/q/r/s/t/u/v/w/x/y/z/braceleft/bar/braceright/asciitilde\n",
647 "/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n",
648 "/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n",
649 "/.notdef/dotlessi/grave/acute/circumflex/tilde/macron/breve\n",
650 "/dotaccent/dieresis/.notdef/ring/cedilla/.notdef/hungarumlaut\n",
651 "/ogonek/caron/space/exclamdown/cent/sterling/currency/yen/brokenbar\n",
652 "/section/dieresis/copyright/ordfeminine/guillemotleft/logicalnot\n",
653 "/hyphen/registered/macron/degree/plusminus/twosuperior/threesuperior\n",
654 "/acute/mu/paragraph/periodcentered/cedilla/onesuperior/ordmasculine\n",
655 "/guillemotright/onequarter/onehalf/threequarters/questiondown\n",
656 "/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla\n",
657 "/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex\n",
658 "/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis\n",
659 "/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute\n",
660 "/Thorn/germandbls/agrave/aacute/acircumflex/atilde/adieresis\n",
661 "/aring/ae/ccedilla/egrave/eacute/ecircumflex/edieresis/igrave\n",
662 "/iacute/icircumflex/idieresis/eth/ntilde/ograve/oacute/ocircumflex\n",
663 "/otilde/odieresis/divide/oslash/ugrave/uacute/ucircumflex/udieresis\n",
664 "/yacute/thorn/ydieresis\n",
669 struct termentry *t = term;
672 NEXT_common_uses_fonts = uses_fonts;
673 NEXT_common_xoff = xoff;
674 NEXT_common_yoff = yoff;
677 NEXTPrintf("%%!NEXT-Adobe-2.0\n");
679 NEXTPrintf(NEXTi1, uses_fonts ? "(atend)" : "");
681 NEXTPrintf("%%%%BoundingBox: %d %d %d %d\n", xoff, yoff,
682 (int) (xsize * width / NEXT_SC + 0.5 + xoff),
683 (int) (ysize * height / NEXT_SC + 0.5 + yoff));
686 NEXT_color ? "true" : "false",
687 NEXT_solid ? "true" : "false",
688 NEXT_LW, /* line width */
689 (int) (t->v_char) / (-3), /* shift for vertical centring */
690 NEXT_SC, /* dash length */
691 NEXT_HTIC / 2.0, /* half point width */
692 NEXT_VTIC / 2.0); /* half point height */
694 if (uses_fonts && (encoding == S_ENC_ISO8859_1)) {
695 for (i = 0; NEXT_iso_8859_1_encoding[i] != NULL; i++) {
696 NEXTPrintf("%s", NEXT_iso_8859_1_encoding[i]);
699 for (i = 0; NEXT_header[i] != NULL; i++)
700 NEXTPrintf("%s", NEXT_header[i]);
701 if (NEXT_duplex_option)
702 NEXTPrintf("statusdict begin %s setduplexmode end\n",
703 NEXT_duplex_state ? "true" : "false");
704 NEXT_RememberFont(NEXT_font);
708 NEXTPrintf("%s", *(dict++));
710 NEXTPrintf("end\n%%%%EndProlog\n");
713 /* the init fn for the NeXT Terminal driver */
718 /* Initialize output string */
719 NEXTsize = DEFAULTNEXTSIZE;
720 if ((NEXTBuffer = malloc(NEXTsize)) == NULL) {
721 printf("Malloc error in next filter init\n");
724 NEXTBufEnd = NEXTBuffer + NEXTsize;
725 NEXTBufAt = NEXTBuffer;
728 term->xmax = NEXT_XMAX;
729 term->ymax = NEXT_YMAX;
731 #ifdef NEXT_OLDTERMINAL
732 if (NEXT_oldterminal)
735 gnuTermAccess =[[GnuTermDriver alloc] init];
737 gnuTermAccess =[[GnuTermDriver alloc] init];
748 static char GPFAR NEXTg1[] = "0 setgray\nnewpath\n";
749 struct termentry *t = term;
752 NEXTBufAt = NEXTBuffer;
754 NEXT_common_init(1, NEXT_XOFF, NEXT_YOFF, term->xmax, term->ymax,
757 NEXTPrintf("gnudict begin\ngsave\n");
758 NEXTPrintf("%d %d translate\n", NEXT_common_xoff, NEXT_common_yoff);
759 NEXTPrintf("%.3f %.3f scale\n", 1.0 / NEXT_SC, 1.0 / NEXT_SC);
763 if (NEXT_common_uses_fonts)
764 NEXTPrintf("(%s) findfont %d scalefont setfont\n", NEXT_font, (t->v_char));
766 NEXT_relative_ok = FALSE;
767 NEXT_pen_x = NEXT_pen_y = -4000;
769 NEXT_linetype_last = LT_UNDEFINED;
771 #ifdef NEXT_OLDTERMINAL
772 if (NEXT_oldterminal) {
773 /* Fill window with white */
774 NEXTPrintf("1 setgray\n");
775 NEXTPrintf("0 0 %d %d rectfill\n", NEXT_XMAX, NEXT_YMAX);
776 NEXTPrintf("0 setgray\n");
790 NEXTPrintf("stroke\ngrestore\nend\n");
792 /* Terminate string */
795 if (NEXT_oldterminal) {
796 d = DPSGetCurrentContext();
797 DPSPrintf(d, NEXTBuffer);
800 /* Here's the call that dumps the string to the server */
801 [gnuTermAccess plot:NEXTBuffer];
811 NEXTPrintf("%%%%Trailer\n");
812 if (!NEXT_common_uses_fonts) {
813 NEXTPrintf("%%%%DocumentFonts: ");
814 while (NEXT_DocFonts) {
815 struct NEXT_FontName *fnp;
816 fnp = NEXT_DocFonts->next;
817 NEXTPrintf("%s%s", NEXT_DocFonts->name, fnp ? ", " : "\n");
818 free(NEXT_DocFonts->name);
827 NEXT_linetype(int linetype)
829 linetype = (linetype % 9) + 2;
832 NEXT_relative_ok = FALSE;
833 if (NEXT_linetype_last == linetype)
835 NEXT_linetype_last = linetype;
836 NEXTPrintf("LT%c\n", "ba012345678"[linetype]);
842 NEXT_move(unsigned int x, unsigned int y)
845 char abso[20], rel[20];
848 /* can't cancel all null moves--need a move after stroke'ing */
849 if (dx == 0 && dy == 0 && NEXT_relative_ok)
851 sprintf(abso, "%d %d M\n", x, y);
852 sprintf(rel, "%d %d R\n", dx, dy);
853 if (strlen(rel) < strlen(abso) && NEXT_relative_ok) {
854 NEXTPrintf("%s", rel);
857 NEXTPrintf("%s", abso);
858 NEXT_relative_ok = TRUE;
859 NEXT_path_count += 1;
866 NEXT_vector(unsigned int x, unsigned int y)
869 char abso[20], rel[20];
872 if (dx == 0 && dy == 0)
874 sprintf(abso, "%d %d L\n", x, y);
875 sprintf(rel, "%d %d V\n", dx, dy);
876 if (strlen(rel) < strlen(abso) && NEXT_relative_ok) {
877 NEXTPrintf("%s", rel);
880 NEXTPrintf("%s", abso);
881 NEXT_relative_ok = TRUE;
882 NEXT_path_count += 1;
885 if (NEXT_path_count >= 400) {
886 NEXTPrintf("currentpoint stroke M\n");
895 NEXT_text_angle(int ang)
903 NEXT_justify_text(enum JUSTIFY mode)
911 NEXT_set_font(const char *font)
916 if (!font || !(*font))
917 font = NEXT_default_font;
918 sep = strcspn(font, ",");
919 strncpy(name, font, sep);
921 size = NEXT_fontsize;
922 if (font[set] == ',')
923 sscanf(&(font[sep + 1]), "%d", &size);
924 NEXTPrintf("/%s findfont %d scalefont setfont\n", name, size * NEXT_SC);
925 NEXT_RememberFont(name);
926 term->v_char = (unsigned int) (size * NEXT_SC);
927 term->h_char = (unsigned int) (size * NEXT_SC * 6 / 10);
932 /* postscript point routines */
935 NEXT_set_pointsize(double size)
937 NEXTPrintf("/vpt %.1f def /hpt %.1f def /vpt2 vpt 2 mul def /hpt2 hpt 2 mul def\n",
938 pointsize * NEXT_VTIC * 0.5, pointsize * NEXT_HTIC * 0.5);
942 NEXT_point(unsigned int x, unsigned int y, int number)
944 static char *pointFNS[] =
945 {"Pnt", "Pls", "Crs", "Star",
946 "Box", "BoxF", "Circle", "CircleF",
947 "TriU", "TriUF", "TriD", "TriDF",
948 "Dia", "DiaF", "Pent", "PentF",
949 "C0", "C1", "C2", "C3",
950 "C4", "C5", "C6", "C7",
951 "C8", "C9", "C10", "C11",
952 "C12", "C13", "C14", "C15",
953 "S0", "S1", "S2", "S3",
954 "S4", "S5", "S6", "S7",
955 "S8", "S9", "S10", "S11",
956 "S12", "S13", "S14", "S15",
957 "D0", "D1", "D2", "D3",
958 "D4", "D5", "D6", "D7",
959 "D8", "D9", "D10", "D11",
960 "D12", "D13", "D14", "D15"
963 number = -1; /* negative types are all 'dot' */
965 number %= sizeof(pointFNS) / sizeof(pointFNS[0]) - 1;
966 NEXTPrintf("%d %d %s\n", x, y, pointFNS[number + 1]);
968 NEXT_relative_ok = 0;
970 NEXT_linetype_last = LT_UNDEFINED; /* force next linetype change */
976 /* All lifted from the enhanced postscript driver */
980 static TBOOLEAN NEXT_opened_string; /* try to cut out empty ()'s */
982 /* used in determining height of processed text */
984 static float NEXT_max_height, NEXT_min_height;
987 /* process a bit of string, and return the last character used.
988 * p is start of string
989 * brace is TRUE to keep processing to }, FALSE for do one character
990 * fontname & fontsize are obvious
991 * base is the current baseline
992 * widthflag is TRUE if the width of this should count,
993 * FALSE for zero width boxes
1001 double fontsize, double base,
1005 /* close a postscript string if it has been opened */
1006 #define NEXT_FLUSH \
1007 { if (NEXT_opened_string) \
1008 { NEXTPrintf("%s", ")]\n"); \
1009 NEXT_opened_string = FALSE; \
1014 { if (!NEXT_opened_string) \
1015 { NEXTPrintf( "[(%s) %.1f %.1f %s (", \
1016 fontname, fontsize, base, \
1017 widthflag ? "true" : "false"); \
1018 NEXT_opened_string = TRUE; \
1023 /* Start each recursion with a clean string */
1026 if (base + fontsize > NEXT_max_height) {
1027 NEXT_max_height = base + fontsize;
1029 if (base < NEXT_min_height) {
1030 NEXT_min_height = base;
1034 float f = 0; /* used for getting new font size */
1035 char *localfontname, ch;
1042 fprintf(stderr, "next driver - spurious }\n");
1047 shift = (*p == '^') ? 0.5 : -0.3;
1051 p = NEXT_recurse(p + 1, FALSE, fontname, fontsize * 0.8,
1052 base + shift * fontsize, widthflag);
1057 /*{{{ recurse (possibly with a new font) */
1059 if (*++p == '/') { /* then parse a fontname, optional fontsize */
1060 while (*++p == ' ');
1062 while ((ch = *p) > ' ' && ch != '=')
1066 /*{{{ get optional font size */
1067 f = (float) strtod(p, &p);
1070 f *= NEXT_SC; /* remember the scaling */
1083 localfontname = NEXT_RememberFont(localfontname);
1085 localfontname = fontname;
1087 localfontname = fontname;
1093 p = NEXT_recurse(p, TRUE, localfontname, f, base, widthflag);
1101 /*{{{ phantom box - prints next 'char', then restores currentpoint */
1105 p = NEXT_recurse(++p, FALSE, fontname, fontsize, base, FALSE);
1115 NEXTPrintf("%c", *p);
1120 /*{{{ is it an escape */
1123 if (p[1] == '\\' || p[1] == '(' || p[1] == ')') {
1125 NEXTPrintf("%c", '\\');
1126 } else if ((ch = p[1]) >= '0' && ch <= '7') {
1127 /* up to 3 octal digits */
1129 NEXTPrintf("%c", '\\');
1130 NEXTPrintf("%c", ch);
1132 if ((ch = p[1]) >= '0' && ch <= '7') {
1133 NEXTPrintf("%c", ch);
1135 if ((ch = p[1]) >= '0' && ch <= '7') {
1136 NEXTPrintf("%c", ch);
1143 /* just go and print it (fall into the 'default' case) */
1149 NEXTPrintf("%c", *p);
1152 /* like TeX, we only do one character in a recursion, unless it's
1158 return (p); /* the ++p in the outer copy will increment us */
1167 NEXT_put_text(unsigned int x, unsigned int y, const char *str)
1169 /* flush any pending graphics (all the XShow routines do this...) */
1174 if (NEXT_path_count) {
1175 NEXTPrintf(" stroke\n");
1176 NEXT_path_count = 0;
1177 NEXT_relative_ok = FALSE;
1182 NEXTPrintf("currentpoint gsave translate %d rotate 0 0 moveto\n",
1187 /* set up the globals */
1189 NEXT_opened_string = FALSE;
1190 NEXT_max_height = -1000;
1191 NEXT_min_height = 1000;
1193 while (*(str = NEXT_recurse(str, TRUE, NEXT_font,
1194 (double) term->v_char,
1197 NEXT_max_height += NEXT_min_height;
1199 NEXTPrintf("] %.1f ", -NEXT_max_height / 3);
1201 switch (NEXT_justify) {
1203 NEXTPrintf("MLshow\n");
1206 NEXTPrintf("MCshow\n");
1209 NEXTPrintf("MRshow\n");
1214 NEXTPrintf("grestore\n");
1215 NEXT_path_count = 0;
1216 NEXT_relative_ok = FALSE;
1225 NXScreen * mainscreen;
1227 mainscreen = [Application mainScreen];
1228 if (mainscreen->depth == NX_TwoBitGrayDepth) return(FALSE);
1233 /* This just packs all the postscript into one (possibly huge) string
1234 * which will be passed (as a fake pointer) via D.O. to the server
1238 NEXTPrintf(char *fmt,...)
1244 /* Process formatting instructions */
1246 vsprintf(NEXTTmpBuf, fmt, ap);
1250 for (pb = NEXTTmpBuf; (*pb != 0); ++pb, ++NEXTBufAt) {
1251 /* reallocate if necessary */
1252 if (NEXTBufAt >= NEXTBufEnd) {
1253 NEXToff = NEXTBufAt - NEXTBuffer;
1255 NEXTBuffer = realloc(NEXTBuffer, NEXTsize);
1256 NEXTBufEnd = NEXTBuffer + NEXTsize;
1257 NEXTBufAt = NEXTBuffer + NEXToff;
1266 /* This next section implements the GnuTermDriver object which manages
1267 the D.O. connection and interface to OBjC
1271 @protocol GnuTermServerMethods
1272 /*- (oneway) executePScode:(in char *)PStext termTitle:(in char *)title;*/
1273 - executePScode:(in char *)
1274 PStext termTitle:(in char *) title;
1278 @implementation GnuTermDriver
1282 NXConnection *myConnection;
1283 char serverpath[100], *envstring;
1284 int GnuTermPathSet = 0;
1287 /* Ask OS for connection to server */
1288 server =[NXConnection connectToName:"gnuplotServer"];
1290 /* Server is running ready to go */
1291 if (server) /*printf("Connected to server\n") */
1294 /* Server isn't running, we must fire it up */
1296 /*printf("Launching GnuTerm\n"); */
1299 /* Check for path set in environment */
1300 if ((envstring = getenv("GNUTERMPATH")) != (char *) NULL) {
1301 sprintf(serverpath, "%s/GnuTerm.app/GnuTerm", envstring);
1304 /* Not in environment */
1306 strcpy(serverpath, "GnuTerm");
1308 /* Try to launch application */
1309 if ([[Application workspace] launchApplication:serverpath] == NO) {
1310 printf("Failed to launch %s.\n", serverpath);
1311 /* Offer a little advice */
1312 if (GnuTermPathSet) {
1313 printf("You must have setenv GNUTERMPATH to something wrong\n");
1314 printf("I recommend you exit gnuplot and fix this.\n");
1316 printf("It must be located in ~/Apps or /LocalApps\n");
1317 printf("I recommend that you either\n");
1318 printf("- move GnuTerm.app to one of these locations\n");
1319 printf("- set GNUTERMPATH with host%% setenv GNUTERMPATH /directory/containing_GnuTerm.app\n");
1320 printf("- start GnuTerm ahead of the first plot command\n");
1321 #ifdef NEXT_OLDTERMINAL
1322 printf("- use the old driver version (set term next old)\n");
1326 /* I wish the gnuplot terminal interface would
1327 let me return an error here.
1330 /* Application is launching */
1332 /* Wait for it to register Server methods with OS */
1334 server =[NXConnection connectToName:"gnuplotServer"];
1335 } while (!server); /* This could result in a hang,
1336 but I've never seen it fail */
1341 /* By limiting ourselves to known protocol
1342 * we speed up the messaging
1344 [server setProtocolForProxy:@protocol(GnuTermServerMethods)];
1346 myConnection =[server connectionForProxy];
1348 /* If the server dies we want to know about it */
1349 [myConnection registerForInvalidationNotification:self];
1350 /* In fact, we'll worry about it */
1351 [NXPort worryAboutPortInvalidation];
1357 -plot:(char *) PSstr;
1359 /* If server has become invalid, re-initialize */
1363 /* This is where we send the huge postscript string to the server
1365 The D.O. system doesn't actually give this pointer to the server.
1366 The pointer is dereferenced on the client side and the
1367 resulting data is sent to the server. On the server side,
1368 space for the data is automatically allocated, and a pointer to
1369 the local data is received.
1370 For details check out:
1371 /NextLibrary/Documentation/NextDev/GeneralRef/06_DistributedObjects/IntroDistObjects.rtf
1374 /*printf("Calling server..."); */
1375 [server executePScode: PSstr termTitle:NEXT_title];
1376 /*printf("returned\n"); */
1382 /* This gets called by OS if server goes down */
1383 -senderIsInvalid:(id) sender
1390 #ifdef NEXT_OLDTERMINAL
1395 float width, height;
1397 width = (xsize * (NEXT_XMAX) / NEXT_SC + 0.5 + NEXT_XOFF);
1398 height = (ysize * (NEXT_YMAX) / NEXT_SC + 0.5 + NEXT_YOFF);
1400 NXApp =[EpsViewer new];
1401 [NXApp windowCreate: width Height:height];
1404 @implementation EpsViewer
1406 - windowCreate:(NXCoord)
1407 width Height:(NXCoord) height
1410 /* create the new window, in a good place */
1412 newContent: [self nextRectForWidth: width Height:height]
1413 style: NX_TITLEDSTYLE
1414 backing: NX_RETAINED
1415 buttonMask: (NX_CLOSEBUTTONMASK | NX_MINIATURIZEBUTTONMASK)
1417 /* we need to receive windowDidBecomeMain: and windowDidResignMain: */
1418 [theNewWin setDelegate:self];
1420 * create a new View, make it the contentView of our new window,
1421 * and destroy the window's old contentView
1423 [[theNewWin setContentView:[[View alloc] init]] free];
1424 /* display the window, and bring it forth */
1425 [theNewWin display];
1426 [theNewWin makeKeyAndOrderFront:self];
1427 /* [theNewWin orderBack:self]; */
1428 /* show the frame */
1432 /***************************************************************************/
1433 /* nextRectForWidth:Height: - return the next good content rectangle */
1434 /* from Carl F. Sutter's wonderful ViewGif2 'Controller' method... */
1435 /***************************************************************************/
1436 /* nextTopLeft - return the next good top left window position */
1437 /***************************************************************************/
1439 -(NXRect *) nextRectForWidth:(NXCoord)
1440 width Height:(NXCoord) height
1443 #define MAX_STEPS 20
1444 #define INITIAL_X 356.0
1445 #define INITIAL_Y 241.0
1447 NXRect nxrTemp; /* used to find window height */
1448 NXRect nxrWinHeight; /* bounds of enclosing window */
1449 NXSize nxsScreen; /* size of screen */
1450 static NXRect nxrResult; /* the Answer! */
1451 static int nCurStep = 0;
1453 /* find a good top-left coord */
1454 nxpTopLeft.x = INITIAL_X + nCurStep * OFFSET;
1455 nxpTopLeft.y = INITIAL_Y + nCurStep * OFFSET;
1456 if (++nCurStep > MAX_STEPS)
1458 /* find window height using nxrTemp */
1459 nxrTemp.size.width = width;
1460 nxrTemp.size.height = height;
1461 nxrTemp.origin.x = nxrTemp.origin.y = 0;
1462 [Window getFrameRect: &nxrWinHeight forContentRect:&nxrTemp
1463 style:NX_TITLEDSTYLE];
1464 [NXApp getScreenSize:&nxsScreen];
1465 /* find the lower-left coord */
1466 nxrResult.origin.x = nxpTopLeft.x;
1467 nxrResult.origin.y = nxsScreen.height - nxrWinHeight.size.height - nxpTopLeft.y;
1468 nxrResult.size.width = width;
1469 nxrResult.size.height = height;
1470 return (&nxrResult);
1474 #endif /* NEXT_OLDTERMINAL */
1477 #endif /* TERM_BODY */
1482 TERM_TABLE_START(next_driver)
1484 "Interface to GnuTerm.app under NeXTstep",
1485 NEXT_XMAX, NEXT_YMAX, NEXT_VCHAR, NEXT_HCHAR,
1486 NEXT_VTIC, NEXT_HTIC, NEXT_options, NEXT_init, NEXT_reset,
1487 NEXT_text, null_scale, NEXT_graphics, NEXT_move, NEXT_vector,
1488 NEXT_linetype, NEXT_put_text, NEXT_text_angle,
1489 NEXT_justify_text, NEXT_point, do_arrow, NEXT_set_font,
1491 TERM_TABLE_END(next_driver)
1494 #define LAST_TERM next_driver
1496 #endif /* TERM_TABLE */
1497 #endif /* TERM_PROTO_ONLY */
1500 #define TERM_HELP_NEXT
1505 "?commands set terminal next",
1506 "?set terminal next",
1512 " Several options may be set in the next driver.",
1515 " set terminal next {<mode>} {<type> } {<color>} {<dashed>}",
1516 " {\"<fontname>\"} {<fontsize>} title {\"<newtitle>\"}",
1518 " where <mode> is `default`, which sets all options to their defaults;",
1519 " <type> is either `new` or `old`, where `old` invokes the old single window;",
1520 " <color> is either `color` or `monochrome`;",
1521 " <dashed> is either `solid` or `dashed`;",
1522 " \"<fontname>\" is the name of a valid PostScript font;",
1523 " <fontsize> is the size of the font in PostScript points; and",
1524 " <title> is the title for the GnuTerm window.",
1525 " Defaults are `new`, `monochrome`, `dashed`, \"Helvetica\", 14pt.",
1528 " set term next default",
1529 " set term next 22",
1530 " set term next color \"Times-Roman\" 14",
1531 " set term next color \"Helvetica\" 12 title \"MyPlot\"",
1532 " set term next old",
1534 " Pointsizes may be changed with `set linestyle`."
1536 #endif /* TERM_HELP */