void ServerPingSettings::HandleLVNGetDispInfo(NMLVDISPINFO *lvdi)
{
	Pinger *pinger = pingers->GetElement(lvdi->item.iItem);

	String pszText = " ";

	switch (lvdi->item.iSubItem) {
        case 0: {
			lvdi->item.pszText = AddPool(pinger->GetServiceName());
            break;
		}     
        case 1: {
            lvdi->item.pszText = AddPool(pinger->GetServerName());
            break;
		}
		case 2: {
			int latestPing = pinger->GetLatestPing();
			if (latestPing > -1) {
				pszText = latestPing;
			}
			lvdi->item.pszText = AddPool(pszText);
			break;
		}
		case 3: {
			double averagePing = pinger->Average();
			if (_finite(averagePing)) {
				pszText = FloatString(pinger->Average());
			}
			lvdi->item.pszText = AddPool(pszText);
			break;
		}
		case 4: {
			double standardDeviation = pinger->StandardDeviation();
			if (_finite(standardDeviation)) {
				pszText = FloatString(abs(standardDeviation));
			}
			lvdi->item.pszText = AddPool(pszText);
			break;
		}
        default:
            break;
	}
}
Ejemplo n.º 2
0
void CFindTagListCtrl::OnGetDispInfo(NMHDR* pNMHDR, LRESULT* pResult) 
{
	if (HasExpiredHelper())
		return;

	LV_DISPINFO *pDispInfo = (LV_DISPINFO*)pNMHDR;
	LVITEM* item = &pDispInfo->item;

	const WWhizTag* tag = (*m_tagArray)[item->iItem];

	item->mask = LVIF_TEXT;
	if (item->iSubItem == 0)
	{
		switch (tag->GetType())
		{
			case WWhizTag::CLASS:		item->pszText = "Class";		break;
			case WWhizTag::DECLARATION:	item->pszText = "Decl";			break;
			case WWhizTag::DEFINE:		item->pszText = "Define";		break;
			case WWhizTag::ENUM:		item->pszText = "Enum";			break;
			case WWhizTag::ENUMMEMBER:	item->pszText = "EnumVal";		break;
			case WWhizTag::FUNCTION:	item->pszText = "Function";		break;
			case WWhizTag::MEMBER:		item->pszText = "MemVar";		break;
			case WWhizTag::NAMESPACE:	item->pszText = "NSpace";		break;
			case WWhizTag::STRUCTURE:	item->pszText = "Struct";		break;
			case WWhizTag::TYPEDEF:		item->pszText = "Typedef";		break;
			case WWhizTag::UNION:		item->pszText = "Union";		break;
			case WWhizTag::VARIABLE:	item->pszText = "Variable";		break;
			case WWhizTag::FILE:		item->pszText = "File";		break;
		}
	}
	else if (item->iSubItem == 1)
	{
		LPCTSTR text = tag->GetNamespace();
		if (item->pszText[0] == 0  &&  tag->GetBuddy())
		{
			item->pszText = (LPTSTR)(LPCTSTR)tag->GetBuddy()->GetNamespace();
		}
		item->pszText = (LPTSTR)text;
	}
	else if (item->iSubItem == 2)
	{
		item->pszText = (LPTSTR)(LPCTSTR)tag->GetParentIdent();
	}
	else if (item->iSubItem == 3)
	{
		item->pszText = (LPTSTR)(LPCTSTR)tag->GetIdent();
	}
	else if (item->iSubItem == 4)
	{
		CString fileName = tag->GetFile()->GetTitle();
		if (!tag->GetFile()->GetExt().IsEmpty())
			fileName += "." + tag->GetFile()->GetExt();

		LPTSTR pstrBuffer = AddPool(&fileName);
		item->pszText = pstrBuffer;
	}
/*	else if (item->iSubItem == 5)
	{
		CString fileName = tag->GetFilename();
		int lastSlash = fileName.ReverseFind('\\');
		fileName = fileName.Left(lastSlash + 1);
		LPTSTR pstrBuffer = AddPool(&fileName);
		item->pszText = pstrBuffer;
	}*/
	else if (item->iSubItem == 5)
	{
		CString searchString = tag->GetSearchString();
		searchString.TrimLeft("^");
		searchString.TrimRight("$");
		searchString.Replace('\t', ' ');
		LPTSTR pstrBuffer = AddPool(&searchString);
		item->pszText = pstrBuffer;
	}

	*pResult = 0;
}