diff --git a/auctions_frame.lua b/auctions_frame.lua index 4f63bac..c7919f6 100644 --- a/auctions_frame.lua +++ b/auctions_frame.lua @@ -69,7 +69,7 @@ function private.update_listing() record = auction_record, }) end - sort(auction_rows, function(a, b) return a.record.search_signature < b.record.search_signature end) + sort(auction_rows, function(a, b) return a.record.name < b.record.name or (b.record.name == b.record.name and a.record.search_signature < b.record.search_signature) end) private.listing:SetData(auction_rows) private.listing:SetSelection(function(row) return row.record == selected_auction end) diff --git a/bids_frame.lua b/bids_frame.lua index 08008ea..153919e 100644 --- a/bids_frame.lua +++ b/bids_frame.lua @@ -89,7 +89,7 @@ function private.update_listing() record = auction_record, }) end - sort(auction_rows, function(a, b) return a.record.search_signature < b.record.search_signature end) + sort(auction_rows, function(a, b) return a.record.name < b.record.name or (b.record.name == b.record.name and a.record.search_signature < b.record.search_signature) end) private.listing:SetData(auction_rows) private.listing:SetSelection(function(row) return row.record == selected_auction end) diff --git a/info.lua b/info.lua index 3efeb22..8cfbd9e 100644 --- a/info.lua +++ b/info.lua @@ -128,7 +128,7 @@ function public.auction(index, type) itemstring = item_info.itemstring, item_key = item_id..':'..suffix_id, signature = Aux.util.join({item_id, suffix_id, unique_id, enchant_id, aux_quantity, start_price, buyout_price}, ':'), -- not unique! - search_signature = Aux.util.join({item_id, suffix_id, enchant_id, buyout_price, bid_price, aux_quantity, duration, owner or ''}, ':'), + search_signature = Aux.util.join({item_id, suffix_id, enchant_id, start_price, buyout_price, bid_price, aux_quantity, duration, owner or ''}, ':'), name = name, texture = texture, diff --git a/sheet.lua b/sheet.lua index 27cf54c..648b2b6 100644 --- a/sheet.lua +++ b/sheet.lua @@ -112,71 +112,6 @@ function public.create(params) local total_width = 0 - local labels = {} - for i = 1,getn(params.columns) do - local button = CreateFrame('Button', nil, content) - if i == 1 then - button:SetPoint('TOPLEFT', content, 'TOPLEFT', 5, params.plain and 16 or 0) - total_width = total_width + 5 - else - button:SetPoint('TOPLEFT', content, 'TOPLEFT', total_width + 3, params.plain and 16 or 0) - total_width = total_width + 3 - end - local label = content:CreateFontString(nil, 'OVERLAY', 'GameFontHighlight') - label:SetText(params.columns[i].title) - local column_width = params.columns[i].width or 30 - - total_width = total_width + column_width - button:SetWidth(column_width) - button:SetHeight(16) - button:SetID(i) - button:SetHighlightTexture([[Interface\QuestFrame\UI-QuestTitleHighlight]]) - button:SetScript('OnMouseDown', function() Aux.sheet.sort(sheet, this:GetID()) end) - button:RegisterForClicks('LeftButtonDown', 'RightButtonDown') - - local texture = content:CreateTexture(nil, 'ARTWORK') - texture:SetTexture([[Interface\QuestFrame\UI-QuestTitleHighlight]]) - texture:SetTexCoord(0.1, 0.8, 0, 1) - texture:SetAllPoints(button) - button.texture = texture - - local sort_texture = button:CreateTexture(nil, 'ARTWORK') - sort_texture:SetTexture([[Interface\Buttons\UI-SortArrow]]) - sort_texture:SetPoint('TOPRIGHT', button, 'TOPRIGHT', 0, 0) - sort_texture:SetPoint('BOTTOM', button, 'BOTTOM', 0, 0) - sort_texture:SetWidth(12) - sort_texture:Hide() - button.sort_texture = sort_texture - --- local background = content:CreateTexture(nil, 'ARTWORK') --- background:SetTexture([[Interface\QuestFrame\UI-QuestTitleHighlight]]) --- -- background:SetTextCoord(0.2, 0.9, 0, 0.9) --- background:SetPoint('TOPLEFT', button, 'BOTTOMLEFT', 0, 0) --- background:SetPoint('TOPRIGHT', button, 'BOTTOMRIGHT', 0, 0) --- background:SetPoint('BOTTOM', content, 'BOTTOM', 0, 0) --- background:SetAlpha(0.2) - - label:SetPoint('TOPLEFT', button, 'TOPLEFT', 0, 0) - label:SetPoint('BOTTOMRIGHT', button, 'BOTTOMRIGHT', 0, 0) - label:SetJustifyH('CENTER') - label:SetJustifyV('CENTER') - label:SetTextColor(0.8, 0.8, 0.8) - - label.button = button - label.texture = texture - label.sort_texture = sort_texture - label.background = background - labels[i] = label - - if params.plain then - for _, obj in ipairs({button, label, texture, sort_texture, background}) do - obj:Hide() - end - end - end - total_width = total_width + 5 - params.frame:SetWidth(total_width) - local rows = {} local row_index = 1 local max_height = content:GetHeight() diff --git a/sort.lua b/sort.lua index 9e91a5e..af8237d 100644 --- a/sort.lua +++ b/sort.lua @@ -71,11 +71,11 @@ function public.compare(a, b, nil_ordering) end end -function public.compare_from_lt(comp) +function public.compare_from_lt(lt) return function(a, b) - if comp(a, b) then + if lt(a, b) then return public.LT - elseif comp(b, a) then + elseif lt(b, a) then return public.GT else return public.EQ