comparison 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
comparison
equal deleted inserted replaced
3:957f42cb49d0 4:247118593c66
1 <Ui>
2 <Frame name="DevianConsole" parent="UIParent" enableMouse="true" enableMouseWheel="true" movable="true" resizable="true" toplevel="true" hidden="true" clampedToScreen="true">
3
4 <Size width="500" height="600"/>
5 <KeyValues>
6 <KeyValue key="format" value="Devian [%s]" />
7 </KeyValues>
8 <Scripts>
9 <OnMouseDown>
10 if button == 'LeftButton' then
11 if self.sizer:IsMouseOver() then
12 return self:StartSizing()
13 end
14 return self:StartMoving()
15 end
16 </OnMouseDown>
17 <OnMouseUp>
18 if button == 'RightButton' then
19 if not self.minimized then
20 self.sizer:ClearAllPoints()
21 self.sizer:SetPoint('TOPRIGHT')
22 self:SetHeight(20)
23 self.minimized = true
24 return self.console:Hide()
25 else
26 self.sizer:ClearAllPoints()
27 self.sizer:SetPoint('BOTTOMRIGHT')
28 self:SetHeight(DevianDB.height)
29 self.minimized = nil
30 return self.console:Show()
31 end
32 end
33 self:StopMovingOrSizing()
34 Devian:SavePos()
35 </OnMouseUp>
36 <OnMouseWheel>
37 local up = delta > 0
38 if IsControlKeyDown() then
39 if up then self.console:ScrollToTop()
40 else self.console:ScrollToBottom() end
41 elseif IsShiftKeyDown() then
42 if up then self.console:PageUp()
43 else self.console:PageDown() end
44 else
45 if up then self.console:ScrollUp()
46 else self.console:ScrollDown() end
47 end
48 </OnMouseWheel>
49 <OnUpdate>
50 if not self.throttle then
51 self.throttle = GetTime()
52 elseif (GetTime()-self.throttle &lt; 0.2) then
53 return
54 else
55 self.throttle = GetTime()
56 end
57
58 self.text:SetText(string.format(self.format, GetTime()))
59 </OnUpdate>
60 </Scripts>
61
62 <Frames>
63 <ScrollingMessageFrame name="$parentBuffer" parentkey="console" maxLines="500" displayduration="2000000">
64 <Anchors>
65 <Anchor point="TOPLEFT" y="-20" />
66 <Anchor point="BOTTOMRIGHT" />
67 </Anchors>
68 <FontString font="Interface\Addons\Devian\font\SourceCodePro-Regular.ttf" wordwrap="true" maxLines="500"
69 justifyH="LEFT"
70 indented="true"
71 setAllPoints="true">
72 <FontHeight>
73 <AbsValue val="12"/>
74 </FontHeight>
75 </FontString>
76
77 <Layers>
78 <Layer level="BACKGROUND">
79 <Texture name="DevianConsoleBG" parentKey="backdrop" setAllPoints="true" alphaMode="MOD">
80 <Color r="1" g="1" b="1" a="1"/>
81 <Gradient orientation="HORIZONTAL">
82 <MinColor a="1" r="0" g="0" b="0"/>
83 <MaxColor a="1" r="1" g="1" b="1"/>
84 </Gradient>
85 </Texture>
86 </Layer>
87 </Layers>
88 </ScrollingMessageFrame>
89 </Frames>
90 <Layers>
91 <Layer level="OVERLAY">
92 <Texture parentKey="tbar" alphaMode="BLEND">
93 <Anchors>
94 <Anchor point="TOPLEFT" />
95 <Anchor point="TOPRIGHT" />
96 </Anchors>
97 <Size y="20" />
98 <Color r="0.3" g="0.3" b="0.3" a="1" />
99 </Texture>
100 <FontString parentKey="text" font="Interface\Addons\Devian\font\SourceCodePro-Bold.ttf" wordwrap="true" maxLines="500"
101 justifyH="LEFT"
102 indented="true">
103 <Anchors>
104 <Anchor point="TOPLEFT" x="4" y="-2" />
105 <Anchor point="TOPRIGHT" x="-4" />
106 </Anchors>
107 <Size y="20" />
108 <FontHeight>
109 <AbsValue val="12"/>
110 </FontHeight>
111 </FontString>
112 </Layer>
113 <Layer level="HIGHLIGHT">
114 <Texture parentKey="sizer" alphaMode="BLEND">
115 <Anchors>
116 <Anchor point="BOTTOMRIGHT" />
117 </Anchors>
118 <Size x="20" y="20" />
119 <Color r="1" g="1" b="1" a="0.7"/>
120 </Texture>
121 </Layer>
122 </Layers>
123 </Frame>
124 </Ui>