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