changeset 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 ae17128ef3f2
children c87bf3e756f3
files abbreviations.lua core.lua gui.lua verbage.lua
diffstat 4 files changed, 137 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/abbreviations.lua	Sun Jun 17 20:55:11 2012 +0000
+++ b/abbreviations.lua	Mon Jun 18 03:02:10 2012 +0000
@@ -1,6 +1,7 @@
 --[==[
 If you want to change these to something else, like in-jokes for your guild,
-write a small addon like this:
+write a small addon like this.  Lines with * are crucial and should not be
+changed from how they're shown here.
 
         Interface/AddOns/YourMod/YourMod.toc:
         =================================
@@ -13,17 +14,19 @@
         main.lua
         =================================
 
-Lines with * are crucial.  Then replace specific entries like this:
+Then replace specific entries like this:
 
         Interface/AddOns/YourMod/main.lua:
         =================================
-        local ouroloot = LibStub("AceAddon-3.0"):GetAddon("Ouro Loot")
+      * local ouroloot = LibStub("AceAddon-3.0"):GetAddon("Ouro Loot")
     
         ouroloot.instance_abbrev["The Bastion of Twilight"] =
-            [[Steve Said He'd /gquit If We Make Him Go Here Ever Again]]
+            [[Steve Said He Would /gquit If We Make Him Go Here Ever Again]]
 
         ouroloot.boss_abbrev["Omnotron Defense System"] =
             [[Jim Will Facetank The Slimes Now]]
+
+        ouroloot:Print [[Tweaked stuff for mah guildies!]]
         =================================
 
 This lets you update Ouro Loot with a new version (overwriting this file)
--- a/core.lua	Sun Jun 17 20:55:11 2012 +0000
+++ b/core.lua	Mon Jun 18 03:02:10 2012 +0000
@@ -115,6 +115,7 @@
 	['popup_on_join'] = true,
 	['register_slashloot'] = true,
 	['scroll_to_bottom'] = true,
+	['gui_noob'] = true,
 	['chatty_on_kill'] = false,
 	['no_tracking_wipes'] = false,
 	['snarky_boss'] = true,
--- a/gui.lua	Sun Jun 17 20:55:11 2012 +0000
+++ b/gui.lua	Mon Jun 18 03:02:10 2012 +0000
@@ -12,7 +12,7 @@
 
 ------ Constants
 local eoi_st_rowheight			= 20
-local eoi_st_displayed_rows		= math.floor(416/eoi_st_rowheight) --math.floor(366/eoi_st_rowheight)
+local eoi_st_displayed_rows		= math.floor(416/eoi_st_rowheight)
 local eoi_st_textured_item_format = "|T%s:"..(eoi_st_rowheight-2).."|t %s[%s]|r%s"
 local eoi_st_otherrow_bgcolortable = {
 	wipe	= { ["r"] = 0.3, ["g"] = 0.3, ["b"] = 0.3},
@@ -70,7 +70,7 @@
 local GetNumRaidMembers = GetNumRaidMembers
 
 -- En masse forward decls of symbols defined inside local blocks
-local _generate_text, _populate_text_specials
+local _generate_text, _populate_text_specials, _markup
 local eoi_dropdownfuncs, _tabtexts, _taborder -- filled out in gui block scope
 local _do_debugging_tooltip, _hide_debugging_tooltip, _build_debugging_tooltip
 local _new_rebroadcast_hyperlink
@@ -84,6 +84,8 @@
 local tabs_OnGroupSelected = {}
 local mkbutton
 local tabs_OnGroupSelected_func, tabs_generated_text_OGS
+-- Similarly for the popup tips on the right side of the window.
+local noob_tips = {}
 
 -- Class color support
 local class_colors-- = {}
@@ -106,6 +108,19 @@
 	addon.class_colors = class_colors
 end
 
+do
+	local replacement_colors = {
+		["+"]="|cffffffff",   -- white
+		["<"]="|cff00ff00",   -- light green
+		[">"]="|r" }
+	function _markup (t)
+		-- wonder if it would be worth memoizing this also
+		return t:gsub("[%+<>]",replacement_colors)
+		        :gsub("([^\n])\n([^\n])", "%1 %2")
+		        :gsub("|r\n\n", "|r\n")
+	end
+end
+
 -- Working around this bug:
 -- http://forums.wowace.com/showpost.php?p=295202&postcount=31
 do
@@ -633,6 +648,50 @@
 	end
 end
 
+-- UI tips window
+local hide_noobtips_frame = flib.nullfunc
+local function get_noobtips_frame()
+	local f = CreateFrame("Frame")
+	f:SetBackdrop{
+		bgFile = [[Interface\Tooltips\UI-Tooltip-Background]],
+		--bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]],
+		edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]],
+		--edgeFile = [[Interface\DialogFrame\UI-DialogBox-Border]],
+		tile = true,
+		tileSize = 8,
+		--tileSize = 32,
+		edgeSize = 12,
+		--edgeSize = 32,
+		insets = { left = 2, right = 2, top = 2, bottom = 2 }
+		--insets = { left = 11, right = 12, top = 12, bottom = 11 }
+	}
+	f:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r,
+		TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b)
+	f:SetBackdropBorderColor(TOOLTIP_DEFAULT_COLOR.r, TOOLTIP_DEFAULT_COLOR.g,
+		TOOLTIP_DEFAULT_COLOR.b)
+	f:SetMovable(false)
+	f:EnableMouse(false)
+	f:SetFrameStrata("TOOLTIP")
+	f:SetToplevel(true)
+	f:SetClampedToScreen(true)
+	f:SetWidth(220)
+	local t = f:CreateFontString (nil, "ARTWORK", "GameFontHighlightSmall")
+	--t:SetPoint ("TOPLEFT", f, "TOPLEFT", 14, -15)
+	t:SetPoint ("TOPLEFT", f, "TOPLEFT", 10, -10)
+	t:SetJustifyH("LEFT")
+
+	f.text = t
+	f.DoTextWork = function (self, text)
+		self.text:SetText(text)
+		self.text:SetWidth (self:GetWidth() - 20)
+		self:SetHeight (self.text:GetHeight() + 20)
+	end
+
+	get_noobtips_frame = function() return f end
+	hide_noobtips_frame = function() f:Hide() end
+	return f
+end
+
 
 ------ Main GUI Window
 local _d   -- display when it's open, eoiST when it's not
@@ -941,7 +1000,7 @@
 		notCheckable = true,
 	}},
 	{
-		"Change from 'wipe' to 'kill'|Also collapses previous wipe entries.",
+		"Change from 'wipe' to 'kill'|Also collapses previous wipe entries.", -- KILLWIPE
 		"Rebroadcast this boss%boss|Broadcasts the kill event and all subsequent loot until next boss.",
 		"Delete this boss event|Permanent, no going back!",
 		"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.",
@@ -1078,6 +1137,9 @@
 
 	elseif kind == 'boss' then
 		eoi_boss_dropdown[1].text = e.bossname
+		-- KILLWIPE:  update '2' if this is not the 2nd entry in eoi_boss_dropdown
+		eoi_boss_dropdown[2].tooltipWhileDisabled = nil
+		eoi_boss_dropdown[2].disabled = e.reason ~= 'wipe' and true or nil
 		EasyMenu (eoi_boss_dropdown, dropdownmenuframe, cellFrame, 0, 0, "MENU")
 
 	elseif kind == 'time' then
@@ -1364,6 +1426,12 @@
 	-- ...and call it.
 	return tabs_OnGroupSelected["eoi"](ocontainer,specials)
 end
+noob_tips["eoi"] = _markup[[
+<Shift-Left> while over an item link to paste it into chat.
+
+<Right>-click any row to display a dropdown menu.  The menu is different for
+the Player column than it is for the Item/Notes columns, and different for
+loot entries than it is for other rows.]]
 
 
 -- Tab 2/3 (generated text)
@@ -1411,7 +1479,6 @@
 		g_generated[pos] = nil
 		addon:Print("'%s' has been regenerated.", _tabtexts[text_kind].title)
 		return addon:redisplay()
-		--return tabs_OnGroupSelected_func(container,"OnGroupSelected",text_kind)
 	end)
 	specials:AddChild(w)
 	if addon:is_plugin(text_kind) then
@@ -1692,6 +1759,12 @@
 	end
 	return tabs_OnGroupSelected["hist"](container,specials)
 end
+noob_tips["hist"] = _markup[[
+<Left>-click a row to see all history for that player.  <Right>-click any row
+to return to showing all players.
+
+<Shift-Left> while over an item link to paste it into chat.  <Shift-Right>
+any row to display a dropdown menu.]]
 
 
 -- Tab 5:  Help (content in verbage.lua)
@@ -1949,13 +2022,12 @@
 			local speedbump = GUI:Create("InteractiveLabel")
 			speedbump:SetFullWidth(true)
 			speedbump:SetFontObject(GameFontHighlightLarge)
-			speedbump:SetImage("Interface\\DialogFrame\\DialogAlertIcon")
+			speedbump:SetImage[[Interface\DialogFrame\DialogAlertIcon]]
 			speedbump:SetImageSize(50,50)
 			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.")
 			speedbump:SetCallback("OnClick", function (_sb)
 				adv_lower = adv_real
 				return addon:redisplay()
-				--return tabs_OnGroupSelected_func(container.parent,"OnGroupSelected","opt")
 			end)
 			container:AddChild(speedbump)
 			spacer = GUI:Create("Spacer")
@@ -1968,7 +2040,6 @@
 	tabs_OnGroupSelected["opt"] = function(container,specials)
 		opts = OuroLootSV_opts
 
-		--container:SetLayout("List")
 		container:SetLayout("Fill")
 		local scroll, grp, w
 
@@ -1980,11 +2051,19 @@
 		grp:SetFullWidth(true)
 		grp:SetTitle("User Options     [these are saved across sessions]")
 
-		-- The relative width fields used to be done to take up less vertical space, but
-		-- that turned out to look messy.  Now they're just a straight line for the most part.
+		-- The relative width fields used to be done to take up less vertical
+		-- space, but that turned out to look messy.  Now they're just a
+		-- straight line for the most part.
+
+		-- the nubtoggle!
+		w = mkoption('gui_noob', [[Show UI Tips]], 0.85,
+			[[Toggles display of the "helpful tips" box on the right side.  Useful if you've just installed/upgraded.]])
+		w:SetImage[[Interface\OptionsFrame\UI-OptionsFrame-NewFeatureIcon]]
+		grp:AddChild(w)
+		w = GUI:Create("Spacer") w:SetFullWidth(true) w:SetHeight(10) grp:AddChild(w)
 
 		-- reminder popup
-		w = mkoption ('popup_on_join', "Show reminder popup", 0.49,
+		w = mkoption ('popup_on_join', "Show reminder popup on new raid", 0.49,
 			[[When joining a raid and not already tracking, display a dialog asking for instructions.]])
 		grp:AddChild(w)
 
@@ -2000,7 +2079,7 @@
 
 		-- chatty boss mode
 		w = mkoption('chatty_on_kill', "Be chatty on boss kill", 0.49,
-			[[Print something to chat output when DBM tells Ouro Loot about a successful boss kill.]])
+			[[Print something to chat output when the boss mod tells Ouro Loot about a successful boss kill.]])
 		grp:AddChild(w)
 
 		-- less noise in main panel
@@ -2010,7 +2089,7 @@
 
 		-- cutesy abbrevs
 		w = mkoption('snarky_boss', "Use snarky boss names", 0.49,
-			[[Irreverent replacement names for boss events.]])
+			[[Irreverent replacement names for boss events.  See abbreviations.lua for details.]])
 		grp:AddChild(w)
 
 		-- LOD plugins in all cases
@@ -2041,7 +2120,7 @@
 			pair:SetRelativeWidth(0.49)
 			local editbox, checkbox
 			editbox = mkbutton("EditBox", nil, opts.keybinding_text,
-				[[Keybinding text format is fragile!  Relog to take effect.]])
+				[[Keybinding text format is fragile (ALT then CTRL then SHIFT)!  Relog to take effect.]])
 			editbox:SetFullWidth(true)
 			editbox:SetLabel("Keybinding text")
 			editbox:SetCallback("OnEnterPressed", function(_w,event,value)
@@ -2257,7 +2336,6 @@
 			addon:ScheduleTimer(function(b)
 				if b:IsVisible() then
 					return addon:redisplay()
-					--return tabs_OnGroupSelected_func(container,"OnGroupSelected","opt")
 				end
 			end, 5, _w)
 		end)
@@ -2277,6 +2355,7 @@
 tabs_OnGroupSelected_func = function (tabs,event,group)
 	tabs_OnGroupSelected_func_args[1] = tabs
 	tabs_OnGroupSelected_func_args[3] = group
+	hide_noobtips_frame()
 	tabs:ReleaseChildren()
 	local spec = tabs:GetUserData("special buttons group")
 	spec:ReleaseChildren()
@@ -2297,14 +2376,29 @@
 	if not status then
 		addon:horrible_horrible_error(err)
 	end
+	if OuroLootSV_opts.gui_noob then
+		local tip = noob_tips[group]
+		if type(tip) == 'function' then
+			tip = tip()
+		end
+		if type(tip) == 'string' and tip ~= "" then
+			local w = get_noobtips_frame()
+			w:SetParent (_d.content)
+			w:ClearAllPoints()
+			w:SetPoint("BOTTOMLEFT", _d.frame, "BOTTOMRIGHT", 3, 3)
+			w:Show()
+			w:DoTextWork(tip)
+		end
+	end
 	--[====[
 	Unfortunately, :GetHeight() called on anything useful out of a TabGroup
 	returns the static default size (about 50 pixels) until the refresh
 	cycle *after* all the frames are shown.  Trying to fix it up after a
 	single OnUpdate doesn't work either.  So for now it's all hardcoded.
 	
-	Using this to determine the actual height of the usable area.
-	366 pixels
+	Using this to determine the actual height of the usable area.  (Will
+	error until an ST is shown, which only happens if it's tracking, etc.)
+	416 pixels
 	if group == "eoi" then
 		local stframe = tabs.children[1].frame
 		print(stframe:GetTop(),"-",stframe:GetBottom(),"=",
@@ -2320,23 +2414,20 @@
 mkbutton ( [Button]     'display key', "Text On Widget", "the mouseover display text")
 mkbutton ( [Button]      [text]        "Text On Widget", "the mouseover display text")
 ]]
-do
-	local replacement_colors = { ["+"]="|cffffffff", ["<"]="|cff00ff00", [">"]="|r" }
-	function mkbutton (opt_widget_type, opt_key, label, status)
-		if not label then
-			opt_widget_type, opt_key, label, status = "Button", opt_widget_type, opt_widget_type, opt_key
-		elseif not status then
-			opt_widget_type, opt_key, label, status = "Button", opt_widget_type, opt_key, label
-		end
-		local button = assert(GUI:Create(opt_widget_type))
-		if button.SetText then button:SetText(tostring(label)) end
-		status = status:gsub("[%+<>]",replacement_colors)
-		button:SetCallback("OnEnter", function() setstatus(status) end) -- maybe factor that closure out
-		button:SetCallback("OnLeave", statusy_OnLeave)
-		-- retrieval key may be specified as nil if all the parameters are given
-		if opt_key then _d:SetUserData (opt_key, button) end
-		return button
+function mkbutton (opt_widget_type, opt_key, label, status)
+	if not label then
+		opt_widget_type, opt_key, label, status = "Button", opt_widget_type, opt_widget_type, opt_key
+	elseif not status then
+		opt_widget_type, opt_key, label, status = "Button", opt_widget_type, opt_key, label
 	end
+	local button = assert(GUI:Create(opt_widget_type))
+	if button.SetText then button:SetText(tostring(label)) end
+	status = _markup(status)
+	button:SetCallback("OnEnter", function() setstatus(status) end) -- maybe factor that closure out
+	button:SetCallback("OnLeave", statusy_OnLeave)
+	-- retrieval key may be specified as nil if all the parameters are given
+	if opt_key then _d:SetUserData (opt_key, button) end
+	return button
 end
 
 --[[
@@ -2371,6 +2462,7 @@
 	display:EnableResize(false)
 	display:SetCallback("OnClose", function(_display)
 		UIDROPDOWNMENU_SHOW_TIME = prev_fade_time 
+		hide_noobtips_frame()
 		_d = _display:GetUserData("eoiST")
 		self.display = nil
 		GUI:Release(_display)
--- a/verbage.lua	Sun Jun 17 20:55:11 2012 +0000
+++ b/verbage.lua	Mon Jun 18 03:02:10 2012 +0000
@@ -416,9 +416,6 @@
 ]]
 
 T.tips = [[
-Shift-clicking an item in the <Loot> or <History> display will paste it into an
-open chat editbox.
-
 The |cffff8000[Ouro Loot]|r "legendary item" displayed at the start of all
 chat messages is a clickable link.  Clicking opens the main display.  An option
 on the <Options> tab will cause a message to be printed after a boss kill,
@@ -437,6 +434,9 @@
 
 Using the "Saved Texts" feature plus the +Clear> button is a great way of putting
 off pasting loot into your guild's website until a more convenient time.
+
+Shift-clicking an item in the <Loot> or <History> display will paste it into an
+open chat editbox.
 ]]
 
 T.tips_slashies = [[
@@ -567,8 +567,10 @@
 	local wrapped = text
 	wrapped = wrapped:gsub ("[%+<>]", replacement_colors)
 	wrapped = wrapped:gsub ("([^\n])\n([^\n])", "%1 %2")
+	--safeprint(wrapped)
 	wrapped = wrapped:gsub ("|r\n\n", "|r\n")
 	wrapped = wrapped:gsub ("Ouroboros", "|cffa335ee<Ouroboros>|r")
+	--safeprint(wrapped)
 	wrapped = wrapped:gsub ("%*%(", "<") :gsub("%)%*", ">") :gsub(":PLUS:", "+")
 	addon.helptext[funkykey] = wrapped
 end