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