--- a/ApplicationModel.st Wed Sep 15 13:09:51 2021 +0100
+++ b/ApplicationModel.st Fri Sep 17 23:06:42 2021 +0100
@@ -167,79 +167,6 @@
defaultKeyboardMap := KeyboardMap new.
"Created: / 04-02-2017 / 22:46:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-initializeDefaultStyleSheet
- "
- Initialize default style sheet.
-
- The default stylesheet is looked up in package's 'styles' directory
- as follows:
- 1. look for style file with the same name as current view's style,
- for example, if current view style is 'Adwaita.style' then look
- for file named 'Adwaita.style'.
- 2. look for style named either 'light.style' (for light themes, the
- default) or 'dark.style' for (dark themes), depending on current
- style variant
- 3. look for style name 'default.style'. Note, that 'default.style' may
- still contain conditional definitions based on theme variant.
-
- The stylesheet has superclasses' stylesheet defined as it's superpack,
- and ApplicationModel's stylesheet is linked to the current view stylesheet
- (that is, to `SimpleView styleSheet`). This is done prior reading any individual
- style files so style files can use abstract definitios (like 'viewBackground')
- from current style.
- "
-
- | stylesDir style |
-
- style := ViewStyle new.
- style packsClassName: self name.
- self == ApplicationModel ifTrue: [
- style superPack: SimpleView styleSheet
- ] ifFalse: [
- style superPack: self superclass defaultStyleSheet.
- ].
-
-
- stylesDir := Smalltalk getPackageDirectoryForPackage: self package.
- stylesDir notNil ifTrue: [ stylesDir := stylesDir / 'styles' ].
- (stylesDir notNil and:[ stylesDir isDirectory ]) ifTrue: [
- | styleFile |
-
- styleFile := stylesDir / (SimpleView styleSheet name , '.style').
- styleFile exists ifFalse: [
- styleFile := stylesDir / ((SimpleView styleSheet at:'variant') = 'dark' ifTrue:['dark.style'] ifFalse:[ 'light.style' ]).
- styleFile exists ifFalse: [
- styleFile := stylesDir / 'default.style'
- ]
- ].
- "/ Avoid reading stylesheet if it's the same as superclasses one
- (style superPack notNil
- and:[ style superPack packsFileName notNil
- and:[ style superPack packsFileName asFilename = styleFile ] ]) ifTrue: [
- "/ Okay, packs are the same - no need to read it again
- ] ifFalse: [
- "/ No, superpack is different. Read the contents
- styleFile exists ifTrue: [
- | failedToRead |
-
- failedToRead := (style readFromFile: styleFile baseName directory: styleFile directory) isNil.
-
- style name: styleFile withoutSuffix baseName.
- style at:#fileReadFailed put:failedToRead.
- ].
- ].
- ].
- defaultStyleSheet := style.
-
- "
- ApplicationModel flushDefaultStyleSheet
- Tools::NewSystemBrowser initializeDefaultStyleSheet; defaultStyleSheet
- "
-
- "Created: / 15-09-2021 / 12:06:39 / Jan Vrany <jan.vrany@labware.com>"
- "Modified (comment): / 15-09-2021 / 13:08:10 / Jan Vrany <jan.vrany@labware.com>"
! !
!ApplicationModel class methodsFor:'instance creation'!
@@ -294,6 +221,18 @@
^ defaultStyleSheet
"Created: / 15-09-2021 / 11:47:04 / Jan Vrany <jan.vrany@labware.com>"
+!
+
+initializeDefaultStyleSheet
+ defaultStyleSheet := ViewStyle for: self.
+
+ "
+ ApplicationModel flushDefaultStyleSheet
+ Tools::NewSystemBrowser initializeDefaultStyleSheet; defaultStyleSheet
+ "
+
+ "Created: / 15-09-2021 / 12:06:39 / Jan Vrany <jan.vrany@labware.com>"
+ "Modified: / 21-09-2021 / 14:30:41 / Jan Vrany <jan.vrany@labware.com>"
! !
!ApplicationModel class methodsFor:'active help'!