equal
deleted
inserted
replaced
451 self selectionDo:[:aComponent | |
451 self selectionDo:[:aComponent | |
452 aComponent withAllSubViewsDo:[:v | |
452 aComponent withAllSubViewsDo:[:v | |
453 self sensor flushExposeEventsFor:v. |
453 self sensor flushExposeEventsFor:v. |
454 v exposeX:0 y:0 width:9999 height:9999. |
454 v exposeX:0 y:0 width:9999 height:9999. |
455 ]. |
455 ]. |
456 |
|
457 self showSelected:aComponent |
456 self showSelected:aComponent |
458 ] |
457 ] |
459 ] |
458 ] |
460 |
459 |
461 ! |
460 ! |
621 movedObject := movedObject first |
620 movedObject := movedObject first |
622 ]. |
621 ]. |
623 self setSelection:movedObject withRedraw:true. |
622 self setSelection:movedObject withRedraw:true. |
624 movedObject := nil. |
623 movedObject := nil. |
625 self setDefaultActions. |
624 self setDefaultActions. |
626 self changed:#layout. |
625 self layoutChanged. |
627 ]. |
626 ]. |
628 ! |
627 ! |
629 |
628 |
630 moveObject:anObject to:aPoint |
629 moveObject:anObject to:aPoint |
631 "move anObject to newOrigin, aPoint |
630 "move anObject to newOrigin, aPoint |
795 [self sensor hasExposeEventFor:nil] whileTrue:[ |
794 [self sensor hasExposeEventFor:nil] whileTrue:[ |
796 self windowGroup processExposeEvents |
795 self windowGroup processExposeEvents |
797 ]. |
796 ]. |
798 |
797 |
799 self setSelection:object withRedraw:true. |
798 self setSelection:object withRedraw:true. |
800 self changed:#layout. |
799 self layoutChanged. |
801 ! |
800 ! |
802 |
801 |
803 startResizeBorder:b of:selection |
802 startResizeBorder:b of:selection |
804 "resize selected view |
803 "resize selected view |
805 " |
804 " |
1133 |
1132 |
1134 (size ~~ 0 or:[coll isNil]) ifTrue:[^ size]. |
1133 (size ~~ 0 or:[coll isNil]) ifTrue:[^ size]. |
1135 ^ 1 |
1134 ^ 1 |
1136 ! |
1135 ! |
1137 |
1136 |
1138 select:something |
|
1139 "change selection to something |
|
1140 " |
|
1141 (self enabled and:[something ~= self selection]) ifTrue:[ |
|
1142 self setSelection:something withRedraw:true. |
|
1143 self selectionChanged |
|
1144 ] |
|
1145 |
|
1146 ! |
|
1147 |
|
1148 selection:something |
1137 selection:something |
1149 "change selection to something |
1138 "change selection to something |
1150 " |
1139 " |
1151 self select:something |
1140 self select:something |
1152 ! |
|
1153 |
|
1154 selectionChanged |
|
1155 "called whenever the selection changed |
|
1156 " |
|
1157 self subclassResponsibility |
|
1158 |
|
1159 ! |
1141 ! |
1160 |
1142 |
1161 selectionDo:aBlock |
1143 selectionDo:aBlock |
1162 "apply block to every selected object |
1144 "apply block to every selected object |
1163 " |
1145 " |
1249 |
1231 |
1250 ! ! |
1232 ! ! |
1251 |
1233 |
1252 !UIObjectView methodsFor:'selections basic'! |
1234 !UIObjectView methodsFor:'selections basic'! |
1253 |
1235 |
1254 addToSelection:anObject |
|
1255 "add an object to the selection |
|
1256 " |
|
1257 (self enabled and:[(self isSelected:anObject) not]) ifTrue:[ |
|
1258 selection isCollection ifFalse:[ |
|
1259 selection isNil ifTrue:[ |
|
1260 selection := anObject |
|
1261 ] ifFalse:[ |
|
1262 selection := OrderedCollection with:selection with:anObject |
|
1263 ] |
|
1264 ] ifTrue:[ |
|
1265 selection add:anObject |
|
1266 ]. |
|
1267 self showSelected:anObject. |
|
1268 self selectionChanged. |
|
1269 ] |
|
1270 ! |
|
1271 |
|
1272 removeFromSelection:anObject |
|
1273 "remove an object from the selection |
|
1274 " |
|
1275 (self isSelected:anObject) ifTrue:[ |
|
1276 self showUnselected:anObject. |
|
1277 |
|
1278 selection size > 1 ifTrue:[ |
|
1279 selection remove:anObject ifAbsent:nil. |
|
1280 self showSelection. |
|
1281 ] ifFalse:[ |
|
1282 selection := nil |
|
1283 ]. |
|
1284 self selectionChanged. |
|
1285 ] |
|
1286 ! |
|
1287 |
|
1288 selection |
1236 selection |
1289 "returns the current selection |
1237 "returns the current selection |
1290 " |
1238 " |
1291 ^ selection |
1239 ^ selection |
1292 |
1240 |
1294 ! |
1242 ! |
1295 |
1243 |
1296 setSelection:aNewSelection withRedraw:doRedraw |
1244 setSelection:aNewSelection withRedraw:doRedraw |
1297 "set a new selection without change notifications |
1245 "set a new selection without change notifications |
1298 " |
1246 " |
|
1247 |sel| |
|
1248 |
|
1249 (sel := aNewSelection) == self ifTrue:[ |
|
1250 sel := nil |
|
1251 ]. |
|
1252 |
1299 doRedraw ifTrue:[ |
1253 doRedraw ifTrue:[ |
1300 self hideSelection. |
1254 self hideSelection. |
1301 selection := aNewSelection. |
1255 selection := sel. |
1302 self showSelection |
1256 self showSelection |
1303 ] ifFalse:[ |
1257 ] ifFalse:[ |
1304 selection := aNewSelection |
1258 selection := sel |
1305 ] |
1259 ] |
1306 ! ! |
1260 ! ! |
1307 |
1261 |
1308 !UIObjectView methodsFor:'testing'! |
1262 !UIObjectView methodsFor:'testing'! |
1309 |
1263 |
1325 ]. |
1279 ]. |
1326 ^ false |
1280 ^ false |
1327 |
1281 |
1328 ! |
1282 ! |
1329 |
1283 |
1330 canPaste:something |
|
1331 "returns true if something could be paste |
|
1332 " |
|
1333 something notNil ifTrue:[ |
|
1334 something isCollection ifTrue:[ |
|
1335 something notEmpty ifTrue:[ |
|
1336 ^ (something at:1) isKindOf:UISpecification |
|
1337 ] |
|
1338 ] ifFalse:[ |
|
1339 ^ something isKindOf:UISpecification |
|
1340 ] |
|
1341 ]. |
|
1342 ^ false |
|
1343 |
|
1344 ! |
|
1345 |
|
1346 canPasteInto:something |
|
1347 "can paste into something ? |
|
1348 " |
|
1349 |
|
1350 |theView theSpec| |
|
1351 |
|
1352 something notNil ifTrue:[ |
|
1353 something isCollection ifFalse:[ |
|
1354 theView := something |
|
1355 ] ifTrue:[ |
|
1356 something size == 1 ifTrue:[ |
|
1357 theView := (something at:1) |
|
1358 ] |
|
1359 ]. |
|
1360 theView notNil ifTrue:[ |
|
1361 theSpec := self specFor:theView. |
|
1362 theSpec isNil ifTrue:[ |
|
1363 ^ theView specClass supportsSubComponents |
|
1364 ]. |
|
1365 ^ theSpec class supportsSubComponents |
|
1366 ] |
|
1367 ]. |
|
1368 ^ false |
|
1369 |
|
1370 "Modified: 8.4.1997 / 01:19:14 / cg" |
|
1371 ! |
|
1372 |
|
1373 hasSelection |
1284 hasSelection |
1374 "returns true if any selected object exists |
1285 "returns true if any selected object exists |
1375 " |
1286 " |
1376 ^ self numberOfSelections ~~ 0 |
1287 ^ self numberOfSelections ~~ 0 |
1377 |
1288 |
1556 aOneArgBlock value:aView. |
1467 aOneArgBlock value:aView. |
1557 self elementChangedSize:aView. |
1468 self elementChangedSize:aView. |
1558 ] |
1469 ] |
1559 ] |
1470 ] |
1560 ]. |
1471 ]. |
1561 self changed:#layout |
1472 self layoutChanged |
1562 |
1473 |
1563 ! ! |
1474 ! ! |
1564 |
1475 |
1565 !UIObjectView methodsFor:'user actions - move'! |
1476 !UIObjectView methodsFor:'user actions - move'! |
1566 |
1477 |
1581 |
1492 |
1582 [ |
1493 [ |
1583 self selectionDo:[:aView| aOneArgBlock value:aView ]. |
1494 self selectionDo:[:aView| aOneArgBlock value:aView ]. |
1584 Delay waitForSeconds:tm. |
1495 Delay waitForSeconds:tm. |
1585 tm := 0.02. |
1496 tm := 0.02. |
1586 self changed:#layout. |
1497 self layoutChanged. |
1587 sensor leftButtonPressed. |
1498 sensor leftButtonPressed. |
1588 ] whileTrue. |
1499 ] whileTrue. |
1589 |
1500 |
1590 "/ handle any expose events (for subcomponents) before |
1501 "/ handle any expose events (for subcomponents) before |
1591 "/ redrawing the handles. |
1502 "/ redrawing the handles. |
1705 aLayout bottomOffset:0. |
1616 aLayout bottomOffset:0. |
1706 aLayout bottomFraction:1.0 |
1617 aLayout bottomFraction:1.0 |
1707 ] |
1618 ] |
1708 ] |
1619 ] |
1709 ]. |
1620 ]. |
1710 self changed:#layout |
1621 self layoutChanged |
1711 ] |
1622 ] |
1712 |
1623 |
1713 |
1624 |
1714 |
1625 |
1715 ! |
1626 ! |
1741 delta := newX - oldX. |
1652 delta := newX - oldX. |
1742 |
1653 |
1743 self shiftLayout:v left:delta right:delta |
1654 self shiftLayout:v left:delta right:delta |
1744 ] |
1655 ] |
1745 ]. |
1656 ]. |
1746 self changed:#layout |
1657 self layoutChanged |
1747 ] |
1658 ] |
1748 |
1659 |
1749 |
1660 |
1750 |
1661 |
1751 ! |
1662 ! |
1777 delta := newY - oldY. |
1688 delta := newY - oldY. |
1778 |
1689 |
1779 self shiftLayout:v top:delta bottom:delta |
1690 self shiftLayout:v top:delta bottom:delta |
1780 ] |
1691 ] |
1781 ]. |
1692 ]. |
1782 self changed:#layout |
1693 self layoutChanged |
1783 ] |
1694 ] |
1784 ! |
1695 ! |
1785 |
1696 |
1786 alignSelectionLeft |
1697 alignSelectionLeft |
1787 "align selection to the left of the first object in the selection; in case |
1698 "align selection to the left of the first object in the selection; in case |
1804 aLayout leftOffset:0. |
1715 aLayout leftOffset:0. |
1805 aLayout leftFraction:0.0. |
1716 aLayout leftFraction:0.0. |
1806 ] |
1717 ] |
1807 ] |
1718 ] |
1808 ]. |
1719 ]. |
1809 self changed:#layout |
1720 self layoutChanged |
1810 ] |
1721 ] |
1811 ! |
1722 ! |
1812 |
1723 |
1813 alignSelectionLeftAndRight |
1724 alignSelectionLeftAndRight |
1814 "align selection to the left/right of the first object in the selection; in case |
1725 "align selection to the left/right of the first object in the selection; in case |
1844 aLayout rightOffset:0. |
1755 aLayout rightOffset:0. |
1845 aLayout rightFraction:1.0. |
1756 aLayout rightFraction:1.0. |
1846 ] |
1757 ] |
1847 ] |
1758 ] |
1848 ]. |
1759 ]. |
1849 self changed:#layout |
1760 self layoutChanged |
1850 ]. |
1761 ]. |
1851 |
1762 |
1852 ! |
1763 ! |
1853 |
1764 |
1854 alignSelectionRight |
1765 alignSelectionRight |
1872 aLayout rightOffset:0. |
1783 aLayout rightOffset:0. |
1873 aLayout rightFraction:1.0. |
1784 aLayout rightFraction:1.0. |
1874 ] |
1785 ] |
1875 ] |
1786 ] |
1876 ]. |
1787 ]. |
1877 self changed:#layout |
1788 self layoutChanged |
1878 ] |
1789 ] |
1879 ! |
1790 ! |
1880 |
1791 |
1881 alignSelectionTop |
1792 alignSelectionTop |
1882 "align selection to the top of the first object in the selection; in case |
1793 "align selection to the top of the first object in the selection; in case |
1899 aLayout topOffset:0. |
1810 aLayout topOffset:0. |
1900 aLayout topFraction:0.0. |
1811 aLayout topFraction:0.0. |
1901 ] |
1812 ] |
1902 ] |
1813 ] |
1903 ]. |
1814 ]. |
1904 self changed:#layout |
1815 self layoutChanged |
1905 ] |
1816 ] |
1906 |
1817 |
1907 ! |
1818 ! |
1908 |
1819 |
1909 alignSelectionTopAndBottom |
1820 alignSelectionTopAndBottom |
1940 aLayout bottomOffset:0. |
1851 aLayout bottomOffset:0. |
1941 aLayout bottomFraction:1.0. |
1852 aLayout bottomFraction:1.0. |
1942 ] |
1853 ] |
1943 ] |
1854 ] |
1944 ]. |
1855 ]. |
1945 self changed:#layout |
1856 self layoutChanged |
1946 ] |
1857 ] |
1947 ! |
1858 ! |
1948 |
1859 |
1949 centerSelection:aOneArgBlockXorY orientation:orientation |
1860 centerSelection:aOneArgBlockXorY orientation:orientation |
1950 "center selection horizontal or vertical dependant on the block result( x or y). |
1861 "center selection horizontal or vertical dependant on the block result( x or y). |
1991 ] ifFalse:[ |
1902 ] ifFalse:[ |
1992 self shiftLayout:v left:delta right:delta |
1903 self shiftLayout:v left:delta right:delta |
1993 ] |
1904 ] |
1994 ] |
1905 ] |
1995 ]. |
1906 ]. |
1996 self changed:#layout |
1907 self layoutChanged |
1997 ] |
1908 ] |
1998 |
1909 |
1999 |
1910 |
2000 ! |
1911 ! |
2001 |
1912 |
2069 delta := min - aView computeOrigin x. |
1980 delta := min - aView computeOrigin x. |
2070 self shiftLayout:aView left:delta right:delta. |
1981 self shiftLayout:aView left:delta right:delta. |
2071 min := min + aView computeExtent x + space |
1982 min := min + aView computeExtent x + space |
2072 ] |
1983 ] |
2073 ]. |
1984 ]. |
2074 self changed:#layout |
1985 self layoutChanged |
2075 |
1986 |
2076 ! |
1987 ! |
2077 |
1988 |
2078 spreadSelectionVer |
1989 spreadSelectionVer |
2079 "spread multiple selection vertical |
1990 "spread multiple selection vertical |
2112 delta := min - aView computeOrigin y. |
2023 delta := min - aView computeOrigin y. |
2113 self shiftLayout:aView top:delta bottom:delta. |
2024 self shiftLayout:aView top:delta bottom:delta. |
2114 min := min + aView height + space |
2025 min := min + aView height + space |
2115 ] |
2026 ] |
2116 ]. |
2027 ]. |
2117 self changed:#layout |
2028 self layoutChanged |
2118 ! ! |
2029 ! ! |
2119 |
2030 |
2120 !UIObjectView methodsFor:'user actions - undo history'! |
2031 !UIObjectView methodsFor:'user actions - undo history'! |
2121 |
2032 |
2122 enableUndoHistory:aState |
2033 enableUndoHistory:aState |