UIPainterView.st
author Claus Gittinger <cg@exept.de>
Sun, 08 Sep 2019 16:04:31 +0200
changeset 3759 24d2564ff378
parent 3575 a9fc2d3553f3
child 3802 908abf2676e7
permissions -rw-r--r--
#REFACTORING by exept class: DataSetBuilder changed: #generatePrintSelectorIn: (send #argumentCount instead of #numArgs) #generateReadSelectorIn: (send #argumentCount instead of #numArgs) #generateWriteSelectorIn: (send #argumentCount instead of #numArgs)
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
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
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
"
1387
65c9df9cb1ad change selection behaviour after delete
ca
parents: 1366
diff changeset
    12
"{ Package: 'stx:libtool2' }"
65c9df9cb1ad change selection behaviour after delete
ca
parents: 1366
diff changeset
    13
3223
38d493fcc782 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3136
diff changeset
    14
"{ NameSpace: Smalltalk }"
38d493fcc782 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3136
diff changeset
    15
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    16
UIObjectView subclass:#UIPainterView
278
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 238
diff changeset
    17
	instanceVariableNames:'treeView listHolder superclassName className methodName
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
    18
		categoryName handleColorBlack handleColorWhite handleMasterColor
2276
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
    19
		sketchPainter listOfAspectsHolder'
3097
766d2055ce4a class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3092
diff changeset
    20
	classVariableNames:'HandCursor RedefineAspectMethods AspectsAsInstances'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    21
	poolDictionaries:''
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    22
	category:'Interface-UIPainter'
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    23
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    24
211
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    25
Object subclass:#ViewProperty
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    26
	instanceVariableNames:'view spec identifier'
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    27
	classVariableNames:'Identifier'
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    28
	poolDictionaries:''
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    29
	privateIn:UIPainterView
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    30
!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
    31
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    32
!UIPainterView class methodsFor:'documentation'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    33
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    34
copyright
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    35
"
156
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
    36
 COPYRIGHT (c) 1995 by Claus Gittinger / eXept Software AG
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
    37
	      All Rights Reserved
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    38
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    39
 This software is furnished under a license and may be used
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    40
 only in accordance with the terms of that license and with the
742
688fd0a0b0fd code generation comment
tz
parents: 723
diff changeset
    41
 inclusion of the above copyright notice. This software may not
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    42
 be provided or otherwise made available to, or used by, any
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    43
 other person.  No title to or ownership of the software is
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    44
 hereby transferred.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    45
"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    46
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    47
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    48
documentation
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    49
"
128
9779b7459a1c selection and update from selection
ca
parents: 121
diff changeset
    50
    buildIn view used by the UIPainter; from this view, the layout of the
9779b7459a1c selection and update from selection
ca
parents: 121
diff changeset
    51
    new application derives from.
9779b7459a1c selection and update from selection
ca
parents: 121
diff changeset
    52
9779b7459a1c selection and update from selection
ca
parents: 121
diff changeset
    53
    [see also:]
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
    54
	UIBuilder
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
    55
	UIObjectView
156
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
    56
b332d7117c40 added copyrights
Claus Gittinger <cg@exept.de>
parents: 154
diff changeset
    57
    [author:]
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
    58
	Claus Gittinger
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
    59
	Claus Atzkern
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    60
"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    61
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
    62
1225
0aa39cc5f0a3 Initialize class vars.
Stefan Vogel <sv@exept.de>
parents: 1201
diff changeset
    63
!UIPainterView class methodsFor:'initialization'!
0aa39cc5f0a3 Initialize class vars.
Stefan Vogel <sv@exept.de>
parents: 1201
diff changeset
    64
0aa39cc5f0a3 Initialize class vars.
Stefan Vogel <sv@exept.de>
parents: 1201
diff changeset
    65
initialize
0aa39cc5f0a3 Initialize class vars.
Stefan Vogel <sv@exept.de>
parents: 1201
diff changeset
    66
1494
115ae5972b27 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1474
diff changeset
    67
    AspectsAsInstances := true. "/ false.
1225
0aa39cc5f0a3 Initialize class vars.
Stefan Vogel <sv@exept.de>
parents: 1201
diff changeset
    68
    RedefineAspectMethods := false.
0aa39cc5f0a3 Initialize class vars.
Stefan Vogel <sv@exept.de>
parents: 1201
diff changeset
    69
0aa39cc5f0a3 Initialize class vars.
Stefan Vogel <sv@exept.de>
parents: 1201
diff changeset
    70
    "Created: / 22.9.1999 / 12:32:31 / stefan"
0aa39cc5f0a3 Initialize class vars.
Stefan Vogel <sv@exept.de>
parents: 1201
diff changeset
    71
! !
0aa39cc5f0a3 Initialize class vars.
Stefan Vogel <sv@exept.de>
parents: 1201
diff changeset
    72
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    73
!UIPainterView class methodsFor:'code generation mode'!
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
    74
925
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    75
generateAspectsAsInstanceVariables
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    76
    "if on, aspects are held as instance variables;
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
    77
     if off (the default), they are kept in the bindings dictionary."
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
    78
925
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    79
    ^ AspectsAsInstances
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    80
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    81
    "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
    82
    "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
    83
!
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    84
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    85
generateAspectsAsInstanceVariables:aBoolean
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    86
    "if on, aspects are held as instance variables;
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
    87
     if off (the default), they are kept in the bindings dictionary."
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
    88
925
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    89
    AspectsAsInstances := aBoolean
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    90
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    91
    "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
    92
    "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
    93
!
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
    94
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
    95
generateCommentedCode
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
    96
    "comments in generated aspect methods; yes or no."
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
    97
2714
abaae556bec8 commentCode flags now in userPrefs
Claus Gittinger <cg@exept.de>
parents: 2627
diff changeset
    98
    ^ UserPreferences current generateComments
abaae556bec8 commentCode flags now in userPrefs
Claus Gittinger <cg@exept.de>
parents: 2627
diff changeset
    99
    and:[ UserPreferences current generateCommentsForAspectMethods ]
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   100
!
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   101
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   102
generateCommentedCode:aBoolean
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   103
    "comments in generated aspect methods; yes or no."
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   104
2716
ed0006640fb4 changed: #generateCommentedCode:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   105
    UserPreferences current generateComments ifFalse:[
ed0006640fb4 changed: #generateCommentedCode:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   106
        aBoolean ifTrue:[
ed0006640fb4 changed: #generateCommentedCode:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   107
            UserPreferences current generateComments:true
ed0006640fb4 changed: #generateCommentedCode:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   108
        ].
ed0006640fb4 changed: #generateCommentedCode:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   109
    ].
ed0006640fb4 changed: #generateCommentedCode:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   110
2714
abaae556bec8 commentCode flags now in userPrefs
Claus Gittinger <cg@exept.de>
parents: 2627
diff changeset
   111
    UserPreferences current 
2716
ed0006640fb4 changed: #generateCommentedCode:
Claus Gittinger <cg@exept.de>
parents: 2714
diff changeset
   112
        generateCommentsForAspectMethods:aBoolean.
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   113
!
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   114
742
688fd0a0b0fd code generation comment
tz
parents: 723
diff changeset
   115
redefineAspectMethods
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   116
    "redefine methods yes or no. 
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   117
     If a method is defined in super class should the message be reinstalled ?"
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   118
1225
0aa39cc5f0a3 Initialize class vars.
Stefan Vogel <sv@exept.de>
parents: 1201
diff changeset
   119
    ^ RedefineAspectMethods
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   120
1225
0aa39cc5f0a3 Initialize class vars.
Stefan Vogel <sv@exept.de>
parents: 1201
diff changeset
   121
    "Modified: / 22.9.1999 / 12:33:03 / stefan"
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   122
!
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   123
742
688fd0a0b0fd code generation comment
tz
parents: 723
diff changeset
   124
redefineAspectMethods:aBoolean
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   125
    "redefine methods yes or no.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   126
     If a method is defined in super class should the message be reinstalled ?"
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   127
742
688fd0a0b0fd code generation comment
tz
parents: 723
diff changeset
   128
    RedefineAspectMethods := aBoolean
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   129
! !
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   130
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   131
!UIPainterView class methodsFor:'defaults'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   132
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   133
defaultMenuMessage
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   134
    "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
   135
    "
121
96d6feeeb049 middleButtonMen:
ca
parents: 119
diff changeset
   136
    ^ #showMiddleButtonMenu
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   137
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   138
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   139
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   140
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   141
!UIPainterView methodsFor:'accessing'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   142
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   143
application
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   144
    ^ nil
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   145
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   146
    "Modified: 6.9.1995 / 00:46:44 / claus"
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   147
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   148
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   149
applicationName
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   150
    ^ self className
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   151
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   152
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   153
applicationName:aName
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   154
    self className:aName
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   155
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   156
1977
cf8a54d02ac0 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 1959
diff changeset
   157
class:aClass superclassName:aSuperclassName selector:aSelector
cf8a54d02ac0 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 1959
diff changeset
   158
    self assert:(aClass isBehavior).
cf8a54d02ac0 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 1959
diff changeset
   159
    className      := aClass name.
cf8a54d02ac0 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 1959
diff changeset
   160
    superclassName := aSuperclassName.
cf8a54d02ac0 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 1959
diff changeset
   161
    methodName     := aSelector.
cf8a54d02ac0 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 1959
diff changeset
   162
!
cf8a54d02ac0 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 1959
diff changeset
   163
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   164
className
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   165
    ^ className
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
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   168
className:aName
1977
cf8a54d02ac0 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 1959
diff changeset
   169
    self assert:(aName isString).
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   170
    className := aName
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   171
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   172
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   173
className:aClassName superclassName:aSuperclassName selector:aSelector
1977
cf8a54d02ac0 code cleanup & refactoring
Claus Gittinger <cg@exept.de>
parents: 1959
diff changeset
   174
    self assert:(aClassName isString).
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   175
    className      := aClassName.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   176
    superclassName := aSuperclassName.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   177
    methodName     := aSelector.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   178
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   179
2276
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
   180
listOfAspectsHolder:something
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
   181
    listOfAspectsHolder := something.
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
   182
!
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
   183
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   184
methodName
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   185
    ^ methodName
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   186
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   187
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   188
methodName:aName
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   189
    methodName := aName
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   190
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   191
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   192
selectNames:aStringOrCollection
1031
7ce4b97f2c43 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   193
    |prop coll s n newSel|
7ce4b97f2c43 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   194
7ce4b97f2c43 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   195
    (aStringOrCollection size == 0) ifTrue:[
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   196
	newSel := nil.
1031
7ce4b97f2c43 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   197
    ] ifFalse:[
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   198
	(s := aStringOrCollection) isString ifFalse:[
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   199
	    s size == 1 ifTrue:[
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   200
		s := s first
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   201
	    ] ifFalse:[
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   202
		coll := OrderedCollection new.
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   203
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   204
		s do:[:aName|
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   205
		    (prop := self propertyOfName:aName) notNil ifTrue:[
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   206
			coll add:(prop view)
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   207
		    ]
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   208
		].
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   209
		(n := coll size) == 1 ifTrue:[
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   210
		    newSel := coll at:1
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   211
		] ifFalse:[
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   212
		    n == 0 ifTrue:[
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   213
			newSel := nil
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   214
		    ] ifFalse:[
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   215
			newSel := coll
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   216
		    ]
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   217
		].
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   218
		^ self select:newSel.
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   219
	    ]
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   220
	].
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   221
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   222
	prop := self propertyOfName:s.
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   223
	prop isNil ifTrue:[
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   224
	    newSel := nil
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   225
	] ifFalse:[
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   226
	    newSel := prop view
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   227
	].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   228
    ].
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   229
1031
7ce4b97f2c43 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1030
diff changeset
   230
    ^ self select:newSel
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   231
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   232
111
ca
parents: 103
diff changeset
   233
!UIPainterView methodsFor:'change & update'!
ca
parents: 103
diff changeset
   234
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   235
layoutChanged
1445
d2654a3b1e3a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1441
diff changeset
   236
    treeView notNil ifTrue:[
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   237
	treeView layoutChanged
1445
d2654a3b1e3a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1441
diff changeset
   238
    ]
111
ca
parents: 103
diff changeset
   239
! !
ca
parents: 103
diff changeset
   240
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   241
!UIPainterView methodsFor:'copy & cut & paste'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   242
2221
8ac60d4545ad selection after paste
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   243
changeSelectionAfterPasteOf:sel
8ac60d4545ad selection after paste
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   244
    sel notNil ifTrue:[
8ac60d4545ad selection after paste
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   245
        self select:sel.
8ac60d4545ad selection after paste
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   246
    ].
8ac60d4545ad selection after paste
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   247
!
8ac60d4545ad selection after paste
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   248
1744
c59a91953b64 paste with no container selected: search for a good one
Claus Gittinger <cg@exept.de>
parents: 1733
diff changeset
   249
commonContainerOf:someComponents
c59a91953b64 paste with no container selected: search for a good one
Claus Gittinger <cg@exept.de>
parents: 1733
diff changeset
   250
    |container|
c59a91953b64 paste with no container selected: search for a good one
Claus Gittinger <cg@exept.de>
parents: 1733
diff changeset
   251
c59a91953b64 paste with no container selected: search for a good one
Claus Gittinger <cg@exept.de>
parents: 1733
diff changeset
   252
    container := someComponents first container.
c59a91953b64 paste with no container selected: search for a good one
Claus Gittinger <cg@exept.de>
parents: 1733
diff changeset
   253
    [container notNil
c59a91953b64 paste with no container selected: search for a good one
Claus Gittinger <cg@exept.de>
parents: 1733
diff changeset
   254
     and:[ (someComponents conform:[:eachComponent | eachComponent isComponentOf:container]) not]]
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   255
	whileTrue:[
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   256
	container := container container.
1744
c59a91953b64 paste with no container selected: search for a good one
Claus Gittinger <cg@exept.de>
parents: 1733
diff changeset
   257
    ].
c59a91953b64 paste with no container selected: search for a good one
Claus Gittinger <cg@exept.de>
parents: 1733
diff changeset
   258
    ^ container
c59a91953b64 paste with no container selected: search for a good one
Claus Gittinger <cg@exept.de>
parents: 1733
diff changeset
   259
!
c59a91953b64 paste with no container selected: search for a good one
Claus Gittinger <cg@exept.de>
parents: 1733
diff changeset
   260
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   261
copySelection
1959
fd6bf76e712a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1954
diff changeset
   262
    "copy the selection into the cut & paste-buffer"
fd6bf76e712a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1954
diff changeset
   263
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   264
    |specs coll|
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   265
2257
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
   266
    coll := self minClosedViewSetFor:(self selection).
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   267
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   268
    coll notNil ifTrue:[
776
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   269
"/        self select:nil.
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   270
        specs := coll collect:[:eachView | self fullSpecWithAbsolutePositionFor:eachView].
1870
771fcc38ecb8 set selection interface changed
ca
parents: 1869
diff changeset
   271
        self setClipboardObject:specs.
776
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   272
"/        treeView selection: sel
60
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
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   275
723
60e8ffac2f38 #deleteSelection in #deleteTotalSelection renamed
tz
parents: 712
diff changeset
   276
deleteSelection
1959
fd6bf76e712a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1954
diff changeset
   277
    "delete the selection buffered"
fd6bf76e712a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1954
diff changeset
   278
887
79a6e12e1d0f after deleting a widget do select the neighbour then the parent (step 2)
tz
parents: 886
diff changeset
   279
    self deleteSelectionBuffered: true
79a6e12e1d0f after deleting a widget do select the neighbour then the parent (step 2)
tz
parents: 886
diff changeset
   280
!
79a6e12e1d0f after deleting a widget do select the neighbour then the parent (step 2)
tz
parents: 886
diff changeset
   281
2396
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   282
deleteSelectionBuffered:buffered
2257
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
   283
    "cut the selection. If buffered is true, place it into the cut&paste-buffer"
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
   284
2396
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   285
    |specs viewsToRemove newSelection firstView|
71
407d25aca670 checkin from browser
ca
parents: 69
diff changeset
   286
1621
112670159075 cg: check if selection change is allowed BEFORE changing the
tm
parents: 1574
diff changeset
   287
    treeView askForSelectionChangeAllowed ifFalse:[^ self].
112670159075 cg: check if selection change is allowed BEFORE changing the
tm
parents: 1574
diff changeset
   288
2396
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   289
    viewsToRemove := self minClosedViewSetFor:(self selection).
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   290
    viewsToRemove isEmptyOrNil ifTrue:[ ^ self].
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   291
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   292
    buffered ifTrue:[
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   293
        specs := viewsToRemove collect:[:aView| self fullSpecWithAbsolutePositionFor:aView ].
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   294
        self setClipboardObject:specs
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   295
    ].
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   296
    firstView    := viewsToRemove first.
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   297
    newSelection := self findContainerOfView:firstView.
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   298
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   299
    newSelection isNil ifTrue:[
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   300
        newSelection := self.
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   301
    ] ifFalse:[
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   302
        viewsToRemove size == 1 ifTrue:[
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   303
            |subviews index|
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   304
2508
d9dc378aaf8d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
   305
            "/ newSelection components notEmptyOrNil ifTrue:[ self halt ].
2396
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   306
            subviews := newSelection subViews.
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   307
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   308
            subviews size > 1 ifTrue:[
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   309
                index := subviews findFirst:[:eachView| eachView isSameOrComponentOf:firstView ].
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   310
                index > 0 ifTrue:[
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   311
                    newSelection := subviews
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   312
                            at:(index + 1)
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   313
                            ifAbsent:[subviews at:index -1].
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   314
                ].
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   315
            ].
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   316
        ].
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   317
    ].
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   318
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   319
    self withSelectionHiddenDo:[
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   320
        self select:newSelection.
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   321
2257
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
   322
        treeView canvasEventsDisabledDo:[
2396
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   323
            self withinTransaction:#cut objects:viewsToRemove do:[
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   324
                viewsToRemove reverseDo:[:aView|
1870
771fcc38ecb8 set selection interface changed
ca
parents: 1869
diff changeset
   325
                    self createUndoRemove:aView.
771fcc38ecb8 set selection interface changed
ca
parents: 1869
diff changeset
   326
                    self remove:aView.
771fcc38ecb8 set selection interface changed
ca
parents: 1869
diff changeset
   327
                ]
771fcc38ecb8 set selection interface changed
ca
parents: 1869
diff changeset
   328
            ].
2396
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   329
        ].
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   330
        self windowGroup processRealExposeEvents.
042e31fded4f *** empty log message ***
ca
parents: 2395
diff changeset
   331
    ].
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   332
!
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
   333
723
60e8ffac2f38 #deleteSelection in #deleteTotalSelection renamed
tz
parents: 712
diff changeset
   334
deleteTotalSelection
1959
fd6bf76e712a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1954
diff changeset
   335
    "delete the selection"
fd6bf76e712a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1954
diff changeset
   336
887
79a6e12e1d0f after deleting a widget do select the neighbour then the parent (step 2)
tz
parents: 886
diff changeset
   337
    self deleteSelectionBuffered: false
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   338
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   339
1832
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
   340
getSelectedViewsAndSpecs
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
   341
    "return an array filed with selected views and corresponding specs.
1959
fd6bf76e712a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1954
diff changeset
   342
     Nil if there is none."
fd6bf76e712a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1954
diff changeset
   343
1832
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
   344
    |specs coll sel|
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
   345
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
   346
    sel := treeView selection.
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
   347
2257
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
   348
    coll := self minClosedViewSetFor:(self selection).
1832
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
   349
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
   350
    coll isNil ifTrue:[^ nil].
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
   351
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
   352
    specs := coll collect:[:aView| self fullSpecFor:aView ].
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
   353
    ^ Array with: coll with: specs
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
   354
!
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
   355
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   356
pasteBuffer
2311
67811bdeb0f5 Support sorting of items in tree
Stefan Vogel <sv@exept.de>
parents: 2295
diff changeset
   357
    "add the objects in the paste-buffer to the object view; 
67811bdeb0f5 Support sorting of items in tree
Stefan Vogel <sv@exept.de>
parents: 2295
diff changeset
   358
     don't change the layout if more than a single item has been selected"
67811bdeb0f5 Support sorting of items in tree
Stefan Vogel <sv@exept.de>
parents: 2295
diff changeset
   359
67811bdeb0f5 Support sorting of items in tree
Stefan Vogel <sv@exept.de>
parents: 2295
diff changeset
   360
    |sel clipboard|
67811bdeb0f5 Support sorting of items in tree
Stefan Vogel <sv@exept.de>
parents: 2295
diff changeset
   361
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   362
    self enabled ifFalse:[
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   363
        Dialog warn:'Operation currently disabled (In geometry test mode)'.
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   364
        ^ self
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   365
    ]. 
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   366
2311
67811bdeb0f5 Support sorting of items in tree
Stefan Vogel <sv@exept.de>
parents: 2295
diff changeset
   367
    clipboard := self getClipboardObject.
2951
c2b24bf7b967 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 2853
diff changeset
   368
    clipboard isString ifTrue:[
c2b24bf7b967 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 2853
diff changeset
   369
        Dialog warn:'can only paste widgets here'.
c2b24bf7b967 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 2853
diff changeset
   370
    ] ifFalse:[
c2b24bf7b967 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 2853
diff changeset
   371
        sel := self pasteSpecifications:clipboard keepLayout:true "(clipboard size > 1)".
c2b24bf7b967 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 2853
diff changeset
   372
        self changeSelectionAfterPasteOf:sel.
c2b24bf7b967 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 2853
diff changeset
   373
    ].
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   374
!
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   375
1338
3c1a528c50db added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
   376
pasteKeepingPosition
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   377
    "add the objects in the paste-buffer to the object view;
1338
3c1a528c50db added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
   378
     translate the layout as appropriate, to position the component
1959
fd6bf76e712a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1954
diff changeset
   379
     at the same absolute position (relative to topView) as before"
fd6bf76e712a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1954
diff changeset
   380
1338
3c1a528c50db added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
   381
    |sel|
3c1a528c50db added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
   382
3c1a528c50db added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
   383
    sel := self
1872
ab5cc43b193a get selection interface changed
ca
parents: 1870
diff changeset
   384
        pasteSpecifications:(self getClipboardObject)
ab5cc43b193a get selection interface changed
ca
parents: 1870
diff changeset
   385
        keepLayout:true
ab5cc43b193a get selection interface changed
ca
parents: 1870
diff changeset
   386
        keepPosition:true
3055
db492f86c9b1 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3038
diff changeset
   387
        at:#keep.
1338
3c1a528c50db added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
   388
2221
8ac60d4545ad selection after paste
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   389
    self changeSelectionAfterPasteOf:sel.
1338
3c1a528c50db added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
   390
!
3c1a528c50db added paste-keeping-absolute-position function
Claus Gittinger <cg@exept.de>
parents: 1308
diff changeset
   391
2395
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   392
pasteSpecifications:aSpecificationOrList into:aContainerOrNil beforeIndex:anIndexOrNil keepLayout:keepLayout keepPosition:keepPosition at:aPointOrNilOrKeep
2537
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
   393
    "add the specs to the object view; 
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
   394
     if given a collection of specs, returns a list of pasted widgets;
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
   395
     if given a single spec, returns that view (sigh - a stupid bw-compatibility kludge)"
2257
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
   396
2494
43400c4e5196 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2483
diff changeset
   397
    |sensor specsToPaste pasteOffset builder newSel 
2560
efad0ef440c7 oops - need repairDamage for shown to be set (under unix; it used to
Michael Beyl <mb@exept.de>
parents: 2537
diff changeset
   398
     bounds containerToPasteInto pastePoint beforeIndex count|
1621
112670159075 cg: check if selection change is allowed BEFORE changing the
tm
parents: 1574
diff changeset
   399
112670159075 cg: check if selection change is allowed BEFORE changing the
tm
parents: 1574
diff changeset
   400
    treeView askForSelectionChangeAllowed ifFalse:[^ nil].
112670159075 cg: check if selection change is allowed BEFORE changing the
tm
parents: 1574
diff changeset
   401
2494
43400c4e5196 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2483
diff changeset
   402
    sensor := self window sensor.
43400c4e5196 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2483
diff changeset
   403
2387
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   404
    containerToPasteInto := aContainerOrNil.
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   405
2366
Claus Gittinger <cg@exept.de>
parents: 2362
diff changeset
   406
    (aPointOrNilOrKeep == #keep
2494
43400c4e5196 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2483
diff changeset
   407
    or:[ sensor shiftDown
43400c4e5196 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2483
diff changeset
   408
    or:[ sensor ctrlDown ]]) ifTrue:[
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   409
        "/ paste into the selection
2387
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   410
        containerToPasteInto isNil ifTrue:[
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   411
            containerToPasteInto := self singleSelection.
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   412
        ].
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   413
    ] ifFalse:[
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   414
        "/ ignore the selection and paste where we drop!!
2366
Claus Gittinger <cg@exept.de>
parents: 2362
diff changeset
   415
        pastePoint := aPointOrNilOrKeep.
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   416
        pastePoint isNil ifTrue:[
3262
3168fe296011 device access
Claus Gittinger <cg@exept.de>
parents: 3249
diff changeset
   417
            pastePoint := device 
2494
43400c4e5196 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2483
diff changeset
   418
                                translatePoint:(sensor mousePoint)
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   419
                                fromView:nil
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   420
                                toView:self.
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   421
        ].
2387
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   422
        containerToPasteInto isNil ifTrue:[
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   423
            containerToPasteInto := self findObjectAt:pastePoint.
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   424
        ].
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   425
    ].
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   426
1744
c59a91953b64 paste with no container selected: search for a good one
Claus Gittinger <cg@exept.de>
parents: 1733
diff changeset
   427
    containerToPasteInto isNil ifTrue:[
1878
6ae0cf83738f Use #setClipboardText: instead of obsolete #setTextSelection:
Stefan Vogel <sv@exept.de>
parents: 1872
diff changeset
   428
        self selection size > 0 ifTrue:[
6ae0cf83738f Use #setClipboardText: instead of obsolete #setTextSelection:
Stefan Vogel <sv@exept.de>
parents: 1872
diff changeset
   429
            containerToPasteInto := self commonContainerOf:self selection
6ae0cf83738f Use #setClipboardText: instead of obsolete #setTextSelection:
Stefan Vogel <sv@exept.de>
parents: 1872
diff changeset
   430
        ] ifFalse:[
6ae0cf83738f Use #setClipboardText: instead of obsolete #setTextSelection:
Stefan Vogel <sv@exept.de>
parents: 1872
diff changeset
   431
            containerToPasteInto := self
6ae0cf83738f Use #setClipboardText: instead of obsolete #setTextSelection:
Stefan Vogel <sv@exept.de>
parents: 1872
diff changeset
   432
        ].
2221
8ac60d4545ad selection after paste
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   433
"/        self selection:containerToPasteInto.
1744
c59a91953b64 paste with no container selected: search for a good one
Claus Gittinger <cg@exept.de>
parents: 1733
diff changeset
   434
    ].
c59a91953b64 paste with no container selected: search for a good one
Claus Gittinger <cg@exept.de>
parents: 1733
diff changeset
   435
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   436
    "/ search up parent list for something we can paste into
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   437
    [containerToPasteInto notNil and:[(self canPasteInto:containerToPasteInto) not]] whileTrue:[
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   438
        containerToPasteInto == self ifTrue:[
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   439
            containerToPasteInto := nil
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   440
        ] ifFalse:[
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   441
            containerToPasteInto := containerToPasteInto container.
1878
6ae0cf83738f Use #setClipboardText: instead of obsolete #setTextSelection:
Stefan Vogel <sv@exept.de>
parents: 1872
diff changeset
   442
        ].
1621
112670159075 cg: check if selection change is allowed BEFORE changing the
tm
parents: 1574
diff changeset
   443
    ].
1752
78d47dc11501 oops - dropping specs
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
   444
    containerToPasteInto isNil ifTrue:[
1878
6ae0cf83738f Use #setClipboardText: instead of obsolete #setTextSelection:
Stefan Vogel <sv@exept.de>
parents: 1872
diff changeset
   445
        containerToPasteInto := self
1752
78d47dc11501 oops - dropping specs
Claus Gittinger <cg@exept.de>
parents: 1746
diff changeset
   446
    ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   447
2221
8ac60d4545ad selection after paste
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   448
    (self canPaste:aSpecificationOrList into:containerToPasteInto)
8ac60d4545ad selection after paste
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   449
    ifFalse:[
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   450
        self enabled ifTrue:[
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   451
            Dialog warn:'Cannot paste into selected component (not a container ?)'.
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   452
        ] ifFalse:[
2951
c2b24bf7b967 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 2853
diff changeset
   453
            Dialog warn:'Operation currently disabled (In geometry test mode)'.
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   454
        ]. 
1878
6ae0cf83738f Use #setClipboardText: instead of obsolete #setTextSelection:
Stefan Vogel <sv@exept.de>
parents: 1872
diff changeset
   455
        ^ nil
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   456
    ].
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   457
2537
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
   458
    self hideSelection.
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
   459
776
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   460
    aSpecificationOrList isCollection ifTrue:[
2257
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
   461
        specsToPaste := aSpecificationOrList
776
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   462
    ] ifFalse:[
2257
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
   463
        specsToPaste := Array with:aSpecificationOrList
776
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   464
    ].
2221
8ac60d4545ad selection after paste
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   465
"/    self setClipboardObject:nil.
776
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   466
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   467
    newSel  := OrderedCollection new.
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   468
    builder := UIBuilder new isEditing:true.
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   469
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   470
    className notNil ifTrue:[
1878
6ae0cf83738f Use #setClipboardText: instead of obsolete #setTextSelection:
Stefan Vogel <sv@exept.de>
parents: 1872
diff changeset
   471
        builder applicationClass:(self resolveName:className)
776
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   472
    ].
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   473
    bounds := Rectangle origin:0@0 extent:(containerToPasteInto bounds extent).
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   474
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   475
    pasteOffset := 0.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   476
2395
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   477
    (anIndexOrNil notNil and:[anIndexOrNil > 0]) ifTrue:[
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   478
        beforeIndex := anIndexOrNil.
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   479
    ].
2257
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
   480
    specsToPaste do:[:eachSpec|
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   481
        |view newOrigin uiPainterAttributes thisAbsOrigin|
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   482
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   483
        uiPainterAttributes := eachSpec otherAttributeAt:#uiPainterAttributes.
2388
17bbaf777e08 *** empty log message ***
sr
parents: 2387
diff changeset
   484
        eachSpec otherAttributeAt:#uiPainterAttributes put:nil.
1878
6ae0cf83738f Use #setClipboardText: instead of obsolete #setTextSelection:
Stefan Vogel <sv@exept.de>
parents: 1872
diff changeset
   485
2395
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   486
        view := self addSpec:eachSpec builder:builder in:containerToPasteInto beforeIndex:beforeIndex.
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   487
        beforeIndex notNil ifTrue:[
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   488
            beforeIndex := beforeIndex + 1
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   489
        ].
3575
a9fc2d3553f3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3557
diff changeset
   490
a9fc2d3553f3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3557
diff changeset
   491
        containerToPasteInto isLayoutWrapper ifTrue:[
a9fc2d3553f3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3557
diff changeset
   492
            eachSpec layout:(#extent->view extent)
a9fc2d3553f3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3557
diff changeset
   493
        ].
a9fc2d3553f3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3557
diff changeset
   494
        
3244
6b83ffb461b5 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
   495
        (keepLayout or:[eachSpec keepUILayout]) ifTrue:[
3249
Claus Gittinger <cg@exept.de>
parents: 3244
diff changeset
   496
            eachSpec layout isAssociation ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 3244
diff changeset
   497
                eachSpec layout key == #extent ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 3244
diff changeset
   498
                    view pixelExtent:eachSpec layout value
Claus Gittinger <cg@exept.de>
parents: 3244
diff changeset
   499
                ] ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 3244
diff changeset
   500
                    "/ self halt.
Claus Gittinger <cg@exept.de>
parents: 3244
diff changeset
   501
                    view geometryLayout:eachSpec layout value
Claus Gittinger <cg@exept.de>
parents: 3244
diff changeset
   502
                ].
Claus Gittinger <cg@exept.de>
parents: 3244
diff changeset
   503
            ] ifFalse:[    
Claus Gittinger <cg@exept.de>
parents: 3244
diff changeset
   504
                view geometryLayout:eachSpec layout.
Claus Gittinger <cg@exept.de>
parents: 3244
diff changeset
   505
            ]
3129
9a90a9d52bc6 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3097
diff changeset
   506
        ] ifFalse:[
9a90a9d52bc6 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3097
diff changeset
   507
            (keepPosition and:[ uiPainterAttributes notNil ]) ifTrue:[
9a90a9d52bc6 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3097
diff changeset
   508
                aPointOrNilOrKeep == #keep ifTrue:[
9a90a9d52bc6 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3097
diff changeset
   509
                    newOrigin := uiPainterAttributes at:#origin.
9a90a9d52bc6 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3097
diff changeset
   510
                ] ifFalse:[
9a90a9d52bc6 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3097
diff changeset
   511
                    thisAbsOrigin := uiPainterAttributes at:#absOrigin.
9a90a9d52bc6 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3097
diff changeset
   512
3262
3168fe296011 device access
Claus Gittinger <cg@exept.de>
parents: 3249
diff changeset
   513
                    newOrigin := device 
3129
9a90a9d52bc6 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3097
diff changeset
   514
                                        translatePoint:thisAbsOrigin
9a90a9d52bc6 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3097
diff changeset
   515
                                        fromView:self
9a90a9d52bc6 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3097
diff changeset
   516
                                        toView:containerToPasteInto.
9a90a9d52bc6 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3097
diff changeset
   517
                ].
2386
4471bede7939 bugfix - copy & paste with layout
ca
parents: 2376
diff changeset
   518
            ] ifFalse:[
3129
9a90a9d52bc6 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3097
diff changeset
   519
                pastePoint isNil ifTrue:[ pastePoint := 0@0 ].
3262
3168fe296011 device access
Claus Gittinger <cg@exept.de>
parents: 3249
diff changeset
   520
                newOrigin := device 
3502
88523ed65628 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3474
diff changeset
   521
                                    translatePoint:pastePoint asPoint
2386
4471bede7939 bugfix - copy & paste with layout
ca
parents: 2376
diff changeset
   522
                                    fromView:self
4471bede7939 bugfix - copy & paste with layout
ca
parents: 2376
diff changeset
   523
                                    toView:containerToPasteInto.
4471bede7939 bugfix - copy & paste with layout
ca
parents: 2376
diff changeset
   524
            ].
3129
9a90a9d52bc6 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3097
diff changeset
   525
9a90a9d52bc6 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3097
diff changeset
   526
            (bounds containsPoint:newOrigin) ifFalse:[
9a90a9d52bc6 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3097
diff changeset
   527
                newOrigin := pasteOffset asPoint.
9a90a9d52bc6 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3097
diff changeset
   528
                pasteOffset := pasteOffset + 4.
9a90a9d52bc6 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3097
diff changeset
   529
            ].
9a90a9d52bc6 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3097
diff changeset
   530
            newOrigin notNil ifTrue:[
9a90a9d52bc6 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3097
diff changeset
   531
                self moveObject:view to:newOrigin.
9a90a9d52bc6 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3097
diff changeset
   532
            ].
1878
6ae0cf83738f Use #setClipboardText: instead of obsolete #setTextSelection:
Stefan Vogel <sv@exept.de>
parents: 1872
diff changeset
   533
        ].
2395
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   534
        view realized ifFalse:[
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   535
            view realize.
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   536
        ].
1878
6ae0cf83738f Use #setClipboardText: instead of obsolete #setTextSelection:
Stefan Vogel <sv@exept.de>
parents: 1872
diff changeset
   537
        newSel add:view.
776
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   538
    ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   539
2537
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
   540
    self 
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
   541
        withinTransaction:#paste 
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
   542
        objects:newSel 
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
   543
        do:[
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
   544
            undoHistory 
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
   545
                addUndoSelector:#undoCreate:
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
   546
                withArgs:(newSel collect:[:v| (self propertyOfView:v) identifier]).
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
   547
            self undoHistoryChanged.
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
   548
        ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   549
776
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   550
    self realizeAllSubViews.
2395
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   551
    "/ newSel do:[:v| v raise].
1744
c59a91953b64 paste with no container selected: search for a good one
Claus Gittinger <cg@exept.de>
parents: 1733
diff changeset
   552
    self elementChangedSize:containerToPasteInto.
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
   553
2818
6d5a0ea87cb7 changed: #pasteSpecifications:into:beforeIndex:keepLayout:keepPosition:at:
Claus Gittinger <cg@exept.de>
parents: 2716
diff changeset
   554
    "/ nil wg if embedded in a browser
6d5a0ea87cb7 changed: #pasteSpecifications:into:beforeIndex:keepLayout:keepPosition:at:
Claus Gittinger <cg@exept.de>
parents: 2716
diff changeset
   555
    self windowGroup notNil ifTrue:[
6d5a0ea87cb7 changed: #pasteSpecifications:into:beforeIndex:keepLayout:keepPosition:at:
Claus Gittinger <cg@exept.de>
parents: 2716
diff changeset
   556
        "/ because the new-created view will destroy the handles, when it redraws itself,
6d5a0ea87cb7 changed: #pasteSpecifications:into:beforeIndex:keepLayout:keepPosition:at:
Claus Gittinger <cg@exept.de>
parents: 2716
diff changeset
   557
        "/ give it a chance to do so, before we return. (bail out after half a second, in case of trouble)
6d5a0ea87cb7 changed: #pasteSpecifications:into:beforeIndex:keepLayout:keepPosition:at:
Claus Gittinger <cg@exept.de>
parents: 2716
diff changeset
   558
        count := 0.
6d5a0ea87cb7 changed: #pasteSpecifications:into:beforeIndex:keepLayout:keepPosition:at:
Claus Gittinger <cg@exept.de>
parents: 2716
diff changeset
   559
        [ (newSel conform:[:v | v shown]) or:[count > 50] ] whileFalse:[
6d5a0ea87cb7 changed: #pasteSpecifications:into:beforeIndex:keepLayout:keepPosition:at:
Claus Gittinger <cg@exept.de>
parents: 2716
diff changeset
   560
            self windowGroup repairDamage.
6d5a0ea87cb7 changed: #pasteSpecifications:into:beforeIndex:keepLayout:keepPosition:at:
Claus Gittinger <cg@exept.de>
parents: 2716
diff changeset
   561
            Delay waitForSeconds:0.01.
6d5a0ea87cb7 changed: #pasteSpecifications:into:beforeIndex:keepLayout:keepPosition:at:
Claus Gittinger <cg@exept.de>
parents: 2716
diff changeset
   562
            count := count+1.
6d5a0ea87cb7 changed: #pasteSpecifications:into:beforeIndex:keepLayout:keepPosition:at:
Claus Gittinger <cg@exept.de>
parents: 2716
diff changeset
   563
        ].
6d5a0ea87cb7 changed: #pasteSpecifications:into:beforeIndex:keepLayout:keepPosition:at:
Claus Gittinger <cg@exept.de>
parents: 2716
diff changeset
   564
        Delay waitForSeconds:0.01.
2560
efad0ef440c7 oops - need repairDamage for shown to be set (under unix; it used to
Michael Beyl <mb@exept.de>
parents: 2537
diff changeset
   565
        self windowGroup repairDamage.
2537
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
   566
    ].
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
   567
776
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
   568
    newSel size == 1 ifTrue:[newSel := newSel at:1].
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   569
    ^ newSel
1500
36c0b4b268b8 use new translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
   570
3502
88523ed65628 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3474
diff changeset
   571
    "Modified: / 16-11-2017 / 23:49:56 / cg"
3575
a9fc2d3553f3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3557
diff changeset
   572
    "Modified: / 18-07-2018 / 09:15:44 / Claus Gittinger"
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   573
!
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   574
3055
db492f86c9b1 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3038
diff changeset
   575
pasteSpecifications:aSpecificationOrList into:aContainerOrNil keepLayout:keepLayout keepPosition:keepPosition at:aPointOrNilOrKeep 
2395
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   576
    "add the specs to the object view; returns list of pasted widgets"
3055
db492f86c9b1 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3038
diff changeset
   577
    
db492f86c9b1 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3038
diff changeset
   578
    ^ self 
db492f86c9b1 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3038
diff changeset
   579
        pasteSpecifications:aSpecificationOrList
db492f86c9b1 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3038
diff changeset
   580
        into:aContainerOrNil
db492f86c9b1 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3038
diff changeset
   581
        beforeIndex:nil
db492f86c9b1 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3038
diff changeset
   582
        keepLayout:keepLayout
db492f86c9b1 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3038
diff changeset
   583
        keepPosition:keepPosition
db492f86c9b1 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3038
diff changeset
   584
        at:aPointOrNilOrKeep
2395
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   585
!
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   586
2387
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   587
pasteSpecifications:aSpecificationOrList keepLayout:keepLayout
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   588
    "add the specs to the object view; returns list of pasted widgets"
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   589
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   590
    ^ self
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   591
        pasteSpecifications:aSpecificationOrList
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   592
        keepLayout:keepLayout
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   593
        keepPosition:true
2627
07d40cde2ac9 changed: #pasteSpecifications:keepLayout:
Claus Gittinger <cg@exept.de>
parents: 2583
diff changeset
   594
        at:#keep "/ nil
2387
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   595
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   596
    "Modified: 11.8.1997 / 01:00:35 / cg"
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   597
!
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   598
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   599
pasteSpecifications:aSpecificationOrList keepLayout:keepLayout at:aPointOrNil
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   600
    "add the specs to the object view; returns list of pasted widgets"
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   601
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   602
    ^ self
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   603
        pasteSpecifications:aSpecificationOrList
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   604
        keepLayout:keepLayout
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   605
        keepPosition:true
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   606
        at:aPointOrNil
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   607
!
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   608
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   609
pasteSpecifications:aSpecificationOrList keepLayout:keepLayout keepPosition:keepPosition at:aPointOrNilOrKeep
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   610
    "add the specs to the object view; returns list of pasted widgets"
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   611
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   612
    ^ self pasteSpecifications:aSpecificationOrList
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   613
        into:nil
2395
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   614
        beforeIndex:nil
2387
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   615
        keepLayout:keepLayout
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   616
        keepPosition:keepPosition
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   617
        at:aPointOrNilOrKeep
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   618
!
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   619
2315
c301d0caf97b changed #pasteWithLayout
Stefan Vogel <sv@exept.de>
parents: 2312
diff changeset
   620
pasteWithLayout
2369
Claus Gittinger <cg@exept.de>
parents: 2367
diff changeset
   621
    "add the objects in the paste-buffer to the object view - keep the old layout"
2315
c301d0caf97b changed #pasteWithLayout
Stefan Vogel <sv@exept.de>
parents: 2312
diff changeset
   622
c301d0caf97b changed #pasteWithLayout
Stefan Vogel <sv@exept.de>
parents: 2312
diff changeset
   623
    |sel|
c301d0caf97b changed #pasteWithLayout
Stefan Vogel <sv@exept.de>
parents: 2312
diff changeset
   624
2366
Claus Gittinger <cg@exept.de>
parents: 2362
diff changeset
   625
    sel := self 
Claus Gittinger <cg@exept.de>
parents: 2362
diff changeset
   626
            pasteSpecifications:(self getClipboardObject)
Claus Gittinger <cg@exept.de>
parents: 2362
diff changeset
   627
            keepLayout:true
Claus Gittinger <cg@exept.de>
parents: 2362
diff changeset
   628
            keepPosition:true
Claus Gittinger <cg@exept.de>
parents: 2362
diff changeset
   629
            at:#keep.
2315
c301d0caf97b changed #pasteWithLayout
Stefan Vogel <sv@exept.de>
parents: 2312
diff changeset
   630
    self changeSelectionAfterPasteOf:sel.
c301d0caf97b changed #pasteWithLayout
Stefan Vogel <sv@exept.de>
parents: 2312
diff changeset
   631
!
c301d0caf97b changed #pasteWithLayout
Stefan Vogel <sv@exept.de>
parents: 2312
diff changeset
   632
2311
67811bdeb0f5 Support sorting of items in tree
Stefan Vogel <sv@exept.de>
parents: 2295
diff changeset
   633
pasteWithoutLayout
2369
Claus Gittinger <cg@exept.de>
parents: 2367
diff changeset
   634
    "add the objects in the paste-buffer to the object view - do not keep the old layout"
1959
fd6bf76e712a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1954
diff changeset
   635
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   636
    |sel|
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   637
2367
6684f50b22cd changed #pasteWithoutLayout
Claus Gittinger <cg@exept.de>
parents: 2366
diff changeset
   638
    sel := self 
6684f50b22cd changed #pasteWithoutLayout
Claus Gittinger <cg@exept.de>
parents: 2366
diff changeset
   639
            pasteSpecifications:(self getClipboardObject)
6684f50b22cd changed #pasteWithoutLayout
Claus Gittinger <cg@exept.de>
parents: 2366
diff changeset
   640
            keepLayout:false
6684f50b22cd changed #pasteWithoutLayout
Claus Gittinger <cg@exept.de>
parents: 2366
diff changeset
   641
            keepPosition:true
6684f50b22cd changed #pasteWithoutLayout
Claus Gittinger <cg@exept.de>
parents: 2366
diff changeset
   642
            at:#keep.
2221
8ac60d4545ad selection after paste
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   643
    self changeSelectionAfterPasteOf:sel.
2257
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
   644
!
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
   645
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
   646
replaceSelectionBy:aNewSpec
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
   647
    "replace the selected widget by another one."
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
   648
3360
b7f7e48455dd #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   649
    |oldSelection treeModel newView oldView container specs index|
2387
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   650
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   651
    (self singleSelection notNil and:[treeView askForSelectionChangeAllowed]) ifFalse:[
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   652
        ^ self
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   653
    ].
3360
b7f7e48455dd #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   654
    
2387
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   655
    treeModel    := treeView model.
2257
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
   656
    oldSelection := treeModel selectedNodes at:1 ifAbsent: nil.
2387
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   657
    oldSelection isNil ifTrue:[^ self].
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   658
2395
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   659
    oldView := oldSelection contents view.
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   660
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   661
    (oldSelection hasChildren and:[aNewSpec class supportsSubComponents]) ifTrue:[
3360
b7f7e48455dd #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   662
        specs := 
b7f7e48455dd #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   663
            oldSelection children collect:[:each|
b7f7e48455dd #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   664
                self fullSpecWithAbsolutePositionFor:(each contents view)
b7f7e48455dd #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   665
            ].
2395
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   666
    ].
2387
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   667
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   668
    aNewSpec
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   669
        otherAttributeAt:#uiPainterAttributes 
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   670
        put:(Dictionary new
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   671
                at:#origin put:oldView origin;
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   672
                at:#extent put:oldView extent;
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   673
                at:#absOrigin put:(oldView originRelativeTo:self);
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   674
                yourself).
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   675
3360
b7f7e48455dd #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   676
    index := oldSelection parent children identityIndexOf:oldSelection.
2387
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   677
    container := self singleSelection container.
3360
b7f7e48455dd #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   678
    
2387
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   679
    self withinTransaction:#replaceBy objects:(Array with:oldView) do:[
2395
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   680
        self withSelectionHiddenDo:[
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   681
            newView := self 
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   682
                    pasteSpecifications:(Array with:aNewSpec)
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   683
                    into:container
3360
b7f7e48455dd #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   684
                    beforeIndex:index
2395
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   685
                    keepLayout:true
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   686
                    keepPosition:true
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   687
                    at:#keep.
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   688
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   689
            self deleteSelectionBuffered:false.
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   690
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   691
            specs size > 0 ifTrue:[
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   692
                self pasteSpecifications:specs 
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   693
                            into:newView
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   694
                            keepLayout:(aNewSpec class canResizeSubComponents)
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   695
                            keepPosition:(aNewSpec class isLayoutContainer not)
3360
b7f7e48455dd #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   696
                            at:index.
2395
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   697
            ].
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   698
            self select:newView.
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   699
       ].
2387
050c6d4d427d bugfix - replaceSelectionBy: (1)
ca
parents: 2386
diff changeset
   700
    ].
2395
9f9cf71a311c *** empty log message ***
ca
parents: 2392
diff changeset
   701
    ^ newView.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   702
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   703
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   704
!UIPainterView methodsFor:'drag & drop'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   705
2116
90fc11105f36 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
   706
canDrop:aDropContext
90fc11105f36 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
   707
    ^ self canDropObjects:aDropContext dropObjects
90fc11105f36 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
   708
90fc11105f36 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
   709
    "Created: / 13-10-2006 / 17:46:11 / cg"
90fc11105f36 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
   710
!
90fc11105f36 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
   711
90fc11105f36 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
   712
canDropObjects:aCollectionOfDropObjects
1914
229b3e455c98 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   713
    "returns true if something can be dropped"
229b3e455c98 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   714
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   715
    ^ (true "aCollectionOfDropObjects size == 1" 
2112
74dfb69c88d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2039
diff changeset
   716
    and:[ self enabled 
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   717
    and:[ true "self numberOfSelections <= 1"
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   718
    and:[ aCollectionOfDropObjects conform:[:each| each theObject isKindOf:UISpecification]
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
   719
              ]]])
2112
74dfb69c88d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2039
diff changeset
   720
2116
90fc11105f36 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
   721
    "Created: / 13-10-2006 / 16:09:24 / cg"
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   722
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   723
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   724
canPaste
1914
229b3e455c98 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   725
    "returns true if there is something which can be pasted in the clipboard"
229b3e455c98 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   726
1872
ab5cc43b193a get selection interface changed
ca
parents: 1870
diff changeset
   727
    ^ self canPaste:(self getClipboardObject)
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   728
!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   729
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   730
canPaste:something
1914
229b3e455c98 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   731
    "returns true if something could be pasted"
229b3e455c98 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   732
2221
8ac60d4545ad selection after paste
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   733
    ^ self canPaste:something into:(self singleSelection)
8ac60d4545ad selection after paste
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   734
!
8ac60d4545ad selection after paste
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   735
8ac60d4545ad selection after paste
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   736
canPaste:something into:containerToPasteInto
8ac60d4545ad selection after paste
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   737
    "returns true if something could be pasted"
8ac60d4545ad selection after paste
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   738
2276
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
   739
    (self enabled) ifFalse:[
1914
229b3e455c98 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   740
        ^ false
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   741
    ].
2276
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
   742
    something isCollection ifTrue:[
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
   743
        something isEmpty ifTrue:[ ^ false].
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
   744
        ^ something conform:[:el | (self canPaste:el into:containerToPasteInto)]
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
   745
    ].
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
   746
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
   747
    (something isKindOf:UISpecification) ifFalse:[
1914
229b3e455c98 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   748
        ^ false
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   749
    ].
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   750
2276
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
   751
    ^ self canPasteInto:containerToPasteInto
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   752
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   753
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
   754
canPasteInto:aView
1914
229b3e455c98 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   755
    "return true, if I can paste into a view"
229b3e455c98 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1894
diff changeset
   756
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
   757
    |prop|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   758
1870
771fcc38ecb8 set selection interface changed
ca
parents: 1869
diff changeset
   759
    aView isNil ifTrue:[ ^ false ].
2265
f6fbbcdd3764 still debugging replaceBy:
Claus Gittinger <cg@exept.de>
parents: 2257
diff changeset
   760
    aView == self ifTrue:[ ^ true ].
1870
771fcc38ecb8 set selection interface changed
ca
parents: 1869
diff changeset
   761
771fcc38ecb8 set selection interface changed
ca
parents: 1869
diff changeset
   762
    (prop := self propertyOfView:aView) notNil ifTrue:[
771fcc38ecb8 set selection interface changed
ca
parents: 1869
diff changeset
   763
        ^ prop spec class supportsSubComponents
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
   764
    ].
1870
771fcc38ecb8 set selection interface changed
ca
parents: 1869
diff changeset
   765
    ^ aView specClass supportsSubComponents.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   766
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   767
2116
90fc11105f36 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
   768
dropObjects:aCollectionOfDropObjects at:aPoint
2537
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
   769
    |spec newSel oldSel dragOffset dropPoint widg|
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
   770
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   771
    self selection notNil ifTrue:[
1953
3b5022bccca4 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 1914
diff changeset
   772
        oldSel := self singleSelection.
3b5022bccca4 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 1914
diff changeset
   773
3b5022bccca4 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 1914
diff changeset
   774
        "/ search selections hierarchy for a widget into which we can paste
3b5022bccca4 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 1914
diff changeset
   775
        widg := oldSel.
3b5022bccca4 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 1914
diff changeset
   776
        [widg isNil or:[self canPasteInto:widg]] whileFalse:[
3b5022bccca4 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 1914
diff changeset
   777
            widg notNil ifTrue:[
3b5022bccca4 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 1914
diff changeset
   778
                widg := widg container
3b5022bccca4 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 1914
diff changeset
   779
            ].
3b5022bccca4 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 1914
diff changeset
   780
        ].
3b5022bccca4 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 1914
diff changeset
   781
3b5022bccca4 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 1914
diff changeset
   782
        oldSel := nil.
3b5022bccca4 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 1914
diff changeset
   783
        self setSelection:widg withRedraw:true.
231
75de472d579f check whether selection is a view or a collection
ca
parents: 223
diff changeset
   784
    ].
1953
3b5022bccca4 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 1914
diff changeset
   785
    spec := (aCollectionOfDropObjects at:1) theObject.
2537
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
   786
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
   787
    dragOffset := DragAndDropManager dragOffsetQuerySignal query.
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
   788
    aPoint isNil ifTrue:[
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
   789
        dropPoint := #keep.
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
   790
    ] ifFalse:[
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
   791
        dropPoint := aPoint - dragOffset.
1833
6ad211a201cf *** empty log message ***
werner
parents: 1832
diff changeset
   792
    ].
2537
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
   793
    newSel := self pasteSpecifications:spec keepLayout:false keepPosition:false at:dropPoint.
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
   794
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
   795
    self select:(oldSel ? newSel).
1060
0332a41de5c5 Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents: 1058
diff changeset
   796
2116
90fc11105f36 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
   797
    "Modified: / 18-03-1999 / 18:29:43 / stefan"
90fc11105f36 drag and drop cleanup
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
   798
    "Created: / 13-10-2006 / 16:09:27 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   799
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   800
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   801
!UIPainterView methodsFor:'drawing'!
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   802
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   803
clearRectangle:visRect
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   804
    super clearRectangle:visRect.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   805
    sketchPainter notNil ifTrue:[
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   806
        sketchPainter redrawInTargetView
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   807
    ].
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   808
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   809
    "Created: / 16-01-2008 / 17:52:27 / cg"
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   810
!
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   811
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   812
clearView
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   813
    super clearView.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   814
    sketchPainter notNil ifTrue:[
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   815
        sketchPainter redrawInTargetView
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   816
    ].
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   817
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   818
    "Created: / 16-01-2008 / 17:46:08 / cg"
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   819
!
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   820
2248
720b0784c6f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2244
diff changeset
   821
useSketchFile:aFilename 
2443
a181aa6d60b4 comment
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
   822
    "a little neat goody: allow for a tablet-sketch file (WALTROP digital notepad)
a181aa6d60b4 comment
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
   823
     to be used as a background of the UIPainter window. This allows for sketches to
a181aa6d60b4 comment
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
   824
     be drawn, shown in the UIPainter, and then used as a placement hint (manual placement)
a181aa6d60b4 comment
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
   825
     for the user. Not a high-tech solution, but helped a lot, when we protoyped GUIs."
a181aa6d60b4 comment
Claus Gittinger <cg@exept.de>
parents: 2421
diff changeset
   826
2248
720b0784c6f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2244
diff changeset
   827
    |mime sketchPainterClass|
720b0784c6f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2244
diff changeset
   828
720b0784c6f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2244
diff changeset
   829
    mime := aFilename asFilename mimeTypeFromName.
720b0784c6f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2244
diff changeset
   830
    mime isNil ifTrue:[
720b0784c6f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2244
diff changeset
   831
        mime := aFilename asFilename mimeTypeOfContents.
720b0784c6f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2244
diff changeset
   832
    ].
720b0784c6f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2244
diff changeset
   833
720b0784c6f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2244
diff changeset
   834
    mime notNil ifTrue:[
2278
8ff3bd6f0820 Allow to load background from image file #useSketchFile:
Stefan Vogel <sv@exept.de>
parents: 2276
diff changeset
   835
        (mime startsWith:'image') ifTrue:[
8ff3bd6f0820 Allow to load background from image file #useSketchFile:
Stefan Vogel <sv@exept.de>
parents: 2276
diff changeset
   836
            self viewBackground:(ImageReader fromFile:aFilename).
8ff3bd6f0820 Allow to load background from image file #useSketchFile:
Stefan Vogel <sv@exept.de>
parents: 2276
diff changeset
   837
            ^ self.
8ff3bd6f0820 Allow to load background from image file #useSketchFile:
Stefan Vogel <sv@exept.de>
parents: 2276
diff changeset
   838
        ].
2444
3e1e97529487 comment
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
   839
        mime = 'application/x-waltop-digital-notepad' ifTrue:[
3e1e97529487 comment
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
   840
            sketchPainterClass := TOPFileDrawer.
3e1e97529487 comment
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
   841
        ].
2248
720b0784c6f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2244
diff changeset
   842
    ].
720b0784c6f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2244
diff changeset
   843
    sketchPainterClass isNil ifTrue:[
2444
3e1e97529487 comment
Claus Gittinger <cg@exept.de>
parents: 2443
diff changeset
   844
        self error:'Unsupported sketch file format'
2248
720b0784c6f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2244
diff changeset
   845
    ].
720b0784c6f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2244
diff changeset
   846
720b0784c6f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2244
diff changeset
   847
    sketchPainter := sketchPainterClass new.
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   848
    sketchPainter targetView:self.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   849
    sketchPainter readFile:aFilename.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   850
    sketchPainter ajustSketch.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   851
    self invalidate.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   852
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   853
    "Created: / 16-01-2008 / 17:46:26 / cg"
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   854
! !
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   855
361
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   856
!UIPainterView methodsFor:'event handling'!
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   857
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   858
keyPress:key x:x y:y view:aView
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   859
    "a delegated keyEvent from aView"
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   860
361
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   861
    self keyPress:key x:x y:y
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   862
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   863
    "Modified: / 31.10.1997 / 20:27:22 / cg"
361
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   864
!
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   865
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   866
keyRelease:key x:x y:y view:aView
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   867
    "a delegated keyEvent from aView"
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   868
361
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   869
    self keyRelease:key x:x y:y
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   870
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
   871
    "Modified: / 31.10.1997 / 20:27:32 / cg"
754
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
   872
!
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
   873
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
   874
sizeChanged:how
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
   875
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   876
    super sizeChanged:how.
754
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
   877
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
   878
    self layoutChanged
361
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   879
! !
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
   880
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   881
!UIPainterView methodsFor:'generating output'!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
   882
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   883
aspectMethods
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   884
    "extract a list of aspect methods - for browsing"
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   885
1683
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
   886
    |cls methods|
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   887
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   888
    className isNil ifTrue:[
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   889
	self warn:'No class defined !!'.
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   890
	^ #()
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   891
    ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   892
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   893
    cls := self resolveName:className.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   894
    methods := IdentitySet new.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   895
1683
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
   896
    self aspectSelectorsAndTypesDo:
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   897
	[:selector :typeSymbol |
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   898
	    |skip|
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   899
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   900
	    (cls includesSelector:selector) ifTrue:[
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   901
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   902
		skip := false.
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   903
		(typeSymbol == #modelAspect) ifTrue:[
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   904
		    (cls isSubclassOf:SimpleDialog) ifTrue:[
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   905
			skip := SimpleDialog includesSelector:(selector asSymbol)
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   906
		    ].
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   907
		].
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   908
		skip ifFalse:[
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   909
		    methods add:(cls compiledMethodAt:selector)
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   910
		].
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   911
	    ]
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   912
	].
1683
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
   913
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
   914
    ^ methods
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
   915
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
   916
    "Created: / 25.10.1997 / 18:58:25 / cg"
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
   917
    "Modified: / 26.10.1997 / 15:06:18 / cg"
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
   918
!
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
   919
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
   920
aspectSelectorsAndTypesDo:aTwoArgBlock
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
   921
    "evaluate aBlock for every aspect methods selector; 2nd arg describes the aspects type"
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
   922
1726
7117789f3020 Remove unused vars
Stefan Vogel <sv@exept.de>
parents: 1714
diff changeset
   923
    |cls selector protoSpec|
1683
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
   924
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
   925
    className isNil ifTrue:[
2195
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   926
        self warn:'No class defined !!'.
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   927
        ^ self
1683
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
   928
    ].
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
   929
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
   930
    cls := self resolveName:className.
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
   931
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   932
    treeView propertiesDo:[:aProp|
2195
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   933
        |selector|
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   934
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   935
        (selector := aProp model) notNil ifTrue:[
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   936
            selector isArray ifFalse:[
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   937
                aTwoArgBlock value:(selector asSymbol) value:#modelAspect
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   938
            ].
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   939
        ].
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   940
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   941
        (selector := aProp menu) notNil ifTrue:[
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   942
            selector isArray ifFalse:[
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   943
                aTwoArgBlock value:(selector asSymbol) value:#menu
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   944
            ].
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   945
        ].
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   946
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   947
        (aProp spec aspectSelectors) do:[:aSel |
2250
e65b8bf6224b care for non-symbolic aspects (false)
Claus Gittinger <cg@exept.de>
parents: 2248
diff changeset
   948
            (aSel isString or:[aSel isSymbol]) ifTrue:[
2195
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   949
                aTwoArgBlock value:(aSel asSymbol) value:#channelAspect
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   950
            ].
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   951
        ].
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   952
        aProp spec actionSelectors do:[:aSel|
2250
e65b8bf6224b care for non-symbolic aspects (false)
Claus Gittinger <cg@exept.de>
parents: 2248
diff changeset
   953
            (aSel isString or:[aSel isSymbol]) ifTrue:[
2195
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   954
                aTwoArgBlock value:(aSel asSymbol) value:#actionSelector
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   955
            ].
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   956
        ].
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   957
        aProp spec valueSelectors do:[:aSel|
2250
e65b8bf6224b care for non-symbolic aspects (false)
Claus Gittinger <cg@exept.de>
parents: 2248
diff changeset
   958
            (aSel isString or:[aSel isSymbol]) ifTrue:[
2195
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   959
                aTwoArgBlock value:(aSel asSymbol) value:#valueSelector
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   960
            ].
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   961
        ]
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   962
    ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   963
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   964
    protoSpec := treeView canvasSpec.
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   965
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   966
    (selector := protoSpec menu) notNil ifTrue:[
2195
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   967
        selector isArray ifFalse:[
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   968
            aTwoArgBlock value:(selector asSymbol) value:#menu
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
   969
        ].
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   970
    ].
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   971
!
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
   972
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
   973
generateActionMethodFor:aspect spec:protoSpec inClass:targetClass
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   974
    |selector args showIt codeStream alreadyInSuperclass numArgs method|
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   975
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   976
    selector := aspect asSymbol.
141
d06c04391233 generate actions with argument
ca
parents: 137
diff changeset
   977
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   978
    alreadyInSuperclass := targetClass superclass canUnderstand:selector.
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
   979
568
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   980
    numArgs := selector numArgs.
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   981
    method  := aspect.
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   982
7c4482bf37cf allow more than 1 numArg for an action
ca
parents: 511
diff changeset
   983
    numArgs == 1 ifTrue:[
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   984
        args := 'anArgument'.
2295
79edbe5882c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2278
diff changeset
   985
        showIt := ''' , anArgument printString , ''...''.'.
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
   986
    ] ifFalse:[
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   987
        args := ''.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   988
        showIt := ' ...''.'.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   989
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   990
        numArgs ~~ 0 ifTrue:[
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   991
            method := ''.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   992
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   993
            selector keywords keysAndValuesDo:[:i :key|
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   994
                method := method, key, 'arg', i printString, ' '
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   995
            ]
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   996
        ]
149
e652608690b1 help ...
ca
parents: 146
diff changeset
   997
    ].
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   998
    codeStream := WriteStream on:(String new:100).
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
   999
    codeStream  
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1000
        nextPutLine:('!!',targetClass name,' methodsFor:''actions''!!');
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1001
        nextPutLine:(method,args);
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1002
        nextPutLine:'    <resource: #uiCallback>';
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1003
        cr.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1004
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1005
    self class generateCommentedCode ifTrue:[
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1006
        codeStream
2295
79edbe5882c6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2278
diff changeset
  1007
            nextPutAll:'    "automatically generated by UIPainter..."
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1008
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1009
    "*** the code below performs no action"
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1010
    "*** (except for some feedback on the Transcript)"
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1011
    "*** Please change as required and accept in the browser."
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1012
    "*** (and replace this comment by something more useful ;-)"
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1013
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1014
'.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1015
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1016
        alreadyInSuperclass ifTrue:[
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1017
            codeStream  
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1018
                nextPutLine:'    "action for ' , aspect , ' is already provided in a superclass."';
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1019
                nextPutLine:'    "It may be redefined here..."';
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1020
                cr.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1021
        ] ifFalse:[
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1022
            codeStream  
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1023
                nextPutLine:'    "action to be defined here..."';
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1024
                cr.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1025
        ].
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1026
    ].
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1027
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1028
    codeStream  
3304
eb8835656382 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 3293
diff changeset
  1029
        nextPutAll:'    Logger info:'''.
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
  1030
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
  1031
    alreadyInSuperclass ifTrue:[
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1032
        codeStream  
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1033
            nextPutAll:'inherited '.
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
  1034
    ].
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1035
    codeStream  
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1036
        nextPutAll:'action for ';
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1037
        nextPutAll:aspect;
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1038
        nextPutLine:showIt.
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
  1039
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
  1040
    alreadyInSuperclass ifTrue:[
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1041
        codeStream  
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1042
            nextPutAll:'    super ';
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1043
            nextPutAll:aspect;
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1044
            nextPutAll:args;
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1045
            nextPutLine:'.'.
288
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
  1046
    ].
675327dd4d7d change drop mechanism:
ca
parents: 285
diff changeset
  1047
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1048
    codeStream  
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1049
        nextPutLine:'!! !!'; cr.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1050
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1051
    ^ codeStream contents.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1052
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1053
    "Modified: / 12-01-2008 / 10:21:52 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1054
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1055
1683
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1056
generateAspectMethodCode
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1057
    "generate aspect, action & menu methods
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1058
     - but do not overwrite existing ones.
2714
abaae556bec8 commentCode flags now in userPrefs
Claus Gittinger <cg@exept.de>
parents: 2627
diff changeset
  1059
     Return a string ready to compile into the application class.
abaae556bec8 commentCode flags now in userPrefs
Claus Gittinger <cg@exept.de>
parents: 2627
diff changeset
  1060
     TODO: refactor and move to CodeGenerator"
1683
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1061
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1062
    ^ self generateAspectMethodCodeFiltering:nil
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1063
!
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1064
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1065
generateAspectMethodCodeFiltering:aFilterOrEmpty
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1066
    "generate aspect, action & menu methods
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1067
     - but do not overwrite existing ones.
2714
abaae556bec8 commentCode flags now in userPrefs
Claus Gittinger <cg@exept.de>
parents: 2627
diff changeset
  1068
     Return a string ready to compile into the application class.
abaae556bec8 commentCode flags now in userPrefs
Claus Gittinger <cg@exept.de>
parents: 2627
diff changeset
  1069
     TODO: refactor and move to CodeGenerator"
1683
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1070
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1071
    |cls codePieces skip protoSpec thisCode
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1072
     definedMethodSelectors iVars t exportSels|
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1073
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1074
    cls := self targetClass.
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1075
    cls isNil ifTrue:[
2024
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1076
        ^ nil
1683
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1077
    ].
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1078
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1079
    codePieces := OrderedCollection new.
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1080
    definedMethodSelectors := IdentitySet new.
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1081
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1082
    treeView propertiesDo:[:aProp|
2024
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1083
        |modelSelector|
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1084
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1085
        protoSpec := aProp spec.
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1086
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1087
        (modelSelector := aProp model) notNil ifTrue:[
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1088
            self generateCodeFrom:(Array with:modelSelector) in:cls
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1089
                do:[:aSel|
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1090
                    (aFilterOrEmpty isNil or:[aFilterOrEmpty includes:aSel]) ifTrue:[
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1091
                        skip := false.
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1092
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1093
                        (cls isSubclassOf:SimpleDialog) ifTrue:[
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1094
                            skip := SimpleDialog includesSelector:aSel
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1095
                        ].
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1096
                        (definedMethodSelectors includes:aSel) ifTrue:[
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1097
                            skip := true.
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1098
                        ].
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1099
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1100
                        skip ifFalse:[
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1101
                            "/ kludge ..
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1102
                            "/ (protoSpec isKindOf:ActionButtonSpec)
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1103
                            (protoSpec defaultModelIsCallBackMethodSelector:aSel)
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1104
                            ifTrue:[
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1105
                                thisCode := (self generateActionMethodFor:aSel spec:protoSpec inClass:cls).
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1106
                            ] ifFalse:[
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1107
                                thisCode := (self generateAspectMethodFor:aSel spec:protoSpec inClass:cls).
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1108
                            ].
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1109
                            codePieces add:thisCode.
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1110
                            definedMethodSelectors add:aSel.
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1111
                            Transcript showCR:'code generated for aspect: ' , aSel
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1112
                        ] ifTrue:[
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1113
                            Transcript showCR:'*** no code generated for aspect: ' , aSel , ' (method already exists)'
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1114
                        ].
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1115
                    ].
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1116
                ].
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1117
        ].
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1118
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1119
        "/ for each aspect, generate getter (if not yet implemented)
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1120
        self generateCodeFrom:(aProp spec aspectSelectors) in:cls
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1121
                do:[:aSel|
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1122
                    (aFilterOrEmpty isNil or:[aFilterOrEmpty includes:aSel]) ifTrue:[
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1123
                        (definedMethodSelectors includes:aSel) ifFalse:[
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1124
                            thisCode := (self generateAspectMethodFor:aSel spec:protoSpec inClass:cls).
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1125
                            codePieces add:thisCode.
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1126
                            definedMethodSelectors add:aSel.
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1127
                            Transcript showCR:'code generated for aspect: ' , aSel
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1128
                        ]
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1129
                    ]
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1130
                ].
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1131
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1132
        "/ exported aspects - need setter methods
3092
c327e636e6a3 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3083
diff changeset
  1133
        exportSels := (treeView exportedAspects ? #()) collect:[:entry | (entry subAspect) asMutator].
2024
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1134
        self generateCodeFrom:exportSels in:cls
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1135
                do:[:aSel|
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1136
                    |aspect|
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1137
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1138
                    (aFilterOrEmpty isNil or:[aFilterOrEmpty includes:aSel]) ifTrue:[
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1139
                        (definedMethodSelectors includes:aSel) ifFalse:[
3136
146b6f9e139c class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3129
diff changeset
  1140
                            aspect := (aSel copyButLast) asSymbol.
2024
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1141
                            thisCode := (self generateAspectSetMethodFor:aspect spec:protoSpec inClass:cls).
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1142
                            codePieces add:thisCode.
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1143
                            definedMethodSelectors add:aSel.
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1144
                            Transcript showCR:'export code generated for aspect: ' , aSel
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1145
                        ]
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1146
                    ]
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1147
                ].
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1148
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1149
        self generateCodeFrom:(aProp spec actionSelectors) in:cls
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1150
                do:[:aSel|
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1151
                    (aFilterOrEmpty isNil or:[aFilterOrEmpty includes:aSel]) ifTrue:[
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1152
                        (definedMethodSelectors includes:aSel) ifFalse:[
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1153
                            thisCode := (self generateActionMethodFor:aSel spec:protoSpec inClass:cls).
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1154
                            codePieces add:thisCode.
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1155
                            definedMethodSelectors add:aSel.
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1156
                            Transcript showCR:'action generated for aspect: ' , aSel
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1157
                        ]
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1158
                    ]
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1159
                ].
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1160
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1161
        self generateCodeFrom:(aProp spec valueSelectors) in:cls
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1162
                do:[:aSel|
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1163
                    (aFilterOrEmpty isNil or:[aFilterOrEmpty includes:aSel]) ifTrue:[
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1164
                        (definedMethodSelectors includes:aSel) ifFalse:[
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1165
                            "/ uppercase: - assume its a globals name.
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1166
                            aSel isUppercaseFirst ifFalse:[
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1167
                                thisCode := (self generateValueMethodFor:aSel spec:protoSpec inClass:cls).
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1168
                                codePieces add:thisCode.
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1169
                                definedMethodSelectors add:aSel.
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1170
                                Transcript showCR:'code generated for aspect: ' , aSel
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1171
                            ]
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1172
                        ]
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1173
                    ]
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1174
                ].
1683
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1175
    ].
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1176
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1177
    AspectsAsInstances ifTrue:[
2024
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1178
        iVars := cls instVarNames asOrderedCollection.
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1179
        definedMethodSelectors do:[:ivar |
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1180
            (iVars includes:ivar) ifFalse:[
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1181
                iVars add:ivar
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1182
            ]
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1183
        ].
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1184
        iVars := iVars asArray.
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1185
        t := cls shallowCopy.
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1186
        t setInstanceVariableString:iVars asStringCollection asString.
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1187
        codePieces addFirst:(t definition , '!!\' withCRs).
1683
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1188
    ].
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1189
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1190
    ^ String
2024
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1191
        streamContents:
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1192
            [:codeStream |
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1193
                codePieces do:[:eachPiece | codeStream nextPutAll:eachPiece].
6e9f614d6c9e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1977
diff changeset
  1194
            ].
1683
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1195
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1196
    "Modified: / 29.7.1998 / 12:21:19 / cg"
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1197
!
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1198
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1199
generateAspectMethodFor:aspect spec:protoSpec inClass:targetClass
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1200
    |modelClass modelValueString modelValue modelGen codeStream|
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1201
149
e652608690b1 help ...
ca
parents: 146
diff changeset
  1202
    modelClass := protoSpec defaultModelClassFor:aspect.
1257
acb8c0a58ef3 dataSPec defaultValue when generating aspects
Claus Gittinger <cg@exept.de>
parents: 1252
diff changeset
  1203
    modelValueString := protoSpec defaultModelValueStringFor:aspect.
acb8c0a58ef3 dataSPec defaultValue when generating aspects
Claus Gittinger <cg@exept.de>
parents: 1252
diff changeset
  1204
    modelValueString notNil ifTrue:[
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1205
        modelGen := modelValueString
1257
acb8c0a58ef3 dataSPec defaultValue when generating aspects
Claus Gittinger <cg@exept.de>
parents: 1252
diff changeset
  1206
    ] ifFalse:[
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1207
        modelValue := protoSpec defaultModelValueFor:aspect.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1208
        modelValue isNil ifTrue:[
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1209
            modelGen := modelClass name , ' new'
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1210
        ] ifFalse:[
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1211
            modelGen := modelValue storeString , ' asValue'
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1212
        ].
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
  1213
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
  1214
    ].
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  1215
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1216
    codeStream := WriteStream on:(String new:100).
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1217
    codeStream  
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1218
        nextPutLine:('!!' , targetClass name , ' methodsFor:''aspects''!!');
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1219
        nextPutLine:aspect;
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1220
        nextPutLine:'    <resource: #uiAspect>';
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1221
        cr.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1222
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1223
    self class generateCommentedCode ifTrue:[
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1224
        codeStream  
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1225
            nextPutAll:'    "automatically generated by UIPainter ..."
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1226
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1227
    "*** the code below creates a default model when invoked."
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1228
    "*** (which may not be the one you wanted)"
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1229
    "*** Please change as required and accept it in the browser."
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1230
    "*** (and replace this comment by something more useful ;-)"
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1231
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1232
'.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1233
    ].
1474
d2ee565fa32a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1467
diff changeset
  1234
925
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
  1235
    AspectsAsInstances ifTrue:[
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1236
        codeStream
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1237
            nextPutLine:('    ',aspect,' isNil ifTrue:[');
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1238
            nextPutLine:('        ',aspect,' := ',modelGen,'.').
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1239
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1240
        modelClass ~~ TriggerValue ifTrue:[
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1241
            self class generateCommentedCode ifTrue:[
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1242
                codeStream
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1243
                    nextPutLine:'"/ if your app needs to be notified of changes, uncomment one of the lines below:'.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1244
            ].
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1245
            codeStream
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1246
                nextPutLine:'"/       ',aspect,' addDependent:self.';
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1247
                nextPutLine:'"/       ',aspect,' onChangeSend:#',aspect,'Changed to:self.'.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1248
        ].
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1249
        codeStream
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1250
            nextPutLine:'    ].';
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1251
            nextPutLine:'    ^ ',aspect,'.'.
925
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
  1252
    ] ifFalse:[
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1253
        codeStream
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1254
            nextPutLine:('    |holder|');
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1255
            cr;
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1256
            nextPutLine:('    (holder := builder bindingAt:#',aspect,') isNil ifTrue:[');
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1257
            nextPutLine:('        holder := ',modelGen,'.');
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1258
            nextPutLine:('        builder aspectAt:#',aspect,' put:holder.').
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1259
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1260
        modelClass ~~ TriggerValue ifTrue:[
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1261
            self class generateCommentedCode ifTrue:[
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1262
                codeStream
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1263
                    nextPutLine:'"/ if your app needs to be notified of changes, uncomment one of the lines below:'.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1264
            ].
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1265
            codeStream
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1266
                nextPutLine:'"/       holder addDependent:self.';
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1267
                nextPutLine:'"/       holder onChangeSend:#',aspect,'Changed to:self.'.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1268
        ].
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1269
        codeStream
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1270
            nextPutLine:'    ].';
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1271
            nextPutLine:'    ^ holder.'.
925
e6ddd46581c3 added option of generating aspects as instvars.
Claus Gittinger <cg@exept.de>
parents: 887
diff changeset
  1272
    ].
1361
9020214f03e6 generate aspect-setters for exported aspects
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1273
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1274
    codeStream
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1275
        nextPutLine:'!! !!'; cr.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1276
"/ self halt.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1277
    ^ codeStream contents.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1278
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1279
    "Modified: / 22-09-1999 / 12:33:47 / stefan"
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1280
    "Modified: / 12-01-2008 / 10:21:43 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1281
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1282
1358
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1283
generateAspectSelectorsMethod
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1284
    "generate aspectSelectors method.
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1285
     Return a string ready to compile into the application class."
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1286
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1287
    |cls code spec|
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1288
1683
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1289
    cls := self targetClass.
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1290
    cls isNil ifTrue:[
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1291
	^ nil
1358
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1292
    ].
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1293
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1294
    spec := treeView exportedAspects.
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1295
    spec size == 0 ifTrue:[^ nil].
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1296
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1297
    "/ make it an array ...
1362
b710bba663cb fixed generateAspectSelectors code generator
Claus Gittinger <cg@exept.de>
parents: 1361
diff changeset
  1298
    spec := spec collect:[:entry | |subAspect type|
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1299
		subAspect := entry subAspect asSymbol.
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1300
		(type := entry type) isNil ifTrue:[
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1301
		    subAspect
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1302
		] ifFalse:[
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1303
		    Array with:subAspect with:type asSymbol
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1304
		].
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1305
	    ].
1358
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1306
    spec := spec asArray.
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1307
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1308
    code := '!!' , cls name , ' class methodsFor:''plugIn spec''!!\\' .
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1309
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1310
    code := code , 'aspectSelectors
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1311
    "This resource specification was automatically generated
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1312
     by the UIPainter of ST/X."
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1313
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1314
    "Do not manually edit this. If it is corrupted,
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1315
     the UIPainter may not be able to read the specification."
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1316
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1317
    "Return a description of exported aspects;
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1318
     these can be connected to aspects of an embedding application
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1319
     (if this app is embedded in a subCanvas)."
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1320
1362
b710bba663cb fixed generateAspectSelectors code generator
Claus Gittinger <cg@exept.de>
parents: 1361
diff changeset
  1321
    ^ #(\'.
b710bba663cb fixed generateAspectSelectors code generator
Claus Gittinger <cg@exept.de>
parents: 1361
diff changeset
  1322
    spec do:[:el | code := code , ('        ' , el storeString , '\') ].
b710bba663cb fixed generateAspectSelectors code generator
Claus Gittinger <cg@exept.de>
parents: 1361
diff changeset
  1323
    code := code , '      ).\'.
b710bba663cb fixed generateAspectSelectors code generator
Claus Gittinger <cg@exept.de>
parents: 1361
diff changeset
  1324
    code := code , '\!!\'.
1358
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1325
    code := code withCRs.
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1326
    ^ code
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1327
1362
b710bba663cb fixed generateAspectSelectors code generator
Claus Gittinger <cg@exept.de>
parents: 1361
diff changeset
  1328
    "Modified: / 18.2.2000 / 02:08:34 / cg"
1358
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1329
!
c0116e25a2ac generateAspectSelectorsMethod
ca
parents: 1347
diff changeset
  1330
1361
9020214f03e6 generate aspect-setters for exported aspects
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1331
generateAspectSetMethodFor:aspect spec:protoSpec inClass:targetClass
9020214f03e6 generate aspect-setters for exported aspects
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1332
    |code|
9020214f03e6 generate aspect-setters for exported aspects
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1333
9020214f03e6 generate aspect-setters for exported aspects
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1334
    code := '!!' , targetClass name , ' methodsFor:''aspects - exported''!!\\' ,
9020214f03e6 generate aspect-setters for exported aspects
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1335
      aspect , ':something\' ,
9020214f03e6 generate aspect-setters for exported aspects
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1336
      '    "automatically generated by UIPainter ..."\\' ,
9020214f03e6 generate aspect-setters for exported aspects
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1337
      '    "This method is used when I am embedded as subApplication,"\' ,
9020214f03e6 generate aspect-setters for exported aspects
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1338
      '    "and the mainApp wants to connect its aspects to mine."\'.
9020214f03e6 generate aspect-setters for exported aspects
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1339
9020214f03e6 generate aspect-setters for exported aspects
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1340
    AspectsAsInstances ifTrue:[
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1341
	code := (code , '\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1342
	  '"/     ' , aspect , ' notNil ifTrue:[\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1343
	  '"/        ' , aspect , ' removeDependent:self.\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1344
	  '"/     ].\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1345
	  '    ' , aspect ,' := something.\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1346
	  '"/     ' , aspect ,' notNil ifTrue:[\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1347
	  '"/        ' , aspect , ' addDependent:self.\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1348
	  '"/     ].\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1349
	  '    ^ self.\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1350
	  '!! !!\\')
1361
9020214f03e6 generate aspect-setters for exported aspects
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1351
    ] ifFalse:[
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1352
	code := (code , '\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1353
	  '"/     |holder|\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1354
	  '\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1355
	  '"/     (holder := builder bindingAt:#' , aspect , ') notNil ifTrue:[\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1356
	  '"/         holder removeDependent:self.\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1357
	  '"/     ].\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1358
	  '    builder aspectAt:#' , aspect , ' put:something.\',
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1359
	  '"/     something notNil ifTrue:[\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1360
	  '"/         something addDependent:self.\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1361
	  '"/     ].\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1362
	  '    ^ self.\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1363
	  '!! !!\\')
1361
9020214f03e6 generate aspect-setters for exported aspects
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1364
    ].
9020214f03e6 generate aspect-setters for exported aspects
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1365
9020214f03e6 generate aspect-setters for exported aspects
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1366
    ^ code withCRs
9020214f03e6 generate aspect-setters for exported aspects
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1367
9020214f03e6 generate aspect-setters for exported aspects
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1368
    "Modified: / 29.7.1998 / 11:29:16 / cg"
9020214f03e6 generate aspect-setters for exported aspects
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1369
    "Modified: / 22.9.1999 / 12:33:47 / stefan"
9020214f03e6 generate aspect-setters for exported aspects
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1370
!
9020214f03e6 generate aspect-setters for exported aspects
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1371
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
  1372
generateCodeFrom:aListOfSelectors in:aClass do:aBlock
1696
0cb66a26b156 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1683
diff changeset
  1373
    |realSelectors redefCondition redefMessage|
0cb66a26b156 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1683
diff changeset
  1374
2250
e65b8bf6224b care for non-symbolic aspects (false)
Claus Gittinger <cg@exept.de>
parents: 2248
diff changeset
  1375
    realSelectors := aListOfSelectors select:[:sel | sel isString or:[sel isSymbol]].
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
  1376
744
20cbba6d7e96 oops - no #redefineMethods found
tz
parents: 742
diff changeset
  1377
    self class redefineAspectMethods ifTrue:[
2195
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
  1378
        redefCondition := [:cls :sel | (cls includesSelector:sel) not].
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
  1379
        redefMessage := ' skipped - already implemented in the class'.
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
  1380
    ] ifFalse:[
2195
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
  1381
        redefCondition := [:cls :sel | (cls canUnderstand:sel) not].
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
  1382
        redefMessage := ' skipped - already implemented in the class (or superclass)'.
1696
0cb66a26b156 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1683
diff changeset
  1383
    ].
0cb66a26b156 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1683
diff changeset
  1384
0cb66a26b156 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1683
diff changeset
  1385
    realSelectors do:[:aSelector|
2195
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
  1386
        (redefCondition value:aClass value:aSelector) ifTrue:[
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
  1387
            aBlock value:aSelector asSymbol
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
  1388
        ] ifFalse:[
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
  1389
            Transcript showCR:('#' , aSelector , redefMessage)
bb6de5f8fd03 Take care of true or false as pseudo-aspect-selectors
Stefan Vogel <sv@exept.de>
parents: 2191
diff changeset
  1390
        ]
698
5bf234e0e451 redefine methods flag
tz
parents: 662
diff changeset
  1391
    ]
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1392
!
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1393
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1394
generateHookMethodFor:selectorSpec comment:commentWhen note:noteOrNil defaultCode:defaultCode inClass:targetClass
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1395
    ^ ('!!' , targetClass name , ' methodsFor:''hooks''!!\\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1396
      selectorSpec , '\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1397
      '    "automatically generated by UIPainter ..."\\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1398
      '    "*** the code here does nothing. It is invoked when"\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1399
      '    "*** ' , commentWhen , '"\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1400
      '    "*** Please change as required and accept in the browser."\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1401
      '\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1402
      '    "specific code to be added below ..."\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1403
      '    "' , (noteOrNil ? '') , '"\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1404
      '\' ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1405
      (defaultCode ? '^ self.') ,
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1406
      '!! !!\\') withCRs
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1407
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1408
    "Modified: / 25.10.1997 / 19:22:17 / cg"
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1409
    "Created: / 31.10.1997 / 17:31:53 / cg"
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1410
!
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1411
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1412
generateHookMethods
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1413
    "generate hook methods
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1414
     - but do not overwrite existing ones.
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1415
     Return a string ready to compile into the application class."
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1416
1683
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1417
    |cls|
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1418
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1419
    cls := self targetClass.
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1420
    cls isNil ifTrue:[
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1421
	^ nil
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1422
    ].
1683
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1423
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1424
    ^ self generateHookMethodsInClass:cls.
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1425
!
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1426
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1427
generateHookMethodsInClass:targetClass
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1428
    |code|
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1429
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1430
    code := ''.
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1431
1554
d5e4612bf7cf implements -> includesSelector
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
  1432
    (targetClass includesSelector:#postBuildWith:) ifFalse:[
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1433
	code := code
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1434
		, (self
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1435
		    generateHookMethodFor:'postBuildWith:aBuilder'
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1436
		    comment:'the widgets have been built, but before the view is opened'
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1437
		    note:'or after the super send'
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1438
		    defaultCode:'    super postBuildWith:aBuilder'
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1439
		    inClass:targetClass)
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1440
    ].
1554
d5e4612bf7cf implements -> includesSelector
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
  1441
    (targetClass includesSelector:#postOpenWith:) ifFalse:[
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1442
	code := code
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1443
		, (self
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1444
		    generateHookMethodFor:'postOpenWith:aBuilder'
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1445
		    comment:'the topView has been opened, but before events are dispatched for it'
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1446
		    note:'or after the super send'
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1447
		    defaultCode:'    super postOpenWith:aBuilder'
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1448
		    inClass:targetClass)
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1449
    ].
1554
d5e4612bf7cf implements -> includesSelector
Claus Gittinger <cg@exept.de>
parents: 1543
diff changeset
  1450
    (targetClass includesSelector:#closeRequest) ifFalse:[
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1451
	code := code
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1452
		, (self
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1453
		    generateHookMethodFor:'closeRequest'
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1454
		    comment:'the topView has been asked to close'
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1455
		    note:'return without the ''super closeRequest'' to stay open'
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1456
		    defaultCode:'    ^super closeRequest'
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1457
		    inClass:targetClass)
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1458
    ].
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1459
    ^ code
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1460
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1461
    "Modified: / 31.10.1997 / 17:30:34 / cg"
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  1462
    "Created: / 31.10.1997 / 17:32:49 / cg"
316
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
  1463
!
053e2d3089b7 support of menu performer
ca
parents: 315
diff changeset
  1464
965
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1465
generateMenuMethodFor:menuSel inClass:targetClass
1805
cf1a9d636bf7 category and comment flags now in Userprefs
Claus Gittinger <cg@exept.de>
parents: 1785
diff changeset
  1466
    |selector args showIt code alreadyInSuperclass numArgs method category|
965
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1467
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1468
    selector := menuSel asSymbol.
1805
cf1a9d636bf7 category and comment flags now in Userprefs
Claus Gittinger <cg@exept.de>
parents: 1785
diff changeset
  1469
    category := UserPreferences current categoryForMenuActionsMethods.
965
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1470
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1471
    alreadyInSuperclass := targetClass superclass canUnderstand:selector.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1472
1805
cf1a9d636bf7 category and comment flags now in Userprefs
Claus Gittinger <cg@exept.de>
parents: 1785
diff changeset
  1473
    code := '!!' , targetClass name , ' methodsFor:''' , category , '''!!\\'.
965
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1474
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1475
    selector = 'openAboutThisApplication' ifTrue:[
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1476
	code := code ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1477
		'openAboutThisApplication\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1478
		'    "opens an about box for this application."\\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1479
		'    "automatically generated by UIPainter ..."\\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1480
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1481
		'    |rev box myClass clsRev image msg|\\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1482
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1483
		'    rev := ''''.\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1484
		'    myClass := self class.\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1485
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1486
		'    (clsRev := myClass revision) notNil ifTrue:[\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1487
		'       rev := ''  (rev: '', clsRev printString, '')''].\\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1488
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1489
		'    msg := Character cr asString , myClass name asBoldText, rev.\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1490
		'    msg := (msg , ''\\*** add more info here ***\\'') withCRs.\\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1491
		'    box := AboutBox title:msg.\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1492
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1493
		'    "/ *** add a #defaultIcon method in the class\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1494
		'    "/ *** and uncomment the following line:\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1495
		'    "/ image := self class defaultIcon.\\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1496
		'    image notNil ifTrue:[\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1497
		'        box image:image\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1498
		'    ].\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1499
		'    box   label:(resources string:''About %1'' with:myClass name).\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1500
		'    box   autoHideAfter:10 with:[].\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1501
		'    box   showAtPointer.\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1502
		'!! !!\\'.
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1503
	^ code withCRs
965
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1504
    ].
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1505
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1506
    selector = 'menuOpen' ifTrue:[
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1507
	code := code ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1508
		'menuOpen\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1509
		'    "automatically generated by UIPainter ..."\\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1510
		'    "*** the code below opens a dialog for file selection"\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1511
		'    "*** and invokes the #doOpen: method with the selected file."\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1512
		'    "*** Please change as required and accept in the browser."\\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1513
		'    |file|\\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1514
		'    file :=\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1515
		'        (FileSelectionBrowser\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1516
		'            request: ''Open''\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1517
		'            fileName: ''''\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1518
		'            "/ inDirectory: lastOpenDirectory\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1519
		'            withFileFilters: #(''*'')).\\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1520
		'    file notNil ifTrue:[\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1521
		'       "/ lastOpenDirectory := file asFilename directory.\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1522
		'       self doOpen:file\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1523
		'    ]\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1524
		'!! !!\'.
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1525
	^ code withCRs
965
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1526
    ].
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1527
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1528
    numArgs := selector numArgs.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1529
    method  := selector.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1530
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1531
    numArgs == 1 ifTrue:[
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1532
	args := 'anArgument'.
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1533
	showIt := ''' , anArgument printString , '' ...''.\'.
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1534
    ] ifFalse:[
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1535
	args := ''.
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1536
	showIt := ' ...''.\'.
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1537
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1538
	numArgs ~~ 0 ifTrue:[
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1539
	    method := ''.
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1540
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1541
	    selector keywords keysAndValuesDo:[:i :key|
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1542
		method := method, key, 'arg', i printString, ' '
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1543
	    ]
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1544
	]
965
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1545
    ].
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1546
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1547
    code := code ,
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1548
		method , args , '\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1549
		'    "automatically generated by UIPainter ..."\\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1550
		'    "*** the code below performs no action"\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1551
		'    "*** (except for some feedback on the Transcript)"\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1552
		'    "*** Please change as required and accept in the browser."\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1553
		'\' .
965
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1554
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1555
    alreadyInSuperclass ifTrue:[
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1556
	code := code ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1557
		    '    "action for ' , selector , ' is already provided in a superclass."\' ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1558
		    '    "It may be redefined here ..."\\'.
965
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1559
    ] ifFalse:[
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1560
	code := code ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1561
		    '    "action to be added ..."\\'.
965
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1562
    ].
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1563
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1564
    code := code ,
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1565
		'    Transcript showCR:self class name, '': '.
965
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1566
    alreadyInSuperclass ifTrue:[
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1567
	code := code , 'inherited '.
965
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1568
    ].
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1569
    code := code , 'menu action for ' , selector , showIt.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1570
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1571
    alreadyInSuperclass ifTrue:[
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1572
	code := code ,
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1573
			'    super ' , selector , args , '.\'.
965
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1574
    ].
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1575
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1576
    code := code ,
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1577
		'!! !!\\'.
965
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1578
    ^ code withCRs
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1579
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1580
    "Created: / 23.8.1998 / 16:46:51 / cg"
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1581
    "Modified: / 23.8.1998 / 18:13:05 / cg"
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1582
!
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1583
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1584
generateMenuMethods
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1585
    "generate menu methods
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1586
     - but do not overwrite existing ones.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1587
     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
  1588
1069
7196ca547f5d code cleanup
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
  1589
    |cls code menuSelector thisCode
7196ca547f5d code cleanup
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
  1590
     definedMethodSelectors
2276
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  1591
     spec specArray fullSpec winSpec menuSpec|
965
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1592
1683
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1593
    cls := self targetClass.
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1594
    cls isNil ifTrue:[
2276
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  1595
        ^ nil
965
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1596
    ].
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1597
2276
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  1598
    spec := treeView generateFullSpecForComponents:#() named:nil.
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  1599
    specArray := spec literalArrayEncoding.
965
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1600
    fullSpec := specArray decodeAsLiteralArray.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1601
    winSpec := fullSpec window.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1602
    menuSelector := winSpec menu.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1603
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1604
    (menuSelector notNil
1069
7196ca547f5d code cleanup
Claus Gittinger <cg@exept.de>
parents: 1060
diff changeset
  1605
    and:[ (cls respondsTo:menuSelector) ]) ifFalse:[
2276
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  1606
        self warn:'No menu defined (yet)'.
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  1607
        ^ nil.
965
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1608
    ].
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1609
    menuSpec := cls perform:menuSelector.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1610
    menuSpec := menuSpec decodeAsLiteralArray.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1611
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1612
    definedMethodSelectors := IdentitySet new.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1613
    code := ''.
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1614
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1615
    menuSpec allItemsDo:[:item |
2276
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  1616
        |sel|
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  1617
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  1618
        (sel := item value) notNil ifTrue:[
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  1619
            (definedMethodSelectors includes:sel) ifFalse:[
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  1620
                self generateCodeFrom:(Array with:sel) in:cls do:[:aSel|
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  1621
                    thisCode := (self generateMenuMethodFor:aSel inClass:cls).
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  1622
                    code := code, thisCode.
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  1623
                ].
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  1624
                definedMethodSelectors add:sel.
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  1625
            ].
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  1626
        ]
965
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1627
    ].
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1628
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1629
    (definedMethodSelectors includes:#menuOpen) ifTrue:[
2276
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  1630
        self generateCodeFrom:(Array with:#doOpen:) in:cls do:[:aSel|
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  1631
            thisCode := (self generateMenuMethodFor:aSel inClass:cls).
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  1632
            code := code, thisCode.
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  1633
        ].
965
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1634
    ].
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1635
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1636
    ^ code
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1637
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1638
    "Created: / 23.8.1998 / 16:12:09 / cg"
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1639
    "Modified: / 23.8.1998 / 18:12:23 / cg"
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1640
!
4f786b46a569 added menu-action code generation
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  1641
188
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
  1642
generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
  1643
    ^ ('!!' , targetClass name , ' methodsFor:''values''!!\\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
  1644
      aspect , '\' ,
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
  1645
      '    "automatically generated by UIPainter ..."\\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
  1646
      '    "*** the code below returns a default value when invoked."\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
  1647
      '    "*** (which may not be the one you wanted)"\' ,
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
  1648
      '    "*** Please change as required and accept in the browser."\' ,
188
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
  1649
      '\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
  1650
      '    "value to be added below ..."\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
  1651
      '    Transcript showCR:self class name , '': no value yet for ' , aspect , ' ...''.\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
  1652
      '\' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
  1653
      '^ nil.' ,
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
  1654
      '!! !!\\') withCRs
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
  1655
352
088174fc1e71 support for constant lists;
Claus Gittinger <cg@exept.de>
parents: 335
diff changeset
  1656
    "Modified: / 25.10.1997 / 19:22:17 / cg"
188
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
  1657
!
8091a35bccf1 generateValueMethodFor:aspect spec:protoSpec inClass:targetClass
ca
parents: 180
diff changeset
  1658
2197
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1659
generateWindowSpec
3038
52374621e04b class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3031
diff changeset
  1660
    |spec addToSpec specsAlready|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1661
310
a68c182d050f support of scrollers and menu for the canvas
ca
parents: 288
diff changeset
  1662
    spec := OrderedCollection new.
3038
52374621e04b class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3031
diff changeset
  1663
    specsAlready := IdentitySet new.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1664
2499
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  1665
    addToSpec :=
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  1666
        [:aView|
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  1667
            |vSpec|
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  1668
            "/ care for wrapped views ...
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  1669
            vSpec := self fullSpecFor:aView.
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  1670
            vSpec isNil ifTrue:[
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  1671
                aView subViews size == 1 ifTrue:[
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  1672
                    vSpec := self fullSpecFor:(aView subViews first).
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  1673
                ]
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  1674
            ].
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  1675
            vSpec isNil ifTrue:[
2505
2d43dbc0e86c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2499
diff changeset
  1676
                (Dialog 
2d43dbc0e86c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2499
diff changeset
  1677
                    confirm:('Oops - could not create spec for view: %1\\Continue ?' bindWith:aView printString) withCRs
2d43dbc0e86c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2499
diff changeset
  1678
                    noLabel:'Abort')
2d43dbc0e86c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2499
diff changeset
  1679
                ifFalse:[
3067
4fc07457aef3 AbortSignal -> AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 3055
diff changeset
  1680
                    AbortOperationRequest raise
2505
2d43dbc0e86c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2499
diff changeset
  1681
                ].
2499
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  1682
            ].
3038
52374621e04b class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3031
diff changeset
  1683
            (specsAlready includes:vSpec) ifTrue:[self halt].
52374621e04b class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3031
diff changeset
  1684
            specsAlready add:vSpec.
2499
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  1685
            spec add:vSpec
2197
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1686
        ].
2499
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  1687
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  1688
    self subViews do:addToSpec.
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  1689
    self components do:addToSpec.
1058
243d945b1daf name the (full-)spec
tm
parents: 1050
diff changeset
  1690
    spec := treeView generateFullSpecForComponents:spec named:methodName.
2197
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1691
    ^ spec
3038
52374621e04b class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3031
diff changeset
  1692
52374621e04b class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3031
diff changeset
  1693
    "Modified: / 30-07-2013 / 09:13:13 / cg"
2197
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1694
!
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1695
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1696
generateWindowSpecMethodSource
3031
a301eabbab46 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
  1697
    ^ self 
a301eabbab46 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
  1698
        generateWindowSpecMethodSourceFor:(self generateWindowSpec) 
a301eabbab46 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
  1699
        class:className 
a301eabbab46 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
  1700
        selector:methodName
a301eabbab46 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
  1701
a301eabbab46 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
  1702
    "Modified: / 5.9.1995 / 21:01:35 / claus"
a301eabbab46 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
  1703
    "Modified: / 15.10.1998 / 11:29:53 / cg"
a301eabbab46 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
  1704
!
a301eabbab46 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
  1705
a301eabbab46 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
  1706
generateWindowSpecMethodSourceFor:spec class:className selector:methodName
a301eabbab46 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
  1707
    |specArray str code category cls mthd specCode|
a301eabbab46 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
  1708
2276
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  1709
    specArray := spec literalArrayEncoding.
2197
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1710
3327
dd50ec5f3c86 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
  1711
    str  := WriteStream on:''.
3031
a301eabbab46 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
  1712
    UISpecification prettyPrintSpecArray:specArray on:str indent:4.
464
Claus Gittinger <cg@exept.de>
parents: 458
diff changeset
  1713
    specCode := str contents.
457
0b39d43d4324 care for exclas in spec-code
Claus Gittinger <cg@exept.de>
parents: 445
diff changeset
  1714
0b39d43d4324 care for exclas in spec-code
Claus Gittinger <cg@exept.de>
parents: 445
diff changeset
  1715
    (specCode includes:$!!) ifTrue:[
2197
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1716
        "/ oops - must be chunk format ...
3327
dd50ec5f3c86 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 3314
diff changeset
  1717
        str  := WriteStream on:''.
2197
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1718
        str nextPutAllAsChunk:specCode.
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1719
        specCode := str contents.
457
0b39d43d4324 care for exclas in spec-code
Claus Gittinger <cg@exept.de>
parents: 445
diff changeset
  1720
    ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1721
178
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
  1722
    "/ 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
  1723
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
  1724
    category := 'interface specs'.
330
ca
parents: 327
diff changeset
  1725
    cls := self resolveName:className.
ca
parents: 327
diff changeset
  1726
ca
parents: 327
diff changeset
  1727
    cls notNil ifTrue:[
2197
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1728
        (mthd := cls class compiledMethodAt:methodName asSymbol) notNil ifTrue:[
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1729
            category := mthd category.
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1730
        ]
178
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
  1731
    ].
fb8451053c96 keep windowSpec methods category if it already exists
Claus Gittinger <cg@exept.de>
parents: 175
diff changeset
  1732
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
  1733
    code := '!!'
2197
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1734
            , className , ' class methodsFor:' , category storeString
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1735
            , '!!' , '\\'
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1736
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1737
            , methodName , '\'
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1738
            , ((ResourceSpecEditor codeGenerationCommentForClass: UIPainter) replChar:$!! withString:'!!!!')
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1739
            , '\\    "\'
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1740
            , ('     UIPainter new openOnClass:' , className , ' andSelector:#' , methodName , '\').
1013
c6428ebd2f0d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1741
1050
355a8ff451b6 care for as-yet-unspecified class in show-spec menu item.
Claus Gittinger <cg@exept.de>
parents: 1039
diff changeset
  1742
    (cls notNil and:[cls isSubclassOf:ApplicationModel]) ifTrue:[
2197
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1743
        code := code
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1744
            , ('     ' , className , ' new openInterface:#' , methodName , '\').
1013
c6428ebd2f0d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1745
    ].
c6428ebd2f0d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1746
c6428ebd2f0d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 995
diff changeset
  1747
    code := code
2197
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1748
            ,(methodName = 'windowSpec'
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1749
                ifTrue:['     ' , className , ' open\'] ifFalse: [''])
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1750
            , '    "\'.
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1751
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1752
    code := code
2197
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1753
            , '\'
3223
38d493fcc782 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3136
diff changeset
  1754
            , '    <resource: #canvas>\\'.
38d493fcc782 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3136
diff changeset
  1755
    code := code withCRs.
38d493fcc782 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3136
diff changeset
  1756
    code := code
2197
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1757
            , '    ^ ' , specCode
3223
38d493fcc782 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3136
diff changeset
  1758
            , '\' withCRs
2197
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1759
            , '!! !!'
3223
38d493fcc782 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3136
diff changeset
  1760
            , '\\' withCRs.
38d493fcc782 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3136
diff changeset
  1761
38d493fcc782 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3136
diff changeset
  1762
    ^ code
1683
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1763
!
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1764
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1765
listOfAspects
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1766
    |cls aspects|
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1767
2276
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  1768
    listOfAspectsHolder notNil ifTrue:[
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  1769
        ^ listOfAspectsHolder value
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  1770
    ].
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  1771
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1772
    aspects := IdentitySet new.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1773
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1774
    cls := self targetClass.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1775
    cls notNil ifTrue:[
2265
f6fbbcdd3764 still debugging replaceBy:
Claus Gittinger <cg@exept.de>
parents: 2257
diff changeset
  1776
        cls withAllSuperclassesDo:[:cls |
f6fbbcdd3764 still debugging replaceBy:
Claus Gittinger <cg@exept.de>
parents: 2257
diff changeset
  1777
            cls methodsDo:[:m |
3293
911a495e2ed7 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1778
                ((m resources ? #()) includes:#uiAspect) ifTrue:[
2265
f6fbbcdd3764 still debugging replaceBy:
Claus Gittinger <cg@exept.de>
parents: 2257
diff changeset
  1779
                    aspects add:m selector
f6fbbcdd3764 still debugging replaceBy:
Claus Gittinger <cg@exept.de>
parents: 2257
diff changeset
  1780
                ].                  
f6fbbcdd3764 still debugging replaceBy:
Claus Gittinger <cg@exept.de>
parents: 2257
diff changeset
  1781
            ]
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1782
        ]
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1783
    ].
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1784
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1785
    treeView propertiesDo:[:aProp|
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1786
        |modelSelector|
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1787
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1788
        (modelSelector := aProp model) notNil ifTrue:[
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1789
            aspects add:modelSelector asSymbol
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1790
        ].
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1791
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1792
"/        aspects addAll:aProp spec actionSelectors.
2250
e65b8bf6224b care for non-symbolic aspects (false)
Claus Gittinger <cg@exept.de>
parents: 2248
diff changeset
  1793
e65b8bf6224b care for non-symbolic aspects (false)
Claus Gittinger <cg@exept.de>
parents: 2248
diff changeset
  1794
        aspects addAll:(aProp spec valueSelectors select:[:a | a isString or:[a isSymbol]]).
e65b8bf6224b care for non-symbolic aspects (false)
Claus Gittinger <cg@exept.de>
parents: 2248
diff changeset
  1795
        aspects addAll:(aProp spec aspectSelectors select:[:a | a isString or:[a isSymbol]]).
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1796
    ].
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1797
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1798
    ^ aspects asOrderedCollection sort.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1799
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1800
    "Created: / 12-01-2008 / 19:24:45 / cg"
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1801
!
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1802
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1803
listOfCallbacks
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1804
    |cls aspects|
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1805
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1806
    aspects := IdentitySet new.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1807
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1808
    cls := self targetClass.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1809
    cls notNil ifTrue:[
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1810
        cls methodsDo:[:m |
3293
911a495e2ed7 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
  1811
            ((m resources ? #()) includes:#uiCallback) ifTrue:[
2244
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1812
                aspects add:m selector
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1813
            ].                  
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1814
        ]
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1815
    ].
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1816
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1817
    treeView propertiesDo:[:aProp|
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1818
        |modelSelector|
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1819
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1820
        aspects addAll:aProp spec actionSelectors.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1821
"/        aspects addAll:aProp spec valueSelectors.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1822
"/        aspects addAll:aProp spec aspectSelectors.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1823
    ].
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1824
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1825
    ^ aspects asOrderedCollection sort.
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1826
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1827
    "Created: / 12-01-2008 / 19:25:19 / cg"
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1828
!
580cac31c444 changed #initialize
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  1829
1683
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1830
targetClass
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1831
    |cls|
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1832
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1833
    className isNil ifTrue:[
2248
720b0784c6f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2244
diff changeset
  1834
        self warn:'No TargetClass defined !!'.
720b0784c6f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2244
diff changeset
  1835
        ^ nil
1683
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1836
    ].
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1837
    (cls := self resolveName:className) isNil ifTrue:[
2248
720b0784c6f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2244
diff changeset
  1838
"/        self warn:('Class ', className asString, ' does not exist !!').
720b0784c6f2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2244
diff changeset
  1839
        ^ nil
1683
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1840
    ].
f95658463570 added selective aspect method generation.
Claus Gittinger <cg@exept.de>
parents: 1671
diff changeset
  1841
    ^ cls.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1842
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1843
754
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1844
!UIPainterView methodsFor:'grid manipulation'!
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1845
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1846
newGrid
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1847
    "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
  1848
     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
  1849
     clears the view and redraws all visible objects."
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1850
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1851
    |defaultViewBackground|
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1852
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1853
    gridPixmap := nil.
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1854
    defaultViewBackground := self class defaultViewBackgroundColor.
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1855
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1856
    shown ifTrue:[
3083
0d6e497eb85f class: UIPainterView
Stefan Vogel <sv@exept.de>
parents: 3067
diff changeset
  1857
        self viewBackground: (defaultViewBackground isColor
0d6e497eb85f class: UIPainterView
Stefan Vogel <sv@exept.de>
parents: 3067
diff changeset
  1858
            ifTrue: [defaultViewBackground]
0d6e497eb85f class: UIPainterView
Stefan Vogel <sv@exept.de>
parents: 3067
diff changeset
  1859
            ifFalse:[self blackColor]).
0d6e497eb85f class: UIPainterView
Stefan Vogel <sv@exept.de>
parents: 3067
diff changeset
  1860
        self clear.
754
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1861
    ].
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1862
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1863
    gridShown ifTrue:[
3083
0d6e497eb85f class: UIPainterView
Stefan Vogel <sv@exept.de>
parents: 3067
diff changeset
  1864
        self defineGrid.
0d6e497eb85f class: UIPainterView
Stefan Vogel <sv@exept.de>
parents: 3067
diff changeset
  1865
        gridPixmap colorMap: (defaultViewBackground isColor
0d6e497eb85f class: UIPainterView
Stefan Vogel <sv@exept.de>
parents: 3067
diff changeset
  1866
            ifTrue: [Array with:defaultViewBackground with:Color darkGray]
0d6e497eb85f class: UIPainterView
Stefan Vogel <sv@exept.de>
parents: 3067
diff changeset
  1867
            ifFalse:[Array with:self whiteColor with:self blackColor]).
0d6e497eb85f class: UIPainterView
Stefan Vogel <sv@exept.de>
parents: 3067
diff changeset
  1868
        self viewBackground:gridPixmap.
754
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1869
    ].
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1870
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1871
    self invalidate
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1872
! !
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  1873
1832
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1874
!UIPainterView methodsFor:'group & ungroup'!
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1875
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1876
group
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1877
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1878
    self groupSelectionWithLayout: false
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1879
!
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1880
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1881
groupSelectionWithLayout: withLayout
2392
ca
parents: 2390
diff changeset
  1882
    |minViews specs spec menu newView target keepLyt keepPos rectangle|
ca
parents: 2390
diff changeset
  1883
ca
parents: 2390
diff changeset
  1884
    self canGroup ifFalse:[^ self ].
ca
parents: 2390
diff changeset
  1885
ca
parents: 2390
diff changeset
  1886
    keepLyt := withLayout.
ca
parents: 2390
diff changeset
  1887
    keepPos := true.
1832
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1888
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1889
    menu := Menu new.
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1890
    menu receiver: self.
3021
3cdebdf0071d class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 2997
diff changeset
  1891
    menu addItem:(MenuItem label:'Box' itemValue:[spec := ViewSpec new]).
3cdebdf0071d class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 2997
diff changeset
  1892
    menu addItem:(MenuItem label:'TBox' itemValue:[spec := TBoxSpec new]).
3cdebdf0071d class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 2997
diff changeset
  1893
    menu addItem:(MenuItem label:'FramedBox' itemValue:[spec := FramedBoxSpec new]).
3cdebdf0071d class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 2997
diff changeset
  1894
3cdebdf0071d class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 2997
diff changeset
  1895
    menu addItem:(MenuItem 
3cdebdf0071d class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 2997
diff changeset
  1896
                    label:'HorizontalPanel'
3cdebdf0071d class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 2997
diff changeset
  1897
                    itemValue:[
2392
ca
parents: 2390
diff changeset
  1898
                        keepLyt := keepPos := false.
ca
parents: 2390
diff changeset
  1899
                        spec := HorizontalPanelViewSpec new.
ca
parents: 2390
diff changeset
  1900
                        spec verticalLayout: #fit.
ca
parents: 2390
diff changeset
  1901
                        spec horizontalLayout: #leftSpace.
ca
parents: 2390
diff changeset
  1902
                    ]).
3021
3cdebdf0071d class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 2997
diff changeset
  1903
    menu addItem:(MenuItem 
3cdebdf0071d class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 2997
diff changeset
  1904
                    label:'VerticalPanel'
3cdebdf0071d class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 2997
diff changeset
  1905
                    itemValue:[
2392
ca
parents: 2390
diff changeset
  1906
                        keepLyt := keepPos := false.
ca
parents: 2390
diff changeset
  1907
                        spec := VerticalPanelViewSpec new.
ca
parents: 2390
diff changeset
  1908
                        spec verticalLayout: #topSpace.
ca
parents: 2390
diff changeset
  1909
                        spec horizontalLayout: #fit.
ca
parents: 2390
diff changeset
  1910
                    ]).
ca
parents: 2390
diff changeset
  1911
ca
parents: 2390
diff changeset
  1912
    menu startUp.
ca
parents: 2390
diff changeset
  1913
    spec isNil ifTrue:[^ self].
ca
parents: 2390
diff changeset
  1914
ca
parents: 2390
diff changeset
  1915
    minViews := self minClosedViewSetFor:(self selection).
ca
parents: 2390
diff changeset
  1916
    minViews size > 1 ifFalse:[^ self].
ca
parents: 2390
diff changeset
  1917
ca
parents: 2390
diff changeset
  1918
    specs     := OrderedCollection new.
ca
parents: 2390
diff changeset
  1919
    rectangle := minViews first frame copy.
ca
parents: 2390
diff changeset
  1920
ca
parents: 2390
diff changeset
  1921
    minViews do:[:eachView|
ca
parents: 2390
diff changeset
  1922
        specs add:(self fullSpecWithAbsolutePositionFor:eachView).
ca
parents: 2390
diff changeset
  1923
        rectangle := rectangle quickMerge:(eachView frame).
1832
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1924
    ].
2392
ca
parents: 2390
diff changeset
  1925
    spec layout:rectangle.
ca
parents: 2390
diff changeset
  1926
ca
parents: 2390
diff changeset
  1927
    target := self findContainerOfView:(minViews first).
ca
parents: 2390
diff changeset
  1928
ca
parents: 2390
diff changeset
  1929
    self withinTransaction:#group objects:(Array with:target) do:[ |widgets|
ca
parents: 2390
diff changeset
  1930
        self deleteSelectionBuffered:false.
ca
parents: 2390
diff changeset
  1931
ca
parents: 2390
diff changeset
  1932
        spec otherAttributeAt:#uiPainterAttributes put:(Dictionary new
ca
parents: 2390
diff changeset
  1933
                at:#origin put:(rectangle origin);
ca
parents: 2390
diff changeset
  1934
                at:#extent put:(rectangle extent);
ca
parents: 2390
diff changeset
  1935
                at:#absOrigin put:(rectangle origin);
ca
parents: 2390
diff changeset
  1936
                yourself).
ca
parents: 2390
diff changeset
  1937
ca
parents: 2390
diff changeset
  1938
        newView := self pasteSpecifications:(Array with:spec) 
ca
parents: 2390
diff changeset
  1939
                    into:target
ca
parents: 2390
diff changeset
  1940
                    keepLayout:true
ca
parents: 2390
diff changeset
  1941
                    keepPosition:true
ca
parents: 2390
diff changeset
  1942
                    at:#keep.
ca
parents: 2390
diff changeset
  1943
ca
parents: 2390
diff changeset
  1944
        widgets := self pasteSpecifications:specs
ca
parents: 2390
diff changeset
  1945
                into:newView
ca
parents: 2390
diff changeset
  1946
                keepLayout:keepLyt
ca
parents: 2390
diff changeset
  1947
                keepPosition:keepPos
ca
parents: 2390
diff changeset
  1948
                at:nil.
1832
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1949
    ].
2392
ca
parents: 2390
diff changeset
  1950
    self select:newView.
1832
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1951
!
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1952
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1953
groupWithLayout
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1954
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1955
    self groupSelectionWithLayout: true
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1956
!
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1957
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1958
ungroup
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1959
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1960
    self ungroupSelectionWithLayout: false
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1961
!
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1962
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1963
ungroupSelectionWithLayout: withLayout
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1964
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1965
    | canvas cS views specs frame view layout superView|
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1966
2392
ca
parents: 2390
diff changeset
  1967
    self canUngroup ifFalse:[^ self ].
ca
parents: 2390
diff changeset
  1968
1832
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1969
    canvas := self painter.
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1970
    cS := canvas getSelectedViewsAndSpecs.
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1971
    cS isNil ifTrue:[^self].
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1972
    views := cS first first subViews copy.
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1973
    superView := cS first first superView.
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1974
    cS last first component isNil ifTrue:[^self].
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1975
    cS last first component collection isEmpty ifTrue:[^self].
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1976
    specs := cS last first component collection copy.
1832
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1977
    frame := cS first first frame.
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1978
    canvas deleteSelection.
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1979
    withLayout ifFalse:[
2392
ca
parents: 2390
diff changeset
  1980
        1 to: specs size do:[:i|
ca
parents: 2390
diff changeset
  1981
            view := views at: i.
ca
parents: 2390
diff changeset
  1982
            layout :=  LayoutFrame leftFraction:0.0 offset: (view origin x + frame origin x)
ca
parents: 2390
diff changeset
  1983
                                  rightFraction:0.0 offset: (view corner x + frame origin x + 1)
ca
parents: 2390
diff changeset
  1984
                                    topFraction:0.0 offset: (view origin y + frame origin y )
ca
parents: 2390
diff changeset
  1985
                                 bottomFraction:0.0 offset: (view corner y + frame origin y + 1).
ca
parents: 2390
diff changeset
  1986
            (specs at: i) layout: layout.
ca
parents: 2390
diff changeset
  1987
        ].
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  1988
    ].
1832
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1989
    canvas selection: superView.
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1990
    canvas pasteSpecifications:specs keepLayout:true.
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1991
    canvas selection: superView.
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1992
!
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1993
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1994
ungroupWithLayout
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1995
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1996
    self ungroupSelectionWithLayout: true
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1997
! !
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  1998
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  1999
!UIPainterView methodsFor:'initialization'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2000
770
96f106b0a61e set color on device
ca
parents: 768
diff changeset
  2001
create
1959
fd6bf76e712a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1954
diff changeset
  2002
    "colors on device"
fd6bf76e712a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1954
diff changeset
  2003
    
770
96f106b0a61e set color on device
ca
parents: 768
diff changeset
  2004
    super create.
3262
3168fe296011 device access
Claus Gittinger <cg@exept.de>
parents: 3249
diff changeset
  2005
    handleColorBlack := handleColorBlack onDevice:device.
3168fe296011 device access
Claus Gittinger <cg@exept.de>
parents: 3249
diff changeset
  2006
    handleColorWhite := handleColorWhite onDevice:device.
3168fe296011 device access
Claus Gittinger <cg@exept.de>
parents: 3249
diff changeset
  2007
    handleMasterColor := handleMasterColor onDevice:device.
770
96f106b0a61e set color on device
ca
parents: 768
diff changeset
  2008
!
96f106b0a61e set color on device
ca
parents: 768
diff changeset
  2009
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2010
initialize
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  2011
    "setup attributes
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  2012
    "
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2013
    super initialize.
770
96f106b0a61e set color on device
ca
parents: 768
diff changeset
  2014
    superclassName    := 'ApplicationModel'.
96f106b0a61e set color on device
ca
parents: 768
diff changeset
  2015
    className         := 'NewApplication'.
96f106b0a61e set color on device
ca
parents: 768
diff changeset
  2016
    methodName        := 'windowSpec'.
96f106b0a61e set color on device
ca
parents: 768
diff changeset
  2017
    categoryName      := 'Applications'.
96f106b0a61e set color on device
ca
parents: 768
diff changeset
  2018
    HandCursor        := Cursor leftHand.
3314
a2f087b57f90 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 3304
diff changeset
  2019
    handleColorBlack  := self blackColor.
a2f087b57f90 #OTHER by stefan
Stefan Vogel <sv@exept.de>
parents: 3304
diff changeset
  2020
    handleColorWhite  := self whiteColor.
770
96f106b0a61e set color on device
ca
parents: 768
diff changeset
  2021
    handleMasterColor := Color red.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2022
712
bf8aa59e82b6 user friendly names
tz
parents: 708
diff changeset
  2023
    self backgroundColor: self class defaultViewBackgroundColor.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2024
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2025
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2026
setupFromSpec:specOrSpecArray
2197
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  2027
    |spec builder specWindow|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2028
784
9ae2b94658e5 wait cursor
tz
parents: 776
diff changeset
  2029
    Cursor wait showWhile: [
2197
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  2030
        self removeAll.
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  2031
        specOrSpecArray notNil ifTrue:[
2526
29b49d1b4d53 selection handling
Claus Gittinger <cg@exept.de>
parents: 2515
diff changeset
  2032
            spec := UISpecification from:specOrSpecArray.
2197
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  2033
        ].
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  2034
        builder := UIBuilder new isEditing:true.
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  2035
        "set applicationClass, in order that subspecifications may be resolved"
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  2036
        className notNil ifTrue:[
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  2037
            builder applicationClass:(self resolveName:className).
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  2038
        ].
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  2039
        spec notNil ifTrue:[
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  2040
            specWindow := spec window.
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  2041
        ].
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  2042
        specWindow notNil ifTrue:[
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  2043
            specWindow setupView:self topView for:builder.
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  2044
            self addSpec:(spec component) builder:builder in:self.
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  2045
        ].
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  2046
        self realizeAllSubViews.
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  2047
        specWindow notNil ifTrue:[
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  2048
            treeView setAttributesFromWindowSpec:specWindow
873c7b960233 slightly refactored to allow for more redefinition in a subclass
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  2049
        ].
1671
493e0430518e no longer use InputView
ca
parents: 1664
diff changeset
  2050
    ].
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2051
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2052
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2053
treeView:aTreeView
361
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
  2054
    treeView := aTreeView.
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
  2055
3557
d124916e2e4d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3554
diff changeset
  2056
    "I want to see the events of the treeView"
361
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
  2057
    treeView delegate:(
3557
d124916e2e4d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3554
diff changeset
  2058
        "/
d124916e2e4d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3554
diff changeset
  2059
        "/ I want to handle everything typed
d124916e2e4d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3554
diff changeset
  2060
        "/ in the treeView, except for Return and Cursor-keys
d124916e2e4d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3554
diff changeset
  2061
        "/
d124916e2e4d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3554
diff changeset
  2062
        KeyboardForwarder
d124916e2e4d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3554
diff changeset
  2063
            toView:self
d124916e2e4d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3554
diff changeset
  2064
            condition:nil
d124916e2e4d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3554
diff changeset
  2065
            filter:[:k | (k isSymbol
d124916e2e4d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3554
diff changeset
  2066
                         and:[k ~~ #Return
d124916e2e4d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3554
diff changeset
  2067
                         and:[k ~~ #Tab
d124916e2e4d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3554
diff changeset
  2068
                         and:[(k startsWith:#Cursor) not]]])
d124916e2e4d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3554
diff changeset
  2069
                   ]
361
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
  2070
    )
6624bb5d9a1a configuration of grid parameters
ca
parents: 352
diff changeset
  2071
376
3023fc08ee35 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 361
diff changeset
  2072
    "Modified: / 31.10.1997 / 20:22:09 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2073
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2074
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2075
!UIPainterView methodsFor:'menus'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2076
121
96d6feeeb049 middleButtonMen:
ca
parents: 119
diff changeset
  2077
showMiddleButtonMenu
2191
88d55c87942d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2180
diff changeset
  2078
    "show the middle button menu; this returns nil"
1635
116bf6f0ff62 can now specify if menu action is to be performed by
ca
parents: 1621
diff changeset
  2079
116bf6f0ff62 can now specify if menu action is to be performed by
ca
parents: 1621
diff changeset
  2080
    |m|
116bf6f0ff62 can now specify if menu action is to be performed by
ca
parents: 1621
diff changeset
  2081
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2082
    self enabled ifTrue:[
2191
88d55c87942d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2180
diff changeset
  2083
        m := MenuPanel fromSpec:(UIPainter menuEdit) receiver:self superView application.
88d55c87942d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2180
diff changeset
  2084
        self startUpMenu:m
111
ca
parents: 103
diff changeset
  2085
    ].
2191
88d55c87942d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2180
diff changeset
  2086
    ^ nil
88d55c87942d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2180
diff changeset
  2087
88d55c87942d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2180
diff changeset
  2088
    "Modified: / 31-10-2007 / 11:10:10 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2089
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2090
1714
f57812a56d17 method category rename
Claus Gittinger <cg@exept.de>
parents: 1696
diff changeset
  2091
!UIPainterView methodsFor:'private-handles'!
754
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  2092
1832
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  2093
painter
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  2094
    ^ treeView canvas
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  2095
!
ba152306fbf5 group & ungroup
werner
parents: 1830
diff changeset
  2096
754
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  2097
showSelected:aComponent
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  2098
    "show object selected
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  2099
    "
2537
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
  2100
    |wasClipped sel hInsideColor hOutsideColor bg|
754
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  2101
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  2102
    selectionHiddenLevel == 0 ifTrue:[
2499
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2103
        sel := treeView selection.
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2104
        (sel size > 1 and: [(treeView model list at: sel first) contents view == aComponent])
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2105
        ifTrue: [
2537
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
  2106
            hInsideColor := handleMasterColor.
2499
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2107
        ] ifFalse:[
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2108
            bg := aComponent viewBackground.
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2109
            bg isColor ifTrue:[
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2110
                bg brightness < 0.5 ifTrue:[
2537
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
  2111
                    hInsideColor := handleColorWhite
2499
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2112
                ] ifFalse:[
2537
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
  2113
                    hInsideColor := handleColorBlack
2499
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2114
                ]
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2115
            ] ifFalse:[
2537
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
  2116
                hInsideColor := handleColorBlack
2499
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2117
            ]
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2118
        ].
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2119
2537
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
  2120
        hInsideColor brightness < 0.5 ifTrue:[
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
  2121
            hOutsideColor := handleColorWhite
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
  2122
        ] ifFalse:[
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
  2123
            hOutsideColor := handleColorBlack
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
  2124
        ].
2499
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2125
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2126
        (wasClipped := clipChildren) ifTrue:[
3387
462d9e0dea1f #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  2127
            gc clippedByChildren:(clipChildren := false).
2499
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2128
        ].
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2129
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2130
        self handlesOf:aComponent do:[:aRectangle :what| 
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2131
            |l t w h|
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2132
2537
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
  2133
            l := aRectangle left.
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
  2134
            t := aRectangle top.
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
  2135
            w := aRectangle width.
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
  2136
            h := aRectangle height.
12e3b32befe4 handle changes
Claus Gittinger <cg@exept.de>
parents: 2526
diff changeset
  2137
3387
462d9e0dea1f #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  2138
            gc paint:hOutsideColor.
462d9e0dea1f #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  2139
            gc displayRectangleX:l y:t width:w height:h.
462d9e0dea1f #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  2140
462d9e0dea1f #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  2141
            gc paint:hInsideColor.
2499
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2142
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2143
            what == #view ifTrue:[
3387
462d9e0dea1f #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  2144
                gc displayRectangleX:l+1 y:t+1 width:w-2 height:h-2
2499
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2145
            ] ifFalse:[
3387
462d9e0dea1f #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  2146
                gc fillRectangleX:l+1 y:t+1 width:w-2 height:h-2
2499
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2147
            ]
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2148
        ].
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2149
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2150
        wasClipped ifTrue:[
3387
462d9e0dea1f #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 3360
diff changeset
  2151
            gc clippedByChildren:(clipChildren := true).
2499
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2152
        ]
754
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  2153
    ]
1543
bg
parents: 1520
diff changeset
  2154
bg
parents: 1520
diff changeset
  2155
    "Modified: / 6.12.2001 / 00:00:16 / cg"
754
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  2156
! !
04e802a6a920 color master selection in red + grid background colored
tz
parents: 744
diff changeset
  2157
335
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
  2158
!UIPainterView methodsFor:'queries'!
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
  2159
2276
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  2160
isEditingSpecOnly
2583
5f737789adee changed #isEditingSpecOnly
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
  2161
    "/ should not be invoked
2421
2504941c00c2 leftOver halt.
Claus Gittinger <cg@exept.de>
parents: 2396
diff changeset
  2162
    self breakPoint:#ca.
2582
f34eb91780f4 changed #isEditingSpecOnly
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  2163
    ^ false.
2276
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  2164
!
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  2165
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  2166
isNotEditingSpecOnly
2583
5f737789adee changed #isEditingSpecOnly
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
  2167
    "/ should not be invoked
2421
2504941c00c2 leftOver halt.
Claus Gittinger <cg@exept.de>
parents: 2396
diff changeset
  2168
    self breakPoint:#ca.
2583
5f737789adee changed #isEditingSpecOnly
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
  2169
    ^ true.
2276
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  2170
!
485bda17023f more changes to allow for non-class/selector (i.e. spec-only) use
Claus Gittinger <cg@exept.de>
parents: 2265
diff changeset
  2171
335
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
  2172
resolveName:aName
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
  2173
    |appl|
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
  2174
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
  2175
    appl := self application.
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
  2176
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
  2177
    appl notNil ifTrue:[
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  2178
	^ appl resolveName:aName
335
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
  2179
    ].
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
  2180
    ^ Smalltalk resolveName:aName inClass:self class
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
  2181
! !
9f048ededd7d resolveName:
ca
parents: 330
diff changeset
  2182
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2183
!UIPainterView methodsFor:'removing components'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2184
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2185
remove:anObject
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2186
    "remove anObject from the contents do redraw
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2187
    "
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2188
    anObject notNil ifTrue:[
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  2189
	treeView removeView:anObject.
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2190
    ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2191
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2192
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2193
removeAll
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  2194
    "remove all objects and properties
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  2195
    "
776
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
  2196
    self select:nil.
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
  2197
    treeView removeAll.
1df0525eeec9 reuse methods provided by the model
ca
parents: 770
diff changeset
  2198
    self removeUndoHistory.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2199
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2200
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2201
!UIPainterView methodsFor:'searching'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2202
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2203
findContainerOfView:aView
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2204
    "returns the super view assigned to a view
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
  2205
    "
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2206
    |p|
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
  2207
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2208
    (p := self propertyOfParentForView:aView) isNil ifTrue:[
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  2209
	^ self
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
  2210
    ].
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2211
    ^ p view
89
35c5711729c2 so far so good
ca
parents: 86
diff changeset
  2212
!
35c5711729c2 so far so good
ca
parents: 86
diff changeset
  2213
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2214
findObjectAt:aPoint
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2215
    |view prop|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2216
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2217
    view := super findObjectAt:aPoint.
2499
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2218
    view isNil ifTrue:[^ nil].
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2219
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2220
    "/ stupid check, if I know about this view
1870
771fcc38ecb8 set selection interface changed
ca
parents: 1869
diff changeset
  2221
    prop := self propertyOfView:view.
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2222
    prop notNil ifTrue:[^ prop view].
2963
7df17046fc89 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 2951
diff changeset
  2223
    self halt:'nil property'.
1870
771fcc38ecb8 set selection interface changed
ca
parents: 1869
diff changeset
  2224
    ^ nil
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2225
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2226
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2227
findViewWithId:aViewId
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  2228
    "finds view assigned to identifier and returns the view or nil
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2229
    "
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2230
    |prop|
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2231
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2232
    prop := self propertyOfIdentifier:aViewId.
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2233
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2234
    prop notNil ifTrue:[^ prop view]
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  2235
	       ifFalse:[^ nil]
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2236
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2237
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2238
propertyOfIdentifier:anId
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2239
    "returns property assigned to unique identifier
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2240
    "
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2241
    anId notNil ifTrue:[
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  2242
	^ treeView propertyDetect:[:p| p identifier == anId ]
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2243
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2244
    ^ nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2245
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2246
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2247
propertyOfName:aString
2231
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2248
    "returns the property for a given widgets name (name in tree)"
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2249
111
ca
parents: 103
diff changeset
  2250
    |name|
ca
parents: 103
diff changeset
  2251
ca
parents: 103
diff changeset
  2252
    aString isNil ifFalse:[
2231
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2253
        name := aString string withoutSeparators.
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2254
        ^ treeView propertyDetect:[:p| p name = name ].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2255
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2256
    ^ nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2257
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2258
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2259
propertyOfParentForView:aSubView
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2260
    "returns the property of the parent or nil
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2261
    "
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2262
    |item|
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2263
1870
771fcc38ecb8 set selection interface changed
ca
parents: 1869
diff changeset
  2264
    (item := treeView detectItemCorespondingToView:aSubView) notNil ifTrue:[
771fcc38ecb8 set selection interface changed
ca
parents: 1869
diff changeset
  2265
        (item := item parent) notNil ifTrue:[^ item contents]
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2266
    ].
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2267
    ^ nil
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2268
!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2269
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2270
propertyOfView:aView
1870
771fcc38ecb8 set selection interface changed
ca
parents: 1869
diff changeset
  2271
    "detect the property for the argument, a view. The property of the view or
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2272
     the first subview providing the properties is returned. If no property is detected
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2273
     nil is returned.
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2274
    "
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2275
    |item|
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2276
1870
771fcc38ecb8 set selection interface changed
ca
parents: 1869
diff changeset
  2277
    item := treeView detectItemCorespondingToView:aView.
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2278
    (item notNil and:[item parent notNil]) ifTrue:[
1870
771fcc38ecb8 set selection interface changed
ca
parents: 1869
diff changeset
  2279
        ^ item contents
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2280
    ].
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2281
    ^ nil
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2282
!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2283
111
ca
parents: 103
diff changeset
  2284
uniqueNameFor:aSpecOrString
2231
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2285
    "generate and return a unique name for a specClass or an items name.
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2286
     (unique name in the tree)"
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2287
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2288
    |maxUsedIndex name nameLen|
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2289
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2290
    name := aSpecOrString isString 
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2291
                ifFalse:[aSpecOrString userFriendlyName]
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2292
                ifTrue:[aSpecOrString].
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2293
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2294
    nameLen := name size.
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2295
    maxUsedIndex := 0.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2296
238
882be7e03af4 renamed claus instVar (;-)
Claus Gittinger <cg@exept.de>
parents: 231
diff changeset
  2297
    treeView propertiesDo:[:p|
2231
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2298
        |thisName|
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2299
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2300
        thisName := p name.
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2301
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2302
        (thisName size > nameLen and:[thisName startsWith:name]) ifTrue:[
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2303
            maxUsedIndex := maxUsedIndex max:(p extractNumberStartingAt:nameLen+1)
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2304
        ]
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2305
    ].
2231
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2306
    ^ name, (maxUsedIndex+1) printString.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2307
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2308
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2309
uniqueNameOf:aView
111
ca
parents: 103
diff changeset
  2310
    |prop|
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2311
111
ca
parents: 103
diff changeset
  2312
    (prop := self propertyOfView:aView) notNil ifTrue:[
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  2313
	prop name isNil ifTrue:[
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  2314
	    prop name:(self uniqueNameFor:(prop spec)).
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  2315
	].
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  2316
	^ prop name
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2317
    ].
111
ca
parents: 103
diff changeset
  2318
    ^ 'self'
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2319
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2320
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2321
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2322
!UIPainterView methodsFor:'selection basics'!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2323
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2324
addToSelection:anObject
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2325
    "add an object to the selection
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2326
    "
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2327
    (self enabled and:[(self isSelected:anObject) not]) ifTrue:[
2257
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2328
        selection isCollection ifFalse:[
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2329
            selection isNil ifTrue:[
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2330
                selection := anObject
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2331
            ] ifFalse:[
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2332
                selection := OrderedCollection with:selection with:anObject
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2333
            ]
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2334
        ] ifTrue:[
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2335
            "/ to enforce the change-message (value is identical to oldValue)
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2336
            selection isList ifTrue:[
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2337
                selection add:anObject
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2338
            ] ifFalse:[
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2339
                selection := selection asOrderedCollection.
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2340
                selection := selection copyWith:anObject
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2341
            ]
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2342
        ].
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2343
        self showSelected:anObject.
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2344
        treeView canvasSelectionAdd:anObject.
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2345
    ]
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2346
1347
c4046d0b638e care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
  2347
    "Modified: / 11.2.2000 / 01:39:05 / cg"
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2348
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2349
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2350
removeFromSelection:anObject
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2351
    "remove an object from the selection
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2352
    "
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2353
    (self isSelected:anObject) ifTrue:[
2257
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2354
        self showUnselected:anObject.
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2355
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2356
        selection size > 1 ifTrue:[
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2357
            selection isList ifTrue:[
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2358
                selection remove:anObject ifAbsent:nil
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2359
            ] ifFalse:[
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2360
                "/ to enforce the change-message (value is identical to oldValue)
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2361
                selection := selection asOrderedCollection.
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2362
                selection := selection copyWithout:anObject
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2363
            ].
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2364
            self showSelection.
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2365
        ] ifFalse:[
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2366
            selection := nil
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2367
        ].
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2368
        treeView canvasSelectionRemove:anObject.
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2369
    ]
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2370
1347
c4046d0b638e care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 1338
diff changeset
  2371
    "Modified: / 11.2.2000 / 01:41:11 / cg"
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2372
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2373
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2374
select:something
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2375
    "change selection to something
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  2376
    "
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  2377
    (self enabled and:[something ~= self selection]) ifTrue:[
2257
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2378
        something isNil
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2379
            ifTrue: [treeView selection: (Array with: 1)]
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2380
            ifFalse:[treeView canvasSelection:something].
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2381
        self setSelection:something withRedraw:true
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2382
    ]
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2383
!
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2384
1830
78a5cf39dc0e nextUpInHier
werner
parents: 1805
diff changeset
  2385
selectNextUpInHierarchy
78a5cf39dc0e nextUpInHier
werner
parents: 1805
diff changeset
  2386
    | sel |
78a5cf39dc0e nextUpInHier
werner
parents: 1805
diff changeset
  2387
78a5cf39dc0e nextUpInHier
werner
parents: 1805
diff changeset
  2388
    (sel := self selection) isNil ifTrue:[^self].
78a5cf39dc0e nextUpInHier
werner
parents: 1805
diff changeset
  2389
    sel isCollection ifTrue:[
2257
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2390
        sel := self selection first.
1830
78a5cf39dc0e nextUpInHier
werner
parents: 1805
diff changeset
  2391
    ].
78a5cf39dc0e nextUpInHier
werner
parents: 1805
diff changeset
  2392
    sel := sel superView.
78a5cf39dc0e nextUpInHier
werner
parents: 1805
diff changeset
  2393
    sel isNil ifTrue:[^self].
2257
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2394
    treeView canvasSelection: sel.
1830
78a5cf39dc0e nextUpInHier
werner
parents: 1805
diff changeset
  2395
    self selection: sel.
78a5cf39dc0e nextUpInHier
werner
parents: 1805
diff changeset
  2396
!
78a5cf39dc0e nextUpInHier
werner
parents: 1805
diff changeset
  2397
2392
ca
parents: 2390
diff changeset
  2398
selectedNodes
ca
parents: 2390
diff changeset
  2399
    ^ treeView model selectedNodes
ca
parents: 2390
diff changeset
  2400
!
ca
parents: 2390
diff changeset
  2401
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2402
updateSelectionFromModel:aSelOrNil
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2403
    "update selection from a new selection
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2404
    "
1427
85b9b5da0b8d optimize: undraw selection
ca
parents: 1402
diff changeset
  2405
    |list|
768
2ef5b8bed914 catch expose events when unselecting
ca
parents: 760
diff changeset
  2406
2180
0912680e1fa7 changed #updateSelectionFromModel:
ab
parents: 2116
diff changeset
  2407
    "/ do not return here if not shown - we NEED the correct selection
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2408
    selectionHiddenLevel == 0 ifTrue:[
2039
d91eaf783502 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  2409
        aSelOrNil size ~~ 0 ifTrue:[
d91eaf783502 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  2410
            list := OrderedCollection new.
d91eaf783502 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  2411
d91eaf783502 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  2412
            self selectionDo:[:el|
d91eaf783502 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  2413
                (aSelOrNil includes:el) ifFalse:[list add:el]
d91eaf783502 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  2414
            ].
2180
0912680e1fa7 changed #updateSelectionFromModel:
ab
parents: 2116
diff changeset
  2415
            self shown ifTrue:[self showUnselected:list].
2039
d91eaf783502 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  2416
        ] ifFalse:[
2180
0912680e1fa7 changed #updateSelectionFromModel:
ab
parents: 2116
diff changeset
  2417
            self shown ifTrue:[self hideSelection].
2039
d91eaf783502 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2024
diff changeset
  2418
        ]
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2419
    ].
2515
d77b8df4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
  2420
    self repairDamage.
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2421
    self setSelection:aSelOrNil withRedraw:false.
2515
d77b8df4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2509
diff changeset
  2422
    self showSelection.
223
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2423
! !
203460df426e change selection handling caused by new tree view
ca
parents: 219
diff changeset
  2424
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2425
!UIPainterView methodsFor:'specification'!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2426
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2427
addSpec:aSpecification builder:aBuilder in:aFrame
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2428
    "build view and subviews from aSpecification into a frame. The top view
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2429
     is returned. The contained components of a spec are set to nil
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2430
    "
2390
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2431
    ^ self addSpec:aSpecification builder:aBuilder in:aFrame beforeIndex:nil.
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2432
!
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2433
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2434
addSpec:aSpecification builder:aBuilder in:aFrame beforeIndex:anIndexOrNil
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2435
    "build view and subviews from aSpecification into a frame. The top view
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2436
     is returned. The contained components of a spec are set to nil
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2437
    "
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2438
    |cls newView viewPosition subviewToRealize|
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  2439
330
ca
parents: 327
diff changeset
  2440
    cls := self resolveName:className.
ca
parents: 327
diff changeset
  2441
ca
parents: 327
diff changeset
  2442
    cls notNil ifTrue:[
2226
5917585724c6 comment
Claus Gittinger <cg@exept.de>
parents: 2221
diff changeset
  2443
        aBuilder applicationClass:cls.
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  2444
    ].
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2445
2390
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2446
    (     anIndexOrNil notNil
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2447
     and:[anIndexOrNil between:1 and:(aFrame subViews size)]
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2448
    ) ifTrue:[
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2449
        viewPosition := anIndexOrNil.
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2450
    ].
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2451
2229
21727bdd8221 comment
Claus Gittinger <cg@exept.de>
parents: 2226
diff changeset
  2452
    "/ remember view<->spec associations to tree
2499
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2453
    aBuilder 
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2454
        componentCreationHook:[:aView :aSpec :builder|
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2455
            |newProperty copyOfSpec nameOfSpec beforeIndex|
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2456
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2457
            (viewPosition notNil and:[aSpecification == aSpec]) ifTrue:[
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2458
                subviewToRealize := aView.
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2459
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2460
                [ (subviewToRealize notNil and:[subviewToRealize superView ~~ aFrame]) ] whileTrue:[
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2461
                    subviewToRealize := subviewToRealize superView.
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2462
                ].
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2463
                subviewToRealize notNil ifTrue:[
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2464
                    beforeIndex := viewPosition.
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2465
                    aFrame changeSequenceOrderFor:subviewToRealize to:viewPosition.
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2466
                ].
2390
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2467
            ].
2499
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2468
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2469
            newProperty := ViewProperty new.
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2470
            copyOfSpec := aSpec copy.
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2471
            newProperty spec:copyOfSpec.
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2472
            newProperty view:aView.
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2473
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2474
            "/ break refs to child-specs
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2475
            "/ (not needed, as we keep the child info in the view hierarchy)
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2476
            copyOfSpec class supportsSubComponents ifTrue:[
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2477
                copyOfSpec component:nil
2390
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2478
            ].
2499
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2479
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2480
            nameOfSpec := copyOfSpec name.
2853
1eadca551eed changed:
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  2481
            "/ old: enforce a name
1eadca551eed changed:
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  2482
            "/ (nameOfSpec isNil or:[(self propertyOfName:nameOfSpec) notNil]) ifTrue:[
1eadca551eed changed:
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  2483
            "/     copyOfSpec name:(nameOfSpec := self uniqueNameFor:copyOfSpec)
1eadca551eed changed:
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  2484
            "/ ].
1eadca551eed changed:
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  2485
            "/ aView name:nameOfSpec.
1eadca551eed changed:
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  2486
            "/ new:
1eadca551eed changed:
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  2487
            (nameOfSpec isNil "notEmptyOrNil" or:[ (self propertyOfName:nameOfSpec) notNil]) ifTrue:[
1eadca551eed changed:
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  2488
                copyOfSpec name:(nameOfSpec := self uniqueNameFor:copyOfSpec).
1eadca551eed changed:
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  2489
                aView name:nameOfSpec.
2499
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2490
            ].
2853
1eadca551eed changed:
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  2491
            "/ end
1eadca551eed changed:
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  2492
2499
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2493
            treeView addProperty:newProperty beforeIndex:beforeIndex.
2390
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2494
        ].
2231
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2495
2390
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2496
    newView := aSpecification buildViewWithLayoutFor:aBuilder in:aFrame.
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2497
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2498
    subviewToRealize notNil ifTrue:[
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2499
        subviewToRealize realize.
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2500
2499
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2501
        aFrame components notEmptyOrNil ifTrue:[ self halt ].
2390
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2502
        aFrame subViews from:(viewPosition + 1 ) do:[:v|
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2503
            v shown ifTrue:[v raise]
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2504
        ].
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2505
    ].
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2506
    ^ newView
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2507
2853
1eadca551eed changed:
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  2508
    "Modified: / 17-08-2011 / 13:56:24 / cg"
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2509
!
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2510
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2511
fullSpecFor:aView
3031
a301eabbab46 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3021
diff changeset
  2512
    "generate a full spec for aView (or component)"
2526
29b49d1b4d53 selection handling
Claus Gittinger <cg@exept.de>
parents: 2515
diff changeset
  2513
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2514
    |mySpec subSpecs|
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2515
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2516
    mySpec := self specFor:aView.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2517
    (mySpec notNil and:[mySpec class supportsSubComponents]) ifTrue:[
2505
2d43dbc0e86c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2499
diff changeset
  2518
        subSpecs isNil ifTrue:[
2d43dbc0e86c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2499
diff changeset
  2519
            subSpecs := OrderedCollection new
2d43dbc0e86c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2499
diff changeset
  2520
        ].
2d43dbc0e86c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2499
diff changeset
  2521
2d43dbc0e86c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2499
diff changeset
  2522
        ((aView components ? #()) , (aView subViews ? #())) do:[:aSubViewOrComponent |
2d43dbc0e86c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2499
diff changeset
  2523
            |spec|
2d43dbc0e86c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2499
diff changeset
  2524
2d43dbc0e86c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2499
diff changeset
  2525
            spec := self fullSpecFor:aSubViewOrComponent.
2d43dbc0e86c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2499
diff changeset
  2526
            spec notNil ifTrue:[
2d43dbc0e86c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2499
diff changeset
  2527
                subSpecs add:spec.
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2528
            ].
2505
2d43dbc0e86c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2499
diff changeset
  2529
        ].
2d43dbc0e86c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2499
diff changeset
  2530
2d43dbc0e86c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2499
diff changeset
  2531
        subSpecs notEmptyOrNil ifTrue:[
2d43dbc0e86c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2499
diff changeset
  2532
            mySpec component:(SpecCollection new collection:subSpecs)
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2533
        ]
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2534
    ].
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2535
    ^ mySpec
3038
52374621e04b class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3031
diff changeset
  2536
52374621e04b class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3031
diff changeset
  2537
    "Modified: / 30-07-2013 / 09:12:18 / cg"
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2538
!
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2539
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2540
fullSpecWithAbsolutePositionFor:aView
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2541
    |spec|
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2542
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2543
    spec := self fullSpecFor:aView.
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2544
    spec 
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2545
        otherAttributeAt:#uiPainterAttributes 
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2546
        put:(Dictionary new
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2547
                at:#origin put:aView origin;
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2548
                at:#extent put:aView extent;
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2549
                at:#absOrigin put:(aView originRelativeTo:self);
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2550
                yourself).
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2551
    ^ spec
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2552
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2553
1173
7b5f40822819 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1092
diff changeset
  2554
rebuildView:aView fromSpec:aSpec withBuilder:aBuilderOrNil
2257
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2555
    self
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2556
        rebuildView:aView fromSpec:aSpec withBuilder:aBuilderOrNil forceNewView:false
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2557
!
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2558
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2559
rebuildView:aView fromSpec:aSpec withBuilder:aBuilderOrNil forceNewView:forceNewView
1173
7b5f40822819 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1092
diff changeset
  2560
    |v builder|
7b5f40822819 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1092
diff changeset
  2561
7b5f40822819 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1092
diff changeset
  2562
    (builder := aBuilderOrNil) isNil ifTrue:[
2257
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2563
        "/ create a dummy builder
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2564
        builder := UIBuilder new isEditing:true.
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2565
        className notNil ifTrue:[
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2566
            builder applicationClass:(self resolveName:className).
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2567
        ].
1173
7b5f40822819 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1092
diff changeset
  2568
    ].
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2569
1252
f886528c2b35 when changing a layoutContainer
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
  2570
    aSpec class isLayoutContainer ifTrue:[
2257
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2571
        "/ TODO:
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2572
        "/ go through subviews and let them resize to their default/preferred
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2573
        "/ needed if we change a containers layout from fit to non-fit.
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2574
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2575
        (aView subViews ? #()) do:[:aSubView |
2265
f6fbbcdd3764 still debugging replaceBy:
Claus Gittinger <cg@exept.de>
parents: 2257
diff changeset
  2576
            |fix spec prop container|
2257
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2577
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2578
            (prop := self propertyOfView:aSubView) notNil ifTrue:[
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2579
                spec := prop spec.
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2580
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2581
                spec useDefaultExtent ifTrue:[
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2582
                    fix := aSubView sizeFixed:false.
2265
f6fbbcdd3764 still debugging replaceBy:
Claus Gittinger <cg@exept.de>
parents: 2257
diff changeset
  2583
                    aView class == VerticalPanelView ifTrue:[
2348
a9c60093561a added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  2584
                        aSubView height:aSubView preferredHeight.
2265
f6fbbcdd3764 still debugging replaceBy:
Claus Gittinger <cg@exept.de>
parents: 2257
diff changeset
  2585
                    ] ifFalse:[
f6fbbcdd3764 still debugging replaceBy:
Claus Gittinger <cg@exept.de>
parents: 2257
diff changeset
  2586
                        aView class == HorizontalPanelView ifTrue:[
2348
a9c60093561a added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  2587
                            aSubView width:aSubView preferredWidth.
2265
f6fbbcdd3764 still debugging replaceBy:
Claus Gittinger <cg@exept.de>
parents: 2257
diff changeset
  2588
                        ] ifFalse:[
f6fbbcdd3764 still debugging replaceBy:
Claus Gittinger <cg@exept.de>
parents: 2257
diff changeset
  2589
                            aSubView extent:aSubView preferredExtent.
f6fbbcdd3764 still debugging replaceBy:
Claus Gittinger <cg@exept.de>
parents: 2257
diff changeset
  2590
                        ].
f6fbbcdd3764 still debugging replaceBy:
Claus Gittinger <cg@exept.de>
parents: 2257
diff changeset
  2591
                    ].
2257
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2592
                    aSubView sizeFixed:fix
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2593
                ]
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2594
            ]
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2595
        ].
1252
f886528c2b35 when changing a layoutContainer
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
  2596
    ].
f886528c2b35 when changing a layoutContainer
Claus Gittinger <cg@exept.de>
parents: 1230
diff changeset
  2597
2257
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2598
    (forceNewView or:[aSpec needsRebuildForAttributes]) ifTrue:[
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2599
        "/ needs a full rebuild (in case view class depends upon spec-attribute)
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2600
        v := aSpec buildViewWithLayoutFor:builder in:(self findContainerOfView:aView).
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2601
        v realize.
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2602
        aView destroy.
3083
0d6e497eb85f class: UIPainterView
Stefan Vogel <sv@exept.de>
parents: 3067
diff changeset
  2603
        self sync.
2257
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2604
        aView becomeSameAs:v.
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2605
        "/ inputView raise.
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2606
    ] ifFalse:[
2257
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2607
        aSpec setAttributesIn:aView with:builder.
badd429a2a2a code beautification; reasonable methodNames;
Claus Gittinger <cg@exept.de>
parents: 2250
diff changeset
  2608
        self elementChangedSize:aView.
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2609
    ].
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2610
!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2611
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2612
specFor:aView
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2613
    "returns a copy of the spec assigned to an object"
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2614
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2615
    |prop spec|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2616
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2617
    (prop := self propertyOfView:aView) isNil ifTrue:[^ nil].
3038
52374621e04b class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3031
diff changeset
  2618
    "/ attention: the above prop may be a superview's prop,
52374621e04b class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3031
diff changeset
  2619
    "/ for subviews which have not been built by me
52374621e04b class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3031
diff changeset
  2620
    "/ (for example, in a box with a given viewClass like Inspector,
52374621e04b class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3031
diff changeset
  2621
    "/ we would return the boxes spec for the subviews.
52374621e04b class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3031
diff changeset
  2622
    "/ This is definitely NOT what we want (as it generates wrong specs).
52374621e04b class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3031
diff changeset
  2623
    "/ therefore check:
52374621e04b class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3031
diff changeset
  2624
    prop view == aView ifFalse:[^ nil].
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2625
1744
c59a91953b64 paste with no container selected: search for a good one
Claus Gittinger <cg@exept.de>
parents: 1733
diff changeset
  2626
    spec := prop spec copy.
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2627
    spec layoutFromView:aView.
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2628
    ^ spec
3038
52374621e04b class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3031
diff changeset
  2629
52374621e04b class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 3031
diff changeset
  2630
    "Modified (comment): / 30-07-2013 / 09:47:51 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2631
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2632
146
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  2633
specForSelection
2526
29b49d1b4d53 selection handling
Claus Gittinger <cg@exept.de>
parents: 2515
diff changeset
  2634
    "returns the spec assigned to current single selection or nil.
29b49d1b4d53 selection handling
Claus Gittinger <cg@exept.de>
parents: 2515
diff changeset
  2635
     Nil is also returned for multiple selections (sigh)"
29b49d1b4d53 selection handling
Claus Gittinger <cg@exept.de>
parents: 2515
diff changeset
  2636
29b49d1b4d53 selection handling
Claus Gittinger <cg@exept.de>
parents: 2515
diff changeset
  2637
    |theSpec|
29b49d1b4d53 selection handling
Claus Gittinger <cg@exept.de>
parents: 2515
diff changeset
  2638
29b49d1b4d53 selection handling
Claus Gittinger <cg@exept.de>
parents: 2515
diff changeset
  2639
    theSpec := self specFor:(self singleSelection).
29b49d1b4d53 selection handling
Claus Gittinger <cg@exept.de>
parents: 2515
diff changeset
  2640
    theSpec isNil ifTrue:[
29b49d1b4d53 selection handling
Claus Gittinger <cg@exept.de>
parents: 2515
diff changeset
  2641
        treeView isCanvasSelected ifTrue:[
29b49d1b4d53 selection handling
Claus Gittinger <cg@exept.de>
parents: 2515
diff changeset
  2642
            theSpec := treeView canvasSpec.
29b49d1b4d53 selection handling
Claus Gittinger <cg@exept.de>
parents: 2515
diff changeset
  2643
        ]
29b49d1b4d53 selection handling
Claus Gittinger <cg@exept.de>
parents: 2515
diff changeset
  2644
    ].
29b49d1b4d53 selection handling
Claus Gittinger <cg@exept.de>
parents: 2515
diff changeset
  2645
    ^ theSpec
146
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  2646
!
ae84facd80be checkin from browser
ca
parents: 141
diff changeset
  2647
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2648
updateFromSpec:aSpec
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2649
    "update current selected view from specification
62
0e8573b4329a so far so good ...
ca
parents: 60
diff changeset
  2650
    "
1173
7b5f40822819 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1092
diff changeset
  2651
    |props name|
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2652
281
aabb4037f6a3 window spec
ca
parents: 279
diff changeset
  2653
    aSpec class == WindowSpec ifTrue:[
2499
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2654
         ^ treeView canvasSpec:aSpec
281
aabb4037f6a3 window spec
ca
parents: 279
diff changeset
  2655
    ].
aabb4037f6a3 window spec
ca
parents: 279
diff changeset
  2656
78
a0a00603a8b6 keep spec in properties
ca
parents: 75
diff changeset
  2657
    self singleSelection notNil ifTrue:[
2499
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2658
        self withSelectionHiddenDo:[
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2659
            self transaction:#specification selectionDo:[:aView|
2853
1eadca551eed changed:
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  2660
2499
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2661
                props   := self propertyOfView:aView.
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2662
                name    := (aSpec name) withoutSeparators.
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2663
2853
1eadca551eed changed:
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  2664
                name isNil ifTrue:[
1eadca551eed changed:
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  2665
                    "/ not yet given a name
1eadca551eed changed:
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  2666
                    (name ~= props name) ifTrue:[
1eadca551eed changed:
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  2667
                        (self propertyOfName:name) notNil ifTrue:[
1eadca551eed changed:
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  2668
                            name := props name
1eadca551eed changed:
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  2669
                        ]
1eadca551eed changed:
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  2670
                    ].
2499
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2671
                ].
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2672
                aSpec name:name.
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2673
                self createUndoSpecModify:props.
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2674
                self rebuildView:aView fromSpec:aSpec withBuilder:nil.
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2675
                props spec:(aSpec copy).
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2676
                treeView propertyChanged:props.
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2677
            ]
11be77599ca9 added component handling;
Claus Gittinger <cg@exept.de>
parents: 2494
diff changeset
  2678
        ]
82
99dc76d66eab checkin from browser
ca
parents: 80
diff changeset
  2679
    ]
212
1836a16763cc oops again
Claus Gittinger <cg@exept.de>
parents: 211
diff changeset
  2680
2853
1eadca551eed changed:
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  2681
    "Modified: / 17-08-2011 / 13:56:38 / cg"
1eadca551eed changed:
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  2682
    "Modified (format): / 18-08-2011 / 02:19:01 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2683
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2684
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2685
!UIPainterView methodsFor:'testing'!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2686
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2687
canChangeLayoutOfView:aView
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2688
    "returns true if the view can change its layout.
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2689
     This is dependent on its parent view."
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2690
2483
3edd36775899 Consider direct subviews of the cancas in canResizeView:
Stefan Vogel <sv@exept.de>
parents: 2480
diff changeset
  2691
    |item parent|
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2692
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2693
    item := treeView itemOfView:aView.
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2694
    item isNil ifTrue:[
3348
1028e3c18509 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3327
diff changeset
  2695
        "/ I don't know anything about that view (cg: how can this happen ?)
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2696
        "/ self breakPoint:#cg.
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2697
        ^ false
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2698
    ].
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2699
    parent := item parent.
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2700
    parent isNil ifTrue:[
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2701
        "/ that view has no parent (cg: does this mean its the canvas itself ?)
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2702
        "/ self breakPoint:#cg.
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2703
        ^ false
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2704
    ].
2483
3edd36775899 Consider direct subviews of the cancas in canResizeView:
Stefan Vogel <sv@exept.de>
parents: 2480
diff changeset
  2705
    parent contents view == self ifTrue:[
3edd36775899 Consider direct subviews of the cancas in canResizeView:
Stefan Vogel <sv@exept.de>
parents: 2480
diff changeset
  2706
        "aView is a direct subview of the canvas
3edd36775899 Consider direct subviews of the cancas in canResizeView:
Stefan Vogel <sv@exept.de>
parents: 2480
diff changeset
  2707
         -- and the canvas supports layout changes of its subviews"
3edd36775899 Consider direct subviews of the cancas in canResizeView:
Stefan Vogel <sv@exept.de>
parents: 2480
diff changeset
  2708
        ^ true.
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2709
    ].
2480
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2710
    ^ parent contents spec class isLayoutContainer not
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2711
!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2712
1230
23e5d0c133e8 added exchangeLayouts function
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
  2713
canExchangeSelectionLayouts
23e5d0c133e8 added exchangeLayouts function
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
  2714
    "returns true if the selection size is exactly 2
23e5d0c133e8 added exchangeLayouts function
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
  2715
     and all elements in the selection can be moved or aligned
23e5d0c133e8 added exchangeLayouts function
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
  2716
    "
2480
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2717
    selection size ~~ 2 ifTrue:[
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2718
        ^ false
1230
23e5d0c133e8 added exchangeLayouts function
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
  2719
    ].
23e5d0c133e8 added exchangeLayouts function
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
  2720
    ^ self canMoveOrAlignSelection
23e5d0c133e8 added exchangeLayouts function
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
  2721
!
23e5d0c133e8 added exchangeLayouts function
Claus Gittinger <cg@exept.de>
parents: 1225
diff changeset
  2722
2392
ca
parents: 2390
diff changeset
  2723
canGroup
ca
parents: 2390
diff changeset
  2724
    "test whether selected elements can be grouped; minimum two elements
ca
parents: 2390
diff changeset
  2725
     must be selected and all must have the same parent"
ca
parents: 2390
diff changeset
  2726
ca
parents: 2390
diff changeset
  2727
    |selectedNodes parent|
ca
parents: 2390
diff changeset
  2728
ca
parents: 2390
diff changeset
  2729
    selectedNodes := self selectedNodes.
ca
parents: 2390
diff changeset
  2730
ca
parents: 2390
diff changeset
  2731
    selectedNodes size < 2ifTrue:[ ^ false ].
ca
parents: 2390
diff changeset
  2732
ca
parents: 2390
diff changeset
  2733
    parent := selectedNodes first parent.
ca
parents: 2390
diff changeset
  2734
    parent isNil ifTrue:[ ^ false ].    "/ test whether not the canvas itself is selected
ca
parents: 2390
diff changeset
  2735
ca
parents: 2390
diff changeset
  2736
    selectedNodes do:[:each|
ca
parents: 2390
diff changeset
  2737
        each parent ~~ parent ifTrue:[^ false ].
ca
parents: 2390
diff changeset
  2738
    ].
ca
parents: 2390
diff changeset
  2739
ca
parents: 2390
diff changeset
  2740
    ^true
ca
parents: 2390
diff changeset
  2741
!
ca
parents: 2390
diff changeset
  2742
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2743
canKeepLayoutInSelection
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2744
    "returns true if layout can be kept during a paste operation
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2745
    "
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2746
    |prop|
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2747
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2748
    prop := self propertyOfView:(self singleSelection).
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2749
  ^ (prop isNil or:[prop spec class isLayoutContainer not])
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2750
!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2751
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2752
canMove:something
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2753
    "checks whether something is not nil and if all widgets derived from
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2754
     something can change their layout ( move, align, ... operation ).
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2755
    "
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2756
    something notNil ifTrue:[
3554
01fa81669da2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 3502
diff changeset
  2757
        something doIfNotNil:[:aView|
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2758
            (self canChangeLayoutOfView:aView) ifFalse:[^ false]
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2759
        ].
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2760
        ^ true
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2761
    ].
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2762
    ^ false
3554
01fa81669da2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 3502
diff changeset
  2763
01fa81669da2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 3502
diff changeset
  2764
    "Modified: / 11-04-2018 / 18:19:47 / stefan"
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2765
!
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2766
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2767
canMoveOrAlignSelection
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2768
    "returns true if a selection exists and all elements in the selection
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2769
     can be moved or aligned
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2770
    "
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2771
    ^ self canMove:(self selection)
2392
ca
parents: 2390
diff changeset
  2772
!
ca
parents: 2390
diff changeset
  2773
2480
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2774
canResize:something
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2775
    "checks whether something is not nil and if all widgets derived from
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2776
     something can be resized."
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2777
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2778
    something notNil ifTrue:[
3554
01fa81669da2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 3502
diff changeset
  2779
        something doIfNotNil:[:aView|
2480
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2780
            (self canResizeView:aView) ifFalse:[^ false]
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2781
        ].
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2782
        ^ true
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2783
    ].
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2784
    ^ false
3554
01fa81669da2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 3502
diff changeset
  2785
01fa81669da2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 3502
diff changeset
  2786
    "Modified: / 11-04-2018 / 18:20:09 / stefan"
2480
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2787
!
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2788
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2789
canResizeSelection
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2790
    "returns true if a selection exists and all elements in the selection
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2791
     can be resized"
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2792
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2793
    ^ self canResize:(self selection)
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2794
!
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2795
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2796
canResizeView:aView
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2797
    "returns true if the view can be resized.
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2798
     This is dependent on its parent view."
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2799
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2800
    |item parent|
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2801
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2802
    item := treeView itemOfView:aView.
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2803
    item isNil ifTrue:[
3348
1028e3c18509 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3327
diff changeset
  2804
        "/ I don't know anything about that view (cg: how can this happen ?)
2480
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2805
        "/ self breakPoint:#cg.
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2806
        ^ false
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2807
    ].
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2808
    parent := item parent.
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2809
    parent isNil ifTrue:[
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2810
        "/ that view has no parent (cg: does this mean its the canvas itself ?)
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2811
        "/ self breakPoint:#cg.
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2812
        ^ false
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2813
    ].
2483
3edd36775899 Consider direct subviews of the cancas in canResizeView:
Stefan Vogel <sv@exept.de>
parents: 2480
diff changeset
  2814
    parent contents view == self ifTrue:[
3edd36775899 Consider direct subviews of the cancas in canResizeView:
Stefan Vogel <sv@exept.de>
parents: 2480
diff changeset
  2815
        "aView is a direct subview of the canvas
3edd36775899 Consider direct subviews of the cancas in canResizeView:
Stefan Vogel <sv@exept.de>
parents: 2480
diff changeset
  2816
         -- and the canvas supports resizing of its subviews"
3edd36775899 Consider direct subviews of the cancas in canResizeView:
Stefan Vogel <sv@exept.de>
parents: 2480
diff changeset
  2817
        ^ true.
3edd36775899 Consider direct subviews of the cancas in canResizeView:
Stefan Vogel <sv@exept.de>
parents: 2480
diff changeset
  2818
    ].
2480
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2819
    ^ parent contents spec class canResizeSubComponents
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2820
!
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2821
2392
ca
parents: 2390
diff changeset
  2822
canUngroup
ca
parents: 2390
diff changeset
  2823
    "test whether the selected element can be ungrouped; only one
ca
parents: 2390
diff changeset
  2824
     element is selected and has children"
ca
parents: 2390
diff changeset
  2825
ca
parents: 2390
diff changeset
  2826
    "/ the #ungroupSelectionWithLayout: dosnot work yet - so disable
ca
parents: 2390
diff changeset
  2827
ca
parents: 2390
diff changeset
  2828
"/    |selectedNodes node|
ca
parents: 2390
diff changeset
  2829
"/
ca
parents: 2390
diff changeset
  2830
"/    selectedNodes := self selectedNodes.
ca
parents: 2390
diff changeset
  2831
"/
ca
parents: 2390
diff changeset
  2832
"/
ca
parents: 2390
diff changeset
  2833
"/    selectedNodes size == 1 ifTrue:[
ca
parents: 2390
diff changeset
  2834
"/        node := selectedNodes first.
ca
parents: 2390
diff changeset
  2835
"/        node parent isNil ifTrue:[ ^ false ].    "/ test whether not the canvas itself is selected
ca
parents: 2390
diff changeset
  2836
"/
ca
parents: 2390
diff changeset
  2837
"/        ^ node hasChildren
ca
parents: 2390
diff changeset
  2838
"/    ].
ca
parents: 2390
diff changeset
  2839
    ^ false
285
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2840
! !
d80b3c6a4373 don't use superView instead parent properties derived
ca
parents: 281
diff changeset
  2841
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2842
!UIPainterView methodsFor:'transaction'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2843
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2844
transaction:aType objects:something do:aOneArgBlock
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2845
    "opens a transaction and evaluates a block within the transaction; the
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2846
     argument to the block is a view from derived from something
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2847
    "
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2848
    self withinTransaction:aType objects:something do:[
3554
01fa81669da2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 3502
diff changeset
  2849
        something doIfNotNil:aOneArgBlock
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2850
    ]
3554
01fa81669da2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 3502
diff changeset
  2851
01fa81669da2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 3502
diff changeset
  2852
    "Modified: / 11-04-2018 / 18:20:27 / stefan"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2853
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2854
1954
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2855
withinTransaction:aType objects:objects do:aNoArgBlock
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2856
    "evaluate a block within a transaction"
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2857
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2858
    |text size prop|
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2859
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2860
    objects isNil ifTrue:[ ^ self ].
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2861
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2862
    size := objects size.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2863
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2864
    objects isCollection ifTrue:[
1954
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2865
        size == 0 ifTrue:[ ^ self ].
2362
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2866
        size == 1 ifTrue:[ 
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2867
            prop := self propertyOfView:(objects first) 
a6a7ef98fdc3 can resize - allow resizing all;
Claus Gittinger <cg@exept.de>
parents: 2358
diff changeset
  2868
        ]
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2869
    ] ifFalse:[
1954
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2870
        prop := self propertyOfView:objects
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2871
    ].
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2872
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2873
    prop notNil ifTrue:[
1954
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2874
        text := prop name
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2875
    ] ifFalse:[
1954
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2876
        text := size printString, ' elements'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2877
    ].
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2878
1954
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2879
    undoHistory withinTransaction:aType text:text do:aNoArgBlock.
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2880
    self undoHistoryChanged.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2881
! !
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2882
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2883
!UIPainterView methodsFor:'undo actions'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2884
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2885
createUndoLayout:aView
3474
53970d18e17c #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3387
diff changeset
  2886
    "create undo action before changing a view's layout"
2509
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2887
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2888
    |lyt args prop|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2889
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2890
    undoHistory isTransactionOpen ifTrue:[
1954
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2891
        prop := self propertyOfView:aView.
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2892
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2893
        prop notNil ifTrue:[
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2894
            args := Array new:3.
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2895
            args at:1 put:(prop identifier).
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2896
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2897
            (lyt := aView geometryLayout) notNil ifTrue:[
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2898
                args at:2 put:#geometryLayout:
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2899
            ] ifFalse:[
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2900
                lyt := aView extent.
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2901
                args at:2 put:#extent:
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2902
            ].
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2903
            args at:3 put:(lyt copy).
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2904
            undoHistory addUndoSelector:#undoLayout: withArgs:args.
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2905
            self undoHistoryChanged.
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2906
        ]
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2907
    ]
3474
53970d18e17c #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3387
diff changeset
  2908
53970d18e17c #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3387
diff changeset
  2909
    "Modified (comment): / 31-08-2017 / 20:17:23 / cg"
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2910
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2911
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2912
createUndoRemove:aView
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2913
    "create undo method before deleting views
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2914
    "
2390
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2915
    |item itemParent prop args|
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2916
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2917
    item := treeView detectItemCorespondingToView:aView.
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2918
    item isNil ifTrue:[^ self ].
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2919
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2920
    itemParent := item parent.
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2921
    itemParent isNil ifTrue:[^ self ].
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2922
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2923
    prop  := item contents.
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2924
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2925
    args := Array
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2926
            with:(self fullSpecFor:aView)
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2927
            with:(prop identifier)
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2928
            with:(itemParent contents identifier)
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2929
            with:(itemParent indexOfChild:item).
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2930
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2931
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2932
    undoHistory addUndoSelector:#'undoRemove:' withArgs:args.
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2933
    self undoHistoryChanged.
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2934
!
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2935
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2936
createUndoSpecModify:aProp
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2937
    "undo method when changing the specification for an object
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2938
    "
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2939
    aProp notNil ifTrue:[
1954
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2940
        undoHistory addUndoSelector:#undoSpecModify:
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2941
                           withArgs:(Array with:(aProp spec) with:(aProp identifier)).
1344ec1f99eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  2942
        self undoHistoryChanged.
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2943
    ]
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2944
!
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2945
2509
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2946
createUndoStartPointEndPoint:aComponent
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2947
    "create an undo action before changing aComponent"
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2948
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2949
    |args prop|
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2950
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2951
    undoHistory isTransactionOpen ifTrue:[
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2952
        prop := self propertyOfView:aComponent.
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2953
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2954
        prop notNil ifTrue:[
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2955
            args := Array new:4.
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2956
            args at:1 put:(prop identifier).
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2957
            args at:2 put:#'startPoint:endPoint:'.
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2958
            args at:3 put:(aComponent startPoint).
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2959
            args at:4 put:(aComponent endPoint).
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2960
            undoHistory addUndoSelector:#undoStartPointEndPoint: withArgs:args.
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2961
            self undoHistoryChanged.
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2962
        ]
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2963
    ]
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2964
!
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  2965
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2966
undoCreate:something
3554
01fa81669da2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 3502
diff changeset
  2967
    "undo method for creating or pasting an object"
01fa81669da2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 3502
diff changeset
  2968
01fa81669da2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 3502
diff changeset
  2969
    something doIfNotNil:[:anId|self remove:(self findViewWithId:anId)].
01fa81669da2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 3502
diff changeset
  2970
01fa81669da2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 3502
diff changeset
  2971
    "Modified: / 11-04-2018 / 18:20:46 / stefan"
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2972
!
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2973
1520
eb77c52704c7 drop: paste in surrounding view if not possible to drop in selected.
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
  2974
undoHistory
eb77c52704c7 drop: paste in surrounding view if not possible to drop in selected.
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
  2975
    ^ undoHistory
eb77c52704c7 drop: paste in surrounding view if not possible to drop in selected.
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
  2976
eb77c52704c7 drop: paste in surrounding view if not possible to drop in selected.
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
  2977
    "Created: / 30.10.2001 / 13:42:45 / cg"
eb77c52704c7 drop: paste in surrounding view if not possible to drop in selected.
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
  2978
!
eb77c52704c7 drop: paste in surrounding view if not possible to drop in selected.
Claus Gittinger <cg@exept.de>
parents: 1500
diff changeset
  2979
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2980
undoLayout:args
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2981
    "undo method to set the old layout; see 'createUndoLayout:'
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2982
    "
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2983
    |view|
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2984
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2985
    (view := self findViewWithId:(args at:1)) notNil ifTrue:[
2480
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2986
        view perform:(args at:2) with:(args at:3).
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2987
        self elementChangedSize:view.
6effcbfba4e3 UIPainter can now resize subviews of PanelViews
Stefan Vogel <sv@exept.de>
parents: 2444
diff changeset
  2988
        self layoutChanged.
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2989
    ]
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2990
!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  2991
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2992
undoRemove:args
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2993
    "undo method when removing an object; see 'createUndoRemove:'
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  2994
    "
2390
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2995
    |frame prop view position parentId|
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2996
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2997
    position := args at:4 ifAbsent:nil.
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2998
    parentId := args at:3 ifAbsent:nil.
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  2999
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  3000
    parentId notNil ifTrue:[
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  3001
        frame := self findViewWithId:parentId.
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  3002
    ].
2390
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  3003
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  3004
    frame isNil ifTrue:[ frame := self. ].
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  3005
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  3006
    view := self addSpec:(args at:1)
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  3007
                 builder:(UIBuilder new isEditing:true)
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  3008
                      in:frame 
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  3009
             beforeIndex:position.
07303d4b4e78 restore position of view during undo delete
ca
parents: 2388
diff changeset
  3010
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  3011
    view realize.
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  3012
    prop := self propertyOfView:view.
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  3013
    prop identifier:(args at:2).
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  3014
!
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  3015
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  3016
undoSpecModify:args
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  3017
    "undo method when changing a spec; see 'createUndoSpecModify:'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  3018
    "
1173
7b5f40822819 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1092
diff changeset
  3019
    |view spec props|
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  3020
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  3021
    props := self propertyOfIdentifier:(args at:2).
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  3022
134
d5ab85ec27fd undo history; keep view identifier
ca
parents: 131
diff changeset
  3023
    props notNil ifTrue:[
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  3024
	view    := props view.
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  3025
	spec    := args at:1.
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  3026
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  3027
	props spec:spec.
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  3028
	self rebuildView:view fromSpec:spec withBuilder:nil.
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  3029
	treeView propertyChanged:props.
211
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3030
    ]
2509
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3031
!
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3032
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3033
undoStartPointEndPoint:args
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3034
    "undo method to set the old start/endPoint; see 'createUndoStartPointEndPoint:'
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3035
    "
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3036
    |view|
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3037
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3038
    (view := self findViewWithId:(args at:1)) notNil ifTrue:[
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3039
        view perform:(args at:2) with:(args at:3) with:(args at:4).
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3040
        self elementChangedSize:view.
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3041
        self layoutChanged.
89612a372d8b code cleanup
Claus Gittinger <cg@exept.de>
parents: 2508
diff changeset
  3042
    ]
211
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3043
! !
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3044
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3045
!UIPainterView::ViewProperty class methodsFor:'instance creation'!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3046
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3047
new
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3048
    Identifier notNil ifTrue:[Identifier := Identifier + 1]
1834
2c640b5f7fa9 *** empty log message ***
werner
parents: 1833
diff changeset
  3049
		     ifFalse:[Identifier := 1].
211
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3050
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3051
  ^ self basicNew initialize
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3052
! !
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3053
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3054
!UIPainterView::ViewProperty methodsFor:'accessing'!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3055
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3056
identifier
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3057
    "return the unique identifier assigned to property
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3058
    "
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3059
    ^ identifier
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3060
!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3061
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3062
identifier:anIdentifier
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3063
    "set the unique identifier assigned to property; called after an restore of
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3064
     a deleted instance
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3065
    "
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3066
    identifier := anIdentifier
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3067
!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3068
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3069
spec
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3070
    "return the value of the instance variable 'spec' (automatically generated)"
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3071
1427
85b9b5da0b8d optimize: undraw selection
ca
parents: 1402
diff changeset
  3072
    ^ spec
85b9b5da0b8d optimize: undraw selection
ca
parents: 1402
diff changeset
  3073
!
211
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3074
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3075
spec:something
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3076
    "set the value of the instance variable 'spec' (automatically generated)"
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3077
1427
85b9b5da0b8d optimize: undraw selection
ca
parents: 1402
diff changeset
  3078
    spec := something.
85b9b5da0b8d optimize: undraw selection
ca
parents: 1402
diff changeset
  3079
!
211
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3080
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3081
view
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3082
    "return the value of the instance variable 'view' (automatically generated)"
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3083
1427
85b9b5da0b8d optimize: undraw selection
ca
parents: 1402
diff changeset
  3084
    ^ view
85b9b5da0b8d optimize: undraw selection
ca
parents: 1402
diff changeset
  3085
!
211
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3086
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3087
view:something
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3088
    "set the value of the instance variable 'view' (automatically generated)"
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3089
1427
85b9b5da0b8d optimize: undraw selection
ca
parents: 1402
diff changeset
  3090
    view := something.
85b9b5da0b8d optimize: undraw selection
ca
parents: 1402
diff changeset
  3091
! !
211
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3092
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3093
!UIPainterView::ViewProperty methodsFor:'initialization'!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3094
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3095
initialize
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3096
    super initialize.
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3097
    identifier := Identifier
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3098
! !
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3099
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3100
!UIPainterView::ViewProperty methodsFor:'misc'!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3101
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3102
extractNumberStartingAt:anIndex
2231
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  3103
    "return the number from the name starting at anIndex (or 0 if there is no number)."
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  3104
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  3105
    "/ cg: code cleanup.
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  3106
    ^ Integer 
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  3107
        readFrom:(self name readStream skip:(anIndex-1))
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  3108
        onError:0
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  3109
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  3110
"/    |val|
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  3111
"/
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  3112
"/    val := 0.
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  3113
"/
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  3114
"/    self name from:anIndex do:[:c|
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  3115
"/        c isDigit ifTrue:[val := val * 10 + c digitValue]
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  3116
"/                 ifFalse:[^ 0]
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  3117
"/    ].
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  3118
"/    ^ val
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  3119
211
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3120
    "
2231
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  3121
     (self basicNew spec:(ButtonSpec new name:'button12')) extractNumberStartingAt:7 
ae58d3ccbbfd refactorings & code cleanup
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  3122
    "
211
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3123
! !
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3124
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3125
!UIPainterView::ViewProperty methodsFor:'spec messages'!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3126
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3127
doesNotUnderstand:aMessage
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3128
    spec notNil ifTrue:[
3287
0bddeff854d4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  3129
        (spec respondsTo:(aMessage selector)) ifTrue:[^ aMessage sendTo:spec]
211
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3130
    ].
3287
0bddeff854d4 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 3262
diff changeset
  3131
    ('[UIPainter::ViewProperty] warning: message ignored: ',aMessage selector) errorPrintCR.
211
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3132
    ^ nil
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3133
!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3134
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3135
layout
1664
782f3bda3c88 bugfix in #layout
ca
parents: 1635
diff changeset
  3136
    ^ spec layout
211
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3137
!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3138
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3139
layout:aLayout
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3140
    spec layout:aLayout
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3141
!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3142
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3143
name
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3144
    ^ spec name
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3145
!
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3146
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3147
name:aName
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3148
    spec name:aName
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3149
! !
Claus Gittinger <cg@exept.de>
parents: 210
diff changeset
  3150
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  3151
!UIPainterView class methodsFor:'documentation'!
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  3152
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  3153
version
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  3154
    ^ '$Header$'
2627
07d40cde2ac9 changed: #pasteSpecifications:keepLayout:
Claus Gittinger <cg@exept.de>
parents: 2583
diff changeset
  3155
!
07d40cde2ac9 changed: #pasteSpecifications:keepLayout:
Claus Gittinger <cg@exept.de>
parents: 2583
diff changeset
  3156
07d40cde2ac9 changed: #pasteSpecifications:keepLayout:
Claus Gittinger <cg@exept.de>
parents: 2583
diff changeset
  3157
version_CVS
07d40cde2ac9 changed: #pasteSpecifications:keepLayout:
Claus Gittinger <cg@exept.de>
parents: 2583
diff changeset
  3158
    ^ '$Header$'
60
7542ab7fbbfe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 59
diff changeset
  3159
! !
1621
112670159075 cg: check if selection change is allowed BEFORE changing the
tm
parents: 1574
diff changeset
  3160
2951
c2b24bf7b967 class: UIPainterView
Claus Gittinger <cg@exept.de>
parents: 2853
diff changeset
  3161
1225
0aa39cc5f0a3 Initialize class vars.
Stefan Vogel <sv@exept.de>
parents: 1201
diff changeset
  3162
UIPainterView initialize!