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