The Trunk: Morphic-mt.1659.mcz

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

The Trunk: Morphic-mt.1659.mcz

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

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

Name: Morphic-mt.1659
Author: mt
Time: 19 May 2020, 2:32:16.407702 pm
UUID: a50918d1-5a41-774e-81c6-696146b0dd2c
Ancestors: Morphic-nice.1658

Like in the code browser, show class icons in object explorer for non-visual objects.

Depends on the browser's #showClassIcons preference as well as #visualExplorer. Routed through ObjectExplorerWrapper in case we decide to decouple those preferences for dependency concerns between Morphic <-> Tools package.

Maybe we should move ObjectExplorerWrapper into the Tools package.

=============== Diff against Morphic-nice.1658 ===============

Item was added:
+ ----- Method: ObjectExplorerWrapper class>>showClassIcons (in category 'preferences') -----
+ showClassIcons
+ ^ Browser showClassIcons!

Item was added:
+ ----- Method: ObjectExplorerWrapper class>>showClassIcons: (in category 'preferences') -----
+ showClassIcons: aBoolean
+ Browser showClassIcons: aBoolean.!

Item was changed:
  ----- Method: ObjectExplorerWrapper>>icon (in category 'accessing') -----
  icon
  "Answer a form to be used as icon"
  ^ Preferences visualExplorer
  ifTrue: [([self object iconOrThumbnailOfSize: 12] on: Error do: [nil])
+ ifNil: [self class showClassIcons
+ ifTrue: [ToolIcons iconNamed: self object class toolIcon]
+ ifFalse: [self class showContentsInColumns
+ ifTrue: [ToolIcons iconNamed: #blank]
+ ifFalse: [nil]]]]
- ifNil: [self class showContentsInColumns
- ifTrue: [ToolIcons iconNamed: #blank]
- ifFalse: [nil]]]
  ifFalse: [nil]!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-mt.1659.mcz

K K Subbu
On 19/05/20 12:32 pm, [hidden email] wrote:
> + ifTrue: [ToolIcons iconNamed: self object class toolIcon]

Instead of adding a toolIcon method to every class, the code can check
if ToolIcons already contains a icon under the class name (in lowercase)

   ToolIcons iconNamed: self object class .. ifAbsent: [ ... ]

This will avoid trivial methods like:

Foo class>>toolIcon  ^#foo

Regards .. Subbu

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-mt.1659.mcz

marcel.taeumel
Hmm... I don't think the class name matches the icon's identifier that often. Here are some thoughts about performance in tools:

[ToolIcons iconNamed: #collection] bench
--- '6,880,000 per second. 145 nanoseconds per run. 12.64 % GC time.'

[ToolIcons iconNamed: Collection name asLowercase asSymbol] bench 
--- '2,140,000 per second. 467 nanoseconds per run. 4.59908 % GC time.'

[Set withAllSuperclasses
detect: [:cls | ToolIcons respondsTo: cls name asLowercase asSymbol]
ifFound: [:cls | ToolIcons iconNamed: cls name asLowercase asSymbol  "for caching"]
ifNone: [nil]] bench 
--- '303,000 per second. 3.3 microseconds per run. 2.59948 % GC time.'

Best,
Marcel

Am 19.05.2020 20:09:53 schrieb K K Subbu <[hidden email]>:

On 19/05/20 12:32 pm, [hidden email] wrote:
> + ifTrue: [ToolIcons iconNamed: self object class toolIcon]

Instead of adding a toolIcon method to every class, the code can check
if ToolIcons already contains a icon under the class name (in lowercase)

ToolIcons iconNamed: self object class .. ifAbsent: [ ... ]

This will avoid trivial methods like:

Foo class>>toolIcon ^#foo

Regards .. Subbu