예제 #1
0
BOOL CAboutDlg::OnInitDialog()
{
	CSkinDialog::OnInitDialog();

	SkinMe( _T("CAboutDlg"), IDR_MAINFRAME );

	// Short version
	SetWindowText( _T(CLIENT_NAME) _T(" ") + theApp.m_sVersion );

	// Long version
	m_wndTitle.SetWindowText( _T(CLIENT_NAME) _T(" ") + theApp.m_sVersionLong );

	DWORD dwSize = GetFileVersionInfoSize( theApp.m_strBinaryPath, &dwSize );
	BYTE* pBuffer = new BYTE[ dwSize ];
	GetFileVersionInfo( theApp.m_strBinaryPath, NULL, dwSize, pBuffer );

	BYTE* pValue = NULL;
	CString strCopyRight;

	if ( VerQueryValue( pBuffer, L"\\StringFileInfo\\000004b0\\LegalCopyright", 
		 (void**)&pValue, (UINT*)&dwSize ) )
		strCopyRight = (LPCTSTR)pValue;

	delete [] pBuffer;

	CWnd* pWnd = GetDlgItem( IDC_COPYRIGHT );
	pWnd->SetWindowText( (LPCTSTR)strCopyRight );

	return TRUE;
}
예제 #2
0
BOOL CMediaVisDlg::OnInitDialog()
{
	CString strMessage;

	CSkinDialog::OnInitDialog();

	SkinMe( L"CMediaVisDlg", ID_MEDIA_VIS );

	CRect rc;
	m_wndList.GetClientRect( &rc );
	rc.right -= GetSystemMetrics( SM_CXVSCROLL ) + 1;

	CoolInterface.SetImageListTo( m_wndList, LVSIL_SMALL );
	m_wndList.InsertColumn( 0, L"Description", LVCFMT_LEFT, rc.right, -1 );
	m_wndList.InsertColumn( 1, L"CLSID", LVCFMT_LEFT, 0, 0 );
	m_wndList.InsertColumn( 2, L"Subpath", LVCFMT_LEFT, 0, 1 );

	m_wndList.SetExtendedStyle( LVS_EX_FULLROWSELECT );

	m_nIcon = CoolInterface.ImageForID( ID_MEDIA_VIS );
	m_hIcon = CoolInterface.ExtractIcon( ID_MEDIA_VIS, FALSE );
	if ( m_hIcon )
		SetIcon( m_hIcon, FALSE );

	LoadString( strMessage, IDS_MEDIAVIS_NOVIS );
	AddPlugin( strMessage, NULL, NULL );
	Enumerate();

	m_nSize = Settings.MediaPlayer.VisSize + 1;
	UpdateData( FALSE );

	m_wndSetup.EnableWindow( m_wndList.GetSelectedCount() == 1 );

	return TRUE;
}
예제 #3
0
BOOL CGraphListDlg::OnInitDialog()
{
	CSkinDialog::OnInitDialog();

	SkinMe( _T("CGraphListDlg"), IDR_TRAFFICFRAME );

	m_gdiImageList.Create( IDB_COLOURDOT, 16, 0, RGB(0,255,0) );
	m_wndList.SetImageList( &m_gdiImageList, LVSIL_SMALL );

	m_wndSpeed.SendMessage( UDM_SETRANGE32, SPEED_MINIMUM, 120000 );

	m_bShowAxis		= m_pGraph->m_bShowAxis;
	m_bShowGrid		= m_pGraph->m_bShowGrid;
	m_bShowLegend	= m_pGraph->m_bShowLegend;
	m_nSpeed		= max( m_pGraph->m_nSpeed, SPEED_MINIMUM );

	UpdateData( FALSE );

	for ( POSITION pos = m_pGraph->GetItemIterator() ; pos ; )
	{
		CGraphItem* pItem = m_pGraph->GetNextItem( pos );
		CLiveItem* pLive = PrepareItem( pItem );
		pLive->Add( &m_wndList, -1, LIST_COLUMNS );
		delete pLive;
	}

	OnItemChangedGraphItems( NULL, NULL );

	return TRUE;
}
예제 #4
0
BOOL CDownloadDlg::OnInitDialog()
{
	CSkinDialog::OnInitDialog();

	SkinMe( NULL, IDR_DOWNLOADSFRAME );

	if ( OpenClipboard() )
	{
		if ( HGLOBAL hData = GetClipboardData( CF_UNICODETEXT ) )
		{
			size_t nData = GlobalSize( hData );
			LPVOID pData = GlobalLock( hData );

			LPTSTR pszData = m_sURL.GetBuffer( (int)( nData + 1 ) / 2 + 1 );
			CopyMemory( pszData, pData, nData );
			pszData[ ( nData + 1 ) / 2 ] = 0;
			m_sURL.ReleaseBuffer();
			GlobalUnlock( hData );
		}

		CloseClipboard();
	}

	m_sURL.Trim( _T(" \t\r\n") );

	CShareazaURL pURL;
	if ( !pURL.Parse( m_sURL, m_pURLs ) )
		m_sURL.Empty();

	UpdateData( FALSE );
	OnChangeURL();

	return TRUE;
}
예제 #5
0
BOOL CFilePreviewDlg::OnInitDialog() 
{
	CSkinDialog::OnInitDialog();
	
	SkinMe( NULL, ID_DOWNLOADS_LAUNCH_COPY );
	
	m_nRange	= 100;
	m_nPosition	= 0;
	m_nScaled	= m_nOldScaled = 0;
	
	if ( theApp.m_bRTL ) m_wndProgress.ModifyStyleEx( WS_EX_LAYOUTRTL, 0, 0 );
	m_wndStatus.GetWindowText( m_sStatus );	
	m_wndProgress.SetRange( 0, 1000 );
	m_wndProgress.SetPos( 0 );
	m_sOldStatus = m_sStatus;
	
	m_wndName.SetWindowText( m_sRemoteName );
	m_wndCancel.EnableWindow( FALSE );
	
	m_bThread = TRUE;
	m_bCancel = FALSE;
	
	CWinThread* pThread = AfxBeginThread( ThreadStart, this, THREAD_PRIORITY_NORMAL );
	m_hThread = pThread->m_hThread;
	
	return TRUE;
}
예제 #6
0
파일: DlgHex.cpp 프로젝트: ivan386/Shareaza
BOOL CHexDlg::OnInitDialog()
{
	CSkinDialog::OnInitDialog();

	SkinMe( _T("CHexDlg"), IDR_MAINFRAME );

	return TRUE;
}
BOOL CSaveFilterAsDlg::OnInitDialog()
{
	CSkinDialog::OnInitDialog();

	SkinMe( _T( "CSaveFilterAsDlg" ), IDR_SEARCHFRAME );

	return TRUE;
}
BOOL CTorrentTrackerDlg::OnInitDialog() 
{
	CSkinDialog::OnInitDialog();
	
	SetIcon( theApp.LoadIcon( IDR_MAINFRAME ), TRUE );
	SkinMe( _T("CTorrentTrackerDlg") );
	
	m_sName			= m_pInfo.m_sName;
	m_sTracker		= m_pInfo.m_sTracker;
	m_sComment		= m_pInfo.m_sComment;
	m_sCreatedBy	= m_pInfo.m_sCreatedBy;
	if ( m_pInfo.m_tCreationDate > 0 )
	{
		CTime pTime( (time_t)m_pInfo.m_tCreationDate );
		m_sCreationDate = pTime.Format( _T("%Y-%m-%d  %H:%M") );
	}
	
	
	CRect rc;
	m_wndFiles.GetClientRect( &rc );
	rc.right -= GetSystemMetrics( SM_CXVSCROLL );
	m_wndFiles.SetImageList( ShellIcons.GetObject( 16 ), LVSIL_SMALL );
	m_wndFiles.InsertColumn( 0, _T("Filename"), LVCFMT_LEFT, rc.right - 80, -1 );
	m_wndFiles.InsertColumn( 1, _T("Size"), LVCFMT_RIGHT, 80, 0 );
	Skin.Translate( _T("CTorrentTrackerList"), m_wndFiles.GetHeaderCtrl() );

	for ( int nFile = 0 ; nFile < m_pInfo.m_nFiles ; nFile++ )
	{
		CBTInfo::CBTFile* pFile = m_pInfo.m_pFiles + nFile;
		LV_ITEM pItem;
		
		ZeroMemory( &pItem, sizeof(pItem) );
		pItem.mask		= LVIF_TEXT|LVIF_IMAGE|LVIF_PARAM;
		pItem.iItem		= m_wndFiles.GetItemCount();
		pItem.lParam	= (LPARAM)nFile;
		pItem.iImage	= ShellIcons.Get( pFile->m_sPath, 16 );
		pItem.pszText	= (LPTSTR)(LPCTSTR)pFile->m_sPath;
		pItem.iItem		= m_wndFiles.InsertItem( &pItem );
		
		m_wndFiles.SetItemText( pItem.iItem, 1, Settings.SmartVolume( pFile->m_nSize, FALSE ) );
	}

	m_wndStartDownloads.SetItemData( 0, dtAlways );
	m_wndStartDownloads.SetItemData( 1, dtWhenRatio );
	m_wndStartDownloads.SetItemData( 2, dtNever );

	m_wndStartDownloads.SetCurSel( *m_pStartTorrentDownloads );
	
	UpdateData( FALSE );
	m_hThread = NULL;
	
	PostMessage( WM_COMMAND, MAKELONG( IDC_TORRENT_REFRESH, BN_CLICKED ), (LPARAM)m_wndRefresh.GetSafeHwnd() );

	return TRUE;
}
예제 #9
0
BOOL CIrcInputDlg::OnInitDialog()
{
	CSkinDialog::OnInitDialog();

	SkinMe( L"CIrcInputDlg", m_nCaptionIndex == 0 ? ID_IRC_ADD :
		( m_bKickOnly ? ID_IRC_KICKWHY : ID_IRC_BANKICKWHY ) );
	SelectCaption( this, m_nCaptionIndex );
	SelectCaption( &m_wndPrompt, m_nCaptionIndex );

	return TRUE;
}
예제 #10
0
BOOL CFolderScanDlg::OnInitDialog()
{
	CSkinDialog::OnInitDialog();

	SkinMe( _T("CFolderScanDlg"), IDR_LIBRARYFRAME );

	CQuickLock oLock( m_pSection );
	m_pDialog = this;
	m_nCookie = Library.GetScanCount();

	SetTimer( 1, 250, NULL );

	return TRUE;
}
BOOL CDonkeyServersDlg::OnInitDialog()
{
	CSkinDialog::OnInitDialog();

	SkinMe( _T("CDonkeyServersDlg") );

	m_sURL = Settings.eDonkey.ServerListURL;
	UpdateData( FALSE );

	m_wndOK.EnableWindow( m_sURL.Find( _T("http://") ) == 0 );
	m_wndProgress.SetRange( 0, 100 );
	m_wndProgress.SetPos( 0 );

	return TRUE;
}
예제 #12
0
BOOL CUpdateServersDlg::OnInitDialog()
{
	CSkinDialog::OnInitDialog();

	SkinMe( _T("CUpdateServersDlg"), IDR_MAINFRAME );

	// Define dlg.m_URL = Settings.DC.HubListURL etc. before dlg.DoModal()
	if ( m_sURL.GetLength() < 12 )
		m_sURL = Settings.eDonkey.ServerListURL;

	m_wndOK.EnableWindow( IsValidURL() );
	m_wndProgress.SetRange( 0, 100 );
	m_wndProgress.SetPos( 0 );

	UpdateData( FALSE );

	return TRUE;
}
예제 #13
0
BOOL CDownloadMonitorDlg::OnInitDialog()
{
	CSkinDialog::OnInitDialog();

	SkinMe( _T("CDownloadMonitorDlg"), IDI_DOWNLOAD_MONITOR );

	CMenu* pMenu = GetSystemMenu( FALSE );
	pMenu->InsertMenu( 0, MF_BYPOSITION|MF_SEPARATOR, ID_SEPARATOR );
	pMenu->InsertMenu( 0, MF_BYPOSITION|MF_STRING, SC_NEXTWINDOW, _T("&Always on Top") );

	CSingleLock pLock( &Transfers.m_pSection, TRUE );

	if ( Downloads.Check( m_pDownload ) )
	{
		m_sName = m_pDownload->m_sName;
		m_wndIcon.SetIcon( ShellIcons.ExtractIcon(
			ShellIcons.Get( m_sName, 32 ), 32 ) );
		m_wndFile.SetWindowText( m_sName );
	}

	pLock.Unlock();

	m_pGraph	= new CLineGraph();
	m_pItem		= new CGraphItem( 0, 1.0f, RGB( 0xFF, 0, 0 ) );

	m_pGraph->m_bShowLegend		= FALSE;
	m_pGraph->m_bShowAxis		= FALSE;
	m_pGraph->m_crBack			= RGB( 255, 255, 240 );
	m_pGraph->m_crGrid			= RGB( 220, 220, 170 );
	m_pGraph->m_nMinGridVert	= 16;

	m_pGraph->AddItem( m_pItem );

	OnTimer( 1 );

	CenterWindow();
	ShowWindow( SW_SHOW );

	SetTimer( 1, 100, NULL );
	EnableToolTips();

	return TRUE;
}
예제 #14
0
BOOL CNewSearchDlg::OnInitDialog()
{
	CSkinDialog::OnInitDialog();

	SkinMe( _T("CNewSearchDlg"), IDR_SEARCHFRAME );

	SelectCaption( this, m_bLocal ? 2 : ( m_bAgain ? 1 : 0 ) );

	CRect rc;
	CString strText;
	m_wndSchema.Create( WS_CHILD|WS_VISIBLE|WS_BORDER|WS_TABSTOP, rc, this, IDC_METADATA );

	LoadString( strText, IDS_SEARCH_PLAIN_TEXT );
	m_wndSchemas.m_sNoSchemaText = strText;
	m_wndSchemas.Load( Settings.Search.LastSchemaURI );

	m_wndSchemas.Select( m_pSearch->m_pSchema );

	OnSelChangeSchemas();

	if ( m_pSearch->m_pXML )
	{
		m_wndSchema.UpdateData( m_pSearch->m_pXML->GetFirstElement(), FALSE );
	}

	Settings.LoadWindow( _T("NewSearch"), this );

	OnCloseUpSchemas();
	
	if ( m_pSearch->m_oSHA1 )
	{
		m_wndSearch.SetWindowText( m_pSearch->m_oSHA1.toUrn() );
		m_wndSchema.ShowWindow( SW_HIDE );
	}
	else
	{
		m_wndSearch.SetWindowText( m_pSearch->m_sSearch );
	}

	if ( m_wndSchemas.GetCurSel() > 0 ) m_wndSchemas.SetFocus();

	return FALSE;
}
예제 #15
0
BOOL CShareManagerDlg::OnInitDialog()
{
	CSkinDialog::OnInitDialog();

	SkinMe( L"CShareManagerDlg", IDR_LIBRARYFRAME );

	CRect rc;
	m_wndList.GetClientRect( &rc );
	m_wndList.SetExtendedStyle( LVS_EX_DOUBLEBUFFER|LVS_EX_TRANSPARENTBKGND|LVS_EX_FULLROWSELECT|LVS_EX_LABELTIP|LVS_EX_CHECKBOXES );
	m_wndList.InsertColumn( 0, _T("Folder"), LVCFMT_LEFT, rc.right - GetSystemMetrics( SM_CXVSCROLL ) );
	m_wndList.EnableToolTips( TRUE );
	ShellIcons.AttachTo( &m_wndList, 16 );	// m_wndList.SetImageList()

	if ( m_wndList.SetBkImage( Skin.GetWatermark( _T("CListCtrl") ) ) )		// || m_wndList.SetBkImage( Images.m_bmSystemWindow.m_hObject )		"System.Windows"
		m_wndList.SetExtendedStyle( LVS_EX_FULLROWSELECT|LVS_EX_TRANSPARENTBKGND|LVS_EX_LABELTIP|LVS_EX_CHECKBOXES );	// No LVS_EX_DOUBLEBUFFER
	else
	{
		m_wndList.SetBkColor( Colors.m_crWindow );
		m_wndList.SetTextBkColor( Colors.m_crWindow );
	}

	m_wndList.SetTextColor( Colors.m_crText );

	{
		CQuickLock oLock( Library.m_pSection );

		for ( POSITION pos = LibraryFolders.GetFolderIterator() ; pos ; )
		{
			CLibraryFolder* pFolder = LibraryFolders.GetNextFolder( pos );

			m_wndList.InsertItem( LVIF_TEXT|LVIF_IMAGE, m_wndList.GetItemCount(),
				pFolder->m_sPath, 0, 0, SHI_FOLDER_OPEN, 0 );

			m_wndList.SetItemState( m_wndList.GetItemCount() - 1,
				UINT( ( pFolder->IsShared() != TRUE ? 1 : 2 ) << 12 ), LVIS_STATEIMAGEMASK );
		}
	}

	m_wndRemove.EnableWindow( FALSE );

	return TRUE;
}
예제 #16
0
BOOL CDownloadGroupDlg::OnInitDialog()
{
    CSkinDialog::OnInitDialog();

    SkinMe( _T("CDownloadGroupDlg") );

    LoadString( m_wndSchemas.m_sNoSchemaText, IDS_SEARCH_PANEL_AFT );
    m_wndSchemas.Load( m_pGroup->m_sSchemaURI );
    m_sOldSchemaURI = m_pGroup->m_sSchemaURI;

    m_wndBrowse.SetCoolIcon( IDI_BROWSE, Settings.General.LanguageRTL );
    m_wndCancel.SetCoolIcon( IDI_FAKE, Settings.General.LanguageRTL );

    CSingleLock pLock( &DownloadGroups.m_pSection, TRUE );

    if ( ! DownloadGroups.Check( m_pGroup ) )
    {
        EndDialog( IDCANCEL );
        return TRUE;
    }

    m_sName		= m_pGroup->m_sName;
    m_sFolder	= m_pGroup->m_sFolder;
    m_bTorrent	= m_pGroup->m_bTorrent;

    for ( POSITION pos = m_pGroup->m_pFilters.GetHeadPosition() ; pos ; )
    {
        m_wndFilterList.AddString( m_pGroup->m_pFilters.GetNext( pos ) );
    }

    UpdateData( FALSE );

    BOOL bSuper = DownloadGroups.GetSuperGroup() == m_pGroup;

    m_wndFolder.EnableWindow( ! bSuper );
    m_wndFilterList.EnableWindow( ! bSuper );
    m_wndFilterAdd.EnableWindow( m_wndFilterList.GetWindowTextLength() > 0 );
    m_wndFilterRemove.EnableWindow( m_wndFilterList.GetCurSel() >= 0 );

    return TRUE;
}
예제 #17
0
BOOL CFilterSearchDlg::OnInitDialog()
{
	CSkinDialog::OnInitDialog();

	SkinMe( _T("CFilterSearchDlg"), IDR_SEARCHFRAME );

	if ( m_pMatches != NULL ) 
	{
		m_pResultFilters = m_pMatches->m_pResultFilters;
		m_pResultFilters->Load();
		UpdateList();
		UpdateFields();
	}

	ASSERT( m_pResultFilters != NULL );

	m_wndSources.SetRange( 0, 256 );

	UpdateData( FALSE );

	return TRUE;
}
예제 #18
0
BOOL CCloseModeDlg::OnInitDialog()
{
	CSkinDialog::OnInitDialog();

	SkinMe( _T("CCloseModeDlg") );

	switch ( Settings.General.CloseMode )
	{
	case 0: case 2:
		m_nMode = 0;
		break;
	case 1:
		m_nMode = 1;
		break;
	case 3:
		m_nMode = 2;
		break;
	}

	UpdateData( FALSE );

	return TRUE;
}
예제 #19
0
BOOL CExistingFileDlg::OnInitDialog()
{
	CSkinDialog::OnInitDialog();

	SkinMe( L"CExistingFileDlg", IDR_DOWNLOADSFRAME );

	if ( m_bAvailable == TRI_UNKNOWN )
		m_nAction = 1;
	else if ( m_bAvailable == TRI_TRUE )
		m_nAction = 0;

	UpdateData( FALSE );

	m_wndComments.ShowWindow( ! m_sComments.IsEmpty() ? SW_SHOW : SW_HIDE );
	m_wndMessageAvailable.ShowWindow( m_bAvailable == TRI_FALSE ? SW_SHOW : SW_HIDE );
	m_wndMessageDeleted.ShowWindow( m_bAvailable != TRI_UNKNOWN ? SW_HIDE : SW_SHOW );
	m_wndMessageDuplicates.ShowWindow( m_bAvailable == TRI_TRUE ? SW_SHOW : SW_HIDE );
	m_wndDownload.ShowWindow( m_bAvailable == TRI_TRUE ? SW_HIDE : SW_SHOW );
	m_wndDontDownload.ShowWindow( m_bAvailable == TRI_TRUE ? SW_HIDE : SW_SHOW );
	m_wndLocate.EnableWindow( m_bAvailable != TRI_UNKNOWN );

	return TRUE;
}
예제 #20
0
BOOL CQueuePropertiesDlg::OnInitDialog()
{
	CSkinDialog::OnInitDialog();

	SkinMe( _T("CQueuePropertiesDlg"), ID_VIEW_UPLOADS );

	m_wndTransfersMin.SetRange( 1, 128 );
	m_wndTransfersMax.SetRange( 1, 512 );
	m_wndRotateTimeSpin.SetRange( 30, 15 * 60 );

	CoolInterface.LoadIconsTo( m_gdiProtocols, protocolIDs );
	m_wndProtocols.SetImageList( &m_gdiProtocols, LVSIL_SMALL );

	m_wndProtocols.SetExtendedStyle( LVS_EX_CHECKBOXES );
	m_wndProtocols.InsertItem( LVIF_TEXT|LVIF_IMAGE|LVIF_PARAM, 0, _T("HTTP"), 0, 0, PROTOCOL_HTTP, PROTOCOL_HTTP );
	m_wndProtocols.InsertItem( LVIF_TEXT|LVIF_IMAGE|LVIF_PARAM, 1, _T("ED2K"), 0, 0, PROTOCOL_ED2K, PROTOCOL_ED2K );
	m_wndProtocols.InsertItem( LVIF_TEXT|LVIF_IMAGE|LVIF_PARAM, 2, _T("DC++"), 0, 0, PROTOCOL_DC, PROTOCOL_DC );
	m_wndProtocols.InsertItem( LVIF_TEXT|LVIF_IMAGE|LVIF_PARAM, 3, _T("BitTorrent"), 0, 0, PROTOCOL_BT, PROTOCOL_BT );

	CSingleLock pLock( &UploadQueues.m_pSection, TRUE );

	if ( ! UploadQueues.Check( m_pQueue ) )
	{
		PostMessage( WM_CLOSE );
		return TRUE;
	}

	m_sName = m_pQueue->m_sName;

	m_nFileStatusFlag = m_pQueue->m_nFileStateFlag;

	if ( m_nFileStatusFlag == CUploadQueue::ulqPartial )
	{
		m_wndPartialOnly.SetCheck(BST_CHECKED);
		m_wndLibraryOnly.SetCheck(BST_UNCHECKED);
		m_wndBoth.SetCheck(BST_UNCHECKED);
	}
	else if ( m_nFileStatusFlag == CUploadQueue::ulqLibrary )
	{
		m_wndPartialOnly.SetCheck(BST_UNCHECKED);
		m_wndLibraryOnly.SetCheck(BST_CHECKED);
		m_wndBoth.SetCheck(BST_UNCHECKED);
	}
	else
	{
		m_wndPartialOnly.SetCheck(BST_UNCHECKED);
		m_wndLibraryOnly.SetCheck(BST_UNCHECKED);
		m_wndBoth.SetCheck(BST_CHECKED);
	}

	m_bMinSize = m_pQueue->m_nMinSize > 0;
	m_sMinSize = Settings.SmartVolume( m_bMinSize ? m_pQueue->m_nMinSize : 0 );

	m_bMaxSize = m_pQueue->m_nMaxSize < SIZE_UNKNOWN;
	m_sMaxSize = Settings.SmartVolume( m_bMaxSize ? m_pQueue->m_nMaxSize : 0 );

	m_bMarked = ( ! m_pQueue->m_sShareTag.IsEmpty() );
	m_sMarked = m_pQueue->m_sShareTag;

	m_bMatch = ( ! m_pQueue->m_sNameMatch.IsEmpty() );
	m_sMatch = m_pQueue->m_sNameMatch;

	m_bProtocols = ( m_pQueue->m_nProtocols != 0 );

	if ( ! m_bProtocols || ( m_pQueue->m_nProtocols & (1<<PROTOCOL_HTTP) ) )
		m_wndProtocols.SetItemState( 0, INDEXTOSTATEIMAGEMASK(2), LVIS_STATEIMAGEMASK );
	if ( ! m_bProtocols || ( m_pQueue->m_nProtocols & (1<<PROTOCOL_ED2K) ) )
		m_wndProtocols.SetItemState( 1, INDEXTOSTATEIMAGEMASK(2), LVIS_STATEIMAGEMASK );
	if ( ! m_bProtocols || ( m_pQueue->m_nProtocols & (1<<PROTOCOL_DC) ) )
		m_wndProtocols.SetItemState( 2, INDEXTOSTATEIMAGEMASK(2), LVIS_STATEIMAGEMASK );
	if ( ! m_bProtocols || ( m_pQueue->m_nProtocols & (1<<PROTOCOL_BT) ) )
		m_wndProtocols.SetItemState( 3, INDEXTOSTATEIMAGEMASK(2), LVIS_STATEIMAGEMASK );

	m_bEnable		= m_pQueue->m_bEnable || m_bEnableOverride;

	m_nCapacity		= max( m_pQueue->m_nCapacity, m_pQueue->m_nMaxTransfers );
	m_nTransfersMin	= m_pQueue->m_nMinTransfers;
	m_nTransfersMax	= m_pQueue->m_nMaxTransfers;

	m_bRotate		= m_pQueue->m_bRotate;
	m_nRotateTime	= m_pQueue->m_nRotateTime;

	m_bReward		= m_pQueue->m_bRewardUploaders;

	//DWORD nTotal = Settings.Connection.OutSpeed * 1024 / 8;
	//DWORD nLimit = Settings.Bandwidth.Uploads;
	//if ( nLimit == 0 || nLimit > nTotal ) nLimit = nTotal;

	int nOtherPoints = (int)UploadQueues.GetTotalBandwidthPoints( !( m_pQueue->m_nProtocols & (1<<PROTOCOL_ED2K) ) )
						- (int)m_pQueue->m_nBandwidthPoints;
	if ( nOtherPoints < 0 ) nOtherPoints = 0;

	m_wndBandwidthSlider.SetRange( 1, max( 100, nOtherPoints * 3 ) );
	m_wndBandwidthSlider.SetPos( m_pQueue->m_nBandwidthPoints );

	UpdateData( FALSE );

	m_wndPartialOnly.EnableWindow(TRUE);
	m_wndLibraryOnly.EnableWindow(TRUE);
	m_wndBoth.EnableWindow(TRUE);

	m_wndMinSize.EnableWindow( m_bMinSize );
	m_wndMaxSize.EnableWindow( m_bMaxSize );
	m_wndMarked.EnableWindow( m_bMarked );
	m_wndMatch.EnableWindow( m_bMatch );
	m_wndProtocols.EnableWindow( m_bProtocols );
	m_wndRotateTime.EnableWindow( m_bRotate );
	m_wndRotateTimeSpin.EnableWindow( m_bRotate );
	m_wndCapacity.SetRange32( static_cast< int >( m_nTransfersMax ), 4096 );
	OnHScroll( 0, 0, NULL );

	if ( Settings.General.GUIMode == GUI_BASIC &&
		 !( Settings.eDonkey.EnableAlways | Settings.eDonkey.Enabled ) )
	{
		m_bProtocols = FALSE;
		m_wndProtocols.EnableWindow( FALSE );
		m_wndProtocols.ShowWindow( FALSE );

		(GetProtocolCheckbox())->EnableWindow( FALSE );
		(GetProtocolCheckbox())->ShowWindow( FALSE );
	}

	return TRUE;
}
BOOL CQueuePropertiesDlg::OnInitDialog()
{
	CSkinDialog::OnInitDialog();

	SkinMe( _T("CQueuePropertiesDlg"), ID_VIEW_UPLOADS );

	m_wndTransfersMin.SetRange( 1, 128 );
	m_wndTransfersMax.SetRange( 1, 512 );
	m_wndRotateTimeSpin.SetRange( 30, 15 * 60 );

	CBitmap bmProtocols;
	bmProtocols.LoadBitmap( IDB_PROTOCOLS );
	if ( theApp.m_bRTL ) 
		bmProtocols.m_hObject = CreateMirroredBitmap( (HBITMAP)bmProtocols.m_hObject );

	m_gdiProtocols.Create( 16, 16, ILC_COLOR32|ILC_MASK, 7, 1 );
	m_gdiProtocols.Add( &bmProtocols, RGB( 0, 255, 0 ) );

	m_wndProtocols.SendMessage( LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_CHECKBOXES, LVS_EX_CHECKBOXES );
	m_wndProtocols.SetImageList( &m_gdiProtocols, LVSIL_SMALL );
	m_wndProtocols.InsertItem( LVIF_TEXT|LVIF_IMAGE|LVIF_PARAM, 0, _T("HTTP"), 0, 0, PROTOCOL_HTTP, PROTOCOL_HTTP );
	m_wndProtocols.InsertItem( LVIF_TEXT|LVIF_IMAGE|LVIF_PARAM, 1, _T("ED2K"), 0, 0, PROTOCOL_ED2K, PROTOCOL_ED2K );

	CSingleLock pLock( &UploadQueues.m_pSection, TRUE );

	if ( ! UploadQueues.Check( m_pQueue ) )
	{
		PostMessage( WM_CLOSE );
		return TRUE;
	}

	m_sName = m_pQueue->m_sName;

	m_bPartial = m_pQueue->m_bPartial;

	if ( m_bMinSize = ( m_pQueue->m_nMinSize > 0 ) )
	{
		m_sMinSize = Settings.SmartVolume( m_pQueue->m_nMinSize, FALSE );
	}
	else
	{
		m_sMinSize = Settings.SmartVolume( 0, FALSE );
	}

	if ( m_bMaxSize = ( m_pQueue->m_nMaxSize < SIZE_UNKNOWN ) )
	{
		m_sMaxSize = Settings.SmartVolume( m_pQueue->m_nMaxSize, FALSE );
	}
	else
	{
		m_sMaxSize = Settings.SmartVolume( 0, FALSE );
	}

	m_bMarked = ( m_pQueue->m_sShareTag.GetLength() > 0 );
	m_sMarked = m_pQueue->m_sShareTag;

	m_bMatch = ( m_pQueue->m_sNameMatch.GetLength() > 0 );
	m_sMatch = m_pQueue->m_sNameMatch;

	m_bProtocols = ( m_pQueue->m_nProtocols != 0 );

	if ( ! m_bProtocols || ( m_pQueue->m_nProtocols & (1<<PROTOCOL_HTTP) ) )
		m_wndProtocols.SetItemState( 0, INDEXTOSTATEIMAGEMASK(2), LVIS_STATEIMAGEMASK );
	if ( ! m_bProtocols || ( m_pQueue->m_nProtocols & (1<<PROTOCOL_ED2K) ) )
		m_wndProtocols.SetItemState( 1, INDEXTOSTATEIMAGEMASK(2), LVIS_STATEIMAGEMASK );

	m_bEnable		= m_pQueue->m_bEnable || m_bEnableOverride;

	m_nCapacity		= max( m_pQueue->m_nCapacity, m_pQueue->m_nMaxTransfers );
	m_nTransfersMin	= m_pQueue->m_nMinTransfers;
	m_nTransfersMax	= m_pQueue->m_nMaxTransfers;

	m_bRotate		= m_pQueue->m_bRotate;
	m_nRotateTime	= m_pQueue->m_nRotateTime;

	m_bReward		= m_pQueue->m_bRewardUploaders;

	DWORD nTotal = Settings.Connection.OutSpeed * 1024 / 8;
	DWORD nLimit = Settings.Bandwidth.Uploads;

	if ( nLimit == 0 || nLimit > nTotal ) nLimit = nTotal;
	int nOtherPoints = UploadQueues.GetTotalBandwidthPoints( !( m_pQueue->m_nProtocols & (1<<PROTOCOL_ED2K) ) ) - m_pQueue->m_nBandwidthPoints;

	if ( nOtherPoints < 0 ) nOtherPoints = 0;

	m_wndBandwidthSlider.SetRange( 1, max( 100, nOtherPoints * 3 ) );
	m_wndBandwidthSlider.SetPos( m_pQueue->m_nBandwidthPoints );

	UpdateData( FALSE );

	m_wndMinSize.EnableWindow( m_bMinSize );
	m_wndMaxSize.EnableWindow( m_bMaxSize );
	m_wndMarked.EnableWindow( m_bMarked );
	m_wndMatch.EnableWindow( m_bMatch );
	m_wndProtocols.EnableWindow( m_bProtocols );
	m_wndRotateTime.EnableWindow( m_bRotate );
	m_wndRotateTimeSpin.EnableWindow( m_bRotate );
	m_wndCapacity.SetRange32( m_nTransfersMax, 4096 );
	OnHScroll( 0, 0, NULL );


	if ( Settings.General.GUIMode == GUI_BASIC )
	{
		if ( !( Settings.eDonkey.EnableAlways | Settings.eDonkey.EnableToday ) )
		{
			m_bProtocols = FALSE;
			m_wndProtocols.EnableWindow( FALSE );
			m_wndProtocols.ShowWindow( FALSE );

			(GetProtocolCheckbox())->EnableWindow( FALSE );
			(GetProtocolCheckbox())->ShowWindow( FALSE );
		}
	}

	return TRUE;
}
예제 #22
0
BOOL CDownloadReviewDlg::OnInitDialog() 
{
	CSkinDialog::OnInitDialog();

	CRect rcList;
	m_wndReviews.GetClientRect( &rcList );
	rcList.right -= GetSystemMetrics( SM_CXVSCROLL );

	CoolInterface.SetImageListTo( m_wndReviews, LVSIL_SMALL );
	m_wndReviews.InsertColumn( 0, _T("User"), LVCFMT_LEFT, 100, -1 );
	m_wndReviews.InsertColumn( 1, _T("Rating"), LVCFMT_CENTER, 90, 0 );
	m_wndReviews.InsertColumn( 2, _T("Comments"), LVCFMT_CENTER, rcList.right- 100 - 80, 1 );
	m_wndReviews.InsertColumn( 3, _T("Order"), LVCFMT_CENTER, 0, 2 );
	Skin.Translate( _T("CReviewList"), m_wndReviews.GetHeaderCtrl() );
	
	m_wndReviews.SendMessage( LVM_SETEXTENDEDLISTVIEWSTYLE,
		LVS_EX_FULLROWSELECT|LVS_EX_LABELTIP, LVS_EX_FULLROWSELECT|LVS_EX_LABELTIP );
	m_wndReviews.EnableToolTips();
	
	// Sort by order added- first at the top
	CLiveList::Sort( &m_wndReviews, 3, FALSE );
	CLiveList::Sort( &m_wndReviews, 3, FALSE );


	CLiveList pReviews( 4 );
	int nIndex = 1;
	// Lock while we're loading the list. (In case the download is destroyed)
	CSingleLock pLock( &Transfers.m_pSection, TRUE );
	
	if ( ! m_pDownload ) return FALSE;

	m_sReviewFileName = m_pDownload->m_sName;

	CDownloadReview* pReview = m_pDownload->GetFirstReview();

	while ( pReview )
	{
		CLiveItem* pItem = pReviews.Add( pReview );
	
		// Client picture
		// Note: We don't have pictures yet. Currently, it uses a star for a G2 
		// review, and a little person for everyone else
		switch ( pReview->m_nUserPicture )
		{
		case 0:
			pItem->SetImage( 0, CoolInterface.ImageForID( ID_TOOLS_WIZARD ) );
			break;
		case 1:
			pItem->SetImage( 0, CoolInterface.ImageForID( ID_TOOLS_PROFILE ) );
			break;
		case 2:
			pItem->SetImage( 0, CoolInterface.ImageForID( ID_TOOLS_WIZARD ) );
			break;
		case 3:
			pItem->SetImage( 0, CoolInterface.ImageForID( ID_TOOLS_PROFILE ) );
			break;
		default:
			pItem->SetImage( 0, CoolInterface.ImageForID( ID_TOOLS_PROFILE ) );
		}
		
		pItem->Set( 0, pReview->m_sUserName );

		int nRating = min( pReview->m_nFileRating, 6 );
		nRating = max ( nRating, 0 );
		CString strRating;
		LoadString( strRating, IDS_RATING_NORATING + nRating );
		pItem->Set( 1, strRating );

		
		pItem->Set( 2, pReview->m_sFileComments );
		pItem->Format( 3, _T("%i"), nIndex );
		

		nIndex++;
		pReview = pReview->m_pNext;
	}

	pLock.Unlock();

	//m_wndReviews.SetFont( &theApp.m_gdiFontBold );

	pReviews.Apply( &m_wndReviews, TRUE );

	// Set window icon
	SkinMe( NULL, IDR_MEDIAFRAME );

	UpdateData( FALSE );
	
	return TRUE;
}
예제 #23
0
BOOL CSecureRuleDlg::OnInitDialog()
{
	CSkinDialog::OnInitDialog();

	SkinMe( _T("CSecureRuleDlg"), IDR_SECURITYFRAME );

	CSingleLock pLock( &Network.m_pSection, TRUE );

	m_bNew = ! Security.Check( m_pRule );
	if ( m_bNew ) m_pRule = new CSecureRule();

	m_nType		= m_pRule->m_nType;
	m_sComment	= m_pRule->m_sComment;
	m_nAction	= m_pRule->m_nAction;
	m_nExpire	= min( m_pRule->m_nExpire, DWORD(2) );
	m_nMatch	= 0;

	if ( m_pRule->m_nType == CSecureRule::srAddress )
	{
		CEdit* pwIP[4]		= { &m_wndIP1, &m_wndIP2, &m_wndIP3, &m_wndIP4 };
		CEdit* pwMask[4]	= { &m_wndMask1, &m_wndMask2, &m_wndMask3, &m_wndMask4 };

		for ( int nByte = 0 ; nByte < 4 ; nByte++ )
		{
			CString strItem;

			strItem.Format( _T("%lu"), m_pRule->m_nMask[ nByte ] );
			pwMask[ nByte ]->SetWindowText( strItem );

			if ( m_pRule->m_nMask[ nByte ] == 0 )
			{
				pwIP[ nByte ]->SetWindowText( _T("*") );
			}
			else
			{
				strItem.Format( _T("%lu"), m_pRule->m_nIP[ nByte ] );
				pwIP[ nByte ]->SetWindowText( strItem );
			}
		}
	}
	else if ( m_pRule->m_nType == CSecureRule::srContent )
	{
		m_sContent = m_pRule->GetContentWords();
		m_nMatch = m_pRule->m_nIP[0] == 1;
	}

	if ( m_nExpire == 2 )
	{
		DWORD nTime = m_pRule->m_nExpire - time( NULL );
		m_nExpireD = nTime / 86400;
		m_nExpireH = ( nTime % 86400 ) / 3600;
		m_nExpireM = ( nTime % 3600 ) / 60;
	}

	pLock.Unlock();

	UpdateData( FALSE );

	OnSelChangeRuleExpire();
	OnSelChangeRuleType();

	return FALSE;
}
예제 #24
0
BOOL CScheduleTaskDlg::OnInitDialog()
{
	CSkinDialog::OnInitDialog();

	SkinMe( L"CScheduleTaskDlg", IDR_SCHEDULERFRAME );

	m_wndSpinDown.SetRange( 1, 99 );
	m_wndSpinUp.SetRange( 1, 101 );

	// New tasks must be added to the list in the same order as Scheduler.h enum
	m_wndTypeSel.AddString( LoadString( IDS_SCHEDULER_BANDWIDTH_FULL ) );
	m_wndTypeSel.AddString( LoadString( IDS_SCHEDULER_BANDWIDTH_LIMITED ) );
	m_wndTypeSel.AddString( LoadString( IDS_SCHEDULER_BANDWIDTH_STOP ) );
	m_wndTypeSel.AddString( LoadString( IDS_SCHEDULER_SYSTEM_EXIT ) );
	m_wndTypeSel.AddString( LoadString( IDS_SCHEDULER_SYSTEM_SHUTDOWN ) );
	m_wndTypeSel.AddString( LoadString( IDS_SCHEDULER_SYSTEM_DIALUP_OFF ) );
	m_wndTypeSel.AddString( LoadString( IDS_SCHEDULER_SYSTEM_NOTICE ) );

	if ( m_bNew )	// We are creating new schedule task, setting default values
	{
		m_pScheduleTask		= new CScheduleTask ();
		m_nAction			= BANDWIDTH_FULL;
		m_bActive			= true;
		m_bLimitedNetworks	= FALSE;
		m_bSpecificDays		= true;
		m_nDays				= 0x7F;
		m_nLimitDown		= 50;
		m_nLimitUp			= 70;

		m_wndDate.GetTime( m_tDateAndTime );	// Simply set m_tDateTime to now
		m_tDateAndTime -= m_tDateAndTime.GetSecond();
		m_wndTime.SetTime( &m_tDateAndTime );	// Discard seconds for convenience

		m_wndActiveCheck.SetCheck( 1 );
		m_wndRadioEveryDay.SetCheck( 1 );
		m_wndRadioOnce.SetCheck( 0 );

		m_wndLimitedCheck.EnableWindow( false );
		m_wndLimitedStaticDown.EnableWindow( false );
		m_wndLimitedStaticUp.EnableWindow( false );
		m_wndLimitedEditDown.EnableWindow( false );
		m_wndLimitedEditUp.EnableWindow( false );
		m_wndSpinDown.EnableWindow( false );
		m_wndSpinUp.EnableWindow( false );
		m_wndDate.EnableWindow( false );
	}
	else	// We are editing an existing schedule task, getting values from it
	{
		m_bSpecificDays	= m_pScheduleTask->m_bSpecificDays;
		m_nAction		= m_pScheduleTask->m_nAction;
		m_sDescription	= m_pScheduleTask->m_sDescription;
		m_tDateAndTime	= m_pScheduleTask->m_tScheduleDateTime;
		m_bActive		= m_pScheduleTask->m_bActive;
		m_nDays			= m_pScheduleTask->m_nDays;
		m_nLimitDown	= m_pScheduleTask->m_nLimitDown;
		m_nLimitUp		= m_pScheduleTask->m_nLimitUp;
		m_bLimitedNetworks	= m_pScheduleTask->m_bLimitedNetworks;

		if ( m_pScheduleTask->m_bExecuted && ! m_pScheduleTask->m_bSpecificDays )
			m_bActive = true;

		m_wndActiveCheck.SetCheck( m_bActive );

		switch ( m_nAction )
		{
		case 0:	// Should never happen
			m_wndTypeSel.SetCurSel(-1);
			break;
		case BANDWIDTH_FULL:
			m_wndTypeSel.SetCurSel(0);
			break;
		case BANDWIDTH_LIMITED:
			m_wndTypeSel.SetCurSel(1);
			break;
		case BANDWIDTH_STOP:
			m_wndTypeSel.SetCurSel(2);
			break;
		case SYSTEM_EXIT:
			m_wndTypeSel.SetCurSel(3);
			break;
		case SYSTEM_SHUTDOWN:
			m_wndTypeSel.SetCurSel(4);
			break;
		case SYSTEM_DISCONNECT:
			m_wndTypeSel.SetCurSel(5);
			break;
		case SYSTEM_NOTICE:
			m_wndTypeSel.SetCurSel(6);
			break;
		}

		m_wndRadioOnce.SetCheck( ! m_bSpecificDays );
		m_wndRadioEveryDay.SetCheck( m_bSpecificDays );
		m_wndDate.SetTime( &m_tDateAndTime );
		m_wndTime.SetTime( &m_tDateAndTime );

		// If task is set for specifs days disable date window
		if ( m_wndRadioEveryDay.GetCheck() )
			m_wndDate.EnableWindow( false );

		if ( m_wndTypeSel.GetCurSel() + 1 == BANDWIDTH_LIMITED )
		{
			m_wndLimitedEditDown.EnableWindow( true );
			m_wndLimitedEditUp.EnableWindow( true );
			m_wndLimitedStaticDown.EnableWindow( true );
			m_wndLimitedStaticUp.EnableWindow( true );
			m_wndSpinDown.EnableWindow( true );
			m_wndSpinUp.EnableWindow( true );
		}
		else
		{
			m_wndLimitedCheck.EnableWindow( false );
			m_wndLimitedEditDown.EnableWindow( false );
			m_wndLimitedEditUp.EnableWindow( false );
			m_wndSpinDown.EnableWindow( false );
			m_wndSpinUp.EnableWindow( false );
		}
	}

	m_wndChkDayMon.SetCheck( m_nDays & MONDAY );
	m_wndChkDayTues.SetCheck( m_nDays & TUESDAY );
	m_wndChkDayWed.SetCheck( m_nDays & WEDNESDAY );
	m_wndChkDayThu.SetCheck( m_nDays & THURSDAY );
	m_wndChkDayFri.SetCheck( m_nDays & FRIDAY );
	m_wndChkDaySat.SetCheck( m_nDays & SATURDAY );
	m_wndChkDaySun.SetCheck( m_nDays & SUNDAY );

	m_wndSpinDown.SetPos( m_nLimitDown );
	m_wndSpinUp.SetPos( m_nLimitUp );

	EnableDaysOfWeek( m_bSpecificDays );

	UpdateData( FALSE );

	return FALSE;
}