UIHelpTool.st
changeset 354 a6de8821d3bf
parent 339 121b64d9b39a
child 369 9d34f1ff4d29
equal deleted inserted replaced
353:6687441ccd4d 354:a6de8821d3bf
    85 
    85 
    86 )
    86 )
    87 ! !
    87 ! !
    88 
    88 
    89 !UIHelpTool class methodsFor:'interface specs'!
    89 !UIHelpTool class methodsFor:'interface specs'!
       
    90 
       
    91 keyMenu
       
    92     "this window spec was automatically generated by the ST/X MenuEditor"
       
    93 
       
    94     "do not manually edit this - the builder may not be able to
       
    95      handle the specification if its corrupted."
       
    96 
       
    97     "
       
    98      MenuEditor new openOnClass:UIHelpTool andSelector:#keyMenu
       
    99      (Menu new fromLiteralArrayEncoding:(UIHelpTool keyMenu)) startUp
       
   100     "
       
   101 
       
   102     <resource: #menu>
       
   103 
       
   104     ^
       
   105      
       
   106        #(#Menu
       
   107           
       
   108            #(
       
   109              #(#MenuItem
       
   110                 #'label:' 'new key ...'
       
   111                 #'value:' #newKey
       
   112             )
       
   113              #(#MenuItem
       
   114                 #'label:' '-'
       
   115             )
       
   116              #(#MenuItem
       
   117                 #'label:' 'remove'
       
   118                 #'value:' #removeKey
       
   119             )
       
   120           ) nil
       
   121           nil
       
   122       )
       
   123 
       
   124     "Created: / 27.10.1997 / 00:55:20 / cg"
       
   125 !
    90 
   126 
    91 menuPanelStandAlone
   127 menuPanelStandAlone
    92     "this window spec was automatically generated by the ST/X MenuEditor"
   128     "this window spec was automatically generated by the ST/X MenuEditor"
    93 
   129 
    94     "do not manually edit this - the builder may not be able to
   130     "do not manually edit this - the builder may not be able to
   170      
   206      
   171        #(#FullSpec
   207        #(#FullSpec
   172           #'window:' 
   208           #'window:' 
   173            #(#WindowSpec
   209            #(#WindowSpec
   174               #'name:' 'HelpTool'
   210               #'name:' 'HelpTool'
   175               #'layout:' #(#LayoutFrame 136 0 718 0 731 0 1215 0)
   211               #'layout:' #(#LayoutFrame 176 0 150 0 771 0 647 0)
   176               #'label:' 'HelpTool'
   212               #'label:' 'HelpTool'
   177               #'min:' #(#Point 10 10)
   213               #'min:' #(#Point 10 10)
   178               #'max:' #(#Point 1160 870)
   214               #'max:' #(#Point 1160 870)
   179               #'bounds:' #(#Rectangle 136 718 732 1216)
   215               #'bounds:' #(#Rectangle 176 150 772 648)
   180           )
   216           )
   181           #'component:' 
   217           #'component:' 
   182            #(#SpecCollection
   218            #(#SpecCollection
   183               #'collection:' 
   219               #'collection:' 
   184                #(
   220                #(
   202                               #'miniScrollerVertical:' true
   238                               #'miniScrollerVertical:' true
   203                           )
   239                           )
   204                            #(#SequenceViewSpec
   240                            #(#SequenceViewSpec
   205                               #'name:' 'selectionList'
   241                               #'name:' 'selectionList'
   206                               #'model:' #listModel
   242                               #'model:' #listModel
       
   243                               #'menu:' #keyMenu
   207                               #'hasHorizontalScrollBar:' true
   244                               #'hasHorizontalScrollBar:' true
   208                               #'hasVerticalScrollBar:' true
   245                               #'hasVerticalScrollBar:' true
   209                               #'miniScrollerHorizontal:' true
   246                               #'miniScrollerHorizontal:' true
   210                               #'miniScrollerVertical:' true
   247                               #'miniScrollerVertical:' true
   211                               #'useIndex:' false
   248                               #'useIndex:' false
   216                     #'handles:' #(#Any 0.5 1.0)
   253                     #'handles:' #(#Any 0.5 1.0)
   217                 )
   254                 )
   218               )
   255               )
   219           )
   256           )
   220       )
   257       )
       
   258 
       
   259     "Modified: / 27.10.1997 / 00:55:35 / cg"
   221 !
   260 !
   222 
   261 
   223 windowSpec
   262 windowSpec
   224     "this window spec was automatically generated by the ST/X UIPainter"
   263     "this window spec was automatically generated by the ST/X UIPainter"
   225 
   264 
   344     "update list from dictionary
   383     "update list from dictionary
   345     "
   384     "
   346     self listChannel value:(dictionary keys asSortedCollection)
   385     self listChannel value:(dictionary keys asSortedCollection)
   347 ! !
   386 ! !
   348 
   387 
       
   388 !UIHelpTool methodsFor:'accessing menu'!
       
   389 
       
   390 keyMenu
       
   391     "this window spec was automatically generated by the UI Builder"
       
   392 
       
   393     ^ self class keyMenu
       
   394 
       
   395     "Created: / 27.10.1997 / 00:55:20 / cg"
       
   396 ! !
       
   397 
   349 !UIHelpTool methodsFor:'actions'!
   398 !UIHelpTool methodsFor:'actions'!
   350 
   399 
   351 accept
   400 accept
   352     "accept the text
   401     "accept the text
   353     "
   402     "
   366 !
   415 !
   367 
   416 
   368 installHelpSpecInto:aClass
   417 installHelpSpecInto:aClass
   369     "install help text
   418     "install help text
   370     "
   419     "
   371     |cls src|
   420     |cls src order|
   372 
   421 
   373     cls := self applicationClassAssociatedWith:aClass.
   422     cls := self applicationClassAssociatedWith:aClass.
   374 
   423 
   375     cls isNil ifTrue:[
   424     cls isNil ifTrue:[
   376         ^ self information:'no application class defined'.
   425         ^ self information:'no application class defined'.
   392 
   441 
   393   ^ super helpSpec addPairsFrom:#(
   442   ^ super helpSpec addPairsFrom:#(
   394 
   443 
   395 '.
   444 '.
   396 
   445 
   397     dictionary keysAndValuesDo:[:key :txt|
   446     order := dictionary keys asSortedCollection.
   398         |t|
   447     order do:[:key |
       
   448         |txt t|
       
   449 
       
   450         txt := dictionary at:key.
   399         src nextPutLine:key storeString.
   451         src nextPutLine:key storeString.
   400 
   452 
   401         t := txt asString replaceAll:(Character cr) with:(Character space).
   453         t := txt asString replaceAll:(Character cr) with:(Character space).
   402 
   454 
   403         (t endsWith:Character space) ifTrue:[
   455         (t endsWith:Character space) ifTrue:[
   409 
   461 
   410     Compiler compile:(src contents)
   462     Compiler compile:(src contents)
   411             forClass:cls class 
   463             forClass:cls class 
   412           inCategory:'help specs'
   464           inCategory:'help specs'
   413 
   465 
       
   466     "Modified: / 26.10.1997 / 23:01:44 / cg"
   414 ! !
   467 ! !
   415 
   468 
   416 !UIHelpTool methodsFor:'aspects'!
   469 !UIHelpTool methodsFor:'aspects'!
   417 
   470 
   418 listChannel
   471 listChannel
   419     "automatically generated by UIPainter ..."
   472     "automatically generated by UIPainter ..."
   420 
   473 
   421     |holder|
   474     |holder|
   422 
   475 
   423     (holder := builder bindingAt:#listChannel) isNil ifTrue:[
   476     (holder := builder bindingAt:#listChannel) isNil ifTrue:[
   424         builder aspectAt:#listChannel put:(holder :=  ValueHolder new).
   477         builder aspectAt:#listChannel put:(holder :=  OrderedCollection new asValue).
   425         holder value:(OrderedCollection new).
       
   426     ].
   478     ].
   427     ^ holder
   479     ^ holder
       
   480 
       
   481     "Modified: / 27.10.1997 / 01:50:33 / cg"
   428 !
   482 !
   429 
   483 
   430 listModel
   484 listModel
   431     "automatically generated by UIPainter ..."
   485     "automatically generated by UIPainter ..."
   432 
   486 
   444 initialize
   498 initialize
   445     "setup instance attributes
   499     "setup instance attributes
   446     "
   500     "
   447     super initialize.
   501     super initialize.
   448     dictionary := IdentityDictionary new.
   502     dictionary := IdentityDictionary new.
       
   503 ! !
       
   504 
       
   505 !UIHelpTool methodsFor:'menu actions'!
       
   506 
       
   507 newKey
       
   508     |k sym|
       
   509 
       
   510     k := Dialog request:'name of new:'.
       
   511     k size > 0 ifTrue:[
       
   512         ((dictionary includesKey:k)
       
   513         or:[(sym := k asSymbolIfInterned) notNil
       
   514             and:[dictionary includesKey:sym]]) 
       
   515         ifTrue:[
       
   516             ^ self warn:'key is already present.'.
       
   517         ].
       
   518         dictionary at:k asSymbol put:''.
       
   519         self updateList
       
   520      ].
       
   521 
       
   522     "Created: / 27.10.1997 / 01:48:48 / cg"
       
   523     "Modified: / 27.10.1997 / 02:24:30 / cg"
       
   524 !
       
   525 
       
   526 removeKey
       
   527     |k sym|
       
   528 
       
   529     k := Dialog request:'name of key to remove:' initialAnswer:listSelection.
       
   530     k size > 0 ifTrue:[
       
   531         ((dictionary includesKey:k)
       
   532         or:[(sym := k asSymbolIfInterned) notNil
       
   533             and:[dictionary includesKey:sym]]) 
       
   534         ifFalse:[
       
   535             ^ self warn:'key is not present.'.
       
   536         ].
       
   537         sym notNil ifTrue:[
       
   538             dictionary removeKey:sym ifAbsent:nil.
       
   539         ].
       
   540         dictionary removeKey:k ifAbsent:nil.
       
   541         self updateList
       
   542      ].
       
   543 
       
   544     "Created: / 27.10.1997 / 01:48:48 / cg"
       
   545     "Modified: / 27.10.1997 / 02:25:30 / cg"
   449 ! !
   546 ! !
   450 
   547 
   451 !UIHelpTool methodsFor:'private'!
   548 !UIHelpTool methodsFor:'private'!
   452 
   549 
   453 editTextView
   550 editTextView