# HG changeset patch # User Nenue # Date 1451477138 18000 # Node ID 5341e4d84622089b96d6079d56ac7cca5e31c1bb # Parent 8a3f42ccf9202df3e0af749df5c7dc4123c155c3 Removed dock manager from the TOC for now Parts of the config dialog in, needs finishing diff -r 8a3f42ccf920 -r 5341e4d84622 Config.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Config.lua Wed Dec 30 07:05:38 2015 -0500 @@ -0,0 +1,178 @@ +--- +-- @file-author@ +-- @project-revision@ @project-hash@ +-- @file-revision@ @file-hash@ +-- Created: 12/30/2015 1:35 AM + +if not LibStub then + print('Something has happened...') +end +local D = LibStub("AceAddon-3.0"):GetAddon("Devian") +DevCon = D:NewModule("Config") +local Cf, tinsert, ipairs, tostring = DevCon, table.insert, ipairs, tostring +local PLAYER_REALM = UnitName("player") .. '-' .. GetRealmName() +local db + + +local SetOpt = function(info, value) + db[info[#info]] = value +end +local GetOpt = function(info) + return db[info[#info]] +end +local GetProfileList = function(info) + local select = {} + for i, profile in ipairs(db.profiles) do + if i == db.workspace then + profile[1] = '|cFFFFFF00'..profile[1]..'|r' + elseif i == db.last_workspace then + profile[1] = '|cFF00FF00'..profile[1]..'|r' + end + tinsert(select,tostring(i)..':'..profile[1]) + end + return select +end +local GetAddOnList = function(id) + local t = Cf.opts.args.addon.args + for k, v in pairs(t) do + k:match("addon_") + t[k] = nil + end + + +end +local SetSelectedToProfile = function(info, value) + GetAddOnList(value) +end +local SetLoadedToProfile = function(info, value) end +local SetProfile = function(info, value) end +local LoadSelectedProfile = function() print('Load #', Cf.selected_profile) end +function Cf:OnInitialize() + db = DevianDB + self.selected_profile = db.primary_channel +end + +function Cf:OnEnable() + + D:Print('Options UI loaded') + self.opts = { + type = 'group', + name = 'Devian', + desc = 'Devkit in a nutshell', + handler = Cf, + set = SetOpt, + get = GetOpt, + args = { + enabled = { + type = 'toggle', + name = 'Enable Print Handler', + desc = 'Allows Devian to handle print() calls.', + order = 10, + }, + addon = { + type = 'group', + name = 'AddOns', + order = 20, + args= { + selected_profile = { + type = 'select', + name = 'Profile', + values = GetProfileList, + set = function(info, value, ...) self.selected_profile = value print('select', value, ...) end, + get = function(info) return self.selected_profile or 1 end, + order = 10 + }, + load_selected = { + func = LoadSelectedProfile, + type = 'execute', + name = 'Load Selected', + desc = 'Save currently loaded AddOns as a profile.', + order = 13, + }, + t_header = { + type = 'header', + name = 'Addons', + width = 'full', + order = 15, + }, + save_loaded = { + func = SetLoadedToProfile, + type = 'execute', + name = 'Save Loaded', + desc = 'Save currently loaded AddOns as a profile.', + order = 400, + }, + save_selected = { + func = SetSelectedToProfile, + type = 'execute', + name = 'Save', + desc = 'Save the selected AddOns as a profile.', + order = 450, + } + } + }, + channels = { + type = 'group', + name = 'Console', + order = 30, + args = { + primary_channel = { + type = 'select', + name = 'Primary Channel', + desc = 'Set the default output channel for untagged messages.', + values = {}, + } + } + }, + tags = { + type = 'group', + name = 'Tags', + order = 40, + args = { + enable_tag = { + type = 'toggle', + name ='Message prefix handling', + desc = 'Enables direction of print() results to different channels based on the first whole word in the output.', + } + } + }, + } + } + + + for i = 1, GetNumAddOns() do + local name = GetAddOnInfo(i) + local enableState, globalState = GetAddOnEnableState(playername, i), GetAddOnEnableState(nil, i) + self.opts.args.addon.args['addon_'..i..'_desc'] = { + type = 'description', + name = name, + width = 'single', + order= (500+i*3) + } + self.opts.args.addon.args['addon_'..i..'_global'] = { + type = 'toggle', + name = '', + get = function() return (GetAddOnEnableState(nil, i) == 2) and true or false end, + set = function(info, value) EnableAddOn(i, value) end, + width= 'half', + order= (500+i*3+1) + } + + self.opts.args.addon.args['addon_'..i..'_char'] = { + type = 'toggle', + name = '', + get = function() return (GetAddOnEnableState(GetUnitName('player'), i) == 1) and true or false end, + set = function(info, value) EnableAddOn(PLAYER_REALM, value) end, + width= 'half', + order= (500+i*3+2) + } + end + + LibStub("AceConfig-3.0"):RegisterOptionsTable("Devian", self.opts) + self.diag = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("Devian", "Devian") +end + +function Cf:ChatCommand(input) + InterfaceOptionsFrame_OpenToCategory(self.diag) + InterfaceOptionsFrame_OpenToCategory(self.diag) +end \ No newline at end of file diff -r 8a3f42ccf920 -r 5341e4d84622 Devian.lua --- a/Devian.lua Tue Dec 29 20:22:18 2015 -0500 +++ b/Devian.lua Wed Dec 30 07:05:38 2015 -0500 @@ -6,6 +6,7 @@ print('Something has happened...') end Devian = LibStub("AceAddon-3.0"):NewAddon("Devian", "AceConsole-3.0", "AceEvent-3.0") +Devian:SetDefaultModuleState(false) local MAJOR, MINOR = 'Devian-1.3', 'r@project-revision@' local D = _G.Devian local MSG_NEED_DEV_MODE = 'Must be in development mode to use this function.' @@ -17,6 +18,12 @@ ['global'] = {{}, {}}, ['tags'] = {}, ['channels'] = {[1] = {signature = 'Main', index = 1, x = 100, y = 800, height = 500, width = 600, enabled = true}}, + ['profiles'] = { + {'Main', false}, + {'Devian', true}, + {'Turok', true}, + {'Bam', true} + }, primary_channel = 1, -- the channel to which default output is sent current_channel = 1, -- the front channel max_channel = 1, -- the highest created channel id @@ -25,20 +32,27 @@ font = [[Interface\Addons\Devian\font\SourceCodePro-Regular.ttf]], -- font info fontsize = 13, fontoutline = 'NONE', - headergrad = {'VERTICAL', 0, 0, 0, 0.5, 0.1, 0.1, 0.1, 0.3}, -- header info + + headergrad = {'VERTICAL', 0, 0, 0, 1, + 1, 0.1, 0.1, 1}, -- header info headerdrop = {1,1,1,1}, + headerblend = 'BLEND', headeralpha = 1, - headerfontcolor = {1,0.2,0.2,1}, - backdrop = {1,1,1,1}, -- background frame info - backgrad = {'VERTICAL', 0.1, 0.1, 0.1, 0.3, 0, 0, 0, 0.5}, + headerfontcolor = {1,1,1,1}, + + backdrop = {1,1,1,1}, -- background frame info + backgrad = {'VERTICAL', 0.1, 0.1, 0.1, 1, 0, 0, 0, 1}, backblend = 'MOD', - backalpha = 0.7, - backborder = {0,0,1,0.75}, - frontdrop = {1,1,1,1}, -- foreground frame info - frontgrad = {'VERTICAL', 0.1, 0.1, 0.1, 0.8, 0, 0, 0, 0.6}, + backalpha = 1, + backborder = {.5,.5,.5,1}, + backheader = {.25,.25,.25,1}, + + frontdrop = {1,1,1,1}, -- foreground frame info + frontgrad = {'VERTICAL', 0.1, 0.1, 0.1, 1, 0, 0, 0, 1}, frontblend = 'MOD', frontalpha = 1, - frontborder = {1,0,0,1}, + frontborder = {.07,.47,1,1}, + frontheader = {1,1,1,1}, tagcolor = {}, -- tag color repository workspace = 2, -- current profile last_workspace = 2 -- default workspace to alternate with when just "/dvn" is issued @@ -255,7 +269,7 @@ -- @param Tag, signature, or numeric index of the channel to output on. Defaults to primary channel. -- @param ... Output contents. local function Message(prefix, ...) - if not db.enabled then + if db.workspace == 1 then return D.oldprint(prefix, ...) end @@ -336,6 +350,8 @@ D:Print("|cFFFFFF00/cleandvn|r", "- Fully resets SavedVariables, profiles and all.") end + + function D:OnEnable() print(MAJOR, MINOR) @@ -350,6 +366,14 @@ D:Print('Development mode active (list #'..db.workspace..'). Print handling |cFF00FF00ON|r.') end + self:RegisterChatCommand("dvg", function(input) + if not self.config then + self.config = DevCon + self:EnableModule("Config") + end + self.modules.Config:ChatCommand(input) + end) + end function D:OnInitialize() diff -r 8a3f42ccf920 -r 5341e4d84622 Devian.toc --- a/Devian.toc Tue Dec 29 20:22:18 2015 -0500 +++ b/Devian.toc Wed Dec 30 07:05:38 2015 -0500 @@ -8,4 +8,4 @@ Devian.xml Devian.lua UI.lua -Dock.lua \ No newline at end of file +Config.lua \ No newline at end of file diff -r 8a3f42ccf920 -r 5341e4d84622 UI.lua --- a/UI.lua Tue Dec 29 20:22:18 2015 -0500 +++ b/UI.lua Wed Dec 30 07:05:38 2015 -0500 @@ -96,8 +96,8 @@ c.out.backdrop:SetTexture(unpack(db.frontdrop)) c.out.backdrop:SetGradientAlpha(unpack(db.frontgrad)) c.out.backdrop:SetBlendMode(db.frontblend) - c.dropmenu.icon:SetVertexColor(unpack(db.headerfontcolor)) - c.title:SetTextColor(unpack(db.headerfontcolor)) + c.dropmenu.icon:SetVertexColor(unpack(db.frontheader)) + c.title:SetTextColor(unpack(db.frontborder)) db.current_channel = c.index for _, part in pairs(c.border) do @@ -114,7 +114,7 @@ bc.out.backdrop:SetTexture(unpack(db.backdrop)) bc.out.backdrop:SetGradientAlpha(unpack(db.backgrad)) bc.out.backdrop:SetBlendMode(db.backblend) - bc.dropmenu.icon:SetVertexColor(unpack(db.backborder)) + bc.dropmenu.icon:SetVertexColor(unpack(db.backheader)) bc.title:SetTextColor(unpack(db.backborder)) for _, part in pairs(bc.border) do @@ -187,6 +187,7 @@ f.out.backdrop:SetTexture(unpack(db.frontdrop)) f.dropmenu.icon:SetVertexColor(unpack(db.headerfontcolor)) f.title:SetTextColor(unpack(db.headerfontcolor)) + f.header:SetAlpha(db.headeralpha) else f.out.backdrop:SetTexture(unpack(db.backdrop)) end @@ -340,6 +341,7 @@ if channel.enabled and db.enabled then -- hide or show last since Min/Max mess with visibility --print('setchan(5a) enable') channel:Show() + channel:ToFront() else --print('setchan(5a) disable') channel:Hide()