WoWInterface SVN OneCompanion

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk/OneCompanion/frames
    from Rev 32 to Rev 33
    Reverse comparison

Rev 32 → Rev 33

templates.lua
27,25 → 27,24
local grip = CreateFrame("Button", "OneCompanionGrip", index)
local slider = CreateFrame("Slider", "OneCompanionIndexSlider", index)
local child = CreateFrame("Frame", "OneCompanionIndexChild", scrollindex)
local footer = CreateFrame("Frame", "OneCompanionFooterFrame", base)
local footer = CreateFrame("Frame", nil, base)
local footerText = footer:CreateFontString(nil, nil, "GameFontNormal")
local footerRev = footer:CreateFontString(nil, nil, "GameFontNormal")
local cfgButton = CreateFrame("Button", nil, footer)
local modButton = CreateFrame("Button", nil, footer)
local model = CreateFrame("Frame", "OneCompanionModelFrame", base)
local modelindex = CreateFrame("PlayerModel", "OneCompanionModelIndexFrame", model)
local mgrip = CreateFrame("Button", "OneCompanionModelGrip", model)
local sliderBackdrop = {
bgFile = [[Interface\Buttons\UI-SliderBar-Background]],
edgeFile = [[Interface\Buttons\UI-SliderBar-Border]],
tile = true, tileSize = 8, edgeSize = 8,
insets = { left = 3, right = 3, top = 3, bottom = 3 } }
local indexBackdrop = {
local defaultBackdrop = {
bgFile = [[Interface\ChatFrame\ChatFrameBackground]],
edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]],
tile = true, tileSize = 16, edgeSize = 16,
insets = { left = 5, right = 5, top = 5, bottom = 5 } }
local footerBackdrop = {
bgFile = [[Interface\ChatFrame\ChatFrameBackground]],
edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]],
tile = true, tileSize = 16, edgeSize = 16,
insets = { left = 5, right = 5, top = 5, bottom = 5 } }
texture:SetAllPoints(breanni)
texture:SetTexture([[Interface\AddOns\OneCompanion\textures\breanni]])
breanni:SetPoint(self.db.profile.sizes.breannipt, UIParent, self.db.profile.sizes.breannirpt, self.db.profile.sizes.breannix, self.db.profile.sizes.breanniy)
53,18 → 52,26
base:SetHeight(self.db.profile.sizes.h)
base:SetWidth(self.db.profile.sizes.w)
base:SetPoint(self.db.profile.sizes.pt, UIParent, self.db.profile.sizes.rpt, self.db.profile.sizes.x, self.db.profile.sizes.y)
model:SetHeight(self.db.profile.sizes.mh)
model:SetWidth(self.db.profile.sizes.mw)
model:SetPoint("TOPLEFT", base, "TOPRIGHT", 0, 0)
model:SetBackdrop(defaultBackdrop)
footer:SetHeight(30)
footer:SetWidth(self.db.profile.sizes.w)
footer:SetPoint("BOTTOMLEFT", base, "BOTTOMLEFT", 0, 0)
footer:SetPoint("BOTTOMRIGHT", base, "BOTTOMRIGHT", 0, 0)
footer:SetBackdrop(footerBackdrop)
footer:SetBackdrop(defaultBackdrop)
scrollindex:SetScrollChild(child)
index:SetWidth(self.db.profile.sizes.w)
index:SetPoint("BOTTOMLEFT", footer, "TOPLEFT", 0, 0)
index:SetPoint("BOTTOMRIGHT", footer, "TOPRIGHT", 0, 0)
index:SetPoint("TOPLEFT", base, "TOPLEFT", 0, 0)
index:SetPoint("TOPRIGHT", base, "TOPRIGHT", 0, 0)
index:SetBackdrop(indexBackdrop)
index:SetBackdrop(defaultBackdrop)
modelindex:SetPoint("BOTTOMLEFT", model, "BOTTOMLEFT", 5, 5)
modelindex:SetPoint("BOTTOMRIGHT", model, "BOTTOMRIGHT", -5, 5)
modelindex:SetPoint("TOPLEFT", model, "TOPLEFT", 5, -5)
modelindex:SetPoint("TOPRIGHT", model, "TOPRIGHT", -5, -5)
scrollindex:SetPoint("TOPLEFT", self.db.profile.sizes.borderpad, - self.db.profile.sizes.borderpad)
scrollindex:SetPoint("TOPRIGHT", - self.db.profile.sizes.borderpad, - self.db.profile.sizes.borderpad)
scrollindex:SetPoint("BOTTOMLEFT", self.db.profile.sizes.borderpad, self.db.profile.sizes.borderpad)
76,8 → 83,8
slider:SetWidth(8)
slider:SetThumbTexture([[Interface\Buttons\UI-SliderBar-Button-Vertical]])
slider:SetFrameStrata("FULLSCREEN_DIALOG")
slider:SetPoint("TOPLEFT", index, "TOPRIGHT", 5, 0)
slider:SetPoint("BOTTOMLEFT", index, "BOTTOMRIGHT", 5, 0)
-- slider:SetPoint("TOPLEFT", index, "TOPRIGHT", 5, 0)
-- slider:SetPoint("BOTTOMLEFT", index, "BOTTOMRIGHT", 5, 0)
slider:SetMinMaxValues(0, 1)
slider:SetValueStep(0.001)
slider:SetValue(0)
94,9 → 101,17
grip:SetWidth(16)
grip:SetHeight(16)
grip:SetScript("OnMouseDown", function() base:StartSizing() grip:SetScript("OnUpdate", function() fra:SetAnchors(base) opt:ToggleButtonScale(nil, nil, nil, nil) end) end)
grip:SetScript("OnMouseUp", function() base:SetScript("OnSizeChanged", nil) base:StopMovingOrSizing() grip:SetScript("OnUpdate", nil) end)
grip:SetScript("OnMouseUp", function() base:SetScript("OnSizeChanged", nil) base:StopMovingOrSizing() grip:SetScript("OnUpdate", nil) fra:SetAnchors(base) end)
grip:SetPoint("BOTTOMRIGHT", index, "BOTTOMRIGHT", -1, 1)
grip:SetFrameLevel(30)
mgrip:SetNormalTexture([[Interface\AddOns\OneCompanion\textures\grip]])
mgrip:SetHighlightTexture([[Interface\AddOns\OneCompanion\textures\grip]])
mgrip:SetWidth(16)
mgrip:SetHeight(16)
mgrip:SetScript("OnMouseDown", function() model:StartSizing() end)
mgrip:SetScript("OnMouseUp", function() model:SetScript("OnSizeChanged", nil) model:StopMovingOrSizing() fra:SetModelAnchors(model) end)
mgrip:SetPoint("BOTTOMRIGHT", model, "BOTTOMRIGHT", -1, 1)
mgrip:SetFrameLevel(30)
footerRev:SetPoint("BOTTOMRIGHT", footer, "BOTTOMRIGHT", -5, 5)
footerRev:SetText("r|cff7a7a7a" .. _G.OneCompanion_MINOR_VERSION .. "|r")
footerText:SetText("One|cffffcc00Companion|r")
107,19 → 122,30
cfgButton:SetNormalTexture([[Interface\Icons\Ability_Repair]])
cfgButton:SetHighlightTexture([[Interface\Buttons\ButtonHilight-Square]])
cfgButton:SetPoint("LEFT", footer, "LEFT", 7, 0)
cfgButton:SetWidth(16)
cfgButton:SetHeight(16)
cfgButton:SetWidth(20)
cfgButton:SetHeight(20)
modButton:SetNormalTexture([[Interface\Icons\INV_Misc_Spyglass_02]])
modButton:SetHighlightTexture([[Interface\Buttons\ButtonHilight-Square]])
modButton:SetPoint("LEFT", cfgButton, "RIGHT", 5, 0)
modButton:SetWidth(20)
modButton:SetHeight(20)
base:EnableMouse(true)
index:EnableMouse(true)
scrollindex:EnableMouse(true)
child:EnableMouse(true)
footer:EnableMouse(true)
model:EnableMouse(true)
modelindex:EnableMouse(true)
base:SetResizable(true)
index:SetResizable(true)
modelindex:SetResizable(true)
footer:SetResizable(true)
base:SetMinResize(50, 68)
model:SetResizable(true)
base:SetMinResize(59, 68)
model:SetMinResize(40, 40)
breanni:SetScript("OnClick", OneCompanion.ToggleShowHide)
cfgButton:SetScript("OnClick", OneCompanion.OpenConfig)
modButton:SetScript("OnClick", OneCompanion.OpenModel)
 
fra.base = base
fra.index = index
129,22 → 155,30
fra.footer = footer
fra.grip = grip
fra.cfgButton = cfgButton
fra.modButton = modButton
fra.breanni = breanni
fra.footerText = footerText
fra.footerRev = footerRev
 
fra.model = model
fra.modelindex = modelindex
fra.mgrip = mgrip
 
base:Hide()
model:Hide()
 
opt:ToggleShowTooltips(nil, nil, nil)
opt:SetColor(nil, nil, nil, nil, nil)
opt:ToggleMainFrameClamp(nil)
opt:ToggleModelFrameClamp(nil)
opt:ToggleShowGrip(nil)
opt:ToggleShowModelGrip(nil)
opt:ToggleLockBreanni(nil)
fra:buildButtons()
opt:ToggleShowTooltips(nil)
opt:ToggleLockBag(nil)
 
opt:ToggleButtonScale(nil, nil, nil, nil)
opt:ToggleBreanniScale(nil, nil)
opt:ToggleStrata(nil, nil)
base:Hide()
end
 
 
152,6 → 186,14
local self , fra = OneCompanion, OneCompanionFrames
local h, m = fra.scrollindex:GetHeight(), OneCompanionMaxHeight
if m > h then
fra.slider:ClearAllPoints()
if fra.model:IsVisible() then
fra.slider:SetPoint("TOPRIGHT", fra.index, "TOPLEFT", -5, 0)
fra.slider:SetPoint("BOTTOMRIGHT", fra.index, "BOTTOMLEFT", -5, 0)
else
fra.slider:SetPoint("TOPLEFT", fra.index, "TOPRIGHT", 5, 0)
fra.slider:SetPoint("BOTTOMLEFT", fra.index, "BOTTOMRIGHT", 5, 0)
end
fra.slider:Show()
else
fra.slider:Hide()
166,15 → 208,36
self.db.profile.sizes.pt, _, self.db.profile.sizes.rpt, self.db.profile.sizes.x, self.db.profile.sizes.y = f:GetPoint()
self.db.profile.sizes.w = f:GetWidth()
self.db.profile.sizes.h = f:GetHeight()
fra.footer:SetWidth(self.db.profile.sizes.w)
fra.index:SetWidth(self.db.profile.sizes.w)
fra.child:SetWidth(self.db.profile.sizes.w)
fra.footer:SetWidth(self.db.profile.sizes.w)
fra.footer:SetPoint("BOTTOMLEFT", fra.base, "BOTTOMLEFT", 0, 0)
fra.footer:SetPoint("BOTTOMRIGHT", fra.base, "BOTTOMRIGHT", 0, 0)
fra.index:SetPoint("BOTTOMLEFT", fra.footer, "TOPLEFT", 0, 0)
fra.index:SetPoint("BOTTOMRIGHT", fra.footer, "TOPRIGHT", 0, 0)
fra.index:SetPoint("TOPLEFT", fra.base, "TOPLEFT", 0, 0)
fra.index:SetPoint("TOPRIGHT", fra.base, "TOPRIGHT", 0, 0)
fra.model:SetPoint("TOPLEFT", fra.base, "TOPRIGHT", 0, 0)
end
end
 
function OneCompanionFrames:SetModelAnchors(f)
local self , fra = OneCompanion, OneCompanionFrames
if f then
self.db.profile.sizes.mw = f:GetWidth()
self.db.profile.sizes.mh = f:GetHeight()
fra.model:ClearAllPoints()
fra.model:SetPoint("TOPLEFT", fra.base, "TOPRIGHT", 0, 0)
fra.modelindex:SetPoint("BOTTOMLEFT", fra.model, "BOTTOMLEFT", 5, 5)
fra.modelindex:SetPoint("BOTTOMRIGHT", fra.model, "BOTTOMRIGHT", -5, 5)
fra.modelindex:SetPoint("TOPLEFT", fra.model, "TOPLEFT", 5, -5)
fra.modelindex:SetPoint("TOPRIGHT", fra.model, "TOPRIGHT", -5, -5)
end
end
 
function OneCompanionFrames:SetBreanniAnchors(f)
local self , fra = OneCompanion, OneCompanionFrames
if f then
if f then
self.db.profile.sizes.breannipt, _, self.db.profile.sizes.breannirpt, self.db.profile.sizes.breannix, self.db.profile.sizes.breanniy = f:GetPoint()
self.db.profile.sizes.breannix = self.db.profile.sizes.breannix * self.db.profile.sizes.bsc
self.db.profile.sizes.breanniy = self.db.profile.sizes.breanniy * self.db.profile.sizes.bsc
187,68 → 250,57
for i, j in ipairs(btn) do
j:Hide()
end
for i = 1, mount do
for i = 1, mount + critter do
local slot = CreateFrame("Button", "OneCompanionSlot" .. i, fra.child, "BankItemButtonGenericTemplate")
local creatureID, creatureName, spellID, icon, active = GetCompanionInfo("MOUNT", i)
local texture = slot:CreateTexture("OneCompanionTexture" .. i)
local cool = CreateFrame("Cooldown", "OneCompanionSlot" .. i .. "Cooldown", slot, "CooldownFrameTemplate")
local texture, type, petID = slot:CreateTexture("OneCompanionTexture" .. i), nil, nil
if i <= mount then type = "MOUNT" petID = i else type = "CRITTER" petID = i - mount end
local creatureID, creatureName, spellID, icon, active = GetCompanionInfo(type, petID)
slot.cool, slot.type, slot.petID, slot.creatureID, slot.creatureName, slot.spellID, slot.active = cool, type, petID, creatureID, creatureName, spellID, active
cool:SetAllPoints(slot)
cool:SetAlpha(0.8)
texture:SetAllPoints(slot)
texture:SetTexture(icon)
slot:SetID(i)
btn[i] = slot
OneCompanionOptions:ToggleShowTooltips(nil, spellID, btn[i])
slot:SetScript("OnClick", function()
if IsModifiedClick("CHATLINK") then
if MacroFrame and MacroFrame:IsShown() then
local spellName = GetSpellInfo(spellID);
ChatEdit_InsertLink(spellName);
local spellName = GetSpellInfo(spellID)
ChatEdit_InsertLink(spellName)
else
local spellLink = GetSpellLink(spellID)
ChatEdit_InsertLink(spellLink);
ChatEdit_InsertLink(spellLink)
end
elseif IsControlKeyDown() then
fra.model:Show()
fra.ShowSlider()
fra.modelindex:SetCreature(creatureID)
else
local creatureID, creatureName, spellID, icon, active = GetCompanionInfo("MOUNT", i);
local creatureID, creatureName, spellID, icon, active = GetCompanionInfo(type, petID)
if active then
DismissCompanion("MOUNT", i)
DismissCompanion(type, petID)
PlaySound("igMainMenuOptionCheckBoxOn")
else
CallCompanion("MOUNT", i)
PlaySound("igMainMenuOptionCheckBoxOff")
CallCompanion(type, petID)
PlaySound("igMainMenuOptionCheckBoxOff")
end
end
end)
end
for i = 1, critter do
local id = i + mount
local slot = CreateFrame("Button", "OneCompanionSlot" .. id, fra.child, "BankItemButtonGenericTemplate")
local creatureID, creatureName, spellID, icon, active = GetCompanionInfo("CRITTER", i)
local texture = slot:CreateTexture("OneCompanionTexture" .. id)
texture:SetAllPoints(slot)
texture:SetTexture(icon)
slot:SetID(id)
btn[id] = slot
OneCompanionOptions:ToggleShowTooltips(nil, spellID, btn[id])
slot:SetScript("OnClick", function()
if IsModifiedClick("CHATLINK") then
if MacroFrame and MacroFrame:IsShown() then
local spellName = GetSpellInfo(spellID);
ChatEdit_InsertLink(spellName);
else
local spellLink = GetSpellLink(spellID)
ChatEdit_InsertLink(spellLink);
end
else
local creatureID, creatureName, spellID, icon, active = GetCompanionInfo("CRITTER", i)
if active then
DismissCompanion("CRITTER", i)
PlaySound("igMainMenuOptionCheckBoxOn")
else
CallCompanion("CRITTER", i)
PlaySound("igMainMenuOptionCheckBoxOff")
end
end
end)
end
 
function OneCompanionFrames:UpdateCooldowns()
local btn = OneCompanionButtons
for i, j in ipairs(btn) do
local start, duration, enable = GetCompanionCooldown(btn[i].type, btn[i].petID)
CooldownFrame_SetTimer(btn[i].cool, start, duration, enable)
end
end
 
function OneCompanionFrames:ShowTip(spellID)
end
\ No newline at end of file +function OneCompanionFrames:OnRotateModel() + local self, endx, endy = OneCompanionFrames.modelindex, GetCursorPosition() + self.rot = (endx - self.startx) / 34 + self:GetFacing() + self:SetRotation(self.rot) + self.startx, self.starty = GetCursorPosition() +end