WoWInterface SVN PocketPlot

[/] [trunk/] [PocketPlot/] [pocketplot_options.lua] - Blame information for rev 86

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 84 Seerah-39096
local _, PocketPlot = ...
2 Seerah-39096
local widgetLists = AceGUIWidgetLSMlists
3 Seerah-39096
local fonts = widgetLists.font
4 Seerah-39096
local oldSetPoint = {}
5 Seerah-39096
local mover, moverText, movershown, db
6 Seerah-39096
 
7 Seerah-39096
local frames = {        "None",         --frames supported by mover
8 Seerah-39096
                                        "Minimap",
9 Seerah-39096
                                        "DurabilityFrame",
10 Seerah-39096
                                        "VehicleSeatIndicator",
11 Seerah-39096
                                        "MiniMapInstanceDifficulty",
12 Seerah-39096
                                        "GuildInstanceDifficulty",
13 Seerah-39096
                                        "MiniMapChallengeMode",
14 Seerah-39096
                                        "GarrisonLandingPageMinimapButton",
15 Seerah-39096
                                }
16 Seerah-39096
local stratae = {"BACKGROUND", "LOW", "MEDIUM", "HIGH", "DIALOG"}
17 Seerah-39096
local allshapes = {     "3-Corner BL",
18 Seerah-39096
                                        "3-Corner BR",
19 Seerah-39096
                                        "3-Corner TL",
20 Seerah-39096
                                        "3-Corner TR",
21 Seerah-39096
                                        "Circle",
22 Seerah-39096
                                        "Compass",
23 86 Seerah-39096
                                        "Faded Circle",
24 Seerah-39096
                                        "Faded Edges",
25 Seerah-39096
                                        "Faded Square",
26 84 Seerah-39096
                                        "Fancy Frame",
27 Seerah-39096
                                        "Flower",
28 Seerah-39096
                                        "Half Round B",
29 Seerah-39096
                                        "Half Round L",
30 Seerah-39096
                                        "Half Round R",
31 Seerah-39096
                                        "Half Round T",
32 Seerah-39096
                                        "Rectangle",
33 Seerah-39096
                                        "Rounded",
34 Seerah-39096
                                        "Scalloped",
35 Seerah-39096
                                        "Slanted 1",
36 Seerah-39096
                                        "Slanted 2",
37 Seerah-39096
                                        "Square",
38 Seerah-39096
                                        "Teardrop BL",
39 Seerah-39096
                                        "Teardrop BR",
40 Seerah-39096
                                        "Teardrop TL",
41 Seerah-39096
                                        "Teardrop TR",
42 Seerah-39096
                                        "Torn",
43 Seerah-39096
                                        "Zigzag Round",
44 Seerah-39096
                                        "Zigzag Square"
45 Seerah-39096
                                }
46 Seerah-39096
PocketPlot.minimapButtonPaths = {               --the GetMinimapShape standards are TOTALLY named wrong! >.<
47 Seerah-39096
                ["3-Corner BL"] = "CORNER-TOPRIGHT",
48 Seerah-39096
                ["3-Corner BR"] = "CORNER-TOPLEFT",
49 Seerah-39096
                ["3-Corner TL"] = "CORNER-BOTTOMRIGHT",
50 Seerah-39096
                ["3-Corner TR"] = "CORNER-BOTTOMLEFT",
51 86 Seerah-39096
                ["Faded Circle"] = "CIRCLE",
52 Seerah-39096
                ["Faded Edges"] = "SQUARE",
53 Seerah-39096
                ["Faded Square"] = "SQUARE",
54 84 Seerah-39096
                ["Fancy Frame"] = "SQUARE",
55 Seerah-39096
                ["Half Round B"] = "SIDE-TOP",
56 Seerah-39096
                ["Half Round L"] = "SIDE-RIGHT",
57 Seerah-39096
                ["Half Round R"] = "SIDE-LEFT",
58 Seerah-39096
                ["Half Round T"] = "SIDE-BOTTOM",
59 Seerah-39096
                ["Rectangle"] = "SQUARE",
60 Seerah-39096
                ["Rounded"] = "SQUARE",
61 Seerah-39096
                ["Scalloped"] = "SQUARE",
62 Seerah-39096
                ["Slanted 1"] = "SQUARE",
63 Seerah-39096
                ["Slanted 2"] = "SQUARE",
64 Seerah-39096
                ["Square"] = "SQUARE",
65 Seerah-39096
                ["Torn"] = "SQUARE",
66 Seerah-39096
                ["Zigzag Square"] = "SQUARE",
67 Seerah-39096
                ["Circle"] = "ROUND",
68 Seerah-39096
                ["Compass"] = "ROUND",
69 Seerah-39096
                ["Flower"] = "ROUND",
70 Seerah-39096
                ["Teardrop BL"] = "TRICORNER-TOPRIGHT",
71 Seerah-39096
                ["Teardrop BR"] = "TRICORNER-TOPLEFT",
72 Seerah-39096
                ["Teardrop TL"] = "TRICORNER-BOTTOMRIGHT",
73 Seerah-39096
                ["Teardrop TR"] = "TRICORNER-BOTTOMLEFT",
74 Seerah-39096
                ["Zigzag Round"] = "ROUND",
75 Seerah-39096
        }
76 Seerah-39096
local minimapButtonPaths = PocketPlot.minimapButtonPaths
77 86 Seerah-39096
local fontFlags = {"None", "Outline", "Monochrome Outline", "Monochrome"}
78 84 Seerah-39096
 
79 Seerah-39096
local defaults = {
80 Seerah-39096
        shape = "Square",
81 Seerah-39096
        lsmfont = "Negotiate Free",
82 Seerah-39096
        fontFlag = "Outline",
83 Seerah-39096
        zoneText = true,
84 Seerah-39096
        zoneSize = 14,
85 Seerah-39096
        clockSize = 16,
86 Seerah-39096
        scale = 1,
87 Seerah-39096
        mapPos = {x = -10, y = -10},
88 Seerah-39096
        bg = {r = 0, g = 0, b = 0},
89 Seerah-39096
        mmAlpha = 1,
90 Seerah-39096
        combatHide = false,
91 Seerah-39096
        alpha = 1,
92 Seerah-39096
        top = false,
93 Seerah-39096
        coords = true,
94 Seerah-39096
        clock = true,
95 Seerah-39096
        coordSize = 16,
96 Seerah-39096
        classbg = false,
97 Seerah-39096
        classfont = false,
98 Seerah-39096
        textOffset = 0,
99 Seerah-39096
        zoneTextOffset = 0,
100 Seerah-39096
        insets = 4,
101 Seerah-39096
        strata = "BACKGROUND",
102 Seerah-39096
        level = 2,
103 86 Seerah-39096
        hideNorth = true,
104 84 Seerah-39096
}
105 Seerah-39096
 
106 Seerah-39096
local function SetPosition(frame)
107 85 Seerah-39096
        local f = _G[frame]
108 84 Seerah-39096
        if mover and mover:IsShown() then
109 Seerah-39096
                local r,_,a,x,y = mover:GetPoint()
110 86 Seerah-39096
                db[frame] = {["r"]=r,
111 85 Seerah-39096
                        ["a"]=a,["x"]=x,["y"]=y}
112 84 Seerah-39096
        end
113 85 Seerah-39096
        local fdata = db[frame]
114 84 Seerah-39096
        f:ClearAllPoints()
115 85 Seerah-39096
        f:SetPoint(fdata.r, UIParent, fdata.a, fdata.x, fdata.y)
116 Seerah-39096
        if not oldSetPoint[frame] then  --prehook
117 Seerah-39096
                oldSetPoint[frame] = f.SetPoint
118 84 Seerah-39096
                f.SetPoint = function(self, a,b,c,d,e, ...)
119 85 Seerah-39096
                        local a,b,c,d,e = db[frame].r, UIParent, db[frame].a, db[frame].x, db[frame].y
120 Seerah-39096
                        return oldSetPoint[frame](self, a,b,c,d,e, ...)
121 84 Seerah-39096
                end
122 Seerah-39096
        end
123 Seerah-39096
end
124 Seerah-39096
 
125 Seerah-39096
local function MoveFrames(frame)
126 Seerah-39096
        if not mover then
127 Seerah-39096
                mover = CreateFrame("Frame", nil, UIParent)
128 Seerah-39096
                mover:SetBackdrop({bgFile ="Interface\\Buttons\\WHITE8x8",})
129 Seerah-39096
                mover:SetBackdropColor(.2,.2,.9,.6)
130 Seerah-39096
                mover:SetMovable(1)
131 Seerah-39096
                mover:SetFrameStrata("HIGH")
132 Seerah-39096
                mover:Hide()
133 Seerah-39096
                moverText = mover:CreateFontString(nil, "OVERLAY")
134 Seerah-39096
                moverText:SetFont("Fonts\\ARIALN.ttf", 15, "OUTLINE")
135 Seerah-39096
                moverText:SetParent(mover)
136 Seerah-39096
                moverText:SetPoint("CENTER")
137 Seerah-39096
                mover:SetScript("OnMouseDown", function() mover:StartMoving() end)
138 86 Seerah-39096
                mover:SetScript("OnMouseUp", function() mover:StopMovingOrSizing() SetPosition(movershown) end)
139 84 Seerah-39096
        end
140 Seerah-39096
        if frame == "None" then
141 Seerah-39096
                mover:SetScale(1)
142 Seerah-39096
                mover:Hide()
143 Seerah-39096
                mover:EnableMouse(false)
144 Seerah-39096
                return
145 Seerah-39096
        else
146 Seerah-39096
                mover:Show()
147 Seerah-39096
                moverText:SetText(frame)
148 Seerah-39096
                mover:EnableMouse(true)
149 Seerah-39096
                mover:SetScale(_G[frame]:GetScale())
150 Seerah-39096
                mover:ClearAllPoints()
151 Seerah-39096
                mover:SetAllPoints(frame)
152 Seerah-39096
        end
153 Seerah-39096
end
154 Seerah-39096
 
155 Seerah-39096
local function NudgeMover(xy, offset)
156 Seerah-39096
        local framePos = db[movershown]
157 Seerah-39096
        local frame = _G[movershown]
158 Seerah-39096
        if not framePos then
159 Seerah-39096
                SetPosition(movershown)
160 Seerah-39096
        end
161 Seerah-39096
        framePos[xy] = framePos[xy] + offset
162 Seerah-39096
        frame:ClearAllPoints()
163 Seerah-39096
        frame:SetPoint(framePos.r, framePos.p, framePos.a, framePos.x, framePos.y)
164 Seerah-39096
        mover:ClearAllPoints()
165 Seerah-39096
        mover:SetAllPoints(frame)
166 Seerah-39096
end
167 Seerah-39096
 
168 Seerah-39096
 
169 Seerah-39096
local options = {
170 Seerah-39096
        name = "PocketPlot Options",
171 Seerah-39096
        type = "group",
172 Seerah-39096
        args = {
173 Seerah-39096
                general = {
174 Seerah-39096
                        name = "General",
175 Seerah-39096
                        type = "group",
176 Seerah-39096
                        args = {
177 Seerah-39096
                                hint = {
178 Seerah-39096
                                        name = "Hint: right-click the minimap to open the calendar. Shift-right-click will open the tracking menu.",
179 Seerah-39096
                                        type = "description",
180 Seerah-39096
                                        order = 1,
181 Seerah-39096
                                },
182 Seerah-39096
                                spacer = {
183 Seerah-39096
                                        name = "",
184 Seerah-39096
                                        type = "description",
185 Seerah-39096
                                        order = 2,
186 Seerah-39096
                                },
187 Seerah-39096
                                header0 = {
188 Seerah-39096
                                        name = "",
189 Seerah-39096
                                        type = "header",
190 Seerah-39096
                                        order = 3,
191 Seerah-39096
                                },
192 Seerah-39096
                                shape = {
193 Seerah-39096
                                        name = "Minimap Shape",
194 Seerah-39096
                                        desc = "Set the shape of the minimap.",
195 Seerah-39096
                                        type = "select",
196 Seerah-39096
                                        values = allshapes,
197 Seerah-39096
                                        get = function()
198 Seerah-39096
                                                                for k, v in pairs(allshapes) do
199 Seerah-39096
                                                                        if db.shape == v then
200 Seerah-39096
                                                                                return k
201 Seerah-39096
                                                                        end
202 Seerah-39096
                                                                end
203 Seerah-39096
                                                        end,
204 Seerah-39096
                                        set = function(_,key)
205 Seerah-39096
                                                                db.shape = allshapes[key]
206 Seerah-39096
                                                                PocketPlot.SetShape()
207 Seerah-39096
                                                                PocketPlot.ClassColors()
208 Seerah-39096
                                                        end,
209 Seerah-39096
                                        order = 4,
210 Seerah-39096
                                },
211 Seerah-39096
                                scale = {
212 Seerah-39096
                                        name = "Minimap Scale",
213 Seerah-39096
                                        desc = "Set the scale of the minimap.",
214 Seerah-39096
                                        type = "range",
215 Seerah-39096
                                        min = .25,
216 Seerah-39096
                                        max = 2,
217 Seerah-39096
                                        step = .05,
218 Seerah-39096
                                        get = function() return db.scale end,
219 Seerah-39096
                                        set = function(_,value)
220 Seerah-39096
                                                                db.scale = value
221 Seerah-39096
                                                                Minimap:SetScale(value)
222 Seerah-39096
                                                        end,
223 Seerah-39096
                                        order = 5,
224 Seerah-39096
                                },
225 Seerah-39096
                                combatHide = {
226 Seerah-39096
                                        name = "Hide in Combat",
227 Seerah-39096
                                        desc = "Hide the minimap when in combat.",
228 Seerah-39096
                                        type = "toggle",
229 Seerah-39096
                                        get = function() return db.combatHide end,
230 Seerah-39096
                                        set = function()
231 Seerah-39096
                                                                db.combatHide = not db.combatHide
232 Seerah-39096
                                                                PocketPlot.CombatHide()
233 Seerah-39096
                                                        end,
234 Seerah-39096
                                        order = 6,
235 Seerah-39096
                                },
236 Seerah-39096
                                strata = {
237 Seerah-39096
                                        name = "Minimap Strata",
238 Seerah-39096
                                        desc = "Set the strata of the minimap and how it layers with other elements in your interface.",
239 Seerah-39096
                                        type = "select",
240 Seerah-39096
                                        values = stratae,
241 Seerah-39096
                                        get = function()
242 Seerah-39096
                                                                for k, v in pairs(stratae) do
243 Seerah-39096
                                                                        if db.strata == v then
244 Seerah-39096
                                                                                return k
245 Seerah-39096
                                                                        end
246 Seerah-39096
                                                                end
247 Seerah-39096
                                                        end,
248 Seerah-39096
                                        set = function(_,key)
249 Seerah-39096
                                                                db.strata = stratae[key]
250 Seerah-39096
                                                                Minimap:SetFrameStrata(db.strata)
251 Seerah-39096
                                                        end,
252 Seerah-39096
                                        order = 7,
253 Seerah-39096
                                },
254 Seerah-39096
                                level = {
255 Seerah-39096
                                        name = "Strata Level",
256 Seerah-39096
                                        desc = "Nudge the minimap up and down different levels on its frame strata.",
257 Seerah-39096
                                        type = "range",
258 Seerah-39096
                                        min = 1,
259 Seerah-39096
                                        max = 10,
260 Seerah-39096
                                        step = 1,
261 Seerah-39096
                                        get = function() return db.level end,
262 Seerah-39096
                                        set = function(_,value)
263 Seerah-39096
                                                                db.level = value
264 Seerah-39096
                                                                Minimap:SetFrameLevel(db.level)
265 Seerah-39096
                                                        end,
266 Seerah-39096
                                        order = 8,
267 Seerah-39096
                                },
268 Seerah-39096
                                battleHide = {
269 Seerah-39096
                                        name = "Hide in Pet Battle",
270 Seerah-39096
                                        desc = "Hide the minimap during pet battles.",
271 Seerah-39096
                                        type = "toggle",
272 Seerah-39096
                                        get = function() return db.battleHide end,
273 Seerah-39096
                                        set = function()
274 Seerah-39096
                                                                db.battleHide = not db.battleHide
275 Seerah-39096
                                                                PocketPlot.PetBattleHide()
276 Seerah-39096
                                                        end,
277 Seerah-39096
                                        order = 9,
278 Seerah-39096
                                },
279 Seerah-39096
                                mmAlpha = {
280 Seerah-39096
                                        name = "Outdoors Alpha",
281 Seerah-39096
                                        desc = "Set the transparency of the minimap when outdoors. Does not take effect when indoors (prevents indoors map from displaying).",
282 Seerah-39096
                                        type = "range",
283 Seerah-39096
                                        min = 0.05,
284 Seerah-39096
                                        max = 1,
285 Seerah-39096
                                        step = .05,
286 Seerah-39096
                                        get = function() return db.mmAlpha end,
287 Seerah-39096
                                        set = function(_,value)
288 Seerah-39096
                                                                db.mmAlpha = value
289 Seerah-39096
                                                                PocketPlot.MinimapFade()
290 Seerah-39096
                                                        end,
291 Seerah-39096
                                        order = 10,
292 Seerah-39096
                                },
293 Seerah-39096
                        },
294 Seerah-39096
                },
295 Seerah-39096
                border = {
296 Seerah-39096
                        name = "Border",
297 Seerah-39096
                        type = "group",
298 Seerah-39096
                        args = {
299 Seerah-39096
                                header1 = {
300 Seerah-39096
                                        name = "",
301 Seerah-39096
                                        type = "header",
302 Seerah-39096
                                        order = 1,
303 Seerah-39096
                                },
304 Seerah-39096
                                border = {
305 Seerah-39096
                                        name = "Border Color",
306 Seerah-39096
                                        desc = "Select a color for the minimap's border.",
307 Seerah-39096
                                        type = "color",
308 Seerah-39096
                                        disabled = function() return db.classbg end,
309 Seerah-39096
                                        get = function() return db.bg.r, db.bg.g, db.bg.b end,
310 Seerah-39096
                                        set = function(_,r,g,b)
311 Seerah-39096
                                                                db.bg.r, db.bg.g, db.bg.b = r,g,b
312 Seerah-39096
                                                                PocketPlot.ClassColors()
313 Seerah-39096
                                                        end,
314 Seerah-39096
                                        order = 2,
315 Seerah-39096
                                },
316 Seerah-39096
                                insets = {
317 Seerah-39096
                                        name = "Border size",
318 Seerah-39096
                                        desc = "Set the width of the border around the minimap.",
319 Seerah-39096
                                        type = "range",
320 Seerah-39096
                                        min = .5,
321 Seerah-39096
                                        max = 10,
322 Seerah-39096
                                        step = .5,
323 Seerah-39096
                                        get = function() return db.insets end,
324 Seerah-39096
                                        set = function(_,value)
325 Seerah-39096
                                                                db.insets = value
326 Seerah-39096
                                                                local dims = Minimap:GetWidth()
327 Seerah-39096
                                                                PocketPlot.bg:SetHeight(dims + value)
328 Seerah-39096
                                                                PocketPlot.bg:SetWidth(dims + value)
329 Seerah-39096
                                                        end,
330 Seerah-39096
                                        order = 3,
331 Seerah-39096
                                },
332 Seerah-39096
                                alpha = {
333 Seerah-39096
                                        name = "Border Alpha",
334 Seerah-39096
                                        desc = "Set the alpha for the minimap border.",
335 Seerah-39096
                                        type = "range",
336 Seerah-39096
                                        min = 0,
337 Seerah-39096
                                        max = 1,
338 Seerah-39096
                                        step = .05,
339 Seerah-39096
                                        get = function() return db.alpha end,
340 Seerah-39096
                                        set = function(_,alpha)
341 Seerah-39096
                                                                db.alpha = alpha
342 Seerah-39096
                                                                PocketPlot.ClassColors()
343 Seerah-39096
                                                        end,
344 Seerah-39096
                                        order = 4,
345 Seerah-39096
                                },
346 Seerah-39096
                                classbg = {
347 Seerah-39096
                                        name = "Class colored border",
348 Seerah-39096
                                        desc = "Color the minimap border by your class.",
349 Seerah-39096
                                        type = "toggle",
350 Seerah-39096
                                        get = function() return db.classbg end,
351 Seerah-39096
                                        set = function()
352 Seerah-39096
                                                                db.classbg = not db.classbg
353 Seerah-39096
                                                                PocketPlot.ClassColors()
354 Seerah-39096
                                                        end,
355 Seerah-39096
                                        order = 5,
356 Seerah-39096
                                },
357 86 Seerah-39096
                                hideNorth = {
358 Seerah-39096
                                        name = "Hide North Tag",
359 Seerah-39096
                                        desc = "Hide the North marker on the minimap.\n\nThis will also hide the compass textures when the Rotate Minimap setting is enabled (in the game's Display settings).",
360 Seerah-39096
                                        type = "toggle",
361 Seerah-39096
                                        get = function() return db.hideNorth end,
362 Seerah-39096
                                        set = function()
363 Seerah-39096
                                                                db.hideNorth = not db.hideNorth
364 Seerah-39096
                                                                if db.hideNorth then
365 Seerah-39096
                                                                        MinimapNorthTag:SetAlpha(0)
366 Seerah-39096
                                                                        MinimapCompassTexture:SetAlpha(0)
367 Seerah-39096
                                                                else
368 Seerah-39096
                                                                        MinimapNorthTag:SetAlpha(1)
369 Seerah-39096
                                                                        MinimapCompassTexture:SetAlpha(1)
370 Seerah-39096
                                                                end
371 Seerah-39096
                                                        end,
372 Seerah-39096
                                        order = 6,
373 Seerah-39096
                                }
374 84 Seerah-39096
                        },
375 Seerah-39096
                },
376 Seerah-39096
                text = {
377 Seerah-39096
                        name = "Text",
378 Seerah-39096
                        type = "group",
379 Seerah-39096
                        args = {
380 Seerah-39096
                                header2 = {
381 Seerah-39096
                                        name = "",
382 Seerah-39096
                                        type = "header",
383 Seerah-39096
                                        order = 1,
384 Seerah-39096
                                },
385 Seerah-39096
                                font = {
386 Seerah-39096
                                        name = "Font",
387 Seerah-39096
                                        desc = "Select a font to use.",
388 Seerah-39096
                                        type = "select",
389 Seerah-39096
                                        dialogControl = "LSM30_Font",
390 Seerah-39096
                                        values = fonts,
391 Seerah-39096
                                        get = function()
392 Seerah-39096
                                                                return db.lsmfont
393 Seerah-39096
                                                        end,
394 Seerah-39096
                                        set = function(_,font)
395 Seerah-39096
                                                                db.lsmfont = font
396 Seerah-39096
                                                                PocketPlot.SetFonts()
397 Seerah-39096
                                                        end,
398 Seerah-39096
                                        order = 2,
399 Seerah-39096
                                },
400 Seerah-39096
                                fontFlag = {
401 Seerah-39096
                                        name = "Font Flag",
402 Seerah-39096
                                        desc = "Set how to alter the displayed font.",
403 Seerah-39096
                                        type = "select",
404 Seerah-39096
                                        values = fontFlags,
405 Seerah-39096
                                        get = function()
406 Seerah-39096
                                                                for k, v in pairs(fontFlags) do
407 Seerah-39096
                                                                        if db.fontFlag == v then
408 Seerah-39096
                                                                                return k
409 Seerah-39096
                                                                        end
410 Seerah-39096
                                                                end
411 Seerah-39096
                                                        end,
412 Seerah-39096
                                        set = function(_,key)
413 Seerah-39096
                                                                db.fontFlag = fontFlags[key]
414 Seerah-39096
                                                                PocketPlot.SetFonts()
415 Seerah-39096
                                                        end,
416 Seerah-39096
                                        order = 3,
417 Seerah-39096
                                },
418 Seerah-39096
                                classfont = {
419 Seerah-39096
                                        name = "Class colored text",
420 Seerah-39096
                                        desc = "Color the clock and coordinates by your class.",
421 Seerah-39096
                                        type = "toggle",
422 Seerah-39096
                                        get = function() return db.classfont end,
423 Seerah-39096
                                        set = function()
424 Seerah-39096
                                                                db.classfont = not db.classfont
425 Seerah-39096
                                                                PocketPlot.ClassColors()
426 Seerah-39096
                                                        end,
427 Seerah-39096
                                        order = 4,
428 Seerah-39096
                                },
429 Seerah-39096
                                zonesize = {
430 Seerah-39096
                                        name = "Zone Text Size",
431 Seerah-39096
                                        desc = "Change the font size of the Zone Text.",
432 Seerah-39096
                                        type = "range",
433 Seerah-39096
                                        min = 6,
434 Seerah-39096
                                        max = 24,
435 Seerah-39096
                                        step = 1,
436 Seerah-39096
                                        get = function() return db.zoneSize end,
437 Seerah-39096
                                        set = function(_,size)
438 Seerah-39096
                                                                db.zoneSize = size
439 Seerah-39096
                                                                PocketPlot.SetFonts()
440 Seerah-39096
                                                        end,
441 Seerah-39096
                                        order = 5,
442 Seerah-39096
                                },
443 Seerah-39096
                                clocksize = {
444 Seerah-39096
                                        name = "Clock Text Size",
445 Seerah-39096
                                        desc = "Change the font size of the clock.",
446 Seerah-39096
                                        type = "range",
447 Seerah-39096
                                        min = 6,
448 Seerah-39096
                                        max = 24,
449 Seerah-39096
                                        step = 1,
450 Seerah-39096
                                        get = function() return db.clockSize end,
451 Seerah-39096
                                        set = function(_,size)
452 Seerah-39096
                                                                db.clockSize = size
453 Seerah-39096
                                                                PocketPlot.SetFonts()
454 Seerah-39096
                                                        end,
455 Seerah-39096
                                        order = 6,
456 Seerah-39096
                                },
457 Seerah-39096
                                coordsize = {
458 Seerah-39096
                                        name = "Coords Text Size",
459 Seerah-39096
                                        desc = "Change the font size of the coordinates.",
460 Seerah-39096
                                        type = "range",
461 Seerah-39096
                                        min = 6,
462 Seerah-39096
                                        max = 24,
463 Seerah-39096
                                        step = 1,
464 Seerah-39096
                                        get = function() return db.coordSize end,
465 Seerah-39096
                                        set = function(_,size)
466 Seerah-39096
                                                                db.coordSize = size
467 Seerah-39096
                                                                PocketPlot.SetFonts()
468 Seerah-39096
                                                        end,
469 Seerah-39096
                                        order = 7,
470 Seerah-39096
                                },
471 Seerah-39096
                                coords = {
472 Seerah-39096
                                        name = "Display coords",
473 Seerah-39096
                                        desc = "Toggle showing the coordinates display.",
474 Seerah-39096
                                        type = "toggle",
475 Seerah-39096
                                        get = function() return db.coords end,
476 Seerah-39096
                                        set = function()
477 Seerah-39096
                                                                db.coords = not db.coords
478 Seerah-39096
                                                                if db.coords then
479 Seerah-39096
                                                                        PocketPlot.coordframe:Show()
480 Seerah-39096
                                                                else
481 Seerah-39096
                                                                        PocketPlot.coordframe:Hide()
482 Seerah-39096
                                                                end
483 Seerah-39096
                                                                PocketPlot.CoordPosition()
484 Seerah-39096
                                                        end,
485 Seerah-39096
                                        order = 8,
486 Seerah-39096
                                },
487 Seerah-39096
                                clock = {
488 Seerah-39096
                                        name = "Display clock",
489 Seerah-39096
                                        desc = "Toggle showing the clock.",
490 Seerah-39096
                                        type = "toggle",
491 Seerah-39096
                                        get = function() return db.clock end,
492 Seerah-39096
                                        set = function()
493 Seerah-39096
                                                                db.clock = not db.clock
494 Seerah-39096
                                                                if db.clock then
495 Seerah-39096
                                                                        TimeManagerClockButton:Show()
496 Seerah-39096
                                                                else
497 Seerah-39096
                                                                        TimeManagerClockButton:Hide()
498 Seerah-39096
                                                                end
499 Seerah-39096
                                                                PocketPlot.CoordPosition()
500 Seerah-39096
                                                        end,
501 Seerah-39096
                                        order = 9,
502 Seerah-39096
                                },
503 Seerah-39096
                                zoneText = {
504 Seerah-39096
                                        name = "Display zone text",
505 Seerah-39096
                                        desc = "Toggle showing the zone text.",
506 Seerah-39096
                                        type = "toggle",
507 Seerah-39096
                                        get = function() return db.zoneText end,
508 Seerah-39096
                                        set = function()
509 Seerah-39096
                                                                db.zoneText = not db.zoneText
510 Seerah-39096
                                                                if db.zoneText then
511 Seerah-39096
                                                                        MinimapZoneTextButton:Show()
512 Seerah-39096
                                                                else
513 Seerah-39096
                                                                        MinimapZoneTextButton:Hide()
514 Seerah-39096
                                                                end
515 Seerah-39096
                                                        end,
516 Seerah-39096
                                        order = 10,
517 Seerah-39096
                                },
518 Seerah-39096
                                top = {
519 Seerah-39096
                                        name = "Clock/coords on top",
520 Seerah-39096
                                        desc = "Toggle showing the clock and coordinates above or below the map.",
521 Seerah-39096
                                        type = "toggle",
522 Seerah-39096
                                        get = function() return db.top end,
523 Seerah-39096
                                        set = function()
524 Seerah-39096
                                                                db.top = not db.top
525 Seerah-39096
                                                                PocketPlot.CoordPosition()
526 Seerah-39096
                                                        end,
527 Seerah-39096
                                        order = 11,
528 Seerah-39096
                                },
529 Seerah-39096
                                textOffset = {
530 Seerah-39096
                                        name = "Clock/Coord Offset",
531 Seerah-39096
                                        desc = "Vertical offset for the clock and coordinates.",
532 Seerah-39096
                                        type = "range",
533 Seerah-39096
                                        min = -50,
534 Seerah-39096
                                        max = 50,
535 Seerah-39096
                                        step = 1,
536 Seerah-39096
                                        get = function() return db.textOffset end,
537 Seerah-39096
                                        set = function(_,offset)
538 Seerah-39096
                                                                db.textOffset = offset
539 Seerah-39096
                                                                PocketPlot.CoordPosition()
540 Seerah-39096
                                                        end,
541 Seerah-39096
                                        order = 12,
542 Seerah-39096
                                },
543 Seerah-39096
                                zoneTextOffset = {
544 Seerah-39096
                                        name = "Zone Text Offset",
545 Seerah-39096
                                        desc = "Vertical offset for the zone text.",
546 Seerah-39096
                                        type = "range",
547 Seerah-39096
                                        min = -50,
548 Seerah-39096
                                        max = 50,
549 Seerah-39096
                                        step = 1,
550 Seerah-39096
                                        get = function() return db.zoneTextOffset end,
551 Seerah-39096
                                        set = function(_,offset)
552 Seerah-39096
                                                                db.zoneTextOffset = offset
553 Seerah-39096
                                                                MinimapZoneTextButton:ClearAllPoints()
554 Seerah-39096
                                                                MinimapZoneTextButton:SetPoint("TOP", Minimap, "TOP", 0, -1 + db.zoneTextOffset)
555 Seerah-39096
                                                        end,
556 Seerah-39096
                                        order = 13,
557 Seerah-39096
                                },
558 Seerah-39096
                        },
559 Seerah-39096
                },
560 Seerah-39096
                locations = {
561 Seerah-39096
                        name = "Locations",
562 Seerah-39096
                        type = "group",
563 Seerah-39096
                        args = {
564 Seerah-39096
                                header3 = {
565 Seerah-39096
                                        name = "",
566 Seerah-39096
                                        type = "header",
567 Seerah-39096
                                        order = 1,
568 Seerah-39096
                                },
569 Seerah-39096
                                movers = {
570 Seerah-39096
                                        name = "Enable mover for...",
571 Seerah-39096
                                        desc = "Shows an anchor to move the selected frame.",
572 Seerah-39096
                                        type = "select",
573 Seerah-39096
                                        values = frames,
574 Seerah-39096
                                        get = function()
575 Seerah-39096
                                                                if movershown then
576 Seerah-39096
                                                                        for k,v in pairs(frames) do
577 Seerah-39096
                                                                                if v == movershown then
578 Seerah-39096
                                                                                        return k
579 Seerah-39096
                                                                                end
580 Seerah-39096
                                                                        end
581 Seerah-39096
                                                                else
582 Seerah-39096
                                                                        return 1        --key for "None" in frames table
583 Seerah-39096
                                                                end
584 Seerah-39096
                                                        end,
585 Seerah-39096
                                        set = function(_,frame)
586 Seerah-39096
                                                                movershown = frames[frame]
587 Seerah-39096
                                                                MoveFrames(movershown)
588 Seerah-39096
                                                        end,
589 Seerah-39096
                                        order = 2,
590 Seerah-39096
                                },
591 Seerah-39096
                                reset = {
592 Seerah-39096
                                        name = "Restore Positions",
593 Seerah-39096
                                        desc = "Clicking this will restore all frames to their default positions.\n\n|c00E30016WARNING:|r Your UI will be reloaded in the process!",
594 Seerah-39096
                                        type = "execute",
595 Seerah-39096
                                        confirm = true,
596 Seerah-39096
                                        func = function()
597 Seerah-39096
                                                                for i=1, #frames do
598 Seerah-39096
                                                                        db[frames[i]] = nil
599 Seerah-39096
                                                                end
600 Seerah-39096
                                                                ReloadUI()
601 Seerah-39096
                                                        end,
602 Seerah-39096
                                        order = 3,
603 Seerah-39096
                                },
604 Seerah-39096
                                div3 = {
605 Seerah-39096
                                        name = " ",
606 Seerah-39096
                                        type = "description",
607 Seerah-39096
                                        order = 4,
608 Seerah-39096
                                },
609 Seerah-39096
                                nudgehelp = {
610 Seerah-39096
                                        name = "Nudge the selected mover...",
611 Seerah-39096
                                        type = "description",
612 Seerah-39096
                                        order = 5,
613 Seerah-39096
                                },
614 Seerah-39096
                                nudgeL = {
615 Seerah-39096
                                        name = "Left",
616 Seerah-39096
                                        desc = "Nudge the frame 1px to the left.",
617 Seerah-39096
                                        type = "execute",
618 Seerah-39096
                                        width = "half",
619 Seerah-39096
                                        disabled = function() return movershown == "None" or movershown == nil end,
620 Seerah-39096
                                        func = function()
621 Seerah-39096
                                                                NudgeMover("x", -1)
622 Seerah-39096
                                                        end,
623 Seerah-39096
                                        order = 6,
624 Seerah-39096
                                },
625 Seerah-39096
                                nudgeR = {
626 Seerah-39096
                                        name = "Right",
627 Seerah-39096
                                        desc = "Nudge the frame 1px to the right.",
628 Seerah-39096
                                        type = "execute",
629 Seerah-39096
                                        width = "half",
630 Seerah-39096
                                        disabled = function() return movershown == "None" or movershown == nil end,
631 Seerah-39096
                                        func = function()
632 Seerah-39096
                                                                NudgeMover("x", 1)
633 Seerah-39096
                                                        end,
634 Seerah-39096
                                        order = 7,
635 Seerah-39096
                                },
636 Seerah-39096
                                nudgeU = {
637 Seerah-39096
                                        name = "Up",
638 Seerah-39096
                                        desc = "Nudge the frame 1px towards the top of the screen.",
639 Seerah-39096
                                        type = "execute",
640 Seerah-39096
                                        width = "half",
641 Seerah-39096
                                        disabled = function() return movershown == "None" or movershown == nil end,
642 Seerah-39096
                                        func = function()
643 Seerah-39096
                                                                NudgeMover("y", 1)
644 Seerah-39096
                                                        end,
645 Seerah-39096
                                        order = 8,
646 Seerah-39096
                                },
647 Seerah-39096
                                nudgeD = {
648 Seerah-39096
                                        name = "Down",
649 Seerah-39096
                                        desc = "Nudge the frame 1px towards the bottom of the screen.",
650 Seerah-39096
                                        type = "execute",
651 Seerah-39096
                                        width = "half",
652 Seerah-39096
                                        disabled = function() return movershown == "None" or movershown == nil end,
653 Seerah-39096
                                        func = function()
654 Seerah-39096
                                                                NudgeMover("y", -1)
655 Seerah-39096
                                                        end,
656 Seerah-39096
                                        order = 9,
657 Seerah-39096
                                },
658 Seerah-39096
                        },
659 Seerah-39096
                },
660 Seerah-39096
                profile = {
661 Seerah-39096
                        name = "Profile",
662 Seerah-39096
                        type = "group",
663 Seerah-39096
                        args = {
664 Seerah-39096
                                header4 = {
665 Seerah-39096
                                        name = "",
666 Seerah-39096
                                        type = "header",
667 Seerah-39096
                                        order = 1,
668 Seerah-39096
                                },
669 Seerah-39096
                                charSpec = {
670 Seerah-39096
                                        name = "Character specific settings",
671 Seerah-39096
                                        desc = "Have this character use their own profile.  If checked, any changes made will not affect other characters.\n\n|c00E30016WARNING:|r Your UI will be reloaded in the process!",
672 Seerah-39096
                                        type = "toggle",
673 Seerah-39096
                                        width = "full",
674 Seerah-39096
                                        confirm = true,
675 Seerah-39096
                                        get = function() return PocketPlotPCDB.charSpec end,
676 Seerah-39096
                                        set = function()
677 Seerah-39096
                                                                PocketPlotPCDB.charSpec = not PocketPlotPCDB.charSpec
678 Seerah-39096
                                                                ReloadUI()
679 Seerah-39096
                                                        end,
680 Seerah-39096
                                        order = 2,
681 Seerah-39096
                                },
682 Seerah-39096
                                copyProfile = {
683 Seerah-39096
                                        name = "Copy from Default",
684 Seerah-39096
                                        desc = "Copy all settings from the default, global profile to this character's profile.  This will not effect other characters' specific profiles.\n\n|c00E30016WARNING:|r Your UI will be reloaded in the process!",
685 Seerah-39096
                                        type = "execute",
686 Seerah-39096
                                        confirm = true,
687 Seerah-39096
                                        disabled = function() return not PocketPlotPCDB.charSpec end,
688 Seerah-39096
                                        func = function()
689 Seerah-39096
                                                                PocketPlotPCDB = PocketPlotDB
690 Seerah-39096
                                                                PocketPlotPCDB.charSpec = true
691 Seerah-39096
                                                                ReloadUI()
692 Seerah-39096
                                                        end,
693 Seerah-39096
                                        order = 3,
694 Seerah-39096
                                },
695 Seerah-39096
                                resetProfile = {
696 Seerah-39096
                                        name = "Profile Reset",
697 Seerah-39096
                                        desc = "Reset this profile back to the out-of-the-box settings.  If you reset the character specific profile, the global profile will be untouched, and vice versa.  This will not effect other character specific profiles.\n\n|c00E30016WARNING:|r Your UI will be reloaded in the process!",
698 Seerah-39096
                                        type = "execute",
699 Seerah-39096
                                        confirm = true,
700 Seerah-39096
                                        func = function()
701 Seerah-39096
                                                                if PocketPlotPCDB.charSpec then
702 Seerah-39096
                                                                        PocketPlotPCDB = {charSpec = true}
703 Seerah-39096
                                                                else
704 Seerah-39096
                                                                        PocketPlotDB = {}
705 Seerah-39096
                                                                end
706 Seerah-39096
                                                                ReloadUI()
707 Seerah-39096
                                                        end,
708 Seerah-39096
                                        order = 4,
709 Seerah-39096
                                },
710 Seerah-39096
                        },
711 Seerah-39096
                },
712 Seerah-39096
        },
713 Seerah-39096
}
714 Seerah-39096
 
715 Seerah-39096
local function SetUpDB()
716 Seerah-39096
        if PocketPlotPCDB.charSpec then
717 Seerah-39096
                --set defaults if new charSpec DB
718 Seerah-39096
                for k,v in pairs(defaults) do
719 Seerah-39096
                        if type(PocketPlotPCDB[k]) == "nil" then
720 Seerah-39096
                                PocketPlotPCDB[k] = v
721 Seerah-39096
                        end
722 Seerah-39096
                end
723 Seerah-39096
                db = PocketPlotPCDB
724 Seerah-39096
        else
725 Seerah-39096
                db = PocketPlotDB
726 Seerah-39096
        end
727 Seerah-39096
        PocketPlot.db = db
728 Seerah-39096
end
729 Seerah-39096
 
730 Seerah-39096
local function OnLoad()
731 Seerah-39096
        PocketPlotDB = PocketPlotDB or {}
732 Seerah-39096
        PocketPlotPCDB = PocketPlotPCDB or {}
733 Seerah-39096
                if PocketPlotPCDB.charSpec == nil then
734 Seerah-39096
                        PocketPlotPCDB.charSpec = false
735 Seerah-39096
                end
736 Seerah-39096
        for k,v in pairs(defaults) do
737 Seerah-39096
            if type(PocketPlotDB[k]) == "nil" then
738 Seerah-39096
                PocketPlotDB[k] = v
739 Seerah-39096
            end
740 Seerah-39096
        end
741 Seerah-39096
        SetUpDB()
742 Seerah-39096
 
743 Seerah-39096
        LibStub("AceConfig-3.0"):RegisterOptionsTable("PocketPlot", options)
744 Seerah-39096
        PocketPlot.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("PocketPlot", "PocketPlot", nil, "general")
745 Seerah-39096
        PocketPlot.optionsFrame.border = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("PocketPlot", "Border", "PocketPlot", "border")
746 Seerah-39096
        PocketPlot.optionsFrame.text = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("PocketPlot", "Text", "PocketPlot", "text")
747 Seerah-39096
        PocketPlot.optionsFrame.locations = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("PocketPlot", "Locations", "PocketPlot", "locations")
748 Seerah-39096
        PocketPlot.optionsFrame.profile = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("PocketPlot", "Profile", "PocketPlot", "profile")
749 Seerah-39096
 
750 Seerah-39096
        SlashCmdList["POCKETPLOT"] = function()
751 Seerah-39096
                InterfaceOptionsFrame_OpenToCategory("PocketPlot")
752 Seerah-39096
                InterfaceOptionsFrame_OpenToCategory("PocketPlot")
753 Seerah-39096
        end
754 Seerah-39096
        SLASH_POCKETPLOT1 = "/pocketplot"
755 Seerah-39096
        SLASH_POCKETPLOT2 = "/pp"
756 Seerah-39096
 
757 Seerah-39096
        --restore moved frame positions--
758 Seerah-39096
        for i=1, #frames do
759 Seerah-39096
                if db[frames[i]] then
760 Seerah-39096
                        SetPosition(frames[i])
761 Seerah-39096
                end
762 Seerah-39096
        end
763 Seerah-39096
 
764 Seerah-39096
        OnLoad = nil
765 Seerah-39096
        SetUpDB = nil
766 Seerah-39096
end
767 Seerah-39096
 
768 Seerah-39096
local f = CreateFrame("Frame")
769 Seerah-39096
f:RegisterEvent("ADDON_LOADED")
770 Seerah-39096
f:SetScript("OnEvent", function(self, event, addon)
771 Seerah-39096
        if addon == "PocketPlot" then
772 Seerah-39096
                OnLoad()
773 Seerah-39096
        end
774 Seerah-39096
end)