greent refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-11-07 12:09:40 +01:00
parent 38d3c6c607
commit 3ef4597018
31 changed files with 267 additions and 252 deletions
+12 -11
View File
@@ -1,6 +1,6 @@
module 'aux.gui.auction_listing'
include 'green_t'
include 'green_T'
include 'aux'
local info = require 'aux.util.info'
@@ -703,13 +703,13 @@ local methods = {
self.rowInfo[getn(self.rowInfo)].children[getn(self.rowInfo[getn(self.rowInfo)].children)].numAuctions = self.rowInfo[getn(self.rowInfo)].children[getn(self.rowInfo[getn(self.rowInfo)].children)].numAuctions + 1
elseif prevRecord and record.item_key == prevRecord.item_key then
-- it's the same base item as the previous row so insert a new auction
tinsert(self.rowInfo[getn(self.rowInfo)].children, T('numAuctions', 1, 'record', record))
tinsert(self.rowInfo[getn(self.rowInfo)].children, O('numAuctions', 1, 'record', record))
if self.expanded[self.rowInfo[getn(self.rowInfo)].expandKey] then
self.rowInfo.numDisplayRows = self.rowInfo.numDisplayRows + 1
end
else
-- it's a different base item from the previous row
tinsert(self.rowInfo, T('item_key', record.item_key, 'expandKey', record.item_key, 'children', A(T('numAuctions', 1, 'record', record))))
tinsert(self.rowInfo, O('item_key', record.item_key, 'expandKey', record.item_key, 'children', A(O('numAuctions', 1, 'record', record))))
self.rowInfo.numDisplayRows = self.rowInfo.numDisplayRows + 1
end
end
@@ -918,7 +918,8 @@ local methods = {
end
end,
SetSort = function(self, ...) auto_release(arg, true)
SetSort = function(self, ...)
auto_release(arg, true)
for k = 1, arg.n do
for i, sort in self.sorts do
if sort.index == abs(arg[k]) then
@@ -988,10 +989,10 @@ function M.CreateAuctionResultsTable(parent, config)
local numRows = 16
rt.ROW_HEIGHT = (parent:GetHeight() - HEAD_HEIGHT - HEAD_SPACE) / numRows
rt.scrollDisabled = nil
rt.expanded = t
rt.handlers = t
rt.sorts = t
rt.records = t
rt.expanded = T
rt.handlers = T
rt.sorts = T
rt.records = T
rt.rowInfo = {numDisplayRows=0}
for name, func in methods do
@@ -1036,7 +1037,7 @@ function M.CreateAuctionResultsTable(parent, config)
_G[scrollBar:GetName() .. 'ScrollDownButton']:Hide()
-- create the header cells
rt.headCells = t
rt.headCells = T
for i, column_config in rt.config do
local cell = CreateFrame('Button', nil, rt.contentFrame)
cell:SetHeight(HEAD_HEIGHT)
@@ -1079,7 +1080,7 @@ function M.CreateAuctionResultsTable(parent, config)
end
-- create the rows
rt.rows = t
rt.rows = T
for i = 1, numRows do
local row = CreateFrame('Frame', nil, rt.contentFrame)
row:SetHeight(rt.ROW_HEIGHT)
@@ -1097,7 +1098,7 @@ function M.CreateAuctionResultsTable(parent, config)
row.highlight = highlight
row.rt = rt
row.cells = t
row.cells = T
for j = 1, getn(rt.config) do
local cell = CreateFrame('Button', nil, row)
local text = cell:CreateFontString()
+7 -6
View File
@@ -1,6 +1,6 @@
module 'aux.gui'
include 'green_t'
include 'green_T'
include 'aux'
M.font = [[Fonts\ARIALN.TTF]]
@@ -24,7 +24,8 @@ function LOAD()
aux_background:SetTexture(color.content.background())
aux_background:SetAllPoints(DropDownList1Backdrop)
blizzard_backdrop = DropDownList1Backdrop:GetBackdrop()
hook('ToggleDropDownMenu', function(...) auto_release(arg, true)
hook('ToggleDropDownMenu', function(...)
auto_release(arg, true)
local ret = temp-A(orig.ToggleDropDownMenu(unpack(arg)))
local dropdown = _G[arg[4] or ''] or this:GetParent()
if strfind(dropdown:GetName() or '', '^AuxFrame%d+$') then
@@ -96,7 +97,7 @@ end
do
local menu = CreateFrame('Frame', unique_name, UIParent, 'UIMenuTemplate')
local orig = menu:GetScript'OnShow'
local structure = t
local structure = T
menu:SetScript('OnShow', function()
UIMenu_Initialize()
for i = 1, getn(structure), 2 do
@@ -203,7 +204,7 @@ function M.button(parent, text_height)
end
do
local mt = {__index=t}
local mt = {__index=T}
function mt.__index:create_tab(text)
local id = getn(self._tabs) + 1
@@ -290,7 +291,7 @@ do
local self = {
_frame = parent,
_orientation = orientation,
_tabs = t,
_tabs = T,
}
return setmetatable(self, mt)
end
@@ -335,7 +336,7 @@ function M.editbox(parent)
end)
editbox:SetScript('OnChar', function() (this.char or nop)() end)
do
local last_click = T('t', 0)
local last_click = O('t', 0)
editbox:SetScript('OnMouseDown', function()
if arg1 == 'RightButton' then
this:SetText('')
+2 -2
View File
@@ -1,6 +1,6 @@
module 'aux.gui.item_listing'
include 'green_t'
include 'green_T'
include 'aux'
local info = require 'aux.util.info'
@@ -63,7 +63,7 @@ function M.create(parent, on_click, selected)
_G[scrollBar:GetName() .. 'ScrollUpButton']:Hide()
_G[scrollBar:GetName() .. 'ScrollDownButton']:Hide()
local rows = t
local rows = T
local row_index = 1
local max_height = content:GetHeight()
local total_height = 0
+6 -6
View File
@@ -1,6 +1,6 @@
module 'aux.gui.listing'
include 'green_t'
include 'green_T'
include 'aux'
local gui = require 'aux.gui'
@@ -442,11 +442,11 @@ function M.CreateScrollingTable(parent)
-- setup default values
st.isTSMScrollingTable = true
st.sizes = t
st.headCols = t
st.rows = t
st.handlers = t
st.sortInfo = t
st.sizes = T
st.headCols = T
st.rows = T
st.handlers = T
st.sortInfo = T
st.colInfo = DEFAULT_COL_INFO
return st