Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
BloodDragon2580 committed Apr 28, 2024
1 parent 190b4bf commit 2621d54
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 29 deletions.
4 changes: 2 additions & 2 deletions GildenSteuer/GildenSteuer.toc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Interface: 100205
## Interface: 100206
## Title:|cffd6266cGildenSteuer|r
## Notes: Zahl deine Steuer und mach die Gilde Glücklich
## Author: BloodDragon2580
## Version: 6.2
## Version: 6.3
## SavedVariables: GildenSteuerDB
## IconTexture: Interface\AddOns\GildenSteuer\Media\Texture\logo

Expand Down
6 changes: 3 additions & 3 deletions GildenSteuer/Libs/AceDB-3.0/AceDB-3.0.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
-- @class file
-- @name AceDB-3.0.lua
-- @release $Id$
local ACEDB_MAJOR, ACEDB_MINOR = "AceDB-3.0", 28
local ACEDB_MAJOR, ACEDB_MINOR = "AceDB-3.0", 29
local AceDB = LibStub:NewLibrary(ACEDB_MAJOR, ACEDB_MINOR)

if not AceDB then return end -- No upgrade needed
Expand Down Expand Up @@ -606,8 +606,8 @@ end
-- profile.
-- @param defaultProfile The profile name to use as the default
function DBObjectLib:ResetDB(defaultProfile)
if defaultProfile and type(defaultProfile) ~= "string" then
error(("Usage: AceDBObject:ResetDB(defaultProfile): 'defaultProfile' - string or nil expected, got %q."):format(type(defaultProfile)), 2)
if defaultProfile and type(defaultProfile) ~= "string" and defaultProfile ~= true then
error(("Usage: AceDBObject:ResetDB(defaultProfile): 'defaultProfile' - string or true expected, got %q."):format(type(defaultProfile)), 2)
end

local sv = self.sv
Expand Down
92 changes: 68 additions & 24 deletions GildenSteuer/Libs/AceGUI-3.0/widgets/AceGUIWidget-ColorPicker.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
--[[-----------------------------------------------------------------------------
ColorPicker Widget
-------------------------------------------------------------------------------]]
local Type, Version = "ColorPicker", 25
local Type, Version = "ColorPicker", 28
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end

Expand All @@ -11,13 +11,24 @@ local pairs = pairs
-- WoW APIs
local CreateFrame, UIParent = CreateFrame, UIParent

-- Unfortunately we have no way to realistically detect if a client uses inverted alpha
-- as no API will tell you. Wrath uses the old colorpicker, era uses the new one, both are inverted
local INVERTED_ALPHA = (WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE)

--[[-----------------------------------------------------------------------------
Support functions
-------------------------------------------------------------------------------]]
local function ColorCallback(self, r, g, b, a, isAlpha)
if INVERTED_ALPHA and a then
a = 1 - a
end
if not self.HasAlpha then
a = 1
end
-- no change, skip update
if r == self.r and g == self.g and b == self.b and a == self.a then
return
end
self:SetColor(r, g, b, a)
if ColorPickerFrame:IsVisible() then
--colorpicker is still open
Expand Down Expand Up @@ -50,30 +61,63 @@ local function ColorSwatch_OnClick(frame)
ColorPickerFrame:SetFrameLevel(frame:GetFrameLevel() + 10)
ColorPickerFrame:SetClampedToScreen(true)

ColorPickerFrame.func = function()
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = 1 - OpacitySliderFrame:GetValue()
ColorCallback(self, r, g, b, a)
end

ColorPickerFrame.hasOpacity = self.HasAlpha
ColorPickerFrame.opacityFunc = function()
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = 1 - OpacitySliderFrame:GetValue()
ColorCallback(self, r, g, b, a, true)
end

local r, g, b, a = self.r, self.g, self.b, self.a
if self.HasAlpha then
ColorPickerFrame.opacity = 1 - (a or 0)
end
ColorPickerFrame:SetColorRGB(r, g, b)

ColorPickerFrame.cancelFunc = function()
ColorCallback(self, r, g, b, a, true)
if ColorPickerFrame.SetupColorPickerAndShow then -- 10.2.5 color picker overhaul
local r2, g2, b2, a2 = self.r, self.g, self.b, (self.a or 1)
if INVERTED_ALPHA then
a2 = 1 - a2
end

local info = {
swatchFunc = function()
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = ColorPickerFrame:GetColorAlpha()
ColorCallback(self, r, g, b, a)
end,

hasOpacity = self.HasAlpha,
opacityFunc = function()
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = ColorPickerFrame:GetColorAlpha()
ColorCallback(self, r, g, b, a, true)
end,
opacity = a2,

cancelFunc = function()
ColorCallback(self, r2, g2, b2, a2, true)
end,

r = r2,
g = g2,
b = b2,
}

ColorPickerFrame:SetupColorPickerAndShow(info)
else
ColorPickerFrame.func = function()
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = OpacitySliderFrame:GetValue()
ColorCallback(self, r, g, b, a)
end

ColorPickerFrame.hasOpacity = self.HasAlpha
ColorPickerFrame.opacityFunc = function()
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = OpacitySliderFrame:GetValue()
ColorCallback(self, r, g, b, a, true)
end

local r, g, b, a = self.r, self.g, self.b, 1 - (self.a or 1)
if self.HasAlpha then
ColorPickerFrame.opacity = a
end
ColorPickerFrame:SetColorRGB(r, g, b)

ColorPickerFrame.cancelFunc = function()
ColorCallback(self, r, g, b, a, true)
end

ColorPickerFrame:Show()
end

ColorPickerFrame:Show()
end
AceGUI:ClearFocus()
end
Expand Down

0 comments on commit 2621d54

Please sign in to comment.