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 / Help Book Source.f < prev    next >
Encoding:
Text File  |  1994-07-07  |  9.3 KB  |  462 lines  |  [TEXT/MPS ]

  1. // Created by Newton Book Maker 1.0.1
  2. // ¡¡ Note: This file may contain needed resources !! 
  3. // Document
  4. book := {
  5.     help: TRUE,
  6.     contents: Array(24, NIL),
  7.     styles: [],
  8.     browsers: [], templates: [], rendering: []};
  9.  
  10. // Shared Scripts
  11. gotoDestScript := func() begin
  12.     if (curRendering = 0) then :TurnToPage(destPage);
  13.     else :TurnToPage(:FindPageByContent(kioskDest, 0, NIL));
  14. end;
  15.  
  16. // Text Styles
  17. s0 := {
  18.     family: 'Geneva,
  19.     face: 0,
  20.     size: 9};
  21. AddArraySlot(book.styles, s0);
  22.  
  23. s1 := {
  24.     family: 'espy /* Monaco */,
  25.     face: 0,
  26.     size: 10};
  27. AddArraySlot(book.styles, s1);
  28.  
  29. s2 := {
  30.     family: 'Espy,
  31.     face: 1,
  32.     size: 10};
  33. AddArraySlot(book.styles, s2);
  34.  
  35. s3 := {
  36.     family: 'Espy,
  37.     face: 0,
  38.     size: 10};
  39. AddArraySlot(book.styles, s3);
  40.  
  41. s4 := {
  42.     family: 'Geneva,
  43.     face: 0,
  44.     size: 9};
  45. AddArraySlot(book.styles, s4);
  46.  
  47. s5 := {
  48.     family: 'Geneva,
  49.     face: 0,
  50.     size: 10};
  51. AddArraySlot(book.styles, s5);
  52.  
  53. s6 := {
  54.     family: 'espy /* Avant Garde */,
  55.     face: 0,
  56.     size: 10};
  57. AddArraySlot(book.styles, s6);
  58.  
  59.  
  60. // Contents
  61. c1 := {
  62.     data: "About Beyond Help",
  63.     viewFont: s2,
  64.     layout: 32
  65. };
  66. book.contents[0] := c1;
  67.  
  68. c2 := {
  69.     data: "
  70. This is a sample help book, written to demonstrate how to add help to your application.  The app has two buttons, both of which open the manual, but the 2nd opens the manual so that the Llamas topic is open.
  71.  
  72. Sample app and help book by Bob Ebert.
  73.  
  74. Many thanks to the Scott Shwarts and David Dunham for help creating this sample.",
  75.     viewFont: s3
  76. };
  77. book.contents[1] := c2;
  78.  
  79. c3 := {
  80.     data: "Help Book Overview",
  81.     viewFont: s2,
  82.     layout: 32
  83. };
  84. book.contents[2] := c3;
  85.  
  86. c4 := {
  87.     data: "
  88. The help book is organized into two main levels, a \"topics\" level and a \"page\" level.  The book always opens to the  topics level, and each line in the topics level can either have subtopics or a single page.
  89.  
  90. Each page is meant to describe a specific topic.  The content for a topic cannot be larger than a page, as no scrolling is supported.  The only navigation available from a page is to return to the topics.",
  91.     viewFont: s3
  92. };
  93. book.contents[3] := c4;
  94.  
  95. c5 := {
  96.     data: "Help Book Usage",
  97.     styles: [15, s2, 1, s3],
  98.     layout: 32
  99. };
  100. book.contents[4] := c5;
  101.  
  102. c6 := {
  103.     data: "
  104. Help books are intended to provide \"How Do I\" type help to an application.  It should list step by step instructions to get a user on the right track.
  105.  
  106. The main rule for help books is KISS:
  107.     Keep It Simple, Stupid
  108.  
  109. The help book should tells users what they need to know to perform some task with an application, and not much else.
  110. ",
  111.     styles: [185, s3, 4, s2, 145, s3],
  112.     tabs: [18]
  113. };
  114. book.contents[5] := c6;
  115.  
  116. c7 := {
  117.     data: "Things to avoid",
  118.     styles: [15, s2, 1, s3],
  119.     layout: 32
  120. };
  121. book.contents[6] := c7;
  122.  
  123. c8 := {
  124.     data: "
  125. Help books are not designed to present the entire users manual.  (You might consider using a separate electonic book for that.)
  126.  
  127. Application help books should not describe how to perform system-wide tasks, such as Faxing or Printing.  (The System Help Book already describes those.)  Only special tasks for your application need to be described.
  128.  
  129. This help book is a bad example.  :-)",
  130.     styles: [382, s3, 4, s4]
  131. };
  132. book.contents[7] := c8;
  133.  
  134. c9 := {
  135.     data: "Building a Help Book",
  136.     styles: [20, s2, 1, s3],
  137.     layout: 32
  138. };
  139. book.contents[8] := c9;
  140.  
  141. c10 := {
  142.     data: "
  143. •    Build your book in the word processor.
  144. •    Drop the file on Newton BookMaker
  145. •    Choose Help Size in the Options menu.
  146. •    Click on the \"Do It\" button.
  147. •    Save the result.
  148. •    Add code to Project Data to read in the book. e.g., 
  149.     ref := OpenResFileX(HOME&\"book.f\");
  150.     load(HOME&\"book.f\");
  151.     CloseResFileX(ref) ;
  152. •    The book is available to the app.",
  153.     styles: [61, s3, 16, s5, 10, s3, 9, s5, 8, s3, 7, s5, 199, s3, 4, s5, 26, s3],
  154.     tabs: [18]
  155. };
  156. book.contents[9] := c10;
  157.  
  158. c11 := {
  159.     data: "User Interface for Opening",
  160.     styles: [26, s2, 1, s3],
  161.     layout: 32
  162. };
  163. book.contents[10] := c11;
  164.  
  165. c12 := {
  166.     data: GetNamedResource("PICT", "4122", 'picture)
  167. };
  168. book.contents[11] := c12;
  169.  
  170. c13 := {
  171.     data: "
  172. The interface element you use for accessing help is the Info button. The sample 'infoButton' includes a user prototemplate for the info button as well as demonstrating how to use it.
  173.  
  174. This sample also contains the protoInfoButton.",
  175.     viewFont: s3
  176. };
  177. book.contents[12] := c13;
  178.  
  179. c14 := {
  180.     data: "Opening a Help Book",
  181.     styles: [19, s2, 1, s3],
  182.     layout: 32
  183. };
  184. book.contents[13] := c14;
  185.  
  186. c15 := {
  187.     data: "
  188. •    Create a template frame like this:
  189.     {_proto: GetRoot().TinyTim._proto,
  190.      bookRef: theBook}
  191. •    Build a view using BuildContext()
  192. •    Send the OpenManual message
  193.     to the view.
  194. •    Or use OpenManualTo().
  195.  
  196. •    Be sure to close the Help Book when
  197.     the app closes.",
  198.     styles: [38, s3, 56, s5, 21, s3, 14, s5, 54, s3, 14, s5, 58, s3],
  199.     tabs: [18]
  200. };
  201. book.contents[14] := c15;
  202.  
  203. c16 := {
  204.     data: "A Font Tip",
  205.     styles: [10, s2, 1, s3],
  206.     layout: 32
  207. };
  208. book.contents[15] := c16;
  209.  
  210. c17 := {
  211.     data: "
  212. You should consider using the system font (Espy Sans) for your help book.  A bitmap version Espy Sans comes with Newton ToolKit.
  213.  
  214. Or, just use any font besides New York or Geneva.  The Newton BookMaker turns all unknown fonts into Espy Sans.  (The source for this paragraph is in Avant Garde!)",
  215.     styles: [131, s3, 163, s6, 1, s3]
  216. };
  217. book.contents[16] := c17;
  218.  
  219. c18 := {
  220.     data: "Llamas (a topic with subtopics)",
  221.     layout: 2048
  222. };
  223. book.contents[17] := c18;
  224.  
  225. c19 := {
  226.     data: "Llama Basics",
  227.     viewFont: s2,
  228.     layout: 32, 
  229.     name: "LlamaTopic"
  230. };
  231. book.contents[18] := c19;
  232.  
  233. c20 := {
  234.     data: GetNamedResource("PICT", "2457", 'picture),
  235.     layout: 4
  236. };
  237. book.contents[19] := c20;
  238.  
  239. c21 := {
  240.     data: "    A llama is:
  241.         Helpful
  242.         Courteous
  243.         Kind
  244.         Obedient
  245.         Cheerful
  246.         Thrifty
  247.         Brave
  248.         Clean
  249.         Reverent",
  250.     viewFont: s3,
  251.     tabs: [36, 54]
  252. };
  253. book.contents[20] := c21;
  254.  
  255. c22 := {
  256.     data: "Llama don'ts",
  257.     viewFont: s2,
  258.     layout: 32
  259. };
  260. book.contents[21] := c22;
  261.  
  262. c23 := {
  263.     data: GetNamedResource("PICT", "31626", 'picture),
  264.     layout: 4
  265. };
  266. book.contents[22] := c23;
  267.  
  268. c24 := {
  269.     data: "NEVER:
  270. • Whack your llama.
  271. • Taunt your llama.
  272. • Mock your llama.
  273. • Leave your llama out in the rain.
  274. • Expose your llama to direct sunlight.
  275. • Let your llama run heavy machinery.
  276. • Mix your llama with alcohol or drugs.
  277. • Fold, Spindle, or Mutilate your llama.
  278. • Let your llama eat lupines.",
  279.     styles: [7, s2, 284, s3]
  280. };
  281. book.contents[23] := c24;
  282.  
  283.  
  284. // Kiosk (menu page) references
  285.  
  286. // Page Templates
  287. Default := {
  288.     nColumns: 1,
  289.     column: [{
  290.     width: 12,
  291.     type: 0}]
  292. };
  293. AddArraySlot(book.templates, Default);
  294.  
  295. // Bounds List
  296. bnd1 := [0,0,206,14];
  297. bnd2 := [0,14,206,214];
  298. bnd3 := [0,14,120,34];
  299. bnd4 := [0,34,206,214];
  300. bnd5 := [87,14,119,46];
  301. bnd6 := [0,46,206,214];
  302. bnd7 := [0,46,206,186];
  303.  
  304. // Pages
  305. pageList := {pageSize: {left: 0, top: 0, right: 206, bottom: 214}, pages: []};
  306.  
  307. // Page 1
  308. page := {template: Default, blocks: []};
  309. AddArraySlot(page.blocks,
  310.     {bounds: bnd1,
  311.     item: c1});
  312. AddArraySlot(page.blocks,
  313.     {bounds: bnd2,
  314.     item: c2});
  315. AddArraySlot(pageList.pages, page);
  316.  
  317. // Page 2
  318. page := {template: Default, blocks: []};
  319. AddArraySlot(page.blocks,
  320.     {bounds: bnd1,
  321.     item: c3});
  322. AddArraySlot(page.blocks,
  323.     {bounds: bnd2,
  324.     item: c4});
  325. AddArraySlot(pageList.pages, page);
  326.  
  327. // Page 3
  328. page := {template: Default, blocks: []};
  329. AddArraySlot(page.blocks,
  330.     {bounds: bnd1,
  331.     item: c5});
  332. AddArraySlot(page.blocks,
  333.     {bounds: bnd2,
  334.     item: c6});
  335. AddArraySlot(pageList.pages, page);
  336.  
  337. // Page 4
  338. page := {template: Default, blocks: []};
  339. AddArraySlot(page.blocks,
  340.     {bounds: bnd1,
  341.     item: c7});
  342. AddArraySlot(page.blocks,
  343.     {bounds: bnd2,
  344.     item: c8});
  345. AddArraySlot(pageList.pages, page);
  346.  
  347. // Page 5
  348. page := {template: Default, blocks: []};
  349. AddArraySlot(page.blocks,
  350.     {bounds: bnd1,
  351.     item: c9});
  352. AddArraySlot(page.blocks,
  353.     {bounds: bnd2,
  354.     item: c10});
  355. AddArraySlot(pageList.pages, page);
  356.  
  357. // Page 6
  358. page := {template: Default, blocks: []};
  359. AddArraySlot(page.blocks,
  360.     {bounds: bnd1,
  361.     item: c11});
  362. AddArraySlot(page.blocks,
  363.     {bounds: bnd3,
  364.     item: c12});
  365. AddArraySlot(page.blocks,
  366.     {bounds: bnd4,
  367.     item: c13});
  368. AddArraySlot(pageList.pages, page);
  369.  
  370. // Page 7
  371. page := {template: Default, blocks: []};
  372. AddArraySlot(page.blocks,
  373.     {bounds: bnd1,
  374.     item: c14});
  375. AddArraySlot(page.blocks,
  376.     {bounds: bnd2,
  377.     item: c15});
  378. AddArraySlot(pageList.pages, page);
  379.  
  380. // Page 8
  381. page := {template: Default, blocks: []};
  382. AddArraySlot(page.blocks,
  383.     {bounds: bnd1,
  384.     item: c16});
  385. AddArraySlot(page.blocks,
  386.     {bounds: bnd2,
  387.     item: c17});
  388. AddArraySlot(pageList.pages, page);
  389.  
  390. // Page 9
  391. page := {template: Default, blocks: []};
  392. AddArraySlot(page.blocks,
  393.     {bounds: bnd1,
  394.     item: c19});
  395. AddArraySlot(page.blocks,
  396.     {bounds: bnd5,
  397.     item: c20});
  398. AddArraySlot(page.blocks,
  399.     {bounds: bnd6,
  400.     item: c21});
  401. AddArraySlot(pageList.pages, page);
  402.  
  403. // Page 10
  404. page := {template: Default, blocks: []};
  405. AddArraySlot(page.blocks,
  406.     {bounds: bnd1,
  407.     item: c22});
  408. AddArraySlot(page.blocks,
  409.     {bounds: bnd5,
  410.     item: c23});
  411. AddArraySlot(page.blocks,
  412.     {bounds: bnd7,
  413.     item: c24});
  414. AddArraySlot(pageList.pages, page);
  415.  
  416. AddArraySlot(book.rendering, pageList);
  417.  
  418. // Browsers & “Page Hints”
  419. b1 := {
  420.     name: "Contents",  list: []
  421. };
  422.  
  423.  
  424. AddArraySlot(b1.list, {    // 0
  425.     item: c1
  426. });
  427. AddArraySlot(b1.list, {    // 1
  428.     item: c3
  429. });
  430. AddArraySlot(b1.list, {    // 2
  431.     item: c5
  432. });
  433. AddArraySlot(b1.list, {    // 3
  434.     item: c7
  435. });
  436. AddArraySlot(b1.list, {    // 4
  437.     item: c9
  438. });
  439. AddArraySlot(b1.list, {    // 5
  440.     item: c11
  441. });
  442. AddArraySlot(b1.list, {    // 6
  443.     item: c14
  444. });
  445. AddArraySlot(b1.list, {    // 7
  446.     item: c16
  447. });
  448. AddArraySlot(b1.list, {    // 8
  449.     item: c18
  450. });
  451. AddArraySlot(b1.list, {    // 9
  452.     level: 2,
  453.     item: c19
  454. });
  455. AddArraySlot(b1.list, {    // 10
  456.     level: 2,
  457.     item: c22
  458. });
  459. AddArraySlot(book.browsers, b1);
  460.  
  461. // Indices and Sub-Indices
  462.