author | penk |
Thu, 15 Jan 2004 09:48:53 +0100 | |
changeset 5430 | e500bd438cc7 |
parent 5429 | 2567fdcf2d8b |
child 5431 | 8f9d5cb9ebc7 |
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 |
|
5430 | 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 |
|
5430 | 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 |
|
5430 | 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 |
|
5430 | 43 |
instanceVariableNames:'resultStream enableStopButton process labelHolder' |
44 |
classVariableNames:'' |
|
45 |
poolDictionaries:'' |
|
46 |
privateIn:FileApplicationNoteBook |
|
3892 | 47 |
! |
48 |
||
49 |
AbstractFileApplicationNoteBookComponent subclass:#HtmlViewApplication |
|
5430 | 50 |
instanceVariableNames:'htmlView labelHolder infoLabelHolder' |
51 |
classVariableNames:'' |
|
52 |
poolDictionaries:'' |
|
53 |
privateIn:FileApplicationNoteBook |
|
3892 | 54 |
! |
55 |
||
56 |
AbstractFileApplicationNoteBookComponent subclass:#ImageViewApplication |
|
5430 | 57 |
instanceVariableNames:'imageFile imageView image fitSize fitMode' |
58 |
classVariableNames:'' |
|
59 |
poolDictionaries:'' |
|
60 |
privateIn:FileApplicationNoteBook |
|
3892 | 61 |
! |
62 |
||
63 |
AbstractFileApplicationNoteBookComponent subclass:#Terminal |
|
5430 | 64 |
instanceVariableNames:'terminalView' |
65 |
classVariableNames:'DefaultLineLimit' |
|
66 |
poolDictionaries:'' |
|
67 |
privateIn:FileApplicationNoteBook |
|
3892 | 68 |
! |
69 |
||
70 |
AbstractFileApplicationNoteBookComponent subclass:#TextEditor |
|
5430 | 71 |
instanceVariableNames:'fileContentsModel modifiedChannel editView enableSave |
72 |
enableReload presentation changeItemProcess closeApplication |
|
73 |
semaChangeItem wantToPrintAsHexDump printAsHexDump itemChanged |
|
74 |
itemRemoved enableHexToggle md5CheckSum |
|
75 |
md5HashValueComputationProcess viewModifiedChannel |
|
76 |
textEditorModificationTime checkModifiedBlock' |
|
77 |
classVariableNames:'' |
|
78 |
poolDictionaries:'' |
|
79 |
privateIn:FileApplicationNoteBook |
|
5417 | 80 |
! |
81 |
||
3892 | 82 |
AbstractFileApplicationNoteBookComponent subclass:#XViewApplication |
5430 | 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...' |
|
5415
20210169445f
allow single extract from an archive
Claus Gittinger <cg@exept.de>
parents:
5414
diff
changeset
|
1337 |
#itemValue: #extractSelection |
20210169445f
allow single extract from an archive
Claus Gittinger <cg@exept.de>
parents:
5414
diff
changeset
|
1338 |
#translateLabel: true |
20210169445f
allow single extract from an archive
Claus Gittinger <cg@exept.de>
parents:
5414
diff
changeset
|
1339 |
) |
20210169445f
allow single extract from an archive
Claus Gittinger <cg@exept.de>
parents:
5414
diff
changeset
|
1340 |
#(#MenuItem |
20210169445f
allow single extract from an archive
Claus Gittinger <cg@exept.de>
parents:
5414
diff
changeset
|
1341 |
#label: 'Extract All to Directory...' |
4475 | 1342 |
#itemValue: #extractAll |
3892 | 1343 |
#translateLabel: true |
1344 |
) |
|
1345 |
#(#MenuItem |
|
4475 | 1346 |
#enabled: #canDelete |
4476 | 1347 |
#label: 'Delete from Archive' |
4961
7b1d05219028
no need for asText when sending allBold
Claus Gittinger <cg@exept.de>
parents:
4953
diff
changeset
|
1348 |
#itemValue: #removeFilesFromArchive |
3892 | 1349 |
#translateLabel: true |
4475 | 1350 |
#shortcutKey: #Delete |
3892 | 1351 |
) |
1352 |
#(#MenuItem |
|
5415
20210169445f
allow single extract from an archive
Claus Gittinger <cg@exept.de>
parents:
5414
diff
changeset
|
1353 |
#label: '-' |
20210169445f
allow single extract from an archive
Claus Gittinger <cg@exept.de>
parents:
5414
diff
changeset
|
1354 |
) |
20210169445f
allow single extract from an archive
Claus Gittinger <cg@exept.de>
parents:
5414
diff
changeset
|
1355 |
#(#MenuItem |
4475 | 1356 |
#enabled: #canViewFile |
5415
20210169445f
allow single extract from an archive
Claus Gittinger <cg@exept.de>
parents:
5414
diff
changeset
|
1357 |
#label: 'Show Contents' |
4475 | 1358 |
#itemValue: #viewFile |
3892 | 1359 |
#translateLabel: true |
4475 | 1360 |
#isVisible: #isEmbeddedApplication |
3892 | 1361 |
) |
1362 |
) |
|
1363 |
nil |
|
1364 |
nil |
|
1365 |
) |
|
1366 |
! |
|
1367 |
||
1368 |
menu |
|
1369 |
"This resource specification was automatically generated |
|
1370 |
by the MenuEditor of ST/X." |
|
1371 |
||
1372 |
"Do not manually edit this!! If it is corrupted, |
|
1373 |
the MenuEditor may not be able to read the specification." |
|
1374 |
||
1375 |
" |
|
1376 |
MenuEditor new openOnClass:FileApplicationNoteBook::ArchiveViewApplication andSelector:#menu |
|
1377 |
(Menu new fromLiteralArrayEncoding:(FileApplicationNoteBook::ArchiveViewApplication menu)) startUp |
|
1378 |
" |
|
1379 |
||
1380 |
<resource: #menu> |
|
1381 |
||
1382 |
^ |
|
1383 |
#(#Menu |
|
1384 |
#( |
|
1385 |
#(#MenuItem |
|
4392 | 1386 |
#activeHelpKey: #stopButton |
1387 |
#enabled: #enableStopButton |
|
3892 | 1388 |
#label: 'Stop' |
4392 | 1389 |
#itemValue: #doStopProcess |
1390 |
#nameKey: #Stop |
|
3892 | 1391 |
#translateLabel: true |
1392 |
#isButton: true |
|
1393 |
#labelImage: #(#ResourceRetriever #ToolbarIconLibrary #stop22x22Icon) |
|
1394 |
) |
|
1395 |
#(#MenuItem |
|
4392 | 1396 |
#activeHelpKey: #extractItem |
3892 | 1397 |
#enabled: #hasListEntriesHolder |
4392 | 1398 |
#label: 'Extract' |
1399 |
#itemValue: #extractAll |
|
3892 | 1400 |
#translateLabel: true |
1401 |
#isButton: true |
|
4392 | 1402 |
#labelImage: #(#ResourceRetriever #'FileApplicationNoteBook::ArchiveViewApplication' #extract28x28Icon) |
3892 | 1403 |
) |
1404 |
#(#MenuItem |
|
4392 | 1405 |
#activeHelpKey: #removeOutputButton |
1406 |
#enabled: #enableRemoveErrorOutput |
|
1407 |
#label: 'Remove Output' |
|
1408 |
#itemValue: #removeErrorOutput |
|
3892 | 1409 |
#translateLabel: true |
1410 |
#isButton: true |
|
4392 | 1411 |
#labelImage: #(#ResourceRetriever #'FileApplicationNoteBook::ArchiveViewApplication' #removeBug28x28Icon) |
1412 |
) |
|
1413 |
#(#MenuItem |
|
1414 |
#activeHelpKey: #closeButton |
|
1415 |
#label: 'Close' |
|
1416 |
#itemValue: #doClose |
|
1417 |
#translateLabel: true |
|
1418 |
#isButton: true |
|
1419 |
#startGroup: #right |
|
3892 | 1420 |
#isVisible: #isEmbeddedApplication |
4392 | 1421 |
#hideMenuOnActivated: false |
3892 | 1422 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #closeIcon) |
1423 |
) |
|
1424 |
) |
|
1425 |
nil |
|
1426 |
nil |
|
1427 |
) |
|
1428 |
! ! |
|
1429 |
||
1430 |
!FileApplicationNoteBook::ArchiveViewApplication class methodsFor:'queries'! |
|
1431 |
||
5010 | 1432 |
canOpenItem:anItem |
5287
693e3ca577aa
avoid autoloading Archiver if an obviously non-archive is double clicked.
Claus Gittinger <cg@exept.de>
parents:
5279
diff
changeset
|
1433 |
|suffix mimeType| |
693e3ca577aa
avoid autoloading Archiver if an obviously non-archive is double clicked.
Claus Gittinger <cg@exept.de>
parents:
5279
diff
changeset
|
1434 |
|
693e3ca577aa
avoid autoloading Archiver if an obviously non-archive is double clicked.
Claus Gittinger <cg@exept.de>
parents:
5279
diff
changeset
|
1435 |
"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
|
1436 |
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
|
1437 |
( #('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
|
1438 |
|
693e3ca577aa
avoid autoloading Archiver if an obviously non-archive is double clicked.
Claus Gittinger <cg@exept.de>
parents:
5279
diff
changeset
|
1439 |
mimeType := anItem mimeType. |
693e3ca577aa
avoid autoloading Archiver if an obviously non-archive is double clicked.
Claus Gittinger <cg@exept.de>
parents:
5279
diff
changeset
|
1440 |
( #('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
|
1441 |
|
5315 | 1442 |
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
|
1443 |
^ (Archiver classForMimeType:mimeType) notNil and:[OperatingSystem isUNIXlike] |
3892 | 1444 |
! |
1445 |
||
1446 |
wantNewApplicationAnyway |
|
1447 |
||
1448 |
^ false |
|
1449 |
! ! |
|
1450 |
||
1451 |
!FileApplicationNoteBook::ArchiveViewApplication class methodsFor:'tableColumns specs'! |
|
1452 |
||
1453 |
tableColumns |
|
1454 |
"This resource specification was automatically generated |
|
1455 |
by the DataSetBuilder of ST/X." |
|
1456 |
||
1457 |
"Do not manually edit this!! If it is corrupted, |
|
1458 |
the DataSetBuilder may not be able to read the specification." |
|
1459 |
||
1460 |
" |
|
5008 | 1461 |
DataSetBuilder new openOnClass:FileApplicationNoteBook::ArchiveViewApplication andSelector:#tableColumns |
3892 | 1462 |
" |
1463 |
||
1464 |
<resource: #tableColumns> |
|
1465 |
||
1466 |
^#( |
|
5222
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1467 |
(DataSetColumnSpec |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1468 |
labelButtonType: Button |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1469 |
labelActionSelector: sortFileListsBy: |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1470 |
labelActionArgument: 'directory' |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1471 |
width: 25 |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1472 |
minWidth: 20 |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1473 |
height: 16 |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1474 |
model: icon |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1475 |
canSelect: false |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1476 |
isResizeable: false |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1477 |
showRowSeparator: false |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1478 |
showColSeparator: false |
3892 | 1479 |
) |
5222
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1480 |
(DataSetColumnSpec |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1481 |
label: 'File Name' |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1482 |
id: 'fileName' |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1483 |
labelAlignment: left |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1484 |
labelButtonType: Button |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1485 |
model: fileName |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1486 |
canSelect: false |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1487 |
showRowSeparator: false |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1488 |
showColSeparator: false |
3892 | 1489 |
) |
5222
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1490 |
(DataSetColumnSpec |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1491 |
label: 'Perm' |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1492 |
id: 'permissions' |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1493 |
labelButtonType: Button |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1494 |
usePreferredWidth: true |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1495 |
width: 75 |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1496 |
model: permissions |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1497 |
canSelect: false |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1498 |
showRowSeparator: false |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1499 |
showColSeparator: false |
3892 | 1500 |
) |
5222
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1501 |
(DataSetColumnSpec |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1502 |
label: 'Version' |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1503 |
id: 'version' |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1504 |
labelButtonType: Button |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1505 |
columnAlignment: right |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1506 |
width: 100 |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1507 |
minWidth: 50 |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1508 |
model: version |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1509 |
canSelect: false |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1510 |
showRowSeparator: false |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1511 |
showColSeparator: false |
3892 | 1512 |
) |
5222
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1513 |
(DataSetColumnSpec |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1514 |
label: 'Type' |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1515 |
id: 'type' |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1516 |
labelButtonType: Button |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1517 |
columnAlignment: right |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1518 |
width: 100 |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1519 |
minWidth: 50 |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1520 |
model: type |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1521 |
canSelect: false |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1522 |
showRowSeparator: false |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1523 |
showColSeparator: false |
3892 | 1524 |
) |
5222
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1525 |
(DataSetColumnSpec |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1526 |
label: 'Owner/Group' |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1527 |
id: 'ownerGroup' |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1528 |
labelButtonType: Button |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1529 |
columnAlignment: right |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1530 |
width: 100 |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1531 |
minWidth: 50 |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1532 |
model: ownerGroup |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1533 |
canSelect: false |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1534 |
showRowSeparator: false |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1535 |
showColSeparator: false |
3892 | 1536 |
) |
5222
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1537 |
(DataSetColumnSpec |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1538 |
label: 'Size' |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1539 |
id: 'size' |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1540 |
labelButtonType: Button |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1541 |
columnAlignment: right |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1542 |
width: 80 |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1543 |
model: size |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1544 |
canSelect: false |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1545 |
showRowSeparator: false |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1546 |
showColSeparator: false |
3892 | 1547 |
) |
5222
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1548 |
(DataSetColumnSpec |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1549 |
label: 'Date & Time' |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1550 |
id: 'dateAndTime' |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1551 |
labelAlignment: right |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1552 |
labelButtonType: Button |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1553 |
columnAlignment: right |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1554 |
usePreferredWidth: true |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1555 |
width: 140 |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1556 |
model: dateAndTime |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1557 |
canSelect: false |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1558 |
showRowSeparator: false |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1559 |
showColSeparator: false |
3892 | 1560 |
) |
5222
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1561 |
(DataSetColumnSpec |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1562 |
label: 'Method' |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1563 |
id: 'method' |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1564 |
labelButtonType: Button |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1565 |
columnAlignment: center |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1566 |
usePreferredWidth: true |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1567 |
width: 140 |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1568 |
model: method |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1569 |
canSelect: false |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1570 |
showRowSeparator: false |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1571 |
showColSeparator: false |
3892 | 1572 |
) |
5222
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1573 |
(DataSetColumnSpec |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1574 |
label: 'CRC' |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1575 |
id: 'crc' |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1576 |
labelButtonType: Button |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1577 |
usePreferredWidth: true |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1578 |
width: 140 |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1579 |
model: crc |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1580 |
canSelect: false |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1581 |
showRowSeparator: false |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1582 |
showColSeparator: false |
3892 | 1583 |
) |
5222
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1584 |
(DataSetColumnSpec |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1585 |
label: 'Compress Size' |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1586 |
id: 'compressSize' |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1587 |
labelButtonType: Button |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1588 |
columnAlignment: right |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1589 |
usePreferredWidth: true |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1590 |
width: 140 |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1591 |
model: compressSize |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1592 |
canSelect: false |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1593 |
showRowSeparator: false |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1594 |
showColSeparator: false |
3892 | 1595 |
) |
5222
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1596 |
(DataSetColumnSpec |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1597 |
label: 'Ratio' |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1598 |
id: 'ratio' |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1599 |
labelButtonType: Button |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1600 |
columnAlignment: right |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1601 |
usePreferredWidth: true |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1602 |
width: 140 |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1603 |
model: ratio |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1604 |
canSelect: false |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1605 |
showRowSeparator: false |
a9bad3ac536e
sort archive table columns disabled no selector was available
penk
parents:
5221
diff
changeset
|
1606 |
showColSeparator: false |
3892 | 1607 |
) |
1608 |
) |
|
5008 | 1609 |
|
3892 | 1610 |
! ! |
1611 |
||
1612 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'accessing'! |
|
1613 |
||
1614 |
archiver |
|
1615 |
"return the value of the instance variable 'archiver' (automatically generated)" |
|
1616 |
||
1617 |
^ archiver |
|
1618 |
! |
|
1619 |
||
1620 |
archiver:something |
|
1621 |
"set the value of the instance variable 'archiver' (automatically generated)" |
|
1622 |
||
1623 |
archiver := something. |
|
1624 |
! |
|
1625 |
||
1626 |
columnDescriptors |
|
1627 |
"return the value of the instance variable 'columnDescriptors' (automatically generated)" |
|
1628 |
||
1629 |
^ columnDescriptors |
|
1630 |
! |
|
1631 |
||
1632 |
columnDescriptors:aListOfColumns |
|
1633 |
"set the value of the instance variable 'columnDescriptors' (automatically generated)" |
|
1634 |
||
1635 |
columnDescriptors = aListOfColumns ifTrue:[ |
|
1636 |
^ self |
|
1637 |
]. |
|
1638 |
||
1639 |
columnDescriptors := OrderedCollection new. |
|
1640 |
||
1641 |
aListOfColumns keysAndValuesDo:[:anIndex :aDesc| |col| |
|
1642 |
col := aDesc isSequenceable ifTrue:[DataSetColumnSpec new fromLiteralArrayEncoding:aDesc] |
|
1643 |
ifFalse:[aDesc]. |
|
1644 |
columnDescriptors add:col. |
|
1645 |
]. |
|
1646 |
! |
|
1647 |
||
5010 | 1648 |
item:anItem |
1649 |
super item:anItem. |
|
4905 | 1650 |
|
4375 | 1651 |
self removeErrorOutput. |
4905 | 1652 |
archiver := Archiver newFor:self fileName. |
1653 |
||
1654 |
archiver notNil ifTrue:[ |
|
4803 | 1655 |
self |
1656 |
makeProcessFor:[ |
|
4905 | 1657 |
self archiver:archiver. |
4803 | 1658 |
self setColumnsForArchiver. |
1659 |
] |
|
1660 |
with:'Setup archive'. |
|
3892 | 1661 |
^ true |
1662 |
]. |
|
1663 |
^ false |
|
1664 |
! |
|
1665 |
||
1666 |
temporaryDirectory |
|
1667 |
"return the value of the instance variable 'temporaryDirectory' (automatically generated)" |
|
1668 |
||
1669 |
temporaryDirectory isNil ifTrue:[ |
|
1670 |
temporaryDirectory := Filename newTemporary. |
|
1671 |
temporaryDirectory makeDirectory. |
|
1672 |
]. |
|
1673 |
^ temporaryDirectory |
|
1674 |
! ! |
|
1675 |
||
1676 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'actions'! |
|
1677 |
||
5010 | 1678 |
changeItem:anItem |
1679 |
self item:anItem. |
|
4803 | 1680 |
self clearFileList. |
4905 | 1681 |
self listAllFiles. |
3892 | 1682 |
^ true |
1683 |
! |
|
1684 |
||
4803 | 1685 |
clearFileList |
1686 |
||
1687 |
self archiveFileList value removeAll. |
|
1688 |
! |
|
1689 |
||
3892 | 1690 |
copyFilesToClipboard |
1691 |
||
1692 |
||
1693 |
|sel list stream| |
|
1694 |
||
1695 |
sel := self selectionHolder value. |
|
1696 |
list := self archiveFileList. |
|
1697 |
(sel notNil and:[sel notEmpty]) ifTrue:[ |
|
1698 |
stream := WriteStream on:''. |
|
1699 |
sel do:[: key | |
|
1700 |
stream nextPutAll:(key fileName asString). |
|
1701 |
stream cr. |
|
1702 |
]. |
|
1703 |
self window setTextSelection:stream contents. |
|
1704 |
stream close. |
|
1705 |
]. |
|
1706 |
! |
|
1707 |
||
1708 |
dblClick |
|
1709 |
||
1710 |
self viewFile. |
|
1711 |
! |
|
1712 |
||
1713 |
doStopProcess |
|
1714 |
||
1715 |
| archiver | |
|
1716 |
self stopProcess. |
|
1717 |
archiver := self archiver. |
|
1718 |
archiver notNil ifTrue:[ |
|
1719 |
self archiver stopProcess. |
|
1720 |
]. |
|
1721 |
self enableStopButton value:false. |
|
1722 |
! |
|
1723 |
||
1724 |
removeErrorOutput |
|
1725 |
||
1726 |
self viewErrorList value:false. |
|
1727 |
self errorListHolder removeAll. |
|
1728 |
! |
|
1729 |
||
1730 |
removeTemporaryDirectory |
|
1731 |
||
1732 |
temporaryDirectory notNil ifTrue:[ |
|
4923
1aced17a14a7
Do not use obsolete FileDirectory
Stefan Vogel <sv@exept.de>
parents:
4913
diff
changeset
|
1733 |
temporaryDirectory removeDirectory. |
3892 | 1734 |
temporaryDirectory := nil. |
1735 |
]. |
|
1736 |
! |
|
1737 |
||
1738 |
selectAll |
|
1739 |
||
1740 |
| sel listOfFiles| |
|
1741 |
||
1742 |
sel := OrderedCollection new. |
|
1743 |
listOfFiles := self archiveFileList value. |
|
1744 |
1 to:(listOfFiles size) do:[ : el | |
|
1745 |
sel add:el |
|
1746 |
]. |
|
1747 |
self selectionHolder value:sel. |
|
1748 |
! |
|
1749 |
||
1750 |
updateFileBrowserIfPresentWith:aDirectory |
|
1751 |
||
1752 |
| master| |
|
1753 |
||
1754 |
master := self masterApplication. |
|
1755 |
master notNil ifTrue:[ |
|
1756 |
master updateAndSelect:(OrderedCollection with:aDirectory). |
|
1757 |
]. |
|
1758 |
! |
|
1759 |
||
1760 |
viewFile |
|
1761 |
||
1762 |
| master item file tempDir| |
|
1763 |
||
4001 | 1764 |
self canViewFile ifFalse:[^ self]. |
3892 | 1765 |
master := self masterApplication. |
1766 |
self selectionHolder value size = 1 ifFalse:[ |
|
1767 |
Dialog warn:'only one file have to be selected'. |
|
1768 |
^ self. |
|
1769 |
]. |
|
1770 |
tempDir := self temporaryDirectory. |
|
1771 |
self extractSelectedFilesTo:tempDir askForExtractOptions:false. |
|
1772 |
process notNil ifTrue:[ |
|
1773 |
process waitUntilTerminated. |
|
1774 |
]. |
|
1775 |
file := tempDir construct:self selectionHolder value first fileName. |
|
1776 |
file exists ifTrue:[ |
|
3982 | 1777 |
item := DirectoryContentsBrowser itemClass fileName:file. |
3892 | 1778 |
]. |
1779 |
master notNil ifTrue:[ |
|
1780 |
master openApplByFileItem:item. |
|
1781 |
]. |
|
1782 |
! ! |
|
1783 |
||
1784 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'aspects'! |
|
1785 |
||
1786 |
archiveFileList |
|
1787 |
||
1788 |
archiveFileList isNil ifTrue:[ |
|
1789 |
archiveFileList := List new. |
|
1790 |
archiveFileList addDependent:self. |
|
1791 |
]. |
|
1792 |
^ archiveFileList. |
|
1793 |
! |
|
1794 |
||
1795 |
enableRemoveErrorOutput |
|
1796 |
"return/create the 'enableRemoveErrorOutput' value holder (automatically generated)" |
|
1797 |
||
1798 |
enableRemoveErrorOutput isNil ifTrue:[ |
|
1799 |
enableRemoveErrorOutput := false asValue. |
|
1800 |
]. |
|
1801 |
^ enableRemoveErrorOutput |
|
1802 |
! |
|
1803 |
||
1804 |
enableStopButton |
|
1805 |
||
1806 |
enableStopButton isNil ifTrue:[ |
|
1807 |
enableStopButton := false asValue. |
|
1808 |
]. |
|
1809 |
^ enableStopButton |
|
1810 |
! |
|
1811 |
||
1812 |
errorListHolder |
|
1813 |
||
1814 |
errorListHolder isNil ifTrue:[ |
|
1815 |
errorListHolder := List new. |
|
1816 |
]. |
|
1817 |
^ errorListHolder. |
|
1818 |
! |
|
1819 |
||
1820 |
errorListVisibilityHolder |
|
1821 |
||
1822 |
errorListVisibilityHolder isNil ifTrue:[ |
|
1823 |
errorListVisibilityHolder := false asValue. |
|
1824 |
]. |
|
1825 |
^ errorListVisibilityHolder |
|
1826 |
! |
|
1827 |
||
1828 |
hasSelectionInList |
|
1829 |
||
1830 |
| sel | |
|
1831 |
sel := self selectionHolder value. |
|
1832 |
^ (sel notNil and:[sel notEmpty]) |
|
1833 |
! |
|
1834 |
||
1835 |
selectionHolder |
|
1836 |
||
1837 |
selectionHolder isNil ifTrue:[ |
|
1838 |
selectionHolder := ValueHolder new. |
|
1839 |
selectionHolder addDependent:self. |
|
1840 |
]. |
|
1841 |
^ selectionHolder. |
|
1842 |
! |
|
1843 |
||
1844 |
tableColumns |
|
1845 |
||
1846 |
tableColumns isNil ifTrue:[ |
|
1847 |
tableColumns := self class tableColumns asValue. |
|
1848 |
]. |
|
1849 |
^ tableColumns. |
|
1850 |
! |
|
1851 |
||
1852 |
viewErrorList |
|
1853 |
"return/create the 'viewErrorList' value holder (automatically generated)" |
|
1854 |
||
1855 |
viewErrorList isNil ifTrue:[ |
|
1856 |
viewErrorList := false asValue. |
|
1857 |
viewErrorList onChangeSend:#viewErrorListChanged to:self. |
|
1858 |
]. |
|
1859 |
^ viewErrorList |
|
1860 |
! ! |
|
1861 |
||
1862 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'change & update'! |
|
1863 |
||
1864 |
update:something with:aParameter from:changedObject |
|
1865 |
"Invoked when an object that I depend upon sends a change notification." |
|
1866 |
||
1867 |
"stub code automatically generated - please change as required" |
|
1868 |
||
1869 |
changedObject == self archiveFileList ifTrue:[ |
|
1870 |
self hasListEntriesHolder value:(changedObject notEmpty). |
|
1871 |
^ self |
|
1872 |
]. |
|
1873 |
super update:something with:aParameter from:changedObject |
|
1874 |
! |
|
1875 |
||
1876 |
viewErrorListChanged |
|
1877 |
||
1878 |
| viewListValue| |
|
1879 |
||
1880 |
viewListValue := self viewErrorList value. |
|
1881 |
self enableRemoveErrorOutput value:viewListValue. |
|
1882 |
self errorListVisibilityHolder value:viewListValue. |
|
1883 |
! ! |
|
1884 |
||
1885 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'command execution'! |
|
1886 |
||
1887 |
getErrorBlock |
|
1888 |
||
1889 |
^ |
|
1890 |
[: x | |
|
1891 |
self viewErrorList value:true. |
|
1892 |
self errorListHolder value add:x. |
|
1893 |
] |
|
1894 |
! |
|
1895 |
||
1896 |
getErrorStream |
|
1897 |
||
1898 |
|errStream| |
|
1899 |
||
1900 |
errStream := ActorStream new. |
|
1901 |
errStream nextPutLineBlock:(self getErrorBlock). |
|
1902 |
^ errStream |
|
1903 |
! |
|
1904 |
||
1905 |
getOutBlock |
|
4961
7b1d05219028
no need for asText when sending allBold
Claus Gittinger <cg@exept.de>
parents:
4953
diff
changeset
|
1906 |
|archiveOutputParser| |
7b1d05219028
no need for asText when sending allBold
Claus Gittinger <cg@exept.de>
parents:
4953
diff
changeset
|
1907 |
|
7b1d05219028
no need for asText when sending allBold
Claus Gittinger <cg@exept.de>
parents:
4953
diff
changeset
|
1908 |
archiveOutputParser := archiver listFilesReader. |
7b1d05219028
no need for asText when sending allBold
Claus Gittinger <cg@exept.de>
parents:
4953
diff
changeset
|
1909 |
|
5413 | 1910 |
^ [: line | |item| |
4961
7b1d05219028
no need for asText when sending allBold
Claus Gittinger <cg@exept.de>
parents:
4953
diff
changeset
|
1911 |
item := archiveOutputParser parseLine:line forItemClass:ArchivItem. |
7b1d05219028
no need for asText when sending allBold
Claus Gittinger <cg@exept.de>
parents:
4953
diff
changeset
|
1912 |
item notNil ifTrue:[ |
3892 | 1913 |
self archiveFileList value add:item |
1914 |
]. |
|
1915 |
] |
|
1916 |
! |
|
1917 |
||
1918 |
getOutStream |
|
1919 |
||
1920 |
|outStream| |
|
1921 |
||
1922 |
outStream := ActorStream new. |
|
1923 |
outStream nextPutLineBlock:(self getOutBlock). |
|
1924 |
^ outStream |
|
1925 |
! |
|
1926 |
||
1927 |
makeProcessFor:aBlock |
|
1928 |
self makeProcessFor:aBlock with:'' |
|
1929 |
! |
|
1930 |
||
1931 |
makeProcessFor:aBlock with:string |
|
1932 |
process notNil ifTrue:[ |
|
1933 |
process waitUntilTerminated. |
|
1934 |
terminateByMe ifTrue:[ |
|
1935 |
terminateByMe := false. |
|
1936 |
^ self |
|
1937 |
]. |
|
1938 |
]. |
|
4803 | 1939 |
|
1940 |
process := [ [ |
|
1941 |
self notify:string. |
|
1942 |
aBlock value. |
|
1943 |
self notify:''. |
|
4890
b3f7edcf4981
Stream streamErrorSignal -> StreamError
Stefan Vogel <sv@exept.de>
parents:
4880
diff
changeset
|
1944 |
] ensure:[ |
3892 | 1945 |
process := nil. |
1946 |
self enableStopButton value:false. |
|
1947 |
] |
|
4803 | 1948 |
] newProcess. |
3892 | 1949 |
process priority:(Processor systemBackgroundPriority). |
1950 |
process name:'ArchiveApplicationProcess'. |
|
4803 | 1951 |
process resume. |
3892 | 1952 |
self enableStopButton value:true. |
1953 |
! |
|
1954 |
||
1955 |
setColumnsForArchiver |
|
1956 |
||
1957 |
| newColumns archiverColumns allColumns iconColumn| |
|
1958 |
||
4965
a251b39fb4a2
dont use a column-descriptors id-field
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
1959 |
archiverColumns := archiver columns collect:[:el| el first]. |
3892 | 1960 |
allColumns := OrderedCollection new. |
1961 |
newColumns := OrderedCollection new. |
|
1962 |
self class tableColumns do:[:el| |
|
1963 |
allColumns add:(DataSetColumnSpec new fromLiteralArrayEncoding:el). |
|
1964 |
]. |
|
4965
a251b39fb4a2
dont use a column-descriptors id-field
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
1965 |
iconColumn := allColumns detect:[: col | (col readSelector asSymbol) = #icon] ifNone:[nil]. |
3892 | 1966 |
iconColumn notNil ifTrue:[ |
1967 |
newColumns add:iconColumn. |
|
1968 |
]. |
|
1969 |
allColumns do:[:col| |
|
4965
a251b39fb4a2
dont use a column-descriptors id-field
Claus Gittinger <cg@exept.de>
parents:
4964
diff
changeset
|
1970 |
(archiverColumns includes:(col readSelector asSymbol)) ifTrue:[ |
3892 | 1971 |
newColumns add:col. |
1972 |
]. |
|
1973 |
]. |
|
1974 |
self tableColumns value:newColumns. |
|
1975 |
self columnDescriptors:(self tableColumns value). |
|
1976 |
! |
|
1977 |
||
1978 |
stopProcess |
|
1979 |
||
1980 |
|task| |
|
1981 |
||
1982 |
terminateByMe := true. |
|
1983 |
(task := process) notNil ifTrue:[ |
|
1984 |
process := nil. |
|
1985 |
||
4645
fcf36da5b305
Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents:
4626
diff
changeset
|
1986 |
Error handle:[:ex| |
3892 | 1987 |
Dialog warn:ex description. |
4645
fcf36da5b305
Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents:
4626
diff
changeset
|
1988 |
] do:[ |
3892 | 1989 |
task isDead ifFalse:[ |
3919 | 1990 |
task terminateWithAllSubprocessesInGroup. |
3892 | 1991 |
task waitUntilTerminated. |
1992 |
] |
|
1993 |
] |
|
1994 |
]. |
|
1995 |
! ! |
|
1996 |
||
1997 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'command helper'! |
|
1998 |
||
1999 |
selectDirectoryDialog |
|
2000 |
||
2001 |
| dir directory haveDirectory| |
|
2002 |
||
2003 |
directory := self fileName directory. |
|
2004 |
haveDirectory := false. |
|
2005 |
[haveDirectory] whileFalse:[ |
|
2006 |
dir := Dialog requestDirectoryName:'Which directory ?' default:dir. |
|
3988 | 2007 |
dir isEmpty ifTrue:[ ^ nil]. |
3892 | 2008 |
dir := dir asFilename. |
2009 |
(dir isExecutable not or:[dir isWritable not]) ifTrue:[ |
|
2010 |
Dialog warn:'cant write to: ', dir asString. |
|
2011 |
]. |
|
2012 |
haveDirectory := true. |
|
2013 |
]. |
|
2014 |
^ dir |
|
3988 | 2015 |
! |
2016 |
||
2017 |
selectDirectoryDialog:message |
|
5413 | 2018 |
|dir haveDirectory answer| |
2019 |
||
2020 |
dir := self masterApplication currentDirectory. |
|
2021 |
dir isNil ifTrue:[ |
|
2022 |
dir := archiver fileName withoutSuffix. |
|
5221 | 2023 |
"/ (fn exists and:[fn isDirectory]) ifTrue:[ |
2024 |
"/ dir := fn |
|
2025 |
"/ ] ifFalse:[ |
|
2026 |
"/ dir := fn directory |
|
2027 |
"/ ]. |
|
4981
0476a3d2d4ef
archiver fix in SelectDirectoryDialog (nil fileName)
Claus Gittinger <cg@exept.de>
parents:
4977
diff
changeset
|
2028 |
]. |
5221 | 2029 |
|
3988 | 2030 |
haveDirectory := false. |
2031 |
[haveDirectory] whileFalse:[ |
|
2032 |
dir := Dialog requestDirectoryName:message default:dir. |
|
2033 |
dir isEmpty ifTrue:[ ^ nil]. |
|
4396
eb8622726488
dialog strings; added create directory to extract operation
Claus Gittinger <cg@exept.de>
parents:
4393
diff
changeset
|
2034 |
|
3988 | 2035 |
dir := dir asFilename. |
4396
eb8622726488
dialog strings; added create directory to extract operation
Claus Gittinger <cg@exept.de>
parents:
4393
diff
changeset
|
2036 |
dir exists ifFalse:[ |
eb8622726488
dialog strings; added create directory to extract operation
Claus Gittinger <cg@exept.de>
parents:
4393
diff
changeset
|
2037 |
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
|
2038 |
answer isNil ifTrue:[ |
eb8622726488
dialog strings; added create directory to extract operation
Claus Gittinger <cg@exept.de>
parents:
4393
diff
changeset
|
2039 |
^ nil |
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 |
answer ifTrue:[ |
eb8622726488
dialog strings; added create directory to extract operation
Claus Gittinger <cg@exept.de>
parents:
4393
diff
changeset
|
2042 |
dir makeDirectory. |
eb8622726488
dialog strings; added create directory to extract operation
Claus Gittinger <cg@exept.de>
parents:
4393
diff
changeset
|
2043 |
dir exists ifFalse:[ |
eb8622726488
dialog strings; added create directory to extract operation
Claus Gittinger <cg@exept.de>
parents:
4393
diff
changeset
|
2044 |
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
|
2045 |
] |
eb8622726488
dialog strings; added create directory to extract operation
Claus Gittinger <cg@exept.de>
parents:
4393
diff
changeset
|
2046 |
]. |
3988 | 2047 |
]. |
4396
eb8622726488
dialog strings; added create directory to extract operation
Claus Gittinger <cg@exept.de>
parents:
4393
diff
changeset
|
2048 |
dir exists ifTrue:[ |
eb8622726488
dialog strings; added create directory to extract operation
Claus Gittinger <cg@exept.de>
parents:
4393
diff
changeset
|
2049 |
(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
|
2050 |
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
|
2051 |
] ifFalse:[ |
eb8622726488
dialog strings; added create directory to extract operation
Claus Gittinger <cg@exept.de>
parents:
4393
diff
changeset
|
2052 |
haveDirectory := true. |
eb8622726488
dialog strings; added create directory to extract operation
Claus Gittinger <cg@exept.de>
parents:
4393
diff
changeset
|
2053 |
]. |
eb8622726488
dialog strings; added create directory to extract operation
Claus Gittinger <cg@exept.de>
parents:
4393
diff
changeset
|
2054 |
]. |
3988 | 2055 |
]. |
2056 |
^ dir |
|
3892 | 2057 |
! ! |
2058 |
||
2059 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'commands add'! |
|
2060 |
||
4803 | 2061 |
addFilesToArchive:colOfFiles |
2062 |
self archiver |
|
2063 |
outStream:nil |
|
2064 |
errorStream:(self getErrorStream) |
|
2065 |
synchron:true. |
|
2066 |
||
4961
7b1d05219028
no need for asText when sending allBold
Claus Gittinger <cg@exept.de>
parents:
4953
diff
changeset
|
2067 |
"/ self |
7b1d05219028
no need for asText when sending allBold
Claus Gittinger <cg@exept.de>
parents:
4953
diff
changeset
|
2068 |
"/ makeProcessFor:[ |
7b1d05219028
no need for asText when sending allBold
Claus Gittinger <cg@exept.de>
parents:
4953
diff
changeset
|
2069 |
"/ self archiver addFilesToArchive:colOfFiles. |
7b1d05219028
no need for asText when sending allBold
Claus Gittinger <cg@exept.de>
parents:
4953
diff
changeset
|
2070 |
"/ ] |
7b1d05219028
no need for asText when sending allBold
Claus Gittinger <cg@exept.de>
parents:
4953
diff
changeset
|
2071 |
"/ with:'Adding files to archive'. |
7b1d05219028
no need for asText when sending allBold
Claus Gittinger <cg@exept.de>
parents:
4953
diff
changeset
|
2072 |
"/ synchronous - otherwise list below fails |
7b1d05219028
no need for asText when sending allBold
Claus Gittinger <cg@exept.de>
parents:
4953
diff
changeset
|
2073 |
self archiver addFilesToArchive:colOfFiles. |
4803 | 2074 |
|
2075 |
"/ ugly code alarm. |
|
3892 | 2076 |
(self archiver class == Archiver zipArchive) ifTrue:[ |
4905 | 2077 |
self listAllFiles |
3892 | 2078 |
] ifFalse:[ |
4905 | 2079 |
self listFiles:colOfFiles |
3892 | 2080 |
]. |
4803 | 2081 |
^ true |
3892 | 2082 |
! ! |
2083 |
||
2084 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'commands extract'! |
|
2085 |
||
2086 |
extractAll |
|
2087 |
||
2088 |
self extractSelectedFilesTo:nil withSelection:#all |
|
2089 |
! |
|
2090 |
||
2091 |
extractSelectedFilesTo:aDirectory askForExtractOptions:askForExtractOptionsBoolean |
|
2092 |
||
2093 |
self extractSelectedFilesTo:aDirectory withSelection:#selection askForExtractOptions:askForExtractOptionsBoolean |
|
2094 |
! |
|
2095 |
||
2096 |
extractSelectedFilesTo:aDirectory withSelection:selectOrAll |
|
2097 |
||
2098 |
self extractSelectedFilesTo:aDirectory withSelection:selectOrAll askForExtractOptions:true. |
|
2099 |
! |
|
2100 |
||
2101 |
extractSelectedFilesTo:aDirectory withSelection:selectOrAll askForExtractOptions:askForExtractOptionsBoolean |
|
2102 |
||
2103 |
| dir| |
|
2104 |
||
2105 |
aDirectory isNil ifTrue:[ |
|
5413 | 2106 |
dir := self selectDirectoryDialog:'Extract into Directory?'. |
3892 | 2107 |
dir isNil ifTrue:[^ self]. |
2108 |
] ifFalse:[ |
|
2109 |
dir := aDirectory. |
|
2110 |
]. |
|
2111 |
selectOrAll == #all ifTrue:[ |
|
2112 |
self extractAllTo:dir. |
|
2113 |
]. |
|
2114 |
selectOrAll == #selection ifTrue:[ |
|
2115 |
self extractSelectionTo:dir askForExtractOptions:askForExtractOptionsBoolean |
|
2116 |
]. |
|
4001 | 2117 |
"/ self updateFileBrowserIfPresentWith:dir. |
3892 | 2118 |
! ! |
2119 |
||
2120 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'commands extract private'! |
|
2121 |
||
2122 |
extractAllTo:aDirectory |
|
2123 |
||
4803 | 2124 |
self archiver |
2125 |
outStream:nil |
|
2126 |
errorStream:(self getErrorStream) |
|
2127 |
synchron:true. |
|
2128 |
self |
|
4905 | 2129 |
makeProcessFor:[ self archiver extractFilesTo:aDirectory ] |
4803 | 2130 |
with:'Extracting all files'. |
3892 | 2131 |
^ true. |
2132 |
! |
|
2133 |
||
5415
20210169445f
allow single extract from an archive
Claus Gittinger <cg@exept.de>
parents:
5414
diff
changeset
|
2134 |
extractSelection |
20210169445f
allow single extract from an archive
Claus Gittinger <cg@exept.de>
parents:
5414
diff
changeset
|
2135 |
self extractSelectedFilesTo:nil withSelection:#selection askForExtractOptions:true |
20210169445f
allow single extract from an archive
Claus Gittinger <cg@exept.de>
parents:
5414
diff
changeset
|
2136 |
! |
20210169445f
allow single extract from an archive
Claus Gittinger <cg@exept.de>
parents:
5414
diff
changeset
|
2137 |
|
3892 | 2138 |
extractSelectionTo:aDirectory askForExtractOptions:askForExtractOptionsBoolean |
2139 |
||
2140 |
| sel index extractWithDirectoryPart extractAllFilesInSelectedDirectories extractFiles| |
|
2141 |
||
2142 |
extractWithDirectoryPart := true. |
|
2143 |
extractAllFilesInSelectedDirectories := false. |
|
2144 |
sel := self selectionHolder value. |
|
2145 |
(sel isNil or:[sel isEmpty]) ifTrue:[ |
|
2146 |
sel := self archiveFileList value. |
|
2147 |
]. |
|
2148 |
sel := sel do:[:item| |
|
2149 |
item fileName: item fileName |
|
2150 |
]. |
|
2151 |
(askForExtractOptionsBoolean and:[self archiver class ~= Archiver zipArchive]) ifTrue:[ |
|
2152 |
extractFiles := self selRemoveFilesForDirs:sel. |
|
2153 |
] ifFalse:[ |
|
2154 |
extractFiles := sel. |
|
2155 |
]. |
|
2156 |
||
2157 |
askForExtractOptionsBoolean ifTrue:[ |
|
2158 |
index := extractFiles findFirst:[: el | el hasDirectoryPart]. |
|
2159 |
index ~= 0 ifTrue:[ |
|
4964 | 2160 |
extractWithDirectoryPart := (Dialog confirmWithCancel:'Extract with directory part ?\\(I.e. create empty directories as required to preserve relative path)' withCRs default:true). |
3892 | 2161 |
extractWithDirectoryPart isNil ifTrue:[^ false]. |
2162 |
]. |
|
2163 |
]. |
|
2164 |
extractWithDirectoryPart ifTrue:[ |
|
2165 |
self extractWithDirectoryPartTo:aDirectory with:extractFiles. |
|
2166 |
] ifFalse:[ |
|
2167 |
self extractWithOutDirectoryPartTo:aDirectory with:extractFiles. |
|
2168 |
]. |
|
2169 |
^ true |
|
2170 |
! |
|
2171 |
||
2172 |
extractWithDirectoryPartTo:aDirectory with:extractFiles |
|
2173 |
||
4803 | 2174 |
self archiver |
2175 |
outStream:nil |
|
2176 |
errorStream:(self getErrorStream) |
|
2177 |
synchron:true. |
|
2178 |
self |
|
4905 | 2179 |
makeProcessFor:[ self archiver extractFiles:extractFiles to:aDirectory ] |
4803 | 2180 |
with:('Extracting files to %1' bindWith:aDirectory asString). |
3892 | 2181 |
^ true. |
2182 |
! |
|
2183 |
||
2184 |
extractWithOutDirectoryPartTo:aDirectory with:extractFiles |
|
2185 |
||
4803 | 2186 |
self archiver |
2187 |
outStream:nil |
|
2188 |
errorStream:(self getErrorStream) |
|
2189 |
synchron:true. |
|
2190 |
self |
|
2191 |
makeProcessFor:[ |
|
2192 |
self archiver |
|
4905 | 2193 |
extractFiles:(extractFiles collect:[:item| item fileName]) |
2194 |
withoutDirectoryTo:aDirectory. |
|
4803 | 2195 |
] |
2196 |
with:('Extracting files to %1' bindWith:aDirectory asString). |
|
3892 | 2197 |
^ true. |
2198 |
! ! |
|
2199 |
||
2200 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'commands list'! |
|
2201 |
||
4905 | 2202 |
listAllFiles |
3892 | 2203 |
self archiveFileList value removeAll. |
4905 | 2204 |
self listFiles:nil |
2205 |
! |
|
2206 |
||
2207 |
listFiles:aColOfFilesOrNil |
|
3892 | 2208 |
process notNil ifTrue:[ |
4803 | 2209 |
process waitUntilTerminated |
3892 | 2210 |
]. |
4803 | 2211 |
|
4905 | 2212 |
archiver notNil ifTrue:[ |
2213 |
self archiver |
|
2214 |
outStream:(self getOutStream) |
|
2215 |
errorStream:(self getErrorStream) |
|
2216 |
synchron:true. |
|
2217 |
||
2218 |
self |
|
2219 |
makeProcessFor:[self archiver listFiles:aColOfFilesOrNil] |
|
2220 |
with:'List files' |
|
2221 |
] |
|
3892 | 2222 |
! ! |
2223 |
||
2224 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'commands remove'! |
|
2225 |
||
4803 | 2226 |
removeFilesFromArchive |
2227 |
|sel realSel list firtsPre stringCol stringRealSel| |
|
3892 | 2228 |
|
2229 |
sel := self selectionHolder value. |
|
4803 | 2230 |
stringCol := sel collect:[:item | item fileName]. |
3892 | 2231 |
firtsPre := stringCol at:1. |
4803 | 2232 |
stringCol from:2 do:[:el | firtsPre := firtsPre commonPrefixWith:el]. |
3892 | 2233 |
list := self archiveFileList value. |
4803 | 2234 |
"/ realSel := OrderedCollection new. |
2235 |
"/ list do:[:item | |
|
2236 |
"/ ((item fileName) startsWith:firtsPre) ifTrue:[ |
|
2237 |
"/ realSel add:item |
|
2238 |
"/ ] |
|
2239 |
"/ ]. |
|
2240 |
realSel := list select:[:item | (item fileName) startsWith:firtsPre]. |
|
2241 |
stringRealSel := realSel collect:[:item | item fileName]. |
|
2242 |
||
2243 |
self archiver |
|
2244 |
outStream:nil |
|
2245 |
errorStream:(self getErrorStream) |
|
2246 |
synchron:true. |
|
2247 |
self |
|
2248 |
makeProcessFor:[ self archiver removeFilesFromArchive:stringCol ] |
|
2249 |
with:'Remove files'. |
|
4462
b14fcc67ff8e
removeAll: changed to removeAllFoundIn:
Michael Beyl <mb@exept.de>
parents:
4417
diff
changeset
|
2250 |
self archiveFileList value removeAllFoundIn:realSel |
3892 | 2251 |
! ! |
2252 |
||
2253 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'drag & drop'! |
|
2254 |
||
3951 | 2255 |
canDrop:aContext |
2256 |
||
2257 |
^ inDropMode |
|
3892 | 2258 |
! |
2259 |
||
4803 | 2260 |
doDrop:aContext |
3892 | 2261 |
|col source arg objects| |
2262 |
||
2263 |
source := aContext dropSource. |
|
2264 |
arg := source argument. |
|
2265 |
objects := aContext dropObjects. |
|
4803 | 2266 |
col := objects collect:[:dropObject | dropObject theObject]. |
2267 |
^ self addFilesToArchive:col |
|
3892 | 2268 |
! |
2269 |
||
2270 |
doStartDrag:aDropSource in:aView |
|
2271 |
"set the cursors before starting the drag & drop operation |
|
2272 |
" |
|
2273 |
|hdl sel| |
|
2274 |
||
4018 | 2275 |
archiver class canDragnDrop ifFalse:[^ self]. |
3892 | 2276 |
sel := self selectionHolder value. |
2277 |
||
2278 |
hdl := DragAndDropManager new. |
|
2279 |
||
4336
b4228ddf2183
change level of buttons bfor notebook applications and remove directory for label of terminal app
penk
parents:
4293
diff
changeset
|
2280 |
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
|
2281 |
hdl enabledCursor:AbstractFileBrowser enabledCursorImage. |
3892 | 2282 |
hdl alienCursor:nil. |
2283 |
||
2284 |
hdl startDragFrom:aView dropSource:aDropSource offset:#topLeft |
|
2285 |
! |
|
2286 |
||
3951 | 2287 |
dropEnter:aContext |
2288 |
||
2289 |
| dropedObjects| |
|
2290 |
||
2291 |
inDropMode := false. |
|
2292 |
(aContext dropSource receiver == self) ifTrue:[^ self]. |
|
2293 |
dropedObjects := aContext dropObjects. |
|
2294 |
||
2295 |
||
2296 |
dropedObjects do:[:aObject| |checkObject checkObjectString| |
|
2297 |
aObject isFileObject ifFalse:[^ self]. |
|
2298 |
checkObject := aObject theObject. |
|
2299 |
checkObject isFilename not ifTrue:[^ self]. |
|
2300 |
checkObject isSpecialFile ifTrue:[^ self]. |
|
2301 |
]. |
|
2302 |
inDropMode := true. |
|
2303 |
! |
|
2304 |
||
2305 |
dropLeave:aContext |
|
2306 |
||
2307 |
inDropMode := false. |
|
2308 |
! |
|
2309 |
||
3892 | 2310 |
getDisplayObjects:anArgument |
2311 |
||
2312 |
| sel string size fnName stream| |
|
2313 |
sel := self selectionHolder value. |
|
2314 |
size := sel size. |
|
2315 |
size == 0 ifTrue:[^ '']. |
|
2316 |
stream := WriteStream on:''. |
|
2317 |
stream nextPutAll:(sel first fileName asFilename baseName asString). |
|
2318 |
size == 1 ifTrue:[ |
|
2319 |
fnName := 'ui_menuitem.xpm'. |
|
2320 |
] ifFalse:[ |
|
2321 |
fnName := 'ui_submenu_open.xpm'. |
|
2322 |
stream nextPutAll:' ... '. |
|
2323 |
stream nextPutAll:(sel last fileName asFilename baseName asString). |
|
2324 |
]. |
|
2325 |
string := stream contents. |
|
2326 |
stream close. |
|
2327 |
^ Array with:(LabelAndIcon icon:(Image fromFile:fnName) |
|
2328 |
string:(Text string:string emphasis:#bold) |
|
2329 |
) |
|
2330 |
! |
|
2331 |
||
2332 |
getDropObjects:anArgument |
|
2333 |
||
2334 |
| sel ret| |
|
2335 |
sel := self selectionHolder value. |
|
2336 |
ret := sel collect:[:el| |
|
4964 | 2337 |
DropObject newFileInArchive:(el fileName asFilename) |
3892 | 2338 |
]. |
2339 |
^ ret |
|
2340 |
! ! |
|
2341 |
||
2342 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'event handling'! |
|
2343 |
||
4803 | 2344 |
processEvent:anEvent |
3892 | 2345 |
"filter keyboard events. |
2346 |
Return true, if I have eaten the event" |
|
2347 |
||
2348 |
|focusView key rawKey| |
|
2349 |
||
2350 |
anEvent isKeyPressEvent ifTrue:[ |
|
2351 |
focusView := anEvent targetView. |
|
2352 |
key := anEvent key. |
|
2353 |
rawKey := anEvent rawKey. |
|
2354 |
(focusView isSameOrComponentOf:self window) ifTrue:[ |
|
2355 |
(key == #Delete) ifTrue:[ |
|
4803 | 2356 |
self removeFilesFromArchive. |
3892 | 2357 |
^ true |
4803 | 2358 |
] |
3892 | 2359 |
] |
2360 |
]. |
|
2361 |
^ false |
|
2362 |
! ! |
|
2363 |
||
2364 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'initialization & release'! |
|
2365 |
||
2366 |
postBuildFileTable:aWidget |
|
2367 |
||
2368 |
fileTable := aWidget scrolledView. |
|
2369 |
fileTable wantsFocusWithPointerEnter. |
|
2370 |
"/ FileBrowser icons keysAndValuesDo:[:aKey :anIcon| |
|
2371 |
"/ fileTable registerImage:anIcon key:aKey. |
|
2372 |
"/ ]. |
|
2373 |
self columnDescriptors:(self class tableColumns). |
|
2374 |
! |
|
2375 |
||
4803 | 2376 |
postOpenWith:aBuilder |
2377 |
|currentDir contents suffix fileName file archivItem| |
|
3892 | 2378 |
|
2379 |
self windowGroup addPreEventHook:self. |
|
2380 |
self masterApplication isNil ifTrue:[ |
|
2381 |
self masterApplication:nil. |
|
2382 |
currentDir := Filename homeDirectory. |
|
2383 |
contents := currentDir directoryContents. |
|
4803 | 2384 |
fileName := contents |
2385 |
detect:[:file | |
|
2386 |
suffix := file asFilename suffix asLowercase. |
|
2387 |
suffix = 'tgz' |
|
2388 |
] |
|
2389 |
ifNone:[nil]. |
|
2390 |
fileName isNil ifTrue:[ |
|
2391 |
Dialog warn:'cant find a Zip file in ' , currentDir asString. |
|
3892 | 2392 |
^ self |
2393 |
]. |
|
2394 |
file := currentDir construct:fileName. |
|
3982 | 2395 |
archivItem := DirectoryContentsBrowser itemClass fileName:file. |
3892 | 2396 |
(self item:archivItem) ifFalse:[ |
4803 | 2397 |
Dialog warn:'file type of ' , item fileName asString , ' not supported'. |
2398 |
^ self |
|
2399 |
] |
|
3892 | 2400 |
]. |
4905 | 2401 |
self listAllFiles. |
4803 | 2402 |
^ super postOpenWith:aBuilder |
3892 | 2403 |
! |
2404 |
||
2405 |
release |
|
2406 |
self archiver release. |
|
2407 |
^ super release. |
|
2408 |
! ! |
|
2409 |
||
2410 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'queries'! |
|
2411 |
||
2412 |
canDelete |
|
2413 |
||
2414 |
^ (self hasOneSelectionInList and:[archiver class canRemoveFiles]) |
|
2415 |
! |
|
2416 |
||
4001 | 2417 |
canViewFile |
2418 |
||
2419 |
^ self archiver class canViewFile and:[self hasOneSelectionInList] |
|
2420 |
! |
|
2421 |
||
2422 |
hasListEntriesHolder |
|
2423 |
"return/create the 'hasListEntriesHolder' value holder (automatically generated)" |
|
2424 |
||
2425 |
hasListEntriesHolder isNil ifTrue:[ |
|
2426 |
hasListEntriesHolder := false asValue. |
|
2427 |
]. |
|
2428 |
^ hasListEntriesHolder |
|
2429 |
! |
|
2430 |
||
2431 |
hasOneSelectionInList |
|
2432 |
||
2433 |
| sel | |
|
2434 |
sel := self selectionHolder value. |
|
2435 |
^ (sel notNil and:[sel notEmpty and:[sel size = 1]]) |
|
2436 |
! |
|
2437 |
||
3892 | 2438 |
selRemoveFilesForDirs:aSel |
2439 |
||
2440 |
|stringCol newSel string| |
|
2441 |
||
2442 |
stringCol := (aSel collect:[: item| item fileName]). |
|
2443 |
newSel := aSel copy. |
|
2444 |
aSel do:[:item | |
|
2445 |
item isDirectory ifTrue:[ |
|
2446 |
string := item fileName. |
|
2447 |
stringCol doWithIndex:[:filename : index| |
|
2448 |
(filename ~= string and:[filename startsWith:string]) ifTrue:[ |
|
2449 |
newSel remove:(aSel at:index) ifAbsent:[nil]. |
|
2450 |
] |
|
2451 |
] |
|
2452 |
]. |
|
2453 |
]. |
|
2454 |
^ newSel. |
|
2455 |
! ! |
|
2456 |
||
2457 |
!FileApplicationNoteBook::ArchiveViewApplication methodsFor:'sorting'! |
|
2458 |
||
2459 |
generateSortBlock:instanceName |
|
2460 |
||
2461 |
| aSymbol cmpOp sortCaselessLocal| |
|
2462 |
||
2463 |
aSymbol := instanceName asSymbol. |
|
2464 |
sortCaselessLocal := self sortCaseless value. |
|
2465 |
currentSortOrder isNil ifTrue:[ |
|
2466 |
currentSortOrder := aSymbol. |
|
2467 |
currentSortOrder := Dictionary new. |
|
2468 |
currentSortOrder at:#column put:aSymbol. |
|
2469 |
currentSortOrder at:#reverse put:false. |
|
2470 |
currentSortOrder at:#sortCaseless put:sortCaselessLocal. |
|
2471 |
] ifFalse:[ |
|
2472 |
(currentSortOrder at:#column) = aSymbol ifTrue:[ |
|
2473 |
"/ same column like before - change sort order |
|
2474 |
| isReverse | |
|
2475 |
isReverse := currentSortOrder at:#reverse. |
|
2476 |
currentSortOrder at:#reverse put:(isReverse not). |
|
2477 |
] ifFalse:[ |
|
2478 |
"/ another column - remark column |
|
2479 |
currentSortOrder at:#column put:aSymbol. |
|
2480 |
] |
|
2481 |
]. |
|
2482 |
(currentSortOrder at:#reverse) ifTrue:[ |
|
2483 |
cmpOp := #'>' |
|
2484 |
] ifFalse:[ |
|
2485 |
cmpOp := #'<' |
|
2486 |
]. |
|
2487 |
^ [:a :b | |
|
2488 |
|entry1 entry2| |
|
2489 |
||
2490 |
entry1 := (a perform:aSymbol). |
|
2491 |
entry2 := (b perform:aSymbol). |
|
2492 |
aSymbol = #fileName ifTrue:[ |
|
2493 |
sortCaselessLocal ifTrue:[ |
|
2494 |
entry1 := entry1 asString asLowercase. |
|
2495 |
entry2 := entry2 asString asLowercase. |
|
2496 |
] ifFalse:[ |
|
2497 |
entry1 := entry1 asString. |
|
2498 |
entry2 := entry2 asString. |
|
2499 |
]. |
|
2500 |
]. |
|
2501 |
entry1 perform:cmpOp with:entry2 |
|
2502 |
]. |
|
2503 |
! |
|
2504 |
||
2505 |
sortList:instanceName |
|
2506 |
||
2507 |
||
2508 |
|sortBlock fileList sortCol| |
|
2509 |
||
2510 |
sortBlock := self generateSortBlock:instanceName. |
|
2511 |
fileList := self archiveFileList value. |
|
2512 |
sortCol := SortedCollection sortBlock:sortBlock. |
|
2513 |
sortCol addAll:fileList. |
|
2514 |
fileList removeAll. |
|
2515 |
fileList addAll:sortCol. |
|
2516 |
! ! |
|
2517 |
||
2518 |
!FileApplicationNoteBook::ArchiveViewApplication::ArchivItem methodsFor:'accessing'! |
|
2519 |
||
2520 |
compressSize |
|
2521 |
"return the value of the instance variable 'compressSize' (automatically generated)" |
|
2522 |
||
2523 |
^ compressSize |
|
2524 |
! |
|
2525 |
||
2526 |
compressSize:something |
|
2527 |
"set the value of the instance variable 'compressSize' (automatically generated)" |
|
2528 |
||
2529 |
compressSize := something. |
|
2530 |
! |
|
2531 |
||
2532 |
crc |
|
2533 |
"return the value of the instance variable 'crc' (automatically generated)" |
|
2534 |
||
2535 |
^ crc |
|
2536 |
! |
|
2537 |
||
2538 |
crc:something |
|
2539 |
"set the value of the instance variable 'crc' (automatically generated)" |
|
2540 |
||
2541 |
crc := something. |
|
2542 |
! |
|
2543 |
||
2544 |
dateAndTime |
|
2545 |
"return the value of the instance variable 'dateAndTime' (automatically generated)" |
|
2546 |
||
2547 |
^ dateAndTime |
|
2548 |
! |
|
2549 |
||
2550 |
dateAndTime:something |
|
2551 |
"set the value of the instance variable 'dateAndTime' (automatically generated)" |
|
2552 |
||
2553 |
dateAndTime := something. |
|
2554 |
! |
|
2555 |
||
5414 | 2556 |
day:day |
2557 |
|ts month year hour minutes seconds| |
|
2558 |
||
2559 |
dateAndTime isNil ifTrue:[ |
|
2560 |
ts := AbsoluteTime now. |
|
2561 |
] ifFalse:[ |
|
2562 |
ts := dateAndTime |
|
2563 |
]. |
|
2564 |
month := ts month. |
|
2565 |
year := ts year. |
|
2566 |
hour := ts hour. |
|
2567 |
minutes := ts minutes. |
|
2568 |
seconds := ts seconds. |
|
2569 |
||
2570 |
dateAndTime := AbsoluteTime |
|
2571 |
day:day |
|
2572 |
month:month |
|
2573 |
year:year |
|
2574 |
hour:hour |
|
2575 |
minutes:minutes |
|
2576 |
seconds:seconds |
|
2577 |
! |
|
2578 |
||
2579 |
dayString:dayString |
|
2580 |
self day:(Integer readFrom:dayString) |
|
2581 |
! |
|
2582 |
||
3892 | 2583 |
fileName |
2584 |
"return the value of the instance variable 'fileName' (automatically generated)" |
|
2585 |
||
2586 |
^ fileName |
|
2587 |
! |
|
2588 |
||
2589 |
fileName:something |
|
2590 |
"set the value of the instance variable 'fileName' (automatically generated)" |
|
2591 |
||
2592 |
fileName := something withoutSpaces. |
|
2593 |
! |
|
2594 |
||
2595 |
icon |
|
2596 |
"return the value of the instance variable 'icon' (automatically generated)" |
|
2597 |
||
2598 |
^ icon |
|
2599 |
! |
|
2600 |
||
2601 |
icon:something |
|
2602 |
"set the value of the instance variable 'icon' (automatically generated)" |
|
2603 |
||
2604 |
icon := something. |
|
2605 |
! |
|
2606 |
||
2607 |
isDirectory |
|
2608 |
"return the value of the instance variable 'directory' (automatically generated)" |
|
2609 |
||
2610 |
^ isDirectory |
|
2611 |
! |
|
2612 |
||
2613 |
isDirectory:something |
|
2614 |
"set the value of the instance variable 'isDirectory' (automatically generated)" |
|
2615 |
||
2616 |
isDirectory := something. |
|
2617 |
! |
|
2618 |
||
2619 |
method |
|
2620 |
"return the value of the instance variable 'method' (automatically generated)" |
|
2621 |
||
2622 |
^ method |
|
2623 |
! |
|
2624 |
||
2625 |
method:something |
|
2626 |
"set the value of the instance variable 'method' (automatically generated)" |
|
2627 |
||
2628 |
method := something. |
|
2629 |
! |
|
2630 |
||
5414 | 2631 |
month:month |
2632 |
|ts day year hour minutes seconds| |
|
2633 |
||
2634 |
dateAndTime isNil ifTrue:[ |
|
2635 |
ts := AbsoluteTime now. |
|
2636 |
] ifFalse:[ |
|
2637 |
ts := dateAndTime |
|
2638 |
]. |
|
2639 |
day := ts day. |
|
2640 |
year := ts year. |
|
2641 |
hour := ts hour. |
|
2642 |
minutes := ts minutes. |
|
2643 |
seconds := ts seconds. |
|
2644 |
||
2645 |
dateAndTime := AbsoluteTime |
|
2646 |
day:day |
|
2647 |
month:month |
|
2648 |
year:year |
|
2649 |
hour:hour |
|
2650 |
minutes:minutes |
|
2651 |
seconds:seconds |
|
2652 |
! |
|
2653 |
||
2654 |
monthName:monthName |
|
2655 |
self month:(Date indexOfMonth:monthName) |
|
2656 |
! |
|
2657 |
||
3892 | 2658 |
ownerGroup |
2659 |
"return the value of the instance variable 'owner' (automatically generated)" |
|
2660 |
||
2661 |
^ ownerGroup |
|
2662 |
! |
|
2663 |
||
2664 |
ownerGroup:something |
|
2665 |
"set the value of the instance variable 'owner' (automatically generated)" |
|
2666 |
||
2667 |
ownerGroup := something. |
|
2668 |
! |
|
2669 |
||
2670 |
permissions |
|
2671 |
"return the value of the instance variable 'permissions' (automatically generated)" |
|
2672 |
||
2673 |
^ permissions |
|
2674 |
! |
|
2675 |
||
2676 |
permissions:something |
|
2677 |
"set the value of the instance variable 'permissions' (automatically generated)" |
|
2678 |
||
2679 |
permissions := something. |
|
2680 |
! |
|
2681 |
||
2682 |
ratio |
|
2683 |
"return the value of the instance variable 'ratio' (automatically generated)" |
|
2684 |
||
2685 |
^ ratio |
|
2686 |
! |
|
2687 |
||
2688 |
ratio:something |
|
2689 |
"set the value of the instance variable 'ratio' (automatically generated)" |
|
2690 |
||
2691 |
ratio := something. |
|
2692 |
! |
|
2693 |
||
2694 |
size |
|
2695 |
"return the value of the instance variable 'size' (automatically generated)" |
|
2696 |
||
2697 |
^ size |
|
2698 |
! |
|
2699 |
||
2700 |
size:something |
|
2701 |
"set the value of the instance variable 'size' (automatically generated)" |
|
2702 |
||
2703 |
size := something. |
|
2704 |
! |
|
2705 |
||
2706 |
sizeAsNumber |
|
2707 |
"return the value of the instance variable 'size' (automatically generated)" |
|
2708 |
||
2709 |
^ size asInteger |
|
2710 |
! |
|
2711 |
||
5414 | 2712 |
time:time |
2713 |
|ts day month year| |
|
2714 |
||
2715 |
dateAndTime isNil ifTrue:[ |
|
2716 |
ts := AbsoluteTime now. |
|
2717 |
] ifFalse:[ |
|
2718 |
ts := dateAndTime |
|
2719 |
]. |
|
2720 |
day := ts day. |
|
2721 |
month := ts month. |
|
2722 |
year := ts year. |
|
2723 |
||
2724 |
dateAndTime := AbsoluteTime |
|
2725 |
day:day |
|
2726 |
month:month |
|
2727 |
year:year |
|
2728 |
hour:time hours |
|
2729 |
minutes:time minutes |
|
2730 |
seconds:time seconds |
|
2731 |
! |
|
2732 |
||
2733 |
timeString:timeString |
|
2734 |
self time:(Time readFrom:timeString) |
|
2735 |
! |
|
2736 |
||
3892 | 2737 |
type |
2738 |
"return the value of the instance variable 'type' (automatically generated)" |
|
2739 |
||
2740 |
^ type |
|
2741 |
! |
|
2742 |
||
2743 |
type:something |
|
2744 |
"set the value of the instance variable 'type' (automatically generated)" |
|
2745 |
||
2746 |
type := something. |
|
2747 |
! |
|
2748 |
||
2749 |
version |
|
2750 |
"return the value of the instance variable 'version' (automatically generated)" |
|
2751 |
||
2752 |
^ version |
|
2753 |
! |
|
2754 |
||
2755 |
version:something |
|
2756 |
"set the value of the instance variable 'version' (automatically generated)" |
|
2757 |
||
2758 |
version := something. |
|
5414 | 2759 |
! |
2760 |
||
2761 |
year:year |
|
2762 |
|ts day month hour minutes seconds| |
|
2763 |
||
2764 |
dateAndTime isNil ifTrue:[ |
|
2765 |
ts := AbsoluteTime now. |
|
2766 |
] ifFalse:[ |
|
2767 |
ts := dateAndTime |
|
2768 |
]. |
|
2769 |
day := ts day. |
|
2770 |
month := ts month. |
|
2771 |
hour := ts hour. |
|
2772 |
minutes := ts minutes. |
|
2773 |
seconds := ts seconds. |
|
2774 |
||
2775 |
dateAndTime := AbsoluteTime |
|
2776 |
day:day |
|
2777 |
month:month |
|
2778 |
year:year |
|
2779 |
hour:hour |
|
2780 |
minutes:minutes |
|
2781 |
seconds:seconds |
|
2782 |
! |
|
2783 |
||
2784 |
yearString:yearString |
|
2785 |
self year:(Integer readFrom:yearString) |
|
3892 | 2786 |
! ! |
2787 |
||
2788 |
!FileApplicationNoteBook::ArchiveViewApplication::ArchivItem methodsFor:'printing'! |
|
2789 |
||
2790 |
printString |
|
2791 |
||
2792 |
^ self fileName asString |
|
2793 |
! ! |
|
2794 |
||
2795 |
!FileApplicationNoteBook::ArchiveViewApplication::ArchivItem methodsFor:'queries'! |
|
2796 |
||
2797 |
hasDirectoryPart |
|
2798 |
||
2799 |
^ self fileName asFilename components size ~= 1 |
|
2800 |
! ! |
|
2801 |
||
2802 |
!FileApplicationNoteBook::CommandResult class methodsFor:'defaults'! |
|
2803 |
||
2804 |
tabStringFor:aApplicationType |
|
2805 |
||
2806 |
^ 'Execution result' |
|
2807 |
! |
|
2808 |
||
2809 |
wantNewApplicationAnyway |
|
2810 |
||
2811 |
^ false |
|
2812 |
! ! |
|
2813 |
||
2814 |
!FileApplicationNoteBook::CommandResult class methodsFor:'interface specs'! |
|
2815 |
||
2816 |
windowSpec |
|
2817 |
"This resource specification was automatically generated |
|
2818 |
by the UIPainter of ST/X." |
|
2819 |
||
2820 |
"Do not manually edit this!! If it is corrupted, |
|
2821 |
the UIPainter may not be able to read the specification." |
|
2822 |
||
2823 |
" |
|
4169 | 2824 |
UIPainter new openOnClass:FileApplicationNoteBook::CommandResult andSelector:#windowSpec |
2825 |
FileApplicationNoteBook::CommandResult new openInterface:#windowSpec |
|
2826 |
FileApplicationNoteBook::CommandResult open |
|
3892 | 2827 |
" |
2828 |
||
2829 |
<resource: #canvas> |
|
2830 |
||
2831 |
^ |
|
2832 |
#(#FullSpec |
|
2833 |
#name: #windowSpec |
|
2834 |
#window: |
|
2835 |
#(#WindowSpec |
|
2836 |
#label: 'NoteBookApplication::CommandResult' |
|
2837 |
#name: 'NoteBookApplication::CommandResult' |
|
2838 |
#min: #(#Point 10 10) |
|
2839 |
#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
|
2840 |
#bounds: #(#Rectangle 220 193 723 546) |
3892 | 2841 |
#menu: #mainMenu |
2842 |
) |
|
2843 |
#component: |
|
2844 |
#(#SpecCollection |
|
2845 |
#collection: #( |
|
2846 |
#(#MenuPanelSpec |
|
2847 |
#name: 'ToolBar1' |
|
2848 |
#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
|
2849 |
#level: 0 |
3892 | 2850 |
#menu: #menu |
2851 |
#textDefault: true |
|
2852 |
) |
|
2853 |
#(#ArbitraryComponentSpec |
|
2854 |
#name: 'ArbitraryComponent1' |
|
2855 |
#layout: #(#LayoutFrame 0 0.0 32 0 0 1.0 0 1) |
|
2856 |
#hasHorizontalScrollBar: true |
|
2857 |
#hasVerticalScrollBar: true |
|
2858 |
#hasBorder: false |
|
2859 |
#component: #TextCollector |
|
2860 |
#postBuildCallback: #postBuildTextCollector: |
|
2861 |
) |
|
4169 | 2862 |
#(#ProgressIndicatorSpec |
2863 |
#name: 'ProgressIndicator1' |
|
2864 |
#layout: #(#LayoutFrame 125 0 11 0 231 0 21 0) |
|
4180 | 2865 |
#visibilityChannel: #enableStopButton |
4169 | 2866 |
#backgroundColor: #(#Color 0.0 66.9993 66.9993) |
2867 |
#showPercentage: false |
|
2868 |
#isActivityIndicator: true |
|
3892 | 2869 |
) |
2870 |
) |
|
2871 |
||
2872 |
) |
|
2873 |
) |
|
2874 |
! ! |
|
2875 |
||
2876 |
!FileApplicationNoteBook::CommandResult class methodsFor:'menu specs'! |
|
2877 |
||
2878 |
menu |
|
2879 |
"This resource specification was automatically generated |
|
2880 |
by the MenuEditor of ST/X." |
|
2881 |
||
2882 |
"Do not manually edit this!! If it is corrupted, |
|
2883 |
the MenuEditor may not be able to read the specification." |
|
2884 |
||
2885 |
" |
|
2886 |
MenuEditor new openOnClass:FileApplicationNoteBook::CommandResult andSelector:#menu |
|
2887 |
(Menu new fromLiteralArrayEncoding:(FileApplicationNoteBook::CommandResult menu)) startUp |
|
2888 |
" |
|
2889 |
||
2890 |
<resource: #menu> |
|
2891 |
||
2892 |
^ |
|
2893 |
#(#Menu |
|
2894 |
#( |
|
2895 |
#(#MenuItem |
|
2896 |
#label: 'Stop' |
|
2897 |
#translateLabel: true |
|
2898 |
#isButton: true |
|
2899 |
#nameKey: #Stop |
|
2900 |
#value: #doStopProcess |
|
2901 |
#enabled: #enableStopButton |
|
2902 |
#labelImage: #(#ResourceRetriever #ToolbarIconLibrary #stop22x22Icon 'Stop') |
|
2903 |
) |
|
2904 |
#(#MenuItem |
|
2905 |
#label: 'Close' |
|
2906 |
#translateLabel: true |
|
2907 |
#isButton: true |
|
2908 |
#nameKey: #Close |
|
2909 |
#isVisible: #isEmbeddedApplication |
|
2910 |
#startGroup: #right |
|
2911 |
#value: #doClose |
|
2912 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #closeIcon) |
|
2913 |
) |
|
2914 |
) |
|
2915 |
nil |
|
2916 |
nil |
|
2917 |
) |
|
2918 |
! ! |
|
2919 |
||
2920 |
!FileApplicationNoteBook::CommandResult methodsFor:'accessing'! |
|
2921 |
||
2922 |
resultStream |
|
2923 |
"return the value of the instance variable 'resultStream' (automatically generated)" |
|
2924 |
||
2925 |
^ resultStream |
|
2926 |
! |
|
2927 |
||
2928 |
resultStream:something |
|
2929 |
"set the value of the instance variable 'resultStream' (automatically generated)" |
|
2930 |
||
2931 |
resultStream := something. |
|
2932 |
! ! |
|
2933 |
||
2934 |
!FileApplicationNoteBook::CommandResult methodsFor:'actions'! |
|
2935 |
||
2936 |
changeTabTo:aString |
|
2937 |
||
2938 |
| masterApplication | |
|
2939 |
||
2940 |
masterApplication := self masterApplication. |
|
2941 |
masterApplication isNil ifFalse:[ |
|
2942 |
masterApplication tabStringChangeTo:aString for:self. |
|
2943 |
]. |
|
2944 |
! |
|
2945 |
||
2946 |
doStopProcess |
|
2947 |
||
2948 |
| myProcess | |
|
2949 |
||
2950 |
myProcess := self process value. |
|
2951 |
myProcess notNil ifTrue:[ |
|
4523 | 2952 |
self notify:('kill ', myProcess name). |
3892 | 2953 |
myProcess terminate. |
2954 |
]. |
|
2955 |
! ! |
|
2956 |
||
2957 |
!FileApplicationNoteBook::CommandResult methodsFor:'aspects'! |
|
2958 |
||
2959 |
enableStopButton |
|
2960 |
||
2961 |
enableStopButton isNil ifTrue:[ |
|
2962 |
enableStopButton := false asValue. |
|
2963 |
]. |
|
2964 |
^ enableStopButton |
|
2965 |
! |
|
2966 |
||
2967 |
process |
|
2968 |
"return/create the 'process' value holder (automatically generated)" |
|
2969 |
||
2970 |
process isNil ifTrue:[ |
|
2971 |
process := ValueHolder new. |
|
2972 |
process addDependent:self. |
|
2973 |
]. |
|
2974 |
^ process |
|
2975 |
! ! |
|
2976 |
||
2977 |
!FileApplicationNoteBook::CommandResult methodsFor:'change & update'! |
|
2978 |
||
2979 |
update:something with:aParameter from:changedObject |
|
2980 |
"Invoked when an object that I depend upon sends a change notification." |
|
2981 |
||
2982 |
"stub code automatically generated - please change as required" |
|
2983 |
||
2984 |
changedObject == self process ifTrue:[ |
|
2985 |
self enableStopButton value:changedObject value notNil. |
|
2986 |
^ self |
|
2987 |
]. |
|
2988 |
super update:something with:aParameter from:changedObject |
|
2989 |
! ! |
|
2990 |
||
2991 |
!FileApplicationNoteBook::CommandResult methodsFor:'initialization & release'! |
|
2992 |
||
2993 |
postBuildTextCollector:aBuilder |
|
2994 |
||
2995 |
self resultStream:aBuilder scrolledView. |
|
2996 |
! |
|
2997 |
||
2998 |
postBuildWith:aBuilder |
|
2999 |
"This is a hook method generated by the Browser. |
|
3000 |
It will be invoked during the initialization of your app/dialog, |
|
3001 |
after all of the visual components have been built, |
|
3002 |
but BEFORE the top window is made visible. |
|
3003 |
Add any app-specific actions here (reading files, setting up values etc.) |
|
3004 |
See also #postOpenWith:, which is invoked after opening." |
|
3005 |
||
3006 |
"/ add any code here ... |
|
3007 |
||
3008 |
^ super postBuildWith:aBuilder |
|
3009 |
! |
|
3010 |
||
3011 |
postOpenWith:aBuilder |
|
3012 |
"This is a hook method generated by the Browser. |
|
3013 |
It will be invoked right after the applications window has been opened. |
|
3014 |
Add any app-specific actions here (starting background processes etc.). |
|
3015 |
See also #postBuildWith:, which is invoked before opening." |
|
3016 |
||
3017 |
"/ add any code here ... |
|
3018 |
||
3019 |
self masterApplication isNil ifTrue:[ |
|
3020 |
self masterApplication:nil. |
|
3021 |
]. |
|
3022 |
^ super postOpenWith:aBuilder |
|
3023 |
! |
|
3024 |
||
3025 |
release |
|
3026 |
||
3027 |
self doStopProcess. |
|
3028 |
^ super release |
|
3029 |
! ! |
|
3030 |
||
3031 |
!FileApplicationNoteBook::CommandResult methodsFor:'printing'! |
|
3032 |
||
3033 |
printString |
|
3034 |
||
3035 |
^ 'CommandResult Application' |
|
3036 |
! ! |
|
3037 |
||
3038 |
!FileApplicationNoteBook::HtmlViewApplication class methodsFor:'defaults'! |
|
3039 |
||
3040 |
tabStringFor:aApplicationType |
|
3041 |
||
3042 |
^ 'HTML View for:' |
|
3043 |
! ! |
|
3044 |
||
5406 | 3045 |
!FileApplicationNoteBook::HtmlViewApplication class methodsFor:'help specs'! |
3046 |
||
3047 |
helpSpec |
|
3048 |
"This resource specification was automatically generated |
|
3049 |
by the UIHelpTool of ST/X." |
|
3050 |
||
3051 |
"Do not manually edit this!! If it is corrupted, |
|
3052 |
the UIHelpTool may not be able to read the specification." |
|
3053 |
||
3054 |
" |
|
3055 |
UIHelpTool openOnClass:FileApplicationNoteBook::HtmlViewApplication |
|
3056 |
" |
|
3057 |
||
3058 |
<resource: #help> |
|
3059 |
||
3060 |
^ super helpSpec addPairsFrom:#( |
|
3061 |
||
3062 |
#'Edit Source' |
|
3063 |
'' |
|
3064 |
||
3065 |
) |
|
3066 |
! ! |
|
3067 |
||
3892 | 3068 |
!FileApplicationNoteBook::HtmlViewApplication class methodsFor:'interface specs'! |
3069 |
||
3070 |
windowSpec |
|
3071 |
"This resource specification was automatically generated |
|
3072 |
by the UIPainter of ST/X." |
|
3073 |
||
3074 |
"Do not manually edit this!! If it is corrupted, |
|
3075 |
the UIPainter may not be able to read the specification." |
|
3076 |
||
3077 |
" |
|
4336
b4228ddf2183
change level of buttons bfor notebook applications and remove directory for label of terminal app
penk
parents:
4293
diff
changeset
|
3078 |
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
|
3079 |
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
|
3080 |
FileApplicationNoteBook::HtmlViewApplication open |
3892 | 3081 |
" |
3082 |
||
3083 |
<resource: #canvas> |
|
3084 |
||
3085 |
^ |
|
3086 |
#(#FullSpec |
|
3087 |
#name: #windowSpec |
|
3088 |
#window: |
|
3089 |
#(#WindowSpec |
|
3090 |
#label: 'NoteBookApplication::HtmlView' |
|
3091 |
#name: 'NoteBookApplication::HtmlView' |
|
3092 |
#min: #(#Point 10 10) |
|
3093 |
#max: #(#Point 1024 768) |
|
3094 |
#bounds: #(#Rectangle 16 42 692 534) |
|
3095 |
#menu: #mainMenu |
|
3096 |
) |
|
3097 |
#component: |
|
3098 |
#(#SpecCollection |
|
3099 |
#collection: #( |
|
3100 |
#(#MenuPanelSpec |
|
3101 |
#name: 'MenuHtml' |
|
3102 |
#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
|
3103 |
#level: 0 |
3892 | 3104 |
#visibilityChannel: #isEmbeddedApplication |
3105 |
#menu: #menu |
|
3106 |
#textDefault: true |
|
3107 |
) |
|
3108 |
#(#ArbitraryComponentSpec |
|
3109 |
#name: 'HTMLView' |
|
3110 |
#layout: #(#LayoutFrame 0 0.0 32 0.0 0 1.0 0 1) |
|
3111 |
#hasHorizontalScrollBar: true |
|
3112 |
#hasVerticalScrollBar: true |
|
3113 |
#miniScrollerHorizontal: false |
|
3114 |
#miniScrollerVertical: false |
|
3115 |
#hasBorder: false |
|
3116 |
#component: #HTMLDocumentView |
|
3117 |
#postBuildCallback: #postBuildHtmlView: |
|
3118 |
) |
|
3119 |
#(#LabelSpec |
|
3120 |
#label: 'FileLabel' |
|
3121 |
#name: 'FileLabel' |
|
3122 |
#layout: #(#LayoutFrame 212 0 2 0 -73 1 30 0) |
|
3123 |
#level: -1 |
|
3124 |
#translateLabel: true |
|
3125 |
#labelChannel: #labelHolder |
|
3126 |
#adjust: #left |
|
3127 |
) |
|
3128 |
) |
|
3129 |
||
3130 |
) |
|
3131 |
) |
|
3132 |
! ! |
|
3133 |
||
3134 |
!FileApplicationNoteBook::HtmlViewApplication class methodsFor:'menu specs'! |
|
3135 |
||
3136 |
menu |
|
3137 |
"This resource specification was automatically generated |
|
3138 |
by the MenuEditor of ST/X." |
|
3139 |
||
3140 |
"Do not manually edit this!! If it is corrupted, |
|
3141 |
the MenuEditor may not be able to read the specification." |
|
3142 |
||
3143 |
" |
|
3144 |
MenuEditor new openOnClass:FileApplicationNoteBook::HtmlViewApplication andSelector:#menu |
|
3145 |
(Menu new fromLiteralArrayEncoding:(FileApplicationNoteBook::HtmlViewApplication menu)) startUp |
|
3146 |
" |
|
3147 |
||
3148 |
<resource: #menu> |
|
3149 |
||
3150 |
^ |
|
5406 | 3151 |
#(Menu |
3152 |
( |
|
3153 |
(MenuItem |
|
3154 |
label: 'Reload' |
|
3155 |
itemValue: doReload |
|
3156 |
translateLabel: true |
|
3157 |
isButton: true |
|
3158 |
labelImage: (ResourceRetriever AbstractFileBrowser htmlReloadIcon) |
|
3892 | 3159 |
) |
5406 | 3160 |
(MenuItem |
3161 |
label: 'Back' |
|
3162 |
itemValue: doGoBack |
|
3163 |
translateLabel: true |
|
3164 |
isButton: true |
|
3165 |
labelImage: (ResourceRetriever Icon leftIcon) |
|
3892 | 3166 |
) |
5406 | 3167 |
(MenuItem |
3168 |
label: 'Print' |
|
3169 |
itemValue: doPrint |
|
3170 |
translateLabel: true |
|
3171 |
isButton: true |
|
3172 |
labelImage: (ResourceRetriever ToolbarIconLibrary printer22x22Icon) |
|
3892 | 3173 |
) |
5406 | 3174 |
(MenuItem |
3175 |
activeHelpKey: #'Edit Source' |
|
3176 |
label: 'Edit' |
|
3177 |
itemValue: doEdit |
|
3178 |
translateLabel: true |
|
3179 |
isButton: true |
|
3180 |
labelImage: (ResourceRetriever ToolbarIconLibrary edit20x20Icon) |
|
3181 |
) |
|
3182 |
(MenuItem |
|
3183 |
label: 'Close' |
|
3184 |
itemValue: doClose |
|
3185 |
translateLabel: true |
|
3186 |
isButton: true |
|
3187 |
startGroup: right |
|
3188 |
hideMenuOnActivated: false |
|
3189 |
labelImage: (ResourceRetriever AbstractFileBrowser closeIcon) |
|
3892 | 3190 |
) |
3191 |
) |
|
3192 |
nil |
|
3193 |
nil |
|
3194 |
) |
|
3195 |
! ! |
|
3196 |
||
3197 |
!FileApplicationNoteBook::HtmlViewApplication class methodsFor:'queries'! |
|
3198 |
||
5010 | 3199 |
canOpenItem:anItem |
3200 |
||
3201 |
^ (anItem hasMimeType and:[anItem mimeType isHtml]) |
|
3892 | 3202 |
! |
3203 |
||
3204 |
wantNewApplicationAnyway |
|
3205 |
||
3206 |
^ false |
|
3207 |
! ! |
|
3208 |
||
3209 |
!FileApplicationNoteBook::HtmlViewApplication methodsFor:'accessing'! |
|
3210 |
||
3211 |
htmlView |
|
3212 |
"return the value of the instance variable 'imageView' (automatically generated)" |
|
3213 |
||
3214 |
^ htmlView |
|
3215 |
! |
|
3216 |
||
3217 |
htmlView:something |
|
3218 |
"set the value of the instance variable 'imageView' (automatically generated)" |
|
3219 |
||
3220 |
htmlView := something. |
|
3221 |
! |
|
3222 |
||
5010 | 3223 |
item:anItem |
3892 | 3224 |
|
3225 |
|retVal| |
|
3226 |
||
5010 | 3227 |
self labelHolder value:anItem fileName asString. |
3228 |
retVal := super item:anItem. |
|
3892 | 3229 |
self setupHtmlView. |
3230 |
^ retVal |
|
3231 |
! ! |
|
3232 |
||
3233 |
!FileApplicationNoteBook::HtmlViewApplication methodsFor:'actions'! |
|
3234 |
||
5406 | 3235 |
doEdit |
3236 |
||
3237 |
self masterApplication openTextEditorOn:item. |
|
3238 |
! |
|
3239 |
||
3892 | 3240 |
doGoBack |
3241 |
||
3242 |
self htmlView menu_back. |
|
3243 |
! |
|
3244 |
||
3245 |
doGoHome |
|
3246 |
||
3247 |
self htmlView menu_home. |
|
3248 |
! |
|
3249 |
||
3250 |
doHelp |
|
3251 |
||
3252 |
self htmlView menu_help. |
|
3253 |
! |
|
3254 |
||
3255 |
doPrint |
|
3256 |
||
3257 |
self htmlView menu_print. |
|
3258 |
! |
|
3259 |
||
3260 |
doReload |
|
3261 |
||
3262 |
self htmlView menu_reload. |
|
3263 |
! |
|
3264 |
||
3265 |
setupHtmlView |
|
3266 |
||
3267 |
| html file directory| |
|
3268 |
||
3269 |
html := self htmlView. |
|
3270 |
html isNil ifTrue:[^ self]. |
|
3271 |
file := self fileName. |
|
3272 |
directory := file directoryName. |
|
3273 |
html homeDocument:(file asString). |
|
3274 |
html setTopDirectoryName:directory. |
|
3275 |
html uriHolder:self labelHolder. |
|
3276 |
html infoHolder:self notifyChannel. |
|
3277 |
html linkButtonPanel:nil. |
|
3278 |
^ html |
|
3279 |
! ! |
|
3280 |
||
3281 |
!FileApplicationNoteBook::HtmlViewApplication methodsFor:'aspects'! |
|
3282 |
||
3283 |
labelHolder |
|
3284 |
||
3285 |
labelHolder isNil ifTrue:[ |
|
3286 |
labelHolder := '' asValue. |
|
3287 |
]. |
|
3288 |
^ labelHolder. |
|
3289 |
! ! |
|
3290 |
||
3291 |
!FileApplicationNoteBook::HtmlViewApplication methodsFor:'initialization & release'! |
|
3292 |
||
3293 |
postBuildHtmlView:aWidget |
|
3294 |
||
3295 |
self htmlView: aWidget scrolledView. |
|
3296 |
self htmlView wantsFocusWithPointerEnter. |
|
3297 |
! |
|
3298 |
||
3299 |
postOpenWith:aBuilder |
|
3300 |
" |
|
3301 |
only invoked if the application not started from a master |
|
3302 |
" |
|
3303 |
||
3304 |
|currentDir contents suffix fileName| |
|
3305 |
||
3306 |
self masterApplication isNil ifTrue:[ |
|
3307 |
self masterApplication:nil. |
|
3308 |
currentDir := Filename homeDirectory. |
|
3309 |
||
3310 |
contents := currentDir directoryContents. |
|
3311 |
fileName := contents |
|
3312 |
detect:[:file | |
|
3313 |
suffix := file asFilename suffix asLowercase. |
|
3314 |
suffix = 'html' |
|
3315 |
] |
|
3316 |
ifNone:[nil]. |
|
3317 |
fileName isNil ifTrue:[ |
|
3318 |
Dialog warn:'cant find a HTML file in ' , currentDir asString. |
|
3319 |
^ self |
|
3320 |
]. |
|
4626 | 3321 |
self item:(DirectoryContentsBrowser itemClass fileName:('..', |
3322 |
Filename separator , |
|
3323 |
'..' , |
|
3324 |
Filename separator , |
|
3325 |
'doc', |
|
3326 |
Filename separator , |
|
3327 |
'online', |
|
3328 |
Filename separator , |
|
3329 |
'english', |
|
3330 |
Filename separator , |
|
3331 |
'TOP.html') asFilename asAbsoluteFilename). |
|
3892 | 3332 |
]. |
3333 |
self setupHtmlView. |
|
3334 |
^ super postOpenWith:aBuilder |
|
3335 |
! ! |
|
3336 |
||
3337 |
!FileApplicationNoteBook::ImageViewApplication class methodsFor:'defaults'! |
|
3338 |
||
3339 |
tabStringFor:aApplicationType |
|
3340 |
||
3341 |
^ 'Image for:' |
|
3342 |
! ! |
|
3343 |
||
3344 |
!FileApplicationNoteBook::ImageViewApplication class methodsFor:'image specs'! |
|
3345 |
||
3346 |
fitSize20x20Icon |
|
3347 |
"This resource specification was automatically generated |
|
3348 |
by the ImageEditor of ST/X." |
|
3349 |
||
3350 |
"Do not manually edit this!! If it is corrupted, |
|
3351 |
the ImageEditor may not be able to read the specification." |
|
3352 |
||
3353 |
" |
|
3354 |
self fitSize20x20Icon inspect |
|
3355 |
ImageEditor openOnClass:self andSelector:#fitSize20x20Icon |
|
3356 |
" |
|
3357 |
||
3358 |
<resource: #image> |
|
3359 |
||
3360 |
^Icon |
|
3361 |
constantNamed:#'FileApplicationNoteBook::ImageViewApplication class fitSize20x20Icon' |
|
3362 |
ifAbsentPut:[(Depth4Image new) width: 20; height: 20; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
3363 |
@@DQDQDQDQDP@@@PDQDQDQDQ@P@A@ADQDQDQDP@PD@@PDQDQDPD@@QDQ@ADQDQ@@DQDQD@@@@@@@@@DQDQDPQDQDQ@DQDQDQDDQUUTPADQDQDQAEUUUT@QDQ |
|
3364 |
DQDPQEUUQ@DQDQDQDDQFQDPADQDQDQADQ$QD@QDQDQDPL3X3Q@DQDQDQDCL3L3LADQDQD@@@@@@@@@DQDQD@DQDQDP@QDQ@@DADQDQDA@@DA@ADQDQDQDP@P |
|
3365 |
@@@QDQDQDQDA@@@ADQDQDQDQD@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
3366 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
3367 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@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:' |
|
3368 |
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@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
3369 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
3370 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
3371 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
3372 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; yourself); yourself] |
|
3373 |
! ! |
|
3374 |
||
3375 |
!FileApplicationNoteBook::ImageViewApplication class methodsFor:'interface specs'! |
|
3376 |
||
3377 |
windowSpec |
|
3378 |
"This resource specification was automatically generated |
|
3379 |
by the UIPainter of ST/X." |
|
3380 |
||
3381 |
"Do not manually edit this!! If it is corrupted, |
|
3382 |
the UIPainter may not be able to read the specification." |
|
3383 |
||
3384 |
" |
|
3385 |
UIPainter new openOnClass:FileApplicationNoteBook::ImageViewApplication andSelector:#windowSpec |
|
3386 |
FileApplicationNoteBook::ImageViewApplication new openInterface:#windowSpec |
|
3387 |
FileApplicationNoteBook::ImageViewApplication open |
|
3388 |
" |
|
3389 |
||
3390 |
<resource: #canvas> |
|
3391 |
||
3392 |
^ |
|
3393 |
#(#FullSpec |
|
3394 |
#name: #windowSpec |
|
3395 |
#window: |
|
3396 |
#(#WindowSpec |
|
3397 |
#label: 'ImageViewer' |
|
3398 |
#name: 'ImageViewer' |
|
3399 |
#min: #(#Point 10 10) |
|
3400 |
#max: #(#Point 1024 768) |
|
3401 |
#bounds: #(#Rectangle 16 42 692 534) |
|
3402 |
#menu: #mainMenu |
|
3403 |
) |
|
3404 |
#component: |
|
3405 |
#(#SpecCollection |
|
3406 |
#collection: #( |
|
3407 |
#(#MenuPanelSpec |
|
4261 | 3408 |
#name: 'MenuImage' |
3892 | 3409 |
#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
|
3410 |
#level: 0 |
3892 | 3411 |
#visibilityChannel: #isEmbeddedApplication |
3412 |
#menu: #menu |
|
3413 |
#textDefault: true |
|
3414 |
) |
|
3415 |
#(#ArbitraryComponentSpec |
|
4261 | 3416 |
#name: 'ImageView' |
3892 | 3417 |
#layout: #(#LayoutFrame 0 0.0 32 0.0 0 1.0 0 1.0) |
3418 |
#hasHorizontalScrollBar: true |
|
3419 |
#hasVerticalScrollBar: true |
|
3420 |
#miniScrollerHorizontal: false |
|
3421 |
#miniScrollerVertical: false |
|
3422 |
#hasBorder: false |
|
3423 |
#component: #ImageView |
|
3424 |
#postBuildCallback: #postBuildImageView: |
|
3425 |
) |
|
3426 |
) |
|
3427 |
||
3428 |
) |
|
3429 |
) |
|
3430 |
! ! |
|
3431 |
||
3432 |
!FileApplicationNoteBook::ImageViewApplication class methodsFor:'menu specs'! |
|
3433 |
||
3434 |
menu |
|
3435 |
"This resource specification was automatically generated |
|
3436 |
by the MenuEditor of ST/X." |
|
3437 |
||
3438 |
"Do not manually edit this!! If it is corrupted, |
|
3439 |
the MenuEditor may not be able to read the specification." |
|
3440 |
||
3441 |
" |
|
3442 |
MenuEditor new openOnClass:FileApplicationNoteBook::ImageViewApplication andSelector:#menu |
|
3443 |
(Menu new fromLiteralArrayEncoding:(FileApplicationNoteBook::ImageViewApplication menu)) startUp |
|
3444 |
" |
|
3445 |
||
3446 |
<resource: #menu> |
|
3447 |
||
3448 |
^ |
|
3449 |
#(#Menu |
|
3450 |
#( |
|
3451 |
#(#MenuItem |
|
3452 |
#label: 'Edit' |
|
4353 | 3453 |
#itemValue: #editImage |
3454 |
#nameKey: #EditImage |
|
3892 | 3455 |
#translateLabel: true |
3456 |
#isButton: true |
|
3457 |
) |
|
3458 |
#(#MenuItem |
|
3459 |
#label: '-' |
|
3460 |
) |
|
3461 |
#(#MenuItem |
|
4353 | 3462 |
#activeHelpKey: #fitSize |
3892 | 3463 |
#label: 'FitSize' |
3464 |
#translateLabel: true |
|
3465 |
#isButton: true |
|
3466 |
#triggerOnDown: true |
|
4353 | 3467 |
#indication: #fitSize |
3892 | 3468 |
#labelImage: #(#ResourceRetriever #'FileApplicationNoteBook::ImageViewApplication' #fitSize20x20Icon) |
3469 |
) |
|
3470 |
#(#MenuItem |
|
3471 |
#label: '-' |
|
3472 |
) |
|
3473 |
#(#MenuItem |
|
3474 |
#label: 'Close' |
|
4353 | 3475 |
#itemValue: #doClose |
3892 | 3476 |
#translateLabel: true |
3477 |
#isButton: true |
|
4353 | 3478 |
#startGroup: #right |
3892 | 3479 |
#hideMenuOnActivated: false |
3480 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #closeIcon) |
|
3481 |
) |
|
3482 |
) |
|
3483 |
nil |
|
3484 |
nil |
|
3485 |
) |
|
3486 |
! ! |
|
3487 |
||
3488 |
!FileApplicationNoteBook::ImageViewApplication class methodsFor:'queries'! |
|
3489 |
||
5010 | 3490 |
canOpenItem:anItem |
3491 |
||
3492 |
^ (anItem hasMimeType and:[anItem mimeType isImage]) |
|
3892 | 3493 |
! |
3494 |
||
3495 |
wantNewApplicationAnyway |
|
3496 |
||
3497 |
^ false |
|
3498 |
! ! |
|
3499 |
||
3500 |
!FileApplicationNoteBook::ImageViewApplication methodsFor:'accessing'! |
|
3501 |
||
3502 |
image:something |
|
3503 |
"set the value of the instance variable 'image' (automatically generated)" |
|
3504 |
||
3505 |
image := something. |
|
4417 | 3506 |
self updateImageInfo. |
3892 | 3507 |
! |
3508 |
||
3509 |
imageView |
|
3510 |
"return the value of the instance variable 'imageView' (automatically generated)" |
|
3511 |
||
3512 |
^ imageView |
|
3513 |
! |
|
3514 |
||
3515 |
imageView:something |
|
3516 |
"set the value of the instance variable 'imageView' (automatically generated)" |
|
3517 |
||
3518 |
imageView := something. |
|
4417 | 3519 |
! |
3520 |
||
3521 |
updateImageInfo |
|
3522 |
|fn msg| |
|
3523 |
||
3524 |
image notNil ifTrue:[ |
|
3525 |
fn := image fileName. |
|
3526 |
fn isNil ifTrue:[ |
|
3527 |
fn := 'unnamed' |
|
3528 |
] ifFalse:[ |
|
3529 |
fn := fn asFilename baseName. |
|
3530 |
]. |
|
3531 |
msg := '%1 %2x%3 depth:%4' |
|
3532 |
bindWith:fn allBold |
|
3533 |
with:image width |
|
3534 |
with:image height |
|
3535 |
with:image depth. |
|
3536 |
]. |
|
4523 | 3537 |
self notify:msg. |
3892 | 3538 |
! ! |
3539 |
||
3540 |
!FileApplicationNoteBook::ImageViewApplication methodsFor:'actions'! |
|
3541 |
||
5010 | 3542 |
changeItem:anItem |
3543 |
||
3544 |
self item:anItem. |
|
3892 | 3545 |
self setupImageView. |
3546 |
^ true |
|
3547 |
! |
|
3548 |
||
3549 |
editImage |
|
3550 |
|img| |
|
3551 |
||
3552 |
img := self image. |
|
3553 |
img notNil ifTrue:[ |
|
4855 | 3554 |
self withWaitCursorDo:[ |
3555 |
img edit. |
|
3556 |
] |
|
3892 | 3557 |
]. |
3558 |
! |
|
3559 |
||
3560 |
image |
|
3561 |
|img fn e| |
|
3562 |
||
3563 |
fn := self fileName. |
|
3564 |
img := Image fromFile:fn. |
|
3565 |
img isNil ifTrue:[ |
|
3566 |
fn exists ifTrue:[ |
|
3567 |
e := 'Unknown/unsupported image format' |
|
3568 |
] ifFalse:[ |
|
3569 |
e := 'No such image' |
|
3570 |
]. |
|
3571 |
Dialog warn:e. |
|
3572 |
^ nil |
|
3573 |
]. |
|
3574 |
^ img. |
|
3575 |
! |
|
3576 |
||
3577 |
setupImageView |
|
4020 | 3578 |
[ |
4744 | 3579 |
|img| |
3580 |
||
3581 |
imageView withCursor:(Cursor wait) do:[ |
|
3582 |
img := self image. |
|
3583 |
img notNil ifTrue:[ |
|
3584 |
self image:img. |
|
3585 |
imageView image:img |
|
3586 |
]. |
|
4020 | 3587 |
]. |
4174 | 3588 |
] fork. |
3892 | 3589 |
! ! |
3590 |
||
3591 |
!FileApplicationNoteBook::ImageViewApplication methodsFor:'aspects'! |
|
3592 |
||
3593 |
fitSize |
|
3594 |
"return/create the 'fitSize' value holder (automatically generated)" |
|
3595 |
||
3596 |
fitSize isNil ifTrue:[ |
|
3597 |
fitSize := ValueHolder new. |
|
3598 |
fitSize addDependent:self. |
|
3599 |
]. |
|
3600 |
^ fitSize |
|
3601 |
! ! |
|
3602 |
||
3603 |
!FileApplicationNoteBook::ImageViewApplication methodsFor:'change & update'! |
|
3604 |
||
3605 |
update:something with:aParameter from:changedObject |
|
3606 |
changedObject == self fitSize ifTrue:[ |
|
3607 |
changedObject value ifTrue:[ |
|
3608 |
imageView adjust:#fitBig. |
|
3609 |
] ifFalse:[ |
|
3610 |
imageView adjust:nil. |
|
3611 |
]. |
|
3612 |
^ self |
|
3613 |
]. |
|
3614 |
super update:something with:aParameter from:changedObject |
|
3615 |
! ! |
|
3616 |
||
3617 |
!FileApplicationNoteBook::ImageViewApplication methodsFor:'initialization & release'! |
|
3618 |
||
3619 |
postBuildImageView:aWidget |
|
3620 |
||
3621 |
self imageView: aWidget scrolledView. |
|
3622 |
self imageView wantsFocusWithPointerEnter. |
|
3623 |
! |
|
3624 |
||
3625 |
postOpenWith:aBuilder |
|
3626 |
" |
|
3627 |
only invoked if the application not started from a master |
|
3628 |
" |
|
3629 |
||
3630 |
|currentDir contents suffix fileName| |
|
3631 |
||
3632 |
self masterApplication isNil ifTrue:[ |
|
3633 |
self masterApplication:nil. |
|
3634 |
currentDir := Filename currentDirectory. |
|
3635 |
contents := currentDir directoryContents. |
|
3636 |
fileName := contents |
|
3637 |
detect:[:file | |
|
3638 |
suffix := file asFilename suffix asLowercase. |
|
3639 |
Image isImageFileSuffix:suffix |
|
3640 |
] |
|
3641 |
ifNone:[nil]. |
|
3642 |
fileName isNil ifTrue:[ |
|
3643 |
Dialog warn:'cant find a Image in ' , currentDir asString. |
|
3644 |
^ self |
|
3645 |
]. |
|
3982 | 3646 |
self item:(DirectoryContentsBrowser itemClass fileName:(currentDir construct:fileName)) |
3892 | 3647 |
]. |
3648 |
self setupImageView. |
|
3649 |
^ super postOpenWith:aBuilder |
|
3650 |
! ! |
|
3651 |
||
3652 |
!FileApplicationNoteBook::Terminal class methodsFor:'defaults'! |
|
3653 |
||
4758 | 3654 |
defaultLineLimit |
3655 |
"the number of buffered lines" |
|
3656 |
||
4759 | 3657 |
^ DefaultLineLimit ? TextCollector defaultLineLimit |
4758 | 3658 |
! |
3659 |
||
3892 | 3660 |
tabStringFor:aApplicationType |
3661 |
||
4336
b4228ddf2183
change level of buttons bfor notebook applications and remove directory for label of terminal app
penk
parents:
4293
diff
changeset
|
3662 |
^ 'Terminal' |
3892 | 3663 |
! ! |
3664 |
||
3665 |
!FileApplicationNoteBook::Terminal class methodsFor:'interface specs'! |
|
3666 |
||
3667 |
windowSpec |
|
3668 |
"This resource specification was automatically generated |
|
3669 |
by the UIPainter of ST/X." |
|
3670 |
||
3671 |
"Do not manually edit this!! If it is corrupted, |
|
3672 |
the UIPainter may not be able to read the specification." |
|
3673 |
||
3674 |
" |
|
4336
b4228ddf2183
change level of buttons bfor notebook applications and remove directory for label of terminal app
penk
parents:
4293
diff
changeset
|
3675 |
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
|
3676 |
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
|
3677 |
FileApplicationNoteBook::Terminal open |
3892 | 3678 |
" |
3679 |
||
3680 |
<resource: #canvas> |
|
3681 |
||
3682 |
^ |
|
3683 |
#(#FullSpec |
|
3684 |
#name: #windowSpec |
|
3685 |
#window: |
|
3686 |
#(#WindowSpec |
|
4336
b4228ddf2183
change level of buttons bfor notebook applications and remove directory for label of terminal app
penk
parents:
4293
diff
changeset
|
3687 |
#label: 'Terminal' |
b4228ddf2183
change level of buttons bfor notebook applications and remove directory for label of terminal app
penk
parents:
4293
diff
changeset
|
3688 |
#name: 'Terminal' |
3892 | 3689 |
#min: #(#Point 10 10) |
3690 |
#max: #(#Point 1024 768) |
|
3691 |
#bounds: #(#Rectangle 16 42 692 534) |
|
3692 |
#menu: #mainMenu |
|
3693 |
) |
|
3694 |
#component: |
|
3695 |
#(#SpecCollection |
|
3696 |
#collection: #( |
|
3697 |
#(#MenuPanelSpec |
|
3698 |
#name: 'MenuTerminal' |
|
3699 |
#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
|
3700 |
#level: 0 |
3892 | 3701 |
#menu: #menu |
3702 |
#textDefault: true |
|
3703 |
) |
|
3704 |
#(#ArbitraryComponentSpec |
|
3705 |
#name: 'TerminalView' |
|
3706 |
#layout: #(#LayoutFrame 0 0.0 32 0.0 0 1.0 0 1.0) |
|
3707 |
#hasHorizontalScrollBar: true |
|
3708 |
#hasVerticalScrollBar: true |
|
3709 |
#miniScrollerHorizontal: false |
|
3710 |
#miniScrollerVertical: false |
|
3711 |
#hasBorder: false |
|
3712 |
#component: #terminalView |
|
3713 |
) |
|
3714 |
) |
|
3715 |
||
3716 |
) |
|
3717 |
) |
|
3718 |
! ! |
|
3719 |
||
3720 |
!FileApplicationNoteBook::Terminal class methodsFor:'menu specs'! |
|
3721 |
||
3722 |
menu |
|
3723 |
"This resource specification was automatically generated |
|
3724 |
by the MenuEditor of ST/X." |
|
3725 |
||
3726 |
"Do not manually edit this!! If it is corrupted, |
|
3727 |
the MenuEditor may not be able to read the specification." |
|
3728 |
||
3729 |
" |
|
3730 |
MenuEditor new openOnClass:FileApplicationNoteBook::Terminal andSelector:#menu |
|
3731 |
(Menu new fromLiteralArrayEncoding:(FileApplicationNoteBook::Terminal menu)) startUp |
|
3732 |
" |
|
3733 |
||
3734 |
<resource: #menu> |
|
3735 |
||
3736 |
^ |
|
3737 |
#(#Menu |
|
3738 |
#( |
|
3739 |
#(#MenuItem |
|
3740 |
#label: 'Save' |
|
3741 |
#translateLabel: true |
|
3742 |
#isButton: true |
|
3743 |
#nameKey: #Save |
|
3744 |
#value: #saveAs |
|
3745 |
#labelImage: #(#ResourceRetriever #ToolbarIconLibrary #saveToFile28x22Icon) |
|
3746 |
) |
|
3747 |
#(#MenuItem |
|
3748 |
#label: 'Close' |
|
3749 |
#translateLabel: true |
|
3750 |
#isButton: true |
|
3751 |
#hideMenuOnActivated: false |
|
3752 |
#isVisible: #isEmbeddedApplication |
|
3753 |
#startGroup: #right |
|
3754 |
#value: #doClose |
|
3755 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #closeIcon) |
|
3756 |
) |
|
3757 |
) |
|
3758 |
nil |
|
3759 |
nil |
|
3760 |
) |
|
3761 |
! ! |
|
3762 |
||
3763 |
!FileApplicationNoteBook::Terminal methodsFor:'accessing'! |
|
3764 |
||
3765 |
terminalView |
|
3766 |
||
3767 |
terminalView isNil ifTrue:[ |
|
3768 |
terminalView := VT100TerminalView new. |
|
4758 | 3769 |
terminalView lineLimit:(self class defaultLineLimit). |
3892 | 3770 |
]. |
3771 |
^ terminalView. |
|
3772 |
! ! |
|
3773 |
||
3774 |
!FileApplicationNoteBook::Terminal methodsFor:'actions'! |
|
3775 |
||
3776 |
saveAs |
|
3777 |
||
3778 |
self terminalView save. |
|
3779 |
! ! |
|
3780 |
||
3781 |
!FileApplicationNoteBook::Terminal methodsFor:'initialization & release'! |
|
3782 |
||
3783 |
postBuildWith:aBuilder |
|
3784 |
||
3785 |
^ super postBuildWith:aBuilder |
|
3786 |
! |
|
3787 |
||
3788 |
shellFinished |
|
3789 |
| master text string| |
|
3790 |
||
3791 |
master := self masterApplication. |
|
3792 |
master notNil ifTrue:[ |
|
3793 |
string := ' - closed'. |
|
3794 |
master tabStringAdd:string for:self. |
|
3795 |
]. |
|
4523 | 3796 |
self notify:'shell in ' , self fileName asString, ' finished'. |
3892 | 3797 |
terminalView cr. |
4515 | 3798 |
|
5305 | 3799 |
text := '>> shell terminated.' allBold. |
3892 | 3800 |
text colorizeAllWith:Color red. |
3801 |
terminalView nextPutAll:text. |
|
3802 |
! |
|
3803 |
||
3804 |
startShell |
|
3805 |
|vt100| |
|
3806 |
||
3807 |
vt100 := self terminalView. |
|
3808 |
vt100 shellTerminateAction:[ self shellFinished ]. |
|
3809 |
vt100 startShellIn:(self fileName). |
|
3810 |
! ! |
|
3811 |
||
3812 |
!FileApplicationNoteBook::Terminal methodsFor:'printing'! |
|
3813 |
||
3814 |
printString |
|
3815 |
||
3816 |
^ ('Terminal on:', self fileName baseName) |
|
3817 |
! ! |
|
3818 |
||
3819 |
!FileApplicationNoteBook::Terminal methodsFor:'queries'! |
|
3820 |
||
3821 |
getTabStringEnd |
|
3822 |
||
3823 |
" get the tab string from the application list on the class side " |
|
3824 |
||
4336
b4228ddf2183
change level of buttons bfor notebook applications and remove directory for label of terminal app
penk
parents:
4293
diff
changeset
|
3825 |
^ '' |
3892 | 3826 |
! ! |
3827 |
||
3828 |
!FileApplicationNoteBook::Terminal methodsFor:'startup & release'! |
|
3829 |
||
3830 |
postOpenWith:aBuilder |
|
3831 |
||
3832 |
" |
|
3833 |
only invoked if the application not started from a master |
|
3834 |
" |
|
3835 |
self masterApplication isNil ifTrue:[ |
|
3836 |
self masterApplication:nil. |
|
3982 | 3837 |
self item:(DirectoryContentsBrowser itemClass fileName:(Filename currentDirectory asAbsoluteFilename)). |
3892 | 3838 |
]. |
3839 |
self startShell. |
|
3840 |
^ super postOpenWith:aBuilder. |
|
3841 |
! ! |
|
3842 |
||
3843 |
!FileApplicationNoteBook::TextEditor class methodsFor:'defaults'! |
|
3844 |
||
3845 |
tabStringFor:aApplicationType |
|
3846 |
||
3847 |
aApplicationType == #directoryDescription ifTrue:[ |
|
3848 |
^ 'Directory description for:' |
|
3849 |
] ifFalse:[ |
|
3850 |
^ 'Editor on:' |
|
3851 |
]. |
|
3852 |
! |
|
3853 |
||
3854 |
wantNewApplicationAnyway |
|
3855 |
||
3856 |
^ false |
|
3857 |
! ! |
|
3858 |
||
4913 | 3859 |
!FileApplicationNoteBook::TextEditor class methodsFor:'interface-specs'! |
3892 | 3860 |
|
3861 |
windowSpec |
|
3862 |
"This resource specification was automatically generated |
|
3863 |
by the UIPainter of ST/X." |
|
3864 |
||
3865 |
"Do not manually edit this!! If it is corrupted, |
|
3866 |
the UIPainter may not be able to read the specification." |
|
3867 |
||
3868 |
" |
|
3950 | 3869 |
UIPainter new openOnClass:FileApplicationNoteBook::TextEditor andSelector:#windowSpec |
3870 |
FileApplicationNoteBook::TextEditor new openInterface:#windowSpec |
|
3871 |
FileApplicationNoteBook::TextEditor open |
|
3892 | 3872 |
" |
3873 |
||
3874 |
<resource: #canvas> |
|
3875 |
||
3876 |
^ |
|
5417 | 3877 |
#(FullSpec |
3878 |
name: windowSpec |
|
3879 |
window: |
|
3880 |
(WindowSpec |
|
3881 |
label: 'TextEditor' |
|
3882 |
name: 'TextEditor' |
|
3883 |
min: (Point 10 10) |
|
3884 |
max: (Point 1024 768) |
|
3885 |
bounds: (Rectangle 16 42 666 342) |
|
3886 |
) |
|
3887 |
component: |
|
3888 |
(SpecCollection |
|
3889 |
collection: ( |
|
3890 |
(MenuPanelSpec |
|
3891 |
name: 'MenuTextEditor' |
|
3892 |
layout: (LayoutFrame 0 0.0 0 0 0 1.0 32 0) |
|
3893 |
level: 0 |
|
3894 |
menu: menu |
|
3895 |
textDefault: true |
|
3896 |
) |
|
5430 | 3897 |
(TextEditorSpec |
3898 |
name: 'TextEditor' |
|
5417 | 3899 |
layout: (LayoutFrame 0 0.0 32 0 0 1.0 0 1.0) |
3900 |
model: fileContentsModel |
|
3901 |
hasHorizontalScrollBar: true |
|
3902 |
hasVerticalScrollBar: true |
|
5430 | 3903 |
modifiedChannel: viewModifiedChannel |
3904 |
acceptCallBack: accept |
|
3905 |
allowDoIt: true |
|
5417 | 3906 |
postBuildCallback: postBuildTextEditor: |
3907 |
) |
|
3908 |
) |
|
3909 |
||
3910 |
) |
|
3911 |
) |
|
3912 |
! |
|
3913 |
||
3914 |
xwindowSpec |
|
3915 |
"This resource specification was automatically generated |
|
3916 |
by the UIPainter of ST/X." |
|
3917 |
||
3918 |
"Do not manually edit this!! If it is corrupted, |
|
3919 |
the UIPainter may not be able to read the specification." |
|
3920 |
||
3921 |
" |
|
3922 |
UIPainter new openOnClass:FileApplicationNoteBook::TextEditor andSelector:#windowSpec |
|
3923 |
FileApplicationNoteBook::TextEditor new openInterface:#windowSpec |
|
3924 |
FileApplicationNoteBook::TextEditor open |
|
3925 |
" |
|
3926 |
||
3927 |
<resource: #canvas> |
|
3928 |
||
3929 |
^ |
|
3892 | 3930 |
#(#FullSpec |
3931 |
#name: #windowSpec |
|
3932 |
#window: |
|
3933 |
#(#WindowSpec |
|
3934 |
#label: 'TextEditor' |
|
3935 |
#name: 'TextEditor' |
|
3936 |
#min: #(#Point 10 10) |
|
3937 |
#max: #(#Point 1024 768) |
|
4047
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
3938 |
#bounds: #(#Rectangle 16 42 666 342) |
3892 | 3939 |
) |
3940 |
#component: |
|
3941 |
#(#SpecCollection |
|
3942 |
#collection: #( |
|
3943 |
#(#MenuPanelSpec |
|
3944 |
#name: 'MenuTextEditor' |
|
3945 |
#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
|
3946 |
#level: 0 |
3892 | 3947 |
#menu: #menu |
3948 |
#textDefault: true |
|
3949 |
) |
|
3950 |
#(#TextEditorSpec |
|
3951 |
#name: 'TextEditor' |
|
3952 |
#layout: #(#LayoutFrame 0 0.0 32 0 0 1.0 0 1.0) |
|
3953 |
#model: #fileContentsModel |
|
3954 |
#hasHorizontalScrollBar: true |
|
3955 |
#hasVerticalScrollBar: true |
|
4071 | 3956 |
#modifiedChannel: #viewModifiedChannel |
3892 | 3957 |
#acceptCallBack: #accept |
3950 | 3958 |
#allowDoIt: true |
3892 | 3959 |
#postBuildCallback: #postBuildTextEditor: |
3960 |
) |
|
3961 |
) |
|
3962 |
||
3963 |
) |
|
3964 |
) |
|
3965 |
! ! |
|
3966 |
||
3967 |
!FileApplicationNoteBook::TextEditor class methodsFor:'menu specs'! |
|
3968 |
||
3969 |
menu |
|
3970 |
"This resource specification was automatically generated |
|
3971 |
by the MenuEditor of ST/X." |
|
3972 |
||
3973 |
"Do not manually edit this!! If it is corrupted, |
|
3974 |
the MenuEditor may not be able to read the specification." |
|
3975 |
||
3976 |
" |
|
3977 |
MenuEditor new openOnClass:FileApplicationNoteBook::TextEditor andSelector:#menu |
|
3978 |
(Menu new fromLiteralArrayEncoding:(FileApplicationNoteBook::TextEditor menu)) startUp |
|
3979 |
" |
|
3980 |
||
3981 |
<resource: #menu> |
|
3982 |
||
3983 |
^ |
|
5197 | 3984 |
#(Menu |
3985 |
( |
|
3986 |
(MenuItem |
|
3987 |
enabled: enableSave |
|
5429 | 3988 |
label: 'Save' |
3989 |
itemValue: accept |
|
3990 |
nameKey: Save |
|
3991 |
translateLabel: true |
|
3992 |
isButton: true |
|
3993 |
labelImage: (ResourceRetriever ToolbarIconLibrary saveToFile28x22Icon) |
|
3994 |
) |
|
3995 |
(MenuItem |
|
5197 | 3996 |
enabled: enableReload |
3997 |
label: 'Reload' |
|
3998 |
itemValue: reload |
|
3999 |
nameKey: Reload |
|
4000 |
translateLabel: true |
|
4001 |
isButton: true |
|
4002 |
labelImage: (ResourceRetriever ToolbarIconLibrary reloadFromFile28x22Icon) |
|
3892 | 4003 |
) |
5197 | 4004 |
(MenuItem |
4005 |
label: '' |
|
3892 | 4006 |
) |
5197 | 4007 |
(MenuItem |
4008 |
enabled: enableHexToggle |
|
4009 |
label: 'Print' |
|
4010 |
itemValue: doPrint |
|
4011 |
nameKey: Print |
|
4012 |
translateLabel: true |
|
4013 |
isButton: true |
|
4014 |
labelImage: (ResourceRetriever ToolbarIconLibrary printer22x22Icon) |
|
3892 | 4015 |
) |
5197 | 4016 |
(MenuItem |
4017 |
label: '' |
|
3892 | 4018 |
) |
5197 | 4019 |
(MenuItem |
4020 |
enabled: enableHexToggle |
|
4021 |
label: 'Hex' |
|
4022 |
translateLabel: true |
|
4023 |
isButton: true |
|
4024 |
indication: printAsHexDump |
|
4025 |
labelImage: (ResourceRetriever AbstractFileBrowser hexToggle22x22Icon) |
|
3892 | 4026 |
) |
5197 | 4027 |
(MenuItem |
4028 |
label: '' |
|
4047
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4029 |
) |
5197 | 4030 |
(MenuItem |
4031 |
label: 'Diff to Current' |
|
4032 |
itemValue: openDiffView |
|
4033 |
translateLabel: true |
|
4034 |
isButton: true |
|
4035 |
labelImage: (ResourceRetriever AbstractFileBrowser diffIcon) |
|
4047
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4036 |
) |
5197 | 4037 |
(MenuItem |
4038 |
label: 'Close' |
|
4039 |
itemValue: doClose |
|
4040 |
translateLabel: true |
|
4041 |
isButton: true |
|
4042 |
startGroup: right |
|
4043 |
isVisible: isEmbeddedApplication |
|
4044 |
hideMenuOnActivated: false |
|
4045 |
labelImage: (ResourceRetriever AbstractFileBrowser closeIcon) |
|
3892 | 4046 |
) |
4047 |
) |
|
4048 |
nil |
|
4049 |
nil |
|
4050 |
) |
|
4051 |
! ! |
|
4052 |
||
4053 |
!FileApplicationNoteBook::TextEditor methodsFor:'accessing'! |
|
4054 |
||
4055 |
item:aDirContentsItem |
|
4056 |
||
4977
621cc3cb454d
checkModify have to reset the mofication time for the file after file change in TextEditor
penk
parents:
4971
diff
changeset
|
4057 |
self releaseCheckModify. |
4620 | 4058 |
(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
|
4059 |
self askForChangeWithReload:true. |
5197 | 4060 |
|
3892 | 4061 |
super item:aDirContentsItem. |
4698 | 4062 |
self printAsHexDump value:(self presentation == #hexDump) withoutNotifying:self. |
4201 | 4063 |
self setContents ifFalse:[ ^ false]. |
4969 | 4064 |
checkModifiedBlock isNil ifTrue:[ |
4065 |
checkModifiedBlock := [ |
|
4066 |
self enqueueMessage:#checkItemForChanges |
|
4067 |
for:self |
|
4068 |
arguments:nil. |
|
4069 |
]. |
|
4070 |
]. |
|
4977
621cc3cb454d
checkModify have to reset the mofication time for the file after file change in TextEditor
penk
parents:
4971
diff
changeset
|
4071 |
textEditorModificationTime := self fileName modificationTime. |
5417 | 4072 |
self releaseCheckModify. |
4969 | 4073 |
self setupCheckModify. |
5417 | 4074 |
self changeInformation. |
3892 | 4075 |
^ true |
4076 |
! |
|
4077 |
||
4078 |
presentation |
|
4079 |
"return the value of the instance variable 'presentation' (automatically generated)" |
|
4080 |
||
4081 |
presentation isNil ifTrue:[ |
|
4082 |
presentation := #asText. |
|
4083 |
]. |
|
4084 |
^ presentation |
|
4085 |
! |
|
4086 |
||
4087 |
presentation:something |
|
4088 |
"set the value of the instance variable 'presentation' (automatically generated)" |
|
4089 |
||
4090 |
presentation := something. |
|
4091 |
! |
|
4092 |
||
4093 |
semaChangeItem |
|
4094 |
||
4095 |
semaChangeItem isNil ifTrue:[ |
|
4096 |
semaChangeItem := Semaphore forMutualExclusion. |
|
4097 |
]. |
|
4098 |
^ semaChangeItem |
|
4099 |
! ! |
|
4100 |
||
4101 |
!FileApplicationNoteBook::TextEditor methodsFor:'actions'! |
|
4102 |
||
4103 |
accept |
|
5417 | 4104 |
self saveWithAskForFilename:false. |
3892 | 4105 |
! |
4106 |
||
5198
ea3f838e1353
do not attempt to reload when closing
Claus Gittinger <cg@exept.de>
parents:
5197
diff
changeset
|
4107 |
askForChangeWithReload:doReload |
5197 | 4108 |
"ask for save changes; |
4109 |
if modified and answered true, the current contents is written back (accepted) |
|
3892 | 4110 |
" |
4111 |
||
5202 | 4112 |
|answer string arg| |
3892 | 4113 |
|
5197 | 4114 |
self modifiedChannel value ifFalse:[ ^ false]. |
4115 |
||
4116 |
arg := self fileName baseName allBold. |
|
4117 |
||
4118 |
self itemChanged value ifTrue:[ |
|
5223 | 4119 |
string := '%1 was changed by someone else. Save your changes anyway (overwrite someones changes) ?' |
5197 | 4120 |
] ifFalse:[ |
3892 | 4121 |
self itemRemoved value ifTrue:[ |
5223 | 4122 |
string := '%1 was removed by someone else. Save your changes anyway (recreate the removed file) ?' |
5197 | 4123 |
] ifFalse:[ |
4553 | 4124 |
string := 'Save changed file %1 ?'. |
5197 | 4125 |
] |
3892 | 4126 |
]. |
5197 | 4127 |
|
5199
f8f257045045
added showDiffs option to askForChange
Claus Gittinger <cg@exept.de>
parents:
5198
diff
changeset
|
4128 |
answer := OptionBox |
f8f257045045
added showDiffs option to askForChange
Claus Gittinger <cg@exept.de>
parents:
5198
diff
changeset
|
4129 |
request:(resources string:string with:arg) withCRs |
f8f257045045
added showDiffs option to askForChange
Claus Gittinger <cg@exept.de>
parents:
5198
diff
changeset
|
4130 |
buttonLabels:(resources array:#('Cancel' 'Show Diffs' 'No' 'Yes')) |
f8f257045045
added showDiffs option to askForChange
Claus Gittinger <cg@exept.de>
parents:
5198
diff
changeset
|
4131 |
values:#(nil showDiffs false true) |
f8f257045045
added showDiffs option to askForChange
Claus Gittinger <cg@exept.de>
parents:
5198
diff
changeset
|
4132 |
default:nil. |
f8f257045045
added showDiffs option to askForChange
Claus Gittinger <cg@exept.de>
parents:
5198
diff
changeset
|
4133 |
|
5197 | 4134 |
answer isNil ifTrue:[^ AbortOperationRequest raise ]. |
4135 |
||
5199
f8f257045045
added showDiffs option to askForChange
Claus Gittinger <cg@exept.de>
parents:
5198
diff
changeset
|
4136 |
answer == #showDiffs ifTrue:[ |
5201 | 4137 |
self openDiffView. |
5199
f8f257045045
added showDiffs option to askForChange
Claus Gittinger <cg@exept.de>
parents:
5198
diff
changeset
|
4138 |
AbortOperationRequest raise |
f8f257045045
added showDiffs option to askForChange
Claus Gittinger <cg@exept.de>
parents:
5198
diff
changeset
|
4139 |
]. |
f8f257045045
added showDiffs option to askForChange
Claus Gittinger <cg@exept.de>
parents:
5198
diff
changeset
|
4140 |
|
5197 | 4141 |
answer ifTrue:[ |
4142 |
self accept |
|
4143 |
] ifFalse:[ |
|
5198
ea3f838e1353
do not attempt to reload when closing
Claus Gittinger <cg@exept.de>
parents:
5197
diff
changeset
|
4144 |
doReload ifTrue:[ |
ea3f838e1353
do not attempt to reload when closing
Claus Gittinger <cg@exept.de>
parents:
5197
diff
changeset
|
4145 |
self setContents. |
ea3f838e1353
do not attempt to reload when closing
Claus Gittinger <cg@exept.de>
parents:
5197
diff
changeset
|
4146 |
] |
3892 | 4147 |
]. |
4148 |
^ answer |
|
4149 |
! |
|
4150 |
||
4151 |
changeInformation |
|
4152 |
||
4621 | 4153 |
| stream win| |
3892 | 4154 |
|
4155 |
stream := WriteStream with:(self getTabString). |
|
4156 |
masterApplication isNil ifTrue:[ |
|
4621 | 4157 |
win := self window. |
4158 |
win notNil ifTrue:[ |
|
4159 |
self window label:stream contents. |
|
4160 |
]. |
|
3892 | 4161 |
] ifFalse:[ |
4162 |
masterApplication tabStringChangeTo:stream contents for:self. |
|
4163 |
]. |
|
4164 |
stream close. |
|
4165 |
! |
|
4166 |
||
4161 | 4167 |
changeInformationForModified:aSymbol |
4045 | 4168 |
masterApplication isNil ifTrue:[ ^ self]. |
4161 | 4169 |
masterApplication changeModified:aSymbol for:self. |
4045 | 4170 |
! |
4171 |
||
3892 | 4172 |
doClose |
4173 |
||
5198
ea3f838e1353
do not attempt to reload when closing
Claus Gittinger <cg@exept.de>
parents:
5197
diff
changeset
|
4174 |
self askForChangeWithReload:false. |
3892 | 4175 |
self masterApplication notNil ifTrue:[ |
3954 | 4176 |
^ super doClose |
3892 | 4177 |
]. |
4178 |
^ true |
|
4179 |
! |
|
4180 |
||
4181 |
doPrint |
|
4182 |
"print the contents |
|
4183 |
" |
|
4473 | 4184 |
(Dialog confirm:'Print contents of editView ?') ifTrue:[ |
3892 | 4185 |
editView doPrint. |
4186 |
]. |
|
4187 |
! |
|
4188 |
||
5417 | 4189 |
doSaveAs |
4190 |
self saveWithAskForFilename:true. |
|
4191 |
! |
|
4192 |
||
4047
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4193 |
getContents |
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4194 |
|
5019 | 4195 |
|file contents present alreadyConfirmed| |
3892 | 4196 |
|
4197 |
file := self fileName. |
|
5037 | 4198 |
ExternalStream readErrorSignal handle:[:ex | |
4199 |
(Dialog confirm:('Read Error.\\Retry ?' withCRs)) |
|
5019 | 4200 |
ifTrue:[ |
5037 | 4201 |
^ ex restart |
5019 | 4202 |
]. |
5037 | 4203 |
] do:[ |
4204 |
ExternalStream lineTooLongErrorSignal handle:[ :ex | |
|
4205 |
(alreadyConfirmed==true |
|
4206 |
or:[ Dialog confirm:(file asString, ' contains very long line(s).\\Load anyway ?' withCRs)]) |
|
4207 |
ifTrue:[ |
|
4208 |
alreadyConfirmed := true. |
|
4209 |
^ ex parameter second , ex parameter first nextLine |
|
4210 |
]. |
|
4211 |
^ nil. |
|
4212 |
] do:[ |
|
4213 |
present := self presentation. |
|
4214 |
present == #asText ifTrue:[ |
|
4215 |
contents := file contents. |
|
4216 |
] ifFalse:[ |
|
4217 |
present == #hexDump ifTrue:[ |
|
4218 |
self withWaitCursorDo:[ |
|
4219 |
contents := AbstractFileBrowser contentsOfFileAsHexDump:file. |
|
4220 |
] |
|
4677 | 4221 |
] |
3892 | 4222 |
] |
5037 | 4223 |
]. |
3892 | 4224 |
]. |
4608
990e5559a904
md5 computation fixed and tuned
Claus Gittinger <cg@exept.de>
parents:
4572
diff
changeset
|
4225 |
^ contents. |
990e5559a904
md5 computation fixed and tuned
Claus Gittinger <cg@exept.de>
parents:
4572
diff
changeset
|
4226 |
! |
990e5559a904
md5 computation fixed and tuned
Claus Gittinger <cg@exept.de>
parents:
4572
diff
changeset
|
4227 |
|
990e5559a904
md5 computation fixed and tuned
Claus Gittinger <cg@exept.de>
parents:
4572
diff
changeset
|
4228 |
getHashForContents:contents |
990e5559a904
md5 computation fixed and tuned
Claus Gittinger <cg@exept.de>
parents:
4572
diff
changeset
|
4229 |
| hashStream| |
990e5559a904
md5 computation fixed and tuned
Claus Gittinger <cg@exept.de>
parents:
4572
diff
changeset
|
4230 |
|
990e5559a904
md5 computation fixed and tuned
Claus Gittinger <cg@exept.de>
parents:
4572
diff
changeset
|
4231 |
self hasMD5 ifFalse:[^ nil]. |
990e5559a904
md5 computation fixed and tuned
Claus Gittinger <cg@exept.de>
parents:
4572
diff
changeset
|
4232 |
|
990e5559a904
md5 computation fixed and tuned
Claus Gittinger <cg@exept.de>
parents:
4572
diff
changeset
|
4233 |
hashStream := MD5Stream new. |
990e5559a904
md5 computation fixed and tuned
Claus Gittinger <cg@exept.de>
parents:
4572
diff
changeset
|
4234 |
contents isStringCollection ifTrue:[ |
990e5559a904
md5 computation fixed and tuned
Claus Gittinger <cg@exept.de>
parents:
4572
diff
changeset
|
4235 |
contents do:[:eachLine | |
4616 | 4236 |
eachLine notNil ifTrue:[ |
4237 |
hashStream nextPutAll:(eachLine string withTabs). |
|
4238 |
]. |
|
4239 |
hashStream nextPut:Character cr. |
|
4608
990e5559a904
md5 computation fixed and tuned
Claus Gittinger <cg@exept.de>
parents:
4572
diff
changeset
|
4240 |
]. |
990e5559a904
md5 computation fixed and tuned
Claus Gittinger <cg@exept.de>
parents:
4572
diff
changeset
|
4241 |
] ifFalse:[ |
990e5559a904
md5 computation fixed and tuned
Claus Gittinger <cg@exept.de>
parents:
4572
diff
changeset
|
4242 |
hashStream nextPutAll:(contents string). |
4071 | 4243 |
]. |
4608
990e5559a904
md5 computation fixed and tuned
Claus Gittinger <cg@exept.de>
parents:
4572
diff
changeset
|
4244 |
^ hashStream hashValue. |
4071 | 4245 |
! |
4246 |
||
4047
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4247 |
openDiffView |
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4248 |
|
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4249 |
|diffView text1 l1 text2 l2| |
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4250 |
|
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4251 |
text1 := editView contents asText. |
5201 | 4252 |
l1 := 'Editor'. |
4047
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4253 |
text2 := self getContents. |
5201 | 4254 |
l2 := 'File: ' , self fileName baseName. |
4047
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4255 |
diffView := DiffTextView openOn:text1 label:l1 and:text2 label:l2. |
5201 | 4256 |
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
|
4257 |
! |
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4258 |
|
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4259 |
reload |
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4260 |
|
4969 | 4261 |
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
|
4262 |
self withWaitCursorDo:[ |
693e3ca577aa
avoid autoloading Archiver if an obviously non-archive is double clicked.
Claus Gittinger <cg@exept.de>
parents:
5279
diff
changeset
|
4263 |
self setContents. |
693e3ca577aa
avoid autoloading Archiver if an obviously non-archive is double clicked.
Claus Gittinger <cg@exept.de>
parents:
5279
diff
changeset
|
4264 |
]. |
4047
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4265 |
! |
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4266 |
|
5417 | 4267 |
saveWithAskForFilename:ask |
4268 |
||
4269 |
|answer fn master defaultDir fnDir| |
|
4270 |
||
4271 |
ask ifTrue:[ |
|
4272 |
defaultDir := self masterApplication currentDirectory. |
|
4273 |
defaultDir isNil ifTrue:[ |
|
4274 |
defaultDir := self fileName directory. |
|
4275 |
]. |
|
4276 |
answer := Dialog |
|
4277 |
requestFileName:(resources string:'Save contents in:') |
|
4278 |
default:self fileName baseName |
|
4279 |
fromDirectory:defaultDir. |
|
4280 |
answer isEmpty ifTrue:[^ self]. |
|
4281 |
fn := answer asFilename. |
|
4282 |
] ifFalse:[ |
|
4283 |
fn := self fileName |
|
4284 |
]. |
|
4285 |
master := self masterApplication. |
|
4286 |
(master notNil and:[master class openAnotherApplicationOnSameItem]) ifTrue:[ |
|
4287 |
(self updateSameFilesFor:fn) ifFalse:[ ^ self ]. |
|
4288 |
]. |
|
4289 |
||
4290 |
fnDir := fn directory. |
|
4291 |
fnDir exists not ifTrue:[ |
|
4292 |
fnDir recursiveMakeDirectory. |
|
4293 |
]. |
|
4294 |
(editView saveAs:fn) ifFalse:[^ self]. |
|
4295 |
||
4296 |
textEditorModificationTime := self fileName modificationTime. |
|
4297 |
||
4298 |
self hasMD5 ifTrue:[ |
|
4299 |
md5CheckSum := self getHashForContents:self fileContentsModel value. |
|
4300 |
]. |
|
4301 |
self enableReload value:false. |
|
4302 |
self itemChanged value:false. |
|
4303 |
self itemRemoved value:false. |
|
4304 |
self modifiedChannel value:false. |
|
4305 |
self notify:self fileName asString, ' saved'. |
|
4306 |
! |
|
4307 |
||
4146
c7c4e3044e50
on doubleclick after search the file is opened and searchPatternStrin is selected
penk
parents:
4111
diff
changeset
|
4308 |
searchForPattern:aContentsPattern ignoreCase:ign |
c7c4e3044e50
on doubleclick after search the file is opened and searchPatternStrin is selected
penk
parents:
4111
diff
changeset
|
4309 |
|
c7c4e3044e50
on doubleclick after search the file is opened and searchPatternStrin is selected
penk
parents:
4111
diff
changeset
|
4310 |
| pattern | |
c7c4e3044e50
on doubleclick after search the file is opened and searchPatternStrin is selected
penk
parents:
4111
diff
changeset
|
4311 |
|
c7c4e3044e50
on doubleclick after search the file is opened and searchPatternStrin is selected
penk
parents:
4111
diff
changeset
|
4312 |
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
|
4313 |
pattern notEmpty ifTrue:[ |
c7c4e3044e50
on doubleclick after search the file is opened and searchPatternStrin is selected
penk
parents:
4111
diff
changeset
|
4314 |
editView rememberSearchPattern:pattern. |
c7c4e3044e50
on doubleclick after search the file is opened and searchPatternStrin is selected
penk
parents:
4111
diff
changeset
|
4315 |
editView searchFwd:pattern ignoreCase:ign. |
c7c4e3044e50
on doubleclick after search the file is opened and searchPatternStrin is selected
penk
parents:
4111
diff
changeset
|
4316 |
] |
c7c4e3044e50
on doubleclick after search the file is opened and searchPatternStrin is selected
penk
parents:
4111
diff
changeset
|
4317 |
! |
c7c4e3044e50
on doubleclick after search the file is opened and searchPatternStrin is selected
penk
parents:
4111
diff
changeset
|
4318 |
|
4047
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4319 |
setContents |
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4320 |
| text| |
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4321 |
|
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4322 |
text := self getContents. |
4201 | 4323 |
text isNil ifTrue:[ ^ false]. |
4953 | 4324 |
self setContentsFor:text. |
4325 |
^ true |
|
4326 |
! |
|
4327 |
||
4328 |
setContentsFor:aText |
|
4329 |
||
4969 | 4330 |
self itemChanged value:false. |
4953 | 4331 |
self fileContentsModel value:aText. |
4071 | 4332 |
self hasMD5 ifTrue:[ |
4953 | 4333 |
md5CheckSum := self getHashForContents:aText. |
4071 | 4334 |
]. |
3892 | 4335 |
self enableReload value:false. |
4336 |
self itemChanged value:false. |
|
4045 | 4337 |
self modifiedChannel value:false. |
3892 | 4338 |
^ true |
4339 |
! |
|
4340 |
||
5417 | 4341 |
updateSameFilesFor:aFilename |
3892 | 4342 |
|
4343 |
| master modifiedApplications stream filename action| |
|
4344 |
||
4345 |
master := self masterApplication. |
|
4346 |
master notNil ifTrue:[ |
|
4347 |
modifiedApplications := master getSameFilesModifiedFor:self. |
|
4348 |
(modifiedApplications isNil or:[modifiedApplications isEmpty]) ifTrue:[^ true ]. |
|
5417 | 4349 |
filename := aFilename asString. |
3892 | 4350 |
stream := WriteStream on:''. |
4351 |
stream nextPutAll:filename. |
|
4352 |
stream nextPutAll:' is modified in tab'. |
|
4353 |
modifiedApplications size > 1 ifTrue:[ |
|
4354 |
stream nextPutAll:'s'. |
|
4355 |
]. |
|
4356 |
stream cr. |
|
4357 |
modifiedApplications do:[ : el | |
|
4358 |
stream space. |
|
4359 |
stream nextPutAll:filename. |
|
4360 |
stream space. |
|
4361 |
el sameFileIndex notNil ifTrue:[ |
|
4362 |
stream nextPutAll:el sameFileIndex asString. |
|
4363 |
]. |
|
4364 |
stream cr. |
|
4365 |
]. |
|
4366 |
stream nextPutAll:'forget changes on other tab'. |
|
4367 |
modifiedApplications size > 1 ifTrue:[ |
|
4368 |
stream nextPutAll:'s'. |
|
4369 |
]. |
|
4370 |
stream nextPutAll:' ?'. |
|
4371 |
action := Dialog |
|
4372 |
choose:stream contents |
|
4373 |
labels:#('cancel' 'no' 'yes') |
|
4374 |
values:#(#cancel #no #yes) |
|
4375 |
default:#cancel. |
|
4376 |
||
4377 |
stream close. |
|
4378 |
action == #cancel ifTrue:[ ^ false ]. |
|
4379 |
action == #yes ifTrue:[ |
|
4380 |
"/ here force reload for other applications |
|
4381 |
modifiedApplications do:[ : el | |
|
4382 |
el reload. |
|
4383 |
] |
|
4384 |
]. |
|
4385 |
]. |
|
4386 |
^ true. |
|
4387 |
! ! |
|
4388 |
||
4389 |
!FileApplicationNoteBook::TextEditor methodsFor:'aspects'! |
|
4390 |
||
5120 | 4391 |
cursorColLabelHolder |
4392 |
^ BlockValue |
|
4393 |
with:[:v | v printString] |
|
4394 |
argument:editView cursorColHolder. |
|
4395 |
! |
|
4396 |
||
4397 |
cursorLineLabelHolder |
|
4398 |
^ BlockValue |
|
4399 |
with:[:v | v printString] |
|
4400 |
argument:editView cursorLineHolder. |
|
4401 |
! |
|
4402 |
||
3892 | 4403 |
enableHexToggle |
4404 |
||
4405 |
enableHexToggle isNil ifTrue:[ |
|
4406 |
enableHexToggle := true asValue. |
|
4407 |
]. |
|
4408 |
^ enableHexToggle |
|
4409 |
! |
|
4410 |
||
4411 |
enableReload |
|
4412 |
||
4413 |
enableReload isNil ifTrue:[ |
|
4414 |
enableReload := false asValue. |
|
4415 |
"/ if your app needs to be notified of changes, uncomment one of the lines below: |
|
4416 |
"/ enableReload addDependent:self. |
|
4417 |
"/ enableReload onChangeSend:#enableReloadChanged to:self. |
|
4418 |
]. |
|
4419 |
^ enableReload. |
|
4420 |
! |
|
4421 |
||
4422 |
enableSave |
|
4423 |
||
4424 |
enableSave isNil ifTrue:[ |
|
4425 |
enableSave := false asValue. |
|
4426 |
"/ if your app needs to be notified of changes, uncomment one of the lines below: |
|
4427 |
"/ enableSave addDependent:self. |
|
4428 |
"/ enableSave onChangeSend:#enableSaveChanged to:self. |
|
4429 |
]. |
|
4430 |
^ enableSave. |
|
4431 |
! |
|
4432 |
||
4433 |
fileContentsModel |
|
4434 |
||
4435 |
fileContentsModel isNil ifTrue:[ |
|
4436 |
fileContentsModel := ValueHolder new. |
|
4437 |
"/ if your app needs to be notified of changes, uncomment one of the lines below: |
|
4438 |
"/ fileContentsModel addDependent:self. |
|
4439 |
"/ fileContentsModel onChangeSend:#fileContentsModelChanged to:self. |
|
4440 |
]. |
|
4441 |
^ fileContentsModel. |
|
4442 |
! |
|
4443 |
||
4444 |
itemChanged |
|
4445 |
||
4446 |
itemChanged isNil ifTrue:[ |
|
4447 |
itemChanged := false asValue. |
|
4448 |
itemChanged addDependent:self. |
|
4449 |
]. |
|
4450 |
^ itemChanged |
|
4451 |
! |
|
4452 |
||
4453 |
itemRemoved |
|
4454 |
||
4455 |
itemRemoved isNil ifTrue:[ |
|
4456 |
itemRemoved := false asValue. |
|
4457 |
itemRemoved addDependent:self. |
|
4458 |
]. |
|
4459 |
^ itemRemoved |
|
4460 |
! |
|
4461 |
||
5120 | 4462 |
modeLabelHolder |
4463 |
^ editView modeLabelHolder. |
|
4464 |
! |
|
4465 |
||
3892 | 4466 |
modifiedChannel |
4467 |
||
4468 |
modifiedChannel isNil ifTrue:[ |
|
4469 |
modifiedChannel := false asValue. |
|
4470 |
modifiedChannel addDependent:self. |
|
4471 |
]. |
|
4472 |
^ modifiedChannel. |
|
4473 |
! |
|
4474 |
||
4475 |
printAsHexDump |
|
4476 |
||
4477 |
printAsHexDump isNil ifTrue:[ |
|
4478 |
printAsHexDump := false asValue. |
|
4479 |
printAsHexDump addDependent:self. |
|
4480 |
]. |
|
4481 |
^ printAsHexDump. |
|
4071 | 4482 |
! |
4483 |
||
4484 |
viewModifiedChannel |
|
4485 |
||
4486 |
viewModifiedChannel isNil ifTrue:[ |
|
4487 |
viewModifiedChannel := false asValue. |
|
4488 |
viewModifiedChannel addDependent:self. |
|
4489 |
]. |
|
4490 |
^ viewModifiedChannel. |
|
3892 | 4491 |
! ! |
4492 |
||
4493 |
!FileApplicationNoteBook::TextEditor methodsFor:'change & update'! |
|
4494 |
||
4047
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4495 |
changeTextColorForChanged |
4969 | 4496 |
|text prevCursorBehavior| |
4497 |
||
4498 |
prevCursorBehavior := editView cursorMovementWhenUpdating. |
|
4499 |
editView cursorMovementWhenUpdating:nil. |
|
4500 |
||
4047
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4501 |
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
|
4502 |
text := editView contents. |
4499 | 4503 |
self fileContentsModel |
4969 | 4504 |
value:(text asText emphasizeAllWith:UserPreferences current emphasisForChangedCode). |
4047
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4505 |
[editView flash] fork. |
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4506 |
] ifFalse:[ |
5287
693e3ca577aa
avoid autoloading Archiver if an obviously non-archive is double clicked.
Claus Gittinger <cg@exept.de>
parents:
5279
diff
changeset
|
4507 |
"/ self fileContentsModel value:text string. |
4047
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4508 |
]. |
4969 | 4509 |
editView cursorMovementWhenUpdating:prevCursorBehavior. |
4510 |
"/ self fileContentsModel changed:#value. |
|
4047
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4511 |
! |
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4512 |
|
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4513 |
itemModified |
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4514 |
|
4161 | 4515 |
| modified outDated removed| |
3892 | 4516 |
|
4517 |
modified := self modifiedChannel value. |
|
4161 | 4518 |
outDated := self itemChanged value. |
3892 | 4519 |
removed := self itemRemoved value. |
4520 |
||
4161 | 4521 |
((modified or:[outDated]) or:[removed]) ifTrue:[ |
4522 |
modified ifTrue:[ |
|
4523 |
self changeInformationForModified:#modified. |
|
4524 |
]. |
|
4525 |
outDated ifTrue:[ |
|
4526 |
self changeInformationForModified:#outDated. |
|
4527 |
]. |
|
4528 |
removed ifTrue:[ |
|
4529 |
self changeInformationForModified:#removed. |
|
4530 |
]. |
|
4531 |
] ifFalse:[ |
|
4532 |
self changeInformationForModified:#unchanged. |
|
4533 |
]. |
|
4534 |
self enableReload value:((modified or:[outDated]) and:[removed not]). |
|
3892 | 4535 |
! |
4536 |
||
4537 |
update:something with:aParameter from:changedObject |
|
4969 | 4538 |
|itemRem contMd5CheckSum viewModified p| |
4071 | 4539 |
|
4540 |
changedObject == self viewModifiedChannel ifTrue:[ |
|
4541 |
viewModified := changedObject value. |
|
4542 |
self hasMD5 ifTrue:[ |
|
4543 |
self viewModifiedChannel value:false withoutNotifying:self. |
|
4544 |
viewModified ifTrue:[ |
|
4969 | 4545 |
(p := md5HashValueComputationProcess) notNil ifTrue:[ |
4546 |
p terminate. |
|
4547 |
]. |
|
4548 |
md5HashValueComputationProcess := |
|
4549 |
[ |
|
4550 |
contMd5CheckSum := self getHashForContents:(editView list). |
|
4551 |
self modifiedChannel value:(contMd5CheckSum ~= md5CheckSum). |
|
4552 |
md5HashValueComputationProcess := nil. |
|
4553 |
] newProcess. |
|
4554 |
md5HashValueComputationProcess priority:(Processor userBackgroundPriority). |
|
4555 |
md5HashValueComputationProcess resume. |
|
4071 | 4556 |
]. |
4969 | 4557 |
] ifFalse:[ |
4558 |
self modifiedChannel value:viewModified. |
|
4559 |
] |
|
4071 | 4560 |
]. |
3892 | 4561 |
changedObject == self modifiedChannel ifTrue:[ |
4969 | 4562 |
self enableSave value:changedObject value. |
4047
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4563 |
self itemModified. |
3892 | 4564 |
^ self |
4565 |
]. |
|
4566 |
changedObject == self itemRemoved ifTrue:[ |
|
4567 |
itemRem := changedObject value. |
|
4969 | 4568 |
self enableSave value:(itemRem ? false). |
3892 | 4569 |
self enableHexToggle value:itemRem not. |
4047
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4570 |
self itemModified. |
3892 | 4571 |
^ self |
4572 |
]. |
|
4573 |
changedObject == self itemChanged ifTrue:[ |
|
4969 | 4574 |
self enqueueMessage:#changeTextColorForChanged for:self arguments:nil. |
4047
e432ab54d1e7
contents color changed to red if modified by someone else
penk
parents:
4045
diff
changeset
|
4575 |
self itemModified. |
3892 | 4576 |
^ self |
4577 |
]. |
|
5197 | 4578 |
|
3892 | 4579 |
changedObject == self printAsHexDump ifTrue:[ |
5197 | 4580 |
AbortOperationRequest handle:[:ex | |
4581 |
self printAsHexDump value:false withoutNotifying:self. |
|
4582 |
^ self. |
|
4583 |
] do:[ |
|
5198
ea3f838e1353
do not attempt to reload when closing
Claus Gittinger <cg@exept.de>
parents:
5197
diff
changeset
|
4584 |
self askForChangeWithReload:true. |
3892 | 4585 |
]. |
5197 | 4586 |
self presentation:(changedObject value ifTrue:[#hexDump] ifFalse:[#asText]). |
3892 | 4587 |
self changeInformation. |
4588 |
self setContents. |
|
4621 | 4589 |
editView notNil ifTrue:[ |
5197 | 4590 |
editView readOnly:(self presentation == #hexDump). |
3892 | 4591 |
]. |
4621 | 4592 |
^ self |
3892 | 4593 |
]. |
4594 |
||
4595 |
super update:something with:aParameter from:changedObject |
|
4596 |
! ! |
|
4597 |
||
4598 |
!FileApplicationNoteBook::TextEditor methodsFor:'printing'! |
|
4599 |
||
4600 |
printString |
|
4601 |
||
4602 |
^ ('TextEditor for:', self fileName baseName) |
|
4603 |
! ! |
|
4604 |
||
4605 |
!FileApplicationNoteBook::TextEditor methodsFor:'privat-process'! |
|
4606 |
||
4969 | 4607 |
checkItemForChanges |
5417 | 4608 |
|dir exist myItem time| |
3892 | 4609 |
|
4610 |
dir := self fileName directory. |
|
4611 |
myItem := self item. |
|
4612 |
exist := myItem exists. |
|
4613 |
self itemRemoved value:(exist not). |
|
4614 |
exist ifTrue:[ |
|
4969 | 4615 |
time := self fileName modificationTime. |
4616 |
textEditorModificationTime isNil ifTrue:[ |
|
4617 |
textEditorModificationTime := time. |
|
4608
990e5559a904
md5 computation fixed and tuned
Claus Gittinger <cg@exept.de>
parents:
4572
diff
changeset
|
4618 |
]. |
4969 | 4619 |
(textEditorModificationTime ~= time) ifTrue:[ |
4620 |
"/ contents changed by someone else |
|
4621 |
self notify:(resources string:'%1 was changed by someone else.' with:item fileName baseName allBold). |
|
4622 |
self itemChanged value:true. |
|
5417 | 4623 |
] ifFalse:[ |
4624 |
(resources string:'%1 was changed by someone else.' with:item fileName baseName allBold) = self notifyChannel value ifTrue:[ |
|
4625 |
self notify:''. |
|
4626 |
]. |
|
4969 | 4627 |
]. |
3892 | 4628 |
]. |
4969 | 4629 |
self setupCheckModify. |
4630 |
! |
|
4631 |
||
4977
621cc3cb454d
checkModify have to reset the mofication time for the file after file change in TextEditor
penk
parents:
4971
diff
changeset
|
4632 |
releaseCheckModify |
621cc3cb454d
checkModify have to reset the mofication time for the file after file change in TextEditor
penk
parents:
4971
diff
changeset
|
4633 |
|
621cc3cb454d
checkModify have to reset the mofication time for the file after file change in TextEditor
penk
parents:
4971
diff
changeset
|
4634 |
Processor removeTimedBlock:checkModifiedBlock. |
621cc3cb454d
checkModify have to reset the mofication time for the file after file change in TextEditor
penk
parents:
4971
diff
changeset
|
4635 |
! |
621cc3cb454d
checkModify have to reset the mofication time for the file after file change in TextEditor
penk
parents:
4971
diff
changeset
|
4636 |
|
4969 | 4637 |
setupCheckModify |
4638 |
||
4639 |
Processor addTimedBlock:checkModifiedBlock afterSeconds:3. |
|
3892 | 4640 |
! ! |
4641 |
||
4642 |
!FileApplicationNoteBook::TextEditor methodsFor:'queries'! |
|
4643 |
||
4071 | 4644 |
hasMD5 |
4645 |
^ ( MD5Stream notNil and:[MD5Stream isLoaded]) |
|
4646 |
! |
|
4647 |
||
3892 | 4648 |
isModified |
5317 | 4649 |
^ self modifiedChannel value |
4650 |
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
|
4651 |
! |
c7c4e3044e50
on doubleclick after search the file is opened and searchPatternStrin is selected
penk
parents:
4111
diff
changeset
|
4652 |
|
c7c4e3044e50
on doubleclick after search the file is opened and searchPatternStrin is selected
penk
parents:
4111
diff
changeset
|
4653 |
isTextEditor |
c7c4e3044e50
on doubleclick after search the file is opened and searchPatternStrin is selected
penk
parents:
4111
diff
changeset
|
4654 |
|
c7c4e3044e50
on doubleclick after search the file is opened and searchPatternStrin is selected
penk
parents:
4111
diff
changeset
|
4655 |
^ true |
3892 | 4656 |
! ! |
4657 |
||
4658 |
!FileApplicationNoteBook::TextEditor methodsFor:'startup & release'! |
|
4659 |
||
4660 |
closeRequest |
|
4661 |
||
4662 |
(self doClose) ifTrue:[ |
|
4663 |
^ super closeRequest. |
|
4105 | 4664 |
|
3892 | 4665 |
]. |
4666 |
! |
|
4667 |
||
4668 |
postBuildTextEditor:aWidget |
|
4669 |
editView := aWidget scrolledView. |
|
5430 | 4670 |
editView saveAction:[ self doSaveAs ]. |
4671 |
||
5417 | 4672 |
aWidget modifiedChannel:self viewModifiedChannel. |
3892 | 4673 |
! |
4674 |
||
4675 |
postBuildWith:aBuilder |
|
4676 |
||
4677 |
super postBuildWith:aBuilder. |
|
4678 |
! |
|
4679 |
||
4680 |
postOpenWith:aBuilder |
|
4681 |
||
5120 | 4682 |
"/ self item isNil ifTrue:[ |
4683 |
"/ self item:(DirectoryContentsBrowser itemClass fileName:(Filename homeDirectory construct:'.bashrc')). |
|
4684 |
"/ ]. |
|
3892 | 4685 |
self setUpTextView. |
4686 |
self changeInformation. |
|
4687 |
^ super postOpenWith:aBuilder |
|
4688 |
! |
|
4689 |
||
4690 |
release |
|
4691 |
"release my resources |
|
4692 |
" |
|
4977
621cc3cb454d
checkModify have to reset the mofication time for the file after file change in TextEditor
penk
parents:
4971
diff
changeset
|
4693 |
self releaseCheckModify. |
4969 | 4694 |
checkModifiedBlock := nil. |
3892 | 4695 |
super release. |
4696 |
! |
|
4697 |
||
4698 |
setUpTextView |
|
4945 | 4699 |
"change the parenthesis-spec of the editor to include $< .. $> if the |
4700 |
shown document is an html- or xml document" |
|
4701 |
||
4702 |
|item mimeType parenthesis col| |
|
4703 |
||
4704 |
item := self item. |
|
4705 |
item notNil ifTrue:[ |
|
4706 |
item hasMimeType ifFalse:[^nil]. |
|
4707 |
mimeType := item mimeType. |
|
4708 |
||
4709 |
(mimeType isHtml or:[mimeType isXml]) ifTrue:[ |
|
4710 |
parenthesis := editView parenthesisSpecification copy. |
|
4711 |
((parenthesis at:#open) includes:$<) ifFalse:[ |
|
4712 |
col := ((parenthesis at:#open) asOrderedCollection). |
|
4392 | 4713 |
col add:$<. |
4945 | 4714 |
parenthesis at:#open put:col. |
4715 |
||
4716 |
col := ((parenthesis at:#close) asOrderedCollection). |
|
4946 | 4717 |
col add:$>. |
4945 | 4718 |
parenthesis at:#close put:col. |
4719 |
||
4720 |
editView parenthesisSpecification:parenthesis |
|
4392 | 4721 |
]. |
3892 | 4722 |
]. |
4392 | 4723 |
] |
3892 | 4724 |
! ! |
4725 |
||
4726 |
!FileApplicationNoteBook::XViewApplication class methodsFor:'defaults'! |
|
4727 |
||
4728 |
maxNumberOfVNCRestarts |
|
4729 |
||
4730 |
^ 10 |
|
4731 |
! |
|
4732 |
||
4733 |
mimeTypeUnixApplicationMapping |
|
4734 |
||
4735 |
" here insert the application and mime type pairs to open by XviewApplication |
|
4736 |
" |
|
4737 |
||
4738 |
^ |
|
4739 |
#( |
|
4740 |
#(#'application/postscript' #gv ) |
|
4741 |
#(#'application/pdf' #acroread ) |
|
4742 |
) |
|
4743 |
! |
|
4744 |
||
4745 |
tabStringFor:aApplicationType |
|
4746 |
||
4747 |
^ 'VNC for:' |
|
4748 |
! |
|
4749 |
||
4336
b4228ddf2183
change level of buttons bfor notebook applications and remove directory for label of terminal app
penk
parents:
4293
diff
changeset
|
4750 |
unixVNCCommand |
b4228ddf2183
change level of buttons bfor notebook applications and remove directory for label of terminal app
penk
parents:
4293
diff
changeset
|
4751 |
|
b4228ddf2183
change level of buttons bfor notebook applications and remove directory for label of terminal app
penk
parents:
4293
diff
changeset
|
4752 |
^ 'Xvnc' |
b4228ddf2183
change level of buttons bfor notebook applications and remove directory for label of terminal app
penk
parents:
4293
diff
changeset
|
4753 |
! |
b4228ddf2183
change level of buttons bfor notebook applications and remove directory for label of terminal app
penk
parents:
4293
diff
changeset
|
4754 |
|
3892 | 4755 |
wantNewApplicationAnyway |
4756 |
||
4500
9f0b8d6ae2be
make a new XView for a new item if an XView already open
penk
parents:
4499
diff
changeset
|
4757 |
^ true |
3892 | 4758 |
! ! |
4759 |
||
4760 |
!FileApplicationNoteBook::XViewApplication class methodsFor:'interface specs'! |
|
4761 |
||
4762 |
windowSpec |
|
4763 |
"This resource specification was automatically generated |
|
4764 |
by the UIPainter of ST/X." |
|
4765 |
||
4766 |
"Do not manually edit this!! If it is corrupted, |
|
4767 |
the UIPainter may not be able to read the specification." |
|
4768 |
||
4769 |
" |
|
4336
b4228ddf2183
change level of buttons bfor notebook applications and remove directory for label of terminal app
penk
parents:
4293
diff
changeset
|
4770 |
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
|
4771 |
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
|
4772 |
FileApplicationNoteBook::XViewApplication open |
3892 | 4773 |
" |
4774 |
||
4775 |
<resource: #canvas> |
|
4776 |
||
4777 |
^ |
|
4778 |
#(#FullSpec |
|
4779 |
#name: #windowSpec |
|
4780 |
#window: |
|
4781 |
#(#WindowSpec |
|
4782 |
#label: 'XView' |
|
4783 |
#name: 'XView' |
|
4784 |
#min: #(#Point 10 10) |
|
4785 |
#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
|
4786 |
#bounds: #(#Rectangle 16 42 692 534) |
3892 | 4787 |
#menu: #mainMenu |
4788 |
) |
|
4789 |
#component: |
|
4790 |
#(#SpecCollection |
|
4791 |
#collection: #( |
|
4792 |
#(#MenuPanelSpec |
|
4261 | 4793 |
#name: 'MenuVNC' |
3892 | 4794 |
#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
|
4795 |
#level: 0 |
3892 | 4796 |
#visibilityChannel: #isEmbeddedApplication |
4797 |
#menu: #menu |
|
4798 |
#textDefault: true |
|
4799 |
) |
|
4800 |
#(#ArbitraryComponentSpec |
|
4261 | 4801 |
#name: 'VNCView' |
3892 | 4802 |
#layout: #(#LayoutFrame 0 0.0 32 0.0 0 1.0 0 1.0) |
4803 |
#hasHorizontalScrollBar: true |
|
4804 |
#hasVerticalScrollBar: true |
|
4805 |
#miniScrollerHorizontal: false |
|
4806 |
#miniScrollerVertical: false |
|
4807 |
#hasBorder: false |
|
4808 |
#component: #VNCFrameBufferView |
|
4809 |
#postBuildCallback: #postBuildXView: |
|
4810 |
) |
|
4811 |
) |
|
4812 |
||
4813 |
) |
|
4814 |
) |
|
4815 |
! ! |
|
4816 |
||
4817 |
!FileApplicationNoteBook::XViewApplication class methodsFor:'menu specs'! |
|
4818 |
||
4819 |
menu |
|
4820 |
"This resource specification was automatically generated |
|
4821 |
by the MenuEditor of ST/X." |
|
4822 |
||
4823 |
"Do not manually edit this!! If it is corrupted, |
|
4824 |
the MenuEditor may not be able to read the specification." |
|
4825 |
||
4826 |
" |
|
4827 |
MenuEditor new openOnClass:NoteBookApplication::ImageViewApplication andSelector:#menu |
|
4828 |
(Menu new fromLiteralArrayEncoding:(NoteBookApplication::ImageViewApplication menu)) startUp |
|
4829 |
" |
|
4830 |
||
4831 |
<resource: #menu> |
|
4832 |
||
4833 |
^ |
|
4834 |
#(#Menu |
|
4835 |
#( |
|
4836 |
#(#MenuItem |
|
4837 |
#label: 'Close' |
|
4838 |
#translateLabel: true |
|
4839 |
#isButton: true |
|
4840 |
#hideMenuOnActivated: false |
|
4841 |
#startGroup: #right |
|
4842 |
#value: #doClose |
|
4843 |
#labelImage: #(#ResourceRetriever #AbstractFileBrowser #closeIcon) |
|
4844 |
) |
|
4845 |
) |
|
4846 |
nil |
|
4847 |
nil |
|
4848 |
) |
|
4849 |
! ! |
|
4850 |
||
4851 |
!FileApplicationNoteBook::XViewApplication class methodsFor:'queries'! |
|
4852 |
||
5008 | 4853 |
canOpenItem:anItem |
5265 | 4854 |
| keySym| |
3892 | 4855 |
|
5008 | 4856 |
keySym := anItem mimeType asSymbol. |
4857 |
OperatingSystem isUNIXlike ifFalse:[^ false]. |
|
4858 |
||
5265 | 4859 |
(self mimeTypeUnixApplicationMapping contains:[ : el | (el at:1) == keySym ]) ifFalse:[^ false]. |
5008 | 4860 |
|
4861 |
(OperatingSystem executeCommand:('which ', self unixVNCCommand)) ifFalse:[ |
|
4862 |
Dialog warn:'Cannot start a viewer for ' , anItem fileName baseName. |
|
4863 |
^ false. |
|
3892 | 4864 |
]. |
5008 | 4865 |
|
4866 |
VNCFrameBufferView notNil ifFalse:[ |
|
4867 |
Dialog warn:'VNC support classes are missing (package not loaded?)'. |
|
4868 |
^ false. |
|
4869 |
]. |
|
4870 |
^ true |
|
3892 | 4871 |
! ! |
4872 |
||
4873 |
!FileApplicationNoteBook::XViewApplication methodsFor:'accessing'! |
|
4874 |
||
4875 |
xView |
|
4876 |
"return the value of the instance variable 'imageView' (automatically generated)" |
|
4877 |
||
4878 |
^ xView |
|
4879 |
! |
|
4880 |
||
4881 |
xView:something |
|
4882 |
"set the value of the instance variable 'imageView' (automatically generated)" |
|
4883 |
||
4884 |
xView := something. |
|
4885 |
! ! |
|
4886 |
||
4887 |
!FileApplicationNoteBook::XViewApplication methodsFor:'actions'! |
|
4888 |
||
4889 |
changeInformation |
|
4890 |
||
4891 |
| stream| |
|
4892 |
||
4893 |
stream := WriteStream on:''. |
|
4894 |
stream nextPutAll:'XView on: '. |
|
4895 |
stream nextPutAll:self fileName baseName. |
|
4896 |
masterApplication isNil ifTrue:[ |
|
4897 |
self window label:stream contents. |
|
4898 |
||
4899 |
] ifFalse:[ |
|
4900 |
masterApplication tabStringChangeTo:stream contents for:self. |
|
4901 |
]. |
|
4902 |
stream close. |
|
4903 |
! |
|
4904 |
||
4905 |
setupXView |
|
4906 |
||
3906 | 4907 |
|xExt yExt mainView| |
3892 | 4908 |
|
4909 |
self startVNCserver. |
|
4910 |
xExt := self xView width asString. |
|
3906 | 4911 |
self masterApplication notNil ifTrue:[ |
4912 |
mainView := self builder windowGroup mainView. |
|
4913 |
"/ if the mainView is a FileBrowser take them y extent because size of notebook can be changed |
|
4914 |
(mainView application class == (Smalltalk at:#FileBrowserV2 ifAbsent:nil)) notNil ifTrue:[ |
|
4915 |
yExt := mainView height asString. |
|
4916 |
]. |
|
4917 |
]. |
|
4918 |
yExt isNil ifTrue:[ |
|
3892 | 4919 |
yExt := self xView height asString. |
4920 |
]. |
|
4921 |
ext := xExt, 'x', yExt. |
|
4922 |
self startViewer. |
|
4923 |
! ! |
|
4924 |
||
4925 |
!FileApplicationNoteBook::XViewApplication methodsFor:'actions VNC'! |
|
4926 |
||
4927 |
setupView |
|
4928 |
| renderer view| |
|
4929 |
||
4930 |
view := xView. |
|
4931 |
renderer := VNCRenderer for:vncConnection targetWindow:view device:xView device. |
|
4932 |
||
4933 |
view renderer:renderer. |
|
4934 |
view connection:vncConnection. |
|
4935 |
||
4936 |
VNCException handle:[:ex| |
|
4937 |
self stopViewer. |
|
4938 |
] do:[ |
|
4939 |
vncConnection |
|
4940 |
startMessageHandlerProcessForRenderer:renderer |
|
4941 |
errorHandler:[:ex | self stopViewer]. |
|
4942 |
]. |
|
4943 |
! |
|
4944 |
||
4945 |
startVNCserver |
|
4946 |
|cmd blocked connected numberOfVncStarts| |
|
4947 |
||
5008 | 4948 |
|
4949 |
VNCAuthenticationFailure isNil ifTrue:[ |
|
4950 |
Dialog warn:'VNC Classes missing (package not laoded ?)'. |
|
4951 |
^ self. |
|
4952 |
]. |
|
4953 |
||
3892 | 4954 |
connected := false. |
4955 |
numberOfVncStarts isNil ifTrue:[ |
|
4956 |
numberOfVncStarts := 1. |
|
4957 |
] ifFalse:[ |
|
4958 |
numberOfVncStarts := numberOfVncStarts + 1. |
|
4959 |
]. |
|
4960 |
||
4961 |
vncLock isNil ifTrue:[vncLock := Semaphore forMutualExclusion]. |
|
4962 |
||
4963 |
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
|
4964 |
cmd := ('/usr/X11R6/bin/', self class unixVNCCommand). |
3892 | 4965 |
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
|
4966 |
cmd := self class unixVNCCommand. |
3892 | 4967 |
]. |
4968 |
vncPortNr isNil ifTrue:[ |
|
4969 |
vncPortNr := 29 |
|
4970 |
]. |
|
4971 |
cmd := cmd , ' :' , vncPortNr printString , ' nologo -nevershared -localhost -depth 16 -geometry 1024x1024'. |
|
4972 |
||
4973 |
blocked := OperatingSystem blockInterrupts. |
|
4974 |
||
4975 |
vncServerPID := Processor |
|
4976 |
monitor:[ |
|
4977 |
vncServerIsTerminated := false. |
|
4978 |
OperatingSystem |
|
4979 |
exec:'/bin/sh' |
|
4980 |
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
|
4981 |
environment:nil |
3892 | 4982 |
fileDescriptors:#() |
4983 |
fork:true |
|
4984 |
newPgrp:true |
|
4985 |
inDirectory:nil. |
|
4986 |
] |
|
4987 |
action:[:status | |
|
4988 |
status stillAlive ifFalse:[ |
|
4989 |
OperatingSystem closePid:vncServerPID. |
|
4990 |
vncLock critical:[ |
|
4991 |
vncServerPID := nil. |
|
4992 |
self vncServerTerminated. |
|
4993 |
]. |
|
4994 |
]. |
|
4995 |
]. |
|
4996 |
||
4997 |
blocked ifFalse:[ |
|
4998 |
OperatingSystem unblockInterrupts |
|
4999 |
]. |
|
5000 |
]. |
|
5001 |
||
5002 |
self waitForTerminationOfServer ifTrue:[ |
|
5003 |
"/ Transcript showCR:'server has terminated really - try with next port'. |
|
5004 |
(numberOfVncStarts < self class maxNumberOfVNCRestarts) ifTrue:[ |
|
5005 |
vncPortNr := vncPortNr + 1. |
|
5006 |
"/ Transcript showCR:'try next port ', vncPortNr asString. |
|
5007 |
self startVNCserver. |
|
5008 |
] ifFalse:[ |
|
5009 |
Dialog warn:'have started servers from port ' |
|
5010 |
, (vncPortNr - self class maxNumberOfVNCRestarts) asString |
|
5011 |
, ' to ' |
|
5012 |
, vncPortNr |
|
5013 |
, ' - cant connect anyway'. |
|
5014 |
"/ Transcript showCR:'have started servers from port ', vncPortNr - self class maxNumberOfVNCRestarts, ' to ', vncPortNr. |
|
5015 |
]. |
|
5016 |
] ifFalse:[ |
|
5017 |
vncLock critical:[ |
|
5018 |
vncServerPID isNil ifTrue:[ |
|
5019 |
Dialog warn:'Cannot start Xvnc'. |
|
5020 |
] ifFalse:[ |
|
5021 |
VNCAuthenticationFailure handle:[:ex | |
|
5022 |
Dialog warn:'Wrong password'. |
|
5023 |
] do:[ |
|
5024 |
connected := self vncConnect. |
|
5025 |
]. |
|
5026 |
connected ifTrue:[self setupView]. |
|
5027 |
]. |
|
5028 |
]. |
|
5029 |
]. |
|
5030 |
! |
|
5031 |
||
5032 |
stopVNCServer |
|
5259 | 5033 |
|pid| |
5034 |
||
5035 |
(pid := vncServerPID) notNil ifTrue:[ |
|
5036 |
OperatingSystem terminateProcess:pid. |
|
3892 | 5037 |
Delay waitForSeconds:0.2. |
5038 |
vncServerPID notNil ifTrue:[ |
|
5259 | 5039 |
OperatingSystem killProcess:pid. |
3892 | 5040 |
vncServerPID := nil. |
5041 |
]. |
|
5259 | 5042 |
OperatingSystem closePid:pid |
3892 | 5043 |
]. |
5044 |
self vncServerTerminated. |
|
5045 |
! |
|
5046 |
||
5047 |
vncConnect |
|
5048 |
| tryConnects| |
|
5049 |
||
5050 |
vncConnection notNil ifTrue:[ |
|
5051 |
vncConnection close |
|
5052 |
]. |
|
5053 |
||
5054 |
vncConnection := VNCServerConnection new. |
|
5055 |
tryConnects := 1. |
|
5056 |
[tryConnects < 3] whileTrue:[ |
|
5057 |
VNCConnectionFailure handle:[:ex | |
|
5058 |
Delay waitForSeconds:0.5. |
|
5059 |
tryConnects := tryConnects + 1. |
|
5060 |
] do:[ |
|
5061 |
vncConnection connectTo:'localhost' port:vncPortNr. |
|
5062 |
^ true. |
|
5063 |
]. |
|
5064 |
]. |
|
5065 |
^ false |
|
5066 |
! |
|
5067 |
||
5068 |
vncServerTerminated |
|
5069 |
"/ Transcript showCR:'vnc server has terminated'. |
|
5070 |
"/ 'vnc server has terminated' errorPrintCR. |
|
5071 |
"/ Dialog information:'vnc server has terminated'. |
|
5072 |
||
5073 |
self stopViewer. |
|
5074 |
vncConnection notNil ifTrue:[ |
|
5075 |
vncConnection close. |
|
5076 |
vncConnection := nil |
|
5077 |
]. |
|
5078 |
vncServerIsTerminated := true. |
|
5079 |
! |
|
5080 |
||
5081 |
waitForTerminationOfServer |
|
5082 |
| cycles | |
|
5083 |
||
5084 |
cycles := 1. |
|
5085 |
[vncServerIsTerminated] whileFalse:[ |
|
5086 |
(cycles > 3) ifTrue:[^ false]. |
|
5087 |
cycles := cycles + 1. |
|
5088 |
Delay waitForSeconds:0.5. |
|
5089 |
]. |
|
5090 |
^ true |
|
5091 |
! ! |
|
5092 |
||
5093 |
!FileApplicationNoteBook::XViewApplication methodsFor:'actions viewer'! |
|
5094 |
||
5095 |
startViewer |
|
5096 |
|cmd keySym applItem | |
|
5097 |
||
5098 |
keySym := self item mimeType asSymbol. |
|
5099 |
applItem := self class mimeTypeUnixApplicationMapping detect:[ : el | (el at:1) == keySym ] ifNone:[nil]. |
|
5100 |
applItem isNil ifTrue:[ ^ self]. |
|
5101 |
||
5102 |
cmd := (applItem at:2) asString, ' -geometry ', ext, ' -display :' , vncPortNr printString , ' ' , self fileName asString. |
|
5103 |
self startViewer:cmd |
|
5104 |
! |
|
5105 |
||
5106 |
startViewer:viewerCommand |
|
5107 |
|blocked| |
|
5108 |
||
5109 |
viewerPID notNil ifTrue:[ |
|
5110 |
^ self |
|
5111 |
]. |
|
5112 |
||
5113 |
blocked := OperatingSystem blockInterrupts. |
|
5114 |
||
5115 |
viewerPID := Processor |
|
5116 |
monitor:[ |
|
5117 |
OperatingSystem |
|
5118 |
exec:'/bin/sh' |
|
5119 |
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
|
5120 |
environment:nil |
3892 | 5121 |
fileDescriptors:#() |
5122 |
fork:true |
|
5123 |
newPgrp:true |
|
5124 |
inDirectory:nil. |
|
5125 |
] |
|
5126 |
action:[:status | |
|
5127 |
status stillAlive ifFalse:[ |
|
5128 |
OperatingSystem closePid:viewerPID. |
|
5129 |
viewerPID := nil. |
|
5130 |
self viewerTerminated. |
|
5131 |
]. |
|
5132 |
]. |
|
5133 |
||
5134 |
blocked ifFalse:[ |
|
5135 |
OperatingSystem unblockInterrupts |
|
5136 |
]. |
|
5137 |
||
5138 |
viewerPID isNil ifTrue:[ |
|
5139 |
Dialog warn:'Cannot start ', viewerCommand. |
|
5140 |
]. |
|
5141 |
! |
|
5142 |
||
5143 |
startXterm |
|
5144 |
|cmd| |
|
5145 |
||
5146 |
cmd := 'xterm -geometry 600x800 -display :' , vncPortNr printString. |
|
5147 |
self startViewer:cmd |
|
5148 |
! |
|
5149 |
||
5150 |
stopViewer |
|
5259 | 5151 |
|pid| |
5152 |
||
5153 |
(pid := viewerPID) notNil ifTrue:[ |
|
5154 |
OperatingSystem terminateProcess:pid. |
|
3892 | 5155 |
Delay waitForSeconds:0.2. |
5156 |
viewerPID notNil ifTrue:[ |
|
5259 | 5157 |
OperatingSystem killProcess:pid. |
3892 | 5158 |
viewerPID := nil. |
5259 | 5159 |
]. |
5160 |
OperatingSystem closePid:pid |
|
3892 | 5161 |
]. |
5162 |
! |
|
5163 |
||
5164 |
viewerTerminated |
|
5165 |
"/ Transcript showCR:'viewer has terminated'. |
|
5166 |
"/ 'viewer has terminated' errorPrintCR. |
|
5167 |
"/ Dialog information:'viewer has terminated'. |
|
5168 |
! ! |
|
5169 |
||
5170 |
!FileApplicationNoteBook::XViewApplication methodsFor:'initialization & release'! |
|
5171 |
||
5172 |
postBuildXView:aWidget |
|
5173 |
||
5174 |
self xView:aWidget scrolledView. |
|
5175 |
self xView wantsFocusWithPointerEnter. |
|
5176 |
aWidget autoHideScrollBars:true. |
|
5177 |
! |
|
5178 |
||
5179 |
postOpenWith:aBuilder |
|
5180 |
" |
|
5181 |
only invoked if the application not started from a master |
|
5182 |
" |
|
5183 |
||
5184 |
|currentDir contents suffix fileName| |
|
5185 |
||
5186 |
self masterApplication isNil ifTrue:[ |
|
5187 |
self masterApplication:nil. |
|
5188 |
currentDir := Filename homeDirectory. |
|
5189 |
contents := currentDir directoryContents. |
|
5190 |
fileName := contents |
|
5191 |
detect:[:file | |
|
5192 |
suffix := file asFilename suffix asLowercase. |
|
5193 |
suffix = 'pdf' |
|
5194 |
] |
|
5195 |
ifNone:[nil]. |
|
5196 |
fileName isNil ifTrue:[ |
|
5197 |
Dialog warn:'cant find a PDF File in ' , currentDir asString. |
|
5198 |
^ self |
|
5199 |
]. |
|
3982 | 5200 |
self item:(DirectoryContentsBrowser itemClass fileName:(currentDir construct:fileName)). |
3892 | 5201 |
]. |
5202 |
self changeInformation. |
|
5203 |
self setupXView. |
|
5204 |
^ super postOpenWith:aBuilder |
|
5205 |
! |
|
5206 |
||
5207 |
release |
|
5208 |
"/Transcript showCR:'release'. |
|
5209 |
self stopViewer. |
|
5210 |
self stopVNCServer. |
|
5211 |
^ super release |
|
5212 |
! ! |
|
5213 |
||
5214 |
!FileApplicationNoteBook class methodsFor:'documentation'! |
|
5215 |
||
5216 |
version |
|
5430 | 5217 |
^ '$Header: /cvs/stx/stx/libtool/FileApplicationNoteBook.st,v 1.134 2004-01-15 08:48:53 penk Exp $' |
3892 | 5218 |
! ! |