Mercurial > wow > ouroloot
comparison gui.lua @ 16:5ee4edd24c13
- new blizz methods for editboxes in dialog popups
- initial code for dropdowns in history (not active yet)
- hovering and shift-clicking to link out of history
- proper confirmations for history rewriting
- options checkboxes more grid-like
- saved texts get a scrollbar instead of expanding indefinitely (duh)
- rearranged savedvars a bit (and added transition code)
- stores raider join/leave times and "demographic" info, all for MLEQDKP
- minor bugfixes and tweaks
| author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
|---|---|
| date | Thu, 25 Aug 2011 00:45:31 +0000 |
| parents | 952c3ac0e783 |
| children | d929c40cdb09 |
comparison
equal
deleted
inserted
replaced
| 15:d8fee518ce5d | 16:5ee4edd24c13 |
|---|---|
| 9 ------ Popup dialogs | 9 ------ Popup dialogs |
| 10 ]] | 10 ]] |
| 11 | 11 |
| 12 ------ Constants | 12 ------ Constants |
| 13 local eoi_st_rowheight = 20 | 13 local eoi_st_rowheight = 20 |
| 14 local eoi_st_displayed_rows = math.floor(366/eoi_st_rowheight) | 14 local eoi_st_displayed_rows = math.floor(416/eoi_st_rowheight) --math.floor(366/eoi_st_rowheight) |
| 15 local eoi_st_textured_item_format = "|T%s:"..(eoi_st_rowheight-2).."|t %s[%s]|r%s" | 15 local eoi_st_textured_item_format = "|T%s:"..(eoi_st_rowheight-2).."|t %s[%s]|r%s" |
| 16 local eoi_st_otherrow_bgcolortable = { | 16 local eoi_st_otherrow_bgcolortable = { |
| 17 wipe = { ["r"] = 0.3, ["g"] = 0.3, ["b"] = 0.3}, | 17 wipe = { ["r"] = 0.3, ["g"] = 0.3, ["b"] = 0.3}, |
| 18 kill = { ["r"] = 0.2, ["g"] = 0.2, ["b"] = 0.2}, | 18 kill = { ["r"] = 0.2, ["g"] = 0.2, ["b"] = 0.2}, |
| 19 time = { ["r"] = 0x0/255, ["g"] = 0x0/255, ["b"] = 1, ["a"] = 0.3}, | 19 time = { ["r"] = 0x0/255, ["g"] = 0x0/255, ["b"] = 1, ["a"] = 0.3}, |
| 212 local v | 212 local v |
| 213 if e.reason == 'kill' then | 213 if e.reason == 'kill' then |
| 214 if e.attempts == 1 then | 214 if e.attempts == 1 then |
| 215 v = "one-shot" | 215 v = "one-shot" |
| 216 else | 216 else |
| 217 v = ("kill on %d%s attempt"):format(e.attempts, grammar[e.attempts] or "th") | 217 v = ("kill on %d%s attempt"):format(e.attempts or 0, grammar[e.attempts] or "th") |
| 218 end | 218 end |
| 219 v = ("%s (%d:%.2d)"):format(v, math.floor(e.duration/60), math.floor(e.duration%60)) | 219 v = ("%s (%d:%.2d)"):format(v, math.floor(e.duration/60), math.floor(e.duration%60)) |
| 220 elseif e.reason == 'wipe' then | 220 elseif e.reason == 'wipe' then |
| 221 v = ("wipe (%d:%.2d)"):format(math.floor(e.duration/60), math.floor(e.duration%60)) | 221 v = ("wipe (%d:%.2d)"):format(math.floor(e.duration/60), math.floor(e.duration%60)) |
| 222 end | 222 end |
| 309 local dotcols = new (col1, col2, col3) | 309 local dotcols = new (col1, col2, col3) |
| 310 local st_entry = new() | 310 local st_entry = new() |
| 311 st_entry.kind = 'history' | 311 st_entry.kind = 'history' |
| 312 st_entry.OLwho = player.name | 312 st_entry.OLwho = player.name |
| 313 st_entry.cols = dotcols | 313 st_entry.cols = dotcols |
| 314 st_entry.itemlink = ilink -- for onenter and onclick | |
| 314 tinsert (st, st_entry) | 315 tinsert (st, st_entry) |
| 315 end | 316 end |
| 316 end | 317 end |
| 317 | 318 |
| 318 --print("finished history loop, #st ==", #st) | 319 --print("finished history loop, #st ==", #st) |
| 412 [CLOSE] = function() CloseDropDownMenus() end, | 413 [CLOSE] = function() CloseDropDownMenus() end, |
| 413 | 414 |
| 414 df_INSERT = function(rowi,text) | 415 df_INSERT = function(rowi,text) |
| 415 local which = (text == 'loot') and "OUROL_EOI_INSERT_LOOT" or "OUROL_EOI_INSERT" | 416 local which = (text == 'loot') and "OUROL_EOI_INSERT_LOOT" or "OUROL_EOI_INSERT" |
| 416 local dialog = StaticPopup_Show(which,text) | 417 local dialog = StaticPopup_Show(which,text) |
| 417 dialog.wideEditBox:SetScript("OnTextChanged",StaticPopup_EditBoxOnTextChanged) | 418 dialog.editBox:SetScript("OnTextChanged",StaticPopup_EditBoxOnTextChanged) |
| 418 dialog.data = {rowindex=rowi, display=_d, kind=text} | 419 dialog.data = {rowindex=rowi, display=_d, kind=text} |
| 419 end, | 420 end, |
| 420 | 421 |
| 421 df_DELETE = function(rowi) | 422 df_DELETE = function(rowi) |
| 422 local gone = tremove(g_loot,rowi) | 423 local gone = tremove(g_loot,rowi) |
| 423 addon:Print("Removed %s.", | 424 addon:Print("Removed %s.", |
| 424 gone.itemlink or gone.bosskill or gone.startday.text) | 425 gone.itemlink or gone.bosskill or gone.startday.text) |
| 426 end, | |
| 427 | |
| 428 ["Delete this history event"] = function(rowi) | |
| 429 --local gone = tremove(g_loot,rowi) | |
| 430 --addon:Print("Removed %s.", | |
| 431 --gone.itemlink or gone.bosskill or gone.startday.text) | |
| 425 end, | 432 end, |
| 426 | 433 |
| 427 -- if kind is boss, also need to stop at new timestamp | 434 -- if kind is boss, also need to stop at new timestamp |
| 428 ["Delete remaining entries for this day"] = function(rowi,kind) | 435 ["Delete remaining entries for this day"] = function(rowi,kind) |
| 429 local fencepost | 436 local fencepost |
| 482 end, | 489 end, |
| 483 | 490 |
| 484 df_REASSIGN = function(rowi,to_whom) | 491 df_REASSIGN = function(rowi,to_whom) |
| 485 g_loot[rowi].person = to_whom | 492 g_loot[rowi].person = to_whom |
| 486 g_loot[rowi].person_class = select(2,UnitClass(to_whom)) | 493 g_loot[rowi].person_class = select(2,UnitClass(to_whom)) |
| 494 -- FIXME also update history | |
| 487 CloseDropDownMenus() -- also need to close parent menu | 495 CloseDropDownMenus() -- also need to close parent menu |
| 488 end, | 496 end, |
| 489 ["Enter name..."] = function(rowi) | 497 ["Enter name..."] = function(rowi) |
| 490 local dialog = StaticPopup_Show "OUROL_REASSIGN_ENTER" | 498 local dialog = StaticPopup_Show "OUROL_REASSIGN_ENTER" |
| 491 dialog.data = {index=rowi, display=_d} | 499 dialog.data = {index=rowi, display=_d} |
| 570 "Insert new loot entry%loot|Inserts new loot above this one, prompting you for information", | 578 "Insert new loot entry%loot|Inserts new loot above this one, prompting you for information", |
| 571 "Insert new boss kill event%boss|Inserts new event above this one, prompting you for information", | 579 "Insert new boss kill event%boss|Inserts new event above this one, prompting you for information", |
| 572 "--", | 580 "--", |
| 573 CLOSE | 581 CLOSE |
| 574 }, dropdownfuncs) | 582 }, dropdownfuncs) |
| 583 local hist_dropdown = gen_easymenu_table( | |
| 584 {{ | |
| 585 -- this is the dropdown title, text filled in on the fly | |
| 586 notClickable = true, | |
| 587 notCheckable = true, | |
| 588 }}, | |
| 589 { | |
| 590 "Delete this history event|Permanent, no going back!", | |
| 591 --"Delete remaining entries for this boss%boss|Erases everything from here down until a new boss/day", | |
| 592 "--", | |
| 593 CLOSE | |
| 594 }, dropdownfuncs) | |
| 575 | 595 |
| 576 --[[ quoted verbatim from lib-st docs: | 596 --[[ quoted verbatim from lib-st docs: |
| 577 rowFrame This is the UI Frame table for the row. | 597 rowFrame This is the UI Frame table for the row. |
| 578 cellFrame This is the UI Frame table for the cell in the row. | 598 cellFrame This is the UI Frame table for the cell in the row. |
| 579 data This is the data table supplied to the scrolling table (in case you lost it :) ) | 599 data This is the data table supplied to the scrolling table (in case you lost it :) ) |
| 587 local function eoi_st_OnEnter (rowFrame, cellFrame, data, cols, row, realrow, column, table, button, ...) | 607 local function eoi_st_OnEnter (rowFrame, cellFrame, data, cols, row, realrow, column, table, button, ...) |
| 588 if (row == nil) or (realrow == nil) then return end -- mouseover column header | 608 if (row == nil) or (realrow == nil) then return end -- mouseover column header |
| 589 local e = data[realrow] | 609 local e = data[realrow] |
| 590 local kind = e.kind | 610 local kind = e.kind |
| 591 | 611 |
| 592 if kind == 'loot' and column == 1 then | 612 if (kind == 'loot' and column == 1) or (kind == 'history' and column == 2) then |
| 593 GameTooltip:SetOwner (cellFrame, "ANCHOR_RIGHT", -20, 0) | 613 if e.itemlink then |
| 594 GameTooltip:SetHyperlink (e.itemlink) | 614 GameTooltip:SetOwner (cellFrame, "ANCHOR_RIGHT", -20, 0) |
| 615 GameTooltip:SetHyperlink (e.itemlink) | |
| 616 end | |
| 595 | 617 |
| 596 elseif kind == 'loot' and column == 2 then | 618 elseif kind == 'loot' and column == 2 then |
| 597 GameTooltip:SetOwner (cellFrame, "ANCHOR_BOTTOMRIGHT", -50, 5) | 619 GameTooltip:SetOwner (cellFrame, "ANCHOR_BOTTOMRIGHT", -50, 5) |
| 598 GameTooltip:ClearLines() | 620 GameTooltip:ClearLines() |
| 599 GameTooltip:AddLine(e.person.." Loot:") | 621 GameTooltip:AddLine(e.person.." Loot:") |
| 636 if (row == nil) or (realrow == nil) then return true end -- click column header, suppress reordering | 658 if (row == nil) or (realrow == nil) then return true end -- click column header, suppress reordering |
| 637 local e = data[realrow] | 659 local e = data[realrow] |
| 638 local kind = e.kind | 660 local kind = e.kind |
| 639 | 661 |
| 640 -- Check for shift-clicking a loot line | 662 -- Check for shift-clicking a loot line |
| 641 if IsModifiedClick("CHATLINK") and kind == 'loot' and column == 1 then | 663 if IsModifiedClick("CHATLINK") and |
| 664 ((kind == 'loot' and column == 1) or (kind == 'history' and column == 2)) | |
| 665 then | |
| 642 ChatEdit_InsertLink (e.itemlink) | 666 ChatEdit_InsertLink (e.itemlink) |
| 643 return true -- do not do anything further | 667 return true -- do not do anything further |
| 644 end | 668 end |
| 645 | 669 |
| 646 -- Remaining actions are all right-click | 670 -- Remaining actions are all right-click |
| 680 | 704 |
| 681 elseif kind == 'time' then | 705 elseif kind == 'time' then |
| 682 eoi_time_dropdown[1].text = e.startday.text | 706 eoi_time_dropdown[1].text = e.startday.text |
| 683 EasyMenu (eoi_time_dropdown, dropdownmenuframe, cellFrame, 0, 0, "MENU") | 707 EasyMenu (eoi_time_dropdown, dropdownmenuframe, cellFrame, 0, 0, "MENU") |
| 684 | 708 |
| 709 elseif kind == 'history' then -- XXX need to move this into new onclick handler | |
| 710 _d:SetUserData("DD loot cell", cellFrame) | |
| 711 hist_dropdown[1].text = e.itemlink | |
| 712 EasyMenu (hist_dropdown, dropdownmenuframe, cellFrame, 0, 0, "MENU") | |
| 685 end | 713 end |
| 686 | 714 |
| 687 return true -- do not do anything further | 715 return true -- do not do anything further |
| 688 end | 716 end |
| 689 | 717 |
| 1192 return addon:redisplay() | 1220 return addon:redisplay() |
| 1193 end) | 1221 end) |
| 1194 specials:AddChild(b) | 1222 specials:AddChild(b) |
| 1195 | 1223 |
| 1196 b = mkbutton('hist_clear', "Clear Realm History", | 1224 b = mkbutton('hist_clear', "Clear Realm History", |
| 1197 [[No confirmation! |cffff1010Erases absolutely all> history entries from the displayed realm.]]) | 1225 [[|cffff1010Erases absolutely all> history entries from the displayed realm.]]) |
| 1198 b:SetFullWidth(true) | 1226 b:SetFullWidth(true) |
| 1199 b:SetCallback("OnClick", function (_b) | 1227 b:SetCallback("OnClick", function (_b) |
| 1200 reset_current_realm(addon.history.realm) | 1228 local dialog = StaticPopup_Show("OUROL_HIST_CLEAR", addon.history.realm) |
| 1201 addon:Print("Stimpy, you eeediot, you've pushed the history erase button!") | 1229 dialog.data = addon |
| 1202 return addon:redisplay() | 1230 dialog.data2 = function(_addon) |
| 1231 reset_current_realm(_addon.history.realm) | |
| 1232 end | |
| 1203 end) | 1233 end) |
| 1204 specials:AddChild(b) | 1234 specials:AddChild(b) |
| 1205 | 1235 |
| 1206 b = mkbutton('hist_clear_all', "Clear All History", | 1236 b = mkbutton('hist_clear_all', "Clear All History", |
| 1207 [[No confirmation! |cffff1010Erases absolutely all> history entries from ALL realms.]]) | 1237 [[|cffff1010Erases absolutely all> history entries from ALL realms.]]) |
| 1208 b:SetFullWidth(true) | 1238 b:SetFullWidth(true) |
| 1209 b:SetCallback("OnClick", function (_b) | 1239 b:SetCallback("OnClick", function (_b) |
| 1210 addon.history_all = {} | 1240 local dialog = StaticPopup_Show("OUROL_HIST_CLEAR", "ALL realms") |
| 1211 reset_current_realm() | 1241 dialog.data = addon |
| 1212 addon:Print("Stimpy, you eeediot, you've pushed the history erase button!") | 1242 dialog.data2 = function(_addon) |
| 1213 return addon:redisplay() | 1243 _addon.history_all = {} |
| 1244 reset_current_realm() | |
| 1245 end | |
| 1214 end) | 1246 end) |
| 1215 specials:AddChild(b) | 1247 specials:AddChild(b) |
| 1216 | 1248 |
| 1217 b = mkbutton('hist_clear_old', "Clear Older", | 1249 b = mkbutton('hist_clear_old', "Clear Older", |
| 1218 [[Preserves only the latest loot entry for each player on the displayed realm, removing all earlier ones.]]) | 1250 [[Preserves only the latest loot entry for each player on the displayed realm, removing all earlier ones.]]) |
| 1219 b:SetFullWidth(true) | 1251 b:SetFullWidth(true) |
| 1220 b:SetCallback("OnClick", function (_b) | 1252 b:SetCallback("OnClick", function (_b) |
| 1221 addon:preen_history(addon.history.realm) | 1253 local dialog = StaticPopup_Show("OUROL_HIST_PREEN", addon.history.realm) |
| 1222 addon:Print("All loot prior to the most recent entries has been erased.") | 1254 dialog.data = addon |
| 1223 addon.hist_clean = nil | 1255 dialog.data2 = function(_addon) |
| 1224 histST:OuroLoot_Refresh() | 1256 _addon:preen_history(_addon.history.realm) |
| 1225 return addon:redisplay() | 1257 _addon.hist_clean = nil |
| 1258 histST:OuroLoot_Refresh() | |
| 1259 end | |
| 1226 end) | 1260 end) |
| 1227 specials:AddChild(b) | 1261 specials:AddChild(b) |
| 1228 end | 1262 end |
| 1229 return tabs_OnGroupSelected["hist"](container,specials) | 1263 return tabs_OnGroupSelected["hist"](container,specials) |
| 1230 end | 1264 end |
| 1460 | 1494 |
| 1461 -- The relative width fields used to be done to take up less vertical space, but | 1495 -- The relative width fields used to be done to take up less vertical space, but |
| 1462 -- that turned out to look messy. Now they're just a straight line for the most part. | 1496 -- that turned out to look messy. Now they're just a straight line for the most part. |
| 1463 | 1497 |
| 1464 -- reminder popup | 1498 -- reminder popup |
| 1465 w = mkoption ('popup_on_join', "Show reminder popup", 0.95, | 1499 w = mkoption ('popup_on_join', "Show reminder popup", 0.49, |
| 1466 [[When joining a raid and not already tracking, display a dialog asking for instructions.]]) | 1500 [[When joining a raid and not already tracking, display a dialog asking for instructions.]]) |
| 1467 grp:AddChild(w) | 1501 grp:AddChild(w) |
| 1468 | 1502 |
| 1469 -- toggle scroll-to-bottom on first tab | 1503 -- toggle scroll-to-bottom on first tab |
| 1470 w = mkoption('scroll_to_bottom', "Scroll to bottom when opening display", 0.95, | 1504 w = mkoption('scroll_to_bottom', "Scroll to bottom when opening display", 0.49, |
| 1471 [[Scroll to the bottom of the loot window (most recent entries) when displaying the GUI.]]) | 1505 [[Scroll to the bottom of the loot window (most recent entries) when displaying the GUI.]]) |
| 1472 grp:AddChild(w) | 1506 grp:AddChild(w) |
| 1473 | 1507 |
| 1474 -- /loot option | 1508 -- /loot option |
| 1475 w = mkoption('register_slashloot', "Register /loot slash command on login", 0.95, | 1509 w = mkoption('register_slashloot', "Register /loot slash command on login", 0.49, |
| 1476 [[Register "/loot" as a slash command in addition to the normal "/ouroloot". Relog to take effect.]]) | 1510 [[Register "/loot" as a slash command in addition to the normal "/ouroloot". Relog to take effect.]]) |
| 1477 grp:AddChild(w) | 1511 grp:AddChild(w) |
| 1478 | 1512 |
| 1479 -- chatty mode | 1513 -- chatty mode |
| 1480 w = mkoption('chatty_on_kill', "Be chatty on boss kill", 0.95, | 1514 w = mkoption('chatty_on_kill', "Be chatty on boss kill", 0.49, |
| 1481 [[Print something to chat output when DBM tells Ouro Loot about a successful boss kill.]]) | 1515 [[Print something to chat output when DBM tells Ouro Loot about a successful boss kill.]]) |
| 1482 grp:AddChild(w) | 1516 grp:AddChild(w) |
| 1483 | 1517 |
| 1484 -- less noise in main panel | 1518 -- less noise in main panel |
| 1485 w = mkoption('no_tracking_wipes', "Do not track wipes", 0.95, | 1519 w = mkoption('no_tracking_wipes', "Do not track wipes", 0.49, |
| 1486 [[Do not add 'wipe' entries on the main loot grid, or generate any text for them.]]) | 1520 [[Do not add 'wipe' entries on the main loot grid, or generate any text for them.]]) |
| 1487 grp:AddChild(w) | 1521 grp:AddChild(w) |
| 1488 | 1522 |
| 1489 -- cutesy abbrevs | 1523 -- cutesy abbrevs |
| 1490 w = mkoption('snarky_boss', "Use snarky boss names", 0.95, | 1524 w = mkoption('snarky_boss', "Use snarky boss names", 0.49, |
| 1491 [[Irreverent replacement names for boss events.]]) | 1525 [[Irreverent replacement names for boss events.]]) |
| 1492 grp:AddChild(w) | 1526 grp:AddChild(w) |
| 1493 | 1527 |
| 1494 -- possible keybindings | 1528 -- possible keybindings |
| 1495 do | 1529 do |
| 1699 _d = display | 1733 _d = display |
| 1700 self.display = display | 1734 self.display = display |
| 1701 display:SetTitle("Ouro Loot") | 1735 display:SetTitle("Ouro Loot") |
| 1702 display:SetStatusText(self.status_text) | 1736 display:SetStatusText(self.status_text) |
| 1703 display:SetLayout("Flow") | 1737 display:SetLayout("Flow") |
| 1704 display:SetStatusTable{width=900} | 1738 display:SetStatusTable{width=900,height=550} -- default height is 500 |
| 1705 -- prevent resizing, also see ace3 tickets 80 and 214 | 1739 -- prevent resizing, also see ace3 tickets 80 and 214 |
| 1706 -- grrrr, no longer works after frame rewrite | 1740 -- grrrr, no longer works after frame rewrite |
| 1707 --[[ | 1741 --[[ |
| 1708 display.sizer_se:SetScript("OnMouseDown",nil) | 1742 display.sizer_se:SetScript("OnMouseDown",nil) |
| 1709 display.sizer_se:SetScript("OnMouseUp",nil) | 1743 display.sizer_se:SetScript("OnMouseUp",nil) |
| 1778 end) | 1812 end) |
| 1779 control:AddChild(b) | 1813 control:AddChild(b) |
| 1780 | 1814 |
| 1781 b = GUI:Create("Spacer") | 1815 b = GUI:Create("Spacer") |
| 1782 b:SetFullWidth(true) | 1816 b:SetFullWidth(true) |
| 1783 b:SetHeight(15) | 1817 b:SetHeight(10) |
| 1784 control:AddChild(b) | 1818 control:AddChild(b) |
| 1785 | 1819 |
| 1786 --[[ | 1820 --[[ |
| 1787 --- Saved Texts --- | 1821 --- Saved Texts --- |
| 1788 [ Save Current As... ] | 1822 [ Save Current As... ] |
| 1802 StaticPopup_Show "OUROL_SAVE_SAVEAS" | 1836 StaticPopup_Show "OUROL_SAVE_SAVEAS" |
| 1803 _d:Hide() | 1837 _d:Hide() |
| 1804 end) | 1838 end) |
| 1805 control:AddChild(b) | 1839 control:AddChild(b) |
| 1806 | 1840 |
| 1807 local saved = self:check_saved_table(--[[silent_on_empty=]]true) | 1841 do |
| 1808 if saved then for i,s in ipairs(saved) do | 1842 local scontainer = GUI:Create("SimpleGroup") |
| 1809 local il = GUI:Create("InteractiveLabel") | 1843 scontainer:SetFullWidth(true) |
| 1810 il:SetFullWidth(true) | 1844 scontainer:SetFullHeight(false) |
| 1811 il:SetText(s.name) | 1845 scontainer:SetAutoAdjustHeight(false) |
| 1812 il:SetUserData("num",i) | 1846 scontainer:SetHeight(40) -- no relative height available anymore |
| 1813 il:SetHighlight(1,1,1,0.4) | 1847 scontainer:SetLayout("Fill") |
| 1814 local str = ("%s %d entries %s"):format(s.date,s.count,s.name) | 1848 local scroll = GUI:Create("ScrollFrame") |
| 1815 il:SetCallback("OnEnter", function() setstatus(str) end) | 1849 scroll:SetLayout("List") |
| 1816 il:SetCallback("OnLeave", statusy_OnLeave) | 1850 local saved = self:check_saved_table(--[[silent_on_empty=]]true) |
| 1817 il:SetCallback("OnClick", function(_il) | 1851 if saved then for i,s in ipairs(saved) do |
| 1818 local prev = _d:GetUserData("saved selection") | 1852 local il = GUI:Create("InteractiveLabel") |
| 1819 if prev then | 1853 il:SetFullWidth(true) |
| 1820 prev.highlight:Hide() | 1854 il:SetText(s.name) |
| 1821 prev:SetColor() | 1855 il:SetUserData("num",i) |
| 1822 end | 1856 il:SetHighlight(1,1,1,0.4) |
| 1823 _il:SetColor(0,1,0) | 1857 local str = ("%s %d entries %s"):format(s.date,s.count,s.name) |
| 1824 _il.highlight:Show() | 1858 il:SetCallback("OnEnter", function() setstatus(str) end) |
| 1825 _d:SetUserData("saved selection",_il) | 1859 il:SetCallback("OnLeave", statusy_OnLeave) |
| 1826 _d:GetUserData("Load"):SetDisabled(false) | 1860 il:SetCallback("OnClick", function(_il) |
| 1827 _d:GetUserData("Delete"):SetDisabled(false) | 1861 local prev = _d:GetUserData("saved selection") |
| 1828 end) | 1862 if prev then |
| 1829 control:AddChild(il) | 1863 prev.highlight:Hide() |
| 1830 end end | 1864 prev:SetColor() |
| 1865 end | |
| 1866 _il:SetColor(0,1,0) | |
| 1867 _il.highlight:Show() | |
| 1868 _d:SetUserData("saved selection",_il) | |
| 1869 _d:GetUserData("Load"):SetDisabled(false) | |
| 1870 _d:GetUserData("Delete"):SetDisabled(false) | |
| 1871 end) | |
| 1872 scroll:AddChild(il) | |
| 1873 end end | |
| 1874 scontainer:AddChild(scroll) | |
| 1875 control:AddChild(scontainer) | |
| 1876 end | |
| 1831 | 1877 |
| 1832 b = mkbutton("Load", | 1878 b = mkbutton("Load", |
| 1833 [[Load previously saved text. +REPLACES> all current loot information!]]) | 1879 [[Load previously saved text. +REPLACES> all current loot information!]]) |
| 1834 b:SetRelativeWidth(0.5) | 1880 b:SetRelativeWidth(0.5) |
| 1835 b:SetCallback("OnClick", function() | 1881 b:SetCallback("OnClick", function() |
| 1850 b:SetDisabled(true) | 1896 b:SetDisabled(true) |
| 1851 control:AddChild(b) | 1897 control:AddChild(b) |
| 1852 | 1898 |
| 1853 b = GUI:Create("Spacer") | 1899 b = GUI:Create("Spacer") |
| 1854 b:SetFullWidth(true) | 1900 b:SetFullWidth(true) |
| 1855 b:SetHeight(15) | 1901 b:SetHeight(10) |
| 1856 control:AddChild(b) | 1902 control:AddChild(b) |
| 1857 | 1903 |
| 1858 -- Other stuff on right-hand side | 1904 -- Other stuff on right-hand side |
| 1859 local tab_specials = GUI:Create("SimpleGroup") | 1905 local tab_specials = GUI:Create("SimpleGroup") |
| 1860 tab_specials:SetLayout("Flow") | 1906 tab_specials:SetLayout("Flow") |
| 1928 dialog.data = nil -- free up memory | 1974 dialog.data = nil -- free up memory |
| 1929 addon:Print("Inserted %s %s (entry %d).", data.kind, data.name, data.rowindex) | 1975 addon:Print("Inserted %s %s (entry %d).", data.kind, data.name, data.rowindex) |
| 1930 return | 1976 return |
| 1931 end | 1977 end |
| 1932 | 1978 |
| 1933 local text = dialog.wideEditBox:GetText() | 1979 local text = dialog.editBox:GetText() |
| 1934 | 1980 |
| 1935 -- second click | 1981 -- second click |
| 1936 if data.name and text then | 1982 if data.name and text then |
| 1937 data.instance = text | 1983 data.instance = text |
| 1938 data.all_done = true | 1984 data.all_done = true |
| 1943 -- first click | 1989 -- first click |
| 1944 if text then | 1990 if text then |
| 1945 data.name = text | 1991 data.name = text |
| 1946 local getinstance = StaticPopup_Show("OUROL_EOI_INSERT","instance") | 1992 local getinstance = StaticPopup_Show("OUROL_EOI_INSERT","instance") |
| 1947 getinstance.data = data | 1993 getinstance.data = data |
| 1948 getinstance.wideEditBox:SetText(addon.instance_tag()) | 1994 getinstance.editBox:SetText(addon.instance_tag()) |
| 1949 -- This suppresses auto-hide (which would case the getinstance dialog | 1995 -- This suppresses auto-hide (which would case the getinstance dialog |
| 1950 -- to go away), but only when mouse clicking. OnEnter is on its own. | 1996 -- to go away), but only when mouse clicking. OnEnter is on its own. |
| 1951 return true | 1997 return true |
| 1952 end | 1998 end |
| 1953 end | 1999 end |
| 1967 dialog.data = nil | 2013 dialog.data = nil |
| 1968 addon:Print("Inserted %s %s (entry %d).", data.kind, data.name, data.rowindex) | 2014 addon:Print("Inserted %s %s (entry %d).", data.kind, data.name, data.rowindex) |
| 1969 return | 2015 return |
| 1970 end | 2016 end |
| 1971 | 2017 |
| 1972 local text = dialog.wideEditBox:GetText():trim() | 2018 local text = dialog.editBox:GetText():trim() |
| 1973 | 2019 |
| 1974 -- third click | 2020 -- third click |
| 1975 if data.name and data.recipient and text then | 2021 if data.name and data.recipient and text then |
| 1976 data.notes = (text ~= "<none>") and text or nil | 2022 data.notes = (text ~= "<none>") and text or nil |
| 1977 data.all_done = true | 2023 data.all_done = true |
| 1981 -- second click | 2027 -- second click |
| 1982 if data.name and text then | 2028 if data.name and text then |
| 1983 data.recipient = text | 2029 data.recipient = text |
| 1984 local getnotes = StaticPopup_Show("OUROL_EOI_INSERT","notes") | 2030 local getnotes = StaticPopup_Show("OUROL_EOI_INSERT","notes") |
| 1985 getnotes.data = data | 2031 getnotes.data = data |
| 1986 getnotes.wideEditBox:SetText("<none>") | 2032 getnotes.editBox:SetText("<none>") |
| 1987 getnotes.wideEditBox:HighlightText() | 2033 getnotes.editBox:HighlightText() |
| 1988 return true | 2034 return true |
| 1989 end | 2035 end |
| 1990 | 2036 |
| 1991 -- first click | 2037 -- first click |
| 1992 if text then | 2038 if text then |
| 1993 data.name = text | 2039 data.name = text |
| 1994 dialog:Hide() -- technically a "different" one about to be shown | 2040 dialog:Hide() -- technically a "different" one about to be shown |
| 1995 local getrecipient = StaticPopup_Show("OUROL_EOI_INSERT","recipient") | 2041 local getrecipient = StaticPopup_Show("OUROL_EOI_INSERT","recipient") |
| 1996 getrecipient.data = data | 2042 getrecipient.data = data |
| 1997 getrecipient.wideEditBox:SetText("") | 2043 getrecipient.editBox:SetText("") |
| 1998 return true | 2044 return true |
| 1999 end | 2045 end |
| 2000 end | 2046 end |
| 2001 | 2047 |
| 2002 local function eoi_st_insert_OnAccept (dialog, data) | 2048 local function eoi_st_insert_OnAccept (dialog, data) |
| 2007 end | 2053 end |
| 2008 end | 2054 end |
| 2009 | 2055 |
| 2010 StaticPopupDialogs["OUROL_CLEAR"] = flib.StaticPopup{ | 2056 StaticPopupDialogs["OUROL_CLEAR"] = flib.StaticPopup{ |
| 2011 text = "Clear current loot information and text?", | 2057 text = "Clear current loot information and text?", |
| 2012 button1 = ACCEPT, | 2058 button1 = YES, |
| 2013 button2 = CANCEL, | 2059 button2 = NO, |
| 2014 OnAccept = function (dialog, addon) | 2060 OnAccept = function (dialog, addon) |
| 2015 addon:Clear(--[[verbose_p=]]true) | 2061 addon:Clear(--[[verbose_p=]]true) |
| 2062 end, | |
| 2063 } | |
| 2064 | |
| 2065 StaticPopupDialogs["OUROL_HIST_CLEAR"] = flib.StaticPopup{ | |
| 2066 text = "Erase all history entries from %s?", | |
| 2067 button1 = YES, | |
| 2068 button2 = NO, | |
| 2069 OnAccept = function (dialog, addon, data2) | |
| 2070 data2(addon) | |
| 2071 addon:Print("Stimpy, you eeediot, you've pushed the history erase button!") | |
| 2072 addon:redisplay() | |
| 2073 end, | |
| 2074 } | |
| 2075 | |
| 2076 StaticPopupDialogs["OUROL_HIST_PREEN"] = flib.StaticPopup{ | |
| 2077 text = "Erase all but the latest entry for players on %s?", | |
| 2078 button1 = YES, | |
| 2079 button2 = NO, | |
| 2080 OnAccept = function (dialog, addon, data2) | |
| 2081 data2(addon) | |
| 2082 addon:Print("All loot prior to the most recent entries has been erased.") | |
| 2083 addon:redisplay() | |
| 2016 end, | 2084 end, |
| 2017 } | 2085 } |
| 2018 | 2086 |
| 2019 StaticPopupDialogs["OUROL_REMIND"] = flib.StaticPopup{ | 2087 StaticPopupDialogs["OUROL_REMIND"] = flib.StaticPopup{ |
| 2020 text = "Do you wish to activate Ouro Loot?\n\n(Hit the Escape key to close this window without clicking)", | 2088 text = "Do you wish to activate Ouro Loot?\n\n(Hit the Escape key to close this window without clicking)", |
| 2048 local t = flib.StaticPopup{ | 2116 local t = flib.StaticPopup{ |
| 2049 text = "Enter name of new %s, then click Next or press Enter:", | 2117 text = "Enter name of new %s, then click Next or press Enter:", |
| 2050 button1 = "Next >", | 2118 button1 = "Next >", |
| 2051 button2 = CANCEL, | 2119 button2 = CANCEL, |
| 2052 hasEditBox = true, | 2120 hasEditBox = true, |
| 2053 hasWideEditBox = true, | 2121 editBoxWidth = 350, |
| 2054 maxLetters = 50, | 2122 maxLetters = 50, |
| 2055 noCancelOnReuse = true, | 2123 noCancelOnReuse = true, |
| 2056 --[[ XXX still needed? | 2124 --[[ XXX still needed? |
| 2057 OnShow = function(dialog) | 2125 OnShow = function(dialog) |
| 2058 dialog.wideEditBox:SetText("") | 2126 dialog.wideEditBox:SetText("") |
| 2079 StaticPopupDialogs["OUROL_EOI_INSERT_LOOT"] = setmetatable(OEIL,OEIL) | 2147 StaticPopupDialogs["OUROL_EOI_INSERT_LOOT"] = setmetatable(OEIL,OEIL) |
| 2080 | 2148 |
| 2081 hooksecurefunc("ChatEdit_InsertLink", function (link,...) | 2149 hooksecurefunc("ChatEdit_InsertLink", function (link,...) |
| 2082 local dialogname = StaticPopup_Visible "OUROL_EOI_INSERT_LOOT" | 2150 local dialogname = StaticPopup_Visible "OUROL_EOI_INSERT_LOOT" |
| 2083 if dialogname then | 2151 if dialogname then |
| 2084 _G[dialogname.."WideEditBox"]:SetText(link) | 2152 _G[dialogname.."EditBox"]:SetText(link) |
| 2085 return true | 2153 return true |
| 2086 end | 2154 end |
| 2087 end) | 2155 end) |
| 2088 end | 2156 end |
| 2089 | 2157 |
| 2099 end,]] | 2167 end,]] |
| 2100 OnAccept = function(dialog, data) | 2168 OnAccept = function(dialog, data) |
| 2101 local name = dialog.usertext --editBox:GetText() | 2169 local name = dialog.usertext --editBox:GetText() |
| 2102 g_loot[data.index].person = name | 2170 g_loot[data.index].person = name |
| 2103 g_loot[data.index].person_class = select(2,UnitClass(name)) | 2171 g_loot[data.index].person_class = select(2,UnitClass(name)) |
| 2172 -- FIXME also update history | |
| 2104 addon:Print("Reassigned entry %d to '%s'.", data.index, name) | 2173 addon:Print("Reassigned entry %d to '%s'.", data.index, name) |
| 2105 data.display:GetUserData("eoiST"):OuroLoot_Refresh(data.index) | 2174 data.display:GetUserData("eoiST"):OuroLoot_Refresh(data.index) |
| 2106 end, | 2175 end, |
| 2107 } | 2176 } |
| 2108 | 2177 |
