equal
deleted
inserted
replaced
9 other person. No title to or ownership of the software is |
9 other person. No title to or ownership of the software is |
10 hereby transferred. |
10 hereby transferred. |
11 " |
11 " |
12 |
12 |
13 UIObjectView subclass:#UIPainterView |
13 UIObjectView subclass:#UIPainterView |
14 instanceVariableNames:'claus listHolder superclassName className methodName categoryName' |
14 instanceVariableNames:'treeView listHolder superclassName className methodName categoryName' |
15 classVariableNames:'HandCursor' |
15 classVariableNames:'HandCursor' |
16 poolDictionaries:'' |
16 poolDictionaries:'' |
17 category:'Interface-UIPainter' |
17 category:'Interface-UIPainter' |
18 ! |
18 ! |
19 |
19 |
97 ! |
97 ! |
98 |
98 |
99 findInputViewIn:aSuperView |
99 findInputViewIn:aSuperView |
100 "returns index of input view into superview or nil |
100 "returns index of input view into superview or nil |
101 " |
101 " |
102 |subviews| |
|
103 |
|
104 aSuperView == self ifTrue:[ |
102 aSuperView == self ifTrue:[ |
105 ^ self subViews findFirst:[:v| v == inputView ] |
103 ^ self subViews findFirst:[:v| v == inputView ] |
106 ]. |
104 ]. |
107 ^ 0 |
105 ^ 0 |
108 ! |
106 ! |
151 ! ! |
149 ! ! |
152 |
150 |
153 !UIPainterView methodsFor:'change & update'! |
151 !UIPainterView methodsFor:'change & update'! |
154 |
152 |
155 layoutChanged |
153 layoutChanged |
156 claus layoutChanged |
154 treeView layoutChanged |
157 ! ! |
155 ! ! |
158 |
156 |
159 !UIPainterView methodsFor:'copy & cut & paste'! |
157 !UIPainterView methodsFor:'copy & cut & paste'! |
160 |
158 |
161 copySelection |
159 copySelection |
181 |specs coll| |
179 |specs coll| |
182 |
180 |
183 coll := self minSetOfSuperViews:(self selection). |
181 coll := self minSetOfSuperViews:(self selection). |
184 |
182 |
185 coll notNil ifTrue:[ |
183 coll notNil ifTrue:[ |
186 claus cvsEventsDisabledDo:[ |
184 treeView cvsEventsDisabledDo:[ |
187 self select:nil. |
185 self select:nil. |
188 specs := coll collect:[:aView| self fullSpecFor:aView ]. |
186 specs := coll collect:[:aView| self fullSpecFor:aView ]. |
189 |
187 |
190 self withinTransaction:#cut objects:coll do:[ |
188 self withinTransaction:#cut objects:coll do:[ |
191 coll reverseDo:[:aView| |
189 coll reverseDo:[:aView| |
218 |
216 |
219 (self canPaste:aSpecificationOrList) ifFalse:[ |
217 (self canPaste:aSpecificationOrList) ifFalse:[ |
220 ^ nil |
218 ^ nil |
221 ]. |
219 ]. |
222 |
220 |
223 claus cvsSetupListDo:[ |
221 treeView cvsSetupListDo:[ |
224 aSpecificationOrList isCollection ifTrue:[ |
222 aSpecificationOrList isCollection ifTrue:[ |
225 paste := aSpecificationOrList |
223 paste := aSpecificationOrList |
226 ] ifFalse:[ |
224 ] ifFalse:[ |
227 paste := Array with:aSpecificationOrList |
225 paste := Array with:aSpecificationOrList |
228 ]. |
226 ]. |
396 self warn:'set the class first'. |
394 self warn:'set the class first'. |
397 ^ code |
395 ^ code |
398 ]. |
396 ]. |
399 cls := Smalltalk classNamed:className. |
397 cls := Smalltalk classNamed:className. |
400 |
398 |
401 claus propertiesDo:[:aProp | |
399 treeView propertiesDo:[:aProp | |
402 |modelSelector menuSelector protoSpec thisCode| |
400 |modelSelector menuSelector protoSpec thisCode| |
403 |
401 |
404 protoSpec := aProp spec. |
402 protoSpec := aProp spec. |
405 |
403 |
406 (modelSelector := aProp model) notNil ifTrue:[ |
404 (modelSelector := aProp model) notNil ifTrue:[ |
466 |
464 |
467 |
465 |
468 ! |
466 ! |
469 |
467 |
470 generateWindowSpecMethodSource |
468 generateWindowSpecMethodSource |
471 |t s spec specArray str code category cls mthd| |
469 |spec specArray str code category cls mthd| |
472 |
470 |
473 specArray := OrderedCollection new. |
471 specArray := OrderedCollection new. |
474 |
472 |
475 self subViews do:[:aView| |
473 self subViews do:[:aView| |
476 aView ~~ inputView ifTrue:[ |
474 aView ~~ inputView ifTrue:[ |
491 (mthd := cls class compiledMethodAt:methodName asSymbol) notNil ifTrue:[ |
489 (mthd := cls class compiledMethodAt:methodName asSymbol) notNil ifTrue:[ |
492 category := mthd category. |
490 category := mthd category. |
493 ] |
491 ] |
494 ]. |
492 ]. |
495 |
493 |
496 code := Character excla asString |
494 code := '!!' |
497 , className , ' class methodsFor:' , category storeString |
495 , className , ' class methodsFor:' , category storeString |
498 , Character excla asString , '\\' |
496 , '!!' , '\\' |
499 |
497 |
500 , methodName , '\' |
498 , methodName , '\' |
501 , ' "this window spec was automatically generated by the ST/X UIPainter"\\' |
499 , ' "this window spec was automatically generated by the ST/X UIPainter"\\' |
502 , ' "do not manually edit this - the painter/builder may not be able to\' |
500 , ' "do not manually edit this - the painter/builder may not be able to\' |
503 , ' handle the specification if its corrupted."\\' |
501 , ' handle the specification if its corrupted."\\' |
513 , '\' |
511 , '\' |
514 , ' <resource: #canvas>\\' |
512 , ' <resource: #canvas>\\' |
515 , ' ^\' |
513 , ' ^\' |
516 , ' ', str contents |
514 , ' ', str contents |
517 , '\' |
515 , '\' |
518 , Character excla asString |
516 , '!! !!' |
519 , ' ' |
|
520 , Character excla asString |
|
521 , '\\'. |
517 , '\\'. |
522 |
518 |
523 ^ code withCRs |
519 ^ code withCRs |
524 |
520 |
525 "Modified: 5.9.1995 / 21:01:35 / claus" |
521 "Modified: 5.9.1995 / 21:01:35 / claus" |
542 ! |
538 ! |
543 |
539 |
544 setupFromSpec:specOrSpecArray |
540 setupFromSpec:specOrSpecArray |
545 |spec builder| |
541 |spec builder| |
546 |
542 |
547 claus cvsSetupListDo:[ |
543 treeView cvsSetupListDo:[ |
548 self removeAll. |
544 self removeAll. |
549 spec := UISpecification from:specOrSpecArray. |
545 spec := UISpecification from:specOrSpecArray. |
550 builder := UIBuilder new. |
546 builder := UIBuilder new. |
551 spec window setupView:self topView for:builder. |
547 spec window setupView:self topView for:builder. |
552 self addSpec:(spec component) builder:builder in:self. |
548 self addSpec:(spec component) builder:builder in:self. |
554 inputView raise. |
550 inputView raise. |
555 ] |
551 ] |
556 ! |
552 ! |
557 |
553 |
558 treeView:aTreeView |
554 treeView:aTreeView |
559 claus := aTreeView |
555 treeView := aTreeView |
560 ! ! |
556 ! ! |
561 |
557 |
562 !UIPainterView methodsFor:'menus'! |
558 !UIPainterView methodsFor:'menus'! |
563 |
559 |
564 showMiddleButtonMenu |
560 showMiddleButtonMenu |
586 |
582 |
587 remove:anObject |
583 remove:anObject |
588 "remove anObject from the contents do redraw |
584 "remove anObject from the contents do redraw |
589 " |
585 " |
590 anObject notNil ifTrue:[ |
586 anObject notNil ifTrue:[ |
591 claus removeView:anObject. |
587 treeView removeView:anObject. |
592 ] |
588 ] |
593 ! |
589 ! |
594 |
590 |
595 removeAll |
591 removeAll |
596 "remove all objects and properties |
592 "remove all objects and properties |
597 " |
593 " |
598 claus cvsEventsDisabledDo:[ |
594 treeView cvsEventsDisabledDo:[ |
599 self select:nil. |
595 self select:nil. |
600 claus removeAll. |
596 treeView removeAll. |
601 self removeUndoHistory. |
597 self removeUndoHistory. |
602 ] |
598 ] |
603 ! ! |
599 ! ! |
604 |
600 |
605 !UIPainterView methodsFor:'searching'! |
601 !UIPainterView methodsFor:'searching'! |
652 |
648 |
653 propertyOfIdentifier:anId |
649 propertyOfIdentifier:anId |
654 "returns property assigned to unique identifier |
650 "returns property assigned to unique identifier |
655 " |
651 " |
656 anId notNil ifTrue:[ |
652 anId notNil ifTrue:[ |
657 ^ claus propertyDetect:[:p| p identifier == anId ] |
653 ^ treeView propertyDetect:[:p| p identifier == anId ] |
658 ]. |
654 ]. |
659 ^ nil |
655 ^ nil |
660 ! |
656 ! |
661 |
657 |
662 propertyOfName:aString |
658 propertyOfName:aString |
664 " |
660 " |
665 |name| |
661 |name| |
666 |
662 |
667 aString isNil ifFalse:[ |
663 aString isNil ifFalse:[ |
668 name := aString string withoutSeparators. |
664 name := aString string withoutSeparators. |
669 ^ claus propertyDetect:[:p| p name = name ]. |
665 ^ treeView propertyDetect:[:p| p name = name ]. |
670 ]. |
666 ]. |
671 ^ nil |
667 ^ nil |
672 ! |
668 ! |
673 |
669 |
674 propertyOfView:aView |
670 propertyOfView:aView |
675 "returns property assigned to view |
671 "returns property assigned to view |
676 " |
672 " |
677 (aView isNil or:[aView == self]) ifFalse:[ |
673 (aView isNil or:[aView == self]) ifFalse:[ |
678 ^ claus propertyDetect:[:p| p view == aView ] |
674 ^ treeView propertyDetect:[:p| p view == aView ] |
679 ]. |
675 ]. |
680 ^ nil |
676 ^ nil |
681 ! |
677 ! |
682 |
678 |
683 uniqueNameFor:aSpecOrString |
679 uniqueNameFor:aSpecOrString |
695 ]. |
691 ]. |
696 name at:1 put:(name at:1) asLowercase. |
692 name at:1 put:(name at:1) asLowercase. |
697 size := name size + 1. |
693 size := name size + 1. |
698 next := 0. |
694 next := 0. |
699 |
695 |
700 claus propertiesDo:[:p| |
696 treeView propertiesDo:[:p| |
701 |n| |
697 |n| |
702 n := p name. |
698 n := p name. |
703 |
699 |
704 (n size >= size and:[n startsWith:name]) ifTrue:[ |
700 (n size >= size and:[n startsWith:name]) ifTrue:[ |
705 next := next max:(p extractNumberStartingAt:size) |
701 next := next max:(p extractNumberStartingAt:size) |
740 ] |
736 ] |
741 ] ifTrue:[ |
737 ] ifTrue:[ |
742 selection add:anObject |
738 selection add:anObject |
743 ]. |
739 ]. |
744 self showSelected:anObject. |
740 self showSelected:anObject. |
745 claus cvsSelectionAdd:anObject. |
741 treeView cvsSelectionAdd:anObject. |
746 ] |
742 ] |
747 |
743 |
748 |
744 |
749 ! |
745 ! |
750 |
746 |
758 selection remove:anObject ifAbsent:nil. |
754 selection remove:anObject ifAbsent:nil. |
759 self showSelection. |
755 self showSelection. |
760 ] ifFalse:[ |
756 ] ifFalse:[ |
761 selection := nil |
757 selection := nil |
762 ]. |
758 ]. |
763 claus cvsSelectionRemove:anObject. |
759 treeView cvsSelectionRemove:anObject. |
764 ] |
760 ] |
765 |
761 |
766 ! |
762 ! |
767 |
763 |
768 select:something |
764 select:something |
769 "change selection to something |
765 "change selection to something |
770 " |
766 " |
771 (self enabled and:[something ~= self selection]) ifTrue:[ |
767 (self enabled and:[something ~= self selection]) ifTrue:[ |
772 self setSelection:something withRedraw:true. |
768 self setSelection:something withRedraw:true. |
773 claus cvsSelection:something |
769 treeView cvsSelection:something |
774 ] |
770 ] |
775 |
771 |
776 ! |
772 ! |
777 |
773 |
778 updateSelectionFromModel:aSel |
774 updateSelectionFromModel:aSel |
820 n := s name. |
816 n := s name. |
821 |
817 |
822 (n isNil or:[(self propertyOfName:n) notNil]) ifTrue:[ |
818 (n isNil or:[(self propertyOfName:n) notNil]) ifTrue:[ |
823 s name:(self uniqueNameFor:s) |
819 s name:(self uniqueNameFor:s) |
824 ]. |
820 ]. |
825 claus addProperty:p. |
821 treeView addProperty:p. |
826 ]. |
822 ]. |
827 |
823 |
828 ^ aSpecification buildViewWithLayoutFor:aBuilder in:aFrame. |
824 ^ aSpecification buildViewWithLayoutFor:aBuilder in:aFrame. |
829 |
825 |
830 "Modified: 4.7.1997 / 23:48:55 / cg" |
826 "Modified: 4.7.1997 / 23:48:55 / cg" |
918 ] ifFalse:[ |
914 ] ifFalse:[ |
919 aSpec setAttributesIn:aView with:builder. |
915 aSpec setAttributesIn:aView with:builder. |
920 self elementChangedSize:aView. |
916 self elementChangedSize:aView. |
921 ]. |
917 ]. |
922 props spec:(aSpec copy). |
918 props spec:(aSpec copy). |
923 claus propertyChanged:props. |
919 treeView propertyChanged:props. |
924 ] |
920 ] |
925 ] |
921 ] |
926 ] |
922 ] |
927 |
923 |
928 "Modified: 4.7.1997 / 23:49:44 / cg" |
924 "Modified: 4.7.1997 / 23:49:44 / cg" |
1080 view become:v |
1076 view become:v |
1081 ] ifFalse:[ |
1077 ] ifFalse:[ |
1082 spec setAttributesIn:view with:builder. |
1078 spec setAttributesIn:view with:builder. |
1083 self elementChangedSize:view. |
1079 self elementChangedSize:view. |
1084 ]. |
1080 ]. |
1085 claus propertyChanged:props. |
1081 treeView propertyChanged:props. |
1086 ] |
1082 ] |
1087 ! ! |
1083 ! ! |
1088 |
1084 |
1089 !UIPainterView::ViewProperty class methodsFor:'instance creation'! |
1085 !UIPainterView::ViewProperty class methodsFor:'instance creation'! |
1090 |
1086 |