UIPainterView.st
author Claus Gittinger <cg@exept.de>
Wed, 17 Feb 1999 12:35:34 +0100
changeset 1030 0b9fbaecbe88
parent 1029 240e51822e15
child 1031 7ce4b97f2c43
permissions -rw-r--r--
output a warning on the transcript, when an aspect method is not generated due to already existing method in class or superclass.
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
742
688fd0a0b0fd code generation comment
tz
parents: 723
diff changeset
     7
 inclusion of the above copyright notice. This software may not
60
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
770
96f106b0a61e set color on device
ca
parents: 768
diff changeset
    15
		categoryName handleColor handleMasterColor'
925
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    16
	classVariableNames:'HandCursor RedefineAspectMethods AspectsAsInstances'
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
742
688fd0a0b0fd code generation comment
tz
parents: 723
diff changeset
    37
 inclusion of the above copyright notice. This software may not
60
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
925
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    61
generateAspectsAsInstanceVariables
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    62
    "if on, aspects are held as instance variables;
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    63
     if off (the default), they are kept in the bindings dictionary.
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    64
    "
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    65
    ^ AspectsAsInstances
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    66
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    67
    "Created: / 29.7.1998 / 11:21:38 / cg"
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    68
    "Modified: / 29.7.1998 / 11:22:01 / cg"
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    69
!
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    70
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    71
generateAspectsAsInstanceVariables:aBoolean
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    72
    "if on, aspects are held as instance variables;
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    73
     if off (the default), they are kept in the bindings dictionary.
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    74
    "
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    75
    AspectsAsInstances := aBoolean
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    76
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    77
    "Created: / 29.7.1998 / 11:21:26 / cg"
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    78
    "Modified: / 29.7.1998 / 11:22:11 / cg"
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    79
!
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    80
742
688fd0a0b0fd code generation comment
tz
parents: 723
diff changeset
    81
redefineAspectMethods
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    82
    "redefine methods yes or no. If a method is defined in super class
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    83
     should the message be reinstalled ?
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    84
    "
742
688fd0a0b0fd code generation comment
tz
parents: 723
diff changeset
    85
    ^ RedefineAspectMethods ? false
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    86
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    87
!
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    88
742
688fd0a0b0fd code generation comment
tz
parents: 723
diff changeset
    89
redefineAspectMethods:aBoolean
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    90
    "redefine methods yes or no. If a method is defined in super class
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    91
     should the message be reinstalled ?
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    92
    "
742
688fd0a0b0fd code generation comment
tz
parents: 723
diff changeset
    93
    RedefineAspectMethods := aBoolean
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    94
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    95
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    96
! !
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    97
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    98
!UIPainterView class methodsFor:'defaults'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    99
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   100
defaultMenuMessage   
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   101
    "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
   102
    "
121
96d6feeeb049 middleButtonMen:
ca
parents: 119
diff changeset
   103
    ^ #showMiddleButtonMenu
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   104
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   105
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   106
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   107
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   108
!UIPainterView methodsFor:'accessing'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   109
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   110
application
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   111
    ^ nil
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   112
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   113
    "Modified: 6.9.1995 / 00:46:44 / claus"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   114
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   115
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   116
applicationName
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   117
    ^ self className
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   118
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   119
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   120
applicationName:aName
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   121
    self className:aName
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   122
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   123
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   124
className
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   125
    ^ className
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   126
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   127
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   128
className:aName
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   129
    className := aName
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   130
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   131
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   132
className:aClassName superclassName:aSuperclassName selector:aSelector
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   133
    className      := aClassName.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   134
    superclassName := aSuperclassName.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   135
    methodName     := aSelector.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   136
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   137
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   138
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   139
findInputViewIn:aSuperView
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   140
    "returns index of input view into superview or nil
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   141
    "
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   142
    aSuperView == self ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   143
        ^ self subViews findFirst:[:v| v == inputView ]
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   144
    ].
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   145
  ^ 0
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   146
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   147
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   148
inputView
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   149
    ^ inputView
111
ca
parents: 103
diff changeset
   150
!
ca
parents: 103
diff changeset
   151
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   152
methodName
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   153
    ^ methodName
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   154
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   155
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   156
methodName:aName
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   157
    methodName := aName
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   158
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   159
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   160
selectNames:aStringOrCollection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   161
    |prop coll s|
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
    (aStringOrCollection isNil or:[aStringOrCollection isEmpty]) ifTrue:[
131
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
   164
        ^ self select:nil
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   165
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   166
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   167
    (s := aStringOrCollection) isString ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   168
        s size == 1 ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   169
            s := s first
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   170
        ] ifFalse:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   171
            coll := OrderedCollection new.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   172
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   173
            s do:[:aName|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   174
                (prop := self propertyOfName:aName) notNil ifTrue:[
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   175
                    coll add:(prop view)
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   176
                ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   177
            ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   178
            coll size == 1 ifTrue:[ ^ self select:(coll at:1) ].
131
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
   179
            coll size == 0 ifTrue:[ ^ self select:nil ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   180
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   181
          ^ self select:coll.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   182
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   183
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   184
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   185
    prop := self propertyOfName:s.
131
715b3dbba87d selection handling changed
ca
parents: 128
diff changeset
   186
    prop isNil ifTrue:[^ self select:nil]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   187
              ifFalse:[^ self select:(prop view)]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   188
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   189
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   190
111
ca
parents: 103
diff changeset
   191
!UIPainterView methodsFor:'change & update'!
ca
parents: 103
diff changeset
   192
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   193
layoutChanged
754
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
   194
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   195
    treeView layoutChanged
111
ca
parents: 103
diff changeset
   196
! !
ca
parents: 103
diff changeset
   197
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   198
!UIPainterView methodsFor:'copy & cut & paste'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   199
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   200
copySelection
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   201
    "copy the selection into the cut&paste-buffer
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   202
    "
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   203
    |specs coll sel|
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   204
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   205
    sel := treeView selection.
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   206
128
9779b7459a1c selection and update from selection
ca
parents: 121
diff changeset
   207
    coll := self minSetOfSuperViews:(self selection).
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   208
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   209
    coll notNil ifTrue:[
776
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   210
"/        self select:nil.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   211
        specs := coll collect:[:aView| self fullSpecFor:aView ].
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   212
        self setSelection:specs.
776
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   213
"/        treeView selection: sel
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   214
    ].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   215
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   216
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   217
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   218
723
60e8ffac2f38 #deleteSelection in #deleteTotalSelection renamed
tz
parents: 712
diff changeset
   219
deleteSelection
887
79a6e12e1d0f after deleting a widget do select the neighbour then the parent (step 2)
tz
parents: 886
diff changeset
   220
    "delete the selection buffered
79a6e12e1d0f after deleting a widget do select the neighbour then the parent (step 2)
tz
parents: 886
diff changeset
   221
    "
79a6e12e1d0f after deleting a widget do select the neighbour then the parent (step 2)
tz
parents: 886
diff changeset
   222
    self deleteSelectionBuffered: true
79a6e12e1d0f after deleting a widget do select the neighbour then the parent (step 2)
tz
parents: 886
diff changeset
   223
!
79a6e12e1d0f after deleting a widget do select the neighbour then the parent (step 2)
tz
parents: 886
diff changeset
   224
79a6e12e1d0f after deleting a widget do select the neighbour then the parent (step 2)
tz
parents: 886
diff changeset
   225
deleteSelectionBuffered: buffered
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   226
    "cut the selection into the cut&paste-buffer
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   227
     and open a transaction
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   228
    "
887
79a6e12e1d0f after deleting a widget do select the neighbour then the parent (step 2)
tz
parents: 886
diff changeset
   229
    |specs coll oldSelectedNode newSelectedNode newSelection|
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   230
128
9779b7459a1c selection and update from selection
ca
parents: 121
diff changeset
   231
    coll := self minSetOfSuperViews:(self selection).
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   232
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   233
    coll notNil ifTrue:[
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
   234
        treeView cvsEventsDisabledDo:[
886
3c67610b9631 after deleting a widget do select the neighbour then the parent
tz
parents: 858
diff changeset
   235
1015
a5d37f30faa8 multiple selection/first node=root/delete - error fixed
tz
parents: 1013
diff changeset
   236
            ((oldSelectedNode := (treeView model selectedNodes at: 1 ifAbsent: nil)) notNil and:
a5d37f30faa8 multiple selection/first node=root/delete - error fixed
tz
parents: 1013
diff changeset
   237
            [oldSelectedNode parent notNil]) ifTrue: [
887
79a6e12e1d0f after deleting a widget do select the neighbour then the parent (step 2)
tz
parents: 886
diff changeset
   238
                oldSelectedNode parent children size <= 1 ifTrue: [
79a6e12e1d0f after deleting a widget do select the neighbour then the parent (step 2)
tz
parents: 886
diff changeset
   239
                    newSelectedNode := oldSelectedNode parent
79a6e12e1d0f after deleting a widget do select the neighbour then the parent (step 2)
tz
parents: 886
diff changeset
   240
                ]
79a6e12e1d0f after deleting a widget do select the neighbour then the parent (step 2)
tz
parents: 886
diff changeset
   241
                ifFalse: [
79a6e12e1d0f after deleting a widget do select the neighbour then the parent (step 2)
tz
parents: 886
diff changeset
   242
                    newSelectedNode := oldSelectedNode parent children 
79a6e12e1d0f after deleting a widget do select the neighbour then the parent (step 2)
tz
parents: 886
diff changeset
   243
                        at: (oldSelectedNode parent indexOfChild: oldSelectedNode) - 1 
79a6e12e1d0f after deleting a widget do select the neighbour then the parent (step 2)
tz
parents: 886
diff changeset
   244
                        ifAbsent: [oldSelectedNode parent children at: 2]
79a6e12e1d0f after deleting a widget do select the neighbour then the parent (step 2)
tz
parents: 886
diff changeset
   245
                ].
886
3c67610b9631 after deleting a widget do select the neighbour then the parent
tz
parents: 858
diff changeset
   246
            ].
887
79a6e12e1d0f after deleting a widget do select the neighbour then the parent (step 2)
tz
parents: 886
diff changeset
   247
            self hideSelection.
79a6e12e1d0f after deleting a widget do select the neighbour then the parent (step 2)
tz
parents: 886
diff changeset
   248
            selection := nil.
111
ca
parents: 103
diff changeset
   249
            specs := coll collect:[:aView| self fullSpecFor:aView ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   250
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   251
            self withinTransaction:#cut objects:coll do:[
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   252
                coll reverseDo:[:aView|
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   253
                    self createUndoRemove:aView.
887
79a6e12e1d0f after deleting a widget do select the neighbour then the parent (step 2)
tz
parents: 886
diff changeset
   254
                    self remove:aView.
111
ca
parents: 103
diff changeset
   255
                ]
ca
parents: 103
diff changeset
   256
            ].
887
79a6e12e1d0f after deleting a widget do select the neighbour then the parent (step 2)
tz
parents: 886
diff changeset
   257
            buffered ifTrue: [self setSelection: specs].
886
3c67610b9631 after deleting a widget do select the neighbour then the parent
tz
parents: 858
diff changeset
   258
            treeView selection: nil. 
887
79a6e12e1d0f after deleting a widget do select the neighbour then the parent (step 2)
tz
parents: 886
diff changeset
   259
            (newSelection := (treeView model indexOf:newSelectedNode)) > 0 ifFalse: [
79a6e12e1d0f after deleting a widget do select the neighbour then the parent (step 2)
tz
parents: 886
diff changeset
   260
                 newSelection := 1
79a6e12e1d0f after deleting a widget do select the neighbour then the parent (step 2)
tz
parents: 886
diff changeset
   261
            ].
79a6e12e1d0f after deleting a widget do select the neighbour then the parent (step 2)
tz
parents: 886
diff changeset
   262
            treeView selection: (Array with: newSelection).
886
3c67610b9631 after deleting a widget do select the neighbour then the parent
tz
parents: 858
diff changeset
   263
            self setSelection:treeView selectedNode contents view withRedraw: true.
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   264
        ]
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   265
    ]
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   266
!
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   267
723
60e8ffac2f38 #deleteSelection in #deleteTotalSelection renamed
tz
parents: 712
diff changeset
   268
deleteTotalSelection
887
79a6e12e1d0f after deleting a widget do select the neighbour then the parent (step 2)
tz
parents: 886
diff changeset
   269
    "delete the selection
79a6e12e1d0f after deleting a widget do select the neighbour then the parent (step 2)
tz
parents: 886
diff changeset
   270
    "            
79a6e12e1d0f after deleting a widget do select the neighbour then the parent (step 2)
tz
parents: 886
diff changeset
   271
    self deleteSelectionBuffered: false
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   272
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   273
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   274
pasteBuffer
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   275
    "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
   276
    "
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   277
    |sel|
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   278
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   279
    sel := self pasteSpecifications:(self getSelection) keepLayout:false.
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   280
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   281
    sel notNil ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   282
        self select:sel.
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   283
    ].
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   284
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   285
!
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   286
392
ca
parents: 376
diff changeset
   287
pasteFromClipBoard:aString
ca
parents: 376
diff changeset
   288
    ^ self
ca
parents: 376
diff changeset
   289
ca
parents: 376
diff changeset
   290
ca
parents: 376
diff changeset
   291
!
ca
parents: 376
diff changeset
   292
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   293
pasteSpecifications:aSpecificationOrList keepLayout:keepLayout
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   294
    "add the specs to the object view; returns list of pasted components
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   295
    "
278
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   296
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   297
    ^ self
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   298
        pasteSpecifications:aSpecificationOrList 
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   299
        keepLayout:keepLayout 
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   300
        at:nil
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   301
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   302
    "Modified: 11.8.1997 / 01:00:35 / cg"
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   303
!
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   304
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   305
pasteSpecifications:aSpecificationOrList keepLayout:keepLayout at:aPointOrNil
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   306
    "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
   307
    "
312
386932d91a97 paste at a point; first translate the point
ca
parents: 310
diff changeset
   308
    |paste frame pasteOrigin pasteOffset builder newSel bounds|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   309
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   310
    (self canPaste:aSpecificationOrList) ifFalse:[
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   311
        ^ nil
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   312
    ].
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   313
776
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   314
    aSpecificationOrList isCollection ifTrue:[
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   315
        paste := aSpecificationOrList
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   316
    ] ifFalse:[
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   317
        paste := Array with:aSpecificationOrList
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   318
    ].
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   319
    (frame := self singleSelection) isNil ifTrue:[
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   320
        frame := self
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   321
    ].
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   322
    self selection:nil.
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   323
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   324
    newSel  := OrderedCollection new.
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   325
    builder := UIBuilder new isEditing:true.
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   326
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   327
    className notNil ifTrue:[
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   328
        builder applicationClass:(self resolveName:className)
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   329
    ].
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   330
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   331
    keepLayout ifFalse:[
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   332
        pasteOffset := 0@0.
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   333
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   334
        aPointOrNil isNil ifTrue:[
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   335
            pasteOrigin := self sensor mousePoint.
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   336
            pasteOrigin := device translatePoint:pasteOrigin
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   337
                                        from:device rootView id
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   338
                                          to:frame id.
165
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   339
        ] ifFalse:[
776
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   340
            pasteOrigin := device translatePoint:aPointOrNil
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   341
                                            from:self id
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   342
                                              to:frame id.
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   343
        ]
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   344
    ].
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   345
    keepLayout ifFalse:[
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   346
        bounds := Rectangle origin:0@0 extent:(frame bounds extent)
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   347
    ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   348
776
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   349
    paste do:[:aSpec|
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   350
        |view|
395
d39076243277 sett UIBuilder isEditing to true
ca
parents: 392
diff changeset
   351
776
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   352
        view := self addSpec:aSpec builder:builder in:frame.
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   353
165
f7df2a53d042 less change notifications
ca
parents: 162
diff changeset
   354
        keepLayout ifFalse:[
776
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   355
            (bounds containsPoint:pasteOrigin) ifFalse:[
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   356
                self moveObject:view to:pasteOffset.
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   357
            ] ifTrue:[
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   358
                self moveObject:view to:pasteOrigin + pasteOffset.
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   359
            ].
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   360
            pasteOffset := pasteOffset + 4
312
386932d91a97 paste at a point; first translate the point
ca
parents: 310
diff changeset
   361
        ].
776
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   362
        view realize.
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   363
        newSel add:view.
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   364
    ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   365
776
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   366
    self withinTransaction:#paste objects:newSel do:[
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   367
        undoHistory addUndoSelector:#undoCreate:
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   368
                           withArgs:(newSel collect:[:v|(self propertyOfView:v) identifier])
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   369
    ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   370
776
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   371
    self realizeAllSubViews.
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   372
    newSel do:[:v| v raise].
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   373
    inputView raise.
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   374
    self elementChangedSize:frame.
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   375
776
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   376
    newSel size == 1 ifTrue:[newSel := newSel at:1].
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   377
    ^ newSel
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   378
!
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   379
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   380
pasteWithLayout
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   381
    "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
   382
     layout
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   383
    "
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   384
    |sel|
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   385
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   386
    sel := self pasteSpecifications:(self getSelection) keepLayout:true.
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   387
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   388
    sel notNil ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   389
        self select:sel.
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   390
    ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   391
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   392
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   393
!UIPainterView methodsFor:'drag & drop'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   394
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   395
canDrop:something
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   396
    "returns true if something can be droped
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   397
    "      
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   398
    (something size == 1 and:[self enabled and:[self numberOfSelections <= 1]]) ifTrue:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   399
      ^ something first theObject isKindOf:UISpecification
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   400
    ].
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   401
    ^ false
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
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   404
canPaste
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   405
    "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
   406
     the selection if exists
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   407
    "
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   408
    ^ self canPaste:(self getSelection)
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   409
!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   410
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   411
canPaste:something
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   412
    "returns true if something could be paste
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   413
    "
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   414
    |el size|
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   415
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   416
    ((size := self numberOfSelections) <= 1 and:[self enabled]) ifFalse:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   417
        ^ false
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   418
    ].
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   419
    something isCollection ifTrue:[something notEmpty ifTrue:[el := something first]]
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   420
                          ifFalse:[el := something].
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   421
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   422
    (el isKindOf:UISpecification) ifFalse:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   423
        ^ false
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   424
    ].
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   425
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   426
    size == 1 ifTrue:[
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   427
        ^ self canPasteInto:(self singleSelection)
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   428
    ].
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   429
  ^ true
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   430
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   431
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   432
canPasteInto:aView
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   433
    "can paste into a view
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   434
    "
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   435
    |prop|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   436
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   437
    aView notNil ifTrue:[
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   438
        (prop := self propertyRespondsToView:aView) notNil ifTrue:[
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   439
            ^ prop spec class supportsSubComponents
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   440
        ].
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   441
      ^ aView specClass supportsSubComponents.
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   442
    ].
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   443
    ^ false
96
73725336b4fe dont paste into scrollable selectionInListViews ...
Claus Gittinger <cg@exept.de>
parents: 89
diff changeset
   444
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   445
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   446
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   447
drop:anObjectOrCollection at:aPoint
278
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   448
    |spec newSel oldSel dragOffset|
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   449
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   450
    self selection notNil ifTrue:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   451
        oldSel := self singleSelection.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   452
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   453
        (self canPasteInto:oldSel) ifFalse:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   454
            oldSel := nil.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   455
            self setSelection:nil withRedraw:true
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   456
        ]
231
75de472d579f check whether selection is a view or a collection
ca
parents: 223
diff changeset
   457
    ].
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   458
    spec := (anObjectOrCollection at:1) theObject.
278
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   459
    dragOffset := DragAndDropManager dragOffsetQuerySignal raise.
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
   460
    newSel := self pasteSpecifications:spec keepLayout:false at:aPoint - dragOffset.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   461
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   462
    oldSel isNil ifTrue:[self select:newSel]
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   463
                ifFalse:[self select:oldSel]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   464
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   465
361
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   466
!UIPainterView methodsFor:'event handling'!
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   467
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   468
keyPress:key x:x y:y view:aView
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   469
    "a delegated keyEvent from aView"
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   470
361
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   471
    self keyPress:key x:x y:y
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   472
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   473
    "Modified: / 31.10.1997 / 20:27:22 / cg"
361
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   474
!
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   475
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   476
keyRelease:key x:x y:y view:aView
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   477
    "a delegated keyEvent from aView"
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   478
361
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   479
    self keyRelease:key x:x y:y
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   480
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   481
    "Modified: / 31.10.1997 / 20:27:32 / cg"
754
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
   482
!
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
   483
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
   484
sizeChanged:how
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
   485
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
   486
    super sizeChanged:how. 
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
   487
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
   488
    self layoutChanged
361
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   489
! !
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   490
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   491
!UIPainterView methodsFor:'generating output'!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   492
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   493
aspectMethods
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   494
    "extract a list of aspect methods - for browsing"
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   495
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   496
    |cls methods skip selector protoSpec|
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
    className isNil ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   499
        self warn:'set the class first'.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   500
        ^ #()
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   501
    ].
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
    cls := self resolveName:className.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   504
    methods := IdentitySet new.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   505
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   506
    treeView propertiesDo:[:aProp|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   507
        |selector|
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
        (selector := aProp model) notNil ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   510
            selector isArray ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   511
                selector := selector asSymbol.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   512
                (cls implements:selector) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   513
                    skip := false.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   514
                    (cls isSubclassOf:SimpleDialog) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   515
                        skip := SimpleDialog implements:selector asSymbol
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   516
                    ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   517
                    skip ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   518
                        methods add:(cls compiledMethodAt:selector)
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
                ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   521
            ].
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
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   524
        (selector := aProp menu) notNil ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   525
            selector isArray ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   526
                selector := selector asSymbol.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   527
                (cls implements:selector) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   528
                    methods add:(cls compiledMethodAt:selector)
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
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   533
        (aProp spec aspectSelectors) do:[:aSel |
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   534
            |selector|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   535
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   536
            aSel isArray ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   537
                selector := aSel asSymbol.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   538
                (cls implements:selector) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   539
                    methods add:(cls compiledMethodAt:selector)
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
        aProp spec actionSelectors do:[:aSel|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   544
            |selector|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   545
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   546
            aSel isArray ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   547
                selector := aSel asSymbol.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   548
                (cls implements:selector) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   549
                    methods add:(cls compiledMethodAt:selector)
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   550
                ]
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   551
            ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   552
        ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   553
        aProp spec valueSelectors do:[:aSel|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   554
            |selector|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   555
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   556
            aSel isArray ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   557
                selector := aSel asSymbol.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   558
                (cls implements:selector) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   559
                    methods add:(cls compiledMethodAt:selector)
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   560
                ]
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   561
            ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   562
        ]
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   563
    ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   564
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   565
    protoSpec := treeView canvasSpec.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   566
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   567
    (selector := protoSpec menu) notNil ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   568
        selector isArray ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   569
            selector := selector asSymbol.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   570
            (cls implements:selector) ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   571
                methods add:(cls compiledMethodAt:selector)
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   572
            ]
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   573
        ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   574
    ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   575
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   576
    ^ methods
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   577
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   578
    "Created: / 25.10.1997 / 18:58:25 / cg"
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   579
    "Modified: / 26.10.1997 / 15:06:18 / cg"
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   580
!
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   581
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   582
generateActionMethodFor:aspect spec:protoSpec inClass:targetClass
568
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   583
    |selector args showIt code alreadyInSuperclass numArgs method|
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   584
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   585
    selector := aspect asSymbol.
141
d06c04391233 generate actions with argument
ca
parents: 137
diff changeset
   586
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   587
    alreadyInSuperclass := targetClass superclass canUnderstand:selector.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   588
568
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   589
    numArgs := selector numArgs.
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   590
    method  := aspect.
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   591
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   592
    numArgs == 1 ifTrue:[
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   593
        args := 'anArgument'.
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   594
        showIt := ''' , anArgument printString , '' ...''.\'.
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   595
    ] ifFalse:[    
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   596
        args := ''.
149
e652608690b1 help ...
ca
parents: 146
diff changeset
   597
        showIt := ' ...''.\'.
568
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   598
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   599
        numArgs ~~ 0 ifTrue:[
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   600
            method := ''.
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   601
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   602
            selector keywords keysAndValuesDo:[:i :key|
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   603
                method := method, key, 'arg', i printString, ' '
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   604
            ]
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   605
        ]
149
e652608690b1 help ...
ca
parents: 146
diff changeset
   606
    ].
141
d06c04391233 generate actions with argument
ca
parents: 137
diff changeset
   607
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   608
    code := '!!' , targetClass name , ' methodsFor:''actions''!!\\' ,
568
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   609
                method , args , '\' ,
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   610
                '    "automatically generated by UIPainter ..."\\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   611
                '    "*** the code below performs no action"\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   612
                '    "*** (except for some feedback on the Transcript)"\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   613
                '    "*** Please change as required and accept in the browser."\' ,
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   614
                '\' .
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   615
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   616
    alreadyInSuperclass ifTrue:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   617
        code := code ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   618
                    '    "action for ' , aspect , ' is already provided in a superclass."\' ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   619
                    '    "It may be redefined here ..."\\'.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   620
    ] ifFalse:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   621
        code := code ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   622
                    '    "action to be added ..."\\'.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   623
    ].
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   624
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   625
    code := code ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   626
                '    Transcript showCR:self class name, '': '.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   627
    alreadyInSuperclass ifTrue:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   628
        code := code , 'inherited '.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   629
    ].
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   630
    code := code , 'action for ' , aspect , showIt.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   631
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   632
    alreadyInSuperclass ifTrue:[
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   633
        code := code ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   634
                        '    super ' , aspect , args , '.\'.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   635
    ].
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   636
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   637
    code := code ,
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   638
                '!! !!\\'.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   639
    ^ code withCRs
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   640
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   641
    "Modified: / 25.10.1997 / 19:18:50 / 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
generateAspectMethodFor:aspect spec:protoSpec inClass:targetClass
655
093cba68e10a simplified to make microsoft cc happy
Claus Gittinger <cg@exept.de>
parents: 588
diff changeset
   645
    |modelClass modelValue modelGen code|
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   646
149
e652608690b1 help ...
ca
parents: 146
diff changeset
   647
    modelClass := protoSpec defaultModelClassFor:aspect.
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   648
    modelValue := protoSpec defaultModelValueFor:aspect.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   649
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   650
    modelValue isNil ifTrue:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   651
        modelGen := modelClass name , ' new'
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   652
    ] ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   653
        modelGen := modelValue storeString , ' asValue'
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   654
    ].
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   655
655
093cba68e10a simplified to make microsoft cc happy
Claus Gittinger <cg@exept.de>
parents: 588
diff changeset
   656
    code := '!!' , targetClass name , ' methodsFor:''aspects''!!\\' ,
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   657
      aspect , '\' ,
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   658
      '    "automatically generated by UIPainter ..."\\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   659
      '    "*** the code below creates a default model when invoked."\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   660
      '    "*** (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
   661
      '    "*** 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
   662
925
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   663
    AspectsAsInstances ifTrue:[
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   664
        code := (code , '\' ,
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   665
          '    ' , aspect , ' isNil ifTrue:[\' ,
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   666
          '        ' , aspect , ' := ' , ' ' , modelGen , '.\' ,
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   667
          '    ].\' ,
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   668
          '    ^ ' , aspect ,'.\' ,
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   669
          '!! !!\\') 
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   670
    ] ifFalse:[
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   671
        code := (code , '\' ,
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   672
          '    |holder|\' ,
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   673
          '\' ,
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   674
          '    (holder := builder bindingAt:#' , aspect , ') isNil ifTrue:[\' ,
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   675
          '        builder aspectAt:#' , aspect , ' put:(holder := ' , ' ' , modelGen , ').\' ,
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   676
          '    ].\' ,
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   677
          '    ^ holder.\' ,
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   678
          '!! !!\\') 
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   679
    ].
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   680
    ^ code withCRs
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   681
925
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   682
    "Modified: / 29.7.1998 / 11:29:16 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   683
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   684
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   685
generateAspectMethods
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   686
    "generate aspect, action & menu methods
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   687
     - but do not overwrite existing ones.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   688
     Return a string ready to compile into the application class."
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   689
858
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   690
    |cls code skip menuSelector protoSpec thisCode
925
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   691
     definedMethodSelectors iVars t|
858
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   692
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   693
    definedMethodSelectors := IdentitySet new.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   694
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   695
    code := ''.
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   696
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   697
    className isNil ifTrue:[
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   698
        self warn:'Set first the class!!'.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   699
        ^ code
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   700
    ].
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   701
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   702
    (cls := self resolveName:className) isNil ifTrue:[
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   703
        self warn:'Class ', className asString, ' does not exist!!'.
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   704
        ^ code
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   705
    ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   706
316
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   707
    treeView propertiesDo:[:aProp|
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   708
        |modelSelector menuSelector|
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   709
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   710
        protoSpec := aProp spec.
175
0b0b4d99e3e7 isResizeable
ca
parents: 165
diff changeset
   711
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   712
        (modelSelector := aProp model) notNil ifTrue:[
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   713
            self generateCodeFrom:(Array with:modelSelector) in:cls
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   714
                do:[:aSel|
858
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   715
                    |sym|
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   716
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   717
                    sym := aSel asSymbol.
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   718
                    skip := false.
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   719
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   720
                    (cls isSubclassOf:SimpleDialog) ifTrue:[
858
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   721
                        skip := SimpleDialog implements:sym
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   722
                    ].
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   723
                    (definedMethodSelectors includes:sym) ifTrue:[
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   724
                        skip := true.
158
6e7f892308ae do not generate accept/cancel and help action methods,
Claus Gittinger <cg@exept.de>
parents: 156
diff changeset
   725
                    ].
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   726
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   727
                    skip ifFalse:[
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   728
                        "/ kludge ..
796
05b2883a23b0 fixed aspect generation for RadioButtons
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   729
                        "/ (protoSpec isKindOf:ActionButtonSpec) 
05b2883a23b0 fixed aspect generation for RadioButtons
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   730
                        (protoSpec defaultModelIsCallBackMethodSelector:aSel)
05b2883a23b0 fixed aspect generation for RadioButtons
Claus Gittinger <cg@exept.de>
parents: 784
diff changeset
   731
                        ifTrue:[
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   732
                            thisCode := (self generateActionMethodFor:aSel spec:protoSpec inClass:cls).
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   733
                        ] ifFalse:[
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   734
                            thisCode := (self generateAspectMethodFor:aSel spec:protoSpec inClass:cls).
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   735
                        ].
858
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   736
                        code := code, thisCode.
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   737
                        definedMethodSelectors add:sym.
1030
0b9fbaecbe88 output a warning on the transcript, when an aspect method
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
   738
                    ] ifTrue:[
0b9fbaecbe88 output a warning on the transcript, when an aspect method
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
   739
                        Transcript showCR:'no code generated for aspect: ' , sym , ' (method already exists)'
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   740
                    ]
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   741
                ]
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   742
        ].
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
   743
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   744
        self generateCodeFrom:(aProp spec aspectSelectors) in:cls
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   745
                do:[:aSel|
858
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   746
                    |sym|
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   747
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   748
                    sym := aSel asSymbol.
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   749
                    (definedMethodSelectors includes:sym) ifFalse:[
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   750
                        thisCode := (self generateAspectMethodFor:aSel spec:protoSpec inClass:cls).
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   751
                        code := code , thisCode.
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   752
                        definedMethodSelectors add:sym.
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   753
                    ]
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   754
                ].
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   755
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   756
        self generateCodeFrom:(aProp spec actionSelectors) in:cls
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   757
                do:[:aSel|
858
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   758
                    |sym|
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   759
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   760
                    sym := aSel asSymbol.
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   761
                    (definedMethodSelectors includes:sym) ifFalse:[
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   762
                        thisCode := (self generateActionMethodFor:aSel spec:protoSpec inClass:cls).
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   763
                        code := code , thisCode.
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   764
                        definedMethodSelectors add:sym.
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   765
                    ]
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   766
                ].
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   767
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   768
        self generateCodeFrom:(aProp spec valueSelectors) in:cls
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   769
                do:[:aSel|
858
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   770
                    |sym|
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   771
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   772
                    sym := aSel asSymbol.
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   773
                    (definedMethodSelectors includes:sym) ifFalse:[
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   774
                        "/ uppercase: - assume its a globals name.
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   775
                        aSel first isUppercase ifFalse:[
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   776
                            thisCode := (self generateValueMethodFor:aSel spec:protoSpec inClass:cls).
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   777
                            code := code , thisCode.
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   778
                            definedMethodSelectors add:sym.
6b2e9e31cf06 do not redefine generated aspect methods
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   779
                        ]
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   780
                    ]
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   781
                ].
316
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   782
    ].
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   783
925
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   784
    AspectsAsInstances ifTrue:[
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   785
        iVars := cls instVarNames asOrderedCollection.
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   786
        definedMethodSelectors do:[:ivar |
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   787
            (iVars includes:ivar) ifFalse:[
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   788
                iVars add:ivar
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   789
            ]
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   790
        ].
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   791
        iVars := iVars asArray.
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   792
        t := cls shallowCopy.
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   793
        t setInstanceVariableString:iVars asStringCollection asString.
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   794
        code := (t definition) , '!!\' withCRs , code.
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   795
    ].
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   796
    ^ code
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   797
925
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
   798
    "Modified: / 29.7.1998 / 12:21:19 / cg"
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   799
!
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   800
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   801
generateCodeFrom:aListOfSelectors in:aClass do:aBlock
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   802
744
20cbba6d7e96 oops - no #redefineMethods found
tz
parents: 742
diff changeset
   803
    self class redefineAspectMethods ifTrue:[
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   804
        aListOfSelectors do:[:aSelector|
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   805
            (aSelector isArray or:[aClass implements:aSelector]) ifFalse:[
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   806
                aBlock value:aSelector
1030
0b9fbaecbe88 output a warning on the transcript, when an aspect method
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
   807
            ] ifTrue:[
0b9fbaecbe88 output a warning on the transcript, when an aspect method
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
   808
                Transcript showCR:'#' , aSelector , ' skipped - already implemented in the class'
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   809
            ]
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   810
        ]
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   811
    ] ifFalse:[
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   812
        aListOfSelectors do:[:aSelector|
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   813
            (aSelector isArray or:[aClass canUnderstand:aSelector]) ifFalse:[
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   814
                aBlock value:aSelector
1030
0b9fbaecbe88 output a warning on the transcript, when an aspect method
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
   815
            ] ifTrue:[
0b9fbaecbe88 output a warning on the transcript, when an aspect method
Claus Gittinger <cg@exept.de>
parents: 1029
diff changeset
   816
                Transcript showCR:'#' , aSelector , ' skipped - already implemented in the class (or superclass)'
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   817
            ]
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   818
        ]
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   819
    ]
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   820
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   821
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   822
!
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   823
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   824
generateHookMethodFor:selectorSpec comment:commentWhen note:noteOrNil defaultCode:defaultCode inClass:targetClass
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   825
    ^ ('!!' , targetClass name , ' methodsFor:''hooks''!!\\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   826
      selectorSpec , '\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   827
      '    "automatically generated by UIPainter ..."\\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   828
      '    "*** the code here does nothing. It is invoked when"\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   829
      '    "*** ' , commentWhen , '"\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   830
      '    "*** Please change as required and accept in the browser."\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   831
      '\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   832
      '    "specific code to be added below ..."\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   833
      '    "' , (noteOrNil ? '') , '"\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   834
      '\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   835
      (defaultCode ? '^ self.') ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   836
      '!! !!\\') withCRs
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   837
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   838
    "Modified: / 25.10.1997 / 19:22:17 / cg"
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   839
    "Created: / 31.10.1997 / 17:31:53 / cg"
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   840
!
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   841
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   842
generateHookMethods
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   843
    "generate hook methods
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   844
     - but do not overwrite existing ones.
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   845
     Return a string ready to compile into the application class."
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   846
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   847
    |cls code skip menuSelector protoSpec thisCode|
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   848
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   849
    code := ''.
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   850
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   851
    className isNil ifTrue:[
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   852
        self warn:'set the class first'.
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   853
        ^ code
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   854
    ].
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   855
    cls := self resolveName:className.
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   856
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   857
    code := code , (self generateHookMethodsInClass:cls).
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   858
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   859
    ^ code
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   860
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   861
    "Created: / 31.10.1997 / 17:21:29 / cg"
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   862
    "Modified: / 31.10.1997 / 17:38:11 / cg"
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   863
!
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   864
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   865
generateHookMethodsInClass:targetClass
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   866
    |code|
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   867
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   868
    code := ''.
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   869
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   870
    (targetClass implements:#postBuildWith:) ifFalse:[
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   871
        code := code 
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   872
                , (self 
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   873
                    generateHookMethodFor:'postBuildWith:aBuilder'
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   874
                    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
   875
                    note:'or after the super send'
b5f3169a0ba7 super sends for the hook methods
tz
parents: 698
diff changeset
   876
                    defaultCode:'    super postBuildWith:aBuilder'
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   877
                    inClass:targetClass)
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   878
    ].
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   879
    (targetClass implements:#postOpenWith:) ifFalse:[
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   880
        code := code 
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   881
                , (self 
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   882
                    generateHookMethodFor:'postOpenWith:aBuilder'
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   883
                    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
   884
                    note:'or after the super send'
b5f3169a0ba7 super sends for the hook methods
tz
parents: 698
diff changeset
   885
                    defaultCode:'    super postOpenWith:aBuilder'
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   886
                    inClass:targetClass)
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   887
    ].
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   888
    (targetClass implements:#closeRequest) ifFalse:[
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   889
        code := code 
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   890
                , (self 
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   891
                    generateHookMethodFor:'closeRequest'
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   892
                    comment:'the topView has been asked to close'
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   893
                    note:'return without the ''super closeRequest'' to stay open'
708
b5f3169a0ba7 super sends for the hook methods
tz
parents: 698
diff changeset
   894
                    defaultCode:'    ^super closeRequest'
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   895
                    inClass:targetClass)
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   896
    ].
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   897
    ^ code
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   898
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   899
    "Modified: / 31.10.1997 / 17:30:34 / cg"
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   900
    "Created: / 31.10.1997 / 17:32:49 / cg"
316
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   901
!
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
   902
965
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   903
generateMenuMethodFor:menuSel inClass:targetClass
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   904
    |selector args showIt code alreadyInSuperclass numArgs method|
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   905
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   906
    selector := menuSel asSymbol.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   907
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   908
    alreadyInSuperclass := targetClass superclass canUnderstand:selector.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   909
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   910
    code := '!!' , targetClass name , ' methodsFor:''menu actions''!!\\'.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   911
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   912
    selector = 'openAboutThisApplication' ifTrue:[
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   913
        code := code ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   914
                'openAboutThisApplication\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   915
                '    "opens an about box for this application."\\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   916
                '    "automatically generated by UIPainter ..."\\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   917
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   918
                '    |rev box myClass clsRev image msg|\\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   919
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   920
                '    rev := ''''.\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   921
                '    myClass := self class.\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   922
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   923
                '    (clsRev := myClass revision) notNil ifTrue:[\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   924
                '       rev := ''  (rev: '', clsRev printString, '')''].\\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   925
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   926
                '    msg := Character cr asString , myClass name asBoldText, rev.\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   927
                '    msg := (msg , ''\\*** add more info here ***\\'') withCRs.\\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   928
                '    box := AboutBox title:msg.\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   929
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   930
                '    "/ *** add a #defaultIcon method in the class\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   931
                '    "/ *** and uncomment the following line:\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   932
                '    "/ image := self class defaultIcon.\\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   933
                '    image notNil ifTrue:[\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   934
                '        box image:image\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   935
                '    ].\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   936
                '    box   label:(resources string:''About %1'' with:myClass name).\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   937
                '    box   autoHideAfter:10 with:[].\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   938
                '    box   showAtPointer.\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   939
                '!! !!\\'.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   940
        ^ code withCRs
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   941
    ].
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   942
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   943
    selector = 'menuOpen' ifTrue:[
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   944
        code := code ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   945
                'menuOpen\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   946
                '    "automatically generated by UIPainter ..."\\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   947
                '    "*** the code below opens a dialog for file selection"\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   948
                '    "*** and invokes the #doOpen: method with the selected file."\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   949
                '    "*** Please change as required and accept in the browser."\\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   950
                '    |file|\\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   951
                '    file :=\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   952
                '        (FileSelectionBrowser\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   953
                '            request: ''Open''\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   954
                '            fileName: ''''\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   955
                '            "/ inDirectory: lastOpenDirectory\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   956
                '            withFileFilters: #(''*'')).\\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   957
                '    file notNil ifTrue:[\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   958
                '       "/ lastOpenDirectory := file asFilename directory.\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   959
                '       self doOpen:file\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   960
                '    ]\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   961
                '!! !!\'.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   962
        ^ code withCRs
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   963
    ].
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   964
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   965
    numArgs := selector numArgs.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   966
    method  := selector.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   967
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   968
    numArgs == 1 ifTrue:[
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   969
        args := 'anArgument'.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   970
        showIt := ''' , anArgument printString , '' ...''.\'.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   971
    ] ifFalse:[    
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   972
        args := ''.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   973
        showIt := ' ...''.\'.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   974
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   975
        numArgs ~~ 0 ifTrue:[
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   976
            method := ''.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   977
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   978
            selector keywords keysAndValuesDo:[:i :key|
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   979
                method := method, key, 'arg', i printString, ' '
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   980
            ]
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   981
        ]
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   982
    ].
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   983
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   984
    code := code ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   985
                method , args , '\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   986
                '    "automatically generated by UIPainter ..."\\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   987
                '    "*** the code below performs no action"\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   988
                '    "*** (except for some feedback on the Transcript)"\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   989
                '    "*** Please change as required and accept in the browser."\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   990
                '\' .
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   991
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   992
    alreadyInSuperclass ifTrue:[
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   993
        code := code ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   994
                    '    "action for ' , selector , ' is already provided in a superclass."\' ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   995
                    '    "It may be redefined here ..."\\'.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   996
    ] ifFalse:[
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   997
        code := code ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   998
                    '    "action to be added ..."\\'.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
   999
    ].
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1000
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1001
    code := code ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1002
                '    Transcript showCR:self class name, '': '.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1003
    alreadyInSuperclass ifTrue:[
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1004
        code := code , 'inherited '.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1005
    ].
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1006
    code := code , 'menu action for ' , selector , showIt.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1007
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1008
    alreadyInSuperclass ifTrue:[
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1009
        code := code ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1010
                        '    super ' , selector , args , '.\'.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1011
    ].
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1012
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1013
    code := code ,
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1014
                '!! !!\\'.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1015
    ^ code withCRs
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1016
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1017
    "Created: / 23.8.1998 / 16:46:51 / cg"
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1018
    "Modified: / 23.8.1998 / 18:13:05 / cg"
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1019
!
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1020
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1021
generateMenuMethods
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1022
    "generate menu methods
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1023
     - but do not overwrite existing ones.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1024
     Return a string ready to compile into the application class."
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1025
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1026
    |cls code skip menuSelector protoSpec thisCode
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1027
     definedMethodSelectors iVars t 
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1028
     specArray fullSpec winSpec menuSpec
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1029
     |
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1030
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1031
    className isNil ifTrue:[
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1032
        self warn:'Set first the class!!'.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1033
        ^ code
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1034
    ].
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1035
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1036
    (cls := self resolveName:className) isNil ifTrue:[
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1037
        self warn:'Class ', className asString, ' does not exist!!'.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1038
        ^ code
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1039
    ].
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1040
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1041
    specArray := treeView generateFullSpecForComponents:#().
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1042
    fullSpec := specArray decodeAsLiteralArray.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1043
    winSpec := fullSpec window.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1044
    menuSelector := winSpec menu.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1045
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1046
    menuSelector isNil ifTrue:[
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1047
        self warn:'No menu defined (yet)'.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1048
        ^ code
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1049
    ].
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1050
    (cls respondsTo:menuSelector) ifFalse:[
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1051
        self warn:'No menu defined (yet)'.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1052
        ^ code.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1053
    ].
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1054
    menuSpec := cls perform:menuSelector.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1055
    menuSpec := menuSpec decodeAsLiteralArray.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1056
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1057
    definedMethodSelectors := IdentitySet new.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1058
    code := ''.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1059
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1060
    menuSpec allItemsDo:[:item |
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1061
        |sel|
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1062
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1063
        (sel := item value) notNil ifTrue:[
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1064
            (definedMethodSelectors includes:sel) ifFalse:[
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1065
                self generateCodeFrom:(Array with:sel) in:cls do:[:aSel|
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1066
                    thisCode := (self generateMenuMethodFor:aSel inClass:cls).
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1067
                    code := code, thisCode.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1068
                ].
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1069
                definedMethodSelectors add:sel.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1070
            ].
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1071
        ]
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1072
    ].
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1073
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1074
    (definedMethodSelectors includes:#menuOpen) ifTrue:[
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1075
        self generateCodeFrom:(Array with:#doOpen:) in:cls do:[:aSel|
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1076
            thisCode := (self generateMenuMethodFor:aSel inClass:cls).
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1077
            code := code, thisCode.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1078
        ].
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1079
    ].
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1080
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1081
    ^ code
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1082
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1083
    "Created: / 23.8.1998 / 16:12:09 / cg"
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1084
    "Modified: / 23.8.1998 / 18:12:23 / cg"
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1085
!
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1086
188
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
  1087
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
  1088
    ^ ('!!' , targetClass name , ' methodsFor:''values''!!\\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
  1089
      aspect , '\' ,
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
  1090
      '    "automatically generated by UIPainter ..."\\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
  1091
      '    "*** the code below returns a default value when invoked."\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
  1092
      '    "*** (which may not be the one you wanted)"\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
  1093
      '    "*** Please change as required and accept in the browser."\' ,
188
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
  1094
      '\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
  1095
      '    "value to be added below ..."\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
  1096
      '    Transcript showCR:self class name , '': no value yet for ' , aspect , ' ...''.\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
  1097
      '\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
  1098
      '^ nil.' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
  1099
      '!! !!\\') withCRs
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
  1100
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
  1101
    "Modified: / 25.10.1997 / 19:22:17 / cg"
188
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
  1102
!
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
  1103
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1104
generateWindowSpecMethodSource
457
0b39d43d4324 care for exclas in spec-code
Claus Gittinger <cg@exept.de>
parents: 445
diff changeset
  1105
    |spec str code category cls mthd specCode|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1106
310
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
  1107
    spec := OrderedCollection new.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1108
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1109
    self subViews do:[:aView|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1110
        aView ~~ inputView ifTrue:[
310
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
  1111
            spec add:(self fullSpecFor:aView)
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1112
        ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1113
    ].
310
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
  1114
    spec := treeView generateFullSpecForComponents:spec.
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
  1115
    str  := WriteStream on:String new.
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
  1116
    UISpecification prettyPrintSpecArray:spec on:str indent:5.
464
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  1117
    specCode := str contents.
457
0b39d43d4324 care for exclas in spec-code
Claus Gittinger <cg@exept.de>
parents: 445
diff changeset
  1118
0b39d43d4324 care for exclas in spec-code
Claus Gittinger <cg@exept.de>
parents: 445
diff changeset
  1119
    (specCode includes:$!!) ifTrue:[
0b39d43d4324 care for exclas in spec-code
Claus Gittinger <cg@exept.de>
parents: 445
diff changeset
  1120
        "/ oops - must be chunk format ...
0b39d43d4324 care for exclas in spec-code
Claus Gittinger <cg@exept.de>
parents: 445
diff changeset
  1121
        str  := WriteStream on:String new.
0b39d43d4324 care for exclas in spec-code
Claus Gittinger <cg@exept.de>
parents: 445
diff changeset
  1122
        str nextPutAllAsChunk:specCode.
0b39d43d4324 care for exclas in spec-code
Claus Gittinger <cg@exept.de>
parents: 445
diff changeset
  1123
        specCode := str contents.
0b39d43d4324 care for exclas in spec-code
Claus Gittinger <cg@exept.de>
parents: 445
diff changeset
  1124
    ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1125
178
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
  1126
    "/ 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
  1127
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
  1128
    category := 'interface specs'.
330
ca
parents: 327
diff changeset
  1129
    cls := self resolveName:className.
ca
parents: 327
diff changeset
  1130
ca
parents: 327
diff changeset
  1131
    cls notNil ifTrue:[
178
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
  1132
        (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
  1133
            category := mthd category.
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
  1134
        ]
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
  1135
    ].
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
  1136
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
  1137
    code := '!!'
178
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
  1138
            , className , ' class methodsFor:' , category storeString
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
  1139
            , '!!' , '\\'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1140
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1141
            , methodName , '\'
742
688fd0a0b0fd code generation comment
tz
parents: 723
diff changeset
  1142
            , ((ResourceSpecEditor codeGenerationCommentForClass: UIPainter) replChar:$!! withString:'!!!!')
688fd0a0b0fd code generation comment
tz
parents: 723
diff changeset
  1143
            , '\\    "\'
1013
c6428ebd2f0d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1144
            , ('     UIPainter new openOnClass:' , className , ' andSelector:#' , methodName , '\').
c6428ebd2f0d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1145
c6428ebd2f0d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1146
    (cls isSubclassOf:ApplicationModel) ifTrue:[
c6428ebd2f0d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1147
        code := code
c6428ebd2f0d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1148
            , ('     ' , className , ' new openInterface:#' , methodName , '\').
c6428ebd2f0d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1149
    ].
c6428ebd2f0d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1150
c6428ebd2f0d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1151
    code := code
742
688fd0a0b0fd code generation comment
tz
parents: 723
diff changeset
  1152
            ,(methodName = 'windowSpec' 
688fd0a0b0fd code generation comment
tz
parents: 723
diff changeset
  1153
                ifTrue:['     ' , className , ' open\'] ifFalse: [''])
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1154
            , '    "\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1155
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1156
    code := code 
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1157
            , '\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1158
            , '    <resource: #canvas>\\'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1159
            , '    ^\' 
457
0b39d43d4324 care for exclas in spec-code
Claus Gittinger <cg@exept.de>
parents: 445
diff changeset
  1160
            , '     ', specCode
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1161
            , '\'
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
  1162
            , '!! !!'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1163
            , '\\'.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1164
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1165
    ^ code withCRs
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1166
1013
c6428ebd2f0d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1167
    "Modified: / 5.9.1995 / 21:01:35 / claus"
c6428ebd2f0d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1168
    "Modified: / 15.10.1998 / 11:29:53 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1169
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1170
754
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1171
!UIPainterView methodsFor:'grid manipulation'!
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1172
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1173
newGrid
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1174
    "define a new grid - this is a private helper which has to be
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1175
     called after any change in the grid. It (re)creates the gridPixmap,
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1176
     clears the view and redraws all visible objects."
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1177
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1178
    |defaultViewBackground|
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1179
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1180
    gridPixmap := nil.
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1181
    defaultViewBackground := self class defaultViewBackgroundColor.
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1182
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1183
    shown ifTrue:[
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1184
        self viewBackground: (defaultViewBackground isColor
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1185
            ifTrue: [defaultViewBackground]
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1186
            ifFalse:[Black]).
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1187
        self clear.
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1188
    ].
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1189
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1190
    gridShown ifTrue:[
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1191
        self defineGrid.
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1192
        gridPixmap colorMap: (defaultViewBackground isColor
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1193
            ifTrue: [Array with:defaultViewBackground with:Color darkGray]
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1194
            ifFalse:[Array with:White with:Black]).
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1195
        self viewBackground:gridPixmap.
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1196
    ].
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1197
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1198
    self invalidate
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1199
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1200
! !
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1201
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1202
!UIPainterView methodsFor:'initialization'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1203
770
96f106b0a61e set color on device
ca
parents: 768
diff changeset
  1204
create
96f106b0a61e set color on device
ca
parents: 768
diff changeset
  1205
    "colors on device
96f106b0a61e set color on device
ca
parents: 768
diff changeset
  1206
    "
96f106b0a61e set color on device
ca
parents: 768
diff changeset
  1207
    super create.
96f106b0a61e set color on device
ca
parents: 768
diff changeset
  1208
96f106b0a61e set color on device
ca
parents: 768
diff changeset
  1209
    handleColor       := handleColor on:device.
96f106b0a61e set color on device
ca
parents: 768
diff changeset
  1210
    handleMasterColor := handleMasterColor on:device.
96f106b0a61e set color on device
ca
parents: 768
diff changeset
  1211
!
96f106b0a61e set color on device
ca
parents: 768
diff changeset
  1212
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1213
initialize
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1214
    "setup attributes
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  1215
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1216
    super initialize.
770
96f106b0a61e set color on device
ca
parents: 768
diff changeset
  1217
    superclassName    := 'ApplicationModel'.
96f106b0a61e set color on device
ca
parents: 768
diff changeset
  1218
    className         := 'NewApplication'.
96f106b0a61e set color on device
ca
parents: 768
diff changeset
  1219
    methodName        := 'windowSpec'.
96f106b0a61e set color on device
ca
parents: 768
diff changeset
  1220
    categoryName      := 'Applications'.
96f106b0a61e set color on device
ca
parents: 768
diff changeset
  1221
    HandCursor        := Cursor leftHand.
96f106b0a61e set color on device
ca
parents: 768
diff changeset
  1222
    handleColor       := Color black.
96f106b0a61e set color on device
ca
parents: 768
diff changeset
  1223
    handleMasterColor := Color red.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1224
712
bf8aa59e82b6 user friendly names
tz
parents: 708
diff changeset
  1225
    self backgroundColor: self class defaultViewBackgroundColor.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1226
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1227
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1228
setupFromSpec:specOrSpecArray
784
9ae2b94658e5 wait cursor
tz
parents: 776
diff changeset
  1229
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  1230
    |spec builder|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1231
784
9ae2b94658e5 wait cursor
tz
parents: 776
diff changeset
  1232
    Cursor wait showWhile: [
9ae2b94658e5 wait cursor
tz
parents: 776
diff changeset
  1233
        self removeAll.
1029
240e51822e15 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1015
diff changeset
  1234
        specOrSpecArray notNil ifTrue:[
240e51822e15 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1015
diff changeset
  1235
            spec    := UISpecification from:specOrSpecArray.
240e51822e15 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1015
diff changeset
  1236
        ].
784
9ae2b94658e5 wait cursor
tz
parents: 776
diff changeset
  1237
        builder := UIBuilder new isEditing:true.
9ae2b94658e5 wait cursor
tz
parents: 776
diff changeset
  1238
        "set applicationClass, in order that subspecifications may be resolved"
9ae2b94658e5 wait cursor
tz
parents: 776
diff changeset
  1239
        className notNil ifTrue:[
9ae2b94658e5 wait cursor
tz
parents: 776
diff changeset
  1240
            builder applicationClass:(self resolveName:className).
9ae2b94658e5 wait cursor
tz
parents: 776
diff changeset
  1241
        ].
1029
240e51822e15 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1015
diff changeset
  1242
        spec notNil ifTrue:[
240e51822e15 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1015
diff changeset
  1243
            spec window setupView:self topView for:builder.
240e51822e15 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1015
diff changeset
  1244
            self addSpec:(spec component) builder:builder in:self.
240e51822e15 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1015
diff changeset
  1245
        ].
784
9ae2b94658e5 wait cursor
tz
parents: 776
diff changeset
  1246
        self realizeAllSubViews.
9ae2b94658e5 wait cursor
tz
parents: 776
diff changeset
  1247
        inputView raise.
1029
240e51822e15 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1015
diff changeset
  1248
        spec notNil ifTrue:[
240e51822e15 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1015
diff changeset
  1249
            treeView setAttributesFromWindowSpec:(spec window)
240e51822e15 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1015
diff changeset
  1250
        ]
784
9ae2b94658e5 wait cursor
tz
parents: 776
diff changeset
  1251
    ]
9ae2b94658e5 wait cursor
tz
parents: 776
diff changeset
  1252
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1253
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1254
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  1255
treeView:aTreeView
361
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
  1256
    treeView := aTreeView.
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
  1257
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
  1258
    treeView delegate:(
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1259
        "/
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1260
        "/ I want to handle everything typed
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1261
        "/ in the treeView, except for Return and Cursor-keys
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1262
        "/
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1263
        KeyboardForwarder 
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1264
            toView:self
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1265
            condition:nil
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1266
            filter:[:k | (k isSymbol 
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1267
                         and:[k ~~ #Return 
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1268
                         and:[(k startsWith:#Cursor) not]])
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1269
                   ]
361
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
  1270
    )
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
  1271
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1272
    "Modified: / 31.10.1997 / 20:22:09 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1273
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1274
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1275
!UIPainterView methodsFor:'menus'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1276
121
96d6feeeb049 middleButtonMen:
ca
parents: 119
diff changeset
  1277
showMiddleButtonMenu
96d6feeeb049 middleButtonMen:
ca
parents: 119