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