WoWInterface SVN PocketPlot

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 90 to Rev 91
    Reverse comparison

Rev 90 → Rev 91

trunk/PocketPlot/PocketPlot.toc
2,7 → 2,7
## Title: PocketPlot
## Author: Seerah
## Notes: Minimap customization
## Version: 3.2
## Version: 3.3
## OptionalDeps: Ace3, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets
## SavedVariables: PocketPlotDB
## SavedVariablesPerCharacter: PocketPlotPCDB
trunk/PocketPlot/pocketplot_options.lua
13,7 → 13,6
"MiniMapChallengeMode",
"GarrisonLandingPageMinimapButton",
}
--local stratae = {"BACKGROUND", "LOW", "MEDIUM", "HIGH", "DIALOG"}
local allshapes = { "3-Corner BL",
"3-Corner BR",
"3-Corner TL",
93,6 → 92,7
coords = true,
clock = true,
coordSize = 16,
cursorcoordSize = 16,
classbg = false,
classfont = false,
textOffset = 0,
101,6 → 101,7
strata = "BACKGROUND",
level = 2,
hideNorth = true,
cursorcoords = true,
}
 
local function SetPosition(frame)
234,38 → 235,6
end,
order = 6,
},
--[[strata = {
name = "Minimap Strata",
desc = "Set the strata of the minimap and how it layers with other elements in your interface.",
type = "select",
values = stratae,
get = function()
for k, v in pairs(stratae) do
if db.strata == v then
return k
end
end
end,
set = function(_,key)
db.strata = stratae[key]
Minimap:SetFrameStrata(db.strata)
end,
order = 7,
},]]
--[[level = {
name = "Strata Level",
desc = "Nudge the minimap up and down different levels on its frame strata.",
type = "range",
min = 1,
max = 10,
step = 1,
get = function() return db.level end,
set = function(_,value)
db.level = value
Minimap:SetFrameLevel(db.level)
end,
order = 8,
},]]
battleHide = {
name = "Hide in Pet Battle",
desc = "Hide the minimap during pet battles.",
418,7 → 387,7
},
classfont = {
name = "Class colored text",
desc = "Color the clock and coordinates by your class.",
desc = "Color the clock and player coordinates by your class.",
type = "toggle",
get = function() return db.classfont end,
set = function()
427,10 → 396,26
end,
order = 4,
},
zoneText = {
name = "Display zone text",
desc = "Toggle showing the zone text at the minimap.",
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 = 5,
},
zonesize = {
name = "Zone Text Size",
desc = "Change the font size of the Zone Text.",
desc = "Change the font size of the zone text.",
type = "range",
disabled = function() return not db.zoneText end,
min = 6,
max = 24,
step = 1,
439,52 → 424,24
db.zoneSize = size
PocketPlot.SetFonts()
end,
order = 5,
},
clocksize = {
name = "Clock Text Size",
desc = "Change the font size of the clock.",
type = "range",
min = 6,
max = 24,
step = 1,
get = function() return db.clockSize end,
set = function(_,size)
db.clockSize = size
PocketPlot.SetFonts()
end,
order = 6,
},
coordsize = {
name = "Coords Text Size",
desc = "Change the font size of the coordinates.",
zoneTextOffset = {
name = "Zone Text Offset",
desc = "Vertical offset from the minimap for the zone text.",
type = "range",
min = 6,
max = 24,
disabled = function() return not db.zoneText end,
min = -50,
max = 50,
step = 1,
get = function() return db.coordSize end,
set = function(_,size)
db.coordSize = size
PocketPlot.SetFonts()
get = function() return db.zoneTextOffset end,
set = function(_,offset)
db.zoneTextOffset = offset
MinimapZoneTextButton:ClearAllPoints()
MinimapZoneTextButton:SetPoint("TOP", Minimap, "TOP", 0, -1 + db.zoneTextOffset)
end,
order = 7,
},
coords = {
name = "Display coords",
desc = "Toggle showing the coordinates display.",
type = "toggle",
get = function() return db.coords end,
set = function()
db.coords = not db.coords
if db.coords then
PocketPlot.coordframe:Show()
else
PocketPlot.coordframe:Hide()
end
PocketPlot.CoordPosition()
end,
order = 8,
},
clock = {
name = "Display clock",
desc = "Toggle showing the clock.",
499,38 → 456,71
end
PocketPlot.CoordPosition()
end,
order = 9,
order = 8,
},
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
clocksize = {
name = "Clock Text Size",
desc = "Change the font size of the clock.",
type = "range",
disabled = function() return not db.clock end,
min = 6,
max = 24,
step = 1,
get = function() return db.clockSize end,
set = function(_,size)
db.clockSize = size
PocketPlot.SetFonts()
end,
order = 10,
order = 9,
},
top = {
name = "Clock/coords on top",
desc = "Toggle showing the clock and coordinates above or below the map.",
desc = "Toggle showing the clock and player coordinates above or below the minimap.",
type = "toggle",
disabled = function() return not db.clock and not db.coords end,
get = function() return db.top end,
set = function()
db.top = not db.top
PocketPlot.CoordPosition()
end,
order = 10,
},
coords = {
name = "Display player coords",
desc = "Toggle showing the player coordinates display.",
type = "toggle",
get = function() return db.coords end,
set = function()
db.coords = not db.coords
if db.coords then
PocketPlot.coordframe:Show()
else
PocketPlot.coordframe:Hide()
end
PocketPlot.CoordPosition()
end,
order = 11,
},
coordsize = {
name = "Player Coords Text Size",
desc = "Change the font size of the player coordinates.",
type = "range",
disabled = function() return not db.coords end,
min = 6,
max = 24,
step = 1,
get = function() return db.coordSize end,
set = function(_,size)
db.coordSize = size
PocketPlot.SetFonts()
end,
order = 12,
},
textOffset = {
name = "Clock/Coord Offset",
desc = "Vertical offset for the clock and coordinates.",
desc = "Vertical offset from the minimap for the clock and player coordinates.",
type = "range",
disabled = function() return not db.clock and not db.coords end,
min = -50,
max = 50,
step = 1,
539,22 → 529,37
db.textOffset = offset
PocketPlot.CoordPosition()
end,
order = 12,
order = 13,
},
zoneTextOffset = {
name = "Zone Text Offset",
desc = "Vertical offset for the zone text.",
cursorcoords = {
name = "Display cursor coords",
desc = "Toggle showing the cursor's coordinates on the world map.",
type = "toggle",
get = function() return db.cursorcoords end,
set = function()
db.cursorcoords = not db.cursorcoords
if db.cursorcoords then
PocketPlot.cursorcoordframe:Show()
else
PocketPlot.cursorcoordframe:Hide()
end
end,
order = 14,
},
cursorcoordsize = {
name = "Cursor Coords Text Size",
desc = "Change the font size of the cursor's coordinates on the world map.",
type = "range",
min = -50,
max = 50,
disabled = function() return not db.cursorcoords end,
min = 6,
max = 24,
step = 1,
get = function() return db.zoneTextOffset end,
set = function(_,offset)
db.zoneTextOffset = offset
MinimapZoneTextButton:ClearAllPoints()
MinimapZoneTextButton:SetPoint("TOP", Minimap, "TOP", 0, -1 + db.zoneTextOffset)
get = function() return db.cursorcoordsize end,
set = function(_,size)
db.cursorcoordsize = size
PocketPlot.SetFonts()
end,
order = 13,
order = 15,
},
},
},
trunk/PocketPlot/pocketplot.lua
1,4 → 1,5
local _, PocketPlot = ...
--local
_, PocketPlot = ...
local LSM = LibStub("LibSharedMedia-3.0")
local fonts = AceGUIWidgetLSMlists.font
local _, class = UnitClass("player")
6,7 → 7,8
local GameTooltip = GameTooltip
local GetPlayerMapPosition = C_Map.GetPlayerMapPosition
local GetBestMapForUnit = C_Map.GetBestMapForUnit
local db, clockBG, clockTime, classColor, coords, coordframe, wasIndoors
local WMSC = WorldMapFrame.ScrollContainer.Child
local db, clockBG, clockTime, classColor, coords, coordframe, cursorcoords, wasIndoors
 
PocketPlot.bg = CreateFrame("Frame", "PocketPlotBG", Minimap)
local bg = PocketPlot.bg
51,6 → 53,7
MinimapZoneText:SetFont(LSM:Fetch("font", db.lsmfont), db.zoneSize, db.fontFlag) --font and font size for zone text
coords:SetFont(LSM:Fetch("font",db.lsmfont), db.coordSize, db.fontFlag)
clockTime:SetFont(LSM:Fetch("font", db.lsmfont), db.clockSize, db.fontFlag)
cursorcoords:SetFont(LSM:Fetch("font", db.lsmfont), db.clockSize, db.fontFlag)
end
 
PocketPlot.CoordPosition = function()
91,10 → 94,10
end
end
 
local throttle = 0
local throttle1 = 0
local function UpdateCoords(self, elapsed)
throttle = throttle + elapsed
if throttle >= .3 then
throttle1 = throttle1 + elapsed
if throttle1 >= .3 then
local mapID = GetBestMapForUnit("player")
if not mapID then return end --mapID can be nil when on loading screen
local posData = GetPlayerMapPosition(mapID, "player")
103,10 → 106,36
else
coords:SetText("--/--")
end
throttle = 0
throttle1 = 0
end
end
 
local throttle2 = 0
local function UpdateCursorCoords(self,elapsed)
throttle2 = throttle2 + elapsed
if throttle2 >= .2 then
local topOffset, leftOffset = WMSC:GetTop(), WMSC:GetLeft()
--if we know where the map is on screen, we can keep going
if topOffset and leftOffset then
--how big is the world map and is it zoomed in?
local mapHeight, mapWidth = WMSC:GetHeight(), WMSC:GetWidth()
local mapScale = WMSC:GetEffectiveScale()
--where is the cursor on screen?
local cursorX, cursorY = GetCursorPosition()
--translate that to the World Map measurements (the map coords are 100x100, so we'll calculate percent)
local coordX = (((cursorX/mapScale) - leftOffset) / mapWidth) * 100
local coordY = ((topOffset - (cursorY/mapScale)) / mapHeight) * 100
--are we actually over the map or no?
if coordX < 0 or coordX > 100 or coordY < 0 or coordY > 100 then
cursorcoords:SetText("--/--")
else
cursorcoords:SetFormattedText("%.1f/%.1f", coordX, coordY)
end
end
throttle2 = 0
end
end
 
PocketPlot.CombatHide = function()
if db.combatHide then
f:RegisterEvent("PLAYER_REGEN_ENABLED")
149,16 → 178,13
 
local function MapSetup()
Minimap:SetScale(db.scale)
--Minimap:SetFrameStrata(db.strata)
Minimap:SetFrameStrata("LOW")
--Minimap:SetFrameLevel(db.level)
Minimap:SetFrameLevel(101)
 
--ZONE TEXT
MinimapZoneTextButton:SetParent("Minimap")
MinimapZoneTextButton:ClearAllPoints()
MinimapZoneTextButton:SetPoint("TOP", Minimap, "TOP", 0, -1 + db.zoneTextOffset) --where the zone text is located
--MinimapZoneTextButton:SetFrameLevel(db.level + 2)
MinimapZoneText:ClearAllPoints()
MinimapZoneText:SetPoint("CENTER")
if not db.zoneText then
169,7 → 195,6
MinimapBorder:Hide()
MinimapBorderTop:Hide()
PocketPlot.SetShape()
--bg:SetFrameLevel(db.level - 1)
bg:SetFrameLevel(99)
bg:SetFrameStrata("BACKGROUND")
bg:SetPoint("CENTER", Minimap, "CENTER")
243,6 → 268,23
coordframe:Show()
end
 
--WORLD MAP CURSOR COORDINATES
cursorcoordframe = CreateFrame("Frame", nil, WorldMapFrame)
PocketPlot.cursorcoordframe = cursorcoordframe
cursorcoords = cursorcoordframe:CreateFontString(nil, "OVERLAY")
cursorcoordframe:SetPoint("BOTTOMLEFT", WorldMapFrame, "BOTTOMLEFT", 10, 10)
cursorcoordframe:SetFrameStrata("DIALOG")
cursorcoordframe:SetHeight(28)
cursorcoordframe:SetWidth(100)
cursorcoords:SetPoint("BOTTOMLEFT")
cursorcoords:SetShadowOffset(1,-1)
cursorcoords:SetShadowColor(0,0,0,1)
cursorcoordframe:Hide() --prevent OnUpdate from running until we want it to
cursorcoordframe:SetScript("OnUpdate", UpdateCursorCoords)
if db.cursorcoords then
cursorcoordframe:Show()
end
 
--CALENDAR BUTTON
GameTimeFrame:SetAlpha(0) --Set alpha to 0 so that it's still hidden, but we'll see the ? flash for new invites
GameTimeFrame:EnableMouse(false)
258,7 → 300,6
Minimap:SetScript("OnMouseUp", function(self, click)
if click == "RightButton" then
if IsShiftKeyDown() then
--MiniMapTrackingButton:Click()
MiniMapTracking_OnMouseDown()
else
GameTimeFrame_OnClick(GameTimeFrame)