view Devian.xml @ 13:080dfa4990fb

necessary abstractions for running multiple console buffers in place message prefix can act as a channel selector when tagged in savedvars more frame vars defined in the XML XML parentKey names organized
author Nenue
date Sat, 19 Dec 2015 07:59:12 -0500
parents 65fcb81f4e0a
children 5254d1ba6013
line wrap: on
line source
<Ui>
  <Frame
      name="DevianConsole"
      parent="UIParent"
      enableMouse="true"
      enableMouseWheel="true"
      clampedToScreen="true"
      movable="true"
      resizable="true"
      toplevel="true"
      hidden="true"
      virtual="true">
    <KeyValues>
      <KeyValue key="index" type="number" value="1" />
      <KeyValue key="name" value="Devian" />
      <KeyValue key="format" value="Devian [%s]" />
    </KeyValues>
    <ResizeBounds>
      <minResize x="200" y="20" />
      <maxResize x="1920" y="1200" />
    </ResizeBounds>
    <Scripts>
      <OnMouseDown>
        if button == 'LeftButton' then
          if self.grip:IsMouseOver() then
            return self:StartSizing()
          end
          return self:StartMoving()
        end
      </OnMouseDown>
      <OnMouseUp>
        if button == 'RightButton' then
          return self:MinMax()
        end
        self:StopMovingOrSizing()
        self:Save()
      </OnMouseUp>
      <OnMouseWheel>
        local up =  delta > 0
        if IsControlKeyDown() then
          if up then self.out:ScrollToTop()
          else self.out:ScrollToBottom() end
        elseif IsShiftKeyDown() then
          if up then self.out:PageUp()
          else self.out:PageDown() end
        else
          if up then self.out:ScrollUp()
          else self.out: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.header:SetText(string.format(self.format, GetTime()))
      </OnUpdate>
    </Scripts>

    <Frames>
      <ScrollingMessageFrame
          name="$parentScrollFrame"
          parentkey="out"
          maxLines="500"
          fade="false"
          displayduration="2147483647"
          insertMode="BOTTOM">
        <Anchors>
          <Anchor point="TOPLEFT" y="-20" />
          <Anchor point="BOTTOMRIGHT" />
        </Anchors>
        <FontString  font="Interface\Addons\Devian\font\SourceCodePro-Regular.ttf" wordwrap="true"
                    justifyH="LEFT"
                    indented="true"
                    setAllPoints="true">
          <FontHeight>
            <AbsValue val="13"/>
          </FontHeight>
        </FontString>

        <Layers>
          <Layer level="BACKGROUND">
            <Texture name="$parentbg" parentKey="backdrop" setAllPoints="true" alphaMode="BLEND">
              <Color r="1" g="1" b="1" a="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>
        </Layers>
      </ScrollingMessageFrame>
    </Frames>
    <Layers>
      <Layer level="BORDER">
        <Texture parentKey="titlebar" 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" />
          <Gradient orientation="VERTICAL">
            <MinColor r="0" g="0" b="0" a="0.7"/>
            <MaxColor r="0.3" g="0.3" b="0.3" a="0.7"/>
          </Gradient>
        </Texture>
        <FontString parentKey="header" font="Interface\Addons\Devian\font\SourceCodePro-Bold.ttf" wordwrap="true"
                    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="OVERLAY">
        <Texture parentKey="grip" strata="HIGH" alphaMode="ADD">
          <Anchors>
            <Anchor point="BOTTOMRIGHT" x="-1" y="1" />
          </Anchors>
          <Size x="18" y="18" />
          <Color r="1" g="1" b="1" a="1"/>
          <Gradient orientation="VERTICAL">
            <MaxColor r="0.2" g="0.2" b="0.2" a="1"/>
            <MinColor r="0.5" g="0.5" b="0.5" a="1"/>
          </Gradient>
        </Texture>
      </Layer>
    </Layers>
  </Frame>
</Ui>