UIObjectView.st
changeset 768 2ef5b8bed914
parent 624 26e7978936fc
child 777 ce2a772e73fa
equal deleted inserted replaced
767:ed96f735dab1 768:2ef5b8bed914
   875     self invertOutlineOf:object
   875     self invertOutlineOf:object
   876 ! !
   876 ! !
   877 
   877 
   878 !UIObjectView methodsFor:'private handles'!
   878 !UIObjectView methodsFor:'private handles'!
   879 
   879 
       
   880 handleAffectedViews:aViewOrSeqOfViews
       
   881     "update affected views
       
   882     "
       
   883     |bw|
       
   884 
       
   885     self forEach:aViewOrSeqOfViews do:[:v|
       
   886         v shown ifTrue:[
       
   887             v fill:v viewBackground.
       
   888             bw := v borderWidth.
       
   889             bw ~~ 0 ifTrue:[
       
   890                 v borderWidth:(bw - 1).
       
   891                 v borderWidth:bw.
       
   892             ].
       
   893             v exposeX:0 y:0 width:9999 height:9999
       
   894         ]
       
   895     ]
       
   896 !
       
   897 
   880 handlesOf:aComponent do:aTwoArgAction
   898 handlesOf:aComponent do:aTwoArgAction
   881     "perform action on each handle of a component
   899     "perform action on each handle of a component
   882     "
   900     "
   883     |dlt ext|
   901     |dlt ext|
   884 
   902 
   915 !
   933 !
   916 
   934 
   917 showUnselected:aComponent
   935 showUnselected:aComponent
   918     "show object unselected
   936     "show object unselected
   919     "
   937     "
       
   938     self showUnselected:aComponent addAffectedViewsTo:nil
       
   939 !
       
   940 
       
   941 showUnselected:aComponent addAffectedViewsTo:aSet
       
   942     "show object unselected. If the set, an IdentitySet, is not nil, the
       
   943      affected subviews are added into the set, otherwise an expose event
       
   944      to each affected cpomponent is raised.
       
   945     "
   920     |wasClipped r|
   946     |wasClipped r|
   921 
   947 
   922     selectionHiddenLevel ~~ 0 ifTrue:[^ self].
   948     selectionHiddenLevel ~~ 0 ifTrue:[^ self].
   923 
   949 
   924     (wasClipped := clipChildren) ifTrue:[
   950     (wasClipped := clipChildren) ifTrue:[
   930     wasClipped ifTrue:[
   956     wasClipped ifTrue:[
   931         self clippedByChildren:(clipChildren := true). 
   957         self clippedByChildren:(clipChildren := true). 
   932     ].
   958     ].
   933 
   959 
   934     "/ must redraw all components which are affected b the handles
   960     "/ must redraw all components which are affected b the handles
   935 
       
   936     r := (aComponent originRelativeTo:self) - (3@3) extent:(aComponent extent + (6@6)).
   961     r := (aComponent originRelativeTo:self) - (3@3) extent:(aComponent extent + (6@6)).
   937 
   962 
   938     subViews do:[:anotherComponent |
   963     subViews do:[:anotherComponent |
   939         |absOrg absFrame|
   964         |absOrg absFrame|
   940 
   965 
   942             absOrg := anotherComponent originRelativeTo:self.
   967             absOrg := anotherComponent originRelativeTo:self.
   943             absFrame := absOrg extent:(anotherComponent extent).
   968             absFrame := absOrg extent:(anotherComponent extent).
   944             (absFrame intersects:r) ifTrue:[
   969             (absFrame intersects:r) ifTrue:[
   945                 anotherComponent withAllSubViewsDo:[:v |
   970                 anotherComponent withAllSubViewsDo:[:v |
   946                     v shown ifTrue:[
   971                     v shown ifTrue:[
   947                         v fill:v viewBackground.
   972                         aSet notNil ifTrue:[
   948                         v exposeX:0 y:0 width:9999 height:9999.
   973                             aSet add:v
       
   974                         ] ifFalse:[
       
   975                             self handleAffectedViews:v
       
   976                         ]
   949                     ]
   977                     ]
   950                 ]
   978                 ]
   951             ]
   979             ]
   952         ]
   980         ]
   953     ]
   981     ].
   954 
   982 
   955     "Modified: 8.4.1997 / 00:32:26 / cg"
       
   956 !
   983 !
   957 
   984 
   958 whichHandleOf:aComponent isHitBy:aPoint
   985 whichHandleOf:aComponent isHitBy:aPoint
   959     "returns kind of handle or nil
   986     "returns kind of handle or nil
   960     "
   987     "
  1156 
  1183 
  1157 ! !
  1184 ! !
  1158 
  1185 
  1159 !UIObjectView methodsFor:'selections'!
  1186 !UIObjectView methodsFor:'selections'!
  1160 
  1187 
       
  1188 hideSelection
       
  1189     "hide the selection - undraw hilights - whatever that is"
       
  1190 
       
  1191     |aSet|
       
  1192 
       
  1193     self selectionDo:[:object|
       
  1194         aSet isNil ifTrue:[
       
  1195             aSet := IdentitySet new
       
  1196         ].
       
  1197         self showUnselected:object addAffectedViewsTo:aSet.
       
  1198     ].
       
  1199     self handleAffectedViews:aSet.
       
  1200 
       
  1201 
       
  1202 !
       
  1203 
  1161 moveableSelection
  1204 moveableSelection
  1162     "checks whether the selection is not empty and all selected instances
  1205     "checks whether the selection is not empty and all selected instances
  1163      can be moved. If true the selection is returned otherwise nil
  1206      can be moved. If true the selection is returned otherwise nil
  1164     "
  1207     "
  1165     |coll|
  1208     |coll|
  1241     "apply block with selection hidden (no handles)
  1284     "apply block with selection hidden (no handles)
  1242     "
  1285     "
  1243     |coll|
  1286     |coll|
  1244 
  1287 
  1245     selectionHiddenLevel == 0 ifTrue:[
  1288     selectionHiddenLevel == 0 ifTrue:[
  1246         self selectionDo:[:aView| self showUnselected:aView].
  1289         self hideSelection.
  1247         device flush.
  1290         device flush.
  1248     ].
  1291     ].
  1249     selectionHiddenLevel := selectionHiddenLevel + 1.
  1292     selectionHiddenLevel := selectionHiddenLevel + 1.
  1250 
  1293 
  1251     aBlock valueNowOrOnUnwindDo:[
  1294     aBlock valueNowOrOnUnwindDo:[