/
## Interface: 40000 |
## Interface: 30300 |
## Title: Chaos Frame Modifier |
## Author: ChaosInc |
## Version: wowi:revision |
else |
local f, fs |
f = CreateFrame("Frame", "CFM_Config", UIParent) |
f:SetWidth(385) |
f:SetHeight(154) |
f:SetWidth(300) |
f:SetHeight(338) |
f:SetPoint("CENTER") |
f:SetFrameStrata("DIALOG") |
f:SetBackdrop({ |
CFM_MouseOverActiveParent:SetText(parent:GetName()) |
end |
end) |
f:Show() |
tinsert(UISpecialFrames,f:GetName()) |
--[[ MOUSEOVER INFO ]] |
f = CreateFrame("FRAME", "CFM_MouseInfoFrame", CFM_Config) |
f:SetHeight(32) |
fs:SetText("") |
fs:SetPoint("LEFT", CFM_MouseOverParent, "RIGHT") |
local b = CreateFrame("Button", "CFM_SelectPanel1", CFM_Config, "OptionsButtonTemplate") |
b:SetNormalFontObject("GameFontNormalSmall") |
b:SetHighlightFontObject("GameFontWhiteSmall") |
b:SetText("Properties") |
b:SetPoint("TOPLEFT", CFM_Config, "TOP", -52,-4) |
b:SetHeight(18) |
b:SetWidth(70) |
b:SetScript("OnClick", function() |
CFM_Panel1:Show() |
CFM_Panel2:Hide() |
CFM_Panel3:Hide() |
end) |
local b = CreateFrame("Button", "CFM_SelectPanel2", CFM_Config, "OptionsButtonTemplate") |
b:SetNormalFontObject("GameFontNormalSmall") |
b:SetHighlightFontObject("GameFontWhiteSmall") |
b:SetText("Anchor") |
b:SetPoint("LEFT", CFM_SelectPanel1, "RIGHT", 0,0) |
b:SetHeight(18) |
b:SetWidth(50) |
b:SetScript("OnClick", function() |
CFM_Panel1:Hide() |
CFM_Panel2:Show() |
CFM_Panel3:Hide() |
end) |
local b = CreateFrame("Button", "CFM_SelectPanel3", CFM_Config, "OptionsButtonTemplate") |
b:SetNormalFontObject("GameFontNormalSmall") |
b:SetHighlightFontObject("GameFontWhiteSmall") |
b:SetText("Add Frame") |
b:SetPoint("LEFT", CFM_SelectPanel2, "RIGHT", 0,0) |
b:SetHeight(18) |
b:SetWidth(70) |
b:SetScript("OnClick", function() |
CFM_Panel1:Hide() |
CFM_Panel2:Hide() |
CFM_Panel3:Show() |
end) |
-- SHOW/HIDE/UNLOCK BUTTONS |
b = CreateFrame("Button", "CFM_UnlockButton", CFM_Config, "OptionsButtonTemplate") |
b:SetWidth(48) |
b:SetPoint("BOTTOMRIGHT", CFM_Config, "BOTTOMRIGHT", -4,4) |
b:RegisterForClicks("LeftButtonUp") |
b:SetNormalFontObject("GameFontNormalSmall") |
b:SetHighlightFontObject("GameFontWhiteSmall") |
b:SetText("Unlock") |
b:SetScript("OnClick", function(self) |
if selFrame == nil or selFrame == "" then |
print("Please select a frame first.") |
return |
end |
frame = _G[selFrame] |
if activeProfile[selFrame].lock then |
activeProfile[selFrame].lock = false |
frame:SetClampedToScreen(activeProfile[selFrame].clamp) |
print(selFrame.. " is unlocked.") |
self:SetText("Lock") |
-- color overlay |
frame.t = frame:CreateTexture() |
frame.t:SetAllPoints(frame) |
frame.t:SetTexture(0,1,0,.2) |
frame:SetMovable(true) |
frame:RegisterForDrag("LeftButton") |
frame:SetScript("OnDragStart", function() |
if frame:IsMovable() then |
frame.isMoving = true |
frame:StartMoving() |
else return end end) |
frame:SetScript("OnDragStop", function() CFM_StopMoving(frame,selFrame) end) |
else |
self:SetText("Unlock") |
frame:SetMovable(false) |
if frame.t ~= nil then frame.t:Hide() frame.t = nil end |
activeProfile[selFrame].lock = true |
print(selFrame.. " is locked.") |
end end) |
b = CreateFrame("Button", "CFM_HideButton", CFM_Config, "OptionsButtonTemplate") |
b:SetWidth(48) |
b:SetPoint("RIGHT", CFM_UnlockButton, "LEFT", 0,0) |
b:RegisterForClicks("LeftButtonUp") |
b:SetNormalFontObject("GameFontNormalSmall") |
b:SetHighlightFontObject("GameFontWhiteSmall") |
b:SetText("Hide") |
b:SetScript("OnClick", function() |
if selFrame == nil or selFrame == "" then |
print("Please select a frame first.") |
return |
end |
_G[selFrame]:Hide() end) |
b = CreateFrame("Button", "CFM_ShowButton", CFM_Config, "OptionsButtonTemplate") |
b:SetWidth(48) |
b:SetPoint("Right", CFM_HideButton, "LEFT", 0,0) |
b:RegisterForClicks("LeftButtonUp") |
b:SetNormalFontObject("GameFontNormalSmall") |
b:SetHighlightFontObject("GameFontWhiteSmall") |
b:SetText("Show") |
b:SetScript("OnClick", function() |
if selFrame == nil or selFrame == "" then |
print("Please select a frame first.") |
return |
end |
_G[selFrame]:Show() end) |
--[[ FORCE HIDE ]] |
fs = f:CreateFontString("CFM_HideText", CFM_Config) |
fs:SetFontObject("GameFontGreenSmall") |
fs:SetJustifyH("RIGHT") |
fs:SetWidth(70) |
fs:SetText("Force Hide") |
fs:SetPoint("BOTTOMLEFT", CFM_Config, "BOTTOM", -54,10) |
cb = CreateFrame("CHECKBUTTON", "CFM_ForceButton", CFM_Config, "OptionsCheckButtonTemplate") |
cb:SetPoint("LEFT", CFM_HideText, "RIGHT", 6, -2) |
cb:SetScale(.75) |
cb:SetScript("OnClick", function(self) |
if selFrame == nil or selFrame == "" then |
print("Please select a frame first.") |
return |
elseif self:GetChecked() == 1 then |
activeProfile[selFrame].forceHide = true |
activeProfile[selFrame].hidden = {} |
local point, parent, relativePoint, offsetX, offsetY = _G[selFrame]:GetPoint() |
activeProfile[selFrame].hidden.point = point |
activeProfile[selFrame].hidden.parent = parent |
activeProfile[selFrame].hidden.relativePoint = relativePoint |
activeProfile[selFrame].hidden.offsetX = offsetX |
activeProfile[selFrame].hidden.offsetY = offsetY |
else |
activeProfile[selFrame].forceHide = false |
_G[selFrame]:ClearAllPoints() |
_G[selFrame]:SetPoint(activeProfile[selFrame].hidden.point,activeProfile[selFrame].hidden.parent, activeProfile[selFrame].hidden.relativePoint, activeProfile[selFrame].hidden.offsetX, activeProfile[selFrame].hidden.offsetY) |
_G[selFrame]:Show() |
activeProfile[selFrame].hidden = nil |
end |
CFM_ApplySettings(selFrame) |
end) |
CFM_CreateScroll() |
CFM_CreatePanel1() |
CFM_CreatePanel2() |
CFM_CreatePanel3() |
CFM_CreateScroll() |
CFM_CreateAdder() |
CFM_CreateMover() |
CFM_CreateProps() |
end |
end |
local sf, b |
sf = CreateFrame("ScrollFrame", "CFM_ScrollFrame", CFM_Config, "FauxScrollFrameTemplate") |
sf:SetWidth(118) |
sf:SetHeight(144) |
sf:SetHeight(262) |
sf:SetPoint("TOPLEFT", CFM_Config, 5, -5) |
sf:SetBackdrop({ |
bgFile="", |
}) |
sf:SetBackdropBorderColor(0,.5,0,1) |
_G[sf:GetName().."ScrollBar"]:SetWidth(5) |
sf:SetScript("OnVerticalScroll", function(self, offset) FauxScrollFrame_OnVerticalScroll(sf, offset, 7, CFM_ScrollUpdate) end) |
sf:SetScript("OnVerticalScroll", function(self, offset) FauxScrollFrame_OnVerticalScroll(sf, offset, 20, CFM_ScrollUpdate) end) |
sf:SetScript("OnShow", CFM_ScrollUpdate) |
sf:SetScript("OnHide", function() |
for k,_ in pairs(activeProfile) do |
function CFM_CreateButtons() |
-- Create scroll buttons |
for i = 1,8 do |
for i = 1,15 do |
local b |
if i == 1 then |
b = CreateFrame("Button", "CFM_ScrollButton"..i, CFM_ScrollFrame) |
b:SetPoint("TOPLEFT",2,-4) |
b:SetPoint("TOPLEFT",2,0) |
b:SetText("Button 1") |
else |
b = CreateFrame("Button", "CFM_ScrollButton"..i, _G["CFM_ScrollButton"..(i-1)]) |
b:SetScript("OnClick", function(self, click) |
if self:GetText() == nil then return end -- button has no data |
if click == "LeftButton" then |
-- reset previously highlighted buttons |
if curButton then |
_G[curButton]:SetBackdropColor(0,0,0,0) |
end |
function CFM_ScrollUpdate() |
CFM_CreateList() |
local line, lineplusoffset |
FauxScrollFrame_Update(CFM_ScrollFrame,#CFM_FrameList,8,20, nil,nil,nil,nil,nil,nil,true) |
FauxScrollFrame_Update(CFM_ScrollFrame,#CFM_FrameList,11,20, nil,nil,nil,nil,nil,nil,true) |
-- 50 is max entries, 10 is number of lines, 20 is pixel height of each line |
for line = 1, 8 do |
for line = 1, 15 do |
lineplusoffset = line + FauxScrollFrame_GetOffset(CFM_ScrollFrame) |
if lineplusoffset < 50 then |
_G["CFM_ScrollButton"..line]:SetText(CFM_FrameList[lineplusoffset]) |
table.sort(CFM_FrameList) -- sort alphabetically |
end |
function CFM_CreatePanel1() |
local f = CreateFrame("Frame", "CFM_Panel1", CFM_Config) |
f:SetWidth(240) |
f:SetHeight(108) |
f:SetPoint("TOPRIGHT", -4, -22) |
f:SetFrameStrata("DIALOG") |
function CFM_SelectFrame(frame) |
selFrame = frame |
gframe = _G[frame] |
if frame == "WorldFrame" then CFM_StrataBoxButton:Disable() print("|c00FF00FFCFM:|r Strata changes to WorldFrame are disabled for user safety.") else CFM_StrataBoxButton:Enable() end |
-- add frame.lock to frame's settings |
if activeProfile[frame].lock == nil then activeProfile[frame].lock = true end |
-- add frame.clamp to frame's settings |
if activeProfile[frame].clamp == nil then activeProfile[frame].clamp = gframe:IsClampedToScreen() end |
-- set check boxes |
if activeProfile[frame].forceHide then |
CFM_HideButton:SetChecked() |
else |
CFM_HideButton:SetChecked(false) |
end |
if activeProfile[frame].sameXY then |
CFM_ConstrainButton:SetChecked() |
else |
CFM_ConstrainButton:SetChecked(false) |
end |
if activeProfile[frame].clamp then |
CFM_ClampButton:SetChecked() |
else |
CFM_ClampButton:SetChecked(false) |
end |
-- fill in rest of frame's info |
CFM_WidthBox:SetText(activeProfile[frame].width) |
CFM_HeightBox:SetText(activeProfile[frame].height) |
CFM_ScaleBox:SetText(activeProfile[frame].scale) |
CFM_LevelBox:SetText(activeProfile[frame].level) |
CFM_AlphaBox:SetText(activeProfile[frame].alpha) |
CFM_ChangeParentBox:SetText(activeProfile[frame].parent) |
CFM_XBox:SetText(activeProfile[frame].offsetX) |
CFM_YBox:SetText(activeProfile[frame].offsetY) |
if activeProfile[selFrame].lock then |
CFM_UnlockButton:SetText("Unlock") |
gframe:SetMovable(false) |
else |
CFM_UnlockButton:SetText("Lock") |
gframe:SetMovable(true) |
gframe:RegisterForDrag("LeftButton") |
gframe:SetScript("OnDragStart", function() |
if gframe:IsMovable() then |
gframe.isMoving = true |
gframe:StartMoving() |
else return end end) |
gframe:SetScript("OnDragStop", function() CFM_StopMoving(gframe,selFrame) end) |
end |
local point = activeProfile[frame].point |
if point == "CENTER" then |
UIDropDownMenu_SetSelectedValue(CFM_FromBox, 0) |
elseif point == "TOP" then |
UIDropDownMenu_SetSelectedValue(CFM_FromBox, 1) |
elseif point == "TOPRIGHT" then |
UIDropDownMenu_SetSelectedValue(CFM_FromBox, 2) |
elseif point == "RIGHT" then |
UIDropDownMenu_SetSelectedValue(CFM_FromBox, 3) |
elseif point == "BOTTOMRIGHT" then |
UIDropDownMenu_SetSelectedValue(CFM_FromBox, 4) |
elseif point == "BOTTOM" then |
UIDropDownMenu_SetSelectedValue(CFM_FromBox, 5) |
elseif point == "BOTTOMLEFT" then |
UIDropDownMenu_SetSelectedValue(CFM_FromBox, 6) |
elseif point == "LEFT" then |
UIDropDownMenu_SetSelectedValue(CFM_FromBox, 7) |
elseif point == "TOPLEFT" then |
UIDropDownMenu_SetSelectedValue(CFM_FromBox, 8) |
end |
UIDropDownMenu_SetText(CFM_FromBox, point) |
local point = activeProfile[frame].relativePoint |
if point == "CENTER" then |
UIDropDownMenu_SetSelectedValue(CFM_ToBox, 0) |
elseif point == "TOP" then |
UIDropDownMenu_SetSelectedValue(CFM_ToBox, 1) |
elseif point == "TOPRIGHT" then |
UIDropDownMenu_SetSelectedValue(CFM_ToBox, 2) |
elseif point == "RIGHT" then |
UIDropDownMenu_SetSelectedValue(CFM_ToBox, 3) |
elseif point == "BOTTOMRIGHT" then |
UIDropDownMenu_SetSelectedValue(CFM_ToBox, 4) |
elseif point == "BOTTOM" then |
UIDropDownMenu_SetSelectedValue(CFM_ToBox, 5) |
elseif point == "BOTTOMLEFT" then |
UIDropDownMenu_SetSelectedValue(CFM_ToBox, 6) |
elseif point == "LEFT" then |
UIDropDownMenu_SetSelectedValue(CFM_ToBox, 7) |
elseif point == "TOPLEFT" then |
UIDropDownMenu_SetSelectedValue(CFM_ToBox, 8) |
end |
UIDropDownMenu_SetText(CFM_ToBox, point) |
local strata = activeProfile[frame].strata |
if strata == "BACKGROUND" then |
UIDropDownMenu_SetSelectedValue(CFM_StrataBox, 0) |
elseif strata == "LOW" then |
UIDropDownMenu_SetSelectedValue(CFM_StrataBox, 1) |
elseif strata == "MEDIUM" then |
UIDropDownMenu_SetSelectedValue(CFM_StrataBox, 2) |
elseif strata == "HIGH" then |
UIDropDownMenu_SetSelectedValue(CFM_StrataBox, 3) |
elseif strata == "DIALOG" then |
UIDropDownMenu_SetSelectedValue(CFM_StrataBox, 4) |
elseif strata == "TOOLTIP" then |
UIDropDownMenu_SetSelectedValue(CFM_StrataBox, 5) |
end |
UIDropDownMenu_SetText(CFM_StrataBox, strata) |
end |
----------------------- |
-- PROPERTIES FRAME -- |
----------------------- |
function CFM_CreateProps() |
local f, fs, e, cb, dm, b |
f = CreateFrame("Frame", "CFM_PropFrame", CFM_Config) |
f:SetWidth(155) |
f:SetHeight(262) |
f:SetPoint("TOPRIGHT", -5, -5) |
-- Create background |
f:SetBackdrop({ |
bgFile = "Interface\\CHATFRAME\\CHATFRAMEBACKGROUND", |
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", |
}) |
f:SetBackdropColor(.25,.1,.25) |
f:SetBackdropBorderColor(0,.5,0) |
f:SetMovable() |
f:SetClampedToScreen() |
f:RegisterForDrag("LeftButton") |
f:SetScript("OnDragStart", f.StartMoving) |
--[[ FORCE HIDE ]] |
fs = f:CreateFontString("CFM_HideText") |
fs:SetFontObject("GameFontGreenSmall") |
fs:SetJustifyH("RIGHT") |
fs:SetWidth(90) |
fs:SetText("Force Hide?") |
fs:SetPoint("TOPLEFT", CFM_PropFrame, "TOPLEFT", 10,-10) |
cb = CreateFrame("CHECKBUTTON", "CFM_HideButton", CFM_Config, "OptionsCheckButtonTemplate") |
cb:SetPoint("LEFT", CFM_HideText, "RIGHT", 10, 0) |
cb:SetScale(.75) |
cb:SetScript("OnClick", function() |
if selFrame == nil or selFrame == "" then |
print("Please select a frame first.") |
return |
elseif self:GetChecked() == 1 then |
activeProfile[selFrame].forceHide = true |
activeProfile[selFrame].hidden = {} |
local point, parent, relativePoint, offsetX, offsetY = _G[selFrame]:GetPoint() |
activeProfile[selFrame].hidden.point = point |
activeProfile[selFrame].hidden.parent = parent |
activeProfile[selFrame].hidden.relativePoint = relativePoint |
activeProfile[selFrame].hidden.offsetX = offsetX |
activeProfile[selFrame].hidden.offsetY = offsetY |
else |
activeProfile[selFrame].forceHide = false |
_G[selFrame]:ClearAllPoints() |
_G[selFrame]:SetPoint(activeProfile[selFrame].hidden.point,activeProfile[selFrame].hidden.parent, activeProfile[selFrame].hidden.relativePoint, activeProfile[selFrame].hidden.offsetX, activeProfile[selFrame].hidden.offsetY) |
_G[selFrame]:Show() |
activeProfile[selFrame].hidden = nil |
end |
CFM_ApplySettings(selFrame) |
end) |
--[[ CONSTRAIN X/Y ]] |
fs = f:CreateFontString("CFM_ConstrainText") |
fs:SetFontObject("GameFontGreenSmall") |
fs:SetJustifyH("CENTER") |
fs:SetWidth(90) |
fs:SetText("Width = Height?") |
fs:SetPoint("TOPLEFT", CFM_HideText, "BOTTOMLEFT", 0, -4) |
cb = CreateFrame("CHECKBUTTON", "CFM_ConstrainButton", CFM_Config, "OptionsCheckButtonTemplate") |
cb:SetPoint("LEFT", CFM_ConstrainText, "RIGHT", 10, 0) |
cb:SetScale(.75) |
cb:SetScript("OnClick", function(self) |
if selFrame == nil or selFrame == "" then |
print("Please select a frame first.") |
return |
elseif self:GetChecked() == 1 then |
activeProfile[selFrame].sameXY = true |
else |
activeProfile[selFrame].sameXY = false |
end |
end) |
--[[ SCREEN CLAMP ]] |
fs = f:CreateFontString("CFM_ClampText") |
fs:SetFontObject("GameFontGreenSmall") |
fs:SetJustifyH("CENTER") |
fs:SetWidth(90) |
fs:SetText("Screen clamp?") |
fs:SetPoint("TOPLEFT", CFM_ConstrainText, "BOTTOMLEFT", 0, -4) |
cb = CreateFrame("CHECKBUTTON", "CFM_ClampButton", CFM_Config, "OptionsCheckButtonTemplate") |
cb:SetPoint("LEFT", CFM_ClampText, "RIGHT", 10, 0) |
cb:SetScale(.75) |
cb:SetScript("OnClick", function(self) |
if selFrame == nil or selFrame == "" then |
print("Please select a frame first.") |
return |
elseif self:GetChecked() == 1 then |
activeProfile[selFrame].clamp = true |
_G[selFrame]:SetClampedToScreen(true) |
else |
activeProfile[selFrame].clamp = false |
_G[selFrame]:SetClampedToScreen(false) |
end |
end) |
--[[ WIDTH DATA ]] |
fs = f:CreateFontString("CFM_WidthText", CFM_Panel1) |
fs = f:CreateFontString("CFM_WidthText") |
fs:SetFontObject("GameFontGreenSmall") |
fs:SetJustifyH("RIGHT") |
fs:SetWidth(40) |
fs:SetText("Width") |
fs:SetPoint("TOPLEFT", CFM_Panel1, "TOPLEFT", 18,-6) |
fs:SetPoint("TOPLEFT", CFM_PropFrame, "TOPLEFT", 20,-52) |
e = CreateFrame("EditBox", "CFM_WidthBox", CFM_Panel1) |
e = CreateFrame("EditBox", "CFM_WidthBox", CFM_PropFrame) |
e:SetWidth(40) |
e:SetHeight(18) |
e:SetPoint("TOP", CFM_WidthText, "Bottom", 5,-2) |
end) |
e:SetScript("OnEscapePressed", e.ClearFocus) |
local b = CreateFrame("Button", "CFM_Width_Plus", CFM_Panel1) |
local b = CreateFrame("Button", "CFM_Width_Plus", CFM_PropFrame) |
b:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Up") |
b:SetHighlightTexture("Interface\\BUTTONS\\UI-PlusButton-Hilight") |
b:SetPushedTexture("Interface\\BUTTONS\\UI-PlusButton-Down") |
end) |
b:SetPoint("TOPLEFT", CFM_WidthBox, "TOPRIGHT", 0,-2) |
local b = CreateFrame("Button", "CFM_Width_Minus", CFM_Panel1) |
local b = CreateFrame("Button", "CFM_Width_Minus", CFM_PropFrame) |
b:SetNormalTexture("Interface\\BUTTONS\\UI-MinusButton-Up") |
b:SetHighlightTexture("Interface\\BUTTONS\\UI-PlusButton-Hilight") |
b:SetPushedTexture("Interface\\BUTTONS\\UI-MinusButton-Down") |
--[[ HEIGHT DATA ]] |
fs = f:CreateFontString("CFM_HeightText", CFM_Panel1) |
fs = f:CreateFontString("CFM_HeightText") |
fs:SetFontObject("GameFontGreenSmall") |
fs:SetJustifyH("CENTER") |
fs:SetWidth(40) |
fs:SetText("Height") |
fs:SetPoint("LEFT", CFM_WidthText, "RIGHT", 40,0) |
fs:SetPoint("TOP", CFM_WidthBox, "BOTTOM", -2,0) |
e = CreateFrame("EditBox", "CFM_HeightBox", CFM_Panel1) |
e = CreateFrame("EditBox", "CFM_HeightBox", CFM_PropFrame) |
e:SetWidth(40) |
e:SetHeight(18) |
e:SetPoint("TOP", CFM_HeightText, "BOTTOM", 2,-2) |
end) |
e:SetScript("OnEscapePressed", e.ClearFocus) |
local b = CreateFrame("Button", "CFM_Height_Plus", CFM_Panel1) |
local b = CreateFrame("Button", "CFM_Height_Plus", CFM_PropFrame) |
b:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Up") |
b:SetHighlightTexture("Interface\\BUTTONS\\UI-PlusButton-Hilight") |
b:SetPushedTexture("Interface\\BUTTONS\\UI-PlusButton-Down") |
end) |
b:SetPoint("TOPLEFT", CFM_HeightBox, "TOPRIGHT", 0,-2) |
local b = CreateFrame("Button", "CFM_Height_Minus", CFM_Panel1) |
local b = CreateFrame("Button", "CFM_Height_Minus", CFM_PropFrame) |
b:SetNormalTexture("Interface\\BUTTONS\\UI-MinusButton-Up") |
b:SetHighlightTexture("Interface\\BUTTONS\\UI-PlusButton-Hilight") |
b:SetPushedTexture("Interface\\BUTTONS\\UI-MinusButton-Down") |
fs:SetJustifyH("CENTER") |
fs:SetWidth(40) |
fs:SetText("Scale") |
fs:SetPoint("TOP", CFM_WidthBox, "BOTTOM", 0,-6) |
fs:SetPoint("LEFT", CFM_WidthText, "RIGHT", 40,0) |
e = CreateFrame("EditBox", "CFM_ScaleBox", CFM_Panel1) |
e:SetWidth(40) |
e = CreateFrame("EditBox", "CFM_ScaleBox", CFM_PropFrame) |
e:SetWidth(30) |
e:SetHeight(18) |
e:SetPoint("TOP", CFM_ScaleText, "BOTTOM", 0,-2) |
e:SetBackdrop({ |
end) |
e:SetScript("OnEscapePressed", e.ClearFocus) |
local b = CreateFrame("Button", "CFM_Scale_Plus", CFM_Panel1) |
local b = CreateFrame("Button", "CFM_Scale_Plus", CFM_PropFrame) |
b:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Up") |
b:SetHighlightTexture("Interface\\BUTTONS\\UI-PlusButton-Hilight") |
b:SetPushedTexture("Interface\\BUTTONS\\UI-PlusButton-Down") |
end) |
b:SetPoint("TOPLEFT", CFM_ScaleBox, "TOPRIGHT", 0,-2) |
local b = CreateFrame("Button", "CFM_Scale_Minus", CFM_Panel1) |
local b = CreateFrame("Button", "CFM_Scale_Minus", CFM_PropFrame) |
b:SetNormalTexture("Interface\\BUTTONS\\UI-MinusButton-Up") |
b:SetHighlightTexture("Interface\\BUTTONS\\UI-PlusButton-Hilight") |
b:SetPushedTexture("Interface\\BUTTONS\\UI-MinusButton-Down") |
fs:SetWidth(40) |
fs:SetJustifyH("CENTER") |
fs:SetText("Level") |
fs:SetPoint("TOP", CFM_HeightBox, "BOTTOM", 0,-6) |
fs:SetPoint("TOP", CFM_ScaleBox, "BOTTOM", 0,-2) |
e = CreateFrame("EditBox", "CFM_LevelBox", CFM_Panel1) |
e:SetWidth(40) |
e = CreateFrame("EditBox", "CFM_LevelBox", CFM_PropFrame) |
e:SetWidth(30) |
e:SetHeight(18) |
e:SetPoint("TOP", CFM_LevelText, "BOTTOM", 0,-2) |
e:SetPoint("TOP", CFM_LevelText, "BOTTOM", 0,0) |
e:SetBackdrop({ |
bgFile="", |
edgeFile="Interface\\Tooltips\\UI-Tooltip-Border", |
end) |
e:SetScript("OnEscapePressed", e.ClearFocus) |
local b = CreateFrame("Button", "CFM_Level_Plus", CFM_Panel1) |
local b = CreateFrame("Button", "CFM_Level_Plus", CFM_PropFrame) |
b:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Up") |
b:SetHighlightTexture("Interface\\BUTTONS\\UI-PlusButton-Hilight") |
b:SetPushedTexture("Interface\\BUTTONS\\UI-PlusButton-Down") |
end) |
b:SetPoint("TOPLEFT", CFM_LevelBox, "TOPRIGHT", 0,-2) |
local b = CreateFrame("Button", "CFM_Level_Minus", CFM_Panel1) |
local b = CreateFrame("Button", "CFM_Level_Minus", CFM_PropFrame) |
b:SetNormalTexture("Interface\\BUTTONS\\UI-MinusButton-Up") |
b:SetHighlightTexture("Interface\\BUTTONS\\UI-PlusButton-Hilight") |
b:SetPushedTexture("Interface\\BUTTONS\\UI-MinusButton-Down") |
fs:SetJustifyH("CENTER") |
fs:SetWidth(40) |
fs:SetText("Alpha") |
fs:SetPoint("LEFT", CFM_LevelText, "RIGHT", 40,0) |
fs:SetPoint("TOP", CFM_LevelBox, "BOTTOM", 0,-2) |
e = CreateFrame("EditBox", "CFM_AlphaBox", CFM_Panel1) |
e:SetWidth(40) |
e = CreateFrame("EditBox", "CFM_AlphaBox", CFM_PropFrame) |
e:SetWidth(30) |
e:SetHeight(18) |
e:SetPoint("TOP", CFM_AlphaText, "BOTTOM", 0,-2) |
e:SetBackdrop({ |
end) |
e:SetScript("OnEscapePressed", e.ClearFocus) |
local b = CreateFrame("Button", "CFM_Alpha_Plus", CFM_Panel1) |
local b = CreateFrame("Button", "CFM_Alpha_Plus", CFM_PropFrame) |
b:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Up") |
b:SetHighlightTexture("Interface\\BUTTONS\\UI-PlusButton-Hilight") |
b:SetPushedTexture("Interface\\BUTTONS\\UI-PlusButton-Down") |
end end) |
b:SetPoint("TOPLEFT", CFM_AlphaBox, "TOPRIGHT", 0,-2) |
local b = CreateFrame("Button", "CFM_Alpha_Minus", CFM_Panel1) |
local b = CreateFrame("Button", "CFM_Alpha_Minus", CFM_PropFrame) |
b:SetNormalTexture("Interface\\BUTTONS\\UI-MinusButton-Up") |
b:SetHighlightTexture("Interface\\BUTTONS\\UI-PlusButton-Hilight") |
b:SetPushedTexture("Interface\\BUTTONS\\UI-MinusButton-Down") |
end end) |
b:SetPoint("TOPRIGHT", CFM_AlphaBox, "TOPLEFT", 0,-2) |
--[[ CONSTRAIN X/Y ]] |
fs = f:CreateFontString("CFM_ConstrainText") |
fs:SetFontObject("GameFontGreenSmall") |
fs:SetJustifyH("RIGHT") |
fs:SetWidth(54) |
fs:SetText("Constrain") |
fs:SetPoint("LEFT", CFM_HeightText, "RIGHT", 24, 0) |
local cb = CreateFrame("CHECKBUTTON", "CFM_ConstrainButton", CFM_Panel1, "OptionsCheckButtonTemplate") |
cb:SetPoint("LEFT", CFM_ConstrainText, "RIGHT", 0, -2) |
cb:SetScale(.75) |
cb:SetScript("OnClick", function(self) |
if selFrame == nil or selFrame == "" then |
print("Please select a frame first.") |
return |
elseif self:GetChecked() == 1 then |
activeProfile[selFrame].sameXY = true |
else |
activeProfile[selFrame].sameXY = false |
end |
end) |
--[[ SCREEN CLAMP ]] |
fs = f:CreateFontString("CFM_ClampText") |
fs:SetFontObject("GameFontGreenSmall") |
fs:SetJustifyH("RIGHT") |
fs:SetWidth(54) |
fs:SetText("S. Clamp") |
fs:SetPoint("TOPRIGHT", CFM_ConstrainText, "BOTTOMRIGHT", 0, -6) |
cb = CreateFrame("CHECKBUTTON", "CFM_ClampButton", CFM_Panel1, "OptionsCheckButtonTemplate") |
cb:SetPoint("LEFT", CFM_ClampText, "RIGHT", 0, 0) |
cb:SetScale(.75) |
cb:SetScript("OnClick", function(self) |
if selFrame == nil or selFrame == "" then |
print("Please select a frame first.") |
return |
elseif self:GetChecked() == 1 then |
activeProfile[selFrame].clamp = true |
_G[selFrame]:SetClampedToScreen(true) |
else |
activeProfile[selFrame].clamp = false |
_G[selFrame]:SetClampedToScreen(false) |
end |
end) |
end |
function CFM_CreatePanel2() |
local f, fs, e |
f = CreateFrame("Frame", "CFM_Panel2", CFM_Config) |
f:SetWidth(240) |
f:SetHeight(108) |
f:SetPoint("TOPRIGHT", -4, -22) |
f:SetFrameStrata("DIALOG") |
f:SetBackdrop({ |
bgFile = "Interface\\CHATFRAME\\CHATFRAMEBACKGROUND", |
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", |
tile = "true", |
tileSize = 32, |
edgeSize = 10, |
insets = {left = 3, right = 3, top = 3, bottom = 3} |
}) |
f:SetBackdropColor(.25,.1,.25) |
f:SetBackdropBorderColor(0,.5,0) |
f:Hide() |
--[[ PARENT DATA ]]-- |
fs = f:CreateFontString("CFM_ChangeParentText") |
fs:SetFontObject("GameFontGreenSmall") |
fs:SetJustifyH("RIGHT") |
fs:SetText("Parent:") |
fs:SetPoint("TOPLEFT", f, "TOPLEFT", 6,-10) |
e = CreateFrame("EditBox", "CFM_ChangeParentBox", CFM_Panel2) |
e:SetWidth(96) |
fs:SetPoint("BOTTOMLEFT", CFM_PropFrame, "BOTTOMLEFT", 5,30) |
e = CreateFrame("EditBox", "CFM_ChangeParentBox", CFM_PropFrame) |
e:SetWidth(106) |
e:SetHeight(18) |
e:SetPoint("LEFT", CFM_ChangeParentText, "RIGHT", 2,0) |
e:SetBackdrop({ |
CFM_ApplySettings(selFrame) |
self:ClearFocus() end) |
e:SetScript("OnEscapePressed", e.ClearFocus) |
--[[ POINT DATA ]] |
fs = f:CreateFontString("CFM_FromText") |
--[[ STRATA DATA ]] |
fs = f:CreateFontString("CFM_StrataText") |
fs:SetFontObject("GameFontGreenSmall") |
fs:SetJustifyH("RIGHT") |
fs:SetText("From:") |
fs:SetPoint("TOPRIGHT", CFM_ChangeParentText, "BOTTOMRIGHT", 0,-14) |
fs:SetText("Strata:") |
fs:SetPoint("BOTTOMLEFT", CFM_ChangeParentText, "TOPLEFT", 5,12) |
dm = CreateFrame("Frame", "CFM_FromBox", f, "UIDropDownMenuTemplate") |
dm:SetPoint("LEFT", CFM_FromText, "RIGHT", -10, -2) |
dm = CreateFrame("Frame", "CFM_StrataBox", f, "UIDropDownMenuTemplate") |
dm:SetPoint("LEFT", CFM_StrataText, "RIGHT", -10, -2) |
dm:SetScale(.75) |
UIDropDownMenu_SetWidth(dm,105) |
UIDropDownMenu_Initialize(dm, CFM_FromDropInit) |
UIDropDownMenu_Initialize(dm, CFM_StrataDropInit) |
--[[ RELATIVEPOINT DATA ]] |
--[[ RELATIVEPOINT DATA ]] |
fs = f:CreateFontString("CFM_ToText") |
fs:SetFontObject("GameFontGreenSmall") |
fs:SetJustifyH("RIGHT") |
fs:SetText("To:") |
fs:SetPoint("TOPRIGHT", CFM_FromText, "BOTTOMRIGHT", 0,-10) |
fs:SetPoint("BOTTOMRIGHT", CFM_StrataText, "TOPRIGHT", 0,12) |
dm = CreateFrame("Frame", "CFM_ToBox", f, "UIDropDownMenuTemplate") |
dm:SetPoint("LEFT", CFM_ToText, "RIGHT", -10, -2) |
UIDropDownMenu_SetWidth(dm,105) |
UIDropDownMenu_Initialize(dm, CFM_ToDropInit) |
--[[ STRATA DATA ]] |
fs = f:CreateFontString("CFM_StrataText") |
--[[ POINT DATA ]] |
fs = f:CreateFontString("CFM_FromText") |
fs:SetFontObject("GameFontGreenSmall") |
fs:SetJustifyH("RIGHT") |
fs:SetText("Strata:") |
fs:SetPoint("TOPRIGHT", CFM_ToText, "BOTTOMRIGHT", 0,-10) |
fs:SetText("From:") |
fs:SetPoint("BOTTOMRIGHT", CFM_ToText, "TOPRIGHT", 0,12) |
dm = CreateFrame("Frame", "CFM_StrataBox", f, "UIDropDownMenuTemplate") |
dm:SetPoint("LEFT", CFM_StrataText, "RIGHT", -10, -2) |
dm = CreateFrame("Frame", "CFM_FromBox", f, "UIDropDownMenuTemplate") |
dm:SetPoint("LEFT", CFM_FromText, "RIGHT", -10, -2) |
dm:SetScale(.75) |
UIDropDownMenu_SetWidth(dm,105) |
UIDropDownMenu_Initialize(dm, CFM_StrataDropInit) |
-- X/Y MOVER |
local e = CreateFrame("EditBox", "CFM_XBox", CFM_Panel2) |
e:SetWidth(45) |
e:SetHeight(18) |
e:SetPoint("RIGHT", CFM_Panel2, "RIGHT", -20,0) |
e:SetBackdrop({ |
bgFile="", |
edgeFile="Interface\\Tooltips\\UI-Tooltip-Border", |
tile="true", |
tileSize= 32, |
edgeSize=10, |
insets = {left=5, right=5, top=5, bottom=5} |
}) |
e:SetAutoFocus(false) |
e:SetTextInsets(5,0,0,0) |
e:SetFontObject("GameFontNormalSmall") |
e:SetMaxLetters(4) |
e:SetText("") |
e:SetScript("OnEnterPressed", function() |
if selFrame == nil or selFrame == "" then |
print("Please select a frame first.") |
return |
UIDropDownMenu_Initialize(dm, CFM_FromDropInit) |
b = CreateFrame("Button", "CFM_ShowButton", CFM_PropFrame, "OptionsButtonTemplate") |
b:SetWidth(48) |
b:SetPoint("BOTTOMLEFT", CFM_PropFrame, "BOTTOMLEFT", 4,4) |
b:RegisterForClicks("LeftButtonUp") |
b:SetNormalFontObject("GameFontNormalSmall") |
b:SetHighlightFontObject("GameFontWhiteSmall") |
b:SetText("Show") |
b:SetScript("OnClick", function() |
if selFrame == nil or selFrame == "" then |
print("Please select a frame first.") |
return |
end |
activeProfile[selFrame].offsetX = tonumber(e:GetText()) |
CFM_ApplySettings(selFrame) |
e:ClearFocus() end) |
e:SetScript("OnEscapePressed", e.ClearFocus) |
local e = CreateFrame("EditBox", "CFM_YBox", CFM_Panel2) |
e:SetWidth(45) |
e:SetHeight(18) |
e:SetPoint("TOPRIGHT", CFM_XBox, "BOTTOMRIGHT", 0,0) |
e:SetBackdrop({ |
bgFile="", |
edgeFile="Interface\\Tooltips\\UI-Tooltip-Border", |
tile="true", |
tileSize= 32, |
edgeSize=10, |
insets = {left=5, right=5, top=5, bottom=5} |
}) |
e:SetAutoFocus(false) |
e:SetTextInsets(5,0,0,0) |
e:SetFontObject("GameFontNormalSmall") |
e:SetMaxLetters(4) |
e:SetText("") |
e:SetScript("OnEnterPressed", function() |
_G[selFrame]:Show() end) |
b = CreateFrame("Button", "CFM_HideButton", CFM_PropFrame, "OptionsButtonTemplate") |
b:SetWidth(48) |
b:SetPoint("BOTTOM", CFM_PropFrame, "BOTTOM", 0,4) |
b:RegisterForClicks("LeftButtonUp") |
b:SetNormalFontObject("GameFontNormalSmall") |
b:SetHighlightFontObject("GameFontWhiteSmall") |
b:SetText("Hide") |
b:SetScript("OnClick", function() |
if selFrame == nil or selFrame == "" then |
print("Please select a frame first.") |
return |
end |
activeProfile[selFrame].offsetY = tonumber(e:GetText()) |
CFM_ApplySettings(selFrame) |
e:ClearFocus() end) |
e:SetScript("OnEscapePressed", e.ClearFocus) |
local fs = f:CreateFontString("CFM_X") |
fs:SetFontObject("GameFontGreenSmall") |
fs:SetText("X:") |
fs:SetPoint("RIGHT", CFM_XBox, "LEFT", -16,0) |
local fs = f:CreateFontString("CFM_Y") |
fs:SetFontObject("GameFontGreenSmall") |
fs:SetText("Y:") |
fs:SetPoint("RIGHT", CFM_YBox, "LEFT", -16,0) |
local b = CreateFrame("Button", "CFM_XPlus", CFM_Panel2) |
b:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Up") |
b:SetHighlightTexture("Interface\\BUTTONS\\UI-PlusButton-Hilight") |
b:SetPushedTexture("Interface\\BUTTONS\\UI-PlusButton-Down") |
b:SetHeight(14) |
b:SetWidth(14) |
b:SetScript("OnClick", function() |
if selFrame == nil or selFrame == "" then |
print("Please select a frame first.") |
return |
end |
CFM_MoveFrame(selFrame, "right") |
end) |
b:SetPoint("TOPLEFT", CFM_XBox, "TOPRIGHT", 0,-2) |
local b = CreateFrame("Button", "CFM_XMinus", CFM_Panel2) |
b:SetNormalTexture("Interface\\BUTTONS\\UI-MinusButton-Up") |
b:SetHighlightTexture("Interface\\BUTTONS\\UI-PlusButton-Hilight") |
b:SetPushedTexture("Interface\\BUTTONS\\UI-MinusButton-Down") |
b:SetHeight(14) |
b:SetWidth(14) |
b:SetScript("OnClick", function() |
if selFrame == nil or selFrame == "" then |
print("Please select a frame first.") |
return |
else |
CFM_MoveFrame(selFrame, "left") end end) |
b:SetPoint("TOPRIGHT", CFM_XBox, "TOPLEFT", 0, -2) |
local b = CreateFrame("Button", "CFM_YPlus", CFM_Panel2) |
b:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Up") |
b:SetHighlightTexture("Interface\\BUTTONS\\UI-PlusButton-Hilight") |
b:SetPushedTexture("Interface\\BUTTONS\\UI-PlusButton-Down") |
b:SetHeight(14) |
b:SetWidth(14) |
b:SetScript("OnClick", function() |
if selFrame == nil or selFrame == "" then |
print("Please select a frame first.") |
return |
else |
CFM_MoveFrame(selFrame, "up") end end) |
b:SetPoint("TOPLEFT", CFM_YBox, "TOPRIGHT", 0,-2) |
local b = CreateFrame("Button", "CFM_YMinus", CFM_Panel2) |
b:SetNormalTexture("Interface\\BUTTONS\\UI-MinusButton-Up") |
b:SetHighlightTexture("Interface\\BUTTONS\\UI-PlusButton-Hilight") |
b:SetPushedTexture("Interface\\BUTTONS\\UI-MinusButton-Down") |
b:SetHeight(14) |
b:SetWidth(14) |
b:SetScript("OnClick", function() |
if selFrame == nil or selFrame == "" then |
print("Please select a frame first.") |
return |
else |
CFM_MoveFrame(selFrame, "down") end end) |
b:SetPoint("TOPRIGHT", CFM_YBox, "TOPLEFT", 0, -2) |
local b = CreateFrame("Button", "CFM_Reset", CFM_Panel2, "OptionsButtonTemplate") |
b:SetWidth(45) |
b:SetPoint("TOP", CFM_YBox, "BOTTOM", 0,0) |
_G[selFrame]:Hide() end) |
b = CreateFrame("Button", "CFM_UnlockButton", CFM_PropFrame, "OptionsButtonTemplate") |
b:SetWidth(48) |
b:SetPoint("BOTTOMRIGHT", CFM_PropFrame, "BOTTOMRIGHT", -4,4) |
b:RegisterForClicks("LeftButtonUp") |
b:SetNormalFontObject("GameFontNormalSmall") |
b:SetHighlightFontObject("GameFontWhiteSmall") |
b:SetText("0,0") |
b:SetText("Unlock") |
b:SetScript("OnClick", function() |
if selFrame == nil or selFrame == "" then |
print("Please select a frame first.") |
return |
end |
activeProfile[selFrame].offsetX = 0 |
CFM_XBox:SetText("0") |
activeProfile[selFrame].offsetY = 0 |
CFM_YBox:SetText("0") |
CFM_ApplySettings(selFrame) |
end) |
frame = _G[selFrame] |
if activeProfile[selFrame].lock then |
activeProfile[selFrame].lock = false |
frame:SetClampedToScreen(activeProfile[selFrame].clamp) |
print(selFrame.. " is unlocked.") |
b:SetText("Lock") |
-- color overlay |
frame.t = frame:CreateTexture() |
frame.t:SetAllPoints(frame) |
frame.t:SetTexture(0,1,0,.2) |
frame:SetMovable(true) |
frame:RegisterForDrag("LeftButton") |
frame:SetScript("OnDragStart", function() |
if frame:IsMovable() then |
frame.isMoving = true |
frame:StartMoving() |
else return end end) |
frame:SetScript("OnDragStop", function() CFM_StopMoving(frame,selFrame) end) |
else |
b:SetText("Unlock") |
frame:SetMovable(false) |
if frame.t ~= nil then frame.t:Hide() frame.t = nil end |
activeProfile[selFrame].lock = true |
print(selFrame.. " is locked.") |
end end) |
end |
function CFM_CreatePanel3() |
local f, fs, e |
f = CreateFrame("Frame", "CFM_Panel3", CFM_Config) |
f:SetWidth(240) |
f:SetHeight(108) |
f:SetPoint("TOPRIGHT", -4, -22) |
f:SetFrameStrata("DIALOG") |
f:SetBackdrop({ |
bgFile = "Interface\\CHATFRAME\\CHATFRAMEBACKGROUND", |
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", |
tile = "true", |
tileSize = 32, |
edgeSize = 10, |
insets = {left = 3, right = 3, top = 3, bottom = 3} |
}) |
f:SetBackdropColor(.25,.1,.25) |
f:SetBackdropBorderColor(0,.5,0) |
f:Hide() |
local fs = f:CreateFontString("CFM_FrameText", CFM_Panel3) |
fs:SetFontObject("GameFontGreenSmall") |
fs:SetWidth(42) |
fs:SetJustifyH("RIGHT") |
fs:SetText("Frame:") |
fs:SetPoint("TOPLEFT", CFM_Panel3, "TOPLEFT", 0,-8) |
e = CreateFrame("EditBox", "CFM_FrameBox", CFM_Panel3) |
e:SetWidth(140) |
e:SetHeight(18) |
e:SetPoint("LEFT", CFM_FrameText, "RIGHT", 2,0) |
e:SetBackdrop({ |
bgFile="", |
edgeFile="Interface\\Tooltips\\UI-Tooltip-Border", |
tile="true", |
tileSize= 32, |
edgeSize=10, |
insets = {left=5, right=5, top=5, bottom=5} |
}) |
e:SetAutoFocus(false) |
e:SetTextInsets(5,0,0,0) |
e:SetFontObject("GameFontNormalSmall") |
e:SetMaxLetters(255) |
e:SetText("") |
e:SetScript("OnEnterPressed", e.ClearFocus) |
e:SetScript("OnEscapePressed", e.ClearFocus) |
e:SetScript("OnTabPressed", function() CFM_ParentBox:SetFocus() end) |
local b = CreateFrame("Button", "CFM_AddFrameButton", CFM_Panel3, "OptionsButtonTemplate") |
b:SetWidth(90) |
b:SetPoint("BOTTOMRIGHT", CFM_Panel3, "BOTTOMRIGHT", -5,4) |
b:RegisterForClicks("LeftButtonUp") |
b:SetText("Add Frame") |
b:SetNormalFontObject("GameFontNormalSmall") |
b:SetHighlightFontObject("GameFontWhiteSmall") |
b:SetScript("OnClick", function() |
CFM_AddFrame(CFM_FrameBox:GetText(), _G[CFM_FrameBox:GetText()]:GetParent():GetName()) |
CFM_FrameBox:SetText("") |
end) |
end |
function CFM_SelectFrame(frame) |
selFrame = frame |
gframe = _G[frame] |
if frame == "WorldFrame" then CFM_StrataBoxButton:Disable() print("|c00FF00FFCFM:|r Strata changes to WorldFrame are disabled for user safety.") else CFM_StrataBoxButton:Enable() end |
-- add frame.lock to frame's settings |
if activeProfile[frame].lock == nil then activeProfile[frame].lock = true end |
-- add frame.clamp to frame's settings |
if activeProfile[frame].clamp == nil then activeProfile[frame].clamp = gframe:IsClampedToScreen() end |
-- set check boxes |
if activeProfile[frame].forceHide then |
CFM_ForceButton:SetChecked() |
else |
CFM_ForceButton:SetChecked(false) |
end |
if activeProfile[frame].sameXY then |
CFM_ConstrainButton:SetChecked() |
else |
CFM_ConstrainButton:SetChecked(false) |
end |
if activeProfile[frame].clamp then |
CFM_ClampButton:SetChecked() |
else |
CFM_ClampButton:SetChecked(false) |
end |
-- fill in rest of frame's info |
CFM_WidthBox:SetText(activeProfile[frame].width) |
CFM_HeightBox:SetText(activeProfile[frame].height) |
CFM_ScaleBox:SetText(activeProfile[frame].scale) |
CFM_LevelBox:SetText(activeProfile[frame].level) |
CFM_AlphaBox:SetText(activeProfile[frame].alpha) |
CFM_ChangeParentBox:SetText(activeProfile[frame].parent) |
CFM_XBox:SetText(activeProfile[frame].offsetX) |
CFM_YBox:SetText(activeProfile[frame].offsetY) |
if activeProfile[selFrame].lock then |
CFM_UnlockButton:SetText("Unlock") |
gframe:SetMovable(false) |
else |
CFM_UnlockButton:SetText("Lock") |
gframe:SetMovable(true) |
gframe:RegisterForDrag("LeftButton") |
gframe:SetScript("OnDragStart", function() |
if gframe:IsMovable() then |
gframe.isMoving = true |
gframe:StartMoving() |
else return end end) |
gframe:SetScript("OnDragStop", function() CFM_StopMoving(gframe,selFrame) end) |
end |
local point = activeProfile[frame].point |
if point == "CENTER" then |
UIDropDownMenu_SetSelectedValue(CFM_FromBox, 0) |
elseif point == "TOP" then |
UIDropDownMenu_SetSelectedValue(CFM_FromBox, 1) |
elseif point == "TOPRIGHT" then |
UIDropDownMenu_SetSelectedValue(CFM_FromBox, 2) |
elseif point == "RIGHT" then |
UIDropDownMenu_SetSelectedValue(CFM_FromBox, 3) |
elseif point == "BOTTOMRIGHT" then |
UIDropDownMenu_SetSelectedValue(CFM_FromBox, 4) |
elseif point == "BOTTOM" then |
UIDropDownMenu_SetSelectedValue(CFM_FromBox, 5) |
elseif point == "BOTTOMLEFT" then |
UIDropDownMenu_SetSelectedValue(CFM_FromBox, 6) |
elseif point == "LEFT" then |
UIDropDownMenu_SetSelectedValue(CFM_FromBox, 7) |
elseif point == "TOPLEFT" then |
UIDropDownMenu_SetSelectedValue(CFM_FromBox, 8) |
end |
UIDropDownMenu_SetText(CFM_FromBox, point) |
local point = activeProfile[frame].relativePoint |
if point == "CENTER" then |
UIDropDownMenu_SetSelectedValue(CFM_ToBox, 0) |
elseif point == "TOP" then |
UIDropDownMenu_SetSelectedValue(CFM_ToBox, 1) |
elseif point == "TOPRIGHT" then |
UIDropDownMenu_SetSelectedValue(CFM_ToBox, 2) |
elseif point == "RIGHT" then |
UIDropDownMenu_SetSelectedValue(CFM_ToBox, 3) |
elseif point == "BOTTOMRIGHT" then |
UIDropDownMenu_SetSelectedValue(CFM_ToBox, 4) |
elseif point == "BOTTOM" then |
UIDropDownMenu_SetSelectedValue(CFM_ToBox, 5) |
elseif point == "BOTTOMLEFT" then |
UIDropDownMenu_SetSelectedValue(CFM_ToBox, 6) |
elseif point == "LEFT" then |
UIDropDownMenu_SetSelectedValue(CFM_ToBox, 7) |
elseif point == "TOPLEFT" then |
UIDropDownMenu_SetSelectedValue(CFM_ToBox, 8) |
end |
UIDropDownMenu_SetText(CFM_ToBox, point) |
local strata = activeProfile[frame].strata |
if strata == "BACKGROUND" then |
UIDropDownMenu_SetSelectedValue(CFM_StrataBox, 0) |
elseif strata == "LOW" then |
UIDropDownMenu_SetSelectedValue(CFM_StrataBox, 1) |
elseif strata == "MEDIUM" then |
UIDropDownMenu_SetSelectedValue(CFM_StrataBox, 2) |
elseif strata == "HIGH" then |
UIDropDownMenu_SetSelectedValue(CFM_StrataBox, 3) |
elseif strata == "DIALOG" then |
UIDropDownMenu_SetSelectedValue(CFM_StrataBox, 4) |
elseif strata == "TOOLTIP" then |
UIDropDownMenu_SetSelectedValue(CFM_StrataBox, 5) |
end |
UIDropDownMenu_SetText(CFM_StrataBox, strata) |
end |
function CFM_FromDropInit(self) |
function CFM_FromDropInit() |
local level = level or 1 |
local info = UIDropDownMenu_CreateInfo() |
info.text = "CENTER" |
info.value = 0 |
info.func = CFM_FromBoxClick |
info.owner = self |
info.func = function() CFM_FromBoxClick() end |
info.owner = this:GetParent() |
info.checked = nil |
info.icon = nil |
UIDropDownMenu_AddButton(info, level) |
info.text = "TOP" |
info.value = 1 |
info.func = CFM_FromBoxClick |
info.owner = self |
info.func = function() CFM_FromBoxClick() end |
info.owner = this:GetParent() |
info.checked = nil |
info.icon = nil |
UIDropDownMenu_AddButton(info, level) |
info.text = "TOPRIGHT" |
info.value = 2 |
info.func = CFM_FromBoxClick |
info.owner = self |
info.func = function() CFM_FromBoxClick() end |
info.owner = this:GetParent() |
info.checked = nil |
info.icon = nil |
UIDropDownMenu_AddButton(info, level) |
info.text = "RIGHT" |
info.value = 3 |
info.func = CFM_FromBoxClick |
info.owner = self |
info.func = function() CFM_FromBoxClick() end |
info.owner = this:GetParent() |
info.checked = nil |
info.icon = nil |
UIDropDownMenu_AddButton(info, level) |
info.text = "BOTTOMRIGHT" |
info.value = 4 |
info.func = CFM_FromBoxClick |
info.owner = self |
info.func = function() CFM_FromBoxClick() end |
info.owner = this:GetParent() |
info.checked = nil |
info.icon = nil |
UIDropDownMenu_AddButton(info, level) |
info.text = "BOTTOM" |
info.value = 5 |
info.func = CFM_FromBoxClick |
info.owner = self |
info.func = function() CFM_FromBoxClick() end |
info.owner = this:GetParent() |
info.checked = nil |
info.icon = nil |
UIDropDownMenu_AddButton(info, level) |
info.text = "BOTTOMLEFT" |
info.value = 6 |
info.func = CFM_FromBoxClick |
info.owner = self |
info.func = function() CFM_FromBoxClick() end |
info.owner = this:GetParent() |
info.checked = nil |
info.icon = nil |
UIDropDownMenu_AddButton(info, level) |
info.text = "LEFT" |
info.value = 7 |
info.func = CFM_FromBoxClick |
info.owner = self |
info.func = function() CFM_FromBoxClick() end |
info.owner = this:GetParent() |
info.checked = nil |
info.icon = nil |
UIDropDownMenu_AddButton(info, level) |
info.text = "TOPLEFT" |
info.value = 8 |
info.func = CFM_FromBoxClick |
info.owner = self |
info.func = function() CFM_FromBoxClick() end |
info.owner = this:GetParent() |
info.checked = nil |
info.icon = nil |
UIDropDownMenu_AddButton(info, level) |
end |
function CFM_ToDropInit(self) |
function CFM_ToDropInit() |
local level = level or 1 |
local info = UIDropDownMenu_CreateInfo() |
info.text = "CENTER" |
info.value = 0 |
info.func = CFM_ToBoxClick |
info.owner = self |
info.func = function() CFM_ToBoxClick() end |
info.owner = this:GetParent() |
info.checked = nil |
info.icon = nil |
UIDropDownMenu_AddButton(info, level) |
info.text = "TOP" |
info.value = 1 |
info.func = CFM_ToBoxClick |
info.owner = self |
info.func = function() CFM_ToBoxClick() end |
info.owner = this:GetParent() |
info.checked = nil |
info.icon = nil |
UIDropDownMenu_AddButton(info, level) |
info.text = "TOPRIGHT" |
info.value = 2 |
info.func = CFM_ToBoxClick |
info.owner = self |
info.func = function() CFM_ToBoxClick() end |
info.owner = this:GetParent() |
info.checked = nil |
info.icon = nil |
UIDropDownMenu_AddButton(info, level) |
info.text = "RIGHT" |
info.value = 3 |
info.func = CFM_ToBoxClick |
info.owner = self |
info.func = function() CFM_ToBoxClick() end |
info.owner = this:GetParent() |
info.checked = nil |
info.icon = nil |
UIDropDownMenu_AddButton(info, level) |
info.text = "BOTTOMRIGHT" |
info.value = 4 |
info.func = CFM_ToBoxClick |
info.owner = self |
info.func = function() CFM_ToBoxClick() end |
info.owner = this:GetParent() |
info.checked = nil |
info.icon = nil |
UIDropDownMenu_AddButton(info, level) |
info.text = "BOTTOM" |
info.value = 5 |
info.func = CFM_ToBoxClick |
info.owner = self |
info.func = function() CFM_ToBoxClick() end |
info.owner = this:GetParent() |
info.checked = nil |
info.icon = nil |
UIDropDownMenu_AddButton(info, level) |
info.text = "BOTTOMLEFT" |
info.value = 6 |
info.func = CFM_ToBoxClick |
info.owner = self |
info.func = function() CFM_ToBoxClick() end |
info.owner = this:GetParent() |
info.checked = nil |
info.icon = nil |
UIDropDownMenu_AddButton(info, level) |
info.text = "LEFT" |
info.value = 7 |
info.func = CFM_ToBoxClick |
info.owner = self |
info.func = function() CFM_ToBoxClick() end |
info.owner = this:GetParent() |
info.checked = nil |
info.icon = nil |
UIDropDownMenu_AddButton(info, level) |
info.text = "TOPLEFT" |
info.value = 8 |
info.func = CFM_ToBoxClick |
info.owner = self |
info.func = function() CFM_ToBoxClick() end |
info.owner = this:GetParent() |
info.checked = nil |
info.icon = nil |
UIDropDownMenu_AddButton(info, level) |
end |
function CFM_StrataDropInit(self) |
function CFM_StrataDropInit() |
local level = level or 1 |
local info = UIDropDownMenu_CreateInfo() |
info.text = "BACKGROUND" |
info.value = 0 |
info.func = CFM_StrataBoxClick |
info.owner = self |
info.func = function() CFM_StrataBoxClick() end |
info.owner = this:GetParent() |
info.checked = nil |
info.icon = nil |
UIDropDownMenu_AddButton(info, level) |
info.text = "LOW" |
info.value = 1 |
info.func = CFM_StrataBoxClick |
info.owner = self |
info.func = function() CFM_StrataBoxClick() end |
info.owner = this:GetParent() |
info.checked = nil |
info.icon = nil |
UIDropDownMenu_AddButton(info, level) |
info.text = "MEDIUM" |
info.value = 2 |
info.func = CFM_StrataBoxClick |
info.owner = self |
info.func = function() CFM_StrataBoxClick() end |
info.owner = this:GetParent() |
info.checked = nil |
info.icon = nil |
UIDropDownMenu_AddButton(info, level) |
info.text = "HIGH" |
info.value = 3 |
info.func = CFM_StrataBoxClick |
info.owner = self |
info.func = function() CFM_StrataBoxClick() end |
info.owner = this:GetParent() |
info.checked = nil |
info.icon = nil |
UIDropDownMenu_AddButton(info, level) |
info.text = "DIALOG" |
info.value = 4 |
info.func = CFM_StrataBoxClick |
info.owner = self |
info.func = function() CFM_StrataBoxClick() end |
info.owner = this:GetParent() |
info.checked = nil |
info.icon = nil |
UIDropDownMenu_AddButton(info, level) |
info.text = "TOOLTIP" |
info.value = 5 |
info.func = CFM_StrataBoxClick |
info.owner = self |
info.func = function() CFM_StrataBoxClick() end |
info.owner = this:GetParent() |
info.checked = nil |
info.icon = nil |
UIDropDownMenu_AddButton(info, level) |
end |
function CFM_FromBoxClick(self) |
UIDropDownMenu_SetSelectedValue(self.owner, self.value) |
if (self.value == 0) then |
function CFM_FromBoxClick() |
UIDropDownMenu_SetSelectedValue(this.owner, this.value) |
if (this.value == 0) then |
activeProfile[selFrame].point = "CENTER" |
elseif (self.value == 1) then |
elseif (this.value == 1) then |
activeProfile[selFrame].point = "TOP" |
elseif (self.value == 2) then |
elseif (this.value == 2) then |
activeProfile[selFrame].point = "TOPRIGHT" |
elseif (self.value == 3) then |
elseif (this.value == 3) then |
activeProfile[selFrame].point = "RIGHT" |
elseif (self.value == 4) then |
elseif (this.value == 4) then |
activeProfile[selFrame].point = "BOTTOMRIGHT" |
elseif (self.value == 5) then |
elseif (this.value == 5) then |
activeProfile[selFrame].point = "BOTTOM" |
elseif (self.value == 6) then |
elseif (this.value == 6) then |
activeProfile[selFrame].point = "BOTTOMLEFT" |
elseif (self.value == 7) then |
elseif (this.value == 7) then |
activeProfile[selFrame].point = "LEFT" |
elseif (self.value == 8) then |
elseif (this.value == 8) then |
activeProfile[selFrame].point = "TOPLEFT" |
end |
CFM_ApplySettings(selFrame) |
end |
function CFM_ToBoxClick(self) |
UIDropDownMenu_SetSelectedValue(self.owner, self.value) |
if (self.value == 0) then |
function CFM_ToBoxClick() |
UIDropDownMenu_SetSelectedValue(this.owner, this.value) |
if (this.value == 0) then |
activeProfile[selFrame].relativePoint = "CENTER" |
elseif (self.value == 1) then |
elseif (this.value == 1) then |
activeProfile[selFrame].relativePoint = "TOP" |
elseif (self.value == 2) then |
elseif (this.value == 2) then |
activeProfile[selFrame].relativePoint = "TOPRIGHT" |
elseif (self.value == 3) then |
elseif (this.value == 3) then |
activeProfile[selFrame].relativePoint = "RIGHT" |
elseif (self.value == 4) then |
elseif (this.value == 4) then |
activeProfile[selFrame].relativePoint = "BOTTOMRIGHT" |
elseif (self.value == 5) then |
elseif (this.value == 5) then |
activeProfile[selFrame].relativePoint = "BOTTOM" |
elseif (self.value == 6) then |
elseif (this.value == 6) then |
activeProfile[selFrame].relativePoint = "BOTTOMLEFT" |
elseif (self.value == 7) then |
elseif (this.value == 7) then |
activeProfile[selFrame].relativePoint = "LEFT" |
elseif (self.value == 8) then |
elseif (this.value == 8) then |
activeProfile[selFrame].relativePoint = "TOPLEFT" |
end |
CFM_ApplySettings(selFrame) |
end |
function CFM_StrataBoxClick(self) |
function CFM_StrataBoxClick() |
if selFrame == nil then return end |
UIDropDownMenu_SetSelectedValue(self.owner, self.value) |
if (self.value == 0) then |
UIDropDownMenu_SetSelectedValue(this.owner, this.value) |
if (this.value == 0) then |
activeProfile[selFrame].strata = "BACKGROUND" |
elseif (self.value == 1) then |
elseif (this.value == 1) then |
activeProfile[selFrame].strata = "LOW" |
elseif (self.value == 2) then |
elseif (this.value == 2) then |
activeProfile[selFrame].strata = "MEDIUM" |
elseif (self.value == 3) then |
elseif (this.value == 3) then |
activeProfile[selFrame].strata = "HIGH" |
elseif (self.value == 4) then |
elseif (this.value == 4) then |
activeProfile[selFrame].strata = "DIALOG" |
elseif (self.value == 5) then |
elseif (this.value == 5) then |
activeProfile[selFrame].strata = "TOOLTIP" |
end |
CFM_ApplySettings(selFrame) |
end |
CFM_ChangeParentBox:SetText(activeProfile[selFrame].parent) |
end |
----------------- |
-- ADDER FRAME -- |
----------------- |
function CFM_CreateAdder() |
local f = CreateFrame("Frame", "CFM_FrameAdder", CFM_Config) |
f:SetWidth(190) |
f:SetHeight(66) |
f:SetPoint("BOTTOMLEFT", 5,5) |
-- Create background |
f:SetBackdrop({ |
bgFile = "Interface\\CHATFRAME\\CHATFRAMEBACKGROUND", |
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", |
tile = "true", |
tileSize = 32, |
edgeSize = 10, |
insets = {left = 3, right = 3, top = 3, bottom = 3} |
}) |
f:SetBackdropColor(.25,.1,.25) |
f:SetBackdropBorderColor(0,.5,0) |
f:SetMovable() |
f:SetClampedToScreen() |
f:RegisterForDrag("LeftButton") |
f:SetScript("OnDragStart", f.StartMoving) |
local fs = f:CreateFontString("CFM_FrameText") |
fs:SetFontObject("GameFontGreenSmall") |
fs:SetWidth(42) |
fs:SetJustifyH("RIGHT") |
fs:SetText("Frame:") |
fs:SetPoint("TOPLEFT", CFM_FrameAdder, "TOPLEFT", 0,-8) |
local e = CreateFrame("EditBox", "CFM_FrameBox", CFM_FrameAdder) |
e:SetWidth(140) |
e:SetHeight(18) |
e:SetPoint("LEFT", CFM_FrameText, "RIGHT", 2,0) |
e:SetBackdrop({ |
bgFile="", |
edgeFile="Interface\\Tooltips\\UI-Tooltip-Border", |
tile="true", |
tileSize= 32, |
edgeSize=10, |
insets = {left=5, right=5, top=5, bottom=5} |
}) |
e:SetAutoFocus(false) |
e:SetTextInsets(5,0,0,0) |
e:SetFontObject("GameFontNormalSmall") |
e:SetMaxLetters(255) |
e:SetText("") |
e:SetScript("OnEnterPressed", e.ClearFocus) |
e:SetScript("OnEscapePressed", e.ClearFocus) |
e:SetScript("OnTabPressed", function() CFM_ParentBox:SetFocus() end) |
--[[ PARENT DATA ]] |
local fs = f:CreateFontString("CFM_ParentText") |
fs:SetWidth(42) |
fs:SetJustifyH("RIGHT") |
fs:SetFontObject("GameFontGreenSmall") |
fs:SetText("Parent:") |
fs:SetPoint("TOP", CFM_FrameText, "BOTTOM", 0,-8) |
local e = CreateFrame("EditBox", "CFM_ParentBox", CFM_FrameAdder) |
e:SetWidth(140) |
e:SetHeight(18) |
e:SetPoint("LEFT", CFM_ParentText, "RIGHT", 2,0) |
e:SetBackdrop({ |
bgFile="", |
edgeFile="Interface\\Tooltips\\UI-Tooltip-Border", |
tile="true", |
tileSize= 32, |
edgeSize=10, |
insets = {left=5, right=5, top=5, bottom=5} |
}) |
e:SetAutoFocus(false) |
e:SetTextInsets(5,0,0,0) |
e:SetFontObject("GameFontNormalSmall") |
e:SetMaxLetters(255) |
e:SetText("") |
e:SetScript("OnEnterPressed", e.ClearFocus) |
e:SetScript("OnEscapePressed", e.ClearFocus) |
e:SetScript("OnTabPressed", function() CFM_FrameBox:SetFocus() end) |
--[[ BUTTONS ]] |
local b = CreateFrame("Button", "CFM_AddFrameButton", CFM_FrameAdder, "OptionsButtonTemplate") |
b:SetWidth(90) |
b:SetPoint("BOTTOMRIGHT", CFM_FrameAdder, "BOTTOMRIGHT", -5,4) |
b:RegisterForClicks("LeftButtonUp") |
b:SetText("Add Frame") |
b:SetNormalFontObject("GameFontNormalSmall") |
b:SetHighlightFontObject("GameFontWhiteSmall") |
b:SetScript("OnClick", function() |
CFM_AddFrame(CFM_FrameBox:GetText(), CFM_ParentBox:GetText()) |
CFM_FrameBox:SetText("") |
CFM_ParentBox:SetText("") |
end) |
local b = CreateFrame("Button", "CFM_ImportFrameButton", CFM_FrameAdder, "OptionsButtonTemplate") |
b:SetWidth(90) |
b:SetPoint("RIGHT", CFM_AddFrameButton, "LEFT", 0,0) |
b:RegisterForClicks("LeftButtonUp") |
b:SetNormalFontObject("GameFontNormalSmall") |
b:SetHighlightFontObject("GameFontWhiteSmall") |
b:SetText("DFM Import") |
b:SetScript("OnClick", function() CFM_Import() end) |
end |
---------------- |
-- MOVE FRAME -- |
---------------- |
function CFM_CreateMover() |
local f = CreateFrame("Frame", "CFM_Mover", CFM_Config) |
f:SetWidth(100) |
f:SetHeight(66) |
f:SetPoint("BOTTOMRIGHT", -5, 5) |
-- Create background |
f:SetBackdrop({ |
bgFile = "Interface\\CHATFRAME\\CHATFRAMEBACKGROUND", |
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", |
tile = "true", |
tileSize = 32, |
edgeSize = 10, |
insets = {left = 3, right = 3, top = 3, bottom = 3} |
}) |
f:SetBackdropColor(.25,.1,.25) |
f:SetBackdropBorderColor(0,.5,0) |
f:SetMovable() |
f:SetClampedToScreen() |
f:RegisterForDrag("LeftButton") |
f:SetScript("OnDragStart", f.StartMoving) |
local e = CreateFrame("EditBox", "CFM_XBox", CFM_Mover) |
e:SetWidth(45) |
e:SetHeight(18) |
e:SetPoint("TOPLEFT", CFM_Mover, "TOPLEFT", 34,-5) |
e:SetBackdrop({ |
bgFile="", |
edgeFile="Interface\\Tooltips\\UI-Tooltip-Border", |
tile="true", |
tileSize= 32, |
edgeSize=10, |
insets = {left=5, right=5, top=5, bottom=5} |
}) |
e:SetAutoFocus(false) |
e:SetTextInsets(5,0,0,0) |
e:SetFontObject("GameFontNormal") |
e:SetMaxLetters(4) |
e:SetText("") |
e:SetScript("OnEnterPressed", function() |
if selFrame == nil or selFrame == "" then |
print("Please select a frame first.") |
return |
end |
activeProfile[selFrame].offsetX = tonumber(e:GetText()) |
CFM_ApplySettings(selFrame) |
e:ClearFocus() end) |
e:SetScript("OnEscapePressed", e.ClearFocus) |
local e = CreateFrame("EditBox", "CFM_YBox", CFM_Mover) |
e:SetWidth(45) |
e:SetHeight(18) |
e:SetPoint("TOPRIGHT", CFM_XBox, "BOTTOMRIGHT", 0,0) |
e:SetBackdrop({ |
bgFile="", |
edgeFile="Interface\\Tooltips\\UI-Tooltip-Border", |
tile="true", |
tileSize= 32, |
edgeSize=10, |
insets = {left=5, right=5, top=5, bottom=5} |
}) |
e:SetAutoFocus(false) |
e:SetTextInsets(5,0,0,0) |
e:SetFontObject("GameFontNormal") |
e:SetMaxLetters(4) |
e:SetText("") |
e:SetScript("OnEnterPressed", function() |
if selFrame == nil or selFrame == "" then |
print("Please select a frame first.") |
return |
end |
activeProfile[selFrame].offsetY = tonumber(e:GetText()) |
CFM_ApplySettings(selFrame) |
e:ClearFocus() end) |
e:SetScript("OnEscapePressed", e.ClearFocus) |
local fs = f:CreateFontString("CFM_Mover_X") |
fs:SetFontObject("GameFontGreenSmall") |
fs:SetText("X:") |
fs:SetPoint("RIGHT", CFM_XBox, "LEFT", -16,0) |
local fs = f:CreateFontString("CFM_Mover_Y") |
fs:SetFontObject("GameFontGreenSmall") |
fs:SetText("Y:") |
fs:SetPoint("RIGHT", CFM_YBox, "LEFT", -16,0) |
local b = CreateFrame("Button", "CFM_Mover_Reset", CFM_Mover, "OptionsButtonTemplate") |
b:SetWidth(45) |
b:SetPoint("BOTTOM", CFM_Mover, "BOTTOM", 0,4) |
b:RegisterForClicks("LeftButtonUp") |
b:SetNormalFontObject("GameFontNormalSmall") |
b:SetHighlightFontObject("GameFontWhiteSmall") |
b:SetText("0,0") |
b:SetScript("OnClick", function() |
if selFrame == nil or selFrame == "" then |
print("Please select a frame first.") |
return |
end |
activeProfile[selFrame].offsetX = 0 |
CFM_XBox:SetText("0") |
activeProfile[selFrame].offsetY = 0 |
CFM_YBox:SetText("0") |
CFM_ApplySettings(selFrame) |
end) |
local b = CreateFrame("Button", "CFM_Mover_XPlus", CFM_Mover) |
b:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Up") |
b:SetHighlightTexture("Interface\\BUTTONS\\UI-PlusButton-Hilight") |
b:SetPushedTexture("Interface\\BUTTONS\\UI-PlusButton-Down") |
b:SetHeight(14) |
b:SetWidth(14) |
b:SetScript("OnClick", function() |
if selFrame == nil or selFrame == "" then |
print("Please select a frame first.") |
return |
end |
CFM_MoveFrame(selFrame, "right") |
end) |
b:SetPoint("TOPLEFT", CFM_XBox, "TOPRIGHT", 0,-2) |
local b = CreateFrame("Button", "CFM_Mover_XMinus", CFM_Mover) |
b:SetNormalTexture("Interface\\BUTTONS\\UI-MinusButton-Up") |
b:SetHighlightTexture("Interface\\BUTTONS\\UI-PlusButton-Hilight") |
b:SetPushedTexture("Interface\\BUTTONS\\UI-MinusButton-Down") |
b:SetHeight(14) |
b:SetWidth(14) |
b:SetScript("OnClick", function() |
if selFrame == nil or selFrame == "" then |
print("Please select a frame first.") |
return |
else |
CFM_MoveFrame(selFrame, "left") end end) |
b:SetPoint("TOPRIGHT", CFM_XBox, "TOPLEFT", 0, -2) |
local b = CreateFrame("Button", "CFM_Mover_YPlus", CFM_Mover) |
b:SetNormalTexture("Interface\\BUTTONS\\UI-PlusButton-Up") |
b:SetHighlightTexture("Interface\\BUTTONS\\UI-PlusButton-Hilight") |
b:SetPushedTexture("Interface\\BUTTONS\\UI-PlusButton-Down") |
b:SetHeight(14) |
b:SetWidth(14) |
b:SetScript("OnClick", function() |
if selFrame == nil or selFrame == "" then |
print("Please select a frame first.") |
return |
else |
CFM_MoveFrame(selFrame, "up") end end) |
b:SetPoint("TOPLEFT", CFM_YBox, "TOPRIGHT", 0,-2) |
local b = CreateFrame("Button", "CFM_Mover_YMinus", CFM_Mover) |
b:SetNormalTexture("Interface\\BUTTONS\\UI-MinusButton-Up") |
b:SetHighlightTexture("Interface\\BUTTONS\\UI-PlusButton-Hilight") |
b:SetPushedTexture("Interface\\BUTTONS\\UI-MinusButton-Down") |
b:SetHeight(14) |
b:SetWidth(14) |
b:SetScript("OnClick", function() |
if selFrame == nil or selFrame == "" then |
print("Please select a frame first.") |
return |
else |
CFM_MoveFrame(selFrame, "down") end end) |
b:SetPoint("TOPRIGHT", CFM_YBox, "TOPLEFT", 0, -2) |
end |
return frame, point, parent, relativePoint, offsetX, offsetY |
end |
function CFM_Import() |
if CFM_ImportFrame then |
CFM_ImportFrame:Show() |
return |
end |
local f, fs, e, b |
f = CreateFrame("Frame", "CFM_ImportFrame", UIParent) |
f:SetWidth(196) |
f:SetHeight(114) |
f:SetPoint("TOPLEFT", CFM_Config, "TOPRIGHT", 0,0) |
f:SetFrameStrata("DIALOG") |
f:SetBackdrop({ |
bgFile = "Interface\\CHATFRAME\\CHATFRAMEBACKGROUND", |
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", |
tile = "true", |
tileSize = 32, |
edgeSize = 10, |
insets = {left = 3, right = 3, top = 3, bottom = 3} |
}) |
f:SetBackdropColor(.25,.1,.25) |
f:SetBackdropBorderColor(0,.5,0) |
fs = f:CreateFontString("CFM_ImportWarn") |
fs:SetFontObject("GameFontRedSmall") |
fs:SetJustifyH("CENTER") |
fs:SetWidth(190) |
fs:SetText("WARNING: Imported frames will NOT have a restore point!") |
fs:SetPoint("TOP", CFM_ImportFrame, "TOP", 0, -8) |
fs = f:CreateFontString("CFM_ImportProfileText") |
fs:SetFontObject("GameFontGreenSmall") |
fs:SetJustifyH("RIGHT") |
fs:SetWidth(44) |
fs:SetText("Profile:") |
fs:SetPoint("TOPLEFT", CFM_ImportFrame, "TOPLEFT", 5,-36) |
fs = f:CreateFontString("CFM_ImportHeaderText") |
fs:SetFontObject("GameFontGreenSmall") |
fs:SetJustifyH("RIGHT") |
fs:SetWidth(44) |
fs:SetText("Header:") |
fs:SetPoint("TOPLEFT", CFM_ImportProfileText, "BOTTOMLEFT", 0,-8) |
fs = f:CreateFontString("CFM_ImportFrameText") |
fs:SetFontObject("GameFontGreenSmall") |
fs:SetJustifyH("RIGHT") |
fs:SetWidth(44) |
fs:SetText("Frame:") |
fs:SetPoint("TOPLEFT", CFM_ImportHeaderText, "BOTTOMLEFT", 0,-8) |
e = CreateFrame("EditBox", "CFM_ImportProfileBox", CFM_ImportFrame) |
e:SetWidth(140) |
e:SetHeight(18) |
e:SetPoint("LEFT", CFM_ImportProfileText, "RIGHT", 0,-2) |
e:SetBackdrop({ |
bgFile="", |
edgeFile="Interface\\Tooltips\\UI-Tooltip-Border", |
tile="true", |
tileSize= 32, |
edgeSize=10, |
insets = {left=5, right=5, top=5, bottom=5} |
}) |
e:SetAutoFocus(false) |
e:SetTextInsets(5,0,0,0) |
e:SetFontObject("GameFontNormalSmall") |
e:SetMaxLetters(255) |
e:SetText("") |
e:SetScript("OnEnterPressed", e.ClearFocus) |
e:SetScript("OnEscapePressed", e.ClearFocus) |
e:SetScript("OnTabPressed", function() CFM_ImportHeaderBox:SetFocus() end) |
e = CreateFrame("EditBox", "CFM_ImportHeaderBox", CFM_ImportFrame) |
e:SetWidth(140) |
e:SetHeight(18) |
e:SetPoint("LEFT", CFM_ImportHeaderText, "RIGHT", 0,-2) |
e:SetBackdrop({ |
bgFile="", |
edgeFile="Interface\\Tooltips\\UI-Tooltip-Border", |
tile="true", |
tileSize= 32, |
edgeSize=10, |
insets = {left=5, right=5, top=5, bottom=5} |
}) |
e:SetAutoFocus(false) |
e:SetTextInsets(5,0,0,0) |
e:SetFontObject("GameFontNormalSmall") |
e:SetMaxLetters(255) |
e:SetText("") |
e:SetScript("OnEnterPressed", e.ClearFocus) |
e:SetScript("OnEscapePressed", e.ClearFocus) |
e:SetScript("OnTabPressed", function() CFM_ImportFrameBox:SetFocus() end) |
e = CreateFrame("EditBox", "CFM_ImportFrameBox", CFM_ImportFrame) |
e:SetWidth(140) |
e:SetHeight(18) |
e:SetPoint("LEFT", CFM_ImportFrameText, "RIGHT", 0,-2) |
e:SetBackdrop({ |
bgFile="", |
edgeFile="Interface\\Tooltips\\UI-Tooltip-Border", |
tile="true", |
tileSize= 32, |
edgeSize=10, |
insets = {left=5, right=5, top=5, bottom=5} |
}) |
e:SetAutoFocus(false) |
e:SetTextInsets(5,0,0,0) |
e:SetFontObject("GameFontNormalSmall") |
e:SetMaxLetters(255) |
e:SetText("") |
e:SetScript("OnEnterPressed", e.ClearFocus) |
e:SetScript("OnEscapePressed", e.ClearFocus) |
e:SetScript("OnTabPressed", function() CFM_ImportProfileBox:SetFocus() end) |
local b = CreateFrame("Button", "CFM_ImportButton", CFM_ImportFrame, "OptionsButtonTemplate") |
b:SetWidth(90) |
b:SetPoint("BOTTOMRIGHT", CFM_ImportFrame, "BOTTOMRIGHT", -5,5) |
b:RegisterForClicks("LeftButtonUp") |
b:SetText("Import Frame") |
b:SetNormalFontObject("GameFontNormalSmall") |
b:SetHighlightFontObject("GameFontWhiteSmall") |
b:SetScript("OnClick", CFM_ImportDFM) |
local b = CreateFrame("Button", "CFM_ImportClose", CFM_ImportFrame, "OptionsButtonTemplate") |
b:SetWidth(50) |
b:SetPoint("BOTTOMLEFT", CFM_ImportFrame, "BOTTOMLEFT", 5,5) |
b:RegisterForClicks("LeftButtonUp") |
b:SetText("Close") |
b:SetNormalFontObject("GameFontNormalSmall") |
b:SetHighlightFontObject("GameFontWhiteSmall") |
b:SetScript("OnClick", function() CFM_ImportFrame:Hide() end) |
end |
function CFM_ImportDFM() |
local profile, impframe, header |
header = CFM_ImportHeaderBox:GetText() |
profile =CFM_ImportProfileBox:GetText() |
impframe = CFM_ImportFrameBox:GetText() |
if profile == "" then |
print("|c00FF00FFCFM:|r Please enter the profile name.") |
return |
end |
if header == "" then |
print("|c00FF00FFCFM:|r Please enter the header name.") |
return |
end |
if impframe == "" then |
print("|c00FF00FFCFM:|r Please enter the frame name.") |
return |
end |
if DFM_Settings[profile] == nil then print("|c00FF00FFCFM:|r Profile does not exist.") return end |
if DFM_Settings[profile][header] == nil then print("|c00FF00FFCFM:|r Header does not exist.") return end |
if DFM_Settings[profile][header][impframe] == nil then print("|c00FF00FFCFM:|r Frame does not exist.") return end |
DFM_Import = DFM_Settings[profile][header][impframe] |
activeProfile[impframe] = activeProfile[impframe] or {} |
activeProfile[impframe].offsetX = DFM_Import.Location.x |
activeProfile[impframe].offsetY = DFM_Import.Location.y |
activeProfile[impframe].point = DFM_Import.Location.point |
activeProfile[impframe].relativeTo = DFM_Import.Location.to |
activeProfile[impframe].parent = DFM_Import.Location.frame |
if DFM_Import.forceHide then |
activeProfile[impframe].forceHide = true |
else |
activeProfile[impframe].forceHide = false |
end |
activeProfile[impframe].strata = DFM_Import[2][1] |
activeProfile[impframe].level = DFM_Import[3][1] |
activeProfile[impframe].height = DFM_Import[4][1] |
activeProfile[impframe].width = DFM_Import[5][1] |
activeProfile[impframe].scale = DFM_Import[6][1] |
activeProfile[impframe].sameXY = false |
CFM_ApplySettings(impframe) |
print("|c00FF00FFCFM:|r ".. impframe.. " has been successfully imported!") |
CFM_ImportProfileBox:SetText("") |
CFM_ImportHeaderBox:SetText("") |
CFM_ImportFrameBox:SetText("") |
end |
function CFM_SwapProfile(realm, toon) |
if CFM_Profiles[realm] == nil or CFM_Profiles[realm][toon] == nil then |
print("|c00FF00FFCFM:|r No profile found. Please make sure you've capitalized your realm and character name.") |