home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Sample Code / Newton Sample Code 1.2 / Book Maker / Beyond Help-3 / Beyond Help.text < prev    next >
Encoding:
Text File  |  1994-07-07  |  5.4 KB  |  221 lines  |  [TEXT/MPS ]

  1. // Copyright © 1993,1994 Apple Computer, Inc. All rights reserved.
  2.  
  3. // app constants
  4. constant kAppMaxWidth := 240 ;
  5. constant kAppMaxHeight := 336 ;
  6.  
  7.  
  8. // read in the book
  9.  
  10. bookFilePath := HOME&"Help Book Source.f" ;
  11.  
  12. // open resource fork for pictures
  13. ref := OpenResFileX(bookFilePath);
  14.  
  15. // load in the book
  16. load(bookFilePath);
  17.  
  18. // close the resource file
  19. CloseResFileX(ref) ;
  20.  
  21.  
  22. // ---- End Project Data ----
  23.  
  24.  
  25. // ---- File Beyond Help.t ----
  26.  
  27. // Before Script for "BeyondHelpApp"
  28. // Copyright © 1993,4 Apple Computer, Inc. All rights reserved.
  29.  
  30. BeyondHelpApp :=
  31.    {title: "Beyond Help",
  32.     viewBounds: {left: 0, top: 2, right: 236, bottom: 334},
  33.     theBook:
  34.       book
  35.       // defined in ProjectData, from Dickens output.,
  36.     viewSetupDoneScript:
  37.       func()
  38.       begin
  39.           // create the new help book that uses the same proto as the system
  40.           // help book (TinyTim).
  41.           // NOTE/WARNING: TinyTime is NOT the proto, it IS the system help book.
  42.          //                     You want the _proto of TinyTime.
  43.       
  44.          self.myHelpBook := BuildContext({_proto: GetRoot().TinyTim._proto, bookRef: theBook});
  45.       end,
  46.     viewQuitScript:
  47.       func()
  48.       begin
  49.          myHelpBook:Close(); // do this so card can be removed
  50.           myHelpBook := nil // do this so help book can be GC'd
  51.       end,
  52.     declareSelf: 'base,
  53.     viewFlags: 4,
  54.     viewFormat: 593,
  55.     viewSetupFormScript:
  56.       func()
  57.       begin
  58.           // resize application to the screen
  59.           local b := GetAppParams();
  60.           viewBounds := RelBounds(b.AppAreaLeft, b.AppAreaTop,
  61.               MIN(kAppMaxWidth, b.appAreaWidth),
  62.               MIN(kAppMaxHeight, b.appAreaHeight));
  63.       end,
  64.     AppInfoItems: ["Help"],
  65.     InfoItemSelected:
  66.       func(item)
  67.       begin
  68.           // this is where you respond to the info button
  69.           // see the pickActionScript in the protoInfoButton to
  70.           // to see where this script is called from.
  71.           
  72.           // see the infoButton sample for details on protoInfoButton
  73.           
  74.          GetRoot().TinyTim:Close();   // in case system help is open
  75.           // OpenManaul is a method of the TinyTim helpbook
  76.          myHelpBook:OpenManual(theBook);
  77.       
  78.       end,
  79.     viewclass: 74,
  80.     debug: "BeyondHelpApp"
  81.    };
  82.  
  83.  
  84. // ---- File protoAdjustoButton ----
  85.  
  86. // Before Script for "_userproto000"
  87. // Copyright, © 1994 Apple Computer. All rights reserved.
  88.  
  89. _userproto000 :=
  90.    {buttonHeight: 13,
  91.     textSpacer: 8,
  92.     viewSetupFormScript:
  93.       func()
  94.       begin
  95.           viewBounds := RelBounds(viewBounds.left, viewBounds.top,
  96.                    StrFontWidth(text, viewFont) + textSpacer, buttonHeight) ;
  97.       end,
  98.     viewChangedScript:
  99.       func(slot, view)
  100.       begin
  101.           inherited:?viewChangedScript(slot, view) ;
  102.           if slot = 'text then
  103.               :SyncView();            // SyncView causes the viewSetupFormScript to be called again,
  104.                                           // which sets the size based on the text.
  105.       end,
  106.     _proto: protoTextButton
  107.    };
  108.  
  109.  
  110. // ---- Back in File Beyond Help.t ----
  111. OpenManualTo := /* child of BeyondHelpApp */
  112.    {text: "Llama Topic",
  113.     buttonClickScript:
  114.       func()
  115.       begin
  116.          GetRoot().TinyTim:Close();   // in case system help is open
  117.           // OpenManualTo is a method of TinyTim See help book doc
  118.          myHelpBook:OpenManualTo(theBook, "LlamaTopic");
  119.       end,
  120.     viewBounds: {left: 68, top: 122, right: 144, bottom: 134},
  121.     _proto: _userproto000,
  122.     debug: "OpenManualTo"
  123.    };
  124.  
  125.  
  126.  
  127. _view000 := /* child of BeyondHelpApp */ {_proto: protoStatus};
  128.  
  129.  
  130. // ---- File protoInfoButton ----
  131.  
  132. // Before Script for "info"
  133. // Copyright ©1994 Apple Computer, Inc., All Rights Reserved.
  134.  
  135. info :=
  136.    {viewBounds: {left: 17, top: 0, right: 30, bottom: 12},
  137.     viewFormat: 67109457,
  138.     pickCancelledScript:
  139.       func()
  140.       begin
  141.           :Hilite(nil);
  142.       end,
  143.     icon: GetPictAsBits("info icon", nil),
  144.     viewClickScript:
  145.       func(unit)
  146.       begin
  147.           if :TrackHilite(unit) then
  148.           begin
  149.               local l := :LocalBox();
  150.       
  151.               DoPopUp(AppInfoItems, l.right+3, l.top, self);
  152.           end;
  153.       end,
  154.     viewFlags: 513,
  155.     viewclass: 76,
  156.     debug: "info"
  157.    };
  158.  
  159. // After Script for "info"
  160. thisView := info;
  161. // set the bounds of the button so that it is to the right
  162. // of the clock and the correct height for the status bar
  163.  
  164. // NOTE: this is the first button, so argument to the
  165. // ButtonBounds function MUST be negative
  166. thisView.viewBounds := ButtonBounds(-(thisView.viewBounds.right - thisView.viewBounds.left));
  167.  
  168.  
  169. // ---- Back in File Beyond Help.t ----
  170. _view001 := /* child of _view000 */
  171.    {
  172.     pickActionScript:
  173.       func(index)
  174.       begin
  175.           // MUST do this
  176.           :Hilite(nil);
  177.       
  178.           :InfoItemSelected(index) ;
  179.       end,
  180.     _proto: info
  181.    };
  182.  
  183.  
  184.  
  185.  
  186.  
  187. _view002 := /* child of BeyondHelpApp */
  188.    {
  189.     text:
  190.       "To see the sample help book, click on the Info button and choose \"Help\""
  191.     ,
  192.     viewBounds: {top: -65, left: 18, right: 148, bottom: -20},
  193.     viewJustify: 128,
  194.     viewFont: {family: 'espy, face: kFaceNormal, size: 10},
  195.     _proto: protoStaticText
  196.    };
  197.  
  198.  
  199.  
  200. _view003 := /* child of BeyondHelpApp */
  201.    {viewBounds: {left: -8, top: 8, right: 48, bottom: 24}, _proto: protoTitle};
  202.  
  203.  
  204.  
  205. _view004 := /* child of BeyondHelpApp */
  206.    {text: "Click on this button to open the Help Book to the Llama Topic",
  207.     viewBounds: {left: 50, top: 64, right: 170, bottom: 120},
  208.     viewJustify: 6,
  209.     viewFont: {family: 'espy, face: kFaceNormal, size: 10},
  210.     _proto: protoStaticText
  211.    };
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219. // ---- Beginning of section for non used Layout files ----
  220.  
  221. // End of output