11 " |
11 " |
12 |
12 |
13 "{ Package: 'stx:libtool' }" |
13 "{ Package: 'stx:libtool' }" |
14 |
14 |
15 StandardSystemView subclass:#FileBrowser |
15 StandardSystemView subclass:#FileBrowser |
16 instanceVariableNames:'menuPanel labelView filterField fileListView subView |
16 instanceVariableNames:'menuPanel labelView filterField fileListView subView |
17 currentDirectory fileList checkBlock checkDelta timeOfLastCheck |
17 currentDirectory fileList checkBlock checkDelta timeOfLastCheck |
18 myName killButton pauseToggle compressTabs lockUpdate |
18 myName killButton pauseToggle compressTabs lockUpdate |
19 previousDirectory currentFileName timeOfFileRead tabSpec |
19 previousDirectory currentFileName timeOfFileRead tabSpec |
20 commandView commandIndex fileEncoding tabRulerView scrollView |
20 commandView commandIndex fileEncoding tabRulerView scrollView |
21 icons listUpdateProcess currentFileInFileName |
21 icons listUpdateProcess currentFileInFileName |
22 lastFileDiffDirectory sortByWhat sortCaseless showingDetails |
22 lastFileDiffDirectory sortByWhat sortCaseless showingDetails |
23 showingHiddenFiles showingBigImagePreview imagePreviewView |
23 showingTimeAndDate showingHiddenFiles showingBigImagePreview |
24 imageRenderProcess dosEOLMode doAutoUpdate doNotShowFontDialog' |
24 imagePreviewView imageRenderProcess dosEOLMode doAutoUpdate |
25 classVariableNames:'DirectoryHistory DirectoryHistoryWhere HistorySize DefaultIcon |
25 doNotShowFontDialog' |
26 CommandHistory CommandHistorySize Icons DefaultCommandPerSuffix |
26 classVariableNames:'DirectoryHistory DirectoryHistoryWhere DirectoryBookmarks |
27 DefaultCommandPerMIME VisitedFileHistory' |
27 HistorySize DefaultIcon CommandHistory CommandHistorySize Icons |
28 poolDictionaries:'' |
28 DefaultCommandPerSuffix DefaultCommandPerMIME VisitedFileHistory' |
29 category:'Interface-Browsers' |
29 poolDictionaries:'' |
|
30 category:'Interface-Browsers' |
30 ! |
31 ! |
31 |
32 |
32 !FileBrowser class methodsFor:'documentation'! |
33 !FileBrowser class methodsFor:'documentation'! |
33 |
34 |
34 copyright |
35 copyright |
35 " |
36 " |
36 COPYRIGHT (c) 1991 by Claus Gittinger |
37 COPYRIGHT (c) 1991 by Claus Gittinger |
37 All Rights Reserved |
38 All Rights Reserved |
38 |
39 |
39 This software is furnished under a license and may be used |
40 This software is furnished under a license and may be used |
40 only in accordance with the terms of that license and with the |
41 only in accordance with the terms of that license and with the |
41 inclusion of the above copyright notice. This software may not |
42 inclusion of the above copyright notice. This software may not |
42 be provided or otherwise made available to, or used by, any |
43 be provided or otherwise made available to, or used by, any |
56 were not available) |
57 were not available) |
57 |
58 |
58 See additional information in 'doc/misc/fbrowser.doc'. |
59 See additional information in 'doc/misc/fbrowser.doc'. |
59 |
60 |
60 WARNING: files edited with FileBrowser will have leading spaces (multiple-8) |
61 WARNING: files edited with FileBrowser will have leading spaces (multiple-8) |
61 being replaced by tabs. If tabs are to be preserved at other |
62 being replaced by tabs. If tabs are to be preserved at other |
62 positions (for example, sendmail-config files) they will be |
63 positions (for example, sendmail-config files) they will be |
63 corrupt after being written. |
64 corrupt after being written. |
64 |
65 |
65 [instance variables]: |
66 [instance variables]: |
66 |
67 |
67 checkDelta <Integer> number of seconds of check interval |
68 checkDelta <Integer> number of seconds of check interval |
68 (looks ever so often if shown directory |
69 (looks ever so often if shown directory |
69 has changed). You may make this number |
70 has changed). You may make this number |
70 higher, if your network-times are |
71 higher, if your network-times are |
71 incorrect and thus, the filebrowser |
72 incorrect and thus, the filebrowser |
72 checks too often. |
73 checks too often. |
73 |
74 |
74 compressTabs <Boolean> if true, leading spaces will be |
75 compressTabs <Boolean> if true, leading spaces will be |
75 replaced by tabs when saving text |
76 replaced by tabs when saving text |
76 |
77 |
77 some of the defaults (long/short list etc.) can be set by the resource file; |
78 some of the defaults (long/short list etc.) can be set by the resource file; |
78 see FileBrowser>>initialize for more details.. |
79 see FileBrowser>>initialize for more details.. |
79 |
80 |
80 [author:] |
81 [author:] |
81 Claus Gittinger |
82 Claus Gittinger |
82 |
83 |
83 [start with:] |
84 [start with:] |
84 FileBrowser open |
85 FileBrowser open |
85 " |
86 " |
86 ! ! |
87 ! ! |
87 |
88 |
88 !FileBrowser class methodsFor:'instance creation'! |
89 !FileBrowser class methodsFor:'instance creation'! |
89 |
90 |
264 |
256 |
265 addToCommandHistory:aCommandString for:aFilename |
257 addToCommandHistory:aCommandString for:aFilename |
266 |cmd suffix| |
258 |cmd suffix| |
267 |
259 |
268 (aCommandString notNil and:[aCommandString notEmpty]) ifTrue:[ |
260 (aCommandString notNil and:[aCommandString notEmpty]) ifTrue:[ |
269 CommandHistory notNil ifTrue:[ |
261 CommandHistory notNil ifTrue:[ |
270 CommandHistory addFirst:aCommandString. |
262 CommandHistory addFirst:aCommandString. |
271 CommandHistory size > CommandHistorySize ifTrue:[ |
263 CommandHistory size > CommandHistorySize ifTrue:[ |
272 CommandHistory removeLast |
264 CommandHistory removeLast |
273 ] |
265 ] |
274 ]. |
266 ]. |
275 aFilename notNil ifTrue:[ |
267 aFilename notNil ifTrue:[ |
276 cmd := aCommandString copyTo:(aCommandString indexOf:Character space ifAbsent:[aCommandString size + 1])-1. |
268 cmd := aCommandString copyTo:(aCommandString indexOf:Character space ifAbsent:[aCommandString size + 1])-1. |
277 DefaultCommandPerSuffix isNil ifTrue:[ |
269 DefaultCommandPerSuffix isNil ifTrue:[ |
278 DefaultCommandPerSuffix := Dictionary new. |
270 DefaultCommandPerSuffix := Dictionary new. |
279 ]. |
271 ]. |
280 suffix := aFilename asFilename suffix. |
272 suffix := aFilename asFilename suffix. |
281 suffix notNil ifTrue:[ |
273 suffix notNil ifTrue:[ |
282 DefaultCommandPerSuffix at:suffix put:cmd. |
274 DefaultCommandPerSuffix at:suffix put:cmd. |
283 ] |
275 ] |
284 ] |
276 ] |
285 ] |
277 ] |
286 |
278 |
287 "Created: 14.11.1996 / 14:58:13 / cg" |
279 "Created: 14.11.1996 / 14:58:13 / cg" |
288 ! |
280 ! |
289 |
281 |
343 <resource: #canvas> |
335 <resource: #canvas> |
344 |
336 |
345 ^ |
337 ^ |
346 |
338 |
347 #(#FullSpec |
339 #(#FullSpec |
348 #window: |
340 #window: |
349 #(#WindowSpec |
341 #(#WindowSpec |
350 #name: 'File Search' |
342 #name: 'File Search' |
351 #layout: #(#LayoutFrame 4 0 50 0 315 0 349 0) |
343 #layout: #(#LayoutFrame 4 0 50 0 315 0 349 0) |
352 #level: 0 |
344 #level: 0 |
353 #label: 'File Search' |
345 #label: 'File Search' |
354 #min: #(#Point 10 10) |
346 #min: #(#Point 10 10) |
355 #max: #(#Point 1280 1024) |
347 #max: #(#Point 1280 1024) |
356 #bounds: #(#Rectangle 4 50 316 350) |
348 #bounds: #(#Rectangle 4 50 316 350) |
357 #usePreferredExtent: false |
349 #usePreferredExtent: false |
358 #returnIsOKInDialog: true |
350 #returnIsOKInDialog: true |
359 #escapeIsCancelInDialog: true |
351 #escapeIsCancelInDialog: true |
360 ) |
352 ) |
361 #component: |
353 #component: |
362 #(#SpecCollection |
354 #(#SpecCollection |
363 #collection: |
355 #collection: |
364 #( |
356 #( |
365 #(#LabelSpec |
357 #(#LabelSpec |
366 #name: 'Label1' |
358 #name: 'Label1' |
367 #layout: #(#LayoutFrame 0 0 10 0 0 1 32 0) |
359 #layout: #(#LayoutFrame 0 0 10 0 0 1 32 0) |
368 #label: 'Search for files named:' |
360 #label: 'Search for files named:' |
369 #translateLabel: true |
361 #translateLabel: true |
370 #adjust: #left |
362 #adjust: #left |
371 ) |
363 ) |
372 #(#InputFieldSpec |
364 #(#InputFieldSpec |
373 #name: 'EntryField1' |
365 #name: 'EntryField1' |
374 #layout: #(#LayoutFrame 10 0 36 0 305 0 58 0) |
366 #layout: #(#LayoutFrame 10 0 36 0 305 0 58 0) |
375 #tabable: true |
367 #tabable: true |
376 #model: #namePatternHolder |
368 #model: #namePatternHolder |
377 ) |
369 ) |
378 #(#CheckBoxSpec |
370 #(#CheckBoxSpec |
379 #name: 'CheckBox1' |
371 #name: 'CheckBox1' |
380 #layout: #(#LayoutFrame 7 0 66 0 143 0 88 0) |
372 #layout: #(#LayoutFrame 7 0 66 0 143 0 88 0) |
381 #tabable: true |
373 #tabable: true |
382 #model: #ignoreCaseInName |
374 #model: #ignoreCaseInName |
383 #label: 'Ignore case' |
375 #label: 'Ignore case' |
384 #translateLabel: true |
376 #translateLabel: true |
385 ) |
377 ) |
386 #(#LabelSpec |
378 #(#LabelSpec |
387 #name: 'Label2' |
379 #name: 'Label2' |
388 #layout: #(#LayoutFrame 0 0.0 107 0 0 1.0 129 0) |
380 #layout: #(#LayoutFrame 0 0.0 107 0 0 1.0 129 0) |
389 #label: 'Containing the string:' |
381 #label: 'Containing the string:' |
390 #translateLabel: true |
382 #translateLabel: true |
391 #adjust: #left |
383 #adjust: #left |
392 ) |
384 ) |
393 #(#InputFieldSpec |
385 #(#InputFieldSpec |
394 #name: 'EntryField2' |
386 #name: 'EntryField2' |
395 #layout: #(#LayoutFrame 10 0 133 0 305 0 155 0) |
387 #layout: #(#LayoutFrame 10 0 133 0 305 0 155 0) |
396 #enableChannel: #notSearchForSameContents |
388 #enableChannel: #notSearchForSameContents |
397 #tabable: true |
389 #tabable: true |
398 #model: #contentsPatternHolder |
390 #model: #contentsPatternHolder |
399 ) |
391 ) |
400 #(#CheckBoxSpec |
392 #(#CheckBoxSpec |
401 #name: 'CheckBox2' |
393 #name: 'CheckBox2' |
402 #layout: #(#LayoutFrame 6 0 163 0 142 0 185 0) |
394 #layout: #(#LayoutFrame 6 0 163 0 142 0 185 0) |
403 #enableChannel: #notSearchForSameContents |
395 #enableChannel: #notSearchForSameContents |
404 #tabable: true |
396 #tabable: true |
405 #model: #ignoreCaseInContents |
397 #model: #ignoreCaseInContents |
406 #label: 'Ignore case' |
398 #label: 'Ignore case' |
407 #translateLabel: true |
399 #translateLabel: true |
408 ) |
400 ) |
409 #(#LabelSpec |
401 #(#LabelSpec |
410 #name: 'Label3' |
402 #name: 'Label3' |
411 #layout: #(#LayoutFrame 0 0.0 223 0 -30 1.0 245 0) |
403 #layout: #(#LayoutFrame 0 0.0 223 0 -30 1.0 245 0) |
412 #label: 'Containing same contents as selected:' |
404 #label: 'Containing same contents as selected:' |
413 #translateLabel: true |
405 #translateLabel: true |
414 #adjust: #left |
406 #adjust: #left |
415 ) |
407 ) |
416 #(#DividerSpec |
408 #(#DividerSpec |
417 #name: 'Separator1' |
409 #name: 'Separator1' |
418 #layout: #(#LayoutFrame 0 0.0 97 0 0 1.0 101 0) |
410 #layout: #(#LayoutFrame 0 0.0 97 0 0 1.0 101 0) |
419 ) |
411 ) |
420 #(#CheckToggleSpec |
412 #(#CheckToggleSpec |
421 #name: 'CheckToggle1' |
413 #name: 'CheckToggle1' |
422 #layout: #(#LayoutOrigin -25 1 225 0) |
414 #layout: #(#LayoutOrigin -25 1 225 0) |
423 #tabable: true |
415 #tabable: true |
424 #model: #searchForSameContents |
416 #model: #searchForSameContents |
425 #enableChannel: #searchForSameContentsEnabled |
417 #enableChannel: #searchForSameContentsEnabled |
426 #isTriggerOnDown: true |
418 #isTriggerOnDown: true |
427 #showLamp: false |
419 #showLamp: false |
428 #lampColor: #(#Color 100.0 100.0 0.0) |
420 #lampColor: #(#Color 100.0 100.0 0.0) |
429 ) |
421 ) |
430 #(#HorizontalPanelViewSpec |
422 #(#HorizontalPanelViewSpec |
431 #name: 'HorizontalPanel1' |
423 #name: 'HorizontalPanel1' |
432 #layout: #(#LayoutFrame 0 0.0 -30 1 0 1.0 0 1.0) |
424 #layout: #(#LayoutFrame 0 0.0 -30 1 0 1.0 0 1.0) |
433 #component: |
425 #component: |
434 #(#SpecCollection |
426 #(#SpecCollection |
435 #collection: |
427 #collection: |
436 #( |
428 #( |
437 #(#ActionButtonSpec |
429 #(#ActionButtonSpec |
438 #name: 'Button1' |
430 #name: 'Button1' |
439 #label: 'Cancel' |
431 #label: 'Cancel' |
440 #translateLabel: true |
432 #translateLabel: true |
441 #tabable: true |
433 #tabable: true |
442 #model: #cancel |
434 #model: #cancel |
443 #extent: #(#Point 151 25) |
435 #extent: #(#Point 151 25) |
444 ) |
436 ) |
445 #(#ActionButtonSpec |
437 #(#ActionButtonSpec |
446 #name: 'Button2' |
438 #name: 'Button2' |
447 #label: 'Search' |
439 #label: 'Search' |
448 #translateLabel: true |
440 #translateLabel: true |
449 #tabable: true |
441 #tabable: true |
450 #model: #accept |
442 #model: #accept |
451 #isDefault: true |
443 #isDefault: true |
452 #extent: #(#Point 152 25) |
444 #extent: #(#Point 152 25) |
453 ) |
445 ) |
454 ) |
446 ) |
455 ) |
447 ) |
456 #horizontalLayout: #fitSpace |
448 #horizontalLayout: #fitSpace |
457 #verticalLayout: #centerMax |
449 #verticalLayout: #centerMax |
458 #horizontalSpace: 3 |
450 #horizontalSpace: 3 |
459 #verticalSpace: 3 |
451 #verticalSpace: 3 |
460 ) |
452 ) |
461 ) |
453 ) |
462 ) |
454 ) |
463 ) |
455 ) |
464 ! ! |
456 ! ! |
465 |
457 |
466 !FileBrowser class methodsFor:'menu specs'! |
458 !FileBrowser class methodsFor:'menu specs'! |
|
459 |
|
460 baseBookmarksMenuSpec |
|
461 "This resource specification was automatically generated |
|
462 by the MenuEditor of ST/X." |
|
463 |
|
464 "Do not manually edit this!! If it is corrupted, |
|
465 the MenuEditor may not be able to read the specification." |
|
466 |
|
467 " |
|
468 MenuEditor new openOnClass:FileBrowser andSelector:#baseBookmarksMenuSpec |
|
469 (Menu new fromLiteralArrayEncoding:(FileBrowser baseBookmarksMenuSpec)) startUp |
|
470 " |
|
471 |
|
472 <resource: #menu> |
|
473 |
|
474 ^ |
|
475 |
|
476 #(#Menu |
|
477 |
|
478 #( |
|
479 #(#MenuItem |
|
480 #label: 'Add Bookmark' |
|
481 #translateLabel: true |
|
482 #value: #addBookmark |
|
483 ) |
|
484 #(#MenuItem |
|
485 #label: 'Remove Bookmark' |
|
486 #translateLabel: true |
|
487 #value: #removeBookmark |
|
488 #enabled: #hasBookmarksToRemove |
|
489 ) |
|
490 ) nil |
|
491 nil |
|
492 ) |
|
493 |
|
494 "Created: / 4.8.1998 / 17:21:16 / cg" |
|
495 "Modified: / 14.8.1998 / 19:19:06 / cg" |
|
496 ! |
467 |
497 |
468 baseDirectoryMenuSpec |
498 baseDirectoryMenuSpec |
469 "This resource specification was automatically generated |
499 "This resource specification was automatically generated |
470 by the MenuEditor of ST/X." |
500 by the MenuEditor of ST/X." |
471 |
501 |
481 |
511 |
482 ^ |
512 ^ |
483 |
513 |
484 #(#Menu |
514 #(#Menu |
485 |
515 |
486 #( |
516 #( |
487 #(#MenuItem |
517 #(#MenuItem |
488 #label: 'Copy Path' |
518 #label: 'Copy Path' |
489 #translateLabel: true |
519 #translateLabel: true |
490 #value: #copyPath |
520 #value: #copyPath |
491 ) |
521 ) |
492 #(#MenuItem |
522 #(#MenuItem |
493 #label: '-' |
523 #label: '-' |
494 ) |
524 ) |
495 #(#MenuItem |
525 #(#MenuItem |
496 #label: 'Up' |
526 #label: 'Up' |
497 #translateLabel: true |
527 #translateLabel: true |
498 #value: #changeToParentDirectory |
528 #value: #changeToParentDirectory |
499 #enabled: #currentDirectoryIsNotTop |
529 #enabled: #currentDirectoryIsNotTop |
500 ) |
530 ) |
501 #(#MenuItem |
531 #(#MenuItem |
502 #label: 'Back' |
532 #label: 'Back' |
503 #translateLabel: true |
533 #translateLabel: true |
504 #value: #changeToPreviousDirectory |
534 #value: #changeToPreviousDirectory |
505 ) |
535 ) |
506 #(#MenuItem |
536 #(#MenuItem |
507 #label: 'Home' |
537 #label: 'Home' |
508 #translateLabel: true |
538 #translateLabel: true |
509 #value: #changeToHomeDirectory |
539 #value: #changeToHomeDirectory |
510 ) |
540 ) |
511 #(#MenuItem |
541 #(#MenuItem |
512 #label: 'Default' |
542 #label: 'Default' |
513 #translateLabel: true |
543 #translateLabel: true |
514 #value: #changeToDefaultDirectory |
544 #value: #changeToDefaultDirectory |
515 ) |
545 ) |
516 #(#MenuItem |
546 #(#MenuItem |
517 #label: 'Goto...' |
547 #label: 'Goto...' |
518 #translateLabel: true |
548 #translateLabel: true |
519 #value: #changeCurrentDirectory |
549 #value: #changeCurrentDirectory |
520 ) |
550 ) |
521 ) nil |
551 #(#MenuItem |
522 nil |
552 #label: '-' |
|
553 ) |
|
554 #(#MenuItem |
|
555 #label: 'History' |
|
556 #translateLabel: true |
|
557 #submenuChannel: #historyMenuSpec |
|
558 ) |
|
559 #(#MenuItem |
|
560 #label: 'Bookmarks' |
|
561 #translateLabel: true |
|
562 #submenuChannel: #bookmarksMenuSpec |
|
563 ) |
|
564 ) nil |
|
565 nil |
523 ) |
566 ) |
524 |
567 |
525 "Created: / 4.8.1998 / 17:21:16 / cg" |
568 "Created: / 4.8.1998 / 17:21:16 / cg" |
526 "Modified: / 14.8.1998 / 19:19:06 / cg" |
569 "Modified: / 14.8.1998 / 19:19:06 / cg" |
|
570 ! |
|
571 |
|
572 bookmarksMenuSpec |
|
573 "This resource specification was automatically generated |
|
574 by the MenuEditor of ST/X." |
|
575 |
|
576 "Do not manually edit this!! If it is corrupted, |
|
577 the MenuEditor may not be able to read the specification." |
|
578 |
|
579 " |
|
580 MenuEditor new openOnClass:FileBrowser andSelector:#bookmarksMenuSpec |
|
581 (Menu new fromLiteralArrayEncoding:(FileBrowser bookmarksMenuSpec)) startUp |
|
582 " |
|
583 |
|
584 <resource: #programMenu> |
|
585 |
|
586 |m| |
|
587 |
|
588 m := self baseBookmarksMenuSpec. |
|
589 m := m decodeAsLiteralArray. |
|
590 |
|
591 "/ add the history items ... |
|
592 |
|
593 DirectoryBookmarks size > 0 ifTrue:[ |
|
594 m addItem:(MenuItem labeled:'-'). |
|
595 DirectoryBookmarks do:[:dirName | |
|
596 m addItem:((MenuItem label:dirName value:#changeDirectoryTo:) |
|
597 argument:dirName; |
|
598 yourself). |
|
599 ]. |
|
600 ]. |
|
601 |
|
602 "/ m receiver:self. |
|
603 m findGuiResourcesIn:self. |
|
604 ^ m |
|
605 |
|
606 "Modified: / 17.8.1998 / 10:13:05 / cg" |
527 ! |
607 ! |
528 |
608 |
529 directoryMenuSpec |
609 directoryMenuSpec |
530 "This resource specification was automatically generated |
610 "This resource specification was automatically generated |
531 by the MenuEditor of ST/X." |
611 by the MenuEditor of ST/X." |
536 " |
616 " |
537 MenuEditor new openOnClass:FileBrowser andSelector:#directoryMenuSpec |
617 MenuEditor new openOnClass:FileBrowser andSelector:#directoryMenuSpec |
538 (Menu new fromLiteralArrayEncoding:(FileBrowser directoryMenuSpec)) startUp |
618 (Menu new fromLiteralArrayEncoding:(FileBrowser directoryMenuSpec)) startUp |
539 " |
619 " |
540 |
620 |
|
621 <resource: #menu> |
|
622 |
|
623 ^ |
|
624 |
|
625 #(#Menu |
|
626 |
|
627 #( |
|
628 #(#MenuItem |
|
629 #label: 'Copy Path' |
|
630 #translateLabel: true |
|
631 #value: #copyPath |
|
632 ) |
|
633 #(#MenuItem |
|
634 #label: '-' |
|
635 ) |
|
636 #(#MenuItem |
|
637 #label: 'Up' |
|
638 #translateLabel: true |
|
639 #value: #changeToParentDirectory |
|
640 #enabled: #currentDirectoryIsNotTop |
|
641 ) |
|
642 #(#MenuItem |
|
643 #label: 'Goto...' |
|
644 #translateLabel: true |
|
645 #value: #changeCurrentDirectory |
|
646 ) |
|
647 #(#MenuItem |
|
648 #label: '-' |
|
649 ) |
|
650 #(#MenuItem |
|
651 #label: 'Back' |
|
652 #translateLabel: true |
|
653 #value: #changeToPreviousDirectory |
|
654 ) |
|
655 #(#MenuItem |
|
656 #label: 'History' |
|
657 #translateLabel: true |
|
658 #submenuChannel: #historyMenuSpec |
|
659 ) |
|
660 #(#MenuItem |
|
661 #label: '-' |
|
662 ) |
|
663 #(#MenuItem |
|
664 #label: 'Default' |
|
665 #translateLabel: true |
|
666 #value: #changeToDefaultDirectory |
|
667 ) |
|
668 #(#MenuItem |
|
669 #label: 'Home' |
|
670 #translateLabel: true |
|
671 #value: #changeToHomeDirectory |
|
672 ) |
|
673 #(#MenuItem |
|
674 #label: 'Bookmarks' |
|
675 #translateLabel: true |
|
676 #submenuChannel: #bookmarksMenuSpec |
|
677 ) |
|
678 ) nil |
|
679 nil |
|
680 ) |
|
681 |
|
682 "Created: / 4.8.1998 / 17:21:16 / cg" |
|
683 "Modified: / 14.8.1998 / 19:19:06 / cg" |
|
684 ! |
|
685 |
|
686 historyMenuSpec |
|
687 "This resource specification was automatically generated |
|
688 by the MenuEditor of ST/X." |
|
689 |
|
690 "Do not manually edit this!! If it is corrupted, |
|
691 the MenuEditor may not be able to read the specification." |
|
692 |
|
693 " |
|
694 MenuEditor new openOnClass:FileBrowser andSelector:#directoryMenuSpec |
|
695 (Menu new fromLiteralArrayEncoding:(FileBrowser directoryMenuSpec)) startUp |
|
696 " |
|
697 |
541 <resource: #programMenu> |
698 <resource: #programMenu> |
542 |
699 |
543 |m| |
700 |m| |
544 |
701 |
545 m := self baseDirectoryMenuSpec. |
|
546 m := m decodeAsLiteralArray. |
|
547 |
|
548 "/ add the history items ... |
702 "/ add the history items ... |
549 |
703 |
550 DirectoryHistory size > 0 ifTrue:[ |
704 DirectoryHistory size > 0 ifTrue:[ |
551 m addItem:(MenuItem labeled:'-'). |
705 m := Menu new. |
552 DirectoryHistory do:[:dirName | |
706 |
553 m addItem:((MenuItem label:dirName value:#changeDirectoryTo:) |
707 DirectoryHistory do:[:dirName | |
554 argument:dirName; |
708 m addItem:((MenuItem label:dirName value:#changeDirectoryTo:) |
555 yourself). |
709 argument:dirName; |
556 ]. |
710 yourself). |
|
711 ]. |
557 ]. |
712 ]. |
558 |
713 |
559 m findGuiResourcesIn:self. |
714 m findGuiResourcesIn:self. |
560 ^ m |
715 ^ m |
561 |
716 |
1434 ^ [ fileListView selection size > 0 |
1595 ^ [ fileListView selection size > 0 |
1435 and:[OSI::ASN1Parser notNil |
1596 and:[OSI::ASN1Parser notNil |
1436 and:[OSI::ASN1Parser isLoaded]]] |
1597 and:[OSI::ASN1Parser isLoaded]]] |
1437 ! |
1598 ! |
1438 |
1599 |
|
1600 hasBookmarks |
|
1601 ^ DirectoryBookmarks size > 0 |
|
1602 |
|
1603 "Created: / 14.8.1998 / 19:17:02 / cg" |
|
1604 "Modified: / 14.8.1998 / 19:17:17 / cg" |
|
1605 ! |
|
1606 |
|
1607 hasBookmarksToRemove |
|
1608 ^ DirectoryBookmarks size > 0 |
|
1609 and:[ DirectoryBookmarks includes:(currentDirectory asFilename pathName) ] |
|
1610 |
|
1611 "Created: / 14.8.1998 / 19:17:02 / cg" |
|
1612 "Modified: / 14.8.1998 / 19:17:17 / cg" |
|
1613 ! |
|
1614 |
1439 hasCBrowser |
1615 hasCBrowser |
1440 ^ [ CC::Browser notNil ] |
1616 ^ [ CC::Browser notNil ] |
1441 |
1617 |
1442 ! |
1618 ! |
1443 |
1619 |
1444 hasFilenameSelectionInCodeView |
1620 hasFilenameSelectionInCodeView |
1445 ^ [ |val sel| |
1621 ^ [ |val sel| |
1446 |
1622 |
1447 val := false. |
1623 val := false. |
1448 sel := subView selection. |
1624 sel := subView selection. |
1449 sel notNil ifTrue:[ |
1625 sel notNil ifTrue:[ |
1450 sel := sel asString withoutSeparators. |
1626 sel := sel asString withoutSeparators. |
1451 sel asFilename exists ifTrue:[ |
1627 sel asFilename exists ifTrue:[ |
1452 val := sel asFilename isReadable |
1628 val := sel asFilename isReadable |
1453 ] |
1629 ] |
1454 ]. |
1630 ]. |
1455 val |
1631 val |
1456 ] |
1632 ] |
1457 |
1633 |
1458 "Created: / 4.2.1999 / 17:34:57 / cg" |
1634 "Created: / 4.2.1999 / 17:34:57 / cg" |
1459 "Modified: / 4.2.1999 / 17:39:32 / cg" |
1635 "Modified: / 4.2.1999 / 17:39:32 / cg" |
1460 ! |
1636 ! |
1461 |
1637 |
1462 hasJava |
1638 hasJava |
1463 ^ [ JavaClassReader notNil |
1639 ^ [ JavaClassReader notNil |
1464 and:[JavaClassReader isLoaded]] |
1640 and:[JavaClassReader isLoaded]] |
1465 |
1641 |
1466 "Modified: / 17.10.1998 / 16:57:14 / cg" |
1642 "Modified: / 17.10.1998 / 16:57:14 / cg" |
1467 "Created: / 17.10.1998 / 22:58:25 / cg" |
1643 "Created: / 17.10.1998 / 22:58:25 / cg" |
1468 ! |
1644 ! |
1469 |
1645 |
1470 hasJavaAndSelection |
1646 hasJavaAndSelection |
1471 ^ [ fileListView selection size > 0 |
1647 ^ [ fileListView selection size > 0 |
1472 and:[JavaClassReader notNil |
1648 and:[JavaClassReader notNil |
1473 and:[JavaClassReader isLoaded]]] |
1649 and:[JavaClassReader isLoaded]]] |
1474 |
1650 |
1475 "Modified: / 17.10.1998 / 16:57:14 / cg" |
1651 "Modified: / 17.10.1998 / 16:57:14 / cg" |
1476 "Created: / 17.10.1998 / 22:58:03 / cg" |
1652 "Created: / 17.10.1998 / 22:58:03 / cg" |
1477 ! |
1653 ! |
1478 |
1654 |
1501 |
1677 |
1502 "Created: / 4.8.1998 / 14:10:31 / cg" |
1678 "Created: / 4.8.1998 / 14:10:31 / cg" |
1503 "Modified: / 4.8.1998 / 14:10:57 / cg" |
1679 "Modified: / 4.8.1998 / 14:10:57 / cg" |
1504 ! |
1680 ! |
1505 |
1681 |
|
1682 hasVisitHistory |
|
1683 ^ [DirectoryHistory size > 0] |
|
1684 |
|
1685 "Created: / 14.8.1998 / 19:17:02 / cg" |
|
1686 "Modified: / 14.8.1998 / 19:17:17 / cg" |
|
1687 ! |
|
1688 |
1506 hasZipFileSelected |
1689 hasZipFileSelected |
1507 ^ [|sel f fn suff| |
1690 ^ [|sel f fn suff| |
1508 |
1691 |
1509 sel := fileListView selection. |
1692 sel := fileListView selection. |
1510 sel size == 1 ifTrue:[ |
1693 sel size == 1 ifTrue:[ |
1511 f := fileList at:sel first ifAbsent:nil. |
1694 f := fileList at:sel first ifAbsent:nil. |
1512 f notNil ifTrue:[ |
1695 f notNil ifTrue:[ |
1513 suff := f asFilename suffix asLowercase. |
1696 suff := f asFilename suffix asLowercase. |
1514 suff = 'zip' or:[suff = 'jar'] |
1697 suff = 'zip' or:[suff = 'jar'] |
1515 ] ifFalse:[ |
1698 ] ifFalse:[ |
1516 false |
1699 false |
1517 ] |
1700 ] |
1518 ] ifFalse:[ |
1701 ] ifFalse:[ |
1519 false |
1702 false |
1520 ] |
1703 ] |
1521 ] |
1704 ] |
1522 |
1705 |
1523 "Created: / 26.8.1998 / 16:15:26 / cg" |
1706 "Created: / 26.8.1998 / 16:15:26 / cg" |
1524 "Modified: / 30.1.1999 / 19:05:59 / cg" |
1707 "Modified: / 30.1.1999 / 19:05:59 / cg" |
1525 ! |
1708 ! |
1526 |
1709 |
1527 javaSupportLoaded |
1710 javaSupportLoaded |
1528 ^ [ JavaClassReader notNil |
1711 ^ [ JavaClassReader notNil |
1529 and:[JavaClassReader isLoaded]] |
1712 and:[JavaClassReader isLoaded]] |
1530 |
1713 |
1531 "Created: / 9.11.1998 / 05:33:17 / cg" |
1714 "Created: / 9.11.1998 / 05:33:17 / cg" |
1532 ! |
1715 ! |
1533 |
1716 |
1534 showingBigImagePreview |
1717 showingBigImagePreview |
1653 If its text, paste it into the codeView." |
1842 If its text, paste it into the codeView." |
1654 |
1843 |
1655 |newDir newFile| |
1844 |newDir newFile| |
1656 |
1845 |
1657 someObject isFileObject ifTrue:[ |
1846 someObject isFileObject ifTrue:[ |
1658 someObject isDirectory ifTrue:[ |
1847 someObject isDirectory ifTrue:[ |
1659 newDir := someObject theObject pathName. |
1848 newDir := someObject theObject pathName. |
1660 ] ifFalse:[ |
1849 ] ifFalse:[ |
1661 newDir := someObject theObject directoryName. |
1850 newDir := someObject theObject directoryName. |
1662 newFile := someObject theObject baseName. |
1851 newFile := someObject theObject baseName. |
1663 ]. |
1852 ]. |
1664 |
1853 |
1665 newDir notNil ifTrue:[ |
1854 newDir notNil ifTrue:[ |
1666 newDir ~= currentDirectory pathName ifTrue:[ |
1855 newDir ~= currentDirectory pathName ifTrue:[ |
1667 self changeDirectoryTo:newDir. |
1856 self changeDirectoryTo:newDir. |
1668 ] |
1857 ] |
1669 ]. |
1858 ]. |
1670 newFile notNil ifTrue:[ |
1859 newFile notNil ifTrue:[ |
1671 newFile ~= currentFileName ifTrue:[ |
1860 newFile ~= currentFileName ifTrue:[ |
1672 fileListView selection:(fileList indexOf:newFile). |
1861 fileListView selection:(fileList indexOf:newFile). |
1673 self doFileGet:false. |
1862 self doFileGet:false. |
1674 ] |
1863 ] |
1675 ]. |
1864 ]. |
1676 ^ self |
1865 ^ self |
1677 ]. |
1866 ]. |
1678 |
1867 |
1679 someObject isTextObject ifTrue:[ |
1868 someObject isTextObject ifTrue:[ |
1680 subView paste:someObject theObject. |
1869 subView paste:someObject theObject. |
1681 ^ self |
1870 ^ self |
1682 ]. |
1871 ]. |
1683 |
1872 |
1684 "Modified: 6.4.1997 / 14:46:44 / cg" |
1873 "Modified: 6.4.1997 / 14:46:44 / cg" |
1685 ! ! |
1874 ! ! |
1686 |
1875 |
2071 |
2260 |
2072 |fileNames dir infoDir filesBySize |
2261 |fileNames dir infoDir filesBySize |
2073 result info dirPrefix| |
2262 result info dirPrefix| |
2074 |
2263 |
2075 (self askIfModified:'contents has not been saved.\\Modifications will be lost when you proceed.' |
2264 (self askIfModified:'contents has not been saved.\\Modifications will be lost when you proceed.' |
2076 yesButton:'proceed') ifFalse:[^ self]. |
2265 yesButton:'proceed') ifFalse:[^ self]. |
2077 |
2266 |
2078 self withWaitCursorDo:[ |
2267 self withWaitCursorDo:[ |
2079 result := Dictionary new. |
2268 result := Dictionary new. |
2080 |
2269 |
2081 dir := currentDirectory asFilename. |
2270 dir := currentDirectory asFilename. |
2082 self label:myName , '- gathering file names ...'. |
2271 self label:myName , '- gathering file names ...'. |
2083 fileNames := dir recursiveDirectoryContents. |
2272 fileNames := dir recursiveDirectoryContents. |
2084 fileNames := fileNames collect:[:fn | dir construct:fn]. |
2273 fileNames := fileNames collect:[:fn | dir construct:fn]. |
2085 fileNames := fileNames select:[:fn | fn isDirectory not]. |
2274 fileNames := fileNames select:[:fn | fn isDirectory not]. |
2086 |
2275 |
2087 self label:myName , '- gathering sizes ...'. |
2276 self label:myName , '- gathering sizes ...'. |
2088 infoDir := Dictionary new. |
2277 infoDir := Dictionary new. |
2089 fileNames do:[:fn | |
2278 fileNames do:[:fn | |
2090 infoDir at:fn put:(fn fileSize) |
2279 infoDir at:fn put:(fn fileSize) |
2091 ]. |
2280 ]. |
2092 |
2281 |
2093 "/ for each, get the files size. |
2282 "/ for each, get the files size. |
2094 "/ in a first pass, look for files of the same size and |
2283 "/ in a first pass, look for files of the same size and |
2095 "/ compare them ... |
2284 "/ compare them ... |
2096 |
2285 |
2097 self label:myName , '- preselect possible duplicates ...'. |
2286 self label:myName , '- preselect possible duplicates ...'. |
2098 filesBySize := Dictionary new. |
2287 filesBySize := Dictionary new. |
2099 infoDir keysAndValuesDo:[:fn :sz | |
2288 infoDir keysAndValuesDo:[:fn :sz | |
2100 |entry| |
2289 |entry| |
2101 |
2290 |
2102 entry := filesBySize at:sz ifAbsentPut:[Set new]. |
2291 entry := filesBySize at:sz ifAbsentPut:[Set new]. |
2103 entry add:fn. |
2292 entry add:fn. |
2104 ]. |
2293 ]. |
2105 |
2294 |
2106 "/ any of same size ? |
2295 "/ any of same size ? |
2107 |
2296 |
2108 self label:myName , '- checking for duplicates ...'. |
2297 self label:myName , '- checking for duplicates ...'. |
2109 filesBySize do:[:entry | |
2298 filesBySize do:[:entry | |
2110 |files| |
2299 |files| |
2111 |
2300 |
2112 entry size > 1 ifTrue:[ |
2301 entry size > 1 ifTrue:[ |
2113 files := entry asArray. |
2302 files := entry asArray. |
2114 1 to:files size-1 do:[:idx1 | |
2303 1 to:files size-1 do:[:idx1 | |
2115 idx1+1 to:files size do:[:idx2 | |
2304 idx1+1 to:files size do:[:idx2 | |
2116 |fn1 fn2| |
2305 |fn1 fn2| |
2117 |
2306 |
2118 fn1 := files at:idx1. |
2307 fn1 := files at:idx1. |
2119 fn2 := files at:idx2. |
2308 fn2 := files at:idx2. |
2120 |
2309 |
2121 "/ self label:myName , '- checking ' , fn1 baseName , ' vs. ' , fn2 baseName , ' ...'. |
2310 "/ self label:myName , '- checking ' , fn1 baseName , ' vs. ' , fn2 baseName , ' ...'. |
2122 (result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
2311 (result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
2123 "/ compare the files |
2312 "/ compare the files |
2124 (fn1 sameContentsAs:fn2) ifTrue:[ |
2313 (fn1 sameContentsAs:fn2) ifTrue:[ |
2125 "/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
2314 "/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
2126 result at:fn1 put:fn2. |
2315 result at:fn1 put:fn2. |
2127 ] |
2316 ] |
2128 ] |
2317 ] |
2129 ] |
2318 ] |
2130 ] |
2319 ] |
2131 ] |
2320 ] |
2132 ]. |
2321 ]. |
2133 |
2322 |
2134 self label:myName , '- sorting ...'. |
2323 self label:myName , '- sorting ...'. |
2135 dirPrefix := currentDirectory asFilename pathName. |
2324 dirPrefix := currentDirectory asFilename pathName. |
2136 result := result associations. |
2325 result := result associations. |
2137 result := result collect:[:assoc | |
2326 result := result collect:[:assoc | |
2138 |f1 f2| |
2327 |f1 f2| |
2139 |
2328 |
2140 f1 := assoc key name. |
2329 f1 := assoc key name. |
2141 f2 := assoc value name. |
2330 f2 := assoc value name. |
2142 (f1 startsWith:dirPrefix) ifTrue:[ |
2331 (f1 startsWith:dirPrefix) ifTrue:[ |
2143 f1 := f1 copyFrom:dirPrefix size + 2. |
2332 f1 := f1 copyFrom:dirPrefix size + 2. |
2144 ]. |
2333 ]. |
2145 (f2 startsWith:dirPrefix) ifTrue:[ |
2334 (f2 startsWith:dirPrefix) ifTrue:[ |
2146 f2 := f2 copyFrom:dirPrefix size + 2. |
2335 f2 := f2 copyFrom:dirPrefix size + 2. |
2147 ]. |
2336 ]. |
2148 f1 < f2 ifTrue:[ |
2337 f1 < f2 ifTrue:[ |
2149 f2 -> f1 |
2338 f2 -> f1 |
2150 ] ifFalse:[ |
2339 ] ifFalse:[ |
2151 f1 -> f2 |
2340 f1 -> f2 |
2152 ] |
2341 ] |
2153 ]. |
2342 ]. |
2154 result sort:[:f1 :f2 | f2 value < f1 value]. |
2343 result sort:[:f1 :f2 | f2 value < f1 value]. |
2155 |
2344 |
2156 info := OrderedCollection new. |
2345 info := OrderedCollection new. |
2157 result do:[:assoc | |
2346 result do:[:assoc | |
2158 info add:(assoc key , ' same as ' , assoc value) |
2347 info add:(assoc key , ' same as ' , assoc value) |
2159 ]. |
2348 ]. |
2160 info isEmpty ifTrue:[ |
2349 info isEmpty ifTrue:[ |
2161 info := 'No duplicate files found.' |
2350 info := 'No duplicate files found.' |
2162 ]. |
2351 ]. |
2163 ]. |
2352 ]. |
2164 |
2353 |
2165 subView contents:info. |
2354 subView contents:info. |
2166 self label:myName. |
2355 self label:myName. |
2167 |
2356 |
2174 |
2363 |
2175 |fileNames dir infoDir filesBySize |
2364 |fileNames dir infoDir filesBySize |
2176 result info| |
2365 result info| |
2177 |
2366 |
2178 (self askIfModified:'contents has not been saved.\\Modifications will be lost when you proceed.' |
2367 (self askIfModified:'contents has not been saved.\\Modifications will be lost when you proceed.' |
2179 yesButton:'proceed') ifFalse:[^ self]. |
2368 yesButton:'proceed') ifFalse:[^ self]. |
2180 |
2369 |
2181 self withWaitCursorDo:[ |
2370 self withWaitCursorDo:[ |
2182 result := Dictionary new. |
2371 result := Dictionary new. |
2183 |
2372 |
2184 dir := currentDirectory asFilename. |
2373 dir := currentDirectory asFilename. |
2185 fileNames := dir directoryContents. |
2374 fileNames := dir directoryContents. |
2186 fileNames := fileNames collect:[:fn | dir construct:fn]. |
2375 fileNames := fileNames collect:[:fn | dir construct:fn]. |
2187 fileNames := fileNames select:[:fn | fn isDirectory not]. |
2376 fileNames := fileNames select:[:fn | fn isDirectory not]. |
2188 |
2377 |
2189 infoDir := Dictionary new. |
2378 infoDir := Dictionary new. |
2190 fileNames do:[:fn | |
2379 fileNames do:[:fn | |
2191 infoDir at:fn put:(fn info) |
2380 infoDir at:fn put:(fn info) |
2192 ]. |
2381 ]. |
2193 |
2382 |
2194 "/ for each, get the files size. |
2383 "/ for each, get the files size. |
2195 "/ in a first pass, look for files of the same size and |
2384 "/ in a first pass, look for files of the same size and |
2196 "/ compare them ... |
2385 "/ compare them ... |
2197 |
2386 |
2198 filesBySize := Dictionary new. |
2387 filesBySize := Dictionary new. |
2199 infoDir keysAndValuesDo:[:fn :info | |
2388 infoDir keysAndValuesDo:[:fn :info | |
2200 |sz entry| |
2389 |sz entry| |
2201 |
2390 |
2202 sz := info size. |
2391 sz := info size. |
2203 entry := filesBySize at:sz ifAbsentPut:[Set new]. |
2392 entry := filesBySize at:sz ifAbsentPut:[Set new]. |
2204 entry add:fn. |
2393 entry add:fn. |
2205 ]. |
2394 ]. |
2206 |
2395 |
2207 "/ any of same size ? |
2396 "/ any of same size ? |
2208 |
2397 |
2209 filesBySize do:[:entry | |
2398 filesBySize do:[:entry | |
2210 |files| |
2399 |files| |
2211 |
2400 |
2212 entry size > 1 ifTrue:[ |
2401 entry size > 1 ifTrue:[ |
2213 files := entry asArray. |
2402 files := entry asArray. |
2214 1 to:files size-1 do:[:idx1 | |
2403 1 to:files size-1 do:[:idx1 | |
2215 idx1+1 to:files size do:[:idx2 | |
2404 idx1+1 to:files size do:[:idx2 | |
2216 |fn1 fn2| |
2405 |fn1 fn2| |
2217 |
2406 |
2218 fn1 := files at:idx1. |
2407 fn1 := files at:idx1. |
2219 fn2 := files at:idx2. |
2408 fn2 := files at:idx2. |
2220 |
2409 |
2221 (result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
2410 (result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[ |
2222 "/ compare the files |
2411 "/ compare the files |
2223 (fn1 sameContentsAs:fn2) ifTrue:[ |
2412 (fn1 sameContentsAs:fn2) ifTrue:[ |
2224 "/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
2413 "/ Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName. |
2225 result at:fn1 put:fn2. |
2414 result at:fn1 put:fn2. |
2226 ] |
2415 ] |
2227 ] |
2416 ] |
2228 ] |
2417 ] |
2229 ] |
2418 ] |
2230 ] |
2419 ] |
2231 ]. |
2420 ]. |
2232 |
2421 |
2233 result := result associations. |
2422 result := result associations. |
2234 result := result collect:[:assoc | |
2423 result := result collect:[:assoc | |
2235 |f1 f2| |
2424 |f1 f2| |
2236 |
2425 |
2237 f1 := assoc key baseName. |
2426 f1 := assoc key baseName. |
2238 f2 := assoc value baseName. |
2427 f2 := assoc value baseName. |
2239 f1 < f2 ifTrue:[ |
2428 f1 < f2 ifTrue:[ |
2240 f2 -> f1 |
2429 f2 -> f1 |
2241 ] ifFalse:[ |
2430 ] ifFalse:[ |
2242 f1 -> f2 |
2431 f1 -> f2 |
2243 ] |
2432 ] |
2244 ]. |
2433 ]. |
2245 result sort:[:f1 :f2 | f2 value < f1 value]. |
2434 result sort:[:f1 :f2 | f2 value < f1 value]. |
2246 |
2435 |
2247 info := OrderedCollection new. |
2436 info := OrderedCollection new. |
2248 result do:[:assoc | |
2437 result do:[:assoc | |
2249 info add:(assoc key , ' same as ' , assoc value) |
2438 info add:(assoc key , ' same as ' , assoc value) |
2250 ]. |
2439 ]. |
2251 info isEmpty ifTrue:[ |
2440 info isEmpty ifTrue:[ |
2252 info := 'No duplicate files found.' |
2441 info := 'No duplicate files found.' |
2253 ]. |
2442 ]. |
2254 ]. |
2443 ]. |
2255 |
2444 |
2256 subView contents:info |
2445 subView contents:info |
2257 |
2446 |
2258 "Created: / 3.10.1998 / 17:59:00 / cg" |
2447 "Created: / 3.10.1998 / 17:59:00 / cg" |
2639 <resource: #programMenu> |
2828 <resource: #programMenu> |
2640 |
2829 |
2641 |items m sel ns subMenu subItems| |
2830 |items m sel ns subMenu subItems| |
2642 |
2831 |
2643 items := #( |
2832 items := #( |
2644 ('spawn' fileSpawn ) |
2833 ('spawn' fileSpawn ) |
2645 ('-' nil ) |
2834 ('-' nil ) |
2646 ('get contents' fileGet GotoLine) |
2835 ('get contents' fileGet GotoLine) |
2647 ('insert contents' fileInsert ) |
2836 ('insert contents' fileInsert ) |
2648 ('show info' fileGetInfo InspectIt) |
2837 ('show info' fileGetInfo InspectIt) |
2649 ('show full info' fileGetLongInfo CmdI) |
2838 ('show full info' fileGetLongInfo CmdI) |
2650 ). |
2839 ). |
2651 |
2840 |
2652 ((ns := Project current defaultNameSpace) notNil |
2841 ((ns := Project current defaultNameSpace) notNil |
2653 and:[ns ~~ Smalltalk]) ifTrue:[ |
2842 and:[ns ~~ Smalltalk]) ifTrue:[ |
2654 items := items copyWith:(Array |
2843 items := items copyWith:(Array |
2655 with:(resources string:'fileIn (into ''%1'')' with:(Project current defaultNameSpace name)) |
2844 with:(resources string:'fileIn (into ''%1'')' with:(Project current defaultNameSpace name)) |
2656 with:#fileFileIn |
2845 with:#fileFileIn |
2657 with:#Accept) |
2846 with:#Accept) |
2658 |
2847 |
2659 ] ifFalse:[ |
2848 ] ifFalse:[ |
2660 items := items copyWith:#( 'fileIn' #fileFileIn #Accept) |
2849 items := items copyWith:#( 'fileIn' #fileFileIn #Accept) |
2661 ]. |
2850 ]. |
2662 |
2851 |
2663 items := items , #( |
2852 items := items , #( |
2664 ('-' ) |
2853 ('-' ) |
2665 ('update' updateCurrentDirectory Cmdu) |
2854 ('update' updateCurrentDirectory Cmdu) |
2666 ('-' ) |
2855 ('-' ) |
2667 ('execute unix command ...' fileExecute DoIt) |
2856 ('execute unix command ...' fileExecute DoIt) |
2668 ('st/x tools' stxTools ) |
2857 ('st/x tools' stxTools ) |
2669 ('-' ) |
2858 ('-' ) |
2670 ('remove' fileRemove Delete) |
2859 ('remove' fileRemove Delete) |
2671 ('rename ...' fileRename ) |
2860 ('rename ...' fileRename ) |
2672 ('-' ) |
2861 ('-' ) |
2673 ('display long list' changeDisplayMode ) |
2862 ('display long list' changeDisplayMode ) |
2674 ('show all files' changeDotFileVisibility ) |
2863 ('show all files' changeDotFileVisibility ) |
2675 ('encoding ...' fileEncoding ) |
2864 ('encoding ...' fileEncoding ) |
2676 ('-' ) |
2865 ('-' ) |
2677 ('create directory ...' newDirectory CmdD) |
2866 ('create directory ...' newDirectory CmdD) |
2678 ('create file ...' newFile CmdF) |
2867 ('create file ...' newFile CmdF) |
2679 ). |
2868 ). |
2680 |
2869 |
2681 m := PopUpMenu |
2870 m := PopUpMenu |
2682 itemList:items |
2871 itemList:items |
2683 resources:resources. |
2872 resources:resources. |
2684 |
2873 |
2685 showingHiddenFiles value "showDotFiles" ifTrue:[ |
2874 showingHiddenFiles value "showDotFiles" ifTrue:[ |
2686 m labelAt:#changeDotFileVisibility put:(resources string:'hide hidden files') |
2875 m labelAt:#changeDotFileVisibility put:(resources string:'hide hidden files') |
2687 ]. |
2876 ]. |
2688 showingDetails value "showLongList" ifTrue:[ |
2877 showingDetails value "showLongList" ifTrue:[ |
2689 m labelAt:#changeDisplayMode put:(resources string:'display short list') |
2878 m labelAt:#changeDisplayMode put:(resources string:'display short list') |
2690 ]. |
2879 ]. |
2691 |
2880 |
2692 items := #( |
2881 items := #( |
2693 ('Changes browser' openChangesBrowser ) |
2882 ('Changes browser' openChangesBrowser ) |
2694 ('Editor' openEditor ) |
2883 ('Editor' openEditor ) |
2695 ('HTML reader' openHTMLReader ) |
2884 ('HTML reader' openHTMLReader ) |
2696 ('Image inspect' openImageInspector ) |
2885 ('Image inspect' openImageInspector ) |
2697 ('show file differences' openDiffView ) |
2886 ('show file differences' openDiffView ) |
2698 ). |
2887 ). |
2699 |
2888 |
2700 OperatingSystem isUNIXlike ifTrue:[ |
2889 OperatingSystem isUNIXlike ifTrue:[ |
2701 items := items , #( ('terminal' openTerminal )). |
2890 items := items , #( ('terminal' openTerminal )). |
2702 ]. |
2891 ]. |
2703 |
2892 |
2704 JavaInterpreter notNil ifTrue:[ |
2893 JavaInterpreter notNil ifTrue:[ |
2705 items := items , #( ('Java Applet Viewer' openAppletViewer)). |
2894 items := items , #( ('Java Applet Viewer' openAppletViewer)). |
2706 ]. |
2895 ]. |
2707 |
2896 |
2708 m subMenuAt:#stxTools |
2897 m subMenuAt:#stxTools |
2709 put:(PopUpMenu |
2898 put:(PopUpMenu |
2710 itemList:items |
2899 itemList:items |
2711 resources:resources). |
2900 resources:resources). |
2712 |
2901 |
2713 ((sel := fileListView selection) isNil |
2902 ((sel := fileListView selection) isNil |
2714 or:[sel isEmpty]) ifTrue:[ |
2903 or:[sel isEmpty]) ifTrue:[ |
2715 m disableAll:#(fileGet fileInsert |
2904 m disableAll:#(fileGet fileInsert |
2716 fileGetInfo fileGetLongInfo |
2905 fileGetInfo fileGetLongInfo |
2717 fileFileIn fileFileInLazy |
2906 fileFileIn fileFileInLazy |
2718 fileRemove fileRename). |
2907 fileRemove fileRename). |
2719 (m subMenuAt:#stxTools) |
2908 (m subMenuAt:#stxTools) |
2720 disableAll:#(openChangesBrowser openEditor openHTMLReader openImageInspector) |
2909 disableAll:#(openChangesBrowser openEditor openHTMLReader openImageInspector) |
2721 ] ifFalse:[ |
2910 ] ifFalse:[ |
2722 fileListView selection size > 1 ifTrue:[ |
2911 fileListView selection size > 1 ifTrue:[ |
2723 m disableAll:#( fileGet fileInsert fileGetInfo fileGetLongInfo fileRename ) |
2912 m disableAll:#( fileGet fileInsert fileGetInfo fileGetLongInfo fileRename ) |
2724 ] |
2913 ] |
2725 ]. |
2914 ]. |
2726 |
2915 |
2727 ^m |
2916 ^m |
2728 |
2917 |
2729 "Modified: / 16.1.1998 / 16:42:59 / stefan" |
2918 "Modified: / 16.1.1998 / 16:42:59 / stefan" |
2735 "send a files contents to the printer (not in the menu)" |
2924 "send a files contents to the printer (not in the menu)" |
2736 |
2925 |
2737 |fileName path inStream printStream line| |
2926 |fileName path inStream printStream line| |
2738 |
2927 |
2739 self withWaitCursorDo:[ |
2928 self withWaitCursorDo:[ |
2740 fileName := self getSelectedFileName. |
2929 fileName := self getSelectedFileName. |
2741 fileName notNil ifTrue:[ |
2930 fileName notNil ifTrue:[ |
2742 path := currentDirectory filenameFor:fileName. |
2931 path := currentDirectory filenameFor:fileName. |
2743 (path type == #regular) ifTrue:[ |
2932 (path type == #regular) ifTrue:[ |
2744 inStream := path readStream. |
2933 inStream := path readStream. |
2745 inStream isNil ifFalse:[ |
2934 inStream isNil ifFalse:[ |
2746 printStream := PrinterStream new. |
2935 printStream := PrinterStream new. |
2747 printStream notNil ifTrue:[ |
2936 printStream notNil ifTrue:[ |
2748 [inStream atEnd] whileFalse:[ |
2937 [inStream atEnd] whileFalse:[ |
2749 line := inStream nextLine. |
2938 line := inStream nextLine. |
2750 printStream nextPutLine:line. |
2939 printStream nextPutLine:line. |
2751 ]. |
2940 ]. |
2752 printStream close |
2941 printStream close |
2753 ]. |
2942 ]. |
2754 inStream close |
2943 inStream close |
2755 ] |
2944 ] |
2756 ] |
2945 ] |
2757 ]. |
2946 ]. |
2758 0 "compiler hint" |
2947 0 "compiler hint" |
2759 ] |
2948 ] |
2760 |
2949 |
2761 "Modified: 23.4.1997 / 13:05:40 / cg" |
2950 "Modified: 23.4.1997 / 13:05:40 / cg" |
2762 "Modified: 18.9.1997 / 16:29:17 / stefan" |
2951 "Modified: 18.9.1997 / 16:29:17 / stefan" |
2763 ! |
2952 ! |
2895 self class openOn:(path pathName). |
3084 self class openOn:(path pathName). |
2896 any := true |
3085 any := true |
2897 ] |
3086 ] |
2898 ]. |
3087 ]. |
2899 any ifFalse:[ |
3088 any ifFalse:[ |
2900 self class openOn:currentDirectory pathName withExtent:self topView extent |
3089 "/ access by name, to get most up-to-date version |
|
3090 "/ (if changed in the browser, and the running one is old) |
|
3091 (Smalltalk at:(self class name)) |
|
3092 openOn:currentDirectory pathName withExtent:self topView extent |
2901 ] |
3093 ] |
2902 |
3094 |
2903 "Modified: 18.9.1997 / 16:32:39 / stefan" |
3095 "Modified: 18.9.1997 / 16:32:39 / stefan" |
2904 ! |
3096 ! |
2905 |
3097 |
2906 loadImageAndPerform:aSelectorOrBlock |
3098 loadImageAndPerform:aSelectorOrBlock |
2907 |img path| |
3099 |img path| |
2908 |
3100 |
2909 self selectedFilesDo:[:fileName | |
3101 self selectedFilesDo:[:fileName | |
2910 path := currentDirectory filenameFor:fileName. |
3102 path := currentDirectory filenameFor:fileName. |
2911 path isDirectory ifFalse:[ |
3103 path isDirectory ifFalse:[ |
2912 img := Image fromFile:(path pathName). |
3104 img := Image fromFile:(path pathName). |
2913 img notNil ifTrue:[ |
3105 img notNil ifTrue:[ |
2914 aSelectorOrBlock isSymbol ifTrue:[ |
3106 aSelectorOrBlock isSymbol ifTrue:[ |
2915 img perform:aSelectorOrBlock |
3107 img perform:aSelectorOrBlock |
2916 ] ifFalse:[ |
3108 ] ifFalse:[ |
2917 aSelectorOrBlock value:img |
3109 aSelectorOrBlock value:img |
2918 ] |
3110 ] |
2919 ] ifFalse:[ |
3111 ] ifFalse:[ |
2920 self warn:'unknown format: ' , fileName |
3112 self warn:'unknown format: ' , fileName |
2921 ] |
3113 ] |
2922 ] |
3114 ] |
2923 ]. |
3115 ]. |
2924 |
3116 |
2925 "Modified: / 17.9.1995 / 17:41:24 / claus" |
3117 "Modified: / 17.9.1995 / 17:41:24 / claus" |
2926 "Modified: / 18.9.1997 / 17:05:04 / stefan" |
3118 "Modified: / 18.9.1997 / 17:05:04 / stefan" |
2927 "Created: / 26.8.1998 / 16:20:18 / cg" |
3119 "Created: / 26.8.1998 / 16:20:18 / cg" |
3107 |
3299 |
3108 openAppletViewer |
3300 openAppletViewer |
3109 |numItems| |
3301 |numItems| |
3110 |
3302 |
3111 (numItems := fileListView selection size) > 2 ifTrue:[ |
3303 (numItems := fileListView selection size) > 2 ifTrue:[ |
3112 (self |
3304 (self |
3113 confirm:(resources string:'open for each of the %1 items ?' |
3305 confirm:(resources string:'open for each of the %1 items ?' |
3114 with:numItems)) ifFalse:[^ self]. |
3306 with:numItems)) ifFalse:[^ self]. |
3115 ]. |
3307 ]. |
3116 |
3308 |
3117 Java startupJavaSystem. |
3309 Java startupJavaSystem. |
3118 "/ Java markAllClassesUninitialized. |
3310 "/ Java markAllClassesUninitialized. |
3119 "/ Java initAllStaticFields. |
3311 "/ Java initAllStaticFields. |
3120 "/ Java initAllClasses. |
3312 "/ Java initAllClasses. |
3121 |
3313 |
3122 self selectedFilesDo:[:fileName | |
3314 self selectedFilesDo:[:fileName | |
3123 |p path| |
3315 |p path| |
3124 |
3316 |
3125 path := currentDirectory filenameFor:fileName. |
3317 path := currentDirectory filenameFor:fileName. |
3126 path isDirectory ifFalse:[ |
3318 path isDirectory ifFalse:[ |
3127 p := Java |
3319 p := Java |
3128 javaProcessForMainOf:(Java classForName:'sun.applet.AppletViewer') |
3320 javaProcessForMainOf:(Java classForName:'sun.applet.AppletViewer') |
3129 argumentString:path pathName. |
3321 argumentString:path pathName. |
3130 p resume. |
3322 p resume. |
3131 ] |
3323 ] |
3132 ]. |
3324 ]. |
3133 |
3325 |
3134 "Modified: / 18.9.1997 / 17:00:59 / stefan" |
3326 "Modified: / 18.9.1997 / 17:00:59 / stefan" |
3135 "Modified: / 17.10.1998 / 17:00:43 / cg" |
3327 "Modified: / 17.10.1998 / 17:00:43 / cg" |
3136 ! |
3328 ! |
3428 |
3620 |
3429 showOrHideTabView |
3621 showOrHideTabView |
3430 "depending on the showLongList setting, show or hde the tabSpec view" |
3622 "depending on the showLongList setting, show or hde the tabSpec view" |
3431 |
3623 |
3432 showingDetails value "showLongList" ifTrue:[ |
3624 showingDetails value "showLongList" ifTrue:[ |
3433 tabRulerView isNil ifTrue:[ |
3625 tabRulerView isNil ifTrue:[ |
3434 self createTabRulerIn:scrollView superView. |
3626 self createTabRulerIn:scrollView superView. |
3435 ]. |
3627 ]. |
3436 tabRulerView beVisible. |
3628 tabRulerView beVisible. |
3437 |
3629 |
3438 false "self is3D" ifTrue:[ |
3630 false "self is3D" ifTrue:[ |
3439 scrollView topInset:(tabRulerView superView height). |
3631 scrollView topInset:(tabRulerView superView height). |
3440 tabRulerView superView leftInset:(fileListView originRelativeTo:scrollView) x. |
3632 tabRulerView superView leftInset:(fileListView originRelativeTo:scrollView) x. |
3441 ] ifFalse:[ |
3633 ] ifFalse:[ |
3442 scrollView topInset:(tabRulerView height). |
3634 scrollView topInset:(tabRulerView height). |
3443 tabRulerView leftInset:(fileListView originRelativeTo:scrollView) x. |
3635 tabRulerView leftInset:(fileListView originRelativeTo:scrollView) x. |
3444 ]. |
3636 ]. |
3445 tabRulerView hiddenTabs:#(1). |
3637 tabRulerView hiddenTabs:#(1). |
3446 tabRulerView fixedTabs:#(1). |
3638 tabRulerView fixedTabs:#(1). |
3447 ] ifFalse:[ |
3639 ] ifFalse:[ |
3448 tabRulerView notNil ifTrue:[ |
3640 tabRulerView notNil ifTrue:[ |
3449 tabRulerView beInvisible. |
3641 tabRulerView beInvisible. |
3450 ]. |
3642 ]. |
3451 scrollView topInset:0 |
3643 scrollView topInset:0 |
3452 ]. |
3644 ]. |
3453 tabSpec := nil. |
3645 tabSpec := nil. |
3454 |
3646 |
3455 "Created: / 19.4.1997 / 09:50:02 / cg" |
3647 "Created: / 19.4.1997 / 09:50:02 / cg" |
3456 "Modified: / 4.8.1998 / 13:44:14 / cg" |
3648 "Modified: / 4.8.1998 / 13:44:14 / cg" |
4243 needUpdate := (currentDirectory modificationTime > timeOfLastCheck). |
4469 needUpdate := (currentDirectory modificationTime > timeOfLastCheck). |
4244 |
4470 |
4245 yesToAll := false. |
4471 yesToAll := false. |
4246 lockUpdate := true. |
4472 lockUpdate := true. |
4247 [ |
4473 [ |
4248 filesToRemove do:[:fileName | |
4474 filesToRemove do:[:fileName | |
4249 |f| |
4475 |f| |
4250 |
4476 |
4251 f := currentDirectory construct:fileName. |
4477 f := currentDirectory construct:fileName. |
4252 OperatingSystem accessDeniedErrorSignal handle:[:ex| |
4478 OperatingSystem accessDeniedErrorSignal handle:[:ex| |
4253 "was not able to remove it" |
4479 "was not able to remove it" |
4254 msg := (resources string:'cannot remove ''%1'' !!' with:fileName). |
4480 msg := (resources string:'cannot remove ''%1'' !!' with:fileName). |
4255 self showAlert:msg with:(OperatingSystem lastErrorString) |
4481 self showAlert:msg with:(OperatingSystem lastErrorString) |
4256 ] do:[ |
4482 ] do:[ |
4257 |answer contents| |
4483 |answer contents| |
4258 |
4484 |
4259 (f isSymbolicLink not) ifTrue:[ |
4485 (f isSymbolicLink not) ifTrue:[ |
4260 self |
4486 self |
4261 doExecuteCommand:('cvs remove -f ' , f baseName) |
4487 doExecuteCommand:('cvs remove -f ' , f baseName) |
4262 replace:false. |
4488 replace:false. |
4263 |
4489 |
4264 " |
4490 " |
4265 self show:nil |
4491 self show:nil |
4266 " |
4492 " |
4267 idx := fileList indexOf:fileName. |
4493 idx := fileList indexOf:fileName. |
4268 idx ~~ 0 ifTrue:[ |
4494 idx ~~ 0 ifTrue:[ |
4269 toRemove add:idx. |
4495 toRemove add:idx. |
4270 ] |
4496 ] |
4271 ] |
4497 ] |
4272 ]. |
4498 ]. |
4273 ]. |
4499 ]. |
4274 ] valueNowOrOnUnwindDo:[ |
4500 ] valueNowOrOnUnwindDo:[ |
4275 lockUpdate := false. |
4501 lockUpdate := false. |
4276 fileListView setSelection:nil. |
4502 fileListView setSelection:nil. |
4277 |
4503 |
4278 "/ |
4504 "/ |
4279 "/ remove reverse - otherwise indices are wrong |
4505 "/ remove reverse - otherwise indices are wrong |
4280 "/ |
4506 "/ |
4281 toRemove sort. |
4507 toRemove sort. |
4282 toRemove reverseDo:[:idx | |
4508 toRemove reverseDo:[:idx | |
4283 fileList removeIndex:idx. |
4509 fileList removeIndex:idx. |
4284 fileListView removeIndex:idx. |
4510 fileListView removeIndex:idx. |
4285 ]. |
4511 ]. |
4286 |
4512 |
4287 updateRunning ifTrue:[ |
4513 updateRunning ifTrue:[ |
4288 self updateCurrentDirectory |
4514 self updateCurrentDirectory |
4289 ] ifFalse:[ |
4515 ] ifFalse:[ |
4290 " |
4516 " |
4291 install a new check after some time |
4517 install a new check after some time |
4292 " |
4518 " |
4293 needUpdate ifFalse:[timeOfLastCheck := AbsoluteTime now]. |
4519 needUpdate ifFalse:[timeOfLastCheck := AbsoluteTime now]. |
4294 Processor removeTimedBlock:checkBlock. |
4520 Processor removeTimedBlock:checkBlock. |
4295 Processor addTimedBlock:checkBlock afterSeconds:checkDelta. |
4521 Processor addTimedBlock:checkBlock afterSeconds:checkDelta. |
4296 ] |
4522 ] |
4297 ]. |
4523 ]. |
4298 |
4524 |
4299 self |
4525 self |
4300 doExecuteCommand:('cvs commit -m ''removed via FileBrowser''') |
4526 doExecuteCommand:('cvs commit -m ''removed via FileBrowser''') |
4301 replace:false. |
4527 replace:false. |
4302 |
4528 |
4303 "Modified: / 21.10.1998 / 17:02:11 / cg" |
4529 "Modified: / 21.10.1998 / 17:02:11 / cg" |
4304 ! ! |
4530 ! ! |
4305 |
4531 |
4306 !FileBrowser methodsFor:'misc user interaction'! |
4532 !FileBrowser methodsFor:'misc user interaction'! |
4407 |
4633 |
4408 update:what with:someArgument from:changedObject |
4634 update:what with:someArgument from:changedObject |
4409 realized ifFalse:[^ self]. |
4635 realized ifFalse:[^ self]. |
4410 |
4636 |
4411 (what == #aboutToExit) ifTrue:[ |
4637 (what == #aboutToExit) ifTrue:[ |
4412 "system wants to shut down this |
4638 "system wants to shut down this |
4413 - if text was modified, pop up, and ask user and save if requested." |
4639 - if text was modified, pop up, and ask user and save if requested." |
4414 |
4640 |
4415 (subView modified and:[subView contentsWasSaved not]) ifTrue:[ |
4641 (subView modified and:[subView contentsWasSaved not]) ifTrue:[ |
4416 self raiseDeiconified. |
4642 self raiseDeiconified. |
4417 |
4643 |
4418 (self |
4644 (self |
4419 ask:(resources at:'FileBrowser:\\contents has not been saved.\\Save before exiting ?') |
4645 ask:(resources at:'FileBrowser:\\contents has not been saved.\\Save before exiting ?') |
4420 yesButton:'save' |
4646 yesButton:'save' |
4421 noButton:'don''t save') |
4647 noButton:'don''t save') |
4422 ifTrue:[ |
4648 ifTrue:[ |
4423 subView acceptAction notNil ifTrue:[ |
4649 subView acceptAction notNil ifTrue:[ |
4424 subView accept |
4650 subView accept |
4425 ] ifFalse:[ |
4651 ] ifFalse:[ |
4426 subView save |
4652 subView save |
4427 ] |
4653 ] |
4428 ] |
4654 ] |
4429 ]. |
4655 ]. |
4430 ^ self |
4656 ^ self |
4431 ]. |
4657 ]. |
4432 changedObject == tabSpec ifTrue:[ |
4658 changedObject == tabSpec ifTrue:[ |
4433 fileListView invalidate |
4659 fileListView invalidate |
4434 ]. |
4660 ]. |
4435 |
4661 |
4436 "Modified: 29.5.1996 / 16:13:43 / cg" |
4662 "Modified: 29.5.1996 / 16:13:43 / cg" |
4437 ! ! |
4663 ! ! |
4438 |
4664 |
4456 |
4682 |
4457 "Modified: 14.12.1996 / 15:37:47 / cg" |
4683 "Modified: 14.12.1996 / 15:37:47 / cg" |
4458 "Created: 2.8.1997 / 14:11:19 / cg" |
4684 "Created: 2.8.1997 / 14:11:19 / cg" |
4459 ! |
4685 ! |
4460 |
4686 |
|
4687 bookmarksMenuSpec |
|
4688 "return the bookmarksMenu for the path label" |
|
4689 |
|
4690 <resource: #programMenu> |
|
4691 |
|
4692 ^ self menuFromSpec:(self class bookmarksMenuSpec). |
|
4693 ! |
|
4694 |
4461 changeCurrentDirectory |
4695 changeCurrentDirectory |
4462 "if text was modified show a queryBox, |
4696 "if text was modified show a queryBox, |
4463 otherwise ask for & change to that directory" |
4697 otherwise ask for & change to that directory" |
4464 |
4698 |
4465 self discardChangesDialog ifTrue:[ |
4699 self discardChangesDialog ifTrue:[ |
4466 self queryForDirectoryToChange |
4700 self queryForDirectoryToChange |
4467 ] |
4701 ] |
4468 |
4702 |
4469 "Modified: 21.9.1997 / 23:45:35 / cg" |
4703 "Modified: 21.9.1997 / 23:45:35 / cg" |
4470 "Modified: 2.10.1997 / 14:09:02 / stefan" |
4704 "Modified: 2.10.1997 / 14:09:02 / stefan" |
4471 ! |
4705 ! |
4472 |
4706 |
4473 changeDirectoryTo:aDirectoryName |
4707 changeDirectoryTo:aDirectoryName |
4474 "sent from label menu to change back to a previous directory" |
4708 "sent from label menu to change back to a previous directory" |
4475 |
4709 |
4476 self discardChangesDialog ifTrue:[ |
4710 self discardChangesDialog ifTrue:[ |
4477 self doChangeCurrentDirectoryTo:aDirectoryName updateHistory:true "/false. |
4711 self doChangeCurrentDirectoryTo:aDirectoryName updateHistory:true "/false. |
4478 ]. |
4712 ]. |
4479 |
4713 |
4480 "Modified: / 2.10.1997 / 14:09:24 / stefan" |
4714 "Modified: / 2.10.1997 / 14:09:24 / stefan" |
4481 "Modified: / 21.7.1998 / 16:38:03 / cg" |
4715 "Modified: / 21.7.1998 / 16:38:03 / cg" |
4482 ! |
4716 ! |
4591 |
4825 |
4592 "Created: / 9.11.1998 / 05:42:05 / cg" |
4826 "Created: / 9.11.1998 / 05:42:05 / cg" |
4593 "Modified: / 9.11.1998 / 05:56:14 / cg" |
4827 "Modified: / 9.11.1998 / 05:56:14 / cg" |
4594 ! |
4828 ! |
4595 |
4829 |
|
4830 historyMenuSpec |
|
4831 "return the historyMenu for the path label" |
|
4832 |
|
4833 <resource: #programMenu> |
|
4834 |
|
4835 ^ self menuFromSpec:(self class historyMenuSpec). |
|
4836 ! |
|
4837 |
4596 labelMenu |
4838 labelMenu |
4597 "return the popUpMenu for the path label" |
4839 "return the popUpMenu for the path label" |
4598 |
4840 |
4599 <resource: #programMenu> |
4841 <resource: #programMenu> |
4600 |
4842 |
4601 |m| |
4843 ^ self menuFromSpec:(self class directoryMenuSpec). |
4602 |
|
4603 m := self class directoryMenuSpec. |
|
4604 m menuPerformer:self. |
|
4605 ^ m |
|
4606 |
|
4607 "Modified: / 14.8.1998 / 12:11:16 / cg" |
|
4608 ! |
4844 ! |
4609 |
4845 |
4610 labelMenu_old |
4846 labelMenu_old |
4611 "return the popUpMenu for the path label" |
4847 "return the popUpMenu for the path label" |
4612 |
4848 |
4613 <resource: #programMenu> |
4849 <resource: #programMenu> |
4614 |
4850 |
4615 |items menu currentIndex| |
4851 |items menu currentIndex| |
4616 |
4852 |
4617 items := #( |
4853 items := #( |
4618 ('copy path' copyPath ) |
4854 ('copy path' copyPath ) |
4619 ('-' ) |
4855 ('-' ) |
4620 ('up' changeToParentDirectory ) |
4856 ('up' changeToParentDirectory ) |
4621 ('back' changeToPreviousDirectory ) |
4857 ('back' changeToPreviousDirectory ) |
4622 ('change to home-directory' changeToHomeDirectory ) |
4858 ('change to home-directory' changeToHomeDirectory ) |
4623 ('change to default-directory' changeToDefaultDirectory ) |
4859 ('change to default-directory' changeToDefaultDirectory ) |
4624 ('change directory ...' changeCurrentDirectory ) |
4860 ('change directory ...' changeCurrentDirectory ) |
4625 ). |
4861 ). |
4626 |
4862 |
4627 (JavaClassReader notNil and:[JavaClassReader isLoaded]) ifTrue:[ |
4863 (JavaClassReader notNil and:[JavaClassReader isLoaded]) ifTrue:[ |
4628 items := items , #( |
4864 items := items , #( |
4629 ( '-') |
4865 ( '-') |
4630 ( 'add to JavaClassPath' addDirToJavaClassPath) |
4866 ( 'add to JavaClassPath' addDirToJavaClassPath) |
4631 ( 'add to JavaSourcePath' addDirToJavaSourcePath) |
4867 ( 'add to JavaSourcePath' addDirToJavaSourcePath) |
4632 ( 'remove from JavaClassPath' removeDirFromJavaClassPath) |
4868 ( 'remove from JavaClassPath' removeDirFromJavaClassPath) |
4633 ( 'remove from JavaSourcePath' removeDirFromJavaSourcePath) |
4869 ( 'remove from JavaSourcePath' removeDirFromJavaSourcePath) |
4634 ). |
4870 ). |
4635 ]. |
4871 ]. |
4636 |
4872 |
4637 DirectoryHistory size > 0 ifTrue:[ |
4873 DirectoryHistory size > 0 ifTrue:[ |
4638 items := items copyWith:#('-'). |
4874 items := items copyWith:#('-'). |
4639 items := items , |
4875 items := items , |
4640 (DirectoryHistory |
4876 (DirectoryHistory |
4641 collect:[:dirName | |
4877 collect:[:dirName | |
4642 Array |
4878 Array |
4643 with:dirName |
4879 with:dirName |
4644 with:#changeDirectoryTo: |
4880 with:#changeDirectoryTo: |
4645 with:nil |
4881 with:nil |
4646 with:dirName |
4882 with:dirName |
4647 ] |
4883 ] |
4648 ). |
4884 ). |
4649 currentIndex := items findFirst:[:i | (i at:1) = currentDirectory pathName]. |
4885 currentIndex := items findFirst:[:i | (i at:1) = currentDirectory pathName]. |
4650 currentIndex == 0 ifTrue:[currentIndex := nil]. |
4886 currentIndex == 0 ifTrue:[currentIndex := nil]. |
4651 ]. |
4887 ]. |
4652 |
4888 |
4653 menu := PopUpMenu |
4889 menu := PopUpMenu |
4654 itemList:items |
4890 itemList:items |
4655 resources:resources. |
4891 resources:resources. |
4656 |
4892 |
4657 previousDirectory isNil ifTrue:[ |
4893 previousDirectory isNil ifTrue:[ |
4658 menu disable:#changeToPreviousDirectory. |
4894 menu disable:#changeToPreviousDirectory. |
4659 ]. |
4895 ]. |
4660 currentIndex notNil ifTrue:[ |
4896 currentIndex notNil ifTrue:[ |
4661 menu disable:currentIndex |
4897 menu disable:currentIndex |
4662 ]. |
4898 ]. |
4663 (JavaClassReader notNil and:[JavaClassReader isLoaded]) ifTrue:[ |
4899 (JavaClassReader notNil and:[JavaClassReader isLoaded]) ifTrue:[ |
4664 (Java classPath includes:currentDirectory pathName) ifTrue:[ |
4900 (Java classPath includes:currentDirectory pathName) ifTrue:[ |
4665 menu disable:#addDirToJavaClassPath |
4901 menu disable:#addDirToJavaClassPath |
4666 ] ifFalse:[ |
4902 ] ifFalse:[ |
4667 menu disable:#removeDirFromJavaClassPath |
4903 menu disable:#removeDirFromJavaClassPath |
4668 ]. |
4904 ]. |
4669 (Java sourcePath includes:currentDirectory pathName) ifTrue:[ |
4905 (Java sourcePath includes:currentDirectory pathName) ifTrue:[ |
4670 menu disable:#addDirToJavaSourcePath |
4906 menu disable:#addDirToJavaSourcePath |
4671 ] ifFalse:[ |
4907 ] ifFalse:[ |
4672 menu disable:#removeDirFromJavaSourcePath |
4908 menu disable:#removeDirFromJavaSourcePath |
4673 ]. |
4909 ]. |
4674 ]. |
4910 ]. |
4675 ^menu. |
4911 ^menu. |
4676 |
4912 |
4677 "Modified: / 21.7.1998 / 16:43:25 / cg" |
4913 "Modified: / 21.7.1998 / 16:43:25 / cg" |
4678 "Created: / 14.8.1998 / 12:10:02 / cg" |
4914 "Created: / 14.8.1998 / 12:10:02 / cg" |
5550 |
5786 |
5551 |msg path idx f| |
5787 |msg path idx f| |
5552 |
5788 |
5553 self label:myName; iconLabel:myName. |
5789 self label:myName; iconLabel:myName. |
5554 fileName notNil ifTrue:[ |
5790 fileName notNil ifTrue:[ |
5555 (f := fileName asFilename) isAbsolute ifFalse:[ |
5791 (f := fileName asFilename) isAbsolute ifFalse:[ |
5556 f := currentDirectory filenameFor:fileName. |
5792 f := currentDirectory filenameFor:fileName. |
5557 ]. |
5793 ]. |
5558 f := f asAbsoluteFilename. |
5794 f := f asAbsoluteFilename. |
5559 (f isDirectory) ifTrue:[ |
5795 (f isDirectory) ifTrue:[ |
5560 (f isReadable) ifTrue:[ |
5796 (f isReadable) ifTrue:[ |
5561 (f isExecutable) ifTrue:[ |
5797 (f isExecutable) ifTrue:[ |
5562 path := currentDirectory pathName. |
5798 path := currentDirectory pathName. |
5563 previousDirectory := path. |
5799 previousDirectory := path. |
5564 |
5800 |
5565 " |
5801 " |
5566 remember where we are positioned in the fileList |
5802 remember where we are positioned in the fileList |
5567 (in case we want to return) |
5803 (in case we want to return) |
5568 " |
5804 " |
5569 idx := DirectoryHistory indexOf:path. |
5805 idx := DirectoryHistory indexOf:path. |
5570 idx ~~ 0 ifTrue:[ |
5806 idx ~~ 0 ifTrue:[ |
5571 DirectoryHistoryWhere at:idx put:fileListView firstLineShown |
5807 DirectoryHistoryWhere at:idx put:fileListView firstLineShown |
5572 ]. |
5808 ]. |
5573 |
5809 |
5574 updateHistory ifTrue:[ |
5810 updateHistory ifTrue:[ |
5575 self addToHistory:path. |
5811 self addToHistory:path. |
5576 ]. |
5812 ]. |
5577 |
5813 |
5578 self setCurrentDirectory:(f pathName). |
5814 self setCurrentDirectory:(f pathName). |
5579 |
5815 |
5580 "/ fetch the new path. |
5816 "/ fetch the new path. |
5581 path := currentDirectory pathName. |
5817 path := currentDirectory pathName. |
5582 |
5818 |
5583 " |
5819 " |
5584 if we have already been there, look for the |
5820 if we have already been there, look for the |
5585 position offset, and scroll the fileList |
5821 position offset, and scroll the fileList |
5586 " |
5822 " |
5587 idx := DirectoryHistory indexOf:path. |
5823 idx := DirectoryHistory indexOf:path. |
5588 idx ~~ 0 ifTrue:[ |
5824 idx ~~ 0 ifTrue:[ |
5589 |pos| |
5825 |pos| |
5590 |
5826 |
5591 pos := DirectoryHistoryWhere at:idx. |
5827 pos := DirectoryHistoryWhere at:idx. |
5592 pos notNil ifTrue:[ |
5828 pos notNil ifTrue:[ |
5593 fileListView scrollToLine:pos. |
5829 fileListView scrollToLine:pos. |
5594 ] |
5830 ] |
5595 ]. |
5831 ]. |
5596 |
5832 |
5597 updateHistory ifTrue:[ |
5833 updateHistory ifTrue:[ |
5598 self addToHistory:path. |
5834 self addToHistory:path. |
5599 ]. |
5835 ]. |
5600 |
5836 |
5601 ^ self |
5837 ^ self |
5602 ]. |
5838 ]. |
5603 msg := 'cannot change directory to ''%1'' !!' |
5839 msg := 'cannot change directory to ''%1'' !!' |
5604 ] ifFalse:[ |
5840 ] ifFalse:[ |
5605 msg := 'cannot read directory ''%1'' !!' |
5841 msg := 'cannot read directory ''%1'' !!' |
5606 ] |
5842 ] |
5607 ] ifFalse:[ |
5843 ] ifFalse:[ |
5608 OperatingSystem isVMSlike ifTrue:[ |
5844 OperatingSystem isVMSlike ifTrue:[ |
5609 "/ cannot tell if it exists or is simply invisible ... |
5845 "/ cannot tell if it exists or is simply invisible ... |
5610 msg := '''%1'' is not a directory or unreadable !!' |
5846 msg := '''%1'' is not a directory or unreadable !!' |
5611 ] ifFalse:[ |
5847 ] ifFalse:[ |
5612 msg := '''%1'' is not a directory !!' |
5848 msg := '''%1'' is not a directory !!' |
5613 ] |
5849 ] |
5614 ]. |
5850 ]. |
5615 Dialog warn:(resources string:msg withCRs with:fileName). |
5851 Dialog warn:(resources string:msg withCRs with:fileName). |
5616 ] |
5852 ] |
5617 |
5853 |
5618 "Modified: / 18.9.1997 / 18:22:30 / stefan" |
5854 "Modified: / 18.9.1997 / 18:22:30 / stefan" |
5619 "Modified: / 27.4.1999 / 17:10:14 / cg" |
5855 "Modified: / 27.4.1999 / 17:10:14 / cg" |
5620 ! |
5856 ! |
5665 |newDirectory| |
5901 |newDirectory| |
5666 |
5902 |
5667 aPathName isEmpty ifTrue:[^ self]. |
5903 aPathName isEmpty ifTrue:[^ self]. |
5668 newDirectory := currentDirectory filenameFor:aPathName. |
5904 newDirectory := currentDirectory filenameFor:aPathName. |
5669 newDirectory isDirectory ifTrue:[ |
5905 newDirectory isDirectory ifTrue:[ |
5670 self currentDirectory:newDirectory. |
5906 self currentDirectory:newDirectory. |
5671 currentFileName notNil ifTrue:[ |
5907 currentFileName notNil ifTrue:[ |
5672 fileListView contents:nil. |
5908 fileListView contents:nil. |
5673 currentFileName := nil. |
5909 currentFileName := nil. |
5674 ] ifFalse:[ |
5910 ] ifFalse:[ |
5675 fileListView setSelection:nil. |
5911 fileListView setSelection:nil. |
5676 fileListView scrollToTop. |
5912 fileListView scrollToTop. |
5677 ]. |
5913 ]. |
5678 self updateCurrentDirectory. |
5914 self updateCurrentDirectory. |
5679 self showInfo. |
5915 self showInfo. |
5680 ] |
5916 ] |
5681 |
5917 |
5682 "Modified: 21.9.1995 / 11:22:45 / claus" |
5918 "Modified: 21.9.1995 / 11:22:45 / claus" |
5683 "Modified: 25.5.1996 / 12:27:01 / cg" |
5919 "Modified: 25.5.1996 / 12:27:01 / cg" |
5684 "Modified: 18.9.1997 / 17:08:07 / stefan" |
5920 "Modified: 18.9.1997 / 17:08:07 / stefan" |
5718 |
5954 |
5719 binary := false. |
5955 binary := false. |
5720 n := aBuffer size. |
5956 n := aBuffer size. |
5721 |
5957 |
5722 (idx := aBuffer findString:'charset=') ~~ 0 ifTrue:[ |
5958 (idx := aBuffer findString:'charset=') ~~ 0 ifTrue:[ |
5723 s := ReadStream on:aBuffer. |
5959 s := ReadStream on:aBuffer. |
5724 s position:idx + 8. |
5960 s position:idx + 8. |
5725 s skipSeparators. |
5961 s skipSeparators. |
5726 w := s upToSeparator. |
5962 w := s upToSeparator. |
5727 w notNil ifTrue:[ |
5963 w notNil ifTrue:[ |
5728 (idx := w indexOf:$") ~~ 0 ifTrue:[ |
5964 (idx := w indexOf:$") ~~ 0 ifTrue:[ |
5729 w := w copyTo:idx-1 |
5965 w := w copyTo:idx-1 |
5730 ]. |
5966 ]. |
5731 ^ w asSymbol |
5967 ^ w asSymbol |
5732 ]. |
5968 ]. |
5733 ]. |
5969 ]. |
5734 (idx := aBuffer findString:'encoding') ~~ 0 ifTrue:[ |
5970 (idx := aBuffer findString:'encoding') ~~ 0 ifTrue:[ |
5735 s := ReadStream on:aBuffer. |
5971 s := ReadStream on:aBuffer. |
5736 s position:idx + 8. |
5972 s position:idx + 8. |
5737 s skipSeparators. |
5973 s skipSeparators. |
5738 s peek == $: ifTrue:[ |
5974 s peek == $: ifTrue:[ |
5739 s next. |
5975 s next. |
5740 s skipSeparators. |
5976 s skipSeparators. |
5741 ]. |
5977 ]. |
5742 |
5978 |
5743 s peek == $# ifTrue:[ |
5979 s peek == $# ifTrue:[ |
5744 s next. |
5980 s next. |
5745 s skipSeparators. |
5981 s skipSeparators. |
5746 ]. |
5982 ]. |
5747 w := s upToSeparator. |
5983 w := s upToSeparator. |
5748 w notNil ifTrue:[ |
5984 w notNil ifTrue:[ |
5749 ^ w asSymbol |
5985 ^ w asSymbol |
5750 ]. |
5986 ]. |
5751 ]. |
5987 ]. |
5752 |
5988 |
5753 1 to:n do:[:i | |
5989 1 to:n do:[:i | |
5754 (aBuffer at:i) isPrintable ifFalse:[binary := true]. |
5990 (aBuffer at:i) isPrintable ifFalse:[binary := true]. |
5755 ]. |
5991 ]. |
5756 |
5992 |
5757 binary ifTrue:[ |
5993 binary ifTrue:[ |
5758 "/ look for JIS7 / EUC encoding |
5994 "/ look for JIS7 / EUC encoding |
5759 |
5995 |
5760 enc := CharacterArray guessEncodingFrom:aBuffer. |
5996 enc := CharacterArray guessEncodingFrom:aBuffer. |
5761 enc notNil ifTrue:[ |
5997 enc notNil ifTrue:[ |
5762 ^ enc |
5998 ^ enc |
5763 ]. |
5999 ]. |
5764 |
6000 |
5765 "/ if the encoding has been set to any non iso setting, |
6001 "/ if the encoding has been set to any non iso setting, |
5766 "/ assume its what we defined ... |
6002 "/ assume its what we defined ... |
5767 |
6003 |
5768 (('iso*' match:fileEncoding) or:['ascii*' match:fileEncoding]) ifTrue:[ |
6004 (('iso*' match:fileEncoding) or:['ascii*' match:fileEncoding]) ifTrue:[ |
5769 ^ #binary |
6005 ^ #binary |
5770 ]. |
6006 ]. |
5771 ^ fileEncoding ? #binary |
6007 ^ fileEncoding ? #binary |
5772 ]. |
6008 ]. |
5773 ^ #ascii |
6009 ^ #ascii |
5774 |
6010 |
5775 "Created: 26.2.1996 / 17:43:08 / cg" |
6011 "Created: 26.2.1996 / 17:43:08 / cg" |
5776 "Modified: 1.7.1997 / 00:00:27 / cg" |
6012 "Modified: 1.7.1997 / 00:00:27 / cg" |
5799 fontsEncoding := subView font encoding. |
6035 fontsEncoding := subView font encoding. |
5800 |
6036 |
5801 pref := self preferredFontEncodingFor:newEncoding. |
6037 pref := self preferredFontEncodingFor:newEncoding. |
5802 |
6038 |
5803 (pref match:fontsEncoding) ifTrue:[ |
6039 (pref match:fontsEncoding) ifTrue:[ |
5804 ^ self |
6040 ^ self |
5805 ]. |
6041 ]. |
5806 "/ stupid ... |
6042 "/ stupid ... |
5807 pref = 'ascii*' ifTrue:[ |
6043 pref = 'ascii*' ifTrue:[ |
5808 (fontsEncoding match:'iso8859*') ifTrue:[ |
6044 (fontsEncoding match:'iso8859*') ifTrue:[ |
5809 ^ self |
6045 ^ self |
5810 ] |
6046 ] |
5811 ]. |
6047 ]. |
5812 |
6048 |
5813 filter := [:f | |coding| |
6049 filter := [:f | |coding| |
5814 (coding := f encoding) notNil |
6050 (coding := f encoding) notNil |
5815 and:[pref match:coding]]. |
6051 and:[pref match:coding]]. |
5816 |
6052 |
5817 defaultFont := TextView defaultFont onDevice:device. |
6053 defaultFont := TextView defaultFont onDevice:device. |
5818 (pref match:(defaultFont encoding)) ifFalse:[ |
6054 (pref match:(defaultFont encoding)) ifFalse:[ |
5819 defaultFont := nil. |
6055 defaultFont := nil. |
5820 ]. |
6056 ]. |
5821 |
6057 |
5822 defaultFont isNil ifTrue:[ |
6058 defaultFont isNil ifTrue:[ |
5823 (pref = 'ascii*' |
6059 (pref = 'ascii*' |
5824 or:[pref = 'iso8859*']) ifTrue:[ |
6060 or:[pref = 'iso8859*']) ifTrue:[ |
5825 defaultFont := FontDescription family:'courier' face:'medium' style:'roman' size:12 |
6061 defaultFont := FontDescription family:'courier' face:'medium' style:'roman' size:12 |
5826 ] |
6062 ] |
5827 ]. |
6063 ]. |
5828 |
6064 |
5829 defaultFont isNil ifTrue:[ |
6065 defaultFont isNil ifTrue:[ |
5830 defaultFont := device |
6066 defaultFont := device |
5831 listOfAvailableFonts |
6067 listOfAvailableFonts |
5832 detect:[:f | filter value:f] |
6068 detect:[:f | filter value:f] |
5833 ifNone:nil. |
6069 ifNone:nil. |
5834 defaultFont isNil ifTrue:[ |
6070 defaultFont isNil ifTrue:[ |
5835 |
6071 |
5836 "/ flush list, and refetch font list |
6072 "/ flush list, and refetch font list |
5837 "/ (in case someone just changed the font path ...) |
6073 "/ (in case someone just changed the font path ...) |
5838 |
6074 |
5839 device flushListOfAvailableFonts. |
6075 device flushListOfAvailableFonts. |
5840 defaultFont := device |
6076 defaultFont := device |
5841 listOfAvailableFonts |
6077 listOfAvailableFonts |
5842 detect:[:f | filter value:f] |
6078 detect:[:f | filter value:f] |
5843 ifNone:nil. |
6079 ifNone:nil. |
5844 ]. |
6080 ]. |
5845 |
6081 |
5846 defaultFont isNil ifTrue:[ |
6082 defaultFont isNil ifTrue:[ |
5847 self warn:'your display does not seem to provide any ' , newEncoding , '-encoded font.'. |
6083 self warn:'your display does not seem to provide any ' , newEncoding , '-encoded font.'. |
5848 ^ self. |
6084 ^ self. |
5849 ] |
6085 ] |
5850 ]. |
6086 ]. |
5851 |
6087 |
5852 msg := 'switch to a %1 encoded font ?'. |
6088 msg := 'switch to a %1 encoded font ?'. |
5853 (ask not or:[self confirm:(resources string:msg with:pref) withCRs]) |
6089 (ask not or:[self confirm:(resources string:msg with:pref) withCRs]) |
5854 ifTrue:[ |
6090 ifTrue:[ |
5855 self withWaitCursorDo:[ |
6091 self withWaitCursorDo:[ |
5856 f := FontPanel |
6092 f := FontPanel |
5857 fontFromUserInitial:defaultFont |
6093 fontFromUserInitial:defaultFont |
5858 title:(resources string:'font selection') |
6094 title:(resources string:'font selection') |
5859 filter:filter. |
6095 filter:filter. |
5860 f notNil ifTrue:[ |
6096 f notNil ifTrue:[ |
5861 subView font:f |
6097 subView font:f |
5862 ] |
6098 ] |
5863 ] |
6099 ] |
5864 ] |
6100 ] |
5865 |
6101 |
5866 "Created: 26.10.1996 / 12:06:54 / cg" |
6102 "Created: 26.10.1996 / 12:06:54 / cg" |
5867 "Modified: 30.6.1997 / 17:46:46 / cg" |
6103 "Modified: 30.6.1997 / 17:46:46 / cg" |
5868 ! ! |
6104 ! ! |
6448 that symbol, and #decodeString: should be able to convert it." |
6684 that symbol, and #decodeString: should be able to convert it." |
6449 |
6685 |
6450 |f stream text msg sz| |
6686 |f stream text msg sz| |
6451 |
6687 |
6452 (f := fileName asFilename) isAbsolute ifFalse:[ |
6688 (f := fileName asFilename) isAbsolute ifFalse:[ |
6453 f := (currentDirectory construct:fileName) |
6689 f := (currentDirectory construct:fileName) |
6454 ]. |
6690 ]. |
6455 stream := f readStream. |
6691 stream := f readStream. |
6456 stream isNil ifTrue:[ |
6692 stream isNil ifTrue:[ |
6457 msg := (resources string:'cannot read file ''%1'' !!' with:fileName). |
6693 msg := (resources string:'cannot read file ''%1'' !!' with:fileName). |
6458 self showAlert:msg with:(FileStream lastErrorString). |
6694 self showAlert:msg with:(FileStream lastErrorString). |
6459 ^ nil |
6695 ^ nil |
6460 ]. |
6696 ]. |
6461 |
6697 |
6462 " |
6698 " |
6463 for very big files, give ObjectMemory a hint, to preallocate more |
6699 for very big files, give ObjectMemory a hint, to preallocate more |
6464 " |
6700 " |
6465 (sz := stream fileSize) > 1000000 ifTrue:[ |
6701 (sz := stream fileSize) > 1000000 ifTrue:[ |
6466 Processor activeProcess withPriority:Processor userBackgroundPriority do:[ |
6702 Processor activeProcess withPriority:Processor userBackgroundPriority do:[ |
6467 ObjectMemory announceSpaceNeed:(sz + (sz // 5)) "/ add 20% for tab expansion |
6703 ObjectMemory announceSpaceNeed:(sz + (sz // 5)) "/ add 20% for tab expansion |
6468 ]. |
6704 ]. |
6469 ]. |
6705 ]. |
6470 |
6706 |
6471 text := self readStream:stream lineDelimiter:aCharacter encoding:encoding. |
6707 text := self readStream:stream lineDelimiter:aCharacter encoding:encoding. |
6472 stream close. |
6708 stream close. |
6473 ^ text |
6709 ^ text |
6495 |
6731 |
6496 text := StringCollection new. |
6732 text := StringCollection new. |
6497 |
6733 |
6498 enc := encoding. |
6734 enc := encoding. |
6499 enc == #iso8859 ifTrue:[ |
6735 enc == #iso8859 ifTrue:[ |
6500 enc := nil |
6736 enc := nil |
6501 ]. |
6737 ]. |
6502 |
6738 |
6503 aCharacter == Character cr ifTrue:[ |
6739 aCharacter == Character cr ifTrue:[ |
6504 FileStream lineTooLongErrorSignal handle:[:ex | |
6740 FileStream lineTooLongErrorSignal handle:[:ex | |
6505 |s partialLine| |
6741 |s partialLine| |
6506 |
6742 |
6507 s := ex parameter at:1. |
6743 s := ex parameter at:1. |
6508 partialLine := ex parameter at:2. |
6744 partialLine := ex parameter at:2. |
6509 ex proceedWith:(partialLine , s upTo:aCharacter) |
6745 ex proceedWith:(partialLine , s upTo:aCharacter) |
6510 ] do:[ |
6746 ] do:[ |
6511 [aStream atEnd] whileFalse:[ |
6747 [aStream atEnd] whileFalse:[ |
6512 line := aStream nextLine withTabsExpanded. |
6748 line := aStream nextLine withTabsExpanded. |
6513 enc notNil ifTrue:[ |
6749 enc notNil ifTrue:[ |
6514 line := line decodeFrom:enc |
6750 line := line decodeFrom:enc |
6515 ]. |
6751 ]. |
6516 text add:line |
6752 text add:line |
6517 ]. |
6753 ]. |
6518 ]. |
6754 ]. |
6519 ] ifFalse:[ |
6755 ] ifFalse:[ |
6520 [aStream atEnd] whileFalse:[ |
6756 [aStream atEnd] whileFalse:[ |
6521 line := (aStream upTo:aCharacter) withTabsExpanded. |
6757 line := (aStream upTo:aCharacter) withTabsExpanded. |
6522 enc notNil ifTrue:[ |
6758 enc notNil ifTrue:[ |
6523 line := line decodeFrom:enc |
6759 line := line decodeFrom:enc |
6524 ]. |
6760 ]. |
6525 text add:line |
6761 text add:line |
6526 ]. |
6762 ]. |
6527 ]. |
6763 ]. |
6528 ^ text |
6764 ^ text |
6529 |
6765 |
6530 "Created: / 22.2.1996 / 14:58:25 / cg" |
6766 "Created: / 22.2.1996 / 14:58:25 / cg" |
6531 "Modified: / 5.2.1999 / 00:53:22 / cg" |
6767 "Modified: / 5.2.1999 / 00:53:22 / cg" |
7226 with:#( '' $r $w $x |
7462 with:#( '' $r $w $x |
7227 ' ' $r $w $x |
7463 ' ' $r $w $x |
7228 ' ' $r $w $x ). |
7464 ' ' $r $w $x ). |
7229 entry colAt:3 put:modeString. |
7465 entry colAt:3 put:modeString. |
7230 |
7466 |
7231 ((info uid) ~~ prevUid) ifTrue:[ |
7467 showingTimeAndDate value ifTrue:[ |
7232 prevUid := (info uid). |
7468 t := f isSymbolicLink |
7233 nameString := OperatingSystem getUserNameFromID:prevUid. |
7469 ifFalse:[f modificationTime] |
7234 nameString := nameString contractTo:10. |
7470 ifTrue:[f linkInfo modified]. |
7235 nameString := nameString , (String new:(10 - nameString size)) |
7471 entry colAt:4 put:t asDate printString. |
|
7472 entry colAt:5 put:t asTime printString. |
|
7473 ] ifFalse:[ |
|
7474 ((info uid) ~~ prevUid) ifTrue:[ |
|
7475 prevUid := (info uid). |
|
7476 nameString := OperatingSystem getUserNameFromID:prevUid. |
|
7477 nameString := nameString contractTo:10. |
|
7478 nameString := nameString , (String new:(10 - nameString size)) |
|
7479 ]. |
|
7480 nameString isNil ifTrue:[nameString := '???']. |
|
7481 entry colAt:4 put:nameString withoutSpaces. |
|
7482 |
|
7483 ((info gid) ~~ prevGid) ifTrue:[ |
|
7484 prevGid := (info gid). |
|
7485 groupString := OperatingSystem getGroupNameFromID:prevGid. |
|
7486 groupString := groupString contractTo:10. |
|
7487 groupString := groupString , (String new:(10 - groupString size)) |
|
7488 ]. |
|
7489 groupString isNil ifTrue:[groupString := '???']. |
|
7490 entry colAt:5 put:groupString withoutSpaces. |
7236 ]. |
7491 ]. |
7237 nameString isNil ifTrue:[nameString := '???']. |
|
7238 entry colAt:4 put:nameString withoutSpaces. |
|
7239 |
|
7240 ((info gid) ~~ prevGid) ifTrue:[ |
|
7241 prevGid := (info gid). |
|
7242 groupString := OperatingSystem getGroupNameFromID:prevGid. |
|
7243 groupString := groupString contractTo:10. |
|
7244 groupString := groupString , (String new:(10 - groupString size)) |
|
7245 ]. |
|
7246 groupString isNil ifTrue:[groupString := '???']. |
|
7247 entry colAt:5 put:groupString withoutSpaces. |
|
7248 |
7492 |
7249 (typ == #regular) ifTrue:[ |
7493 (typ == #regular) ifTrue:[ |
7250 entry colAt:6 put:(self sizePrintString:(info size)). |
7494 entry colAt:6 put:(self sizePrintString:(info size)). |
7251 ]. |
7495 ]. |
7252 |
7496 |