author | Jan Vrany <jan.vrany@labware.com> |
Sat, 30 Sep 2023 22:55:25 +0100 | |
branch | jv |
changeset 19648 | 5df52d354504 |
parent 15566 | 184cea584be5 |
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 |
||
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 |
|
12847
ed021bafe2ac
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
9768
diff
changeset
|
76 |
name: 'FilePanel' |
9766 | 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' |
|
12876
a54015e67850
class: FileDialogWithPreview
Claus Gittinger <cg@exept.de>
parents:
12847
diff
changeset
|
184 |
layout: (LayoutFrame 3 0 -25 1 90 0 -1 1) |
9766 | 185 |
translateLabel: true |
186 |
labelChannel: filenameLabelHolder |
|
187 |
adjust: left |
|
188 |
) |
|
189 |
(FilenameInputFieldSpec |
|
190 |
name: 'FilenameEntryField' |
|
12876
a54015e67850
class: FileDialogWithPreview
Claus Gittinger <cg@exept.de>
parents:
12847
diff
changeset
|
191 |
layout: (LayoutFrame 90 0 -25 1 -4 1 -1 1) |
9766 | 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) |
|
12876
a54015e67850
class: FileDialogWithPreview
Claus Gittinger <cg@exept.de>
parents:
12847
diff
changeset
|
229 |
postBuildCallback: postBuildVerticalPanelView: |
9766 | 230 |
) |
231 |
(HorizontalPanelViewSpec |
|
232 |
name: 'ButtonPanel' |
|
233 |
layout: (LayoutFrame 0 0.0 -30 1 0 1 0 1) |
|
234 |
visibilityChannel: buttonPanelVisibleHolder |
|
235 |
horizontalLayout: fitSpace |
|
236 |
verticalLayout: center |
|
237 |
horizontalSpace: 3 |
|
238 |
verticalSpace: 3 |
|
239 |
reverseOrderIfOKAtLeft: true |
|
240 |
component: |
|
241 |
(SpecCollection |
|
242 |
collection: ( |
|
243 |
(ActionButtonSpec |
|
244 |
label: 'Cancel' |
|
245 |
name: 'cancelButton' |
|
246 |
translateLabel: true |
|
247 |
labelChannel: cancelLabelHolder |
|
248 |
tabable: true |
|
249 |
model: doCancel |
|
12876
a54015e67850
class: FileDialogWithPreview
Claus Gittinger <cg@exept.de>
parents:
12847
diff
changeset
|
250 |
extent: (Point 131 25) |
9766 | 251 |
) |
252 |
(ActionButtonSpec |
|
253 |
label: 'Append' |
|
254 |
name: 'appendButton' |
|
255 |
visibilityChannel: appendButtonVisibleHolder |
|
256 |
translateLabel: true |
|
257 |
labelChannel: appendLabelHolder |
|
258 |
tabable: true |
|
259 |
model: appendPressed |
|
12876
a54015e67850
class: FileDialogWithPreview
Claus Gittinger <cg@exept.de>
parents:
12847
diff
changeset
|
260 |
extent: (Point 132 25) |
9766 | 261 |
) |
262 |
(ActionButtonSpec |
|
263 |
label: 'OK' |
|
264 |
name: 'okButton' |
|
265 |
translateLabel: true |
|
266 |
labelChannel: okLabelHolder |
|
267 |
tabable: true |
|
268 |
model: okPressed |
|
269 |
isDefault: true |
|
12876
a54015e67850
class: FileDialogWithPreview
Claus Gittinger <cg@exept.de>
parents:
12847
diff
changeset
|
270 |
extent: (Point 132 25) |
9766 | 271 |
) |
272 |
) |
|
273 |
||
274 |
) |
|
12882
7798eeb45eb8
class: FileDialogWithPreview
Claus Gittinger <cg@exept.de>
parents:
12876
diff
changeset
|
275 |
keepSpaceForOSXResizeHandleH: true |
9766 | 276 |
) |
277 |
) |
|
278 |
||
279 |
) |
|
280 |
) |
|
281 |
! ! |
|
282 |
||
283 |
!FileDialogWithPreview class methodsFor:'plugIn spec'! |
|
284 |
||
285 |
aspectSelectors |
|
286 |
"This resource specification was automatically generated |
|
287 |
by the UIPainter of ST/X." |
|
288 |
||
289 |
"Do not manually edit this. If it is corrupted, |
|
290 |
the UIPainter may not be able to read the specification." |
|
291 |
||
292 |
"Return a description of exported aspects; |
|
293 |
these can be connected to aspects of an embedding application |
|
294 |
(if this app is embedded in a subCanvas)." |
|
295 |
||
296 |
^ #( |
|
297 |
#filenameHolder |
|
298 |
#filterHolder |
|
299 |
#rootDirectoryHolder |
|
300 |
). |
|
301 |
||
302 |
! ! |
|
303 |
||
304 |
!FileDialogWithPreview methodsFor:'change & update'! |
|
305 |
||
306 |
fileSelectionChanged |
|
307 |
|fn mime image| |
|
308 |
||
309 |
super fileSelectionChanged. |
|
12882
7798eeb45eb8
class: FileDialogWithPreview
Claus Gittinger <cg@exept.de>
parents:
12876
diff
changeset
|
310 |
((fn := self filenameHolder value) notNil and:[ fn exists ]) ifTrue:[ |
9766 | 311 |
(mime := fn mimeTypeFromName) notNil ifTrue:[ |
13716
9f0d7f69c782
class: FileDialogWithPreview
Claus Gittinger <cg@exept.de>
parents:
12882
diff
changeset
|
312 |
mime isImageType ifTrue:[ |
9766 | 313 |
image := Image fromFile:fn. |
314 |
imagePreview image:image. |
|
315 |
]. |
|
316 |
]. |
|
317 |
]. |
|
318 |
||
319 |
"Created: / 14-02-2011 / 18:00:39 / cg" |
|
320 |
! ! |
|
321 |
||
322 |
!FileDialogWithPreview methodsFor:'initialization'! |
|
323 |
||
324 |
postBuildImageView:aView |
|
325 |
imagePreview := aView |
|
326 |
||
327 |
"Created: / 14-02-2011 / 18:08:05 / cg" |
|
328 |
! ! |
|
329 |
||
330 |
!FileDialogWithPreview class methodsFor:'documentation'! |
|
331 |
||
12882
7798eeb45eb8
class: FileDialogWithPreview
Claus Gittinger <cg@exept.de>
parents:
12876
diff
changeset
|
332 |
version |
13716
9f0d7f69c782
class: FileDialogWithPreview
Claus Gittinger <cg@exept.de>
parents:
12882
diff
changeset
|
333 |
^ '$Header: /cvs/stx/stx/libtool/FileDialogWithPreview.st,v 1.6 2013-12-07 10:46:29 cg Exp $' |
12882
7798eeb45eb8
class: FileDialogWithPreview
Claus Gittinger <cg@exept.de>
parents:
12876
diff
changeset
|
334 |
! |
7798eeb45eb8
class: FileDialogWithPreview
Claus Gittinger <cg@exept.de>
parents:
12876
diff
changeset
|
335 |
|
9766 | 336 |
version_CVS |
13716
9f0d7f69c782
class: FileDialogWithPreview
Claus Gittinger <cg@exept.de>
parents:
12882
diff
changeset
|
337 |
^ '$Header: /cvs/stx/stx/libtool/FileDialogWithPreview.st,v 1.6 2013-12-07 10:46:29 cg Exp $' |
9766 | 338 |
! ! |
12847
ed021bafe2ac
class: Expecco::ExpeccoDebugView
Claus Gittinger <cg@exept.de>
parents:
9768
diff
changeset
|
339 |