From d388cf07b1420b93d42124323b7d1f2f4a1026c2 Mon Sep 17 00:00:00 2001 From: James Whitehead II Date: Sun, 1 Jun 2008 21:57:32 +0000 Subject: [PATCH] Added an option to change the world-map click modifier --- TomTom.lua | 19 +++++++++++++++++-- TomTom_Config.lua | 20 ++++++++++++++++++-- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/TomTom.lua b/TomTom.lua index 1e1666f..b69e55f 100755 --- a/TomTom.lua +++ b/TomTom.lua @@ -96,6 +96,7 @@ function TomTom:ADDON_LOADED(event, addon) otherzone = true, clickcreate = true, menu = true, + create_modifier = "C", }, comm = { enable = true, @@ -272,14 +273,28 @@ end -- Hook the WorldMap OnClick local Orig_WorldMapButton_OnClick = WorldMapButton_OnClick +local world_click_verify = { + ["A"] = function() return IsAltKeyDown() end, + ["C"] = function() return IsControlKeyDown() end, + ["S"] = function() return IsShiftKeyDown() end, +} + function WorldMapButton_OnClick(...) local mouseButton, button = ... - if IsControlKeyDown() and mouseButton == "RightButton" then + if mouseButton == "RightButton" then + -- Check for all the modifiers that are currently set + for mod in TomTom.db.profile.worldmap.create_modifier:gmatch("[ACS]") do + if not world_click_verify[mod] or not world_click_verify[mod]() then + return Orig_WorldMapButton_OnClick(...) + end + end + + -- Actually try to add a note local c,z = GetCurrentMapContinent(), GetCurrentMapZone() local x,y = GetCurrentCursorPosition() if z == 0 then - return + return Orig_WorldMapButton_OnClick(...) end local uid = TomTom:AddZWaypoint(c,z,x*100,y*100) diff --git a/TomTom_Config.lua b/TomTom_Config.lua index eebe6a9..6868cbe 100644 --- a/TomTom_Config.lua +++ b/TomTom_Config.lua @@ -361,8 +361,24 @@ local function createconfig() width = "double", arg = "worldmap.menu", }, - player = { + modifier = { + type = "select", order = 7, + name = L["Create note modifier"], + desc = L["This setting changes the modifier used by TomTom when right-clicking on the world map to create a waypoint"], + values = { + ["A"] = "Alt", + ["C"] = "Ctrl", + ["S"] = "Shift", + ["AC"] = "Alt-Ctrl", + ["AS"] = "Alt-Shift", + ["CS"] = "Ctrl-Shift", + ["ACS"] = "Alt-Ctrl-Shift", + }, + arg = "worldmap.create_modifier", + }, + player = { + order = 8, type = "group", inline = true, name = L["Player Coordinates"], @@ -385,7 +401,7 @@ local function createconfig() }, }, cursor = { - order = 8, + order = 9, type = "group", inline = true, name = L["Cursor Coordinates"], -- 1.7.9.5