UIHelpTool.st
changeset 1340 4276358d937b
parent 1336 3c84dc6f8d4b
child 1506 6525741c998e
equal deleted inserted replaced
1339:b989732e3610 1340:4276358d937b
   129     <resource: #help>
   129     <resource: #help>
   130 
   130 
   131     ^super helpSpec addPairsFrom:#(
   131     ^super helpSpec addPairsFrom:#(
   132 
   132 
   133 #addHelpTextKey
   133 #addHelpTextKey
   134 'Adds the help text key to the help spec.'
   134 'Adds the key to the help spec.'
   135 
   135 
   136 #currentHelpTexts
   136 #currentHelpTexts
   137 'Selected help text key.'
   137 'Selected help text key.'
   138 
   138 
   139 #deleteHelpTextKey
   139 #deleteHelpTextKey
   140 'Deletes the help text key from the help spec.'
   140 'Deletes the key from the help spec.'
       
   141 
       
   142 #updateHelpTextKey
       
   143 'Refetch the help spec.'
   141 
   144 
   142 #fileLoad
   145 #fileLoad
   143 'Opens a dialog for selecting and loading a help spec from a class.'
   146 'Opens a dialog for selecting and loading a help spec from a class.'
   144 
   147 
   145 #fileSave
   148 #fileSave
   146 'Saves current help spec.'
   149 'Saves the current help spec.'
       
   150 
       
   151 #fileUpdate
       
   152 'Reload the help spec.'
   147 
   153 
   148 #helpTextView
   154 #helpTextView
   149 'Shows the help text.'
   155 'Shows the help text.'
   150 
   156 
   151 #listOfHelpSpecClasses
   157 #listOfHelpSpecClasses
   152 'List of the classes where help specs can be/are implemented.'
   158 'Classes where help specs can be/are implemented.'
   153 
   159 
   154 #listOfHelpTexts
   160 #listOfHelpTexts
   155 'List of the help text keys.'
   161 'List of help text keys.'
   156 
   162 
   157 #removeHelpTextKey
   163 #removeHelpTextKey
   158 'Removes the help text key from the widget.'
   164 'Removes the help message from the widget.'
   159 
   165 
   160 )
   166 )
   161 ! !
   167 ! !
   162 
   168 
   163 !UIHelpTool class methodsFor:'interface specs'!
   169 !UIHelpTool class methodsFor:'interface specs'!
   184        #(#WindowSpec
   190        #(#WindowSpec
   185           #label: 'Help Tool'
   191           #label: 'Help Tool'
   186           #name: 'Help Tool'
   192           #name: 'Help Tool'
   187           #min: #(#Point 10 10)
   193           #min: #(#Point 10 10)
   188           #max: #(#Point 1160 870)
   194           #max: #(#Point 1160 870)
   189           #bounds: #(#Rectangle 93 147 379 418)
   195           #bounds: #(#Rectangle 218 175 504 446)
   190         )
   196         )
   191         #component: 
   197         #component: 
   192        #(#SpecCollection
   198        #(#SpecCollection
   193           #collection: #(
   199           #collection: #(
   194            #(#VariableVerticalPanelSpec
   200            #(#VariableVerticalPanelSpec
   195               #name: 'VariableVerticalPanel'
   201               #name: 'VariableVerticalPanel'
   196               #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
   202               #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
   197               #component: 
   203               #component: 
   198              #(#SpecCollection
   204              #(#SpecCollection
   199                 #collection: #(
   205                 #collection: #(
   200                  #(#VariableHorizontalPanelSpec
   206                  #(#ViewSpec
   201                     #name: 'VariableHorizontalPanel'
   207                     #name: 'Box1'
   202                     #component: 
   208                     #component: 
   203                    #(#SpecCollection
   209                    #(#SpecCollection
   204                       #collection: #(
   210                       #collection: #(
   205                        #(#SequenceViewSpec
   211                        #(#HorizontalPanelViewSpec
   206                           #name: 'listOfHelpKeysView'
   212                           #name: 'HorizontalPanel1'
   207                           #activeHelpKey: #listOfHelpTexts
   213                           #layout: #(#LayoutFrame 0 0 0 0 0 1 25 0)
   208                           #tabable: true
   214                           #horizontalLayout: #fit
   209                           #model: #listModel
   215                           #verticalLayout: #fit
   210                           #hasHorizontalScrollBar: true
   216                           #horizontalSpace: 3
   211                           #hasVerticalScrollBar: true
   217                           #verticalSpace: 3
   212                           #miniScrollerHorizontal: true
       
   213                           #useIndex: false
       
   214                           #sequenceList: #listChannel
       
   215                         )
       
   216                        #(#ViewSpec
       
   217                           #name: 'Box'
       
   218                           #component: 
   218                           #component: 
   219                          #(#SpecCollection
   219                          #(#SpecCollection
   220                             #collection: #(
   220                             #collection: #(
   221                              #(#HorizontalPanelViewSpec
   221                              #(#ActionButtonSpec
   222                                 #name: 'HorizontalPanel1'
   222                                 #label: 'Add'
   223                                 #layout: #(#LayoutFrame 0 0.0 2 0 0 1.0 26 0)
   223                                 #name: 'AddButton'
   224                                 #horizontalLayout: #fit
   224                                 #activeHelpKey: #addHelpTextKey
   225                                 #verticalLayout: #fit
   225                                 #translateLabel: true
   226                                 #horizontalSpace: 3
   226                                 #tabable: true
   227                                 #verticalSpace: 3
   227                                 #model: #doAdd
       
   228                                 #extent: #(#Point 69 25)
       
   229                               )
       
   230                              #(#ActionButtonSpec
       
   231                                 #label: 'Remove'
       
   232                                 #name: 'RemoveButton'
       
   233                                 #activeHelpKey: #removeHelpTextKey
       
   234                                 #translateLabel: true
       
   235                                 #tabable: true
       
   236                                 #model: #doRemove
       
   237                                 #extent: #(#Point 69 25)
       
   238                               )
       
   239                              #(#ActionButtonSpec
       
   240                                 #label: 'Update'
       
   241                                 #name: 'UpdateButton'
       
   242                                 #activeHelpKey: #updateHelpTextKey
       
   243                                 #translateLabel: true
       
   244                                 #tabable: true
       
   245                                 #model: #doUpdate
       
   246                                 #extent: #(#Point 69 25)
       
   247                               )
       
   248                              #(#ActionButtonSpec
       
   249                                 #label: 'Delete'
       
   250                                 #name: 'DeleteButton'
       
   251                                 #activeHelpKey: #deleteHelpTextKey
       
   252                                 #translateLabel: true
       
   253                                 #tabable: true
       
   254                                 #model: #doDelete
       
   255                                 #extent: #(#Point 70 25)
       
   256                               )
       
   257                              )
       
   258                            
       
   259                           )
       
   260                         )
       
   261                        #(#VariableHorizontalPanelSpec
       
   262                           #name: 'VariableHorizontalPanel'
       
   263                           #layout: #(#LayoutFrame 0 0 25 0 0 1 0 1)
       
   264                           #component: 
       
   265                          #(#SpecCollection
       
   266                             #collection: #(
       
   267                              #(#SequenceViewSpec
       
   268                                 #name: 'listOfHelpKeysView'
       
   269                                 #activeHelpKey: #listOfHelpTexts
       
   270                                 #tabable: true
       
   271                                 #model: #listModel
       
   272                                 #hasHorizontalScrollBar: true
       
   273                                 #hasVerticalScrollBar: true
       
   274                                 #miniScrollerHorizontal: true
       
   275                                 #useIndex: false
       
   276                                 #sequenceList: #listChannel
       
   277                               )
       
   278                              #(#ViewSpec
       
   279                                 #name: 'Box'
   228                                 #component: 
   280                                 #component: 
   229                                #(#SpecCollection
   281                                #(#SpecCollection
   230                                   #collection: #(
   282                                   #collection: #(
   231                                    #(#ActionButtonSpec
   283                                    #(#InputFieldSpec
   232                                       #attributes: 
   284                                       #name: 'helpKeyInputField'
   233                                      #(#tabable
   285                                       #layout: #(#LayoutFrame 2 0.0 2 0 -2 1.0 25 0)
   234                                         true
   286                                       #activeHelpKey: #currentHelpTexts
   235                                       )
       
   236                                       #label: 'Add'
       
   237                                       #name: 'AddButton'
       
   238                                       #activeHelpKey: #addHelpTextKey
       
   239                                       #translateLabel: true
       
   240                                       #tabable: true
   287                                       #tabable: true
   241                                       #model: #doAdd
   288                                       #model: #listModel
   242                                       #extent: #(#Point 44 24)
   289                                       #immediateAccept: false
       
   290                                       #acceptOnPointerLeave: false
   243                                     )
   291                                     )
   244                                    #(#ActionButtonSpec
   292                                    #(#SequenceViewSpec
   245                                       #attributes: 
   293                                       #name: 'listOfHelpSpecClassesView'
   246                                      #(#tabable
   294                                       #layout: #(#LayoutFrame 0 0.0 27 0 0 1.0 0 1.0)
   247                                         true
   295                                       #activeHelpKey: #listOfHelpSpecClasses
   248                                       )
       
   249                                       #label: 'Remove'
       
   250                                       #name: 'RemoveButton'
       
   251                                       #activeHelpKey: #removeHelpTextKey
       
   252                                       #translateLabel: true
       
   253                                       #tabable: true
   296                                       #tabable: true
   254                                       #model: #doRemove
   297                                       #model: #selectionOfHelpSpecClass
   255                                       #extent: #(#Point 44 24)
   298                                       #hasHorizontalScrollBar: true
   256                                     )
   299                                       #hasVerticalScrollBar: true
   257                                    #(#ActionButtonSpec
   300                                       #miniScrollerHorizontal: true
   258                                       #attributes: 
   301                                       #miniScrollerVertical: true
   259                                      #(#tabable
   302                                       #valueChangeSelector: #helpSpecClassSelected
   260                                         true
   303                                       #useIndex: false
   261                                       )
   304                                       #sequenceList: #listOfHelpSpecClasses
   262                                       #label: 'Delete'
       
   263                                       #name: 'DeleteButton'
       
   264                                       #activeHelpKey: #deleteHelpTextKey
       
   265                                       #translateLabel: true
       
   266                                       #tabable: true
       
   267                                       #model: #doDelete
       
   268                                       #extent: #(#Point 44 24)
       
   269                                     )
   305                                     )
   270                                    )
   306                                    )
   271                                  
   307                                  
   272                                 )
   308                                 )
   273                               )
   309                               )
   274                              #(#InputFieldSpec
       
   275                                 #attributes: 
       
   276                                #(#tabable
       
   277                                   true
       
   278                                 )
       
   279                                 #name: 'helpKeyInputField'
       
   280                                 #layout: #(#LayoutFrame 0 0.0 29 0 0 1.0 51 0)
       
   281                                 #activeHelpKey: #currentHelpTexts
       
   282                                 #tabable: true
       
   283                                 #model: #listModel
       
   284                                 #immediateAccept: false
       
   285                                 #acceptOnPointerLeave: false
       
   286                               )
       
   287                              #(#SequenceViewSpec
       
   288                                 #name: 'listOfHelpSpecClassesView'
       
   289                                 #layout: #(#LayoutFrame 0 0.0 54 0 0 1.0 0 1.0)
       
   290                                 #activeHelpKey: #listOfHelpSpecClasses
       
   291                                 #tabable: true
       
   292                                 #model: #selectionOfHelpSpecClass
       
   293                                 #hasHorizontalScrollBar: true
       
   294                                 #hasVerticalScrollBar: true
       
   295                                 #miniScrollerHorizontal: true
       
   296                                 #miniScrollerVertical: true
       
   297                                 #valueChangeSelector: #helpSpecClassSelected
       
   298                                 #useIndex: false
       
   299                                 #sequenceList: #listOfHelpSpecClasses
       
   300                               )
       
   301                              )
   310                              )
   302                            
   311                            
   303                           )
   312                           )
       
   313                           #handles: #(#Any 0.5 1.0)
   304                         )
   314                         )
   305                        )
   315                        )
   306                      
   316                      
   307                     )
   317                     )
   308                     #handles: #(#Any 0.5 1.0)
       
   309                   )
   318                   )
   310                  #(#TextEditorSpec
   319                  #(#TextEditorSpec
   311                     #name: 'helpTextView'
   320                     #name: 'helpTextView'
   312                     #activeHelpKey: #helpTextView
   321                     #activeHelpKey: #helpTextView
   313                     #tabable: true
   322                     #tabable: true
   408                           #translateLabel: true
   417                           #translateLabel: true
   409                           #value: #doLoad
   418                           #value: #doLoad
   410                           #activeHelpKey: #fileLoad
   419                           #activeHelpKey: #fileLoad
   411                       )
   420                       )
   412                        #(#MenuItem
   421                        #(#MenuItem
       
   422                           #label: 'Update'
       
   423                           #translateLabel: true
       
   424                           #value: #doUpdate
       
   425                           #activeHelpKey: #fileUpdate
       
   426                       )
       
   427                        #(#MenuItem
   413                           #label: '-'
   428                           #label: '-'
   414                       )
   429                       )
   415                        #(#MenuItem
   430                        #(#MenuItem
   416                           #label: 'Save'
   431                           #label: 'Save'
   417                           #translateLabel: true
   432                           #translateLabel: true
   624      'between' aClass and ApplicationModel" 
   639      'between' aClass and ApplicationModel" 
   625 
   640 
   626     |list listOfHelpSpecClassesView|
   641     |list listOfHelpSpecClassesView|
   627 
   642 
   628     modified := false.
   643     modified := false.
   629     specClass notNil
   644     specClass  := self getHelpSpecClassFromClass:aClass.
   630     ifTrue:
   645     self rebuild.
   631     [   
   646 !
       
   647 
       
   648 buildFromClass: aClass andSelector: aSelector
       
   649     "sets aSelector and reads the help dictionary from aClass"
       
   650 
       
   651     specSelector := aSelector.
       
   652     self buildFromClass:aClass
       
   653 
       
   654 !
       
   655 
       
   656 rebuild
       
   657     "reads the help dictionary from aClass and find remaining classes 
       
   658      'between' aClass and ApplicationModel" 
       
   659 
       
   660     |list listOfHelpSpecClassesView|
       
   661 
       
   662     specClass notNil ifTrue:[   
   632         dictionary   := Dictionary new.
   663         dictionary   := Dictionary new.
   633         dictionaries := Dictionary new.
   664         dictionaries := Dictionary new.
   634     ].
   665     ].
   635     specClass  := self getHelpSpecClassFromClass:aClass.
   666 
   636     (specClass isClass and: [specClass isLoaded])
   667     (specClass isClass and: [specClass isLoaded])
   637     ifTrue: 
   668     ifTrue: 
   638     [                                               
   669     [                                               
   639         (specClass class implements:specSelector) ifFalse:[
   670         (specClass class implements:specSelector) ifFalse:[
   640             dictionaries at: specClass name put: dictionary 
   671             dictionaries at: specClass name put: dictionary 
   653         ].
   684         ].
   654         self helpSpecClassSelected.
   685         self helpSpecClassSelected.
   655     ].
   686     ].
   656 
   687 
   657     self updateList
   688     self updateList
   658 
       
   659     "Modified: / 21.8.1998 / 15:48:00 / cg"
       
   660 !
       
   661 
       
   662 buildFromClass: aClass andSelector: aSelector
       
   663     "sets aSelector and reads the help dictionary from aClass"
       
   664 
       
   665     specSelector := aSelector.
       
   666     self buildFromClass:aClass
       
   667 
   689 
   668 ! !
   690 ! !
   669 
   691 
   670 !UIHelpTool methodsFor:'callbacks'!
   692 !UIHelpTool methodsFor:'callbacks'!
   671 
   693 
  1044 !UIHelpTool methodsFor:'startup / release'!
  1066 !UIHelpTool methodsFor:'startup / release'!
  1045 
  1067 
  1046 closeRequest
  1068 closeRequest
  1047     "asks for permission before closing"
  1069     "asks for permission before closing"
  1048 
  1070 
  1049     (self masterApplication isNil and:[self askForModification]) ifTrue:[super closeRequest]
  1071     (self masterApplication isNil and:[self askForModification]) ifTrue:[
       
  1072         super closeRequest
       
  1073     ]
  1050 !
  1074 !
  1051 
  1075 
  1052 initialize
  1076 initialize
  1053     "initializes instance variables"
  1077     "initializes instance variables"
  1054 
  1078 
  1231 
  1255 
  1232 doSave
  1256 doSave
  1233     "saves the help dictionaries on specClass"
  1257     "saves the help dictionaries on specClass"
  1234 
  1258 
  1235     self installHelpSpecsOnClass:specClass
  1259     self installHelpSpecsOnClass:specClass
       
  1260 !
       
  1261 
       
  1262 doUpdate
       
  1263     "reread the helpspecs and update my lists"
       
  1264 
       
  1265     specClass isNil ifTrue:[
       
  1266         ^ self warn:'No spec loaded'.
       
  1267     ].
       
  1268 
       
  1269     (self askForModification) ifTrue:[
       
  1270         self rebuild
       
  1271     ]
  1236 ! !
  1272 ! !
  1237 
  1273 
  1238 !UIHelpTool class methodsFor:'documentation'!
  1274 !UIHelpTool class methodsFor:'documentation'!
  1239 
  1275 
  1240 version
  1276 version