DirectoryView.st
changeset 1385 cbe7e7763105
parent 1346 0793db434b21
child 1627 e14aa2449e97
equal deleted inserted replaced
1384:ff417bf5f8d8 1385:cbe7e7763105
     9  other person. No title to or ownership of the software is
     9  other person. No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 
    12 
    13 
    13 
       
    14 "{ Package: 'stx:libtool2' }"
       
    15 
    14 ApplicationModel subclass:#DirectoryView
    16 ApplicationModel subclass:#DirectoryView
    15 	instanceVariableNames:'directory selectedFileFilter readTask monitoring
    17 	instanceVariableNames:'directory selectedFileFilter readTask monitoring
    16 		monitoringTimeBlock fileDoubleClickAction fileSelectAction
    18 		monitoringTimeBlock fileDoubleClickAction fileSelectAction
    17 		fileFilterSelectAction fileAttributes'
    19 		fileFilterSelectAction fileAttributes'
    18 	classVariableNames:''
    20 	classVariableNames:''
    21 !
    23 !
    22 
    24 
    23 Object subclass:#FileRow
    25 Object subclass:#FileRow
    24 	instanceVariableNames:'fileName size modified iconKey imageFromFile group owner
    26 	instanceVariableNames:'fileName size modified iconKey imageFromFile group owner
    25 		permissions baseName'
    27 		permissions baseName'
    26 	classVariableNames:''
    28 	classVariableNames:'MaxImageFileSize'
    27 	poolDictionaries:''
    29 	poolDictionaries:''
    28 	privateIn:DirectoryView
    30 	privateIn:DirectoryView
    29 !
    31 !
    30 
    32 
    31 !DirectoryView class methodsFor:'documentation'!
    33 !DirectoryView class methodsFor:'documentation'!
   847 
   849 
   848     ^permissions
   850     ^permissions
   849 !
   851 !
   850 
   852 
   851 retrieveImageFromFileAndRegisterOn: aGC
   853 retrieveImageFromFileAndRegisterOn: aGC
   852 
   854     "retrieve a bitmap image - but only if it is smaller than some limit (currently 20k)"
   853     |image|
   855 
       
   856     |image maxImageFileSize|
       
   857 
       
   858     maxImageFileSize := MaxImageFileSize ? 20000.
       
   859 
   854     imageFromFile := false.       
   860     imageFromFile := false.       
   855     (image := aGC registeredImageAt: fileName name asSymbol) isNil
   861     (image := aGC registeredImageAt: fileName name asSymbol) isNil
   856     ifTrue:
   862     ifTrue:[            
   857     [            
   863         size < maxImageFileSize ifTrue:[     
   858         size < 5000
       
   859         ifTrue:
       
   860         [     
       
   861             Object errorSignal handle: [:ex|]
   864             Object errorSignal handle: [:ex|]
   862             do:
   865             do:[   
   863             [   
   866                 (image := Image fromFile: fileName name) notNil ifTrue:[
   864                 (image := Image fromFile: fileName name) notNil
   867                     image extent y > 22 ifTrue:[         
   865                 ifTrue:
       
   866                 [
       
   867                     image extent y > 22
       
   868                     ifTrue:
       
   869                     [         
       
   870                         image := image magnifiedBy: 22/image extent y
   868                         image := image magnifiedBy: 22/image extent y
   871                     ].
   869                     ].
   872                     image := aGC registerImage: image key: fileName name asSymbol.
   870                     image := aGC registerImage: image key: fileName name asSymbol.
   873                 ]
   871                 ]
   874             ] 
   872             ]