164
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1995 by eXept Software AG
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
ApplicationModel subclass:#UISpecificationTool
|
|
17 |
instanceVariableNames:'modifiedHolder aspects specClass specEdited specChannel'
|
|
18 |
classVariableNames:''
|
|
19 |
poolDictionaries:''
|
|
20 |
category:'Interface-UIPainter'
|
|
21 |
!
|
|
22 |
|
|
23 |
!UISpecificationTool class methodsFor:'documentation'!
|
|
24 |
|
|
25 |
copyright
|
|
26 |
"
|
|
27 |
COPYRIGHT (c) 1995 by eXept Software AG
|
|
28 |
All Rights Reserved
|
|
29 |
|
|
30 |
This software is furnished under a license and may be used
|
|
31 |
only in accordance with the terms of that license and with the
|
|
32 |
inclusion of the above copyright notice. This software may not
|
|
33 |
be provided or otherwise made available to, or used by, any
|
|
34 |
other person. No title to or ownership of the software is
|
|
35 |
hereby transferred.
|
|
36 |
"
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
!
|
|
41 |
|
|
42 |
documentation
|
|
43 |
"
|
|
44 |
used by the UIPainter to manipulate the specifications of the selected component
|
|
45 |
|
|
46 |
[author:]
|
|
47 |
Claus Atzkern
|
|
48 |
|
|
49 |
[see also:]
|
|
50 |
UIPainter
|
|
51 |
UILayoutTool
|
|
52 |
UIHelpTool
|
|
53 |
"
|
|
54 |
! !
|
|
55 |
|
|
56 |
!UISpecificationTool class methodsFor:'interface specs'!
|
|
57 |
|
|
58 |
windowSpec
|
|
59 |
"this window spec was automatically generated by the ST/X UIPainter"
|
|
60 |
|
|
61 |
"do not manually edit this - the painter/builder may not be able to
|
|
62 |
handle the specification if its corrupted."
|
|
63 |
|
|
64 |
"
|
|
65 |
UIPainter new openOnClass:UISpecificationTool andSelector:#windowSpec
|
|
66 |
UISpecificationTool new openInterface:#windowSpec
|
|
67 |
"
|
|
68 |
"UISpecificationTool open"
|
|
69 |
|
|
70 |
<resource: #canvas>
|
|
71 |
|
|
72 |
^
|
|
73 |
|
|
74 |
#(#FullSpec
|
|
75 |
#'window:'
|
|
76 |
#(#WindowSpec
|
|
77 |
#'name:' 'uIPainterView'
|
|
78 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
|
|
79 |
#'label:' 'unnamed canvas'
|
|
80 |
#'bounds:' #(#Rectangle 0 0 300 300)
|
|
81 |
)
|
|
82 |
#'component:'
|
|
83 |
#(#SpecCollection
|
|
84 |
#'collection:'
|
|
85 |
#(
|
|
86 |
#(#ViewSpec
|
|
87 |
#'name:' 'Frame'
|
|
88 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
|
|
89 |
)
|
|
90 |
)
|
|
91 |
)
|
|
92 |
)
|
|
93 |
! !
|
|
94 |
|
|
95 |
!UISpecificationTool methodsFor:'accessing'!
|
|
96 |
|
|
97 |
modifiedHolder:aValueHolder
|
|
98 |
"set the value holder set to true in case of modifying attributes
|
|
99 |
"
|
|
100 |
modifiedHolder notNil ifTrue:[
|
|
101 |
modifiedHolder removeDependent:self.
|
|
102 |
].
|
|
103 |
|
|
104 |
(modifiedHolder := aValueHolder) notNil ifTrue:[
|
|
105 |
modifiedHolder addDependent:self.
|
|
106 |
].
|
|
107 |
|
|
108 |
!
|
|
109 |
|
|
110 |
update
|
|
111 |
"reload specification
|
|
112 |
"
|
|
113 |
specChannel notNil ifTrue:[
|
|
114 |
specChannel value:specEdited.
|
|
115 |
]
|
|
116 |
|
|
117 |
|
|
118 |
! !
|
|
119 |
|
|
120 |
!UISpecificationTool methodsFor:'bindings'!
|
|
121 |
|
|
122 |
aspectFor:aKey
|
|
123 |
"returns aspect for a key or nil
|
|
124 |
"
|
|
125 |
aspects notNil ifTrue:[
|
|
126 |
^ aspects at:aKey ifAbsent:nil
|
|
127 |
].
|
|
128 |
^ super aspectFor:aKey
|
|
129 |
|
|
130 |
!
|
|
131 |
|
|
132 |
specEdited
|
|
133 |
"gets current edit specification
|
|
134 |
"
|
|
135 |
^ specEdited
|
|
136 |
|
|
137 |
|
|
138 |
!
|
|
139 |
|
|
140 |
specEdited:aSpec
|
|
141 |
"sets current edit specification
|
|
142 |
"
|
|
143 |
aSpec isNil ifTrue:[
|
|
144 |
specChannel := nil.
|
|
145 |
specEdited := nil.
|
|
146 |
aspects := nil.
|
|
147 |
] ifFalse:[
|
|
148 |
specEdited class == aSpec class ifTrue:[
|
|
149 |
specEdited := aSpec.
|
|
150 |
^ specChannel value:specEdited.
|
|
151 |
].
|
|
152 |
specEdited := aSpec.
|
|
153 |
aspects := IdentityDictionary new.
|
|
154 |
specChannel := specEdited asValue.
|
|
155 |
specEdited class addBindingsTo:aspects for:specEdited channel:specChannel.
|
|
156 |
aspects do:[:el| el addDependent:self ].
|
|
157 |
].
|
|
158 |
|
|
159 |
specClass notNil ifTrue:[
|
|
160 |
(builder componentAt:#Frame) destroySubViews.
|
|
161 |
specClass := nil.
|
|
162 |
].
|
|
163 |
! !
|
|
164 |
|
|
165 |
!UISpecificationTool methodsFor:'change & update'!
|
|
166 |
|
|
167 |
update:something with:someArgument from:someone
|
|
168 |
"any attribute changed its state in the current specification
|
|
169 |
"
|
|
170 |
someone ~~ modifiedHolder ifTrue:[
|
|
171 |
modifiedHolder value ~~ true ifTrue:[
|
|
172 |
modifiedHolder value:true
|
|
173 |
]
|
|
174 |
]
|
|
175 |
|
|
176 |
|
|
177 |
! !
|
|
178 |
|
|
179 |
!UISpecificationTool methodsFor:'selection'!
|
|
180 |
|
|
181 |
selection:something
|
|
182 |
|slices idx spec frame|
|
|
183 |
|
|
184 |
specEdited notNil ifTrue:[
|
|
185 |
slices := specEdited class slices.
|
|
186 |
idx:= slices findFirst:[:aSlice| aSlice first = something ].
|
|
187 |
|
|
188 |
idx ~~ 0 ifTrue:[
|
|
189 |
spec := specEdited class perform:((slices at:idx) last).
|
|
190 |
].
|
|
191 |
].
|
|
192 |
|
|
193 |
spec ~= specClass ifTrue:[
|
|
194 |
frame := builder componentAt:#Frame.
|
|
195 |
frame destroySubViews.
|
|
196 |
|
|
197 |
spec notNil ifTrue:[
|
|
198 |
builder buildFromSpec:spec in:frame.
|
|
199 |
frame allViewBackground:(frame viewBackground).
|
|
200 |
frame realizeAllSubViews.
|
|
201 |
]
|
|
202 |
].
|
|
203 |
specClass := spec.
|
|
204 |
! !
|
|
205 |
|
|
206 |
!UISpecificationTool class methodsFor:'documentation'!
|
|
207 |
|
|
208 |
version
|
|
209 |
^ '$Header$'
|
|
210 |
! !
|