diff ui/ExportTab.lua @ 17:e77e01abce98

Warlords of Draenor pre-patch
author Adam tegen <adam.tegen@gmail.com>
date Mon, 13 Oct 2014 21:28:32 -0500
parents ece9167c0d1c
children 90175bdc50e6
line wrap: on
line diff
--- a/ui/ExportTab.lua	Thu Jul 10 15:32:11 2014 -0700
+++ b/ui/ExportTab.lua	Mon Oct 13 21:28:32 2014 -0500
@@ -5,7 +5,7 @@
 AskMrRobot.ExportTab = AskMrRobot.inheritsFrom(AskMrRobot.Frame)
 
 -- helper to create text for this tab
-local function CreateText(state, tab, font, relativeTo, xOffset, yOffset, text)
+local function CreateText(tab, font, relativeTo, xOffset, yOffset, text)
     local t = tab:CreateFontString(nil, "ARTWORK", font)
 	t:SetPoint("TOPLEFT", relativeTo, "BOTTOMLEFT", xOffset, yOffset)
 	t:SetPoint("RIGHT", tab, "RIGHT", -25, 0)
@@ -13,10 +13,6 @@
 	t:SetJustifyH("LEFT")
 	t:SetText(text)
     
-    if (state ~= nil) then
-        table.insert(state, t)
-    end
-    
     return t
 end
 
@@ -28,46 +24,13 @@
 	tab:SetPoint("BOTTOMRIGHT")
 	tab:Hide()
     
-    -- used to toggle between the two states... could use like, tabs or a UI panel or something, but then I would have to read more pseudo-documentation.
-    tab.manualElements = {}
-    tab.autoElements = {}
-
 	local text = tab:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
 	text:SetPoint("TOPLEFT", 0, -5)
-	text:SetText(L.AMR_EXPORTTAB_EXPORT_BB)  
-    
-    local chooseText = CreateText(nil, tab, "GameFontWhite", text, 0, -15, "Choose a method:")
-	chooseText:SetJustifyV("MIDDLE")
-    chooseText:SetHeight(30)
-    
-    local btn = CreateFrame("Button", "AmrExportManual", tab, "UIPanelButtonTemplate")
-	btn:SetPoint("TOPLEFT", text, "BOTTOMLEFT", 125, -15)
-	btn:SetText(L.AMR_EXPORTTAB_COPY_PASTE)
-	btn:SetWidth(120)
-	btn:SetHeight(30)
-    tab.btnManual = btn
-    
-    btn:SetScript("OnClick", function()
-        AmrOptions.exportToClient = false
-        tab:Update()
-    end)
-    
-    btn = CreateFrame("Button", "AmrExportAuto", tab, "UIPanelButtonTemplate")
-	btn:SetPoint("TOPLEFT", text, "BOTTOMLEFT", 275, -15)
-	btn:SetText(L.AMR_EXPORTTAB_AMR_CLIENT)
-	btn:SetWidth(120)
-	btn:SetHeight(30)
-    tab.btnAuto = btn
-    
-    btn:SetScript("OnClick", function()
-        AmrOptions.exportToClient = true
-        tab:Update()
-    end)
-    
+	text:SetText(L.AMR_EXPORTTAB_EXPORT_TITLE)  
+        
     -- copy/paste
-    text = CreateText(tab.manualElements, tab, "GameFontNormalLarge", chooseText, 0, -20, L.AMR_EXPORTTAB_COPY_PASTE_EXPORT)
-    local text2 = CreateText(tab.manualElements, tab, "GameFontWhite", text, 0, -15, L.AMR_EXPORTTAB_COPY_PASTE_EXPORT_1)
-    text = CreateText(tab.manualElements, tab, "GameFontWhite", text2, 0, -15, L.AMR_EXPORTTAB_COPY_PASTE_EXPORT_2)
+    local text2 = CreateText(tab, "GameFontWhite", text, 0, -15, L.AMR_EXPORTTAB_COPY_PASTE_EXPORT_1)
+    text = CreateText(tab, "GameFontWhite", text2, 0, -15, L.AMR_EXPORTTAB_COPY_PASTE_EXPORT_2)
 
 	local txtExportString = CreateFrame("ScrollFrame", "AmrScrollFrame", tab, "InputScrollFrameTemplate")
 	txtExportString:SetPoint("TOPLEFT", text, "BOTTOMLEFT", 12, -10)
@@ -78,57 +41,24 @@
     txtExportString.EditBox:SetMaxLetters(0)
 	txtExportString.CharCount:Hide()
 	tab.txtExportString = txtExportString
-    table.insert(tab.manualElements, txtExportString)
     
     txtExportString.EditBox:SetScript("OnEscapePressed", function()
-        AskMrRobot_ReforgeFrame:Hide()
+        AskMrRobot.mainWindow:Hide()
     end)
     
-    text = CreateText(tab.manualElements, tab, "GameFontWhite", txtExportString, -12, -20, L.AMR_EXPORTTAB_COPY_PASTE_EXPORT_3)
-    text2 = CreateText(tab.manualElements, tab, "GameFontWhite", text, 10, -5, L.AMR_EXPORTTAB_COPY_PASTE_EXPORT_4)
-
-    local image = tab:CreateTexture(nil, "BACKGROUND")
-	image:SetPoint("TOPLEFT", text2, "BOTTOMLEFT", 2, -10)
-	image:SetTexture("Interface\\AddOns\\AskMrRobot\\Media\\BiBScreen")
-    table.insert(tab.manualElements, image)
-    
-    text = CreateText(tab.manualElements, tab, "GameFontWhite", text2, 0, -120, L.AMR_EXPORTTAB_COPY_PASTE_EXPORT_NOTE)
+    text = CreateText(tab, "GameFontWhite", txtExportString, -12, -20, L.AMR_EXPORTTAB_COPY_PASTE_EXPORT_3)
+ 
+    text = CreateText(tab, "GameFontWhite", text, 0, -10, L.AMR_EXPORTTAB_COPY_PASTE_EXPORT_NOTE)
     
     btn = CreateFrame("Button", "AmrUpdateExportString", tab, "UIPanelButtonTemplate")
-	btn:SetPoint("TOPLEFT", text, "BOTTOMLEFT", 0, -5)
+	btn:SetPoint("TOPLEFT", text, "BOTTOMLEFT", -2, -10)
 	btn:SetText("Update")
-	btn:SetWidth(120)
-	btn:SetHeight(25)
-    table.insert(tab.manualElements, btn)
+	btn:SetWidth(110)
+	btn:SetHeight(30)
     
     btn:SetScript("OnClick", function()
         tab:Update()
     end)
-    
-    -- amr client
-    text = CreateText(tab.autoElements, tab, "GameFontNormalLarge", chooseText, 0, -20, L.AMR_EXPORTTAB_AMR_CLIENT_EXPORT)
-    text2 = CreateText(tab.autoElements, tab, "GameFontWhite", text, 0, -15, L.AMR_EXPORTTAB_AMR_CLIENT_EXPORT_1)
-    text = CreateText(tab.autoElements, tab, "GameFontWhite", text2, 0, -15, L.AMR_EXPORTTAB_AMR_CLIENT_EXPORT_2)
-
-    btn = CreateFrame("Button", "AmrExportFile", tab, "UIPanelButtonTemplate")
-	btn:SetPoint("TOPLEFT", text, "BOTTOMLEFT", 12, -10)
-	btn:SetText("Export to File")
-	btn:SetWidth(180)
-	btn:SetHeight(25)
-    table.insert(tab.autoElements, btn)
-    
-    btn:SetScript("OnClick", function()
-        AskMrRobot.SaveAll()
-        ReloadUI()
-    end)
-
-    text = CreateText(tab.autoElements, tab, "GameFontWhite", btn, -12, -20, L.AMR_EXPORTTAB_AMR_CLIENT_EXPORT_3)
-    text2 = CreateText(tab.autoElements, tab, "GameFontWhite", text, 10, -5, L.AMR_EXPORTTAB_AMR_CLIENT_EXPORT_4)
-
-    image = tab:CreateTexture(nil, "BACKGROUND")
-	image:SetPoint("TOPLEFT", text2, "BOTTOMLEFT", 2, -10)
-	image:SetTexture("Interface\\AddOns\\AskMrRobot\\Media\\BiBScreen")
-    table.insert(tab.autoElements, image)
 
     tab:SetScript("OnShow", function()
         tab:Update()
@@ -139,21 +69,8 @@
 
 -- update the panel and state
 function AskMrRobot.ExportTab:Update()
-
-    if (AmrOptions.exportToClient) then
-        for i, v in ipairs(self.manualElements) do v:Hide() end
-        for i, v in ipairs(self.autoElements) do v:Show() end
-        self.btnManual:UnlockHighlight()
-        self.btnAuto:LockHighlight()
-    else
-        for i, v in ipairs(self.autoElements) do v:Hide() end
-        for i, v in ipairs(self.manualElements) do v:Show() end
-        self.btnAuto:UnlockHighlight()
-        self.btnManual:LockHighlight()
-        
-        AskMrRobot.SaveAll()
-        self.txtExportString.EditBox:SetText(AskMrRobot.ExportToString())
-        self.txtExportString.EditBox:HighlightText()
-        self.txtExportString.EditBox:SetFocus()
-    end
+    AskMrRobot.SaveAll()
+    self.txtExportString.EditBox:SetText(AskMrRobot.ExportToString())
+    self.txtExportString.EditBox:HighlightText()
+    self.txtExportString.EditBox:SetFocus()
 end