229 |
229 |
230 coll := self minSetOfSuperViews:(self selection). |
230 coll := self minSetOfSuperViews:(self selection). |
231 |
231 |
232 coll notNil ifTrue:[ |
232 coll notNil ifTrue:[ |
233 "/ self select:nil. |
233 "/ self select:nil. |
234 specs := coll collect:[:aView| self fullSpecFor:aView ]. |
234 specs := coll collect:[:aView| self fullSpecFor:aView ]. |
235 self setSelection:specs. |
235 self setClipboardObject:specs. |
236 "/ treeView selection: sel |
236 "/ treeView selection: sel |
237 ]. |
237 ]. |
238 |
|
239 |
|
240 ! |
238 ! |
241 |
239 |
242 deleteSelection |
240 deleteSelection |
243 "delete the selection buffered |
241 "delete the selection buffered |
244 " |
242 " |
254 treeView askForSelectionChangeAllowed ifFalse:[^ self]. |
252 treeView askForSelectionChangeAllowed ifFalse:[^ self]. |
255 |
253 |
256 coll := self minSetOfSuperViews:(self selection). |
254 coll := self minSetOfSuperViews:(self selection). |
257 |
255 |
258 coll notNil ifTrue:[ |
256 coll notNil ifTrue:[ |
259 treeView cvsEventsDisabledDo:[ |
257 treeView cvsEventsDisabledDo:[ |
260 treeModel := treeView model. |
258 treeModel := treeView model. |
261 oldSelection := treeModel selectedNodes at:1 ifAbsent: nil. |
259 oldSelection := treeModel selectedNodes at:1 ifAbsent: nil. |
262 |
260 |
263 oldSelection notNil ifTrue:[ |
261 oldSelection notNil ifTrue:[ |
264 children := oldSelection parent children. |
262 children := oldSelection parent children. |
265 (size := children size) > 1 ifTrue:[ |
263 (size := children size) > 1 ifTrue:[ |
266 index := children identityIndexOf:oldSelection. |
264 index := children identityIndexOf:oldSelection. |
267 size == index ifTrue:[ |
265 size == index ifTrue:[ |
268 index := index - 1 |
266 index := index - 1 |
269 ]. |
267 ]. |
270 newSelection := children at:index ifAbsent:1. |
268 newSelection := children at:index ifAbsent:1. |
271 ] ifFalse:[ |
269 ] ifFalse:[ |
272 newSelection := oldSelection parent |
270 newSelection := oldSelection parent |
273 ]. |
271 ]. |
274 newSelection := treeModel indexOf:newSelection. |
272 newSelection := treeModel indexOf:newSelection. |
275 ] ifFalse:[ |
273 ] ifFalse:[ |
276 newSelection := 1 |
274 newSelection := 1 |
277 ]. |
275 ]. |
278 |
276 |
279 self hideSelection. |
277 self hideSelection. |
280 selection := nil. |
278 selection := nil. |
281 specs := coll collect:[:aView| self fullSpecFor:aView ]. |
279 specs := coll collect:[:aView| self fullSpecFor:aView ]. |
282 |
280 |
283 self withinTransaction:#cut objects:coll do:[ |
281 self withinTransaction:#cut objects:coll do:[ |
284 coll reverseDo:[:aView| |
282 coll reverseDo:[:aView| |
285 self createUndoRemove:aView. |
283 self createUndoRemove:aView. |
286 self remove:aView. |
284 self remove:aView. |
287 ] |
285 ] |
288 ]. |
286 ]. |
289 buffered ifTrue: [self setSelection:specs]. |
287 buffered ifTrue: [self setClipboardObject:specs]. |
290 treeView selection:nil. |
288 treeView selection:nil. |
291 treeView selection:(Array with: newSelection). |
289 treeView selection:(Array with: newSelection). |
292 (nd := treeView selectedNode) notNil ifTrue:[ |
290 (nd := treeView selectedNode) notNil ifTrue:[ |
293 self setSelection:nd contents view withRedraw:true. |
291 self setSelection:nd contents view withRedraw:true. |
294 ] |
292 ] |
295 ] |
293 ] |
296 ] |
294 ] |
297 ! |
295 ! |
298 |
296 |
299 deleteTotalSelection |
297 deleteTotalSelection |
300 "delete the selection |
298 "delete the selection |
536 canPasteInto:aView |
534 canPasteInto:aView |
537 "can paste into a view |
535 "can paste into a view |
538 " |
536 " |
539 |prop| |
537 |prop| |
540 |
538 |
541 aView notNil ifTrue:[ |
539 aView isNil ifTrue:[ ^ false ]. |
542 (prop := self propertyRespondsToView:aView) notNil ifTrue:[ |
540 |
543 ^ prop spec class supportsSubComponents |
541 (aView isKindOf:VerticalPanelView) ifTrue:[self halt]. |
544 ]. |
542 (prop := self propertyOfView:aView) notNil ifTrue:[ |
545 ^ aView specClass supportsSubComponents. |
543 ^ prop spec class supportsSubComponents |
546 ]. |
544 ]. |
547 ^ false |
545 ^ aView specClass supportsSubComponents. |
548 |
|
549 ! |
546 ! |
550 |
547 |
551 drop:anObjectOrCollection at:aPoint |
548 drop:anObjectOrCollection at:aPoint |
552 |spec newSel oldSel dragOffset widg doit| |
549 |spec newSel oldSel dragOffset widg doit| |
553 |
550 |
1763 "find the origin/corner of the currentWidget |
1760 "find the origin/corner of the currentWidget |
1764 " |
1761 " |
1765 |view prop| |
1762 |view prop| |
1766 |
1763 |
1767 view := super findObjectAt:aPoint. |
1764 view := super findObjectAt:aPoint. |
1768 prop := self propertyRespondsToView:view. |
1765 prop := self propertyOfView:view. |
1769 |
1766 |
1770 prop notNil ifTrue:[^ prop view]. |
1767 prop notNil ifTrue:[^ prop view]. |
1771 ^ nil |
1768 ^ nil |
1772 ! |
1769 ! |
1773 |
1770 |
1774 findViewWithId:aViewId |
1771 findViewWithId:aViewId |
1775 "finds view assigned to identifier and returns the view or nil |
1772 "finds view assigned to identifier and returns the view or nil |
1776 " |
1773 " |
1806 propertyOfParentForView:aSubView |
1803 propertyOfParentForView:aSubView |
1807 "returns the property of the parent or nil |
1804 "returns the property of the parent or nil |
1808 " |
1805 " |
1809 |item| |
1806 |item| |
1810 |
1807 |
1811 (item := treeView detectItemRespondsToView:aSubView) notNil ifTrue:[ |
1808 (item := treeView detectItemCorespondingToView:aSubView) notNil ifTrue:[ |
1812 (item := item parent) notNil ifTrue:[^ item contents] |
1809 (item := item parent) notNil ifTrue:[^ item contents] |
1813 ]. |
1810 ]. |
1814 ^ nil |
1811 ^ nil |
1815 ! |
1812 ! |
1816 |
1813 |
1817 propertyOfView:aView |
1814 propertyOfView:aView |
1818 "returns property assigned to view |
1815 "detect the property for the argument, a view. The property of the view or |
1819 " |
|
1820 (aView isNil or:[aView == self]) ifFalse:[ |
|
1821 ^ treeView propertyDetect:[:p| p view == aView ] |
|
1822 ]. |
|
1823 ^ nil |
|
1824 ! |
|
1825 |
|
1826 propertyRespondsToView:aView |
|
1827 "detect the property responding to the argument a view. The property of the view or |
|
1828 the first subview providing the properties is returned. If no property is detected |
1816 the first subview providing the properties is returned. If no property is detected |
1829 nil is returned. |
1817 nil is returned. |
1830 " |
1818 " |
1831 |item| |
1819 |item| |
1832 |
1820 |
1833 item := treeView detectItemRespondsToView:aView. |
1821 item := treeView detectItemCorespondingToView:aView. |
1834 |
1822 |
1835 (item notNil and:[item parent notNil]) ifTrue:[ |
1823 (item notNil and:[item parent notNil]) ifTrue:[ |
1836 ^ item contents |
1824 ^ item contents |
1837 ]. |
1825 ]. |
1838 ^ nil |
1826 ^ nil |
1839 ! |
1827 ! |
1840 |
1828 |
1841 uniqueNameFor:aSpecOrString |
1829 uniqueNameFor:aSpecOrString |