UIPainter.st
changeset 368 9e588f397bc9
parent 366 68b0e0a329a4
child 375 b43507f222ce
equal deleted inserted replaced
367:5a78ebab56ff 368:9e588f397bc9
     7  inclusion of the above copyright notice.   This software may not
     7  inclusion of the above copyright notice.   This software may not
     8  be provided or otherwise made available to, or used by, any
     8  be provided or otherwise made available to, or used by, any
     9  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
       
    12 
    12 
    13 
    13 ApplicationModel subclass:#UIPainter
    14 ApplicationModel subclass:#UIPainter
    14 	instanceVariableNames:'treeView selectionPanel tabSelection specClass specSelector
    15 	instanceVariableNames:'treeView selectionPanel tabSelection specClass specSelector
    15 		specSuperclass aspects layoutCanvas helpCanvas specCanvas
    16 		specSuperclass aspects layoutCanvas helpCanvas specCanvas
    16 		transcript'
    17 		transcript'
   216     "Modified: / 29.10.1997 / 03:19:58 / cg"
   217     "Modified: / 29.10.1997 / 03:19:58 / cg"
   217 ! !
   218 ! !
   218 
   219 
   219 !UIPainter class methodsFor:'helpers'!
   220 !UIPainter class methodsFor:'helpers'!
   220 
   221 
   221 convertString:aString maxLineSize:maxCharactersPerLine
   222 convertString:aString maxLineSize:maxCharactersPerLine skipLineFeed:skipLineFeed
   222     "converts a string to a string collection with maximum characters
   223     "converts a string to a string collection with maximum characters
   223      per line
   224      per line
   224     "
   225     "
   225     |stream
   226     |stream
   226         max     "{ Class:SmallInteger }"
   227         max     "{ Class:SmallInteger }"
   242 
   243 
   243     [start <= size] whileTrue:[
   244     [start <= size] whileTrue:[
   244         (start := aString indexOfNonSeparatorStartingAt:start) == 0 ifTrue:[
   245         (start := aString indexOfNonSeparatorStartingAt:start) == 0 ifTrue:[
   245             ^ stream contents
   246             ^ stream contents
   246         ].
   247         ].
   247         (stop := aString indexOfSeparatorStartingAt:start) == 0 ifTrue:[
   248         (aString at:start) == $\ ifTrue:[
   248                 stop := size + 1
   249             skipLineFeed ifFalse:[
   249         ].
   250                 stream nextPut:$\
   250         cpySz := stop - start.
   251             ].
   251 
   252             start := start + 1.
   252         lnSz == 0 ifFalse:[
   253             stream cr.
   253             (lnSz := lnSz + cpySz) >= max ifTrue:[stream cr.    lnSz := cpySz ]
   254             start := start + 1.
   254                                          ifFalse:[stream space. lnSz := lnSz + 1]
   255             lnSz := 0.
   255         ] ifTrue:[
   256         ] ifFalse:[
   256             lnSz := cpySz
   257             (stop := aString indexOfSeparatorStartingAt:start) == 0 ifTrue:[
   257         ].
   258                     stop := size + 1
   258         stream nextPutAll:aString startingAt:start to:(stop - 1).
   259             ].
   259         start := stop.
   260             (aString at:(stop - 1)) == $\ ifTrue:[
       
   261                 stop := stop - 1
       
   262             ].
       
   263             cpySz := stop - start.
       
   264 
       
   265             lnSz == 0 ifFalse:[
       
   266                 (lnSz := lnSz + cpySz) >= max ifTrue:[stream cr.    lnSz := cpySz ]
       
   267                                              ifFalse:[stream space. lnSz := lnSz + 1]
       
   268             ] ifTrue:[
       
   269                 lnSz := cpySz
       
   270             ].
       
   271             stream nextPutAll:aString startingAt:start to:(stop - 1).
       
   272             start := stop.
       
   273         ]
   260     ].
   274     ].
   261     ^ stream contents
   275     ^ stream contents
   262 ! !
   276 ! !
   263 
   277 
   264 !UIPainter class methodsFor:'icons'!
   278 !UIPainter class methodsFor:'icons'!
  1682     aHelpText isNil ifTrue:[
  1696     aHelpText isNil ifTrue:[
  1683         txt := nil
  1697         txt := nil
  1684     ] ifFalse:[
  1698     ] ifFalse:[
  1685         txt := self class 
  1699         txt := self class 
  1686                 convertString:(aHelpText asString)
  1700                 convertString:(aHelpText asString)
  1687                 maxLineSize:(transcript width // transcript font width).
  1701                 maxLineSize:(transcript width // transcript font width)
       
  1702                skipLineFeed:true
  1688     ].
  1703     ].
  1689     transcript hideCursor.
  1704     transcript hideCursor.
  1690     transcript contents:txt.
  1705     transcript contents:txt.
  1691     ^ true
  1706     ^ true
  1692 
  1707 
  3347 initialize
  3362 initialize
  3348     "initialization; set multiple select and model
  3363     "initialization; set multiple select and model
  3349     "
  3364     "
  3350     super initialize.
  3365     super initialize.
  3351     self multipleSelectOk:true.
  3366     self multipleSelectOk:true.
       
  3367     cvsEventsDisabled := false.
       
  3368 
  3352 ! !
  3369 ! !
  3353 
  3370 
  3354 !UIPainter::TreeView methodsFor:'private'!
  3371 !UIPainter::TreeView methodsFor:'private'!
  3355 
  3372 
  3356 figureFor:aNode
  3373 figureFor:aNode