SimpleView.st
changeset 5978 d82030712cd6
parent 5976 fc2bc2186bfa
child 6050 6d4531c62a46
--- a/SimpleView.st	Fri Jan 04 17:23:58 2013 +0100
+++ b/SimpleView.st	Mon Jan 07 16:06:21 2013 +0100
@@ -1289,6 +1289,52 @@
     self updateAllStyleCaches.
 !
 
+updateAllStyleCaches
+    "reload all style caches in all view classes.
+     Needed after a style change or when a style file has been changed"
+
+    (Screen isNil or:[Screen current isNil]) ifTrue:[^ self].
+
+    "
+     tell all view classes to flush any
+     cached style-data
+    "
+    self changed:#style.
+    SimpleView updateStyleCache.
+    SimpleView allSubclassesDo:[:aClass |
+        "JV@2010-12-02: Removed to avoid lost of preferred fonts on image restart"
+        "/ cg: no, this is required!!!!!!
+        "/ otherwise, we get ugly courier fonts on windows
+        "/ updateStyleCache MUST clear any previously
+        "/ cached font values, otherwise you cannot load a style's font.
+        "/ if you want to keep your fonts, do it elsewhere (keep some userFontPrefs and restore from there)
+
+        "/ JV: Font preferences ARE already saved in user's setting.rc/setting.stx, but they
+        "/     are not reloaded on snapshot restart (which is correct, I think).
+        "/     This just discard such fonts. I would say calling this upon snapshot restart
+        "/     is a bad idea. Workaround it only for me is not a solution as all other
+        "/     Linux users are ... off. Let's workaround it:
+        (Smalltalk isInitialized not and:
+            [OperatingSystem getOSType == #linux and:
+                [UserPreferences current linuxFontWorkaround]])
+                    ifFalse:[
+                        aClass defaultFont:nil.
+                    ].
+
+        (aClass class includesSelector:#updateStyleCache) ifTrue:[
+            aClass updateStyleCache
+        ].
+    ]
+
+    "
+     View updateAllStyleCaches
+    "
+
+    "Modified: / 15-09-1998 / 22:04:15 / cg"
+    "Modified (format): / 05-10-2011 / 16:08:47 / az"
+    "Modified (format): / 30-03-2012 / 17:31:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 updateStyleCache
     "this method gets some heavily used style stuff and keeps
      it in class-variables for faster access.
@@ -10946,11 +10992,11 @@
 !SimpleView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.715 2013-01-04 16:23:44 vrany Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.716 2013-01-07 15:06:21 vrany Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.715 2013-01-04 16:23:44 vrany Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.716 2013-01-07 15:06:21 vrany Exp $'
 !
 
 version_SVN