from retail

This commit is contained in:
Bunny67
2022-05-19 22:04:17 +03:00
parent 9465daedd8
commit e7e789686a
86 changed files with 9118 additions and 5486 deletions
+25 -35
View File
@@ -5,7 +5,7 @@ local AddonName, OptionsPrivate = ...
local strtrim, strsub = strtrim, strsub
-- WoW APIs
local CreateFrame = CreateFrame
local GetTime, CreateFrame = GetTime, CreateFrame
local AceGUI = LibStub("AceGUI-3.0")
@@ -15,26 +15,31 @@ local L = WeakAuras.L
local importexport
local function ConstructImportExport(frame)
local group = AceGUI:Create("InlineGroup");
local group = AceGUI:Create("WeakAurasInlineGroup");
group.frame:SetParent(frame);
group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -17, 12);
group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 17, -10);
group.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, -16);
group.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -16, 46);
group.frame:Hide();
group:SetLayout("fill");
group:SetLayout("flow");
local title = AceGUI:Create("Label")
title:SetFontObject(GameFontNormalHuge)
title:SetFullWidth(true)
group:AddChild(title)
local input = AceGUI:Create("MultiLineEditBox");
input:SetWidth(400);
input.button:Hide();
--input.frame:SetClipsChildren(true);
input:DisableButton(true)
input:SetFullWidth(true)
input:SetFullHeight(true)
group:AddChild(input);
local close = CreateFrame("Button", nil, group.frame, "UIPanelButtonTemplate");
close:SetScript("OnClick", function() group:Close() end);
close:SetPoint("BOTTOMRIGHT", -27, 13);
close:SetPoint("BOTTOMRIGHT", -20, -24);
close:SetFrameLevel(close:GetFrameLevel() + 1)
close:SetHeight(20);
close:SetWidth(100);
close:SetText(L["Done"])
close:SetText(L["Close"])
function group.Open(self, mode, id)
if(frame.window == "texture") then
@@ -47,16 +52,17 @@ local function ConstructImportExport(frame)
frame.window = "importexport";
frame:UpdateFrameVisible()
if(mode == "export" or mode == "table") then
title:SetText(L["Exporting"])
if(id) then
local displayStr;
if(mode == "export") then
displayStr = WeakAuras.DisplayToString(id, true);
displayStr = OptionsPrivate.Private.DisplayToString(id, true);
elseif(mode == "table") then
displayStr = OptionsPrivate.Private.DataToString(id);
end
input.editBox:SetMaxBytes(nil);
input.editBox:SetScript("OnEscapePressed", function() group:Close(); end);
input.editBox:SetScript("OnChar", function() input:SetText(displayStr); input.editBox:HighlightText(); end);
input.editBox:SetScript("OnTextChanged", function() input:SetText(displayStr); input.editBox:HighlightText(); end);
input.editBox:SetScript("OnMouseUp", function() input.editBox:HighlightText(); end);
input:SetLabel(id.." - "..#displayStr);
input.button:Hide();
@@ -65,37 +71,21 @@ local function ConstructImportExport(frame)
input:SetFocus();
end
elseif(mode == "import") then
local textBuffer, i, lastPaste = {}, 0
local function clearBuffer(self)
lastPaste = nil
self:SetScript('OnUpdate', nil)
local pasted = strtrim(table.concat(textBuffer))
input.editBox:ClearFocus();
pasted = pasted:match( "^%s*(.-)%s*$" );
if (#pasted > 20) then
WeakAuras.Import(pasted);
input:SetLabel(L["Processed %i chars"]:format(i));
input.editBox:SetMaxBytes(2500);
input.editBox:SetText(strsub(pasted, 1, 2500));
title:SetText(L["Importing"])
input.editBox:SetScript("OnTextChanged", function(self)
local pasted = self:GetText()
pasted = pasted:match("^%s*(.-)%s*$")
if #pasted > 20 then
WeakAuras.Import(pasted)
end
end
input.editBox:SetScript('OnChar', function(self, c)
if not lastPaste then
textBuffer, i, lastPaste = {}, 0, 1
self:SetScript('OnUpdate', clearBuffer)
end
i = i + 1
textBuffer[i] = c
end)
input.editBox:SetText("");
input.editBox:SetMaxBytes(2500);
input.editBox:SetScript("OnEscapePressed", function() group:Close(); end);
input.editBox:SetScript("OnMouseUp", nil);
input:SetLabel(L["Paste text below"]);
input:SetFocus();
end
group:DoLayout()
end
function group.Close(self)