WoWInterface SVN Visor2GUI

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 2 to Rev 3
    Reverse comparison

Rev 2 → Rev 3

Frame.lua New file
0,0 → 1,322
--[[ $Id$ ]]
 
local L = AceLibrary("AceLocale-2.2"):new("Visor2GUI")
local alpha = 1
 
-- wee! complex gui frame creation is fun!
local frame = CreateFrame("Frame", "Visor2GUIFrame", UIParent)
tinsert(UISpecialFrames, "Visor2GUIFrame")
frame:Hide()
frame:SetWidth(400)
frame:SetHeight(400)
frame:SetPoint("CENTER", UIParent, "CENTER")
frame:SetFrameLevel(9)
frame:EnableMouse(true)
frame:SetMovable(true)
frame:RegisterForDrag("LeftButton")
frame:SetScript("OnDragStart", function(this) this:StartMoving() end)
frame:SetScript("OnDragStop", function(this) this:StopMovingOrSizing() end)
frame:SetScript("OnUpdate", function(this, elapsed)
-- this function borrowed from RockConfig-1.0
if MouseIsOver(this) then
if alpha < 1 then alpha = alpha + elapsed/.15 end
if alpha >= 1 then alpha = 1 end
else
if alpha > .25 then alpha = alpha - elapsed/.15 end
if alpha <= .25 then alpha = .25 end
end
this:SetAlpha(alpha)
end)
frame:SetBackdrop({
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
insets = { left = 5, right = 5, top = 5, bottom = 5 },
tile = true, tileSize = 16, edgeSize = 16,
})
frame:SetBackdropColor(0.09, 0.09, 0.19)
frame:SetBackdropBorderColor(0.5, 0.5, 0.5)
 
local texture = frame:CreateTexture(nil, "ARTWORK")
texture:SetWidth(300)
texture:SetHeight(48)
texture:SetPoint("TOP", 0, 15)
texture:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header")
 
local header = frame:CreateFontString(nil, "ARTWORK", "GameFontNormal")
header:SetPoint("TOP", 0, 7)
header:SetText(L["Visor2 GUI"])
 
local editBox = CreateFrame("EditBox", "Visor2GUIEditBox", frame, "InputBoxTemplate")
editBox:SetWidth(325)
editBox:SetHeight(20)
editBox:SetPoint("TOP", frame, "TOP", 0, -47)
editBox:SetAutoFocus(false)
editBox:SetScript("OnEnterPressed", function() Visor2GUI:EditBoxUpdate() end)
 
local editBoxLabel = editBox:CreateFontString(nil, "ARTWORK", "GameFontNormal")
editBoxLabel:SetPoint("TOP", 0, 20)
editBoxLabel:SetText(L["Enter frame name or select frame with Grab button"])
 
local target = frame:CreateFontString("Visor2GUITarget", "ARTWORK", "GameFontNormal")
target:SetPoint("TOPLEFT", editBox, "BOTTOMLEFT")
 
local grabParent = CreateFrame("Button", "Visor2GUIGrabParent", frame, "GameMenuButtonTemplate")
grabParent:SetWidth(100)
grabParent:SetHeight(25)
grabParent:SetPoint("TOPRIGHT", editBox, "BOTTOMRIGHT")
grabParent:SetText(L["Grab Parent"])
grabParent:SetScript("OnEnter", function() Visor2GUI:ShowTooltip(L["Set the active frame's parent frame as the active frame"]) end)
grabParent:SetScript("OnLeave", function() GameTooltip:Hide() end)
grabParent:SetScript("OnClick", function() Visor2:SetupFrame("f="..Visor2GUI.parent) end)
 
-- sliders
local scaleSlider = CreateFrame("Slider", "Visor2GUIScale", frame, "OptionsSliderTemplate")
scaleSlider:SetWidth(120)
scaleSlider:SetHeight(16)
scaleSlider:SetPoint("TOP", 90, -110)
scaleSlider:SetMinMaxValues(0.05, 3)
scaleSlider:SetValueStep(0.05)
scaleSlider:SetValue(1)
scaleSlider:SetScript("OnEnter", function() Visor2GUI:ShowTooltip(L["Adjust frame size"]) end)
scaleSlider:SetScript("OnLeave", function() GameTooltip:Hide() end)
scaleSlider:SetScript("OnValueChanged", function() Visor2GUI:ScaleUpdate() end)
 
local alphaSlider = CreateFrame("Slider", "Visor2GUIAlpha", frame, "OptionsSliderTemplate")
alphaSlider:SetWidth(120)
alphaSlider:SetHeight(16)
alphaSlider:SetPoint("TOP", scaleSlider, "BOTTOM", 0, -30)
alphaSlider:SetMinMaxValues(0, 1)
alphaSlider:SetValueStep(0.05)
alphaSlider:SetValue(1)
alphaSlider:SetScript("OnEnter", function() Visor2GUI:ShowTooltip(L["Adjust frame transparency"]) end)
alphaSlider:SetScript("OnLeave", function() GameTooltip:Hide() end)
alphaSlider:SetScript("OnValueChanged", function() Visor2GUI:AlphaUpdate() end)
 
-- nudger stuff
local nudgeSlider = CreateFrame("Slider", "Visor2GUINudge", frame, "OptionsSliderTemplate")
nudgeSlider:SetWidth(120)
nudgeSlider:SetHeight(16)
nudgeSlider:SetPoint("BOTTOM", -85, 60)
nudgeSlider:SetMinMaxValues(1, 80)
nudgeSlider:SetValueStep(1)
nudgeSlider:SetScript("OnMouseUp", function() Visor2GUI:NudgeUpdate() end)
 
local nudgeLeft = CreateFrame("Button", nil, frame, "UIPanelButtonTemplate")
nudgeLeft:SetWidth(20)
nudgeLeft:SetHeight(20)
nudgeLeft:SetPoint("BOTTOM", nudgeSlider, "TOP", -20, 40)
nudgeLeft:SetText("<")
nudgeLeft:SetScript("OnEnter", function() Visor2GUI:ShowTooltip(L["Nudge Left"]) end)
nudgeLeft:SetScript("OnLeave", function() GameTooltip:Hide() end)
nudgeLeft:SetScript("OnClick", function() Visor2GUI:NudgeLeft() end)
 
local nudgeRight = CreateFrame("Button", nil, frame, "UIPanelButtonTemplate")
nudgeRight:SetWidth(20)
nudgeRight:SetHeight(20)
nudgeRight:SetPoint("BOTTOM", nudgeSlider, "TOP", 20, 40)
nudgeRight:SetText(">")
nudgeRight:SetScript("OnEnter", function() Visor2GUI:ShowTooltip(L["Nudge Right"]) end)
nudgeRight:SetScript("OnLeave", function() GameTooltip:Hide() end)
nudgeRight:SetScript("OnClick", function() Visor2GUI:NudgeRight() end)
 
local nudgeUp = CreateFrame("Button", nil, frame, "UIPanelButtonTemplate")
nudgeUp:SetWidth(20)
nudgeUp:SetHeight(20)
nudgeUp:SetPoint("BOTTOM", nudgeSlider, "TOP", 0, 60)
nudgeUp:SetText("^")
nudgeUp:SetScript("OnEnter", function() Visor2GUI:ShowTooltip(L["Nudge Up"]) end)
nudgeUp:SetScript("OnLeave", function() GameTooltip:Hide() end)
nudgeUp:SetScript("OnClick", function() Visor2GUI:NudgeUp() end)
 
local nudgeDown = CreateFrame("Button", nil, frame, "UIPanelButtonTemplate")
nudgeDown:SetWidth(20)
nudgeDown:SetHeight(20)
nudgeDown:SetPoint("BOTTOM", nudgeSlider, "TOP", 0, 20)
nudgeDown:SetText("v")
nudgeDown:SetScript("OnEnter", function() Visor2GUI:ShowTooltip(L["Nudge Down"]) end)
nudgeDown:SetScript("OnLeave", function() GameTooltip:Hide() end)
nudgeDown:SetScript("OnClick", function() Visor2GUI:NudgeDown() end)
 
-- edit width
local editW = CreateFrame("EditBox", "Visor2GUIEditW", frame, "InputBoxTemplate")
editW:SetWidth(40)
editW:SetHeight(20)
editW:SetPoint("TOP", -83, -110)
editW:SetAutoFocus(false)
editW:SetScript("OnEnter", function() Visor2GUI:ShowTooltip(L["Enter Width"]) end)
editW:SetScript("OnLeave", function() GameTooltip:Hide() end)
editW:SetScript("OnEnterPressed", function() Visor2GUI:EditWUpdate() end)
 
local editWLabel = editW:CreateFontString(nil, "ARTWORK", "GameFontNormal")
editWLabel:SetPoint("TOP", -20, 15)
editWLabel:SetText(L["Frame Width"])
 
local editWDown = CreateFrame("Button", nil, frame, "UIPanelButtonTemplate")
editWDown:SetWidth(20)
editWDown:SetHeight(20)
editWDown:SetPoint("RIGHT", editW, "LEFT", -34, 0)
editWDown:SetText("<")
editWDown:SetScript("OnEnter", function() Visor2GUI:ShowTooltip(L["Width Down"]) end)
editWDown:SetScript("OnLeave", function() GameTooltip:Hide() end)
editWDown:SetScript("OnClick", function() Visor2GUI:ButtonWDown() end)
 
local editWUp = CreateFrame("Button", nil, frame, "UIPanelButtonTemplate")
editWUp:SetWidth(20)
editWUp:SetHeight(20)
editWUp:SetPoint("RIGHT", editW, "LEFT", -10, 0)
editWUp:SetText(">")
editWUp:SetScript("OnEnter", function() Visor2GUI:ShowTooltip(L["Width Up"]) end)
editWUp:SetScript("OnLeave", function() GameTooltip:Hide() end)
editWUp:SetScript("OnClick", function() Visor2GUI:ButtonWUp() end)
 
-- edit height
local editH = CreateFrame("EditBox", "Visor2GUIEditH", frame, "InputBoxTemplate")
editH:SetWidth(40)
editH:SetHeight(20)
editH:SetPoint("TOP", editW, "BOTTOM", 0, -27)
editH:SetAutoFocus(false)
editH:SetScript("OnEnter", function() Visor2GUI:ShowTooltip(L["Enter Height"]) end)
editH:SetScript("OnLeave", function() GameTooltip:Hide() end)
editH:SetScript("OnEnterPressed", function() Visor2GUI:EditHUpdate() end)
 
local editHLabel = editH:CreateFontString(nil, "ARTWORK", "GameFontNormal")
editHLabel:SetPoint("TOP", -20, 15)
editHLabel:SetText(L["Frame Height"])
 
local editHDown = CreateFrame("Button", nil, frame, "UIPanelButtonTemplate")
editHDown:SetWidth(20)
editHDown:SetHeight(20)
editHDown:SetPoint("RIGHT", editH, "LEFT", -10, 0)
editHDown:SetText("v")
editHDown:SetScript("OnEnter", function() Visor2GUI:ShowTooltip(L["Height Down"]) end)
editHDown:SetScript("OnLeave", function() GameTooltip:Hide() end)
editHDown:SetScript("OnClick", function() Visor2GUI:ButtonHDown() end)
 
local editHUp = CreateFrame("Button", nil, frame, "UIPanelButtonTemplate")
editHUp:SetWidth(20)
editHUp:SetHeight(20)
editHUp:SetPoint("RIGHT", editH, "LEFT", -34, 0)
editHUp:SetText("^")
editHUp:SetScript("OnEnter", function() Visor2GUI:ShowTooltip(L["Height Up"]) end)
editHUp:SetScript("OnLeave", function() GameTooltip:Hide() end)
editHUp:SetScript("OnClick", function() Visor2GUI:ButtonHUp() end)
 
-- edit co-ordinates
local editX = CreateFrame("EditBox", "Visor2GUIEditX", frame, "InputBoxTemplate")
editX:SetWidth(40)
editX:SetHeight(20)
editX:SetPoint("BOTTOM", 120, 150)
editX:SetAutoFocus(false)
editX:SetScript("OnEnter", function() Visor2GUI:ShowTooltip(L["Enter X co-ordinate (center point of frame)"]) end)
editX:SetScript("OnLeave", function() GameTooltip:Hide() end)
editX:SetScript("OnEnterPressed", function() Visor2GUI:EditXUpdate() end)
 
local editXLabel = editX:CreateFontString(nil, "ARTWORK", "GameFontNormal")
editXLabel:SetPoint("RIGHT", editX, "LEFT", -10, 0)
editXLabel:SetText("X")
 
local editY = CreateFrame("EditBox", "Visor2GUIEditY", frame, "InputBoxTemplate")
editY:SetWidth(40)
editY:SetHeight(20)
editY:SetPoint("TOP", editX, "BOTTOM", 0, -14)
editY:SetAutoFocus(false)
editY:SetScript("OnEnter", function() Visor2GUI:ShowTooltip(L["Enter Y co-ordinate (center point of frame)"]) end)
editY:SetScript("OnLeave", function() GameTooltip:Hide() end)
editY:SetScript("OnEnterPressed", function() Visor2GUI:EditYUpdate() end)
 
local editYLabel = editY:CreateFontString(nil, "ARTWORK", "GameFontNormal")
editYLabel:SetPoint("RIGHT", editY, "LEFT", -10, 0)
editYLabel:SetText("Y")
 
-- other buttons
local grab = CreateFrame("Button", nil, frame, "GameMenuButtonTemplate")
grab:SetWidth(50)
grab:SetHeight(25)
grab:SetPoint("BOTTOM", 0, 15)
grab:SetText(L["Grab"])
grab:SetScript("OnEnter", function() Visor2GUI:ShowTooltip(L["Left-Click and hold the mouse button, move the mouse over a frame and release the button to select that frame"]) end)
grab:SetScript("OnLeave", function() GameTooltip:Hide() end)
grab:SetScript("OnMouseDown", function() target:SetText(L["Drag mouse and release on target frame"]) end)
grab:SetScript("OnMouseUp", function() Visor2:SetupFrame("gf=TRUE") end)
 
local done = CreateFrame("Button", nil, frame, "GameMenuButtonTemplate")
done:SetWidth(100)
done:SetHeight(25)
done:SetPoint("BOTTOM", 85, 15)
done:SetText(L["Done"])
done:SetScript("OnEnter", function() Visor2GUI:ShowTooltip(L["Exit Visor2 GUI"]) end)
done:SetScript("OnLeave", function() GameTooltip:Hide() end)
done:SetScript("OnClick", function() this:GetParent():Hide() end)
 
local del = CreateFrame("Button", "Visor2GUIDelete", frame, "GameMenuButtonTemplate")
del:SetWidth(100)
del:SetHeight(25)
del:SetPoint("BOTTOM", -85, 15)
del:SetText(L["Delete"])
del:Disable()
del:SetScript("OnEnter", function() Visor2GUI:ShowTooltip(L["Delete the selected frame's settings from Visor2"]) end)
del:SetScript("OnLeave", function() GameTooltip:Hide() end)
 
local hide = CreateFrame("Button", "Visor2GUIHide", frame, "GameMenuButtonTemplate")
hide:SetWidth(110)
hide:SetHeight(25)
hide:SetPoint("TOP", 0, -190)
hide:SetText(L["Hide Frame"])
hide:Disable()
hide:SetScript("OnEnter", function() Visor2GUI:ShowTooltip(L["Show/Hide the selected frame"]) end)
hide:SetScript("OnLeave", function() GameTooltip:Hide() end)
hide:SetScript("OnClick", function() Visor2GUI:HideUpdate() end)
 
local virtual = CreateFrame("Button", "Visor2GUIVirt", frame, "GameMenuButtonTemplate")
virtual:SetWidth(75)
virtual:SetHeight(25)
virtual:SetPoint("BOTTOM", 87, 50)
virtual:SetText(L["Virtual"])
virtual:Disable()
virtual:SetScript("OnEnter", function() Visor2GUI:ShowTooltip(L["Show a virtual copy of a hidden frame"]) end)
virtual:SetScript("OnLeave", function() GameTooltip:Hide() end)
virtual:SetScript("OnClick", function() Visor2GUI:ButtonVirt() end)
 
-- confirmation
local confirm = CreateFrame("Frame", "Visor2GUIConfirmFrame", UIParent)
tinsert(UISpecialFrames, "Visor2GUIConfirmFrame")
confirm:Hide()
confirm:SetWidth(450)
confirm:SetHeight(200)
confirm:SetPoint("CENTER", "UIParent", "CENTER")
confirm:SetToplevel(1)
confirm:SetBackdrop({
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
insets = { left = 5, right = 6, top = 5, bottom = 6 },
tile = true, tileSize = 32, edgeSize = 32,
})
 
del:SetScript("OnClick", function() confirm:Show() end)
 
local confirmText1 = confirm:CreateFontString(nil, "ARTWORK", "GameFontNormal")
confirmText1:SetPoint("TOP", 0, -50)
confirmText1:SetText(L["Are you sure you want to delete this frame's settings?"])
 
local confirmLabel = confirm:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
confirmLabel:SetPoint("TOP", confirmText1, "BOTTOM", 0, -25)
 
confirm:SetScript("OnShow", function() confirmLabel:SetText(Visor2GUI.f) end)
 
local confirmText2 = confirm:CreateFontString(nil, "ARTWORK", "GameFontNormal")
confirmText2:SetPoint("TOP", confirmLabel, "BOTTOM", 0, -30)
confirmText2:SetText(L["You will need to reload for any changes to take effect"])
 
local confirmDel = CreateFrame("Button", nil, confirm, "GameMenuButtonTemplate")
confirmDel:SetWidth(100)
confirmDel:SetHeight(22)
confirmDel:SetPoint("BOTTOMLEFT", 25, 15)
confirmDel:SetText(L["Delete"])
confirmDel:SetScript("OnClick", function() Visor2:DeleteFrame(Visor2GUI.f) confirm:Hide() end)
 
local confirmCancel = CreateFrame("Button", nil, confirm, "GameMenuButtonTemplate")
confirmCancel:SetWidth(100)
confirmCancel:SetHeight(22)
confirmCancel:SetPoint("BOTTOMRIGHT", -25, 15)
confirmCancel:SetText(L["Cancel"])
confirmCancel:SetScript("OnClick", function() confirm:Hide() end)
Property changes : Added: svn:keywords + Id Added: svn:eol-style + native
Visor2GUI.toc New file
0,0 → 1,17
## Interface: 20400
## Title: Visor2 GUI
## Notes: GUI framework for the "Visor2" frame-modification AddOn
## Author: Ethan Centaurai
## Version: 2.1.wowi:revision
## LoadManagers: AddonLoader
## X-LoadOn-Slash: /vzg, /Visor2GUI
## X-eMail: ethan.centaurai@live.co.uk
## X-Category: Frame Modification
## X-Credits: Tain, Rowne, Eraphine and Stylpe, the original authors of Visor and VisorGUI
## X-Donate: PayPal:ethan.centaurai@live.co.uk
## SavedVariables: Visor2GUIDB
## RequiredDeps: Visor2
Locale-enUS.lua
 
Core.lua
Frame.lua
Property changes : Added: svn:eol-style + native
Locale-enUS.lua New file
0,0 → 1,49
--[[ $Id:Locale-enUS.lua 46303 2007-08-11 21:56:03Z darkimakuni $ ]]
 
AceLibrary("AceLocale-2.2"):new("Visor2GUI"):RegisterTranslations("enUS", function() return {
["Visor2 GUI"] = true,
["Toggle GUI Frame"] = true,
 
["Grab"] = true,
["Grab Parent"] = true,
["Done"] = true,
["Cancel"] = true,
["Delete"] = true,
["None"] = true,
["Virtual"] = true,
 
["Are you sure you want to delete this frame's settings?"] = true,
["You will need to reload for any changes to take effect"] = true,
["Enter frame name or select frame with Grab button"] = true,
["Drag mouse and release on target frame"] = true,
 
["Nudge Left"] = true,
["Nudge Right"] = true,
["Nudge Up"] = true,
["Nudge Down"] = true,
["Nudge Amount: "] = true,
["Width Up"] = true,
["Width Down"] = true,
["Height Up"] = true,
["Height Down"] = true,
 
["Left-Click and hold the mouse button, move the mouse over a frame and release the button to select that frame"] = true,
["Set the active frame's parent frame as the active frame"] = true,
["Parent Frame: "] = true,
["Exit Visor2 GUI"] = true,
["Delete the selected frame's settings from Visor2"] = true,
["Show/Hide the selected frame"] = true,
["Hide Frame"] = true,
["Show Frame"] = true,
["Adjust frame size"] = true,
["Frame Scale: "] = true,
["Adjust frame transparency"] = true,
["Frame Alpha: "] = true,
["Enter Width"] = true,
["Frame Width"] = true,
["Enter Height"] = true,
["Frame Height"] = true,
["Enter X co-ordinate (center point of frame)"] = true,
["Enter Y co-ordinate (center point of frame)"] = true,
["Show a virtual copy of a hidden frame"] = true,
} end)
Property changes : Added: svn:keywords + Id Added: svn:eol-style + native
Core.lua New file
0,0 → 1,368
--[[ $Id$ ]]
 
Visor2GUI = Visor2:NewModule("GUI", "AceConsole-2.0", "AceDB-2.0")
Visor2GUI.date = ("$Date$"):match("%d%d%d%d%-%d%d%-%d%d")
 
Visor2GUI:RegisterDB("Visor2GUIDB")
Visor2GUI:RegisterDefaults('account', { nudgeAmount = 20 })
 
 
local L = AceLibrary("AceLocale-2.2"):new("Visor2GUI")
local function round(num, digits)
-- banker's rounding
local mantissa = 10^digits
local norm = num*mantissa
norm = norm + 0.5
local norm_f = math.floor(norm)
if norm == norm_f and (norm_f % 2) ~= 0 then
return (norm_f-1)/mantissa
end
return norm_f/mantissa
end
 
 
function Visor2GUI:OnEnable()
self:RegisterEvent("VISOR_UPDATE")
self:RegisterChatCommand({ "/vzg", "/Visor2GUI" }, {
type = 'group', args = {
toggle = {
type = 'execute', name = L["Toggle GUI Frame"], desc = L["Toggle GUI Frame"],
func = function()
if Visor2GUIFrame:IsShown() then Visor2GUIFrame:Hide()
else Visor2GUIFrame:Show() end
end,
},
},
})
 
Visor2:Do("n="..self.db.account.nudgeAmount)
Visor2GUINudge:SetValue(self.db.account.nudgeAmount)
end
 
 
function Visor2GUI:VISOR_UPDATE(p)
if not Visor2GUIFrame:IsShown() then return end
 
if p.f then
if self.virtual then
if p.f == "Visor2GUIVirtualFrame" or p.f == self.virtual then
self.f = self.virtual
end
else
self.f = p.f
end
 
self.parent = _G[self.f]:GetParent():GetName() or nil
 
if self.parent then Visor2GUIGrabParent:Enable()
else Visor2GUIGrabParent:Disable() end
 
Visor2GUITarget:SetText(L["Parent Frame: "].."|cffffffff"..(self.parent or L["None"]))
Visor2GUIEditBox:SetText(self.f)
 
local s = p.s or _G[self.f]:GetScale()
Visor2GUIScale:SetValue(s or 1)
 
local a = p.a or _G[self.f]:GetAlpha()
Visor2GUIAlpha:SetValue(a or 1)
 
local wh = p.wh or _G[self.f]:GetWidth()
wh = round(wh, 0)
Visor2GUIEditW:SetText(wh)
 
local ht = p.ht or _G[self.f]:GetHeight()
ht = round(ht, 0)
Visor2GUIEditH:SetText(ht)
 
local x, y = _G[self.f]:GetCenter()
x = p.x or round(x, 0)
y = p.y or round(y, 0)
 
Visor2GUIEditX:SetText(x)
Visor2GUIEditY:SetText(y)
 
if _G[p.f]:IsShown() then
Visor2GUIHide:SetText(L["Hide Frame"])
else
Visor2GUIHide:SetText(L["Show Frame"])
end
 
Visor2GUIHide:Enable()
Visor2GUIVirt:Enable()
Visor2GUIDelete:Enable()
else
Visor2GUIHide:Disable()
Visor2GUIVirt:Disable()
Visor2GUIDelete:Disable()
end
end
 
 
function Visor2GUI:ShowTooltip(txt)
GameTooltip_SetDefaultAnchor(GameTooltip, UIParent)
GameTooltip:SetText(txt)
GameTooltip:Show()
end
 
function Visor2GUI:Toggle()
if Visor2GUIFrame:IsShown() then
Visor2GUIFrame:Hide()
else
Visor2GUIFrame:Show()
end
end
 
 
function Visor2GUI:EditBoxUpdate()
if self.virtual then
Visor2GUIEditBox:SetText(self.virtual)
else
Visor2:SetupFrame("f="..this:GetText())
end
end
 
function Visor2GUI:EditWUpdate()
local n = Visor2GUIEditW:GetText()
 
if self.virtual then
Visor2:Do("f="..self.virtual.." wh="..n)
Visor2:Do("f=Visor2GUIVirtualFrame wh="..n)
else
Visor2:Do("wh="..n)
end
end
 
function Visor2GUI:ButtonWUp()
local n = Visor2GUIEditW:GetText() + 1
 
if self.virtual then
Visor2:Do("f="..self.virtual.." wh="..n)
Visor2:Do("f=Visor2GUIVirtualFrame wh="..n)
else
Visor2:Do("wh="..n)
end
end
 
function Visor2GUI:ButtonWDown()
local n = Visor2GUIEditW:GetText() - 1
 
if self.virtual then
Visor2:Do("f="..self.virtual.." wh="..n)
Visor2:Do("f=Visor2GUIVirtualFrame wh="..n)
else
Visor2:Do("wh="..n)
end
end
 
 
function Visor2GUI:EditHUpdate()
local n = Visor2GUIEditH:GetText()
 
if self.virtual then
Visor2:Do("f="..self.virtual.." ht="..n)
Visor2:Do("f=Visor2GUIVirtualFrame ht="..n)
else
Visor2:Do("ht="..n)
end
end
 
function Visor2GUI:ButtonHUp()
local n = Visor2GUIEditH:GetText() + 1
 
if self.virtual then
Visor2:Do("f="..self.virtual.." ht="..n)
Visor2:Do("f=Visor2GUIVirtualFrame ht="..n)
else
Visor2:Do("ht="..n)
end
end
 
function Visor2GUI:ButtonHDown()
local n = Visor2GUIEditH:GetText() - 1
 
if self.virtual then
Visor2:Do("f="..self.virtual.." ht="..n)
Visor2:Do("f=Visor2GUIVirtualFrame ht="..n)
else
Visor2:Do("ht="..n)
end
end
 
 
function Visor2GUI:ScaleUpdate()
local s = round(this:GetValue(), 2)
 
Visor2GUIScaleText:SetText(L["Frame Scale: "]..s)
 
if self.virtual then
Visor2:Do("f="..self.virtual.." s="..s)
Visor2:Do("f=Visor2GUIVirtualFrame s="..s)
else
Visor2:Do("s="..s)
end
end
 
function Visor2GUI:AlphaUpdate()
local a = round(this:GetValue(), 2)
 
Visor2GUIAlphaText:SetText(L["Frame Alpha: "]..a)
 
if self.virtual then
Visor2:Do("f="..self.virtual.." a="..a)
Visor2:Do("f=Visor2GUIVirtualFrame a="..a)
else
Visor2:Do("a="..a)
end
end
 
function Visor2GUI:HideUpdate()
if Visor2GUIHide:GetText() == L["Hide Frame"] then
Visor2:Do("h=TRUE")
Visor2GUIHide:SetText(L["Show Frame"])
else
Visor2:Do("h=FALSE")
Visor2GUIHide:SetText(L["Hide Frame"])
end
end
 
 
function Visor2GUI:EditXUpdate()
local x = Visor2GUIEditX:GetText()
 
if self.virtual then
Visor2:Do("f="..self.virtual.." x="..x)
Visor2:Do("f=Visor2GUIVirtualFrame x="..x)
else
Visor2:Do("x="..x)
end
 
Visor2GUIEditX:SetText(x)
end
 
function Visor2GUI:EditYUpdate()
local y = Visor2GUIEditY:GetText()
 
if self.virtual then
Visor2:Do("f="..self.virtual.." y="..y)
Visor2:Do("f=Visor2GUIVirtualFrame y="..y)
else
Visor2:Do("y="..y)
end
 
Visor2GUIEditY:SetText(y)
end
 
 
function Visor2GUI:NudgeUpdate()
local n = this:GetValue()
 
Visor2GUINudgeText:SetText(L["Nudge Amount: "]..n)
 
self.db.account.nudgeAmount = n
Visor2:Do("n="..n)
end
 
function Visor2GUI:NudgeLeft()
if self.virtual then
Visor2:Do("f="..self.virtual)
Visor2Nudge:Left()
 
Visor2:Do("f=Visor2GUIVirtualFrame")
Visor2Nudge:Left()
else
Visor2Nudge:Left()
end
end
 
function Visor2GUI:NudgeRight()
if self.virtual then
Visor2:Do("f="..self.virtual)
Visor2Nudge:Right()
 
Visor2:Do("f=Visor2GUIVirtualFrame")
Visor2Nudge:Right()
else
Visor2Nudge:Right()
end
end
 
function Visor2GUI:NudgeUp()
if self.virtual then
Visor2:Do("f="..self.virtual)
Visor2Nudge:Up()
 
Visor2:Do("f=Visor2GUIVirtualFrame")
Visor2Nudge:Up()
else
Visor2Nudge:Up()
end
end
 
function Visor2GUI:NudgeDown()
if self.virtual then
Visor2:Do("f="..self.virtual)
Visor2Nudge:Down()
 
Visor2:Do("f=Visor2GUIVirtualFrame")
Visor2Nudge:Down()
else
Visor2Nudge:Down()
end
end
 
 
function Visor2GUI:ButtonVirt()
local f = self.f
local vf = Visor2GUIVirtualFrame
 
if vf:IsShown() then
vf:Hide()
self.virtual = nil
return
end
 
if _G[f] then
self.virtual = _G[f]:GetName()
 
Visor2GUIVirtualFrameTitleString:SetText(f)
Visor2:Do("f=Visor2GUIVirtualFrame")
 
local h = _G[f]:GetHeight() or 200
local w = _G[f]:GetWidth() or 200
local s = _G[f]:GetScale() or 1
local x, y = _G[f]:GetCenter()
local p = _G[f]:GetParent()
 
if p then
p = _G[f]:GetParent():GetName()
else
p = "UIParent"
end
 
if not x then x = 500 end
if not y then y = 300 end
 
vf:SetParent(p)
 
if not vf.VisorSetScale then
vf:SetScale(s)
else
vf:VisorSetScale(s)
end
 
if not vf.VisorSetPoint then
vf:SetPoint("CENTER", p, "BOTTOMLEFT", x, y)
else
vf:VisorSetPoint("CENTER", p, "BOTTOMLEFT", x, y)
end
 
Visor2:Do("f=Visor2GUIVirtualFrame s="..s.." p1=CENTER p2=BOTTOMLEFT")
Visor2:Do("f=Visor2GUIVirtualFrame x="..x.." y="..y.." p="..p.." pr="..p)
 
if h and w then
Visor2:Do("f=Visor2GUIVirtualFrame".." ht="..h.." wh="..w)
end
 
vf:Show()
end
end
Property changes : Added: svn:eol-style + native Added: svn:keywords + Id Date