Mercurial > wow > devian
diff Devian.lua @ 7:d0cd0e68213e v1.2-r7
Frame anchor set in a way that doesn't disjoint the other pieces when it's changed.
Corrected arithmetic in SavePos; should be using y = GetTop - GetScreenHeight
Height parameter only saved when maximized
author | Nenue |
---|---|
date | Fri, 18 Dec 2015 20:49:58 -0500 |
parents | b526dc930b15 |
children | 12d814c10962 |
line wrap: on
line diff
--- a/Devian.lua Fri Dec 18 20:15:01 2015 -0500 +++ b/Devian.lua Fri Dec 18 20:49:58 2015 -0500 @@ -9,6 +9,9 @@ local PLAYER_REALM = UnitName("player") .. '-' .. GetRealmName() local DEVIAN_FRAME = DevianConsole local cherry = false +local print = function(...) + _G.print('DVN', ...) +end if not DevianDB then DevianDB = { ['global'] = {[STATE_LOW] = {}, [STATE_HIGH] = {}}, @@ -16,7 +19,7 @@ dnd_status = true, dnd_message = "Debugging. Your messages may get eaten.", x = 100, - y = -150, + y = 800, height = 500, width = 600, font = [[Interface\Addons\Devian\font\SourceCodePro-Regular.ttf]], @@ -28,10 +31,15 @@ local db = DevianDB function D:SavePos(x,y) - db.y = DEVIAN_FRAME:GetTop() + db.y = (DEVIAN_FRAME:GetTop() - GetScreenHeight()) db.x = DEVIAN_FRAME:GetLeft() db.width = DEVIAN_FRAME:GetWidth() - db.height = DEVIAN_FRAME:GetHeight() + if not DEVIAN_FRAME.minimized then + db.height = DEVIAN_FRAME:GetHeight() + end + + print(db.y) + DEVIAN_FRAME:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', db.x, db.y) end local ScanAddOnList = function(args) @@ -133,7 +141,7 @@ f:SetMaxLines(500) --]] f.console:SetInsertMode('BOTTOM') - f:SetPoint('CENTER', UIParent, 'CENTER', db.x, db.y) + f:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', db.x, db.y) f:SetSize(db.width, db.height) f:Lower() @@ -145,6 +153,25 @@ D.debug_init = true end +function D:ToggleMinMax() + if DEVIAN_FRAME.minimized then + self:Maximize() + else + self:Minimize() + end +end +function D:Minimize() + DEVIAN_FRAME:SetHeight(20) + DEVIAN_FRAME.minimized = true + DEVIAN_FRAME:SetMaxResize(GetScreenWidth(),20) + return DEVIAN_FRAME.console:Hide() +end +function D:Maximize() + DEVIAN_FRAME:SetHeight(db.height) + DEVIAN_FRAME.minimized = nil + DEVIAN_FRAME:SetMaxResize(GetScreenWidth(),GetScreenHeight()) + return DEVIAN_FRAME.console:Show() +end local prefix_cache = {} local function Message(prefix, ...) @@ -192,23 +219,6 @@ DEVIAN_FRAME.console:AddMessage(table.concat(buffer, ' ')) table.wipe(buffer) end -function D:ToggleMinMax() - if DEVIAN_FRAME.minimized then - self:Maximize() - else - self:Minimize() - end -end -function D:Minimize() - DEVIAN_FRAME:SetHeight(20) - DEVIAN_FRAME.minimized = true - return DEVIAN_FRAME.console:Hide() -end -function D:Maximize() - DEVIAN_FRAME:SetHeight(DevianDB.height) - DEVIAN_FRAME.minimized = nil - return DEVIAN_FRAME.console:Show() -end function D:OnEnable() if db.enabled then