[squeak-dev] The Trunk: Morphic-mt.1347.mcz

Bert Freudenberg bert at freudenbergs.de
Tue Jul 18 21:31:31 UTC 2017


How about using onDNU: instead of respondsTo:?

    windowColor := [each model windowColorToUse] onDNU: #windowColorToUse
 do:
        [UserInterfaceTheme current get: #uniformWindowColor for: Model].

I don't have a strong opinion, but it feels "cleaner".

- Bert -

On Tue, Jul 18, 2017 at 9:14 PM, Eliot Miranda <eliot.miranda at gmail.com>
wrote:

> nice!
>
> On Tue, Jul 18, 2017 at 1:12 AM, <commits at source.squeak.org> wrote:
>
>> Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
>> http://source.squeak.org/trunk/Morphic-mt.1347.mcz
>>
>> ==================== Summary ====================
>>
>> Name: Morphic-mt.1347
>> Author: mt
>> Time: 18 July 2017, 10:11:56.69381 am
>> UUID: f95fc4b5-03e5-2f45-9a3f-087fb10cae98
>> Ancestors: Morphic-eem.1346
>>
>> Regarding window colors and window listing, improve robustness for models
>> that do not subclass Model and forget to provide #windowColorToUse.
>>
>> Note that we could have added that message to Object but I do prefer not
>> to clutter the interface any further.
>>
>> =============== Diff against Morphic-eem.1346 ===============
>>
>> Item was changed:
>>   ----- Method: TheWorldMainDockingBar>>listWindowsOn: (in category
>> 'submenu - windows') -----
>>   listWindowsOn: menu
>>
>>         | windows |
>>         windows := self allVisibleWindows sorted: [:winA :winB |
>>                 ((winA model isNil or: [winB model isNil]) or: [winA
>> model name = winB model name])
>>                         ifTrue: [winA label < winB label]
>>                         ifFalse: [winA model name < winB model name]].
>>         windows ifEmpty: [
>>                 menu addItem: [ :item |
>>                         item
>>                                 contents: 'No Windows' translated;
>>                                 isEnabled: false ] ].
>>         windows do: [ :each |
>> +               | windowColor |
>> +               windowColor := (each model respondsTo: #windowColorToUse)
>> +                       ifTrue: [each model windowColorToUse]
>> +                       ifFalse: [UserInterfaceTheme current get:
>> #uniformWindowColor for: Model].
>>                 menu addItem: [ :item |
>>                         item
>>                                 contents: (self windowMenuItemLabelFor:
>> each);
>> +                               icon: (self colorIcon: windowColor);
>> -                               icon: (each model ifNotNil: [self
>> colorIcon: each model windowColorToUse]);
>>                                 target: each;
>>                                 selector: #comeToFront;
>>                                 subMenuUpdater: self
>>                                 selector: #windowMenuFor:on:
>>                                 arguments: { each };
>>                                 action: [ each beKeyWindow; expand ] ] ].
>>         menu
>>                 addLine;
>>                 add: 'Close all windows' target: self selector:
>> #closeAllWindowsUnsafe;
>>                 addItem: [:item | item
>>                         contents: 'Close all windows without changes';
>>                         target: self;
>>                         icon: MenuIcons smallBroomIcon;
>>                         selector: #closeAllWindows];
>>                 add: 'Close all windows but workspaces' target: self
>> selector: #closeAllWindowsButWorkspaces.!
>>
>>
>>
>
>
> --
> _,,,^..^,,,_
> best, Eliot
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20170718/16139e87/attachment.html>


More information about the Squeak-dev mailing list