UIHelpTool.st
author ca
Wed, 15 Oct 1997 15:39:41 +0200
changeset 334 3f632e9711e8
parent 331 aa1663b8c2ab
child 335 9f048ededd7d
permissions -rw-r--r--
add DataSetSpec
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
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    16
	instanceVariableNames:'specClass dictionary listSelection maxCharsPerLine modifiedHolder'
148
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
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    50
!UIHelpTool class methodsFor:'instance creation'!
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    51
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    52
openOnClass:aClass
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    53
    "
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    54
     UIHelpTool openOnClass:UIPainter
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    55
    "
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    56
    |helpTool|
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    57
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    58
    helpTool := UIHelpTool new.
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    59
    helpTool openInterface:#standAloneSpec.
292
af69e3e025a9 an empty selection is specified by 0
ca
parents: 286
diff changeset
    60
    helpTool helpSpecFrom:aClass
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    61
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    62
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    63
! !
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    64
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    65
!UIHelpTool class methodsFor:'constants'!
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    66
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    67
label
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    68
    ^ 'Help'
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    69
! !
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    70
151
ca
parents: 148
diff changeset
    71
!UIHelpTool class methodsFor:'help specs'!
ca
parents: 148
diff changeset
    72
ca
parents: 148
diff changeset
    73
helpSpec
ca
parents: 148
diff changeset
    74
    "return a dictionary filled with helpKey -> helptext associations.
292
af69e3e025a9 an empty selection is specified by 0
ca
parents: 286
diff changeset
    75
     These are used by the activeHelp tool."
af69e3e025a9 an empty selection is specified by 0
ca
parents: 286
diff changeset
    76
172
10e8e0510baa helpSpec no longer under UIPainter
ca
parents: 156
diff changeset
    77
    "
292
af69e3e025a9 an empty selection is specified by 0
ca
parents: 286
diff changeset
    78
    UIHelpTool openOnClass:UIHelpTool    
af69e3e025a9 an empty selection is specified by 0
ca
parents: 286
diff changeset
    79
    "
af69e3e025a9 an empty selection is specified by 0
ca
parents: 286
diff changeset
    80
172
10e8e0510baa helpSpec no longer under UIPainter
ca
parents: 156
diff changeset
    81
  ^ super helpSpec addPairsFrom:#(
151
ca
parents: 148
diff changeset
    82
172
10e8e0510baa helpSpec no longer under UIPainter
ca
parents: 156
diff changeset
    83
#activeHelpAccessKey
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    84
'This ID is used to access an active help text for the selected component'
172
10e8e0510baa helpSpec no longer under UIPainter
ca
parents: 156
diff changeset
    85
10e8e0510baa helpSpec no longer under UIPainter
ca
parents: 156
diff changeset
    86
)
151
ca
parents: 148
diff changeset
    87
! !
ca
parents: 148
diff changeset
    88
148
785417b6955d intitial checkin
ca
parents:
diff changeset
    89
!UIHelpTool class methodsFor:'interface specs'!
785417b6955d intitial checkin
ca
parents:
diff changeset
    90
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    91
menuPanelStandAlone
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    92
    "this window spec was automatically generated by the ST/X MenuEditor"
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    93
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    94
    "do not manually edit this - the builder may not be able to
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    95
     handle the specification if its corrupted."
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    96
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    97
    "
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    98
     MenuEditor new openOnClass:UIHelpTool andSelector:#menuPanelStandAlone
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
    99
     (Menu new fromLiteralArrayEncoding:(UIHelpTool menuPanelStandAlone)) startUp
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   100
    "
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   101
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   102
    <resource: #menu>
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   103
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   104
    ^
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   105
     
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   106
       #(#Menu
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   107
          
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   108
           #(
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   109
             #(#MenuItem
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   110
                #'label:' 'file'
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   111
                #'submenu:' 
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   112
                 #(#Menu
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   113
                    
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   114
                     #(
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   115
                       #(#MenuItem
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   116
                          #'label:' 'reload'
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   117
                          #'value:' #doReload
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   118
                      )
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   119
                       #(#MenuItem
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   120
                          #'label:' '-'
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   121
                      )
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   122
                       #(#MenuItem
292
af69e3e025a9 an empty selection is specified by 0
ca
parents: 286
diff changeset
   123
                          #'label:' 'quit'
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   124
                          #'value:' #closeRequest
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   125
                      )
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   126
                    ) nil
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   127
                    nil
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   128
                )
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   129
            )
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   130
             #(#MenuItem
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   131
                #'label:' 'code'
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   132
                #'submenu:' 
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   133
                 #(#Menu
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   134
                    
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   135
                     #(
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   136
                       #(#MenuItem
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   137
                          #'label:' 'class'
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   138
                          #'value:' #doFromClass
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   139
                      )
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   140
                       #(#MenuItem
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   141
                          #'label:' '-'
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   142
                      )
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   143
                       #(#MenuItem
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   144
                          #'label:' 'install help spec.'
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   145
                          #'value:' #doInstallHelpSpec
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   146
                      )
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   147
                    ) nil
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   148
                    nil
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   149
                )
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   150
            )
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   151
          ) nil
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   152
          nil
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   153
      )
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   154
!
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   155
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   156
standAloneSpec
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   157
    "this window spec was automatically generated by the ST/X UIPainter"
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   158
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   159
    "do not manually edit this - the painter/builder may not be able to
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   160
     handle the specification if its corrupted."
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   161
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   162
    "
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   163
     UIPainter new openOnClass:UIHelpTool andSelector:#standAloneSpec
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   164
     UIHelpTool new openInterface:#standAloneSpec
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   165
    "
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   166
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   167
    <resource: #canvas>
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   168
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   169
    ^
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   170
     
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   171
       #(#FullSpec
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   172
          #'window:' 
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   173
           #(#WindowSpec
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   174
              #'name:' 'HelpTool'
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   175
              #'layout:' #(#LayoutFrame 199 0 167 0 794 0 664 0)
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   176
              #'label:' 'HelpTool'
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   177
              #'min:' #(#Point 10 10)
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   178
              #'max:' #(#Point 1160 870)
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   179
              #'bounds:' #(#Rectangle 199 167 795 665)
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   180
          )
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   181
          #'component:' 
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   182
           #(#SpecCollection
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   183
              #'collection:' 
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   184
               #(
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   185
                 #(#MenuPanelSpec
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   186
                    #'name:' 'menuPanelStandAlone'
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   187
                    #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 25 0)
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   188
                    #'menu:' #menuPanelStandAlone
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   189
                )
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   190
                 #(#VariableHorizontalPanelSpec
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   191
                    #'name:' 'variableHorizontalPanel1'
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   192
                    #'layout:' #(#LayoutFrame 0 0.0 25 0.0 0 1.0 0 1.0)
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   193
                    #'component:' 
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   194
                     #(#SpecCollection
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   195
                        #'collection:' 
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   196
                         #(
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   197
                           #(#TextEditorSpec
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   198
                              #'name:' 'textView'
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   199
                              #'hasHorizontalScrollBar:' true
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   200
                              #'hasVerticalScrollBar:' true
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   201
                              #'miniScrollerHorizontal:' true
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   202
                              #'miniScrollerVertical:' true
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   203
                          )
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   204
                           #(#SequenceViewSpec
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   205
                              #'name:' 'selectionList'
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   206
                              #'model:' #selectionListModel
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   207
                              #'hasHorizontalScrollBar:' true
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   208
                              #'hasVerticalScrollBar:' true
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   209
                              #'miniScrollerHorizontal:' true
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   210
                              #'miniScrollerVertical:' true
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   211
                          )
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   212
                        )
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   213
                    )
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   214
                )
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   215
              )
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   216
          )
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   217
      )
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   218
!
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   219
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   220
windowSpec
785417b6955d intitial checkin
ca
parents:
diff changeset
   221
    "this window spec was automatically generated by the ST/X UIPainter"
785417b6955d intitial checkin
ca
parents:
diff changeset
   222
785417b6955d intitial checkin
ca
parents:
diff changeset
   223
    "do not manually edit this - the painter/builder may not be able to
785417b6955d intitial checkin
ca
parents:
diff changeset
   224
     handle the specification if its corrupted."
785417b6955d intitial checkin
ca
parents:
diff changeset
   225
785417b6955d intitial checkin
ca
parents:
diff changeset
   226
    "
151
ca
parents: 148
diff changeset
   227
     UIPainter new openOnClass:UIHelpTool andSelector:#windowSpec
ca
parents: 148
diff changeset
   228
     UIHelpTool new openInterface:#windowSpec
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   229
    "
151
ca
parents: 148
diff changeset
   230
    "UIHelpTool open"
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   231
785417b6955d intitial checkin
ca
parents:
diff changeset
   232
    <resource: #canvas>
785417b6955d intitial checkin
ca
parents:
diff changeset
   233
785417b6955d intitial checkin
ca
parents:
diff changeset
   234
    ^
785417b6955d intitial checkin
ca
parents:
diff changeset
   235
     
785417b6955d intitial checkin
ca
parents:
diff changeset
   236
       #(#FullSpec
785417b6955d intitial checkin
ca
parents:
diff changeset
   237
          #'window:' 
785417b6955d intitial checkin
ca
parents:
diff changeset
   238
           #(#WindowSpec
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   239
              #'name:' 'HelpTool'
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   240
              #'layout:' #(#LayoutFrame 199 0 167 0 484 0 437 0)
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   241
              #'label:' 'unnamed canvas'
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   242
              #'min:' #(#Point 10 10)
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   243
              #'max:' #(#Point 1160 870)
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   244
              #'bounds:' #(#Rectangle 199 167 485 438)
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   245
          )
785417b6955d intitial checkin
ca
parents:
diff changeset
   246
          #'component:' 
785417b6955d intitial checkin
ca
parents:
diff changeset
   247
           #(#SpecCollection
785417b6955d intitial checkin
ca
parents:
diff changeset
   248
              #'collection:' 
785417b6955d intitial checkin
ca
parents:
diff changeset
   249
               #(
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   250
                 #(#LabelSpec
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   251
                    #'name:' 'keyLabel'
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   252
                    #'layout:' #(#AlignmentOrigin 3 0.0 42 0.0 0 1)
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   253
                    #'label:' 'Key:'
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   254
                    #'adjust:' #left
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   255
                    #'resizeForLabel:' true
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   256
                )
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   257
                 #(#ComboBoxSpec
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   258
                    #'name:' 'comboBox'
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   259
                    #'layout:' #(#LayoutFrame 48 0 22 0 -3 1.0 44 0)
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   260
                    #'activeHelpKey:' #activeHelpAccessKey
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   261
                    #'tabable:' true
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   262
                    #'model:' #listModel
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   263
                    #'type:' #symbolOrNil
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   264
                    #'comboList:' #listChannel
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   265
                )
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   266
                 #(#TextEditorSpec
785417b6955d intitial checkin
ca
parents:
diff changeset
   267
                    #'name:' 'textView'
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   268
                    #'layout:' #(#LayoutFrame 3 0.0 45 0.0 -3 1.0 -3 1.0)
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   269
                    #'hasHorizontalScrollBar:' true
785417b6955d intitial checkin
ca
parents:
diff changeset
   270
                    #'hasVerticalScrollBar:' true
785417b6955d intitial checkin
ca
parents:
diff changeset
   271
                    #'miniScrollerHorizontal:' true
785417b6955d intitial checkin
ca
parents:
diff changeset
   272
                    #'miniScrollerVertical:' true
785417b6955d intitial checkin
ca
parents:
diff changeset
   273
                )
785417b6955d intitial checkin
ca
parents:
diff changeset
   274
              )
785417b6955d intitial checkin
ca
parents:
diff changeset
   275
          )
785417b6955d intitial checkin
ca
parents:
diff changeset
   276
      )
785417b6955d intitial checkin
ca
parents:
diff changeset
   277
! !
785417b6955d intitial checkin
ca
parents:
diff changeset
   278
196
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   279
!UIHelpTool class methodsFor:'misc'!
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   280
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   281
applicationClassAssociatedWith:aClass
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   282
    "get application class keeping the associated help text or nil
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   283
    "
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   284
    |cls|
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   285
331
ca
parents: 319
diff changeset
   286
    cls := self resolveName:aClass.
196
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   287
331
ca
parents: 319
diff changeset
   288
    (cls notNil and:[cls includesBehavior:UISpecification]) ifTrue:[
ca
parents: 319
diff changeset
   289
        ^ UISpecificationTool
196
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   290
    ].
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   291
  ^ cls
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   292
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   293
! !
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   294
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   295
!UIHelpTool methodsFor:'accessing'!
785417b6955d intitial checkin
ca
parents:
diff changeset
   296
151
ca
parents: 148
diff changeset
   297
dictionary
ca
parents: 148
diff changeset
   298
    "return the value of the instance variable 'dictionary' (automatically generated)"
ca
parents: 148
diff changeset
   299
ca
parents: 148
diff changeset
   300
    ^ dictionary!
ca
parents: 148
diff changeset
   301
ca
parents: 148
diff changeset
   302
dictionary:aDictionary
ca
parents: 148
diff changeset
   303
    "set the value of the instance variable 'dictionary' (automatically generated)"
ca
parents: 148
diff changeset
   304
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   305
    (dictionary := aDictionary) isNil ifTrue:[
204
8dcd7f22e4d1 checkin from browser
ca
parents: 196
diff changeset
   306
        dictionary := IdentityDictionary new.
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   307
    ].
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   308
    self updateList
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   309
!
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   310
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   311
helpKey
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   312
    listSelection size ~~ 0 ifTrue:[
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   313
        ^ listSelection asSymbol
151
ca
parents: 148
diff changeset
   314
    ].
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   315
    ^ nil
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   316
!
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   317
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   318
helpKey:aKey
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   319
    |key|
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   320
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   321
    aKey size ~~ 0 ifTrue:[
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   322
        key := aKey asString
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   323
    ].
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   324
    self listModel value:key
151
ca
parents: 148
diff changeset
   325
!
ca
parents: 148
diff changeset
   326
196
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   327
helpSpecFrom:aClass
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   328
    "read help text from an application associated with the class
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   329
    "
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   330
    |help|
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   331
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   332
    specClass := self class applicationClassAssociatedWith:aClass.
196
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   333
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   334
    (specClass respondsTo:#helpSpec) ifTrue:[
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   335
        help := specClass helpSpec
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   336
    ] ifFalse:[
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   337
        specClass := nil
196
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   338
    ].
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   339
    self dictionary:help
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   340
!
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   341
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   342
modifiedHolder:aValueHolder
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   343
    "set the value holder set to true in case of modifying attributes
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   344
    "
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   345
    modifiedHolder notNil ifTrue:[
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   346
        modifiedHolder removeDependent:self. 
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   347
    ].
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   348
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   349
    (modifiedHolder := aValueHolder) notNil ifTrue:[
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   350
        modifiedHolder addDependent:self.
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   351
    ].
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   352
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   353
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   354
!
785417b6955d intitial checkin
ca
parents:
diff changeset
   355
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   356
updateList
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   357
    "update list from dictionary
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   358
    "
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   359
    self listChannel value:(dictionary keys asSortedCollection)
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   360
! !
785417b6955d intitial checkin
ca
parents:
diff changeset
   361
785417b6955d intitial checkin
ca
parents:
diff changeset
   362
!UIHelpTool methodsFor:'actions'!
785417b6955d intitial checkin
ca
parents:
diff changeset
   363
785417b6955d intitial checkin
ca
parents:
diff changeset
   364
accept
785417b6955d intitial checkin
ca
parents:
diff changeset
   365
    "accept the text
785417b6955d intitial checkin
ca
parents:
diff changeset
   366
    "
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   367
    |view key txt list|
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   368
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   369
    (listSelection size == 0 or:[(view := self editTextView) isNil]) ifFalse:[
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   370
        txt  := view contents asString.
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   371
        key  := listSelection asSymbol.
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   372
        list := self listChannel value.
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   373
785417b6955d intitial checkin
ca
parents:
diff changeset
   374
        (dictionary at:key ifAbsent:nil) isNil ifTrue:[
785417b6955d intitial checkin
ca
parents:
diff changeset
   375
            list add:key.
785417b6955d intitial checkin
ca
parents:
diff changeset
   376
        ].
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   377
        dictionary at:key put:txt
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   378
    ]
196
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   379
!
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   380
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   381
installHelpSpecInto:aClass
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   382
    "install help text
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   383
    "
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   384
    |cls src|
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   385
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   386
    cls := self class applicationClassAssociatedWith:aClass.
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   387
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   388
    cls isNil ifTrue:[
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   389
        ^ self information:'no application class defined'.
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   390
    ].
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   391
    dictionary isEmpty ifTrue:[
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   392
        ^ self information:'no help text defined'
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   393
    ].
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   394
    src  := '' writeStream.
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   395
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   396
    src nextPutAll:
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   397
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   398
'helpSpec
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   399
    "return a dictionary filled with helpKey -> helptext associations.
292
af69e3e025a9 an empty selection is specified by 0
ca
parents: 286
diff changeset
   400
     These are used by the activeHelp tool."
af69e3e025a9 an empty selection is specified by 0
ca
parents: 286
diff changeset
   401
196
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   402
    "
292
af69e3e025a9 an empty selection is specified by 0
ca
parents: 286
diff changeset
   403
    UIHelpTool openOnClass:', cls name asString ,'    
af69e3e025a9 an empty selection is specified by 0
ca
parents: 286
diff changeset
   404
    "
af69e3e025a9 an empty selection is specified by 0
ca
parents: 286
diff changeset
   405
196
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   406
  ^ super helpSpec addPairsFrom:#(
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   407
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   408
'.
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   409
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   410
    dictionary keysAndValuesDo:[:key :txt|
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   411
        |t|
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   412
        src nextPutLine:key storeString.
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   413
319
f16aa0e8541e dont crash with nonexisting bitmaps
Claus Gittinger <cg@exept.de>
parents: 299
diff changeset
   414
        t := txt asString replaceAll:(Character cr) with:(Character space).
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   415
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   416
        (t endsWith:Character space) ifTrue:[
196
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   417
            t := t copyWithoutLast:1
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   418
        ].
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   419
        src nextPutLine:t storeString; cr.
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   420
    ].
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   421
    src nextPutLine:')'.
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   422
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   423
    Compiler compile:(src contents)
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   424
            forClass:cls class 
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   425
          inCategory:'help specs'
56f63eb42a34 generate help specs
ca
parents: 172
diff changeset
   426
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   427
! !
785417b6955d intitial checkin
ca
parents:
diff changeset
   428
785417b6955d intitial checkin
ca
parents:
diff changeset
   429
!UIHelpTool methodsFor:'aspects'!
785417b6955d intitial checkin
ca
parents:
diff changeset
   430
785417b6955d intitial checkin
ca
parents:
diff changeset
   431
listChannel
785417b6955d intitial checkin
ca
parents:
diff changeset
   432
    "automatically generated by UIPainter ..."
785417b6955d intitial checkin
ca
parents:
diff changeset
   433
785417b6955d intitial checkin
ca
parents:
diff changeset
   434
    |holder|
785417b6955d intitial checkin
ca
parents:
diff changeset
   435
785417b6955d intitial checkin
ca
parents:
diff changeset
   436
    (holder := builder bindingAt:#listChannel) isNil ifTrue:[
785417b6955d intitial checkin
ca
parents:
diff changeset
   437
        builder aspectAt:#listChannel put:(holder :=  ValueHolder new).
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   438
        holder value:(OrderedCollection new).
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   439
    ].
785417b6955d intitial checkin
ca
parents:
diff changeset
   440
    ^ holder
785417b6955d intitial checkin
ca
parents:
diff changeset
   441
!
785417b6955d intitial checkin
ca
parents:
diff changeset
   442
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   443
listModel
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   444
    "automatically generated by UIPainter ..."
785417b6955d intitial checkin
ca
parents:
diff changeset
   445
785417b6955d intitial checkin
ca
parents:
diff changeset
   446
    |holder|
785417b6955d intitial checkin
ca
parents:
diff changeset
   447
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   448
    (holder := builder bindingAt:#listModel) isNil ifTrue:[
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   449
        holder := AspectAdaptor new subject:self; forAspect:#listSelection.
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   450
        builder aspectAt:#listModel put:holder.
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   451
    ].
785417b6955d intitial checkin
ca
parents:
diff changeset
   452
    ^ holder
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   453
!
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   454
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   455
selectionListModel
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   456
    "automatically generated by UIPainter ..."
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   457
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   458
    |holder|
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   459
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   460
    (holder := builder bindingAt:#selectionListModel) isNil ifTrue:[
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   461
        builder aspectAt:#selectionListModel put:(holder :=  SelectionInList new).
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   462
        holder listHolder:(self listChannel).
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   463
        holder selectionIndexHolder:(self listModel).
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   464
    ].
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   465
    ^ holder
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   466
! !
785417b6955d intitial checkin
ca
parents:
diff changeset
   467
785417b6955d intitial checkin
ca
parents:
diff changeset
   468
!UIHelpTool methodsFor:'initialization'!
785417b6955d intitial checkin
ca
parents:
diff changeset
   469
785417b6955d intitial checkin
ca
parents:
diff changeset
   470
initialize
785417b6955d intitial checkin
ca
parents:
diff changeset
   471
    "setup instance attributes
785417b6955d intitial checkin
ca
parents:
diff changeset
   472
    "
785417b6955d intitial checkin
ca
parents:
diff changeset
   473
    super initialize.
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   474
    dictionary := IdentityDictionary new.
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   475
! !
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   476
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   477
!UIHelpTool methodsFor:'private'!
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   478
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   479
editTextView
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   480
    "get the editTextView or nil.
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   481
    "
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   482
    |view|
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   483
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   484
    (view := builder componentAt:#textView) notNil ifTrue:[
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   485
        view := view scrolledView.
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   486
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   487
        view acceptAction isNil ifTrue:[
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   488
            view acceptAction:[:aList| self accept ].
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   489
        ].
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   490
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   491
        view left ~~ 0 ifTrue:[
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   492
            (maxCharsPerLine := view extent x // view font width) < 10 ifTrue:[
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   493
                maxCharsPerLine := nil
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   494
            ]
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   495
        ].
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   496
    ].
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   497
    ^ view
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   498
! !
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   499
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   500
!UIHelpTool methodsFor:'selection'!
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   501
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   502
listSelection
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   503
    "returns current selection
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   504
    "
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   505
    ^ listSelection
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   506
!
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   507
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   508
listSelection:aSelection
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   509
    "current selection changed
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   510
    "
299
62009576ca33 checkin from browser
ca
parents: 292
diff changeset
   511
    |txt view sel|
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   512
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   513
    aSelection isNumber ifTrue:[
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   514
        aSelection ~~ 0 ifTrue:[
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   515
            sel := self listChannel value at:aSelection
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   516
        ]
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   517
    ] ifFalse:[
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   518
        aSelection size ~~ 0 ifTrue:[
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   519
            sel := aSelection withoutSeparators.
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   520
            sel size == 0 ifTrue:[
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   521
                sel := nil
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   522
            ]
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   523
        ]
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   524
    ].
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   525
299
62009576ca33 checkin from browser
ca
parents: 292
diff changeset
   526
    listSelection = sel ifFalse:[
62009576ca33 checkin from browser
ca
parents: 292
diff changeset
   527
        listSelection := sel.
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   528
299
62009576ca33 checkin from browser
ca
parents: 292
diff changeset
   529
        modifiedHolder notNil ifTrue:[
62009576ca33 checkin from browser
ca
parents: 292
diff changeset
   530
            modifiedHolder value:true.
62009576ca33 checkin from browser
ca
parents: 292
diff changeset
   531
        ].
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   532
299
62009576ca33 checkin from browser
ca
parents: 292
diff changeset
   533
        (view := self editTextView) notNil ifTrue:[
62009576ca33 checkin from browser
ca
parents: 292
diff changeset
   534
            listSelection notNil ifTrue:[
62009576ca33 checkin from browser
ca
parents: 292
diff changeset
   535
                txt := dictionary at:(listSelection asSymbol) ifAbsent:nil.
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   536
299
62009576ca33 checkin from browser
ca
parents: 292
diff changeset
   537
                (txt isNil or:[maxCharsPerLine isNil]) ifFalse:[
62009576ca33 checkin from browser
ca
parents: 292
diff changeset
   538
                    txt := UIPainter convertString:(txt asString) maxLineSize:maxCharsPerLine.
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   539
                ]
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   540
            ].
299
62009576ca33 checkin from browser
ca
parents: 292
diff changeset
   541
            view contents:txt.    
62009576ca33 checkin from browser
ca
parents: 292
diff changeset
   542
        ]
62009576ca33 checkin from browser
ca
parents: 292
diff changeset
   543
    ]
286
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   544
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   545
! !
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   546
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   547
!UIHelpTool methodsFor:'user interactions'!
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   548
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   549
doFromClass
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   550
    "setup new specification from a class accessed through to a dialog
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   551
    "
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   552
    |cls accepted|
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   553
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   554
    specClass notNil ifTrue:[cls := specClass name asValue]
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   555
                    ifFalse:[cls := '' asValue].
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   556
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   557
    [true] whileTrue:[
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   558
        accepted :=
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   559
            (DialogBox new
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   560
                addTextLabel:'Classes name:';
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   561
                addInputFieldOn:cls; 
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   562
                addAbortButton; 
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   563
                addOkButton; 
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   564
                open
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   565
            ) accepted.
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   566
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   567
        accepted ifFalse:[^ self].
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   568
        cls := self class applicationClassAssociatedWith:cls value.
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   569
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   570
        cls notNil ifTrue:[
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   571
            ^ self helpSpecFrom:cls
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   572
        ].
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   573
        self warn:'no such class'.
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   574
    ]
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   575
!
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   576
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   577
doInstallHelpSpec
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   578
    "install help spec
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   579
    "
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   580
    self installHelpSpecInto:specClass
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   581
!
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   582
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   583
doReload
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   584
    "reload specification
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   585
    "
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   586
    |oldSel model|
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   587
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   588
    model  := self listModel.
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   589
    oldSel := model value.
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   590
    model value:nil.
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   591
    self helpSpecFrom:specClass.
23712b1d3f3d checkin from browser
ca
parents: 261
diff changeset
   592
    model value:oldSel.
148
785417b6955d intitial checkin
ca
parents:
diff changeset
   593
! !
785417b6955d intitial checkin
ca
parents:
diff changeset
   594
785417b6955d intitial checkin
ca
parents:
diff changeset
   595
!UIHelpTool class methodsFor:'documentation'!
785417b6955d intitial checkin
ca
parents:
diff changeset
   596
785417b6955d intitial checkin
ca
parents:
diff changeset
   597
version
785417b6955d intitial checkin
ca
parents:
diff changeset
   598
    ^ '$Header$'
785417b6955d intitial checkin
ca
parents:
diff changeset
   599
! !