UIPainterView.st
author ca
Fri, 28 Feb 1997 18:04:09 +0100
changeset 69 e533f77871dd
parent 62 0e8573b4329a
child 71 407d25aca670
permissions -rw-r--r--
generateAspectMethods: code2
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
57
5af567f52811 checkin from browser
ca
parents: 55
diff changeset
    22
	instanceVariableNames:'aspectSelector changeSelector nameIndex view elementClass
59
0a2b2ff030a0 so far ...
ca
parents: 57
diff changeset
    23
		labelSelector identifier tabable defaultable menuSelector
0a2b2ff030a0 so far ...
ca
parents: 57
diff changeset
    24
		initiallyInvisible'
52
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
    25
	classVariableNames:'Identifier'
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
    26
	poolDictionaries:''
40a98a1507b4 *** empty log message ***
ca
parents: 51
diff changeset
    27
	privateIn:UIPainterView
51
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    28
!
01d0c9394944 *** empty log message ***
ca
parents: 49
diff changeset
    29
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    30
UIPainterView::ViewProperty subclass:#GroupProperties
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    31
	instanceVariableNames:'controlledObjects group'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    32
	classVariableNames:''
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    33
	poolDictionaries:''
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    34
	privateIn:UIPainterView
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    35
!
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
!UIPainterView class methodsFor:'documentation'!
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    40
"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    41
 COPYRIGHT (c) 1995 by Claus Gittinger
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    42
	      All Rights Reserved
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    43
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    44
 This software is furnished under a license and may be used
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    45
 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
    46
 inclusion of the above copyright notice.   This software may not
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    47
 be provided or otherwise made available to, or used by, any
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    48
 other person.  No title to or ownership of the software is
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    49
 hereby transferred.
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
!
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
documentation
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
    not yet finished, not yet published, not yet released.
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
! !
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
!UIPainterView class methodsFor:'defaults'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    61
defaultMenuMessage   
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    62
    "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
    63
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    64
    ^ #menu
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
! !
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
!UIPainterView methodsFor:'accessing'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    70
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    71
application
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    72
    self halt.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    73
    ^ nil
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
    "Modified: 6.9.1995 / 00:46:44 / claus"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    76
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    77
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    78
className
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    79
    ^ className
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    80
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    81
    "Modified: 5.9.1995 / 18:41:30 / claus"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    82
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    83
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    84
className:aString
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    85
    className := aString
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
    "Modified: 5.9.1995 / 18:47:17 / claus"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    88
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    89
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    90
className:aClassName superclassName:aSuperclassName selector:aSelector
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    91
    className := aClassName.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    92
    superclassName := aSuperclassName.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    93
    methodName := aSelector.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    94
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    95
!
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
methodName
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    98
    ^ methodName
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    99
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   100
    "Modified: 5.9.1995 / 18:41:34 / claus"
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   103
methodName:aString
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   104
    methodName := aString
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
    "Modified: 5.9.1995 / 18:47:27 / claus"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   107
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   108
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   109
selectNames:aStringOrCollection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   110
    |prop coll s|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   111
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   112
    (aStringOrCollection isNil or:[aStringOrCollection isEmpty]) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   113
        ^ self unselect
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   114
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   115
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   116
    (s := aStringOrCollection) isString ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   117
        s size == 1 ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   118
            s := s first
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   119
        ] ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   120
            coll := OrderedCollection new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   121
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   122
            s do:[:aName|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   123
                (prop := self propertyOfName:aName) notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   124
                    coll add:(prop view)
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   125
                ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   126
            ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   127
            coll size == 1 ifTrue:[ ^ self select:(coll at:1) ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   128
            coll size == 0 ifTrue:[ ^ self unselect ].
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
          ^ self select:coll.
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
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   133
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   134
    prop := self propertyOfName:s.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   135
    prop isNil ifTrue:[^ self unselect]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   136
              ifFalse:[^ self select:(prop view)]
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
! !
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
!UIPainterView ignoredMethodsFor:'code manipulation'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   141
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   142
changeClass
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   143
    |box classNameHolder superclassNameHolder|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   144
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   145
    classNameHolder := (className ? 'MyClass') asValue.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   146
    superclassNameHolder := (superclassName ? 'ApplicationModel') asValue.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   147
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   148
    box := DialogBox new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   149
    box addTextLabel:'class:'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   150
    box addInputFieldOn:classNameHolder.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   151
    box addTextLabel:'super class:'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   152
    box addInputFieldOn:superclassNameHolder.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   153
    box addAbortButton; addOkButton.
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
    box open.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   156
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   157
    box accepted ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   158
        className := classNameHolder value.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   159
        superclassName := superclassNameHolder value.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   160
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   161
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   162
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   163
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   164
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   165
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   166
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   167
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   168
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   169
changeVariables
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   170
    | box names propList p n newName|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   171
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   172
    names := VariableArray new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   173
    propList := VariableArray new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   174
    viewProperties do:[:props |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   175
        n := props name.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   176
        n notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   177
            names add:n.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   178
            propList add:props
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   179
        ]
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
    box := BuilderVariablesBox new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   182
    box list:names.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   183
    box selectAction:[:selection |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   184
        p := propList at:selection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   185
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   186
    box okAction:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   187
        newName := box enterValue.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   188
Transcript showCR:('renamed ' , (p name) , 'to:' , newName).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   189
        p name:newName
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   190
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   191
    box showAtPointer
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   194
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   195
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   196
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   197
!UIPainterView methodsFor:'copy & cut & paste'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   198
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   199
copySelection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   200
    "copy the selection into the cut&paste-buffer
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   201
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   202
    |specs|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   203
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   204
    specs := self generateSpecFor:selection.
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
    specs notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   207
        self setSelection:specs
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   208
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   209
    self unselect.
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   212
deleteSelection
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   213
    "delete the selection; copy the selection into the cut&paste-buffer
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   214
     and open a transaction
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   215
    "
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   216
    |text specs|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   217
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   218
    self numberOfSelections ~~ 0 ifTrue:[
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   219
        specs := self generateSpecFor:selection.
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   220
        text  := self transactionTextFor:selection.
60
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
        undoHistory transaction:#cut text:text do:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   223
            super deleteSelection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   224
        ].
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   225
        self setSelection:specs
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   226
    ]
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   229
pasteBuffer
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   230
    "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
   231
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   232
    |paste builder frame pasteOrigin pasteOffset|
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
    paste := self getSelection.
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
    (self canPaste:paste) ifFalse:[ ^ self].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   237
    (paste isCollection)  ifFalse:[ paste := Array with:paste].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   238
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   239
    frame := self singleSelection.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   240
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   241
    (self canPasteInto:frame) ifFalse:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   242
        frame := self
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
    self unselect.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   245
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   246
    builder     := UIBuilder new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   247
    selection   := OrderedCollection new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   248
    pasteOffset := 0@0.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   249
    pasteOrigin := self sensor mousePoint.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   250
    pasteOrigin := device translatePoint:pasteOrigin from:device rootView id to:frame id.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   251
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   252
    paste do:[:aSpec|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   253
        |view org|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   254
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   255
        builder componentCreationHook:[:aView :aSpecification :aBuilder |  
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   256
            self createdComponent:aView forSpec:aSpecification builder:aBuilder.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   257
        ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   258
        builder applicationClass:(Smalltalk classNamed:className).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   259
        view := aSpec buildViewWithLayoutFor:builder in:frame.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   260
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   261
        (frame bounds containsPoint:pasteOrigin) ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   262
            self moveObject:view to:pasteOffset.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   263
        ] ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   264
            self moveObject:view to:pasteOrigin + pasteOffset.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   265
        ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   266
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   267
        view realize.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   268
        selection add:view.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   269
        pasteOffset := pasteOffset + 4.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   270
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   271
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   272
    self transaction:#paste selectionDo:[:v|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   273
        self undoCreate:((self propertyOfView:v) identifier)
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   274
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   275
    selection size == 1 ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   276
        selection := selection at:1
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   277
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   278
    self showSelection.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   279
    self realizeAllSubViews.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   280
    inputView raise.
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   281
    self elementChangedSize:frame.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   282
    self changed:#tree
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   283
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   284
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   285
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   286
!UIPainterView methodsFor:'creating subviews'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   287
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   288
addProperties:properties for:aView
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   289
    "set properties to a view and add properties to viewProperties.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   290
     In case that properties are nil properties are created
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   291
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   292
    |name props|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   293
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   294
    (props := properties) isNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   295
        props := self propertiesForNewView:aView.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   296
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   297
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   298
    viewProperties add:props.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   299
    name := props name.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   300
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   301
    aView specClass supportsLabel ifTrue:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   302
        aView label:name
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
    aView name:name.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   305
  ^ props
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   306
!
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
propertiesForNewView:aView
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   309
    "generate property for a view and return properties
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   310
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   311
    |cls props index|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   312
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   313
    cls := aView class.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   314
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   315
    props := ViewProperty new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   316
    props view:aView.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   317
    props elementClass:cls.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   318
    index := self variableIndexForClass:cls.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   319
    props nameIndex:index.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   320
    props name:(self variableNameForClass:cls index:index).
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
    ^ props
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   323
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   324
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   325
setupCreatedObject:anObject
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   326
    "set default properties for a created object
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   327
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   328
    |props|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   329
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   330
    props := self addProperties:nil for:anObject.
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
    undoHistory transaction:#create text:(props name) do:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   333
        self undoCreate:(props identifier).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   334
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   335
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   336
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   337
!UIPainterView methodsFor:'drag & drop'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   338
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   339
canDrop:anObjectOrCollection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   340
    Transcript showCR:'canDrop'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   341
    ^ true
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   342
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   343
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   346
drop:anObjectOrCollection at:aPoint
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   347
    Transcript showCR:'drop:anObjectOrCollection at:aPoint'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   348
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   349
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   350
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   351
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   352
!UIPainterView methodsFor:'event handling'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   353
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   354
keyPress:key x:x y:y
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   355
    "any key pressed
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   356
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   357
    <resource: #keyboard ( #Copy #Paste) >
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   358
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   359
    key == #Copy ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   360
        ^ self copySelection
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   363
    key == #Paste ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   364
        ^ self pasteBuffer
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   365
    ].
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
    super keyPress:key x:x y:y
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   368
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   369
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   370
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   371
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   372
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   373
! !
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
!UIPainterView methodsFor:'generating output'!
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
generateActionMethodFor:aspect spec:protoSpec inClass:targetClass
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   378
    ^ ('!!' , targetClass name , ' methodsFor:''actions''!!\\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   379
      aspect , '\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   380
      '    "automatically generated by UIPainter ..."\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   381
      '\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   382
      '    "action to be added ..."\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   383
      '    Transcript showCR:''action for ' , aspect , ' ...''.\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   384
      '!! !!\\') withCRs
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   387
generateAspectMethodFor:aspect spec:protoSpec inClass:targetClass
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   388
    ^ ('!!' , targetClass name , ' methodsFor:''aspects''!!\\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   389
      aspect , '\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   390
      '    "automatically generated by UIPainter ..."\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   391
      '\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   392
      '    |holder|\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   393
      '\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   394
      '    (holder := builder bindingAt:#' , aspect , ') isNil ifTrue:[\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   395
      '        builder aspectAt:#' , aspect , ' put:(holder := ' , ' ValueHolder new' , ').\' ,
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
      '    ^ holder\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   398
      '!! !!\\') withCRs
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   399
!
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
generateAspectMethods
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   402
    |cls code|
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
    className isNil ifTrue:[
69
e533f77871dd generateAspectMethods: code2
ca
parents: 62
diff changeset
   405
        self warn:'set the class first'.
e533f77871dd generateAspectMethods: code2
ca
parents: 62
diff changeset
   406
        ^ ''
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   407
    ].
69
e533f77871dd generateAspectMethods: code2
ca
parents: 62
diff changeset
   408
"/    (cls := Smalltalk at:className asSymbol) isNil ifTrue:[
e533f77871dd generateAspectMethods: code2
ca
parents: 62
diff changeset
   409
"/        self warn:'create the class first'.
e533f77871dd generateAspectMethods: code2
ca
parents: 62
diff changeset
   410
"/        ^ ''
e533f77871dd generateAspectMethods: code2
ca
parents: 62
diff changeset
   411
"/    ].
60
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
    code := ''.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   414
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   415
    viewProperties do:[:aProp |
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   416
        |modelSelector menuSelector protoSpec thisCode|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   417
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   418
        (modelSelector := aProp aspectSelector) notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   419
            (cls implements:modelSelector asSymbol) ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   420
                protoSpec := aProp view specClass basicNew.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   421
                "/ kludge ..
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   422
                (protoSpec isMemberOf:ActionButtonSpec) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   423
                    thisCode := (self generateActionMethodFor:modelSelector spec:protoSpec inClass:cls).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   424
                ] ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   425
                    thisCode := (self generateAspectMethodFor:modelSelector spec:protoSpec inClass:cls).
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
                code := code , thisCode
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   428
            ].
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   429
        ].
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   430
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   431
        (menuSelector := aProp menuSelector) notNil ifTrue:[
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   432
            (cls implements:menuSelector asSymbol) ifFalse:[
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   433
                protoSpec := aProp view specClass basicNew.
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   434
                "/ kludge ..
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   435
                thisCode := (self generateAspectMethodFor:menuSelector spec:protoSpec inClass:cls).
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   436
                code := code , thisCode
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   437
            ]
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
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   440
    ^ code
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   441
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   444
!UIPainterView ignoredMethodsFor:'generating output'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   445
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   446
generateClassDefinition
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   447
    |defCode|
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
    defCode := superclassName , ' subclass:#' , className , '\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   450
    defCode := defCode , '  instanceVariableNames:'''.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   451
    defCode := defCode , self subviewVariableNames , '''\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   452
    defCode := defCode , '  classVariableNames:''''\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   453
    defCode := defCode , '  poolDictionaries:''''\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   454
    defCode := defCode , '  category:''' , categoryName , '''\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   455
    defCode := defCode , Character excla asString , '\\'.
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
    ^ defCode withCRs
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
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
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   462
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   463
!UIPainterView methodsFor:'generating output'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   464
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   465
generateCode
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   466
    "generate code for the windowSpec method"
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
    |code|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   469
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   470
    code := ''.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   471
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   472
"/    (Smalltalk classNamed:className asSymbol) isNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   473
"/        code := code , self generateClassDefinition.
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
"/    code := code , self generateInitMethod.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   476
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   477
    code := code , self generateWindowSpecMethodSource.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   478
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   479
"/    code := code , self generateAspectMethods.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   480
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   481
    ^ code withCRs
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   482
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   483
    "Modified: 5.9.1995 / 20:57:53 / claus"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   484
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   485
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   486
!UIPainterView ignoredMethodsFor:'generating output'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   487
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   488
generateInitCodeForGroup:aGroup
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   489
    |code c name p objects outlets moreCode sym typ val|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   490
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   491
    " <name> := <GroupClass> in:<name-of-superview>"
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
    code := ''.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   494
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   495
    p := self propertyOfGroup:aGroup.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   496
    name := p at:#variableName.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   497
    c := '  ' , name , ' := ' , (aGroup class name) , ' new.\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   498
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   499
    code := code , c withCRs.
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
    " <name> <symbol>:<value>"
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
    objects := p at:#controlledObjects ifAbsent:[nil].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   504
    objects notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   505
        objects do:[:controlledObject |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   506
            c := c , name , ' add:' , (self variableNameOf:controlledObject) , '.\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   507
        ]
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   510
    code := code , c withCRs
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   515
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   518
generateInitCodeForOtherStuff
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   519
    |code g c name p outlets moreCode sym typ val|
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
    code := ''.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   522
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   523
    "generate code for groups"
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
    viewProperties do:[:props |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   526
        g := props at:#group ifAbsent:[nil].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   527
        g notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   528
            code := code , (self generateInitCodeForGroup:g)
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   529
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   530
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   531
    ^ code
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   532
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   533
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   536
generateInitCodeForView:aView
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   537
    |code c name p outlets moreCode sym typ val|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   538
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   539
    " <name> := <ViewClass> in:<name-of-superview>"
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
    code := ''.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   542
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   543
    p := self propertyOfView:aView.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   544
    name := p at:#variableName.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   545
    c := '    ' , name , ' := ' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   546
         (aView class name) , ' in:' , (self variableNameOf:(aView superView)) , '.\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   547
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   548
    " <name> origin:(...) extent:(...)"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   549
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   550
    c := c , '    ' , name , ' origin:(', aView origin printString , ')'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   551
                    , ' extent:(', aView extent printString , ').\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   552
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   553
    moreCode := p at:#initCode ifAbsent:nil.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   554
    moreCode notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   555
        c := c , moreCode , '\' withCRs
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
    code := code , c withCRs.
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
    " <name> <symbol>:<value>"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   561
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   562
    outlets := p at:#outlets ifAbsent:[nil].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   563
    outlets notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   564
        outlets do:[:selectorOutlet |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   565
            sym := selectorOutlet at:#selector.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   566
            typ := selectorOutlet at:#type.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   567
            val := selectorOutlet at:#value.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   568
            c :=  '    ' , name , ' ' , sym.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   569
            (typ == #number) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   570
                c := c , val printString
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   571
            ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   572
            (typ == #string) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   573
                c := c , '''' , val , ''''
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
            (typ == #text) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   576
                c := c , '''' , val asString , ''''
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   577
            ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   578
            (typ == #strings) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   579
                c := c , '#( '.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   580
                val asText do:[:aString |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   581
                    c := c , '''' , aString , ''' '
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
                c := c , ')'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   584
            ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   585
            (typ == #block) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   586
                c := c , val
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   587
            ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   588
            (typ == #color) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   589
                c := c , '(Color name:''' , val , ''')'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   590
            ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   591
            c := c , '.' , Character cr asString.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   592
            code := code , c
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   593
        ]
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
    self subviewsOf:aView do:[:v |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   597
        code := code , (self generateInitCodeForView:v)
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.
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
    "Modified: 5.9.1995 / 20:06:07 / claus"
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   604
generateInitMethod
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   605
    |defCode code|
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
    defCode := Character excla asString ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   608
               className , ' methodsFor:''initialization''' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   609
               Character excla asString , '\\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   610
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   611
    defCode := defCode , 'initialize\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   612
    defCode := defCode , '    super initialize.\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   613
    defCode := defCode , '    self setupSubViews.\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   614
    defCode := defCode , '    self setupLocalStuff\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   615
    defCode := defCode , Character excla asString , '\\'.
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
    defCode := defCode , 'setupSubViews\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   618
    code := defCode withCRs.
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
    self subviewsOf:self do:[:v |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   621
        code := code , (self generateInitCodeForView:v)
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   624
    code := code , (self generateInitCodeForOtherStuff).
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
    code := code , '    ^ self\' withCRs.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   627
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   628
    defCode := Character excla asString , '\\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   629
    defCode := defCode , 'setupLocalStuff\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   630
    defCode := defCode , '    ^ self\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   631
    defCode := defCode , Character excla asString , ' ' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   632
                         Character excla asString , '\\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   633
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   634
    code := code , defCode withCRs.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   635
    ^ code.
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
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
generateOutlets
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   643
    ^ self
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   646
!UIPainterView methodsFor:'generating output'!
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
generateSpecFor:something 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   649
    "generate a spec for a view or collection of views
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   650
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   651
    |spec views|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   652
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   653
    something notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   654
        something isCollection ifTrue:[views := something]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   655
                              ifFalse:[views := Array with:something].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   656
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   657
        spec := views collect:[:aView||topSpec|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   658
            aView specClass isNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   659
                ^ nil
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   660
            ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   661
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   662
            topSpec := aView specClass 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   663
                            fromView:aView 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   664
                            callBack:[:newSpec :view | self stuffPropertiesFrom:view intoSpec:newSpec].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   665
            topSpec
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   666
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   667
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   668
    ^ spec
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   669
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   670
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   673
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   674
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   675
!
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
generateWindowSpecMethodSource
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   678
    |spec specArray str code|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   679
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   680
    subViews remove:inputView.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   681
    [
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   682
        spec := FullSpec fromView:self callBack:[:newSpec :view | self stuffPropertiesFrom:view intoSpec:newSpec].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   683
    ] valueNowOrOnUnwindDo:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   684
        subViews addFirst:inputView.
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
    specArray := spec literalArrayEncoding.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   687
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   688
    str := WriteStream on:String new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   689
    self prettyPrintSpecArray:specArray on:str indent:5.
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
    code := Character excla asString 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   692
            , className , ' class methodsFor:''interface specs'''
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   693
            , Character excla asString , '\\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   694
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   695
            , methodName , '\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   696
            , '    "this window spec was automatically generated by the ST/X UIPainter"\\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   697
            , '    "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
   698
            , '     handle the specification if its corrupted."\\'
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
            , '     UIPainter new openOnClass:' , className , ' andSelector:#' , methodName , '\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   701
            , '     ' , className , ' new openInterface:#' , methodName , '\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   702
            , '    "\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   703
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   704
    methodName = 'windowSpec' ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   705
        code := code , '    "' , className , ' open"\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   706
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   707
    code := code 
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
            , '    <resource: #canvas>\\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   710
            , '    ^\' 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   711
            , '     ', str contents
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   712
            , '\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   713
            , Character excla asString
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   714
            , ' '
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   715
            , Character excla asString
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   716
            , '\\'.
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
    ^ code withCRs
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   719
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   720
    "Modified: 5.9.1995 / 21:01:35 / claus"
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
!UIPainterView ignoredMethodsFor:'generating output'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   724
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   725
nameOfClass
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   726
    ^ 'NewView'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   727
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   728
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   729
!UIPainterView methodsFor:'generating output'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   730
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   731
outletValueOf:aSymbol for:aView
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   732
"/    |c name p outlets moreCode sym typ val|
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
"/    p := self propertyOfView:aView.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   735
"/    outlets := p at:#outlets ifAbsent:[^ nil].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   736
"/    outlets notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   737
"/        outlets do:[:selectorOutlet |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   738
"/            sym := selectorOutlet at:#selector.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   739
"/            (sym == aSymbol) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   740
"/                typ := selectorOutlet at:#type.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   741
"/                val := selectorOutlet at:#value.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   742
"/                ^ val
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   743
"/            ]
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
"/    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   746
    ^ nil
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   747
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   748
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   749
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
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   752
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   753
prettyPrintSpecArray:spec on:aStream indent:i
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   754
    "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
   755
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   756
    |what oneLine|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   757
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   758
    spec isArray ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   759
        spec isLiteral ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   760
            aStream nextPutAll:spec storeString
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   761
        ] ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   762
            self halt.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   763
        ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   764
        ^ self
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   765
    ].
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
    spec isEmpty ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   768
        aStream nextPutAll:'#()'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   769
        ^ self
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
    what := spec at:1.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   773
    what isArray ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   774
        aStream cr; spaces:i+2.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   775
        aStream nextPutAll:'#('.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   776
        "/ a spec-collection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   777
        spec do:[:element |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   778
            self prettyPrintSpecArray:element on:aStream indent:i+2.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   779
        ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   780
        aStream cr.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   781
        aStream spaces:i+1.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   782
        aStream nextPutAll:')'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   783
        ^ self.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   784
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   785
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   786
    oneLine := false.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   787
    (#(#LayoutFrame #LayoutOrigin #AlignmentOrigin 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   788
       #Rectangle #Point
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   789
       #Color #ColorValue
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   790
    ) 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   791
    includesIdentical:what) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   792
        oneLine := true
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   793
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   794
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   795
    oneLine ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   796
        aStream cr.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   797
        aStream spaces:i+2.
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
    aStream nextPutAll:'#('.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   800
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
    aStream nextPutAll:what storeString.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   803
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   804
    oneLine ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   805
        aStream cr.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   806
        aStream spaces:i+4.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   807
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   808
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   809
    2 to:spec size do:[:index |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   810
        aStream space.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   811
        self prettyPrintSpecArray:(spec at:index) on:aStream indent:i+4.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   812
        oneLine ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   813
            (index odd and:[index ~~ (spec size)]) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   814
                aStream cr; spaces:i+4.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   815
            ]
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
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   818
    oneLine ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   819
        aStream cr.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   820
        aStream spaces:i+1.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   821
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   822
    aStream nextPutAll:')'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   823
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   824
    "Modified: 5.9.1995 / 17:44:20 / claus"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   825
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   826
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   827
storeContentsOn:aStream
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   828
    viewProperties do:[:p| p storeOn:aStream]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   829
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   830
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   831
stuffPropertiesFrom:view intoSpec:newSpec
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   832
    "stuff any additional information (held in the properties) into the spec
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   833
     which was just created from view"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   834
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   835
    |props aspectSelector changeSelector labelSelector name tabable defaultable
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   836
     menuSelector initiallyInvisible|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   837
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   838
    props := self propertyOfView:view.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   839
    props isNil ifTrue:[^ self].
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
    (aspectSelector := props aspectSelector) notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   842
        newSpec model:aspectSelector
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   843
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   844
    (changeSelector := props changeSelector) notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   845
        newSpec change:changeSelector
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   846
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   847
    (menuSelector := props menuSelector) notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   848
        newSpec menu:menuSelector
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   849
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   850
    (labelSelector := props labelSelector) notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   851
        newSpec label:labelSelector
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   852
    ].
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   853
    (tabable := props tabable) == true ifTrue:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   854
        newSpec tabable:tabable
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
    (defaultable := props defaultable) notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   857
        newSpec defaultable:defaultable
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
    (initiallyInvisible := props initiallyInvisible) notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   860
        newSpec initiallyInvisible:initiallyInvisible
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   861
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   862
    (name := props name) notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   863
        newSpec name:name
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   864
    ].
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
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   867
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   868
!UIPainterView ignoredMethodsFor:'generating output'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   869
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   870
subviewVariableNames
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   871
    |names|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   872
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   873
    names := ''.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   874
    viewProperties do:[:p| names := names , ' ' , (p name)].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   875
  ^ names
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   876
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   877
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   878
!UIPainterView methodsFor:'generating output'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   879
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   880
subviewsOf:aView do:aBlock
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   881
    |subs v|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   882
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   883
    (subs := aView subViews) notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   884
        subs do:[:v|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   885
            (v ~~ inputView and:[v notNil]) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   886
                (viewProperties detect:[:p | p view == v] ifNone:nil) notNil ifTrue:[ 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   887
                    (v superView == aView) ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   888
                        aBlock value:v
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   889
                    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   890
                ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   891
            ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   892
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   893
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   894
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   895
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   896
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   897
!UIPainterView methodsFor:'group manipulations'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   898
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   899
groupEnterFields
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   900
    |props name index group objects|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   901
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   902
    selection isNil ifTrue:[^ self].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   903
    self selectionDo:[:aView |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   904
        (aView isKindOf:EditField) ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   905
            self warn:'select EditFields only !!'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   906
            ^ self
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   907
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   908
    ].
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   909
    self withSelectionHiddenDo:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   910
        group := EnterFieldGroup new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   911
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   912
        props := GroupProperties new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   913
        props elementClass:EnterFieldGroup.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   914
        props group:group.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   915
        index := self variableIndexForClass:EnterFieldGroup.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   916
        props nameIndex:index.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   917
        name := self variableNameForClass:EnterFieldGroup index:index.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   918
        props name:name.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   919
        objects := OrderedCollection new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   920
        props controlledObjects:objects.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   921
        viewProperties add:props.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   922
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   923
        self selectionDo:[:aView |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   924
            objects add:aView.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   925
            group add:aView
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   926
        ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   927
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   928
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
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   931
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   932
groupRadioButtons
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   933
    |props name index group objects|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   934
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   935
    selection isNil ifTrue:[^ self].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   936
    self selectionDo:[:aView |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   937
        (aView isKindOf:RadioButton) ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   938
            self warn:'select RadioButtons only !!'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   939
            ^ self
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   940
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   941
    ].
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   942
    self withSelectionHiddenDo:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   943
        group := RadioButtonGroup new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   944
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   945
        props := GroupProperties new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   946
        props elementClass:RadioButtonGroup.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   947
        props group:group.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   948
        index := self variableIndexForClass:RadioButtonGroup.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   949
        props nameIndex:index.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   950
        name := self variableNameForClass:RadioButtonGroup index:index.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   951
        props name:name.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   952
        group groupID:name asSymbol.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   953
        objects := OrderedCollection new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   954
        props controlledObjects:objects.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   955
        viewProperties add:props.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   956
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   957
        self selectionDo:[:aView |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   958
            aView turnOff.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   959
            objects add:aView.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   960
            group add:aView
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   961
        ].
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   964
    "Modified: 5.9.1995 / 16:06:15 / claus"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   965
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   966
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   967
!UIPainterView methodsFor:'initialization'!
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
initialize
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   970
    "setup attributes
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   971
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   972
    super initialize.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   973
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   974
    superclassName := 'ApplicationModel'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   975
    className      := 'NewApplication'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   976
    methodName     := 'windowSpec'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   977
    categoryName   := 'Applications'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   978
    viewProperties := OrderedCollection new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   979
    HandCursor     := Cursor leftHand.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   980
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   981
    "Modified: 5.9.1995 / 19:58:06 / claus"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   982
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   983
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   984
!UIPainterView methodsFor:'interface to Builder'!
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
addOutletDefinitionFor:outletSymbol type:type value:outletValue for:aView
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   987
    |outletProps selectorProps viewProps|
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
    viewProps := self propertyOfView:aView.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   990
"/    outletProps := viewProps at:#outlets ifAbsent:[nil].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   991
"/    outletProps isNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   992
"/        outletProps := Dictionary new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   993
"/        viewProps at:#outlets put:outletProps
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   994
"/    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   995
"/    selectorProps := outletProps at:outletSymbol ifAbsent:[nil].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   996
"/    selectorProps isNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   997
"/        selectorProps := Dictionary new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   998
"/        outletProps at:outletSymbol put:selectorProps
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   999
"/    ].
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
"/    selectorProps at:#selector put:outletSymbol.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1002
"/    selectorProps at:#type put:type.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1003
"/    selectorProps at:#value put:outletValue
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1004
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1007
addSpec:specOrSpecArray
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1008
    |spec builder|
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
    spec := UISpecification from:specOrSpecArray.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1011
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1012
    builder := UIBuilder new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1013
    builder componentCreationHook:[:view :spec :aBuilder |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1014
                self createdComponent:view forSpec:spec builder:aBuilder
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1015
            ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1016
    builder applicationClass:(Smalltalk classNamed:className).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1017
    spec setupView:self for:builder.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1018
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1019
    self realizeAllSubViews.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1020
    inputView raise.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1021
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1022
"/    viewProperties := OrderedCollection new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1023
"/    self generatePropertiesFor:(self subViews select:[:v | v ~~ inputView]).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1024
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1025
    self changed:#tree.
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
    "Modified: 5.9.1995 / 23:36:55 / claus"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1029
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1030
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1031
applicationName
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1032
    ^ className
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1033
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1034
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1035
aspectAt:aSymbol
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1036
    self halt.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1037
    ^ nil
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
    "Modified: 6.9.1995 / 00:45:35 / claus"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1040
!
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
createdComponent:newView forSpec:aSpec builder:aBuilder
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1043
    "callBack from UISpec view building"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1044
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1045
    |props|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1046
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1047
    props := self propertiesForNewView:newView.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1048
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1049
    aSpec name notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1050
        (self propertyOfName:(aSpec name)) isNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1051
            props name:aSpec name
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
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1054
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1055
    props labelSelector:(aSpec labelSelector).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1056
    props aspectSelector:(aSpec modelSelector).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1057
    props menuSelector:(aSpec menuSelector).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1058
    props tabable:(aSpec tabable).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1059
    props defaultable:(aSpec defaultable).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1060
    props initiallyInvisible:(aSpec initiallyInvisible).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1061
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1062
    viewProperties add:props.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1063
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1064
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1065
generatePropertiesFor:aCollectionOfViews
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1066
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1067
    "/ done as two loops, to get bread-first naming
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1068
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1069
    aCollectionOfViews do:[:aView|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1070
        |props|
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
        props := self propertiesForNewView:aView.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1073
        viewProperties add:props.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1074
        aView name:(props name).
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
        aView geometryLayout isNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1077
            aView geometryLayout:(aView bounds asLayout).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1078
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1079
    ].
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
    aCollectionOfViews do:[:aView |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1082
        |subs|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1083
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1084
        subs := aView subViews.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1085
        subs notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1086
            self generatePropertiesFor:subs
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1087
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1088
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1089
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1090
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1091
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1092
inspectAttributes
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1093
    |p|
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
    self singleSelectionDo:[:aView |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1096
        p := self propertyOfView:aView.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1097
        p inspect
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
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1100
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1101
inspectSpec
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1102
    |s|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1103
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1104
    self singleSelectionDo:[:aView |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1105
        s := self generateSpecFor:aView.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1106
        s first inspect
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1107
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1108
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1109
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1110
setupFromSpec:specOrSpecArray
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1111
    self removeAll.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1112
    self addSpec:specOrSpecArray
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1113
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1114
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1115
showFontPanel
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1116
    |action|
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
    fontPanel isNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1119
	fontPanel := FontPanel new 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1120
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1121
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1122
    selection notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1123
	action := [:family :face :style :size |
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1124
		       self changeFontFamily:family face:face
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1125
				       style:style size:size
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1126
		  ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1127
	fontPanel action:action.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1128
	fontPanel showAtPointer
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
!UIPainterView methodsFor:'menus'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1133
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1134
menu
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1135
    "returns middle-button menu dependent on the selection
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1136
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1137
    |menu canPaste|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1138
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1139
    testMode ifTrue:[^ nil ].
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
    canPaste := self canPaste:(self getSelection).
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
    selection isNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1144
        menu := PopUpMenu labels:( resources array:#('paste' 'undo'))
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1145
                       selectors:#( #pasteBuffer #undoLast )
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1146
                    accelerators:#( #Paste nil )
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1147
                        receiver:self.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1148
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1149
        canPaste           ifFalse:[menu disable:#pasteBuffer].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1150
        undoHistory isEmpty ifTrue:[menu disable:#undoLast].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1151
      ^ menu
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1152
    ].    
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
    menu := PopUpMenu labels:( resources array:#(
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1155
                                  'copy' 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1156
                                  'cut' 
69
e533f77871dd generateAspectMethods: code2
ca
parents: 62
diff changeset
  1157
                                  'paste'
e533f77871dd generateAspectMethods: code2
ca
parents: 62
diff changeset
  1158
                                  'undo'
60
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
                                  'arrange'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1161
                                  'dimension'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1162
                                  'align'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1163
                                )
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1164
                              )
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1165
                   selectors:#(   #copySelection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1166
                                  #deleteSelection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1167
                                  #pasteBuffer
69
e533f77871dd generateAspectMethods: code2
ca
parents: 62
diff changeset
  1168
                                  #undoLast
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1169
                                  nil
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1170
                                  #arrange
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1171
                                  #dimension
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1172
                                  #align
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1173
                              )
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1174
                   accelerators:#(#Copy
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1175
                                  #Cut
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1176
                                  #Paste
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1177
                                  nil
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1178
                                  nil
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1179
                                  nil
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1180
                                  nil
69
e533f77871dd generateAspectMethods: code2
ca
parents: 62
diff changeset
  1181
                                  nil
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1182
                              )
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1183
                     receiver:self.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1184
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1185
    (canPaste and:[self canPasteInto:selection]) ifFalse:[
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1186
        menu disable:#pasteBuffer
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1187
    ].
69
e533f77871dd generateAspectMethods: code2
ca
parents: 62
diff changeset
  1188
    undoHistory isEmpty ifTrue:[menu disable:#undoLast].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1189
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1190
    menu subMenuAt:#arrange   put:(self subMenuArrange).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1191
    menu subMenuAt:#dimension put:(self subMenuDimension).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1192
    menu subMenuAt:#align     put:(self subMenuAlign).
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1193
  ^ menu
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1194
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1195
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1196
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1197
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1198
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1199
subMenuAlign
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1200
    "returns submenu alignment
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1201
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1202
    |menu|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1203
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1204
    menu := PopUpMenu labels:(
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1205
                resources array:#(
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1206
                                    'align left' 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1207
                                    'align right'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1208
                                    'align left & right'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1209
                                    'align top' 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1210
                                    'align bottom'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1211
                                    'align centered vertical'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1212
                                    'align centered horizontal'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1213
                                    '-'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1214
                                    'spread horizontal'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1215
                                    'spread vertical'
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1216
                                    '-'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1217
                                    'center horizontal in frame'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1218
                                    'center vertical in frame'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1219
                                  )
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1220
                         )
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1221
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1222
              selectors:#(  
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1223
                            alignSelectionLeft
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1224
                            alignSelectionRight
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1225
                            alignSelectionLeftAndRight
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1226
                            alignSelectionTop
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1227
                            alignSelectionBottom
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1228
                            alignSelectionCenterHor
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1229
                            alignSelectionCenterVer
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1230
                            nil
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1231
                            spreadSelectionHor
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1232
                            spreadSelectionVer
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1233
                            nil
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1234
                            centerSelectionHor
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents