{ @(#)DG.scp version: 2.1.2.2 date: 20 Jun 1995 } define val1,val2,val3,val4,val5,val6,val7,val8,val9,val10,val11,val12,val13, str1,str2,str3,str4,str5,arrowfg,arrowbg,arrowpat,linewid,fgcol,bgcol,patt, doit,colpikit,findtype,findstr,edtype,edcase,edword,edwrap,edback,edfind, edrep,lastformulapaste,hpval,custfmt,outline,top,bottom,left,right,prevunit,fnt {=========================================================================} function dgokcan(dx,dy,x0,y0,x1,y1,n,s) define xx0,xx1 xx0 = x0 xx1 = x1 if (x1 - x0 > 5000) xx0 = xx0 + ((x1 - x0) - 5000) / 2 xx1 = xx1 - ((x1 - x0) - 5000) / 2 end if new modal dialog box at (-1,-1) (dx,dy) name dialog box n {1 2} add push button "OK@","Cancel@" at (xx0,y0) (xx1,y1) script "DG:doit=0" dialog cancel push button select control 1 script "repaint off DG:doit=1 " & s & " repaint on" dialog default push button end function {=========================================================================} function DGGrayRange() if CTValue(4,1) = 1 select control 5 grey control select control 6 grey control else select control 5 ungrey control select field line 1 select control 6 ungrey control select field line 1 end if end function {=========================================================================} function DGPrint( printer, selectpage ) {1 2} call dgokcan(7000,3800,1000,2900,6000,3800,"Print Options"," ") {3} add custom button at (300,100) (4400,2800) outline 2 border disable control show control title "Page Information@" {4} add radio button "@All", "Range" at (550, 1000) (1750, 2200) script "on mouseup call DG:DGGrayRange() end mouseup" outline 2 border {5} add field at (2200, 700) (4100, 1050) field text "1" field justification left maximum field length 8 grey control show control name "From@" {6} add field at (2450, 1250) (4100, 1600) field text "last" field justification left maximum field length 8 grey control show control name "To@" if selectpage = -1 select control 4 radio button 1 else select control 4 radio button 2 call DG:DGGrayRange() select control 5 field text selectpage select control 6 field text selectpage end if {7} add number wheel at (1950, 1800) (4100, 2600) number wheel range 1 to 15 number wheel precision 0 number wheel step 1 show control name "Copies@" {8} add list box printer at (4600, 100) (6700, 2800) show scroll bar list box show control title "Printer@" end function {=========================================================================} function DGPreview(left, top, right, bottom, color, center, border, units, orient, pagetype, res) prevunit = units {1 2} call dgokcan(8200,7300,1600,6400,6600,7300,"Page Setup"," ") {3}add custom button at (300,80) (7900,3500) disable control outline 2 border show control title "Margins@" fill pattern 20 {4}add radio button "@Inches","C@entimeters","@Points" at (500,500) (2500,3200) script "call DG:convert()" outline 2 border select control item units show control title "Units@" {5}add text "Top" at (4400,650) (5780,900) align center no line border {6}add number wheel at (4400,900) (5800,1620) number wheel range 0 to 32768 call fixnumwhl(6, top, units) {7}add text "Left" at (2700,1920) (3300,2170) no line border {8}add number wheel at (3300,1620) (4700,2340) number wheel range 0 to 32768 call fixnumwhl(8, left, units) {9}add text "Right" at (7000,1920) (7800,2170) no line border {10}add number wheel at (5400,1620) (6800,2340) number wheel range 0 to 32768 call fixnumwhl(10, right, units) {11}add text "Bottom" at (4400,3160) (5800,3400) align center no line border {12}add number wheel at (4400,2440) (5800,3160) number wheel range 0 to 32768 call fixnumwhl(12, bottom, units) {13}add radio button "@US Letter", "U@S Legal", "@A4 Letter", "@B5 Letter" at (300, 3600) (4300, 4900) outline 2 border show control title "Paper Type@" radio button pagetype {14}add radio button "P@ortrait", "@Landscape" at (4600, 3600) (7900, 4900) outline 2 border show control title "Orientation@" radio button orient {15}add number wheel at (300, 5060) (2000, 6200) number wheel range 72 to 1440 number wheel precision 0 number wheel step 40 number wheel position res outline 2 border show control title "Resolution@" {16}add check box "@Color","Ce@nter","@Report Border" at (2500,5060) (7900,6200) outline 2 border show control title "Options@" if color <> 0 check box 1 end if if center <> 0 check box 2 end if if border <> 0 check box 3 end if end function {=========================================================================} function fixnumwhl(ctrlnum, curval, unitsel) select control ctrlnum repaint off number wheel precision choose(unitsel-1, 2, 2, 0) number wheel step choose(unitsel-1, 0.05, 0.05, 1) repaint on number wheel position curval end function {=========================================================================} function convert() define unitsel,factor,curvalue,ii unitsel = CTValue(4, 0) for ii = 6 to 12 step 2 if prevunit = 1 {inches} factor = choose(unitsel-1, 1.0, 2.54, 72) curvalue = CTValue(ii,0)*factor call fixnumwhl(ii, curvalue, unitsel) end if if prevunit = 2 {cm} factor = choose(unitsel-1, 0.3937, 1.0, 28.3465) curvalue = CTValue(ii,0)*factor call fixnumwhl(ii, curvalue, unitsel) end if if prevunit = 3 {points} factor = choose(unitsel-1, 0.01389, 0.03528, 1.0) curvalue = CTValue(ii,0)*factor call fixnumwhl(ii, curvalue, unitsel) end if end for prevunit = unitsel end function {=========================================================================} function fix(s0) define i,c,l,s1 s1="" l=length(s0) for i=1 to l c=mid(s0,i-1,1) s1=s1&c if c="""" s1=s1&"""" end if end for return s1 end function {=========================================================================} function DGCustom() val1=0 custfmt=customformat() while (val1 <> 1) new modal dialog box at (-1,-1) (5050,6300) script "on idle if DG:val1=-1 DG:val1=0 select control 4 select field text from DG:val2-1 to 255 repaint control end if end idle" name dialog box "Custom Format" {1 2 3} add push button "OK@","Cancel@","@Delete" at (0,5400) (5050,6100) select control 1 dialog default push button script "repaint off DG:doit=1 DG:custfmt=ctstring(4,0) repaint on" select control 2 dialog cancel push button script "DG:doit=0" select control 3 script "remove custom format ctstring(4,0) if not cerror() select control 5 list box custom formats if ctvalue(5,0) unselect control item ctvalue(5,0) end if select control 4 field text """" end if" {4} add field at (300,4300) (4750,5120) show control title "Format@" custfmt=customformat() field word wrap off maximum field length 255 if length(custfmt) field text custfmt end if {5} add list box "" at (300,300) (4750,4060) script "if length(ctstring(5,0)) select control 4 field text ctstring(5,0) end if on mousedoubleclick repaint off DG:doit=1 DG:custfmt=ctstring(4,0) repaint on quit dialog box end mousedoubleclick" show scroll bar list box list box custom formats if (ctvalue(5,0)) unselect control item ctvalue(5,0) end if if (val1=0 and length(custfmt)) select control item custfmt end if use dialog box if doit and length(custfmt) val2=validcustomformat(custfmt) if val2=-1 invalidate on run "format custom """&fix(custfmt)&"""" invalidate off val1=1 else message "Error in custom format." val1=-1 end if else val1=1 end if end while end function {=========================================================================} function DGCellBorder() define cellborder {1 2} call dgokcan(3200,4100,0,3200,3200,4100,"Cell Border","DG:outline=ctvalue(3,1) DG:top=ctvalue(3,4) DG:bottom=ctvalue(3,5) DG:right=ctvalue(3,3) DG:left=ctvalue(3,2)") {3} add check box "@Outline","@Left","@Right","@Top","@Bottom" at (300,200) (2700,2900) outline 2 border show control title "Type@" cellborder=cellborder() case bitand(cellborder/64,3) when 1 check box 4 when 2 three state check box 4 end case case bitand(cellborder/16,3) when 1 check box 2 when 2 three state check box 2 end case case bitand(cellborder/4,3) when 1 check box 5 when 2 three state check box 5 end case case bitand(cellborder,3) when 1 check box 3 when 2 three state check box 3 end case use dialog box { --------------------------------------------------------} if doit str1=if(outline,"O","")&if(top,if(top=1,"T",""),"t")& if(left,if(left=1,"L",""),"l")&if(bottom,if(bottom=1,"B",""),"b")& if(right,if(right=1,"R",""),"r") if length(str1) invalidate on run "cell border """&str1&"""" invalidate off end if end if end function {=========================================================================} function sheetinfo() {1 2} call dgokcan(5600,4800,500,3900,5200,4800,"Sheet Info","DG:val1=ctvalue(6,1) DG:val2=ctvalue(7,0) DG:str1=ctstring(8,0)") {3} add text "Name: "&name() at (300,300) (5300,1100) no line border {4} add text cells() & " cells,"&formulas()&" formulas,"& if(modified(),"Modified","Not modified")& if(iscircular(),",Circular references","")& if(iscalc(),",Needs to be recalculated","") at (300,1200) (5300,2100) no line border {5} add custom button at (300,1750) (5300,3800) outline 2 border show control title "Auto Save@" disable control {6} add check box "@On" at (500,2500) (1500,2950) no line border if autosaveon() check box 1 end if {7} add number wheel at (1600,2300) (5100,3000) number wheel range 0 to if(autosaveevery()*24*60>999,autosaveevery()*24*60+100,999) number wheel step 1 number wheel position autosaveevery()*24*60 show control name "Interval (minutes)@" {8} add field at (500,3200) (5100,3600) show control name "Name@" field text autosavename() use dialog box { --------------------------------------------------------} if doit invalidate on run if(val1,"auto save on","auto save off") run "auto save sheet every " & val2 / 24 / 60 run "auto save sheet name """ & str1 & """" invalidate off end if end function {=========================================================================} function DGPreviewGoto(CurPageNum) {1 2} call dgokcan(3600,2700,0,1800,3600,2700,"Goto","DG:val1=ctvalue(3,0)") {3} add number wheel at (800,100) (2800,1300) outline 2 border number wheel range 1 to 32767 number wheel step 1 number wheel position CurPageNum show control title "Page Number@" val1=0 use dialog box { --------------------------------------------------------} return val1 end function {=========================================================================} function DGFileError(prmpt,sel) define cw,w,a,b cw=150 w=length(prmpt) * cw if w < 5000 w=5000 elseif w > 10000 w=10000 end if a=0 b=w if w > 5000 a = (w-5000) / 2 b = b - a end if {1 2} call dgokcan(w,3000,a,2100,b,3000,"Error","DG:val1=ctvalue(3,0)") {3} add radio button "@All Errors","@Total Errors" at (w/2-2200,900) (w/2+2200,1500) radio button sel outline 2 border {4} add text prmpt at (300,300) (w-300,800) no line border val1=0 use dialog box { --------------------------------------------------------} return val1 end function {=========================================================================} function DGAsk(prmpt,initstr,maxlength) define fw,tw,w,a,b,mult mult = 130 fw = maxlength*mult + 130 tw = length(prmpt)*mult w=max(fw,tw)+400 if w < 3000 w=3000 elseif w > 10000 w=10000 end if if fw > 9600 fw=9600 end if if fw > tw tw = fw end if a=0 b=w if w > 5000 a = (w-5000) / 2 b = b - a end if {1,2}call dgokcan(w,2100,a,1200,b,2100,"???","DG:str1=ctstring(4,0)") {3}add text prmpt at (200,100)+(tw,600) no line border {4}add field at (200,700)+(fw,400) field text initstr maximum field length maxlength str1=initstr use dialog box { --------------------------------------------------------} return str1 end function {=========================================================================} function DGShadow() {1 2} call dgokcan(5340,6900,0,6000,5340,6900,"Shadow","DG:fgcol=ctvalue(3,0) DG:bgcol=ctvalue(4,0) DG:patt=ctvalue(5,0) DG:val1=ctvalue(6,0)") {3} add color picker at (700,100) (2400,2400) script "select control 5 pattern picker fg ctvalue(3,0) select control 7 shadow fg ctvalue(3,0)" outline 1 border color picker shadowfg() show control title "@Foreground" {4} add color picker at (2940,100) (4640,2400) script "select control 5 pattern picker bg ctvalue(4,0) select control 7 shadow bg ctvalue(4,0)" outline 1 border color picker shadowbg() show control title "@Background" {5} add pattern picker at (300,2600) (5040,3740) script "select control 7 shadow pattern ctvalue(5,0)" outline 1 border pattern picker fg shadowfg() pattern picker bg shadowbg() pattern picker shadowpattern() {6} add number wheel at (500,4500) (2800,5200) script "select control 7 shadow strength ctvalue(6,0)" number wheel range 0 to 255 number wheel step 1 number wheel position shadowstrength() show control name "Strength@" {7} add custom button at (3240,4140) (4640,5540) single line border fill pattern 0 2d drop shadow square corners shadow fg ctvalue(3,0) shadow bg ctvalue(4,0) shadow pattern ctvalue(5,0) border x offset 0 border y offset 0 shadow strength ctvalue(6,0) use dialog box { --------------------------------------------------------} if doit invalidate on run "3D chart shadow fg "&fgcol run "3D chart shadow bg "&bgcol run "3D chart shadow pattern "&patt run "3D chart shadow strength "&val1 invalidate off end if end function {=========================================================================} function getpaswrd() {1 2} call dgokcan(5200,1500,0,800,5200,1500,"Password","DG:str1=ctstring(3,0)") {3} add field at (200,200) (5000,600) field word wrap off field character 42 maximum field length 15 show control name "Password@" str1=0 use dialog box { --------------------------------------------------------} return str1 end function {=========================================================================} function getsettings() edtype=ctvalue(5,0) edcase=ctvalue(6,1) edword=ctvalue(6,2) edwrap=ctvalue(6,3) edback=ctvalue(6,4) edfind=ctstring(8,0) edrep=ctstring(10,0) end function {=========================================================================} function frupdate() case ctvalue(5,0) when 1 select control 2,3,9,10 grey control select control 6 ungrey control select control 7 show text "String to find?" when 2 select control 2,3,6,9,10 ungrey control select control 7 show text "String to find?" when 3 select control 2,3,6,9,10 grey control select control 7 show text "Line number?" end case end function {=========================================================================} function fieldfind() if edtype < 1 or edtype > 3 edtype=1 edfind="" edrep="" edcase=0 edword=0 edwrap=0 edback=0 end if new modal dialog box at (-1,-1) (8400,4400) name dialog box "Find" {1 2 3 4} add push button "@Find","@Replace","Replace @All","Cancel@" at (6100,0) (8400,4400) select control 1 dialog default push button script "repaint off DG:doit=1 call DG:getsettings() repaint on" select control 2 script "repaint off DG:doit=2 call DG:getsettings() repaint on quit dialog box" select control 3 script "repaint off DG:doit=3 call DG:getsettings() repaint on quit dialog box" select control 4 dialog cancel push button script "DG:doit=0" {5} add radio button "F@ind","Find/Re@place","@Goto Line" at (200,2200) (2600,4200) script "call DG:frupdate()" outline 2 border radio button edtype {6} add check box "@Case Sensitive","@Entire Word","@Wrap-around","@Backwards" at (2800,2200) (5600,4200) outline 2 border if edcase check box 1 end if if edword check box 2 end if if edwrap check box 3 end if if edback check box 4 end if {7} add text "String to find?" at (200,200) (5600,450) no line border {8} add field at (200,500) (5600,860) field word wrap off field text edfind maximum field length 200 {9} add text "Replace with what?" at (200,1100) (5600,1350) no line border {10} add field at (200,1400) (5600,1800) field word wrap off field text edrep maximum field length 200 call frupdate() use dialog box { --------------------------------------------------------} if doit invalidate on if edtype=3 run "goto line "&edfind else run choose(doit - 1,"find","replace","replace all") & " field text """&fix(edfind)&"""" & if(doit > 1," with """&fix(edrep)&"""","") & " options """ & if(edcase,"C","c") & if(edword,"W","w") & if(edwrap,"A","a") & if(edback,"B","b")&"""" end if invalidate off end if end function {=========================================================================} function ssfind() if edtype < 1 or edtype > 5 findtype=1 findstr="" end if {1 2} call dgokcan(5000,3500,0,2600,5000,3500,"Sheet Find", "DG:findtype=ctvalue(3,0) DG:findstr=ctstring(4,0)") {3} add radio button "@Text","@Value","@Formula","@Criteria","C@ell" at (200,200) (4800,1600) outline 2 border radio button findtype show control title "F@ind" {4} add field at (200,1800) (4800,2200) field word wrap off field text findstr maximum field length 200 use dialog box { --------------------------------------------------------} if doit invalidate on case findtype when 1 run "find text"""&fix(findstr)&"""" when 2 run "find value "&findstr when 3 run "find formula text """&fix(findstr)&"""" when 4 run "find criteria "&findstr when 5 run "select range "&findstr end case invalidate off end if end function {=========================================================================} function DGFind() if windowtype()=7 or (selectiontype(1)=3 and subselectiontype(1)=3) call fieldfind() else call ssfind() end if end function {=========================================================================} function DGColumnWidth() {1 2} call dgokcan(3060,2300,0,1400,3060,2300,"Column Width","DG:val1=ctvalue(3,0)") {3} add number wheel at (500,300) (2560,1100) outline 2 border number wheel range 0 to 1000 number wheel step 1 number wheel position 100 use dialog box { --------------------------------------------------------} if doit invalidate on run "column width "&val1 invalidate off end if end function {=========================================================================} function DGRowHeight() {1 2} call dgokcan(3060,2300,0,1400,3060,2300,"Row Height","DG:val1=ctvalue(3,0)") {3} add number wheel at (500,300) (2560,1100) outline 2 border number wheel range 0 to 1000 number wheel step 1 number wheel position 100 use dialog box { --------------------------------------------------------} if doit invalidate on run "row height "&val1 invalidate off end if end function {=========================================================================} function DGNewName(name) new modal dialog box at (-1,-1) (5800,2400) name dialog box "New Name" {1} add push button "OK@" at (2300,1600) (3500,2100) script "DG:str1=ctstring(3,0)" dialog default push button {2} add text "Invalid range name, enter new name." at (240,200) (5600,550) no line border {3} add field at (200,550) (5600,950) maximum field length 200 field text name field word wrap off str1=name use dialog box { --------------------------------------------------------} return str1 end function {=========================================================================} { **************************************************************************** Modification :- Real Time inclusion in PASTE FORMULA Funcs Changed :- pasteupdate(), DGPasteFormula() Author :- danield (c) IISC 1995 Date :- 09/02/95 Description :- Modified by DD 08/02/9a to allow Real/Time functions to be included in the 1.4.1 release so that the GO...PASTE FORMULA command includes all Real/Time functions. Also modified sscmds.rez to include all the commands in the range of 3000 to 3030. :- Modified by SH 20/06/95 to remove above functionality for Non-realtime version of Wingz Note: getenv(18) returns 1 if it is Non-realtime and 0 if it is realtime **************************************************************************** } function pasteupdate() define s,e select control 4 lastformulapaste=ctvalue(3,0) if getenv(18) = 1 if lastformulapaste=10 list box name items else s=2000+lastformulapaste*100 e=choose(lastformulapaste-1,2117,2222,2308,2409,2509,2621,2719,2833,2914) list box message items s to e end if else if lastformulapaste=11 list box name items else s=2000+lastformulapaste*100 e=choose(lastformulapaste-1,2117,2222,2308,2409,2509,2621,2719,2833,2914,3030) list box message items s to e end if end if end function {=========================================================================} function DGPasteFormula() {1 2} call dgokcan(9000,6600,2300,5600,6500,6500,"Paste Formula","DG:str1=ctstring(4,0)") if getenv(18) = 1 {3} add radio button "@Business","@Date/Time","@Logical","@Statistical","D@atabase", "@Text","Sp@readsheet","N@umeric","O@perators","@Names" at (300,300) (2400,5400) else {3} add radio button "@Business","@Date/Time","@Logical","@Statistical","D@atabase", "@Text","Sp@readsheet","N@umeric","O@perators","@RealTime","@Names" at (300,300) (2400,5400) end if script "call DG:pasteupdate()" radio button if(lastformulapaste,lastformulapaste,1) outline 2 border {4} add list box "" at (2700,300) (8700,5400) script "on mousedoubleclick DG:doit=1 DG:str1=ctstring(4,0) quit dialog box end mousedoubleclick" show scroll bar list box call pasteupdate() str1 = "" use dialog box { --------------------------------------------------------} if doit and length(str1) invalidate on if getenv(18) = 1 if lastformulapaste=10 and contains(str1," ") str1="'"&str1&"'" end if else if lastformulapaste=11 and contains(str1," ") str1="'"&str1&"'" end if end if run "put text """&str1&"""" end if invalidate off end function {=========================================================================} function numname(x0,y0,x1,y1) { assert: objects 1 and 2 are defined } {3} add text "Object #: "&number() at (x0,y0) (x1,y1) no line border {4} add field at (x0,y1+200) (x1,y1+600) field word wrap off field text name() maximum field length 15 show control name "Name@" end function {=========================================================================} function gengraf1() {1 2} call dgokcan(5800,3200,500,2500,5300,2900,"2D Chart Info","DG:str1=ctstring(4,0) DG:val1=ctvalue(5,0)") {3 4} call numname(300,200,5500,560) {5} add number wheel at (1300,1400) (4500,2100) number wheel range 1 to 200 number wheel step 1 number wheel position serieswidth() show control name "Series width@" use dialog box { --------------------------------------------------------} if doit invalidate on run "object name """&str1&"""" run "series width "&val1 invalidate off end if end function {=========================================================================} function gengraf2() {1 2} call dgokcan(5400,7000,400,6300,5000,6700,"3D Chart Info", "DG:str1=ctstring(4,0) DG:val1=ctvalue(6,0) DG:val2=ctvalue(7,0) DG:val3=ctvalue(10,1) DG:val4=ctvalue(11,0) DG:val5=ctvalue(8,0)") {3 4} call numname(300,300,5100,550) { 4 s1 name 6 v1 w/h 7 v2 d/h 10 v3 mb? 11 v4 mb pct 8 v5 wid } {5} add custom button at (300,1300) (5100, 4600) disable control outline 2 border show control title "Chart Proportions@" {6} add number wheel at (1000,1900) (4300,2600) number wheel range 10 to 1000 number wheel step 1 number wheel position wtohratio() show control name "Width to height@" {7} add number wheel at (1000,2800) (4300,3500) number wheel range 10 to 1000 number wheel step 1 number wheel position dtohratio() show control name "Depth to height@" {8} add number wheel at (1340,3700) (4300,4400) number wheel range 1 to 100 number wheel step 1 number wheel position serieswidth() show control name "Series width@" {9} add custom button at (300,4600) (5100, 6000) disable control outline 2 border show control title "Base Offset@" {10} add check box "@Manual Base" at (500,5380) (3100,5800) script "select control 11 if ctvalue(10,1) ungrey control else grey control end if" no line border if bitand(surfdisp(),16) check box 1 end if {11} add number wheel at (2630,5150) (4950,5850) show control name "Offset@" number wheel range 0 to 255 number wheel step 1 number wheel position int(surfcont() / 256) if not ctvalue(10,1) grey control end if use dialog box { --------------------------------------------------------} if doit invalidate on run "object name """&str1&"""" run "3D width height "&val1 run "3D depth height "&val2 run "manual base placement "&if(val3,val4&" percent","off") run "series width "&val5 invalidate off end if end function {=========================================================================} function piegraf() {1 2} call dgokcan(5400,6300,1000,5700,5000,6000,"Pie Chart Info","DG:str1=ctstring(4,0) DG:val1=ctvalue(5,0) DG:val2=ctvalue(6,0) DG:val3=ctvalue(7,0) DG:str2=ctstring(8,0)") {3 4} call numname(300,300,5100,660) {5} add radio button "Non@e","Ascending","Descending" at (2800,1400) (5100,3700) show control title "Sorting@" radio button piesort() + 1 outline 2 border {6} add radio button "@None","@Sum","By @Range" at (300,1400) (2600,3700) script "select control 8 if ctvalue(6,3) ungrey control else grey control end if" show control title "Weighting@" radio button pieweight() + 1 outline 2 border {7} add number wheel at (1300,4500) (4000,5300) number wheel range 0 to 360 number wheel step 1 number wheel position pieangle() show control name "Start Angle@" {8} add field at (300,3900) (5100,4300) maximum field length 200 field word wrap off show control name "Weight Range@" if not iserr(piewgtrange()) field text reference(piewgtrange()) end if if ctvalue(6,3) ungrey control else grey control end if use dialog box { --------------------------------------------------------} if doit invalidate on run "object name """&str1&"""" run "pie sorting " & choose(val1-1,"off","ascending","descending") run "pie weight" & choose(val2-1,"ing off","ing sum"," range "&str2) run "pie starting angle "&val3 invalidate off end if end function {=========================================================================} function contgraf() {1,2} call dgokcan(5400,5000,500,4500,4900,4700,"Contour Chart Info","DG:str1=ctstring(4,0) DG:val1=ctvalue(6,1) DG:val2=ctvalue(7,1) DG:val3=ctvalue(9,1) DG:val4=ctvalue(10,0)") {3 4} call numname(300,300,5100,650) {5} add custom button at (300,1500) (5100, 2500) disable control outline 2 border show control title "Options@" {6} add check box "Contour @Bands" at (500,2050) (2500,2400) script "if not ctvalue(7,1) select control 6 check box 1 end if" no line border if bitand(surfcont(),2) or (not bitand(surfcont(),8)) check box 1 end if {7} add check box "Contour @Lines" at (3000,2050) (4950,2400) script "if not ctvalue(7,1) select control 6 check box 1 end if" no line border if bitand(surfcont(),8) check box 1 end if {8} add custom button at (300,2700) (5100, 4000) disable control outline 2 border show control title "Surface Smoothing@" {9} add check box "@Smoothing" at (500,3440) (3090,3800) script "select control 10 if ctvalue(9,1) ungrey control else grey control end if" no line border if surfsmooth() > 0 check box 1 end if {10} add number wheel at (2800,3200) (5000,3900) number wheel range 1 to 50 number wheel step 1 show control name "Segments@" if ctvalue(7,1) number wheel position surfsmooth() else number wheel position 4 grey control end if use dialog box { --------------------------------------------------------} if doit invalidate on run "object name """&str1&"""" run "base contour bands "&if(val1,"on","off") run "base contour lines "&if(val2,"on","off") run "surface smoothing "&if(val3,val4,0) invalidate off end if end function {=========================================================================} function wireup() str1=ctstring(4,0) val1=ctvalue(6,0) val2=ctvalue(7,0) val3=ctvalue(9,1) val4=ctvalue(10,0) val5=ctvalue(12,1) val6=ctvalue(13,0) val7=ctvalue(15,1) val8=ctvalue(16,1) val9=ctvalue(17,1) val10=ctvalue(18,1) end function {=========================================================================} function wiregrey() select control 9,17,18 if ctvalue(15,1) ungrey control else grey control end if select control 10 if ctvalue(9,1) and ctvalue(15,1) ungrey control else grey control end if select control 13 if ctvalue(12,1) ungrey control else grey control end if end function {=========================================================================} function wiregraf() {1,2} call dgokcan(7700,8300,1000,7800,7300,8000,"Wireframe Chart Info","call DG:wireup()") {3 4} call numname(300,300,7200,550) {5} add custom button at (300,3100) (7400,4400) disable control outline 2 border show control title "Chart Proportions@" {6} add number wheel at (450,3600) (3800,4300) number wheel range 10 to 1000 number wheel step 1 number wheel position wtohratio() show control name "Width to height@" {7} add number wheel at (3900,3600) (7300,4300) number wheel range 10 to 1000 number wheel step 1 number wheel position dtohratio() show control name "Depth to height@" {8} add custom button at (300,4600) (7400,5900) disable control outline 2 border show control title "Base Offset@" {9} add check box "@Manual Base" at (500,5325) (2500,5770) script "call DG:wiregrey()" no line border if bitand(surfdisp(),16) check box 1 end if {10} add number wheel at (5200,5100) (7300,5800) show control name "Offset@" number wheel range 0 to 255 number wheel step 1 number wheel position int(surfcont() / 256) {11} add custom button at (300,6100) (7400,7400) disable control outline 2 border show control title "Surface Smoothing@" {12} add check box "@Smoothing" at (500,6825) (2500,7270) script "call DG:wiregrey()" no line border if surfsmooth() > 0 check box 1 end if {13} add number wheel at (5100,6600) (7300,7300) number wheel range 1 to 50 number wheel step 1 show control name "Segments@" if surfsmooth() number wheel position surfsmooth() else number wheel position 4 end if {14} add custom button at (300,1300) (7400,2900) disable control outline 2 border show control title "Options@" {15} add check box "@Axes" at (500,1900) (3900,2300) script "call DG:wiregrey()" no line border if surfaxes() check box 1 end if {16} add check box "Su@rface Contour Lines" at (500,2400) (3900,2800) no line border if bitand(surfcont(),4) check box 1 end if {17} add check box "Base Contour @Bands" at (4400,1900) (7200,2300) no line border if bitand(surfcont(),2) check box 1 end if {18} add check box "Base Contour @Lines" at (4400,2400) (7200,2800) no line border if bitand(surfcont(),8) check box 1 end if call wiregrey() use dialog box { --------------------------------------------------------} if doit invalidate on run "object name """&str1&"""" run "3D width height "&val1 run "3D depth height "&val2 run "manual base placement "&if(val3,val4&" percent","off") run "surface smoothing "&if(val5,val6,0) run "surface axes "&if(val7,"on","off") run "surface contour lines "&if(val8,"on","off") run "base contour bands "&if(val9,"on","off") run "base contour lines "&if(val10,"on","off") invalidate off end if end function {=========================================================================} function surfupdate() str1=ctstring(4,0) val1=ctvalue(6,0) val2=ctvalue(7,0) val3=ctvalue(9,1) val4=ctvalue(10,0) val5=ctvalue(12,1) val6=ctvalue(13,0) val7=ctvalue(15,1) val8=ctvalue(16,1) val9=ctvalue(17,1) val10=ctvalue(18,1) val11=ctvalue(19,1) val12=ctvalue(20,1) val13=ctvalue(21,1) end function {=========================================================================} function surfgrey() select control 9 if ctvalue(15,1) or ctvalue(17,1) ungrey control else grey control end if select control 10 if ctvalue(9,1) and (ctvalue(15,1) or ctvalue(17,1)) ungrey control else grey control end if select control 13 if ctvalue(12,1) ungrey control else grey control end if select control 17,18 if ctvalue(16,1) ungrey control else grey control end if select control 20,21 if (not ctvalue(15,1)) or (ctvalue(16,1) and ctvalue(17,1)) grey control else ungrey control end if end function {=========================================================================} function surfgraf() {1,2} call dgokcan(7400,9000,300,8400,7100,8700,"Surface Chart Info","call DG:surfupdate()") {3 4} call numname(300,250,7100,500) {5} add custom button at (300,3400) (7100,5500) disable control outline 2 border show control title "Chart Proportions@" {6} add number wheel at (1750,3900) (5100,4600) number wheel range 10 to 1000 number wheel step 1 number wheel position wtohratio() show control name "Width to height@" {7} add number wheel at (1750,4700) (5100,5400) number wheel range 10 to 1000 number wheel step 1 number wheel position dtohratio() show control name "Depth to height@" {8} add custom button at (300,5500) (7100,6800) disable control outline 2 border show control title "Base Offset@" {9} add check box "@Manual Base" at (500,6200) (2350,6500) script "call DG:surfgrey()" no line border if bitand(surfdisp(),16) check box 1 end if {10} add number wheel at (4880,6000) (7000,6700) show control name "Offset@" number wheel range 0 to 255 number wheel step 1 number wheel position int(surfcont() / 256) {11} add custom button at (300,6800) (7100,8100) disable control outline 2 border show control title "Surface Smoothing@" {12} add check box "@Smoothing" at (500,7500) (2350,8000) script "call DG:surfgrey()" no line border if surfsmooth() > 0 check box 1 end if {13} add number wheel at (4820,7300) (7000,8000) number wheel range 1 to 50 number wheel step 1 show control name "Segments@" if surfsmooth() number wheel position surfsmooth() else number wheel position 4 end if {14} add custom button at (300,1200) (7100,3400) disable control outline 2 border show control title "Options@" {15} add check box "@Axes" at (500,1800) (3500,2100) script "call DG:surfgrey()" no line border if surfaxes() check box 1 end if {16} add check box "@Clipping" at (500,2200) (3500,2500) script "call DG:surfgrey()" no line border if surfclip() check box 1 end if {17} add check box "@Pedestal" at (500,2600) (3500,2900) script "call DG:surfgrey()" no line border if surfbase() check box 1 end if {18} add check box "S@urface Contour Bands" at (500,3000) (3500,3300) no line border if bitand(surfcont(),1) check box 1 end if {19} add check box "Su@rface Contour Lines" at (3800,1800) (7000,2100) no line border if bitand(surfcont(),4) check box 1 end if {20} add check box "Base Contour @Bands" at (3800,2200) (7000,2500) no line border if bitand(surfcont(),2) check box 1 end if {21} add check box "Base Contour @Lines" at (3800,2600) (7000,2900) no line border if bitand(surfcont(),8) check box 1 end if call surfgrey() use dialog box { --------------------------------------------------------} if doit invalidate on run "object name """&str1&"""" run "3D width height "&val1 run "3D depth height "&val2 run "manual base placement "&if(val3,val4&" percent","off") run "surface smoothing "&if(val5,val6,0) run "surface axes "&if(val7,"on","off") if val8 run "surface pedestal "&if(val9,"on","off") run "surface contour bands "&if(val10,"on","off") run "surface clipping on" else run "surface clipping off" end if run "surface contour lines "&if(val11,"on","off") run "base contour bands "&if(val12,"on","off") run "base contour lines "&if(val13,"on","off") invalidate off end if end function {=========================================================================} function buttoninfo() {1 2} call dgokcan(6400,2300,500,1400,6000,2300,"Button Info","DG:str1=ctstring(3,0) DG:str2=ctstring(4,0) DG:val1=ctvalue(6,1)") {3} add field at (2520,300) (6100,700) field word wrap off field text name() maximum field length 200 show control name "Name@" {4} add field at (2400,800) (6100,1200) field word wrap off field text title() maximum field length 200 show control name "Title@" {5} add text "Object #: "&number() at (300,400) (2300,660) no line border {6} add check box "@Transparent" at (300,900) (2300,1200) no line border if transparent() check box 1 end if use dialog box { --------------------------------------------------------} if doit invalidate on run "object name """&str1&"""" run "control name """&str1&"""" if title() <> str2 if str2 = "" run "hide control title" else run "show control title"""&str2&"""" end if end if run if(val1,"in","")&"visible button" invalidate off end if end function {=========================================================================} function fieldupdate() str1=ctstring(4,0) str2=ctstring(5,0) val1=ctvalue(8,0) val2=ctvalue(9,0) val3=ctvalue(10,0) val4=ctvalue(11,0) val5=ctvalue(13,0) val6=ctvalue(14,1) val7=ctvalue(14,2) val8=ctvalue(14,3) val9=ctvalue(14,4) val10=ctvalue(15,0) val11=ctvalue(16,0) val12=ctvalue(17,0) end function {=========================================================================} function fieldup() define t t=ctvalue(16,0) select control 17 if t<4 grey control else ungrey control end if end function {=========================================================================} function fieldinfo() {1,2} call dgokcan(8900,7300,1000,6700,7900,7000,"Field Info","call DG:fieldupdate()") {3} add custom button at (200,600)(8700,2000) disable control outline 2 border {4} add field at (540,800) (8550,1200) field word wrap off field text name() maximum field length 255 show control name "Name@" {5} add field at (400,1400) (8550,1800) field word wrap off field text title() maximum field length 255 show control name "Title@" {6} add text "Object #: "&number() at (200,200) (3000,550) no line border {7} add custom button at (200,2050) (2900,4900) disable control outline 2 border show control title "Margins@" {8} add number wheel at (375,2500) (1475,3600) number wheel range 0 to 999 number wheel step 1 number wheel position leftindent()/20 show control title "Left@" {9} add number wheel at (1625,2500) (2725,3600) number wheel range 0 to 999 number wheel step 1 number wheel position rightindent()/20 show control title "Right@" {10} add number wheel at (375,3625) (1475,4750) number wheel range 0 to 999 number wheel step 1 number wheel position topmargin()/20 show control title "Top@" {11} add number wheel at (1625,3625) (2725,4750) number wheel range 0 to 999 number wheel step 1 number wheel position bottommargin()/20 show control title "Bottom@" {12} add custom button at (200,5000) (8700,6300) disable control outline 2 border show control title "Alignment@" {13} add number wheel at (400,5500) (3900,6200) number wheel range -999 to 999 number wheel step 1 number wheel position indent()/20 show control name "Paragraph Indent@" {14} add check box "@Locked","@Scroller","@Word wrap","@Cell note" at (3100,2050) (5800,4900) outline 2 border show control title "Options@" if locked() check box 1 end if if scrollbar() check box 2 end if if wordwrap() check box 3 end if if isnote() check box 4 end if {15} add number wheel at (4100,5500) (5920,6200) number wheel range 0 to 999 number wheel step 1 number wheel position tabs()/20 show control name "Tabs@" {16} add radio button "S@ingle","@Double","@1.5 lines","@Fixed Height", "@Extra Leading" at (6000,2050) (8700,4900) script "call DG:fieldup()" show control title "Line Space@" outline 2 border radio button linespacing() {17} add number wheel at (6450,5500) (8500,6200) number wheel range 0 to 999 number wheel step 1 number wheel position lineleading()/20 show control name "Leading@" call fieldup() use dialog box { --------------------------------------------------------} if doit invalidate on run "object name """&str1&"""" run "control name """&str1&"""" run "show control title """&str2&"""" run "left indent "&val1&" points" run "right indent "&val2&" points" run "field top margin "&val3&" points" run "field bottom margin "&val4&" points" run "indent "&val5&" points" run if(val6,"","un")&"lock field text" run if(val7,"show","hide")&" scroll bar field" run "field word wrap "&if(val8,"on","off") run "field "&if(val9,"","not")&" note" run "field tabs every "&val10&" points" run "line spacing "&choose(val11-1,"single","double","1.5", "fixed "&val12&" points","single plus "&val12&" points") invalidate off end if end function {=========================================================================} function genitem() {1 2} call dgokcan(5000,2600,0,1700,5000,2600,"Object Info","DG:str1=ctstring(4,0)") {3 4} call numname(300,200,4800,560) use dialog box { --------------------------------------------------------} if doit invalidate on run "object name """&str1&"""" invalidate off end if end function {=========================================================================} function charts() define t t=charttype() if t=0 or t=4 or t=12 or t=21 call gengraf1() elseif t>4 and t<10 call gengraf2() elseif t=10 or t=11 call piegraf() elseif t=18 call wiregraf() elseif t=19 call contgraf() elseif t=20 call surfgraf() else call genitem() end if end function {=========================================================================} function polyinfo() {1 2} call dgokcan(6000,3200,900,2400,5300,2900,"Poly Info","DG:str1=ctstring(4,0) DG:val1=ctvalue(5,0) DG:val2=ctvalue(6,1)") {3 4} call numname(300,200,5700,560) {5} add radio button "Poly@line","Poly@gon" at (2300,1500) (5700,2000) outline 2 border radio button polyclosed() + 1 {6} add check box "@Smoothing" at (500,1600) (2000,2000) if smooth() check box 1 end if no line border use dialog box { --------------------------------------------------------} if doit invalidate on run "object name """&str1&"""" run "poly"& if(val1 = 1,"line","gon") run "poly smoothing " &if(val2,"on","off") invalidate off end if end function {=========================================================================} function DGObjectInfo() case selectiontype(1) when 1 call sheetinfo() when 3 case subselectiontype(1) when 2 call buttoninfo() when 3 call fieldinfo() when 4 call charts() when 9 call polyinfo() otherwise call genitem() end case end case end function {=========================================================================} function paintpie() define ht,ht1,y1,y2,y3,y4 square window (-1.01,-1.1) (1.01,1.1) line width 20 line pattern 1 line fg black() ht=sin(ctvalue(3,0)*pi()/180) ht1=cos(ctvalue(3,0)*pi()/180)*0.1 y1=-ht+ht1 y2=ht+ht1 y3=-ht-ht1 y4=ht-ht1 move (1,0.1) segment arc (-1,y1) (1,y2) 0 for 180 open polygon move (-1,ht1) draw (-1,-ht1) segment arc (-1,y3) (1,y4) 180 for 180 draw (1,-ht1) draw (1,ht1) segment arc (-1,y1) (1,y2) 0 for -180 close polygon fill pattern 1 fill fg rgb(200,200,200) paint polygon kill polygon end function {=========================================================================} function DG3DPieView() {1 2} call dgokcan(4600,4600,0,3500,4600,4600,"3D Pie View","DG:val1=ctvalue(3,0)") {3} add slide bar at (600,220) (1400,3280) script "select control 6 repaint control" slide bar range 0 to 90 slide bar position elevation() slide bar major divisions 6 slide bar minor divisions 2 no line border {4} add text "Elevation" at (200,200) (540,3300) text rotate on align center no line border {5 gld changed numbers below} add custom button at (1500,310) (4360,3190) outline 1 border {6} add custom button at (1640,440) (4260,3060) script "on repaint call DG:paintpie() end repaint" no line border use dialog box { --------------------------------------------------------} if doit invalidate on run "elevation "&val1 invalidate off end if end function {=========================================================================} function repview() square window 3d (-0.03,-0.03,-0.03) (1.03,1.03,1.03) elevation ctvalue(3,0) rotation ctvalue(4,0) vanishing x ctvalue(5,0) vanishing y ctvalue(6,0) distance ctvalue(7,0) line width 60 move 3d (0,0,0) draw 3d (1,0,0) move 3d (0,0,0) draw 3d (0,1,0) move 3d (0,0,0) draw 3d (0,0,1) line width 20 move 3d (1,0,0) draw 3d (1,1,0) draw 3d (1,1,1) draw 3d (1,0,1) draw 3d (1,0,0) move 3d (1,1,0) draw 3d (0,1,0) draw 3d (0,1,1) draw 3d (1,1,1) move 3d (0,1,1) draw 3d (0,0,1) draw 3d (1,0,1) square window (-2,-2) (102,102) symbol color red() symbol width 40 symbol size 20 points symbol type 2 draw symbol (ctvalue(5,0),ctvalue(6,0)) end function {=========================================================================} function DG3DView() if charttype()=11 call DG3DPieView() exit function end if {1 2} call dgokcan(7100,5700,900,4800,6200,5700,"3D View","DG:val1=ctvalue(3,0) DG:val2=ctvalue(4,0) DG:val3=ctvalue(5,0) DG:val4=ctvalue(6,0) DG:val5=ctvalue(7,0)") {3} add slide bar at (600,200) (1400,3700) script "select control 8 repaint control" slide bar range 0 to 90 slide bar position elevation() slide bar major divisions 6 slide bar minor divisions 2 no line border {4} add slide bar at (1420,3650) (4900,4460) script "select control 8 repaint control" slide bar range 0 to 360 slide bar position rotation() slide bar major divisions 6 slide bar minor divisions 2 no line border {5} add number wheel at (4900,240) (6700,1440) script "select control 8 repaint control" number wheel range 0 to 100 number wheel step 1 number wheel position vanishingx() show control title "Vanishing X@" {6} add number wheel at (4900,1640) (6700,2840) script "select control 8 repaint control" number wheel range 0 to 100 number wheel step 1 number wheel position vanishingy() show control title "Vanishing Y@" {7} add number wheel at (4900,3040) (6700,4240) script "select control 8 repaint control" number wheel range 50 to 1001 number wheel step 1 number wheel position perspective() show control title "Distance@" {8} add custom button at (1450,300) (4710,3600) script "select control 5 number wheel position mousex() * 100 / 2620 select control 6 number wheel position 100 - mousey() * 100 / 2620 select control 8 repaint control on repaint call DG:repview() end repaint" outline 1 border {10} add text "Elevation" at (200,200) (600,3700) text rotate on align center no line border {11} add text "Rotation" at (1600,4500) (4600,4900) align center no line border use dialog box { --------------------------------------------------------} if doit invalidate on run "elevation "&val1 run "rotation "&val2 run "vanishing x "&val3 run "vanishing y "&val4 run "distance "&val5 invalidate off end if end function {=========================================================================} function dobars(whichone) case whichone when 1 if val4 <> ctvalue(1,0) val4=ctvalue(1,0) paint green bar val4, val5, val6 paint blue bar val4, val5, val6 end if when 2 if val5 <> ctvalue(2,0) val5=ctvalue(2,0) paint red bar val4, val5, val6 paint blue bar val4, val5, val6 end if when 3 if val6 <> ctvalue(3,0) val6=ctvalue(3,0) paint red bar val4, val5, val6 paint green bar val4, val5, val6 end if end case end function {=========================================================================} function redo() select control 1 slide bar position val1 select control 2 slide bar position val2 select control 3 slide bar position val3 val4=val1 val5=val2 val6=val3 paint red bar val4, val5, val6 paint green bar val4, val5, val6 paint blue bar val4, val5, val6 paint sample box val4, val5, val6 end function {=========================================================================} function colpik(clr) { assert no objects defined } define oldval1,oldval2,oldval3,oldval4,oldval5,oldval6,col col=colpick:colorpicker(clr,"") if iserr(col) oldval1=val1 oldval2=val2 oldval3=val3 oldval4=val4 oldval5=val5 oldval6=val6 val3=bitand(clr/65536,255) val2=bitand(clr/256,255) val1=bitand(clr,255) val4=val1 val5=val2 val6=val3 new modal dialog box at (-1,-1) (8000,7000) script "on repaint paint red bar DG:val4, DG:val5, DG:val6 paint green bar DG:val4, DG:val5, DG:val6 paint blue bar DG:val4, DG:val5, DG:val6 paint sample box DG:val4, DG:val5, DG:val6 end repaint" name dialog box "Color Picker" {1} add slide bar at (300,140) (1400,6000) script "call DG:dobars(1) paint sample box ctvalue(1,0), DG:val5, DG:val6 on mousestilldown call DG:dobars(1) end mousestilldown on mousemove paint sample box ctvalue(1,0), DG:val5, DG:val6 end mousemove" slide bar range 0.0 to 255.0 slide bar major divisions 8 slide bar minor divisions 8 outline 2 border show control title "Red@" slide bar position val1 {2} add slide bar at (2300,140) (3400,6000) script "call DG:dobars(2) paint sample box DG:val4, ctvalue(2,0), DG:val6 on mousestilldown call DG:dobars(2) end mousestilldown on mousemove paint sample box DG:val4, ctvalue(2,0), DG:val6 end mousemove" slide bar range 0.0 to 255.0 slide bar major divisions 8 slide bar minor divisions 8 outline 2 border show control title "Green@" slide bar position val2 {3} add slide bar at (4200,140) (5300,6000) script "call DG:dobars(3) paint sample box DG:val4, DG:val5, ctvalue(3,0) on mousestilldown call DG:dobars(3) end mousestilldown on mousemove paint sample box DG:val4, DG:val5, ctvalue(3,0) end mousemove" slide bar range 0.0 to 255.0 slide bar major divisions 8 slide bar minor divisions 8 outline 2 border show control title "Blue@" slide bar position val3 {4 5} add push button "OK@","Cancel@" at (1000,6300) (7000,6800) script "DG:doit=0" dialog cancel push button select control 4 script "DG:colpikit=1 DG:val1=ctvalue(1,0) DG:val2=ctvalue(2,0) DG:val3=ctvalue(3,0)" dialog default push button {6} add custom button at (5900,200) (7900,2200) script "call DG:redo()" fill bg rgb(val1,val2,val3) colpikit=0 use dialog box { --------------------------------------------------------} col=rgb(val1,val2,val3) val1=oldval1 val2=oldval2 val3=oldval3 val4=oldval4 val5=oldval5 val6=oldval6 else colpikit=clr <> col end if return col end function {=========================================================================} function DGTextColor(start) define clr {1 2 3 4 5 6} clr=colpik(textcolor()) if colpikit invalidate on run start&"text color "&clr invalidate off end if end function {=========================================================================} function DGSymbol() {1 2} call dgokcan(5340,6700,0,5800,5340,6700,"Symbol","DG:val1=ctvalue(3,0) DG:val2=ctvalue(4,0) DG:val3=ctvalue(5,0) DG:val4=ctvalue(6,0)") {3} add color picker at (300,100) (2100,2600) script "select control 4 line picker fg ctvalue(3,0) select control 5 symbol picker color ctvalue(3,0) select control 7 repaint control" outline 1 border color picker symbolcolor() show control title "Color@" {4} add line picker 5,20,40,60,80,100,200 at (2300,100) (5040,2600) script "select control 7 repaint control" outline 1 border show control title "@Line Width" line picker fg symbolcolor() line picker pattern 1 line picker symbolwidth() {5} add symbol picker at (200,2800) (5040,3940) script "select control 7 repaint control" outline 1 border symbol picker symboltype() symbol picker color symbolcolor() {6} add number wheel at (800,4400) (2600,5100) script "select control 7 repaint control" no line border number wheel range 1 to 999 number wheel step 1 number wheel position symbolsize()/20 show control name "Size@" {7} add custom button at (3240,4140) (4640,5540) script "on repaint symbol color ctvalue(3,0) symbol width ctvalue(4,0) symbol size ctvalue(6,0) points symbol type ctvalue(5,0) draw symbol (0.5,0.5) end repaint" outline 1 border use dialog box { --------------------------------------------------------} if doit invalidate on run "symbol color "&val1 run "symbol width "&val2 run "symbol type "&val3 run "symbol size "&val4&" points" invalidate off end if end function {=========================================================================} function DGScaleInfo() {1 2} call dgokcan(5600,4300,500,3300,5100,4200,"Scale Info","DG:val1=ctvalue(3,1) DG:str1=ctstring(4,0) DG:str2=ctstring(5,0) DG:val2=ctvalue(6,0) DG:val3=ctvalue(7,0) DG:str3=ctstring(8,0)") {3} add check box "@Manual Scaling" at (300,350) (2500,700) script "select control 4,5,6,7 if ctvalue(3,1) ungrey control else grey control end if" no line border if scalemanual() check box 1 end if {4} add field at (300,1000) (5300,1400) field word wrap off show control name "Minimum@" maximum field length 200 field text scaleminimum() {5} add field at (300,1500) (5300,1900) field word wrap off show control name "Maximum@" maximum field length 200 field text scalemaximum() {6} add number wheel at (500,2100) (2550,3300) number wheel range 1 to 999 number wheel step 1 number wheel position scalemajdiv() show control title "Major Div.@" {7} add number wheel at (3050,2100) (5100,3300) number wheel range 1 to 999 number wheel step 1 number wheel position scalemindiv() show control title "Minor Div.@" {8} add field at (3000,300) (5300,650) field word wrap off show control name "Log Base@" maximum field length 200 field text scalelogbase() select control 4,5,6,7 if ctvalue(3,1) ungrey control else grey control end if use dialog box { --------------------------------------------------------} if doit invalidate on if val1 run "manual scaling from "&str1&" to "&str2&" with " & val2&" major and "&val3&" minor divisions" else run "automatic scaling" end if run "axis log base "&str3 invalidate off end if end function {=========================================================================} function DGCombo() define d2 d2 = (charttype() = 4) {1 2} call dgokcan(5100,3400,0,2500,5100,3400,"Combination","DG:val1=ctvalue(3,0) DG:val2=ctvalue(4,1) DG:val3=ctvalue(5,1) DG:str1=ctstring(6,0)") {3} add radio button "@Bar","@Line","La@yer","@Step" at (200,100) (4900,1000) outline 2 border show control title "Type@" radio button combtype() {4} add check box "@Hide Legend Entry" at (300,1600) (3000,2000) no line border if comblegend() check box 1 else uncheck box 1 end if {5} add check box "S@tack" at (300,2100) (3000,2400) no line border if charttype()=4 if combstack() check box 1 else uncheck box 1 end if else grey control end if {6} add number wheel at (3200,1200) (4900,2400) number wheel range 1 to 999 number wheel step 1 number wheel position combcolumn() show control title "Column@" outline 2 border if (not d2) grey control end if use dialog box { --------------------------------------------------------} if doit invalidate on run "series type "&choose(val1-1,"bar","line","layer","step") run if(val2,"hide series legend","show series"); run if(val3,"","un")&"stack series" run "series column "&str1 invalidate off end if end function {=========================================================================} function DGLabel() {1 2} call dgokcan(4400,3900,500,3000,3900,3900,"Label","DG:val1=ctvalue(3,0) DG:val2=ctvalue(4,0)") {3} add radio button "@Hide","@Base","@Center","@Exterior" at (200,100) (2100,2700) show control title "Display@" radio button serlabeldisplay() outline 2 border {4} add radio button "@Text","@Value","@Percent" at (2300,100) (4200,2700) radio button serlabeltype() show control title "Type@" outline 2 border use dialog box { --------------------------------------------------------} if doit invalidate on run "series label "&choose(val2-1,"text","value","percent") run if(val1=1,"hide ","")&"series label "& choose(val1-1,"","base","centered","exterior") invalidate off end if end function {=========================================================================} function DGPassword() if (iserr(password(1))) message "Worksheet was opened without permission to edit password." exit function end if new modal dialog box at (-1,-1) (5200,3100) name dialog box "Password" {1 2} add push button "OK@","Cancel@" at (0,2200) (5200,3100) script "DG:doit=0" dialog cancel push button select control 1 script "repaint off DG:doit=1 DG:str1=ctstring(3,0) DG:str2=ctstring(4,0) DG:val1=ctvalue(5,1) DG:val2=ctvalue(6,1) repaint on" dialog default push button {3} add field at (300,200) (4900,600) field word wrap off maximum field length 15 show control name "Password 1@" field text password(1) {4} add field at (300,800) (4900,1200) field word wrap off maximum field length 15 show control name "Password 2@" field text password(2) {5} add check box "@Read Only" at (500,1600) (2500,2000) no line border if passwordro(2) check box 1 else uncheck box 1 end if {6} add check box "@Encrypt File" at (2500,1600) (5000,2000) no line border if encrypted() check box 1 else uncheck box 1 end if use dialog box { --------------------------------------------------------} if doit invalidate on str1="password 1 """&str1&""" password 2 """&str2&"""" if val1 str1=str1&" read only" end if run str1 run "encryption "&if(val2,"on","off") invalidate off end if end function {=========================================================================} function DGTextSize() {1 2} call dgokcan(3060,2300,0,1400,3060,2300,"Text Size","DG:val1=ctvalue(3,0)") {3} add number wheel at (500,300) (2560,1100) outline 2 border number wheel range 1 to 255 number wheel step 1 number wheel position textsize() use dialog box { --------------------------------------------------------} if doit invalidate on run "text size "&val1 invalidate off end if end function {=========================================================================} function DGScale() {1 2} call dgokcan(3060,2300,0,1400,3060,2300,"Window Scale","DG:val1=ctvalue(3,0)") {3} add number wheel at (500,300) (2560,1100) outline 2 border number wheel range 24 to 400 number wheel step 1 number wheel position round(scale()*100,0) use dialog box { --------------------------------------------------------} if doit invalidate on run "window scale "&val1&"%" invalidate off end if end function {=========================================================================} function DGIteration() {1 2} call dgokcan(6000,3100,0,2200,6000,3100,"Iteration","DG:str1=ctstring(3,0) DG:str2=ctstring(4,0) DG:val1=ctvalue(5,0)") {3} add field at (200,200) (5800,600) field word wrap off maximum field length 200 show control name "Max Change@" if not iserr(deltarange()) field text deltavalue() end if {4} add field at (330,800) (5800,1200) field word wrap off maximum field length 200 show control name "Test Cell@" if not iserr(deltarange()) field text reference(deltarange()) end if {5} add number wheel at (1000,1400) (4600,2100) show control name "Max Iterations@" number wheel range 0 to 30000 number wheel step 1 number wheel position iterations() use dialog box { --------------------------------------------------------} if doit invalidate on if str1<>"" and str2<>"" run "iterate until "&str2&" changes less than "&str1 & " max "&val1&" times" else run "iterate "&val1&" times" end if invalidate off end if end function {=========================================================================} function DGPrecision() {1 2} call dgokcan(3060,2300,0,1400,3060,2300,"Precision","DG:val1=ctvalue(3,0)") {3} add number wheel at (500,300) (2560,1100) outline 2 border number wheel range -15 to 15 number wheel step 1 number wheel position if(bitand(format(),32768),-bitand(format(),15),bitand(format(),15)) use dialog box { --------------------------------------------------------} if doit invalidate on run "precision "&val1 invalidate off end if end function {=========================================================================} function DGName() define selname,selref,i selname="" selref="" if selectiontype(1)=1 selname=rangename(selection(1)) selref=reference(selection(1)) end if while 1 {1 2} call dgokcan(6000,2400,500,1500,5500,2400,"Define Name","DG:str1=ctstring(3,0) DG:str2=ctstring(4,0)") {3} add field at (200,200) (5800,600) field word wrap off field text selname maximum field length 200 show control name " Name@" {4} add field at (200,800) (5800,1200) field word wrap off field text selref maximum field length 200 show control name "Reference@" use dialog box { --------------------------------------------------------} if doit if validrangename(str1) invalidate on run "name range """&str2&""" as """&str1&"""" invalidate off else repaint on message "Range names must begin with a letter, and contain only letters, digits, and spaces." selname=str1 continue while end if end if exit while end while end function {=========================================================================} function DGHelp(s) new modal dialog box at (-1,-1)(6600,5400) name dialog box s {1 2} add push button "OK@","Cancel@" at (800,4500)(5800,5400) script "DG:hpval=-1 DG:doit=0" dialog cancel push button select control 1 script "DG:hpval=ctvalue(3,0)" dialog default push button {3} add list box " " at (300,300) (6300,4200) script "on mousedoubleclick DG:hpval=ctvalue(3,0) quit dialog box end mousedoubleclick" show scroll bar list box show control title s end function {=========================================================================} function DGHpval() use dialog box { --------------------------------------------------------} return hpval end function {=========================================================================} function DGGenFill(f,b,p,n,s) {1 2} call dgokcan(5840,5340,500,4440,5340,5340,n,"DG:fgcol=ctvalue(3,0) DG:bgcol=ctvalue(4,0) DG:patt=ctvalue(5,0)") {3} add color picker at (900,200) (2600,2500) script "select control 5 pattern picker fg ctvalue(3,0)" outline 1 border color picker f show control title "@Foreground" {4} add color picker at (3240,200) (4940,2500) script "select control 5 pattern picker bg ctvalue(4,0)" outline 1 border color picker b show control title "@Background" {5} add pattern picker at (300,2900) (5540,4200) outline 1 border pattern picker fg f pattern picker bg b pattern picker p use dialog box { --------------------------------------------------------} if doit invalidate on run s&" fg "&fgcol run s&" bg "&bgcol run s&" pattern "&patt invalidate off end if end function {=========================================================================} function DGFill() call DGGenFill(fillfg(),fillbg(),fillpattern(),"Fill", "fill") end function {=========================================================================} function DGPlotFill() call DGGenFill(plotbrushfg(),plotbrushbg(),plotbrushpattern(),"Plot Fill","plot interior") end function {=========================================================================} function DGBaseSideFill() call DGGenFill(basesidefg(),basesidebg(),basesidepattern(),"Base Side Fill","base side") end function {=========================================================================} function DGBaseTopFill() call DGGenFill(basetopfg(),basetopbg(),basetoppattern(),"Base Top Fill","base top") end function {=========================================================================} function DGGenLine(f,b,p,w,n,s) {1 2} call dgokcan(7000,5200,0,4300,7000,5200,n,"DG:fgcol=ctvalue(3,0) DG:bgcol=ctvalue(4,0) DG:patt=ctvalue(5,0)") {3} add color picker at (300,200) (2000,2500) script "select control 5 pattern picker fg ctvalue(3,0) select control 6 line picker fg ctvalue(3,0)" outline 1 border color picker f show control title "@Foreground" {4} add color picker at (2200,200) (3900,2500) script "select control 5 pattern picker bg ctvalue(4,0) select control 6 line picker bg ctvalue(4,0)" outline 1 border color picker b show control title "@Background" {5} add pattern picker at (1000,2900) (6000,4000) script "select control 6 line picker pattern ctvalue(5,0)" outline 1 border pattern picker fg f pattern picker bg b pattern picker p {6} add line picker 5,20,40,60,80,100,200 at (4100,200) (6700,2500) script "DG:linewid=ctvalue(6,0)" outline 1 border show control title "@Line Width" line picker fg f line picker bg b line picker pattern p line picker w linewid=w use dialog box { --------------------------------------------------------} if doit invalidate on run s&" fg "&fgcol run s&" bg "&bgcol run s&" pattern "&patt run s&" width "&linewid invalidate off end if end function {=========================================================================} function drawarrow() fill fg arrowfg fill bg arrowbg fill pattern arrowpat line fg ctvalue(3,0) line bg ctvalue(4,0) line pattern ctvalue(5,0) line width linewid arrow length ctvalue(9,0) points move (0.0,0.0) draw (1.0,1.0) if (ctvalue(7,1)) draw arrowhead (1,1) (0,0) end if if (ctvalue(7,2)) draw arrowhead (0,0) (1,1) end if end function {=========================================================================} function DGGenLineArrow(f,b,p,w,n,s) arrowfg=fillfg() arrowbg=fillbg() arrowpat=fillpattern() {1 2} call dgokcan(6800,7000,900,6100,5900,7000,n,"DG:fgcol=ctvalue(3,0) DG:bgcol=ctvalue(4,0) DG:patt=ctvalue(5,0) DG:val2=ctvalue(7,1) DG:val3=ctvalue(7,2) DG:val4=ctvalue(9,0)") {3} add color picker at (300,100) (2000,2500) script "select control 5 pattern picker fg ctvalue(3,0) select control 6 line picker fg ctvalue(3,0) select control 8 repaint control" outline 1 border color picker f show control title "@Foreground" {4} add color picker at (2200,100) (3900,2500) script "select control 5 pattern picker bg ctvalue(4,0) select control 6 line picker bg ctvalue(4,0) select control 8 repaint control" outline 1 border color picker b show control title "@Background" {5} add pattern picker at (1000,2700) (5900,3900) script "select control 6 line picker pattern ctvalue(5,0) select control 8 repaint control" outline 1 border pattern picker fg f pattern picker bg b pattern picker p {6} add line picker 5,20,40,60,80,100,200 at (4100,200) (6500,2500) script "DG:linewid=ctvalue(6,0) select control 8 repaint control" outline 1 border line picker fg f line picker bg b line picker pattern p line picker w linewid=w {7} add check box "@Starting","@Ending" at (300,4100) (2000,5600) script "select control 9 if ctvalue(7,1) or ctvalue(7,2) ungrey control else grey control end if select control 8 repaint control" outline 2 border show control title "Arrow@" if bitand(arrowhead(),1) check box 1 end if if bitand(arrowhead(),2) check box 2 end if {8} add custom button at (5000,4100) (6500,5600) script "on repaint call DG:drawarrow() end repaint" outline 1 border {9} add number wheel at (2300,4500) (4700,5200) script "select control 8 repaint control" show control name "Length@" number wheel range 1 to 999 number wheel step 1 number wheel position arrowlength() / 20 if ctvalue(7,1) or ctvalue(7,2) ungrey control else grey control end if use dialog box { --------------------------------------------------------} if doit invalidate on run s&" fg "&fgcol run s&" bg "&bgcol run s&" pattern "&patt run s&" width "&linewid if val2 run if(val3,"double","back")&" arrow" else run if(val3,"single","no")&" arrow" end if run "arrow length "&val4 &" points" invalidate off end if end function {=========================================================================} function DGLine() if iserr(arrowlength()) call DGGenLine(linefg(),linebg(),linepattern(),linewidth(),"Line","line") else call DGGenLineArrow(linefg(),linebg(),linepattern(),linewidth(),"Line Arrow","line") end if end function {=========================================================================} function DGMajGrid() call DGGenLine(axismajgridfg(),axismajgridbg(),axismajgridpat(),axismajgridwidth(),"Axis Major Grid Line","axis major grid") end function {=========================================================================} function DGMinGrid() call DGGenLine(axismingridfg(),axismingridbg(),axismingridpat(),axismingridwidth(),"Axis Minor Grid Line","axis minor grid") end function {=========================================================================} function DGBaseLine() call DGGenLine(basepenfg(),basepenbg(),basepenpattern(),basepenwidth(),"Base Line","base line") end function {=========================================================================} function DGSurfaceLine() call DGGenLine(surfacepenfg(),surfacepenbg(),surfacepenpattern(),surfacepenwidth(),"Surface Line","surface line") end function {=========================================================================} function DGPlotLine() call DGGenLine(plotpenfg(),plotpenbg(),plotpenpattern(),plotpenwidth(),"Plot Interior Line","plot interior line") end function {=========================================================================} function bordup() if ctvalue(5,0) > 5 { corner and shadow set; most controls grey } val1 = ctvalue(3,0) val2 = ctvalue(4,0) select control 3,4,6,7,8,9,10,11 grey control select control 12 square corners no drop shadow if val3 <> ctvalue(5,0) val3 = ctvalue(5,0) case val3 when 6 button border when 7 outline 1 border when 8 outline 2 border end case end if else select control 3,4 ungrey control select control 12 if val1 <> ctvalue(3,0) or val3 > 5 val1 = ctvalue(3,0) case val1 when 1 square corners when 2 round corners end case end if if val2 <> ctvalue(4,0) or val3 > 5 val2= ctvalue(4,0) case val2 when 1 select control 6,7,8,9,10,11 grey control select control 6 grey control when 2 select control 6,7,8,9,10,11 ungrey control select control 6 ungrey control when 3 select control 6,7,8,9,10 ungrey control select control 6 ungrey control select control 11 grey control end case select control 12 case val2 when 1 no drop shadow when 2 2d drop shadow when 3 3d drop shadow end case end if if val3 <> ctvalue(5,0) val3 = ctvalue(5,0) case val3 when 1 no line border when 2 single line border when 3 double line border when 4 thick inner line border when 5 thick outer line border end case end if end if if fgcol <> ctvalue(6,0) fgcol=ctvalue(6,0) shadow fg fgcol select control 8 pattern picker fg fgcol select control 12 end if if bgcol <> ctvalue(7,0) bgcol=ctvalue(7,0) shadow bg bgcol select control 8 pattern picker bg bgcol select control 12 end if if patt <> ctvalue(8,0) patt=ctvalue(8,0) shadow pattern patt end if if val4 <> ctvalue(9,0) val4=ctvalue(9,0) border x offset val4 points end if if val5 <> ctvalue(10,0) val5=ctvalue(10,0) border y offset val5 points end if if val6 <> ctvalue(11,0) val6=ctvalue(11,0) shadow strength val6 end if end function {=========================================================================} function DGBorder() val1=-1 val2=-1 val3=-1 fgcol=-1 bgcol=-1 patt=-1 val4=-1 val5=-1 val6=-1 {1 2} call dgokcan(7900,8240,1500,7340,6540,8240,"Border","call DG:bordup()") {3} add radio button "S@quare","@Round" at (160,160) (2220,1420) script "call DG:bordup()" outline 2 border show control title "Corners@" radio button bitand(borderstyle(),32) / 32 + 1 {4} add radio button "@None","@2D Drop","@3D Drop" at (160,1580) (2220,3280) script "call DG:bordup()" outline 2 border show control title "Shadow@" radio button bitand(borderstyle(),3) + 1 {5} add radio button "Non@e","@Single Line","@Double Line","Thick @Inner", "Thick @Outer","B@utton","Ou@tline 1","Out@line 2" at (160,3440) (2220,6880) script "call DG:bordup()" outline 2 border radio button bitand(borderstyle(),28)/4+1 show control title "Line Type@" {6} add color picker at (2460,160) (4180,2560) script "call DG:bordup()" outline 1 border color picker borderfg() show control title "@Foreground" {7} add color picker at (4400,160) (6080,2560) script "call DG:bordup()" outline 1 border color picker borderbg() show control title "@Background" {8} add pattern picker at (2460,2920) (7740,4160) script "call DG:bordup()" outline 1 border pattern picker fg borderfg() pattern picker bg borderbg() pattern picker borderpattern() {9} add number wheel at (6340,160) (7740,1360) script "call DG:bordup()" number wheel range -999 to 999 number wheel step 1 number wheel position borderx()/20 show control title "X-offset@" {10} add number wheel at (6340,1360) (7740,2560) script "call DG:bordup()" number wheel range -999 to 999 number wheel step 1 number wheel position bordery()/20 show control title "Y-offset@" {11} add number wheel at (6340,5060) (7740,6240) script "call DG:bordup()" number wheel range 0 to 255 number wheel step 1 number wheel position borderstrength() show control title "Strength@" {12} add custom button at (2460,4540) (6200,6880) fill fg fillfg() fill bg fillbg() fill pattern fillpattern() line fg linefg() line bg linebg() line pattern linepattern() line width linewidth() call DG:bordup() use dialog box { --------------------------------------------------------} if doit invalidate on run if(val1=1,"square","round")&" corners" run choose(val2-1,"no drop","2d drop","3d drop")&" shadow" run choose(val3-1,"no line","single line","double line","thick inner line","thick outer line","button","outline 1","outline 2")&" border" run "shadow fg "&fgcol run "shadow bg "&bgcol run "shadow pattern "&patt run "border x offset "&val4&" points" run "border y offset "&val5&" points" run "shadow strength "&val6 invalidate off end if end function {=========================================================================} function DGFileDlg(isopen, buttonstring, radiostring, slctnum) if (isopen) new modal dialog box at (-1,-1)(6450, 6700) name dialog box buttonstring {1} add push button buttonstring at (350, 5950)+(1100,400) {2} add push button "Cancel@" at (2050, 5950)+(1800,400) else new modal dialog box at (-1,-1)(6450, 6300) name dialog box buttonstring {1} add push button buttonstring at (350, 5550)+(1100,400) {2} add push button "Cancel@" at (2050, 5550)+(1800,400) end if dialog cancel push button select control 1 dialog default push button {3} add list box " " at (3400, 2100)+(2700, 2400) show scroll bar list box {4} add list box " " at (350, 2100)+(2700, 2400) show scroll bar list box sort control {5} add field at (1000,350)+(5100,500) field word wrap off maximum field length 200 {6} add text " " at (2900, 1050)+(3200,350) no line border if isopen {7} add radio button radiostring, "@All Documents" at (350,4900)+(3650,800) no line border radio button slctnum else {8} add popup menu " " at (4050,4900)+(2400,1400) end if {9} add text "File:" at (350, 450)+(600, 450) no line border {10} add text "Current Directory:" at (350, 1050)+(2500, 350) no line border {11} add text "Files:" at (350,1650)+(2700,350) no line border {12} add text "Directories:" at (3400,1650)+(2700,350) no line border end function function DGFontList () {1 2} call dgokcan(4700,5500,100,4800,4600,5100,"Font","DG:fnt = ctstring(3,0)") add list box "" at (200,200) (4500,4450) script "on mousedoubleclick repaint off DG:doit=1 DG:fnt=ctstring(3,0) repaint on quit dialog box end mousedoubleclick" show scroll bar list box list box font names add control items textfont() sort control select control item textfont() top list box item textfont() use dialog box if doit run "text font """&fnt&"""" end if end function function DGRangeName(type) new modal dialog box at (-1,-1) (5000, 3500) {name dialog box type&" Range Name"} if (type="Remove") name dialog box "Remove Name" add push button "OK", "Cancel@" at (0,2850) (5000,3300) else name dialog box "Goto Name" add push button "OK", "Cancel@" at (0,2850) (5000,3300) end if dialog cancel push button select control 1 dialog default push button script "repaint off DG:str1=ctstring(3,0) repaint on" add list box "" at (200,200) (4800, 2500) script "on mousedoubleclick repaint off DG:doit=1 DG:str1=ctstring(3,0) repaint on quit dialog box end mousedoubleclick" show scroll bar list box list box range names str1="" use dialog box if length(str1) invalidate on run if(type="Remove","remove name ""","select range """)&str1&"""" invalidate off end if end function