annotate 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
rev   line source
Nenue@34 1 --- ${PACKAGE_NAME}
Nenue@34 2 -- @file-author@
Nenue@34 3 -- @project-revision@ @project-hash@
Nenue@34 4 -- @file-revision@ @file-hash@
Nenue@34 5 -- Created: 4/15/2016 11:36 PM
Nenue@34 6
Nenue@34 7 local B = select(2,...).frame
Nenue@34 8 local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
Nenue@34 9 local setmetatable, type, rawset = setmetatable, type, rawset
Nenue@37 10 local print = B.print('Tracker')
Nenue@37 11 local lprint = B.print('Layout')
Nenue@37 12 local oprint = B.print('Objectives')
Nenue@34 13 T.defaults.Schema = setmetatable({}, {
Nenue@34 14 __newindex = function(schemas,layerName, layerTable)
Nenue@34 15 -- tracker/block/line
Nenue@34 16 if type(layerTable) == 'table' then
Nenue@37 17
Nenue@37 18 print('adding layer', layerName)
Nenue@37 19 for k,v in pairs(layerTable) do
Nenue@37 20 print(' incorporated schema', k)
Nenue@37 21 if type(v) == 'table' and k ~= 'default' then
Nenue@37 22 setmetatable(v, {
Nenue@37 23 __index = function(schemaTable, key)
Nenue@37 24 print(' substituting default "'..tostring(schemas[layerName].default[key])..'" for |cFF00FFFF', layerName..'|r.|cFF0088FF'..k..'|r.'..key)
Nenue@37 25 return schemas[layerName].default[key]
Nenue@37 26 end
Nenue@37 27 })
Nenue@37 28 end
Nenue@37 29 end
Nenue@34 30 rawset(schemas, layerName, setmetatable(layerTable, {
Nenue@34 31 __newindex = function(layerTable, schemaName, schemaTable)
Nenue@34 32 -- schema table
Nenue@34 33 if type(schemaTable) == 'table' then
Nenue@37 34 print('adding schema', schemaName, 'to', layerName, 'layers')
Nenue@37 35
Nenue@37 36
Nenue@34 37 rawset(layerTable, schemaName, setmetatable(schemaTable, {
Nenue@34 38 __index = function(schemaTable, key)
Nenue@37 39 print(' substituting default "'..tostring(schemas[layerName].default[key])..'" for |cFF00FFFF', layerName..'|r.|cFF0088FF'..schemaName..'|r.'..key)
Nenue@37 40 rawset(schemaTable, key, schemas[layerName].default[key])
Nenue@37 41 return schemas[layerName].default[key]
Nenue@34 42 end
Nenue@34 43 }))
Nenue@34 44 end
Nenue@34 45 end,
Nenue@34 46 }))
Nenue@34 47 end
Nenue@34 48 end
Nenue@34 49 })
Nenue@34 50
Nenue@37 51 T.defaults.Schema.tracker = {
Nenue@37 52 default = {
Nenue@37 53 headerbg = {'VERTICAL', 1, 1, 0.5, 0.5, 1, 1, 0.5, 0},
Nenue@37 54 headerFont = {[[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 14, 'OUTLINE'},
Nenue@37 55 blockSpacing = 1,
Nenue@37 56 }
Nenue@37 57 }
Nenue@37 58 T.defaults.Schema.block = {
Nenue@37 59 default = {
Nenue@37 60 titleColor = {1, 0.7, 0, 1},
Nenue@37 61 titlebg = {'HORIZONTAL', 1, 0, .7, 0, 1, 0, .7, .125},
Nenue@37 62 textbg = {'HORIZONTAL', 0, 0, 0, 0, 0, 0, 0, 0.4 },
Nenue@37 63 selectionbg = {'HORIZONTAL', 1, 1, 1, 0, 1, 1, 1, 0.225},
Nenue@37 64 titleFont = {[[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'OUTLINE'},
Nenue@37 65 textFont = {[[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]], 16, 'OUTLINE'},
Nenue@37 66 titleIndent = 4,
Nenue@37 67 titleSpacing = 3,
Nenue@37 68 selectionIndent = 5,
Nenue@37 69 textIndent = 3,
Nenue@37 70 textSpacing = 3,
Nenue@37 71 rewardSize = 24,
Nenue@34 72 },
Nenue@37 73 achievement = {
Nenue@37 74 titleColor = {0, 0.7, 1, 1},
Nenue@34 75 },
Nenue@37 76 achievement_account = {
Nenue@37 77 titleColor = {.35, 0.7, 1, 1},
Nenue@34 78 },
Nenue@37 79 daily = {
Nenue@37 80 titleColor = {0, 0.7, 1, 1},
Nenue@37 81 titlebg = {'HORIZONTAL', 0, .7, 1, .25, 0, 1, .7, .125},
Nenue@37 82 textbg = {'HORIZONTAL', 0, .7, 1, .075, 0, 1, .7, .1},
Nenue@37 83 },
Nenue@37 84 weekly = {
Nenue@37 85 titleColor = {.25, 0.7, 1, 1},
Nenue@37 86 titlebg = {'HORIZONTAL', 0, .35, .7, .25, 0, .35, .7, .125},
Nenue@37 87 textbg = {'HORIZONTAL', 0, .35, .7, .1, 0, .35, .7, .075 },
Nenue@37 88 },
Nenue@37 89 account = {
Nenue@37 90 titlebg = {'HORIZONTAL', .1, .1, .1, .25, .1, .1, .1, .125},
Nenue@37 91 textbg = {'HORIZONTAL', .1, .1, .1, 0.4, .1, .1, .1, .085 },
Nenue@37 92 },
Nenue@37 93 -- alliance
Nenue@37 94 faction_1 = {
Nenue@37 95 titlebg = {'HORIZONTAL', .2, .4, 1, 0.4, .2, .4, 1, .085 },
Nenue@37 96 textbg = {'HORIZONTAL', .2, .4, 1, 0.4, .2, .4, 1, .085 },
Nenue@37 97 },
Nenue@37 98 -- horde
Nenue@37 99 faction_2 = {
Nenue@37 100 titlebg = {'HORIZONTAL', .6, 0, 0.4, 0.4, .6, 0, 0.4, .085 },
Nenue@37 101 textbg = {'HORIZONTAL', .6, 0, 0.4, 0.4, .6, 0, 0.4, .085 },
Nenue@37 102 }
Nenue@37 103 }
Nenue@37 104 T.defaults.Schema.line = {
Nenue@37 105 default = {
Nenue@37 106 textColor = {.5,.75,1},
Nenue@37 107 textSpacing = 3,
Nenue@37 108 textIndent = 3,
Nenue@37 109 },
Nenue@37 110 completed = {
Nenue@37 111 textColor = {0, 1, 0}
Nenue@37 112 },
Nenue@37 113 failed = {
Nenue@37 114 textColor = {1,0,0 }
Nenue@37 115 },
Nenue@37 116 autocomplete = {
Nenue@37 117 textColor = {0,1,0 }
Nenue@37 118 },
Nenue@37 119 objectColor = {
Nenue@37 120 textColor = {0,1,1}
Nenue@37 121 },
Nenue@37 122 monster = {
Nenue@37 123 textColor = {1,1,0}
Nenue@37 124 },
Nenue@37 125 item = {
Nenue@37 126 textColor = {1,.25,.5}
Nenue@37 127 }
Nenue@37 128 }
Nenue@37 129 T.defaults.Schema.widget = {
Nenue@37 130 progressbar = {
Nenue@34 131
Nenue@37 132 },
Nenue@37 133 timer = {
Nenue@34 134
Nenue@37 135 }
Nenue@34 136 }