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