help texts
authorClaus Gittinger <cg@exept.de>
Fri, 20 Jan 2006 16:27:53 +0100
changeset 2086 d357dc59885a
parent 2085 117512664f9e
child 2087 69abec0dd510
help texts
ApplicationModel.st
--- a/ApplicationModel.st	Fri Jan 20 15:52:57 2006 +0100
+++ b/ApplicationModel.st	Fri Jan 20 16:27:53 2006 +0100
@@ -988,124 +988,6 @@
     "Modified: / 18.6.1998 / 20:33:36 / cg"
 !
 
-flyByHelpSpec
-    "activeHelp interface: return some short help text for a widget component"
-
-    ^ self class flyByHelpSpec
-!
-
-flyByHelpTextFor:aComponent
-    "activeHelp interface: return some short help text for a widget component"
-
-    |key|
-
-    builder notNil ifTrue:[
-        (key := builder helpKeyFor:aComponent) notNil ifTrue:[
-            ^ self flyByHelpTextForKey:key
-        ]
-    ].
-    masterApplication notNil ifTrue:[
-        ^ masterApplication flyByHelpTextFor:aComponent
-    ].
-    ^ nil
-
-    "Modified: / 31.7.1998 / 23:03:10 / cg"
-!
-
-flyByHelpTextForKey: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)"
-
-    |helpText helpSpec resourceArgs|
-
-    helpSpec := self flyByHelpSpec.
-    helpSpec notNil ifTrue:[
-        helpText := helpSpec at:aKey ifAbsent:nil.
-    ].
-    helpText isNil ifTrue:[
-        masterApplication notNil ifTrue:[
-            helpText := masterApplication flyByHelpTextForKey:aKey
-        ]
-    ].
-
-    "/ new: allow for a collection (resource-key arg1 arg2...)
-    (helpText isCollection and:[helpText isString not]) ifTrue:[
-        resourceArgs := helpText copyFrom:2.
-        helpText := helpText first.
-    ].
-
-    (resources notNil and:[helpText notNil]) ifTrue:[
-        "/ translate.
-        resourceArgs notNil ifTrue:[
-            ^ resources stringWithCRs:helpText withArgs:resourceArgs
-        ].
-        ^ resources string:helpText
-    ].
-    ^ helpText
-
-    "Modified: / 16-03-2004 / 15:38:31 / cg"
-!
-
-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 xLated|
-
-    helpText := (self helpSpec) at:aKey ifAbsent:nil.
-    helpText isNil ifTrue:[
-        masterApplication notNil ifTrue:[
-            helpText := masterApplication helpTextForKey:aKey
-        ].
-        helpText isNil ifTrue:[
-            ^ helpText
-        ].
-    ].
-
-    "/ translate.
-    resources notNil ifTrue:[
-        xLated := resources string:helpText default:nil.
-        xLated isNil ifTrue:[
-            (helpText endsWith:'.') ifTrue:[
-                xLated := resources string:(helpText copyWithoutLast:1) default:nil.
-                xLated notNil ifTrue:[
-                    ^ xLated , '.'
-                ]
-            ].
-        ].
-        ^ resources string:helpText
-    ].
-    ^ helpText
-
-    "Modified: / 4.2.2000 / 15:30:16 / cg"
-!
-
 labelFor:aKey
     "sent by the builder to ask for an application provided
      label for a component.
@@ -1228,6 +1110,137 @@
 
 ! !
 
+!ApplicationModel methodsFor:'binding access-help'!
+
+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|
+
+    helpText := (self helpSpec) at:aKey ifAbsent:nil.
+    helpText isNil ifTrue:[
+        masterApplication notNil ifTrue:[
+            helpText := masterApplication helpTextForKey:aKey
+        ].
+    ].
+    ^ helpText
+!
+
+flyByHelpSpec
+    "activeHelp interface: return some short help text for a widget component"
+
+    ^ self class flyByHelpSpec
+!
+
+flyByHelpTextFor:aComponent
+    "activeHelp interface: return some short help text for a widget component"
+
+    |key|
+
+    builder notNil ifTrue:[
+        (key := builder helpKeyFor:aComponent) notNil ifTrue:[
+            ^ self flyByHelpTextForKey:key
+        ]
+    ].
+    masterApplication notNil ifTrue:[
+        ^ masterApplication flyByHelpTextFor:aComponent
+    ].
+    ^ nil
+
+    "Modified: / 31.7.1998 / 23:03:10 / cg"
+!
+
+flyByHelpTextForKey: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)"
+
+    |helpText helpSpec resourceArgs|
+
+    helpSpec := self flyByHelpSpec.
+    helpSpec notNil ifTrue:[
+        helpText := helpSpec at:aKey ifAbsent:nil.
+    ].
+    helpText isNil ifTrue:[
+        masterApplication notNil ifTrue:[
+            helpText := masterApplication flyByHelpTextForKey:aKey
+        ]
+    ].
+
+    "/ new: allow for a collection (resource-key arg1 arg2...)
+    (helpText isCollection and:[helpText isString not]) ifTrue:[
+        resourceArgs := helpText copyFrom:2.
+        helpText := helpText first.
+    ].
+
+    (resources notNil and:[helpText notNil]) ifTrue:[
+        "/ translate.
+        resourceArgs notNil ifTrue:[
+            ^ resources stringWithCRs:helpText withArgs:resourceArgs
+        ].
+        ^ resources string:helpText
+    ].
+    ^ helpText
+
+    "Modified: / 16-03-2004 / 15:38:31 / cg"
+!
+
+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 xLated|
+
+    helpText := self basicHelpTextForKey:aKey.
+    helpText isNil ifTrue:[
+        ^ nil
+    ].
+
+    "/ translate.
+    resources notNil ifTrue:[
+        xLated := resources string:helpText default:nil.
+        xLated isNil ifTrue:[
+            (helpText endsWith:'.') ifTrue:[
+                xLated := resources string:(helpText copyWithoutLast:1) default:nil.
+                xLated notNil ifTrue:[
+                    ^ xLated , '.'
+                ]
+            ].
+        ].
+        ^ resources string:helpText
+    ].
+    ^ helpText
+
+    "Modified: / 4.2.2000 / 15:30:16 / cg"
+! !
+
 !ApplicationModel methodsFor:'change & update'!
 
 delayedUpdate:something with:aParameter from:changedObject
@@ -2877,7 +2890,7 @@
 !ApplicationModel class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.216 2006-01-10 13:31:49 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.217 2006-01-20 15:27:53 cg Exp $'
 ! !
 
 ApplicationModel initialize!