SimpleView.st
changeset 5669 bc47f2771650
parent 5667 c065259f0d5c
child 5679 455385b07655
equal deleted inserted replaced
5668:7c7c6df62b22 5669:bc47f2771650
  1297      into faster class variables as well. These should NOT do a
  1297      into faster class variables as well. These should NOT do a
  1298      super updateStyleCache, since this method is called for all view-classes
  1298      super updateStyleCache, since this method is called for all view-classes
  1299      anyway."
  1299      anyway."
  1300 
  1300 
  1301     <resource: #style (#viewSpacing #font #borderWidth #borderColor
  1301     <resource: #style (#viewSpacing #font #borderWidth #borderColor
  1302 		       #viewBackground #shadowColor #lightColor
  1302                        #viewBackground #shadowColor #lightColor
  1303 		       #focusColor #focusBorderWidth)>
  1303                        #focusColor #focusBorderWidth)>
  1304 
  1304 
  1305     |bgGrey currentScreen|
  1305     |bgGrey currentScreen|
  1306 
  1306 
  1307     "
  1307     "
  1308      when coming here the first time, we read the styleSheet
  1308      when coming here the first time, we read the styleSheet
  1309      and keep the values in fast class variables
  1309      and keep the values in fast class variables
  1310     "
  1310     "
  1311     StyleSheet isNil ifTrue:[
  1311     StyleSheet isNil ifTrue:[
  1312 	self setDefaultStyle.
  1312         self setDefaultStyle.
  1313 	self readStyleSheet.
  1313         self readStyleSheet.
  1314     ].
  1314     ].
  1315 
  1315 
  1316     currentScreen := Screen current.
  1316     currentScreen := Screen current ? Screen default.
  1317 
  1317 
  1318     Grey := StyleSheet viewGrey.
  1318     Grey := StyleSheet viewGrey.
  1319     Grey isNil ifTrue:[
  1319     Grey isNil ifTrue:[
  1320 	Grey := Color grey
  1320         Grey := Color grey
  1321     ].
  1321     ].
  1322     Grey := Grey onDevice:currentScreen.
  1322     Grey := Grey onDevice:currentScreen.
  1323 
  1323 
  1324     StyleSheet fileReadFailed ifTrue:[
  1324     StyleSheet fileReadFailed ifTrue:[
  1325 	bgGrey := White
  1325         bgGrey := White
  1326     ] ifFalse:[
  1326     ] ifFalse:[
  1327 	currentScreen hasGrayscales ifTrue:[
  1327         currentScreen hasGrayscales ifTrue:[
  1328 	    bgGrey := Grey
  1328             bgGrey := Grey
  1329 	] ifFalse:[
  1329         ] ifFalse:[
  1330 	    bgGrey := White
  1330             bgGrey := White
  1331 	]
  1331         ]
  1332     ].
  1332     ].
  1333     bgGrey := bgGrey onDevice:currentScreen.
  1333     bgGrey := bgGrey onDevice:currentScreen.
  1334 
  1334 
  1335     ViewSpacing := StyleSheet at:#viewSpacing.
  1335     ViewSpacing := StyleSheet at:#viewSpacing.
  1336     ViewSpacing isNil ifTrue:[
  1336     ViewSpacing isNil ifTrue:[
  1337 	ViewSpacing := currentScreen defaultStyleValueFor:#viewSpacing.
  1337         ViewSpacing := currentScreen defaultStyleValueFor:#viewSpacing.
  1338     ].
  1338     ].
  1339 
  1339 
  1340     DefaultBorderColor := StyleSheet colorAt:#borderColor.
  1340     DefaultBorderColor := StyleSheet colorAt:#borderColor.
  1341     DefaultBorderColor isNil ifTrue:[
  1341     DefaultBorderColor isNil ifTrue:[
  1342 	DefaultBorderColor := currentScreen defaultStyleValueFor:#borderColor
  1342         DefaultBorderColor := currentScreen defaultStyleValueFor:#borderColor
  1343     ].
  1343     ].
  1344 
  1344 
  1345     StyleSheet fileReadFailed ifTrue:[
  1345     StyleSheet fileReadFailed ifTrue:[
  1346 	DefaultBorderWidth := 1.
  1346         DefaultBorderWidth := 1.
  1347 	DefaultShadowColor := Black.
  1347         DefaultShadowColor := Black.
  1348 	DefaultLightColor :=  White.
  1348         DefaultLightColor :=  White.
  1349 	DefaultFocusColor := Black.
  1349         DefaultFocusColor := Black.
  1350 	DefaultFocusBorderWidth := 1.
  1350         DefaultFocusBorderWidth := 1.
  1351 	DefaultViewBackgroundColor := White.
  1351         DefaultViewBackgroundColor := White.
  1352     ] ifFalse:[
  1352     ] ifFalse:[
  1353 	DefaultBorderWidth := StyleSheet at:#borderWidth default:0.
  1353         DefaultBorderWidth := StyleSheet at:#borderWidth default:0.
  1354 	DefaultViewBackgroundColor := StyleSheet colorAt:#viewBackground default:bgGrey.
  1354         DefaultViewBackgroundColor := StyleSheet colorAt:#viewBackground default:bgGrey.
  1355 	DefaultShadowColor := StyleSheet colorAt:#shadowColor.
  1355         DefaultShadowColor := StyleSheet colorAt:#shadowColor.
  1356 	DefaultLightColor := StyleSheet colorAt:#lightColor.
  1356         DefaultLightColor := StyleSheet colorAt:#lightColor.
  1357 	DefaultFocusColor := StyleSheet colorAt:#focusColor default:Color red.
  1357         DefaultFocusColor := StyleSheet colorAt:#focusColor default:Color red.
  1358 	DefaultFocusBorderWidth := StyleSheet at:'focusBorderWidth' default:2.
  1358         DefaultFocusBorderWidth := StyleSheet at:'focusBorderWidth' default:2.
  1359     ].
  1359     ].
  1360 
  1360 
  1361     self == SimpleView ifTrue:[
  1361     self == SimpleView ifTrue:[
  1362 	DefaultFont := StyleSheet at:#font.
  1362         DefaultFont := StyleSheet at:#font.
  1363 	DefaultFont isNil ifTrue:[
  1363         DefaultFont isNil ifTrue:[
  1364 	    DefaultFont := Font family:'courier' face:'medium' style:'roman' size:12.
  1364             DefaultFont := Font family:'courier' face:'medium' style:'roman' size:12.
  1365 	].
  1365         ].
  1366 	DefaultFont := DefaultFont onDevice:currentScreen.
  1366         DefaultFont := DefaultFont onDevice:currentScreen.
  1367     ] ifFalse:[
  1367     ] ifFalse:[
  1368 	DefaultFont := nil
  1368         DefaultFont := nil
  1369     ].
  1369     ].
  1370 
  1370 
  1371     DefaultViewBackgroundColor isNil ifTrue:[
  1371     DefaultViewBackgroundColor isNil ifTrue:[
  1372 	'SimpleView [warning]: bad viewBackground in style - using white' errorPrintCR.
  1372         'SimpleView [warning]: bad viewBackground in style - using white' errorPrintCR.
  1373 	DefaultViewBackgroundColor := White
  1373         DefaultViewBackgroundColor := White
  1374     ].
  1374     ].
  1375 
  1375 
  1376     "Modified: / 29.4.1997 / 11:16:52 / dq"
  1376     "Modified: / 29-04-1997 / 11:16:52 / dq"
  1377     "Modified: / 8.3.1999 / 01:36:05 / cg"
  1377     "Modified: / 20-12-2010 / 14:40:22 / cg"
  1378 !
  1378 !
  1379 
  1379 
  1380 viewSpacing
  1380 viewSpacing
  1381     "return a convenient number of pixels used to separate views (usually 1mm).
  1381     "return a convenient number of pixels used to separate views (usually 1mm).
  1382      Having this value here at a common place makes certain that all views
  1382      Having this value here at a common place makes certain that all views
 10738 ! !
 10738 ! !
 10739 
 10739 
 10740 !SimpleView class methodsFor:'documentation'!
 10740 !SimpleView class methodsFor:'documentation'!
 10741 
 10741 
 10742 version
 10742 version
 10743     ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.680 2010-12-09 17:14:27 cg Exp $'
 10743     ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.681 2010-12-20 13:40:45 cg Exp $'
 10744 !
 10744 !
 10745 
 10745 
 10746 version_CVS
 10746 version_CVS
 10747     ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.680 2010-12-09 17:14:27 cg Exp $'
 10747     ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.681 2010-12-20 13:40:45 cg Exp $'
 10748 ! !
 10748 ! !
 10749 
 10749 
 10750 SimpleView initialize!
 10750 SimpleView initialize!