429 |
429 |
430 elementChangedSize:aView |
430 elementChangedSize:aView |
431 "some element has changed its size; collect them during selectionHiddenLevel |
431 "some element has changed its size; collect them during selectionHiddenLevel |
432 is on |
432 is on |
433 " |
433 " |
434 selectionHiddenLevel ~~ 0 ifTrue:[ |
434 |spv| |
435 setOfSuperViewsSizeChanged add:aView superView |
435 |
436 ] ifFalse:[ |
436 spv := self findContainerOfView:aView. |
437 aView superView sizeChanged:nil |
437 |
438 ] |
438 selectionHiddenLevel ~~ 0 ifTrue:[setOfSuperViewsSizeChanged add:spv] |
|
439 ifFalse:[spv sizeChanged:nil] |
439 ! |
440 ! |
440 |
441 |
441 exposeX:x y:y width:w height:h |
442 exposeX:x y:y width:w height:h |
442 "handle an expose event from device; redraw selection |
443 "handle an expose event from device; redraw selection |
443 " |
444 " |
682 ! |
691 ! |
683 |
692 |
684 startSelectOrMove:aPoint |
693 startSelectOrMove:aPoint |
685 "a button is pressed at a point; start moving or selection |
694 "a button is pressed at a point; start moving or selection |
686 " |
695 " |
687 |aView b| |
696 |aView b v| |
688 |
697 |
689 self enabled ifFalse:[^ self]. |
698 self enabled ifFalse:[^ self]. |
690 |
699 |
691 aView := self singleSelection. |
700 aView := self singleSelection. |
692 |
701 |
693 aView notNil ifTrue:[ |
702 aView notNil ifTrue:[ |
694 (aView superView specClass canResizeSubComponents) ifTrue:[ |
703 v := self findContainerOfView:aView. |
|
704 |
|
705 v specClass canResizeSubComponents ifTrue:[ |
695 b := self whichHandleOf:aView isHitBy:aPoint. |
706 b := self whichHandleOf:aView isHitBy:aPoint. |
696 |
707 |
697 (b notNil and:[b ~~ #view]) ifTrue:[ |
708 (b notNil and:[b ~~ #view]) ifTrue:[ |
698 ^ self startResizeBorder:b of:aView. |
709 ^ self startResizeBorder:b of:aView. |
699 ] |
710 ] |
700 ]. |
711 ]. |
701 |
712 |
702 (self sensor ctrlDown and:[self canMove:aView]) ifFalse:[ |
713 (self sensor ctrlDown and:[self canChangeLayoutOfView:aView]) ifFalse:[ |
703 aView := nil |
714 aView := nil |
704 ] |
715 ] |
705 ]. |
716 ]. |
706 |
717 |
707 aView isNil ifTrue:[ |
718 aView isNil ifTrue:[ |
708 (aView := self findObjectAt:aPoint) isNil ifTrue:[ |
719 (aView := self findObjectAt:aPoint) isNil ifTrue:[ |
709 ^ self select:nil |
720 ^ self select:nil |
710 ]. |
721 ]. |
711 |
722 |
712 (self canMove:aView) ifFalse:[ |
723 (self canChangeLayoutOfView:aView) ifFalse:[ |
713 ^ self select:aView |
724 ^ self select:aView |
714 ] |
725 ] |
715 ]. |
726 ]. |
716 |
727 |
717 (self isSelected:aView) ifFalse:[ |
728 (self isSelected:aView) ifFalse:[ |
1259 ] |
1262 ] |
1260 ! ! |
1263 ! ! |
1261 |
1264 |
1262 !UIObjectView methodsFor:'testing'! |
1265 !UIObjectView methodsFor:'testing'! |
1263 |
1266 |
1264 canMove:something |
|
1265 "returns always true; all contained views can be moved |
|
1266 " |
|
1267 |sv| |
|
1268 |
|
1269 something notNil ifTrue:[ |
|
1270 self forEach:something do:[:v| |
|
1271 sv ~~ v superView ifTrue:[ |
|
1272 (sv notNil or:[v superView specClass isLayoutContainer]) ifTrue:[ |
|
1273 ^ false |
|
1274 ]. |
|
1275 sv := v superView |
|
1276 ] |
|
1277 ]. |
|
1278 ^ true |
|
1279 ]. |
|
1280 ^ false |
|
1281 |
|
1282 ! |
|
1283 |
|
1284 hasSelection |
1267 hasSelection |
1285 "returns true if any selected object exists |
1268 "returns true if any widget is selected |
1286 " |
1269 " |
1287 ^ self numberOfSelections ~~ 0 |
1270 ^ self numberOfSelections ~~ 0 |
1288 |
1271 |
|
1272 ! |
|
1273 |
|
1274 hasSingleSelection |
|
1275 "returns true if one widget is selected |
|
1276 " |
|
1277 ^ self numberOfSelections == 1 |
|
1278 |
|
1279 ! |
|
1280 |
|
1281 hasUndoHistory |
|
1282 "returns true if undos exists |
|
1283 " |
|
1284 ^ undoHistory isEmpty not |
1289 ! |
1285 ! |
1290 |
1286 |
1291 isModified |
1287 isModified |
1292 "returns true if painter is modified |
1288 "returns true if painter is modified |
1293 " |
1289 " |
1634 (sel := self moveableSelection) notNil ifTrue:[ |
1630 (sel := self moveableSelection) notNil ifTrue:[ |
1635 self withSelectionHiddenDo:[ |
1631 self withSelectionHiddenDo:[ |
1636 view := self singleSelection. |
1632 view := self singleSelection. |
1637 |
1633 |
1638 view notNil ifTrue:[ |
1634 view notNil ifTrue:[ |
1639 view := view superView. |
1635 |
|
1636 view := self findContainerOfView:view. |
1640 center := view computeExtent |
1637 center := view computeExtent |
1641 ] ifFalse:[ |
1638 ] ifFalse:[ |
1642 view := sel first. |
1639 view := sel first. |
1643 center := view computeCorner + view computeOrigin. |
1640 center := view computeCorner + view computeOrigin. |
1644 ]. |
1641 ]. |
1670 (sel := self moveableSelection) notNil ifTrue:[ |
1667 (sel := self moveableSelection) notNil ifTrue:[ |
1671 self withSelectionHiddenDo:[ |
1668 self withSelectionHiddenDo:[ |
1672 view := self singleSelection. |
1669 view := self singleSelection. |
1673 |
1670 |
1674 view notNil ifTrue:[ |
1671 view notNil ifTrue:[ |
1675 view := view superView. |
1672 view := self findContainerOfView:view. |
1676 center := view computeExtent |
1673 center := view computeExtent |
1677 ] ifFalse:[ |
1674 ] ifFalse:[ |
1678 view := sel first. |
1675 view := sel first. |
1679 center := view computeCorner + view computeOrigin. |
1676 center := view computeCorner + view computeOrigin. |
1680 ]. |
1677 ]. |
1870 self withSelectionHiddenDo:[ |
1867 self withSelectionHiddenDo:[ |
1871 max := 0. |
1868 max := 0. |
1872 |
1869 |
1873 self selectionDo:[:aView | |
1870 self selectionDo:[:aView | |
1874 superview isNil ifTrue:[ |
1871 superview isNil ifTrue:[ |
1875 superview := aView superView |
1872 superview := self findContainerOfView:aView |
1876 ] ifFalse:[ |
1873 ] ifFalse:[ |
1877 (aView superView == superview) ifFalse:[ |
1874 (self findContainerOfView:aView) == superview ifFalse:[ |
1878 ^ self notify:'views must have same superview'. |
1875 ^ self notify:'views must have same superview'. |
1879 ] |
1876 ] |
1880 ]. |
1877 ]. |
1881 val := aOneArgBlockXorY value:(aView computeOrigin). |
1878 val := aOneArgBlockXorY value:(aView computeOrigin). |
1882 |
1879 |