- Added size offset options for the chat tab embed feature.

- Revamp on the editor for the custom line text.
This commit is contained in:
Tercio
2018-07-28 18:22:13 -03:00
parent a1c527711c
commit 720a95bc1b
10 changed files with 126 additions and 92 deletions
+6 -10
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -2321,7 +2321,7 @@ end
local actor_class_color_r, actor_class_color_g, actor_class_color_b
-- ~atualizar ~barra
-- ~atualizar ~barra ~update
function atributo_damage:AtualizaBarra (instancia, barras_container, qual_barra, lugar, total, sub_atributo, forcar, keyName, combat_time, percentage_type, use_animations, bars_show_data, bars_brackets, bars_separator)
-- instncia, container das barras, qual barra, colocao, total?, sub atributo, forar refresh, key
+11 -3
View File
@@ -356,9 +356,18 @@ end
--> desativando a instncia ela fica em stand by e apenas hida a janela ~shutdown ~close ~fechar
function _detalhes:DesativarInstancia()
local lower = _detalhes:GetLowerInstanceNumber()
self.ativa = false
_detalhes.opened_windows = _detalhes.opened_windows-1
if (not self.baseframe) then
--> windown isn't initialized yet
if (_detalhes.debug) then
_detalhes:Msg ("(debug) called HideWindow() but the window isn't initialized yet.")
end
return
end
local lower = _detalhes:GetLowerInstanceNumber()
_detalhes:GetLowerInstanceNumber()
if (lower == self.meu_id) then
@@ -370,7 +379,6 @@ end
_detalhes.switch:CloseMe()
end
_detalhes.opened_windows = _detalhes.opened_windows-1
self:ResetaGump()
--gump:Fade (self.baseframe.cabecalho.atributo_icon, _unpack (_detalhes.windows_fade_in))
+7 -7
View File
@@ -173,9 +173,9 @@ end
local y_up = window1.toolbar_side == 1 and -20 or 0
local y_down = (window1.show_statusbar and 14 or 0) + (window1.toolbar_side == 2 and 20 or 0)
window1.baseframe:SetPoint ("topleft", ChatFrameBackground, "topleft", 0, y_up)
window1.baseframe:SetPoint ("bottomright", ChatFrameBackground, "bottomright", 0, y_down)
window1.baseframe:SetPoint ("topleft", ChatFrameBackground, "topleft", 0, y_up + _detalhes.chat_tab_embed.y_offset)
window1.baseframe:SetPoint ("bottomright", ChatFrameBackground, "bottomright", _detalhes.chat_tab_embed.x_offset, y_down)
window1:LockInstance (true)
window1:SaveMainWindowPosition()
@@ -221,11 +221,11 @@ end
local width = ChatFrameBackground:GetWidth() / 2
local height = ChatFrameBackground:GetHeight() - y_down + y_up
window1.baseframe:SetSize (width, height)
window2.baseframe:SetSize (width, height)
window1.baseframe:SetSize (width + (_detalhes.chat_tab_embed.x_offset/2), height + _detalhes.chat_tab_embed.y_offset)
window2.baseframe:SetSize (width + (_detalhes.chat_tab_embed.x_offset/2), height + _detalhes.chat_tab_embed.y_offset)
window1.baseframe:SetPoint ("topleft", ChatFrameBackground, "topleft", 0, y_up)
window2.baseframe:SetPoint ("topright", ChatFrameBackground, "topright", 0, y_up)
window1.baseframe:SetPoint ("topleft", ChatFrameBackground, "topleft", 0, y_up + _detalhes.chat_tab_embed.y_offset)
window2.baseframe:SetPoint ("topright", ChatFrameBackground, "topright", _detalhes.chat_tab_embed.x_offset, y_up + _detalhes.chat_tab_embed.y_offset)
window1:SaveMainWindowPosition()
window2:SaveMainWindowPosition()
+19 -10
View File
@@ -456,27 +456,36 @@
--> replacing data for custom texts
_detalhes.string = {}
local left_side_func
local right_side_func
local function_cache = {}
local arguments_cache = {}
local parameters_cache = {}
local args
local replace_arg = function (i)
return args [tonumber(i)]
return arguments_cache [tonumber(i)]
end
local run_function = function (str)
--> cache functions
local func = function_cache [str]
if (not func) then
func = loadstring (str)
function_cache [str] = func
end
--str = [[local player, combat = ...;]] .. str
local okey, value = _pcall (loadstring (str), args[4], args[5])
local okey, value = _pcall (func, parameters_cache [1], parameters_cache [2])
if (not okey) then
_detalhes:Msg ("|cFFFF9900error on custom text function|r:", value)
_detalhes:Msg ("|cFFFF9900error on custom text|r:", value)
return 0
end
return value or 0
end
function _detalhes.string.replace (str, ...)
args = {...}
function _detalhes.string.replace (str, v1, v2, v3, v4, v5)
arguments_cache [1] = v1
arguments_cache [2] = v2
arguments_cache [3] = v3
parameters_cache [1] = v4
parameters_cache [2] = v5
return (str:gsub ("{data(%d+)}", replace_arg):gsub ("{func(.-)}", run_function))
end
+28 -53
View File
@@ -3024,10 +3024,12 @@
--> row text editor
local panel = _detalhes:CreateWelcomePanel ("DetailsWindowOptionsBarTextEditor", nil, 650, 210, true)
local panel = _detalhes:CreateWelcomePanel ("DetailsWindowOptionsBarTextEditor", nil, 650, 230, true)
panel:SetPoint ("center", UIParent, "center")
panel:Hide()
panel:SetFrameStrata ("FULLSCREEN")
Details.gump:ApplyStandardBackdrop (panel)
Details.gump:CreateTitleBar (panel, "Details! Custom Line Text Editor")
function panel:Open (text, callback, host, default)
if (host) then
@@ -3042,18 +3044,24 @@
panel:Show()
end
local y = -32
local buttonTemplate = Details.gump:GetTemplate ("button", "OPTIONS_BUTTON_TEMPLATE")
local textentry = _detalhes.gump:NewSpecialLuaEditorEntry (panel, 450, 185, "editbox", "$parentEntry", true)
textentry:SetPoint ("topleft", panel, "topleft", 10, -12)
textentry:SetPoint ("topleft", panel, "topleft", 10, y)
Details.gump:ApplyStandardBackdrop (textentry)
Details.gump:SetFontSize (textentry.editbox, 14)
Details.gump:ReskinSlider (textentry.scroll)
local arg1_button = _detalhes.gump:NewButton (panel, nil, "$parentButton1", nil, 80, 20, function() textentry.editbox:Insert ("{data1}") end, nil, nil, nil, string.format (Loc ["STRING_OPTIONS_TEXTEDITOR_DATA"], "1"), 1)
local arg2_button = _detalhes.gump:NewButton (panel, nil, "$parentButton2", nil, 80, 20, function() textentry.editbox:Insert ("{data2}") end, nil, nil, nil, string.format (Loc ["STRING_OPTIONS_TEXTEDITOR_DATA"], "2"), 1)
local arg3_button = _detalhes.gump:NewButton (panel, nil, "$parentButton3", nil, 80, 20, function() textentry.editbox:Insert ("{data3}") end, nil, nil, nil, string.format (Loc ["STRING_OPTIONS_TEXTEDITOR_DATA"], "3"), 1)
arg1_button:SetPoint ("topright", panel, "topright", -12, -14)
arg2_button:SetPoint ("topright", panel, "topright", -12, -36)
arg3_button:SetPoint ("topright", panel, "topright", -12, -58)
arg1_button:InstallCustomTexture()
arg2_button:InstallCustomTexture()
arg3_button:InstallCustomTexture()
arg1_button:SetPoint ("topright", panel, "topright", -12, y)
arg2_button:SetPoint ("topright", panel, "topright", -12, y - (20*1))
arg3_button:SetPoint ("topright", panel, "topright", -12, y - (20*2))
arg1_button:SetTemplate (buttonTemplate)
arg2_button:SetTemplate (buttonTemplate)
arg3_button:SetTemplate (buttonTemplate)
arg1_button.tooltip = Loc ["STRING_OPTIONS_TEXTEDITOR_DATA_TOOLTIP"]
arg2_button.tooltip = Loc ["STRING_OPTIONS_TEXTEDITOR_DATA_TOOLTIP"]
@@ -3168,70 +3176,37 @@
ColorSelection ( textentry.editbox, "|c" .. hex)
end
local func_button = _detalhes.gump:NewButton (panel, nil, "$parentButton4", nil, 80, 20, function() textentry.editbox:Insert ("{func local player = ...; return 0;}") end, nil, nil, nil, Loc ["STRING_OPTIONS_TEXTEDITOR_FUNC"], 1)
local func_button = _detalhes.gump:NewButton (panel, nil, "$parentButton4", nil, 80, 20, function() textentry.editbox:Insert ("{func local player, combat = ...; return 0;}") end, nil, nil, nil, Loc ["STRING_OPTIONS_TEXTEDITOR_FUNC"], 1)
local color_button = _detalhes.gump:NewColorPickButton (panel, "$parentButton5", nil, color_func)
color_button:SetSize (80, 20)
func_button:SetPoint ("topright", panel, "topright", -12, -80)
color_button:SetPoint ("topright", panel, "topright", -12, -102)
func_button:InstallCustomTexture()
color_button:SetTemplate (buttonTemplate)
func_button:SetPoint ("topright", panel, "topright", -12, y - (20*3))
color_button:SetPoint ("topright", panel, "topright", -12, y - (20*4))
func_button:SetTemplate (buttonTemplate)
color_button.tooltip = Loc ["STRING_OPTIONS_TEXTEDITOR_COLOR_TOOLTIP"]
func_button.tooltip = Loc ["STRING_OPTIONS_TEXTEDITOR_FUNC_TOOLTIP"]
--color_button:InstallCustomTexture()
--local comma_button = _detalhes.gump:NewButton (panel, nil, "$parentButtonComma", nil, 80, 20, function() textentry.editbox:Insert ("_detalhes:comma_value ( )") end, nil, nil, nil, Loc ["STRING_OPTIONS_TEXTEDITOR_COMMA"])
--local tok_button = _detalhes.gump:NewButton (panel, nil, "$parentButtonTok", nil, 80, 20, function() textentry.editbox:Insert ("_detalhes:ToK2 ( )") end, nil, nil, nil, Loc ["STRING_OPTIONS_TEXTEDITOR_TOK"])
--comma_button:InstallCustomTexture()
--tok_button:InstallCustomTexture()
--comma_button.tooltip = Loc ["STRING_OPTIONS_TEXTEDITOR_COMMA_TOOLTIP"]
--tok_button.tooltip = Loc ["STRING_OPTIONS_TEXTEDITOR_TOK_TOOLTIP"]
--comma_button:SetPoint ("topright", panel, "topright", -100, -14)
--tok_button:SetPoint ("topright", panel, "topright", -100, -36)
local done = function()
local text = panel.editbox:GetText()
--text = text:gsub ("\n", "")
--local test = text
--local function errorhandler(err)
-- return geterrorhandler()(err)
--end
--local code = [[local str = "STR"; str = _detalhes.string.replace (str, 100, 50, 75, {nome = "you", total = 10, total_without_pet = 5, damage_taken = 7, last_dps = 1, friendlyfire_total = 6, totalover = 2, totalabsorb = 4, totalover_without_pet = 6, healing_taken = 1, heal_enemy_amt = 2});]]
--code = code:gsub ("STR", test)
--local f = loadstring (code)
--if (not f) then
-- print ("loadstring failed:", f)
--end
--local err, two = xpcall (f, errorhandler)
--if (not err) then
-- return
--end
panel.callback (text)
panel:Hide()
end
local ok_button = _detalhes.gump:NewButton (panel, nil, "$parentButtonOk", nil, 80, 20, done, nil, nil, nil, Loc ["STRING_OPTIONS_TEXTEDITOR_DONE"], 1)
ok_button.tooltip = Loc ["STRING_OPTIONS_TEXTEDITOR_DONE_TOOLTIP"]
ok_button:InstallCustomTexture()
ok_button:SetPoint ("topright", panel, "topright", -12, -174)
ok_button:SetTemplate (buttonTemplate)
ok_button:SetPoint ("topright", panel, "topright", -12, -194)
local reset_button = _detalhes.gump:NewButton (panel, nil, "$parentDefaultOk", nil, 80, 20, function() textentry.editbox:SetText (panel.default) end, nil, nil, nil, Loc ["STRING_OPTIONS_TEXTEDITOR_RESET"], 1)
reset_button.tooltip = Loc ["STRING_OPTIONS_TEXTEDITOR_RESET_TOOLTIP"]
reset_button:InstallCustomTexture()
reset_button:SetPoint ("topright", panel, "topright", -100, -152)
reset_button:SetTemplate (buttonTemplate)
reset_button:SetPoint ("topright", panel, "topright", -100, -172)
local cancel_button = _detalhes.gump:NewButton (panel, nil, "$parentDefaultCancel", nil, 80, 20, function() textentry.editbox:SetText (panel.default_text); done(); end, nil, nil, nil, Loc ["STRING_OPTIONS_TEXTEDITOR_CANCEL"], 1)
cancel_button.tooltip = Loc ["STRING_OPTIONS_TEXTEDITOR_CANCEL_TOOLTIP"]
cancel_button:InstallCustomTexture()
cancel_button:SetPoint ("topright", panel, "topright", -100, -174)
cancel_button:SetTemplate (buttonTemplate)
cancel_button:SetPoint ("topright", panel, "topright", -100, -194)
--update window
function _detalhes:OpenUpdateWindow()
+2
View File
@@ -1040,6 +1040,8 @@ local default_profile = {
enabled = false,
tab_name = "",
single_window = false,
x_offset = 0,
y_offset = 0,
},
--> broadcaster options
+15 -8
View File
@@ -142,25 +142,32 @@ do
[102342] = 105, -- Ironbark
[33763] = 105, -- Lifebloom
[88423] = 105, -- Nature's Cure
--[8936] = 105, -- Regrowth -overlap
[18562] = 105, -- Swiftmend
-- Beast Mastery Hunter:
[19574] = 253, -- Bestial Wrath
[82692] = 253, -- Focus Fire
[53257] = 253, -- Cobra Strikes
[19574] = 253, -- Bestial Wrath
[217200] = 253, --Barbed Shot
[193455] = 253, --Cobra Shot
-- Marksmanship Hunter:
[53209] = 254, -- Chimaera Shot
[3045] = 254, -- Rapid Fire
[257045] = 254, --Rapid Fire
[19434] = 254, -- Aimed Shot
[193526] = 254, --Trueshot
[185358] = 254, --Arcane Shot
[186387] = 254, --Bursting Shot
-- Survival Hunter:
[3674] = 255, -- Black Arrow
[53301] = 255, -- Explosive Shot
[87935] = 255, -- Serpent Sting
[259491] = 255, -- Serpent Sting
[190925] = 255, --Harpoon
[186289] = 255, --Aspect of the Eagle
[259491] = 255, --Serpent Sting
[187708] = 255, --Carve
[259495] = 255, --Wildfire Bomb
[195645] = 255, --Wing Clip
[186270] = 255, --Raptor Strike
[187707] = 255, --Muzzle
-- Arcane Mage:
[153626] = 62, -- Arcane Orb
+36
View File
@@ -5829,6 +5829,38 @@ function window:CreateFrame3()
window:CreateLineBackground2 (frame3, "ChatTabEmbed2WindowsSlider", "ChatTabEmbed2WindowsLabel", Loc ["STRING_OPTIONS_TABEMB_SINGLE_DESC"])
--> size correction - width
g:NewLabel (frame3, _, "$parentChatTabEmbedSizeCorrectionLabel", "ChatTabEmbedSizeCorrectionLabel", "Width Offset", "GameFontHighlightLeft")
local s = g:NewSlider (frame3, _, "$parentChatTabEmbedSizeCorrectionSlider", "ChatTabEmbedSizeCorrectionSlider", SLIDER_WIDTH, SLIDER_HEIGHT, -100, 100, 1, tonumber (_detalhes.chat_tab_embed.x_offset), nil, nil, nil, options_slider_template)
frame3.ChatTabEmbedSizeCorrectionSlider:SetPoint ("left", frame3.ChatTabEmbedSizeCorrectionLabel, "right", 2)
frame3.ChatTabEmbedSizeCorrectionSlider:SetHook ("OnValueChange", function (self, instance, amount)
_detalhes.chat_tab_embed.x_offset = amount
if (_detalhes.chat_embed.enabled) then
_detalhes.chat_embed:DoEmbed()
end
_detalhes:SendOptionsModifiedEvent (instance)
end)
window:CreateLineBackground2 (frame3, "ChatTabEmbedSizeCorrectionSlider", "ChatTabEmbedSizeCorrectionLabel", "Fine tune the size of the window while embeded in the chat.")
---------
--> size correction - height
g:NewLabel (frame3, _, "$parentChatTabEmbedSizeCorrection2Label", "ChatTabEmbedSizeCorrection2Label", "Height Offset", "GameFontHighlightLeft")
local s = g:NewSlider (frame3, _, "$parentChatTabEmbedSizeCorrection2Slider", "ChatTabEmbedSizeCorrection2Slider", SLIDER_WIDTH, SLIDER_HEIGHT, -100, 100, 1, tonumber (_detalhes.chat_tab_embed.y_offset), nil, nil, nil, options_slider_template)
frame3.ChatTabEmbedSizeCorrection2Slider:SetPoint ("left", frame3.ChatTabEmbedSizeCorrection2Label, "right", 2)
frame3.ChatTabEmbedSizeCorrection2Slider:SetHook ("OnValueChange", function (self, instance, amount)
_detalhes.chat_tab_embed.y_offset = amount
if (_detalhes.chat_embed.enabled) then
_detalhes.chat_embed:DoEmbed()
end
_detalhes:SendOptionsModifiedEvent (instance)
end)
window:CreateLineBackground2 (frame3, "ChatTabEmbedSizeCorrection2Slider", "ChatTabEmbedSizeCorrection2Label", "Fine tune the size of the window while embeded in the chat.")
--------
--> extra Options -~-extra
g:NewLabel (frame3, _, "$parentSkinExtraOptionsAnchor", "SkinExtraOptionsAnchor", Loc ["STRING_OPTIONS_SKIN_EXTRA_OPTIONS_ANCHOR"], "GameFontNormal")
@@ -5873,6 +5905,8 @@ function window:CreateFrame3()
{"ChatTabEmbedEnabledLabel", 2},
{"ChatTabEmbedNameLabel", 3},
{"ChatTabEmbed2WindowsLabel", 4},
{"ChatTabEmbedSizeCorrectionLabel"},
{"ChatTabEmbedSizeCorrection2Label"},
{"SkinExtraOptionsAnchor", 5, true},
}
@@ -11453,6 +11487,8 @@ end --> if not window
_G.DetailsOptionsWindow3ChatTabEmbedEnabledSlider.MyObject:SetValue (_detalhes.chat_tab_embed.enabled)
_G.DetailsOptionsWindow3ChatTabEmbedNameEntry.MyObject.text = _detalhes.chat_tab_embed.tab_name
_G.DetailsOptionsWindow3ChatTabEmbed2WindowsSlider.MyObject:SetValue (_detalhes.chat_tab_embed.single_window)
_G.DetailsOptionsWindow3ChatTabEmbedSizeCorrectionSlider.MyObject:SetValue (_detalhes.chat_tab_embed.x_offset)
_G.DetailsOptionsWindow3ChatTabEmbedSizeCorrection2Slider.MyObject:SetValue (_detalhes.chat_tab_embed.y_offset)
--> hide all
for name, _ in pairs (_detalhes.skins) do
+1
View File
@@ -7291,6 +7291,7 @@ function _detalhes:SetTitleBarText (text)
end
end
-- ~titletext
function _detalhes:AttributeMenu (enabled, pos_x, pos_y, font, size, color, side, shadow, timer_encounter, timer_bg, timer_arena)
if (type (enabled) ~= "boolean") then