-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathAtlasOptions.lua
156 lines (130 loc) · 4.42 KB
/
AtlasOptions.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
--[[
Atlas, a World of Warcraft instance map browser
Email me at [email protected]
This file is part of Atlas.
Atlas is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Atlas is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Atlas; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--]]
function AtlasOptions_Toggle()
if(AtlasOptionsFrame:IsVisible()) then
AtlasOptionsFrame:Hide();
else
AtlasOptionsFrame:Show();
end
end
function AtlasOptions_AutoSelectToggle()
if(AtlasOptions.AtlasAutoSelect) then
AtlasOptions.AtlasAutoSelect = false;
else
AtlasOptions.AtlasAutoSelect = true;
end
AtlasOptions_Init();
end
function AtlasOptions_RightClickToggle()
if(AtlasOptions.AtlasRightClick) then
AtlasOptions.AtlasRightClick = false;
else
AtlasOptions.AtlasRightClick = true;
end
AtlasOptions_Init();
end
function AtlasOptions_AcronymsToggle()
if(AtlasOptions.AtlasAcronyms) then
AtlasOptions.AtlasAcronyms = false;
else
AtlasOptions.AtlasAcronyms = true;
end
AtlasOptions_Init();
Atlas_Refresh();
end
function AtlasOptions_ClampedToggle()
if(AtlasOptions.AtlasClamped) then
AtlasOptions.AtlasClamped = false;
else
AtlasOptions.AtlasClamped = true;
end
AtlasFrame:SetClampedToScreen(AtlasOptions.AtlasClamped);
AtlasOptions_Init();
Atlas_Refresh();
end
function AtlasOptions_CtrlToggle()
if(AtlasOptions.AtlasCtrl) then
AtlasOptions.AtlasCtrl = false;
else
AtlasOptions.AtlasCtrl = true;
end
AtlasOptions_Init();
Atlas_Refresh();
end
function AtlasOptions_OnLoad()
UIPanelWindows['AtlasOptionsFrame'] = {area = 'center', pushable = 0};
end
function AtlasOptions_Init()
AtlasOptionsFrameToggleButton:SetChecked(AtlasOptions.AtlasButtonShown);
AtlasOptionsFrameAutoSelect:SetChecked(AtlasOptions.AtlasAutoSelect);
AtlasOptionsFrameRightClick:SetChecked(AtlasOptions.AtlasRightClick);
AtlasOptionsFrameAcronyms:SetChecked(AtlasOptions.AtlasAcronyms);
AtlasOptionsFrameClamped:SetChecked(AtlasOptions.AtlasClamped);
AtlasOptionsFrameSliderButtonPos:SetValue(AtlasOptions.AtlasButtonPosition);
AtlasOptionsFrameSliderButtonRad:SetValue(AtlasOptions.AtlasButtonRadius);
AtlasOptionsFrameSliderAlpha:SetValue(AtlasOptions.AtlasAlpha);
AtlasOptionsFrameSliderScale:SetValue(AtlasOptions.AtlasScale);
end
function AtlasOptions_ResetPosition()
AtlasFrame:ClearAllPoints();
AtlasFrame:SetPoint("TOPLEFT", 0, -104);
AtlasOptions.AtlasButtonPosition = 336;
AtlasOptions.AtlasButtonRadius = 78;
AtlasOptions.AtlasAlpha = 1.0;
AtlasOptions.AtlasScale = 1.0;
AtlasOptions_Init();
end
function AtlasOptions_SetupSlider(text, mymin, mymax, step)
getglobal(this:GetName().."Text"):SetText(text.." ("..this:GetValue()..")");
this:SetMinMaxValues(mymin, mymax);
getglobal(this:GetName().."Low"):SetText(mymin);
getglobal(this:GetName().."High"):SetText(mymax);
this:SetValueStep(step);
end
local function round(num, idp)
local mult = 10 ^ (idp or 0);
return math.floor(num * mult + 0.5) / mult;
end
function AtlasOptions_UpdateSlider(text)
getglobal(this:GetName().."Text"):SetText(text.." ("..round(this:GetValue(),2)..")");
end
function AtlasOptionsFrameDropDownCats_Initialize()
local i;
for i = 1, getn(Atlas_DropDownLayouts_Order), 1 do
info = {
text = Atlas_DropDownLayouts_Order[i];
func = AtlasOptionsFrameDropDownCats_OnClick;
};
UIDropDownMenu_AddButton(info);
end
end
function AtlasOptionsFrameDropDownCats_OnShow()
UIDropDownMenu_Initialize(AtlasOptionsFrameDropDownCats, AtlasOptionsFrameDropDownCats_Initialize);
UIDropDownMenu_SetSelectedID(AtlasOptionsFrameDropDownCats, AtlasOptions.AtlasSortBy);
UIDropDownMenu_SetWidth(100, AtlasOptionsFrameDropDownCats);
end
function AtlasOptionsFrameDropDownCats_OnClick()
local thisID = this:GetID();
UIDropDownMenu_SetSelectedID(AtlasOptionsFrameDropDownCats, thisID);
AtlasOptions.AtlasSortBy = thisID;
AtlasOptions.AtlasZone = 1;
AtlasOptions.AtlasType = 1;
Atlas_PopulateDropdowns();
Atlas_Refresh();
AtlasFrameDropDownType_OnShow();
AtlasFrameDropDown_OnShow();
end