From fd09d77331559d4e1c1122a7840cf6368c1aa3f6 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Wed, 28 Oct 2020 12:59:30 -0300 Subject: [PATCH] Fixed title bar text reseting position and code cleanups --- Libs/DF/fw.lua | 6 +-- boot.lua | 4 +- classes/class_instance.lua | 30 +++------------ frames/window_main.lua | 58 +++++------------------------ frames/window_options2_sections.lua | 34 ++++++++++++++++- 5 files changed, 52 insertions(+), 80 deletions(-) diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index 7b3fd14a6..158e16d9e 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 213 +local dversion = 214 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary (major, minor) @@ -612,8 +612,8 @@ function DF:TruncateText (fontString, maxWidth) end end -function DF:Msg (msg) - print ("|cFFFFFFAA" .. (self.__name or "FW Msg:") .. "|r ", msg) +function DF:Msg (msg, ...) + print ("|cFFFFFFAA" .. (self.__name or "FW Msg:") .. "|r ", msg, ...) end function DF:GetNpcIdFromGuid (guid) diff --git a/boot.lua b/boot.lua index 5c6696f59..beee6c177 100644 --- a/boot.lua +++ b/boot.lua @@ -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 = 7933 - _detalhes.alpha_build_counter = 7933 --if this is higher than the regular counter, use it instead + _detalhes.build_counter = 7935 + _detalhes.alpha_build_counter = 7935 --if this is higher than the regular counter, use it instead _detalhes.game_version = "v9.0.1" _detalhes.userversion = "v9.0.1." .. _detalhes.build_counter _detalhes.realversion = 143 --core version, this is used to check API version for scripts and plugins (see alias below) diff --git a/classes/class_instance.lua b/classes/class_instance.lua index 3e65d72ce..62eb35d78 100644 --- a/classes/class_instance.lua +++ b/classes/class_instance.lua @@ -594,7 +594,6 @@ end end function _detalhes:AtivarInstancia (temp) - self.ativa = true self.cached_bar_width = self.cached_bar_width or 0 @@ -608,11 +607,14 @@ end end if (not self.iniciada) then - self:RestauraJanela (self.meu_id) --parece que esta chamando o ativar instance denovo... + self:RestauraJanela (self.meu_id, nil, true) --parece que esta chamando o ativar instance denovo... passei true no load_only vamos ver o resultado + self.iniciada = true else _detalhes.opened_windows = _detalhes.opened_windows+1 end + self:ChangeSkin() --carrega a skin aqui que era antes feito dentro do restaura janela + _detalhes:TrocaTabela (self, nil, nil, nil, true) if (self.hide_icon) then @@ -627,9 +629,7 @@ end gump:Fade (self.windowSwitchButton, 0) self:SetMenuAlpha() - self.baseframe.cabecalho.fechar:Enable() - self:ChangeIcon() if (not temp) then @@ -645,28 +645,10 @@ end self:ToolbarMenuButtons() self:ToolbarSide() self:AttributeMenu() - - --[=[ --this block was showing back the window after using /details hide, It's probably a leftover from the new Auto Hide and the old one. - _detalhes.WindowAutoHideTick = _detalhes.WindowAutoHideTick or {} - if (_detalhes.WindowAutoHideTick [self.meu_id]) then - _detalhes.WindowAutoHideTick [self.meu_id]:Cancel() - end - _detalhes.WindowAutoHideTick [self.meu_id] = C_Timer.NewTicker (10, function() - if (self.last_interaction) then - if (self.last_interaction + 10 < _detalhes._tempo) then - self:AdjustAlphaByContext(true) - _detalhes.WindowAutoHideTick [self.meu_id]:Cancel() - end - else - self:AdjustAlphaByContext(true) - _detalhes.WindowAutoHideTick [self.meu_id]:Cancel() - end - end) - --]=] else self:AdjustAlphaByContext(true) end - + self:DesaturateMenu() self:CheckFor_EnabledTrashSuppression() @@ -674,7 +656,6 @@ end if (not temp and not _detalhes.initializing) then _detalhes:SendEvent ("DETAILS_INSTANCE_OPEN", nil, self) end - end ------------------------------------------------------------------------------------------------------------------------ @@ -735,7 +716,6 @@ end end table.remove (_detalhes.tabela_instancias, id) - end diff --git a/frames/window_main.lua b/frames/window_main.lua index 948a396a1..f51f84cf5 100644 --- a/frames/window_main.lua +++ b/frames/window_main.lua @@ -846,7 +846,6 @@ local function move_janela (baseframe, iniciando, instancia, just_updating) if (need_start) then --> se a inst�ncia n�o tiver sido aberta ainda local lower_instance = _detalhes:GetLowerInstanceNumber() - --print (lower_instance, instancia_alvo.meu_id, DEATHGRAPHICS_BUTTON:GetParent():GetName()) instancia_alvo:RestauraJanela (instancia_alvo.meu_id, true) if (instancia_alvo:IsSoloMode()) then @@ -2054,9 +2053,7 @@ local barra_scripts_onmouseup = function (self, button) return _detalhes:ReportSingleLine (self._instance, self) end - - --print (self.minha_tabela) - -- /dump DetailsBarra_1_1.minha_tabela + if (not self.minha_tabela) then return _detalhes:Msg ("this bar is waiting update.") end @@ -4001,7 +3998,6 @@ function _detalhes:SetBarGrowDirection (direction) else for index = 1, #bars do bars [index]:SetWidth (baseframe:GetWidth() + self.row_info.space.right) - --print (bars [index]:GetWidth(), baseframe:GetWidth()) end end end @@ -5042,9 +5038,6 @@ end -- ~autohide �utohide function _detalhes:SetWindowAlphaForCombat (entering_in_combat, true_hide, alphaAmount) - ---print(entering_in_combat, "|", true_hide, "|", alphaAmount) - local amount, rowsamount, menuamount --get the values @@ -5084,8 +5077,6 @@ function _detalhes:SetWindowAlphaForCombat (entering_in_combat, true_hide, alpha end self.combat_changes_alpha = nil end - - --print ("baseframe:",amount,"rowframe:",rowsamount,"menu:",menuamount) --apply if (true_hide and amount == 0) then @@ -5221,7 +5212,6 @@ function _detalhes:InstanceColor (red, green, blue, alpha, no_save, change_statu self:StatusBarColor (nil, nil, nil, alpha, true) end --- print (self.skin, self.meu_id) local skin = _detalhes.skins [self.skin] if (not skin) then --the skin isn't available any more Details:Msg ("Skin " .. (self.skin or "?") .. " not found, changing to 'Dark Theme'.") @@ -5230,15 +5220,6 @@ function _detalhes:InstanceColor (red, green, blue, alpha, no_save, change_statu self.skin = "Minimalistic" end - --[[ - self.baseframe.rodape.esquerdo:SetVertexColor (red, green, blue) - self.baseframe.rodape.esquerdo:SetAlpha (alpha) - self.baseframe.rodape.direita:SetVertexColor (red, green, blue) - self.baseframe.rodape.direita:SetAlpha (alpha) - self.baseframe.rodape.top_bg:SetVertexColor (red, green, blue) - self.baseframe.rodape.top_bg:SetAlpha (alpha) - --]] - self.baseframe.cabecalho.ball_r:SetVertexColor (red, green, blue) self.baseframe.cabecalho.ball_r:SetAlpha (alpha) @@ -6246,8 +6227,6 @@ local build_segment_list = function (self, elapsed) segments_used = segments_used + 1 - --print (thisCombat.is_boss.name, thisCombat.instance_type, _detalhes:GetRaidIcon (thisCombat.is_boss.mapid), thisCombat.is_boss.ej_instance_id) - if (thisCombat.is_mythic_dungeon_segment) then if (not isMythicDungeon) then @@ -6929,7 +6908,6 @@ function _detalhes:ChangeSkin (skin_name) if (not just_updating) then --> skin updater - --print ("debug", self.meu_id, self.iniciada, self.baseframe, self.bgframe) if (self.bgframe.skin_script) then self.bgframe:SetScript ("OnUpdate", nil) self.bgframe.skin_script = false @@ -7092,7 +7070,7 @@ function _detalhes:ChangeSkin (skin_name) self.baseframe.cabecalho.atributo_icon:SetPoint ("topright", self.baseframe.cabecalho.ball_point, "topright", icon_anchor[1], icon_anchor[2]) self:ChangeIcon() end - + ----------> lock alpha head if (not this_skin.can_change_alpha_head) then @@ -7114,10 +7092,10 @@ function _detalhes:ChangeSkin (skin_name) self:SetBarBackdropSettings() self:SetBarSpecIconSettings() self:SetBarRightTextSettings() - + --> update toolbar self:ToolbarSide() - + --> update stretch button self:StretchButtonAnchor() @@ -7146,7 +7124,7 @@ function _detalhes:ChangeSkin (skin_name) else self:InstanceWallpaper (false) end - + --> update instance color self:InstanceColor() self:SetBackgroundColor() @@ -7727,7 +7705,7 @@ function _detalhes:AttributeMenu (enabled, pos_x, pos_y, font, size, color, side if (type (enabled) ~= "boolean") then enabled = self.attribute_text.enabled end - + if (not pos_x) then pos_x = self.attribute_text.anchor [1] end @@ -8283,7 +8261,7 @@ function _detalhes:ToolbarSide (side, only_update_anchors) self.baseframe.UPFrameLeftPart:SetPoint ("topleft", self.baseframe, "bottomleft", 0, 0) end - + if (only_update_anchors) then --> ShowSideBars depends on this and creates a infinite loop return @@ -8291,10 +8269,10 @@ function _detalhes:ToolbarSide (side, only_update_anchors) --> update top menus self:LeftMenuAnchorSide() - + self:StretchButtonAnchor() - - self:HideMainIcon() + + self:HideMainIcon() --attribute menu reseting value if (self.show_sidebars) then self:ShowSideBars() @@ -8367,7 +8345,6 @@ function _detalhes:StretchButtonAnchor (side) end function _detalhes:MenuAnchor (x, y) - if (self.toolbar_side == 1) then --top if (not x) then x = self.menu_anchor [1] @@ -8417,7 +8394,6 @@ function _detalhes:MenuAnchor (x, y) end self:ToolbarMenuButtons() - end function _detalhes:HideMainIcon (value) @@ -8440,7 +8416,6 @@ function _detalhes:HideMainIcon (value) self.baseframe.cabecalho.ball:SetTexCoord (l, r, b, t) local l, r, t, b = unpack (COORDS_LEFT_CONNECTOR_NO_ICON) self.baseframe.cabecalho.emenda:SetTexCoord (l, r, b, t) - end local skin = _detalhes.skins [self.skin] @@ -8468,19 +8443,6 @@ function _detalhes:HideMainIcon (value) self.baseframe.cabecalho.emenda:SetTexCoord (l, r, b, t) end end - - if (_detalhes.skins [self.skin].icon_titletext_position) then - if (not value and self.attribute_text.enabled and self.attribute_text.side == self.toolbar_side) then - self.attribute_text.anchor [1] = _detalhes.skins [self.skin].icon_titletext_position [1] - self.attribute_text.anchor [2] = _detalhes.skins [self.skin].icon_titletext_position [2] - self:AttributeMenu() - elseif (value and self.attribute_text.enabled and self.attribute_text.side == self.toolbar_side) then - self.attribute_text.anchor [1] = _detalhes.skins [self.skin].instance_cprops.attribute_text.anchor [1] - self.attribute_text.anchor [2] = _detalhes.skins [self.skin].instance_cprops.attribute_text.anchor [2] - self:AttributeMenu() - end - end - end --> search key: ~desaturate diff --git a/frames/window_options2_sections.lua b/frames/window_options2_sections.lua index 49eeaf114..c67b66c0a 100644 --- a/frames/window_options2_sections.lua +++ b/frames/window_options2_sections.lua @@ -2,6 +2,28 @@ if (true) then --return end +--[[ + search '~10' to go directly to tooltips settings + + ~01 - display + ~02 - skins + ~03 - bars general + ~04 - bars texts + ~05 - title bar + ~06 - body setings + ~07 - status bar + ~08 - plugins + ~09 - profiles + ~10 - tooltips + ~11 - datafeed + ~12 - wallpaper + ~13 - automation + ~14 - raid tools + ~15 - broadcaster + ~16 - custom spells + ~17 - charts data +--]] + local Details = _G.Details local DF = _G.DetailsFramework @@ -3947,6 +3969,7 @@ do end +-- ~11 ~datafeed do local buildSection = function(sectionFrame) @@ -4092,7 +4115,8 @@ do end -do --~wallpaper +-- ~12 ~wallpaper +do local buildSection = function(sectionFrame) --> callback from the image editor @@ -4497,7 +4521,9 @@ do --~wallpaper tinsert(Details.optionsSection, buildSection) end -do -- ~automation ~auto hide + +-- ~13 ~automation ~auto hide +do local buildSection = function(sectionFrame) --> auto switch options @@ -4920,6 +4946,7 @@ do -- ~automation ~auto hide end +-- ~14 ~raidtools ~tools do --raid tools local buildSection = function(sectionFrame) @@ -5374,6 +5401,7 @@ do --raid tools end +-- ~15 ~broadcaster do local buildSection = function(sectionFrame) @@ -5611,6 +5639,7 @@ do end +-- ~16 ~customspells ~spells do local buildSection = function(sectionFrame) @@ -5770,6 +5799,7 @@ do end +-- ~17 ~charts data do local buildSection = function(sectionFrame)