124 !UIObjectView class methodsFor:'queries'! |
124 !UIObjectView class methodsFor:'queries'! |
125 |
125 |
126 layoutType:aView |
126 layoutType:aView |
127 "returns layout type of aView or nil |
127 "returns layout type of aView or nil |
128 " |
128 " |
129 |layout spec| |
129 |layout spec superView| |
130 |
130 |
131 layout := aView geometryLayout. |
131 aView notNil ifTrue:[ |
132 |
132 layout := aView geometryLayout. |
133 layout notNil ifTrue:[ |
133 layout notNil ifTrue:[ |
134 layout isLayout ifTrue:[ |
134 layout isLayout ifTrue:[ |
135 layout isLayoutFrame ifTrue:[ ^ #LayoutFrame ]. |
135 layout isLayoutFrame ifTrue:[ ^ #LayoutFrame ]. |
136 layout isAlignmentOrigin ifTrue:[ ^ #AlignmentOrigin ]. |
136 layout isAlignmentOrigin ifTrue:[ ^ #AlignmentOrigin ]. |
137 layout isLayoutOrigin ifTrue:[ ^ #LayoutOrigin ]. |
137 layout isLayoutOrigin ifTrue:[ ^ #LayoutOrigin ]. |
|
138 ] ifFalse:[ |
|
139 layout isRectangle ifTrue:[ ^ #Rectangle ]. |
|
140 layout isPoint ifTrue:[ ^ #Point ]. |
|
141 ] |
138 ] ifFalse:[ |
142 ] ifFalse:[ |
139 layout isRectangle ifTrue:[ ^ #Rectangle ]. |
143 (superView := aView superView) notNil ifTrue:[ |
140 layout isPoint ifTrue:[ ^ #Point ]. |
144 spec := superView specClass. |
|
145 spec canResizeSubComponents ifTrue:[ |
|
146 ^ #Extent |
|
147 ] |
|
148 ] |
141 ] |
149 ] |
142 ] ifFalse:[ |
|
143 spec := aView superView specClass. |
|
144 |
|
145 spec canResizeSubComponents ifTrue:[ ^ #Extent ]. |
|
146 ]. |
150 ]. |
147 ^ nil |
151 ^ nil |
148 |
152 |
149 "Modified: 28.2.1997 / 13:02:16 / cg" |
153 "Modified: 28.2.1997 / 13:02:16 / cg" |
150 ! ! |
154 ! ! |
151 |
155 |
152 !UIObjectView methodsFor:'accessing'! |
156 !UIObjectView methodsFor:'accessing'! |
|
157 |
|
158 canModify |
|
159 ^ testMode not |
|
160 ! |
|
161 |
|
162 canModify:aBool |
|
163 self testMode:(aBool not) |
|
164 ! |
153 |
165 |
154 gridAlign |
166 gridAlign |
155 "returns state of aligning to grid |
167 "returns state of aligning to grid |
156 " |
168 " |
157 ^ aligning |
169 ^ aligning |
1208 ! |
1220 ! |
1209 |
1221 |
1210 removeFromSelection:something |
1222 removeFromSelection:something |
1211 "remove something from selection |
1223 "remove something from selection |
1212 " |
1224 " |
1213 super removeFromSelection:something. |
1225 something notNil ifTrue:[ |
1214 self changed:#selection |
1226 super removeFromSelection:something. |
|
1227 self selectionChanged |
|
1228 ]. |
1215 |
1229 |
1216 ! |
1230 ! |
1217 |
1231 |
1218 select:something |
1232 select:something |
1219 "change selection to something |
1233 "change selection to something |
1220 " |
1234 " |
1221 (self canSelect:something) ifTrue:[ |
1235 (self canSelect:something) ifTrue:[ |
1222 super select:something. |
1236 super select:something. |
1223 self changed:#selection |
1237 self selectionChanged |
1224 ] |
1238 ] |
|
1239 |
|
1240 |
1225 |
1241 |
1226 ! |
1242 ! |
1227 |
1243 |
1228 selection |
1244 selection |
1229 "returns selection |
1245 "returns selection |
1230 " |
1246 " |
1231 ^ selection |
1247 ^ selection |
1232 |
1248 |
|
1249 |
|
1250 ! |
|
1251 |
|
1252 selectionChanged |
|
1253 "called whenever the selection changed |
|
1254 " |
|
1255 self subclassResponsibility |
1233 |
1256 |
1234 ! |
1257 ! |
1235 |
1258 |
1236 showSelection |
1259 showSelection |
1237 selectionHiddenLevel == 0 ifTrue:[ |
1260 selectionHiddenLevel == 0 ifTrue:[ |
1602 |
1626 |
1603 ! ! |
1627 ! ! |
1604 |
1628 |
1605 !UIObjectView methodsFor:'user actions - move'! |
1629 !UIObjectView methodsFor:'user actions - move'! |
1606 |
1630 |
1607 moveSelectionDown:aNumber |
1631 moveSelectionDown |
1608 "move selection down |
1632 "move selection down |
1609 " |
1633 " |
1610 |gridY| |
1634 |gridY n| |
1611 |
1635 |
1612 (self canMove:selection) ifTrue:[ |
1636 (self canMove:selection) ifTrue:[ |
1613 gridAlign notNil ifTrue:[gridY := gridAlign y]. |
1637 gridAlign notNil ifTrue:[gridY := gridAlign y]. |
1614 |
1638 |
1615 self withSelectionHiddenDo:[ |
1639 self withSelectionHiddenDo:[ |
1616 self transaction:#moveDown selectionDo:[:aView| |
1640 self selectionDo:[:aView| |
1617 |n d| |
|
1618 |
|
1619 n := aNumber. |
|
1620 |
|
1621 aligning ifTrue:[ |
1641 aligning ifTrue:[ |
1622 d := ((aView computeCorner y) \\ gridY). |
1642 n := ((aView computeCorner y) \\ gridY). |
1623 n := n * gridY. |
1643 |
1624 |
1644 n ~~ 0 ifTrue:[ |
1625 d ~~ 0 ifTrue:[ |
1645 n := gridY - n + 1. |
1626 n := n - d + 1. |
1646 ] ifFalse:[ |
|
1647 n := gridY |
1627 ] |
1648 ] |
|
1649 ] ifFalse:[ |
|
1650 n := 1 |
1628 ]. |
1651 ]. |
1629 self shiftLayout:aView top:n bottom:n |
1652 self shiftLayout:aView top:n bottom:n |
1630 ] |
1653 ] |
1631 ]. |
1654 ]. |
1632 self changed:#layout |
1655 self changed:#layout |
1633 ] |
1656 ] |
1634 |
1657 |
1635 ! |
1658 ! |
1636 |
1659 |
1637 moveSelectionLeft:aNumber |
1660 moveSelectionLeft |
1638 "move selection left |
1661 "move selection left |
1639 " |
1662 " |
1640 |gridX| |
1663 |gridX n| |
1641 |
1664 |
1642 (self canMove:selection) ifTrue:[ |
1665 (self canMove:selection) ifTrue:[ |
1643 gridAlign notNil ifTrue:[gridX := gridAlign x]. |
1666 gridAlign notNil ifTrue:[gridX := gridAlign x]. |
1644 |
1667 |
1645 self withSelectionHiddenDo:[ |
1668 self withSelectionHiddenDo:[ |
1646 self transaction:#moveLeft selectionDo:[:aView| |
1669 self selectionDo:[:aView| |
1647 |n d| |
|
1648 |
|
1649 n := aNumber. |
|
1650 |
|
1651 aligning ifTrue:[ |
1670 aligning ifTrue:[ |
1652 d := ((aView computeOrigin x) \\ gridX). |
1671 n := ((aView computeOrigin x) \\ gridX). |
1653 d ~~ 0 ifTrue:[ |
1672 n == 0 ifTrue:[n := gridX]. |
1654 n := n-1. |
1673 n := n negated. |
1655 ]. |
1674 ] ifFalse:[ |
1656 n := (n * gridX) + d. |
1675 n := -1 |
1657 ]. |
|
1658 n := n negated. |
|
1659 self shiftLayout:aView left:n right:n |
|
1660 ] |
|
1661 ]. |
|
1662 self changed:#layout |
|
1663 ] |
|
1664 ! |
|
1665 |
|
1666 moveSelectionRight:aNumber |
|
1667 "move selection right |
|
1668 " |
|
1669 |gridX| |
|
1670 |
|
1671 (self canMove:selection) ifTrue:[ |
|
1672 gridAlign notNil ifTrue:[gridX := gridAlign x]. |
|
1673 |
|
1674 self withSelectionHiddenDo:[ |
|
1675 self transaction:#moveRight selectionDo:[:aView| |
|
1676 |n d| |
|
1677 |
|
1678 n := aNumber. |
|
1679 |
|
1680 aligning ifTrue:[ |
|
1681 d := ((aView computeCorner x) \\ gridX). |
|
1682 n := n * gridX. |
|
1683 |
|
1684 d ~~ 0 ifTrue:[ |
|
1685 n := n - d + 1. |
|
1686 ] |
|
1687 ]. |
1676 ]. |
1688 self shiftLayout:aView left:n right:n |
1677 self shiftLayout:aView left:n right:n |
1689 ] |
1678 ] |
1690 ]. |
1679 ]. |
1691 self changed:#layout |
1680 self changed:#layout |
1692 ] |
1681 ] |
1693 ! |
1682 ! |
1694 |
1683 |
1695 moveSelectionUp:aNumber |
1684 moveSelectionRight |
|
1685 "move selection right |
|
1686 " |
|
1687 |gridX n| |
|
1688 |
|
1689 (self canMove:selection) ifTrue:[ |
|
1690 gridAlign notNil ifTrue:[gridX := gridAlign x]. |
|
1691 |
|
1692 self withSelectionHiddenDo:[ |
|
1693 self selectionDo:[:aView| |
|
1694 aligning ifTrue:[ |
|
1695 n := ((aView computeCorner x) \\ gridX). |
|
1696 |
|
1697 n ~~ 0 ifTrue:[n := n negated] |
|
1698 ifFalse:[n := gridX] |
|
1699 ] ifFalse:[ |
|
1700 n := 1 |
|
1701 ]. |
|
1702 self shiftLayout:aView left:n right:n |
|
1703 ] |
|
1704 ]. |
|
1705 self changed:#layout |
|
1706 ] |
|
1707 ! |
|
1708 |
|
1709 moveSelectionUp |
1696 "move selection up |
1710 "move selection up |
1697 " |
1711 " |
1698 |gridY| |
1712 |gridY n| |
1699 |
1713 |
1700 (self canMove:selection) ifTrue:[ |
1714 (self canMove:selection) ifTrue:[ |
1701 gridAlign notNil ifTrue:[gridY := gridAlign y]. |
1715 gridAlign notNil ifTrue:[gridY := gridAlign y]. |
1702 |
1716 |
1703 self withSelectionHiddenDo:[ |
1717 self withSelectionHiddenDo:[ |
1704 self transaction:#moveUp selectionDo:[:aView| |
1718 self selectionDo:[:aView| |
1705 |n d| |
|
1706 |
|
1707 n := aNumber. |
|
1708 |
|
1709 aligning ifTrue:[ |
1719 aligning ifTrue:[ |
1710 d := ((aView computeOrigin x) \\ gridY). |
1720 n := ((aView computeOrigin x) \\ gridY). |
1711 d ~~ 0 ifTrue:[ |
1721 n == 0 ifTrue:[n := gridY]. |
1712 n := n-1. |
1722 n := n negated. |
1713 ]. |
1723 ] ifFalse:[ |
1714 n := (n * gridY) + d. |
1724 n := -1 |
1715 ]. |
1725 ]. |
1716 n := n negated. |
|
1717 self shiftLayout:aView top:n bottom:n |
1726 self shiftLayout:aView top:n bottom:n |
1718 ] |
1727 ] |
1719 ]. |
1728 ]. |
1720 self changed:#layout |
1729 self changed:#layout |
1721 ] |
1730 ] |