UserPreferences.st
changeset 4582 31cbce168a1d
parent 4580 654e30c513ec
child 4583 9f6051955f6a
equal deleted inserted replaced
4581:9b807b6f7265 4582:31cbce168a1d
    35 
    35 
    36 !
    36 !
    37 
    37 
    38 documentation
    38 documentation
    39 "
    39 "
    40     Not yet finished.
    40     A Dictionary for user preference values.
       
    41     For non-existing keys, either a defaultValue (false),
       
    42     or the value from a defaultDictionary is returned.
    41 
    43 
    42     This will eventually keep track of ALL user preferences.
    44     This will eventually keep track of ALL user preferences.
    43     (which are currently spread over the system).
    45     (which are currently spread over the system).
    44     For now, only a few preferences are found here - but this
    46     For now, only a few preferences are found here - but this
    45     will change over time.
    47     will change over time.
       
    48 
       
    49     UserPreferences current at:#foo
    46 "
    50 "
    47 ! !
    51 ! !
    48 
    52 
    49 !UserPreferences class methodsFor:'initialization'!
    53 !UserPreferences class methodsFor:'initialization'!
    50 
    54 
   103     "Created: / 31.3.1998 / 13:43:03 / cg"
   107     "Created: / 31.3.1998 / 13:43:03 / cg"
   104 !
   108 !
   105 
   109 
   106 default
   110 default
   107     DefaultPreferences isNil ifTrue:[
   111     DefaultPreferences isNil ifTrue:[
   108 	self initializeDefaultPreferences
   112         self initializeDefaultPreferences
   109     ].
   113     ].
   110     ^ DefaultPreferences.
   114     ^ DefaultPreferences.
   111 
   115 
       
   116     "
       
   117      DefaultPreferences := nil.
       
   118     "
   112 !
   119 !
   113 
   120 
   114 reset
   121 reset
   115     "resets the CurrentPreferences to its default values"
   122     "resets the CurrentPreferences to its default values"
   116 
   123 
   557 
   564 
   558     k := aMessage selector.
   565     k := aMessage selector.
   559     (self includesKey:k) ifTrue:[
   566     (self includesKey:k) ifTrue:[
   560         ^ self at:k
   567         ^ self at:k
   561     ].
   568     ].
   562     (self default includesKey:k) ifTrue:[
   569     ((def := self class default) includesKey:k) ifTrue:[
   563         ^ self default at:k
   570         ^ def at:k
   564     ].
   571     ].
   565     ^ super doesNotUnderstand:aMessage
   572     ^ super doesNotUnderstand:aMessage
   566 !
   573 !
   567 
   574 
   568 errorColor
   575 errorColor
   953     self class syntaxColorKeys do:[:k | self removeKey:k ifAbsent:nil].
   960     self class syntaxColorKeys do:[:k | self removeKey:k ifAbsent:nil].
   954     self at:#commentColor put:(Color green darkened).
   961     self at:#commentColor put:(Color green darkened).
   955 
   962 
   956 ! !
   963 ! !
   957 
   964 
       
   965 !UserPreferences methodsFor:'default value'!
       
   966 
       
   967 errorKeyNotFound:aKey
       
   968     "for any non-existing key, false is returned"
       
   969 
       
   970     ^ false
       
   971 ! !
       
   972 
   958 !UserPreferences class methodsFor:'documentation'!
   973 !UserPreferences class methodsFor:'documentation'!
   959 
   974 
   960 version
   975 version
   961     ^ '$Header: /cvs/stx/stx/libbasic/UserPreferences.st,v 1.45 1999-08-09 14:46:44 cg Exp $'
   976     ^ '$Header: /cvs/stx/stx/libbasic/UserPreferences.st,v 1.46 1999-08-10 17:46:32 cg Exp $'
   962 ! !
   977 ! !
   963 UserPreferences initialize!