/trunk/BindingsReminder
if (not BindingsReminder) then BindingsReminder = {} end |
BindingsReminder.dvorak = { |
[1] = "ESC", |
local layout = { |
[1] = {"ESCAPE","ESC"}, |
[2] = "F1", |
[3] = "F2", |
[4] = "F3", |
[96] = {"NUMPADDECIMAL","."}, |
} |
--BindingsReminder.cLayout = BindingsReminder.dvorak |
BindingsReminder.RegisterLayout("Dvorak", "Dvorak layout", layout) |
if (not BindingsReminder) then BindingsReminder = {} end |
BindingsReminder.qwerty = { |
local layout = { |
[1] = {"ESCAPE","ESC"}, |
[2] = "F1", |
[3] = "F2", |
[95] = {"NUMPAD0","0"}, |
[96] = {"NUMPADDECIMAL","."}, |
} |
BindingsReminder.qwerty = layout |
BindingsReminder.cLayout = BindingsReminder.qwerty |
BindingsReminder.RegisterLayout("Qwerty", "Standard qwerty keyboard", layout, true) |
<Layer level="ARTWORK"> |
<FontString name="$parentText" inherits="GameFontHighlightSmall" text=""> |
<Anchors> |
<Anchor point="BOTTOM" relativePoint="CENTER"/> |
<Anchor point="CENTER" relativePoint="CENTER"/> |
</Anchors> |
</FontString> |
</Layer> |
local tinsert = table.insert |
local type, next, pairs, getglobal = type, next, pairs, getglobal |
local tostring, tonumber = tostring, tonumber |
local format = string.format |
local string = string |
-- table with all the keys in it. each key is a table |
local _entries = {} |
local _layouts = {} |
local _defaultLayout |
if (not BindingsReminder) then BindingsReminder = {} end |
local BindingsReminder = BindingsReminder |
-- to hold button stuff |
BindingsReminder.bLayout = {} |
local permutations = {"SHIFT","CTRL","ALT","ALT-SHIFT","ALT-CTRL","CTRL-SHIFT","ALT-CTRL-SHIFT"} |
local function _buildBindingsTable() |
local function _buildBindingsTable(reset) |
if reset then _bindings = {} end |
local keyTbl |
local action |
for i=1,#BindingsReminder.cLayout do |
end |
end |
function BindingsReminder.RegisterLayout(name, description, layout, default) |
if default then _defaultLayout = layout end |
tinsert(_layouts, {name, description, layout}) |
table.sort(_layouts, function(a, b) return a[1] > b[1] end) |
end |
function BindingsReminder.DumpBadKeys() |
for button,tbl in pairs(_bindings) do |
local frame = BindingsReminder.bLayout[button] |
end |
function BindingsReminder.CreateKeyBoard() |
BindingsReminder.cLayout = BindingsReminder.qwerty |
BindingsReminder.cLayout = _defaultLayout |
end |
local function _getKey(key) |
end |
end |
function BindingsReminder.SetText(f) |
function BindingsReminder.UpdateLayout() |
_bindings = {} |
_entries = {} |
BindingsReminder.bLayout = {} |
for i=1,96 do |
local f = getglobal("BR_"..i) |
BindingsReminder.SetText(f, true) |
BindingsReminder.KeyToKey(f) |
end |
end |
function BindingsReminder.SetText(f, reset) |
local name = f:GetName() |
local key = string.match(name,"^BR_(.+)$") |
local test = _getKey(tonumber(key)) |
function BindingsReminder.CommandHandler(msg) |
msg = string.lower(msg) |
local tbl = {strsplit(' ', msg)} |
if (msg == "show") then |
-- show the GUI |
BindingsReminderFrame:Show() |
elseif (msg == "dumpbad") then |
BindingsReminder.DumpBadKeys() |
--elseif (msg == "help") then |
elseif (msg == "layouts") then |
DEFAULT_CHAT_FRAME:AddMessage("Available layouts:") |
for i=1,#_layouts do |
local name, description = _layouts[i][1], _layouts[i][2] |
DEFAULT_CHAT_FRAME:AddMessage(format("%s: %s", name, description)) |
end |
elseif (tbl[1] == "layout") then |
local newLayout = tbl[2] |
for i=1,#_layouts do |
if string.lower(_layouts[i][1]) == newLayout then |
BindingsReminder.cLayout = _layouts[i][3] |
end |
end |
BindingsReminder.UpdateLayout() |
BindingsReminder.UpdateTable() |
else |
DEFAULT_CHAT_FRAME:AddMessage("BindingsReminder v".._version) |
DEFAULT_CHAT_FRAME:AddMessage("show: show the keyboard") |
DEFAULT_CHAT_FRAME:AddMessage("hide: hide the keyboard") |
DEFAULT_CHAT_FRAME:AddMessage("layouts: show the available layouts") |
DEFAULT_CHAT_FRAME:AddMessage("layout <newLayout>: update the keyboard for a new layout") |
end |
end |
KeyBindingFrame:HookScript("OnKeyDown", onHide) |
end |
end |
--myBindings = _bindings |
0.9-20400 |
- can now switch layouts |
0.8-20400 |
- relativeTo ~= relativePoint |
0.7-20400 |