-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathConfig.lua
More file actions
executable file
·225 lines (197 loc) · 7.46 KB
/
Config.lua
File metadata and controls
executable file
·225 lines (197 loc) · 7.46 KB
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
-- Config
-- user defined options and saved vars
-------------------------------------------------------------------------------
-- Module Loading
-------------------------------------------------------------------------------
---@type TotesEmotes
local ADDON_NAME, Totes = ...
Totes.Wormhole()
---@class Config -- IntelliJ-EmmyLua annotation
---@field opts Options
---@field optDefaults Options
Config = { }
-------------------------------------------------------------------------------
-- Configuration Options Menu UI
-------------------------------------------------------------------------------
function Config:new()
return Object:new(Config)
end
local function optKeyBind(config, value)
if value ~= nil then
local valueB = GetBindingKey(KEYBINDING_ID);
if valueB then
SetBinding(valueB);
end
if value ~= "" then
SetBinding(value, KEYBINDING_ID);
end
SaveBindings(GetCurrentBindingSet());
end
return GetBindingKey(KEYBINDING_ID);
end
---@type table
local optionsMenu
---@return table
local function initializeOptionsMenu()
if optionsMenu then
return optionsMenu
end
local opts = DB.opts
local isKeyboardDisabled = function()
return not opts.isKeyboardEnabled
end
optionsMenu = {
name = Totes.myTitle,
type = "group",
args = {
-------------------------------------------------------------------------------
-- General Options
-------------------------------------------------------------------------------
introText = {
order = 100,
type = 'description',
fontSize = "small",
name = [=[All /emotes are a few clicks away!
Tips:
]=].. L10N.getTipsForConfigScreen(),
},
-------------------------------------------------------------------------------
-- Enable Keyboard
-------------------------------------------------------------------------------
keyboardHeader = {
order = 500,
name = "Keyboard Controls",
type = 'header',
},
keyboardHelp = {
order = 510,
type = 'description',
name = "TotesEmotes can be controlled with both the mouse and keyboard. However, you can disable the keyboard if you don't want the menu to intercept keystrokes.",
},
keyboardEnabled = {
order = 520,
name = "Enable Keyboard",
desc = "Don't intercept any keystrokes. Control emotes using only the mouse.",
type = "toggle",
set = function(optionsMenu, val)
opts.isKeyboardEnabled = val
if val then
TheMenu:enableKeyboard(true)
else
TheMenu:enableKeyboard(false)
end
end,
get = function()
return opts.isKeyboardEnabled
end,
},
-------------------------------------------------------------------------------
-- shortcut numbering
-------------------------------------------------------------------------------
quickHeader = {
order = 1000,
name = "Shortcut Quick Keys",
type = 'header',
hidden = isKeyboardDisabled,
},
quickHelp = {
order = 1010,
type = 'description',
name = "The first several emotes in the menu can be triggered via a key-press. By default, these are: 1, 2, 3, ... 9, and 0",
hidden = isKeyboardDisabled,
},
quickKeyBacktick = {
order = 1100,
name = "Start with `",
desc = "The quick keys will start with the ` before the 1",
--width = "full",
type = "toggle",
set = function(optionsMenu, val)
opts.quickKeyBacktick = val
-- TODO reinit
end,
get = function()
return opts.quickKeyBacktick
end,
hidden = isKeyboardDisabled,
},
quickKeyDash = {
order = 1200,
name = "Include -",
desc = 'The quick keys will include "-" after 0',
--width = "full",
type = "toggle",
set = function(optionsMenu, val)
opts.quickKeyDash = val
-- TODO reinit
end,
get = function()
return opts.quickKeyDash
end,
hidden = isKeyboardDisabled,
},
quickKeyEqual = {
order = 1300,
name = "Include =",
desc = 'The quick keys will include "=" on the end',
--width = "full",
type = "toggle",
set = function(optionsMenu, val)
opts.quickKeyEqual = val
-- TODO reinit
end,
get = function()
return opts.quickKeyEqual
end,
hidden = isKeyboardDisabled,
},
-------------------------------------------------------------------------------
-- Autocomplete
-------------------------------------------------------------------------------
everythingHeader = {
order = 2000,
name = "Autocomplete",
type = 'header',
hidden = isKeyboardDisabled,
},
everythingHelp = {
order = 2010,
type = 'description',
name = "While the menu is open, typing in a word will trigger a search for matching emotes.",
hidden = isKeyboardDisabled,
},
-------------------------------------------------------------------------------
-- Key Bindings
-------------------------------------------------------------------------------
keybindingHeader = {
order = 3000,
name = "Key Bindings",
type = 'header',
},
keybindingBinder = {
order = 3010,
type = "keybinding",
width = "double",
name = "Toggle Menu",
desc = "Open and close the menu of emotes.",
get = optKeyBind,
set = optKeyBind,
},
}
}
return optionsMenu
end
-------------------------------------------------------------------------------
-- Mouse Button opt maker
-------------------------------------------------------------------------------
function Config:initializeOptionsMenu()
initializeOptionsMenu()
--local db = LibStub("AceDB-3.0"):New(ADDON_NAME, defaults)
--options.args.profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(db)
LibStub("AceConfig-3.0"):RegisterOptionsTable(ADDON_NAME, optionsMenu)
LibStub("AceConfigDialog-3.0.TOTES"):AddToBlizOptions(ADDON_NAME, Totes.myTitle)
end
function Config:open()
--print("TOTES Totes.configUiId",Totes.configUiId)
Settings.OpenToCategory(Totes.configUiId, Totes.myTitle)
end