WoWInterface SVN FuBaruClock

Compare Revisions

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

Rev 10 → Rev 11

trunk/FuBar_uClock/Core.lua
1,6 → 1,7
--[[ $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
 
15,14 → 16,14
args = {
twentyFour = {
name = "24 Hour Mode",
desc = "Choose whether to have the time shown in 12hr or 24hr format",
desc = "Choose whether to have the time shown in 12-hour or 24-hour 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,
32,7 → 33,7
end
 
function uClock:OnTextUpdate()
self:SetText(self:GetTimeString(date("%H"), date("%M")))
self:SetText(self:GetTimeString(date("%H"), date("%M"), true))
end
 
function uClock:OnTooltipUpdate()
40,17 → 41,27
 
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 ToggleCalendar()
else ToggleTimeManager() end
if IsShiftKeyDown() then
if GroupCalendar then
GroupCalendar.ToggleCalendarDisplay()
else
ToggleCalendar()
end
else
ToggleTimeManager()
end
end
end
 
 
function uClock:GetTimeString(hour, minute)
function uClock:GetTimeString(hour, minute, color)
local time, pm
 
if not self.db.profile.twentyFour then
60,7 → 71,7
if hour == 0 then hour = 12 end
end
 
time = ("|cffffffff%d:%02d"):format(hour, minute)
time = ("%d:%02d"):format(hour, minute)
 
if self.db.profile.showSeconds then
time = time..date(":%S")
70,5 → 81,6
time = time..(pm and " PM" or " AM")
end
 
return time.."|r"
if color then return "|cffffffff"..time.."|r"
else return time end
end