# HG changeset patch # User Nenue # Date 1450486090 18000 # Node ID 247118593c66a1c466ad8b8ffa53402466b31982 # Parent 957f42cb49d024b0e1b5a6c0ee691970532a837a Console interface properly resides in XML, and has been fitted with a sizing widget. Console frame can be moved by clicking and dragging anywhere, and can be minimized by right click. Font paths point to the actual addon tree. diff -r 957f42cb49d0 -r 247118593c66 Devian.lua --- a/Devian.lua Fri Dec 18 04:10:09 2015 -0500 +++ b/Devian.lua Fri Dec 18 19:48:10 2015 -0500 @@ -5,10 +5,31 @@ end Devian = LibStub("AceAddon-3.0"):NewAddon("Devian", "AceConsole-3.0", "AceEvent-3.0") local D = _G.Devian -local db local STATE_LOW, STATE_HIGH = 1, 2 local PLAYER_REALM = UnitName("player") .. '-' .. GetRealmName() -local DEVIAN_FRAME = DevianDebugInfo +local DEVIAN_FRAME = DevianConsole +local cherry = false +if not DevianDB then + DevianDB = { + ['global'] = {[STATE_LOW] = {}, [STATE_HIGH] = {}}, + console = true, + dnd_status = true, + dnd_message = "Debugging. Your messages may get eaten.", + x = 100, + y = -150, + height = 500, + width = 600, + } + cherry = "This is probably the first time, so:\n /dvn 2 to save your regular addon list\n /dvn 1 to save your development addon list\n /dvn to switch between the two\n /dvc to toggle print() frame" +end +local db = DevianDB + +function D:SavePos(x,y) + db.y = DEVIAN_FRAME:GetTop() + db.x = DEVIAN_FRAME:GetLeft() + db.width = DEVIAN_FRAME:GetWidth() + db.height = DEVIAN_FRAME:GetHeight() +end local ScanAddOnList = function(args) local list_state @@ -86,15 +107,13 @@ -- Debug info local function CreateMessenger() - -- TODO: throw this into an XML file - if not DEVIAN_FRAME then - DEVIAN_FRAME = CreateFrame('ScrollingMessageFrame', DEVIAN_FRAME, UIParent) - if not db.console then - DEVIAN_FRAME:Hide() - end + if db.console == true then + DEVIAN_FRAME:Show() end + local f = DEVIAN_FRAME + --[[ f.backdrop = f:CreateTexture('backdrop', 'BACKGROUND') f.backdrop:SetTexture(1,1,1,1) f.backdrop:SetGradient('HORIZONTAL', 0.2, 0.2, 0.2, 1, 1, 1) @@ -105,30 +124,20 @@ f:EnableMouseWheel(true) f:EnableKeyboard(true) f:SetScript('OnMouseWheel', function (self, delta) - local up = delta > 0 - if IsControlKeyDown() then - if up then self:ScrollToTop() - else self:ScrollToBottom() end - elseif IsShiftKeyDown() then - if up then self:PageUp() - else self:PageDown() end - else - if up then self:ScrollUp() - else self:ScrollDown() end - end end) f:ScrollToBottom() f:SetMaxLines(500) - f:SetInsertMode('BOTTOM') - f:SetPoint('BOTTOMLEFT', GENERAL_CHAT_DOCK, 'TOPLEFT', 0, 25) - f:SetPoint('TOPRIGHT', UIParent, 'TOP', 0, 0- PlayerFrame:GetHeight()) - f:SetFrameStrata('BACKGROUND') - f:SetFont([[Interface\Addons\Turok\Media\font\SourceCodePro-Regular.ttf]], 14, 'NONE') + --]] + f.console:SetInsertMode('BOTTOM') + f:SetPoint('CENTER', UIParent, 'CENTER', db.x, db.y) + f:SetSize(db.width, db.height) + f:Lower() + f.console:SetFont([[Interface\Addons\Turok\Media\font\SourceCodePro-Regular.ttf]], 13, 'NONE') - f:SetFading(false) - f:SetTimeVisible(2147483647) - f:SetJustifyH('LEFT') + f.console:SetFading(false) + f.console:SetTimeVisible(2147483647) + --f:SetJustifyH('LEFT') D.debug_init = true @@ -177,7 +186,7 @@ table.insert(buffer, var) end - DEVIAN_FRAME:AddMessage(table.concat(buffer, ' ')) + DEVIAN_FRAME.console:AddMessage(table.concat(buffer, ' ')) table.wipe(buffer) end @@ -192,18 +201,6 @@ function D:OnInitialize() - local cherry = false - if not DevianDB then - DevianDB = { - ['global'] = {[STATE_LOW] = {}, [STATE_HIGH] = {}}, - console = true, - dnd_status = true, - dnd_message = "Debugging. Your messages may get eaten.", - } - cherry = "This is probably the first time, so:\n /dvn 2 to save your regular addon list\n /dvn 1 to save your development addon list\n /dvn to switch between the two\n /dvc to toggle print() frame" - end - db = DevianDB - if not db[PLAYER_REALM] then db[PLAYER_REALM] = {[STATE_LOW] = {}, [STATE_HIGH] = {} } if not cherry then diff -r 957f42cb49d0 -r 247118593c66 Devian.toc --- a/Devian.toc Fri Dec 18 04:10:09 2015 -0500 +++ b/Devian.toc Fri Dec 18 19:48:10 2015 -0500 @@ -8,5 +8,5 @@ ## Version: 0.1 ## SavedVariables: DevianDB ## Deps: Ace3 - +Devian.xml Devian.lua \ No newline at end of file diff -r 957f42cb49d0 -r 247118593c66 Devian.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Devian.xml Fri Dec 18 19:48:10 2015 -0500 @@ -0,0 +1,124 @@ + + + + + + + + + + if button == 'LeftButton' then + if self.sizer:IsMouseOver() then + return self:StartSizing() + end + return self:StartMoving() + end + + + if button == 'RightButton' then + if not self.minimized then + self.sizer:ClearAllPoints() + self.sizer:SetPoint('TOPRIGHT') + self:SetHeight(20) + self.minimized = true + return self.console:Hide() + else + self.sizer:ClearAllPoints() + self.sizer:SetPoint('BOTTOMRIGHT') + self:SetHeight(DevianDB.height) + self.minimized = nil + return self.console:Show() + end + end + self:StopMovingOrSizing() + Devian:SavePos() + + + local up = delta > 0 + if IsControlKeyDown() then + if up then self.console:ScrollToTop() + else self.console:ScrollToBottom() end + elseif IsShiftKeyDown() then + if up then self.console:PageUp() + else self.console:PageDown() end + else + if up then self.console:ScrollUp() + else self.console:ScrollDown() end + end + + + if not self.throttle then + self.throttle = GetTime() + elseif (GetTime()-self.throttle < 0.2) then + return + else + self.throttle = GetTime() + end + + self.text:SetText(string.format(self.format, GetTime())) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file