changeset 55:1b8c597dba44

added movement fading todo: sort out dock mouseover hitches
author Nenue
date Wed, 06 Jan 2016 07:37:17 -0500
parents 25725b0c933c
children 4b1b301cf8d4
files Devian.lua Devian.toc Devian.xml UI.lua
diffstat 4 files changed, 69 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/Devian.lua	Tue Jan 05 01:41:22 2016 -0500
+++ b/Devian.lua	Wed Jan 06 07:37:17 2016 -0500
@@ -24,7 +24,12 @@
 local defaults = {
   ['global'] = {{}, {}},
   ['tags'] = {},
-  ['channels'] = {[1] = {signature = 'Main', index = 1, x = 100, y = 800, height = 500, width = 600, enabled = true}},
+  ['channels'] = {[1] = {
+    signature = 'Main',
+    index = 1,
+    x = 100, y = 800,
+    height = 500, width = 600,
+    enabled = true}},
   ['profiles'] = {
     {'Main', false},
     {'Devian', true},
@@ -34,7 +39,7 @@
   primary_channel = 1, -- the channel to which default output is sent
   current_channel = 1, -- the front channel
   max_channel = 1, -- the highest created channel id
-  enable = true, -- allow enabled consoles to appear
+  enabled = true, -- allow enabled consoles to appear
   load_message = "Defaults loaded.", -- messages to be displayed after reload
   font = [[Interface\Addons\Devian\font\SourceCodePro-Regular.ttf]], -- font info
   fontsize = 13,
@@ -49,14 +54,14 @@
 
   backdrop = {1,1,1,1},                                      -- background frame info
   backgrad = {'VERTICAL', 0.1, 0.1, 0.1,   1, 0, 0, 0, 1},
-  backblend = 'MOD',
+  backblend = 'BLEND',
   backalpha = 1,
   backborder = {.5,.5,.5,1},
   backheader = {.25,.25,.25,1},
 
   frontdrop = {1,1,1,1},                                     -- foreground frame info
   frontgrad = {'VERTICAL', 0.1, 0.1, 0.1,  1, 0, 0, 0, 1},
-  frontblend = 'MOD',
+  frontblend = 'BLEND',
   frontalpha = 1,
   frontborder = {.07,.47,1,1},
   frontheader = {1,1,1,1},
@@ -75,8 +80,10 @@
   dock_button_alpha_on = 1,
   dock_button_alpha_off = 0.2,
   dock_button_fade_in = 0.075,
-  dock_button_fade_out = 0.075
+  dock_button_fade_out = 0.075,
 
+  movement_fade = true,
+  movement_fade_time = 0.15,
 }
 
 local function ScanAddOnList(cmd, ...)
@@ -295,8 +302,8 @@
     return D.oldprint(prefix, ...)
   end
 
-  if prefix == nil then
-    prefix = 1
+  if tostring(prefix) == nil then
+    prefix = 'nil*'
   end
 
   local sendq = {}
@@ -333,7 +340,7 @@
   end
   pcolor = db.tagcolor[prefix]
 
-  local buffer = {'|cFF'.. pcolor..prefix ..'|r'}
+  local buffer = {}
   for i = 1, select('#',...) do
     local var = select(i, ...)
 
@@ -356,7 +363,10 @@
   end
   local message = concat(buffer, ' ')
   for id, channel in pairs(sendq) do
-    channel.out:AddMessage(message)
+    if channel.width < 250 then
+      prefix = string.sub(prefix, 0,2)
+    end
+    channel.out:AddMessage('|cFF'.. pcolor..prefix ..'|r ' .. message)
     UIFrameFadeIn(D.dock.buttons[id], db.dock_onshow_fade_time, db.dock_onshow_fade_from, db.dock_onshow_fade_to)
     UIFrameFadeIn(D.dock.buttons[id].caption, db.dock_onshow_fade_time, db.dock_onshow_fade_from, db.dock_onshow_fade_to)
   end
@@ -401,6 +411,26 @@
   end)
   --@end-debug@
 
+  -- movement fading
+  if db.movement_fade then
+    self:RegisterEvent('PLAYER_STARTED_MOVING', function()
+      for k, v in pairs(self.console) do
+        if v.enabled then
+          v.preAlpha = v:GetAlpha()
+          UIFrameFadeOut(v, db.movement_fade_time, v.preAlpha, 0)
+          UIFrameFadeOut(v.out, db.movement_fade_time, v.preAlpha, 0)
+        end
+      end
+    end)
+    self:RegisterEvent('PLAYER_STOPPED_MOVING', function()
+      for k, v in pairs(self.console) do
+        if v.enabled then
+          UIFrameFadeIn(v, db.movement_fade_time, v:GetAlpha(), v.alpha)
+          UIFrameFadeIn(v.out, db.movement_fade_time, v:GetAlpha(), v.alpha)
+        end
+      end
+    end)
+  end
 end
 
 function D:OnInitialize()
--- a/Devian.toc	Tue Jan 05 01:41:22 2016 -0500
+++ b/Devian.toc	Wed Jan 06 07:37:17 2016 -0500
@@ -1,6 +1,6 @@
 ## Interface: 60200
 ## Title: Devian
-## Notes: Addon toggler for lua development
+## Notes: AddOn Development Workspace
 ## Author: Krakyn
 ## Version: 2.0 @project-revision@
 ## SavedVariables: DevianDB
--- a/Devian.xml	Tue Jan 05 01:41:22 2016 -0500
+++ b/Devian.xml	Wed Jan 06 07:37:17 2016 -0500
@@ -81,7 +81,7 @@
     </FontString>
 
     <Layers>
-      <Layer level="BACKGROUND">
+      <Layer level="ARTWORK">
         <Texture name="$parentBackdrop" parentKey="backdrop" setAllPoints="true" alphaMode="BLEND">
           <Color r="1" g="1" b="1" a="1"/>
           <Gradient orientation="VERTICAL">
@@ -253,6 +253,31 @@
       </Layer>
     </Layers>
   </Frame>
+  <Button name="DevianExecButton" parent="UIParent" hidden="true">
+    <Size x="32" y="32" />
+    <Anchors>
+      <Anchor point="TOPRIGHT" relativePoint="TOPLEFT" relativeTo="DevianDock" x="-4"/>
+    </Anchors>
+
+    <NormalTexture file="Interface/Addons/Devian/arrow.blp" setAllPoints="true" alphaMode="ADD">
+      <Color r="1" g="1" b="1" a="1" />
+    </NormalTexture>
+    <PushedTexture file="Interface/Addons/Devian/arrow.blp" setAllPoints="true" alphaMode="ADD">
+      <Anchors>
+        <Anchor point="TOPRIGHT" x="-1" y="-1" />
+        <Anchor point="BOTTOMLEFT" x="1" y="1" />
+      </Anchors>
+      <Color r="1" g="0" b="0.5" a="1" />
+    </PushedTexture>
+
+
+
+    <Layers>
+      <Layer level="ARTWORK">
+
+      </Layer>
+    </Layers>
+  </Button>
 
   <Button name="DevianBeacon" hidden="true" inherits="DevianButton" virtual="true" enableMouse="true" alpha="1" frameStrata="MEDIUM">
     <Size x="64" y="32" />
--- a/UI.lua	Tue Jan 05 01:41:22 2016 -0500
+++ b/UI.lua	Wed Jan 06 07:37:17 2016 -0500
@@ -38,30 +38,12 @@
 
 local function Console_Save(self)
   local db = D.channels[self.index]
-  if self.x then
-    db.x = self.x
-  else
     db.x = self:GetLeft()
-  end
-
-  if self.y then
-    db.y = self.y
-  else
     db.y = (self:GetTop() - GetScreenHeight())
-  end
-
-  if self.width then
-    db.width = self.width
-  else
     db.width = self:GetWidth()
-  end
 
   if not self.minimized then
-    if self.height then
-      db.height = self.height
-    else
-      db.height = self:GetHeight()
-    end
+    db.height = self:GetHeight()
     self:SetHeight(db.height)
   end
 
@@ -122,10 +104,6 @@
     if up then
       self:StopMovingOrSizing()
       self:ToFront()
-      self.x = nil
-      self.y = nil
-      self.width = nil
-      self.height = nil
       self:Save()
     elseif self.out.grip:IsMouseOver() then
       self:StartSizing()
@@ -335,9 +313,9 @@
     channel:Maximize()
   end
 
-  if channel.enabled and db.enabled then -- hide or show last since Min/Max mess with visibility
+  if channel.enabled then -- hide or show last since Min/Max mess with visibility
   --print('setchan(5a) enable')
-  channel:Show()
+    channel:Show()
     channel:ToFront()
   else
     --print('setchan(5a) disable')