comparison gui.lua @ 122:fb4bda3ad05c

Various trivial cleanups.
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Fri, 17 Aug 2012 01:04:38 -0400
parents ec5174529e0f
children a9cf9b2fbf9b
comparison
equal deleted inserted replaced
121:4dd67f8116f4 122:fb4bda3ad05c
465 if #self.history < 1 or self.hist_clean == 0 then 465 if #self.history < 1 or self.hist_clean == 0 then
466 self.hist_clean = nil 466 self.hist_clean = nil
467 opt_starting_index = nil 467 opt_starting_index = nil
468 end 468 end
469 if not self.history.st then 469 if not self.history.st then
470 --print"creating ST!" 470 self.history.st = {}
471 self.history.st = {
472 --[[{ kind = "realm",
473 cols = setmetatable({
474 { value = self.history.realm },
475 }, time_column1_used_mt)
476 }]]
477 }
478 end 471 end
479 472
480 -- for now 473 -- for now
481 if self.hist_clean == #self.history then return end 474 if self.hist_clean == #self.history then return end
482 475
483 local st = self.history.st 476 local st = self.history.st
484 --print("starting history loop, #st ==", #st, "#history ==", #self.history)
485 for i,t in ipairs(st) do 477 for i,t in ipairs(st) do
486 del(t.cols[1]) 478 del(t.cols[1])
487 del(t.cols[2]) 479 del(t.cols[2])
488 del(t.cols[3]) 480 del(t.cols[3])
489 del(t.cols) 481 del(t.cols)
537 st_entry.itemlink = ilink -- for onenter and onclick 529 st_entry.itemlink = ilink -- for onenter and onclick
538 tinsert (st, st_entry) 530 tinsert (st, st_entry)
539 end 531 end
540 end 532 end
541 533
542 --print("finished history loop, #st ==", #st)
543 self.hist_clean = cache_okay and #self.history or nil 534 self.hist_clean = cache_okay and #self.history or nil
544 end 535 end
545 end 536 end
546 537
547 -- Debugging tooltip (unfortunately managed by global and semi-global state 538 -- Debugging tooltip (unfortunately managed by global and semi-global state
793 --[[ 784 --[[
794 Controls for the tabs on the left side of the main display. 785 Controls for the tabs on the left side of the main display.
795 ]] 786 ]]
796 787
797 do 788 do
798 --local next_insertion_position = 2 -- position in taborder 789 -- position in taborder
799 local next_insertion_position = #gui.taborder + 1 790 local next_insertion_position = #gui.taborder + 1
800 local removed, saved_offset 791 local removed, saved_offset
801 792
802 function gui:tabposition_insert (tabcode) 793 function gui:tabposition_insert (tabcode)
803 tinsert (gui.taborder, next_insertion_position, tabcode) 794 tinsert (gui.taborder, next_insertion_position, tabcode)
1420 end 1411 end
1421 1412
1422 -- Calling SetData breaks (trying to call Refresh) if g_loot hasn't gone 1413 -- Calling SetData breaks (trying to call Refresh) if g_loot hasn't gone
1423 -- through this loop. 1414 -- through this loop.
1424 addon:_fill_out_eoi_data(1) 1415 addon:_fill_out_eoi_data(1)
1425 -- safety check begin 1416 --[[ safety check begin
1426 for i,e in ipairs(g_dloot) do 1417 for i,e in ipairs(g_dloot) do
1427 if type(e.cols) ~= 'table' then 1418 if type(e.cols) ~= 'table' then
1428 addon:Print("ARGH, index",i,"bad in eoi_OGS, type",type(e.cols), 1419 addon:Print("ARGH, index",i,"bad in eoi_OGS, type",type(e.cols),
1429 "entry kind", e.kind, "data", e.itemname or e.bossname or e.startday.text, 1420 "entry kind", e.kind, "data", e.itemname or e.bossname or e.startday.text,
1430 "-- please take a screenshot and send to Farmbuyer@US-Kilrogg.") 1421 "-- please take a screenshot and send to Farmbuyer@US-Kilrogg.")
1431 tabledump(e) 1422 tabledump(e)
1432 end 1423 end
1433 end 1424 end
1434 -- safety check end 1425 -- safety check end]]
1435 ST:SetData(g_dloot) 1426 ST:SetData(g_dloot)
1436 ST:EnableSelection(true) 1427 ST:EnableSelection(true)
1437 ST:RegisterEvents{ 1428 ST:RegisterEvents{
1438 OnEnter = eoi_st_OnEnter, 1429 OnEnter = eoi_st_OnEnter,
1439 OnLeave = eoi_st_OnLeave, 1430 OnLeave = eoi_st_OnLeave,
1450 addon:_fill_out_eoi_data(opt_index) 1441 addon:_fill_out_eoi_data(opt_index)
1451 return oldrefresh(self) 1442 return oldrefresh(self)
1452 end 1443 end
1453 ST.OuroLoot_Refresh = function (self, opt_index) 1444 ST.OuroLoot_Refresh = function (self, opt_index)
1454 addon:_fill_out_eoi_data(opt_index) 1445 addon:_fill_out_eoi_data(opt_index)
1455 -- safety check begin 1446 --[[ safety check begin
1456 for i,e in ipairs(g_dloot) do 1447 for i,e in ipairs(g_dloot) do
1457 if type(e.cols) ~= 'table' then 1448 if type(e.cols) ~= 'table' then
1458 addon:Print("ARGH, index",i,"bad in eoi refresh, refreshed at", opt_index, "type",type(e.cols), 1449 addon:Print("ARGH, index",i,"bad in eoi refresh, refreshed at", opt_index, "type",type(e.cols),
1459 "entry kind", e.kind, "data", e.itemname or e.bossname or e.startday.text, 1450 "entry kind", e.kind, "data", e.itemname or e.bossname or e.startday.text,
1460 "-- please take a screenshot and send to Farmbuyer@US-Kilrogg.") 1451 "-- please take a screenshot and send to Farmbuyer@US-Kilrogg.")
1461 tabledump(e) 1452 tabledump(e)
1462 end 1453 end
1463 end 1454 end
1464 -- safety check end 1455 -- safety check end]]
1465 self:SortData() -- calls hooked refresh 1456 self:SortData() -- calls hooked refresh
1466 end 1457 end
1467 1458
1468 -- No need to keep creating function closures that all just "return true", 1459 -- No need to keep creating function closures that all just "return true",
1469 -- instead we grab the one made inside lib-st. There's no "get filter" API 1460 -- instead we grab the one made inside lib-st. There's no "get filter" API
1731 local cell = h.cols[column] 1722 local cell = h.cols[column]
1732 1723
1733 cellFrame.text:SetText(cell.value) 1724 cellFrame.text:SetText(cell.value)
1734 cellFrame.text:SetTextColor(1,1,1,1) 1725 cellFrame.text:SetTextColor(1,1,1,1)
1735 1726
1736 --stable:SetHighLightColor (rowFrame, eoi_st_otherrow_bgcolortable[h.kind])
1737 stable:SetHighLightColor (rowFrame, eoi_st_otherrow_bgcolortable_default) 1727 stable:SetHighLightColor (rowFrame, eoi_st_otherrow_bgcolortable_default)
1738 end 1728 end
1739 1729
1740 local function hist_st_OnClick (rowFrame, cellFrame, data, cols, row, realrow, column, stable, button, down) 1730 local function hist_st_OnClick (rowFrame, cellFrame, data, cols, row, realrow, column, stable, button, down)
1741 if (row == nil) or (realrow == nil) then return false end -- click column header, do default resorting 1731 if (row == nil) or (realrow == nil) then return false end -- click column header, do default resorting