SelectionInListView.st
changeset 6054 2dd9fc1c0bff
parent 5992 9c05410340c1
child 6073 511a25603e1c
child 6085 4ecbe3a93aec
equal deleted inserted replaced
6053:74dd0568082d 6054:2dd9fc1c0bff
  1491     "somewhat of a kludge: if selection is first line,
  1491     "somewhat of a kludge: if selection is first line,
  1492      we have to remove the highlight frame by hand here"
  1492      we have to remove the highlight frame by hand here"
  1493 
  1493 
  1494     (shown and:[hilightLevel ~~ 0]) ifTrue:[
  1494     (shown and:[hilightLevel ~~ 0]) ifTrue:[
  1495         selection == firstLineShown ifTrue:[
  1495         selection == firstLineShown ifTrue:[
  1496            self paint:bgColor.
  1496            gc paint:bgColor.
  1497            self fillRectangleX:margin y:margin
  1497            gc fillRectangleX:margin y:margin
  1498                           width:(width - (margin * 2)) 
  1498               width:(width - (margin * 2)) height:(hilightLevel abs).
  1499                          height:(hilightLevel abs).
       
  1500         ].
  1499         ].
  1501     ].
  1500     ].
  1502 
  1501 
  1503     aBoolean ifTrue:[
  1502     aBoolean ifTrue:[
  1504         oldSelection := selection.
  1503         oldSelection := selection.
  2070     hilightFrameColor notNil ifTrue:[
  2069     hilightFrameColor notNil ifTrue:[
  2071         hilightLevel == 0 ifTrue:[
  2070         hilightLevel == 0 ifTrue:[
  2072             "
  2071             "
  2073              a line above and below
  2072              a line above and below
  2074             "
  2073             "
  2075             self paint:hilightFrameColor.
  2074             gc paint:hilightFrameColor.
  2076             self displayLineFromX:0 y:y toX:width y:y.
  2075             gc displayLineFromX:0 y:y toX:width y:y.
  2077             y2 := y + fontHeight - 1.
  2076             y2 := y + fontHeight - 1.
  2078             self displayLineFromX:0 y:y2 toX:width y:y2.
  2077             gc displayLineFromX:0 y:y2 toX:width y:y2.
  2079             ^ self
  2078             ^ self
  2080         ]
  2079         ]
  2081     ] ifFalse:[
  2080     ] ifFalse:[
  2082         hilightStyle == #motif ifTrue:[
  2081         hilightStyle == #motif ifTrue:[
  2083             "/ an additional line, inset by one pixel
  2082             "/ an additional line, inset by one pixel
  2084             self paint:fg.
  2083             gc paint:fg.
  2085             self displayLineFromX:0 y:y+1 toX:width y:y+1.
  2084             gc displayLineFromX:0 y:y+1 toX:width y:y+1.
  2086             y2 := y + fontHeight - 1 - 1.
  2085             y2 := y + fontHeight - 1 - 1.
  2087             self displayLineFromX:0 y:y2 toX:width y:y2.
  2086             gc displayLineFromX:0 y:y2 toX:width y:y2.
  2088         ] ifFalse:[
  2087         ] ifFalse:[
  2089             hilightStyle == #macosx ifTrue:[
  2088             hilightStyle == #macosx ifTrue:[
  2090                 "/ an additional line, at the bottom
  2089                 "/ an additional line, at the bottom
  2091                 self paint:viewBackground.
  2090                 gc paint:viewBackground.
  2092                 y2 := y + fontHeight - 1.
  2091                 y2 := y + fontHeight - 1.
  2093                 self displayLineFromX:0 y:y2 toX:width y:y2.
  2092                 gc displayLineFromX:0 y:y2 toX:width y:y2.
  2094             ]
  2093             ]
  2095         ].
  2094         ].
  2096     ].
  2095     ].
  2097 
  2096 
  2098     "
  2097     "
  2148     y := self yOfVisibleLine:visLineNr.
  2147     y := self yOfVisibleLine:visLineNr.
  2149 
  2148 
  2150     "/ if an explicit drawing block has been defined - let it do it.
  2149     "/ if an explicit drawing block has been defined - let it do it.
  2151     selectedVisualBlock notNil ifTrue:[
  2150     selectedVisualBlock notNil ifTrue:[
  2152         backgroundAlreadyClearedColor == bg ifFalse:[
  2151         backgroundAlreadyClearedColor == bg ifFalse:[
  2153             self paint:bg.
  2152             gc paint:bg.
  2154             self fillRectangleX:margin y:y - (lineSpacing//2)
  2153             gc fillRectangleX:margin y:y - (lineSpacing//2)
  2155                           width:(width - (2 * margin)) 
  2154                           width:(width - (2 * margin)) 
  2156                          height:fontHeight.
  2155                          height:fontHeight.
  2157         ].
  2156         ].
  2158 
  2157 
  2159         dObj := selectedVisualBlock value:self value:listLine.
  2158         dObj := selectedVisualBlock value:self value:listLine.
  2160         self paint:fg on:bg.
  2159         gc paint:fg on:bg.
  2161         dObj displayOn:self x:(textStartLeft-viewOrigin x) y:y + gc font ascent opaque:true.
  2160         dObj displayOn:self x:(textStartLeft-viewOrigin x) y:y + gc font ascent opaque:true.
  2162         
  2161         
  2163         self drawSelectionHighlightFrameForItemAtY:y with:fg.
  2162         self drawSelectionHighlightFrameForItemAtY:y with:fg.
  2164         ^ self.
  2163         ^ self.
  2165     ].
  2164     ].
  2166 
  2165 
  2167     strikeOut ifTrue:[
  2166     strikeOut ifTrue:[
  2168         self drawVisibleLine:visLineNr with:fgColor and:bgColor.
  2167         self drawVisibleLine:visLineNr with:fgColor and:bgColor.
  2169 
  2168 
  2170         self paint:fgColor.
  2169         gc paint:fgColor.
  2171         y := y + (fontHeight // 2).
  2170         y := y + (fontHeight // 2).
  2172         self displayLineFromX:0 y:y toX:width y:y.
  2171         gc displayLineFromX:0 y:y toX:width y:y.
  2173         ^ self
  2172         ^ self
  2174     ].
  2173     ].
  2175 
  2174 
  2176     "/ kludge:
  2175     "/ kludge:
  2177     "/ care for text objects with a color
  2176     "/ care for text objects with a color
  3476 
  3475 
  3477         visualBlock notNil ifTrue:[
  3476         visualBlock notNil ifTrue:[
  3478             y := self yOfVisibleLine:visLineNr.
  3477             y := self yOfVisibleLine:visLineNr.
  3479 
  3478 
  3480             backgroundAlreadyClearedColor == bg ifFalse:[
  3479             backgroundAlreadyClearedColor == bg ifFalse:[
  3481                 self paint:bg.
  3480                 gc paint:bg.
  3482                 self fillRectangleX:margin y:y - (lineSpacing//2)
  3481                 gc fillRectangleX:margin y:y - (lineSpacing//2)
  3483                               width:(width - (2 * margin)) 
  3482                               width:(width - (2 * margin)) 
  3484                              height:fontHeight.
  3483                              height:fontHeight.
  3485             ].
  3484             ].
  3486 
  3485 
  3487             dObj := visualBlock value:self value:listLine.
  3486             dObj := visualBlock value:self value:listLine.
  3488             self paint:fg on:bg.
  3487             gc paint:fg on:bg.
  3489             dObj displayOn:self x:(textStartLeft - viewOrigin) x y:y + gc font ascent opaque:true.
  3488             dObj displayOn:self x:(textStartLeft - viewOrigin) x y:y + gc font ascent opaque:true.
  3490             ^ self
  3489             ^ self
  3491         ].
  3490         ].
  3492 
  3491 
  3493         listAttributes notNil ifTrue:[
  3492         listAttributes notNil ifTrue:[