class: AbstractSettingsApplication
authorClaus Gittinger <cg@exept.de>
Thu, 18 Dec 2014 17:00:50 +0100
changeset 15049 41530cb36c13
parent 15048 4e8598056078
child 15050 9034dd01f8a4
class: AbstractSettingsApplication
AbstractSettingsApplication.st
--- a/AbstractSettingsApplication.st	Thu Dec 18 16:08:22 2014 +0100
+++ b/AbstractSettingsApplication.st	Thu Dec 18 17:00:50 2014 +0100
@@ -5605,10 +5605,14 @@
 'Select an entry from this function list, to see the raw key which invokes this function.\To change, check the "Change" toggle below, select a rawkey+function combinarion,\and finally press the "Apply" button'
 
 #'changeMap'
-'Switch between "display" and "modify" modes.\If checked, you can select a combination and assign the key-function combination with the "Apply" button.\If not checked, either list show''s the other''s associated entry'
+'Switch between "display" and "modify" mode.\If checked, you can select a combination and assign the key-function combination with the "Apply" button.\If not checked, either list show''s the other''s associated entry'
 
 #'applyChange'
-'Installs the currently selected key-function combination'
+'Adds the current key-function combination to the keyboard map'
+
+#saveMapAs
+'Save the current keyboard map to an alternative keyboard setup file.\This can be loaded via fileIn or shared with other users.'
+
 )
 ! !
 
@@ -5645,7 +5649,7 @@
          label: 'Keyboard Mapping Settings'
          name: 'Keyboard Mapping Settings'
          min: (Point 10 10)
-         bounds: (Rectangle 0 0 491 653)
+         bounds: (Rectangle 0 0 482 654)
        )
        component: 
       (SpecCollection
@@ -5703,7 +5707,7 @@
                               (SpecCollection
                                  collection: (
                                   (CheckBoxSpec
-                                     label: 'Change'
+                                     label: 'Modify'
                                      name: 'CheckBox1'
                                      layout: (LayoutFrame 0 0 7 0 136 0 29 0)
                                      activeHelpKey: changeMap
@@ -5748,20 +5752,31 @@
                                useIndex: false
                                sequenceList: functionKeyList
                              )
-                            (ViewSpec
-                               name: 'Box5'
+                            (HorizontalPanelViewSpec
+                               name: 'HorizontalPanel1'
                                layout: (LayoutFrame 0 0 -30 1 0 1 0 1)
+                               horizontalLayout: fitSpace
+                               verticalLayout: center
                                component: 
                               (SpecCollection
                                  collection: (
                                   (ActionButtonSpec
                                      label: 'Apply'
                                      name: 'Button1'
-                                     layout: (LayoutFrame 0 0 8 0 125 0 30 0)
                                      activeHelpKey: applyChange
                                      visibilityChannel: changeMapHolder
                                      translateLabel: true
                                      model: applyMapChange
+                                     extent: (Point 125 22)
+                                   )
+                                  (ActionButtonSpec
+                                     label: 'Save As...'
+                                     name: 'Button2'
+                                     activeHelpKey: saveMapAs
+                                     visibilityChannel: changeMapHolder
+                                     translateLabel: true
+                                     model: saveMapAs
+                                     extent: (Point 125 22)
                                    )
                                   )
                                 
@@ -5816,15 +5831,48 @@
 !AbstractSettingsApplication::KbdMappingSettingsAppl methodsFor:'actions'!
 
 applyMapChange
-    Screen current keyboardMap at:(self currentKeyHolder value asSymbol) put:(self selectedFunctionKey value asSymbol).
+    mappings at:(self currentKeyHolder value asSymbol) put:(self selectedFunctionKey value asSymbol).
+    self updateModifiedChannel.
 !
 
 basicReadSettings
-    "nothing done here"
+    |l|
+
+    mappings := Dictionary new declareAllFrom: Screen current keyboardMap.
+
+    self rawKeyList contents: (mappings keys collect:[:key | key asString] as:Array) sort.
+    l := (mappings values asSet collect:[:key | key asString] as:Array) sort.
+    l addFirst:'* unassigned *'.
+    self functionKeyList contents:l.
+
+    self changeMapHolder value:false.
 !
 
 basicSaveSettings
-    "nothing done here"
+    self saveMapAs:(Filename applicationDataDirectory construct:'private_keyboard.rc')
+!
+
+saveMapAs
+    "invoked via save as button"
+
+    |fn|
+
+    fn := Dialog 
+            requestFileName:'Save private keyboard settings in:'
+            default:'private_keyboard.rc'
+            fromDirectory:(Filename applicationDataDirectory).
+    fn isEmptyOrNil ifTrue:[ ^ self ].
+    self saveMapAs:fn asFilename.
+!
+
+saveMapAs:aFilename
+    aFilename writingFileDo:[:s |
+        s nextPutLine:'|map|'.
+        s nextPutLine:'map := Screen current keyboardMap.'.
+        mappings keysAndValuesDo:[:eachKey :eachFunction |
+            s nextPutLine:('map at:%1 put:%2.' bindWith:eachKey storeString with:eachFunction storeString).
+        ].    
+    ].
 ! !
 
 !AbstractSettingsApplication::KbdMappingSettingsAppl methodsFor:'aspects'!
@@ -5845,7 +5893,7 @@
 
 functionKeyList
     functionKeyList isNil ifTrue:[
-	functionKeyList := ValueHolder new.
+        functionKeyList := List new.
     ].
     ^ functionKeyList.
 !
@@ -5983,12 +6031,6 @@
 
     super initialize.
 
-    mappings := Screen current keyboardMap.
-
-    rawKeyList := (mappings keys collect:[:key | key asString] as:Array) sort.
-    functionKeyList := (mappings values asSet collect:[:key | key asString] as:Array) sort.
-    functionKeyList addFirst:'* unassigned *'.
-
     self labelTextHolder value:(resources at:'KEY_MSG2' default:'keyboard mapping:') withCRs.
 !
 
@@ -6001,8 +6043,7 @@
 !AbstractSettingsApplication::KbdMappingSettingsAppl methodsFor:'queries'!
 
 hasUnsavedChanges
-
-    ^ false
+    ^ mappings ~= Screen current keyboardMap.
 ! !
 
 !AbstractSettingsApplication::LanguageSettingsAppl class methodsFor:'font specs'!
@@ -8677,14 +8718,17 @@
 #focusFollowsMouse
 'Keyboard focus follows the mouse position (no need to click into fields for focus)'
 
+#'shouldRememberLastExtent'
+'Applications remember their last window size when closed,\and take that as default when opened the next time.'
+
 #menuPanelTakesFocusOnClick
 'Menupanel takes the keyboard focus when clicked. If off, the focus remains unchanged'
 
 #mouseWheelFocusFollowsMouse
-'Mousewheel focus follows the mouse position (no need to click into fields for focus)'
+'Mousewheel focus follows the mouse position (no need to click into fields for focus).\If Keyboard focus follows pointer is set to true, then this is always also true.'
 
 #allowMouseWheelZoom
-'Turning the mousewheel with CTRL- or ALT-key pressed will zoom in/out\(i.e. changes the view''s magnification if it supports zooming).\Note that on Mac-OSX systems, CTRL-Wheel is already handled by the window manager,\so you have to press the ALT key.\'
+'Turning the mousewheel with CTRL- or ALT-key pressed will zoom in/out\(i.e. changes the view''s magnification if it supports zooming).\Note that on Mac-OSX systems, CTRL-Wheel is already handled by the window manager,\so you have to press the ALT key.'
 
 #takeFocus
 'Windows automatically fetch the focus when opened\(usually not needed, as done by window manager)'
@@ -8702,7 +8746,7 @@
 'Right click changes the selection (before the menu is opened).\This is the Windows behavior. Under X11, selection and menu activation are done by different mouse buttons.'
 
 #showRightButtonMenuOnRelease
-'Activate popup menus when the mouse button is released; not when pressed.\Usually better, as it allows for the mouse pointer to be moved away,\in case you change your mind'
+'Activate popup menus when the mouse button is released; not when pressed.\Usually better, as it allows for the mouse pointer to be moved away,\in case you change your mind.\However, some people prefer the menu to come up immediately'
 
 #hostNameInLabel
 'Show additional session, host and user information in each of the ST/X windows.\Useful, if you have multiple, possibly remote ST/X sessions running on the same screen,\to not loose track of which window belongs to which session.'
@@ -8821,6 +8865,35 @@
                    extent: (Point 530 30)
                  )
                 (CheckBoxSpec
+                   label: 'MouseWheel Focus Follows Mouse'
+                   name: 'mouseWheelFocusFollowsMouse'
+                   activeHelpKey: mouseWheelFocusFollowsMouse
+                   enableChannel: mouseWheelFocusFollowsMouseEnabled
+                   model: mouseWheelFocusFollowsMouse
+                   translateLabel: true
+                   extent: (Point 530 30)
+                 )
+                (CheckBoxSpec
+                   label: 'Zoom with CTRL- or ALT-Mousewheel'
+                   name: 'CheckBox1'
+                   activeHelpKey: allowMouseWheelZoom
+                   model: allowMouseWheelZoom
+                   translateLabel: true
+                   extent: (Point 530 30)
+                 )
+                (ViewSpec
+                   name: 'SeparatingSpace4'
+                   extent: (Point 530 3)
+                 )
+                (DividerSpec
+                   name: 'Separator2'
+                   extent: (Point 530 3)
+                 )
+                (ViewSpec
+                   name: 'SeparatingSpace5'
+                   extent: (Point 530 3)
+                 )
+                (CheckBoxSpec
                    label: 'Menu Panels take Focus on Click'
                    name: 'CheckBox7'
                    activeHelpKey: menuPanelTakesFocusOnClick
@@ -8871,49 +8944,12 @@
                 (CheckBoxSpec
                    label: 'Applications Remember Last Extent as Default'
                    name: 'CheckBox5'
-                   activeHelpKey: forceWindowsIntoMonitorBounds
+                   activeHelpKey: shouldRememberLastExtent
                    model: shouldRememberLastExtent
                    translateLabel: true
                    extent: (Point 530 30)
                  )
                 (ViewSpec
-                   name: 'SeparatingSpace3'
-                   extent: (Point 530 4)
-                 )
-                (DividerSpec
-                   name: 'Separator2'
-                   extent: (Point 530 3)
-                 )
-                (ViewSpec
-                   name: 'SeparatingSpace4'
-                   extent: (Point 530 3)
-                 )
-                (CheckBoxSpec
-                   label: 'MouseWheel Focus Follows Mouse'
-                   name: 'mouseWheelFocusFollowsMouse'
-                   activeHelpKey: mouseWheelFocusFollowsMouse
-                   enableChannel: mouseWheelFocusFollowsMouseEnabled
-                   model: mouseWheelFocusFollowsMouse
-                   translateLabel: true
-                   extent: (Point 530 30)
-                 )
-                (CheckBoxSpec
-                   label: 'Zoom with CTRL- or ALT-Mousewheel'
-                   name: 'CheckBox1'
-                   activeHelpKey: allowMouseWheelZoom
-                   model: allowMouseWheelZoom
-                   translateLabel: true
-                   extent: (Point 530 30)
-                 )
-                (CheckBoxSpec
-                   label: 'ALT-Leftclick is Rightclick'
-                   name: 'CheckBox3'
-                   activeHelpKey: button2WithAltKey
-                   model: button2WithAltKey
-                   translateLabel: true
-                   extent: (Point 530 30)
-                 )
-                (ViewSpec
                    name: 'SeparatingSpace5'
                    extent: (Point 530 4)
                  )
@@ -8941,6 +8977,14 @@
                    translateLabel: true
                    extent: (Point 530 30)
                  )
+                (CheckBoxSpec
+                   label: 'ALT-Leftclick is Rightclick'
+                   name: 'CheckBox3'
+                   activeHelpKey: button2WithAltKey
+                   model: button2WithAltKey
+                   translateLabel: true
+                   extent: (Point 530 30)
+                 )
                 (ViewSpec
                    name: 'SeparatingSpace7'
                    extent: (Point 530 4)
@@ -8961,7 +9005,7 @@
                       (LabelSpec
                          label: 'Label'
                          name: 'Label1'
-                         layout: (LayoutFrame 0 0 0 0 173 0 17 0)
+                         layout: (LayoutFrame 0 0 0 0 218 0 20 0)
                          activeHelpKey: hostNameInLabel
                          translateLabel: true
                          labelChannel: formatHostNameWindowLabel
@@ -8971,7 +9015,7 @@
                       (LabelSpec
                          label: 'Label'
                          name: 'Label2'
-                         layout: (LayoutFrame 0 0.29999999999999999 30 0 0 0.59999999999999998 0 1)
+                         layout: (LayoutFrame 0 0.30000000000000004 30 0 0 0.59999999999999998 0 1)
                          activeHelpKey: hostNameInLabel
                          translateLabel: true
                          labelChannel: formatHostNameWindowLabel1
@@ -18954,10 +18998,10 @@
 !AbstractSettingsApplication class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/AbstractSettingsApplication.st,v 1.579 2014-12-17 22:51:09 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/AbstractSettingsApplication.st,v 1.580 2014-12-18 16:00:50 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/AbstractSettingsApplication.st,v 1.579 2014-12-17 22:51:09 cg Exp $'
-! !
-
+    ^ '$Header: /cvs/stx/stx/libtool/AbstractSettingsApplication.st,v 1.580 2014-12-18 16:00:50 cg Exp $'
+! !
+