// Text of project VF+Sample written on 1/8/96 at 12:09 AM// Beginning of file HugePicture_view000 := {viewFlags: 578, viewFormat: 1, viewBounds: {left: 30, top: 35, right: 213, bottom: 254}, declareSelf: 'base, viewJustify: 15, viewEffect: 133344, viewSetupFormScript: func() begin local ap := GetAppParams(); // Size this view to fill the screen. self.viewBounds := RelBounds(ap.appAreaLeft, ap.appAreaTop, ap.appAreaWidth, ap.appAreaHeight); end, ReOrientToScreen: @588 // better known as ROM_DefRotateFunc: allows operation in rotated mode under Newton 2.0 , viewClass: 76 };_view001 := {_proto: @166};AddStepForm(_view000, _view001);constant |layout_HugePicture| := _view000;// End of file HugePicture// Beginning of text file Project Data// Make sure you've specified a unique application symbol in Project Settings. This symbol (referred// to with the constant kAppSymbol) is used to distinguish the Additions from different packages.constant kAddSym := '|ViewFrame:JRH|; // Global variable that Additions are added to.// The actual Addition data - an array of frames containing any of the following slots:// title - A string or bitmap that always appears in the Additions popup menu.// GetTitle: func(obj) - Returns a string or bitmap to appear in the Additions menu, or NIL.// 'obj' is ViewFrame's current object, or NIL if none. Mutually exclusive with 'title.// AdditionScript: func(obj, VF) - Performs Addition command when this item is selected in the// Additions menu. 'obj' is current object, 'VF' is ViewFrame's base view.// DisplayObject: func(obj, VF) - Called each time an object is displayed, to allow the normal// display to be overridden. If a non-NIL value is returned, no further DisplayObject// scripts will be called, nor will the normal display be done. The action of this slot// is entirely independent of the previous three.// Other slots are called in particular circumstances. See the documentation for details.DefConst('kAddList, [ { title: "About VF+Sample", // About item: strongly recommended AdditionScript: func(obj, VF) begin VF:Notify(kNotifyQAlert, EnsureInternal("VF+Sample 1.1"), EnsureInternal("© 1995-6 Jason Harper.\n" "Command: Huge Bitmap/Picture.\n" "Viewer: 42.\n" "Annotation: Integer (even/odd).\n" "Info popup item: current time.")); end,// Note that :Notify has to be sent to VF (or GetRoot()), since the script is not called in an// ordinary view context// The following scripts are all in the same Addition frame, since they are all of different types.// They could just as well been placed in separate frames. DisplayObject: func(obj, VF) begin if obj = 42 then begin // Special viewer for the number 42 VF:AddStatic("Thanks for all the fish!"); true; // return non-nil to override normal object display end; end, AnnotateObject: func(obj, VF) begin if classof(obj) = 'Int then begin // Display integers as even or odd VF:AddStatic("Number is " & if BAnd(obj, 1) = 0 then "even" else "odd"); end; end, AddInfo: func(obj, addtap, addnontap) begin call addtap with ("The time is now " & TimeStr(Time(), kIncludeAllElements), // the item Time(), // new object added to path when item is tapped "/Time()"); // description of new object end, }, { GetTitle: func(obj) begin // Huge BM/Pic item: present only if object is appropriate if IsFrame(obj) and obj.bits exists and obj.bounds exists then "Huge Bitmap"; // Return different title for each type of supported object else if classof(obj) = 'picture then "Huge Picture"; end, AdditionScript: func(obj, VF) begin if IsFrame(obj) and classof(obj) = 'picture then // Extract picture data from a picture obj := SetClass(clone(obj.data), 'picture); // shape: there is a difference! BuildContext({ // Attach object display view to root view, so that it isn't _proto: GetLayout("HugePicture"), // limited to the size of VF's base view, and so that icon: obj, // we don't have to worry about cleaning up after it. Just don't }):Open(); // forget to supply some way of closing the view! end, },]);// Keep in mind that an auto part's InstallScript is NOT TotalCloned before it is executed.// Therefore, EnsureInternal is required for the names of all slots that are created, and for all// other objects that will be accessed at (or left around after) RemoveScript time.InstallScript := func(partFrame, removeFrame) begin local additions := GetGlobals().(kAddSym); // Get VF's global frame if not additions then GetGlobals().(EnsureInternal(kAddSym)) := // Create it if it doesn't exist additions := EnsureInternal({}); additions.(EnsureInternal(kAppSymbol)) := kAddList; // Add our Additions to it.end;RemoveScript := func(removeFrame) begin local additions := GetGlobals().(kAddSym); // Get VF's global frame if not additions then return; // Exit gracefully if it has been trashed RemoveSlot(additions, kAppSymbol); // Remove our Additions... if length(additions) = 0 then // and the global frame itself, if we were RemoveSlot(GetGlobals(), kAddSym); // the last remaining set of Additions.// End of text file Project Data