MIMETypes.st
author Claus Gittinger <cg@exept.de>
Fri, 11 Jan 2013 16:13:27 +0100
changeset 3053 2c1b6c1e317f
parent 3039 1a8ca229615f
child 3104 39607bbc7c1d
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1997 by eXept Software AG 
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
     3
	      All Rights Reserved
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
1410
faf04ef6892b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
    12
"{ Package: 'stx:libview2' }"
faf04ef6892b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
    13
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
Object subclass:#MIMETypes
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
    15
	instanceVariableNames:''
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
    16
	classVariableNames:'TypeToImageReaderClassMapping TypeToCommentStringMapping
1979
0612875a95c1 acroread command from registry (win32)
Claus Gittinger <cg@exept.de>
parents: 1925
diff changeset
    17
		TypeToFileSuffixMapping TypeToViewerApplicationMapping
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
    18
		SuffixToCommentStringMapping FileSuffixToTypeMapping
1979
0612875a95c1 acroread command from registry (win32)
Claus Gittinger <cg@exept.de>
parents: 1925
diff changeset
    19
		FilenameToTypeMapping FileSuffixToImageReaderClassMapping
0612875a95c1 acroread command from registry (win32)
Claus Gittinger <cg@exept.de>
parents: 1925
diff changeset
    20
		CharSetToFontMapping LastSuffix LastType
2298
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
    21
		DefaultCommandPerMIMEPerOS DefaultPrintCommandPerMIMEPerOS
2491
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
    22
		TypeToParenthesisSpecMapping SuffixToParenthesisSpecMapping'
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
    23
	poolDictionaries:''
1800
817b8ce39da7 category
Claus Gittinger <cg@exept.de>
parents: 1783
diff changeset
    24
	category:'Net-Communication-Support'
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
    25
!
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
    26
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
    27
String variableByteSubclass:#MIMEType
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
    28
	instanceVariableNames:''
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
    29
	classVariableNames:'CachedTypes'
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
    30
	poolDictionaries:''
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
    31
	privateIn:MIMETypes
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
!
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
!MIMETypes class methodsFor:'documentation'!
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
copyright
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
"
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
 COPYRIGHT (c) 1997 by eXept Software AG 
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
    39
	      All Rights Reserved
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
 This software is furnished under a license and may be used
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
 only in accordance with the terms of that license and with the
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
 inclusion of the above copyright notice.   This software may not
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
 be provided or otherwise made available to, or used by, any
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
 other person.  No title to or ownership of the software is
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
 hereby transferred.
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
"
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
!
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
documentation
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
"
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
    just a place to keep MIME information
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
    (avoid spreading things at many places)
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
1021
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    57
    MIMETypes is abstract and functional.
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    58
    Actually, in some OperatingSystems, this information may
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    59
    be found in some config files (or registries).
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    60
    Therefore, this class may have to be extended to support this
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    61
    and fetch the information from there eventually.
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
    62
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
    [author:]
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
        Claus Gittinger
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
"
1311
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
    66
!
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
    67
2486
42063a7fc3db mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
    68
examples
42063a7fc3db mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
    69
"
2970
8b91ec204044 comment/format in: #initialize
Claus Gittinger <cg@exept.de>
parents: 2968
diff changeset
    70
                                                                            [exBegin]
2487
eaa224da42fa mimeType: x-expecco-testsuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents: 2486
diff changeset
    71
    MIMETypes mimeTypeFromString:'application/x-expecco-testsuite' 
2970
8b91ec204044 comment/format in: #initialize
Claus Gittinger <cg@exept.de>
parents: 2968
diff changeset
    72
                                                                            [exEnd]
2486
42063a7fc3db mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
    73
2970
8b91ec204044 comment/format in: #initialize
Claus Gittinger <cg@exept.de>
parents: 2968
diff changeset
    74
                                                                            [exBegin]
2486
42063a7fc3db mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
    75
    MIMETypes mimeTypeForSuffix:'gif'     
2970
8b91ec204044 comment/format in: #initialize
Claus Gittinger <cg@exept.de>
parents: 2968
diff changeset
    76
    MIMETypes mimeTypeForSuffix:'ets'
8b91ec204044 comment/format in: #initialize
Claus Gittinger <cg@exept.de>
parents: 2968
diff changeset
    77
    MIMETypes mimeTypeForSuffix:'xlsx'
8b91ec204044 comment/format in: #initialize
Claus Gittinger <cg@exept.de>
parents: 2968
diff changeset
    78
                                                                            [exEnd]
2486
42063a7fc3db mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
    79
"
42063a7fc3db mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
    80
!
42063a7fc3db mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
    81
1311
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
    82
knownTypes
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
    83
"
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
    84
    simply a reminder for me ...
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
    85
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
    86
    application         mime                            file extentsions
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
    87
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
    88
        powerpoint      application/ms-powerpoint       .pot, .ppz, .ppt, .pps, 
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
    89
                        application/mspowerpoint        
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
    90
                        application/vnd.ms-powerpoint   
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
    91
                        application/x-mspowerpoint
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
    92
1312
Claus Gittinger <cg@exept.de>
parents: 1311
diff changeset
    93
        shockwave       application/x-shockwave-flash   .swf     
1311
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
    94
1312
Claus Gittinger <cg@exept.de>
parents: 1311
diff changeset
    95
        futuresplash    application/futuresplash        .spl
1311
Claus Gittinger <cg@exept.de>
parents: 1300
diff changeset
    96
"
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
! !
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
!MIMETypes class methodsFor:'initialization'!
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   101
initialize
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   102
    "initialize wellKnown facts"
2491
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   103
    
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   104
    MIMEType initialize. "must be initialized first"
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   105
    LastSuffix := LastType := nil.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   106
    self initializeFileNameToMimeTypeMapping.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   107
    self initializeImageReaderMappings.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   108
    self initializeCommentStringMappings.
2491
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   109
    self initializeParenthesisSpecMappings.
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   110
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   111
    "
2970
8b91ec204044 comment/format in: #initialize
Claus Gittinger <cg@exept.de>
parents: 2968
diff changeset
   112
     self initialize
8b91ec204044 comment/format in: #initialize
Claus Gittinger <cg@exept.de>
parents: 2968
diff changeset
   113
    "
8b91ec204044 comment/format in: #initialize
Claus Gittinger <cg@exept.de>
parents: 2968
diff changeset
   114
2298
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
   115
    "Modified: / 10-04-2007 / 15:16:44 / cg"
2970
8b91ec204044 comment/format in: #initialize
Claus Gittinger <cg@exept.de>
parents: 2968
diff changeset
   116
    "Modified (comment): / 29-11-2011 / 19:11:51 / cg"
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   117
!
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   118
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   119
initializeCommentStringMappings
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   120
    TypeToCommentStringMapping := Dictionary new.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   121
    SuffixToCommentStringMapping := Dictionary new.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   122
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   123
    TypeToCommentStringMapping 
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   124
        at:'application/x-make'
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   125
        put:#('#' (nil nil)).           "/ '#' for EOL comments only
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   126
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   127
    TypeToCommentStringMapping 
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   128
        at:'application/x-sh'
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   129
        put:#('#' (nil nil)).           "/ '#' for EOL comments only
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   130
2489
b891d96fd496 elf extension: x-expecco-logfile
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
   131
    #('text/html' 'text/xml' 
b891d96fd496 elf extension: x-expecco-logfile
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
   132
      'application/xml' 
b891d96fd496 elf extension: x-expecco-logfile
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
   133
      'application/x-expecco-testsuite'
b891d96fd496 elf extension: x-expecco-logfile
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
   134
      'application/x-expecco-logfile'
b891d96fd496 elf extension: x-expecco-logfile
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
   135
    )
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   136
    do:[:eachXMLType |
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   137
        TypeToCommentStringMapping 
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   138
            at:eachXMLType
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   139
            put:#(nil ('<!!-- ' ' -->')). "/ '<!!-- ... -->' delimited comments only
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   140
    ].
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   141
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   142
    TypeToCommentStringMapping 
2055
501740104b75 css-comments
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
   143
        at:'text/css'
501740104b75 css-comments
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
   144
        put:#('//' ('/*' '*/')).          
501740104b75 css-comments
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
   145
501740104b75 css-comments
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
   146
    TypeToCommentStringMapping 
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   147
        at:'application/x-batch-script'
2937
67ef44218dc0 changed: #initializeCommentStringMappings
Claus Gittinger <cg@exept.de>
parents: 2924
diff changeset
   148
        put:#('@REM ' '@rem ' 'REM ' 'rem ' (nil nil)).         "/ 'rem ' for EOL comments only
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   149
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   150
    "/ the following is ST/X specific
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   151
    TypeToCommentStringMapping 
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   152
        at:'application/x-smalltalk-source'
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   153
        put:#('"/' ('"' '"')).           "/ '"/ ' for EOL; ".." for delimited comments
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   154
2055
501740104b75 css-comments
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
   155
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   156
    "/ this is for standard smalltalk
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   157
"/    TypeToCommentStringMapping 
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   158
"/        at:'application/x-smalltalk-source'
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   159
"/        put:#(nil ('"' '"')).            "/ ".." for delimited comments only
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   160
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   161
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   162
    TypeToCommentStringMapping 
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   163
        at:'application/x-pascal-source'
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   164
        put:#(nil ('{' '}')).           "/ '{'..'}' for delimited comments
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   165
2055
501740104b75 css-comments
Claus Gittinger <cg@exept.de>
parents: 2048
diff changeset
   166
2048
dbb361dd9c5f comment strings for javascript files
Claus Gittinger <cg@exept.de>
parents: 2028
diff changeset
   167
"/    "/ the following is k&r
dbb361dd9c5f comment strings for javascript files
Claus Gittinger <cg@exept.de>
parents: 2028
diff changeset
   168
"/    TypeToCommentStringMapping 
dbb361dd9c5f comment strings for javascript files
Claus Gittinger <cg@exept.de>
parents: 2028
diff changeset
   169
"/        at:'application/x-c-source'
dbb361dd9c5f comment strings for javascript files
Claus Gittinger <cg@exept.de>
parents: 2028
diff changeset
   170
"/        put:#(nil ('/*' '*/')).          "/ '/*'..'*/' for delimited comments
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   171
    "/ this is ANSI-c
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   172
    TypeToCommentStringMapping 
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   173
        at:'application/x-c-source'
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   174
        put:#('//' ('/*' '*/')).          
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   175
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   176
    TypeToCommentStringMapping 
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   177
        at:'application/x-cpp-source'
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   178
        put:#('//' ('/*' '*/')).          
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   179
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   180
    TypeToCommentStringMapping 
2479
40a05c259915 c# mime type
Claus Gittinger <cg@exept.de>
parents: 2432
diff changeset
   181
        at:'application/x-csharp-source'
40a05c259915 c# mime type
Claus Gittinger <cg@exept.de>
parents: 2432
diff changeset
   182
        put:#('//' ('/*' '*/')).          
40a05c259915 c# mime type
Claus Gittinger <cg@exept.de>
parents: 2432
diff changeset
   183
40a05c259915 c# mime type
Claus Gittinger <cg@exept.de>
parents: 2432
diff changeset
   184
    TypeToCommentStringMapping 
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   185
        at:'application/x-java-source'
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   186
        put:#('//' ('/*' '*/')).          
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   187
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   188
    TypeToCommentStringMapping 
2048
dbb361dd9c5f comment strings for javascript files
Claus Gittinger <cg@exept.de>
parents: 2028
diff changeset
   189
        at:'application/x-javascript'
dbb361dd9c5f comment strings for javascript files
Claus Gittinger <cg@exept.de>
parents: 2028
diff changeset
   190
        put:#('//' ('/*' '*/')).          
dbb361dd9c5f comment strings for javascript files
Claus Gittinger <cg@exept.de>
parents: 2028
diff changeset
   191
dbb361dd9c5f comment strings for javascript files
Claus Gittinger <cg@exept.de>
parents: 2028
diff changeset
   192
    TypeToCommentStringMapping 
2298
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
   193
        at:'application/x-lisp-source'
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
   194
        put:#(';' (nil nil)).           "/ '#' for EOL comments only
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
   195
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
   196
    TypeToCommentStringMapping 
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   197
        at:'application/x-asn1-source'
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   198
        put:#('--' ('--' '--')).          
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   199
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   200
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   201
    "/ st/x support files
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   202
    SuffixToCommentStringMapping 
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   203
        at:'style'
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   204
        put:#(';' (nil nil)).          
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   205
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   206
    SuffixToCommentStringMapping 
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   207
        at:'rs'
2298
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
   208
        put:#(';' (nil nil)).
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
   209
2937
67ef44218dc0 changed: #initializeCommentStringMappings
Claus Gittinger <cg@exept.de>
parents: 2924
diff changeset
   210
    "Modified: / 06-09-2011 / 10:46:27 / cg"
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   211
!
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   212
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   213
initializeDefaultCommands
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   214
    "TODO: move this to OS"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   215
2116
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   216
    |unixCommands win32Commands unixPrintCommands win32PrintCommands|
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   217
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   218
    DefaultCommandPerMIMEPerOS := Dictionary new.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   219
    DefaultCommandPerMIMEPerOS at:#unix  put:(unixCommands := Dictionary new).
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   220
    DefaultCommandPerMIMEPerOS at:#win32 put:(win32Commands := Dictionary new).
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   221
2904
bb555534881e changed: #initializeDefaultCommands
Stefan Vogel <sv@exept.de>
parents: 2892
diff changeset
   222
    unixCommands at:'application/x-tar-compressed' put:'gunzip < "%1" | tar tvf -'.
bb555534881e changed: #initializeDefaultCommands
Stefan Vogel <sv@exept.de>
parents: 2892
diff changeset
   223
    unixCommands at:'application/pdf'              put:'acroread "%1"'.
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   224
2141
8decb5cd7766 support html browser under unix
ca
parents: 2118
diff changeset
   225
    OperatingSystem isMSWINDOWSlike ifFalse:[ |cmd|
2142
d9537c2a5c64 support konqueror as html browser
ca
parents: 2141
diff changeset
   226
        cmd := #( firefox konqueror mozilla netscape opera )
2141
8decb5cd7766 support html browser under unix
ca
parents: 2118
diff changeset
   227
                detect:[:aCmd| (OperatingSystem pathOfCommand:aCmd) notEmptyOrNil ]
8decb5cd7766 support html browser under unix
ca
parents: 2118
diff changeset
   228
                ifNone:nil.
8decb5cd7766 support html browser under unix
ca
parents: 2118
diff changeset
   229
8decb5cd7766 support html browser under unix
ca
parents: 2118
diff changeset
   230
        cmd notNil ifTrue:[
2142
d9537c2a5c64 support konqueror as html browser
ca
parents: 2141
diff changeset
   231
            unixCommands at:'text/html' put:(cmd, ' "%1"')       
2141
8decb5cd7766 support html browser under unix
ca
parents: 2118
diff changeset
   232
        ].
8decb5cd7766 support html browser under unix
ca
parents: 2118
diff changeset
   233
    ].
8decb5cd7766 support html browser under unix
ca
parents: 2118
diff changeset
   234
8decb5cd7766 support html browser under unix
ca
parents: 2118
diff changeset
   235
2116
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   236
    DefaultPrintCommandPerMIMEPerOS := Dictionary new.
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   237
    DefaultPrintCommandPerMIMEPerOS at:#unix  put:(unixPrintCommands := Dictionary new).
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   238
    DefaultPrintCommandPerMIMEPerOS at:#win32 put:(win32PrintCommands := Dictionary new).
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   239
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   240
    "/ if you have a good (intelligent) spooler ;-)
2904
bb555534881e changed: #initializeDefaultCommands
Stefan Vogel <sv@exept.de>
parents: 2892
diff changeset
   241
    unixPrintCommands at:'application/pdf'         put:'lpr "%1"'.
2116
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   242
    "/ if not, you may need more...
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   243
    "/ unixPrintCommands at:'application/pdf'         put:'pdfToPS %1 | lpr'.
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   244
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   245
    "/ WIN32 setup is now obsolete - now read through the registry
2096
0cc1b8dbdd5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   246
"/    OperatingSystem isMSWINDOWSlike ifTrue:[
0cc1b8dbdd5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   247
"/        #(
0cc1b8dbdd5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   248
"/            "suffix"    "default"       "mime"
0cc1b8dbdd5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   249
"/            ( 'pdf'     'acrord32 %1'   'application/pdf' )
0cc1b8dbdd5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   250
"/        ) triplesDo:[:suffix :default :mime|
0cc1b8dbdd5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   251
"/            |cmd|
0cc1b8dbdd5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   252
"/
0cc1b8dbdd5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   253
"/            cmd := Win32OperatingSystem::RegistryEntry executableForSuffix:suffix.
0cc1b8dbdd5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   254
"/            cmd isNil ifTrue:[
0cc1b8dbdd5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   255
"/                "assume its in the path"
0cc1b8dbdd5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   256
"/                cmd := default.
0cc1b8dbdd5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   257
"/            ].
0cc1b8dbdd5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   258
"/            win32Commands at:mime put:cmd.
0cc1b8dbdd5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   259
"/        ].
0cc1b8dbdd5b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   260
"/    ].
1979
0612875a95c1 acroread command from registry (win32)
Claus Gittinger <cg@exept.de>
parents: 1925
diff changeset
   261
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   262
    "
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   263
     self initializeDefaultCommands
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   264
    "
1979
0612875a95c1 acroread command from registry (win32)
Claus Gittinger <cg@exept.de>
parents: 1925
diff changeset
   265
0612875a95c1 acroread command from registry (win32)
Claus Gittinger <cg@exept.de>
parents: 1925
diff changeset
   266
    "Modified: / 12-05-2004 / 11:43:23 / cg"
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   267
!
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   268
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   269
initializeFileNameToMimeTypeMapping
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   270
    "initialize wellKnown facts"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   271
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   272
    |types|
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   273
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   274
    FileSuffixToTypeMapping isNil ifTrue:[
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   275
        FileSuffixToTypeMapping := Dictionary new
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   276
    ].
1887
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   277
    TypeToFileSuffixMapping isNil ifTrue:[
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   278
        TypeToFileSuffixMapping := Dictionary new
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   279
    ].
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   280
    FilenameToTypeMapping isNil ifTrue:[
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   281
        FilenameToTypeMapping := Dictionary new.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   282
    ].
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   283
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   284
    types := OrderedCollection new.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   285
    types addAll:self textTypeList.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   286
    types addAll:self imageTypeList.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   287
    types addAll:self videoTypeList.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   288
    types addAll:self audioTypeList.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   289
    types addAll:self applicationTypeList.
1888
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   290
    types addAll:self osSpecificTypeList.
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   291
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   292
    types pairWiseDo:[:suff :typeString|
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   293
        |type|
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   294
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   295
        type := MIMEType fromString:typeString.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   296
        suff isArray ifTrue:[
1887
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   297
            suff do:[:s | FileSuffixToTypeMapping at:s put:type].
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   298
            TypeToFileSuffixMapping at:type put:suff first.
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   299
        ] ifFalse:[
1887
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   300
            FileSuffixToTypeMapping at:suff put:type.
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   301
            TypeToFileSuffixMapping at:type put:suff.
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   302
        ].
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   303
    ].
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   304
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   305
    self miscFilenameList pairWiseDo:[:nm :typeString|
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   306
        |type|
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   307
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   308
        type := MIMEType fromString:typeString.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   309
        nm isArray ifTrue:[
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   310
            nm do:[:s | FilenameToTypeMapping at:s put:type]
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   311
        ] ifFalse:[
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   312
            FilenameToTypeMapping at:nm put:type
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   313
        ]
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   314
    ].
1888
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   315
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   316
    "
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   317
     self initializeFileNameToMimeTypeMapping
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   318
    "
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   319
!
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   320
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   321
initializeImageReaderMappings
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   322
    FileSuffixToImageReaderClassMapping isNil ifTrue:[
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   323
        FileSuffixToImageReaderClassMapping := Dictionary new
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   324
    ].
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   325
    "MIME" TypeToImageReaderClassMapping isNil ifTrue:[
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   326
        TypeToImageReaderClassMapping := Dictionary new
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   327
    ].
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   328
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   329
    "/ setup mimeType to image reader class mapping ...
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   330
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   331
    TypeToImageReaderClassMapping at:'image/jpeg' put:JPEGReader.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   332
    TypeToImageReaderClassMapping at:'image/gif'  put:GIFReader.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   333
    TypeToImageReaderClassMapping at:'image/tiff' put:TIFFReader.
2710
29d76b5bb816 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2588
diff changeset
   334
    TypeToImageReaderClassMapping at:'image/png'  put:PNGReader.
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   335
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   336
    "/ setup suffix to image reader class mapping ...
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   337
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   338
    FileSuffixToImageReaderClassMapping at:'jpg'  put:JPEGReader.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   339
    FileSuffixToImageReaderClassMapping at:'gif'  put:GIFReader.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   340
    FileSuffixToImageReaderClassMapping at:'tif'  put:TIFFReader.
2710
29d76b5bb816 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2588
diff changeset
   341
    FileSuffixToImageReaderClassMapping at:'png'  put:PNGReader.
2570
a089fc8372f1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   342
a089fc8372f1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   343
    WindowsIconReader notNil ifTrue:[
a089fc8372f1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   344
        TypeToImageReaderClassMapping at:'image/bmp'  put:WindowsIconReader.
a089fc8372f1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   345
        FileSuffixToImageReaderClassMapping at:'bmp'  put:WindowsIconReader.
a089fc8372f1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2535
diff changeset
   346
    ].
2298
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
   347
!
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
   348
2491
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   349
initializeParenthesisSpecMappings
2298
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
   350
    |spec|
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
   351
2491
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   352
    TypeToParenthesisSpecMapping := Dictionary new.
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   353
    SuffixToParenthesisSpecMapping := Dictionary new.
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   354
    
2298
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
   355
    "/ ST/X spec
2491
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   356
    
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   357
    spec := IdentityDictionary new.
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   358
    spec at:#open put:#( $( $[ ${ ).
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   359
    spec at:#close put:#( $) $] $} ).
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   360
    spec at:#ignore put:#( $' $" '$[' '$]' '${' '$)' ).
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   361
    spec at:#eolComment put:'"/'.
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   362
    TypeToParenthesisSpecMapping at:'application/x-smalltalk-source' put:spec.
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   363
    
2479
40a05c259915 c# mime type
Claus Gittinger <cg@exept.de>
parents: 2432
diff changeset
   364
    "/ XML & HTML
2491
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   365
    
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   366
    spec := IdentityDictionary new.
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   367
    spec at:#open put:#( $< ).
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   368
    spec at:#close put:#( $> ).
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   369
    spec at:#ignore put:#( $' $" '$[' '$]' '${' '$)' ).
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   370
    #( 'text/html' 'text/xml' 'application/xml' ) do:[:eachXMLType | 
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   371
        TypeToParenthesisSpecMapping at:eachXMLType put:spec
2298
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
   372
    ].
2491
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   373
    
2479
40a05c259915 c# mime type
Claus Gittinger <cg@exept.de>
parents: 2432
diff changeset
   374
    "/ ANSI-c, Java, C#
2491
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   375
    
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   376
    spec := IdentityDictionary new.
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   377
    spec at:#open put:#( $( $[ ${ ).
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   378
    spec at:#close put:#( $) $] $} ).
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   379
    spec at:#ignore put:#( $' $" ).
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   380
    spec at:#eolComment put:'//'.
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   381
    TypeToParenthesisSpecMapping at:'application/x-c-source' put:spec.
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   382
    TypeToParenthesisSpecMapping at:'application/x-cpp-source' put:spec.
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   383
    TypeToParenthesisSpecMapping at:'application/x-csharp-source' put:spec.
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   384
    TypeToParenthesisSpecMapping at:'application/x-java-source' put:spec.
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   385
    TypeToParenthesisSpecMapping at:'application/x-javascript' put:spec.
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   386
    
2298
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
   387
    "/ Lisp
2491
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   388
    
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   389
    spec := IdentityDictionary new.
3039
1a8ca229615f class: MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
   390
    spec at:#open put:#( $( $[ ).
1a8ca229615f class: MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
   391
    spec at:#close put:#( $) $] ).
2491
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   392
    spec at:#ignore put:#( $" ).
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   393
    spec at:#eolComment put:';'.
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   394
    TypeToParenthesisSpecMapping at:'application/x-lisp-source' put:spec.
2298
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
   395
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
   396
    "Created: / 10-04-2007 / 15:16:37 / cg"
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   397
! !
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   398
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   399
!MIMETypes class methodsFor:'initialization-lists'!
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   400
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   401
applicationCompressorsAndArchiveTypeList
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   402
    ^ #(
1890
ccf118af49ce tar.bz2 suffix
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   403
        'tar'                       'application/x-tar'
ccf118af49ce tar.bz2 suffix
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   404
        'gtar'                      'application/x-gtar'
1891
1b53c21c64c5 tar.bz2 suffix
Claus Gittinger <cg@exept.de>
parents: 1890
diff changeset
   405
        ('tgz' 'tar.gz')            'application/x-tar-gzip-compressed'   "/ 'application/x-tar-compressed'
1b53c21c64c5 tar.bz2 suffix
Claus Gittinger <cg@exept.de>
parents: 1890
diff changeset
   406
        ('tar.bz2')                 'application/x-tar-bzip2-compressed'
1890
ccf118af49ce tar.bz2 suffix
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   407
        'zip'                       'application/x-zip-compressed'
ccf118af49ce tar.bz2 suffix
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   408
        'bz2'                       'application/x-bzip2-compressed'
ccf118af49ce tar.bz2 suffix
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   409
        ('gz' 'z')                  'application/x-gzip-compressed'
ccf118af49ce tar.bz2 suffix
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   410
        'cpio'                      'application/x-cpio'
ccf118af49ce tar.bz2 suffix
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   411
        'shar'                      'application/x-shar'
ccf118af49ce tar.bz2 suffix
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   412
        'jar'                       'application/java-archive'
ccf118af49ce tar.bz2 suffix
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   413
        'sar'                       'application/x-squeak-archive'
ccf118af49ce tar.bz2 suffix
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   414
        'sit'                       'application/x-stuffit'
ccf118af49ce tar.bz2 suffix
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   415
        'hqx'                       'application/mac-binhex40'
ccf118af49ce tar.bz2 suffix
Claus Gittinger <cg@exept.de>
parents: 1889
diff changeset
   416
        'cpt'                       'application/mac-compactpro'
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   417
    )
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   418
!
645
97e83ab4d246 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 643
diff changeset
   419
1609
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   420
applicationMiscTypeList
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   421
    "misc applications"
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   422
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   423
    ^ #(
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   424
        ('a' 'o' 'obj' )                        'application/binary'
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   425
        'a'                                     'application/library'
2968
bcd13537812b changed: #applicationMiscTypeList
sr
parents: 2942
diff changeset
   426
        ('lic')                                 'application/license'
1609
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   427
        ('dll' 'so')                            'application/shared-library'
2486
42063a7fc3db mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
   428
42063a7fc3db mimeType: x-expecco-testSuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
   429
        ('ets')                                 'application/x-expecco-testsuite'
2489
b891d96fd496 elf extension: x-expecco-logfile
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
   430
        ('elf')                                 'application/x-expecco-logfile'
2886
22b48a4da285 comment/format in: #initializeFileNameToMimeTypeMapping
sr
parents: 2830
diff changeset
   431
        ('expeccolicense')                      'application/x-expecco-license'
2888
a0bd24f746c0 changed: #applicationMiscTypeList
sr
parents: 2886
diff changeset
   432
        ('expeccopatch')                        'application/x-expecco-patch'
1609
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   433
    )
2886
22b48a4da285 comment/format in: #initializeFileNameToMimeTypeMapping
sr
parents: 2830
diff changeset
   434
2968
bcd13537812b changed: #applicationMiscTypeList
sr
parents: 2942
diff changeset
   435
    "Modified: / 03-11-2011 / 10:42:28 / sr"
1609
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   436
!
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   437
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   438
applicationProgLangTypeList
3020
3f9c74ff0975 changed: #applicationProgLangTypeList
Claus Gittinger <cg@exept.de>
parents: 3014
diff changeset
   439
    "applications for programming languages"
713
548898fdd1dc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 663
diff changeset
   440
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   441
    ^ #(
1609
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   442
        ('st' 'cls' 'rc')            'application/x-smalltalk-source'
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   443
        'sif'                        'application/x-smalltalk-source-sif'
1668
070264d3a087 added dolphin package
Claus Gittinger <cg@exept.de>
parents: 1666
diff changeset
   444
        'pac'                        'application/x-smalltalk-dolphin-package'
1778
6a019cc68896 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   445
6a019cc68896 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   446
        'sts'                        'application/x-squeak-source'
6a019cc68896 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   447
        'pr'                         'application/x-squeak-project'
6a019cc68896 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   448
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   449
        'c'                          'application/x-c-source'
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   450
        ('cc' 'cpp')                 'application/x-cpp-source'
2479
40a05c259915 c# mime type
Claus Gittinger <cg@exept.de>
parents: 2432
diff changeset
   451
        'cs'                         'application/x-csharp-source'
1609
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   452
        ('h' 'hi')                   'application/x-c-header'
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   453
        ('js' 'mocha')               'application/x-javascript'
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   454
        ('java' 'jav')               'application/x-java-source'
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   455
        'sh'                         'application/x-sh'
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   456
        'csh'                        'application/x-csh'
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   457
        'tcl'                        'application/x-tcl'
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   458
        'pl'                         'application/x-perl'
3020
3f9c74ff0975 changed: #applicationProgLangTypeList
Claus Gittinger <cg@exept.de>
parents: 3014
diff changeset
   459
        'dart'                       'application/x-dart'
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   460
        'mak'                        'application/x-make'
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   461
        'bat'                        'application/x-batch-script'
3008
aadfac4bdc84 changed:
Claus Gittinger <cg@exept.de>
parents: 2970
diff changeset
   462
        ('asn1' 'x409' 'gdmo' 'gdm') 'application/x-asn1-source'
aadfac4bdc84 changed:
Claus Gittinger <cg@exept.de>
parents: 2970
diff changeset
   463
2912
f3466ea0810b changed: #applicationProgLangTypeList
Claus Gittinger <cg@exept.de>
parents: 2911
diff changeset
   464
        ('lisp' 'lsp' 'scm' 'ss' 
f3466ea0810b changed: #applicationProgLangTypeList
Claus Gittinger <cg@exept.de>
parents: 2911
diff changeset
   465
         'arc' 'cl' 'brg')           'application/x-lisp-source'
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   466
    )
2298
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
   467
3020
3f9c74ff0975 changed: #applicationProgLangTypeList
Claus Gittinger <cg@exept.de>
parents: 3014
diff changeset
   468
    "Modified (comment): / 21-08-2012 / 20:55:13 / cg"
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   469
!
1561
942de18a3e3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1560
diff changeset
   470
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   471
applicationTextTypeList
1606
158c10a36736 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1604
diff changeset
   472
    "text applications"
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   473
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   474
    ^ #(
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   475
        ('ps' 'eps')                 'application/postscript'
1778
6a019cc68896 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   476
        "/ 'ai'                         'application/postscript'
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   477
        'pdf'                        'application/pdf'
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   478
        'rtf'                        'application/rtf'
1778
6a019cc68896 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   479
        "/ 'rtf'                        'text/rtf'            ????
3008
aadfac4bdc84 changed:
Claus Gittinger <cg@exept.de>
parents: 2970
diff changeset
   480
        'ics'                        'text/calendar'
aadfac4bdc84 changed:
Claus Gittinger <cg@exept.de>
parents: 2970
diff changeset
   481
        'doc'                        'application/ms-word-document'
1778
6a019cc68896 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   482
        "/ 'doc'                        'application/winword'
6a019cc68896 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   483
        'swf'                        'application/x-shockwave-flash'
6a019cc68896 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   484
        ('ppt' 'ppz' 'pot' 'pps')    'application/mspowerpoint'
2028
5d67d14ad4a0 slk type added
Michael Beyl <mb@exept.de>
parents: 2024
diff changeset
   485
        'xls'                        'application/x-excel'   
5d67d14ad4a0 slk type added
Michael Beyl <mb@exept.de>
parents: 2024
diff changeset
   486
        'slk'                        'application/vnd.ms-excel'
2911
7afaf1fdae8b comment/format in: #mimeTypeForFilename:
Claus Gittinger <cg@exept.de>
parents: 2904
diff changeset
   487
        'txt'                        'text/plain'
2970
8b91ec204044 comment/format in: #initialize
Claus Gittinger <cg@exept.de>
parents: 2968
diff changeset
   488
        'xlsx'                       'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   489
    )
2911
7afaf1fdae8b comment/format in: #mimeTypeForFilename:
Claus Gittinger <cg@exept.de>
parents: 2904
diff changeset
   490
3008
aadfac4bdc84 changed:
Claus Gittinger <cg@exept.de>
parents: 2970
diff changeset
   491
    "Modified: / 26-05-2012 / 15:27:30 / cg"
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   492
!
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   493
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   494
applicationTypeList
1606
158c10a36736 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1604
diff changeset
   495
    "applications"
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   496
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   497
    |typeList|                            
1180
c3309b30d14f code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   498
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   499
    typeList := OrderedCollection new.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   500
    typeList addAll:self applicationProgLangTypeList.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   501
    typeList addAll:self applicationTextTypeList.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   502
    typeList addAll:self applicationCompressorsAndArchiveTypeList.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   503
    typeList addAll:self applicationMiscTypeList.
1616
f07466809515 add binary file extensions
penk
parents: 1612
diff changeset
   504
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   505
    ^ typeList
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   506
!
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   507
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   508
audioTypeList
1606
158c10a36736 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1604
diff changeset
   509
    "audio formats ..."
1180
c3309b30d14f code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   510
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   511
    ^ #(
1720
cca50de2e8e4 change x-png to png
penk
parents: 1716
diff changeset
   512
        ('au' 'snd')            'audio/basic'
1778
6a019cc68896 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   513
        ('ra')                  'audio/x-realaudio'
6a019cc68896 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   514
        ('ram' 'rm')            'audio/x-pn-realaudio'
1888
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   515
"/ cg: see unixSpecific / windowsSpecific
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   516
"/        'rpm'                   'audio/x-pn-realaudio-plugin'
3008
aadfac4bdc84 changed:
Claus Gittinger <cg@exept.de>
parents: 2970
diff changeset
   517
        ('mpa' 'mpega' 'mpga')  'audio/mpeg'
1778
6a019cc68896 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   518
        "/ 'mp3'                   'audio/x-mp3'
6a019cc68896 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   519
        ('mp3' 'mp2')           'audio/mpeg'
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   520
        'wav'                   'audio/x-wav'
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   521
        ('aif' 'aiff' 'aifc')   'audio/x-aiff'
1778
6a019cc68896 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   522
        ('midi' 'mid')          'audio/midi'
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   523
    )
3008
aadfac4bdc84 changed:
Claus Gittinger <cg@exept.de>
parents: 2970
diff changeset
   524
aadfac4bdc84 changed:
Claus Gittinger <cg@exept.de>
parents: 2970
diff changeset
   525
    "Modified: / 26-05-2012 / 15:23:45 / cg"
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   526
!
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   527
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   528
imageTypeList
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   529
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   530
    ^ #(
1180
c3309b30d14f code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   531
        "/ image formats ...
c3309b30d14f code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   532
1216
26fe79e724d0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1188
diff changeset
   533
        ('jpg' 'jpeg')  'image/jpeg'
1188
bea6424548e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
   534
        'gif'           'image/gif'
bea6424548e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
   535
        ('tif' 'tiff')  'image/tiff'
bea6424548e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
   536
        'xbm'           'image/x-xbitmap'
bea6424548e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
   537
        'xpm'           'image/x-xpixmap'
1720
cca50de2e8e4 change x-png to png
penk
parents: 1716
diff changeset
   538
        'png'           'image/png'
1188
bea6424548e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
   539
        'pcd'           'image/x-photo-cd'
bea6424548e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
   540
        'bmp'           'image/x-MS-bmp'
bea6424548e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
   541
        'rgb'           'image/x-rgb'
bea6424548e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
   542
        'ppm'           'image/x-portable-pixmap'
bea6424548e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
   543
        'pgm'           'image/x-portable-graymap'
bea6424548e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
   544
        'pbm'           'image/x-portable-bitmap'
bea6424548e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
   545
        'pnm'           'image/x-portable-anymap'
bea6424548e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
   546
        'xwd'           'image/x-xwindowdump'
bea6424548e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1180
diff changeset
   547
        'ras'           'image/x-cmu-raster'
1216
26fe79e724d0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1188
diff changeset
   548
        'tga'           'image/x-targa'
2020
d5c5d7928433 add 'image/x-ico' for *.ico files
penk
parents: 1981
diff changeset
   549
        'ico'           'image/x-ico'
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   550
    ) 
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   551
!
1180
c3309b30d14f code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   552
1609
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   553
miscFilenameList
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   554
    "other formats (not by suffix, but by fileName isnstead) ..."
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   555
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   556
    ^ #(
2113
65cbfeee886d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
   557
        ('makefile' 'make.proto' 'make.spec' 'nt.mak')  'application/x-make'
2830
2945a046a7f5 changed: #miscFilenameList
Claus Gittinger <cg@exept.de>
parents: 2820
diff changeset
   558
        ('exe' 'bin' 'com')                             'application/octet-stream'
2113
65cbfeee886d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
   559
        ('class')                                       'application/octet-stream'
2375
723e3325bad1 top file format
Claus Gittinger <cg@exept.de>
parents: 2298
diff changeset
   560
        ('top')                                         'application/x-waltop-digital-notepad'
1609
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   561
    )
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   562
!
090ee7aa4cab *** empty log message ***
penk
parents: 1606
diff changeset
   563
1888
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   564
osSpecificTypeList
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   565
    OperatingSystem isMSWINDOWSlike ifTrue:[
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   566
        ^ self windowsSpecificTypeList
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   567
    ].
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   568
    ^ self unixSpecificTypeList
2023
70c535a959be *** empty log message ***
penk
parents: 2020
diff changeset
   569
70c535a959be *** empty log message ***
penk
parents: 2020
diff changeset
   570
"
70c535a959be *** empty log message ***
penk
parents: 2020
diff changeset
   571
    self osSpecificTypeList
70c535a959be *** empty log message ***
penk
parents: 2020
diff changeset
   572
"
1888
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   573
!
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   574
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   575
textTypeList
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   576
   "/ misc text ...
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   577
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   578
    ^ #(
1887
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   579
        ('html' 'htm' 'shtml')  'text/html'
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   580
        ('txt' 'text')          'text/plain'
1680
d34932ed0e86 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1668
diff changeset
   581
        'xml'                   'text/xml'
1777
5879ec563fc1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1775
diff changeset
   582
        'css'                   'text/css'
2432
8dcb56eb1e89 csv icon
Claus Gittinger <cg@exept.de>
parents: 2375
diff changeset
   583
        'csv'                   'text/csv'
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   584
    )
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   585
!
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   586
1888
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   587
unixSpecificTypeList
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   588
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   589
    ^ #(
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   590
"/ cg: RPM is 'audio/x-pn-realaudio-plugin' for WIN32
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   591
"/     and 'application/x-rpm' for Unix
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   592
        'rpm'                   'application/x-rpm'
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   593
    )
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   594
!
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   595
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   596
videoTypeList
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   597
    "/ video formats ...
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   598
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   599
    ^ #(
1720
cca50de2e8e4 change x-png to png
penk
parents: 1716
diff changeset
   600
        ('qt' 'mov' 'moov')                'video/quicktime'
cca50de2e8e4 change x-png to png
penk
parents: 1716
diff changeset
   601
        ('mpv' 'mpegv' 'mpg' 'mpeg' 'mpe') 'video/mpeg'
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   602
        'movie'                            'video/x-sgi-movie'
1820
7817c4809af7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1819
diff changeset
   603
        ('avi' 'wmv' 'asf')                'video/x-msvideo'
1604
0c678133dc4b new class for mimeType instances
penk
parents: 1593
diff changeset
   604
        ('mpv2' 'mp2v' 'mp2' 'mpeg2')      'video/x-mpeg2'
1680
d34932ed0e86 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1668
diff changeset
   605
        'rm'                               'application/vnd.rn-realmedia'
d34932ed0e86 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1668
diff changeset
   606
        'rv'                               'video/x-pn-realvideo'
1778
6a019cc68896 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1777
diff changeset
   607
   )
1888
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   608
!
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   609
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   610
windowsSpecificTypeList
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   611
    ^ #(
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   612
"/ cg: RPM is 'audio/x-pn-realaudio-plugin' for WIN32
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   613
"/     and 'application/x-rpm' for Unix
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   614
        'rpm'                   'audio/x-pn-realaudio-plugin'
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   615
    )
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   616
! !
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   617
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   618
!MIMETypes class methodsFor:'obsolete'!
1489
9e339e123bfa commentStrings: added ifUnknown-argument
tm
parents: 1475
diff changeset
   619
2491
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   620
defaultCommandForMimeType:mimeType
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   621
    <resource: #obsolete>
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   622
    self obsoleteMethodWarning:'use #defaultCommandTemplateToOpenMimeType:'.
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   623
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   624
    ^ self defaultCommandTemplateToOpenMimeType:mimeType
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   625
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   626
    "
2758
66e62ceecb67 comment/format in: #defaultCommandForMimeType:
Claus Gittinger <cg@exept.de>
parents: 2724
diff changeset
   627
     MIMETypes defaultCommandTemplateToOpenMimeType:'application/pdf' 
2491
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   628
    "
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   629
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   630
    "Created: / 12-05-2004 / 11:09:22 / cg"
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   631
    "Modified: / 12-05-2004 / 11:16:53 / cg"
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   632
!
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
   633
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   634
fontForCharset:aCharSetName
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   635
    "return the font-encoding for an iso-charset"
1489
9e339e123bfa commentStrings: added ifUnknown-argument
tm
parents: 1475
diff changeset
   636
1981
52b15b1e90b6 Mark obsolete methods
Stefan Vogel <sv@exept.de>
parents: 1979
diff changeset
   637
    <resource:#obsolete>
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   638
    self obsoleteMethodWarning:'use FontDescription >> fontNamePatternForCharset:'.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   639
    ^ FontDescription fontNamePatternForCharset:aCharSetName.
1489
9e339e123bfa commentStrings: added ifUnknown-argument
tm
parents: 1475
diff changeset
   640
9e339e123bfa commentStrings: added ifUnknown-argument
tm
parents: 1475
diff changeset
   641
    "
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   642
     MIMETypes fontForCharset:'iso2022-jp'       
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   643
     MIMETypes fontForCharset:'euc-jp'     
1472
bef5798d367d comment strings
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   644
    "
bef5798d367d comment strings
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   645
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   646
    "Modified: / 1.8.1998 / 17:00:57 / cg"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   647
! !
1472
bef5798d367d comment strings
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   648
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   649
!MIMETypes class methodsFor:'queries'!
1472
bef5798d367d comment strings
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
   650
647
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   651
defineImageType:mimeType suffix:aSuffix reader:aReaderClass
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   652
    "register an image reader."
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   653
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   654
    aSuffix notNil ifTrue:[
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   655
        self imageReaderForSuffix:aSuffix put:aReaderClass.
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   656
    ].
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   657
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   658
    mimeType notNil ifTrue:[
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   659
        self imageReaderForType:mimeType put:aReaderClass
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   660
    ].
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   661
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   662
    (aSuffix notNil and:[mimeType notNil]) ifTrue:[
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   663
        self mimeTypeForSuffix:aSuffix put:mimeType
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   664
    ].
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   665
!
6f26c76aa0c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 646
diff changeset
   666
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   667
fileSuffixToImageReaderMapping
1021
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   668
    "return the suffix-to-imageReader mapping"
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   669
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   670
    ^ FileSuffixToImageReaderClassMapping ? #()
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   671
1021
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   672
    "Modified: / 1.8.1998 / 17:00:11 / cg"
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   673
!
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   674
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   675
imageFileSuffixes
1021
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   676
    "return a collection with known file suffixes"
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   677
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   678
    FileSuffixToImageReaderClassMapping isNil ifTrue:[^ #()].
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   679
    ^ FileSuffixToImageReaderClassMapping keys
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   680
1021
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   681
    "Created: / 30.6.1997 / 22:04:48 / cg"
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   682
    "Modified: / 1.8.1998 / 17:01:26 / cg"
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   683
!
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   684
3014
e6d9a204da08 comment/format in: #mimeTypeForFilename:
Claus Gittinger <cg@exept.de>
parents: 3012
diff changeset
   685
mimeTypeForFilename:filenameOrString
1272
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   686
    "given a filename, return the mime-type or nil, if unknown"
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   687
1780
ba94d562efe8 support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   688
    |type filename lcFilename suff suff2|
1272
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   689
3014
e6d9a204da08 comment/format in: #mimeTypeForFilename:
Claus Gittinger <cg@exept.de>
parents: 3012
diff changeset
   690
    filename := filenameOrString asFilename.
1474
bd86cf0c1a84 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1473
diff changeset
   691
bd86cf0c1a84 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1473
diff changeset
   692
    lcFilename := filename baseName asLowercase.
1272
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   693
    type := FilenameToTypeMapping at:lcFilename ifAbsent:nil.
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   694
    type isNil ifTrue:[
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   695
        "/ allow for fallback ...
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   696
        type := OperatingSystem mimeTypeForFilename:lcFilename.
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   697
        "/ the special value #unknown is returned as nil;
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   698
        "/ this avoids constant retry if a mimeType is not known in
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   699
        "/ the OS.
1275
cf421c7dfeec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
   700
"/        type isNil ifTrue:[
cf421c7dfeec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
   701
"/            FilenameToTypeMapping at:lcFilename put:#unknown
cf421c7dfeec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1274
diff changeset
   702
"/        ].
1272
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   703
    ].
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   704
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   705
    type == #unknown ifTrue:[
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   706
        type := nil.
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   707
    ].
1273
7a52d4bcdb10 filenames mime query falls back to suffix query.
Claus Gittinger <cg@exept.de>
parents: 1272
diff changeset
   708
7a52d4bcdb10 filenames mime query falls back to suffix query.
Claus Gittinger <cg@exept.de>
parents: 1272
diff changeset
   709
    type isNil ifTrue:[
1473
876caa979b7e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1472
diff changeset
   710
        suff := filename suffix.
1273
7a52d4bcdb10 filenames mime query falls back to suffix query.
Claus Gittinger <cg@exept.de>
parents: 1272
diff changeset
   711
        suff size ~~ 0 ifTrue:[
1780
ba94d562efe8 support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   712
            "/ sigh - special code for multiple-suffices...
ba94d562efe8 support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   713
            "/ .tar.gz -> tgz
ba94d562efe8 support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   714
            suff2 := filename withoutSuffix suffix.
ba94d562efe8 support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   715
            suff2 size > 0 ifTrue:[
ba94d562efe8 support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   716
                type := self mimeTypeForSuffix:(suff2 , '.' , suff).
ba94d562efe8 support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   717
            ].
ba94d562efe8 support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   718
            type isNil ifTrue:[
ba94d562efe8 support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   719
                type := self mimeTypeForSuffix:suff
ba94d562efe8 support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   720
            ].
1273
7a52d4bcdb10 filenames mime query falls back to suffix query.
Claus Gittinger <cg@exept.de>
parents: 1272
diff changeset
   721
        ]
7a52d4bcdb10 filenames mime query falls back to suffix query.
Claus Gittinger <cg@exept.de>
parents: 1272
diff changeset
   722
    ].
7a52d4bcdb10 filenames mime query falls back to suffix query.
Claus Gittinger <cg@exept.de>
parents: 1272
diff changeset
   723
1272
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   724
    ^ type
1780
ba94d562efe8 support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   725
ba94d562efe8 support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   726
    "
2820
98e9403031ad comment/format
Claus Gittinger <cg@exept.de>
parents: 2758
diff changeset
   727
     MIMETypes mimeTypeForFilename:'typeinst.dvi'      
98e9403031ad comment/format
Claus Gittinger <cg@exept.de>
parents: 2758
diff changeset
   728
     MIMETypes mimeTypeForFilename:'foo.tar'
98e9403031ad comment/format
Claus Gittinger <cg@exept.de>
parents: 2758
diff changeset
   729
     MIMETypes mimeTypeForFilename:'foo.tgz'
98e9403031ad comment/format
Claus Gittinger <cg@exept.de>
parents: 2758
diff changeset
   730
     MIMETypes mimeTypeForFilename:'foo.tar.gz'
2911
7afaf1fdae8b comment/format in: #mimeTypeForFilename:
Claus Gittinger <cg@exept.de>
parents: 2904
diff changeset
   731
     MIMETypes mimeTypeForFilename:'foo.txt'   
1780
ba94d562efe8 support double-suffix such as '.tar.gz'
Claus Gittinger <cg@exept.de>
parents: 1779
diff changeset
   732
    "
2911
7afaf1fdae8b comment/format in: #mimeTypeForFilename:
Claus Gittinger <cg@exept.de>
parents: 2904
diff changeset
   733
7afaf1fdae8b comment/format in: #mimeTypeForFilename:
Claus Gittinger <cg@exept.de>
parents: 2904
diff changeset
   734
    "Modified: / 10-05-2011 / 11:55:18 / cg"
3014
e6d9a204da08 comment/format in: #mimeTypeForFilename:
Claus Gittinger <cg@exept.de>
parents: 3012
diff changeset
   735
    "Modified (format): / 28-07-2012 / 09:39:15 / cg"
1272
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   736
!
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   737
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   738
mimeTypeForFilename:filename put:mimeType
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   739
    "register a mime type for a filename"
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   740
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   741
    FilenameToTypeMapping isNil ifTrue:[
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   742
        FilenameToTypeMapping := Dictionary new
91ba4078b690 additional mime table for filenames without suffix.
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   743
    ].
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   744
    FilenameToTypeMapping at:filename put:(MIMEType fromString:mimeType asLowercase)
1611
5804b7d63ee8 checkin from browser
penk
parents: 1610
diff changeset
   745
!
5804b7d63ee8 checkin from browser
penk
parents: 1610
diff changeset
   746
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   747
mimeTypeForSuffix:suffix
1021
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   748
    "given a file suffix, return the mime-type"
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   749
1180
c3309b30d14f code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   750
    |type lcSuffix|
c3309b30d14f code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   751
1837
penk
parents: 1820
diff changeset
   752
    suffix = LastSuffix ifTrue:[
penk
parents: 1820
diff changeset
   753
        ^ LastType
penk
parents: 1820
diff changeset
   754
    ].
penk
parents: 1820
diff changeset
   755
1180
c3309b30d14f code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   756
    lcSuffix := suffix asLowercase.
1837
penk
parents: 1820
diff changeset
   757
    type := FileSuffixToTypeMapping at:lcSuffix ifAbsent:nil.
penk
parents: 1820
diff changeset
   758
    type isNil ifTrue:[
penk
parents: 1820
diff changeset
   759
        "/ allow for fallback ...
penk
parents: 1820
diff changeset
   760
        type := OperatingSystem mimeTypeForSuffix:lcSuffix.
penk
parents: 1820
diff changeset
   761
        "/ the special value #unknown is returned as nil;
penk
parents: 1820
diff changeset
   762
        "/ this avoids constant retry if a mimeType is not known in the OS.
penk
parents: 1820
diff changeset
   763
penk
parents: 1820
diff changeset
   764
        type := type ? #unknown.
penk
parents: 1820
diff changeset
   765
        FileSuffixToTypeMapping at:lcSuffix put:type.
1180
c3309b30d14f code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   766
    ].
1837
penk
parents: 1820
diff changeset
   767
1180
c3309b30d14f code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   768
    type == #unknown ifTrue:[
1837
penk
parents: 1820
diff changeset
   769
        type := nil.
1180
c3309b30d14f code cleanup & added mimeType aquire fallBack via OS
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   770
    ].
1840
19123ded64e3 mime Types have to MIMEType instance
penk
parents: 1837
diff changeset
   771
    type notNil ifTrue:[
19123ded64e3 mime Types have to MIMEType instance
penk
parents: 1837
diff changeset
   772
        LastSuffix := suffix.
19123ded64e3 mime Types have to MIMEType instance
penk
parents: 1837
diff changeset
   773
        LastType := MIMEType fromString:type.
19123ded64e3 mime Types have to MIMEType instance
penk
parents: 1837
diff changeset
   774
        ^ LastType
19123ded64e3 mime Types have to MIMEType instance
penk
parents: 1837
diff changeset
   775
    ].
1841
b7ff9829e4b3 return value should be undefined if type isNil
penk
parents: 1840
diff changeset
   776
    ^ type
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   777
1666
2fe4fb7be12c added xml type
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
   778
    "
1840
19123ded64e3 mime Types have to MIMEType instance
penk
parents: 1837
diff changeset
   779
     self mimeTypeForSuffix:'gif'     
1888
ef0f346b8f43 rpm suffix is RPM-package under unix (realplayer under windows)
Claus Gittinger <cg@exept.de>
parents: 1887
diff changeset
   780
     self mimeTypeForSuffix:'rpm'     
2891
9aee109c1c1c changed:
Claus Gittinger <cg@exept.de>
parents: 2888
diff changeset
   781
     self mimeTypeForSuffix:'zip'     
1666
2fe4fb7be12c added xml type
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
   782
    "
2fe4fb7be12c added xml type
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
   783
2891
9aee109c1c1c changed:
Claus Gittinger <cg@exept.de>
parents: 2888
diff changeset
   784
    "Created: / 30-06-1997 / 21:55:51 / cg"
9aee109c1c1c changed:
Claus Gittinger <cg@exept.de>
parents: 2888
diff changeset
   785
    "Modified: / 14-02-2011 / 17:14:34 / cg"
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   786
!
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   787
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   788
mimeTypeForSuffix:suffix put:mimeType
1021
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   789
    "register a mime type for a file suffix"
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   790
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   791
    FileSuffixToTypeMapping isNil ifTrue:[
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   792
        FileSuffixToTypeMapping := Dictionary new
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   793
    ].
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   794
    FileSuffixToTypeMapping at:suffix put:mimeType asLowercase
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   795
1021
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   796
    "Created: / 30.6.1997 / 21:56:20 / cg"
004c324dc31a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   797
    "Modified: / 1.8.1998 / 17:03:18 / cg"
1593
4bf2544435a9 add class getter method for FileSuffixToTypemapping
penk
parents: 1561
diff changeset
   798
!
4bf2544435a9 add class getter method for FileSuffixToTypemapping
penk
parents: 1561
diff changeset
   799
4bf2544435a9 add class getter method for FileSuffixToTypemapping
penk
parents: 1561
diff changeset
   800
mimeTypeForSuffixMapping
4bf2544435a9 add class getter method for FileSuffixToTypemapping
penk
parents: 1561
diff changeset
   801
4bf2544435a9 add class getter method for FileSuffixToTypemapping
penk
parents: 1561
diff changeset
   802
    ^ FileSuffixToTypeMapping
1611
5804b7d63ee8 checkin from browser
penk
parents: 1610
diff changeset
   803
!
5804b7d63ee8 checkin from browser
penk
parents: 1610
diff changeset
   804
2023
70c535a959be *** empty log message ***
penk
parents: 2020
diff changeset
   805
mimeTypeFromString:mimeTypeString
70c535a959be *** empty log message ***
penk
parents: 2020
diff changeset
   806
    "given a mime-type for a string"
70c535a959be *** empty log message ***
penk
parents: 2020
diff changeset
   807
70c535a959be *** empty log message ***
penk
parents: 2020
diff changeset
   808
     ^ MIMEType fromString:mimeTypeString
70c535a959be *** empty log message ***
penk
parents: 2020
diff changeset
   809
70c535a959be *** empty log message ***
penk
parents: 2020
diff changeset
   810
    "
70c535a959be *** empty log message ***
penk
parents: 2020
diff changeset
   811
     self mimeTypeFromString:'image/gif' 
2487
eaa224da42fa mimeType: x-expecco-testsuite (extension: ets)
Claus Gittinger <cg@exept.de>
parents: 2486
diff changeset
   812
     self mimeTypeFromString:'application/x-expecco-testsuite' 
2023
70c535a959be *** empty log message ***
penk
parents: 2020
diff changeset
   813
    "
70c535a959be *** empty log message ***
penk
parents: 2020
diff changeset
   814
!
70c535a959be *** empty log message ***
penk
parents: 2020
diff changeset
   815
1611
5804b7d63ee8 checkin from browser
penk
parents: 1610
diff changeset
   816
mimeTypeOfContents:filename
5804b7d63ee8 checkin from browser
penk
parents: 1610
diff changeset
   817
    "given a filename, scan the contents, return the mime-type or nil, if unknown"
5804b7d63ee8 checkin from browser
penk
parents: 1610
diff changeset
   818
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   819
    |typeString|
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   820
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   821
    typeString := filename mimeTypeOfContents.
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   822
    typeString isNil ifTrue:[^ nil].
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   823
    ^ MIMEType fromString:typeString.
1887
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   824
!
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   825
2582
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   826
mimeTypeOfData:someData
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   827
    "this tries to guess the mime type of contents of someData.
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   828
     Returns nil, if unknown.
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   829
     This is done using some heuristics, and may need some improvement"
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   830
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   831
    |buffer lcBuffer size idx idx2|
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   832
2583
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
   833
    someData isEmptyOrNil ifTrue:[^ nil].
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
   834
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
   835
    size := 2048 min:someData size.
2582
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   836
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   837
    "/ read some data from the file ...
2583
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
   838
    buffer := (someData copyTo:size) asString.
2582
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   839
    lcBuffer := buffer asLowercase.
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   840
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   841
    (idx := lcBuffer findString:'mimetype:') ~~ 0 ifTrue:[
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   842
        idx := idx + 'mimetype:' size.
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   843
        idx := lcBuffer indexOfNonSeparatorStartingAt:idx.
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   844
        idx2 := lcBuffer indexOfSeparatorStartingAt:idx.
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   845
        idx2 > idx ifTrue:[
2583
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
   846
            ^ MIMEType fromString:(lcBuffer copyFrom:idx to:idx2-1)
2582
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   847
        ].
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   848
    ].
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   849
2924
808feaad1bb3 changed: #mimeTypeOfData:
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   850
    "/ real starters
2582
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   851
    #(
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   852
        ( #[16r4C 16r00 16r00 16r00 16r01 16r14 16r02 16r00 16r00 16r00 16r00 16r00 16rC0 16r00 16r00 16r00 16r00 16r00 16r00 16r46] 
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   853
                #'application/x-ms-shortcut' )
2924
808feaad1bb3 changed: #mimeTypeOfData:
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   854
        ( 'ITOLITLS' 
808feaad1bb3 changed: #mimeTypeOfData:
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   855
                #'application/x-ms-reader' )
2582
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   856
        ( 'WALTOP' 
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   857
                #'application/x-waltop-digital-notepad' )
2892
3da4b1884487 changed: #mimeTypeOfData:
Claus Gittinger <cg@exept.de>
parents: 2891
diff changeset
   858
        ('PK'                       
3da4b1884487 changed: #mimeTypeOfData:
Claus Gittinger <cg@exept.de>
parents: 2891
diff changeset
   859
                #'application/x-zip-compressed')
2582
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   860
     ) pairsDo:[:pattern :what |
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   861
        |patternString|
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   862
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   863
        patternString := pattern asString.
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   864
        (buffer startsWith:patternString) ifTrue:[
2583
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
   865
            ^ MIMEType fromString:what
2582
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   866
        ]
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   867
    ].
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   868
2924
808feaad1bb3 changed: #mimeTypeOfData:
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   869
    "/ somewhere near the beginning
2582
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   870
    #(
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   871
            ('<body:'                   #'text/html')
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   872
            ('%!!ps-adobe'               #'application/postscript')
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   873
            ('%PDF-'                    #'application/pdf')
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   874
            ('#!! /bin/sh'               #'application/x-sh')
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   875
            ('#!!/bin/sh'                #'application/x-sh')
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   876
            "/ ('#!! /bin/bash'              'application/x-bash')
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   877
            "/ ('#!!/bin/bash'               'application/x-bash')
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   878
            ('<?xml version='           #'text/xml')
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   879
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   880
            ('from dolphin'             #'application/x-smalltalk-source')
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   881
            ('from visualworks'         #'application/x-smalltalk-source')
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   882
            ('categoriesforclass'       #'application/x-smalltalk-source')
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   883
            ('methodsfor!!'              #'application/x-smalltalk-source')
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   884
            ('subclass:'                #'application/x-smalltalk-source')
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   885
            ('methodsfor:'              #'application/x-smalltalk-source')
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   886
            ('interchangeversion:'      #'application/x-smalltalk-source-sif')
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   887
            ('subclass:'                #'application/x-smalltalk-source')
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   888
            ('methodsfor:'              #'application/x-smalltalk-source')
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   889
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   890
    ) pairsDo:[:pattern :what | 
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   891
        (lcBuffer findString:pattern) ~~ 0 ifTrue:[
2583
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
   892
            ^ MIMEType fromString:what
2582
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   893
        ]
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   894
    ].
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   895
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   896
    (idx := lcBuffer findString:'<h') ~~ 0 ifTrue:[
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   897
        ((lcBuffer continuesWith:'<head' startingAt:idx)
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   898
        or:[(lcBuffer continuesWith:'<html' startingAt:idx)
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   899
        or:[(lcBuffer continuesWith:'<h1' startingAt:idx)
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   900
        or:[(lcBuffer continuesWith:'<h2' startingAt:idx)
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   901
        or:[(lcBuffer continuesWith:'<h3' startingAt:idx)
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   902
        or:[(lcBuffer continuesWith:'<h4' startingAt:idx)
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   903
        or:[(lcBuffer continuesWith:'<h5' startingAt:idx)
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   904
        or:[(lcBuffer continuesWith:'<h6' startingAt:idx)]]]]]]])
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   905
        ifTrue:[
2583
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
   906
            ^ MIMEType fromString:'text/html'
2582
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   907
        ]
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   908
    ].
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   909
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   910
    [size ~~ 0 and:[(buffer at:size) isPrintable]] whileTrue:[size := size - 1].
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   911
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   912
    size == 0 ifTrue:[
2583
Claus Gittinger <cg@exept.de>
parents: 2582
diff changeset
   913
        ^ MIMEType fromString:'text/plain'
2582
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   914
    ].
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   915
    ^ nil
2891
9aee109c1c1c changed:
Claus Gittinger <cg@exept.de>
parents: 2888
diff changeset
   916
2924
808feaad1bb3 changed: #mimeTypeOfData:
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   917
    "Modified: / 12-07-2011 / 19:08:17 / cg"
2582
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   918
!
298203fdb64d mime type detection from conents moved from fileName to here
Claus Gittinger <cg@exept.de>
parents: 2570
diff changeset
   919
1887
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   920
suffixForMimeType:mimeType
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   921
    "given a file suffix, return the mime-type"
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   922
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   923
    ^ TypeToFileSuffixMapping at:mimeType ifAbsent:nil
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   924
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   925
    "
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   926
     self suffixForMimeType:(MIMEType fromString:'image/gif')     
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   927
    "
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   928
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   929
    "Created: / 30.6.1997 / 21:55:51 / cg"
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   930
    "Modified: / 23.12.1999 / 22:30:55 / cg"
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   931
!
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   932
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   933
suffixForMimeTypeString:mimeTypeString
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   934
    "given a file suffix, return the mime-type"
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   935
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   936
     ^ self suffixForMimeType:(MIMEType fromString:mimeTypeString) 
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   937
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   938
    "
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   939
     self suffixForMimeTypeString:'image/gif' 
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   940
    "
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   941
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   942
    "Created: / 30.6.1997 / 21:55:51 / cg"
ae19bd933dbd add suffixForMimeType acces
penk
parents: 1864
diff changeset
   943
    "Modified: / 23.12.1999 / 22:30:55 / cg"
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   944
! !
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
   945
2116
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   946
!MIMETypes class methodsFor:'queries-applications'!
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   947
2117
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   948
defaultCommandPerMIME
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   949
    "returns the collection which is used to map MIME-type to command-templates."
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   950
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   951
    "TODO: move this to OS/UserPreferences"
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   952
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   953
    DefaultCommandPerMIMEPerOS isNil ifTrue:[
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   954
        self initializeDefaultCommands
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   955
    ].
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   956
    OperatingSystem isUNIXlike ifTrue:[
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   957
        ^ DefaultCommandPerMIMEPerOS at:#unix
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   958
    ].
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   959
    ^ DefaultCommandPerMIMEPerOS at:#win32
2942
693d381bc775 comment/format in: #defaultCommandPerMIME
Claus Gittinger <cg@exept.de>
parents: 2937
diff changeset
   960
693d381bc775 comment/format in: #defaultCommandPerMIME
Claus Gittinger <cg@exept.de>
parents: 2937
diff changeset
   961
    "
693d381bc775 comment/format in: #defaultCommandPerMIME
Claus Gittinger <cg@exept.de>
parents: 2937
diff changeset
   962
     MIMETypes defaultCommandPerMIME
693d381bc775 comment/format in: #defaultCommandPerMIME
Claus Gittinger <cg@exept.de>
parents: 2937
diff changeset
   963
    "
693d381bc775 comment/format in: #defaultCommandPerMIME
Claus Gittinger <cg@exept.de>
parents: 2937
diff changeset
   964
693d381bc775 comment/format in: #defaultCommandPerMIME
Claus Gittinger <cg@exept.de>
parents: 2937
diff changeset
   965
    "Modified (comment): / 16-09-2011 / 16:20:12 / cg"
2117
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   966
!
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
   967
2116
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   968
defaultCommandTemplateToOpenMimeType:mimeType
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   969
    |cmd|
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   970
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   971
    cmd := self defaultCommandPerMIME at:mimeType ifAbsent:nil.
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   972
    cmd isNil ifTrue:[
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   973
        OperatingSystem isMSWINDOWSlike ifTrue:[
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   974
            cmd := Win32OperatingSystem::RegistryEntry commandTemplateToOpenMimeType:mimeType
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   975
        ].
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   976
    ].
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   977
    ^ cmd
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   978
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   979
    "
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   980
     MIMETypes defaultCommandTemplateToOpenMimeType:'application/pdf'
2118
b41112f6c76e commandTemplate stuff
Claus Gittinger <cg@exept.de>
parents: 2117
diff changeset
   981
     MIMETypes defaultCommandTemplateToOpenMimeType:'text/html'
2116
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   982
    "
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   983
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   984
    "Created: / 12-05-2004 / 11:09:22 / cg"
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   985
    "Modified: / 12-05-2004 / 11:16:53 / cg"
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   986
!
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   987
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   988
defaultCommandTemplateToPrintMimeType:mimeType
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   989
    |cmd|
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   990
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   991
    cmd := self defaultPrintCommandPerMIME at:mimeType ifAbsent:nil.
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   992
    cmd isNil ifTrue:[
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   993
        OperatingSystem isMSWINDOWSlike ifTrue:[
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   994
            cmd := Win32OperatingSystem::RegistryEntry commandTemplateToPrintMimeType:mimeType
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   995
        ].
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   996
    ].
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   997
    ^ cmd
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   998
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
   999
    "
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
  1000
     MIMETypes defaultCommandTemplateToPrintMimeType:'application/pdf'
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
  1001
    "
2117
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1002
!
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1003
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1004
defaultPrintCommandPerMIME
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1005
    "returns the collection which is used to map MIME-type to printing command-templates."
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1006
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1007
    "TODO: move this to OS/UserPreferences"
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1008
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1009
    DefaultPrintCommandPerMIMEPerOS isNil ifTrue:[
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1010
        self initializeDefaultCommands
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1011
    ].
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1012
    OperatingSystem isUNIXlike ifTrue:[
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1013
        ^ DefaultPrintCommandPerMIMEPerOS at:#unix
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1014
    ].
84ad717d243e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1015
    ^ DefaultPrintCommandPerMIMEPerOS at:#win32
2116
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
  1016
! !
edc0a8f8ff26 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2113
diff changeset
  1017
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1018
!MIMETypes class methodsFor:'queries-image formats'!
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1019
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1020
imageReaderClasses
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1021
    "return a collection of registered image reader classes"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1022
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1023
    |setOfClasses|
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1024
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1025
    setOfClasses := IdentitySet new.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1026
    FileSuffixToImageReaderClassMapping notNil ifTrue:[
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1027
        FileSuffixToImageReaderClassMapping keysAndValuesDo:[:suff :cls |
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1028
            setOfClasses add:cls
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1029
        ].
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1030
    ].
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1031
    TypeToImageReaderClassMapping notNil ifTrue:[
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1032
        TypeToImageReaderClassMapping keysAndValuesDo:[:suff :cls |
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1033
            setOfClasses add:cls
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1034
        ].
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1035
    ].
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1036
    ^ setOfClasses
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1037
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1038
    "Created: / 30.6.1997 / 22:03:42 / cg"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1039
    "Modified: / 1.8.1998 / 16:59:52 / cg"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1040
!
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1041
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1042
imageReaderForSuffix:aSuffix
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1043
    "given a file suffix, return an approriate image reader class"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1044
2724
8e834e62dbbc Initialize when querying for image type and not yet initialized
Stefan Vogel <sv@exept.de>
parents: 2710
diff changeset
  1045
    FileSuffixToImageReaderClassMapping isNil ifTrue:[
8e834e62dbbc Initialize when querying for image type and not yet initialized
Stefan Vogel <sv@exept.de>
parents: 2710
diff changeset
  1046
        self initializeImageReaderMappings
8e834e62dbbc Initialize when querying for image type and not yet initialized
Stefan Vogel <sv@exept.de>
parents: 2710
diff changeset
  1047
    ].
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1048
    ^ FileSuffixToImageReaderClassMapping at:aSuffix asLowercase ifAbsent:nil
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1049
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1050
    "Created: / 30.6.1997 / 21:59:11 / cg"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1051
    "Modified: / 1.8.1998 / 17:01:58 / cg"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1052
!
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1053
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1054
imageReaderForSuffix:aSuffix put:aReaderClass
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1055
    "register an image reader for a file suffix"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1056
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1057
    FileSuffixToImageReaderClassMapping isNil ifTrue:[
2724
8e834e62dbbc Initialize when querying for image type and not yet initialized
Stefan Vogel <sv@exept.de>
parents: 2710
diff changeset
  1058
        self initializeImageReaderMappings
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1059
    ].
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1060
    FileSuffixToImageReaderClassMapping at:aSuffix asLowercase put:aReaderClass
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1061
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1062
    "Created: / 30.6.1997 / 21:59:43 / cg"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1063
    "Modified: / 1.8.1998 / 17:02:14 / cg"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1064
!
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1065
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1066
imageReaderForType:mimeTypeString
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1067
    "given a mime-type, return an approriate image reader class"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1068
2724
8e834e62dbbc Initialize when querying for image type and not yet initialized
Stefan Vogel <sv@exept.de>
parents: 2710
diff changeset
  1069
    TypeToImageReaderClassMapping isNil ifTrue:[
8e834e62dbbc Initialize when querying for image type and not yet initialized
Stefan Vogel <sv@exept.de>
parents: 2710
diff changeset
  1070
        self initializeImageReaderMappings
8e834e62dbbc Initialize when querying for image type and not yet initialized
Stefan Vogel <sv@exept.de>
parents: 2710
diff changeset
  1071
    ].
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1072
    ^ TypeToImageReaderClassMapping at:mimeTypeString asLowercase ifAbsent:nil
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1073
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1074
    "Created: / 30.6.1997 / 21:56:01 / cg"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1075
    "Modified: / 1.8.1998 / 17:02:28 / cg"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1076
!
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1077
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1078
imageReaderForType:mimeTypeString put:aReaderClass
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1079
    "register an image reader for a mime-type"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1080
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1081
    TypeToImageReaderClassMapping isNil ifTrue:[
2724
8e834e62dbbc Initialize when querying for image type and not yet initialized
Stefan Vogel <sv@exept.de>
parents: 2710
diff changeset
  1082
        self initializeImageReaderMappings
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1083
    ].
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1084
    TypeToImageReaderClassMapping at:mimeTypeString asLowercase put:aReaderClass
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1085
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1086
    "Created: / 30.6.1997 / 21:56:11 / cg"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1087
    "Modified: / 1.8.1998 / 17:02:40 / cg"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1088
! !
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1089
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1090
!MIMETypes class methodsFor:'queries-language syntax'!
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1091
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1092
commentStringsForFilename:aFilename
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1093
    "return a useful comment definition; heuristics for now.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1094
     The returned value is an array of 2 elements;
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1095
     the first is the end-of-line comment string (or nil);
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1096
     the second an array of opening/closing delimiters (or an array of nils)"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1097
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1098
     |mime|
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1099
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1100
     mime := MIMETypes mimeTypeForFilename:aFilename.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1101
     ^ self commentStringsForMimeType:mime suffix:(aFilename asFilename suffix)
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1102
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1103
    "
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1104
     MIMETypes commentStringsForFilename:'Makefile'.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1105
     MIMETypes commentStringsForFilename:'Object.st'. 
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1106
     MIMETypes commentStringsForFilename:'Foo.java'. 
1925
9f5e4568529f comment
Claus Gittinger <cg@exept.de>
parents: 1891
diff changeset
  1107
     MIMETypes commentStringsForFilename:'Foo.html'. 
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1108
    "
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1109
!
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1110
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1111
commentStringsForFilename:aFilename ifUnknown:alternativeBlockReturningCommentString
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1112
    "return a useful comment definition; heuristics for now.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1113
     The returned value is an array of 2 elements;
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1114
     the first is the end-of-line comment string (or nil);
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1115
     the second an array of opening/closing delimiters (or an array of nils)"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1116
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1117
     |mime|
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1118
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1119
     mime := MIMETypes mimeTypeForFilename:aFilename.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1120
     ^ self commentStringsForMimeType:mime suffix:(aFilename asFilename suffix) ifUnknown:alternativeBlockReturningCommentString
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1121
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1122
    "
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1123
     MIMETypes commentStringsForFilename:'Makefile'.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1124
     MIMETypes commentStringsForFilename:'Object.st'. 
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1125
     MIMETypes commentStringsForFilename:'Foo.java'. 
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1126
    "
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1127
!
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1128
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1129
commentStringsForMimeType:mime suffix:suff
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1130
    "return a useful comment definition; heuristics for now.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1131
     The returned value is an array of 2 elements;
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1132
     the first is the end-of-line comment string (or nil);
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1133
     the second an array of opening/closing delimiters (or an array of nils)"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1134
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1135
    ^ self
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1136
        commentStringsForMimeType:mime suffix:suff 
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1137
        ifUnknown: #(';' (nil nil))  
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1138
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1139
    "
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1140
     |mime|
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1141
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1142
     mime := MIMETypes mimeTypeForFilename:'Makefile'.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1143
     MIMETypes commentStringsForMimeType:mime suffix:nil.     
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1144
    "
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1145
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1146
    "
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1147
     |mime|
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1148
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1149
     mime := MIMETypes mimeTypeForFilename:'Object.st'.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1150
     MIMETypes commentStringsForMimeType:mime suffix:nil.    
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1151
    "
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1152
!
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1153
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1154
commentStringsForMimeType:mime suffix:suff ifUnknown:alternativeBlockReturningCommentString
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1155
    "return a useful comment definition; heuristics for now.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1156
     The returned value is an array of 2 elements;
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1157
     the first is the end-of-line comment string (or nil);
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1158
     the second an array of opening/closing delimiters (or an array of nils)"
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1159
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1160
    |commentSpec|
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1161
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1162
    commentSpec := TypeToCommentStringMapping at:mime ifAbsent:nil.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1163
    commentSpec notNil ifTrue:[
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1164
        ^ commentSpec
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1165
    ].
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1166
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1167
    commentSpec := SuffixToCommentStringMapping at:suff ifAbsent:nil.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1168
    commentSpec notNil ifTrue:[
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1169
        ^ commentSpec
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1170
    ].
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1171
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1172
    ^ alternativeBlockReturningCommentString value
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1173
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1174
    "
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1175
     |mime|
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1176
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1177
     mime := MIMETypes mimeTypeForFilename:'Makefile'.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1178
     MIMETypes commentStringsForMimeType:mime suffix:nil.     
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1179
    "
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1180
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1181
    "
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1182
     |mime|
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1183
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1184
     mime := MIMETypes mimeTypeForFilename:'Object.st'.
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1185
     MIMETypes commentStringsForMimeType:mime suffix:nil.    
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1186
    "
2298
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1187
!
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1188
2491
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
  1189
parenthesisSpecForFilename:aFilename
2298
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1190
    "return a useful parentesis spec; heuristics for now.
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1191
     The returned value is a dictionary to be used as parentesis spec in an editor"
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1192
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1193
     |mime|
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1194
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1195
     mime := MIMETypes mimeTypeForFilename:aFilename.
2491
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
  1196
     ^ self parenthesisSpecForMimeType:mime suffix:(aFilename asFilename suffix)
2298
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1197
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1198
    "
2491
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
  1199
     MIMETypes parenthesisSpecForFilename:'Object.st'. 
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
  1200
     MIMETypes parenthesisSpecForFilename:'Foo.java'. 
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
  1201
     MIMETypes parenthesisSpecForFilename:'Foo.html'. 
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
  1202
     MIMETypes parenthesisSpecForFilename:'Foo.lsp'. 
2298
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1203
    "
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1204
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1205
    "Created: / 10-04-2007 / 15:18:41 / cg"
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1206
!
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1207
2491
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
  1208
parenthesisSpecForFilename:aFilename ifUnknown:alternative
2298
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1209
     |mime|
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1210
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1211
     mime := MIMETypes mimeTypeForFilename:aFilename.
2491
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
  1212
     ^ self parenthesisSpecForMimeType:mime suffix:(aFilename asFilename suffix) ifUnknown:alternative
2298
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1213
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1214
    "Created: / 10-04-2007 / 15:26:20 / cg"
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1215
!
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1216
2491
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
  1217
parenthesisSpecForMimeType:mime suffix:suff
2298
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1218
    ^ self
2491
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
  1219
        parenthesisSpecForMimeType:mime suffix:suff 
2298
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1220
        ifUnknown: nil
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1221
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1222
    "Created: / 10-04-2007 / 15:19:39 / cg"
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1223
!
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1224
2491
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
  1225
parenthesisSpecForMimeType:mime suffix:suff ifUnknown:alternativeValue
2298
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1226
    |spec|
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1227
2491
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
  1228
    spec := TypeToParenthesisSpecMapping at:mime ifAbsent:nil.
2298
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1229
    spec notNil ifTrue:[
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1230
        ^ spec
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1231
    ].
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1232
2491
831417cc1e5b Change bas spelling: parentesis to good spellinge parenthesis
Stefan Vogel <sv@exept.de>
parents: 2490
diff changeset
  1233
    spec := SuffixToParenthesisSpecMapping at:suff ifAbsent:nil.
2298
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1234
    spec notNil ifTrue:[
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1235
        ^ spec
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1236
    ].
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1237
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1238
    ^ alternativeValue value
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1239
2d09f75ee005 parentesis spec
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  1240
    "Created: / 10-04-2007 / 15:20:38 / cg"
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1241
! !
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1242
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1243
!MIMETypes::MIMEType class methodsFor:'documentation'!
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1244
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1245
documentation
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1246
"
1864
c21ec6c1635e comments
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1247
    like a string, but knows that it represents a mimeType.
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1248
"
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1249
! !
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1250
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1251
!MIMETypes::MIMEType class methodsFor:'instance creation'!
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1252
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1253
fromString:aString
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1254
    |cachedType newType|
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1255
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1256
    aString class == self ifTrue:[^ aString].
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1257
3011
f2af94d78383 delay initialization of cachedTypes
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1258
    CachedTypes isNil ifTrue:[
3012
af9c31ac2fc1 make it a real dictionary
Claus Gittinger <cg@exept.de>
parents: 3011
diff changeset
  1259
        CachedTypes := Dictionary new:100.
3011
f2af94d78383 delay initialization of cachedTypes
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1260
    ].
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1261
    cachedType := CachedTypes at:aString ifAbsent:nil.
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1262
    cachedType notNil ifTrue:[^ cachedType].
3011
f2af94d78383 delay initialization of cachedTypes
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1263
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1264
    newType := aString copy changeClassTo:self.
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1265
    CachedTypes at:aString put:newType.
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1266
    ^ newType
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1267
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1268
    "
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1269
     self fromString:'text/html'
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1270
    "
3011
f2af94d78383 delay initialization of cachedTypes
Claus Gittinger <cg@exept.de>
parents: 3008
diff changeset
  1271
3012
af9c31ac2fc1 make it a real dictionary
Claus Gittinger <cg@exept.de>
parents: 3011
diff changeset
  1272
    "Modified: / 20-07-2012 / 17:36:31 / cg"
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1273
! !
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1274
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1275
!MIMETypes::MIMEType methodsFor:'queries'!
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1276
1693
4055b361abe9 isArchiv -> isArchive
Claus Gittinger <cg@exept.de>
parents: 1691
diff changeset
  1277
isArchive
1864
c21ec6c1635e comments
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1278
    "return true, if I represent an archive type (such as zip or tar)"
c21ec6c1635e comments
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1279
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1280
    |archivTypes|
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1281
1729
5d1b74b8d264 refactored
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
  1282
    archivTypes := MIMETypes applicationCompressorsAndArchiveTypeList.
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1283
    archivTypes pairWiseDo:[: ext : type |
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1284
        self = type ifTrue:[ ^ true].
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1285
    ].
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1286
    ^ false
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1287
!
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1288
2024
eb5838c72cc7 isBinary added
penk
parents: 2023
diff changeset
  1289
isBinary
eb5838c72cc7 isBinary added
penk
parents: 2023
diff changeset
  1290
    "return true, if I represent a binary (non-text) type"
eb5838c72cc7 isBinary added
penk
parents: 2023
diff changeset
  1291
eb5838c72cc7 isBinary added
penk
parents: 2023
diff changeset
  1292
    ^ self isTextType not
eb5838c72cc7 isBinary added
penk
parents: 2023
diff changeset
  1293
!
eb5838c72cc7 isBinary added
penk
parents: 2023
diff changeset
  1294
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1295
isHtml
1864
c21ec6c1635e comments
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1296
    "return true, if I represent the html text type"
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1297
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1298
    ^ (self = 'text/html')
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1299
!
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1300
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1301
isImage
1864
c21ec6c1635e comments
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1302
    "return true, if I represent an image type (such as gif or jpg)"
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1303
1693
4055b361abe9 isArchiv -> isArchive
Claus Gittinger <cg@exept.de>
parents: 1691
diff changeset
  1304
    ^ (self startsWith:'image/')
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1305
!
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1306
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1307
isPdf
1864
c21ec6c1635e comments
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1308
    "return true, if I represent the pdf type"
c21ec6c1635e comments
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1309
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1310
    ^ (self = 'application/pdf')
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1311
!
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1312
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1313
isSmalltalkSource
1864
c21ec6c1635e comments
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1314
    "return true, if I represent the smalltalk sourcecode type"
c21ec6c1635e comments
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1315
1612
4c7893f943a8 *** empty log message ***
penk
parents: 1611
diff changeset
  1316
    ^ (self = 'application/x-smalltalk-source')
1783
faf721f692ae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  1317
!
faf721f692ae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  1318
2024
eb5838c72cc7 isBinary added
penk
parents: 2023
diff changeset
  1319
isTextType
eb5838c72cc7 isBinary added
penk
parents: 2023
diff changeset
  1320
    "return true, if I represent some text type"
eb5838c72cc7 isBinary added
penk
parents: 2023
diff changeset
  1321
eb5838c72cc7 isBinary added
penk
parents: 2023
diff changeset
  1322
    ^ self startsWith:'text/'
eb5838c72cc7 isBinary added
penk
parents: 2023
diff changeset
  1323
!
eb5838c72cc7 isBinary added
penk
parents: 2023
diff changeset
  1324
1783
faf721f692ae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  1325
isXml
1864
c21ec6c1635e comments
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1326
    "return true, if I represent the xml text type"
c21ec6c1635e comments
Claus Gittinger <cg@exept.de>
parents: 1841
diff changeset
  1327
1783
faf721f692ae *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  1328
    ^ (self = 'text/xml')
2490
9bcc1b3fd7e0 MIMEType>>#suffix
Stefan Vogel <sv@exept.de>
parents: 2489
diff changeset
  1329
!
9bcc1b3fd7e0 MIMEType>>#suffix
Stefan Vogel <sv@exept.de>
parents: 2489
diff changeset
  1330
9bcc1b3fd7e0 MIMEType>>#suffix
Stefan Vogel <sv@exept.de>
parents: 2489
diff changeset
  1331
suffix
9bcc1b3fd7e0 MIMEType>>#suffix
Stefan Vogel <sv@exept.de>
parents: 2489
diff changeset
  1332
    ^ MIMETypes suffixForMimeType:self
9bcc1b3fd7e0 MIMEType>>#suffix
Stefan Vogel <sv@exept.de>
parents: 2489
diff changeset
  1333
9bcc1b3fd7e0 MIMEType>>#suffix
Stefan Vogel <sv@exept.de>
parents: 2489
diff changeset
  1334
    "
9bcc1b3fd7e0 MIMEType>>#suffix
Stefan Vogel <sv@exept.de>
parents: 2489
diff changeset
  1335
       (MIMETypes mimeTypeFromString:'application/x-expecco-testsuite') suffix 
9bcc1b3fd7e0 MIMEType>>#suffix
Stefan Vogel <sv@exept.de>
parents: 2489
diff changeset
  1336
    "
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1337
! !
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1338
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1339
!MIMETypes class methodsFor:'documentation'!
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1340
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1341
version
3039
1a8ca229615f class: MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
  1342
    ^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.125 2012-12-14 16:19:15 cg Exp $'
2758
66e62ceecb67 comment/format in: #defaultCommandForMimeType:
Claus Gittinger <cg@exept.de>
parents: 2724
diff changeset
  1343
!
66e62ceecb67 comment/format in: #defaultCommandForMimeType:
Claus Gittinger <cg@exept.de>
parents: 2724
diff changeset
  1344
66e62ceecb67 comment/format in: #defaultCommandForMimeType:
Claus Gittinger <cg@exept.de>
parents: 2724
diff changeset
  1345
version_CVS
3039
1a8ca229615f class: MIMETypes
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
  1346
    ^ '$Header: /cvs/stx/stx/libview2/MIMETypes.st,v 1.125 2012-12-14 16:19:15 cg Exp $'
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1347
! !
1666
2fe4fb7be12c added xml type
Claus Gittinger <cg@exept.de>
parents: 1616
diff changeset
  1348
643
f3bd12eb1008 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1349
MIMETypes initialize!