unit AEProfile; interface uses Memory, QuickDraw, Packages, Menus, Events, Fonts, Scrap, ToolUtils,Resources, Errors, Palettes, LowMem, AppleEvents,AEObjects, AERegistry, Errors, globals, Utilities, Edit,File1,Graphics,Analysis, Msc, AEUtility, AEWIndow; function ProfileEvents(var inAppleEvent, reply:AppleEvent; inToken: TokenPtr; theCommand: OSType):OSerr; function ProfilePutData(var inAppleEvent, reply:AppleEvent; inToken: TokenPtr):OSerr; function ProfileGetData(var inAppleEvent, reply:AppleEvent; inToken: TokenPtr):OSerr; implementation function ProfileEvents(var inAppleEvent, reply:AppleEvent; inToken: TokenPtr; theCommand: OSType):OSerr; VAR theError:OSErr; theName:str255; begin theError := errAEEventNotHandled; if PlotWindow <> nil then begin if theCommand = 'clos' then theError := CloseAWindow(PlotWindow) else if theCommand = 'Upda' then { UPDATE} begin PlotDensityProfile; UpdatePlotWindow end { UPDATE} else if inToken^.containerWindow = PlotWindow then theError := WindowEvents(inAppleEvent, reply,inToken,theCommand); end; ProfileEvents := theError; end; function ProfileGetData(var inAppleEvent, reply:AppleEvent; inToken: TokenPtr):OSerr; VAR theError:OSErr; theIndex:LongInt; i:integer; theList:AEDescList; xValue:extended; begin theError := errAEDescNotFound; { if name = 'wide' then theError := ReturnShortProperty(reply, ProfilePlotWidth) else if name = 'hite' then theError := ReturnShortProperty(reply, ProfilePlotHeight) } with inToken^ do begin if name = 'pPlX' then theError := ReturnShortProperty(reply, ProfilePlotWidth) else if name = 'pPlY' then theError := ReturnShortProperty(reply, ProfilePlotHeight) else if name = 'pPl+' then theError := ReturnExtendedProperty(reply, ProfilePlotMax) else if name = 'pPl-' then theError := ReturnExtendedProperty(reply, ProfilePlotMin) else if name = 'Plt-' then theError := ReturnExtendedProperty(reply, ActualPlotMin) else if name = 'Plt+' then theError := ReturnExtendedProperty(reply, ActualPlotMax) else if name = 'PltN' then theError := ReturnShortProperty(reply, PlotCount) else if name = 'PltA' then theError := ReturnShortProperty(reply, PlotAvg) else if name = 'pPlL' then theError := ReturnBooleanProperty(reply, DrawPlotLabels) else if name = 'PltD' then begin CheckIndex(index,1,PlotCount); if thru > 0 then begin theError := AECreateList(nil, 0,false,theList); CheckIndex(thru,1,PlotCount); for i := index to thru do begin xValue := PlotData^[i]; theError := AEPutPtr( theList, 0, typeExtended, Ptr(@xValue), sizeof(extended) ); end; theError := AEPutParamDesc( reply, keyDirectObject, theList ); end else begin xValue := PlotData^[index]; theError := ReturnExtendedProperty(reply, xValue); end; end else theError := WindowGetData(inAppleEvent, reply, inToken); { inherit ! } end; ProfileGetData := theError; end; function ProfilePutData(var inAppleEvent, reply:AppleEvent; inToken: TokenPtr):OSerr; VAR theError:OSErr; theInfo: InfoPtr; theWindow: WindowPtr; theXVal:extended; theValue, i, k:integer; theAEProp: AEDesc; theName:str255; theRect:Rect; theList:AEDescList; theReturnedType:DescType; theActualSize:Size; typeCode:DescType; itemsInList, n:LongInt; pt1,pt2:Point; begin ProfilePutData := noErr; theWindow := inToken^.containerWindow; with inToken^ do begin { if name = 'hite' then begin ProfilePlotHeight := GetShortProperty(inAppleEvent,10,10000); if theWindow <> nil then begin theRect := theWindow^.portRect; SizeWindow(theWindow, theValue, theRect.bottom - theRect.top + theValue, true); end; end else if name = 'wide' then begin ProfilePlotWidth := GetShortProperty(inAppleEvent,10,10000); if theWindow <> nil then begin theRect := theWindow^.portRect; SizeWindow(theWindow, theRect.right - theRect.left + theValue, theValue, true); end; end } if name = 'pPlY' then ProfilePlotHeight := GetShortProperty(inAppleEvent,10,10000) else if name = 'pPlX' then ProfilePlotWidth := GetShortProperty(inAppleEvent,10,10000) else if name = 'pPl+' then begin ProfilePlotMax := GetExtendedProperty(inAppleEvent); AutoScalePlots := (ProfilePlotMin = 0.0) and (ProfilePlotMax = 0.0); end else if name = 'pPl-' then begin theError := AEGetParamDesc(inAppleEvent, 'data', typeExtended, theAEProp); theError := ExtendedFromDesc(theAEProp, ProfilePlotMin); AutoScalePlots := (ProfilePlotMin = 0.0) and (ProfilePlotMax = 0.0); end else if name = 'pPlX' then begin theValue := GetShortProperty(inAppleEvent,0,10000); if (theValue < 10) then theValue := 0; ProfilePlotWidth := theValue; FixedSizePlot := not ((ProfilePlotWidth = 0) and (ProfilePlotHeight = 0)); end else if name = 'pPlY' then begin theValue := GetShortProperty(inAppleEvent,0,10000); if (theValue < 10) then theValue := 0; ProfilePlotHeight := theValue; FixedSizePlot := not ((ProfilePlotWidth = 0) and (ProfilePlotHeight = 0)); end else if name = 'pPlL' then DrawPlotLabels := GetBooleanProperty(inAppleEvent) else ProfilePutData := WindowPutData(inAppleEvent, reply, inToken); { check inherited stuff } end; end; end.