UIHelpTool.st
author ca
Thu, 03 Jul 1997 06:30:55 +0200
changeset 196 56f63eb42a34
parent 172 10e8e0510baa
child 204 8dcd7f22e4d1
permissions -rw-r--r--
generate help specs
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:[
ca
parents: 148
diff changeset
   163
        list := nil
ca
parents: 148
diff changeset
   164
    ].
ca
parents: 148
diff changeset
   165
!
ca
parents: 148
diff changeset
   166
196
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   167
helpSpecFrom:aClass
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   168
    "read help text from an application associated with the class
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   169
    "
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   170
    |help cls|
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   171
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   172
    cls := self class applicationClassAssociatedWith:aClass.
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   173
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   174
    (cls respondsTo:#helpSpec) ifTrue:[
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   175
        help := cls helpSpec
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   176
    ].
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   177
    self dictionary:help
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   178
!
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   179
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   180
key
785417b6955d intitial checkin
ca
parents:
diff changeset
   181
    "get the key from the edit field as symbol or nil
785417b6955d intitial checkin
ca
parents:
diff changeset
   182
    "
785417b6955d intitial checkin
ca
parents:
diff changeset
   183
    |key|
785417b6955d intitial checkin
ca
parents:
diff changeset
   184
785417b6955d intitial checkin
ca
parents:
diff changeset
   185
    key := model value.
785417b6955d intitial checkin
ca
parents:
diff changeset
   186
785417b6955d intitial checkin
ca
parents:
diff changeset
   187
    (     key size ~~ 0
785417b6955d intitial checkin
ca
parents:
diff changeset
   188
     and:[(key indexOfSeparatorStartingAt:1) == 0
785417b6955d intitial checkin
ca
parents:
diff changeset
   189
      or:[(key := key withoutSeparators) notEmpty]]
785417b6955d intitial checkin
ca
parents:
diff changeset
   190
    ) ifTrue:[
785417b6955d intitial checkin
ca
parents:
diff changeset
   191
        ^ key asSymbol
785417b6955d intitial checkin
ca
parents:
diff changeset
   192
    ].
785417b6955d intitial checkin
ca
parents:
diff changeset
   193
  ^ nil
785417b6955d intitial checkin
ca
parents:
diff changeset
   194
!
785417b6955d intitial checkin
ca
parents:
diff changeset
   195
785417b6955d intitial checkin
ca
parents:
diff changeset
   196
model:aKeyHolder
785417b6955d intitial checkin
ca
parents:
diff changeset
   197
    "set the model on the edit field
785417b6955d intitial checkin
ca
parents:
diff changeset
   198
    "
785417b6955d intitial checkin
ca
parents:
diff changeset
   199
    model notNil ifTrue:[
785417b6955d intitial checkin
ca
parents:
diff changeset
   200
        model removeDependent:self
785417b6955d intitial checkin
ca
parents:
diff changeset
   201
    ].
785417b6955d intitial checkin
ca
parents:
diff changeset
   202
    (model := aKeyHolder) notNil ifTrue:[
785417b6955d intitial checkin
ca
parents:
diff changeset
   203
        model addDependent:self
785417b6955d intitial checkin
ca
parents:
diff changeset
   204
    ].
785417b6955d intitial checkin
ca
parents:
diff changeset
   205
    (builder componentAt:#comboBox) model:model.
151
ca
parents: 148
diff changeset
   206
    self update:nil with:#model from:model.
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   207
! !
785417b6955d intitial checkin
ca
parents:
diff changeset
   208
785417b6955d intitial checkin
ca
parents:
diff changeset
   209
!UIHelpTool methodsFor:'actions'!
785417b6955d intitial checkin
ca
parents:
diff changeset
   210
785417b6955d intitial checkin
ca
parents:
diff changeset
   211
accept
785417b6955d intitial checkin
ca
parents:
diff changeset
   212
    "accept the text
785417b6955d intitial checkin
ca
parents:
diff changeset
   213
    "
785417b6955d intitial checkin
ca
parents:
diff changeset
   214
    |key txt|
785417b6955d intitial checkin
ca
parents:
diff changeset
   215
785417b6955d intitial checkin
ca
parents:
diff changeset
   216
    key := self key.
785417b6955d intitial checkin
ca
parents:
diff changeset
   217
    txt := self textChannel.
785417b6955d intitial checkin
ca
parents:
diff changeset
   218
785417b6955d intitial checkin
ca
parents:
diff changeset
   219
    key notNil ifTrue:[
785417b6955d intitial checkin
ca
parents:
diff changeset
   220
        txt dependentsDo:[:edt| edt accept].
785417b6955d intitial checkin
ca
parents:
diff changeset
   221
785417b6955d intitial checkin
ca
parents:
diff changeset
   222
        (dictionary at:key ifAbsent:nil) isNil ifTrue:[
785417b6955d intitial checkin
ca
parents:
diff changeset
   223
            list add:key.
785417b6955d intitial checkin
ca
parents:
diff changeset
   224
            self listChannel value:list
785417b6955d intitial checkin
ca
parents:
diff changeset
   225
        ].
785417b6955d intitial checkin
ca
parents:
diff changeset
   226
        dictionary at:key put:(txt value)
785417b6955d intitial checkin
ca
parents:
diff changeset
   227
    ] ifFalse:[
785417b6955d intitial checkin
ca
parents:
diff changeset
   228
        key := nil.
785417b6955d intitial checkin
ca
parents:
diff changeset
   229
        txt value:nil.
785417b6955d intitial checkin
ca
parents:
diff changeset
   230
    ].
785417b6955d intitial checkin
ca
parents:
diff changeset
   231
785417b6955d intitial checkin
ca
parents:
diff changeset
   232
    model notNil ifTrue:[
785417b6955d intitial checkin
ca
parents:
diff changeset
   233
        model value:key
785417b6955d intitial checkin
ca
parents:
diff changeset
   234
    ]
196
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   235
!
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   236
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   237
installHelpSpecInto:aClass
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   238
    "install help text
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   239
    "
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   240
    |cls src|
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   241
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   242
    cls := self class applicationClassAssociatedWith:aClass.
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   243
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   244
    cls isNil ifTrue:[
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   245
        ^ self information:'no application class defined'.
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   246
    ].
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   247
    dictionary isEmpty ifTrue:[
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   248
        ^ self information:'no help text defined'
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   249
    ].
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   250
    src  := '' writeStream.
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   251
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   252
    src nextPutAll:
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   253
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   254
'helpSpec
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   255
    "return a dictionary filled with helpKey -> helptext associations.
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   256
     These are used by the activeHelp tool.
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   257
    "
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   258
  ^ super helpSpec addPairsFrom:#(
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   259
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
    dictionary keysAndValuesDo:[:key :txt|
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   263
        |t|
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   264
        src nextPutLine:key storeString.
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   265
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   266
        t := txt asString.
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   267
        (t endsWith:Character cr) ifTrue:[
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   268
            t := t copyWithoutLast:1
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   269
        ].
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   270
        src nextPutLine:t storeString; cr.
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   271
    ].
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   272
    src nextPutLine:')'.
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   273
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   274
    Compiler compile:(src contents)
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   275
            forClass:cls class 
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   276
          inCategory:'help specs'
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   277
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   278
! !
785417b6955d intitial checkin
ca
parents:
diff changeset
   279
785417b6955d intitial checkin
ca
parents:
diff changeset
   280
!UIHelpTool methodsFor:'aspects'!
785417b6955d intitial checkin
ca
parents:
diff changeset
   281
785417b6955d intitial checkin
ca
parents:
diff changeset
   282
listChannel
785417b6955d intitial checkin
ca
parents:
diff changeset
   283
    "automatically generated by UIPainter ..."
785417b6955d intitial checkin
ca
parents:
diff changeset
   284
785417b6955d intitial checkin
ca
parents:
diff changeset
   285
    |holder|
785417b6955d intitial checkin
ca
parents:
diff changeset
   286
785417b6955d intitial checkin
ca
parents:
diff changeset
   287
    (holder := builder bindingAt:#listChannel) isNil ifTrue:[
785417b6955d intitial checkin
ca
parents:
diff changeset
   288
        builder aspectAt:#listChannel put:(holder :=  ValueHolder new).
196
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   289
        holder value:list.
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   290
    ].
785417b6955d intitial checkin
ca
parents:
diff changeset
   291
    ^ holder
785417b6955d intitial checkin
ca
parents:
diff changeset
   292
!
785417b6955d intitial checkin
ca
parents:
diff changeset
   293
785417b6955d intitial checkin
ca
parents:
diff changeset
   294
textChannel
785417b6955d intitial checkin
ca
parents:
diff changeset
   295
    "automatically generated by UIPainter ..."
785417b6955d intitial checkin
ca
parents:
diff changeset
   296
785417b6955d intitial checkin
ca
parents:
diff changeset
   297
    |holder|
785417b6955d intitial checkin
ca
parents:
diff changeset
   298
785417b6955d intitial checkin
ca
parents:
diff changeset
   299
    (holder := builder bindingAt:#textChannel) isNil ifTrue:[
785417b6955d intitial checkin
ca
parents:
diff changeset
   300
        builder aspectAt:#textChannel put:(holder :=  ValueHolder new).
785417b6955d intitial checkin
ca
parents:
diff changeset
   301
    ].
785417b6955d intitial checkin
ca
parents:
diff changeset
   302
    ^ holder
785417b6955d intitial checkin
ca
parents:
diff changeset
   303
! !
785417b6955d intitial checkin
ca
parents:
diff changeset
   304
785417b6955d intitial checkin
ca
parents:
diff changeset
   305
!UIHelpTool methodsFor:'change & update'!
785417b6955d intitial checkin
ca
parents:
diff changeset
   306
785417b6955d intitial checkin
ca
parents:
diff changeset
   307
update:something with:aParameter from:someObject
785417b6955d intitial checkin
ca
parents:
diff changeset
   308
    "model might change
785417b6955d intitial checkin
ca
parents:
diff changeset
   309
    "
785417b6955d intitial checkin
ca
parents:
diff changeset
   310
    |text key|
785417b6955d intitial checkin
ca
parents:
diff changeset
   311
785417b6955d intitial checkin
ca
parents:
diff changeset
   312
    (key := self key) notNil ifTrue:[
785417b6955d intitial checkin
ca
parents:
diff changeset
   313
        (text := dictionary at:key ifAbsent:nil) notNil ifTrue:[
785417b6955d intitial checkin
ca
parents:
diff changeset
   314
            self textChannel value:text
785417b6955d intitial checkin
ca
parents:
diff changeset
   315
        ]
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
!UIHelpTool methodsFor:'initialization'!
785417b6955d intitial checkin
ca
parents:
diff changeset
   320
785417b6955d intitial checkin
ca
parents:
diff changeset
   321
initialize
785417b6955d intitial checkin
ca
parents:
diff changeset
   322
    "setup instance attributes
785417b6955d intitial checkin
ca
parents:
diff changeset
   323
    "
785417b6955d intitial checkin
ca
parents:
diff changeset
   324
    super initialize.
785417b6955d intitial checkin
ca
parents:
diff changeset
   325
    dictionary  := IdentityDictionary new.
785417b6955d intitial checkin
ca
parents:
diff changeset
   326
    list        := OrderedCollection new.
785417b6955d intitial checkin
ca
parents:
diff changeset
   327
! !
785417b6955d intitial checkin
ca
parents:
diff changeset
   328
785417b6955d intitial checkin
ca
parents:
diff changeset
   329
!UIHelpTool class methodsFor:'documentation'!
785417b6955d intitial checkin
ca
parents:
diff changeset
   330
785417b6955d intitial checkin
ca
parents:
diff changeset
   331
version
785417b6955d intitial checkin
ca
parents:
diff changeset
   332
    ^ '$Header$'
785417b6955d intitial checkin
ca
parents:
diff changeset
   333
! !