from retail
This commit is contained in:
@@ -3849,8 +3849,8 @@ function GenericTrigger.GetAdditionalProperties(data, triggernum)
|
||||
local variables = GenericTrigger.GetTsuConditionVariables(data.id, triggernum)
|
||||
if (type(variables) == "table") then
|
||||
for var, varData in pairs(variables) do
|
||||
if (type(varData) == "table") and varData.display then
|
||||
props[var] = varData.display
|
||||
if (type(varData) == "table") then
|
||||
props[var] = varData.display or var
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3359,7 +3359,7 @@ Private.event_prototypes = {
|
||||
test = "true",
|
||||
conditionType = "bool",
|
||||
conditionTest = function(state, needle)
|
||||
return state and state.show and ((IsUsableSpell(state.spellname) == 1 and true or false) == (needle == 1))
|
||||
return state and state.show and (IsUsableSpell(state.spellname or "") == (needle == 1))
|
||||
end,
|
||||
conditionEvents = {
|
||||
"SPELL_UPDATE_USABLE",
|
||||
@@ -3374,7 +3374,7 @@ Private.event_prototypes = {
|
||||
test = "true",
|
||||
conditionType = "bool",
|
||||
conditionTest = function(state, needle)
|
||||
return state and state.show and ((select(2, IsUsableSpell(state.spellname)) == 1 and true or false) == (needle == 1));
|
||||
return state and state.show and (select(2, IsUsableSpell(state.spellname or "")) == (needle == 1));
|
||||
end,
|
||||
conditionEvents = {
|
||||
"SPELL_UPDATE_USABLE",
|
||||
@@ -4382,7 +4382,7 @@ Private.event_prototypes = {
|
||||
charges = (duration == 0 or gcdCooldown) and 1 or 0;
|
||||
end
|
||||
local ready = startTime == 0 or charges > 0
|
||||
local active = IsUsableSpell(spellName) and ready
|
||||
local active = IsUsableSpell(spellName or "") and ready
|
||||
]=]
|
||||
if(trigger.use_targetRequired) then
|
||||
ret = ret.."active = active and WeakAuras.IsSpellInRange(spellName or '', 'target')\n";
|
||||
|
||||
@@ -1,30 +1,32 @@
|
||||
if not WeakAuras.IsLibsOK() then return end
|
||||
|
||||
local Type, Version = "WeakAurasInput", 1
|
||||
local Type, Version = "WeakAurasInput", 2
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
local OnEditFocusGained = function(frame)
|
||||
local self = frame.obj
|
||||
local option = self.userdata.option
|
||||
if option and option.callbacks and option.callbacks.OnEditFocusGained then
|
||||
option.callbacks.OnEditFocusGained(self)
|
||||
end
|
||||
end
|
||||
local eventCallbacks = {
|
||||
OnEditFocusGained = "OnEditFocusGained",
|
||||
OnEditFocusLost = "OnEditFocusLost",
|
||||
OnEnterPressed = "OnEnterPressed",
|
||||
OnShow = "OnShow"
|
||||
}
|
||||
|
||||
local OnShow = function(frame)
|
||||
local function EventHandler(frame, event)
|
||||
local self = frame.obj
|
||||
local option = self.userdata.option
|
||||
if option and option.callbacks and option.callbacks.OnShow then
|
||||
option.callbacks.OnShow(self)
|
||||
if option and option.callbacks and option.callbacks[event] then
|
||||
option.callbacks[event](self)
|
||||
end
|
||||
end
|
||||
|
||||
local function Constructor()
|
||||
local widget = AceGUI:Create("EditBox")
|
||||
widget.type = Type
|
||||
widget.editbox:HookScript("OnEditFocusGained", OnEditFocusGained)
|
||||
widget.editbox:HookScript("OnShow", OnShow)
|
||||
|
||||
for event, callback in pairs(eventCallbacks) do
|
||||
widget.editbox:HookScript(event, function(frame) EventHandler(frame, callback) end)
|
||||
end
|
||||
|
||||
return widget
|
||||
end
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
if not WeakAuras.IsLibsOK() then return end
|
||||
|
||||
local Type, Version = "WeakAurasMultiLineEditBox", 38
|
||||
local Type, Version = "WeakAurasMultiLineEditBox", 39
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
@@ -74,10 +74,15 @@ local function OnCursorChanged(self, _, y, _, cursorHeight)
|
||||
end
|
||||
end
|
||||
|
||||
local function OnEditFocusLost(self) -- EditBox
|
||||
self:HighlightText(0, 0)
|
||||
self.obj:Fire("OnEditFocusLost")
|
||||
self.obj.scrollFrame:EnableMouseWheel(false);
|
||||
local function OnEditFocusLost(frame) -- EditBox
|
||||
local self = frame.obj
|
||||
frame:HighlightText(0, 0)
|
||||
self:Fire("OnEditFocusLost")
|
||||
self.scrollFrame:EnableMouseWheel(false);
|
||||
local option = self.userdata.option
|
||||
if option and option.callbacks and option.callbacks.OnEditFocusLost then
|
||||
option.callbacks.OnEditFocusLost(self)
|
||||
end
|
||||
end
|
||||
|
||||
local function OnEnter(self) -- EditBox / ScrollFrame
|
||||
|
||||
@@ -156,7 +156,13 @@ function OptionsPrivate.GetActionOptions(data)
|
||||
callbacks = {
|
||||
OnEditFocusGained = function(self)
|
||||
local widget = dynamicTextInputs["start_message_dest"]
|
||||
OptionsPrivate.ToggleTextReplacements(data, true, widget)
|
||||
OptionsPrivate.ToggleTextReplacements(data, widget, "OnEditFocusGained")
|
||||
end,
|
||||
OnEditFocusLost = function(self)
|
||||
OptionsPrivate.ToggleTextReplacements(nil, nil, "OnEditFocusLost")
|
||||
end,
|
||||
OnEnterPressed = function(self)
|
||||
OptionsPrivate.ToggleTextReplacements(nil, nil, "OnEnterPressed")
|
||||
end,
|
||||
OnShow = function(self)
|
||||
dynamicTextInputs["start_message_dest"] = self
|
||||
@@ -173,7 +179,7 @@ function OptionsPrivate.GetActionOptions(data)
|
||||
hidden = function() return data.actions.start.message_type ~= "WHISPER" end,
|
||||
func = function()
|
||||
local widget = dynamicTextInputs["start_message_dest"]
|
||||
OptionsPrivate.ToggleTextReplacements(data, nil, widget)
|
||||
OptionsPrivate.ToggleTextReplacements(data, widget, "ToggleButton")
|
||||
end,
|
||||
imageWidth = 24,
|
||||
imageHeight = 24,
|
||||
@@ -199,7 +205,13 @@ function OptionsPrivate.GetActionOptions(data)
|
||||
callbacks = {
|
||||
OnEditFocusGained = function(self)
|
||||
local widget = dynamicTextInputs["start_message"]
|
||||
OptionsPrivate.ToggleTextReplacements(data, true, widget)
|
||||
OptionsPrivate.ToggleTextReplacements(data, widget, "OnEditFocusGained")
|
||||
end,
|
||||
OnEditFocusLost = function(self)
|
||||
OptionsPrivate.ToggleTextReplacements(nil, nil, "OnEditFocusLost")
|
||||
end,
|
||||
OnEnterPressed = function(self)
|
||||
OptionsPrivate.ToggleTextReplacements(nil, nil, "OnEnterPressed")
|
||||
end,
|
||||
OnShow = function(self)
|
||||
dynamicTextInputs["start_message"] = self
|
||||
@@ -215,7 +227,7 @@ function OptionsPrivate.GetActionOptions(data)
|
||||
disabled = function() return not data.actions.start.do_message end,
|
||||
func = function()
|
||||
local widget = dynamicTextInputs["start_message"]
|
||||
OptionsPrivate.ToggleTextReplacements(data, nil, widget)
|
||||
OptionsPrivate.ToggleTextReplacements(data, widget, "ToggleButton")
|
||||
end,
|
||||
imageWidth = 24,
|
||||
imageHeight = 24,
|
||||
@@ -613,7 +625,13 @@ function OptionsPrivate.GetActionOptions(data)
|
||||
callbacks = {
|
||||
OnEditFocusGained = function(self)
|
||||
local widget = dynamicTextInputs["finish_message_dest"]
|
||||
OptionsPrivate.ToggleTextReplacements(data, true, widget)
|
||||
OptionsPrivate.ToggleTextReplacements(data, widget, "OnEditFocusGained")
|
||||
end,
|
||||
OnEditFocusLost = function(self)
|
||||
OptionsPrivate.ToggleTextReplacements(nil, nil, "OnEditFocusLost")
|
||||
end,
|
||||
OnEnterPressed = function(self)
|
||||
OptionsPrivate.ToggleTextReplacements(nil, nil, "OnEnterPressed")
|
||||
end,
|
||||
OnShow = function(self)
|
||||
dynamicTextInputs["finish_message_dest"] = self
|
||||
@@ -630,7 +648,7 @@ function OptionsPrivate.GetActionOptions(data)
|
||||
hidden = function() return data.actions.finish.message_type ~= "WHISPER" end,
|
||||
func = function()
|
||||
local widget = dynamicTextInputs["finish_message_dest"]
|
||||
OptionsPrivate.ToggleTextReplacements(data, nil, widget)
|
||||
OptionsPrivate.ToggleTextReplacements(data, widget, "ToggleButton")
|
||||
end,
|
||||
imageWidth = 24,
|
||||
imageHeight = 24,
|
||||
@@ -656,7 +674,13 @@ function OptionsPrivate.GetActionOptions(data)
|
||||
callbacks = {
|
||||
OnEditFocusGained = function(self)
|
||||
local widget = dynamicTextInputs["finish_message"]
|
||||
OptionsPrivate.ToggleTextReplacements(data, true, widget)
|
||||
OptionsPrivate.ToggleTextReplacements(data, widget, "OnEditFocusGained")
|
||||
end,
|
||||
OnEditFocusLost = function(self)
|
||||
OptionsPrivate.ToggleTextReplacements(nil, nil, "OnEditFocusLost")
|
||||
end,
|
||||
OnEnterPressed = function(self)
|
||||
OptionsPrivate.ToggleTextReplacements(nil, nil, "OnEnterPressed")
|
||||
end,
|
||||
OnShow = function(self)
|
||||
dynamicTextInputs["finish_message"] = self
|
||||
@@ -672,7 +696,7 @@ function OptionsPrivate.GetActionOptions(data)
|
||||
disabled = function() return not data.actions.finish.do_message end,
|
||||
func = function()
|
||||
local widget = dynamicTextInputs["finish_message"]
|
||||
OptionsPrivate.ToggleTextReplacements(data, nil, widget)
|
||||
OptionsPrivate.ToggleTextReplacements(data, widget, "ToggleButton")
|
||||
end,
|
||||
imageWidth = 24,
|
||||
imageHeight = 24,
|
||||
|
||||
@@ -935,7 +935,13 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA
|
||||
callbacks = {
|
||||
OnEditFocusGained = function(self)
|
||||
local widget = dynamicTextInputs["condition" .. i .. "value" .. j .. "message dest"]
|
||||
OptionsPrivate.ToggleTextReplacements(data, true, widget)
|
||||
OptionsPrivate.ToggleTextReplacements(data, widget, "OnEditFocusGained")
|
||||
end,
|
||||
OnEditFocusLost = function(self)
|
||||
OptionsPrivate.ToggleTextReplacements(nil, nil, "OnEditFocusLost")
|
||||
end,
|
||||
OnEnterPressed = function(self)
|
||||
OptionsPrivate.ToggleTextReplacements(nil, nil, "OnEnterPressed")
|
||||
end,
|
||||
OnShow = function(self)
|
||||
dynamicTextInputs["condition" .. i .. "value" .. j .. "message dest"] = self
|
||||
@@ -955,7 +961,7 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA
|
||||
end,
|
||||
func = function()
|
||||
local widget = dynamicTextInputs["condition" .. i .. "value" .. j .. "message dest"]
|
||||
OptionsPrivate.ToggleTextReplacements(data, nil, widget)
|
||||
OptionsPrivate.ToggleTextReplacements(data, widget, "ToggleButton")
|
||||
end,
|
||||
imageWidth = 24,
|
||||
imageHeight = 24,
|
||||
@@ -995,7 +1001,13 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA
|
||||
callbacks = {
|
||||
OnEditFocusGained = function(self)
|
||||
local widget = dynamicTextInputs["condition" .. i .. "value" .. j .. "message"]
|
||||
OptionsPrivate.ToggleTextReplacements(data, true, widget)
|
||||
OptionsPrivate.ToggleTextReplacements(data, widget, "OnEditFocusGained")
|
||||
end,
|
||||
OnEditFocusLost = function(self)
|
||||
OptionsPrivate.ToggleTextReplacements(nil, nil, "OnEditFocusLost")
|
||||
end,
|
||||
OnEnterPressed = function(self)
|
||||
OptionsPrivate.ToggleTextReplacements(nil, nil, "OnEnterPressed")
|
||||
end,
|
||||
OnShow = function(self)
|
||||
dynamicTextInputs["condition" .. i .. "value" .. j .. "message"] = self
|
||||
@@ -1012,7 +1024,7 @@ local function addControlsForChange(args, order, data, conditionVariable, totalA
|
||||
order = order,
|
||||
func = function()
|
||||
local widget = dynamicTextInputs["condition" .. i .. "value" .. j .. "message"]
|
||||
OptionsPrivate.ToggleTextReplacements(data, nil, widget)
|
||||
OptionsPrivate.ToggleTextReplacements(data, widget, "ToggleButton")
|
||||
end,
|
||||
imageWidth = 24,
|
||||
imageHeight = 24,
|
||||
|
||||
@@ -928,14 +928,33 @@ function OptionsPrivate.CreateFrame()
|
||||
dynamicTextCodesFrame.label = dynamicTextCodesLabel
|
||||
dynamicTextCodesFrame:Hide()
|
||||
|
||||
function OptionsPrivate.ToggleTextReplacements(data, show, widget)
|
||||
if show or not dynamicTextCodesFrame:IsShown() then
|
||||
function OptionsPrivate.ToggleTextReplacements(data, widget, event)
|
||||
-- If the text edit has focus when the user clicks on the button, we'll get two events:
|
||||
-- a) The OnEditFocusLost
|
||||
-- b) The ToggleButton OnClick event
|
||||
-- Since we want to hide the text replacement window in that case,
|
||||
-- ignore the ToggleButton if it is directly after the OnEditFocusLost
|
||||
local currentTime = GetTime()
|
||||
if event == "ToggleButton"
|
||||
and dynamicTextCodesFrame.lastCaller
|
||||
and dynamicTextCodesFrame.lastCaller.event == "OnEditFocusLost"
|
||||
and currentTime - dynamicTextCodesFrame.lastCaller.time < 0.2
|
||||
then
|
||||
return
|
||||
end
|
||||
dynamicTextCodesFrame.lastCaller = {
|
||||
event = event,
|
||||
time = currentTime,
|
||||
}
|
||||
if event == "OnEditFocusGained" or not dynamicTextCodesFrame:IsShown() then
|
||||
dynamicTextCodesFrame:Show()
|
||||
if OptionsPrivate.currentDynamicTextInput ~= widget then
|
||||
OptionsPrivate.UpdateTextReplacements(dynamicTextCodesFrame, data)
|
||||
end
|
||||
OptionsPrivate.currentDynamicTextInput = widget
|
||||
else
|
||||
elseif event == "OnEnterPressed" then
|
||||
dynamicTextCodesFrame:Hide()
|
||||
elseif not dynamicTextCodesFrame:IsMouseOver() then -- Prevents hiding when clicking inside the frame
|
||||
dynamicTextCodesFrame:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -43,7 +43,7 @@ local function createOptions(id, data)
|
||||
__order = 1,
|
||||
__dynamicTextCodes = function()
|
||||
local widget = dynamicTextInputs["displayText"]
|
||||
OptionsPrivate.ToggleTextReplacements(data, nil, widget)
|
||||
OptionsPrivate.ToggleTextReplacements(data, widget, "ToggleButton")
|
||||
end,
|
||||
displayText = {
|
||||
type = "input",
|
||||
@@ -65,7 +65,10 @@ local function createOptions(id, data)
|
||||
callbacks = {
|
||||
OnEditFocusGained = function(self)
|
||||
local widget = dynamicTextInputs["displayText"]
|
||||
OptionsPrivate.ToggleTextReplacements(data, true, widget)
|
||||
OptionsPrivate.ToggleTextReplacements(data, widget, "OnEditFocusGained")
|
||||
end,
|
||||
OnEditFocusLost = function(self)
|
||||
OptionsPrivate.ToggleTextReplacements(nil, nil, "OnEditFocusLost")
|
||||
end,
|
||||
OnShow = function(self)
|
||||
dynamicTextInputs["displayText"] = self
|
||||
|
||||
@@ -59,7 +59,13 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
callbacks = {
|
||||
OnEditFocusGained = function(self)
|
||||
local widget = dynamicTextInputs[subIndex]
|
||||
OptionsPrivate.ToggleTextReplacements(parentData, true, widget)
|
||||
OptionsPrivate.ToggleTextReplacements(parentData, widget, "OnEditFocusGained")
|
||||
end,
|
||||
OnEditFocusLost = function(self)
|
||||
OptionsPrivate.ToggleTextReplacements(nil, nil, "OnEditFocusLost")
|
||||
end,
|
||||
OnEnterPressed = function(self)
|
||||
OptionsPrivate.ToggleTextReplacements(nil, nil, "OnEnterPressed")
|
||||
end,
|
||||
OnShow = function(self)
|
||||
dynamicTextInputs[subIndex] = self
|
||||
@@ -74,7 +80,7 @@ local function createOptions(parentData, data, index, subIndex)
|
||||
order = 11.1,
|
||||
func = function()
|
||||
local widget = dynamicTextInputs[subIndex]
|
||||
OptionsPrivate.ToggleTextReplacements(parentData, nil, widget)
|
||||
OptionsPrivate.ToggleTextReplacements(parentData, widget, "ToggleButton")
|
||||
end,
|
||||
imageWidth = 24,
|
||||
imageHeight = 24,
|
||||
|
||||
Reference in New Issue
Block a user