From 29573952b765b545c36e88b9c72844c527711260 Mon Sep 17 00:00:00 2001 From: MilleXIV Date: Tue, 30 Aug 2016 00:05:55 -0400 Subject: [PATCH] Some minor updates * Fixes for bugs reported on WoW Interface, and tickets #21 and #22 * Add ability to disable social text and new event text --- locales/enUS.lua | 3 +++ modules/clock.lua | 25 +++++++++++++++++++------ modules/currency.lua | 40 +--------------------------------------- modules/micromenu.lua | 19 ++++++++++++++++--- modules/system.lua | 11 +++++++++++ modules/talent.lua | 9 +++++++-- modules/travel.lua | 12 ++++++++---- 7 files changed, 65 insertions(+), 54 deletions(-) diff --git a/locales/enUS.lua b/locales/enUS.lua index e7db17b..362b128 100644 --- a/locales/enUS.lua +++ b/locales/enUS.lua @@ -58,6 +58,7 @@ L['Open Guild Page'] = true; L['Social'] = true; L['No Tag'] = true; L['Level'] = true; +L['Hide Social Text'] = true; L['Armor'] = true; L['Always Show Item Level'] = true; @@ -72,6 +73,7 @@ L['Local Time'] = true; L['Realm Time'] = true; L['Open Calendar'] = true; L['Open Clock'] = true; +L['Hide Event Text'] = true; L['Travel'] = true; L['Port Options'] = true; @@ -102,6 +104,7 @@ L['Addons to Show in Tooltip'] = true; L['Show All Addons in Tooltip with Shift'] = true; L['Memory Usage'] = true; L['Garbage Collect'] = true; +L['Cleaned'] = true; L['Use Class Colors'] = true; L['Cooldowns'] = true; diff --git a/modules/clock.lua b/modules/clock.lua index 8aa848a..b616608 100644 --- a/modules/clock.lua +++ b/modules/clock.lua @@ -84,6 +84,9 @@ function ClockModule:Refresh() self.eventText:SetFont(xb:GetFont(db.text.smallFontSize)) self.eventText:SetPoint('CENTER', self.clockText, xb.miniTextPosition) + if xb.db.profile.modules.clock.hideEventText then + self.eventText:Hide() + end end function ClockModule:CreateFrames() @@ -109,9 +112,11 @@ function ClockModule:RegisterFrameEvents() local dateString = date(ClockModule.timeFormats[xb.db.profile.modules.clock.timeFormat], clockTime) ClockModule.clockText:SetText(dateString) - local eventInvites = CalendarGetNumPendingInvites() - if eventInvites > 0 then - ClockModule.eventText:SetText(string.format("%s (|cffffff00%i|r)", L['New Event!'], eventInvites)) + if not xb.db.profile.modules.clock.hideEventText then + local eventInvites = CalendarGetNumPendingInvites() + if eventInvites > 0 then + ClockModule.eventText:SetText(string.format("%s (|cffffff00%i|r)", L['New Event!'], eventInvites)) + end end ClockModule:Refresh() @@ -177,7 +182,8 @@ function ClockModule:GetDefaultOptions() enabled = true, timeFormat = 'twelveAmPm', fontSize = 20, - serverTime = false + serverTime = false, + hideEventText = false } end @@ -210,9 +216,16 @@ function ClockModule:GetConfig() get = function() return xb.db.profile.modules.clock.serverTime; end, set = function(_, val) xb.db.profile.modules.clock.serverTime = val; end }, + hideEventText = { + name = L['Hide Event Text'], + order = 2, + type = "toggle", + get = function() return xb.db.profile.modules.clock.hideEventText; end, + set = function(_, val) xb.db.profile.modules.clock.hideEventText = val; end + }, timeFormat = { name = L['Time Format'], - order = 2, + order = 3, type = "select", values = { --TODO: WTF is with this not accepting a variable? twelveAmPm = '08:00 AM (12 Hour)', @@ -229,7 +242,7 @@ function ClockModule:GetConfig() fontSize = { name = L['Font Size'], type = 'range', - order = 3, + order = 4, min = 10, max = 20, step = 1, diff --git a/modules/currency.lua b/modules/currency.lua index 2d3cc10..109a3fb 100644 --- a/modules/currency.lua +++ b/modules/currency.lua @@ -50,7 +50,7 @@ function CurrencyModule:OnDisable() end function CurrencyModule:Refresh() - + local db = xb.db.profile xb.constants.playerLevel = UnitLevel("player") if InCombatLockdown() then if xb.constants.playerLevel < MAX_PLAYER_LEVEL and db.modules.currency.showXPbar then @@ -64,7 +64,6 @@ function CurrencyModule:Refresh() end) return end - local db = xb.db.profile if self.currencyFrame == nil then return; end if not db.modules.currency.enabled then return; end @@ -252,43 +251,6 @@ function CurrencyModule:RegisterFrameEvents() self:Refresh() end end) - - --[[ - self.goldButton:EnableMouse(true) - self.goldButton:RegisterForClicks("AnyUp") - - self.goldButton:SetScript('OnEnter', function() - if InCombatLockdown() then return; end - self.goldText:SetTextColor(unpack(xb:HoverColors())) - self.bagText:SetTextColor(unpack(xb:HoverColors())) - - GameTooltip:SetOwner(CurrencyModule.goldFrame, 'ANCHOR_'..xb.miniTextPosition) - GameTooltip:AddLine("[|cff6699FF"..L['Gold'].."|r - |cff82c5ff"..xb.constants.playerFactionLocal.." "..xb.constants.playerRealm.."|r]") - GameTooltip:AddLine(" ") - - local totalGold = 0 - for charName, goldData in pairs(xb.db.factionrealm) do - GameTooltip:AddDoubleLine(charName, CurrencyModule:FormatCoinText(goldData.currentMoney), 1, 1, 0, 1, 1, 1) - totalGold = totalGold + goldData.currentMoney - end - GameTooltip:AddLine(" ") - GameTooltip:AddDoubleLine(L['Total'], CurrencyModule:FormatCoinText(totalGold), 1, 1, 0, 1, 1, 1) - GameTooltip:AddDoubleLine('<'..L['Left-Click']..'>', L['Toggle Bags'], 1, 1, 0, 1, 1, 1) - GameTooltip:Show() - end) - - self.goldButton:SetScript('OnLeave', function() - if InCombatLockdown() then return; end - local db = xb.db.profile - self.goldText:SetTextColor(db.color.inactive.r, db.color.inactive.g, db.color.inactive.b, db.color.inactive.a) - self.bagText:SetTextColor(db.color.inactive.r, db.color.inactive.g, db.color.inactive.b, db.color.inactive.a) - GameTooltip:Hide() - end) - - self.goldButton:SetScript('OnClick', function(_, button) - if InCombatLockdown() then return; end - ToggleAllBags() - end)]]-- end function CurrencyModule:ShowTooltip() diff --git a/modules/micromenu.lua b/modules/micromenu.lua index f0e8c97..0bf8be8 100644 --- a/modules/micromenu.lua +++ b/modules/micromenu.lua @@ -117,6 +117,9 @@ function MenuModule:Refresh() frame:SetPoint('CENTER', self.frames[name], xb.miniTextPosition) self.bgTexture[name]:SetColorTexture(xb.db.profile.color.barColor.r, xb.db.profile.color.barColor.g, xb.db.profile.color.barColor.b, xb.db.profile.color.barColor.a) self.bgTexture[name]:SetPoint('CENTER', frame, 'CENTER') + if xb.db.profile.modules.microMenu.hideSocialText then + frame:Hide() + end end end @@ -233,6 +236,7 @@ function MenuModule:UnregisterFrameEvents() end function MenuModule:UpdateGuildText(isEvent) + if xb.db.profile.modules.microMenu.hideSocialText then return; end if isEvent == nil then GuildRoster() end @@ -247,6 +251,7 @@ function MenuModule:UpdateGuildText(isEvent) end function MenuModule:UpdateFriendText() + if xb.db.profile.modules.microMenu.hideSocialText then return; end local _, bnOnlineMembers = BNGetNumFriends() local _, friendsOnline = GetNumFriends() local totalFriends = bnOnlineMembers + friendsOnline @@ -521,7 +526,8 @@ function MenuModule:GetDefaultOptions() enabled = true, showTooltips = true, mainMenuSpacing = 2, - iconSpacing = 2 + iconSpacing = 2, + hideSocialText = false } end @@ -551,9 +557,16 @@ function MenuModule:GetConfig() get = function() return xb.db.profile.modules.microMenu.showTooltips; end, set = function(_, val) xb.db.profile.modules.microMenu.showTooltips = val; self:Refresh(); end }, + hideSocialText = { + name = L['Hide Social Text'], + order = 2, + type = "toggle", + get = function() return xb.db.profile.modules.microMenu.hideSocialText; end, + set = function(_, val) xb.db.profile.modules.microMenu.hideSocialText = val; self:Refresh(); end + }, mainMenuSpacing = { name = L['Main Menu Icon Right Spacing'], - order = 2, + order = 3, type="range", min = 2, max = 20, @@ -563,7 +576,7 @@ function MenuModule:GetConfig() }, iconSpacing = { name = L['Icon Spacing'], - order = 2, + order = 4, type="range", min = 2, max = 20, diff --git a/modules/system.lua b/modules/system.lua index e7ae8ba..6720baa 100644 --- a/modules/system.lua +++ b/modules/system.lua @@ -202,7 +202,18 @@ function SystemModule:RegisterFrameEvents() self.fpsFrame:SetScript('OnClick', function(_, button) if InCombatLockdown() then return; end if button == 'LeftButton' then + UpdateAddOnMemoryUsage() + local before = collectgarbage('count') collectgarbage() + local after = collectgarbage('count') + local memDiff = before - after + local memString = '' + if memDiff > 1024 then + memString = string.format("%.2f MB", (memDiff / 1024)) + else + memString = string.format("%.0f KB", floor(memDiff)) + end + print("|cff6699FFXIV_Databar|r: "..L['Cleaned']..": |cffffff00"..memString) end end) diff --git a/modules/talent.lua b/modules/talent.lua index 02f4d34..7f403cf 100644 --- a/modules/talent.lua +++ b/modules/talent.lua @@ -107,12 +107,17 @@ function TalentModule:Refresh() self.talentFrame:SetSize(self.specFrame:GetWidth(), xb:GetHeight()) - self.specPopup:SetPoint('BOTTOM', self.specFrame, 'TOP', 0, xb.constants.popupPadding) + local popupPadding = xb.constants.popupPadding + if db.general.barPosition == 'TOP' then + popupPadding = -(popupPadding) + end + + self.specPopup:SetPoint(db.general.barPosition, self.specFrame, xb.miniTextPosition, 0, popupPadding) self.specPopupTexture:SetColorTexture(db.color.barColor.r, db.color.barColor.g, db.color.barColor.b, db.color.barColor.a) self.specPopupTexture:SetAllPoints() self.specPopup:Hide() - self.lootSpecPopup:SetPoint('BOTTOM', self.specFrame, 'TOP', 0, xb.constants.popupPadding) + self.lootSpecPopup:SetPoint(db.general.barPosition, self.specFrame, xb.miniTextPosition, 0, popupPadding) self.lootSpecPopupTexture:SetColorTexture(db.color.barColor.r, db.color.barColor.g, db.color.barColor.b, db.color.barColor.a) self.lootSpecPopupTexture:SetAllPoints() self.lootSpecPopup:Hide() diff --git a/modules/travel.lua b/modules/travel.lua index 2b87882..604565a 100644 --- a/modules/travel.lua +++ b/modules/travel.lua @@ -194,15 +194,19 @@ function TravelModule:SetPortColor() if (PlayerHasToy(v) or IsUsableItem(v)) then if GetItemCooldown(v) == 0 then hearthName, _ = GetItemInfo(v) - hearthActive = true - self.portButton:SetAttribute("macrotext", "/cast "..hearthName) + if hearthName ~= nil then + hearthActive = true + self.portButton:SetAttribute("macrotext", "/cast "..hearthName) + end end end -- if toy/item if IsPlayerSpell(v) then if GetSpellCooldown(v) == 0 then hearthName, _ = GetSpellInfo(v) - hearthActive = true - self.portButton:SetAttribute("macrotext", "/cast "..hearthName) + if hearthName ~= nil then + hearthActive = true + self.portButton:SetAttribute("macrotext", "/cast "..hearthName) + end end end -- if is spell -- 1.7.9.5