diff Devian.xml @ 4:247118593c66

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.
author Nenue
date Fri, 18 Dec 2015 19:48:10 -0500
parents
children ac644fc860cc
line wrap: on
line diff
--- /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 @@
+<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>
+    <Scripts>
+      <OnMouseDown>
+        if button == 'LeftButton' then
+          if self.sizer:IsMouseOver() then
+            return self:StartSizing()
+          end
+          return self:StartMoving()
+        end
+      </OnMouseDown>
+      <OnMouseUp>
+        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()
+      </OnMouseUp>
+      <OnMouseWheel>
+        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
+      </OnMouseWheel>
+      <OnUpdate>
+        if not self.throttle then
+          self.throttle = GetTime()
+        elseif (GetTime()-self.throttle &lt; 0.2) then
+          return
+        else
+          self.throttle = GetTime()
+        end
+
+        self.text:SetText(string.format(self.format, GetTime()))
+      </OnUpdate>
+    </Scripts>
+
+    <Frames>
+      <ScrollingMessageFrame name="$parentBuffer" parentkey="console" maxLines="500" displayduration="2000000">
+        <Anchors>
+          <Anchor point="TOPLEFT" y="-20" />
+          <Anchor point="BOTTOMRIGHT" />
+        </Anchors>
+        <FontString font="Interface\Addons\Devian\font\SourceCodePro-Regular.ttf" wordwrap="true" maxLines="500"
+                    justifyH="LEFT"
+                    indented="true"
+                    setAllPoints="true">
+          <FontHeight>
+            <AbsValue val="12"/>
+          </FontHeight>
+        </FontString>
+
+        <Layers>
+          <Layer level="BACKGROUND">
+            <Texture name="DevianConsoleBG" parentKey="backdrop" setAllPoints="true" alphaMode="MOD">
+              <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>
+            </Texture>
+          </Layer>
+        </Layers>
+      </ScrollingMessageFrame>
+    </Frames>
+    <Layers>
+      <Layer level="OVERLAY">
+        <Texture parentKey="tbar" alphaMode="BLEND">
+          <Anchors>
+            <Anchor point="TOPLEFT" />
+            <Anchor point="TOPRIGHT" />
+          </Anchors>
+          <Size y="20" />
+          <Color r="0.3" g="0.3" b="0.3" a="1" />
+        </Texture>
+        <FontString parentKey="text" font="Interface\Addons\Devian\font\SourceCodePro-Bold.ttf" wordwrap="true" maxLines="500"
+                    justifyH="LEFT"
+                    indented="true">
+          <Anchors>
+            <Anchor point="TOPLEFT" x="4" y="-2" />
+            <Anchor point="TOPRIGHT" x="-4" />
+          </Anchors>
+          <Size y="20" />
+          <FontHeight>
+            <AbsValue val="12"/>
+          </FontHeight>
+        </FontString>
+      </Layer>
+      <Layer level="HIGHLIGHT">
+        <Texture parentKey="sizer" alphaMode="BLEND">
+          <Anchors>
+            <Anchor point="BOTTOMRIGHT" />
+          </Anchors>
+          <Size x="20" y="20" />
+          <Color r="1" g="1" b="1" a="0.7"/>
+        </Texture>
+      </Layer>
+    </Layers>
+  </Frame>
+</Ui>
\ No newline at end of file