//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] <-- Loulach --

class CPPgRelease : public CPropertyPage
{
	DECLARE_DYNAMIC(CPPgRelease)

public:
	CPPgRelease();
	virtual ~CPPgRelease();

	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;

	HTREEITEM m_htiReleaseTweaks;
		HTREEITEM m_htiPartTraffic; // MOD: NPT - [NeoPartTraffic]

		// MOD: TQ - [TweakUploadQueue]
		HTREEITEM m_htiTweakUploadQueue;
			HTREEITEM m_htiSaveUploadQueueWaitTime; // MOD: SQ - [SaveUploadQueue]
			HTREEITEM m_htiUseMultiQueue; // MOD: MQ - [MultiQueue]
			HTREEITEM m_htiUseRandomQueue; // MOD: RQ - [RandomQueue]
			HTREEITEM m_htiInfiniteQueue;
			HTREEITEM m_htiUploadQueueOverFlow;
				HTREEITEM m_htiQueueOverFlowRelease;
				HTREEITEM m_htiQueueOverFlowEx;
				HTREEITEM m_htiQueueOverFlowDef;
				HTREEITEM m_htiQueueOverFlowCF;
			HTREEITEM m_htiOldPrioritySystem;
		// MOD: TQ END

		// MOD: IPS - [InteligentPartSharing]
		HTREEITEM m_htiInteligentPartSharing;
			HTREEITEM m_htiInteligentPartSharingEnable;
			HTREEITEM m_htiInteligentPartSharingTimer;
			HTREEITEM m_htiMaxProzentToHide;
			HTREEITEM m_htiHideOverAvaliblyParts;
				HTREEITEM m_htiHideOverAvaliblyPartsDefault;
				HTREEITEM m_htiHideOverAvaliblyPartsEnable;
				HTREEITEM m_htiHideOverAvaliblyPartsEnableAll;
				HTREEITEM m_htiHideOverAvaliblyPartsDisable;
				HTREEITEM m_htiHideOverAvaliblyValue;
				HTREEITEM m_htiHideOverAvaliblyMode;
					HTREEITEM m_htiHideOverAvaliblyMode0;
					HTREEITEM m_htiHideOverAvaliblyMode1;
					HTREEITEM m_htiHideOverAvaliblyMode2;
				HTREEITEM m_htiBlockHighOverAvaliblyParts;
					HTREEITEM m_htiBlockHighOverAvaliblyPartsDefault;
					HTREEITEM m_htiBlockHighOverAvaliblyPartsEnable;
					HTREEITEM m_htiBlockHighOverAvaliblyPartsEnableAll;
					HTREEITEM m_htiBlockHighOverAvaliblyPartsDisable;
					HTREEITEM m_htiBlockHighOverAvaliblyFactor;
			HTREEITEM m_htiHideOverSharedParts;
				HTREEITEM m_htiHideOverSharedPartsDefault;
				HTREEITEM m_htiHideOverSharedPartsEnable;
				HTREEITEM m_htiHideOverSharedPartsEnableAll;
				HTREEITEM m_htiHideOverSharedPartsDisable;
				HTREEITEM m_htiHideOverSharedValue;
				HTREEITEM m_htiHideOverSharedMode;
					HTREEITEM m_htiHideOverSharedMode0;
					HTREEITEM m_htiHideOverSharedMode1;
					HTREEITEM m_htiHideOverSharedMode2;
				HTREEITEM m_htiDontHideUnderAvaliblyParts;
					HTREEITEM m_htiDontHideUnderAvaliblyPartsDefault;
					HTREEITEM m_htiDontHideUnderAvaliblyPartsEnable;
					HTREEITEM m_htiDontHideUnderAvaliblyPartsEnableAll;
					HTREEITEM m_htiDontHideUnderAvaliblyPartsDisable;
					HTREEITEM m_htiDontHideUnderAvaliblyValue;
					HTREEITEM m_htiDontHideUnderAvaliblyMode;
						HTREEITEM m_htiDontHideUnderAvaliblyMode0;
						HTREEITEM m_htiDontHideUnderAvaliblyMode1;
						HTREEITEM m_htiDontHideUnderAvaliblyMode2;
				HTREEITEM m_htiBlockHighOverSharedParts;
					HTREEITEM m_htiBlockHighOverSharedPartsDefault;
					HTREEITEM m_htiBlockHighOverSharedPartsEnable;
					HTREEITEM m_htiBlockHighOverSharedPartsEnableAll;
					HTREEITEM m_htiBlockHighOverSharedPartsDisable;
					HTREEITEM m_htiBlockHighOverSharedFactor;
				HTREEITEM m_htiHideOverSharedCalc;
					HTREEITEM m_htiHideOverSharedCalcDefault;
					HTREEITEM m_htiHideOverSharedCalcHigh;
					HTREEITEM m_htiHideOverSharedCalcLow;
			HTREEITEM m_htiShowAlwaysNeeded;
				HTREEITEM m_htiShowAlwaysNeededDefault;
				HTREEITEM m_htiShowAlwaysNeededEnable;
				HTREEITEM m_htiShowAlwaysNeededEnableAll;
				HTREEITEM m_htiShowAlwaysNeededDisable;
				HTREEITEM m_htiShowAlwaysNeededValue;
				HTREEITEM m_htiShowAlwaysIncomplete;
					HTREEITEM m_htiShowAlwaysIncompleteDefault;
					HTREEITEM m_htiShowAlwaysIncompleteEnable;
					HTREEITEM m_htiShowAlwaysIncompleteEnableAll;
					HTREEITEM m_htiShowAlwaysIncompleteDisable;
	// MOD: IPS END

/////////////////////////////////////////////////////////////////////////////////
		
	UINT	m_uPartTraffic; // MOD: NPT - [NeoPartTraffic]
	int		m_iPartTrafficColor; // MOD: NPT - [NeoPartTraffic]

	bool	m_bSaveUploadQueueWaitTime; // MOD: SQ - [SaveUploadQueue]

	// MOD: TQ - [TweakUploadQueue]
	bool	m_bInfiniteQueue;

	UINT	m_uQueueOverFlowRelease;
	int		m_iQueueOverFlowRelease;

	UINT	m_uQueueOverFlowEx;
	int		m_iQueueOverFlowEx;

	UINT	m_uQueueOverFlowDef;
	int		m_iQueueOverFlowDef;

	UINT	m_uQueueOverFlowCF;
	int		m_iQueueOverFlowCF;
	// MOD: TQ END

	bool	m_bUseMultiQueue; // MOD: MQ - [MultiQueue]
	bool	m_bUseRandomQueue; // MOD: RQ - [RandomQueue]

	bool	m_bOldPrioritySystem;


	// MOD: IPS - [InteligentPartSharing]
	bool	m_bInteligentPartSharing;
	int		m_iInteligentPartSharingTimer;
	int		m_iMaxProzentToHide;

	int		m_iHideOverAvaliblyParts;
	int		m_iHideOverAvaliblyMode;
	float	m_fHideOverAvaliblyValue;
	int		m_iHideOverAvaliblyCatch;

	int		m_iHideOverSharedParts;
	int		m_iHideOverSharedMode;
	float	m_fHideOverSharedValue;
	int		m_iHideOverSharedCalc;
	
	int		m_iDontHideUnderAvaliblyParts;
	int		m_iDontHideUnderAvaliblyMode;
	float	m_fDontHideUnderAvaliblyValue;

	int		m_iBlockHighOverAvaliblyParts;
	float	m_fBlockHighOverAvaliblyFactor;

	int		m_iBlockHighOverSharedParts;
	float	m_fBlockHighOverSharedFactor;

	int		m_iShowAlwaysNeeded;
	int		m_iShowAlwaysParts;

	int		m_iShowAlwaysIncomplete;
	// MOD: IPS 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;}
	bool	CheckIPSEnable(); // MOD: IPS - [InteligentPartSharing]
};
