1 ObjectView subclass:#UIObjectView |
1 ObjectView subclass:#UIObjectView |
2 instanceVariableNames:'inputView testMode undoHistory copiedExtent actionData |
2 instanceVariableNames:'inputView testMode undoHistory copiedExtent copiedLayout |
3 createClass clipChildren selectionHiddenLevel |
3 actionData createClass clipChildren selectionHiddenLevel |
4 setOfSuperViewsSizeChanged' |
4 setOfSuperViewsSizeChanged' |
5 classVariableNames:'' |
5 classVariableNames:'' |
6 poolDictionaries:'' |
6 poolDictionaries:'' |
7 category:'Interface-UIPainter' |
7 category:'Interface-UIPainter' |
8 ! |
8 ! |
462 ! |
462 ! |
463 |
463 |
464 createWidgetWithClass:aClass |
464 createWidgetWithClass:aClass |
465 "prepare to create new widgets |
465 "prepare to create new widgets |
466 " |
466 " |
467 createClass := aClass. |
467 aClass notNil ifTrue:[ |
468 pressAction := [:pressPoint | self startCreate:pressPoint]. |
468 createClass := aClass. |
469 self cursor:Cursor origin. |
469 pressAction := [:aPoint| self startCreate:aPoint]. |
470 |
470 self cursor:Cursor origin. |
|
471 ] |
471 |
472 |
472 ! |
473 ! |
473 |
474 |
474 doDragCreate:aPoint |
475 doDragCreate:aPoint |
475 "do a widget create drag |
476 "do a widget create drag |
519 |
519 |
520 initializeCreatedObject:anObject |
520 initializeCreatedObject:anObject |
521 self subclassResponsibility |
521 self subclassResponsibility |
522 ! |
522 ! |
523 |
523 |
|
524 setupInitialLayoutFor:anObject |
|
525 "setup initial layout for an object; !!!! some kludge !!!! |
|
526 " |
|
527 |spec topSpec| |
|
528 |
|
529 topSpec := anObject superView specClass basicNew. |
|
530 |
|
531 topSpec class isLayoutContainer ifFalse:[ |
|
532 |
|
533 "/ ... KLUDGE .... |
|
534 |
|
535 spec := anObject specClass. |
|
536 |
|
537 ( spec == ViewSpec |
|
538 or:[spec == SubCanvasSpec |
|
539 or:[spec == TextEditorSpec |
|
540 or:[spec == SequenceViewSpec]]] |
|
541 ) ifTrue:[ |
|
542 anObject geometryLayout:(anObject bounds asLayout). |
|
543 ^ self |
|
544 ] |
|
545 ]. |
|
546 topSpec setupInitialLayoutFor:anObject. |
|
547 |
|
548 ! |
|
549 |
524 startCreate:aPoint |
550 startCreate:aPoint |
525 "start a widget create |
551 "start a widget create |
526 " |
552 " |
527 |widget object start frame delta| |
553 |widget object start frame delta| |
528 |
554 |
529 self selection notNil ifTrue:[ |
555 self unselect. |
530 self numberOfSelections > 1 ifTrue:[ |
556 widget := self findContainerViewAt:aPoint. |
531 self warn:'to much elements selected'. |
|
532 ^ self setDefaultActions. |
|
533 ]. |
|
534 self unselect |
|
535 ]. |
|
536 |
|
537 ( (widget := self findObjectAt:aPoint) notNil |
|
538 and:[widget specClass supportsSubComponents] |
|
539 ) ifFalse:[ |
|
540 widget := self |
|
541 ]. |
|
542 |
557 |
543 motionAction := [:movePoint| self doDragCreate:movePoint]. |
558 motionAction := [:movePoint| self doDragCreate:movePoint]. |
544 releaseAction := [ self endCreate]. |
559 releaseAction := [ self endCreate]. |
545 |
560 |
546 object := createClass new. |
561 object := createClass new. |
557 object origin:(frame origin). |
572 object origin:(frame origin). |
558 self initializeCreatedObject:object. |
573 self initializeCreatedObject:object. |
559 self actionCreate:object frame:frame delta:delta. |
574 self actionCreate:object frame:frame delta:delta. |
560 object extent:(actionData minExtent). |
575 object extent:(actionData minExtent). |
561 object realize. |
576 object realize. |
562 |
|
563 self actionCreate:object frame:frame delta:delta. |
|
564 self invertOutlineOf:object. |
577 self invertOutlineOf:object. |
565 ! ! |
578 ! ! |
566 |
579 |
567 !UIObjectView methodsFor:'object moving'! |
580 !UIObjectView methodsFor:'object moving'! |
568 |
581 |
1426 |
1447 |
1427 |
1448 |
1428 |
1449 |
1429 ! |
1450 ! |
1430 |
1451 |
|
1452 copyLayout |
|
1453 "copy the layout from the selected object |
|
1454 " |
|
1455 |object| |
|
1456 |
|
1457 object := self singleSelection. |
|
1458 |
|
1459 object notNil ifTrue:[ |
|
1460 copiedLayout := object geometryLayout copy |
|
1461 ] ifFalse:[ |
|
1462 self warn:'exactly one element must be selected'. |
|
1463 ] |
|
1464 |
|
1465 |
|
1466 |
|
1467 ! |
|
1468 |
1431 pasteExtent |
1469 pasteExtent |
1432 "paste the copied extent to all objects in the selection |
1470 "paste the copied extent to all objects in the selection |
1433 " |
1471 " |
1434 copiedExtent notNil ifTrue:[ |
1472 copiedExtent notNil ifTrue:[ |
1435 self transition:#pasteExtent dimensionDo:[:v| |
1473 self transition:#pasteExtent dimensionDo:[:v| |
1445 self transition:#pasteHeight dimensionDo:[:v| |
1483 self transition:#pasteHeight dimensionDo:[:v| |
1446 self resize:v bottom:(v computeOrigin + copiedExtent) |
1484 self resize:v bottom:(v computeOrigin + copiedExtent) |
1447 ] |
1485 ] |
1448 ] |
1486 ] |
1449 |
1487 |
|
1488 ! |
|
1489 |
|
1490 pasteLayout |
|
1491 "paste layout to all objects in the selection |
|
1492 " |
|
1493 copiedLayout notNil ifTrue:[ |
|
1494 self transition:#pasteLayout dimensionDo:[:v| |
|
1495 v geometryLayout:(copiedLayout copy) |
|
1496 ] |
|
1497 ] |
1450 ! |
1498 ! |
1451 |
1499 |
1452 pasteWidth |
1500 pasteWidth |
1453 "paste the copied extent width to all objects in the selection |
1501 "paste the copied extent width to all objects in the selection |
1454 " |
1502 " |