WoWInterface SVN FuBaruClock

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 11 to Rev 10
    Reverse comparison

Rev 11 → Rev 10

trunk/FuBar_uClock/Core.lua
1,7 → 1,6
--[[ $Id$ ]]--
uClock = AceLibrary("AceAddon-2.0"):new("AceDB-2.0", "AceEvent-2.0", "FuBarPlugin-2.0")
uClock.date = ("$Date$"):match("%d%d%d%d%-%d%d%-%d%d")
uClock.hasIcon = "Interface\\Icons\\INV_Misc_PocketWatch_02"
uClock.blizzardTooltip = true
uClock.cannotHideText = true
 
16,14 → 15,14
args = {
twentyFour = {
name = "24 Hour Mode",
desc = "Choose whether to have the time shown in 12-hour or 24-hour format,",
desc = "Choose whether to have the time shown in 12hr or 24hr format",
type = "toggle", order = 1,
get = function() return self.db.profile.twentyFour end,
set = function() self.db.profile.twentyFour = not self.db.profile.twentyFour end,
},
showSeconds = {
name = "Show Seconds",
desc = "Choose whether to show seconds.",
desc = "Choose whether to show seconds",
type = "toggle", order = 2,
get = function() return self.db.profile.showSeconds end,
set = function() self.db.profile.showSeconds = not self.db.profile.showSeconds end,
33,7 → 32,7
end
 
function uClock:OnTextUpdate()
self:SetText(self:GetTimeString(date("%H"), date("%M"), true))
self:SetText(self:GetTimeString(date("%H"), date("%M")))
end
 
function uClock:OnTooltipUpdate()
41,27 → 40,17
 
GameTooltip:AddDoubleLine("Server Time", self:GetTimeString(hour, minute))
GameTooltip:AddDoubleLine("Today's Date", date("%A, %B %d, %Y"))
GameTooltip:AddLine(" ")
GameTooltip:AddLine("|cffeda55fClick|r to toggle the Time Manager.", 0.2, 1, 0.2)
GameTooltip:AddLine("|cffeda55fShift-Click|r to toggle the Calendar.", 0.2, 1, 0.2)
end
 
function uClock:OnClick(button)
if button == "LeftButton" then
if IsShiftKeyDown() then
if GroupCalendar then
GroupCalendar.ToggleCalendarDisplay()
else
ToggleCalendar()
end
else
ToggleTimeManager()
end
if IsShiftKeyDown() then ToggleCalendar()
else ToggleTimeManager() end
end
end
 
 
function uClock:GetTimeString(hour, minute, color)
function uClock:GetTimeString(hour, minute)
local time, pm
 
if not self.db.profile.twentyFour then
71,7 → 60,7
if hour == 0 then hour = 12 end
end
 
time = ("%d:%02d"):format(hour, minute)
time = ("|cffffffff%d:%02d"):format(hour, minute)
 
if self.db.profile.showSeconds then
time = time..date(":%S")
81,6 → 70,5
time = time..(pm and " PM" or " AM")
end
 
if color then return "|cffffffff"..time.."|r"
else return time end
return time.."|r"
end