示例#1
0
void CSearchMonitorWnd::OnTimer(UINT_PTR nIDEvent) 
{
	if ( nIDEvent != 2 ) return;

	BOOL bScroll = m_wndList.GetTopIndex() + m_wndList.GetCountPerPage() >= m_wndList.GetItemCount();

	for (;;)
	{
		CLiveItem* pItem;

		{
			CSingleLock pLock( &m_pSection );
			if ( ! pLock.Lock( 250 ) )
				break;

			if ( m_pQueue.GetCount() == 0 )
				break;

			pItem = m_pQueue.RemoveHead();
		}

		if ( (DWORD)m_wndList.GetItemCount() >= Settings.Search.MonitorQueue && Settings.Search.MonitorQueue > 0 )
		{
			m_wndList.DeleteItem( 0 );
		}

		/*int nItem =*/ pItem->Add( &m_wndList, -1, 4 );

		delete pItem;
	}

	if ( bScroll ) m_wndList.EnsureVisible( m_wndList.GetItemCount() - 1, FALSE );
}
示例#2
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;
}
示例#3
0
void CLiveList::Apply(CListCtrl* pCtrl, BOOL bSort)
{
	ASSERT_VALID( this );

	CQuickLock oLock( m_pSection );

	BOOL bModified = FALSE;

	for ( int nItem = 0 ; nItem < pCtrl->GetItemCount() ; nItem++ )
	{
		DWORD nParam		= (DWORD)pCtrl->GetItemData( nItem );
		CLiveItem* pItem;

		if ( m_pItems.Lookup( nParam, pItem ) )
		{
			ASSERT_VALID( pItem );
			if ( pItem->Update( pCtrl, nItem, m_nColumns ) ) bModified = TRUE;

			delete pItem;
			m_pItems.RemoveKey( nParam );
		}
		else
		{
			pCtrl->DeleteItem( nItem-- );
			bModified = TRUE;
		}
	}

	int nCount = pCtrl->GetItemCount();

	for ( POSITION pos = m_pItems.GetStartPosition() ; pos ; )
	{
		CLiveItem* pItem;
		DWORD_PTR nParam;

		m_pItems.GetNextAssoc( pos, nParam, pItem );
		ASSERT_VALID( pItem );
		pItem->Add( pCtrl, nCount++, m_nColumns );
		bModified = TRUE;

		delete pItem;
	}

	m_pItems.RemoveAll();

	if ( bModified && bSort ) Sort( pCtrl, -1 );
}
示例#4
0
void CGraphListDlg::OnGraphAdd()
{
	CGraphItemDlg dlg( this, new CGraphItem() );

	if ( dlg.DoModal() == IDOK )
	{
		m_pGraph->AddItem( dlg.m_pItem );
		CLiveItem* pLive = PrepareItem( dlg.m_pItem );
		pLive->Add( &m_wndList, -1, LIST_COLUMNS );
		delete pLive;
		SetModified();
	}
	else
	{
		delete dlg.m_pItem;
	}
}
示例#5
0
void CLiveList::Apply(CListCtrl* pCtrl, BOOL bSort)
{
	ASSERT_VALID( this );

	BOOL bModified = FALSE;

	int nCount = pCtrl->GetItemCount();

// Start flicker workaround for VS2012
//#if defined(_MSC_VER) && (_MSC_VER >= 1700)		// #ifdef _USING_V110_SDK71_
#if defined(_MSC_PLATFORM_TOOLSET) && (_MSC_PLATFORM_TOOLSET >= 110)		// Custom define
	pCtrl->SendMessage( WM_SETREDRAW, FALSE );
	const int nSelected = pCtrl->GetNextItem( -1, LVNI_SELECTED );
#endif

	CQuickLock oLock( m_pSection );

	for ( int nItem = 0 ; nItem < nCount ; nItem++ )
	{
		DWORD nParam = (DWORD)pCtrl->GetItemData( nItem );
		CLiveItem* pItem;

		if ( m_pItems.Lookup( nParam, pItem ) )
		{
			ASSERT_VALID( pItem );
			if ( pItem->Update( pCtrl, nItem, m_nColumns ) )
				bModified = TRUE;

			delete pItem;
			m_pItems.RemoveKey( nParam );
		}
		else
		{
			pCtrl->DeleteItem( nItem-- );
			bModified = TRUE;
			nCount--;
		}
	}

	nCount = pCtrl->GetItemCount();		// ToDo: Is this double-check needed?

	for ( POSITION pos = m_pItems.GetStartPosition() ; pos ; )
	{
		CLiveItem* pItem;
		DWORD_PTR nParam;

		m_pItems.GetNextAssoc( pos, nParam, pItem );
		ASSERT_VALID( pItem );
		pItem->Add( pCtrl, nCount++, m_nColumns );
		bModified = TRUE;

		delete pItem;
	}

	m_pItems.RemoveAll();

	if ( bModified && bSort )
		Sort( pCtrl, -1 );

// End flicker workaround for VS2012
//#if defined(_MSC_VER) && (_MSC_VER >= 1700)		// #ifdef _USING_V110_SDK71_
#if defined(_MSC_PLATFORM_TOOLSET) && (_MSC_PLATFORM_TOOLSET >= 110)		// Custom define
	pCtrl->SendMessage( WM_SETREDRAW, TRUE );
	if ( nSelected >= 0 )
	{
		pCtrl->SetItemState( nSelected, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED );
		pCtrl->SetSelectionMark( nSelected );
	}
#endif
}