Launcher.st
changeset 107 db1b370632d7
parent 106 f4eb10b3b463
child 108 a936f81cc162
--- a/Launcher.st	Tue Jun 27 04:30:28 1995 +0200
+++ b/Launcher.st	Mon Jul 03 04:37:45 1995 +0200
@@ -37,7 +37,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libtool/Launcher.st,v 1.17 1995-06-27 02:29:51 claus Exp $
+$Header: /cvs/stx/stx/libtool/Launcher.st,v 1.18 1995-07-03 02:37:39 claus Exp $
 "
 !
 
@@ -307,12 +307,14 @@
     myMenu at:#settings 
 	   putLabels:(resources array:#(
 					'language'
+					'show keyboard mappings'
 					'view style'
 					'compilation'
 					'misc'
 					))
 	   selectors:#(
 					#languageSetting 
+					#keyboardSetting 
 					#viewStyleSetting 
 					#compilerSettings 
 					#miscSettings 
@@ -405,7 +407,7 @@
 setupViewsIn:topView 
     "create the pulldown menu, buttonPanel and transcript view"
 
-    |frame tFont|
+    |tFont|
 
     topView model:self.
 
@@ -455,7 +457,7 @@
 setupButtonPanelIn:aTopView
     "create the buttonPanel"
 
-    |sep spc mh|
+    |spc mh|
 
     spc := View viewSpacing // 2.
     buttonPanel := HorizontalPanelView in:aTopView.
@@ -628,6 +630,9 @@
 	#(startFileBrowser   'FBrowser32x32.xbm')
 	#(nil nil)
 	#(startChangesBrowser 'CBrowser32x32.xbm')
+"/        #(nil nil)
+"/        #(nil nil)
+"/        #(startDocumentationTool 'book11.ico')
      )
 !
 
@@ -787,7 +792,7 @@
 
 viewStyleSetting 
     |listOfStyles resourceDir dir box 
-     list listView infoLabel infoForwarder newStyle cont|
+     list listView infoLabel infoForwarder newStyle|
 
     "
      search resources directory for a list of .style files ...
@@ -899,6 +904,128 @@
     box showAtPointer
 !
 
+keyboardSetting 
+    |mappings listOfRawKeys listOfFunctions
+     box l
+     list1 list2 listView1 listView2 
+     frame infoLabel selectionForwarder macroForwarder macroTextView y|
+
+    mappings := Screen current keyboardMap.
+
+    listOfRawKeys := (mappings keys asArray collect:[:key | key asString]) sort.
+    listOfFunctions := (mappings values asSet asArray collect:[:key | key asString]) sort.
+
+    selectionForwarder := Plug new.
+    selectionForwarder respondTo:#showFunction
+		  with:[
+			|raw|
+			raw := list1 selection.
+			list2 retractInterrestFor:selectionForwarder.
+			list2 selection:(mappings at:raw asSymbol) asString.
+			list2 onChangeSend:#showRawKey to:selectionForwarder.
+		       ].
+    selectionForwarder respondTo:#showRawKey
+		  with:[
+			|f raw|
+
+			f := list2 selection.
+			list1 retractInterrestFor:selectionForwarder.
+			raw := mappings keyAtValue:f asString.
+			raw isNil ifTrue:[
+			    raw := mappings keyAtValue:f first.
+			    raw isNil ifTrue:[
+				raw := mappings keyAtValue:f asSymbol.
+			    ]
+			].
+			list1 selection:raw.
+			list1 onChangeSend:#showFunction to:selectionForwarder.
+		       ].
+
+    macroForwarder := Plug new.
+    macroForwarder respondTo:#showMacro
+		  with:[
+			|f macro indent|
+			f := list2 selection.
+			(f startsWith:'Cmd') ifTrue:[
+			    f := f copyFrom:4
+			].
+			macro := FunctionKeySequences at:(f asSymbol) ifAbsent:nil.
+			macro notNil ifTrue:[
+			    macro := macro asStringCollection.
+			    indent := macro
+					 inject:99999 into:[:min :element |
+					     |stripped|
+
+					     stripped := element withoutLeadingSeparators.
+					     stripped size == 0 ifTrue:[
+						 min
+					     ] ifFalse:[
+						 min min:(element size - stripped size)
+					     ]
+					 ].
+			    indent ~~ 0 ifTrue:[
+				macro := macro collect:[:line | 
+					     line size > indent ifTrue:[
+						line copyFrom:indent+1
+					     ] ifFalse:[
+						line
+					     ].
+					]
+			    ].                        
+			].
+			macroTextView contents:macro.
+		       ].
+
+    list1 := SelectionInList with:listOfRawKeys.
+    list1 onChangeSend:#showFunction to:selectionForwarder.
+    list2 := SelectionInList with:listOfFunctions.
+    list2 onChangeSend:#showRawKey to:selectionForwarder.
+    list2 onChangeSend:#showMacro to:macroForwarder.
+
+    box := Dialog new.
+    box label:(resources string:'Keyboard mappings').
+
+    l := box addTextLabel:(resources string:'KEY_MSG') withCRs.
+    l adjust:#left.
+
+    frame := View new.
+    frame extent:300 @ 300.
+
+    listView1 := ScrollableView for:SelectionInListView in:frame.
+    listView1 model:list1.
+    listView1 origin:0.0@0.0 corner:0.5@1.0.
+
+    listView2 := ScrollableView for:SelectionInListView in:frame.
+    listView2 model:list2.
+    listView2 origin:0.5@0.0 corner:1.0@1.0.
+
+    frame topInset:box yPosition.
+    box addComponent:frame withExtent:350@200.
+    frame origin:0.0@0.0 corner:1.0@0.6.
+
+    box addVerticalSpace.
+
+    l := box addTextLabel:(resources string:'Macro text (if any):') withCRs.
+    l adjust:#left.
+    l origin:0.0@0.6 corner:1.0@0.6.
+    l topInset:(View viewSpacing).
+    l bottomInset:(l preferredExtent y negated - View viewSpacing).
+
+    macroTextView := HVScrollableView for:TextView miniScroller:true.
+    box addComponent:macroTextView.
+    macroTextView origin:0.0@0.6 corner:1.0@1.0.
+    y := box yPosition.
+
+    box addAbortButton; addOkButton.
+    macroTextView topInset:(l preferredExtent y).
+    macroTextView bottomInset:(box preferredExtent y - y).
+
+    box showAtPointer.
+
+    box accepted ifTrue:[
+    ]
+!
+
 compilerSettings
     |box warnings warnSTX warnUnderscore warnOldStyle allowUnderscore immutableArrays
      warnSTXBox warnUnderscoreBox warnOldStyleBox enabler|