author | penk |
Tue, 15 Oct 2002 15:12:25 +0200 | |
changeset 4001 | ef0ac34526b0 |
parent 3989 | 7eec3cb5bce6 |
child 4018 | 43e02c59719d |
permissions | -rw-r--r-- |
3892 | 1 |
"{ Package: 'stx:libtool' }" |
2 |
||
3 |
AbstractFileBrowser subclass:#FileApplicationNoteBook |
|
3982 | 4 |
instanceVariableNames:'canvasHolder selectedEditorPage listOfApplications tabMenuIndex |
5 |
tabList selectionHistoryList privateTabList' |
|
6 |
classVariableNames:'' |
|
7 |
poolDictionaries:'' |
|
8 |
category:'Interface-Tools-File' |
|
3892 | 9 |
! |
10 |
||
11 |
AbstractFileApplicationNoteBookComponent subclass:#ArchiveViewApplication |
|
3982 | 12 |
instanceVariableNames:'archiveFileList enableStopButton fileTable currentSortOrder |
13 |
selectionHolder tableColumns commandProcess errorListHolder |
|
14 |
viewErrorList temporaryDirectory enableRemoveErrorOutput |
|
15 |
errorListVisibilityHolder hasListEntriesHolder archiver process |
|
16 |
terminateByMe columnDescriptors inDropMode' |
|
17 |
classVariableNames:'' |
|
18 |
poolDictionaries:'' |
|
19 |
privateIn:FileApplicationNoteBook |
|
3892 | 20 |
! |
21 |
||
22 |
Object subclass:#ArchivItem |
|
3982 | 23 |
instanceVariableNames:'fileName size dateAndTime permissions icon ownerGroup method crc |
24 |
compressSize ratio version type isDirectory' |
|
25 |
classVariableNames:'' |
|
26 |
poolDictionaries:'' |
|
27 |
privateIn:FileApplicationNoteBook::ArchiveViewApplication |
|
3892 | 28 |
! |
29 |
||
30 |
AbstractFileApplicationNoteBookComponent subclass:#CommandResult |
|
3982 | 31 |
instanceVariableNames:'resultStream enableStopButton process labelHolder' |
32 |
classVariableNames:'' |
|
33 |
poolDictionaries:'' |
|
34 |
privateIn:FileApplicationNoteBook |
|
3892 | 35 |
! |
36 |
||
37 |
AbstractFileApplicationNoteBookComponent subclass:#HtmlViewApplication |
|
3982 | 38 |
instanceVariableNames:'htmlView labelHolder infoLabelHolder' |
39 |
classVariableNames:'' |
|
40 |
poolDictionaries:'' |
|
41 |
privateIn:FileApplicationNoteBook |
|
3892 | 42 |
! |
43 |
||
44 |
AbstractFileApplicationNoteBookComponent subclass:#ImageViewApplication |
|
3982 | 45 |
instanceVariableNames:'imageFile imageView image fitSize fitMode' |
46 |
classVariableNames:'' |
|
47 |
poolDictionaries:'' |
|
48 |
privateIn:FileApplicationNoteBook |
|
3892 | 49 |
! |
50 |
||
51 |
AbstractFileApplicationNoteBookComponent subclass:#Terminal |
|
3982 | 52 |
instanceVariableNames:'terminalView' |
53 |
classVariableNames:'' |
|
54 |
poolDictionaries:'' |
|
55 |
privateIn:FileApplicationNoteBook |
|
3892 | 56 |
! |
57 |
||
58 |
AbstractFileApplicationNoteBookComponent subclass:#TextEditor |
|
3982 | 59 |
instanceVariableNames:'fileContentsModel doSaveFile modifiedChannel editView enableSave |
60 |
enableReload presentation changeItemProcess closeApplication |
|
61 |
semaChangeItem printAsHexDump itemChanged itemRemoved |
|
62 |
enableHexToggle textEditorChangeModificationTime' |
|
63 |
classVariableNames:'' |
|
64 |
poolDictionaries:'' |
|
65 |
privateIn:FileApplicationNoteBook |
|
3892 | 66 |
! |
67 |
||
68 |
AbstractFileApplicationNoteBookComponent subclass:#XViewApplication |
|
3982 | 69 |
instanceVariableNames:'xView xFile vncServerPID vncPortNr vncConnection viewerPID |
70 |
vncLock vncServerIsTerminated xItem ext' |
|
71 |
classVariableNames:'' |
|
72 |
poolDictionaries:'' |
|
73 |
privateIn:FileApplicationNoteBook |
|
3892 | 74 |
! |
75 |
||
76 |
||
77 |
!FileApplicationNoteBook class methodsFor:'application list'! |
|
78 |
||
79 |
applicationList |
|
80 |
" returns a list of all applications to start by the NoteBookApplication with |
|
81 |
#className #type |
|
82 |
||
83 |
example: |
|
84 |
#( #'FooEditor' nil ) |
|
85 |
" |
|
86 |
||
87 |
^ #( |
|
88 |
#( #'TextEditor' #file ) |
|
89 |
#( #'TextEditor' #directoryDescription ) |
|
90 |
#( #'HtmlViewApplication' nil ) |
|
91 |
#( #'FindFileApplication' nil ) |
|
92 |
#( #'Terminal' nil ) |
|
93 |
#( #'ImageViewApplication' nil ) |
|
94 |
#( #'ArchiveViewApplication' nil ) |
|
95 |
#( #'CommandResult' nil ) |
|
96 |
#( #'XViewApplication' nil ) |
|
97 |
) |
|
98 |
! |
|
99 |
||
100 |
classFor:aApplicationListItem |
|
101 |
|rawName cls| |
|
102 |
||
103 |
rawName := aApplicationListItem at:1. |
|
104 |
(cls := self privateClassesAt:rawName) isNil ifTrue:[ |
|
105 |
cls := Smalltalk at:rawName. |
|
106 |
]. |
|
107 |
^ cls |
|
108 |
! |
|
109 |
||
110 |
defaultApplication |
|
111 |
" returns the application to be started if no itemQuery returns true or no supportedSuffix is supported |
|
112 |
" |
|
113 |
||
114 |
^ self applicationList detect:[: applItem| |
|
115 |
(((self classFor:applItem) == self textEditorClass) |
|
116 |
and:[(self typeFor:applItem) == #file]) |
|
117 |
] ifNone:[nil]. |
|
118 |
! |
|
119 |
||
120 |
typeFor:aApplicationListItem |
|
121 |
||
122 |
^ aApplicationListItem at:2 |
|
123 |
! ! |
|
124 |
||
125 |
!FileApplicationNoteBook class methodsFor:'classAccess'! |
|
126 |
||
127 |
textEditorClass |
|
128 |
||
129 |
^ TextEditor |
|
130 |
! ! |
|
131 |
||
132 |
!FileApplicationNoteBook class methodsFor:'defaults'! |
|
133 |
||
134 |
openAnotherApplicationOnSameItem |
|
135 |
||
136 |
^ false |
|
137 |
! ! |
|
138 |
||
139 |
!FileApplicationNoteBook class methodsFor:'interface specs'! |
|
140 |
||
141 |
windowSpec |
|
142 |
"This resource specification was automatically generated |
|
143 |
by the UIPainter of ST/X." |
|
144 |
||
145 |
"Do not manually edit this!! If it is corrupted, |
|
146 |
the UIPainter may not be able to read the specification." |
|
147 |
||
148 |
" |
|
149 |
UIPainter new openOnClass:NoteBookApplication andSelector:#windowSpec |
|
150 |
NoteBookApplication new openInterface:#windowSpec |
|
151 |
NoteBookApplication open |
|
152 |
" |
|
153 |
||
154 |
<resource: #canvas> |
|
155 |
||
156 |
^ |
|
157 |
#(#FullSpec |
|
158 |
#name: #windowSpec |
|
159 |
#window: |
|
160 |
#(#WindowSpec |
|
161 |
#label: 'FileBrowserV2TextEditor' |
|
162 |
#name: 'FileBrowserV2TextEditor' |
|
163 |
#min: #(#Point 10 10) |
|
164 |
#max: #(#Point 1024 768) |
|
165 |
#bounds: #(#Rectangle 16 42 316 342) |
|
166 |
) |
|
167 |
#component: |
|
168 |
#(#SpecCollection |
|
169 |
#collection: #( |
|
170 |
#(#NoteBookViewSpec |
|
171 |
#name: 'CommandAndTextEditor' |
|
172 |
#layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
173 |
#model: #selectedEditorPage |
|
174 |
#menu: #tabList |
|
175 |
#useIndex: true |
|
176 |
#accessTabMenuAction: #tabMenuAt: |
|
177 |
#canvas: #canvasHolder |
|
178 |
#keepCanvasAlive: true |
|
179 |
) |
|
180 |
) |
|
181 |
||
182 |
) |
|
183 |
) |
|
184 |
! ! |
|
185 |
||
186 |
!FileApplicationNoteBook class methodsFor:'menu specs'! |
|
187 |
||
188 |
tabMenu |
|
189 |
"This resource specification was automatically generated |
|
190 |
by the MenuEditor of ST/X." |
|
191 |
||
192 |
"Do not manually edit this!! If it is corrupted, |
|
193 |
the MenuEditor may not be able to read the specification." |
|
194 |
||
195 |
" |
|
196 |
MenuEditor new openOnClass:FileApplicationNoteBook andSelector:#tabMenu |
|
197 |
(Menu new fromLiteralArrayEncoding:(FileApplicationNoteBook tabMenu)) startUp |
|
198 |
" |
|
199 |
||
200 |
<resource: #menu> |
|
201 |
||
202 |
^ |
|
203 |
#(#Menu |
|
204 |
#( |
|
205 |
#(#MenuItem |
|
206 |
#label: 'Close' |
|
207 |
#translateLabel: true |
|
208 |
#value: #doCloseApplication |
|
209 |
) |
|
210 |
) |
|
211 |
nil |
|
212 |
nil |
|
213 |
) |
|
214 |
! ! |
|
215 |
||
216 |
!FileApplicationNoteBook methodsFor:'accessing'! |
|
217 |
||
218 |
listOfApplications |
|
219 |
"return the value of the instance variable 'listOfApplications' (automatically generated)" |
|
220 |
||
221 |
listOfApplications isNil ifTrue:[ |
|
222 |
listOfApplications := OrderedCollection new. |
|
223 |
]. |
|
224 |
^ listOfApplications |
|
225 |
! |
|
226 |
||
227 |
selectionHistoryList |
|
228 |
||
229 |
selectionHistoryList isNil ifTrue:[ |
|
230 |
selectionHistoryList := OrderedCollection new. |
|
231 |
]. |
|
232 |
^ selectionHistoryList |
|
233 |
! |
|
234 |
||
235 |
selectionHistoryList:aCol |
|
236 |
||
237 |
selectionHistoryList := aCol |
|
238 |
! ! |
|
239 |
||
240 |
!FileApplicationNoteBook methodsFor:'accessing applications'! |
|
241 |
||
242 |
getAllApplicationsByClass:aClass andType:aType |
|
243 |
||
244 |
^ self listOfApplications select:[ : appl | |
|
245 |
((appl class = aClass) |
|
246 |
and:[appl type = aType]) |
|
247 |
]. |
|
248 |
! |
|
249 |
||
250 |
getApplicationByType:aType |
|
251 |
||
252 |
^ self listOfApplications detect:[ : appl | |
|
253 |
(appl type == aType) |
|
254 |
] ifNone:[nil]. |
|
255 |
! |
|
256 |
||
257 |
getIndexFor:aApplication |
|
258 |
||
259 |
| index | |
|
260 |
||
261 |
index := self listOfApplications indexOf:aApplication. |
|
262 |
index ~~ 0 ifTrue:[ |
|
263 |
^ index. |
|
264 |
]. |
|
265 |
^ nil. |
|
266 |
! |
|
267 |
||
268 |
getSameApplicationsFor:aApplication |
|
269 |
||
270 |
^ self listOfApplications select:[ : appl | |
|
271 |
( (appl ~= aApplication) |
|
272 |
and:[ (appl isKindOf:(aApplication class)) |
|
273 |
and:[ (appl item = (aApplication item)) |
|
274 |
and:[ (appl type == aApplication type) ]]]) |
|
275 |
]. |
|
276 |
! ! |
|
277 |
||
278 |
!FileApplicationNoteBook methodsFor:'actions-app-common'! |
|
279 |
||
280 |
changeItem:aItem for:aAppl |
|
281 |
||
282 |
| applIndex string| |
|
283 |
||
284 |
applIndex := self getIndexFor:aAppl. |
|
3982 | 285 |
(aItem notNil and:[aItem isDirectory not " and:[aAppl type ~= #directoryDescription]"]) ifTrue:[ |
3892 | 286 |
(aAppl changeItem:aItem) ifFalse:[ ^ self]. |
287 |
self fileHistory add:aItem. |
|
288 |
self enableFileHistory value:true. |
|
289 |
]. |
|
290 |
string := aAppl getTabString. |
|
291 |
self privateTabList at:applIndex put:string. |
|
292 |
self doSelect:aAppl. |
|
293 |
! |
|
294 |
||
295 |
closeSubCanvas:aApplication |
|
296 |
||
3929 | 297 |
| applIndex historyList localHistoryList selectedPage| |
3892 | 298 |
|
299 |
applIndex := self getIndexFor:aApplication. |
|
300 |
applIndex notNil ifTrue:[ |
|
301 |
"/ "/ UPDATE THE LAST SELECTION BECAUSE SEL INDEX IS DECREMENTED FOR HIGHER INDEXES |
|
302 |
"/ self lastSelection:applIndex. |
|
303 |
||
304 |
historyList := self selectionHistoryList. |
|
305 |
historyList remove:applIndex ifAbsent:nil. |
|
306 |
localHistoryList := OrderedCollection new. |
|
307 |
historyList notEmpty ifTrue:[ |
|
3929 | 308 |
selectedPage := historyList last. |
3892 | 309 |
] ifFalse:[ |
3929 | 310 |
selectedPage := 1. |
311 |
]. |
|
312 |
self selectedEditorPage value:selectedPage. |
|
313 |
||
3892 | 314 |
historyList do:[ : index | |
315 |
index <= applIndex ifTrue:[ |
|
316 |
localHistoryList add:index |
|
317 |
] ifFalse:[ |
|
318 |
localHistoryList add:(index - 1) |
|
319 |
] |
|
320 |
]. |
|
321 |
self selectionHistoryList:localHistoryList. |
|
322 |
self listOfApplications removeIndex:applIndex. |
|
323 |
self privateTabList removeIndex:applIndex. |
|
324 |
self privateTabList isEmpty ifTrue:[ |
|
325 |
self viewNoteBookApplicationHolder value:false. |
|
326 |
self enableViewNoteBookApplication value:false. |
|
327 |
] ifFalse:[ |
|
328 |
historyList notEmpty ifTrue:[ |
|
329 |
self selectedEditorPage value:(self selectionHistoryList last). |
|
330 |
] |
|
331 |
] |
|
332 |
]. |
|
333 |
||
334 |
"/ because subCanvas was configured to keep its view, |
|
335 |
"/ we must destroy it here. |
|
3987 | 336 |
aApplication window destroy. |
3892 | 337 |
! |
338 |
||
339 |
doCloseApplication |
|
340 |
||
341 |
| appl | |
|
342 |
||
343 |
appl := self listOfApplications at:tabMenuIndex. |
|
344 |
appl doClose. |
|
345 |
! |
|
346 |
||
347 |
openApplByFileItem:aItem |
|
348 |
||
349 |
" use the default class list for open of applications by item " |
|
350 |
||
351 |
| applList applItem itemClass| |
|
352 |
||
353 |
aItem isNil ifTrue:[ ^ self ]. |
|
354 |
applList := self applicationList. |
|
355 |
applItem := applList detect:[: aApplItem| |
|
356 |
itemClass := self class classFor:aApplItem. |
|
357 |
(itemClass canOpenItem:aItem). |
|
358 |
] ifNone:[nil]. |
|
359 |
applItem isNil ifTrue:[ ^ self openDefaultApplicationByItem:aItem]. |
|
360 |
applItem notNil ifTrue:[ |
|
361 |
| itemType | |
|
362 |
itemType := self class typeFor:applItem. |
|
363 |
itemClass := self class classFor:applItem. |
|
364 |
(self openApplicationClass:itemClass withItem:aItem withType:itemType) isNil ifTrue:[ |
|
365 |
^ self openDefaultApplicationByItem:aItem. |
|
366 |
]. |
|
367 |
]. |
|
368 |
! |
|
369 |
||
370 |
openApplicationClass:aClass withItem:aItem withType:aType |
|
371 |
||
372 |
| existingAppl newAppl| |
|
373 |
||
374 |
" do not open not readable items " |
|
375 |
(aItem notNil and:[aItem isDirectory not and:[aItem fileName isReadable not]]) ifTrue:[ |
|
376 |
Dialog warn:'Can not open unreadable file ', aItem fileName baseName. |
|
377 |
AbortSignal raise. |
|
378 |
]. |
|
379 |
existingAppl := self tryToGetExistingApplFor:aClass withItem:aItem withType:aType. |
|
380 |
existingAppl notNil ifTrue:[ |
|
381 |
self doSelect:existingAppl. |
|
382 |
^ existingAppl |
|
383 |
]. |
|
384 |
newAppl := aClass new. |
|
385 |
newAppl type:aType. |
|
386 |
(newAppl item:aItem) ifFalse:[ ^ nil ]. |
|
3906 | 387 |
(aItem notNil and:[(aItem isDirectory not) and:[aType ~= #directoryDescription]]) ifTrue:[ |
3892 | 388 |
self fileHistory add:aItem. |
389 |
self enableFileHistory value:true. |
|
390 |
]. |
|
391 |
self setSameFileIndexFor:newAppl. |
|
392 |
self startApplication:newAppl. |
|
393 |
^ newAppl |
|
394 |
! |
|
395 |
||
396 |
openDefaultApplicationByItem:aItem |
|
397 |
" open the default application if no application for item is available or the start of the |
|
398 |
available application failed |
|
399 |
" |
|
400 |
| applItem | |
|
401 |
||
402 |
applItem := self class defaultApplication. |
|
403 |
applItem notNil ifTrue:[ |
|
404 |
| itemType itemClass| |
|
405 |
itemType := self class typeFor:applItem. |
|
406 |
itemClass := self class classFor:applItem. |
|
407 |
^ self openApplicationClass:itemClass withItem:aItem withType:itemType. |
|
408 |
]. |
|
409 |
^ nil |
|
410 |
! |
|
411 |
||
412 |
setSameFileIndexFor:anAppl |
|
413 |
||
414 |
|sameFiles index item| |
|
415 |
||
416 |
self class openAnotherApplicationOnSameItem not ifTrue:[ |
|
417 |
anAppl sameFileIndex:nil. |
|
418 |
^ self. |
|
419 |
]. |
|
420 |
item := anAppl item. |
|
421 |
item notNil ifTrue:[ |
|
422 |
| hasSameFiles | |
|
423 |
sameFiles := self getSameApplicationsFor:anAppl. |
|
424 |
hasSameFiles := sameFiles notEmpty. |
|
425 |
hasSameFiles ifTrue:[ |
|
426 |
(sameFiles size == 1 and:[sameFiles first sameFileIndex isNil]) ifTrue:[ |
|
427 |
anAppl sameFileIndex:1. |
|
428 |
^ self |
|
429 |
] ifFalse:[ |
|
430 |
index := (sameFiles collect:[:el | (el sameFileIndex ? 1)]) max. |
|
431 |
anAppl sameFileIndex:index + 1. |
|
432 |
^ self |
|
433 |
] |
|
434 |
]. |
|
435 |
anAppl sameFileIndex:nil. |
|
436 |
]. |
|
437 |
! |
|
438 |
||
439 |
startApplication:aApplication |
|
440 |
||
441 |
| window| |
|
442 |
||
443 |
aApplication masterApplication:self. |
|
444 |
aApplication window ifNil:[ |
|
445 |
window := ApplicationSubView new. |
|
446 |
aApplication createBuilder. |
|
447 |
window client:aApplication. |
|
448 |
]. |
|
449 |
self listOfApplications add:aApplication. |
|
450 |
self privateTabList add:(aApplication getTabString). |
|
451 |
self viewNoteBookApplicationHolder value:true. |
|
452 |
self enableViewNoteBookApplication value:true. |
|
453 |
self doSelect:aApplication. |
|
3987 | 454 |
"/ [ |
3892 | 455 |
aApplication postOpenWith:aApplication builder. |
3987 | 456 |
"/ ] forkAt:Processor activePriority. |
3892 | 457 |
! |
458 |
||
459 |
tabStringAdd:aString for:aAppl |
|
460 |
||
461 |
| index text stream| |
|
462 |
||
463 |
index := self getIndexFor:aAppl. |
|
464 |
index isNil ifTrue:[ ^ self]. |
|
465 |
text := self privateTabList at:index. |
|
466 |
stream := WriteStream on:''. |
|
467 |
stream nextPutAll:text. |
|
468 |
stream space. |
|
469 |
stream nextPutAll:aString. |
|
470 |
self privateTabList at:index put:stream contents. |
|
471 |
stream close. |
|
472 |
! |
|
473 |
||
474 |
tabStringChangeTo:aString for:aAppl |
|
475 |
||
476 |
| index| |
|
477 |
||
478 |
index := self getIndexFor:aAppl. |
|
479 |
index isNil ifTrue:[ ^ self]. |
|
480 |
self privateTabList at:index put:aString. |
|
481 |
! |
|
482 |
||
483 |
tryToGetExistingApplFor:aClass withItem:aItem withType:aType |
|
484 |
||
485 |
||
486 |
|sameAppl changeAppl selAppl| |
|
487 |
||
488 |
aClass wantNewApplicationAnyway ifTrue:[^ nil]. |
|
489 |
sameAppl := self getAllApplicationsByClass:aClass andType:aType. |
|
490 |
sameAppl isEmpty ifTrue:[^ nil]. |
|
491 |
((aType == #directoryDescription) or:[aType == #commandResult]) ifTrue:[ |
|
492 |
changeAppl := sameAppl first. |
|
493 |
] ifFalse:[ |
|
494 |
(self openMultipleApplicationsForType value) ifTrue:[ |
|
495 |
"/ open more than one application for a class and a type |
|
496 |
(self class openAnotherApplicationOnSameItem) ifTrue:[ |
|
497 |
"/ open a new application anyway, no matters if item already open |
|
498 |
^ nil |
|
499 |
] ifFalse:[ |
|
500 |
"/ if item already changed select the application |
|
501 |
selAppl := sameAppl detect:[ : appl | |
|
502 |
(appl item = aItem) |
|
503 |
] ifNone:[nil]. |
|
504 |
]. |
|
505 |
] ifFalse:[ |
|
506 |
"/ keep in same application change the first application of the same class and type - if item not changed otherwise open new |
|
507 |
changeAppl := sameAppl detect:[ : appl | |
|
508 |
(appl isModified not) |
|
509 |
] ifNone:[nil]. |
|
510 |
]. |
|
511 |
]. |
|
512 |
changeAppl notNil ifTrue:[ |
|
513 |
self changeItem:aItem for:changeAppl. |
|
514 |
selAppl := changeAppl. |
|
515 |
]. |
|
516 |
^ selAppl. |
|
517 |
! ! |
|
518 |
||
519 |
!FileApplicationNoteBook methodsFor:'actions-app-spec'! |
|
520 |
||
521 |
changeDirectoryDescription |
|
522 |
||
523 |
| aInfoItem| |
|
524 |
||
525 |
aInfoItem := self getInfoItem. |
|
526 |
aInfoItem isNil ifTrue:[ ^ self closeDirectoryDescription ]. |
|
527 |
self openDirectoryDescription. |
|
528 |
! |
|
529 |
||
530 |
closeDirectoryDescription |
|
531 |
||
532 |
| dirContApll | |
|
533 |
||
534 |
dirContApll := self getApplicationByType:#directoryDescription. |
|
535 |
dirContApll notNil ifTrue:[ |
|
536 |
dirContApll doClose. |
|
537 |
]. |
|
538 |
! |
|
539 |
||
540 |
openArchiveViewApplication:aItem |
|
541 |
||
542 |
| result | |
|
543 |
result := self openApplicationClass:ArchiveViewApplication withItem:aItem withType:nil. |
|
544 |
result isNil ifTrue:[ |
|
545 |
Dialog warn:'file type of ', aItem fileName baseName, ' not yet supported'. |
|
546 |
^ self. |
|
547 |
]. |
|
548 |
! |
|
549 |
||
550 |
openCommandResultApplication |
|
551 |
||
552 |
||
553 |
^ self openApplicationClass:CommandResult withItem:nil withType:#commandResult |
|
554 |
! |
|
555 |
||
556 |
openDirectoryDescription |
|
557 |
||
558 |
| appl aInfoItem| |
|
559 |
||
560 |
aInfoItem := self getInfoItem. |
|
561 |
aInfoItem notNil ifTrue:[ |
|
562 |
appl := self openTextEditorOn:aInfoItem type:#directoryDescription. |
|
563 |
]. |
|
564 |
! |
|
565 |
||
566 |
openSearchFileOn:aItem |
|
567 |
||
568 |
^ self openApplicationClass:FindFileApplication withItem:aItem withType:nil |
|
569 |
! |
|
570 |
||
571 |
openTerminalApplication:aItem |
|
572 |
||
573 |
^ self openApplicationClass:Terminal withItem:aItem withType:nil |
|
574 |
! |
|
575 |
||
576 |
openTextEditorOn:aItem |
|
577 |
||
578 |
^ self openTextEditorOn:aItem type:#file |
|
579 |
! |
|
580 |
||
581 |
openTextEditorOn:aItem type:aDirDescrOrFile |
|
582 |
||
583 |
^ self openApplicationClass:TextEditor withItem:aItem withType:aDirDescrOrFile |
|
584 |
! ! |
|
585 |
||
586 |
!FileApplicationNoteBook methodsFor:'applicationlist access'! |
|
587 |
||
588 |
applicationList |
|
589 |
^ self class applicationList |
|
590 |
! ! |
|
591 |
||
592 |
!FileApplicationNoteBook methodsFor:'aspects'! |
|
593 |
||
594 |
canvasHolder |
|
595 |
||
596 |
canvasHolder isNil ifTrue:[ |
|
597 |
canvasHolder := ValueHolder new. |
|
598 |
]. |
|
599 |
^ canvasHolder. |
|
600 |
! |
|
601 |
||
602 |
privateTabList |
|
603 |
||
604 |
privateTabList isNil ifTrue:[ |
|
605 |
privateTabList := List new. |
|
606 |
privateTabList addDependent:self. |
|
607 |
]. |
|
608 |
^ privateTabList. |
|
609 |
! |
|
610 |
||
611 |
selectedEditorPage |
|
612 |
||
613 |
selectedEditorPage isNil ifTrue:[ |
|
614 |
selectedEditorPage := ValueHolder new. |
|
615 |
"/ if your app needs to be notified of changes, uncomment one of the lines below: |
|
616 |
selectedEditorPage addDependent:self. |
|
617 |
"/ selectedEditorPage onChangeSend:#selectedEditorPageChanged to:self. |
|
618 |
]. |
|
619 |
^ selectedEditorPage. |
|
620 |
! |
|
621 |
||
622 |
tabList |
|
623 |
||
624 |
tabList isNil ifTrue:[ |
|
625 |
tabList := (List new) asValue. |
|
626 |
]. |
|
627 |
^ tabList. |
|
628 |
! |
|
629 |
||
630 |
tabList:aValue |
|
631 |
||
632 |
tabList := aValue. |
|
633 |
! ! |
|
634 |
||
635 |
!FileApplicationNoteBook methodsFor:'change & update'! |
|
636 |
||
637 |
update:something with:aParameter from:changedObject |
|
638 |
"Invoked when an object that I depend upon sends a change notification." |
|
639 |
||
640 |
"stub code automatically generated - please change as required" |
|
641 |
||
642 |
| appl sel viewDirDescr| |
|
643 |
||
644 |
||
645 |
changedObject == self currentDirectories ifTrue:[ |
|
646 |
self viewDirectoryDescription value ifTrue:[ |
|
647 |
self changeDirectoryDescription. |
|
648 |
]. |
|
649 |
^ self. |
|
650 |
]. |
|
651 |
changedObject == self viewDirectoryDescription ifTrue:[ |
|
652 |
viewDirDescr := changedObject value. |
|
653 |
viewDirDescr ifTrue:[ |
|
654 |
self openDirectoryDescription. |
|
655 |
] ifFalse:[ |
|
656 |
self closeDirectoryDescription. |
|
657 |
]. |
|
658 |
^ self. |
|
659 |
]. |
|
660 |
changedObject == self privateTabList ifTrue:[ |
|
661 |
| privateListOfTabs | |
|
662 |
privateListOfTabs := changedObject. |
|
663 |
privateListOfTabs size > 1 ifTrue:[ |
|
664 |
self tabList value:privateListOfTabs. |
|
665 |
self tabList changed. |
|
666 |
] ifFalse:[ |
|
667 |
self tabList value:nil. |
|
668 |
]. |
|
669 |
^ self |
|
670 |
]. |
|
671 |
changedObject == self selectedEditorPage ifTrue:[ |
|
672 |
| listOfEdits indexOfLastSel list | |
|
673 |
||
674 |
sel := changedObject value. |
|
675 |
"/ dont want the tabs with one application - thats why i have to change my tablist |
|
676 |
"/ sel goes to if - i want select the last selection |
|
677 |
sel = 0 ifTrue:[ |
|
678 |
^ self. |
|
679 |
]. |
|
680 |
list := self selectionHistoryList. |
|
681 |
(list includes:sel) ifTrue:[ |
|
682 |
list remove:sel |
|
683 |
]. |
|
684 |
list add:sel. |
|
685 |
self selectionHistoryList:list. |
|
686 |
appl := self listOfApplications at:sel. |
|
687 |
self doSelect:appl. |
|
688 |
]. |
|
689 |
||
690 |
^ super update:something with:aParameter from:changedObject |
|
691 |
! ! |
|
692 |
||
693 |
!FileApplicationNoteBook methodsFor:'menu & actions'! |
|
694 |
||
695 |
tabMenuAt:aTab |
|
696 |
||
697 |
|menu| |
|
698 |
||
699 |
menu := Menu new fromLiteralArrayEncoding:self class tabMenu. |
|
700 |
menu ifNil:[ ^ nil ]. |
|
701 |
tabMenuIndex := aTab. |
|
702 |
menu receiver:self. |
|
703 |
^ menu |
|
704 |
! ! |
|
705 |
||
706 |
!FileApplicationNoteBook methodsFor:'queries'! |
|
707 |
||
708 |
getSameFilesModifiedFor:aAppl |
|
709 |
||
710 |
| sameFileAppl colOfChanged | |
|
711 |
||
712 |
sameFileAppl := self getSameApplicationsFor:aAppl. |
|
713 |
sameFileAppl notEmpty ifTrue:[ |
|
714 |
colOfChanged := OrderedCollection new. |
|
715 |
sameFileAppl do:[ : el | |
|
716 |
el modifiedChannel value ifTrue:[ |
|
717 |
colOfChanged add:el. |
|
718 |
] |
|
719 |
] |
|
720 |
]. |
|
721 |
^ colOfChanged |
|
722 |
! ! |
|
723 |
||
724 |
!FileApplicationNoteBook methodsFor:'selection'! |
|
725 |
||
726 |
doSelect:anAppl |
|
727 |
||
728 |
| index fileName| |
|
729 |
||
730 |
fileName := anAppl fileName. |
|
731 |
fileName notNil ifTrue:[ |
|
732 |
self changeFileBrowserTitleTo:fileName baseName. |
|
3982 | 733 |
"/ self gotoFile:fileName. |
3892 | 734 |
]. |
735 |
index := self getIndexFor:anAppl. |
|
3955
43aea4062c21
select file of application if selection changed in NoteBook
penk
parents:
3954
diff
changeset
|
736 |
|
3892 | 737 |
|
738 |
index notNil ifTrue:[ |
|
739 |
canvasHolder value:(anAppl window). |
|
740 |
self selectedEditorPage value:index. |
|
741 |
] |
|
742 |
! ! |
|
743 |
||
744 |
!FileApplicationNoteBook methodsFor:'startup & release'! |
|
745 |
||
3954 | 746 |
closeRequest |
747 |
||
748 |
self listOfApplications do:[:appl| |
|
749 |
appl doClose not ifTrue:[ |
|
750 |
^ false. |
|
751 |
]. |
|
752 |
]. |
|
753 |
super closeRequest. |
|
754 |
^ true |
|
755 |
! |
|
756 |
||
3892 | 757 |
makeDependent |
758 |
||
759 |
self viewDirectoryDescription addDependent:self. |
|
760 |
self currentDirectories addDependent:self. |
|
761 |
! |
|
762 |
||
763 |
postOpenAsSubcanvasWith:aBuilder |
|
764 |
||
765 |
self viewDirectoryDescription changed. |
|
766 |
^ super postOpenAsSubcanvasWith:aBuilder. |
|
767 |
! |
|
768 |
||
769 |
postOpenWith:aBuilder |
|
770 |
||
771 |
" |
|
772 |
only invoked if the application not started from a master |
|
773 |
" |
|
3982 | 774 |
self openTextEditorOn:(DirectoryContentsBrowser itemClass fileName:(Filename homeDirectory construct:'.bashrc')). |
3892 | 775 |
^ super postOpenWith:aBuilder |
776 |
! |
|
777 |
||
778 |
preBuildWith:aBuilder |
|
779 |
||
780 |
self masterApplication isNil ifTrue:[ |
|
781 |
self masterApplication:nil. |
|
782 |
]. |
|
783 |
^ super preBuildWith:aBuilder. |
|
784 |
! ! |
|
785 |
||
786 |
!FileApplicationNoteBook::ArchiveViewApplication class methodsFor:'common options'! |
|
787 |
||
788 |
SupportedFiles |
|
789 |
||
790 |
| dict | |
|
791 |
dict := Dictionary new. |
|
792 |
||
793 |
#( |
|
794 |
'application/x-tar-compressed' tarGZipArchive |
|
795 |
'application/x-tar' tarArchive |
|
796 |
'application/x-gzip-compressed' gzipArchive |
|
797 |
'application/x-zip-compressed' zipArchive |
|
798 |
) pairWiseDo:[ : mimeType :classSelector | |
|
799 |
dict at:mimeType put:classSelector. |
|
800 |
]. |
|
801 |
^ dict |
|
802 |
! |
|
803 |
||
804 |
classSelectorFor:aItem |
|
805 |
||
3951 | 806 |
| class mimeType| |
3892 | 807 |
aItem hasMimeType ifFalse:[^nil]. |
3951 | 808 |
mimeType := aItem mimeType. |
809 |
class := self SupportedFiles at:mimeType ifAbsent:nil. |
|
810 |
(mimeType = 'application/x-gzip-compressed') ifTrue:[ |
|
811 |
(aItem lastButOneSuffix = 'tar') ifTrue:[ |
|
3892 | 812 |
class := #tarGZipArchive. |
813 |
]. |
|
814 |
]. |
|
815 |
^ class. |
|
816 |
! ! |
|
817 |
||
818 |
!FileApplicationNoteBook::ArchiveViewApplication class methodsFor:'defaults'! |
|
819 |
||
820 |
tabStringFor:aApplicationType |
|
821 |
||
822 |
^ 'Archive for:' |
|
823 |
! ! |
|
824 |
||
825 |
!FileApplicationNoteBook::ArchiveViewApplication class methodsFor:'image specs'! |
|
826 |
||
827 |
removeError |
|
828 |
"This resource specification was automatically generated |
|
829 |
by the ImageEditor of ST/X." |
|
830 |
||
831 |
"Do not manually edit this!! If it is corrupted, |
|
832 |
the ImageEditor may not be able to read the specification." |
|
833 |
||
834 |
" |
|
835 |
self removeError inspect |
|
836 |
ImageEditor openOnClass:self andSelector:#removeError |
|
837 |
Icon flushCachedIcons |
|
838 |
" |
|
839 |
||
840 |
<resource: #image> |
|
841 |
||
842 |
^Icon |
|
843 |
constantNamed:#'FileApplicationNoteBook::ArchiveViewApplication class removeError' |
|
844 |
ifAbsentPut:[(Depth8Image new) width: 28; height: 22; photometric:(#palette); bitsPerSample:(#(8 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
845 |
@@@@@@@@@@@FA @@@@@@@@XF@@@@@@@@@@@@@@@@@@@@@@@@@@XF@@@@@@XF@@@@@@@@@@@@@@@@@@@@@@@@@@@@A X@@@XF@@@@@@@@@@@@@@@@@@@@@@@@ |
|
846 |
@@@@@@@FA XF@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@XF@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@XFA X@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@XF |
|
847 |
@@@FA @@@@@@@@@@@@@@@@@@@@@@@@@@@@XF@@@@@@XF@@@@@@@@@@@@@@@@@@@@@@@@@@XF@@@@@@@@A X@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
848 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
849 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
850 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
851 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; colorMapFromArray:#[0 0 0 8 4 8 105 133 190 121 133 157 129 129 129 194 194 194 255 0 0]; mask:((Depth1Image new) width: 28; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@LC@@@A!! @@@L0@@@A8@@@@L@@@@G @@@CL@@@A!! @@@0L@@@@@@@BY=5LAIUUT S5UU8D!!UUPAFU\#@@@@@@@LR9@@D)J @A:R(@@P$*@@CIN @@@@@@@@@a') ; yourself); yourself] |
|
852 |
! ! |
|
853 |
||
854 |
!FileApplicationNoteBook::ArchiveViewApplication class methodsFor:'interface specs'! |
|
855 |
||
856 |
windowSpec |
|
857 |
"This resource specification was automatically generated |
|
858 |
by the UIPainter of ST/X." |
|
859 |
||
860 |
"Do not manually edit this!! If it is corrupted, |
|
861 |
the UIPainter may not be able to read the specification." |
|
862 |
||
863 |
" |
|
3951 | 864 |
UIPainter new openOnClass:FileApplicationNoteBook::ArchiveViewApplication andSelector:#windowSpec |
865 |
FileApplicationNoteBook::ArchiveViewApplication new openInterface:#windowSpec |
|
866 |
FileApplicationNoteBook::ArchiveViewApplication open |
|
3892 | 867 |
" |
868 |
||
869 |
<resource: #canvas> |
|
870 |
||
871 |
^ |
|
872 |
#(#FullSpec |
|
873 |
#name: #windowSpec |
|
874 |
#window: |
|
875 |
#(#WindowSpec |
|
876 |
#label: 'Archive Application' |
|
877 |
#name: 'Archive Application' |
|
878 |
#min: #(#Point 10 10) |
|
879 |
#max: #(#Point 1024 768) |
|
880 |
#bounds: #(#Rectangle 12 22 688 514) |
|
881 |
#menu: #mainMenu |
|
882 |
) |
|
883 |
#component: |
|
884 |
#(#SpecCollection |
|
885 |
#collection: #( |
|
886 |
#(#MenuPanelSpec |
|
887 |
#name: 'MenuTerminal' |
|
888 |
#layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 32 0) |
|
889 |
#menu: #menu |
|
890 |
#textDefault: true |
|
891 |
) |
|
892 |
#(#'FileBrowserV2UISpecifications::PanelSpec' |
|
893 |
#name: 'VerticalPanel' |
|
894 |
#layout: #(#LayoutFrame 0 0.0 32 0.0 0 1.0 0 1.0) |
|
895 |
#borderWidth: 1 |
|
896 |
#whichView: #last |
|
897 |
#orientation: #vertical |
|
898 |
#visibility: #errorListVisibilityHolder |
|
899 |
#component: |
|
900 |
#(#SpecCollection |
|
901 |
#collection: #( |
|
902 |
#(#DataSetSpec |
|
903 |
#name: 'Table1' |
|
904 |
#model: #selectionHolder |
|
905 |
#menu: #fileListMenu |
|
906 |
#hasHorizontalScrollBar: true |
|
907 |
#hasVerticalScrollBar: true |
|
908 |
#dataList: #archiveFileList |
|
909 |
#useIndex: false |
|
910 |
#has3Dsepartors: false |
|
911 |
#doubleClickSelector: #dblClick |
|
912 |
#columnHolder: #tableColumns |
|
913 |
#multipleSelectOk: true |
|
914 |
#verticalSpacing: 0 |
|
915 |
#postBuildCallback: #postBuildFileTable: |
|
916 |
#properties: |
|
917 |
#(#PropertyListDictionary |
|
3951 | 918 |
#dropSelector: #doDrop: |
3892 | 919 |
#dragArgument: #archivApplication |
920 |
#startDragSelector: #doStartDrag:in: |
|
921 |
#displayObjectSelector: #getDisplayObjects: |
|
922 |
#dropObjectSelector: #getDropObjects: |
|
923 |
#dropArgument: #archivApplication |
|
3951 | 924 |
#canDropSelector: #canDrop: |
925 |
#leaveSelector: #dropLeave: |
|
926 |
#overSelector: nil |
|
927 |
#enterSelector: #dropEnter: |
|
3892 | 928 |
) |
929 |
) |
|
930 |
#(#SequenceViewSpec |
|
931 |
#name: 'ErrorList' |
|
932 |
#initiallyDisabled: true |
|
933 |
#hasHorizontalScrollBar: true |
|
934 |
#hasVerticalScrollBar: true |
|
935 |
#backgroundColor: #(#Color 100.0 100.0 100.0) |
|
936 |
#isMultiSelect: true |
|
937 |
#useIndex: false |
|
938 |
#sequenceList: #errorListHolder |
|
939 |
) |
|
940 |
) |
|
941 |
||
942 |
) |
|
943 |
#handles: #(#Any 0.5 1.0) |
|
944 |
) |
|
945 |
) |
|
946 |
||
947 |
) |
|
948 |
) |
|
949 |
! ! |
|
950 |
||
951 |
!FileApplicationNoteBook::ArchiveViewApplication class methodsFor:'menu specs'! |
|
952 |
||
953 |
fileListMenu |
|
954 |
"This resource specification was automatically generated |
|
955 |
by the MenuEditor of ST/X." |
|
956 |
||
957 |
"Do not manually edit this!! If it is corrupted, |
|
958 |
the MenuEditor may not be able to read the specification." |
|
959 |
||
960 |
" |
|
961 |
MenuEditor new openOnClass:NoteBookApplication::ArchiveViewApplication andSelector:#fileListMenu |
|
962 |
(Menu new fromLiteralArrayEncoding:(NoteBookApplication::ArchiveViewApplication fileListMenu)) startUp |
|
963 |
" |
|
964 |
||
965 |
<resource: #menu> |
|
966 |
||
967 |
^ |
|
968 |
#(#Menu |
|
969 |
#( |
|
970 |
#(#MenuItem |
|
971 |
#label: 'Extract to Directory' |
|
972 |
#translateLabel: true |
|
973 |
#value: #extractAll |
|
974 |
#enabled: #hasSelectionInList |
|
975 |
) |
|
976 |
#(#MenuItem |
|
977 |
#label: 'Delete from Archiv' |
|
978 |
#translateLabel: true |
|
979 |
#value: #removeFilesFromArchiv |
|
980 |
#enabled: #canDelete |
|
981 |
#shortcutKeyCharacter: #Delete |
|
982 |
) |
|
983 |
#(#MenuItem |
|
984 |
#label: 'View' |
|
985 |
#translateLabel: true |
|
986 |
#isVisible: #isEmbeddedApplication |
|
987 |
#value: #viewFile |
|
4001 | 988 |
#enabled: #canViewFile |
3892 | 989 |
) |
990 |
#(#MenuItem |
|
991 |
#label: 'Copy Filenames' |
|
992 |
#translateLabel: true |
|
993 |
#value: #copyFilesToClipboard |
|
994 |
#enabled: #hasSelectionInList |
|
995 |
) |
|
996 |
#(#MenuItem |
|
997 |
#label: 'Select All' |
|
998 |
#translateLabel: true |
|
999 |
#value: #selectAll |
|
1000 |
#enabled: #hasListEntriesHolder |
|
1001 |
) |
|
1002 |
) |
|
1003 |
nil |
|
1004 |
nil |
|
1005 |
) |
|
1006 |
! |
|
1007 |
||
1008 |
menu |
|
1009 |
"This resource specification was automatically generated |
|
1010 |
by the MenuEditor of ST/X." |
|
1011 |
||
1012 |
"Do not manually edit this!! If it is corrupted, |
|
1013 |
the MenuEditor may not be able to read the specification." |
|
1014 |
||
1015 |
" |
|
1016 |
MenuEditor new openOnClass:FileApplicationNoteBook::ArchiveViewApplication andSelector:#menu |
|
1017 |
(Menu new fromLiteralArrayEncoding:(FileApplicationNoteBook::ArchiveViewApplication menu)) startUp |
|
1018 |
" |
|
1019 |
||
1020 |
<resource: #menu> |
|
1021 |
||
1022 |
^ |
|
1023 |
#(#Menu |
|
1024 |
#( |
|
1025 |
#(#MenuItem |
|
1026 |
#label: 'Stop' |
|
1027 |
#translateLabel: true |
|
1028 |
#isButton: true |
|
1029 |
#nameKey: #Stop |
|
1030 |
#value: #doStopProcess |
|
1031 |
#enabled: #enableStopButton |
|
1032 |
#labelImage: #(#ResourceRetriever #ToolbarIconLibrary #stop22x22Icon) |
|
1033 |
) |
|
1034 |
#(#MenuItem |
|
1035 |
#label: 'Exctract' |
|
1036 |
#translateLabel: true |
|
1037 |
#isButton: true |
|
1038 |
#value: #extractAll |
|
1039 |
#enabled: #hasListEntriesHolder |
|
1040 |
#labelImage: #(#ResourceRetriever #ToolbarIconLibrary #extract28x28Icon) |
|
1041 |
) |
|
1042 |
#(#MenuItem |
|
1043 |
#label: 'Remove Output' |
|
1044 |
#translateLabel: true |
|
1045 |
#isButton: true |
|
1046 |
#value: #removeErrorOutput |
|
1047 |
#enabled: #enableRemoveErrorOutput |
|
1048 |
#labelImage: #(#ResourceRetriever nil #removeError) |
|
1049 |
) |
|
1050 |
#(#MenuItem |
|
1051 |
#label: 'Close' |
|
1052 |
#translateLabel: true |
|
1053 |
#isButton: true |
|
1054 |
#hideMenuOnActivated: false |
|
1055 |
#isVisible: #isEmbeddedApplication |
|
1056 |
#startGroup: #right |
|
1057 |
#value: #doClose |
|
1058 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #closeIcon) |
|
1059 |
) |
|
1060 |
) |
|
1061 |
nil |
|
1062 |
nil |
|
1063 |
) |
|
1064 |
! ! |
|
1065 |
||
1066 |
!FileApplicationNoteBook::ArchiveViewApplication class methodsFor:'queries'! |
|
1067 |
||
1068 |
canOpenItem:aItem |
|
1069 |
||
1070 |
^ (aItem hasMimeType and:[(aItem mimeType isArchiv) and:[OperatingSystem isUNIXlike]]) |
|
1071 |
! |
|
1072 |
||
1073 |
wantNewApplicationAnyway |
|
1074 |
||
1075 |
^ false |
|
1076 |
! ! |
|
1077 |
||
1078 |
!FileApplicationNoteBook::ArchiveViewApplication class methodsFor:'tableColumns specs'! |
|
1079 |
||
1080 |
tableColumns |
|
1081 |
"This resource specification was automatically generated |
|
1082 |
by the DataSetBuilder of ST/X." |
|
1083 |
||
1084 |
"Do not manually edit this!! If it is corrupted, |
|
1085 |
the DataSetBuilder may not be able to read the specification." |
|
1086 |
||
1087 |
" |
|
1088 |
DataSetBuilder new openOnClass:NoteBookApplication::ArchiveViewApplication andSelector:#tableColumns |
|
1089 |
" |
|
1090 |
||
1091 |
<resource: #tableColumns> |
|
1092 |
||
1093 |
^#( |
|
1094 |
#(#DataSetColumnSpec |
|
1095 |
#id: 'icon' |
|
1096 |
#labelButtonType: #Button |
|
3989 | 1097 |
#labelActionSelector: #sortFileListsBy: |
3892 | 1098 |
#labelActionArgument: 'directory' |
1099 |
#width: 25 |
|
1100 |
#minWidth: 20 |
|
1101 |
#height: 16 |
|
1102 |
#model: #icon |
|
1103 |
#canSelect: false |
|
1104 |
#isResizeable: false |
|
1105 |
#showRowSeparator: false |
|
1106 |
#showColSeparator: false |
|
1107 |
) |
|
1108 |
#(#DataSetColumnSpec |
|
1109 |
#label: 'File Name' |
|
1110 |
#id: 'fileName' |
|
1111 |
#labelAlignment: #left |
|
1112 |
#labelButtonType: #Button |
|
3989 | 1113 |
#labelActionSelector: #sortFileListsBy: |
3892 | 1114 |
#labelActionArgument: 'fileName' |
1115 |
#model: #fileName |
|
1116 |
#canSelect: false |
|
1117 |
#showRowSeparator: false |
|
1118 |
#showColSeparator: false |
|
1119 |
) |
|
1120 |
#(#DataSetColumnSpec |
|
1121 |
#label: 'Perm' |
|
1122 |
#id: 'permissions' |
|
1123 |
#labelButtonType: #Button |
|
3989 | 1124 |
#labelActionSelector: #sortFileListsBy: |
3892 | 1125 |
#labelActionArgument: 'permissions' |
1126 |
#usePreferredWidth: true |
|
1127 |
#width: 75 |
|
1128 |
#model: #permissions |
|
1129 |
#canSelect: false |
|
1130 |
#showRowSeparator: false |
|
1131 |
#showColSeparator: false |
|
1132 |
) |
|
1133 |
#(#DataSetColumnSpec |
|
1134 |
#label: 'Version' |
|
1135 |
#id: 'version' |
|
1136 |
#labelButtonType: #Button |
|
3989 | 1137 |
#labelActionSelector: #sortFileListsBy: |
3892 | 1138 |
#labelActionArgument: 'version' |
1139 |
#columnAlignment: #right |
|
1140 |
#width: 100 |
|
1141 |
#minWidth: 50 |
|
1142 |
#model: #version |
|
1143 |
#canSelect: false |
|
1144 |
#showRowSeparator: false |
|
1145 |
#showColSeparator: false |
|
1146 |
) |
|
1147 |
#(#DataSetColumnSpec |
|
1148 |
#label: 'Type' |
|
1149 |
#id: 'type' |
|
1150 |
#labelButtonType: #Button |
|
3989 | 1151 |
#labelActionSelector: #sortFileListsBy: |
3892 | 1152 |
#labelActionArgument: 'type' |
1153 |
#columnAlignment: #right |
|
1154 |
#width: 100 |
|
1155 |
#minWidth: 50 |
|
1156 |
#model: #type |
|
1157 |
#canSelect: false |
|
1158 |
#showRowSeparator: false |
|
1159 |
#showColSeparator: false |
|
1160 |
) |
|
1161 |
#(#DataSetColumnSpec |
|
1162 |
#label: 'Owner/Group' |
|
1163 |
#id: 'ownerGroup' |
|
1164 |
#labelButtonType: #Button |
|
3989 | 1165 |
#labelActionSelector: #sortFileListsBy: |
3892 | 1166 |
#labelActionArgument: 'ownerGroup' |
1167 |
#columnAlignment: #right |
|
1168 |
#width: 100 |
|
1169 |
#minWidth: 50 |
|
1170 |
#model: #ownerGroup |
|
1171 |
#canSelect: false |
|
1172 |
#showRowSeparator: false |
|
1173 |
#showColSeparator: false |
|
1174 |
) |
|
1175 |
#(#DataSetColumnSpec |
|
1176 |
#label: 'Size' |
|
1177 |
#id: 'size' |
|
1178 |
#labelButtonType: #Button |
|
3989 | 1179 |
#labelActionSelector: #sortFileListsBy: |
3892 | 1180 |
#labelActionArgument: 'sizeAsNumber' |
1181 |
#columnAlignment: #right |
|
1182 |
#width: 80 |
|
1183 |
#model: #size |
|
1184 |
#canSelect: false |
|
1185 |
#showRowSeparator: false |
|
1186 |
#showColSeparator: false |
|
1187 |
) |
|
1188 |
#(#DataSetColumnSpec |
|
1189 |
#label: 'Date & Time' |
|
1190 |
#id: 'dateAndTime' |
|
1191 |
#labelAlignment: #right |
|
1192 |
#labelButtonType: #Button |
|
3989 | 1193 |
#labelActionSelector: #sortFileListsBy: |
3892 | 1194 |
#labelActionArgument: 'dateAndTime' |
1195 |
#columnAlignment: #right |
|
1196 |
#usePreferredWidth: true |
|
1197 |
#width: 140 |
|
1198 |
#model: #dateAndTime |
|
1199 |
#canSelect: false |
|
1200 |
#showRowSeparator: false |
|
1201 |
#showColSeparator: false |
|
1202 |
) |
|
1203 |
#(#DataSetColumnSpec |
|
1204 |
#label: 'Method' |
|
1205 |
#id: 'method' |
|
1206 |
#labelButtonType: #Button |
|
3989 | 1207 |
#labelActionSelector: #sortFileListsBy: |
3892 | 1208 |
#labelActionArgument: 'method' |
1209 |
#columnAlignment: #center |
|
1210 |
#usePreferredWidth: true |
|
1211 |
#width: 140 |
|
1212 |
#model: #method |
|
1213 |
#canSelect: false |
|
1214 |
#showRowSeparator: false |
|
1215 |
#showColSeparator: false |
|
1216 |
) |
|
1217 |
#(#DataSetColumnSpec |
|
1218 |
#label: 'CRC' |
|
1219 |
#id: 'crc' |
|
1220 |
#labelButtonType: #Button |
|
3989 | 1221 |
#labelActionSelector: #sortFileListsBy: |
3892 | 1222 |
#labelActionArgument: 'crc' |
1223 |
#usePreferredWidth: true |
|
1224 |
#width: 140 |
|
1225 |
#model: #crc |
|
1226 |
#canSelect: false |
|
1227 |
#showRowSeparator: false |
|
1228 |
#showColSeparator: false |
|
1229 |
) |
|
1230 |
#(#DataSetColumnSpec |
|
1231 |
#label: 'Compress Size' |
|
1232 |
#id: 'compressSize' |
|
1233 |
#labelButtonType: #Button |
|
3989 | 1234 |
#labelActionSelector: #sortFileListsBy: |
3892 | 1235 |
#labelActionArgument: 'compressSize' |
1236 |
#usePreferredWidth: true |
|
1237 |
#width: 140 |
|
1238 |
#model: #compressSize |
|
1239 |
#canSelect: false |
|
1240 |
#showRowSeparator: false |
|
1241 |
#showColSeparator: false |
|
1242 |
) |
|
1243 |
#(#DataSetColumnSpec |
|
1244 |
#label: 'Ratio' |
|
1245 |
#id: 'ratio' |
|
1246 |
#labelButtonType: #Button |
|
3989 | 1247 |
#labelActionSelector: #sortFileListsBy: |
3892 | 1248 |
#labelActionArgument: 'ratio' |
1249 |
#usePreferredWidth: true |
|
1250 |
#width: 140 |
|
1251 |
#model: #ratio |
|
1252 |
#canSelect: false |
|
1253 |
#showRowSeparator: false |
|
1254 |
#showColSeparator: false |
|
1255 |
) |
|
1256 |
) |
|
1257 |
! ! |
|
1258 |
||
1259 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'accessing'! |
|
1260 |
||
1261 |
archiver |
|
1262 |
"return the value of the instance variable 'archiver' (automatically generated)" |
|
1263 |
||
1264 |
^ archiver |
|
1265 |
! |
|
1266 |
||
1267 |
archiver:something |
|
1268 |
"set the value of the instance variable 'archiver' (automatically generated)" |
|
1269 |
||
1270 |
archiver := something. |
|
1271 |
! |
|
1272 |
||
1273 |
columnDescriptors |
|
1274 |
"return the value of the instance variable 'columnDescriptors' (automatically generated)" |
|
1275 |
||
1276 |
^ columnDescriptors |
|
1277 |
! |
|
1278 |
||
1279 |
columnDescriptors:aListOfColumns |
|
1280 |
"set the value of the instance variable 'columnDescriptors' (automatically generated)" |
|
1281 |
||
1282 |
columnDescriptors = aListOfColumns ifTrue:[ |
|
1283 |
^ self |
|
1284 |
]. |
|
1285 |
||
1286 |
columnDescriptors := OrderedCollection new. |
|
1287 |
||
1288 |
aListOfColumns keysAndValuesDo:[:anIndex :aDesc| |col| |
|
1289 |
col := aDesc isSequenceable ifTrue:[DataSetColumnSpec new fromLiteralArrayEncoding:aDesc] |
|
1290 |
ifFalse:[aDesc]. |
|
1291 |
columnDescriptors add:col. |
|
1292 |
]. |
|
1293 |
! |
|
1294 |
||
1295 |
item:aItem |
|
1296 |
"set the value of the instance variable 'item' (automatically generated)" |
|
1297 |
||
1298 |
| classSelector| |
|
1299 |
||
1300 |
super item:aItem. |
|
1301 |
classSelector := self class classSelectorFor:aItem. |
|
1302 |
(classSelector notNil and:[(Archiver respondsTo:classSelector) notNil]) ifTrue:[ |
|
1303 |
self makeProcessFor:[ |
|
1304 |
self archiver:((Archiver perform:classSelector) with:(self fileName)). |
|
1305 |
self setColumnsForArchiver. |
|
1306 |
] with:'setup archiv'. |
|
1307 |
^ true |
|
1308 |
]. |
|
1309 |
^ false |
|
1310 |
! |
|
1311 |
||
1312 |
temporaryDirectory |
|
1313 |
"return the value of the instance variable 'temporaryDirectory' (automatically generated)" |
|
1314 |
||
1315 |
temporaryDirectory isNil ifTrue:[ |
|
1316 |
temporaryDirectory := Filename newTemporary. |
|
1317 |
temporaryDirectory makeDirectory. |
|
1318 |
]. |
|
1319 |
^ temporaryDirectory |
|
1320 |
! ! |
|
1321 |
||
1322 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'actions'! |
|
1323 |
||
1324 |
changeItem:aItem |
|
1325 |
||
1326 |
self item:aItem. |
|
1327 |
self emptyList. |
|
1328 |
self listAllFilesFromArchiv. |
|
1329 |
^ true |
|
1330 |
! |
|
1331 |
||
1332 |
copyFilesToClipboard |
|
1333 |
||
1334 |
||
1335 |
|sel list stream| |
|
1336 |
||
1337 |
sel := self selectionHolder value. |
|
1338 |
list := self archiveFileList. |
|
1339 |
(sel notNil and:[sel notEmpty]) ifTrue:[ |
|
1340 |
stream := WriteStream on:''. |
|
1341 |
sel do:[: key | |
|
1342 |
stream nextPutAll:(key fileName asString). |
|
1343 |
stream cr. |
|
1344 |
]. |
|
1345 |
self window setTextSelection:stream contents. |
|
1346 |
stream close. |
|
1347 |
]. |
|
1348 |
! |
|
1349 |
||
1350 |
dblClick |
|
1351 |
||
1352 |
self viewFile. |
|
1353 |
! |
|
1354 |
||
1355 |
doStopProcess |
|
1356 |
||
1357 |
| archiver | |
|
1358 |
self stopProcess. |
|
1359 |
archiver := self archiver. |
|
1360 |
archiver notNil ifTrue:[ |
|
1361 |
self archiver stopProcess. |
|
1362 |
]. |
|
1363 |
self enableStopButton value:false. |
|
1364 |
! |
|
1365 |
||
1366 |
emptyList |
|
1367 |
||
1368 |
self archiveFileList value removeAll. |
|
1369 |
! |
|
1370 |
||
1371 |
removeErrorOutput |
|
1372 |
||
1373 |
self viewErrorList value:false. |
|
1374 |
self errorListHolder removeAll. |
|
1375 |
! |
|
1376 |
||
1377 |
removeTemporaryDirectory |
|
1378 |
||
1379 |
| tmp | |
|
1380 |
||
1381 |
temporaryDirectory notNil ifTrue:[ |
|
1382 |
tmp := self temporaryDirectory. |
|
1383 |
(FileDirectory directoryNamed:(tmp directory)) removeDirectory:tmp baseName. |
|
1384 |
temporaryDirectory := nil. |
|
1385 |
]. |
|
1386 |
! |
|
1387 |
||
1388 |
selectAll |
|
1389 |
||
1390 |
| sel listOfFiles| |
|
1391 |
||
1392 |
sel := OrderedCollection new. |
|
1393 |
listOfFiles := self archiveFileList value. |
|
1394 |
1 to:(listOfFiles size) do:[ : el | |
|
1395 |
sel add:el |
|
1396 |
]. |
|
1397 |
self selectionHolder value:sel. |
|
1398 |
! |
|
1399 |
||
1400 |
updateFileBrowserIfPresentWith:aDirectory |
|
1401 |
||
1402 |
| master| |
|
1403 |
||
1404 |
master := self masterApplication. |
|
1405 |
master notNil ifTrue:[ |
|
1406 |
master updateAndSelect:(OrderedCollection with:aDirectory). |
|
1407 |
]. |
|
1408 |
! |
|
1409 |
||
1410 |
viewFile |
|
1411 |
||
1412 |
| master item file tempDir| |
|
1413 |
||
4001 | 1414 |
self canViewFile ifFalse:[^ self]. |
3892 | 1415 |
master := self masterApplication. |
1416 |
self selectionHolder value size = 1 ifFalse:[ |
|
1417 |
Dialog warn:'only one file have to be selected'. |
|
1418 |
^ self. |
|
1419 |
]. |
|
1420 |
tempDir := self temporaryDirectory. |
|
1421 |
self extractSelectedFilesTo:tempDir askForExtractOptions:false. |
|
1422 |
process notNil ifTrue:[ |
|
1423 |
process waitUntilTerminated. |
|
1424 |
]. |
|
1425 |
file := tempDir construct:self selectionHolder value first fileName. |
|
1426 |
file exists ifTrue:[ |
|
3982 | 1427 |
item := DirectoryContentsBrowser itemClass fileName:file. |
3892 | 1428 |
]. |
1429 |
master notNil ifTrue:[ |
|
1430 |
master openApplByFileItem:item. |
|
1431 |
]. |
|
1432 |
! ! |
|
1433 |
||
1434 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'aspects'! |
|
1435 |
||
1436 |
archiveFileList |
|
1437 |
||
1438 |
archiveFileList isNil ifTrue:[ |
|
1439 |
archiveFileList := List new. |
|
1440 |
archiveFileList addDependent:self. |
|
1441 |
]. |
|
1442 |
^ archiveFileList. |
|
1443 |
! |
|
1444 |
||
1445 |
enableRemoveErrorOutput |
|
1446 |
"return/create the 'enableRemoveErrorOutput' value holder (automatically generated)" |
|
1447 |
||
1448 |
enableRemoveErrorOutput isNil ifTrue:[ |
|
1449 |
enableRemoveErrorOutput := false asValue. |
|
1450 |
]. |
|
1451 |
^ enableRemoveErrorOutput |
|
1452 |
! |
|
1453 |
||
1454 |
enableStopButton |
|
1455 |
||
1456 |
enableStopButton isNil ifTrue:[ |
|
1457 |
enableStopButton := false asValue. |
|
1458 |
]. |
|
1459 |
^ enableStopButton |
|
1460 |
! |
|
1461 |
||
1462 |
errorListHolder |
|
1463 |
||
1464 |
errorListHolder isNil ifTrue:[ |
|
1465 |
errorListHolder := List new. |
|
1466 |
]. |
|
1467 |
^ errorListHolder. |
|
1468 |
! |
|
1469 |
||
1470 |
errorListVisibilityHolder |
|
1471 |
||
1472 |
errorListVisibilityHolder isNil ifTrue:[ |
|
1473 |
errorListVisibilityHolder := false asValue. |
|
1474 |
]. |
|
1475 |
^ errorListVisibilityHolder |
|
1476 |
! |
|
1477 |
||
1478 |
hasSelectionInList |
|
1479 |
||
1480 |
| sel | |
|
1481 |
sel := self selectionHolder value. |
|
1482 |
^ (sel notNil and:[sel notEmpty]) |
|
1483 |
! |
|
1484 |
||
1485 |
selectionHolder |
|
1486 |
||
1487 |
selectionHolder isNil ifTrue:[ |
|
1488 |
selectionHolder := ValueHolder new. |
|
1489 |
selectionHolder addDependent:self. |
|
1490 |
]. |
|
1491 |
^ selectionHolder. |
|
1492 |
! |
|
1493 |
||
1494 |
tableColumns |
|
1495 |
||
1496 |
tableColumns isNil ifTrue:[ |
|
1497 |
tableColumns := self class tableColumns asValue. |
|
1498 |
]. |
|
1499 |
^ tableColumns. |
|
1500 |
! |
|
1501 |
||
1502 |
viewErrorList |
|
1503 |
"return/create the 'viewErrorList' value holder (automatically generated)" |
|
1504 |
||
1505 |
viewErrorList isNil ifTrue:[ |
|
1506 |
viewErrorList := false asValue. |
|
1507 |
viewErrorList onChangeSend:#viewErrorListChanged to:self. |
|
1508 |
]. |
|
1509 |
^ viewErrorList |
|
1510 |
! ! |
|
1511 |
||
1512 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'change & update'! |
|
1513 |
||
1514 |
update:something with:aParameter from:changedObject |
|
1515 |
"Invoked when an object that I depend upon sends a change notification." |
|
1516 |
||
1517 |
"stub code automatically generated - please change as required" |
|
1518 |
||
1519 |
changedObject == self archiveFileList ifTrue:[ |
|
1520 |
self hasListEntriesHolder value:(changedObject notEmpty). |
|
1521 |
^ self |
|
1522 |
]. |
|
1523 |
super update:something with:aParameter from:changedObject |
|
1524 |
! |
|
1525 |
||
1526 |
viewErrorListChanged |
|
1527 |
||
1528 |
| viewListValue| |
|
1529 |
||
1530 |
viewListValue := self viewErrorList value. |
|
1531 |
self enableRemoveErrorOutput value:viewListValue. |
|
1532 |
self errorListVisibilityHolder value:viewListValue. |
|
1533 |
! ! |
|
1534 |
||
1535 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'command execution'! |
|
1536 |
||
1537 |
getErrorBlock |
|
1538 |
||
1539 |
^ |
|
1540 |
[: x | |
|
1541 |
self viewErrorList value:true. |
|
1542 |
self errorListHolder value add:x. |
|
1543 |
] |
|
1544 |
! |
|
1545 |
||
1546 |
getErrorStream |
|
1547 |
||
1548 |
|errStream| |
|
1549 |
||
1550 |
errStream := ActorStream new. |
|
1551 |
errStream nextPutLineBlock:(self getErrorBlock). |
|
1552 |
^ errStream |
|
1553 |
! |
|
1554 |
||
1555 |
getOutBlock |
|
1556 |
||
1557 |
|firstLineNotReaded key| |
|
1558 |
||
1559 |
firstLineNotReaded := true. |
|
1560 |
^ [: line | |
|
1561 |
| words ownerGroup item archiverColumns itemWriter index itemWordCount| |
|
1562 |
||
1563 |
(firstLineNotReaded and:[archiver class hasTitleLine]) ifTrue:[ |
|
1564 |
firstLineNotReaded := false. |
|
1565 |
]ifFalse:[ |
|
1566 |
words := line asCollectionOfWords. |
|
1567 |
archiverColumns := archiver class columns. |
|
1568 |
item := ArchivItem new. |
|
1569 |
index := 1. |
|
1570 |
archiverColumns do:[:colDescr | |
|
1571 |
| itemStream | |
|
1572 |
itemWordCount := colDescr second. |
|
1573 |
itemWriter := ((colDescr first) asString, ':') asSymbol. |
|
1574 |
itemStream := WriteStream on:''. |
|
1575 |
index to:(index + itemWordCount - 1) do:[:i| |
|
1576 |
itemStream nextPutAll:(words at:i). |
|
1577 |
itemStream space. |
|
1578 |
]. |
|
1579 |
item perform:itemWriter with:(itemStream contents). |
|
1580 |
itemStream close. |
|
1581 |
index := index + itemWordCount. |
|
1582 |
]. |
|
1583 |
((archiverColumns collect:[:el| el first]) includes:#permissions) ifTrue:[ |
|
1584 |
(item permissions startsWith:$d) ifTrue:[ |
|
1585 |
key := #directory. |
|
1586 |
item isDirectory:true. |
|
1587 |
] ifFalse:[ |
|
1588 |
key := MIMETypes mimeTypeForFilename:(item fileName asFilename baseName). |
|
1589 |
item isDirectory:false. |
|
1590 |
]. |
|
1591 |
] ifFalse:[ |
|
1592 |
key := MIMETypes mimeTypeForFilename:(item fileName asFilename baseName). |
|
1593 |
]. |
|
1594 |
item icon:(FileBrowser iconForKeyMatching:key). |
|
1595 |
self archiveFileList value add:item |
|
1596 |
]. |
|
1597 |
] |
|
1598 |
! |
|
1599 |
||
1600 |
getOutStream |
|
1601 |
||
1602 |
|outStream| |
|
1603 |
||
1604 |
outStream := ActorStream new. |
|
1605 |
outStream nextPutLineBlock:(self getOutBlock). |
|
1606 |
^ outStream |
|
1607 |
! |
|
1608 |
||
1609 |
makeProcessFor:aBlock |
|
1610 |
||
1611 |
self makeProcessFor:aBlock with:'' |
|
1612 |
! |
|
1613 |
||
1614 |
makeProcessFor:aBlock with:string |
|
1615 |
||
1616 |
| locBlock | |
|
1617 |
||
1618 |
process notNil ifTrue:[ |
|
1619 |
process waitUntilTerminated. |
|
1620 |
terminateByMe ifTrue:[ |
|
1621 |
terminateByMe := false. |
|
1622 |
^ self |
|
1623 |
]. |
|
1624 |
]. |
|
1625 |
locBlock := [ [ |
|
1626 |
self notifyChannel value:string. |
|
1627 |
aBlock value. |
|
1628 |
self notifyChannel value:''. |
|
1629 |
] valueNowOrOnUnwindDo:[ |
|
1630 |
process := nil. |
|
1631 |
self enableStopButton value:false. |
|
1632 |
] |
|
1633 |
]. |
|
1634 |
process := locBlock newProcess. |
|
1635 |
process priority:(Processor systemBackgroundPriority). |
|
1636 |
process name:'ArchiveApplicationProcess'. |
|
1637 |
self enableStopButton value:true. |
|
1638 |
process resume. |
|
1639 |
! |
|
1640 |
||
1641 |
setColumnsForArchiver |
|
1642 |
||
1643 |
| newColumns archiverColumns allColumns iconColumn| |
|
1644 |
||
1645 |
archiverColumns := archiver class columns collect:[:el| el first]. |
|
1646 |
allColumns := OrderedCollection new. |
|
1647 |
newColumns := OrderedCollection new. |
|
1648 |
self class tableColumns do:[:el| |
|
1649 |
allColumns add:(DataSetColumnSpec new fromLiteralArrayEncoding:el). |
|
1650 |
]. |
|
1651 |
iconColumn := allColumns detect:[: col | (col id asSymbol) = #icon] ifNone:[nil]. |
|
1652 |
iconColumn notNil ifTrue:[ |
|
1653 |
newColumns add:iconColumn. |
|
1654 |
]. |
|
1655 |
allColumns do:[:col| |
|
1656 |
(archiverColumns includes:(col id asSymbol)) ifTrue:[ |
|
1657 |
newColumns add:col. |
|
1658 |
]. |
|
1659 |
]. |
|
1660 |
self tableColumns value:newColumns. |
|
1661 |
self columnDescriptors:(self tableColumns value). |
|
1662 |
! |
|
1663 |
||
1664 |
stopProcess |
|
1665 |
||
1666 |
|task| |
|
1667 |
||
1668 |
terminateByMe := true. |
|
1669 |
(task := process) notNil ifTrue:[ |
|
1670 |
process := nil. |
|
1671 |
||
1672 |
Object errorSignal handle:[:ex| |
|
1673 |
Dialog warn:ex description. |
|
1674 |
]do:[ |
|
1675 |
task isDead ifFalse:[ |
|
3919 | 1676 |
task terminateWithAllSubprocessesInGroup. |
3892 | 1677 |
task waitUntilTerminated. |
1678 |
] |
|
1679 |
] |
|
1680 |
]. |
|
1681 |
! ! |
|
1682 |
||
1683 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'command helper'! |
|
1684 |
||
1685 |
selectDirectoryDialog |
|
1686 |
||
1687 |
| dir directory haveDirectory| |
|
1688 |
||
1689 |
directory := self fileName directory. |
|
1690 |
haveDirectory := false. |
|
1691 |
[haveDirectory] whileFalse:[ |
|
1692 |
dir := Dialog requestDirectoryName:'Which directory ?' default:dir. |
|
3988 | 1693 |
dir isEmpty ifTrue:[ ^ nil]. |
3892 | 1694 |
dir := dir asFilename. |
1695 |
(dir isExecutable not or:[dir isWritable not]) ifTrue:[ |
|
1696 |
Dialog warn:'cant write to: ', dir asString. |
|
1697 |
]. |
|
1698 |
haveDirectory := true. |
|
1699 |
]. |
|
1700 |
^ dir |
|
3988 | 1701 |
! |
1702 |
||
1703 |
selectDirectoryDialog:message |
|
1704 |
||
1705 |
| dir directory haveDirectory| |
|
1706 |
||
1707 |
directory := self fileName directory. |
|
1708 |
haveDirectory := false. |
|
1709 |
[haveDirectory] whileFalse:[ |
|
1710 |
dir := Dialog requestDirectoryName:message default:dir. |
|
1711 |
dir isEmpty ifTrue:[ ^ nil]. |
|
1712 |
dir := dir asFilename. |
|
1713 |
(dir isExecutable not or:[dir isWritable not]) ifTrue:[ |
|
1714 |
Dialog warn:'Cannot write to: ', dir asString. |
|
1715 |
^ nil. |
|
1716 |
]. |
|
1717 |
haveDirectory := true. |
|
1718 |
]. |
|
1719 |
^ dir |
|
3892 | 1720 |
! ! |
1721 |
||
1722 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'commands add'! |
|
1723 |
||
1724 |
addFilesToArchiv:colOfFiles |
|
1725 |
||
1726 |
||
1727 |
self archiver outStream:nil errorStream:(self getErrorStream) synchron:true. |
|
1728 |
self makeProcessFor:[ |
|
1729 |
self archiver addFilesToArchiv:colOfFiles. |
|
1730 |
] with:'add Files to archiv'. |
|
1731 |
(self archiver class == Archiver zipArchive) ifTrue:[ |
|
1732 |
self listAllFilesFromArchiv. |
|
1733 |
] ifFalse:[ |
|
1734 |
self listFilesFromArchiv:colOfFiles. |
|
1735 |
]. |
|
1736 |
^ true. |
|
1737 |
! ! |
|
1738 |
||
1739 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'commands extract'! |
|
1740 |
||
1741 |
extractAll |
|
1742 |
||
1743 |
self extractSelectedFilesTo:nil withSelection:#all |
|
1744 |
! |
|
1745 |
||
1746 |
extractSelectedFilesTo:aDirectory askForExtractOptions:askForExtractOptionsBoolean |
|
1747 |
||
1748 |
self extractSelectedFilesTo:aDirectory withSelection:#selection askForExtractOptions:askForExtractOptionsBoolean |
|
1749 |
! |
|
1750 |
||
1751 |
extractSelectedFilesTo:aDirectory withSelection:selectOrAll |
|
1752 |
||
1753 |
self extractSelectedFilesTo:aDirectory withSelection:selectOrAll askForExtractOptions:true. |
|
1754 |
! |
|
1755 |
||
1756 |
extractSelectedFilesTo:aDirectory withSelection:selectOrAll askForExtractOptions:askForExtractOptionsBoolean |
|
1757 |
||
1758 |
| dir| |
|
1759 |
||
1760 |
aDirectory isNil ifTrue:[ |
|
3988 | 1761 |
dir := self selectDirectoryDialog:'Extract in which directory ?'. |
3892 | 1762 |
dir isNil ifTrue:[^ self]. |
1763 |
] ifFalse:[ |
|
1764 |
dir := aDirectory. |
|
1765 |
]. |
|
1766 |
selectOrAll == #all ifTrue:[ |
|
1767 |
self extractAllTo:dir. |
|
1768 |
]. |
|
1769 |
selectOrAll == #selection ifTrue:[ |
|
1770 |
self extractSelectionTo:dir askForExtractOptions:askForExtractOptionsBoolean |
|
1771 |
]. |
|
4001 | 1772 |
"/ self updateFileBrowserIfPresentWith:dir. |
3892 | 1773 |
! ! |
1774 |
||
1775 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'commands extract private'! |
|
1776 |
||
1777 |
extractAllTo:aDirectory |
|
1778 |
||
1779 |
self archiver outStream:nil errorStream:(self getErrorStream) synchron:true. |
|
1780 |
self makeProcessFor:[ |
|
1781 |
self archiver extractTo:aDirectory. |
|
1782 |
] with:'extract all files'. |
|
1783 |
^ true. |
|
1784 |
! |
|
1785 |
||
1786 |
extractSelectionTo:aDirectory askForExtractOptions:askForExtractOptionsBoolean |
|
1787 |
||
1788 |
| sel index extractWithDirectoryPart extractAllFilesInSelectedDirectories extractFiles| |
|
1789 |
||
1790 |
extractWithDirectoryPart := true. |
|
1791 |
extractAllFilesInSelectedDirectories := false. |
|
1792 |
sel := self selectionHolder value. |
|
1793 |
(sel isNil or:[sel isEmpty]) ifTrue:[ |
|
1794 |
sel := self archiveFileList value. |
|
1795 |
]. |
|
1796 |
sel := sel do:[:item| |
|
1797 |
item fileName: item fileName |
|
1798 |
]. |
|
1799 |
(askForExtractOptionsBoolean and:[self archiver class ~= Archiver zipArchive]) ifTrue:[ |
|
1800 |
extractFiles := self selRemoveFilesForDirs:sel. |
|
1801 |
] ifFalse:[ |
|
1802 |
extractFiles := sel. |
|
1803 |
]. |
|
1804 |
||
1805 |
askForExtractOptionsBoolean ifTrue:[ |
|
1806 |
index := extractFiles findFirst:[: el | el hasDirectoryPart]. |
|
1807 |
index ~= 0 ifTrue:[ |
|
1808 |
extractWithDirectoryPart := (Dialog confirmWithCancel:'Extract with directory part?' default:true). |
|
1809 |
extractWithDirectoryPart isNil ifTrue:[^ false]. |
|
1810 |
]. |
|
1811 |
]. |
|
1812 |
extractWithDirectoryPart ifTrue:[ |
|
1813 |
self extractWithDirectoryPartTo:aDirectory with:extractFiles. |
|
1814 |
] ifFalse:[ |
|
1815 |
self extractWithOutDirectoryPartTo:aDirectory with:extractFiles. |
|
1816 |
]. |
|
1817 |
^ true |
|
1818 |
! |
|
1819 |
||
1820 |
extractWithDirectoryPartTo:aDirectory with:extractFiles |
|
1821 |
||
1822 |
self archiver outStream:nil errorStream:(self getErrorStream) synchron:true. |
|
1823 |
self makeProcessFor:[ |
|
1824 |
self archiver extractTo:aDirectory with:extractFiles. |
|
1825 |
] with:('extract Files to ', aDirectory asString). |
|
1826 |
^ true. |
|
1827 |
! |
|
1828 |
||
1829 |
extractWithOutDirectoryPartTo:aDirectory with:extractFiles |
|
1830 |
||
1831 |
self archiver outStream:nil errorStream:(self getErrorStream) synchron:true. |
|
1832 |
self makeProcessFor:[ |
|
1833 |
self archiver extractWithOutDirectoryTo:aDirectory |
|
1834 |
with:(extractFiles collect:[:item| item fileName]). |
|
1835 |
] with:('extract Files to ', aDirectory asString). |
|
1836 |
^ true. |
|
1837 |
! ! |
|
1838 |
||
1839 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'commands list'! |
|
1840 |
||
1841 |
listAllFilesFromArchiv |
|
1842 |
||
1843 |
self archiveFileList value removeAll. |
|
1844 |
self listFilesFromArchiv:nil |
|
1845 |
! |
|
1846 |
||
1847 |
listFilesFromArchiv:newColOfFiles |
|
1848 |
||
1849 |
process notNil ifTrue:[ |
|
1850 |
process waitUntilTerminated. |
|
1851 |
]. |
|
1852 |
self archiver outStream:(self getOutStream) errorStream:(self getErrorStream) synchron:true. |
|
1853 |
self makeProcessFor:[ |
|
1854 |
self archiver listFilesFromArchiv:newColOfFiles. |
|
1855 |
] with:'list Files'. |
|
1856 |
! ! |
|
1857 |
||
1858 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'commands remove'! |
|
1859 |
||
1860 |
removeFilesFromArchiv |
|
1861 |
||
1862 |
| sel realSel list firtsPre stringCol stringRealSel| |
|
1863 |
||
1864 |
sel := self selectionHolder value. |
|
1865 |
stringCol := sel collect:[: item| item fileName]. |
|
1866 |
firtsPre := stringCol at:1. |
|
1867 |
stringCol from:2 do:[:el| |
|
1868 |
firtsPre := firtsPre commonPrefixWith:el. |
|
1869 |
]. |
|
1870 |
list := self archiveFileList value. |
|
1871 |
realSel := OrderedCollection new. |
|
1872 |
list do:[:item| |
|
1873 |
((item fileName) startsWith:firtsPre) ifTrue:[ |
|
1874 |
realSel add:item. |
|
1875 |
]. |
|
1876 |
]. |
|
1877 |
stringRealSel := realSel collect:[: item| item fileName]. |
|
1878 |
||
1879 |
self archiver outStream:nil errorStream:(self getErrorStream) synchron:true. |
|
1880 |
self makeProcessFor:[ |
|
1881 |
self archiver removeFilesFromArchiv:stringCol. |
|
1882 |
] with:'remove files'. |
|
1883 |
||
1884 |
self archiveFileList value removeAll:realSel |
|
1885 |
! ! |
|
1886 |
||
1887 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'drag & drop'! |
|
1888 |
||
3951 | 1889 |
canDrop:aContext |
1890 |
||
1891 |
^ inDropMode |
|
3892 | 1892 |
! |
1893 |
||
1894 |
doDrop:aContext |
|
1895 |
||
1896 |
|col source arg objects| |
|
1897 |
||
1898 |
source := aContext dropSource. |
|
1899 |
arg := source argument. |
|
1900 |
objects := aContext dropObjects. |
|
1901 |
col := OrderedCollection new. |
|
1902 |
objects do:[:obj| |
|
1903 |
col add:(obj theObject). |
|
1904 |
]. |
|
1905 |
^ self addFilesToArchiv:col. |
|
1906 |
! |
|
1907 |
||
1908 |
doStartDrag:aDropSource in:aView |
|
1909 |
"set the cursors before starting the drag & drop operation |
|
1910 |
" |
|
1911 |
|hdl sel| |
|
1912 |
||
1913 |
archiver class canRemoveFiles ifFalse:[^ self]. |
|
1914 |
sel := self selectionHolder value. |
|
1915 |
||
1916 |
hdl := DragAndDropManager new. |
|
1917 |
||
3951 | 1918 |
hdl disabledCursor:AbstractFileBrowser DisabledCursorImage. |
1919 |
hdl enabledCursor:AbstractFileBrowser EnabledCursorImage. |
|
3892 | 1920 |
hdl alienCursor:nil. |
1921 |
||
1922 |
hdl startDragFrom:aView dropSource:aDropSource offset:#topLeft |
|
1923 |
! |
|
1924 |
||
3951 | 1925 |
dropEnter:aContext |
1926 |
||
1927 |
| dropedObjects| |
|
1928 |
||
1929 |
inDropMode := false. |
|
1930 |
(aContext dropSource receiver == self) ifTrue:[^ self]. |
|
1931 |
dropedObjects := aContext dropObjects. |
|
1932 |
||
1933 |
||
1934 |
dropedObjects do:[:aObject| |checkObject checkObjectString| |
|
1935 |
aObject isFileObject ifFalse:[^ self]. |
|
1936 |
checkObject := aObject theObject. |
|
1937 |
checkObject isFilename not ifTrue:[^ self]. |
|
1938 |
checkObject isSpecialFile ifTrue:[^ self]. |
|
1939 |
]. |
|
1940 |
inDropMode := true. |
|
1941 |
! |
|
1942 |
||
1943 |
dropLeave:aContext |
|
1944 |
||
1945 |
inDropMode := false. |
|
1946 |
! |
|
1947 |
||
3892 | 1948 |
getDisplayObjects:anArgument |
1949 |
||
1950 |
| sel string size fnName stream| |
|
1951 |
sel := self selectionHolder value. |
|
1952 |
size := sel size. |
|
1953 |
size == 0 ifTrue:[^ '']. |
|
1954 |
stream := WriteStream on:''. |
|
1955 |
stream nextPutAll:(sel first fileName asFilename baseName asString). |
|
1956 |
size == 1 ifTrue:[ |
|
1957 |
fnName := 'ui_menuitem.xpm'. |
|
1958 |
] ifFalse:[ |
|
1959 |
fnName := 'ui_submenu_open.xpm'. |
|
1960 |
stream nextPutAll:' ... '. |
|
1961 |
stream nextPutAll:(sel last fileName asFilename baseName asString). |
|
1962 |
]. |
|
1963 |
string := stream contents. |
|
1964 |
stream close. |
|
1965 |
^ Array with:(LabelAndIcon icon:(Image fromFile:fnName) |
|
1966 |
string:(Text string:string emphasis:#bold) |
|
1967 |
) |
|
1968 |
! |
|
1969 |
||
1970 |
getDropObjects:anArgument |
|
1971 |
||
1972 |
| sel ret| |
|
1973 |
sel := self selectionHolder value. |
|
1974 |
ret := sel collect:[:el| |
|
3951 | 1975 |
DropObject newFile:(el fileName asFilename) |
3892 | 1976 |
]. |
1977 |
^ ret |
|
1978 |
! ! |
|
1979 |
||
1980 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'event handling'! |
|
1981 |
||
1982 |
processEvent:anEvent |
|
1983 |
"filter keyboard events. |
|
1984 |
Return true, if I have eaten the event" |
|
1985 |
||
1986 |
|focusView key rawKey| |
|
1987 |
||
1988 |
anEvent isKeyPressEvent ifTrue:[ |
|
1989 |
focusView := anEvent targetView. |
|
1990 |
key := anEvent key. |
|
1991 |
rawKey := anEvent rawKey. |
|
1992 |
||
1993 |
(focusView isSameOrComponentOf:self window) ifTrue:[ |
|
1994 |
"/ (key ~= #'Alt_L') ifTrue:[self halt.]. |
|
1995 |
(key == #Delete) ifTrue:[ |
|
1996 |
self removeFilesFromArchiv. |
|
1997 |
^ true |
|
1998 |
]. |
|
1999 |
] |
|
2000 |
]. |
|
2001 |
^ false |
|
2002 |
! ! |
|
2003 |
||
2004 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'initialization & release'! |
|
2005 |
||
2006 |
postBuildFileTable:aWidget |
|
2007 |
||
2008 |
fileTable := aWidget scrolledView. |
|
2009 |
fileTable wantsFocusWithPointerEnter. |
|
2010 |
"/ FileBrowser icons keysAndValuesDo:[:aKey :anIcon| |
|
2011 |
"/ fileTable registerImage:anIcon key:aKey. |
|
2012 |
"/ ]. |
|
2013 |
self columnDescriptors:(self class tableColumns). |
|
2014 |
! |
|
2015 |
||
2016 |
postOpenWith:aBuilder |
|
2017 |
||
2018 |
| currentDir contents suffix fileName file archivItem| |
|
2019 |
||
2020 |
self windowGroup addPreEventHook:self. |
|
2021 |
self masterApplication isNil ifTrue:[ |
|
2022 |
self masterApplication:nil. |
|
2023 |
currentDir := Filename homeDirectory. |
|
2024 |
contents := currentDir directoryContents. |
|
2025 |
fileName := contents detect:[: file | |
|
2026 |
suffix := file asFilename suffix asLowercase. |
|
2027 |
suffix = 'tgz' |
|
2028 |
] ifNone:[nil]. |
|
2029 |
fileName isNil ifTrue:[ |
|
2030 |
Dialog warn:'cant find a Zip file in ', currentDir asString. |
|
2031 |
^ self |
|
2032 |
]. |
|
2033 |
file := currentDir construct:fileName. |
|
3982 | 2034 |
archivItem := DirectoryContentsBrowser itemClass fileName:file. |
3892 | 2035 |
(self item:archivItem) ifFalse:[ |
2036 |
Dialog warn:'file type of ', item fileName asString, ' not supported'. |
|
2037 |
^ self. |
|
2038 |
]. |
|
2039 |
]. |
|
2040 |
self listAllFilesFromArchiv. |
|
2041 |
^ super postOpenWith:aBuilder. |
|
2042 |
! |
|
2043 |
||
2044 |
release |
|
2045 |
||
2046 |
self archiver release. |
|
2047 |
^ super release. |
|
2048 |
! ! |
|
2049 |
||
2050 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'queries'! |
|
2051 |
||
2052 |
archivType |
|
2053 |
||
2054 |
| file firstsuffix secondsuffix| |
|
2055 |
||
2056 |
file := self fileName. |
|
2057 |
firstsuffix := file withoutSuffix suffix. |
|
2058 |
secondsuffix := file suffix. |
|
2059 |
(secondsuffix = 'tgz' or:[firstsuffix = 'tar' and:[secondsuffix = 'gz']]) ifTrue:[ |
|
2060 |
^ #tarFileCompressed |
|
2061 |
]. |
|
2062 |
(secondsuffix = 'tar') ifTrue:[ |
|
2063 |
^ #tarFile |
|
2064 |
]. |
|
2065 |
(secondsuffix = 'gz') ifTrue:[ |
|
2066 |
^ #gzipFile |
|
2067 |
]. |
|
2068 |
(secondsuffix = 'zip') ifTrue:[ |
|
2069 |
^ #zipFile |
|
2070 |
]. |
|
2071 |
! |
|
2072 |
||
2073 |
canDelete |
|
2074 |
||
2075 |
^ (self hasOneSelectionInList and:[archiver class canRemoveFiles]) |
|
2076 |
! |
|
2077 |
||
4001 | 2078 |
canViewFile |
2079 |
||
2080 |
^ self archiver class canViewFile and:[self hasOneSelectionInList] |
|
2081 |
! |
|
2082 |
||
2083 |
hasListEntriesHolder |
|
2084 |
"return/create the 'hasListEntriesHolder' value holder (automatically generated)" |
|
2085 |
||
2086 |
hasListEntriesHolder isNil ifTrue:[ |
|
2087 |
hasListEntriesHolder := false asValue. |
|
2088 |
]. |
|
2089 |
^ hasListEntriesHolder |
|
2090 |
! |
|
2091 |
||
2092 |
hasOneSelectionInList |
|
2093 |
||
2094 |
| sel | |
|
2095 |
sel := self selectionHolder value. |
|
2096 |
^ (sel notNil and:[sel notEmpty and:[sel size = 1]]) |
|
2097 |
! |
|
2098 |
||
3892 | 2099 |
selRemoveFilesForDirs:aSel |
2100 |
||
2101 |
|stringCol newSel string| |
|
2102 |
||
2103 |
stringCol := (aSel collect:[: item| item fileName]). |
|
2104 |
newSel := aSel copy. |
|
2105 |
aSel do:[:item | |
|
2106 |
item isDirectory ifTrue:[ |
|
2107 |
string := item fileName. |
|
2108 |
stringCol doWithIndex:[:filename : index| |
|
2109 |
(filename ~= string and:[filename startsWith:string]) ifTrue:[ |
|
2110 |
newSel remove:(aSel at:index) ifAbsent:[nil]. |
|
2111 |
] |
|
2112 |
] |
|
2113 |
]. |
|
2114 |
]. |
|
2115 |
^ newSel. |
|
2116 |
! ! |
|
2117 |
||
2118 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'sorting'! |
|
2119 |
||
2120 |
generateSortBlock:instanceName |
|
2121 |
||
2122 |
| aSymbol cmpOp sortCaselessLocal| |
|
2123 |
||
2124 |
aSymbol := instanceName asSymbol. |
|
2125 |
sortCaselessLocal := self sortCaseless value. |
|
2126 |
currentSortOrder isNil ifTrue:[ |
|
2127 |
currentSortOrder := aSymbol. |
|
2128 |
currentSortOrder := Dictionary new. |
|
2129 |
currentSortOrder at:#column put:aSymbol. |
|
2130 |
currentSortOrder at:#reverse put:false. |
|
2131 |
currentSortOrder at:#sortCaseless put:sortCaselessLocal. |
|
2132 |
] ifFalse:[ |
|
2133 |
(currentSortOrder at:#column) = aSymbol ifTrue:[ |
|
2134 |
"/ same column like before - change sort order |
|
2135 |
| isReverse | |
|
2136 |
isReverse := currentSortOrder at:#reverse. |
|
2137 |
currentSortOrder at:#reverse put:(isReverse not). |
|
2138 |
] ifFalse:[ |
|
2139 |
"/ another column - remark column |
|
2140 |
currentSortOrder at:#column put:aSymbol. |
|
2141 |
] |
|
2142 |
]. |
|
2143 |
(currentSortOrder at:#reverse) ifTrue:[ |
|
2144 |
cmpOp := #'>' |
|
2145 |
] ifFalse:[ |
|
2146 |
cmpOp := #'<' |
|
2147 |
]. |
|
2148 |
^ [:a :b | |
|
2149 |
|entry1 entry2| |
|
2150 |
||
2151 |
entry1 := (a perform:aSymbol). |
|
2152 |
entry2 := (b perform:aSymbol). |
|
2153 |
aSymbol = #fileName ifTrue:[ |
|
2154 |
sortCaselessLocal ifTrue:[ |
|
2155 |
entry1 := entry1 asString asLowercase. |
|
2156 |
entry2 := entry2 asString asLowercase. |
|
2157 |
] ifFalse:[ |
|
2158 |
entry1 := entry1 asString. |
|
2159 |
entry2 := entry2 asString. |
|
2160 |
]. |
|
2161 |
]. |
|
2162 |
entry1 perform:cmpOp with:entry2 |
|
2163 |
]. |
|
2164 |
! |
|
2165 |
||
2166 |
sortList:instanceName |
|
2167 |
||
2168 |
||
2169 |
|sortBlock fileList sortCol| |
|
2170 |
||
2171 |
sortBlock := self generateSortBlock:instanceName. |
|
2172 |
fileList := self archiveFileList value. |
|
2173 |
sortCol := SortedCollection sortBlock:sortBlock. |
|
2174 |
sortCol addAll:fileList. |
|
2175 |
fileList removeAll. |
|
2176 |
fileList addAll:sortCol. |
|
2177 |
! ! |
|
2178 |
||
2179 |
!FileApplicationNoteBook::ArchiveViewApplication::ArchivItem methodsFor:'accessing'! |
|
2180 |
||
2181 |
compressSize |
|
2182 |
"return the value of the instance variable 'compressSize' (automatically generated)" |
|
2183 |
||
2184 |
^ compressSize |
|
2185 |
! |
|
2186 |
||
2187 |
compressSize:something |
|
2188 |
"set the value of the instance variable 'compressSize' (automatically generated)" |
|
2189 |
||
2190 |
compressSize := something. |
|
2191 |
! |
|
2192 |
||
2193 |
crc |
|
2194 |
"return the value of the instance variable 'crc' (automatically generated)" |
|
2195 |
||
2196 |
^ crc |
|
2197 |
! |
|
2198 |
||
2199 |
crc:something |
|
2200 |
"set the value of the instance variable 'crc' (automatically generated)" |
|
2201 |
||
2202 |
crc := something. |
|
2203 |
! |
|
2204 |
||
2205 |
dateAndTime |
|
2206 |
"return the value of the instance variable 'dateAndTime' (automatically generated)" |
|
2207 |
||
2208 |
^ dateAndTime |
|
2209 |
! |
|
2210 |
||
2211 |
dateAndTime:something |
|
2212 |
"set the value of the instance variable 'dateAndTime' (automatically generated)" |
|
2213 |
||
2214 |
dateAndTime := something. |
|
2215 |
! |
|
2216 |
||
2217 |
fileName |
|
2218 |
"return the value of the instance variable 'fileName' (automatically generated)" |
|
2219 |
||
2220 |
^ fileName |
|
2221 |
! |
|
2222 |
||
2223 |
fileName:something |
|
2224 |
"set the value of the instance variable 'fileName' (automatically generated)" |
|
2225 |
||
2226 |
fileName := something withoutSpaces. |
|
2227 |
! |
|
2228 |
||
2229 |
icon |
|
2230 |
"return the value of the instance variable 'icon' (automatically generated)" |
|
2231 |
||
2232 |
^ icon |
|
2233 |
! |
|
2234 |
||
2235 |
icon:something |
|
2236 |
"set the value of the instance variable 'icon' (automatically generated)" |
|
2237 |
||
2238 |
icon := something. |
|
2239 |
! |
|
2240 |
||
2241 |
isDirectory |
|
2242 |
"return the value of the instance variable 'directory' (automatically generated)" |
|
2243 |
||
2244 |
^ isDirectory |
|
2245 |
! |
|
2246 |
||
2247 |
isDirectory:something |
|
2248 |
"set the value of the instance variable 'isDirectory' (automatically generated)" |
|
2249 |
||
2250 |
isDirectory := something. |
|
2251 |
! |
|
2252 |
||
2253 |
method |
|
2254 |
"return the value of the instance variable 'method' (automatically generated)" |
|
2255 |
||
2256 |
^ method |
|
2257 |
! |
|
2258 |
||
2259 |
method:something |
|
2260 |
"set the value of the instance variable 'method' (automatically generated)" |
|
2261 |
||
2262 |
method := something. |
|
2263 |
! |
|
2264 |
||
2265 |
ownerGroup |
|
2266 |
"return the value of the instance variable 'owner' (automatically generated)" |
|
2267 |
||
2268 |
^ ownerGroup |
|
2269 |
! |
|
2270 |
||
2271 |
ownerGroup:something |
|
2272 |
"set the value of the instance variable 'owner' (automatically generated)" |
|
2273 |
||
2274 |
ownerGroup := something. |
|
2275 |
! |
|
2276 |
||
2277 |
permissions |
|
2278 |
"return the value of the instance variable 'permissions' (automatically generated)" |
|
2279 |
||
2280 |
^ permissions |
|
2281 |
! |
|
2282 |
||
2283 |
permissions:something |
|
2284 |
"set the value of the instance variable 'permissions' (automatically generated)" |
|
2285 |
||
2286 |
permissions := something. |
|
2287 |
! |
|
2288 |
||
2289 |
ratio |
|
2290 |
"return the value of the instance variable 'ratio' (automatically generated)" |
|
2291 |
||
2292 |
^ ratio |
|
2293 |
! |
|
2294 |
||
2295 |
ratio:something |
|
2296 |
"set the value of the instance variable 'ratio' (automatically generated)" |
|
2297 |
||
2298 |
ratio := something. |
|
2299 |
! |
|
2300 |
||
2301 |
size |
|
2302 |
"return the value of the instance variable 'size' (automatically generated)" |
|
2303 |
||
2304 |
^ size |
|
2305 |
! |
|
2306 |
||
2307 |
size:something |
|
2308 |
"set the value of the instance variable 'size' (automatically generated)" |
|
2309 |
||
2310 |
size := something. |
|
2311 |
! |
|
2312 |
||
2313 |
sizeAsNumber |
|
2314 |
"return the value of the instance variable 'size' (automatically generated)" |
|
2315 |
||
2316 |
^ size asInteger |
|
2317 |
! |
|
2318 |
||
2319 |
type |
|
2320 |
"return the value of the instance variable 'type' (automatically generated)" |
|
2321 |
||
2322 |
^ type |
|
2323 |
! |
|
2324 |
||
2325 |
type:something |
|
2326 |
"set the value of the instance variable 'type' (automatically generated)" |
|
2327 |
||
2328 |
type := something. |
|
2329 |
! |
|
2330 |
||
2331 |
version |
|
2332 |
"return the value of the instance variable 'version' (automatically generated)" |
|
2333 |
||
2334 |
^ version |
|
2335 |
! |
|
2336 |
||
2337 |
version:something |
|
2338 |
"set the value of the instance variable 'version' (automatically generated)" |
|
2339 |
||
2340 |
version := something. |
|
2341 |
! ! |
|
2342 |
||
2343 |
!FileApplicationNoteBook::ArchiveViewApplication::ArchivItem methodsFor:'printing'! |
|
2344 |
||
2345 |
printString |
|
2346 |
||
2347 |
^ self fileName asString |
|
2348 |
! ! |
|
2349 |
||
2350 |
!FileApplicationNoteBook::ArchiveViewApplication::ArchivItem methodsFor:'queries'! |
|
2351 |
||
2352 |
hasDirectoryPart |
|
2353 |
||
2354 |
^ self fileName asFilename components size ~= 1 |
|
2355 |
! ! |
|
2356 |
||
2357 |
!FileApplicationNoteBook::CommandResult class methodsFor:'defaults'! |
|
2358 |
||
2359 |
tabStringFor:aApplicationType |
|
2360 |
||
2361 |
^ 'Execution result' |
|
2362 |
! |
|
2363 |
||
2364 |
wantNewApplicationAnyway |
|
2365 |
||
2366 |
^ false |
|
2367 |
! ! |
|
2368 |
||
2369 |
!FileApplicationNoteBook::CommandResult class methodsFor:'interface specs'! |
|
2370 |
||
2371 |
windowSpec |
|
2372 |
"This resource specification was automatically generated |
|
2373 |
by the UIPainter of ST/X." |
|
2374 |
||
2375 |
"Do not manually edit this!! If it is corrupted, |
|
2376 |
the UIPainter may not be able to read the specification." |
|
2377 |
||
2378 |
" |
|
2379 |
UIPainter new openOnClass:NoteBookApplication::CommandResult andSelector:#windowSpec |
|
2380 |
NoteBookApplication::CommandResult new openInterface:#windowSpec |
|
2381 |
NoteBookApplication::CommandResult open |
|
2382 |
" |
|
2383 |
||
2384 |
<resource: #canvas> |
|
2385 |
||
2386 |
^ |
|
2387 |
#(#FullSpec |
|
2388 |
#name: #windowSpec |
|
2389 |
#window: |
|
2390 |
#(#WindowSpec |
|
2391 |
#label: 'NoteBookApplication::CommandResult' |
|
2392 |
#name: 'NoteBookApplication::CommandResult' |
|
2393 |
#min: #(#Point 10 10) |
|
2394 |
#max: #(#Point 1024 768) |
|
2395 |
#bounds: #(#Rectangle 16 42 519 395) |
|
2396 |
#menu: #mainMenu |
|
2397 |
) |
|
2398 |
#component: |
|
2399 |
#(#SpecCollection |
|
2400 |
#collection: #( |
|
2401 |
#(#MenuPanelSpec |
|
2402 |
#name: 'ToolBar1' |
|
2403 |
#layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 32 0) |
|
2404 |
#menu: #menu |
|
2405 |
#textDefault: true |
|
2406 |
) |
|
2407 |
#(#ArbitraryComponentSpec |
|
2408 |
#name: 'ArbitraryComponent1' |
|
2409 |
#layout: #(#LayoutFrame 0 0.0 32 0 0 1.0 0 1) |
|
2410 |
#hasHorizontalScrollBar: true |
|
2411 |
#hasVerticalScrollBar: true |
|
2412 |
#hasBorder: false |
|
2413 |
#component: #TextCollector |
|
2414 |
#postBuildCallback: #postBuildTextCollector: |
|
2415 |
) |
|
2416 |
#(#LabelSpec |
|
2417 |
#label: 'FileLabel' |
|
2418 |
#name: 'FileLabel' |
|
2419 |
#layout: #(#LayoutFrame 87 0 2 0 -36 1 30 0) |
|
2420 |
#level: -1 |
|
2421 |
#translateLabel: true |
|
2422 |
#labelChannel: #labelHolder |
|
2423 |
#adjust: #left |
|
2424 |
) |
|
2425 |
) |
|
2426 |
||
2427 |
) |
|
2428 |
) |
|
2429 |
! ! |
|
2430 |
||
2431 |
!FileApplicationNoteBook::CommandResult class methodsFor:'menu specs'! |
|
2432 |
||
2433 |
menu |
|
2434 |
"This resource specification was automatically generated |
|
2435 |
by the MenuEditor of ST/X." |
|
2436 |
||
2437 |
"Do not manually edit this!! If it is corrupted, |
|
2438 |
the MenuEditor may not be able to read the specification." |
|
2439 |
||
2440 |
" |
|
2441 |
MenuEditor new openOnClass:FileApplicationNoteBook::CommandResult andSelector:#menu |
|
2442 |
(Menu new fromLiteralArrayEncoding:(FileApplicationNoteBook::CommandResult menu)) startUp |
|
2443 |
" |
|
2444 |
||
2445 |
<resource: #menu> |
|
2446 |
||
2447 |
^ |
|
2448 |
#(#Menu |
|
2449 |
#( |
|
2450 |
#(#MenuItem |
|
2451 |
#label: 'Stop' |
|
2452 |
#translateLabel: true |
|
2453 |
#isButton: true |
|
2454 |
#nameKey: #Stop |
|
2455 |
#value: #doStopProcess |
|
2456 |
#enabled: #enableStopButton |
|
2457 |
#labelImage: #(#ResourceRetriever #ToolbarIconLibrary #stop22x22Icon 'Stop') |
|
2458 |
) |
|
2459 |
#(#MenuItem |
|
2460 |
#label: 'Close' |
|
2461 |
#translateLabel: true |
|
2462 |
#isButton: true |
|
2463 |
#nameKey: #Close |
|
2464 |
#isVisible: #isEmbeddedApplication |
|
2465 |
#startGroup: #right |
|
2466 |
#value: #doClose |
|
2467 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #closeIcon) |
|
2468 |
) |
|
2469 |
) |
|
2470 |
nil |
|
2471 |
nil |
|
2472 |
) |
|
2473 |
! ! |
|
2474 |
||
2475 |
!FileApplicationNoteBook::CommandResult methodsFor:'accessing'! |
|
2476 |
||
2477 |
resultStream |
|
2478 |
"return the value of the instance variable 'resultStream' (automatically generated)" |
|
2479 |
||
2480 |
^ resultStream |
|
2481 |
! |
|
2482 |
||
2483 |
resultStream:something |
|
2484 |
"set the value of the instance variable 'resultStream' (automatically generated)" |
|
2485 |
||
2486 |
resultStream := something. |
|
2487 |
! ! |
|
2488 |
||
2489 |
!FileApplicationNoteBook::CommandResult methodsFor:'actions'! |
|
2490 |
||
2491 |
changeTabTo:aString |
|
2492 |
||
2493 |
| masterApplication | |
|
2494 |
||
2495 |
self labelHolder value:aString. |
|
2496 |
masterApplication := self masterApplication. |
|
2497 |
masterApplication isNil ifFalse:[ |
|
2498 |
masterApplication tabStringChangeTo:aString for:self. |
|
2499 |
]. |
|
2500 |
! |
|
2501 |
||
2502 |
doStopProcess |
|
2503 |
||
2504 |
| myProcess | |
|
2505 |
||
2506 |
myProcess := self process value. |
|
2507 |
myProcess notNil ifTrue:[ |
|
2508 |
self notifyChannel value:('kill ', myProcess name). |
|
2509 |
myProcess terminate. |
|
2510 |
]. |
|
2511 |
! ! |
|
2512 |
||
2513 |
!FileApplicationNoteBook::CommandResult methodsFor:'aspects'! |
|
2514 |
||
2515 |
enableStopButton |
|
2516 |
||
2517 |
enableStopButton isNil ifTrue:[ |
|
2518 |
enableStopButton := false asValue. |
|
2519 |
]. |
|
2520 |
^ enableStopButton |
|
2521 |
! |
|
2522 |
||
2523 |
labelHolder |
|
2524 |
||
2525 |
labelHolder isNil ifTrue:[ |
|
2526 |
labelHolder := '' asValue. |
|
2527 |
]. |
|
2528 |
^ labelHolder. |
|
2529 |
! |
|
2530 |
||
2531 |
process |
|
2532 |
"return/create the 'process' value holder (automatically generated)" |
|
2533 |
||
2534 |
process isNil ifTrue:[ |
|
2535 |
process := ValueHolder new. |
|
2536 |
process addDependent:self. |
|
2537 |
]. |
|
2538 |
^ process |
|
2539 |
! ! |
|
2540 |
||
2541 |
!FileApplicationNoteBook::CommandResult methodsFor:'change & update'! |
|
2542 |
||
2543 |
update:something with:aParameter from:changedObject |
|
2544 |
"Invoked when an object that I depend upon sends a change notification." |
|
2545 |
||
2546 |
"stub code automatically generated - please change as required" |
|
2547 |
||
2548 |
changedObject == self process ifTrue:[ |
|
2549 |
self enableStopButton value:changedObject value notNil. |
|
2550 |
^ self |
|
2551 |
]. |
|
2552 |
super update:something with:aParameter from:changedObject |
|
2553 |
! ! |
|
2554 |
||
2555 |
!FileApplicationNoteBook::CommandResult methodsFor:'initialization & release'! |
|
2556 |
||
2557 |
postBuildTextCollector:aBuilder |
|
2558 |
||
2559 |
self resultStream:aBuilder scrolledView. |
|
2560 |
! |
|
2561 |
||
2562 |
postBuildWith:aBuilder |
|
2563 |
"This is a hook method generated by the Browser. |
|
2564 |
It will be invoked during the initialization of your app/dialog, |
|
2565 |
after all of the visual components have been built, |
|
2566 |
but BEFORE the top window is made visible. |
|
2567 |
Add any app-specific actions here (reading files, setting up values etc.) |
|
2568 |
See also #postOpenWith:, which is invoked after opening." |
|
2569 |
||
2570 |
"/ add any code here ... |
|
2571 |
||
2572 |
^ super postBuildWith:aBuilder |
|
2573 |
! |
|
2574 |
||
2575 |
postOpenWith:aBuilder |
|
2576 |
"This is a hook method generated by the Browser. |
|
2577 |
It will be invoked right after the applications window has been opened. |
|
2578 |
Add any app-specific actions here (starting background processes etc.). |
|
2579 |
See also #postBuildWith:, which is invoked before opening." |
|
2580 |
||
2581 |
"/ add any code here ... |
|
2582 |
||
2583 |
self masterApplication isNil ifTrue:[ |
|
2584 |
self masterApplication:nil. |
|
2585 |
]. |
|
2586 |
^ super postOpenWith:aBuilder |
|
2587 |
! |
|
2588 |
||
2589 |
release |
|
2590 |
||
2591 |
self doStopProcess. |
|
2592 |
^ super release |
|
2593 |
! ! |
|
2594 |
||
2595 |
!FileApplicationNoteBook::CommandResult methodsFor:'printing'! |
|
2596 |
||
2597 |
printString |
|
2598 |
||
2599 |
^ 'CommandResult Application' |
|
2600 |
! ! |
|
2601 |
||
2602 |
!FileApplicationNoteBook::HtmlViewApplication class methodsFor:'defaults'! |
|
2603 |
||
2604 |
tabStringFor:aApplicationType |
|
2605 |
||
2606 |
^ 'HTML View for:' |
|
2607 |
! ! |
|
2608 |
||
2609 |
!FileApplicationNoteBook::HtmlViewApplication class methodsFor:'interface specs'! |
|
2610 |
||
2611 |
windowSpec |
|
2612 |
"This resource specification was automatically generated |
|
2613 |
by the UIPainter of ST/X." |
|
2614 |
||
2615 |
"Do not manually edit this!! If it is corrupted, |
|
2616 |
the UIPainter may not be able to read the specification." |
|
2617 |
||
2618 |
" |
|
2619 |
UIPainter new openOnClass:NoteBookApplication::HtmlViewApplication andSelector:#windowSpec |
|
2620 |
NoteBookApplication::HtmlViewApplication new openInterface:#windowSpec |
|
2621 |
NoteBookApplication::HtmlViewApplication open |
|
2622 |
" |
|
2623 |
||
2624 |
<resource: #canvas> |
|
2625 |
||
2626 |
^ |
|
2627 |
#(#FullSpec |
|
2628 |
#name: #windowSpec |
|
2629 |
#window: |
|
2630 |
#(#WindowSpec |
|
2631 |
#label: 'NoteBookApplication::HtmlView' |
|
2632 |
#name: 'NoteBookApplication::HtmlView' |
|
2633 |
#min: #(#Point 10 10) |
|
2634 |
#max: #(#Point 1024 768) |
|
2635 |
#bounds: #(#Rectangle 16 42 692 534) |
|
2636 |
#menu: #mainMenu |
|
2637 |
) |
|
2638 |
#component: |
|
2639 |
#(#SpecCollection |
|
2640 |
#collection: #( |
|
2641 |
#(#MenuPanelSpec |
|
2642 |
#name: 'MenuHtml' |
|
2643 |
#layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 32 0) |
|
2644 |
#visibilityChannel: #isEmbeddedApplication |
|
2645 |
#menu: #menu |
|
2646 |
#textDefault: true |
|
2647 |
) |
|
2648 |
#(#ArbitraryComponentSpec |
|
2649 |
#name: 'HTMLView' |
|
2650 |
#layout: #(#LayoutFrame 0 0.0 32 0.0 0 1.0 0 1) |
|
2651 |
#hasHorizontalScrollBar: true |
|
2652 |
#hasVerticalScrollBar: true |
|
2653 |
#miniScrollerHorizontal: false |
|
2654 |
#miniScrollerVertical: false |
|
2655 |
#hasBorder: false |
|
2656 |
#component: #HTMLDocumentView |
|
2657 |
#postBuildCallback: #postBuildHtmlView: |
|
2658 |
) |
|
2659 |
#(#LabelSpec |
|
2660 |
#label: 'FileLabel' |
|
2661 |
#name: 'FileLabel' |
|
2662 |
#layout: #(#LayoutFrame 212 0 2 0 -73 1 30 0) |
|
2663 |
#level: -1 |
|
2664 |
#translateLabel: true |
|
2665 |
#labelChannel: #labelHolder |
|
2666 |
#adjust: #left |
|
2667 |
) |
|
2668 |
) |
|
2669 |
||
2670 |
) |
|
2671 |
) |
|
2672 |
! ! |
|
2673 |
||
2674 |
!FileApplicationNoteBook::HtmlViewApplication class methodsFor:'menu specs'! |
|
2675 |
||
2676 |
menu |
|
2677 |
"This resource specification was automatically generated |
|
2678 |
by the MenuEditor of ST/X." |
|
2679 |
||
2680 |
"Do not manually edit this!! If it is corrupted, |
|
2681 |
the MenuEditor may not be able to read the specification." |
|
2682 |
||
2683 |
" |
|
2684 |
MenuEditor new openOnClass:FileApplicationNoteBook::HtmlViewApplication andSelector:#menu |
|
2685 |
(Menu new fromLiteralArrayEncoding:(FileApplicationNoteBook::HtmlViewApplication menu)) startUp |
|
2686 |
" |
|
2687 |
||
2688 |
<resource: #menu> |
|
2689 |
||
2690 |
^ |
|
2691 |
#(#Menu |
|
2692 |
#( |
|
2693 |
#(#MenuItem |
|
2694 |
#label: 'Reload' |
|
2695 |
#translateLabel: true |
|
2696 |
#isButton: true |
|
2697 |
#value: #doReload |
|
2698 |
#labelImage: #(#ResourceRetriever nil #htmlReloadIcon) |
|
2699 |
) |
|
2700 |
#(#MenuItem |
|
2701 |
#label: 'Back' |
|
2702 |
#translateLabel: true |
|
2703 |
#isButton: true |
|
2704 |
#value: #doGoBack |
|
2705 |
#labelImage: #(#ResourceRetriever #Icon #leftIcon) |
|
2706 |
) |
|
2707 |
#(#MenuItem |
|
2708 |
#label: 'Print' |
|
2709 |
#translateLabel: true |
|
2710 |
#isButton: true |
|
2711 |
#value: #doPrint |
|
2712 |
#labelImage: #(#ResourceRetriever #ToolbarIconLibrary #printer22x22Icon) |
|
2713 |
) |
|
2714 |
#(#MenuItem |
|
2715 |
#label: 'Close' |
|
2716 |
#translateLabel: true |
|
2717 |
#isButton: true |
|
2718 |
#hideMenuOnActivated: false |
|
2719 |
#startGroup: #right |
|
2720 |
#value: #doClose |
|
2721 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #closeIcon) |
|
2722 |
) |
|
2723 |
) |
|
2724 |
nil |
|
2725 |
nil |
|
2726 |
) |
|
2727 |
! ! |
|
2728 |
||
2729 |
!FileApplicationNoteBook::HtmlViewApplication class methodsFor:'queries'! |
|
2730 |
||
2731 |
canOpenItem:aItem |
|
2732 |
||
2733 |
^ (aItem hasMimeType and:[aItem mimeType isHtml]) |
|
2734 |
! |
|
2735 |
||
2736 |
wantNewApplicationAnyway |
|
2737 |
||
2738 |
^ false |
|
2739 |
! ! |
|
2740 |
||
2741 |
!FileApplicationNoteBook::HtmlViewApplication methodsFor:'accessing'! |
|
2742 |
||
2743 |
htmlView |
|
2744 |
"return the value of the instance variable 'imageView' (automatically generated)" |
|
2745 |
||
2746 |
^ htmlView |
|
2747 |
! |
|
2748 |
||
2749 |
htmlView:something |
|
2750 |
"set the value of the instance variable 'imageView' (automatically generated)" |
|
2751 |
||
2752 |
htmlView := something. |
|
2753 |
! |
|
2754 |
||
2755 |
item:aItem |
|
2756 |
||
2757 |
|retVal| |
|
2758 |
||
2759 |
self labelHolder value:aItem fileName asString. |
|
2760 |
retVal := super item:aItem. |
|
2761 |
self setupHtmlView. |
|
2762 |
^ retVal |
|
2763 |
! ! |
|
2764 |
||
2765 |
!FileApplicationNoteBook::HtmlViewApplication methodsFor:'actions'! |
|
2766 |
||
2767 |
doGoBack |
|
2768 |
||
2769 |
self htmlView menu_back. |
|
2770 |
! |
|
2771 |
||
2772 |
doGoHome |
|
2773 |
||
2774 |
self htmlView menu_home. |
|
2775 |
! |
|
2776 |
||
2777 |
doHelp |
|
2778 |
||
2779 |
self htmlView menu_help. |
|
2780 |
! |
|
2781 |
||
2782 |
doPrint |
|
2783 |
||
2784 |
self htmlView menu_print. |
|
2785 |
! |
|
2786 |
||
2787 |
doReload |
|
2788 |
||
2789 |
self htmlView menu_reload. |
|
2790 |
! |
|
2791 |
||
2792 |
setupHtmlView |
|
2793 |
||
2794 |
| html file directory| |
|
2795 |
||
2796 |
html := self htmlView. |
|
2797 |
html isNil ifTrue:[^ self]. |
|
2798 |
file := self fileName. |
|
2799 |
directory := file directoryName. |
|
2800 |
html homeDocument:(file asString). |
|
2801 |
html setTopDirectoryName:directory. |
|
2802 |
html uriHolder:self labelHolder. |
|
2803 |
html infoHolder:self notifyChannel. |
|
2804 |
html linkButtonPanel:nil. |
|
2805 |
^ html |
|
2806 |
! ! |
|
2807 |
||
2808 |
!FileApplicationNoteBook::HtmlViewApplication methodsFor:'aspects'! |
|
2809 |
||
2810 |
labelHolder |
|
2811 |
||
2812 |
labelHolder isNil ifTrue:[ |
|
2813 |
labelHolder := '' asValue. |
|
2814 |
]. |
|
2815 |
^ labelHolder. |
|
2816 |
! ! |
|
2817 |
||
2818 |
!FileApplicationNoteBook::HtmlViewApplication methodsFor:'initialization & release'! |
|
2819 |
||
2820 |
postBuildHtmlView:aWidget |
|
2821 |
||
2822 |
self htmlView: aWidget scrolledView. |
|
2823 |
self htmlView wantsFocusWithPointerEnter. |
|
2824 |
! |
|
2825 |
||
2826 |
postOpenWith:aBuilder |
|
2827 |
" |
|
2828 |
only invoked if the application not started from a master |
|
2829 |
" |
|
2830 |
||
2831 |
|currentDir contents suffix fileName| |
|
2832 |
||
2833 |
self masterApplication isNil ifTrue:[ |
|
2834 |
self masterApplication:nil. |
|
2835 |
currentDir := Filename homeDirectory. |
|
2836 |
||
2837 |
contents := currentDir directoryContents. |
|
2838 |
fileName := contents |
|
2839 |
detect:[:file | |
|
2840 |
suffix := file asFilename suffix asLowercase. |
|
2841 |
suffix = 'html' |
|
2842 |
] |
|
2843 |
ifNone:[nil]. |
|
2844 |
fileName isNil ifTrue:[ |
|
2845 |
Dialog warn:'cant find a HTML file in ' , currentDir asString. |
|
2846 |
^ self |
|
2847 |
]. |
|
3982 | 2848 |
self item:(DirectoryContentsBrowser itemClass fileName:('../../doc/online/english/TOP.html' asFilename)). |
3892 | 2849 |
]. |
2850 |
self setupHtmlView. |
|
2851 |
^ super postOpenWith:aBuilder |
|
2852 |
! ! |
|
2853 |
||
2854 |
!FileApplicationNoteBook::ImageViewApplication class methodsFor:'defaults'! |
|
2855 |
||
2856 |
tabStringFor:aApplicationType |
|
2857 |
||
2858 |
^ 'Image for:' |
|
2859 |
! ! |
|
2860 |
||
2861 |
!FileApplicationNoteBook::ImageViewApplication class methodsFor:'image specs'! |
|
2862 |
||
2863 |
fitSize20x20Icon |
|
2864 |
"This resource specification was automatically generated |
|
2865 |
by the ImageEditor of ST/X." |
|
2866 |
||
2867 |
"Do not manually edit this!! If it is corrupted, |
|
2868 |
the ImageEditor may not be able to read the specification." |
|
2869 |
||
2870 |
" |
|
2871 |
self fitSize20x20Icon inspect |
|
2872 |
ImageEditor openOnClass:self andSelector:#fitSize20x20Icon |
|
2873 |
" |
|
2874 |
||
2875 |
<resource: #image> |
|
2876 |
||
2877 |
^Icon |
|
2878 |
constantNamed:#'FileApplicationNoteBook::ImageViewApplication class fitSize20x20Icon' |
|
2879 |
ifAbsentPut:[(Depth4Image new) width: 20; height: 20; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
2880 |
@@DQDQDQDQDP@@@PDQDQDQDQ@P@A@ADQDQDQDP@PD@@PDQDQDPD@@QDQ@ADQDQ@@DQDQD@@@@@@@@@DQDQDPQDQDQ@DQDQDQDDQUUTPADQDQDQAEUUUT@QDQ |
|
2881 |
DQDPQEUUQ@DQDQDQDDQFQDPADQDQDQADQ$QD@QDQDQDPL3X3Q@DQDQDQDCL3L3LADQDQD@@@@@@@@@DQDQD@DQDQDP@QDQ@@DADQDQDA@@DA@ADQDQDQDP@P |
|
2882 |
@@@QDQDQDQDA@@@ADQDQDQDQD@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
2883 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
2884 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; colorMapFromArray:#[0 0 0 255 255 255 0 0 0 0 137 0 174 218 230 0 206 0 133 60 36]; mask:((Depth1Image new) width: 20; height: 20; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
2885 |
8@A00@@0(@APE@J@C@L@G?>@A?8@A?8@A?8@A?8@A?8@A?8@A?8@A?8@G?>@C@L@E@J@(@AP0@@08@A0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
2886 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
2887 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
2888 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
2889 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; yourself); yourself] |
|
2890 |
! ! |
|
2891 |
||
2892 |
!FileApplicationNoteBook::ImageViewApplication class methodsFor:'interface specs'! |
|
2893 |
||
2894 |
windowSpec |
|
2895 |
"This resource specification was automatically generated |
|
2896 |
by the UIPainter of ST/X." |
|
2897 |
||
2898 |
"Do not manually edit this!! If it is corrupted, |
|
2899 |
the UIPainter may not be able to read the specification." |
|
2900 |
||
2901 |
" |
|
2902 |
UIPainter new openOnClass:FileApplicationNoteBook::ImageViewApplication andSelector:#windowSpec |
|
2903 |
FileApplicationNoteBook::ImageViewApplication new openInterface:#windowSpec |
|
2904 |
FileApplicationNoteBook::ImageViewApplication open |
|
2905 |
" |
|
2906 |
||
2907 |
<resource: #canvas> |
|
2908 |
||
2909 |
^ |
|
2910 |
#(#FullSpec |
|
2911 |
#name: #windowSpec |
|
2912 |
#window: |
|
2913 |
#(#WindowSpec |
|
2914 |
#label: 'ImageViewer' |
|
2915 |
#name: 'ImageViewer' |
|
2916 |
#min: #(#Point 10 10) |
|
2917 |
#max: #(#Point 1024 768) |
|
2918 |
#bounds: #(#Rectangle 16 42 692 534) |
|
2919 |
#menu: #mainMenu |
|
2920 |
) |
|
2921 |
#component: |
|
2922 |
#(#SpecCollection |
|
2923 |
#collection: #( |
|
2924 |
#(#MenuPanelSpec |
|
2925 |
#name: 'MenuTerminal' |
|
2926 |
#layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 32 0) |
|
2927 |
#visibilityChannel: #isEmbeddedApplication |
|
2928 |
#menu: #menu |
|
2929 |
#textDefault: true |
|
2930 |
) |
|
2931 |
#(#ArbitraryComponentSpec |
|
2932 |
#name: 'TerminalView' |
|
2933 |
#layout: #(#LayoutFrame 0 0.0 32 0.0 0 1.0 0 1.0) |
|
2934 |
#hasHorizontalScrollBar: true |
|
2935 |
#hasVerticalScrollBar: true |
|
2936 |
#miniScrollerHorizontal: false |
|
2937 |
#miniScrollerVertical: false |
|
2938 |
#hasBorder: false |
|
2939 |
#component: #ImageView |
|
2940 |
#postBuildCallback: #postBuildImageView: |
|
2941 |
) |
|
2942 |
) |
|
2943 |
||
2944 |
) |
|
2945 |
) |
|
2946 |
! ! |
|
2947 |
||
2948 |
!FileApplicationNoteBook::ImageViewApplication class methodsFor:'menu specs'! |
|
2949 |
||
2950 |
menu |
|
2951 |
"This resource specification was automatically generated |
|
2952 |
by the MenuEditor of ST/X." |
|
2953 |
||
2954 |
"Do not manually edit this!! If it is corrupted, |
|
2955 |
the MenuEditor may not be able to read the specification." |
|
2956 |
||
2957 |
" |
|
2958 |
MenuEditor new openOnClass:FileApplicationNoteBook::ImageViewApplication andSelector:#menu |
|
2959 |
(Menu new fromLiteralArrayEncoding:(FileApplicationNoteBook::ImageViewApplication menu)) startUp |
|
2960 |
" |
|
2961 |
||
2962 |
<resource: #menu> |
|
2963 |
||
2964 |
^ |
|
2965 |
#(#Menu |
|
2966 |
#( |
|
2967 |
#(#MenuItem |
|
2968 |
#label: 'Edit' |
|
2969 |
#translateLabel: true |
|
2970 |
#isButton: true |
|
2971 |
#nameKey: #EditImage |
|
2972 |
#value: #editImage |
|
2973 |
) |
|
2974 |
#(#MenuItem |
|
2975 |
#label: '-' |
|
2976 |
) |
|
2977 |
#(#MenuItem |
|
2978 |
#label: 'FitSize' |
|
2979 |
#translateLabel: true |
|
2980 |
#isButton: true |
|
2981 |
#triggerOnDown: true |
|
2982 |
#labelImage: #(#ResourceRetriever #'FileApplicationNoteBook::ImageViewApplication' #fitSize20x20Icon) |
|
2983 |
#indication: #fitSize |
|
2984 |
) |
|
2985 |
#(#MenuItem |
|
2986 |
#label: '-' |
|
2987 |
) |
|
2988 |
#(#MenuItem |
|
2989 |
#label: 'Close' |
|
2990 |
#translateLabel: true |
|
2991 |
#isButton: true |
|
2992 |
#hideMenuOnActivated: false |
|
2993 |
#startGroup: #right |
|
2994 |
#value: #doClose |
|
2995 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #closeIcon) |
|
2996 |
) |
|
2997 |
) |
|
2998 |
nil |
|
2999 |
nil |
|
3000 |
) |
|
3001 |
! ! |
|
3002 |
||
3003 |
!FileApplicationNoteBook::ImageViewApplication class methodsFor:'queries'! |
|
3004 |
||
3005 |
canOpenItem:aItem |
|
3006 |
||
3007 |
^ (aItem hasMimeType and:[aItem mimeType isImage]) |
|
3008 |
! |
|
3009 |
||
3010 |
wantNewApplicationAnyway |
|
3011 |
||
3012 |
^ false |
|
3013 |
! ! |
|
3014 |
||
3015 |
!FileApplicationNoteBook::ImageViewApplication methodsFor:'accessing'! |
|
3016 |
||
3017 |
image:something |
|
3018 |
"set the value of the instance variable 'image' (automatically generated)" |
|
3019 |
||
3020 |
image := something. |
|
3021 |
! |
|
3022 |
||
3023 |
imageView |
|
3024 |
"return the value of the instance variable 'imageView' (automatically generated)" |
|
3025 |
||
3026 |
^ imageView |
|
3027 |
! |
|
3028 |
||
3029 |
imageView:something |
|
3030 |
"set the value of the instance variable 'imageView' (automatically generated)" |
|
3031 |
||
3032 |
imageView := something. |
|
3033 |
! ! |
|
3034 |
||
3035 |
!FileApplicationNoteBook::ImageViewApplication methodsFor:'actions'! |
|
3036 |
||
3037 |
changeItem:aItem |
|
3038 |
||
3039 |
self item:aItem. |
|
3040 |
self setupImageView. |
|
3041 |
^ true |
|
3042 |
! |
|
3043 |
||
3044 |
editImage |
|
3045 |
|img| |
|
3046 |
||
3047 |
img := self image. |
|
3048 |
img notNil ifTrue:[ |
|
3049 |
img edit. |
|
3050 |
]. |
|
3051 |
! |
|
3052 |
||
3053 |
image |
|
3054 |
|img fn e| |
|
3055 |
||
3056 |
fn := self fileName. |
|
3057 |
img := Image fromFile:fn. |
|
3058 |
img isNil ifTrue:[ |
|
3059 |
fn exists ifTrue:[ |
|
3060 |
e := 'Unknown/unsupported image format' |
|
3061 |
] ifFalse:[ |
|
3062 |
e := 'No such image' |
|
3063 |
]. |
|
3064 |
Dialog warn:e. |
|
3065 |
^ nil |
|
3066 |
]. |
|
3067 |
^ img. |
|
3068 |
! |
|
3069 |
||
3070 |
setupImageView |
|
3071 |
|img| |
|
3072 |
||
3073 |
self window topView withWaitCursorDo:[ |
|
3074 |
img := self image. |
|
3075 |
img notNil ifTrue:[ |
|
3076 |
self image:img. |
|
3077 |
imageView image:img |
|
3078 |
] |
|
3079 |
] |
|
3080 |
! ! |
|
3081 |
||
3082 |
!FileApplicationNoteBook::ImageViewApplication methodsFor:'aspects'! |
|
3083 |
||
3084 |
fitSize |
|
3085 |
"return/create the 'fitSize' value holder (automatically generated)" |
|
3086 |
||
3087 |
fitSize isNil ifTrue:[ |
|
3088 |
fitSize := ValueHolder new. |
|
3089 |
fitSize addDependent:self. |
|
3090 |
]. |
|
3091 |
^ fitSize |
|
3092 |
! ! |
|
3093 |
||
3094 |
!FileApplicationNoteBook::ImageViewApplication methodsFor:'change & update'! |
|
3095 |
||
3096 |
update:something with:aParameter from:changedObject |
|
3097 |
changedObject == self fitSize ifTrue:[ |
|
3098 |
changedObject value ifTrue:[ |
|
3099 |
imageView adjust:#fitBig. |
|
3100 |
] ifFalse:[ |
|
3101 |
imageView adjust:nil. |
|
3102 |
]. |
|
3103 |
^ self |
|
3104 |
]. |
|
3105 |
super update:something with:aParameter from:changedObject |
|
3106 |
! ! |
|
3107 |
||
3108 |
!FileApplicationNoteBook::ImageViewApplication methodsFor:'initialization & release'! |
|
3109 |
||
3110 |
postBuildImageView:aWidget |
|
3111 |
||
3112 |
self imageView: aWidget scrolledView. |
|
3113 |
self imageView wantsFocusWithPointerEnter. |
|
3114 |
! |
|
3115 |
||
3116 |
postOpenWith:aBuilder |
|
3117 |
" |
|
3118 |
only invoked if the application not started from a master |
|
3119 |
" |
|
3120 |
||
3121 |
|currentDir contents suffix fileName| |
|
3122 |
||
3123 |
self masterApplication isNil ifTrue:[ |
|
3124 |
self masterApplication:nil. |
|
3125 |
currentDir := Filename currentDirectory. |
|
3126 |
contents := currentDir directoryContents. |
|
3127 |
fileName := contents |
|
3128 |
detect:[:file | |
|
3129 |
suffix := file asFilename suffix asLowercase. |
|
3130 |
Image isImageFileSuffix:suffix |
|
3131 |
] |
|
3132 |
ifNone:[nil]. |
|
3133 |
fileName isNil ifTrue:[ |
|
3134 |
Dialog warn:'cant find a Image in ' , currentDir asString. |
|
3135 |
^ self |
|
3136 |
]. |
|
3982 | 3137 |
self item:(DirectoryContentsBrowser itemClass fileName:(currentDir construct:fileName)) |
3892 | 3138 |
]. |
3139 |
self setupImageView. |
|
3140 |
^ super postOpenWith:aBuilder |
|
3141 |
! ! |
|
3142 |
||
3143 |
!FileApplicationNoteBook::Terminal class methodsFor:'defaults'! |
|
3144 |
||
3145 |
tabStringFor:aApplicationType |
|
3146 |
||
3147 |
^ 'Terminal in:' |
|
3148 |
! ! |
|
3149 |
||
3150 |
!FileApplicationNoteBook::Terminal class methodsFor:'interface specs'! |
|
3151 |
||
3152 |
windowSpec |
|
3153 |
"This resource specification was automatically generated |
|
3154 |
by the UIPainter of ST/X." |
|
3155 |
||
3156 |
"Do not manually edit this!! If it is corrupted, |
|
3157 |
the UIPainter may not be able to read the specification." |
|
3158 |
||
3159 |
" |
|
3160 |
UIPainter new openOnClass:NoteBookApplication::Terminal andSelector:#windowSpec |
|
3161 |
NoteBookApplication::Terminal new openInterface:#windowSpec |
|
3162 |
NoteBookApplication::Terminal open |
|
3163 |
" |
|
3164 |
||
3165 |
<resource: #canvas> |
|
3166 |
||
3167 |
^ |
|
3168 |
#(#FullSpec |
|
3169 |
#name: #windowSpec |
|
3170 |
#window: |
|
3171 |
#(#WindowSpec |
|
3172 |
#label: 'NoteBookApplication::Terminal' |
|
3173 |
#name: 'NoteBookApplication::Terminal' |
|
3174 |
#min: #(#Point 10 10) |
|
3175 |
#max: #(#Point 1024 768) |
|
3176 |
#bounds: #(#Rectangle 16 42 692 534) |
|
3177 |
#menu: #mainMenu |
|
3178 |
) |
|
3179 |
#component: |
|
3180 |
#(#SpecCollection |
|
3181 |
#collection: #( |
|
3182 |
#(#MenuPanelSpec |
|
3183 |
#name: 'MenuTerminal' |
|
3184 |
#layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 32 0) |
|
3185 |
#menu: #menu |
|
3186 |
#textDefault: true |
|
3187 |
) |
|
3188 |
#(#ArbitraryComponentSpec |
|
3189 |
#name: 'TerminalView' |
|
3190 |
#layout: #(#LayoutFrame 0 0.0 32 0.0 0 1.0 0 1.0) |
|
3191 |
#hasHorizontalScrollBar: true |
|
3192 |
#hasVerticalScrollBar: true |
|
3193 |
#miniScrollerHorizontal: false |
|
3194 |
#miniScrollerVertical: false |
|
3195 |
#hasBorder: false |
|
3196 |
#component: #terminalView |
|
3197 |
) |
|
3198 |
) |
|
3199 |
||
3200 |
) |
|
3201 |
) |
|
3202 |
! ! |
|
3203 |
||
3204 |
!FileApplicationNoteBook::Terminal class methodsFor:'menu specs'! |
|
3205 |
||
3206 |
menu |
|
3207 |
"This resource specification was automatically generated |
|
3208 |
by the MenuEditor of ST/X." |
|
3209 |
||
3210 |
"Do not manually edit this!! If it is corrupted, |
|
3211 |
the MenuEditor may not be able to read the specification." |
|
3212 |
||
3213 |
" |
|
3214 |
MenuEditor new openOnClass:FileApplicationNoteBook::Terminal andSelector:#menu |
|
3215 |
(Menu new fromLiteralArrayEncoding:(FileApplicationNoteBook::Terminal menu)) startUp |
|
3216 |
" |
|
3217 |
||
3218 |
<resource: #menu> |
|
3219 |
||
3220 |
^ |
|
3221 |
#(#Menu |
|
3222 |
#( |
|
3223 |
#(#MenuItem |
|
3224 |
#label: 'Save' |
|
3225 |
#translateLabel: true |
|
3226 |
#isButton: true |
|
3227 |
#nameKey: #Save |
|
3228 |
#value: #saveAs |
|
3229 |
#labelImage: #(#ResourceRetriever #ToolbarIconLibrary #saveToFile28x22Icon) |
|
3230 |
) |
|
3231 |
#(#MenuItem |
|
3232 |
#label: 'Close' |
|
3233 |
#translateLabel: true |
|
3234 |
#isButton: true |
|
3235 |
#hideMenuOnActivated: false |
|
3236 |
#isVisible: #isEmbeddedApplication |
|
3237 |
#startGroup: #right |
|
3238 |
#value: #doClose |
|
3239 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #closeIcon) |
|
3240 |
) |
|
3241 |
) |
|
3242 |
nil |
|
3243 |
nil |
|
3244 |
) |
|
3245 |
! ! |
|
3246 |
||
3247 |
!FileApplicationNoteBook::Terminal methodsFor:'accessing'! |
|
3248 |
||
3249 |
terminalView |
|
3250 |
||
3251 |
terminalView isNil ifTrue:[ |
|
3252 |
terminalView := VT100TerminalView new. |
|
3253 |
]. |
|
3254 |
^ terminalView. |
|
3255 |
! ! |
|
3256 |
||
3257 |
!FileApplicationNoteBook::Terminal methodsFor:'actions'! |
|
3258 |
||
3259 |
saveAs |
|
3260 |
||
3261 |
self terminalView save. |
|
3262 |
! ! |
|
3263 |
||
3264 |
!FileApplicationNoteBook::Terminal methodsFor:'initialization & release'! |
|
3265 |
||
3266 |
postBuildWith:aBuilder |
|
3267 |
||
3268 |
^ super postBuildWith:aBuilder |
|
3269 |
! |
|
3270 |
||
3271 |
shellFinished |
|
3272 |
||
3273 |
| master text string| |
|
3274 |
||
3275 |
master := self masterApplication. |
|
3276 |
master notNil ifTrue:[ |
|
3277 |
string := ' - closed'. |
|
3278 |
master tabStringAdd:string for:self. |
|
3279 |
]. |
|
3280 |
self notifyChannel value:'shell in ' , self fileName asString, ' finished'. |
|
3281 |
terminalView cr. |
|
3282 |
text := '>> shell closed' asText allBold. |
|
3283 |
text colorizeAllWith:Color red. |
|
3284 |
terminalView nextPutAll:text. |
|
3285 |
! |
|
3286 |
||
3287 |
startShell |
|
3288 |
|vt100| |
|
3289 |
||
3290 |
vt100 := self terminalView. |
|
3291 |
vt100 shellTerminateAction:[ self shellFinished ]. |
|
3292 |
vt100 startShellIn:(self fileName). |
|
3293 |
! ! |
|
3294 |
||
3295 |
!FileApplicationNoteBook::Terminal methodsFor:'printing'! |
|
3296 |
||
3297 |
printString |
|
3298 |
||
3299 |
^ ('Terminal on:', self fileName baseName) |
|
3300 |
! ! |
|
3301 |
||
3302 |
!FileApplicationNoteBook::Terminal methodsFor:'queries'! |
|
3303 |
||
3304 |
getTabStringEnd |
|
3305 |
||
3306 |
" get the tab string from the application list on the class side " |
|
3307 |
||
3308 |
^ '..', OperatingSystem fileSeparator, self fileName baseName, OperatingSystem fileSeparator |
|
3309 |
! ! |
|
3310 |
||
3311 |
!FileApplicationNoteBook::Terminal methodsFor:'startup & release'! |
|
3312 |
||
3313 |
postOpenWith:aBuilder |
|
3314 |
||
3315 |
" |
|
3316 |
only invoked if the application not started from a master |
|
3317 |
" |
|
3318 |
self masterApplication isNil ifTrue:[ |
|
3319 |
self masterApplication:nil. |
|
3982 | 3320 |
self item:(DirectoryContentsBrowser itemClass fileName:(Filename currentDirectory asAbsoluteFilename)). |
3892 | 3321 |
]. |
3322 |
self startShell. |
|
3323 |
^ super postOpenWith:aBuilder. |
|
3324 |
! ! |
|
3325 |
||
3326 |
!FileApplicationNoteBook::TextEditor class methodsFor:'defaults'! |
|
3327 |
||
3328 |
tabStringFor:aApplicationType |
|
3329 |
||
3330 |
aApplicationType == #directoryDescription ifTrue:[ |
|
3331 |
^ 'Directory description for:' |
|
3332 |
] ifFalse:[ |
|
3333 |
^ 'Editor on:' |
|
3334 |
]. |
|
3335 |
! |
|
3336 |
||
3337 |
wantNewApplicationAnyway |
|
3338 |
||
3339 |
^ false |
|
3340 |
! ! |
|
3341 |
||
3342 |
!FileApplicationNoteBook::TextEditor class methodsFor:'interface - specs'! |
|
3343 |
||
3344 |
windowSpec |
|
3345 |
"This resource specification was automatically generated |
|
3346 |
by the UIPainter of ST/X." |
|
3347 |
||
3348 |
"Do not manually edit this!! If it is corrupted, |
|
3349 |
the UIPainter may not be able to read the specification." |
|
3350 |
||
3351 |
" |
|
3950 | 3352 |
UIPainter new openOnClass:FileApplicationNoteBook::TextEditor andSelector:#windowSpec |
3353 |
FileApplicationNoteBook::TextEditor new openInterface:#windowSpec |
|
3354 |
FileApplicationNoteBook::TextEditor open |
|
3892 | 3355 |
" |
3356 |
||
3357 |
<resource: #canvas> |
|
3358 |
||
3359 |
^ |
|
3360 |
#(#FullSpec |
|
3361 |
#name: #windowSpec |
|
3362 |
#window: |
|
3363 |
#(#WindowSpec |
|
3364 |
#label: 'TextEditor' |
|
3365 |
#name: 'TextEditor' |
|
3366 |
#min: #(#Point 10 10) |
|
3367 |
#max: #(#Point 1024 768) |
|
3950 | 3368 |
#bounds: #(#Rectangle 370 396 1020 696) |
3892 | 3369 |
) |
3370 |
#component: |
|
3371 |
#(#SpecCollection |
|
3372 |
#collection: #( |
|
3373 |
#(#MenuPanelSpec |
|
3374 |
#name: 'MenuTextEditor' |
|
3375 |
#layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 32 0) |
|
3376 |
#menu: #menu |
|
3377 |
#textDefault: true |
|
3378 |
) |
|
3379 |
#(#TextEditorSpec |
|
3380 |
#name: 'TextEditor' |
|
3381 |
#layout: #(#LayoutFrame 0 0.0 32 0 0 1.0 0 1.0) |
|
3382 |
#model: #fileContentsModel |
|
3383 |
#hasHorizontalScrollBar: true |
|
3384 |
#hasVerticalScrollBar: true |
|
3385 |
#modifiedChannel: #modifiedChannel |
|
3386 |
#acceptCallBack: #accept |
|
3950 | 3387 |
#allowDoIt: true |
3892 | 3388 |
#postBuildCallback: #postBuildTextEditor: |
3389 |
) |
|
3390 |
) |
|
3391 |
||
3392 |
) |
|
3393 |
) |
|
3394 |
! ! |
|
3395 |
||
3396 |
!FileApplicationNoteBook::TextEditor class methodsFor:'menu specs'! |
|
3397 |
||
3398 |
menu |
|
3399 |
"This resource specification was automatically generated |
|
3400 |
by the MenuEditor of ST/X." |
|
3401 |
||
3402 |
"Do not manually edit this!! If it is corrupted, |
|
3403 |
the MenuEditor may not be able to read the specification." |
|
3404 |
||
3405 |
" |
|
3406 |
MenuEditor new openOnClass:FileApplicationNoteBook::TextEditor andSelector:#menu |
|
3407 |
(Menu new fromLiteralArrayEncoding:(FileApplicationNoteBook::TextEditor menu)) startUp |
|
3408 |
" |
|
3409 |
||
3410 |
<resource: #menu> |
|
3411 |
||
3412 |
^ |
|
3413 |
#(#Menu |
|
3414 |
#( |
|
3415 |
#(#MenuItem |
|
3416 |
#label: 'Save' |
|
3417 |
#translateLabel: true |
|
3418 |
#isButton: true |
|
3419 |
#nameKey: #Save |
|
3420 |
#value: #accept |
|
3421 |
#enabled: #enableSave |
|
3422 |
#labelImage: #(#ResourceRetriever #ToolbarIconLibrary #saveToFile28x22Icon) |
|
3423 |
) |
|
3424 |
#(#MenuItem |
|
3425 |
#label: 'Reload' |
|
3426 |
#translateLabel: true |
|
3427 |
#isButton: true |
|
3428 |
#nameKey: #Reload |
|
3429 |
#value: #reload |
|
3430 |
#enabled: #enableReload |
|
3431 |
#labelImage: #(#ResourceRetriever #ToolbarIconLibrary #reloadFromFile28x22Icon) |
|
3432 |
) |
|
3433 |
#(#MenuItem |
|
3434 |
#label: '' |
|
3435 |
) |
|
3436 |
#(#MenuItem |
|
3437 |
#label: 'Print' |
|
3438 |
#translateLabel: true |
|
3439 |
#isButton: true |
|
3440 |
#nameKey: #Print |
|
3441 |
#value: #doPrint |
|
3442 |
#enabled: #enableHexToggle |
|
3443 |
#labelImage: #(#ResourceRetriever #ToolbarIconLibrary #printer22x22Icon) |
|
3444 |
) |
|
3445 |
#(#MenuItem |
|
3446 |
#label: '' |
|
3447 |
) |
|
3448 |
#(#MenuItem |
|
3449 |
#label: 'Hex' |
|
3450 |
#translateLabel: true |
|
3451 |
#isButton: true |
|
3452 |
#enabled: #enableHexToggle |
|
3453 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #hexToggle22x22Icon) |
|
3454 |
#indication: #printAsHexDump |
|
3455 |
) |
|
3456 |
#(#MenuItem |
|
3457 |
#label: 'Close' |
|
3458 |
#translateLabel: true |
|
3459 |
#isButton: true |
|
3460 |
#hideMenuOnActivated: false |
|
3461 |
#isVisible: #isEmbeddedApplication |
|
3462 |
#startGroup: #right |
|
3463 |
#value: #doClose |
|
3464 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #closeIcon) |
|
3465 |
) |
|
3466 |
) |
|
3467 |
nil |
|
3468 |
nil |
|
3469 |
) |
|
3470 |
! ! |
|
3471 |
||
3472 |
!FileApplicationNoteBook::TextEditor methodsFor:'accessing'! |
|
3473 |
||
3474 |
item:aDirContentsItem |
|
3475 |
||
3476 |
||
3477 |
self stopChangeItemProcess. |
|
3478 |
super item:aDirContentsItem. |
|
3479 |
(self askForChange) isNil ifTrue:[ ^ false]. |
|
3480 |
self setContents. |
|
3481 |
self startChangeItemProcess. |
|
3482 |
^ true |
|
3483 |
! |
|
3484 |
||
3485 |
presentation |
|
3486 |
"return the value of the instance variable 'presentation' (automatically generated)" |
|
3487 |
||
3488 |
presentation isNil ifTrue:[ |
|
3489 |
presentation := #asText. |
|
3490 |
]. |
|
3491 |
^ presentation |
|
3492 |
! |
|
3493 |
||
3494 |
presentation:something |
|
3495 |
"set the value of the instance variable 'presentation' (automatically generated)" |
|
3496 |
||
3497 |
presentation := something. |
|
3498 |
! |
|
3499 |
||
3500 |
semaChangeItem |
|
3501 |
||
3502 |
semaChangeItem isNil ifTrue:[ |
|
3503 |
semaChangeItem := Semaphore forMutualExclusion. |
|
3504 |
]. |
|
3505 |
^ semaChangeItem |
|
3506 |
! ! |
|
3507 |
||
3508 |
!FileApplicationNoteBook::TextEditor methodsFor:'actions'! |
|
3509 |
||
3510 |
accept |
|
3511 |
||
3512 |
| dir | |
|
3513 |
||
3514 |
self masterApplication class openAnotherApplicationOnSameItem ifTrue:[ |
|
3515 |
self updateSameFiles ifFalse:[ ^ self ]. |
|
3516 |
]. |
|
3517 |
self notifyChannel value:self fileName asString, ' saved'. |
|
3518 |
dir := self fileName directory. |
|
3519 |
dir exists not ifTrue:[ |
|
3520 |
dir recursiveMakeDirectory. |
|
3521 |
]. |
|
3522 |
editView saveAs:(self fileName). |
|
3523 |
self notifyChannel value:self fileName asString, ' saved'. |
|
3524 |
self semaChangeItem critical:[ |
|
3525 |
textEditorChangeModificationTime := nil. |
|
3526 |
self itemChanged value:false. |
|
3527 |
]. |
|
3528 |
self modifiedChannel value:false. |
|
3529 |
self itemRemoved value:false. |
|
3530 |
! |
|
3531 |
||
3532 |
askForChange |
|
3533 |
"ask for save changes |
|
3534 |
" |
|
3535 |
||
3536 |
|answer string| |
|
3537 |
||
3538 |
answer := false. |
|
3539 |
self modifiedChannel value ifTrue:[ |
|
3540 |
self itemChanged value ifTrue:[ |
|
3541 |
string := self fileName asString , ' was changed by someone else' |
|
3542 |
, Character cr , 'want to save your changes anyway ?' |
|
3543 |
]. |
|
3544 |
self itemRemoved value ifTrue:[ |
|
3545 |
string := self fileName asString , ' was removed by someone else' |
|
3546 |
, Character cr , 'want to save your changes anyway ?' |
|
3547 |
]. |
|
3548 |
string := 'save changed file ' , self fileName asString , ' ?' |
|
3549 |
]. |
|
3550 |
string notNil ifTrue:[ |
|
3551 |
answer := (Dialog confirmWithCancel:string). |
|
3552 |
answer isNil ifTrue:[^ answer]. |
|
3553 |
answer == true ifTrue:[ |
|
3554 |
self accept |
|
3555 |
] ifFalse:[ |
|
3556 |
self setContents. |
|
3557 |
] |
|
3558 |
]. |
|
3559 |
^ answer |
|
3560 |
! |
|
3561 |
||
3562 |
changeInformation |
|
3563 |
||
3564 |
| stream | |
|
3565 |
||
3566 |
stream := WriteStream with:(self getTabString). |
|
3567 |
masterApplication isNil ifTrue:[ |
|
3568 |
self window label:stream contents. |
|
3569 |
||
3570 |
] ifFalse:[ |
|
3571 |
masterApplication tabStringChangeTo:stream contents for:self. |
|
3572 |
]. |
|
3573 |
stream close. |
|
3574 |
! |
|
3575 |
||
3576 |
doClose |
|
3577 |
||
3578 |
(self askForChange) isNil ifTrue:[ ^ false]. |
|
3579 |
self masterApplication notNil ifTrue:[ |
|
3954 | 3580 |
^ super doClose |
3892 | 3581 |
]. |
3582 |
^ true |
|
3583 |
! |
|
3584 |
||
3585 |
doPrint |
|
3586 |
"print the contents |
|
3587 |
" |
|
3588 |
(Dialog confirm:'printing ?') ifTrue:[ |
|
3589 |
editView doPrint. |
|
3590 |
]. |
|
3591 |
! |
|
3592 |
||
3593 |
reload |
|
3594 |
||
3595 |
self setContents. |
|
3596 |
! |
|
3597 |
||
3598 |
setContents |
|
3599 |
||
3600 |
||
3601 |
|file contents present| |
|
3602 |
||
3603 |
file := self fileName. |
|
3604 |
RecursionInterruptSignal handle:[ : ex | |
|
3605 |
Dialog warn:file asString, ' is too big to be loaded !!'. |
|
3606 |
^ false. |
|
3607 |
] do:[ |
|
3608 |
present := self presentation. |
|
3609 |
present == #asText ifTrue:[ |
|
3610 |
contents := file contents. |
|
3611 |
] ifFalse:[ |
|
3612 |
present == #hexDump ifTrue:[ |
|
3613 |
contents := self getFileHexContents:file. |
|
3614 |
] |
|
3615 |
] |
|
3616 |
]. |
|
3617 |
self fileContentsModel value:contents. |
|
3618 |
self enableReload value:false. |
|
3619 |
self itemChanged value:false. |
|
3620 |
self modifiedChannel setValue:false. |
|
3621 |
self modifiedChannel changed. |
|
3622 |
^ true |
|
3623 |
! |
|
3624 |
||
3625 |
updateSameFiles |
|
3626 |
||
3627 |
| master modifiedApplications stream filename action| |
|
3628 |
||
3629 |
master := self masterApplication. |
|
3630 |
master notNil ifTrue:[ |
|
3631 |
modifiedApplications := master getSameFilesModifiedFor:self. |
|
3632 |
(modifiedApplications isNil or:[modifiedApplications isEmpty]) ifTrue:[^ true ]. |
|
3633 |
filename := self fileName asString. |
|
3634 |
stream := WriteStream on:''. |
|
3635 |
stream nextPutAll:filename. |
|
3636 |
stream nextPutAll:' is modified in tab'. |
|
3637 |
modifiedApplications size > 1 ifTrue:[ |
|
3638 |
stream nextPutAll:'s'. |
|
3639 |
]. |
|
3640 |
stream cr. |
|
3641 |
modifiedApplications do:[ : el | |
|
3642 |
stream space. |
|
3643 |
stream nextPutAll:filename. |
|
3644 |
stream space. |
|
3645 |
el sameFileIndex notNil ifTrue:[ |
|
3646 |
stream nextPutAll:el sameFileIndex asString. |
|
3647 |
]. |
|
3648 |
stream cr. |
|
3649 |
]. |
|
3650 |
stream nextPutAll:'forget changes on other tab'. |
|
3651 |
modifiedApplications size > 1 ifTrue:[ |
|
3652 |
stream nextPutAll:'s'. |
|
3653 |
]. |
|
3654 |
stream nextPutAll:' ?'. |
|
3655 |
action := Dialog |
|
3656 |
choose:stream contents |
|
3657 |
labels:#('cancel' 'no' 'yes') |
|
3658 |
values:#(#cancel #no #yes) |
|
3659 |
default:#cancel. |
|
3660 |
||
3661 |
stream close. |
|
3662 |
action == #cancel ifTrue:[ ^ false ]. |
|
3663 |
action == #yes ifTrue:[ |
|
3664 |
"/ here force reload for other applications |
|
3665 |
modifiedApplications do:[ : el | |
|
3666 |
el reload. |
|
3667 |
] |
|
3668 |
]. |
|
3669 |
]. |
|
3670 |
^ true. |
|
3671 |
! ! |
|
3672 |
||
3673 |
!FileApplicationNoteBook::TextEditor methodsFor:'aspects'! |
|
3674 |
||
3675 |
doSaveFile |
|
3676 |
||
3677 |
doSaveFile isNil ifTrue:[ |
|
3678 |
doSaveFile := ValueHolder new. |
|
3679 |
]. |
|
3680 |
^ doSaveFile. |
|
3681 |
! |
|
3682 |
||
3683 |
enableHexToggle |
|
3684 |
||
3685 |
enableHexToggle isNil ifTrue:[ |
|
3686 |
enableHexToggle := true asValue. |
|
3687 |
]. |
|
3688 |
^ enableHexToggle |
|
3689 |
! |
|
3690 |
||
3691 |
enableReload |
|
3692 |
||
3693 |
enableReload isNil ifTrue:[ |
|
3694 |
enableReload := false asValue. |
|
3695 |
"/ if your app needs to be notified of changes, uncomment one of the lines below: |
|
3696 |
"/ enableReload addDependent:self. |
|
3697 |
"/ enableReload onChangeSend:#enableReloadChanged to:self. |
|
3698 |
]. |
|
3699 |
^ enableReload. |
|
3700 |
! |
|
3701 |
||
3702 |
enableSave |
|
3703 |
||
3704 |
enableSave isNil ifTrue:[ |
|
3705 |
enableSave := false asValue. |
|
3706 |
"/ if your app needs to be notified of changes, uncomment one of the lines below: |
|
3707 |
"/ enableSave addDependent:self. |
|
3708 |
"/ enableSave onChangeSend:#enableSaveChanged to:self. |
|
3709 |
]. |
|
3710 |
^ enableSave. |
|
3711 |
! |
|
3712 |
||
3713 |
fileContentsModel |
|
3714 |
||
3715 |
fileContentsModel isNil ifTrue:[ |
|
3716 |
fileContentsModel := ValueHolder new. |
|
3717 |
"/ if your app needs to be notified of changes, uncomment one of the lines below: |
|
3718 |
"/ fileContentsModel addDependent:self. |
|
3719 |
"/ fileContentsModel onChangeSend:#fileContentsModelChanged to:self. |
|
3720 |
]. |
|
3721 |
^ fileContentsModel. |
|
3722 |
! |
|
3723 |
||
3724 |
itemChanged |
|
3725 |
||
3726 |
itemChanged isNil ifTrue:[ |
|
3727 |
itemChanged := false asValue. |
|
3728 |
itemChanged addDependent:self. |
|
3729 |
]. |
|
3730 |
^ itemChanged |
|
3731 |
! |
|
3732 |
||
3733 |
itemRemoved |
|
3734 |
||
3735 |
itemRemoved isNil ifTrue:[ |
|
3736 |
itemRemoved := false asValue. |
|
3737 |
itemRemoved addDependent:self. |
|
3738 |
]. |
|
3739 |
^ itemRemoved |
|
3740 |
! |
|
3741 |
||
3742 |
modifiedChannel |
|
3743 |
||
3744 |
modifiedChannel isNil ifTrue:[ |
|
3745 |
modifiedChannel := false asValue. |
|
3746 |
"/ if your app needs to be notified of changes, uncomment one of the lines below: |
|
3747 |
modifiedChannel addDependent:self. |
|
3748 |
"/ modifiedChannel onChangeSend:#modifiedChannelChanged to:self. |
|
3749 |
]. |
|
3750 |
^ modifiedChannel. |
|
3751 |
! |
|
3752 |
||
3753 |
printAsHexDump |
|
3754 |
||
3755 |
printAsHexDump isNil ifTrue:[ |
|
3756 |
printAsHexDump := false asValue. |
|
3757 |
printAsHexDump addDependent:self. |
|
3758 |
]. |
|
3759 |
^ printAsHexDump. |
|
3760 |
! ! |
|
3761 |
||
3762 |
!FileApplicationNoteBook::TextEditor methodsFor:'change & update'! |
|
3763 |
||
3764 |
changeEnableReload |
|
3765 |
||
3766 |
| modified changed removed | |
|
3767 |
||
3768 |
modified := self modifiedChannel value. |
|
3769 |
changed := self itemChanged value. |
|
3770 |
removed := self itemRemoved value. |
|
3771 |
||
3772 |
self enableReload value:((modified or:[changed]) and:[removed not]). |
|
3773 |
! |
|
3774 |
||
3775 |
update:something with:aParameter from:changedObject |
|
3776 |
"Invoked when an object that I depend upon sends a change notification." |
|
3777 |
||
3778 |
"stub code automatically generated - please change as required" |
|
3779 |
||
3780 |
|modified itemRem| |
|
3781 |
||
3782 |
changedObject == self modifiedChannel ifTrue:[ |
|
3783 |
modified := changedObject value. |
|
3784 |
self enableSave value:modified. |
|
3785 |
self changeEnableReload. |
|
3786 |
^ self |
|
3787 |
]. |
|
3788 |
changedObject == self itemRemoved ifTrue:[ |
|
3789 |
itemRem := changedObject value. |
|
3790 |
itemRem == true ifTrue:[ |
|
3791 |
self enableSave value:true. |
|
3792 |
]. |
|
3793 |
self enableHexToggle value:itemRem not. |
|
3794 |
self changeEnableReload. |
|
3795 |
^ self |
|
3796 |
]. |
|
3797 |
changedObject == self itemChanged ifTrue:[ |
|
3798 |
self changeEnableReload. |
|
3799 |
changedObject value == true ifTrue:[ |
|
3800 |
self enableSave value:true. |
|
3801 |
]. |
|
3802 |
^ self |
|
3803 |
]. |
|
3804 |
changedObject == self printAsHexDump ifTrue:[ |
|
3805 |
(self askForChange) isNil ifTrue:[ |
|
3806 |
self printAsHexDump value:changedObject value not withoutNotifying:self. |
|
3807 |
^ self |
|
3808 |
]. |
|
3809 |
changedObject value ifTrue:[ |
|
3810 |
self presentation:#hexDump. |
|
3811 |
] ifFalse:[ |
|
3812 |
self presentation:#asText. |
|
3813 |
]. |
|
3814 |
self changeInformation. |
|
3815 |
self setContents. |
|
3816 |
(self presentation == #hexDump) ifTrue:[ |
|
3817 |
editView readOnly:true. |
|
3818 |
] ifFalse:[ |
|
3819 |
editView readOnly:false. |
|
3820 |
]. |
|
3821 |
^ self |
|
3822 |
]. |
|
3823 |
||
3824 |
super update:something with:aParameter from:changedObject |
|
3825 |
! ! |
|
3826 |
||
3827 |
!FileApplicationNoteBook::TextEditor methodsFor:'printing'! |
|
3828 |
||
3829 |
printString |
|
3830 |
||
3831 |
^ ('TextEditor for:', self fileName baseName) |
|
3832 |
! ! |
|
3833 |
||
3834 |
!FileApplicationNoteBook::TextEditor methodsFor:'privat-process'! |
|
3835 |
||
3836 |
checkMyItemForChanges |
|
3837 |
||
3838 |
| dir exist myItem| |
|
3839 |
||
3840 |
dir := self fileName directory. |
|
3841 |
myItem := self item. |
|
3842 |
exist := myItem exists. |
|
3843 |
self itemRemoved value:(exist not). |
|
3844 |
exist ifTrue:[ |
|
3845 |
self semaChangeItem critical:[ |
|
3846 |
| time info| |
|
3847 |
info := self fileName asAbsoluteFilename info. |
|
3962
3906b10c42fd
modified -> modificationTime
Claus Gittinger <cg@exept.de>
parents:
3955
diff
changeset
|
3848 |
time := info modificationTime. |
3892 | 3849 |
textEditorChangeModificationTime isNil ifTrue:[ |
3850 |
textEditorChangeModificationTime := time. |
|
3851 |
]. |
|
3852 |
((textEditorChangeModificationTime = time) not) ifTrue:[ |
|
3853 |
"/ contents changed by someone else |
|
3854 |
textEditorChangeModificationTime := time. |
|
3855 |
self notifyChannel value:item fileName asString, ' was changed by someone else'. |
|
3856 |
self itemChanged value:true. |
|
3857 |
]. |
|
3858 |
] |
|
3859 |
] |
|
3860 |
! |
|
3861 |
||
3862 |
getFileHexContents:f |
|
3863 |
||
3864 |
|fileName stream data offs |
|
3865 |
addrDigits col line lineStream asciiLineStream lines| |
|
3866 |
||
3867 |
fileName := f baseName. |
|
3868 |
f isDirectory ifTrue:[ |
|
3869 |
^ Dialog warn:(resources string:'%1 is a directory.' with:fileName). |
|
3870 |
]. |
|
3871 |
f exists ifFalse:[ |
|
3872 |
Dialog warn:(resources string:'oops, ''%1'' is gone or unreadable.' with:fileName). |
|
3873 |
^ self |
|
3874 |
]. |
|
3875 |
f isReadable ifFalse:[ |
|
3876 |
Dialog warn:(resources string:'''%1'' is unreadable.' with:fileName). |
|
3877 |
^ self |
|
3878 |
]. |
|
3879 |
f fileSize > (512*1024) ifTrue:[ |
|
3880 |
(Dialog confirm:'Warning: the file is big (', (f fileSize//1024) printString , 'Kb). Show anyway ?') |
|
3881 |
ifFalse:[ |
|
3882 |
^ self |
|
3883 |
] |
|
3884 |
]. |
|
3885 |
stream := f readStream binary. |
|
3886 |
data := stream contents. |
|
3887 |
stream close. |
|
3888 |
||
3889 |
"/ subView list:nil. |
|
3890 |
col := 1. |
|
3891 |
offs := 0. |
|
3892 |
lines := StringCollection new. |
|
3893 |
||
3894 |
addrDigits := ((f fileSize + 1) log:16) truncated + 1. |
|
3895 |
||
3896 |
lineStream := '' writeStream. |
|
3897 |
asciiLineStream := '' writeStream. |
|
3898 |
||
3899 |
lineStream nextPutAll:(offs hexPrintString:addrDigits). |
|
3900 |
lineStream nextPutAll:': '. |
|
3901 |
||
3902 |
data do:[:byte | |
|
3903 |
lineStream nextPutAll:(byte hexPrintString:2). |
|
3904 |
(byte between:32 and:127) ifTrue:[ |
|
3905 |
asciiLineStream nextPut:(Character value:byte) |
|
3906 |
] ifFalse:[ |
|
3907 |
asciiLineStream nextPut:$. |
|
3908 |
]. |
|
3909 |
||
3910 |
offs := offs + 1. |
|
3911 |
col := col + 1. |
|
3912 |
col > 16 ifTrue:[ |
|
3913 |
lineStream nextPutAll:' '. |
|
3914 |
lineStream nextPutAll:asciiLineStream contents. |
|
3915 |
lines add:(lineStream contents). |
|
3916 |
(offs bitAnd:16rFF) == 0 ifTrue:[ |
|
3917 |
lines add:nil |
|
3918 |
]. |
|
3919 |
lineStream reset. |
|
3920 |
asciiLineStream reset. |
|
3921 |
||
3922 |
lineStream nextPutAll:(offs hexPrintString:addrDigits). |
|
3923 |
lineStream nextPutAll:': '. |
|
3924 |
col := 1. |
|
3925 |
] ifFalse:[ |
|
3926 |
lineStream space |
|
3927 |
] |
|
3928 |
]. |
|
3929 |
line := lineStream contents paddedTo:(3*16 + addrDigits + 1). |
|
3930 |
lines add:(line , ' ' , asciiLineStream contents). |
|
3931 |
^ lines |
|
3932 |
! |
|
3933 |
||
3934 |
startChangeItemProcess |
|
3935 |
||
3936 |
changeItemProcess isNil ifTrue:[ |
|
3937 |
self itemRemoved value:false. |
|
3938 |
self itemChanged value:false. |
|
3939 |
changeItemProcess := Process for:[ [ [true] whileTrue:[ |
|
3940 |
||
3941 |
self checkMyItemForChanges. |
|
3942 |
Delay waitForSeconds:1.0 |
|
3943 |
] |
|
3944 |
] valueNowOrOnUnwindDo:[ |
|
3945 |
changeItemProcess := nil. |
|
3946 |
textEditorChangeModificationTime := nil. |
|
3947 |
] |
|
3948 |
] |
|
3949 |
priority:(Processor systemBackgroundPriority). |
|
3950 |
||
3951 |
changeItemProcess name:('TextEditorLookForModify[', self fileName baseName, ']'). |
|
3952 |
changeItemProcess resume. |
|
3953 |
]. |
|
3954 |
! |
|
3955 |
||
3956 |
stopChangeItemProcess |
|
3957 |
||
3958 |
| task | |
|
3959 |
||
3960 |
task := changeItemProcess. |
|
3961 |
task notNil ifTrue:[ |
|
3962 |
changeItemProcess := nil. |
|
3963 |
||
3964 |
Object errorSignal handle:[:ex| |
|
3965 |
Dialog warn:ex description. |
|
3966 |
]do:[ |
|
3967 |
task isDead ifFalse:[ |
|
3968 |
task terminate. |
|
3969 |
task waitUntilTerminated. |
|
3970 |
] |
|
3971 |
] |
|
3972 |
]. |
|
3973 |
! ! |
|
3974 |
||
3975 |
!FileApplicationNoteBook::TextEditor methodsFor:'queries'! |
|
3976 |
||
3977 |
isModified |
|
3978 |
||
3979 |
^ self modifiedChannel value |
|
3980 |
! ! |
|
3981 |
||
3982 |
!FileApplicationNoteBook::TextEditor methodsFor:'startup & release'! |
|
3983 |
||
3984 |
closeRequest |
|
3985 |
||
3986 |
(self doClose) ifTrue:[ |
|
3987 |
^ super closeRequest. |
|
3988 |
]. |
|
3989 |
! |
|
3990 |
||
3991 |
postBuildTextEditor:aWidget |
|
3992 |
||
3993 |
editView := aWidget scrolledView. |
|
3994 |
! |
|
3995 |
||
3996 |
postBuildWith:aBuilder |
|
3997 |
||
3998 |
super postBuildWith:aBuilder. |
|
3999 |
! |
|
4000 |
||
4001 |
postOpenWith:aBuilder |
|
4002 |
||
4003 |
self masterApplication isNil ifTrue:[ |
|
4004 |
self masterApplication:nil. |
|
3982 | 4005 |
self item:(DirectoryContentsBrowser itemClass fileName:(Filename homeDirectory construct:'/lala/.bashrc')). |
3892 | 4006 |
]. |
4007 |
self setUpTextView. |
|
4008 |
self changeInformation. |
|
4009 |
^ super postOpenWith:aBuilder |
|
4010 |
! |
|
4011 |
||
4012 |
release |
|
4013 |
"release my resources |
|
4014 |
" |
|
4015 |
self stopChangeItemProcess. |
|
4016 |
super release. |
|
4017 |
! |
|
4018 |
||
4019 |
setUpTextView |
|
4020 |
||
4021 |
|paranthesis col| |
|
4022 |
||
4023 |
self item hasMimeType ifFalse:[^nil]. |
|
4024 |
(self item mimeType isHtml) ifTrue:[ |
|
4025 |
paranthesis := editView parenthesisSpecification. |
|
4026 |
((paranthesis at:#open) includes:$<) ifFalse:[ |
|
4027 |
col := (paranthesis at:#open) asOrderedCollection add:$<. |
|
4028 |
paranthesis at:#open put:col. |
|
4029 |
]. |
|
4030 |
((paranthesis at:#close) includes:$>) ifFalse:[ |
|
4031 |
col := (paranthesis at:#close) asOrderedCollection add:$>. |
|
4032 |
paranthesis at:#close put:col. |
|
4033 |
] |
|
4034 |
]. |
|
4035 |
! ! |
|
4036 |
||
4037 |
!FileApplicationNoteBook::XViewApplication class methodsFor:'defaults'! |
|
4038 |
||
3906 | 4039 |
UnixVNCCommand |
4040 |
||
4041 |
^ 'Xvnc' |
|
4042 |
! |
|
4043 |
||
3892 | 4044 |
maxNumberOfVNCRestarts |
4045 |
||
4046 |
^ 10 |
|
4047 |
! |
|
4048 |
||
4049 |
mimeTypeUnixApplicationMapping |
|
4050 |
||
4051 |
" here insert the application and mime type pairs to open by XviewApplication |
|
4052 |
" |
|
4053 |
||
4054 |
^ |
|
4055 |
#( |
|
4056 |
#(#'application/postscript' #gv ) |
|
4057 |
#(#'application/pdf' #acroread ) |
|
4058 |
) |
|
4059 |
! |
|
4060 |
||
4061 |
tabStringFor:aApplicationType |
|
4062 |
||
4063 |
^ 'VNC for:' |
|
4064 |
! |
|
4065 |
||
4066 |
wantNewApplicationAnyway |
|
4067 |
||
4068 |
^ false |
|
4069 |
! ! |
|
4070 |
||
4071 |
!FileApplicationNoteBook::XViewApplication class methodsFor:'interface specs'! |
|
4072 |
||
4073 |
windowSpec |
|
4074 |
"This resource specification was automatically generated |
|
4075 |
by the UIPainter of ST/X." |
|
4076 |
||
4077 |
"Do not manually edit this!! If it is corrupted, |
|
4078 |
the UIPainter may not be able to read the specification." |
|
4079 |
||
4080 |
" |
|
4081 |
UIPainter new openOnClass:NoteBookApplication::XViewApplication andSelector:#windowSpec |
|
4082 |
NoteBookApplication::XViewApplication new openInterface:#windowSpec |
|
4083 |
NoteBookApplication::XViewApplication open |
|
4084 |
" |
|
4085 |
||
4086 |
<resource: #canvas> |
|
4087 |
||
4088 |
^ |
|
4089 |
#(#FullSpec |
|
4090 |
#name: #windowSpec |
|
4091 |
#window: |
|
4092 |
#(#WindowSpec |
|
4093 |
#label: 'XView' |
|
4094 |
#name: 'XView' |
|
4095 |
#min: #(#Point 10 10) |
|
4096 |
#max: #(#Point 1024 768) |
|
4097 |
#bounds: #(#Rectangle 12 22 688 514) |
|
4098 |
#menu: #mainMenu |
|
4099 |
) |
|
4100 |
#component: |
|
4101 |
#(#SpecCollection |
|
4102 |
#collection: #( |
|
4103 |
#(#MenuPanelSpec |
|
4104 |
#name: 'MenuTerminal' |
|
4105 |
#layout: #(#LayoutFrame 0 0.0 0 0 0 1.0 32 0) |
|
4106 |
#visibilityChannel: #isEmbeddedApplication |
|
4107 |
#menu: #menu |
|
4108 |
#textDefault: true |
|
4109 |
) |
|
4110 |
#(#ArbitraryComponentSpec |
|
4111 |
#name: 'TerminalView' |
|
4112 |
#layout: #(#LayoutFrame 0 0.0 32 0.0 0 1.0 0 1.0) |
|
4113 |
#hasHorizontalScrollBar: true |
|
4114 |
#hasVerticalScrollBar: true |
|
4115 |
#miniScrollerHorizontal: false |
|
4116 |
#miniScrollerVertical: false |
|
4117 |
#hasBorder: false |
|
4118 |
#component: #VNCFrameBufferView |
|
4119 |
#postBuildCallback: #postBuildXView: |
|
4120 |
) |
|
4121 |
) |
|
4122 |
||
4123 |
) |
|
4124 |
) |
|
4125 |
! ! |
|
4126 |
||
4127 |
!FileApplicationNoteBook::XViewApplication class methodsFor:'menu specs'! |
|
4128 |
||
4129 |
menu |
|
4130 |
"This resource specification was automatically generated |
|
4131 |
by the MenuEditor of ST/X." |
|
4132 |
||
4133 |
"Do not manually edit this!! If it is corrupted, |
|
4134 |
the MenuEditor may not be able to read the specification." |
|
4135 |
||
4136 |
" |
|
4137 |
MenuEditor new openOnClass:NoteBookApplication::ImageViewApplication andSelector:#menu |
|
4138 |
(Menu new fromLiteralArrayEncoding:(NoteBookApplication::ImageViewApplication menu)) startUp |
|
4139 |
" |
|
4140 |
||
4141 |
<resource: #menu> |
|
4142 |
||
4143 |
^ |
|
4144 |
#(#Menu |
|
4145 |
#( |
|
4146 |
#(#MenuItem |
|
4147 |
#label: 'Close' |
|
4148 |
#translateLabel: true |
|
4149 |
#isButton: true |
|
4150 |
#hideMenuOnActivated: false |
|
4151 |
#startGroup: #right |
|
4152 |
#value: #doClose |
|
4153 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #closeIcon) |
|
4154 |
) |
|
4155 |
) |
|
4156 |
nil |
|
4157 |
nil |
|
4158 |
) |
|
4159 |
! ! |
|
4160 |
||
4161 |
!FileApplicationNoteBook::XViewApplication class methodsFor:'queries'! |
|
4162 |
||
4163 |
canOpenItem:aItem |
|
4164 |
||
4165 |
| keySym canOpen| |
|
4166 |
||
4167 |
keySym := aItem mimeType asSymbol. |
|
4168 |
(OperatingSystem isUNIXlike) not ifTrue:[^ false]. |
|
4169 |
canOpen := self mimeTypeUnixApplicationMapping detect:[ : el | (el at:1) == keySym ] ifNone:[nil]. |
|
4170 |
canOpen isNil ifTrue:[^ false]. |
|
4171 |
(OperatingSystem executeCommand:('which ', self UnixVNCCommand)) ifTrue:[ |
|
4172 |
^ true |
|
4173 |
] ifFalse:[ |
|
4174 |
(Dialog warn:'cant start viewer for ' |
|
4175 |
, aItem fileName baseName |
|
4176 |
) |
|
4177 |
]. |
|
4178 |
^ false. |
|
4179 |
! ! |
|
4180 |
||
4181 |
!FileApplicationNoteBook::XViewApplication methodsFor:'accessing'! |
|
4182 |
||
4183 |
xView |
|
4184 |
"return the value of the instance variable 'imageView' (automatically generated)" |
|
4185 |
||
4186 |
^ xView |
|
4187 |
! |
|
4188 |
||
4189 |
xView:something |
|
4190 |
"set the value of the instance variable 'imageView' (automatically generated)" |
|
4191 |
||
4192 |
xView := something. |
|
4193 |
! ! |
|
4194 |
||
4195 |
!FileApplicationNoteBook::XViewApplication methodsFor:'actions'! |
|
4196 |
||
4197 |
changeInformation |
|
4198 |
||
4199 |
| stream| |
|
4200 |
||
4201 |
stream := WriteStream on:''. |
|
4202 |
stream nextPutAll:'XView on: '. |
|
4203 |
stream nextPutAll:self fileName baseName. |
|
4204 |
masterApplication isNil ifTrue:[ |
|
4205 |
self window label:stream contents. |
|
4206 |
||
4207 |
] ifFalse:[ |
|
4208 |
masterApplication tabStringChangeTo:stream contents for:self. |
|
4209 |
]. |
|
4210 |
stream close. |
|
4211 |
! |
|
4212 |
||
4213 |
setupXView |
|
4214 |
||
3906 | 4215 |
|xExt yExt mainView| |
3892 | 4216 |
|
4217 |
self startVNCserver. |
|
4218 |
xExt := self xView width asString. |
|
3906 | 4219 |
self masterApplication notNil ifTrue:[ |
4220 |
mainView := self builder windowGroup mainView. |
|
4221 |
"/ if the mainView is a FileBrowser take them y extent because size of notebook can be changed |
|
4222 |
(mainView application class == (Smalltalk at:#FileBrowserV2 ifAbsent:nil)) notNil ifTrue:[ |
|
4223 |
yExt := mainView height asString. |
|
4224 |
]. |
|
4225 |
]. |
|
4226 |
yExt isNil ifTrue:[ |
|
3892 | 4227 |
yExt := self xView height asString. |
4228 |
]. |
|
4229 |
ext := xExt, 'x', yExt. |
|
4230 |
self startViewer. |
|
4231 |
! ! |
|
4232 |
||
4233 |
!FileApplicationNoteBook::XViewApplication methodsFor:'actions VNC'! |
|
4234 |
||
4235 |
setupView |
|
4236 |
| renderer view| |
|
4237 |
||
4238 |
view := xView. |
|
4239 |
renderer := VNCRenderer for:vncConnection targetWindow:view device:xView device. |
|
4240 |
||
4241 |
view renderer:renderer. |
|
4242 |
view connection:vncConnection. |
|
4243 |
||
4244 |
VNCException handle:[:ex| |
|
4245 |
self stopViewer. |
|
4246 |
] do:[ |
|
4247 |
vncConnection |
|
4248 |
startMessageHandlerProcessForRenderer:renderer |
|
4249 |
errorHandler:[:ex | self stopViewer]. |
|
4250 |
]. |
|
4251 |
! |
|
4252 |
||
4253 |
startVNCserver |
|
4254 |
|cmd blocked connected numberOfVncStarts| |
|
4255 |
||
4256 |
connected := false. |
|
4257 |
numberOfVncStarts isNil ifTrue:[ |
|
4258 |
numberOfVncStarts := 1. |
|
4259 |
] ifFalse:[ |
|
4260 |
numberOfVncStarts := numberOfVncStarts + 1. |
|
4261 |
]. |
|
4262 |
||
4263 |
vncLock isNil ifTrue:[vncLock := Semaphore forMutualExclusion]. |
|
4264 |
||
4265 |
vncServerPID isNil ifTrue:[ |
|
4266 |
cmd := ('/usr/X11R6/bin/', self class UnixVNCCommand). |
|
4267 |
cmd asFilename exists ifFalse:[ |
|
4268 |
cmd := self class UnixVNCCommand. |
|
4269 |
]. |
|
4270 |
vncPortNr isNil ifTrue:[ |
|
4271 |
vncPortNr := 29 |
|
4272 |
]. |
|
4273 |
cmd := cmd , ' :' , vncPortNr printString , ' nologo -nevershared -localhost -depth 16 -geometry 1024x1024'. |
|
4274 |
||
4275 |
blocked := OperatingSystem blockInterrupts. |
|
4276 |
||
4277 |
vncServerPID := Processor |
|
4278 |
monitor:[ |
|
4279 |
vncServerIsTerminated := false. |
|
4280 |
OperatingSystem |
|
4281 |
exec:'/bin/sh' |
|
4282 |
withArguments:(Array with:'sh' with:'-c' with:cmd) |
|
4283 |
fileDescriptors:#() |
|
4284 |
closeDescriptors:#() |
|
4285 |
fork:true |
|
4286 |
newPgrp:true |
|
4287 |
inDirectory:nil. |
|
4288 |
] |
|
4289 |
action:[:status | |
|
4290 |
status stillAlive ifFalse:[ |
|
4291 |
OperatingSystem closePid:vncServerPID. |
|
4292 |
vncLock critical:[ |
|
4293 |
vncServerPID := nil. |
|
4294 |
self vncServerTerminated. |
|
4295 |
]. |
|
4296 |
]. |
|
4297 |
]. |
|
4298 |
||
4299 |
blocked ifFalse:[ |
|
4300 |
OperatingSystem unblockInterrupts |
|
4301 |
]. |
|
4302 |
]. |
|
4303 |
||
4304 |
self waitForTerminationOfServer ifTrue:[ |
|
4305 |
"/ Transcript showCR:'server has terminated really - try with next port'. |
|
4306 |
(numberOfVncStarts < self class maxNumberOfVNCRestarts) ifTrue:[ |
|
4307 |
vncPortNr := vncPortNr + 1. |
|
4308 |
"/ Transcript showCR:'try next port ', vncPortNr asString. |
|
4309 |
self startVNCserver. |
|
4310 |
] ifFalse:[ |
|
4311 |
Dialog warn:'have started servers from port ' |
|
4312 |
, (vncPortNr - self class maxNumberOfVNCRestarts) asString |
|
4313 |
, ' to ' |
|
4314 |
, vncPortNr |
|
4315 |
, ' - cant connect anyway'. |
|
4316 |
"/ Transcript showCR:'have started servers from port ', vncPortNr - self class maxNumberOfVNCRestarts, ' to ', vncPortNr. |
|
4317 |
]. |
|
4318 |
] ifFalse:[ |
|
4319 |
vncLock critical:[ |
|
4320 |
vncServerPID isNil ifTrue:[ |
|
4321 |
Dialog warn:'Cannot start Xvnc'. |
|
4322 |
] ifFalse:[ |
|
4323 |
VNCAuthenticationFailure handle:[:ex | |
|
4324 |
Dialog warn:'Wrong password'. |
|
4325 |
] do:[ |
|
4326 |
connected := self vncConnect. |
|
4327 |
]. |
|
4328 |
connected ifTrue:[self setupView]. |
|
4329 |
]. |
|
4330 |
]. |
|
4331 |
]. |
|
4332 |
! |
|
4333 |
||
4334 |
stopVNCServer |
|
4335 |
||
4336 |
vncServerPID notNil ifTrue:[ |
|
4337 |
OperatingSystem terminateProcess:vncServerPID. |
|
4338 |
Delay waitForSeconds:0.2. |
|
4339 |
vncServerPID notNil ifTrue:[ |
|
4340 |
OperatingSystem killProcess:vncServerPID. |
|
4341 |
vncServerPID := nil. |
|
4342 |
]. |
|
4343 |
]. |
|
4344 |
self vncServerTerminated. |
|
4345 |
! |
|
4346 |
||
4347 |
vncConnect |
|
4348 |
| tryConnects| |
|
4349 |
||
4350 |
vncConnection notNil ifTrue:[ |
|
4351 |
vncConnection close |
|
4352 |
]. |
|
4353 |
||
4354 |
vncConnection := VNCServerConnection new. |
|
4355 |
tryConnects := 1. |
|
4356 |
[tryConnects < 3] whileTrue:[ |
|
4357 |
VNCConnectionFailure handle:[:ex | |
|
4358 |
Delay waitForSeconds:0.5. |
|
4359 |
tryConnects := tryConnects + 1. |
|
4360 |
] do:[ |
|
4361 |
vncConnection connectTo:'localhost' port:vncPortNr. |
|
4362 |
^ true. |
|
4363 |
]. |
|
4364 |
]. |
|
4365 |
^ false |
|
4366 |
! |
|
4367 |
||
4368 |
vncServerTerminated |
|
4369 |
"/ Transcript showCR:'vnc server has terminated'. |
|
4370 |
"/ 'vnc server has terminated' errorPrintCR. |
|
4371 |
"/ Dialog information:'vnc server has terminated'. |
|
4372 |
||
4373 |
self stopViewer. |
|
4374 |
vncConnection notNil ifTrue:[ |
|
4375 |
vncConnection close. |
|
4376 |
vncConnection := nil |
|
4377 |
]. |
|
4378 |
vncServerIsTerminated := true. |
|
4379 |
! |
|
4380 |
||
4381 |
waitForTerminationOfServer |
|
4382 |
| cycles | |
|
4383 |
||
4384 |
cycles := 1. |
|
4385 |
[vncServerIsTerminated] whileFalse:[ |
|
4386 |
(cycles > 3) ifTrue:[^ false]. |
|
4387 |
cycles := cycles + 1. |
|
4388 |
Delay waitForSeconds:0.5. |
|
4389 |
]. |
|
4390 |
^ true |
|
4391 |
! ! |
|
4392 |
||
4393 |
!FileApplicationNoteBook::XViewApplication methodsFor:'actions viewer'! |
|
4394 |
||
4395 |
startViewer |
|
4396 |
|cmd keySym applItem | |
|
4397 |
||
4398 |
keySym := self item mimeType asSymbol. |
|
4399 |
applItem := self class mimeTypeUnixApplicationMapping detect:[ : el | (el at:1) == keySym ] ifNone:[nil]. |
|
4400 |
applItem isNil ifTrue:[ ^ self]. |
|
4401 |
||
4402 |
cmd := (applItem at:2) asString, ' -geometry ', ext, ' -display :' , vncPortNr printString , ' ' , self fileName asString. |
|
4403 |
self startViewer:cmd |
|
4404 |
! |
|
4405 |
||
4406 |
startViewer:viewerCommand |
|
4407 |
|blocked| |
|
4408 |
||
4409 |
viewerPID notNil ifTrue:[ |
|
4410 |
^ self |
|
4411 |
]. |
|
4412 |
||
4413 |
blocked := OperatingSystem blockInterrupts. |
|
4414 |
||
4415 |
viewerPID := Processor |
|
4416 |
monitor:[ |
|
4417 |
OperatingSystem |
|
4418 |
exec:'/bin/sh' |
|
4419 |
withArguments:(Array with:'sh' with:'-c' with:viewerCommand) |
|
4420 |
fileDescriptors:#() |
|
4421 |
closeDescriptors:#() |
|
4422 |
fork:true |
|
4423 |
newPgrp:true |
|
4424 |
inDirectory:nil. |
|
4425 |
] |
|
4426 |
action:[:status | |
|
4427 |
status stillAlive ifFalse:[ |
|
4428 |
OperatingSystem closePid:viewerPID. |
|
4429 |
viewerPID := nil. |
|
4430 |
self viewerTerminated. |
|
4431 |
]. |
|
4432 |
]. |
|
4433 |
||
4434 |
blocked ifFalse:[ |
|
4435 |
OperatingSystem unblockInterrupts |
|
4436 |
]. |
|
4437 |
||
4438 |
viewerPID isNil ifTrue:[ |
|
4439 |
Dialog warn:'Cannot start ', viewerCommand. |
|
4440 |
]. |
|
4441 |
! |
|
4442 |
||
4443 |
startXterm |
|
4444 |
|cmd| |
|
4445 |
||
4446 |
cmd := 'xterm -geometry 600x800 -display :' , vncPortNr printString. |
|
4447 |
self startViewer:cmd |
|
4448 |
! |
|
4449 |
||
4450 |
stopViewer |
|
4451 |
viewerPID notNil ifTrue:[ |
|
4452 |
OperatingSystem terminateProcess:viewerPID. |
|
4453 |
Delay waitForSeconds:0.2. |
|
4454 |
viewerPID notNil ifTrue:[ |
|
4455 |
OperatingSystem killProcess:viewerPID. |
|
4456 |
viewerPID := nil. |
|
4457 |
] |
|
4458 |
]. |
|
4459 |
! |
|
4460 |
||
4461 |
viewerTerminated |
|
4462 |
"/ Transcript showCR:'viewer has terminated'. |
|
4463 |
"/ 'viewer has terminated' errorPrintCR. |
|
4464 |
"/ Dialog information:'viewer has terminated'. |
|
4465 |
! ! |
|
4466 |
||
4467 |
!FileApplicationNoteBook::XViewApplication methodsFor:'initialization & release'! |
|
4468 |
||
4469 |
postBuildXView:aWidget |
|
4470 |
||
4471 |
self xView:aWidget scrolledView. |
|
4472 |
self xView wantsFocusWithPointerEnter. |
|
4473 |
aWidget autoHideScrollBars:true. |
|
4474 |
! |
|
4475 |
||
4476 |
postOpenWith:aBuilder |
|
4477 |
" |
|
4478 |
only invoked if the application not started from a master |
|
4479 |
" |
|
4480 |
||
4481 |
|currentDir contents suffix fileName| |
|
4482 |
||
4483 |
self masterApplication isNil ifTrue:[ |
|
4484 |
self masterApplication:nil. |
|
4485 |
currentDir := Filename homeDirectory. |
|
4486 |
contents := currentDir directoryContents. |
|
4487 |
fileName := contents |
|
4488 |
detect:[:file | |
|
4489 |
suffix := file asFilename suffix asLowercase. |
|
4490 |
suffix = 'pdf' |
|
4491 |
] |
|
4492 |
ifNone:[nil]. |
|
4493 |
fileName isNil ifTrue:[ |
|
4494 |
Dialog warn:'cant find a PDF File in ' , currentDir asString. |
|
4495 |
^ self |
|
4496 |
]. |
|
3982 | 4497 |
self item:(DirectoryContentsBrowser itemClass fileName:(currentDir construct:fileName)). |
3892 | 4498 |
]. |
4499 |
self changeInformation. |
|
4500 |
self setupXView. |
|
4501 |
^ super postOpenWith:aBuilder |
|
4502 |
! |
|
4503 |
||
4504 |
release |
|
4505 |
"/Transcript showCR:'release'. |
|
4506 |
self stopViewer. |
|
4507 |
self stopVNCServer. |
|
4508 |
^ super release |
|
4509 |
! ! |
|
4510 |
||
4511 |
!FileApplicationNoteBook class methodsFor:'documentation'! |
|
4512 |
||
4513 |
version |
|
4001 | 4514 |
^ '$Header: /cvs/stx/stx/libtool/FileApplicationNoteBook.st,v 1.15 2002-10-15 13:12:25 penk Exp $' |
3892 | 4515 |
! ! |