UIPainter.st
changeset 542 11be1353d34c
parent 538 3d75219adb32
child 547 930b3df19305
equal deleted inserted replaced
541:5dc124df04e2 542:11be1353d34c
    56 
    56 
    57     [start with:]
    57     [start with:]
    58         UIPainter open
    58         UIPainter open
    59 
    59 
    60     [author:]
    60     [author:]
    61         Claus Gittinger
    61         Claus Gittinger, eXept Software AG
    62         Claus Atzkern
    62         Claus Atzkern, eXept Software AG
    63 
    63 
    64     [see also:]
    64     [see also:]
    65         UIBuilder
    65         UIBuilder
    66         ApplicationModel
    66         ApplicationModel
    67         UISpecification
    67         UISpecification
   244         max     "{ Class:SmallInteger }"
   244         max     "{ Class:SmallInteger }"
   245         size    "{ Class:SmallInteger }"
   245         size    "{ Class:SmallInteger }"
   246         start   "{ Class:SmallInteger }"
   246         start   "{ Class:SmallInteger }"
   247         stop    "{ Class:SmallInteger }"
   247         stop    "{ Class:SmallInteger }"
   248         cpySz   "{ Class:SmallInteger }"
   248         cpySz   "{ Class:SmallInteger }"
   249         lnSz    "{ Class:SmallInteger }"|
   249         lnSz    "{ Class:SmallInteger }"
       
   250         atBeginOfLine|
   250 
   251 
   251     maxCharactersPerLine < 20 ifFalse:[max := maxCharactersPerLine - 1]
   252     maxCharactersPerLine < 20 ifFalse:[max := maxCharactersPerLine - 1]
   252                                ifTrue:[max := 20].
   253                                ifTrue:[max := 20].
   253 
   254 
   254     (size := aString size) <= max ifTrue:[
   255     (size := aString size) <= max ifTrue:[
   255         ^ aString
   256         ^ aString
   256     ].
   257     ].
   257     start  := 1.
   258     start  := 1.
   258     lnSz   := 0.
   259     lnSz   := 0.
   259     stream := (String new:size) writeStream.
   260     stream := (String new:size) writeStream.
       
   261 
       
   262     atBeginOfLine := true.
   260 
   263 
   261     [start <= size] whileTrue:[
   264     [start <= size] whileTrue:[
   262         (start := aString indexOfNonSeparatorStartingAt:start) == 0 ifTrue:[
   265         (start := aString indexOfNonSeparatorStartingAt:start) == 0 ifTrue:[
   263             ^ stream contents
   266             ^ stream contents
   264         ].
   267         ].
   270             stream cr.
   273             stream cr.
   271             start := start + 1.
   274             start := start + 1.
   272             lnSz := 0.
   275             lnSz := 0.
   273         ] ifFalse:[
   276         ] ifFalse:[
   274             (stop := aString indexOfSeparatorStartingAt:start) == 0 ifTrue:[
   277             (stop := aString indexOfSeparatorStartingAt:start) == 0 ifTrue:[
   275                     stop := size + 1
   278                 stop := size + 1
   276             ].
   279             ].
   277             (aString at:(stop - 1)) == $\ ifTrue:[
   280             (aString at:(stop - 1)) == $\ ifTrue:[
   278                 stop := stop - 1
   281                 stop := stop - 1
   279             ].
   282             ].
   280             cpySz := stop - start.
   283             cpySz := stop - start.
   281 
   284 
   282             lnSz == 0 ifFalse:[
   285             lnSz == 0 ifFalse:[
   283                 (lnSz := lnSz + cpySz) >= max ifTrue:[stream cr.    lnSz := cpySz ]
   286                 (lnSz := lnSz + cpySz) >= max ifTrue:[stream cr.    lnSz := cpySz. atBeginOfLine := true. ]
   284                                              ifFalse:[stream space. lnSz := lnSz + 1]
   287                                              ifFalse:[stream space. lnSz := lnSz + 1]
   285             ] ifTrue:[
   288             ] ifTrue:[
   286                 lnSz := cpySz
   289                 lnSz := cpySz
   287             ].
   290             ].
   288             stream nextPutAll:aString startingAt:start to:(stop - 1).
   291             stream nextPutAll:aString startingAt:start to:(stop - 1).
   289             start := stop.
   292             start := stop.
   290         ]
   293         ]
   291     ].
   294     ].
   292     ^ stream contents
   295     ^ stream contents
       
   296 
       
   297     "Modified: / 1.2.1998 / 14:42:56 / cg"
   293 ! !
   298 ! !
   294 
   299 
   295 !UIPainter class methodsFor:'interface specs'!
   300 !UIPainter class methodsFor:'interface specs'!
   296 
   301 
   297 gridParametersSpec
   302 gridParametersSpec