Skip to content

Commit

Permalink
General 8.3 Update
Browse files Browse the repository at this point in the history
- ToC Bump.
- Fixed the '_bit_band' bug.
- Framwork update from 161 to 164.
  • Loading branch information
Tercioo committed Jan 16, 2020
1 parent 88ec99d commit baf7d2f
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Details.toc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Interface: 80205
## Interface: 80300
## Title: Details! Damage Meter
## Notes: Essential tool to impress that chick in your raid.
## SavedVariables: _detalhes_global
Expand Down
45 changes: 42 additions & 3 deletions Libs/DF/fw.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

local dversion = 161
local dversion = 164

local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary (major, minor)
Expand Down Expand Up @@ -942,6 +942,10 @@ end
label:SetPoint (cur_x, cur_y)
tinsert (parent.widget_list, label)
line_widgets_created = line_widgets_created + 1

if (widget_table.id) then
parent.widgetids [widget_table.id] = label
end

elseif (widget_table.type == "select" or widget_table.type == "dropdown") then
local dropdown = DF:NewDropDown (parent, nil, "$parentWidget" .. index, nil, 140, 18, widget_table.values, widget_table.get(), dropdown_template)
Expand All @@ -963,6 +967,10 @@ end
dropdown:SetHook (hookName, hookFunc)
end
end

if (widget_table.id) then
parent.widgetids [widget_table.id] = dropdown
end

local size = label.widget:GetStringWidth() + 140 + 4
if (size > max_x) then
Expand Down Expand Up @@ -996,8 +1004,17 @@ end
end

local label = DF:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name .. (use_two_points and ": " or ""), "GameFontNormal", widget_table.text_template or text_template or 12)
switch:SetPoint ("left", label, "right", 2)
label:SetPoint (cur_x, cur_y)
if (widget_table.boxfirst) then
switch:SetPoint (cur_x, cur_y)
label:SetPoint ("left", switch, "right", 2)
else
label:SetPoint (cur_x, cur_y)
switch:SetPoint ("left", label, "right", 2)
end

if (widget_table.id) then
parent.widgetids [widget_table.id] = switch
end

local size = label.widget:GetStringWidth() + 60 + 4
if (size > max_x) then
Expand Down Expand Up @@ -1037,6 +1054,10 @@ end
slider:SetPoint ("left", label, "right", 2)
label:SetPoint (cur_x, cur_y)

if (widget_table.id) then
parent.widgetids [widget_table.id] = slider
end

local size = label.widget:GetStringWidth() + 140 + 6
if (size > max_x) then
max_x = size
Expand Down Expand Up @@ -1074,6 +1095,10 @@ end
colorpick:SetPoint ("left", label, "right", 2)
label:SetPoint (cur_x, cur_y)

if (widget_table.id) then
parent.widgetids [widget_table.id] = colorpick
end

local size = label.widget:GetStringWidth() + 60 + 4
if (size > max_x) then
max_x = size
Expand Down Expand Up @@ -1102,6 +1127,10 @@ end
button:SetHook (hookName, hookFunc)
end
end

if (widget_table.id) then
parent.widgetids [widget_table.id] = button
end

local size = button:GetWidth() + 4
if (size > max_x) then
Expand Down Expand Up @@ -1133,6 +1162,10 @@ end
textentry:SetHook (hookName, hookFunc)
end
end

if (widget_table.id) then
parent.widgetids [widget_table.id] = textentry
end

local size = label.widget:GetStringWidth() + 60 + 4
if (size > max_x) then
Expand Down Expand Up @@ -1296,9 +1329,15 @@ end
end
end

local get_frame_by_id = function (self, id)
return self.widgetids [id]
end

function DF:SetAsOptionsPanel (frame)
frame.RefreshOptions = refresh_options
frame.widget_list = {}
frame.widgetids = {}
frame.GetWidgetById = get_frame_by_id
end

function DF:CreateOptionsFrame (name, title, template)
Expand Down
103 changes: 93 additions & 10 deletions Libs/DF/panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5009,11 +5009,18 @@ DF.IconRowFunctions = {
cooldownFrame:SetFrameLevel (newIconFrame:GetFrameLevel()+1)

newIconFrame.CountdownText = cooldownFrame:CreateFontString (nil, "overlay", "GameFontNormal")
newIconFrame.CountdownText:SetPoint ("center")
--newIconFrame.CountdownText:SetPoint ("center")
newIconFrame.CountdownText:SetPoint (self.options.text_anchor or "center", newIconFrame, self.options.text_rel_anchor or "center", self.options.text_x_offset or 0, self.options.text_y_offset or 0)
newIconFrame.CountdownText:Hide()

newIconFrame.StackText = cooldownFrame:CreateFontString (nil, "overlay", "GameFontNormal")
--newIconFrame.StackText:SetPoint ("bottomright")
newIconFrame.StackText:SetPoint (self.options.stack_text_anchor or "center", newIconFrame, self.options.stack_text_rel_anchor or "bottomright", self.options.stack_text_x_offset or 0, self.options.stack_text_y_offset or 0)
newIconFrame.StackText:Hide()

newIconFrame.Desc = newIconFrame:CreateFontString (nil, "overlay", "GameFontNormal")
newIconFrame.Desc:SetPoint ("bottom", newIconFrame, "top", 0, 2)
--newIconFrame.Desc:SetPoint ("bottom", newIconFrame, "top", 0, 2)
newIconFrame.Desc:SetPoint(self.options.desc_text_anchor or "bottom", newIconFrame, self.options.desc_text_rel_anchor or "top", self.options.desc_text_x_offset or 0, self.options.desc_text_y_offset or 2)
newIconFrame.Desc:Hide()

newIconFrame.Cooldown = cooldownFrame
Expand Down Expand Up @@ -5051,7 +5058,7 @@ DF.IconRowFunctions = {
return iconFrame
end,

SetIcon = function (self, spellId, borderColor, startTime, duration, forceTexture, descText)
SetIcon = function (self, spellId, borderColor, startTime, duration, forceTexture, descText, count, debuffType, caster, canStealOrPurge)

local spellName, _, spellIcon

Expand Down Expand Up @@ -5090,6 +5097,7 @@ DF.IconRowFunctions = {
formattedTime = floor (formattedTime)
end

iconFrame.CountdownText:SetPoint (self.options.text_anchor or "center", iconFrame, self.options.text_rel_anchor or "center", self.options.text_x_offset or 0, self.options.text_y_offset or 0)
iconFrame.CountdownText:SetText (formattedTime)
iconFrame.Cooldown:SetHideCountdownNumbers (true)
else
Expand All @@ -5104,18 +5112,38 @@ DF.IconRowFunctions = {
iconFrame.Desc:Show()
iconFrame.Desc:SetText (descText.text)
iconFrame.Desc:SetTextColor (DF:ParseColors (descText.text_color or self.options.desc_text_color))
iconFrame.Desc:SetPoint(self.options.desc_text_anchor or "bottom", iconFrame, self.options.desc_text_rel_anchor or "top", self.options.desc_text_x_offset or 0, self.options.desc_text_y_offset or 2)
DF:SetFontSize (iconFrame.Desc, descText.text_size or self.options.desc_text_size)
else
iconFrame.Desc:Hide()
end

if (count and count > 1 and self.options.stack_text) then
iconFrame.StackText:Show()
iconFrame.StackText:SetText (count)
iconFrame.StackText:SetTextColor (DF:ParseColors (self.options.desc_text_color))
iconFrame.StackText:SetPoint (self.options.stack_text_anchor or "center", iconFrame, self.options.stack_text_rel_anchor or "bottomright", self.options.stack_text_x_offset or 0, self.options.stack_text_y_offset or 0)
DF:SetFontSize (iconFrame.StackText, self.options.stack_text_size)
else
iconFrame.StackText:Hide()
end

PixelUtil.SetSize (iconFrame, self.options.icon_width, self.options.icon_height)
iconFrame:Show()

--> update the size of the frame
self:SetWidth ((self.options.left_padding * 2) + (self.options.icon_padding * (self.NextIcon-2)) + (self.options.icon_width * (self.NextIcon - 1)))
self:SetHeight (self.options.icon_height + (self.options.top_padding * 2))

--> make information available
iconFrame.spellId = spellId
iconFrame.startTime = startTime
iconFrame.duration = duration
iconFrame.count = count
iconFrame.debuffType = debuffType
iconFrame.caster = caster
iconFrame.canStealOrPurge = canStealOrPurge

--> show the frame
self:Show()

Expand Down Expand Up @@ -5175,9 +5203,24 @@ local default_icon_row_options = {
texcoord = {.1, .9, .1, .9},
show_text = true,
text_color = {1, 1, 1, 1},
text_anchor = "center",
text_rel_anchor = "center",
text_x_offset = 0,
text_y_offset = 0,
desc_text = true,
desc_text_color = {1, 1, 1, 1},
desc_text_size = 7,
desc_text_anchor = "bottom",
desc_text_rel_anchor = "top",
desc_text_x_offset = 0,
desc_text_y_offset = 2,
stack_text = true,
stack_text_color = {1, 1, 1, 1},
stack_text_size = 10,
stack_text_anchor = "center",
stack_text_rel_anchor = "bottomright",
stack_text_x_offset = 0,
stack_text_y_offset = 0,
left_padding = 1, --distance between right and left
top_padding = 1, --distance between top and bottom
icon_padding = 1, --distance between each icon
Expand Down Expand Up @@ -9276,15 +9319,15 @@ DF.TimeLineBlockFunctions = {
if (isAura) then
block.auraLength:Show()
block.auraLength:SetWidth (pixelPerSecond * isAura)
block:SetWidth (pixelPerSecond * isAura)
block:SetWidth (max (pixelPerSecond * isAura, 16))
else
block.auraLength:Hide()
end

block.background:SetVertexColor (0, 0, 0, 0)
else
block.background:SetVertexColor (unpack (color))
PixelUtil.SetSize (block, width, self:GetHeight())
PixelUtil.SetSize (block, max (width, 16), self:GetHeight())
block.auraLength:Hide()
end
end
Expand Down Expand Up @@ -9521,7 +9564,12 @@ function DF:CreateTimeLineFrame (parent, name, options, timelineOptions)
horizontalSlider:SetMinMaxValues (0, scrollWidth)
horizontalSlider:SetValue (0)
horizontalSlider:SetScript ("OnValueChanged", function (self)
frameCanvas:SetHorizontalScroll (self:GetValue())
local _, maxValue = horizontalSlider:GetMinMaxValues()
local stepValue = ceil (ceil(self:GetValue() * maxValue)/maxValue)
if (stepValue ~= horizontalSlider.currentValue) then
horizontalSlider.currentValue = stepValue
frameCanvas:SetHorizontalScroll (stepValue)
end
end)

frameCanvas.horizontalSlider = horizontalSlider
Expand Down Expand Up @@ -9552,9 +9600,12 @@ function DF:CreateTimeLineFrame (parent, name, options, timelineOptions)
scaleSlider:SetValue (DF:GetRangeValue (frameCanvas.options.scale_min, frameCanvas.options.scale_max, 0.5))

scaleSlider:SetScript ("OnValueChanged", function (self)
local current = scaleSlider:GetValue()
frameCanvas.currentScale = current
frameCanvas:RefreshTimeLine()
local stepValue = ceil(self:GetValue() * 100)/100
if (stepValue ~= frameCanvas.currentScale) then
local current = stepValue
frameCanvas.currentScale = stepValue
frameCanvas:RefreshTimeLine()
end
end)

--create vertical slider
Expand Down Expand Up @@ -9734,6 +9785,38 @@ function DF:ShowErrorMessage (errorMessage, titleText)
DF.ErrorMessagePanel.FlashAnimation:Play()
end

--[[
DF:SetPointOffsets(frame, xOffset, yOffset)
Set an offset into the already existing offset of the frame
If passed xOffset:1 and yOffset:1 and the frame has 1 -1, the new offset will be 2 -2
This function is great to create a 1 knob for distance
@frame: a frame to have the offsets changed
@xOffset: the amount to apply into the x offset
@yOffset: the amount to apply into the y offset
--]]
function DF:SetPointOffsets(frame, xOffset, yOffset)
for i = 1, frame:GetNumPoints() do
local anchor1, anchorTo, anchor2, x, y = frame:GetPoint(i)
x = x or 0
y = y or 0

if (x >= 0) then
xOffset = x + xOffset

elseif (x < 0) then
xOffset = x - xOffset
end

if (y >= 0) then
yOffset = y + yOffset

elseif (y < 0) then
yOffset = y - yOffset
end

frame:SetPoint(anchor1, anchorTo, anchor2, xOffset, yOffset)
end
end

--functionn falsee truee breakk elsea endz
12 changes: 12 additions & 0 deletions Libs/DF/slider.lua
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,17 @@ local DFSliderMetaFunctions = _G [DF.GlobalWidgetControlNames ["slider"]]
end
end

-- clear focus
function DFSliderMetaFunctions:ClearFocus()
local editbox = DFSliderMetaFunctions.editbox_typevalue
if editbox and self.typing_value then
editbox:ClearFocus()
editbox:Hide()
editbox:GetParent().MyObject.typing_value = false
editbox:GetParent().MyObject.value = self.typing_value_started
end
end

-- enabled
function DFSliderMetaFunctions:IsEnabled()
return not _rawget (self, "lockdown")
Expand All @@ -312,6 +323,7 @@ local DFSliderMetaFunctions = _G [DF.GlobalWidgetControlNames ["slider"]]

function DFSliderMetaFunctions:Disable()

self:ClearFocus()
self.slider:Disable()
self.slider.amt:Hide()
self:SetAlpha (.4)
Expand Down
Loading

0 comments on commit baf7d2f

Please sign in to comment.