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