% % Class: FancyPlotWindow % SubClass: PlotWindow % % Author: Dennis Brockway % % Methods: % /new - => instance % systemdict begin /FancyPlotWindow PlotWindow [] classbegin % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % ClientMenu Stuff %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % /FntPts 16 def % % COLORS % /colorsquare { % color keyword => - /paint eq {20 20 rect setcolor fill} {pop 20 20} ifelse } def /SetTextOrFillColor { % color => - dup /ThisColor exch store /currentindex colorsmenu send { 0 {/CurrentPlotColor } 1 {/BackGroundColor } 2 {/LabelColor } 3 {/AxisColor } 4 {/NumberColor } } case exch store /Display ThisWindow send } def /colormenu [ColorDict { exch pop [exch { /paint eq {20 20 rect setcolor fill} {pop 20 20} ifelse } ] } forall] [{currentkey 0 get /SetTextOrFillColor ThisWindow send}] /new DefaultMenu send def { /LayoutStyle [8 ColorDict length 1 index div ceiling] def /StrokeSelection? true def /CellHorizGap 2 def /CellVertGap 2 def /RetainCanvas? true def } colormenu send /colorsmenu [ (Plot Color =>) colormenu (Fill Color =>) colormenu (Label Color =>) colormenu (Axis Color =>) colormenu (Number Color =>) colormenu ] /new DefaultMenu send def % % FONTS % /SetLabelOrNumberFont { % fontname => - dup /currentindex fontsmenu send { % fontname fontname indx 0 {/LabelFontName exch store /LabelFonts exch LabelFontSize} 1 {/NumberFontName exch store /NumberFonts exch NumberFontSize} } case exch findfont exch scalefont store /Display ThisWindow send } def /fontkey { findfont FntPts scalefont } def /fontmenu [ [(Times) /Times-Roman fontkey] [(\274Bold) /Times-Bold fontkey] [(\274Italic) /Times-Italic fontkey] [(\274BoldItalic) /Times-BoldItalic fontkey] [(Helvetica) /Helvetica fontkey] [(\274Bold) /Helvetica-Bold fontkey] [(\274Oblique) /Helvetica-Oblique fontkey] [(\274BoldOblique) /Helvetica-BoldOblique fontkey] [(Courier) /Courier fontkey] [(\274Bold) /Courier-Bold fontkey] [(\274Oblique) /Courier-Oblique fontkey] [(\274BoldOblique) /Courier-BoldOblique fontkey] ] [{ currentkey 1 get /FontName get /SetLabelOrNumberFont ThisWindow send}] /new DefaultMenu send def { /LayoutStyle [4 3] def /RowMajor? false def /CenterItems? false def } fontmenu send /fontsmenu [ (Label Font ->) fontmenu (Number Font ->) fontmenu ] /new DefaultMenu send def % % POINTS SIZE % /SetLabelOrNumberSize { % size => - /currentindex pointsmenu send { 0 { dup /LabelFontSize exch store LabelFontName findfont exch scalefont /LabelFonts exch store } 1 { dup /NumberFontSize exch store NumberFontName findfont exch scalefont /NumberFonts exch store } } case /Display ThisWindow send } def /pointsizemenu [(6) (8) (10) (12) (14) (16) (18) (24) (32) (64)] [{ currentkey cvi /SetLabelOrNumberSize ThisWindow send}] /new DefaultMenu send def { /LayoutStyle [2 5] def /CellHorizGap 5 def } pointsizemenu send /pointsmenu [ (Label Font Size ->) pointsizemenu (Number Font Size ->) pointsizemenu ] /new DefaultMenu send def % % OPTIONS % /SetDrawOptions { % true/false => - /currentindex optionsmenu send { 0 {/LabelXaxis? } 1 {/LabelYaxis? } 2 {/DrawBox? } 3 {/DrawXaxis? } 4 {/DrawYaxis? } 5 {/NumberXaxis? } 6 {/NumberYaxis? } } case exch store /Display ThisWindow send } def /optionmenu [(Yes) (No)] [{currentindex 0 eq /SetDrawOptions ThisWindow send}] /new DefaultMenu send def /optionsmenu [ (Label Xaxis ? ->) optionmenu (Label Yaxis ? ->) optionmenu (Draw Box ? ->) optionmenu (Draw Xaxis ? ->) optionmenu (Draw Yaxis ? ->) optionmenu (Number Xaxis ? ->) optionmenu (Number Yaxis ? ->) optionmenu ] /new DefaultMenu send def % % TICS % /SetNumberTics { % number => - /currentindex ticsmenu send { 0 { /Numdxs exch store setdxs } 1 { /Numdys exch store setdys } } case /Display ThisWindow send } def /ticsizemenu [(1) (2) (5) (10) (15) (20)] [{ currentkey cvi /SetNumberTics ThisWindow send }] /new DefaultMenu send def { /LayoutStyle [1 6] def /CellHorizGap 5 def } ticsizemenu send /ticsmenu [ (Number of X tics ->) ticsizemenu (Number of Y tics ->) ticsizemenu ] /new DefaultMenu send def % % CLEAR % /clearplot [ (Yes, really) { /Clear ThisWindow send } (No, not really) {} ] /new DefaultMenu send def % % CLientMenu Definition % /ClientMenu [ (Set Colors ->) colorsmenu (Set Fonts ->) fontsmenu (Set Font Size ->) pointsmenu (Set Tics ->) ticsmenu (Set Options ->) optionsmenu (Clear Plot ->) clearplot (Display Plot ) {/Display ThisWindow send} ( ) {} (Zap) {/destroy ThisWindow send } ] /new DefaultMenu send def classend def end % systemdict