SelectionInListModelView.st
changeset 4318 ee2c154ee065
parent 4273 d56dfb04df83
child 4483 b3f21fdb636c
equal deleted inserted replaced
4317:4c2fd0c98fcb 4318:ee2c154ee065
  1065      at a lineNr.
  1065      at a lineNr.
  1066     "
  1066     "
  1067     |item xMax xLftDmg xRgtDmg x0 x1 y0 y1 hL wL|
  1067     |item xMax xLftDmg xRgtDmg x0 x1 y0 y1 hL wL|
  1068 
  1068 
  1069     (strikeOut or:[highlightMode isNil]) ifTrue:[
  1069     (strikeOut or:[highlightMode isNil]) ifTrue:[
  1070 	^ self
  1070         ^ self
  1071     ].
  1071     ].
  1072     editorView notNil ifTrue:[
  1072     editorView notNil ifTrue:[
  1073 	"/ there is an open editor; do not redraw selected
  1073         "/ there is an open editor; do not redraw selected
  1074 	^ self
  1074         ^ self
  1075     ].
  1075     ].
  1076 
  1076 
  1077     (    highlightMode == #line
  1077     (    highlightMode == #line
  1078      or:[highlightMode == #label
  1078      or:[highlightMode == #label
  1079      or:[highlightMode == #dropMode]]
  1079      or:[highlightMode == #dropMode]]
  1080     ) ifFalse:[
  1080     ) ifFalse:[
  1081 	"/ highlightMode not supported
  1081         "/ highlightMode not supported
  1082 	^ self
  1082         ^ self
  1083     ].
  1083     ].
  1084     (item := self at:lnNr ifAbsent:nil) isNil ifTrue:[
  1084     (item := self at:lnNr ifAbsent:nil) isNil ifTrue:[
  1085 	"/ list might change during drawing; item no longer visible
  1085         "/ list might change during drawing; item no longer visible
  1086 	^ self
  1086         ^ self
  1087     ].
  1087     ].
  1088     xMax := x + w.
  1088     xMax := x + w.
  1089 
  1089 
  1090     "/ CLEAR THE BACKGROUND
  1090     "/ CLEAR THE BACKGROUND
  1091 
  1091 
  1092     y0 := self yVisibleOfLine:lnNr.
  1092     y0 := self yVisibleOfLine:lnNr.
  1093     y1 := self yVisibleOfLine:(lnNr + 1).
  1093     y1 := self yVisibleOfLine:(lnNr + 1).
  1094     hL := y1 - y0.
  1094     hL := y1 - y0.
  1095 
  1095 
  1096     highlightMode == #line ifTrue:[
  1096     highlightMode == #line ifTrue:[
  1097 	x0 := x.
  1097         x0 := x.
  1098 	x1 := xMax.
  1098         x1 := xMax.
  1099     ] ifFalse:[ "/ is #label or #rectangle
  1099     ] ifFalse:[ "/ is #label or #rectangle
  1100 	x0 := (self xVisibleOfItem:item) - (textStartLeft // 2).
  1100         x0 := (self xVisibleOfItem:item) - (textStartLeft // 2).
  1101 	x0 >= xMax ifTrue:[ ^ self ].
  1101         x0 >= xMax ifTrue:[ ^ self ].
  1102 
  1102 
  1103 	x1 := x0 + (listRenderer widthFor:item) + textStartLeft + 1.
  1103         x1 := x0 + (listRenderer widthFor:item) + textStartLeft + 1.
  1104 	x1 < x ifTrue:[ ^ self ].
  1104         x1 < x ifTrue:[ ^ self ].
  1105     ].
  1105     ].
  1106     xLftDmg := x0 max:x.
  1106     xLftDmg := x0 max:x.
  1107     xRgtDmg := x1 min:xMax.
  1107     xRgtDmg := x1 min:xMax.
  1108     xRgtDmg > xLftDmg ifFalse:[^ self].
  1108     xRgtDmg > xLftDmg ifFalse:[^ self].
  1109 
  1109 
  1110     (highlightMode == #dropMode or:[self hasFocus not]) ifTrue:[
  1110     (highlightMode == #dropMode or:[self hasFocus not]) ifTrue:[
  1111 	self paint:hilightBgColorNoFocus.
  1111         self paint:hilightBgColorNoFocus.
  1112     ] ifFalse:[
  1112     ] ifFalse:[
  1113 	self paint:hilightBgColor.
  1113         self paint:hilightBgColor.
  1114     ].
  1114     ].
  1115     self fillRectangleX:xLftDmg y:y0 width:(xRgtDmg - xLftDmg) height:hL.
  1115     self fillRectangleX:xLftDmg y:y0 width:(xRgtDmg - xLftDmg) height:hL.
  1116     wL := x1 - x0.
  1116     wL := x1 - x0.
  1117 
  1117 
  1118     "/ DRAW THE FRAME
  1118     "/ DRAW THE FRAME
  1119 
  1119 
  1120     hilightFrameColor notNil ifTrue:[
  1120     hilightFrameColor notNil ifTrue:[
  1121 	hilightLevel == 0 ifTrue:[
  1121         hilightLevel == 0 ifTrue:[
  1122 	    self paint:hilightFrameColor.
  1122             self paint:hilightFrameColor.
  1123 
  1123 
  1124 	    highlightMode == #line ifTrue:[
  1124             highlightMode == #line ifTrue:[
  1125 		self displayLineFromX:x0 y:y0 toX:x1 y:y0.
  1125                 self displayLineFromX:x0 y:y0 toX:x1 y:y0.
  1126 		y1 := y0 + hL - 1.
  1126                 y1 := y0 + hL - 1.
  1127 		self displayLineFromX:x0 y:y1 toX:x1 y:y1.
  1127                 self displayLineFromX:x0 y:y1 toX:x1 y:y1.
  1128 	    ] ifFalse:[
  1128             ] ifFalse:[
  1129 		self displayRectangleX:x0 y:y0 width:wL height:hL
  1129                 self displayRectangleX:x0 y:y0 width:wL height:hL
  1130 	    ].
  1130             ].
  1131 	    ^ self.
  1131             ^ self.
  1132 	]
  1132         ]
  1133     ] ifFalse:[
  1133     ] ifFalse:[
  1134 	hilightStyle == #motif ifTrue:[
  1134         hilightStyle == #motif ifTrue:[
  1135 	    self paint:bgColor.
  1135             self paint:bgColor.
  1136 	    y1 := y0 + 1.
  1136             y1 := y0 + 1.
  1137 	    highlightMode == #line ifTrue:[
  1137             highlightMode == #line ifTrue:[
  1138 		self displayLineFromX:x0 y:y1 toX:x1 y:y1.
  1138                 self displayLineFromX:x0 y:y1 toX:x1 y:y1.
  1139 		y1 := y0 + hL - 2.
  1139                 y1 := y0 + hL - 2.
  1140 		self displayLineFromX:x0 y:y1 toX:x1 y:y1.
  1140                 self displayLineFromX:x0 y:y1 toX:x1 y:y1.
  1141 	    ] ifFalse:[
  1141             ] ifFalse:[
  1142 		self displayRectangleX:x0 + 1 y:y1 width:wL - 2 height:hL - 2
  1142                 self displayRectangleX:x0 + 1 y:y1 width:wL - 2 height:hL - 2
  1143 	    ]
  1143             ]
  1144 	].
  1144         ].
  1145 	hilightLevel == 0 ifTrue:[ ^ self ].
  1145         hilightLevel == 0 ifTrue:[ ^ self ].
  1146     ].
  1146     ].
  1147 
  1147 
  1148     "/ draw edge
  1148     "/ draw edge
  1149     highlightMode == #line ifTrue:[
  1149     highlightMode == #line ifTrue:[
  1150 	x0 := margin.
  1150         x0 := margin.
  1151 	wL := width - x0 - x0.
  1151         wL := width - margin - margin.
  1152     ].
  1152     ].
  1153     self drawEdgesForX:x0 y:y0 width:wL height:hL level:hilightLevel.
  1153     self drawEdgesForX:x0 y:y0 width:wL height:hL level:hilightLevel.
  1154 !
  1154 !
  1155 
  1155 
  1156 drawSelectionFrameFrom:start to:stop x:x y:y w:w
  1156 drawSelectionFrameFrom:start to:stop x:x y:y w:w
  2694 ! !
  2694 ! !
  2695 
  2695 
  2696 !SelectionInListModelView class methodsFor:'documentation'!
  2696 !SelectionInListModelView class methodsFor:'documentation'!
  2697 
  2697 
  2698 version_CVS
  2698 version_CVS
  2699     ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInListModelView.st,v 1.161 2013-07-13 20:31:53 cg Exp $'
  2699     ^ '$Header: /cvs/stx/stx/libwidg2/SelectionInListModelView.st,v 1.162 2013-08-07 07:27:56 cg Exp $'
  2700 ! !
  2700 ! !
  2701 
  2701