Quantcast

Add an option to reset options on waypoints

James Whitehead II [10-28-12 - 16:52]
Add an option to reset options on waypoints

If you change the minimap display or world display options, they will
not take affect for any waypoints that are already set. This button
under 'General Options' will re-set these options on all of the
currently set waypoints.
Filename
Localization.enUS.lua
TomTom.lua
TomTom_Config.lua
diff --git a/Localization.enUS.lua b/Localization.enUS.lua
index 7ecd28e..257d423 100644
--- a/Localization.enUS.lua
+++ b/Localization.enUS.lua
@@ -67,6 +67,7 @@ TomTomLocals = {
 	["General Options"] = "General Options",
 	["Good color"] = "Good color",
 	["Hide the crazy arrow display during pet battles"] = "Hide the crazy arrow display during pet battles",
+	["If you have changed the waypoint display settings (minimap, world), this will re-set all waypoints to the current options."] = "If you have changed the waypoint display settings (minimap, world), this will re-set all waypoints to the current options.",
 	["Lock coordinate block"] = "Lock coordinate block",
 	["Lock waypoint arrow"] = "Lock waypoint arrow",
 	["Locks the coordinate block so it can't be accidentally dragged to another location"] = "Locks the coordinate block so it can't be accidentally dragged to another location",
@@ -92,6 +93,7 @@ TomTomLocals = {
 	["Remove waypoint"] = "Remove waypoint",
 	["Removed %d waypoints from %s"] = "Removed %d waypoints from %s",
 	["Reset Position"] = "Reset Position",
+	["Reset waypoint display options to current"] = "Reset waypoint display options to current",
 	["Resets the position of the waypoint arrow if its been dragged off screen"] = "Resets the position of the waypoint arrow if its been dragged off screen",
 	["Save new waypoints until I remove them"] = "Save new waypoints until I remove them",
 	["Save profile for TomTom waypoints"] = "Save profile for TomTom waypoints",
diff --git a/TomTom.lua b/TomTom.lua
index 686700c..9229ff5 100755
--- a/TomTom.lua
+++ b/TomTom.lua
@@ -243,6 +243,18 @@ function TomTom:ClearAllWaypoints()
     end
 end

+function TomTom:ResetWaypointOptions()
+	local minimap = self.profile.minimap.enable
+	local world = self.profile.worldmap.enable
+
+	for map, data in pairs(self.waypointprofile) do
+		for key, waypoint in pairs(data) do
+			waypoint.minimap = minimap
+			waypoint.world = sorld
+		end
+	end
+end
+
 function TomTom:ReloadWaypoints()
     self:ClearAllWaypoints()

diff --git a/TomTom_Config.lua b/TomTom_Config.lua
index 2e3e043..8731f3b 100755
--- a/TomTom_Config.lua
+++ b/TomTom_Config.lua
@@ -670,6 +670,17 @@ local function createconfig()
 				width = "double",
 				arg = "general.corpse_arrow",
 			},
+			reset_waypoint_options = {
+				type = "execute",
+				order = 7,
+				name = L["Reset waypoint display options to current"],
+				desc = L["If you have changed the waypoint display settings (minimap, world), this will re-set all waypoints to the current options."],
+				func = function()
+					TomTom:ResetWaypointOptions()
+					TomTom:ReloadWaypoints()
+				end,
+				width = "double",
+			},
 		},
 	}