Mercurial > wow > devian
changeset 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 | 5fb37280eb74 |
files | Devian.lua Devian.xml |
diffstat | 2 files changed, 35 insertions(+), 27 deletions(-) [+] |
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
--- a/Devian.xml Fri Dec 18 20:15:01 2015 -0500 +++ b/Devian.xml Fri Dec 18 20:49:58 2015 -0500 @@ -1,7 +1,5 @@ <Ui> <Frame name="DevianConsole" parent="UIParent" enableMouse="true" enableMouseWheel="true" movable="true" resizable="true" toplevel="true" hidden="true" clampedToScreen="true"> - - <Size width="500" height="600"/> <KeyValues> <KeyValue key="format" value="Devian [%s]" /> </KeyValues> @@ -68,11 +66,11 @@ <Layers> <Layer level="BACKGROUND"> - <Texture name="DevianConsoleBG" parentKey="backdrop" setAllPoints="true" alphaMode="MOD"> + <Texture name="DevianConsoleBG" parentKey="backdrop" setAllPoints="true" alphaMode="BLEND"> <Color r="1" g="1" b="1" a="1"/> - <Gradient orientation="HORIZONTAL"> - <MinColor a="1" r="0" g="0" b="0"/> - <MaxColor a="1" r="1" g="1" b="1"/> + <Gradient orientation="VERTICAL"> + <MinColor r="0" g="0" b="0" a="0.7"/> + <MaxColor r="0" g="0" b="0" a="0.3"/> </Gradient> </Texture> </Layer>