Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.50 KB | None | 0 0
  1. --Author Manaleaf - Sargeras
  2. --GUI for RDSW
  3.  
  4. local startupFrame = CreateFrame("FRAME")
  5. startupFrame:RegisterEvent("ADDON_LOADED")
  6. startupFrame:SetScript("OnEvent", function(self, event, addon)
  7. if addon == "RDSW" then
  8. --GUI local variables
  9. local buttonNormalTexture = "Interface\\Addons\\RDSW\\Media\\Images\\Button Unpressed Leaf Texture"
  10. local buttonHighlightTexture = "Interface\\Addons\\RDSW\\Media\\Images\\Button Pressed Glow"
  11. local buttonPressedTexture = "Interface\\Addons\\RDSW\\Media\\Images\\Button Pressed Glow"
  12. local directoryItems = {"Settings", "History", "FAQ", "Utility"}
  13. local contentTypeItems = {"raid", "mythicdungeon", "dungeonnonmythic"}
  14. local locationEnabledItems = {"incombat", "bossencounter", "outofcombat"}
  15. local historyButtonNum = 10
  16. local activeWindowList = {"RDSW_Settings_Window_Frame", "RDSW_History_Window_Frame",
  17. "RDSW_FAQ_Window_Frame", "RDSW_Utility_Window_Frame"}
  18. local historyCap = 1000
  19.  
  20. --Individual Frame Generator
  21. function RDSW.frameGen(frameAttr, ...)
  22. local frame
  23. local parent
  24. local frameObj = {}
  25. --Copy template
  26. if frameAttr.template then
  27. for k,v in pairs(frameAttr.template) do
  28. frameObj[k] = v
  29. end
  30. end
  31. --Overwrite template with object attributes
  32. for k,v in pairs(frameAttr) do
  33. frameObj[k] = v
  34. end
  35. --Auxiliary attribute overwrite
  36. if ... then
  37. for k,v in pairs(...) do
  38. frameObj[k] = v
  39. end
  40. end
  41. --Defaults
  42. if not frameObj.xOff then frameObj.xOff = 0 end
  43. if not frameObj.yOff then frameObj.yOff = 0 end
  44. if not frameObj.width then frameObj.width = 0 end
  45. if not frameObj.height then frameObj.height = 0 end
  46. if frameObj.parent then parent = _G[frameObj.parent] end
  47.  
  48. if frameObj.fType == "FRAME" then
  49. frame = CreateFrame("Frame", frameObj.name, parent)
  50. elseif frameObj.fType == "TEXT" then
  51. frame = parent:CreateFontString(frameObj.name)
  52. --Text Defaults
  53. if not frameObj.font then frameObj.font = RDSW.vixarFont end
  54. if not frameObj.fontSize then frameObj.fontSize = 18 end
  55. if not frameObj.fontFlags then frameObj.fontFlags = "OUTLINE" end
  56.  
  57. frame:SetFont(frameObj.font, frameObj.fontSize, frameObj.fontFlags)
  58. if frameObj.hJustify then frame:SetJustifyH(frameObj.hJustify) end
  59. if frameObj.vJustify then frame:SetJustifyV(frameObj.vJustify) end
  60. if frameObj.text then frame:SetText(frameObj.text) end
  61. elseif frameObj.fType == "BUTTON" then
  62. frame = CreateFrame("Button", frameObj.name, parent)
  63. if frameObj.normalTexture then --set Normal Texture
  64. frame:SetNormalTexture(frameObj.normalTexture)
  65. else
  66. frame:SetNormalTexture(buttonNormalTexture)
  67. end
  68. if frameObj.highlightTexture then --set Highlight Texture
  69. frame:SetHighlightTexture(frameObj.highlightTexture)
  70. else
  71. frame:SetHighlightTexture(buttonHighlightTexture)
  72. end
  73. if frameObj.pushedTexture then --set Pressed Texture
  74. frame:SetPushedTexture(frameObj.pushedTexture)
  75. else
  76. frame:SetPushedTexture(buttonPressedTexture)
  77. end
  78. frame:SetScript("OnMouseUp", function() frameObj.clickFunc(frameObj) end)
  79. elseif frameObj.fType == "DROPDOWN" then
  80. frame = CreateFrame("Button", frameObj.name, parent, "UIDropDownMenuTemplate")
  81. frame:ClearAllPoints()
  82. if frameObj.initFunc then UIDropDownMenu_Initialize(frame, frameObj.initFunc) end
  83. UIDropDownMenu_SetWidth(frame, frameObj.width);
  84. UIDropDownMenu_SetButtonWidth(frame, frameObj.buttonWidth)
  85. UIDropDownMenu_SetSelectedID(frame, 1)
  86. if frameObj.hJustify then UIDropDownMenu_JustifyText(frame, frameObj.hJustify) end
  87. elseif frameObj.fType == "CHECKBOX" then
  88. frame = CreateFrame("CheckButton", frameObj.name, parent, "UICheckButtonTemplate")
  89. frame:SetScript("OnMouseUp", function() frameObj.checkedFunc(frameObj.arg1) end)
  90. if contentType[v].enabled == true then
  91. checkboxFrame:SetChecked(true)
  92. else
  93. checkboxFrame:SetChecked(false)
  94. end
  95. elseif frameObj.fType == "EDITBOX" then
  96. frame = CreateFrame("EditBox", frameObj.name, parent, "InputBoxTemplate")
  97. if frameObj.boxAutoFocus then frame:SetAutoFocus(frameObj.boxAutoFocus) end
  98. if boxNumeric then frame:SetNumeric() end
  99. if frameObj.numeric then frame:SetNumber(frameObj.numeric) end
  100. if enterPressedFunc then frame:SetScript("OnEnterPressed", enterPressedFunc) end
  101. if escapePressedFunc then frame:SetScript("OnEscapePressed", escapePressedFunc) end
  102. frame:SetAutoFocus(false)
  103. frame:ClearFocus()
  104. end
  105.  
  106. if frameObj.transcribe then
  107. frame.SetAllPoints(frameObj.transcribe)
  108. else
  109. if frameObj.pointOnParent then
  110. frame:SetPoint(frameObj.pointOnFrame, frameObj.parent, frameObj.pointOnParent, frameObj.xOff, frameObj.yOff)
  111. else --omit pointOnParent
  112. frame:SetPoint(frameObj.pointOnFrame, frameObj.parent, frameObj.xOff, frameObj.yOff)
  113. end
  114. if frameObj.pointOnParent then
  115. frame:SetPoint(frameObj.pointOnFrame, frameObj.parent, frameObj.pointOnParent, frameObj.xOff, frameObj.yOff)
  116. else --omit pointOnParent
  117. frame:SetPoint(frameObj.pointOnFrame, frameObj.parent, frameObj.xOff, frameObj.yOff)
  118. end
  119.  
  120. frame:SetSize(frameObj.width, frameObj.height)
  121.  
  122. if frameObj.strata then
  123. frame:SetFrameStrata(frameObj.strata)
  124. end
  125. if frameObj.level then
  126. frame:SetFrameLevel(frameObj.level)
  127. end
  128. end
  129.  
  130. if frameObj.backdrop then
  131. frame:SetBackdrop(frameObj.backdrop)
  132. end
  133.  
  134. if frameObj.drawLayer then
  135. frame:SetDrawLayer(frameObj.drawLayer)
  136. end
  137. if frameObj.func then
  138. frameObj.func(frameObj)
  139. end
  140.  
  141. if frameObj.color then
  142. frame:SetTextColor(frameObj.color[1], frameObj.color[2], frameObj.color[3], frameObj.color[4])
  143. end
  144. return frame
  145. end
  146.  
  147. --Creates a index style set of button frames.
  148. local function indexGen(items, frameObj, textObj, ttlHeight)
  149. if type(items) == "number" then
  150. local height = ttlHeight / items
  151. for i = 1, items do
  152. RDSW.frameGen(frameObj, {["name"] = frameObj.name .. i, ["height"] = height, arg1 = i})
  153. if not textObj.parent then textObj.parent = frameObj.name end
  154. RDSW.frameGen(textObj, {["name"] = textObj.name .. i, ["height"] = height})
  155. end
  156. elseif type(items) == "table" then
  157. local height = ttlHeight / #items
  158. local frame = _G[parent]
  159. for i,v in ipairs(items) do
  160. RDSW.frameGen(frameObj, {["name"] = frameObj.name .. i, ["height"] = height, arg1 = i})
  161. if not textObj.parent then textObj.parent = frameObj.name end
  162. RDSW.frameGen(textObj, {["name"] = textObj.name .. i, ["height"] = height, text = v})
  163. end
  164. end
  165. end
  166.  
  167. --Creates a row-col box style set of checkbox frames.
  168. local function checkBoxGen(items, frameObj, textObj, contentType, title, ttlWidth, ttlHeight, frameXPos, frameYPos, cols)
  169. local indent = 10
  170. local rows = math.ceil(#items / cols)
  171. local height = (ttlHeight - frameObj.height - indent * 2) / (rows-1)
  172. local width = (ttlWidth - frameObj.width - indent * 2) / (cols)
  173.  
  174. --Create background Frame
  175. local frame = CreateFrame("FRAME", frameObj.name .. "_Frame", _G[frameObj.parent])
  176. frame:SetPoint(frameObj.pointOnFrame, frameObj.parent, frameXPos, frameYPos)
  177. frame:SetSize(ttlWidth, ttlHeight)
  178. frame:SetBackdrop({
  179. edgeFile="Interface\\DialogFrame\\UI-DialogBox-Border",
  180. tile = false,
  181. tileSize = nil,
  182. edgeSize = 10,
  183. insets = {left = 1, right = 1, top = 1, bottom = 1}
  184. })
  185. RDSW.frameGen(textObj, {text = title, ["width"] = ttlWidth})
  186. local checkboxFrame, colPos, rowPos
  187. for i,v in ipairs(items) do
  188. colPos = mod(i-1, cols) * width + indent
  189. rowPos = math.floor((i-1)/rows) * height * -1 - indent
  190. checkboxFrame = RDSW.frameGen(frameObj,
  191. {--Individual checkbox attributes
  192. name = frameObj.name .. contentType[v].id,
  193. parent = frame,
  194. xOff = colPos,
  195. yOff = rowPos,
  196. ["height"] = height,
  197. ["width"] = width,
  198. arg1 = contentType[v]
  199. }),
  200. RDSW.frameGen(textObj,
  201. { --Individual checkbox title attributes
  202. parent = checkboxFrame,
  203. ["height"] = height,
  204. ["width"] = width,
  205. text = contentType.name
  206. })
  207.  
  208. end
  209. end
  210.  
  211. --Updates Display Frame Text
  212. function RDSW.updateDisplay()
  213. ------------------------Break update display into RDSW.updateDisplay() and RDSW.updateDisplayVisibility()
  214. local displayShown = RDSW_Display_Frame:IsVisible()
  215. if RDSW.inCombat then
  216. if RDSW.enabled["incombat"].enabled and not displayShown and RDSW.inCombat then
  217. RDSW_Display_Frame:Show()
  218. elseif not RDSW.enabled["incombat"].enabled and displayShown and RDSW.inCombat then
  219. RDSW_Display_Frame:Hide()
  220. end
  221. else --if not in combat
  222. if RDSW.enabled["outofcombat"].enabled and not displayShown and not RDSW.inCombat then
  223. RDSW_Display_Frame:Show()
  224. elseif not RDSW.enabled["outofcombat"].enabled and displayShown and not RDSW.inCombat then
  225. RDSW_Display_Frame:Hide()
  226. end
  227. end
  228. if RDSW.activeEncounter then
  229. if RDSW.enabled["bossencounter"].enabled and not displayShown and RDSW.activeEncounter then
  230. RDSW_Display_Frame:Show()
  231. elseif not RDSW.enabled["bossencounter"].enabled and displayShown and RDSW.activeEncounter then
  232. RDSW_Display_Frame:Hide()
  233. end
  234. end
  235. --------------------
  236. if displayShown then
  237. local strFormat = "\n%15s: %-5." .. tostring(RDSW.option.displayPrecision) .. "f"
  238. local outString, hstCurText1, hstCurText2, hstTTLText1, hstTTLText2
  239. if RDSW.option.calcType == 1 then
  240. hstCurText1 = string.format(strFormat, "Haste[HPM]", RDSW.score.CUR_HST_HPM)
  241. hstCurText2 = string.format(strFormat, "Haste[HPCT]",RDSW.score.CUR_HST_HPCT)
  242. hstTTLText1 = string.format(strFormat, "Haste[HPM]",RDSW.score.TTL_HST_HPM)
  243. hstTTLText2 = string.format(strFormat, "Haste[HPCT]",RDSW.score.TTL_HST_HPCT)
  244. elseif RDSW.option.calcType == 2 then
  245. hstCurText1 = string.format(strFormat, "Haste[HPM]", RDSW.score.CUR_HST_HPM)
  246. hstCurText2 = ""
  247. hstTTLText1 = string.format(strFormat, "Haste[HPM]",RDSW.score.TTL_HST_HPM)
  248. hstTTLText2 = ""
  249. elseif RDSW.option.calcType == 3 then
  250. hstCurText1 = format(strFormat, "Haste[HPCT]",RDSW.score.CUR_HST_HPCT)
  251. hstCurText2 = ""
  252. hstTTLText1 = string.format(strFormat, "Haste[HPCT]",RDSW.score.TTL_HST_HPCT)
  253. hstTTLText2 = ""
  254. end
  255. outString1 = string.format("%-28s"
  256. .. strFormat
  257. .. strFormat
  258. .. "%s%s"
  259. .. strFormat
  260. .. strFormat,
  261. "Current",
  262. "Intellect", RDSW.score.CUR_SP,
  263. "Crit", RDSW.score.CUR_CRT,
  264. hstCurText1, hstCurText2,
  265. "Mastery", RDSW.score.CUR_MST,
  266. "Versatility", RDSW.score.CUR_VRS
  267. )
  268. outString2 = string.format("%-30s"
  269. .. strFormat
  270. .. strFormat
  271. .. "%s%s"
  272. .. strFormat
  273. .. strFormat,
  274. "Total",
  275. "Intellect", RDSW.score.TTL_SP,
  276. "Crit", RDSW.score.TTL_CRT,
  277. hstTTLText1, hstTTLText2,
  278. "Mastery", RDSW.score.TTL_MST,
  279. "Versatility", RDSW.score.TTL_VRS
  280. )
  281. RDSW_Display_Text1:SetText(outString1)
  282. RDSW_Display_Text2:SetText(outString2)
  283. end
  284.  
  285. end
  286.  
  287. --Updates text field on History Window Buttons
  288. function RDSW.updateHistoryPage(page)
  289. RDSW.historyPage = page
  290. local entryNum
  291. local outString
  292. for i = 1, historyButtonNum do
  293. entryNum = (RDSW.historyPage - 1) * historyButtonNum + i
  294. entry = RDSW.history[RDSW.historyEntryNum - entryNum + 1]
  295. if not entry then
  296. outString = "--No Session--"
  297. else
  298. outString = string.format("%7d -%12s: %22s [%s] %20s %8s",
  299. entryNum,
  300. RDSW.getDateFormat(entry.date),
  301. entry.encounter,
  302. entry.outcome,
  303. RDSW.getDungeonType(entry.dungeonmode),
  304. entry.duration)
  305. end
  306.  
  307. _G["RDSW_History_Button_Font" .. i]:SetText(outString)
  308. end
  309. end
  310.  
  311. --Display Frame
  312. local displayFrameObj = {
  313. fType = "FRAME",
  314. name = "RDSW_Display_Frame",
  315. parent = nil,
  316. anchor = nil,
  317. pointOnFrame = "CENTER",
  318. pointOnParent = nil,
  319. transcribe = nil, --Set All Points, ignores width, heigh, xoff, yoff, strata
  320. width = 210,
  321. height = 95,
  322. xOff = RDSW.option.displayXPos,
  323. yOff = RDSW.option.displayYPos,
  324. strata = "BACKGROUND",
  325. level = 7,
  326. drawLayer = nil,
  327. backdrop = {
  328. bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
  329. tile = false,
  330. tileSize = nil,
  331. edgeSize = 10
  332. },
  333. func = function(frameObj)
  334. local f = _G[frameObj.name]
  335. f:SetMovable(true)
  336. f:EnableMouse(true)
  337. f:SetScript("OnDragStart", f.StartMoving)
  338. f:SetScript("OnDragStop", f.StopMovingOrSizing)
  339. if RDSW.option.lock then
  340. f:SetAlpha(1)
  341. f:RegisterForDrag("LeftButton")
  342. else
  343. f:SetAlpha(0)
  344. f:RegisterForDrag()
  345. end
  346. end
  347. }
  348.  
  349. --Display Text 1 and 2
  350. local displayTextObj1 = {
  351. fType = "TEXT",
  352. name = "RDSW_Display_Text1",
  353. parent = displayFrameObj.name,
  354. pointOnFrame = "LEFT",
  355. pointOnParent = "LEFT",
  356. width = 200,
  357. height = 300, --handeled by frameGen function
  358. text = nil,
  359. strata = nil,
  360. drawLayer = "OVERLAY",
  361. font = RDSW.vixarFont,
  362. fontSize = RDSW.option.displayFontSize, ---ADD FUNCTIONALITY TO UPDATE THIS FONTSIZE WHEN FONTSIZE IS UPDATED VIA GUI
  363. hJustify = "RIGHT",
  364. vJustify = nil,
  365. fontFlags = "OUTLINE",
  366. text = nil,
  367. func = nil
  368. }
  369.  
  370. --Display Text 1 and 2
  371. local displayTextObj2 = {
  372. template = displayTextObj1,
  373. name = "RDSW_Display_Text2"
  374. }
  375.  
  376. --Display Text 3
  377. local displayTextObj3 = {
  378. template = displayTextObj1,
  379. name = "RDSW_Display_Text3",
  380. width = 150,
  381. height = 10,
  382. hJustify = "CENTER",
  383. text = string.format("RDSW V: %.1f", RDSW.version),
  384. func = function()
  385. RDSW.SetDisplayTextPos()
  386. end
  387. }
  388.  
  389. --Sets Orientation of Display Text
  390. function RDSW.SetDisplayTextPos()
  391. local frame = _G[displayFrameObj.name]
  392. if RDSW.option.displayOrientation == "Horizontal" then
  393. _G[displayTextObj1.name]:SetPoint("LEFT", frame, 0, 0)
  394. _G[displayTextObj2.name]:SetPoint("LEFT", frame, 175, 0)
  395. _G[displayTextObj3.name]:SetPoint("TOP", frame, 0, 10)
  396. elseif RDSW.option.displayOrientation == "Vertical" then
  397. _G[displayTextObj1.name]:SetPoint("LEFT", frame, 0, 0)
  398. _G[displayTextObj2.name]:SetPoint("LEFT", frame, 0, -100)
  399. _G[displayTextObj3.name]:SetPoint("TOP", frame, 0, 10)
  400. end
  401. end
  402.  
  403. --Config Frame
  404. local configFrameObj = {
  405. fType = "FRAME",
  406. name = "RDSW_Config_Frame",
  407. parent = nil,
  408. anchor = nil,
  409. pointOnFrame = "CENTER",
  410. pointOnParent = nil,
  411. transcribe = nil, --Set All Points, ignores width, heigh, xoff, yoff, strata
  412. width = 900,
  413. height = 550,
  414. xOff = RDSW.option.configXPos,
  415. yOff = RDSW.option.configXPos,
  416. strata = "MEDIUM",
  417. level = 5,
  418. drawLayer = nil,
  419. backdrop = {
  420. bgFile="Interface\\Addons\\RDSW\\Media\\Images\\Green Forest" ,
  421. edgeFile="Interface\\DialogFrame\\UI-DialogBox-Border",
  422. tile = false,
  423. tileSize = nil,
  424. edgeSize = 10,
  425. insets = {left = 1, right = 1, top = 1, bottom = 1}
  426. },
  427. func = function(frameObj)
  428. local frame = _G[frameObj.name]
  429. frame:SetMovable(true)
  430. frame:EnableMouse(true)
  431. frame:SetScript("OnDragStart", frame.StartMoving)
  432. frame:SetScript("OnDragStop", frame.StopMovingOrSizing)
  433. frame:RegisterForDrag("LeftButton")
  434. end
  435. }
  436.  
  437. --Directory Frame
  438. local dirFrameObj = {
  439. fType = "FRAME",
  440. name = "RDSW_Directory_Frame",
  441. parent = "RDSW_Config_Frame",
  442. anchor = nil,
  443. pointOnFrame = "TOPLEFT",
  444. pointOnParent = nil,
  445. width = 170,
  446. height = 170,
  447. xOff = 10,
  448. yOff = -10,
  449. strata = "MEDIUM",
  450. level = 10,
  451. drawLayer = nil,
  452. backdrop = {
  453. bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
  454. edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
  455. tile = false,
  456. tileSize = nil,
  457. edgeSize = 10
  458. }
  459. }
  460.  
  461. --Active Window Frame
  462. local actFrameObj = {
  463. fType = "FRAME",
  464. name = "RDSW_Active_Window_Frame",
  465. parent = "RDSW_Config_Frame",
  466. anchor = nil,
  467. pointOnFrame = "TOPLEFT",
  468. pointOnParent = nil,
  469. width = 700,
  470. height = 350,
  471. xOff = 10,
  472. yOff = 10,
  473. strata = "MEDIUM",
  474. level = 10,
  475. drawLayer = nil,
  476. backdrop = {
  477. bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
  478. edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
  479. tile = false,
  480. tileSize = nil,
  481. edgeSize = 10
  482. },
  483. func = function(frameObj)
  484. local frame
  485. local parent = _G[frameObj.name]
  486. for k,v in ipairs(directoryItems) do
  487. frame = CreateFrame("Frame", "RDSW_" .. v .. "_Window_Frame", parent)
  488. frame:SetAllPoints(frameObj.name)
  489. frame:SetFrameLevel(12)
  490. frame:SetBackdrop({
  491. bgFile="Interface\\DialogFrame\\UI-DialogBox-Background",
  492. edgeFile="Interface\\DialogFrame\\UI-DialogBox-Border",
  493. tile = false,
  494. tileSize = nil,
  495. edgeSize = 10
  496. })
  497. end
  498. end
  499. }
  500.  
  501. --Aux Frame
  502. local auxFrameObj = {
  503. fType = "FRAME",
  504. name = "RDSW_Aux_Frame",
  505. parent = "RDSW_Config_Frame",
  506. anchor = nil,
  507. pointOnFrame = "BOTTOMLEFT",
  508. pointOnParent = "BOTTOMLEFT",
  509. width = 880,
  510. height = 175,
  511. xOff = 10,
  512. yOff = 10,
  513. strata = "MEDIUM",
  514. level = 7,
  515. drawLayer = nil,
  516. backdrop = {
  517. bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
  518. edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
  519. tile = false,
  520. tileSize = nil,
  521. edgeSize = 10
  522. }
  523. }
  524.  
  525. --Banner Texture
  526. local BannerFrameObj = {
  527. fType = "FRAME",
  528. name = "RDSW_Banner",
  529. parent = "RDSW_Settings_Window_Frame",
  530. anchor = nil,
  531. pointOnFrame = "TOP",
  532. pointOnParent = "CENTER",
  533. width = 300,
  534. height = 75,
  535. xOff = 0,
  536. yOff = 150,
  537. strata = "MEDIUM",
  538. level = 14,
  539. drawLayer = nil,
  540. backdrop = {
  541. bgFile = "Interface\\addons\\RDSW\\Media\\Images\\RDSW Banner",
  542. tile = false,
  543. tileSize = nil
  544. }
  545. }
  546.  
  547. --Haste Display Type Dropdown
  548. local settings_DropDownObj1 = {
  549. fType = "BUTTON",
  550. name = "RDSW_Settings_DropDownObj1",
  551. parent = "RDSW_Settings_Window_Frame",
  552. anchor = nil,
  553. pointOnFrame = "CENTER",
  554. pointOnParent = nil,
  555. width = 100,
  556. buttonWidth = 124,
  557. height = 0,
  558. xOff = -210,
  559. yOff = 0,
  560. strata = "MEDIUM",
  561. level = 14,
  562. hJustify = "LEFT",
  563. droplist = {"Both", "HPM: Healing Per Mana", "HPCT: Healing Per Cast Time"},
  564. clickFunc = function(self, item)
  565. UIDropDownMenu_SetSelectedID(settings_DropDownObj1.name, self:GetID())
  566. for k,v in ipairs(settings_DropDownObj1.droplist) do
  567. if item == v then
  568. RDSW.option = k
  569. break;
  570. end
  571. end
  572. RDSW.updateDisplay()
  573. end,
  574. initFunc = function(self)
  575. local info = UIDropDownMenu_CreateInfo()
  576. for k,v in ipairs(settings_DropDownObj1.droplist) do
  577. info = UIDropDownMenu_CreateInfo()
  578. info.text = v
  579. info.value = v
  580. info.func = settings_DropDownObj1.clickFunc
  581. info.arg1 = v
  582. UIDropDownMenu_AddButton(info, 1)
  583. end
  584. end
  585. }
  586.  
  587. --Haste Display Type Dropdown Text
  588. local settings_DropDown1_TextObj = {
  589. fType = "TEXT",
  590. name = "RDSW_settings_DropDownObj1_Text",
  591. parent = settings_DropDownObj1.name,
  592. pointOnFrame = "CENTER",
  593. pointOnParent = nil,
  594. width = 300,
  595. height = 75, --handeled by frameGen function
  596. xOff = 0,
  597. yOff = 25,
  598. text = "Haste Display:",
  599. drawLayer = "OVERLAY",
  600. fontSize = 12, ---ADD FUNCTIONALITY TO UPDATE THIS FONTSIZE WHEN FONTSIZE IS UPDATED VIA GUI
  601. hJustify = "CENTER",
  602. color = {1,1,1,1}
  603. }
  604.  
  605. --Display Orientation Dropdown
  606. local settings_DropDownObj2 = {
  607. template = settings_DropDownObj1,
  608. name = "RDSW_Settings_DropDownObj2",
  609. xOff = -70,
  610. droplist = {"Horizontal", "Vertical"},
  611. clickFunc = function(self, item)
  612. UIDropDownMenu_SetSelectedID(settings_DropDownObj2.name, self:GetID())
  613. for k,v in ipairs(settings_DropDownObj2.droplist) do
  614. if item == v then
  615. RDSW.option.displayOrientation = v
  616. break;
  617. end
  618. end
  619. RDSW.updateDisplay()
  620. end,
  621. initFunc = function(self)
  622. local info = UIDropDownMenu_CreateInfo()
  623. for k,v in ipairs(settings_DropDownObj2.droplist) do
  624. info = UIDropDownMenu_CreateInfo()
  625. info.text = v
  626. info.value = v
  627. info.func = settings_DropDownObj2.clickFunc
  628. info.arg1 = v
  629. UIDropDownMenu_AddButton(info, 1)
  630. end
  631. end
  632. }
  633.  
  634. --Display Orientation Dropdown Text
  635. local settings_DropDown2_TextObj = {
  636. template = settings_DropDown1_TextObj,
  637. name = "RDSW_settings_DropDownObj2_Text",
  638. text = "Orientation:",
  639. parent = settings_DropDownObj2.name
  640. }
  641.  
  642. --Display Precision Dropdown
  643. local settings_DropDownObj3 = {
  644. template = settings_DropDownObj1,
  645. name = "RDSW_Settings_DropDownObj3",
  646. xOff = 70,
  647. droplist = {"0.123", "0.12", "0.1"},
  648. clickFunc = function(self, item)
  649. UIDropDownMenu_SetSelectedID(settings_DropDownObj3.name, self:GetID())
  650. for k,v in ipairs(settings_DropDownObj3.droplist) do
  651. if item == v then
  652. RDSW.option.displayPrecision = #settings_DropDownObj3.droplist - k + 1
  653. break;
  654. end
  655. end
  656. RDSW.updateDisplay()
  657. end,
  658. initFunc = function(self)
  659. local info = UIDropDownMenu_CreateInfo()
  660. for k,v in ipairs(settings_DropDownObj3.droplist) do
  661. info = UIDropDownMenu_CreateInfo()
  662. info.text = v
  663. info.value = v
  664. info.func = settings_DropDownObj3.clickFunc
  665. info.arg1 = v
  666. UIDropDownMenu_AddButton(info, 1)
  667. end
  668. end
  669. }
  670.  
  671. --Display Precision Dropdown Text
  672. local settings_DropDown3_TextObj = {
  673. template = settings_DropDown1_TextObj,
  674. name = "RDSW_settings_DropDownObj3_Text",
  675. text = "Orientation:",
  676. parent = settings_DropDownObj3.name
  677. }
  678.  
  679. --Font size Editbox
  680. local settings_EditBoxObj1 = {
  681. fType = "EDITBOX",
  682. name = "RDSW_Settings_EDITBOX1",
  683. parent = "RDSW_Settings_Window_Frame",
  684. anchor = nil,
  685. pointOnFrame = "CENTER",
  686. pointOnParent = nil,
  687. width = 40,
  688. height = 40,
  689. xOff = 210,
  690. yOff = 0,
  691. fontSize = 12,
  692. hJustify = "LEFT",
  693. boxAutoFocus = false,
  694. boxNumeric = true,
  695. numeric = RDSW.option.displayFontSize,
  696. enterPressedFunc = function()
  697. RDSW.option.displayFontSize = swfEditBox1:GetNumber()
  698. RDSW_Display_Text1:SetFont(RDSW.vixarFont, RDSW.option.displayFontSize, "OUTLINE")
  699. RDSW_Display_Text2:SetFont(RDSW.vixarFont, RDSW.option.displayFontSize, "OUTLINE")
  700. settings_EditBOxObj1.name:SetNumber(RDSW.option.displayFontSize)
  701. settings_EditBOxObj1.name:ClearFocus()
  702. end,
  703. escapePressedFunc = function()
  704. settings_EditBOxObj1.name:ClearFocus()
  705. end
  706. }
  707.  
  708. --Font size Editbox Text
  709. local settings_EditBox1_TextObj = {
  710. fType = "TEXT",
  711. name = "RDSW_settings_EditBoxObj1_Text",
  712. parent = settings_EditBoxObj1.name,
  713. pointOnFrame = "CENTER",
  714. pointOnParent = nil,
  715. width = 150,
  716. height = 75, --handeled by frameGen function
  717. xOff = 0,
  718. yOff = 25,
  719. text = "Display Font Size:",
  720. drawLayer = "OVERLAY",
  721. fontSize = 12, ---ADD FUNCTIONALITY TO UPDATE THIS FONTSIZE WHEN FONTSIZE IS UPDATED VIA GUI
  722. hJustify = "CENTER",
  723. color = {1,1,1,1}
  724. }
  725.  
  726. --Directory Buttons
  727. local directoryButtonFrameObj = {
  728. fType = "BUTTON",
  729. name = "RDSW_Directory_Button",
  730. parent = "RDSW_Directory_Frame",
  731. pointOnFrame = "TOPLEFT",
  732. pointOnParent = "TOPLEFT",
  733. width = 160,
  734. height = nil, --handeled by gen function
  735. xOff = 5,
  736. yOff = -5,
  737. strata = "MEDIUM",
  738. level = 10,
  739. drawLayer = nil,
  740. clickFunc = function(frameObj)
  741. RDSW.activeWindowCode = frameObj.arg1
  742. local frame
  743. for i = 1, frameNum do
  744. frame = _G[directoryButtonFrameObj.name .. i]
  745. if i == frameObj.arg1 then
  746. frame:SetNormalTexture(buttonPressedTexture)
  747. else
  748. frame:SetNormalTexture(buttonNormalTexture)
  749. end
  750. end
  751.  
  752. for i,v in ipairs(#activeWindowList) do
  753. if RDSW.activeWindowCode == i then
  754. _G[v]:Show()
  755. else
  756. _G[v]:Hide()
  757. end
  758. end
  759. end,
  760. arg1 = nil
  761. }
  762.  
  763. --Directory Button Text
  764. local directoryButtonTextObj = {
  765. fType = "TEXT",
  766. name = "RDSW_Directory_Button_Font",
  767. parent = "RDSW_Directory_Frame",
  768. pointOnFrame = "LEFT",
  769. pointOnParent = "LEFT",
  770. width = 160,
  771. height = nil, --handeled by gen function
  772. xOff = 10,
  773. yOff = 0,
  774. text = nil,
  775. strata = nil,
  776. drawLayer = "OVERLAY",
  777. font = RDSW.vixarFont,
  778. fontSize = 18,
  779. hJustify = "LEFT",
  780. vJustify = nil,
  781. fontFlags = "OUTLINE",
  782. }
  783.  
  784.  
  785. --History Button
  786. local historyButtonFrameObj = {
  787. fType = "BUTTON",
  788. name = "RDSW_History_Button",
  789. parent = "RDSW_History_Window_Frame",
  790. pointOnFrame = "TOPLEFT",
  791. pointOnParent = "TOPLEFT",
  792. width = 670,
  793. height = nil, --handeled by gen function
  794. xOff = 5,
  795. yOff = -5,
  796. strata = "MEDIUM",
  797. level = 10,
  798. drawLayer = nil,
  799. clickFunc = function(frameObj, frameNum)
  800. local frame
  801. for i = 1, frameNum do
  802. frame = _G[historyButtonFrameObj.name .. i]
  803. if i == frameObj.arg1 then
  804. frame:SetNormalTexture(buttonPressedTexture)
  805. else
  806. frame:SetNormalTexture(buttonNormalTexture)
  807. end
  808. end
  809. ----------------------------IMPLEMENT HISTORY WINDOW FUNCTIONS
  810. end,
  811. arg1 = nil
  812.  
  813. }
  814.  
  815. --History Button Text
  816. local historyButtonTextObj = {
  817. fType = "TEXT",
  818. name = "RDSW_History_Button_Font",
  819. parent = "RDSW_History_Window_Frame",
  820. pointOnFrame = "LEFT",
  821. pointOnParent = "LEFT",
  822. width = 670,
  823. height = nil, --handeled by gen function
  824. xOff = 10,
  825. yOff = 0,
  826. text = nil,
  827. strata = nil,
  828. drawLayer = "OVERLAY",
  829. font = RDSW.vixarFont,
  830. fontSize = 18,
  831. hJustify = "LEFT",
  832. vJustify = nil,
  833. fontFlags = "OUTLINE"
  834. }
  835. --Content Type checkboxes
  836. local settings_ContentEnabled_CheckBoxObj = {
  837. fType = "CHECKBOX",
  838. name = "RDSW_settings_ContentEnabled_CheckBox",
  839. parent = "RDSW_Settings_Window_Frame",
  840. anchor = nil,
  841. pointOnFrame = "CENTER",
  842. pointOnParent = nil,
  843. transcribe = nil, --Set All Points, ignores width, heigh, xoff, yoff, strata
  844. height = 25,
  845. width = 25,
  846. xOff = 10,
  847. yOff = 25,
  848. strata = "BACKGROUND",
  849. level = 7,
  850. drawLayer = nil,
  851. buttonSize = 25,
  852. backdrop = {
  853. bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
  854. tile = false,
  855. tileSize = nil,
  856. edgeSize = 10
  857. },
  858. checkedFunc = function(contentType)
  859. if _G["RDSW_settings_ContentEnabled_CheckBox"]:GetChecked() then
  860. contentType.enabled = false
  861. else
  862. contentType.enabled = true
  863. end
  864. RDSW.updateDisplay()
  865. end,
  866. arg1 = nil
  867. }
  868.  
  869. --Content Type checkboxes Text
  870. local settings_CheckBox_TextObj = {
  871. fType = "TEXT",
  872. name = "RDSW_settings_ContentEnabled_CheckBox_Font",
  873. parent = settings_ContentEnabled_CheckBoxObj.name,
  874. pointOnFrame = "TOPLEFT",
  875. pointOnParent = "TOPLEFT",
  876. xOff = 28,
  877. yOff = 0,
  878. height = 50,
  879. text = nil,
  880. strata = nil,
  881. drawLayer = "OVERLAY",
  882. fontSize = 18,
  883. hJustify = "LEFT",
  884. vJustify = nil,
  885. fontFlags = "OUTLINE"
  886. }
  887.  
  888. --Location Enabling checkboxes
  889. local settings_LocationEnabled_CheckBoxObj = {
  890. template = settings_ContentEnabled_CheckBoxObj,
  891. name = "RDSW_settings_LocationEnabled_CheckBox"
  892. }
  893.  
  894. --Location Enabling checkboxes Text
  895. local settings_LocationEnabled_TextObj = {
  896. template = settings_CheckBox_TextObj,
  897. name = "RDSW_settings_LocationEnabled_CheckBox_Font"
  898. }
  899.  
  900. --frameGen Calls
  901. ----Display
  902. RDSW.frameGen(displayFrameObj)
  903. RDSW.frameGen(displayTextObj1)
  904. RDSW.frameGen(displayTextObj2)
  905. RDSW.frameGen(displayTextObj3)
  906.  
  907. ----Config
  908. RDSW.frameGen(configFrameObj)
  909. RDSW.frameGen(dirFrameObj)
  910. RDSW.frameGen(actFrameObj)
  911. RDSW.frameGen(auxFrameObj)
  912. RDSW.frameGen(BannerFrameObj)
  913.  
  914. --Settings
  915. RDSW.frameGen(settings_DropDownObj1)
  916. RDSW.frameGen(settings_DropDown1_TextObj)
  917. RDSW.frameGen(settings_DropDownObj2)
  918. RDSW.frameGen(settings_DropDown2_TextObj)
  919. RDSW.frameGen(settings_DropDownObj3)
  920. RDSW.frameGen(settings_DropDown3_TextObj)
  921. RDSW.frameGen(settings_EditBoxObj1)
  922. RDSW.frameGen(settings_EditBox1_TextObj)
  923.  
  924. ----Directory and History Buttons
  925. indexGen(directoryItems, directoryButtonFrameObj, directoryButtonTextObj, 160)
  926. indexGen(historyButtonNum, historyButtonFrameObj, historyButtonTextObj, 338)
  927.  
  928. ----Setting Checkboxs
  929. checkBoxGen(contentTypeItems,
  930. settings_ContentEnabled_CheckBoxObj,
  931. settings_CheckBox_TextObj,
  932. RDSW.enabled, "Content Type:",
  933. 300, 80, -175, -125, 2)
  934. checkBoxGen(locationEnabledItems,
  935. settings_LocationEnabled_CheckBoxObj,
  936. settings_LocationEnabled_TextObj,
  937. RDSW.enabled, "Show Display:",
  938. 300, 80, 175, -125, 2)
  939.  
  940. --Startup State Function calls
  941. RDSW.updateHistoryPage(RDSW.historyPage)
  942. RDSW.SetDisplayTextPos()
  943. RDSW.updateDisplay()
  944.  
  945. --Clicks initial button.
  946. _G[directoryButtonFrameObj.name .. RDSW.activeWindowCode]:Click(_G[directoryButtonFrameObj.name .. RDSW.activeWindowCode])
  947.  
  948. --Set Config Hide/Show stat on load.
  949. if not RDSW.option.configToggle then
  950. RDSW_Config_Frame:Hide()
  951. end
  952.  
  953. --Implement aux frame display on history window button press
  954. --Implement turn page button and text field
  955. --Implement search for date on history
  956. end
  957. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement