Release Candidate 1

This commit is contained in:
Tercio Jose
2022-11-18 16:54:25 -03:00
parent bbbda84c68
commit 1c8dfb3ab7
96 changed files with 3053 additions and 1427 deletions
+49
View File
@@ -1029,3 +1029,52 @@ end
return colorPickButton
end
function DF:SetRegularButtonTexture(button, texture, left, right, top, bottom)
if (type(left) == "table") then
left, right, top, bottom = unpack(left)
end
if (not left) then
left, right, top, bottom = 0, 1, 0, 1
end
local atlas
if (type(texture) == "string") then
atlas = C_Texture.GetAtlasInfo(texture)
end
local normalTexture = button:GetNormalTexture()
local pushedTexture = button:GetPushedTexture()
local highlightTexture = button:GetHightlightTexture()
local disabledTexture = button:GetDisabledTexture()
if (atlas) then
normalTexture:SetAtlas(texture)
pushedTexture:SetAtlas(texture)
highlightTexture:SetAtlas(texture)
disabledTexture:SetAtlas(texture)
else
normalTexture:SetTexture(texture)
pushedTexture:SetTexture(texture)
highlightTexture:SetTexture(texture)
disabledTexture:SetTexture(texture)
normalTexture:SetTexCoord(left, right, top, bottom)
pushedTexture:SetTexCoord(left, right, top, bottom)
highlightTexture:SetTexCoord(left, right, top, bottom)
disabledTexture:SetTexCoord(left, right, top, bottom)
end
end
function DF:SetRegularButtonVertexColor(button, ...)
local r, g, b, a = DF:ParseColor(...)
local normalTexture = button:GetNormalTexture()
local pushedTexture = button:GetPushedTexture()
local highlightTexture = button:GetHightlightTexture()
local disabledTexture = button:GetDisabledTexture()
normalTexture:SetVertexColor(r, g, b, a)
pushedTexture:SetVertexColor(r, g, b, a)
highlightTexture:SetVertexColor(r, g, b, a)
disabledTexture:SetVertexColor(r, g, b, a)
end
+4 -2
View File
@@ -28,6 +28,8 @@ function DF:CreateCoolTip()
return
end
local maxStatusBarValue = 100000000
local defaultBackdrop = {bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1,
tile = true, tileSize = 16, insets = {left = 0, right = 0, top = 0, bottom = 0}}
local defaultBackdropColor = {0.1215, 0.1176, 0.1294, 0.8000}
@@ -1159,7 +1161,7 @@ function DF:CreateCoolTip()
function gameCooltip:StatusBar(menuButton, statusBarSettings)
if (statusBarSettings) then
menuButton.statusbar:SetValue(statusBarSettings[1])
menuButton.statusbar:SetValue(Clamp(statusBarSettings[1], 0, maxStatusBarValue))
menuButton.statusbar:SetStatusBarColor(statusBarSettings[2], statusBarSettings[3], statusBarSettings[4], statusBarSettings[5])
menuButton.statusbar:SetHeight(20 + (gameCooltip.OptionsTable.StatusBarHeightMod or 0))
@@ -1171,7 +1173,7 @@ function DF:CreateCoolTip()
end
if (statusBarSettings[7]) then
menuButton.statusbar2:SetValue(statusBarSettings[7].value)
menuButton.statusbar2:SetValue(Clamp(statusBarSettings[7].value, 0, maxStatusBarValue))
menuButton.statusbar2.texture:SetTexture(statusBarSettings[7].texture or [[Interface\RaidFrame\Raid-Bar-Hp-Fill]])
if (statusBarSettings[7].specialSpark) then
menuButton.spark2:Show()
+84 -20
View File
@@ -191,10 +191,10 @@ DF:Mixin(DropDownMetaFunctions, DF.ScriptHookMixin)
--menu width and height
function DropDownMetaFunctions:SetMenuSize(width, height)
if (width) then
return rawset(self, "realsizeW", width)
rawset(self, "realsizeW", width)
end
if (height) then
return rawset(self, "realsizeH", height)
rawset(self, "realsizeH", height)
end
end
@@ -515,6 +515,18 @@ function DropDownMetaFunctions:Selected(thisOption)
self.label:SetPoint("left", self.label:GetParent(), "left", 4, 0)
end
if (thisOption.centerTexture) then
self.dropdown.centerTexture:SetTexture(thisOption.centerTexture)
else
self.dropdown.centerTexture:SetTexture("")
end
if (thisOption.rightTexture) then
self.dropdown.rightTexture:SetTexture(thisOption.rightTexture)
else
self.dropdown.rightTexture:SetTexture("")
end
if (thisOption.statusbar) then
self.statusbar:SetTexture(thisOption.statusbar)
if (thisOption.statusbarcolor) then
@@ -540,6 +552,7 @@ function DropDownMetaFunctions:Selected(thisOption)
self:SetValue(thisOption.value)
end
--on click on any option in the dropdown
function DetailsFrameworkDropDownOptionClick(button)
--update name and icon on main frame
button.object:Selected(button.table)
@@ -555,9 +568,11 @@ function DetailsFrameworkDropDownOptionClick(button)
button.object.myvaluelabel = button.table.label
end
--on click on the dropdown show the menu frame with the options to select
function DropDownMetaFunctions:Open()
self.dropdown.dropdownframe:Show()
self.dropdown.dropdownborder:Show()
self.opened = true
if (lastOpened) then
lastOpened:Close()
@@ -565,6 +580,7 @@ function DropDownMetaFunctions:Open()
lastOpened = self
end
--close the menu showing the options
function DropDownMetaFunctions:Close()
--when menu is being close, just hide the border and the script will call back this again
if (self.dropdown.dropdownborder:IsShown()) then
@@ -585,6 +601,7 @@ function DetailsFrameworkDropDownOptionsFrameOnHide(self)
self:GetParent().MyObject:Close()
end
--on enter an option in the menu dropdown
function DetailsFrameworkDropDownOptionOnEnter(self)
if (self.table.desc) then
GameCooltip2:Preset(2)
@@ -603,10 +620,22 @@ function DetailsFrameworkDropDownOptionOnEnter(self)
self.tooltip = true
end
if (self.table.audiocue) then
if (DF.CurrentSoundHandle) then
StopSound(DF.CurrentSoundHandle, 0.1)
end
local willPlay, soundHandle = PlaySoundFile(self.table.audiocue, "Master")
if (willPlay) then
DF.CurrentSoundHandle = soundHandle
end
end
self:GetParent().mouseover:SetPoint("left", self)
self:GetParent().mouseover:Show()
end
--on leave an option on the menu dropdown
function DetailsFrameworkDropDownOptionOnLeave(frame)
if (frame.table.desc) then
GameCooltip2:ShowMe(false)
@@ -615,6 +644,7 @@ function DetailsFrameworkDropDownOptionOnLeave(frame)
end
--@button is the raw button frame, object is the button capsule
--click on the main dropdown frame (not the menu options popup)
function DetailsFrameworkDropDownOnMouseDown(button, buttontype)
local object = button.MyObject
@@ -645,9 +675,9 @@ function DetailsFrameworkDropDownOnMouseDown(button, buttontype)
end
for tindex, thisOption in ipairs(optionsTable) do
local show = isOptionVisible(button, thisOption)
local bIsOptionVisible = isOptionVisible(button, thisOption)
if (show) then
if (bIsOptionVisible) then
local thisOptionFrame = object.menus[i]
showing = showing + 1
@@ -657,14 +687,26 @@ function DetailsFrameworkDropDownOnMouseDown(button, buttontype)
thisOptionFrame = DF:CreateDropdownButton(parent, name)
local optionIndex = i - 1
thisOptionFrame:SetPoint("topleft", parent, "topleft", 1, (-optionIndex*20)-0)
thisOptionFrame:SetPoint("topright", parent, "topright", 0, (-optionIndex*20)-0)
thisOptionFrame:SetPoint("topleft", parent, "topleft", 1, (-optionIndex * 20))
thisOptionFrame:SetPoint("topright", parent, "topright", 0, (-optionIndex * 20))
thisOptionFrame.object = object
object.menus[i] = thisOptionFrame
end
thisOptionFrame:SetFrameStrata(thisOptionFrame:GetParent():GetFrameStrata())
thisOptionFrame:SetFrameLevel(thisOptionFrame:GetParent():GetFrameLevel()+10)
thisOptionFrame:SetFrameLevel(thisOptionFrame:GetParent():GetFrameLevel() + 10)
if (thisOption.rightTexture) then
thisOptionFrame.rightTexture:SetTexture(thisOption.rightTexture)
else
thisOptionFrame.rightTexture:SetTexture("")
end
if (thisOption.centerTexture) then
thisOptionFrame.centerTexture:SetTexture(thisOption.centerTexture)
else
thisOptionFrame.centerTexture:SetTexture("")
end
thisOptionFrame.icon:SetTexture(thisOption.icon)
if (thisOption.icon) then
@@ -742,8 +784,8 @@ function DetailsFrameworkDropDownOnMouseDown(button, buttontype)
thisOptionFrame.table = thisOption
local labelwitdh = thisOptionFrame.label:GetStringWidth()
if (labelwitdh+40 > frameWitdh) then
frameWitdh = labelwitdh+40
if (labelwitdh + 40 > frameWitdh) then
frameWitdh = labelwitdh + 40
end
thisOptionFrame:Show()
@@ -763,7 +805,7 @@ function DetailsFrameworkDropDownOnMouseDown(button, buttontype)
local size = object.realsizeH
if (showing*20 > size) then
if (showing * 20 > size) then
--show scrollbar and setup scroll
object:ShowScroll()
scrollFrame:EnableMouseWheel(true)
@@ -817,6 +859,10 @@ function DetailsFrameworkDropDownOnMouseDown(button, buttontype)
end
object:Open()
--scrollFrame:SetHeight(300)
--scrollChild:SetHeight(300)
--scrollBorder:SetHeight(300)
else
--clear menu
end
@@ -1050,8 +1096,8 @@ function DF:NewDropDown(parent, container, name, member, width, height, func, de
end
dropDownObject.func = func
dropDownObject.realsizeW = 150
dropDownObject.realsizeH = 150
dropDownObject.realsizeW = 165
dropDownObject.realsizeH = 300
dropDownObject.FixedValue = nil
dropDownObject.opened = false
dropDownObject.menus = {}
@@ -1138,6 +1184,16 @@ function DF:CreateNewDropdownFrame(parent, name)
icon:SetVertexColor(1, 1, 1, 0.4)
newDropdownFrame.icon = icon
local rightTexture = newDropdownFrame:CreateTexture("$parent_RightTexture", "OVERLAY")
rightTexture:SetPoint("right", newDropdownFrame, "right", -2, 0)
rightTexture:SetSize(20, 20)
newDropdownFrame.rightTexture = rightTexture
local centerTexture = newDropdownFrame:CreateTexture("$parent_CenterTexture", "OVERLAY")
centerTexture:SetPoint("center", newDropdownFrame, "center", 0, 0)
centerTexture:SetSize(20, 20)
newDropdownFrame.centerTexture = centerTexture
local text = newDropdownFrame:CreateFontString("$parent_Text", "ARTWORK", "GameFontHighlightSmall")
text:SetPoint("left", icon, "right", 5, 0)
text:SetJustifyH("left")
@@ -1168,33 +1224,31 @@ function DF:CreateNewDropdownFrame(parent, name)
local border = CreateFrame("frame", "$Parent_Border", newDropdownFrame, "BackdropTemplate")
border:Hide()
border:SetFrameStrata("FULLSCREEN")
border:SetSize(150, 150)
border:SetSize(150, 300)
border:SetPoint("topleft", newDropdownFrame, "bottomleft", 0, 0)
border:SetBackdrop(borderBackdrop)
border:SetScript("OnHide", DetailsFrameworkDropDownOptionsFrameOnHide)
border:SetBackdropColor(0, 0, 0, 0.92)
border:SetBackdropBorderColor(0, 0, 0, 1)
border:SetBackdropBorderColor(.2, .2, .2, 0.8)
newDropdownFrame.dropdownborder = border
local scroll = CreateFrame("ScrollFrame", "$Parent_ScrollFrame", newDropdownFrame, "BackdropTemplate")
scroll:SetFrameStrata("FULLSCREEN")
scroll:SetSize(150, 150)
scroll:SetSize(150, 300)
scroll:SetPoint("topleft", newDropdownFrame, "bottomleft", 0, 0)
scroll:Hide()
newDropdownFrame.dropdownframe = scroll
local child = CreateFrame("frame", "$Parent_ScrollChild", scroll, "BackdropTemplate")
child:SetSize(150, 150)
--child:SetAllPoints()
child:SetSize(150, 300)
child:SetPoint("topleft", scroll, "topleft", 0, 0)
child:SetBackdrop(childBackdrop)
child:SetBackdropColor(0, 0, 0, 1)
DF:ApplyStandardBackdrop(child)
local backgroundTexture = child:CreateTexture(nil, "background")
backgroundTexture:SetAllPoints()
backgroundTexture:SetColorTexture(0, 0, 0, 1)
DF:ApplyStandardBackdrop(child)
local selected = child:CreateTexture("$parent_SelectedTexture", "BACKGROUND")
selected:SetSize(150, 16)
selected:SetPoint("left", child, "left", 2, 0)
@@ -1243,6 +1297,16 @@ function DF:CreateDropdownButton(parent, name)
rightButton:SetPoint("right", newButton, "right", -2, 0)
rightButton:Hide()
local rightTexture = newButton:CreateTexture("$parent_RightTexture", "OVERLAY")
rightTexture:SetPoint("right", newButton, "right", -2, 0)
rightTexture:SetSize(20, 20)
newButton.rightTexture = rightTexture
local centerTexture = newButton:CreateTexture("$parent_CenterTexture", "OVERLAY")
centerTexture:SetPoint("center", newButton, "center", 0, 0)
centerTexture:SetSize(20, 20)
newButton.centerTexture = centerTexture
newButton:SetScript("OnMouseDown", DetailsFrameworkDropDownOptionClick)
newButton:SetScript("OnEnter", DetailsFrameworkDropDownOptionOnEnter)
newButton:SetScript("OnLeave", DetailsFrameworkDropDownOptionOnLeave)
+9 -3
View File
@@ -1,6 +1,6 @@
local dversion = 387
local dversion = 393
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)
@@ -694,7 +694,7 @@ function DF:GroupIterator(callback, ...)
end
end
function DF:IntegerToTimer(value)
function DF:IntegerToTimer(value) --~formattime
return "" .. floor(value/60) .. ":" .. format("%02.f", value%60)
end
@@ -3372,7 +3372,12 @@ end
--this is most copied from the wow client code, few changes applied to customize it
function DF:CreateGlowOverlay (parent, antsColor, glowColor)
local glowFrame = CreateFrame("frame", parent:GetName() and "$parentGlow2" or "OverlayActionGlow" .. math.random(1, 10000000), parent, "ActionBarButtonSpellActivationAlert")
local pName = parent:GetName()
local fName = pName and (pName.."Glow2") or "OverlayActionGlow" .. math.random(1, 10000000)
if fName and string.len(fName) > 50 then -- shorten to work around too long names
fName = strsub(fName, string.len(fName)-49)
end
local glowFrame = CreateFrame("frame", fName, parent, "ActionBarButtonSpellActivationAlert")
glowFrame:HookScript ("OnShow", glow_overlay_onshow)
glowFrame:HookScript ("OnHide", glow_overlay_onhide)
@@ -4827,6 +4832,7 @@ end
["getglobal"] = true,
["setmetatable"] = true,
["DevTools_DumpCommand"] = true,
["ChatEdit_SendText"] = true,
--avoid creating macros
["SetBindingMacro"] = true,
+93 -48
View File
@@ -1971,48 +1971,64 @@ function detailsFramework:CreateScaleBar(frame, config) --~scale
end
local no_options = {}
function detailsFramework:CreateSimplePanel(parent, w, h, title, name, panel_options, db)
if (db and name and not db [name]) then
db [name] = {scale = 1}
--[=[
options available to panel_options:
NoScripts = false, --if true, won't set OnMouseDown and OnMouseUp (won't be movable)
NoTUISpecialFrame = false, --if true, won't add the frame to 'UISpecialFrames'
DontRightClickClose = false, --if true, won't make the frame close when clicked with the right mouse button
UseScaleBar = false, --if true, will create a scale bar in the top left corner (require a table on 'db' to save the scale)
UseStatusBar = false, --if true, creates a status bar at the bottom of the frame (frame.StatusBar)
NoCloseButton = false, --if true, won't show the close button
NoTitleBar = false, --if true, don't create the title bar
]=]
function detailsFramework:CreateSimplePanel(parent, width, height, title, frameName, panelOptions, savedVariableTable)
if (savedVariableTable and frameName and not savedVariableTable[frameName]) then
savedVariableTable[frameName] = {
scale = 1
}
end
if (not name) then
name = "DetailsFrameworkSimplePanel" .. detailsFramework.SimplePanelCounter
if (not frameName) then
frameName = "DetailsFrameworkSimplePanel" .. detailsFramework.SimplePanelCounter
detailsFramework.SimplePanelCounter = detailsFramework.SimplePanelCounter + 1
end
if (not parent) then
parent = UIParent
end
panel_options = panel_options or no_options
panelOptions = panelOptions or no_options
local f = CreateFrame("frame", name, UIParent,"BackdropTemplate")
f:SetSize(w or 400, h or 250)
f:SetPoint("center", UIParent, "center", 0, 0)
f:SetFrameStrata("FULLSCREEN")
f:EnableMouse()
f:SetMovable(true)
f:SetBackdrop(SimplePanel_frame_backdrop)
f:SetBackdropColor(unpack(SimplePanel_frame_backdrop_color))
f:SetBackdropBorderColor(unpack(SimplePanel_frame_backdrop_border_color))
local simplePanel = CreateFrame("frame", frameName, UIParent,"BackdropTemplate")
simplePanel:SetSize(width or 400, height or 250)
simplePanel:SetPoint("center", UIParent, "center", 0, 0)
simplePanel:SetFrameStrata("FULLSCREEN")
simplePanel:EnableMouse()
simplePanel:SetMovable(true)
simplePanel:SetBackdrop(SimplePanel_frame_backdrop)
simplePanel:SetBackdropColor(unpack(SimplePanel_frame_backdrop_color))
simplePanel:SetBackdropBorderColor(unpack(SimplePanel_frame_backdrop_border_color))
f.DontRightClickClose = panel_options.DontRightClickClose
simplePanel.DontRightClickClose = panelOptions.DontRightClickClose
if (not panel_options.NoTUISpecialFrame) then
tinsert(UISpecialFrames, name)
if (not panelOptions.NoTUISpecialFrame) then
tinsert(UISpecialFrames, frameName)
end
local title_bar = CreateFrame("frame", name .. "TitleBar", f,"BackdropTemplate")
title_bar:SetPoint("topleft", f, "topleft", 2, -3)
title_bar:SetPoint("topright", f, "topright", -2, -3)
title_bar:SetHeight(20)
title_bar:SetBackdrop(SimplePanel_frame_backdrop)
title_bar:SetBackdropColor(.2, .2, .2, 1)
title_bar:SetBackdropBorderColor(0, 0, 0, 1)
f.TitleBar = title_bar
if (panelOptions.UseStatusBar) then
local statusBar = detailsFramework:CreateStatusBar(simplePanel)
simplePanel.StatusBar = statusBar
end
local close = CreateFrame("button", name and name .. "CloseButton", title_bar)
local titleBar = CreateFrame("frame", frameName .. "TitleBar", simplePanel,"BackdropTemplate")
titleBar:SetPoint("topleft", simplePanel, "topleft", 2, -3)
titleBar:SetPoint("topright", simplePanel, "topright", -2, -3)
titleBar:SetHeight(20)
titleBar:SetBackdrop(SimplePanel_frame_backdrop)
titleBar:SetBackdropColor(.2, .2, .2, 1)
titleBar:SetBackdropBorderColor(0, 0, 0, 1)
simplePanel.TitleBar = titleBar
local close = CreateFrame("button", frameName and frameName .. "CloseButton", titleBar)
close:SetFrameLevel(detailsFramework.FRAMELEVEL_OVERLAY)
close:SetSize(16, 16)
@@ -2025,31 +2041,37 @@ function detailsFramework:CreateSimplePanel(parent, w, h, title, name, panel_opt
close:SetAlpha(0.7)
close:SetScript("OnClick", simple_panel_close_click)
f.Close = close
simplePanel.Close = close
local title_string = title_bar:CreateFontString(name and name .. "Title", "overlay", "GameFontNormal")
title_string:SetTextColor(.8, .8, .8, 1)
title_string:SetText(title or "")
f.Title = title_string
local titleText = titleBar:CreateFontString(frameName and frameName .. "Title", "overlay", "GameFontNormal")
titleText:SetTextColor(.8, .8, .8, 1)
titleText:SetText(title or "")
simplePanel.Title = titleText
if (panel_options.UseScaleBar and db [name]) then
detailsFramework:CreateScaleBar (f, db [name])
f:SetScale(db [name].scale)
if (panelOptions.UseScaleBar and savedVariableTable [frameName]) then
detailsFramework:CreateScaleBar (simplePanel, savedVariableTable [frameName])
simplePanel:SetScale(savedVariableTable [frameName].scale)
end
f.Title:SetPoint("center", title_bar, "center")
f.Close:SetPoint("right", title_bar, "right", -2, 0)
simplePanel.Title:SetPoint("center", titleBar, "center")
simplePanel.Close:SetPoint("right", titleBar, "right", -2, 0)
if (panel_options.NoCloseButton) then
f.Close:Hide()
if (panelOptions.NoCloseButton) then
simplePanel.Close:Hide()
end
f:SetScript("OnMouseDown", simple_panel_mouse_down)
f:SetScript("OnMouseUp", simple_panel_mouse_up)
if (panelOptions.NoTitleBar) then
simplePanel.TitleBar:Hide()
end
f.SetTitle = simple_panel_settitle
if (not panelOptions.NoScripts) then
simplePanel:SetScript("OnMouseDown", simple_panel_mouse_down)
simplePanel:SetScript("OnMouseUp", simple_panel_mouse_up)
end
return f
simplePanel.SetTitle = simple_panel_settitle
return simplePanel
end
local Panel1PxBackdrop = {bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 64,
@@ -7622,6 +7644,9 @@ detailsFramework.CastFrameFunctions = {
CanLazyTick = true, --if true, it'll execute the lazy tick function, it ticks in a much slower pace comparece with the regular tick
LazyUpdateCooldown = 0.2, --amount of time to wait for the next lazy update, this updates non critical things like the cast timer
FillOnInterrupt = true,
HideSparkOnInterrupt = true,
--default size
Width = 100,
Height = 20,
@@ -8268,12 +8293,26 @@ detailsFramework.CastFrameFunctions = {
UNIT_SPELLCAST_STOP = function(self, unit, ...)
local unitID, castID, spellID = ...
if (self.castID == castID) then
self.Spark:Hide()
if (self.interrupted) then
if (self.Settings.HideSparkOnInterrupt) then
self.Spark:Hide()
end
else
self.Spark:Hide()
end
self.percentText:Hide()
local value = self:GetValue()
local _, maxValue = self:GetMinMaxValues()
self:SetValue(self.maxValue or maxValue or 1)
if (self.interrupted) then
if (self.Settings.FillOnInterrupt) then
self:SetValue(self.maxValue or maxValue or 1)
end
else
self:SetValue(self.maxValue or maxValue or 1)
end
self.casting = nil
self.finished = true
@@ -8357,12 +8396,18 @@ detailsFramework.CastFrameFunctions = {
self.channeling = nil
self.interrupted = true
self.finished = true
self:SetValue(self.maxValue or select(2, self:GetMinMaxValues()) or 1)
if (self.Settings.FillOnInterrupt) then
self:SetValue(self.maxValue or select(2, self:GetMinMaxValues()) or 1)
end
if (self.Settings.HideSparkOnInterrupt) then
self.Spark:Hide()
end
local castColor = self:GetCastColor()
self:SetColor (castColor) --SetColor handles with ParseColors()
self.Spark:Hide()
self.percentText:Hide()
self.Text:SetText(INTERRUPTED) --auto locale within the global namespace