changeset 5:ac644fc860cc

ResizeBounds set Min/Maximize moved into lua
author Nenue
date Fri, 18 Dec 2015 20:12:18 -0500
parents 247118593c66
children b526dc930b15
files Devian.lua Devian.xml
diffstat 2 files changed, 33 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/Devian.lua	Fri Dec 18 19:48:10 2015 -0500
+++ b/Devian.lua	Fri Dec 18 20:12:18 2015 -0500
@@ -19,6 +19,9 @@
     y = -150,
     height = 500,
     width = 600,
+    font = [[Interface\Addons\Devian\font\SourceCodePro-Regular.ttf]],
+    fontsize = 13,
+    fontoutline = 'NONE',
   }
   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
@@ -133,10 +136,10 @@
   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.console:SetFading(false)
   f.console:SetTimeVisible(2147483647)
+  f.console:SetFont(db.font, db.fontsize, db.fontoutline)
   --f:SetJustifyH('LEFT')
 
 
@@ -189,6 +192,25 @@
   DEVIAN_FRAME.console:AddMessage(table.concat(buffer, ' '))
   table.wipe(buffer)
 end
+function D:ToggleMinMax()
+  if DEVIAN_FRAME.minimized then
+    self:Maximize()
+  else
+    self:Minimize()
+  end
+end
+function D:Minimize()
+  DEVIAN_FRAME.sizer:ClearAllPoints()
+  DEVIAN_FRAME:SetHeight(20)
+  DEVIAN_FRAME.minimized = true
+  return DEVIAN_FRAME.console:Hide()
+end
+function D:Maximize()
+  DEVIAN_FRAME.sizer:ClearAllPoints()
+  DEVIAN_FRAME:SetHeight(DevianDB.height)
+  DEVIAN_FRAME.minimized = nil
+  return DEVIAN_FRAME.console:Show()
+end
 
 function D:OnEnable()
   if db.enabled then
@@ -199,6 +221,7 @@
   end
 end
 
+
 function D:OnInitialize()
 
   if not db[PLAYER_REALM] then
@@ -226,6 +249,7 @@
     db.console = (db.console == false) and true or false
     if db.console then
       DEVIAN_FRAME:Show()
+      D:Maximize()
     else
       DEVIAN_FRAME:Hide()
     end
--- a/Devian.xml	Fri Dec 18 19:48:10 2015 -0500
+++ b/Devian.xml	Fri Dec 18 20:12:18 2015 -0500
@@ -5,6 +5,10 @@
     <KeyValues>
       <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
@@ -16,19 +20,7 @@
       </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
+          return Devian:ToggleMinMax()
         end
         self:StopMovingOrSizing()
         Devian:SavePos()
@@ -65,12 +57,12 @@
           <Anchor point="TOPLEFT" y="-20" />
           <Anchor point="BOTTOMRIGHT" />
         </Anchors>
-        <FontString font="Interface\Addons\Devian\font\SourceCodePro-Regular.ttf" wordwrap="true" maxLines="500"
+        <FontString  font="Interface\Addons\Devian\font\SourceCodePro-Regular.ttf" wordwrap="true"
                     justifyH="LEFT"
                     indented="true"
                     setAllPoints="true">
           <FontHeight>
-            <AbsValue val="12"/>
+            <AbsValue val="13"/>
           </FontHeight>
         </FontString>
 
@@ -97,7 +89,7 @@
           <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"
+        <FontString parentKey="text" font="Interface\Addons\Devian\font\SourceCodePro-Bold.ttf" wordwrap="true"
                     justifyH="LEFT"
                     indented="true">
           <Anchors>