FileBrowser.st
changeset 3861 8d5fcf90ae5f
parent 3860 8c491484ea20
child 3862 eee340e1a930
equal deleted inserted replaced
3860:8c491484ea20 3861:8d5fcf90ae5f
    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 matchedIcons listUpdateProcess currentFileInFileName
    22 		lastFileDiffDirectory sortByWhat sortCaseless showingDetails
    22 		lastFileDiffDirectory sortByWhat sortCaseless showingDetails
    23 		showingTimeAndDate showingHiddenFiles showingBigImagePreview
    23 		showingTimeAndDate showingHiddenFiles showingBigImagePreview
    24 		imagePreviewView imageRenderProcess dosEOLMode doAutoUpdate
    24 		imagePreviewView imageRenderProcess dosEOLMode doAutoUpdate
    25 		doNotShowFontDialog lastEnforcedNameSpace'
    25 		doNotShowFontDialog lastEnforcedNameSpace'
    26 	classVariableNames:'DirectoryHistory DirectoryHistoryWhere DirectoryBookmarks
    26 	classVariableNames:'DirectoryHistory DirectoryHistoryWhere DirectoryBookmarks
    27 		HistorySize DefaultIcon CommandHistory CommandHistorySize Icons
    27 		HistorySize DefaultIcon CommandHistory CommandHistorySize Icons
    28 		DefaultCommandPerSuffix DefaultCommandPerMIME VisitedFileHistory
    28 		MatchedIcons DefaultCommandPerSuffix DefaultCommandPerMIME
    29 		LastEnforcedNameSpace'
    29 		VisitedFileHistory LastEnforcedNameSpace'
    30 	poolDictionaries:''
    30 	poolDictionaries:''
    31 	category:'Interface-Browsers'
    31 	category:'Interface-Browsers'
    32 !
    32 !
    33 
    33 
    34 !FileBrowser class methodsFor:'documentation'!
    34 !FileBrowser class methodsFor:'documentation'!
   152 ! !
   152 ! !
   153 
   153 
   154 !FileBrowser class methodsFor:'class initialization'!
   154 !FileBrowser class methodsFor:'class initialization'!
   155 
   155 
   156 icons
   156 icons
       
   157 self halt.
   157     Icons isNil ifTrue:[
   158     Icons isNil ifTrue:[
   158         self initializeIcons
   159         self initializeIcons
   159     ].
   160     ].
   160     ^ Icons
   161     ^ Icons
   161 !
   162 !
   179     resources := self classResources.
   180     resources := self classResources.
   180 
   181 
   181     #(
   182     #(
   182         "/ internal-type to icon mappings.
   183         "/ internal-type to icon mappings.
   183         (#directory             'ICON_DIRECTORY'            'tiny_yellow_dir.xpm'            )
   184         (#directory             'ICON_DIRECTORY'            'tiny_yellow_dir.xpm'            )
       
   185         (#directoryOpen         'ICON_DIRECTORY_OPEN'       'tiny_yellow_dir_open.xpm'       )
   184         (#directoryLocked       'ICON_DIRECTORY_LOCKED'     'tiny_yellow_dir_locked.xpm'     )
   186         (#directoryLocked       'ICON_DIRECTORY_LOCKED'     'tiny_yellow_dir_locked.xpm'     )
   185         (#directoryLink         'ICON_DIRECTORY_LINK'       'tiny_yellow_dir_link.xpm'       )
   187         (#directoryLink         'ICON_DIRECTORY_LINK'       'tiny_yellow_dir_link.xpm'       )
   186         (#file                  'ICON_FILE'                 'tiny_file_plain.xpm'            )
   188         (#file                  'ICON_FILE'                 'tiny_file_plain.xpm'            )
   187         (#fileLink              'ICON_FILE_LINK'            'tiny_file_link.xpm'             )
   189         (#fileLink              'ICON_FILE_LINK'            'tiny_file_link.xpm'             )
   188         (#fileLocked            'ICON_FILE_LOCKED'          'tiny_file_lock.xpm'             )
   190         (#fileLocked            'ICON_FILE_LOCKED'          'tiny_file_lock.xpm'             )
   194         (#compressedFile        'ICON_COMPRESSED_FILE'      'tiny_file_compressed.xpm'       )
   196         (#compressedFile        'ICON_COMPRESSED_FILE'      'tiny_file_compressed.xpm'       )
   195         (#compressedArchive     'ICON_COMPRESSED_ARCHIVE'   'tiny_file_tar_compressed.xpm'   )
   197         (#compressedArchive     'ICON_COMPRESSED_ARCHIVE'   'tiny_file_tar_compressed.xpm'   )
   196         (#archive               'ICON_ARCHIVE'              'tiny_file_tar.xpm'              )
   198         (#archive               'ICON_ARCHIVE'              'tiny_file_tar.xpm'              )
   197         (#specialFile           'ICON_SPECIALFILE'          'tiny_file_special.xpm'          )
   199         (#specialFile           'ICON_SPECIALFILE'          'tiny_file_special.xpm'          )
   198 
   200 
       
   201         (#addOnLocked           'ICON_ADDON_LOCKED'         'tiny_addOn_lock.xpm'            )
       
   202         (#addOnLinked           'ICON_ADDON_LINKED'         'tiny_addOn_link.xpm'            )
       
   203 
   199         (#directoryGray         'ICON_DIRECTORY_GRAY'       'tiny_yellow_dir_gray.xpm'       )
   204         (#directoryGray         'ICON_DIRECTORY_GRAY'       'tiny_yellow_dir_gray.xpm'       )
   200      ) do:[:entry |
   205      ) do:[:entry |
   201         |key resource defaultName nm img|
   206         |key resource defaultName nm img|
   202 
   207 
   203         key := entry at:1.
   208         key := entry at:1.
   217      self initializeFileTypeIcons
   222      self initializeFileTypeIcons
   218     "
   223     "
   219 !
   224 !
   220 
   225 
   221 initializeIcons
   226 initializeIcons
   222     |resources|
       
   223 
       
   224     resources := self classResources.
       
   225 
       
   226     Icons := Dictionary new.
   227     Icons := Dictionary new.
       
   228     MatchedIcons := OrderedCollection new.
   227     self initializeFileTypeIcons.
   229     self initializeFileTypeIcons.
   228     self initializeMimeTypeIcons.
   230     self initializeMimeTypeIcons.
   229 
   231 
   230     "
   232     "
   231      self initializeIcons
   233      self initializeIcons
   233 
   235 
   234     "Modified: / 1.8.1998 / 17:39:27 / cg"
   236     "Modified: / 1.8.1998 / 17:39:27 / cg"
   235 !
   237 !
   236 
   238 
   237 initializeMimeTypeIcons
   239 initializeMimeTypeIcons
   238 
       
   239     #(
   240     #(
   240         "/ mime-type to icon mappings.
   241         "/ mime-type to icon mappings.
   241         'image/jpeg'                                    'tiny_file_pix.xpm'
   242 "/        'image/jpeg'                                    'tiny_file_pix.xpm'
   242         'image/gif'                                     'tiny_file_pix.xpm'
   243 "/        'image/gif'                                     'tiny_file_pix.xpm'
   243         'image/tiff'                                    'tiny_file_pix.xpm'
   244 "/        'image/tiff'                                    'tiny_file_pix.xpm'
   244         'image/x-xbitmap'                               'tiny_file_pix.xpm'
   245 "/        'image/x-xbitmap'                               'tiny_file_pix.xpm'
   245         'image/x-xpixmap'                               'tiny_file_pix.xpm'
   246 "/        'image/x-xpixmap'                               'tiny_file_pix.xpm'
   246         'image/x-png'                                   'tiny_file_pix.xpm'
   247 "/        'image/x-png'                                   'tiny_file_pix.xpm'
   247         'image/x-photo-cd'                              'tiny_file_pix.xpm'
   248 "/        'image/x-photo-cd'                              'tiny_file_pix.xpm'
   248         'image/x-MS-bmp'                                'tiny_file_pix.xpm'
   249 "/        'image/x-MS-bmp'                                'tiny_file_pix.xpm'
   249         'image/x-rgb'                                   'tiny_file_pix.xpm'
   250 "/        'image/x-rgb'                                   'tiny_file_pix.xpm'
   250         'image/x-portable-pixmap'                       'tiny_file_pix.xpm'
   251 "/        'image/x-portable-pixmap'                       'tiny_file_pix.xpm'
   251         'image/x-portable-graymap'                      'tiny_file_pix.xpm'
   252 "/        'image/x-portable-graymap'                      'tiny_file_pix.xpm'
   252         'image/x-portable-bitmap'                       'tiny_file_pix.xpm'
   253 "/        'image/x-portable-bitmap'                       'tiny_file_pix.xpm'
   253         'image/x-portable-anymap'                       'tiny_file_pix.xpm'
   254 "/        'image/x-portable-anymap'                       'tiny_file_pix.xpm'
   254         'image/x-xwindowdump'                           'tiny_file_pix.xpm'
   255 "/        'image/x-xwindowdump'                           'tiny_file_pix.xpm'
   255         'image/x-cmu-raster'                            'tiny_file_pix.xpm'
   256 "/        'image/x-cmu-raster'                            'tiny_file_pix.xpm'
   256         'image/x-targa'                                 'tiny_file_pix.xpm'
   257 "/        'image/x-targa'                                 'tiny_file_pix.xpm'
       
   258         'image/*'                                       'tiny_file_pix.xpm'
   257 
   259 
   258         "/ misc text ...
   260         "/ misc text ...
   259 
   261 
   260         'text/html'                                     'tiny_file_text.xpm'
   262 "/        'text/html'                                     'tiny_file_text.xpm'
   261         'text/html'                                     'tiny_file_text.xpm'
   263 "/        'text/plain'                                    'tiny_file_text.xpm'
   262         'text/plain'                                    'tiny_file_text.xpm'
   264         'text/*'                                        'tiny_file_text.xpm'
   263 
   265 
   264         'application/postscript'                        'tiny_file_postscript.xpm'
   266         'application/postscript'                        'tiny_file_postscript.xpm'
   265         'application/pdf'                               'tiny_file_pdf.xpm'
   267         'application/pdf'                               'tiny_file_pdf.xpm'
   266         'application/rtf'                               'tiny_file_text.xpm'
   268         'application/rtf'                               'tiny_file_rtf.xpm'
   267 
   269 
   268         "/ video formats ...
   270         "/ video formats ...
   269 
   271 
   270         'video/x-sgi-movie'                             'tiny_file_movie.xpm'
   272 "/        'video/x-sgi-movie'                             'tiny_file_movie.xpm'
   271         'video/x-msvideo'                               'tiny_file_movie.xpm'
   273 "/        'video/x-msvideo'                               'tiny_file_movie.xpm'
   272         'video/quicktime'                               'tiny_file_movie.xpm'
   274 "/        'video/quicktime'                               'tiny_file_movie.xpm'
   273         'video/x-mpeg2'                                 'tiny_file_movie.xpm'
   275 "/        'video/x-mpeg2'                                 'tiny_file_movie.xpm'
   274         'video/mpeg'                                    'tiny_file_movie.xpm'
   276 "/        'video/mpeg'                                    'tiny_file_movie.xpm'
       
   277         'video/*'                                       'tiny_file_movie.xpm'
   275 
   278 
   276         "/ audio formats ...
   279         "/ audio formats ...
   277 
   280 
   278         'audio/x-pn-realaudio'                          'tiny_file_sound.xpm'
   281 "/        'audio/x-pn-realaudio'                          'tiny_file_sound.xpm'
   279         'audio/x-mpeg'                                  'tiny_file_sound.xpm'
   282 "/        'audio/x-mpeg'                                  'tiny_file_sound.xpm'
   280         'audio/x-mp3'                                   'tiny_file_sound.xpm'
   283 "/        'audio/x-mp3'                                   'tiny_file_sound.xpm'
   281         'audio/x-wav'                                   'tiny_file_sound.xpm'
   284 "/        'audio/x-wav'                                   'tiny_file_sound.xpm'
   282         'audio/x-aiff'                                  'tiny_file_sound.xpm'
   285 "/        'audio/x-aiff'                                  'tiny_file_sound.xpm'
   283         'audio/basic'                                   'tiny_file_sound.xpm'
   286 "/        'audio/basic'                                   'tiny_file_sound.xpm'
   284 
   287 "/        'audio/x-shockwave-flash'                       'tiny_file_sound.xpm'
   285         "/ more multimedia ...
   288         'audio/*'                                       'tiny_file_sound.xpm'
   286 
       
   287         'audio/x-shockwave-flash'                       'tiny_file_sound.xpm'
       
   288 
   289 
   289         "/ misc stuff
   290         "/ misc stuff
   290         'application/winword'                           'tiny_file_text.xpm'
   291         'application/winword'                           'tiny_file_text.xpm'
   291 
   292 
   292         "/ progr. languages
   293         "/ progr. languages
   294         'application/x-smalltalk-source-sif'            'tiny_file_text.xpm'
   295         'application/x-smalltalk-source-sif'            'tiny_file_text.xpm'
   295         'application/x-c-source'                        'tiny_file_text.xpm'
   296         'application/x-c-source'                        'tiny_file_text.xpm'
   296         'application/x-cpp-source'                      'tiny_file_text.xpm'
   297         'application/x-cpp-source'                      'tiny_file_text.xpm'
   297         'application/x-javascript'                      'tiny_file_text.xpm'
   298         'application/x-javascript'                      'tiny_file_text.xpm'
   298         'application/x-java-source'                     'tiny_file_java.xpm'
   299         'application/x-java-source'                     'tiny_file_java.xpm'
       
   300 
   299         'application/x-sh'                              'tiny_file_text.xpm'
   301         'application/x-sh'                              'tiny_file_text.xpm'
   300         'application/x-csh'                             'tiny_file_text.xpm'
   302         'application/x-csh'                             'tiny_file_text.xpm'
   301         'application/x-tcl'                             'tiny_file_text.xpm'
   303         'application/x-tcl'                             'tiny_file_text.xpm'
   302         'application/x-perl'                            'tiny_file_text.xpm'
   304         'application/x-perl'                            'tiny_file_text.xpm'
   303         'application/x-make'                            'tiny_file_text.xpm'
   305         'application/x-make'                            'tiny_file_text.xpm'
   311         'application/x-zip-compressed'                'tiny_file_compressed_archive.xpm'
   313         'application/x-zip-compressed'                'tiny_file_compressed_archive.xpm'
   312         'application/x-gzip-compressed'               'tiny_file_compressed_archive.xpm'
   314         'application/x-gzip-compressed'               'tiny_file_compressed_archive.xpm'
   313         'application/x-cpio'                          'tiny_file_archive.xpm'
   315         'application/x-cpio'                          'tiny_file_archive.xpm'
   314         'application/x-shar'                          'tiny_file_archive.xpm'
   316         'application/x-shar'                          'tiny_file_archive.xpm'
   315         'application/java-archive'                    'tiny_file_archive.xpm'
   317         'application/java-archive'                    'tiny_file_archive.xpm'
   316      ) pairWiseDo:[:mimeType :fileName |
   318 
       
   319         '*'                                           'tiny_file_plain.xpm'
       
   320      ) pairWiseDo:[:mimeTypePattern :fileName |
   317         | nm |
   321         | nm |
   318 
   322 
   319         nm := 'xpmBitmaps/document_images/' , fileName.
   323         nm := 'xpmBitmaps/document_images/' , fileName.
   320         Icons at:mimeType put:(Smalltalk imageFromFileNamed:nm forClass:self).
   324         mimeTypePattern includesMatchCharacters ifTrue:[
       
   325             MatchedIcons add:(mimeTypePattern-> (Smalltalk imageFromFileNamed:nm forClass:self)).
       
   326         ] ifFalse:[    
       
   327             Icons at:mimeTypePattern put:(Smalltalk imageFromFileNamed:nm forClass:self).
       
   328         ]
   321     ]
   329     ]
   322 
   330 
   323     "
   331     "
   324      self initializeMimeTypeIcons
   332      self initializeMimeTypeIcons
   325     "
   333     "
  1529                         yourself).
  1537                         yourself).
  1530     ].
  1538     ].
  1531     ^ m
  1539     ^ m
  1532 ! !
  1540 ! !
  1533 
  1541 
       
  1542 !FileBrowser class methodsFor:'private - presentation'!
       
  1543 
       
  1544 fileTypeFor:aFilename
       
  1545     |key|
       
  1546 
       
  1547     aFilename isDirectory ifTrue:[
       
  1548         key := #directory.
       
  1549     ] ifFalse:[
       
  1550         key := #file.
       
  1551         aFilename isExecutableProgram ifTrue:[
       
  1552             key := #executableFile
       
  1553         ].
       
  1554     ].
       
  1555 "/    aFilename isDirectory ifTrue:[
       
  1556 "/        aFilename isSymbolicLink ifTrue:[
       
  1557 "/            key := #directoryLink
       
  1558 "/        ] ifFalse:[
       
  1559 "/            key := #directory.
       
  1560 "/            (aFilename isReadable not or:[aFilename isExecutable not]) ifTrue:[
       
  1561 "/                key := #directoryLocked
       
  1562 "/            ].
       
  1563 "/        ]
       
  1564 "/    ] ifFalse:[
       
  1565 "/        aFilename isSymbolicLink ifTrue:[
       
  1566 "/            aFilename isReadable not ifTrue:[
       
  1567 "/                key := #fileLocked
       
  1568 "/            ] ifFalse:[
       
  1569 "/                key := #fileLink
       
  1570 "/            ]
       
  1571 "/        ] ifFalse:[
       
  1572 "/            key := #file.
       
  1573 "/            aFilename isExecutableProgram ifTrue:[
       
  1574 "/                key := #executableFile
       
  1575 "/            ].
       
  1576 "/            (aFilename isReadable not) ifTrue:[
       
  1577 "/                key := #fileLocked
       
  1578 "/            ].
       
  1579 "/        ].
       
  1580 "/    ].
       
  1581 
       
  1582     ^ key
       
  1583 !
       
  1584 
       
  1585 getAddOnIconsFor:aFilename
       
  1586     "given a fileName, return an appropriate icon"
       
  1587 
       
  1588     | addIcns isDirectory isReadable|
       
  1589 
       
  1590     addIcns := OrderedCollection new.
       
  1591     aFilename isSymbolicLink ifTrue:[
       
  1592         addIcns add:(self iconForKeyMatching:#addOnLinked).
       
  1593     ].
       
  1594     isDirectory := aFilename isDirectory.
       
  1595     isReadable := aFilename isReadable.
       
  1596     ((isReadable not and:[isDirectory not]) or:[(isDirectory) and:[(isReadable not) or:[aFilename isExecutable not]]]) ifTrue:[
       
  1597         addIcns add:(self iconForKeyMatching:#addOnLocked).
       
  1598     ].
       
  1599     ^ addIcns
       
  1600 !
       
  1601 
       
  1602 iconForFile:aFilename
       
  1603     "given a fileName, return an appropriate icon"
       
  1604 
       
  1605     |icn addIcns|
       
  1606 
       
  1607     icn := self iconForKeyMatching:(self iconKeyForFile:aFilename).
       
  1608     addIcns := self getAddOnIconsFor:aFilename.
       
  1609     addIcns notEmpty ifTrue:[
       
  1610         addIcns addFirst:icn.
       
  1611         ^ MultiImage images:addIcns.
       
  1612     ].
       
  1613     ^ icn
       
  1614 !
       
  1615 
       
  1616 iconForKeyMatching:mimeTypeOrKey
       
  1617     |assoc icn|
       
  1618 
       
  1619     icn := Icons at:mimeTypeOrKey ifAbsent:nil.
       
  1620     icn notNil ifTrue:[^ icn].
       
  1621     assoc := MatchedIcons detect:[:assoc | assoc key match:mimeTypeOrKey] ifNone:nil.
       
  1622     assoc notNil ifTrue:[^ assoc value].
       
  1623     ^ nil.
       
  1624 !
       
  1625 
       
  1626 iconKeyForFile:aFilenameArg
       
  1627     "given a fileName, return an appropriate icon"
       
  1628 
       
  1629     |aFilename fileType mimeType suffix|
       
  1630 
       
  1631     aFilename := aFilenameArg.
       
  1632 
       
  1633     fileType := self fileTypeFor:aFilename.
       
  1634 
       
  1635     aFilename isDirectory ifFalse:[
       
  1636         "/ aFilename isReadable ifTrue:[
       
  1637             suffix := aFilename suffix.
       
  1638             (suffix = 'bak' or:[suffix = 'sav']) ifTrue:[
       
  1639                 aFilename := aFilename withoutSuffix.
       
  1640             ].
       
  1641             mimeType := MIMETypes mimeTypeForFilename:aFilename.
       
  1642         "/ ].
       
  1643     ].
       
  1644 
       
  1645     ^ (mimeType ? fileType).
       
  1646 ! !
       
  1647 
  1534 !FileBrowser class methodsFor:'queries'!
  1648 !FileBrowser class methodsFor:'queries'!
  1535 
  1649 
  1536 isVisualStartable
  1650 isVisualStartable
  1537     "return true, if this application can be started via #open.
  1651     "return true, if this application can be started via #open.
  1538      (to allow start of a change browser via double-click in the browser)"
  1652      (to allow start of a change browser via double-click in the browser)"
  4100         HistorySize := 15
  4214         HistorySize := 15
  4101     ].
  4215     ].
  4102     commandIndex := 0.
  4216     commandIndex := 0.
  4103 
  4217 
  4104     icons := Dictionary new.
  4218     icons := Dictionary new.
       
  4219     matchedIcons := OrderedCollection new.
  4105 
  4220 
  4106     Icons isNil ifTrue:[
  4221     Icons isNil ifTrue:[
  4107         self class initializeIcons
  4222         self class initializeIcons
  4108     ].
  4223     ].
  4109 
  4224 
  7366 
  7481 
  7367     "Created: / 17.4.1997 / 02:51:41 / cg"
  7482     "Created: / 17.4.1997 / 02:51:41 / cg"
  7368     "Modified: / 27.7.1998 / 20:23:34 / cg"
  7483     "Modified: / 27.7.1998 / 20:23:34 / cg"
  7369 !
  7484 !
  7370 
  7485 
  7371 iconForFile:aFilenameString
  7486 iconForFile:aFilename
  7372     "given a fileName, return an appropriate icon"
  7487     "given a fileName, return an appropriate icon"
  7373 
  7488 
  7374     |f icn key key2 suff mimeType|
  7489     |icn addIcns|
  7375 
  7490 
  7376     f := currentDirectory construct:aFilenameString.
  7491     icn := self iconForKeyMatching:(self class iconKeyForFile:aFilename).
  7377     f isDirectory ifTrue:[
  7492     addIcns := self class getAddOnIconsFor:aFilename.
  7378         f isSymbolicLink ifTrue:[
  7493     addIcns notEmpty ifTrue:[
  7379             key := #directoryLink
  7494         addIcns addFirst:icn.
  7380         ] ifFalse:[
  7495         ^ MultiImage images:addIcns.
  7381             key := #directory.
  7496     ].
  7382             (f isReadable not or:[f isExecutable not]) ifTrue:[
  7497     ^ icn
  7383                 key := #directoryLocked
  7498 !
  7384             ].
  7499 
  7385         ]
  7500 iconForKeyMatching:mimeTypeOrKey
  7386     ] ifFalse:[
  7501     |assoc icn|
  7387         f isSymbolicLink ifTrue:[
  7502 
  7388             f isReadable not ifTrue:[
  7503     icn := icons at:mimeTypeOrKey ifAbsent:nil.
  7389                 key := #fileLocked
  7504     icn notNil ifTrue:[^ icn].
  7390             ] ifFalse:[
  7505     assoc := matchedIcons detect:[:assoc | assoc key match:mimeTypeOrKey] ifNone:nil.
  7391                 key := #fileLink
  7506     assoc notNil ifTrue:[^ assoc value].
  7392             ]
       
  7393         ] ifFalse:[
       
  7394             key := key2 := #file.
       
  7395             f isExecutableProgram ifTrue:[
       
  7396                 key := key2 := #executableFile
       
  7397             ].
       
  7398             (f isReadable not) ifTrue:[
       
  7399                 key := #fileLocked
       
  7400             ] ifFalse:[
       
  7401                 suff := f suffix.
       
  7402                 (suff = 'bak' or:[suff = 'sav']) ifTrue:[
       
  7403                     suff := f withoutSuffix suffix.
       
  7404                 ].
       
  7405                 suff size > 0 ifTrue:[
       
  7406                     mimeType := MIMETypes mimeTypeForSuffix:suff.
       
  7407                     mimeType notNil ifTrue:[
       
  7408                         (mimeType startsWith:'image/') ifTrue:[
       
  7409                             key := #imageFile
       
  7410                         ] ifFalse:[
       
  7411                             (mimeType startsWith:'text/') ifTrue:[
       
  7412                                 key := #textFile
       
  7413                             ]
       
  7414                         ]
       
  7415                     ].
       
  7416                 ].
       
  7417             ].
       
  7418         ].
       
  7419     ].
       
  7420 
       
  7421     "/ local (device) icons
       
  7422     icons notNil ifTrue:[
       
  7423         mimeType notNil ifTrue:[
       
  7424             icn := icons at:mimeType ifAbsent:nil.
       
  7425         ] ifFalse:[
       
  7426             icn := icons at:key ifAbsent:nil.
       
  7427         ].
       
  7428         icn notNil ifTrue:[^ icn].
       
  7429     ].
       
  7430 
  7507 
  7431     "/ global icons
  7508     "/ global icons
  7432 
  7509 
  7433     Icons notNil ifTrue:[
  7510     Icons notNil ifTrue:[
  7434         mimeType notNil ifTrue:[
  7511         icn := Icons at:mimeTypeOrKey ifAbsent:nil.
  7435             icn := Icons at:mimeType ifAbsent:nil.
       
  7436             "/ sight - check for parent-MIME types ...
       
  7437 
       
  7438             [icn isNil and:[mimeType includes:$/]] whileTrue:[
       
  7439                 mimeType := mimeType copyTo:(mimeType lastIndexOf:$/) - 1.
       
  7440                 icn := Icons at:mimeType ifAbsent:nil.
       
  7441             ].
       
  7442         ].
       
  7443         icn notNil ifTrue:[
  7512         icn notNil ifTrue:[
  7444             key := mimeType
  7513             icn := icn copy onDevice:device.
  7445         ] ifFalse:[
  7514             icn clearMaskedPixels.
  7446             icn := Icons at:key ifAbsent:nil.
  7515             icons at:mimeTypeOrKey put:icn.
  7447         ].
       
  7448     ].
       
  7449 
       
  7450     icn isNil ifTrue:[
       
  7451         (    (key := key2) isNil
       
  7452          or:[(icn := icons at:key ifAbsent:nil) notNil
       
  7453          or:[(icn := Icons at:key ifAbsent:nil) isNil]]
       
  7454         ) ifTrue:[
       
  7455             ^ icn
  7516             ^ icn
  7456         ]
  7517         ].
  7457     ].
  7518 
  7458 
  7519         assoc := MatchedIcons detect:[:assoc | assoc key match:mimeTypeOrKey] ifNone:nil.
  7459     "/ remember device icon
  7520         assoc notNil ifTrue:[
  7460     icn := icn copy onDevice:device.
  7521             icn := assoc value copy onDevice:device.
  7461     icn clearMaskedPixels.
  7522             icn clearMaskedPixels.
  7462     icons at:key put:icn.
  7523             matchedIcons add:(assoc key -> icn).
  7463     ^ icn
  7524             ^ icn
  7464 
  7525         ].
  7465     "Modified: / 18.9.1997 / 16:35:28 / stefan"
  7526     ].
  7466     "Modified: / 23.12.1999 / 22:28:00 / cg"
  7527 
       
  7528     ^ nil
  7467 !
  7529 !
  7468 
  7530 
  7469 stopImageRenderProcess
  7531 stopImageRenderProcess
  7470     imageRenderProcess notNil ifTrue:[
  7532     imageRenderProcess notNil ifTrue:[
  7471         imageRenderProcess terminate.
  7533         imageRenderProcess terminate.
  7779                                 (len > 20) ifTrue:[
  7841                                 (len > 20) ifTrue:[
  7780                                     fileNameString := (fileNameString contractTo:20)
  7842                                     fileNameString := (fileNameString contractTo:20)
  7781                                 ].
  7843                                 ].
  7782                             ].
  7844                             ].
  7783 
  7845 
  7784                             entry colAt:1 put:(self iconForFile:aFileName).
  7846                             entry colAt:1 put:(self iconForFile:(currentDirectory construct:aFileName)).
  7785                             entry colAt:2 put:fileNameString.
  7847                             entry colAt:2 put:fileNameString.
  7786 
  7848 
  7787                             "/fileListView at:lineIndex put:entry.
  7849                             "/fileListView at:lineIndex put:entry.
  7788                             fileListView withoutRedrawAt:lineIndex put:entry.
  7850                             fileListView withoutRedrawAt:lineIndex put:entry.
  7789                             fileListView invalidateLine:lineIndex.
  7851                             fileListView invalidateLine:lineIndex.
  8019 ! !
  8081 ! !
  8020 
  8082 
  8021 !FileBrowser class methodsFor:'documentation'!
  8083 !FileBrowser class methodsFor:'documentation'!
  8022 
  8084 
  8023 version
  8085 version
  8024     ^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.490 2002-09-10 14:02:13 penk Exp $'
  8086     ^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.491 2002-09-11 12:55:33 penk Exp $'
  8025 ! !
  8087 ! !