--[[
    Name:           Titan Gatherer
	Description:	Titan Panel plugin for Gatherer
	  Gatherer created by Esamynn
    Author:         Suddendeath2000
    Version:        1.3
    --]] 
  
--Shows Addon Info in Chat Upon Logon--       
    DEFAULT_CHAT_FRAME:AddMessage(GREEN_FONT_COLOR_CODE.."Titan Panel [Gatherer] v1.3 by Suddendeath2000") 

--Registers Plugin with Titan Panel--
function TitanPanelGathererButton_OnLoad(self)
self.registry = {
		id = "Gatherer",
	  version = "1.3",
        menuText = "Gatherer",
        buttonTextFunction = "TitanPanelGathererButton_GetButtonText",	
      category = "Profession",
        tooltipTitle = "Gatherer",
		tooltipTextFunction = "TitanPanelGathererButton_GetTooltipText",
	    icon = "Interface\\AddOns\\TitanGatherer\\TitanGatherer",
        iconButtonWidth = 16,
        iconWidth = 16,        
        savedVariables = {
			ShowIcon = 1,
			ShowLabelText = 1,  
            ShowTooltipText = 1,
            ShowMenuOptions = 1,
            ShowAdvancedMenus = 1,
    }
 };     
end

TPGLabel = "Gatherer"
c = "|cff999999"

--Puts Button Name on Button--
function TitanPanelGathererButton_GetButtonText()
        return TPGLabel
end

--Information Shown on Button Mouseover--
function TitanPanelGathererButton_GetTooltipText()
	local c = "|cff00ff00"
	return c.."Right-click to Open Gatherer Report.\n"..c.."Left-click to Toggle Minimap icons.\n"..c.."Shift/Left-click to Toggle Mainmap icons."
end

--Determines Options by Button Click--
function TitanPanelGathererButton_OnClick(self, button)
	if button == "LeftButton" then
	   if IsShiftKeyDown() then TitanPanelGathererButton_MainMapTog()
       else TitanPanelGathererButton_MiniMapTog()
  end 
end
    if button == "RightButton" then
		Gatherer.Report.Toggle()
  end
end

--Mainmap Toggle--
function TitanPanelGathererButton_MainMapTog()
  if ( Gatherer.Config.GetSetting("mainmap.enable") ) then
        Gatherer.Command.Process( "mainmap off" )
  else
		Gatherer.Command.Process( "mainmap on" )
  end
end

--Minimap Toggle--    
function TitanPanelGathererButton_MiniMapTog()
  if ( Gatherer.Config.GetSetting("minimap.enable") ) then
		Gatherer.Command.Process( "minimap off" )
        TPGLabel = c.."Gatherer"
  else
		Gatherer.Command.Process( "minimap on" )
        TPGLabel = "Gatherer"
  end
end

--Updates Button Text--
function TitanPanelGathererButton_OnUpdate(self)
      TitanPanelButton_UpdateButton("Gatherer")
end
 

 

