diff --git a/Babelfish.lua b/Babelfish.lua new file mode 100644 index 0000000..7fe9104 --- /dev/null +++ b/Babelfish.lua @@ -0,0 +1,27 @@ +#!/usr/local/bin/lua + +local strings = {} + +for i=1,#arg do + local file = io.open(arg[i], "r") + assert(file, "Could not open " .. arg[i]) + local text = file:read("*all") + + for match in string.gmatch(text, "L%[\"(.-)\"%]") do + strings[match] = true + end +end + +local work = {} + +for k,v in pairs(strings) do table.insert(work, k) end +table.sort(work) + +print("--Localization.enUS.lua\n") +print("TomTomLocals = {") +for idx,match in ipairs(work) do + local val = match + print(string.format("\t[\"%s\"] = \"%s\",", match, val)) +end +print("}\n") +print("setmetatable(TomTomLocals, {__index=function(t,k) rawset(t, k, k) end})") diff --git a/Config.lua b/Config.lua deleted file mode 100644 index 188ed36..0000000 --- a/Config.lua +++ /dev/null @@ -1,349 +0,0 @@ -local options = {} -local db = {} - -local L = setmetatable({}, {__index = function(t,k) return k end}) - -options.type = "group" -options.name = "TomTom" - -function options.get(info) - local ns,opt = string.split(".", info.arg) - local val = TomTom.db.profile[ns][opt] - if type(val) == "table" then - return unpack(val) - else - return val - end -end - -function options.set(info, arg1, arg2, arg3, arg4) - local ns,opt = string.split(".", info.arg) - --TomTom:Print(ns, opt, arg1, arg2, arg3, arg4) - if arg2 then - local entry = TomTom.db.profile[ns][opt] - entry[1] = arg1 - entry[2] = arg2 - entry[3] = arg3 - entry[4] = arg4 - else - TomTom.db.profile[ns][opt] = arg1 - end - - if ns == "block" then - TomTom:ShowHideBlockCoords() - elseif ns == "mapcoords" then - TomTom:ShowHideWorldCoords() - end -end - -options.args = {} - -options.args.coordblock = { - type = "group", - name = L["Coordinate Block"], - desc = L["Options that alter the coordinate block"], - args = { - desc = { - order = 1, - type = "description", - name = L["TomTom provides you with a floating coordinate display that can be used to determine your current position. These options can be used to enable or disable this display, or customize the block's display."], - }, - enable = { - order = 2, - type = "toggle", - name = L["Enable coordinate block"], - desc = L["Enables a floating block that displays your current position in the current zone"], - arg = "block.enable", - }, - accuracy = { - order = 3, - type = "range", - name = "Accuracy", - desc = L["Coordinates can be displayed as simple XX, YY coordinate, or as more precise XX.XX, YY.YY. This setting allows you to control that precision"], - min = 0, max = 2, step = 1, - arg = "block.accuracy", - }, - lock = { - order = 4, - type = "toggle", - name = L["Lock coordinate block"], - arg = "block.lock", - }, - display = { - order = 4, - type = "group", - name = L["Display Settings"], - args = { - bordercolor = { - type = "color", - name = L["Border color"], - arg = "block.bordercolor", - }, - bgcolor = { - type = "color", - name = L["Background color"], - arg = "block.bgcolor", - }, - height = { - type = "range", - name = L["Block height"], - arg = "block.height", - min = 5, max = 50, step = 1, - }, - width = { - type = "range", - name = L["Block width"], - arg = "block.width", - min = 50, max = 250, step = 5, - }, - fontsize = { - type = "range", - name = L["Font size"], - arg = "block.fontsize", - min = 1, max = 24, step = 1, - }, - }, - }, - }, -} -- End coordinate block settings - -options.args.mapcoord = { - type = "group", - name = L["Map Coordinates"], - desc = L["Options that customize the map coordinate display"], - args = { - help = { - order = 1, - type = "description", - name = L["TomTom is capable of displaying the player's coordinates on the world map, as well as the current coordinate position of the cursor. These options can be used to enable or disable these displays"], - }, - player = { - type = "group", - name = L["Player Coordinates"], - args = { - enableplayer = { - order = 1, - type = "toggle", - name = L["Enable player coordinates"], - arg = "mapcoords.playerenable", - }, - playeraccuracy = { - order = 4, - type = "range", - name = L["Player coordinate accuracy"], - desc = L["Coordinates can be displayed as simple XX, YY coordinate, or as more precise XX.XX, YY.YY. This setting allows you to control that precision"], - min = 0, max = 2, step = 1, - arg = "mapcoords.playeraccuracy", - }, - }, - }, - cursor = { - type = "group", - name = L["Cursor Coordinates"], - args = { - enablecursor = { - order = 3, - type = "toggle", - name = L["Enable cursor coordinates"], - arg = "mapcoords.cursorenable", - }, - - cursoraccuracy = { - order = 5, - type = "range", - name = L["Cursor coordinate accuracy"], - desc = L["Coordinates can be displayed as simple XX, YY coordinate, or as more precise XX.XX, YY.YY. This setting allows you to control that precision"], - min = 0, max = 2, step = 1, - arg = "mapcoords.cursoraccuracy", - }, - }, - }, - }, -} -- end map coord options - -options.args.crazytaxi = { - type = "group", - name = L["Waypoint Arrow"], - args = { - help = { - order = 1, - type = "description", - name = L["TomTom provides an arrow that can be placed anywhere on the screen. Similar to the arrow in \"Crazy Taxi\" it will point you towards your next waypoint"], - }, - enable = { - order = 2, - type = "toggle", - name = L["Enable floating waypoint arrow"], - width = "double", - arg = "arrow.enable", - }, - heredistance = { - order = 3, - 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"], - min = 0, max = 150, step = 5, - arg = "arrow.arrival", - }, - lock = { - order = 4, - type = "toggle", - name = L["Lock arrow"], - desc = L["Locks the waypoint arrow, so it can't be moved accidentally"], - arg = "arrow.lock", - }, - arrival = { - order = 5, - type = "toggle", - name = L["Show time to arrival"], - desc = L["Shows an estimate of how long it will take you to reach the waypoint at your current speed"], - arg = "arrow.showtta", - }, - color = { - type = "group", - name = L["Arrow colors"], - args = { - help = { - order = 1, - type = "description", - name = L["The floating waypoint arrow can change color depending on whether or nor you are facing your destination. By default it will display green when you are facing it directly, and red when you are facing away from it. These colors can be changed in this section. Setting these options to the same color will cause the arrow to not change color at all"], - }, - colorstart = { - type = "color", - name = L["Good color"], - arg = "arrow.goodcolor", - hasAlpha = false, - }, - colormiddle = { - type = "color", - name = L["Middle color"], - arg = "arrow.middlecolor", - hasAlpha = false, - }, - colorend = { - type = "color", - name = L["Bad color"], - arg = "arrow.badcolor", - hasAlpha = false, - }, - }, - }, - }, -} -- End crazy taxi options - -options.args.minimap = { - type = "group", - name = L["Minimap"], - args = { - help = { - order = 1, - type = "description", - name = L["TomTom can display multiple waypoint arrows on the minimap. These options control the display of these waypoints"], - }, - enable = { - order = 2, - type = "toggle", - name = L["Enable minimap waypoints"], - width = "double", - arg = "minimap.enable", - }, - otherzone = { - type = "toggle", - name = L["Display waypoints from other zones"], - desc = L["TomTom can hide waypoints in other zones, this setting toggles that functionality"], - width = "double", - arg = "minimap.otherzone", - }, - tooltip = { - type = "toggle", - name = L["Enable mouseover tooltips"], - desc = L["TomTom can display a tooltip containing information abouto waypoints, when they are moused over. This setting toggles that functionality"], - arg = "minimap.tooltip", - }, - - }, -} -- End minimap options - -options.args.worldmap = { - type = "group", - name = L["World Map"], - args = { - help = { - order = 1, - type = "description", - name = L["TomTom can display multiple waypoints on the world map. These options control the display of these waypoints"], - }, - enable = { - order = 2, - type = "toggle", - name = L["Enable world map waypoints"], - width = "double", - arg = "worldmap.enable", - }, - otherzone = { - type = "toggle", - name = L["Display waypoints from other zones"], - desc = L["TomTom can hide waypoints in other zones, this setting toggles that functionality"], - width = "double", - arg = "worldmap.otherzone", - }, - tooltip = { - type = "toggle", - name = L["Enable mouseover tooltips"], - desc = L["TomTom can display a tooltip containing information abouto waypoints, when they are moused over. This setting toggles that functionality"], - arg = "worldmap.tooltip", - }, - createclick = { - type = "toggle", - name = L["Allow control-right clicking on map to create new waypoint"], - width = "double", - arg = "worldmap.clickcreate", - }, - }, -} -- End world map options - -options.args.general = { - type = "group", - name = L["General Options"], - args = { - help = { - order = 1, - type = "description", - name = L["TomTom is able to accept and send waypoints to guild and party members who are also running TomTom. In addition, waypoints may be stored between sessions."], - }, - comm = { - type = "toggle", - name = L["Accept waypoints from guild and party members"], - width = "double", - arg = "comm.enable", - }, - promptcomm = { - type = "toggle", - name = L["Prompt before accepting sent waypoints"], - width = "double", - arg = "comm.prompt", - }, - persistence = { - type = "toggle", - name = L["Save waypoints in between sessions"], - width = "double", - arg = "persistence.savewaypoints", - }, - cleardistance = { - type = "range", - name = L["Clear waypoint distance"], - desc = L["Waypoints can be automatically cleared when you reach them. This slider allows you to customize the distance in yards that signals your \"arrival\" at the waypoint. A setting of 0 turns off the auto-clearing feature\n\nChanging this setting only takes effect after reloading your interface."], - min = 0, max = 150, step = 1, - arg = "persistence.cleardistance", - }, - }, -} - -LibStub("AceConfig-3.0"):RegisterOptionsTable("TomTom", options) -LibStub("AceConfigDialog-3.0"):SetDefaultSize("TomTom", 600, 400) - -SLASH_TOMTOM1 = "/tomtom" -SlashCmdList["TOMTOM"] = function(msg) - LibStub("AceConfigDialog-3.0"):Open("TomTom") -end - diff --git a/Localization.enUS.lua b/Localization.enUS.lua new file mode 100644 index 0000000..32b5d26 --- /dev/null +++ b/Localization.enUS.lua @@ -0,0 +1,6 @@ +--Localization.enUS.lua + +TomTolmLocals = { +} + +setmetatable(TomTomLocals, {__index=function(t,k) rawset(t, k, k) end}) diff --git a/TomTom.lua b/TomTom.lua index d513fb7..9aeeecb 100755 --- a/TomTom.lua +++ b/TomTom.lua @@ -3,7 +3,7 @@ ----------------------------------------------------------------------------]] -- Simple localization table for messages -local L = setmetatable({}, {__index=function(t,k) return k end}) +local L = TomTomLocals local Astrolabe = DongleStub("Astrolabe-0.4") diff --git a/TomTom.toc b/TomTom.toc index 7958a0a..1ecbdcd 100755 --- a/TomTom.toc +++ b/TomTom.toc @@ -12,9 +12,11 @@ libs\CallbackHandler-1.0\CallbackHandler-1.0.xml libs\AceGUI-3.0\AceGUI-3.0.xml libs\AceConfig-3.0\AceConfig-3.0.xml +Localization.enUS.lua + TomTom.lua TomTom_Waypoints.lua TomTom_Zones.lua TomTom_CrazyArrow.lua -Config.lua +TomTom_Config.lua diff --git a/TomTom_Config.lua b/TomTom_Config.lua new file mode 100644 index 0000000..c244f57 --- /dev/null +++ b/TomTom_Config.lua @@ -0,0 +1,349 @@ +local options = {} +local db = {} + +local L = TomTomLocals + +options.type = "group" +options.name = "TomTom" + +function options.get(info) + local ns,opt = string.split(".", info.arg) + local val = TomTom.db.profile[ns][opt] + if type(val) == "table" then + return unpack(val) + else + return val + end +end + +function options.set(info, arg1, arg2, arg3, arg4) + local ns,opt = string.split(".", info.arg) + --TomTom:Print(ns, opt, arg1, arg2, arg3, arg4) + if arg2 then + local entry = TomTom.db.profile[ns][opt] + entry[1] = arg1 + entry[2] = arg2 + entry[3] = arg3 + entry[4] = arg4 + else + TomTom.db.profile[ns][opt] = arg1 + end + + if ns == "block" then + TomTom:ShowHideBlockCoords() + elseif ns == "mapcoords" then + TomTom:ShowHideWorldCoords() + end +end + +options.args = {} + +options.args.coordblock = { + type = "group", + name = L["Coordinate Block"], + desc = L["Options that alter the coordinate block"], + args = { + desc = { + order = 1, + type = "description", + name = L["TomTom provides you with a floating coordinate display that can be used to determine your current position. These options can be used to enable or disable this display, or customize the block's display."], + }, + enable = { + order = 2, + type = "toggle", + name = L["Enable coordinate block"], + desc = L["Enables a floating block that displays your current position in the current zone"], + arg = "block.enable", + }, + accuracy = { + order = 3, + type = "range", + name = "Accuracy", + desc = L["Coordinates can be displayed as simple XX, YY coordinate, or as more precise XX.XX, YY.YY. This setting allows you to control that precision"], + min = 0, max = 2, step = 1, + arg = "block.accuracy", + }, + lock = { + order = 4, + type = "toggle", + name = L["Lock coordinate block"], + arg = "block.lock", + }, + display = { + order = 4, + type = "group", + name = L["Display Settings"], + args = { + bordercolor = { + type = "color", + name = L["Border color"], + arg = "block.bordercolor", + }, + bgcolor = { + type = "color", + name = L["Background color"], + arg = "block.bgcolor", + }, + height = { + type = "range", + name = L["Block height"], + arg = "block.height", + min = 5, max = 50, step = 1, + }, + width = { + type = "range", + name = L["Block width"], + arg = "block.width", + min = 50, max = 250, step = 5, + }, + fontsize = { + type = "range", + name = L["Font size"], + arg = "block.fontsize", + min = 1, max = 24, step = 1, + }, + }, + }, + }, +} -- End coordinate block settings + +options.args.mapcoord = { + type = "group", + name = L["Map Coordinates"], + desc = L["Options that customize the map coordinate display"], + args = { + help = { + order = 1, + type = "description", + name = L["TomTom is capable of displaying the player's coordinates on the world map, as well as the current coordinate position of the cursor. These options can be used to enable or disable these displays"], + }, + player = { + type = "group", + name = L["Player Coordinates"], + args = { + enableplayer = { + order = 1, + type = "toggle", + name = L["Enable player coordinates"], + arg = "mapcoords.playerenable", + }, + playeraccuracy = { + order = 4, + type = "range", + name = L["Player coordinate accuracy"], + desc = L["Coordinates can be displayed as simple XX, YY coordinate, or as more precise XX.XX, YY.YY. This setting allows you to control that precision"], + min = 0, max = 2, step = 1, + arg = "mapcoords.playeraccuracy", + }, + }, + }, + cursor = { + type = "group", + name = L["Cursor Coordinates"], + args = { + enablecursor = { + order = 3, + type = "toggle", + name = L["Enable cursor coordinates"], + arg = "mapcoords.cursorenable", + }, + + cursoraccuracy = { + order = 5, + type = "range", + name = L["Cursor coordinate accuracy"], + desc = L["Coordinates can be displayed as simple XX, YY coordinate, or as more precise XX.XX, YY.YY. This setting allows you to control that precision"], + min = 0, max = 2, step = 1, + arg = "mapcoords.cursoraccuracy", + }, + }, + }, + }, +} -- end map coord options + +options.args.crazytaxi = { + type = "group", + name = L["Waypoint Arrow"], + args = { + help = { + order = 1, + type = "description", + name = L["TomTom provides an arrow that can be placed anywhere on the screen. Similar to the arrow in \"Crazy Taxi\" it will point you towards your next waypoint"], + }, + enable = { + order = 2, + type = "toggle", + name = L["Enable floating waypoint arrow"], + width = "double", + arg = "arrow.enable", + }, + heredistance = { + order = 3, + 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"], + min = 0, max = 150, step = 5, + arg = "arrow.arrival", + }, + lock = { + order = 4, + type = "toggle", + name = L["Lock arrow"], + desc = L["Locks the waypoint arrow, so it can't be moved accidentally"], + arg = "arrow.lock", + }, + arrival = { + order = 5, + type = "toggle", + name = L["Show time to arrival"], + desc = L["Shows an estimate of how long it will take you to reach the waypoint at your current speed"], + arg = "arrow.showtta", + }, + color = { + type = "group", + name = L["Arrow colors"], + args = { + help = { + order = 1, + type = "description", + name = L["The floating waypoint arrow can change color depending on whether or nor you are facing your destination. By default it will display green when you are facing it directly, and red when you are facing away from it. These colors can be changed in this section. Setting these options to the same color will cause the arrow to not change color at all"], + }, + colorstart = { + type = "color", + name = L["Good color"], + arg = "arrow.goodcolor", + hasAlpha = false, + }, + colormiddle = { + type = "color", + name = L["Middle color"], + arg = "arrow.middlecolor", + hasAlpha = false, + }, + colorend = { + type = "color", + name = L["Bad color"], + arg = "arrow.badcolor", + hasAlpha = false, + }, + }, + }, + }, +} -- End crazy taxi options + +options.args.minimap = { + type = "group", + name = L["Minimap"], + args = { + help = { + order = 1, + type = "description", + name = L["TomTom can display multiple waypoint arrows on the minimap. These options control the display of these waypoints"], + }, + enable = { + order = 2, + type = "toggle", + name = L["Enable minimap waypoints"], + width = "double", + arg = "minimap.enable", + }, + otherzone = { + type = "toggle", + name = L["Display waypoints from other zones"], + desc = L["TomTom can hide waypoints in other zones, this setting toggles that functionality"], + width = "double", + arg = "minimap.otherzone", + }, + tooltip = { + type = "toggle", + name = L["Enable mouseover tooltips"], + desc = L["TomTom can display a tooltip containing information abouto waypoints, when they are moused over. This setting toggles that functionality"], + arg = "minimap.tooltip", + }, + + }, +} -- End minimap options + +options.args.worldmap = { + type = "group", + name = L["World Map"], + args = { + help = { + order = 1, + type = "description", + name = L["TomTom can display multiple waypoints on the world map. These options control the display of these waypoints"], + }, + enable = { + order = 2, + type = "toggle", + name = L["Enable world map waypoints"], + width = "double", + arg = "worldmap.enable", + }, + otherzone = { + type = "toggle", + name = L["Display waypoints from other zones"], + desc = L["TomTom can hide waypoints in other zones, this setting toggles that functionality"], + width = "double", + arg = "worldmap.otherzone", + }, + tooltip = { + type = "toggle", + name = L["Enable mouseover tooltips"], + desc = L["TomTom can display a tooltip containing information abouto waypoints, when they are moused over. This setting toggles that functionality"], + arg = "worldmap.tooltip", + }, + createclick = { + type = "toggle", + name = L["Allow control-right clicking on map to create new waypoint"], + width = "double", + arg = "worldmap.clickcreate", + }, + }, +} -- End world map options + +options.args.general = { + type = "group", + name = L["General Options"], + args = { + help = { + order = 1, + type = "description", + name = L["TomTom is able to accept and send waypoints to guild and party members who are also running TomTom. In addition, waypoints may be stored between sessions."], + }, + comm = { + type = "toggle", + name = L["Accept waypoints from guild and party members"], + width = "double", + arg = "comm.enable", + }, + promptcomm = { + type = "toggle", + name = L["Prompt before accepting sent waypoints"], + width = "double", + arg = "comm.prompt", + }, + persistence = { + type = "toggle", + name = L["Save waypoints in between sessions"], + width = "double", + arg = "persistence.savewaypoints", + }, + cleardistance = { + type = "range", + name = L["Clear waypoint distance"], + desc = L["Waypoints can be automatically cleared when you reach them. This slider allows you to customize the distance in yards that signals your \"arrival\" at the waypoint. A setting of 0 turns off the auto-clearing feature\n\nChanging this setting only takes effect after reloading your interface."], + min = 0, max = 150, step = 1, + arg = "persistence.cleardistance", + }, + }, +} + +LibStub("AceConfig-3.0"):RegisterOptionsTable("TomTom", options) +LibStub("AceConfigDialog-3.0"):SetDefaultSize("TomTom", 600, 400) + +SLASH_TOMTOM1 = "/tomtom" +SlashCmdList["TOMTOM"] = function(msg) + LibStub("AceConfigDialog-3.0"):Open("TomTom") +end +