SimpleView.st
changeset 2292 8efc5272cf0b
parent 2274 9f4e4e52938a
child 2293 e6b23b41d390
--- a/SimpleView.st	Sun Aug 30 12:36:55 1998 +0200
+++ b/SimpleView.st	Sun Aug 30 13:46:58 1998 +0200
@@ -1119,76 +1119,85 @@
      anyway."
 
     <resource: #style (#viewSpacing #font #borderWidth
-		       #viewBackground #shadowColor #lightColor
-		       #focusColor #focusBorderWidth)>
-
-    |bgGrey|
+                       #viewBackground #shadowColor #lightColor
+                       #focusColor #focusBorderWidth)>
+
+    |bgGrey defStyle|
 
     "
      when coming here the first time, we read the styleSheet
      and keep the values in fast class variables
     "
     StyleSheet isNil ifTrue:[
-	DefaultStyle := #normal.
-	StyleSheet := ViewStyle fromFile:'normal.style'.
+        defStyle := OperatingSystem getEnvironment:'STX_VIEWSTYLE'.
+        defStyle notNil ifTrue:[
+            DefaultStyle := defStyle asSymbol.
+        ] ifFalse:[
+            Screen default depth > 1 ifTrue:[
+                DefaultStyle := #motif
+            ] ifFalse:[
+                DefaultStyle := #normal.
+            ]
+        ].
+        StyleSheet := ViewStyle fromFile:(DefaultStyle , '.style').
     ].
 
     Grey := StyleSheet viewGrey.
     Grey isNil ifTrue:[
-	Grey := Color grey
+        Grey := Color grey
     ].
     Grey := Grey on:Display.
 
     StyleSheet fileReadFailed ifTrue:[
-	bgGrey := White
+        bgGrey := White
     ] ifFalse:[
-	Display hasGrayscales ifTrue:[
-	    bgGrey := Grey
-	] ifFalse:[
-	    bgGrey := White 
-	]
+        Display hasGrayscales ifTrue:[
+            bgGrey := Grey
+        ] ifFalse:[
+            bgGrey := White 
+        ]
     ].
     bgGrey := bgGrey on:Display.
 
     ViewSpacing := StyleSheet at:'viewSpacing'.
     ViewSpacing isNil ifTrue:[
-	ViewSpacing := Display defaultStyleValueFor:#viewSpacing.
+        ViewSpacing := Display defaultStyleValueFor:#viewSpacing.
     ].
 
     DefaultBorderColor := StyleSheet colorAt:'borderColor'.
     DefaultBorderColor isNil ifTrue:[
-	DefaultBorderColor := Display defaultStyleValueFor:#borderColor
+        DefaultBorderColor := Display defaultStyleValueFor:#borderColor
     ].
 
     StyleSheet fileReadFailed ifTrue:[
-	DefaultBorderWidth := 1.
-	DefaultShadowColor := Black.
-	DefaultLightColor :=  White.
-	DefaultFocusColor := Black.
-	DefaultFocusBorderWidth := 2.
-	DefaultViewBackgroundColor := White.
+        DefaultBorderWidth := 1.
+        DefaultShadowColor := Black.
+        DefaultLightColor :=  White.
+        DefaultFocusColor := Black.
+        DefaultFocusBorderWidth := 2.
+        DefaultViewBackgroundColor := White.
     ] ifFalse:[
-	DefaultBorderWidth := StyleSheet at:'borderWidth' default:0.
-	DefaultViewBackgroundColor := StyleSheet colorAt:'viewBackground' default:bgGrey.
-	DefaultShadowColor := StyleSheet colorAt:'shadowColor'.
-	DefaultLightColor := StyleSheet colorAt:'lightColor'.
-	DefaultFocusColor := StyleSheet colorAt:'focusColor' default:Color red.
-	DefaultFocusBorderWidth := StyleSheet at:'focusBorderWidth' default:2.
+        DefaultBorderWidth := StyleSheet at:'borderWidth' default:0.
+        DefaultViewBackgroundColor := StyleSheet colorAt:'viewBackground' default:bgGrey.
+        DefaultShadowColor := StyleSheet colorAt:'shadowColor'.
+        DefaultLightColor := StyleSheet colorAt:'lightColor'.
+        DefaultFocusColor := StyleSheet colorAt:'focusColor' default:Color red.
+        DefaultFocusBorderWidth := StyleSheet at:'focusBorderWidth' default:2.
     ].
 
     self == SimpleView ifTrue:[
-	DefaultFont := StyleSheet at:'font'.
-	DefaultFont isNil ifTrue:[
-	    DefaultFont := Font family:'courier' face:'medium' style:'roman' size:12.
-	].
-	DefaultFont := DefaultFont on:Display.
+        DefaultFont := StyleSheet at:'font'.
+        DefaultFont isNil ifTrue:[
+            DefaultFont := Font family:'courier' face:'medium' style:'roman' size:12.
+        ].
+        DefaultFont := DefaultFont on:Display.
     ] ifFalse:[
-	DefaultFont := nil
+        DefaultFont := nil
     ].
 
     DefaultViewBackgroundColor isNil ifTrue:[
-	'SimpleView [warning]: bad viewBackground in style - using white' errorPrintCR.
-	DefaultViewBackgroundColor := White
+        'SimpleView [warning]: bad viewBackground in style - using white' errorPrintCR.
+        DefaultViewBackgroundColor := White
     ].
 
     "Modified: 10.1.1997 / 18:06:18 / cg"
@@ -7892,6 +7901,6 @@
 !SimpleView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.268 1998-08-24 16:33:16 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.269 1998-08-30 11:46:58 cg Exp $'
 ! !
 SimpleView initialize!