diff --git a/boot.lua b/boot.lua index a8b9c6fe..fb851a81 100644 --- a/boot.lua +++ b/boot.lua @@ -8,7 +8,7 @@ _ = nil _detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0") - _detalhes.userversion = "v1.12.3" + _detalhes.userversion = "v1.12.4" _detalhes.version = "Alpha 016" _detalhes.realversion = 16 diff --git a/framework/button.lua b/framework/button.lua index 74ab442a..122e2cb7 100644 --- a/framework/button.lua +++ b/framework/button.lua @@ -471,7 +471,7 @@ local ButtonMetaFunctions = {} end if (button.MyObject.have_tooltip) then - GameCooltip:Reset() + _detalhes:CooltipPreset (1) GameCooltip:AddLine (button.MyObject.have_tooltip) GameCooltip:ShowCooltip (button, "tooltip") end diff --git a/framework/slider.lua b/framework/slider.lua index 1d51fee1..864bf39d 100644 --- a/framework/slider.lua +++ b/framework/slider.lua @@ -312,6 +312,8 @@ local SliderMetaFunctions = {} return end end + + DetailsFrameworkSliderButtons:ShowMe (slider) slider.thumb:SetAlpha (1) @@ -341,6 +343,8 @@ local SliderMetaFunctions = {} end end + DetailsFrameworkSliderButtons:PrepareToHide() + slider.thumb:SetAlpha (.7) if (slider.MyObject.have_tooltip) then @@ -356,11 +360,201 @@ local SliderMetaFunctions = {} end + + local f = CreateFrame ("frame", "DetailsFrameworkSliderButtons", UIParent) + f:Hide() + --f:SetBackdrop ({bgFile = [[Interface\DialogFrame\UI-DialogBox-Background-Dark]], tile = true, tileSize = 5}) + f:SetHeight (18) + + local t = 0 + f.is_going_hide = false + local going_hide = function (self, elapsed) + t = t + elapsed + if (t > 0.3) then + f:Hide() + f:SetScript ("OnUpdate", nil) + f.is_going_hide = false + end + end + + function f:ShowMe (host) + f:SetPoint ("bottomleft", host, "topleft", -3, -5) + f:SetPoint ("bottomright", host, "topright", 3, -5) + f:SetFrameStrata (host:GetFrameStrata()) + f:SetFrameLevel (host:GetFrameLevel()) + f:Show() + if (f.is_going_hide) then + f:SetScript ("OnUpdate", nil) + f.is_going_hide = false + end + + f.host = host.MyObject + end + + function f:PrepareToHide() + f.is_going_hide = true + t = 0 + f:SetScript ("OnUpdate", going_hide) + end + + local button_plus = CreateFrame ("button", "DetailsFrameworkSliderButtonsPlusButton", f) + local button_minor = CreateFrame ("button", "DetailsFrameworkSliderButtonsMinorButton", f) + + button_plus:SetScript ("OnEnter", function (self) + if (f.is_going_hide) then + f:SetScript ("OnUpdate", nil) + f.is_going_hide = false + end + end) + button_minor:SetScript ("OnEnter", function (self) + if (f.is_going_hide) then + f:SetScript ("OnUpdate", nil) + f.is_going_hide = false + end + end) + + button_plus:SetScript ("OnLeave", function (self) + f:PrepareToHide() + end) + button_minor:SetScript ("OnLeave", function (self) + f:PrepareToHide() + end) + + button_plus:SetNormalTexture ([[Interface\Buttons\UI-PlusButton-Up]]) + button_minor:SetNormalTexture ([[Interface\Buttons\UI-MinusButton-Up]]) + + button_plus:SetPushedTexture ([[Interface\Buttons\UI-PlusButton-Down]]) + button_minor:SetPushedTexture ([[Interface\Buttons\UI-MinusButton-Down]]) + + button_plus:SetDisabledTexture ([[Interface\Buttons\UI-PlusButton-Disabled]]) + button_minor:SetDisabledTexture ([[Interface\Buttons\UI-MinusButton-Disabled]]) + + button_plus:SetHighlightTexture ([[Interface\Buttons\UI-PlusButton-Hilight]]) + button_minor:SetHighlightTexture ([[Interface\Buttons\UI-PlusButton-Hilight]]) + + --button_minor:SetPoint ("bottomleft", f, "bottomleft", -6, -13) + --button_plus:SetPoint ("bottomright", f, "bottomright", 6, -13) + + button_minor:SetPoint ("bottomright", f, "bottomright", 13, -13) + button_plus:SetPoint ("left", button_minor, "right", -2, 0) + + button_plus:SetSize (16, 16) + button_minor:SetSize (16, 16) + + local timer = 0 + local change_timer = 0 + + -- -- -- + + local plus_button_script = function() + + local current = f.host.value + local editbox = SliderMetaFunctions.editbox_typevalue + + if (f.host.fine_tuning) then + f.host:SetValue (current + f.host.fine_tuning) + if (editbox and SliderMetaFunctions.editbox_typevalue:IsShown()) then + SliderMetaFunctions.editbox_typevalue:SetText (tostring (string.format ("%.1f", current + f.host.fine_tuning))) + end + else + if (f.host.useDecimals) then + f.host:SetValue (current + 0.1) + if (editbox and SliderMetaFunctions.editbox_typevalue:IsShown()) then + SliderMetaFunctions.editbox_typevalue:SetText (string.format ("%.1f", current + 0.1)) + end + else + f.host:SetValue (current + 1) + if (editbox and SliderMetaFunctions.editbox_typevalue:IsShown()) then + SliderMetaFunctions.editbox_typevalue:SetText (tostring (math.floor (current + 1))) + end + end + end + + end + + button_plus:SetScript ("OnMouseUp", function (self) + if (not button_plus.got_click) then + plus_button_script() + end + button_plus.got_click = false + self:SetScript ("OnUpdate", nil) + end) + + local on_update = function (self, elapsed) + timer = timer + elapsed + if (timer > 0.6) then + change_timer = change_timer + elapsed + if (change_timer > 0.1) then + change_timer = 0 + plus_button_script() + button_plus.got_click = true + end + end + end + button_plus:SetScript ("OnMouseDown", function (self) + timer = 0 + change_timer = 0 + self:SetScript ("OnUpdate", on_update) + end) + + -- -- -- + + local minor_button_script = function() + local current = f.host.value + local editbox = SliderMetaFunctions.editbox_typevalue + + if (f.host.fine_tuning) then + f.host:SetValue (current - f.host.fine_tuning) + if (editbox and SliderMetaFunctions.editbox_typevalue:IsShown()) then + SliderMetaFunctions.editbox_typevalue:SetText (tostring (string.format ("%.1f", current - f.host.fine_tuning))) + end + else + if (f.host.useDecimals) then + f.host:SetValue (current - 0.1) + if (editbox and SliderMetaFunctions.editbox_typevalue:IsShown()) then + SliderMetaFunctions.editbox_typevalue:SetText (string.format ("%.1f", current - 0.1)) + end + else + f.host:SetValue (current - 1) + if (editbox and SliderMetaFunctions.editbox_typevalue:IsShown()) then + SliderMetaFunctions.editbox_typevalue:SetText (tostring (math.floor (current - 1))) + end + end + end + end + + button_minor:SetScript ("OnMouseUp", function (self) + if (not button_minor.got_click) then + minor_button_script() + end + button_minor.got_click = false + self:SetScript ("OnUpdate", nil) + end) + + local on_update = function (self, elapsed) + timer = timer + elapsed + if (timer > 0.6) then + change_timer = change_timer + elapsed + if (change_timer > 0.1) then + change_timer = 0 + minor_button_script() + button_minor.got_click = true + end + end + end + button_minor:SetScript ("OnMouseDown", function (self) + timer = 0 + change_timer = 0 + self:SetScript ("OnUpdate", on_update) + end) + function SliderMetaFunctions:TypeValue() if (not self.isSwitch) then if (not SliderMetaFunctions.editbox_typevalue) then + local editbox = CreateFrame ("EditBox", "DetailsFrameworkSliderEditBox", UIParent) + editbox:SetSize (40, 20) editbox:SetJustifyH ("center") editbox:SetBackdrop ({bgFile = [[Interface\DialogFrame\UI-DialogBox-Background-Dark]], @@ -374,12 +568,23 @@ local SliderMetaFunctions = {} editbox:GetParent().MyObject.typing_value = false editbox:GetParent().MyObject.value = tonumber (editbox:GetText()) end) + editbox:SetScript ("OnEscapePressed", function() editbox:ClearFocus() editbox:Hide() editbox:GetParent().MyObject.typing_value = false editbox:GetParent().MyObject.value = tonumber (self.typing_value_started) end) + + editbox:SetScript ("OnTextChanged", function() + editbox:GetParent().MyObject.typing_can_change = true + editbox:GetParent().MyObject.value = tonumber (editbox:GetText()) + editbox:GetParent().MyObject.typing_can_change = false + + -- esse self fica como o primeiro a ser alterado + --print ("text changed", self:GetName()) + --print () + end) SliderMetaFunctions.editbox_typevalue = editbox end @@ -453,8 +658,9 @@ local SliderMetaFunctions = {} local amt = slider:GetValue() - if (slider.MyObject.typing_value) then - return slider.MyObject:SetValue (slider.MyObject.typing_value_started) + if (slider.MyObject.typing_value and not slider.MyObject.typing_can_change) then + slider.MyObject:SetValue (slider.MyObject.typing_value_started) + return end table_insert (slider.MyObject.previous_value, 1, amt) diff --git a/gumps/janela_info.lua b/gumps/janela_info.lua index c8169226..1ac89efb 100644 --- a/gumps/janela_info.lua +++ b/gumps/janela_info.lua @@ -85,6 +85,7 @@ function _detalhes:AbreJanelaInfo (jogador) info.avatar:Show() info.avatar_bg:Show() + info.avatar_bg:SetAlpha (.65) info.avatar_nick:Show() info.avatar_attribute:Show() @@ -588,11 +589,11 @@ local function cria_textos (este_gump) este_gump.avatar_bg:SetDrawLayer ("overlay", 2) este_gump.avatar_nick:SetDrawLayer ("overlay", 4) - este_gump.avatar:SetPoint ("TOPLEFT", este_gump, "TOPLEFT", 70, -10) - este_gump.avatar_bg:SetPoint ("TOPLEFT", este_gump, "TOPLEFT", 70, -12) + este_gump.avatar:SetPoint ("TOPLEFT", este_gump, "TOPLEFT", 60, -10) + este_gump.avatar_bg:SetPoint ("TOPLEFT", este_gump, "TOPLEFT", 60, -12) este_gump.avatar_bg:SetSize (275, 60) - este_gump.avatar_nick:SetPoint ("TOPLEFT", este_gump, "TOPLEFT", 208, -54) + este_gump.avatar_nick:SetPoint ("TOPLEFT", este_gump, "TOPLEFT", 195, -54) este_gump.avatar:Hide() este_gump.avatar_bg:Hide() diff --git a/gumps/janela_options.lua b/gumps/janela_options.lua index 6cd19db4..5d2f2fda 100644 --- a/gumps/janela_options.lua +++ b/gumps/janela_options.lua @@ -252,8 +252,34 @@ function _detalhes:OpenOptionsWindow (instance) window.Disable3DColorPick:SetPoint ("left", hide_3d_world, "right", 120, 0) window.Disable3DColorPick:SetColor (.5, .5, .5, 1) window.Disable3DColorPick:Hide() + + --> create bars + + local fill_bars = function() + local current_combat = _detalhes:GetCombat ("current") + + local actors_name = {"Ragnaros", "Alivecrawler", "Ghostcrawler Hate Ghostbusters", "The Lich King", "Your Neighbor", "Your Raid Leader", "A Shadow Priest Complaining About Dps", "Parry Hotter", "Your Math Teacher", "King Joffrey", "Batman", UnitName ("player") .. " Snow", "A Drunk Dawrf", "Somebody That You Used To Know", "Low Dps Guy", "Elvis Presley Doesn't Have Death Log", "Walter Can't Be Shadow Priest", "Bolvar Fordragon","Malygos","Akama","Anachronos","Lady Blaumeux","Cairne Bloodhoof","Borivar","C'Thun","Drek'Thar","Durotan","Eonar","Footman Malakai","Bolvar Fordragon","Fritz Fizzlesprocket","Lisa Gallywix","M'uru","High Priestess MacDonnell","Nazgrel","Ner'zhul","Saria Nightwatcher","Chief Ogg'ora","Ogoun","Grimm Onearm","Apothecary Oni'jus","Orman of Stromgarde","General Rajaxx","Baron Rivendare","Roland","Archmage Trelane","Liam Trollbane"} + local actors_classes = CLASS_SORT_ORDER + + for i = 1, 10 do + local robot = current_combat[1]:PegarCombatente (0x0000000000000, actors_name [math.random (1, #actors_name)], 0x114, true) + robot.grupo = true + robot.classe = actors_classes [math.random (1, #actors_classes)] + robot.total = math.random (10000000, 60000000) + end + + current_combat.start_time = time()-360 + current_combat.end_time = time() + + _G.DetailsOptionsWindow.instance:InstanceReset() + + end + local fillbars = g:NewButton (window, _, "$parentCreateExampleBarsButton", nil, 110, 14, fill_bars, nil, nil, nil, "Create Test Bars") + fillbars:SetPoint ("bottomleft", window.widget, "bottomleft", 200, 12) + --fillbars:InstallCustomTexture() + - --> left panel buttons + --> left panel buttons local menu_indexes = { [1] = "General Settings", @@ -1641,10 +1667,6 @@ function window:CreateFrame4() s:SetBackdropColor (unpack (slider_backdrop_color)) s:SetThumbSize (50) - - --> bars sort direction - - --> row texture color local rowcolor_callback = function (button, r, g, b, a) @@ -1660,44 +1682,7 @@ function window:CreateFrame4() window:create_line_background (frame4, frame4.rowPickColorLabel, frame4.rowColorPick) frame4.rowColorPick:SetHook ("OnEnter", background_on_enter) frame4.rowColorPick:SetHook ("OnLeave", background_on_leave) - - - --> bar background - local onSelectTextureBackground = function (_, instance, textureName) - instance:SetBarSettings (nil, nil, nil, nil, textureName) - end - - local textures2 = SharedMedia:HashTable ("statusbar") - local texTable2 = {} - for name, texturePath in pairs (textures2) do - texTable2[#texTable2+1] = {value = name, label = name, statusbar = texturePath, onclick = onSelectTextureBackground} - end - local buildTextureMenu2 = function() return texTable2 end - - local d = g:NewDropDown (frame4, _, "$parentRowBackgroundTextureDropdown", "rowBackgroundDropdown", DROPDOWN_WIDTH, 20, buildTextureMenu2, nil) - d.onenter_backdrop = dropdown_backdrop_onenter - d.onleave_backdrop = dropdown_backdrop_onleave - d:SetBackdrop (dropdown_backdrop) - d:SetBackdropColor (unpack (dropdown_backdrop_onleave)) - - --> bar texture - local onSelectTexture = function (_, instance, textureName) - instance:SetBarSettings (nil, textureName) - end - - local textures = SharedMedia:HashTable ("statusbar") - local texTable = {} - for name, texturePath in pairs (textures) do - texTable[#texTable+1] = {value = name, label = name, statusbar = texturePath, onclick = onSelectTexture} - end - - local buildTextureMenu = function() return texTable end - local d = g:NewDropDown (frame4, _, "$parentTextureDropdown", "textureDropdown", DROPDOWN_WIDTH, 20, buildTextureMenu, nil) - d.onenter_backdrop = dropdown_backdrop_onenter - d.onleave_backdrop = dropdown_backdrop_onleave - d:SetBackdrop (dropdown_backdrop) - d:SetBackdropColor (unpack (dropdown_backdrop_onleave)) - + --> bar grow direction local grow_switch_func = function (slider, value) if (value == 1) then @@ -1774,6 +1759,26 @@ function window:CreateFrame4() frame4.rowAlphaSlider:SetHook ("OnLeave", background_on_leave) -- texture + local onSelectTexture = function (_, instance, textureName) + instance:SetBarSettings (nil, textureName) + end + + local buildTextureMenu = function() + local textures = SharedMedia:HashTable ("statusbar") + local texTable = {} + for name, texturePath in pairs (textures) do + texTable[#texTable+1] = {value = name, label = name, statusbar = texturePath, onclick = onSelectTexture} + end + table.sort (texTable, function (t1, t2) return t1.label < t2.label end) + return texTable + end + + local d = g:NewDropDown (frame4, _, "$parentTextureDropdown", "textureDropdown", DROPDOWN_WIDTH, 20, buildTextureMenu, nil) + d.onenter_backdrop = dropdown_backdrop_onenter + d.onleave_backdrop = dropdown_backdrop_onleave + d:SetBackdrop (dropdown_backdrop) + d:SetBackdropColor (unpack (dropdown_backdrop_onleave)) + g:NewLabel (frame4, _, "$parentTextureLabel", "textureLabel", Loc ["STRING_OPTIONS_BAR_TEXTURE"], "GameFontHighlightLeft") -- frame4.textureDropdown:SetPoint ("left", frame4.textureLabel, "right", 2) @@ -1784,6 +1789,28 @@ function window:CreateFrame4() frame4.textureDropdown:SetHook ("OnLeave", background_on_leave) -- background texture + + --> bar background + local onSelectTextureBackground = function (_, instance, textureName) + instance:SetBarSettings (nil, nil, nil, nil, textureName) + end + + local buildTextureMenu2 = function() + local textures2 = SharedMedia:HashTable ("statusbar") + local texTable2 = {} + for name, texturePath in pairs (textures2) do + texTable2[#texTable2+1] = {value = name, label = name, statusbar = texturePath, onclick = onSelectTextureBackground} + end + table.sort (texTable2, function (t1, t2) return t1.label < t2.label end) + return texTable2 + end + + local d = g:NewDropDown (frame4, _, "$parentRowBackgroundTextureDropdown", "rowBackgroundDropdown", DROPDOWN_WIDTH, 20, buildTextureMenu2, nil) + d.onenter_backdrop = dropdown_backdrop_onenter + d.onleave_backdrop = dropdown_backdrop_onleave + d:SetBackdrop (dropdown_backdrop) + d:SetBackdropColor (unpack (dropdown_backdrop_onleave)) + g:NewLabel (frame4, _, "$parentRowBackgroundTextureLabel", "rowBackgroundLabel", Loc ["STRING_OPTIONS_BAR_TEXTURE"], "GameFontHighlightLeft") -- frame4.rowBackgroundDropdown:SetPoint ("left", frame4.rowBackgroundLabel, "right", 2) @@ -1841,7 +1868,7 @@ function window:CreateFrame4() --icon file g:NewLabel (frame4, _, "$parentIconFileLabel", "iconFileLabel", Loc ["STRING_OPTIONS_BAR_ICONFILE"], "GameFontHighlightLeft") - g:NewTextEntry (frame4, _, "$parentIconFileEntry", "iconFileEntry", 260, 20) + g:NewTextEntry (frame4, _, "$parentIconFileEntry", "iconFileEntry", 240, 20) frame4.iconFileEntry:SetPoint ("left", frame4.iconFileLabel, "right", 2, 0) frame4.iconFileEntry.tooltip = "- Press escape to restore default value.\n- Leave empty to hide icons." @@ -1861,6 +1888,21 @@ function window:CreateFrame4() frame4.iconFileEntry:SetHook ("OnLeave", background_on_leave) frame4.iconFileEntry.text = instance.row_info.icon_file + + g:NewButton (frame4, _, "$parentNoIconButton", "noIconButton", 20, 20, function() + if (frame4.iconFileEntry.text == "") then + frame4.iconFileEntry.text = [[Interface\AddOns\Details\images\classes_small]] + frame4.iconFileEntry:PressEnter() + else + frame4.iconFileEntry.text = "" + frame4.iconFileEntry:PressEnter() + end + end) + frame4.noIconButton:SetPoint ("left", frame4.iconFileEntry, "right", 2, 1) + frame4.noIconButton:SetNormalTexture ([[Interface\Buttons\UI-GroupLoot-Pass-Down]]) + frame4.noIconButton:SetHighlightTexture ([[Interface\Buttons\UI-GROUPLOOT-PASS-HIGHLIGHT]]) + frame4.noIconButton:SetPushedTexture ([[Interface\Buttons\UI-GroupLoot-Pass-Up]]) + frame4.noIconButton.tooltip = "Clear icon file." --bar start at g:NewSwitch (frame4, _, "$parentBarStartSlider", "barStartSlider", 60, 20, nil, nil, instance.row_info.start_after_icon) @@ -1955,12 +1997,16 @@ function window:CreateFrame5() local onSelectFont = function (_, instance, fontName) instance:SetBarTextSettings (nil, fontName) end - local fontObjects = SharedMedia:HashTable ("font") - local fontTable = {} - for name, fontPath in pairs (fontObjects) do - fontTable[#fontTable+1] = {value = name, label = name, onclick = onSelectFont, font = fontPath} + + local buildFontMenu = function() + local fontObjects = SharedMedia:HashTable ("font") + local fontTable = {} + for name, fontPath in pairs (fontObjects) do + fontTable[#fontTable+1] = {value = name, label = name, onclick = onSelectFont, font = fontPath} + end + table.sort (fontTable, function (t1, t2) return t1.label < t2.label end) + return fontTable end - local buildFontMenu = function() return fontTable end local d = g:NewDropDown (frame5, _, "$parentFontDropdown", "fontDropdown", DROPDOWN_WIDTH, 20, buildFontMenu, nil) d.onenter_backdrop = dropdown_backdrop_onenter @@ -2604,6 +2650,7 @@ function window:CreateFrame7() for name, fontPath in pairs (SharedMedia:HashTable ("font")) do fonts [#fonts+1] = {value = name, label = name, onclick = on_select_attribute_font, font = fontPath} end + table.sort (fonts, function (t1, t2) return t1.label < t2.label end) return fonts end @@ -2772,6 +2819,7 @@ function window:CreateFrame8() for name, fontPath in pairs (fontObjects) do fontTable[#fontTable+1] = {value = name, label = name, onclick = reset_text_color_onselectfont, font = fontPath} end + table.sort (fontTable, function (t1, t2) return t1.label < t2.label end) return fontTable end local d = g:NewDropDown (frame8, _, "$parentResetTextFontDropdown", "resetTextFontDropdown", DROPDOWN_WIDTH, 20, reset_text_color_build_font_menu, nil) @@ -2803,6 +2851,7 @@ function window:CreateFrame8() for name, fontPath in pairs (fontObjects) do fontTable[#fontTable+1] = {value = name, label = name, onclick = instance_text_color_onselectfont, font = fontPath} end + table.sort (fontTable, function (t1, t2) return t1.label < t2.label end) return fontTable end local d = g:NewDropDown (frame8, _, "$parentInstanceTextFontDropdown", "instanceTextFontDropdown", DROPDOWN_WIDTH, 20, instance_text_color_build_font_menu, nil)