Mercurial > wow > devian
diff Devian.lua @ 28:31ca76e04766 v1.4.4
/dvn tag and /dvc commands will respond to all of their arguments
Index assignment algorithm should stop breaking new channels.
current channel's ToFront is invoked after the initializer loop
author | Nenue |
---|---|
date | Fri, 25 Dec 2015 03:32:56 -0500 |
parents | b0e8bd30575f |
children | 42e74b72726d |
line wrap: on
line diff
--- a/Devian.lua Thu Dec 24 03:00:16 2015 -0500 +++ b/Devian.lua Fri Dec 25 03:32:56 2015 -0500 @@ -23,12 +23,14 @@ font = [[Interface\Addons\Devian\font\SourceCodePro-Regular.ttf]], fontsize = 13, fontoutline = 'NONE', - backdrop = {1,1,1,0.2}, + backalpha = 0.5, + backdrop = {0,0,0,0.4}, backgrad = {'VERTICAL', 0.1, 0.1, 0.1, 0.3, 0, 0, 0, 0.5}, backblend = 'BLEND', - frontdrop = {1,1,1,1}, + frontdrop = {0,0,0,1}, frontgrad = {'VERTICAL', 0.1, 0.1, 0.1, 0.9, 0, 0, 0, 0.9}, frontblend = 'BLEND', + frontalpha = 1, frontborder = {1,0,0,1}, backborder = {0,0,1,0.75}, } @@ -60,7 +62,7 @@ return D:DistributeFrames() elseif mode == 'tag' then -- tagging if tag ~= nil and dest ~= nil then - local channel = D:SetChannel(dest:match('%a'), dest:match('%d')) + local channel = D:SetChannel(dest:match('%a+'), dest:match('%d+')) if not D.tags[tag] then D.tags[tag] = {} end @@ -199,23 +201,25 @@ -- @param ... one or more space-seperated channel keys local function Console_Toggle(input) local search = {} - local key, n = D:GetArgs(input, 1) - if key then + local n = 0 + if D:GetArgs(input,1) then repeat + key, n = D:GetArgs(input,1,n) if D.sig[key] then table.insert(search, D.sig[key]) elseif D.console[key] then table.insert(search, D.console[key]) end - key, n = D:GetArgs(input,1,n) until n == 1e9 else search = D.console end db.toggle = not db.toggle and true or nil - for _, c in ipairs(search) do + for i, c in ipairs(search) do + print(i,c.index) if db.toggle then + c.enabled = true c:Show() if db.current_channel == c.index then c:ToFront() @@ -244,6 +248,7 @@ --print(db.frontblend) -- D.raise_ct = D.raise_ct + 1 c:Raise() + c:SetAlpha(db.frontalpha) c.out.backdrop:SetTexture(unpack(db.frontdrop)) c.out.backdrop:SetGradientAlpha(unpack(db.frontgrad)) c.out.backdrop:SetBlendMode(db.frontblend) @@ -259,6 +264,7 @@ --print(unpack(db.backdrop)) --print(unpack(db.backgrad)) --print(db.backblend) + bc:SetAlpha(db.backalpha) bc.out.backdrop:SetTexture(unpack(db.backdrop)) bc.out.backdrop:SetGradientAlpha(unpack(db.backgrad)) bc.out.backdrop:SetBlendMode(db.backblend) @@ -457,35 +463,50 @@ --print('join:', i , cinfo) local t_info = {} local dbvars = db.channels[self.primary_channel] + local signame + + -- is cinfo a table or signature? if type(cinfo) == 'string' then - local signame = tostring(cinfo) + signame = tostring(cinfo) t_info.signature = signame - end - - if type(cinfo) ~= 'table' then + elseif type(cinfo) ~= 'table' then cinfo = {} end - if i then + -- did we get a signature string? + if not (cinfo.signature or t_info.signature) then + t_info.signature = 'Console' + end + + -- was an index given? + if not i then + i = D.num_channels + 1 + t_info.index = i + -- make a new one + else i = tonumber(i) + -- is it valid? if db.channels[i] then dbvars = db.channels[i] + -- use that as our base vars else - -- if there is no channels[i], then we need to check for sig collision - local sigvar = signame - local j = 2 - while D.sig[sigvar] do - sigvar = signame .. j - j = j + 1 + if db.sig[t_info.signature] then + local sigvar = t_info.signature + local j = 2 + while D.sig[sigvar] do + sigvar = signame .. j + j = j + 1 + end + t_info.signature = sigvar end - t_info.signature = sigvar + + i = D.num_channels + 1 + t_info.index = i + -- make a new index number and fix the signature end end - if not (cinfo.signature or t_info.signature) then - t_info.signature = 'Console'..i - end - + -- can proceed to fill in from base vars here for k,v in pairs(dbvars) do if not t_info[k] then if cinfo[k] then @@ -496,22 +517,23 @@ end end + -- we're working with a fresh channel right? if not db.channels[i] then t_info.x = t_info.x + 20 t_info.y = t_info.y - 20 db.channels[i] = t_info + -- set its position just off of the base vars and store it end + -- can proceed to display something from here if not self.console[i] then self.console[i] = CreateConsole(i, t_info) + -- if it isn't already spawned, create the frame end local channel = self.console[i] self.sig[t_info.signature] = channel self.sigID[t_info.signature] = i self.IDsig[i] = t_info.signature - if i == db.current_channel then - channel:ToFront() - end return channel end @@ -591,6 +613,7 @@ if self.console[db.current_channel] then self.console[db.current_channel]:ToFront() + -- bring the current channel to the front end if db.enabled then