Squeak Class Documentation category index | class index  
 
BookMorph
  category: Morphic-Books
  superclass: BooklikeMorph
  subclasses: TabbedPalette GeeBookMorph MoviePlayerMorph StackMorph StoryboardBookMorph

A collection of pages, each of which is a place to put morphs. Allows one or another page to show; orchestrates the page transitions; offers control panel for navigating among pages and for adding and deleting pages.

To write a book out to the disk or to a file server, decide what folder it goes in. Construct a url to a typical page:
file://myDisk/folder/myBook1.sp
or
ftp://aServer/folder/myBook1.sp

Choose "send all pages to server" from the book's menu (press the <> part of the controls). Choose "use page numbers". Paste in the url.

To load an existing book, find its ".bo" file in the file list browser. Choose "load as book".

To load an existing book from its url, execute:
Ã(URLMorph grabURL: 'ftp://aServer/folder/myBook1.sp') book: true.

Multiple people may modify a book. If other people may have changed a book you have on your screen, choose "reload all from server".

Add or modify a page, and choose "send this page to server".

The polite thing to do is to reload before changing a book. Then write one or all pages soon after making your changes. If you store a stale book, it will wipe out changes that other people made in the mean time.

Pages may be linked to each other. To create a named link to a new page, type the name of the page in a text area in a page. Select it and do Cmd-6. Choose 'link to'. A new page of that name will be added at the back of the book. Clicking on the blue text flips to that page.
To create a link to an existing page, first name the page. Go to that page and Cmd-click on it. The name of the page is below the page. Click in it and backspace and type. Return to the page you are linking from. Type the name. Cmd-6, 'link to'.

Text search: Search for a set of fragments. allStrings collects text of fields. Turn to page with all fragments on it and highlight the first one. Save the container and offset in properties: #searchContainer, #searchOffset, #searchKey. Search again from there. Clear those at each page turn, or change of search key.

[rules about book indexes and pages: Index and pages must live in the same directory. They have the same file prefix, followed by .bo for the index or 4.sp for a page (or x4.sp). When a book is moved to a new directory, the load routine gets the new urls for all pages and saves those in the index. Book stores index url in property #url.
Allow mulitple indexes (books) on the same shared set of pages. If book has a url in same directory as pages, allow them to have different prefixes.
save all pages first time, save one page first time, fromRemoteStream: (first time)
save all pages normal , save one page normal, reload
where I check if same dir]
URLMorph holds url of both page and book.

instance methods
  accessing
  allNonSubmorphMorphs
currentPage
pageNamed:
pageNumberOf:
pages
pages:
setAllPagesColor:
userString

  copying
  updateReferencesUsing:

  drawing
  fullDrawPostscriptOn:

  dropping/grabbing
  acceptDroppingMorph:event:
allowSubmorphExtraction
wantsDroppedMorph:event:

  initialization
  fromRemoteStream:
fromURL:
initialize
initializeToStandAlone
newPages:
newPages:currentIndex:
removeEverything
setInitialState

  insert and delete
  defaultNameStemForNewPages
deletePage
deletePageBasic
insertPage:pageSize:
insertPage:pageSize:atIndex:
insertPageColored:
insertPageLabel:morphs:
insertPageSilentlyAtEnd

  menu
  addBookMenuItemsTo:hand:
bookmarkForThisPage
buildThreadOfProjects
copyUrl
findText:
findText:inStrings:startAt:container:pageNum:
forgetURLs
getAllText
getStemUrl
goToPage
highlightText:at:in:
invokeBookMenu
keepTogether
loadImagesIntoBook
makeUniformPageSize
menuPageSoundFor:event:
menuPageSoundForAll:
menuPageSoundForThisPage:
menuPageVisualFor:event:
menuPageVisualForAll:
menuPageVisualForThisPage:
pageControlsVisible
pasteBookPage
reload
reserveUrls
reserveUrlsIfNeeded
saveAsNumberedURLs
saveIndexOfOnly:
saveIndexOnURL
saveOnUrlPage:
saveOneOnURL
savePagesOnURL
setNewPagePrototype
setPageColor
textSearch
textSearch:
thumbnailForThisPage
toggleFullScreen
toggleShowingOfPageControls
uncachePageSorter

  navigation
  buildFloatingPageControls
goToPage:
goToPage:transitionSpec:
goToPageMorph:
goToPageMorph:fromBookmark:
goToPageMorph:transitionSpec:
goToPageUrl:
goto:
insertPageMorphInCorrectSpot:
lastPage
nextPage
pageNumber
previousPage
setWrapPages:
showMoreControls
transitionSpecFor:

  object fileIn
 

  other
  abandon
adjustCurrentPageForFullScreen
configureForKids
defersHaloOnClickTo:
exitFullScreen
goFullScreen
isInFullScreenMode
makeMinimalControlsWithColor:title:
releaseCachedState
resizePagesTo:
succeededInRevealing:

  printing
  asPostscript
pagesHandledAutomatically
printPSToFile

  scripting
  chooseAndRevertToVersion
installRollBackButtons
methodHolderVersions
methodHolders
revertToCheckpoint:

  sorting
  acceptSortedContentsFrom:
morphsForPageSorter
sortPages
sortPages:

class methods
  booksAsProjects
  makeBookOfProjects:named:

  parts bin
  descriptionForPartsBin

  scripting
  additionsToViewerCategories
authoringPrototype
nextPageButton
previousPageButton

  url
  alreadyInFromUrl:
grabURL:
isInWorld:withUrl:

instance methods
  accessing top  
 

allNonSubmorphMorphs

Return a collection containing all morphs in this morph which are not currently in the submorph containment hierarchy. Especially the non-showing pages in BookMorphs. (As needed, make a variant of this that brings in all pages that are not in memory.)


 

currentPage


 

pageNamed:


 

pageNumberOf:

Modified so that if the page IS in memory, other pages don't have to be brought in. (This method may wrongly say a page is not here if pages has a tombstone (MorphObjectOut) and that tombstone would resolve to an object already in this image. This is an unlikely case, and callers just have to tolerate it.)


 

pages


 

pages:


 

setAllPagesColor:

Set the color of all the pages to a new color


 

userString

Do I have a text string to be searched on?


  copying top  
 

updateReferencesUsing:

Update intra-morph references within a composite morph that has
been copied. For example, if a button refers to morph X in the orginal
composite then the copy of that button in the new composite should refer to
the copy of X in new composite, not the original X. This default
implementation updates the contents of any morph-bearing slot. It may be
overridden to avoid this behavior if so desired.


  drawing top  
 

fullDrawPostscriptOn:


  dropping/grabbing top  
 

acceptDroppingMorph:event:

Allow the user to add submorphs just by dropping them on this morph.


 

allowSubmorphExtraction


 

wantsDroppedMorph:event:

Return true if the receiver wishes to accept the given morph, which is being dropped by a hand in response to the given event. Note that for a successful drop operation both parties need to agree. The symmetric check is done automatically via aMorph wantsToBeDroppedInto: self.


  initialization top  
 

fromRemoteStream:

Make a book from an index and a bunch of pages on a server. NOT showing any page! Index and pages must live in the same directory. If the book has moved, save the current correct urls for each of the pages. Self must already have a url stored in property #url.


 

fromURL:

Make a book from an index and a bunch of pages on a server. NOT showing any page!


 

initialize


 

initializeToStandAlone

Set up the receiver, created by a #basicNew and now ready to be initialized, as a fully-formed morph suitable for providing a graphic for a parts bin surrogate, and, when such a parts-bin surrogate is clicked on, for attaching to the hand as a viable stand-alone morph. Because of historical precedent, #initialize has been expected to handle this burden, though a great number of morphs actually cannot stand alone. In any case, by default we call the historical #initialize, though unhappily, so that all existing morphs will work no worse than before when using this protocol.


 

newPages:

Replace all my pages with the given list of BookPageMorphs. After this call, currentPage may be invalid.


 

newPages:currentIndex:

Replace all my pages with the given list of BookPageMorphs. Make the current page be the page with the given index.


 

removeEverything


 

setInitialState


  insert and delete top  
 

defaultNameStemForNewPages

Answer a stem onto which to build default names for fresh pages


 

deletePage


 

deletePageBasic


 

insertPage:pageSize:


 

insertPage:pageSize:atIndex:


 

insertPageColored:

Insert a new page for the receiver, using the given color as its background color


 

insertPageLabel:morphs:


 

insertPageSilentlyAtEnd

Create a new page at the end of the book. Do not turn to it.


  menu top  
 

addBookMenuItemsTo:hand:


 

bookmarkForThisPage

If this book exists on a server, make the reference via a URL


 

buildThreadOfProjects


 

copyUrl

Copy this page's url to the clipboard


 

findText:

Turn to the next page that has all of the strings mentioned on it. Highlight where it is found. allText and allTextUrls have been set. Case insensitive search.
Resuming a search. If container's text is still in the list and secondary keys are still in the page, (1) search rest of that container. (2) search rest of containers on that page (3) pages till end of book, (4) from page 1 to this page again.


 

findText:inStrings:startAt:container:pageNum:

Call once to search a page of the book. Return true if found and highlight the text. oldContainer should be NIL.
(oldContainer is only non-nil when (1) doing a 'search again' and (2) the page is in memory and (3) keys has just one element. oldContainer is a TextMorph.)


 

forgetURLs

About to save these objects in a new place. Forget where stored now. Must bring in all pages we don't have.


 

getAllText

Collect the text for each page. Just point at strings so don't have to recopy them. Parallel array of urls for ID of pages.
allText = Array (pages size) of arrays (fields in it) of strings of text.
allTextUrls = Array (pages size) of urls or page numbers.
For any page that is out, text data came from .bo file on server.
Is rewritten when one or all pages are stored.


 

getStemUrl

Try to find the old place where this book was stored. Confirm with the
user. Else ask for new place.


 

goToPage


 

highlightText:at:in:

Find the container with this text and highlight it. May not be able to do it for stringMorphs.


 

invokeBookMenu

Invoke the book's control panel menu.


 

keepTogether

Mark this book so that each page will not go into a separate file. Do this when pages share referenes to a common Player. Don't want many copies of that Player when bring in. Do not write pages of book out. Write the PasteUpMorph that the entire book lives in.


 

loadImagesIntoBook

PowerPoint stores GIF presentations as individual slides named Slide1, Slide2, etc.
Load these into the book. mjg 9/99


 

makeUniformPageSize

Make all pages be of the same size as the current page.


 

menuPageSoundFor:event:


 

menuPageSoundForAll:


 

menuPageSoundForThisPage:


 

menuPageVisualFor:event:


 

menuPageVisualForAll:


 

menuPageVisualForThisPage:


 

pageControlsVisible


 

pasteBookPage


 

reload

Fetch the pages of this book from the server again. For all pages that have not been modified, keep current ones. Use new pages. For each, look up in cache, if time there is equal to time of new, and its in, use the current morph.
Later do fancy things when a page has changed here, and also on the server.


 

reserveUrls

Save a dummy version of the book first, assign all pages URLs, write dummy files to reserve the url, and write the index. Good when I have pages with interpointing bookmarks.


 

reserveUrlsIfNeeded

See if this book needs to pre-allocate urls. Harmless if have urls already. Actually writes dummy files to reserve names.


 

saveAsNumberedURLs

Write out all pages in this book that are not showing, onto a server. The local disk could be the server. For any page that does not have a SqueakPage and a url already, name that page file by its page number. Any pages that are already totally out will stay that way.


 

saveIndexOfOnly:

Modify the index of this book on a server. Read the index, modify the entry for just this page, and write back. See saveIndexOnURL. (page file names must be unique even if they live in different directories.)


 

saveIndexOnURL

Make up an index to the pages of this book, with thumbnails, and store it on the server. (aDictionary, aMorphObjectOut, aMorphObjectOut, aMorphObjectOut). The last part corresponds exactly to what pages looks like when they are all out. Each holds onto a SqueakPage, which holds a url and a thumbnail.


 

saveOnUrlPage:

Write out this single page in this book onto a server. See savePagesOnURL. (Don't compute the texts, only this page's is written.)


 

saveOneOnURL

Write out this single page onto a server. See savePagesOnURL. (Don't compute the texts, only this page's is written.)


 

savePagesOnURL

Write out all pages in this book onto a server. For any page that does not have a SqueakPage and a url already, ask the user for one. Give the option of naming all page files by page number. Any pages that are not in memory will stay that way. The local disk could be the server.


 

setNewPagePrototype

Record the current page as the prototype to be copied when inserting new pages.


 

setPageColor

Get a color from the user, then set all the pages to that color


 

textSearch

search the text on all pages of this book


 

textSearch:

search the text on all pages of this book


 

thumbnailForThisPage


 

toggleFullScreen


 

toggleShowingOfPageControls


 

uncachePageSorter


  navigation top  
 

buildFloatingPageControls


 

goToPage:


 

goToPage:transitionSpec:


 

goToPageMorph:


 

goToPageMorph:fromBookmark:

This protocol enables sensitivity to a transitionSpec on the bookmark


 

goToPageMorph:transitionSpec:


 

goToPageUrl:


 

goto:


 

insertPageMorphInCorrectSpot:


 

lastPage


 

nextPage


 

pageNumber


 

previousPage


 

setWrapPages:


 

showMoreControls


 

transitionSpecFor:


  object fileIn top  

  other top  
 

abandon

Like delete, but we really intend not to use this morph again. Make the page cache release the page object.


 

adjustCurrentPageForFullScreen


 

configureForKids


 

defersHaloOnClickTo:

If a cmd-click on aSubMorph would make it a preferred recipient of the halo, answer true


 

exitFullScreen


 

goFullScreen


 

isInFullScreenMode


 

makeMinimalControlsWithColor:title:


 

releaseCachedState

Release the cached state of all my pages.


 

resizePagesTo:


 

succeededInRevealing:


  printing top  
 

asPostscript


 

pagesHandledAutomatically


 

printPSToFile

Ask the user for a filename and print this morph as postscript.


  scripting top  
 

chooseAndRevertToVersion

Let the user choose an older version for all code in MethodMorphs in this book. Run through that code and revert each one to that time.


 

installRollBackButtons

In each script in me, put a versions button it the upper right.


 

methodHolderVersions

Create lists of times of older versions of all code in MethodMorphs in this book.


 

methodHolders

search for all scripts that are in MethodHolders. These are the ones that have versions.


 

revertToCheckpoint:

Put all scripts (that appear in MethodPanes) back to the way they were at an earlier time.


  sorting top  
 

acceptSortedContentsFrom:

Update my page list from the given page sorter.


 

morphsForPageSorter


 

sortPages


 

sortPages:


class methods
  booksAsProjects top  
 

makeBookOfProjects:named:


BookMorph makeBookOfProjects: (Project allProjects select: [ :each | each world isMorph])


  parts bin top  
 

descriptionForPartsBin

If the receiver is a member of a class that would like to be represented in a parts bin, answer the name by which it should be known, and a documentation string to be provided, for example, as balloon help. When the 'nativitySelector' is sent to the 'globalReceiver', it is expected that some kind of Morph will result. The parameters used in the implementation below are for documentation purposes only!


  scripting top  
 

additionsToViewerCategories

Answer a list of (<categoryName> <list of category specs>) pairs that characterize the phrases this kind of morph wishes to add to various Viewer categories.


 

authoringPrototype

Answer an instance of the receiver suitable for placing in a parts bin for authors


 

nextPageButton

Answer a button that will take the user to the next page of its enclosing book


 

previousPageButton

Answer a button that will take the user to the previous page of its enclosing book


  url top  
 

alreadyInFromUrl:

Does a bookMorph living in some world in this image represent the same set of server pages? If so, don't create another one. It will steal pages from the existing one. Go delete the first one.


 

grabURL:

Create a BookMorph for this url and put it in the hand.


 

isInWorld:withUrl:

If a book with this url is in the that (current) world, return it. Say if it is out or in another world.