DirectoryView.st
author Claus Gittinger <cg@exept.de>
Sat, 21 Jul 2012 18:58:03 +0200
changeset 2898 c7f6c498df6a
parent 2878 241be37ce37b
child 2938 8e9207531826
permissions -rw-r--r--
category of:15 methods
tz@424
     1
"
tz@502
     2
 COPYRIGHT (c) 1997 by eXept Software AG
tz@424
     3
              All Rights Reserved
tz@424
     4
tz@424
     5
 This software is furnished under a license and may be used
tz@424
     6
 only in accordance with the terms of that license and with the
tz@424
     7
 inclusion of the above copyright notice. This software may not
tz@424
     8
 be provided or otherwise made available to, or used by, any
tz@424
     9
 other person. No title to or ownership of the software is
tz@424
    10
 hereby transferred.
tz@424
    11
"
cg@1385
    12
"{ Package: 'stx:libtool2' }"
cg@1385
    13
tz@424
    14
ApplicationModel subclass:#DirectoryView
tz@424
    15
	instanceVariableNames:'directory selectedFileFilter readTask monitoring
tz@424
    16
		monitoringTimeBlock fileDoubleClickAction fileSelectAction
tz@424
    17
		fileFilterSelectAction fileAttributes'
tz@424
    18
	classVariableNames:''
tz@424
    19
	poolDictionaries:''
cg@2101
    20
	category:'Interface-Dialogs'
tz@424
    21
!
tz@424
    22
tz@424
    23
Object subclass:#FileRow
tz@638
    24
	instanceVariableNames:'fileName size modified iconKey imageFromFile group owner
tz@638
    25
		permissions baseName'
cg@1385
    26
	classVariableNames:'MaxImageFileSize'
tz@424
    27
	poolDictionaries:''
tz@424
    28
	privateIn:DirectoryView
tz@424
    29
!
tz@424
    30
tz@424
    31
!DirectoryView class methodsFor:'documentation'!
tz@424
    32
tz@424
    33
copyright
tz@424
    34
"
tz@502
    35
 COPYRIGHT (c) 1997 by eXept Software AG
tz@424
    36
              All Rights Reserved
tz@424
    37
tz@424
    38
 This software is furnished under a license and may be used
tz@424
    39
 only in accordance with the terms of that license and with the
tz@424
    40
 inclusion of the above copyright notice. This software may not
tz@424
    41
 be provided or otherwise made available to, or used by, any
tz@424
    42
 other person. No title to or ownership of the software is
tz@424
    43
 hereby transferred.
tz@424
    44
"
tz@424
    45
tz@424
    46
!
tz@424
    47
tz@424
    48
documentation
tz@424
    49
"
cg@2351
    50
    this is somewhat outdated. However, it is still used by the image editor and
cg@2351
    51
    some other resource editors.
cg@2351
    52
    It has the advantage of showing the file-contents...
cg@2351
    53
    ...but the disabdvantage of having an ugly layout and user interface.
tz@502
    54
tz@502
    55
    [author:]
tz@502
    56
        Thomas Zwick
tz@424
    57
"
tz@424
    58
! !
tz@424
    59
tz@424
    60
!DirectoryView class methodsFor:'instance creation'!
tz@424
    61
sv@516
    62
openOnDirectory: aDirectoryString
sv@516
    63
    "open a DirectoryView for a aDirectoryString"
tz@424
    64
sv@516
    65
    ^ (self new directory: aDirectoryString) open
tz@424
    66
sv@516
    67
    "
sv@516
    68
     self openOnDirectory: '/etc'
sv@516
    69
    "
tz@424
    70
sv@516
    71
    "Modified: / 28.1.1998 / 15:44:53 / stefan"
tz@424
    72
! !
tz@424
    73
tz@424
    74
!DirectoryView class methodsFor:'interface specs'!
tz@424
    75
tz@424
    76
windowSpec
tz@820
    77
    "This resource specification was automatically generated
tz@820
    78
     by the UIPainter of ST/X."
tz@424
    79
tz@820
    80
    "Do not manually edit this!! If it is corrupted,
tz@820
    81
     the UIPainter may not be able to read the specification."
tz@424
    82
tz@424
    83
    "
tz@424
    84
     UIPainter new openOnClass:DirectoryView andSelector:#windowSpec
tz@424
    85
     DirectoryView new openInterface:#windowSpec
tz@820
    86
     DirectoryView open
tz@424
    87
    "
tz@424
    88
tz@424
    89
    <resource: #canvas>
tz@424
    90
cg@1346
    91
    ^ 
cg@1346
    92
     #(#FullSpec
cg@1346
    93
        #name: #windowSpec
cg@1346
    94
        #window: 
cg@1346
    95
       #(#WindowSpec
cg@1346
    96
          #label: 'Directory View'
cg@1346
    97
          #name: 'Directory View'
cg@1346
    98
          #min: #(#Point 10 10)
cg@1346
    99
          #max: #(#Point 1152 900)
cg@1346
   100
          #bounds: #(#Rectangle 13 23 413 323)
cg@1346
   101
        )
cg@1346
   102
        #component: 
cg@1346
   103
       #(#SpecCollection
cg@1346
   104
          #collection: #(
cg@1346
   105
           #(#DataSetSpec
cg@1346
   106
              #name: 'filesDataSetView'
cg@1346
   107
              #layout: #(#LayoutFrame 0 0.0 24 0.0 -2 1.0 0 1.0)
cg@1346
   108
              #model: #selectionOfFile
cg@1346
   109
              #menu: #fileListMenu
cg@1346
   110
              #hasHorizontalScrollBar: true
cg@1346
   111
              #hasVerticalScrollBar: true
cg@1346
   112
              #miniScrollerHorizontal: true
cg@1346
   113
              #dataList: #listOfFiles
cg@1346
   114
              #useIndex: false
cg@1346
   115
              #has3Dsepartors: false
cg@1346
   116
              #doubleClickSelector: #fileDoubleClicked
cg@1346
   117
              #columnHolder: #fileAttributeColumns
cg@1346
   118
              #valueChangeSelector: #fileSelected
cg@1346
   119
              #verticalSpacing: 1
cg@1346
   120
            )
cg@1346
   121
           #(#ComboBoxSpec
cg@1346
   122
              #name: 'formatComboBox'
cg@1346
   123
              #layout: #(#LayoutFrame 63 0.0 0 0 0 1.0 22 0)
cg@1346
   124
              #model: #selectionOfFileFilter
cg@1346
   125
              #immediateAccept: false
cg@1346
   126
              #acceptOnTab: false
cg@1346
   127
              #acceptOnPointerLeave: false
cg@1346
   128
              #comboList: #listOfFileFilters
cg@1346
   129
            )
cg@1346
   130
           #(#LabelSpec
cg@1346
   131
              #label: 'Filter: '
cg@1346
   132
              #name: 'filterLabel'
cg@1346
   133
              #layout: #(#LayoutFrame 0 0 0 0 62 0 22 0)
cg@1346
   134
              #adjust: #right
cg@1346
   135
            )
cg@1346
   136
           )
cg@1346
   137
         
cg@1346
   138
        )
tz@424
   139
      )
cg@1346
   140
cg@1346
   141
    "Modified: / 11.2.2000 / 00:11:43 / cg"
tz@424
   142
! !
tz@424
   143
tz@823
   144
!DirectoryView class methodsFor:'list specs'!
tz@823
   145
tz@823
   146
tableColumnsForFileAttributes
tz@823
   147
    "This resource specification was automatically generated
tz@823
   148
     by the DataSetBuilder of ST/X."
tz@823
   149
tz@823
   150
    "Do not manually edit this!! If it is corrupted,
tz@823
   151
     the DataSetBuilder may not be able to read the specification."
tz@823
   152
tz@823
   153
    "
tz@823
   154
     DataSetBuilder new openOnClass:DirectoryView andSelector:#tableColumnsForFileAttributes
tz@823
   155
    "
tz@823
   156
tz@823
   157
    <resource: #tableColumns>
tz@823
   158
tz@823
   159
tz@823
   160
    ^ #(
tz@823
   161
        #(#DataSetColumnSpec
tz@823
   162
           #label: ''
tz@823
   163
           #width: 30
tz@823
   164
           #height: 22
tz@823
   165
           #printSelector: #iconOn:
tz@823
   166
           #canSelect: false
tz@823
   167
       )
tz@823
   168
        #(#DataSetColumnSpec
tz@823
   169
           #label: 'File name'
tz@823
   170
           #labelAlignment: #left
tz@823
   171
           #minWidth: 150
tz@823
   172
           #model: #baseName
tz@823
   173
           #canSelect: false
tz@823
   174
       )
tz@823
   175
        #(#DataSetColumnSpec
tz@823
   176
           #label: 'Size'
tz@823
   177
           #labelAlignment: #left
tz@823
   178
           #width: 70
tz@823
   179
           #model: #size
tz@823
   180
           #canSelect: false
tz@823
   181
       )
tz@823
   182
        #(#DataSetColumnSpec
tz@823
   183
           #label: 'Modified'
tz@823
   184
           #labelAlignment: #left
tz@823
   185
           #model: #modified
tz@823
   186
           #canSelect: false
tz@823
   187
       )
tz@823
   188
        #(#DataSetColumnSpec
tz@823
   189
           #label: 'Permissions'
tz@823
   190
           #labelAlignment: #left
tz@823
   191
           #width: 85
tz@823
   192
           #model: #permissions
tz@823
   193
           #canSelect: false
tz@823
   194
       )
tz@823
   195
        #(#DataSetColumnSpec
tz@823
   196
           #label: 'Owner'
tz@823
   197
           #labelAlignment: #left
tz@823
   198
           #width: 50
tz@823
   199
           #model: #owner
tz@823
   200
           #canSelect: false
tz@823
   201
       )
tz@823
   202
        #(#DataSetColumnSpec
tz@823
   203
           #label: 'Group'
tz@823
   204
           #labelAlignment: #left
tz@823
   205
           #width: 50
tz@823
   206
           #model: #group
tz@823
   207
           #canSelect: false
tz@823
   208
       )
tz@823
   209
     )
tz@823
   210
! !
tz@823
   211
cg@1346
   212
!DirectoryView class methodsFor:'menu specs'!
cg@1346
   213
cg@1346
   214
fileListMenu
cg@1346
   215
    "This resource specification was automatically generated
cg@1346
   216
     by the MenuEditor of ST/X."
cg@1346
   217
cg@1346
   218
    "Do not manually edit this!! If it is corrupted,
cg@1346
   219
     the MenuEditor may not be able to read the specification."
cg@1346
   220
cg@1346
   221
    "
cg@1346
   222
     MenuEditor new openOnClass:DirectoryView andSelector:#fileListMenu
cg@1346
   223
     (Menu new fromLiteralArrayEncoding:(DirectoryView fileListMenu)) startUp
cg@1346
   224
    "
cg@1346
   225
cg@1346
   226
    <resource: #menu>
cg@1346
   227
cg@1346
   228
    ^ 
cg@1346
   229
     #(#Menu
cg@1346
   230
        #(
cg@1346
   231
         #(#MenuItem
cg@1346
   232
            #label: 'Update'
cg@1346
   233
            #translateLabel: true
cg@1346
   234
            #value: #updateFileList
cg@1346
   235
          )
cg@1346
   236
         )
cg@1346
   237
        nil
cg@1346
   238
        nil
cg@1346
   239
      )
cg@1346
   240
cg@1346
   241
    "Created: / 11.2.2000 / 00:11:39 / cg"
cg@1346
   242
! !
cg@1346
   243
tz@424
   244
!DirectoryView methodsFor:'accessing'!
tz@424
   245
tz@424
   246
directory: aDirectory
tz@424
   247
tz@424
   248
    directory := aDirectory asFilename asAbsoluteFilename name
tz@424
   249
!
tz@424
   250
tz@424
   251
fileAttributes: anArray
tz@424
   252
tz@424
   253
    fileAttributes := anArray
tz@424
   254
!
tz@424
   255
tz@424
   256
fileDoubleClickAction: anActionBlock
tz@424
   257
tz@424
   258
    fileDoubleClickAction := anActionBlock
tz@424
   259
!
tz@424
   260
tz@424
   261
fileFilterSelectAction: anActionBlock
tz@424
   262
tz@424
   263
    fileFilterSelectAction := anActionBlock
tz@424
   264
!
tz@424
   265
tz@424
   266
fileSelectAction: anActionBlock
tz@424
   267
tz@424
   268
    fileSelectAction := anActionBlock
tz@424
   269
!
tz@424
   270
tz@424
   271
listOfFileFilters: aCollection
tz@424
   272
tz@424
   273
    self listOfFileFilters contents: aCollection.
tz@424
   274
    self selectionOfFileFilter value: (self listOfFileFilters at: 1 ifAbsent: [nil]).
tz@424
   275
!
tz@424
   276
tz@424
   277
monitoring: aBoolean
tz@424
   278
tz@424
   279
    aBoolean
tz@424
   280
    ifTrue:
tz@424
   281
    [
tz@424
   282
        monitoringTimeBlock := [self readDirectory].
tz@424
   283
        self readDirectory.
tz@424
   284
    ]
tz@424
   285
    ifFalse:
tz@424
   286
    [
tz@424
   287
        monitoring ifTrue:
tz@424
   288
        [
tz@424
   289
            Processor removeTimedBlock:monitoringTimeBlock.
tz@424
   290
            monitoringTimeBlock := nil
tz@424
   291
        ]
tz@424
   292
    ].
tz@424
   293
tz@424
   294
    monitoring := aBoolean.
tz@424
   295
tz@424
   296
! !
tz@424
   297
tz@424
   298
!DirectoryView methodsFor:'aspects'!
tz@424
   299
tz@424
   300
fileAttributeColumns
tz@424
   301
tz@424
   302
    |holder|
tz@424
   303
    (holder := builder bindingAt:#fileAttributeColumns) isNil ifTrue:[
tz@424
   304
        |fileAttributeColumns|
tz@424
   305
        builder aspectAt:#fileAttributeColumns put:(holder := List new).
tz@820
   306
        fileAttributeColumns := self class tableColumnsForFileAttributes collect: [:i| i decodeAsLiteralArray].
tz@424
   307
        holder add: fileAttributeColumns first.
tz@424
   308
        fileAttributeColumns do:
tz@424
   309
        [:col|
tz@424
   310
            (fileAttributes includes: col label) ifTrue: [holder add: col]
tz@424
   311
        ].
tz@591
   312
        holder do: [:col| col label: ' ', col label]
tz@424
   313
    ].
tz@424
   314
    ^ holder
tz@424
   315
!
tz@424
   316
tz@424
   317
listOfFileFilters
tz@424
   318
tz@424
   319
    |holder|          
tz@424
   320
    (holder := builder bindingAt:#listOfFileFilters) isNil ifTrue:[
tz@424
   321
        builder aspectAt:#listOfFileFilters put:(holder :=  List with: '*').
tz@424
   322
    ].
tz@424
   323
    ^ holder
tz@424
   324
!
tz@424
   325
tz@424
   326
listOfFiles
tz@424
   327
tz@424
   328
    |holder|
tz@424
   329
    (holder := builder bindingAt:#listOfFiles) isNil ifTrue:[
tz@424
   330
        builder aspectAt:#listOfFiles put:(holder :=  List new).
tz@424
   331
    ].
tz@424
   332
    ^ holder
tz@424
   333
!
tz@424
   334
tz@424
   335
selectionOfFile
tz@424
   336
tz@424
   337
    |holder|
tz@424
   338
    (holder := builder bindingAt:#selectionOfFile) isNil ifTrue:[
tz@424
   339
        builder aspectAt:#selectionOfFile put:(holder :=  ValueHolder new).
tz@424
   340
    ].
tz@424
   341
    ^ holder
tz@424
   342
tz@424
   343
!
tz@424
   344
tz@424
   345
selectionOfFileFilter
tz@424
   346
tz@424
   347
    |holder|
tz@424
   348
    (holder := builder bindingAt:#selectionOfFileFilter) isNil ifTrue:[
tz@424
   349
        builder aspectAt:#selectionOfFileFilter put:
tz@424
   350
        (holder := AspectAdaptor new subject:self; forAspect:#selectedFileFilter).
tz@424
   351
        selectedFileFilter := '*'.
tz@424
   352
    ].
tz@424
   353
    ^ holder
tz@424
   354
! !
tz@424
   355
tz@424
   356
!DirectoryView methodsFor:'callbacks'!
tz@424
   357
tz@424
   358
fileDoubleClicked
tz@424
   359
      
tz@473
   360
    (fileDoubleClickAction notNil and: [self selectionOfFile value notNil]) 
tz@424
   361
    ifTrue: 
tz@424
   362
    [
tz@424
   363
        fileDoubleClickAction numArgs = 0
tz@424
   364
        ifTrue:
tz@424
   365
        [
tz@424
   366
            fileDoubleClickAction value
tz@424
   367
        ].
tz@424
   368
        fileDoubleClickAction numArgs = 1
tz@424
   369
        ifTrue:
tz@451
   370
        [                
tz@451
   371
            fileDoubleClickAction value: (directory asFilename construct: self selectionOfFile value baseName) name
tz@424
   372
        ]
tz@424
   373
    ]
tz@424
   374
!
tz@424
   375
tz@424
   376
fileSelected
tz@424
   377
      
tz@473
   378
    (fileSelectAction notNil and: [self selectionOfFile value notNil]) 
tz@424
   379
    ifTrue: 
tz@424
   380
    [
tz@424
   381
        fileSelectAction numArgs = 0
tz@424
   382
        ifTrue:
tz@424
   383
        [
tz@424
   384
            fileSelectAction value
tz@424
   385
        ].
tz@424
   386
        fileSelectAction numArgs = 1
tz@424
   387
        ifTrue:
tz@424
   388
        [
tz@451
   389
            fileSelectAction value: (directory asFilename construct: self selectionOfFile value baseName) name
tz@424
   390
        ]
tz@424
   391
    ]
tz@424
   392
! !
tz@424
   393
tz@424
   394
!DirectoryView methodsFor:'initialization'!
tz@424
   395
tz@424
   396
initialize
tz@424
   397
tz@424
   398
    super initialize.
cg@874
   399
    self createBuilder.
tz@424
   400
tz@424
   401
    directory :=  directory ? '.' asFilename asAbsoluteFilename directoryName.
tz@424
   402
    monitoring := false.
tz@593
   403
    fileAttributes := #('File name' 'Size' 'Modified').
tz@424
   404
    self selectionOfFileFilter value: (self listOfFileFilters at: 1 ifAbsent: [nil]).
tz@424
   405
cg@874
   406
    "Modified: / 20.6.1998 / 14:46:10 / cg"
tz@424
   407
! !
tz@424
   408
cg@2878
   409
!DirectoryView methodsFor:'initialize-release'!
cg@2878
   410
cg@2878
   411
release
cg@2878
   412
cg@2878
   413
    monitoring ifTrue:
cg@2878
   414
    [
cg@2878
   415
        Processor removeTimedBlock:monitoringTimeBlock.
cg@2878
   416
        monitoringTimeBlock := nil
cg@2878
   417
    ].
cg@2878
   418
cg@2878
   419
    super release
cg@2878
   420
cg@2878
   421
! !
cg@2878
   422
cg@1346
   423
!DirectoryView methodsFor:'menu actions'!
cg@1346
   424
cg@1346
   425
updateFileList
cg@1346
   426
    DirectoryContents flushCache.
cg@1346
   427
    self readDirectory
cg@1346
   428
cg@1346
   429
    "Created: / 11.2.2000 / 00:12:46 / cg"
cg@1346
   430
    "Modified: / 11.2.2000 / 00:14:32 / cg"
cg@1346
   431
! !
cg@1346
   432
tz@424
   433
!DirectoryView methodsFor:'private'!
tz@424
   434
tz@424
   435
readDirectory
cg@2439
   436
    |allDirectories allFiles foundFiles filterList dir newContents|    
tz@424
   437
cg@2439
   438
    allFiles := OrderedCollection new.
cg@2439
   439
    allDirectories := OrderedCollection new.
cg@2439
   440
    foundFiles := OrderedCollection new.
cg@991
   441
    "/ filterList := self listOfFileFilters value.
cg@991
   442
    filterList := self selectedFileFilter asCollectionOfSubstringsSeparatedBy:$;.
cg@991
   443
    filterList := filterList collect:[:pattern | pattern withoutSeparators].
tz@614
   444
cg@999
   445
    self withCursor:Cursor read do:[ 
cg@828
   446
        (dir := DirectoryContents directoryNamed: directory) notNil ifTrue:[
cg@979
   447
"/            dir filesAndBasenamesDo:[:file :name|      
cg@979
   448
"/                filterList do:[:filter|
cg@979
   449
"/                    ((filter match:name) and:[(foundFiles includes: name) not])
cg@979
   450
"/                    ifTrue:[
cg@979
   451
"/                        foundFiles add: name
cg@979
   452
"/                    ].
cg@979
   453
"/                ].
cg@979
   454
"/            ].
cg@979
   455
            dir filesAndBasenamesDo:[:file :name|      
cg@979
   456
                allFiles add: name
tz@590
   457
            ].
cg@2439
   458
            dir directoriesAndBasenamesDo:[:file :name|      
cg@2439
   459
                allDirectories add: name
cg@2439
   460
            ].
cg@991
   461
cg@999
   462
            Filename isCaseSensitive ifFalse:[
cg@999
   463
                filterList do:[:filter|
cg@999
   464
                    |lcFilter|
cg@999
   465
cg@999
   466
                    lcFilter := filter asLowercase.
cg@999
   467
                    foundFiles
cg@999
   468
                        addAll:(allFiles 
cg@999
   469
                                    select:[:name | lcFilter match:name asLowercase]
cg@999
   470
                                ).
cg@999
   471
                ]
cg@999
   472
            ] ifTrue:[
cg@999
   473
                filterList do:[:filter|
cg@999
   474
                    foundFiles
cg@999
   475
                        addAll:(allFiles 
cg@999
   476
                                    select:[:name | filter match:name]
cg@999
   477
                                ).
cg@999
   478
                ]
cg@979
   479
            ].
cg@979
   480
cg@2439
   481
            foundFiles sort.
cg@2439
   482
            allDirectories sort.
cg@2439
   483
cg@979
   484
            dir := directory asFilename.
cg@2439
   485
cg@2439
   486
            newContents := OrderedCollection new.
cg@2439
   487
            newContents addAll:(allDirectories collect:[:name| FileRow new fileName:(dir construct:name)]).
cg@2439
   488
            newContents addAll:(foundFiles collect:[:name| FileRow new fileName:(dir construct:name)]).
cg@2439
   489
cg@2439
   490
            self listOfFiles contents:newContents
cg@828
   491
        ]
tz@590
   492
    ]
tz@614
   493
cg@999
   494
    "Modified: / 23.9.1998 / 17:00:42 / cg"
tz@590
   495
!
tz@590
   496
tz@590
   497
readMonitoringDirectory
tz@590
   498
tz@424
   499
    |readBlock|
tz@424
   500
    readTask notNil ifTrue: [readTask terminate].
tz@424
   501
    readBlock :=
tz@424
   502
    [
tz@424
   503
        |dir currentFilenames oldListOfFiles|
tz@424
   504
        dir := directory asFilename.
tz@424
   505
        currentFilenames := OrderedCollection new.
tz@424
   506
        (dir isReadable and:[dir isExecutable]) ifTrue:
tz@424
   507
        [
tz@424
   508
            self listOfFileFilters value do:
tz@424
   509
            [:filter|
tz@424
   510
                (dir filesMatchingWithoutDotDirs: filter) do:
tz@424
   511
                [:aFileName|
tz@424
   512
                    |file|
tz@424
   513
                    (file := dir construct: aFileName) isDirectory
tz@424
   514
                    ifFalse:
tz@424
   515
                    [
tz@424
   516
                        currentFilenames add: file
tz@424
   517
                    ]
tz@424
   518
                ].
tz@424
   519
            ].
tz@424
   520
        ].
tz@424
   521
        oldListOfFiles := self listOfFiles copy.
tz@424
   522
        (currentFilenames asSortedCollection: [:f1 :f2| f1 baseName < f2 baseName]) asSet do: 
tz@424
   523
        [:fileName| 
tz@424
   524
            (oldListOfFiles detect: [:fileRow| fileRow fileName = fileName] ifNone: nil) isNil
tz@424
   525
            ifTrue:                                                                             
tz@424
   526
            [
tz@424
   527
                |nearestFileRow r|
tz@424
   528
                nearestFileRow := self listOfFiles indexOf: (self listOfFiles detect: [:fileRow| fileRow baseName > fileName baseName] ifNone: nil).
tz@424
   529
                nearestFileRow = 0
tz@424
   530
                ifTrue: [self listOfFiles add: (r := FileRow new fileName: fileName asFilename)]
tz@424
   531
                ifFalse: [self listOfFiles add: (r := FileRow new fileName: fileName asFilename) beforeIndex: nearestFileRow].
tz@424
   532
                monitoring ifTrue: [self selectionOfFile value: r].
tz@424
   533
            ]
tz@424
   534
        ].
tz@424
   535
        self listOfFiles reverseDo:
tz@424
   536
        [:fileRow|
tz@424
   537
            (currentFilenames includes: fileRow fileName)
tz@424
   538
            ifFalse: [self listOfFiles remove: fileRow]
tz@424
   539
        ]
tz@424
   540
    ].
tz@424
   541
tz@424
   542
    monitoring
tz@424
   543
    ifTrue:
tz@424
   544
    [
tz@424
   545
        readTask := readBlock forkAt: Processor userBackgroundPriority.
tz@424
   546
        Processor addTimedBlock: monitoringTimeBlock afterSeconds: 1
tz@424
   547
    ]
tz@424
   548
    ifFalse:
tz@424
   549
    [
tz@424
   550
        Cursor wait showWhile: [readBlock value]
tz@424
   551
    ]
tz@424
   552
! !
tz@424
   553
tz@424
   554
!DirectoryView methodsFor:'selection'!
tz@424
   555
tz@424
   556
selectedFileFilter
tz@424
   557
tz@424
   558
    ^selectedFileFilter
tz@424
   559
tz@424
   560
!
tz@424
   561
cg@999
   562
selectedFileFilter:aString
cg@999
   563
    "change the file filter"
tz@424
   564
cg@999
   565
    |listOfFileFilters nArgs|
cg@999
   566
cg@999
   567
    aString = selectedFileFilter ifTrue:[^ self].
cg@999
   568
cg@999
   569
    listOfFileFilters := self listOfFileFilters.
cg@999
   570
cg@999
   571
    "/ what is this for ?
cg@999
   572
    aString size == 0 ifTrue: [
cg@999
   573
        listOfFileFilters remove: selectedFileFilter ifAbsent: nil
cg@999
   574
    ].
tz@424
   575
    selectedFileFilter := aString.
cg@999
   576
cg@999
   577
    ((listOfFileFilters includes: selectedFileFilter) not
cg@999
   578
    and:[selectedFileFilter notEmpty])
cg@999
   579
    ifTrue: [
cg@999
   580
        listOfFileFilters addFirst: selectedFileFilter
tz@424
   581
    ].
cg@999
   582
    ((listOfFileFilters includes: selectedFileFilter)
cg@999
   583
    and:[fileFilterSelectAction notNil]) 
cg@999
   584
    ifTrue: [
cg@999
   585
        (nArgs := fileFilterSelectAction numArgs) == 0
cg@999
   586
        ifTrue: [
tz@424
   587
            fileFilterSelectAction value
cg@999
   588
        ] ifFalse:[
cg@999
   589
            nArgs == 1 ifTrue:[
cg@999
   590
                fileFilterSelectAction value: selectedFileFilter
cg@999
   591
            ] ifFalse:[
cg@999
   592
                self error:'bad numArgs of fileFilter action block'
cg@999
   593
            ]
tz@424
   594
        ]
tz@424
   595
    ].       
tz@424
   596
    self readDirectory.
cg@999
   597
cg@999
   598
    "Modified: / 23.9.1998 / 16:53:05 / cg"
tz@424
   599
! !
tz@424
   600
tz@424
   601
!DirectoryView methodsFor:'startup / release'!
tz@424
   602
tz@424
   603
closeRequest
tz@424
   604
tz@424
   605
    self release.
tz@424
   606
tz@424
   607
    super closeRequest
tz@424
   608
tz@424
   609
! !
tz@424
   610
tz@424
   611
!DirectoryView::FileRow class methodsFor:'resources'!
tz@424
   612
tz@424
   613
HFileIcon
tz@424
   614
tz@424
   615
    ^self hFileIcon
tz@424
   616
!
tz@424
   617
tz@424
   618
MakefileIcon
tz@590
   619
    "Generated by the Image Editor"
tz@590
   620
    "
tz@590
   621
    ImageEditor openOnClass:self andSelector:#MakefileIcon
tz@590
   622
    "
tz@424
   623
tz@424
   624
    <resource: #image>
tz@590
   625
tz@590
   626
    ^Icon
tz@590
   627
        constantNamed:#'DirectoryView::FileRow MakefileIcon'
penk@1627
   628
        ifAbsentPut:[(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???9 @_0 @W2 @S0 @Q0 @_0 @O8 @@0 @@0 @@0)IV0/U$0)]&0)UT;)UV4 @@0 @@0???0???0'); colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0'); yourself); yourself]
penk@1627
   629
!
tz@424
   630
tz@424
   631
binaryFileIcon
tz@590
   632
    "Generated by the Image Editor"
tz@590
   633
    "
tz@590
   634
    ImageEditor openOnClass:self andSelector:#binaryFileIcon
tz@590
   635
    "
tz@424
   636
tz@424
   637
    <resource: #image>
tz@590
   638
tz@590
   639
    ^Icon
tz@590
   640
        constantNamed:#'DirectoryView::FileRow binaryFileIcon'
penk@1627
   641
        ifAbsentPut:[(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???3 @_7 @W4#&S0&6Q0&6_3&6O5&6@0#&@9 @@0&\@2&6@0&6@0&6@1&6@8&\@0 @@0???0???1'); colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0'); yourself); yourself]
penk@1627
   642
!
tz@424
   643
tz@424
   644
cFileIcon
tz@590
   645
    "Generated by the Image Editor"
tz@590
   646
    "
tz@590
   647
    ImageEditor openOnClass:self andSelector:#cFileIcon
tz@590
   648
    "
tz@424
   649
tz@424
   650
    <resource: #image>
tz@590
   651
tz@590
   652
    ^Icon
tz@590
   653
        constantNamed:#'DirectoryView::FileRow cFileIcon'
penk@1627
   654
        ifAbsentPut:[(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???9 @_0 @W2 @S0 @Q0 @_0 @O8 @@0 @@0 \@0 "@0  @0  @0&"@;&\@4 @@0 @@0???0???0'); colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0'); yourself); yourself]
penk@1627
   655
!
tz@424
   656
tz@424
   657
exeFileIcon
tz@590
   658
    "Generated by the Image Editor"
tz@590
   659
    "
tz@590
   660
    ImageEditor openOnClass:self andSelector:#exeFileIcon
tz@590
   661
    "
tz@424
   662
tz@424
   663
    <resource: #image>
tz@590
   664
tz@590
   665
    ^Icon
tz@590
   666
        constantNamed:#'DirectoryView::FileRow exeFileIcon'
penk@1627
   667
        ifAbsentPut:[(Depth2Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUUUU@@@@UUT@@@AEUP@@@DEU@@@@PETEUUUUUPZ**)UUAUUUUATG???4EP_???PUA???=ATG???4EP_???PUA???=ATEUUUTEP@@@@@U@@@@@AUUUUUUUUUUUUUTb'); colorMap:(((Array new:4) at:1 put:((Color white)); at:2 put:((Color black)); at:3 put:((Color red:0.0 green:49.9977 blue:49.9977)); at:4 put:((Color grey:66.9978)); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0'); yourself); yourself]
penk@1627
   668
!
tz@424
   669
tz@424
   670
fileIcon
tz@590
   671
    "Generated by the Image Editor"
tz@590
   672
    "
tz@590
   673
    ImageEditor openOnClass:self andSelector:#fileIcon
tz@590
   674
    "
tz@424
   675
tz@424
   676
    <resource: #image>
tz@590
   677
tz@590
   678
    ^Icon
tz@590
   679
        constantNamed:#'DirectoryView::FileRow fileIcon'
penk@1627
   680
        ifAbsentPut:[(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???9 @_0 @W2 @S0 @Q0 @_0 @O8 @@0 @@0 @@0 @@0 @@0 @@0 @@; @@4 @@0 @@0???0???0') ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0') ; yourself); yourself]
penk@1627
   681
!
tz@424
   682
tz@424
   683
hFileIcon
tz@590
   684
    "Generated by the Image Editor"
tz@590
   685
    "
tz@590
   686
    ImageEditor openOnClass:self andSelector:#hFileIcon
tz@590
   687
    "
tz@424
   688
tz@424
   689
    <resource: #image>
tz@590
   690
tz@590
   691
    ^Icon
tz@590
   692
        constantNamed:#'DirectoryView::FileRow hFileIcon'
penk@1627
   693
        ifAbsentPut:[(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???9 @_0 @W2 @S0 @Q0 @_0 @O8  @0  @0 ,@0 2@0 "@0 "@0&"@;&"@4 @@0 @@0???0???0'); colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0'); yourself); yourself]
penk@1627
   694
!
tz@424
   695
tz@644
   696
htmlFileIcon
tz@644
   697
    "Generated by the Image Editor"
tz@644
   698
    "
tz@644
   699
    ImageEditor openOnClass:self andSelector:#htmlFileIcon
tz@644
   700
    "
tz@424
   701
tz@424
   702
    <resource: #image>
tz@644
   703
tz@644
   704
    ^Icon
tz@644
   705
        constantNamed:#'DirectoryView::FileRow htmlFileIcon'
penk@1627
   706
        ifAbsentPut:[(Depth4Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'DQDQDQDQDQDQDQ????????DQDQD_???????1@QDQG???L3L3<P@QDQ??L3ADL3D@@QD_?3L0P3L1DQDQG?L3MCP3L1DQDQ?3QCQCMCP??1D_<4P4QDL4O?<QG?L4QDL3MD??DQ?3L3QCL3PO?1D_<3L4QDL4O?<QG?<3QDQCMO??DQ??L4QDP4S??1D_??=D@@S???<QG???????????DQ???????????1DQDQDQDQDQDQDQDQDQDQDQDQDQDP@a') ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); add:(Color red:0.0 green:0.0 blue:100.0); add:(Color red:0.0 green:100.0 blue:100.0); add:(Color red:100.0 green:100.0 blue:0.0); add:(Color red:100.0 green:0.0 blue:100.0); add:(Color red:49.9977 green:0.0 blue:0.0); add:(Color red:0.0 green:49.9977 blue:0.0); add:(Color red:0.0 green:0.0 blue:49.9977); add:(Color red:0.0 green:49.9977 blue:49.9977); add:(Color red:49.9977 green:49.9977 blue:0.0); add:(Color red:49.9977 green:0.0 blue:49.9977); add:(Color grey:49.9977); add:(Color grey:66.9978); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0') ; yourself); yourself]
penk@1627
   707
!
tz@644
   708
tz@644
   709
imageFileIcon
tz@644
   710
    "Generated by the Image Editor"
tz@644
   711
    "
tz@644
   712
    ImageEditor openOnClass:self andSelector:#imageFileIcon
tz@644
   713
    "
tz@644
   714
tz@644
   715
    <resource: #image>
tz@644
   716
tz@644
   717
    ^Icon
tz@644
   718
        constantNamed:#'DirectoryView::FileRow imageFileIcon'
penk@1627
   719
        ifAbsentPut:[(Depth4Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@DQDQDQDQ@@@@@ADQDQDQDPD@@@@QDQDQDQDAD@@@DQDQDQDQ@QD@@ADQDQDQDP@@@@@TQG]4)G50@@@@EDQ7^$+W4QDP@AQD]7R$_WDQD@@SL6Y#$61!!DQ@@D3M&ZS''F0QDP@AL3Y&NS[FDQD@@RH%UR %-QDQ@@D"IUVB"5,QDP@AH"UUJBV5DQD@@QDQDQDQDQDQ@@DQDQDQDQDQDP@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a') ; colorMap:((OrderedCollection new add:(Color black); add:(Color white); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); add:(Color red:0.0 green:0.0 blue:100.0); add:(Color red:0.0 green:100.0 blue:100.0); add:(Color red:100.0 green:100.0 blue:0.0); add:(Color red:100.0 green:0.0 blue:100.0); add:(Color red:49.9977 green:0.0 blue:0.0); add:(Color red:0.0 green:49.9977 blue:0.0); add:(Color red:0.0 green:0.0 blue:49.9977); add:(Color red:0.0 green:49.9977 blue:49.9977); add:(Color red:49.9977 green:49.9977 blue:0.0); add:(Color red:49.9977 green:0.0 blue:49.9977); add:(Color grey:49.9977); add:(Color grey:66.9978); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0') ; yourself); yourself]
penk@1627
   720
!
tz@424
   721
tz@424
   722
imgFileIcon
tz@590
   723
    "Generated by the Image Editor"
tz@590
   724
    "
tz@590
   725
    ImageEditor openOnClass:self andSelector:#imgFileIcon
tz@590
   726
    "
tz@424
   727
tz@424
   728
    <resource: #image>
tz@590
   729
tz@590
   730
    ^Icon
tz@590
   731
        constantNamed:#'DirectoryView::FileRow imgFileIcon'
tz@644
   732
        ifAbsentPut:[(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???9 @_0 @W2 @S0 @Q0 @_0 @O8  @0 @@0!!-F0 **0 **0 **0&**;&*&4 @B0 @N0???0???0'); colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0'); yourself); yourself]
tz@644
   733
!
tz@424
   734
tz@424
   735
linkedFileIcon
tz@644
   736
    "Generated by the Image Editor"
tz@644
   737
    "
tz@644
   738
    ImageEditor openOnClass:self andSelector:#linkedFileIcon
tz@644
   739
    "
tz@424
   740
tz@424
   741
    <resource: #image>
tz@644
   742
tz@644
   743
    ^Icon
tz@644
   744
        constantNamed:#'DirectoryView::FileRow linkedFileIcon'
penk@1627
   745
        ifAbsentPut:[(Depth2Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUUUU@@@@UUT@@@AEUP@@@DEU@@@@PET@@@AUUP@@@AUU@@@@@AT@@@@ EP@@@B U@@@**!!T@@J**EP@B B UB*(@HATJ*@@@EP@@@@@U@@@@@AUUUUUUUUUUUUUTb') ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); add:(Color red:0.0 green:0.0 blue:100.0); add:(Color red:100.0 green:0.0 blue:0.0); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0') ; yourself); yourself]
penk@1627
   746
!
tz@424
   747
tz@424
   748
lockedFileIcon
tz@644
   749
    "Generated by the Image Editor"
tz@644
   750
    "
tz@644
   751
    ImageEditor openOnClass:self andSelector:#lockedFileIcon
tz@644
   752
    "
tz@424
   753
tz@424
   754
    <resource: #image>
tz@644
   755
tz@644
   756
    ^Icon
tz@644
   757
        constantNamed:#'DirectoryView::FileRow lockedFileIcon'
penk@1627
   758
        ifAbsentPut:[(Depth2Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'UUUUUUU(@@@UUT(@@AEUP(@@DEU@(@@PET@(@IUUP@(B!!UU@@((@AT@@*@@EP@B(@@U@@((@AT@J@(@EPB @(@U@(@@(ATJ@@@(ER @@@(U(@@@@)UUUUUUUUUUUUUTb') ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0') ; yourself); yourself]
penk@1627
   759
!
tz@424
   760
tz@424
   761
protoFileIcon
tz@424
   762
tz@424
   763
    ^self MakefileIcon
tz@424
   764
!
tz@424
   765
tz@424
   766
rcFileIcon
tz@644
   767
    "Generated by the Image Editor"
tz@644
   768
    "
tz@644
   769
    ImageEditor openOnClass:self andSelector:#rcFileIcon
tz@644
   770
    "
tz@424
   771
tz@424
   772
    <resource: #image>
tz@644
   773
tz@644
   774
    ^Icon
tz@644
   775
        constantNamed:#'DirectoryView::FileRow rcFileIcon'
penk@1627
   776
        ifAbsentPut:[(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???9 @_0 @W2 @S0 @Q0 @_0 @O8 @@0 @@0 ) 0 2P0 "@0 "@0&"P;&!! 4 @@0 @@0???0???0') ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0') ; yourself); yourself]
penk@1627
   777
!
tz@424
   778
tz@424
   779
sFileIcon
tz@644
   780
    "Generated by the Image Editor"
tz@644
   781
    "
tz@644
   782
    ImageEditor openOnClass:self andSelector:#sFileIcon
tz@644
   783
    "
tz@424
   784
tz@424
   785
    <resource: #image>
tz@644
   786
tz@644
   787
    ^Icon
tz@644
   788
        constantNamed:#'DirectoryView::FileRow sFileIcon'
penk@1627
   789
        ifAbsentPut:[(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???9 @_0 @W2 @S0 @Q0 @_0 @O8 @@0 @@0 X@0  @0 0@0 X@0&H@;&0@4 @@0 @@0???0???0') ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0') ; yourself); yourself]
penk@1627
   790
!
tz@424
   791
tz@424
   792
stFileIcon
tz@590
   793
    "Generated by the Image Editor"
tz@590
   794
    "
tz@590
   795
    ImageEditor openOnClass:self andSelector:#stFileIcon
tz@590
   796
    "
tz@424
   797
tz@424
   798
    <resource: #image>
tz@590
   799
tz@590
   800
    ^Icon
tz@590
   801
        constantNamed:#'DirectoryView::FileRow stFileIcon'
penk@1627
   802
        ifAbsentPut:[(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???9 @_0 @W2 @S0 @Q0 @_0 @O8 A@0 A@0 [00 !!@0 1@0 Y@0&I@;&004 @@0 @@0???0???0'); colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0'); yourself); yourself]
penk@1627
   803
!
tz@424
   804
tz@424
   805
stcFileIcon
tz@644
   806
    "Generated by the Image Editor"
tz@644
   807
    "
tz@644
   808
    ImageEditor openOnClass:self andSelector:#stcFileIcon
tz@644
   809
    "
tz@424
   810
tz@424
   811
    <resource: #image>
tz@644
   812
tz@644
   813
    ^Icon
tz@644
   814
        constantNamed:#'DirectoryView::FileRow stcFileIcon'
penk@1627
   815
        ifAbsentPut:[(Depth1Image new) width: 20; height: 19; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'???9 @_0 @W2 @S0 @Q0 @_0 @O8 B@0 B@0 _L0 "R0 2P0 ZP0&JR;&3L4 @@0 @@0???0???0') ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); yourself)); mask:((ImageMask new) width: 20; height: 19; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'??0@??8@??<@??>@???@??? ???0???0???0???0???0???0???0???0???0???0???0???0_??0') ; yourself); yourself]
penk@1627
   816
! !
tz@424
   817
tz@424
   818
!DirectoryView::FileRow methodsFor:'accessing'!
tz@424
   819
tz@424
   820
baseName
tz@424
   821
tz@424
   822
    ^baseName ? (baseName := fileName baseName)
tz@424
   823
tz@424
   824
tz@424
   825
tz@424
   826
tz@424
   827
tz@424
   828
tz@424
   829
tz@424
   830
!
tz@424
   831
tz@424
   832
fileName
tz@424
   833
tz@424
   834
    ^fileName
tz@424
   835
!
tz@424
   836
tz@424
   837
fileName: aFileName
tz@424
   838
tz@614
   839
    fileName := aFileName
tz@424
   840
!
tz@424
   841
tz@424
   842
group
tz@424
   843
tz@424
   844
    ^group
tz@424
   845
!
tz@424
   846
tz@424
   847
iconOn:aGC
tz@424
   848
tz@638
   849
    |icon|
tz@638
   850
    iconKey isNil 
tz@638
   851
    ifTrue: 
tz@424
   852
    [
tz@614
   853
        self validateAttributes.
tz@638
   854
        (imageFromFile isNil and: [iconKey == #imageFileIcon])
tz@638
   855
            ifTrue:  [icon := self retrieveImageFromFileAndRegisterOn: aGC]
tz@424
   856
    ].
cg@645
   857
    imageFromFile == true
tz@638
   858
        ifFalse: [icon := aGC registerImage: (self class perform: iconKey) key: iconKey]
tz@638
   859
        ifTrue:  [icon := aGC registeredImageAt: iconKey].
tz@638
   860
    ^icon
cg@645
   861
cg@645
   862
    "Modified: / 18.2.1998 / 18:01:52 / cg"
tz@424
   863
!
tz@424
   864
tz@424
   865
modified
tz@424
   866
tz@424
   867
    ^modified
tz@424
   868
!
tz@424
   869
tz@424
   870
owner
tz@424
   871
tz@424
   872
    ^owner
tz@424
   873
!
tz@424
   874
tz@424
   875
permissions
tz@424
   876
tz@424
   877
    ^permissions
tz@424
   878
!
tz@424
   879
tz@638
   880
retrieveImageFromFileAndRegisterOn: aGC
cg@1385
   881
    "retrieve a bitmap image - but only if it is smaller than some limit (currently 20k)"
tz@638
   882
cg@1385
   883
    |image maxImageFileSize|
cg@1385
   884
cg@1385
   885
    maxImageFileSize := MaxImageFileSize ? 20000.
cg@1385
   886
tz@638
   887
    imageFromFile := false.       
tz@638
   888
    (image := aGC registeredImageAt: fileName name asSymbol) isNil
cg@1385
   889
    ifTrue:[            
cg@1385
   890
        size < maxImageFileSize ifTrue:[     
tz@638
   891
            Object errorSignal handle: [:ex|]
cg@1385
   892
            do:[   
cg@1385
   893
                (image := Image fromFile: fileName name) notNil ifTrue:[
cg@1385
   894
                    image extent y > 22 ifTrue:[         
tz@638
   895
                        image := image magnifiedBy: 22/image extent y
tz@638
   896
                    ].
tz@638
   897
                    image := aGC registerImage: image key: fileName name asSymbol.
tz@638
   898
                ]
tz@638
   899
            ] 
tz@638
   900
        ].
tz@638
   901
    ].
tz@638
   902
    image notNil ifTrue: [imageFromFile := true. iconKey := fileName name asSymbol].
tz@638
   903
    ^image
tz@638
   904
tz@638
   905
tz@638
   906
tz@638
   907
!
tz@638
   908
tz@424
   909
size
cg@607
   910
    size isNumber ifFalse:[^ size].
cg@607
   911
    size < 1000        ifTrue: [^ size printString].
cg@607
   912
    size < (100*1024)  ifTrue: [^(((size/1024) * 10) asInteger/10) asFloat printString, ' Kb'].
cg@607
   913
    size < (1000*1024) ifTrue: [^(((size/1024)) asInteger) printString, ' Kb'].
cg@607
   914
    ^(((size/1048576) * 10) asInteger/10) asFloat printString, ' Mb'
tz@424
   915
cg@607
   916
    "Modified: / 6.2.1998 / 03:38:45 / cg"
tz@424
   917
! !
tz@424
   918
tz@424
   919
!DirectoryView::FileRow methodsFor:'private'!
tz@424
   920
tz@424
   921
validateAttributes
tz@424
   922
tz@638
   923
    |info mode| 
tz@638
   924
tz@424
   925
    permissions := String new:9 withAll:$-.
tz@424
   926
tz@424
   927
    (info := fileName info) isNil
tz@424
   928
    ifTrue:
tz@424
   929
    [
tz@424
   930
        iconKey := #lockedFileIcon.
tz@424
   931
        size    := owner := group := '?'.
tz@424
   932
      ^ self
tz@424
   933
    ].        
tz@424
   934
    size   := info size.
penk@1627
   935
    modified := info modificationTime printString.
tz@424
   936
    owner  := OperatingSystem getUserNameFromID: info uid.
tz@424
   937
    group  := OperatingSystem getGroupNameFromID: info gid.
tz@424
   938
    mode   := info mode.
tz@424
   939
tz@424
   940
    1 to:9 by:3 do:[:i|
tz@424
   941
        #((0 $x) (1 $w) (2 $r)) do:
tz@424
   942
        [:m|
tz@424
   943
            (mode bitAt:i + m first) == 1 ifTrue:[permissions at: 10 - m first - i put: m last]
tz@424
   944
        ]
tz@424
   945
    ].
tz@424
   946
tz@424
   947
    fileName isReadable
tz@424
   948
    ifTrue:
tz@424
   949
    [
tz@424
   950
        info type == #symbolicLink
tz@424
   951
        ifTrue:
tz@424
   952
        [
tz@424
   953
            ^iconKey := #linkedFileIcon
tz@424
   954
        ]
tz@424
   955
        ifFalse:
tz@424
   956
        [       
tz@424
   957
            ((DirectoryView::FileRow class implements: (iconKey := (fileName suffix, 'FileIcon') asSymbol))
tz@424
   958
            or:
tz@424
   959
            [DirectoryView::FileRow class implements: (iconKey := (fileName baseName, 'Icon') asSymbol)])
tz@424
   960
            ifFalse:
tz@424
   961
            [
tz@424
   962
                iconKey := #fileIcon.
tz@424
   963
                (Image isImageFileSuffix:fileName suffix)
tz@424
   964
                ifTrue:
tz@424
   965
                [
tz@424
   966
                    ^iconKey := #imageFileIcon
tz@424
   967
                ].
tz@424
   968
                (fileName suffix = 'o') | (fileName suffix = 'so')
tz@424
   969
                ifTrue:
tz@424
   970
                [
tz@424
   971
                    ^iconKey := #binaryFileIcon
tz@424
   972
                ].
tz@424
   973
tz@424
   974
                fileName isExecutableProgram
tz@424
   975
                ifTrue:
tz@424
   976
                [
tz@424
   977
                    ^iconKey := #exeFileIcon
tz@424
   978
                ]
tz@424
   979
            ]
tz@424
   980
        ]
tz@424
   981
    ] 
tz@424
   982
    ifFalse:
tz@424
   983
    [
tz@424
   984
        ^iconKey := #lockedFileIcon
tz@424
   985
    ].
tz@424
   986
! !
tz@424
   987
tz@424
   988
!DirectoryView class methodsFor:'documentation'!
tz@424
   989
tz@424
   990
version
tz@424
   991
    ^ '$Header$'
tz@424
   992
! !