/branches
local PocketPlot = CreateFrame("Frame", nil, Minimap) |
local movershown, clockFrame, clockTime, LSM, fonts, defaultfontkey |
PP_oldMinimap, PP_oldDurabilityFrame, PP_oldQuestWatchFrame, PP_oldQuestTimerFrame, PP_oldAchievementWatchFrame = "foo" |
local _G = _G |
local movershown |
local mover = CreateFrame("Frame", nil, UIParent) |
mover:SetBackdrop({bgFile ="Interface\\Buttons\\WHITE8x8",}) |
mover:SetBackdrop({ |
bgFile ="Interface\\Buttons\\WHITE8x8", |
}) |
mover:SetBackdropColor(.2,.2,.9) |
mover:SetMovable(1) |
mover:Hide() |
moverText:SetFont("Fonts\\ARIALN.ttf", 14) |
moverText:SetParent(mover) |
moverText:SetPoint("CENTER") |
frames = { "Minimap", |
"DurabilityFrame", |
"QuestWatchFrame", |
"QuestTimerFrame", |
"AchievementWatchFrame", |
} |
local defaults = { |
font = "Interface\\AddOns\\PocketPlot\\media\\BLUEHIGH.ttf", --file path to a .ttf font |
lsmfont = "Blue Highway", |
zoneSize = 14, --font size |
clockSize = 16, --font size |
size = 14, --font size (clock is size + 2) |
scale = .9, --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. |
blips = "Interface\\AddOns\\PocketPlot\\media\\PPblips2.blp", --file path to blip textures (2 styles are included with this addon, or you can find/create your own. If you like the default blips, then use "Interface\\Minimap\\OBJECTICONS.blp") |
MinimapZoneTextButton:SetParent("Minimap") |
MinimapZoneTextButton:SetPoint("TOP", Minimap, "TOP", 0, -1) --where the zone text is located |
MinimapZoneTextButton:SetFrameLevel(5) |
if LSM then |
MinimapZoneText:SetFont(LSM:Fetch("font", PocketPlotDB.lsmfont), PocketPlotDB.zoneSize, "OUTLINE") --font and font size for zone text |
else |
MinimapZoneText:SetFont(PocketPlotDB.font, PocketPlotDB.zoneSize, "OUTLINE") --font and font size for zone text |
end |
MinimapZoneText:SetFont(PocketPlotDB.font, PocketPlotDB.size, "OUTLINE") --font and font size for zone text |
--MINIMAP ICONS/BLIPS |
Minimap:SetBlipTexture(PocketPlotDB.blips) --custom texture for blips |
Minimap:SetMaskTexture("Interface\\AddOns\\PocketPlot\\media\\mask.blp") |
PocketPlot:SetFrameLevel(1) |
PocketPlot:SetBackdrop({ --border is actually a background frame that's slightly larger than minimap |
bgFile ="Interface\\Buttons\\WHITE8x8", |
bgFile ="Interface\\Tooltips\\UI-Tooltip-Background", |
insets = {left = -3, right = -3, top = -3, bottom = -3}, |
}) |
PocketPlot:SetBackdropColor(PocketPlotDB.bg.r,PocketPlotDB.bg.g,PocketPlotDB.bg.b) |
MinimapZoomOut:Hide() |
Minimap:EnableMouseWheel(true) |
Minimap:SetScript("OnMouseWheel", function(_, zoom) |
if zoom > 0 then |
Minimap_ZoomIn() |
else |
Minimap_ZoomOut() |
end |
end) |
if zoom > 0 then |
Minimap_ZoomIn() |
else |
Minimap_ZoomOut() |
end |
end) |
--CLOCK FRAME |
if not IsAddOnLoaded("Blizzard_TimeManager") then |
LoadAddOn("Blizzard_TimeManager") |
end |
clockFrame, clockTime = TimeManagerClockButton:GetRegions() |
local clockFrame, clockTime = TimeManagerClockButton:GetRegions() |
clockFrame:Hide() |
clockTime:SetFont(PocketPlotDB.font, PocketPlotDB.size + 3, "OUTLINE") |
TimeManagerClockButton:SetPoint("TOP", Minimap, "BOTTOM", 0, 0) |
if LSM then |
clockTime:SetFont(LSM:Fetch("font", PocketPlotDB.lsmfont), PocketPlotDB.clockSize, "OUTLINE") |
else |
clockTime:SetFont(PocketPlotDB.font, PocketPlotDB.clockSize, "OUTLINE") |
end |
--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 |
local r,p,a,x,y = _G[frame]:GetPoint() |
local height = _G[frame]:GetHeight() |
local width = _G[frame]:GetWidth() |
local frscale = _G[frame]:GetScale() |
mover:SetHeight(height) |
mover:SetWidth(width) |
mover:SetScale(frscale) |
mover:ClearAllPoints() |
mover:SetPoint(r,p,a,x,y) |
end |
end |
local function SetPosition(frame) |
if mover:IsShown() then |
local r,p,a,x,y = mover:GetPoint() |
PocketPlotDB[frame] = {["r"]=r, ["a"]=a,["x"]=x,["y"]=y} |
end |
_G[frame]:ClearAllPoints() |
_G[frame]:SetPoint(PocketPlotDB[frame].r, UIParent, PocketPlotDB[frame].a, PocketPlotDB[frame].x, PocketPlotDB[frame].y) |
_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, UIParent, PocketPlotDB[frame].a, PocketPlotDB[frame].x, PocketPlotDB[frame].y |
return _G["PP_old"..frame](self, a,b,c,d,e, ...) |
end |
local function SavePosition() |
local origsetpoint = QuestWatchFrame:SetPoint |
local r,p,a,x,y = mover:GetPoint() |
_G[movershown]:ClearAllPoints() |
origsetpoint(r,p,a,x,y) |
_G[movershown].SetPoint = function() return end |
PocketPlotDB[movershown] = {r,a,x,y} |
DEFAULT_CHAT_FRAME:AddMessage(r..",UIParent,"..a..","..x..","..y) |
end |
local function PocketPlotOptions(panel) |
"default", .9, |
"current", PocketPlotDB.scale, |
"setFunc", function(value) PocketPlotDB.scale = value Minimap:SetScale(PocketPlotDB.scale) end, |
"currentTextFunc", function() return ("%.0f%%"):format(PocketPlotDB.scale*100) end |
"currentTextFunc", function(value) return ("%.0f%%"):format(PocketPlotDB.scale*100) end |
):SetPoint("TOPLEFT", subText, "BOTTOMLEFT", 0, -30) |
panel:MakeColorPicker( |
"name", "Border color", |
"currentR", PocketPlotDB.bg.r, |
"currentG", PocketPlotDB.bg.g, |
"currentB", PocketPlotDB.bg.b, |
"setFunc", function(retr,retg,retb) PocketPlotDB.bg.r,PocketPlotDB.bg.g,PocketPlotDB.bg.b = retr,retg,retb PocketPlot:SetBackdropColor(PocketPlotDB.bg.r,PocketPlotDB.bg.g,PocketPlotDB.bg.b) end |
):SetPoint("TOPLEFT", subText, "BOTTOM", 0, -30) |
panel:MakeSlider( |
"name", "Zone text size", |
"description", "Change the font size of the Zone Text.", |
"minText", "6", |
"maxText", "24", |
"minValue", 6, |
"maxValue", 24, |
"step", 1, |
"default", 14, |
"current", PocketPlotDB.zoneSize, |
"setFunc", function(size) PocketPlotDB.zoneSize = size MinimapZoneText:SetFont(PocketPlotDB.font, PocketPlotDB.zoneSize, "OUTLINE") end, |
"currentTextFunc", function() return PocketPlotDB.zoneSize end |
):SetPoint("TOPLEFT", subText, "BOTTOMLEFT", 0, -90) |
panel:MakeSlider( |
"name", "Clock text size", |
"description", "Change the font size of the Clock.", |
"minText", "6", |
"maxText", "24", |
"minValue", 6, |
"maxValue", 24, |
"step", 1, |
"default", 16, |
"current", PocketPlotDB.clockSize, |
"setFunc", function(size) PocketPlotDB.clockSize = size clockTime:SetFont(PocketPlotDB.font, PocketPlotDB.clockSize, "OUTLINE") end, |
"currentTextFunc", function() return PocketPlotDB.clockSize end |
):SetPoint("TOPLEFT", subText, "BOTTOM", 0, -90) |
"setFunc", function(retr,retg,retb) PocketPlotDB.bg.r,PocketPlotDB.bg.g,PocketPlotDB.bg.b,PocketPlotDB.bg.a = retr,retg,retb,reta PocketPlot:SetBackdropColor(PocketPlotDB.bg.r,PocketPlotDB.bg.g,PocketPlotDB.bg.b) end |
):SetPoint("TOPLEFT", subText, "CENTER", 0, -30) |
panel:MakeDropDown( |
"name", "Enable mover for...", |
"description", "Shows an anchor to move the selected frame.", |
"values", { "Minimap", "Minimap", |
"DurabilityFrame", "Durability Frame", |
"description", 'Shows an anchor to move the selected frame.\n\nPress the "Default" button to return the frame to its normal position (requires you to reload your UI).', |
"values", { "DurabilityFrame", "Durability Frame", |
"QuestWatchFrame", "Quest Tracker", |
"QuestTimerFrame", "Quest Timer", |
"AchievementWatchFrame", "Achievement Tracker", |
"default", "None", |
"current", movershown or "None", |
"setFunc", function(frame) movershown = frame MoveFrames(frame) end |
):SetPoint("TOPLEFT", subText, "BOTTOMLEFT", 0, -150) |
if LSM then |
panel:MakeDropDown( |
"name", "Font", |
"description", "SharedMedia was detected. Select a font.", |
"values", fonts, |
"default", defaultfontkey, |
"current", PocketPlotDB.lsmfont, |
-- "getFunc", function() return PocketPlotDB.lsmfont end, |
"setFunc", function(font) DEFAULT_CHAT_FRAME:AddMessage(font) PocketPlotDB.lsmfont = font clockTime:SetFont(LSM:Fetch("font", font), PocketPlotDB.clockSize, "OUTLINE") MinimapZoneText:SetFont(LSM:Fetch("font", font), PocketPlotDB.zoneSize, "OUTLINE") end |
):SetPoint("TOPLEFT", subText, "BOTTOM", 0, -150) |
end |
panel:MakeButton( |
"name", "Restore Positions", |
"description", "Clicking this will restore all frames to their default positions.\n\nWARNING: Your UI will be reloaded in the process!", |
"func", function() for i=1, #frames do PocketPlotDB[frames[i]] = nil end ReloadUI() end |
):SetPoint("TOP", subText, "BOTTOM", 0, -300) |
):SetPoint("TOPLEFT", subText, "TOPLEFT", 0, -100) |
end |
local function PlayerLogin() |
if not PocketPlotDB then |
PocketPlotDB = defaults |
end |
DEFAULT_CHAT_FRAME:AddMessage(PocketPlotDB.bg.a) |
-- db = PocketPlotDB or defaults |
MapSetup() |
LibStub("LibSimpleOptions-1.0").AddOptionsPanel("PocketPlot", function(panel) PocketPlotOptions(panel) end) |
LibStub("LibSimpleOptions-1.0").AddSlashCommand("PocketPlot", "/pocketplot", "/pp") |
if LibStub("LibSharedMedia-3.0") ~= nil then |
LSM = LibStub("LibSharedMedia-3.0") |
LSM:Register("font", "Blue Highway", "Interface\\AddOns\\PocketPlot\\media\\BLUEHIGH.ttf") |
fonts = {} |
for k,v in pairs(LSM:List("font")) do |
table.insert(fonts, k) |
table.insert(fonts, v) |
if v == "Blue Highway" then |
defaultfontkey = k |
end |
end |
end |
MapSetup() |
for i=1, #frames do |
if PocketPlotDB[frames[i]] then |
SetPosition(frames[i]) |
end |
end |
end |
mover:SetScript("OnMouseDown", function() this:StartMoving() end) |
mover:SetScript("OnMouseUp", function() this:StopMovingOrSizing() SetPosition(movershown) end) |
mover:SetScript("OnMouseUp", function() this:StopMovingOrSizing() SavePosition() end) |
PocketPlot:SetScript("OnEvent", PlayerLogin) |
PocketPlot:RegisterEvent("PLAYER_LOGIN") |
## Notes: Minimap customization |
## Version: 2.0 |
## X-Category: Minimap |
## OptionalDeps: LibSimpleOptions-1.0, LibSharedMedia-3.0 |
## OptionalDeps: LibSimpleOptions-1.0 |
## SavedVariables: PocketPlotDB |
libs\LibStub.lua |