This commit is contained in:
Bunny67
2020-09-14 10:12:22 +03:00
parent 6c3f9d925e
commit 0f4f16b6f0
71 changed files with 2302 additions and 2431 deletions
+37 -41
View File
@@ -17,9 +17,6 @@ local L = WeakAuras.L
local textEditor
local valueFromPath = WeakAuras.ValueFromPath
local valueToPath = WeakAuras.ValueToPath
local editor_themes = {
["Standard"] = {
["Table"] = "|c00ff3333",
@@ -149,36 +146,6 @@ end]=]
},
}
local function settings_dropdown_initialize(frame, level, menu)
for k, v in pairs(editor_themes) do
local item = {
text = k,
isNotRadio = false,
checked = function()
return WeakAurasSaved.editor_theme == k
end,
func = function()
WeakAurasSaved.editor_theme = k
set_scheme()
WeakAuras.editor.editBox:SetText(WeakAuras.editor.editBox:GetText())
end
}
UIDropDownMenu_AddButton(item)
end
UIDropDownMenu_AddButton(
{
text = L["Bracket Matching"],
isNotRadio = true,
checked = function()
return WeakAurasSaved.editor_bracket_matching
end,
func = function()
WeakAurasSaved.editor_bracket_matching = not WeakAurasSaved.editor_bracket_matching
end
}
)
end
local function ConstructTextEditor(frame)
local group = AceGUI:Create("InlineGroup")
group.frame:SetParent(frame)
@@ -260,6 +227,36 @@ local function ConstructTextEditor(frame)
urlText:SetPoint("RIGHT", settings_frame, "LEFT")
local dropdown = CreateFrame("Frame", "SettingsMenuFrame", settings_frame, "UIDropDownMenuTemplate")
local function settings_dropdown_initialize(frame, level, menu)
for k, v in pairs(editor_themes) do
local item = {
text = k,
isNotRadio = false,
checked = function()
return WeakAurasSaved.editor_theme == k
end,
func = function()
WeakAurasSaved.editor_theme = k
set_scheme()
editor.editBox:SetText(editor.editBox:GetText())
end
}
UIDropDownMenu_AddButton(item)
end
UIDropDownMenu_AddButton(
{
text = L["Bracket Matching"],
isNotRadio = true,
checked = function()
return WeakAurasSaved.editor_bracket_matching
end,
func = function()
WeakAurasSaved.editor_bracket_matching = not WeakAurasSaved.editor_bracket_matching
end
}
)
end
UIDropDownMenu_Initialize(dropdown, settings_dropdown_initialize, "MENU")
settings_frame:SetScript(
@@ -331,8 +328,8 @@ local function ConstructTextEditor(frame)
button:SetCallback(
"OnClick",
function()
WeakAuras.editor.editBox:Insert(snippet.snippet)
WeakAuras.editor:SetFocus()
editor.editBox:Insert(snippet.snippet)
editor:SetFocus()
end
)
button.deleteButton:SetScript(
@@ -635,7 +632,7 @@ local function ConstructTextEditor(frame)
local combinedText = ""
for index, childId in pairs(data.controlledChildren) do
local childData = WeakAuras.GetData(childId)
local text = valueFromPath(childData, multipath and path[childId] or path)
local text = OptionsPrivate.Private.ValueFromPath(childData, multipath and path[childId] or path)
if text then
if not (singleText) then
singleText = text
@@ -661,7 +658,7 @@ local function ConstructTextEditor(frame)
editor.combinedText = true
end
else
editor:SetText(valueFromPath(data, path) or "")
editor:SetText(OptionsPrivate.Private.ValueFromPath(data, path) or "")
end
editor:SetFocus()
end
@@ -716,11 +713,11 @@ local function ConstructTextEditor(frame)
for index, childId in pairs(self.data.controlledChildren) do
local text = editor.combinedText and (textById[childId] or "") or editor:GetText()
local childData = WeakAuras.GetData(childId)
valueToPath(childData, self.multipath and self.path[childId] or self.path, text)
OptionsPrivate.Private.ValueToPath(childData, self.multipath and self.path[childId] or self.path, text)
WeakAuras.Add(childData)
end
else
valueToPath(self.data, self.path, editor:GetText())
OptionsPrivate.Private.ValueToPath(self.data, self.path, editor:GetText())
WeakAuras.Add(self.data)
end
if (self.reloadOptions) then
@@ -742,12 +739,11 @@ local function ConstructTextEditor(frame)
frame:UpdateFrameVisible()
WeakAuras.FillOptions()
end
WeakAuras.editor = editor
return group
end
function WeakAuras.TextEditor(frame)
function OptionsPrivate.TextEditor(frame)
textEditor = textEditor or ConstructTextEditor(frame)
return textEditor
end