Skip to content

Commit

Permalink
Auto Hide Options Overhaul
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Jun 27, 2020
1 parent 2d40243 commit e6dec35
Show file tree
Hide file tree
Showing 12 changed files with 219 additions and 32 deletions.
21 changes: 19 additions & 2 deletions Libs/DF/auras.lua
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,29 @@ do
WidgetType = "aura_tracker",
SetHook = DF.SetHook,
RunHooksForWidget = DF.RunHooksForWidget,

dversion = DF.dversion,
}

_G [DF.GlobalWidgetControlNames ["aura_tracker"]] = _G [DF.GlobalWidgetControlNames ["aura_tracker"]] or metaPrototype
--check if there's a metaPrototype already existing
if (_G[DF.GlobalWidgetControlNames["aura_tracker"]]) then
--get the already existing metaPrototype
local oldMetaPrototype = _G[DF.GlobalWidgetControlNames ["aura_tracker"]]
--check if is older
if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then
--the version is older them the currently loading one
--copy the new values into the old metatable
for funcName, _ in pairs(metaPrototype) do
oldMetaPrototype[funcName] = metaPrototype[funcName]
end
end
else
--first time loading the framework
_G[DF.GlobalWidgetControlNames ["aura_tracker"]] = metaPrototype
end
end

local AuraTrackerMetaFunctions = _G [DF.GlobalWidgetControlNames ["aura_tracker"]]
local AuraTrackerMetaFunctions = _G[DF.GlobalWidgetControlNames ["aura_tracker"]]

--create panels
local on_profile_changed = function (self, newdb)
Expand Down
21 changes: 19 additions & 2 deletions Libs/DF/button.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,29 @@ do
HasHook = DF.HasHook,
ClearHooks = DF.ClearHooks,
RunHooksForWidget = DF.RunHooksForWidget,

dversion = DF.dversion
}

_G [DF.GlobalWidgetControlNames ["button"]] = _G [DF.GlobalWidgetControlNames ["button"]] or metaPrototype
--check if there's a metaPrototype already existing
if (_G[DF.GlobalWidgetControlNames["button"]]) then
--get the already existing metaPrototype
local oldMetaPrototype = _G[DF.GlobalWidgetControlNames ["button"]]
--check if is older
if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then
--the version is older them the currently loading one
--copy the new values into the old metatable
for funcName, _ in pairs(metaPrototype) do
oldMetaPrototype[funcName] = metaPrototype[funcName]
end
end
else
--first time loading the framework
_G[DF.GlobalWidgetControlNames ["button"]] = metaPrototype
end
end

local ButtonMetaFunctions = _G [DF.GlobalWidgetControlNames ["button"]]
local ButtonMetaFunctions = _G[DF.GlobalWidgetControlNames ["button"]]

------------------------------------------------------------------------------------------------------------
--> metatables
Expand Down
21 changes: 19 additions & 2 deletions Libs/DF/dropdown.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,29 @@ do
HasHook = DF.HasHook,
ClearHooks = DF.ClearHooks,
RunHooksForWidget = DF.RunHooksForWidget,

dversion = DF.dversion,
}

_G [DF.GlobalWidgetControlNames ["dropdown"]] = _G [DF.GlobalWidgetControlNames ["dropdown"]] or metaPrototype
--check if there's a metaPrototype already existing
if (_G[DF.GlobalWidgetControlNames["dropdown"]]) then
--get the already existing metaPrototype
local oldMetaPrototype = _G[DF.GlobalWidgetControlNames ["dropdown"]]
--check if is older
if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then
--the version is older them the currently loading one
--copy the new values into the old metatable
for funcName, _ in pairs(metaPrototype) do
oldMetaPrototype[funcName] = metaPrototype[funcName]
end
end
else
--first time loading the framework
_G[DF.GlobalWidgetControlNames ["dropdown"]] = metaPrototype
end
end

local DropDownMetaFunctions = _G [DF.GlobalWidgetControlNames ["dropdown"]]
local DropDownMetaFunctions = _G[DF.GlobalWidgetControlNames ["dropdown"]]

------------------------------------------------------------------------------------------------------------
--> metatables
Expand Down
11 changes: 6 additions & 5 deletions Libs/DF/fw.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

local dversion = 187
local dversion = 190

local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary (major, minor)
Expand Down Expand Up @@ -27,6 +27,8 @@ local UnitIsTapDenied = UnitIsTapDenied
SMALL_NUMBER = 0.000001
ALPHA_BLEND_AMOUNT = 0.8400251

DF.dversion = dversion

DF.AuthorInfo = {
Name = "Terciob",
Discord = "https://discord.gg/AGSzAZX",
Expand Down Expand Up @@ -3901,16 +3903,15 @@ end
do
local get = function(self)
local object = tremove(self.notUse, #self.notUse)
if (object) then
if (object) then
tinsert(self.inUse, object)
return object, false

else
--need to create the new object
local newObject = self.newObjectFunc(self, unpack(self.payload))
local newObject = self.newObjectFunc(self, unpack(self.payload))
if (newObject) then
tinsert(self.inUse, newObject)
return object, true
return newObject, true
end
end
end
Expand Down
21 changes: 19 additions & 2 deletions Libs/DF/label.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,29 @@ do
WidgetType = "label",
SetHook = DF.SetHook,
RunHooksForWidget = DF.RunHooksForWidget,

dversion = DF.dversion,
}

_G [DF.GlobalWidgetControlNames ["label"]] = _G [DF.GlobalWidgetControlNames ["label"]] or metaPrototype
--check if there's a metaPrototype already existing
if (_G[DF.GlobalWidgetControlNames["label"]]) then
--get the already existing metaPrototype
local oldMetaPrototype = _G[DF.GlobalWidgetControlNames ["label"]]
--check if is older
if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then
--the version is older them the currently loading one
--copy the new values into the old metatable
for funcName, _ in pairs(metaPrototype) do
oldMetaPrototype[funcName] = metaPrototype[funcName]
end
end
else
--first time loading the framework
_G[DF.GlobalWidgetControlNames ["label"]] = metaPrototype
end
end

local LabelMetaFunctions = _G [DF.GlobalWidgetControlNames ["label"]]
local LabelMetaFunctions = _G[DF.GlobalWidgetControlNames ["label"]]

------------------------------------------------------------------------------------------------------------
--> metatables
Expand Down
21 changes: 19 additions & 2 deletions Libs/DF/normal_bar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,29 @@ do
WidgetType = "normal_bar",
SetHook = DF.SetHook,
RunHooksForWidget = DF.RunHooksForWidget,

dversion = DF.dversion,
}

_G [DF.GlobalWidgetControlNames ["normal_bar"]] = _G [DF.GlobalWidgetControlNames ["normal_bar"]] or metaPrototype
--check if there's a metaPrototype already existing
if (_G[DF.GlobalWidgetControlNames["normal_bar"]]) then
--get the already existing metaPrototype
local oldMetaPrototype = _G[DF.GlobalWidgetControlNames ["normal_bar"]]
--check if is older
if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then
--the version is older them the currently loading one
--copy the new values into the old metatable
for funcName, _ in pairs(metaPrototype) do
oldMetaPrototype[funcName] = metaPrototype[funcName]
end
end
else
--first time loading the framework
_G[DF.GlobalWidgetControlNames ["normal_bar"]] = metaPrototype
end
end

local BarMetaFunctions = _G [DF.GlobalWidgetControlNames ["normal_bar"]]
local BarMetaFunctions = _G[DF.GlobalWidgetControlNames ["normal_bar"]]

------------------------------------------------------------------------------------------------------------
--> metatables
Expand Down
42 changes: 38 additions & 4 deletions Libs/DF/panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,29 @@ do
WidgetType = "panel",
SetHook = DF.SetHook,
RunHooksForWidget = DF.RunHooksForWidget,

dversion = DF.dversion,
}

_G [DF.GlobalWidgetControlNames ["panel"]] = _G [DF.GlobalWidgetControlNames ["panel"]] or metaPrototype
--check if there's a metaPrototype already existing
if (_G[DF.GlobalWidgetControlNames["panel"]]) then
--get the already existing metaPrototype
local oldMetaPrototype = _G[DF.GlobalWidgetControlNames ["panel"]]
--check if is older
if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then
--the version is older them the currently loading one
--copy the new values into the old metatable
for funcName, _ in pairs(metaPrototype) do
oldMetaPrototype[funcName] = metaPrototype[funcName]
end
end
else
--first time loading the framework
_G[DF.GlobalWidgetControlNames ["panel"]] = metaPrototype
end
end

local PanelMetaFunctions = _G [DF.GlobalWidgetControlNames ["panel"]]
local PanelMetaFunctions = _G[DF.GlobalWidgetControlNames ["panel"]]

--> mixin for options functions
DF.OptionsFunctions = {
Expand Down Expand Up @@ -7087,10 +7104,27 @@ DF.StatusBarFunctions = {
WidgetType = "healthBar",
SetHook = DF.SetHook,
RunHooksForWidget = DF.RunHooksForWidget,

dversion = DF.dversion,
}
_G [DF.GlobalWidgetControlNames ["healthBar"]] = _G [DF.GlobalWidgetControlNames ["healthBar"]] or healthBarMetaPrototype
--check if there's a metaPrototype already existing
if (_G[DF.GlobalWidgetControlNames["healthBar"]]) then
--get the already existing metaPrototype
local oldMetaPrototype = _G[DF.GlobalWidgetControlNames ["healthBar"]]
--check if is older
if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then
--the version is older them the currently loading one
--copy the new values into the old metatable
for funcName, _ in pairs(healthBarMetaPrototype) do
oldMetaPrototype[funcName] = healthBarMetaPrototype[funcName]
end
end
else
--first time loading the framework
_G[DF.GlobalWidgetControlNames ["healthBar"]] = healthBarMetaPrototype
end

local healthBarMetaFunctions = _G [DF.GlobalWidgetControlNames ["healthBar"]]
local healthBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["healthBar"]]

--hook list
local defaultHooksForHealthBar = {
Expand Down
21 changes: 19 additions & 2 deletions Libs/DF/picture.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,29 @@ do
WidgetType = "image",
SetHook = DF.SetHook,
RunHooksForWidget = DF.RunHooksForWidget,

dversion = DF.dversion,
}

_G [DF.GlobalWidgetControlNames ["image"]] = _G [DF.GlobalWidgetControlNames ["image"]] or metaPrototype
--check if there's a metaPrototype already existing
if (_G[DF.GlobalWidgetControlNames["image"]]) then
--get the already existing metaPrototype
local oldMetaPrototype = _G[DF.GlobalWidgetControlNames ["image"]]
--check if is older
if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then
--the version is older them the currently loading one
--copy the new values into the old metatable
for funcName, _ in pairs(metaPrototype) do
oldMetaPrototype[funcName] = metaPrototype[funcName]
end
end
else
--first time loading the framework
_G[DF.GlobalWidgetControlNames ["image"]] = metaPrototype
end
end

local ImageMetaFunctions = _G [DF.GlobalWidgetControlNames ["image"]]
local ImageMetaFunctions = _G[DF.GlobalWidgetControlNames ["image"]]

------------------------------------------------------------------------------------------------------------
--> metatables
Expand Down
20 changes: 18 additions & 2 deletions Libs/DF/slider.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,28 @@ do
ClearHooks = DF.ClearHooks,
RunHooksForWidget = DF.RunHooksForWidget,

dversion = DF.dversion,
}

_G [DF.GlobalWidgetControlNames ["slider"]] = _G [DF.GlobalWidgetControlNames ["slider"]] or metaPrototype
--check if there's a metaPrototype already existing
if (_G[DF.GlobalWidgetControlNames["slider"]]) then
--get the already existing metaPrototype
local oldMetaPrototype = _G[DF.GlobalWidgetControlNames ["slider"]]
--check if is older
if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then
--the version is older them the currently loading one
--copy the new values into the old metatable
for funcName, _ in pairs(metaPrototype) do
oldMetaPrototype[funcName] = metaPrototype[funcName]
end
end
else
--first time loading the framework
_G[DF.GlobalWidgetControlNames ["slider"]] = metaPrototype
end
end

local DFSliderMetaFunctions = _G [DF.GlobalWidgetControlNames ["slider"]]
local DFSliderMetaFunctions = _G[DF.GlobalWidgetControlNames ["slider"]]

------------------------------------------------------------------------------------------------------------
--> metatables
Expand Down
21 changes: 19 additions & 2 deletions Libs/DF/split_bar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,29 @@ do
WidgetType = "split_bar",
SetHook = DF.SetHook,
RunHooksForWidget = DF.RunHooksForWidget,

dversion = DF.dversion,
}

_G [DF.GlobalWidgetControlNames ["split_bar"]] = _G [DF.GlobalWidgetControlNames ["split_bar"]] or metaPrototype
--check if there's a metaPrototype already existing
if (_G[DF.GlobalWidgetControlNames["split_bar"]]) then
--get the already existing metaPrototype
local oldMetaPrototype = _G[DF.GlobalWidgetControlNames ["split_bar"]]
--check if is older
if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then
--the version is older them the currently loading one
--copy the new values into the old metatable
for funcName, _ in pairs(metaPrototype) do
oldMetaPrototype[funcName] = metaPrototype[funcName]
end
end
else
--first time loading the framework
_G[DF.GlobalWidgetControlNames ["split_bar"]] = metaPrototype
end
end

local SplitBarMetaFunctions = _G [DF.GlobalWidgetControlNames ["split_bar"]]
local SplitBarMetaFunctions = _G[DF.GlobalWidgetControlNames ["split_bar"]]

------------------------------------------------------------------------------------------------------------
--> metatables
Expand Down
21 changes: 19 additions & 2 deletions Libs/DF/textentry.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,29 @@ do
HasHook = DF.HasHook,
ClearHooks = DF.ClearHooks,
RunHooksForWidget = DF.RunHooksForWidget,

dversion = DF.dversion,
}

_G [DF.GlobalWidgetControlNames ["textentry"]] = _G [DF.GlobalWidgetControlNames ["textentry"]] or metaPrototype
--check if there's a metaPrototype already existing
if (_G[DF.GlobalWidgetControlNames["textentry"]]) then
--get the already existing metaPrototype
local oldMetaPrototype = _G[DF.GlobalWidgetControlNames ["textentry"]]
--check if is older
if ( (not oldMetaPrototype.dversion) or (oldMetaPrototype.dversion < DF.dversion) ) then
--the version is older them the currently loading one
--copy the new values into the old metatable
for funcName, _ in pairs(metaPrototype) do
oldMetaPrototype[funcName] = metaPrototype[funcName]
end
end
else
--first time loading the framework
_G[DF.GlobalWidgetControlNames ["textentry"]] = metaPrototype
end
end

local TextEntryMetaFunctions = _G [DF.GlobalWidgetControlNames ["textentry"]]
local TextEntryMetaFunctions = _G[DF.GlobalWidgetControlNames ["textentry"]]
DF.TextEntryCounter = DF.TextEntryCounter or 1

------------------------------------------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit e6dec35

Please sign in to comment.