--- a/UIPainterView.st Mon May 18 15:28:09 2009 +0200
+++ b/UIPainterView.st Mon May 18 15:28:47 2009 +0200
@@ -379,7 +379,9 @@
!
pasteSpecifications:aSpecificationOrList into:aContainerOrNil beforeIndex:anIndexOrNil keepLayout:keepLayout keepPosition:keepPosition at:aPointOrNilOrKeep
- "add the specs to the object view; returns list of pasted widgets"
+ "add the specs to the object view;
+ if given a collection of specs, returns a list of pasted widgets;
+ if given a single spec, returns that view (sigh - a stupid bw-compatibility kludge)"
|sensor specsToPaste pasteOffset builder newSel
bounds containerToPasteInto pastePoint beforeIndex|
@@ -442,6 +444,8 @@
^ nil
].
+ self hideSelection.
+
aSpecificationOrList isCollection ifTrue:[
specsToPaste := aSpecificationOrList
] ifFalse:[
@@ -505,16 +509,28 @@
newSel add:view.
].
- self withinTransaction:#paste objects:newSel do:[
- undoHistory addUndoSelector:#undoCreate:
- withArgs:(newSel collect:[:v|(self propertyOfView:v) identifier]).
- self undoHistoryChanged.
- ].
+ self
+ withinTransaction:#paste
+ objects:newSel
+ do:[
+ undoHistory
+ addUndoSelector:#undoCreate:
+ withArgs:(newSel collect:[:v| (self propertyOfView:v) identifier]).
+ self undoHistoryChanged.
+ ].
self realizeAllSubViews.
"/ newSel do:[:v| v raise].
self elementChangedSize:containerToPasteInto.
+ "/ because the new-created view will destroy the handles, when it redraws itself,
+ "/ give it a chance to do so, before we return.
+ [ (newSel conform:[:v | v shown]) ] whileFalse:[
+ Delay waitForSeconds:0.01.
+ ].
+ Delay waitForSeconds:0.01.
+ self windowGroup repairDamage.
+
newSel size == 1 ifTrue:[newSel := newSel at:1].
^ newSel
@@ -711,9 +727,8 @@
!
dropObjects:aCollectionOfDropObjects at:aPoint
- |spec newSel oldSel dragOffset dropPoint widg doit|
-
- doit := true.
+ |spec newSel oldSel dragOffset dropPoint widg|
+
self selection notNil ifTrue:[
oldSel := self singleSelection.
@@ -729,35 +744,19 @@
self setSelection:widg withRedraw:true.
].
spec := (aCollectionOfDropObjects at:1) theObject.
- doit ifTrue:[
- dragOffset := DragAndDropManager dragOffsetQuerySignal query.
- aPoint isNil ifTrue:[
- dropPoint := #keep.
- ] ifFalse:[
- dropPoint := aPoint - dragOffset.
- ].
- newSel := self pasteSpecifications:spec keepLayout:false keepPosition:false at:dropPoint.
- self select:(oldSel ? newSel)
+
+ dragOffset := DragAndDropManager dragOffsetQuerySignal query.
+ aPoint isNil ifTrue:[
+ dropPoint := #keep.
+ ] ifFalse:[
+ dropPoint := aPoint - dragOffset.
].
+ newSel := self pasteSpecifications:spec keepLayout:false keepPosition:false at:dropPoint.
+
+ self select:(oldSel ? newSel).
"Modified: / 18-03-1999 / 18:29:43 / stefan"
"Created: / 13-10-2006 / 16:09:27 / cg"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
! !
!UIPainterView methodsFor:'drawing'!
@@ -2043,27 +2042,31 @@
showSelected:aComponent
"show object selected
"
- |wasClipped sel hColor bg|
+ |wasClipped sel hInsideColor hOutsideColor bg|
selectionHiddenLevel == 0 ifTrue:[
sel := treeView selection.
(sel size > 1 and: [(treeView model list at: sel first) contents view == aComponent])
ifTrue: [
- hColor := handleMasterColor
+ hInsideColor := handleMasterColor.
] ifFalse:[
bg := aComponent viewBackground.
bg isColor ifTrue:[
bg brightness < 0.5 ifTrue:[
- hColor := handleColorWhite
+ hInsideColor := handleColorWhite
] ifFalse:[
- hColor := handleColorBlack
+ hInsideColor := handleColorBlack
]
] ifFalse:[
- hColor := handleColorBlack
+ hInsideColor := handleColorBlack
]
].
- self paint:hColor.
+ hInsideColor brightness < 0.5 ifTrue:[
+ hOutsideColor := handleColorWhite
+ ] ifFalse:[
+ hOutsideColor := handleColorBlack
+ ].
(wasClipped := clipChildren) ifTrue:[
self clippedByChildren:(clipChildren := false).
@@ -2072,15 +2075,20 @@
self handlesOf:aComponent do:[:aRectangle :what|
|l t w h|
- l := aRectangle left + 1.
- t := aRectangle top + 1.
- w := aRectangle width - 2.
- h := aRectangle height - 2.
+ l := aRectangle left.
+ t := aRectangle top.
+ w := aRectangle width.
+ h := aRectangle height.
+
+ self paint:hOutsideColor.
+ self displayRectangleX:l y:t width:w height:h.
+
+ self paint:hInsideColor.
what == #view ifTrue:[
- self displayRectangleX:l y:t width:w height:h
+ self displayRectangleX:l+1 y:t+1 width:w-2 height:h-2
] ifFalse:[
- self fillRectangleX:l y:t width:w height:h
+ self fillRectangleX:l+1 y:t+1 width:w-2 height:h-2
]
].