diff --git a/Libs/AceSerializer-3.0/AceSerializer-3.0.lua b/Libs/AceSerializer-3.0/AceSerializer-3.0.lua index 0df27803..cc23a67b 100644 --- a/Libs/AceSerializer-3.0/AceSerializer-3.0.lua +++ b/Libs/AceSerializer-3.0/AceSerializer-3.0.lua @@ -10,8 +10,8 @@ -- make into AceSerializer. -- @class file -- @name AceSerializer-3.0 --- @release $Id: AceSerializer-3.0.lua 1038 2011-10-03 01:39:58Z mikk $ -local MAJOR,MINOR = "AceSerializer-3.0", 4 +-- @release $Id: AceSerializer-3.0.lua 1135 2015-09-19 20:39:16Z nevcairiel $ +local MAJOR,MINOR = "AceSerializer-3.0", 5 local AceSerializer, oldminor = LibStub:NewLibrary(MAJOR, MINOR) if not AceSerializer then return end @@ -27,8 +27,8 @@ local tconcat = table.concat local inf = math.huge local serNaN -- can't do this in 4.3, see ace3 ticket 268 -local serInf = tostring(inf) -local serNegInf = tostring(-inf) +local serInf, serInfMac = "1.#INF", "inf" +local serNegInf, serNegInfMac = "-1.#INF", "-inf" -- Serialization functions @@ -62,11 +62,15 @@ local function SerializeValue(v, res, nres) elseif t=="number" then -- ^N = number (just tostring()ed) or ^F (float components) local str = tostring(v) - if tonumber(str)==v --[[not in 4.3 or str==serNaN]] or str==serInf or str==serNegInf then + if tonumber(str)==v --[[not in 4.3 or str==serNaN]] then -- translates just fine, transmit as-is res[nres+1] = "^N" res[nres+2] = str nres=nres+2 + elseif v == inf or v == -inf then + res[nres+1] = "^N" + res[nres+2] = v == inf and serInf or serNegInf + nres=nres+2 else local m,e = frexp(v) res[nres+1] = "^F" @@ -147,9 +151,9 @@ end local function DeserializeNumberHelper(number) --[[ not in 4.3 if number == serNaN then return 0/0 - else]]if number == serNegInf then + else]]if number == serNegInf or number == serNegInfMac then return -inf - elseif number == serInf then + elseif number == serInf or number == serInfMac then return inf else return tonumber(number) diff --git a/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua b/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua index bc311d97..eaa0d5d6 100644 --- a/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua +++ b/Libs/CallbackHandler-1.0/CallbackHandler-1.0.lua @@ -1,4 +1,4 @@ ---[[ $Id: CallbackHandler-1.0.lua 965 2010-08-09 00:47:52Z mikk $ ]] +--[[ $Id: CallbackHandler-1.0.lua 1131 2015-06-04 07:29:24Z nevcairiel $ ]] local MAJOR, MINOR = "CallbackHandler-1.0", 6 local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR) @@ -65,9 +65,7 @@ end}) -- UnregisterName - name of the callback unregistration API, default "UnregisterCallback" -- UnregisterAllName - name of the API to unregister all callbacks, default "UnregisterAllCallbacks". false == don't publish this API. -function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAllName, OnUsed, OnUnused) - -- TODO: Remove this after beta has gone out - assert(not OnUsed and not OnUnused, "ACE-80: OnUsed/OnUnused are deprecated. Callbacks are now done to registry.OnUsed and registry.OnUnused") +function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAllName) RegisterName = RegisterName or "RegisterCallback" UnregisterName = UnregisterName or "UnregisterCallback" diff --git a/Libs/DF/button.lua b/Libs/DF/button.lua index 23ccf586..83d01ed0 100644 --- a/Libs/DF/button.lua +++ b/Libs/DF/button.lua @@ -932,7 +932,7 @@ function DF:NewButton (parent, container, name, member, w, h, func, param1, para DF.ButtonCounter = DF.ButtonCounter + 1 elseif (not parent) then - return nil + return error ("Details! FrameWork: parent not found.", 2) end if (not container) then container = parent diff --git a/Libs/DF/cooltip.lua b/Libs/DF/cooltip.lua index ec57ba24..27e48d63 100644 --- a/Libs/DF/cooltip.lua +++ b/Libs/DF/cooltip.lua @@ -893,7 +893,7 @@ function DF:CreateCoolTip() end function CoolTip:StatusBar (menuButton, StatusBar) - + if (StatusBar) then menuButton.statusbar:SetValue (StatusBar [1]) @@ -926,19 +926,38 @@ function DF:CreateCoolTip() menuButton.spark2:Hide() end + if (StatusBar [8]) then + local texture = SharedMedia:Fetch ("statusbar", StatusBar [8], true) + if (texture) then + menuButton.statusbar.texture:SetTexture (texture) + else + menuButton.statusbar.texture:SetTexture (StatusBar [8]) + end + elseif (CoolTip.OptionsTable.StatusBarTexture) then + local texture = SharedMedia:Fetch ("statusbar", CoolTip.OptionsTable.StatusBarTexture, true) + if (texture) then + menuButton.statusbar.texture:SetTexture (texture) + else + menuButton.statusbar.texture:SetTexture (CoolTip.OptionsTable.StatusBarTexture) + end + else + menuButton.statusbar.texture:SetTexture ("Interface\\PaperDollInfoFrame\\UI-Character-Skills-Bar") + end + + --[[ if (CoolTip.OptionsTable.StatusBarTexture) then menuButton.statusbar.texture:SetTexture (CoolTip.OptionsTable.StatusBarTexture) else menuButton.statusbar.texture:SetTexture ("Interface\\PaperDollInfoFrame\\UI-Character-Skills-Bar") end - + --]] else menuButton.statusbar:SetValue (0) menuButton.statusbar2:SetValue (0) menuButton.spark:Hide() menuButton.spark2:Hide() end - + if (CoolTip.OptionsTable.LeftBorderSize) then menuButton.statusbar:SetPoint ("left", menuButton, "left", 10 + CoolTip.OptionsTable.LeftBorderSize, 0) else @@ -1382,7 +1401,7 @@ function DF:CreateCoolTip() elseif (CoolTip.OptionsTable.IgnoreButtonAutoHeight) then frame1:SetHeight ( (temp+spacing) * -1) else - frame1:SetHeight ( _math_max ( (frame1.hHeight * CoolTip.Indexes) + 12, 22 )) + frame1:SetHeight ( _math_max ( (frame1.hHeight * CoolTip.Indexes) + 8 + ((CoolTip.OptionsTable.ButtonsYMod or 0)*-1), 22 )) end end @@ -1938,8 +1957,8 @@ function DF:CreateCoolTip() ---------------------------------------------------------------------- --> Reset cooltip - local default_backdrop = {bgFile=[[Interface\DialogFrame\UI-DialogBox-Background-Dark]], edgeFile=[[Interface\Tooltips\UI-Tooltip-Border]], tile=true, - edgeSize=16, tileSize=16, insets = {left=3, right=3, top=4, bottom=4}} + local default_backdrop = {bgFile = [[Interface\DialogFrame\UI-DialogBox-Background-Dark]], edgeFile = [[Interface\Buttons\WHITE8X8]], tile = true, + edgeSize = 1, tileSize = 16, insets = {left = 0, right = 0, top = 0, bottom = 0}} local default_backdrop_color = {0.09019, 0.09019, 0.18823, 1} local default_backdropborder_color = {1, 1, 1, 1} @@ -2232,7 +2251,7 @@ function DF:CreateCoolTip() --> parameters: value [, color red, color green, color blue, color alpha [, glow]] --> can also use a table or html color name in color red and send glow in color green - function CoolTip:AddStatusBar (statusbarValue, frame, ColorR, ColorG, ColorB, ColorA, statusbarGlow, backgroundBar) + function CoolTip:AddStatusBar (statusbarValue, frame, ColorR, ColorG, ColorB, ColorA, statusbarGlow, backgroundBar, barTexture) --> need a previous line if (CoolTip.Indexes == 0) then @@ -2305,6 +2324,7 @@ function DF:CreateCoolTip() statusbarTable [5] = ColorA statusbarTable [6] = statusbarGlow statusbarTable [7] = backgroundBar + statusbarTable [8] = barTexture end diff --git a/Libs/DF/dropdown.lua b/Libs/DF/dropdown.lua index 175c94c4..52fd7618 100644 --- a/Libs/DF/dropdown.lua +++ b/Libs/DF/dropdown.lua @@ -905,14 +905,15 @@ function DF:NewDropDown (parent, container, name, member, w, h, func, default, t DF.DropDownCounter = DF.DropDownCounter + 1 elseif (not parent) then - return nil + return error ("Details! FrameWork: parent not found.", 2) end if (not container) then container = parent end if (name:find ("$parent")) then - name = name:gsub ("$parent", parent:GetName()) + local parentName = DF.GetParentName (parent) + name = name:gsub ("$parent", parentName) end local DropDownObject = {type = "dropdown", dframework = true} diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 4e07c764..b03f076e 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,5 +1,5 @@ -local dversion = 14 +local dversion = 15 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary (major, minor) @@ -11,19 +11,24 @@ end DetailsFrameworkCanLoad = true local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0") +local _ local _type = type local _unpack = unpack -local _ local upper = string.upper -DF.LabelNameCounter = 1 -DF.PictureNameCounter = 1 -DF.BarNameCounter = 1 -DF.DropDownCounter = 1 -DF.PanelCounter = 1 -DF.ButtonCounter = 1 -DF.SliderCounter = 1 -DF.SplitBarCounter = 1 +--> will always give a very random name for our widgets +local init_counter = math.random (1, 1000000) + +DF.LabelNameCounter = DF.LabelNameCounter or init_counter +DF.PictureNameCounter = DF.PictureNameCounter or init_counter +DF.BarNameCounter = DF.BarNameCounter or init_counter +DF.DropDownCounter = DF.DropDownCounter or init_counter +DF.PanelCounter = DF.PanelCounter or init_counter +DF.SimplePanelCounter = DF.SimplePanelCounter or init_counter +DF.ButtonCounter = DF.ButtonCounter or init_counter +DF.SliderCounter = DF.SliderCounter or init_counter +DF.SwitchCounter = DF.SwitchCounter or init_counter +DF.SplitBarCounter = DF.SplitBarCounter or init_counter DF.FrameWorkVersion = tostring (dversion) function DF:PrintVersion() @@ -32,12 +37,14 @@ end LibStub:GetLibrary("AceTimer-3.0"):Embed (DF) +--> get the working folder do local path = string.match (debugstack (1, 1, 0), "AddOns\\(.+)fw.lua") if (path) then DF.folder = "Interface\\AddOns\\" .. path else - DF.folder = "" + --> if not found, try to use the last valid one + DF.folder = DF.folder or "" end end @@ -94,6 +101,7 @@ local embed_functions = { "ShowTextPromptPanel", "www_icons", "GetTemplate", + "InstallTemplate", "GetFrameworkFolder", "ShowPanicWarning", } @@ -868,17 +876,40 @@ DF.slider_templates ["OPTIONS_SLIDER_TEMPLATE"] = { thumbcolor = {0, 0, 0, 0.5}, } -function DF:GetTemplate (type, template_name) +function DF:InstallTemplate (widget_type, template_name, template) + widget_type = string.lower (widget_type) + local template_table - if (type == "font") then + if (widget_type == "font") then template_table = DF.font_templates - elseif (type == "dropdown") then + elseif (widget_type == "dropdown") then template_table = DF.dropdown_templates - elseif (type == "button") then + elseif (widget_type == "button") then template_table = DF.button_templates - elseif (type == "switch") then + elseif (widget_type == "switch") then template_table = DF.switch_templates - elseif (type == "slider") then + elseif (widget_type == "slider") then + template_table = DF.slider_templates + end + + template_table [template_name] = template + + return template +end + +function DF:GetTemplate (widget_type, template_name) + widget_type = string.lower (widget_type) + + local template_table + if (widget_type == "font") then + template_table = DF.font_templates + elseif (widget_type == "dropdown") then + template_table = DF.dropdown_templates + elseif (widget_type == "button") then + template_table = DF.button_templates + elseif (widget_type == "switch") then + template_table = DF.switch_templates + elseif (widget_type == "slider") then template_table = DF.slider_templates end return template_table [template_name] diff --git a/Libs/DF/label.lua b/Libs/DF/label.lua index c4ccbc6c..8e67f969 100644 --- a/Libs/DF/label.lua +++ b/Libs/DF/label.lua @@ -244,7 +244,7 @@ end function DF:NewLabel (parent, container, name, member, text, font, size, color, layer) if (not parent) then - return nil + return error ("Details! FrameWork: parent not found.", 2) end if (not container) then container = parent @@ -256,9 +256,8 @@ function DF:NewLabel (parent, container, name, member, text, font, size, color, end if (name:find ("$parent")) then - local pname = parent:GetName() - assert (pname, "label used $parent but parent has no name.") - name = name:gsub ("$parent", parent:GetName()) + local parentName = DF.GetParentName (parent) + name = name:gsub ("$parent", parentName) end local LabelObject = {type = "label", dframework = true} diff --git a/Libs/DF/normal_bar.lua b/Libs/DF/normal_bar.lua index 949bedd9..cd556785 100644 --- a/Libs/DF/normal_bar.lua +++ b/Libs/DF/normal_bar.lua @@ -646,13 +646,14 @@ function DF:NewBar (parent, container, name, member, w, h, value, texture_name) DF.BarNameCounter = DF.BarNameCounter + 1 elseif (not parent) then - return nil + return error ("Details! FrameWork: parent not found.", 2) elseif (not container) then container = parent end if (name:find ("$parent")) then - name = name:gsub ("$parent", parent:GetName()) + local parentName = DF.GetParentName (parent) + name = name:gsub ("$parent", parentName) end local BarObject = {type = "bar", dframework = true} diff --git a/Libs/DF/panel.lua b/Libs/DF/panel.lua index edac1d11..3b2968f7 100644 --- a/Libs/DF/panel.lua +++ b/Libs/DF/panel.lua @@ -18,8 +18,6 @@ local cleanfunction = function() end local PanelMetaFunctions = {} local APIFrameFunctions -local simple_panel_counter = 1 - ------------------------------------------------------------------------------------------------------------ --> metatables @@ -1456,7 +1454,6 @@ end ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ -local simple_panel_counter = 1 local simple_panel_mouse_down = function (self, button) if (button == "RightButton") then if (self.IsMoving) then @@ -1501,8 +1498,8 @@ local no_options = {} function DF:CreateSimplePanel (parent, w, h, title, name, panel_options) if (not name) then - name = "DetailsFrameworkSimplePanel" .. simple_panel_counter - simple_panel_counter = simple_panel_counter + 1 + name = "DetailsFrameworkSimplePanel" .. DF.SimplePanelCounter + DF.SimplePanelCounter = DF.SimplePanelCounter + 1 end if (not parent) then parent = UIParent @@ -1560,8 +1557,6 @@ function DF:CreateSimplePanel (parent, w, h, title, name, panel_options) f.SetTitle = simple_panel_settitle - simple_panel_counter = simple_panel_counter + 1 - return f end @@ -1836,17 +1831,21 @@ function DF:ShowTextPromptPanel (message, callback) prompt:SetPoint ("top", f, "top", 0, -15) prompt:SetJustifyH ("center") f.prompt = prompt - - local button_true = DF:CreateButton (f, nil, 60, 20, "Okey") + + local button_text_template = DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE") + local options_dropdown_template = DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE") + + local button_true = DF:CreateButton (f, nil, 60, 20, "Okey", nil, nil, nil, nil, nil, nil, options_dropdown_template, button_text_template) button_true:SetPoint ("bottomleft", f, "bottomleft", 10, 5) f.button_true = button_true - local button_false = DF:CreateButton (f, function() f.textbox:ClearFocus(); f:Hide() end, 60, 20, "Cancel") + local button_false = DF:CreateButton (f, function() f.textbox:ClearFocus(); f:Hide() end, 60, 20, "Cancel", nil, nil, nil, nil, nil, nil, options_dropdown_template, button_text_template) button_false:SetPoint ("bottomright", f, "bottomright", -10, 5) f.button_false = button_false - local textbox = DF:CreateTextEntry (f, function()end, 380, 20, "textbox", nil, nil, nil, nil) + local textbox = DF:CreateTextEntry (f, function()end, 380, 20, "textbox", nil, nil, options_dropdown_template) textbox:SetPoint ("topleft", f, "topleft", 10, -45) + f.EntryBox = textbox button_true:SetClickFunction (function() local my_func = button_true.true_function @@ -1866,9 +1865,10 @@ function DF:ShowTextPromptPanel (message, callback) DF.text_prompt_panel:Show() + DetailsFrameworkPrompt.EntryBox:SetText ("") DF.text_prompt_panel.prompt:SetText (message) DF.text_prompt_panel.button_true.true_function = callback - DF.text_prompt_panel.textbox:SetText ("") + DF.text_prompt_panel.textbox:SetFocus (true) end diff --git a/Libs/DF/picture.lua b/Libs/DF/picture.lua index 1dbbab96..069a5884 100644 --- a/Libs/DF/picture.lua +++ b/Libs/DF/picture.lua @@ -213,7 +213,7 @@ end function DF:NewImage (parent, texture, w, h, layer, coords, member, name) if (not parent) then - return nil + return error ("Details! FrameWork: parent not found.", 2) end if (not name) then @@ -222,7 +222,8 @@ function DF:NewImage (parent, texture, w, h, layer, coords, member, name) end if (name:find ("$parent")) then - name = name:gsub ("$parent", parent:GetName()) + local parentName = DF.GetParentName (parent) + name = name:gsub ("$parent", parentName) end local ImageObject = {type = "image", dframework = true} diff --git a/Libs/DF/slider.lua b/Libs/DF/slider.lua index 65c859c6..18cb129d 100644 --- a/Libs/DF/slider.lua +++ b/Libs/DF/slider.lua @@ -18,7 +18,6 @@ local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0") local cleanfunction = function() end local APISliderFunctions = false local SliderMetaFunctions = {} -local NameLessSlider = 1 ------------------------------------------------------------------------------------------------------------ --> metatables @@ -877,10 +876,10 @@ function DF:NewSwitch (parent, container, name, member, w, h, ltext, rtext, defa --> early checks if (not name) then - name = "DetailsFrameWorkSlider" .. NameLessSlider - NameLessSlider = NameLessSlider + 1 + name = "DetailsFrameWorkSlider" .. DF.SwitchCounter + DF.SwitchCounter = DF.SwitchCounter + 1 elseif (not parent) then - return nil + return error ("Details! FrameWork: parent not found.", 2) end if (not container) then container = parent @@ -1035,14 +1034,15 @@ function DF:NewSlider (parent, container, name, member, w, h, min, max, step, de DF.SliderCounter = DF.SliderCounter + 1 end if (not parent) then - return nil + return error ("Details! FrameWork: parent not found.", 2) end if (not container) then container = parent end if (name:find ("$parent")) then - name = name:gsub ("$parent", parent:GetName()) + local parentName = DF.GetParentName (parent) + name = name:gsub ("$parent", parentName) end local SliderObject = {type = "slider", dframework = true} diff --git a/Libs/DF/split_bar.lua b/Libs/DF/split_bar.lua index f83af669..23ed3c43 100644 --- a/Libs/DF/split_bar.lua +++ b/Libs/DF/split_bar.lua @@ -539,14 +539,15 @@ function DF:NewSplitBar (parent, container, name, member, w, h) DF.SplitBarCounter = DF.SplitBarCounter + 1 end if (not parent) then - return nil + return error ("Details! FrameWork: parent not found.", 2) end if (not container) then container = parent end if (name:find ("$parent")) then - name = name:gsub ("$parent", parent:GetName()) + local parentName = DF.GetParentName (parent) + name = name:gsub ("$parent", parentName) end local SplitBarObject = {type = "barsplit", dframework = true} diff --git a/Libs/DF/textentry.lua b/Libs/DF/textentry.lua index 82c637ed..4e693437 100644 --- a/Libs/DF/textentry.lua +++ b/Libs/DF/textentry.lua @@ -183,6 +183,13 @@ DF.TextEntryCounter = 1 end + function TextEntryMetaFunctions:SetText (text) + self.editbox:SetText (text) + end + function TextEntryMetaFunctions:GetText() + return self.editbox:GetText() + end + --> frame levels function TextEntryMetaFunctions:GetFrameLevel() return self.editbox:GetFrameLevel() @@ -470,23 +477,23 @@ DF.TextEntryCounter = 1 function TextEntryMetaFunctions:SetTemplate (template) if (template.width) then - self:SetWidth (template.width) + self.editbox:SetWidth (template.width) end if (template.height) then - self:SetHeight (template.height) + self.editbox:SetHeight (template.height) end if (template.backdrop) then - self:SetBackdrop (template.backdrop) + self.editbox:SetBackdrop (template.backdrop) end if (template.backdropcolor) then local r, g, b, a = DF:ParseColors (template.backdropcolor) - self:SetBackdropColor (r, g, b, a) + self.editbox:SetBackdropColor (r, g, b, a) self.onleave_backdrop = {r, g, b, a} end if (template.backdropbordercolor) then local r, g, b, a = DF:ParseColors (template.backdropbordercolor) - self:SetBackdropBorderColor (r, g, b, a) + self.editbox:SetBackdropBorderColor (r, g, b, a) self.editbox.current_bordercolor[1] = r self.editbox.current_bordercolor[2] = g self.editbox.current_bordercolor[3] = b @@ -509,7 +516,7 @@ function DF:NewTextEntry (parent, container, name, member, w, h, func, param1, p DF.TextEntryCounter = DF.TextEntryCounter + 1 elseif (not parent) then - return nil + return error ("Details! FrameWork: parent not found.", 2) end if (not container) then @@ -517,7 +524,8 @@ function DF:NewTextEntry (parent, container, name, member, w, h, func, param1, p end if (name:find ("$parent")) then - name = name:gsub ("$parent", parent:GetName()) + local parentName = DF.GetParentName (parent) + name = name:gsub ("$parent", parentName) end local TextEntryObject = {type = "textentry", dframework = true} @@ -667,7 +675,8 @@ end function DF:NewSpecialLuaEditorEntry (parent, w, h, member, name, nointent) if (name:find ("$parent")) then - name = name:gsub ("$parent", parent:GetName()) + local parentName = DF.GetParentName (parent) + name = name:gsub ("$parent", parentName) end local borderframe = CreateFrame ("Frame", name, parent) diff --git a/Libs/LibDBIcon-1.0/LibDBIcon-1.0.lua b/Libs/LibDBIcon-1.0/LibDBIcon-1.0.lua index dfc65a8f..dcd333df 100644 --- a/Libs/LibDBIcon-1.0/LibDBIcon-1.0.lua +++ b/Libs/LibDBIcon-1.0/LibDBIcon-1.0.lua @@ -1,39 +1,12 @@ ---[[ -Name: DBIcon-1.0 -Revision: $Rev: 34 $ -Author(s): Rabbit (rabbit.magtheridon@gmail.com) -Description: Allows addons to register to recieve a lightweight minimap icon as an alternative to more heavy LDB displays. -Dependencies: LibStub -License: GPL v2 or later. -]] - ---[[ -Copyright (C) 2008-2011 Rabbit - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -]] ----------------------------------------------------------------------- --- DBIcon-1.0 +-- LibDBIcon-1.0 -- --- Disclaimer: Most of this code was ripped from Barrel but fixed, streamlined --- and cleaned up a lot so that it no longer sucks. +-- Allows addons to easily create a lightweight minimap icon as an alternative to heavier LDB displays. -- local DBICON10 = "LibDBIcon-1.0" -local DBICON10_MINOR = tonumber(("$Rev: 34 $"):match("(%d+)")) +local DBICON10_MINOR = 34 -- Bump on changes if not LibStub then error(DBICON10 .. " requires LibStub.") end local ldb = LibStub("LibDataBroker-1.1", true) if not ldb then error(DBICON10 .. " requires LibDataBroker-1.1.") end @@ -46,7 +19,7 @@ lib.callbackRegistered = lib.callbackRegistered or nil lib.callbacks = lib.callbacks or LibStub("CallbackHandler-1.0"):New(lib) lib.notCreated = lib.notCreated or {} -function lib:IconCallback(event, name, key, value, dataobj) +function lib:IconCallback(event, name, key, value) if lib.objects[name] then if key == "icon" then lib.objects[name].icon:SetTexture(value) @@ -73,7 +46,6 @@ if not lib.callbackRegistered then lib.callbackRegistered = true end --- Tooltip code ripped from StatBlockCore by Funkydude local function getAnchors(frame) local x, y = frame:GetCenter() if not x or not y then return "CENTER" end @@ -103,7 +75,7 @@ end -------------------------------------------------------------------------------- -local onClick, onMouseUp, onMouseDown, onDragStart, onDragStop, onDragEnd, updatePosition +local onClick, onMouseUp, onMouseDown, onDragStart, onDragStop, updatePosition do local minimapShapes = { diff --git a/Libs/LibDataBroker-1.1/LibDataBroker-1.1.lua b/Libs/LibDataBroker-1.1/LibDataBroker-1.1.lua index 04b5037d..4182f2e1 100644 --- a/Libs/LibDataBroker-1.1/LibDataBroker-1.1.lua +++ b/Libs/LibDataBroker-1.1/LibDataBroker-1.1.lua @@ -2,7 +2,7 @@ assert(LibStub, "LibDataBroker-1.1 requires LibStub") assert(LibStub:GetLibrary("CallbackHandler-1.0", true), "LibDataBroker-1.1 requires CallbackHandler-1.0") -local lib, oldminor = LibStub:NewLibrary("LibDataBroker-1.1", 3) +local lib, oldminor = LibStub:NewLibrary("LibDataBroker-1.1", 4) if not lib then return end oldminor = oldminor or 0 @@ -64,3 +64,27 @@ if oldminor < 1 then return self.namestorage[dataobject] end end + +if oldminor < 4 then + local next = pairs(attributestorage) + function lib:pairs(dataobject_or_name) + local t = type(dataobject_or_name) + assert(t == "string" or t == "table", "Usage: ldb:pairs('dataobjectname') or ldb:pairs(dataobject)") + + local dataobj = self.proxystorage[dataobject_or_name] or dataobject_or_name + assert(attributestorage[dataobj], "Data object not found") + + return next, attributestorage[dataobj], nil + end + + local ipairs_iter = ipairs(attributestorage) + function lib:ipairs(dataobject_or_name) + local t = type(dataobject_or_name) + assert(t == "string" or t == "table", "Usage: ldb:ipairs('dataobjectname') or ldb:ipairs(dataobject)") + + local dataobj = self.proxystorage[dataobject_or_name] or dataobject_or_name + assert(attributestorage[dataobj], "Data object not found") + + return ipairs_iter, attributestorage[dataobj], 0 + end +end diff --git a/Libs/LibSharedMedia-3.0/lib.xml b/Libs/LibSharedMedia-3.0/lib.xml index 5b4a5c87..fd1c0cd5 100644 --- a/Libs/LibSharedMedia-3.0/lib.xml +++ b/Libs/LibSharedMedia-3.0/lib.xml @@ -1,4 +1,5 @@ -