adam@0: local _, AskMrRobot = ... adam@0: adam@0: -- initialize the ImportTab class adam@0: AskMrRobot.ImportTab = AskMrRobot.inheritsFrom(AskMrRobot.Frame) adam@0: adam@0: function AskMrRobot.ImportTab:new(parent) adam@0: adam@0: local tab = AskMrRobot.Frame:new(nil, parent) adam@0: setmetatable(tab, { __index = AskMrRobot.ImportTab }) adam@0: tab:SetPoint("TOPLEFT") adam@0: tab:SetPoint("BOTTOMRIGHT") adam@0: tab:Hide() adam@0: adam@0: -- import button adam@0: tab.button = CreateFrame("Button", "AmrImportButton", tab, "UIPanelButtonTemplate") adam@0: tab.button:SetPoint("BOTTOM") adam@0: tab.button:SetText("Import!") adam@0: tab.button:SetWidth(100) adam@0: tab.button:SetHeight(20) adam@0: tab.button:SetPoint("BOTTOM", 0, 15) adam@0: adam@0: local text = tab:CreateFontString("AmrImportText1", "ARTWORK", "GameFontNormalLarge") adam@0: text:SetPoint("TOPLEFT", 0, -5) adam@0: text:SetFormattedText("Import Mr. Robot's optimizations") adam@0: adam@0: text = tab:CreateFontString("AmrImportText2", "ARTWORK", "GameFontWhite") adam@0: text:SetPoint("TOPLEFT", "AmrImportText1", "BOTTOMLEFT", 0, -20) adam@0: text:SetPoint("RIGHT", 0, -20) adam@0: text:SetWidth(text:GetWidth()) adam@0: text:SetJustifyH("LEFT") adam@0: text:SetText("1. Go to our website, optimize, then click the 'export to addon' button found just above the stats section.") adam@0: adam@0: local image = tab:CreateTexture(nil, "BACKGROUND") adam@0: image:SetPoint("TOPLEFT", text, "BOTTOMLEFT", 16, -10) adam@0: image:SetTexture("Interface\\AddOns\\AskMrRobot\\Media\\AddonExport") adam@0: image:SetSize(256, 256) adam@0: adam@0: text = tab:CreateFontString("AmrImportText3", "ARTWORK", "GameFontWhite") adam@0: text:SetPoint("TOPLEFT", image, "BOTTOMLEFT", -16, 24) adam@0: text:SetPoint("RIGHT", -15, 40) adam@0: text:SetWidth(text:GetWidth()) adam@0: text:SetJustifyH("LEFT") adam@0: 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: adam@0: local scrollFrame = CreateFrame("ScrollFrame", "AmrImportScrollFrame", tab, "InputScrollFrameTemplate") adam@0: scrollFrame:SetPoint("TOPLEFT", text, "BOTTOMLEFT", 5, -10) adam@0: scrollFrame:SetPoint("BOTTOM", "AmrImportButton", "TOP", 0, 10) adam@0: scrollFrame:SetPoint("RIGHT", -30, 0) adam@0: scrollFrame:SetWidth(430) adam@0: scrollFrame.EditBox:SetWidth(scrollFrame:GetWidth()) adam@0: scrollFrame.EditBox:SetMaxLetters(1100) adam@0: scrollFrame.CharCount:Hide() adam@0: scrollFrame.EditBox.PromptText:SetText("Paste text from AskMrRobot.com here.") adam@0: scrollFrame.EditBox:SetFocus() adam@0: scrollFrame.EditBox:HighlightText() adam@0: tab.scrollFrame = scrollFrame adam@0: adam@0: tab:SetScript("OnShow", function() adam@0: tab.scrollFrame.EditBox:HighlightText() adam@0: tab.scrollFrame.EditBox:SetFocus() adam@0: end) adam@0: adam@0: return tab adam@0: end