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