377 |
377 |
378 self changeSelectionAfterPasteOf:sel. |
378 self changeSelectionAfterPasteOf:sel. |
379 ! |
379 ! |
380 |
380 |
381 pasteSpecifications:aSpecificationOrList into:aContainerOrNil beforeIndex:anIndexOrNil keepLayout:keepLayout keepPosition:keepPosition at:aPointOrNilOrKeep |
381 pasteSpecifications:aSpecificationOrList into:aContainerOrNil beforeIndex:anIndexOrNil keepLayout:keepLayout keepPosition:keepPosition at:aPointOrNilOrKeep |
382 "add the specs to the object view; returns list of pasted widgets" |
382 "add the specs to the object view; |
|
383 if given a collection of specs, returns a list of pasted widgets; |
|
384 if given a single spec, returns that view (sigh - a stupid bw-compatibility kludge)" |
383 |
385 |
384 |sensor specsToPaste pasteOffset builder newSel |
386 |sensor specsToPaste pasteOffset builder newSel |
385 bounds containerToPasteInto pastePoint beforeIndex| |
387 bounds containerToPasteInto pastePoint beforeIndex| |
386 |
388 |
387 treeView askForSelectionChangeAllowed ifFalse:[^ nil]. |
389 treeView askForSelectionChangeAllowed ifFalse:[^ nil]. |
503 view realize. |
507 view realize. |
504 ]. |
508 ]. |
505 newSel add:view. |
509 newSel add:view. |
506 ]. |
510 ]. |
507 |
511 |
508 self withinTransaction:#paste objects:newSel do:[ |
512 self |
509 undoHistory addUndoSelector:#undoCreate: |
513 withinTransaction:#paste |
510 withArgs:(newSel collect:[:v|(self propertyOfView:v) identifier]). |
514 objects:newSel |
511 self undoHistoryChanged. |
515 do:[ |
512 ]. |
516 undoHistory |
|
517 addUndoSelector:#undoCreate: |
|
518 withArgs:(newSel collect:[:v| (self propertyOfView:v) identifier]). |
|
519 self undoHistoryChanged. |
|
520 ]. |
513 |
521 |
514 self realizeAllSubViews. |
522 self realizeAllSubViews. |
515 "/ newSel do:[:v| v raise]. |
523 "/ newSel do:[:v| v raise]. |
516 self elementChangedSize:containerToPasteInto. |
524 self elementChangedSize:containerToPasteInto. |
|
525 |
|
526 "/ because the new-created view will destroy the handles, when it redraws itself, |
|
527 "/ give it a chance to do so, before we return. |
|
528 [ (newSel conform:[:v | v shown]) ] whileFalse:[ |
|
529 Delay waitForSeconds:0.01. |
|
530 ]. |
|
531 Delay waitForSeconds:0.01. |
|
532 self windowGroup repairDamage. |
517 |
533 |
518 newSel size == 1 ifTrue:[newSel := newSel at:1]. |
534 newSel size == 1 ifTrue:[newSel := newSel at:1]. |
519 ^ newSel |
535 ^ newSel |
520 |
536 |
521 "Modified: / 10.10.2001 / 14:15:12 / cg" |
537 "Modified: / 10.10.2001 / 14:15:12 / cg" |
709 ]. |
725 ]. |
710 ^ aView specClass supportsSubComponents. |
726 ^ aView specClass supportsSubComponents. |
711 ! |
727 ! |
712 |
728 |
713 dropObjects:aCollectionOfDropObjects at:aPoint |
729 dropObjects:aCollectionOfDropObjects at:aPoint |
714 |spec newSel oldSel dragOffset dropPoint widg doit| |
730 |spec newSel oldSel dragOffset dropPoint widg| |
715 |
731 |
716 doit := true. |
|
717 self selection notNil ifTrue:[ |
732 self selection notNil ifTrue:[ |
718 oldSel := self singleSelection. |
733 oldSel := self singleSelection. |
719 |
734 |
720 "/ search selections hierarchy for a widget into which we can paste |
735 "/ search selections hierarchy for a widget into which we can paste |
721 widg := oldSel. |
736 widg := oldSel. |
727 |
742 |
728 oldSel := nil. |
743 oldSel := nil. |
729 self setSelection:widg withRedraw:true. |
744 self setSelection:widg withRedraw:true. |
730 ]. |
745 ]. |
731 spec := (aCollectionOfDropObjects at:1) theObject. |
746 spec := (aCollectionOfDropObjects at:1) theObject. |
732 doit ifTrue:[ |
747 |
733 dragOffset := DragAndDropManager dragOffsetQuerySignal query. |
748 dragOffset := DragAndDropManager dragOffsetQuerySignal query. |
734 aPoint isNil ifTrue:[ |
749 aPoint isNil ifTrue:[ |
735 dropPoint := #keep. |
750 dropPoint := #keep. |
736 ] ifFalse:[ |
751 ] ifFalse:[ |
737 dropPoint := aPoint - dragOffset. |
752 dropPoint := aPoint - dragOffset. |
738 ]. |
753 ]. |
739 newSel := self pasteSpecifications:spec keepLayout:false keepPosition:false at:dropPoint. |
754 newSel := self pasteSpecifications:spec keepLayout:false keepPosition:false at:dropPoint. |
740 self select:(oldSel ? newSel) |
755 |
741 ]. |
756 self select:(oldSel ? newSel). |
742 |
757 |
743 "Modified: / 18-03-1999 / 18:29:43 / stefan" |
758 "Modified: / 18-03-1999 / 18:29:43 / stefan" |
744 "Created: / 13-10-2006 / 16:09:27 / cg" |
759 "Created: / 13-10-2006 / 16:09:27 / cg" |
745 |
|
746 |
|
747 |
|
748 |
|
749 |
|
750 |
|
751 |
|
752 |
|
753 |
|
754 |
|
755 |
|
756 |
|
757 |
|
758 |
|
759 |
|
760 |
|
761 ! ! |
760 ! ! |
762 |
761 |
763 !UIPainterView methodsFor:'drawing'! |
762 !UIPainterView methodsFor:'drawing'! |
764 |
763 |
765 clearRectangle:visRect |
764 clearRectangle:visRect |
2041 ! |
2040 ! |
2042 |
2041 |
2043 showSelected:aComponent |
2042 showSelected:aComponent |
2044 "show object selected |
2043 "show object selected |
2045 " |
2044 " |
2046 |wasClipped sel hColor bg| |
2045 |wasClipped sel hInsideColor hOutsideColor bg| |
2047 |
2046 |
2048 selectionHiddenLevel == 0 ifTrue:[ |
2047 selectionHiddenLevel == 0 ifTrue:[ |
2049 sel := treeView selection. |
2048 sel := treeView selection. |
2050 (sel size > 1 and: [(treeView model list at: sel first) contents view == aComponent]) |
2049 (sel size > 1 and: [(treeView model list at: sel first) contents view == aComponent]) |
2051 ifTrue: [ |
2050 ifTrue: [ |
2052 hColor := handleMasterColor |
2051 hInsideColor := handleMasterColor. |
2053 ] ifFalse:[ |
2052 ] ifFalse:[ |
2054 bg := aComponent viewBackground. |
2053 bg := aComponent viewBackground. |
2055 bg isColor ifTrue:[ |
2054 bg isColor ifTrue:[ |
2056 bg brightness < 0.5 ifTrue:[ |
2055 bg brightness < 0.5 ifTrue:[ |
2057 hColor := handleColorWhite |
2056 hInsideColor := handleColorWhite |
2058 ] ifFalse:[ |
2057 ] ifFalse:[ |
2059 hColor := handleColorBlack |
2058 hInsideColor := handleColorBlack |
2060 ] |
2059 ] |
2061 ] ifFalse:[ |
2060 ] ifFalse:[ |
2062 hColor := handleColorBlack |
2061 hInsideColor := handleColorBlack |
2063 ] |
2062 ] |
2064 ]. |
2063 ]. |
2065 |
2064 |
2066 self paint:hColor. |
2065 hInsideColor brightness < 0.5 ifTrue:[ |
|
2066 hOutsideColor := handleColorWhite |
|
2067 ] ifFalse:[ |
|
2068 hOutsideColor := handleColorBlack |
|
2069 ]. |
2067 |
2070 |
2068 (wasClipped := clipChildren) ifTrue:[ |
2071 (wasClipped := clipChildren) ifTrue:[ |
2069 self clippedByChildren:(clipChildren := false). |
2072 self clippedByChildren:(clipChildren := false). |
2070 ]. |
2073 ]. |
2071 |
2074 |
2072 self handlesOf:aComponent do:[:aRectangle :what| |
2075 self handlesOf:aComponent do:[:aRectangle :what| |
2073 |l t w h| |
2076 |l t w h| |
2074 |
2077 |
2075 l := aRectangle left + 1. |
2078 l := aRectangle left. |
2076 t := aRectangle top + 1. |
2079 t := aRectangle top. |
2077 w := aRectangle width - 2. |
2080 w := aRectangle width. |
2078 h := aRectangle height - 2. |
2081 h := aRectangle height. |
|
2082 |
|
2083 self paint:hOutsideColor. |
|
2084 self displayRectangleX:l y:t width:w height:h. |
|
2085 |
|
2086 self paint:hInsideColor. |
2079 |
2087 |
2080 what == #view ifTrue:[ |
2088 what == #view ifTrue:[ |
2081 self displayRectangleX:l y:t width:w height:h |
2089 self displayRectangleX:l+1 y:t+1 width:w-2 height:h-2 |
2082 ] ifFalse:[ |
2090 ] ifFalse:[ |
2083 self fillRectangleX:l y:t width:w height:h |
2091 self fillRectangleX:l+1 y:t+1 width:w-2 height:h-2 |
2084 ] |
2092 ] |
2085 ]. |
2093 ]. |
2086 |
2094 |
2087 wasClipped ifTrue:[ |
2095 wasClipped ifTrue:[ |
2088 self clippedByChildren:(clipChildren := true). |
2096 self clippedByChildren:(clipChildren := true). |