// Text of project AuxForm written on 5/12/95 at 4:53 PM // Beginning of text file Project Data /* ** Newton Developer Technical Support Sample Code ** ** AuxForm, Shows how to use routing 'auxilliary forms' for routing slips ** ** by Maurice Sharp and J. Christopher Bell, Newton Developer Technical Support ** ** Copyright © 1993-1995 by Apple Computer, Inc. All rights reserved. ** ** You may incorporate this sample code into your applications without ** restriction. This sample code has been provided "AS IS" and the ** responsibility for its operation is 100% yours. You are not ** permitted to modify and redistribute the source as "DTS Sample Code." ** If you are going to re-distribute the source, we require that you ** make it clear in the source that the code was descended from ** Apple-provided sample code, but that you've made changes. */ constant kBusinessFormat := '|businessFormat:AuxForm:PIEDTS|; // End of text file Project Data // Beginning of file mainFormat // Before Script for "_view000" /* ** Newton Developer Technical Support Sample Code ** ** AuxForm, Shows how to use routing 'auxilliary forms' for routing slips ** ** by Maurice Sharp and J. Christopher Bell, Newton Developer Technical Support ** ** Copyright © 1993-1995 by Apple Computer, Inc. All rights reserved. ** ** You may incorporate this sample code into your applications without ** restriction. This sample code has been provided "AS IS" and the ** responsibility for its operation is 100% yours. You are not ** permitted to modify and redistribute the source as "DTS Sample Code." ** If you are going to re-distribute the source, we require that you ** make it clear in the source that the code was descended from ** Apple-provided sample code, but that you've made changes. */ _view000 := { printNextPageScript: func() begin nil; end, _proto: @200 }; // Before Script for "_view001" // Copyright © 1993, 1994 by Apple Computer, Inc. All rights reserved. _view001 := {text: "Hello, world!\n", viewBounds: {left: 0, top: 0, right: 0, bottom: 0}, viewSetupFormScript: func() begin // wiggyField is set by the text from the // auxilliary slip self.text := if not StrEqual(fields.wiggyField, "") then fields.wiggyField else "Empty auxForm string" ; end, viewJustify: 246, viewFont: {family: ROM_espyFont, face: 0, size: 36}, _proto: @218 }; AddStepForm(_view000, _view001); constant |layout_mainFormat| := _view000; // End of file mainFormat // Beginning of file myAuxFormat // Before Script for "_view002" /* ** Newton Developer Technical Support Sample Code ** ** AuxForm, Shows how to use routing 'auxilliary forms' for routing slips ** ** by Maurice Sharp and J. Christopher Bell, Newton Developer Technical Support ** ** Copyright © 1993-1995 by Apple Computer, Inc. All rights reserved. ** ** You may incorporate this sample code into your applications without ** restriction. This sample code has been provided "AS IS" and the ** responsibility for its operation is 100% yours. You are not ** permitted to modify and redistribute the source as "DTS Sample Code." ** If you are going to re-distribute the source, we require that you ** make it clear in the source that the code was descended from ** Apple-provided sample code, but that you've made changes. */ _view002 := {viewBounds: {left: 4, top: 174, right: 192, bottom: 242}, viewSetupFormScript: func() begin local myHeight := viewBounds.bottom - viewBounds.top ; // adjust viewbounds to be right under the printslip // (or faxslip) local printBounds := GetRoot().printslip.viewBounds ; // You MUST CHECK TO SEE IF THIS VALUE IS NIL! // Because printslip is not documented, it may change. // So GetRoot().(slipSymbol).viewBounds might // evaluate to nil! // Never rely on the slots 'faxslip, 'printslip, // 'beamslip, or 'mailSlip existing in the root or assume that // slips can be referenced via a slip symbol. // They are subject to change in future software. // if we cannot tell where the slip is, assume we float in the upper-left! if not printBounds then printBounds := {top: 0, left:0, right: viewbounds.right-viewbounds.left, bottom: myHeight}; local newViewbounds := {} ; newViewBounds.left := printBounds.left ; // add 10 to account for frame of this floater and // the other floater (i.e., frame size is in addition // to viewBounds. newViewBounds.top := printBounds.bottom + 10 ; newViewBounds.right := printBounds.right ; newViewBounds.bottom := newViewBounds.top + myHeight + 10 ; self.viewBounds := newViewBounds ; end, viewClickScript: func(unit) begin nil; end, viewFlags: 576, _proto: @179 }; // Before Script for "_view003" // this view exists so that the 'drag' message only is captured // if the user taps on the outside of the floater, not within... _view003 := {viewBounds: {left: 0, top: 0, right: 0, bottom: 0}, viewFlags: 513, viewFormat: 0, viewJustify: 240, viewClickScript: func(unit) begin :Parent():Drag(unit, :Parent():Parent():GlobalBox()); // Return true if click has been completely handled, nil otherwise true; end, viewClass: 74 }; AddStepForm(_view002, _view003); // Before Script for "_view004" // Copyright © 1993, 1994 by Apple Computer, Inc. All rights reserved. _view004 := {viewBounds: {left: 8, top: 24, right: 192, bottom: 56}, labelCommands: ["one", "two"], label: "Print This:", textChanged: func() begin fields.wiggyField := text ; end, textSetup: func() begin text := "" ; fields.wiggyField := text ; end, viewClickScript: func(unit) begin nil; // Return true if click has been completely handled, nil otherwise end, _proto: @189 }; AddStepForm(_view002, _view004); // Before Script for "_view005" // Copyright © 1993, 1994 by Apple Computer, Inc. All rights reserved. _view005 := {text: "Text to print or fax", viewBounds: {left: 0, top: 0, right: 0, bottom: 16}, viewJustify: 8388662, _proto: @218 }; AddStepForm(_view002, _view005); _view006 := {_proto: @163}; AddStepForm(_view002, _view006); constant |layout_myAuxFormat| := _view002; // End of file myAuxFormat // Beginning of file main.t // Before Script for "_view007" /* ** Newton Developer Technical Support Sample Code ** ** AuxForm, Shows how to use routing 'auxilliary forms' for routing slips ** ** by Maurice Sharp and J. Christopher Bell, Newton Developer Technical Support ** ** Copyright © 1993-1995 by Apple Computer, Inc. All rights reserved. ** ** You may incorporate this sample code into your applications without ** restriction. This sample code has been provided "AS IS" and the ** responsibility for its operation is 100% yours. You are not ** permitted to modify and redistribute the source as "DTS Sample Code." ** If you are going to re-distribute the source, we require that you ** make it clear in the source that the code was descended from ** Apple-provided sample code, but that you've made changes. */ _view007 := {title: "AuxForm", viewBounds: {left: 5, top: 66, right: 221, bottom: 159}, target: nil, routingFrame: //a simple routing frame { // something for printing print: { title: "Print Thing", routeForm: 'printSlip, formats: [kBusinessFormat] } };, viewSetupFormScript: func() begin GetGlobals().routing.(kAppSymbol) := routingFrame; targetView := self; GetRoot().(kBusinessFormat) := BuildContext(businessFormat); // get my auxilliary format (auxForm), just use a proto // to get the information GetRoot().(kAuxFormat) := BuildContext(GetLayout("myAuxFormat")); // need to set target to a cursor Entry! target := Query(GetUnionSoup("Names"), {type: 'index}):Entry() ; if not target then // if no names target := {}; end, viewQuitScript: func() begin RemoveSlot(GetGlobals().routing, kAppSymbol); RemoveSlot(GetRoot(), kBusinessFormat); RemoveSlot(GetRoot(), kAuxFormat); end, targetView: nil, businessFormat: { title: "Business", // this is a symbol for your foramt. It is totally // arbitrary since you jam the format into the root // view. The only requirement is that the slot name // in the rootView matches this symbol. What you // jam in there is up to you. // see your viewSetupFormScript for the jam in. auxForm: kAuxFormat, // used by mail for text only sending textScript: nil, attachment: true, _proto: ROM_coverPageFormat, mainFormat: GetLayout("mainFormat") }, SetupRoutingSlip: func(fields) begin fields.target := target ; fields.title := "Look ma, no hands" ; end, appSymbol: kAppSymbol, viewFlags: 1, viewFormat: 83886417, declareSelf: 'base, viewClass: 74 }; _view008 := {_proto: @219}; AddStepForm(_view007, _view008); // Before Script for "_view009" // Copyright © 1993, 1994 by Apple Computer, Inc. All rights reserved. _view009 := {_proto: @209}; AddStepForm(_view008, _view009); _view010 := {title: "AuxForm", _proto: @229}; AddStepForm(_view007, _view010); _view011 := {text: "Select 'print' in the action button to see a routing auxform.", viewBounds: {left: 20, top: 23, right: 196, bottom: 71}, viewJustify: 2, _proto: @218 }; AddStepForm(_view007, _view011); constant |layout_main.t| := _view007; // End of file main.t