UIPainterView.st
author ca
Tue, 04 Mar 1997 17:41:19 +0100
changeset 82 99dc76d66eab
parent 80 3316c52ef2b7
child 86 06bdbae8bd8e
permissions -rw-r--r--
checkin from browser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     1
"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     3
	      All Rights Reserved
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     4
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     5
 This software is furnished under a license and may be used
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     6
 only in accordance with the terms of that license and with the
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     8
 be provided or otherwise made available to, or used by, any
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
     9
 other person.  No title to or ownership of the software is
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    10
 hereby transferred.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    11
"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    12
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    13
UIObjectView subclass:#UIPainterView
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    14
	instanceVariableNames:'fontPanel viewProperties superclassName className methodName
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    15
		categoryName'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    16
	classVariableNames:'HandCursor'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    17
	poolDictionaries:''
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    18
	category:'Interface-UIPainter'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    19
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    20
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    21
Object subclass:#ViewProperty
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    22
	instanceVariableNames:'view spec identifier'
52
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
    23
	classVariableNames:'Identifier'
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
    24
	poolDictionaries:''
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
    25
	privateIn:UIPainterView
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    26
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    27
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    28
UIPainterView::ViewProperty subclass:#GroupProperties
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    29
	instanceVariableNames:'controlledObjects group name'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    30
	classVariableNames:''
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    31
	poolDictionaries:''
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    32
	privateIn:UIPainterView
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    33
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    34
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    35
!UIPainterView class methodsFor:'documentation'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    36
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    37
copyright
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    38
"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    39
 COPYRIGHT (c) 1995 by Claus Gittinger
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    40
	      All Rights Reserved
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    41
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    42
 This software is furnished under a license and may be used
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    43
 only in accordance with the terms of that license and with the
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    44
 inclusion of the above copyright notice.   This software may not
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    45
 be provided or otherwise made available to, or used by, any
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    46
 other person.  No title to or ownership of the software is
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    47
 hereby transferred.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    48
"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    49
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    50
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    51
documentation
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    52
"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    53
    not yet finished, not yet published, not yet released.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    54
"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    55
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    56
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    57
!UIPainterView class methodsFor:'defaults'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    58
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    59
defaultMenuMessage   
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    60
    "This message is the default yo be sent to the menuHolder to get a menu
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    61
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    62
    ^ #menu
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    63
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    64
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    65
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    66
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    67
!UIPainterView methodsFor:'accessing'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    68
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    69
application
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    70
    self halt.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    71
    ^ nil
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    72
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    73
    "Modified: 6.9.1995 / 00:46:44 / claus"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    74
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    75
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    76
applicationName
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    77
    ^ self className
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    78
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    79
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    80
applicationName:aName
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    81
    self className:aName
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    82
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    83
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    84
className
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    85
    ^ className
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    86
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    87
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    88
className:aName
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    89
    className := aName
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    90
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    91
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    92
className:aClassName superclassName:aSuperclassName selector:aSelector
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    93
    className      := aClassName.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    94
    superclassName := aSuperclassName.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    95
    methodName     := aSelector.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    96
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    97
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    98
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    99
methodName
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   100
    ^ methodName
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   101
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   102
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   103
methodName:aName
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   104
    methodName := aName
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   105
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   106
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   107
selectNames:aStringOrCollection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   108
    |prop coll s|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   109
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   110
    (aStringOrCollection isNil or:[aStringOrCollection isEmpty]) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   111
        ^ self unselect
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   112
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   113
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   114
    (s := aStringOrCollection) isString ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   115
        s size == 1 ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   116
            s := s first
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   117
        ] ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   118
            coll := OrderedCollection new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   119
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   120
            s do:[:aName|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   121
                (prop := self propertyOfName:aName) notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   122
                    coll add:(prop view)
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   123
                ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   124
            ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   125
            coll size == 1 ifTrue:[ ^ self select:(coll at:1) ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   126
            coll size == 0 ifTrue:[ ^ self unselect ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   127
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   128
          ^ self select:coll.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   129
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   130
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   131
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   132
    prop := self propertyOfName:s.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   133
    prop isNil ifTrue:[^ self unselect]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   134
              ifFalse:[^ self select:(prop view)]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   135
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   136
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   137
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   138
!UIPainterView methodsFor:'copy & cut & paste'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   139
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   140
copySelection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   141
    "copy the selection into the cut&paste-buffer
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   142
    "
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   143
    |specs coll|
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   144
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   145
    coll := self minSetOfSuperViews:selection.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   146
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   147
    coll notNil ifTrue:[
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   148
        self unselect.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   149
        specs := coll collect:[:aView| self fullSpecFor:aView ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   150
        self setSelection:specs
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   151
    ].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   152
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   153
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   154
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   155
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   156
deleteSelection
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   157
    "delete the selection; copy the selection into the cut&paste-buffer
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   158
     and open a transaction
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   159
    "
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   160
    |text specs coll|
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   161
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   162
    coll := self minSetOfSuperViews:selection.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   163
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   164
    coll notNil ifTrue:[
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   165
        self unselect.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   166
        specs := coll collect:[:aView| self fullSpecFor:aView ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   167
        text  := self transactionTextFor:coll.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   168
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   169
        undoHistory transaction:#cut text:text do:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   170
            coll reverseDo:[:o||p|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   171
                (p := self propertyOfView:o) notNil ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   172
                    self undoRemove:(p identifier)
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   173
                ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   174
                self remove:o
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   175
            ]
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   176
        ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   177
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   178
        self setSelection:specs.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   179
        self changed:#tree.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   180
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   181
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   182
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   183
pasteBuffer
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   184
    "add the objects in the paste-buffer to the object view
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   185
    "
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   186
    |paste frame pasteOrigin pasteOffset builder|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   187
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   188
    paste := self getSelection.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   189
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   190
    (self canPaste:paste) ifFalse:[ ^ self].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   191
    (paste isCollection)  ifFalse:[ paste := Array with:paste].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   192
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   193
    frame := self singleSelection.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   194
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   195
    (self canPasteInto:frame) ifFalse:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   196
        frame := self
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   197
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   198
    self unselect.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   199
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   200
    selection   := OrderedCollection new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   201
    pasteOffset := 0@0.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   202
    pasteOrigin := self sensor mousePoint.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   203
    pasteOrigin := device translatePoint:pasteOrigin from:device rootView id to:frame id.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   204
    builder     := UIBuilder new.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   205
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   206
    paste do:[:aSpec|
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   207
        |view|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   208
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   209
        view := self addSpec:aSpec builder:builder in:frame.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   210
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   211
        (frame bounds containsPoint:pasteOrigin) ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   212
            self moveObject:view to:pasteOffset.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   213
        ] ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   214
            self moveObject:view to:pasteOrigin + pasteOffset.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   215
        ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   216
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   217
        view realize.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   218
        selection add:view.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   219
        pasteOffset := pasteOffset + 4.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   220
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   221
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   222
    self transaction:#paste selectionDo:[:v|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   223
        self undoCreate:((self propertyOfView:v) identifier)
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   224
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   225
    selection size == 1 ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   226
        selection := selection at:1
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   227
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   228
    self showSelection.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   229
    self realizeAllSubViews.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   230
    inputView raise.
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   231
    self elementChangedSize:frame.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   232
    self changed:#tree
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   233
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   234
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   235
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   236
!UIPainterView methodsFor:'drag & drop'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   237
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   238
canDrop:anObjectOrCollection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   239
    Transcript showCR:'canDrop'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   240
    ^ true
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   241
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   242
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   243
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   244
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   245
drop:anObjectOrCollection at:aPoint
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   246
    Transcript showCR:'drop:anObjectOrCollection at:aPoint'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   247
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   248
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   249
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   250
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   251
!UIPainterView methodsFor:'generating output'!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   252
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   253
XXgenerateWindowSpecMethodSource
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   254
    |spec specArray str code|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   255
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   256
    subViews remove:inputView.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   257
    [
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   258
        spec := FullSpec fromView:self
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   259
    ] valueNowOrOnUnwindDo:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   260
        subViews addFirst:inputView.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   261
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   262
    specArray := spec literalArrayEncoding.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   263
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   264
    str := WriteStream on:String new.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   265
    self prettyPrintSpecArray:specArray on:str indent:5.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   266
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   267
    code := Character excla asString 
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   268
            , className , ' class methodsFor:''interface specs'''
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   269
            , Character excla asString , '\\'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   270
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   271
            , methodName , '\'
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   272
            , '    "this window spec was automatically generated by the ST/X UIPainter"\\'
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   273
            , '    "do not manually edit this - the painter/builder may not be able to\'
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   274
            , '     handle the specification if its corrupted."\\'
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   275
            , '    "\'
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   276
            , '     UIPainter new openOnClass:' , className , ' andSelector:#' , methodName , '\'
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   277
            , '     ' , className , ' new openInterface:#' , methodName , '\'
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   278
            , '    "\'.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   279
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   280
    methodName = 'windowSpec' ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   281
        code := code , '    "' , className , ' open"\'
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   282
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   283
    code := code 
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   284
            , '\'
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   285
            , '    <resource: #canvas>\\'
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   286
            , '    ^\' 
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   287
            , '     ', str contents
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   288
            , '\'
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   289
            , Character excla asString
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   290
            , ' '
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   291
            , Character excla asString
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   292
            , '\\'.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   293
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   294
    ^ code withCRs
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   295
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   296
    "Modified: 5.9.1995 / 21:01:35 / claus"
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   297
!
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   298
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   299
generateActionMethodFor:aspect spec:protoSpec inClass:targetClass
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   300
    ^ ('!!' , targetClass name , ' methodsFor:''actions''!!\\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   301
      aspect , '\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   302
      '    "automatically generated by UIPainter ..."\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   303
      '\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   304
      '    "action to be added ..."\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   305
      '    Transcript showCR:''action for ' , aspect , ' ...''.\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   306
      '!! !!\\') withCRs
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   307
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   308
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   309
generateAspectMethodFor:aspect spec:protoSpec inClass:targetClass
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   310
    ^ ('!!' , targetClass name , ' methodsFor:''aspects''!!\\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   311
      aspect , '\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   312
      '    "automatically generated by UIPainter ..."\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   313
      '\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   314
      '    |holder|\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   315
      '\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   316
      '    (holder := builder bindingAt:#' , aspect , ') isNil ifTrue:[\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   317
      '        builder aspectAt:#' , aspect , ' put:(holder := ' , ' ValueHolder new' , ').\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   318
      '    ].\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   319
      '    ^ holder\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   320
      '!! !!\\') withCRs
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   321
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   322
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   323
generateAspectMethods
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   324
    |cls code|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   325
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   326
    code := ''.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   327
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   328
    className isNil ifTrue:[
69
e533f77871dd generateAspectMethods: code2
ca
parents: 62
diff changeset
   329
        self warn:'set the class first'.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   330
        ^ code
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   331
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   332
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   333
    viewProperties do:[:aProp |
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   334
        |modelSelector menuSelector protoSpec thisCode|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   335
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   336
        (modelSelector := aProp model) notNil ifTrue:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   337
            (cls implements:modelSelector asSymbol) ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   338
                protoSpec := aProp view specClass basicNew.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   339
                "/ kludge ..
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   340
                (protoSpec isMemberOf:ActionButtonSpec) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   341
                    thisCode := (self generateActionMethodFor:modelSelector spec:protoSpec inClass:cls).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   342
                ] ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   343
                    thisCode := (self generateAspectMethodFor:modelSelector spec:protoSpec inClass:cls).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   344
                ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   345
                code := code , thisCode
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   346
            ].
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   347
        ].
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   348
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   349
        (menuSelector := aProp menu) notNil ifTrue:[
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   350
            (cls implements:menuSelector asSymbol) ifFalse:[
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   351
                protoSpec := aProp view specClass basicNew.
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   352
                "/ kludge ..
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   353
                thisCode := (self generateAspectMethodFor:menuSelector spec:protoSpec inClass:cls).
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   354
                code := code , thisCode
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   355
            ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   356
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   357
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   358
    ^ code
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   359
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   360
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   361
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   362
!UIPainterView ignoredMethodsFor:'generating output'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   363
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   364
generateClassDefinition
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   365
    |defCode|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   366
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   367
    defCode := superclassName , ' subclass:#' , className , '\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   368
    defCode := defCode , '  instanceVariableNames:'''.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   369
    defCode := defCode , self subviewVariableNames , '''\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   370
    defCode := defCode , '  classVariableNames:''''\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   371
    defCode := defCode , '  poolDictionaries:''''\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   372
    defCode := defCode , '  category:''' , categoryName , '''\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   373
    defCode := defCode , Character excla asString , '\\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   374
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   375
    ^ defCode withCRs
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   376
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   377
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   378
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   379
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   380
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   381
!UIPainterView methodsFor:'generating output'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   382
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   383
generateCode
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   384
    "generate code for the windowSpec method"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   385
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   386
    |code|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   387
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   388
    code := ''.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   389
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   390
"/    (Smalltalk classNamed:className asSymbol) isNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   391
"/        code := code , self generateClassDefinition.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   392
"/    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   393
"/    code := code , self generateInitMethod.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   394
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   395
    code := code , self generateWindowSpecMethodSource.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   396
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   397
"/    code := code , self generateAspectMethods.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   398
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   399
    ^ code withCRs
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   400
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   401
    "Modified: 5.9.1995 / 20:57:53 / claus"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   402
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   403
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   404
!UIPainterView ignoredMethodsFor:'generating output'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   405
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   406
generateInitCodeForGroup:aGroup
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   407
    |code c name p objects outlets moreCode sym typ val|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   408
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   409
    " <name> := <GroupClass> in:<name-of-superview>"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   410
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   411
    code := ''.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   412
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   413
    p := self propertyOfGroup:aGroup.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   414
    name := p at:#variableName.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   415
    c := '  ' , name , ' := ' , (aGroup class name) , ' new.\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   416
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   417
    code := code , c withCRs.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   418
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   419
    " <name> <symbol>:<value>"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   420
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   421
    objects := p at:#controlledObjects ifAbsent:[nil].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   422
    objects notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   423
        objects do:[:controlledObject |
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   424
            c := c , name , ' add:' , (self uniqueNameOf:controlledObject) , '.\'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   425
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   426
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   427
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   428
    code := code , c withCRs
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   429
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   430
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   431
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   432
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   433
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   434
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   435
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   436
generateInitCodeForOtherStuff
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   437
    |code g c name p outlets moreCode sym typ val|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   438
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   439
    code := ''.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   440
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   441
    "generate code for groups"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   442
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   443
    viewProperties do:[:props |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   444
        g := props at:#group ifAbsent:[nil].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   445
        g notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   446
            code := code , (self generateInitCodeForGroup:g)
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   447
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   448
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   449
    ^ code
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   450
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   451
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   452
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   453
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   454
generateInitCodeForView:aView
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   455
    |code c name p outlets moreCode sym typ val|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   456
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   457
    " <name> := <ViewClass> in:<name-of-superview>"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   458
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   459
    code := ''.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   460
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   461
    p := self propertyOfView:aView.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   462
    name := p at:#variableName.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   463
    c := '    ' , name , ' := ' ,
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   464
         (aView class name) , ' in:' , (self uniqueNameOf:(aView superView)) , '.\'.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   465
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   466
    " <name> origin:(...) extent:(...)"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   467
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   468
    c := c , '    ' , name , ' origin:(', aView origin printString , ')'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   469
                    , ' extent:(', aView extent printString , ').\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   470
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   471
    moreCode := p at:#initCode ifAbsent:nil.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   472
    moreCode notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   473
        c := c , moreCode , '\' withCRs
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   474
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   475
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   476
    code := code , c withCRs.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   477
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   478
    " <name> <symbol>:<value>"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   479
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   480
    outlets := p at:#outlets ifAbsent:[nil].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   481
    outlets notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   482
        outlets do:[:selectorOutlet |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   483
            sym := selectorOutlet at:#selector.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   484
            typ := selectorOutlet at:#type.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   485
            val := selectorOutlet at:#value.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   486
            c :=  '    ' , name , ' ' , sym.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   487
            (typ == #number) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   488
                c := c , val printString
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   489
            ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   490
            (typ == #string) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   491
                c := c , '''' , val , ''''
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   492
            ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   493
            (typ == #text) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   494
                c := c , '''' , val asString , ''''
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   495
            ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   496
            (typ == #strings) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   497
                c := c , '#( '.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   498
                val asText do:[:aString |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   499
                    c := c , '''' , aString , ''' '
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   500
                ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   501
                c := c , ')'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   502
            ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   503
            (typ == #block) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   504
                c := c , val
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   505
            ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   506
            (typ == #color) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   507
                c := c , '(Color name:''' , val , ''')'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   508
            ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   509
            c := c , '.' , Character cr asString.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   510
            code := code , c
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   511
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   512
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   513
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   514
    self subviewsOf:aView do:[:v |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   515
        code := code , (self generateInitCodeForView:v)
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   516
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   517
    ^ code.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   518
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   519
    "Modified: 5.9.1995 / 20:06:07 / claus"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   520
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   521
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   522
generateInitMethod
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   523
    |defCode code|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   524
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   525
    defCode := Character excla asString ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   526
               className , ' methodsFor:''initialization''' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   527
               Character excla asString , '\\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   528
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   529
    defCode := defCode , 'initialize\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   530
    defCode := defCode , '    super initialize.\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   531
    defCode := defCode , '    self setupSubViews.\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   532
    defCode := defCode , '    self setupLocalStuff\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   533
    defCode := defCode , Character excla asString , '\\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   534
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   535
    defCode := defCode , 'setupSubViews\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   536
    code := defCode withCRs.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   537
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   538
    self subviewsOf:self do:[:v |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   539
        code := code , (self generateInitCodeForView:v)
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   540
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   541
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   542
    code := code , (self generateInitCodeForOtherStuff).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   543
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   544
    code := code , '    ^ self\' withCRs.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   545
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   546
    defCode := Character excla asString , '\\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   547
    defCode := defCode , 'setupLocalStuff\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   548
    defCode := defCode , '    ^ self\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   549
    defCode := defCode , Character excla asString , ' ' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   550
                         Character excla asString , '\\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   551
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   552
    code := code , defCode withCRs.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   553
    ^ code.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   554
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   555
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   556
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   557
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   558
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   559
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   560
generateOutlets
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   561
    ^ self
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   562
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   563
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   564
!UIPainterView methodsFor:'generating output'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   565
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   566
generateWindowSpecMethodSource
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   567
    |t s spec specArray str code|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   568
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   569
    specArray := OrderedCollection new.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   570
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   571
    self subViews do:[:aView|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   572
        aView ~~ inputView ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   573
            specArray add:(self fullSpecFor:aView)
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   574
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   575
    ].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   576
    spec := FullSpec new.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   577
    spec fromBuilder:self components:(SpecCollection new collection:specArray).
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   578
    specArray := spec literalArrayEncoding.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   579
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   580
    str := WriteStream on:String new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   581
    self prettyPrintSpecArray:specArray on:str indent:5.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   582
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   583
    code := Character excla asString 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   584
            , className , ' class methodsFor:''interface specs'''
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   585
            , Character excla asString , '\\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   586
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   587
            , methodName , '\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   588
            , '    "this window spec was automatically generated by the ST/X UIPainter"\\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   589
            , '    "do not manually edit this - the painter/builder may not be able to\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   590
            , '     handle the specification if its corrupted."\\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   591
            , '    "\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   592
            , '     UIPainter new openOnClass:' , className , ' andSelector:#' , methodName , '\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   593
            , '     ' , className , ' new openInterface:#' , methodName , '\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   594
            , '    "\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   595
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   596
    methodName = 'windowSpec' ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   597
        code := code , '    "' , className , ' open"\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   598
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   599
    code := code 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   600
            , '\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   601
            , '    <resource: #canvas>\\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   602
            , '    ^\' 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   603
            , '     ', str contents
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   604
            , '\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   605
            , Character excla asString
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   606
            , ' '
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   607
            , Character excla asString
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   608
            , '\\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   609
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   610
    ^ code withCRs
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   611
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   612
    "Modified: 5.9.1995 / 21:01:35 / claus"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   613
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   614
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   615
!UIPainterView ignoredMethodsFor:'generating output'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   616
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   617
nameOfClass
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   618
    ^ 'NewView'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   619
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   620
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   621
!UIPainterView methodsFor:'generating output'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   622
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   623
outletValueOf:aSymbol for:aView
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   624
"/    |c name p outlets moreCode sym typ val|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   625
"/
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   626
"/    p := self propertyOfView:aView.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   627
"/    outlets := p at:#outlets ifAbsent:[^ nil].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   628
"/    outlets notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   629
"/        outlets do:[:selectorOutlet |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   630
"/            sym := selectorOutlet at:#selector.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   631
"/            (sym == aSymbol) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   632
"/                typ := selectorOutlet at:#type.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   633
"/                val := selectorOutlet at:#value.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   634
"/                ^ val
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   635
"/            ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   636
"/        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   637
"/    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   638
    ^ nil
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   639
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   640
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   641
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   642
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   643
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   644
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   645
prettyPrintSpecArray:spec on:aStream indent:i
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   646
    "just for your convenience: prettyPrint a specArray to aStream - it looks better that way"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   647
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   648
    |what oneLine|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   649
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   650
    spec isArray ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   651
        spec isLiteral ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   652
            aStream nextPutAll:spec storeString
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   653
        ] ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   654
            self halt.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   655
        ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   656
        ^ self
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   657
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   658
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   659
    spec isEmpty ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   660
        aStream nextPutAll:'#()'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   661
        ^ self
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   662
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   663
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   664
    what := spec at:1.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   665
    what isArray ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   666
        aStream cr; spaces:i+2.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   667
        aStream nextPutAll:'#('.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   668
        "/ a spec-collection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   669
        spec do:[:element |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   670
            self prettyPrintSpecArray:element on:aStream indent:i+2.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   671
        ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   672
        aStream cr.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   673
        aStream spaces:i+1.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   674
        aStream nextPutAll:')'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   675
        ^ self.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   676
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   677
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   678
    oneLine := false.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   679
    (#(#LayoutFrame #LayoutOrigin #AlignmentOrigin 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   680
       #Rectangle #Point
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   681
       #Color #ColorValue
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   682
    ) 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   683
    includesIdentical:what) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   684
        oneLine := true
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   685
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   686
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   687
    oneLine ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   688
        aStream cr.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   689
        aStream spaces:i+2.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   690
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   691
    aStream nextPutAll:'#('.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   692
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   693
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   694
    aStream nextPutAll:what storeString.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   695
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   696
    oneLine ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   697
        aStream cr.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   698
        aStream spaces:i+4.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   699
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   700
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   701
    2 to:spec size do:[:index |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   702
        aStream space.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   703
        self prettyPrintSpecArray:(spec at:index) on:aStream indent:i+4.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   704
        oneLine ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   705
            (index odd and:[index ~~ (spec size)]) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   706
                aStream cr; spaces:i+4.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   707
            ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   708
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   709
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   710
    oneLine ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   711
        aStream cr.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   712
        aStream spaces:i+1.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   713
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   714
    aStream nextPutAll:')'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   715
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   716
    "Modified: 5.9.1995 / 17:44:20 / claus"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   717
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   718
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   719
storeContentsOn:aStream
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   720
    viewProperties do:[:p| p storeOn:aStream]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   721
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   722
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   723
subviewsOf:aView do:aBlock
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   724
    |subs v|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   725
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   726
    (subs := aView subViews) notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   727
        subs do:[:v|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   728
            (v ~~ inputView and:[v notNil]) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   729
                (viewProperties detect:[:p | p view == v] ifNone:nil) notNil ifTrue:[ 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   730
                    (v superView == aView) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   731
                        aBlock value:v
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   732
                    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   733
                ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   734
            ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   735
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   736
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   737
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   738
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   739
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   740
!UIPainterView methodsFor:'group manipulations'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   741
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   742
groupEnterFields
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   743
    |props group objects|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   744
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   745
    selection isNil ifTrue:[^ self].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   746
    self selectionDo:[:aView |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   747
        (aView isKindOf:EditField) ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   748
            self warn:'select EditFields only !!'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   749
            ^ self
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   750
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   751
    ].
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   752
    self withSelectionHiddenDo:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   753
        group := EnterFieldGroup new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   754
        props := GroupProperties new.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   755
        name  := self uniqueNameFor:EnterFieldGroup.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   756
        props group:group.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   757
        props name:name.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   758
        group groupID:name asSymbol.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   759
        objects := OrderedCollection new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   760
        props controlledObjects:objects.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   761
        viewProperties add:props.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   762
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   763
        self selectionDo:[:aView |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   764
            objects add:aView.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   765
            group add:aView
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   766
        ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   767
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   768
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   769
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   770
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   771
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   772
groupRadioButtons
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   773
    |props name group objects|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   774
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   775
    selection isNil ifTrue:[^ self].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   776
    self selectionDo:[:aView |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   777
        (aView isKindOf:RadioButton) ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   778
            self warn:'select RadioButtons only !!'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   779
            ^ self
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   780
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   781
    ].
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   782
    self withSelectionHiddenDo:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   783
        group := RadioButtonGroup new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   784
        props := GroupProperties new.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   785
        name  := self uniqueNameFor:RadioButtonGroup.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   786
        props group:group.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   787
        props name:name.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   788
        group groupID:name asSymbol.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   789
        objects := OrderedCollection new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   790
        props controlledObjects:objects.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   791
        viewProperties add:props.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   792
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   793
        self selectionDo:[:aView |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   794
            aView turnOff.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   795
            objects add:aView.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   796
            group add:aView
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   797
        ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   798
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   799
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   800
    "Modified: 5.9.1995 / 16:06:15 / claus"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   801
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   802
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   803
!UIPainterView methodsFor:'initialization'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   804
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   805
initialize
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   806
    "setup attributes
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   807
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   808
    super initialize.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   809
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   810
    superclassName := 'ApplicationModel'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   811
    className      := 'NewApplication'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   812
    methodName     := 'windowSpec'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   813
    categoryName   := 'Applications'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   814
    viewProperties := OrderedCollection new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   815
    HandCursor     := Cursor leftHand.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   816
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   817
    "Modified: 5.9.1995 / 19:58:06 / claus"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   818
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   819
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   820
initializeCreatedObject:anObject
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   821
    "set default properties for a created object
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   822
    "
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   823
    |props spec cls|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   824
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   825
    cls   := anObject class.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   826
    spec  := anObject specClass fromView:anObject.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   827
    props := ViewProperty new.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   828
    props view:anObject.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   829
    props spec:spec.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   830
    props name:(self uniqueNameFor:cls).
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   831
    viewProperties add:props.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   832
82
99dc76d66eab checkin from browser
ca
parents: 80
diff changeset
   833
    ((spec respondsTo:#label:) and:[self supportsLabel:anObject]) ifTrue:[
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   834
        anObject label:(props name).
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   835
        spec label:(props name)
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   836
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   837
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   838
    undoHistory transaction:#create text:(props name) do:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   839
        self undoCreate:(props identifier).
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   840
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   841
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   842
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   843
setupFromSpec:specOrSpecArray
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   844
    |spec builder|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   845
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   846
    self removeAll.
80
3316c52ef2b7 write back specification to properties after undo modification
ca
parents: 78
diff changeset
   847
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   848
    spec    := UISpecification from:specOrSpecArray.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   849
    builder := UIBuilder new.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   850
    spec window setupView:self topView for:builder.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   851
    self addSpec:(spec component) builder:builder in:self.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   852
    self realizeAllSubViews.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   853
    inputView raise.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   854
    self changed:#tree.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   855
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   856
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   857
!UIPainterView methodsFor:'menus'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   858
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   859
menu
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   860
    "returns middle-button menu dependent on the selection
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   861
    "
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   862
    |menu canPaste undoIdx undoText|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   863
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   864
    testMode ifTrue:[^ nil ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   865
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   866
    canPaste := self canPaste:(self getSelection).
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   867
    undoText := undoHistory lastTypeAsString.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   868
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   869
    selection isNil ifTrue:[
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   870
        undoIdx := 2.
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   871
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   872
        menu := PopUpMenu labels:( resources array:#('paste' 'undo') )
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   873
                       selectors:#( #pasteBuffer #undoLast )
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   874
                    accelerators:#( #Paste       nil )
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   875
                        receiver:self.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   876
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   877
        canPaste ifFalse:[menu disable:#pasteBuffer].
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   878
    ] ifFalse:[    
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   879
        undoIdx := 4.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   880
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   881
        menu := PopUpMenu labels:( resources array:#(
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   882
                                      'copy' 
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   883
                                      'cut' 
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   884
                                      'paste'
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   885
                                      'undo'
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   886
                                      '-' 
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   887
                                      'arrange'
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   888
                                      'dimension'
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   889
                                      'align'
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   890
                                    )
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   891
                                  )
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   892
                       selectors:#(   #copySelection
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   893
                                      #deleteSelection
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   894
                                      #pasteBuffer
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   895
                                      #undoLast
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   896
                                      nil
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   897
                                      #arrange
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   898
                                      #dimension
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   899
                                      #align
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   900
                                  )
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   901
                       accelerators:#(#Copy
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   902
                                      #Cut
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   903
                                      #Paste
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   904
                                      nil
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   905
                                      nil
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   906
                                      nil
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   907
                                      nil
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   908
                                      nil
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   909
                                  )
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   910
                         receiver:self.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   911
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   912
        (canPaste and:[self canPasteInto:selection]) ifFalse:[
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   913
            menu disable:#pasteBuffer
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   914
        ].
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   915
        menu subMenuAt:#arrange   put:(self subMenuArrange).
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   916
        menu subMenuAt:#dimension put:(self subMenuDimension).
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   917
        menu subMenuAt:#align     put:(self subMenuAlign).
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   918
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   919
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   920
    undoText notNil ifTrue:[
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   921
        menu labelAt:undoIdx put:((menu labels at:undoIdx), ':  ', undoText)
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   922
    ] ifFalse:[
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   923
        menu disable:#undoLast
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   924
    ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   925
  ^ menu
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   926
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   927
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   928
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   929
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   930
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   931
showFontPanel
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   932
    |action|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   933
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   934
    fontPanel isNil ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   935
	fontPanel := FontPanel new 
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   936
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   937
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   938
    selection notNil ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   939
	action := [:family :face :style :size |
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   940
		       self changeFontFamily:family face:face
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   941
				       style:style size:size
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   942
		  ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   943
	fontPanel action:action.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   944
	fontPanel showAtPointer
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   945
    ]
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   946
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   947
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   948
subMenuAlign
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   949
    "returns submenu alignment
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   950
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   951
    |menu|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   952
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   953
    menu := PopUpMenu labels:(
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   954
                resources array:#(
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   955
                                    'align left' 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   956
                                    'align right'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   957
                                    'align left & right'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   958
                                    'align top' 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   959
                                    'align bottom'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   960
                                    'align centered vertical'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   961
                                    'align centered horizontal'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   962
                                    '-'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   963
                                    'spread horizontal'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   964
                                    'spread vertical'
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   965
                                    '-'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   966
                                    'center horizontal in frame'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   967
                                    'center vertical in frame'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   968
                                  )
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   969
                         )
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   970
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   971
              selectors:#(  
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   972
                            alignSelectionLeft
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   973
                            alignSelectionRight
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   974
                            alignSelectionLeftAndRight
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   975
                            alignSelectionTop
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   976
                            alignSelectionBottom
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   977
                            alignSelectionCenterHor
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   978
                            alignSelectionCenterVer
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   979
                            nil
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   980
                            spreadSelectionHor
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   981
                            spreadSelectionVer
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   982
                            nil
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   983
                            centerSelectionHor
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   984
                            centerSelectionVer
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   985
                         )
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   986
               receiver:self.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   987
    ^ menu    
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   988
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   989
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   990
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   991
subMenuArrange
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   992
    "returns submenu arrange
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   993
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   994
    |menu|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   995
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   996
    menu := PopUpMenu labels:( 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   997
                resources array:#(
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   998
                                    'to front' 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   999
                                    'to back' 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1000
                                 )
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1001
                              )
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1002
                   selectors:#(
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1003
                                    raiseSelection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1004
                                    lowerSelection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1005
                              )
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1006
                     receiver:self.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1007
  ^ menu
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1008
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1009
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1010
subMenuDimension
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1011
    "returns submenu dimension
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1012
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1013
    |menu|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1014
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1015
    menu := PopUpMenu labels:( 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1016
                resources array:#(
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1017
                                    'default extent' 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1018
                                    'default width' 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1019
                                    'default height'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1020
                                    '-'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1021
                                    'copy extent'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1022
                                    '-'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1023
                                    'paste extent'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1024
                                    'paste width'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1025
                                    'paste height'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1026
                                 )
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1027
                              )
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1028
                   selectors:#(
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1029
                                    setToDefaultExtent
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1030
                                    setToDefaultWidth
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1031
                                    setToDefaultHeight
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1032
                                    nil
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1033
                                    copyExtent
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1034
                                    nil
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1035
                                    pasteExtent
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1036
                                    pasteWidth
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1037
                                    pasteHeight
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1038
                              )
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1039
                     receiver:self.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1040
  ^ menu
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1041
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1042
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1043
subMenuFont
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1044
    "returns submenu dimension
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1045
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1046
    |menu|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1047
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1048
    menu := PopUpMenu labels:( 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1049
                resources array:#(
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1050
                                    'larger' 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1051
                                    'smaller'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1052
                                    '-'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1053
                                    'normal'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1054
                                    'bold'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1055
                                    'italic'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1056
                                    'bold italic'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1057
                                    '-'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1058
                                    'font panel'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1059
                                 )
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1060
                              )
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1061
                   selectors:#(
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1062
                                    largerFont 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1063
                                    smallerFont
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1064
                                    nil
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1065
                                    normalFont
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1066
                                    boldFont
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1067
                                    italicFont
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1068
                                    boldItalicFont
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1069
                                    nil
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1070
                                    showFontPanel
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1071
                              )
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1072
                     receiver:self.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1073
  ^ menu
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1074
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1075
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1076
!UIPainterView methodsFor:'misc'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1077
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1078
changeFontFamily:family face:face style:style size:size
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1079
    |f|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1080
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1081
    f := Font family:family
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1082
                face:face
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1083
               style:style
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1084
                size:size.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1085
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1086
    f notNil ifTrue:[
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1087
        self withSelectionHiddenDo:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1088
            self selectionDo:[:aView |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1089
                aView font:f.
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1090
                self elementChangedSize:aView.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1091
            ]
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1092
        ].
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1093
        self changed:#any.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1094
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1095
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1096
    "Modified: 5.9.1995 / 12:13:27 / claus"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1097
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1098
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1099
!UIPainterView methodsFor:'removing components'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1100
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1101
remove:anObject
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1102
    "remove anObject from the contents do redraw
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1103
    "
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1104
    |props|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1105
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1106
    anObject notNil ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1107
        (anObject subViews notNil) ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1108
            anObject subViews copy do:[:sub |
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1109
                self remove:sub
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1110
            ]
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1111
        ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1112
        (props := self propertyOfView:anObject) notNil ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1113
            viewProperties remove:props ifAbsent:nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1114
        ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1115
        anObject destroy
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1116
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1117
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1118
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1119
removeAll
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1120
    "remove all objects and properties
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1121
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1122
    self unselect.
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1123
    viewProperties := OrderedCollection new.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1124
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1125
    subViews notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1126
        subViews copy do:[:sub |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1127
            sub ~~ inputView ifTrue:[   
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1128
                self remove:sub
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1129
            ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1130
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1131
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1132
    undoHistory reinitialize.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1133
    self changed:#tree
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1134
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1135
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1136
!UIPainterView methodsFor:'searching'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1137
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1138
findObjectAt:aPoint
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1139
    "find the origin/corner of the currentWidget
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1140
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1141
    |view|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1142
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1143
    view := super findObjectAt:aPoint.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1144
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1145
    view notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1146
        "can be a view within a view not visible
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1147
        "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1148
        [ (self propertyOfView:view) isNil ] whileTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1149
            (view := view superView) == self ifTrue:[^ nil]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1150
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1151
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1152
    ^ view
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1153
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1154
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1155
findViewWithId:aViewId
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1156
    "finds view assigned to identifier and returns the view or nil
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1157
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1158
    |prop|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1159
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1160
    prop := self propertyOfIdentifier:aViewId.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1161
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1162
    prop notNil ifTrue:[^ prop view]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1163
               ifFalse:[^ nil]
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1164
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1165
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1166
propertyOfGroup:aGroup
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1167
    "returns property assigned to group
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1168
    "
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1169
    ^ viewProperties detect:[:p| p group == aGroup] ifNone:nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1170
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1171
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1172
propertyOfIdentifier:anId
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1173
    "returns property assigned to unique identifier
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1174
    "
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1175
    anId notNil ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1176
        ^ viewProperties detect:[:p| p identifier == anId] ifNone:nil.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1177
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1178
    ^ nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1179
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1180
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1181
propertyOfName:aString
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1182
    "returns property assigned to name
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1183
    "
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1184
    aString = 'self' ifFalse:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1185
        ^ viewProperties detect:[:p| p name = aString] ifNone:nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1186
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1187
    ^ nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1188
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1189
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1190
propertyOfView:aView
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1191
    "returns property assigned to view
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1192
    "
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1193
    (aView isNil or:[aView == self]) ifFalse:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1194
        ^ viewProperties detect:[:p| p view == aView] ifNone:nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1195
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1196
    ^ nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1197
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1198
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1199
uniqueNameFor:aClass
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1200
    "generate and return an unique name for a class
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1201
    "
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1202
    |next name size|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1203
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1204
    next  := 0.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1205
    name  := aClass name asString copy.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1206
    size  := name size + 1.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1207
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1208
    name at:1 put:(name at:1) asLowercase.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1209
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1210
    viewProperties do:[:p||n|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1211
        n := p name.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1212
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1213
        (n size >= size and:[n startsWith:name]) ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1214
            next := next max:(p extractNumberStartingAt:size)
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1215
        ]
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1216
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1217
    next := next + 1.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1218
    name := name, next printString.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1219
  ^ name
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1220
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1221
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1222
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1223
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1224
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1225
uniqueNameOf:aView
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1226
    |prop|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1227
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1228
    aView notNil ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1229
        prop := self propertyOfView:aView
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1230
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1231
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1232
    prop notNil ifTrue:[^ prop name]
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1233
               ifFalse:[^ 'self']
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1234
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1235
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1236
!UIPainterView methodsFor:'selection'!
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1237
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1238
addTreeFrom:aView to:aCollection
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1239
    "add aView and contained subcomponents to collection
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1240
    "
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1241
    (self propertyOfView:aView) notNil ifTrue:[
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1242
        aCollection add:aView.
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1243
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1244
        (aView subViews notNil) ifTrue:[
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1245
            aView subViews do:[:subView|
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1246
                self addTreeFrom:subView to:aCollection
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1247
            ]
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1248
        ].
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1249
    ]
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1250
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1251
!
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1252
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1253
selectSubComponents
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1254
    "select all subcomponents for current selection
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1255
    "
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1256
    |startAtView aCollection|
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1257
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1258
    aCollection := OrderedCollection new.
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1259
    startAtView := self singleSelection.
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1260
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1261
    startAtView isNil ifTrue:[
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1262
        self subViews notNil ifTrue:[
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1263
            self subViews do:[:subView|
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1264
                subView ~~ inputView ifTrue:[
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1265
                    self addTreeFrom:subView to:aCollection
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1266
                ]
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1267
            ]
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1268
        ]
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1269
    ] ifFalse:[
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1270
        self addTreeFrom:startAtView to:aCollection
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1271
    ].
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1272
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1273
    aCollection size > 1 ifTrue:[
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1274
        self withSelectionHiddenDo:[
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1275
            selection := aCollection
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1276
        ].
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1277
        self changed:#selection
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1278
    ]
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1279
! !
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
  1280
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1281
!UIPainterView methodsFor:'specification'!
a0a00603a8b6 keep spec in properties
ca