diff -r 556bb6c9e36c -r 230fe13c4e51 UIGalleryView.st --- a/UIGalleryView.st Sun May 02 13:40:15 1999 +0200 +++ b/UIGalleryView.st Thu May 06 23:11:00 1999 +0200 @@ -1,6 +1,6 @@ " COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG - All Rights Reserved + All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the @@ -39,7 +39,7 @@ copyright " COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG - All Rights Reserved + All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the @@ -60,12 +60,12 @@ The UISelectionPanel used by the UIPainter is implemented in this way. [author:] - Claus Gittinger - Claus Atzkern + Claus Gittinger + Claus Atzkern [see also:] - UIPainter - UISelectionPanel + UIPainter + UISelectionPanel " ! @@ -74,25 +74,25 @@ " opens a gallery - [exBegin] + [exBegin] |top sel| top := StandardSystemView new label:'gallery'; extent:500@300. sel := UIGalleryView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. sel labels:#( 'Buttons' - 'Panels' - 'Text' - ). + 'Panels' + 'Text' + ). sel minorKeys:#( #standardButtonToggle - #standardPanels - #standardText - ). + #standardPanels + #standardText + ). sel majorKey:UISelectionPanel. top open. - [exEnd] + [exEnd] " ! ! @@ -139,9 +139,9 @@ appl := self application. appl notNil ifTrue:[ - majorKey := appl resolveName:aKey + majorKey := appl resolveName:aKey ] ifFalse:[ - majorKey := Smalltalk resolveName:aKey inClass:self class + majorKey := Smalltalk resolveName:aKey inClass:self class ]. self selection:nil ! @@ -195,11 +195,11 @@ specifications from a class associated with the majorKey. " minorKeysHolder notNil ifTrue:[ - minorKeysHolder removeDependent:self. + minorKeysHolder removeDependent:self. ]. (minorKeysHolder := aValueHolder) notNil ifTrue:[ - minorKeysHolder addDependent:self. + minorKeysHolder addDependent:self. ]. self minorKeys:(minorKeysHolder value) ! ! @@ -214,24 +214,24 @@ selection := tabRaw listIndexOf:something. minorKeysHolder notNil ifTrue:[ - minorKeys := minorKeysHolder value. + minorKeys := minorKeysHolder value. ]. (selection notNil and:[minorKeys size >= selection]) ifTrue:[ - selector := minorKeys at:selection. + selector := minorKeys at:selection. - (majorKey respondsTo:selector) ifTrue:[ - specification := majorKey perform:selector - ] ifFalse:[ - (application := self application) notNil ifTrue:[ - Object messageNotUnderstoodSignal handle:[:ex| - (application class respondsTo:selector) ifTrue:[ - specification := application class perform:selector - ] - ] do:[ - specification := application aspectFor:selector - ] - ] - ] + (majorKey respondsTo:selector) ifTrue:[ + specification := majorKey perform:selector + ] ifFalse:[ + (application := self application) notNil ifTrue:[ + Object messageNotUnderstoodSignal handle:[:ex| + (application class respondsTo:selector) ifTrue:[ + specification := application class perform:selector + ] + ] do:[ + specification := application aspectFor:selector + ] + ] + ] ]. canvas specification:specification. @@ -245,7 +245,7 @@ "one of my models changed its value " changedObject == minorKeysHolder ifTrue:[ - ^ self minorKeys:( minorKeysHolder value) + ^ self minorKeys:( minorKeysHolder value) ]. super update:something with:aParameter from:changedObject. @@ -255,8 +255,8 @@ destroy minorKeysHolder notNil ifTrue:[ - minorKeysHolder removeDependent:self. - minorKeysHolder := nil. + minorKeysHolder removeDependent:self. + minorKeysHolder := nil. ]. super destroy. ! @@ -300,7 +300,7 @@ no selection the specification under the cursor " (clientSpecHolder := aHolder) notNil ifTrue:[ - clientSpecHolder value:selection + clientSpecHolder value:selection ]. ! @@ -330,36 +330,36 @@ self selection:nil. self subViews copy do:[:aSubView| - aSubView ~~ inputView ifTrue:[ - aSubView destroy - ] + aSubView ~~ inputView ifTrue:[ + aSubView destroy + ] ]. aSpecOrSpecArray notNil ifTrue:[ - specification := UISpecification from:aSpecOrSpecArray. + specification := UISpecification from:aSpecOrSpecArray. - (specification respondsTo:#buildViewFor:in:) ifFalse:[ - specification := nil. - ^ self - ]. - (builder := uiBuilder) isNil ifTrue:[ - builder := UIBuilder new isEditing:true. - builder showDefaults:true. - ]. + (specification respondsTo:#buildViewFor:in:) ifFalse:[ + specification := nil. + ^ self + ]. + (builder := uiBuilder) isNil ifTrue:[ + builder := UIBuilder new isEditing:true. + builder showDefaults:true. + ]. - specification buildViewFor:builder in:self. + specification buildViewFor:builder in:self. - subViews do:[:v| - (v ~~ inputView and:[(self findSpecFor:v) notNil]) ifTrue:[ - v borderWidth:1. - ] - ]. - self shown ifTrue:[ - self realizeAllSubViews. - inputView raise - ] + subViews do:[:v| + (v ~~ inputView and:[(self findSpecFor:v) notNil]) ifTrue:[ + v borderWidth:1. + ] + ]. + self shown ifTrue:[ + self realizeAllSubViews. + inputView raise + ] ] ifFalse:[ - specification := nil + specification := nil ] @@ -374,13 +374,13 @@ |spec comp coll| (aSpec notNil and:[aSpec canUIDrag]) ifFalse:[ - ^ nil + ^ nil ]. spec := aSpec copy. (aSpec class supportsSubComponents and:[aSpec component notNil]) ifFalse:[ - ^ spec + ^ spec ]. comp := aSpec component. spec component:nil. @@ -391,9 +391,9 @@ coll := OrderedCollection new. comp do:[:anEntry||spc| - (spc := self buildSpecFrom:anEntry) notNil ifTrue:[ - coll add:spc - ] + (spc := self buildSpecFrom:anEntry) notNil ifTrue:[ + coll add:spc + ] ]. coll isEmpty ifTrue:[ ^ spec @@ -418,17 +418,17 @@ spec := self findSpecFor:selection. spec notNil ifTrue:[ - spec := self buildSpecFrom:spec. - name := spec className asString. - name := name copyFrom:1 to:(name size - ('Spec' size) + 1). - name at:1 put:(name at:1) asLowercase. - name at:(name size) put:$1. - spec name:name. + spec := self buildSpecFrom:spec. + name := spec className asString. + name := name copyFrom:1 to:(name size - ('Spec' size) + 1). + name at:1 put:(name at:1) asLowercase. + name at:(name size) put:$1. + spec name:name. - self showUnselected. - dragObj := DropSpec for:selection specification:spec. - "/ self showSelected. - DragAndDropManager startDrag:dragObj from:inputView. + self showUnselected. + dragObj := DropSpec for:selection specification:spec. + "/ self showSelected. + DragAndDropManager startDrag:dragObj from:inputView. ] ! @@ -441,19 +441,19 @@ spec := self findSpecFor:selection. spec notNil ifTrue:[ - spec := self buildSpecFrom:spec. - spec name:(spec copy userFriendlyName, $1). + spec := self buildSpecFrom:spec. + spec name:(spec copy userFriendlyName, $1). - self showUnselected. - dragObj := DropSpec for:selection specification:spec. - "/ self showSelected. + self showUnselected. + dragObj := DropSpec for:selection specification:spec. + "/ self showSelected. - o := lastClickPoint - selection origin. + o := lastClickPoint - selection origin. - DragAndDropManager - startDrag:dragObj - from:inputView - offset:o. + DragAndDropManager + startDrag:dragObj + from:inputView + offset:o. ] "Created: 11.8.1997 / 00:44:17 / cg" @@ -468,12 +468,12 @@ |sensor| (state ~~ 0 and:[lastClickPoint notNil and:[selection notNil]]) ifTrue:[ - sensor := self sensor. - sensor anyButtonPressed ifTrue:[ - (lastClickPoint dist:(x@y)) > 10.0 ifTrue:[ - ^ self startDragWithOffset:(x@y) - lastClickPoint - ] - ] + sensor := self sensor. + sensor anyButtonPressed ifTrue:[ + (lastClickPoint dist:(x@y)) > 10.0 ifTrue:[ + ^ self startDragWithOffset:(x@y) - lastClickPoint + ] + ] ] ! @@ -483,17 +483,17 @@ |application| button == 1 ifTrue:[ - lastClickPoint := Point x:x y:y. - self selection:(self findObjectAtX:x y:y). + lastClickPoint := Point x:x y:y. + self selection:(self findObjectAtX:x y:y). ] ifFalse:[ - lastClickPoint := nil. + lastClickPoint := nil. - (menuSelector notNil and:[(application := self application) notNil]) ifTrue:[ - Object messageNotUnderstoodSignal handle:[:ex| - ] do:[ - application aspectFor:menuSelector - ] - ] + (menuSelector notNil and:[(application := self application) notNil]) ifTrue:[ + Object messageNotUnderstoodSignal handle:[:ex| + ] do:[ + application aspectFor:menuSelector + ] + ] ] ! @@ -504,7 +504,7 @@ super exposeX:x y:y width:w height:h. (selection notNil and:[self sensor hasExposeEventFor:selection]) ifFalse:[ - self showSelected. + self showSelected. ]. @@ -547,17 +547,17 @@ subViews do:[:v| |pX pY| - v ~~ inputView ifTrue:[ - p := device translatePoint:point from:id to:(v id). + v ~~ inputView ifTrue:[ + p := device translatePoint:point from:id to:(v id). pX := p x. pY := p y. - ( pX >= 0 and:[pX <= v width - and:[pY >= 0 and:[pY <= v height - and:[(self findSpecFor:v) notNil]]]] - ) ifTrue:[ - ^ v - ] - ] + ( pX >= 0 and:[pX <= v width + and:[pY >= 0 and:[pY <= v height + and:[(self findSpecFor:v) notNil]]]] + ) ifTrue:[ + ^ v + ] + ] ]. ^ nil @@ -570,14 +570,14 @@ |name| anObject notNil ifTrue:[ - name := anObject name. + name := anObject name. - specification do:[:aSpec| - aSpec name = name ifTrue:[ - aSpec canUIDrag ifTrue:[^ aSpec] - ifFalse:[^ nil] - ] - ] + specification do:[:aSpec| + aSpec name = name ifTrue:[ + aSpec canUIDrag ifTrue:[^ aSpec] + ifFalse:[^ nil] + ] + ] ]. ^ nil @@ -591,14 +591,14 @@ is a rectangle " aComponent notNil ifTrue:[ - aOneArgBlock value:(aComponent origin - (2@2) extent:6@6). - aOneArgBlock value:(aComponent corner - (1@1) extent:6@6). - aOneArgBlock value:(aComponent topRight - (1@2) extent:6@6). - aOneArgBlock value:(aComponent bottomLeft - (2@1) extent:6@6). - aOneArgBlock value:(aComponent leftCenter - (2@0) extent:6@6). - aOneArgBlock value:(aComponent rightCenter - (1@0) extent:6@6). - aOneArgBlock value:(aComponent topCenter - (0@2) extent:6@6). - aOneArgBlock value:(aComponent bottomCenter - (0@1) extent:6@6). + aOneArgBlock value:(aComponent origin - (2@2) extent:6@6). + aOneArgBlock value:(aComponent corner - (1@1) extent:6@6). + aOneArgBlock value:(aComponent topRight - (1@2) extent:6@6). + aOneArgBlock value:(aComponent bottomLeft - (2@1) extent:6@6). + aOneArgBlock value:(aComponent leftCenter - (2@0) extent:6@6). + aOneArgBlock value:(aComponent rightCenter - (1@0) extent:6@6). + aOneArgBlock value:(aComponent topCenter - (0@2) extent:6@6). + aOneArgBlock value:(aComponent bottomCenter - (0@1) extent:6@6). ] @@ -610,18 +610,18 @@ |spec| selection ~~ anObject ifTrue:[ - self showUnselected. - spec := self findSpecFor:anObject. + self showUnselected. + spec := self findSpecFor:anObject. - spec notNil ifTrue:[ - selection := anObject. - self showSelected - ] ifFalse:[ - selection := nil - ]. - clientSpecHolder notNil ifTrue:[ - clientSpecHolder value:spec - ] + spec notNil ifTrue:[ + selection := anObject. + self showSelected + ] ifFalse:[ + selection := nil + ]. + clientSpecHolder notNil ifTrue:[ + clientSpecHolder value:spec + ] ] @@ -633,12 +633,12 @@ shown ifFalse:[^ self]. selection notNil ifTrue:[ - self clippedByChildren:false. + self clippedByChildren:false. - self handlesOf:selection do:[:aRectangle| - self fillRectangle:aRectangle - ]. - self clippedByChildren:true. + self handlesOf:selection do:[:aRectangle| + self fillRectangle:aRectangle + ]. + self clippedByChildren:true. ]. @@ -650,7 +650,7 @@ |r currSel| (currSel := selection) isNil ifTrue:[ - ^ self + ^ self ]. shown ifFalse:[^ self]. selection := nil. @@ -658,25 +658,27 @@ self clippedByChildren:false. self handlesOf:currSel do:[:aRectangle| - self clearRectangle:aRectangle + self clearRectangle:aRectangle ]. self clippedByChildren:true. r := currSel bounds. subViews do:[:sv| - |absOrg absFrame| + |absOrg absFrame| - sv ~~ inputView ifTrue:[ - (sv bounds intersects:r) ifTrue:[ - "/ sv borderColor:(Color gray:5). - sv borderColor:(Color black). + sv ~~ inputView ifTrue:[ + (sv bounds intersects:r) ifTrue:[ + "/ sv borderColor:(Color gray:5). + sv borderColor:(Color black). - sv withAllSubViewsDo:[:v| - v fill:v viewBackground. - v exposeX:0 y:0 width:v width height:v height. - ] - ] - ] + sv withAllSubViewsDo:[:v| + v realized ifTrue:[ + v fill:v viewBackground. + v exposeX:0 y:0 width:v width height:v height. + ] + ] + ] + ] ]. selection := currSel. @@ -696,24 +698,24 @@ point := device translatePoint:0@0 from:(aView id) to:(root id). (point x > 0 and:[point y > 0]) ifTrue:[ - point := point + extent. - (point x < root width and:[point y < root height]) ifTrue:[ - aView topView raise. - device sync. - aView invalidate. - aView windowGroup processExposeEvents. - displayObject := Image fromView:aView grab:false. - ] + point := point + extent. + (point x < root width and:[point y < root height]) ifTrue:[ + aView topView raise. + device sync. + aView invalidate. + aView windowGroup processExposeEvents. + displayObject := Image fromView:aView grab:false. + ] ]. displayObject isNil ifTrue:[ - displayObject := Form extent:extent depth:1. - displayObject colorMap:(Array with:Color white with:Color black). - displayObject fill:(Color colorId:0). - displayObject paint:(Color colorId:1). - displayObject displayRectangleX:0 y:0 width:aView extent x height:aView extent y. + displayObject := Form extent:extent depth:1. + displayObject colorMap:(Array with:Color white with:Color black). + displayObject fill:(Color colorId:0). + displayObject paint:(Color colorId:1). + displayObject displayRectangleX:0 y:0 width:aView extent x height:aView extent y. ]. aSpec class == UISubSpecification ifTrue:[ - aSpec layout:(LayoutOrigin fromPoint:0@0) + aSpec layout:(LayoutOrigin fromPoint:0@0) ]. inst := self new.