---------------------------------------------------------------------------------
--
-- Prat - A framework for World of Warcraft chat mods
--
-- Copyright (C) 2006-2007  Prat Development Team
--
-- This program is free software; you can redistribute it and/or
-- modify it under the terms of the GNU General Public License
-- as published by the Free Software Foundation; either version 2
-- of the License, or (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to:
--
-- Free Software Foundation, Inc., 
-- 51 Franklin Street, Fifth Floor, 
-- Boston, MA  02110-1301, USA.
--
--
-------------------------------------------------------------------------------

-- Gotta have Prat
if not Prat then return end

if not AceLibrary:HasInstance("Waterfall-1.0") then return end

local W = AceLibrary("Waterfall-1.0")
local dewdrop = AceLibrary("Dewdrop-2.0")
local WATERFALL_ID = "Prat"

local function RegisterWaterfall()
	local p = Prat.db.profile
	
	Prat.Options.args.Waterfall = {
			name = "Waterfall Config",
			type = "execute",
			order = 340,
			desc = "Opens the Waterfall Config window",
			func = function() W:Open("Prat") dewdrop:Close() end,
			disabled = "~IsActive"
		}


	W:Register(WATERFALL_ID,
	    "aceOptions", Prat.Options,
	    'treeType', 'SECTION',
	     'colorR',0.5,'colorG',0.5,'colorB',1)

end

PratWaterfall = AceLibrary("AceAddon-2.0"):new("AceEvent-2.0", "AceDB-2.0")

function PratWaterfall:OnInitialize()
    self:RegisterEvent("Prat_Ready")
end

function PratWaterfall:Prat_Ready()
    RegisterWaterfall()
	self:RegisterEvent("Prat_ModuleDisabled", "ModuleUpdate")
	self:RegisterEvent("Prat_ModuleEnabled", "ModuleUpdate")    
end    

function PratWaterfall:ModuleUpdate()
    W:Refresh(WATERFALL_ID)
end