AbstractSettingsApplication.st
changeset 15047 cdfb5c80a65e
parent 15043 7ac6a56ec87b
child 15049 41530cb36c13
--- a/AbstractSettingsApplication.st	Wed Dec 17 21:14:34 2014 +0100
+++ b/AbstractSettingsApplication.st	Wed Dec 17 23:51:09 2014 +0100
@@ -131,7 +131,8 @@
 
 AbstractSettingsApplication subclass:#KbdMappingSettingsAppl
 	instanceVariableNames:'selectedRawKey macroTextHolder selectedFunctionKey
-		labelTextHolder functionKeyList rawKeyList mappings'
+		labelTextHolder changeMapHolder currentKeyHolder functionKeyList
+		rawKeyList mappings'
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:AbstractSettingsApplication
@@ -5580,6 +5581,37 @@
     "Created: / 25-01-2007 / 17:16:46 / cg"
 ! !
 
+!AbstractSettingsApplication::KbdMappingSettingsAppl class methodsFor:'help specs'!
+
+flyByHelpSpec
+    "This resource specification was automatically generated
+     by the UIHelpTool of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the UIHelpTool may not be able to read the specification."
+
+    "
+     UIHelpTool openOnClass:AbstractSettingsApplication::MemorySettingsAppl
+    "
+
+    <resource: #help>
+
+    ^ super flyByHelpSpec addPairsFrom:#(
+
+#rawKeyList
+'Select an entry from this list of keys, to see the associated function in the right list.\To change, check the "Change" toggle below, then select the function to assign,\and finally press the "Apply" button'
+
+#functionKeyList
+'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'
+
+#'applyChange'
+'Installs the currently selected key-function combination'
+)
+! !
+
 !AbstractSettingsApplication::KbdMappingSettingsAppl class methodsFor:'image specs'!
 
 defaultIcon
@@ -5657,6 +5689,7 @@
                             (SequenceViewSpec
                                name: 'RawKeyList'
                                layout: (LayoutFrame 0 0 30 0 0 1 -30 1)
+                               activeHelpKey: rawKeyList
                                model: selectedRawKey
                                hasHorizontalScrollBar: true
                                hasVerticalScrollBar: true
@@ -5673,9 +5706,19 @@
                                      label: 'Change'
                                      name: 'CheckBox1'
                                      layout: (LayoutFrame 0 0 7 0 136 0 29 0)
+                                     activeHelpKey: changeMap
                                      model: changeMapHolder
                                      translateLabel: true
                                    )
+                                  (InputFieldSpec
+                                     name: 'EntryField1'
+                                     layout: (LayoutFrame 136 0 7 0 0 1 29 0)
+                                     visibilityChannel: changeMapHolder
+                                     model: currentKeyHolder
+                                     acceptOnReturn: true
+                                     acceptOnTab: true
+                                     acceptOnPointerLeave: true
+                                   )
                                   )
                                 
                                )
@@ -5698,6 +5741,7 @@
                             (SequenceViewSpec
                                name: 'FunctionKeyList'
                                layout: (LayoutFrame 0 0 30 0 0 1 -30 1)
+                               activeHelpKey: functionList
                                model: selectedFunctionKey
                                hasHorizontalScrollBar: true
                                hasVerticalScrollBar: true
@@ -5714,6 +5758,8 @@
                                      label: 'Apply'
                                      name: 'Button1'
                                      layout: (LayoutFrame 0 0 8 0 125 0 30 0)
+                                     activeHelpKey: applyChange
+                                     visibilityChannel: changeMapHolder
                                      translateLabel: true
                                      model: applyMapChange
                                    )
@@ -5745,6 +5791,7 @@
                       (TextEditorSpec
                          name: 'MacroText'
                          layout: (LayoutFrame 0 0.0 30 0 0 1.0 0 1.0)
+                         activeHelpKey: macroText
                          model: macroTextHolder
                          hasHorizontalScrollBar: true
                          hasVerticalScrollBar: true
@@ -5768,6 +5815,10 @@
 
 !AbstractSettingsApplication::KbdMappingSettingsAppl methodsFor:'actions'!
 
+applyMapChange
+    Screen current keyboardMap at:(self currentKeyHolder value asSymbol) put:(self selectedFunctionKey value asSymbol).
+!
+
 basicReadSettings
     "nothing done here"
 !
@@ -5778,6 +5829,20 @@
 
 !AbstractSettingsApplication::KbdMappingSettingsAppl methodsFor:'aspects'!
 
+changeMapHolder
+    changeMapHolder isNil ifTrue:[
+        changeMapHolder := false asValue.
+    ].
+    ^ changeMapHolder.
+!
+
+currentKeyHolder
+    currentKeyHolder isNil ifTrue:[
+        currentKeyHolder := nil asValue.
+    ].
+    ^ currentKeyHolder.
+!
+
 functionKeyList
     functionKeyList isNil ifTrue:[
 	functionKeyList := ValueHolder new.
@@ -5828,8 +5893,8 @@
 !AbstractSettingsApplication::KbdMappingSettingsAppl methodsFor:'change & update'!
 
 changeFunctionKeySelection
-
     |raw|
+
     raw := self selectedRawKey value.
     self selectedFunctionKey value:(mappings at:raw asSymbol) asString  withoutNotifying:self.
 
@@ -5878,10 +5943,10 @@
     f := self selectedFunctionKey value.
     raw := mappings keyAtValue:f asString.
     raw isNil ifTrue:[
-	raw := mappings keyAtValue:f first.
-	raw isNil ifTrue:[
-	    raw := mappings keyAtValue:f asSymbol.
-	]
+        raw := mappings keyAtValue:f first.
+        raw isNil ifTrue:[
+            raw := mappings keyAtValue:f asSymbol.
+        ]
     ].
     self selectedRawKey value:raw withoutNotifying:self.
 
@@ -5890,13 +5955,18 @@
 
 update:something with:aParameter from:changedObject
     changedObject == self selectedFunctionKey ifTrue:[
-	self changeRawKeySelection.
-	self changeMacroText.
-	^ self
+        changeMapHolder value ifFalse:[
+            self changeRawKeySelection.
+        ].
+        self changeMacroText.
+        ^ self
     ].
     changedObject == self selectedRawKey ifTrue:[
-	self changeFunctionKeySelection.
-	^ self
+        changeMapHolder value ifFalse:[
+            self changeFunctionKeySelection.
+        ].
+        self currentKeyHolder value:changedObject value.
+        ^ self
     ].
     super update:something with:aParameter from:changedObject
 ! !
@@ -5917,6 +5987,7 @@
 
     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.
 !
@@ -18883,10 +18954,10 @@
 !AbstractSettingsApplication class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/AbstractSettingsApplication.st,v 1.578 2014-12-17 17:32:11 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/AbstractSettingsApplication.st,v 1.579 2014-12-17 22:51:09 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/AbstractSettingsApplication.st,v 1.578 2014-12-17 17:32:11 cg Exp $'
-! !
-
+    ^ '$Header: /cvs/stx/stx/libtool/AbstractSettingsApplication.st,v 1.579 2014-12-17 22:51:09 cg Exp $'
+! !
+