Mercurial > wow > skeletonkey
comparison SkeletonKey/UI.lua @ 7:a2fc77fa4c73
- make sure key bindings honor the `ActionButtonUseKeyDown' CVar
author | Nenue |
---|---|
date | Thu, 28 Jul 2016 17:27:40 -0400 |
parents | f6d1c192afc6 |
children | e7977b336bf7 |
comparison
equal
deleted
inserted
replaced
6:f6d1c192afc6 | 7:a2fc77fa4c73 |
---|---|
388 self.profile = kb.db.bindMode | 388 self.profile = kb.db.bindMode |
389 self:RegisterForDrag('LeftButton') | 389 self:RegisterForDrag('LeftButton') |
390 end | 390 end |
391 | 391 |
392 --- Retrieves button at index; creates said button and instates any stored parameters | 392 --- Retrieves button at index; creates said button and instates any stored parameters |
393 local leftSlot, upSlot | 393 do |
394 local buttonsDepth = 0 | 394 local leftSlot, upSlot |
395 kb.GetSlot = function(index) | 395 local buttonsDepth = 0 |
396 | 396 kb.GetSlot = function(index) |
397 local slot = index + kb.scrollOffset | 397 |
398 | 398 local slot = index + kb.scrollOffset |
399 if not kb.buttons[index] then | 399 |
400 local button = CreateFrame('CheckButton', 'KeyBinderSlot'..index, kb, 'KeyButton') | 400 if not kb.buttons[index] then |
401 button:SetScript('OnClick', KeyButton_OnClick) | 401 local button = CreateFrame('CheckButton', 'KeyBinderSlot'..index, kb, 'KeyButton') |
402 button:SetScript('OnUpdate', KeyButton_OnUpdate) | 402 button:SetScript('OnClick', KeyButton_OnClick) |
403 button:SetScript('OnDragStart', KeyButton_OnDragStart) | 403 button:SetScript('OnUpdate', KeyButton_OnUpdate) |
404 button:SetScript('OnReceiveDrag', KeyButton_OnReceiveDrag) | 404 button:SetScript('OnDragStart', KeyButton_OnDragStart) |
405 button:RegisterForClicks('AnyUp') | 405 button:SetScript('OnReceiveDrag', KeyButton_OnReceiveDrag) |
406 | 406 button:RegisterForClicks('AnyUp') |
407 | 407 |
408 local newRow = (mod(index, BINDS_PER_ROW) == 1) | 408 |
409 | 409 local newRow = (mod(index, BINDS_PER_ROW) == 1) |
410 if index == 1 then | 410 |
411 button:SetPoint('TOPLEFT', kb.bg, 'TOPLEFT', BUTTON_PADDING, - BUTTON_PADDING) | 411 if index == 1 then |
412 upSlot = button | 412 button:SetPoint('TOPLEFT', kb.bg, 'TOPLEFT', BUTTON_PADDING, - BUTTON_PADDING) |
413 buttonsDepth = KEY_BUTTON_SIZE + BUTTON_PADDING * 2 | 413 upSlot = button |
414 elseif newRow then | 414 buttonsDepth = KEY_BUTTON_SIZE + BUTTON_PADDING * 2 |
415 button:SetPoint('TOPLEFT', upSlot, 'BOTTOMLEFT', 0, -BUTTON_SPACING) | 415 elseif newRow then |
416 upSlot = button | 416 button:SetPoint('TOPLEFT', upSlot, 'BOTTOMLEFT', 0, -BUTTON_SPACING) |
417 buttonsDepth = buttonsDepth + KEY_BUTTON_SIZE + BUTTON_SPACING | 417 upSlot = button |
418 else | 418 buttonsDepth = buttonsDepth + KEY_BUTTON_SIZE + BUTTON_SPACING |
419 button:SetPoint('TOPLEFT', leftSlot, 'TOPRIGHT', BUTTON_HSPACING, 0) | 419 else |
420 end | 420 button:SetPoint('TOPLEFT', leftSlot, 'TOPRIGHT', BUTTON_HSPACING, 0) |
421 | 421 end |
422 button:SetSize(KEY_BUTTON_SIZE, KEY_BUTTON_SIZE) | 422 |
423 button:Show() | 423 button:SetSize(KEY_BUTTON_SIZE, KEY_BUTTON_SIZE) |
424 kb.buttons[index] = button | 424 button:Show() |
425 leftSlot = button | 425 kb.buttons[index] = button |
426 end | 426 leftSlot = button |
427 return kb.buttons[index] | 427 end |
428 return kb.buttons[index] | |
429 end | |
428 end | 430 end |
429 | 431 |
430 --- Updates profile assignment and button contents | 432 --- Updates profile assignment and button contents |
431 kb.UpdateSlot = function(self, force) | 433 kb.UpdateSlot = function(self, force) |
432 local slot = self:GetID() | 434 local slot = self:GetID() |