AbstractSettingsApplication.st
changeset 16989 1714bd619d1d
parent 16986 257538e3f185
child 16992 01cd10d0a65a
--- a/AbstractSettingsApplication.st	Sun Oct 30 18:33:20 2016 +0100
+++ b/AbstractSettingsApplication.st	Sun Oct 30 18:33:54 2016 +0100
@@ -1020,10 +1020,46 @@
         self subclassResponsibility.
     ].
     ^ nil.
+!
+
+widgetsWithChangedSettingsDo:aBlock
+    "/ to be redefined in subclasses...
+
+    |mySpec|
+    
+    self hasValuesDifferentFromDefault ifTrue:[
+        mySpec := self class windowSpec decodeAsLiteralArray.
+        (self aspects ? #()) do:[:aspect |
+            |subSpec widget|
+            
+            (UserPreferences default perform:aspect) ~= (currentUserPrefs perform:aspect) ifTrue:[
+                subSpec := mySpec findSpecForWhich:[:spec | spec model = aspect].
+                widget := self window 
+                            allSubViewsDetect:[:w | w name = subSpec name] 
+                            ifNone:nil.
+                aBlock value:widget. 
+            ].    
+        ].    
+    ].
 ! !
 
 !AbstractSettingsApplication methodsFor:'queries'!
 
+hasValuesDifferentFromDefault
+    |savedCurrent answer|
+
+    self hasUnsavedChanges ifTrue:[^ true].
+    
+    savedCurrent := currentUserPrefs.
+    [
+        currentUserPrefs := UserPreferences default.   
+        answer := self hasUnsavedChanges
+    ] ensure:[
+        currentUserPrefs := savedCurrent
+    ].    
+    ^ answer
+!
+
 isEnabledInSettingsDialog:aSettingsDialog
     ^ true
 
@@ -1538,7 +1574,9 @@
 !AbstractSettingsApplication::AutoloadedPackagesSettingsAppl methodsFor:'queries'!
 
 hasUnsavedChanges
-    packageChooser listOfSelectedItems value asArray = UserPreferences current autoloadedPackages asArray ifFalse:[^true].
+    packageChooser notNil ifTrue:[
+        packageChooser listOfSelectedItems value asArray = UserPreferences current autoloadedPackages asArray ifFalse:[^true].
+    ].
     ^ false.
 ! !
 
@@ -5445,9 +5483,9 @@
                          label: '(empty for login-name)'
                          name: 'Label2'
                          layout: (LayoutFrame 354 0 0 0 0 1 30 0)
+                         activeHelpKey: userNameInHistoryLine
                          translateLabel: true
                          adjust: left
-                         activeHelpKey: userNameInHistoryLine
                        )
                       )
                     
@@ -5467,25 +5505,25 @@
                          label: 'FileIn Source Mode:'
                          name: 'FileInSourceModeLabel'
                          layout: (AlignmentOrigin 282 0 15 0 1 0.5)
-                         translateLabel: true
-                         adjust: right
                          activeHelpKey: fileInSourceMode
+                         translateLabel: true
+                         adjust: right
                        )
                       (PopUpListSpec
                          label: 'PopUp List'
                          name: 'KeepSourceSelection'
-                         layout: (LayoutFrame 279 0 0 0 -5 1 30 0)
+                         layout: (LayoutFrame 279 0 1 0 -5 1 30 0)
+                         activeHelpKey: fileInSourceMode
                          translateLabel: true
                          tabable: true
                          model: keepSourceSelection
                          menu: keepSource
                          useIndex: true
-                         activeHelpKey: fileInSourceMode
-                       )
-                      )
-                    
-                   )
-                   extent: (Point 600 30)
+                       )
+                      )
+                    
+                   )
+                   extent: (Point 600 32)
                  )
                 (DividerSpec
                    name: 'Separator1'
@@ -5494,11 +5532,11 @@
                 (CheckBoxSpec
                    label: 'If Present, Load Binary Objects when Autoloading'
                    name: 'LoadBinaryObjectsWhenAutoloading'
+                   activeHelpKey: loadBinaryObjectsWhenAutoloading
                    enableChannel: canLoadBinaries
                    model: loadBinaries
                    translateLabel: true
                    extent: (Point 600 30)
-                   activeHelpKey: loadBinaryObjectsWhenAutoloading
                  )
                 )
               
@@ -11204,9 +11242,7 @@
 !AbstractSettingsApplication::OsiSettingsAppl methodsFor:'actions'!
 
 basicReadSettings
-    self osiACSEPresent value:(OSI::ACSE notNil and:[OSI::ACSE isLoaded]).
-    self osiROSEPresent value:(OSI::ROSE notNil and:[OSI::ROSE isLoaded]).
-    self osiCMISEPresent value:(OSI::CMISE notNil and:[OSI::CMISE isLoaded]).
+    self updateOSIPackagePresentHolders.
     self osiACSEPresent value ifTrue:[
         self osiACSEErrorLogging value:OSI::ACSE errorLogging.
         self osiACSEConnectionLogging value:OSI::ACSE connectionLogging.
@@ -11239,6 +11275,12 @@
         OSI::CMISE errorLogging:self osiCMISEErrorLogging value.
         OSI::CMISE messageLogging:self osiCMISEMessageLogging value.
     ].
+!
+
+updateOSIPackagePresentHolders
+    self osiACSEPresent value:(OSI::ACSE notNil and:[OSI::ACSE isLoaded]).
+    self osiROSEPresent value:(OSI::ROSE notNil and:[OSI::ROSE isLoaded]).
+    self osiCMISEPresent value:(OSI::CMISE notNil and:[OSI::CMISE isLoaded]).
 ! !
 
 !AbstractSettingsApplication::OsiSettingsAppl methodsFor:'aspects'!
@@ -11267,7 +11309,7 @@
 
 osiACSEPresent
     osiACSEPresent isNil ifTrue:[
-        osiACSEPresent := true asValue.
+        osiACSEPresent := OSI::ACSE notNil asValue.
     ].
     ^ osiACSEPresent.
 !
@@ -11288,7 +11330,7 @@
 
 osiCMISEPresent
     osiCMISEPresent isNil ifTrue:[
-        osiCMISEPresent := true asValue.
+        osiCMISEPresent := OSI::CMISE notNil asValue.
     ].
     ^ osiCMISEPresent.
 !
@@ -11310,7 +11352,7 @@
 osiROSEPresent
 
     osiROSEPresent isNil ifTrue:[
-        osiROSEPresent := true asValue.
+        osiROSEPresent := OSI::ROSE notNil asValue.
     ].
     ^ osiROSEPresent.
 !
@@ -11332,19 +11374,26 @@
 !AbstractSettingsApplication::OsiSettingsAppl methodsFor:'queries'!
 
 hasUnsavedChanges
-
-    ^ ((
-        (self osiACSEPresent value and:[
-        self osiACSEErrorLogging value ~= OSI::ACSE errorLogging or:[
-        self osiACSEConnectionLogging value ~= OSI::ACSE connectionLogging or:[
-        self osiACSEDataLogging value ~= OSI::ACSE dataLogging]]]) or:[
-        self osiROSEPresent value and:[
-            self osiROSEErrorLogging value ~= OSI::ROSE errorLogging or:[
-            self osiROSEInvokationLogging value ~= OSI::ROSE invocationLogging or:[
-            self osiROSEResponseLogging value ~= OSI::ROSE responseLogging]]]]) or:[
-        (self osiCMISEPresent value) and:[
-        self osiCMISEErrorLogging value ~= OSI::CMISE errorLogging or:[
-        self osiCMISEMessageLogging value ~= OSI::CMISE messageLogging]]])
+    self updateOSIPackagePresentHolders.
+
+    (self osiACSEPresent value 
+        and:[
+            self osiACSEErrorLogging value ~= OSI::ACSE errorLogging 
+            or:[ self osiACSEConnectionLogging value ~= OSI::ACSE connectionLogging 
+            or:[ self osiACSEDataLogging value ~= OSI::ACSE dataLogging]]]) ifTrue:[^ true].
+
+    (self osiROSEPresent value 
+        and:[
+            self osiROSEErrorLogging value ~= OSI::ROSE errorLogging 
+            or:[ self osiROSEInvokationLogging value ~= OSI::ROSE invocationLogging 
+            or:[ self osiROSEResponseLogging value ~= OSI::ROSE responseLogging]]]) ifTrue:[^ true].
+            
+    (self osiCMISEPresent value 
+        and:[ 
+            self osiCMISEErrorLogging value ~= OSI::CMISE errorLogging 
+            or:[ self osiCMISEMessageLogging value ~= OSI::CMISE messageLogging]])ifTrue:[^ true].
+
+    ^ false.
 ! !
 
 !AbstractSettingsApplication::PackagePathSettingsAppl class methodsFor:'help specs'!
@@ -15817,7 +15866,7 @@
                                         )
                                       
                                      )
-                                     extent: (Point 618 258)
+                                     extent: (Point 622 262)
                                    )
                                   )
                                 
@@ -15950,7 +15999,7 @@
                             (CheckBoxSpec
                                label: 'If Present, Use Local Source (Suppress Checkout)'
                                name: 'CheckBox4'
-                               layout: (LayoutFrame 30 0 0 0 -5 1 30 0)
+                               layout: (LayoutFrame 30 0 1 0 -5 1 29 0)
                                activeHelpKey: useLocalSources
                                enableChannel: useManager
                                model: localSourceFirst
@@ -15959,7 +16008,7 @@
                             )
                           
                          )
-                         extent: (Point 660 30)
+                         extent: (Point 660 32)
                        )
                       (ViewSpec
                          name: 'KeepMethodSourceBox'
@@ -15970,7 +16019,7 @@
                             (CheckBoxSpec
                                label: 'Keep Method Source (In Image)'
                                name: 'CheckBox7'
-                               layout: (LayoutFrame 30 0 0 0 -5 1 30 0)
+                               layout: (LayoutFrame 30 0 1 0 -5 1 29 0)
                                activeHelpKey: keepMethodSourceInImage
                                enableChannel: useManager
                                model: keepMethodSource
@@ -15979,7 +16028,7 @@
                             )
                           
                          )
-                         extent: (Point 660 30)
+                         extent: (Point 660 32)
                        )
                       (ViewSpec
                          name: 'CheckForHaltSendsBox'
@@ -15990,7 +16039,7 @@
                             (CheckBoxSpec
                                label: 'Check for halt/error-Sends when Checking in'
                                name: 'CheckBox5'
-                               layout: (LayoutFrame 30 0 0 0 -5 1 30 0)
+                               layout: (LayoutFrame 30 0 1 0 -5 1 30 0)
                                activeHelpKey: checkClassesWhenCheckingIn
                                enableChannel: useManager
                                model: checkClassesWhenCheckingIn
@@ -15999,7 +16048,7 @@
                             )
                           
                          )
-                         extent: (Point 660 30)
+                         extent: (Point 660 32)
                        )
                       (ViewSpec
                          name: 'VerboseBox'
@@ -16010,7 +16059,7 @@
                             (CheckBoxSpec
                                label: 'Verbose (Trace Operations on Transcript)'
                                name: 'CheckBox6'
-                               layout: (LayoutFrame 30 0 0 0 -5 1 30 0)
+                               layout: (LayoutFrame 30 0 1 0 -5 1 30 0)
                                activeHelpKey: verboseSourceCodeAccess
                                enableChannel: useManager
                                model: verboseSourceCodeAccess
@@ -16019,7 +16068,7 @@
                             )
                           
                          )
-                         extent: (Point 660 30)
+                         extent: (Point 660 32)
                        )
                       )
                     
@@ -18295,6 +18344,8 @@
 hasUnsavedChanges
     |colorList colorPerformer emphasisPerformer|
 
+    oldUserPreferences isNil ifTrue:[^ false].
+    
     colorList := UserPreferences syntaxColorNames.
     colorList do:[:syntaxElement |
         colorPerformer := (self syntaxColorSelectorForElement:syntaxElement).
@@ -19905,51 +19956,52 @@
 
     <resource: #canvas>
 
-    ^
-     #(FullSpec
-        name: windowSpec
-        window:
-       (WindowSpec
-          label: 'ToolSetting'
-          name: 'ToolSetting'
-          min: (Point 10 10)
-          bounds: (Rectangle 0 0 431 60)
-        )
-        component:
-       (SpecCollection
-          collection: (
-           (LabelSpec
-              label: 'Tool...'
-              name: 'Label'
-              layout: (LayoutFrame 0 0 0 0 150 0 30 0)
-              translateLabel: true
-              labelChannel: optionLabelHolder
-              adjust: left
-            )
-           (PopUpListSpec
-              label: 'Please select...'
-              name: 'OptionList'
-              layout: (LayoutFrame 150 0 3 0 0 1 27 0)
-              model: optionSelectionHolder
-              menu: optionLabelList
-              useIndex: true
-            )
-           (InputFieldSpec
-              name: 'EntryField1'
-              layout: (LayoutFrame 150 0 33 0 0 1 56 0)
-              visibilityChannel: optionCustomValueVisibleHolder
-              backgroundChannel: optionCustomValueBackgroundHolder
-              model: optionCustomValueHolder
-              type: string
-              immediateAccept: true
-              acceptOnReturn: true
-              acceptOnTab: true
-              acceptOnPointerLeave: true
-            )
-           )
-
-        )
-      )
+    ^ 
+    #(FullSpec
+       name: windowSpec
+       window: 
+      (WindowSpec
+         label: 'ToolSetting'
+         name: 'ToolSetting'
+         min: (Point 10 10)
+         bounds: (Rectangle 0 0 431 60)
+       )
+       component: 
+      (SpecCollection
+         collection: (
+          (LabelSpec
+             label: 'Tool...'
+             name: 'Label'
+             layout: (LayoutFrame 0 0 0 0 250 0 30 0)
+             translateLabel: true
+             labelChannel: optionLabelHolder
+             adjust: left
+           )
+          (PopUpListSpec
+             label: 'Please select...'
+             name: 'OptionList'
+             layout: (LayoutFrame 250 0 3 0 0 1 27 0)
+             translateLabel: true
+             model: optionSelectionHolder
+             menu: optionLabelList
+             useIndex: true
+           )
+          (InputFieldSpec
+             name: 'EntryField1'
+             layout: (LayoutFrame 250 0 33 0 0 1 56 0)
+             visibilityChannel: optionCustomValueVisibleHolder
+             backgroundChannel: optionCustomValueBackgroundHolder
+             model: optionCustomValueHolder
+             type: string
+             immediateAccept: true
+             acceptOnReturn: true
+             acceptOnTab: true
+             acceptOnPointerLeave: true
+           )
+          )
+        
+       )
+     )
 ! !
 
 !AbstractSettingsApplication::ToolboxSettingsAppl::ClassToolSetting methodsFor:'accessing'!