Quantcast

Size change menu added, .toc changed

Petr Grabovoy [06-25-16 - 11:36]
Size change menu added, .toc changed
Filename
Modules/ViragDevToolModulesCore.lua
ViragDevTool.lua
ViragDevTool.toc
ViragDevTool.xml
ViragDevToolOptions.lua
ViragDevToolOptions.xml
diff --git a/Modules/ViragDevToolModulesCore.lua b/Modules/ViragDevToolModulesCore.lua
index 6b68c5c..1975e42 100644
--- a/Modules/ViragDevToolModulesCore.lua
+++ b/Modules/ViragDevToolModulesCore.lua
@@ -1,6 +1,6 @@
 local ViragDevTool = ViragDevTool

---TODO not implemented yet just an idea
+--TODO not implemented yet just an idea .Dont have time for this right now
 --- This class handles modules that can be registered in this addon.
 -- if you want to create custom module it has to implement following methods
 -- module lifecicle is
diff --git a/ViragDevTool.lua b/ViragDevTool.lua
index 3802855..568c311 100644
--- a/ViragDevTool.lua
+++ b/ViragDevTool.lua
@@ -133,6 +133,7 @@ ViragDevTool = {

         -- stores arguments for fcunction calls --todo implement
         tArgs = {},
+        fontSize = 12, -- font size for default table
         colors = {
             white = "|cFFFFFFFF",
             gray = "|cFFBEB9B5",
@@ -438,7 +439,7 @@ function ViragDevTool:SortFnForCells(nodeList)
     end
     --lets try some better sorting if we have small number of records
     --numbers will be sorted not like 1,10,2 but like 1,2,10
-    if #nodeList < 100 then
+    if #nodeList < 300 then
         cmpFn = function(a, b)
             if a.name == "__index" then return true
             elseif b.name == "__index" then return false
@@ -464,6 +465,11 @@ end
 -----------------------------------------------------------------------------------------------
 -- UI
 -----------------------------------------------------------------------------------------------
+function ViragDevTool:UpdateUI()
+    self:UpdateMainTableUI()
+    self:UpdateSideBarUI()
+end
+
 function ViragDevTool:ToggleUI()
     self:Toggle(self.wndRef)
     self.settings.isWndOpen = self.wndRef:IsVisible()
@@ -559,7 +565,9 @@ function ViragDevTool:UpdateMainTableUI(force)
     self:ScrollBar_AddChildren(scrollFrame, "ViragDevToolEntryTemplate")

     local buttons = scrollFrame.buttons;
+
     local offset = HybridScrollFrame_GetOffset(scrollFrame)
+    self:UpdateScrollFrameRowSize(scrollFrame)
     local totalRowsCount = self.list.size
     local lineplusoffset;

@@ -576,9 +584,29 @@ function ViragDevTool:UpdateMainTableUI(force)
     end

     HybridScrollFrame_Update(scrollFrame, totalRowsCount * buttons[1]:GetHeight(), scrollFrame:GetHeight());
+
     scrollFrame.scrollChild:SetWidth(scrollFrame:GetWidth())
 end

+function ViragDevTool:UpdateScrollFrameRowSize(scrollFrame)
+    local currentFont = self.settings and self.settings.fontSize or 10
+
+    local buttons = scrollFrame.buttons;
+    local cellHeight = currentFont + currentFont * 0.2
+    cellHeight = cellHeight %2 == 0 and cellHeight or cellHeight + 1
+    for _, button in pairs(buttons) do
+        button:SetHeight(cellHeight)
+        local font = button.nameButton:GetFontString():GetFont()
+        button.nameButton:GetFontString():SetFont(font, currentFont)
+        button.rowNumberButton:GetFontString():SetFont(font, currentFont)
+        button.valueButton:GetFontString():SetFont(font, currentFont)
+    end
+
+    scrollFrame.buttonHeight = cellHeight
+
+
+end
+
 function ViragDevTool:UpdateMainTableUIOptimized()

     if (self.waitFrame == nil) then
@@ -608,6 +636,7 @@ function ViragDevTool:ScrollBar_AddChildren(scrollFrame, strTemplate)
         local scrollBarValue = scrollFrame.scrollBar:GetValue()
         HybridScrollFrame_CreateButtons(scrollFrame, strTemplate, 0, -2)
         scrollFrame.scrollBar:SetValue(scrollBarValue);
+
     end
 end

@@ -772,7 +801,7 @@ function ViragDevTool:UpdateSideBarUI()
     local buttons = scrollFrame.buttons;

     local offset = HybridScrollFrame_GetOffset(scrollFrame)
-    local data = self.settings[self.settings.sideBarTabSelected] or {}
+    local data = self.settings and self.settings[self.settings.sideBarTabSelected] or {}
     local totalRowsCount = self:tablelength(data)

     for k, frame in pairs(buttons) do
@@ -1023,7 +1052,6 @@ function ViragDevTool:OnLoad(mainFrame)
     self.wndRef.scrollFrame.update = function()
         self:ForceUpdateMainTableUI()
     end
-    self:ForceUpdateMainTableUI()

     self.wndRef.sideFrame.sideScrollFrame.update = function()
         self:UpdateSideBarUI()
@@ -1038,12 +1066,13 @@ function ViragDevTool:OnLoad(mainFrame)
             self:ExecuteCMD(msg, true)
         end
     end
+
+    self:UpdateUI()
 end

 function ViragDevTool:OnAddonSettingsLoaded()
     local s = ViragDevTool_Settings

-    self:Add(ViragDevTool_Settings.colors, "ViragDevTool_Settings.colors")
     if s == nil then
         s = self.default_settings
         ViragDevTool_Settings = s
@@ -1111,6 +1140,8 @@ function ViragDevTool:OnAddonSettingsLoaded()
     self:LoadInterfaceOptions()

     self.wndRef.columnResizer:SetPoint("TOPLEFT", self.wndRef, "TOPLEFT", s.collResizerPosition, -30)
+
+    self:UpdateUI()
 end

 -----------------------------------------------------------------------------------------------
diff --git a/ViragDevTool.toc b/ViragDevTool.toc
index bee5154..9a514f2 100644
--- a/ViragDevTool.toc
+++ b/ViragDevTool.toc
@@ -1,6 +1,6 @@
-## Interface: 60200
-## Title: Virag's WoW Dev Tool
-## Author: Varren@AzuregosRU
+## Interface: 70000
+## Title: ViragDevTool
+## Author: Varren@Azuregos-RU
 ## Version: 0.1
 ## SavedVariables: ViragDevTool_Settings
 ViragDevTool.lua
diff --git a/ViragDevTool.xml b/ViragDevTool.xml
index 1b1606a..e13c242 100644
--- a/ViragDevTool.xml
+++ b/ViragDevTool.xml
@@ -1,7 +1,7 @@
 <Ui>
     <!--FONTS -->
-    <Font name="ViragDevToolDefaultFont" inherits="SystemFont_Small" justifyV="TOP" justifyH="LEFT" />
-    <Font name="ViragDevToolMediumFont" inherits="SystemFont_Med1" justifyV="TOP" justifyH="LEFT" virtual="true"/>
+    <Font name="ViragDevToolDefaultFont" inherits="SystemFont_Small" justifyV="CENTER" justifyH="LEFT" />
+    <Font name="ViragDevToolMediumFont" inherits="SystemFont_Med1" justifyV="CENTER" justifyH="LEFT" virtual="true"/>

     <Texture name="ViragDevToolStrokeTexture" virtual="true">
         <Color r="0.1" g="0.1" b="0.1" a="1"/>
@@ -105,7 +105,7 @@
         </Anchors>
         <Scripts>
             <OnLoad>
-                self.scrollChild:SetPoint("BOTTOM")
+                self.scrollChild:SetPoint("BOTTOM", self, "BOTTOM", 0, -100)
             </OnLoad>
         </Scripts>
         <Frames>
@@ -265,7 +265,7 @@

     <!--ROW FOR MAIN HybridScrollFrameTemplate -->
     <Button name="ViragDevToolEntryTemplate" inherits="ViragDevToolRowTemplate" virtual="true">
-        <Size y="13"/>
+        <Size y="7"/>
         <Frames>
             <!--COLUMN 1-->
             <Button text="123456" name="$parentCountColumn" inherits="ViragDevToolColumnTemplate"
diff --git a/ViragDevToolOptions.lua b/ViragDevToolOptions.lua
index 2c6a54a..759bf56 100644
--- a/ViragDevToolOptions.lua
+++ b/ViragDevToolOptions.lua
@@ -7,13 +7,12 @@ end

 function ViragDevTool:LoadInterfaceOptions()
     if not self.wndRef.optionsFrame then
-        local frame = CreateFrame("Frame", "ViragDevToolOptionsMainFrame", self.wndRef, "ViragDevToolFrameTemplate")
+        local frame = CreateFrame("Frame", "ViragDevToolOptionsMainFrame", self.wndRef, "ViragDevToolOptionsFrameRowTemplate")
         frame:SetPoint("BOTTOM", self.wndRef, "TOP")
         frame:SetHeight(35)
         frame:SetPoint("LEFT")
         frame:SetPoint("RIGHT")
         frame:Hide()
-        self:Add(frame, "ViragDevToolOptionsFrameRowTemplate")

         self:CreateColorPickerFrame(frame)
         self.wndRef.optionsFrame = frame
@@ -70,17 +69,27 @@ function ViragDevTool:CreateColorPickerFrame(parent)
         xOffset = 5
     end

+    local updateFontSize = function(button, fontSize)
+        button:SetText("Font: " .. tostring(fontSize))
+        ViragDevTool:UpdateMainTableUI()
+    end
+
     local button = CreateFrame("Button", "VDTFrameColorReset", parent, "ViragDevToolButtonTemplate")
     button:SetPoint(point, relativeTo, relativePoint, xOffset, yOffset)
     button:SetPoint("TOP", parent, "TOP", -5, -5)
     button:SetPoint("BOTTOM", parent, "BOTTOM", -5, 5)
-    button:SetText("Reset")
+
+    updateFontSize(button, self.settings.fontSize)
     button:SetScript("OnMouseUp", function(this, mouseButton, down)
-        for _, button in pairs(buttons) do
-            local color = button:GetText()
-            ViragDevTool.colors[color] = ViragDevTool.default_settings.colors[color]
-            update(button, color)
+        if mouseButton == "RightButton" then
+            self.settings.fontSize = self.settings.fontSize - 1
+
+        elseif mouseButton == "LeftButton" then
+            self.settings.fontSize = self.settings.fontSize + 1
         end
+
+        updateFontSize(this, self.settings.fontSize )
+
     end)
 end

diff --git a/ViragDevToolOptions.xml b/ViragDevToolOptions.xml
index 7a37ce6..6d0811a 100644
--- a/ViragDevToolOptions.xml
+++ b/ViragDevToolOptions.xml
@@ -1,7 +1,6 @@
 <Ui>


-
     <Frame name="VDTColorPickerFrameItemTemplate" virtual="true">
         <Size x="100" y="25"/>

@@ -32,23 +31,24 @@
                             <Color r="0.5" g="0" b="0" a="1"/>
                         </Texture>
                     </Layer>
+
                 </Layers>
             </Button>
         </Frames>
     </Frame>
-    <Layers>
-        <Layer level="ARTWORK">
-            <Texture>
-                <Anchors>
-                    <Anchor point="TOPRIGHT"/>
-                    <Anchor point="BOTTOMLEFT"/>
-                </Anchors>
-                <Color r="0" g="0.30" b="0.1" a="0.7"/>
-            </Texture>
-        </Layer>
-    </Layers>
+
     <Frame name="ViragDevToolOptionsFrameRowTemplate" virtual="true">
         <Layers>
+            <Layer level="ARTWORK">
+                <Texture>
+                    <Anchors>
+                        <Anchor point="TOPRIGHT"/>
+                        <Anchor point="BOTTOMLEFT"/>
+                    </Anchors>
+                    <!-- <Color r="0.5" g="0.7" b="0.9" a="0.8"/>-->
+                    <Color r="0.5" g="0" b="0" a="0.5"/>
+                </Texture>
+            </Layer>
             <Layer level="BACKGROUND">
                 <Texture>
                     <Anchors>
@@ -56,7 +56,17 @@
                         <Anchor point="BOTTOMLEFT"/>
                     </Anchors>
                     <!-- <Color r="0.5" g="0.7" b="0.9" a="0.8"/>-->
-                    <Color r="0.5" g="0" b="0.1" a="0.5"/>
+                    <Color r="0" g="0" b="0.1" a="0.5"/>
+                </Texture>
+            </Layer>
+            <Layer level="OVERLAY">
+                <Texture>
+                    <Size y="1"/>
+                    <Anchors>
+                        <Anchor point="BOTTOMRIGHT" />
+                        <Anchor point="LEFT" />
+                    </Anchors>
+                    <Color r="0.5" g="0.2" b="0.2" a="0.5"/>
                 </Texture>
             </Layer>
         </Layers>