diff --git a/README.md b/README.md index bf80498..c74f487 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,35 @@ I have bad memory so I made this. A todolist/checklist AddOn for World of Warcra **I have tested it only in WoW Classic** +## How to install it +- Extract the files on your WoW Addon folder, usually `C:\Program Files (x86)\World of Warcraft\_classic_\Interface\AddOns`. +- Ensure that the .lua files are not spread inside the AddOns folder, but rather, inside the correct `TodoChecklister` folder. +- Your files shoud look like this: +``` +WowFolder + \ + \ + Interface + \ + \ + AddOns + \ + \ + TodoChecklister + \ + \ + TodoChecklister.toc/*.lua files/Any other addon file and folder +``` + +## How to use it +- If you happen to have any AddOn that integrates with `AceAddon` or `LibDBIcon`, a "list" button should appear on your minimap and you can toggle the addon by clicking it + ![mapButton](./button.png) +- Or you can also type `/todo tg` on your chatbox to toggle the window + +## List of slash commands +- **/todo tg** - Toggle the Todo window +- **/todo help** - Display available commands on chat + ## Reference material - [A Guide and Reference for Creating WoW Addons: WoW Programming](http://garde.sylvanas.free.fr/ressources/Guides/Macros-Addons/Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons.pdf) diff --git a/TodoChecklister.toc b/TodoChecklister.toc index fb76aaa..a9ffade 100644 --- a/TodoChecklister.toc +++ b/TodoChecklister.toc @@ -4,7 +4,7 @@ ## Notes: I have bad memory so I made this. A todolist/checklist AddOn for World of Warcraft. ## Version: 1.0 ## DefaultState: enabled -## SavedVariables: TodoChecklisterDB +## SavedVariables: TodoChecklisterDB, TodoChecklisterMapIcon constants.lua tableUtils.lua @@ -14,4 +14,5 @@ debug.lua components\components.xml chat.lua +minimapIcon.lua init.lua \ No newline at end of file diff --git a/button.png b/button.png new file mode 100644 index 0000000..1ff7ce8 Binary files /dev/null and b/button.png differ diff --git a/chat.lua b/chat.lua index cb97c96..c672a5c 100644 --- a/chat.lua +++ b/chat.lua @@ -14,22 +14,21 @@ local Utils = core.Utils; Chat.command = "/todo"; Chat.commands = { ["tg"] = function() - core.TodoUI.Toggle(); + core.TodoChecklisterFrame:Toggle() end, ["help"] = function() print(" "); Chat:Print("List of slash commands:") - -- Chat:Print("|cff00cc66/todo config|r - shows config menu"); - -- Chat:Print("|cff00cc66/todo help|r - shows help info"); + Chat:Print("|cff00cc66/todo tg|r - Toggle todo window"); print(" "); end, - ["example"] = { - ["test"] = function(...) - Chat:Print("My Value:", tostringall(...)); - end - } + -- ["example"] = { + -- ["test"] = function(...) + -- Chat:Print("My Value:", tostringall(...)); + -- end + -- } }; -------------------------------------- diff --git a/components/TodoChecklister.lua b/components/TodoChecklister.lua index 0bbf627..c5d14ed 100644 --- a/components/TodoChecklister.lua +++ b/components/TodoChecklister.lua @@ -36,6 +36,14 @@ function TodoChecklisterFrame:CheckItem(text) end end +function TodoChecklisterFrame:Toggle() + if (self.frame:IsShown()) then + self.frame:Hide(); + else + self.frame:Show(); + end +end + -------------------------------------- -- TodoChecklisterFrame Events -------------------------------------- @@ -96,7 +104,7 @@ function TodoChecklisterFrame:OnLoad(frame) HybridScrollFrame_CreateButtons(frame.ScrollFrame, "TodoItemTemplate") -- Display the frame - frame:Show() + self:Toggle(); end function TodoChecklisterFrame:OnShow(frame) diff --git a/init.lua b/init.lua index 5b390cc..967c3a4 100644 --- a/init.lua +++ b/init.lua @@ -10,6 +10,7 @@ function core:Init(event, name) core.Debug:Init(); core.Chat:Init(); + core.MinimapIcon:Init(); if (#TodoChecklisterDB > 0) then local completedList = core.TableUtils:Filter(TodoChecklisterDB, function(x) return x.isChecked == true end) diff --git a/minimapIcon.lua b/minimapIcon.lua new file mode 100644 index 0000000..4f68d0e --- /dev/null +++ b/minimapIcon.lua @@ -0,0 +1,27 @@ +-------------------------------------- +-- Namespaces +-------------------------------------- +local addonName, core = ...; +core.MinimapIcon = {}; -- adds Config table to addon namespace + +local MinimapIcon = core.MinimapIcon; +local Constants = core.Constants; + +-------------------------------------- +-- MinimapIcon functions +-------------------------------------- +function MinimapIcon:Init() + if type(TodoChecklisterMapIcon) ~= "table" then + TodoChecklisterMapIcon = { hide=false } + end + if LibStub("LibDBIcon-1.0", true) then + local minimapIconLDB = LibStub("LibDataBroker-1.1"):NewDataObject(addonName.."MinimapIcon", { + type = "data source", + text = addonName, + icon = "Interface\\Icons\\INV_Misc_Note_03", + OnClick = function (self, button) core.TodoChecklisterFrame:Toggle() end + }); + + LibStub("LibDBIcon-1.0"):Register(addonName, minimapIconLDB, TodoChecklisterMapIcon) + end +end