// Text of project Photo Album written on 8/8/96 at 1:19 PM // Beginning of file photo form base := {viewBounds: {left: 14, top: 14, right: -14, bottom: -14}, viewJustify: 240, whichShape: 2 // default to this picture , debug: "base", _proto: @180 }; _view000 := {viewBounds: {left: 3, top: 4, right: -3, bottom: -25}, viewFlags: 33, viewFormat: 257, viewJustify: 240, viewDrawScript: rf:=OpenResFileX(HOME & "Photos"); DefConst('kTheShapes, [ GetPictAsBits("usaBW",nil), // GetPictAsBits converts to Black & White GetNamedResource("PICT", "TheWorld",'picture), // but GetNamedResource doesn't. GetNamedResource("PICT", "Amelio", 'picture), GetNamedResource("PICT", "Jason", 'picture), GetNamedResource("PICT", "Teddy", 'picture), ]); CloseResFileX(rf); // define names for each of these pictures, for use by the picker control DefConst('kPictureNames, ["USA map", "The World", "Amelio", "Jason", "Teddy bear"]); func() begin local theShape := MakeShape(kTheShapes[whichShape]); // center the shape within our view local bounds := ShapeBounds(theShape); OffsetShape(theShape, (self:LocalBox().right - bounds.right + bounds.left) div 2, (self:LocalBox().bottom - bounds.bottom + bounds.top) div 2); // and draw it! :DrawShape(theShape, nil); // also display some informational text (slightly ugly code because the shape could be a frame or binary object) SetValue(sizeDisplay, 'text, length(if IsFrame(kTheShapes[whichShape]) then kTheShapes[whichShape].bits else kTheShapes[whichShape]) && "bytes;" && bounds.right-bounds.left && "by" && bounds.bottom-bounds.top); end, viewClass: 74 }; AddStepForm(base, _view000); _view001 := {labelCommands: kPictureNames, text: "Picture", viewBounds: {left: 4, top: -15, right: 145, bottom: 0}, textSetup: func() labelCommands[whichShape], labelActionScript: func(cmd) begin // change the selector whichShape := cmd; // and refresh everything :parent():Dirty(); end, viewJustify: 8388736, _proto: @190 }; AddStepForm(base, _view001); sizeDisplay := {text: "", viewBounds: {left: -160, top: -14, right: -15, bottom: 1}, viewJustify: 8388769, debug: "sizeDisplay", _proto: @218 }; AddStepForm(base, sizeDisplay); StepDeclare(base, sizeDisplay, 'sizeDisplay); // After Script for "base" thisView := base; // Copyright 1996 by Apple Computer, Inc. All rights reserved. constant |layout_photo form| := base; // End of file photo form