added save/restore settings
authorClaus Gittinger <cg@exept.de>
Sat, 09 Nov 1996 01:47:37 +0100
changeset 853 70c241a0bafc
parent 852 7d4990a06c01
child 854 f461c1789660
added save/restore settings
Launcher.st
--- a/Launcher.st	Sat Nov 09 00:53:25 1996 +0100
+++ b/Launcher.st	Sat Nov 09 01:47:37 1996 +0100
@@ -2219,6 +2219,210 @@
     "Modified: 9.9.1996 / 22:43:51 / stefan"
 !
 
+restoreSettings
+    "a temporary kludge - we need a central systemSettings object for this,
+     which can be saved/restored with a single store/read."
+
+    |fileName|
+
+    fileName := Dialog 
+        requestFileName:(resources string:'name of the settings file:') 
+        default:'settings.stx'
+        ok:(resources string:'restore') 
+        abort:(resources string:'cancel') 
+        pattern:'*.stx'
+        fromDirectory:nil.
+
+    (fileName isNil or:[fileName isEmpty]) ifTrue:[
+        "/ canceled
+        ^ self
+    ].
+
+    self withWaitCursorDo:[
+        Smalltalk fileIn:fileName.
+
+        self reopenLauncher.
+    ].
+
+    "Modified: 9.11.1996 / 01:46:18 / cg"
+!
+
+saveSettings
+    "a temporary kludge - we need a central systemSettings object for this,
+     which can be saved/restored with a single store/read."
+
+    |s screen fileName|
+
+    fileName := Dialog 
+        requestFileName:(resources string:'name of the settings file:') 
+        default:'settings.stx'
+        ok:(resources string:'save') 
+        abort:(resources string:'cancel') 
+        pattern:'*.stx'
+        fromDirectory:nil.
+
+    (fileName isNil or:[fileName isEmpty]) ifTrue:[
+        "/ canceled
+        ^ self
+    ].
+
+    s := fileName asFilename writeStream.
+    s isNil ifTrue:[
+        self warn:'cannot write the ''' , fileName , ''' file'.
+        ^ self
+    ].
+
+    s nextPutLine:'"/ ST/X saved settings';
+      nextPutLine:'"/ DO NOT MODIFY MANUALLY';
+      nextPutLine:'"/';
+      nextPutLine:'"/ this file was automatically generated by the';
+      nextPutLine:'"/ ''save settings'' function of the Launcher';
+      nextPutLine:'"/'.
+    s cr.
+
+    s nextPutLine:'"/'.
+    s nextPutLine:'"/ saved by ' , OperatingSystem getLoginName , '@' , OperatingSystem getHostName , ' at ' , AbsoluteTime now printString.
+    s nextPutLine:'"/'.
+    s cr.
+
+    s nextPutLine:'"/'.
+    s nextPutLine:'"/ Display settings:'.
+    s nextPutLine:'"/'.
+    s nextPutLine:'"/ only restore the display settings, if on the same Display ...'.
+    s nextPutLine:'Display displayName = ' , (Display displayName storeString) , ' ifTrue:['.
+      screen := Screen current.
+      screen fixColors notNil ifTrue:[
+        s nextPutLine:'  Image flushDeviceImages.'.
+        s nextPutLine:'  Color colorAllocationFailSignal catch:['.
+        s nextPutLine:'    Color getColorsRed:6 green:6 blue:4 on:Display'.
+        s nextPutLine:'  ].'.
+      ] ifFalse:[
+        s nextPutLine:'  Display releaseFixColors.'.
+      ].
+      s nextPutLine:'  Display hasColors: ' , (screen hasColors storeString) , '.'.
+      s nextPutLine:'  Display widthInMillimeter: ' , (screen widthInMillimeter storeString) , '.'.
+      s nextPutLine:'  Display heightInMillimeter: ' , (screen heightInMillimeter storeString) , '.'.
+      s nextPutLine:'  Display supportsDeepIcons: ' , (screen supportsDeepIcons storeString) , '.'.
+      s nextPutLine:'  Image ditherAlgorithm: ' , (Image ditherAlgorithm storeString) , '.'.
+      s nextPutLine:'  View defaultStyle:(View defaultStyle). "/ to flush any device images'.
+    s nextPutLine:'].'.
+    s cr.
+
+    s nextPutLine:'"/'.
+    s nextPutLine:'"/ Compiler settings:'.
+    s nextPutLine:'"/'.
+    s nextPutLine:'Compiler warnSTXSpecials: ' , (Compiler warnSTXSpecials storeString) , '.';
+      nextPutLine:'Compiler warnUnderscoreInIdentifier: ' , (Compiler warnUnderscoreInIdentifier storeString) , '.';
+      nextPutLine:'Compiler warnOldStyleAssignment: ' , (Compiler warnOldStyleAssignment storeString) , '.';
+      nextPutLine:'Compiler warnCommonMistakes: ' , (Compiler warnCommonMistakes storeString) , '.';
+      nextPutLine:'Compiler allowUnderscoreInIdentifier: ' , (Compiler allowUnderscoreInIdentifier storeString) , '.';
+      nextPutLine:'Compiler arraysAreImmutable: ' , (Compiler arraysAreImmutable storeString) , '.';
+      nextPutLine:'Compiler lineNumberInfo: ' , (Compiler lineNumberInfo storeString) , '.';
+
+      nextPutLine:'Compiler foldConstants: ' , (Compiler foldConstants storeString) , '.';
+
+      nextPutLine:'Compiler stcCompilationIncludes: ' , (Compiler stcCompilationIncludes storeString) , '.';
+      nextPutLine:'Compiler stcCompilationDefines: ' , (Compiler stcCompilationDefines storeString) , '.';
+      nextPutLine:'Compiler stcCompilationOptions: ' , (Compiler stcCompilationOptions storeString) , '.';
+      nextPutLine:'Compiler ccCompilationOptions: ' , (Compiler ccCompilationOptions storeString) , '.';
+      nextPutLine:'Compiler ccPath: ' , (Compiler ccPath storeString) , '.';
+
+      nextPutLine:'ObjectMemory justInTimeCompilation: ' , (ObjectMemory justInTimeCompilation storeString) , '.';
+      nextPutLine:'ObjectMemory fullSingleStepSupport: ' , (ObjectMemory fullSingleStepSupport storeString) , '.'.
+
+    HistoryManager isActive ifTrue:[
+        s nextPutLine:'HistoryManager activate.'.
+    ] ifFalse:[
+        s nextPutLine:'HistoryManager deactivate.'.
+    ].
+
+    ObjectFileLoader notNil ifTrue:[
+        s nextPutLine:'ObjectFileLoader searchedLibraries: ' , (ObjectFileLoader searchedLibraries storeString) , '.'.
+        s nextPutLine:'ObjectFileLoader libPath: ' , (ObjectFileLoader libPath storeString) , '.'.
+    ].
+
+    s nextPutLine:'Class catchMethodRedefinitions: ' , (Class catchMethodRedefinitions storeString) , '.'.
+    s nextPutLine:'ClassCategoryReader sourceMode: ' , (ClassCategoryReader sourceMode storeString) , '.'.
+
+    s cr.
+    s nextPutLine:'"/'.
+    s nextPutLine:'"/ Info & Debug Messages:'.
+    s nextPutLine:'"/'.
+    s nextPutLine:'ObjectMemory infoPrinting: ' , (ObjectMemory infoPrinting storeString) , '.';
+      nextPutLine:'ObjectMemory debugPrinting: ' , (ObjectMemory debugPrinting storeString) , '.';
+      nextPutLine:'Object infoPrinting: ' , (Object infoPrinting storeString) , '.';
+      nextPutLine:'DeviceWorkstation errorPrinting: ' , (DeviceWorkstation errorPrinting storeString) , '.'.
+
+
+    s cr.
+    s nextPutLine:'"/'.
+    s nextPutLine:'"/ Misc settings:'.
+    s nextPutLine:'"/'.
+    s nextPutLine:'Class keepMethodHistory: ' , (Class methodHistory notNil storeString) , '.';
+      nextPutLine:'Smalltalk logDoits: ' , (Smalltalk logDoits storeString) , '.';
+      nextPutLine:'Autoload compileLazy: ' , (Autoload compileLazy storeString) , '.';
+      nextPutLine:'Smalltalk loadBinaries: ' , (Smalltalk loadBinaries storeString) , '.';
+      nextPutLine:'StandardSystemView includeHostNameInLabel: ' , (StandardSystemView includeHostNameInLabel storeString) , '.';
+
+      "/ claus - I dont think its a good idea to save those ...
+      nextPutLine:'"/ Class updateChanges: ' , (Class updatingChanges storeString) , '.';
+      nextPutLine:'"/ ObjectMemory nameForChanges: ' , (ObjectMemory nameForChanges storeString) , '.';
+
+      nextPutLine:'Dialog returnFocusWhenClosingModalBoxes: ' , (Dialog returnFocusWhenClosingModalBoxes storeString) , '.';
+      nextPutLine:'MenuView showAcceleratorKeys: ' , (MenuView showAcceleratorKeys storeString) , '.';
+      nextPutLine:'Class tryLocalSourceFirst: ' , (Class tryLocalSourceFirst storeString) , '.'.
+
+    s cr.
+    s nextPutLine:'"/'.
+    s nextPutLine:'"/ Printer settings:'.
+    s nextPutLine:'"/'.
+    s nextPutLine:'Printer := ' , (Printer name) , '.';
+      nextPutLine:'Printer printCommand: ' , (Printer printCommand storeString) , '.'.
+
+    Printer supportsPageSizes ifTrue:[
+        s nextPutLine:'Printer pageFormat: ' , (Printer pageFormat storeString) , '.'.
+        s nextPutLine:'Printer landscape: ' , (Printer landscape storeString) , '.'.
+    ].
+    Printer supportsMargins ifTrue:[
+        s nextPutLine:'Printer topMargin: ' , (Printer topMargin storeString) , '.'.
+        s nextPutLine:'Printer leftMargin: ' , (Printer leftMargin storeString) , '.'.
+        s nextPutLine:'Printer rightMargin: ' , (Printer rightMargin storeString) , '.'.
+        s nextPutLine:'Printer bottomMargin: ' , (Printer bottomMargin storeString) , '.'.
+    ].
+    Printer supportsPostscript ifTrue:[
+        s nextPutLine:'Printer supportsColor: ' , (Printer supportsColor storeString) , '.'.
+    ].
+
+    s cr.
+    s nextPutLine:'"/'.
+    s nextPutLine:'"/ Font settings:'.
+    s nextPutLine:'"/'.
+    s nextPutLine:'View defaultFont: ' , (View defaultFont storeString) , '.'.
+    s nextPutLine:'Label defaultFont: ' , (Label defaultFont storeString) , '.'.
+    s nextPutLine:'Button defaultFont: ' , (Button defaultFont storeString) , '.'.
+    s nextPutLine:'Toggle defaultFont: ' , (Toggle defaultFont storeString) , '.'.
+    s nextPutLine:'SelectionInListView defaultFont: ' , (SelectionInListView defaultFont storeString) , '.'.
+    s nextPutLine:'MenuView defaultFont: ' , (MenuView defaultFont storeString) , '.'.
+    s nextPutLine:'PullDownMenu defaultFont: ' , (PullDownMenu defaultFont storeString) , '.'.
+    s nextPutLine:'TextView defaultFont: ' , (TextView defaultFont storeString) , '.'.
+    s nextPutLine:'EditTextView defaultFont: ' , (EditTextView defaultFont storeString) , '.'.
+    s nextPutLine:'CodeView defaultFont: ' , (CodeView defaultFont storeString) , '.'.
+
+    s cr.
+    s nextPutLine:'"/'.
+    s nextPutLine:'"/ Language setting:'.
+    s nextPutLine:'"/'.
+    s nextPutLine:'Smalltalk language: ' , (Smalltalk language storeString) , '.'.
+    s nextPutLine:'Smalltalk languageTerritory: ' , (Smalltalk languageTerritory storeString) , '.'.
+    s close.
+
+    "
+     Transcript topView application saveSettings
+    "
+
+    "Modified: 9.11.1996 / 01:44:38 / cg"
+!
+
 viewStyleSetting 
     |listOfStyles resourceDir dir box 
      list listView scrView infoLabel infoForwarder newStyle|
@@ -3268,6 +3472,9 @@
                                         'object memory ...'
                                         'screen ...'
                                         'misc ...'
+                                        '='
+                                        'save settngs ...'
+                                        'restore settngs ...'
                                         ))
            selectors:#(
                                         #languageSetting 
@@ -3279,7 +3486,10 @@
                                         #compilerSettings 
                                         #memorySettings 
                                         #displaySettings 
-                                        #miscSettings 
+                                        #miscSettings
+                                        nil
+                                        #saveSettings 
+                                        #restoreSettings 
                       )
            receiver:self.
 
@@ -3342,7 +3552,7 @@
 
     self disableDangerousMenuItemsInRemoteLauncher
 
-    "Modified: 18.10.1996 / 14:13:30 / cg"
+    "Modified: 9.11.1996 / 01:25:32 / cg"
 !
 
 setupOtherViewsIn:aTopView
@@ -3749,5 +3959,5 @@
 !Launcher class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Launcher.st,v 1.212 1996-11-07 18:49:57 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Launcher.st,v 1.213 1996-11-09 00:47:37 cg Exp $'
 ! !