From a188d72e5ee3a9681fd6cc9bd694146763ff83f0 Mon Sep 17 00:00:00 2001 From: Xruptor Date: Mon, 22 Aug 2016 00:00:13 -0400 Subject: [PATCH] Reworked the configuration screen again. -Decided to move to Ace3 for the options screen. Ace3 provides a nice widget framework that saves me lots of trouble. -Edited a few of the localization entries. I made a few of them more concise and to the point. Others I changed the wording around. My localization pals out there will have to make the changes. -Fix a few things with the new BagSync color options. -Now I just need to find a good GIT mirror for the Ace3 libraries. Since they use SVN instead. --- BagSync.lua | 45 +- BagSync.toc | 3 +- libs/AceConfig-3.0/AceConfig-3.0.lua | 57 + libs/AceConfig-3.0/AceConfig-3.0.xml | 8 + .../AceConfigCmd-3.0/AceConfigCmd-3.0.lua | 794 ++++++++ .../AceConfigCmd-3.0/AceConfigCmd-3.0.xml | 4 + .../AceConfigDialog-3.0/AceConfigDialog-3.0.lua | 1955 ++++++++++++++++++++ .../AceConfigDialog-3.0/AceConfigDialog-3.0.xml | 4 + .../AceConfigRegistry-3.0.lua | 349 ++++ .../AceConfigRegistry-3.0.xml | 4 + libs/AceGUI-3.0/AceGUI-3.0.lua | 813 ++++++++ libs/AceGUI-3.0/AceGUI-3.0.xml | 28 + .../widgets/AceGUIContainer-BlizOptionsGroup.lua | 138 ++ .../widgets/AceGUIContainer-DropDownGroup.lua | 157 ++ libs/AceGUI-3.0/widgets/AceGUIContainer-Frame.lua | 311 ++++ .../widgets/AceGUIContainer-InlineGroup.lua | 103 ++ .../widgets/AceGUIContainer-ScrollFrame.lua | 210 +++ .../widgets/AceGUIContainer-SimpleGroup.lua | 69 + .../widgets/AceGUIContainer-TabGroup.lua | 350 ++++ .../widgets/AceGUIContainer-TreeGroup.lua | 717 +++++++ libs/AceGUI-3.0/widgets/AceGUIContainer-Window.lua | 331 ++++ libs/AceGUI-3.0/widgets/AceGUIWidget-Button.lua | 103 ++ libs/AceGUI-3.0/widgets/AceGUIWidget-CheckBox.lua | 295 +++ .../widgets/AceGUIWidget-ColorPicker.lua | 194 ++ .../widgets/AceGUIWidget-DropDown-Items.lua | 477 +++++ libs/AceGUI-3.0/widgets/AceGUIWidget-DropDown.lua | 737 ++++++++ libs/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua | 265 +++ libs/AceGUI-3.0/widgets/AceGUIWidget-Heading.lua | 78 + libs/AceGUI-3.0/widgets/AceGUIWidget-Icon.lua | 140 ++ .../widgets/AceGUIWidget-InteractiveLabel.lua | 101 + .../AceGUI-3.0/widgets/AceGUIWidget-Keybinding.lua | 249 +++ libs/AceGUI-3.0/widgets/AceGUIWidget-Label.lua | 166 ++ .../widgets/AceGUIWidget-MultiLineEditBox.lua | 366 ++++ libs/AceGUI-3.0/widgets/AceGUIWidget-Slider.lua | 285 +++ .../Changelog-LibSimpleOptions-1.0-r46.txt | 15 - libs/LibSimpleOptions-1.0/LibSimpleOptions-1.0.lua | 961 ---------- libs/LibSimpleOptions-1.0/LibSimpleOptions-1.0.toc | 15 - libs/LibSimpleOptions-1.0/LibStub/LibStub.lua | 30 - libs/LibSimpleOptions-1.0/lib.xml | 4 - localization/localization.lua | 122 +- modules/config.lua | 511 ++--- modules/tokens.lua | 2 +- 42 files changed, 10227 insertions(+), 1339 deletions(-) create mode 100644 libs/AceConfig-3.0/AceConfig-3.0.lua create mode 100644 libs/AceConfig-3.0/AceConfig-3.0.xml create mode 100644 libs/AceConfig-3.0/AceConfigCmd-3.0/AceConfigCmd-3.0.lua create mode 100644 libs/AceConfig-3.0/AceConfigCmd-3.0/AceConfigCmd-3.0.xml create mode 100644 libs/AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.lua create mode 100644 libs/AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.xml create mode 100644 libs/AceConfig-3.0/AceConfigRegistry-3.0/AceConfigRegistry-3.0.lua create mode 100644 libs/AceConfig-3.0/AceConfigRegistry-3.0/AceConfigRegistry-3.0.xml create mode 100644 libs/AceGUI-3.0/AceGUI-3.0.lua create mode 100644 libs/AceGUI-3.0/AceGUI-3.0.xml create mode 100644 libs/AceGUI-3.0/widgets/AceGUIContainer-BlizOptionsGroup.lua create mode 100644 libs/AceGUI-3.0/widgets/AceGUIContainer-DropDownGroup.lua create mode 100644 libs/AceGUI-3.0/widgets/AceGUIContainer-Frame.lua create mode 100644 libs/AceGUI-3.0/widgets/AceGUIContainer-InlineGroup.lua create mode 100644 libs/AceGUI-3.0/widgets/AceGUIContainer-ScrollFrame.lua create mode 100644 libs/AceGUI-3.0/widgets/AceGUIContainer-SimpleGroup.lua create mode 100644 libs/AceGUI-3.0/widgets/AceGUIContainer-TabGroup.lua create mode 100644 libs/AceGUI-3.0/widgets/AceGUIContainer-TreeGroup.lua create mode 100644 libs/AceGUI-3.0/widgets/AceGUIContainer-Window.lua create mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-Button.lua create mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-CheckBox.lua create mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-ColorPicker.lua create mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-DropDown-Items.lua create mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-DropDown.lua create mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua create mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-Heading.lua create mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-Icon.lua create mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-InteractiveLabel.lua create mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-Keybinding.lua create mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-Label.lua create mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-MultiLineEditBox.lua create mode 100644 libs/AceGUI-3.0/widgets/AceGUIWidget-Slider.lua delete mode 100644 libs/LibSimpleOptions-1.0/Changelog-LibSimpleOptions-1.0-r46.txt delete mode 100644 libs/LibSimpleOptions-1.0/LibSimpleOptions-1.0.lua delete mode 100644 libs/LibSimpleOptions-1.0/LibSimpleOptions-1.0.toc delete mode 100644 libs/LibSimpleOptions-1.0/LibStub/LibStub.lua delete mode 100644 libs/LibSimpleOptions-1.0/lib.xml diff --git a/BagSync.lua b/BagSync.lua index c643816..1017b23 100644 --- a/BagSync.lua +++ b/BagSync.lua @@ -139,12 +139,12 @@ local function StartupDB() --setup the default colors if BagSyncOpt.colors == nil then BagSyncOpt.colors = {} end - if BagSyncOpt.colors.FIRST == nil then BagSyncOpt.colors.FIRST = { r = 128/255, g = 1, b = 0 } end - if BagSyncOpt.colors.SECOND == nil then BagSyncOpt.colors.SECOND = { r = 199/255, g = 199/255, b = 207/255 } end - if BagSyncOpt.colors.TOTAL == nil then BagSyncOpt.colors.TOTAL = { r = 244/255, g = 164/255, b = 96/255 } end - if BagSyncOpt.colors.GUILD == nil then BagSyncOpt.colors.GUILD = { r = 101/255, g = 184/255, b = 192/255 } end - if BagSyncOpt.colors.CROSS == nil then BagSyncOpt.colors.CROSS = { r = 1, g = 125/255, b = 10/255 } end - if BagSyncOpt.colors.BNET == nil then BagSyncOpt.colors.BNET = { r = 53/255, g = 136/255, b = 1 } end + if BagSyncOpt.colors.first == nil then BagSyncOpt.colors.first = { r = 128/255, g = 1, b = 0 } end + if BagSyncOpt.colors.second == nil then BagSyncOpt.colors.second = { r = 199/255, g = 199/255, b = 207/255 } end + if BagSyncOpt.colors.total == nil then BagSyncOpt.colors.total = { r = 244/255, g = 164/255, b = 96/255 } end + if BagSyncOpt.colors.guild == nil then BagSyncOpt.colors.guild = { r = 101/255, g = 184/255, b = 192/255 } end + if BagSyncOpt.colors.cross == nil then BagSyncOpt.colors.cross = { r = 1, g = 125/255, b = 10/255 } end + if BagSyncOpt.colors.bnet == nil then BagSyncOpt.colors.bnet = { r = 53/255, g = 136/255, b = 1 } end --new format, get rid of old if not BagSyncOpt.dbversion or not tonumber(BagSyncOpt.dbversion) or tonumber(BagSyncOpt.dbversion) < 7 then @@ -342,16 +342,16 @@ function BagSync:getCharacterRealmInfo(charName, charRealm) if BagSyncOpt.enableBNetAccountItems then if charRealm and charRealm ~= currentRealm then if not crossRealmNames[charRealm] then - charName = yName.." "..rgbhex(BagSyncOpt.colors.BNET).."[BNet-"..realmFullName.."]|r" + charName = yName.." "..rgbhex(BagSyncOpt.colors.bnet).."[BNet-"..realmFullName.."]|r" else - charName = yName.." "..rgbhex(BagSyncOpt.colors.CROSS).."[XR-"..realmFullName.."]|r" + charName = yName.." "..rgbhex(BagSyncOpt.colors.cross).."[XR-"..realmFullName.."]|r" end else charName = yName end elseif BagSyncOpt.enableCrossRealmsItems then if charRealm and charRealm ~= currentRealm then - charName = yName.." "..rgbhex(BagSyncOpt.colors.CROSS).."[XR-"..realmFullName.."]|r" + charName = yName.." "..rgbhex(BagSyncOpt.colors.cross).."[XR-"..realmFullName.."]|r" else charName = yName end @@ -373,16 +373,16 @@ function BagSync:getGuildRealmInfo(guildName, guildRealm) if BagSyncOpt.enableBNetAccountItems then if guildRealm and guildRealm ~= currentRealm then if not crossRealmNames[guildRealm] then - guildName = guildName.." "..rgbhex(BagSyncOpt.colors.BNET).."[BNet-"..realmFullName.."]|r" + guildName = guildName.." "..rgbhex(BagSyncOpt.colors.bnet).."[BNet-"..realmFullName.."]|r" else - guildName = guildName.." "..rgbhex(BagSyncOpt.colors.CROSS).."[XR-"..realmFullName.."]|r" + guildName = guildName.." "..rgbhex(BagSyncOpt.colors.cross).."[XR-"..realmFullName.."]|r" end else guildName = guildName end elseif BagSyncOpt.enableCrossRealmsItems then if guildRealm and guildRealm ~= currentRealm then - guildName = guildName.." "..rgbhex(BagSyncOpt.colors.CROSS).."[XR-"..realmFullName.."]|r" + guildName = guildName.." "..rgbhex(BagSyncOpt.colors.cross).."[XR-"..realmFullName.."]|r" else guildName = guildName end @@ -747,7 +747,7 @@ function BagSync:ShowMoneyTooltip() end if BagSyncOpt.showTotal and gldTotal > 0 then tooltip:AddLine(" ") - tooltip:AddDoubleLine(tooltipColor(BagSyncOpt.colors.TOTAL, buildMoneyString(gldTotal, false)), 1, 1, 1, 1, 1, 1) + tooltip:AddDoubleLine(tooltipColor(BagSyncOpt.colors.total, buildMoneyString(gldTotal, false)), 1, 1, 1, 1, 1, 1) end tooltip:AddLine(" ") @@ -916,10 +916,10 @@ local function CountsToInfoString(countTable) end if not totalPass then - local totalStr = tooltipColor(BagSyncOpt.colors.FIRST, total) - return totalStr .. tooltipColor(BagSyncOpt.colors.SECOND, format(" (%s)", info)) + local totalStr = tooltipColor(BagSyncOpt.colors.first, total) + return totalStr .. tooltipColor(BagSyncOpt.colors.second, format(" (%s)", info)) else - return tooltipColor(BagSyncOpt.colors.FIRST, info) + return tooltipColor(BagSyncOpt.colors.first, info) end end end @@ -941,13 +941,13 @@ end local function getNameColor(sName, sClass) if not BagSyncOpt.enableUnitClass then - return tooltipColor(BagSyncOpt.colors.FIRST, sName) + return tooltipColor(BagSyncOpt.colors.first, sName) else if sName ~= "Unknown" and sClass and RAID_CLASS_COLORS[sClass] then return rgbhex(RAID_CLASS_COLORS[sClass])..sName.."|r" end end - return tooltipColor(BagSyncOpt.colors.FIRST, sName) + return tooltipColor(BagSyncOpt.colors.first, sName) end local function getPlayerNameColor(sName) @@ -955,7 +955,7 @@ local function getPlayerNameColor(sName) local sClass = BagSyncDB[currentRealm][sName].class return getNameColor(sName, sClass) end - return tooltipColor(BagSyncOpt.colors.FIRST, sName) + return tooltipColor(BagSyncOpt.colors.first, sName) end local function AddCurrencyToTooltip(frame, currencyName) @@ -1106,7 +1106,7 @@ local function AddItemToTooltip(frame, link) --workaround for k, v in pairsByKeys(previousGuilds) do --only print stuff higher then zero if v > 0 then - table.insert(lastDisplayed, tooltipColor(BagSyncOpt.colors.GUILD, k).."@"..tooltipColor(BagSyncOpt.colors.SECOND, v)) + table.insert(lastDisplayed, tooltipColor(BagSyncOpt.colors.guild, k).."@"..tooltipColor(BagSyncOpt.colors.second, v)) end end end @@ -1114,7 +1114,7 @@ local function AddItemToTooltip(frame, link) --workaround --show grand total if we have something --don't show total if there is only one item if BagSyncOpt.showTotal and grandTotal > 0 and getn(lastDisplayed) > 1 then - table.insert(lastDisplayed, tooltipColor(BagSyncOpt.colors.TOTAL, L["Total:"]).."@"..tooltipColor(BagSyncOpt.colors.SECOND, grandTotal)) + table.insert(lastDisplayed, tooltipColor(BagSyncOpt.colors.total, L["Total:"]).."@"..tooltipColor(BagSyncOpt.colors.second, grandTotal)) end --now check for seperater and only add if we have something in the table already @@ -1311,9 +1311,6 @@ function BagSync:PLAYER_LOGIN() --initiate the db StartupDB() - --load the options menu - BSOpt_Startup() - --do DB cleanup check by version number if not BagSyncOpt.dbversion or BagSyncOpt.dbversion ~= ver then self:FixDB_Data() diff --git a/BagSync.toc b/BagSync.toc index 9a7df90..37dea92 100644 --- a/BagSync.toc +++ b/BagSync.toc @@ -9,11 +9,12 @@ localization\localization.lua libs\LibStub\LibStub.lua libs\CallbackHandler-1.0\CallbackHandler-1.0.xml +libs\AceGUI-3.0\AceGUI-3.0.xml +libs\AceConfig-3.0\AceConfig-3.0.xml libs\Unfit-1.0\Unfit-1.0.lua libs\CustomSearch-1.0\CustomSearch-1.0.lua libs\LibItemSearch-1.2\LibItemSearch-1.2.lua libs\LibDataBroker-1.1\LibDataBroker-1.1.lua -libs\LibSimpleOptions-1.0\LibSimpleOptions-1.0.lua libs\tekKonfigScroll.lua modules\minimap.lua modules\search.lua diff --git a/libs/AceConfig-3.0/AceConfig-3.0.lua b/libs/AceConfig-3.0/AceConfig-3.0.lua new file mode 100644 index 0000000..3bedf8c --- /dev/null +++ b/libs/AceConfig-3.0/AceConfig-3.0.lua @@ -0,0 +1,57 @@ +--- AceConfig-3.0 wrapper library. +-- Provides an API to register an options table with the config registry, +-- as well as associate it with a slash command. +-- @class file +-- @name AceConfig-3.0 +-- @release $Id: AceConfig-3.0.lua 969 2010-10-07 02:11:48Z shefki $ + +--[[ +AceConfig-3.0 + +Very light wrapper library that combines all the AceConfig subcomponents into one more easily used whole. + +]] + +local MAJOR, MINOR = "AceConfig-3.0", 2 +local AceConfig = LibStub:NewLibrary(MAJOR, MINOR) + +if not AceConfig then return end + +local cfgreg = LibStub("AceConfigRegistry-3.0") +local cfgcmd = LibStub("AceConfigCmd-3.0") +--TODO: local cfgdlg = LibStub("AceConfigDialog-3.0", true) +--TODO: local cfgdrp = LibStub("AceConfigDropdown-3.0", true) + +-- Lua APIs +local pcall, error, type, pairs = pcall, error, type, pairs + +-- ------------------------------------------------------------------- +-- :RegisterOptionsTable(appName, options, slashcmd, persist) +-- +-- - appName - (string) application name +-- - options - table or function ref, see AceConfigRegistry +-- - slashcmd - slash command (string) or table with commands, or nil to NOT create a slash command + +--- Register a option table with the AceConfig registry. +-- You can supply a slash command (or a table of slash commands) to register with AceConfigCmd directly. +-- @paramsig appName, options [, slashcmd] +-- @param appName The application name for the config table. +-- @param options The option table (or a function to generate one on demand). http://www.wowace.com/addons/ace3/pages/ace-config-3-0-options-tables/ +-- @param slashcmd A slash command to register for the option table, or a table of slash commands. +-- @usage +-- local AceConfig = LibStub("AceConfig-3.0") +-- AceConfig:RegisterOptionsTable("MyAddon", myOptions, {"/myslash", "/my"}) +function AceConfig:RegisterOptionsTable(appName, options, slashcmd) + local ok,msg = pcall(cfgreg.RegisterOptionsTable, self, appName, options) + if not ok then error(msg, 2) end + + if slashcmd then + if type(slashcmd) == "table" then + for _,cmd in pairs(slashcmd) do + cfgcmd:CreateChatCommand(cmd, appName) + end + else + cfgcmd:CreateChatCommand(slashcmd, appName) + end + end +end diff --git a/libs/AceConfig-3.0/AceConfig-3.0.xml b/libs/AceConfig-3.0/AceConfig-3.0.xml new file mode 100644 index 0000000..87972ad --- /dev/null +++ b/libs/AceConfig-3.0/AceConfig-3.0.xml @@ -0,0 +1,8 @@ + + + + + +