WoWInterface SVN PocketPlot

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 53 to Rev 54
    Reverse comparison

Rev 53 → Rev 54

trunk/PocketPlot/pocketplot.lua
11,7 → 11,7
local LSM = LibStub("LibSharedMedia-3.0")
local fonts = LSM:List("font")
local class = select(2, UnitClass("player"))
local classColor, movershown, clockFrame, clockTime
local classColor, movershown, clockFrame, clockTime, db, options
local Minimap = Minimap
local MinimapZoneTextButton = MinimapZoneTextButton
local GameTimeFrame = GameTimeFrame
48,11 → 48,14
local defaults = {
shape = "Square",
lsmfont = "Blue Highway",
zoneText = true,
zoneSize = 14, --font size
clockSize = 16, --font size
scale = 1, --scale of the minimap
mapPos = {x = -10, y = -10}, --offset of the minimap from the top right corner. If you wish to change where the minimap is anchored, see the "Minimap Location and Size" section below Note: this will move the quest tracker, etc, unless you use other addons to control those frames.
bg = {r = 0, g = 0, b = 0}, --border colors (red, green, blue) -- values are a range from 0-1 (0,0,0 is black and 1,1,1 is white)
mmAlpha = 1,
combHide = false,
alpha = 1,
top = false,
coords = true,
66,12 → 69,12
 
 
local function ClassColors()
if PocketPlotDB.classbg then
PocketPlot:SetBackdropColor(classColor.r, classColor.g, classColor.b, PocketPlotDB.alpha)
if db.classbg then
PocketPlot:SetBackdropColor(classColor.r, classColor.g, classColor.b, db.alpha)
else
PocketPlot:SetBackdropColor(PocketPlotDB.bg.r-.05,PocketPlotDB.bg.g-.05,PocketPlotDB.bg.b-.05,PocketPlotDB.alpha)
PocketPlot:SetBackdropColor(db.bg.r-.05,db.bg.g-.05,db.bg.b-.05,db.alpha)
end
if PocketPlotDB.classfont then
if db.classfont then
clockTime:SetTextColor(classColor.r, classColor.g, classColor.b)
coords:SetTextColor(classColor.r, classColor.g, classColor.b)
else
80,8 → 83,25
end
end
 
local function CombatHide()
if db.combHide then
PocketPlot:RegisterEvent("PLAYER_REGEN_ENABLED")
PocketPlot:RegisterEvent("PLAYER_REGEN_DISABLED")
PocketPlot:SetScript("OnEvent", function(self,event)
if event == "PLAYER_REGEN_DISABLED" then
Minimap:Hide()
else
Minimap:Show()
end
end)
else
PocketPlot:UnregisterEvent("PLAYER_REGEN_ENABLED")
PocketPlot:UnregisterEvent("PLAYER_REGEN_DISABLED")
end
end
 
local function SetShape()
if PocketPlotDB.shape == "Square" then
if db.shape == "Square" then
Minimap:SetMaskTexture("Interface\\AddOns\\PocketPlot\\media\\mask.blp")
PocketPlot:SetBackdrop({ bgFile = "Interface\\Buttons\\WHITE8x8" })
--so minimap buttons follow the square shape instead of round
96,16 → 116,20
local function MapSetup()
--MINIMAP LOCATION AND SIZE
Minimap:ClearAllPoints()
Minimap:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", PocketPlotDB.mapPos.x, PocketPlotDB.mapPos.y) --this says that the topright of the minimap is anchored to the topright of your screen (UIParent), with offsets of 10 to the left and 10 down
Minimap:SetScale(PocketPlotDB.scale) --this says that the minimap is set to 90% scale
Minimap:SetFrameStrata(PocketPlotDB.strata)
Minimap:SetFrameLevel(PocketPlotDB.level)
Minimap:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", db.mapPos.x, db.mapPos.y) --this says that the topright of the minimap is anchored to the topright of your screen (UIParent), with offsets of 10 to the left and 10 down
Minimap:SetScale(db.scale) --this says that the minimap is set to 90% scale
Minimap:SetFrameStrata(db.strata)
Minimap:SetFrameLevel(db.level)
Minimap:SetAlpha(db.mmAlpha)
 
--ZONE TEXT
MinimapZoneTextButton:SetParent("Minimap")
MinimapZoneTextButton:SetPoint("TOP", Minimap, "TOP", 0, -1) --where the zone text is located
MinimapZoneTextButton:SetFrameLevel(5)
MinimapZoneText:SetFont(LSM:Fetch("font", PocketPlotDB.lsmfont), PocketPlotDB.zoneSize, "OUTLINE") --font and font size for zone text
MinimapZoneText:SetFont(LSM:Fetch("font", db.lsmfont), db.zoneSize, "OUTLINE") --font and font size for zone text
if not db.zoneText then
MinimapZoneTextButton:Hide()
end
 
--MINIMAP ICONS/BLIPS
Minimap:SetBlipTexture(blips) --custom texture for blips
116,8 → 140,8
PocketPlot:SetFrameLevel(1)
PocketPlot:SetPoint("CENTER", Minimap, "CENTER")
local dims = Minimap:GetWidth()
PocketPlot:SetHeight(dims + PocketPlotDB.insets)
PocketPlot:SetWidth(dims + PocketPlotDB.insets)
PocketPlot:SetHeight(dims + db.insets)
PocketPlot:SetWidth(dims + db.insets)
 
--MAKE THE MINIMAP ZOOM WITH MOUSEWHEEL
MinimapZoomIn:Hide()
137,7 → 161,7
end
clockFrame, clockTime = TimeManagerClockButton:GetRegions()
clockFrame:Hide()
clockTime:SetFont(LSM:Fetch("font", PocketPlotDB.lsmfont), PocketPlotDB.clockSize, "OUTLINE")
clockTime:SetFont(LSM:Fetch("font", db.lsmfont), db.clockSize, "OUTLINE")
 
--CALENDAR BUTTON/FRAME
GameTimeFrame:SetAlpha(0) --calendar button (old day/night indicator) --Set alpha to 0 so that it's still hidden, but we'll see the ? flash for new invites
188,11 → 212,13
MinimapBorderTop:Hide()
MinimapToggleButton:Hide()
 
CombatHide() --Check to see if we should hide the minimap in combat
 
MinimapCluster:EnableMouse(false) --so you can still click the game world/turn in the upper right corner
 
--COORDINATES
coords:SetFont(LSM:Fetch("font",PocketPlotDB.lsmfont), PocketPlotDB.coordSize, "OUTLINE")
if PocketPlotDB.coords then
coords:SetFont(LSM:Fetch("font",db.lsmfont), db.coordSize, "OUTLINE")
if db.coords then
coordframe:Show()
else
coordframe:Hide()
208,7 → 234,7
TimeManagerClockButton:ClearAllPoints()
coords:ClearAllPoints()
coordframe:ClearAllPoints()
if not PocketPlotDB.top then
if not db.top then
if clockshown and not coordshown then
TimeManagerClockButton:SetPoint("TOP", Minimap, "BOTTOM", 0, 0)
end
260,20 → 286,34
else
p = "MinimapCluster"
end
PocketPlotDB[frame] = {["r"]=r, ["p"]=p,["a"]=a,["x"]=x,["y"]=y}
db[frame] = {["r"]=r, ["p"]=p,["a"]=a,["x"]=x,["y"]=y}
end
_G[frame]:ClearAllPoints()
_G[frame]:SetPoint(PocketPlotDB[frame].r, _G[PocketPlotDB[frame].p], PocketPlotDB[frame].a, PocketPlotDB[frame].x, PocketPlotDB[frame].y)
_G[frame]:SetPoint(db[frame].r, _G[db[frame].p], db[frame].a, db[frame].x, db[frame].y)
if not _G["PP_old"..frame] then
_G["PP_old"..frame] = _G[frame].SetPoint
_G[frame].SetPoint = function(self, a,b,c,d,e, ...)
local a,b,c,d,e = PocketPlotDB[frame].r, _G[PocketPlotDB[frame].p], PocketPlotDB[frame].a, PocketPlotDB[frame].x, PocketPlotDB[frame].y
local a,b,c,d,e = db[frame].r, _G[db[frame].p], db[frame].a, db[frame].x, db[frame].y
return _G["PP_old"..frame](self, a,b,c,d,e, ...)
end
end
end
 
local function ConfirmPopup()
local function SetUpDB()
if PocketPlotPCDB.charSpec then
--set defaults if new charSpec DB
for k,v in pairs(defaults) do
if type(PocketPlotPCDB[k]) == "nil" then
PocketPlotPCDB[k] = v
end
end
db = PocketPlotPCDB
else
db = PocketPlotDB
end
end
 
local function ConfirmResetPopup()
if not StaticPopupDialogs["POCKETPLOT_RESET"] then
StaticPopupDialogs["POCKETPLOT_RESET"] = {
text = "Are you sure you want to reset these frames and reload your UI?",
281,7 → 321,7
button2 = "No",
OnAccept = function()
for i=1, #frames do
PocketPlotDB[frames[i]] = nil
db[frames[i]] = nil
end
ReloadUI()
end,
293,8 → 333,28
StaticPopup_Show("POCKETPLOT_RESET")
end
 
local function ConfirmProfilePopup()
if not StaticPopupDialogs["POCKETPLOT_PROFILE"] then
StaticPopupDialogs["POCKETPLOT_PROFILE"] = {
text = "Are you sure you want to change your profile and reload your UI?",
button1 = "Yes",
button2 = "No",
OnAccept = function() ReloadUI() end,
OnCancel = function()
PocketPlotPCDB.charSpec = not PocketPlotPCDB.charSpec
LibStub("AceConfigRegistry-3.0"):NotifyChange("PocketPlot")
print("Your profile switch has been cancelled.")
end,
timeout = 0,
whileDead = 1,
hideOnEscape = 1
}
end
StaticPopup_Show("POCKETPLOT_PROFILE")
end
 
local options = {
 
options = {
name = "PocketPlot Options",
type = "group",
args = {
310,13 → 370,13
values = shapes,
get = function()
for k, v in pairs(shapes) do
if PocketPlotDB.shape == v then
if db.shape == v then
return k
end
end
end,
set = function(_,key)
PocketPlotDB.shape = shapes[key]
db.shape = shapes[key]
SetShape()
ClassColors()
end,
329,13 → 389,38
min = .25,
max = 2,
step = .05,
get = function() return PocketPlotDB.scale end,
get = function() return db.scale end,
set = function(_,value)
PocketPlotDB.scale = value
Minimap:SetScale(PocketPlotDB.scale)
db.scale = value
Minimap:SetScale(value)
end,
order = 0.2,
},
mmAlpha = {
name = "Minimap Alpha",
desc = "Set the transparency of the minimap.",
type = "range",
min = 0.05,
max = 1,
step = .05,
get = function() return db.mmAlpha end,
set = function(_,value)
db.mmAlpha = value
Minimap:SetAlpha(value)
end,
order = 0.25,
},
combHide = {
name = "Hide in Combat",
desc = "Hide the minimap when in combat.",
type = "toggle",
get = function() return db.combHide end,
set = function()
db.combHide = not db.combHide
CombatHide()
end,
order = 0.275,
},
strata = {
name = "Minimap Strata",
desc = "Set the strata of the minimap and how it layers with other elements in your interface.",
343,14 → 428,14
values = stratae,
get = function()
for k, v in pairs(stratae) do
if PocketPlotDB.strata == v then
if db.strata == v then
return k
end
end
end,
set = function(_,key)
PocketPlotDB.strata = stratae[key]
Minimap:SetFrameStrata(PocketPlotDB.strata)
db.strata = stratae[key]
Minimap:SetFrameStrata(db.strata)
end,
order = 0.3,
},
361,27 → 446,27
min = 1,
max = 10,
step = 1,
get = function() return PocketPlotDB.level end,
get = function() return db.level end,
set = function(_,value)
PocketPlotDB.level = value
Minimap:SetFrameLevel(PocketPlotDB.level)
db.level = value
Minimap:SetFrameLevel(db.level)
end,
order = 0.4,
},
header1 = {
name = "Border options",
type = "header",
order = .5,
order = 0.5,
},
border = {
name = "Border Color",
desc = "Select a color for the minimap's border.",
type = "color",
disabled = function() return PocketPlotDB.classbg end,
disabled = function() return db.classbg end,
-- hasAlpha = true,
get = function() return PocketPlotDB.bg.r, PocketPlotDB.bg.g, PocketPlotDB.bg.b end,
get = function() return db.bg.r, db.bg.g, db.bg.b end,
set = function(_,r,g,b)
PocketPlotDB.bg.r,PocketPlotDB.bg.g,PocketPlotDB.bg.b = r,g,b
db.bg.r,db.bg.g,db.bg.b = r,g,b
ClassColors()
end,
order = 1,
390,9 → 475,9
name = "Class colored border",
desc = "Color the minimap border by your class.",
type = "toggle",
get = function() return PocketPlotDB.classbg end,
get = function() return db.classbg end,
set = function()
PocketPlotDB.classbg = not PocketPlotDB.classbg
db.classbg = not db.classbg
ClassColors()
end,
order = 2,
404,9 → 489,9
min = .5,
max = 10,
step = .5,
get = function() return PocketPlotDB.insets end,
get = function() return db.insets end,
set = function(_,value)
PocketPlotDB.insets = value
db.insets = value
local dims = Minimap:GetWidth()
PocketPlot:SetHeight(dims + value)
PocketPlot:SetWidth(dims + value)
420,9 → 505,9
min = 0,
max = 1,
step = .05,
get = function() return PocketPlotDB.alpha end,
get = function() return db.alpha end,
set = function(_,alpha)
PocketPlotDB.alpha = alpha
db.alpha = alpha
ClassColors()
end,
order = 3.5,
444,16 → 529,16
values = fonts,
get = function()
for k,v in pairs(fonts) do
if v == PocketPlotDB.lsmfont then
if v == db.lsmfont then
return k
end
end
end,
set = function(_,font)
PocketPlotDB.lsmfont = fonts[font]
clockTime:SetFont(LSM:Fetch("font", PocketPlotDB.lsmfont), PocketPlotDB.clockSize, "OUTLINE")
MinimapZoneText:SetFont(LSM:Fetch("font", PocketPlotDB.lsmfont), PocketPlotDB.zoneSize, "OUTLINE")
coords:SetFont(LSM:Fetch("font",PocketPlotDB.lsmfont), PocketPlotDB.coordSize, "OUTLINE")
db.lsmfont = fonts[font]
clockTime:SetFont(LSM:Fetch("font", db.lsmfont), db.clockSize, "OUTLINE")
MinimapZoneText:SetFont(LSM:Fetch("font", db.lsmfont), db.zoneSize, "OUTLINE")
coords:SetFont(LSM:Fetch("font",db.lsmfont), db.coordSize, "OUTLINE")
end,
order = 6,
},
464,10 → 549,10
min = 6,
max = 24,
step = 1,
get = function() return PocketPlotDB.zoneSize end,
get = function() return db.zoneSize end,
set = function(_,size)
PocketPlotDB.zoneSize = size
MinimapZoneText:SetFont(LSM:Fetch("font",PocketPlotDB.lsmfont), PocketPlotDB.zoneSize, "OUTLINE")
db.zoneSize = size
MinimapZoneText:SetFont(LSM:Fetch("font",db.lsmfont), db.zoneSize, "OUTLINE")
end,
order = 7,
},
478,10 → 563,10
min = 6,
max = 24,
step = 1,
get = function() return PocketPlotDB.clockSize end,
get = function() return db.clockSize end,
set = function(_,size)
PocketPlotDB.clockSize = size
clockTime:SetFont(LSM:Fetch("font",PocketPlotDB.lsmfont), PocketPlotDB.clockSize, "OUTLINE")
db.clockSize = size
clockTime:SetFont(LSM:Fetch("font",db.lsmfont), db.clockSize, "OUTLINE")
end,
order = 8,
},
492,10 → 577,10
min = 6,
max = 24,
step = 1,
get = function() return PocketPlotDB.coordSize end,
get = function() return db.coordSize end,
set = function(_,size)
PocketPlotDB.coordSize = size
coords:SetFont(LSM:Fetch("font",PocketPlotDB.lsmfont), PocketPlotDB.coordSize, "OUTLINE")
db.coordSize = size
coords:SetFont(LSM:Fetch("font",db.lsmfont), db.coordSize, "OUTLINE")
end,
order = 9,
},
503,10 → 588,10
name = "Display coords",
desc = "Toggle showing the coordinates display.",
type = "toggle",
get = function() return PocketPlotDB.coords end,
get = function() return db.coords end,
set = function()
PocketPlotDB.coords = not PocketPlotDB.coords
if PocketPlotDB.coords then
db.coords = not db.coords
if db.coords then
coordframe:Show()
else
coordframe:Hide()
515,13 → 600,28
end,
order = 10,
},
zoneText = {
name = "Display zone text",
desc = "Toggle showing the zone text.",
type = "toggle",
get = function() return db.zoneText end,
set = function()
db.zoneText = not db.zoneText
if db.zoneText then
MinimapZoneTextButton:Show()
else
MinimapZoneTextButton:Hide()
end
end,
order = 10.5,
},
top = {
name = "Clock/coords on top",
desc = "Toggle showing the clock and coordinates above or below the map.",
type = "toggle",
get = function() return PocketPlotDB.top end,
get = function() return db.top end,
set = function()
PocketPlotDB.top = not PocketPlotDB.top
db.top = not db.top
CoordPosition()
end,
order = 11,
530,9 → 630,9
name = "Class colored text",
desc = "Color the clock and coordinates by your class.",
type = "toggle",
get = function() return PocketPlotDB.classfont end,
get = function() return db.classfont end,
set = function()
PocketPlotDB.classfont = not PocketPlotDB.classfont
db.classfont = not db.classfont
ClassColors()
end,
order = 12,
573,7 → 673,7
name = "Restore Positions",
desc = "Clicking this will restore all frames to their default positions.\n\n|c00E30016WARNING:|r Your UI will be reloaded in the process!",
type = "execute",
func = function() ConfirmPopup() end,
func = function() ConfirmResetPopup() end,
order = 16,
},
nudgeL = {
582,13 → 682,13
type = "execute",
disabled = function() return movershown == "None" or movershown == nil end,
func = function()
if not PocketPlotDB[movershown] then
if not db[movershown] then
SetPosition(movershown)
end
local frame = _G[movershown]
PocketPlotDB[movershown].x = PocketPlotDB[movershown].x - 1
db[movershown].x = db[movershown].x - 1
frame:ClearAllPoints()
frame:SetPoint(PocketPlotDB[movershown].r, PocketPlotDB[movershown].p, PocketPlotDB[movershown].a, PocketPlotDB[movershown].x, PocketPlotDB[movershown].y)
frame:SetPoint(db[movershown].r, db[movershown].p, db[movershown].a, db[movershown].x, db[movershown].y)
mover:ClearAllPoints()
mover:SetAllPoints(frame)
end,
600,13 → 700,13
type = "execute",
disabled = function() return movershown == "None" or movershown == nil end,
func = function()
if not PocketPlotDB[movershown] then
if not db[movershown] then
SetPosition(movershown)
end
local frame = _G[movershown]
PocketPlotDB[movershown].x = PocketPlotDB[movershown].x + 1
db[movershown].x = db[movershown].x + 1
frame:ClearAllPoints()
frame:SetPoint(PocketPlotDB[movershown].r, PocketPlotDB[movershown].p, PocketPlotDB[movershown].a, PocketPlotDB[movershown].x, PocketPlotDB[movershown].y)
frame:SetPoint(db[movershown].r, db[movershown].p, db[movershown].a, db[movershown].x, db[movershown].y)
mover:ClearAllPoints()
mover:SetAllPoints(frame)
end,
618,13 → 718,13
type = "execute",
disabled = function() return movershown == "None" or movershown == nil end,
func = function()
if not PocketPlotDB[movershown] then
if not db[movershown] then
SetPosition(movershown)
end
local frame = _G[movershown]
PocketPlotDB[movershown].y = PocketPlotDB[movershown].y + 1
db[movershown].y = db[movershown].y + 1
frame:ClearAllPoints()
frame:SetPoint(PocketPlotDB[movershown].r, PocketPlotDB[movershown].p, PocketPlotDB[movershown].a, PocketPlotDB[movershown].x, PocketPlotDB[movershown].y)
frame:SetPoint(db[movershown].r, db[movershown].p, db[movershown].a, db[movershown].x, db[movershown].y)
mover:ClearAllPoints()
mover:SetAllPoints(frame)
end,
636,29 → 736,56
type = "execute",
disabled = function() return movershown == "None" or movershown == nil end,
func = function()
if not PocketPlotDB[movershown] then
if not db[movershown] then
SetPosition(movershown)
end
local frame = _G[movershown]
PocketPlotDB[movershown].y = PocketPlotDB[movershown].y - 1
db[movershown].y = db[movershown].y - 1
frame:ClearAllPoints()
frame:SetPoint(PocketPlotDB[movershown].r, PocketPlotDB[movershown].p, PocketPlotDB[movershown].a, PocketPlotDB[movershown].x, PocketPlotDB[movershown].y)
frame:SetPoint(db[movershown].r, db[movershown].p, db[movershown].a, db[movershown].x, db[movershown].y)
mover:ClearAllPoints()
mover:SetAllPoints(frame)
end,
order = 20,
},
div3 = {
name = " ",
type = "description",
order = 21,
},
header4 = {
name = "Profile",
type = "header",
order = 22,
},
charSpec = {
name = "Character specific settings",
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!",
type = "toggle",
width = "full",
get = function() return PocketPlotPCDB.charSpec end,
set = function()
PocketPlotPCDB.charSpec = not PocketPlotPCDB.charSpec
ConfirmProfilePopup()
end,
order = 23,
},
},
}
 
 
local function PlayerLogin()
PocketPlotDB = PocketPlotDB or {}
PocketPlotPCDB = PocketPlotPCDB or {}
if PocketPlotPCDB.charSpec == nil then
PocketPlotPCDB.charSpec = false
end
for k,v in pairs(defaults) do
if type(PocketPlotDB[k]) == "nil" then
PocketPlotDB[k] = v
end
end
SetUpDB()
 
classColor = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[class] or RAID_CLASS_COLORS[class]
 
676,7 → 803,7
 
--restore moved frame positions--
for i=1, #frames do
if PocketPlotDB[frames[i]] then
if db[frames[i]] then
SetPosition(frames[i])
end
end
706,7 → 833,7
coords:SetFormattedText("%.1f/%.1f", coordx*100, coordy*100)
end)
coordframe:SetScript("OnEvent", function(self)
if PocketPlotDB.coords then
if db.coords then
if IsInInstance() then
self:Hide()
else
trunk/PocketPlot/PocketPlot.toc
2,10 → 2,11
## Title: PocketPlot
## Author: Seerah
## Notes: Minimap customization
## Version: 2.7
## Version: 2.8
## X-Category: Minimap
## OptionalDeps: Ace3, LibSharedMedia-3.0
## SavedVariables: PocketPlotDB
## SavedVariablesPerCharacter: PocketPlotPCDB
 
libs\LibStub\LibStub.lua
libs\CallbackHandler-1.0\CallbackHandler-1.0.xml