UIGalleryView.st
changeset 1120 230fe13c4e51
parent 1113 aec10e7dbe80
child 1127 41253026b070
equal deleted inserted replaced
1119:556bb6c9e36c 1120:230fe13c4e51
     1 "
     1 "
     2  COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG
     2  COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG
     3               All Rights Reserved
     3 	      All Rights Reserved
     4 
     4 
     5  This software is furnished under a license and may be used
     5  This software is furnished under a license and may be used
     6  only in accordance with the terms of that license and with the
     6  only in accordance with the terms of that license and with the
     7  inclusion of the above copyright notice.   This software may not
     7  inclusion of the above copyright notice.   This software may not
     8  be provided or otherwise made available to, or used by, any
     8  be provided or otherwise made available to, or used by, any
    37 !UIGalleryView class methodsFor:'documentation'!
    37 !UIGalleryView class methodsFor:'documentation'!
    38 
    38 
    39 copyright
    39 copyright
    40 "
    40 "
    41  COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG
    41  COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG
    42               All Rights Reserved
    42 	      All Rights Reserved
    43 
    43 
    44  This software is furnished under a license and may be used
    44  This software is furnished under a license and may be used
    45  only in accordance with the terms of that license and with the
    45  only in accordance with the terms of that license and with the
    46  inclusion of the above copyright notice.   This software may not
    46  inclusion of the above copyright notice.   This software may not
    47  be provided or otherwise made available to, or used by, any
    47  be provided or otherwise made available to, or used by, any
    58     into other components by drag & drop or copy @ paste. The objects
    58     into other components by drag & drop or copy @ paste. The objects
    59     which are draged/droped must be kind of UISpecification's.
    59     which are draged/droped must be kind of UISpecification's.
    60     The UISelectionPanel used by the UIPainter is implemented in this way.
    60     The UISelectionPanel used by the UIPainter is implemented in this way.
    61 
    61 
    62     [author:]
    62     [author:]
    63         Claus Gittinger
    63 	Claus Gittinger
    64         Claus Atzkern
    64 	Claus Atzkern
    65 
    65 
    66     [see also:]
    66     [see also:]
    67         UIPainter
    67 	UIPainter
    68         UISelectionPanel
    68 	UISelectionPanel
    69 "
    69 "
    70 
    70 
    71 !
    71 !
    72 
    72 
    73 examples
    73 examples
    74 "
    74 "
    75     opens a gallery
    75     opens a gallery
    76 
    76 
    77                                                                         [exBegin]
    77 									[exBegin]
    78     |top sel|
    78     |top sel|
    79 
    79 
    80     top := StandardSystemView new label:'gallery'; extent:500@300.
    80     top := StandardSystemView new label:'gallery'; extent:500@300.
    81     sel := UIGalleryView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
    81     sel := UIGalleryView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
    82 
    82 
    83     sel labels:#(    'Buttons'
    83     sel labels:#(    'Buttons'
    84                      'Panels'
    84 		     'Panels'
    85                      'Text'
    85 		     'Text'
    86                    ).
    86 		   ).
    87 
    87 
    88     sel minorKeys:#( #standardButtonToggle
    88     sel minorKeys:#( #standardButtonToggle
    89                      #standardPanels
    89 		     #standardPanels
    90                      #standardText
    90 		     #standardText
    91                    ).
    91 		   ).
    92 
    92 
    93     sel majorKey:UISelectionPanel.
    93     sel majorKey:UISelectionPanel.
    94     top open.
    94     top open.
    95                                                                         [exEnd]
    95 									[exEnd]
    96 "
    96 "
    97 ! !
    97 ! !
    98 
    98 
    99 !UIGalleryView methodsFor:'accessing'!
    99 !UIGalleryView methodsFor:'accessing'!
   100 
   100 
   137     |appl|
   137     |appl|
   138 
   138 
   139     appl := self application.
   139     appl := self application.
   140 
   140 
   141     appl notNil ifTrue:[
   141     appl notNil ifTrue:[
   142         majorKey := appl resolveName:aKey
   142 	majorKey := appl resolveName:aKey
   143     ] ifFalse:[
   143     ] ifFalse:[
   144         majorKey := Smalltalk resolveName:aKey inClass:self class
   144 	majorKey := Smalltalk resolveName:aKey inClass:self class
   145     ].
   145     ].
   146     self selection:nil
   146     self selection:nil
   147 !
   147 !
   148 
   148 
   149 minorKeys
   149 minorKeys
   193 minorKeysHolder:aValueHolder
   193 minorKeysHolder:aValueHolder
   194     "set the holder keeping the minor keys; the selectors to access
   194     "set the holder keeping the minor keys; the selectors to access
   195      specifications from a class associated with the majorKey.
   195      specifications from a class associated with the majorKey.
   196     "
   196     "
   197     minorKeysHolder notNil ifTrue:[
   197     minorKeysHolder notNil ifTrue:[
   198         minorKeysHolder removeDependent:self. 
   198 	minorKeysHolder removeDependent:self. 
   199     ].
   199     ].
   200 
   200 
   201     (minorKeysHolder := aValueHolder) notNil ifTrue:[
   201     (minorKeysHolder := aValueHolder) notNil ifTrue:[
   202         minorKeysHolder addDependent:self.
   202 	minorKeysHolder addDependent:self.
   203     ].
   203     ].
   204     self minorKeys:(minorKeysHolder value)
   204     self minorKeys:(minorKeysHolder value)
   205 ! !
   205 ! !
   206 
   206 
   207 !UIGalleryView methodsFor:'change & update'!
   207 !UIGalleryView methodsFor:'change & update'!
   212     |specification selector selection application|
   212     |specification selector selection application|
   213 
   213 
   214     selection := tabRaw listIndexOf:something.
   214     selection := tabRaw listIndexOf:something.
   215 
   215 
   216     minorKeysHolder notNil ifTrue:[
   216     minorKeysHolder notNil ifTrue:[
   217         minorKeys := minorKeysHolder value.
   217 	minorKeys := minorKeysHolder value.
   218     ].
   218     ].
   219     (selection notNil and:[minorKeys size >= selection]) ifTrue:[
   219     (selection notNil and:[minorKeys size >= selection]) ifTrue:[
   220         selector := minorKeys at:selection.
   220 	selector := minorKeys at:selection.
   221 
   221 
   222         (majorKey respondsTo:selector) ifTrue:[
   222 	(majorKey respondsTo:selector) ifTrue:[
   223             specification := majorKey perform:selector
   223 	    specification := majorKey perform:selector
   224         ] ifFalse:[
   224 	] ifFalse:[
   225             (application := self application) notNil ifTrue:[
   225 	    (application := self application) notNil ifTrue:[
   226                 Object messageNotUnderstoodSignal handle:[:ex|
   226 		Object messageNotUnderstoodSignal handle:[:ex|
   227                     (application class respondsTo:selector) ifTrue:[
   227 		    (application class respondsTo:selector) ifTrue:[
   228                         specification := application class perform:selector
   228 			specification := application class perform:selector
   229                     ]
   229 		    ]
   230                 ] do:[
   230 		] do:[
   231                     specification := application aspectFor:selector
   231 		    specification := application aspectFor:selector
   232                 ]
   232 		]
   233             ]
   233 	    ]
   234         ]
   234 	]
   235     ].
   235     ].
   236     canvas specification:specification.
   236     canvas specification:specification.
   237 
   237 
   238 !
   238 !
   239 
   239 
   243 
   243 
   244 update:something with:aParameter from:changedObject
   244 update:something with:aParameter from:changedObject
   245     "one of my models changed its value
   245     "one of my models changed its value
   246     "
   246     "
   247     changedObject == minorKeysHolder ifTrue:[
   247     changedObject == minorKeysHolder ifTrue:[
   248         ^ self minorKeys:( minorKeysHolder value)
   248 	^ self minorKeys:( minorKeysHolder value)
   249     ].
   249     ].
   250     super update:something with:aParameter from:changedObject.
   250     super update:something with:aParameter from:changedObject.
   251 
   251 
   252 ! !
   252 ! !
   253 
   253 
   254 !UIGalleryView methodsFor:'initialize / release'!
   254 !UIGalleryView methodsFor:'initialize / release'!
   255 
   255 
   256 destroy
   256 destroy
   257     minorKeysHolder notNil ifTrue:[
   257     minorKeysHolder notNil ifTrue:[
   258         minorKeysHolder removeDependent:self. 
   258 	minorKeysHolder removeDependent:self. 
   259         minorKeysHolder := nil.
   259 	minorKeysHolder := nil.
   260     ].
   260     ].
   261     super destroy.
   261     super destroy.
   262 !
   262 !
   263 
   263 
   264 initialize
   264 initialize
   298 clientSpecHolder:aHolder
   298 clientSpecHolder:aHolder
   299     "set the holder which keeps the current selection or in case of
   299     "set the holder which keeps the current selection or in case of
   300      no selection the specification under the cursor
   300      no selection the specification under the cursor
   301     "
   301     "
   302     (clientSpecHolder := aHolder) notNil ifTrue:[
   302     (clientSpecHolder := aHolder) notNil ifTrue:[
   303         clientSpecHolder value:selection
   303 	clientSpecHolder value:selection
   304     ].
   304     ].
   305 !
   305 !
   306 
   306 
   307 menuSelector
   307 menuSelector
   308     "return the value of the instance variable 'menuSelector' (automatically generated)"
   308     "return the value of the instance variable 'menuSelector' (automatically generated)"
   328     |builder|
   328     |builder|
   329 
   329 
   330     self selection:nil.
   330     self selection:nil.
   331 
   331 
   332     self subViews copy do:[:aSubView|
   332     self subViews copy do:[:aSubView|
   333         aSubView ~~ inputView ifTrue:[
   333 	aSubView ~~ inputView ifTrue:[
   334             aSubView destroy
   334 	    aSubView destroy
   335         ]
   335 	]
   336     ].
   336     ].
   337 
   337 
   338     aSpecOrSpecArray notNil ifTrue:[
   338     aSpecOrSpecArray notNil ifTrue:[
   339         specification := UISpecification from:aSpecOrSpecArray.
   339 	specification := UISpecification from:aSpecOrSpecArray.
   340 
   340 
   341         (specification respondsTo:#buildViewFor:in:) ifFalse:[
   341 	(specification respondsTo:#buildViewFor:in:) ifFalse:[
   342             specification := nil.
   342 	    specification := nil.
   343           ^ self
   343 	  ^ self
   344         ].
   344 	].
   345         (builder := uiBuilder) isNil ifTrue:[
   345 	(builder := uiBuilder) isNil ifTrue:[
   346             builder := UIBuilder new isEditing:true.
   346 	    builder := UIBuilder new isEditing:true.
   347             builder showDefaults:true.
   347 	    builder showDefaults:true.
   348         ].
   348 	].
   349 
   349 
   350         specification buildViewFor:builder in:self.
   350 	specification buildViewFor:builder in:self.
   351 
   351 
   352         subViews do:[:v|
   352 	subViews do:[:v|
   353             (v ~~ inputView and:[(self findSpecFor:v) notNil]) ifTrue:[
   353 	    (v ~~ inputView and:[(self findSpecFor:v) notNil]) ifTrue:[
   354                 v borderWidth:1.
   354 		v borderWidth:1.
   355             ]
   355 	    ]
   356         ].
   356 	].
   357         self shown ifTrue:[
   357 	self shown ifTrue:[
   358             self realizeAllSubViews.
   358 	    self realizeAllSubViews.
   359             inputView raise
   359 	    inputView raise
   360         ]
   360 	]
   361     ] ifFalse:[
   361     ] ifFalse:[
   362         specification := nil
   362 	specification := nil
   363     ]
   363     ]
   364 
   364 
   365 
   365 
   366 
   366 
   367 ! !
   367 ! !
   372     "build spec out of spec
   372     "build spec out of spec
   373     "
   373     "
   374     |spec comp coll|
   374     |spec comp coll|
   375 
   375 
   376     (aSpec notNil and:[aSpec canUIDrag]) ifFalse:[
   376     (aSpec notNil and:[aSpec canUIDrag]) ifFalse:[
   377         ^ nil
   377 	^ nil
   378     ].
   378     ].
   379 
   379 
   380     spec := aSpec copy.
   380     spec := aSpec copy.
   381 
   381 
   382     (aSpec class supportsSubComponents and:[aSpec component notNil]) ifFalse:[
   382     (aSpec class supportsSubComponents and:[aSpec component notNil]) ifFalse:[
   383         ^ spec
   383 	^ spec
   384     ].
   384     ].
   385     comp := aSpec component.
   385     comp := aSpec component.
   386     spec component:nil.
   386     spec component:nil.
   387 
   387 
   388     comp canUIDrag ifFalse:[
   388     comp canUIDrag ifFalse:[
   389       ^ spec
   389       ^ spec
   390     ].
   390     ].
   391     coll := OrderedCollection new.
   391     coll := OrderedCollection new.
   392 
   392 
   393     comp do:[:anEntry||spc|
   393     comp do:[:anEntry||spc|
   394         (spc := self buildSpecFrom:anEntry) notNil ifTrue:[
   394 	(spc := self buildSpecFrom:anEntry) notNil ifTrue:[
   395             coll add:spc
   395 	    coll add:spc
   396         ]
   396 	]
   397     ].
   397     ].
   398     coll isEmpty ifTrue:[
   398     coll isEmpty ifTrue:[
   399       ^ spec
   399       ^ spec
   400     ].
   400     ].
   401     comp := comp copy.
   401     comp := comp copy.
   416     |dragObj spec name|
   416     |dragObj spec name|
   417 
   417 
   418     spec := self findSpecFor:selection.
   418     spec := self findSpecFor:selection.
   419 
   419 
   420     spec notNil ifTrue:[
   420     spec notNil ifTrue:[
   421         spec := self buildSpecFrom:spec.
   421 	spec := self buildSpecFrom:spec.
   422         name := spec className asString.
   422 	name := spec className asString.
   423         name := name copyFrom:1 to:(name size - ('Spec' size) + 1). 
   423 	name := name copyFrom:1 to:(name size - ('Spec' size) + 1). 
   424         name at:1 put:(name at:1) asLowercase.
   424 	name at:1 put:(name at:1) asLowercase.
   425         name at:(name size) put:$1.
   425 	name at:(name size) put:$1.
   426         spec name:name.
   426 	spec name:name.
   427 
   427 
   428         self showUnselected.
   428 	self showUnselected.
   429         dragObj := DropSpec for:selection specification:spec.
   429 	dragObj := DropSpec for:selection specification:spec.
   430         "/ self showSelected.
   430 	"/ self showSelected.
   431         DragAndDropManager startDrag:dragObj from:inputView.
   431 	DragAndDropManager startDrag:dragObj from:inputView.
   432     ]
   432     ]
   433 
   433 
   434 !
   434 !
   435 
   435 
   436 startDragWithOffset:offs
   436 startDragWithOffset:offs
   439     |dragObj spec o|
   439     |dragObj spec o|
   440 
   440 
   441     spec := self findSpecFor:selection.
   441     spec := self findSpecFor:selection.
   442 
   442 
   443     spec notNil ifTrue:[
   443     spec notNil ifTrue:[
   444         spec := self buildSpecFrom:spec.
   444 	spec := self buildSpecFrom:spec.
   445         spec name:(spec copy userFriendlyName, $1).
   445 	spec name:(spec copy userFriendlyName, $1).
   446 
   446 
   447         self showUnselected.
   447 	self showUnselected.
   448         dragObj := DropSpec for:selection specification:spec.
   448 	dragObj := DropSpec for:selection specification:spec.
   449         "/ self showSelected.
   449 	"/ self showSelected.
   450 
   450 
   451         o := lastClickPoint - selection origin.
   451 	o := lastClickPoint - selection origin.
   452 
   452 
   453         DragAndDropManager 
   453 	DragAndDropManager 
   454             startDrag:dragObj 
   454 	    startDrag:dragObj 
   455             from:inputView
   455 	    from:inputView
   456             offset:o.
   456 	    offset:o.
   457     ]
   457     ]
   458 
   458 
   459     "Created: 11.8.1997 / 00:44:17 / cg"
   459     "Created: 11.8.1997 / 00:44:17 / cg"
   460     "Modified: 11.8.1997 / 00:48:35 / cg"
   460     "Modified: 11.8.1997 / 00:48:35 / cg"
   461 ! !
   461 ! !
   466     "start a drag on selection
   466     "start a drag on selection
   467     "
   467     "
   468     |sensor|
   468     |sensor|
   469 
   469 
   470     (state ~~ 0 and:[lastClickPoint notNil and:[selection notNil]]) ifTrue:[
   470     (state ~~ 0 and:[lastClickPoint notNil and:[selection notNil]]) ifTrue:[
   471         sensor := self sensor.
   471 	sensor := self sensor.
   472         sensor anyButtonPressed ifTrue:[
   472 	sensor anyButtonPressed ifTrue:[
   473             (lastClickPoint dist:(x@y)) > 10.0 ifTrue:[
   473 	    (lastClickPoint dist:(x@y)) > 10.0 ifTrue:[
   474                 ^ self startDragWithOffset:(x@y) - lastClickPoint
   474 		^ self startDragWithOffset:(x@y) - lastClickPoint
   475             ]
   475 	    ]
   476         ]
   476 	]
   477     ]
   477     ]
   478 !
   478 !
   479 
   479 
   480 buttonPress:button x:x y:y
   480 buttonPress:button x:x y:y
   481     "change selection
   481     "change selection
   482     "
   482     "
   483     |application|
   483     |application|
   484 
   484 
   485     button == 1 ifTrue:[
   485     button == 1 ifTrue:[
   486         lastClickPoint := Point x:x y:y.
   486 	lastClickPoint := Point x:x y:y.
   487         self selection:(self findObjectAtX:x y:y).
   487 	self selection:(self findObjectAtX:x y:y).
   488     ]  ifFalse:[
   488     ]  ifFalse:[
   489         lastClickPoint := nil.
   489 	lastClickPoint := nil.
   490 
   490 
   491         (menuSelector notNil and:[(application := self application) notNil]) ifTrue:[
   491 	(menuSelector notNil and:[(application := self application) notNil]) ifTrue:[
   492             Object messageNotUnderstoodSignal handle:[:ex|
   492 	    Object messageNotUnderstoodSignal handle:[:ex|
   493             ] do:[
   493 	    ] do:[
   494                 application aspectFor:menuSelector
   494 		application aspectFor:menuSelector
   495             ]
   495 	    ]
   496         ]
   496 	]
   497     ]
   497     ]
   498 
   498 
   499 !
   499 !
   500 
   500 
   501 exposeX:x y:y width:w height:h
   501 exposeX:x y:y width:w height:h
   502     "handle an expose event from device; redraw selection
   502     "handle an expose event from device; redraw selection
   503     "
   503     "
   504     super exposeX:x y:y width:w height:h.
   504     super exposeX:x y:y width:w height:h.
   505 
   505 
   506     (selection notNil and:[self sensor hasExposeEventFor:selection]) ifFalse:[
   506     (selection notNil and:[self sensor hasExposeEventFor:selection]) ifFalse:[
   507         self showSelected.
   507 	self showSelected.
   508     ].
   508     ].
   509 
   509 
   510 
   510 
   511 !
   511 !
   512 
   512 
   545     id    := inputView id.
   545     id    := inputView id.
   546 
   546 
   547     subViews do:[:v|
   547     subViews do:[:v|
   548 	|pX pY|
   548 	|pX pY|
   549 
   549 
   550         v ~~ inputView ifTrue:[
   550 	v ~~ inputView ifTrue:[
   551             p := device translatePoint:point from:id to:(v id).
   551 	    p := device translatePoint:point from:id to:(v id).
   552 	    pX := p x.
   552 	    pX := p x.
   553 	    pY := p y.
   553 	    pY := p y.
   554             (     pX >= 0 and:[pX <= v width
   554 	    (     pX >= 0 and:[pX <= v width
   555              and:[pY >= 0 and:[pY <= v height
   555 	     and:[pY >= 0 and:[pY <= v height
   556              and:[(self findSpecFor:v) notNil]]]]
   556 	     and:[(self findSpecFor:v) notNil]]]]
   557             ) ifTrue:[
   557 	    ) ifTrue:[
   558                 ^ v
   558 		^ v
   559             ]
   559 	    ]
   560         ]
   560 	]
   561     ].
   561     ].
   562   ^ nil
   562   ^ nil
   563 
   563 
   564 
   564 
   565 !
   565 !
   568     "returns subspec assigned to instance or nil
   568     "returns subspec assigned to instance or nil
   569     "
   569     "
   570     |name|
   570     |name|
   571 
   571 
   572     anObject notNil ifTrue:[
   572     anObject notNil ifTrue:[
   573         name := anObject name.
   573 	name := anObject name.
   574 
   574 
   575         specification do:[:aSpec|
   575 	specification do:[:aSpec|
   576             aSpec name = name ifTrue:[
   576 	    aSpec name = name ifTrue:[
   577                 aSpec canUIDrag ifTrue:[^ aSpec]
   577 		aSpec canUIDrag ifTrue:[^ aSpec]
   578                                ifFalse:[^ nil]
   578 			       ifFalse:[^ nil]
   579             ]
   579 	    ]
   580         ]
   580 	]
   581     ].
   581     ].
   582     ^ nil
   582     ^ nil
   583 
   583 
   584 
   584 
   585 ! !
   585 ! !
   589 handlesOf:aComponent do:aOneArgBlock
   589 handlesOf:aComponent do:aOneArgBlock
   590     "evaluate the block on each handle; the argument to the block
   590     "evaluate the block on each handle; the argument to the block
   591      is a rectangle
   591      is a rectangle
   592     "
   592     "
   593     aComponent notNil ifTrue:[
   593     aComponent notNil ifTrue:[
   594         aOneArgBlock value:(aComponent origin       - (2@2) extent:6@6).
   594 	aOneArgBlock value:(aComponent origin       - (2@2) extent:6@6).
   595         aOneArgBlock value:(aComponent corner       - (1@1) extent:6@6).
   595 	aOneArgBlock value:(aComponent corner       - (1@1) extent:6@6).
   596         aOneArgBlock value:(aComponent topRight     - (1@2) extent:6@6).
   596 	aOneArgBlock value:(aComponent topRight     - (1@2) extent:6@6).
   597         aOneArgBlock value:(aComponent bottomLeft   - (2@1) extent:6@6).
   597 	aOneArgBlock value:(aComponent bottomLeft   - (2@1) extent:6@6).
   598         aOneArgBlock value:(aComponent leftCenter   - (2@0) extent:6@6).
   598 	aOneArgBlock value:(aComponent leftCenter   - (2@0) extent:6@6).
   599         aOneArgBlock value:(aComponent rightCenter  - (1@0) extent:6@6).
   599 	aOneArgBlock value:(aComponent rightCenter  - (1@0) extent:6@6).
   600         aOneArgBlock value:(aComponent topCenter    - (0@2) extent:6@6).
   600 	aOneArgBlock value:(aComponent topCenter    - (0@2) extent:6@6).
   601         aOneArgBlock value:(aComponent bottomCenter - (0@1) extent:6@6).
   601 	aOneArgBlock value:(aComponent bottomCenter - (0@1) extent:6@6).
   602     ]
   602     ]
   603 
   603 
   604 
   604 
   605 !
   605 !
   606 
   606 
   608     "selection changed
   608     "selection changed
   609     "
   609     "
   610     |spec|
   610     |spec|
   611 
   611 
   612     selection ~~ anObject ifTrue:[
   612     selection ~~ anObject ifTrue:[
   613         self showUnselected.
   613 	self showUnselected.
   614         spec := self findSpecFor:anObject.
   614 	spec := self findSpecFor:anObject.
   615 
   615 
   616         spec notNil ifTrue:[
   616 	spec notNil ifTrue:[
   617             selection := anObject.
   617 	    selection := anObject.
   618             self showSelected
   618 	    self showSelected
   619         ] ifFalse:[
   619 	] ifFalse:[
   620             selection := nil
   620 	    selection := nil
   621         ].
   621 	].
   622         clientSpecHolder notNil ifTrue:[
   622 	clientSpecHolder notNil ifTrue:[
   623             clientSpecHolder value:spec
   623 	    clientSpecHolder value:spec
   624         ]
   624 	]
   625     ]
   625     ]
   626 
   626 
   627 
   627 
   628 !
   628 !
   629 
   629 
   631     "show selected
   631     "show selected
   632     "
   632     "
   633     shown ifFalse:[^ self].
   633     shown ifFalse:[^ self].
   634 
   634 
   635     selection notNil ifTrue:[
   635     selection notNil ifTrue:[
   636         self clippedByChildren:false.
   636 	self clippedByChildren:false.
   637 
   637 
   638         self handlesOf:selection do:[:aRectangle|
   638 	self handlesOf:selection do:[:aRectangle|
   639             self fillRectangle:aRectangle
   639 	    self fillRectangle:aRectangle
   640         ].
   640 	].
   641         self clippedByChildren:true.
   641 	self clippedByChildren:true.
   642     ].
   642     ].
   643 
   643 
   644 
   644 
   645 !
   645 !
   646 
   646 
   648     "show unselected
   648     "show unselected
   649     "
   649     "
   650     |r currSel|
   650     |r currSel|
   651 
   651 
   652     (currSel := selection) isNil ifTrue:[
   652     (currSel := selection) isNil ifTrue:[
   653         ^ self
   653 	^ self
   654     ].
   654     ].
   655     shown ifFalse:[^ self].
   655     shown ifFalse:[^ self].
   656     selection := nil.
   656     selection := nil.
   657 
   657 
   658     self clippedByChildren:false.
   658     self clippedByChildren:false.
   659 
   659 
   660     self handlesOf:currSel do:[:aRectangle|
   660     self handlesOf:currSel do:[:aRectangle|
   661         self clearRectangle:aRectangle
   661 	self clearRectangle:aRectangle
   662     ].
   662     ].
   663     self clippedByChildren:true.
   663     self clippedByChildren:true.
   664     r := currSel bounds.
   664     r := currSel bounds.
   665 
   665 
   666     subViews do:[:sv|
   666     subViews do:[:sv|
   667         |absOrg absFrame|
   667 	|absOrg absFrame|
   668 
   668 
   669         sv ~~ inputView ifTrue:[
   669 	sv ~~ inputView ifTrue:[
   670             (sv bounds intersects:r) ifTrue:[
   670 	    (sv bounds intersects:r) ifTrue:[
   671                 "/ sv borderColor:(Color gray:5).
   671 		"/ sv borderColor:(Color gray:5).
   672                 sv borderColor:(Color black).
   672 		sv borderColor:(Color black).
   673 
   673 
   674                 sv withAllSubViewsDo:[:v|
   674 		sv withAllSubViewsDo:[:v|
   675                     v fill:v viewBackground.
   675 		    v realized ifTrue:[
   676                     v exposeX:0 y:0 width:v width height:v height.
   676 			v fill:v viewBackground.
   677                 ]
   677 			v exposeX:0 y:0 width:v width height:v height.
   678             ]
   678 		    ]
   679         ]
   679 		]
       
   680 	    ]
       
   681 	]
   680     ].
   682     ].
   681     selection := currSel.
   683     selection := currSel.
   682 
   684 
   683     "Modified: / 9.11.1998 / 12:49:57 / cg"
   685     "Modified: / 9.11.1998 / 12:49:57 / cg"
   684 ! !
   686 ! !
   694     root   := device rootView.
   696     root   := device rootView.
   695     extent := aView extent.
   697     extent := aView extent.
   696     point  := device translatePoint:0@0 from:(aView id) to:(root id).
   698     point  := device translatePoint:0@0 from:(aView id) to:(root id).
   697 
   699 
   698     (point x > 0 and:[point y > 0]) ifTrue:[
   700     (point x > 0 and:[point y > 0]) ifTrue:[
   699         point := point + extent.
   701 	point := point + extent.
   700         (point x < root width and:[point y < root height]) ifTrue:[
   702 	(point x < root width and:[point y < root height]) ifTrue:[
   701             aView topView raise.
   703 	    aView topView raise.
   702             device sync.
   704 	    device sync.
   703             aView invalidate.
   705 	    aView invalidate.
   704             aView windowGroup processExposeEvents.
   706 	    aView windowGroup processExposeEvents.
   705             displayObject := Image fromView:aView grab:false.
   707 	    displayObject := Image fromView:aView grab:false.
   706         ]
   708 	]
   707     ].
   709     ].
   708     displayObject isNil ifTrue:[
   710     displayObject isNil ifTrue:[
   709         displayObject := Form extent:extent depth:1.
   711 	displayObject := Form extent:extent depth:1.
   710         displayObject colorMap:(Array with:Color white with:Color black).
   712 	displayObject colorMap:(Array with:Color white with:Color black).
   711         displayObject fill:(Color colorId:0).
   713 	displayObject fill:(Color colorId:0).
   712         displayObject paint:(Color colorId:1).
   714 	displayObject paint:(Color colorId:1).
   713         displayObject displayRectangleX:0 y:0 width:aView extent x height:aView extent y.
   715 	displayObject displayRectangleX:0 y:0 width:aView extent x height:aView extent y.
   714     ].
   716     ].
   715     aSpec class == UISubSpecification ifTrue:[
   717     aSpec class == UISubSpecification ifTrue:[
   716         aSpec layout:(LayoutOrigin fromPoint:0@0)
   718 	aSpec layout:(LayoutOrigin fromPoint:0@0)
   717     ].
   719     ].
   718 
   720 
   719     inst := self new.
   721     inst := self new.
   720     inst displayObject:displayObject.
   722     inst displayObject:displayObject.
   721     inst theObject:aSpec.
   723     inst theObject:aSpec.