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