class Twiddler::Config

Attributes

configs[R]
keyboard[R]
mouse[R]

Public Class Methods

keytable() click to toggle source
# File lib/twiddler/config.rb, line 129
def self.keytable
  @table ||= 
    begin
      table = KeyTable.new

      table.start_tag(:normal)
      table.start_tag(:letters)
      (("a".."z").to_a).each_with_index do |ltr, idx|
        table[idx+4] = ltr
      end
      (("A".."Z").to_a).each_with_index do |ltr, idx|
        table.mod(idx+4, "shift", ltr)
      end
      table.end_tag(:letters)
      table.start_tag(:numbers)

      (("1".."9").to_a + ["0"]).each_with_index do |num, idx|
        table[idx+30] = num
      end
      %w[! @ # $ % ^ & * ( )].each_with_index do |shift_num, idx|
        table.mod(idx+30, "shift", shift_num)
      end
      table.end_tag(:numbers)

      table.start_tag(:punctuation)
      table[45] = "-"
      table.mod(45, "shift", "_")
      table[46] = "="
      table.mod(46, "shift", "+")
      table[47] = "["
      table.mod(47, "shift", "{")
      table[48] = "]"
      table.mod(48, "shift", "}")
      table[49] = "\\"
      table.mod(49, "shift", "|")
      table[56] = "/"
      table.mod(56, "shift", "?")
      table[51] = ";"
      table.mod(51, "shift", ":")
      table[52] = "'"
      table.mod(52, "shift", "\"")
      table[53] = "`"
      table.mod(53, "shift", "~")
      table[54] = ","
      table.mod(54, "shift", "<")
      table[55] = "."
      table.mod(55, "shift", ">")
      table[73] = "~"
      table.clear_tags

      table.start_tag(:special)
      table[40] = "<Rtrn>"
      table[41] = "<Esc>"
      table[42] = "<Bksp>"
      table[43] = "<Tab>"
      table[44] = "<Spc>"
      table[57] = "<Cplk>"
      table[71] = "<Scrlk>"
      table[74] = "<Home>"
      table[75] = "<PgUp>"
      table[76] = "<Delete>"
      table[77] = "<End>"
      table[78] = "<PgDn>"
      table[79] = "<Right>"
      table[80] = "<Left>"
      table[81] = "<Down>"
      table[82] = "<Up>"
      table[83] = "<Nmlk>"

      table.start_tag(:fkeys)
      ("1".."12").to_a.each_with_index do |fkey, idx|
        table[idx+58] = "F" + fkey
      end
      table.end_tag(:fkeys)

      table.start_tag(:hardware_control)
      table[-2] = "<<Mass Storage Mode>>"
      table[-3] = "<<Upgrade Mode>>"
      table[-4] = "<<Disable Mouse Mode>>"
      table[-5] = "<<Enable Mouse Mode>>"
      table.clear_tags

      table
    end
end
new() click to toggle source
# File lib/twiddler/config.rb, line 389
def initialize()
  @mouse = []
  @keyboard = []
  @configs = {}
end

Public Instance Methods

inspect() click to toggle source
# File lib/twiddler/config.rb, line 401
def inspect
  "<Twiddler::Config: \n  " + 
    "Config: #{@configs.inspect}\n  " + 
  @keyboard.map do |chord|
    chord.render
  end.join("\n  ") + 
    "\n  ---\n  " + 
    @mouse.map do |chord|
    chord.render
    end.join("\n  ") + "\n" +
      ">"
end
keytable() click to toggle source
# File lib/twiddler/config.rb, line 395
def keytable
  self.class.keytable
end