Skip to content

Commit

Permalink
Fixed two errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Aug 1, 2024
1 parent d0e6ae8 commit db15d82
Show file tree
Hide file tree
Showing 10 changed files with 168 additions and 30 deletions.
2 changes: 2 additions & 0 deletions WorldQuestTracker_MapAPI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ if (not DF) then
return
end

local GetItemInfo = C_Item and C_Item.GetItemInfo or GetItemInfo

--localization
local L = DF.Language.GetLanguageTable(addonId)

Expand Down
2 changes: 2 additions & 0 deletions WorldQuestTracker_ZoneMap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1941,6 +1941,8 @@ if (bountyBoard) then

local UpdateBountyBoard = function(self, mapID)

do return end

if (WorldMapFrame.mapID == 905) then --argus
--the bounty board in argus is above the world quest tracker widgets
C_Timer.After(0.5, function()
Expand Down
31 changes: 26 additions & 5 deletions libs/DF/buildmenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,16 @@ local onLeaveHighlight = function(self)
end
end

--control the highlight color, if true, use color one, if false, use color two
--color one: .2, .2, .2, 0.5
--color two: .3, .3, .3, 0.5
local bHighlightColorOne = true

---create a button and a texture to highlight the button when the mouse is over it
---the button has the dimentions of the label and the widget
---@param frame frame
---@param label fontstring
---@param widgetWidth nunmber
---@param widgetWidth number
---@return unknown
local createOptionHighlightFrame = function(frame, label, widgetWidth)
frame = frame.widget or frame
Expand All @@ -163,13 +168,22 @@ local createOptionHighlightFrame = function(frame, label, widgetWidth)

local highlightTexture = highlightFrame:CreateTexture(nil, "overlay")
highlightTexture:SetColorTexture(1, 1, 1, 0.1)

PixelUtil.SetPoint(highlightTexture, "topleft", highlightFrame, "topleft", 0, 0)
PixelUtil.SetPoint(highlightTexture, "bottomright", highlightFrame, "bottomright", 0, 0)
highlightTexture:Hide()

local backgroundTexture = highlightFrame:CreateTexture(nil, "artwork")
backgroundTexture:SetColorTexture(1, 1, 1)
backgroundTexture:SetColorTexture(1, 1, 1, 0.5)
backgroundTexture:SetVertexColor(.25, .25, .25, 0.5)

if (bHighlightColorOne) then
backgroundTexture:SetVertexColor(.2, .2, .2, 0.5)
else
backgroundTexture:SetVertexColor(.25, .25, .25, 0.5)
end
bHighlightColorOne = not bHighlightColorOne

PixelUtil.SetPoint(backgroundTexture, "topleft", highlightFrame, "topleft", 0, 0)
PixelUtil.SetPoint(backgroundTexture, "bottomright", highlightFrame, "bottomright", 0, 0)

Expand Down Expand Up @@ -536,13 +550,16 @@ local setColorProperties = function(parent, widget, widgetTable, currentXOffset,
label:ClearAllPoints()

if (bAlignAsPairs) then
PixelUtil.SetPoint(label, "topleft", widget:GetParent(), "topleft", currentXOffset, currentYOffset)
PixelUtil.SetPoint(widget.widget, "left", label, "left", nAlignAsPairsLength, 0)

if (not widget.highlightFrame) then
local highlightFrame = createOptionHighlightFrame(widget, label, (widgetWidth or 140) + nAlignAsPairsLength + 5)
widget.highlightFrame = highlightFrame
end

----
widget._valueChangeHook = valueChangeHook
--widget.highlightFrame:SetScript("OnClick", highlightFrameOnClickToggle) --todo make this function for color picker color pick start
PixelUtil.SetPoint(label, "topleft", widget:GetParent(), "topleft", currentXOffset, currentYOffset)
PixelUtil.SetPoint(widget.widget, "right", widget.highlightFrame, "right", -3, 0)
else
if (widgetTable.boxfirst or bUseBoxFirstOnAllWidgets) then
label:SetPoint("left", widget.widget, "right", 2, 0)
Expand Down Expand Up @@ -1055,6 +1072,8 @@ function detailsFramework:BuildMenuVolatile(parent, menuOptions, xOffset, yOffse
end
detailsFramework:ClearOptionsPanel(parent)

bHighlightColorOne = true

local amountLineWidgetAdded = 0
local biggestColumnHeight = 0 --used to resize the scrollbox child when a scrollbox is passed
local latestInlineWidget
Expand Down Expand Up @@ -1323,6 +1342,8 @@ function detailsFramework:BuildMenu(parent, menuOptions, xOffset, yOffset, heigh
local maxColumnWidth = 0 --biggest width of widget + text size on the current column loop pass
local maxWidgetWidth = 0 --biggest widget width on the current column loop pass

bHighlightColorOne = true

--parse settings and the options table
parseOptionsTypes(menuOptions)

Expand Down
2 changes: 1 addition & 1 deletion libs/DF/button.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1332,7 +1332,7 @@ detailsFramework.TabButtonMixin = {
---@return df_tabbutton
function detailsFramework:CreateTabButton(parent, frameName)
---@type df_tabbutton
local tabButton = CreateFrame("button", frameName, parent)
local tabButton = CreateFrame("button", frameName, parent, "BackdropTemplate")
tabButton:SetSize(50, 20)
tabButton.bIsSelected = false

Expand Down
34 changes: 34 additions & 0 deletions libs/DF/charts.lua
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ end
---@field lines line[]
---@field fixedLineWidth number
---@field chartName string
---@field dataPoint_OnEnterFunc fun(self: df_chart, onEnterFunc: function, ...) set the function to be called when the mouse hover over a data point in the chart
---@field dataPoint_OnEnterPayload any[] set the payload to be passed to the function set by DataPoint_OnEnterFunc
---@field dataPoint_OnLeaveFunc fun(self: df_chart, onLeaveFunc: function, ...) set the function to be called when the mouse leaves a data point in the chart
---@field dataPoint_OnLeavePayload any[] set the payload to be passed to the function set by DataPoint_OnLeaveFunc
---@field GetOnEnterLeaveFunctions fun(self: df_chart) : function, any[], function, any[] return the functions and payloads set by DataPoint_OnEnterFunc and DataPoint_OnLeaveFunc
---@field ChartFrameConstructor fun(self: df_chart) set the default values for the chart frame
---@field GetLine fun(self: df_chart) : line return a line and also internally handle next line
---@field GetLines fun(self: df_chart) : line[] return a table with all lines already created
Expand Down Expand Up @@ -684,6 +689,31 @@ detailsFramework.ChartFrameMixin = {
self:UpdateFrameSizeCache()
end,

---when the mouse hover over a data point in the chart, this function will be called
---@param self df_chart
SetOnEnterFunction = function(self, onEnterFunc, ...)
self.dataPoint_OnEnterFunc = onEnterFunc
self.dataPoint_OnEnterPayload = {...}
end,

---when the mouse leaves a data point in the chart, this function will be called
---@param self df_chart
SetOnLeaveFunction = function(self, onLeaveFunc, ...)
self.dataPoint_OnLeaveFunc = onLeaveFunc
self.dataPoint_OnLeavePayload = {...}
end,

---get the data point on enter and on leave function
---@param self df_chart
---@return function onEnterFunc
---@return any[] onEnterPayload
---@return function onLeaveFunc
---@return any[] onLeavePayload
GetOnEnterLeaveFunctions = function(self)
return self.dataPoint_OnEnterFunc, self.dataPoint_OnEnterPayload, self.dataPoint_OnLeaveFunc, self.dataPoint_OnLeavePayload
end,

---this function will draw the chart lines
---@param self df_chart
---@param yPointScale number|nil
---@param bUpdateLabels boolean|nil
Expand All @@ -709,6 +739,8 @@ detailsFramework.ChartFrameMixin = {

self:ResetDataIndex()

print(maxLines)

for i = 1, maxLines do
local line = self:GetLine()

Expand Down Expand Up @@ -798,6 +830,8 @@ local createChartFrame = function(parent, name)
return chartFrame
end



function detailsFramework:CreateGraphicLineFrame(parent, name)
---@type df_chart
local newGraphicFrame = createChartFrame(parent, name)
Expand Down
5 changes: 2 additions & 3 deletions libs/DF/definitions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,9 @@
---@field CreateSearchBox fun(self:table, parent:frame, callback:function) : df_searchbox
---@field ConvertAnchorPointToInside fun(self:table, anchorPoint:anchorid) : anchorid
---@field CreateHeader fun(self:table, parent:frame, headerTable:df_headercolumndata[], options:table?, frameName:string?) : df_headerframe
---@field CreateGraphicMultiLineFrame fun(self:table, parent:frame, name:string) : df_chartmulti
---@field CreateGraphicLineFrame fun(self:table, parent:frame, name:string) : df_chart
---@field
---@field



--[=[
Wrapped objects: when using the following functions, the object will be wrapped in a table, e.g. detailsFramework:CreateButton() will return a table with the button, the button will be accessible through the "button" key.
Expand Down
57 changes: 43 additions & 14 deletions libs/DF/fw.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


local dversion = 552
local dversion = 556
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)

Expand Down Expand Up @@ -113,13 +113,13 @@ end
---return if the wow version the player is playing is dragonflight or an expansion after it
---@return boolean
function DF.IsDragonflightAndBeyond()
return 110000 >= 100000
return buildInfo >= 100000
end

---return true if the wow version is Dragonflight or below
---@return boolean
function DF.IsDragonflightOrBelow()
return 110000 < 110000
return buildInfo < 110000
end

---return if the wow version the player is playing is a classic version of wow
Expand Down Expand Up @@ -2801,6 +2801,9 @@ local templateOnLeave = function(frame)
end
end

DF.TemplateOnEnter = templateOnEnter
DF.TemplateOnLeave = templateOnLeave

---set a details framework template into a regular frame
---@param self table
---@param frame uiobject
Expand Down Expand Up @@ -2911,8 +2914,10 @@ end

--DF.font_templates ["ORANGE_FONT_TEMPLATE"] = {color = "orange", size = 11, font = "Accidental Presidency"}
--DF.font_templates ["OPTIONS_FONT_TEMPLATE"] = {color = "yellow", size = 12, font = "Accidental Presidency"}
DF.font_templates["ORANGE_FONT_TEMPLATE"] = {color = "orange", size = 10, font = DF:GetBestFontForLanguage()}
DF.font_templates["OPTIONS_FONT_TEMPLATE"] = {color = "yellow", size = 9.6, font = DF:GetBestFontForLanguage()}
--DF.font_templates["ORANGE_FONT_TEMPLATE"] = {color = "orange", size = 10, font = DF:GetBestFontForLanguage()}
DF.font_templates["ORANGE_FONT_TEMPLATE"] = {color = {1, 0.8235, 0, 1}, size = 12, font = DF:GetBestFontForLanguage()}
--DF.font_templates["OPTIONS_FONT_TEMPLATE"] = {color = "yellow", size = 9.6, font = DF:GetBestFontForLanguage()}
DF.font_templates["OPTIONS_FONT_TEMPLATE"] = {color = {1, 1, 1, 0.9}, size = 9.6, font = DF:GetBestFontForLanguage()}
DF.font_templates["SMALL_SILVER"] = {color = "silver", size = 9, font = DF:GetBestFontForLanguage()}

--dropdowns
Expand All @@ -2926,10 +2931,11 @@ DF.dropdown_templates["OPTIONS_DROPDOWN_TEMPLATE"] = {
tile = true
},

backdropcolor = {1, 1, 1, .7},
backdropbordercolor = {0, 0, 0, 1},
onentercolor = {1, 1, 1, .9},
onenterbordercolor = {1, 1, 1, 1},
--backdropcolor = {0.1, 0.1, 0.1, .7},
backdropcolor = {0.2, 0.2, 0.2, .7},
onentercolor = {0.3, 0.3, 0.3, .7},
backdropbordercolor = {0, 0, 0, .4},
onenterbordercolor = {0.3, 0.3, 0.3, 0.8},

dropicon = "Interface\\BUTTONS\\arrow-Down-Down",
dropiconsize = {16, 16},
Expand Down Expand Up @@ -3051,14 +3057,37 @@ DF.button_templates["STANDARD_GRAY"] = {
DF.slider_templates = DF.slider_templates or {}
DF.slider_templates["OPTIONS_SLIDER_TEMPLATE"] = {
backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},
backdropcolor = {1, 1, 1, .5},
backdropbordercolor = {0, 0, 0, 1},
onentercolor = {1, 1, 1, .5},
onenterbordercolor = {1, 1, 1, 1},

--original color wow10:
--backdropcolor = {1, 1, 1, .5},
--backdropbordercolor = {0, 0, 0, 1},
--onentercolor = {1, 1, 1, .5},
--onenterbordercolor = {1, 1, 1, 1},

backdropcolor = {0.2, 0.2, 0.2, .7},
onentercolor = {0.3, 0.3, 0.3, .7},
backdropbordercolor = {0, 0, 0, .4}, --0.7 original alpha wow10
onenterbordercolor = {0.3, 0.3, 0.3, 0.8},

thumbtexture = [[Interface\Tooltips\UI-Tooltip-Background]],
thumbwidth = 16,
thumbheight = 14,
thumbcolor = {0, 0, 0, 0.5},
--thumbcolor = {0, 0, 0, 0.5},
thumbcolor = {.8, .8, .8, 0.5},
}

DF.slider_templates["OPTIONS_SLIDERDARK_TEMPLATE"] = {
backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true},

backdropcolor = {0.05, 0.05, 0.05, .7},
onentercolor = {0.3, 0.3, 0.3, .7},
backdropbordercolor = {0, 0, 0, 1},
onenterbordercolor = {0, 0, 0, 1},

thumbtexture = [[Interface\Tooltips\UI-Tooltip-Background]],
thumbwidth = 24,
thumbheight = 14,
thumbcolor = {.8, .8, .8, 0.5},
}

DF.slider_templates["MODERN_SLIDER_TEMPLATE"] = {
Expand Down
1 change: 1 addition & 0 deletions libs/DF/slider.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1170,6 +1170,7 @@ end
--DF:Mixin(DFSliderMetaFunctions, DF.TooltipHandlerMixin)

---@class df_slider : slider, df_scripthookmixin, df_widgets
---@field tooltip string?
---@field widget slider
---@field slider slider
---@field type string
Expand Down
41 changes: 40 additions & 1 deletion libs/DF/textentry.lua
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,12 @@ detailsFramework.TextEntryCounter = detailsFramework.TextEntryCounter or 1

if (textentry:IsEnabled()) then
textentry.current_bordercolor = textentry.current_bordercolor or {textentry:GetBackdropBorderColor()}
textentry:SetBackdropBorderColor(1, 1, 1, 1)
local onEnterBorderColor = object.onenter_backdrop_border_color
if (onEnterBorderColor) then
textentry:SetBackdropBorderColor(detailsFramework:ParseColors(onEnterBorderColor))
else
textentry:SetBackdropBorderColor(1, 1, 1, 0.6)
end
end
end

Expand Down Expand Up @@ -522,11 +527,13 @@ function TextEntryMetaFunctions:SetTemplate(template)
if (template.backdrop) then
self.editbox:SetBackdrop(template.backdrop)
end

if (template.backdropcolor) then
local r, g, b, a = detailsFramework:ParseColors(template.backdropcolor)
self.editbox:SetBackdropColor(r, g, b, a)
self.onleave_backdrop = {r, g, b, a}
end

if (template.backdropbordercolor) then
local r, g, b, a = detailsFramework:ParseColors(template.backdropbordercolor)
self.editbox:SetBackdropBorderColor(r, g, b, a)
Expand All @@ -536,8 +543,40 @@ function TextEntryMetaFunctions:SetTemplate(template)
self.editbox.current_bordercolor[4] = a
self.onleave_backdrop_border_color = {r, g, b, a}
end

if (template.onentercolor) then
local r, g, b, a = detailsFramework:ParseColors(template.onentercolor)
self.onenter_backdrop = {r, g, b, a}
self:HookScript("OnEnter", detailsFramework.TemplateOnEnter)
self.__has_onentercolor_script = true
end

if (template.onleavecolor) then
local r, g, b, a = detailsFramework:ParseColors(template.onleavecolor)
self.onleave_backdrop = {r, g, b, a}
self:HookScript("OnLeave", detailsFramework.TemplateOnLeave)
self.__has_onleavecolor_script = true
end

if (template.onenterbordercolor) then
local r, g, b, a = detailsFramework:ParseColors(template.onenterbordercolor)
self.onenter_backdrop_border_color = {r, g, b, a}
if (not self.__has_onentercolor_script) then
self:HookScript("OnEnter", detailsFramework.TemplateOnEnter)
end
end

if (template.onleavebordercolor) then
local r, g, b, a = detailsFramework:ParseColors(template.onleavebordercolor)
self.onleave_backdrop_border_color = {r, g, b, a}
if (not self.__has_onleavecolor_script) then
self:HookScript("OnLeave", detailsFramework.TemplateOnLeave)
end
end
end

--TextEntryMetaFunctions.SetTemplate = DetailsFramework.SetTemplate

------------------------------------------------------------------------------------------------------------
--object constructor

Expand Down
Loading

0 comments on commit db15d82

Please sign in to comment.