Removed the leftover print plus framework updates

This commit is contained in:
Tercio Jose
2020-03-14 13:40:14 -03:00
parent 3d7f299207
commit 149986e6cc
10 changed files with 323 additions and 12 deletions
+1
View File
@@ -29,3 +29,4 @@ locales/Details-deDE.lua
Libs/LibTranslit/.pkgmeta
a.lua
functions/pack2.lua
*.json
+1
View File
@@ -7,3 +7,4 @@ cooltip_background.blp
feedback_sites.blp
icons.blp
mail.blp
*.json
+33 -3
View File
@@ -21,6 +21,8 @@ do
local metaPrototype = {
WidgetType = "dropdown",
SetHook = DF.SetHook,
HasHook = DF.HasHook,
ClearHooks = DF.ClearHooks,
RunHooksForWidget = DF.RunHooksForWidget,
}
@@ -454,8 +456,15 @@ function DropDownMetaFunctions:Selected (_table)
else
self.label:SetPoint ("left", self.label:GetParent(), "left", 4, 0)
end
self.statusbar:SetTexture (_table.statusbar)
if (_table.statusbar) then
self.statusbar:SetTexture (_table.statusbar)
if (_table.statusbarcolor) then
self.statusbar:SetVertexColor (unpack(_table.statusbarcolor))
end
else
self.statusbar:SetTexture ([[Interface\Tooltips\CHATBUBBLE-BACKGROUND]])
end
if (_table.color) then
local _value1, _value2, _value3, _value4 = DF:ParseColors (_table.color)
@@ -650,7 +659,23 @@ function DetailsFrameworkDropDownOnMouseDown (button)
_this_row.label:SetFont ("GameFontHighlightSmall", 10.5)
end
_this_row.statusbar:SetTexture (_table.statusbar)
if (_table.statusbar) then
_this_row.statusbar:SetTexture (_table.statusbar)
if (_table.statusbarcolor) then
_this_row.statusbar:SetVertexColor (unpack(_table.statusbarcolor))
end
else
_this_row.statusbar:SetTexture ([[Interface\Tooltips\CHATBUBBLE-BACKGROUND]])
end
--an extra button in the right side of the row
--run a given function passing the button in the first argument, the row on 2nd and the _table in the 3rd
if (_table.rightbutton) then
DF:Dispatch (_table.rightbutton, _this_row.rightButton, _this_row, _table)
else
_this_row.rightButton:Hide()
end
_this_row.label:SetText (_table.label)
if (currentText and currentText == _table.label) then
@@ -1150,6 +1175,7 @@ function DF:CreateDropdownButton (parent, name)
statusbar:SetPoint ("left", f, "left", 1, 0)
statusbar:SetPoint ("right", f, "right", -10, 0)
statusbar:SetSize (150, 20)
statusbar:SetTexture ([[Interface\Tooltips\UI-Tooltip-Background]])
f.statusbar = statusbar
local icon = f:CreateTexture ("$parent_IconTexture", "OVERLAY")
@@ -1164,6 +1190,10 @@ function DF:CreateDropdownButton (parent, name)
DF:SetFontSize (text, 10)
f.label = text
local rightButton = DF:CreateButton(f, function()end, 16, 16, "", 0, 0, "", "rightButton", "$parentRightButton", nil, DF:GetTemplate ("dropdown", "OPTIONS_DROPDOWN_TEMPLATE"))
rightButton:SetPoint("right", f, "right", -2, 0)
rightButton:Hide()
f:SetScript ("OnMouseDown", DetailsFrameworkDropDownOptionClick)
f:SetScript ("OnEnter", DetailsFrameworkDropDownOptionOnEnter)
f:SetScript ("OnLeave", DetailsFrameworkDropDownOptionOnLeave)
+277 -3
View File
@@ -1,5 +1,5 @@
local dversion = 171
local dversion = 176
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary (major, minor)
@@ -17,6 +17,8 @@ local _type = type
local _unpack = unpack
local upper = string.upper
local string_match = string.match
local tinsert = _G.tinsert
local abs = _G.abs
local UnitPlayerControlled = UnitPlayerControlled
local UnitIsTapDenied = UnitIsTapDenied
@@ -932,7 +934,213 @@ end
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> menus
local getMenuWidgetVolative = function(parent, widgetType, indexTable)
if (widgetType == "label") then
local widget = parent.widget_list_by_type[widgetType][indexTable[widgetType]]
if (not widget) then
widget = DF:CreateLabel (parent, "", 10, "white", "", nil, "$parentWidget" .. widgetType .. indexTable[widgetType], "overlay")
tinsert(parent.widget_list, widget)
tinsert(parent.widget_list_by_type[widgetType], widget)
end
indexTable[widgetType] = indexTable[widgetType] + 1
return widget
elseif (widgetType == "dropdown") then
local widget = parent.widget_list_by_type[widgetType][indexTable[widgetType]]
if (not widget) then
widget = DF:CreateDropDown (parent, function() return {} end, nil, 140, 18, nil, "$parentWidget" .. widgetType .. indexTable[widgetType])
widget.hasLabel = DF:CreateLabel (parent, "", 10, "white", "", nil, "$parentWidget" .. widgetType .. indexTable[widgetType] .. "label", "overlay")
tinsert(parent.widget_list, widget)
tinsert(parent.widget_list_by_type[widgetType], widget)
else
widget:ClearHooks()
widget.hasLabel.text = ""
end
indexTable[widgetType] = indexTable[widgetType] + 1
return widget
elseif (widgetType == "switch") then
local widget = parent.widget_list_by_type[widgetType][indexTable[widgetType]]
if (not widget) then
local widget = DF:CreateSwitch (parent, nil, true, 20, 20, nil, nil, nil, "$parentWidget" .. widgetType .. indexTable[widgetType])
widget.hasLabel = DF:CreateLabel (parent, "", 10, "white", "", nil, "$parentWidget" .. widgetType .. indexTable[widgetType] .. "label", "overlay")
tinsert(parent.widget_list, widget)
tinsert(parent.widget_list_by_type[widgetType], widget)
else
widget:ClearHooks()
end
indexTable[widgetType] = indexTable[widgetType] + 1
return widget
elseif (widgetType == "slider") then
elseif (widgetType == "color") then
elseif (widgetType == "button") then
elseif (widgetType == "textentry") then
end
end
--volatile menu can be called several times, each time all settings are reset and a new menu is built using the same widgets
function DF:BuildMenuVolatile (parent, menu, x_offset, y_offset, height, use_two_points, text_template, dropdown_template, switch_template, switch_is_box, slider_template, button_template, value_change_hook)
if (not parent.widget_list) then
DF:SetAsOptionsPanel (parent)
end
DF:ClearOptionsPanel(parent)
local cur_x = x_offset
local cur_y = y_offset
local max_x = 0
local widgetIndexes = {
label = 1,
dropdown = 1,
switch = 1,
slider = 1,
color = 1,
button = 1,
textentry = 1,
}
height = abs ((height or parent:GetHeight()) - abs (y_offset) + 20)
height = height*-1
for index, widget_table in ipairs(menu) do
--step a line
if (widget_table.type == "blank" or widget_table.type == "space") then
-- do nothing
elseif (widget_table.type == "label" or widget_table.type == "text") then
local label = getMenuWidgetVolative(parent, "label", widgetIndexes)
label.text = widget_table.get() or widget_table.text or ""
label.color = widget_table.color
label.fontface = widget_table.font
if (widget_table.text_template or text_template) then
label:SetTemplate(widget_table.text_template or text_template)
else
label.fontsize = widget_table.size or 10
end
label._get = widget_table.get
label.widget_type = "label"
label:ClearAllPoints()
label:SetPoint (cur_x, cur_y)
if (widget_table.id) then
parent.widgetids [widget_table.id] = label
end
--dropdowns
elseif (widget_table.type == "select" or widget_table.type == "dropdown") then
local dropdown = getMenuWidgetVolative(parent, "dropdown", widgetIndexes)
dropdown:SetFunction(widget_table.values)
dropdown:Refresh()
dropdown:Select (widget_table.get())
dropdown:SetTemplate (dropdown_template)
dropdown.tooltip = widget_table.desc
dropdown._get = widget_table.get
dropdown.widget_type = "select"
dropdown.hasLabel.text = widget_table.name .. (use_two_points and ": " or "")
dropdown.hasLabel:SetTemplate(widget_table.text_template or text_template)
dropdown:ClearAllPoints()
dropdown:SetPoint ("left", dropdown.hasLabel, "right", 2)
dropdown.hasLabel:ClearAllPoints()
dropdown.hasLabel:SetPoint (cur_x, cur_y)
--> global callback
if (value_change_hook) then
dropdown:SetHook ("OnOptionSelected", value_change_hook)
end
--> hook list (hook list is wiped when getting the widget)
if (widget_table.hooks) then
for hookName, hookFunc in pairs (widget_table.hooks) do
dropdown:SetHook (hookName, hookFunc)
end
end
if (widget_table.id) then
parent.widgetids [widget_table.id] = dropdown
end
local size = dropdown.hasLabel.widget:GetStringWidth() + 140 + 4
if (size > max_x) then
max_x = size
end
--switchs
elseif (widget_table.type == "toggle" or widget_table.type == "switch") then
local switch = getMenuWidgetVolative(parent, "switch", widgetIndexes)
switch:SetValue(widget_table.get())
switch:SetTemplate(switch_template)
switch:SetAsCheckBox() --it's always a checkbox on volatile menu
switch.tooltip = widget_table.desc
switch._get = widget_table.get
switch.widget_type = "toggle"
switch.OnSwitch = widget_table.set
if (value_change_hook) then
switch:SetHook ("OnSwitch", value_change_hook)
end
--> hook list
if (widget_table.hooks) then
for hookName, hookFunc in pairs (widget_table.hooks) do
switch:SetHook (hookName, hookFunc)
end
end
switch.hasLabel.text = widget_table.name .. (use_two_points and ": " or "")
switch.hasLabel:SetTemplate(widget_table.text_template or text_template)
switch:ClearAllPoints()
switch.hasLabel:ClearAllPoints()
if (widget_table.boxfirst) then
switch:SetPoint (cur_x, cur_y)
switch.hasLabel:SetPoint ("left", switch, "right", 2)
else
switch.hasLabel:SetPoint (cur_x, cur_y)
switch:SetPoint ("left", switch.hasLabel, "right", 2)
end
if (widget_table.id) then
parent.widgetids [widget_table.id] = switch
end
local size = switch.hasLabel:GetStringWidth() + 60 + 4
if (size > max_x) then
max_x = size
end
end
end
end
local disable_on_combat = {}
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, value_change_hook)
@@ -955,13 +1163,17 @@ end
if (widget_table.type == "blank" or widget_table.type == "space") then
-- 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 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)
--store the widget created into the overall table and the widget by type
tinsert (parent.widget_list, label)
tinsert (parent.widget_list_by_type.label, label)
line_widgets_created = line_widgets_created + 1
if (widget_table.id) then
@@ -973,9 +1185,11 @@ end
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 text_template or 12)
dropdown:SetPoint ("left", label, "right", 2)
label:SetPoint (cur_x, cur_y)
dropdown.hasLabel = label
--> global callback
if (value_change_hook) then
@@ -998,7 +1212,10 @@ end
max_x = size
end
--store the widget created into the overall table and the widget by type
tinsert (parent.widget_list, dropdown)
tinsert (parent.widget_list_by_type.dropdown, dropdown)
widget_created = dropdown
line_widgets_created = line_widgets_created + 1
@@ -1032,6 +1249,7 @@ end
label:SetPoint (cur_x, cur_y)
switch:SetPoint ("left", label, "right", 2)
end
switch.hasLabel = label
if (widget_table.id) then
parent.widgetids [widget_table.id] = switch
@@ -1042,7 +1260,10 @@ end
max_x = size
end
--store the widget created into the overall table and the widget by type
tinsert (parent.widget_list, switch)
tinsert (parent.widget_list_by_type.switch, switch)
widget_created = switch
line_widgets_created = line_widgets_created + 1
@@ -1074,6 +1295,7 @@ 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)
slider:SetPoint ("left", label, "right", 2)
label:SetPoint (cur_x, cur_y)
slider.hasLabel = label
if (widget_table.id) then
parent.widgetids [widget_table.id] = slider
@@ -1084,7 +1306,10 @@ end
max_x = size
end
--store the widget created into the overall table and the widget by type
tinsert (parent.widget_list, slider)
tinsert (parent.widget_list_by_type.slider, slider)
widget_created = slider
line_widgets_created = line_widgets_created + 1
@@ -1115,6 +1340,7 @@ 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)
colorpick:SetPoint ("left", label, "right", 2)
label:SetPoint (cur_x, cur_y)
colorpick.hasLabel = label
if (widget_table.id) then
parent.widgetids [widget_table.id] = colorpick
@@ -1125,7 +1351,10 @@ end
max_x = size
end
--store the widget created into the overall table and the widget by type
tinsert (parent.widget_list, colorpick)
tinsert (parent.widget_list_by_type.color, colorpick)
widget_created = colorpick
line_widgets_created = line_widgets_created + 1
@@ -1158,7 +1387,10 @@ end
max_x = size
end
--store the widget created into the overall table and the widget by type
tinsert (parent.widget_list, button)
tinsert (parent.widget_list_by_type.button, button)
widget_created = button
line_widgets_created = line_widgets_created + 1
@@ -1174,6 +1406,7 @@ 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)
textentry:SetPoint ("left", label, "right", 2)
label:SetPoint (cur_x, cur_y)
textentry.hasLabel = label
--> text entry doesn't trigger global callback
@@ -1193,7 +1426,10 @@ end
max_x = size
end
--store the widget created into the overall table and the widget by type
tinsert (parent.widget_list, textentry)
tinsert (parent.widget_list_by_type.textentry, textentry)
widget_created = textentry
line_widgets_created = line_widgets_created + 1
@@ -1354,9 +1590,29 @@ end
return self.widgetids [id]
end
function DF:ClearOptionsPanel(frame)
for i = 1, #frame.widget_list do
frame.widget_list[i]:Hide()
if (frame.widget_list[i].hasLabel) then
frame.widget_list[i].hasLabel:SetText("")
end
end
table.wipe(frame.widgetids)
end
function DF:SetAsOptionsPanel (frame)
frame.RefreshOptions = refresh_options
frame.widget_list = {}
frame.widget_list_by_type = {
["dropdown"] = {}, -- "select"
["switch"] = {}, -- "toggle"
["slider"] = {}, -- "range"
["color"] = {}, --
["button"] = {}, -- "execute"
["textentry"] = {}, --
["label"] = {}, --"text"
}
frame.widgetids = {}
frame.GetWidgetById = get_frame_by_id
end
@@ -1697,6 +1953,24 @@ function DF:SetHook (hookType, func)
end
end
function DF:HasHook (hookType, func)
if (self.HookList [hookType]) then
if (type (func) == "function") then
for i = #self.HookList [hookType], 1, -1 do
if (self.HookList [hookType] [i] == func) then
return true
end
end
end
end
end
function DF:ClearHooks()
for hookType, hookTable in pairs(self.HookList) do
table.wipe(hookTable)
end
end
function DF:Error (errortext)
print ("|cFFFF2222Details! Framework Error|r:", errortext, self.GetName and self:GetName(), self.WidgetType, debugstack (2, 3, 0))
end
+5 -1
View File
@@ -1729,7 +1729,11 @@ function DF:IconPick (callback, close_when_select, param1, param2)
local GetSpellInfo = GetSpellInfo
for i = 1, #MACRO_ICON_FILENAMES do
local spellName = GetSpellInfo (MACRO_ICON_FILENAMES [i])
SPELLNAMES_CACHE [i] = spellName or "NULL"
if (spellName) then
SPELLNAMES_CACHE [i] = spellName
else
SPELLNAMES_CACHE [i] = MACRO_ICON_FILENAMES [i]
end
end
end
+2
View File
@@ -1109,6 +1109,7 @@ function DF:NewSpecialLuaEditorEntry (parent, w, h, member, name, nointent, show
scrollframeNumberLines.editbox = CreateFrame ("editbox", "$parentLineNumbers", scrollframeNumberLines)
scrollframeNumberLines.editbox:SetMultiLine (true)
scrollframeNumberLines.editbox:SetAutoFocus (false)
scrollframeNumberLines.editbox:SetEnabled (false)
scrollframeNumberLines.editbox:SetFontObject ("GameFontHighlightSmall")
scrollframeNumberLines.editbox:SetJustifyH ("left")
scrollframeNumberLines.editbox:SetJustifyV ("top")
@@ -1117,6 +1118,7 @@ function DF:NewSpecialLuaEditorEntry (parent, w, h, member, name, nointent, show
scrollframeNumberLines.editbox:SetPoint ("bottomright", borderframe, "bottomright", -30, 10)
scrollframeNumberLines:SetScrollChild (scrollframeNumberLines.editbox)
scrollframeNumberLines:EnableMouseWheel (false)
for i = 1, 1000 do
scrollframeNumberLines.editbox:Insert (i .. "\n")
+1 -1
View File
@@ -4,7 +4,7 @@
-- NickTag:SetNickname (name) -> set the player nick name, after set nicktag will broadcast the nick over addon guild channel.
--
local major, minor = "NickTag-1.0", 11
local major, minor = "NickTag-1.0", 12
local NickTag, oldminor = LibStub:NewLibrary (major, minor)
if (not NickTag) then
+1 -1
View File
@@ -1,4 +1,4 @@
## Interface: 70200
## Interface: 80200
## Title: NickTag-1.0
## Notes: Standalone version of the NickTag library.
+2 -2
View File
@@ -4,8 +4,8 @@
_ = nil
_detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0")
_detalhes.build_counter = 7281
_detalhes.alpha_build_counter = 7281 --if this is higher than the regular counter, use it instead
_detalhes.build_counter = 7282
_detalhes.alpha_build_counter = 7282 --if this is higher than the regular counter, use it instead
_detalhes.game_version = "v8.3.0"
_detalhes.userversion = "v8.3.0." .. _detalhes.build_counter
_detalhes.realversion = 140 --core version, this is used to check API version for scripts and plugins (see alias below)
-1
View File
@@ -2201,7 +2201,6 @@ function _detalhes:TrocaTabela (instancia, segmento, atributo, sub_atributo, ini
if (_detalhes.instances_segments_locked and not iniciando_instancia) then
for _, instance in ipairs (_detalhes.tabela_instancias) do
if (instance.meu_id ~= instancia.meu_id and instance.ativa and not instance._postponing_switch and not instance._postponing_current) then
print (instance:GetSegment(), instancia:GetSegment())
if (instance:GetSegment() >= 0 and instancia:GetSegment() ~= -1) then
if (instance.modo == 2 or instance.modo == 3) then
--> na troca de segmento, conferir se a instancia esta frozen