Copyright © 1994-1995 by Creative Digital, Inc. All rights reserved. This article is reprinted from the May 1994 issue of PDA Developers magazine, a bimonthly technical journal for programmers creating software for handheld devices. For more information about PDA Developers, contact Creative Digital at 415.621.4252 or cdi@cdigital.com.
The Newton Book Maker is a simple tool that you can use to take the information important to you and put it on your Newton. You don't need to be a programmer to take advantage of Book Maker, but a procedure for book making helps smooth the process. This article contains some guidelines, assembled over the course of a half dozen or so projects, that can make book making easier and help you produce better books. I discuss preparation, design, technique, testing and some routines you can copy and use in your own products.
The simplest way to describe bookmaking is:
Note: In this article, places where you substitute your own names are noted within <>, as in ".story <YourStoryName>". The actual command you use would read ".story MyStoryName".
A good word processor makes data cleanup easier. Check the spelling, of course. If possible, read or at least skim over the text looking for glaring grammar errors. Are capitals and mixed cases accurate and consistent throughout the text? If the text reads "Personal Digital Assistant" in one place, is it the same everywhere? What about acronyms (CDROM, CD-ROM) and hyphenated words (on-line, on line, online)? If the document has paragraph styles or style sheets, test a small subset of the text to see whether Book Maker recognizes the styles. If it does, you can leave them; if not you have to eliminate the styles and set the font, size and other text attributes directly. Eliminate or replace any special character fonts (such as bullets in Symbol font). A word processor with font and format based search ability in its find/replace function (such as Microsoft Word) is very helpful here.
Rule of Thumb for Space: The word processor document is approximately equal to the size of the final Newton Book. The package is usually about twice the word processor file size, but Newton compresses at around 2:1. This is rough, and varies depending on the type of information, but it should keep you from having to delete text near the end of the project.
.layout <yourlayout name> 12 noTitle .running picture
A Word on Subjects and Levels
The NoExtend flag prevents the last entry from highlighting to the bottom of the screen..story goto=<wherever> NoExtend .script viewClickScript if (:TrackHilite(aClick)) then begin :buttonClickScript(); :Hilite(NIL); end; TRUE; .endscript <KIOSK ENTRY>
The simplest script for using a storycard is:
.script
:ShowStoryCard('<somename>, "<title>",
{left: <w>, top: <x>, right: <y>, bottom: <z>});
.endscript
The .script command and the following information is added to the entry where
you want the user to tap to show the storycard. w, x, y, z are the window's
dimensions. With a book sized 240 pixels wide by 302 long, it may take a
little experimenting to get the window properly placed.
Put the storycards' content near the beginning of the text, after the layouts and prior to the title page. If you have many storycards, performance is faster when they are near the beginning. A typical storycard would look like this:
.story nopage .attribute <somename>: "<title>" <text>
Don't be afraid to leave white space around entries. A crowded page is hard
to read, even more so on an LCD display. Spaces between kiosk items, between
columns, between headings and stories contribute to a better looking page.
Use the .space command, but remember it needs a story (with content) both
above and below it. A story is simply content that is not broken up by other
commands. A story can be an entire document, a paragraph, several pages or a
picture.
Break up stories with space or lines so that a solid text block doesn't
confront the user on each page. Use the edgeTop and edgeBottom commands in
the .story line to get solid lines. Dashed lines gently separate elements
onscreen, and are less distracting to the eye than a solid line (see Figure
5.)
Add this script where you want a dashed line.
.story layout=<yourLayout> edgeTop .script slot drawPenPat vfLtGray .endscript

.running picture in a layout shows the same picture for each page with that
layout. With a goto in the form of .running picture goto=<destination>, the
user can go to the same destination from each page with that layout. What if
you want to use two (or more) icons in a layout and give the user several
places to goto from each entry? For instance, a helpful navigation device is
to include an icon to return to the main kiosk, and an icon to go to the
current level kiosk (see Figure 6).
Here is a technique for using one picture to return to the main kiosk and another picture to go to the current level kiosk. The book commands to do this are fairly simply, but you need to do some preparation in NTK before you can use them.
First, create a ResEdit file containing the pictures for the buttons --
NTK and Book Maker reference this file. Next, in NTK, create a proto layout
with a protoPictureButton for each picture in a clView. Name them
descriptively, as in ToTopKiosk or ToKiosk_A. You don't have to place them
accurately, since filling in the viewBounds takes care of precision placement
(see Figure 7). Next, set the clView viewBounds (see Figure 8). Then, edit
each protoPictureButton as follows:

* Each picture used to send the user to a kiosk gets an icon (select the
appropriate picture from your .rsrc files) and a buttonClickScript like the
following:
// Parent slots: // curRendering // destPage // kioskDest func() begin // Get rid of storyCard before turning away (works around a bug) if (storyCard <> NIL) then :HideStoryCard(); if (curRendering = 0) then // If we're the pre-built size, we know which page to turn to. :TurnToPage(destPage); else // We've been re-layed out, so we'll have to search for the kiosk :TurnToPage(:FindPageByContent(kioskDest,0,NIL)); end
viewBounds (this is where
you place the picture precisely on the Newton screen) and the viewFormat (see
Figure 9). Add a protoPictureButton and a viewSetupFormScript like this
one:
func() begin self.icon := :Parent().icon; end

buttonClickScript like the following:
Enter the appropriate page number for the topmost kiosk; in most books, this is page one, unless you have a title or introductory pages.func() begin // Get rid of storyCard before turning away (works around a bug) if (storyCard <> NIL) then :HideStoryCard(); :TurnToPage(1); end
* Also, give each picture an icon -- select the appropriate icon from your
.rsrc files -- and a protoPictureButton). Finally, set the viewBounds and
viewFormat (see Figure 10).
Finally, as your last step, you need to modify the Book Maker script. In the preamble, add
In the layouts, add:// Opening the resource file for storycards rRef := OpenResFileX(HOME & "<YourResEditFile>.rsrc");
.layout <YourLayout> noTitle
.running form height=20 width=240 goto=<YourKiosk>
{_proto: layout_<YourNTKLayoutName>, icon:
GetPictAsBits("<YourIcon>", NIL)}
You can use your NTK Layout for different headers by creating a separately
named Proto Layout in NTK and a separately name layout in Book Maker for each
header. Insert the appropriate icon name in place of <YourIcon>. The icon
that goes to the topmost kiosk is the same regardless of layout.
.# dot command that indicates
a comment. I use .#---- for stories, .#====== for subjects and .#****** for
kiosks. This makes them easier to find in a long text file. Use the comments
to label large areas like layout declarations, storycard text and kiosks.
I like to put my dot commands in a different font, larger and with the style
set to bold, while working on the book, to make proofing easier. It is
painful to search for a bad .story or .subject command that blends in with
the text above it. Since this takes some discipline, don't forget that you
might have missed a dot command or two when searching for errors.
When the book is done, tested and ready for its final version, change the non-Newton fonts to a Geneva or New York font set to bold or italic to keep them standing out. If they remain in their original font, there's no harm done, but the .f file will show unknown fonts. Though no one but the creator(s) sees the marked up text, highlighting the dot commands makes future changes easier.
Step back and judge:
If the book has groups of data that need browser entries for each group, add
a field (or fields) to indicate the first record for each group. Mark the
first record in each group so that the merge commands will have something to
test for writing the .subject command. See the Sample below, where the first
and third records have Header = "Y" and produce the necessary .subject
commands.
Create a merge file that writes the dot commands around each record, and use the word processor merge command to create the bulk of the Newton Book. Edit the merged file to undo any workarounds that need undoing. Once you have a good merged file, cut and paste the one-time commands and the preamble into the file with and run the final result through Book Maker.
The merge commands I use to create my book file are:Record 1 Header Y Subject Storage ItemName Rewritable Optical Disks Price 32.00 Story1 Massive Storage Capacity Story2 For your mass data & image storage needs Record 2 Header N Subject Storage ItemName Tape Backup Media Price Story1 High Data Storage Capacity Story2 Perfect for unattended backup Record 3 Header Y Subject Displays ItemName Color Terminal Price 350.00 Story1 8-bit color display Story2
Here's the result of merging the two:"DATA ?""IF Header="Y"" .# ============================= .subject 2 browseronly "Subject" "ENDIF" .# ----------------------------- .subject 3 "ItemName" .story startspage centered "Story1" "IF Story2 <> """.space 3 .story "Story2""ENDIF" Price:"IF Price <> """ $"Price""ELSE" n/a"ENDIF"
.# ============================= .subject 2 browseronly Storage .# ----------------------------- .subject 3 Rewritable Optical Disks .story startspage centered Massive Storage Capacity .space 3 .story For your mass data & image storage needs Price:$32.00 .# ----------------------------- .subject 3 Tape Backup Media .story startspage centered High Data Storage Capacity .space 3 .story Perfect for unattended backup .story Price:n/a .# ============================= .subject 2 browseronly Displays .# ----------------------------- .subject 3 Color Terminal .story startspage centered 8-bit color display Price:$350.00
Create some sample books, just for fun, such as your family tree, ten favorite movies or something similar. Since Book Maker gives quick results it's easy to play and learn. When you're ready for a real book, you'll be prepared. We all want information on the Newton to be useful once it's there. A little practice, forethought about the design and attention to detail rewards the Book Maker with a book that conveys information in a way that's attractive and easy to use.