-
Notifications
You must be signed in to change notification settings - Fork 0
/
DeviceMappingAtmel.lua
61 lines (56 loc) · 3.81 KB
/
DeviceMappingAtmel.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
--
-- Main file connecting all the mappings
--
local sourceDirectory = debug.getinfo(1).source:match("@?(.*[/\\])") or ""
dofile(sourceDirectory .. "lua/strict.lua")
dofile(sourceDirectory .. "lua/GHubDefs.lua")
dofile(sourceDirectory .. "lua/BaseHandlerTable.lua")
dofile(sourceDirectory .. "lua/ModifierState.lua")
dofile(sourceDirectory .. "lua/DeviceEventHandler.lua")
dofile(sourceDirectory .. "lua/DirectKeyMap.lua")
dofile(sourceDirectory .. "lua/OneShotKeyCombinationMap.lua")
dofile(sourceDirectory .. "lua/DirectMacroMap.lua")
dofile(sourceDirectory .. "lua/OneShotMacroMap.lua")
dofile(sourceDirectory .. "lua/TabNavigationSequence.lua")
local G_Shift_Button = GHubDefs.GShiftButton
local Second_Shift_Button = GHubDefs.RightButton
local Pseudo_Tab_Button_for_Alt_Tab = GHubDefs.KeyPad[GHubDefs.UpperRow ][GHubDefs.BackColumn]
local Pseudo_Tab_Button_for_Control_Tab = GHubDefs.KeyPad[GHubDefs.MiddleRow][GHubDefs.MiddleFrontColumn]
local Volume_Down_and_Page_Down_Button = GHubDefs.KeyPad[GHubDefs.LowerRow ][GHubDefs.MiddleFrontColumn]
local Volume_Up_and_End_Button = GHubDefs.KeyPad[GHubDefs.LowerRow ][GHubDefs.MiddleBackColumn]
local Redo_and_Page_Up_Button = GHubDefs.KeyPad[GHubDefs.UpperRow ][GHubDefs.MiddleFrontColumn]
local Undo_and_Home_Button = GHubDefs.KeyPad[GHubDefs.UpperRow ][GHubDefs.MiddleBackColumn]
local Back_and_Control_Tab_Button = Pseudo_Tab_Button_for_Control_Tab
local Wheel_Click_Button = GHubDefs.MiddleButton
local GShiftState = ModifierState:new()
local SecondShiftState = ModifierState:new()
local PageDownKeyMap = DirectKeyMap:new(GHubDefs.ScanCodes.PageDown)
local PageUpKeyMap = DirectKeyMap:new(GHubDefs.ScanCodes.PageUp)
local RaiseVolumeMap = DirectMacroMap:new("Raise Volume")
local LowerVolumeMap = DirectMacroMap:new("Lower Volume")
local EndKeyMap = DirectKeyMap:new(GHubDefs.ScanCodes.End)
local HomeKeyMap = DirectKeyMap:new(GHubDefs.ScanCodes.Home)
local CutMap = OneShotMacroMap:new("Cut 1")
local UndoMap = OneShotMacroMap:new("Ctrl+Z")
local RedoMap = OneShotMacroMap:new("Ctrl+Y")
local AltTabSequence = TabNavigationSequence:new(GHubDefs.ScanCodes.LeftAlt, GHubDefs.ScanCodes.LeftShift, GHubDefs.ScanCodes.Tab)
local ControlTabSequence = TabNavigationSequence:new(GHubDefs.ScanCodes.LeftControl, GHubDefs.ScanCodes.LeftShift, GHubDefs.ScanCodes.Tab)
local GoBackKeyMap = OneShotKeyCombinationMap:new(GHubDefs.ScanCodes.LeftControl, GHubDefs.ScanCodes.Minus)
local SaveKeyMap = OneShotKeyCombinationMap:new(GHubDefs.ScanCodes.LeftControl, GHubDefs.ScanCodes.S)
local GoToDefinitionMap = DirectKeyMap:new(GHubDefs.ScanCodes.F12)
GShiftState:registerWith(DeviceEventHandler, DeviceEventHandler, GHubDefs.GShiftButton)
SecondShiftState:registerWith(DeviceEventHandler, GShiftState, GHubDefs.RightButton)
GoBackKeyMap:registerWith(DeviceEventHandler, Back_and_Control_Tab_Button)
PageDownKeyMap:registerWith(SecondShiftState, Volume_Down_and_Page_Down_Button)
PageUpKeyMap:registerWith(SecondShiftState, Redo_and_Page_Up_Button)
EndKeyMap:registerWith(SecondShiftState, Volume_Up_and_End_Button)
HomeKeyMap:registerWith(SecondShiftState, Undo_and_Home_Button)
LowerVolumeMap:registerWith(GShiftState, Volume_Down_and_Page_Down_Button)
RaiseVolumeMap:registerWith(GShiftState, Volume_Up_and_End_Button)
CutMap:registerWith(SecondShiftState, Back_and_Control_Tab_Button)
UndoMap:registerWith(GShiftState, Undo_and_Home_Button)
RedoMap:registerWith(GShiftState, Redo_and_Page_Up_Button)
AltTabSequence:registerWith(DeviceEventHandler, GShiftState, Pseudo_Tab_Button_for_Alt_Tab, Pseudo_Tab_Button_for_Control_Tab)
ControlTabSequence:registerWith(GShiftState, Pseudo_Tab_Button_for_Control_Tab, Pseudo_Tab_Button_for_Alt_Tab)
GoToDefinitionMap:registerWith(GShiftState, Wheel_Click_Button)
SaveKeyMap:registerWith(SecondShiftState, Wheel_Click_Button)