Mercurial > wow > ouroloot
comparison gui.lua @ 128:dc39ce56a62d
- Adding new loot dispositions requires plugin module.
- 'NewLootEntry' and 'NewEOIEntry' events also take a row index. (Hmmm)
- Loot disposition options broken out into a submenu, and use the same
color their notes text do. Toggle a checkbox for the current value.
author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
---|---|
date | Wed, 22 Aug 2012 23:37:24 -0400 |
parents | 9232cacc9136 |
children | 2731702567c4 |
comparison
equal
deleted
inserted
replaced
127:c6d8e096296e | 128:dc39ce56a62d |
---|---|
447 e.cols[1].value = e.startday.text | 447 e.cols[1].value = e.startday.text |
448 e.cols[2].value = "" | 448 e.cols[2].value = "" |
449 e.cols[3].value = "" | 449 e.cols[3].value = "" |
450 | 450 |
451 end | 451 end |
452 self.loot_clean = i | |
452 break | 453 break |
453 end end | 454 end end |
454 self.loot_clean = #g_loot | 455 --self.loot_clean = #g_loot |
455 end | 456 end |
456 | 457 |
457 do | 458 do |
458 function addon:_fill_out_hist_data (opt_starting_index) | 459 function addon:_fill_out_hist_data (opt_starting_index) |
459 local new, del = flib.new, flib.del | 460 local new, del = flib.new, flib.del |
1027 E("Delete remaining entries for this day", nil, 'time', "Erases everything from here down until a new day.\n\nHold down the Shift key to also delete the corresponding entries from player History."), | 1028 E("Delete remaining entries for this day", nil, 'time', "Erases everything from here down until a new day.\n\nHold down the Shift key to also delete the corresponding entries from player History."), |
1028 E("Insert new loot entry", 'df_INSERT', 'loot', "Inserts new loot above this one, prompting you for information."), | 1029 E("Insert new loot entry", 'df_INSERT', 'loot', "Inserts new loot above this one, prompting you for information."), |
1029 E("Insert new boss kill event", 'df_INSERT', 'boss', "Inserts new event above this one, prompting you for information."), | 1030 E("Insert new boss kill event", 'df_INSERT', 'boss', "Inserts new event above this one, prompting you for information."), |
1030 E(CLOSE), | 1031 E(CLOSE), |
1031 } | 1032 } |
1033 gui.dropdown.eoi_loot_mark = {} | |
1032 gui.dropdown.eoi_loot = { | 1034 gui.dropdown.eoi_loot = { |
1033 { | 1035 { |
1034 -- this is the dropdown title, text filled in on the fly | 1036 -- this is the dropdown title, text filled in on the fly |
1035 notClickable = true, | 1037 notClickable = true, |
1038 notCheckable = true, | |
1039 }, | |
1040 { | |
1041 text = "Mark as...", | |
1042 hasArrow = true, | |
1043 menuList = gui.dropdown.eoi_loot_mark, | |
1044 tooltipOnButton = true, | |
1045 tooltipWhileDisabled = true, | |
1036 notCheckable = true, | 1046 notCheckable = true, |
1037 }, | 1047 }, |
1038 E("--"), | 1048 E("--"), |
1039 E("Rebroadcast this loot entry", nil, nil, "Sends this loot event, including special notes, as if it just happened."), | 1049 E("Rebroadcast this loot entry", nil, nil, "Sends this loot event, including special notes, as if it just happened."), |
1040 E("Delete this loot event", 'df_DELETE', nil, "Permanent, no going back!\n\nHold down the Shift key to also delete the corresponding entry from player's History."), | 1050 E("Delete this loot event", 'df_DELETE', nil, "Permanent, no going back!\n\nHold down the Shift key to also delete the corresponding entry from player's History."), |
1056 text = "Reassign to...", | 1066 text = "Reassign to...", |
1057 hasArrow = true, | 1067 hasArrow = true, |
1058 --menuList = filled in in the fly, | 1068 --menuList = filled in in the fly, |
1059 tooltipOnButton = true, | 1069 tooltipOnButton = true, |
1060 tooltipWhileDisabled = true, | 1070 tooltipWhileDisabled = true, |
1071 notCheckable = true, | |
1061 }, | 1072 }, |
1062 E("Show only this player"), | 1073 E("Show only this player"), |
1063 E(CLOSE), | 1074 E(CLOSE), |
1064 } | 1075 } |
1065 gui.dropdown.eoi_boss = { | 1076 gui.dropdown.eoi_boss = { |
2327 end | 2338 end |
2328 | 2339 |
2329 | 2340 |
2330 -- We need to be able to reference the dropdownmenu locals, and I didn't want to | 2341 -- We need to be able to reference the dropdownmenu locals, and I didn't want to |
2331 -- bubble them up any higher. | 2342 -- bubble them up any higher. |
2332 function gui.add_dropdown_entry (menutag, name, func_tbl, func_or_othername, arg, tooltiptext) | 2343 do |
2333 local emtbl = assert(gui.dropdown[menutag]) | 2344 -- If the UIDropDownMenu_SetSelected* functions could be used with EasyMenu |
2334 | 2345 -- in a sane fashion, we could dispense with the 'checked' field. |
2335 if type(func_tbl) == 'table' then | 2346 local function disposition_is_checked (buttonframe) |
2336 -- use it directly | 2347 -- arg2 == disp code, GetID == index into dropdown array |
2337 elseif func_tbl == nil then | 2348 local i = _d and _d.GetUserData and _d:GetUserData("DD index") |
2338 -- determine it from the menu tag | 2349 if i then |
2339 func_tbl = (menutag:sub(1,3) == 'eoi' and eoi_dropdownfuncs) | 2350 return g_loot[i].disposition == buttonframe.arg2 |
2340 or (menutag:sub(1,4) == 'hist' and hist_dropdownfuncs) | 2351 end |
2341 or error("Cannot figure out function table from menu tag name") | 2352 end |
2342 end | 2353 |
2343 | 2354 function gui.add_dropdown_entry (menutag, name, func_tbl, func_or_othername, arg, tooltiptext) |
2344 if type(func_or_othername) == 'string' then | 2355 local emtbl = assert(gui.dropdown[menutag]) |
2345 -- gen_dd_entry handles this | 2356 |
2346 elseif type(func_or_othername) == 'function' then | 2357 if type(func_tbl) == 'table' then |
2347 error"bah" | 2358 -- use it directly |
2348 end | 2359 elseif func_tbl == nil then |
2349 | 2360 -- determine it from the menu tag |
2350 local index | 2361 func_tbl = (menutag:sub(1,3) == 'eoi' and eoi_dropdownfuncs) |
2351 if menutag == 'eoi_loot' then | 2362 or (menutag:sub(1,4) == 'hist' and hist_dropdownfuncs) |
2352 index = 2 | 2363 or error("Cannot figure out function table from menu tag name") |
2353 elseif menutag == 'eoi_player' then | 2364 end |
2354 index = 3 | 2365 |
2355 else | 2366 if type(func_or_othername) == 'string' then |
2356 index = 2 | 2367 -- gen_dd_entry handles this |
2357 end | 2368 elseif type(func_or_othername) == 'function' then |
2358 | 2369 error"bah" |
2359 local ent = gen_dd_entry (name, func_tbl, func_or_othername, arg, tooltiptext) | 2370 end |
2360 tinsert (emtbl, index, ent) | 2371 |
2361 return ent | 2372 -- Insert most new entries right under the title |
2373 local index | |
2374 if menutag == 'eoi_loot' then | |
2375 index = 3 | |
2376 elseif menutag == 'eoi_player' then | |
2377 index = 3 | |
2378 elseif menutag == 'eoi_loot_mark' then | |
2379 index = #emtbl + 1 | |
2380 else | |
2381 index = 2 | |
2382 end | |
2383 | |
2384 local ent = gen_dd_entry (name, func_tbl, func_or_othername, arg, tooltiptext) | |
2385 tinsert (emtbl, index, ent) | |
2386 | |
2387 if menutag == 'eoi_loot_mark' then | |
2388 ent.notCheckable = nil | |
2389 ent.checked = disposition_is_checked | |
2390 end | |
2391 | |
2392 return ent | |
2393 end | |
2362 end | 2394 end |
2363 | 2395 |
2364 | 2396 |
2365 ------ Popup dialogs | 2397 ------ Popup dialogs |
2366 local function build_my_slider_widget() | 2398 local function build_my_slider_widget() |