class: SettingsDialog
authorClaus Gittinger <cg@exept.de>
Thu, 23 Oct 2014 13:12:20 +0200
changeset 14792 03a4d13a4ff5
parent 14791 6d6a74a828c8
child 14793 b483aa895e56
class: SettingsDialog added: #menuCollapseAll #menuExpandAll changed: #mainMenu
SettingsDialog.st
--- a/SettingsDialog.st	Thu Oct 23 12:30:56 2014 +0200
+++ b/SettingsDialog.st	Thu Oct 23 13:12:20 2014 +0200
@@ -35,7 +35,7 @@
 !
 
 AbstractSettingsApplication subclass:#SettingsFilenameAppl
-	instanceVariableNames:'settingsFilenameHolder'
+	instanceVariableNames:'settingsFilenameHolder infoLabelHolder'
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:SettingsDialog
@@ -535,6 +535,7 @@
     "Do not manually edit this!! If it is corrupted,
      the MenuEditor may not be able to read the specification."
 
+
     "
      MenuEditor new openOnClass:SettingsDialog andSelector:#mainMenu
      (Menu new fromLiteralArrayEncoding:(SettingsDialog mainMenu)) startUp
@@ -547,14 +548,12 @@
         (
          (MenuItem
             label: '&File'
-            translateLabel: true
             submenu: 
            (Menu
               (
                (MenuItem
                   label: '&Load From...'
                   itemValue: loadSettingsFromFile
-                  translateLabel: true
                   isVisible: loadAndSaveSettingsItemVisible
                 )
                (MenuItem
@@ -564,13 +563,11 @@
                (MenuItem
                   label: 'Save'
                   itemValue: saveSettingsWithoutAskingForFile
-                  translateLabel: true
                   isVisible: loadAndSaveSettingsItemVisible
                 )
                (MenuItem
                   label: '&Save As...'
                   itemValue: askForFileAndSaveSettings
-                  translateLabel: true
                   isVisible: loadAndSaveSettingsItemVisible
                 )
                (MenuItem
@@ -580,7 +577,24 @@
                (MenuItem
                   label: 'E&xit'
                   itemValue: closeRequest
-                  translateLabel: true
+                )
+               )
+              nil
+              nil
+            )
+          )
+         (MenuItem
+            label: 'View'
+            submenu: 
+           (Menu
+              (
+               (MenuItem
+                  label: 'Expand All'
+                  itemValue: menuExpandAll
+                )
+               (MenuItem
+                  label: 'Collapse All'
+                  itemValue: menuCollapseAll
                 )
                )
               nil
@@ -1574,6 +1588,14 @@
     "Modified: / 08-09-2006 / 19:23:15 / cg"
 !
 
+menuCollapseAll
+    applicationList root children do:[:each | each collapse].
+!
+
+menuExpandAll
+    applicationList root children do:[:each | each recursiveExpand].
+!
+
 saveSettingsWithoutAskingForFile
     self class saveSettingsWithoutAskingForFile.
 ! !
@@ -1752,6 +1774,12 @@
       (SpecCollection
          collection: (
           (LabelSpec
+             name: 'InfoLabel'
+             layout: (LayoutFrame 0 0 -169 0.5 0 1 -45 0.5)
+             translateLabel: true
+             labelChannel: infoLabelHolder
+           )
+          (LabelSpec
              label: 'Preferences are stored in file:'
              name: 'Label1'
              layout: (LayoutFrame 0 0 -30 0.5 0 1 0 0.5)
@@ -1814,23 +1842,13 @@
 !SettingsDialog::SettingsFilenameAppl methodsFor:'actions'!
 
 openSettingsFile
-    | filename |
-
-    filename := UserPreferences current 
-                    at:#settingsFilename      
-                    ifAbsent:[UserPreferences defaultUserSettingsFile pathName].
-    self openSettingsFile: filename
+    self openSettingsFile: (self settingsFile)
 
     "Created: / 07-02-2012 / 11:15:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 reloadSettingsFile
-    | filename |
-
-    filename := UserPreferences current 
-                    at:#settingsFilename      
-                    ifAbsent:[UserPreferences defaultUserSettingsFile pathName].
-    self reloadSettingsFile: filename
+    self reloadSettingsFile: (self settingsFile)
 
     "Created: / 17-02-2012 / 10:26:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
@@ -1838,7 +1856,7 @@
 saveAsPrivateSettingsFile
     |fn|
 
-    fn := UserPreferences defaultUserSettingsFile pathName.
+    fn := self defaultSettingsFile.
     SettingsDialog saveSettingsTo:fn.
     UserPreferences current at:#settingsFilename put:fn.
     settingsFilenameHolder value:fn.
@@ -1846,6 +1864,19 @@
 
 !SettingsDialog::SettingsFilenameAppl methodsFor:'aspects'!
 
+infoLabelHolder
+    infoLabelHolder isNil ifTrue:[
+        infoLabelHolder := nil asValue.
+        infoLabelHolder value:
+                     (resources 
+                        stringWithCRs:(
+                            'Unless saved via the "Save"-Button,'
+                            , '\changes affect the current session only.')).
+
+    ].
+    ^ infoLabelHolder
+!
+
 settingsFilenameHolder
     settingsFilenameHolder isNil ifTrue:[
         settingsFilenameHolder := nil asValue.
@@ -1860,7 +1891,7 @@
 
 openSettingsFile: filename 
 
-    UserPreferences current fileBrowserClass
+    UserPreferences fileBrowserClass
         openOnFileNamed:filename editing:true
 
     "Created: / 07-02-2012 / 01:08:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -1879,9 +1910,7 @@
 basicReadSettings
     |filename|
 
-    filename := UserPreferences current 
-                        at:#settingsFilename      
-                        ifAbsent:[UserPreferences defaultUserSettingsFile pathName].
+    filename := self settingsFile.
 "/      filename := filename asText
 "/        colorizeAllWith: Color blue;
 "/        actionForAll:[ self openSettingsFile: filename ].
@@ -1892,24 +1921,48 @@
     ^self
 
     "Modified: / 07-02-2012 / 01:03:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+editorHelpRelativeWikiURL
+    "the relative URL of the dialog-description in the Wiki"
+
+    ^ 'Settings'
+!
+
+helpFilename
+    "subclasses must return the relative name of a helpFile
+     in the doc/online/<language>/help directory.
+     Or nil, if no help is available."
+
+    ^ nil.
 ! !
 
 !SettingsDialog::SettingsFilenameAppl methodsFor:'queries'!
 
+defaultSettingsFile
+    ^ UserPreferences defaultUserSettingsFile pathName
+!
+
 hasUnsavedChanges
     ^false
 
     "Modified: / 07-02-2012 / 01:03:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+settingsFile
+    ^ UserPreferences current 
+                    at:#settingsFilename      
+                    ifAbsent:[self defaultSettingsFile].
 ! !
 
 !SettingsDialog class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/SettingsDialog.st,v 1.120 2014-07-11 00:25:24 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/SettingsDialog.st,v 1.121 2014-10-23 11:12:20 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/SettingsDialog.st,v 1.120 2014-07-11 00:25:24 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/SettingsDialog.st,v 1.121 2014-10-23 11:12:20 cg Exp $'
 ! !