WoWInterface SVN OneCompanion

Compare Revisions

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

Rev 32 → Rev 33

options.lua
18,7 → 18,7
local L = LibStub("AceLocale-3.0"):GetLocale("OneCompanion")
local AC = LibStub("AceConfig-3.0")
local ACD = LibStub("AceConfigDialog-3.0")
local stratas = {["BACKGROUND"]="BACKGROUND", ["LOW"]="LOW", ["MEDIUM"]="MEDIUM", ["HIGH"]="HIGH", ["DIALOG"]="DIALOG",
local stratas = {["BACKGROUND"]="BACKGROUND", ["LOW"]="LOW", ["MEDIUM"]="MEDIUM", ["HIGH"]="HIGH", ["DIALOG"]="DIALOG",
["FULLSCREEN"]="FULLSCREEN", ["FULLSCREEN_DIALOG"]="FULLSCREEN_DIALOG", ["TOOLTIP"]="TOOLTIP"}
 
local defaults = {
32,6 → 32,8
y = 0,
w = 225,
h = 200,
mw = 225,
mh = 200,
sc = 1,
bsc = 1,
breannix = 0,
44,10 → 46,14
footer = {0.1215686274509804, 0.1254901960784314, 0.1254901960784314, 1},
bindex = {0.7019607843137254, 0.3137254901960784, 0.5686274509803921, 1},
bfooter = {0.807843137254902, 0.1254901960784314, 0.1176470588235294, 1},
model = {0.203921568627451, 0.2117647058823529, 0.2078431372549019, 0.9299999997019768},
bmodel = {0.7019607843137254, 0.3137254901960784, 0.5686274509803921, 1},
},
misc = {
clamp = true,
mclamp = false,
grip = false,
mgrip = false,
tip = false,
lockbreanni = false,
lockbag = false,
112,8 → 118,8
args = {
h = {
order = 0,
name = L["Height"],
desc = L["Change mainframe height"],
name = L["Index height"],
desc = L["Change the index frame height"],
type = "range",
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,
121,13 → 127,31
},
w = {
order = 5,
name = L["Width"],
desc = L["Change mainframe width"],
name = L["Index width"],
desc = L["Change the index frame width"],
type = "range",
min = 50, max = 1000, step = 1,
min = 59, max = 1000, step = 1,
set = "ToggleMainFrameWidth",
get = function() return OneCompanionFrames.base:GetWidth() end,
},
mh = {
order = 6,
name = L["Model height"],
desc = L["Change the model frame height"],
type = "range",
min = 40, max = 1000, step = 1,
set = function(_, value) OneCompanion.db.profile.sizes.mh = value OneCompanionFrames.model:SetHeight(OneCompanion.db.profile.sizes.mh) end,
get = function() return OneCompanionFrames.model:GetHeight() end,
},
mw = {
order = 7,
name = L["Model width"],
desc = L["Change the model frame width"],
type = "range",
min = 40, max = 1000, step = 1,
set = "ToggleModelFrameWidth",
get = function() return OneCompanionFrames.model:GetWidth() end,
},
sc = {
order = 10,
name = L["Button scale"],
138,7 → 162,7
get = function() return OneCompanion.db.profile.sizes.sc end,
},
bsc = {
order = 11,
order = 15,
name = L["Breanni scale"],
desc = L["Change the Breanni's button scale"],
type = "range",
147,7 → 171,7
get = function() return OneCompanion.db.profile.sizes.bsc end,
},
buttonpad = {
order = 15,
order = 11,
name = L["Button padding"],
desc = L["Change the size between each button"],
type = "range",
175,25 → 199,25
index = {
order = 0,
name = L["Index window"],
desc = L["Change the background color for the index window"],
desc = L["Change the index window background color"],
type = "color",
hasAlpha = true,
get = function() return unpack(OneCompanion.db.profile.colors.index) end,
set = "SetColor",
},
footer = {
order = 5,
order = 10,
name = L["Footer window"],
desc = L["Change the background color for the footer window"],
desc = L["Change the footer window background color"],
type = "color",
hasAlpha = true,
get = function() return unpack(OneCompanion.db.profile.colors.footer) end,
set = "SetColor",
},
bindex = {
order = 10,
order = 5,
name = L["Index border"],
desc = L["Change the border color for the index window"],
desc = L["Change the index window border color"],
type = "color",
hasAlpha = true,
get = function() return unpack(OneCompanion.db.profile.colors.bindex) end,
202,12 → 226,30
bfooter = {
order = 15,
name = L["Footer border"],
desc = L["Change the border color for the footer window"],
desc = L["Change the footer window border color"],
type = "color",
hasAlpha = true,
get = function() return unpack(OneCompanion.db.profile.colors.bfooter) end,
set = "SetColor",
},
model = {
order = 20,
name = L["Model window"],
desc = L["Change the model window background color"],
type = "color",
hasAlpha = true,
get = function() return unpack(OneCompanion.db.profile.colors.model) end,
set = "SetColor",
},
bmodel = {
order = 25,
name = L["Model border"],
desc = L["Change the model window border color"],
type = "color",
hasAlpha = true,
get = function() return unpack(OneCompanion.db.profile.colors.bmodel) end,
set = "SetColor",
},
}
},
misc = {
219,19 → 261,35
clamp = {
order = 0,
type = "toggle",
name = L["Clamped to screen"],
desc = L["Clamp the mainframe to the screen"],
name = L["Clamped index"],
desc = L["Clamp the index frame to the screen"],
set = "ToggleMainFrameClamp",
get = function() return OneCompanion.db.profile.misc.clamp end,
},
mclamp = {
order = 1,
type = "toggle",
name = L["Clamped model"],
desc = L["Clamp the model frame to the screen"],
set = "ToggleModelFrameClamp",
get = function() return OneCompanion.db.profile.misc.mclamp end,
},
grip = {
order = 5,
type = "toggle",
name = L["Hide grip"],
name = L["Hide index grip"],
desc = L["Hide or show the index frame grip"],
set = "ToggleShowGrip",
get = function() return OneCompanion.db.profile.misc.grip end,
},
mgrip = {
order = 6,
type = "toggle",
name = L["Hide model grip"],
desc = L["Hide or show the model frame grip"],
set = "ToggleShowModelGrip",
get = function() return OneCompanion.db.profile.misc.mgrip end,
},
tip = {
order = 10,
type = "toggle",
312,11 → 370,15
OCstop = function() fra.base:StopMovingOrSizing() fra:SetAnchors(fra.base) end
end
for i, j in pairs(fra) do
if type(fra[i]) ~= "function" and i ~= "breanni" and i ~= "grip" and i ~= "slider" and i ~= "footerText" and i ~= "footerRev" then
if type(fra[i]) ~= "function" and i ~= "breanni" and i ~= "grip" and i ~= "mgrip" and i ~= "slider" and i ~= "footerText" and i ~= "footerRev" and i ~= "modelindex" then
if i == "scrollindex" then fra[i]:SetFrameLevel(0) end
fra[i]:SetScript("OnMouseDown", OCstart)
fra[i]:SetScript("OnMouseUp", OCstop)
end
if i == "modelindex" then
fra[i]:SetScript("OnMouseDown", function() fra[i].startx, fra[i].starty = GetCursorPosition() fra[i]:SetScript("OnUpdate", fra.OnRotateModel) end)
fra[i]:SetScript("OnMouseUp", function() fra[i]:SetScript("OnUpdate", nil) end)
end
end
for i, j in ipairs(btn) do
j:SetScript("OnDragStart", OCstart)
358,6 → 420,12
opt:ToggleButtonScale(nil, nil, nil, nil)
end
 
function OneCompanionOptions:ToggleModelFrameWidth(_, value)
local self, fra = OneCompanion, OneCompanionFrames
if value then self.db.profile.sizes.mw = value end
fra.model:SetWidth(self.db.profile.sizes.mw)
end
 
function OneCompanionOptions:IsMainFrameHeight()
local fra = OneCompanionFrames
local value = fra.base:GetHeight()
367,7 → 435,7
function OneCompanionOptions:ToggleBreanniScale(_, value)
local self, fra = OneCompanion, OneCompanionFrames
if value then self.db.profile.sizes.bsc = value end
fra.breanni:SetScale(self.db.profile.sizes.bsc)
fra.breanni:SetScale(self.db.profile.sizes.bsc)
fra.breanni:SetPoint(self.db.profile.sizes.breannipt, UIParent, self.db.profile.sizes.breannirpt, self.db.profile.sizes.breannix / self.db.profile.sizes.bsc, self.db.profile.sizes.breanniy / self.db.profile.sizes.bsc)
end
 
397,14 → 465,14
end
end
end
local f, s, p, e = fra.footerText:GetFont()
local f, s, p = fra.footerText:GetFont()
local e = fra.footer:GetWidth()
if e < 94 then
if e < 122 then
fra.footerText:SetFont(f, 6, p)
fra.footerRev:SetFont(f, 6, p)
fra.footerText:SetPoint("BOTTOMRIGHT", fra.footerRev, "TOPRIGHT", 0, 0)
fra.footerText:SetPoint("BOTTOMRIGHT", fra.footerRev, "TOPRIGHT", 0, 0)
fra.footerText:SetText("One|cffffcc00C|r")
elseif e < 140 then
elseif e < 173 then
fra.footerText:SetFont(f, 8, p)
fra.footerRev:SetFont(f, 8, p)
fra.footerText:SetPoint("BOTTOMRIGHT", fra.footerRev, "TOPRIGHT", 0, 0)
424,6 → 492,12
fra.base:SetClampedToScreen(self.db.profile.misc.clamp)
end
 
function OneCompanionOptions:ToggleModelFrameClamp(value)
local self, fra = OneCompanion, OneCompanionFrames
if value then self.db.profile.misc.mclamp = not self.db.profile.misc.mclamp end
fra.model:SetClampedToScreen(self.db.profile.misc.mclamp)
end
 
function OneCompanionOptions:SetColor(key, r, g, b, a)
local self, fra = OneCompanion, OneCompanionFrames
if key then
434,6 → 508,8
r, g, b, a = unpack(self.db.profile.colors.footer) fra.footer:SetBackdropColor(r, g, b, a)
r, g, b, a = unpack(self.db.profile.colors.bindex) fra.index:SetBackdropBorderColor(r, g, b, a)
r, g, b, a = unpack(self.db.profile.colors.bfooter) fra.footer:SetBackdropBorderColor(r, g, b, a)
r, g, b, a = unpack(self.db.profile.colors.model) fra.model:SetBackdropColor(r, g, b, a)
r, g, b, a = unpack(self.db.profile.colors.bmodel) fra.model:SetBackdropBorderColor(r, g, b, a)
end
 
function OneCompanionOptions:ToggleShowGrip(value)
442,15 → 518,18
if self.db.profile.misc.grip then fra.grip:Hide() else fra.grip:Show() end
end
 
function OneCompanionOptions:ToggleShowTooltips(value, spellID, b)
function OneCompanionOptions:ToggleShowModelGrip(value)
local self, fra = OneCompanion, OneCompanionFrames
if value then self.db.profile.misc.mgrip = not self.db.profile.misc.mgrip end
if self.db.profile.misc.mgrip then fra.mgrip:Hide() else fra.mgrip:Show() end
end
 
function OneCompanionOptions:ToggleShowTooltips(value)
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
for i, j in ipairs(btn) do j:SetScript("OnEnter", nil) end
else
fra.cfgButton:SetScript("OnEnter", function(self)
if GetCVar("UberTooltips") == "1" then
458,45 → 537,38
else
g:SetOwner(self, "ANCHOR_RIGHT")
end
g:AddLine(L["Settings"])
g:AddLine(L["Settings"], 1, 1, 1)
g:AddLine(L["Click to open/close the Ace3 configuration window"])
g:Show()
end)
fra.modButton:SetScript("OnEnter", function(self)
if GetCVar("UberTooltips") == "1" then
GameTooltip_SetDefaultAnchor(g, self)
else
g:SetOwner(self, "ANCHOR_RIGHT")
end
g:AddLine(L["Companion preview"], 1, 1, 1)
g:AddLine(L["Click to open/close the 3D preview window"])
g:AddLine(L["Ctrl-click any companion icon to show its 3D preview"], 0.1843137254901961, 0.8235294117647058, 0)
g:Show()
end)
fra.cfgButton:SetScript("OnLeave", function(self) g:Hide() end)
if b then
b:SetScript("OnEnter", function(self)
fra.modButton:SetScript("OnLeave", function(self) g:Hide() end)
for i, j in ipairs(btn) do
j:SetScript("OnEnter", function(self)
if GetCVar("UberTooltips") == "1" then
GameTooltip_SetDefaultAnchor(g, self)
else
g:SetOwner(self, "ANCHOR_LEFT")
g:SetOwner(self, "ANCHOR_RIGHT")
end
if g:SetHyperlink("spell:" .. spellID) then
if g:SetHyperlink("spell:" .. j.spellID) then
self.UpdateTooltip = self
else
self.UpdateTooltip = nil
end
g:AddLine(L["Ctrl-click to show the 3D preview"], 0.1843137254901961, 0.8235294117647058, 0)
g:Show()
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
end