WoWInterface SVN zz_Actionbuttons

[/] [trunk/] [zz_Actionbuttons/] [core.lua] - Diff between revs 15 and 17

Show entire file | Details | Blame | View Log

Rev 15 Rev 17
Line 19... Line 19...
                BonusActionBarFrame,
                BonusActionBarFrame,
                BonusActionBarFrameTexture1,
                BonusActionBarFrameTexture1,
                BonusActionBarFrameTexture2,
                BonusActionBarFrameTexture2,
                BonusActionBarFrameTexture3,
                BonusActionBarFrameTexture3,
                BonusActionBarFrameTexture4,
                BonusActionBarFrameTexture4,
 
--              PossessBarFrame,
                VehicleMenuBar,
                VehicleMenuBar,
        }
        }
        for i = 1, #hide do
        for i = 1, #hide do
                local f = hide[i]
                local f = hide[i]
                if(type(f.UnregisterAllEvents) == 'function') then f:UnregisterAllEvents() end
                if(type(f.UnregisterAllEvents) == 'function') then f:UnregisterAllEvents() end
Line 77... Line 78...
                        local btn = f['sbuttons'][i]
                        local btn = f['sbuttons'][i]
                        bh = f['sizeButton'] or btn:GetHeight()
                        bh = f['sizeButton'] or btn:GetHeight()
                        btn:SetParent(f)
                        btn:SetParent(f)
                        btn:ClearAllPoints()
                        btn:ClearAllPoints()
                        if(y == 1) then
                        if(y == 1) then
 
 
                                btn:SetPoint("TOPLEFT", f, "TOPLEFT",xoffset , -row * bh - yoffset)
                                btn:SetPoint("TOPLEFT", f, "TOPLEFT",xoffset , -row * bh - yoffset)
                        else
                        else
                                btn:SetPoint("TOPLEFT", lastbutton, "TOPRIGHT",xoffset,0)
                                btn:SetPoint("TOPLEFT", lastbutton, "TOPRIGHT",xoffset,0)
                        end
                        end
                        y = y + 1
                        y = y + 1
Line 92... Line 92...
                        lastbutton = btn
                        lastbutton = btn
                        if(y > spr) then
                        if(y > spr) then
                                y = 1
                                y = 1
                                row = row + 1
                                row = row + 1
                        end
                        end
 
 
                end
                end
        end
        end
        if(row < 1) then row = 1 end
        if(row < 1) then row = 1 end
        f['maxslots'] = f['maxslots'] or 12
        f['maxslots'] = f['maxslots'] or 12
        if(db['bars'][bname]['cols'] > f['maxslots']) then db['bars'][bname]['cols'] = f['maxslots'] end
        if(db['bars'][bname]['cols'] > f['maxslots']) then db['bars'][bname]['cols'] = f['maxslots'] end
        bh = bh or 0
        bh = bh or 0
        f:SetWidth(db['bars'][bname]['cols']*(lastbutton:GetWidth() + xoffset) + xoffset)
        f:SetWidth(db['bars'][bname]['cols']*(lastbutton:GetWidth() + xoffset) + xoffset)
        f:SetHeight(row * (bh + yoffset) + yoffset)
        f:SetHeight(row * (bh + yoffset) + yoffset)
 
        if(not f['skipMasque'] and addon['MSQ'] and addon['MSQGroup']) then
 
                addon['MSQGroup']:ReSkin() -- test if bags keep their skin or if I need to create new bag buttons
 
        end
end
end
addon['applySettings'] = applySettings
addon['applySettings'] = applySettings
local function getButton(parent, id, offset)
local function getButton(parent, id, offset)
        local btn
        local btn
        if(offset <= 12) then
        if(offset <= NUM_ACTIONBAR_BUTTONS) then
                btn = _G['ActionButton'..id]
                btn = _G['ActionButton'..id]
        elseif(offset <= 24) then
        elseif(offset <= NUM_ACTIONBAR_BUTTONS * 2) then
 
 
        elseif(offset <= 36) then
        elseif(offset <= NUM_ACTIONBAR_BUTTONS * 3) then
                btn = _G['MultiBarRightButton'..id]
                btn = _G['MultiBarRightButton'..id]
        elseif(offset <= 48) then
        elseif(offset <= NUM_ACTIONBAR_BUTTONS * 4) then
                btn = _G['MultiBarLeftButton'..id]
                btn = _G['MultiBarLeftButton'..id]
        elseif(offset <= 60) then
        elseif(offset <= NUM_ACTIONBAR_BUTTONS * 5) then
                btn = _G['MultiBarBottomRightButton'..id]
                btn = _G['MultiBarBottomRightButton'..id]
        elseif(offset <= 72) then
        elseif(offset <= NUM_ACTIONBAR_BUTTONS * 6) then
                btn = _G['MultiBarBottomLeftButton'..id]
                btn = _G['MultiBarBottomLeftButton'..id]
        elseif((offset > 190) and (offset <= 200)) then
        elseif((offset > 190) and (offset <= 190 + NUM_SHAPESHIFT_SLOTS)) then
                btn = _G['ShapeshiftButton'..id]
                btn = _G['ShapeshiftButton'..id]
        elseif((offset > 200) and (offset <= 210)) then
        elseif((offset > 190 + NUM_SHAPESHIFT_SLOTS) and (offset <= 190 + NUM_SHAPESHIFT_SLOTS + NUM_PET_ACTION_SLOTS)) then
                btn = _G['PetActionButton'..id]
                btn = _G['PetActionButton'..id]
 
        elseif((offset > 190 + NUM_SHAPESHIFT_SLOTS + NUM_PET_ACTION_SLOTS) and (offset <= 190 + NUM_SHAPESHIFT_SLOTS + NUM_PET_ACTION_SLOTS + NUM_POSSESS_SLOTS)) then
 
                btn = _G['PossessButton'..id]
        end
        end
 
 
        if(not btn) then
        if(not btn) then
                btn = CreateFrame("CheckButton", "$PARENTActionButton"..offset, parent, "ActionButtonTemplate ActionBarButtonCodeTemplate",id)
                btn = CreateFrame("CheckButton", "$PARENTActionButton"..offset, parent, "ActionButtonTemplate ActionBarButtonCodeTemplate",id)
                btn['buttonType'] = "ZZACTIONBUTTON"
                btn['buttonType'] = "ZZACTIONBUTTON"
        else
        else
--              btn:GetParent():UnregisterAllEvents()
 
                btn:GetParent():Hide()
                btn:GetParent():Hide()
                btn:GetParent().Show = btn:GetParent().Hide
                btn:GetParent().Show = btn:GetParent().Hide
                btn:ClearAllPoints()
                btn:ClearAllPoints()
                btn:SetParent(parent)
                btn:SetParent(parent)
        end
        end
        fadeInOut(btn)
        fadeInOut(btn)
 
 
--      print(parent, id, offset, btn:GetName())
 
        return btn
        return btn
end
end
 
 
local function createBar(bid,mb,bh)
local function createBar(bid,mb,bh)
        mb = mb or 12
        mb = mb or 12
Line 200... Line 203...
                elseif(class == "DRUID") then
                elseif(class == "DRUID") then
                        RegisterStateDriver(f, "page", "[stance:1] 9;[stance:3,stealth] 8;[stance:3] 7;[stance:5] 10;1") -- 1 bear/ 3 cat/ 5 moonkin
                        RegisterStateDriver(f, "page", "[stance:1] 9;[stance:3,stealth] 8;[stance:3] 7;[stance:5] 10;1") -- 1 bear/ 3 cat/ 5 moonkin
                elseif(class == "ROGUE") then
                elseif(class == "ROGUE") then
                        RegisterStateDriver(f, "page", "[stance:1] 7;[stance:3] 8; 1") -- 1 stealth/ 3 shadow dance
                        RegisterStateDriver(f, "page", "[stance:1] 7;[stance:3] 8; 1") -- 1 stealth/ 3 shadow dance
                elseif(class == "PRIEST") then
                elseif(class == "PRIEST") then
                        RegisterStateDriver(f, "page", "[stance:1] 7; 1")
                        RegisterStateDriver(f, "page", "[stance:1,@player,nodead] 7; 1")
                end
                end
                RegisterStateDriver(f, "possess", "[bonusbar:5] 11")
                RegisterStateDriver(f, "possess", "[bonusbar:5] 11")
        else
        else
 
 
                f:SetAttribute('_onstate-showvehicle', [[
                f:SetAttribute('_onstate-showvehicle', [[
                        if(newstate=='hide') then
                        if(newstate=='hide') then
                                self:Hide()
                                self:Hide()
                        else
                        else
                                self:Show()
                                self:Show()
Line 238... Line 240...
                if(bid == 1) then
                if(bid == 1) then
                        b:SetAttribute('_childupdate-actionpage', [[
                        b:SetAttribute('_childupdate-actionpage', [[
                                self:SetAttribute('action--dummy', self:GetAttribute('action--dummy'))
                                self:SetAttribute('action--dummy', self:GetAttribute('action--dummy'))
                        ]])
                        ]])
                elseif(bid<7) then
                elseif(bid<7) then
                        b:SetAttribute('_childupdate-actionpage', [[
--                      b:SetAttribute('_childupdate-actionpage', [[]])
 
 
                        ]])
 
                end
                end
                f['sbuttons'][#f['sbuttons'] + 1] = b
                f['sbuttons'][#f['sbuttons'] + 1] = b
--              b:SetAttribute('action', i)
 
        end
        end
--      addon['addDrag'](f)
 
--      f['sizeButton'] = lastbutton:GetHeight()
 
        addon['applySettings'](f:GetName(),32)
        addon['applySettings'](f:GetName(),32)
        if(db['bars'][f:GetName()]['fadein']) then fadeOut(lastbutton) end
        if(db['bars'][f:GetName()]['fadein']) then fadeOut(lastbutton) end
        return f:GetName()
        return f:GetName()
end
end
 
 
Line 267... Line 264...
        _G[pref[#pref-1]]:center()
        _G[pref[#pref-1]]:center()
end
end
 
 
local function init(self, event, ...)
local function init(self, event, ...)
        _,class = UnitClass('player')
        _,class = UnitClass('player')
 
        addon['applySettings']("zzABar20",32)
end
end
addon['updateDB'] = function(db)
addon['updateDB'] = function(db)
        db['bars'] = db['bars'] or {}
        db['bars'] = db['bars'] or {}
        db['bars']['MultiCastActionBarFrame'] = db['bars']['MultiCastActionBarFrame'] or {
        db['bars']['MultiCastActionBarFrame'] = db['bars']['MultiCastActionBarFrame'] or {
                ['cols'] = 12,
                ['cols'] = 12,
Line 285... Line 283...
        db = addon['updateDB'](addon['db']['profile'])
        db = addon['updateDB'](addon['db']['profile'])
 
 
        db['bars']['MultiCastActionBarFrame']['cols'] = db['bars']['MultiCastActionBarFrame']['cols'] or 12
        db['bars']['MultiCastActionBarFrame']['cols'] = db['bars']['MultiCastActionBarFrame']['cols'] or 12
        addon['AddConfigEntry'](addon, name, 'toggle', 'dragAble', 'Unlocked', 'Use alt+click to move your bars', 0)
        addon['AddConfigEntry'](addon, name, 'toggle', 'dragAble', 'Unlocked', 'Use alt+click to move your bars', 0)
        do
        do
 
--              ShapeshiftButton1:SetSize(32,32)
                local function addP(bname)
                local function addP(bname)
                        local o = addon['AddConfigMenu'](addon, {
                        local o = addon['AddConfigMenu'](addon, {
                                ['name'] = bname,
                                ['name'] = bname,
                                ['menuGet'] = getBarPref,
                                ['menuGet'] = getBarPref,
                                ['menuSet'] = setBarPref,
                                ['menuSet'] = setBarPref,
Line 301... Line 300...
                for i = 1,6 do
                for i = 1,6 do
                        addP(createBar(i, NUM_ACTIONBAR_BUTTONS,32))
                        addP(createBar(i, NUM_ACTIONBAR_BUTTONS,32))
                end
                end
                addP(createBar(20, NUM_SHAPESHIFT_SLOTS,32))
                addP(createBar(20, NUM_SHAPESHIFT_SLOTS,32))
                addP(createBar(21, NUM_PET_ACTION_SLOTS,32))
                addP(createBar(21, NUM_PET_ACTION_SLOTS,32))
 
--              addP(createBar(22, NUM_POSSESS_SLOTS,32))
                addP("MultiCastActionBarFrame")
                addP("MultiCastActionBarFrame")
                addP(name.."MicroMenu")
                addP(name.."MicroMenu")
                addP(name.."BagBar")
                addP(name.."BagBar")
        end
        end
 
 
        MultiCastActionBarFrame:ClearAllPoints()
        MultiCastActionBarFrame:ClearAllPoints()
        MultiCastActionBarFrame:SetPoint("CENTER")
        MultiCastActionBarFrame:SetPoint("CENTER")
        UIPARENT_MANAGED_FRAME_POSITIONS["MultiCastActionBarFrame"] = nil
        UIPARENT_MANAGED_FRAME_POSITIONS["MultiCastActionBarFrame"] = nil
        addon['addDrag'](MultiCastActionBarFrame)
        addon['addDrag'](MultiCastActionBarFrame)
        MoveMicroButtons = function() end
        MoveMicroButtons = function() end
        VehicleMenuBar_MoveMicroButtons = function() end
        VehicleMenuBar_MoveMicroButtons = function() end
--      hooksecurefunc("ChangeMultiCastActionPage", updateMCB)
 
        hooksecurefunc("MultiActionBar_UpdateGridVisibility", function()
        hooksecurefunc("MultiActionBar_UpdateGridVisibility", function()
                local bar = _G['zzABar2']
                local bar = _G['zzABar2']
                for i = 1, #bar['sbuttons'] do
                for i = 1, #bar['sbuttons'] do
                        local b = bar['sbuttons'][i]
                        local b = bar['sbuttons'][i]
                        if (ALWAYS_SHOW_MULTIBARS == "1" or ALWAYS_SHOW_MULTIBARS == 1 ) then
                        if (ALWAYS_SHOW_MULTIBARS == "1" or ALWAYS_SHOW_MULTIBARS == 1 ) then
                                b:SetAttribute('showgrid',1)
                                b:SetAttribute('showgrid',1)
--                              print("show", b:GetName(),b:GetAttribute("showgrid"))
 
                                ActionButton_ShowGrid(b)
                                ActionButton_ShowGrid(b)
--                              print("show", b:GetName(),b:GetAttribute("showgrid"))
 
                        else
                        else
                                b:SetAttribute('showgrid',0)
                                b:SetAttribute('showgrid',0)
--                              print("hide", b:GetName())
 
                                ActionButton_HideGrid(b)
                                ActionButton_HideGrid(b)
                        end
                        end
                end
                end
        end)
        end)
        hideBlizz()
        hideBlizz()
Line 338... Line 334...
        exitButton:RegisterForClicks("AnyUp") -- UI-Vehicles-Button-Pitch-Up UI-VEHICLES-BUTTON-PITCHDOWN-UP
        exitButton:RegisterForClicks("AnyUp") -- UI-Vehicles-Button-Pitch-Up UI-VEHICLES-BUTTON-PITCHDOWN-UP
        exitButton:SetNormalTexture("Interface\\Vehicles\\UI-Vehicles-Button-Exit-Up")
        exitButton:SetNormalTexture("Interface\\Vehicles\\UI-Vehicles-Button-Exit-Up")
        exitButton:SetScript("OnClick", function(self) VehicleExit() end)
        exitButton:SetScript("OnClick", function(self) VehicleExit() end)
        addon['addSimpleDrag'](exitButton,"FRAME")
        addon['addSimpleDrag'](exitButton,"FRAME")
        RegisterStateDriver(exitButton, "visibility", "[vehicleui] show;hide")
        RegisterStateDriver(exitButton, "visibility", "[vehicleui] show;hide")
 
-- ExtraAction
 
        ExtraActionBarFrame:SetParent(UIParent)
 
        ExtraActionBarFrame:SetSize(64,64)
 
        ExtraActionBarFrame:SetPoint("CENTER",0,0)
 
        UIPARENT_MANAGED_FRAME_POSITIONS["ExtraActionBarFrame"] = nil
 
        addon['addSimpleDrag'](ExtraActionBarFrame,"FRAME")
 
        if(addon['MSQGroup']) then
 
                addon['MSQGroup']:AddButton(_G["ExtraActionButton1"])
 
        end
end
end
 
 
addon['startup'](addon, name, name, init, true, defaults)
addon['startup'](addon, name, name, init, true, defaults)
 No newline at end of file
 No newline at end of file