diff --git a/Libs/DF/auras.lua b/Libs/DF/auras.lua index 5c39a2f43..1de0b5064 100644 --- a/Libs/DF/auras.lua +++ b/Libs/DF/auras.lua @@ -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" diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 9145b58bf..e4e14a16b 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,5 +1,5 @@ -local dversion = 167 +local dversion = 171 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary (major, minor) @@ -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) @@ -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 @@ -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"}) @@ -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"}) @@ -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) diff --git a/Libs/DF/panel.lua b/Libs/DF/panel.lua index 9ffdc065b..92bbfd603 100644 --- a/Libs/DF/panel.lua +++ b/Libs/DF/panel.lua @@ -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", diff --git a/Libs/DF/textentry.lua b/Libs/DF/textentry.lua index c90b3b27e..5091f2879 100644 --- a/Libs/DF/textentry.lua +++ b/Libs/DF/textentry.lua @@ -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) @@ -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) @@ -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 @@ -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}})