-
Notifications
You must be signed in to change notification settings - Fork 0
/
DeviceMappingWoW.lua
180 lines (169 loc) · 13.7 KB
/
DeviceMappingWoW.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
--
-- 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/DirectKeyMapOverride.lua")
dofile(sourceDirectory .. "lua/DirectKeyWithModifierMap.lua")
-- dofile(sourceDirectory .. "lua/DirectMouseButtonMap.lua")
-- dofile(sourceDirectory .. "lua/OneShotKeyCombinationMap.lua")
-- dofile(sourceDirectory .. "lua/DirectMacroMap.lua")
-- dofile(sourceDirectory .. "lua/OneShotMacroMap.lua")
-- dofile(sourceDirectory .. "lua/TabNavigationSequence.lua")
local GShiftState = ModifierState:new()
local GShiftShiftMap = DirectKeyMapOverride:new(GHubDefs.ScanCodes.LeftShift)
local G9Action = DirectKeyMap:new(GHubDefs.ScanCodes.F1, GHubDefs.ScanCodes.LeftShift, GHubDefs.ScanCodes.LeftControl)
local G10Action = DirectKeyMap:new(GHubDefs.ScanCodes.F2, GHubDefs.ScanCodes.LeftShift, GHubDefs.ScanCodes.LeftControl)
local G11Action = DirectKeyMap:new(GHubDefs.ScanCodes.F3, GHubDefs.ScanCodes.LeftShift, GHubDefs.ScanCodes.LeftControl)
local G12Action = DirectKeyMap:new(GHubDefs.ScanCodes.F4, GHubDefs.ScanCodes.LeftShift, GHubDefs.ScanCodes.LeftControl)
local G13Action = DirectKeyMap:new(GHubDefs.ScanCodes.F5, GHubDefs.ScanCodes.LeftShift, GHubDefs.ScanCodes.LeftControl)
local G14Action = DirectKeyMap:new(GHubDefs.ScanCodes.F6, GHubDefs.ScanCodes.LeftShift, GHubDefs.ScanCodes.LeftControl)
local G15Action = DirectKeyMap:new(GHubDefs.ScanCodes.F7, GHubDefs.ScanCodes.LeftShift, GHubDefs.ScanCodes.LeftControl)
local G16Action = DirectKeyMap:new(GHubDefs.ScanCodes.F8, GHubDefs.ScanCodes.LeftShift, GHubDefs.ScanCodes.LeftControl)
local G17Action = DirectKeyMap:new(GHubDefs.ScanCodes.F9, GHubDefs.ScanCodes.LeftShift, GHubDefs.ScanCodes.LeftControl)
local G18Action = DirectKeyMap:new(GHubDefs.ScanCodes.F10, GHubDefs.ScanCodes.LeftShift, GHubDefs.ScanCodes.LeftControl)
local G19Action = DirectKeyMap:new(GHubDefs.ScanCodes.F11, GHubDefs.ScanCodes.LeftShift, GHubDefs.ScanCodes.LeftControl)
local G20Action = DirectKeyMap:new(GHubDefs.ScanCodes.F12, GHubDefs.ScanCodes.LeftShift, GHubDefs.ScanCodes.LeftControl)
local ShiftG9Action = DirectKeyMap:new(GHubDefs.ScanCodes.F1, GHubDefs.ScanCodes.LeftShift, GHubDefs.ScanCodes.LeftAlt)
local ShiftG10Action = DirectKeyMap:new(GHubDefs.ScanCodes.Digit2, GHubDefs.ScanCodes.LeftShift, GHubDefs.ScanCodes.LeftAlt)
local ShiftG11Action = DirectKeyMap:new(GHubDefs.ScanCodes.Digit3, GHubDefs.ScanCodes.LeftShift, GHubDefs.ScanCodes.LeftAlt)
local ShiftG12Action = DirectKeyMap:new(GHubDefs.ScanCodes.Digit4, GHubDefs.ScanCodes.LeftShift, GHubDefs.ScanCodes.LeftAlt)
local ShiftG13Action = DirectKeyMap:new(GHubDefs.ScanCodes.F5, GHubDefs.ScanCodes.LeftShift, GHubDefs.ScanCodes.LeftAlt)
local ShiftG14Action = DirectKeyMap:new(GHubDefs.ScanCodes.F6, GHubDefs.ScanCodes.LeftShift, GHubDefs.ScanCodes.LeftAlt)
local ShiftG15Action = DirectKeyMap:new(GHubDefs.ScanCodes.F7, GHubDefs.ScanCodes.LeftShift, GHubDefs.ScanCodes.LeftAlt)
local ShiftG16Action = DirectKeyMap:new(GHubDefs.ScanCodes.Digit8, GHubDefs.ScanCodes.LeftShift, GHubDefs.ScanCodes.LeftAlt)
local ShiftG17Action = DirectKeyMap:new(GHubDefs.ScanCodes.F9, GHubDefs.ScanCodes.LeftShift, GHubDefs.ScanCodes.LeftAlt)
local ShiftG18Action = DirectKeyMap:new(GHubDefs.ScanCodes.Digit0, GHubDefs.ScanCodes.LeftShift, GHubDefs.ScanCodes.LeftAlt)
local ShiftG19Action = DirectKeyMap:new(GHubDefs.ScanCodes.F11, GHubDefs.ScanCodes.LeftShift, GHubDefs.ScanCodes.LeftAlt)
local ShiftG20Action = DirectKeyMap:new(GHubDefs.ScanCodes.F12, GHubDefs.ScanCodes.LeftShift, GHubDefs.ScanCodes.LeftAlt)
local CtrlG9Action = DirectKeyWithModifierMap:new(GHubDefs.Modifier.Control, nil, GHubDefs.ScanCodes.Digit1, GHubDefs.ScanCodes.LeftShift)
local CtrlG10Action = DirectKeyWithModifierMap:new(GHubDefs.Modifier.Control, nil, GHubDefs.ScanCodes.Digit2, GHubDefs.ScanCodes.LeftShift)
local CtrlG11Action = DirectKeyWithModifierMap:new(GHubDefs.Modifier.Control, nil, GHubDefs.ScanCodes.Digit3, GHubDefs.ScanCodes.LeftShift)
local CtrlG12Action = DirectKeyWithModifierMap:new(GHubDefs.Modifier.Control, nil, GHubDefs.ScanCodes.Digit4, GHubDefs.ScanCodes.LeftShift)
local CtrlG13Action = DirectKeyWithModifierMap:new(GHubDefs.Modifier.Control, nil, GHubDefs.ScanCodes.Digit5, GHubDefs.ScanCodes.LeftShift)
local CtrlG14Action = DirectKeyWithModifierMap:new(GHubDefs.Modifier.Control, nil, GHubDefs.ScanCodes.Digit6, GHubDefs.ScanCodes.LeftShift)
local CtrlG15Action = DirectKeyWithModifierMap:new(GHubDefs.Modifier.Control, nil, GHubDefs.ScanCodes.Digit7, GHubDefs.ScanCodes.LeftShift)
local CtrlG16Action = DirectKeyWithModifierMap:new(GHubDefs.Modifier.Control, nil, GHubDefs.ScanCodes.LeftBracket, GHubDefs.ScanCodes.LeftShift)
local CtrlG17Action = DirectKeyWithModifierMap:new(GHubDefs.Modifier.Control, nil, GHubDefs.ScanCodes.RightBracket, GHubDefs.ScanCodes.LeftShift)
local CtrlG18Action = DirectKeyWithModifierMap:new(GHubDefs.Modifier.Control, nil, GHubDefs.ScanCodes.Tilde, GHubDefs.ScanCodes.LeftShift)
local CtrlG19Action = DirectKeyWithModifierMap:new(GHubDefs.Modifier.Control, nil, GHubDefs.ScanCodes.Minus, GHubDefs.ScanCodes.LeftShift)
local CtrlG20Action = DirectKeyWithModifierMap:new(GHubDefs.Modifier.Control, nil, GHubDefs.ScanCodes.Equal, GHubDefs.ScanCodes.LeftShift)
GShiftState:registerWith(DeviceEventHandler, DeviceEventHandler, GHubDefs.GShiftButton)
GShiftShiftMap:registerWith(GHubDefs.GShiftButton)
DirectKeyMapOverride:registerOverrides(DeviceEventHandler)
G9Action:registerWith(DeviceEventHandler, GHubDefs.G9)
G10Action:registerWith(DeviceEventHandler, GHubDefs.G10)
G11Action:registerWith(DeviceEventHandler, GHubDefs.G11)
G12Action:registerWith(DeviceEventHandler, GHubDefs.G12)
G13Action:registerWith(DeviceEventHandler, GHubDefs.G13)
G14Action:registerWith(DeviceEventHandler, GHubDefs.G14)
G15Action:registerWith(DeviceEventHandler, GHubDefs.G15)
G16Action:registerWith(DeviceEventHandler, GHubDefs.G16)
G17Action:registerWith(DeviceEventHandler, GHubDefs.G17)
G18Action:registerWith(DeviceEventHandler, GHubDefs.G18)
G19Action:registerWith(DeviceEventHandler, GHubDefs.G19)
G20Action:registerWith(DeviceEventHandler, GHubDefs.G20)
ShiftG9Action:registerWith(GShiftState, GHubDefs.G9)
ShiftG10Action:registerWith(GShiftState, GHubDefs.G10)
ShiftG11Action:registerWith(GShiftState, GHubDefs.G11)
ShiftG12Action:registerWith(GShiftState, GHubDefs.G12)
ShiftG13Action:registerWith(GShiftState, GHubDefs.G13)
ShiftG14Action:registerWith(GShiftState, GHubDefs.G14)
ShiftG15Action:registerWith(GShiftState, GHubDefs.G15)
ShiftG16Action:registerWith(GShiftState, GHubDefs.G16)
ShiftG17Action:registerWith(GShiftState, GHubDefs.G17)
ShiftG18Action:registerWith(GShiftState, GHubDefs.G18)
ShiftG19Action:registerWith(GShiftState, GHubDefs.G19)
ShiftG20Action:registerWith(GShiftState, GHubDefs.G20)
CtrlG9Action:registerWith(DeviceEventHandler, GHubDefs.G9)
CtrlG10Action:registerWith(DeviceEventHandler, GHubDefs.G10)
CtrlG11Action:registerWith(DeviceEventHandler, GHubDefs.G11)
CtrlG12Action:registerWith(DeviceEventHandler, GHubDefs.G12)
CtrlG13Action:registerWith(DeviceEventHandler, GHubDefs.G13)
CtrlG14Action:registerWith(DeviceEventHandler, GHubDefs.G14)
CtrlG15Action:registerWith(DeviceEventHandler, GHubDefs.G15)
CtrlG16Action:registerWith(DeviceEventHandler, GHubDefs.G16)
CtrlG17Action:registerWith(DeviceEventHandler, GHubDefs.G17)
CtrlG18Action:registerWith(DeviceEventHandler, GHubDefs.G18)
CtrlG19Action:registerWith(DeviceEventHandler, GHubDefs.G19)
CtrlG20Action:registerWith(DeviceEventHandler, GHubDefs.G20)
-- 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 Minimize_Maximize_Button = GHubDefs.KeyPad[GHubDefs.LowerRow ][GHubDefs.FrontColumn]
-- local Delete_Backspace_Button = GHubDefs.KeyPad[GHubDefs.UpperRow ][GHubDefs.FrontColumn]
-- local Wheel_Click_Button = GHubDefs.MiddleButton
-- local Tab_Space_Button = GHubDefs.KeyPad[GHubDefs.MiddleRow][GHubDefs.FrontColumn]
-- local Playback_Control_Button = GHubDefs.KeyPad[GHubDefs.MiddleRow][GHubDefs.MiddleBackColumn]
-- local Scroll_Left_and_App_Tab_Button = GHubDefs.KeyPad[GHubDefs.LowerRow ][GHubDefs.BackColumn]
-- local Scroll_Right_and_App_Tab_Button = GHubDefs.KeyPad[GHubDefs.MiddleRow][GHubDefs.BackColumn]
--
-- local GShiftState = ModifierState:new()
-- local SecondShiftState = ModifierState:new()
-- local RaiseVolumeMap = DirectMacroMap:new("Raise Volume")
-- local LowerVolumeMap = DirectMacroMap:new("Lower Volume")
-- local SecondShiftMap = DirectMouseButtonMap:new(GHubDefs.MouseButtonLocation.Right)
-- local EndKeyMap = DirectKeyMap:new(GHubDefs.ScanCodes.End)
-- local HomeKeyMap = DirectKeyMap:new(GHubDefs.ScanCodes.Home)
-- local CtrlEndMap = OneShotKeyCombinationMap:new(GHubDefs.ScanCodes.LeftControl, GHubDefs.ScanCodes.End)
-- local CtrlHomeMap = OneShotKeyCombinationMap:new(GHubDefs.ScanCodes.LeftControl, 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 App2TabSequence = TabNavigationSequence:new(GHubDefs.ScanCodes.LeftGui, GHubDefs.ScanCodes.LeftShift, GHubDefs.ScanCodes.Digit2)
-- local GoBackKeyMap = OneShotKeyCombinationMap:new(GHubDefs.ScanCodes.LeftAlt, GHubDefs.ScanCodes.Left)
-- local MinimizeMap = OneShotKeyCombinationMap:new(GHubDefs.ScanCodes.LeftGui, GHubDefs.ScanCodes.Down)
-- local MaximizeMap = OneShotKeyCombinationMap:new(GHubDefs.ScanCodes.LeftGui, GHubDefs.ScanCodes.Up)
-- local DeleteKeyMap = DirectKeyMap:new(GHubDefs.ScanCodes.Delete)
-- local BackspaceKeyMap = DirectKeyMap:new(GHubDefs.ScanCodes.Backspace)
-- local GoUpKeyMap = OneShotKeyCombinationMap:new(GHubDefs.ScanCodes.LeftAlt, GHubDefs.ScanCodes.Up)
-- local SaveKeyMap = OneShotKeyCombinationMap:new(GHubDefs.ScanCodes.LeftControl, GHubDefs.ScanCodes.S)
-- local OpenKeyMap = OneShotKeyCombinationMap:new(GHubDefs.ScanCodes.LeftControl, GHubDefs.ScanCodes.O)
-- local NewTabKeyMap = OneShotKeyCombinationMap:new(GHubDefs.ScanCodes.LeftControl, GHubDefs.ScanCodes.T)
-- local TabKeyMap = DirectKeyMap:new(GHubDefs.ScanCodes.Tab)
-- local SpaceKeyMap = DirectKeyMap:new(GHubDefs.ScanCodes.Spacebar)
-- local PlaybackControlMap = DirectMacroMap:new("Play Pause")
-- local ScrollLeftMap = DirectMacroMap:new("Repeat Scroll Left")
-- local ScrollRightMap = DirectMacroMap:new("Repeat Scroll Right")
--
-- GShiftState:registerWith(DeviceEventHandler, DeviceEventHandler, GHubDefs.GShiftButton)
-- SecondShiftMap:registerWith(DeviceEventHandler, Second_Shift_Button)
-- SecondShiftState:registerWith(DeviceEventHandler, GShiftState, GHubDefs.RightButton)
-- GoBackKeyMap:registerWith(DeviceEventHandler, Back_and_Control_Tab_Button)
-- CtrlEndMap:registerWith(SecondShiftState, Volume_Down_and_Page_Down_Button)
-- CtrlHomeMap: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)
-- App2TabSequence:registerWith(SecondShiftState, Scroll_Left_and_App_Tab_Button, Scroll_Right_and_App_Tab_Button)
-- MinimizeMap:registerWith(GShiftState, Minimize_Maximize_Button)
-- MaximizeMap:registerWith(SecondShiftState, Minimize_Maximize_Button)
-- DeleteKeyMap:registerWith(GShiftState, Delete_Backspace_Button)
-- BackspaceKeyMap:registerWith(SecondShiftState, Delete_Backspace_Button)
-- GoUpKeyMap:registerWith(GShiftState, Wheel_Click_Button)
-- SaveKeyMap:registerWith(SecondShiftState, Wheel_Click_Button)
-- TabKeyMap:registerWith(GShiftState, Tab_Space_Button)
-- SpaceKeyMap:registerWith(SecondShiftState, Tab_Space_Button)
-- PlaybackControlMap:registerWith(GShiftState, Playback_Control_Button)
-- OpenKeyMap:registerWith(SecondShiftState, Playback_Control_Button)
-- NewTabKeyMap:registerWith(DeviceEventHandler, GHubDefs.KeyPad[GHubDefs.UpperRow][GHubDefs.MiddleBackColumn])
-- ScrollLeftMap:registerWith(GShiftState, Scroll_Left_and_App_Tab_Button)
-- ScrollRightMap:registerWith(GShiftState, Scroll_Right_and_App_Tab_Button)