vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | local SUBFRAMES = { |
2 | ["FishingLocationsFrame"] = { |
||
3 | ["name"] = FishingBuddy.LOCATIONS_TAB, |
||
4 | ["tooltip"] = FishingBuddy.LOCATIONS_INFO, |
||
5 | ["toggle"] = "_LOC", |
||
6 | ["id"] = "1", |
||
7 | }, |
||
8 | ["FishingOutfitFrame"] = { |
||
9 | ["name"] = FishingBuddy.OUTFITS_TAB, |
||
10 | ["tooltip"] = FishingBuddy.OUTFITS_INFO, |
||
11 | ["toggle"] = "_OUT", |
||
12 | ["id"] = "2", |
||
13 | }, |
||
14 | ["FishingTrackingFrame"] = { |
||
15 | ["name"] = FishingBuddy.TRACKING_TAB, |
||
16 | ["tooltip"] = FishingBuddy.TRACKING_INFO, |
||
17 | ["toggle"] = "_TRK", |
||
18 | ["id"] = "3", |
||
19 | }, |
||
20 | ["FishingOptionsFrame"] = { |
||
21 | ["name"] = FishingBuddy.OPTIONS_TAB, |
||
22 | ["tooltip"] = FishingBuddy.OPTIONS_INFO, |
||
23 | ["toggle"] = "_OPT", |
||
24 | ["id"] = "4", |
||
25 | } |
||
26 | }; |
||
27 | |||
28 | local function DisableSubFrame(frameName) |
||
29 | for value,info in SUBFRAMES do |
||
30 | if ( value == frameName ) then |
||
31 | local id = info.id; |
||
32 | local hideframe = string.format("FishingBuddyFrameTab%d", id); |
||
33 | local f = getglobal(hideframe); |
||
34 | if ( f ) then |
||
35 | f:Hide(); |
||
36 | end |
||
37 | id = id + 1; |
||
38 | f = getglobal("FishingBuddyFrameTab"..id); |
||
39 | if ( f ) then |
||
40 | f:SetPoint("LEFT", hideframe, "LEFT", 0, 0) |
||
41 | end |
||
42 | end |
||
43 | end |
||
44 | end |
||
45 | FishingBuddy.DisableSubFrame = DisableSubFrame; |
||
46 | |||
47 | local function ShowSubFrame(frameName) |
||
48 | for value,_ in SUBFRAMES do |
||
49 | local frame = getglobal(value); |
||
50 | if ( frame ) then |
||
51 | if ( value == frameName ) then |
||
52 | frame:Show() |
||
53 | else |
||
54 | frame:Hide(); |
||
55 | end |
||
56 | end |
||
57 | end |
||
58 | end |
||
59 | |||
60 | function ToggleFishingBuddyFrame(tab) |
||
61 | if ( tab == "FishingOutfitFrame" and not OutfitDisplayFrame_OnLoad and not FishingOutfitFrame:IsVisible() ) then |
||
62 | return; |
||
63 | end |
||
64 | local subFrame = getglobal(tab); |
||
65 | if ( subFrame ) then |
||
66 | local id = subFrame:GetID(); |
||
67 | PanelTemplates_SetTab(FishingBuddyFrame, id); |
||
68 | if ( FishingBuddyFrame:IsVisible() ) then |
||
69 | if ( subFrame:IsVisible() ) then |
||
70 | HideUIPanel(FishingBuddyFrame); |
||
71 | else |
||
72 | ShowSubFrame(tab); |
||
73 | end |
||
74 | else |
||
75 | ShowUIPanel(FishingBuddyFrame); |
||
76 | ShowSubFrame(tab); |
||
77 | end |
||
78 | end |
||
79 | end |
||
80 | |||
81 | local TABFRAMES = {}; |
||
82 | function FishingBuddyFrameTab_OnClick() |
||
83 | ToggleFishingBuddyFrame(TABFRAMES[this:GetName()]); |
||
84 | PlaySound("igCharacterInfoTab"); |
||
85 | end |
||
86 | |||
87 | function FishingBuddyFrame_OnLoad() |
||
88 | -- Act like Blizzard windows |
||
89 | UIPanelWindows["FishingBuddyFrame"] = { area = "left", pushable = 999 }; |
||
90 | -- Close with escape key |
||
91 | tinsert(UISpecialFrames, "FishingBuddyFrame"); |
||
92 | |||
93 | -- Tab Handling code |
||
94 | PanelTemplates_SetNumTabs(this, 4); |
||
95 | PanelTemplates_SetTab(this, 1); |
||
96 | |||
97 | this:RegisterEvent("VARIABLES_LOADED"); |
||
98 | end |
||
99 | |||
100 | function FishingBuddyFrame_OnEvent(event) |
||
101 | if ( event == "VARIABLES_LOADED" ) then |
||
102 | -- set up mappings |
||
103 | for frame,info in SUBFRAMES do |
||
104 | local f = getglobal(frame); |
||
105 | if ( f ) then |
||
106 | f:SetID(info.id); |
||
107 | |||
108 | local tabname = "FishingBuddyFrameTab"..info.id; |
||
109 | TABFRAMES[tabname] = frame; |
||
110 | local tab = getglobal(tabname); |
||
111 | tab:SetText(info.name); |
||
112 | tab.tooltip = info.tooltip; |
||
113 | tab.toggle = "TOGGLEFISHINGBUDDY"..info.toggle; |
||
114 | else |
||
115 | DisableSubFrame(frame); |
||
116 | end |
||
117 | end |
||
118 | ToggleFishingBuddyFrame("FishingLocationsFrame"); |
||
119 | end |
||
120 | end |
||
121 | |||
122 | function FishingBuddyFrame_OnShow() |
||
123 | FishingBuddyFramePortrait:SetTexture("Interface\\LootFrame\\FishingLoot-Icon"); |
||
124 | FishingBuddyNameText:SetText(FishingBuddy.WINDOW_TITLE); |
||
125 | UpdateMicroButtons(); |
||
126 | end |
||
127 | |||
128 | function FishingBuddyFrame_OnHide() |
||
129 | UpdateMicroButtons(); |
||
130 | end |