WoWInterface SVN zz_Coords

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 69 to Rev 70
    Reverse comparison

Rev 69 → Rev 70

trunk/zz_Coords/core.lua
20,47 → 20,11
local zoneText,subZoneText
local coordsline,col
local L = LibStub("AceLocale-3.0"):GetLocale(childName, true)
local outbound = true
local mf, mfn
local db
local delayMapUpdate = .4
local delayOnUpdate = .5
local function isoutbound()
mf = GetMouseFocus()
if(mf) then
mfn = GetMouseFocus():GetName()
if(mfn and mfn ~= "WorldMapFrame") then
if((string.sub(mfn,1,8) == "WorldMap") or (string.sub(mfn,1,8) == "poiWorld"))then return false end
end
end
return true
end
 
local function getContinent()
local continent
local mapID = C_Map.GetBestMapForUnit("player")
if(mapID) then
local info = C_Map.GetMapInfo(mapID)
if(info) then
if(info['mapType'] > 2) then
while(info['mapType'] > 2) do
info = C_Map.GetMapInfo(info['parentMapID'])
end
continent = info['mapID']
end
end
end
return continent
end
local function positionFrame()
-- if(WORLDMAP_SETTINGS['size'] ~= WORLDMAP_WINDOWED_SIZE) then
if(WorldMapFrame:IsMaximized()) then
zz_CoordsMapFrameCoordText:SetPoint("BOTTOM", WorldMapFrame, "BOTTOM", db['screenX'], db['screenY'])
else
zz_CoordsMapFrameCoordText:SetText()
zz_CoordsMapFrameCoordText:SetPoint("BOTTOM", WorldMapFrame, "BOTTOM", db['windowX'], db['windowY'])
end
end
local function limitLength(info, maxlength)
if(info and maxlength) then
if(maxlength > 0 and info:len() > maxlength) then
130,12 → 94,10
tip:AddLine(GetRealZoneText())
tip:AddLine(GetSubZoneText())
tip:AddLine(format("%s: %s",childName,tostring(playerCoords)))
if(info~="inbound") then
tip:AddLine(L['HINT'])
tip:AddLine(L['HINT2'])
tip:AddLine(L['HINT3'])
tip:AddLine(L['HINT4'])
end
tip:AddLine(L['HINT'])
tip:AddLine(L['HINT2'])
tip:AddLine(L['HINT3'])
tip:AddLine(L['HINT4'])
end
 
local function OnButton(self, button)
200,9 → 162,6
end
 
local function ZONED()
if(not WorldMapFrame:IsShown()) then
-- SetMapToCurrentZone()
end
zoneText = db['ShowZone'] and GetRealZoneText() or ""
if(db['ShowSubZone']) then
if(GetSubZoneText() and GetSubZoneText()~="") then
216,48 → 175,13
end
end
zoneText = limitLength(zoneText,db['maxLength'])
end
-- local alreadyprinted = false
local function MapFrame_OnUpdate()
C_Timer.After(delayMapUpdate, MapFrame_OnUpdate)
--[[ if(not alreadyprinted) then
alreadyprinted=true
for k,v in pairs(WorldMapFrame) do
print(k,v)
end
end ]]
if(not WorldMapFrame.ScrollContainer:IsVisible()) then return end
setPlayerCoords()
local x,y = WorldMapFrame.ScrollContainer:GetCursorPosition()
local centerX, centerY = WorldMapFrame.ScrollContainer:GetCenter();
local width = WorldMapFrame.ScrollContainer:GetWidth();
local height = WorldMapFrame.ScrollContainer:GetHeight();
local adjustedY = addon['round']((centerY + (height/2) - y) / height * 100,1);
local adjustedX = addon['round']((x - (centerX - (width/2))) / width * 100,1);
local adjustedX, adjustedY = addon['GetXY']()
zz_CoordsMapFrameCoordText:SetText(format("%s%s",isoutbound() and L['outbound'] or L['COORDFMTSTRING']( mapFrame,adjustedX, adjustedY), playerCoords))
WorldMapFrameTitleText:SetText(adjustedX..", "..adjustedY)
positionFrame()
if(isoutbound()) then
MouseOut(mapFrame)
if(not db['hideMapCoords']) then
addon['mapframe']:Show()
else
MouseIn(mapFrame,adjustedX, adjustedY,playerCoords)
addon['mapframe']:Hide()
end
end
 
local function mainFrame()
mapFrame = CreateFrame("Frame", "zz_CoordsMapFrame", WorldMapFrame)
C_Timer.After(delayMapUpdate, MapFrame_OnUpdate)
local coordText = mapFrame:CreateFontString("zz_CoordsMapFrameCoordText", "ARTWORK")
coordText:SetFont(GameFontNormal:GetFont())
coordText:SetTextColor(GameFontNormal:GetTextColor())
coordText:SetShadowColor(GameFontNormal:GetShadowColor())
coordText:SetShadowOffset(GameFontNormal:GetShadowOffset())
coordText:SetPoint("BOTTOM", WorldMapFrame.ScrollContainer, "BOTTOM", 0, 10)
mapFrame:Show()
coordText:Show()
end
 
local function getPref(pref)
return db[pref[#pref]]
end
274,7 → 198,6
['OnClick'] = OnButton,
}, getPref, setPref)
db = addon['db']['profile'][childName]
mainFrame()
C_Timer.After(delayOnUpdate, OnDataUpdate)
BINDING_HEADER_COORDS = childName
BINDING_NAME_COORDS_TOGGLE = L["Toggle Minimap"]
284,25 → 207,12
addon['AddConfigEntry'](addon, childName,"toggle","hideMapCoords",L['Hide Map coords'],L['This hides the coords-display at the bottom of your map'],2,nil,nil,nil,nil,options['args'][childName])
addon['AddConfigEntry'](addon, childName,"toggle","ShowZone",L['Show Zone'],nil,1,nil,nil,nil,nil,options['args'][childName])
addon['AddConfigEntry'](addon, childName,"toggle","ShowSubZone",L['Show Subzone'],nil,1,nil,nil,nil,nil,options['args'][childName])
addon['AddConfigEntry'](addon, childName,"toggle","ShowMapID",L['Show MapID'],nil,2,nil,nil,nil,nil,options['args'][childName])
addon['AddConfigEntry'](addon, childName,"range","maxLength",L['Max Length'],L['Limits the maximum length of the zone'],1,0,255,1,false,options['args'][childName])
addon['AddConfigEntry'](addon, childName,"header",'screenXY',L['Mapcoords Screen'],nil,3,nil,nil,nil,nil,options['args'][childName])
addon['AddConfigEntry'](addon, childName,"header",'windowXY',L['Mapcoords Window'],nil,6,nil,nil,nil,nil,options['args'][childName])
addon['AddConfigEntry'](addon, childName,"range","screenX",L['Screen X'],L['Adjusts the X-Offset on fullscreenmap'],4,-1024,1024,1,false,options['args'][childName])
addon['AddConfigEntry'](addon, childName,"range","screenY",L['Screen Y'],L['Adjusts the Y-Offset on fullscreenmap'],5,-1024,1024,1,false,options['args'][childName])
addon['AddConfigEntry'](addon, childName,"range","windowX",L['Window X'],L['Adjusts the X-Offset on windowed map'],7,-512,512,1,false,options['args'][childName])
addon['AddConfigEntry'](addon, childName,"range","windowY",L['Window Y'],L['Adjusts the Y-Offset on windowed map'],8,-512,512,1,false,options['args'][childName])
if(not db['hideMapCoords']) then
zz_CoordsMapFrame:Show()
else
zz_CoordsMapFrame:Hide()
end
db['screenX'] = db['screenX'] or 0
db['screenY'] = db['screenY'] or 11
db['windowX'] = db['windowX'] or -10
db['windowY'] = db['windowY'] or -3
addon['RegisterFunc']({"ZONE_CHANGED_NEW_AREA","ZONE_CHANGED","ZONE_CHANGED_INDOORS"},"OnEvent", ZONED)
WorldMapFrame:HookScript("OnEnter", function(self) outbound = false end)
WorldMapFrame:HookScript("OnLeave", function(self) outbound = true end)
addon['RegisterFunc']({"ZONE_CHANGED_NEW_AREA","ZONE_CHANGED","ZONE_CHANGED_INDOORS","NEW_WMO_CHUNK"},"OnEvent", ZONED)
ZONED()
end
 
trunk/zz_Coords/locale_enUS.lua
5,6 → 5,7
L[name] = name
L[name..' Settings'] = format("%s Settings",name)
L['Hide Map coords'] = true
L['Show MapID'] = "Show MapID on worldmap"
L['This hides the coords-display at the bottom of your map'] = true
L['outbound'] = "Cursor: - -- Player: "
L['Player'] = true
trunk/zz_Coords/provider.lua
3,7 → 3,7
local childName = "zz_Coords"
-- Provides a basic interface for something that manages the adding, updating, and removing of data like icons, blobs or text to the map canvas
local zzDataProvider = {};
local coordText
local coordText,db
local mapframe
local zzDebug = false
 
13,34 → 13,51
local function GetXY()
local map = WorldMapFrame.ScrollContainer
local x, y = map:GetNormalizedCursorPosition();
local adjustedX = addon['round'](x * 100,1)
local adjustedY = addon['round'](y * 100,1)
local adjustedX = x * 100
local adjustedY = y * 100
return adjustedX,adjustedY
end
addon['GetXY'] = GetXY
local function update()
if(not addon['db']['profile'][childName]) then return end
if(not db) then
db = addon['db']['profile'][childName]
end
if(coordText) then
db['screenX'] = db['screenX'] or 10
db['screenY'] = db['screenY'] or 5
db['windowX'] = db['windowX'] or 10
db['windowY'] = db['windowY'] or 5
local x,y = GetXY()
local str = ""
local mapID = zzDataProvider:GetMap():GetMapID()
if(mapID) then
if(mapID and db['ShowMapID']) then
str = format("%s MapID: %i",str,mapID)
end
local
if(not(x == 100 or y==100 or x==0 or y==0)) then
str = format("%s Mouse: %i,%i",str,x,y)
str = format("%s Mouse: %.1f / %.1f",str,x,y)
end
local pinfo = C_Map.GetPlayerMapPosition(mapID,"player")
if(pinfo and pinfo.x and pinfo.y) then
str = format("%s Player: %.1f / %.1f",str,pinfo.x * 100,pinfo.y * 100)
end
coordText:SetText(str)
if(not db['hideMapCoords']) then
mapframe:Show()
else
mapframe:Hide()
end
mapframe:SetPoint("BOTTOMLEFT", WorldMapFrame, "BOTTOMLEFT", db['windowX'], db['windowY'])
end
end
function zzDataProvider:OnAdded(owningMap)
-- Optionally override in your mixin, called when this provider is added to a map canvas
self.owningMap = owningMap;
if(not coordText or not mapframe) then
mapframe = CreateFrame("Frame", "zz_CoordsMapFrame2", WorldMapFrame)
mapframe:SetWidth(300)
mapframe = CreateFrame("Frame", "zz_CoordsMapFrame", WorldMapFrame)
mapframe:SetWidth(600)
mapframe:SetHeight(20)
mapframe:SetPoint("BOTTOMLEFT", WorldMapFrame, "BOTTOMLEFT", 10, 5)
-- mapframe:SetPoint("BOTTOMLEFT", WorldMapFrame, "BOTTOMLEFT", addon['db']['windowX'], addon['db']['windowY'])
mapframe:SetFrameStrata("HIGH")
mapframe.elapsed = 0
coordText = mapframe:CreateFontString(nil, "OVERLAY","GameFontNormal")
52,6 → 69,7
self.elapsed = 0
update()
end)
addon['mapframe'] = mapframe
end
end
 
trunk/zz_Coords/locale_deDE.lua
5,6 → 5,7
L[name] = name
L[name..' Settings'] = name..' Settings'
L['Hide Map coords'] = "Verstecke Map-Koordinaten"
L['Show MapID'] = "Zeige MapID auf der Weltkarte"
L['This hides the coords-display at the bottom of your map'] = "Deaktiviert die Anzeige der Koordinaten auf der Map"
L['outbound'] = "Zeiger: - -- Spieler: "
L['Player'] = "Spieler"