vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --[[ |
2 | Guild Event Manager by Kiki of European Cho'gall (Alliance) |
||
3 | Main GUI - By Alexandre Flament & Kiki |
||
4 | ]] |
||
5 | |||
6 | local firstShow = true; |
||
7 | |||
8 | function GEMMain_SelectTab(tab) |
||
9 | PanelTemplates_SetTab(GEMMainFrame, tab); |
||
10 | local TabFrames = { |
||
11 | [1] = "GEMListFrame", |
||
12 | [2] = "GEMNewFrame", |
||
13 | [3] = "GEMPlayersFrame", |
||
14 | [4] = "GEMOptionsFrame", |
||
15 | [5] = "GEMDebugFrame", |
||
16 | }; |
||
17 | for id, name in TabFrames do |
||
18 | if (id == tab) then |
||
19 | getglobal(name):Show(); |
||
20 | else |
||
21 | getglobal(name):Hide(); |
||
22 | end |
||
23 | end |
||
24 | end |
||
25 | |||
26 | function GEMMain_OnMouseUp() |
||
27 | if ( GEMMainFrame.isMoving ) then |
||
28 | GEMMainFrame:StopMovingOrSizing(); |
||
29 | GEMMainFrame.isMoving = false; |
||
30 | end |
||
31 | end |
||
32 | |||
33 | function GEMMain_OnMouseDown(button) |
||
34 | if ( ( ( not GEMMainFrame.isLocked ) or ( GEMMainFrame.isLocked == 0 ) ) and ( arg1 == "LeftButton" ) ) then |
||
35 | GEMMainFrame:StartMoving(); |
||
36 | GEMMainFrame.isMoving = true; |
||
37 | end |
||
38 | end |
||
39 | |||
40 | function GEMMain_OnHide() |
||
41 | if ( GEMMainFrame.isMoving ) then |
||
42 | GEMMainFrame:StopMovingOrSizing(); |
||
43 | GEMMainFrame.isMoving = false; |
||
44 | end |
||
45 | end |
||
46 | |||
47 | function GEMMain_OnShow() |
||
48 | if (firstShow) then |
||
49 | GEMMain_SelectTab(1); |
||
50 | firstShow = false; |
||
51 | end; |
||
52 | if(GEM_OldVersion) |
||
53 | then |
||
54 | GEMMainFrameTitle:SetText(GEM_TITLE.." v"..GEM_VERSION..GEM_TEXT_OBSOLETE); |
||
55 | elseif(GEM_NewMinorVersion) |
||
56 | then |
||
57 | GEMMainFrameTitle:SetText(GEM_TITLE.." v"..GEM_VERSION..GEM_TEXT_NEW_MINOR); |
||
58 | else |
||
59 | GEMMainFrameTitle:SetText(GEM_TITLE.." v"..GEM_VERSION); |
||
60 | end |
||
61 | end |
||
62 | |||
63 | function GEMMain_OnLoad() |
||
64 | tinsert(UISpecialFrames,"GEMMainFrame"); |
||
65 | |||
66 | PanelTemplates_SetNumTabs(GEMMainFrame, 4); |
||
67 | PanelTemplates_SetTab(GEMMainFrame, 1); |
||
68 | GEMMinimapButton_Update(); |
||
69 | GEMMinimapButton:Show(); |
||
70 | GEMMinimapButtonText:SetText(""); |
||
71 | GEMMinimapButtonText:SetTextColor(1.0,0.1,0.1); |
||
72 | if ButtonHole then |
||
73 | ButtonHole.application.RegisterMod({id="GEMGUILDEVENTMANAGER", name="Guild Event Manager",tooltip="Easily handle and schedule planned guild events", buttonFrame="GEMMinimapButton", updateFunction="GEMMinimapButton_Update"}); |
||
74 | end |
||
75 | end |
||
76 | |||
77 | function GEM_Toggle(page) |
||
78 | if (GEMMainFrame:IsVisible()) then |
||
79 | GEMMainFrame:Hide(); |
||
80 | else |
||
81 | if(page) |
||
82 | then |
||
83 | firstShow = false; |
||
84 | GEMMain_SelectTab(page); |
||
85 | end |
||
86 | GEMMainFrame:Show(); |
||
87 | end |
||
88 | end |
||
89 | |||
90 | |||
91 | -------- Minimap button ------ |
||
92 | function GEMMinimapButton_Update() |
||
93 | if(GEM_PlayerName) |
||
94 | then |
||
95 | local radius = GEM_Events.MinimapRadiusOffset; |
||
96 | local arc = GEM_Events.MinimapArcOffset; |
||
97 | GEMMinimapButton:SetPoint( "TOPLEFT", "Minimap", "TOPLEFT",55 - ( ( radius ) * cos( arc ) ),( ( radius ) * sin( arc ) ) - 55); |
||
98 | GEMMinimapButtonTexture:SetTexture("Interface\\Icons\\"..GEM_Events.MinimapTexture); |
||
99 | end |
||
100 | end |
||
101 | |||
102 | |||
103 | -------- HELP ------ |
||
104 | function GEM_Help_SetTooltip() |
||
105 | local uiX, uiY = UIParent:GetCenter(); |
||
106 | local thisX, thisY = this:GetCenter(); |
||
107 | |||
108 | local anchor = ""; |
||
109 | if ( thisY > uiY ) then |
||
110 | anchor = "BOTTOM"; |
||
111 | else |
||
112 | anchor = "TOP"; |
||
113 | end |
||
114 | |||
115 | if ( thisX < uiX ) then |
||
116 | if ( anchor == "TOP" ) then |
||
117 | anchor = "TOPLEFT"; |
||
118 | else |
||
119 | anchor = "BOTTOMRIGHT"; |
||
120 | end |
||
121 | else |
||
122 | if ( anchor == "TOP" ) then |
||
123 | anchor = "TOPRIGHT"; |
||
124 | else |
||
125 | anchor = "BOTTOMLEFT"; |
||
126 | end |
||
127 | end |
||
128 | GameTooltip:SetOwner(this, "ANCHOR_" .. anchor); |
||
129 | end |
||
130 | |||
131 | function GEM_Help_LoadText() |
||
132 | local texts = { |
||
133 | GEM_HELP_EVENTS_TAB_EVENTS, |
||
134 | GEM_HELP_PLAYERS_TAB_MEMBERS, |
||
135 | GEM_HELP_NEW_TAB_TEMPLATES, |
||
136 | GEM_HELP_NEW_TAB_SORTING, |
||
137 | GEM_HELP_NEW_TAB_CONFIG, |
||
138 | }; |
||
139 | |||
140 | this.text = texts[this:GetID()]; |
||
141 | end |
||
142 |