diff --git a/Bootstrap.lua b/Bootstrap.lua index 7f490bf..9f81824 100644 --- a/Bootstrap.lua +++ b/Bootstrap.lua @@ -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", @@ -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() @@ -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 @@ -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 @@ -121,4 +128,13 @@ commands.cloak = function(tokens) GenericTraitFrame:SetSystemID(29) GenericTraitFrame:SetTreeID(1115) ToggleFrame(GenericTraitFrame) -end \ No newline at end of file +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 ") + end +end diff --git a/UI.lua b/UI.lua index 1009a9e..a82d921 100644 --- a/UI.lua +++ b/UI.lua @@ -12,7 +12,7 @@ local COLORS = { WARN = "fff468", PROGRESS = "fff468", - IGNORED = "c0c0c0", + IGNORED = "606060", DONE = "00ffba", WARRIOR = "c69b6d", @@ -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 @@ -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 })