Mercurial > wow > skeletonkey
comparison BindingsFrame.lua @ 78:d4c100b0fd01 v7.1.5-80-release
- Fixed an issue with talent bindings not loading between specialization changes.
- Fixed action button text corruption that occurred after changing assignments on an inactive spell.
author | Nenue |
---|---|
date | Thu, 26 Jan 2017 20:25:04 -0500 |
parents | 6623b7f2c1ca |
children | b9a53385462c |
comparison
equal
deleted
inserted
replaced
77:4ca4cc031e99 | 78:d4c100b0fd01 |
---|---|
14 [[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]] | 14 [[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]] |
15 [[Interface\UI-TutorialFrame-QuestGiver\UI-TutorialFrame-QuestGray]] | 15 [[Interface\UI-TutorialFrame-QuestGiver\UI-TutorialFrame-QuestGray]] |
16 --]=] | 16 --]=] |
17 | 17 |
18 SkeletonKeyButtonMixin = {} | 18 SkeletonKeyButtonMixin = {} |
19 local skb = SkeletonKeyButtonMixin | |
19 local _, kb = ... | 20 local _, kb = ... |
20 local print = (DEVIAN_PNAME == 'SkeletonKey') and function(...) _G.print('SKUI', ...) end or nop | 21 local print = (DEVIAN_PNAME == 'SkeletonKey') and function(...) _G.print('SKUI', ...) end or nop |
21 local gprint = (DEVIAN_PNAME == 'SkeletonKey') and function(...) _G.print('SK', ...) end or nop | 22 local gprint = (DEVIAN_PNAME == 'SkeletonKey') and function(...) _G.print('SK', ...) end or nop |
22 local L = kb.L | 23 local L = kb.L |
23 local BINDS_PER_ROW = 2 | 24 local BINDS_PER_ROW = 2 |
421 button.isActive = nil | 422 button.isActive = nil |
422 kb.saveTarget = nil | 423 kb.saveTarget = nil |
423 return true | 424 return true |
424 end | 425 end |
425 | 426 |
427 function ActionListPanel:UnbindSlot (button) | |
428 | |
429 local configTable = kb.currentProfile.buttons[button:GetID()] | |
430 local button = button or kb.saveTarget | |
431 if not button then | |
432 return | |
433 end | |
434 | |
435 local command = button.command | |
436 local actionType = button.actionType | |
437 local actionID = button.actionID | |
438 | |
439 | |
440 local talentName = button.actionName | |
441 if actionType == 'macro' then | |
442 local spellName, _, spellID = GetMacroSpell(actionID) | |
443 talentName = spellName | |
444 end | |
445 | |
446 local keys = {GetBindingKey(command) } | |
447 if configTable and configTable.assignedKeys then | |
448 for _, key in ipairs(configTable.assignedKeys) do | |
449 if not tContains(keys, key) then | |
450 tinsert(keys, key) | |
451 end | |
452 end | |
453 end | |
454 | |
455 -- only manipulate bindings if its an available ability | |
456 if button.isAvailable then | |
457 --print('detected', #keys, 'bindings') | |
458 | |
459 if #keys >= 1 then | |
460 kb.UpdateBindingsCache(actionType, actionID, {}) | |
461 end | |
462 | |
463 for i, key in pairs(keys) do | |
464 --print('clearing', key) | |
465 SetBinding(key, nil) | |
466 kb.bindings[tostring(actionType)..'_'..tostring(actionID)] = nil | |
467 end | |
468 SaveBindings(GetCurrentBindingSet()) | |
469 end | |
470 | |
471 | |
472 if configTable and configTable.assignedKeys then | |
473 table.wipe(configTable.assignedKeys) | |
474 end | |
475 | |
476 if kb.currentProfile.bound[command] then | |
477 kb.currentProfile.bound[command] = nil | |
478 --kb:print(BINDING_REMOVED:format(self.actionName, configHeaders[db.bindMode])) | |
479 end | |
480 kb.saveTarget = nil | |
481 button:UpdateSlot(true) | |
482 return true | |
483 end | |
484 | |
426 function ActionListPanel:OnInput(key) | 485 function ActionListPanel:OnInput(key) |
427 | 486 |
428 if key == 'ESCAPE' then | 487 if key == 'ESCAPE' then |
429 return self:DeactivateSlot(kb.saveTarget) | 488 return self:DeactivateSlot(kb.saveTarget) |
430 end | 489 end |
446 | 505 |
447 function SystemBindingsPanel:Update(force) | 506 function SystemBindingsPanel:Update(force) |
448 end | 507 end |
449 | 508 |
450 --- Associate processed input with the given slot's metadata | 509 --- Associate processed input with the given slot's metadata |
451 function SkeletonKeyButtonMixin:SaveSlot (key) | 510 function skb:SaveSlot (key) |
452 | 511 |
453 if not self.command then | 512 if not self.command then |
454 return | 513 return |
455 end | 514 end |
456 if InCombatLockdown() then | 515 if InCombatLockdown() then |
503 if self.isAvailable then | 562 if self.isAvailable then |
504 print('Binding available spell', binding, self.command) | 563 print('Binding available spell', binding, self.command) |
505 SetBinding(binding, self.command) | 564 SetBinding(binding, self.command) |
506 SaveBindings(GetCurrentBindingSet()) | 565 SaveBindings(GetCurrentBindingSet()) |
507 self.assignedKeys = {GetBindingKey(self.command) } | 566 self.assignedKeys = {GetBindingKey(self.command) } |
508 | 567 kb.UpdateBindingsCache(self.actionType, self.actionID, self.assignedKeys) |
509 kb:print(L('BINDING_ASSIGNED', binding, self.actionName, kb.currentHeader)) | 568 kb:print(L('BINDING_ASSIGNED', binding, self.actionName, kb.currentHeader)) |
510 else | 569 else |
511 kb:print(L('UNSELECTED_TALENT_ASSIGNED', binding, self.actionName, kb.currentHeader)) | 570 kb:print(L('UNSELECTED_TALENT_ASSIGNED', binding, self.actionName, kb.currentHeader)) |
512 end | 571 end |
513 | 572 |
514 if not tContains(self.assignedKeys, binding) then | 573 if not tContains(self.assignedKeys, binding) then |
515 tinsert(self.assignedKeys, 1, binding) | 574 tinsert(self.assignedKeys, 1, binding) |
516 end | 575 end |
517 | |
518 | 576 |
519 for _, key in ipairs(self.assignedKeys) do | 577 for _, key in ipairs(self.assignedKeys) do |
520 if not kb.currentProfile.bindings[key] then | 578 if not kb.currentProfile.bindings[key] then |
521 kb.currentProfile.bindings[key] = self.command | 579 kb.currentProfile.bindings[key] = self.command |
522 end | 580 end |
528 profile.commands[self.command] = nil | 586 profile.commands[self.command] = nil |
529 profile.bound[self.command] = nil | 587 profile.bound[self.command] = nil |
530 end | 588 end |
531 end | 589 end |
532 | 590 |
533 kb.UpdateBindingsCache(self.actionType, self.actionID, self.assignedKeys) | |
534 | |
535 self.binding = binding | 591 self.binding = binding |
536 | |
537 return true | 592 return true |
538 end | 593 end |
539 | 594 |
540 function SkeletonKeyMixin:OnKeyDown(key) | 595 function SkeletonKeyMixin:OnKeyDown(key) |
541 self:ProcessInput(key) | 596 self:ProcessInput(key) |
546 function SkeletonKeyMixin:OnDragStart() | 601 function SkeletonKeyMixin:OnDragStart() |
547 self:StartMoving() | 602 self:StartMoving() |
548 end | 603 end |
549 function SkeletonKeyMixin:OnDragStop() | 604 function SkeletonKeyMixin:OnDragStop() |
550 self:StopMovingOrSizing() | 605 self:StopMovingOrSizing() |
551 end | |
552 | |
553 function ActionListPanel:UnbindSlot (button) | |
554 | |
555 local configTable = kb.currentProfile.buttons[button:GetID()] | |
556 local button = button or kb.saveTarget | |
557 if not button then | |
558 return | |
559 end | |
560 | |
561 local command = button.command | |
562 local actionType = button.actionType | |
563 local actionID = button.actionID | |
564 | |
565 | |
566 local talentName = button.actionName | |
567 if actionType == 'macro' then | |
568 local spellName, _, spellID = GetMacroSpell(actionID) | |
569 talentName = spellName | |
570 end | |
571 | |
572 local keys = {GetBindingKey(command) } | |
573 if configTable and configTable.assignedKeys then | |
574 for _, key in ipairs(configTable.assignedKeys) do | |
575 if not tContains(keys, key) then | |
576 tinsert(keys, key) | |
577 end | |
578 end | |
579 end | |
580 | |
581 -- only manipulate bindings if its an available ability | |
582 if button.isAvailable then | |
583 --print('detected', #keys, 'bindings') | |
584 | |
585 if #keys >= 1 then | |
586 kb.UpdateBindingsCache(actionType, actionID, {}) | |
587 end | |
588 | |
589 for i, key in pairs(keys) do | |
590 --print('clearing', key) | |
591 SetBinding(key, nil) | |
592 kb.bindings[tostring(actionType)..'_'..tostring(actionID)] = nil | |
593 end | |
594 SaveBindings(GetCurrentBindingSet()) | |
595 end | |
596 | |
597 | |
598 if configTable and configTable.assignedKeys then | |
599 table.wipe(configTable.assignedKeys) | |
600 end | |
601 | |
602 if kb.currentProfile.bound[command] then | |
603 kb.currentProfile.bound[command] = nil | |
604 --kb:print(BINDING_REMOVED:format(self.actionName, configHeaders[db.bindMode])) | |
605 end | |
606 kb.saveTarget = nil | |
607 button:UpdateSlot(true) | |
608 return true | |
609 end | 606 end |
610 | 607 |
611 kb.AcceptAssignment = function(self, ...) | 608 kb.AcceptAssignment = function(self, ...) |
612 local popup = StaticPopupDialogs["SKELETONKEY_CONFIRM_ASSIGN_SLOT"] | 609 local popup = StaticPopupDialogs["SKELETONKEY_CONFIRM_ASSIGN_SLOT"] |
613 local source = kb. loadedProfiles[popup.oldProfile] | 610 local source = kb. loadedProfiles[popup.oldProfile] |