[squeak-dev] The Trunk: Morphic-cmm.577.mcz
Chris Muller
asqueaker at gmail.com
Sat Dec 24 20:52:23 UTC 2011
This is just an old version I just noticed had never been deleted out
of the Inbox. Moved it to trunk.
On Sat, Dec 24, 2011 at 2:49 PM, <commits at source.squeak.org> wrote:
> Chris Muller uploaded a new version of Morphic to project The Trunk:
> http://source.squeak.org/trunk/Morphic-cmm.577.mcz
>
> ==================== Summary ====================
>
> Name: Morphic-cmm.577
> Author: cmm
> Time: 29 August 2011, 9:09:42.052 pm
> UUID: 5227dddb-7836-46d3-9522-a96776d7035c
> Ancestors: Morphic-cmm.576
>
> - When using the new list-filtering, if the user's keystroke will cause filtering to an empty list, then flash rather than present an empty list.
> - Preserve 300ms "slow-keystroke" timing for when the legacy preference is engaged for filterableLists. That way, in case someone wants to press, t -- t -- t to go to the third in the list that starts with 't', they will only have to wait 300ms in between presses.
> - Order the items with front-matching items at the top of the list, and substring-matches below that.
>
> =============== Diff against Morphic-cmm.576 ===============
>
> Item was changed:
> ----- Method: PluggableListMorph>>basicKeyPressed: (in category 'model access') -----
> basicKeyPressed: aChar
> | milliseconds slowKeyStroke listSize newSelectionIndex oldSelectionIndex startIndex |
> oldSelectionIndex := newSelectionIndex := self getCurrentSelectionIndex.
> listSize := self getListSize.
> milliseconds := Time millisecondClockValue.
> slowKeyStroke := (Time
> milliseconds: milliseconds
> + since: lastKeystrokeTime) > (self class filterableLists ifTrue: [500] ifFalse: [ 300 ]).
> - since: lastKeystrokeTime) > 500.
> lastKeystrokeTime := milliseconds.
> slowKeyStroke
> ifTrue:
> [ "forget previous keystrokes and search in following elements"
> lastKeystrokes := aChar asLowercase asString.
> + newSelectionIndex := newSelectionIndex \\ listSize + 1.
> + self class filterableLists ifTrue: [ list := self getFullList ] ]
> - newSelectionIndex := newSelectionIndex \\ listSize + 1 ]
> ifFalse: [ "append quick keystrokes but don't move selection if it still matches"
> lastKeystrokes := lastKeystrokes , aChar asLowercase asString ].
> "No change if model is locked"
> model okToChange ifFalse: [ ^ self ].
> self class filterableLists
> ifTrue:
> [ self
> filterList ;
> updateList.
> newSelectionIndex := self modelIndexFor: 1 ]
> ifFalse:
> [ startIndex := newSelectionIndex.
> listSize := self getListSize.
> [ (self getListItem: newSelectionIndex) asString withBlanksTrimmed asLowercase beginsWith: lastKeystrokes ] whileFalse:
> [ (newSelectionIndex := newSelectionIndex \\ listSize + 1) = startIndex ifTrue: [ ^ self flash"Not in list." ] ].
> newSelectionIndex = oldSelectionIndex ifTrue: [ ^ self flash ] ].
> + (self hasFilter and: [(self getCurrentSelectionIndex = newSelectionIndex) not]) ifTrue:
> - self getCurrentSelectionIndex = newSelectionIndex ifFalse:
> [self changeModelSelection: newSelectionIndex]!
>
> Item was changed:
> ----- Method: PluggableListMorph>>filterList (in category 'filtering') -----
> filterList
> self hasFilter
> ifTrue:
> + [ | frontMatching substringMatching newList |
> + self indicateFiltered.
> + frontMatching := OrderedCollection new.
> + substringMatching := OrderedCollection new.
> + list withIndexDo:
> + [ : each : n | | foundPos |
> + foundPos := each asString
> + findString: lastKeystrokes
> + startingAt: 1
> + caseSensitive: false.
> + foundPos = 1
> + ifTrue: [ frontMatching add: each ]
> + ifFalse:
> + [ foundPos = 0 ifFalse: [ substringMatching add: each ] ] ].
> + newList := frontMatching , substringMatching.
> + newList
> + ifEmpty:
> + [ lastKeystrokes := lastKeystrokes allButLast: 1.
> + self
> + flash ;
> + filterList ]
> + ifNotEmpty: [ list := newList ] ]
> - [ self indicateFiltered.
> - list := Array streamContents:
> - [ : stream | list withIndexDo:
> - [ : each : n | (each asString
> - includesSubstring: lastKeystrokes
> - caseSensitive: false) ifTrue: [ stream nextPut: each ] ] ] ]
> ifFalse: [ self indicateUnfiltered ]!
>
> Item was changed:
> ----- Method: PluggableListMorph>>update: (in category 'updating') -----
> update: aSymbol
> "Refer to the comment in View|update:."
> aSymbol == getListSelector ifTrue:
> [ self updateList.
> ^ self ].
> aSymbol == getIndexSelector ifTrue:
> [ | uiIndex modelIndex |
> uiIndex := self uiIndexFor: (modelIndex := self getCurrentSelectionIndex).
> self selectionIndex:
> (uiIndex = 0
> ifTrue:
> [ "The filter is preventing us from selecting the item we want - remove it."
> + (list notNil and: [list size > 0]) ifTrue: [ self removeFilter ].
> - list size > 0 ifTrue: [ self removeFilter ].
> modelIndex ]
> ifFalse: [ uiIndex ]).
> ^ self ]!
>
>
More information about the Squeak-dev
mailing list
|