3375 !UIPainter::TreeView methodsFor:'canvas selection'! |
3373 !UIPainter::TreeView methodsFor:'canvas selection'! |
3376 |
3374 |
3377 cvsSelection:aSelection |
3375 cvsSelection:aSelection |
3378 "canvas changed its selection |
3376 "canvas changed its selection |
3379 " |
3377 " |
3380 |sel list| |
3378 |sel list size| |
3381 |
3379 |
3382 ( aSelection isNil |
3380 ((sel := aSelection) isNil or:[sel isCollection]) ifFalse:[ |
3383 or:[(aSelection isCollection and:[aSelection isEmpty])] |
3381 sel := Array with:sel |
3384 ) ifTrue:[ |
3382 ]. |
3385 ^ self cvsEventsDisabledDo:[ self selection:sel ] |
3383 |
3386 ]. |
3384 (size := sel size) ~~ 0 ifTrue:[ |
3387 list := OrderedCollection new. |
3385 list := OrderedCollection new:size. |
3388 |
3386 |
3389 aSelection isCollection ifTrue:[ |
3387 sel do:[:aView||item| |
3390 aSelection notNil ifTrue:[sel := aSelection] |
3388 (item := self itemOfView:aView) notNil ifTrue:[ |
3391 ] ifFalse:[ |
3389 list add:item. |
3392 sel := Array with:aSelection |
3390 model doMakeVisible:item. |
3393 ]. |
3391 ] |
3394 |
3392 ]. |
3395 list := OrderedCollection new:(sel size). |
3393 sel := list collect:[:anItem| self indexOfNode:anItem ]. |
3396 self setSelection:nil. |
3394 ]. |
3397 |
|
3398 sel do:[:aView||item| |
|
3399 (item := self itemOfView:aView) notNil ifTrue:[ |
|
3400 list add:item. |
|
3401 model doMakeVisible:item. |
|
3402 ] |
|
3403 ]. |
|
3404 sel := list collect:[:anItem| self indexOfNode:anItem ]. |
|
3405 self cvsEventsDisabledDo:[ self selection:sel ]. |
3395 self cvsEventsDisabledDo:[ self selection:sel ]. |
3406 |
3396 |
3407 |
3397 |
3408 |
3398 |
3409 |
3399 |
3559 self selectedNode == model root ifFalse:[ |
3549 self selectedNode == model root ifFalse:[ |
3560 super doubleClicked |
3550 super doubleClicked |
3561 ] |
3551 ] |
3562 |
3552 |
3563 |
3553 |
|
3554 ! |
|
3555 |
|
3556 drawLabelIndex:anIndex atX:textX y:yCenter |
|
3557 "draws a tiny rectangle for indicating the master node (first selected node)" |
|
3558 |
|
3559 |dX| |
|
3560 |
|
3561 super drawLabelIndex:anIndex atX:textX y:yCenter. |
|
3562 |
|
3563 ((selection size > 1) and: [selection first == anIndex]) ifTrue:[ |
|
3564 dX := textInset - 1. |
|
3565 self paint:self application painter handleMasterColor. |
|
3566 self fillRectangleX:(textX - dX - 2) |
|
3567 y:yCenter + 2 - (fontHeight // 2) |
|
3568 width:dX |
|
3569 height:dX |
|
3570 ] |
3564 ! ! |
3571 ! ! |
3565 |
3572 |
3566 !UIPainter::TreeView methodsFor:'initialization'! |
3573 !UIPainter::TreeView methodsFor:'initialization'! |
3567 |
3574 |
3568 initialize |
3575 initialize |
3585 |
3592 |
3586 self model labelAction: |
3593 self model labelAction: |
3587 [:aNode| |
3594 [:aNode| |
3588 |spec| |
3595 |spec| |
3589 (spec := aNode contents spec) notNil |
3596 (spec := aNode contents spec) notNil |
3590 ifTrue: |
3597 ifTrue: [self nameForSpecInList:spec] |
3591 [ |
3598 ifFalse:[aNode name] |
3592 ((selection size > 1) and: [(listOfNodes at:selection first) == aNode]) |
|
3593 ifTrue: [(Text string:'M' foregroundColor:Color black backgroundColor:Color red), ' ',(self nameForSpecInList:spec)] |
|
3594 ifFalse:[self nameForSpecInList:spec] |
|
3595 ] |
|
3596 ifFalse: |
|
3597 [ |
|
3598 aNode name |
|
3599 ] |
|
3600 ] |
3599 ] |
3601 ! ! |
3600 ! ! |
3602 |
3601 |
3603 !UIPainter::TreeView methodsFor:'private'! |
3602 !UIPainter::TreeView methodsFor:'private'! |
3604 |
3603 |