1 /* Hello, Emacs, this is -*-C-*-
2 * $Id: mgr.trm,v 1.11 2006/07/21 02:35:47 sfeam Exp $
5 /* GNUPLOT - mgr.trm */
8 * Copyright 1986 - 1993, 1998, 2004 Thomas Williams, Colin Kelley
10 * Permission to use, copy, and distribute this software and its
11 * documentation for any purpose with or without fee is hereby granted,
12 * provided that the above copyright notice appear in all copies and
13 * that both that copyright notice and this permission notice appear
14 * in supporting documentation.
16 * Permission to modify the software is granted, but not the right to
17 * distribute the complete modified source code. Modifications are to
18 * be distributed as patches to the released version. Permission to
19 * distribute binaries produced by compiling modified sources is granted,
21 * 1. distribute the corresponding source modifications from the
22 * released version in the form of a patch file along with the binaries,
23 * 2. add special version identification to distinguish your version
24 * in addition to the base release version number,
25 * 3. provide your name and address as the primary contact for the
26 * support of your modified version, and
27 * 4. retain our contact information in regard to use of the base
29 * Permission to distribute the released version of the source code along
30 * with corresponding source modifications in the form of a patch file is
31 * granted with same provisions 2 through 4 for binary distributions.
33 * This software is provided "as is" without express or implied warranty
34 * to the extent permitted by applicable law.
38 * This file is included by ../term.c.
40 * This terminal driver supports:
41 * Mgr window system, color display
44 * Vincent Broman, broman@nosc.mil
47 * adapted to the new terminal layout by Stefan Bodewig (Dec. 1995)
57 TERM_PUBLIC void MGR_init __PROTO((void));
58 TERM_PUBLIC void MGR_graphics __PROTO((void));
59 TERM_PUBLIC void MGR_text __PROTO((void));
60 TERM_PUBLIC void MGR_linetype __PROTO((int linetype));
61 TERM_PUBLIC void MGR_move __PROTO((unsigned int x, unsigned int y));
62 TERM_PUBLIC void MGR_vector __PROTO((unsigned int x, unsigned int y));
63 TERM_PUBLIC void MGR_put_text __PROTO((unsigned int x, unsigned int y, const char *str));
64 TERM_PUBLIC void MGR_reset __PROTO((void));
71 #endif /* TERM_PROTO */
73 #ifndef TERM_PROTO_ONLY
76 #include <term.h> /* from Mgr, not gnuplot */
80 static int MGR_border = 5;
81 static int MGR_winnbr = 0;
83 static int MGR_rowcount = 24;
84 static int MGR_winwidth = MGR_XMAX;
85 static int MGR_winheight = MGR_YMAX;
86 static int MGR_vchar = MGR_VCHAR;
87 static int MGR_hchar = MGR_HCHAR;
101 if (m_gets(res) && sscanf(res, "%*s%d%d%d", &w, &h, &bor) == 3)
104 m_newwin(0, 0, MGR_winwidth + 2 * MGR_border,
105 MGR_winheight + 2 * MGR_border);
107 if (m_gets(res) && sscanf(res, "%d", &winnbr) == 1)
110 /* if no alt window is created, then the main window is used
111 * and if size is different, term_tbl updated later */
112 m_selectwin(MGR_winnbr);
116 if (m_gets(res) && sscanf(res, "%d %d", &w, &h) == 2) {
122 term->v_char = MGR_vchar;
123 term->h_char = MGR_hchar;
124 term->v_tic = MGR_vchar / 4;
125 term->h_tic = MGR_hchar / 2;
138 m_selectwin(MGR_winnbr);
139 m_setmode(M_ACTIVATE);
142 /* we permit the user to reshape the window arbitrarily.
143 do_plot calls boundary to recheck the term_tbl for each plot */
145 m_getinfo(G_WINSIZE);
146 if (m_gets(res) && sscanf(res, "%d %d", &c, &r) == 2)
149 if (m_gets(res) && sscanf(res, "%d %d %d %d", &c, &r, &w, &h) == 4) {
150 term->xmax = MGR_winwidth = w;
151 term->ymax = MGR_winheight = h;
164 m_move(0, MGR_rowcount - 1);
171 MGR_linetype(int linetype)
174 * this mapping of colors is intended for a color sun on which
175 * colors 0-23 are defined, 0 is white, 1 is black.
177 m_linecolor(B_SRC, (linetype < 0) ? 1 : (2 + (linetype % 22)));
182 MGR_move(unsigned int x, unsigned int y)
184 m_go(x, MGR_winheight - 1 - y);
189 MGR_vector(unsigned int x, unsigned int y)
191 m_draw(x, MGR_winheight - 1 - y);
196 MGR_put_text(unsigned int x, unsigned int y, const char *str)
198 MGR_move(x, y - MGR_vchar / 2);
207 m_destroywin(MGR_winnbr);
209 m_setmode(M_ACTIVATE);
213 #endif /* TERM_BODY */
217 TERM_TABLE_START(mgr_driver)
218 "mgr", "Mgr window system",
219 /* dimensions nominal, replaced during MGR_graphics call */
220 MGR_XMAX, MGR_YMAX, MGR_VCHAR, MGR_HCHAR,
221 MGR_VTIC, MGR_HTIC, options_null, MGR_init, MGR_reset,
222 MGR_text, null_scale, MGR_graphics, MGR_move, MGR_vector,
223 MGR_linetype, MGR_put_text, null_text_angle,
224 null_justify_text, do_point, do_arrow, set_font_null
225 TERM_TABLE_END(mgr_driver)
228 #define LAST_TERM mgr_driver
230 #endif /* TERM_TABLE */
231 #endif /* TERM_PROTO_ONLY */
236 "?commands set terminal mgr",
242 " The `mgr` terminal driver supports the Mgr Window system. It has no options."