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