TerminalView.st
changeset 4294 44d208158d1e
parent 4290 bad371611ba6
child 4295 5bd43114a67b
equal deleted inserted replaced
4293:ade403689ce1 4294:44d208158d1e
   118 
   118 
   119 !TerminalView class methodsFor:'initialization'!
   119 !TerminalView class methodsFor:'initialization'!
   120 
   120 
   121 initialize
   121 initialize
   122 
   122 
   123     Debug := false.
   123     Debug := DebugKeyboard := false.
   124 
   124 
   125 "
   125     "
   126     self initialize
   126      self initialize
   127 "
   127     "
   128 ! !
   128 ! !
   129 
   129 
   130 !TerminalView class methodsFor:'defaults'!
   130 !TerminalView class methodsFor:'defaults'!
   131 
   131 
   132 defaultIcon
   132 defaultIcon
   651     "/ should go untranslated (CTRL-key),
   651     "/ should go untranslated (CTRL-key),
   652     "/ even if defined as function keys.
   652     "/ even if defined as function keys.
   653 
   653 
   654     inStream isNil ifTrue:[^ self].
   654     inStream isNil ifTrue:[^ self].
   655 
   655 
   656     Debug ifTrue:[
   656     DebugKeyboard ifTrue:[
   657         Transcript showCR:'----'; show:'keyPress:' ; showCR:aKey printString.
   657         Transcript showCR:'----'; show:'keyPress:' ; showCR:aKey printString.
   658     ].
   658     ].
   659 
   659 
   660     aKey isCharacter ifTrue:[
   660     aKey isCharacter ifTrue:[
   661         self deselect.
   661         self deselect.
   686     ] ifFalse:[
   686     ] ifFalse:[
   687         seq := kbdSequences at:aKey ifAbsent:nil.
   687         seq := kbdSequences at:aKey ifAbsent:nil.
   688     ].
   688     ].
   689 
   689 
   690     seq notNil ifTrue:[
   690     seq notNil ifTrue:[
   691         Debug ifTrue:[
   691         DebugKeyboard ifTrue:[
   692             Transcript show:'->' ; showCR:seq storeString.
   692             Transcript show:'->' ; showCR:seq storeString.
   693         ].
   693         ].
   694         seq := seq withoutCEscapes.
   694         seq := seq withoutCEscapes.
   695 
   695 
   696         localEcho ifTrue:[
   696         localEcho ifTrue:[
   718     ].
   718     ].
   719 
   719 
   720     "/
   720     "/
   721     "/ care for function-keys, which are mapped to Ctrl-x;
   721     "/ care for function-keys, which are mapped to Ctrl-x;
   722     "/
   722     "/
   723     Debug ifTrue:[
   723     DebugKeyboard ifTrue:[
   724         Transcript show:'raw ->' ; showCR:rawKey storeString.
   724         Transcript show:'raw ->' ; showCR:rawKey storeString.
   725     ].
   725     ].
   726 
   726 
   727     seq := kbdSequences at:rawKey ifAbsent:nil.
   727     seq := kbdSequences at:rawKey ifAbsent:nil.
   728     seq notNil ifTrue:[
   728     seq notNil ifTrue:[
   729         Debug ifTrue:[
   729         DebugKeyboard ifTrue:[
   730             Transcript show:'->' ; showCR:seq storeString.
   730             Transcript show:'->' ; showCR:seq storeString.
   731         ].
   731         ].
   732         inStream nextPutAll:(seq withoutCEscapes).
   732         inStream nextPutAll:(seq withoutCEscapes).
   733         ^ self
   733         ^ self
   734     ].
   734     ].
   736     (rawKey startsWith:'Ctrl') ifTrue:[
   736     (rawKey startsWith:'Ctrl') ifTrue:[
   737         rest := rawKey copyFrom:5.
   737         rest := rawKey copyFrom:5.
   738         rest size == 1 ifTrue:[
   738         rest size == 1 ifTrue:[
   739             rest := rest at:1.
   739             rest := rest at:1.
   740             (rest >= $a and:[rest <= $z]) ifTrue:[
   740             (rest >= $a and:[rest <= $z]) ifTrue:[
   741                 Debug ifTrue:[
   741                 DebugKeyboard ifTrue:[
   742                     Transcript show:'->' ; showCR:(Character value:(rest - $a + 1)) storeString.
   742                     Transcript show:'->' ; showCR:(Character value:(rest - $a + 1)) storeString.
   743                 ].
   743                 ].
   744                 inStream nextPut:(Character value:(rest - $a + 1)).
   744                 inStream nextPut:(Character value:(rest - $a + 1)).
   745                 ^ self
   745                 ^ self
   746             ].
   746             ].
   747             (rest >= $A and:[rest <= $Z]) ifTrue:[
   747             (rest >= $A and:[rest <= $Z]) ifTrue:[
   748                 Debug ifTrue:[
   748                 DebugKeyboard ifTrue:[
   749                     Transcript show:'->' ; showCR:(Character value:(rest - $a + 1)) storeString.
   749                     Transcript show:'->' ; showCR:(Character value:(rest - $a + 1)) storeString.
   750                 ].
   750                 ].
   751                 inStream nextPut:(Character value:(rest - $A + 1)).
   751                 inStream nextPut:(Character value:(rest - $A + 1)).
   752                 ^ self
   752                 ^ self
   753             ].
   753             ].
   768     ].
   768     ].
   769     (rawKey = 'Ctrl') ifTrue:[
   769     (rawKey = 'Ctrl') ifTrue:[
   770         ^ self
   770         ^ self
   771     ].
   771     ].
   772 
   772 
   773     Debug ifTrue:[
   773     DebugKeyboard ifTrue:[
   774         Transcript show:'unhandled key: '; showCR:rawKey.
   774         Transcript show:'unhandled key: '; showCR:rawKey.
   775     ].
   775     ].
       
   776 
       
   777     "
       
   778      DebugKeyboard := true
       
   779     "
   776 
   780 
   777     "Modified: / 25-01-2012 / 10:43:06 / cg"
   781     "Modified: / 25-01-2012 / 10:43:06 / cg"
   778 !
   782 !
   779 
   783 
   780 shellTerminated
   784 shellTerminated
  2048 ! !
  2052 ! !
  2049 
  2053 
  2050 !TerminalView class methodsFor:'documentation'!
  2054 !TerminalView class methodsFor:'documentation'!
  2051 
  2055 
  2052 version
  2056 version
  2053     ^ '$Header: /cvs/stx/stx/libwidg2/TerminalView.st,v 1.148 2013-07-23 13:59:55 cg Exp $'
  2057     ^ '$Header: /cvs/stx/stx/libwidg2/TerminalView.st,v 1.149 2013-07-23 14:25:19 cg Exp $'
  2054 !
  2058 !
  2055 
  2059 
  2056 version_CVS
  2060 version_CVS
  2057     ^ '$Header: /cvs/stx/stx/libwidg2/TerminalView.st,v 1.148 2013-07-23 13:59:55 cg Exp $'
  2061     ^ '$Header: /cvs/stx/stx/libwidg2/TerminalView.st,v 1.149 2013-07-23 14:25:19 cg Exp $'
  2058 ! !
  2062 ! !
  2059 
  2063 
  2060 
  2064 
  2061 TerminalView initialize!
  2065 TerminalView initialize!