#OTHER by cg
big refactoring:
replaced all flyByHelpXXX sends and implementations
by helpXXX. This should remove the confusion on where
the tooltips should be stored and which methods need
to be redefined.
ATTENTION:
May introduce temporary inconveniences until all
other applications (in exept:xxx packages) are changed.
--- a/ApplicationModel.st Tue Jan 16 22:14:09 2018 +0100
+++ b/ApplicationModel.st Tue Jan 16 22:14:16 2018 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 1995 by Claus Gittinger
All Rights Reserved
@@ -198,7 +200,8 @@
!ApplicationModel class methodsFor:'active help'!
flyByHelpSpec
- "default is: take the oldStyle help-spec (should be redefined by concrete class)."
+ "obsolete: only provided for backward compatibility.
+ default is: take the oldStyle help-spec (should be redefined by concrete class)."
^ self helpSpec
!
@@ -2554,7 +2557,7 @@
!ApplicationModel methodsFor:'help texts'!
-basicFlyByHelpTextForKey:aKey
+basicHelpTextForKey:aKey
"flyByHelp interface: return some short help text for a key.
key is the symbol associated with some widget or menu item.
Return the original (english) text as written in the helpSpec;
@@ -2562,17 +2565,23 @@
|helpSpecFromBindings helpText helpSpec "resourceArgs"|
- helpSpecFromBindings := self aspectFor:#flyByHelpSpec.
+ helpSpecFromBindings := self aspectFor:#helpSpec.
helpSpecFromBindings notNil ifTrue:[
helpText := helpSpecFromBindings at:aKey ifAbsent:nil.
- ] ifFalse:[
+ ].
+ helpText isNil ifTrue:[
+ "/ fall back for old apps
helpSpecFromBindings := self aspectFor:#helpSpec.
helpSpecFromBindings notNil ifTrue:[
helpText := helpSpecFromBindings at:aKey ifAbsent:nil.
].
].
helpText isNil ifTrue:[
- helpSpec := self flyByHelpSpec.
+ helpSpec := self helpSpec.
+ helpSpec isNil ifTrue:[
+ "/ fall back for old apps
+ helpSpec := self perform:#flyByHelpSpec ifNotUnderstood:nil.
+ ].
helpSpec notNil ifTrue:[
helpText := helpSpec at:aKey ifAbsent:nil.
].
@@ -2581,7 +2590,7 @@
"/ new: allow for a collection (resource-key arg1 arg2...)
helpText isNonByteCollection ifTrue:[
helpText := helpText first.
-"/ resourceArgs := helpText copyFrom:2.
+ "/ resourceArgs := helpText copyFrom:2.
].
^ helpText
@@ -2589,80 +2598,59 @@
"Modified (comment): / 17-11-2016 / 22:37:05 / cg"
!
-basicHelpTextForKey:aKey
- "activeHelp interface: return some help text for a key
- key is the symbol associated with some widget or menu item.
- Return the original (english) text; needs to be translated as per language"
-
- |helpText helpSpec "resourceArgs"|
-
- helpSpec := self helpSpec.
- helpSpec notNil ifTrue:[
- helpText := helpSpec at:aKey ifAbsent:nil.
- ].
-
- "/ new: allow for a collection (resource-key arg1 arg2...)
- helpText isNonByteCollection ifTrue:[
- helpText := helpText first.
-"/ resourceArgs := helpText copyFrom:2.
- ].
- ^ helpText
-!
-
-flyByHelpSpec
+helpSpec
"activeHelp interface: return some short help text for a widget component"
|specFromBuilder|
builder notNil ifTrue:[
- (specFromBuilder := builder bindingAt:#flyByHelpSpec) notNil ifTrue:[
- ^ specFromBuilder
- ].
-
+ (specFromBuilder := builder bindingAt:#helpSpec) notNil ifTrue:[
+ ^ specFromBuilder
+ ].
].
- ^ self class flyByHelpSpec
-!
-
-flyByHelpTextFor:aComponent
- "activeHelp interface: return some short help text for a widget component"
+ ^ self class helpSpec
+!
+
+helpTextFor:aComponent
+ "activeHelp interface: return some help text for a widget component"
|key|
builder notNil ifTrue:[
(key := builder helpKeyFor:aComponent) notNil ifTrue:[
- ^ self flyByHelpTextForKey:key
+ ^ self helpTextForKey:key
]
].
masterApplication notNil ifTrue:[
- ^ masterApplication flyByHelpTextFor:aComponent
+ ^ masterApplication helpTextFor:aComponent
].
^ nil
"Modified: / 31.7.1998 / 23:03:10 / cg"
!
-flyByHelpTextFor:aComponent at:aPoint
+helpTextFor:aComponent at:aPoint
"if not redefined by subclass, fall back to general method"
- ^ self flyByHelpTextFor:aComponent
+ ^ self helpTextFor:aComponent
"Created: / 09-01-2018 / 16:32:40 / stefan"
!
-flyByHelpTextForKey:aKey
+helpTextForKey:aKey
"flyByHelp interface: return some short help text for a key
key is the symbol associated with some widget or menu item.
- (from my flyByHelpSpec); return a language variant (if available)"
+ (from my helpSpec); return a language variant (if available)"
|helpText translatedHelpText translatedKey|
ActiveHelp debugging ifTrue:[ Transcript showCR:'help key: ', aKey].
- helpText := self basicFlyByHelpTextForKey:aKey.
+ helpText := self basicHelpTextForKey:aKey.
helpText isNil ifTrue:[
masterApplication notNil ifTrue:[
"here we get an already translated helpText"
- helpText := masterApplication flyByHelpTextForKey:aKey.
+ helpText := masterApplication helpTextForKey:aKey.
].
helpText isNil ifTrue:[
"there is no help text - resolve key from resources"
@@ -2690,75 +2678,12 @@
"Modified (comment): / 09-01-2018 / 17:36:30 / stefan"
!
-flyByHelpTextForKey:aKey row:aRowNr
+helpTextForKey:aKey row:aRowNr
"Special interface for DataSet - get the active help text for a specific row"
"Default: no row specific help"
- ^ self flyByHelpTextForKey:aKey.
-!
-
-helpSpec
- "activeHelp interface: return some short help text for a widget component"
-
- ^ self class helpSpec
-!
-
-helpTextFor:aComponent
- "activeHelp interface: return some help text for a widget component"
-
- |key|
-
- builder notNil ifTrue:[
- (key := builder helpKeyFor:aComponent) notNil ifTrue:[
- ^ self helpTextForKey:key
- ]
- ].
- masterApplication notNil ifTrue:[
- ^ masterApplication helpTextFor:aComponent
- ].
- ^ nil
-
- "Modified: / 31.7.1998 / 23:03:10 / cg"
-!
-
-helpTextForKey:aKey
- "activeHelp interface: return some help text for a key
- key is the symbol associated with some widget or menu item.
- (from my helpSpec); return a language variant (if available)"
-
- |helpText translatedHelpText translatedKey|
-
- helpText := self basicHelpTextForKey:aKey.
- helpText isNil ifTrue:[
- masterApplication notNil ifTrue:[
- "here we get an already translated helpText"
- helpText := masterApplication helpTextForKey:aKey.
- ].
- helpText isNil ifTrue:[
- "there is no help text - resolve key from resources"
- helpText := (self translateString:aKey) withCRs.
- ].
- ^ helpText.
- ].
-
- "/ kludge to allow for dynamic translation by the application itself.
- helpText isBlock ifTrue:[
- ^ helpText value.
- ].
-
- "get the translation"
- translatedHelpText := self translateString:helpText.
- translatedHelpText == helpText ifTrue:[
- "there is no translation in the resources - maybe there is one for the key?"
- translatedKey := self translateString:aKey.
- translatedKey ~~ aKey ifTrue:[
- translatedHelpText := translatedKey.
- ].
- ].
- ^ translatedHelpText withCRs.
-
- "Modified: / 22-12-2011 / 11:07:03 / cg"
+ ^ self helpTextForKey:aKey.
! !
!ApplicationModel methodsFor:'hooks'!