diff --git a/WeakAuras/BuffTrigger.lua b/WeakAuras/BuffTrigger.lua index 1dcc05007c..1aaa36f835 100644 --- a/WeakAuras/BuffTrigger.lua +++ b/WeakAuras/BuffTrigger.lua @@ -1501,7 +1501,7 @@ function BuffTrigger.Add(data) end if (trigger.type == "aura" and not(trigger.unit ~= "group" and trigger.autoclone) - and trigger.unit ~= "multi" and not(trigger.unit == "group" and not trigger.groupclone)) then + and trigger.unit ~= "multi" and not(trigger.unit == "group" and not trigger.groupclone)) then showOn = trigger.showOn; end diff --git a/WeakAuras/Prototypes.lua b/WeakAuras/Prototypes.lua index fa44fa9494..131408b661 100644 --- a/WeakAuras/Prototypes.lua +++ b/WeakAuras/Prototypes.lua @@ -795,52 +795,52 @@ WeakAuras.load_prototype = { local single_class; -- First check to use if the class load is on multi-select with only one class selected if(trigger.use_class == false and trigger.class and trigger.class.multi) then - local num_classes = 0; - for class in pairs(trigger.class.multi) do - single_class = class; - num_classes = num_classes + 1; - end - if(num_classes ~= 1) then - single_class = nil; - end + local num_classes = 0; + for class in pairs(trigger.class.multi) do + single_class = class; + num_classes = num_classes + 1; + end + if(num_classes ~= 1) then + single_class = nil; + end end -- If that is not the case, see if it is on single-select if((not single_class) and trigger.use_class and trigger.class and trigger.class.single) then - single_class = trigger.class.single + single_class = trigger.class.single end if (trigger.use_class == nil) then -- no class selected, fallback to current class - single_class = select(2, UnitClass("player")); + single_class = select(2, UnitClass("player")); end local single_spec; if (single_class) then - if(trigger.use_spec == false and trigger.spec and trigger.spec.multi) then - local num_specs = 0; - for spec in pairs(trigger.spec.multi) do - single_spec = spec; - num_specs = num_specs + 1; - end - if (num_specs ~= 1) then - single_spec = nil; - end - end + if(trigger.use_spec == false and trigger.spec and trigger.spec.multi) then + local num_specs = 0; + for spec in pairs(trigger.spec.multi) do + single_spec = spec; + num_specs = num_specs + 1; + end + if (num_specs ~= 1) then + single_spec = nil; + end + end end if ((not single_spec) and trigger.use_spec and trigger.spec and trigger.spec.single) then - single_spec = trigger.spec.single; + single_spec = trigger.spec.single; end if (trigger.use_spec == nil) then - single_spec = GetSpecialization(); + single_spec = GetSpecialization(); end -- print ("Using talent cache", single_class, single_spec); -- If a single specific class was found, load the specific list for it if(single_class and WeakAuras.pvp_talent_types_specific[single_class] - and single_spec and WeakAuras.pvp_talent_types_specific[single_class][single_spec]) then - return WeakAuras.pvp_talent_types_specific[single_class][single_spec]; + and single_spec and WeakAuras.pvp_talent_types_specific[single_class][single_spec]) then + return WeakAuras.pvp_talent_types_specific[single_class][single_spec]; else - return WeakAuras.pvp_talent_types; + return WeakAuras.pvp_talent_types; end end end, @@ -884,8 +884,8 @@ WeakAuras.load_prototype = { type = "string", init = "arg", desc = function() - return L["Supports multiple entries, separated by commas\n"] .. L["Current Zone ID: "] .. C_Map.GetBestMapForUnit("player") - end, + return L["Supports multiple entries, separated by commas\n"] .. L["Current Zone ID: "] .. C_Map.GetBestMapForUnit("player") + end, test = "WeakAuras.CheckNumericIds([[%s]], zoneId)", }, { @@ -2393,7 +2393,7 @@ WeakAuras.event_prototypes = { ["Cooldown Ready (Item)"] = { type = "event", events = { - }, + }, internal_events = { "ITEM_COOLDOWN_READY", }, @@ -3656,8 +3656,8 @@ WeakAuras.event_prototypes = { type = "select", values = "rune_specific_types", test = "(showOn == \"showOnReady\" and (startTime == 0)) " .. - "or (showOn == \"showOnCooldown\" and startTime > 0) " .. - "or (showOn == \"showAlways\")", + "or (showOn == \"showOnCooldown\" and startTime > 0) " .. + "or (showOn == \"showAlways\")", enable = function(trigger) return not trigger.use_runesCount end, reloadOptions = true }, diff --git a/WeakAuras/RegionTypes/AuraBar.lua b/WeakAuras/RegionTypes/AuraBar.lua index 99a4186fb2..b00956b68f 100644 --- a/WeakAuras/RegionTypes/AuraBar.lua +++ b/WeakAuras/RegionTypes/AuraBar.lua @@ -251,36 +251,36 @@ local GetTexCoordSpark = function(degree, mirror) end local GetTexCoordFunctions = -{ - ["HORIZONTAL"] = function(startProgress, endProgress) - local TLx, TLy = startProgress, 0; - local TRx, TRy = endProgress, 0; - local BLx, BLy = startProgress, 1; - local BRx, BRy = endProgress, 1; - return TLx, TLy, BLx, BLy, TRx, TRy, BRx, BRy; - end, - ["HORIZONTAL_INVERSE"] = function(startProgress, endProgress) - local TLx, TLy = endProgress, 0; - local TRx, TRy = startProgress, 0; - local BLx, BLy = endProgress, 1; - local BRx, BRy = startProgress, 1; - return TLx, TLy, BLx, BLy, TRx, TRy, BRx, BRy; - end, - ["VERTICAL"] = function(startProgress, endProgress) - local TLx, TLy = startProgress, 1; - local TRx, TRy = startProgress, 0; - local BLx, BLy = endProgress, 1; - local BRx, BRy = endProgress, 0; - return TLx, TLy, BLx, BLy, TRx, TRy, BRx, BRy; - end, - ["VERTICAL_INVERSE"] = function(startProgress, endProgress) - local TLx, TLy = endProgress, 0; - local TRx, TRy = endProgress, 1; - local BLx, BLy = startProgress, 0; - local BRx, BRy = startProgress, 1; - return TLx, TLy, BLx, BLy, TRx, TRy, BRx, BRy; - end -} + { + ["HORIZONTAL"] = function(startProgress, endProgress) + local TLx, TLy = startProgress, 0; + local TRx, TRy = endProgress, 0; + local BLx, BLy = startProgress, 1; + local BRx, BRy = endProgress, 1; + return TLx, TLy, BLx, BLy, TRx, TRy, BRx, BRy; + end, + ["HORIZONTAL_INVERSE"] = function(startProgress, endProgress) + local TLx, TLy = endProgress, 0; + local TRx, TRy = startProgress, 0; + local BLx, BLy = endProgress, 1; + local BRx, BRy = startProgress, 1; + return TLx, TLy, BLx, BLy, TRx, TRy, BRx, BRy; + end, + ["VERTICAL"] = function(startProgress, endProgress) + local TLx, TLy = startProgress, 1; + local TRx, TRy = startProgress, 0; + local BLx, BLy = endProgress, 1; + local BRx, BRy = endProgress, 0; + return TLx, TLy, BLx, BLy, TRx, TRy, BRx, BRy; + end, + ["VERTICAL_INVERSE"] = function(startProgress, endProgress) + local TLx, TLy = endProgress, 0; + local TRx, TRy = endProgress, 1; + local BLx, BLy = startProgress, 0; + local BRx, BRy = startProgress, 1; + return TLx, TLy, BLx, BLy, TRx, TRy, BRx, BRy; + end + } local anchorAlignment = { ["HORIZONTAL"] = { "TOPLEFT", "BOTTOMLEFT", "RIGHT" }, diff --git a/WeakAuras/RegionTypes/ProgressTexture.lua b/WeakAuras/RegionTypes/ProgressTexture.lua index a8090cbe61..37cbedbf69 100644 --- a/WeakAuras/RegionTypes/ProgressTexture.lua +++ b/WeakAuras/RegionTypes/ProgressTexture.lua @@ -489,179 +489,179 @@ local orientationToAnchorPoint = { } local textureFunctions = { - SetValueFunctions = { - ["HORIZONTAL"] = function(self, startProgress, endProgress) - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", startProgress, 0 ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", startProgress, 1 ); - - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", endProgress, 0 ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", endProgress, 1 ); - end, - ["HORIZONTAL_INVERSE"] = function(self, startProgress, endProgress) - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", 1 - endProgress, 0 ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", 1 - endProgress, 1 ); - - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", 1 - startProgress, 0 ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", 1 - startProgress, 1 ); - end, - ["VERTICAL"] = function(self, startProgress, endProgress) - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", 0, 1 - endProgress ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", 1, 1 - endProgress ); - - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", 0, 1 - startProgress ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", 1, 1 - startProgress ); - end, - ["VERTICAL_INVERSE"] = function(self, startProgress, endProgress) - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", 0, startProgress ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", 1, startProgress ); - - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", 0, endProgress ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", 1, endProgress ); - end, - }, - - SetValueFunctionsSlanted = { - ["HORIZONTAL"] = function(self, startProgress, endProgress) - local slant = self.slant or 0; - if (self.slantMode == "EXTEND") then - startProgress = startProgress * (1 + slant) - slant; - endProgress = endProgress * (1 + slant) - slant; - else - startProgress = startProgress * (1 - slant); - endProgress = endProgress * (1 - slant); - end + SetValueFunctions = { + ["HORIZONTAL"] = function(self, startProgress, endProgress) + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", startProgress, 0 ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", startProgress, 1 ); - local slant1 = self.slantFirst and 0 or slant; - local slant2 = self.slantFirst and slant or 0; + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", endProgress, 0 ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", endProgress, 1 ); + end, + ["HORIZONTAL_INVERSE"] = function(self, startProgress, endProgress) + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", 1 - endProgress, 0 ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", 1 - endProgress, 1 ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", startProgress + slant1, 0 ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", startProgress + slant2, 1 ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", 1 - startProgress, 0 ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", 1 - startProgress, 1 ); + end, + ["VERTICAL"] = function(self, startProgress, endProgress) + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", 0, 1 - endProgress ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", 1, 1 - endProgress ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", endProgress + slant1, 0 ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", endProgress + slant2, 1 ); - end, - ["HORIZONTAL_INVERSE"] = function(self, startProgress, endProgress) - local slant = self.slant or 0; - if (self.slantMode == "EXTEND") then - startProgress = startProgress * (1 + slant) - slant; - endProgress = endProgress * (1 + slant) - slant; - else - startProgress = startProgress * (1 - slant); - endProgress = endProgress * (1 - slant); - end + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", 0, 1 - startProgress ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", 1, 1 - startProgress ); + end, + ["VERTICAL_INVERSE"] = function(self, startProgress, endProgress) + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", 0, startProgress ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", 1, startProgress ); - local slant1 = self.slantFirst and slant or 0; - local slant2 = self.slantFirst and 0 or slant; + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", 0, endProgress ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", 1, endProgress ); + end, + }, - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", 1 - endProgress - slant1, 0 ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", 1 - endProgress - slant2, 1 ); + SetValueFunctionsSlanted = { + ["HORIZONTAL"] = function(self, startProgress, endProgress) + local slant = self.slant or 0; + if (self.slantMode == "EXTEND") then + startProgress = startProgress * (1 + slant) - slant; + endProgress = endProgress * (1 + slant) - slant; + else + startProgress = startProgress * (1 - slant); + endProgress = endProgress * (1 - slant); + end - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", 1 - startProgress - slant1, 0 ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", 1 - startProgress - slant2, 1 ); - end, - ["VERTICAL"] = function(self, startProgress, endProgress) - local slant = self.slant or 0; - if (self.slantMode == "EXTEND") then - startProgress = startProgress * (1 + slant) - slant; - endProgress = endProgress * (1 + slant) - slant; - else - startProgress = startProgress * (1 - slant); - endProgress = endProgress * (1 - slant); - end + local slant1 = self.slantFirst and 0 or slant; + local slant2 = self.slantFirst and slant or 0; - local slant1 = self.slantFirst and slant or 0; - local slant2 = self.slantFirst and 0 or slant; + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", startProgress + slant1, 0 ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", startProgress + slant2, 1 ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", 0, 1 - endProgress - slant1 ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", 1, 1 - endProgress - slant2 ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", endProgress + slant1, 0 ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", endProgress + slant2, 1 ); + end, + ["HORIZONTAL_INVERSE"] = function(self, startProgress, endProgress) + local slant = self.slant or 0; + if (self.slantMode == "EXTEND") then + startProgress = startProgress * (1 + slant) - slant; + endProgress = endProgress * (1 + slant) - slant; + else + startProgress = startProgress * (1 - slant); + endProgress = endProgress * (1 - slant); + end - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", 0, 1 - startProgress - slant1 ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", 1, 1 - startProgress - slant2 ); - end, - ["VERTICAL_INVERSE"] = function(self, startProgress, endProgress) - local slant = self.slant or 0; - if (self.slantMode == "EXTEND") then - startProgress = startProgress * (1 + slant) - slant; - endProgress = endProgress * (1 + slant) - slant; - else - startProgress = startProgress * (1 - slant); - endProgress = endProgress * (1 - slant); - end + local slant1 = self.slantFirst and slant or 0; + local slant2 = self.slantFirst and 0 or slant; - local slant1 = self.slantFirst and 0 or slant; - local slant2 = self.slantFirst and slant or 0; + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", 1 - endProgress - slant1, 0 ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", 1 - endProgress - slant2, 1 ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", 0, startProgress + slant1 ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", 1, startProgress + slant2 ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", 1 - startProgress - slant1, 0 ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", 1 - startProgress - slant2, 1 ); + end, + ["VERTICAL"] = function(self, startProgress, endProgress) + local slant = self.slant or 0; + if (self.slantMode == "EXTEND") then + startProgress = startProgress * (1 + slant) - slant; + endProgress = endProgress * (1 + slant) - slant; + else + startProgress = startProgress * (1 - slant); + endProgress = endProgress * (1 - slant); + end - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", 0, endProgress + slant1 ); - self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", 1, endProgress + slant2 ); - end, - }, + local slant1 = self.slantFirst and slant or 0; + local slant2 = self.slantFirst and 0 or slant; - SetBackgroundOffset = function(self, backgroundOffset) - self.backgroundOffset = backgroundOffset; - end, + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", 0, 1 - endProgress - slant1 ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", 1, 1 - endProgress - slant2 ); - SetOrientation = function(self, orientation, compress, slanted, slant, slantFirst, slantMode) - self.SetValueFunction = slanted and self.SetValueFunctionsSlanted[orientation] or self.SetValueFunctions[orientation]; - self.compress = compress; - self.slanted = slanted; - self.slant = slant; - self.slantFirst = slantFirst; - self.slantMode = slantMode; - if (self.compress) then - self:ClearAllPoints(); - local anchor = orientationToAnchorPoint[orientation]; - self:SetPoint(anchor, self.region, anchor); - self.horizontal = orientation == "HORIZONTAL" or orientation == "HORIZONTAL_INVERSE"; + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", 0, 1 - startProgress - slant1 ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", 1, 1 - startProgress - slant2 ); + end, + ["VERTICAL_INVERSE"] = function(self, startProgress, endProgress) + local slant = self.slant or 0; + if (self.slantMode == "EXTEND") then + startProgress = startProgress * (1 + slant) - slant; + endProgress = endProgress * (1 + slant) - slant; else - local offset = self.backgroundOffset or 0; - self:ClearAllPoints(); - self:SetPoint("BOTTOMLEFT", self.region, "BOTTOMLEFT", -1 * offset, -1 * offset); - self:SetPoint("TOPRIGHT", self.region, "TOPRIGHT", offset, offset); + startProgress = startProgress * (1 - slant); + endProgress = endProgress * (1 - slant); end - self:Update(); + + local slant1 = self.slantFirst and 0 or slant; + local slant2 = self.slantFirst and slant or 0; + + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UL", 0, startProgress + slant1 ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "UR", 1, startProgress + slant2 ); + + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LL", 0, endProgress + slant1 ); + self.coord:MoveCorner(self:GetWidth(), self:GetHeight(), "LR", 1, endProgress + slant2 ); end, + }, + + SetBackgroundOffset = function(self, backgroundOffset) + self.backgroundOffset = backgroundOffset; + end, + + SetOrientation = function(self, orientation, compress, slanted, slant, slantFirst, slantMode) + self.SetValueFunction = slanted and self.SetValueFunctionsSlanted[orientation] or self.SetValueFunctions[orientation]; + self.compress = compress; + self.slanted = slanted; + self.slant = slant; + self.slantFirst = slantFirst; + self.slantMode = slantMode; + if (self.compress) then + self:ClearAllPoints(); + local anchor = orientationToAnchorPoint[orientation]; + self:SetPoint(anchor, self.region, anchor); + self.horizontal = orientation == "HORIZONTAL" or orientation == "HORIZONTAL_INVERSE"; + else + local offset = self.backgroundOffset or 0; + self:ClearAllPoints(); + self:SetPoint("BOTTOMLEFT", self.region, "BOTTOMLEFT", -1 * offset, -1 * offset); + self:SetPoint("TOPRIGHT", self.region, "TOPRIGHT", offset, offset); + end + self:Update(); + end, - SetValue = function(self, startProgress, endProgress) - self.startProgress = startProgress; - self.endProgress = endProgress; + SetValue = function(self, startProgress, endProgress) + self.startProgress = startProgress; + self.endProgress = endProgress; - if (self.compress) then - local progress = self.region.progress or 1; - local horScale = self.horizontal and progress or 1; - local verScale = self.horizontal and 1 or progress; - self:SetWidth(self.region:GetWidth() * horScale); - self:SetHeight(self.region:GetHeight() * verScale); + if (self.compress) then + local progress = self.region.progress or 1; + local horScale = self.horizontal and progress or 1; + local verScale = self.horizontal and 1 or progress; + self:SetWidth(self.region:GetWidth() * horScale); + self:SetHeight(self.region:GetHeight() * verScale); - if (progress > 0.1) then - startProgress = startProgress / progress; - endProgress = endProgress / progress; - else - startProgress, endProgress = 0, 0; - end + if (progress > 0.1) then + startProgress = startProgress / progress; + endProgress = endProgress / progress; + else + startProgress, endProgress = 0, 0; end + end - self.coord:SetFull(); - self:SetValueFunction(startProgress, endProgress); + self.coord:SetFull(); + self:SetValueFunction(startProgress, endProgress); - local region = self.region; - local scalex = region.scale_x or 1; - local scaley = region.scale_y or 1; - local rotation = region.rotation or 0; - local mirror_h = region.mirror_h or false; - local mirror_v = region.mirror_v or false; - local user_x = region.user_x; - local user_y = region.user_y; + local region = self.region; + local scalex = region.scale_x or 1; + local scaley = region.scale_y or 1; + local rotation = region.rotation or 0; + local mirror_h = region.mirror_h or false; + local mirror_v = region.mirror_v or false; + local user_x = region.user_x; + local user_y = region.user_y; - self.coord:Transform(scalex, scaley, rotation, mirror_h, mirror_v, user_x, user_y); - self.coord:Apply(); - end, + self.coord:Transform(scalex, scaley, rotation, mirror_h, mirror_v, user_x, user_y); + self.coord:Apply(); + end, - Update = function(self) - self:SetValue(self.startProgress, self.endProgress); - end, + Update = function(self) + self:SetValue(self.startProgress, self.endProgress); + end, } diff --git a/WeakAuras/WeakAuras.lua b/WeakAuras/WeakAuras.lua index 5147220918..00e8922588 100644 --- a/WeakAuras/WeakAuras.lua +++ b/WeakAuras/WeakAuras.lua @@ -558,7 +558,7 @@ function WeakAuras.ConstructFunction(prototype, trigger, skipOptional) tinsert(input, name); end if (arg.optional and skipOptional) then - -- Do nothing + -- Do nothing elseif(arg.hidden or arg.type == "tristate" or arg.type == "toggle" or (arg.type == "multiselect" and trigger["use_"..name] ~= nil) or ((trigger["use_"..name] or arg.required) and trigger[name])) then if(arg.init and arg.init ~= "arg") then init = init.."local "..name.." = "..arg.init.."\n"; @@ -840,9 +840,9 @@ local function CreateActivateCondition(ret, id, condition, conditionNumber, prop elseif (propertyData.action) then local pathToCustomFunction = "nil"; if (WeakAuras.customConditionsFunctions[id] - and WeakAuras.customConditionsFunctions[id][conditionNumber] - and WeakAuras.customConditionsFunctions[id][conditionNumber].changes - and WeakAuras.customConditionsFunctions[id][conditionNumber].changes[changeNum]) then + and WeakAuras.customConditionsFunctions[id][conditionNumber] + and WeakAuras.customConditionsFunctions[id][conditionNumber].changes + and WeakAuras.customConditionsFunctions[id][conditionNumber].changes[changeNum]) then pathToCustomFunction = string.format("WeakAuras.customConditionsFunctions[%q][%s].changes[%s]", id, conditionNumber, changeNum); end ret = ret .. " if (not skipActions) then\n"; @@ -2062,7 +2062,7 @@ function WeakAuras.Modernize(data) }; load.use_ingroup = false; elseif (load.use_ingroup == false) then - load.ingroup.single = "solo"; + load.ingroup.single = "solo"; load.ingroup.multi = {}; load.use_ingroup = true; end @@ -4030,9 +4030,9 @@ function WeakAuras.UpdatedTriggerState(id) if (not activeTriggerState[cloneId] or not activeTriggerState[cloneId].show) then clone:Collapse(); end - end - -- Show new states - ApplyStatesToRegions(id, newActiveTrigger, activeTriggerState); + end + -- Show new states + ApplyStatesToRegions(id, newActiveTrigger, activeTriggerState); end for cloneId, state in pairs(activeTriggerState) do @@ -4136,20 +4136,20 @@ function WeakAuras.ReplacePlaceHolders(textStr, region, customFunc) if (value) then textStr = string.sub(textStr, 1, currentPos - 1) .. value .. string.sub(textStr, endPos + 1); end - elseif (endPos > currentPos and regionState) then - local symbol = string.sub(textStr, currentPos + 1, endPos); - local value = regionState[symbol] and tostring(regionState[symbol]); - if (value) then - textStr = string.sub(textStr, 1, currentPos - 1) .. value .. string.sub(textStr, endPos + 1); - else - value = ReplaceValuePlaceHolders(string.sub(textStr, currentPos, currentPos + 1), region, customFunc); - value = value or ""; - textStr = string.sub(textStr, 1, currentPos - 1) .. value .. string.sub(textStr, currentPos + 2); - end + elseif (endPos > currentPos and regionState) then + local symbol = string.sub(textStr, currentPos + 1, endPos); + local value = regionState[symbol] and tostring(regionState[symbol]); + if (value) then + textStr = string.sub(textStr, 1, currentPos - 1) .. value .. string.sub(textStr, endPos + 1); + else + value = ReplaceValuePlaceHolders(string.sub(textStr, currentPos, currentPos + 1), region, customFunc); + value = value or ""; + textStr = string.sub(textStr, 1, currentPos - 1) .. value .. string.sub(textStr, currentPos + 2); end - endPos = currentPos - 1; + end + endPos = currentPos - 1; elseif (char >= 65 and char <= 90) or (char >= 97 and char <= 122) then - -- a-zA-Z character + -- a-zA-Z character else endPos = currentPos - 1; end diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasDisplayButton.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasDisplayButton.lua index 961df253fd..efd49e337e 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasDisplayButton.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasDisplayButton.lua @@ -36,11 +36,11 @@ local function copyAuraPart(source, destination, part) if (part == "display" or all) then for k, v in pairs(source) do if (not ignoreForCopyingDisplay[k]) then - if (type(v) == "table") then - destination[k] = CopyTable(v); - else - destination[k] = v; - end + if (type(v) == "table") then + destination[k] = CopyTable(v); + else + destination[k] = v; + end end end end diff --git a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasMultiLineEditBox.lua b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasMultiLineEditBox.lua index f464148b12..253f204148 100644 --- a/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasMultiLineEditBox.lua +++ b/WeakAurasOptions/AceGUI-Widgets/AceGUIWidget-WeakAurasMultiLineEditBox.lua @@ -19,374 +19,374 @@ Support functions -------------------------------------------------------------------------------]] if not AceGUIWeakAurasMultiLineEditBoxInsertLink then - -- upgradeable hook - hooksecurefunc("ChatEdit_InsertLink", function(...) return _G.AceGUIWeakAurasMultiLineEditBoxInsertLink(...) end) + -- upgradeable hook + hooksecurefunc("ChatEdit_InsertLink", function(...) return _G.AceGUIWeakAurasMultiLineEditBoxInsertLink(...) end) end function _G.AceGUIWeakAurasMultiLineEditBoxInsertLink(text) - for i = 1, AceGUI:GetWidgetCount(Type) do - local editbox = _G[("WeakAurasMultiLineEditBox%uEdit"):format(i)] - if editbox and editbox:IsVisible() and editbox:HasFocus() then - editbox:Insert(text) - return true - end - end + for i = 1, AceGUI:GetWidgetCount(Type) do + local editbox = _G[("WeakAurasMultiLineEditBox%uEdit"):format(i)] + if editbox and editbox:IsVisible() and editbox:HasFocus() then + editbox:Insert(text) + return true + end + end end local function Layout(self) - self:SetHeight(self.numlines * 14 + (self.disablebutton and 19 or 41) + self.labelHeight) - - if self.labelHeight == 0 then - self.scrollBar:SetPoint("TOP", self.frame, "TOP", 0, -23) - else - self.scrollBar:SetPoint("TOP", self.label, "BOTTOM", 0, -19) - end - - if self.disablebutton then - self.scrollBar:SetPoint("BOTTOM", self.frame, "BOTTOM", 0, 21) - self.scrollBG:SetPoint("BOTTOMLEFT", 0, 4) - else - self.scrollBar:SetPoint("BOTTOM", self.button, "TOP", 0, 18) - self.scrollBG:SetPoint("BOTTOMLEFT", self.button, "TOPLEFT") - end + self:SetHeight(self.numlines * 14 + (self.disablebutton and 19 or 41) + self.labelHeight) + + if self.labelHeight == 0 then + self.scrollBar:SetPoint("TOP", self.frame, "TOP", 0, -23) + else + self.scrollBar:SetPoint("TOP", self.label, "BOTTOM", 0, -19) + end + + if self.disablebutton then + self.scrollBar:SetPoint("BOTTOM", self.frame, "BOTTOM", 0, 21) + self.scrollBG:SetPoint("BOTTOMLEFT", 0, 4) + else + self.scrollBar:SetPoint("BOTTOM", self.button, "TOP", 0, 18) + self.scrollBG:SetPoint("BOTTOMLEFT", self.button, "TOPLEFT") + end end --[[----------------------------------------------------------------------------- Scripts -------------------------------------------------------------------------------]] local function OnClick(self) -- Button - self = self.obj - self.editBox:ClearFocus() - if not self:Fire("OnEnterPressed", self.editBox:GetText()) then - self.button:Disable() - end + self = self.obj + self.editBox:ClearFocus() + if not self:Fire("OnEnterPressed", self.editBox:GetText()) then + self.button:Disable() + end end local function OnCursorChanged(self, _, y, _, cursorHeight) -- EditBox - self, y = self.obj.scrollFrame, -y - local offset = self:GetVerticalScroll() - if y < offset then - self:SetVerticalScroll(y) - else - y = y + cursorHeight - self:GetHeight() - if y > offset then - self:SetVerticalScroll(y) - end - end + self, y = self.obj.scrollFrame, -y + local offset = self:GetVerticalScroll() + if y < offset then + self:SetVerticalScroll(y) + else + y = y + cursorHeight - self:GetHeight() + if y > offset then + self:SetVerticalScroll(y) + end + end end local function OnEditFocusLost(self) -- EditBox - self:HighlightText(0, 0) - self.obj:Fire("OnEditFocusLost") - self.obj.scrollFrame:EnableMouseWheel(false); + self:HighlightText(0, 0) + self.obj:Fire("OnEditFocusLost") + self.obj.scrollFrame:EnableMouseWheel(false); end local function OnEnter(self) -- EditBox / ScrollFrame - self = self.obj - if not self.entered then - self.entered = true - self:Fire("OnEnter") - end + self = self.obj + if not self.entered then + self.entered = true + self:Fire("OnEnter") + end end local function OnLeave(self) -- EditBox / ScrollFrame - self = self.obj - if self.entered then - self.entered = nil - self:Fire("OnLeave") - end + self = self.obj + if self.entered then + self.entered = nil + self:Fire("OnLeave") + end end local function OnMouseUp(self) -- ScrollFrame - self = self.obj.editBox - self:SetFocus() - self:SetCursorPosition(self:GetNumLetters()) + self = self.obj.editBox + self:SetFocus() + self:SetCursorPosition(self:GetNumLetters()) end local function OnReceiveDrag(self) -- EditBox / ScrollFrame - local type, id, info = GetCursorInfo() - if type == "spell" then - info = GetSpellInfo(id, info) - elseif type ~= "item" then - return - end - ClearCursor() - self = self.obj - local editBox = self.editBox - if not editBox:HasFocus() then - editBox:SetFocus() - editBox:SetCursorPosition(editBox:GetNumLetters()) - end - editBox:Insert(info) - self.button:Enable() + local type, id, info = GetCursorInfo() + if type == "spell" then + info = GetSpellInfo(id, info) + elseif type ~= "item" then + return + end + ClearCursor() + self = self.obj + local editBox = self.editBox + if not editBox:HasFocus() then + editBox:SetFocus() + editBox:SetCursorPosition(editBox:GetNumLetters()) + end + editBox:Insert(info) + self.button:Enable() end local function OnSizeChanged(self, width, height) -- ScrollFrame - self.obj.editBox:SetWidth(width) + self.obj.editBox:SetWidth(width) end local function OnTextChanged(self, userInput) -- EditBox - if userInput then - self = self.obj - self:Fire("OnTextChanged", self.editBox:GetText()) - self.button:Enable() - end + if userInput then + self = self.obj + self:Fire("OnTextChanged", self.editBox:GetText()) + self.button:Enable() +end end local function OnTextSet(self) -- EditBox - self:HighlightText(0, 0) - self:SetCursorPosition(self:GetNumLetters()) - self:SetCursorPosition(0) - self.obj.button:Disable() + self:HighlightText(0, 0) + self:SetCursorPosition(self:GetNumLetters()) + self:SetCursorPosition(0) + self.obj.button:Disable() end local function OnVerticalScroll(self, offset) -- ScrollFrame - local editBox = self.obj.editBox - editBox:SetHitRectInsets(0, 0, offset, editBox:GetHeight() - offset - self:GetHeight()) + local editBox = self.obj.editBox + editBox:SetHitRectInsets(0, 0, offset, editBox:GetHeight() - offset - self:GetHeight()) end local function OnFrameShow(frame) - if (frame.focusOnShow) then - frame.obj.editBox:SetFocus() - frame.focusOnShow = nil; - end - local self = frame.obj; - local option = self.userdata.option; - local numExtraButtons = 0; - if (option and option.arg and option.arg.extraFunctions) then - numExtraButtons = #option.arg.extraFunctions; - for index, data in ipairs(option.arg.extraFunctions) do - if (not self.extraButtons[index]) then - local extraButton = CreateFrame("Button", ("%s%dExpandButton%d"):format(Type, self.widgetNum, index), frame, "UIPanelButtonTemplate") - extraButton:SetPoint("LEFT", self.extraButtons[index - 1], "RIGHT"); - extraButton:SetHeight(22) - extraButton:SetWidth(100); - self.extraButtons[index] = extraButton; - end - local extraButton = self.extraButtons[index]; - extraButton:SetText(data.buttonLabel); - extraButton:SetScript("OnClick", data.func); - extraButton:Show(); - end - end - - for i = numExtraButtons + 1, #self.extraButtons do - self.extraButtons[i]:Hide(); - end + if (frame.focusOnShow) then + frame.obj.editBox:SetFocus() + frame.focusOnShow = nil; + end + local self = frame.obj; + local option = self.userdata.option; + local numExtraButtons = 0; + if (option and option.arg and option.arg.extraFunctions) then + numExtraButtons = #option.arg.extraFunctions; + for index, data in ipairs(option.arg.extraFunctions) do + if (not self.extraButtons[index]) then + local extraButton = CreateFrame("Button", ("%s%dExpandButton%d"):format(Type, self.widgetNum, index), frame, "UIPanelButtonTemplate") + extraButton:SetPoint("LEFT", self.extraButtons[index - 1], "RIGHT"); + extraButton:SetHeight(22) + extraButton:SetWidth(100); + self.extraButtons[index] = extraButton; + end + local extraButton = self.extraButtons[index]; + extraButton:SetText(data.buttonLabel); + extraButton:SetScript("OnClick", data.func); + extraButton:Show(); + end + end + + for i = numExtraButtons + 1, #self.extraButtons do + self.extraButtons[i]:Hide(); + end end local function OnEditFocusGained(frame) - AceGUI:SetFocus(frame.obj) - frame.obj:Fire("OnEditFocusGained") - frame.obj.scrollFrame:EnableMouseWheel(true); + AceGUI:SetFocus(frame.obj) + frame.obj:Fire("OnEditFocusGained") + frame.obj.scrollFrame:EnableMouseWheel(true); end --[[----------------------------------------------------------------------------- Methods -------------------------------------------------------------------------------]] local methods = { - ["OnAcquire"] = function(self) - self.editBox:SetText("") - self:SetDisabled(false) - self:SetWidth(200) - self:DisableButton(false) - self:SetNumLines() - self.entered = nil - self:SetMaxLetters(0) - end, - - ["OnRelease"] = function(self) - self:ClearFocus() - end, - - ["SetDisabled"] = function(self, disabled) - local editBox = self.editBox - if disabled then - editBox:ClearFocus() - editBox:EnableMouse(false) - editBox:SetTextColor(0.5, 0.5, 0.5) - self.label:SetTextColor(0.5, 0.5, 0.5) - self.scrollFrame:EnableMouse(false) - self.button:Disable() - else - editBox:EnableMouse(true) - editBox:SetTextColor(1, 1, 1) - self.label:SetTextColor(1, 0.82, 0) - self.scrollFrame:EnableMouse(true) - end - end, - - ["SetLabel"] = function(self, text) - if text and text ~= "" then - self.label:SetText(text) - if self.labelHeight ~= 10 then - self.labelHeight = 10 - self.label:Show() - end - elseif self.labelHeight ~= 0 then - self.labelHeight = 0 - self.label:Hide() - end - Layout(self) - end, - - ["SetNumLines"] = function(self, value) - if not value or value < 4 then - value = 4 - end - self.numlines = value - Layout(self) - end, - - ["SetText"] = function(self, text) - self.editBox:SetText(IndentationLib.encode(text)) - end, - - ["GetText"] = function(self) - return IndentationLib.decode(self.editBox:GetText()) - end, - - ["SetMaxLetters"] = function (self, num) - self.editBox:SetMaxLetters(num or 0) - end, - - ["DisableButton"] = function(self, disabled) - self.disablebutton = disabled - if disabled then - self.button:Hide() - else - self.button:Show() - end - Layout(self) - end, - - ["ClearFocus"] = function(self) - self.editBox:ClearFocus() - self.frame.focusOnShow = nil; - end, - - ["SetFocus"] = function(self) - self.editBox:SetFocus() - if not self.frame:IsShown() then - self.frame.focusOnShow = true; - end - end, - - ["HighlightText"] = function(self, from, to) - self.editBox:HighlightText(from, to) - end, - - ["GetCursorPosition"] = function(self) - return self.editBox:GetCursorPosition() - end, - - ["SetCursorPosition"] = function(self, ...) - return self.editBox:SetCursorPosition(...) - end, + ["OnAcquire"] = function(self) + self.editBox:SetText("") + self:SetDisabled(false) + self:SetWidth(200) + self:DisableButton(false) + self:SetNumLines() + self.entered = nil + self:SetMaxLetters(0) + end, + + ["OnRelease"] = function(self) + self:ClearFocus() + end, + + ["SetDisabled"] = function(self, disabled) + local editBox = self.editBox + if disabled then + editBox:ClearFocus() + editBox:EnableMouse(false) + editBox:SetTextColor(0.5, 0.5, 0.5) + self.label:SetTextColor(0.5, 0.5, 0.5) + self.scrollFrame:EnableMouse(false) + self.button:Disable() + else + editBox:EnableMouse(true) + editBox:SetTextColor(1, 1, 1) + self.label:SetTextColor(1, 0.82, 0) + self.scrollFrame:EnableMouse(true) + end + end, + + ["SetLabel"] = function(self, text) + if text and text ~= "" then + self.label:SetText(text) + if self.labelHeight ~= 10 then + self.labelHeight = 10 + self.label:Show() + end + elseif self.labelHeight ~= 0 then + self.labelHeight = 0 + self.label:Hide() + end + Layout(self) + end, + + ["SetNumLines"] = function(self, value) + if not value or value < 4 then + value = 4 + end + self.numlines = value + Layout(self) + end, + + ["SetText"] = function(self, text) + self.editBox:SetText(IndentationLib.encode(text)) + end, + + ["GetText"] = function(self) + return IndentationLib.decode(self.editBox:GetText()) + end, + + ["SetMaxLetters"] = function (self, num) + self.editBox:SetMaxLetters(num or 0) + end, + + ["DisableButton"] = function(self, disabled) + self.disablebutton = disabled + if disabled then + self.button:Hide() + else + self.button:Show() + end + Layout(self) + end, + + ["ClearFocus"] = function(self) + self.editBox:ClearFocus() + self.frame.focusOnShow = nil; + end, + + ["SetFocus"] = function(self) + self.editBox:SetFocus() + if not self.frame:IsShown() then + self.frame.focusOnShow = true; + end + end, + + ["HighlightText"] = function(self, from, to) + self.editBox:HighlightText(from, to) + end, + + ["GetCursorPosition"] = function(self) + return self.editBox:GetCursorPosition() + end, + + ["SetCursorPosition"] = function(self, ...) + return self.editBox:SetCursorPosition(...) + end, } --[[----------------------------------------------------------------------------- Constructor -------------------------------------------------------------------------------]] local backdrop = { - bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], - edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]], edgeSize = 16, - insets = { left = 4, right = 3, top = 4, bottom = 3 } + bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], + edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]], edgeSize = 16, + insets = { left = 4, right = 3, top = 4, bottom = 3 } } local function Constructor() - local frame = CreateFrame("Frame", nil, UIParent) - frame:Hide() - - frame:SetScript("OnShow", OnFrameShow); - local widgetNum = AceGUI:GetNextWidgetNum(Type) - - local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall") - label:SetPoint("TOPLEFT", frame, "TOPLEFT", 0, -4) - label:SetPoint("TOPRIGHT", frame, "TOPRIGHT", 0, -4) - label:SetJustifyH("LEFT") - label:SetText(ACCEPT) - label:SetHeight(10) - - local button = CreateFrame("Button", ("%s%dButton"):format(Type, widgetNum), frame, "UIPanelButtonTemplate") - button:SetPoint("BOTTOMLEFT", 0, 4) - button:SetHeight(22) - button:SetWidth(100) - button:SetText(ACCEPT) - button:SetScript("OnClick", OnClick) - button:Disable() - - local extraButtons = {}; - extraButtons[0] = button; - - local scrollBG = CreateFrame("Frame", nil, frame) - scrollBG:SetBackdrop(backdrop) - scrollBG:SetBackdropColor(0, 0, 0) - scrollBG:SetBackdropBorderColor(0.4, 0.4, 0.4) - - local scrollFrame = CreateFrame("ScrollFrame", ("%s%dScrollFrame"):format(Type, widgetNum), frame, "UIPanelScrollFrameTemplate") - scrollFrame:EnableMouseWheel(false); - - local scrollBar = _G[scrollFrame:GetName() .. "ScrollBar"] - scrollBar:ClearAllPoints() - scrollBar:SetPoint("TOP", label, "BOTTOM", 0, -19) - scrollBar:SetPoint("BOTTOM", button, "TOP", 0, 18) - scrollBar:SetPoint("RIGHT", frame, "RIGHT") - - scrollBG:SetPoint("TOPRIGHT", scrollBar, "TOPLEFT", 0, 19) - scrollBG:SetPoint("BOTTOMLEFT", button, "TOPLEFT") - - scrollFrame:SetPoint("TOPLEFT", scrollBG, "TOPLEFT", 5, -6) - scrollFrame:SetPoint("BOTTOMRIGHT", scrollBG, "BOTTOMRIGHT", -4, 4) - scrollFrame:SetScript("OnEnter", OnEnter) - scrollFrame:SetScript("OnLeave", OnLeave) - scrollFrame:SetScript("OnMouseUp", OnMouseUp) - scrollFrame:SetScript("OnReceiveDrag", OnReceiveDrag) - scrollFrame:SetScript("OnSizeChanged", OnSizeChanged) - scrollFrame:HookScript("OnVerticalScroll", OnVerticalScroll) - - local editBox = CreateFrame("EditBox", ("%s%dEdit"):format(Type, widgetNum), scrollFrame) - editBox:SetAllPoints() - editBox:SetFontObject(ChatFontNormal) - editBox:SetMultiLine(true) - editBox:EnableMouse(true) - editBox:SetAutoFocus(false) - editBox:SetCountInvisibleLetters(false) - editBox:SetScript("OnCursorChanged", OnCursorChanged) - editBox:SetScript("OnEditFocusLost", OnEditFocusLost) - editBox:SetScript("OnEnter", OnEnter) - editBox:SetScript("OnEscapePressed", editBox.ClearFocus) - editBox:SetScript("OnLeave", OnLeave) - editBox:SetScript("OnMouseDown", OnReceiveDrag) - editBox:SetScript("OnReceiveDrag", OnReceiveDrag) - editBox:SetScript("OnTextChanged", OnTextChanged) - editBox:SetScript("OnTextSet", OnTextSet) - editBox:SetScript("OnEditFocusGained", OnEditFocusGained) - - - scrollFrame:SetScrollChild(editBox) - - local widget = { - button = button, - extraButtons = extraButtons, - editBox = editBox, - frame = frame, - label = label, - labelHeight = 10, - numlines = 4, - scrollBar = scrollBar, - scrollBG = scrollBG, - scrollFrame = scrollFrame, - type = Type, - widgetNum = widgetNum, - } - for method, func in pairs(methods) do - widget[method] = func - end - button.obj, editBox.obj, scrollFrame.obj = widget, widget, widget - - return AceGUI:RegisterAsWidget(widget) + local frame = CreateFrame("Frame", nil, UIParent) + frame:Hide() + + frame:SetScript("OnShow", OnFrameShow); + local widgetNum = AceGUI:GetNextWidgetNum(Type) + + local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall") + label:SetPoint("TOPLEFT", frame, "TOPLEFT", 0, -4) + label:SetPoint("TOPRIGHT", frame, "TOPRIGHT", 0, -4) + label:SetJustifyH("LEFT") + label:SetText(ACCEPT) + label:SetHeight(10) + + local button = CreateFrame("Button", ("%s%dButton"):format(Type, widgetNum), frame, "UIPanelButtonTemplate") + button:SetPoint("BOTTOMLEFT", 0, 4) + button:SetHeight(22) + button:SetWidth(100) + button:SetText(ACCEPT) + button:SetScript("OnClick", OnClick) + button:Disable() + + local extraButtons = {}; + extraButtons[0] = button; + + local scrollBG = CreateFrame("Frame", nil, frame) + scrollBG:SetBackdrop(backdrop) + scrollBG:SetBackdropColor(0, 0, 0) + scrollBG:SetBackdropBorderColor(0.4, 0.4, 0.4) + + local scrollFrame = CreateFrame("ScrollFrame", ("%s%dScrollFrame"):format(Type, widgetNum), frame, "UIPanelScrollFrameTemplate") + scrollFrame:EnableMouseWheel(false); + + local scrollBar = _G[scrollFrame:GetName() .. "ScrollBar"] + scrollBar:ClearAllPoints() + scrollBar:SetPoint("TOP", label, "BOTTOM", 0, -19) + scrollBar:SetPoint("BOTTOM", button, "TOP", 0, 18) + scrollBar:SetPoint("RIGHT", frame, "RIGHT") + + scrollBG:SetPoint("TOPRIGHT", scrollBar, "TOPLEFT", 0, 19) + scrollBG:SetPoint("BOTTOMLEFT", button, "TOPLEFT") + + scrollFrame:SetPoint("TOPLEFT", scrollBG, "TOPLEFT", 5, -6) + scrollFrame:SetPoint("BOTTOMRIGHT", scrollBG, "BOTTOMRIGHT", -4, 4) + scrollFrame:SetScript("OnEnter", OnEnter) + scrollFrame:SetScript("OnLeave", OnLeave) + scrollFrame:SetScript("OnMouseUp", OnMouseUp) + scrollFrame:SetScript("OnReceiveDrag", OnReceiveDrag) + scrollFrame:SetScript("OnSizeChanged", OnSizeChanged) + scrollFrame:HookScript("OnVerticalScroll", OnVerticalScroll) + + local editBox = CreateFrame("EditBox", ("%s%dEdit"):format(Type, widgetNum), scrollFrame) + editBox:SetAllPoints() + editBox:SetFontObject(ChatFontNormal) + editBox:SetMultiLine(true) + editBox:EnableMouse(true) + editBox:SetAutoFocus(false) + editBox:SetCountInvisibleLetters(false) + editBox:SetScript("OnCursorChanged", OnCursorChanged) + editBox:SetScript("OnEditFocusLost", OnEditFocusLost) + editBox:SetScript("OnEnter", OnEnter) + editBox:SetScript("OnEscapePressed", editBox.ClearFocus) + editBox:SetScript("OnLeave", OnLeave) + editBox:SetScript("OnMouseDown", OnReceiveDrag) + editBox:SetScript("OnReceiveDrag", OnReceiveDrag) + editBox:SetScript("OnTextChanged", OnTextChanged) + editBox:SetScript("OnTextSet", OnTextSet) + editBox:SetScript("OnEditFocusGained", OnEditFocusGained) + + + scrollFrame:SetScrollChild(editBox) + + local widget = { + button = button, + extraButtons = extraButtons, + editBox = editBox, + frame = frame, + label = label, + labelHeight = 10, + numlines = 4, + scrollBar = scrollBar, + scrollBG = scrollBG, + scrollFrame = scrollFrame, + type = Type, + widgetNum = widgetNum, + } + for method, func in pairs(methods) do + widget[method] = func + end + button.obj, editBox.obj, scrollFrame.obj = widget, widget, widget + + return AceGUI:RegisterAsWidget(widget) end AceGUI:RegisterWidgetType(Type, Constructor, Version) diff --git a/WeakAurasOptions/ActionOptions.lua b/WeakAurasOptions/ActionOptions.lua index ace2898915..1339307be7 100644 --- a/WeakAurasOptions/ActionOptions.lua +++ b/WeakAurasOptions/ActionOptions.lua @@ -312,43 +312,43 @@ function WeakAuras.AddActionOption(id, data) hidden = function() return data.actions.finish.sound ~= " KitID" end, disabled = function() return not data.actions.finish.do_sound end }, - finish_stop_sound = { - type = "toggle", - name = L["Stop Sound"], - order = 29.1, - width = "double" - }, - finish_do_glow = { - type = "toggle", - name = L["Button Glow"], - order = 30.1 - }, - finish_glow_action = { - type = "select", - name = L["Glow Action"], - order = 30.2, - values = WeakAuras.glow_action_types, - disabled = function() return not data.actions.finish.do_glow end - }, - finish_glow_frame = { - type = "input", - name = L["Frame"], - order = 30.3, - hidden = function() return not data.actions.finish.do_glow end - }, - finish_choose_glow_frame = { - type = "execute", - name = L["Choose"], - order = 30.4, - hidden = function() return not data.actions.finish.do_glow end, - func = function() - if(data.controlledChildren and data.controlledChildren[1]) then - WeakAuras.PickDisplay(data.controlledChildren[1]); - WeakAuras.StartFrameChooser(WeakAuras.GetData(data.controlledChildren[1]), {"actions", "finish", "glow_frame"}); - else - WeakAuras.StartFrameChooser(data, {"actions", "finish", "glow_frame"}); + finish_stop_sound = { + type = "toggle", + name = L["Stop Sound"], + order = 29.1, + width = "double" + }, + finish_do_glow = { + type = "toggle", + name = L["Button Glow"], + order = 30.1 + }, + finish_glow_action = { + type = "select", + name = L["Glow Action"], + order = 30.2, + values = WeakAuras.glow_action_types, + disabled = function() return not data.actions.finish.do_glow end + }, + finish_glow_frame = { + type = "input", + name = L["Frame"], + order = 30.3, + hidden = function() return not data.actions.finish.do_glow end + }, + finish_choose_glow_frame = { + type = "execute", + name = L["Choose"], + order = 30.4, + hidden = function() return not data.actions.finish.do_glow end, + func = function() + if(data.controlledChildren and data.controlledChildren[1]) then + WeakAuras.PickDisplay(data.controlledChildren[1]); + WeakAuras.StartFrameChooser(WeakAuras.GetData(data.controlledChildren[1]), {"actions", "finish", "glow_frame"}); + else + WeakAuras.StartFrameChooser(data, {"actions", "finish", "glow_frame"}); + end end - end }, finish_do_custom = { type = "toggle", @@ -356,7 +356,7 @@ function WeakAuras.AddActionOption(id, data) order = 31, width = "double" }, - -- Text editor added below + -- Text editor added below }, } diff --git a/WeakAurasOptions/OptionsFrames/TextEditor.lua b/WeakAurasOptions/OptionsFrames/TextEditor.lua index df84997be2..e9d2364153 100644 --- a/WeakAurasOptions/OptionsFrames/TextEditor.lua +++ b/WeakAurasOptions/OptionsFrames/TextEditor.lua @@ -375,7 +375,7 @@ local function ConstructTextEditor(frame) if (self.reloadOptions) then if(self.data.controlledChildren) then for index, childId in pairs(self.data.controlledChildren) do - WeakAuras.ScheduleReloadOptions(WeakAuras.GetData(childId)); + WeakAuras.ScheduleReloadOptions(WeakAuras.GetData(childId)); end WeakAuras.ScheduleReloadOptions(self.data); else diff --git a/WeakAurasOptions/RegionOptions/Icon.lua b/WeakAurasOptions/RegionOptions/Icon.lua index 96ee3a46d6..39fc724431 100644 --- a/WeakAurasOptions/RegionOptions/Icon.lua +++ b/WeakAurasOptions/RegionOptions/Icon.lua @@ -220,7 +220,7 @@ local function createOptions(id, data) name = L["General Text Settings"], hidden = function() return not ((data.text1Enabled and WeakAuras.ContainsPlaceHolders(data.text1, "cpt")) - or (data.text2Enabled and WeakAuras.ContainsPlaceHolders(data.text2, "cpt"))) + or (data.text2Enabled and WeakAuras.ContainsPlaceHolders(data.text2, "cpt"))) end, }, customTextUpdate = { @@ -228,7 +228,7 @@ local function createOptions(id, data) width = "double", hidden = function() return not ((data.text1Enabled and WeakAuras.ContainsPlaceHolders(data.text1, "c")) - or (data.text2Enabled and WeakAuras.ContainsPlaceHolders(data.text2, "c"))) + or (data.text2Enabled and WeakAuras.ContainsPlaceHolders(data.text2, "c"))) end, name = L["Update Custom Text On..."], values = WeakAuras.text_check_types, @@ -243,7 +243,7 @@ local function createOptions(id, data) get = function() return data.progressPrecision or 1 end, hidden = function() return not ((data.text1Enabled and WeakAuras.ContainsPlaceHolders(data.text1, "pt")) - or (data.text2Enabled and WeakAuras.ContainsPlaceHolders(data.text2, "pt"))) + or (data.text2Enabled and WeakAuras.ContainsPlaceHolders(data.text2, "pt"))) end, disabled = function() return not (WeakAuras.ContainsPlaceHolders(data.text1, "p") or WeakAuras.ContainsPlaceHolders(data.text2, "p")); @@ -257,7 +257,7 @@ local function createOptions(id, data) get = function() return data.totalPrecision or 1 end, hidden = function() return not ((data.text1Enabled and WeakAuras.ContainsPlaceHolders(data.text1, "pt")) - or (data.text2Enabled and WeakAuras.ContainsPlaceHolders(data.text2, "pt"))) + or (data.text2Enabled and WeakAuras.ContainsPlaceHolders(data.text2, "pt"))) end, disabled = function() return not (WeakAuras.ContainsPlaceHolders(data.text1, "t") or WeakAuras.ContainsPlaceHolders(data.text2, "t")); @@ -310,7 +310,7 @@ local function createOptions(id, data) local function hideCustomTextEditor() return not ((data.text1Enabled and WeakAuras.ContainsPlaceHolders(data.text1, "c")) - or (data.text2Enabled and WeakAuras.ContainsPlaceHolders(data.text2, "c"))) + or (data.text2Enabled and WeakAuras.ContainsPlaceHolders(data.text2, "c"))) end WeakAuras.AddCodeOption(options, data, L["Custom Function"], "customText", 43.2, hideCustomTextEditor, {"customText"}, false); diff --git a/WeakAurasOptions/WeakAurasOptions.lua b/WeakAurasOptions/WeakAurasOptions.lua index d19d277b9c..389c4f0ac2 100644 --- a/WeakAurasOptions/WeakAurasOptions.lua +++ b/WeakAurasOptions/WeakAurasOptions.lua @@ -1987,7 +1987,7 @@ local function replaceNameDescFuncs(intable, data) name = childOption.name; end if (not name) then - -- Do nothing + -- Do nothing elseif(first) then combinedName = name; first = false; diff --git a/WeakAurasTemplates/TriggerTemplatesData.lua b/WeakAurasTemplates/TriggerTemplatesData.lua index 7c725a008e..90cb9005ab 100644 --- a/WeakAurasTemplates/TriggerTemplatesData.lua +++ b/WeakAurasTemplates/TriggerTemplatesData.lua @@ -619,7 +619,7 @@ templates.class.HUNTER = { [3] = { title = L["Cooldowns"], args = { - { spell = 781, type = "ability"}, -- Disengage + { spell = 781, type = "ability"}, -- Disengage { spell = 1543, type = "ability"}, -- Flare { spell = 2649, type = "ability"}, -- Growl { spell = 5116, type = "ability"}, -- Concussive Shot @@ -3546,9 +3546,9 @@ end for _, class in pairs(templates.class) do for _, spec in pairs(class) do - -- TODO 8.0 - -- tinsert(spec[5].args, { spell = 195710, type = "ability"}) -- Honorable Medallion - -- tinsert(spec[5].args, { spell = 208683, type = "ability", pvptalent = 1}) -- Gladiator's Medallion + -- TODO 8.0 + -- tinsert(spec[5].args, { spell = 195710, type = "ability"}) -- Honorable Medallion + -- tinsert(spec[5].args, { spell = 208683, type = "ability", pvptalent = 1}) -- Gladiator's Medallion end end