[squeak-dev] The Trunk: Morphic-bf.618.mcz

Chris Muller asqueaker at gmail.com
Sat Apr 14 20:43:02 UTC 2012


Hmm, no time to look into it today but just from memory -- I think
that is (trying to) handle the case where the selected item was
changed by domain code (e.g., not user selection), but for the filter
already applied by the list, it wouldn't be able to be selected, so it
removes the filter to allow it to be selected..

On Sat, Apr 14, 2012 at 3:21 PM, Bert Freudenberg <bert at freudenbergs.de> wrote:
> On 14.04.2012, at 11:36, Chris Muller wrote:
>
>> Awesome!  Thanks Bert!
>
> Hehe.
>
> I'm still puzzled by the #removeFilter send in PluggableListMorph>>update:. I made it do less harm, but couldn't quite figure out how it's supposed to work (in particular since it does not seem to update the list after removing the filter).
>
> - Bert -
>
>> On Fri, Apr 13, 2012 at 6:34 PM,  <commits at source.squeak.org> wrote:
>>> Bert Freudenberg uploaded a new version of Morphic to project The Trunk:
>>> http://source.squeak.org/trunk/Morphic-bf.618.mcz
>>>
>>> ==================== Summary ====================
>>>
>>> Name: Morphic-bf.618
>>> Author: bf
>>> Time: 13 April 2012, 4:34:16.297 pm
>>> UUID: 0ab6bc05-3abd-458f-8af2-fc9d6c42d769
>>> Ancestors: Morphic-eem.617
>>>
>>> Fix keyboard filtering in PluggableListMorphOfMany (e.g., the TestRunner's class list)
>>>
>>> =============== Diff against Morphic-eem.617 ===============
>>>
>>> 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."
>>> +                                       (modelIndex > 0 and: [list notNil and: [list size > 0]]) ifTrue: [ self removeFilter ].
>>> -                                       (list notNil and: [list size > 0]) ifTrue: [ self removeFilter ].
>>>                                        modelIndex ]
>>>                                ifFalse: [ uiIndex ]).
>>>                ^ self ]!
>>>
>>> Item was changed:
>>>  ----- Method: PluggableListMorphOfMany>>itemSelectedAmongMultiple: (in category 'model access') -----
>>>  itemSelectedAmongMultiple: index
>>> +       ^self listSelectionAt: (self modelIndexFor: index)!
>>> -       ^self listSelectionAt: index!
>>>
>>> Item was changed:
>>>  ----- Method: PluggableListMorphOfMany>>mouseDown: (in category 'event handling') -----
>>>  mouseDown: event
>>> +       | oldIndex oldVal row index |
>>> -       | oldIndex oldVal row |
>>>        event yellowButtonPressed ifTrue: [^ self yellowButtonActivity: event shiftPressed].
>>>        row := self rowAtLocation: event position.
>>>
>>>        row = 0 ifTrue: [^super mouseDown: event].
>>> +       index := self modelIndexFor: row.
>>>
>>>        model okToChange ifFalse: [^ self].  "No change if model is locked"
>>>
>>>        "Set meaning for subsequent dragging of selection"
>>> +       dragOnOrOff := (self listSelectionAt: index) not.
>>> -       dragOnOrOff := (self listSelectionAt: row) not.
>>>        oldIndex := self getCurrentSelectionIndex.
>>>        oldIndex ~= 0 ifTrue: [oldVal := self listSelectionAt: oldIndex].
>>>
>>>        "Set or clear new primary selection (listIndex)"
>>>        dragOnOrOff
>>> +               ifTrue: [self changeModelSelection: index]
>>> -               ifTrue: [self changeModelSelection: (self modelIndexFor: row)]
>>>                ifFalse: [self changeModelSelection: 0].
>>>
>>>        "Need to restore the old one, due to how model works, and set new one."
>>>        oldIndex ~= 0 ifTrue: [self listSelectionAt: oldIndex put: oldVal].
>>> +       self listSelectionAt: index put: dragOnOrOff.
>>> -       self listSelectionAt: row put: dragOnOrOff.
>>>        "event hand releaseMouseFocus: aMorph."
>>> + !
>>> -       "aMorph changed"!
>>>
>>> Item was changed:
>>>  ----- Method: PluggableListMorphOfMany>>mouseMove: (in category 'event handling') -----
>>>  mouseMove: event
>>>        "The mouse has moved, as characterized by the event provided.  Adjust the scrollbar, and alter the selection as appropriate"
>>>
>>> +       | oldIndex oldVal row index |
>>> -       | oldIndex oldVal row |
>>>        event position y < self top
>>>                ifTrue:
>>>                        [scrollBar scrollUp: 1.
>>>                        row := self rowAtLocation: scroller topLeft + (1 @ 1)]
>>>                ifFalse:
>>>                        [row := event position y > self bottom
>>>                                ifTrue:
>>>                                        [scrollBar scrollDown: 1.
>>>                                        self rowAtLocation: scroller bottomLeft + (1 @ -1)]
>>>                                ifFalse: [ self rowAtLocation: event position]].
>>>        row = 0 ifTrue: [^super mouseDown: event].
>>> +       index := self modelIndexFor: row.
>>>
>>>        model okToChange ifFalse: [^self].      "No change if model is locked"
>>>
>>>        dragOnOrOff ifNil:
>>>                        ["Was not set at mouse down, which means the mouse must have gone down in an area where there was no list item"
>>> +                       dragOnOrOff := (self listSelectionAt: index) not].
>>> -                       dragOnOrOff := (self listSelectionAt: row) not].
>>>
>>>        "Set meaning for subsequent dragging of selection"
>>>        oldIndex := self getCurrentSelectionIndex.
>>>        oldIndex ~= 0 ifTrue: [oldVal := self listSelectionAt: oldIndex].
>>>
>>>        "Set or clear new primary selection (listIndex)"
>>>        dragOnOrOff
>>> +               ifTrue: [self changeModelSelection: index]
>>> -               ifTrue: [self changeModelSelection: (self modelIndexFor: row)]
>>>                ifFalse: [self changeModelSelection: 0].
>>>
>>>        "Need to restore the old one, due to how model works, and set new one."
>>>        oldIndex ~= 0 ifTrue: [self listSelectionAt: oldIndex put: oldVal].
>>> +       self listSelectionAt: index put: dragOnOrOff.
>>> + !
>>> -       self listSelectionAt: row put: dragOnOrOff.
>>> -       row changed!
>>>
>>>
>>
>
>
>
>


More information about the Squeak-dev mailing list