vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --[Functions: GUI Interface for WIM_History.xml |
2 | |||
3 | WIM_HistoryView_Name_Selected = ""; |
||
4 | WIM_HistoryView_Filter_Selected = ""; |
||
5 | |||
6 | function WIM_HistoryView_NameClick() |
||
7 | if(WIM_HistoryView_Name_Selected ~= this.Name) then |
||
8 | WIM_HistoryView_Filter_Selected = ""; |
||
9 | end |
||
10 | WIM_HistoryView_Name_Selected = this.theName; |
||
11 | WIM_HistoryViewFiltersScrollBar_Update(); |
||
12 | end |
||
13 | |||
14 | function WIM_HistoryView_FilterClick() |
||
15 | WIM_HistoryView_Filter_Selected = this.theName; |
||
16 | end |
||
17 | |||
18 | function WIM_HistoryViewNameScrollBar_Update() |
||
19 | local line; |
||
20 | local lineplusoffset; |
||
21 | local HistoryNames = {}; |
||
22 | |||
23 | for key in WIM_History do |
||
24 | table.insert(HistoryNames, key); |
||
25 | end |
||
26 | table.sort(HistoryNames); |
||
27 | |||
28 | FauxScrollFrame_Update(WIM_HistoryFrameNameListScrollBar,table.getn(HistoryNames),15,16); |
||
29 | for line=1,15 do |
||
30 | lineplusoffset = line + FauxScrollFrame_GetOffset(WIM_HistoryFrameNameListScrollBar); |
||
31 | if lineplusoffset <= table.getn(HistoryNames) then |
||
32 | getglobal("WIM_HistoryFrameNameListButton"..line.."Name"):SetText(HistoryNames[lineplusoffset]); |
||
33 | getglobal("WIM_HistoryFrameNameListButton"..line).theName = HistoryNames[lineplusoffset]; |
||
34 | if ( WIM_HistoryView_Name_Selected == HistoryNames[lineplusoffset] ) then |
||
35 | getglobal("WIM_HistoryFrameNameListButton"..line):LockHighlight(); |
||
36 | else |
||
37 | getglobal("WIM_HistoryFrameNameListButton"..line):UnlockHighlight(); |
||
38 | end |
||
39 | getglobal("WIM_HistoryFrameNameListButton"..line):Show(); |
||
40 | else |
||
41 | getglobal("WIM_HistoryFrameNameListButton"..line):Hide(); |
||
42 | end |
||
43 | end |
||
44 | end |
||
45 | |||
46 | |||
47 | |||
48 | |||
49 | function WIM_HistoryViewFiltersScrollBar_Update() |
||
50 | local line; |
||
51 | local lineplusoffset; |
||
52 | local Filters = {}; |
||
53 | |||
54 | local tDate = ""; |
||
55 | local lDate = ""; |
||
56 | if(WIM_History[WIM_HistoryView_Name_Selected]) then |
||
57 | for i=1,table.getn(WIM_History[WIM_HistoryView_Name_Selected]) do |
||
58 | tDate = WIM_History[WIM_HistoryView_Name_Selected][i].date; |
||
59 | if(tDate ~= lDate) then |
||
60 | table.insert(Filters, tDate); |
||
61 | lDate = tDate; |
||
62 | end |
||
63 | end |
||
64 | end |
||
65 | table.sort(Filters); |
||
66 | table.insert(Filters, 1, "None (Show All)"); |
||
67 | if(WIM_HistoryView_Filter_Selected == "") then |
||
68 | --[WIM_HistoryView_Filter_Selected = Filters[1]; |
||
69 | end |
||
70 | |||
71 | FauxScrollFrame_Update(WIM_HistoryFrameFilterListScrollBar,table.getn(Filters),7,16); |
||
72 | for line=1,7 do |
||
73 | lineplusoffset = line + FauxScrollFrame_GetOffset(WIM_HistoryFrameFilterListScrollBar); |
||
74 | if lineplusoffset <= table.getn(Filters) then |
||
75 | getglobal("WIM_HistoryFrameFilterListButton"..line.."Name"):SetText(Filters[lineplusoffset]); |
||
76 | if(lineplusoffset == 1) then |
||
77 | getglobal("WIM_HistoryFrameFilterListButton"..line).theName = ""; |
||
78 | else |
||
79 | getglobal("WIM_HistoryFrameFilterListButton"..line).theName = Filters[lineplusoffset]; |
||
80 | end |
||
81 | if ( WIM_HistoryView_Filter_Selected == Filters[lineplusoffset] ) then |
||
82 | getglobal("WIM_HistoryFrameFilterListButton"..line):LockHighlight(); |
||
83 | else |
||
84 | getglobal("WIM_HistoryFrameFilterListButton"..line):UnlockHighlight(); |
||
85 | end |
||
86 | getglobal("WIM_HistoryFrameFilterListButton"..line):Show(); |
||
87 | else |
||
88 | getglobal("WIM_HistoryFrameFilterListButton"..line):Hide(); |
||
89 | end |
||
90 | end |
||
91 | WIM_HistoryView_ShowMessages(); |
||
92 | end |
||
93 | |||
94 | |||
95 | function WIM_HistoryView_ShowMessages() |
||
96 | local tStamp = ""; |
||
97 | local tFrom = ""; |
||
98 | local tMsg = ""; |
||
99 | local prevDate = ""; |
||
100 | |||
101 | WIM_HistoryFrameMessageListScrollingMessageFrame:Clear(); |
||
102 | if(WIM_History[WIM_HistoryView_Name_Selected]) then |
||
103 | for i = 1, table.getn(WIM_History[WIM_HistoryView_Name_Selected]) do |
||
104 | if(WIM_HistoryView_Filter_Selected == "" or WIM_HistoryView_Filter_Selected == WIM_History[WIM_HistoryView_Name_Selected][i].date) then |
||
105 | if(WIM_HistoryView_Filter_Selected == "") then |
||
106 | if(prevDate ~= WIM_History[WIM_HistoryView_Name_Selected][i].date) then |
||
107 | prevDate = WIM_History[WIM_HistoryView_Name_Selected][i].date |
||
108 | WIM_HistoryFrameMessageListScrollingMessageFrame:AddMessage(" "); |
||
109 | WIM_HistoryFrameMessageListScrollingMessageFrame:AddMessage("|cffffffff["..prevDate.."]|r"); |
||
110 | end |
||
111 | end |
||
112 | tStamp = "|cff"..WIM_RGBtoHex(WIM_Data.displayColors.sysMsg.r, WIM_Data.displayColors.sysMsg.g, WIM_Data.displayColors.sysMsg.b)..WIM_History[WIM_HistoryView_Name_Selected][i].time.."|r "; |
||
113 | tFrom = "[|Hplayer:"..WIM_History[WIM_HistoryView_Name_Selected][i].from.."|h"..WIM_GetAlias(WIM_History[WIM_HistoryView_Name_Selected][i].from, true).."|h]: "; |
||
114 | tMsg = tStamp..tFrom..WIM_History[WIM_HistoryView_Name_Selected][i].msg; |
||
115 | if(WIM_History[WIM_HistoryView_Name_Selected][i].type == 1) then |
||
116 | WIM_HistoryFrameMessageListScrollingMessageFrame:AddMessage(tMsg, WIM_Data.displayColors.wispIn.r, WIM_Data.displayColors.wispIn.g, WIM_Data.displayColors.wispIn.b); |
||
117 | elseif(WIM_History[WIM_HistoryView_Name_Selected][i].type == 2) then |
||
118 | WIM_HistoryFrameMessageListScrollingMessageFrame:AddMessage(tMsg, WIM_Data.displayColors.wispOut.r, WIM_Data.displayColors.wispOut.g, WIM_Data.displayColors.wispOut.b); |
||
119 | end |
||
120 | end |
||
121 | end |
||
122 | end |
||
123 | WIM_UpdateScrollBars(WIM_HistoryFrameMessageListScrollingMessageFrame); |
||
124 | end |