Hi all, just coming back ... yes if "not styled" is the default then #okToStyle should return false if #shoutAboutToStyle is not implemented by the model:
(model respondsTo: #shoutAboutToStyle:) ifFalse: [^true].
should be:
(model respondsTo: #shoutAboutToStyle:) ifFalse: [^false].
Cheers Alain On 04/09/2011 14:25, Stéphane Ducasse wrote:
The inspector is shouted because the "not to shout" was the default behavior of Shout, but now, okToStyle self shoutEnabled ifFalse: [^ false]. (model respondsTo: #shoutAboutToStyle:) ifFalse: [^true]. ^model shoutAboutToStyle: self the bold part make the default behavior "to shout". So maybe this value should be changed. But let's wait for Alain explanation
No, #shoutEnabled returning true makes it enabled.
I do not get it
okToStyle self shoutEnabled ifFalse: [^ false]. (model respondsTo: #shoutAboutToStyle:) ifFalse: [^true]. ^model shoutAboutToStyle: self
shoutEnabled ^ self class shoutEnabled
shoutEnabled ^ (Smalltalk globals includesKey: #SHPreferences) and: [(Smalltalk globals at: #SHPreferences) enabled]
so when shout is loaded self shoutEnabled = true
self shoutEnabled ifFalse: [^ false].
So okToStyle will return true when the method shoutAboutToStyle: is not defined
(model respondsTo: #shoutAboutToStyle:) ifFalse: [^true].
and this is this default that I'm talking about. Because if we would return false then only places that specifically define shoutAboutToStyle would be styled.
No?
Stef