Module: VRKeyAcceleratorUseable

Included in:
VRMenuUseable
Defined in:
lib/vr/vrcontrol.rb

Overview

Thanks to Yukimisake-san.

Instance Method Summary collapse

Instance Method Details



1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
# File 'lib/vr/vrcontrol.rb', line 1007

def menuTransTable(hsh) 
  tVirt = {"Ctrl" => 0x08,"Shift" => 0x04,"Alt" => 0x10}
  tVkey = {"F1"=>0x70,"F2"=>0x71,"F3"=>0x72,"F4"=>0x73,
           "F5"=>0x74,"F6"=>0x75,"F7"=>0x76,"F8"=>0x77,
           "F9"=>0x78,"F10"=>0x79,"F11"=>0x7a,"F12"=>0x7b,
           "Insert"=>0x2d,"Delete"=>0x2e,"PageUp"=>0x21,"PageDown"=>0x22,
           "End"=>0x23,"Home"=>0x24
  }
  r = []
  hsh.each{|k,v|
    fVirt = 1
    key = nil
    if txt = v[/\t.*/] then
      a = txt.strip!.split(/\+/)
      a[0,a.size-1].each{|ii|
          raise "Iregal Key" unless n = tVirt[ii]
          fVirt += n } if a.size > 1
      if (s = a[a.size-1]).size > 1 then
        unless key = tVkey[s] then raise "Iregal Key" end
      else
        key = (s.upcase)[0]
      end
    end
    if key then
      r << fVirt
      r << key
      r << k
    end
  }
  r
end