Mercurial > wow > hansgar_and_franzok_assist
changeset 22:dbd417f413a8
- framework update.
| author | Tercio |
|---|---|
| date | Tue, 08 Sep 2015 13:16:49 -0300 |
| parents | 7fef991992f6 |
| children | 52973d00a183 |
| files | Hansgar_And_Franzok_Assist.lua Libs/DF/button.lua Libs/DF/dropdown.lua Libs/DF/dropdown.xml Libs/DF/fw.lua Libs/DF/label.lua Libs/DF/normal_bar.lua Libs/DF/panel.lua Libs/DF/pictureedit.lua Libs/DF/slider.lua Libs/DF/split_bar.lua Libs/DF/textentry.lua |
| diffstat | 12 files changed, 791 insertions(+), 265 deletions(-) [+] |
line wrap: on
line diff
--- a/Hansgar_And_Franzok_Assist.lua Tue Aug 25 14:09:54 2015 -0300 +++ b/Hansgar_And_Franzok_Assist.lua Tue Sep 08 13:16:49 2015 -0300 @@ -19,7 +19,7 @@ --local f = CreateFrame ("frame", "Hansgar_And_Franzok_Assist", UIParent) local f = DF:Create1PxPanel (_, 155, 166, "Hans & Franz", "Hansgar_And_Franzok_Assist", nil, "top", true) f:SetFrameStrata ("DIALOG") -f.version = "v0.15e" +f.version = "v0.15f" f.Close:SetScript ("OnClick", function (self) if (f.StampersPhase) then
--- a/Libs/DF/button.lua Tue Aug 25 14:09:54 2015 -0300 +++ b/Libs/DF/button.lua Tue Sep 08 13:16:49 2015 -0300 @@ -616,6 +616,14 @@ end end + if (button.MyObject.onenter_backdrop_border_color) then + button:SetBackdropBorderColor (unpack (button.MyObject.onenter_backdrop_border_color)) + end + + if (button.MyObject.onenter_backdrop) then + button:SetBackdropColor (unpack (button.MyObject.onenter_backdrop)) + end + if (button.MyObject.have_tooltip) then GameCooltip2:Preset (2) if (type (button.MyObject.have_tooltip) == "function") then @@ -625,13 +633,6 @@ end GameCooltip2:ShowCooltip (button, "tooltip") end - - local parent = button:GetParent().MyObject - if (parent and parent.type == "panel") then - if (parent.GradientEnabled) then - parent:RunGradient() - end - end end local OnLeave = function (button) @@ -665,18 +666,19 @@ end end + if (button.MyObject.onleave_backdrop_border_color) then + button:SetBackdropBorderColor (unpack (button.MyObject.onleave_backdrop_border_color)) + end + + if (button.MyObject.onleave_backdrop) then + button:SetBackdropColor (unpack (button.MyObject.onleave_backdrop)) + end + if (button.MyObject.have_tooltip) then if (GameCooltip2:GetText (1) == button.MyObject.have_tooltip or type (button.MyObject.have_tooltip) == "function") then GameCooltip2:Hide() end end - - local parent = button:GetParent().MyObject - if (parent and parent.type == "panel") then - if (parent.GradientEnabled) then - parent:RunGradient (false) - end - end end local OnHide = function (button) @@ -862,13 +864,65 @@ end ------------------------------------------------------------------------------------------------------------ + +function ButtonMetaFunctions:SetTemplate (template) + + if (template.width) then + self:SetWidth (template.width) + end + if (template.height) then + self:SetHeight (template.height) + end + + if (template.backdrop) then + self:SetBackdrop (template.backdrop) + end + if (template.backdropcolor) then + local r, g, b, a = DF:ParseColors (template.backdropcolor) + self:SetBackdropColor (r, g, b, a) + self.onleave_backdrop = {r, g, b, a} + end + if (template.backdropbordercolor) then + local r, g, b, a = DF:ParseColors (template.backdropbordercolor) + self:SetBackdropBorderColor (r, g, b, a) + self.onleave_backdrop_border_color = {r, g, b, a} + end + + if (template.onentercolor) then + local r, g, b, a = DF:ParseColors (template.onentercolor) + self.onenter_backdrop = {r, g, b, a} + end + + if (template.onleavecolor) then + local r, g, b, a = DF:ParseColors (template.onleavecolor) + self.onleave_backdrop = {r, g, b, a} + end + + if (template.onenterbordercolor) then + local r, g, b, a = DF:ParseColors (template.onenterbordercolor) + self.onenter_backdrop_border_color = {r, g, b, a} + end + + if (template.onleavebordercolor) then + local r, g, b, a = DF:ParseColors (template.onleavebordercolor) + self.onleave_backdrop_border_color = {r, g, b, a} + end + + if (template.icon) then + local i = template.icon + self:SetIcon (i.texture, i.width, i.height, i.layout, i.texcoord, i.color, i.textdistance, i.leftpadding) + end + +end + +------------------------------------------------------------------------------------------------------------ --> object constructor -function DF:CreateButton (parent, func, w, h, text, param1, param2, texture, member, name, short_method, text_template) - return DF:NewButton (parent, parent, name, member, w, h, func, param1, param2, texture, text, short_method, text_template) +function DF:CreateButton (parent, func, w, h, text, param1, param2, texture, member, name, short_method, button_template, text_template) + return DF:NewButton (parent, parent, name, member, w, h, func, param1, param2, texture, text, short_method, button_template, text_template) end -function DF:NewButton (parent, container, name, member, w, h, func, param1, param2, texture, text, short_method, template) +function DF:NewButton (parent, container, name, member, w, h, func, param1, param2, texture, text, short_method, button_template, text_template) if (not name) then name = "DetailsFrameworkButtonNumber" .. DF.ButtonCounter @@ -884,8 +938,7 @@ if (name:find ("$parent")) then name = name:gsub ("$parent", parent:GetName()) end - - + local ButtonObject = {type = "button", dframework = true} if (member) then @@ -917,7 +970,7 @@ ButtonObject.button = CreateFrame ("button", name, parent, "DetailsFrameworkButtonTemplate") ButtonObject.widget = ButtonObject.button - ButtonObject.button:SetBackdrop ({bgFile = DF.folder .. "background", tileSize = 64, edgeFile = DF.folder .. "border_2", edgeSize = 10, insets = {left = 1, right = 1, top = 1, bottom = 1}}) + --ButtonObject.button:SetBackdrop ({bgFile = DF.folder .. "background", tileSize = 64, edgeFile = DF.folder .. "border_2", edgeSize = 10, insets = {left = 1, right = 1, top = 1, bottom = 1}}) ButtonObject.button:SetBackdropColor (0, 0, 0, 0.4) ButtonObject.button:SetBackdropBorderColor (1, 1, 1, 1) @@ -934,6 +987,7 @@ end end + ButtonObject.button:SetWidth (w or 100) ButtonObject.button:SetHeight (h or 20) ButtonObject.button.MyObject = ButtonObject @@ -977,17 +1031,17 @@ ButtonObject.short_method = short_method - if (template) then - if (template.size) then - DF:SetFontSize (ButtonObject.button.text, template.size) + if (text_template) then + if (text_template.size) then + DF:SetFontSize (ButtonObject.button.text, text_template.size) end - if (template.color) then - local r, g, b, a = DF:ParseColors (template.color) + if (text_template.color) then + local r, g, b, a = DF:ParseColors (text_template.color) ButtonObject.button.text:SetTextColor (r, g, b, a) end - if (template.font) then + if (text_template.font) then local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0") - local font = SharedMedia:Fetch ("font", template.font) + local font = SharedMedia:Fetch ("font", text_template.font) DF:SetFontFace (ButtonObject.button.text, font) end end @@ -1002,6 +1056,10 @@ _setmetatable (ButtonObject, ButtonMetaFunctions) + if (button_template) then + ButtonObject:SetTemplate (button_template) + end + return ButtonObject end @@ -1029,21 +1087,23 @@ ColorPickerFrame:Hide() end -function DF:CreateColorPickButton (parent, name, member, callback, alpha) - return DF:NewColorPickButton (parent, name, member, callback, alpha) +function DF:CreateColorPickButton (parent, name, member, callback, alpha, button_template) + return DF:NewColorPickButton (parent, name, member, callback, alpha, button_template) end -function DF:NewColorPickButton (parent, name, member, callback, alpha) +function DF:NewColorPickButton (parent, name, member, callback, alpha, button_template) --button - local button = DF:NewButton (parent, _, name, member, color_button_width, color_button_height, pickcolor, alpha, "param2") - button:InstallCustomTexture() + local button = DF:NewButton (parent, _, name, member, color_button_width, color_button_height, pickcolor, alpha, "param2", nil, nil, nil, button_template) button.color_callback = callback button.Cancel = colorpick_cancel button.SetColor = set_colorpick_color - button:SetBackdrop ({edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]], edgeSize = 6, - bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]], insets = {left = 0, right = 0, top = 0, bottom = 0}}) + if (not button_template) then + button:InstallCustomTexture() + button:SetBackdrop ({edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]], edgeSize = 6, + bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]], insets = {left = 0, right = 0, top = 0, bottom = 0}}) + end --textura do fundo local background = DF:NewImage (button, nil, color_button_width, color_button_height, nil, nil, nil, "$parentBck")
--- a/Libs/DF/dropdown.lua Tue Aug 25 14:09:54 2015 -0300 +++ b/Libs/DF/dropdown.lua Tue Sep 08 13:16:49 2015 -0300 @@ -329,7 +329,11 @@ end function DropDownMetaFunctions:NoOptionSelected() + if (self.no_options) then + return + end self.label:SetText (self.empty_text or "no option selected") + self.label:SetPoint ("left", self.icon, "right", 2, 0) self.label:SetTextColor (1, 1, 1, 0.4) if (self.empty_icon) then self.icon:SetTexture (self.empty_icon) @@ -348,6 +352,7 @@ self:SetAlpha (0.5) self.no_options = true self.label:SetText ("no options") + self.label:SetPoint ("left", self.icon, "right", 2, 0) self.label:SetTextColor (1, 1, 1, 0.4) self.icon:SetTexture ([[Interface\CHARACTERFRAME\UI-Player-PlayTimeUnhealthy]]) self.icon:SetTexCoord (0, 1, 0, 1) @@ -444,6 +449,7 @@ self.icon:SetVertexColor (1, 1, 1, 1) end + self.icon:SetSize (self:GetHeight()-2, self:GetHeight()-2) else self.label:SetPoint ("left", self.label:GetParent(), "left", 4, 0) end @@ -482,6 +488,7 @@ --> set the value of selected option in main object button.object.myvalue = button.table.value + button.object.myvaluelabel = button.table.label end function DropDownMetaFunctions:Open() @@ -563,6 +570,7 @@ local i = 1 local showing = 0 local currentText = button.text:GetText() or "" + local currentIndex if (object.OnMouseDownHook) then local interrupt = object.OnMouseDownHook (button, buttontype, menu, scrollFrame, scrollChild, selectedTexture) @@ -571,7 +579,7 @@ end end - for _, _table in ipairs (menu) do + for tindex, _table in ipairs (menu) do local show = isOptionVisible (_table) @@ -639,7 +647,10 @@ end selectedTexture:Show() - selectedTexture:SetVertexColor (1, 1, 1, .3); + selectedTexture:SetVertexColor (1, 1, 1, .3) + selectedTexture:SetTexCoord (0, 29/32, 5/32, 27/32) + + currentIndex = tindex currentText = nil end @@ -719,7 +730,12 @@ end end - object.scroll:SetValue (0) + if (object.myvaluelabel and currentIndex and scrollFrame.slider:IsShown()) then + object.scroll:SetValue (max ((currentIndex*20) - 80, 0)) + else + object.scroll:SetValue (0) + end + object:Open() else @@ -749,6 +765,10 @@ self:SetBackdropColor (.2, .2, .2, .2) end + if (self.MyObject.onenter_backdrop_border_color) then + self:SetBackdropBorderColor (unpack (self.MyObject.onenter_backdrop_border_color)) + end + self.arrowTexture2:Show() if (self.MyObject.have_tooltip) then @@ -763,14 +783,7 @@ GameCooltip2:SetOwner (self) GameCooltip2:ShowCooltip() end - - local parent = self:GetParent().MyObject - if (parent and parent.type == "panel") then - if (parent.GradientEnabled) then - parent:RunGradient() - end - end - + end function DetailsFrameworkDropDownOnLeave (self) @@ -787,18 +800,15 @@ self:SetBackdropColor (1, 1, 1, .5) end + if (self.MyObject.onleave_backdrop_border_color) then + self:SetBackdropBorderColor (unpack (self.MyObject.onleave_backdrop_border_color)) + end + self.arrowTexture2:Hide() if (self.MyObject.have_tooltip) then GameCooltip2:ShowMe (false) end - - local parent = self:GetParent().MyObject - if (parent and parent.type == "panel") then - if (parent.GradientEnabled) then - parent:RunGradient (false) - end - end end function DetailsFrameworkDropDownOnSizeChanged (self, w, h) @@ -836,13 +846,59 @@ end ------------------------------------------------------------------------------------------------------------ +function DropDownMetaFunctions:SetTemplate (template) + + if (template.width) then + self:SetWidth (template.width) + end + if (template.height) then + self:SetHeight (template.height) + end + + if (template.backdrop) then + self:SetBackdrop (template.backdrop) + end + if (template.backdropcolor) then + local r, g, b, a = DF:ParseColors (template.backdropcolor) + self:SetBackdropColor (r, g, b, a) + self.onleave_backdrop = {r, g, b, a} + end + if (template.backdropbordercolor) then + local r, g, b, a = DF:ParseColors (template.backdropbordercolor) + self:SetBackdropBorderColor (r, g, b, a) + self.onleave_backdrop_border_color = {r, g, b, a} + end + + if (template.onentercolor) then + local r, g, b, a = DF:ParseColors (template.onentercolor) + self.onenter_backdrop = {r, g, b, a} + end + + if (template.onleavecolor) then + local r, g, b, a = DF:ParseColors (template.onleavecolor) + self.onleave_backdrop = {r, g, b, a} + end + + if (template.onenterbordercolor) then + local r, g, b, a = DF:ParseColors (template.onenterbordercolor) + self.onenter_backdrop_border_color = {r, g, b, a} + end + + if (template.onleavebordercolor) then + local r, g, b, a = DF:ParseColors (template.onleavebordercolor) + self.onleave_backdrop_border_color = {r, g, b, a} + end + +end + +------------------------------------------------------------------------------------------------------------ --> object constructor -function DF:CreateDropDown (parent, func, default, w, h, member, name) - return DF:NewDropDown (parent, parent, name, member, w, h, func, default) +function DF:CreateDropDown (parent, func, default, w, h, member, name, template) + return DF:NewDropDown (parent, parent, name, member, w, h, func, default, template) end -function DF:NewDropDown (parent, container, name, member, w, h, func, default) +function DF:NewDropDown (parent, container, name, member, w, h, func, default, template) if (not name) then name = "DetailsFrameworkDropDownNumber" .. DF.DropDownCounter @@ -959,6 +1015,10 @@ end end + if (template) then + DropDownObject:SetTemplate (template) + end + return DropDownObject end \ No newline at end of file
--- a/Libs/DF/dropdown.xml Tue Aug 25 14:09:54 2015 -0300 +++ b/Libs/DF/dropdown.xml Tue Sep 08 13:16:49 2015 -0300 @@ -119,8 +119,8 @@ <Layers> <Layer level="BACKGROUND"> - <!-- selected texture --> - <Texture name="$parent_SelectedTexture" parentKey="selected" hidden="true" file="Interface\AddOns\Details\framework\cooltip_background"> + <!-- selected texture // we don't know where the file is it --> + <Texture name="$parent_SelectedTexture" parentKey="selected" hidden="true" file="Interface\RAIDFRAME\Raid-Bar-Hp-Fill"> <Size x="150" y="16" /> <!--<TexCoords left="0.31250000" right="0.78515625" top="0.00390625" bottom="0.36328125"/>--> <Anchors>
--- a/Libs/DF/fw.lua Tue Aug 25 14:09:54 2015 -0300 +++ b/Libs/DF/fw.lua Tue Sep 08 13:16:49 2015 -0300 @@ -1,5 +1,5 @@ -local major, minor = "DetailsFramework-1.0", 5 +local major, minor = "DetailsFramework-1.0", 8 local DF, oldminor = LibStub:NewLibrary (major, minor) if (not DF) then @@ -23,6 +23,8 @@ DF.SliderCounter = 1 DF.SplitBarCounter = 1 +LibStub:GetLibrary("AceTimer-3.0"):Embed (DF) + do local path = string.match (debugstack (1, 1, 0), "AddOns\\(.+)fw.lua") if (path) then @@ -80,12 +82,20 @@ "Create1PxPanel", "CreateFeedbackButton", "CreateOptionsFrame", + "NewSpecialLuaEditorEntry", "ShowPromptPanel", + "ShowTextPromptPanel", "www_icons", + "GetTemplate", + "GetFrameworkFolder", } DF.table = {} +function DF:GetFrameworkFolder() + return DF.folder +end + function DF.table.reverse (t) local new = {} local index = 1 @@ -115,7 +125,7 @@ if (type (value) == "table") then t1 [key] = t1 [key] or {} DF.table.deploy (t1 [key], t2 [key]) - elseif (not t1 [key]) then + elseif (t1 [key] == nil) then t1 [key] = value end end @@ -567,7 +577,11 @@ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- --> menus - function DF:BuildMenu (parent, menu, x_offset, y_offset, height, use_two_points) + function DF:BuildMenu (parent, menu, x_offset, y_offset, height, use_two_points, text_template, dropdown_template, switch_template, switch_is_box, slider_template, button_template) + + if (not parent.widget_list) then + DF:SetAsOptionsPanel (parent) + end local cur_x = x_offset local cur_y = y_offset @@ -582,18 +596,18 @@ -- do nothing elseif (widget_table.type == "label" or widget_table.type == "text") then - local label = DF:CreateLabel (parent, widget_table.get() or widget_table.text, widget_table.text_template or widget_table.size, widget_table.color, widget_table.font, nil, "$parentWidget" .. index, "overlay") + local label = DF:CreateLabel (parent, widget_table.get() or widget_table.text, widget_table.text_template or text_template or widget_table.size, widget_table.color, widget_table.font, nil, "$parentWidget" .. index, "overlay") label._get = widget_table.get label.widget_type = "label" label:SetPoint (cur_x, cur_y) tinsert (parent.widget_list, label) 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()) + local dropdown = DF:NewDropDown (parent, nil, "$parentWidget" .. index, nil, 140, 18, widget_table.values, widget_table.get(), dropdown_template) dropdown.tooltip = widget_table.desc dropdown._get = widget_table.get dropdown.widget_type = "select" - local label = DF:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name .. (use_two_points and ": " or ""), "GameFontNormal", widget_table.text_template or 12) + 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) dropdown:SetPoint ("left", label, "right", 2) label:SetPoint (cur_x, cur_y) @@ -605,13 +619,17 @@ tinsert (parent.widget_list, dropdown) elseif (widget_table.type == "toggle" or widget_table.type == "switch") then - local switch = DF:NewSwitch (parent, nil, "$parentWidget" .. index, nil, 60, 20, nil, nil, widget_table.get()) + local switch = DF:NewSwitch (parent, nil, "$parentWidget" .. index, nil, 60, 20, nil, nil, widget_table.get(), nil, nil, nil, nil, switch_template) switch.tooltip = widget_table.desc switch._get = widget_table.get switch.widget_type = "toggle" switch.OnSwitch = widget_table.set - local label = DF:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name .. (use_two_points and ": " or ""), "GameFontNormal", widget_table.text_template or 12) + if (switch_is_box) then + switch:SetAsCheckBox() + 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) @@ -624,13 +642,13 @@ elseif (widget_table.type == "range" or widget_table.type == "slider") then local is_decimanls = widget_table.usedecimals - local slider = DF:NewSlider (parent, nil, "$parentWidget" .. index, nil, 140, 20, widget_table.min, widget_table.max, widget_table.step, widget_table.get(), is_decimanls) + local slider = DF:NewSlider (parent, nil, "$parentWidget" .. index, nil, 140, 20, widget_table.min, widget_table.max, widget_table.step, widget_table.get(), is_decimanls, nil, nil, slider_template) slider.tooltip = widget_table.desc slider._get = widget_table.get slider.widget_type = "range" slider:SetHook ("OnValueChange", widget_table.set) - local label = DF:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name .. (use_two_points and ": " or ""), "GameFontNormal", widget_table.text_template or 12) + 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) slider:SetPoint ("left", label, "right", 2) label:SetPoint (cur_x, cur_y) @@ -642,7 +660,7 @@ tinsert (parent.widget_list, slider) elseif (widget_table.type == "color" or widget_table.type == "color") then - local colorpick = DF:NewColorPickButton (parent, "$parentWidget" .. index, nil, widget_table.set) + local colorpick = DF:NewColorPickButton (parent, "$parentWidget" .. index, nil, widget_table.set, nil, button_template) colorpick.tooltip = widget_table.desc colorpick._get = widget_table.get colorpick.widget_type = "color" @@ -654,7 +672,7 @@ colorpick:SetColor (default_value, g, b, a) end - local label = DF:NewLabel (parent, nil, "$parentLabel" .. index, nil, widget_table.name .. (use_two_points and ": " or ""), "GameFontNormal", widget_table.text_template or 12) + 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) colorpick:SetPoint ("left", label, "right", 2) label:SetPoint (cur_x, cur_y) @@ -667,8 +685,11 @@ elseif (widget_table.type == "execute" or widget_table.type == "button") then - local button = DF:NewButton (parent, nil, "$parentWidget", nil, 120, 18, widget_table.func, widget_table.param1, widget_table.param2, nil, widget_table.name) - button:InstallCustomTexture() + local button = DF:NewButton (parent, nil, "$parentWidget" .. index, nil, 120, 18, widget_table.func, widget_table.param1, widget_table.param2, nil, widget_table.name, nil, button_template) + if (not button_template) then + button:InstallCustomTexture() + end + button:SetPoint (cur_x, cur_y) button.tooltip = widget_table.desc button.widget_type = "execute" @@ -899,4 +920,79 @@ return options_frame end - end \ No newline at end of file + end + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +--> templates + +DF.font_templates = {} +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.dropdown_templates = {} +DF.dropdown_templates ["OPTIONS_DROPDOWN_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}, +} + +DF.switch_templates = {} +DF.switch_templates ["OPTIONS_CHECKBOX_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}, + width = 18, + height = 18, + enabled_backdropcolor = {1, 1, 1, .5}, + disabled_backdropcolor = {1, 1, 1, .2}, + onenterbordercolor = {1, 1, 1, 1}, +} +DF.switch_templates ["OPTIONS_CHECKBOX_BRIGHT_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}, + width = 18, + height = 18, + enabled_backdropcolor = {1, 1, 1, .5}, + disabled_backdropcolor = {1, 1, 1, .5}, + onenterbordercolor = {1, 1, 1, 1}, +} + +DF.button_templates = {} +DF.button_templates ["OPTIONS_BUTTON_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}, +} + +DF.slider_templates = {} +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}, + thumbtexture = [[Interface\Tooltips\UI-Tooltip-Background]], + thumbwidth = 16, + thumbheight = 14, + thumbcolor = {0, 0, 0, 0.5}, +} + +function DF:GetTemplate (type, template_name) + local template_table + if (type == "font") then + template_table = DF.font_templates + elseif (type == "dropdown") then + template_table = DF.dropdown_templates + elseif (type == "button") then + template_table = DF.button_templates + elseif (type == "switch") then + template_table = DF.switch_templates + elseif (type == "slider") then + template_table = DF.slider_templates + end + return template_table [template_name] +end +
--- a/Libs/DF/label.lua Tue Aug 25 14:09:54 2015 -0300 +++ b/Libs/DF/label.lua Tue Sep 08 13:16:49 2015 -0300 @@ -219,6 +219,23 @@ end ------------------------------------------------------------------------------------------------------------ + + function LabelMetaFunctions:SetTemplate (template) + if (template.size) then + DF:SetFontSize (self.label, template.size) + end + if (template.color) then + local r, g, b, a = DF:ParseColors (template.color) + self:SetTextColor (r, g, b, a) + end + if (template.font) then + local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0") + local font = SharedMedia:Fetch ("font", template.font) + DF:SetFontFace (self.label, font) + end + end + +------------------------------------------------------------------------------------------------------------ --> object constructor function DF:CreateLabel (parent, text, size, color, font, member, name, layer) return DF:NewLabel (parent, nil, name, member, text, font, size, color, layer) @@ -287,22 +304,6 @@ if (size and type (size) == "number") then DF:SetFontSize (LabelObject.label, size) - - elseif (size and type (size) == "table") then - local template = size - - if (template.size) then - DF:SetFontSize (LabelObject.label, template.size) - end - if (template.color) then - local r, g, b, a = DF:ParseColors (template.color) - LabelObject.label:SetTextColor (r, g, b, a) - end - if (template.font) then - local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0") - local font = SharedMedia:Fetch ("font", template.font) - DF:SetFontFace (LabelObject.label, font) - end end @@ -310,6 +311,10 @@ LabelObject.label:SetJustifyH ("LEFT") setmetatable (LabelObject, LabelMetaFunctions) + + if (size and type (size) == "table") then + LabelObject:SetTemplate (size) + end return LabelObject end \ No newline at end of file
--- a/Libs/DF/normal_bar.lua Tue Aug 25 14:09:54 2015 -0300 +++ b/Libs/DF/normal_bar.lua Tue Sep 08 13:16:49 2015 -0300 @@ -196,6 +196,7 @@ _object.statusbar:SetStatusBarColor (_value1, _value2, _value3, _value4) _object._texture.original_colors = {_value1, _value2, _value3, _value4} + _object.timer_texture:SetVertexColor (_value1, _value2, _value3, _value4) return _object._texture:SetVertexColor (_value1, _value2, _value3, _value4) end --> icon @@ -216,8 +217,10 @@ if (type (_value) == "table") then local _value1, _value2 = _unpack (_value) _object._texture:SetTexture (_value1) + _object.timer_texture:SetTexture (_value1) if (_value2) then _object._texture:SetTexCoord (_unpack (_value2)) + _object.timer_texture:SetTexCoord (_unpack (_value2)) end else if (_value:find ("\\")) then @@ -226,8 +229,10 @@ local file = SharedMedia:Fetch ("statusbar", _value) if (file) then _object._texture:SetTexture (file) + _object.timer_texture:SetTexture (file) else _object._texture:SetTexture (_value) + _object.timer_texture:SetTexture (_value) end end end @@ -541,6 +546,7 @@ self.div_timer:Show() self.background:Show() + self:Show() self.timer = true
--- a/Libs/DF/panel.lua Tue Aug 25 14:09:54 2015 -0300 +++ b/Libs/DF/panel.lua Tue Sep 08 13:16:49 2015 -0300 @@ -259,11 +259,9 @@ function PanelMetaFunctions:SetBackdropColor (color, arg2, arg3, arg4) if (arg2) then self.frame:SetBackdropColor (color, arg2, arg3, arg4 or 1) - self.frame.Gradient.OnLeave = {color, arg2, arg3, arg4 or 1} else local _value1, _value2, _value3, _value4 = DF:ParseColors (color) self.frame:SetBackdropColor (_value1, _value2, _value3, _value4) - self.frame.Gradient.OnLeave = {_value1, _value2, _value3, _value4} end end @@ -276,16 +274,6 @@ self.frame:SetBackdropBorderColor (_value1, _value2, _value3, _value4) end --- gradient colors - function PanelMetaFunctions:SetGradient (FadeType, color) - local _value1, _value2, _value3, _value4 = DF:ParseColors (color) - if (FadeType == "OnEnter") then - self.frame.Gradient.OnEnter = {_value1, _value2, _value3, _value4} - elseif (FadeType == "OnLeave") then - self.frame.Gradient.OnLeave = {_value1, _value2, _value3, _value4} - end - end - -- tooltip function PanelMetaFunctions:SetTooltip (tooltip) if (tooltip) then @@ -322,14 +310,6 @@ self.widget:SetFrameStrata (strata) end end - --- enable and disable gradients - function PanelMetaFunctions:DisableGradient() - self.GradientEnabled = false - end - function PanelMetaFunctions:EnableGradient() - self.GradientEnabled = true - end --> hooks function PanelMetaFunctions:SetHook (hookType, func) @@ -489,7 +469,6 @@ PanelObject.OnMouseUpHook = nil --> misc PanelObject.is_locked = true - PanelObject.GradientEnabled = true PanelObject.container = container PanelObject.rightButtonClose = false @@ -588,6 +567,7 @@ local cur_width = 0 local row_width = self._width / rows_shown + local sindex = 1 wipe (self._anchors) @@ -765,6 +745,8 @@ end end + self.current_header = updated_rows + self:AlignRows() end @@ -798,7 +780,8 @@ local create_panel_button = function (self, row) row.button_total = row.button_total + 1 local button = DF:NewButton (row, nil, "$parentButton" .. row.button_total, "button" .. row.button_total, 120, 20) - button:InstallCustomTexture() + --, nil, nil, nil, nil, nil, nil, DF:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE") + --button:InstallCustomTexture() --> create icon and the text local icon = DF:NewImage (button, nil, 20, 20) @@ -848,7 +831,28 @@ local drop_header_function = function (self) wipe (self.rows) end + +local fillpanel_update_size = function (self, elapsed) + local panel = self.MyObject + + panel._width = panel:GetWidth() + panel._height = panel:GetHeight() + + panel:UpdateRowAmount() + if (panel.current_header) then + update_rows (panel, panel.current_header) + end + panel:Refresh() + + self:SetScript ("OnUpdate", nil) +end + -- ~fillpanel + --alias +function DF:CreateFillPanel (parent, rows, w, h, total_lines, fill_row, autowidth, options, member, name) + return DF:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_row, autowidth, options) +end + function DF:NewFillPanel (parent, rows, name, member, w, h, total_lines, fill_row, autowidth, options) local panel = DF:NewPanel (parent, parent, name, member, w, h) @@ -877,6 +881,10 @@ panel._totalfunc = total_lines panel._autowidth = autowidth + panel:SetScript ("OnSizeChanged", function() + panel:SetScript ("OnUpdate", fillpanel_update_size) + end) + for index, t in ipairs (rows) do panel.AddRow (panel, t) end @@ -920,11 +928,7 @@ button = button + 1 buttonwidget.index = real_index - local func = function() - t.func (real_index, index) - panel:Refresh() - end - buttonwidget:SetClickFunction (func) + if (type (results [index]) == "table") then if (results [index].text) then @@ -936,9 +940,24 @@ end if (results [index].func) then - buttonwidget:SetClickFunction (results [index].func, real_index, results [index].value) + local func = function() + t.func (real_index, results [index].value) + panel:Refresh() + end + buttonwidget:SetClickFunction (func) + else + local func = function() + t.func (real_index, index) + panel:Refresh() + end + buttonwidget:SetClickFunction (func) end else + local func = function() + t.func (real_index, index) + panel:Refresh() + end + buttonwidget:SetClickFunction (func) buttonwidget:SetText (results [index]) end @@ -969,6 +988,10 @@ end function panel:Refresh() + if (type (panel._totalfunc) == "boolean") then + --> not yet initialized + return + end local filled_lines = panel._totalfunc (panel) local scroll_total_lines = #panel.scrollframe.lines local line_height = options.rowheight @@ -987,43 +1010,46 @@ scrollframe.lines = {} --create lines - local size = options.rowheight - local amount = math.floor (((h-21) / size)) - - for i = 1, amount do - local row = CreateFrame ("frame", panel:GetName() .. "Row_" .. i, panel.widget) - row:SetSize (1, size) - row.color = {1, 1, 1, .2} - - row:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]]}) - - if (i%2 == 0) then - row:SetBackdropColor (.5, .5, .5, 0.2) - else - row:SetBackdropColor (1, 1, 1, 0.00) + function panel:UpdateRowAmount() + local size = options.rowheight + local amount = math.floor (((panel._height-21) / size)) + + for i = #scrollframe.lines+1, amount do + local row = CreateFrame ("frame", panel:GetName() .. "Row_" .. i, panel.widget) + row:SetSize (1, size) + row.color = {1, 1, 1, .2} + + row:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]]}) + + if (i%2 == 0) then + row:SetBackdropColor (.5, .5, .5, 0.2) + else + row:SetBackdropColor (1, 1, 1, 0.00) + end + + row:SetPoint ("topleft", scrollframe, "topleft", 0, (i-1) * size * -1) + row:SetPoint ("topright", scrollframe, "topright", 0, (i-1) * size * -1) + tinsert (scrollframe.lines, row) + + row.text_available = {} + row.text_inuse = {} + row.text_total = 0 + + row.entry_available = {} + row.entry_inuse = {} + row.entry_total = 0 + + row.button_available = {} + row.button_inuse = {} + row.button_total = 0 + + row.icon_available = {} + row.icon_inuse = {} + row.icon_total = 0 end - - row:SetPoint ("topleft", scrollframe, "topleft", 0, (i-1) * size * -1) - row:SetPoint ("topright", scrollframe, "topright", 0, (i-1) * size * -1) - tinsert (scrollframe.lines, row) - - row.text_available = {} - row.text_inuse = {} - row.text_total = 0 - - row.entry_available = {} - row.entry_inuse = {} - row.entry_total = 0 - - row.button_available = {} - row.button_inuse = {} - row.button_total = 0 - - row.icon_available = {} - row.icon_inuse = {} - row.icon_total = 0 end - + panel:UpdateRowAmount() + panel.AlignRows (panel) return panel @@ -1437,9 +1463,17 @@ end end local simple_panel_settitle = function (self, title) - self.title:SetText (title) + self.Title:SetText (title) end +local simple_panel_close_click = function (self) + self:GetParent():GetParent():Hide() +end + +local SimplePanel_frame_backdrop = {edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true} +local SimplePanel_frame_backdrop_color = {0, 0, 0, 0.9} +local SimplePanel_frame_backdrop_border_color = {0, 0, 0, 1} + function DF:CreateSimplePanel (parent, w, h, title, name) if (not name) then @@ -1456,22 +1490,42 @@ 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)) tinsert (UISpecialFrames, name) - + + local title_bar = CreateFrame ("frame", name .. "TitleBar", f) + 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) + + local close = CreateFrame ("button", name and name .. "CloseButton", title_bar) + close:SetSize (16, 16) + close:SetNormalTexture (DF.folder .. "icons") + close:SetHighlightTexture (DF.folder .. "icons") + close:SetPushedTexture (DF.folder .. "icons") + close:GetNormalTexture():SetTexCoord (0, 16/128, 0, 1) + close:GetHighlightTexture():SetTexCoord (0, 16/128, 0, 1) + close:GetPushedTexture():SetTexCoord (0, 16/128, 0, 1) + close:SetAlpha (0.7) + close:SetScript ("OnClick", simple_panel_close_click) + f.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 + + f.Title:SetPoint ("center", title_bar, "center") + f.Close:SetPoint ("right", title_bar, "right", -2, 0) + f:SetScript ("OnMouseDown", simple_panel_mouse_down) f:SetScript ("OnMouseUp", simple_panel_mouse_up) - local bg = f:CreateTexture (nil, "background") - bg:SetAllPoints (f) - bg:SetTexture (DF.folder .. "background") - - local close = CreateFrame ("button", name .. "Close", f, "UIPanelCloseButton") - close:SetSize (32, 32) - close:SetPoint ("topright", f, "topright", 0, -12) - - f.title = DF:CreateLabel (f, title or "", 12, nil, "GameFontNormal") - f.title:SetPoint ("top", f, "top", 0, -22) - f.SetTitle = simple_panel_settitle simple_panel_counter = simple_panel_counter + 1 @@ -1678,18 +1732,23 @@ if (not DF.prompt_panel) then local f = CreateFrame ("frame", "DetailsFrameworkPrompt", UIParent) - f:SetSize (400, 100) + f:SetSize (400, 65) f:SetFrameStrata ("DIALOG") - f:SetPoint ("center", UIParent, "center", 0, -300) + f:SetPoint ("center", UIParent, "center", 0, 300) f:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) f:SetBackdropColor (0, 0, 0, 0.8) f:SetBackdropBorderColor (0, 0, 0, 1) - local button_true = DF:CreateButton (f, nil, 60, 20, "") + local prompt = f:CreateFontString (nil, "overlay", "GameFontNormal") + prompt:SetPoint ("top", f, "top", 0, -15) + prompt:SetJustifyH ("center") + f.prompt = prompt + + local button_true = DF:CreateButton (f, nil, 60, 20, "Yes") button_true:SetPoint ("bottomleft", f, "bottomleft", 5, 5) f.button_true = button_true - local button_false = DF:CreateButton (f, nil, 60, 20, "") + local button_false = DF:CreateButton (f, nil, 60, 20, "No") button_false:SetPoint ("bottomright", f, "bottomright", -5, 5) f.button_false = button_false @@ -1700,6 +1759,7 @@ if (not okey) then print ("error:", errormessage) end + f:Hide() end end) @@ -1710,6 +1770,7 @@ if (not okey) then print ("error:", errormessage) end + f:Hide() end end) @@ -1719,11 +1780,67 @@ assert (type (func_true) == "function" and type (func_false) == "function", "ShowPromptPanel expects two functions.") + DF.promtp_panel.prompt:SetText (message) DF.promtp_panel.button_true.true_function = func_true DF.promtp_panel.button_false.false_function = func_false DF.promtp_panel:Show() end + + +function DF:ShowTextPromptPanel (message, callback) + + if (not DF.text_prompt_panel) then + + local f = CreateFrame ("frame", "DetailsFrameworkPrompt", UIParent) + f:SetSize (400, 100) + f:SetFrameStrata ("DIALOG") + f:SetPoint ("center", UIParent, "center", 0, 300) + f:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) + f:SetBackdropColor (0, 0, 0, 0.8) + f:SetBackdropBorderColor (0, 0, 0, 1) + + local prompt = f:CreateFontString (nil, "overlay", "GameFontNormal") + prompt:SetPoint ("top", f, "top", 0, -15) + prompt:SetJustifyH ("center") + f.prompt = prompt + + local button_true = DF:CreateButton (f, nil, 60, 20, "Okey") + button_true:SetPoint ("bottomleft", f, "bottomleft", 10, 5) + f.button_true = button_true + + local button_false = DF:CreateButton (f, function() f.textbox:ClearFocus(); f:Hide() end, 60, 20, "Cancel") + button_false:SetPoint ("bottomright", f, "bottomright", -10, 5) + f.button_false = button_false + + local textbox = DF:CreateTextEntry (f, function()end, 380, 20, "textbox", nil, nil, nil, nil) + textbox:SetPoint ("topleft", f, "topleft", 10, -45) + + button_true:SetClickFunction (function() + local my_func = button_true.true_function + if (my_func) then + local okey, errormessage = pcall (my_func, textbox:GetText()) + textbox:ClearFocus() + if (not okey) then + print ("error:", errormessage) + end + f:Hide() + end + end) + + f:Hide() + DF.text_prompt_panel = f + end + + DF.text_prompt_panel:Show() + + DF.text_prompt_panel.prompt:SetText (message) + DF.text_prompt_panel.button_true.true_function = callback + DF.text_prompt_panel.textbox:SetText ("") + DF.text_prompt_panel.textbox:SetFocus (true) + +end + ------------------------------------------------------------------------------------------------------------------------------------------------ --> options button -- ~options function DF:CreateOptionsButton (parent, callback, name) @@ -2126,18 +2243,22 @@ end local chart_panel_set_scale = function (self, amt, func, text) + if (type (amt) ~= "number") then return end local piece = amt / 1000 / 8 + if (not text or text == "") then + text = amt > 1000000 and "M" or amt > 1000 and "K" + end for i = 1, 8 do if (func) then self ["dpsamt" .. math.abs (i-9)]:SetText ( func (piece*i) .. (text or "")) else if (piece*i > 1) then - self ["dpsamt" .. math.abs (i-9)]:SetText ( floor (piece*i) .. (text or "")) + self ["dpsamt" .. math.abs (i-9)]:SetText ( format ("%.1f", piece*i) .. (text or "")) else self ["dpsamt" .. math.abs (i-9)]:SetText ( format ("%.3f", piece*i) .. (text or "")) end @@ -2264,7 +2385,7 @@ button:SetScript ("OnClick", function() chart_panel_enable_line (self, thisbox) end) - button:SetPoint ("center", box, "center") + button:SetPoint ("center", box.widget or box, "center") thisbox.button = button @@ -2440,7 +2561,7 @@ local f = self self = self.Graphic - + local _data = {} local max_value = graphicData.max_value local amount = #graphicData
--- a/Libs/DF/pictureedit.lua Tue Aug 25 14:09:54 2015 -0300 +++ b/Libs/DF/pictureedit.lua Tue Sep 08 13:16:49 2015 -0300 @@ -12,7 +12,6 @@ window:SetMovable (true) tinsert (UISpecialFrames, "DetailsFrameworkImageEdit") window:SetFrameStrata ("TOOLTIP") - window:SetMaxResize (266, 226) window.hooks = {} @@ -39,9 +38,9 @@ window:StopMovingOrSizing() end) - local background_frame_image = background_frame:CreateTexture (nil, "background") - background_frame_image:SetAllPoints (background_frame) - background_frame_image:SetTexture ([[Interface\AddOns\Details\images\welcome]]) + background_frame:SetBackdrop ({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1, bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) + background_frame:SetBackdropColor (0, 0, 0, 0.9) + background_frame:SetBackdropBorderColor (0, 0, 0, 1) local haveHFlip = false local haveVFlip = false @@ -72,7 +71,7 @@ topSlider:SetHook ("OnValueChange", function (_, _, value) topCoordTexture.image:SetHeight (window.frame:GetHeight()/100*value) if (window.callback_func) then - window.accept (true) + window.accept (nil, nil, true) end end) @@ -105,7 +104,7 @@ value = math.abs (value-100) bottomCoordTexture.image:SetHeight (math.max (window.frame:GetHeight()/100*value, 1)) if (window.callback_func) then - window.accept (true) + window.accept (nil, nil, true) end end) @@ -136,7 +135,7 @@ leftSlider:SetHook ("OnValueChange", function (_, _, value) leftCoordTexture.image:SetWidth (window.frame:GetWidth()/100*value) if (window.callback_func) then - window.accept (true) + window.accept (nil, nil, true) end end) @@ -168,7 +167,7 @@ value = math.abs (value-100) rightCoordTexture.image:SetWidth (math.max (window.frame:GetWidth()/100*value, 1)) if (window.callback_func) then - window.accept (true) + window.accept (nil, nil, true) end end) @@ -191,7 +190,7 @@ local alphaFrame local originalColor = {0.9999, 0.8196, 0} - local enableTexEdit = function (side, _, button) + local enableTexEdit = function (button, b, side) if (alphaFrameShown) then alphaFrame:Hide() @@ -245,12 +244,12 @@ if (default) then edit_texture:SetVertexColor (unpack (default)) if (window.callback_func) then - window.accept (true) + window.accept (nil, nil, true) end else edit_texture:SetVertexColor (ColorPickerFrame:GetColorRGB()) if (window.callback_func) then - window.accept (true) + window.accept (nil, nil, true) end end end @@ -301,7 +300,7 @@ --leftSlider.backdrop = nil --leftSlider.fractional = true - local alpha = function(_, _, button) + local alpha = function (button) if (ColorPickerFrame:IsShown()) then ColorPickerFrame:Hide() @@ -331,7 +330,7 @@ alphaSlider:SetHook ("OnValueChange", function (_, _, value) edit_texture:SetAlpha (value/100) if (window.callback_func) then - window.accept (true) + window.accept (nil, nil, true) end end) @@ -375,23 +374,23 @@ topCoordTexture:SetHeight (window.frame:GetHeight()/100*topSlider:GetValue()) if (window.callback_func) then - window.accept (true) + window.accept (nil, nil, true) end end) --> flip - local flip = function (side) + local flip = function (button, b, side) if (side == 1) then haveHFlip = not haveHFlip if (window.callback_func) then - window.accept (true) + window.accept (nil, nil, true) end elseif (side == 2) then haveVFlip = not haveVFlip if (window.callback_func) then - window.accept (true) + window.accept (nil, nil, true) end end end @@ -405,7 +404,7 @@ flipButtonV:InstallCustomTexture() --> accept - window.accept = function (keep_editing) + window.accept = function (self, b, keep_editing) if (not keep_editing) then buttonsBackground:Hide() @@ -470,6 +469,7 @@ window.callback_func = callback window.extra_param = extraParam buttonsBackground:Show() + buttonsBackground.widget:SetBackdrop (nil) table.wipe (window.hooks) end @@ -505,7 +505,7 @@ end if (window.callback_func) then - window.accept (true) + window.accept (nil, nil, true) end end
--- a/Libs/DF/slider.lua Tue Aug 25 14:09:54 2015 -0300 +++ b/Libs/DF/slider.lua Tue Sep 08 13:16:49 2015 -0300 @@ -340,6 +340,10 @@ slider.thumb:SetAlpha (1) + if (slider.MyObject.onenter_backdrop_border_color) then + slider:SetBackdropBorderColor (unpack (slider.MyObject.onenter_backdrop_border_color)) + end + if (slider.MyObject.have_tooltip and slider.MyObject.have_tooltip ~= "Right Click to Type the Value") then GameCooltip2:Preset (2) GameCooltip2:AddLine (slider.MyObject.have_tooltip) @@ -350,14 +354,6 @@ GameCooltip2:AddIcon ([[Interface\TUTORIALFRAME\UI-TUTORIAL-FRAME]], 1, 1, 16, 16, 0.015625, 0.15671875, 0.640625, 0.798828125) GameCooltip2:ShowCooltip (slider, "tooltip") end - - local parent = slider:GetParent().MyObject - if (parent and parent.type == "panel") then - if (parent.GradientEnabled) then - parent:RunGradient() - end - end - end local OnLeave = function (slider) @@ -377,17 +373,14 @@ slider.thumb:SetAlpha (.7) + if (slider.MyObject.onleave_backdrop_border_color) then + slider:SetBackdropBorderColor (unpack (slider.MyObject.onleave_backdrop_border_color)) + end + if (slider.MyObject.have_tooltip) then GameCooltip2:ShowMe (false) end - local parent = slider:GetParent().MyObject - if (parent and parent.type == "panel") then - if (parent.GradientEnabled) then - parent:RunGradient (false) - end - end - end @@ -740,23 +733,35 @@ end if (_rawget (slider, "value")) then --actived - _rawset (slider, "value", false) - slider._text:SetText (slider._ltext) - slider._thumb:ClearAllPoints() - slider:SetBackdropColor (1, 0, 0, 0.4) - slider._thumb:SetPoint ("left", slider.widget, "left") - + if (slider.backdrop_disabledcolor) then + slider:SetBackdropColor (unpack (slider.backdrop_disabledcolor)) + else + slider:SetBackdropColor (1, 0, 0, 0.4) + end + + if (slider.is_checkbox) then + slider.checked_texture:Hide() + else + slider._text:SetText (slider._ltext) + slider._thumb:ClearAllPoints() + slider._thumb:SetPoint ("left", slider.widget, "left") + end else - _rawset (slider, "value", true) - slider._text:SetText (slider._rtext) - slider._thumb:ClearAllPoints() - - slider:SetBackdropColor (0, 0, 1, 0.4) - slider._thumb:SetPoint ("right", slider.widget, "right") - + if (slider.backdrop_enabledcolor) then + slider:SetBackdropColor (unpack (slider.backdrop_enabledcolor)) + else + slider:SetBackdropColor (0, 0, 1, 0.4) + end + if (slider.is_checkbox) then + slider.checked_texture:Show() + else + slider._text:SetText (slider._rtext) + slider._thumb:ClearAllPoints() + slider._thumb:SetPoint ("right", slider.widget, "right") + end end if (slider.OnSwitch and not forced_value) then @@ -800,8 +805,13 @@ self.lock_texture:SetPoint ("center", self._thumb, "center") end + if (self.is_checkbox) then + self.checked_texture:Hide() + else + self._text:Hide() + end + self.lock_texture:Show() - self._text:Hide() self:SetAlpha (.4) _rawset (self, "lockdown", true) end @@ -812,21 +822,60 @@ self.lock_texture:SetPoint ("center", self._thumb, "center") end + if (self.is_checkbox) then + if (_rawget (self, "value")) then + self.checked_texture:Show() + else + self.checked_texture:Hide() + end + else + self._text:Show() + end + self.lock_texture:Hide() - self._text:Show() self:SetAlpha (1) return _rawset (self, "lockdown", false) end -function DF:CreateSwitch (parent, on_switch, default_value, w, h, ltext, rtext, member, name, color_inverted, switch_func, return_func, with_label) - local switch, label = DF:NewSwitch (parent, parent, name, member, w or 60, h or 20, ltext, rtext, default_value, color_inverted, switch_func, return_func, with_label) +local set_as_checkbok = function (self) + local checked = self:CreateTexture (nil, "overlay") + checked:SetTexture ([[Interface\Buttons\UI-CheckBox-Check]]) + checked:SetPoint ("center", self.button, "center", -1, -1) + local size_pct = self:GetWidth()/32 + checked:SetSize (32*size_pct, 32*size_pct) + self.checked_texture = checked + + self._thumb:Hide() + self._text:Hide() + + self.is_checkbox = true + + if (_rawget (self, "value")) then + self.checked_texture:Show() + if (self.backdrop_enabledcolor) then + self:SetBackdropColor (unpack (self.backdrop_enabledcolor)) + else + self:SetBackdropColor (0, 0, 1, 0.4) + end + else + self.checked_texture:Hide() + if (self.backdrop_disabledcolor) then + self:SetBackdropColor (unpack (self.backdrop_disabledcolor)) + else + self:SetBackdropColor (0, 0, 1, 0.4) + end + end +end + +function DF:CreateSwitch (parent, on_switch, default_value, w, h, ltext, rtext, member, name, color_inverted, switch_func, return_func, with_label, switch_template, label_template) + local switch, label = DF:NewSwitch (parent, parent, name, member, w or 60, h or 20, ltext, rtext, default_value, color_inverted, switch_func, return_func, with_label, switch_template, label_template) if (on_switch) then switch.OnSwitch = on_switch end return switch, label end -function DF:NewSwitch (parent, container, name, member, w, h, ltext, rtext, default_value, color_inverted, switch_func, return_func, with_label) +function DF:NewSwitch (parent, container, name, member, w, h, ltext, rtext, default_value, color_inverted, switch_func, return_func, with_label, switch_template, label_template) --> early checks if (not name) then @@ -857,6 +906,8 @@ slider.SetFixedParameter = switch_set_fixparameter slider.Disable = switch_disable slider.Enable = switch_enable + slider.SetAsCheckBox = set_as_checkbok + slider.SetTemplate = SliderMetaFunctions.SetTemplate if (member) then parent [member] = slider @@ -889,22 +940,96 @@ slider.isSwitch = true + if (switch_template) then + slider:SetTemplate (switch_template) + end + if (with_label) then local label = DF:CreateLabel (slider.widget, with_label, nil, nil, nil, "label", nil, "overlay") label.text = with_label slider.widget:SetPoint ("left", label.widget, "right", 2, 0) with_label = label + + if (label_template) then + label:SetTemplate (label_template) + end end return slider, with_label end -function DF:CreateSlider (parent, w, h, min, max, step, defaultv, isDecemal, member, name, with_label) - local slider, label = DF:NewSlider (parent, parent, name, member, w, h, min, max, step, defaultv, isDecemal, false, with_label) +function SliderMetaFunctions:SetTemplate (template) + + --slider e switch + if (template.width) then + self:SetWidth (template.width) + end + if (template.height) then + self:SetHeight (template.height) + end + + if (template.backdrop) then + self:SetBackdrop (template.backdrop) + end + if (template.backdropcolor) then + local r, g, b, a = DF:ParseColors (template.backdropcolor) + self:SetBackdropColor (r, g, b, a) + end + if (template.backdropbordercolor) then + local r, g, b, a = DF:ParseColors (template.backdropbordercolor) + self:SetBackdropBorderColor (r, g, b, a) + self.onleave_backdrop_border_color = {r, g, b, a} + end + + if (template.onenterbordercolor) then + local r, g, b, a = DF:ParseColors (template.onenterbordercolor) + self.onenter_backdrop_border_color = {r, g, b, a} + end + + if (template.onleavebordercolor) then + local r, g, b, a = DF:ParseColors (template.onleavebordercolor) + self.onleave_backdrop_border_color = {r, g, b, a} + end + + if (template.thumbtexture) then + if (self.thumb) then + self.thumb:SetTexture (template.thumbtexture) + end + end + if (template.thumbwidth) then + if (self.thumb) then + self.thumb:SetWidth (template.thumbwidth) + end + end + if (template.thumbheight) then + if (self.thumb) then + self.thumb:SetHeight (template.thumbheight) + end + end + if (template.thumbcolor) then + if (self.thumb) then + local r, g, b, a = DF:ParseColors (template.thumbcolor) + self.thumb:SetVertexColor (r, g, b, a) + end + end + + --switch only + if (template.enabled_backdropcolor) then + local r, g, b, a = DF:ParseColors (template.enabled_backdropcolor) + self.backdrop_enabledcolor = {r, g, b, a} + end + if (template.disabled_backdropcolor) then + local r, g, b, a = DF:ParseColors (template.disabled_backdropcolor) + self.backdrop_disabledcolor = {r, g, b, a} + end +end + +function DF:CreateSlider (parent, w, h, min, max, step, defaultv, isDecemal, member, name, with_label, slider_template, label_template) + local slider, label = DF:NewSlider (parent, parent, name, member, w, h, min, max, step, defaultv, isDecemal, false, with_label, slider_template, label_template) return slider, label end -function DF:NewSlider (parent, container, name, member, w, h, min, max, step, defaultv, isDecemal, isSwitch, with_label) +function DF:NewSlider (parent, container, name, member, w, h, min, max, step, defaultv, isDecemal, isSwitch, with_label, slider_template, label_template) --> early checks if (not name) then @@ -1033,6 +1158,14 @@ label.text = with_label SliderObject.slider:SetPoint ("left", label.widget, "right", 2, 0) with_label = label + + if (label_template) then + label:SetTemplate (label_template) + end + end + + if (slider_template) then + SliderObject:SetTemplate (slider_template) end return SliderObject, with_label
--- a/Libs/DF/split_bar.lua Tue Aug 25 14:09:54 2015 -0300 +++ b/Libs/DF/split_bar.lua Tue Sep 08 13:16:49 2015 -0300 @@ -444,8 +444,6 @@ end end - local oc = frame.MyObject.texture.original_colors --original colors - DF:GradientEffect ( frame.MyObject.texture, "texture", oc[1], oc[2], oc[3], oc[4], oc[1]+0.2, oc[2]+0.2, oc[3]+0.2, oc[4], .2) frame.MyObject.div:SetPoint ("left", frame, "left", frame:GetValue() * (frame:GetWidth()/100) - 18, 0) if (frame.MyObject.have_tooltip) then @@ -453,13 +451,6 @@ GameCooltip2:AddLine (frame.MyObject.have_tooltip) GameCooltip2:ShowCooltip (frame, "tooltip") end - - local parent = frame:GetParent().MyObject - if (parent and parent.type == "panel") then - if (parent.GradientEnabled) then - parent:RunGradient() - end - end end local OnLeave = function (frame) @@ -469,21 +460,10 @@ return end end - - local oc = frame.MyObject.texture.original_colors --original colors - local r, g, b, a = frame.MyObject.texture:GetVertexColor() - DF:GradientEffect ( frame.MyObject.texture, "texture", r, g, b, a, oc[1], oc[2], oc[3], oc[4], .2) - + if (frame.MyObject.have_tooltip) then DF.popup:ShowMe (false) end - - local parent = frame:GetParent().MyObject - if (parent and parent.type == "panel") then - if (parent.GradientEnabled) then - parent:RunGradient (false) - end - end end local OnHide = function (frame)
--- a/Libs/DF/textentry.lua Tue Aug 25 14:09:54 2015 -0300 +++ b/Libs/DF/textentry.lua Tue Sep 08 13:16:49 2015 -0300 @@ -259,6 +259,9 @@ self.editbox:SetBackdropBorderColor (unpack (self.enabled_border_color)) self.editbox:SetBackdropColor (unpack (self.enabled_backdrop_color)) self.editbox:SetTextColor (unpack (self.enabled_text_color)) + if (self.editbox.borderframe) then + self.editbox.borderframe:SetBackdropColor (unpack (self.editbox.borderframe.onleave_backdrop)) + end end end @@ -273,6 +276,10 @@ self.editbox:SetBackdropBorderColor (.5, .5, .5, .5) self.editbox:SetBackdropColor (.5, .5, .5, .5) self.editbox:SetTextColor (.5, .5, .5, .5) + + if (self.editbox.borderframe) then + self.editbox.borderframe:SetBackdropColor (.5, .5, .5, .5) + end end end @@ -300,13 +307,6 @@ textentry:SetBackdropBorderColor (1, 1, 1, 1) end - local parent = textentry:GetParent().MyObject - if (parent and parent.type == "panel") then - if (parent.GradientEnabled) then - parent:RunGradient() - end - end - end local OnLeave = function (textentry) @@ -326,13 +326,7 @@ if (textentry:IsEnabled()) then textentry:SetBackdropBorderColor (unpack (textentry.current_bordercolor)) end - - local parent = textentry:GetParent().MyObject - if (parent and parent.type == "panel") then - if (parent.GradientEnabled) then - parent:RunGradient (false) - end - end + end local OnHide = function (textentry) @@ -473,13 +467,42 @@ end ------------------------------------------------------------------------------------------------------------ + +function TextEntryMetaFunctions:SetTemplate (template) + if (template.width) then + self:SetWidth (template.width) + end + if (template.height) then + self:SetHeight (template.height) + end + + if (template.backdrop) then + self:SetBackdrop (template.backdrop) + end + if (template.backdropcolor) then + local r, g, b, a = DF:ParseColors (template.backdropcolor) + self:SetBackdropColor (r, g, b, a) + self.onleave_backdrop = {r, g, b, a} + end + if (template.backdropbordercolor) then + local r, g, b, a = DF:ParseColors (template.backdropbordercolor) + self:SetBackdropBorderColor (r, g, b, a) + self.editbox.current_bordercolor[1] = r + self.editbox.current_bordercolor[2] = g + self.editbox.current_bordercolor[3] = b + self.editbox.current_bordercolor[4] = a + self.onleave_backdrop_border_color = {r, g, b, a} + end +end + +------------------------------------------------------------------------------------------------------------ --> object constructor -function DF:CreateTextEntry (parent, func, w, h, member, name) - return DF:NewTextEntry (parent, parent, name, member, w, h, func) +function DF:CreateTextEntry (parent, func, w, h, member, name, with_label, entry_template, label_template) + return DF:NewTextEntry (parent, parent, name, member, w, h, func, nil, nil, nil, with_label, entry_template, label_template) end -function DF:NewTextEntry (parent, container, name, member, w, h, func, param1, param2, space) +function DF:NewTextEntry (parent, container, name, member, w, h, func, param1, param2, space, with_label, entry_template, label_template) if (not name) then name = "DetailsFrameworkTextEntryNumber" .. DF.TextEntryCounter @@ -571,6 +594,8 @@ TextEntryObject.enabled_border_color = {TextEntryObject.editbox:GetBackdropBorderColor()} TextEntryObject.enabled_backdrop_color = {TextEntryObject.editbox:GetBackdropColor()} TextEntryObject.enabled_text_color = {TextEntryObject.editbox:GetTextColor()} + TextEntryObject.onleave_backdrop = {TextEntryObject.editbox:GetBackdropColor()} + TextEntryObject.onleave_backdrop_border_color = {TextEntryObject.editbox:GetBackdropBorderColor()} TextEntryObject.func = func TextEntryObject.param1 = param1 @@ -599,8 +624,31 @@ _setmetatable (TextEntryObject, TextEntryMetaFunctions) - return TextEntryObject + if (with_label) then + local label = DF:CreateLabel (TextEntryObject.editbox, with_label, nil, nil, nil, "label", nil, "overlay") + label.text = with_label + TextEntryObject.editbox:SetPoint ("left", label.widget, "right", 2, 0) + if (label_template) then + label:SetTemplate (label_template) + end + with_label = label + end + if (entry_template) then + TextEntryObject:SetTemplate (entry_template) + end + + return TextEntryObject, with_label + +end + +function DF:NewSpellEntry (parent, func, w, h, param1, param2, member, name) + local editbox = DF:NewTextEntry (parent, parent, name, member, w, h, func, param1, param2) + + editbox:SetHook ("OnEditFocusGained", SpellEntryOnEditFocusGained) + editbox:SetHook ("OnTextChanged", SpellEntryOnTextChanged) + + return editbox end local function_gettext = function (self) @@ -649,17 +697,32 @@ borderframe.ClearFocus = function_clearfocus borderframe.SetFocus = function_setfocus + borderframe.Enable = TextEntryMetaFunctions.Enable + borderframe.Disable = TextEntryMetaFunctions.Disable + + borderframe.SetTemplate = TextEntryMetaFunctions.SetTemplate + 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}}) + + scrollframe.editbox.current_bordercolor = {1, 1, 1, 0.7} + borderframe:SetBackdropBorderColor (1, 1, 1, 0.7) borderframe:SetBackdropColor (0.090195, 0.090195, 0.188234, 1) - borderframe:SetBackdropBorderColor (1, 1, 1, 1) + + borderframe.enabled_border_color = {borderframe:GetBackdropBorderColor()} + borderframe.enabled_backdrop_color = {borderframe:GetBackdropColor()} + borderframe.enabled_text_color = {scrollframe.editbox:GetTextColor()} + + borderframe.onleave_backdrop = {scrollframe.editbox:GetBackdropColor()} + borderframe.onleave_backdrop_border_color = {scrollframe.editbox:GetBackdropBorderColor()} borderframe.scroll = scrollframe borderframe.editbox = scrollframe.editbox + borderframe.editbox.borderframe = borderframe return borderframe end \ No newline at end of file
