AbstractLauncherApplication.st
changeset 2395 958d743c03a6
parent 2382 bd2cfbff7a0f
child 2435 0c1aa09bf9e0
--- a/AbstractLauncherApplication.st	Thu Sep 16 16:05:47 1999 +0200
+++ b/AbstractLauncherApplication.st	Fri Sep 17 11:45:14 1999 +0200
@@ -2067,9 +2067,9 @@
     box addVerticalSpace; addHorizontalLine; addVerticalSpace.
 
     (box addTextLabel:(resources string:'Screen: depth: %1 visual: %2  (%3)'
-                                 with:Screen current depth printString
-                                 with:Screen current visualType
-                                 with:Screen current serverVendor))
+                                 with:screen depth printString
+                                 with:screen visualType
+                                 with:screen serverVendor))
         adjust:#left.
 
     box addVerticalSpace; addHorizontalLine; addVerticalSpace.
@@ -2465,112 +2465,114 @@
     listOfLanguages := listOfLanguages asOrderedCollection.
 
     translatedLanguages := listOfLanguages collect:[:lang | |item|
-					item := resources at:lang.
-					item isString ifTrue:[
-					    item
-					] ifFalse:[
-					    item at:1
-					]
-				].
+                                        item := resources at:lang.
+                                        item isString ifTrue:[
+                                            item
+                                        ] ifFalse:[
+                                            item at:1
+                                        ]
+                                ].
     flags := listOfLanguages collect:[:lang | |item|
-					item := resources at:lang.
-					item isArray ifTrue:[
-					    item at:2
-					] ifFalse:[
-					    nil
-					]
-				].
+                                        item := resources at:lang.
+                                        item isArray ifTrue:[
+                                            item at:2
+                                        ] ifFalse:[
+                                            nil
+                                        ]
+                                ].
     flags := flags collect:[:nm | nm notNil ifTrue:[Image fromFile:nm] ifFalse:[nil]].
 
     languageList := translatedLanguages with:flags collect:[:lang :flag |
-				LabelAndIcon icon:flag string:lang.
-			].
+                                LabelAndIcon icon:flag string:lang.
+                        ].
 
     box := ListSelectionBox title:(resources at:'LANG_MSG' default:'select a language') withCRs.
     box label:(resources string:'Language selection').
     box list:languageList.
     box initialText:(Language , '-' , LanguageTerritory).
     box action:[:newLanguage |
-	requestor withWaitCursorDo:[
-	    |fontPref idx language oldLanguage territory enc answer matchingFonts l|
-
-	    idx := translatedLanguages indexOf:newLanguage withoutSeparators.
-	    idx ~~ 0 ifTrue:[
-		language := listOfLanguages at:idx
-	    ] ifFalse:[
-		language := newLanguage
-	    ].
-	    (language includes:$-) ifTrue:[
-		l := language asCollectionOfSubstringsSeparatedBy:$-.
-		language := l at:1.
-		territory := l at:2.
-	    ].
-	    territory isNil ifTrue:[
-		territory := language copyTo:2
-	    ].
-
-	    "/ check if the new language needs a differently encoded font;
-	    "/ ask user to switch font and allow cancellation.
-	    "/ Otherwise, you are left with unreadable menu & button items ...
-
-	    oldLanguage := Smalltalk language.
-	    Smalltalk language:language asSymbol.
-	    ResourcePack flushCachedResourcePacks.
-	    "/ refetch resources ...
-	    resources := requestor class classResources.
-	    fontPref := resources at:'PREFERRED_FONT_ENCODING' default:'iso8859*'.
-	    Smalltalk language:oldLanguage.
-
-	    switch := true.
-	    enc := MenuView defaultFont encoding.
-	    (fontPref match:enc) ifFalse:[
-		"/ look if there is one at all.
-		matchingFonts := Screen current listOfAvailableFonts select:[:f | fontPref match:f encoding].
-		matchingFonts size == 0 ifTrue:[
-		    "/ flush and try again - just in case, the font path has changed.
-		    Screen current flushListOfAvailableFonts.
-		    matchingFonts := Screen current listOfAvailableFonts select:[:f | fontPref match:f encoding].
-		].
-		matchingFonts size == 0 ifTrue:[
-		    (Dialog 
-			confirm:(resources 
-				    string:'Your display does not offer any %1-encoded font.\\Change the language anyway ?\ (texts will probably be unreadable then)'
-				      with:fontPref) withCRs)
-		    ifFalse:[
-			switch := false
-		    ]
-		] ifFalse:[
-		    answer := Dialog 
-				confirmWithCancel:(resources 
-							string:'menu font is not %1-encoded.\\Change it ?'
-							with:fontPref) withCRs
-					   labels:(resources
-							array:#('cancel' 'no' 'yes'))
-					   default:3.
-		    answer isNil ifTrue:[
-			switch := false
-		    ] ifFalse:[
-			answer ifTrue:[
-			    switch := (requestor fontBoxForEncoding:fontPref)
-			]
-		    ].
-		].
-	    ].
-
-	    switch ifTrue:[
-		Transcript showCR:'change language to ' , newLanguage , ' ...'.
-		Smalltalk language:language asSymbol.
-		Smalltalk languageTerritory:territory asSymbol.
-		ResourcePack flushCachedResourcePacks
-	    ].
-	].
-	switch ifTrue:[
-	    requestor reopenLauncher.
-	    DebugView newDebugger.
-	]
+        requestor withWaitCursorDo:[
+            |fontPref idx language oldLanguage territory enc 
+             answer matchingFonts l screen|
+
+            idx := translatedLanguages indexOf:newLanguage withoutSeparators.
+            idx ~~ 0 ifTrue:[
+                language := listOfLanguages at:idx
+            ] ifFalse:[
+                language := newLanguage
+            ].
+            (language includes:$-) ifTrue:[
+                l := language asCollectionOfSubstringsSeparatedBy:$-.
+                language := l at:1.
+                territory := l at:2.
+            ].
+            territory isNil ifTrue:[
+                territory := language copyTo:2
+            ].
+
+            "/ check if the new language needs a differently encoded font;
+            "/ ask user to switch font and allow cancellation.
+            "/ Otherwise, you are left with unreadable menu & button items ...
+
+            oldLanguage := Smalltalk language.
+            Smalltalk language:language asSymbol.
+            ResourcePack flushCachedResourcePacks.
+            "/ refetch resources ...
+            resources := requestor class classResources.
+            fontPref := resources at:'PREFERRED_FONT_ENCODING' default:'iso8859*'.
+            Smalltalk language:oldLanguage.
+
+            switch := true.
+            enc := MenuView defaultFont encoding.
+            (fontPref match:enc) ifFalse:[
+                "/ look if there is one at all.
+                screen := Screen current.
+                matchingFonts := screen listOfAvailableFonts select:[:f | fontPref match:f encoding].
+                matchingFonts size == 0 ifTrue:[
+                    "/ flush and try again - just in case, the font path has changed.
+                    screen flushListOfAvailableFonts.
+                    matchingFonts := screen listOfAvailableFonts select:[:f | fontPref match:f encoding].
+                ].
+                matchingFonts size == 0 ifTrue:[
+                    (Dialog 
+                        confirm:(resources 
+                                    string:'Your display does not offer any %1-encoded font.\\Change the language anyway ?\ (texts will probably be unreadable then)'
+                                      with:fontPref) withCRs)
+                    ifFalse:[
+                        switch := false
+                    ]
+                ] ifFalse:[
+                    answer := Dialog 
+                                confirmWithCancel:(resources 
+                                                        string:'menu font is not %1-encoded.\\Change it ?'
+                                                        with:fontPref) withCRs
+                                           labels:(resources
+                                                        array:#('cancel' 'no' 'yes'))
+                                           default:3.
+                    answer isNil ifTrue:[
+                        switch := false
+                    ] ifFalse:[
+                        answer ifTrue:[
+                            switch := (requestor fontBoxForEncoding:fontPref)
+                        ]
+                    ].
+                ].
+            ].
+
+            switch ifTrue:[
+                Transcript showCR:'change language to ' , newLanguage , ' ...'.
+                Smalltalk language:language asSymbol.
+                Smalltalk languageTerritory:territory asSymbol.
+                ResourcePack flushCachedResourcePacks
+            ].
+        ].
+        switch ifTrue:[
+            requestor reopenLauncher.
+            DebugView newDebugger.
+        ]
     ].    
     box
-	addHelpButtonFor:'Launcher/languageSetting.html'.
+        addHelpButtonFor:'Launcher/languageSetting.html'.
     box open.
     box destroy
 
@@ -2750,9 +2752,10 @@
     |box check shadows takeFocus focusFollowsMouse returnFocus  
      hostNameInLabel showAccelerators 
      preemptive dynamicPrios hostNameInLabelHolder resources y
-     activateOnClick opaqueVariablePanelResize|
+     activateOnClick opaqueVariablePanelResize currentUserPrefs|
 
     resources := requestor class classResources.
+    currentUserPrefs := UserPreferences current.
 
     "/ 
     "/ extract relevant system settings ...
@@ -2762,9 +2765,9 @@
     hostNameInLabelHolder := hostNameInLabel asValue.
     returnFocus := StandardSystemView returnFocusWhenClosingModalBoxes asValue.
     takeFocus := StandardSystemView takeFocusWhenMapped asValue.
-    focusFollowsMouse := (UserPreferences current focusFollowsMouse ? true) asValue.
+    focusFollowsMouse := (currentUserPrefs focusFollowsMouse ? true) asValue.
     activateOnClick := (Display activateOnClick:nil) asValue.
-    opaqueVariablePanelResize := UserPreferences current opaqueVariablePanelResizing asValue.
+    opaqueVariablePanelResize := currentUserPrefs opaqueVariablePanelResizing asValue.
 
     showAccelerators := MenuView showAcceleratorKeys asValue.
     preemptive := Processor isTimeSlicing asValue.
@@ -2824,11 +2827,11 @@
             ]
         ].
 
-        UserPreferences current opaqueVariablePanelResizing:opaqueVariablePanelResize value.
+        currentUserPrefs opaqueVariablePanelResizing:opaqueVariablePanelResize value.
 
         StandardSystemView returnFocusWhenClosingModalBoxes:returnFocus value.
         StandardSystemView takeFocusWhenMapped:takeFocus value.
-        UserPreferences current focusFollowsMouse:focusFollowsMouse value.
+        currentUserPrefs focusFollowsMouse:focusFollowsMouse value.
         Screen current activateOnClick:(activateOnClick value).
 
         MenuView showAcceleratorKeys:showAccelerators value.
@@ -3165,9 +3168,10 @@
      Will move entries over to UserPreferences over time;
      new items should always go there."
 
-    |s screen fileName resources|
+    |s screen fileName resources currentUserPrefs|
 
     resources := requestor class classResources.
+    currentUserPrefs := UserPreferences current.
 
     fileName := Dialog 
         requestFileName:(resources string:'save settings in:') 
@@ -3283,8 +3287,8 @@
     s nextPutLine:'"/'.
     s nextPutLine:'EditTextView st80Mode: ' , (EditTextView st80Mode storeString) , '.'.
     s nextPutLine:'TextView st80SelectMode: ' , (TextView st80SelectMode storeString) , '.'.
-    s nextPutLine:'UserPreferences current syntaxColoring: ' , (UserPreferences current syntaxColoring storeString) , '.'.
-    UserPreferences current keysAndValuesDo:[:k :v |
+    s nextPutLine:'UserPreferences current syntaxColoring: ' , (currentUserPrefs syntaxColoring storeString) , '.'.
+    currentUserPrefs keysAndValuesDo:[:k :v |
         s nextPutLine:'UserPreferences current at:' , k storeString , ' put:' , v storeString , '.'.
     ].
 
@@ -3292,8 +3296,8 @@
     s nextPutLine:'"/'.
     s nextPutLine:'"/ Tool settings:'.
     s nextPutLine:'"/'.
-    s nextPutLine:'UserPreferences current useNewInspector: ' , (UserPreferences current useNewInspector storeString) , '.'.
-    s nextPutLine:'UserPreferences current useNewChangesBrowser: ' , (UserPreferences current useNewChangesBrowser storeString) , '.'.
+    s nextPutLine:'UserPreferences current useNewInspector: ' , (currentUserPrefs useNewInspector storeString) , '.'.
+    s nextPutLine:'UserPreferences current useNewChangesBrowser: ' , (currentUserPrefs useNewChangesBrowser storeString) , '.'.
 
     s cr.
     s nextPutLine:'"/'.
@@ -3311,7 +3315,7 @@
 
       nextPutLine:'StandardSystemView returnFocusWhenClosingModalBoxes: ' , (StandardSystemView returnFocusWhenClosingModalBoxes storeString) , '.';
       nextPutLine:'StandardSystemView takeFocusWhenMapped: ' , (StandardSystemView takeFocusWhenMapped storeString) , '.';
-      nextPutLine:'UserPreferences current focusFollowsMouse: ' , (UserPreferences current focusFollowsMouse ? true) storeString , '.';
+      nextPutLine:'UserPreferences current focusFollowsMouse: ' , (currentUserPrefs focusFollowsMouse ? true) storeString , '.';
       nextPutLine:'Display activateOnClick: ' , ((Display activateOnClick:nil) storeString) , '.';
       nextPutLine:'MenuView showAcceleratorKeys: ' , (MenuView showAcceleratorKeys storeString) , '.';
       nextPutLine:'Class tryLocalSourceFirst: ' , (Class tryLocalSourceFirst storeString) , '.'.
@@ -3828,7 +3832,7 @@
     useNewInspector := currentUserPrefs useNewInspector asValue.
     useNewChangesBrowser := currentUserPrefs useNewChangesBrowser asValue.
     showClockInLauncher := currentUserPrefs showClockInLauncher asValue.
-    useNewVersionDiffBrowser := UserPreferences current useNewVersionDiffBrowser asValue.
+    useNewVersionDiffBrowser := currentUserPrefs useNewVersionDiffBrowser asValue.
 
     "/
     "/ create a box on those values ...
@@ -4628,9 +4632,10 @@
      syntaxColor syntaxColors colorMenu oldUserPreferences
      syntaxEmphasises syntaxColorSelector syntaxEmphasisSelector syntaxColoringBox
      syntaxEmphasisesBox syntaxColoringResetButton b resetList
-     resetListBox|
+     resetListBox currentUserPrefs|
 
     resources := requestor class classResources.
+    currentUserPrefs := UserPreferences current.
 
     exampleText := 
 'methodSelector:methodArg
@@ -4676,20 +4681,20 @@
 
     box addVerticalSpace.
 
-    oldUserPreferences := UserPreferences current copy.
+    oldUserPreferences := currentUserPrefs copy.
 
     syntaxColoringBox := box addComboListOn: (syntaxColors := SelectionInList with:UserPreferences syntaxColorNames initialSelection:1).
     syntaxColorSelector    := [(syntaxColors selection replChar:$  withString: '') asLowercaseFirst asSymbol].
     syntaxEmphasisSelector := [((syntaxColorSelector value readStream upToAll: 'Color'), 'Emphasis') asLowercaseFirst asSymbol].
-    syntaxColor := (UserPreferences current perform: syntaxColorSelector value) asValue.
+    syntaxColor := (currentUserPrefs perform: syntaxColorSelector value) asValue.
     colorMenu := ColorMenu new.
     colorMenu model: syntaxColor.
     syntaxColor onChangeSend: #value to: 
-        [UserPreferences current at:  syntaxColorSelector value put: syntaxColor value.
+        [currentUserPrefs at:  syntaxColorSelector value put: syntaxColor value.
          recolorAction value.].
     syntaxColors onChangeSend: #value to: 
-        [syntaxColor value: (UserPreferences current perform:syntaxColorSelector value).
-         syntaxEmphasises selection: (UserPreferences current perform: syntaxEmphasisSelector value).
+        [syntaxColor value: (currentUserPrefs perform:syntaxColorSelector value).
+         syntaxEmphasises selection: (currentUserPrefs perform: syntaxEmphasisSelector value).
          recolorAction value.].
 
     syntaxEmphasises := SelectionInList 
@@ -4724,7 +4729,7 @@
             em == #'italic+red underline' ifTrue:[ em := Array with:#italic with:#underline with:(#underlineColor->Color red)].
             em == #'italic+red underwave' ifTrue:[ em := Array with:#italic with:#underwave with:(#underlineColor->Color red)].
 
-            UserPreferences current at: syntaxEmphasisSelector value put:em.
+            currentUserPrefs at: syntaxEmphasisSelector value put:em.
             recolorAction value
         ].
     syntaxColors changed:#value. "/ to force initial update of emphasis
@@ -4741,9 +4746,8 @@
                                 #resetSyntaxColorsGreenComments
                                 #resetSyntaxColorsAllBlackExceptBadIDs
                           ) at:resetList selectionIndex.
-        UserPreferences current perform:resetSelector. 
-        syntaxColor value:(UserPreferences current 
-                                perform:syntaxColorSelector value).
+        currentUserPrefs perform:resetSelector. 
+        syntaxColor value:(currentUserPrefs perform:syntaxColorSelector value).
         recolorAction value.
     ].
     syntaxColoringResetButton := box addComponent:b.
@@ -4800,5 +4804,5 @@
 !AbstractLauncherApplication class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/AbstractLauncherApplication.st,v 1.81 1999-09-08 17:42:01 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/AbstractLauncherApplication.st,v 1.82 1999-09-17 09:45:14 cg Exp $'
 ! !