//this file is part of NeoMule
//Copyright (C)2006 David Xanatos ( Xanatos@Lycos.at / http://neomule.sourceforge.net )
//
//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 the Free Software
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.


#pragma once
#include "Sion\GUI\CP\TreeOptionsCtrl.h" // NEO - [TreeControl]

class CPPgSources : public CPropertyPage
{
	DECLARE_DYNAMIC(CPPgSources)

public:
	CPPgSources();
	virtual ~CPPgSources();

	void SetFiles(const CSimpleArray<CObject*>* paFiles) { m_paFiles = paFiles; m_bDataChanged = true; m_bFilePreferences = true; } // MOD: FCFG - [FileConfiguration]

	// Dialog Data
	enum { IDD = IDD_PPG_MOD };

protected:
	// MOD: FCFG - [FileConfiguration]
	//CString m_strCaption;
	const CSimpleArray<CObject*>* m_paFiles;
	bool m_bDataChanged;
	uint32 m_timer;
	static LPCTSTR sm_pszNotAvail;

	bool m_bFilePreferences; // We use the same dialog ro the Prefs and the File Prefs
	// MOD: FCFG END

	CTreeOptionsCtrl m_ctrlTreeOptions; // NEO - [TreeControl]
	bool m_bInitializedTreeOpts;

	// MOD: DR - [DownloadReask]
	HTREEITEM m_htiDownloadReask;
		HTREEITEM m_htiSpreadReask; // MOD: SR - [SpreadReask]
		HTREEITEM m_htiReask;
			HTREEITEM m_htiReaskIntervals;
		HTREEITEM m_htiNnPReask;
			HTREEITEM m_htiReaskNnPDefault;
			HTREEITEM m_htiReaskNnPEnable;
			HTREEITEM m_htiReaskNnPDisable;
			HTREEITEM m_htiReaskNnPIntervals;
		HTREEITEM m_htiFullQReask;
			HTREEITEM m_htiReaskFullQDefault;
			HTREEITEM m_htiReaskFullQEnable;
			HTREEITEM m_htiReaskFullQDisable;
			HTREEITEM m_htiReaskFullQIntervals;
	// MOD: DR END

	// MOD: DS - [DropSources]
	HTREEITEM m_htiDrop;
		HTREEITEM m_htiUseDontAskThisIP;
			HTREEITEM m_htiUseDontAskThisIPDefault;
			HTREEITEM m_htiUseDontAskThisIPEnable;
			HTREEITEM m_htiUseDontAskThisIPDisable;
			HTREEITEM m_htiDontAskThisIPTime;
		HTREEITEM m_htiDropNnP;
			HTREEITEM m_htiDropNnPDefault;
			HTREEITEM m_htiDropNnPEnable;
			HTREEITEM m_htiDropNnPDisable;
			HTREEITEM m_htiDropNnPLimit;
				HTREEITEM m_htiDropNnPLimitDefault;
				HTREEITEM m_htiDropNnPLimitTotal;
				HTREEITEM m_htiDropNnPLimitRelativ;
				HTREEITEM m_htiDropNnPLimitSpecyfic;
				HTREEITEM m_htiDropNnPLimitDisable;
			HTREEITEM m_htiDropNnPTimer;
		HTREEITEM m_htiDropFullQ;
			HTREEITEM m_htiDropFullQDefault;
			HTREEITEM m_htiDropFullQEnable;
			HTREEITEM m_htiDropFullQDisable;
			HTREEITEM m_htiDropFullQLimit;
				HTREEITEM m_htiDropFullQLimitDefault;
				HTREEITEM m_htiDropFullQLimitTotal;
				HTREEITEM m_htiDropFullQLimitRelativ;
				HTREEITEM m_htiDropFullQLimitSpecyfic;
				HTREEITEM m_htiDropFullQLimitDisable;
			HTREEITEM m_htiDropFullQTimer;
		HTREEITEM m_htiDropHighQ;
			HTREEITEM m_htiDropHighQDefault;
			HTREEITEM m_htiDropHighQEnable;
			HTREEITEM m_htiDropHighQDisable;
			HTREEITEM m_htiDropHighQValue;
			HTREEITEM m_htiDropHighQLimit;
				HTREEITEM m_htiDropHighQLimitDefault;
				HTREEITEM m_htiDropHighQLimitTotal;
				HTREEITEM m_htiDropHighQLimitRelativ;
				HTREEITEM m_htiDropHighQLimitSpecyfic;
				HTREEITEM m_htiDropHighQLimitDisable;
			HTREEITEM m_htiDropHighQTimer;
	// MOD: DS END

	// MOD: FCFG - [FileConfiguration]
	int		m_iHardLimit;
	int		m_iSwapLimit;
	int		m_iCleanUpLimit;
	int		m_iCalcStandardLimits;
	bool	m_bCalcStandardLimits;

	// MOD: SR - [SpreadReask]
	bool	m_bSpreadReask;
	int		m_iSpreadReask;
	// MOD: SR END

	// MOD: DR - [DownloadReask]
	int		m_iReaskIntervals;

	int		m_iNnPReask;
	bool	m_bDontNnPReask;
	int		m_iNnPReaskIntervals;

	int		m_iFullQReask;
	bool	m_bDontFullQReask;
	int		m_iFullQReaskIntervals;
	// MOD: DR END

	// MOD: DS - [DropSources]
	bool	m_bUseDontAskThisIP;
	int		m_iUseDontAskThisIP;
	int		m_iDontAskThisIPTime;

	int		m_iDropNnP;
	UINT	m_uDropNnP;
	int		m_iDropNnPLimit;
	int		m_iDropNnPLimitMode;
	int		m_iDropNnPTimer;

	int		m_iDropFullQ;
	UINT	m_uDropFullQ;
	int		m_iDropFullQLimit;
	int		m_iDropFullQLimitMode;
	int		m_iDropFullQTimer;

	int		m_iDropHighQ;
	UINT	m_uDropHighQ;
	int		m_iDropHighQValue;
	int		m_iDropHighQLimit;
	int		m_iDropHighQLimitMode;
	int		m_iDropHighQTimer;
	// MOD: DS END

	void ClearAllMembers();

	//void Localize();
	void LoadSettings();
	void RefreshData(); // MOD: FCFG - [FileConfiguration]

	virtual BOOL OnInitDialog();
	virtual BOOL OnApply();
	virtual BOOL OnKillActive();
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
	virtual BOOL OnSetActive(); // MOD: FCFG - [FileConfiguration]

	DECLARE_MESSAGE_MAP()
	afx_msg void OnTimer(UINT nIDEvent); // MOD: FCFG - [FileConfiguration]
	afx_msg void OnDestroy();
	afx_msg LRESULT OnDataChanged(WPARAM, LPARAM); // MOD: FCFG - [FileConfiguration]

	afx_msg LRESULT OnTreeOptsCtrlNotify(WPARAM wParam, LPARAM lParam);
	afx_msg LRESULT DrawTreeItemHelp(WPARAM wParam, LPARAM lParam);
	afx_msg void OnHelp();
	afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);

private:
	bool	ForFile() {return m_bFilePreferences;}
	//void	CheckSLEnable(); // MOD: NST - [NeoSourceTweaks]
};
