diff --git a/core.lua b/core.lua index fcfea3c..00c8400 100644 --- a/core.lua +++ b/core.lua @@ -218,7 +218,12 @@ end function XIVBar:Refresh() if self.frames.bar == nil then return; end - + + self.miniTextPosition = "TOP" + if self.db.profile.general.barPosition == 'TOP' then + self.miniTextPosition = 'BOTTOM' + end + local barColor = self.db.profile.color.barColor self.frames.bar:ClearAllPoints() self.frames.bar:SetPoint(self.db.profile.general.barPosition) diff --git a/locales/enUS.lua b/locales/enUS.lua index 1e1db8a..f316045 100644 --- a/locales/enUS.lua +++ b/locales/enUS.lua @@ -6,6 +6,8 @@ L['General'] = true; L['Text'] = true; L['Modules'] = true; +L['Left-Click'] = true; +L['Right-Click'] = true; -- General L['Bar Position'] = true; @@ -42,3 +44,8 @@ L['Armor'] = true; L['Clock'] = true; L['Time Format'] = true; L['Use Server Time'] = true; +L['New Event!'] = true; +L['Local Time'] = true; +L['Realm Time'] = true; +L['Open Calendar'] = true; +L['Open Clock'] = true; diff --git a/modules/clock.lua b/modules/clock.lua index 5a6604c..d724187 100644 --- a/modules/clock.lua +++ b/modules/clock.lua @@ -65,19 +65,23 @@ function ClockModule:Refresh() if self.clockFrame == nil then return; end if not db.modules.clock.enabled then return; end - --self.clockText:SetAllPoints() self.clockText:SetFont(xb.LSM:Fetch(xb.LSM.MediaType.FONT, db.text.font), db.modules.clock.fontSize) ClockModule:SetClockColor() - --self.clockFrame:SetSize(self.clockText:GetStringWidth(), self.clockText:GetStringHeight()) - self.clockFrame:SetSize(100, 30) - self.clockFrame:SetPoint('CENTER', self.clockFrame:GetParent()) + + self.clockFrame:SetSize(self.clockText:GetStringWidth(), self.clockText:GetStringHeight()) + self.clockFrame:SetPoint('CENTER') + self.clockTextFrame:SetSize(self.clockText:GetStringWidth(), self.clockText:GetStringHeight()) self.clockTextFrame:SetPoint('CENTER') + self.clockText:SetPoint('CENTER') + + self.eventText:SetFont(xb.LSM:Fetch(xb.LSM.MediaType.FONT, db.text.font), db.text.smallFontSize) + self.eventText:SetPoint('CENTER', self.clockText, xb.miniTextPosition) end function ClockModule:CreateFrames() - self.clockTextFrame = self.clockTextFrame or CreateFrame("BUTTON", 'XIV_ClockTextFrame', self.clockFrame) + self.clockTextFrame = self.clockTextFrame or CreateFrame("BUTTON", nil, self.clockFrame) self.clockText = self.clockText or self.clockTextFrame:CreateFontString(nil, "OVERLAY") self.eventText = self.eventText or self.clockTextFrame:CreateFontString(nil, "OVERLAY") end @@ -98,6 +102,12 @@ function ClockModule:RegisterFrameEvents() end 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)) + end + ClockModule:Refresh() ClockModule.elapsed = 0 end @@ -106,12 +116,38 @@ function ClockModule:RegisterFrameEvents() self.clockTextFrame:SetScript('OnEnter', function() if InCombatLockdown() then return; end ClockModule:SetClockColor() + GameTooltip:SetOwner(ClockModule.clockTextFrame, 'ANCHOR_'..xb.miniTextPosition) + GameTooltip:AddLine("[|cff6699FFClock|r]") + GameTooltip:AddLine(" ") + local clockTime = nil + local ttTimeText = '' + if xb.db.profile.modules.clock.serverTime then + clockTime = time() + ttTimeText = L['Local Time']; + else + clockTime = GetServerTime() + ttTimeText = L['Realm Time']; + end + GameTooltip:AddDoubleLine(ttTimeText, date(ClockModule.timeFormats[xb.db.profile.modules.clock.timeFormat], clockTime), 1, 1, 0, 1, 1, 1) + GameTooltip:AddLine(" ") + GameTooltip:AddDoubleLine('<'..L['Left-Click']..'>', L['Open Calendar'], 1, 1, 0, 1, 1, 1) + GameTooltip:AddDoubleLine('<'..L['Right-Click']..'>', L['Open Clock'], 1, 1, 0, 1, 1, 1) + GameTooltip:Show() end) self.clockTextFrame:SetScript('OnLeave', function() if InCombatLockdown() then return; end ClockModule:SetClockColor() end) + + self.clockTextFrame:SetScript('OnClick', function(_, button) + if InCombatLockdown() then return; end + if button == 'LeftButton' then + ToggleCalendar() + elseif button == 'RightButton' then + ToggleTimeManager() + end + end) end function ClockModule:SetClockColor() diff --git a/modules/micromenu.lua b/modules/micromenu.lua index 4a7594e..b9ef4b9 100644 --- a/modules/micromenu.lua +++ b/modules/micromenu.lua @@ -53,10 +53,6 @@ function MenuModule:Refresh() if not xb.db.profile.modules.microMenu.enabled then return; end self.iconSize = xb:GetHeight(); - self.textPosition = "TOP" - if xb.db.profile.general.barPosition == 'TOP' then - self.textPosition = 'BOTTOM' - end local colors = xb.db.profile.color local totalWidth = 0; @@ -79,7 +75,7 @@ function MenuModule:Refresh() for name, frame in pairs(self.text) do frame:SetFont(xb.LSM:Fetch(xb.LSM.MediaType.FONT, xb.db.profile.text.font), xb.db.profile.text.smallFontSize) - frame:SetPoint('CENTER', self.frames[name], self.textPosition) + 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) end