///////////////////////////////////////////////////////////////////////////////
//PPgSomTam.cpp : implementation file///////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "emule.h"
#include "./AntiLeech/Modname.h"
#include "SomTamMod/PPgSomTam.h"
#include "emuledlg.h"
#include "serverWnd.h" 
#include "UploadQueue.h"
#include "OtherFunctions.h"
#include "UserMsgs.h"
#include "Preferences.h"
#ifdef CLIENTANALYZER
#include "UploadQueue.h" // VQB: fullChunk
#endif
#include "MuleToolbarCtrl.h" // High resulution speedmeter on toolbar [eFMod/Stulle] - Stulle
#include "./ConChecker/ConChecker.h" //>>> WiZaRd::ConChecker [eWombat]


#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

#pragma warning(disable:4800)




IMPLEMENT_DYNAMIC(CPPgSomTamMod, CPropertyPage)

BEGIN_MESSAGE_MAP(CPPgSomTamMod, CPropertyPage)
	ON_WM_HSCROLL()
	ON_WM_DESTROY()
	ON_MESSAGE(UM_TREEOPTSCTRL_NOTIFY, OnTreeOptsCtrlNotify)
	ON_BN_CLICKED(IDC_FUNNYNICK, OnSettingsChange) //Xman Funny-Nick (Stulle/Morph)

	ON_WM_HELPINFO()

END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////

CPPgSomTamMod::CPPgSomTamMod()
	: CPropertyPage(CPPgSomTamMod::IDD)
	, m_ctrlTreeOptions(theApp.m_iDfltImageListColorFlags)
	
{
	m_bInitializedTreeOpts = false;

    m_htiSomTamMod = NULL; //-->Matrik Menu
    m_AdditionalTweaks = NULL;
	m_htiEnableDownloadInBold = NULL; //MORPH - Added by SiRoB, show download in Bold
	m_UploadTweaks = NULL;
	m_bUseSlotFocus = false; //>>> WiZaRd::SlotFocus
	m_htiUseSlotFocus = NULL; //>>> WiZaRd::SlotFocus
	// Tux: Feature: Automatic shared files updater [start]
	m_htiDirWatcher = NULL;
	m_bDirWatcher = false;
	// Tux: Feature: Automatic shared files updater [end]
	m_htiShowSpeedMeter = NULL; // High resulution speedmeter on toolbar [eFMod/Stulle] - Stulle
	m_bShowSpeedMeter = false;	// High resulution speedmeter on toolbar [eFMod/Stulle] - Stulle
	// Added by MoNKi [ SlugFiller: -lowIdRetry- ]
	m_htiLowIdRetry = NULL;
	m_iLowIdRetry = 0;
	// End SlugFiller
	//>Matrik >Show Icon Preview When is Ready
	m_htiShowIconPreview = NULL;
	m_bShowIconPreview = false;
	//<Matrik
			
}

///////////////////////////////////////////////////////////////////////////////
//
//
CPPgSomTamMod::~CPPgSomTamMod()
{
}

///////////////////////////////////////////////////////////////////////////////
//
//
void CPPgSomTamMod::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);

	DDX_Control(pDX, IDC_SOMTAMMOD, m_ctrlTreeOptions);
			
	if (!m_bInitializedTreeOpts)
	{

        int iImgSomTamMod = 8; //>>Matrik
		int iImgDownl = 8; //>>Matrik
        int iImgUpload = 8; //>>Matrik
		int iImgConchecker = 8; //>>Matrik
		int iImgPingMethod = 8; //>>Matrik
		int iImgSetSmallFile = 8; //>>Matrik
		int	iImgSLS = 8;		//>>> JvA::SLS [enkeyDEV]
		

        CImageList* piml = m_ctrlTreeOptions.GetImageList(TVSIL_NORMAL);
		if (piml){
			
            iImgSomTamMod =	    piml->Add(CTempIconLoader(L"TOMBSTONE")); //Menu Matrik
		    iImgDownl =         piml->Add(CTempIconLoader(L"POWERSHAREON"));  // Icon
			iImgUpload =        piml->Add(CTempIconLoader(L"POWERSHAREOFF"));   // Icon
			iImgConchecker =    piml->Add(CTempIconLoader(L"CONCHECKER"));   // Icon
			iImgPingMethod =    piml->Add(CTempIconLoader(L"PINGMETHOD")); //  Icon
			iImgSetSmallFile =  piml->Add(CTempIconLoader(L"SETSMALLFILE")); //  Icon
			iImgSLS			=	piml->Add(CTempIconLoader(L"SLS"));	//>>> JvA::SLS [enkeyDEV]
			
		}




///////////////////////////////////////////////////////////////////////////////
//Menu
//

        m_htiSomTamMod = m_ctrlTreeOptions.InsertGroup(_T("Som-Tam Mod I"), iImgSomTamMod, TVI_ROOT);
		m_ctrlTreeOptions.SetItemState(m_htiSomTamMod, TVIS_BOLD, TVIS_BOLD);
		
        //>>Matrik Download
		m_AdditionalTweaks = m_ctrlTreeOptions.InsertGroup(_T("Options Download"), iImgDownl, m_htiSomTamMod);
		m_ctrlTreeOptions.SetItemState(m_AdditionalTweaks, TVIS_BOLD, TVIS_BOLD);
		
		m_htiEnableDownloadInBold = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_DOWNLOAD_IN_BOLD), m_AdditionalTweaks, m_bEnableDownloadInBold); //MORPH - Added by SiRoB, show download in Bold
		m_htiShowSpeedMeter = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_SHOW_SPEED_METER), m_AdditionalTweaks, m_bShowSpeedMeter); // High resulution speedmeter on toolbar [eFMod/Stulle] - Stulle
	    m_htiShowIconPreview = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_SHOW_ICON_PREVIEW), m_AdditionalTweaks, m_bShowIconPreview); //Matrik >Show Icon Preview When is Ready

		//>>> JvA::SLS [enkeyDEV]
		m_htiSLSGroup		= m_ctrlTreeOptions.InsertGroup(GetResString(IDS_SLSLABEL), iImgSLS, m_AdditionalTweaks);
		m_htiSLSCheck		= m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_SLSCHECKLABEL), m_htiSLSGroup, m_bSLSCheck);
		m_htiSLSActivationLimit = m_ctrlTreeOptions.InsertItem(GetResString(IDS_SLSACTIVATIONLABEL), TREEOPTSCTRLIMG_EDIT, TREEOPTSCTRLIMG_EDIT, m_htiSLSGroup);
		m_ctrlTreeOptions.AddEditBox(m_htiSLSActivationLimit, RUNTIME_CLASS(CNumTreeOptionsEdit));
		m_htiSLSSaveValue	= m_ctrlTreeOptions.InsertItem(GetResString(IDS_SLSSAVEVALUE), TREEOPTSCTRLIMG_EDIT, TREEOPTSCTRLIMG_EDIT, m_htiSLSGroup);
		m_ctrlTreeOptions.AddEditBox(m_htiSLSSaveValue, RUNTIME_CLASS(CNumTreeOptionsEdit));
        //<<< JvA::SLS [enkeyDEV]

		//>>> JvA::SLS [enkeyDEV]
		m_ctrlTreeOptions.SetItemState(m_htiSLSGroup, TVIS_BOLD, TVIS_BOLD);
        //<<< JvA::SLS [enkeyDEV]

        //>>Matrik Upload
		m_UploadTweaks = m_ctrlTreeOptions.InsertGroup(_T("Options Upload"), iImgUpload, m_htiSomTamMod);
		m_ctrlTreeOptions.SetItemState(m_UploadTweaks, TVIS_BOLD, TVIS_BOLD);

		//>>> WiZaRd::SlotFocus
		m_htiUseSlotFocus = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_SLOTFOCUS), m_UploadTweaks, m_bUseSlotFocus);
        //<<< WiZaRd::SlotFocus

		m_htiDirWatcher = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_DIR_WATCHER), m_UploadTweaks, m_bDirWatcher);	// Tux: Feature: Automatic shared files updater
        
		//>>> WiZaRd::Small File Slot
		m_htiSmallFileSize = m_ctrlTreeOptions.InsertItem(GetResString(IDS_SMALL_FILE_SIZE), TREEOPTSCTRLIMG_EDIT, TREEOPTSCTRLIMG_EDIT, m_UploadTweaks);
		m_ctrlTreeOptions.AddEditBox(m_htiSmallFileSize, RUNTIME_CLASS(CNumTreeOptionsEdit));
        //<<< WiZaRd::Small File Slot

		//>>Matrik Conchecker
		//>>> WiZaRd::ConChecker [eWombat]
		m_htiConcheckerGroup = m_ctrlTreeOptions.InsertGroup(GetResString(IDS_CONCHECKER), iImgConchecker, m_htiSomTamMod);
		m_ctrlTreeOptions.SetItemState(m_htiConcheckerGroup, TVIS_BOLD, TVIS_BOLD);
		// Added by MoNKi [ SlugFiller: -lowIdRetry- ]
		m_htiLowIdRetry = m_ctrlTreeOptions.InsertItem(_T("LowID retries"), TREEOPTSCTRLIMG_EDIT, TREEOPTSCTRLIMG_EDIT, m_htiConcheckerGroup);
		m_ctrlTreeOptions.AddEditBox(m_htiLowIdRetry, RUNTIME_CLASS(CNumTreeOptionsEdit));
		// End SlugFiller
		m_htiConcheckerActive = m_ctrlTreeOptions.InsertCheckBox(GetResString(IDS_CONCHECKER_ACTIVE), m_htiConcheckerGroup, m_bConcheckerActive);
		m_htiConcheckerPingtypeRadio = m_ctrlTreeOptions.InsertGroup(GetResString(IDS_CONCHECKER_PINGMETHOD), iImgPingMethod, m_htiConcheckerGroup);
		m_ctrlTreeOptions.SetItemState(m_htiConcheckerPingtypeRadio, TVIS_BOLD, TVIS_BOLD);
		m_htiConcheckerPingICMP = m_ctrlTreeOptions.InsertRadioButton(GetResString(IDS_CONCHECKER_ICMP), m_htiConcheckerPingtypeRadio, m_iConcheckerPingtype == 0);
		m_htiConcheckerPingRAW = m_ctrlTreeOptions.InsertRadioButton(GetResString(IDS_CONCHECKER_RAW), m_htiConcheckerPingtypeRadio, m_iConcheckerPingtype == 1);
		m_htiConcheckerTTL = m_ctrlTreeOptions.InsertItem(GetResString(IDS_CONCHECKER_TTL), TREEOPTSCTRLIMG_EDIT, TREEOPTSCTRLIMG_EDIT, m_htiConcheckerGroup);
		m_ctrlTreeOptions.AddEditBox(m_htiConcheckerTTL, RUNTIME_CLASS(CNumTreeOptionsEdit));
		m_htiConcheckerPingtimeout = m_ctrlTreeOptions.InsertItem(GetResString(IDS_CONCHECKER_TIMEOUT), TREEOPTSCTRLIMG_EDIT, TREEOPTSCTRLIMG_EDIT, m_htiConcheckerGroup);
		m_ctrlTreeOptions.AddEditBox(m_htiConcheckerPingtimeout, RUNTIME_CLASS(CNumTreeOptionsEdit));
        //<<< WiZaRd::ConChecker [eWombat]
			

}
	    m_ctrlTreeOptions.Expand(m_htiSomTamMod, TVE_EXPAND);  // Menu
        m_ctrlTreeOptions.Expand(m_AdditionalTweaks, TVE_EXPAND);
	    m_ctrlTreeOptions.Expand(m_UploadTweaks, TVE_EXPAND);
		m_ctrlTreeOptions.Expand(m_htiConcheckerGroup, TVE_EXPAND); //ConChecker
        m_ctrlTreeOptions.Expand(m_htiConcheckerPingtypeRadio, TVE_EXPAND); //ConChecker Ping
		m_ctrlTreeOptions.SendMessage(WM_VSCROLL, SB_TOP);
		m_bInitializedTreeOpts = true;

 ///////////////////////////////////////////////////////////////////////////////////
 

    
    DDX_TreeCheck(pDX, IDC_SOMTAMMOD, m_htiEnableDownloadInBold, m_bEnableDownloadInBold); //MORPH - Added by SiRoB, show download in Bold
	DDX_TreeCheck(pDX, IDC_SOMTAMMOD, m_htiUseSlotFocus, m_bUseSlotFocus); //>>> WiZaRd::SlotFocus
	DDX_TreeCheck(pDX, IDC_SOMTAMMOD, m_htiDirWatcher, m_bDirWatcher);	// Tux: Feature: Automatic shared files updater
    DDX_TreeCheck(pDX, IDC_SOMTAMMOD, m_htiShowSpeedMeter, m_bShowSpeedMeter); // High resulution speedmeter on toolbar [eFMod/Stulle] - Stulle
    //>>> JvA::SLS [enkeyDEV]
	DDX_TreeCheck(pDX, IDC_SOMTAMMOD, m_htiSLSCheck, m_bSLSCheck);
	DDX_TreeEdit(pDX, IDC_SOMTAMMOD, m_htiSLSActivationLimit, m_iSLSActivationLimit);
	DDX_TreeEdit(pDX, IDC_SOMTAMMOD, m_htiSLSSaveValue, m_iSLSSaveValue);
	DDV_MinMaxInt(pDX, m_iSLSActivationLimit, 0, 100);
	DDV_MinMaxInt(pDX, m_iSLSSaveValue, 0, 50);
//<<< JvA::SLS [enkeyDEV]
	//>>> WiZaRd::Small File Slot
	DDX_TreeEdit(pDX, IDC_SOMTAMMOD, m_htiSmallFileSize, m_uiSmallFileSize);
	DDV_MinMaxInt(pDX, m_uiSmallFileSize, 50, 2048);
//<<< WiZaRd::Small File Slot

	// Added by MoNKi [ SlugFiller: -lowIdRetry- ]
	DDX_TreeEdit(pDX, IDC_SOMTAMMOD, m_htiLowIdRetry, m_iLowIdRetry);
	DDV_MinMaxInt(pDX, m_iLowIdRetry, 0, 255);
	// End SlugFiller

	//>>> WiZaRd::ConChecker [eWombat]
	DDX_TreeCheck(pDX, IDC_SOMTAMMOD, m_htiConcheckerActive, m_bConcheckerActive);	
	DDX_TreeEdit(pDX, IDC_SOMTAMMOD, m_htiConcheckerTTL, m_iConcheckerTTL);
	DDV_MinMaxInt(pDX, m_iConcheckerTTL, 8, 64);
	DDX_TreeEdit(pDX, IDC_SOMTAMMOD, m_htiConcheckerPingtimeout, m_iConcheckerPingtimeout);
	DDV_MinMaxInt(pDX, m_iConcheckerPingtimeout, 1, 64);
	DDX_TreeRadio(pDX, IDC_SOMTAMMOD, m_htiConcheckerPingtypeRadio, m_iConcheckerPingtype); 
//<<< WiZaRd::ConChecker [eWombat]
	DDX_TreeCheck(pDX, IDC_SOMTAMMOD, m_htiShowIconPreview, m_bShowIconPreview); //>Matrik >Show Icon Preview When is Ready


}
///////////////////////////////////////////////////////////////////////////////
//OnInitDialog
//
BOOL CPPgSomTamMod::OnInitDialog()
{

CPropertyPage::OnInitDialog();
	InitWindowStyles(this);
	
	m_bEnableDownloadInBold = thePrefs.m_bShowActiveDownloadsBold; //MORPH - Added by SiRoB, show download in Bold
	m_bUseSlotFocus = thePrefs.IsUseSlotFocus(); //>>> WiZaRd::SlotFocus
	m_bDirWatcher = thePrefs.GetDirectoryWatcher();	// Tux: Feature: Automatic shared files updater
    m_bShowSpeedMeter = thePrefs.GetShowSpeedMeter(); // High resulution speedmeter on toolbar [eFMod/Stulle] - Stulle
	//>>> JvA::SLS [enkeyDEV]
	m_bSLSCheck = thePrefs.UseSaveLoadSources();
	m_iSLSActivationLimit = thePrefs.GetActivationLimitSLS();
	m_iSLSSaveValue = thePrefs.GetSourcesToSaveSLS();
    //<<< JvA::SLS [enkeyDEV]

	m_uiSmallFileSize = thePrefs.GetSmallFileSize(); //>>> WiZaRd::Small File Slot

	// Added by MoNKi [ SlugFiller: -lowIdRetry- ]
	m_iLowIdRetry = thePrefs.GetLowIdRetries();
	// End SlugFiller

	//>>> WiZaRd::ConChecker [eWombat]
	m_bConcheckerActive = thePrefs.GetCheckCon();	
	m_iConcheckerTTL = thePrefs.GetPingTTL();
	m_iConcheckerPingtimeout = thePrefs.GetPingTimeout();
	m_iConcheckerPingtype = thePrefs.GetICMP() ? 0 : 1; 
    //<<< WiZaRd::ConChecker [eWombat]

	m_bShowIconPreview = thePrefs.GetShowIconPreview(); //>Matrik >Show Icon Preview When is Ready
			
	CPropertyPage::OnInitDialog();
	LoadSettings();//
	InitWindowStyles(this);
	Localize();
	return TRUE;   // retourne TRUE  sauf si vous avez défini le focus sur un contrôle
}
	

///////////////////////////////////////////////////////////////////////////////
//OnApply
//

BOOL CPPgSomTamMod::OnApply(){
		CString sBuffer;

	thePrefs.m_bShowActiveDownloadsBold = m_bEnableDownloadInBold; //MORPH - Added by SiRoB, show download in Bold
	thePrefs.SetUseSlotFocus(m_bUseSlotFocus); //>>> WiZaRd::SlotFocus	
	// ==> High resulution speedmeter on toolbar [eFMod/Stulle] - Stulle
	if(m_bShowSpeedMeter != thePrefs.GetShowSpeedMeter())
	{
		thePrefs.m_bShowSpeedMeter = m_bShowSpeedMeter;
		theApp.emuledlg->toolbar->ShowSpeedMeter(m_bShowSpeedMeter);
	}
	// <== High resulution speedmeter on toolbar [eFMod/Stulle] - Stulle

	// Tux: Feature: Automatic shared files updater [start]
	if (thePrefs.m_bDirectoryWatcher != m_bDirWatcher) {
		thePrefs.m_bDirectoryWatcher = m_bDirWatcher;
		theApp.ResetDirectoryWatcher();
	}
	// Tux: Feature: Automatic shared files updater [end]

	//>>> JvA::SLS [enkeyDEV]
	thePrefs.SetSaveLoadSource(m_bSLSCheck);
	thePrefs.SetActivationLimitSLS((uint8)m_iSLSActivationLimit);
	thePrefs.SetSourcesToSaveSLS((uint8)m_iSLSSaveValue);
    //<<< JvA::SLS [enkeyDEV]

	//>>> WiZaRd::Small File Slot
	thePrefs.SetSmallFileSize((uint16)m_uiSmallFileSize);
    //<<< WiZaRd::Small File Slot

	thePrefs.m_bShowIconPreview = m_bShowIconPreview; //>Matrik >Show Icon Preview When is Ready

	// Added by MoNKi [ SlugFiller: -lowIdRetry- ]
	if(m_iLowIdRetry<0)
		m_iLowIdRetry = 0;
	if(m_iLowIdRetry>255)
		m_iLowIdRetry = 255;
	thePrefs.LowIdRetries = m_iLowIdRetry;
	// End SlugFiller

	//>>> WiZaRd::ConChecker [eWombat]
	const bool bSetPrefs = m_iConcheckerTTL != thePrefs.GetPingTTL()
		|| m_iConcheckerPingtimeout != thePrefs.GetPingTimeout()
		|| (uint8)m_iConcheckerPingtype != (thePrefs.GetICMP() ? 0 : 1);
	thePrefs.SetPingTTL((uint8)m_iConcheckerTTL);
	thePrefs.SetPingTimeout((uint8)m_iConcheckerPingtimeout);
	thePrefs.SetICMP(m_iConcheckerPingtype == 0); 
	if(m_bConcheckerActive != thePrefs.GetCheckCon())
	{
		thePrefs.SetCheckCon(m_bConcheckerActive);
		if(m_bConcheckerActive)
			theApp.conchecker.Start();
		else
			theApp.conchecker.Stop();
	}
	else if(bSetPrefs)
		theApp.conchecker.SetPreferences();
    //<<< WiZaRd::ConChecker [eWombat]

	//Xman Funny-Nick (Stulle/Morph)
	thePrefs.SetDisplayFunnyNick(IsDlgButtonChecked(IDC_FUNNYNICK)!=0);
	//Xman end

		
	SetModified();
	return CPropertyPage::OnApply();
}
///////////////////////////////////////////////////////////////////////////////
//Localize
//

void CPPgSomTamMod::Localize(void)
{
	
	if (m_hWnd)
	{

		CString buffer;//Test

    if (m_htiEnableDownloadInBold) m_ctrlTreeOptions.SetItemText(m_htiEnableDownloadInBold, GetResString(IDS_DOWNLOAD_IN_BOLD)); //MORPH - Added by SiRoB, show download in Bold
    if (m_htiUseSlotFocus) m_ctrlTreeOptions.SetItemText(m_htiUseSlotFocus, GetResString(IDS_SLOTFOCUS)); //>>> WiZaRd::SlotFocus
    if (m_htiShowSpeedMeter) m_ctrlTreeOptions.SetItemText(m_htiShowSpeedMeter, GetResString(IDS_SHOW_SPEED_METER)); // High resulution speedmeter on toolbar [eFMod/Stulle] - Stulle
	
        //>>> JvA::SLS [enkeyDEV]
		if(m_htiSLSGroup) m_ctrlTreeOptions.SetItemText(m_htiSLSGroup, GetResString(IDS_SLSLABEL));
		if(m_htiSLSCheck) m_ctrlTreeOptions.SetItemText(m_htiSLSCheck, GetResString(IDS_SLSCHECKLABEL));
		if(m_htiSLSActivationLimit) m_ctrlTreeOptions.SetEditLabel(m_htiSLSActivationLimit, GetResString(IDS_SLSACTIVATIONLABEL));
		if(m_htiSLSSaveValue) m_ctrlTreeOptions.SetEditLabel(m_htiSLSSaveValue, GetResString(IDS_SLSSAVEVALUE));
        //<<< JvA::SLS [enkeyDEV]

	if (m_htiSmallFileSize) m_ctrlTreeOptions.SetEditLabel(m_htiSmallFileSize, GetResString(IDS_SMALL_FILE_SIZE)); //>>> WiZaRd::Small File
	

	// Added by MoNKi [ SlugFiller: -lowIdRetry- ]
		if(m_htiLowIdRetry)
			m_ctrlTreeOptions.SetEditLabel(m_htiLowIdRetry, GetResString(IDS_RECONNECTONLOWID));
		// End SlugFiller
		//>Matrik >Show Icon Preview When is Ready
		if(m_htiShowIconPreview)
			m_ctrlTreeOptions.SetEditLabel(m_htiShowIconPreview, GetResString(IDS_SHOW_ICON_PREVIEW));
		//<Matrik

	//>>> WiZaRd::ConChecker [eWombat]
		if (m_htiConcheckerGroup)		m_ctrlTreeOptions.SetItemText(m_htiConcheckerGroup, GetResString(IDS_CONCHECKER));
		if (m_htiConcheckerActive)		m_ctrlTreeOptions.SetItemText(m_htiConcheckerActive, GetResString(IDS_CONCHECKER_ACTIVE));
		if (m_htiConcheckerPingtypeRadio) m_ctrlTreeOptions.SetItemText(m_htiConcheckerPingtypeRadio, GetResString(IDS_CONCHECKER_PINGMETHOD));
		if (m_htiConcheckerPingICMP)	m_ctrlTreeOptions.SetItemText(m_htiConcheckerPingICMP, GetResString(IDS_CONCHECKER_ICMP));
		if (m_htiConcheckerPingRAW)		m_ctrlTreeOptions.SetItemText(m_htiConcheckerPingRAW, GetResString(IDS_CONCHECKER_RAW));
		if (m_htiConcheckerTTL)			m_ctrlTreeOptions.SetEditLabel(m_htiConcheckerTTL, GetResString(IDS_CONCHECKER_TTL));
		if (m_htiConcheckerPingtimeout) m_ctrlTreeOptions.SetEditLabel(m_htiConcheckerPingtimeout, GetResString(IDS_CONCHECKER_TIMEOUT));
//<<< WiZaRd::ConChecker [eWombat]

		//Xman Funny-Nick (Stulle/Morph)
		GetDlgItem(IDC_FUNNYNICK_GROUP)->SetWindowText(GetResString(IDS_FUNNYNICK_GROUP));
		SetDlgItemText(IDC_FUNNYNICK,GetResString(IDS_FUNNYNICK));
		//Xman end
				
	
	}
}

////////////////////////////////////// OnApply //////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////
//OnDestroy
//

void CPPgSomTamMod::OnDestroy()
{	
	m_ctrlTreeOptions.DeleteAllItems();
	m_ctrlTreeOptions.DestroyWindow();
	m_bInitializedTreeOpts = false;

	m_htiEnableDownloadInBold = NULL; //MORPH - Added by SiRoB, show download in Bold
	m_htiUseSlotFocus = NULL; //>>> WiZaRd::SlotFocus
    // Tux: Feature: Automatic shared files updater [start]
	m_htiDirWatcher = NULL;
	m_bDirWatcher = false;
	// Tux: Feature: Automatic shared files updater [end]

	m_htiShowSpeedMeter = NULL; // High resulution speedmeter on toolbar [eFMod/Stulle] - Stulle
	m_bShowSpeedMeter = false; //

	//>>> JvA::SLS [enkeyDEV]
	m_htiSLSGroup = NULL;
	m_htiSLSCheck = NULL;
	m_htiSLSActivationLimit = NULL;
	m_htiSLSSaveValue = NULL;
	m_bSLSCheck = false;
	m_iSLSActivationLimit = 0;
	m_iSLSSaveValue = 0;
    //<<< JvA::SLS [enkeyDEV]

	//>>> WiZaRd::Small File Slot
	m_htiSmallFileSize = NULL;
	m_uiSmallFileSize = 0;
    //<<< WiZaRd::Small File Slot

	// Added by MoNKi [ SlugFiller: -lowIdRetry- ]
	m_htiLowIdRetry = NULL;
	// End SlugFiller

	//>>> WiZaRd::ConChecker [eWombat]
	m_htiConcheckerGroup = NULL;
	m_htiConcheckerActive = NULL;
	m_htiConcheckerPingtypeRadio = NULL;
	m_htiConcheckerPingICMP = NULL;
	m_htiConcheckerPingRAW = NULL;
	m_htiConcheckerTTL = NULL;
	m_htiConcheckerPingtimeout = NULL;
	m_bConcheckerActive = false;
	m_iConcheckerPingtype = 0;
	m_iConcheckerTTL = 0;
	m_iConcheckerPingtimeout = 0;
//<<< WiZaRd::ConChecker [eWombat]
	//>Matrik >Show Icon Preview When is Ready
	m_htiShowIconPreview = NULL; //
	m_bShowIconPreview = false; //Test
	//<Matrik


	
	CPropertyPage::OnDestroy();
}
///////////////////////////////////////////////////////////////////////////////
//Null
//
/*
void CPPgNissa::SetNull()
{

}
*/

///////////////////////////////////////////////////////////////////////////////
//Loadsetting
//

void CPPgSomTamMod::LoadSettings(void)
{
	if(m_hWnd)
	{
		CString strBuffer;

		CheckDlgButton(IDC_FUNNYNICK, thePrefs.DisplayFunnyNick()); //Xman Funny-Nick (Stulle/Morph)

	}
		
	}

	    	
///////////////////////////////////////////////////////////////////////////////
//OnKillActive
//
BOOL CPPgSomTamMod::OnKillActive()
{
	
	
	
	m_ctrlTreeOptions.HandleChildControlLosingFocus();
	return CPropertyPage::OnKillActive();

}



LRESULT CPPgSomTamMod::OnTreeOptsCtrlNotify(WPARAM wParam,LPARAM /*lParam*/)
{
	if (wParam == IDC_SOMTAMMOD)
	{
		//TREEOPTSCTRLNOTIFY* pton = (TREEOPTSCTRLNOTIFY*)lParam;
		SetModified();
	}
	return 0;
}

//void CPPgSomTamMod::OnHScroll(UINT /*nSBCode*/, UINT /*nPos*/, CScrollBar* pScrollBar) 
/*{

		// <CB Mod : NiceHash : Prefs>
#ifdef CB_MOD_NICEHASH_ENABLED
	 if (pScrollBar->GetSafeHwnd() == m_ctlNiceHashLoadWeight.m_hWnd) {
		m_iNiceHashLoadWeight = ((CSliderCtrl*)pScrollBar)->GetPos()*10;
		CString temp;
		temp.Format(_T("%s: %s%%"), GetResString(IDS_NICEHASH_CPULOAD), GetFormatedUInt(m_iNiceHashLoadWeight));
		GetDlgItem(IDC_NICEHASH_STATIC)->SetWindowText(temp);
		SetModified(TRUE);
	}
#endif
	// </CB Mod : NiceHash : Prefs>

	SetModified(TRUE);
	UpdateData(false); 
	//CPropertyPage::OnHScroll(nSBCode, nPos, pScrollBar);
}
*/

/*
void CPPgNissa::OnTvnSelchangedMATOpts(NMHDR *pNMHDR, LRESULT *pResult)
{
	LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);
	// TODO: Add your control notification handler code here
	*pResult = 0;
}
*/
/*
void CPPgNissa::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) 
{
*/

/*

void CPPgNissa::OnBnClickedButton1()
{
   TCHAR forum[256];
_tcscpy (forum, _T("http://www.emule-forum.com"));
ShellExecute(NULL, NULL, forum, NULL, thePrefs.GetAppDir(), SW_SHOWDEFAULT); 
}
//<--Nissa

*/