/* Hello, Emacs, this is -*-C-*-
 * $Id: mac.trm,v 1.10 2008/12/26 22:16:03 sfeam Exp $
 *
 */

/* GNUPLOT -- mac.trm */

/* Macintosh graphics terminal */

/*[
 * Copyright 1986 - 1993, 1998, 2004   Thomas Williams, Colin Kelley
 *
 * Permission to use, copy, and distribute this software and its
 * documentation for any purpose with or without fee is hereby granted,
 * provided that the above copyright notice appear in all copies and
 * that both that copyright notice and this permission notice appear
 * in supporting documentation.
 *
 * Permission to modify the software is granted, but not the right to
 * distribute the complete modified source code.  Modifications are to
 * be distributed as patches to the released version.  Permission to
 * distribute binaries produced by compiling modified sources is granted,
 * provided you
 *   1. distribute the corresponding source modifications from the
 *    released version in the form of a patch file along with the binaries,
 *   2. add special version identification to distinguish your version
 *    in addition to the base release version number,
 *   3. provide your name and address as the primary contact for the
 *    support of your modified version, and
 *   4. retain our contact information in regard to use of the base
 *    software.
 * Permission to distribute the released version of the source code along
 * with corresponding source modifications in the form of a patch file is
 * granted with same provisions 2 through 4 for binary distributions.
 *
 * This software is provided "as is" without express or implied warranty
 * to the extent permitted by applicable law.
]*/

#ifndef GOT_DRIVER_H
#include "driver.h"
#endif

#ifdef TERM_REGISTER
register_term(mac)
#endif

/******************************************************************************
*                                                                             *
* struct TERMENTRY {                                                          *
*     char *name;                                                             *
*     char *description;                                                      *
*     unsigned int xmax,ymax,v_char,h_char,v_tic,h_tic;                       *
*                                                                             *
*     void (*options) __PROTO((void));                                        *
*     void (*init) __PROTO((void));                                           *
*     void (*reset) __PROTO((void));                                          *
*     void (*text) __PROTO((void));                                           *
*     int (*scale) __PROTO((double, double));                                 *
*     void (*graphics) __PROTO((void));                                       *
*     void (*move) __PROTO((unsigned int, unsigned int));                     *
*     void (*vector) __PROTO((unsigned int, unsigned int));                   *
*     void (*linetype) __PROTO((int));                                        *
*     void (*put_text) __PROTO((unsigned int, unsigned int,const char*));     *
*     -- the following are optional. set term ensures they are not NULL       *
*     int (*text_angle) __PROTO((int));                                       *
*     int (*justify_text) __PROTO((enum JUSTIFY));                            *
*     void (*point) __PROTO((unsigned int, unsigned int,int));                *
*     void (*arrow) __PROTO((unsigned int, unsigned int, unsigned int, unsigned int,int)); *
*     int (*set_font) __PROTO((const char *font));                            *
*     void (*pointsize) __PROTO((double));                                    *
*     int flags;                                                              *
*     void (*suspend) __PROTO((void)); -- called after one plot of multiplot  *
*     void (*resume) __PROTO((void));  -- called before plots of multiplot    *
*     void (*fillbox) __PROTO((int style, unsigned int x1, unsigned int y1, unsigned)) -- clear in multiplot mode *
*     void (*linewidth) __PROTO((double linewidth));                          *
* };                                                                          *
*                                                                             *
******************************************************************************/



#ifdef TERM_PROTO

#define MAC_XMAX 494
#define MAC_YMAX 274
/*
 * #define MAC_XOFFSET (497-MAC_XMAX)
 *
 * #define MAC_XLAST (MAC_XMAX - 1)
 * #define MAC_YLAST (MAC_YMAX - 1)
 */

#define MAC_VCHAR 12	 /* monaco 9 point plain style */
#define MAC_HCHAR 6
#define MAC_VTIC 3
#define MAC_HTIC 3

void MAC_init __PROTO((void));
void MAC_graphics __PROTO((void));
void MAC_text __PROTO((void));
void MAC_linetype __PROTO((int linetype));
void MAC_move __PROTO((unsigned int x,unsigned int y));
void MAC_vector __PROTO((unsigned int x,unsigned int y));
void MAC_put_text __PROTO((unsigned int x,unsigned int y,const char *str));
int  MAC_text_angle __PROTO((int angle));
int  MAC_justify_text __PROTO((enum JUSTIFY just));
void MAC_reset __PROTO((void));
void MAC_options __PROTO((void));
void MAC_suspend __PROTO((void));
void MAC_resume __PROTO((void));
int  MAC_setfont __PROTO((char *font));
#endif /* TERM_PROTO */

#ifndef TERM_PROTO_ONLY
#ifdef TERM_BODY
#endif /* TERM_BODY */

#ifdef TERM_TABLE

TERM_TABLE_START(mac_driver)
    "macintosh", "Macintosh Graphic Window",
    MAC_XMAX, MAC_YMAX, MAC_VCHAR+1, MAC_HCHAR,
    MAC_VTIC, MAC_HTIC, MAC_options,MAC_init, MAC_reset,
    MAC_text, null_scale, MAC_graphics, MAC_move, MAC_vector,
    MAC_linetype, MAC_put_text, MAC_text_angle,
    MAC_justify_text, do_point, do_arrow,
    MAC_setfont, NULL, TERM_CAN_MULTIPLOT+TERM_BINARY,
    MAC_suspend, MAC_resume
TERM_TABLE_END(mac_driver)

#undef LAST_TERM
#define LAST_TERM mac_driver

#endif /* TERM_TABLE */
#endif /* TERM_PROTO_ONLY */

#ifdef TERM_HELP
START_HELP(mac)
"1 macintosh",
"?set terminal macintosh",
"?set term macintosh",
"?terminal macintosh",
"?term macintosh",
"?macintosh",
" Syntax:",
"      set terminal macintosh {singlewin | multiwin} {vertical | novertical}",
"                             {size <width>, <height> | default}",
"",
" 'singlewin' limits the output to a single window and is useful for animations.",
" 'multiwin' allows multiple windows.",
" 'vertical' is only valid under the gx option. With this option, rotated text",
" will be drawn vertically. novertical turns this option off.",
" size <width>, <height> overrides the graph size set in the preferences",
" dialog until it is cleared with either 'set term mac size default'",
" or 'set term mac default'.",
"",
" 'set term mac size default' sets the window size settings to those set in",
" the preferences dialog.",
"",
" 'set term mac default' sets all options to their default values.",
" Default values: nogx, multiwin, novertical.",
"",
" If you generate graphs under the multiwin option and then switch to singlewin,",
" the next plot command will cause one more window to be created. This new",
" window will be reused as long as singlewin is in effect. If you switch back",
" to multiwin, generate some graphs, and then switch to singlewin again, the",
" orginal 'singlewin' window will be resused if it is still open. Otherwise",
" a new 'singlewin' window will be created. The 'singlewin' window is not numbered."
END_HELP(mac)
#endif /* TERM_HELP */
