Log:
AutoBar:
-- 2.00.00.27 beta
-- Dont lock size for cyCircled buttons
Modified:
trunk/AutoBar/AutoBar.toc
trunk/AutoBar/AutoBar.xml
trunk/AutoBar/AutoBarButton.lua
trunk/AutoBar/AutoBarItemList.lua
trunk/AutoBar/Core.lua
trunk/AutoBar/Style.lua
Modified: trunk/AutoBar/AutoBar.toc
==============================================================================
--- trunk/AutoBar/AutoBar.toc (original)
+++ trunk/AutoBar/AutoBar.toc Mon Jan 15 09:41:46 2007
@@ -6,7 +6,7 @@
## Title-zhCN: 消耗品助手 |cff7fff7f -Ace2-|r
## Title-zhTW: 消耗品助手(AutoBar) |cff7fff7f -Ace2-|r
## Author: Toadkiller
-## Version: 2.00.00.26 beta
+## Version: 2.00.00.27 beta
## Notes: Provides up to 24 buttons in a bar that automatically adds any potions, water, food and other items you specify into a slot for use. Does not take up any action slots so you can save those for spells and abilities.
## Notes-koKR: 자동으로 물약, 음료, 음식등이 포함된 24개의 버튼을 제공하며 슬롯에 사용할 아이템을 별도로 등록할 수 있습니다. 이것은 당신의 주문과 능력을 위해 액션 슬롯에 여유를 가져다 줄 것입니다.
## Notes-zhCN: 一组可配置的按钮,能自动从背包中寻找设定的物品供方便使用。
Modified: trunk/AutoBar/AutoBar.xml
==============================================================================
--- trunk/AutoBar/AutoBar.xml (original)
+++ trunk/AutoBar/AutoBar.xml Mon Jan 15 09:41:46 2007
@@ -1,10 +1,15 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
C:\Projects\WoW\Bin\Interface\FrameXML\UI.xsd">
- <Button name="AutoBarSAButtonTemplate" virtual="true" inherits="SecureActionButtonTemplate, ActionButtonTemplate, SecureAnchorEnterTemplate">
+ <Button name="AutoBarButtonTemplate" virtual="true" inherits="SecureActionButtonTemplate, ActionButtonTemplate">
<Size>
<AbsDimension x="36" y="36"/>
</Size>
<Scripts>
+ </Scripts>
+ </Button>
+
+ <Button name="AutoBarSAButtonTemplate" virtual="true" inherits="AutoBarButtonTemplate, SecureAnchorEnterTemplate">
+ <Scripts>
<PreClick>
AutoBarButton:PreClick(button);
</PreClick>
@@ -14,7 +19,7 @@
</Scripts>
</Button>
- <Button name="AutoBarSAPopupButtonTemplate" virtual="true" frameStrata="DIALOG" inherits="AutoBarSAButtonTemplate">
+ <Button name="AutoBarSAPopupButtonTemplate" virtual="true" frameStrata="DIALOG" inherits="AutoBarButtonTemplate">
<Scripts>
<OnEnter>
if (not AutoBar.display.hideTooltips) then
@@ -75,6 +80,12 @@
<CheckedTexture file="Interface\AddOns\AutoBar\Art\draghandle-checked" />
</CheckButton>
<Frame name="AutoBarSSHeaderFrame" toplevel="true" movable="true" enableMouse="true" resizable="true" inherits="SecureStateHeaderTemplate">
+ <Size x="1" y="1"/>
+ <Anchors>
+ <Anchor point="CENTER" relativeTo="$parent" relativePoint="CENTER"/>
+ </Anchors>
+ </Frame>
+ <Frame name="AutoBarSSDriverFrame" toplevel="true" movable="true" enableMouse="true" resizable="true" inherits="SecureStateDriverTemplate">
<Size x="1" y="1"/>
<Anchors>
<Anchor point="CENTER" relativeTo="$parent" relativePoint="CENTER"/>
Modified: trunk/AutoBar/AutoBarButton.lua
==============================================================================
--- trunk/AutoBar/AutoBarButton.lua (original)
+++ trunk/AutoBar/AutoBarButton.lua Mon Jan 15 09:41:46 2007
@@ -367,9 +367,9 @@
function AutoBarButton:PreClick(mousebutton)
local button = this;
button:SetChecked(false);
- if (IsMounted()) then
- Dismount();
- end
+-- if (IsMounted()) then
+-- Dismount();
+-- end
end
Modified: trunk/AutoBar/AutoBarItemList.lua
==============================================================================
--- trunk/AutoBar/AutoBarItemList.lua (original)
+++ trunk/AutoBar/AutoBarItemList.lua Mon Jan 15 09:41:46 2007
@@ -535,6 +535,7 @@
12928,
12627,
18904,
+ 23691,
11020,
},
Modified: trunk/AutoBar/Core.lua
==============================================================================
--- trunk/AutoBar/Core.lua (original)
+++ trunk/AutoBar/Core.lua Mon Jan 15 09:41:46 2007
@@ -30,11 +30,13 @@
-- Named Slots
-- Hide slot option
--- Fix Unbind Key
--- Fix keybinds
+
+-- 2.00.00.27 beta
+-- Dont lock size for cyCircled buttons
-- 2.00.00.26 beta
--- Kill the keybind tab & switch back to Blizzard KeyBind UI based keys
+-- Kill the keybind tab & switch back to Blizzard KeyBind UI based keys.
+-- Keys tab keys are not preserved, old ones still bound from Blizzard UI will be reused.
-- Barring bugs that finalizes the key bindings feature.
-- Allow gapping of -1
-- CanCastSpell -> AutoBarProfile:CanCastSpell
@@ -182,7 +184,6 @@
AUTOBAR_MAXBUTTONS = 24;
AUTOBAR_MAXPOPUPBUTTONS = 12;
AUTOBAR_MAXSLOTCATEGORIES = 16;
-local AUTOBAR_SHIFTSTATE = AUTOBAR_MAXBUTTONS; -- state offset when shift is held down
AutoBar_Debug = nil;
@@ -633,143 +634,6 @@
end
--- Assign content to the buttons, set count & keybinding texts, visibility, etc.
-function AutoBar:ButtonsUpdate()
- if (not AutoBar.inWorld or InCombatLockdown()) then
- return
- end
---local startTime = GetTime();
- local buttonsIndex, i, button, rank, icon, countText, index, enabled, items, bag, slot, count, itemId, category, popupItemId;
- local displayButton = 1; -- On Screen button, ignores empty slots
---DEFAULT_CHAT_FRAME:AddMessage("AutoBar:ButtonsUpdate start");
- for buttonsIndex = 1, AUTOBAR_MAXBUTTONS, 1 do
- local button = AutoBar.ssButtons[buttonsIndex];
- local showButton = button:GetAttribute("buttonsIndex");
-
- local popupButtons = AutoBar.ssPopupButtons[buttonsIndex];
- local popupButton;
- for popupButtonIndex = 1, AUTOBAR_MAXPOPUPBUTTONS, 1 do
- popupButton = popupButtons[popupButtonIndex];
- popupButton:SetAttribute("showstates", "!*");
- end
-
---DEFAULT_CHAT_FRAME:AddMessage("AutoBar:ButtonsUpdate buttonsIndex " .. buttonsIndex);
- if (showButton) then
- bag, slot,_,_,_,_,index,enabled = AutoBar_Button_GetDisplayItem(buttonsIndex)
---DEFAULT_CHAT_FRAME:AddMessage("AutoBar:ButtonsUpdate buttonsIndex " .. buttonsIndex .. " bag, slot " .. tostring(bag) .. " " .. tostring(slot));
- if (bag or slot) then
- button:SetAttribute("showstates", "*");
- button.x = AutoBar.buttonLocations[displayButton].x;
- button.y = AutoBar.buttonLocations[displayButton].y;
- button:SetAttribute("ofsx", button.x);
- button:SetAttribute("ofsy", button.y);
-
- rank = AutoBar_Buttons_CurrentItems[buttonsIndex][index].rank;
- itemId = AutoBar_ButtonItemList[buttonsIndex][rank];
- count = GetItemCount(tonumber(itemId));
-
- category = AutoBar_SearchedForItems[itemId][2];
- AutoBarButton:SetAttributes(button, "AutoBarSAB"..buttonsIndex, bag, slot, count, itemId, category);
-
- -- The popup mostly displays the best to worst choice in order, mostly
- local popupButtonIndex, currentItems, buttonIndex, effectivePopup;
- local maxPopups = table.maxn(AutoBar_Buttons_CurrentItems[buttonsIndex]);
- local targetPopup = maxPopups;
-
- for popupButtonIndex = 1, maxPopups do
- if (popupButtonIndex > AUTOBAR_MAXPOPUPBUTTONS) then
- break;
- end
- currentItems = AutoBar_Buttons_CurrentItems[buttonsIndex][popupButtonIndex];
- rank = AutoBar_Buttons_CurrentItems[buttonsIndex][popupButtonIndex].rank;
- popupItemId = AutoBar_ButtonItemList[buttonsIndex][rank];
- count = GetItemCount(tonumber(popupItemId));
-
- if (itemId == popupItemId) then
- effectivePopup = 1;
- else
- effectivePopup = targetPopup;
- targetPopup = targetPopup - 1;
- end
---local name, _ = AutoBar.LinkDecode(GetContainerItemLink(currentItems.items[1][1], currentItems.items[1][2]));
---DEFAULT_CHAT_FRAME:AddMessage("AutoBar:ButtonsUpdate popupButtonIndex " .. tostring(popupButtonIndex) .. " effectivePopup " .. tostring(effectivePopup) .. " " .. tostring(name));
- popupButton = popupButtons[effectivePopup];
- category = AutoBar_SearchedForItems[popupItemId][2];
- AutoBarButton:SetAttributes(popupButton, "AutoBarSAB"..buttonsIndex.."P"..effectivePopup, currentItems.items[1][1], currentItems.items[1][2], count, popupItemId, category);
- popupButton:SetAttribute("buttonsIndex", buttonsIndex);
- popupButton:SetAttribute("popupButtonIndex", popupButtonIndex);
-
- if (AutoBar.display.popupOnShift) then
- if (effectivePopup == 1) then
---popupButton:SetAttribute("showstates", tostring(buttonsIndex));
- popupButton:SetAttribute("showstates", tostring(buttonsIndex)..","..(tostring(buttonsIndex + AUTOBAR_SHIFTSTATE)));
- else
- popupButton:SetAttribute("showstates", (tostring(buttonsIndex + AUTOBAR_SHIFTSTATE)));
- end
- else
- popupButton:SetAttribute("showstates", tostring(buttonsIndex));
- end
-
- AutoBarButton:SetVisual("AutoBarSAB"..buttonsIndex.."P"..effectivePopup);
- end
-
- -- Adjust popup positions based on their buttons position
- local buttonWidth, buttonHeight, gapping = AutoBar:GetButtonSize();
- for popupButtonIndex = 1, AUTOBAR_MAXPOPUPBUTTONS do
- local popupButton = popupButtons[popupButtonIndex];
- local buttonDistance = popupButtonIndex - 1; -- Zero based so first button is on top of its parent
-
- -- Set the popup direction
- if (AutoBar.display.popupToBottom) then
- popupButton:SetAttribute("ofsx", "*:"..button.x);
- popupButton:SetAttribute("ofsy", "*:"..(button.y - buttonDistance * (buttonHeight + gapping)));
- elseif (AutoBar.display.popupToLeft) then
- popupButton:SetAttribute("ofsx", "*:"..button.x - buttonDistance * (buttonWidth + gapping));
- popupButton:SetAttribute("ofsy", "*:"..(button.y));
- elseif (AutoBar.display.popupToRight) then
- popupButton:SetAttribute("ofsx", "*:"..button.x + buttonDistance * (buttonWidth + gapping));
- popupButton:SetAttribute("ofsy", "*:"..(button.y));
- else
- popupButton:SetAttribute("ofsx", "*:"..button.x);
- popupButton:SetAttribute("ofsy", "*:"..(button.y + buttonDistance * (buttonHeight + gapping)));
- end
- end
-
- displayButton = displayButton + 1;
- else
---DEFAULT_CHAT_FRAME:AddMessage("AutoBar:ButtonsUpdate buttonsIndex " .. tostring(buttonsIndex).." spell "..tostring(AutoBar.buttons[buttonsIndex].castSpell));
- if (AutoBar.buttons[buttonsIndex] and (AutoBar.display.showCategoryIcon or AutoBar.buttons[buttonsIndex].castSpell)) then
- button:SetAttribute("showstates", "*");
- button.x = AutoBar.buttonLocations[displayButton].x;
- button.y = AutoBar.buttonLocations[displayButton].y;
- button:SetAttribute("ofsx", button.x);
- button:SetAttribute("ofsy", button.y);
- -- Button is empty so show Category Icon
- local buttonInfo = AutoBar.buttons[buttonsIndex];
- if (buttonInfo and buttonInfo[1]) then
- category = buttonInfo[table.maxn(buttonInfo)];
- AutoBarButton:SetAttributes(button, "AutoBarSAB"..buttonsIndex, nil, nil, 0, nil, category);
- displayButton = displayButton + 1;
- else
- if (AutoBar.display.showEmptyButtons) then
- button:SetAttribute("showstates", "!*");
- displayButton = displayButton + 1;
- end
- end
- else
- button:SetAttribute("showstates", "!*");
- end
- end
- else
- button:SetAttribute("showstates", "!*");
- end
- end
--- AutoBar.ssHeader:SetAttribute("state", "0");
- SecureStateHeader_Refresh(AutoBar.ssHeader);
---DEFAULT_CHAT_FRAME:AddMessage("AutoBar:ButtonsUpdate " .. tostring(GetTime() - startTime));
-end
-
-
-- Assign display buttons to active slots and return the number of displayed buttons
function AutoBar:AssignButtons(maxButtons)
local displayedButtons = 1;
@@ -1066,14 +930,33 @@
end
---function AutoBar:StateChanged(newState)
--- DEFAULT_CHAT_FRAME:AddMessage(self:GetName().. ": " .. tostring(self:GetAttribute("state")));
---end
+local AUTOBAR_SHIFTSTATE = AUTOBAR_MAXBUTTONS; -- state offset when shift is held down
+local AUTOBAR_SHIFT_ON = AUTOBAR_MAXBUTTONS * 2 + 1; -- ground state when shift is held down
+local AUTOBAR_MAXBUTTONS_SHIFT = AUTOBAR_MAXBUTTONS * 2; -- ground state when shift is held down
+local AUTOBAR_MIN_RANGE = "1-"..AUTOBAR_MAXBUTTONS;
+local AUTOBAR_MAX_RANGE = (AUTOBAR_MAXBUTTONS+1).."-"..(AUTOBAR_MAXBUTTONS * 2);
+local AUTOBAR_MAP_SHIFT_UP
+local AUTOBAR_MAP_SHIFT_DOWN
+local AUTOBAR_MAP_SHIFT_UP_ALL;
+local AUTOBAR_MAP_SHIFT_DOWN_ALL;
+
+function AutoBar:StateChanged(newState)
+ DEFAULT_CHAT_FRAME:AddMessage(self:GetName().. ": " .. tostring(self:GetAttribute("state")));
+end
-- Create the buttons and popups
function AutoBar:LayoutInitialize()
local buttonWidth, buttonHeight, gapping = AutoBar:GetButtonSize();
+ AUTOBAR_MAP_SHIFT_UP = ""
+ AUTOBAR_MAP_SHIFT_DOWN = ""
+ for i = 1, AUTOBAR_MAXBUTTONS, 1 do
+ AUTOBAR_MAP_SHIFT_UP = AUTOBAR_MAP_SHIFT_UP..";"..i..":"..(i+AUTOBAR_SHIFTSTATE)
+ AUTOBAR_MAP_SHIFT_DOWN = AUTOBAR_MAP_SHIFT_DOWN..";"..(i+AUTOBAR_SHIFTSTATE)..":"..i
+ end
+ AUTOBAR_MAP_SHIFT_UP_ALL = AUTOBAR_SHIFT_ON..":0"..AUTOBAR_MAP_SHIFT_UP
+ AUTOBAR_MAP_SHIFT_DOWN_ALL = "0:"..AUTOBAR_SHIFT_ON..AUTOBAR_MAP_SHIFT_DOWN
+
--DEFAULT_CHAT_FRAME:AddMessage("AutoBar:LayoutInitialize gapping " .. tostring(gapping) .. " / " .. tostring(buttonWidth) .. " / " .. tostring(buttonHeight), 1, 0.5, 0);
-- The main driver. It's draghandle child allows repositioning
@@ -1086,9 +969,30 @@
p:SetAttribute("state-popup", "0");
p:SetAttribute("statemap-popup", "*:0");
-p.StateChanged = AutoBar.StateChanged;
+--p.StateChanged = AutoBar.StateChanged;
AutoBar.ssHeader = p;
+
+local driver = _G["AutoBarSSDriverFrame"]; --CreateFrame("Frame", "StealthBarDriverFrame", UIParent, "SecureStateDriverTemplate")
+--driver:SetPoint("CENTER",0,0) driver:SetWidth(2) driver:SetHeight(2)
+-- in stealth, set to state 1, out of stealth go to state 1
+--driver:SetAttribute("statemap-stealth-0", "0")
+--driver:SetAttribute("statemap-stealth-1", "1")
+
+--driver:SetAttribute("statemap-ctrl-0", "0")
+--driver:SetAttribute("statemap-ctrl-1", AUTOBAR_SHIFT_ON)
+--p = driver;
+--p:SetAttribute("statemap-anchor", "0-"..AUTOBAR_SHIFT_ON..":$input");
+--p:SetAttribute("delaystatemap-anchor", "0-"..AUTOBAR_MAXBUTTONS..":0");
+--p:SetAttribute("delaytimemap-anchor", "0-"..AUTOBAR_MAXBUTTONS..":0.2");
+--p:SetAttribute("delayhovermap-anchor", "0-"..AUTOBAR_MAXBUTTONS..":true");
+--p:SetAttribute("ctrl-delaystatemap-anchor", AUTOBAR_MAX_RANGE..":"..AUTOBAR_SHIFT_ON);
+--p:SetAttribute("ctrl-delaytimemap-anchor", AUTOBAR_MAX_RANGE..":0.2");
+--p:SetAttribute("ctrl-delayhovermap-anchor", AUTOBAR_MAX_RANGE..":true");
+--p:SetAttribute("state-popup", "0");
+--p:SetAttribute("statemap-popup", "*:0");
+--p:SetAttribute("ctrl-statemap-popup", "*:"..AUTOBAR_SHIFT_ON);
+
-- Hook up AutoBarFrame components so we can do docking
AutoBarFrame:SetAttribute("addchild", AutoBarSSHeaderFrame);
AutoBarFrame:SetAttribute("addchild", AutoBarAnchorFrameHandle);
@@ -1101,9 +1005,6 @@
AutoBarSSHeaderFrame:SetAttribute("ofsx", 0);
AutoBarSSHeaderFrame:SetAttribute("ofsy", 0);
- -- SHift Key detector
- -- Insert "SecureAnchorUpDownTemplate" here
-
-- Create the slot buttons
AutoBar.ssButtons = {};
for i = 1, AUTOBAR_MAXBUTTONS do
@@ -1111,7 +1012,6 @@
AutoBar.ssButtons[i] = button;
button:SetAttribute("newstate","0:"..tostring(i)..";"..tostring(i)..":0")
-button:SetAttribute("ctrl-newstate","0:"..tostring(AUTOBAR_MAXBUTTONS + AUTOBAR_SHIFTSTATE)..";"..tostring(AUTOBAR_MAXBUTTONS + AUTOBAR_SHIFTSTATE)..":0")
-- Set 0 second delay before returning to state 0 so keybindings dont open the popup
button:SetAttribute("delaystate", "0:0")
button:SetAttribute("delaytime", "0:0.1")
@@ -1146,7 +1046,7 @@
popupHeader:SetAttribute("exportstate", "popup");
-popupHeader.StateChanged = AutoBar.StateChanged;
+--popupHeader.StateChanged = AutoBar.StateChanged;
p:SetAttribute("addchild", popupHeader);
popupHeader:SetAttribute("ofspoint", "*:CENTER");
@@ -1235,6 +1135,14 @@
point = "TOPLEFT";
end
+ if (AutoBar.display.popupOnShift) then
+AutoBar.ssHeader:SetAttribute("statemap-ctrl-0", AUTOBAR_MAP_SHIFT_UP)
+AutoBar.ssHeader:SetAttribute("statemap-ctrl-1", AUTOBAR_MAP_SHIFT_DOWN)
+ else
+ AutoBar.ssHeader:SetAttribute("statemap-ctrl-0", nil)
+ AutoBar.ssHeader:SetAttribute("statemap-ctrl-1", nil)
+ end
+
local i, button, effectiveButton, popupHeader;
local displayButton = 1;
for i = 1, AUTOBAR_MAXBUTTONS, 1 do
@@ -1251,12 +1159,25 @@
popupHeader = AutoBar.ssPopupHeaders[i];
if (AutoBar.display.popupOnShift) then
-button:SetAttribute("childstate", "^" .. tostring(i));
-button:SetAttribute("ctrl-childstate", "^" .. tostring(i + AUTOBAR_SHIFTSTATE));
--- button:SetAttribute("childstate", "^" .. tostring(i));
--- button:SetAttribute("ctrl-childstate", "^" .. tostring(i + AUTOBAR_SHIFTSTATE));
- popupHeader:SetAttribute("statemap-ctrl-1", tostring(i)..":"..(tostring(i + AUTOBAR_SHIFTSTATE)));
- popupHeader:SetAttribute("statemap-ctrl-0", (tostring(i + AUTOBAR_SHIFTSTATE))..":"..tostring(i));
+ button:SetAttribute("newstate","0:"..tostring(i)..";"..tostring(i)..":0")
+ button:SetAttribute("ctrl-newstate", AUTOBAR_SHIFTSTATE..":"..tostring(i + AUTOBAR_SHIFTSTATE)..";"..tostring(i + AUTOBAR_SHIFTSTATE)..":"..AUTOBAR_SHIFTSTATE)
+-- button:SetAttribute("delaystate", "0:0")
+ button:SetAttribute("ctrl-delaystate", "0:"..AUTOBAR_SHIFTSTATE)
+ button:SetAttribute("childstate", "^" .. tostring(i));
+ button:SetAttribute("ctrl-childstate", "^" .. tostring(i + AUTOBAR_SHIFTSTATE));
+
+ popupHeader:SetAttribute("statemap-anchor", "0-"..AUTOBAR_SHIFT_ON..":$input");
+ popupHeader:SetAttribute("delaystatemap-anchor", "0-"..AUTOBAR_MAXBUTTONS..":0");
+ popupHeader:SetAttribute("ctrl-delaystatemap-anchor", AUTOBAR_MAX_RANGE..":AUTOBAR_SHIFT_ON");
+ popupHeader:SetAttribute("delaytimemap-anchor", "0-"..AUTOBAR_SHIFT_ON..":0.2");
+ popupHeader:SetAttribute("delayhovermap-anchor", "0-"..AUTOBAR_SHIFT_ON..":true");
+
+ popupHeader:SetAttribute("state-parent", 0);
+-- popupHeader:SetAttribute("statemap-parent", "*:"..tostring(i));
+ popupHeader:SetAttribute("ctrl-statemap-parent", "*:"..tostring(i + AUTOBAR_SHIFTSTATE));
+--
+-- popupHeader:SetAttribute("statemap-ctrl-1", tostring(i)..":"..(tostring(i + AUTOBAR_SHIFTSTATE)));
+-- popupHeader:SetAttribute("statemap-ctrl-0", (tostring(i + AUTOBAR_SHIFTSTATE))..":"..tostring(i));
else
button:SetAttribute("childstate", "^" .. tostring(i));
popupHeader:SetAttribute("statemap-ctrl-1", nil);
@@ -1333,6 +1254,143 @@
autoBarAnchorFrameHandle:SetAttribute("showstates", "*");
autoBarAnchorFrameHandle:Show();
end
+end
+
+
+-- Assign content to the buttons, set count & keybinding texts, visibility, etc.
+function AutoBar:ButtonsUpdate()
+ if (not AutoBar.inWorld or InCombatLockdown()) then
+ return
+ end
+--local startTime = GetTime();
+ local buttonsIndex, i, button, rank, icon, countText, index, enabled, items, bag, slot, count, itemId, category, popupItemId;
+ local displayButton = 1; -- On Screen button, ignores empty slots
+--DEFAULT_CHAT_FRAME:AddMessage("AutoBar:ButtonsUpdate start");
+ for buttonsIndex = 1, AUTOBAR_MAXBUTTONS, 1 do
+ local button = AutoBar.ssButtons[buttonsIndex];
+ local showButton = button:GetAttribute("buttonsIndex");
+
+ local popupButtons = AutoBar.ssPopupButtons[buttonsIndex];
+ local popupButton;
+ for popupButtonIndex = 1, AUTOBAR_MAXPOPUPBUTTONS, 1 do
+ popupButton = popupButtons[popupButtonIndex];
+ popupButton:SetAttribute("showstates", "!*");
+ end
+
+--DEFAULT_CHAT_FRAME:AddMessage("AutoBar:ButtonsUpdate buttonsIndex " .. buttonsIndex);
+ if (showButton) then
+ bag, slot,_,_,_,_,index,enabled = AutoBar_Button_GetDisplayItem(buttonsIndex)
+--DEFAULT_CHAT_FRAME:AddMessage("AutoBar:ButtonsUpdate buttonsIndex " .. buttonsIndex .. " bag, slot " .. tostring(bag) .. " " .. tostring(slot));
+ if (bag or slot) then
+ button:SetAttribute("showstates", "*");
+ button.x = AutoBar.buttonLocations[displayButton].x;
+ button.y = AutoBar.buttonLocations[displayButton].y;
+ button:SetAttribute("ofsx", button.x);
+ button:SetAttribute("ofsy", button.y);
+
+ rank = AutoBar_Buttons_CurrentItems[buttonsIndex][index].rank;
+ itemId = AutoBar_ButtonItemList[buttonsIndex][rank];
+ count = GetItemCount(tonumber(itemId));
+
+ category = AutoBar_SearchedForItems[itemId][2];
+ AutoBarButton:SetAttributes(button, "AutoBarSAB"..buttonsIndex, bag, slot, count, itemId, category);
+
+ -- The popup mostly displays the best to worst choice in order, mostly
+ local popupButtonIndex, currentItems, buttonIndex, effectivePopup;
+ local maxPopups = table.maxn(AutoBar_Buttons_CurrentItems[buttonsIndex]);
+ local targetPopup = maxPopups;
+
+ for popupButtonIndex = 1, maxPopups do
+ if (popupButtonIndex > AUTOBAR_MAXPOPUPBUTTONS) then
+ break;
+ end
+ currentItems = AutoBar_Buttons_CurrentItems[buttonsIndex][popupButtonIndex];
+ rank = AutoBar_Buttons_CurrentItems[buttonsIndex][popupButtonIndex].rank;
+ popupItemId = AutoBar_ButtonItemList[buttonsIndex][rank];
+ count = GetItemCount(tonumber(popupItemId));
+
+ if (itemId == popupItemId) then
+ effectivePopup = 1;
+ else
+ effectivePopup = targetPopup;
+ targetPopup = targetPopup - 1;
+ end
+--local name, _ = AutoBar.LinkDecode(GetContainerItemLink(currentItems.items[1][1], currentItems.items[1][2]));
+--DEFAULT_CHAT_FRAME:AddMessage("AutoBar:ButtonsUpdate popupButtonIndex " .. tostring(popupButtonIndex) .. " effectivePopup " .. tostring(effectivePopup) .. " " .. tostring(name));
+ popupButton = popupButtons[effectivePopup];
+ category = AutoBar_SearchedForItems[popupItemId][2];
+ AutoBarButton:SetAttributes(popupButton, "AutoBarSAB"..buttonsIndex.."P"..effectivePopup, currentItems.items[1][1], currentItems.items[1][2], count, popupItemId, category);
+ popupButton:SetAttribute("buttonsIndex", buttonsIndex);
+ popupButton:SetAttribute("popupButtonIndex", popupButtonIndex);
+
+ if (AutoBar.display.popupOnShift) then
+ if (effectivePopup == 1) then
+--popupButton:SetAttribute("showstates", tostring(buttonsIndex));
+ popupButton:SetAttribute("showstates", tostring(buttonsIndex)..","..(tostring(buttonsIndex + AUTOBAR_SHIFTSTATE)));
+ else
+ popupButton:SetAttribute("showstates", (tostring(buttonsIndex + AUTOBAR_SHIFTSTATE)));
+ end
+ else
+ popupButton:SetAttribute("showstates", tostring(buttonsIndex));
+ end
+
+ AutoBarButton:SetVisual("AutoBarSAB"..buttonsIndex.."P"..effectivePopup);
+ end
+
+ -- Adjust popup positions based on their buttons position
+ local buttonWidth, buttonHeight, gapping = AutoBar:GetButtonSize();
+ for popupButtonIndex = 1, AUTOBAR_MAXPOPUPBUTTONS do
+ local popupButton = popupButtons[popupButtonIndex];
+ local buttonDistance = popupButtonIndex - 1; -- Zero based so first button is on top of its parent
+
+ -- Set the popup direction
+ if (AutoBar.display.popupToBottom) then
+ popupButton:SetAttribute("ofsx", "*:"..button.x);
+ popupButton:SetAttribute("ofsy", "*:"..(button.y - buttonDistance * (buttonHeight + gapping)));
+ elseif (AutoBar.display.popupToLeft) then
+ popupButton:SetAttribute("ofsx", "*:"..button.x - buttonDistance * (buttonWidth + gapping));
+ popupButton:SetAttribute("ofsy", "*:"..(button.y));
+ elseif (AutoBar.display.popupToRight) then
+ popupButton:SetAttribute("ofsx", "*:"..button.x + buttonDistance * (buttonWidth + gapping));
+ popupButton:SetAttribute("ofsy", "*:"..(button.y));
+ else
+ popupButton:SetAttribute("ofsx", "*:"..button.x);
+ popupButton:SetAttribute("ofsy", "*:"..(button.y + buttonDistance * (buttonHeight + gapping)));
+ end
+ end
+
+ displayButton = displayButton + 1;
+ else
+--DEFAULT_CHAT_FRAME:AddMessage("AutoBar:ButtonsUpdate buttonsIndex " .. tostring(buttonsIndex).." spell "..tostring(AutoBar.buttons[buttonsIndex].castSpell));
+ if (AutoBar.buttons[buttonsIndex] and (AutoBar.display.showCategoryIcon or AutoBar.buttons[buttonsIndex].castSpell)) then
+ button:SetAttribute("showstates", "*");
+ button.x = AutoBar.buttonLocations[displayButton].x;
+ button.y = AutoBar.buttonLocations[displayButton].y;
+ button:SetAttribute("ofsx", button.x);
+ button:SetAttribute("ofsy", button.y);
+ -- Button is empty so show Category Icon
+ local buttonInfo = AutoBar.buttons[buttonsIndex];
+ if (buttonInfo and buttonInfo[1]) then
+ category = buttonInfo[table.maxn(buttonInfo)];
+ AutoBarButton:SetAttributes(button, "AutoBarSAB"..buttonsIndex, nil, nil, 0, nil, category);
+ displayButton = displayButton + 1;
+ else
+ if (AutoBar.display.showEmptyButtons) then
+ button:SetAttribute("showstates", "!*");
+ displayButton = displayButton + 1;
+ end
+ end
+ else
+ button:SetAttribute("showstates", "!*");
+ end
+ end
+ else
+ button:SetAttribute("showstates", "!*");
+ end
+ end
+ AutoBar.ssHeader:SetAttribute("state", "0");
+ SecureStateHeader_Refresh(AutoBar.ssHeader);
+--DEFAULT_CHAT_FRAME:AddMessage("AutoBar:ButtonsUpdate " .. tostring(GetTime() - startTime));
end
Modified: trunk/AutoBar/Style.lua
==============================================================================
--- trunk/AutoBar/Style.lua (original)
+++ trunk/AutoBar/Style.lua Mon Jan 15 09:41:46 2007
@@ -54,8 +54,8 @@
},
[4] = {
name = "cyCircled",
- buttonWidth = 35;
- buttonHeight = 35;
+-- buttonWidth = 35;
+-- buttonHeight = 35;
noHotKey = true;
callbackFunc = nil;
},