--- a/ViewStyle.st Thu Nov 09 13:25:38 2006 +0100
+++ b/ViewStyle.st Mon Nov 27 16:47:09 2006 +0100
@@ -9,7 +9,6 @@
other person. No title to or ownership of the software is
hereby transferred.
"
-
"{ Package: 'stx:libview' }"
ResourcePack subclass:#ViewStyle
@@ -57,41 +56,29 @@
fromFile:aFileNameArg
"get the preferences definitions from a file"
- |aFileName prefs failed nm dir d path|
+ |aFileName prefs failed nm dir path baseName|
aFileName := aFileNameArg asFilename.
(aFileName hasSuffix:'style') ifTrue:[
- nm := aFileName withoutSuffix
+ baseName := aFileName withoutSuffix baseName.
+ nm := aFileName.
] ifFalse:[
- nm := aFileName
+ baseName := aFileName baseName.
+ nm := aFileName withSuffix:'style'.
].
prefs := self new.
- prefs at:#name put:nm baseName.
+ prefs at:#name put:baseName.
- "/ generic search first (allows for user to overwrite it)
- path := Smalltalk getResourceFileName:aFileName forPackage:'stx:libview'.
+ path := Smalltalk getResourceFileName:nm forPackage:'stx:libview'.
path notNil ifTrue:[
- dir := path asFilename directory name
- ] ifFalse:[
- "/ then search in the classes package directory ...
- dir := Smalltalk projectDirectoryForPackage:'stx:libview'.
- dir notNil ifTrue:[
- dir := dir asFilename.
- d := dir construct:'resources'.
- (d exists and:[(d construct:aFileName) exists]) ifFalse:[
- d := dir construct:'styles'.
- ].
- (d exists and:[(d construct:aFileName) exists]) ifTrue:[
- dir := d
- ].
- dir := dir pathName.
- ].
+ dir := path asFilename directory pathName.
].
- failed := (prefs readFromFile:aFileName directory:dir) isNil.
+ failed := (prefs readFromFile:nm directory:dir) isNil.
prefs at:#fileReadFailed put:failed.
^ prefs
"
+ ViewStyle fromFile:'motif'
ViewStyle fromFile:'motif.style'
ViewStyle fromFile:'normal.style'
ViewStyle fromFile:'iris.style'
@@ -266,5 +253,5 @@
!ViewStyle class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/ViewStyle.st,v 1.29 2004-09-27 08:30:08 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/ViewStyle.st,v 1.30 2006-11-27 15:47:09 stefan Exp $'
! !