UIHelpTool.st
author Claus Gittinger <cg@exept.de>
Fri, 04 Jul 1997 23:47:35 +0200
changeset 211 45f193f4e870
parent 204 8dcd7f22e4d1
child 261 deaa4815065c
permissions -rw-r--r--
oops
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
156
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
     1
"
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
     2
 COPYRIGHT (c) 1995 by eXept Software AG
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
     3
              All Rights Reserved
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
     4
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
     5
 This software is furnished under a license and may be used
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
     6
 only in accordance with the terms of that license and with the
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
     8
 be provided or otherwise made available to, or used by, any
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
     9
 other person.  No title to or ownership of the software is
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
    10
 hereby transferred.
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
    11
"
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
    12
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
    13
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
    14
148
785417b6955d intitial checkin
ca
parents:
diff changeset
    15
ApplicationModel subclass:#UIHelpTool
785417b6955d intitial checkin
ca
parents:
diff changeset
    16
	instanceVariableNames:'dictionary list model'
785417b6955d intitial checkin
ca
parents:
diff changeset
    17
	classVariableNames:''
785417b6955d intitial checkin
ca
parents:
diff changeset
    18
	poolDictionaries:''
785417b6955d intitial checkin
ca
parents:
diff changeset
    19
	category:'Interface-UIPainter'
785417b6955d intitial checkin
ca
parents:
diff changeset
    20
!
785417b6955d intitial checkin
ca
parents:
diff changeset
    21
785417b6955d intitial checkin
ca
parents:
diff changeset
    22
!UIHelpTool class methodsFor:'documentation'!
785417b6955d intitial checkin
ca
parents:
diff changeset
    23
156
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
    24
copyright
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
    25
"
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
    26
 COPYRIGHT (c) 1995 by eXept Software AG
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
    27
              All Rights Reserved
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
    28
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
    29
 This software is furnished under a license and may be used
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
    30
 only in accordance with the terms of that license and with the
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
    32
 be provided or otherwise made available to, or used by, any
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
    33
 other person.  No title to or ownership of the software is
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
    34
 hereby transferred.
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
    35
"
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
    36
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
    37
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
    38
!
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
    39
148
785417b6955d intitial checkin
ca
parents:
diff changeset
    40
documentation
785417b6955d intitial checkin
ca
parents:
diff changeset
    41
"
785417b6955d intitial checkin
ca
parents:
diff changeset
    42
    used by the UIPainter to add help text to any component which will be shown
785417b6955d intitial checkin
ca
parents:
diff changeset
    43
    during runing an application with enabled activeHelp mode.
156
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
    44
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
    45
    [author:]
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 151
diff changeset
    46
        Claus Atzkern
148
785417b6955d intitial checkin
ca
parents:
diff changeset
    47
"
785417b6955d intitial checkin
ca
parents:
diff changeset
    48
! !
785417b6955d intitial checkin
ca
parents:
diff changeset
    49
151
ca
parents: 148
diff changeset
    50
!UIHelpTool class methodsFor:'help specs'!
ca
parents: 148
diff changeset
    51
ca
parents: 148
diff changeset
    52
helpSpec
ca
parents: 148
diff changeset
    53
    "return a dictionary filled with helpKey -> helptext associations.
172
10e8e0510baa helpSpec no longer under UIPainter
ca
parents: 156
diff changeset
    54
     These are used by the activeHelp tool.
10e8e0510baa helpSpec no longer under UIPainter
ca
parents: 156
diff changeset
    55
    "
10e8e0510baa helpSpec no longer under UIPainter
ca
parents: 156
diff changeset
    56
  ^ super helpSpec addPairsFrom:#(
151
ca
parents: 148
diff changeset
    57
172
10e8e0510baa helpSpec no longer under UIPainter
ca
parents: 156
diff changeset
    58
#activeHelpAccessKey
10e8e0510baa helpSpec no longer under UIPainter
ca
parents: 156
diff changeset
    59
'This ID is used to access an active
10e8e0510baa helpSpec no longer under UIPainter
ca
parents: 156
diff changeset
    60
help text for the selected component'
10e8e0510baa helpSpec no longer under UIPainter
ca
parents: 156
diff changeset
    61
10e8e0510baa helpSpec no longer under UIPainter
ca
parents: 156
diff changeset
    62
)
10e8e0510baa helpSpec no longer under UIPainter
ca
parents: 156
diff changeset
    63
151
ca
parents: 148
diff changeset
    64
! !
ca
parents: 148
diff changeset
    65
148
785417b6955d intitial checkin
ca
parents:
diff changeset
    66
!UIHelpTool class methodsFor:'interface specs'!
785417b6955d intitial checkin
ca
parents:
diff changeset
    67
785417b6955d intitial checkin
ca
parents:
diff changeset
    68
windowSpec
785417b6955d intitial checkin
ca
parents:
diff changeset
    69
    "this window spec was automatically generated by the ST/X UIPainter"
785417b6955d intitial checkin
ca
parents:
diff changeset
    70
785417b6955d intitial checkin
ca
parents:
diff changeset
    71
    "do not manually edit this - the painter/builder may not be able to
785417b6955d intitial checkin
ca
parents:
diff changeset
    72
     handle the specification if its corrupted."
785417b6955d intitial checkin
ca
parents:
diff changeset
    73
785417b6955d intitial checkin
ca
parents:
diff changeset
    74
    "
151
ca
parents: 148
diff changeset
    75
     UIPainter new openOnClass:UIHelpTool andSelector:#windowSpec
ca
parents: 148
diff changeset
    76
     UIHelpTool new openInterface:#windowSpec
148
785417b6955d intitial checkin
ca
parents:
diff changeset
    77
    "
151
ca
parents: 148
diff changeset
    78
    "UIHelpTool open"
148
785417b6955d intitial checkin
ca
parents:
diff changeset
    79
785417b6955d intitial checkin
ca
parents:
diff changeset
    80
    <resource: #canvas>
785417b6955d intitial checkin
ca
parents:
diff changeset
    81
785417b6955d intitial checkin
ca
parents:
diff changeset
    82
    ^
785417b6955d intitial checkin
ca
parents:
diff changeset
    83
     
785417b6955d intitial checkin
ca
parents:
diff changeset
    84
       #(#FullSpec
785417b6955d intitial checkin
ca
parents:
diff changeset
    85
          #'window:' 
785417b6955d intitial checkin
ca
parents:
diff changeset
    86
           #(#WindowSpec
785417b6955d intitial checkin
ca
parents:
diff changeset
    87
              #'name:' 'uIPainterView'
785417b6955d intitial checkin
ca
parents:
diff changeset
    88
              #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
785417b6955d intitial checkin
ca
parents:
diff changeset
    89
              #'label:' 'unnamed canvas'
785417b6955d intitial checkin
ca
parents:
diff changeset
    90
              #'bounds:' #(#Rectangle 0 0 286 272)
785417b6955d intitial checkin
ca
parents:
diff changeset
    91
          )
785417b6955d intitial checkin
ca
parents:
diff changeset
    92
          #'component:' 
785417b6955d intitial checkin
ca
parents:
diff changeset
    93
           #(#SpecCollection
785417b6955d intitial checkin
ca
parents:
diff changeset
    94
              #'collection:' 
785417b6955d intitial checkin
ca
parents:
diff changeset
    95
               #(
785417b6955d intitial checkin
ca
parents:
diff changeset
    96
                 #(#TextEditorSpec
785417b6955d intitial checkin
ca
parents:
diff changeset
    97
                    #'name:' 'textView'
785417b6955d intitial checkin
ca
parents:
diff changeset
    98
                    #'layout:' #(#LayoutFrame 46 0 25 0.0 0 1.0 0 1.0)
785417b6955d intitial checkin
ca
parents:
diff changeset
    99
                    #'model:' #textChannel
785417b6955d intitial checkin
ca
parents:
diff changeset
   100
                    #'hasHorizontalScrollBar:' true
785417b6955d intitial checkin
ca
parents:
diff changeset
   101
                    #'hasVerticalScrollBar:' true
785417b6955d intitial checkin
ca
parents:
diff changeset
   102
                    #'miniScrollerHorizontal:' true
785417b6955d intitial checkin
ca
parents:
diff changeset
   103
                    #'miniScrollerVertical:' true
785417b6955d intitial checkin
ca
parents:
diff changeset
   104
                )
785417b6955d intitial checkin
ca
parents:
diff changeset
   105
                 #(#LabelSpec
785417b6955d intitial checkin
ca
parents:
diff changeset
   106
                    #'name:' 'keyLabel'
785417b6955d intitial checkin
ca
parents:
diff changeset
   107
                    #'layout:' #(#LayoutFrame 0 0.0 1 0.0 41 0 21 0)
785417b6955d intitial checkin
ca
parents:
diff changeset
   108
                    #'label:' 'Key:'
785417b6955d intitial checkin
ca
parents:
diff changeset
   109
                    #'adjust:' #left
785417b6955d intitial checkin
ca
parents:
diff changeset
   110
                    #'resizeForLabel:' false
785417b6955d intitial checkin
ca
parents:
diff changeset
   111
                )
785417b6955d intitial checkin
ca
parents:
diff changeset
   112
                 #(#ComboBoxSpec
785417b6955d intitial checkin
ca
parents:
diff changeset
   113
                    #'name:' 'comboBox'
785417b6955d intitial checkin
ca
parents:
diff changeset
   114
                    #'layout:' #(#LayoutFrame 46 0 1 0 0 1.0 21 0)
151
ca
parents: 148
diff changeset
   115
                    #'activeHelpKey:' #activeHelpAccessKey
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   116
                    #'tabable:' true
785417b6955d intitial checkin
ca
parents:
diff changeset
   117
                    #'comboList:' #listChannel
785417b6955d intitial checkin
ca
parents:
diff changeset
   118
                )
785417b6955d intitial checkin
ca
parents:
diff changeset
   119
                 #(#LabelSpec
785417b6955d intitial checkin
ca
parents:
diff changeset
   120
                    #'name:' 'textLabel'
785417b6955d intitial checkin
ca
parents:
diff changeset
   121
                    #'layout:' #(#LayoutFrame 0 0.0 25 0.0 41 0 45 0)
785417b6955d intitial checkin
ca
parents:
diff changeset
   122
                    #'label:' 'Text:'
785417b6955d intitial checkin
ca
parents:
diff changeset
   123
                    #'adjust:' #left
785417b6955d intitial checkin
ca
parents:
diff changeset
   124
                    #'resizeForLabel:' false
785417b6955d intitial checkin
ca
parents:
diff changeset
   125
                )
785417b6955d intitial checkin
ca
parents:
diff changeset
   126
              )
785417b6955d intitial checkin
ca
parents:
diff changeset
   127
          )
785417b6955d intitial checkin
ca
parents:
diff changeset
   128
      )
785417b6955d intitial checkin
ca
parents:
diff changeset
   129
! !
785417b6955d intitial checkin
ca
parents:
diff changeset
   130
196
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   131
!UIHelpTool class methodsFor:'misc'!
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   132
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   133
applicationClassAssociatedWith:aClass
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   134
    "get application class keeping the associated help text or nil
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   135
    "
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   136
    |cls|
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   137
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   138
    aClass notNil ifTrue:[
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   139
        aClass isBehavior ifFalse:[cls := Smalltalk at:aClass asSymbol]
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   140
                           ifTrue:[cls := aClass].
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   141
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   142
        (cls notNil and:[cls includesBehavior:UISpecification]) ifTrue:[
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   143
            ^ UISpecificationTool
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   144
        ]
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   145
    ].
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   146
  ^ cls
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   147
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   148
! !
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   149
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   150
!UIHelpTool methodsFor:'accessing'!
785417b6955d intitial checkin
ca
parents:
diff changeset
   151
151
ca
parents: 148
diff changeset
   152
dictionary
ca
parents: 148
diff changeset
   153
    "return the value of the instance variable 'dictionary' (automatically generated)"
ca
parents: 148
diff changeset
   154
ca
parents: 148
diff changeset
   155
    ^ dictionary!
ca
parents: 148
diff changeset
   156
ca
parents: 148
diff changeset
   157
dictionary:aDictionary
ca
parents: 148
diff changeset
   158
    "set the value of the instance variable 'dictionary' (automatically generated)"
ca
parents: 148
diff changeset
   159
ca
parents: 148
diff changeset
   160
    (dictionary := aDictionary) notNil ifTrue:[
ca
parents: 148
diff changeset
   161
        list := dictionary keys asOrderedCollection
ca
parents: 148
diff changeset
   162
    ] ifFalse:[
204
8dcd7f22e4d1 checkin from browser
ca
parents: 196
diff changeset
   163
        dictionary := IdentityDictionary new.
151
ca
parents: 148
diff changeset
   164
        list := nil
ca
parents: 148
diff changeset
   165
    ].
ca
parents: 148
diff changeset
   166
!
ca
parents: 148
diff changeset
   167
196
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   168
helpSpecFrom:aClass
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   169
    "read help text from an application associated with the class
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   170
    "
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   171
    |help cls|
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   172
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   173
    cls := self class applicationClassAssociatedWith:aClass.
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   174
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   175
    (cls respondsTo:#helpSpec) ifTrue:[
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   176
        help := cls helpSpec
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   177
    ].
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   178
    self dictionary:help
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   179
!
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   180
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   181
key
785417b6955d intitial checkin
ca
parents:
diff changeset
   182
    "get the key from the edit field as symbol or nil
785417b6955d intitial checkin
ca
parents:
diff changeset
   183
    "
785417b6955d intitial checkin
ca
parents:
diff changeset
   184
    |key|
785417b6955d intitial checkin
ca
parents:
diff changeset
   185
785417b6955d intitial checkin
ca
parents:
diff changeset
   186
    key := model value.
785417b6955d intitial checkin
ca
parents:
diff changeset
   187
785417b6955d intitial checkin
ca
parents:
diff changeset
   188
    (     key size ~~ 0
785417b6955d intitial checkin
ca
parents:
diff changeset
   189
     and:[(key indexOfSeparatorStartingAt:1) == 0
785417b6955d intitial checkin
ca
parents:
diff changeset
   190
      or:[(key := key withoutSeparators) notEmpty]]
785417b6955d intitial checkin
ca
parents:
diff changeset
   191
    ) ifTrue:[
785417b6955d intitial checkin
ca
parents:
diff changeset
   192
        ^ key asSymbol
785417b6955d intitial checkin
ca
parents:
diff changeset
   193
    ].
785417b6955d intitial checkin
ca
parents:
diff changeset
   194
  ^ nil
785417b6955d intitial checkin
ca
parents:
diff changeset
   195
!
785417b6955d intitial checkin
ca
parents:
diff changeset
   196
785417b6955d intitial checkin
ca
parents:
diff changeset
   197
model:aKeyHolder
785417b6955d intitial checkin
ca
parents:
diff changeset
   198
    "set the model on the edit field
785417b6955d intitial checkin
ca
parents:
diff changeset
   199
    "
785417b6955d intitial checkin
ca
parents:
diff changeset
   200
    model notNil ifTrue:[
785417b6955d intitial checkin
ca
parents:
diff changeset
   201
        model removeDependent:self
785417b6955d intitial checkin
ca
parents:
diff changeset
   202
    ].
785417b6955d intitial checkin
ca
parents:
diff changeset
   203
    (model := aKeyHolder) notNil ifTrue:[
785417b6955d intitial checkin
ca
parents:
diff changeset
   204
        model addDependent:self
785417b6955d intitial checkin
ca
parents:
diff changeset
   205
    ].
785417b6955d intitial checkin
ca
parents:
diff changeset
   206
    (builder componentAt:#comboBox) model:model.
151
ca
parents: 148
diff changeset
   207
    self update:nil with:#model from:model.
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   208
! !
785417b6955d intitial checkin
ca
parents:
diff changeset
   209
785417b6955d intitial checkin
ca
parents:
diff changeset
   210
!UIHelpTool methodsFor:'actions'!
785417b6955d intitial checkin
ca
parents:
diff changeset
   211
785417b6955d intitial checkin
ca
parents:
diff changeset
   212
accept
785417b6955d intitial checkin
ca
parents:
diff changeset
   213
    "accept the text
785417b6955d intitial checkin
ca
parents:
diff changeset
   214
    "
785417b6955d intitial checkin
ca
parents:
diff changeset
   215
    |key txt|
785417b6955d intitial checkin
ca
parents:
diff changeset
   216
785417b6955d intitial checkin
ca
parents:
diff changeset
   217
    key := self key.
785417b6955d intitial checkin
ca
parents:
diff changeset
   218
    txt := self textChannel.
785417b6955d intitial checkin
ca
parents:
diff changeset
   219
785417b6955d intitial checkin
ca
parents:
diff changeset
   220
    key notNil ifTrue:[
785417b6955d intitial checkin
ca
parents:
diff changeset
   221
        txt dependentsDo:[:edt| edt accept].
785417b6955d intitial checkin
ca
parents:
diff changeset
   222
785417b6955d intitial checkin
ca
parents:
diff changeset
   223
        (dictionary at:key ifAbsent:nil) isNil ifTrue:[
785417b6955d intitial checkin
ca
parents:
diff changeset
   224
            list add:key.
785417b6955d intitial checkin
ca
parents:
diff changeset
   225
            self listChannel value:list
785417b6955d intitial checkin
ca
parents:
diff changeset
   226
        ].
785417b6955d intitial checkin
ca
parents:
diff changeset
   227
        dictionary at:key put:(txt value)
785417b6955d intitial checkin
ca
parents:
diff changeset
   228
    ] ifFalse:[
785417b6955d intitial checkin
ca
parents:
diff changeset
   229
        key := nil.
785417b6955d intitial checkin
ca
parents:
diff changeset
   230
        txt value:nil.
785417b6955d intitial checkin
ca
parents:
diff changeset
   231
    ].
785417b6955d intitial checkin
ca
parents:
diff changeset
   232
785417b6955d intitial checkin
ca
parents:
diff changeset
   233
    model notNil ifTrue:[
785417b6955d intitial checkin
ca
parents:
diff changeset
   234
        model value:key
785417b6955d intitial checkin
ca
parents:
diff changeset
   235
    ]
196
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   236
!
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   237
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   238
installHelpSpecInto:aClass
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   239
    "install help text
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   240
    "
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   241
    |cls src|
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   242
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   243
    cls := self class applicationClassAssociatedWith:aClass.
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   244
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   245
    cls isNil ifTrue:[
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   246
        ^ self information:'no application class defined'.
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   247
    ].
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   248
    dictionary isEmpty ifTrue:[
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   249
        ^ self information:'no help text defined'
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   250
    ].
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   251
    src  := '' writeStream.
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   252
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   253
    src nextPutAll:
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   254
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   255
'helpSpec
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   256
    "return a dictionary filled with helpKey -> helptext associations.
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   257
     These are used by the activeHelp tool.
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   258
    "
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   259
  ^ super helpSpec addPairsFrom:#(
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   260
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   261
'.
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   262
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   263
    dictionary keysAndValuesDo:[:key :txt|
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   264
        |t|
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   265
        src nextPutLine:key storeString.
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   266
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   267
        t := txt asString.
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   268
        (t endsWith:Character cr) ifTrue:[
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   269
            t := t copyWithoutLast:1
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   270
        ].
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   271
        src nextPutLine:t storeString; cr.
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   272
    ].
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   273
    src nextPutLine:')'.
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   274
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   275
    Compiler compile:(src contents)
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   276
            forClass:cls class 
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   277
          inCategory:'help specs'
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   278
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   279
! !
785417b6955d intitial checkin
ca
parents:
diff changeset
   280
785417b6955d intitial checkin
ca
parents:
diff changeset
   281
!UIHelpTool methodsFor:'aspects'!
785417b6955d intitial checkin
ca
parents:
diff changeset
   282
785417b6955d intitial checkin
ca
parents:
diff changeset
   283
listChannel
785417b6955d intitial checkin
ca
parents:
diff changeset
   284
    "automatically generated by UIPainter ..."
785417b6955d intitial checkin
ca
parents:
diff changeset
   285
785417b6955d intitial checkin
ca
parents:
diff changeset
   286
    |holder|
785417b6955d intitial checkin
ca
parents:
diff changeset
   287
785417b6955d intitial checkin
ca
parents:
diff changeset
   288
    (holder := builder bindingAt:#listChannel) isNil ifTrue:[
785417b6955d intitial checkin
ca
parents:
diff changeset
   289
        builder aspectAt:#listChannel put:(holder :=  ValueHolder new).
196
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   290
        holder value:list.
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   291
    ].
785417b6955d intitial checkin
ca
parents:
diff changeset
   292
    ^ holder
785417b6955d intitial checkin
ca
parents:
diff changeset
   293
!
785417b6955d intitial checkin
ca
parents:
diff changeset
   294
785417b6955d intitial checkin
ca
parents:
diff changeset
   295
textChannel
785417b6955d intitial checkin
ca
parents:
diff changeset
   296
    "automatically generated by UIPainter ..."
785417b6955d intitial checkin
ca
parents:
diff changeset
   297
785417b6955d intitial checkin
ca
parents:
diff changeset
   298
    |holder|
785417b6955d intitial checkin
ca
parents:
diff changeset
   299
785417b6955d intitial checkin
ca
parents:
diff changeset
   300
    (holder := builder bindingAt:#textChannel) isNil ifTrue:[
785417b6955d intitial checkin
ca
parents:
diff changeset
   301
        builder aspectAt:#textChannel put:(holder :=  ValueHolder new).
785417b6955d intitial checkin
ca
parents:
diff changeset
   302
    ].
785417b6955d intitial checkin
ca
parents:
diff changeset
   303
    ^ holder
785417b6955d intitial checkin
ca
parents:
diff changeset
   304
! !
785417b6955d intitial checkin
ca
parents:
diff changeset
   305
785417b6955d intitial checkin
ca
parents:
diff changeset
   306
!UIHelpTool methodsFor:'change & update'!
785417b6955d intitial checkin
ca
parents:
diff changeset
   307
785417b6955d intitial checkin
ca
parents:
diff changeset
   308
update:something with:aParameter from:someObject
785417b6955d intitial checkin
ca
parents:
diff changeset
   309
    "model might change
785417b6955d intitial checkin
ca
parents:
diff changeset
   310
    "
785417b6955d intitial checkin
ca
parents:
diff changeset
   311
    |text key|
785417b6955d intitial checkin
ca
parents:
diff changeset
   312
785417b6955d intitial checkin
ca
parents:
diff changeset
   313
    (key := self key) notNil ifTrue:[
785417b6955d intitial checkin
ca
parents:
diff changeset
   314
        (text := dictionary at:key ifAbsent:nil) notNil ifTrue:[
785417b6955d intitial checkin
ca
parents:
diff changeset
   315
            self textChannel value:text
785417b6955d intitial checkin
ca
parents:
diff changeset
   316
        ]
785417b6955d intitial checkin
ca
parents:
diff changeset
   317
    ]
785417b6955d intitial checkin
ca
parents:
diff changeset
   318
! !
785417b6955d intitial checkin
ca
parents:
diff changeset
   319
785417b6955d intitial checkin
ca
parents:
diff changeset
   320
!UIHelpTool methodsFor:'initialization'!
785417b6955d intitial checkin
ca
parents:
diff changeset
   321
785417b6955d intitial checkin
ca
parents:
diff changeset
   322
initialize
785417b6955d intitial checkin
ca
parents:
diff changeset
   323
    "setup instance attributes
785417b6955d intitial checkin
ca
parents:
diff changeset
   324
    "
785417b6955d intitial checkin
ca
parents:
diff changeset
   325
    super initialize.
785417b6955d intitial checkin
ca
parents:
diff changeset
   326
    dictionary  := IdentityDictionary new.
785417b6955d intitial checkin
ca
parents:
diff changeset
   327
    list        := OrderedCollection new.
785417b6955d intitial checkin
ca
parents:
diff changeset
   328
! !
785417b6955d intitial checkin
ca
parents:
diff changeset
   329
785417b6955d intitial checkin
ca
parents:
diff changeset
   330
!UIHelpTool class methodsFor:'documentation'!
785417b6955d intitial checkin
ca
parents:
diff changeset
   331
785417b6955d intitial checkin
ca
parents:
diff changeset
   332
version
785417b6955d intitial checkin
ca
parents:
diff changeset
   333
    ^ '$Header$'
785417b6955d intitial checkin
ca
parents:
diff changeset
   334
! !