Skip to content

Commit

Permalink
Framework update
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Feb 26, 2020
1 parent 5d371f4 commit ff5cccb
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 38 deletions.
2 changes: 1 addition & 1 deletion Libs/DF/auras.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ local GetSpellInfo = GetSpellInfo
local lower = string.lower
local GetSpellBookItemInfo = GetSpellBookItemInfo

local CONST_MAX_SPELLS = 300000
local CONST_MAX_SPELLS = 400000

function DF:GetAuraByName (unit, spellName, isDebuff)
isDebuff = isDebuff and "HARMFUL|PLAYER"
Expand Down
62 changes: 44 additions & 18 deletions Libs/DF/fw.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

local dversion = 167
local dversion = 171

local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary (major, minor)
Expand Down Expand Up @@ -134,6 +134,8 @@ DF.SplitBarCounter = DF.SplitBarCounter or init_counter
DF.FRAMELEVEL_OVERLAY = 750
DF.FRAMELEVEL_BACKGROUND = 150

--/dump DetailsFramework:PrintVersion()

DF.FrameWorkVersion = tostring (dversion)
function DF:PrintVersion()
print ("Details! Framework Version:", DF.FrameWorkVersion)
Expand Down Expand Up @@ -317,6 +319,22 @@ function DF.table.copy (t1, t2)
return t1
end

--> copy from table2 to table1 overwriting values but do not copy data that cannot be compressed
function DF.table.copytocompress (t1, t2)
for key, value in pairs (t2) do
print (key, value)
if (key ~= "__index" and type(value) ~= "function") then
if (type (value) == "table") then
t1 [key] = t1 [key] or {}
DF.table.copytocompress (t1 [key], t2 [key])
else
t1 [key] = value
end
end
end
return t1
end

--> copy values that does exist on table2 but not on table1
function DF.table.deploy (t1, t2)
for key, value in pairs (t2) do
Expand Down Expand Up @@ -2546,28 +2564,31 @@ function DF:ReskinSlider (slider, heightOffset)

else
--up button

local offset = 1 --space between the scrollbox and the scrollar

do
local normalTexture = slider.ScrollBar.ScrollUpButton.Normal
normalTexture:SetTexture ([[Interface\Buttons\Arrow-Up-Up]])
normalTexture:SetTexCoord (0, 1, .2, 1)

normalTexture:SetPoint ("topleft", slider.ScrollBar.ScrollUpButton, "topleft", 1, 0)
normalTexture:SetPoint ("bottomright", slider.ScrollBar.ScrollUpButton, "bottomright", 1, 0)
normalTexture:SetPoint ("topleft", slider.ScrollBar.ScrollUpButton, "topleft", offset, 0)
normalTexture:SetPoint ("bottomright", slider.ScrollBar.ScrollUpButton, "bottomright", offset, 0)

local pushedTexture = slider.ScrollBar.ScrollUpButton.Pushed
pushedTexture:SetTexture ([[Interface\Buttons\Arrow-Up-Down]])
pushedTexture:SetTexCoord (0, 1, .2, 1)

pushedTexture:SetPoint ("topleft", slider.ScrollBar.ScrollUpButton, "topleft", 1, 0)
pushedTexture:SetPoint ("bottomright", slider.ScrollBar.ScrollUpButton, "bottomright", 1, 0)
pushedTexture:SetPoint ("topleft", slider.ScrollBar.ScrollUpButton, "topleft", offset, 0)
pushedTexture:SetPoint ("bottomright", slider.ScrollBar.ScrollUpButton, "bottomright", offset, 0)

local disabledTexture = slider.ScrollBar.ScrollUpButton.Disabled
disabledTexture:SetTexture ([[Interface\Buttons\Arrow-Up-Disabled]])
disabledTexture:SetTexCoord (0, 1, .2, 1)
disabledTexture:SetAlpha (.5)

disabledTexture:SetPoint ("topleft", slider.ScrollBar.ScrollUpButton, "topleft", 1, 0)
disabledTexture:SetPoint ("bottomright", slider.ScrollBar.ScrollUpButton, "bottomright", 1, 0)
disabledTexture:SetPoint ("topleft", slider.ScrollBar.ScrollUpButton, "topleft", offset, 0)
disabledTexture:SetPoint ("bottomright", slider.ScrollBar.ScrollUpButton, "bottomright", offset, 0)

slider.ScrollBar.ScrollUpButton:SetSize (16, 16)
slider.ScrollBar.ScrollUpButton:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = "Interface\\Tooltips\\UI-Tooltip-Background"})
Expand All @@ -2584,23 +2605,23 @@ function DF:ReskinSlider (slider, heightOffset)
normalTexture:SetTexture ([[Interface\Buttons\Arrow-Down-Up]])
normalTexture:SetTexCoord (0, 1, 0, .8)

normalTexture:SetPoint ("topleft", slider.ScrollBar.ScrollDownButton, "topleft", 1, -4)
normalTexture:SetPoint ("bottomright", slider.ScrollBar.ScrollDownButton, "bottomright", 1, -4)
normalTexture:SetPoint ("topleft", slider.ScrollBar.ScrollDownButton, "topleft", offset, -4)
normalTexture:SetPoint ("bottomright", slider.ScrollBar.ScrollDownButton, "bottomright", offset, -4)

local pushedTexture = slider.ScrollBar.ScrollDownButton.Pushed
pushedTexture:SetTexture ([[Interface\Buttons\Arrow-Down-Down]])
pushedTexture:SetTexCoord (0, 1, 0, .8)

pushedTexture:SetPoint ("topleft", slider.ScrollBar.ScrollDownButton, "topleft", 1, -4)
pushedTexture:SetPoint ("bottomright", slider.ScrollBar.ScrollDownButton, "bottomright", 1, -4)
pushedTexture:SetPoint ("topleft", slider.ScrollBar.ScrollDownButton, "topleft", offset, -4)
pushedTexture:SetPoint ("bottomright", slider.ScrollBar.ScrollDownButton, "bottomright", offset, -4)

local disabledTexture = slider.ScrollBar.ScrollDownButton.Disabled
disabledTexture:SetTexture ([[Interface\Buttons\Arrow-Down-Disabled]])
disabledTexture:SetTexCoord (0, 1, 0, .8)
disabledTexture:SetAlpha (.5)

disabledTexture:SetPoint ("topleft", slider.ScrollBar.ScrollDownButton, "topleft", 1, -4)
disabledTexture:SetPoint ("bottomright", slider.ScrollBar.ScrollDownButton, "bottomright", 1, -4)
disabledTexture:SetPoint ("topleft", slider.ScrollBar.ScrollDownButton, "topleft", offset, -4)
disabledTexture:SetPoint ("bottomright", slider.ScrollBar.ScrollDownButton, "bottomright", offset, -4)

slider.ScrollBar.ScrollDownButton:SetSize (16, 16)
slider.ScrollBar.ScrollDownButton:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = "Interface\\Tooltips\\UI-Tooltip-Background"})
Expand All @@ -2611,11 +2632,16 @@ function DF:ReskinSlider (slider, heightOffset)
--slider.ScrollBar.ScrollDownButton:SetPoint ("top", slider.ScrollBar, "bottom", 0, 0)
end

--

slider.ScrollBar:SetPoint ("TOPLEFT", slider, "TOPRIGHT", 6, -16)
slider.ScrollBar:SetPoint ("BOTTOMLEFT", slider, "BOTTOMRIGHT", 6, 16 + (heightOffset and heightOffset*-1 or 0))

--if the parent has a editbox, this is a code editor
if (slider:GetParent().editbox) then
slider.ScrollBar:SetPoint ("TOPLEFT", slider, "TOPRIGHT", 12 + offset, -6)
slider.ScrollBar:SetPoint ("BOTTOMLEFT", slider, "BOTTOMRIGHT", 12 + offset, 6 + (heightOffset and heightOffset*-1 or 0))

else
slider.ScrollBar:SetPoint ("TOPLEFT", slider, "TOPRIGHT", 6, -16)
slider.ScrollBar:SetPoint ("BOTTOMLEFT", slider, "BOTTOMRIGHT", 6, 16 + (heightOffset and heightOffset*-1 or 0))
end

slider.ScrollBar.ThumbTexture:SetColorTexture (.5, .5, .5, .3)
slider.ScrollBar.ThumbTexture:SetSize (12, 8)

Expand Down
8 changes: 4 additions & 4 deletions Libs/DF/panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8506,10 +8506,10 @@ DF.BorderFunctions = {
end,

SetBorderThickness = function (self, newThickness)
PixelUtil.SetWidth (f.leftBorder, newThickness, newThickness)
PixelUtil.SetWidth (f.rightBorder, newThickness, newThickness)
PixelUtil.SetHeight (f.topBorder, newThickness, newThickness)
PixelUtil.SetHeight (f.bottomBorder, newThickness, newThickness)
PixelUtil.SetWidth (self.leftBorder, newThickness, newThickness)
PixelUtil.SetWidth (self.rightBorder, newThickness, newThickness)
PixelUtil.SetHeight (self.topBorder, newThickness, newThickness)
PixelUtil.SetHeight (self.bottomBorder, newThickness, newThickness)
end,

WidgetType = "border",
Expand Down
88 changes: 73 additions & 15 deletions Libs/DF/textentry.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1072,8 +1072,15 @@ function TextEntryMetaFunctions:SetAsAutoComplete (poolName, poolTable, shouldOp

end

function DF:NewSpecialLuaEditorEntry (parent, w, h, member, name, nointent)

local set_speciallua_editor_font_size = function(borderFrame, newSize)
local file, size, flags = borderFrame.editbox:GetFont()
borderFrame.editbox:SetFont (file, newSize, flags)

borderFrame.editboxlines:SetFont (file, newSize, flags)
end

function DF:NewSpecialLuaEditorEntry (parent, w, h, member, name, nointent, showLineNumbers)

if (name:find ("$parent")) then
local parentName = DF.GetParentName (parent)
name = name:gsub ("$parent", parentName)
Expand All @@ -1087,32 +1094,82 @@ function DF:NewSpecialLuaEditorEntry (parent, w, h, member, name, nointent)
end

local scrollframe = CreateFrame ("ScrollFrame", name, borderframe, "UIPanelScrollFrameTemplate")
scrollframe:SetSize (232, 20)
local scrollframeNumberLines = CreateFrame ("ScrollFrame", name .. "NumberLines", borderframe, "UIPanelScrollFrameTemplate")

scrollframe.editbox = CreateFrame ("editbox", "$parentEditBox", scrollframe)
scrollframe.editbox:SetMultiLine (true)
scrollframe.editbox:SetAutoFocus (false)
scrollframe.editbox:SetSize (232, 20)
scrollframe.editbox:SetAllPoints()

scrollframe.editbox:SetScript ("OnCursorChanged", _G.ScrollingEdit_OnCursorChanged)
scrollframe.editbox:SetScript ("OnEscapePressed", _G.EditBox_ClearFocus)
scrollframe.editbox:SetFontObject ("GameFontHighlightSmall")

scrollframe:SetScrollChild (scrollframe.editbox)

--letters="255"
--countInvisibleLetters="true"

--line number
if (showLineNumbers) then
scrollframeNumberLines.editbox = CreateFrame ("editbox", "$parentLineNumbers", scrollframeNumberLines)
scrollframeNumberLines.editbox:SetMultiLine (true)
scrollframeNumberLines.editbox:SetAutoFocus (false)
scrollframeNumberLines.editbox:SetFontObject ("GameFontHighlightSmall")
scrollframeNumberLines.editbox:SetJustifyH ("left")
scrollframeNumberLines.editbox:SetJustifyV ("top")
scrollframeNumberLines.editbox:SetTextColor(.3, .3, .3, .5)
scrollframeNumberLines.editbox:SetPoint ("topleft", borderframe, "topleft", 10, -10)
scrollframeNumberLines.editbox:SetPoint ("bottomright", borderframe, "bottomright", -30, 10)

scrollframeNumberLines:SetScrollChild (scrollframeNumberLines.editbox)

for i = 1, 1000 do
scrollframeNumberLines.editbox:Insert (i .. "\n")
end

--place the lua code field 20 pixels to the right to make run to the lines scroll
scrollframe:SetPoint ("topleft", borderframe, "topleft", 30, -10)
scrollframe:SetPoint ("bottomright", borderframe, "bottomright", -10, 10)

--when the lua code field scrolls, make the lua field scroll too
scrollframe:SetScript ("OnVerticalScroll", function (self, offset)
scrollframeNumberLines:SetVerticalScroll(scrollframe:GetVerticalScroll())
scrollframeNumberLines.ScrollBar:Hide()
end)

--place the number lines scroll in the begining of the editing code space
scrollframeNumberLines:SetPoint ("topleft", borderframe, "topleft", 10, -10)
scrollframeNumberLines:SetPoint ("bottomright", borderframe, "bottomright", -10, 10)

scrollframeNumberLines.editbox:SetJustifyH ("left")
scrollframeNumberLines.editbox:SetJustifyV ("top")

scrollframeNumberLines:SetScript ("OnSizeChanged", function (self)
scrollframeNumberLines.editbox:SetSize (self:GetSize())
scrollframeNumberLines.ScrollBar:Hide()
end)

scrollframeNumberLines.ScrollBar:HookScript("OnShow", function(self)
self:Hide()
end)

borderframe.scrollnumberlines = scrollframeNumberLines
borderframe.editboxlines = scrollframeNumberLines.editbox
borderframe.editboxlines.borderframe = borderframe

scrollframeNumberLines.ScrollBar:Hide()
scrollframeNumberLines:SetBackdrop(nil)
scrollframeNumberLines.editbox:SetBackdrop(nil)

else
scrollframe:SetPoint ("topleft", borderframe, "topleft", 10, -10)
scrollframe:SetPoint ("bottomright", borderframe, "bottomright", -10, 10)
scrollframeNumberLines:SetPoint ("topleft", borderframe, "topleft", 10, -10)
scrollframeNumberLines:SetPoint ("bottomright", borderframe, "bottomright", -10, 10)
scrollframeNumberLines:Hide()
end
--16:40
borderframe.SetAsAutoComplete = TextEntryMetaFunctions.SetAsAutoComplete

scrollframe:SetScript ("OnSizeChanged", function (self)
scrollframe.editbox:SetSize (self:GetSize())
end)

scrollframe:SetPoint ("topleft", borderframe, "topleft", 10, -10)
scrollframe:SetPoint ("bottomright", borderframe, "bottomright", -30, 10)

scrollframe.editbox:SetMultiLine (true)
scrollframe.editbox:SetJustifyH ("left")
scrollframe.editbox:SetJustifyV ("top")
scrollframe.editbox:SetMaxBytes (1024000)
Expand All @@ -1122,6 +1179,7 @@ function DF:NewSpecialLuaEditorEntry (parent, w, h, member, name, nointent)
borderframe.SetText = function_settext
borderframe.ClearFocus = function_clearfocus
borderframe.SetFocus = function_setfocus
borderframe.SetTextSize = set_speciallua_editor_font_size

borderframe.Enable = TextEntryMetaFunctions.Enable
borderframe.Disable = TextEntryMetaFunctions.Disable
Expand All @@ -1131,7 +1189,7 @@ function DF:NewSpecialLuaEditorEntry (parent, w, h, member, name, nointent)
if (not nointent) then
IndentationLib.enable (scrollframe.editbox, nil, 4)
end

borderframe:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]],
tile = 1, tileSize = 16, edgeSize = 16, insets = {left = 5, right = 5, top = 5, bottom = 5}})

Expand Down

0 comments on commit ff5cccb

Please sign in to comment.