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