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