00001
00002 c
00003 c Copyright (c) 1986,1987,1988,1989,1990,1991,1992,1993,
00004 c by Steve McMillan, Drexel University, Philadelphia, PA.
00005 c
00006 c All rights reserved.
00007 c
00008 c Redistribution and use in source and binary forms are permitted
00009 c provided that the above copyright notice and this paragraph are
00010 c duplicated in all such forms and that any documentation,
00011 c advertising materials, and other materials related to such
00012 c distribution and use acknowledge that the software was developed
00013 c by the author named above.
00014 c
00015 c THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
00016 c IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
00017 c WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00018 c
00019 c *************************************************************
00020 c * *
00021 c * Initialization of mcpak and interface between it *
00022 c * and any "local" plotting package: *
00023 c * *
00024 c * ROUTINES mcinit(a), dev select(a), get device, weight, *
00025 c * pen (color), dev on, dev off, graphin, erase, clear, *
00026 c * invert, polyfill, bounded, eop, mcquit, display text *
00027 c * and plot. *
00028 c * *
00029 c * Also included are numbr and symbl, which use the *
00030 c * external number and symbol routines (if any) to mimic *
00031 c * the nomber and simbol calling conventions. *
00032 c * *
00033 c * For portability, no other plotting routine should *
00034 c * ever call the external routines directly. instead, *
00035 c * use plot, numbr, symbl, clear, etc. *
00036 c * *
00037 c * *
00038 c * (The above-named routines are now split among *
00039 c * several source file.) *
00040 c * *
00041 c *************************************************************
00042 c
00043 subroutine mcinit
00044 save
00045 c
00046 c Initialize device, clear screen, establish plotting
00047 c area, aspect ratio, etc.
00048 c
00049 character*80 device
00050 character *(*) dev
00051 common /plot sizes/ xsize,ysize
00052 common /plot device/ device,aspect,idev
00053 common /framesize/ nxpix,nx0,xfac,nypix,ny0,yfac
00054 common /ncar/ nxpix1,nypix1,nx01,ny01,xfac1,yfac1
00055 common /plain font/ wid
00056 common /dev status/ idevon,idevpen,idevwt
00057 common /dev details/ itek,ivers
00058 common /sunscreen/ isun
00059 common /plot offset/ iin
00060 c
00061 logical set
00062 c
00063 common /dev init/ init
00064 data init/0/
00065 c
00066 c
00067 c Entry points:
00068 c
00069 c mcinit: set up graphics, prompt for device
00070 c (or get from environment)
00071 c mcinita: set up graphics, take device as argument
00072 c
00073 c devselect: don't change graphic state, prompt for device
00074 c (or get from environment)
00075 c devselecta: don't change graphic state, take device as
00076 c argument
00077 c
00078 c-----------------------------------------------------------------------
00079 c
00080 device=' '
00081 go to 50
00082 c
00083 c-----------------------------------------------------------------------
00084 c
00085 entry mcinita(dev)
00086 device=dev
00087 c
00088 50 if (init.gt.0) return
00089 call plot setup
00090 c
00091 iclr=1
00092 if (init.lt.0) iclr=0
00093 init=1
00094 iin=1
00095 call init chars
00096 go to 100
00097 c
00098 c-----------------------------------------------------------------------
00099 c
00100 entry dev selecta(dev)
00101 device=dev
00102 go to 75
00103 c
00104 c-----------------------------------------------------------------------
00105 c
00106 entry dev select
00107 device=' '
00108 c
00109 c-----------------------------------------------------------------------
00110 c
00111 75 iin=2
00112 init = 1
00113 call devoff
00114 c
00115 c Most devices are simply "on" or "off" and have only one display.
00116 c Some combinations of devices are allowed, others are forbidden.
00117 c
00118 c Presently, allow an arbitrary number of X windows,
00119 c only have one PostScript file open at a time (but
00120 c do allow it to remain open when X is selected),
00121 c on return to an open PostScript file, append to it,
00122 c don't allow any other output channel if "Sun" is used.
00123 c
00124 c These combinations are mainly handled in getdevice.
00125 c
00126 if (idev.eq.5.or.idev.eq.6) then
00127 c
00128 c Clean up the HP plotter.
00129 c
00130 write(6,80)27,27
00131 80 format(1x,a1,'.Y',a1,'.L')
00132 read(5,*)idummy
00133 call devoff
00134 c
00135 end if
00136 c
00137 100 idevwt = 1
00138 if (idevpen.lt.0) idevpen = 0
00139 c
00140 c Determine the new device.
00141 c
00142 call get device
00143 c
00144 c Restore old settings:
00145 c
00146 call weight(idevwt)
00147 if (idevpen.gt.0) call pen(idevpen)
00148 c
00149 c (These is necessary because idevwt, idevpen may be set by getdevice.)
00150 c
00151 if (itek.eq.1.and.iclr.eq.1) then
00152 call devon
00153 call clear
00154 call devoff
00155 end if
00156 c
00157 c Force ysize/xsize = aspect ratio, so coordinate angles = physical ones.
00158 c
00159 ysize=xsize*aspect
00160 xfac=nxpix/xsize
00161 yfac=nypix/ysize
00162 if (idev.eq.2) then
00163 xfac1=nxpix1/xsize
00164 yfac1=nypix1/ysize
00165 end if
00166 c
00167 c Be careful setting up default "frame" options, as these
00168 c may reset the graphics in an unwanted manner.
00169 c
00170 if (iin.ne.1) return
00171 c
00172 call gethset(set)
00173 if (.not.set) call sethts(.25,.2)
00174 c
00175 call getmset(set)
00176 if (.not.set) call setmod(0,1,0,0,0)
00177 c
00178 call setlhe(0.)
00179 c
00180 call getfset(set)
00181 if (.not.set) then
00182 call setxtf
00183 if (itek.eq.1) call setpln
00184 end if
00185 c
00186 end