#REFACTORING by cg
class: MenuPanel
changed: #drawItemsX:y:width:height: (send #clippingBounds: instead of #clippingRectangle:)
--- a/MenuPanel.st Fri Jan 20 18:51:06 2017 +0100
+++ b/MenuPanel.st Fri Jan 20 18:51:50 2017 +0100
@@ -2792,69 +2792,69 @@
isVertical := self verticalLayout.
isVertical ifTrue:[
- start := items findFirst:[:el| |l| l := el layout. l notNil and:[l bottom > y]].
- start == 0 ifTrue:[ ^ self ].
- y1 := y + h.
- stop := items findFirst:[:el| |l| l := el layout. l notNil and:[l top > y1] ]
- startingAt:(start + 1).
+ start := items findFirst:[:el| |l| l := el layout. l notNil and:[l bottom > y]].
+ start == 0 ifTrue:[ ^ self ].
+ y1 := y + h.
+ stop := items findFirst:[:el| |l| l := el layout. l notNil and:[l top > y1] ]
+ startingAt:(start + 1).
] ifFalse:[
- start := items findFirst:[:el| |l| l := el layout. l notNil and:[l right > x ]].
- start == 0 ifTrue:[ ^ self ].
- x1 := x + w.
- stop := items findFirst:[:el| |l| l := el layout .l notNil and:[l left > x1]]
- startingAt:(start + 1).
+ start := items findFirst:[:el| |l| l := el layout. l notNil and:[l right > x ]].
+ start == 0 ifTrue:[ ^ self ].
+ x1 := x + w.
+ stop := items findFirst:[:el| |l| l := el layout .l notNil and:[l left > x1]]
+ startingAt:(start + 1).
].
stop == 0 ifTrue:[stop := size] ifFalse:[stop := stop - 1].
(groupSizes size ~~ 0 and:[showGroupDivider]) ifTrue:[
- groupDivInset := self groupDividerSize // 2.
-
- groupDivInset ~~ 0 ifTrue:[
- (start ~~ 1 and:[self hasGroupDividerAt:(start-1)]) ifTrue:[
- start := start - 1
- ]
- ].
+ groupDivInset := self groupDividerSize // 2.
+
+ groupDivInset ~~ 0 ifTrue:[
+ (start ~~ 1 and:[self hasGroupDividerAt:(start-1)]) ifTrue:[
+ start := start - 1
+ ]
+ ].
] ifFalse:[
- groupDivInset := 0
+ groupDivInset := 0
].
prevClip := self clippingBoundsOrNil.
- self clippingRectangle:(Rectangle left:x top:y width:w height:h).
+ self clippingBounds:(Rectangle left:x top:y width:w height:h).
start to:stop do:[:i|
- item := items at:i.
- item draw.
-
- (groupDivInset ~~ 0 and:[i ~~ size and:[self hasGroupDividerAt:i]]) ifTrue:[
- layout := item layout.
-
- isVertical ifTrue:[
- x1 := layout left.
- x2 := layout right.
- y1 := layout bottom + groupDivInset.
- y2 := y1.
- ] ifFalse:[
- y1 := layout top.
- y2 := layout bottom.
- x1 := layout right + groupDivInset.
- x2 := x1.
- ].
- self paint:shadowColor.
- self displayLineFromX:x1 y:y1 toX:x2 y:y2.
- self paint:lightColor.
-
- isVertical ifTrue:[y1 := y1 + 1. y2 := y1 ]
- ifFalse:[x1 := x1 + 1. x2 := x1 ].
-
- self displayLineFromX:x1 y:y1 toX:x2 y:y2
- ].
- selection == item ifTrue:[
- self focusComesByTab ifTrue:[
- self drawFocusForItem:item.
- ].
- ].
- ].
- self clippingRectangle:prevClip.
+ item := items at:i.
+ item draw.
+
+ (groupDivInset ~~ 0 and:[i ~~ size and:[self hasGroupDividerAt:i]]) ifTrue:[
+ layout := item layout.
+
+ isVertical ifTrue:[
+ x1 := layout left.
+ x2 := layout right.
+ y1 := layout bottom + groupDivInset.
+ y2 := y1.
+ ] ifFalse:[
+ y1 := layout top.
+ y2 := layout bottom.
+ x1 := layout right + groupDivInset.
+ x2 := x1.
+ ].
+ self paint:shadowColor.
+ self displayLineFromX:x1 y:y1 toX:x2 y:y2.
+ self paint:lightColor.
+
+ isVertical ifTrue:[y1 := y1 + 1. y2 := y1 ]
+ ifFalse:[x1 := x1 + 1. x2 := x1 ].
+
+ self displayLineFromX:x1 y:y1 toX:x2 y:y2
+ ].
+ selection == item ifTrue:[
+ self focusComesByTab ifTrue:[
+ self drawFocusForItem:item.
+ ].
+ ].
+ ].
+ self clippingBounds:prevClip.
!
drawLabelEdgeFor:anItem selected:isSelected