UIHelpTool.st
changeset 299 62009576ca33
parent 292 af69e3e025a9
child 319 f16aa0e8541e
equal deleted inserted replaced
298:cec1f174397e 299:62009576ca33
   509 !
   509 !
   510 
   510 
   511 listSelection:aSelection
   511 listSelection:aSelection
   512     "current selection changed
   512     "current selection changed
   513     "
   513     "
   514     |txt col line view sel|
   514     |txt view sel|
   515 
   515 
   516     aSelection isNumber ifTrue:[
   516     aSelection isNumber ifTrue:[
   517         aSelection ~~ 0 ifTrue:[
   517         aSelection ~~ 0 ifTrue:[
   518             sel := self listChannel value at:aSelection
   518             sel := self listChannel value at:aSelection
   519         ]
   519         ]
   524                 sel := nil
   524                 sel := nil
   525             ]
   525             ]
   526         ]
   526         ]
   527     ].
   527     ].
   528 
   528 
   529     listSelection = sel ifTrue:[
   529     listSelection = sel ifFalse:[
   530         ^ self
   530         listSelection := sel.
   531     ].
   531 
   532     listSelection := sel.
   532         modifiedHolder notNil ifTrue:[
   533 
   533             modifiedHolder value:true.
   534     modifiedHolder notNil ifTrue:[
   534         ].
   535         modifiedHolder value:true.
   535 
   536     ].
   536         (view := self editTextView) notNil ifTrue:[
   537 
   537             listSelection notNil ifTrue:[
   538     (view := self editTextView) isNil ifTrue:[
   538                 txt := dictionary at:(listSelection asSymbol) ifAbsent:nil.
   539         ^ self
   539 
   540     ].
   540                 (txt isNil or:[maxCharsPerLine isNil]) ifFalse:[
   541 
   541                     txt := UIPainter convertString:(txt asString) maxLineSize:maxCharsPerLine.
   542     listSelection notNil ifTrue:[
       
   543         txt := dictionary at:(listSelection asSymbol) ifAbsent:nil.
       
   544     ].
       
   545 
       
   546     (txt isNil or:[maxCharsPerLine isNil]) ifTrue:[
       
   547         col := txt.
       
   548     ] ifFalse:[
       
   549         col := OrderedCollection new.
       
   550 
       
   551         txt asString asCollectionOfWords do:[:aWord|
       
   552             line isNil ifTrue:[
       
   553                 line := aWord
       
   554             ] ifFalse:[
       
   555                 (line size + aWord size) >= maxCharsPerLine ifTrue:[
       
   556                     col add:line.
       
   557                     line := aWord
       
   558                 ] ifFalse:[
       
   559                     line := line, ' ', aWord
       
   560                 ]
   542                 ]
   561             ].
   543             ].
   562         ].
   544             view contents:txt.    
   563         line notNil ifTrue:[col add:line].
   545         ]
   564     ].
   546     ]
   565     view contents:col.    
       
   566 
       
   567 
   547 
   568 ! !
   548 ! !
   569 
   549 
   570 !UIHelpTool methodsFor:'user interactions'!
   550 !UIHelpTool methodsFor:'user interactions'!
   571 
   551