WoWInterface SVN BearinMind

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 4 to Rev 5
    Reverse comparison

Rev 4 → Rev 5

Bear in Mind/BiM.lua
93,6 → 93,9
local function ShouldShowReminder(reminder)
local show = false
if not reminder.data.shown then --if not currently shown
if reminder.charName and reminder.charName ~= BiM.charName then --if only for a certain char, and not THIS char, then don't show
return
end
local _, m, d, y = CalendarGetDate()
local curDate = strformat("%d-%d-%d", m, d, y)
--if show always or haven't shown yet today
156,7 → 159,7
local timeReminders = db.reminders.time
for i = 1, #timeReminders do
local reminder = timeReminders[i]
if reminder.time == GameTime_GetTime(true) then
if reminder.time == GameTime_GetTime(true) and ShouldShowReminder(reminder) then
tinsert(sRD, reminder.data)
BiM.DisplayReminder(reminder.data)
end
Bear in Mind/Bear in Mind.toc
2,7 → 2,7
## Title: Bear in Mind
## Author: Seerah
## Notes: An addon to remind you of things.
## Version: 0.1.1
## Version: 0.2
## OptionalDeps: Ace3, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, LibAdvancedIconSelector-1.0
## SavedVariables: BearInMindDB
## SavedVariablesPerCharacter: BearInMindPCDB
Bear in Mind/BiM_options.lua
13,7 → 13,9
local zr, er, dr, tr, lr, cr --shortcuts to db.reminders.zone, etc.
local zre, ere, dre, tre, lre, cre --save which reminder is currently being edited
local dropdownContents = {} --what to display in the edit dropdown on the current tab
local prevChar = {} --storing prevChar for tristate toggles for char specific reminders
 
BiM.charName = UnitName("player")
BiM.dayMap = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}
local sampleData = {
icon = "Interface\\AddOns\\Bear in Mind\\BiM-icon",
249,10 → 251,19
end,
order = 4,
},
spacer1 = {
name = "",
type = "description",
width = "full",
thisChar = {
name = "Character Specific",
desc = function()
return BiM.CharSpecOptionDesc(zr, zre)
end,
type = "toggle",
tristate = true,
get = function()
return BiM.CharSpecOptionGet(zr, zre)
end,
set = function(_, state)
return BiM.CharSpecOptionSet(zr, zre, state)
end,
order = 5,
},
zone = {
278,7 → 289,7
end,
order = 7,
},
spacer2 = {
spacer = {
name = " \n \n ", --or make a header?
type = "description",
width = "full",
391,10 → 402,19
end,
order = 4,
},
spacer1 = {
name = "",
type = "description",
width = "full",
thisChar = {
name = "Character Specific",
desc = function()
return BiM.CharSpecOptionDesc(er, ere)
end,
type = "toggle",
tristate = true,
get = function()
return BiM.CharSpecOptionGet(er, ere)
end,
set = function(_, state)
return BiM.CharSpecOptionSet(er, ere, state)
end,
order = 5,
},
event = {
419,7 → 439,7
end,
order = 7,
},
spacer2 = {
spacer = {
name = " \n \n ", --or make a header?
type = "description",
width = "full",
532,10 → 552,19
end,
order = 4,
},
spacer1 = {
name = "",
type = "description",
width = "full",
thisChar = {
name = "Character Specific",
desc = function()
return BiM.CharSpecOptionDesc(lr, lre)
end,
type = "toggle",
tristate = true,
get = function()
return BiM.CharSpecOptionGet(lr, lre)
end,
set = function(_, state)
return BiM.CharSpecOptionSet(lr, lre, state)
end,
order = 5,
},
showAlways = {
548,7 → 577,7
end,
order = 7,
},
spacer2 = {
spacer = {
name = " \n \n ", --or make a header?
type = "description",
width = "full",
661,10 → 690,19
end,
order = 4,
},
spacer1 = {
name = "",
type = "description",
width = "full",
thisChar = {
name = "Character Specific",
desc = function()
return BiM.CharSpecOptionDesc(dr, dre)
end,
type = "toggle",
tristate = true,
get = function()
return BiM.CharSpecOptionGet(dr, dre)
end,
set = function(_, state)
return BiM.CharSpecOptionSet(dr, dre, state)
end,
order = 5,
},
day = {
688,7 → 726,7
end,
order = 7,
},
spacer2 = {
spacer = {
name = " \n \n ", --or make a header?
type = "description",
width = "full",
801,10 → 839,19
end,
order = 4,
},
spacer1 = {
name = "",
type = "description",
width = "full",
thisChar = {
name = "Character Specific",
desc = function()
return BiM.CharSpecOptionDesc(tr, tre)
end,
type = "toggle",
tristate = true,
get = function()
return BiM.CharSpecOptionGet(tr, tre)
end,
set = function(_, state)
return BiM.CharSpecOptionSet(tr, tre, state)
end,
order = 5,
},
time = {
817,7 → 864,7
end,
order = 6,
},
spacer2 = {
spacer = {
name = " \n \n ", --or make a header?
type = "description",
width = "full",
840,6 → 887,58
},
}
 
function BiM.CharSpecOptionDesc(rtype, rem)
local current, past
if rem then
local r = rtype[rem]
if r.charName then --if saved for a char
current = "\n\nThis reminder is currently set to display only for "..r.charName
else
current = "\n\nThis reminder is currently set to display for all characters."
end
if prevChar[r.name] and prevChar[r.name] ~= r.charName then
past = "\n\nThis reminder was previously set to display only for "..prevChar[r.name]..". Cycle through the checkbox to return to this setting."
end
end
return string.format("Display this reminder only while playing a certain character.%s%s", current or "", past or "")
end
 
function BiM.CharSpecOptionGet(rtype, rem)
if rem then
local r = rtype[rem]
local name = r.charName
if prevChar[r.name] == nil then
if name and name ~= BiM.charName then --if previously set to a different character
prevChar[r.name] = name --save a backup of the character name
else
prevChar[r.name] = false
end
end
if name then
if name == BiM.charName then --this char
return true
else --different char
return nil --will be grey check
end
else
return false
end
else
return false
end
end
 
function BiM.CharSpecOptionSet(rtype, rem, state)
local r = rtype[rem]
if state then --true
r.charName = BiM.charName
elseif state == false then
r.charName = nil
else --nil
r.charName = prevChar[r.name] and prevChar[r.name] or false
end
end
 
local function OnInitialize()
BearInMindDB = BearInMindDB or {}
db = BearInMindDB
858,6 → 957,12
login = {},
custom = {},
}
--reset any reminders that are stuck at shown (logging out without dismissing or client crash)
for rtype, set in pairs(db.reminders) do
for i = 1, #set do
set[i].data.shown = false
end
end
 
LibStub("AceConfig-3.0"):RegisterOptionsTable(addonName, options)
BiM.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions(addonName, addonName)