Mercurial > wow > buffalo2
diff ObjectiveTracker/Schema.lua @ 37:e84d645c8ab8
- revised the tracker update function to build its complete data list up front and use the values as points of comparison for determining possible out of place blocks, which will be iterated over afterward to remove what wasn't re-used
- also entailed revising the exact role of global event handlers and function hooks, limiting their directions of communication so one doesn't end up calling the other multiple or inifinity times
- schema handling polish
author | Nenue |
---|---|
date | Mon, 18 Apr 2016 07:56:23 -0400 |
parents | 69d03f8e293e |
children | 1f8f9cc3d956 |
line wrap: on
line diff
--- a/ObjectiveTracker/Schema.lua Sun Apr 17 13:00:31 2016 -0400 +++ b/ObjectiveTracker/Schema.lua Mon Apr 18 07:56:23 2016 -0400 @@ -7,22 +7,38 @@ local B = select(2,...).frame local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') local setmetatable, type, rawset = setmetatable, type, rawset -local print = B.print('Schema') +local print = B.print('Tracker') +local lprint = B.print('Layout') +local oprint = B.print('Objectives') T.defaults.Schema = setmetatable({}, { __newindex = function(schemas,layerName, layerTable) -- tracker/block/line if type(layerTable) == 'table' then + + print('adding layer', layerName) + for k,v in pairs(layerTable) do + print(' incorporated schema', k) + if type(v) == 'table' and k ~= 'default' then + setmetatable(v, { + __index = function(schemaTable, key) + print(' substituting default "'..tostring(schemas[layerName].default[key])..'" for |cFF00FFFF', layerName..'|r.|cFF0088FF'..k..'|r.'..key) + return schemas[layerName].default[key] + end + }) + end + end rawset(schemas, layerName, setmetatable(layerTable, { - __index = function(layerTable, schemaName) - - end, __newindex = function(layerTable, schemaName, schemaTable) -- schema table if type(schemaTable) == 'table' then + print('adding schema', schemaName, 'to', layerName, 'layers') + + rawset(layerTable, schemaName, setmetatable(schemaTable, { __index = function(schemaTable, key) - print('substituting a default value for |cFF00FFFF', layerName..'|r.|cFF0088FF'..schemaName..'|r.'..key) - return layerTable.default[key] + print(' substituting default "'..tostring(schemas[layerName].default[key])..'" for |cFF00FFFF', layerName..'|r.|cFF0088FF'..schemaName..'|r.'..key) + rawset(schemaTable, key, schemas[layerName].default[key]) + return schemas[layerName].default[key] end })) end @@ -32,81 +48,89 @@ end }) -T.defaults.Schema = { - tracker = { - default = { - headerbg = {'VERTICAL', 1, 1, 0.5, 0.5, 1, 1, 0.5, 0}, - headerFont = {[[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 14, 'OUTLINE'}, - blockSpacing = 1, - } +T.defaults.Schema.tracker = { + default = { + headerbg = {'VERTICAL', 1, 1, 0.5, 0.5, 1, 1, 0.5, 0}, + headerFont = {[[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 14, 'OUTLINE'}, + blockSpacing = 1, + } +} +T.defaults.Schema.block = { + default = { + titleColor = {1, 0.7, 0, 1}, + titlebg = {'HORIZONTAL', 1, 0, .7, 0, 1, 0, .7, .125}, + textbg = {'HORIZONTAL', 0, 0, 0, 0, 0, 0, 0, 0.4 }, + selectionbg = {'HORIZONTAL', 1, 1, 1, 0, 1, 1, 1, 0.225}, + titleFont = {[[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'OUTLINE'}, + textFont = {[[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]], 16, 'OUTLINE'}, + titleIndent = 4, + titleSpacing = 3, + selectionIndent = 5, + textIndent = 3, + textSpacing = 3, + rewardSize = 24, }, - block = { - default = { - titlebg = {'HORIZONTAL', 1, 0, .7, 0, 1, 0, .7, .125}, - textbg = {'HORIZONTAL', 0, 0, 0, 0.4, 0, 0, 0, 0 }, - selectionbg = {'HORIZONTAL', 1, 1, 1, 0, 1, 1, 1, 0.225}, - titleFont = {[[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'OUTLINE'}, - textFont = {[[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]], 16, 'OUTLINE'}, - titleIndent = 4, - titleSpacing = 3, - textIndent = 3, - textSpacing = 3, - rewardSize = 24, - }, - daily = { - titlebg = {'HORIZONTAL', 0, .7, 1, .25, 0, 1, .7, .125}, - textbg = {'HORIZONTAL', 0, .7, 1, .1, 0, 1, .7, .075 }, - }, - weekly = { - titlebg = {'HORIZONTAL', 0, .35, .7, .25, 0, .35, .7, .125}, - textbg = {'HORIZONTAL', 0, .35, .7, .1, 0, .35, .7, .075 }, - }, - account = { - titlebg = {'HORIZONTAL', .1, .1, .1, .25, .1, .1, .1, .125}, - textbg = {'HORIZONTAL', .1, .1, .1, 0.4, .1, .1, .1, .085 }, - }, - -- alliance - faction_1 = { - titlebg = {'HORIZONTAL', .2, .4, 1, 0.4, .2, .4, 1, .085 }, - textbg = {'HORIZONTAL', .2, .4, 1, 0.4, .2, .4, 1, .085 }, - }, - -- horde - faction_2 = { - titlebg = {'HORIZONTAL', .6, 0, 0.4, 0.4, .6, 0, 0.4, .085 }, - textbg = {'HORIZONTAL', .6, 0, 0.4, 0.4, .6, 0, 0.4, .085 }, - } + achievement = { + titleColor = {0, 0.7, 1, 1}, }, - line = { - default = { - textColor = {.5,.75,1}, - textSpacing = 3, - textIndent = 3, - }, - completed = { - textColor = {0, 1, 0} - }, - failed = { - textColor = {1,0,0 } - }, - autocomplete = { - textColor = {0,1,0 } - }, - objectColor = { - textColor = {0,1,1} - }, - monster = { - textColor = {1,1,0} - }, - item = { - textColor = {1,.25,.5} - } + achievement_account = { + titleColor = {.35, 0.7, 1, 1}, }, - widget = { - progressbar = { + daily = { + titleColor = {0, 0.7, 1, 1}, + titlebg = {'HORIZONTAL', 0, .7, 1, .25, 0, 1, .7, .125}, + textbg = {'HORIZONTAL', 0, .7, 1, .075, 0, 1, .7, .1}, + }, + weekly = { + titleColor = {.25, 0.7, 1, 1}, + titlebg = {'HORIZONTAL', 0, .35, .7, .25, 0, .35, .7, .125}, + textbg = {'HORIZONTAL', 0, .35, .7, .1, 0, .35, .7, .075 }, + }, + account = { + titlebg = {'HORIZONTAL', .1, .1, .1, .25, .1, .1, .1, .125}, + textbg = {'HORIZONTAL', .1, .1, .1, 0.4, .1, .1, .1, .085 }, + }, + -- alliance + faction_1 = { + titlebg = {'HORIZONTAL', .2, .4, 1, 0.4, .2, .4, 1, .085 }, + textbg = {'HORIZONTAL', .2, .4, 1, 0.4, .2, .4, 1, .085 }, + }, + -- horde + faction_2 = { + titlebg = {'HORIZONTAL', .6, 0, 0.4, 0.4, .6, 0, 0.4, .085 }, + textbg = {'HORIZONTAL', .6, 0, 0.4, 0.4, .6, 0, 0.4, .085 }, + } +} +T.defaults.Schema.line = { + default = { + textColor = {.5,.75,1}, + textSpacing = 3, + textIndent = 3, + }, + completed = { + textColor = {0, 1, 0} + }, + failed = { + textColor = {1,0,0 } + }, + autocomplete = { + textColor = {0,1,0 } + }, + objectColor = { + textColor = {0,1,1} + }, + monster = { + textColor = {1,1,0} + }, + item = { + textColor = {1,.25,.5} + } +} +T.defaults.Schema.widget = { + progressbar = { - }, - timer = { + }, + timer = { - } - }, + } } \ No newline at end of file