beta
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
if not WeakAuras.IsCorrectVersion() then return end
|
||||
local AddonName, OptionsPrivate = ...
|
||||
|
||||
-- Lua APIs
|
||||
local pairs = pairs
|
||||
@@ -117,7 +118,7 @@ local function ConstructCodeReview(frame)
|
||||
return group
|
||||
end
|
||||
|
||||
function WeakAuras.CodeReview(frame)
|
||||
function OptionsPrivate.CodeReview(frame)
|
||||
codeReview = codeReview or ConstructCodeReview(frame)
|
||||
return codeReview
|
||||
end
|
||||
|
||||
@@ -13,15 +13,12 @@ local AceConfigDialog = LibStub("AceConfigDialog-3.0")
|
||||
local WeakAuras = WeakAuras
|
||||
local L = WeakAuras.L
|
||||
|
||||
local valueFromPath = WeakAuras.ValueFromPath
|
||||
local valueToPath = WeakAuras.ValueToPath
|
||||
|
||||
local frameChooserFrame
|
||||
local frameChooserBox
|
||||
|
||||
local oldFocus
|
||||
local oldFocusName
|
||||
function WeakAuras.StartFrameChooser(data, path)
|
||||
function OptionsPrivate.StartFrameChooser(data, path)
|
||||
local frame = WeakAuras.OptionsFrame();
|
||||
if not(frameChooserFrame) then
|
||||
frameChooserFrame = CreateFrame("frame");
|
||||
@@ -35,15 +32,15 @@ function WeakAuras.StartFrameChooser(data, path)
|
||||
frameChooserBox:SetBackdropBorderColor(0, 1, 0);
|
||||
frameChooserBox:Hide();
|
||||
end
|
||||
local givenValue = valueFromPath(data, path);
|
||||
local givenValue = OptionsPrivate.Private.ValueFromPath(data, path);
|
||||
|
||||
frameChooserFrame:SetScript("OnUpdate", function()
|
||||
if(IsMouseButtonDown("RightButton")) then
|
||||
valueToPath(data, path, givenValue);
|
||||
WeakAuras.StopFrameChooser(data);
|
||||
OptionsPrivate.Private.ValueToPath(data, path, givenValue);
|
||||
OptionsPrivate.StopFrameChooser(data);
|
||||
WeakAuras.FillOptions()
|
||||
elseif(IsMouseButtonDown("LeftButton") and oldFocusName) then
|
||||
WeakAuras.StopFrameChooser(data);
|
||||
OptionsPrivate.StopFrameChooser(data);
|
||||
else
|
||||
SetCursor("CAST_CURSOR");
|
||||
|
||||
@@ -76,7 +73,7 @@ function WeakAuras.StartFrameChooser(data, path)
|
||||
end
|
||||
|
||||
if(focusName ~= oldFocusName) then
|
||||
valueToPath(data, path, focusName);
|
||||
OptionsPrivate.Private.ValueToPath(data, path, focusName);
|
||||
oldFocusName = focusName;
|
||||
WeakAuras.FillOptions()
|
||||
end
|
||||
@@ -91,7 +88,7 @@ function WeakAuras.StartFrameChooser(data, path)
|
||||
end);
|
||||
end
|
||||
|
||||
function WeakAuras.StopFrameChooser(data)
|
||||
function OptionsPrivate.StopFrameChooser(data)
|
||||
if(frameChooserFrame) then
|
||||
frameChooserFrame:SetScript("OnUpdate", nil);
|
||||
frameChooserBox:Hide();
|
||||
|
||||
@@ -202,7 +202,7 @@ local function ConstructIconPicker(frame)
|
||||
return group
|
||||
end
|
||||
|
||||
function WeakAuras.IconPicker(frame)
|
||||
function OptionsPrivate.IconPicker(frame)
|
||||
iconPicker = iconPicker or ConstructIconPicker(frame)
|
||||
return iconPicker
|
||||
end
|
||||
|
||||
@@ -52,7 +52,7 @@ local function ConstructImportExport(frame)
|
||||
if(mode == "export") then
|
||||
displayStr = WeakAuras.DisplayToString(id, true);
|
||||
elseif(mode == "table") then
|
||||
displayStr = WeakAuras.DataToString(id);
|
||||
displayStr = OptionsPrivate.Private.DataToString(id);
|
||||
end
|
||||
input.editBox:SetScript("OnEscapePressed", function() group:Close(); end);
|
||||
input.editBox:SetScript("OnChar", function() input:SetText(displayStr); input.editBox:HighlightText(); end);
|
||||
@@ -92,7 +92,7 @@ local function ConstructImportExport(frame)
|
||||
return group
|
||||
end
|
||||
|
||||
function WeakAuras.ImportExport(frame)
|
||||
function OptionsPrivate.ImportExport(frame)
|
||||
importexport = importexport or ConstructImportExport(frame)
|
||||
return importexport
|
||||
end
|
||||
|
||||
@@ -204,7 +204,7 @@ local function ConstructModelPicker(frame)
|
||||
return group
|
||||
end
|
||||
|
||||
function WeakAuras.ModelPicker(frame)
|
||||
function OptionsPrivate.ModelPicker(frame)
|
||||
modelPicker = modelPicker or ConstructModelPicker(frame)
|
||||
return modelPicker
|
||||
end
|
||||
|
||||
@@ -14,8 +14,6 @@ local WeakAuras = WeakAuras
|
||||
local moversizer
|
||||
local mover
|
||||
|
||||
local savedVars = WeakAuras.savedVars
|
||||
|
||||
local function EnsureTexture(self, texture)
|
||||
if texture then
|
||||
return texture
|
||||
@@ -45,7 +43,7 @@ local function moveOnePxl(direction)
|
||||
end
|
||||
WeakAuras.Add(data, nil, true)
|
||||
WeakAuras.UpdateThumbnail(data)
|
||||
WeakAuras.ResetMoverSizer()
|
||||
OptionsPrivate.ResetMoverSizer()
|
||||
if data.parent then
|
||||
local parentData = WeakAuras.GetData(data.parent)
|
||||
if parentData then
|
||||
@@ -494,14 +492,14 @@ local function ConstructMoverSizer(parent)
|
||||
frame:ScaleCorners(region:GetWidth(), region:GetHeight())
|
||||
local regionStrata = region:GetFrameStrata()
|
||||
if regionStrata then
|
||||
local strata = math.min(tIndexOf(WeakAuras.frame_strata_types, regionStrata) + 1, 9)
|
||||
frame:SetFrameStrata(WeakAuras.frame_strata_types[strata])
|
||||
mover:SetFrameStrata(WeakAuras.frame_strata_types[strata])
|
||||
local strata = math.min(tIndexOf(OptionsPrivate.Private.frame_strata_types, regionStrata) + 1, 9)
|
||||
frame:SetFrameStrata(OptionsPrivate.Private.frame_strata_types[strata])
|
||||
mover:SetFrameStrata(OptionsPrivate.Private.frame_strata_types[strata])
|
||||
end
|
||||
|
||||
local db = savedVars.db
|
||||
local db = OptionsPrivate.savedVars.db
|
||||
mover.startMoving = function()
|
||||
WeakAuras.CancelAnimation(region, true, true, true, true, true)
|
||||
OptionsPrivate.Private.CancelAnimation(region, true, true, true, true, true)
|
||||
mover:ClearAllPoints()
|
||||
if data.regionType == "group" then
|
||||
mover:SetPoint(mover.selfPoint, region, mover.anchorPoint, region.blx * scale, region.bly * scale)
|
||||
@@ -617,7 +615,7 @@ local function ConstructMoverSizer(parent)
|
||||
end
|
||||
end
|
||||
WeakAuras.FillOptions()
|
||||
WeakAuras.Animate("display", data.uid, "main", data.animation.main, WeakAuras.regions[data.id].region, false, nil, true)
|
||||
OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, WeakAuras.regions[data.id].region, false, nil, true)
|
||||
-- hide alignment lines
|
||||
frame.lineY:Hide()
|
||||
frame.lineX:Hide()
|
||||
@@ -639,7 +637,7 @@ local function ConstructMoverSizer(parent)
|
||||
if region:IsResizable() then
|
||||
frame.startSizing = function(point)
|
||||
mover.isMoving = true
|
||||
WeakAuras.CancelAnimation(region, true, true, true, true, true)
|
||||
OptionsPrivate.Private.CancelAnimation(region, true, true, true, true, true)
|
||||
local rSelfPoint, rAnchor, rAnchorPoint, rXOffset, rYOffset = region:GetPoint(1)
|
||||
region:StartSizing(point)
|
||||
frame.text:ClearAllPoints()
|
||||
@@ -737,7 +735,7 @@ local function ConstructMoverSizer(parent)
|
||||
frame.text:Hide()
|
||||
frame:SetScript("OnUpdate", nil)
|
||||
WeakAuras.FillOptions()
|
||||
WeakAuras.Animate("display", data.uid, "main", data.animation.main, WeakAuras.regions[data.id].region, false, nil, true)
|
||||
OptionsPrivate.Private.Animate("display", data.uid, "main", data.animation.main, WeakAuras.regions[data.id].region, false, nil, true)
|
||||
-- hide alignment lines
|
||||
frame.lineY:Hide()
|
||||
frame.lineX:Hide()
|
||||
@@ -835,7 +833,7 @@ local function ConstructMoverSizer(parent)
|
||||
self.alignCurrentAlpha = newAlpha
|
||||
end
|
||||
|
||||
local db = savedVars.db
|
||||
local db = OptionsPrivate.savedVars.db
|
||||
local region = self.moving.region
|
||||
local data = self.moving.data
|
||||
if not self.isMoving then
|
||||
@@ -974,7 +972,7 @@ local function ConstructMoverSizer(parent)
|
||||
return frame, mover
|
||||
end
|
||||
|
||||
function WeakAuras.MoverSizer(parent)
|
||||
function OptionsPrivate.MoverSizer(parent)
|
||||
if not moversizer or not mover then
|
||||
moversizer, mover = ConstructMoverSizer(parent)
|
||||
end
|
||||
|
||||
@@ -18,12 +18,10 @@ local WeakAuras = WeakAuras
|
||||
local L = WeakAuras.L
|
||||
|
||||
local displayButtons = WeakAuras.displayButtons
|
||||
local loaded = WeakAuras.loaded
|
||||
local regionOptions = WeakAuras.regionOptions
|
||||
local savedVars = WeakAuras.savedVars
|
||||
local tempGroup = WeakAuras.tempGroup
|
||||
local tempGroup = OptionsPrivate.tempGroup
|
||||
local prettyPrint = WeakAuras.prettyPrint
|
||||
local aceOptions = WeakAuras.aceOptions
|
||||
local aceOptions = {}
|
||||
|
||||
local function CreateDecoration(frame)
|
||||
local deco = CreateFrame("Frame", nil, frame)
|
||||
@@ -135,11 +133,11 @@ local defaultHeight = 665
|
||||
local minWidth = 750
|
||||
local minHeight = 240
|
||||
|
||||
function WeakAuras.CreateFrame()
|
||||
function OptionsPrivate.CreateFrame()
|
||||
local WeakAuras_DropDownMenu = CreateFrame("frame", "WeakAuras_DropDownMenu", nil, "UIDropDownMenuTemplate")
|
||||
local frame
|
||||
local db = savedVars.db
|
||||
local odb = savedVars.odb
|
||||
local db = OptionsPrivate.savedVars.db
|
||||
local odb = OptionsPrivate.savedVars.odb
|
||||
-------- Mostly Copied from AceGUIContainer-Frame--------
|
||||
frame = CreateFrame("FRAME", "WeakAurasOptions", UIParent)
|
||||
tinsert(UISpecialFrames, frame:GetName())
|
||||
@@ -173,15 +171,10 @@ function WeakAuras.CreateFrame()
|
||||
frame:Hide()
|
||||
|
||||
frame:SetScript("OnHide", function()
|
||||
WeakAuras.ClearFakeStates()
|
||||
WeakAuras.SetDragging()
|
||||
OptionsPrivate.Private.ClearFakeStates()
|
||||
OptionsPrivate.SetDragging()
|
||||
|
||||
local tutFrame = WeakAuras.TutorialsFrame and WeakAuras.TutorialsFrame()
|
||||
if tutFrame and tutFrame:IsVisible() then
|
||||
tutFrame:Hide()
|
||||
end
|
||||
|
||||
WeakAuras.PauseAllDynamicGroups()
|
||||
OptionsPrivate.Private.PauseAllDynamicGroups()
|
||||
|
||||
for id, data in pairs(WeakAuras.regions) do
|
||||
data.region:Collapse()
|
||||
@@ -194,12 +187,11 @@ function WeakAuras.CreateFrame()
|
||||
end
|
||||
end
|
||||
|
||||
WeakAuras.ResumeAllDynamicGroups()
|
||||
WeakAuras.ReloadAll()
|
||||
WeakAuras.Resume()
|
||||
OptionsPrivate.Private.ResumeAllDynamicGroups()
|
||||
OptionsPrivate.Private.Resume()
|
||||
|
||||
if WeakAuras.mouseFrame then
|
||||
WeakAuras.mouseFrame:OptionsClosed()
|
||||
if OptionsPrivate.Private.mouseFrame then
|
||||
OptionsPrivate.Private.mouseFrame:OptionsClosed()
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -537,14 +529,14 @@ function WeakAuras.CreateFrame()
|
||||
container.content:SetPoint("BOTTOMRIGHT", 0, 0)
|
||||
frame.container = container
|
||||
|
||||
frame.texturePicker = WeakAuras.TexturePicker(frame)
|
||||
frame.iconPicker = WeakAuras.IconPicker(frame)
|
||||
frame.modelPicker = WeakAuras.ModelPicker(frame)
|
||||
frame.importexport = WeakAuras.ImportExport(frame)
|
||||
frame.texteditor = WeakAuras.TextEditor(frame)
|
||||
frame.codereview = WeakAuras.CodeReview(frame)
|
||||
frame.texturePicker = OptionsPrivate.TexturePicker(frame)
|
||||
frame.iconPicker = OptionsPrivate.IconPicker(frame)
|
||||
frame.modelPicker = OptionsPrivate.ModelPicker(frame)
|
||||
frame.importexport = OptionsPrivate.ImportExport(frame)
|
||||
frame.texteditor = OptionsPrivate.TextEditor(frame)
|
||||
frame.codereview = OptionsPrivate.CodeReview(frame)
|
||||
|
||||
frame.moversizer, frame.mover = WeakAuras.MoverSizer(frame)
|
||||
frame.moversizer, frame.mover = OptionsPrivate.MoverSizer(frame)
|
||||
|
||||
-- filter line
|
||||
local filterInput = CreateFrame("editbox", "WeakAurasFilterInput", frame, "InputBoxTemplate")
|
||||
@@ -609,7 +601,7 @@ function WeakAuras.CreateFrame()
|
||||
local importButton = AceGUI:Create("WeakAurasToolbarButton")
|
||||
importButton:SetText(L["Import"])
|
||||
importButton:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\importsmall")
|
||||
importButton:SetCallback("OnClick", WeakAuras.ImportFromString)
|
||||
importButton:SetCallback("OnClick", OptionsPrivate.ImportFromString)
|
||||
toolbarContainer:AddChild(importButton)
|
||||
|
||||
local magnetButton = AceGUI:Create("WeakAurasToolbarButton")
|
||||
@@ -701,7 +693,7 @@ function WeakAuras.CreateFrame()
|
||||
|
||||
local numAddons = 0
|
||||
|
||||
for addon, addonData in pairs(WeakAuras.addons) do
|
||||
for addon, addonData in pairs(OptionsPrivate.Private) do
|
||||
numAddons = numAddons + 1
|
||||
end
|
||||
|
||||
@@ -733,26 +725,26 @@ function WeakAuras.CreateFrame()
|
||||
loadedButton:SetExpandDescription(L["Expand all loaded displays"])
|
||||
loadedButton:SetCollapseDescription(L["Collapse all loaded displays"])
|
||||
loadedButton:SetViewClick(function()
|
||||
WeakAuras.PauseAllDynamicGroups()
|
||||
OptionsPrivate.Private.PauseAllDynamicGroups()
|
||||
if loadedButton.view.func() == 2 then
|
||||
for id, child in pairs(displayButtons) do
|
||||
if loaded[id] ~= nil then
|
||||
if OptionsPrivate.Private.loaded[id] ~= nil then
|
||||
child:PriorityHide(2)
|
||||
end
|
||||
end
|
||||
else
|
||||
for id, child in pairs(displayButtons) do
|
||||
if loaded[id] ~= nil then
|
||||
if OptionsPrivate.Private.loaded[id] ~= nil then
|
||||
child:PriorityShow(2)
|
||||
end
|
||||
end
|
||||
end
|
||||
WeakAuras.ResumeAllDynamicGroups()
|
||||
OptionsPrivate.Private.ResumeAllDynamicGroups()
|
||||
end)
|
||||
loadedButton:SetViewTest(function()
|
||||
local none, all = true, true
|
||||
for id, child in pairs(displayButtons) do
|
||||
if loaded[id] ~= nil then
|
||||
if OptionsPrivate.Private.loaded[id] ~= nil then
|
||||
if child:GetVisibility() ~= 2 then
|
||||
all = false
|
||||
end
|
||||
@@ -794,13 +786,13 @@ function WeakAuras.CreateFrame()
|
||||
unloadedButton:SetViewClick(function()
|
||||
if unloadedButton.view.func() == 2 then
|
||||
for id, child in pairs(displayButtons) do
|
||||
if loaded[id] == nil then
|
||||
if OptionsPrivate.Private.loaded[id] == nil then
|
||||
child:PriorityHide(2)
|
||||
end
|
||||
end
|
||||
else
|
||||
for id, child in pairs(displayButtons) do
|
||||
if loaded[id] == nil then
|
||||
if OptionsPrivate.Private.loaded[id] == nil then
|
||||
child:PriorityShow(2)
|
||||
end
|
||||
end
|
||||
@@ -809,7 +801,7 @@ function WeakAuras.CreateFrame()
|
||||
unloadedButton:SetViewTest(function()
|
||||
local none, all = true, true
|
||||
for id, child in pairs(displayButtons) do
|
||||
if loaded[id] == nil then
|
||||
if OptionsPrivate.Private.loaded[id] == nil then
|
||||
if child:GetVisibility() ~= 2 then
|
||||
all = false
|
||||
end
|
||||
@@ -893,25 +885,21 @@ function WeakAuras.CreateFrame()
|
||||
end
|
||||
end
|
||||
|
||||
frame.GetSubOptions = function(self, id, tab)
|
||||
return aceOptions[id] and aceOptions[id][tab]
|
||||
end
|
||||
|
||||
frame.EnsureOptions = function(self, data, tab)
|
||||
local id = data.id
|
||||
aceOptions[id] = aceOptions[id] or {}
|
||||
if not aceOptions[id][tab] then
|
||||
local optionsGenerator =
|
||||
{
|
||||
group = WeakAuras.GetGroupOptions,
|
||||
region = WeakAuras.GetDisplayOptions,
|
||||
trigger = WeakAuras.GetTriggerOptions,
|
||||
conditions = WeakAuras.GetConditionOptions,
|
||||
load = WeakAuras.GetLoadOptions,
|
||||
action = WeakAuras.GetActionOptions,
|
||||
animation = WeakAuras.GetAnimationOptions,
|
||||
authorOptions = WeakAuras.GetAuthorOptions,
|
||||
information = WeakAuras.GetInformationOptions,
|
||||
group = OptionsPrivate.GetGroupOptions,
|
||||
region = OptionsPrivate.GetDisplayOptions,
|
||||
trigger = OptionsPrivate.GetTriggerOptions,
|
||||
conditions = OptionsPrivate.GetConditionOptions,
|
||||
load = OptionsPrivate.GetLoadOptions,
|
||||
action = OptionsPrivate.GetActionOptions,
|
||||
animation = OptionsPrivate.GetAnimationOptions,
|
||||
authorOptions = OptionsPrivate.GetAuthorOptions,
|
||||
information = OptionsPrivate.GetInformationOptions,
|
||||
}
|
||||
if optionsGenerator[tab] then
|
||||
aceOptions[id][tab] = optionsGenerator[tab](data)
|
||||
@@ -996,7 +984,7 @@ function WeakAuras.CreateFrame()
|
||||
end
|
||||
|
||||
frame.ClearPicks = function(self, noHide)
|
||||
WeakAuras.PauseAllDynamicGroups()
|
||||
OptionsPrivate.Private.PauseAllDynamicGroups()
|
||||
|
||||
frame.pickedDisplay = nil
|
||||
frame.pickedOption = nil
|
||||
@@ -1013,7 +1001,7 @@ function WeakAuras.CreateFrame()
|
||||
container:ReleaseChildren()
|
||||
self.moversizer:Hide()
|
||||
|
||||
WeakAuras.ResumeAllDynamicGroups()
|
||||
OptionsPrivate.Private.ResumeAllDynamicGroups()
|
||||
end
|
||||
|
||||
local function GetTarget(pickedDisplay)
|
||||
@@ -1154,7 +1142,7 @@ function WeakAuras.CreateFrame()
|
||||
|
||||
importButton:SetIcon(frame.importThumbnail)
|
||||
importButton:SetDescription(L["Import a display from an encoded string"])
|
||||
importButton:SetClick(WeakAuras.ImportFromString)
|
||||
importButton:SetClick(OptionsPrivate.ImportFromString)
|
||||
containerScroll:AddChild(importButton)
|
||||
end
|
||||
|
||||
@@ -1177,7 +1165,7 @@ function WeakAuras.CreateFrame()
|
||||
container:SetLayout("fill")
|
||||
container:AddChild(containerScroll)
|
||||
|
||||
WeakAuras.CreateImportButtons()
|
||||
OptionsPrivate.CreateImportButtons()
|
||||
WeakAuras.SortImportButtons(containerScroll)
|
||||
else
|
||||
error("An options button other than New or Addons was selected... but there are no other options buttons!")
|
||||
@@ -1199,7 +1187,7 @@ function WeakAuras.CreateFrame()
|
||||
displayButtons[data.parent]:Expand()
|
||||
end
|
||||
end
|
||||
if loaded[id] ~= nil then
|
||||
if OptionsPrivate.Private.loaded[id] ~= nil then
|
||||
-- Under loaded
|
||||
if not loadedButton:GetExpanded() then
|
||||
loadedButton:Expand()
|
||||
@@ -1260,17 +1248,17 @@ function WeakAuras.CreateFrame()
|
||||
if type(self.pickedDisplay) == "string" then
|
||||
if WeakAuras.GetData(self.pickedDisplay).controlledChildren then
|
||||
wasGroup = true
|
||||
elseif not WeakAuras.IsDisplayPicked(id) then
|
||||
elseif not OptionsPrivate.IsDisplayPicked(id) then
|
||||
tinsert(tempGroup.controlledChildren, self.pickedDisplay)
|
||||
end
|
||||
end
|
||||
if wasGroup then
|
||||
self:PickDisplay(id)
|
||||
elseif not WeakAuras.IsDisplayPicked(id) then
|
||||
elseif not OptionsPrivate.IsDisplayPicked(id) then
|
||||
self.pickedDisplay = tempGroup
|
||||
displayButtons[id]:Pick()
|
||||
tinsert(tempGroup.controlledChildren, id)
|
||||
WeakAuras.ClearOptions(tempGroup.id)
|
||||
OptionsPrivate.ClearOptions(tempGroup.id)
|
||||
self:FillOptions()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -221,7 +221,6 @@ local function ConstructTexturePicker(frame)
|
||||
else
|
||||
_, givenPath = next(self.givenPath);
|
||||
end
|
||||
WeakAuras.debug(givenPath, 3);
|
||||
for categoryName, category in pairs(self.textures) do
|
||||
if not(picked) then
|
||||
for texturePath, textureName in pairs(category) do
|
||||
@@ -279,7 +278,7 @@ local function ConstructTexturePicker(frame)
|
||||
return group
|
||||
end
|
||||
|
||||
function WeakAuras.TexturePicker(frame)
|
||||
function OptionsPrivate.TexturePicker(frame)
|
||||
texturePicker = texturePicker or ConstructTexturePicker(frame)
|
||||
return texturePicker
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user