Mercurial > wow > hansgar_and_franzok_assist
changeset 29:5da06cb420d4
- framework update.
| author | Tercioo |
|---|---|
| date | Sat, 02 Jan 2016 13:33:05 -0200 |
| parents | 7523376ecaa3 |
| children | d1963bd45219 |
| files | Hansgar_And_Franzok_Assist.lua Libs/DF/button.lua Libs/DF/cooltip.lua Libs/DF/dropdown.lua Libs/DF/fw.lua Libs/DF/label.lua Libs/DF/normal_bar.lua Libs/DF/panel.lua Libs/DF/picture.lua Libs/DF/slider.lua Libs/DF/split_bar.lua Libs/DF/textentry.lua |
| diffstat | 12 files changed, 153 insertions(+), 66 deletions(-) [+] |
line wrap: on
line diff
--- a/Hansgar_And_Franzok_Assist.lua Fri Dec 18 15:15:50 2015 -0200 +++ b/Hansgar_And_Franzok_Assist.lua Sat Jan 02 13:33:05 2016 -0200 @@ -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.16a" +f.version = "v0.16b" f.Close:SetScript ("OnClick", function (self) if (f.StampersPhase) then
--- a/Libs/DF/button.lua Fri Dec 18 15:15:50 2015 -0200 +++ b/Libs/DF/button.lua Sat Jan 02 13:33:05 2016 -0200 @@ -385,14 +385,14 @@ end -- icon - function ButtonMetaFunctions:SetIcon (texture, width, height, layout, texcoord, overlay, textdistance, leftpadding) + function ButtonMetaFunctions:SetIcon (texture, width, height, layout, texcoord, overlay, textdistance, leftpadding, textheight) if (not self.icon) then self.icon = self:CreateTexture (nil, "artwork") self.icon:SetSize (self.height*0.8, self.height*0.8) self.icon:SetPoint ("left", self.widget, "left", 4 + (leftpadding or 0), 0) self.icon.leftpadding = leftpadding or 0 self.widget.text:ClearAllPoints() - self.widget.text:SetPoint ("left", self.icon, "right", textdistance or 2, 0) + self.widget.text:SetPoint ("left", self.icon, "right", textdistance or 2, 0 + (textheight or 0)) end self.icon:SetTexture (texture) @@ -932,7 +932,7 @@ DF.ButtonCounter = DF.ButtonCounter + 1 elseif (not parent) then - return nil + return error ("Details! FrameWork: parent not found.", 2) end if (not container) then container = parent
--- a/Libs/DF/cooltip.lua Fri Dec 18 15:15:50 2015 -0200 +++ b/Libs/DF/cooltip.lua Sat Jan 02 13:33:05 2016 -0200 @@ -893,7 +893,7 @@ end function CoolTip:StatusBar (menuButton, StatusBar) - + if (StatusBar) then menuButton.statusbar:SetValue (StatusBar [1]) @@ -926,19 +926,38 @@ menuButton.spark2:Hide() end + if (StatusBar [8]) then + local texture = SharedMedia:Fetch ("statusbar", StatusBar [8], true) + if (texture) then + menuButton.statusbar.texture:SetTexture (texture) + else + menuButton.statusbar.texture:SetTexture (StatusBar [8]) + end + elseif (CoolTip.OptionsTable.StatusBarTexture) then + local texture = SharedMedia:Fetch ("statusbar", CoolTip.OptionsTable.StatusBarTexture, true) + if (texture) then + menuButton.statusbar.texture:SetTexture (texture) + else + menuButton.statusbar.texture:SetTexture (CoolTip.OptionsTable.StatusBarTexture) + end + else + menuButton.statusbar.texture:SetTexture ("Interface\\PaperDollInfoFrame\\UI-Character-Skills-Bar") + end + + --[[ if (CoolTip.OptionsTable.StatusBarTexture) then menuButton.statusbar.texture:SetTexture (CoolTip.OptionsTable.StatusBarTexture) else menuButton.statusbar.texture:SetTexture ("Interface\\PaperDollInfoFrame\\UI-Character-Skills-Bar") end - + --]] else menuButton.statusbar:SetValue (0) menuButton.statusbar2:SetValue (0) menuButton.spark:Hide() menuButton.spark2:Hide() end - + if (CoolTip.OptionsTable.LeftBorderSize) then menuButton.statusbar:SetPoint ("left", menuButton, "left", 10 + CoolTip.OptionsTable.LeftBorderSize, 0) else @@ -1382,7 +1401,7 @@ elseif (CoolTip.OptionsTable.IgnoreButtonAutoHeight) then frame1:SetHeight ( (temp+spacing) * -1) else - frame1:SetHeight ( _math_max ( (frame1.hHeight * CoolTip.Indexes) + 12, 22 )) + frame1:SetHeight ( _math_max ( (frame1.hHeight * CoolTip.Indexes) + 8 + ((CoolTip.OptionsTable.ButtonsYMod or 0)*-1), 22 )) end end @@ -1938,8 +1957,8 @@ ---------------------------------------------------------------------- --> Reset cooltip - local default_backdrop = {bgFile=[[Interface\DialogFrame\UI-DialogBox-Background-Dark]], edgeFile=[[Interface\Tooltips\UI-Tooltip-Border]], tile=true, - edgeSize=16, tileSize=16, insets = {left=3, right=3, top=4, bottom=4}} + local default_backdrop = {bgFile = [[Interface\DialogFrame\UI-DialogBox-Background-Dark]], edgeFile = [[Interface\Buttons\WHITE8X8]], tile = true, + edgeSize = 1, tileSize = 16, insets = {left = 0, right = 0, top = 0, bottom = 0}} local default_backdrop_color = {0.09019, 0.09019, 0.18823, 1} local default_backdropborder_color = {1, 1, 1, 1} @@ -2232,7 +2251,7 @@ --> parameters: value [, color red, color green, color blue, color alpha [, glow]] --> can also use a table or html color name in color red and send glow in color green - function CoolTip:AddStatusBar (statusbarValue, frame, ColorR, ColorG, ColorB, ColorA, statusbarGlow, backgroundBar) + function CoolTip:AddStatusBar (statusbarValue, frame, ColorR, ColorG, ColorB, ColorA, statusbarGlow, backgroundBar, barTexture) --> need a previous line if (CoolTip.Indexes == 0) then @@ -2305,6 +2324,7 @@ statusbarTable [5] = ColorA statusbarTable [6] = statusbarGlow statusbarTable [7] = backgroundBar + statusbarTable [8] = barTexture end
--- a/Libs/DF/dropdown.lua Fri Dec 18 15:15:50 2015 -0200 +++ b/Libs/DF/dropdown.lua Sat Jan 02 13:33:05 2016 -0200 @@ -905,14 +905,15 @@ DF.DropDownCounter = DF.DropDownCounter + 1 elseif (not parent) then - return nil + return error ("Details! FrameWork: parent not found.", 2) end if (not container) then container = parent end if (name:find ("$parent")) then - name = name:gsub ("$parent", parent:GetName()) + local parentName = DF.GetParentName (parent) + name = name:gsub ("$parent", parentName) end local DropDownObject = {type = "dropdown", dframework = true}
--- a/Libs/DF/fw.lua Fri Dec 18 15:15:50 2015 -0200 +++ b/Libs/DF/fw.lua Sat Jan 02 13:33:05 2016 -0200 @@ -1,5 +1,5 @@ -local dversion = 13 +local dversion = 15 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary (major, minor) @@ -11,19 +11,24 @@ DetailsFrameworkCanLoad = true local SharedMedia = LibStub:GetLibrary ("LibSharedMedia-3.0") +local _ local _type = type local _unpack = unpack -local _ local upper = string.upper -DF.LabelNameCounter = 1 -DF.PictureNameCounter = 1 -DF.BarNameCounter = 1 -DF.DropDownCounter = 1 -DF.PanelCounter = 1 -DF.ButtonCounter = 1 -DF.SliderCounter = 1 -DF.SplitBarCounter = 1 +--> will always give a very random name for our widgets +local init_counter = math.random (1, 1000000) + +DF.LabelNameCounter = DF.LabelNameCounter or init_counter +DF.PictureNameCounter = DF.PictureNameCounter or init_counter +DF.BarNameCounter = DF.BarNameCounter or init_counter +DF.DropDownCounter = DF.DropDownCounter or init_counter +DF.PanelCounter = DF.PanelCounter or init_counter +DF.SimplePanelCounter = DF.SimplePanelCounter or init_counter +DF.ButtonCounter = DF.ButtonCounter or init_counter +DF.SliderCounter = DF.SliderCounter or init_counter +DF.SwitchCounter = DF.SwitchCounter or init_counter +DF.SplitBarCounter = DF.SplitBarCounter or init_counter DF.FrameWorkVersion = tostring (dversion) function DF:PrintVersion() @@ -32,12 +37,14 @@ LibStub:GetLibrary("AceTimer-3.0"):Embed (DF) +--> get the working folder do local path = string.match (debugstack (1, 1, 0), "AddOns\\(.+)fw.lua") if (path) then DF.folder = "Interface\\AddOns\\" .. path else - DF.folder = "" + --> if not found, try to use the last valid one + DF.folder = DF.folder or "" end end @@ -94,7 +101,9 @@ "ShowTextPromptPanel", "www_icons", "GetTemplate", + "InstallTemplate", "GetFrameworkFolder", + "ShowPanicWarning", } DF.table = {} @@ -867,17 +876,40 @@ thumbcolor = {0, 0, 0, 0.5}, } -function DF:GetTemplate (type, template_name) +function DF:InstallTemplate (widget_type, template_name, template) + widget_type = string.lower (widget_type) + local template_table - if (type == "font") then + if (widget_type == "font") then template_table = DF.font_templates - elseif (type == "dropdown") then + elseif (widget_type == "dropdown") then template_table = DF.dropdown_templates - elseif (type == "button") then + elseif (widget_type == "button") then template_table = DF.button_templates - elseif (type == "switch") then + elseif (widget_type == "switch") then template_table = DF.switch_templates - elseif (type == "slider") then + elseif (widget_type == "slider") then + template_table = DF.slider_templates + end + + template_table [template_name] = template + + return template +end + +function DF:GetTemplate (widget_type, template_name) + widget_type = string.lower (widget_type) + + local template_table + if (widget_type == "font") then + template_table = DF.font_templates + elseif (widget_type == "dropdown") then + template_table = DF.dropdown_templates + elseif (widget_type == "button") then + template_table = DF.button_templates + elseif (widget_type == "switch") then + template_table = DF.switch_templates + elseif (widget_type == "slider") then template_table = DF.slider_templates end return template_table [template_name]
--- a/Libs/DF/label.lua Fri Dec 18 15:15:50 2015 -0200 +++ b/Libs/DF/label.lua Sat Jan 02 13:33:05 2016 -0200 @@ -244,7 +244,7 @@ function DF:NewLabel (parent, container, name, member, text, font, size, color, layer) if (not parent) then - return nil + return error ("Details! FrameWork: parent not found.", 2) end if (not container) then container = parent @@ -256,9 +256,8 @@ end if (name:find ("$parent")) then - local pname = parent:GetName() - assert (pname, "label used $parent but parent has no name.") - name = name:gsub ("$parent", parent:GetName()) + local parentName = DF.GetParentName (parent) + name = name:gsub ("$parent", parentName) end local LabelObject = {type = "label", dframework = true}
--- a/Libs/DF/normal_bar.lua Fri Dec 18 15:15:50 2015 -0200 +++ b/Libs/DF/normal_bar.lua Sat Jan 02 13:33:05 2016 -0200 @@ -646,13 +646,14 @@ DF.BarNameCounter = DF.BarNameCounter + 1 elseif (not parent) then - return nil + return error ("Details! FrameWork: parent not found.", 2) elseif (not container) then container = parent end if (name:find ("$parent")) then - name = name:gsub ("$parent", parent:GetName()) + local parentName = DF.GetParentName (parent) + name = name:gsub ("$parent", parentName) end local BarObject = {type = "bar", dframework = true}
--- a/Libs/DF/panel.lua Fri Dec 18 15:15:50 2015 -0200 +++ b/Libs/DF/panel.lua Sat Jan 02 13:33:05 2016 -0200 @@ -18,8 +18,6 @@ local PanelMetaFunctions = {} local APIFrameFunctions -local simple_panel_counter = 1 - ------------------------------------------------------------------------------------------------------------ --> metatables @@ -1433,7 +1431,29 @@ end -local simple_panel_counter = 1 +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + +function DF:ShowPanicWarning (text) + if (not DF.PanicWarningWindow) then + DF.PanicWarningWindow = CreateFrame ("frame", "DetailsFrameworkPanicWarningWindow", UIParent) + DF.PanicWarningWindow:SetHeight (80) + DF.PanicWarningWindow:SetBackdrop ({bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], tileSize = 64, tile = true}) + DF.PanicWarningWindow:SetBackdropColor (1, 0, 0, 0.2) + DF.PanicWarningWindow:SetPoint ("topleft", UIParent, "topleft", 0, -250) + DF.PanicWarningWindow:SetPoint ("topright", UIParent, "topright", 0, -250) + + DF.PanicWarningWindow.text = DF.PanicWarningWindow:CreateFontString (nil, "overlay", "GameFontNormal") + DF.PanicWarningWindow.text:SetPoint ("center", DF.PanicWarningWindow, "center") + DF.PanicWarningWindow.text:SetTextColor (1, 0.6, 0) + end + + DF.PanicWarningWindow.text:SetText (text) + DF.PanicWarningWindow:Show() +end + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ + + local simple_panel_mouse_down = function (self, button) if (button == "RightButton") then if (self.IsMoving) then @@ -1478,8 +1498,8 @@ function DF:CreateSimplePanel (parent, w, h, title, name, panel_options) if (not name) then - name = "DetailsFrameworkSimplePanel" .. simple_panel_counter - simple_panel_counter = simple_panel_counter + 1 + name = "DetailsFrameworkSimplePanel" .. DF.SimplePanelCounter + DF.SimplePanelCounter = DF.SimplePanelCounter + 1 end if (not parent) then parent = UIParent @@ -1537,8 +1557,6 @@ f.SetTitle = simple_panel_settitle - simple_panel_counter = simple_panel_counter + 1 - return f end @@ -1813,17 +1831,21 @@ prompt:SetPoint ("top", f, "top", 0, -15) prompt:SetJustifyH ("center") f.prompt = prompt - - local button_true = DF:CreateButton (f, nil, 60, 20, "Okey") + + local button_text_template = DF:GetTemplate ("font", "OPTIONS_FONT_TEMPLATE") + local options_dropdown_template = DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE") + + local button_true = DF:CreateButton (f, nil, 60, 20, "Okey", nil, nil, nil, nil, nil, nil, options_dropdown_template, button_text_template) 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") + local button_false = DF:CreateButton (f, function() f.textbox:ClearFocus(); f:Hide() end, 60, 20, "Cancel", nil, nil, nil, nil, nil, nil, options_dropdown_template, button_text_template) 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) + local textbox = DF:CreateTextEntry (f, function()end, 380, 20, "textbox", nil, nil, options_dropdown_template) textbox:SetPoint ("topleft", f, "topleft", 10, -45) + f.EntryBox = textbox button_true:SetClickFunction (function() local my_func = button_true.true_function @@ -1843,9 +1865,10 @@ DF.text_prompt_panel:Show() + DetailsFrameworkPrompt.EntryBox:SetText ("") 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
--- a/Libs/DF/picture.lua Fri Dec 18 15:15:50 2015 -0200 +++ b/Libs/DF/picture.lua Sat Jan 02 13:33:05 2016 -0200 @@ -213,7 +213,7 @@ function DF:NewImage (parent, texture, w, h, layer, coords, member, name) if (not parent) then - return nil + return error ("Details! FrameWork: parent not found.", 2) end if (not name) then @@ -222,7 +222,8 @@ end if (name:find ("$parent")) then - name = name:gsub ("$parent", parent:GetName()) + local parentName = DF.GetParentName (parent) + name = name:gsub ("$parent", parentName) end local ImageObject = {type = "image", dframework = true}
--- a/Libs/DF/slider.lua Fri Dec 18 15:15:50 2015 -0200 +++ b/Libs/DF/slider.lua Sat Jan 02 13:33:05 2016 -0200 @@ -18,7 +18,6 @@ local cleanfunction = function() end local APISliderFunctions = false local SliderMetaFunctions = {} -local NameLessSlider = 1 ------------------------------------------------------------------------------------------------------------ --> metatables @@ -877,10 +876,10 @@ --> early checks if (not name) then - name = "DetailsFrameWorkSlider" .. NameLessSlider - NameLessSlider = NameLessSlider + 1 + name = "DetailsFrameWorkSlider" .. DF.SwitchCounter + DF.SwitchCounter = DF.SwitchCounter + 1 elseif (not parent) then - return nil + return error ("Details! FrameWork: parent not found.", 2) end if (not container) then container = parent @@ -1035,14 +1034,15 @@ DF.SliderCounter = DF.SliderCounter + 1 end if (not parent) then - return nil + return error ("Details! FrameWork: parent not found.", 2) end if (not container) then container = parent end if (name:find ("$parent")) then - name = name:gsub ("$parent", parent:GetName()) + local parentName = DF.GetParentName (parent) + name = name:gsub ("$parent", parentName) end local SliderObject = {type = "slider", dframework = true}
--- a/Libs/DF/split_bar.lua Fri Dec 18 15:15:50 2015 -0200 +++ b/Libs/DF/split_bar.lua Sat Jan 02 13:33:05 2016 -0200 @@ -539,14 +539,15 @@ DF.SplitBarCounter = DF.SplitBarCounter + 1 end if (not parent) then - return nil + return error ("Details! FrameWork: parent not found.", 2) end if (not container) then container = parent end if (name:find ("$parent")) then - name = name:gsub ("$parent", parent:GetName()) + local parentName = DF.GetParentName (parent) + name = name:gsub ("$parent", parentName) end local SplitBarObject = {type = "barsplit", dframework = true}
--- a/Libs/DF/textentry.lua Fri Dec 18 15:15:50 2015 -0200 +++ b/Libs/DF/textentry.lua Sat Jan 02 13:33:05 2016 -0200 @@ -183,6 +183,13 @@ end + function TextEntryMetaFunctions:SetText (text) + self.editbox:SetText (text) + end + function TextEntryMetaFunctions:GetText() + return self.editbox:GetText() + end + --> frame levels function TextEntryMetaFunctions:GetFrameLevel() return self.editbox:GetFrameLevel() @@ -470,23 +477,23 @@ function TextEntryMetaFunctions:SetTemplate (template) if (template.width) then - self:SetWidth (template.width) + self.editbox:SetWidth (template.width) end if (template.height) then - self:SetHeight (template.height) + self.editbox:SetHeight (template.height) end if (template.backdrop) then - self:SetBackdrop (template.backdrop) + self.editbox:SetBackdrop (template.backdrop) end if (template.backdropcolor) then local r, g, b, a = DF:ParseColors (template.backdropcolor) - self:SetBackdropColor (r, g, b, a) + self.editbox: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:SetBackdropBorderColor (r, g, b, a) self.editbox.current_bordercolor[1] = r self.editbox.current_bordercolor[2] = g self.editbox.current_bordercolor[3] = b @@ -509,7 +516,7 @@ DF.TextEntryCounter = DF.TextEntryCounter + 1 elseif (not parent) then - return nil + return error ("Details! FrameWork: parent not found.", 2) end if (not container) then @@ -517,7 +524,8 @@ end if (name:find ("$parent")) then - name = name:gsub ("$parent", parent:GetName()) + local parentName = DF.GetParentName (parent) + name = name:gsub ("$parent", parentName) end local TextEntryObject = {type = "textentry", dframework = true} @@ -667,7 +675,8 @@ function DF:NewSpecialLuaEditorEntry (parent, w, h, member, name, nointent) if (name:find ("$parent")) then - name = name:gsub ("$parent", parent:GetName()) + local parentName = DF.GetParentName (parent) + name = name:gsub ("$parent", parentName) end local borderframe = CreateFrame ("Frame", name, parent)
