Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Author Manaleaf - Sargeras
- --GUI for RDSW
- local startupFrame = CreateFrame("FRAME")
- startupFrame:RegisterEvent("ADDON_LOADED")
- startupFrame:SetScript("OnEvent", function(self, event, addon)
- if addon == "RDSW" then
- --GUI local variables
- local buttonNormalTexture = "Interface\\Addons\\RDSW\\Media\\Images\\Button Unpressed Leaf Texture"
- local buttonHighlightTexture = "Interface\\Addons\\RDSW\\Media\\Images\\Button Pressed Glow"
- local buttonPressedTexture = "Interface\\Addons\\RDSW\\Media\\Images\\Button Pressed Glow"
- local directoryItems = {"Settings", "History", "FAQ", "Utility"}
- local contentTypeItems = {"raid", "mythicdungeon", "dungeonnonmythic"}
- local locationEnabledItems = {"incombat", "bossencounter", "outofcombat"}
- local historyButtonNum = 10
- local activeWindowList = {"RDSW_Settings_Window_Frame", "RDSW_History_Window_Frame",
- "RDSW_FAQ_Window_Frame", "RDSW_Utility_Window_Frame"}
- local historyCap = 1000
- --Individual Frame Generator
- function RDSW.frameGen(frameAttr, ...)
- local frame
- local parent
- local frameObj = {}
- --Copy template
- if frameAttr.template then
- for k,v in pairs(frameAttr.template) do
- frameObj[k] = v
- end
- end
- --Overwrite template with object attributes
- for k,v in pairs(frameAttr) do
- frameObj[k] = v
- end
- --Auxiliary attribute overwrite
- if ... then
- for k,v in pairs(...) do
- frameObj[k] = v
- end
- end
- --Defaults
- if not frameObj.xOff then frameObj.xOff = 0 end
- if not frameObj.yOff then frameObj.yOff = 0 end
- if not frameObj.width then frameObj.width = 0 end
- if not frameObj.height then frameObj.height = 0 end
- if frameObj.parent then parent = _G[frameObj.parent] end
- if frameObj.fType == "FRAME" then
- frame = CreateFrame("Frame", frameObj.name, parent)
- elseif frameObj.fType == "TEXT" then
- frame = parent:CreateFontString(frameObj.name)
- --Text Defaults
- if not frameObj.font then frameObj.font = RDSW.vixarFont end
- if not frameObj.fontSize then frameObj.fontSize = 18 end
- if not frameObj.fontFlags then frameObj.fontFlags = "OUTLINE" end
- frame:SetFont(frameObj.font, frameObj.fontSize, frameObj.fontFlags)
- if frameObj.hJustify then frame:SetJustifyH(frameObj.hJustify) end
- if frameObj.vJustify then frame:SetJustifyV(frameObj.vJustify) end
- if frameObj.text then frame:SetText(frameObj.text) end
- elseif frameObj.fType == "BUTTON" then
- frame = CreateFrame("Button", frameObj.name, parent)
- if frameObj.normalTexture then --set Normal Texture
- frame:SetNormalTexture(frameObj.normalTexture)
- else
- frame:SetNormalTexture(buttonNormalTexture)
- end
- if frameObj.highlightTexture then --set Highlight Texture
- frame:SetHighlightTexture(frameObj.highlightTexture)
- else
- frame:SetHighlightTexture(buttonHighlightTexture)
- end
- if frameObj.pushedTexture then --set Pressed Texture
- frame:SetPushedTexture(frameObj.pushedTexture)
- else
- frame:SetPushedTexture(buttonPressedTexture)
- end
- frame:SetScript("OnMouseUp", function() frameObj.clickFunc(frameObj) end)
- elseif frameObj.fType == "DROPDOWN" then
- frame = CreateFrame("Button", frameObj.name, parent, "UIDropDownMenuTemplate")
- frame:ClearAllPoints()
- if frameObj.initFunc then UIDropDownMenu_Initialize(frame, frameObj.initFunc) end
- UIDropDownMenu_SetWidth(frame, frameObj.width);
- UIDropDownMenu_SetButtonWidth(frame, frameObj.buttonWidth)
- UIDropDownMenu_SetSelectedID(frame, 1)
- if frameObj.hJustify then UIDropDownMenu_JustifyText(frame, frameObj.hJustify) end
- elseif frameObj.fType == "CHECKBOX" then
- frame = CreateFrame("CheckButton", frameObj.name, parent, "UICheckButtonTemplate")
- frame:SetScript("OnMouseUp", function() frameObj.checkedFunc(frameObj.arg1) end)
- if contentType[v].enabled == true then
- checkboxFrame:SetChecked(true)
- else
- checkboxFrame:SetChecked(false)
- end
- elseif frameObj.fType == "EDITBOX" then
- frame = CreateFrame("EditBox", frameObj.name, parent, "InputBoxTemplate")
- if frameObj.boxAutoFocus then frame:SetAutoFocus(frameObj.boxAutoFocus) end
- if boxNumeric then frame:SetNumeric() end
- if frameObj.numeric then frame:SetNumber(frameObj.numeric) end
- if enterPressedFunc then frame:SetScript("OnEnterPressed", enterPressedFunc) end
- if escapePressedFunc then frame:SetScript("OnEscapePressed", escapePressedFunc) end
- frame:SetAutoFocus(false)
- frame:ClearFocus()
- end
- if frameObj.transcribe then
- frame.SetAllPoints(frameObj.transcribe)
- else
- if frameObj.pointOnParent then
- frame:SetPoint(frameObj.pointOnFrame, frameObj.parent, frameObj.pointOnParent, frameObj.xOff, frameObj.yOff)
- else --omit pointOnParent
- frame:SetPoint(frameObj.pointOnFrame, frameObj.parent, frameObj.xOff, frameObj.yOff)
- end
- if frameObj.pointOnParent then
- frame:SetPoint(frameObj.pointOnFrame, frameObj.parent, frameObj.pointOnParent, frameObj.xOff, frameObj.yOff)
- else --omit pointOnParent
- frame:SetPoint(frameObj.pointOnFrame, frameObj.parent, frameObj.xOff, frameObj.yOff)
- end
- frame:SetSize(frameObj.width, frameObj.height)
- if frameObj.strata then
- frame:SetFrameStrata(frameObj.strata)
- end
- if frameObj.level then
- frame:SetFrameLevel(frameObj.level)
- end
- end
- if frameObj.backdrop then
- frame:SetBackdrop(frameObj.backdrop)
- end
- if frameObj.drawLayer then
- frame:SetDrawLayer(frameObj.drawLayer)
- end
- if frameObj.func then
- frameObj.func(frameObj)
- end
- if frameObj.color then
- frame:SetTextColor(frameObj.color[1], frameObj.color[2], frameObj.color[3], frameObj.color[4])
- end
- return frame
- end
- --Creates a index style set of button frames.
- local function indexGen(items, frameObj, textObj, ttlHeight)
- if type(items) == "number" then
- local height = ttlHeight / items
- for i = 1, items do
- RDSW.frameGen(frameObj, {["name"] = frameObj.name .. i, ["height"] = height, arg1 = i})
- if not textObj.parent then textObj.parent = frameObj.name end
- RDSW.frameGen(textObj, {["name"] = textObj.name .. i, ["height"] = height})
- end
- elseif type(items) == "table" then
- local height = ttlHeight / #items
- local frame = _G[parent]
- for i,v in ipairs(items) do
- RDSW.frameGen(frameObj, {["name"] = frameObj.name .. i, ["height"] = height, arg1 = i})
- if not textObj.parent then textObj.parent = frameObj.name end
- RDSW.frameGen(textObj, {["name"] = textObj.name .. i, ["height"] = height, text = v})
- end
- end
- end
- --Creates a row-col box style set of checkbox frames.
- local function checkBoxGen(items, frameObj, textObj, contentType, title, ttlWidth, ttlHeight, frameXPos, frameYPos, cols)
- local indent = 10
- local rows = math.ceil(#items / cols)
- local height = (ttlHeight - frameObj.height - indent * 2) / (rows-1)
- local width = (ttlWidth - frameObj.width - indent * 2) / (cols)
- --Create background Frame
- local frame = CreateFrame("FRAME", frameObj.name .. "_Frame", _G[frameObj.parent])
- frame:SetPoint(frameObj.pointOnFrame, frameObj.parent, frameXPos, frameYPos)
- frame:SetSize(ttlWidth, ttlHeight)
- frame:SetBackdrop({
- edgeFile="Interface\\DialogFrame\\UI-DialogBox-Border",
- tile = false,
- tileSize = nil,
- edgeSize = 10,
- insets = {left = 1, right = 1, top = 1, bottom = 1}
- })
- RDSW.frameGen(textObj, {text = title, ["width"] = ttlWidth})
- local checkboxFrame, colPos, rowPos
- for i,v in ipairs(items) do
- colPos = mod(i-1, cols) * width + indent
- rowPos = math.floor((i-1)/rows) * height * -1 - indent
- checkboxFrame = RDSW.frameGen(frameObj,
- {--Individual checkbox attributes
- name = frameObj.name .. contentType[v].id,
- parent = frame,
- xOff = colPos,
- yOff = rowPos,
- ["height"] = height,
- ["width"] = width,
- arg1 = contentType[v]
- }),
- RDSW.frameGen(textObj,
- { --Individual checkbox title attributes
- parent = checkboxFrame,
- ["height"] = height,
- ["width"] = width,
- text = contentType.name
- })
- end
- end
- --Updates Display Frame Text
- function RDSW.updateDisplay()
- ------------------------Break update display into RDSW.updateDisplay() and RDSW.updateDisplayVisibility()
- local displayShown = RDSW_Display_Frame:IsVisible()
- if RDSW.inCombat then
- if RDSW.enabled["incombat"].enabled and not displayShown and RDSW.inCombat then
- RDSW_Display_Frame:Show()
- elseif not RDSW.enabled["incombat"].enabled and displayShown and RDSW.inCombat then
- RDSW_Display_Frame:Hide()
- end
- else --if not in combat
- if RDSW.enabled["outofcombat"].enabled and not displayShown and not RDSW.inCombat then
- RDSW_Display_Frame:Show()
- elseif not RDSW.enabled["outofcombat"].enabled and displayShown and not RDSW.inCombat then
- RDSW_Display_Frame:Hide()
- end
- end
- if RDSW.activeEncounter then
- if RDSW.enabled["bossencounter"].enabled and not displayShown and RDSW.activeEncounter then
- RDSW_Display_Frame:Show()
- elseif not RDSW.enabled["bossencounter"].enabled and displayShown and RDSW.activeEncounter then
- RDSW_Display_Frame:Hide()
- end
- end
- --------------------
- if displayShown then
- local strFormat = "\n%15s: %-5." .. tostring(RDSW.option.displayPrecision) .. "f"
- local outString, hstCurText1, hstCurText2, hstTTLText1, hstTTLText2
- if RDSW.option.calcType == 1 then
- hstCurText1 = string.format(strFormat, "Haste[HPM]", RDSW.score.CUR_HST_HPM)
- hstCurText2 = string.format(strFormat, "Haste[HPCT]",RDSW.score.CUR_HST_HPCT)
- hstTTLText1 = string.format(strFormat, "Haste[HPM]",RDSW.score.TTL_HST_HPM)
- hstTTLText2 = string.format(strFormat, "Haste[HPCT]",RDSW.score.TTL_HST_HPCT)
- elseif RDSW.option.calcType == 2 then
- hstCurText1 = string.format(strFormat, "Haste[HPM]", RDSW.score.CUR_HST_HPM)
- hstCurText2 = ""
- hstTTLText1 = string.format(strFormat, "Haste[HPM]",RDSW.score.TTL_HST_HPM)
- hstTTLText2 = ""
- elseif RDSW.option.calcType == 3 then
- hstCurText1 = format(strFormat, "Haste[HPCT]",RDSW.score.CUR_HST_HPCT)
- hstCurText2 = ""
- hstTTLText1 = string.format(strFormat, "Haste[HPCT]",RDSW.score.TTL_HST_HPCT)
- hstTTLText2 = ""
- end
- outString1 = string.format("%-28s"
- .. strFormat
- .. strFormat
- .. "%s%s"
- .. strFormat
- .. strFormat,
- "Current",
- "Intellect", RDSW.score.CUR_SP,
- "Crit", RDSW.score.CUR_CRT,
- hstCurText1, hstCurText2,
- "Mastery", RDSW.score.CUR_MST,
- "Versatility", RDSW.score.CUR_VRS
- )
- outString2 = string.format("%-30s"
- .. strFormat
- .. strFormat
- .. "%s%s"
- .. strFormat
- .. strFormat,
- "Total",
- "Intellect", RDSW.score.TTL_SP,
- "Crit", RDSW.score.TTL_CRT,
- hstTTLText1, hstTTLText2,
- "Mastery", RDSW.score.TTL_MST,
- "Versatility", RDSW.score.TTL_VRS
- )
- RDSW_Display_Text1:SetText(outString1)
- RDSW_Display_Text2:SetText(outString2)
- end
- end
- --Updates text field on History Window Buttons
- function RDSW.updateHistoryPage(page)
- RDSW.historyPage = page
- local entryNum
- local outString
- for i = 1, historyButtonNum do
- entryNum = (RDSW.historyPage - 1) * historyButtonNum + i
- entry = RDSW.history[RDSW.historyEntryNum - entryNum + 1]
- if not entry then
- outString = "--No Session--"
- else
- outString = string.format("%7d -%12s: %22s [%s] %20s %8s",
- entryNum,
- RDSW.getDateFormat(entry.date),
- entry.encounter,
- entry.outcome,
- RDSW.getDungeonType(entry.dungeonmode),
- entry.duration)
- end
- _G["RDSW_History_Button_Font" .. i]:SetText(outString)
- end
- end
- --Display Frame
- local displayFrameObj = {
- fType = "FRAME",
- name = "RDSW_Display_Frame",
- parent = nil,
- anchor = nil,
- pointOnFrame = "CENTER",
- pointOnParent = nil,
- transcribe = nil, --Set All Points, ignores width, heigh, xoff, yoff, strata
- width = 210,
- height = 95,
- xOff = RDSW.option.displayXPos,
- yOff = RDSW.option.displayYPos,
- strata = "BACKGROUND",
- level = 7,
- drawLayer = nil,
- backdrop = {
- bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
- tile = false,
- tileSize = nil,
- edgeSize = 10
- },
- func = function(frameObj)
- local f = _G[frameObj.name]
- f:SetMovable(true)
- f:EnableMouse(true)
- f:SetScript("OnDragStart", f.StartMoving)
- f:SetScript("OnDragStop", f.StopMovingOrSizing)
- if RDSW.option.lock then
- f:SetAlpha(1)
- f:RegisterForDrag("LeftButton")
- else
- f:SetAlpha(0)
- f:RegisterForDrag()
- end
- end
- }
- --Display Text 1 and 2
- local displayTextObj1 = {
- fType = "TEXT",
- name = "RDSW_Display_Text1",
- parent = displayFrameObj.name,
- pointOnFrame = "LEFT",
- pointOnParent = "LEFT",
- width = 200,
- height = 300, --handeled by frameGen function
- text = nil,
- strata = nil,
- drawLayer = "OVERLAY",
- font = RDSW.vixarFont,
- fontSize = RDSW.option.displayFontSize, ---ADD FUNCTIONALITY TO UPDATE THIS FONTSIZE WHEN FONTSIZE IS UPDATED VIA GUI
- hJustify = "RIGHT",
- vJustify = nil,
- fontFlags = "OUTLINE",
- text = nil,
- func = nil
- }
- --Display Text 1 and 2
- local displayTextObj2 = {
- template = displayTextObj1,
- name = "RDSW_Display_Text2"
- }
- --Display Text 3
- local displayTextObj3 = {
- template = displayTextObj1,
- name = "RDSW_Display_Text3",
- width = 150,
- height = 10,
- hJustify = "CENTER",
- text = string.format("RDSW V: %.1f", RDSW.version),
- func = function()
- RDSW.SetDisplayTextPos()
- end
- }
- --Sets Orientation of Display Text
- function RDSW.SetDisplayTextPos()
- local frame = _G[displayFrameObj.name]
- if RDSW.option.displayOrientation == "Horizontal" then
- _G[displayTextObj1.name]:SetPoint("LEFT", frame, 0, 0)
- _G[displayTextObj2.name]:SetPoint("LEFT", frame, 175, 0)
- _G[displayTextObj3.name]:SetPoint("TOP", frame, 0, 10)
- elseif RDSW.option.displayOrientation == "Vertical" then
- _G[displayTextObj1.name]:SetPoint("LEFT", frame, 0, 0)
- _G[displayTextObj2.name]:SetPoint("LEFT", frame, 0, -100)
- _G[displayTextObj3.name]:SetPoint("TOP", frame, 0, 10)
- end
- end
- --Config Frame
- local configFrameObj = {
- fType = "FRAME",
- name = "RDSW_Config_Frame",
- parent = nil,
- anchor = nil,
- pointOnFrame = "CENTER",
- pointOnParent = nil,
- transcribe = nil, --Set All Points, ignores width, heigh, xoff, yoff, strata
- width = 900,
- height = 550,
- xOff = RDSW.option.configXPos,
- yOff = RDSW.option.configXPos,
- strata = "MEDIUM",
- level = 5,
- drawLayer = nil,
- backdrop = {
- bgFile="Interface\\Addons\\RDSW\\Media\\Images\\Green Forest" ,
- edgeFile="Interface\\DialogFrame\\UI-DialogBox-Border",
- tile = false,
- tileSize = nil,
- edgeSize = 10,
- insets = {left = 1, right = 1, top = 1, bottom = 1}
- },
- func = function(frameObj)
- local frame = _G[frameObj.name]
- frame:SetMovable(true)
- frame:EnableMouse(true)
- frame:SetScript("OnDragStart", frame.StartMoving)
- frame:SetScript("OnDragStop", frame.StopMovingOrSizing)
- frame:RegisterForDrag("LeftButton")
- end
- }
- --Directory Frame
- local dirFrameObj = {
- fType = "FRAME",
- name = "RDSW_Directory_Frame",
- parent = "RDSW_Config_Frame",
- anchor = nil,
- pointOnFrame = "TOPLEFT",
- pointOnParent = nil,
- width = 170,
- height = 170,
- xOff = 10,
- yOff = -10,
- strata = "MEDIUM",
- level = 10,
- drawLayer = nil,
- backdrop = {
- bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
- edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
- tile = false,
- tileSize = nil,
- edgeSize = 10
- }
- }
- --Active Window Frame
- local actFrameObj = {
- fType = "FRAME",
- name = "RDSW_Active_Window_Frame",
- parent = "RDSW_Config_Frame",
- anchor = nil,
- pointOnFrame = "TOPLEFT",
- pointOnParent = nil,
- width = 700,
- height = 350,
- xOff = 10,
- yOff = 10,
- strata = "MEDIUM",
- level = 10,
- drawLayer = nil,
- backdrop = {
- bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
- edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
- tile = false,
- tileSize = nil,
- edgeSize = 10
- },
- func = function(frameObj)
- local frame
- local parent = _G[frameObj.name]
- for k,v in ipairs(directoryItems) do
- frame = CreateFrame("Frame", "RDSW_" .. v .. "_Window_Frame", parent)
- frame:SetAllPoints(frameObj.name)
- frame:SetFrameLevel(12)
- frame:SetBackdrop({
- bgFile="Interface\\DialogFrame\\UI-DialogBox-Background",
- edgeFile="Interface\\DialogFrame\\UI-DialogBox-Border",
- tile = false,
- tileSize = nil,
- edgeSize = 10
- })
- end
- end
- }
- --Aux Frame
- local auxFrameObj = {
- fType = "FRAME",
- name = "RDSW_Aux_Frame",
- parent = "RDSW_Config_Frame",
- anchor = nil,
- pointOnFrame = "BOTTOMLEFT",
- pointOnParent = "BOTTOMLEFT",
- width = 880,
- height = 175,
- xOff = 10,
- yOff = 10,
- strata = "MEDIUM",
- level = 7,
- drawLayer = nil,
- backdrop = {
- bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
- edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
- tile = false,
- tileSize = nil,
- edgeSize = 10
- }
- }
- --Banner Texture
- local BannerFrameObj = {
- fType = "FRAME",
- name = "RDSW_Banner",
- parent = "RDSW_Settings_Window_Frame",
- anchor = nil,
- pointOnFrame = "TOP",
- pointOnParent = "CENTER",
- width = 300,
- height = 75,
- xOff = 0,
- yOff = 150,
- strata = "MEDIUM",
- level = 14,
- drawLayer = nil,
- backdrop = {
- bgFile = "Interface\\addons\\RDSW\\Media\\Images\\RDSW Banner",
- tile = false,
- tileSize = nil
- }
- }
- --Haste Display Type Dropdown
- local settings_DropDownObj1 = {
- fType = "BUTTON",
- name = "RDSW_Settings_DropDownObj1",
- parent = "RDSW_Settings_Window_Frame",
- anchor = nil,
- pointOnFrame = "CENTER",
- pointOnParent = nil,
- width = 100,
- buttonWidth = 124,
- height = 0,
- xOff = -210,
- yOff = 0,
- strata = "MEDIUM",
- level = 14,
- hJustify = "LEFT",
- droplist = {"Both", "HPM: Healing Per Mana", "HPCT: Healing Per Cast Time"},
- clickFunc = function(self, item)
- UIDropDownMenu_SetSelectedID(settings_DropDownObj1.name, self:GetID())
- for k,v in ipairs(settings_DropDownObj1.droplist) do
- if item == v then
- RDSW.option = k
- break;
- end
- end
- RDSW.updateDisplay()
- end,
- initFunc = function(self)
- local info = UIDropDownMenu_CreateInfo()
- for k,v in ipairs(settings_DropDownObj1.droplist) do
- info = UIDropDownMenu_CreateInfo()
- info.text = v
- info.value = v
- info.func = settings_DropDownObj1.clickFunc
- info.arg1 = v
- UIDropDownMenu_AddButton(info, 1)
- end
- end
- }
- --Haste Display Type Dropdown Text
- local settings_DropDown1_TextObj = {
- fType = "TEXT",
- name = "RDSW_settings_DropDownObj1_Text",
- parent = settings_DropDownObj1.name,
- pointOnFrame = "CENTER",
- pointOnParent = nil,
- width = 300,
- height = 75, --handeled by frameGen function
- xOff = 0,
- yOff = 25,
- text = "Haste Display:",
- drawLayer = "OVERLAY",
- fontSize = 12, ---ADD FUNCTIONALITY TO UPDATE THIS FONTSIZE WHEN FONTSIZE IS UPDATED VIA GUI
- hJustify = "CENTER",
- color = {1,1,1,1}
- }
- --Display Orientation Dropdown
- local settings_DropDownObj2 = {
- template = settings_DropDownObj1,
- name = "RDSW_Settings_DropDownObj2",
- xOff = -70,
- droplist = {"Horizontal", "Vertical"},
- clickFunc = function(self, item)
- UIDropDownMenu_SetSelectedID(settings_DropDownObj2.name, self:GetID())
- for k,v in ipairs(settings_DropDownObj2.droplist) do
- if item == v then
- RDSW.option.displayOrientation = v
- break;
- end
- end
- RDSW.updateDisplay()
- end,
- initFunc = function(self)
- local info = UIDropDownMenu_CreateInfo()
- for k,v in ipairs(settings_DropDownObj2.droplist) do
- info = UIDropDownMenu_CreateInfo()
- info.text = v
- info.value = v
- info.func = settings_DropDownObj2.clickFunc
- info.arg1 = v
- UIDropDownMenu_AddButton(info, 1)
- end
- end
- }
- --Display Orientation Dropdown Text
- local settings_DropDown2_TextObj = {
- template = settings_DropDown1_TextObj,
- name = "RDSW_settings_DropDownObj2_Text",
- text = "Orientation:",
- parent = settings_DropDownObj2.name
- }
- --Display Precision Dropdown
- local settings_DropDownObj3 = {
- template = settings_DropDownObj1,
- name = "RDSW_Settings_DropDownObj3",
- xOff = 70,
- droplist = {"0.123", "0.12", "0.1"},
- clickFunc = function(self, item)
- UIDropDownMenu_SetSelectedID(settings_DropDownObj3.name, self:GetID())
- for k,v in ipairs(settings_DropDownObj3.droplist) do
- if item == v then
- RDSW.option.displayPrecision = #settings_DropDownObj3.droplist - k + 1
- break;
- end
- end
- RDSW.updateDisplay()
- end,
- initFunc = function(self)
- local info = UIDropDownMenu_CreateInfo()
- for k,v in ipairs(settings_DropDownObj3.droplist) do
- info = UIDropDownMenu_CreateInfo()
- info.text = v
- info.value = v
- info.func = settings_DropDownObj3.clickFunc
- info.arg1 = v
- UIDropDownMenu_AddButton(info, 1)
- end
- end
- }
- --Display Precision Dropdown Text
- local settings_DropDown3_TextObj = {
- template = settings_DropDown1_TextObj,
- name = "RDSW_settings_DropDownObj3_Text",
- text = "Orientation:",
- parent = settings_DropDownObj3.name
- }
- --Font size Editbox
- local settings_EditBoxObj1 = {
- fType = "EDITBOX",
- name = "RDSW_Settings_EDITBOX1",
- parent = "RDSW_Settings_Window_Frame",
- anchor = nil,
- pointOnFrame = "CENTER",
- pointOnParent = nil,
- width = 40,
- height = 40,
- xOff = 210,
- yOff = 0,
- fontSize = 12,
- hJustify = "LEFT",
- boxAutoFocus = false,
- boxNumeric = true,
- numeric = RDSW.option.displayFontSize,
- enterPressedFunc = function()
- RDSW.option.displayFontSize = swfEditBox1:GetNumber()
- RDSW_Display_Text1:SetFont(RDSW.vixarFont, RDSW.option.displayFontSize, "OUTLINE")
- RDSW_Display_Text2:SetFont(RDSW.vixarFont, RDSW.option.displayFontSize, "OUTLINE")
- settings_EditBOxObj1.name:SetNumber(RDSW.option.displayFontSize)
- settings_EditBOxObj1.name:ClearFocus()
- end,
- escapePressedFunc = function()
- settings_EditBOxObj1.name:ClearFocus()
- end
- }
- --Font size Editbox Text
- local settings_EditBox1_TextObj = {
- fType = "TEXT",
- name = "RDSW_settings_EditBoxObj1_Text",
- parent = settings_EditBoxObj1.name,
- pointOnFrame = "CENTER",
- pointOnParent = nil,
- width = 150,
- height = 75, --handeled by frameGen function
- xOff = 0,
- yOff = 25,
- text = "Display Font Size:",
- drawLayer = "OVERLAY",
- fontSize = 12, ---ADD FUNCTIONALITY TO UPDATE THIS FONTSIZE WHEN FONTSIZE IS UPDATED VIA GUI
- hJustify = "CENTER",
- color = {1,1,1,1}
- }
- --Directory Buttons
- local directoryButtonFrameObj = {
- fType = "BUTTON",
- name = "RDSW_Directory_Button",
- parent = "RDSW_Directory_Frame",
- pointOnFrame = "TOPLEFT",
- pointOnParent = "TOPLEFT",
- width = 160,
- height = nil, --handeled by gen function
- xOff = 5,
- yOff = -5,
- strata = "MEDIUM",
- level = 10,
- drawLayer = nil,
- clickFunc = function(frameObj)
- RDSW.activeWindowCode = frameObj.arg1
- local frame
- for i = 1, frameNum do
- frame = _G[directoryButtonFrameObj.name .. i]
- if i == frameObj.arg1 then
- frame:SetNormalTexture(buttonPressedTexture)
- else
- frame:SetNormalTexture(buttonNormalTexture)
- end
- end
- for i,v in ipairs(#activeWindowList) do
- if RDSW.activeWindowCode == i then
- _G[v]:Show()
- else
- _G[v]:Hide()
- end
- end
- end,
- arg1 = nil
- }
- --Directory Button Text
- local directoryButtonTextObj = {
- fType = "TEXT",
- name = "RDSW_Directory_Button_Font",
- parent = "RDSW_Directory_Frame",
- pointOnFrame = "LEFT",
- pointOnParent = "LEFT",
- width = 160,
- height = nil, --handeled by gen function
- xOff = 10,
- yOff = 0,
- text = nil,
- strata = nil,
- drawLayer = "OVERLAY",
- font = RDSW.vixarFont,
- fontSize = 18,
- hJustify = "LEFT",
- vJustify = nil,
- fontFlags = "OUTLINE",
- }
- --History Button
- local historyButtonFrameObj = {
- fType = "BUTTON",
- name = "RDSW_History_Button",
- parent = "RDSW_History_Window_Frame",
- pointOnFrame = "TOPLEFT",
- pointOnParent = "TOPLEFT",
- width = 670,
- height = nil, --handeled by gen function
- xOff = 5,
- yOff = -5,
- strata = "MEDIUM",
- level = 10,
- drawLayer = nil,
- clickFunc = function(frameObj, frameNum)
- local frame
- for i = 1, frameNum do
- frame = _G[historyButtonFrameObj.name .. i]
- if i == frameObj.arg1 then
- frame:SetNormalTexture(buttonPressedTexture)
- else
- frame:SetNormalTexture(buttonNormalTexture)
- end
- end
- ----------------------------IMPLEMENT HISTORY WINDOW FUNCTIONS
- end,
- arg1 = nil
- }
- --History Button Text
- local historyButtonTextObj = {
- fType = "TEXT",
- name = "RDSW_History_Button_Font",
- parent = "RDSW_History_Window_Frame",
- pointOnFrame = "LEFT",
- pointOnParent = "LEFT",
- width = 670,
- height = nil, --handeled by gen function
- xOff = 10,
- yOff = 0,
- text = nil,
- strata = nil,
- drawLayer = "OVERLAY",
- font = RDSW.vixarFont,
- fontSize = 18,
- hJustify = "LEFT",
- vJustify = nil,
- fontFlags = "OUTLINE"
- }
- --Content Type checkboxes
- local settings_ContentEnabled_CheckBoxObj = {
- fType = "CHECKBOX",
- name = "RDSW_settings_ContentEnabled_CheckBox",
- parent = "RDSW_Settings_Window_Frame",
- anchor = nil,
- pointOnFrame = "CENTER",
- pointOnParent = nil,
- transcribe = nil, --Set All Points, ignores width, heigh, xoff, yoff, strata
- height = 25,
- width = 25,
- xOff = 10,
- yOff = 25,
- strata = "BACKGROUND",
- level = 7,
- drawLayer = nil,
- buttonSize = 25,
- backdrop = {
- bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
- tile = false,
- tileSize = nil,
- edgeSize = 10
- },
- checkedFunc = function(contentType)
- if _G["RDSW_settings_ContentEnabled_CheckBox"]:GetChecked() then
- contentType.enabled = false
- else
- contentType.enabled = true
- end
- RDSW.updateDisplay()
- end,
- arg1 = nil
- }
- --Content Type checkboxes Text
- local settings_CheckBox_TextObj = {
- fType = "TEXT",
- name = "RDSW_settings_ContentEnabled_CheckBox_Font",
- parent = settings_ContentEnabled_CheckBoxObj.name,
- pointOnFrame = "TOPLEFT",
- pointOnParent = "TOPLEFT",
- xOff = 28,
- yOff = 0,
- height = 50,
- text = nil,
- strata = nil,
- drawLayer = "OVERLAY",
- fontSize = 18,
- hJustify = "LEFT",
- vJustify = nil,
- fontFlags = "OUTLINE"
- }
- --Location Enabling checkboxes
- local settings_LocationEnabled_CheckBoxObj = {
- template = settings_ContentEnabled_CheckBoxObj,
- name = "RDSW_settings_LocationEnabled_CheckBox"
- }
- --Location Enabling checkboxes Text
- local settings_LocationEnabled_TextObj = {
- template = settings_CheckBox_TextObj,
- name = "RDSW_settings_LocationEnabled_CheckBox_Font"
- }
- --frameGen Calls
- ----Display
- RDSW.frameGen(displayFrameObj)
- RDSW.frameGen(displayTextObj1)
- RDSW.frameGen(displayTextObj2)
- RDSW.frameGen(displayTextObj3)
- ----Config
- RDSW.frameGen(configFrameObj)
- RDSW.frameGen(dirFrameObj)
- RDSW.frameGen(actFrameObj)
- RDSW.frameGen(auxFrameObj)
- RDSW.frameGen(BannerFrameObj)
- --Settings
- RDSW.frameGen(settings_DropDownObj1)
- RDSW.frameGen(settings_DropDown1_TextObj)
- RDSW.frameGen(settings_DropDownObj2)
- RDSW.frameGen(settings_DropDown2_TextObj)
- RDSW.frameGen(settings_DropDownObj3)
- RDSW.frameGen(settings_DropDown3_TextObj)
- RDSW.frameGen(settings_EditBoxObj1)
- RDSW.frameGen(settings_EditBox1_TextObj)
- ----Directory and History Buttons
- indexGen(directoryItems, directoryButtonFrameObj, directoryButtonTextObj, 160)
- indexGen(historyButtonNum, historyButtonFrameObj, historyButtonTextObj, 338)
- ----Setting Checkboxs
- checkBoxGen(contentTypeItems,
- settings_ContentEnabled_CheckBoxObj,
- settings_CheckBox_TextObj,
- RDSW.enabled, "Content Type:",
- 300, 80, -175, -125, 2)
- checkBoxGen(locationEnabledItems,
- settings_LocationEnabled_CheckBoxObj,
- settings_LocationEnabled_TextObj,
- RDSW.enabled, "Show Display:",
- 300, 80, 175, -125, 2)
- --Startup State Function calls
- RDSW.updateHistoryPage(RDSW.historyPage)
- RDSW.SetDisplayTextPos()
- RDSW.updateDisplay()
- --Clicks initial button.
- _G[directoryButtonFrameObj.name .. RDSW.activeWindowCode]:Click(_G[directoryButtonFrameObj.name .. RDSW.activeWindowCode])
- --Set Config Hide/Show stat on load.
- if not RDSW.option.configToggle then
- RDSW_Config_Frame:Hide()
- end
- --Implement aux frame display on history window button press
- --Implement turn page button and text field
- --Implement search for date on history
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement