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