The Trunk: Morphic-mt.1252.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Morphic-mt.1252.mcz

commits-2
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1252.mcz

==================== Summary ====================

Name: Morphic-mt.1252
Author: mt
Time: 10 August 2016, 2:57:41.114966 pm
UUID: 018bb58d-a1dd-9e43-9e29-8ed7e534aeb1
Ancestors: Morphic-mt.1251

Make disabling the preference "filterable list" work again.

=============== Diff against Morphic-mt.1251 ===============

Item was changed:
  ----- Method: LazyListMorph>>displayFilterOn:for:in:font: (in category 'drawing') -----
  displayFilterOn: canvas for: row in: drawBounds font: font
  "Draw filter matches if any."
 
  | fill |
+ listSource filterableList ifFalse: [^ self].
+
  fill := self filterColor isColor
  ifTrue: [SolidFillStyle color: self filterColor]
  ifFalse: [self filterColor].
  fill isGradientFill ifTrue: [
  fill origin: drawBounds topLeft.
  fill direction: 0@ drawBounds height].
 
  (self filterOffsets: row) do: [:offset | | r |
  r := ((drawBounds left + offset first first) @ drawBounds top corner: (drawBounds left + offset first last) @ drawBounds bottom).
  canvas
  frameAndFillRoundRect: (r outsetBy: 1@0)
  radius: 3
  fillStyle: fill
  borderWidth: 1
  borderColor: fill asColor twiceDarker.
  canvas
  drawString: offset second
  in: r
  font: font
  color: self filterTextColor].!

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.
  listSize = 0 ifTrue: [ ^self flash ].
  milliseconds := Time millisecondClockValue.
  slowKeyStroke := (Time
  milliseconds: milliseconds
+ since: lastKeystrokeTime) > (self filterableList ifTrue: [500] ifFalse: [ 300 ]).
- since: lastKeystrokeTime) > (self class filterableLists ifTrue: [500] ifFalse: [ 300 ]).
  lastKeystrokeTime := milliseconds.
  slowKeyStroke
  ifTrue:
+ [ self filterableList ifTrue: [ self hasFilter ifFalse: [ priorSelection := self modelIndexFor: self selectionIndex] ].
- [ self class filterableLists ifTrue: [ self hasFilter ifFalse: [ priorSelection := self modelIndexFor: self selectionIndex] ].
  "forget previous keystrokes and search in following elements"
  lastKeystrokes := aChar asLowercase asString.
  newSelectionIndex := newSelectionIndex \\ listSize + 1.
+ self filterableList ifTrue: [ list := self getFullList ] ]
- self class filterableLists ifTrue: [ list := self getFullList ] ]
  ifFalse: [ "append quick keystrokes but don't move selection if it still matches"
  lastKeystrokes := lastKeystrokes , aChar asLowercase asString.
  newSelectionIndex := newSelectionIndex max: 1 ].
  "No change if model is locked"
  model okToChange ifFalse: [ ^ self ].
+ self filterableList
- 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 changeModelSelection: newSelectionIndex]!

Item was added:
+ ----- Method: PluggableListMorph>>filterableList (in category 'accessing') -----
+ filterableList
+ ^ (self valueOfProperty: #filterableList ifAbsent: [false]) or: [self class filterableLists]!

Item was added:
+ ----- Method: PluggableListMorph>>filterableList: (in category 'accessing') -----
+ filterableList: aBoolean
+ self setProperty: #filterableList toValue: aBoolean.!

Item was changed:
  ----- Method: PluggableListMorph>>getList (in category 'model access') -----
  getList
  "Answer the list to be displayed.  Caches the returned list in the 'list' ivar"
  getListSelector == nil ifTrue: [ ^ Array empty ].
  list := self getFullList.
+ self filterableList ifTrue: [ self filterList ].
- self class filterableLists ifTrue: [ self filterList ].
  ^ list ifNil: [ Array empty ]!