'From etoys2.2 of 24 September 2007 [latest update: #1685] on 4 October 2007 at 10:45:10 pm'! "Change Set: bookMenu-sw Date: 4 October 2007 Author: Scott Wallace Makes the 'book' menu obtained from the halo-menu be the same animal obtained by clicking on the menu-icon in the book's control panel. Adds 'find-again' alongside 'find' in the menu for much greater convenience doing repeated text searches. Provides balloon help for book menu items. Provides #translated/translatedNoop calls as appropriate in the book menu."! !BooklikeMorph methodsFor: 'menus' stamp: 'sw 10/4/2007 22:29'! addCustomMenuItems: aCustomMenu hand: aHandMorph "This factoring allows subclasses to have different menu yet still use the super call for the rest of the metamenu." super addCustomMenuItems: aCustomMenu hand: aHandMorph. aCustomMenu add: 'book...' translated target: self action: #invokeBookMenu. "self addBookMenuItemsTo: aCustomMenu hand: aHandMorph"! ! !BookMorph methodsFor: 'menu' stamp: 'sw 10/4/2007 22:25'! bookMenu "Create and answer the standard book menu." | aMenu | aMenu _ MenuMorph new defaultTarget: self. aMenu addTitle: 'Book' translated. aMenu addStayUpItem. aMenu addTranslatedList: #( ('find...' textSearch 'search the book for word(s)') ('find again' textSearchAgain 'search for the next occurrence of a string') - ('go to page...' goToPage 'go directly to a page, if you know its page-number') ('duplicate this page' duplicatePage 'add a new page just like this one to0 the book.') - ('revert this page' revertPage 'restore this page to its initial condition, if possible.') ('revert entire book' revertAllPages 'restore all pages of this book to their initial condition if possible.') -) translatedNoop. self addBookToggleItemsTo: aMenu. aMenu addTranslatedList: #( - ('sort pages' sortPages 'open a tool allowing you to arrange the pages of the book.') ('hand me a bookmark for this page' bookmarkForThisPage 'make a bookmark object which, when clicked, will make the book turn to this page.') ('hand me a thumbnail for this page' thumbnailForThisPage 'create an icon representing this page') -) translatedNoop. aMenu addLine. self addTransitionItemsTo: aMenu. self addSaveAndRevertItemsTo: aMenu. self addAllPagesItemsTo: aMenu. "At the moment this one does nothing" self addAdvancedItemsTo: aMenu. ^ aMenu " Disused items: 'send all pages to server' savePagesOnURL. 'send this page to server' saveOneOnURL. 'reload all from server' reload. 'keep in one file' keepTogether. 'load PPT images from slide #1' loadImagesIntoBook. 'copy page url to clipboard' copyUrl." ! ! !BookMorph methodsFor: 'menu' stamp: 'sw 10/4/2007 22:13'! invokeBookMenu "Invoke the book's control panel menu." self bookMenu popUpInWorld ! ! !BookMorph methodsFor: 'menu' stamp: 'sw 1/7/2007 02:34'! textSearchAgain "The classic find-again" | wanted wants list | list _ self valueOfProperty: #searchKey ifAbsent: [#()]. wanted _ String streamContents: [:strm | list do: [:each | strm nextPutAll: each; space]]. wants _ wanted findTokens: Character separators. wants isEmpty ifTrue: [^ self]. self getAllText. "save in allText, allTextUrls" ^ self findText: wants "goes to the page and highlights the text"! !