// Text of project NouveauScroll written on 4/28/97 at 5:14 PM // Beginning of file ParagraphView.t paragraphViewer := {viewBounds: {left: 16, top: 16, right: -16, bottom: -16}, viewJustify: 240, OpenWithText: func(initialText) begin self.text := initialText; :Open(); end, title: "Read Only Text", debug: "paragraphViewer", _proto: @179 /* protoFloater */ }; clipper := {viewBounds: {left: 5, top: 20, right: -5, bottom: -18}, viewFlags: 33, viewJustify: 240, ViewScroll2DScript: func(dir, extras) begin // scrollAmount says how much to scroll local scrollAmount := extras.amount * viewer.viewLineSpacing; :SetOrigin(0,Max(0,Min(viewer.viewBounds.bottom-:LocalBox().bottom, viewOriginY + scrollAmount))); RefreshViews(); end, viewSetupFormScript: func() begin // set up the height to be an integral number of lines viewBounds := Clone(viewBounds); local viewHeight := :LocalBox().bottom; local visibleLines := viewHeight div viewer.viewLineSpacing; viewBounds.bottom := viewBounds.bottom - (viewHeight mod viewer.viewLineSpacing) - 1; // setup the scroller UpDownScroller.scrollView := self; UpDownScroller.scrollAmounts := [1, visibleLines - 1, 100]; UpDownScroller.viewRect := SetBounds(0,0,0,visibleLines); UpDownScroller.pageThreshold := 3; // size paragraph to match text local newBounds := :LocalBox(); newBounds.bottom := 0; newBounds := TotalTextBounds({ text: text, viewFont: viewer.viewFont, viewBounds: newBounds}, nil); viewer.text := text; viewer.viewBounds := newBounds; UpDownScroller.scrollRect := UpDownScroller.dataRect := SetBounds(0,0,0, newbounds.bottom DIV viewer.viewLineSpacing); end, viewOriginY: 0, viewFormat: 337, debug: "clipper", viewClass: 74 /* clView */ }; AddStepForm(paragraphViewer, clipper); viewer := {viewBounds: {left: 0, top: 0, right: 0, bottom: 0}, viewFlags: 163, viewFormat: 12289, viewFont: SimpleFont10, viewLineSpacing: 13, viewJustify: 0, debug: "viewer", viewClass: 81 /* clParagraphView */ }; AddStepForm(clipper, viewer); StepDeclare(clipper, viewer, 'viewer); UpDownScroller := {viewBounds: {left: -24, top: 0, right: -6, bottom: 33}, debug: "UpDownScroller", _proto: @656 /* protoUpDownScroller */ }; AddStepForm(paragraphViewer, UpDownScroller); StepDeclare(paragraphViewer, UpDownScroller, 'UpDownScroller); paragraphViewer_v229_0 := {_proto: @229 /* protoTitle */}; AddStepForm(paragraphViewer, paragraphViewer_v229_0); paragraphViewer_v166_0 := {_proto: @166 /* protoCloseBox */}; AddStepForm(paragraphViewer, paragraphViewer_v166_0); constant |layout_ParagraphView.t| := paragraphViewer; // End of file ParagraphView.t // Beginning of file NouveauScroll.t // Before Script for myApp // Copyright ©1994 Apple Computer, Inc. All rights reserved. myApp := {title: "NouveauScroll", viewBounds: {left: 0, top: 2, right: 236, bottom: 334}, viewSetupFormScript: func() begin local l := GetAppParams(); self.viewBounds := RelBounds(l.appAreaLeft, l.appAreaTop, MIN(l.appAreaWidth, 240), MIN(l.appAreaHeight, 336)) ; end, viewFlags: 516, debug: "myApp", _proto: @132 /* protoDragger */ }; myApp_v218_0 := {text: "Does not use acceleration or feedback", viewBounds: {left: 0, top: 16, right: 0, bottom: 32}, viewJustify: 8388658, _proto: @218 /* protoStaticText */ }; AddStepForm(myApp, myApp_v218_0); SimpleScroller := {viewBounds: {left: 0, top: 32, right: 148, bottom: 156}, viewFlags: 1, viewFormat: 336, viewJustify: 16, debug: "SimpleScroller", viewClass: 74 /* clView */ }; AddStepForm(myApp, SimpleScroller); Scrollee := {viewBounds: {left: 0, top: 0, right: 148, bottom: 124}, def: protoTableDef, viewSetupFormScript: func() begin // first clone off a copy of the table definition to avoid Read only errors def := Clone(def); // setup the number of entries in the table def.tabDown := numItems; //add an array of text values for each of the table entries def.tabValues := Array(numItems, nil) ; for i := 1 to numItems do def.tabValues[i - 1] := "item " & i ; // now make each entry as wide as the interior of the table def.tabWidths := (viewBounds.right - viewBounds.left) - 2 ; def.tabHeights := FontHeight(viewFont) ; // setup the scroller UpDownScroller.ScrollView := self ; end, numItems: 100, ViewScroll2DScript: func(dir, extras) begin // scrollAmount says how much to scroll scrollAmount := ABS(extras.amount) ; if extras.amount > 0 then :viewScrollDownScript() ; else :viewScrollUpScript() ; RefreshViews() ; end, viewFormat: 257, debug: "Scrollee", _proto: @223 /* protoTable */ }; AddStepForm(SimpleScroller, Scrollee); StepDeclare(SimpleScroller, Scrollee, 'Scrollee); UpDownScroller := {viewBounds: {left: -19, top: 0, right: -1, bottom: 33}, debug: "UpDownScroller", _proto: @656 /* protoUpDownScroller */ }; AddStepForm(SimpleScroller, UpDownScroller); StepDeclare(SimpleScroller, UpDownScroller, 'UpDownScroller); myApp_v218_0 := {text: "Uses acceleration and feedback", viewBounds: {left: 0, top: 160, right: 0, bottom: 176}, viewJustify: 8388658, _proto: @218 /* protoStaticText */ }; AddStepForm(myApp, myApp_v218_0); ComplexScroller := {viewBounds: {left: 0, top: 176, right: 148, bottom: 300}, viewFlags: 1, viewFormat: 336, viewJustify: 16, debug: "ComplexScroller", viewClass: 74 /* clView */ }; AddStepForm(myApp, ComplexScroller); Scrollee := {viewBounds: {left: 0, top: 0, right: 148, bottom: 124}, def: protoTableDef, viewSetupFormScript: func() begin // first clone off a copy of the table definition to avoid Read only errors def := Clone(def); // setup the number of entries in the table def.tabDown := numItems; //add an array of text values for each of the table entries def.tabValues := Array(numItems, nil) ; for i := 1 to numItems do def.tabValues[i - 1] := "item " & i ; // now make each entry as wide as the interior of the table def.tabWidths := (viewBounds.right - viewBounds.left) - 2 ; def.tabHeights := FontHeight(viewFont) ; // setup the scroller local sRect := SetBounds(0, 0, 0, numItems) ; UpDownScroller.ScrollRect := sRect ; UpDownScroller.DataRect := sRect ; UpDownScroller.ViewRect := SetBounds(0, 0, 0, ((viewBounds.bottom - viewBounds.top) DIV def.tabHeights)) ; UpDownScroller.ScrollAmounts := [1, UpDownScroller.ViewRect.bottom - 1, 10] ; UpDownScroller.ScrollView := self ; end, numItems: 100, ViewScroll2DScript: func(dir, extras) begin // scrollAmount says how much to scroll scrollAmount := ABS(extras.amount) ; if extras.amount > 0 then :viewScrollDownScript() ; else :viewScrollUpScript() ; RefreshViews() ; end, viewFormat: 257, debug: "Scrollee", _proto: @223 /* protoTable */ }; AddStepForm(ComplexScroller, Scrollee); StepDeclare(ComplexScroller, Scrollee, 'Scrollee); UpDownScroller := {viewBounds: {left: -19, top: 0, right: -1, bottom: 33}, debug: "UpDownScroller", _proto: @656 /* protoUpDownScroller */ }; AddStepForm(ComplexScroller, UpDownScroller); StepDeclare(ComplexScroller, UpDownScroller, 'UpDownScroller); myApp_v229_0 := {_proto: @229 /* protoTitle */}; AddStepForm(myApp, myApp_v229_0); myApp_v401_0 := { menuLeftButtons: [ { _proto: protoTextButton, text: "Text", buttonClickScript: func() begin local text := ""; for i := 0 to Random(30,50) do text := text & "line " & i & $\n; paragraphViewer:OpenWithText(text); end, }, ], _proto: @401 /* newtStatusBar */ }; AddStepForm(myApp, myApp_v401_0); paragraphViewer := LinkedSubview(paragraphViewer, {viewBounds: {left: 160, top: 206, right: 236, bottom: 250}, debug: "paragraphViewer" }); AddStepForm(myApp, paragraphViewer); StepDeclare(myApp, paragraphViewer, 'paragraphViewer); constant |layout_NouveauScroll.t| := myApp; // End of file NouveauScroll.t