diff --git a/Modules/LCDDisplay.lua b/Modules/LCDDisplay.lua new file mode 100644 index 0000000..dfed98d --- /dev/null +++ b/Modules/LCDDisplay.lua @@ -0,0 +1,44 @@ +local mod = StarTip:NewModule("LCDDisplay") +mod.name = "LCDDisplay" +mod.toggled = true +mod.defaultOff = true +local Evaluator = LibStub("StarLibEvaluator-1.0") +local LibCore = LibStub("StarLibCore-1.0") +local LibLCDText = LibStub("StarLibLCDText-1.0") +local LibDriverQTip = LibStub("StarLibDriverQTip-1.0") + +mod.name = "LCDDisplay" +mod.toggled = true +local _G = _G +local GameTooltip = _G.GameTooltip +local cores = {} +local coresDict = {} +local config = {} +local defaults = {profile= {cores={}}} + +function mod:OnInitialize() + self.db = StarTip.db:RegisterNamespace(self:GetName(), defaults) + + self.config = Evaluator.ExecuteCode({}, mod:GetName(), StarTip.config) + + self.lcd = LibDriverQTip:New(self, "display_startip", self.config, StarTip.db.profile.errorLevel) + self.lcd.core:CFGSetup() + self.lcd.core:BuildLayouts() + +end + +function mod:OnEnable() + self.lcd.core:StartLayout() + self.lcd:Show() +end + +function mod:OnDisable() + self.lcd.core:StopLayout() + self.lcd:Hide() +end + +function mod:AddLCD(core) + tinsert(coresList, core) + coresDict[core.name] = {core=core, i = #coresList} + self:RebuildOpts() +end \ No newline at end of file diff --git a/Modules/Text.lua b/Modules/Text.lua index eec278c..3f3fea1 100644 --- a/Modules/Text.lua +++ b/Modules/Text.lua @@ -31,30 +31,6 @@ environment.new = StarTip.new environment.newDict = StarTip.newDict environment.del = StarTip.del environment._G = _G -environment.UnitExists = _G.UnitExists -environment.UnitIsPlayer = _G.UnitIsPlayer -environment.UnitBuff = _G.UnitBuff -environment.GetSpellInfo = _G.GetSpellInfo -environment.UnitIsConnected = _G.UnitIsConnected -environment.UnitIsFeignDeath = _G.UnitIsFeignDeath -environment.UnitIsGhost = _G.UnitIsGhost -environment.UnitIsDead = _G.UnitIsDead -environment.UnitLevel = _G.UnitLevel -environment.UnitClassification = _G.UnitClassification -environment.UnitSelectionColor = _G.UnitSelectionColor -environment.UnitRace = _G.UnitRace -environment.GetGuildInfo = _G.GetGuildInfo -environment.UnitName = _G.UnitName -environment.UnitClass = _G.UnitClass -environment.UnitHealth = _G.UnitHealth -environment.UnitHealthMax = _G.UnitHealthMax -environment.UnitMana = _G.UnitMana -environment.UnitManaMax = _G.UnitManaMax -environment.UnitFactionGroup = _G.UnitFactionGroup -environment.UnitCreatureFamily = _G.UnitCreatureFamily -environment.UnitCreatureType = _G.UnitCreatureType -environment.UnitIsUnit = _G.UnitIsUnit -environment.RAID_CLASS_COLORS = _G.RAID_CLASS_COLORS local LSM = _G.LibStub("LibSharedMedia-3.0") local factionList = {} local linesToAdd = {} @@ -460,7 +436,8 @@ function mod:OnInitialize() StarTip:SetOptionsDisabled(options, true) -- create our core object. Note that we must provide it with an LCD after it is created. - self.core = LibCore:New(mod, environment, name, config, "text", StarTip.db.profile.errorLevel) + + self.core = LibCore:New(mod, environment, self:GetName(), {[self:GetName()] = {}}, "text", StarTip.db.profile.errorLevel) self.lcd = LCDText:New(self.core, 1, 0, 0, 0, 0, 0) self.core.lcd = self.lcd @@ -576,8 +553,8 @@ function mod:CreateLines() if not v.leftObj or v.lineNum ~= lineNum then if v.leftObj then v.leftObj:Del() end - v.string = v.left - v.leftObj = WidgetText:New(mod.core, v.name .. "left", v, 0, 0, v.layer or 0, environment, StarTip.db.profile.errorLevel, updateFontString, mod.leftLines[lineNum]) + v.value = v.left + v.leftObj = WidgetText:New(mod.core, v.name .. "left", v, 0, 0, v.layer or 0, StarTip.db.profile.errorLevel, updateFontString, mod.leftLines[lineNum]) v.leftObj.visitor.lcd = self.lcd v.leftObj:Start() else @@ -592,8 +569,8 @@ function mod:CreateLines() if not v.rightObj or v.lineNum ~= lineNum then if v.rightObj then v.rightObj:Del() end - v.string = v.right - v.rightObj = WidgetText:New(mod.core, v.name .. "right", v, 0, 0, v.layer or 0, environment, StarTip.db.profile.errorLevel, updateFontString, mod.rightLines[lineNum]) + v.value = v.right + v.rightObj = WidgetText:New(mod.core, v.name .. "right", v, 0, 0, v.layer or 0, StarTip.db.profile.errorLevel, updateFontString, mod.rightLines[lineNum]) v.rightObj.visitor.lcd = self.lcd v.rightObj:Start() @@ -611,8 +588,8 @@ function mod:CreateLines() if not v.leftObj or v.lineNum ~= lineNum then if v.leftObj then v.leftObj:Del() end - v.string = v.left - v.leftObj = WidgetText:New(mod.core, v.name, v, 0, 0, 0, environment, StarTip.db.profile.errorLevel, updateFontString, mod.leftLines[lineNum]) + v.value = v.left + v.leftObj = WidgetText:New(mod.core, v.name, v, 0, 0, 0, StarTip.db.profile.errorLevel, updateFontString, mod.leftLines[lineNum]) v.leftObj.visitor.lcd = lcd v.leftObj:Start() v.lineNum = lineNum diff --git a/StarTip.toc b/StarTip.toc index de0406f..2ac1a67 100644 --- a/StarTip.toc +++ b/StarTip.toc @@ -31,4 +31,7 @@ Modules\Targeting.lua Modules\Text.lua Modules\DeadlyAnnounce.lua Modules\Talents.lua +Modules\LCDDisplay.lua + +config.lua diff --git a/config.lua b/config.lua index 1af2fe1..925a0c4 100644 --- a/config.lua +++ b/config.lua @@ -1,181 +1,202 @@ -StarLib.config = [[ +StarTip.config = [[ local foo = 500 -config = { - "display_startip": { - "driver": "startip", - "layers": 3, - "background": "d9ccf16f", - "rows": 4, - "cols": 20, - "layout-timeout": 0, - "update": 25, - "widget0": "widget_key_up", - "widget1": "widget_key_down", - "transition-speed": 50, - "refresh-rate": 25, - "layout0": "layout_startip" +return { + ["display_startip"] = { + ["driver"] = "startip", + ["layers"] = 3, + ["background"] = "d9ccf16f", + ["rows"] = 2, + ["cols"] = 20, + ["layout-timeout"] = 0, + ["update"] = 25, + ["widget0"] = "widget_key_up", + ["widget1"] = "widget_key_down", + ["transition-speed"] = 50, + ["refresh-rate"] = 25, + ["layout0"] = "layout_startip" }, - "layout_blank": { - "keyless": 1, - "layout-timeout": 0 + ["layout_blank"] = { + ["keyless"] = 1, + ["layout-timeout"] = 0 }, - "layout_startip": { - "row1": { - "col1": "widget_cpu_label", - //"col11": "widget_cpu_histogram", - "col6": "widget_cpu" + ["layout_startip"] = { + ["row1"] = { + ["col1"] = "widget_name_label", + ["col10"] = "widget_name" }, - "row2": { - "col1": "widget_wlan0_label", - //"col11": "widget_wlan0_histogram", - "col7": "widget_wlan0" + ["row2"] = { + ["col1"] = "widget_class_label", + ["col10"] = "widget_class" }, - "row3": { - }, - "row4": { - "col1": "widget_bottom_ticker" - }, - "transition": "U" + ["transition"] = "U" }, - "widget_icon_blob": { - "bitmap": { - "row1": ".....|.....|.....", - "row2": ".....|.....|.***.", - "row3": ".....|.***.|*...*", - "row4": "..*..|.*.*.|*...*", - "row5": ".....|.***.|*...*", - "row6": ".....|.....|.***.", - "row7": ".....|.....|.....", - "row8": ".....|.....|....." + ["widget_name_label"] = { + type = "text", + value = 'return "Name:"', + prefix = '', + postfix = '', + precision = 0xbabe, + align = ALIGN_LEFT, + update = 0, + speed = 0, + direction = SCROLL_RIGHT, + cols = 5, + color = "return 0xffffffff" + }, + ["widget_name"] = { + type = "text", + value = "return UnitName('player')", + cols = 10 + }, + ["widget_class_label"] = { + type = "text", + value = 'return "Class:"', + cols = 7 + }, + ["widget_class"] = { + type = "text", + value = "return UnitClass('player')", + cols = 10 + }, + ["widget_icon_blob"] = { + ["bitmap"] = { + ["row1"] = ".....|.....|.....", + ["row2"] = ".....|.....|.***.", + ["row3"] = ".....|.***.|*...*", + ["row4"] = "..*..|.*.*.|*...*", + ["row5"] = ".....|.***.|*...*", + ["row6"] = ".....|.....|.***.", + ["row7"] = ".....|.....|.....", + ["row8"] = ".....|.....|....." }, - "speed": "return foo", - "type": "icon" + ["speed"] = "return foo", + ["type"] = "icon" }, - "widget_icon_ekg": { - "bitmap": { - "row1": ".....|.....|.....|.....|.....|.....|.....|.....", - "row2": ".....|....*|...*.|..*..|.*...|*....|.....|.....", - "row3": ".....|....*|...*.|..*..|.*...|*....|.....|.....", - "row4": ".....|....*|...**|..**.|.**..|**...|*....|.....", - "row5": ".....|....*|...**|..**.|.**..|**...|*....|.....", - "row6": ".....|....*|...*.|..*.*|.*.*.|*.*..|.*...|*....", - "row7": "*****|*****|****.|***..|**..*|*..**|..***|.****", - "row8": ".....|.....|.....|.....|.....|.....|.....|....." + ["widget_icon_ekg"] = { + ["bitmap"] = { + ["row1"] = ".....|.....|.....|.....|.....|.....|.....|.....", + ["row2"] = ".....|....*|...*.|..*..|.*...|*....|.....|.....", + ["row3"] = ".....|....*|...*.|..*..|.*...|*....|.....|.....", + ["row4"] = ".....|....*|...**|..**.|.**..|**...|*....|.....", + ["row5"] = ".....|....*|...**|..**.|.**..|**...|*....|.....", + ["row6"] = ".....|....*|...*.|..*.*|.*.*.|*.*..|.*...|*....", + ["row7"] = "*****|*****|****.|***..|**..*|*..**|..***|.****", + ["row8"] = ".....|.....|.....|.....|.....|.....|.....|....." }, - "speed": "return foo", - "type": "icon" + ["speed"] = "return foo", + ["type"] = "icon" }, - "widget_icon_heart": { - "bitmap": { - "row1": ".....|.....|.....|.....|.....|.....", - "row2": ".*.*.|.....|.*.*.|.....|.....|.....", - "row3": "*****|.*.*.|*****|.*.*.|.*.*.|.*.*.", - "row4": "*****|.***.|*****|.***.|.***.|.***.", - "row5": ".***.|.***.|.***.|.***.|.***.|.***.", - "row6": ".***.|..*..|.***.|..*..|..*..|..*..", - "row7": "..*..|.....|..*..|.....|.....|.....", - "row8": ".....|.....|.....|.....|.....|....." + ["widget_icon_heart"] = { + ["bitmap"] = { + ["row1"] = ".....|.....|.....|.....|.....|.....", + ["row2"] = ".*.*.|.....|.*.*.|.....|.....|.....", + ["row3"] = "*****|.*.*.|*****|.*.*.|.*.*.|.*.*.", + ["row4"] = "*****|.***.|*****|.***.|.***.|.***.", + ["row5"] = ".***.|.***.|.***.|.***.|.***.|.***.", + ["row6"] = ".***.|..*..|.***.|..*..|..*..|..*..", + ["row7"] = "..*..|.....|..*..|.....|.....|.....", + ["row8"] = ".....|.....|.....|.....|.....|....." }, - "speed": "return foo", - "type": "icon" + ["speed"] = "return foo", + ["type"] = "icon" }, - "widget_icon_heartbeat": { - "bitmap": { - "row1": ".....|.....", - "row2": ".*.*.|.*.*.", - "row3": "*****|*.*.*", - "row4": "*****|*...*", - "row5": ".***.|.*.*.", - "row6": ".***.|.*.*.", - "row7": "..*..|..*..", - "row8": ".....|....." + ["widget_icon_heartbeat"] = { + ["bitmap"] = { + ["row1"] = ".....|.....", + ["row2"] = ".*.*.|.*.*.", + ["row3"] = "*****|*.*.*", + ["row4"] = "*****|*...*", + ["row5"] = ".***.|.*.*.", + ["row6"] = ".***.|.*.*.", + ["row7"] = "..*..|..*..", + ["row8"] = ".....|....." }, - "speed": "return foo", - "type": "icon" + ["speed"] = "return foo", + ["type"] = "icon" }, - "widget_icon_karo": { - "bitmap": { - "row1": ".....|.....|.....|.....|..*..|.....|.....|.....", - "row2": ".....|.....|.....|..*..|.*.*.|..*..|.....|.....", - "row3": ".....|.....|..*..|.*.*.|*...*|.*.*.|..*..|.....", - "row4": ".....|..*..|.*.*.|*...*|.....|*...*|.*.*.|..*..", - "row5": ".....|.....|..*..|.*.*.|*...*|.*.*.|..*..|.....", - "row6": ".....|.....|.....|..*..|.*.*.|..*..|.....|.....", - "row7": ".....|.....|.....|.....|..*..|.....|.....|.....", - "row8": ".....|.....|.....|.....|.....|.....|.....|....." + ["widget_icon_karo"] = { + ["bitmap"] = { + ["row1"] = ".....|.....|.....|.....|..*..|.....|.....|.....", + ["row2"] = ".....|.....|.....|..*..|.*.*.|..*..|.....|.....", + ["row3"] = ".....|.....|..*..|.*.*.|*...*|.*.*.|..*..|.....", + ["row4"] = ".....|..*..|.*.*.|*...*|.....|*...*|.*.*.|..*..", + ["row5"] = ".....|.....|..*..|.*.*.|*...*|.*.*.|..*..|.....", + ["row6"] = ".....|.....|.....|..*..|.*.*.|..*..|.....|.....", + ["row7"] = ".....|.....|.....|.....|..*..|.....|.....|.....", + ["row8"] = ".....|.....|.....|.....|.....|.....|.....|....." }, - "speed": "return foo", - "type": "icon" + ["speed"] = "return foo", + ["type"] = "icon" }, - "widget_icon_rain": { - "bitmap": { - "row1": "...*.|.....|.....|.*...|....*|..*..|.....|*....", - "row2": "*....|...*.|.....|.....|.*...|....*|..*..|.....", - "row3": ".....|*....|...*.|.....|.....|.*...|....*|..*..", - "row4": "..*..|.....|*....|...*.|.....|.....|.*...|....*", - "row5": "....*|..*..|.....|*....|...*.|.....|.....|.*...", - "row6": ".*...|....*|..*..|.....|*....|...*.|.....|.....", - "row7": ".....|.*...|....*|..*..|.....|*....|...*.|.....", - "row8": ".....|.....|.*...|....*|..*..|.....|*....|...*." + ["widget_icon_rain"] = { + ["bitmap"] = { + ["row1"] = "...*.|.....|.....|.*...|....*|..*..|.....|*....", + ["row2"] = "*....|...*.|.....|.....|.*...|....*|..*..|.....", + ["row3"] = ".....|*....|...*.|.....|.....|.*...|....*|..*..", + ["row4"] = "..*..|.....|*....|...*.|.....|.....|.*...|....*", + ["row5"] = "....*|..*..|.....|*....|...*.|.....|.....|.*...", + ["row6"] = ".*...|....*|..*..|.....|*....|...*.|.....|.....", + ["row7"] = ".....|.*...|....*|..*..|.....|*....|...*.|.....", + ["row8"] = ".....|.....|.*...|....*|..*..|.....|*....|...*." }, - "speed": "return foo", - "type": "icon" + ["speed"] = "return foo", + ["type"] = "icon" }, - "widget_icon_squirrel": { - "bitmap": { - "row1": ".....|.....|.....|.....|.....|.....", - "row2": ".....|.....|.....|.....|.....|.....", - "row3": ".....|.....|.....|.....|.....|.....", - "row4": "**...|.**..|..**.|...**|....*|.....", - "row5": "*****|*****|*****|*****|*****|*****", - "row6": "...**|..**.|.**..|**...|*....|.....", - "row7": ".....|.....|.....|.....|.....|.....", - "row8": ".....|.....|.....|.....|.....|....." + ["widget_icon_squirrel"] = { + ["bitmap"] = { + ["row1"] = ".....|.....|.....|.....|.....|.....", + ["row2"] = ".....|.....|.....|.....|.....|.....", + ["row3"] = ".....|.....|.....|.....|.....|.....", + ["row4"] = "**...|.**..|..**.|...**|....*|.....", + ["row5"] = "*****|*****|*****|*****|*****|*****", + ["row6"] = "...**|..**.|.**..|**...|*....|.....", + ["row7"] = ".....|.....|.....|.....|.....|.....", + ["row8"] = ".....|.....|.....|.....|.....|....." }, - "speed": "return foo", - "type": "icon" + ["speed"] = "return foo", + ["type"] = "icon" }, - "widget_icon_timer": { - "bitmap": { - "row1": ".....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|", - "row2": ".***.|.*+*.|.*++.|.*++.|.*++.|.*++.|.*++.|.*++.|.*++.|.*++.|.*++.|.*++.|.+++.|.+*+.|.+**.|.+**.|.+**.|.+**.|.+**.|.+**.|.+**.|.+**.|.+**.|.+**.|", - "row3": "*****|**+**|**++*|**+++|**++.|**++.|**+++|**+++|**+++|**+++|**+++|+++++|+++++|++*++|++**+|++***|++**.|++**.|++***|++***|++***|++***|++***|*****|", - "row4": "*****|**+**|**+**|**+**|**+++|**+++|**+++|**+++|**+++|**+++|+++++|+++++|+++++|++*++|++*++|++*++|++***|++***|++***|++***|++***|++***|*****|*****|", - "row5": "*****|*****|*****|*****|*****|***++|***++|**+++|*++++|+++++|+++++|+++++|+++++|+++++|+++++|+++++|+++++|+++**|+++**|++***|+****|*****|*****|*****|", - "row6": ".***.|.***.|.***.|.***.|.***.|.***.|.**+.|.*++.|.+++.|.+++.|.+++.|.+++.|.+++.|.+++.|.+++.|.+++.|.+++.|.+++.|.++*.|.+**.|.***.|.***.|.***.|.***.|", - "row7": ".....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|", - "row8": ".....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|" + ["widget_icon_timer"] = { + ["bitmap"] = { + ["row1"] = ".....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|", + ["row2"] = ".***.|.*+*.|.*++.|.*++.|.*++.|.*++.|.*++.|.*++.|.*++.|.*++.|.*++.|.*++.|.+++.|.+*+.|.+**.|.+**.|.+**.|.+**.|.+**.|.+**.|.+**.|.+**.|.+**.|.+**.|", + ["row3"] = "*****|**+**|**++*|**+++|**++.|**++.|**+++|**+++|**+++|**+++|**+++|+++++|+++++|++*++|++**+|++***|++**.|++**.|++***|++***|++***|++***|++***|*****|", + ["row4"] = "*****|**+**|**+**|**+**|**+++|**+++|**+++|**+++|**+++|**+++|+++++|+++++|+++++|++*++|++*++|++*++|++***|++***|++***|++***|++***|++***|*****|*****|", + ["row5"] = "*****|*****|*****|*****|*****|***++|***++|**+++|*++++|+++++|+++++|+++++|+++++|+++++|+++++|+++++|+++++|+++**|+++**|++***|+****|*****|*****|*****|", + ["row6"] = ".***.|.***.|.***.|.***.|.***.|.***.|.**+.|.*++.|.+++.|.+++.|.+++.|.+++.|.+++.|.+++.|.+++.|.+++.|.+++.|.+++.|.++*.|.+**.|.***.|.***.|.***.|.***.|", + ["row7"] = ".....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|", + ["row8"] = ".....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|" }, - "speed": "return foo", - "type": "icon" + ["speed"] = "return foo", + ["type"] = "icon" }, - "widget_icon_wave": { - "bitmap": { - "row1": "..**.|.**..|**...|*....|.....|.....|.....|.....|....*|...**", - "row2": ".*..*|*..*.|..*..|.*...|*....|.....|.....|....*|...*.|..*..", - "row3": "*....|....*|...*.|..*..|.*...|*....|....*|...*.|..*..|.*...", - "row4": "*....|....*|...*.|..*..|.*...|*....|....*|...*.|..*..|.*...", - "row5": "*....|....*|...*.|..*..|.*...|*....|....*|...*.|..*..|.*...", - "row6": ".....|.....|....*|...*.|..*..|.*..*|*..*.|..*..|.*...|*....", - "row7": ".....|.....|.....|....*|...**|..**.|.**..|**...|*....|.....", - "row8": ".....|.....|.....|.....|.....|.....|.....|.....|.....|....." + ["widget_icon_wave"] = { + ["bitmap"] = { + ["row1"] = "..**.|.**..|**...|*....|.....|.....|.....|.....|....*|...**", + ["row2"] = ".*..*|*..*.|..*..|.*...|*....|.....|.....|....*|...*.|..*..", + ["row3"] = "*....|....*|...*.|..*..|.*...|*....|....*|...*.|..*..|.*...", + ["row4"] = "*....|....*|...*.|..*..|.*...|*....|....*|...*.|..*..|.*...", + ["row5"] = "*....|....*|...*.|..*..|.*...|*....|....*|...*.|..*..|.*...", + ["row6"] = ".....|.....|....*|...*.|..*..|.*..*|*..*.|..*..|.*...|*....", + ["row7"] = ".....|.....|.....|....*|...**|..**.|.**..|**...|*....|.....", + ["row8"] = ".....|.....|.....|.....|.....|.....|.....|.....|.....|....." }, - "speed": "return foo", - "type": "icon" + ["speed"] = "return foo", + ["type"] = "icon" }, - "widget_key_down": { - "expression": "lcd.Transition(-1)", - "key": 2, - "type": "key" + ["widget_key_down"] = { + ["expression"] = "lcd.Transition(-1)", + ["key"] = 2, + ["type"] = "key" }, - "widget_key_up": { - "expression": "lcd.Transition(1)", - "key": 1, - "type": "key" + ["widget_key_up"] = { + ["expression"] = "lcd.Transition(1)", + ["key"] = 1, + ["type"] = "key" }, - "widget_percent": { - "expression": "'%'", - "type": "text" + ["widget_percent"] = { + ["expression"] = "'%'", + ["type"] = "text" } } ]] \ No newline at end of file