UIObjectView.st
changeset 44 cb65ce16c150
child 47 5e4319953a0b
equal deleted inserted replaced
43:3dd91a85c243 44:cb65ce16c150
       
     1 ObjectView subclass:#UIObjectView
       
     2 	instanceVariableNames:'inputView testMode undoHistory copiedExtent resizedObject
       
     3 		resizeSelector createInWidget createFrame createdObject
       
     4 		createClass'
       
     5 	classVariableNames:''
       
     6 	poolDictionaries:''
       
     7 	category:'Interface-UIPainter'
       
     8 !
       
     9 
       
    10 
       
    11 !UIObjectView class methodsFor:'defaults'!
       
    12 
       
    13 defaultGrid
       
    14     ^ 4 @ 4
       
    15 
       
    16 !
       
    17 
       
    18 gridShown
       
    19     ^ false
       
    20 
       
    21 !
       
    22 
       
    23 handleSize
       
    24     "size of blob drawn for handles"
       
    25     ^ 4
       
    26 
       
    27 !
       
    28 
       
    29 hitDelta
       
    30     ^ 4
       
    31 
       
    32 ! !
       
    33 
       
    34 !UIObjectView methodsFor:'accessing'!
       
    35 
       
    36 gridParameters
       
    37     "used by defineGrid, and in a separate method for
       
    38      easier redefinition in subclasses. 
       
    39      Returns the grid parameters in an array of 7 elements,
       
    40      which control the appearance of the grid-pattern.
       
    41      the elements are:
       
    42 
       
    43         bigStepH        number of pixels horizontally between 2 major steps
       
    44         bigStepV        number of pixels vertically between 2 major steps
       
    45         littleStepH     number of pixels horizontally between 2 minor steps
       
    46         littleStepV     number of pixels vertically between 2 minor steps
       
    47         gridAlignH      number of pixels for horizontal grid align (pointer snap)
       
    48         gridAlignV      number of pixels for vertical grid align (pointer snap)
       
    49         docBounds       true, if document boundary should be shown
       
    50 
       
    51      if littleStepH/V are nil, only bigSteps are drawn.
       
    52     "
       
    53 
       
    54     ^ #(10 10 nil nil 10 10 false)
       
    55 
       
    56 
       
    57 !
       
    58 
       
    59 hideGrid
       
    60     gridShown ifTrue:[
       
    61         self withSelectionHiddenDo:[
       
    62             super hideGrid
       
    63         ]
       
    64     ]
       
    65 
       
    66 
       
    67 !
       
    68 
       
    69 showGrid
       
    70     self withSelectionHiddenDo:[
       
    71         super showGrid
       
    72     ]
       
    73 
       
    74     "Modified: 5.9.1995 / 12:47:46 / claus"
       
    75 
       
    76 
       
    77 !
       
    78 
       
    79 testMode
       
    80     "returns testMode
       
    81     "
       
    82     ^ testMode
       
    83 
       
    84 
       
    85 !
       
    86 
       
    87 testMode:aBoolean
       
    88     "change testMode
       
    89     "
       
    90     (aBoolean == testMode) ifFalse:[
       
    91         testMode := aBoolean.
       
    92 
       
    93         testMode ifTrue:[
       
    94             self unselect.
       
    95             inputView unrealize
       
    96         ] ifFalse:[
       
    97             inputView raise.
       
    98             inputView realize
       
    99         ]
       
   100     ]
       
   101 
       
   102 
       
   103 ! !
       
   104 
       
   105 !UIObjectView methodsFor:'cut & paste'!
       
   106 
       
   107 convertForPaste:something
       
   108     Transcript showCR:'convertForPaste'.
       
   109     ^ nil
       
   110 
       
   111 
       
   112 !
       
   113 
       
   114 deleteSelection
       
   115     "delete the selection
       
   116     "
       
   117     undoHistory transactionNamed:'delete' do:[
       
   118         super deleteSelection
       
   119     ].
       
   120 
       
   121 ! !
       
   122 
       
   123 !UIObjectView methodsFor:'dragging object move'!
       
   124 
       
   125 doObjectMove:aPoint
       
   126     "move selection
       
   127     "
       
   128 
       
   129     selection isCollection ifTrue:[^ self].
       
   130 
       
   131     movedObject isNil ifTrue:[
       
   132         (movedObject := selection) isNil ifTrue:[
       
   133             ^ self
       
   134         ].
       
   135         super unselect.
       
   136         moveDelta := aPoint - movedObject computeOrigin.
       
   137         self invertOutlineOf:movedObject
       
   138     ].
       
   139 
       
   140     self moveObject:movedObject to:(aPoint - moveDelta)
       
   141 
       
   142 
       
   143 !
       
   144 
       
   145 endObjectMove
       
   146     "cleanup after object move"
       
   147 
       
   148     movedObject notNil ifTrue:[
       
   149         self invertOutlineOf:movedObject.
       
   150         self setDefaultActions.
       
   151         self select:movedObject.
       
   152         movedObject := nil
       
   153     ].
       
   154 
       
   155     "Modified: 5.9.1995 / 12:20:31 / claus"
       
   156 
       
   157 
       
   158 !
       
   159 
       
   160 startObjectMove:aView at:aPoint
       
   161 
       
   162     super startObjectMove:aView at:aPoint.
       
   163 
       
   164     aView notNil ifTrue:[
       
   165         undoHistory transactionNamed:'move' do:[
       
   166             self undoBlockPositionChanged:aView
       
   167         ]
       
   168     ]
       
   169 
       
   170 
       
   171 !
       
   172 
       
   173 startSelectMoreOrMove:aPoint
       
   174     "add/remove to/from selection"
       
   175 
       
   176     |anObject|
       
   177 
       
   178     testMode ifTrue:[^ self].
       
   179 
       
   180     anObject := self findObjectAtVisible:aPoint.
       
   181     anObject notNil ifTrue:[
       
   182         (self isSelected:anObject) ifTrue:[
       
   183             self removeFromSelection:anObject
       
   184         ] ifFalse:[
       
   185             self addToSelection:anObject
       
   186         ]
       
   187     ]
       
   188 !
       
   189 
       
   190 startSelectOrMove:aPoint
       
   191     "a button is pressed at a point
       
   192     "
       
   193     |anObject b|
       
   194 
       
   195     testMode ifTrue:[^ self].
       
   196 
       
   197     "if there is one selection and point hits handle, start a resize
       
   198     "
       
   199     self singleSelection notNil ifTrue:[
       
   200         b := self whichHandleOf:selection isHitBy:aPoint.
       
   201 
       
   202         (b notNil and:[b ~~ #view]) ifTrue:[
       
   203             ^ self startResizeBorder:b of:selection at:aPoint.
       
   204         ]
       
   205     ].
       
   206 
       
   207     anObject := self findObjectAtVisible:aPoint.
       
   208 
       
   209     "nothing is selected
       
   210     "
       
   211     anObject isNil ifTrue:[
       
   212         ^ self unselect
       
   213     ].
       
   214 
       
   215     "object not in selection; clear selection and add anObject to selection
       
   216     "
       
   217     (self isSelected:anObject) ifFalse:[
       
   218         super unselect.
       
   219         self select:anObject.
       
   220     ] ifTrue:[
       
   221         selection isCollection ifTrue:[
       
   222             ^ self removeFromSelection:anObject.
       
   223         ]
       
   224     ].
       
   225 
       
   226     "prepare move operation for an object
       
   227     "
       
   228     motionAction := [:movePoint|
       
   229         (aPoint dist:movePoint) > 2.0 ifTrue:[
       
   230             self startObjectMove:anObject at:aPoint
       
   231         ]
       
   232     ].
       
   233     releaseAction := [self setDefaultActions].
       
   234 
       
   235 
       
   236 ! !
       
   237 
       
   238 !UIObjectView methodsFor:'event handling'!
       
   239 
       
   240 doKeyInput:key
       
   241     ^ self
       
   242 
       
   243 
       
   244 !
       
   245 
       
   246 elementChanged:aView 
       
   247     "some element has been changed - kludge to force a resizing
       
   248      operation (for child layout recomputation) in its superView"
       
   249 
       
   250     aView superView sizeChanged:nil.
       
   251     self changed:#any.
       
   252 
       
   253 
       
   254 !
       
   255 
       
   256 elementChangedLayout:aView 
       
   257     "some element has been changed - kludge to force a resizing
       
   258      operation (for child layout recomputation) in its superView"
       
   259 
       
   260     aView superView sizeChanged:nil.
       
   261     self changed:#layout.
       
   262 
       
   263 
       
   264 !
       
   265 
       
   266 exposeX:x y:y width:w height:h
       
   267     "handle an expose event from device; redraw selection
       
   268     "
       
   269     super exposeX:x y:y width:w height:h.
       
   270 
       
   271     selection notNil ifTrue:[
       
   272         self selectionDo:[:v | self showSelected:v]
       
   273     ]
       
   274 
       
   275 
       
   276 !
       
   277 
       
   278 keyPress:key x:x y:y
       
   279 
       
   280     key == #InspectIt ifTrue:[
       
   281         ^ self inspectSelection
       
   282     ].
       
   283 
       
   284     (key == #Delete or:[key == #BackSpace]) ifTrue: [
       
   285         selection notNil ifTrue:[
       
   286             self deleteSelection
       
   287         ]
       
   288     ] ifFalse:[
       
   289         keyPressAction notNil ifTrue:[
       
   290             keyPressAction value:key
       
   291         ]
       
   292     ]
       
   293 
       
   294 
       
   295 !
       
   296 
       
   297 processEvent:anEvent
       
   298     "catch expose events for components, and redraw its handles after
       
   299      the redraw when this happens
       
   300     "
       
   301     |view|
       
   302 
       
   303     selection notNil ifTrue:[
       
   304         anEvent type == #damage ifTrue:[
       
   305             view := anEvent view.
       
   306             (selection == view
       
   307             or:[selection isCollection
       
   308                 and:[selection includes:view]]) ifTrue:[
       
   309                     self showSelected:view
       
   310             ]
       
   311         ]
       
   312     ].
       
   313     ^ false.
       
   314 
       
   315 
       
   316 !
       
   317 
       
   318 sizeChanged:how
       
   319     self withSelectionHiddenDo:[
       
   320         super sizeChanged:how
       
   321     ]
       
   322 
       
   323 
       
   324 ! !
       
   325 
       
   326 !UIObjectView methodsFor:'initialization'!
       
   327 
       
   328 initialize
       
   329     super initialize.
       
   330 
       
   331     "funny: since I do not want the created widgets to get pointer
       
   332      events, I put an InputView on top of them, which catches those events
       
   333      and passes them back to me - have to take care, that this inputView
       
   334      is always on top
       
   335     "
       
   336     inputView := InputView origin:0.0@0.0 extent:1.0@1.0 in:self.
       
   337 
       
   338     inputView eventReceiver:self.
       
   339     inputView enableButtonEvents.
       
   340     inputView enableButtonMotionEvents.
       
   341 
       
   342     undoHistory := UndoHistory new.
       
   343 
       
   344     undoHistory modifiedAction:[:what|
       
   345         self changed:#undoHistory with:what
       
   346     ].
       
   347 
       
   348     testMode := false.
       
   349 
       
   350     (self class gridShown) ifTrue:[
       
   351         super showGrid
       
   352     ].
       
   353 
       
   354 !
       
   355 
       
   356 realize
       
   357     super realize.
       
   358     self windowGroup postEventHook:self
       
   359 
       
   360 ! !
       
   361 
       
   362 !UIObjectView methodsFor:'misc'!
       
   363 
       
   364 cursor:aCursor
       
   365     inputView realized ifTrue:[
       
   366         inputView cursor:aCursor
       
   367     ].
       
   368     super cursor:aCursor
       
   369 
       
   370 
       
   371 !
       
   372 
       
   373 invertOutlineOf:anObject
       
   374     |delta|
       
   375 
       
   376     self clippedByChildren:false.
       
   377     delta := (anObject originRelativeTo:self) - anObject origin.
       
   378     self xoring:[
       
   379         self displayRectangle:((anObject origin + delta) extent:anObject extent).
       
   380     ].
       
   381     self clippedByChildren:true.
       
   382 
       
   383     "Modified: 5.9.1995 / 12:25:25 / claus"
       
   384 
       
   385 
       
   386 !
       
   387 
       
   388 showDragging:something offset:anOffset
       
   389     "drag around a View"
       
   390 
       
   391     |top|
       
   392 
       
   393     self forEach:something do:[:anObject |
       
   394         self drawRectangle:((anObject origin + anOffset) extent:(anObject extent))
       
   395     ]
       
   396 
       
   397 ! !
       
   398 
       
   399 !UIObjectView methodsFor:'object creation'!
       
   400 
       
   401 doDragCreate:aPoint
       
   402     "do a widget create drag
       
   403     "
       
   404     |p|
       
   405 
       
   406     p := self alignToGrid:aPoint.
       
   407     createFrame corner:(p - (createInWidget originRelativeTo:self)).
       
   408 
       
   409     (createFrame extent x < 10) ifTrue:[
       
   410         createFrame extent x:10
       
   411     ].
       
   412 
       
   413     (createFrame extent y < 10) ifTrue:[
       
   414         createFrame extent y:10
       
   415     ].
       
   416 
       
   417     self invertOutlineOf:createdObject.
       
   418     createdObject origin:(createFrame origin) extent:(createFrame extent).
       
   419     self invertOutlineOf:createdObject.
       
   420 !
       
   421 
       
   422 endCreate
       
   423     "end a widget create drag
       
   424     "
       
   425     self invertOutlineOf:createdObject.
       
   426     self cursor:oldCursor.
       
   427     inputView raise.
       
   428 
       
   429     createdObject geometryLayout:(createdObject bounds asLayout).
       
   430 
       
   431     self changed:#tree.
       
   432     self select:createdObject.
       
   433     createdObject := nil.
       
   434 
       
   435     pressAction   := [:pressPoint | self startSelectOrMove:pressPoint].
       
   436     motionAction  := [:movePoint | true].
       
   437     releaseAction := [ true ].
       
   438 
       
   439     self cursor:Cursor normal.
       
   440 
       
   441 
       
   442 !
       
   443 
       
   444 initializeCreatedObject:anObject
       
   445     self subclassResponsibility
       
   446 !
       
   447 
       
   448 startCreate:aPoint
       
   449     "start a widget create
       
   450     "
       
   451     |props index startPoint|
       
   452 
       
   453     createClass isNil ifTrue:[
       
   454         ^ self
       
   455     ].
       
   456 
       
   457     startPoint    := self alignToGrid:aPoint.
       
   458     motionAction  := [:movePoint | self doDragCreate:movePoint].
       
   459     releaseAction := [self endCreate].
       
   460 
       
   461     (selection isNil or:[selection isKindOf:Collection]) ifTrue:[
       
   462         createInWidget := self findObjectIn:self at:aPoint
       
   463     ] ifFalse:[
       
   464         createInWidget := self findObjectIn:selection at:aPoint
       
   465     ].
       
   466     super unselect.
       
   467     self select:createInWidget.
       
   468 
       
   469     oldCursor := cursor.
       
   470     self cursor:(Cursor leftHand).
       
   471 
       
   472     createInWidget isNil ifTrue:[
       
   473         createdObject  := createClass in:self.
       
   474         createInWidget := self.
       
   475     ] ifFalse:[
       
   476         createdObject := createClass new.
       
   477         createInWidget addSubView:createdObject.
       
   478     ].
       
   479 
       
   480     createFrame := Rectangle origin:(startPoint - (createInWidget originRelativeTo:self))
       
   481                              corner:startPoint.
       
   482 
       
   483     createdObject origin:(createFrame origin).
       
   484 
       
   485     undoHistory transactionNamed:'create' do:[
       
   486         self initializeCreatedObject:createdObject.
       
   487     ].
       
   488     createdObject realize.
       
   489     self invertOutlineOf:createdObject.
       
   490 ! !
       
   491 
       
   492 !UIObjectView methodsFor:'private handles'!
       
   493 
       
   494 handlesOf:aComponent do:aBlock
       
   495     |delta layout vertical horizontal|
       
   496 
       
   497     layout := aComponent geometryLayout.
       
   498     delta  := (aComponent originRelativeTo:self) - aComponent origin.
       
   499 
       
   500     (layout isLayout not or:[layout isLayoutFrame]) ifTrue:[
       
   501         vertical   := self isVerticalResizable:aComponent.
       
   502         horizontal := self isHorizontalResizable:aComponent.
       
   503     ] ifFalse:[
       
   504         vertical   := false.
       
   505         horizontal := false.
       
   506     ].
       
   507 
       
   508     horizontal ifTrue:[
       
   509         aBlock value:(aComponent leftCenter   + delta) value:#left.
       
   510         aBlock value:(aComponent rightCenter  + delta) value:#right.
       
   511     ].
       
   512 
       
   513     vertical ifTrue:[
       
   514         aBlock value:(aComponent topCenter    + delta) value:#top.
       
   515         aBlock value:(aComponent bottomCenter + delta) value:#bottom.
       
   516     ].
       
   517 
       
   518     (horizontal and:[vertical]) ifTrue:[
       
   519         aBlock value:(aComponent origin     + delta) value:#origin.
       
   520         aBlock value:(aComponent corner     + delta) value:#corner.
       
   521         aBlock value:(aComponent topRight   + delta) value:#topRight.
       
   522         aBlock value:(aComponent bottomLeft + delta) value:#bottomLeft.
       
   523     ] ifFalse:[
       
   524         aBlock value:(aComponent origin     + delta) value:#view.
       
   525         aBlock value:(aComponent corner     + delta) value:#view.
       
   526         aBlock value:(aComponent topRight   + delta) value:#view.
       
   527         aBlock value:(aComponent bottomLeft + delta) value:#view.
       
   528     ].
       
   529 
       
   530 
       
   531 !
       
   532 
       
   533 showSelected:aComponent
       
   534     |delta oldPaint|
       
   535 
       
   536     self paint:Color black. 
       
   537     self clippedByChildren:false. 
       
   538 
       
   539     self handlesOf:aComponent do:[:pnt :what |
       
   540         what == #view ifTrue:[self displayRectangle:(pnt - (4@4) extent:7@7)]
       
   541                      ifFalse:[self    fillRectangle:(pnt - (4@4) extent:7@7)]
       
   542     ].
       
   543 
       
   544     self clippedByChildren:true.
       
   545     self paint:oldPaint.
       
   546 !
       
   547 
       
   548 showUnselected:aComponent
       
   549     |delta r oldPaint|
       
   550 
       
   551     r := aComponent origin extent:8@8.
       
   552 
       
   553     self clippedByChildren:false. 
       
   554 
       
   555     self handlesOf:aComponent do:[:pnt :what |
       
   556         self clearRectangle:(pnt - (4@4) extent:7@7).
       
   557     ].
       
   558 
       
   559     self clippedByChildren:true. 
       
   560 
       
   561     "/ must redraw all components which are affected b the handles
       
   562 
       
   563     r := (aComponent originRelativeTo:self) - (4@4)
       
   564              extent:(aComponent extent + (4@4)).
       
   565 
       
   566     subViews do:[:anotherComponent |
       
   567         |absOrg absFrame|
       
   568 
       
   569         anotherComponent ~~ inputView ifTrue:[
       
   570             absOrg := anotherComponent originRelativeTo:self.
       
   571             absFrame := absOrg extent:(anotherComponent extent).
       
   572             (absFrame intersects:r) ifTrue:[
       
   573                 anotherComponent withAllSubViewsDo:[:v |
       
   574                     v clear.
       
   575                     v exposeX:0 y:0 width:9999 height:9999.
       
   576                 ]
       
   577             ]
       
   578         ]
       
   579     ]
       
   580 
       
   581 !
       
   582 
       
   583 whichHandleOf:aView isHitBy:aPoint
       
   584     |bounds|
       
   585 
       
   586     self handlesOf:aView do:[:pnt :what |
       
   587         ((pnt - (4@4) extent:7@7) containsPoint:aPoint) ifTrue:[
       
   588             ^ what
       
   589         ].
       
   590     ].
       
   591 
       
   592     ^ #view
       
   593 
       
   594     "Modified: 5.9.1995 / 14:39:34 / claus"
       
   595 
       
   596 ! !
       
   597 
       
   598 !UIObjectView methodsFor:'private resizing-subviews'!
       
   599 
       
   600 resize:aView bottom:aPoint
       
   601 
       
   602     undoHistory disabledTransitionDo:[
       
   603         self shifLayout:aView top:0 bottom:((aPoint y) - (aView computeCorner y))
       
   604     ]
       
   605 !
       
   606 
       
   607 resize:aView corner:aPoint
       
   608     |delta|
       
   609 
       
   610     delta := aPoint - aView computeCorner.
       
   611 
       
   612     undoHistory disabledTransitionDo:[
       
   613         self shifLayout:aView top:0 bottom:(delta y) left:0 right:(delta x)
       
   614     ]
       
   615 !
       
   616 
       
   617 resize:aView left:aPoint
       
   618 
       
   619     undoHistory disabledTransitionDo:[
       
   620         self shifLayout:aView left:((aPoint x) - (aView computeOrigin x)) right:0
       
   621     ]
       
   622 
       
   623 !
       
   624 
       
   625 resize:aView right:aPoint
       
   626 
       
   627     undoHistory disabledTransitionDo:[
       
   628         self shifLayout:aView left:0 right:((aPoint x) - (aView computeCorner x))
       
   629     ]
       
   630 !
       
   631 
       
   632 resize:aView top:aPoint
       
   633 
       
   634     undoHistory disabledTransitionDo:[
       
   635         self shifLayout:aView top:((aPoint y) - (aView computeOrigin y)) bottom:0
       
   636     ]
       
   637 ! !
       
   638 
       
   639 !UIObjectView methodsFor:'private shift-layout'!
       
   640 
       
   641 shifLayout:aView left:l right:r
       
   642     "shift layout for a view; in case of an open transaction, the
       
   643      undoAction will be defined
       
   644     "
       
   645     self shifLayout:aView top:0 bottom:0 left:l right:r
       
   646 
       
   647 !
       
   648 
       
   649 shifLayout:aView top:t bottom:b
       
   650     "shift layout for a view; in case of an open transaction, the
       
   651      undoAction will be defined
       
   652     "
       
   653     self shifLayout:aView top:t bottom:b left:0 right:0
       
   654 
       
   655 
       
   656 !
       
   657 
       
   658 shifLayout:aView top:t bottom:b left:l right:r
       
   659     "shift layout for a view; in case of an open transaction, the
       
   660      undoAction will be defined
       
   661     "
       
   662     |layout|
       
   663 
       
   664     self undoBlockPositionChanged:aView.
       
   665 
       
   666     layout := aView geometryLayout.
       
   667 
       
   668     layout leftOffset:(layout leftOffset + l)
       
   669             topOffset:(layout topOffset  + t).
       
   670 
       
   671     layout isLayoutFrame ifTrue:[
       
   672         layout bottomOffset:(layout bottomOffset + b).
       
   673         layout  rightOffset:(layout rightOffset  + r).
       
   674     ].
       
   675 
       
   676     aView geometryLayout:layout.
       
   677 
       
   678 
       
   679 
       
   680 ! !
       
   681 
       
   682 !UIObjectView methodsFor:'private undo-actions'!
       
   683 
       
   684 undoBlockDimensionChanged:aView
       
   685 
       
   686     undoHistory isTransactionOpen ifTrue:[
       
   687         |layout|
       
   688 
       
   689         layout := aView geometryLayout copy.
       
   690 
       
   691         undoHistory addUndoBlock:[
       
   692             aView geometryLayout:layout.
       
   693             aView superView sizeChanged:nil.
       
   694         ]
       
   695     ]
       
   696 
       
   697 !
       
   698 
       
   699 undoBlockPositionChanged:aView
       
   700 
       
   701     undoHistory isTransactionOpen ifTrue:[
       
   702         |layout|
       
   703 
       
   704         layout := aView geometryLayout copy.
       
   705         undoHistory addUndoBlock:[aView geometryLayout:layout]
       
   706     ]
       
   707 
       
   708 ! !
       
   709 
       
   710 !UIObjectView methodsFor:'searching'!
       
   711 
       
   712 findObjectAt:aPoint
       
   713     "find the origin/corner of the currentWidget"
       
   714 
       
   715      selection notNil ifTrue:[
       
   716         (selection isKindOf:Collection) ifTrue:[
       
   717             ^ self findObjectIn:(selection first) at:aPoint
       
   718         ].
       
   719         ^ self findObjectIn:selection at:aPoint
       
   720      ].
       
   721      ^ self findObjectIn:self at:aPoint
       
   722 
       
   723 
       
   724 
       
   725 !
       
   726 
       
   727 findObjectIn:aView at:aPoint
       
   728     "find the origin/corner of the currentWidget
       
   729     "
       
   730     |relPoint|
       
   731 
       
   732     aView isNil ifTrue:[^ nil].
       
   733     aView subViews notNil ifTrue:[
       
   734         relPoint := aPoint - (aView originRelativeTo:self).
       
   735         self subviewsOf:aView do:[:aView |
       
   736             |org ext|
       
   737 
       
   738             (aView isKindOf:InputView) ifFalse:[
       
   739                 org := aView computeOrigin.
       
   740                 ext := aView computeExtent.
       
   741                 ((org extent:ext) containsPoint:relPoint) ifTrue:[
       
   742                     ^ aView
       
   743                 ]
       
   744             ]
       
   745         ]
       
   746     ].
       
   747     (aView == self) ifTrue:[^ nil].
       
   748 
       
   749     ^ self findObjectIn:(aView superView) at:aPoint
       
   750 !
       
   751 
       
   752 whichBorderOf:aView isHitBy:aPoint
       
   753     |p r bw org|
       
   754 
       
   755     bw := aView borderWidth.
       
   756     p := aPoint - (aView superView originRelativeTo:self).
       
   757 
       
   758     r := Rectangle origin:(aView origin)
       
   759                    extent:(aView width @ bw).
       
   760     (r containsPoint:p) ifTrue:[^ #top:].
       
   761 
       
   762     r origin:(aView left @ (aView bottom + bw)) extent:(aView width @ bw).
       
   763     (r containsPoint:p) ifTrue:[^ #bottom:].
       
   764 
       
   765     r top:(aView top).
       
   766     r extent:(bw @ aView height).
       
   767     (r containsPoint:p) ifTrue:[^ #left:].
       
   768 
       
   769     r origin:((aView right + bw) @ aView top).
       
   770     (r containsPoint:p) ifTrue:[^ #right:].
       
   771 
       
   772     ^ nil
       
   773 
       
   774 
       
   775 ! !
       
   776 
       
   777 !UIObjectView methodsFor:'selections'!
       
   778 
       
   779 addToSelection:something
       
   780     (testMode or:[something == selection]) ifFalse:[
       
   781         selection ~~ something ifTrue:[
       
   782             super addToSelection:something.
       
   783             self changed:#selection.
       
   784         ]
       
   785     ]
       
   786 !
       
   787 
       
   788 inspectSelection
       
   789     self singleSelectionDo:[:aView |
       
   790         aView inspect
       
   791     ]
       
   792 !
       
   793 
       
   794 removeFromSelection:something
       
   795     super removeFromSelection:something.
       
   796     self changed:#selection
       
   797 
       
   798 !
       
   799 
       
   800 select:something
       
   801     (testMode or:[something == selection]) ifFalse:[
       
   802         super select:something.
       
   803         self changed:#selection
       
   804     ]
       
   805 
       
   806 !
       
   807 
       
   808 selection
       
   809     ^ selection
       
   810 
       
   811 
       
   812 !
       
   813 
       
   814 selectionFindMinimum:aOneArgBlock
       
   815     "returns the minimum value from the block evaluated on each view
       
   816      in the selection
       
   817     "
       
   818     |min val|
       
   819 
       
   820     self selectionDo:[:aView|
       
   821         val := aOneArgBlock value:aView.
       
   822 
       
   823         min isNil ifTrue:[min := val]
       
   824                  ifFalse:[min := min min:val]
       
   825     ].
       
   826     ^ min
       
   827 !
       
   828 
       
   829 selectionHiddenDo:aBlock
       
   830     "apply block to every object in selection"
       
   831 
       
   832     self selectionDo:[:aView |
       
   833         self showUnselected:aView.
       
   834     ].
       
   835     device flush.
       
   836     aBlock value.
       
   837     self selectionDo:[:aView |
       
   838         self showSelected:aView
       
   839     ]
       
   840 
       
   841 
       
   842 !
       
   843 
       
   844 singleSelection
       
   845     "returns single selection or nil
       
   846     "
       
   847     (selection isKindOf:SimpleView) ifTrue:[^ selection]
       
   848                                    ifFalse:[^ nil]
       
   849 !
       
   850 
       
   851 singleSelectionDo:aBlock
       
   852 
       
   853     self singleSelection notNil ifTrue:[
       
   854         aBlock value:selection
       
   855     ]
       
   856 !
       
   857 
       
   858 unselect
       
   859     selection notNil ifTrue:[
       
   860         super unselect.
       
   861         self changed:#selection
       
   862     ]
       
   863 
       
   864 !
       
   865 
       
   866 withSelectionHiddenDo:aBlock
       
   867     "evaluate aBlock while selection is hidden"
       
   868 
       
   869     |sel|
       
   870 
       
   871     selection isNil ifTrue:[
       
   872         aBlock value
       
   873     ] ifFalse:[
       
   874         sel := selection.
       
   875         super unselect.
       
   876         aBlock value.
       
   877         super select:sel
       
   878     ]
       
   879 
       
   880     "Modified: 6.9.1995 / 01:46:16 / claus"
       
   881 
       
   882 
       
   883 ! !
       
   884 
       
   885 !UIObjectView methodsFor:'testing'!
       
   886 
       
   887 canMove:something
       
   888     ^ true
       
   889 
       
   890 
       
   891 !
       
   892 
       
   893 isHorizontalResizable:aComponent
       
   894     ^ self subclassResponsibility
       
   895 
       
   896 
       
   897 !
       
   898 
       
   899 isVerticalResizable:aComponent
       
   900     ^ self subclassResponsibility
       
   901 
       
   902 
       
   903 ! !
       
   904 
       
   905 !UIObjectView methodsFor:'user actions'!
       
   906 
       
   907 createWidgetWithClass:aClass
       
   908     "prepare to create new widgets
       
   909     "
       
   910     createClass := aClass.
       
   911     pressAction := [:pressPoint | self startCreate:pressPoint].
       
   912     self cursor:Cursor origin.
       
   913 
       
   914 
       
   915 !
       
   916 
       
   917 undoAction
       
   918     undoHistory notEmpty ifTrue:[
       
   919         self unselect.
       
   920         undoHistory undoLast
       
   921     ]
       
   922 
       
   923 
       
   924 ! !
       
   925 
       
   926 !UIObjectView methodsFor:'user actions - dimension'!
       
   927 
       
   928 copyExtent
       
   929     (selection isNil or:[selection isKindOf:Collection]) ifTrue:[
       
   930         ^ self warn:'exactly one element must be selected'.
       
   931     ].
       
   932     copiedExtent := selection computeExtent
       
   933 
       
   934 
       
   935 
       
   936 !
       
   937 
       
   938 pasteExtent
       
   939     copiedExtent notNil ifTrue:[
       
   940         self transition:'paste extent' dimensionDo:[:v|
       
   941             self resize:v corner:(v computeOrigin + copiedExtent)
       
   942         ]    
       
   943     ]    
       
   944 !
       
   945 
       
   946 pasteHeight
       
   947     copiedExtent notNil ifTrue:[
       
   948         self transition:'paste height' dimensionDo:[:v|
       
   949             self resize:v bottom:(v computeOrigin + copiedExtent)
       
   950         ]    
       
   951     ]    
       
   952 
       
   953 !
       
   954 
       
   955 pasteWidth
       
   956     copiedExtent notNil ifTrue:[
       
   957         self transition:'paste width' dimensionDo:[:v|
       
   958             self resize:v right:(v computeOrigin + copiedExtent)
       
   959         ]    
       
   960     ]    
       
   961 
       
   962 !
       
   963 
       
   964 setDimension:aLayout
       
   965     |undoText|
       
   966 
       
   967     undoText := 'change layout'.
       
   968     aLayout isLayout ifTrue:[
       
   969         undoText := 'change to layout frame'.
       
   970         aLayout isAlignmentOrigin ifTrue:[
       
   971             undoText := 'change to layout alignOrigin'.
       
   972         ] ifFalse:[
       
   973             aLayout isAlignmentOrigin ifTrue:[
       
   974                 undoText := 'change to layout origin'.
       
   975             ]
       
   976         ]
       
   977     ].
       
   978 
       
   979     self transition:undoText dimensionDo:[:v| v geometryLayout:(aLayout copy)]    
       
   980 
       
   981 !
       
   982 
       
   983 setToDefaultExtent
       
   984     self transition:'default extent' dimensionDo:[:v|
       
   985         self resize:v corner:(v computeOrigin + (v preferredExtent))
       
   986     ]    
       
   987 
       
   988 !
       
   989 
       
   990 setToDefaultHeight
       
   991     self transition:'default height' dimensionDo:[:v|
       
   992         self resize:v bottom:(v computeOrigin + (v preferredExtent))
       
   993     ]    
       
   994 
       
   995 !
       
   996 
       
   997 setToDefaultWidth
       
   998     self transition:'default width' dimensionDo:[:v|
       
   999         self resize:v right:(v computeOrigin + (v preferredExtent))
       
  1000     ]    
       
  1001 
       
  1002 !
       
  1003 
       
  1004 transition:what dimensionDo:aOneArgBlock
       
  1005     "change dimension within a transaction for the selected elements by evaluating
       
  1006      the block with the argument a view.
       
  1007     "
       
  1008     self selectionHiddenDo:[
       
  1009         undoHistory transactionNamed:what do:[
       
  1010             self selectionDo:[:aView|
       
  1011                 self undoBlockDimensionChanged:aView.
       
  1012                 aOneArgBlock value:aView.
       
  1013                 self elementChangedLayout:aView.
       
  1014             ]
       
  1015         ]
       
  1016     ]
       
  1017 ! !
       
  1018 
       
  1019 !UIObjectView methodsFor:'user actions - move'!
       
  1020 
       
  1021 basicMoveSelectionHorizontal:n
       
  1022     "move left:  n < 0
       
  1023      move right: n > 0
       
  1024     "
       
  1025     self selectionHiddenDo:[
       
  1026         undoHistory transactionNamed:'move' do:[
       
  1027             self selectionDo:[:aView|self shifLayout:aView left:n right:n]
       
  1028         ].
       
  1029         self changed:#layout
       
  1030     ]
       
  1031 
       
  1032 
       
  1033 !
       
  1034 
       
  1035 basicMoveSelectionVertical:n
       
  1036     "move up:   n < 0
       
  1037      move down: n > 0
       
  1038     "
       
  1039     self selectionHiddenDo:[
       
  1040         undoHistory transactionNamed:'move' do:[
       
  1041             self selectionDo:[:aView| self shifLayout:aView top:n bottom:n ]
       
  1042         ].
       
  1043         self changed:#layout
       
  1044     ]
       
  1045 
       
  1046 
       
  1047 
       
  1048 !
       
  1049 
       
  1050 moveObject:anObject to:aPoint
       
  1051     "move anObject to newOrigin, aPoint
       
  1052     "
       
  1053     |dX dY org delta|
       
  1054 
       
  1055     anObject notNil ifTrue:[
       
  1056         self invertOutlineOf:anObject.
       
  1057 
       
  1058         org := anObject computeOrigin.
       
  1059 
       
  1060         delta := aPoint - org.
       
  1061         delta := (self alignToGrid:aPoint) - org.
       
  1062         dX := delta x.
       
  1063         dY := delta y.
       
  1064 
       
  1065         undoHistory disabledTransitionDo:[
       
  1066             self shifLayout:anObject top:dY bottom:dY left:dX right:dX
       
  1067         ].
       
  1068         self elementChangedLayout:anObject.
       
  1069         self invertOutlineOf:anObject.
       
  1070     ]
       
  1071 
       
  1072 !
       
  1073 
       
  1074 moveSelectionDown
       
  1075     self moveSelectionDown:1
       
  1076 
       
  1077 
       
  1078 !
       
  1079 
       
  1080 moveSelectionDown10
       
  1081     self moveSelectionDown:10
       
  1082 
       
  1083 
       
  1084 !
       
  1085 
       
  1086 moveSelectionDown:n
       
  1087     self basicMoveSelectionVertical:n
       
  1088 
       
  1089 
       
  1090 !
       
  1091 
       
  1092 moveSelectionLeft
       
  1093     self moveSelectionLeft:1
       
  1094 
       
  1095 
       
  1096 !
       
  1097 
       
  1098 moveSelectionLeft10
       
  1099     self moveSelectionLeft:10
       
  1100 
       
  1101 
       
  1102 !
       
  1103 
       
  1104 moveSelectionLeft:n
       
  1105     self basicMoveSelectionHorizontal:(n negated)
       
  1106 
       
  1107 
       
  1108 !
       
  1109 
       
  1110 moveSelectionRight
       
  1111     self moveSelectionRight:1
       
  1112 
       
  1113 
       
  1114 !
       
  1115 
       
  1116 moveSelectionRight10
       
  1117     self moveSelectionRight:10
       
  1118 
       
  1119 
       
  1120 !
       
  1121 
       
  1122 moveSelectionRight:n
       
  1123     self basicMoveSelectionHorizontal:n
       
  1124 
       
  1125 
       
  1126 !
       
  1127 
       
  1128 moveSelectionUp
       
  1129     self moveSelectionUp:1
       
  1130 
       
  1131 
       
  1132 !
       
  1133 
       
  1134 moveSelectionUp10
       
  1135     self moveSelectionUp:10
       
  1136 
       
  1137 
       
  1138 !
       
  1139 
       
  1140 moveSelectionUp:n
       
  1141     self basicMoveSelectionVertical:(n negated)
       
  1142 
       
  1143 
       
  1144 ! !
       
  1145 
       
  1146 !UIObjectView methodsFor:'user actions - position'!
       
  1147 
       
  1148 alignSelectionBottom
       
  1149     |bmost delta|
       
  1150 
       
  1151     self selectionHiddenDo:[
       
  1152         bmost := 0.
       
  1153         self selectionDo:[:v| bmost := bmost max:(v computeCorner y)].
       
  1154 
       
  1155         undoHistory transactionNamed:'align' do:[
       
  1156             self selectionDo:[:v|
       
  1157                 (delta := bmost - (v computeCorner y)) ~~ 0 ifTrue:[
       
  1158                     self shifLayout:v top:delta bottom:delta
       
  1159                 ]
       
  1160             ]
       
  1161         ].
       
  1162         self changed:#layout
       
  1163     ]
       
  1164 
       
  1165 
       
  1166 
       
  1167 !
       
  1168 
       
  1169 alignSelectionCenterHor
       
  1170     |counter centerX|
       
  1171 
       
  1172     self selectionHiddenDo:[
       
  1173         counter := 0.
       
  1174         centerX := 0.
       
  1175 
       
  1176         self selectionDo:[:v |
       
  1177             centerX := centerX + (v computeCorner x + v computeOrigin x).
       
  1178             counter := counter + 1.
       
  1179         ].
       
  1180         centerX := centerX // (counter * 2).
       
  1181 
       
  1182         undoHistory transactionNamed:'align' do:[
       
  1183             |newX oldX delta|
       
  1184 
       
  1185             self selectionDo:[:v|
       
  1186                 oldX  := v computeOrigin x.
       
  1187                 newX  := centerX - ((v computeCorner x - oldX) // 2).
       
  1188                 delta := newX - oldX.
       
  1189 
       
  1190                 self shifLayout:v left:delta right:delta
       
  1191             ]
       
  1192         ].
       
  1193         self changed:#layout
       
  1194     ]
       
  1195 
       
  1196 
       
  1197 
       
  1198 !
       
  1199 
       
  1200 alignSelectionCenterVer
       
  1201     |counter centerY|
       
  1202 
       
  1203     self selectionHiddenDo:[
       
  1204         counter := 0.
       
  1205         centerY := 0.
       
  1206 
       
  1207         self selectionDo:[:v |
       
  1208             centerY := centerY + (v computeCorner y + v computeOrigin y).
       
  1209             counter := counter + 1.
       
  1210         ].
       
  1211         centerY := centerY // (counter * 2).
       
  1212 
       
  1213         undoHistory transactionNamed:'align' do:[
       
  1214             |newY oldY delta|
       
  1215 
       
  1216             self selectionDo:[:v|
       
  1217                 oldY  := v computeOrigin y.
       
  1218                 newY  := centerY - ((v computeCorner y - oldY) // 2).
       
  1219                 delta := newY - oldY.
       
  1220 
       
  1221                 self shifLayout:v top:delta bottom:delta
       
  1222             ]
       
  1223         ].
       
  1224         self changed:#layout
       
  1225     ]
       
  1226 !
       
  1227 
       
  1228 alignSelectionLeft
       
  1229     |lmost delta|
       
  1230 
       
  1231     self selectionHiddenDo:[
       
  1232         lmost := self selectionFindMinimum:[:v| v computeOrigin x].
       
  1233 
       
  1234         undoHistory transactionNamed:'align' do:[
       
  1235             self selectionDo:[:v|
       
  1236                 (delta := lmost - (v computeOrigin x)) ~~ 0 ifTrue:[
       
  1237                     self shifLayout:v left:delta right:delta
       
  1238                 ]
       
  1239             ]
       
  1240         ].
       
  1241         self changed:#layout
       
  1242     ]
       
  1243 
       
  1244 !
       
  1245 
       
  1246 alignSelectionLeftAndRight
       
  1247     |lmost rmost|
       
  1248 
       
  1249     self selectionHiddenDo:[
       
  1250         lmost := self selectionFindMinimum:[:v| v computeOrigin x].
       
  1251         rmost := 0.
       
  1252         self selectionDo:[:v | rmost := rmost max:(v computeCorner x)].
       
  1253 
       
  1254         undoHistory transactionNamed:'align' do:[
       
  1255             self selectionDo:[:v|
       
  1256                 self shifLayout:v left:(lmost - (v computeOrigin x))
       
  1257                                  right:(rmost - (v computeCorner x))
       
  1258             ]
       
  1259         ].
       
  1260         self changed:#layout
       
  1261     ]
       
  1262 !
       
  1263 
       
  1264 alignSelectionRight
       
  1265     |rmost delta|
       
  1266 
       
  1267     self selectionHiddenDo:[
       
  1268         rmost := 0.
       
  1269         self selectionDo:[:v| rmost := rmost max:(v computeCorner x)].
       
  1270 
       
  1271         undoHistory transactionNamed:'align' do:[
       
  1272             self selectionDo:[:v|
       
  1273                 (delta := rmost - (v computeCorner x)) ~~ 0 ifTrue:[
       
  1274                     self shifLayout:v left:delta right:delta
       
  1275                 ]
       
  1276             ]
       
  1277         ].
       
  1278         self changed:#layout
       
  1279     ]
       
  1280 
       
  1281 !
       
  1282 
       
  1283 alignSelectionTop
       
  1284     |tmost delta|
       
  1285 
       
  1286     self selectionHiddenDo:[
       
  1287         tmost := self selectionFindMinimum:[:v| v computeOrigin y].
       
  1288 
       
  1289         undoHistory transactionNamed:'align' do:[
       
  1290             self selectionDo:[:v||delta|
       
  1291                 (delta := tmost - (v computeOrigin y)) ~~ 0 ifTrue:[
       
  1292                     self shifLayout:v top:delta bottom:delta
       
  1293                 ]
       
  1294             ]
       
  1295         ].
       
  1296         self changed:#layout
       
  1297     ]
       
  1298 
       
  1299 !
       
  1300 
       
  1301 alignSelectionTopAndBottom
       
  1302     |tmost bmost|
       
  1303 
       
  1304     self selectionHiddenDo:[
       
  1305         tmost := self selectionFindMinimum:[:v| v computeOrigin y].
       
  1306         bmost := 0.
       
  1307         self selectionDo:[:v| bmost := bmost max:(v computeCorner y)].
       
  1308 
       
  1309         undoHistory transactionNamed:'align' do:[
       
  1310             self selectionDo:[:v|
       
  1311                 self shifLayout:v top:(tmost - (v computeOrigin y))
       
  1312                                bottom:(bmost - (v computeCorner y))
       
  1313             ]
       
  1314         ].
       
  1315         self changed:#layout
       
  1316     ]
       
  1317 !
       
  1318 
       
  1319 centerSelection:aOneArgBlockXorY
       
  1320     "center selection horizontal or vertical dependant on the block result( x or y).
       
  1321      The argument to the block is the point.
       
  1322     "
       
  1323     |superview min max delta val|
       
  1324 
       
  1325     self selectionHiddenDo:[
       
  1326         max := 0.
       
  1327 
       
  1328         self selectionDo:[:aView |
       
  1329             superview isNil ifTrue:[
       
  1330                 superview := aView superView
       
  1331             ] ifFalse:[
       
  1332                 (aView superView == superview) ifFalse:[
       
  1333                     ^ self notify:'views must have same superview'.
       
  1334                 ]
       
  1335             ].
       
  1336             val := aOneArgBlockXorY value:(aView computeOrigin).    
       
  1337 
       
  1338             min isNil ifTrue:[min := val]
       
  1339                      ifFalse:[min := min min:val].
       
  1340 
       
  1341             val := aOneArgBlockXorY value:(aView computeCorner).
       
  1342             max := max max:val.
       
  1343         ].
       
  1344 
       
  1345         val := aOneArgBlockXorY value:(superview computeExtent).
       
  1346         max := (min + val - max) // 2.
       
  1347 
       
  1348         max == min ifFalse:[
       
  1349             delta := max - min.
       
  1350 
       
  1351             undoHistory transactionNamed:'center' do:[
       
  1352                 self selectionDo:[:aView|
       
  1353                     self shifLayout:aView top:delta bottom:delta]
       
  1354             ]
       
  1355         ].
       
  1356         self changed:#layout
       
  1357     ]
       
  1358 
       
  1359 
       
  1360 !
       
  1361 
       
  1362 centerSelectionHor
       
  1363     "center selection horizontal
       
  1364     "
       
  1365     self centerSelection:[:aPoint| aPoint x]
       
  1366 
       
  1367 
       
  1368 !
       
  1369 
       
  1370 centerSelectionVer
       
  1371     "center selection vertical
       
  1372     "
       
  1373     self centerSelection:[:aPoint| aPoint y]
       
  1374 !
       
  1375 
       
  1376 spreadSelectionHor
       
  1377     |sumWidths min max viewsInOrder topsInOrder count space|
       
  1378 
       
  1379     (selection isKindOf:Collection) ifFalse:[^ self].
       
  1380 
       
  1381     self selectionHiddenDo:[
       
  1382         count := 0.
       
  1383         sumWidths := 0.
       
  1384         max := 0.
       
  1385 
       
  1386         self selectionDo:[:aView |
       
  1387             sumWidths := sumWidths + aView width.
       
  1388 
       
  1389             min isNil ifTrue:[min := aView left]
       
  1390                      ifFalse:[min := min min:(aView left)].
       
  1391 
       
  1392             max := max max:(aView right).
       
  1393             count := count + 1
       
  1394         ].
       
  1395         viewsInOrder := Array withAll:selection.
       
  1396         topsInOrder  := viewsInOrder collect:[:aView | aView left].
       
  1397         topsInOrder sortWith:viewsInOrder.
       
  1398 
       
  1399         space := (((max - min) - sumWidths) / (count - 1)) rounded asInteger.
       
  1400 
       
  1401         undoHistory transactionNamed:'spread' do:[
       
  1402             viewsInOrder do:[:aView | 
       
  1403                 |delta|
       
  1404 
       
  1405                 delta := min - aView computeOrigin x.
       
  1406                 self shifLayout:aView left:delta right:delta.
       
  1407                 min := min + aView computeExtent x + space
       
  1408             ]
       
  1409         ].
       
  1410         self changed:#layout
       
  1411     ]
       
  1412 
       
  1413 !
       
  1414 
       
  1415 spreadSelectionVer
       
  1416     |sumHeights min max viewsInOrder topsInOrder count space|
       
  1417 
       
  1418     (selection isKindOf:Collection) ifFalse:[^ self].
       
  1419 
       
  1420     self selectionHiddenDo:[
       
  1421         count := 0.
       
  1422         sumHeights := 0.
       
  1423         max := 0.
       
  1424 
       
  1425         self selectionDo:[:aView |
       
  1426             sumHeights := sumHeights + aView height.
       
  1427 
       
  1428             min isNil ifTrue:[min := aView top]
       
  1429                      ifFalse:[min := min min:(aView top)].
       
  1430 
       
  1431             max   := max max:(aView bottom).
       
  1432             count := count + 1
       
  1433         ].
       
  1434         viewsInOrder := Array withAll:selection.
       
  1435         topsInOrder  := viewsInOrder collect:[:aView|aView top].
       
  1436         topsInOrder sortWith:viewsInOrder.
       
  1437 
       
  1438         space := (((max - min) - sumHeights) / (count - 1)) rounded asInteger.
       
  1439 
       
  1440         undoHistory transactionNamed:'spread' do:[
       
  1441             viewsInOrder do:[:aView||delta|
       
  1442                 delta := min - aView computeOrigin y.
       
  1443                 self shifLayout:aView top:delta bottom:delta.
       
  1444                 min := min + aView height + space
       
  1445             ]
       
  1446         ].
       
  1447         self changed:#layout
       
  1448     ]
       
  1449 ! !
       
  1450 
       
  1451 !UIObjectView methodsFor:'user actions - resize'!
       
  1452 
       
  1453 doDragResize:aPoint
       
  1454     "do a widget resize drag"
       
  1455 
       
  1456     |p|
       
  1457 
       
  1458     self invertOutlineOf:resizedObject.
       
  1459     p := (self alignToGrid:aPoint) - (resizedObject container originRelativeTo:self).
       
  1460     self perform:('x' , resizeSelector , ':') asSymbol with:p.
       
  1461     resizedObject geometryLayout:(resizedObject geometryLayout).
       
  1462     self invertOutlineOf:resizedObject
       
  1463 
       
  1464     "Modified: 5.9.1995 / 17:11:46 / claus"
       
  1465 
       
  1466 !
       
  1467 
       
  1468 endResize
       
  1469     "cleanup after object resize"
       
  1470 
       
  1471     self invertOutlineOf:resizedObject.
       
  1472     self setDefaultActions.
       
  1473     self select:resizedObject.
       
  1474     resizedObject := nil
       
  1475 
       
  1476     "Modified: 5.9.1995 / 17:11:17 / claus"
       
  1477 
       
  1478 !
       
  1479 
       
  1480 startResizeBorder:b of:selection at:aPoint
       
  1481     "resize selected view
       
  1482     "
       
  1483     resizedObject := self singleSelection.
       
  1484 
       
  1485     resizedObject notNil ifTrue:[
       
  1486         resizeSelector := b.
       
  1487         super unselect.
       
  1488 
       
  1489         undoHistory transactionNamed:'extent' do:[
       
  1490             self undoBlockDimensionChanged:resizedObject.
       
  1491         ].
       
  1492 
       
  1493         motionAction := [:movePoint | self doDragResize:movePoint].
       
  1494         releaseAction := [self endResize].
       
  1495         self invertOutlineOf:resizedObject
       
  1496     ]
       
  1497 !
       
  1498 
       
  1499 xbottom:aPoint
       
  1500     self resize:resizedObject bottom:aPoint
       
  1501 
       
  1502 !
       
  1503 
       
  1504 xbottomLeft:aPoint
       
  1505     self resize:resizedObject   left:aPoint.
       
  1506     self resize:resizedObject bottom:aPoint.
       
  1507 
       
  1508 !
       
  1509 
       
  1510 xcorner:aPoint
       
  1511     self resize:resizedObject corner:aPoint.
       
  1512 
       
  1513 !
       
  1514 
       
  1515 xleft:aPoint
       
  1516     self resize:resizedObject left:aPoint
       
  1517 
       
  1518 !
       
  1519 
       
  1520 xorigin:aPoint
       
  1521     self resize:resizedObject left:aPoint.
       
  1522     self resize:resizedObject  top:aPoint.
       
  1523 
       
  1524 !
       
  1525 
       
  1526 xright:aPoint
       
  1527     self resize:resizedObject right:aPoint
       
  1528 
       
  1529 !
       
  1530 
       
  1531 xtop:aPoint
       
  1532     self resize:resizedObject top:aPoint
       
  1533 
       
  1534 !
       
  1535 
       
  1536 xtopRight:aPoint
       
  1537     self resize:resizedObject right:aPoint.
       
  1538     self resize:resizedObject   top:aPoint.
       
  1539 
       
  1540 ! !
       
  1541 
       
  1542 !UIObjectView class methodsFor:'documentation'!
       
  1543 
       
  1544 version
       
  1545     ^ '$Header$'
       
  1546 ! !