// Text of project Wrap It Up written on 5/12/95 at 18:19 // Beginning of file Wrap It Up.t // Before Script for "paragraphApp" // Copyright © 1994 by Apple Computer, Inc. All rights reserved. paragraphApp := {title: "Wrap It Up", viewBounds: {top: 0, left: 0, right: 240, bottom: 336}, viewSetupFormScript: func() begin constant kMaxWidth := 240; constant kMaxHeight := 336; local b := GetAppParams(); self.viewBounds := RelBounds(b.appAreaLeft, b.appAreaTop, Min(b.appAreaWidth, kMaxWidth), Min(b.appAreaHeight, kMaxHeight) ); end, debug: "paragraphApp", _proto: @157 }; _view000 := {viewFlags: 33, viewFormat: 337, viewBounds: {left: 9, top: 25, right: 231, bottom: 159}, viewSetupChildrenScript: func() begin stepchildren := EnsureInternal(stepchildren); end, viewClass: 77 }; AddStepForm(paragraphApp, _view000); theParagraph := {viewFlags: 134217737, viewFormat: 337, viewFont: userFont12, viewBounds: {left: 9, top: 9, right: 209, bottom: 105}, text: "Word", viewJustify: 0, debug: "theParagraph", viewClass: 81 }; AddStepForm(_view000, theParagraph); StepDeclare(paragraphApp, theParagraph, 'theParagraph); // After Script for "theParagraph" thisView := theParagraph; thisView.viewLineSpacing := nil; // Make sure this slot is set here so it doesn't inherit // GetRoot() has a viewLineSpacing slot! addAbove := {text: "Add word above", buttonClickScript: func() begin SetValue(theParagraph, 'text, theParagraph.text && GetRandomWord(0, 20)); SetValue(theParagraph, 'viewBounds, theParagraph.viewBounds); // the second SetValue is needed to tweak the clParagraphView into // updating an internal cache. It's a workarond for a clParagraphView // bug. The SetValue doesn't necessarily have to be for viewBounds. end, viewBounds: {left: 10, top: 170, right: 110, bottom: 182}, debug: "addAbove", _proto: @226 }; AddStepForm(paragraphApp, addAbove); addBelow := {text: "Add word below", buttonClickScript: func() begin SetValue(anotherParagraph, 'text, anotherParagraph.text && GetRandomWord(0, 20)); end, viewBounds: {left: 130, top: 170, right: 230, bottom: 182}, debug: "addBelow", _proto: @226 }; AddStepForm(paragraphApp, addBelow); anotherParagraph := {viewFlags: 6657, viewFormat: 337, viewFont: userFont12, viewBounds: {left: 17, top: 193, right: 223, bottom: 209}, text: "Word", viewJustify: 0, viewChangedScript: func(slot, view) begin if slot = 'text and view = self then :AdjustHeight(); end, AdjustHeight: func() begin local width := viewBounds.right - viewBounds.left; local height := call kSimpleTextHeightFunc with (text, width, viewFont); if viewBounds.top + height <> viewBounds.bottom then begin local newBounds := DeepClone(viewBounds); newBounds.bottom := newBounds.top + height; SetValue(self, 'viewBounds, newBounds); end; end;, debug: "anotherParagraph", viewClass: 81 }; AddStepForm(paragraphApp, anotherParagraph); StepDeclare(paragraphApp, anotherParagraph, 'anotherParagraph); // After Script for "anotherParagraph" thisView := anotherParagraph; thisView.viewLineSpacing := nil; // Make sure this slot is set here so it doesn't inherit // GetRoot() has a viewLineSpacing slot! constant |layout_Wrap It Up.t| := paragraphApp; // End of file Wrap It Up.t