3527 self updateInfoLabel. |
3534 self updateInfoLabel. |
3528 "Modified: / 22.8.1998 / 17:41:34 / cg" |
3535 "Modified: / 22.8.1998 / 17:41:34 / cg" |
3529 ! |
3536 ! |
3530 |
3537 |
3531 initialize |
3538 initialize |
|
3539 |name| |
|
3540 |
3532 super initialize. |
3541 super initialize. |
3533 |
3542 |
3534 modified := false. |
3543 modified := false. |
3535 aspects := IdentityDictionary new. |
3544 aspects := IdentityDictionary new. |
3536 aspects at:#classNameChannel put:'NewApplication' asValue. |
3545 aspects at:#classNameChannel put:'NewApplication' asValue. |
3537 ! |
|
3538 |
|
3539 loadFromClass:aClass andSelector:selector |
|
3540 "loads a window spec by evaluating aMessageString |
|
3541 (which is something like 'fooClass windowSpec')" |
|
3542 |
|
3543 self assert:(aClass isNil or:[aClass isClass]). |
|
3544 |
|
3545 self askForModification ifFalse:[^ self]. |
|
3546 |
|
3547 self setClass:aClass selector:selector. |
|
3548 |
|
3549 (aClass respondsTo:selector) ifTrue:[ |
|
3550 self painter setupFromSpec:(aClass perform:selector). |
|
3551 ] |
|
3552 ! |
|
3553 |
|
3554 loadFromMessage:classAndSelector |
|
3555 "loads a window spec by evaluating aMessageString |
|
3556 (which is something like 'fooClass windowSpec')" |
|
3557 |
|
3558 self askForModification ifFalse:[^ self]. |
|
3559 |
|
3560 classAndSelector notNil ifTrue:[ |
|
3561 self loadFromClass:classAndSelector methodClass andSelector:classAndSelector methodSelector |
|
3562 ] |
|
3563 ! |
|
3564 |
|
3565 openInterface:aSymbol |
|
3566 "in addition to opening my interface, also open up a gallery and a painter" |
|
3567 |
|
3568 |cls painterView painter topView galleryWindow icon name| |
|
3569 |
|
3570 specClassName notNil ifTrue:[ |
|
3571 specClassName isBehavior ifTrue:[ |
|
3572 name := specClassName nameWithoutPrefix. |
|
3573 ] ifFalse:[ |
|
3574 name := specClassName printString string |
|
3575 ] |
|
3576 ]. |
|
3577 (aspects at:#classNameChannel) value:(specClassName ? 'NewApplication'). |
|
3578 |
|
3579 specSuperclassName isNil ifTrue:[ |
|
3580 specClassName notNil ifTrue:[ |
|
3581 (cls := self resolveName:specClassName) notNil ifTrue:[ |
|
3582 specSuperclassName := cls superclass name. |
|
3583 ] |
|
3584 ] |
|
3585 ]. |
|
3586 aspects at:#superclassNameChannel |
|
3587 put:((specSuperclassName notNil |
|
3588 ifTrue:[ specSuperclassName ] |
|
3589 ifFalse:[ 'ApplicationModel' ]) asValue). |
|
3590 aspects at:#superclassNameDefaults |
|
3591 put:#( 'ApplicationModel' 'SimpleDialog' ) asValue. |
|
3592 aspects at:#methodNameChannel |
|
3593 put:((specSelector notNil |
|
3594 ifTrue:[ specSelector asValue ] |
|
3595 ifFalse:[ #windowSpec ]) asValue). |
|
3596 |
3546 |
3597 treeView := TreeView new. |
3547 treeView := TreeView new. |
3598 treeView windowSpecClass:(self defaultWindowSpecClass). |
3548 treeView windowSpecClass:(self defaultWindowSpecClass). |
3599 treeView |
3549 treeView |
3600 selectConditionBlock:[:newSelection | self selectionChangeAllowed:newSelection ]. |
3550 selectConditionBlock:[:newSelection | self selectionChangeAllowed:newSelection ]. |
3608 painter := UIPainterView in:painterView. |
3558 painter := UIPainterView in:painterView. |
3609 painter layout:(0.0 @ 0.0 corner:1.0 @ 1.0) asLayout. |
3559 painter layout:(0.0 @ 0.0 corner:1.0 @ 1.0) asLayout. |
3610 treeView := treeView canvas:painter specName:name. |
3560 treeView := treeView canvas:painter specName:name. |
3611 painter treeView:treeView. |
3561 painter treeView:treeView. |
3612 treeView model addDependent:self. |
3562 treeView model addDependent:self. |
|
3563 painter enableChannel:(self enableChannel). |
|
3564 ! |
|
3565 |
|
3566 loadFromClass:aClass andSelector:selector |
|
3567 "loads a window spec by evaluating aMessageString |
|
3568 (which is something like 'fooClass windowSpec')" |
|
3569 |
|
3570 self assert:(aClass isNil or:[aClass isClass]). |
|
3571 |
|
3572 self askForModification ifFalse:[^ self]. |
|
3573 |
|
3574 self setClass:aClass selector:selector. |
|
3575 |
|
3576 (aClass respondsTo:selector) ifTrue:[ |
|
3577 self painter setupFromSpec:(aClass perform:selector). |
|
3578 ] |
|
3579 ! |
|
3580 |
|
3581 loadFromMessage:classAndSelector |
|
3582 "loads a window spec by evaluating aMessageString |
|
3583 (which is something like 'fooClass windowSpec')" |
|
3584 |
|
3585 self askForModification ifFalse:[^ self]. |
|
3586 |
|
3587 classAndSelector notNil ifTrue:[ |
|
3588 self loadFromClass:classAndSelector methodClass andSelector:classAndSelector methodSelector |
|
3589 ] |
|
3590 ! |
|
3591 |
|
3592 openInterface:aSymbol |
|
3593 "in addition to opening my interface, also open up a gallery and a painter" |
|
3594 |
|
3595 |cls topView galleryWindow icon name| |
|
3596 |
|
3597 specClassName notNil ifTrue:[ |
|
3598 specClassName isBehavior ifTrue:[ |
|
3599 name := specClassName nameWithoutPrefix. |
|
3600 ] ifFalse:[ |
|
3601 name := specClassName printString string |
|
3602 ] |
|
3603 ]. |
|
3604 (aspects at:#classNameChannel) value:(specClassName ? 'NewApplication'). |
|
3605 |
|
3606 specSuperclassName isNil ifTrue:[ |
|
3607 specClassName notNil ifTrue:[ |
|
3608 (cls := self resolveName:specClassName) notNil ifTrue:[ |
|
3609 specSuperclassName := cls superclass name. |
|
3610 ] |
|
3611 ] |
|
3612 ]. |
|
3613 aspects at:#superclassNameChannel |
|
3614 put:((specSuperclassName notNil |
|
3615 ifTrue:[ specSuperclassName ] |
|
3616 ifFalse:[ 'ApplicationModel' ]) asValue). |
|
3617 aspects at:#superclassNameDefaults |
|
3618 put:#( 'ApplicationModel' 'SimpleDialog' ) asValue. |
|
3619 aspects at:#methodNameChannel |
|
3620 put:((specSelector notNil |
|
3621 ifTrue:[ specSelector asValue ] |
|
3622 ifFalse:[ #windowSpec ]) asValue). |
|
3623 |
|
3624 "/ treeView := TreeView new. |
|
3625 "/ treeView windowSpecClass:(self defaultWindowSpecClass). |
|
3626 "/ treeView |
|
3627 "/ selectConditionBlock:[:newSelection | self selectionChangeAllowed:newSelection ]. |
|
3628 |
|
3629 "/ painterView := StandardSystemView new. |
|
3630 "/ name := name ? UIPainter defaultNameOfCanvas. |
|
3631 "/ painterView beToolWindow. |
|
3632 "/ painterView name:name. |
|
3633 "/ painterView label:name. |
|
3634 "/ painterView extent:(treeView windowSpecClass defaultExtentInUIPainter). |
|
3635 "/ painter := UIPainterView in:painterView. |
|
3636 "/ painter layout:(0.0 @ 0.0 corner:1.0 @ 1.0) asLayout. |
|
3637 "/ treeView := treeView canvas:painter specName:name. |
|
3638 "/ painter treeView:treeView. |
|
3639 "/ treeView model addDependent:self. |
|
3640 "/ painter enableChannel:(self enableChannel). |
3613 |
3641 |
3614 super openInterface:aSymbol. |
3642 super openInterface:aSymbol. |
3615 |
3643 |
3616 topView := self window. |
3644 topView := self window. |
3617 topView label:'GUI Painter'. |
3645 topView label:'GUI Painter'. |