annotate ui/ImportTab.lua @ 0:ec731d2fe6ba

Version 1.2.12.0
author Adam tegen <adam.tegen@gmail.com>
date Tue, 20 May 2014 21:43:23 -0500
parents
children ece9167c0d1c
rev   line source
adam@0 1 local _, AskMrRobot = ...
adam@0 2
adam@0 3 -- initialize the ImportTab class
adam@0 4 AskMrRobot.ImportTab = AskMrRobot.inheritsFrom(AskMrRobot.Frame)
adam@0 5
adam@0 6 function AskMrRobot.ImportTab:new(parent)
adam@0 7
adam@0 8 local tab = AskMrRobot.Frame:new(nil, parent)
adam@0 9 setmetatable(tab, { __index = AskMrRobot.ImportTab })
adam@0 10 tab:SetPoint("TOPLEFT")
adam@0 11 tab:SetPoint("BOTTOMRIGHT")
adam@0 12 tab:Hide()
adam@0 13
adam@0 14 -- import button
adam@0 15 tab.button = CreateFrame("Button", "AmrImportButton", tab, "UIPanelButtonTemplate")
adam@0 16 tab.button:SetPoint("BOTTOM")
adam@0 17 tab.button:SetText("Import!")
adam@0 18 tab.button:SetWidth(100)
adam@0 19 tab.button:SetHeight(20)
adam@0 20 tab.button:SetPoint("BOTTOM", 0, 15)
adam@0 21
adam@0 22 local text = tab:CreateFontString("AmrImportText1", "ARTWORK", "GameFontNormalLarge")
adam@0 23 text:SetPoint("TOPLEFT", 0, -5)
adam@0 24 text:SetFormattedText("Import Mr. Robot's optimizations")
adam@0 25
adam@0 26 text = tab:CreateFontString("AmrImportText2", "ARTWORK", "GameFontWhite")
adam@0 27 text:SetPoint("TOPLEFT", "AmrImportText1", "BOTTOMLEFT", 0, -20)
adam@0 28 text:SetPoint("RIGHT", 0, -20)
adam@0 29 text:SetWidth(text:GetWidth())
adam@0 30 text:SetJustifyH("LEFT")
adam@0 31 text:SetText("1. Go to our website, optimize, then click the 'export to addon' button found just above the stats section.")
adam@0 32
adam@0 33 local image = tab:CreateTexture(nil, "BACKGROUND")
adam@0 34 image:SetPoint("TOPLEFT", text, "BOTTOMLEFT", 16, -10)
adam@0 35 image:SetTexture("Interface\\AddOns\\AskMrRobot\\Media\\AddonExport")
adam@0 36 image:SetSize(256, 256)
adam@0 37
adam@0 38 text = tab:CreateFontString("AmrImportText3", "ARTWORK", "GameFontWhite")
adam@0 39 text:SetPoint("TOPLEFT", image, "BOTTOMLEFT", -16, 24)
adam@0 40 text:SetPoint("RIGHT", -15, 40)
adam@0 41 text:SetWidth(text:GetWidth())
adam@0 42 text:SetJustifyH("LEFT")
adam@0 43 text:SetText("2. A window will popup, copy the text from that window.\r\r3. Return here and paste the text into the window below. To paste it, hold ctrl + v, or on a mac apple + v.\r\r4. Click the 'Import' button below")
adam@0 44
adam@0 45 local scrollFrame = CreateFrame("ScrollFrame", "AmrImportScrollFrame", tab, "InputScrollFrameTemplate")
adam@0 46 scrollFrame:SetPoint("TOPLEFT", text, "BOTTOMLEFT", 5, -10)
adam@0 47 scrollFrame:SetPoint("BOTTOM", "AmrImportButton", "TOP", 0, 10)
adam@0 48 scrollFrame:SetPoint("RIGHT", -30, 0)
adam@0 49 scrollFrame:SetWidth(430)
adam@0 50 scrollFrame.EditBox:SetWidth(scrollFrame:GetWidth())
adam@0 51 scrollFrame.EditBox:SetMaxLetters(1100)
adam@0 52 scrollFrame.CharCount:Hide()
adam@0 53 scrollFrame.EditBox.PromptText:SetText("Paste text from AskMrRobot.com here.")
adam@0 54 scrollFrame.EditBox:SetFocus()
adam@0 55 scrollFrame.EditBox:HighlightText()
adam@0 56 tab.scrollFrame = scrollFrame
adam@0 57
adam@0 58 tab:SetScript("OnShow", function()
adam@0 59 tab.scrollFrame.EditBox:HighlightText()
adam@0 60 tab.scrollFrame.EditBox:SetFocus()
adam@0 61 end)
adam@0 62
adam@0 63 return tab
adam@0 64 end