- Small visual improvement on tooltips.

- Fixed an issue when closing solo plugins with the red X button.
This commit is contained in:
Tercioo
2016-01-02 13:27:59 -02:00
parent e13a415d26
commit 05d9b10399
27 changed files with 238 additions and 154 deletions
+1 -1
View File
@@ -932,7 +932,7 @@ function DF:NewButton (parent, container, name, member, w, h, func, param1, para
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
+27 -7
View File
@@ -893,7 +893,7 @@ function DF:CreateCoolTip()
end
function CoolTip:StatusBar (menuButton, StatusBar)
if (StatusBar) then
menuButton.statusbar:SetValue (StatusBar [1])
@@ -926,19 +926,38 @@ function DF:CreateCoolTip()
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 @@ function DF:CreateCoolTip()
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 @@ function DF:CreateCoolTip()
----------------------------------------------------------------------
--> 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 @@ function DF:CreateCoolTip()
--> 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 @@ function DF:CreateCoolTip()
statusbarTable [5] = ColorA
statusbarTable [6] = statusbarGlow
statusbarTable [7] = backgroundBar
statusbarTable [8] = barTexture
end
+3 -2
View File
@@ -905,14 +905,15 @@ function DF:NewDropDown (parent, container, name, member, w, h, func, default, t
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}
+48 -17
View File
@@ -1,5 +1,5 @@
local dversion = 14
local dversion = 15
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary (major, minor)
@@ -11,19 +11,24 @@ end
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 @@ end
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,6 +101,7 @@ local embed_functions = {
"ShowTextPromptPanel",
"www_icons",
"GetTemplate",
"InstallTemplate",
"GetFrameworkFolder",
"ShowPanicWarning",
}
@@ -868,17 +876,40 @@ DF.slider_templates ["OPTIONS_SLIDER_TEMPLATE"] = {
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]
+3 -4
View File
@@ -244,7 +244,7 @@ end
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 @@ function DF:NewLabel (parent, container, name, member, text, font, size, color,
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}
+3 -2
View File
@@ -646,13 +646,14 @@ function DF:NewBar (parent, container, name, member, w, h, value, texture_name)
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}
+12 -12
View File
@@ -18,8 +18,6 @@ local cleanfunction = function() end
local PanelMetaFunctions = {}
local APIFrameFunctions
local simple_panel_counter = 1
------------------------------------------------------------------------------------------------------------
--> metatables
@@ -1456,7 +1454,6 @@ end
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local simple_panel_counter = 1
local simple_panel_mouse_down = function (self, button)
if (button == "RightButton") then
if (self.IsMoving) then
@@ -1501,8 +1498,8 @@ local no_options = {}
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
@@ -1560,8 +1557,6 @@ function DF:CreateSimplePanel (parent, w, h, title, name, panel_options)
f.SetTitle = simple_panel_settitle
simple_panel_counter = simple_panel_counter + 1
return f
end
@@ -1836,17 +1831,21 @@ function DF:ShowTextPromptPanel (message, callback)
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
@@ -1866,9 +1865,10 @@ function DF:ShowTextPromptPanel (message, callback)
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
+3 -2
View File
@@ -213,7 +213,7 @@ end
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 @@ function DF:NewImage (parent, texture, w, h, layer, coords, member, name)
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}
+6 -6
View File
@@ -18,7 +18,6 @@ local SharedMedia = LibStub:GetLibrary("LibSharedMedia-3.0")
local cleanfunction = function() end
local APISliderFunctions = false
local SliderMetaFunctions = {}
local NameLessSlider = 1
------------------------------------------------------------------------------------------------------------
--> metatables
@@ -877,10 +876,10 @@ function DF:NewSwitch (parent, container, name, member, w, h, ltext, rtext, defa
--> 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 @@ function DF:NewSlider (parent, container, name, member, w, h, min, max, step, de
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}
+3 -2
View File
@@ -539,14 +539,15 @@ function DF:NewSplitBar (parent, container, name, member, w, h)
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}
+17 -8
View File
@@ -183,6 +183,13 @@ DF.TextEntryCounter = 1
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 @@ DF.TextEntryCounter = 1
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 @@ function DF:NewTextEntry (parent, container, name, member, w, h, func, param1, p
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 @@ function DF:NewTextEntry (parent, container, name, member, w, h, func, param1, p
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 @@ end
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)