/trunk
index:SetPoint("TOPLEFT", base, "TOPLEFT", 0, 0) |
index:SetPoint("TOPRIGHT", base, "TOPRIGHT", 0, 0) |
index:SetBackdrop(indexBackdrop) |
-- base:SetFrameStrata("BACKGROUND") |
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) |
scrollindex:SetPoint("BOTTOMRIGHT", - self.db.profile.sizes.borderpad, self.db.profile.sizes.borderpad) |
child:SetWidth(scrollindex:GetWidth()) |
-- child:SetToplevel(true) |
-- child:SetFrameStrata("FULLSCREEN_DIALOG") |
slider:SetOrientation("VERTICAL") |
-- slider:SetHitRectInsets(0, -10, -10, -10) |
slider:SetBackdrop(sliderBackdrop) |
grip:SetHighlightTexture([[Interface\AddOns\OneCompanion\textures\grip]]) |
grip:SetWidth(16) |
grip:SetHeight(16) |
grip:SetScript("OnMouseDown", function() this:GetParent():GetParent():StartSizing() grip:SetScript("OnUpdate", function() fra:SetAnchors(base) opt:ToggleButtonScale(nil, nil, nil, nil) end) end) |
grip:SetScript("OnMouseUp", function() base:SetScript("OnSizeChanged", nil) this:GetParent():GetParent():StopMovingOrSizing() grip:SetScript("OnUpdate", nil) end) |
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:SetPoint("BOTTOMRIGHT", index, "BOTTOMRIGHT", -1, 1) |
grip:SetFrameLevel(30) |
footerRev:SetPoint("BOTTOMRIGHT", footer, "BOTTOMRIGHT", -5, 5) |
base:SetResizable(true) |
index:SetResizable(true) |
footer:SetResizable(true) |
base:SetMinResize(112, 50) |
-- base:SetScript("OnSizeChanged", nil) |
base:SetMinResize(50, 68) |
breanni:SetScript("OnClick", OneCompanion.ToggleShowHide) |
cfgButton:SetScript("OnClick", OneCompanion.OpenConfig) |
fra.breanni = breanni |
fra.footerText = footerText |
fra.footerRev = footerRev |
-- fra:SetAnchors(nil) |
opt:ToggleShowTooltips(nil) |
opt:ToggleShowTooltips(nil, nil, nil) |
opt:SetColor(nil, nil, nil, nil, nil) |
opt:ToggleMainFrameClamp(nil) |
opt:ToggleShowGrip(nil) |
texture:SetTexture(icon) |
slot:SetID(i) |
btn[i] = slot |
OneCompanionOptions:ToggleShowTooltips(nil, spellID, btn[i]) |
slot:SetScript("OnClick", function() |
CallCompanion("MOUNT", i) |
PlaySound("igMainMenuOptionCheckBoxOff") |
local creatureID, creatureName, spellID, icon, active = GetCompanionInfo("MOUNT", i); |
if active then |
DismissCompanion("MOUNT", i) |
PlaySound("igMainMenuOptionCheckBoxOn") |
else |
CallCompanion("MOUNT", i) |
PlaySound("igMainMenuOptionCheckBoxOff") |
end |
end) |
end |
for i = 1, critter do |
texture:SetTexture(icon) |
slot:SetID(id) |
btn[id] = slot |
OneCompanionOptions:ToggleShowTooltips(nil, spellID, btn[id]) |
slot:SetScript("OnClick", function() |
CallCompanion("CRITTER", i) |
PlaySound("igMainMenuOptionCheckBoxOff") |
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:ShowTip(spellID) |
end |
Description: OneCompanion is an alternative to the default companion frame introduced in WotLK that combines all your companions and mounts into one fully customizable frame |
]] |
if not (select(4,GetBuildInfo()) >= 30000) then return end |
if not (select(4,GetBuildInfo()) >= 30000) then DEFAULT_CHAT_FRAME:AddMessage("One|cffffcc00Companion|r: wrong WoW client, OneCompanion is built for WotLK only.") return end |
local MINOR_VERSION = tonumber(("$Revision$"):match("%d+")) |
_G.OneCompanion_MINOR_VERSION = MINOR_VERSION |
Description: OneCompanion is an alternative to the default companion frame introduced in WotLK that combines all your companions and mounts into one fully customizable frame |
]] |
if not (select(4,GetBuildInfo()) >= 30000) then DEFAULT_CHAT_FRAME:AddMessage("One|cffffcc00Companion|r: wrong WoW client, OneCompanion is built for WotLK only.") return end |
if not (select(4,GetBuildInfo()) >= 30000) then return end |
local MINOR_VERSION = tonumber(("$Revision$"):match("%d+")) |
if MINOR_VERSION > _G.OneCompanion_MINOR_VERSION then _G.OneCompanion_MINOR_VERSION = MINOR_VERSION end |
name = L["Height"], |
desc = L["Change mainframe height"], |
type = "range", |
min = 100, max = 800, step = 1, |
min = 68, max = 1000, step = 1, |
set = function(_, value) OneCompanion.db.profile.sizes.h = value OneCompanionFrames.base:SetHeight(OneCompanion.db.profile.sizes.h) OneCompanionFrames.ShowSlider() end, |
get = function() return OneCompanionFrames.base:GetHeight() end, |
}, |
name = L["Width"], |
desc = L["Change mainframe width"], |
type = "range", |
min = 112, max = 800, step = 1, |
min = 50, max = 1000, step = 1, |
set = "ToggleMainFrameWidth", |
get = function() return OneCompanionFrames.base:GetWidth() end, |
}, |
desc = L["Change the background color for the index window"], |
type = "color", |
hasAlpha = true, |
get = function() |
return unpack(OneCompanion.db.profile.colors.index) |
end, |
get = function() return unpack(OneCompanion.db.profile.colors.index) end, |
set = "SetColor", |
}, |
footer = { |
desc = L["Change the background color for the footer window"], |
type = "color", |
hasAlpha = true, |
get = function() |
return unpack(OneCompanion.db.profile.colors.footer) |
end, |
get = function() return unpack(OneCompanion.db.profile.colors.footer) end, |
set = "SetColor", |
}, |
bindex = { |
desc = L["Change the border color for the index window"], |
type = "color", |
hasAlpha = true, |
get = function() |
return unpack(OneCompanion.db.profile.colors.bindex) |
end, |
get = function() return unpack(OneCompanion.db.profile.colors.bindex) end, |
set = "SetColor", |
}, |
bfooter = { |
desc = L["Change the border color for the footer window"], |
type = "color", |
hasAlpha = true, |
get = function() |
return unpack(OneCompanion.db.profile.colors.bfooter) |
end, |
get = function() return unpack(OneCompanion.db.profile.colors.bfooter) end, |
set = "SetColor", |
}, |
} |
end |
end |
end |
local f, s, p = fra.footerText:GetFont() |
if fra.footer:GetWidth() < 140 then |
local f, s, p, e = fra.footerText:GetFont() |
local e = fra.footer:GetWidth() |
if e < 94 then |
fra.footerText:SetFont(f, 6, p) |
fra.footerRev:SetFont(f, 6, p) |
fra.footerText:SetPoint("BOTTOMRIGHT", fra.footerRev, "TOPRIGHT", 0, 0) |
fra.footerText:SetText("One|cffffcc00C|r") |
elseif e < 140 then |
fra.footerText:SetFont(f, 8, p) |
fra.footerRev:SetFont(f, 8, p) |
fra.footerText:SetPoint("BOTTOMRIGHT", fra.footerRev, "TOPRIGHT", 0, 0) |
fra.footerText:SetText("One|cffffcc00Companion|r") |
else |
fra.footerText:SetFont(f, 12, p) |
fra.footerRev:SetFont(f, 8, p) |
fra.footerText:SetPoint("BOTTOMRIGHT", fra.footerRev, "TOPLEFT", 0, -4) |
fra.footerText:SetText("One|cffffcc00Companion|r") |
end |
fra.ShowSlider() |
end |
if self.db.profile.misc.grip then fra.grip:Hide() else fra.grip:Show() end |
end |
function OneCompanionOptions:ToggleShowTooltips(value) |
local self, fra, gam = OneCompanion, OneCompanionFrames, GameTooltip |
function OneCompanionOptions:ToggleShowTooltips(value, spellID, b) |
local self, fra, g, btn = OneCompanion, OneCompanionFrames, GameTooltip, OneCompanionButtons |
if value then self.db.profile.misc.tip = not self.db.profile.misc.tip end |
if self.db.profile.misc.tip then |
fra.cfgButton:SetScript("OnEnter", nil) |
if b then b:SetScript("OnEnter", nil) |
elseif value then |
for i, j in ipairs(btn) do j:SetScript("OnEnter", nil) end |
end |
else |
fra.cfgButton:SetScript("OnEnter", function(self) |
if ( GetCVar("UberTooltips") == "1" ) then |
GameTooltip_SetDefaultAnchor(gam, self) |
if GetCVar("UberTooltips") == "1" then |
GameTooltip_SetDefaultAnchor(g, self) |
else |
gam:SetOwner(self, "ANCHOR_RIGHT") |
g:SetOwner(self, "ANCHOR_RIGHT") |
end |
gam:AddLine(L["Settings"]) |
gam:Show() |
g:AddLine(L["Settings"]) |
g:Show() |
end) |
fra.cfgButton:SetScript("OnLeave", function(self) gam:Hide() end) |
fra.cfgButton:SetScript("OnLeave", function(self) g:Hide() end) |
if b then |
b:SetScript("OnEnter", function(self) |
if GetCVar("UberTooltips") == "1" then |
GameTooltip_SetDefaultAnchor(g, self) |
else |
g:SetOwner(self, "ANCHOR_LEFT") |
end |
if g:SetHyperlink("spell:" .. spellID) then |
self.UpdateTooltip = self |
else |
self.UpdateTooltip = nil |
end |
end) |
elseif value then |
for i, j in ipairs(btn) do |
local d = GetNumCompanions("MOUNT") |
local creatureID, creatureName, spellID, icon, active |
if i <= d then |
creatureID, creatureName, spellID, icon, active = GetCompanionInfo("MOUNT", i) |
else |
creatureID, creatureName, spellID, icon, active = GetCompanionInfo("CRITTER", i-d) |
end |
j:SetScript("OnEnter", function(self) |
if GetCVar("UberTooltips") == "1" then |
GameTooltip_SetDefaultAnchor(g, self) |
else |
g:SetOwner(self, "ANCHOR_LEFT") |
end |
if g:SetHyperlink("spell:" .. spellID) then |
self.UpdateTooltip = self |
else |
self.UpdateTooltip = nil |
end |
end) |
end |
end |
end |
end |