diff --git a/VarrenDevTool.lua b/VarrenDevTool.lua
deleted file mode 100644
index cbec5be..0000000
--- a/VarrenDevTool.lua
+++ /dev/null
@@ -1,288 +0,0 @@
-local VarrenDevToolLinkedList = { size = 0; first = nil, last = nil }
-
-function VarrenDevToolLinkedList:GetInfoAtPosition(position)
- if self.size < position or self.first == nil then
- return nil
- end
-
- local node = self.first
- while position > 1 do
- node = node.next
- position = position - 1
- end
-
- return node
-end
-
-function VarrenDevToolLinkedList:AddNodeAfter(node, prevNode)
- local tempNext = node.next
- node.next = prevNode
- prevNode.next = tempNext
- self.size = self.size + 1;
-end
-
-function VarrenDevToolLinkedList:AddNodesAfter(nodeList, parentNode)
- local tempNext = parentNode.next
- local currNode = parentNode;
-
- for _, node in pairs(nodeList) do
- currNode.next = node
- currNode = node
- self.size = self.size + 1;
- end
-
- currNode.next = tempNext
-
- if tempNext == nil then
- self.last = currNode
- end
-end
-
-function VarrenDevToolLinkedList:AddNode(data, dataName)
- local node = self:NewNode(data, dataName)
-
- if self.first == nil then
- self.first = node
- self.last = node
- else
- if self.last ~= nil then
- self.last.next = node
- end
- self.last = node
- end
-
- self.size = self.size + 1;
-end
-
-function VarrenDevToolLinkedList:NewNode(data, dataName, padding, parent)
- return {
- name = dataName,
- value = data,
- next = nil,
- padding = padding == nil and 0 or padding,
- parent = parent
- }
-end
-
-function VarrenDevToolLinkedList:RemoveChildNodes(node)
- local currNode = node
-
- while true do
-
- currNode = currNode.next
-
- if currNode == nil then
- node.next = nil
- self.last = node
- break
- end
-
- if currNode.padding <= node.padding then
- node.next = currNode
- break
- end
-
- self.size = self.size - 1
- end
-end
-
-function VarrenDevToolLinkedList:Clear()
- self.size = 0
- self.first = nil
- self.last = nil
-end
-
-local pairs, tostring, type, print, string, getmetatable, table,pcall = pairs, tostring, type, print, string, getmetatable, table,pcall
-local HybridScrollFrame_CreateButtons, HybridScrollFrame_GetOffset, HybridScrollFrame_Update = HybridScrollFrame_CreateButtons,HybridScrollFrame_GetOffset, HybridScrollFrame_Update
-
-function VarrenDevTool_ExpandCell(info)
-
- local nodeList = {}
- local padding = info.padding + 1
- local couner = 0
- for k, v in pairs(info.value) do
- if type(v) ~= "userdata" then
-
- nodeList[couner] = VarrenDevToolLinkedList:NewNode(v, tostring(k), padding, info)
- else
- local mt = getmetatable(info.value)
- if mt then
- nodeList[couner] = VarrenDevToolLinkedList:NewNode(mt.__index, "$metatable", padding, info)
- end
- end
- couner = couner + 1
- end
-
- table.sort(nodeList, function(a, b)
- return a.name < b.name
- end)
-
- VarrenDevToolLinkedList:AddNodesAfter(nodeList, info)
- info.expanded = true
- VarrenDevTool_ScrollBar_Update()
-end
-
-function VarrenDevTool_ColapseCell(info)
- VarrenDevToolLinkedList:RemoveChildNodes(info)
- info.expanded = nil
- print("size: " .. VarrenDevToolLinkedList.size)
- VarrenDevTool_ScrollBar_Update()
-end
-
-function VarrenDevTool_AddData(data, dataName)
- VarrenDevToolLinkedList:AddNode(data, dataName)
- VarrenDevTool_ScrollBar_Update()
-end
-
-function VarrenDevTool_ClearData()
- VarrenDevToolLinkedList:Clear()
- VarrenDevTool_ScrollBar_Update()
-end
-
-function VarrenDevTool_ScrollBar_Update()
-
- local scrollFrame = VarrenDevToolScrollFrame
-
- local buttons = scrollFrame.buttons;
- local offset = HybridScrollFrame_GetOffset(scrollFrame)
- local totalRowsCount = VarrenDevToolLinkedList.size
- local lineplusoffset; -- an index into our data calculated from the scroll offset
-
- local nodeInfo = VarrenDevToolLinkedList:GetInfoAtPosition(offset)
- for k, view in pairs(buttons) do
-
- lineplusoffset = k + offset;
- -- print("ok: " .. lineplusoffset .. " " .. offset .. " " .. k .. " " .. (nodeInfo ~= nil and nodeInfo.name or "nil"))
- if lineplusoffset <= totalRowsCount then
- VarrenDevTool_UpdateListItem(view, nodeInfo, lineplusoffset)
- nodeInfo = nodeInfo.next
- view:Show();
- else
- view:Hide();
- end
- end
-
- HybridScrollFrame_Update(scrollFrame, totalRowsCount * buttons[1]:GetHeight(), scrollFrame:GetHeight());
-
-end
-
-
-
-function VarrenDevTool_UpdateListItem(node, info, id)
- local nameButton = node.nameButton;
- local typeButton = node.typeButton
- local valueButton = node.valueButton
- local rowNumberButton = node.rowNumberButton
-
- local value = info.value
- local name = info.name
- local padding = info.padding
-
- nameButton:SetPoint("LEFT", node.typeButton, "RIGHT", 20 * padding, 0)
-
- local valueType = type(value)
-
- valueButton:SetText(tostring(value))
- nameButton:SetText(tostring(name))
- typeButton:SetText(valueType)
- rowNumberButton:SetText(tostring(id))
-
- local color = "VarrenDevToolBaseFont"
- if valueType == "table" then
- if name ~= "$metatable" then
- if value.GetObjectType then
- if value.IsForbidden and value:IsForbidden() then
- else
- valueButton:SetText(value:GetObjectType() .. " " .. tostring(value))
- end
- end
- color = "VarrenDevToolTableFont";
- else
- color = "VarrenDevToolMetatableFont";
- end
- local resultStringName = tostring(name)
- local MAX_STRING_SIZE = 60
- if #resultStringName >= MAX_STRING_SIZE then
- resultStringName = string.sub(resultStringName, 0, MAX_STRING_SIZE) .. "..."
- end
-
- local function tablelength(T)
- local count = 0
- for _ in pairs(T) do count = count + 1 end
- return count
- end
-
- nameButton:SetText(resultStringName .. " (" .. tablelength(value) .. ") ");
-
- elseif valueType == "userdata" then
- color = "VarrenDevToolTableFont";
- elseif valueType == "string" then
- valueButton:SetText(string.gsub(string.gsub(tostring(value), "|n", ""), "\n", ""))
- color = "VarrenDevToolStringFont";
- elseif valueType == "number" then
- color = "VarrenDevToolNumberFont";
- elseif valueType == "function" then
- color = "VarrenDevToolFunctionFont";
- end
-
-
-
- node.nameButton:SetNormalFontObject(color);
- node.typeButton:SetNormalFontObject(color)
- node.valueButton:SetNormalFontObject(color)
- node.rowNumberButton:SetNormalFontObject(color)
-
- if valueType == "table" then
- nameButton:SetScript("OnMouseUp", function(self, button, down)
- print("click")
- if info.expanded then
- VarrenDevTool_ColapseCell(info)
- else
- VarrenDevTool_ExpandCell(info)
- end
- end)
- elseif valueType == "function" then
- nameButton:SetScript("OnMouseUp", function(self, button, down)
- print("click")
- VarrenDevTool_TryCallFunction(info)
- end)
- else
- nameButton:SetScript("OnMouseUp", nil)
- end
-end
-
-function VarrenDevTool_TryCallFunction(info)
- local value = info.value
-
- local ok, result = pcall(value)
- if ok then
- local resultType = type(result)
- local additionalInfo = ""
- if resultType == "string" or resultType == "number" then
- additionalInfo = tostring(result)
- end
-
- print("returns: " .. resultType .. " " .. additionalInfo)
- else
- local parent = info.parent
- if parent then
- if parent.name == "$metatable" then
- parent = parent.parent
- print("found metatable" .. info.name)
- end
-
- local ok, result = pcall(parent.value[info.name], parent.value)
- local resultType = type(result)
- local additionalInfo = tostring(result)
-
- print(parent.name ..":".. info.name .."() returns: " .. additionalInfo.. " ("..resultType ..")" )
- end
- end
-end
-
-
-function DEBUG(self, text)
- if self.debug then
- print(text);
- end
-end
diff --git a/VarrenDevTool.toc b/VarrenDevTool.toc
deleted file mode 100644
index 6470f06..0000000
--- a/VarrenDevTool.toc
+++ /dev/null
@@ -1,6 +0,0 @@
-## Interface: 60200
-## Title: Varren's WoW Dev Tool
-## Author: Varren@AzuregosRU
-## Version: 0.1
-
-VarrenDevTool.xml
diff --git a/VarrenDevTool.xml b/VarrenDevTool.xml
deleted file mode 100644
index 9a12344..0000000
--- a/VarrenDevTool.xml
+++ /dev/null
@@ -1,233 +0,0 @@
-<Ui>
- <Script file="VarrenDevTool.lua"/>
- <Font name="VarrenDevToolDefaultFont" inherits="SystemFont_Small" justifyW="LEFT" justifyH="LEFT" virtual="true"/>
-
- <Font name="VarrenDevToolTableFont" inherits="VarrenDevToolDefaultFont" virtual="true">
- <Color r="0.41" g="0.80" b="0.94"/>
- </Font>
- <Font name="VarrenDevToolStringFont" inherits="VarrenDevToolDefaultFont" virtual="true">
- <Color r="0.67" g="0.83" b="0.45"/>
- </Font>
- <Font name="VarrenDevToolNumberFont" inherits="VarrenDevToolDefaultFont" virtual="true">
- <Color r="1.0" g="0.96" b="0.41"/>
- </Font>
- <Font name="VarrenDevToolFunctionFont" inherits="VarrenDevToolDefaultFont" virtual="true">
- <Color r="1.0" g="0.49" b="0.04"/>
- </Font>
- <Font name="VarrenDevToolBaseFont" inherits="VarrenDevToolDefaultFont" virtual="true">
- <Color r="1.0" g="1.0" b="1.0"/>
- </Font>
- <Font name="VarrenDevToolMetatableFont" inherits="VarrenDevToolDefaultFont" virtual="true">
- <Color r="1.0" g="1.0" b="1.0"/>
- </Font>
-
- <Button text="Test" name="VarrenDevToolTopButton" inherits="UIPanelButtonTemplate" virtual="true">
- <Size>
- <AbsDimension x="150" y="25"/>
- </Size>
- <NormalFont style="GameFontHighlightLeft"/>
- </Button>
-
- <Frame name="VarrenDevToolEntryTemplate" virtual="true">
- <Anchors>
- <Anchor point="TOPLEFT"/>
- </Anchors>
- <Size>
- <AbsDimension x="1200" y="12"/>
- </Size>
- <Frames>
- <Button text="table" name="$parentRowCellCount" parentKey="rowNumberButton">
- <Size>
- <AbsDimension x="50"/>
- </Size>
- <Anchors>
- <Anchor point="TOP"/>
- <Anchor point="BOTTOM"/>
- <Anchor point="LEFT"/>
- </Anchors>
-
- <NormalFont style="VarrenDevToolDefaultFont"/>
- </Button>
- <Button text="123456" name="$parentRowType" parentKey="typeButton">
- <Size>
- <AbsDimension x="50"/>
- </Size>
- <Anchors>
- <Anchor point="TOP"/>
- <Anchor point="BOTTOM"/>
- <Anchor point="LEFT" relativeTo="$parentRowCellCount" relativePoint="RIGHT">
- </Anchor>
- </Anchors>
-
- <NormalFont style="VarrenDevToolDefaultFont"/>
- </Button>
-
- <Button text="Test Text" name="$parentNameRow" parentKey="nameButton">
- <Size>
- <AbsDimension x="400"/>
- </Size>
- <Anchors>
- <Anchor point="TOP"/>
- <Anchor point="BOTTOM"/>
- <Anchor point="LEFT" relativeTo="$parentRowCellCount" relativePoint="RIGHT"/>
- </Anchors>
-
- <NormalFont style="VarrenDevToolDefaultFont"/>
- </Button>
- <Button text="Test Text" name="$parentValueRow" parentKey="valueButton">
- <Size>
- <AbsDimension x="700"/>
- </Size>
- <Anchors>
- <Anchor point="TOP"/>
- <Anchor point="BOTTOM"/>
- <Anchor point="RIGHT"/>
- <Anchor point="LEFT" relativeTo="$parentNameRow" relativePoint="RIGHT"/>
-
- </Anchors>
-
- <NormalFont style="VarrenDevToolDefaultFont"/>
- </Button>
- </Frames>
- </Frame>
- <Frame name="VarrenDevTool" parent="UIParent" enableMouse="true" movable="true" resizable="true">
- <Size>
- <AbsDimension x="1200" y="600"/>
- </Size>
- <Anchors>
- <Anchor point="CENTER"/>
- </Anchors>
- <Scripts>
- <OnLoad>
- self:RegisterForDrag("LeftButton");
- </OnLoad>
- <OnDragStart>
- self:StartSizing()
- </OnDragStart>
- <OnReceiveDrag>
- VarrenDevTool_ScrollBar_Update()
- </OnReceiveDrag>
- <OnDragStop>
- HybridScrollFrame_CreateButtons(self.scrollFrame, "VarrenDevToolEntryTemplate", 0, -2)
- self:StopMovingOrSizing();
- </OnDragStop>
- </Scripts>
- <Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border"
- tile="true">
- <BackgroundInsets>
- <AbsInset left="4" right="4" top="4" bottom="4"/>
- </BackgroundInsets>
- <TileSize>
- <AbsValue val="16"/>
- </TileSize>
- <EdgeSize>
- <AbsValue val="16"/>
- </EdgeSize>
- </Backdrop>
-
- <Frames>
- <ScrollFrame name="$parentScrollFrame" inherits="HybridScrollFrameTemplate" parentKey="scrollFrame">
- <Anchors>
- <Anchor point="TOPLEFT">
- <Offset>
- <AbsDimension x="8" y="-8"/>
- </Offset>
- </Anchor>
- <Anchor point="BOTTOMRIGHT">
- <Offset>
- <AbsDimension x="-30" y="8"/>
- </Offset>
- </Anchor>
- </Anchors>
- <Scripts>
- <OnShow>
- print("OnShow GetHeight: "..self:GetHeight())
- HybridScrollFrame_CreateButtons(self, "VarrenDevToolEntryTemplate", 0, -2)
- VarrenDevTool_ScrollBar_Update()
- </OnShow>
-
- <OnLoad>
- print("OnLoad GetHeight: "..self:GetHeight())
- self.update = VarrenDevTool_ScrollBar_Update
- </OnLoad>
- </Scripts>
- <Frames>
- <Slider name="$parentScrollBar" inherits="HybridScrollBarTemplate">
- <Anchors>
- <Anchor point="TOPLEFT" relativePoint="TOPRIGHT" x="3" y="-12"/>
- <Anchor point="BOTTOMLEFT" relativePoint="BOTTOMRIGHT" x="3" y="13"/>
- </Anchors>
- </Slider>
- </Frames>
- </ScrollFrame>
- <Frame name="$parentTopBar" parent="VarrenDevTool" enableMouse="true">
- <Size>
- <AbsDimension y="25"/>
- </Size>
- <Scripts>
- <OnLoad>
- self:RegisterForDrag("LeftButton");
- </OnLoad>
- <OnDragStart>
- self:GetParent():StartMoving()
- </OnDragStart>
- <OnReceiveDrag>
- VarrenDevTool_ScrollBar_Update()
- </OnReceiveDrag>
- <OnDragStop>
- self:GetParent():StopMovingOrSizing();
- </OnDragStop>
- </Scripts>
-
- <Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background"
- tile="true">
-
- <TileSize>
- <AbsValue val="16"/>
- </TileSize>
- <EdgeSize>
- <AbsValue val="16"/>
- </EdgeSize>
- </Backdrop>
- <Anchors>
- <Anchor point="LEFT"/>
- <Anchor point="RIGHT"/>
- <Anchor point="BOTTOM" relativeTo="$parent" relativePoint="TOP"/>
- </Anchors>
- <Frames>
- <Button text="CLEAR" name="$parentClearButton" inherits="VarrenDevToolTopButton">
- <Scripts>
- <OnClick>
- VarrenDevTool_ClearData()
- </OnClick>
- </Scripts>
- <Anchors>
- <Anchor point="TOPLEFT"/>
- </Anchors>
- </Button>
- <Button text="_G" name="$parentAddGlobalButton" inherits="VarrenDevToolTopButton">
- <Scripts>
- <OnClick>
- VarrenDevTool_AddData(_G, "_G")
- </OnClick>
- </Scripts>
- <Anchors>
- <Anchor point="LEFT" relativeTo="$parentClearButton" relativePoint="RIGHT"/>
- </Anchors>
- </Button>
- <Button text="Unit" name="$parentAddPlayerInfoButton" inherits="VarrenDevToolTopButton">
- <Scripts>
- <OnClick>
- local name, realm = UnitFullName("player")
- VarrenDevTool_AddData(UnitGUID("player"), name .. "-" .. realm)
- </OnClick>
- </Scripts>
- <Anchors>
- <Anchor point="LEFT" relativeTo="$parentAddGlobalButton" relativePoint="RIGHT"/>
- </Anchors>
- </Button>
- </Frames>
- </Frame>
- </Frames>
- </Frame>
-</Ui>
\ No newline at end of file
diff --git a/ViragDevTool.lua b/ViragDevTool.lua
new file mode 100644
index 0000000..321c313
--- /dev/null
+++ b/ViragDevTool.lua
@@ -0,0 +1,288 @@
+local ViragDevToolLinkedList = { size = 0; first = nil, last = nil }
+
+function ViragDevToolLinkedList:GetInfoAtPosition(position)
+ if self.size < position or self.first == nil then
+ return nil
+ end
+
+ local node = self.first
+ while position > 1 do
+ node = node.next
+ position = position - 1
+ end
+
+ return node
+end
+
+function ViragDevToolLinkedList:AddNodeAfter(node, prevNode)
+ local tempNext = node.next
+ node.next = prevNode
+ prevNode.next = tempNext
+ self.size = self.size + 1;
+end
+
+function ViragDevToolLinkedList:AddNodesAfter(nodeList, parentNode)
+ local tempNext = parentNode.next
+ local currNode = parentNode;
+
+ for _, node in pairs(nodeList) do
+ currNode.next = node
+ currNode = node
+ self.size = self.size + 1;
+ end
+
+ currNode.next = tempNext
+
+ if tempNext == nil then
+ self.last = currNode
+ end
+end
+
+function ViragDevToolLinkedList:AddNode(data, dataName)
+ local node = self:NewNode(data, dataName)
+
+ if self.first == nil then
+ self.first = node
+ self.last = node
+ else
+ if self.last ~= nil then
+ self.last.next = node
+ end
+ self.last = node
+ end
+
+ self.size = self.size + 1;
+end
+
+function ViragDevToolLinkedList:NewNode(data, dataName, padding, parent)
+ return {
+ name = dataName,
+ value = data,
+ next = nil,
+ padding = padding == nil and 0 or padding,
+ parent = parent
+ }
+end
+
+function ViragDevToolLinkedList:RemoveChildNodes(node)
+ local currNode = node
+
+ while true do
+
+ currNode = currNode.next
+
+ if currNode == nil then
+ node.next = nil
+ self.last = node
+ break
+ end
+
+ if currNode.padding <= node.padding then
+ node.next = currNode
+ break
+ end
+
+ self.size = self.size - 1
+ end
+end
+
+function ViragDevToolLinkedList:Clear()
+ self.size = 0
+ self.first = nil
+ self.last = nil
+end
+
+local pairs, tostring, type, print, string, getmetatable, table,pcall = pairs, tostring, type, print, string, getmetatable, table,pcall
+local HybridScrollFrame_CreateButtons, HybridScrollFrame_GetOffset, HybridScrollFrame_Update = HybridScrollFrame_CreateButtons,HybridScrollFrame_GetOffset, HybridScrollFrame_Update
+
+function ViragDevTool_ExpandCell(info)
+
+ local nodeList = {}
+ local padding = info.padding + 1
+ local couner = 0
+ for k, v in pairs(info.value) do
+ if type(v) ~= "userdata" then
+
+ nodeList[couner] = ViragDevToolLinkedList:NewNode(v, tostring(k), padding, info)
+ else
+ local mt = getmetatable(info.value)
+ if mt then
+ nodeList[couner] = ViragDevToolLinkedList:NewNode(mt.__index, "$metatable", padding, info)
+ end
+ end
+ couner = couner + 1
+ end
+
+ table.sort(nodeList, function(a, b)
+ return a.name < b.name
+ end)
+
+ ViragDevToolLinkedList:AddNodesAfter(nodeList, info)
+ info.expanded = true
+ ViragDevTool_ScrollBar_Update()
+end
+
+function ViragDevTool_ColapseCell(info)
+ ViragDevToolLinkedList:RemoveChildNodes(info)
+ info.expanded = nil
+ print("size: " .. ViragDevToolLinkedList.size)
+ ViragDevTool_ScrollBar_Update()
+end
+
+function ViragDevTool_AddData(data, dataName)
+ ViragDevToolLinkedList:AddNode(data, dataName)
+ ViragDevTool_ScrollBar_Update()
+end
+
+function ViragDevTool_ClearData()
+ ViragDevToolLinkedList:Clear()
+ ViragDevTool_ScrollBar_Update()
+end
+
+function ViragDevTool_ScrollBar_Update()
+
+ local scrollFrame = ViragDevToolScrollFrame
+
+ local buttons = scrollFrame.buttons;
+ local offset = HybridScrollFrame_GetOffset(scrollFrame)
+ local totalRowsCount = ViragDevToolLinkedList.size
+ local lineplusoffset; -- an index into our data calculated from the scroll offset
+
+ local nodeInfo = ViragDevToolLinkedList:GetInfoAtPosition(offset)
+ for k, view in pairs(buttons) do
+
+ lineplusoffset = k + offset;
+ -- print("ok: " .. lineplusoffset .. " " .. offset .. " " .. k .. " " .. (nodeInfo ~= nil and nodeInfo.name or "nil"))
+ if lineplusoffset <= totalRowsCount then
+ ViragDevTool_UpdateListItem(view, nodeInfo, lineplusoffset)
+ nodeInfo = nodeInfo.next
+ view:Show();
+ else
+ view:Hide();
+ end
+ end
+
+ HybridScrollFrame_Update(scrollFrame, totalRowsCount * buttons[1]:GetHeight(), scrollFrame:GetHeight());
+
+end
+
+
+
+function ViragDevTool_UpdateListItem(node, info, id)
+ local nameButton = node.nameButton;
+ local typeButton = node.typeButton
+ local valueButton = node.valueButton
+ local rowNumberButton = node.rowNumberButton
+
+ local value = info.value
+ local name = info.name
+ local padding = info.padding
+
+ nameButton:SetPoint("LEFT", node.typeButton, "RIGHT", 20 * padding, 0)
+
+ local valueType = type(value)
+
+ valueButton:SetText(tostring(value))
+ nameButton:SetText(tostring(name))
+ typeButton:SetText(valueType)
+ rowNumberButton:SetText(tostring(id))
+
+ local color = "ViragDevToolBaseFont"
+ if valueType == "table" then
+ if name ~= "$metatable" then
+ if value.GetObjectType then
+ if value.IsForbidden and value:IsForbidden() then
+ else
+ valueButton:SetText(value:GetObjectType() .. " " .. tostring(value))
+ end
+ end
+ color = "ViragDevToolTableFont";
+ else
+ color = "ViragDevToolMetatableFont";
+ end
+ local resultStringName = tostring(name)
+ local MAX_STRING_SIZE = 60
+ if #resultStringName >= MAX_STRING_SIZE then
+ resultStringName = string.sub(resultStringName, 0, MAX_STRING_SIZE) .. "..."
+ end
+
+ local function tablelength(T)
+ local count = 0
+ for _ in pairs(T) do count = count + 1 end
+ return count
+ end
+
+ nameButton:SetText(resultStringName .. " (" .. tablelength(value) .. ") ");
+
+ elseif valueType == "userdata" then
+ color = "ViragDevToolTableFont";
+ elseif valueType == "string" then
+ valueButton:SetText(string.gsub(string.gsub(tostring(value), "|n", ""), "\n", ""))
+ color = "ViragDevToolStringFont";
+ elseif valueType == "number" then
+ color = "ViragDevToolNumberFont";
+ elseif valueType == "function" then
+ color = "ViragDevToolFunctionFont";
+ end
+
+
+
+ node.nameButton:SetNormalFontObject(color);
+ node.typeButton:SetNormalFontObject(color)
+ node.valueButton:SetNormalFontObject(color)
+ node.rowNumberButton:SetNormalFontObject(color)
+
+ if valueType == "table" then
+ nameButton:SetScript("OnMouseUp", function(self, button, down)
+ print("click")
+ if info.expanded then
+ ViragDevTool_ColapseCell(info)
+ else
+ ViragDevTool_ExpandCell(info)
+ end
+ end)
+ elseif valueType == "function" then
+ nameButton:SetScript("OnMouseUp", function(self, button, down)
+ print("click")
+ ViragDevTool_TryCallFunction(info)
+ end)
+ else
+ nameButton:SetScript("OnMouseUp", nil)
+ end
+end
+
+function ViragDevTool_TryCallFunction(info)
+ local value = info.value
+
+ local ok, result = pcall(value)
+ if ok then
+ local resultType = type(result)
+ local additionalInfo = ""
+ if resultType == "string" or resultType == "number" then
+ additionalInfo = tostring(result)
+ end
+
+ print("returns: " .. resultType .. " " .. additionalInfo)
+ else
+ local parent = info.parent
+ if parent then
+ if parent.name == "$metatable" then
+ parent = parent.parent
+ print("found metatable" .. info.name)
+ end
+
+ local ok, result = pcall(parent.value[info.name], parent.value)
+ local resultType = type(result)
+ local additionalInfo = tostring(result)
+
+ print(parent.name ..":".. info.name .."() returns: " .. additionalInfo.. " ("..resultType ..")" )
+ end
+ end
+end
+
+
+function DEBUG(self, text)
+ if self.debug then
+ print(text);
+ end
+end
diff --git a/ViragDevTool.toc b/ViragDevTool.toc
new file mode 100644
index 0000000..5bf7605
--- /dev/null
+++ b/ViragDevTool.toc
@@ -0,0 +1,6 @@
+## Interface: 60200
+## Title: Virag's WoW Dev Tool
+## Author: Varren@AzuregosRU
+## Version: 0.1
+
+ViragDevTool.xml
diff --git a/ViragDevTool.xml b/ViragDevTool.xml
new file mode 100644
index 0000000..a7cdc34
--- /dev/null
+++ b/ViragDevTool.xml
@@ -0,0 +1,233 @@
+<Ui>
+ <Script file="ViragDevTool.lua"/>
+ <Font name="ViragDevToolDefaultFont" inherits="SystemFont_Small" justifyW="LEFT" justifyH="LEFT" virtual="true"/>
+
+ <Font name="ViragDevToolTableFont" inherits="ViragDevToolDefaultFont" virtual="true">
+ <Color r="0.41" g="0.80" b="0.94"/>
+ </Font>
+ <Font name="ViragDevToolStringFont" inherits="ViragDevToolDefaultFont" virtual="true">
+ <Color r="0.67" g="0.83" b="0.45"/>
+ </Font>
+ <Font name="ViragDevToolNumberFont" inherits="ViragDevToolDefaultFont" virtual="true">
+ <Color r="1.0" g="0.96" b="0.41"/>
+ </Font>
+ <Font name="ViragDevToolFunctionFont" inherits="ViragDevToolDefaultFont" virtual="true">
+ <Color r="1.0" g="0.49" b="0.04"/>
+ </Font>
+ <Font name="ViragDevToolBaseFont" inherits="ViragDevToolDefaultFont" virtual="true">
+ <Color r="1.0" g="1.0" b="1.0"/>
+ </Font>
+ <Font name="ViragDevToolMetatableFont" inherits="ViragDevToolDefaultFont" virtual="true">
+ <Color r="1.0" g="1.0" b="1.0"/>
+ </Font>
+
+ <Button text="Test" name="ViragDevToolTopButton" inherits="UIPanelButtonTemplate" virtual="true">
+ <Size>
+ <AbsDimension x="150" y="25"/>
+ </Size>
+ <NormalFont style="GameFontHighlightLeft"/>
+ </Button>
+
+ <Frame name="ViragDevToolEntryTemplate" virtual="true">
+ <Anchors>
+ <Anchor point="TOPLEFT"/>
+ </Anchors>
+ <Size>
+ <AbsDimension x="1200" y="12"/>
+ </Size>
+ <Frames>
+ <Button text="table" name="$parentRowCellCount" parentKey="rowNumberButton">
+ <Size>
+ <AbsDimension x="50"/>
+ </Size>
+ <Anchors>
+ <Anchor point="TOP"/>
+ <Anchor point="BOTTOM"/>
+ <Anchor point="LEFT"/>
+ </Anchors>
+
+ <NormalFont style="ViragDevToolDefaultFont"/>
+ </Button>
+ <Button text="123456" name="$parentRowType" parentKey="typeButton">
+ <Size>
+ <AbsDimension x="50"/>
+ </Size>
+ <Anchors>
+ <Anchor point="TOP"/>
+ <Anchor point="BOTTOM"/>
+ <Anchor point="LEFT" relativeTo="$parentRowCellCount" relativePoint="RIGHT">
+ </Anchor>
+ </Anchors>
+
+ <NormalFont style="ViragDevToolDefaultFont"/>
+ </Button>
+
+ <Button text="Test Text" name="$parentNameRow" parentKey="nameButton">
+ <Size>
+ <AbsDimension x="400"/>
+ </Size>
+ <Anchors>
+ <Anchor point="TOP"/>
+ <Anchor point="BOTTOM"/>
+ <Anchor point="LEFT" relativeTo="$parentRowCellCount" relativePoint="RIGHT"/>
+ </Anchors>
+
+ <NormalFont style="ViragDevToolDefaultFont"/>
+ </Button>
+ <Button text="Test Text" name="$parentValueRow" parentKey="valueButton">
+ <Size>
+ <AbsDimension x="700"/>
+ </Size>
+ <Anchors>
+ <Anchor point="TOP"/>
+ <Anchor point="BOTTOM"/>
+ <Anchor point="RIGHT"/>
+ <Anchor point="LEFT" relativeTo="$parentNameRow" relativePoint="RIGHT"/>
+
+ </Anchors>
+
+ <NormalFont style="ViragDevToolDefaultFont"/>
+ </Button>
+ </Frames>
+ </Frame>
+ <Frame name="ViragDevTool" parent="UIParent" enableMouse="true" movable="true" resizable="true">
+ <Size>
+ <AbsDimension x="1200" y="600"/>
+ </Size>
+ <Anchors>
+ <Anchor point="CENTER"/>
+ </Anchors>
+ <Scripts>
+ <OnLoad>
+ self:RegisterForDrag("LeftButton");
+ </OnLoad>
+ <OnDragStart>
+ self:StartSizing()
+ </OnDragStart>
+ <OnReceiveDrag>
+ ViragDevTool_ScrollBar_Update()
+ </OnReceiveDrag>
+ <OnDragStop>
+ HybridScrollFrame_CreateButtons(self.scrollFrame, "ViragDevToolEntryTemplate", 0, -2)
+ self:StopMovingOrSizing();
+ </OnDragStop>
+ </Scripts>
+ <Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border"
+ tile="true">
+ <BackgroundInsets>
+ <AbsInset left="4" right="4" top="4" bottom="4"/>
+ </BackgroundInsets>
+ <TileSize>
+ <AbsValue val="16"/>
+ </TileSize>
+ <EdgeSize>
+ <AbsValue val="16"/>
+ </EdgeSize>
+ </Backdrop>
+
+ <Frames>
+ <ScrollFrame name="$parentScrollFrame" inherits="HybridScrollFrameTemplate" parentKey="scrollFrame">
+ <Anchors>
+ <Anchor point="TOPLEFT">
+ <Offset>
+ <AbsDimension x="8" y="-8"/>
+ </Offset>
+ </Anchor>
+ <Anchor point="BOTTOMRIGHT">
+ <Offset>
+ <AbsDimension x="-30" y="8"/>
+ </Offset>
+ </Anchor>
+ </Anchors>
+ <Scripts>
+ <OnShow>
+ print("OnShow GetHeight: "..self:GetHeight())
+ HybridScrollFrame_CreateButtons(self, "ViragDevToolEntryTemplate", 0, -2)
+ ViragDevTool_ScrollBar_Update()
+ </OnShow>
+
+ <OnLoad>
+ print("OnLoad GetHeight: "..self:GetHeight())
+ self.update = ViragDevTool_ScrollBar_Update
+ </OnLoad>
+ </Scripts>
+ <Frames>
+ <Slider name="$parentScrollBar" inherits="HybridScrollBarTemplate">
+ <Anchors>
+ <Anchor point="TOPLEFT" relativePoint="TOPRIGHT" x="3" y="-12"/>
+ <Anchor point="BOTTOMLEFT" relativePoint="BOTTOMRIGHT" x="3" y="13"/>
+ </Anchors>
+ </Slider>
+ </Frames>
+ </ScrollFrame>
+ <Frame name="$parentTopBar" parent="ViragDevTool" enableMouse="true">
+ <Size>
+ <AbsDimension y="25"/>
+ </Size>
+ <Scripts>
+ <OnLoad>
+ self:RegisterForDrag("LeftButton");
+ </OnLoad>
+ <OnDragStart>
+ self:GetParent():StartMoving()
+ </OnDragStart>
+ <OnReceiveDrag>
+ ViragDevTool_ScrollBar_Update()
+ </OnReceiveDrag>
+ <OnDragStop>
+ self:GetParent():StopMovingOrSizing();
+ </OnDragStop>
+ </Scripts>
+
+ <Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background"
+ tile="true">
+
+ <TileSize>
+ <AbsValue val="16"/>
+ </TileSize>
+ <EdgeSize>
+ <AbsValue val="16"/>
+ </EdgeSize>
+ </Backdrop>
+ <Anchors>
+ <Anchor point="LEFT"/>
+ <Anchor point="RIGHT"/>
+ <Anchor point="BOTTOM" relativeTo="$parent" relativePoint="TOP"/>
+ </Anchors>
+ <Frames>
+ <Button text="CLEAR" name="$parentClearButton" inherits="ViragDevToolTopButton">
+ <Scripts>
+ <OnClick>
+ ViragDevTool_ClearData()
+ </OnClick>
+ </Scripts>
+ <Anchors>
+ <Anchor point="TOPLEFT"/>
+ </Anchors>
+ </Button>
+ <Button text="_G" name="$parentAddGlobalButton" inherits="ViragDevToolTopButton">
+ <Scripts>
+ <OnClick>
+ ViragDevTool_AddData(_G, "_G")
+ </OnClick>
+ </Scripts>
+ <Anchors>
+ <Anchor point="LEFT" relativeTo="$parentClearButton" relativePoint="RIGHT"/>
+ </Anchors>
+ </Button>
+ <Button text="Unit" name="$parentAddPlayerInfoButton" inherits="ViragDevToolTopButton">
+ <Scripts>
+ <OnClick>
+ local name, realm = UnitFullName("player")
+ ViragDevTool_AddData(UnitGUID("player"), name .. "-" .. realm)
+ </OnClick>
+ </Scripts>
+ <Anchors>
+ <Anchor point="LEFT" relativeTo="$parentAddGlobalButton" relativePoint="RIGHT"/>
+ </Anchors>
+ </Button>
+ </Frames>
+ </Frame>
+ </Frames>
+ </Frame>
+</Ui>
\ No newline at end of file