'From Moshi of 3 March 2007 [latest update: #250] on 19 July 2007 at 12:48:55 am'! "Change Set: viewerSearchAgain-sw Date: 19 July 2007 Author: Scott Wallace Eliminate all non-letters from the string processing associated with Viewer Search. Cross-published from moshi update 0253viewerSearchAgain-sw. "! !SearchingViewer methodsFor: 'search' stamp: 'sw 7/19/2007 00:45'! doSearchFrom: aSource interactive: isInteractive "Perform the search operation. If interactive is true, this actually happened because a search button was pressed; if false, it was triggered some other way for which an informer would be inappropriate." | searchFor aVocab aList all anInterface useTranslations scriptNames addedMorphs | searchString := aSource isString ifTrue: [aSource] ifFalse: [(aSource isKindOf: PluggableTextMorph) "old" ifTrue: [aSource text string] ifFalse: [aSource contents asString]]. searchFor _ searchString asLowercaseAlphabetic. aVocab _ self outerViewer currentVocabulary. (useTranslations _ (scriptedPlayer isPlayerLike) and: [aVocab isEToyVocabulary]) ifTrue: [all _ scriptedPlayer costume selectorsForViewer. all addAll: (scriptNames _ scriptedPlayer class namedTileScriptSelectors)] ifFalse: [all _ scriptNames _ scriptedPlayer class allSelectors]. aList _ all select: [:aSelector | (aVocab includesSelector: aSelector forInstance: scriptedPlayer ofClass: scriptedPlayer class limitClass: ProtoObject) and: [(useTranslations and: [(anInterface _ aVocab methodInterfaceAt: aSelector ifAbsent: [nil]) notNil and: [anInterface wording asString asLowercaseAlphabetic includesSubstring: searchFor caseSensitive: true]]) or: [((scriptNames includes: aSelector) or: [useTranslations not]) and: [aSelector includesSubstring: searchFor caseSensitive: false]]]]. aList _ aList asSortedArray. self removeAllButFirstSubmorph. "that being the header" self addAllMorphs: ((addedMorphs _ scriptedPlayer tilePhrasesForSelectorList: aList inViewer: self)). self enforceTileColorPolicy. self secreteCategorySymbol. self world ifNotNil: [self world startSteppingSubmorphsOf: self]. self adjustColorsAndBordersWithin. owner ifNotNil: [owner isStandardViewer ifTrue: [owner fitFlap]. (isInteractive and: [addedMorphs isEmpty]) ifTrue: [searchFor ifNotEmpty: [self inform: ('No matches found for "' translated), searchFor, '"']]]! ! !String methodsFor: 'converting' stamp: 'sw 7/19/2007 00:44'! asLowercaseAlphabetic "Return a copy of the receiver from which all non-alphabetic chars have been removed" ^ self select: [:ch | ch isLetter] thenCollect: [:l | l asLowercase] " ' ? abc 8/ d ' asLowercaseAlphabetic " ! !