UIPainterView.st
author tz
Fri, 06 Mar 1998 15:33:06 +0100
changeset 708 b5f3169a0ba7
parent 698 5bf234e0e451
child 712 bf8aa59e82b6
permissions -rw-r--r--
super sends for the hook methods
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
"
156
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger / eXept Software AG
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
     3
              All Rights Reserved
60
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
278
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
    14
	instanceVariableNames:'treeView listHolder superclassName className methodName
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
    15
		categoryName'
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    16
	classVariableNames:'HandCursor RedefineMethods'
60
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
211
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    21
Object subclass:#ViewProperty
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    22
	instanceVariableNames:'view spec identifier'
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    23
	classVariableNames:'Identifier'
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    24
	poolDictionaries:''
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    25
	privateIn:UIPainterView
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    26
!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    27
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    28
!UIPainterView class methodsFor:'documentation'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    29
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    30
copyright
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    31
"
156
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
    32
 COPYRIGHT (c) 1995 by Claus Gittinger / eXept Software AG
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
    33
              All Rights Reserved
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    34
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    35
 This software is furnished under a license and may be used
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    36
 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
    37
 inclusion of the above copyright notice.   This software may not
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    38
 be provided or otherwise made available to, or used by, any
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    39
 other person.  No title to or ownership of the software is
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    40
 hereby transferred.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    41
"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    42
!
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
documentation
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    45
"
128
9779b7459a1c selection and update from selection
ca
parents: 121
diff changeset
    46
    buildIn view used by the UIPainter; from this view, the layout of the
9779b7459a1c selection and update from selection
ca
parents: 121
diff changeset
    47
    new application derives from.
9779b7459a1c selection and update from selection
ca
parents: 121
diff changeset
    48
9779b7459a1c selection and update from selection
ca
parents: 121
diff changeset
    49
    [see also:]
9779b7459a1c selection and update from selection
ca
parents: 121
diff changeset
    50
        UIBuilder
9779b7459a1c selection and update from selection
ca
parents: 121
diff changeset
    51
        UIObjectView
156
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
    52
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
    53
    [author:]
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
    54
        Claus Gittinger
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
    55
        Claus Atzkern
60
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
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    59
!UIPainterView class methodsFor:'code generation mode'!
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    60
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    61
redefineMethods
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    62
    "redefine methods yes or no. If a method is defined in super class
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    63
     should the message be reinstalled ?
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    64
    "
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    65
    ^ RedefineMethods ? false
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    66
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    67
!
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    68
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    69
redefineMethods:aBool
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    70
    "redefine methods yes or no. If a method is defined in super class
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    71
     should the message be reinstalled ?
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    72
    "
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    73
    RedefineMethods := aBool
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    74
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    75
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    76
! !
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    77
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    78
!UIPainterView class methodsFor:'defaults'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    79
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    80
defaultMenuMessage   
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    81
    "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
    82
    "
121
96d6feeeb049 middleButtonMen:
ca
parents: 119
diff changeset
    83
    ^ #showMiddleButtonMenu
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    84
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    85
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    88
!UIPainterView methodsFor:'accessing'!
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
application
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    91
    ^ nil
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    92
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    93
    "Modified: 6.9.1995 / 00:46:44 / claus"
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
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    96
applicationName
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    97
    ^ self className
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    98
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
    99
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   100
applicationName:aName
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   101
    self className:aName
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   102
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   103
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   104
className
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   105
    ^ className
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   106
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   107
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   108
className:aName
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   109
    className := aName
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   110
!
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
className:aClassName superclassName:aSuperclassName selector:aSelector
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   113
    className      := aClassName.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   114
    superclassName := aSuperclassName.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   115
    methodName     := aSelector.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   116
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   117
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   118
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   119
findInputViewIn:aSuperView
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   120
    "returns index of input view into superview or nil
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   121
    "
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   122
    aSuperView == self ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   123
        ^ self subViews findFirst:[:v| v == inputView ]
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   124
    ].
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   125
  ^ 0
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   126
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   127
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   128
inputView
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   129
    ^ inputView
111
ca
parents: 103
diff changeset
   130
!
ca
parents: 103
diff changeset
   131
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   132
methodName
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   133
    ^ methodName
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   134
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   135
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   136
methodName:aName
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   137
    methodName := aName
60
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
selectNames:aStringOrCollection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   141
    |prop coll s|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   142
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   143
    (aStringOrCollection isNil or:[aStringOrCollection isEmpty]) ifTrue:[
131
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
   144
        ^ self select:nil
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   145
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   146
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   147
    (s := aStringOrCollection) isString ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   148
        s size == 1 ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   149
            s := s first
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   150
        ] ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   151
            coll := OrderedCollection new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   152
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   153
            s do:[:aName|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   154
                (prop := self propertyOfName:aName) notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   155
                    coll add:(prop view)
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
            ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   158
            coll size == 1 ifTrue:[ ^ self select:(coll at:1) ].
131
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
   159
            coll size == 0 ifTrue:[ ^ self select:nil ].
60
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
          ^ self select:coll.
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
    prop := self propertyOfName:s.
131
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
   166
    prop isNil ifTrue:[^ self select:nil]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   167
              ifFalse:[^ self select:(prop view)]
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
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   170
111
ca
parents: 103
diff changeset
   171
!UIPainterView methodsFor:'change & update'!
ca
parents: 103
diff changeset
   172
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   173
layoutChanged
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   174
    treeView layoutChanged
111
ca
parents: 103
diff changeset
   175
! !
ca
parents: 103
diff changeset
   176
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   177
!UIPainterView methodsFor:'copy & cut & paste'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   178
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   179
copySelection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   180
    "copy the selection into the cut&paste-buffer
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   181
    "
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   182
    |specs coll sel|
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   183
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   184
    sel := treeView selection.
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   185
128
9779b7459a1c selection and update from selection
ca
parents: 121
diff changeset
   186
    coll := self minSetOfSuperViews:(self selection).
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   187
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   188
    coll notNil ifTrue:[
131
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
   189
        self select:nil.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   190
        specs := coll collect:[:aView| self fullSpecFor:aView ].
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   191
        self setSelection:specs.
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   192
        treeView selection: sel
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   193
    ].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   194
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   195
60
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
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   198
cutSelection
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   199
    "cut the selection into the cut&paste-buffer
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   200
     and open a transaction
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   201
    "
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   202
    |specs coll|
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   203
128
9779b7459a1c selection and update from selection
ca
parents: 121
diff changeset
   204
    coll := self minSetOfSuperViews:(self selection).
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   205
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   206
    coll notNil ifTrue:[
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   207
        treeView cvsEventsDisabledDo:[
131
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
   208
            self select:nil.
111
ca
parents: 103
diff changeset
   209
            specs := coll collect:[:aView| self fullSpecFor:aView ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   210
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   211
            self withinTransaction:#cut objects:coll do:[
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   212
                coll reverseDo:[:aView|
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   213
                    self createUndoRemove:aView.
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   214
                    self remove:aView
111
ca
parents: 103
diff changeset
   215
                ]
ca
parents: 103
diff changeset
   216
            ].
ca
parents: 103
diff changeset
   217
            self setSelection:specs.
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   218
            treeView selection: (Array with: 1)
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   219
        ]
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   220
    ]
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   221
!
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   222
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   223
deleteSelection
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   224
    "delete the selection; copy the selection into the cut&paste-buffer
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   225
     and open a transaction
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   226
    "
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   227
    |specs coll|
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   228
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   229
    coll := self minSetOfSuperViews:(self selection).
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   230
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   231
    coll notNil ifTrue:[
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   232
        treeView cvsEventsDisabledDo:[
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   233
            self select:nil.
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   234
            specs := coll collect:[:aView| self fullSpecFor:aView ].
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   235
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   236
            self withinTransaction:#cut objects:coll do:[
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   237
                coll reverseDo:[:aView|
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   238
                    self remove:aView
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   239
                ]
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   240
            ].
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   241
            treeView selection: (Array with: 1)
111
ca
parents: 103
diff changeset
   242
        ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   243
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   244
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   245
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   246
pasteBuffer
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   247
    "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
   248
    "
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   249
    |sel|
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   250
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   251
    sel := self pasteSpecifications:(self getSelection) keepLayout:false.
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   252
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   253
    sel notNil ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   254
        self select:sel.
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   255
    ].
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   256
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   257
!
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   258
392
ca
parents: 376
diff changeset
   259
pasteFromClipBoard:aString
ca
parents: 376
diff changeset
   260
    ^ self
ca
parents: 376
diff changeset
   261
ca
parents: 376
diff changeset
   262
ca
parents: 376
diff changeset
   263
!
ca
parents: 376
diff changeset
   264
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   265
pasteSpecifications:aSpecificationOrList keepLayout:keepLayout
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   266
    "add the specs to the object view; returns list of pasted components
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   267
    "
278
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   268
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   269
    ^ self
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   270
        pasteSpecifications:aSpecificationOrList 
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   271
        keepLayout:keepLayout 
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   272
        at:nil
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   273
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   274
    "Modified: 11.8.1997 / 01:00:35 / cg"
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   275
!
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   276
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   277
pasteSpecifications:aSpecificationOrList keepLayout:keepLayout at:aPointOrNil
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   278
    "add the specs to the object view; returns list of pasted components
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   279
    "
312
386932d91a97 paste at a point; first translate the point
ca
parents: 310
diff changeset
   280
    |paste frame pasteOrigin pasteOffset builder newSel bounds|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   281
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   282
    (self canPaste:aSpecificationOrList) ifFalse:[
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   283
        ^ nil
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   284
    ].
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   285
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   286
    treeView cvsSetupListDo:[
165
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   287
        aSpecificationOrList isCollection ifTrue:[
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   288
            paste := aSpecificationOrList
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   289
        ] ifFalse:[
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   290
            paste := Array with:aSpecificationOrList
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   291
        ].
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   292
        (frame := self singleSelection) isNil ifTrue:[
165
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   293
            frame := self
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   294
        ].
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   295
        self setSelection:nil withRedraw:true.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   296
165
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   297
        newSel  := OrderedCollection new.
395
d39076243277 sett UIBuilder isEditing to true
ca
parents: 392
diff changeset
   298
        builder := UIBuilder new isEditing:true.
d39076243277 sett UIBuilder isEditing to true
ca
parents: 392
diff changeset
   299
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
   300
        className notNil ifTrue:[
330
ca
parents: 327
diff changeset
   301
            builder applicationClass:(self resolveName:className)
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
   302
        ].
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   303
165
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   304
        keepLayout ifFalse:[
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   305
            pasteOffset := 0@0.
312
386932d91a97 paste at a point; first translate the point
ca
parents: 310
diff changeset
   306
278
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   307
            aPointOrNil isNil ifTrue:[
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   308
                pasteOrigin := self sensor mousePoint.
312
386932d91a97 paste at a point; first translate the point
ca
parents: 310
diff changeset
   309
                pasteOrigin := device translatePoint:pasteOrigin
386932d91a97 paste at a point; first translate the point
ca
parents: 310
diff changeset
   310
                                            from:device rootView id
386932d91a97 paste at a point; first translate the point
ca
parents: 310
diff changeset
   311
                                              to:frame id.
278
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   312
            ] ifFalse:[
312
386932d91a97 paste at a point; first translate the point
ca
parents: 310
diff changeset
   313
                pasteOrigin := device translatePoint:aPointOrNil
386932d91a97 paste at a point; first translate the point
ca
parents: 310
diff changeset
   314
                                                from:self id
386932d91a97 paste at a point; first translate the point
ca
parents: 310
diff changeset
   315
                                                  to:frame id.
386932d91a97 paste at a point; first translate the point
ca
parents: 310
diff changeset
   316
            ]
386932d91a97 paste at a point; first translate the point
ca
parents: 310
diff changeset
   317
        ].
386932d91a97 paste at a point; first translate the point
ca
parents: 310
diff changeset
   318
        keepLayout ifFalse:[
386932d91a97 paste at a point; first translate the point
ca
parents: 310
diff changeset
   319
            bounds := Rectangle origin:0@0 extent:(frame bounds extent)
165
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   320
        ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   321
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   322
        paste do:[:aSpec|
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   323
            |view|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   324
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   325
            view := self addSpec:aSpec builder:builder in:frame.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   326
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   327
            keepLayout ifFalse:[
312
386932d91a97 paste at a point; first translate the point
ca
parents: 310
diff changeset
   328
                (bounds containsPoint:pasteOrigin) ifFalse:[
315
056c9fe74cc6 remove a halt statement
ca
parents: 312
diff changeset
   329
                    self moveObject:view to:pasteOffset.
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   330
                ] ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   331
                    self moveObject:view to:pasteOrigin + pasteOffset.
111
ca
parents: 103
diff changeset
   332
                ].
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   333
                pasteOffset := pasteOffset + 4
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   334
            ].
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   335
            view realize.
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   336
            newSel add:view.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   337
        ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   338
165
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   339
        self withinTransaction:#paste objects:newSel do:[
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   340
            undoHistory addUndoSelector:#undoCreate:
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   341
                               withArgs:(newSel collect:[:v|(self propertyOfView:v) identifier])
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   342
        ].
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   343
165
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   344
        self realizeAllSubViews.
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   345
        newSel do:[:v| v raise].
165
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   346
        inputView raise.
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   347
        self elementChangedSize:frame.
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   348
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   349
        newSel size == 1 ifTrue:[newSel := newSel at:1].
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   350
    ].
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   351
    ^ newSel
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   352
!
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   353
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   354
pasteWithLayout
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   355
    "add the objects in the paste-buffer to the object view; don't change the
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   356
     layout
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   357
    "
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   358
    |sel|
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   359
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   360
    sel := self pasteSpecifications:(self getSelection) keepLayout:true.
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   361
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   362
    sel notNil ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   363
        self select:sel.
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   364
    ].
60
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
!UIPainterView methodsFor:'drag & drop'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   368
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   369
canDrop:something
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   370
    "returns true if something can be droped
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   371
    "      
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   372
    (something size == 1 and:[self enabled and:[self numberOfSelections <= 1]]) ifTrue:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   373
      ^ something first theObject isKindOf:UISpecification
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   374
    ].
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   375
    ^ false
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   376
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   377
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   378
canPaste
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   379
    "returns true if something to be past exists and can be paste into
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   380
     the selection if exists
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   381
    "
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   382
    ^ self canPaste:(self getSelection)
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   383
!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   384
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   385
canPaste:something
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   386
    "returns true if something could be paste
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   387
    "
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   388
    |el size|
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   389
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   390
    ((size := self numberOfSelections) <= 1 and:[self enabled]) ifFalse:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   391
        ^ false
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   392
    ].
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   393
    something isCollection ifTrue:[something notEmpty ifTrue:[el := something first]]
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   394
                          ifFalse:[el := something].
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   395
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   396
    (el isKindOf:UISpecification) ifFalse:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   397
        ^ false
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   398
    ].
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   399
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   400
    size == 1 ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   401
        ^ self canPasteInto:(self singleSelection)
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   402
    ].
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   403
  ^ true
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   404
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   405
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   406
canPasteInto:aView
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   407
    "can paste into a view
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   408
    "
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   409
    |prop|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   410
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   411
    aView notNil ifTrue:[
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   412
        (prop := self propertyRespondsToView:aView) notNil ifTrue:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   413
            ^ prop spec class supportsSubComponents
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   414
        ].
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   415
      ^ aView specClass supportsSubComponents.
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   416
    ].
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   417
    ^ false
96
73725336b4fe dont paste into scrollable selectionInListViews ...
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   418
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   419
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   420
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   421
drop:anObjectOrCollection at:aPoint
278
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   422
    |spec newSel oldSel dragOffset|
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   423
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   424
    self selection notNil ifTrue:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   425
        oldSel := self singleSelection.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   426
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   427
        (self canPasteInto:oldSel) ifFalse:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   428
            oldSel := nil.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   429
            self setSelection:nil withRedraw:true
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   430
        ]
231
75de472d579f check whether selection is a view or a collection
ca
parents: 223
diff changeset
   431
    ].
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   432
    spec := (anObjectOrCollection at:1) theObject.
278
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   433
    dragOffset := DragAndDropManager dragOffsetQuerySignal raise.
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   434
    newSel := self pasteSpecifications:spec keepLayout:false at:aPoint - dragOffset.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   435
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   436
    oldSel isNil ifTrue:[self select:newSel]
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   437
                ifFalse:[self select:oldSel]
60
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
361
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   440
!UIPainterView methodsFor:'event handling'!
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   441
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   442
keyPress:key x:x y:y view:aView
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   443
    "a delegated keyEvent from aView"
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   444
361
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   445
    self keyPress:key x:x y:y
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   446
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   447
    "Modified: / 31.10.1997 / 20:27:22 / cg"
361
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   448
!
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   449
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   450
keyRelease:key x:x y:y view:aView
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   451
    "a delegated keyEvent from aView"
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   452
361
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   453
    self keyRelease:key x:x y:y
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   454
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   455
    "Modified: / 31.10.1997 / 20:27:32 / cg"
361
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   456
! !
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   457
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   458
!UIPainterView methodsFor:'generating output'!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   459
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   460
aspectMethods
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   461
    "extract a list of aspect methods - for browsing"
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   462
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   463
    |cls methods skip selector protoSpec|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   464
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   465
    className isNil ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   466
        self warn:'set the class first'.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   467
        ^ #()
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   468
    ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   469
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   470
    cls := self resolveName:className.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   471
    methods := IdentitySet new.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   472
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   473
    treeView propertiesDo:[:aProp|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   474
        |selector|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   475
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   476
        (selector := aProp model) notNil ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   477
            selector isArray ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   478
                selector := selector asSymbol.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   479
                (cls implements:selector) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   480
                    skip := false.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   481
                    (cls isSubclassOf:SimpleDialog) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   482
                        skip := SimpleDialog implements:selector asSymbol
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   483
                    ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   484
                    skip ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   485
                        methods add:(cls compiledMethodAt:selector)
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   486
                    ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   487
                ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   488
            ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   489
        ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   490
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   491
        (selector := aProp menu) notNil ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   492
            selector isArray ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   493
                selector := selector asSymbol.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   494
                (cls implements:selector) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   495
                    methods add:(cls compiledMethodAt:selector)
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   496
                ]
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   497
            ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   498
        ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   499
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   500
        (aProp spec aspectSelectors) do:[:aSel |
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   501
            |selector|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   502
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   503
            aSel isArray ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   504
                selector := aSel asSymbol.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   505
                (cls implements:selector) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   506
                    methods add:(cls compiledMethodAt:selector)
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   507
                ]
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   508
            ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   509
        ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   510
        aProp spec actionSelectors do:[:aSel|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   511
            |selector|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   512
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   513
            aSel isArray ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   514
                selector := aSel asSymbol.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   515
                (cls implements:selector) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   516
                    methods add:(cls compiledMethodAt:selector)
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   517
                ]
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   518
            ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   519
        ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   520
        aProp spec valueSelectors do:[:aSel|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   521
            |selector|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   522
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   523
            aSel isArray ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   524
                selector := aSel asSymbol.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   525
                (cls implements:selector) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   526
                    methods add:(cls compiledMethodAt:selector)
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   527
                ]
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   528
            ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   529
        ]
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   530
    ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   531
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   532
    protoSpec := treeView canvasSpec.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   533
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   534
    (selector := protoSpec menu) notNil ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   535
        selector isArray ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   536
            selector := selector asSymbol.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   537
            (cls implements:selector) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   538
                methods add:(cls compiledMethodAt:selector)
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   539
            ]
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   540
        ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   541
    ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   542
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   543
    ^ methods
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   544
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   545
    "Created: / 25.10.1997 / 18:58:25 / cg"
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   546
    "Modified: / 26.10.1997 / 15:06:18 / cg"
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   547
!
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   548
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   549
generateActionMethodFor:aspect spec:protoSpec inClass:targetClass
568
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   550
    |selector args showIt code alreadyInSuperclass numArgs method|
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   551
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   552
    selector := aspect asSymbol.
141
d06c04391233 generate actions with argument
ca
parents: 137
diff changeset
   553
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   554
    alreadyInSuperclass := targetClass superclass canUnderstand:selector.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   555
568
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   556
    numArgs := selector numArgs.
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   557
    method  := aspect.
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   558
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   559
    numArgs == 1 ifTrue:[
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   560
        args := 'anArgument'.
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   561
        showIt := ''' , anArgument printString , '' ...''.\'.
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   562
    ] ifFalse:[    
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   563
        args := ''.
149
e652608690b1 help ...
ca
parents: 146
diff changeset
   564
        showIt := ' ...''.\'.
568
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   565
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   566
        numArgs ~~ 0 ifTrue:[
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   567
            method := ''.
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   568
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   569
            selector keywords keysAndValuesDo:[:i :key|
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   570
                method := method, key, 'arg', i printString, ' '
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   571
            ]
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   572
        ]
149
e652608690b1 help ...
ca
parents: 146
diff changeset
   573
    ].
141
d06c04391233 generate actions with argument
ca
parents: 137
diff changeset
   574
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   575
    code := '!!' , targetClass name , ' methodsFor:''actions''!!\\' ,
568
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   576
                method , args , '\' ,
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   577
                '    "automatically generated by UIPainter ..."\\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   578
                '    "*** the code below performs no action"\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   579
                '    "*** (except for some feedback on the Transcript)"\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   580
                '    "*** Please change as required and accept in the browser."\' ,
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   581
                '\' .
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   582
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   583
    alreadyInSuperclass ifTrue:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   584
        code := code ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   585
                    '    "action for ' , aspect , ' is already provided in a superclass."\' ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   586
                    '    "It may be redefined here ..."\\'.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   587
    ] ifFalse:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   588
        code := code ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   589
                    '    "action to be added ..."\\'.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   590
    ].
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   591
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   592
    code := code ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   593
                '    Transcript showCR:self class name, '': '.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   594
    alreadyInSuperclass ifTrue:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   595
        code := code , 'inherited '.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   596
    ].
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   597
    code := code , 'action for ' , aspect , showIt.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   598
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   599
    alreadyInSuperclass ifTrue:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   600
        code := code ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   601
                        '    super ' , aspect , args , '.\'.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   602
    ].
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   603
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   604
    code := code ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   605
                '!! !!\\'.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   606
    ^ code withCRs
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   607
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   608
    "Modified: / 25.10.1997 / 19:18:50 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   609
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   610
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   611
generateAspectMethodFor:aspect spec:protoSpec inClass:targetClass
655
093cba68e10a simplified to make microsoft cc happy
Claus Gittinger <cg@exept.de>
parents: 588
diff changeset
   612
    |modelClass modelValue modelGen code|
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   613
149
e652608690b1 help ...
ca
parents: 146
diff changeset
   614
    modelClass := protoSpec defaultModelClassFor:aspect.
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   615
    modelValue := protoSpec defaultModelValueFor:aspect.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   616
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   617
    modelValue isNil ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   618
        modelGen := modelClass name , ' new'
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   619
    ] ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   620
        modelGen := modelValue storeString , ' asValue'
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   621
    ].
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   622
655
093cba68e10a simplified to make microsoft cc happy
Claus Gittinger <cg@exept.de>
parents: 588
diff changeset
   623
    code := '!!' , targetClass name , ' methodsFor:''aspects''!!\\' ,
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   624
      aspect , '\' ,
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   625
      '    "automatically generated by UIPainter ..."\\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   626
      '    "*** the code below creates a default model when invoked."\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   627
      '    "*** (which may not be the one you wanted)"\' ,
655
093cba68e10a simplified to make microsoft cc happy
Claus Gittinger <cg@exept.de>
parents: 588
diff changeset
   628
      '    "*** Please change as required and accept in the browser."\'.
093cba68e10a simplified to make microsoft cc happy
Claus Gittinger <cg@exept.de>
parents: 588
diff changeset
   629
093cba68e10a simplified to make microsoft cc happy
Claus Gittinger <cg@exept.de>
parents: 588
diff changeset
   630
    code := (code ,
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   631
      '\' ,
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   632
      '    |holder|\' ,
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
      '    (holder := builder bindingAt:#' , aspect , ') isNil ifTrue:[\' ,
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   635
      '        builder aspectAt:#' , aspect , ' put:(holder := ' , ' ' , modelGen , ').\' ,
60
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
      '    ^ holder\' ,
655
093cba68e10a simplified to make microsoft cc happy
Claus Gittinger <cg@exept.de>
parents: 588
diff changeset
   638
      '!! !!\\') withCRs.
093cba68e10a simplified to make microsoft cc happy
Claus Gittinger <cg@exept.de>
parents: 588
diff changeset
   639
    ^ code
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   640
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   641
    "Modified: / 26.10.1997 / 19:01:15 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   642
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   643
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   644
generateAspectMethods
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   645
    "generate aspect, action & menu methods
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   646
     - but do not overwrite existing ones.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   647
     Return a string ready to compile into the application class."
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   648
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   649
    |cls code skip menuSelector protoSpec thisCode|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   650
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   651
    code := ''.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   652
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   653
    className isNil ifTrue:[
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   654
        self warn:'Set first the class!!'.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   655
        ^ code
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   656
    ].
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   657
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   658
    (cls := self resolveName:className) isNil ifTrue:[
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   659
        self warn:'Class ', className asString, ' does not exist!!'.
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   660
        ^ code
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   661
    ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   662
316
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   663
    treeView propertiesDo:[:aProp|
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   664
        |modelSelector menuSelector|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   665
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   666
        protoSpec := aProp spec.
175
0b0b4d99e3e7 isResizeable
ca
parents: 165
diff changeset
   667
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   668
        (modelSelector := aProp model) notNil ifTrue:[
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   669
            self generateCodeFrom:(Array with:modelSelector) in:cls
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   670
                do:[:aSel|
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   671
                    skip := false.
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   672
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   673
                    (cls isSubclassOf:SimpleDialog) ifTrue:[
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   674
                        skip := SimpleDialog implements:aSel asSymbol
158
6e7f892308ae do not generate accept/cancel and help action methods,
Claus Gittinger <cg@exept.de>
parents: 156
diff changeset
   675
                    ].
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   676
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   677
                    skip ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   678
                        "/ kludge ..
501
16d87a6511d4 change #isMemberOf: to #isKindOf:ActionButtonSpec
ca
parents: 464
diff changeset
   679
                        (protoSpec isKindOf:ActionButtonSpec) ifTrue:[
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   680
                            thisCode := (self generateActionMethodFor:aSel spec:protoSpec inClass:cls).
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   681
                        ] ifFalse:[
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   682
                            thisCode := (self generateAspectMethodFor:aSel spec:protoSpec inClass:cls).
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   683
                        ].
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   684
                        code := code, thisCode
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   685
                    ]
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   686
                ]
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   687
        ].
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   688
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   689
        self generateCodeFrom:(aProp spec aspectSelectors) in:cls
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   690
                do:[:aSel|
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   691
                    thisCode := (self generateAspectMethodFor:aSel spec:protoSpec inClass:cls).
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   692
                    code := code , thisCode
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   693
                ].
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   694
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   695
        self generateCodeFrom:(aProp spec actionSelectors) in:cls
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   696
                do:[:aSel|
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   697
                    thisCode := (self generateActionMethodFor:aSel spec:protoSpec inClass:cls).
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   698
                    code := code , thisCode
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   699
                ].
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   700
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   701
        self generateCodeFrom:(aProp spec valueSelectors) in:cls
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   702
                do:[:aSel|
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   703
                 "/ uppercase: - assume its a globals name.
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   704
                    aSel first isUppercase ifFalse:[
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   705
                        thisCode := (self generateValueMethodFor:aSel spec:protoSpec inClass:cls).
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   706
                        code := code , thisCode
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   707
                    ]
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   708
                ].
316
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   709
    ].
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   710
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   711
    ^ code
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   712
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   713
!
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   714
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   715
generateCodeFrom:aListOfSelectors in:aClass do:aBlock
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   716
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   717
    self class redefineMethods ifTrue:[
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   718
        aListOfSelectors do:[:aSelector|
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   719
            (aSelector isArray or:[aClass implements:aSelector]) ifFalse:[
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   720
                aBlock value:aSelector
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   721
            ]
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   722
        ]
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   723
    ] ifFalse:[
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   724
        aListOfSelectors do:[:aSelector|
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   725
            (aSelector isArray or:[aClass canUnderstand:aSelector]) ifFalse:[
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   726
                aBlock value:aSelector
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   727
            ]
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   728
        ]
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   729
    ]
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   730
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   731
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   732
!
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   733
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   734
generateHookMethodFor:selectorSpec comment:commentWhen note:noteOrNil defaultCode:defaultCode inClass:targetClass
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   735
    ^ ('!!' , targetClass name , ' methodsFor:''hooks''!!\\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   736
      selectorSpec , '\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   737
      '    "automatically generated by UIPainter ..."\\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   738
      '    "*** the code here does nothing. It is invoked when"\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   739
      '    "*** ' , commentWhen , '"\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   740
      '    "*** Please change as required and accept in the browser."\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   741
      '\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   742
      '    "specific code to be added below ..."\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   743
      '    "' , (noteOrNil ? '') , '"\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   744
      '\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   745
      (defaultCode ? '^ self.') ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   746
      '!! !!\\') withCRs
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   747
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   748
    "Modified: / 25.10.1997 / 19:22:17 / cg"
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   749
    "Created: / 31.10.1997 / 17:31:53 / cg"
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   750
!
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   751
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   752
generateHookMethods
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   753
    "generate hook methods
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   754
     - but do not overwrite existing ones.
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   755
     Return a string ready to compile into the application class."
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   756
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   757
    |cls code skip menuSelector protoSpec thisCode|
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   758
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   759
    code := ''.
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   760
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   761
    className isNil ifTrue:[
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   762
        self warn:'set the class first'.
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   763
        ^ code
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   764
    ].
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   765
    cls := self resolveName:className.
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   766
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   767
    code := code , (self generateHookMethodsInClass:cls).
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   768
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   769
    ^ code
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   770
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   771
    "Created: / 31.10.1997 / 17:21:29 / cg"
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   772
    "Modified: / 31.10.1997 / 17:38:11 / cg"
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   773
!
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   774
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   775
generateHookMethodsInClass:targetClass
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   776
    |code|
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   777
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   778
    code := ''.
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   779
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   780
    (targetClass implements:#postBuildWith:) ifFalse:[
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   781
        code := code 
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   782
                , (self 
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   783
                    generateHookMethodFor:'postBuildWith:aBuilder'
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   784
                    comment:'the widgets have been built, but before the view is opened'
708
b5f3169a0ba7 super sends for the hook methods
tz
parents: 698
diff changeset
   785
                    note:'or after the super send'
b5f3169a0ba7 super sends for the hook methods
tz
parents: 698
diff changeset
   786
                    defaultCode:'    super postBuildWith:aBuilder'
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   787
                    inClass:targetClass)
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   788
    ].
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   789
    (targetClass implements:#postOpenWith:) ifFalse:[
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   790
        code := code 
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   791
                , (self 
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   792
                    generateHookMethodFor:'postOpenWith:aBuilder'
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   793
                    comment:'the topView has been opened, but before events are dispatched for it'
708
b5f3169a0ba7 super sends for the hook methods
tz
parents: 698
diff changeset
   794
                    note:'or after the super send'
b5f3169a0ba7 super sends for the hook methods
tz
parents: 698
diff changeset
   795
                    defaultCode:'    super postOpenWith:aBuilder'
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   796
                    inClass:targetClass)
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   797
    ].
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   798
    (targetClass implements:#closeRequest) ifFalse:[
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   799
        code := code 
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   800
                , (self 
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   801
                    generateHookMethodFor:'closeRequest'
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   802
                    comment:'the topView has been asked to close'
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   803
                    note:'return without the ''super closeRequest'' to stay open'
708
b5f3169a0ba7 super sends for the hook methods
tz
parents: 698
diff changeset
   804
                    defaultCode:'    ^super closeRequest'
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   805
                    inClass:targetClass)
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   806
    ].
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   807
    ^ code
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   808
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   809
    "Modified: / 31.10.1997 / 17:30:34 / cg"
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   810
    "Created: / 31.10.1997 / 17:32:49 / cg"
316
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   811
!
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   812
188
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   813
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   814
    ^ ('!!' , targetClass name , ' methodsFor:''values''!!\\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   815
      aspect , '\' ,
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   816
      '    "automatically generated by UIPainter ..."\\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   817
      '    "*** the code below returns a default value when invoked."\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   818
      '    "*** (which may not be the one you wanted)"\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   819
      '    "*** Please change as required and accept in the browser."\' ,
188
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   820
      '\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   821
      '    "value to be added below ..."\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   822
      '    Transcript showCR:self class name , '': no value yet for ' , aspect , ' ...''.\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   823
      '\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   824
      '^ nil.' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   825
      '!! !!\\') withCRs
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   826
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   827
    "Modified: / 25.10.1997 / 19:22:17 / cg"
188
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   828
!
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
   829
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   830
generateWindowSpecMethodSource
457
0b39d43d4324 care for exclas in spec-code
Claus Gittinger <cg@exept.de>
parents: 445
diff changeset
   831
    |spec str code category cls mthd specCode|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   832
310
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
   833
    spec := OrderedCollection new.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   834
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   835
    self subViews do:[:aView|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   836
        aView ~~ inputView ifTrue:[
310
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
   837
            spec add:(self fullSpecFor:aView)
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   838
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   839
    ].
310
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
   840
    spec := treeView generateFullSpecForComponents:spec.
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
   841
    str  := WriteStream on:String new.
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
   842
    UISpecification prettyPrintSpecArray:spec on:str indent:5.
464
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
   843
    specCode := str contents.
457
0b39d43d4324 care for exclas in spec-code
Claus Gittinger <cg@exept.de>
parents: 445
diff changeset
   844
0b39d43d4324 care for exclas in spec-code
Claus Gittinger <cg@exept.de>
parents: 445
diff changeset
   845
    (specCode includes:$!!) ifTrue:[
0b39d43d4324 care for exclas in spec-code
Claus Gittinger <cg@exept.de>
parents: 445
diff changeset
   846
        "/ oops - must be chunk format ...
0b39d43d4324 care for exclas in spec-code
Claus Gittinger <cg@exept.de>
parents: 445
diff changeset
   847
        str  := WriteStream on:String new.
0b39d43d4324 care for exclas in spec-code
Claus Gittinger <cg@exept.de>
parents: 445
diff changeset
   848
        str nextPutAllAsChunk:specCode.
0b39d43d4324 care for exclas in spec-code
Claus Gittinger <cg@exept.de>
parents: 445
diff changeset
   849
        specCode := str contents.
0b39d43d4324 care for exclas in spec-code
Claus Gittinger <cg@exept.de>
parents: 445
diff changeset
   850
    ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   851
178
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   852
    "/ if that method already exists, do not overwrite the category
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   853
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   854
    category := 'interface specs'.
330
ca
parents: 327
diff changeset
   855
    cls := self resolveName:className.
ca
parents: 327
diff changeset
   856
ca
parents: 327
diff changeset
   857
    cls notNil ifTrue:[
178
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   858
        (mthd := cls class compiledMethodAt:methodName asSymbol) notNil ifTrue:[
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   859
            category := mthd category.
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   860
        ]
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   861
    ].
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   862
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   863
    code := '!!'
178
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   864
            , className , ' class methodsFor:' , category storeString
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   865
            , '!!' , '\\'
60
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
            , methodName , '\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   868
            , '    "this window spec was automatically generated by the ST/X UIPainter"\\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   869
            , '    "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
   870
            , '     handle the specification if its corrupted."\\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   871
            , '    "\'
655
093cba68e10a simplified to make microsoft cc happy
Claus Gittinger <cg@exept.de>
parents: 588
diff changeset
   872
            , ('     UIPainter new openOnClass:' , className , ' andSelector:#' , methodName , '\')
093cba68e10a simplified to make microsoft cc happy
Claus Gittinger <cg@exept.de>
parents: 588
diff changeset
   873
            , ('     ' , className , ' new openInterface:#' , methodName , '\')
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   874
            , '    "\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   875
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   876
    methodName = 'windowSpec' ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   877
        code := code , '    "' , className , ' open"\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   878
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   879
    code := code 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   880
            , '\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   881
            , '    <resource: #canvas>\\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   882
            , '    ^\' 
457
0b39d43d4324 care for exclas in spec-code
Claus Gittinger <cg@exept.de>
parents: 445
diff changeset
   883
            , '     ', specCode
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   884
            , '\'
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   885
            , '!! !!'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   886
            , '\\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   887
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   888
    ^ code withCRs
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
    "Modified: 5.9.1995 / 21:01:35 / claus"
178
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
   891
    "Modified: 24.6.1997 / 19:12:44 / cg"
60
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
!UIPainterView methodsFor:'initialization'!
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
initialize
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   897
    "setup attributes
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   898
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   899
    super initialize.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   900
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   901
    superclassName := 'ApplicationModel'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   902
    className      := 'NewApplication'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   903
    methodName     := 'windowSpec'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   904
    categoryName   := 'Applications'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   905
    HandCursor     := Cursor leftHand.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   906
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   907
    self backgroundColor: self class defaultViewBackgroundColor
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   908
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   909
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   910
setupFromSpec:specOrSpecArray
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   911
    |spec builder|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   912
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   913
    treeView cvsSetupListDo:[
111
ca
parents: 103
diff changeset
   914
        self removeAll.
ca
parents: 103
diff changeset
   915
        spec    := UISpecification from:specOrSpecArray.
395
d39076243277 sett UIBuilder isEditing to true
ca
parents: 392
diff changeset
   916
        builder := UIBuilder new isEditing:true.
588
daead6079de7 Set builders applicationClass (for retrieving subSpecifications)
Stefan Vogel <sv@exept.de>
parents: 568
diff changeset
   917
        "set applicationClass, in order that subspecifications may be resolved"
daead6079de7 Set builders applicationClass (for retrieving subSpecifications)
Stefan Vogel <sv@exept.de>
parents: 568
diff changeset
   918
        className notNil ifTrue:[
daead6079de7 Set builders applicationClass (for retrieving subSpecifications)
Stefan Vogel <sv@exept.de>
parents: 568
diff changeset
   919
            builder applicationClass:(self resolveName:className).
daead6079de7 Set builders applicationClass (for retrieving subSpecifications)
Stefan Vogel <sv@exept.de>
parents: 568
diff changeset
   920
        ].
111
ca
parents: 103
diff changeset
   921
        spec window setupView:self topView for:builder.
ca
parents: 103
diff changeset
   922
        self addSpec:(spec component) builder:builder in:self.
ca
parents: 103
diff changeset
   923
        self realizeAllSubViews.
ca
parents: 103
diff changeset
   924
        inputView raise.
310
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
   925
        treeView setAttributesFromWindowSpec:(spec window).
111
ca
parents: 103
diff changeset
   926
    ]
588
daead6079de7 Set builders applicationClass (for retrieving subSpecifications)
Stefan Vogel <sv@exept.de>
parents: 568
diff changeset
   927
daead6079de7 Set builders applicationClass (for retrieving subSpecifications)
Stefan Vogel <sv@exept.de>
parents: 568
diff changeset
   928
    "Modified: / 5.2.1998 / 11:42:39 / stefan"
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   929
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   930
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   931
treeView:aTreeView
361
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   932
    treeView := aTreeView.
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   933
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   934
    treeView delegate:(
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   935
        "/
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   936
        "/ I want to handle everything typed
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   937
        "/ in the treeView, except for Return and Cursor-keys
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   938
        "/
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   939
        KeyboardForwarder 
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   940
            toView:self
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   941
            condition:nil
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   942
            filter:[:k | (k isSymbol 
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   943
                         and:[k ~~ #Return 
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   944
                         and:[(k startsWith:#Cursor) not]])
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   945
                   ]
361
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   946
    )
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   947
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   948
    "Modified: / 31.10.1997 / 20:22:09 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   949
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   950
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   951
!UIPainterView methodsFor:'menus'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   952
121
96d6feeeb049 middleButtonMen:
ca
parents: 119
diff changeset
   953
showMiddleButtonMenu
96d6feeeb049 middleButtonMen:
ca
parents: 119
diff changeset
   954
    "show the middle button menu; this returns nil
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   955
    "
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   956
    self enabled ifTrue:[
445
ddfa937f6d1d changed for the gui painter
tz
parents: 395
diff changeset
   957
        (MenuPanel fromSpec:(UIPainter menuEdit) receiver:self) startUp
111
ca
parents: 103
diff changeset
   958
    ].
121
96d6feeeb049 middleButtonMen:
ca
parents: 119
diff changeset
   959
  ^ nil
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   960
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   961
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   962
60
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
335
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   965
!UIPainterView methodsFor:'queries'!
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   966
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   967
resolveName:aName
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   968
    |appl|
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   969
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   970
    appl := self application.
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   971
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   972
    appl notNil ifTrue:[
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   973
        ^ appl resolveName:aName
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   974
    ].
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   975
    ^ Smalltalk resolveName:aName inClass:self class
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   976
! !
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
   977
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   978
!UIPainterView methodsFor:'removing components'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   979
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   980
remove:anObject
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   981
    "remove anObject from the contents do redraw
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   982
    "
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   983
    anObject notNil ifTrue:[
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   984
        treeView removeView:anObject.
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   985
    ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   986
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   987
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   988
removeAll
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   989
    "remove all objects and properties
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   990
    "
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   991
    treeView cvsEventsDisabledDo:[
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   992
        self  select:nil.
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   993
        treeView removeAll.
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   994
        self  removeUndoHistory.
111
ca
parents: 103
diff changeset
   995
    ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   996
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   997
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   998
!UIPainterView methodsFor:'searching'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   999
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1000
findContainerOfView:aView
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1001
    "returns the super view assigned to a view
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
  1002
    "
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1003
    |p|
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
  1004
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1005
    (p := self propertyOfParentForView:aView) isNil ifTrue:[
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
  1006
        ^ self
35c5711729c2 so far so good
ca
parents: 86
diff changeset
  1007
    ].
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1008
    ^ p view
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
  1009
!
35c5711729c2 so far so good
ca
parents: 86
diff changeset
  1010
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1011
findObjectAt:aPoint
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1012
    "find the origin/corner of the currentWidget
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1013
    "
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1014
    |view prop|
60
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
    view := super findObjectAt:aPoint.
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1017
    prop := self propertyRespondsToView:view.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1018
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1019
    prop notNil ifTrue:[^ prop view].
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1020
  ^ nil
60
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
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1023
findViewWithId:aViewId
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1024
    "finds view assigned to identifier and returns the view or nil
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1025
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1026
    |prop|
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
    prop := self propertyOfIdentifier:aViewId.
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
    prop notNil ifTrue:[^ prop view]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1031
               ifFalse:[^ nil]
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1032
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1033
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1034
propertyOfIdentifier:anId
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1035
    "returns property assigned to unique identifier
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1036
    "
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1037
    anId notNil ifTrue:[
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
  1038
        ^ treeView propertyDetect:[:p| p identifier == anId ]
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1039
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1040
    ^ nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1041
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1042
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1043
propertyOfName:aString
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1044
    "returns property assigned to name
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1045
    "
111
ca
parents: 103
diff changeset
  1046
    |name|
ca
parents: 103
diff changeset
  1047
ca
parents: 103
diff changeset
  1048
    aString isNil ifFalse:[
ca
parents: 103
diff changeset
  1049
        name := aString string withoutSeparators.
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
  1050
      ^ treeView propertyDetect:[:p| p name = name ].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1051
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1052
    ^ nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1053
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1054
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1055
propertyOfParentForView:aSubView
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1056
    "returns the property of the parent or nil
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1057
    "
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1058
    |item|
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1059
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1060
    (item := treeView detectItemRespondsToView:aSubView) notNil ifTrue:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1061
        (item := item parent) notNil ifTrue:[^ item contents]
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1062
    ].
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1063
    ^ nil
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1064
!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1065
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1066
propertyOfView:aView
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1067
    "returns property assigned to view
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1068
    "
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1069
    (aView isNil or:[aView == self]) ifFalse:[
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
  1070
        ^ treeView propertyDetect:[:p| p view == aView ]
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1071
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1072
    ^ nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1073
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1074
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1075
propertyRespondsToView:aView
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1076
    "detect the property responding to the argument a view. The property of the view or
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1077
     the first subview providing the properties is returned. If no property is detected
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1078
     nil is returned.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1079
    "
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1080
    |item|
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1081
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1082
    item := treeView detectItemRespondsToView:aView.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1083
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1084
    (item notNil and:[item parent notNil]) ifTrue:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1085
        ^ item contents
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1086
    ].
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1087
    ^ nil
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1088
!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1089
111
ca
parents: 103
diff changeset
  1090
uniqueNameFor:aSpecOrString
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1091
    "generate and return an unique name for a class
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1092
    "
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1093
    |next name size|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1094
111
ca
parents: 103
diff changeset
  1095
    aSpecOrString isString ifFalse:[name := aSpecOrString className asString]
ca
parents: 103
diff changeset
  1096
                            ifTrue:[name := aSpecOrString].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1097
111
ca
parents: 103
diff changeset
  1098
    (name endsWith:'Spec') ifTrue:[
ca
parents: 103
diff changeset
  1099
        name := name copyFrom:1 to:(name size - 4).
ca
parents: 103
diff changeset
  1100
    ] ifFalse:[
ca
parents: 103
diff changeset
  1101
        name := name copy
ca
parents: 103
diff changeset
  1102
    ].
ca
parents: 103
diff changeset
  1103
    size  := name size + 1.
ca
parents: 103
diff changeset
  1104
    next  := 0.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1105
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
  1106
    treeView propertiesDo:[:p|
111
ca
parents: 103
diff changeset
  1107
        |n|
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1108
        n := p name.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1109
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1110
        (n size >= size and:[n startsWith:name]) ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1111
            next := next max:(p extractNumberStartingAt:size)
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1112
        ]
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1113
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1114
    next := next + 1.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1115
    name := name, next printString.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1116
  ^ name
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1117
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1118
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1119
662
28d6cac7968b consistent ID-naming of the widgets
tz
parents: 655
diff changeset
  1120
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1121
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1122
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1123
uniqueNameOf:aView
111
ca
parents: 103
diff changeset
  1124
    |prop|
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1125
111
ca
parents: 103
diff changeset
  1126
    (prop := self propertyOfView:aView) notNil ifTrue:[
ca
parents: 103
diff changeset
  1127
        prop name isNil ifTrue:[
ca
parents: 103
diff changeset
  1128
            prop name:(self uniqueNameFor:(prop spec)).
ca
parents: 103
diff changeset
  1129
        ].
ca
parents: 103
diff changeset
  1130
        ^ prop name
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1131
    ].
111
ca
parents: 103
diff changeset
  1132
    ^ 'self'
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1133
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1134
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1135
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1136
!UIPainterView methodsFor:'selection basics'!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1137
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1138
addToSelection:anObject
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1139
    "add an object to the selection
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1140
    "
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1141
    (self enabled and:[(self isSelected:anObject) not]) ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1142
        selection isCollection ifFalse:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1143
            selection isNil ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1144
                selection := anObject
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1145
            ] ifFalse:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1146
                selection := OrderedCollection with:selection with:anObject
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1147
            ]
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1148
        ] ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1149
            selection add:anObject
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1150
        ].
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1151
        self showSelected:anObject.
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
  1152
        treeView cvsSelectionAdd:anObject.
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1153
    ]
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1154
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1155
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1156
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1157
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1158
removeFromSelection:anObject
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1159
    "remove an object from the selection
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1160
    "
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1161
    (self isSelected:anObject) ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1162
        self showUnselected:anObject.
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1163
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1164
        selection size > 1 ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1165
            selection remove:anObject ifAbsent:nil.
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1166
            self showSelection.
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1167
        ] ifFalse:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1168
            selection := nil
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1169
        ].
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
  1170
        treeView cvsSelectionRemove:anObject.
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1171
    ]
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1172
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1173
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1174
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1175
select:something
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1176
    "change selection to something
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1177
    "
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1178
    (self enabled and:[something ~= self selection]) ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1179
        self setSelection:something withRedraw:true.
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
  1180
        treeView cvsSelection:something
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1181
    ]
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1182
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1183
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1184
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1185
updateSelectionFromModel:aSelOrNil
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1186
    "update selection from a new selection
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1187
    "
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1188
    selectionHiddenLevel == 0 ifTrue:[
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1189
        aSelOrNil size ~~ 0 ifTrue:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1190
            self selectionDo:[:el| (aSelOrNil includes:el) ifFalse:[self showUnselected:el] ]
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1191
        ] ifFalse:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1192
            self selectionDo:[:el| self showUnselected:el ]
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1193
        ]
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1194
    ].
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1195
    self setSelection:aSelOrNil withRedraw:false.
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1196
    self showSelection
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1197
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1198
! !
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1199
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1200
!UIPainterView methodsFor:'specification'!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1201
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1202
addSpec:aSpecification builder:aBuilder in:aFrame
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1203
    "build view and subviews from aSpecification into a frame. The top view
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1204
     is returned. The contained components of a spec are set to nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1205
    "
330
ca
parents: 327
diff changeset
  1206
    |cls|
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1207
330
ca
parents: 327
diff changeset
  1208
    cls := self resolveName:className.
ca
parents: 327
diff changeset
  1209
ca
parents: 327
diff changeset
  1210
    cls notNil ifTrue:[
ca
parents: 327
diff changeset
  1211
        aBuilder applicationClass:cls.
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1212
    ].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1213
111
ca
parents: 103
diff changeset
  1214
    aBuilder componentCreationHook:[:aView :aSpec :aBdr||sv p s n|
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1215
        p := ViewProperty new.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1216
        s := aSpec copy.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1217
        p spec:s.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1218
        p view:aView.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1219
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1220
        s class supportsSubComponents ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1221
            s component:nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1222
        ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1223
111
ca
parents: 103
diff changeset
  1224
        n := s name.
ca
parents: 103
diff changeset
  1225
ca
parents: 103
diff changeset
  1226
        (n isNil or:[(self propertyOfName:n) notNil]) ifTrue:[
ca
parents: 103
diff changeset
  1227
            s name:(self uniqueNameFor:s)
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1228
        ].
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
  1229
        treeView addProperty:p.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1230
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1231
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1232
    ^ aSpecification buildViewWithLayoutFor:aBuilder in:aFrame.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1233
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  1234
    "Modified: 4.7.1997 / 23:48:55 / cg"
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1235
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1236
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1237
fullSpecFor:anObject
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1238
    "generate a full spec for an object
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1239
    "
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1240
    |mySpec subSpecs|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1241
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1242
    mySpec := self specFor:anObject.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1243
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1244
    (mySpec notNil and:[mySpec class supportsSubComponents]) ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1245
        (anObject subViews notNil) ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1246
            anObject subViews do:[:aSubView||spec|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1247
                spec := self fullSpecFor:aSubView.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1248
                spec notNil ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1249
                    subSpecs isNil ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1250
                        subSpecs := OrderedCollection new
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1251
                    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1252
                    subSpecs add:spec.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1253
                ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1254
            ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1255
            subSpecs notNil ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1256
                mySpec component:(SpecCollection new collection:subSpecs)
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1257
            ]
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1258
        ]
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1259
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1260
    ^ mySpec
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1261
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1262
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1263
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1264
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1265
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1266
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1267
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1268
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1269
rebuildView:aView fromSpec:aSpec withBuilder:aBuilder
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1270
    |v|
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1271
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1272
    aSpec needsRebuildForAttributes ifTrue:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1273
        v := aSpec buildViewWithLayoutFor:aBuilder in:(self findContainerOfView:aView).
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1274
        v realize.    
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1275
        aView destroy.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1276
        device sync.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1277
        device flush.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1278
        aView becomeSameAs:v.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1279
        inputView raise.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1280
    ] ifFalse:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1281
        aSpec setAttributesIn:aView with:aBuilder.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1282
        self elementChangedSize:aView.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1283
    ].
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1284
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1285
!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  1286
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1287
specFor:anObject
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1288
    "returns spec assigned to an object
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1289
    "
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1290
    |prop spec|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1291
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1292
    (prop := self propertyOfView:anObject) notNil ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1293
        spec := prop spec copy.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1294
        spec layoutFromView:anObject
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1295
    ].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1296
    ^ spec
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1297
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1298
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1299
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1300
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1301
146
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1302
specForSelection
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1303
    "returns spec assigned to current single selection or nil
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1304
    "
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1305
    ^ self specFor:(self singleSelection)
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1306
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1307
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1308
!
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  1309
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1310
updateFromSpec:aSpec
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1311
    "update current selected view from specification
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1312
    "
327
0040d47658c6 check - warnings eliminated. Fix in InspectorList.st
Claus Gittinger <cg@exept.de>
parents: 316
diff changeset
  1313
    |props name builder|
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1314
281
aabb4037f6a3 window spec
ca
parents: 279
diff changeset
  1315
    aSpec class == WindowSpec ifTrue:[
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
  1316
         ^ treeView canvasSpec:aSpec
281
aabb4037f6a3 window spec
ca
parents: 279
diff changeset
  1317
    ].
aabb4037f6a3 window spec
ca
parents: 279
diff changeset
  1318
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1319
    self singleSelection notNil ifTrue:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1320
        self withSelectionHiddenDo:[
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1321
            self transaction:#specification selectionDo:[:aView|
395
d39076243277 sett UIBuilder isEditing to true
ca
parents: 392
diff changeset
  1322
                builder := UIBuilder new isEditing:true.