9768
|
1 |
"
|
|
2 |
COPYRIGHT (c) 2011 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 |
"
|
9766
|
12 |
"{ Package: 'stx:libtool' }"
|
|
13 |
|
|
14 |
FileDialog subclass:#FileDialogWithPreview
|
|
15 |
instanceVariableNames:'imagePreview'
|
|
16 |
classVariableNames:''
|
|
17 |
poolDictionaries:''
|
|
18 |
category:'Interface-Tools-File'
|
|
19 |
!
|
|
20 |
|
9768
|
21 |
!FileDialogWithPreview class methodsFor:'documentation'!
|
|
22 |
|
|
23 |
copyright
|
|
24 |
"
|
|
25 |
COPYRIGHT (c) 2011 by eXept Software AG
|
|
26 |
All Rights Reserved
|
|
27 |
|
|
28 |
This software is furnished under a license and may be used
|
|
29 |
only in accordance with the terms of that license and with the
|
|
30 |
inclusion of the above copyright notice. This software may not
|
|
31 |
be provided or otherwise made available to, or used by, any
|
|
32 |
other person. No title to or ownership of the software is
|
|
33 |
hereby transferred.
|
|
34 |
"
|
|
35 |
!
|
|
36 |
|
|
37 |
documentation
|
|
38 |
"
|
|
39 |
a FileDialog with image preview
|
|
40 |
"
|
|
41 |
! !
|
9766
|
42 |
|
|
43 |
!FileDialogWithPreview class methodsFor:'interface specs'!
|
|
44 |
|
|
45 |
windowSpec
|
|
46 |
"This resource specification was automatically generated
|
|
47 |
by the UIPainter of ST/X."
|
|
48 |
|
|
49 |
"Do not manually edit this!! If it is corrupted,
|
|
50 |
the UIPainter may not be able to read the specification."
|
|
51 |
|
|
52 |
"
|
|
53 |
UIPainter new openOnClass:FileDialogWithPreview andSelector:#windowSpec
|
|
54 |
FileDialogWithPreview new openInterface:#windowSpec
|
|
55 |
FileDialogWithPreview open
|
|
56 |
"
|
|
57 |
|
|
58 |
<resource: #canvas>
|
|
59 |
|
|
60 |
^
|
|
61 |
#(FullSpec
|
|
62 |
name: windowSpec
|
|
63 |
window:
|
|
64 |
(WindowSpec
|
|
65 |
label: 'FileDialog'
|
|
66 |
name: 'FileDialog'
|
|
67 |
min: (Point 10 10)
|
|
68 |
bounds: (Rectangle 0 0 407 607)
|
|
69 |
menu: mainMenu
|
|
70 |
performer: treeBrowser
|
|
71 |
)
|
|
72 |
component:
|
|
73 |
(SpecCollection
|
|
74 |
collection: (
|
|
75 |
(VariableVerticalPanelSpec
|
|
76 |
name: 'FileAndPreviewPanel'
|
|
77 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 -30 1.0)
|
|
78 |
showHandle: true
|
|
79 |
handlePosition: center
|
|
80 |
component:
|
|
81 |
(SpecCollection
|
|
82 |
collection: (
|
|
83 |
(ViewSpec
|
|
84 |
name: 'FilePart'
|
|
85 |
component:
|
|
86 |
(SpecCollection
|
|
87 |
collection: (
|
|
88 |
(MenuPanelSpec
|
|
89 |
name: 'ToolBar1'
|
|
90 |
layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 40 0)
|
|
91 |
tabable: true
|
|
92 |
menu: toolBarMenu
|
|
93 |
textDefault: true
|
|
94 |
)
|
|
95 |
(VariableHorizontalPanelSpec
|
|
96 |
name: 'DeviceAndFilterPanel'
|
|
97 |
layout: (LayoutFrame 0 0 40 0 0 1 70 0)
|
|
98 |
level: 1
|
|
99 |
showHandle: true
|
|
100 |
component:
|
|
101 |
(SpecCollection
|
|
102 |
collection: (
|
|
103 |
(ViewSpec
|
|
104 |
name: 'Box1'
|
|
105 |
component:
|
|
106 |
(SpecCollection
|
|
107 |
collection: (
|
|
108 |
(ComboListSpec
|
|
109 |
name: 'ComboList1'
|
|
110 |
layout: (LayoutFrame 1 0 1 0.0 -1 1 -1 1)
|
|
111 |
visibilityChannel: driveSelectorVisible
|
|
112 |
model: selectedDeviceDrive
|
|
113 |
comboList: listOfDeviceDrives
|
|
114 |
useIndex: false
|
|
115 |
hidePullDownMenuButton: false
|
|
116 |
)
|
|
117 |
)
|
|
118 |
|
|
119 |
)
|
|
120 |
)
|
|
121 |
(ViewSpec
|
|
122 |
name: 'Box2'
|
|
123 |
component:
|
|
124 |
(SpecCollection
|
|
125 |
collection: (
|
|
126 |
(LabelSpec
|
|
127 |
label: 'Filter:'
|
|
128 |
name: 'FilterLabel'
|
|
129 |
layout: (LayoutFrame 1 0 2 0 59 0 -2 1)
|
|
130 |
translateLabel: true
|
|
131 |
adjust: right
|
|
132 |
)
|
|
133 |
(InputFieldSpec
|
|
134 |
name: 'FilterEntryField'
|
|
135 |
layout: (LayoutFrame 60 0 -27 1 -2 1 -2 1)
|
|
136 |
model: filterHolder
|
|
137 |
immediateAccept: true
|
|
138 |
acceptOnReturn: true
|
|
139 |
acceptOnTab: true
|
|
140 |
acceptOnLostFocus: true
|
|
141 |
acceptOnPointerLeave: false
|
|
142 |
postBuildCallback: postBuildFilterField:
|
|
143 |
)
|
|
144 |
)
|
|
145 |
|
|
146 |
)
|
|
147 |
)
|
|
148 |
)
|
|
149 |
|
|
150 |
)
|
|
151 |
handles: (Any 0.2972972972973 1.0)
|
|
152 |
)
|
|
153 |
(SubCanvasSpec
|
|
154 |
name: 'DirectoryTreeBrowser'
|
|
155 |
layout: (LayoutFrame 0 0.0 70 0 0 1.0 -30 1)
|
|
156 |
tabable: true
|
|
157 |
hasHorizontalScrollBar: false
|
|
158 |
hasVerticalScrollBar: false
|
|
159 |
majorKey: DirectoryTreeBrowser
|
|
160 |
subAspectHolders:
|
|
161 |
(Array
|
|
162 |
|
|
163 |
(SubChannelInfoSpec
|
|
164 |
subAspect: filterModel
|
|
165 |
aspect: filterHolder
|
|
166 |
)
|
|
167 |
(SubChannelInfoSpec
|
|
168 |
subAspect: rootHolder
|
|
169 |
aspect: rootDirectoryHolder
|
|
170 |
)
|
|
171 |
|
|
172 |
(SubChannelInfoSpec
|
|
173 |
subAspect: showHiddenFiles
|
|
174 |
aspect: showHiddenFiles
|
|
175 |
)
|
|
176 |
)
|
|
177 |
createNewApplication: true
|
|
178 |
createNewBuilder: true
|
|
179 |
postBuildCallback: postBuildTreeBrowser:
|
|
180 |
)
|
|
181 |
(LabelSpec
|
|
182 |
label: 'Filename:'
|
|
183 |
name: 'FilenameLabel'
|
|
184 |
layout: (LayoutFrame 3 0 -25 1 73 0 -1 1)
|
|
185 |
translateLabel: true
|
|
186 |
labelChannel: filenameLabelHolder
|
|
187 |
adjust: left
|
|
188 |
)
|
|
189 |
(FilenameInputFieldSpec
|
|
190 |
name: 'FilenameEntryField'
|
|
191 |
layout: (LayoutFrame 70 0 -25 1 -4 1 -1 1)
|
|
192 |
tabable: true
|
|
193 |
model: filenameHolder
|
|
194 |
immediateAccept: false
|
|
195 |
acceptOnPointerLeave: false
|
|
196 |
hasKeyboardFocusInitially: true
|
|
197 |
postBuildCallback: postBuildFileNameField:
|
|
198 |
)
|
|
199 |
)
|
|
200 |
|
|
201 |
)
|
|
202 |
)
|
|
203 |
(ViewSpec
|
|
204 |
name: 'PreviewBox'
|
|
205 |
visibilityChannel: previewVisibleHolder
|
|
206 |
component:
|
|
207 |
(SpecCollection
|
|
208 |
collection: (
|
|
209 |
(ArbitraryComponentSpec
|
|
210 |
name: 'ArbitraryComponent1'
|
|
211 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1)
|
|
212 |
visibilityChannel: imageViewVisible
|
|
213 |
hasHorizontalScrollBar: true
|
|
214 |
hasVerticalScrollBar: true
|
|
215 |
miniScrollerHorizontal: true
|
|
216 |
miniScrollerVertical: true
|
|
217 |
hasBorder: false
|
|
218 |
component: ImageView
|
|
219 |
postBuildCallback: postBuildImageView:
|
|
220 |
)
|
|
221 |
)
|
|
222 |
|
|
223 |
)
|
|
224 |
)
|
|
225 |
)
|
|
226 |
|
|
227 |
)
|
|
228 |
handles: (Any 0.750433275563258 1.0)
|
|
229 |
)
|
|
230 |
(HorizontalPanelViewSpec
|
|
231 |
name: 'ButtonPanel'
|
|
232 |
layout: (LayoutFrame 0 0.0 -30 1 0 1 0 1)
|
|
233 |
visibilityChannel: buttonPanelVisibleHolder
|
|
234 |
horizontalLayout: fitSpace
|
|
235 |
verticalLayout: center
|
|
236 |
horizontalSpace: 3
|
|
237 |
verticalSpace: 3
|
|
238 |
reverseOrderIfOKAtLeft: true
|
|
239 |
component:
|
|
240 |
(SpecCollection
|
|
241 |
collection: (
|
|
242 |
(ActionButtonSpec
|
|
243 |
label: 'Cancel'
|
|
244 |
name: 'cancelButton'
|
|
245 |
translateLabel: true
|
|
246 |
labelChannel: cancelLabelHolder
|
|
247 |
tabable: true
|
|
248 |
model: doCancel
|
|
249 |
extent: (Point 131 22)
|
|
250 |
)
|
|
251 |
(ActionButtonSpec
|
|
252 |
label: 'Append'
|
|
253 |
name: 'appendButton'
|
|
254 |
visibilityChannel: appendButtonVisibleHolder
|
|
255 |
translateLabel: true
|
|
256 |
labelChannel: appendLabelHolder
|
|
257 |
tabable: true
|
|
258 |
model: appendPressed
|
|
259 |
extent: (Point 132 22)
|
|
260 |
)
|
|
261 |
(ActionButtonSpec
|
|
262 |
label: 'OK'
|
|
263 |
name: 'okButton'
|
|
264 |
translateLabel: true
|
|
265 |
labelChannel: okLabelHolder
|
|
266 |
tabable: true
|
|
267 |
model: okPressed
|
|
268 |
isDefault: true
|
|
269 |
extent: (Point 132 22)
|
|
270 |
)
|
|
271 |
)
|
|
272 |
|
|
273 |
)
|
|
274 |
)
|
|
275 |
)
|
|
276 |
|
|
277 |
)
|
|
278 |
)
|
|
279 |
! !
|
|
280 |
|
|
281 |
!FileDialogWithPreview class methodsFor:'plugIn spec'!
|
|
282 |
|
|
283 |
aspectSelectors
|
|
284 |
"This resource specification was automatically generated
|
|
285 |
by the UIPainter of ST/X."
|
|
286 |
|
|
287 |
"Do not manually edit this. If it is corrupted,
|
|
288 |
the UIPainter may not be able to read the specification."
|
|
289 |
|
|
290 |
"Return a description of exported aspects;
|
|
291 |
these can be connected to aspects of an embedding application
|
|
292 |
(if this app is embedded in a subCanvas)."
|
|
293 |
|
|
294 |
^ #(
|
|
295 |
#filenameHolder
|
|
296 |
#filterHolder
|
|
297 |
#rootDirectoryHolder
|
|
298 |
).
|
|
299 |
|
|
300 |
! !
|
|
301 |
|
|
302 |
!FileDialogWithPreview methodsFor:'change & update'!
|
|
303 |
|
|
304 |
fileSelectionChanged
|
|
305 |
|fn mime image|
|
|
306 |
|
|
307 |
super fileSelectionChanged.
|
|
308 |
(fn := self filenameHolder value) exists ifTrue:[
|
|
309 |
(mime := fn mimeTypeFromName) notNil ifTrue:[
|
|
310 |
mime isImage ifTrue:[
|
|
311 |
image := Image fromFile:fn.
|
|
312 |
imagePreview image:image.
|
|
313 |
].
|
|
314 |
].
|
|
315 |
].
|
|
316 |
|
|
317 |
"Created: / 14-02-2011 / 18:00:39 / cg"
|
|
318 |
! !
|
|
319 |
|
|
320 |
!FileDialogWithPreview methodsFor:'initialization'!
|
|
321 |
|
|
322 |
postBuildImageView:aView
|
|
323 |
imagePreview := aView
|
|
324 |
|
|
325 |
"Created: / 14-02-2011 / 18:08:05 / cg"
|
|
326 |
! !
|
|
327 |
|
|
328 |
!FileDialogWithPreview class methodsFor:'documentation'!
|
|
329 |
|
|
330 |
version_CVS
|
9768
|
331 |
^ '$Header: /cvs/stx/stx/libtool/FileDialogWithPreview.st,v 1.2 2011-02-14 17:13:03 cg Exp $'
|
9766
|
332 |
! !
|