[BACK]Return to mgr.trm CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / gnuplot / term

Annotation of OpenXM_contrib/gnuplot/term/mgr.trm, Revision 1.1

1.1     ! maekawa     1: /*
        !             2:  * Id: $
        !             3:  */
        !             4:
        !             5: /* GNUPLOT - mgr.trm */
        !             6:
        !             7: /*[
        !             8:  * Copyright 1986 - 1993, 1998   Thomas Williams, Colin Kelley
        !             9:  *
        !            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.
        !            15:  *
        !            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,
        !            20:  * provided you
        !            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
        !            28:  *    software.
        !            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.
        !            32:  *
        !            33:  * This software is provided "as is" without express or implied warranty
        !            34:  * to the extent permitted by applicable law.
        !            35: ]*/
        !            36:
        !            37: /*
        !            38:  * This file is included by ../term.c.
        !            39:  *
        !            40:  * This terminal driver supports:
        !            41:  *  Mgr window system, color display
        !            42:  *
        !            43:  * AUTHOR
        !            44:  *  Vincent Broman, broman@nosc.mil
        !            45:  */
        !            46: /*
        !            47:  * adapted to the new terminal layout by Stefan Bodewig (Dec. 1995)
        !            48:  */
        !            49:
        !            50: #include "driver.h"
        !            51:
        !            52: #ifdef TERM_REGISTER
        !            53: register_term(mgr)
        !            54: #endif
        !            55:
        !            56: #ifdef TERM_PROTO
        !            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, char *str));
        !            64: TERM_PUBLIC void MGR_reset __PROTO((void));
        !            65: #define MGR_XMAX 640
        !            66: #define MGR_YMAX 400
        !            67: #define MGR_VCHAR 16
        !            68: #define MGR_HCHAR 8
        !            69: #define MGR_VTIC 4
        !            70: #define MGR_HTIC 4
        !            71: #endif /* TERM_PROTO */
        !            72:
        !            73: #ifndef TERM_PROTO_ONLY
        !            74: #ifdef TERM_BODY
        !            75: #undef ESC
        !            76: #include <term.h>              /* from Mgr, not gnuplot */
        !            77:
        !            78:
        !            79:
        !            80: static int MGR_border = 5;
        !            81: static int MGR_winnbr = 0;
        !            82:
        !            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;
        !            88:
        !            89:
        !            90: TERM_PUBLIC void MGR_init()
        !            91: {
        !            92:     char res[300];
        !            93:     int winnbr;
        !            94:     int w, h, bor;
        !            95:
        !            96:     m_setup(0);
        !            97:     m_ttyset();
        !            98:
        !            99:     m_getinfo(G_SYSTEM);
        !           100:     if (m_gets(res) && sscanf(res, "%*s%d%d%d", &w, &h, &bor) == 3)
        !           101:        MGR_border = bor;
        !           102:
        !           103:     m_newwin(0, 0, MGR_winwidth + 2 * MGR_border,
        !           104:             MGR_winheight + 2 * MGR_border);
        !           105:
        !           106:     if (m_gets(res) && sscanf(res, "%d", &winnbr) == 1)
        !           107:        MGR_winnbr = winnbr;
        !           108:
        !           109:     /* if no alt window is created, then the main window is used
        !           110:      * and if size is different, term_tbl updated later */
        !           111:     m_selectwin(MGR_winnbr);
        !           112:     m_setmode(M_ABS);
        !           113:
        !           114:     m_getinfo(G_FONT);
        !           115:     if (m_gets(res) && sscanf(res, "%d %d", &w, &h) == 2) {
        !           116:        MGR_vchar = h;
        !           117:        MGR_hchar = w;
        !           118:     }
        !           119:     m_ttyreset();
        !           120:
        !           121:     term->v_char = MGR_vchar;
        !           122:     term->h_char = MGR_hchar;
        !           123:     term->v_tic = MGR_vchar / 4;
        !           124:     term->h_tic = MGR_hchar / 2;
        !           125:
        !           126:     m_selectwin(0);
        !           127:     m_flush();
        !           128: }
        !           129:
        !           130:
        !           131: TERM_PUBLIC void MGR_graphics()
        !           132: {
        !           133:     char res[32];
        !           134:     int c, r, w, h;
        !           135:
        !           136:     m_selectwin(MGR_winnbr);
        !           137:     m_setmode(M_ACTIVATE);
        !           138:     m_clear();
        !           139:
        !           140:     /* we permit the user to reshape the window arbitrarily.
        !           141:        do_plot calls boundary to recheck the term_tbl for each plot */
        !           142:     m_ttyset();
        !           143:     m_getinfo(G_WINSIZE);
        !           144:     if (m_gets(res) && sscanf(res, "%d %d", &c, &r) == 2)
        !           145:        MGR_rowcount = r;
        !           146:     m_getinfo(G_COORDS);
        !           147:     if (m_gets(res) && sscanf(res, "%d %d %d %d", &c, &r, &w, &h) == 4) {
        !           148:        term->xmax = MGR_winwidth = w;
        !           149:        term->ymax = MGR_winheight = h;
        !           150:     }
        !           151:     m_ttyreset();
        !           152:     m_flush();
        !           153: }
        !           154:
        !           155:
        !           156: TERM_PUBLIC void MGR_text()
        !           157: {
        !           158:     m_go(0, 0);
        !           159:     m_aligntext();
        !           160:     if (MGR_winnbr == 0)
        !           161:        m_move(0, MGR_rowcount - 1);
        !           162:     m_selectwin(0);
        !           163:     m_flush();
        !           164: }
        !           165:
        !           166:
        !           167: TERM_PUBLIC void MGR_linetype(linetype)
        !           168: int linetype;
        !           169: {
        !           170: /*
        !           171:  * this mapping of colors is intended for a color sun on which
        !           172:  * colors 0-23 are defined, 0 is white, 1 is black.
        !           173:  */
        !           174:     m_linecolor(B_SRC, (linetype < 0) ? 1 : (2 + (linetype % 22)));
        !           175: }
        !           176:
        !           177:
        !           178: TERM_PUBLIC void MGR_move(x, y)
        !           179: unsigned int x, y;
        !           180: {
        !           181:     m_go(x, MGR_winheight - 1 - y);
        !           182: }
        !           183:
        !           184:
        !           185: TERM_PUBLIC void MGR_vector(x, y)
        !           186: unsigned int x, y;
        !           187: {
        !           188:     m_draw(x, MGR_winheight - 1 - y);
        !           189: }
        !           190:
        !           191:
        !           192: TERM_PUBLIC void MGR_put_text(x, y, str)
        !           193: unsigned int x, y;
        !           194: char *str;
        !           195: {
        !           196:     MGR_move(x, y - MGR_vchar / 2);
        !           197:     m_aligntext();
        !           198:     m_printstr(str);
        !           199: }
        !           200:
        !           201:
        !           202: TERM_PUBLIC void MGR_reset()
        !           203: {
        !           204:     m_destroywin(MGR_winnbr);
        !           205:     MGR_winnbr = 0;
        !           206:     m_setmode(M_ACTIVATE);
        !           207:     m_flush();
        !           208: }
        !           209:
        !           210: #endif /* TERM_BODY */
        !           211:
        !           212: #ifdef TERM_TABLE
        !           213:
        !           214: TERM_TABLE_START(mgr_driver)
        !           215:     "mgr", "Mgr window system",
        !           216:     /* dimensions nominal, replaced during MGR_graphics call */
        !           217:     MGR_XMAX, MGR_YMAX, MGR_VCHAR, MGR_HCHAR,
        !           218:     MGR_VTIC, MGR_HTIC, options_null, MGR_init, MGR_reset,
        !           219:     MGR_text, null_scale, MGR_graphics, MGR_move, MGR_vector,
        !           220:     MGR_linetype, MGR_put_text, null_text_angle,
        !           221:     null_justify_text, do_point, do_arrow, set_font_null
        !           222: TERM_TABLE_END(mgr_driver)
        !           223:
        !           224: #undef LAST_TERM
        !           225: #define LAST_TERM mgr_driver
        !           226:
        !           227: #endif /* TERM_TABLE */
        !           228: #endif /* TERM_PROTO_ONLY */
        !           229:
        !           230: #ifdef TERM_HELP
        !           231: START_HELP(mgr)
        !           232: "1 mgr",
        !           233: "?commands set terminal mgr",
        !           234: "?set terminal mgr",
        !           235: "?set term mgr",
        !           236: "?terminal mgr",
        !           237: "?term mgr",
        !           238: "?mgr",
        !           239: " The `mgr` terminal driver supports the Mgr Window system.  It has no options."
        !           240: END_HELP(mgr)
        !           241: #endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>