Mercurial > wow > ouroloot
diff verbage.lua @ 95:3546c7b55986
Move generation of the Help tab to the same file as the help text. Allow registration of arbitrary tab controls, not just text generation. Move some shared data out of the addon table into a 'gui' state table in preparation for more of the same. Clean some cruft out of the default itemfilter list.
author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
---|---|
date | Thu, 26 Jul 2012 03:34:56 +0000 |
parents | c9f955f9a285 |
children | 780b7e0eeeeb |
line wrap: on
line diff
--- a/verbage.lua Tue Jul 24 23:04:51 2012 +0000 +++ b/verbage.lua Thu Jul 26 03:34:56 2012 +0000 @@ -1,9 +1,26 @@ +local addon = select(2,...) +if addon.NOLOAD then return end + +-- Don't bother recording any of this loot: +addon.default_itemfilter = { + -- could probably remove most of this now +-- [29434] = true, -- Badge of Justice +-- [40752] = true, -- Emblem of Heroism +-- [40753] = true, -- Emblem of Valor +-- [45624] = true, -- Emblem of Conquest +-- [43228] = true, -- Stone Keeper's Shard +-- [47241] = true, -- Emblem of Triumph +-- [49426] = true, -- Emblem of Frost +} + +-- Mark these as straight to guild vault: +addon.default_itemvault = { + [52078] = true, -- Chaos Orb + [69237] = true, -- Living Ember + [71998] = true, -- Essence of Destruction +} local todo = [[ -- When using slash command to go directly to a tab, accept additional arguments -and let the tab decide how to interpret them. (For starters, History should -search for a player's name and do the current "magnify" action.) - - Right-clicking the [ouroloot] chat link could do something different than the current left-clicking. Popup small menu in place? @@ -15,9 +32,6 @@ that would be likely to drive me batshiat insane. ]] -local addon = select(2,...) -if addon.NOLOAD then return end - addon.helptree = { { value = "about", @@ -114,12 +128,16 @@ local T={} T.about = [[ Ouro Loot is the fault of Farmbuyer of Ouroboros on US-Kilrogg. Bug reports, -comments, and suggestions are welcome at the project page at curse.com or send -them to <farmbuyer@gmail.com>. +comments, and suggestions are welcome at the project page: + +<www.curse.com/addons/wow/ouroloot> + + +or send them to <farmbuyer@gmail.com>. ]] T.basic = [[ -The </ouroloot> (and </loot> by default) command opens this display. The buttons +The </ouroloot> command opens this display. The buttons on the right side control operation and are mostly self-explanatory. Hovering over things will usually display some additional text in the gray line at the bottom. @@ -274,8 +292,8 @@ If you logout for any reason, the addon will not reactivate when you log back in. -You can use </loot bcast> or </loot broadcast> to turn on rebroadcasting without -opening the GUI. +You can use </ouroloot bcast> or </ouroloot broadcast> to turn on rebroadcasting +without opening the GUI. ]] T.texts = [[ @@ -440,11 +458,15 @@ ]] T.tips_slashies = [[ -If you give an unrecognized argument to the </ouroloot> slash command, it will +A field in the <Options> tab lets you use additional slash commands as a +shortcut for </ouroloot>. The author prefers </ol>, as an example. The +default used to be </loot> until that became a builtin command in MoP. + +If you give an unrecognized argument to a slash command, it will search the tab titles left to right for a title beginning with the same letters as -the argument, and open the display to that tab. For example, <"/loot a"> would -open the <Attendance> tab, and <"/loot ad"> would open the <Advanced> tab. If -you had added a theoretical <EQDKP> tab, then <"/loot eq"> would be the fastest +the argument, and open the display to that tab. For example, <"/ol a"> would +open the <Attendance> tab, and <"/ol ad"> would open the <Advanced> tab. If +you had added a theoretical <EQDKP> tab, then <"/ol eq"> would be the fastest way to see it. The </ouroloot> command can take arguments to do things without going through @@ -578,23 +600,67 @@ todo = nil --- Don't bother recording any of this loot: -addon.default_itemfilter = { - [29434] = true, -- Badge of Justice - [40752] = true, -- Emblem of Heroism - [40753] = true, -- Emblem of Valor - [45624] = true, -- Emblem of Conquest - -- could probably remove most of this now - [43228] = true, -- Stone Keeper's Shard - [47241] = true, -- Emblem of Triumph - [49426] = true, -- Emblem of Frost -} +-- Tab 5: Help +do + local AceGUI = LibStub("AceGUI-3.0") + -- widget container status tables (will have things magically appear + -- inside them that we wish to preserve) + local status_for_scroll = {} + local status_for_select = { treewidth = 145 } --- Mark these as straight to guild vault: -addon.default_itemvault = { - [52078] = true, -- Chaos Orb - [69237] = true, -- Living Ember - [71998] = true, -- Essence of Destruction -} + -- Clicking an entry on the left tree column. + local help_OnGroupSelected_func = function (treeg,event,category) + treeg:ReleaseChildren() + local txt = AceGUI:Create("Label") + txt:SetFullWidth(true) + txt:SetFontObject(GameFontNormal)--Highlight) + txt:SetText(addon.helptext[category]) + local sf = AceGUI:Create("ScrollFrame") + sf:SetStatusTable(status_for_scroll) + sf:SetLayout("Fill") + -- This forces the scrolling area to be bigger than the visible area; else + -- some of the text gets cut off without ever triggering the scrollbar. + sf.content:SetHeight(700) + sf:AddChild(txt) + treeg:AddChild(sf) + if treeg:GetUserData("help restore scroll") then + if status_for_scroll.scrollvalue then + sf:SetScroll(status_for_scroll.scrollvalue) + end + treeg:SetUserData("help restore scroll", false) + else + sf:SetScroll(0) + end + end + + -- Clicking the Help tab as a whole (tabs_OnGroupSelected["help"]). + local tabs_OGS = function(container,specials) + container:SetLayout("Fill") + local left = AceGUI:Create("TreeGroup") + left:SetStatusTable(status_for_select) + left:SetLayout("Fill") + left:SetFullWidth(true) + left:SetFullHeight(true) + left:EnableButtonTooltips(false) + left:SetTree(addon.helptree) + left:SetCallback("OnGroupSelected", help_OnGroupSelected_func) + container:AddChild(left) + if status_for_select.selected then + left:SetUserData("help restore scroll", true) + left:SelectByValue(status_for_select.selected) + else + left:SelectByValue("basic") + end + end + + local noob = [[ +Every tab across the top also gets its own special buttons here in the lower +right, under the same name as the tab. Some controls do not become visible +until that tab has data to work with.]] + + addon:register_tab_control_AT_END ("help", [[Help]], + [[Instructions, reminders, and tips for non-obvious features]], + tabs_OGS, --[[opt_noobtip=]]noob) +end -- vim:noet