diff --git a/TomTom.lua b/TomTom.lua index 8e50d09..d4ebf23 100755 --- a/TomTom.lua +++ b/TomTom.lua @@ -50,6 +50,9 @@ function TomTom:ADDON_LOADED(event, addon) self:UnregisterEvent("ADDON_LOADED") self.defaults = { profile = { + general = { + confirmremoveall = true, + }, block = { enable = true, accuracy = 2, @@ -81,12 +84,14 @@ function TomTom:ADDON_LOADED(event, addon) enable = true, otherzone = true, tooltip = true, + menu = true, }, worldmap = { enable = true, tooltip = true, otherzone = true, clickcreate = true, + menu = true, }, comm = { enable = true, @@ -360,7 +365,12 @@ local dropdown_info = { { -- Remove ALL waypoints text = L["Remove all waypoints"], func = function() - StaticPopup_Show("TOMTOM_REMOVE_ALL_CONFIRM") + if TomTom.db.profile.general.confirmremoveall then + StaticPopup_Show("TOMTOM_REMOVE_ALL_CONFIRM") + else + StaticPopupDialogs["TOMTOM_REMOVE_ALL_CONFIRM"].OnAccept() + return + end end, }, { -- Save this waypoint @@ -514,9 +524,18 @@ end --[[------------------------------------------------------------------- -- Define callback functions -------------------------------------------------------------------]]-- -local function _both_onclick(event, uid, self, button) - TomTom:InitializeDropdown(uid) - ToggleDropDownMenu(1, nil, TomTom.dropdown, "cursor", 0, 0) +local function _minimap_onclick(event, uid, self, button) + if TomTom.db.profile.minimap.menu then + TomTom:InitializeDropdown(uid) + ToggleDropDownMenu(1, nil, TomTom.dropdown, "cursor", 0, 0) + end +end + +local function _world_onclick(event, uid, self, button) + if TomTom.db.profile.worldmap.menu then + TomTom:InitializeDropdown(uid) + ToggleDropDownMenu(1, nil, TomTom.dropdown, "cursor", 0, 0) + end end local function _both_tooltip_show(event, tooltip, uid, dist) @@ -629,12 +648,12 @@ function TomTom:AddZWaypoint(c, z, x, y, desc, persistent, minimap, world, custo else callbacks = { minimap = { - onclick = _both_onclick, + onclick = _minimap_onclick, tooltip_show = _minimap_tooltip_show, tooltip_update = _both_tooltip_update, }, world = { - onclick = _both_onclick, + onclick = _world_onclick, tooltip_show = _world_tooltip_show, tooltip_update = _both_tooltip_show, }, @@ -838,7 +857,12 @@ SlashCmdList["WAY"] = function(msg) if tokens[1] == "reset" then if tokens[2] == "all" then - StaticPopup_Show("TOMTOM_REMOVE_ALL_CONFIRM") + if TomTom.db.profile.general.confirmremoveall then + StaticPopup_Show("TOMTOM_REMOVE_ALL_CONFIRM") + else + StaticPopupDialogs["TOMTOM_REMOVE_ALL_CONFIRM"].OnAccept() + return + end elseif tokens[2] then -- Reset the named zone diff --git a/TomTom_Config.lua b/TomTom_Config.lua index 19c551c..719dc1b 100644 --- a/TomTom_Config.lua +++ b/TomTom_Config.lua @@ -179,7 +179,7 @@ local function createconfig() arg = "arrow.menu", }, heredistance = { - order = 6, + order = 7, type = "range", name = L["\"Arrival Distance\""], desc = L["This setting will control the distance at which the waypoint arrow switches to a downwards arrow, indicating you have arrived at your destination"], @@ -189,7 +189,7 @@ local function createconfig() color = { type = "group", name = L["Arrow colors"], - order = 7, + order = 8, inline = true, args = { help = { @@ -259,7 +259,13 @@ local function createconfig() width = "double", arg = "minimap.tooltip", }, - + rightclick = { + type = "toggle", + name = L["Enable the right-click contextual menu"], + desc = L["Enables a menu when right-clicking on a waypoint allowing you to clear or remove waypoints"], + width = "double", + arg = "minimap.menu", + }, }, } -- End minimap options @@ -305,8 +311,16 @@ local function createconfig() width = "double", arg = "worldmap.clickcreate", }, - player = { + rightclick = { + type = "toggle", order = 6, + name = L["Enable the right-click contextual menu"], + desc = L["Enables a menu when right-clicking on a waypoint allowing you to clear or remove waypoints"], + width = "double", + arg = "worldmap.menu", + }, + player = { + order = 7, type = "group", inline = true, name = L["Player Coordinates"], @@ -329,7 +343,7 @@ local function createconfig() }, }, cursor = { - order = 7, + order = 8, type = "group", inline = true, name = L["Cursor Coordinates"], @@ -378,6 +392,14 @@ local function createconfig() arg = "comm.prompt", }, --]] + confirmremove = { + type = "toggle", + order = 2, + name = L["Ask for confirmation on \"Remove All\""], + desc = L["This option will toggle whether or not you are asked to confirm removing all waypoints. If enabled, a dialog box will appear, requiring you to confirm removing the waypoints"], + width = "double", + arg = "general.confirmremoveall", + }, persistence = { type = "toggle", order = 3, diff --git a/TomTom_CrazyArrow.lua b/TomTom_CrazyArrow.lua index 59a0380..db1d2f9 100644 --- a/TomTom_CrazyArrow.lua +++ b/TomTom_CrazyArrow.lua @@ -290,7 +290,12 @@ local dropdown_info = { -- Remove all waypoints text = L["Remove all waypoints"], func = function() - StaticPopup_Show("TOMTOM_REMOVE_ALL_CONFIRM") + if TomTom.db.profile.general.confirmremoveall then + StaticPopup_Show("TOMTOM_REMOVE_ALL_CONFIRM") + else + StaticPopupDialogs["TOMTOM_REMOVE_ALL_CONFIRM"].OnAccept() + return + end end, }, }