Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions Bootstrap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ addonTable.addon = addon

function addon:OnInitialize()
addon.guid = UnitGUID("player") -- cache guid call
addon.initialized = false

-- TODO back up config in case of crash?
-- TODO and/or use import strings so people can share QuestIDs they find
if not TM_TASKS then TM_TASKS = {} end
if not TM_STATUS then TM_STATUS = {} end
if not TM_WINDOW then TM_WINDOW = { width = 333, height = 500 } end
if not TM_WINDOW then TM_WINDOW = { width = 333, height = 500, scale = 1.0, opened = false } end

LibStub:GetLibrary("LibDataBroker-1.1"):NewDataObject(L["Title"], {
type = "launcher",
Expand All @@ -37,6 +38,10 @@ function addon:OnEnable()
addon:PurgeExpired() -- could be daily
local changed = addon:UpdateAll()
if changed then addon:RefreshWindow() end
if TM_WINDOW.opened and not addon.initialized then
addon:ShowWindow()
addon.initialized = true
end
end

--local finish = debugprofilestop()
Expand All @@ -57,8 +62,10 @@ end

function TM_AddonCompartmentFunc(addonName, buttonName, menuButtonFrame)
if TM_FRAME and TM_FRAME:IsShown() then
TM_WINDOW.opened = false
TM_FRAME:Hide()
else
TM_WINDOW.opened = true
addon:ShowWindow()
end
end
Expand All @@ -73,7 +80,7 @@ SLASH_TASKMANAGER1 = "/taskmanager"
SLASH_TASKMANAGER2 = "/task"
SlashCmdList.TASKMANAGER = function(msg)
local tokens = {}
for token in string.gmatch(msg, "(%w+)") do
for token in string.gmatch(msg, "(%S+)") do
table.insert(tokens, token)
end
if not tokens[1] then tokens[1] = "show" end
Expand Down Expand Up @@ -121,4 +128,13 @@ commands.cloak = function(tokens)
GenericTraitFrame:SetSystemID(29)
GenericTraitFrame:SetTreeID(1115)
ToggleFrame(GenericTraitFrame)
end
end

commands.scale = function(tokens)
if tokens[2] and tonumber(tokens[2]) then
TM_FRAME:SetScale(tonumber(tokens[2]))
TM_WINDOW["scale"] = tonumber(tokens[2])
else
print("/task scale <number>")
end
end
8 changes: 6 additions & 2 deletions UI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ local COLORS = {
WARN = "fff468",

PROGRESS = "fff468",
IGNORED = "c0c0c0",
IGNORED = "606060",
DONE = "00ffba",

WARRIOR = "c69b6d",
Expand Down Expand Up @@ -120,6 +120,7 @@ function addon:CreateMainFrame()
f:SetPortraitToAsset("Interface\\Icons\\inv_10_inscription_illusoryspellscrolls_color10")

f:SetSize(TM_WINDOW.width or 333, TM_WINDOW.height or 500)
f:SetScale(TM_WINDOW.scale or 1.0)
if TM_WINDOW.top then
f:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", TM_WINDOW.left, TM_WINDOW.top)
else
Expand Down Expand Up @@ -383,7 +384,10 @@ function addon:CreateTaskFrame(parent)
end

f.title:SetScript("OnMouseUp", function(self, button)
if button == "RightButton" then
if button == "LeftButton" and IsShiftKeyDown() then
addon:IgnoreTask(addon.guid, f.key, not addon:IsIgnored(addon.guid, f.key))
addon:RefreshWindow()
elseif button == "RightButton" then
UIDropDownMenu_Initialize(TM_FRAME.menu, function(frame, level, menuList)
UIDropDownMenu_AddButton({ text = L["SkipAllTask"], arg1 = f, arg2 = true, func = addon.MenuSkipAllTask })
UIDropDownMenu_AddButton({ text = L["UnskipAllTask"], arg1 = f, arg2 = false, func = addon.MenuSkipAllTask })
Expand Down