/trunk/PocketPlot
} |
local stratae = {"BACKGROUND", "LOW", "MEDIUM", "HIGH", "DIALOG"} |
local shapes = {"Square", "Circle"} |
local fontFlags = {"None", "Outline", "Thick Outline", "Monochrome"} |
local defaults = { |
shape = "Square", |
lsmfont = "Blue Highway", |
fontFlag = "Outline", |
zoneText = true, |
zoneSize = 14, --font size |
clockSize = 16, --font size |
end |
end |
local function MoveFrames(frame) |
if frame == "None" then |
mover:Hide() |
mover:EnableMouse(0) |
return |
else |
mover:Show() |
moverText:SetText(frame) |
mover:EnableMouse(1) |
mover:ClearAllPoints() |
mover:SetAllPoints(frame) |
end |
end |
local function SetPosition(frame) |
if mover:IsShown() then |
local r,p,a,x,y = mover:GetPoint() |
--frames lose their reference anchor frame when dragging... :/ |
if movershown == "Minimap" then |
p = "UIParent" |
else |
p = "MinimapCluster" |
end |
db[frame] = {["r"]=r, ["p"]=p,["a"]=a,["x"]=x,["y"]=y} |
end |
_G[frame]:ClearAllPoints() |
_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 = 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 MapSetup() |
--restore moved frame positions-- |
for i=1, #frames do |
if db[frames[i]] then |
SetPosition(frames[i]) |
end |
end |
--MINIMAP LOCATION AND SIZE |
Minimap:ClearAllPoints() |
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) |
MinimapZoneTextButton:SetParent("Minimap") |
MinimapZoneTextButton:SetPoint("TOP", Minimap, "TOP", 0, -1) --where the zone text is located |
MinimapZoneTextButton:SetFrameLevel(5) |
MinimapZoneText:SetFont(LSM:Fetch("font", db.lsmfont), db.zoneSize, "OUTLINE") --font and font size for zone text |
MinimapZoneText:SetFont(LSM:Fetch("font", db.lsmfont), db.zoneSize, db.fontFlag) --font and font size for zone text |
if not db.zoneText then |
MinimapZoneTextButton:Hide() |
end |
end |
clockFrame, clockTime = TimeManagerClockButton:GetRegions() |
clockFrame:Hide() |
clockTime:SetFont(LSM:Fetch("font", db.lsmfont), db.clockSize, "OUTLINE") |
clockTime:SetFont(LSM:Fetch("font", db.lsmfont), db.clockSize, db.fontFlag) |
--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 |
MinimapCluster:EnableMouse(false) --so you can still click the game world/turn in the upper right corner |
--COORDINATES |
coords:SetFont(LSM:Fetch("font",db.lsmfont), db.coordSize, "OUTLINE") |
coords:SetFont(LSM:Fetch("font",db.lsmfont), db.coordSize, db.fontFlag) |
if db.coords then |
coordframe:Show() |
else |
end |
end |
local function MoveFrames(frame) |
if frame == "None" then |
mover:Hide() |
mover:EnableMouse(0) |
return |
else |
mover:Show() |
moverText:SetText(frame) |
mover:EnableMouse(1) |
mover:ClearAllPoints() |
mover:SetAllPoints(frame) |
end |
end |
local function SetPosition(frame) |
if mover:IsShown() then |
local r,p,a,x,y = mover:GetPoint() |
--frames lose their reference anchor frame when dragging... :/ |
if movershown == "Minimap" then |
p = "UIParent" |
else |
p = "MinimapCluster" |
end |
db[frame] = {["r"]=r, ["p"]=p,["a"]=a,["x"]=x,["y"]=y} |
end |
_G[frame]:ClearAllPoints() |
_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 = 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 SetUpDB() |
if PocketPlotPCDB.charSpec then |
--set defaults if new charSpec DB |
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?", |
button1 = "Yes", |
button2 = "No", |
OnAccept = function() |
for i=1, #frames do |
db[frames[i]] = nil |
end |
ReloadUI() |
end, |
timeout = 0, |
whileDead = 1, |
hideOnEscape = 1 |
} |
end |
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 |
options = { |
name = "PocketPlot Options", |
type = "group", |
type = "select", |
values = fonts, |
get = function() |
for k,v in pairs(fonts) do |
if v == db.lsmfont then |
return k |
for k,v in pairs(fonts) do |
if v == db.lsmfont then |
return k |
end |
end |
end |
end, |
end, |
set = function(_,font) |
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, |
db.lsmfont = fonts[font] |
clockTime:SetFont(LSM:Fetch("font", db.lsmfont), db.clockSize, db.fontFlag) |
MinimapZoneText:SetFont(LSM:Fetch("font", db.lsmfont), db.zoneSize, db.fontFlag) |
coords:SetFont(LSM:Fetch("font",db.lsmfont), db.coordSize, db.fontFlag) |
end, |
order = 6, |
}, |
fontFlag = { |
name = "Font Flag", |
desc = "Set how to alter the displayed font.", |
type = "select", |
values = fontFlags, |
get = function() |
for k, v in pairs(fontFlags) do |
if db.fontFlag == v then |
return k |
end |
end |
end, |
set = function(_,key) |
db.fontFlag = fontFlags[key] |
clockTime:SetFont(LSM:Fetch("font", db.lsmfont), db.clockSize, db.fontFlag) |
MinimapZoneText:SetFont(LSM:Fetch("font", db.lsmfont), db.zoneSize, db.fontFlag) |
coords:SetFont(LSM:Fetch("font",db.lsmfont), db.coordSize, db.fontFlag) |
end, |
order = 6.5, |
}, |
zonesize = { |
name = "Zone Text Size", |
desc = "Change the font size of the Zone Text.", |
get = function() return db.zoneSize end, |
set = function(_,size) |
db.zoneSize = size |
MinimapZoneText:SetFont(LSM:Fetch("font",db.lsmfont), db.zoneSize, "OUTLINE") |
MinimapZoneText:SetFont(LSM:Fetch("font",db.lsmfont), db.zoneSize, db.fontFlag) |
end, |
order = 7, |
}, |
get = function() return db.clockSize end, |
set = function(_,size) |
db.clockSize = size |
clockTime:SetFont(LSM:Fetch("font",db.lsmfont), db.clockSize, "OUTLINE") |
clockTime:SetFont(LSM:Fetch("font",db.lsmfont), db.clockSize, db.fontFlag) |
end, |
order = 8, |
}, |
get = function() return db.coordSize end, |
set = function(_,size) |
db.coordSize = size |
coords:SetFont(LSM:Fetch("font",db.lsmfont), db.coordSize, "OUTLINE") |
coords:SetFont(LSM:Fetch("font",db.lsmfont), db.coordSize, db.fontFlag) |
end, |
order = 9, |
}, |
classfont = { |
name = "Class colored text", |
desc = "Color the clock and coordinates by your class.", |
type = "toggle", |
get = function() return db.classfont end, |
set = function() |
db.classfont = not db.classfont |
ClassColors() |
end, |
order = 10, |
}, |
coords = { |
name = "Display coords", |
desc = "Toggle showing the coordinates display.", |
end |
CoordPosition() |
end, |
order = 10, |
order = 11, |
}, |
zoneText = { |
name = "Display zone text", |
MinimapZoneTextButton:Hide() |
end |
end, |
order = 10.5, |
order = 12, |
}, |
top = { |
name = "Clock/coords on top", |
db.top = not db.top |
CoordPosition() |
end, |
order = 11, |
order = 13, |
}, |
classfont = { |
name = "Class colored text", |
desc = "Color the clock and coordinates by your class.", |
type = "toggle", |
get = function() return db.classfont end, |
set = function() |
db.classfont = not db.classfont |
ClassColors() |
end, |
order = 12, |
}, |
-- div2 = { |
-- name = " ", |
-- type = "description", |
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() ConfirmResetPopup() end, |
confirm = true, |
func = function() |
for i=1, #frames do |
db[frames[i]] = nil |
end |
ReloadUI() |
end, |
order = 16, |
}, |
nudgeL = { |
name = "Nudge Left", |
desc = "Click to nudge the frame 1px to the left.", |
name = "Left", |
desc = "Nudge the frame 1px to the left.", |
type = "execute", |
width = "half", |
disabled = function() return movershown == "None" or movershown == nil end, |
func = function() |
if not db[movershown] then |
order = 17, |
}, |
nudgeR = { |
name = "Nudge Right", |
desc = "Click to nudge the frame 1px to the right.", |
name = "Right", |
desc = "Nudge the frame 1px to the right.", |
type = "execute", |
width = "half", |
disabled = function() return movershown == "None" or movershown == nil end, |
func = function() |
if not db[movershown] then |
order = 18, |
}, |
nudgeU = { |
name = "Nudge Up", |
desc = "Click to nudge the frame 1px towards the top of the screen.", |
name = "Up", |
desc = "Nudge the frame 1px towards the top of the screen.", |
type = "execute", |
width = "half", |
disabled = function() return movershown == "None" or movershown == nil end, |
func = function() |
if not db[movershown] then |
order = 19, |
}, |
nudgeD = { |
name = "Nudge Down", |
desc = "Click to nudge the frame 1px towards the bottom of the screen.", |
name = "Down", |
desc = "Nudge the frame 1px towards the bottom of the screen.", |
type = "execute", |
width = "half", |
disabled = function() return movershown == "None" or movershown == nil end, |
func = function() |
if not db[movershown] then |
type = "header", |
order = 22, |
}, |
--[[ warning = { |
name = "\n|c00E30016WARNING:|r Changing any of the following options will cause your UI to be reloaded in the process!\n", |
type = "description", |
order = 22.5, |
},]]-- |
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", |
confirm = true, |
get = function() return PocketPlotPCDB.charSpec end, |
set = function() |
PocketPlotPCDB.charSpec = not PocketPlotPCDB.charSpec |
ConfirmProfilePopup() |
ReloadUI() |
end, |
order = 23, |
}, |
copyProfile = { |
name = "Copy from Default", |
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!", |
type = "execute", |
confirm = true, |
disabled = function() return not PocketPlotPCDB.charSpec end, |
func = function() |
PocketPlotPCDB = PocketPlotDB |
PocketPlotPCDB.charSpec = true |
ReloadUI() |
end, |
order = 24, |
}, |
resetProfile = { |
name = "Profile Reset", |
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!", |
type = "execute", |
confirm = true, |
func = function() |
if PocketPlotPCDB.charSpec then |
PocketPlotPCDB = {charSpec = true} |
else |
PocketPlotDB = {} |
end |
ReloadUI() |
end, |
order = 25, |
}, |
}, |
} |
MapSetup() |
--restore moved frame positions-- |
for i=1, #frames do |
if db[frames[i]] then |
SetPosition(frames[i]) |
end |
end |
-- --restore moved frame positions-- |
-- for i=1, #frames do |
-- if db[frames[i]] then |
-- SetPosition(frames[i]) |
-- end |
-- end |
--is here because it wasn't working down below for some odd reason...-- |
TimeManagerClockButton:SetScript("OnHide", CoordPosition) |
## Title: PocketPlot |
## Author: Seerah |
## Notes: Minimap customization |
## Version: 2.8 |
## Version: 2.9 |
## X-Category: Minimap |
## OptionalDeps: Ace3, LibSharedMedia-3.0 |
## SavedVariables: PocketPlotDB |