{$U-} unit Interf(40); interface uses MemTypes, QuickDraw, OSIntf, ToolIntf,MacPrint,PackIntf,FixMath,Graf3D, Globals, Utilities,Routines,ThreeD; procedure MoveScrollBars; procedure fixPlotRect; procedure fixScrollBars; procedure ProcessContourMenu (menuid, menuitem : integer); procedure DoContent (myEvent : EventRecord; theWindow : WindowPtr); procedure ContourContent; procedure ContourScroll (dh, dv : integer); function GetITDims(var Horiz, Vert:integer;var mag:longint;var level, xOrigin, yOrigin, minData, maxData : integer) : boolean; procedure closeWindow(myWindow : WindowPtr); procedure fixOrigin(x,y : integer); procedure DoAbout; procedure DoPrint; procedure DoScrap(myWindow : windowPtr); procedure DoSave(myWindow : windowPtr); implementation var newX,newY : integer; myPict : PicHandle; clipRgn : RgnHandle; procedure MoveScrollBars; begin with ContourWindow[windowIndex]^.portRect do begin HideControl(VerticalScrollBar[windowIndex]); HideControl(HorizontalScrollBar[windowIndex]); MoveControl(VerticalScrollBar[windowIndex], right - (ScrollBarWidth - 1), top - 1); SizeControl(VerticalScrollBar[windowIndex], ScrollBarWidth, bottom + 1 - (top - 1) - (ScrollBarWidth - 1)); MoveControl(HorizontalScrollBar[windowIndex], left - 1, bottom - (ScrollBarWidth - 1)); SizeControl(HorizontalScrollBar[windowIndex], right + 1 - (left - 1) - (ScrollBarWidth - 1), ScrollBarWidth); ShowControl(HorizontalScrollBar[windowIndex]); ShowControl(VerticalScrollBar[windowIndex]); end end; procedure OffsetScrollBars (dh, dv : integer); { Offset the Scroll Bars by dh and dv - to avoid flashing them with MoveScrollBars } var R : Rect; begin R := VerticalScrollBar[windowIndex]^^.ContrlRect; OffsetRect(R, dh, dv); VerticalScrollBar[windowIndex]^^.ContrlRect := R; R := HorizontalScrollBar[windowIndex]^^.ContrlRect; OffsetRect(R, dh, dv); HorizontalScrollBar[windowIndex]^^.ContrlRect := R; end; procedure fixPlotRect; { Set plotRect to be the contents without scrollbars } begin plotRect[windowIndex] := ContourWindow[windowIndex]^.portRect; plotRect[windowIndex].bottom := plotRect[windowIndex].bottom - ScrollBarWidth + 1; plotRect[windowIndex].right := plotRect[windowIndex].right - ScrollBarWidth + 1; end; procedure fixScrollBars; { fix the maximum scroll bar value to allow scrolling to end of data, but not much further } { Or set min and max to -90 and 90 if scrollAngle } { It uses the plotRect so fixPlotRect first } begin with plotRect[windowIndex] do begin SetCtlMin(HorizontalScrollBar[windowIndex], MinDataX*currentGridSize); SetCtlMin(VerticalScrollBar[windowIndex], MinDataY*currentGridSize); SetCtlMax(HorizontalScrollBar[windowIndex], max(minDataX*currentGridSize, maxX[windowIndex] * currentGridSize - (right - left))); SetCtlMax(VerticalScrollBar[windowIndex], max(minDataY* currentGridSize, maxY[windowIndex] * currentGridSize - (bottom - top))); SetCtlValue(HorizontalScrollBar[windowIndex], max(left, minDataX* currentGridSize)); SetCtlValue(VerticalScrollBar[windowIndex], max(top, minDataY* currentGridSize)); end; end; procedure ContourContent; var newBounds : Rect; P : Point; Xgrid, Ygrid : longint; alrslt : integer; begin GetMouse(P); SelectRectangle(P, newBounds); zooming[windowIndex] := true; with newBounds do if ((right - left) <= 5) and ((bottom - top) <= 5) then begin { Zoom out centered on P } if (currentGridSize <> 1) then begin setCursor(Zorro^^); enableItem(GoodiesMenu,2); NewGridSize := currentGridSize div 2; if NewGridSize = 0 then NewGridSize := 1; with P, plotRect[windowIndex] do begin newX := (h-(right-left)) div 2; newY := (v-(bottom-top)) div 2; end; end else begin newGridSize := 1; alrslt := NoteAlert(ZBalertID, nil); end end else if ((right - left) >= currentGridSize) and ((bottom - top) >= currentGridSize) then begin { Zoom in on newBounds } setCursor(Zorro^^); enableItem(GoodiesMenu,1); enableItem(PlotMenu,3); setItem(FileMenu,4,'Print Selection ...'); setItem(EditMenu,4,'Copy Selection'); selection[windowIndex] := true; with ContourWindow[windowIndex]^.portRect do begin Xgrid := trunc(currentGridSize * longint(right - left) / (newBounds.right - newBounds.left)); Ygrid := trunc(currentGridSize * longint(bottom - top) / (newBounds.bottom - newBounds.top)); end; NewGridSize := min(Xgrid, Ygrid); { Set the origin so that points may be specified with index * currentGridSize } with newBounds do begin newX := (left*newGridSize) div currentGridSize; newY := (top*newGridSize) div currentGridSize; end; end else begin alrslt := NoteAlert(IEalertID, nil); newGridSize := currentGridSize end; flushEvents(everyEvent,0); end; procedure zoomer(level:integer); begin HideControl(VerticalScrollBar[windowIndex]); HideControl(HorizontalScrollBar[windowIndex]); currentGridSize := newGridSize; fixOrigin(newX,newY); fixPlotRect; { Force complete replot } InvalRect(ContourWindow[windowIndex]^.portRect); { Adjust scroll bar value and position } fixScrollBars; MoveScrollBars; end; procedure ContourScroll; {(dh, dv : integer)} { Determine the minimum amount of scrolling required to update the window. } { Only scroll the plotRect, without the previous update region, } { and inside the visible region. ScrollRect then returns the correct update region. } var updateRgn : RgnHandle; plotRgn : RgnHandle; copyUpdate : RgnHandle; peek : WindowPeek; ScrollR : Rect; begin SetPort(ContourWindow[windowIndex]); peek := WindowPeek(ContourWindow[windowIndex]); fixPlotRect; { first optain a copy of the current update region } copyUpdate := NewRgn; CopyRgn(peek^.updateRgn, copyUpdate); { give the region local coordinates } with ContourWindow[windowIndex]^.portBits.bounds do OffsetRgn(copyUpdate, left, top); { make a region out of the whole plotting rectangle } plotRgn := NewRgn; RectRgn(plotRgn, plotRect[windowIndex]); { remove the current update region } DiffRgn(plotRgn, copyUpdate, plotRgn); { intersect with the current visible region } SectRgn(plotRgn, ContourWindow[windowIndex]^.VisRgn, plotRgn); { Get the scrolling rectangle from the resulting regions bounding box } scrollR := plotRgn^^.rgnBBox; DisposeRgn(copyUpdate); DisposeRgn(plotRgn); { Scroll the rectangle and invalidate the returned updateRgn } updateRgn := NewRgn; ScrollRect(scrollR, dh, dv, updateRgn); InvalRgn(updateRgn); DisposeRgn(updateRgn); with ContourWindow[windowIndex]^.portRect do setOrigin(left - dh, top - dv); fixPlotRect; OffsetScrollBars(-dh, -dv); end; procedure ScrollBits; var newOrigin : point; dh, dv : INTEGER; begin with ContourWindow[windowIndex]^ do begin newOrigin.h := GetCtlValue(HorizontalScrollBar[windowIndex]); newOrigin.v := GetCtlValue(VerticalScrollBar[windowIndex]); dh := portRect.left - newOrigin.h; dv := portRect.top - newOrigin.v; ContourScroll(dh, dv); end end; procedure ScrollUp (whichControl : ControlHandle; theCode : INTEGER); begin if theCode = inUpButton then begin SetCtlValue(whichControl, GetCtlValue(whichControl) - trunc(5 * sqrt(currentGridSize))); ScrollBits end end; procedure ScrollDown (whichControl : ControlHandle; theCode : INTEGER); begin if theCode = inDownButton then begin SetCtlValue(whichControl, GetCtlValue(whichControl) + trunc(5 * sqrt(currentGridSize))); ScrollBits end end; procedure PageScroll (whichControl : ControlHandle; code, direction : INTEGER); var myPt : point; amount : integer; begin amount := PlotRect[windowIndex].bottom - PlotRect[windowIndex].top; repeat GetMouse(myPt); if TestControl(whichControl, myPt) = code then begin SetCtlValue(whichControl, GetCtlValue(whichControl) + amount * direction); ScrollBits end until not StillDown; end; procedure Scroll(myControl : ControlHandle; code : integer); var currentValue : integer; myPt : point; delta : integer; begin currentValue := GetCtlValue(myControl); case code of inUpButton : delta := -10; inDownButton : delta := 10; inPageUp : delta := -30; inPageDown : delta := 30; end; if (code = inPageUp) or (code = inPageDown) then repeat GetMouse(myPt); if TestControl(myControl,myPt) = code then begin currentValue := currentValue + delta; SetCtlValue(myControl,currentValue); end; until not StillDown else SetCtlValue(myControl,CurrentValue+delta); end; procedure DoContent; {(myEvent : EventRecord; theWindow : WindowPtr) } var thePoint : Point; theControlPart : integer; theControl : ControlHandle; t : integer; currentValue : integer; begin thePoint := myEvent.where; GlobalToLocal(thePoint); theControlPart := FindControl(thePoint, theWindow, theControl); if theControlPart <> 0 then if theWindow = ContourWindow[windowIndex] then case theControlPart of inUpButton : t := TrackControl(theControl, thePoint, @ScrollUp); inDownButton : t := TrackControl(theControl, thePoint, @ScrollDown); inPageUP : PageScroll(theControl, theControlPart, -1); inPageDown : PageScroll(theControl, theControlPart, 1); inThumb : begin t := TrackControl(theControl, thePoint, nil); ScrollBits end; otherwise end { case } else begin currentValue := GetCtlValue(theControl); if theControlPart = inThumb then t := TrackControl(theControl,thePoint,nil) else t := TrackControl(theControl,thePoint,@Scroll); if currentValue <> GetCtlValue(theControl) then begin InvalRect(myRect[windowIndex]); xTops[windowIndex] := GetCtlValue(TDHBar[windowIndex]); yTops[windowIndex] := GetCtlValue(TDVBar[windowIndex]); CreateData(xTops[windowIndex],yTops[windowIndex]); end; end else if theWindow = ContourWindow[windowIndex] then ContourContent else redrawBox; end; { DoContent } function StrtoInt (var value : integer; strng : str255): boolean; var i: integer; ok : boolean; begin value := 0; ok := true; for i := 1 to length (strng) do if ((strng [i] >= '0') and (strng [i] <= '9')) then value := (value * 10) + (ord (strng[i]) - $30) else ok := false; StrtoInt := ok and (length(strng) <> 0); end; function getITdims;{(var Horiz, Vert: integer; mag:longint; level, xOrigin, yOrigin, minData, maxData : integer) : boolean;} var aboutDITL : DialogPtr; ItemNo, rslt : integer; okHandle,thndl : handle; box : rect; numb : str255; cont, allNumbers : boolean; savePort : WindowPtr; oldmag : longint; oldLevel,oldx,oldy,oldmin,oldmax : integer; procedure restoreData; begin oldmag := mag; oldLevel := level; oldx := xOrigin; oldy := yOrigin; oldmin := minData; oldmax := maxData; GetDItem(aboutDITL,hditem,rslt,thndl,box); SetDItem(aboutDITL,hditem,statText,thndl,box); NumToString(longint(Horiz),numb); SetIText(thndl,numb); GetDItem(aboutDITL,vditem,rslt,thndl,box); SetDItem(aboutDITL,vditem,statText,thndl,box); NumToString(longint(Vert),numb); SetIText(thndl,numb); GetDItem(aboutDITL,magItem,rslt,thndl,box); NumToString(mag,numb); SetIText(thndl,numb); GetDItem(aboutDITL,levelItem,rslt,thndl,box); NumToString(longint(level),numb); SetIText(thndl,numb); GetDItem(aboutDITL,xAxisItem,rslt,thndl,box); NumToString(longint(xOrigin),numb); SetIText(thndl,numb); GetDItem(aboutDITL,yAxisItem,rslt,thndl,box); NumToString(longint(yOrigin),numb); SetIText(thndl,numb); GetDItem(aboutDITL,minItem,rslt,thndl,box); NumToString(longint(minData),numb); SetIText(thndl,numb); GetDItem(aboutDITL,maxItem,rslt,thndl,box); NumToString(longint(maxData),numb); SetIText(thndl,numb); SelIText(aboutDITL,magItem,0,4); end; begin GetPort(savePort); aboutDITL := getnewDialog(dimenID,nil,pointer(-1)); if maxData <> -1 then restoreData else SelIText(aboutDITL,hditem,0,3); setPort(aboutDITL); GetDItem(aboutDITL,okItem,rslt,okHandle,box); PenSize(3,3); InsetRect(box,-4,-4); FrameRoundRect(box,16,16); PenSize(1,1); cont := true; while cont do begin ModalDialog(nil,ItemNo); if ItemNo = cancelItem then cont := false else begin allNumbers := false; GetDItem(aboutDITL,hditem,rslt,thndl,box); GetIText(thndl,numb); if StrToInt(Horiz,numb) and (Horiz > 0) then begin GetDItem(aboutDITL,vditem,rslt,thndl,box); GetIText(thndl,numb); if StrToInt(Vert,numb) and (Vert > 0) then begin GetDItem(aboutDITL,magItem,rslt,thndl,box); GetIText(thndl,numb); if StrToInt(level,numb) and (level > 0) then begin mag := longint(level); GetDItem(aboutDITL,levelItem,rslt,thndl,box); GetIText(thndl,numb); if StrToInt(level,numb) and (level> 0) and (level <= maxLevels) then begin GetDItem(aboutDITL,xAxisItem,rslt,thndl,box); GetIText(thndl,numb); if StrToInt(xOrigin,numb) and (xOrigin <= Horiz) then begin GetDItem(aboutDITL,yAxisItem,rslt,thndl,box); GetIText(thndl,numb); if StrToInt(yOrigin,numb) and (yOrigin <= Vert) then begin GetDItem(aboutDITL,minItem,rslt,thndl,box); GetIText(thndl,numb); if StrToInt(minData,numb) and (minData >= 0) then begin GetDItem(aboutDITL,maxItem,rslt,thndl,box); GetIText(thndl,numb); if StrToInt(maxData,numb) and (maxData > minData) and (maxData <= 255) then begin if ItemNo = ok then cont := false; allNumbers := true; end; end; end; end; end; end; end; end; if allNumbers then HiliteControl(ControlHandle(okHandle),0) else HiliteControl(ControlHandle(okHandle),255); end; end; if ItemNo = CancelItem then begin GetITDims := false; mag := oldMag; level := oldLevel; xOrigin := oldx; yOrigin := oldy; minData := oldmin; maxData := oldmax; end else GetITDims := true; setPort(savePort); DisposDialog(aboutDITL); end; procedure redraw; var xlow,xhigh,ylow,yhigh : integer; begin getMatrixBounds(plotRect[windowIndex],xlow,xhigh,ylow,yhigh); if getITDims(maxX[windowIndex],maxY[windowIndex], currentGridSize, NoOfLevels[windowIndex], xlow,ylow, minData[windowIndex], maxData[windowIndex]) then begin fixOrigin(xlow*currentGridSize,ylow*currentGridSize); fixPlotRect; fixScrollBars; MoveScrollBars; CalculateLevels; InvalRect(PlotRect[windowIndex]); end; end; procedure ProcessContourMenu; begin case menuid of PlotMenuID : case menuitem of 1: begin if ThreeDWindow[windowIndex] <> nil then closeWindow(ThreeDWindow[windowIndex]); if shadeSurface[windowIndex] then begin shadeSurface[windowIndex] := false; InvalRect(plotRect[windowIndex]); CheckItem(PlotMenu,menuitem,true); CheckItem(PlotMenu,2,false); CheckItem(PlotMenu,3,false); end; end; 2 : (* Shade Surface *) begin if ThreeDWindow[windowIndex] <> nil then closeWindow(ThreeDWindow[windowIndex]); if not shadeSurface[windowIndex] then begin shadeSurface[windowIndex] := true; InvalRect(plotRect[windowIndex]); CheckItem(PlotMenu, menuitem, true); CheckItem(plotMenu,1,false); CheckItem(plotMenu,3,false); end; end; 3 : (* 3D *) begin CheckItem(PlotMenu,menuItem,true); CheckItem(PlotMenu,1,false); CheckItem(PlotMenu,2,false); ThreeDPlot(marqueeRect[windowIndex]); end; 5 : begin toggle[windowIndex] := not toggle[windowIndex]; InvalRect(myRect[windowIndex]); end; 6 : begin gridOn[windowIndex] := not gridOn[windowIndex]; CheckItem(PlotMenu,menuItem,gridOn[windowIndex]); if gridOn[windowIndex] then begin getMatrixBounds(plotRect[windowIndex],Xlow,Xhigh,Ylow,Yhigh); DrawGrid(xlow,xhigh,ylow,yhigh); end else InvalRect(plotRect[windowIndex]); end; otherwise; end; (* case *) GoodiesMenuID : case menuItem of 1,2 : zoomer(menuItem); 3 : redraw; otherwise; end; end; (* case *) end; procedure closeWindow; {myWindow: WindowPtr} var i : integer; resFileNum : integer; procedure FixMenuBar; begin if NoOfWindows = maxWindows then EnableItem(FileMenu,1); NoOfWindows := NoOfWindows -1; if NoOfWindows = 0 then begin DisableItem(FileMenu,2); DisableItem(FileMenu,3); DisableItem(FileMenu,4); DeleteMenu(PlotMenuID); DeleteMenu(goodiesMenuID); DisposeMenu(PlotMenu); DisposeMenu(GoodiesMenu); end; DrawMenuBar; end; procedure ReInit; begin DisposeWindow(ContourWindow[windowIndex]); ContourWindow[windowIndex] := nil; if ThreeDWindow[windowIndex] <> nil then begin DisposeWindow(ThreeDWindow[windowIndex]); ThreeDWindow[windowIndex] := nil; end; secondTime[windowIndex] := false; shadeSurface[windowIndex] := False; gridOn[windowIndex] := false; selection[windowIndex] := false; zooming[windowIndex] := false; zoomed[windowIndex] := false; ThreeDWindow[windowIndex] := nil; ContourWindow[windowIndex] := nil; theFile[windowIndex] := -1; end; begin if myWindow = ThreeDWindow[windowIndex] then begin setPort(ContourWindow[windowIndex]); CheckItem(PlotMenu,3,false); if shadeSurface[windowIndex] then CheckItem(PlotMenu,2,true) else CheckItem(PlotMenu,1,true); HideWindow(myWindow); end else if myWindow = ContourWindow[windowIndex] then begin FixMenuBar; resultCode := FSClose(theFile[windowIndex]); ReInit; if NewFile[windowIndex] then begin createResFile(resName[windowIndex]); resFileNum := OpenResFile(resName[windowIndex]); dimen[windowIndex] := dimenHandle(NewHandle(sizeOf(dimensions))); dimen[windowIndex]^^.maxX := maxX[windowIndex]; dimen[windowIndex]^^.maxY := maxY[windowIndex]; dimen[windowIndex]^^.gridSize := currentGridSize; dimen[windowIndex]^^.NoOfLevels := NoOfLevels[windowIndex]; dimen[windowIndex]^^.xOrigin := xOrigin[windowIndex]; dimen[windowIndex]^^.yOrigin := yOrigin[windowIndex]; dimen[windowIndex]^^.minData := minData[windowIndex]; dimen[windowIndex]^^.maxData := maxData[windowIndex]; AddResource(handle(dimen[windowIndex]),'crac',resID,''); CloseResFile(resFileNum); end; end; if NoOfWindows <> 0 then ChangeWindow(FrontWindow) else windowIndex := 0; end; procedure DoAbout; const dlgID = 8863; var contourDialog : DialogPtr; tempRect : Rect; begin contourDialog := GetNewDialog(dlgID,nil,pointer(-1)); tempRect := contourDialog^.PortRect; with ScreenBits.bounds do MoveWindow(contourDialog,(right-(tempRect.right-tempRect.left)) div 2, (bottom-(tempRect.bottom-tempRect.top)) div 2,true); ShowWindow(contourDialog); DrawDialog(contourDialog); while button do; repeat until button; FlushEvents(everyEvent,0); DisposDialog(contourDialog); end; procedure fixOrigin; {(x,y : integer)} var xLength, yLength : longint; begin with plotRect[windowIndex] do begin xLength := right - left; yLength := bottom - top; end; if (x+xLength) > currentGridSize*maxX[windowIndex] then x := maxX[windowIndex]*currentGridSize-xLength; if x < 0 then x := 0; if (y+yLength) > currentGridSize*maxY[windowIndex] then y := maxY[windowIndex]*currentGridSize-yLength; if y < 0 then y := 0; setOrigin(x,y); end; procedure GetPicture(picFrame : rect;NewGrid : longint;TwoD : boolean); var temp : longint; begin setCursor(ClockCursor^^); clipRgn := newRgn; GetClip(clipRgn); ClipRect(picFrame); myPict := OpenPicture(picFrame); if TwoD then begin temp := currentGridSize; currentGridSize := NewGrid; contourPlot(picFrame); currentGridSize := temp; end else Prepare3DPlot; closePicture; SetClip(clipRgn); DisposeRgn(clipRgn); InitCursor; end; procedure DoPrint; var mark : char; PlotArea : rect; temp : longint; p : windowPtr; xlow,xhigh, ylow,yhigh : integer; begin if PrJobDialog(prRecHdl) then begin GetPort(p); myPrPort := PrOpenDoc(prRecHdl,nil,nil); if PrError = noErr then begin with prRecHdl^^.prInfo.rPage do if selection[windowIndex] then begin GetMatrixBounds(marqueeRect[windowIndex],xlow,xhigh,ylow,yhigh); temp := currentGridSize; currentGridSize := min(right div (xhigh-xlow),bottom div (yhigh-ylow)); setRect(plotArea,xlow*currentGridSize,ylow*currentGridSize, xhigh*currentGridSize,(yhigh-1)*currentGridSize); {writeln(xlow:5,xhigh:5,ylow:5,yhigh:5,currentGridSize:10); with plotArea do writeln(left:5,top:5,right:5,bottom:5);} setOrigin(xlow*currentGridSize,ylow*currentGridSize); end else begin temp := currentGridSize; currentGridSize := min(right div maxX[windowIndex],bottom div maxY[windowIndex]); if currentGridSize = 0 then currentGridSize := 1; setRect(plotArea,0,0,currentGridSize*maxX[windowIndex],currentGridSize*maxY[windowIndex]); end; PrOpenPage(myPrPort,nil); if PrError = noErr then begin clipRect(plotArea); ContourPlot(plotArea); currentGridSize := temp; end; PRClosePage(myPrPort); end; PrCloseDoc(myPrPort); if (prRecHdl^^.prJob.bJDocLoop = bSpoolLoop) and (PrError = noErr) then begin sysbeep(1); sysbeep(1); PrPicFile(prRecHdl,nil,nil,nil,PrStRec); end; if PrError <> noErr then sysbeep(9); SetPort(p); end; end; procedure DoScrap; var picFrame : rect; NewGrid : longint; begin resultCode := ZeroScrap; if resultCode <> 0 then begin sysbeep(1);sysbeep(3);end; if myWindow = ContourWindow[windowIndex] then begin if selection[windowIndex] then begin NewGrid := currentGridSize; picFrame := marqueeRect[windowIndex]; end else begin NewGrid := 1; setRect(picFrame,0,0,maxX[windowIndex],maxY[windowIndex]); end; GetPicture(picFrame,NewGrid,true); end else begin setRect(picFrame,100,0,460,284); GetPicture(picFrame,NewGrid,false); end; HLock(handle(myPict)); resultCode := PutScrap(GetHandleSize(handle(myPict)),'PICT',ptr(myPict^)); if resultCode <> 0 then sysbeep(9); KillPicture(myPict); end; procedure DoSave; var picFrame : rect; where : point; reply : SFReply; buffer : packed array[0..511] of char; i : integer; theFile : integer; count : longint; begin SetPt(where,100,100); SFPutFile(where,'','contours',nil,reply); if reply.good then with reply do begin resultCode := Create(fname,vRefNum,'crac','PICT'); resultCode := FSOpen(fname,vRefNum,theFile); for i := 0 to 511 do buffer[i] := chr(0); count := 512; resultCode := FSWrite(theFile,count,@buffer); if myWindow = ContourWindow[windowIndex] then begin setRect(picFrame,0,0,maxX[windowIndex],maxY[windowIndex]); GetPicture(picFrame,1,true); end else if myWindow = ThreeDWindow[windowIndex] then begin setRect(picFrame,100,0,460,284); GetPicture(picFrame,1,false); end; Hlock(handle(myPict)); count := GetHandleSize(handle(myPict)); resultCode := FSWrite(theFile,count,ptr(myPict^)); resultCode := FSClose(theFile); end; end; end. .