00001
00002 subroutine save_context(idev,iwin)
00003 c
00004 c Save the context of the specified device/window.
00005 c
00006 integer context_id
00007 c
00008 id = context_id(idev,iwin,1)
00009 c
00010 if (id.gt.0) then
00011 call save_mcpak_context(id)
00012 call save_mcdraw_context(id)
00013 end if
00014 c
00015 end
00016
00017
00018 subroutine load_context(idev,iwin)
00019 c
00020 c Load the stored context for the specified device/window.
00021 c
00022 common /prompt/ iprompt
00023 integer context_id
00024 c
00025 id = context_id(idev,iwin,2)
00026 c
00027 if (id.gt.0) then
00028 c
00029 c if (iprompt.ne.0) write(6,'(a)')
00030 c $ 'Restoring graphics context. Note that x, y, and z '
00031 c $ 'are not reloaded'
00032 c
00033 call restore_mcpak_context(id)
00034 call restore_mcdraw_context(id)
00035 end if
00036 c
00037 end
00038
00039
00040 integer function context_id(idev,iwin,iopt)
00041 c
00042 c Return the index corresponding to the specified idev and iwin.
00043 c If the pair are not found, create a new entry (iopt = 1), or return
00044 c with a value of -1 (opt = 2). Also return -1 if NCMAX is exceeded.
00045 c
00046 c For now, allow up to 100 contexts (static storage!)
00047 c
00048 parameter (NCMAX = 100)
00049 c
00050 integer nc,id(NCMAX),iw(NCMAX)
00051 data nc/0/
00052 c
00053 do ic=1,nc
00054 if (id(ic).eq.idev.and.iw(ic).eq.iwin) then
00055 context_id = ic
00056 return
00057 end if
00058 end do
00059 c
00060 if (iopt.eq.2.or.nc.ge.NCMAX) then
00061 context_id = -1
00062 else
00063 nc = nc + 1
00064 id(nc) = idev
00065 iw(nc) = iwin
00066 context_id = nc
00067 end if
00068 c
00069 end