home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / Newton Platform Info / Newton 2.0 Sample Code / User Interface / PreeferMadnessTNG-1 / PreeferMadnessTNG.text < prev    next >
Encoding:
Text File  |  1996-02-19  |  19.8 KB  |  745 lines  |  [TEXT/MPS ]

  1. // Text of project PreeferMadnessTNG written on 2/19/96 at 8:17 PM
  2. // Beginning of text file AppConstants.f
  3. // Copyright © 1993 - 1996 Apple Computer, Inc. All rights reserved.
  4. /*
  5.     Application constants for PreeferMadnessTNG
  6.     
  7.     constants for:
  8.         app preferences
  9.         start sound
  10. */
  11.  
  12.  
  13. // prefs constants
  14.  
  15. DefConst('kPrefsFrame,        // default prefs settings
  16.     {tag: kAppString,
  17.      version: 1,
  18.      startWithSound: nil,
  19.      onePrefOnly: true,
  20.      philospherIndex: 0,
  21.      });
  22.  
  23. constant kPreferenceTitle := "Preefer Preferences" ;
  24. constant kApplicationPreferenceTitle := "Application" ;
  25.  
  26.  
  27. // philisophical constants
  28. DefConst('kPhilPicker, 
  29.                 ["None", 'pickSeparator, "Plato", "Aristotle",
  30.                 "Descartes", "Mill", "Tsunemoto", "Nietzsche",
  31.                 "Marx", "Wittgenstien", "Heidegger", "Russell", "Popper", "Dr. Llama"]) ;
  32.  
  33.  
  34. // start sound
  35. r := OpenResFileX("PreeferMadness.rsrc");
  36. DefConst('kStartSound, GetSound("Oh la la")) ;
  37. CloseResFileX(r) ;
  38. // End of text file AppConstants.f
  39. // Beginning of file protoPrefsOverview
  40. _userproto000 :=
  41.     {viewBounds: {left: 0, top: 0, right: 224, bottom: 220},
  42.      viewFlags: 548,
  43.      viewJustify: 80,
  44.      prefItemsArray:
  45.        // user of this proto MUST provide this!
  46.        // an array of protoPrefRollItem's that are the preferences
  47.        // of the application
  48.        nil,
  49.      OpenPref:
  50.        DefConst( 'kPrefFrame, {
  51.                _proto: protoFloatngo,
  52.        
  53.                viewJustify: vjParentLeftH + vjParentTopV,
  54.        
  55.                viewBounds: nil,
  56.        
  57.                stepChildren: nil,
  58.                
  59.                ReorientToScreen: ROM_DefRotateFunc,
  60.        
  61.                viewSetupDoneScript: func()
  62.                begin
  63.                local myBounds := :LocalBox();
  64.                local prefBounds ;
  65.        
  66.                foreach kid in :ChildViewFrames() do
  67.                    if kid._proto = prefPanelProto then
  68.                        prefBounds := kid:LocalBox() ;
  69.        
  70.                if prefBounds AND myBounds.bottom < prefBounds.bottom then
  71.                    SetValue(self, 'viewBounds,    RelBounds(0, 0, myBounds.right, prefBounds.bottom)) ;
  72.                end,    
  73.                });
  74.        
  75.        func(prefPanel)
  76.        begin
  77.            local item := BuildContext( kPrefFrame );
  78.            
  79.            // pref panel will be attached to the root view, but want
  80.            // to center it inside the parent view or overview
  81.            item.viewBounds := RelBounds(:GlobalBox().left, 
  82.                :GlobalBox().top + :LocalBox().bottom DIV 2 - prefPanel.height DIV 2,
  83.                :LocalBox().right, prefPanel.height) ;
  84.        
  85.            item.stepChildren := item.viewChildren;
  86.            item.viewChildren := [prefPanel];
  87.            item.prefPanelProto := prefPanel ;
  88.        
  89.            item:Open();
  90.            return item;
  91.        end,
  92.      openChild: nil,
  93.      viewQuitScript:
  94.        func()
  95.        begin
  96.            if openChild then
  97.                openChild:Close();
  98.            inherited:?viewQuitScript();        // this method might be defined internally
  99.        end,
  100.      _proto: @180
  101.     };
  102.  
  103. _view000 :=
  104.     {viewBounds: {left: 14, top: 4, right: 94, bottom: 20},
  105.      viewSetupFormScript:
  106.        func()
  107.        begin
  108.            if title then
  109.                self.title := title ;
  110.            else
  111.                self.title := defaultTitle ;
  112.        
  113.            inherited:?viewSetupFormScript();        // this method is defined internally
  114.        end,
  115.      defaulttitle: "Preferences",
  116.      _proto: @229
  117.     };
  118. AddStepForm(_userproto000, _view000);
  119.  
  120.  
  121.  
  122. _view001 :=
  123.     {viewBounds: {left: 0, top: 16, right: 0, bottom: -16},
  124.      viewFlags: 517,
  125.      viewJustify: 240,
  126.      cursor:
  127.        {
  128.            items: nil,
  129.        
  130.            index: 0,
  131.            
  132.            NumItems: func()
  133.                Length(items),
  134.        
  135.            Entry: func()
  136.            begin
  137.                if index < Length(items) then
  138.                items[index];
  139.            end,
  140.        
  141.            Next: func()
  142.                if index < Length(items)-1 then
  143.                begin
  144.                    index := index + 1;
  145.                    items[index];
  146.                end,
  147.                
  148.            Move: func(delta)
  149.            begin
  150.                index := Min(Max(index + delta, 0), Length(items)-1) ;
  151.                items[index];
  152.            end,
  153.            
  154.            Reset: func()
  155.                index := 0,
  156.        
  157.            Clone: func()
  158.                Clone(self),
  159.                
  160.            GetIndexEntry: func(theIndex)
  161.                items[theIndex],
  162.        },
  163.      selectIndent: 0,
  164.      Abstract:
  165.        constant kIconPrefSpace := 25;
  166.        
  167.        r := OpenResFileX("PreeferMadness.rsrc");
  168.        DefConst('kPrefsDefaultIcon, GetPictAsBits("defaultPrefIcon", nil));
  169.        CloseResFileX(r);
  170.        
  171.        func(pref,bbox)
  172.        begin
  173.            [
  174.            MakeText(pref.overview, bbox.left + kIconPrefSpace, bbox.top, bbox.right, bbox.top + 11),
  175.            if pref.icon then
  176.                OffsetShape(MakeShape(pref.icon), 
  177.                    bbox.left + (kIconPrefSpace - pref.icon.bounds.right) DIV 2, 
  178.                    bbox.top + (kIconPrefSpace - pref.icon.bounds.bottom) DIV 2);
  179.            else
  180.                OffsetShape(
  181.                    MakeShape(kPrefsDefaultIcon),
  182.                        bbox.left + (kIconPrefSpace - kPrefsDefaultIcon.bounds.right) DIV 2, 
  183.                        bbox.top + kPrefsDefaultIcon.bounds.bottom DIV 2),
  184.            ]
  185.        end,
  186.      HitItem:
  187.        func(hitIndex, xcoord, ycoord)
  188.        begin
  189.            // find the actual item hit
  190.            // i.e., compensate for any scrolling offset
  191.            local realIndex := hitIndex + topIndex;
  192.            if openChild then
  193.                openChild:Close();
  194.            
  195.            openChild := :OpenPref(cursor:GetIndexEntry(realIndex));
  196.        end,
  197.      Scroller:
  198.        func(dir)
  199.        begin
  200.            local newIndex := Min(Max(topIndex + dir, 0), cursor:NumItems()-1);
  201.            local realDir := topIndex - newIndex ;
  202.        
  203.            // can get called when the list is at the top or
  204.            // bottom, so check if we need to do real work
  205.            if realDir <> 0 then
  206.            begin
  207.                // update the index for the item at the top of the display
  208.                topIndex := newIndex ;
  209.        
  210.                // let viewSetupChildrenScript do the work
  211.                :RedoChildren();
  212.            end ;
  213.        end,
  214.      topIndex:
  215.        // index of the item that is currently at the
  216.        // top of the displayed items
  217.        0,
  218.      viewSetupChildrenScript:
  219.        // Required
  220.        // use SetupAbstracts to setup the pictures shown
  221.        func()
  222.        begin
  223.            // can get called when a scroll occurs
  224.            // so clone off the cursor and move
  225.            // it so that the first item is the
  226.            // current top of the displayed items
  227.            local curs := cursor:Clone();
  228.        
  229.            curs:Reset();
  230.            curs:Move(topIndex);
  231.            :SetupAbstracts(curs);
  232.        end,
  233.      viewSetupFormScript:
  234.        func()
  235.        begin
  236.            // only need to setup cursor if not already there
  237.            // i.e., viewSetupFormScript may get called multiple times
  238.            if IsReadOnly(cursor) then
  239.            begin
  240.                cursor := {_proto: cursor,
  241.                              items: prefItemsArray};
  242.            end ;
  243.        end,
  244.      nothingCheckable: true,
  245.      autoDeselect: true,
  246.      lineHeight: 16,
  247.      _proto: @191
  248.     };
  249. AddStepForm(_userproto000, _view001);
  250.  
  251.  
  252.  
  253. // After Script for "_userproto000"
  254. thisView := _userproto000;
  255. // Copyright ©1996 Apple Computer, Inc. All rights reserved.
  256. nil
  257.  
  258.  
  259. constant |layout_protoPrefsOverview| := _userproto000;
  260. // End of file protoPrefsOverview
  261. // Beginning of file PreeferFormulaItem
  262.  
  263. // Before Script for "_userproto001"
  264. // Copyright © 1993-6 Apple Computer, Inc. All rights reserved.
  265.  
  266.  
  267. _userproto001 :=
  268.     {viewBounds: {left: 0, top: 22, right: 240, bottom: 88},
  269.      overview: "Preefer Formula Overview Title",
  270.      title: "Preefer Formula Panel Title",
  271.      _proto: @180
  272.     };
  273.  
  274. _view002 := {viewBounds: {left: 5, top: 6, right: 77, bottom: 22}, _proto: @229}
  275.     ;
  276. AddStepForm(_userproto001, _view002);
  277.  
  278.  
  279.  
  280. _view003 :=
  281.     {viewBounds: {left: 16, top: 32, right: 200, bottom: 56},
  282.      viewFlags: 1,
  283.      text: "42",
  284.      label: "Enter the answer:",
  285.      entryFlags: 10753,
  286.      viewSetupFormScript:
  287.        func()
  288.        begin
  289.            // make the entry line ignore spaces
  290.            inherited:?viewSetupFormScript();
  291.            entryLine.textFlags := vNoSpaces ;
  292.        end,
  293.      _proto: @189
  294.     };
  295. AddStepForm(_userproto001, _view003);
  296.  
  297.  
  298.  
  299.  
  300. constant |layout_PreeferFormulaItem| := _userproto001;
  301. // End of file PreeferFormulaItem
  302. // Beginning of file PreeferAutoPrefsItem
  303.  
  304. // Before Script for "PrefsPanelBase"
  305. // Copyright © 1993-6 Apple Computer, Inc. All rights reserved.
  306.  
  307.  
  308. PrefsPanelBase :=
  309.     {viewBounds: {left: 0, top: 0, right: 0, bottom: 40},
  310.      overview: "Preefer Prefs",
  311.      text: "Preefer Prefs",
  312.      prefsEntry: nil,
  313.      viewQuitScript:
  314.        func()
  315.        begin
  316.        
  317.         //nil out slots to allow for GC
  318.         prefsEntry := nil;
  319.        
  320.        end,
  321.      height: 40,
  322.      icon: GetPictAsBits("SmallPreeferIcon", nil),
  323.      viewSetupFormScript:
  324.        func()
  325.        begin
  326.          prefsEntry := GetAppPrefs(kAppSymbol, kPrefsFrame) ;
  327.        
  328.          //IMPORTANT to call the inherited ViewSetupDoneScript in our proto
  329.          inherited:?viewSetupFormScript();
  330.        end,
  331.      debug: "PrefsPanelBase",
  332.      _proto: @385
  333.     };
  334.  
  335. soundCheckbox :=
  336.     {text: "Start with sound",
  337.      viewBounds: {left: 24, top: 16, right: 192, bottom: 32},
  338.      buttonValue: true,
  339.      valueChanged:
  340.        func()
  341.        begin
  342.          prefsEntry.startWithSound := viewValue;
  343.          EntryChange(prefsEntry);
  344.        end,
  345.      viewValue: nil,
  346.      viewSetupFormScript:
  347.        func()
  348.        begin
  349.            viewValue := prefsEntry.startWithSound ;
  350.        end,
  351.      debug: "soundCheckbox",
  352.      _proto: @164
  353.     };
  354. AddStepForm(PrefsPanelBase, soundCheckbox);
  355. StepDeclare(PrefsPanelBase, soundCheckbox, 'soundCheckbox);
  356.  
  357.  
  358.  
  359.  
  360. constant |layout_PreeferAutoPrefsItem| := PrefsPanelBase;
  361. // End of file PreeferAutoPrefsItem
  362. // Beginning of file PreeferPhilPrefItem
  363.  
  364. // Before Script for "_userproto002"
  365. // Copyright © 1993-6 Apple Computer, Inc. All rights reserved.
  366.  
  367.  
  368. _userproto002 :=
  369.     {viewBounds: {left: 0, top: 0, right: 0, bottom: 35},
  370.      height: 35,
  371.      overview: "Philisophical Leaning",
  372.      text: "Philisophical Leaning",
  373.      icon: nil,
  374.      prefsEntry: nil,
  375.      viewSetupFormScript:
  376.        func()
  377.        begin
  378.            prefsEntry := GetAppPrefs(kAppSymbol, kPrefsFrame);
  379.            inherited:?viewSetupFormScript();
  380.        end,
  381.      _proto: @385
  382.     };
  383.  
  384. _view004 :=
  385.     {viewBounds: {left: 25, top: 17, right: 207, bottom: 39},
  386.      labelCommands: kPhilPicker,
  387.      text: "Philosopher",
  388.      textSetup:
  389.        func()
  390.        begin
  391.            labelCommands[prefsEntry.philosopherIndex] ;
  392.        end,
  393.      labelActionScript:
  394.        func(cmd)
  395.        begin
  396.            prefsEntry.philosopherIndex := cmd;
  397.            EntryChange(prefsEntry);
  398.            GetRoot().(kAppSymbol):RevisePhilosophy();
  399.        end,
  400.      _proto: @190
  401.     };
  402. AddStepForm(_userproto002, _view004);
  403.  
  404.  
  405.  
  406.  
  407. constant |layout_PreeferPhilPrefItem| := _userproto002;
  408. // End of file PreeferPhilPrefItem
  409. // Beginning of file PreeferAppPrefsItems
  410.  
  411. // Before Script for "_userproto003"
  412. // Copyright © 1993-6 Apple Computer, Inc. All rights reserved.
  413.  
  414.  
  415. _userproto003 :=
  416.     {viewBounds: {left: 0, top: 0, right: 0, bottom: 50},
  417.      height: 50,
  418.      icon: nil,
  419.      prefsEntry: nil,
  420.      viewSetupFormScript:
  421.        func()
  422.        begin
  423.            prefsEntry := GetAppPrefs(kAppSymbol, kPrefsFrame);
  424.        
  425.            // hack code, see the comment in the overview slot
  426.            if prefsEntry.onePrefOnly then
  427.                overview := kPreferenceTitle ;
  428.        
  429.            inherited:?viewSetupFormScript();
  430.        end,
  431.      overview:
  432.        // Some hacking occurs here :-)
  433.        
  434.        // Since this sample demos either one pref or multiple prefs,
  435.        // we need to change the title of this preference on the fly.
  436.        // However, the protoPrefsOverview will construct the abstract for
  437.        // the overview based on an uninstantiated template... i.e., the
  438.        // viewSetupFormScript of this template will not run before the
  439.        // abstract is constructed.
  440.        
  441.        // The bottom line is that this is the overview text for the
  442.        // multiple pref case.
  443.        
  444.        kApplicationPreferenceTitle,
  445.      text: "Is this slot used?",
  446.      _proto: @385
  447.     };
  448.  
  449. soundCheckbox :=
  450.     {text: "Start with sound",
  451.      viewBounds: {left: 32, top: 16, right: 200, bottom: 32},
  452.      buttonValue: true,
  453.      valueChanged:
  454.        func()
  455.        begin
  456.          prefsEntry.startWithSound := viewValue;
  457.          EntryChange(prefsEntry);
  458.        end,
  459.      viewSetupFormScript:
  460.        func()
  461.        begin
  462.            viewValue := prefsEntry.startWithSound ;
  463.        end,
  464.      debug: "soundCheckbox",
  465.      _proto: @164
  466.     };
  467. AddStepForm(_userproto003, soundCheckbox);
  468.  
  469.  
  470.  
  471. onePrefItemOnlyCheckbox :=
  472.     {text: "Only One Preference",
  473.      viewBounds: {left: 32, top: 32, right: 200, bottom: 48},
  474.      buttonValue: true,
  475.      valueChanged:
  476.        func()
  477.        begin
  478.          prefsEntry.onePrefOnly := viewValue;
  479.          EntryChange(prefsEntry);
  480.        end,
  481.      viewSetupFormScript:
  482.        func()
  483.        begin
  484.            viewValue := prefsEntry.onePrefOnly ;
  485.        end,
  486.      debug: "onePrefItemOnlyCheckbox",
  487.      _proto: @164
  488.     };
  489. AddStepForm(_userproto003, onePrefItemOnlyCheckbox);
  490.  
  491.  
  492.  
  493.  
  494. constant |layout_PreeferAppPrefsItems| := _userproto003;
  495. // End of file PreeferAppPrefsItems
  496. // Beginning of file PreeferSinglePrefFloater.t
  497.  
  498. // Before Script for "_view005"
  499. // Copyright © 1996 Apple Computer, Inc. All rights reserved.
  500.  
  501.  
  502. _view005 :=
  503.     {viewBounds: {left: 0, top: 0, right: 224, bottom: 50},
  504.      viewJustify: 80,
  505.      _proto: @180
  506.     };
  507.  
  508. _view006 := {_proto: _userproto003};
  509. AddStepForm(_view005, _view006);
  510.  
  511.  
  512.  
  513.  
  514. constant |layout_PreeferSinglePrefFloater.t| := _view005;
  515. // End of file PreeferSinglePrefFloater.t
  516. // Beginning of file PreeferMultiplePrefsOverview.t
  517.  
  518. // Before Script for "_view007"
  519. // Copyright © 1993-6 Apple Computer, Inc. All rights reserved.
  520.  
  521.  
  522. _view007 :=
  523.     {title: kPreferenceTitle,
  524.      prefItemsArray:
  525.        // MUST provide this!
  526.        // an array of protoPrefRollItem's that are the preference items
  527.        
  528.        [GetLayout("PreeferAppPrefsItems"), GetLayout("PreeferPhilPrefItem")];,
  529.      viewBounds: {left: 0, top: 0, right: 224, bottom: 65},
  530.      _proto: _userproto000
  531.     };
  532.  
  533.  
  534. constant |layout_PreeferMultiplePrefsOverview.t| := _view007;
  535. // End of file PreeferMultiplePrefsOverview.t
  536. // Beginning of file PreeferMadness.t
  537.  
  538. // Before Script for "MyBase"
  539. // Copyright © 1993-6 Apple Computer, Inc. All rights reserved.
  540.  
  541.  
  542. MyBase :=
  543.     {viewBounds: {left: 0, top: 0, right: 240, bottom: 336},
  544.      viewSetupFormScript:
  545.        func()
  546.        begin
  547.            // Resize the app to fill the screen.
  548.            // This will look very odd on watch-size or whiteboard-sized Newton
  549.            // devices, but then again this sample isn't exactly useful to a user...
  550.            local l := GetAppParams() ;
  551.            self.viewBounds := RelBounds(l.appAreaLeft, l.appAreaTop, l.appAreaWidth, l.appAreaHeight);
  552.            
  553.            prefsEntry := GetAppPrefs(kAppSymbol, kPrefsFrame) ;
  554.            if prefsEntry.startWithSound then
  555.               PlaySound(kStartSound);
  556.        end,
  557.      viewQuitScript:
  558.        func()
  559.        begin
  560.        
  561.         //nil out slots to allow for GC
  562.         prefsEntry := nil;
  563.        
  564.        end,
  565.      prefsEntry:
  566.        // will be the our entry from the system preferences soup
  567.        // set in protoApp.viewSetupFormScript
  568.        nil,
  569.      viewFlags: 4,
  570.      viewFormat: 328017,
  571.      declareSelf: 'base,
  572.      currentPrefsVersion: 1,
  573.      DoInfoPrefs:
  574.        func()
  575.        begin
  576.            // if we have multiple preferences, open a prefs overview
  577.            // otherwise just open the pref
  578.        
  579.            if prefsEntry.onePrefOnly then    
  580.                SinglePref:Open();
  581.            else
  582.                // open up the preferences overview
  583.                PrefsOverview:Open();
  584.        
  585.        end,
  586.      RevisePhilosophy:
  587.        func()
  588.        begin
  589.            philView:RevisePhilosophy();
  590.        end,
  591.      ReorientToScreen: ROM_DefRotateFunc,
  592.      viewJustify: 16,
  593.      title: kAppName,
  594.      debug: "MyBase",
  595.      viewClass: 74
  596.     };
  597.  
  598. _view008 :=
  599.     {viewBounds: {left: -6, top: 2, right: 74, bottom: 18}, _proto: @229};
  600. AddStepForm(MyBase, _view008);
  601.  
  602.  
  603.  
  604. _view009 := {menuLeftButtons: [protoInfoButton], _proto: @401};
  605. AddStepForm(MyBase, _view009);
  606.  
  607.  
  608.  
  609. PhilView :=
  610.     {text: "",
  611.      viewBounds: {left: 2, top: 42, right: 242, bottom: 218},
  612.      viewJustify: 0,
  613.      viewFont: {family: 'NewYork, face: kFaceBold, size: 14},
  614.      viewSetupFormScript:
  615.        func()
  616.        begin
  617.            if prefsEntry.philosopherIndex then
  618.                text := philText[prefsEntry.philosopherIndex] ;
  619.            else
  620.            begin
  621.                prefsEntry.philosopherIndex := 0 ;
  622.                EntryChange(prefsEntry) ;
  623.                text := "";
  624.            end;
  625.        end,
  626.      philText:
  627.        ["","",
  628.        // Plato
  629.        "There is an objective ideal Llama form of which all manifistations are just shadows",
  630.        // Aristotle
  631.        "Every Llama can be classified into one of a finite number of sub-types of Llamas",
  632.        // Rene Descartes
  633.        "I think, therefore there must be Llamas",
  634.        // John Stuart Mill
  635.        "It is up to the free will of the individual to believe in Llamas or not",
  636.        // Tsunemoto
  637.        "It does not matter if Llamas exist or not, it only matters than an individual live by the way of courage",
  638.        // Nietzsche
  639.        "The Llama is dead!",
  640.        // Marx
  641.        "To each Llama according to its needs, from each according to its abilities",
  642.        // Wittgenstien
  643.        "It is futile to talk about Llamas because we will never agree on what the concept means",
  644.        // Heidegger
  645.        "There is no objective ideal Llama, each individual's concept of Llama is made up of their own experiences of and about Llamas",
  646.        // Russell
  647.        "With the help of mathematics we have discovered that Llamas are not valid constructs",
  648.        // Popper
  649.        "The question of the verification of Llamas depends upon the ability to falsify that Llamas do not exist",
  650.        // Dr. Llama
  651.        "I am the Llama",
  652.        ],
  653.      RevisePhilosophy:
  654.        func()
  655.        begin
  656.            SetValue(self, 'text, philText[prefsEntry.philosopherIndex]) ;
  657.        end,
  658.      debug: "PhilView",
  659.      _proto: @218
  660.     };
  661. AddStepForm(MyBase, PhilView);
  662. StepDeclare(MyBase, PhilView, 'PhilView);
  663.  
  664.  
  665.  
  666. _view010 :=
  667.     {
  668.      text:
  669.        "Click on the Info button and choose \"Prefs\" to set the application preferences"
  670.      ,
  671.      viewBounds: {top: -65, left: 10, right: 154, bottom: -20},
  672.      viewJustify: 128,
  673.      viewFont: ROM_fontsystem10,
  674.      _proto: @218
  675.     };
  676. AddStepForm(MyBase, _view010);
  677.  
  678.  
  679. PrefsOverview := LinkedSubview(_view007,
  680.     {viewBounds: {left: 2, top: 218, right: 122, bottom: 258},
  681.      debug: "PrefsOverview"
  682.     });
  683. AddStepForm(MyBase, PrefsOverview);
  684. StepDeclare(MyBase, PrefsOverview, 'PrefsOverview);
  685. SinglePref := LinkedSubview(_view005,
  686.     {viewBounds: {left: 130, top: 218, right: 234, bottom: 258},
  687.      debug: "SinglePref"
  688.     });
  689. AddStepForm(MyBase, SinglePref);
  690. StepDeclare(MyBase, SinglePref, 'SinglePref);
  691.  
  692.  
  693. constant |layout_PreeferMadness.t| := MyBase;
  694. // End of file PreeferMadness.t
  695. // Beginning of text file PackageStuff.f
  696. // Copyright © 1993 - 1996 Apple Computer, Inc. All rights reserved.
  697. /*
  698.     package and part stuff
  699.     
  700.     Includes:
  701.         part frame additions
  702.         InstallScript
  703.         RemoveScript    
  704.  
  705.  */
  706.  
  707.  
  708. // These calls to SetPartFrameSlot need to be done after the layout has
  709. // been compiled, which is why this file is last in the build sequence.
  710.  
  711. SetPartFrameSlot('PreeferFormulaItem, GetLayout("PreeferFormulaItem"));
  712. SetPartFrameSlot('PreeferAutoPrefsItem, GetLayout("PreeferAutoPrefsItem"));
  713.  
  714.  
  715. InstallScript := func(partFrame)
  716. begin
  717.     // NOTE: only auto parts would register their prefs with the
  718.     //            system, and only if there was no other way to present
  719.     //            preferences. This is done here for demonstration purposes
  720.     //            only.
  721.     RegPrefs(kAppSymbol, partFrame.PreeferAutoPrefsItem);
  722.  
  723.     // register the formula.
  724.     // NOTE: can not use GetLayout directly in a form part installScript
  725.     //       since the InstallScript is EnsureInternal'd. If we did do
  726.     //       a GetLayout call, the layout would be copied into the NS Heap!
  727.     RegFormulas(kAppSymbol, partFrame.PreeferFormulaItem);
  728.  
  729. end;
  730.  
  731.  
  732. RemoveScript := func(partFrame)
  733. begin
  734.     // NOTE: only autoparts need to register system prefs... see above
  735.     UnregPrefs(kAppSymbol);
  736.  
  737.     //unregister the formula
  738.     UnregFormulas(kAppSymbol);
  739.  
  740. end;
  741. // End of text file PackageStuff.f
  742.  
  743.  
  744.  
  745.