comparison verbage.lua @ 96:780b7e0eeeeb

Break the options panel out of gui.lua into new options.lua. Move default item lists from verbage.lua there also. Redo options panel as a tree instead of a massive scrolling thing, and prepare data structures to let plugins/etc add their own options code.
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Thu, 26 Jul 2012 20:46:00 +0000
parents 3546c7b55986
children ba5ff82dcf19
comparison
equal deleted inserted replaced
95:3546c7b55986 96:780b7e0eeeeb
1 local addon = select(2,...) 1 local addon = select(2,...)
2 if addon.NOLOAD then return end 2 if addon.NOLOAD then return end
3
4 -- Don't bother recording any of this loot:
5 addon.default_itemfilter = {
6 -- could probably remove most of this now
7 -- [29434] = true, -- Badge of Justice
8 -- [40752] = true, -- Emblem of Heroism
9 -- [40753] = true, -- Emblem of Valor
10 -- [45624] = true, -- Emblem of Conquest
11 -- [43228] = true, -- Stone Keeper's Shard
12 -- [47241] = true, -- Emblem of Triumph
13 -- [49426] = true, -- Emblem of Frost
14 }
15
16 -- Mark these as straight to guild vault:
17 addon.default_itemvault = {
18 [52078] = true, -- Chaos Orb
19 [69237] = true, -- Living Ember
20 [71998] = true, -- Essence of Destruction
21 }
22 3
23 local todo = [[ 4 local todo = [[
24 - Right-clicking the [ouroloot] chat link could do something different than 5 - Right-clicking the [ouroloot] chat link could do something different than
25 the current left-clicking. Popup small menu in place? 6 the current left-clicking. Popup small menu in place?
26 7
30 11
31 - Being able to drag rows up and down the main loot grid would be awesome. Coding 12 - Being able to drag rows up and down the main loot grid would be awesome. Coding
32 that would be likely to drive me batshiat insane. 13 that would be likely to drive me batshiat insane.
33 ]] 14 ]]
34 15
35 addon.helptree = { 16 local helptree = {
36 { 17 {
37 value = "about", 18 value = "about",
38 text = "About", 19 text = "About",
39 }, 20 },
40 { 21 {
118 } 99 }
119 100
120 -- Help text. Formatting doesn't matter, but use a blank line to split 101 -- Help text. Formatting doesn't matter, but use a blank line to split
121 -- paragraphs. This file needs to be edited with a text editor that doesn't 102 -- paragraphs. This file needs to be edited with a text editor that doesn't
122 -- do anything stupid by placing extra spaces at the end of lines. 103 -- do anything stupid by placing extra spaces at the end of lines.
104 local helptext
123 do 105 do
124 local replacement_colors = { 106 local replacement_colors = {
125 ["+"]="|cff30adff", -- blue: right-click options, control panel names 107 ["+"]="|cff30adff", -- blue: right-click options, control panel names
126 ["<"]="|cff00ff00", -- light green, tab titles and generic highlighting 108 ["<"]="|cff00ff00", -- light green, tab titles and generic highlighting
127 [">"]="|r" } 109 [">"]="|r" }
581 T.todo_todolist = todo 563 T.todo_todolist = todo
582 564
583 565
584 -- Fill out the table that will actually be used. Join adjacent lines here so 566 -- Fill out the table that will actually be used. Join adjacent lines here so
585 -- that they'll wrap properly. 567 -- that they'll wrap properly.
586 addon.helptext = {} 568 helptext = {}
587 for k,text in pairs(T) do 569 for k,text in pairs(T) do
588 local funkykey = k:gsub('_','\001') -- this is how TreeGroup makes unique keys 570 local funkykey = k:gsub('_','\001') -- this is how TreeGroup makes unique keys
589 local wrapped = text 571 local wrapped = text
590 wrapped = wrapped:gsub ("[%+<>]", replacement_colors) 572 wrapped = wrapped:gsub ("[%+<>]", replacement_colors)
591 wrapped = wrapped:gsub ("([^\n])\n([^\n])", "%1 %2") 573 wrapped = wrapped:gsub ("([^\n])\n([^\n])", "%1 %2")
592 --safeprint(wrapped) 574 --safeprint(wrapped)
593 wrapped = wrapped:gsub ("|r\n\n", "|r\n") 575 wrapped = wrapped:gsub ("|r\n\n", "|r\n")
594 wrapped = wrapped:gsub ("Ouroboros", "|cffa335ee<Ouroboros>|r") 576 wrapped = wrapped:gsub ("Ouroboros", "|cffa335ee<Ouroboros>|r")
595 --safeprint(wrapped) 577 --safeprint(wrapped)
596 wrapped = wrapped:gsub ("%*%(", "<") :gsub("%)%*", ">") :gsub(":PLUS:", "+") 578 wrapped = wrapped:gsub ("%*%(", "<") :gsub("%)%*", ">") :gsub(":PLUS:", "+")
597 addon.helptext[funkykey] = wrapped 579 helptext[funkykey] = wrapped
598 end 580 end
599 end -- do scope 581 end -- do scope
600 todo = nil 582 todo = nil
601 583
602 584
608 local status_for_scroll = {} 590 local status_for_scroll = {}
609 local status_for_select = { treewidth = 145 } 591 local status_for_select = { treewidth = 145 }
610 592
611 -- Clicking an entry on the left tree column. 593 -- Clicking an entry on the left tree column.
612 local help_OnGroupSelected_func = function (treeg,event,category) 594 local help_OnGroupSelected_func = function (treeg,event,category)
595 -- Some way of just reusing the same Label widget when clicking
596 -- different topics?
613 treeg:ReleaseChildren() 597 treeg:ReleaseChildren()
614 local txt = AceGUI:Create("Label") 598 local txt = AceGUI:Create("Label")
615 txt:SetFullWidth(true) 599 txt:SetFullWidth(true)
616 txt:SetFontObject(GameFontNormal)--Highlight) 600 txt:SetFontObject(GameFontNormal)--Highlight)
617 txt:SetText(addon.helptext[category]) 601 txt:SetText(helptext[category])
618 local sf = AceGUI:Create("ScrollFrame") 602 local sf = AceGUI:Create("ScrollFrame")
619 sf:SetStatusTable(status_for_scroll) 603 sf:SetStatusTable(status_for_scroll)
620 sf:SetLayout("Fill") 604 sf:SetLayout("Fill")
621 -- This forces the scrolling area to be bigger than the visible area; else 605 -- This forces the scrolling area to be bigger than the visible area; else
622 -- some of the text gets cut off without ever triggering the scrollbar. 606 -- some of the text gets cut off without ever triggering the scrollbar.
640 left:SetStatusTable(status_for_select) 624 left:SetStatusTable(status_for_select)
641 left:SetLayout("Fill") 625 left:SetLayout("Fill")
642 left:SetFullWidth(true) 626 left:SetFullWidth(true)
643 left:SetFullHeight(true) 627 left:SetFullHeight(true)
644 left:EnableButtonTooltips(false) 628 left:EnableButtonTooltips(false)
645 left:SetTree(addon.helptree) 629 left:SetTree(helptree)
646 left:SetCallback("OnGroupSelected", help_OnGroupSelected_func) 630 left:SetCallback("OnGroupSelected", help_OnGroupSelected_func)
647 container:AddChild(left) 631 container:AddChild(left)
648 if status_for_select.selected then 632 if status_for_select.selected then
649 left:SetUserData("help restore scroll", true) 633 left:SetUserData("help restore scroll", true)
650 left:SelectByValue(status_for_select.selected) 634 left:SelectByValue(status_for_select.selected)