Mercurial > wow > ouroloot
comparison gui.lua @ 83:940e53dd18c3
- More cosmetic cleanup.
- Implement "GUI noob" option. Basic entries for Loot and History tabs.
- Disable wipe->kill toggling once the entry is actually a kill. Duh.
author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
---|---|
date | Mon, 18 Jun 2012 03:02:10 +0000 |
parents | 0f6355bcfe68 |
children | c87bf3e756f3 |
comparison
equal
deleted
inserted
replaced
82:ae17128ef3f2 | 83:940e53dd18c3 |
---|---|
10 ------ Popup dialogs | 10 ------ Popup dialogs |
11 ]] | 11 ]] |
12 | 12 |
13 ------ Constants | 13 ------ Constants |
14 local eoi_st_rowheight = 20 | 14 local eoi_st_rowheight = 20 |
15 local eoi_st_displayed_rows = math.floor(416/eoi_st_rowheight) --math.floor(366/eoi_st_rowheight) | 15 local eoi_st_displayed_rows = math.floor(416/eoi_st_rowheight) |
16 local eoi_st_textured_item_format = "|T%s:"..(eoi_st_rowheight-2).."|t %s[%s]|r%s" | 16 local eoi_st_textured_item_format = "|T%s:"..(eoi_st_rowheight-2).."|t %s[%s]|r%s" |
17 local eoi_st_otherrow_bgcolortable = { | 17 local eoi_st_otherrow_bgcolortable = { |
18 wipe = { ["r"] = 0.3, ["g"] = 0.3, ["b"] = 0.3}, | 18 wipe = { ["r"] = 0.3, ["g"] = 0.3, ["b"] = 0.3}, |
19 kill = { ["r"] = 0.2, ["g"] = 0.2, ["b"] = 0.2}, | 19 kill = { ["r"] = 0.2, ["g"] = 0.2, ["b"] = 0.2}, |
20 time = { ["r"] = 0x0/255, ["g"] = 0x0/255, ["b"] = 1, ["a"] = 0.3}, | 20 time = { ["r"] = 0x0/255, ["g"] = 0x0/255, ["b"] = 1, ["a"] = 0.3}, |
68 local pprint, tabledump = addon.pprint, flib.tabledump | 68 local pprint, tabledump = addon.pprint, flib.tabledump |
69 local GetItemInfo, ITEM_QUALITY_COLORS = GetItemInfo, ITEM_QUALITY_COLORS | 69 local GetItemInfo, ITEM_QUALITY_COLORS = GetItemInfo, ITEM_QUALITY_COLORS |
70 local GetNumRaidMembers = GetNumRaidMembers | 70 local GetNumRaidMembers = GetNumRaidMembers |
71 | 71 |
72 -- En masse forward decls of symbols defined inside local blocks | 72 -- En masse forward decls of symbols defined inside local blocks |
73 local _generate_text, _populate_text_specials | 73 local _generate_text, _populate_text_specials, _markup |
74 local eoi_dropdownfuncs, _tabtexts, _taborder -- filled out in gui block scope | 74 local eoi_dropdownfuncs, _tabtexts, _taborder -- filled out in gui block scope |
75 local _do_debugging_tooltip, _hide_debugging_tooltip, _build_debugging_tooltip | 75 local _do_debugging_tooltip, _hide_debugging_tooltip, _build_debugging_tooltip |
76 local _new_rebroadcast_hyperlink | 76 local _new_rebroadcast_hyperlink |
77 | 77 |
78 --[[ | 78 --[[ |
82 argument. | 82 argument. |
83 ]] | 83 ]] |
84 local tabs_OnGroupSelected = {} | 84 local tabs_OnGroupSelected = {} |
85 local mkbutton | 85 local mkbutton |
86 local tabs_OnGroupSelected_func, tabs_generated_text_OGS | 86 local tabs_OnGroupSelected_func, tabs_generated_text_OGS |
87 -- Similarly for the popup tips on the right side of the window. | |
88 local noob_tips = {} | |
87 | 89 |
88 -- Class color support | 90 -- Class color support |
89 local class_colors-- = {} | 91 local class_colors-- = {} |
90 do | 92 do |
91 local function fill_out_class_colors() | 93 local function fill_out_class_colors() |
102 fill_out_class_colors() | 104 fill_out_class_colors() |
103 if CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS.RegisterCallback then | 105 if CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS.RegisterCallback then |
104 CUSTOM_CLASS_COLORS:RegisterCallback(fill_out_class_colors) | 106 CUSTOM_CLASS_COLORS:RegisterCallback(fill_out_class_colors) |
105 end | 107 end |
106 addon.class_colors = class_colors | 108 addon.class_colors = class_colors |
109 end | |
110 | |
111 do | |
112 local replacement_colors = { | |
113 ["+"]="|cffffffff", -- white | |
114 ["<"]="|cff00ff00", -- light green | |
115 [">"]="|r" } | |
116 function _markup (t) | |
117 -- wonder if it would be worth memoizing this also | |
118 return t:gsub("[%+<>]",replacement_colors) | |
119 :gsub("([^\n])\n([^\n])", "%1 %2") | |
120 :gsub("|r\n\n", "|r\n") | |
121 end | |
107 end | 122 end |
108 | 123 |
109 -- Working around this bug: | 124 -- Working around this bug: |
110 -- http://forums.wowace.com/showpost.php?p=295202&postcount=31 | 125 -- http://forums.wowace.com/showpost.php?p=295202&postcount=31 |
111 do | 126 do |
629 -- which looks reasonably pleasing | 644 -- which looks reasonably pleasing |
630 [[Broadcast this entry]], "|cff3588ff", onclick) | 645 [[Broadcast this entry]], "|cff3588ff", onclick) |
631 rebroadcast_map[ident] = u | 646 rebroadcast_map[ident] = u |
632 return clicky | 647 return clicky |
633 end | 648 end |
649 end | |
650 | |
651 -- UI tips window | |
652 local hide_noobtips_frame = flib.nullfunc | |
653 local function get_noobtips_frame() | |
654 local f = CreateFrame("Frame") | |
655 f:SetBackdrop{ | |
656 bgFile = [[Interface\Tooltips\UI-Tooltip-Background]], | |
657 --bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]], | |
658 edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]], | |
659 --edgeFile = [[Interface\DialogFrame\UI-DialogBox-Border]], | |
660 tile = true, | |
661 tileSize = 8, | |
662 --tileSize = 32, | |
663 edgeSize = 12, | |
664 --edgeSize = 32, | |
665 insets = { left = 2, right = 2, top = 2, bottom = 2 } | |
666 --insets = { left = 11, right = 12, top = 12, bottom = 11 } | |
667 } | |
668 f:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, | |
669 TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b) | |
670 f:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g, | |
671 TOOLTIP_DEFAULT_COLOR.b) | |
672 f:SetMovable(false) | |
673 f:EnableMouse(false) | |
674 f:SetFrameStrata("TOOLTIP") | |
675 f:SetToplevel(true) | |
676 f:SetClampedToScreen(true) | |
677 f:SetWidth(220) | |
678 local t = f:CreateFontString (nil, "ARTWORK", "GameFontHighlightSmall") | |
679 --t:SetPoint ("TOPLEFT", f, "TOPLEFT", 14, -15) | |
680 t:SetPoint ("TOPLEFT", f, "TOPLEFT", 10, -10) | |
681 t:SetJustifyH("LEFT") | |
682 | |
683 f.text = t | |
684 f.DoTextWork = function (self, text) | |
685 self.text:SetText(text) | |
686 self.text:SetWidth (self:GetWidth() - 20) | |
687 self:SetHeight (self.text:GetHeight() + 20) | |
688 end | |
689 | |
690 get_noobtips_frame = function() return f end | |
691 hide_noobtips_frame = function() f:Hide() end | |
692 return f | |
634 end | 693 end |
635 | 694 |
636 | 695 |
637 ------ Main GUI Window | 696 ------ Main GUI Window |
638 local _d -- display when it's open, eoiST when it's not | 697 local _d -- display when it's open, eoiST when it's not |
939 isTitle = true, | 998 isTitle = true, |
940 notClickable = true, | 999 notClickable = true, |
941 notCheckable = true, | 1000 notCheckable = true, |
942 }}, | 1001 }}, |
943 { | 1002 { |
944 "Change from 'wipe' to 'kill'|Also collapses previous wipe entries.", | 1003 "Change from 'wipe' to 'kill'|Also collapses previous wipe entries.", -- KILLWIPE |
945 "Rebroadcast this boss%boss|Broadcasts the kill event and all subsequent loot until next boss.", | 1004 "Rebroadcast this boss%boss|Broadcasts the kill event and all subsequent loot until next boss.", |
946 "Delete this boss event|Permanent, no going back!", | 1005 "Delete this boss event|Permanent, no going back!", |
947 "Delete remaining entries for this boss%boss|Erases everything from here down until a new boss/day.\n\nHold down the Shift key to also delete the player's corresponding History entry.", | 1006 "Delete remaining entries for this boss%boss|Erases everything from here down until a new boss/day.\n\nHold down the Shift key to also delete the player's corresponding History entry.", |
948 "Insert new loot entry%loot|Inserts new loot above this one, prompting you for information.", | 1007 "Insert new loot entry%loot|Inserts new loot above this one, prompting you for information.", |
949 "Insert new boss kill event%boss|Inserts new event above this one, prompting you for information.", | 1008 "Insert new boss kill event%boss|Inserts new event above this one, prompting you for information.", |
1076 end | 1135 end |
1077 EasyMenu (eoi_player_dropdown, dropdownmenuframe, cellFrame, 0, 0, "MENU") | 1136 EasyMenu (eoi_player_dropdown, dropdownmenuframe, cellFrame, 0, 0, "MENU") |
1078 | 1137 |
1079 elseif kind == 'boss' then | 1138 elseif kind == 'boss' then |
1080 eoi_boss_dropdown[1].text = e.bossname | 1139 eoi_boss_dropdown[1].text = e.bossname |
1140 -- KILLWIPE: update '2' if this is not the 2nd entry in eoi_boss_dropdown | |
1141 eoi_boss_dropdown[2].tooltipWhileDisabled = nil | |
1142 eoi_boss_dropdown[2].disabled = e.reason ~= 'wipe' and true or nil | |
1081 EasyMenu (eoi_boss_dropdown, dropdownmenuframe, cellFrame, 0, 0, "MENU") | 1143 EasyMenu (eoi_boss_dropdown, dropdownmenuframe, cellFrame, 0, 0, "MENU") |
1082 | 1144 |
1083 elseif kind == 'time' then | 1145 elseif kind == 'time' then |
1084 eoi_time_dropdown[1].text = e.startday.text | 1146 eoi_time_dropdown[1].text = e.startday.text |
1085 EasyMenu (eoi_time_dropdown, dropdownmenuframe, cellFrame, 0, 0, "MENU") | 1147 EasyMenu (eoi_time_dropdown, dropdownmenuframe, cellFrame, 0, 0, "MENU") |
1362 specials:AddChild(b) | 1424 specials:AddChild(b) |
1363 end | 1425 end |
1364 -- ...and call it. | 1426 -- ...and call it. |
1365 return tabs_OnGroupSelected["eoi"](ocontainer,specials) | 1427 return tabs_OnGroupSelected["eoi"](ocontainer,specials) |
1366 end | 1428 end |
1429 noob_tips["eoi"] = _markup[[ | |
1430 <Shift-Left> while over an item link to paste it into chat. | |
1431 | |
1432 <Right>-click any row to display a dropdown menu. The menu is different for | |
1433 the Player column than it is for the Item/Notes columns, and different for | |
1434 loot entries than it is for other rows.]] | |
1367 | 1435 |
1368 | 1436 |
1369 -- Tab 2/3 (generated text) | 1437 -- Tab 2/3 (generated text) |
1370 function tabs_generated_text_OGS (container, specials, text_kind) | 1438 function tabs_generated_text_OGS (container, specials, text_kind) |
1371 container:SetLayout("Fill") | 1439 container:SetLayout("Fill") |
1409 g_loot.printed[text_kind] = 0 | 1477 g_loot.printed[text_kind] = 0 |
1410 g_generated.last_instance = nil | 1478 g_generated.last_instance = nil |
1411 g_generated[pos] = nil | 1479 g_generated[pos] = nil |
1412 addon:Print("'%s' has been regenerated.", _tabtexts[text_kind].title) | 1480 addon:Print("'%s' has been regenerated.", _tabtexts[text_kind].title) |
1413 return addon:redisplay() | 1481 return addon:redisplay() |
1414 --return tabs_OnGroupSelected_func(container,"OnGroupSelected",text_kind) | |
1415 end) | 1482 end) |
1416 specials:AddChild(w) | 1483 specials:AddChild(w) |
1417 if addon:is_plugin(text_kind) then | 1484 if addon:is_plugin(text_kind) then |
1418 local pname = addon:is_plugin(text_kind):GetName() | 1485 local pname = addon:is_plugin(text_kind):GetName() |
1419 w = mkbutton("Reset SVs & ReloadUI", | 1486 w = mkbutton("Reset SVs & ReloadUI", |
1690 end) | 1757 end) |
1691 specials:AddChild(b) | 1758 specials:AddChild(b) |
1692 end | 1759 end |
1693 return tabs_OnGroupSelected["hist"](container,specials) | 1760 return tabs_OnGroupSelected["hist"](container,specials) |
1694 end | 1761 end |
1762 noob_tips["hist"] = _markup[[ | |
1763 <Left>-click a row to see all history for that player. <Right>-click any row | |
1764 to return to showing all players. | |
1765 | |
1766 <Shift-Left> while over an item link to paste it into chat. <Shift-Right> | |
1767 any row to display a dropdown menu.]] | |
1695 | 1768 |
1696 | 1769 |
1697 -- Tab 5: Help (content in verbage.lua) | 1770 -- Tab 5: Help (content in verbage.lua) |
1698 do | 1771 do |
1699 local tabs_help_OnGroupSelected_func = function (treeg,event,category) | 1772 local tabs_help_OnGroupSelected_func = function (treeg,event,category) |
1947 spacer:SetHeight(5) | 2020 spacer:SetHeight(5) |
1948 container:AddChild(spacer) | 2021 container:AddChild(spacer) |
1949 local speedbump = GUI:Create("InteractiveLabel") | 2022 local speedbump = GUI:Create("InteractiveLabel") |
1950 speedbump:SetFullWidth(true) | 2023 speedbump:SetFullWidth(true) |
1951 speedbump:SetFontObject(GameFontHighlightLarge) | 2024 speedbump:SetFontObject(GameFontHighlightLarge) |
1952 speedbump:SetImage("Interface\\DialogFrame\\DialogAlertIcon") | 2025 speedbump:SetImage[[Interface\DialogFrame\DialogAlertIcon]] |
1953 speedbump:SetImageSize(50,50) | 2026 speedbump:SetImageSize(50,50) |
1954 speedbump:SetText("The debugging/testing settings on the rest of this panel can seriously bork up the addon if you make a mistake. If you're okay with the possibility of losing data, click this warning to load the panel.") | 2027 speedbump:SetText("The debugging/testing settings on the rest of this panel can seriously bork up the addon if you make a mistake. If you're okay with the possibility of losing data, click this warning to load the panel.") |
1955 speedbump:SetCallback("OnClick", function (_sb) | 2028 speedbump:SetCallback("OnClick", function (_sb) |
1956 adv_lower = adv_real | 2029 adv_lower = adv_real |
1957 return addon:redisplay() | 2030 return addon:redisplay() |
1958 --return tabs_OnGroupSelected_func(container.parent,"OnGroupSelected","opt") | |
1959 end) | 2031 end) |
1960 container:AddChild(speedbump) | 2032 container:AddChild(speedbump) |
1961 spacer = GUI:Create("Spacer") | 2033 spacer = GUI:Create("Spacer") |
1962 spacer:SetFullWidth(true) | 2034 spacer:SetFullWidth(true) |
1963 spacer:SetHeight(5) | 2035 spacer:SetHeight(5) |
1966 end | 2038 end |
1967 | 2039 |
1968 tabs_OnGroupSelected["opt"] = function(container,specials) | 2040 tabs_OnGroupSelected["opt"] = function(container,specials) |
1969 opts = OuroLootSV_opts | 2041 opts = OuroLootSV_opts |
1970 | 2042 |
1971 --container:SetLayout("List") | |
1972 container:SetLayout("Fill") | 2043 container:SetLayout("Fill") |
1973 local scroll, grp, w | 2044 local scroll, grp, w |
1974 | 2045 |
1975 scroll = GUI:Create("ScrollFrame") | 2046 scroll = GUI:Create("ScrollFrame") |
1976 scroll:SetLayout("Flow") | 2047 scroll:SetLayout("Flow") |
1978 grp = GUI:Create("InlineGroup") | 2049 grp = GUI:Create("InlineGroup") |
1979 grp:SetLayout("Flow") | 2050 grp:SetLayout("Flow") |
1980 grp:SetFullWidth(true) | 2051 grp:SetFullWidth(true) |
1981 grp:SetTitle("User Options [these are saved across sessions]") | 2052 grp:SetTitle("User Options [these are saved across sessions]") |
1982 | 2053 |
1983 -- The relative width fields used to be done to take up less vertical space, but | 2054 -- The relative width fields used to be done to take up less vertical |
1984 -- that turned out to look messy. Now they're just a straight line for the most part. | 2055 -- space, but that turned out to look messy. Now they're just a |
2056 -- straight line for the most part. | |
2057 | |
2058 -- the nubtoggle! | |
2059 w = mkoption('gui_noob', [[Show UI Tips]], 0.85, | |
2060 [[Toggles display of the "helpful tips" box on the right side. Useful if you've just installed/upgraded.]]) | |
2061 w:SetImage[[Interface\OptionsFrame\UI-OptionsFrame-NewFeatureIcon]] | |
2062 grp:AddChild(w) | |
2063 w = GUI:Create("Spacer") w:SetFullWidth(true) w:SetHeight(10) grp:AddChild(w) | |
1985 | 2064 |
1986 -- reminder popup | 2065 -- reminder popup |
1987 w = mkoption ('popup_on_join', "Show reminder popup", 0.49, | 2066 w = mkoption ('popup_on_join', "Show reminder popup on new raid", 0.49, |
1988 [[When joining a raid and not already tracking, display a dialog asking for instructions.]]) | 2067 [[When joining a raid and not already tracking, display a dialog asking for instructions.]]) |
1989 grp:AddChild(w) | 2068 grp:AddChild(w) |
1990 | 2069 |
1991 -- toggle scroll-to-bottom on first tab | 2070 -- toggle scroll-to-bottom on first tab |
1992 w = mkoption('scroll_to_bottom', "Scroll to bottom when opening display", 0.49, | 2071 w = mkoption('scroll_to_bottom', "Scroll to bottom when opening display", 0.49, |
1998 [[Register "/loot" as a slash command in addition to the normal "/ouroloot". Relog to take effect.]]) | 2077 [[Register "/loot" as a slash command in addition to the normal "/ouroloot". Relog to take effect.]]) |
1999 grp:AddChild(w) | 2078 grp:AddChild(w) |
2000 | 2079 |
2001 -- chatty boss mode | 2080 -- chatty boss mode |
2002 w = mkoption('chatty_on_kill', "Be chatty on boss kill", 0.49, | 2081 w = mkoption('chatty_on_kill', "Be chatty on boss kill", 0.49, |
2003 [[Print something to chat output when DBM tells Ouro Loot about a successful boss kill.]]) | 2082 [[Print something to chat output when the boss mod tells Ouro Loot about a successful boss kill.]]) |
2004 grp:AddChild(w) | 2083 grp:AddChild(w) |
2005 | 2084 |
2006 -- less noise in main panel | 2085 -- less noise in main panel |
2007 w = mkoption('no_tracking_wipes', "Do not track wipes", 0.49, | 2086 w = mkoption('no_tracking_wipes', "Do not track wipes", 0.49, |
2008 [[Do not add 'wipe' entries on the main loot grid, or generate any text for them.]]) | 2087 [[Do not add 'wipe' entries on the main loot grid, or generate any text for them.]]) |
2009 grp:AddChild(w) | 2088 grp:AddChild(w) |
2010 | 2089 |
2011 -- cutesy abbrevs | 2090 -- cutesy abbrevs |
2012 w = mkoption('snarky_boss', "Use snarky boss names", 0.49, | 2091 w = mkoption('snarky_boss', "Use snarky boss names", 0.49, |
2013 [[Irreverent replacement names for boss events.]]) | 2092 [[Irreverent replacement names for boss events. See abbreviations.lua for details.]]) |
2014 grp:AddChild(w) | 2093 grp:AddChild(w) |
2015 | 2094 |
2016 -- LOD plugins in all cases | 2095 -- LOD plugins in all cases |
2017 w = mkoption('display_disabled_LODs', "Include disabled plugins", 0.49, | 2096 w = mkoption('display_disabled_LODs', "Include disabled plugins", 0.49, |
2018 [[Show loadable plugins even if they've been disabled (and offer to enable them). Relog to take effect.]]) | 2097 [[Show loadable plugins even if they've been disabled (and offer to enable them). Relog to take effect.]]) |
2039 local pair = GUI:Create("InlineGroup") | 2118 local pair = GUI:Create("InlineGroup") |
2040 pair:SetLayout("List") | 2119 pair:SetLayout("List") |
2041 pair:SetRelativeWidth(0.49) | 2120 pair:SetRelativeWidth(0.49) |
2042 local editbox, checkbox | 2121 local editbox, checkbox |
2043 editbox = mkbutton("EditBox", nil, opts.keybinding_text, | 2122 editbox = mkbutton("EditBox", nil, opts.keybinding_text, |
2044 [[Keybinding text format is fragile! Relog to take effect.]]) | 2123 [[Keybinding text format is fragile (ALT then CTRL then SHIFT)! Relog to take effect.]]) |
2045 editbox:SetFullWidth(true) | 2124 editbox:SetFullWidth(true) |
2046 editbox:SetLabel("Keybinding text") | 2125 editbox:SetLabel("Keybinding text") |
2047 editbox:SetCallback("OnEnterPressed", function(_w,event,value) | 2126 editbox:SetCallback("OnEnterPressed", function(_w,event,value) |
2048 opts.keybinding_text = value | 2127 opts.keybinding_text = value |
2049 end) | 2128 end) |
2255 _w:SetDisabled(true) | 2334 _w:SetDisabled(true) |
2256 addon:DoPing() | 2335 addon:DoPing() |
2257 addon:ScheduleTimer(function(b) | 2336 addon:ScheduleTimer(function(b) |
2258 if b:IsVisible() then | 2337 if b:IsVisible() then |
2259 return addon:redisplay() | 2338 return addon:redisplay() |
2260 --return tabs_OnGroupSelected_func(container,"OnGroupSelected","opt") | |
2261 end | 2339 end |
2262 end, 5, _w) | 2340 end, 5, _w) |
2263 end) | 2341 end) |
2264 specials:AddChild(w) | 2342 specials:AddChild(w) |
2265 | 2343 |
2275 -- Simply to avoid recreating the same function over and over | 2353 -- Simply to avoid recreating the same function over and over |
2276 local tabs_OnGroupSelected_func_args = { [2] = "OnGroupSelected" } | 2354 local tabs_OnGroupSelected_func_args = { [2] = "OnGroupSelected" } |
2277 tabs_OnGroupSelected_func = function (tabs,event,group) | 2355 tabs_OnGroupSelected_func = function (tabs,event,group) |
2278 tabs_OnGroupSelected_func_args[1] = tabs | 2356 tabs_OnGroupSelected_func_args[1] = tabs |
2279 tabs_OnGroupSelected_func_args[3] = group | 2357 tabs_OnGroupSelected_func_args[3] = group |
2358 hide_noobtips_frame() | |
2280 tabs:ReleaseChildren() | 2359 tabs:ReleaseChildren() |
2281 local spec = tabs:GetUserData("special buttons group") | 2360 local spec = tabs:GetUserData("special buttons group") |
2282 spec:ReleaseChildren() | 2361 spec:ReleaseChildren() |
2283 local h = GUI:Create("Heading") | 2362 local h = GUI:Create("Heading") |
2284 h:SetFullWidth(true) | 2363 h:SetFullWidth(true) |
2295 end | 2374 end |
2296 local status,err = pcall (tabs_OnGroupSelected[group], tabs, spec, group) | 2375 local status,err = pcall (tabs_OnGroupSelected[group], tabs, spec, group) |
2297 if not status then | 2376 if not status then |
2298 addon:horrible_horrible_error(err) | 2377 addon:horrible_horrible_error(err) |
2299 end | 2378 end |
2379 if OuroLootSV_opts.gui_noob then | |
2380 local tip = noob_tips[group] | |
2381 if type(tip) == 'function' then | |
2382 tip = tip() | |
2383 end | |
2384 if type(tip) == 'string' and tip ~= "" then | |
2385 local w = get_noobtips_frame() | |
2386 w:SetParent (_d.content) | |
2387 w:ClearAllPoints() | |
2388 w:SetPoint("BOTTOMLEFT", _d.frame, "BOTTOMRIGHT", 3, 3) | |
2389 w:Show() | |
2390 w:DoTextWork(tip) | |
2391 end | |
2392 end | |
2300 --[====[ | 2393 --[====[ |
2301 Unfortunately, :GetHeight() called on anything useful out of a TabGroup | 2394 Unfortunately, :GetHeight() called on anything useful out of a TabGroup |
2302 returns the static default size (about 50 pixels) until the refresh | 2395 returns the static default size (about 50 pixels) until the refresh |
2303 cycle *after* all the frames are shown. Trying to fix it up after a | 2396 cycle *after* all the frames are shown. Trying to fix it up after a |
2304 single OnUpdate doesn't work either. So for now it's all hardcoded. | 2397 single OnUpdate doesn't work either. So for now it's all hardcoded. |
2305 | 2398 |
2306 Using this to determine the actual height of the usable area. | 2399 Using this to determine the actual height of the usable area. (Will |
2307 366 pixels | 2400 error until an ST is shown, which only happens if it's tracking, etc.) |
2401 416 pixels | |
2308 if group == "eoi" then | 2402 if group == "eoi" then |
2309 local stframe = tabs.children[1].frame | 2403 local stframe = tabs.children[1].frame |
2310 print(stframe:GetTop(),"-",stframe:GetBottom(),"=", | 2404 print(stframe:GetTop(),"-",stframe:GetBottom(),"=", |
2311 stframe:GetTop()-stframe:GetBottom()) | 2405 stframe:GetTop()-stframe:GetBottom()) |
2312 print(stframe:GetRight(),"-",stframe:GetLeft(),"=", | 2406 print(stframe:GetRight(),"-",stframe:GetLeft(),"=", |
2318 --[[ | 2412 --[[ |
2319 mkbutton ("WidgetType", 'display key', "Text On Widget", "the mouseover display text") | 2413 mkbutton ("WidgetType", 'display key', "Text On Widget", "the mouseover display text") |
2320 mkbutton ( [Button] 'display key', "Text On Widget", "the mouseover display text") | 2414 mkbutton ( [Button] 'display key', "Text On Widget", "the mouseover display text") |
2321 mkbutton ( [Button] [text] "Text On Widget", "the mouseover display text") | 2415 mkbutton ( [Button] [text] "Text On Widget", "the mouseover display text") |
2322 ]] | 2416 ]] |
2323 do | 2417 function mkbutton (opt_widget_type, opt_key, label, status) |
2324 local replacement_colors = { ["+"]="|cffffffff", ["<"]="|cff00ff00", [">"]="|r" } | 2418 if not label then |
2325 function mkbutton (opt_widget_type, opt_key, label, status) | 2419 opt_widget_type, opt_key, label, status = "Button", opt_widget_type, opt_widget_type, opt_key |
2326 if not label then | 2420 elseif not status then |
2327 opt_widget_type, opt_key, label, status = "Button", opt_widget_type, opt_widget_type, opt_key | 2421 opt_widget_type, opt_key, label, status = "Button", opt_widget_type, opt_key, label |
2328 elseif not status then | 2422 end |
2329 opt_widget_type, opt_key, label, status = "Button", opt_widget_type, opt_key, label | 2423 local button = assert(GUI:Create(opt_widget_type)) |
2330 end | 2424 if button.SetText then button:SetText(tostring(label)) end |
2331 local button = assert(GUI:Create(opt_widget_type)) | 2425 status = _markup(status) |
2332 if button.SetText then button:SetText(tostring(label)) end | 2426 button:SetCallback("OnEnter", function() setstatus(status) end) -- maybe factor that closure out |
2333 status = status:gsub("[%+<>]",replacement_colors) | 2427 button:SetCallback("OnLeave", statusy_OnLeave) |
2334 button:SetCallback("OnEnter", function() setstatus(status) end) -- maybe factor that closure out | 2428 -- retrieval key may be specified as nil if all the parameters are given |
2335 button:SetCallback("OnLeave", statusy_OnLeave) | 2429 if opt_key then _d:SetUserData (opt_key, button) end |
2336 -- retrieval key may be specified as nil if all the parameters are given | 2430 return button |
2337 if opt_key then _d:SetUserData (opt_key, button) end | |
2338 return button | |
2339 end | |
2340 end | 2431 end |
2341 | 2432 |
2342 --[[ | 2433 --[[ |
2343 Creates the main window. | 2434 Creates the main window. |
2344 ]] | 2435 ]] |
2369 display:SetLayout("Flow") | 2460 display:SetLayout("Flow") |
2370 display:SetStatusTable{width=900,height=550} -- default height is 500 | 2461 display:SetStatusTable{width=900,height=550} -- default height is 500 |
2371 display:EnableResize(false) | 2462 display:EnableResize(false) |
2372 display:SetCallback("OnClose", function(_display) | 2463 display:SetCallback("OnClose", function(_display) |
2373 UIDROPDOWNMENU_SHOW_TIME = prev_fade_time | 2464 UIDROPDOWNMENU_SHOW_TIME = prev_fade_time |
2465 hide_noobtips_frame() | |
2374 _d = _display:GetUserData("eoiST") | 2466 _d = _display:GetUserData("eoiST") |
2375 self.display = nil | 2467 self.display = nil |
2376 GUI:Release(_display) | 2468 GUI:Release(_display) |
2377 flib.clear() | 2469 flib.clear() |
2378 collectgarbage() | 2470 collectgarbage() |