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