Mercurial > wow > skeletonkey
comparison SkeletonKey/BindingsUI.lua @ 18:91398d284a99
- stickyMode and hoverInput togglers with tooltips
- remove keybinds via an interface button
- turn off key input when receiving GAMEMENU key
- ignore modifier keys
- mask out key selections that are bound to core interface functions (todo: selectively free up combinations involving 1-6, F1-F12, etc.)
| author | Nenue |
|---|---|
| date | Sat, 30 Jul 2016 03:33:09 -0400 |
| parents | 500f9b2bd9ac |
| children | 67db6b712bf3 |
comparison
equal
deleted
inserted
replaced
| 17:500f9b2bd9ac | 18:91398d284a99 |
|---|---|
| 136 kb.bindingstext:SetText(self.bindingText) | 136 kb.bindingstext:SetText(self.bindingText) |
| 137 kb.fadeStep = 0 | 137 kb.fadeStep = 0 |
| 138 kb.throttle = 0 | 138 kb.throttle = 0 |
| 139 kb:SetScript('OnUpdate', KeyBinder_OnUpdate) | 139 kb:SetScript('OnUpdate', KeyBinder_OnUpdate) |
| 140 | 140 |
| 141 if kb.db.hoverInput and kb.saveTarget ~= self then | |
| 142 kb.ActivateSlot(self) | |
| 143 kb.ui() | |
| 144 end | |
| 145 | |
| 141 end | 146 end |
| 142 else | 147 else |
| 143 if self.active then | 148 if self.active then |
| 144 self.active = nil | 149 self.active = nil |
| 150 kb.DeactivateSlot(self) | |
| 151 kb.ui() | |
| 145 end | 152 end |
| 146 end | 153 end |
| 147 end | 154 end |
| 148 | 155 |
| 149 local KeyBinder_OnMouseWheel = function(self, delta) | 156 local KeyBinder_OnMouseWheel = function(self, delta) |
| 166 for i = 1, #kb.buttons do | 173 for i = 1, #kb.buttons do |
| 167 kb.buttons[i]:SetSize(KEY_BUTTON_SIZE,KEY_BUTTON_SIZE) | 174 kb.buttons[i]:SetSize(KEY_BUTTON_SIZE,KEY_BUTTON_SIZE) |
| 168 end | 175 end |
| 169 | 176 |
| 170 kb.ui(true) | 177 kb.ui(true) |
| 178 end | |
| 179 | |
| 180 local CheckButton_OnEnter = function(self) | |
| 181 if self.tooltip then | |
| 182 GameTooltip:SetOwner(self) | |
| 183 GameTooltip:SetText(self.tooltip) | |
| 184 GameTooltip:Show() | |
| 185 end | |
| 186 end | |
| 187 local CheckButton_OnLeave = function(self) | |
| 188 if self.tooltip and GameTooltip:GetOwner() == self then | |
| 189 GameTooltip:Hide() | |
| 190 end | |
| 191 | |
| 171 end | 192 end |
| 172 | 193 |
| 173 local KeyBinder_OnHide = function() | 194 local KeyBinder_OnHide = function() |
| 174 KeyBinderImportLog:Hide() | 195 KeyBinderImportLog:Hide() |
| 175 end | 196 end |
| 269 kb:uibutton( | 290 kb:uibutton( |
| 270 'KeyBinderInventoryButton', 'Bags', nil, | 291 'KeyBinderInventoryButton', 'Bags', nil, |
| 271 function() OpenAllBags() end, | 292 function() OpenAllBags() end, |
| 272 "Interface\\BUTTONS\\UI-MicroButtonCharacter-Up", {0, 1, .4, 1}) | 293 "Interface\\BUTTONS\\UI-MicroButtonCharacter-Up", {0, 1, .4, 1}) |
| 273 | 294 |
| 295 KeyBinderStickyMode.tooltip = 'Keep input active after receiving a key.' | |
| 274 KeyBinderStickyMode:SetScript('OnClick', function(self) | 296 KeyBinderStickyMode:SetScript('OnClick', function(self) |
| 275 | 297 kb.db.stickyMode = self:GetChecked() |
| 276 kb.stickyMode = self:GetChecked() | 298 if not kb.db.stickyMode then |
| 277 if not kb.stickyMode then | |
| 278 if kb.saveTarget then | 299 if kb.saveTarget then |
| 279 kb.DeactivateSlot(kb.saveTarget) | 300 kb.DeactivateSlot(kb.saveTarget) |
| 280 end | 301 end |
| 281 end | 302 end |
| 282 | |
| 283 kb.ui() | 303 kb.ui() |
| 284 end) | 304 end) |
| 305 if kb.db.stickyMode then | |
| 306 KeyBinderStickyMode:SetChecked(true) | |
| 307 end | |
| 308 | |
| 309 KeyBinderHoverInput.tooltip = 'Enable key input when the cursor is over a binding slot.' | |
| 310 KeyBinderHoverInput:SetScript('OnClick', function(self) | |
| 311 kb.db.hoverInput = self:GetChecked() | |
| 312 kb.ui() | |
| 313 end) | |
| 314 if kb.db.hoverInput then | |
| 315 KeyBinderHoverInput:SetChecked(true) | |
| 316 end | |
| 317 | |
| 318 | |
| 319 KeyBinderUnbindButton:SetScript('OnClick', function() | |
| 320 if kb.saveTarget then | |
| 321 kb.UnbindSlot(kb.saveTarget) | |
| 322 end | |
| 323 kb.ui() | |
| 324 end) | |
| 325 | |
| 326 KeyBinderStickyMode:SetScript('OnEnter', CheckButton_OnEnter) | |
| 327 KeyBinderHoverInput:SetScript('OnEnter', CheckButton_OnEnter) | |
| 328 KeyBinderStickyMode:SetScript('OnLeave', CheckButton_OnLeave) | |
| 329 KeyBinderHoverInput:SetScript('OnLeave', CheckButton_OnLeave) | |
| 285 | 330 |
| 286 kb.info:SetPoint('TOPLEFT', kb.UIPanels[1], 'BOTTOMLEFT', 0, -BUTTON_SPACING) | 331 kb.info:SetPoint('TOPLEFT', kb.UIPanels[1], 'BOTTOMLEFT', 0, -BUTTON_SPACING) |
| 287 HEADER_OFFSET = kb.UIPanels[1]:GetHeight() + BUTTON_PADDING | 332 HEADER_OFFSET = kb.UIPanels[1]:GetHeight() + BUTTON_PADDING |
| 288 + kb.info:GetHeight() | 333 + kb.info:GetHeight() |
| 289 FOOTER_OFFSET = saveButton:GetHeight() + BUTTON_PADDING | 334 FOOTER_OFFSET = saveButton:GetHeight() + BUTTON_PADDING |
| 393 KeyBinderUnbindButton:Show() | 438 KeyBinderUnbindButton:Show() |
| 394 else | 439 else |
| 395 KeyBinderUnbindButton:Hide() | 440 KeyBinderUnbindButton:Hide() |
| 396 end | 441 end |
| 397 | 442 |
| 443 KeyBinderStickyMode.label:SetText(kb.db.stickyMode and 'Sticky' or 'Normal') | |
| 444 KeyBinderHoverInput.label:SetText(kb.db.hoverInput and 'MouseOver' or 'Manual') | |
| 398 | 445 |
| 399 -- Reset this so talent cache can be rebuilt | 446 -- Reset this so talent cache can be rebuilt |
| 400 kb.talentsPushed = nil | 447 kb.talentsPushed = nil |
| 401 end | 448 end |
| 402 | 449 |
