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