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