void CGridListCtrl::OnPaint() { // Make the gridlines easier to see than default light grey // First let the control do its default drawing. const MSG *pMsg = GetCurrentMessage(); DefWindowProc(pMsg->message, pMsg->wParam, pMsg->lParam); // Draw the lines only for LVS_REPORT mode if ((GetStyle() & LVS_TYPEMASK) == LVS_REPORT) { CClientDC dc(this); CPen NewPen(PS_SOLID, 0, m_RGBLineColour); CPen *pOldPen = dc.SelectObject(&NewPen); // Get the number of columns CHeaderCtrl *pHeader = (CHeaderCtrl *)GetDlgItem(m_HeaderCtrlID); int nColumnCount = pHeader->GetItemCount(); // The bottom of the header corresponds to the top of the line RECT rect; pHeader->GetClientRect(&rect); int top = rect.bottom; // Now get the client rect so we know the line length and when to stop GetClientRect(&rect); // The border of the column is offset by the horz scroll int borderx = 0 - GetScrollPos(SB_HORZ); for (int i = 0; i < nColumnCount; i++) { // Get the next border borderx += GetColumnWidth(pHeader->OrderToIndex(i)); // if next border is outside client area, break out if (borderx >= rect.right) break; // Draw the line. dc.MoveTo(borderx - 1, top); dc.LineTo(borderx - 1, rect.bottom); } // Draw the horizontal grid lines // First get the height if (!GetItemRect(0, &rect, LVIR_BOUNDS)) return; int height = rect.bottom - rect.top; GetClientRect(&rect); int width = rect.right; for (int i = 1; i <= GetCountPerPage(); i++) { dc.MoveTo(0, top + height * i); dc.LineTo(width, top + height * i); } dc.SelectObject(pOldPen); } }
void CClientListCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { if( !theApp.emuledlg->IsRunning() ) return; if (!lpDrawItemStruct->itemData) return; CDC* odc = CDC::FromHandle(lpDrawItemStruct->hDC); BOOL bCtrlFocused = ((GetFocus() == this ) || (GetStyle() & LVS_SHOWSELALWAYS)); if (lpDrawItemStruct->itemState & ODS_SELECTED) { if(bCtrlFocused) odc->SetBkColor(m_crHighlight); else odc->SetBkColor(m_crNoHighlight); } else odc->SetBkColor(GetBkColor()); const CUpDownClient* client = (CUpDownClient*)lpDrawItemStruct->itemData; CMemDC dc(odc, &lpDrawItemStruct->rcItem); CFont* pOldFont = dc.SelectObject(GetFont()); CRect cur_rec(lpDrawItemStruct->rcItem); COLORREF crOldTextColor = dc.SetTextColor((lpDrawItemStruct->itemState & ODS_SELECTED) ? m_crHighlightText : m_crWindowText); int iOldBkMode; if (m_crWindowTextBk == CLR_NONE){ DefWindowProc(WM_ERASEBKGND, (WPARAM)(HDC)dc, 0); iOldBkMode = dc.SetBkMode(TRANSPARENT); } else iOldBkMode = OPAQUE; CHeaderCtrl *pHeaderCtrl = GetHeaderCtrl(); int iCount = pHeaderCtrl->GetItemCount(); cur_rec.right = cur_rec.left - 8; cur_rec.left += 4; CString Sbuffer; for(int iCurrent = 0; iCurrent < iCount; iCurrent++){ int iColumn = pHeaderCtrl->OrderToIndex(iCurrent); if( !IsColumnHidden(iColumn) ){ cur_rec.right += GetColumnWidth(iColumn); switch(iColumn){ case 0:{ uint8 image; if (client->IsFriend()) image = 2; else if (client->GetClientSoft() == SO_EDONKEYHYBRID) image = 4; else if (client->GetClientSoft() == SO_MLDONKEY) image = 3; else if (client->GetClientSoft() == SO_SHAREAZA) image = 5; else if (client->GetClientSoft() == SO_URL) image = 6; else if (client->GetClientSoft() == SO_AMULE) image = 7; else if (client->GetClientSoft() == SO_LPHANT) image = 8; else if (client->ExtProtocolAvailable()) //==>Modversion [shadow2004] #ifdef MODVERSION image = (client->IsNextEMF())?10:1; #else //Modversion image = 1; #endif //Modversion //<==Modversion [shadow2004] else image = 0; POINT point = {cur_rec.left, cur_rec.top+1}; imagelist.Draw(dc,image, point, ILD_NORMAL | ((client->Credits() && client->Credits()->GetCurrentIdentState(client->GetIP()) == IS_IDENTIFIED) ? INDEXTOOVERLAYMASK(1) : 0)); if (client->GetUserName()==NULL) Sbuffer.Format(_T("(%s)"), GetResString(IDS_UNKNOWN)); else Sbuffer = client->GetUserName(); cur_rec.left +=20; dc.DrawText(Sbuffer,Sbuffer.GetLength(),&cur_rec,DLC_DT_TEXT); cur_rec.left -=20; break; } case 1:{ Sbuffer = client->GetUploadStateDisplayString(); break; } case 2:{ if(client->credits) Sbuffer = CastItoXBytes(client->credits->GetUploadedTotal(), false, false); else Sbuffer.Empty(); break; } case 3:{ Sbuffer = client->GetDownloadStateDisplayString(); break; } case 4:{ if(client->credits) Sbuffer = CastItoXBytes(client->credits->GetDownloadedTotal(), false, false); else Sbuffer.Empty(); break; } case 5:{ Sbuffer = client->GetClientSoftVer(); if (Sbuffer.IsEmpty()) Sbuffer = GetResString(IDS_UNKNOWN); break; } case 6:{ if(client->socket){ if(client->socket->IsConnected()){ Sbuffer = GetResString(IDS_YES); break; } } Sbuffer = GetResString(IDS_NO); break; } case 7: Sbuffer = md4str(client->GetUserHash()); break; } if( iColumn != 0) dc.DrawText(Sbuffer,Sbuffer.GetLength(),&cur_rec,DLC_DT_TEXT); cur_rec.left += GetColumnWidth(iColumn); }
void CDownloadClientsCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { if( !theApp.emuledlg->IsRunning() ) return; if (!lpDrawItemStruct->itemData) return; CDC* odc = CDC::FromHandle(lpDrawItemStruct->hDC); BOOL bCtrlFocused = ((GetFocus() == this ) || (GetStyle() & LVS_SHOWSELALWAYS)); if (lpDrawItemStruct->itemState & ODS_SELECTED) { if(bCtrlFocused) odc->SetBkColor(m_crHighlight); else odc->SetBkColor(m_crNoHighlight); } else odc->SetBkColor(GetBkColor()); const CUpDownClient* client = (CUpDownClient*)lpDrawItemStruct->itemData; CMemDC dc(odc, &lpDrawItemStruct->rcItem); CFont* pOldFont = dc.SelectObject(GetFont()); CRect cur_rec(lpDrawItemStruct->rcItem); COLORREF crOldTextColor = dc.SetTextColor((lpDrawItemStruct->itemState & ODS_SELECTED) ? m_crHighlightText : m_crWindowText); if(client->GetSlotNumber() > theApp.uploadqueue->GetActiveUploadsCount()) { dc.SetTextColor(::GetSysColor(COLOR_GRAYTEXT)); } int iOldBkMode; if (m_crWindowTextBk == CLR_NONE){ DefWindowProc(WM_ERASEBKGND, (WPARAM)(HDC)dc, 0); iOldBkMode = dc.SetBkMode(TRANSPARENT); } else iOldBkMode = OPAQUE; CHeaderCtrl *pHeaderCtrl = GetHeaderCtrl(); int iCount = pHeaderCtrl->GetItemCount(); cur_rec.right = cur_rec.left - 8; cur_rec.left += 4; CString Sbuffer; for(int iCurrent = 0; iCurrent < iCount; iCurrent++){ int iColumn = pHeaderCtrl->OrderToIndex(iCurrent); if( !IsColumnHidden(iColumn) ){ cur_rec.right += GetColumnWidth(iColumn); switch(iColumn){ case 0:{ uint8 image; if (client->credits != NULL){ if (client->IsFriend()) image = 4; else if (client->GetClientSoft() == SO_EDONKEYHYBRID){ //==> Xman CreditSystem [shadow2004] if (client->credits->GetScoreRatio(client/*->GetIP()*/) > 1) image = 8; else image = 7; } else if (client->GetClientSoft() == SO_MLDONKEY){ if (client->credits->GetScoreRatio(client/*->GetIP()*/) > 1) image = 6; else image = 5; } else if (client->GetClientSoft() == SO_SHAREAZA){ if(client->credits->GetScoreRatio(client/*->GetIP()*/) > 1) image = 10; else image = 9; } else if (client->GetClientSoft() == SO_AMULE){ if(client->credits->GetScoreRatio(client/*->GetIP()*/) > 1) image = 12; else image = 11; } else if (client->GetClientSoft() == SO_LPHANT){ if(client->credits->GetScoreRatio(client/*->GetIP()*/) > 1) image = 14; else image = 13; } else if (client->ExtProtocolAvailable()){ if(client->credits->GetScoreRatio(client/*->GetIP()*/) > 1) image = 3; else image = 1; } else{ if (client->credits->GetScoreRatio(client/*->GetIP()*/) > 1) //<== Xman CreditSystem [shadow2004] image = 2; else image = 0; } } else image = 0; POINT point = {cur_rec.left, cur_rec.top+1}; m_ImageList.Draw(dc,image, point, ILD_NORMAL | ((client->Credits() && client->Credits()->GetCurrentIdentState(client->GetIP()) == IS_IDENTIFIED) ? INDEXTOOVERLAYMASK(1) : 0)); Sbuffer = client->GetUserName(); cur_rec.left +=20; dc.DrawText(Sbuffer,Sbuffer.GetLength(),&cur_rec,DLC_DT_TEXT); cur_rec.left -=20; break; } case 1: Sbuffer.Format(_T("%s"), client->GetClientSoftVer()); break; case 2: Sbuffer.Format(_T("%s"), client->GetRequestFile()->GetFileName()); break; case 3: Sbuffer=CastItoXBytes( (float)client->GetDownloadDatarate() , false, true); dc.DrawText(Sbuffer,Sbuffer.GetLength(),&cur_rec, DLC_DT_TEXT | DT_RIGHT); break; case 4: cur_rec.bottom--; cur_rec.top++; client->DrawStatusBar(dc, &cur_rec, false); cur_rec.bottom++; cur_rec.top--; break; case 5: if(client->Credits() && client->GetSessionDown() < client->credits->GetDownloadedTotal()) Sbuffer.Format(_T("%s (%s)"), CastItoXBytes(client->GetSessionDown()), CastItoXBytes(client->credits->GetDownloadedTotal())); else Sbuffer.Format(_T("%s"), CastItoXBytes(client->GetSessionDown())); break; case 6: if(client->Credits() && client->GetSessionUp() < client->credits->GetUploadedTotal()) Sbuffer.Format(_T("%s (%s)"), CastItoXBytes(client->GetSessionUp()), CastItoXBytes(client->credits->GetUploadedTotal())); else Sbuffer.Format(_T("%s"), CastItoXBytes(client->GetSessionUp())); break; case 7: switch(client->GetSourceFrom()){ case SF_SERVER: Sbuffer = _T("eD2K Server"); break; case SF_KADEMLIA: Sbuffer = GetResString(IDS_KADEMLIA); break; case SF_SOURCE_EXCHANGE: Sbuffer = GetResString(IDS_SE); break; case SF_PASSIVE: Sbuffer = GetResString(IDS_PASSIVE); break; case SF_LINK: Sbuffer = GetResString(IDS_SW_LINK); break; default: Sbuffer = GetResString(IDS_UNKNOWN); break; } break; } if( iColumn != 4 && iColumn != 0 && iColumn != 3 && iColumn != 11) dc.DrawText(Sbuffer,Sbuffer.GetLength(),&cur_rec,DLC_DT_TEXT); cur_rec.left += GetColumnWidth(iColumn); } } //draw rectangle around selected item(s) if (lpDrawItemStruct->itemState & ODS_SELECTED) { RECT outline_rec = lpDrawItemStruct->rcItem; outline_rec.top--; outline_rec.bottom++; dc.FrameRect(&outline_rec, &CBrush(GetBkColor())); outline_rec.top++; outline_rec.bottom--; outline_rec.left++; outline_rec.right--; if (bCtrlFocused) dc.FrameRect(&outline_rec, &CBrush(m_crFocusLine)); else dc.FrameRect(&outline_rec, &CBrush(m_crNoFocusLine)); } if (m_crWindowTextBk == CLR_NONE) dc.SetBkMode(iOldBkMode); dc.SelectObject(pOldFont); dc.SetTextColor(crOldTextColor); }
void CQueueListCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { if (!theApp.emuledlg->IsRunning()) return; if (!lpDrawItemStruct->itemData) return; // ==> Visual Studio 2010 Compatibility [Stulle/Avi-3k/ied] - Stulle /* CMemDC dc(CDC::FromHandle(lpDrawItemStruct->hDC), &lpDrawItemStruct->rcItem); */ CMemoryDC dc(CDC::FromHandle(lpDrawItemStruct->hDC), &lpDrawItemStruct->rcItem); // <== Visual Studio 2010 Compatibility [Stulle/Avi-3k/ied] - Stulle BOOL bCtrlFocused; //Xman narrow font at transferwindow /* InitItemMemDC(dc, lpDrawItemStruct, bCtrlFocused); */ // ==> Design Settings [eWombat/Stulle] - Stulle /* InitItemMemDC(dc, lpDrawItemStruct, bCtrlFocused, true); //Xman end */ InitItemMemDC(dc, lpDrawItemStruct, bCtrlFocused, true, style_b_queuelist); // <== Design Settings [eWombat/Stulle] - Stulle CRect cur_rec(lpDrawItemStruct->rcItem); CRect rcClient; GetClientRect(&rcClient); const CUpDownClient *client = (CUpDownClient *)lpDrawItemStruct->itemData; // ==> Design Settings [eWombat/Stulle] - Stulle /* COLORREF crOldBackColor = dc->GetBkColor(); //Xman PowerRelease //Xman show LowIDs */ // <== Design Settings [eWombat/Stulle] - Stulle CHeaderCtrl *pHeaderCtrl = GetHeaderCtrl(); int iCount = pHeaderCtrl->GetItemCount(); cur_rec.right = cur_rec.left - sm_iLabelOffset; cur_rec.left += sm_iIconOffset; for (int iCurrent = 0; iCurrent < iCount; iCurrent++) { int iColumn = pHeaderCtrl->OrderToIndex(iCurrent); if (!IsColumnHidden(iColumn)) { UINT uDrawTextAlignment; int iColumnWidth = GetColumnWidth(iColumn, uDrawTextAlignment); cur_rec.right += iColumnWidth; if (cur_rec.left < cur_rec.right && HaveIntersection(rcClient, cur_rec)) { TCHAR szItem[1024]; GetItemDisplayText(client, iColumn, szItem, _countof(szItem)); switch (iColumn) { case 0:{ int iImage; //Xman Show correct Icons /* if (client->IsFriend()) iImage = 4; else if (client->GetClientSoft() == SO_EDONKEYHYBRID) { if (client->credits->GetScoreRatio(client->GetIP()) > 1) iImage = 8; else iImage = 7; } else if (client->GetClientSoft() == SO_MLDONKEY) { if (client->credits->GetScoreRatio(client->GetIP()) > 1) iImage = 6; else iImage = 5; } else if (client->GetClientSoft() == SO_SHAREAZA) { if (client->credits->GetScoreRatio(client->GetIP()) > 1) iImage = 10; else iImage = 9; } else if (client->GetClientSoft() == SO_AMULE) { if (client->credits->GetScoreRatio(client->GetIP()) > 1) iImage = 12; else iImage = 11; } else if (client->GetClientSoft() == SO_LPHANT) { if (client->credits->GetScoreRatio(client->GetIP()) > 1) iImage = 14; else iImage = 13; } else if (client->ExtProtocolAvailable()) { if (client->credits->GetScoreRatio(client->GetIP()) > 1) iImage = 3; else iImage = 1; } else { if (client->credits->GetScoreRatio(client->GetIP()) > 1) iImage = 2; else iImage = 0; } */ if (client->IsFriend()) iImage = 6; else if (client->GetClientSoft() == SO_EDONKEYHYBRID){ iImage = 10; } else if (client->GetClientSoft() == SO_EDONKEY){ iImage = 2; } else if (client->GetClientSoft() == SO_MLDONKEY){ iImage = 8; } else if (client->GetClientSoft() == SO_SHAREAZA){ iImage = 12; } else if (client->GetClientSoft() == SO_AMULE){ iImage = 14; } else if (client->GetClientSoft() == SO_LPHANT){ iImage = 16; } else if (client->ExtProtocolAvailable()){ // ==> Mod Icons - Stulle /* iImage = 4; */ if(client->GetModClient() == MOD_NONE) iImage = 4; else iImage = (uint8)(client->GetModClient() + 19); // <== Mod Icons - Stulle } else{ iImage = 0; } //Xman Anti-Leecher if(client->IsLeecher()>0) iImage=18; else //Xman end if (((client->credits)?client->credits->GetScoreRatio(client):0) > 1) // ==> Mod Icons - Stulle // ==> CreditSystems [EastShare/ MorphXT] - Stulle /* iImage++; */ if (client->GetModClient() == MOD_NONE){ if(client->credits && client->credits->GetHasScore(client)) iImage++; } // <== CreditSystems [EastShare/ MorphXT] - Stulle // <== Mod Icons - Stulle //Xman end UINT nOverlayImage = 0; if ((client->Credits() && client->Credits()->GetCurrentIdentState(client->GetIP()) == IS_IDENTIFIED)) nOverlayImage |= 1; //Xman changed: display the obfuscation icon for all clients which enabled it /* if (client->IsObfuscatedConnectionEstablished()) */ if(client->IsObfuscatedConnectionEstablished() || (!(client->socket != NULL && client->socket->IsConnected()) && (client->SupportsCryptLayer() && thePrefs.IsClientCryptLayerSupported() && (client->RequestsCryptLayer() || thePrefs.IsClientCryptLayerRequested())))) nOverlayImage |= 2; int iIconPosY = (cur_rec.Height() > 16) ? ((cur_rec.Height() - 16) / 2) : 1; POINT point = { cur_rec.left, cur_rec.top + iIconPosY }; m_ImageList.Draw(dc, iImage, point, ILD_NORMAL | INDEXTOOVERLAYMASK(nOverlayImage)); // ==> Mod Icons - Stulle if(client->Credits() && client->credits->GetHasScore(client) && client->GetModClient() != MOD_NONE) { if (nOverlayImage & 1) m_overlayimages.Draw(dc,1, point, ILD_TRANSPARENT); else m_overlayimages.Draw(dc,0, point, ILD_TRANSPARENT); } // <== Mod Icons - Stulle //Xman friend visualization if (client->IsFriend() && client->GetFriendSlot()) m_ImageList.Draw(dc,19, point, ILD_NORMAL); //Xman end //EastShare Start - added by AndCycle, IP to Country if(theApp.ip2country->ShowCountryFlag() ) { cur_rec.left+=20; POINT point2= {cur_rec.left,cur_rec.top+1}; //theApp.ip2country->GetFlagImageList()->Draw(dc, client->GetCountryFlagIndex(), point2, ILD_NORMAL); theApp.ip2country->GetFlagImageList()->DrawIndirect(&theApp.ip2country->GetFlagImageDrawParams(dc,client->GetCountryFlagIndex(),point2)); cur_rec.left += sm_iLabelOffset; } //EastShare End - added by AndCycle, IP to Country cur_rec.left += 16 + sm_iLabelOffset; dc.DrawText(szItem, -1, &cur_rec, MLC_DT_TEXT | uDrawTextAlignment); cur_rec.left -= 16; cur_rec.right -= sm_iSubItemInset; //EastShare Start - added by AndCycle, IP to Country if(theApp.ip2country->ShowCountryFlag() ) { cur_rec.left-=20; } //EastShare End - added by AndCycle, IP to Country break; } case 9: if (client->GetUpPartCount()) { cur_rec.bottom--; cur_rec.top++; COLORREF crOldBackColor = dc->GetBkColor(); //Xman Code Improvement: FillSolidRect client->DrawUpStatusBar(dc, &cur_rec, false, thePrefs.UseFlatBar()); dc.SetBkColor(crOldBackColor); //Xman Code Improvement: FillSolidRect //Xman client percentage (font idea by morph) CString buffer; // ==> Show Client Percentage optional [Stulle] - Stulle /* if (thePrefs.GetUseDwlPercentage()) */ if (thePrefs.GetShowClientPercentage()) // <== Show Client Percentage optional [Stulle] - Stulle { if(client->GetHisCompletedPartsPercent_UP() >=0) { COLORREF oldclr = dc.SetTextColor(RGB(0,0,0)); int iOMode = dc.SetBkMode(TRANSPARENT); buffer.Format(_T("%i%%"), client->GetHisCompletedPartsPercent_UP()); CFont *pOldFont = dc.SelectObject(&m_fontBoldSmaller); #define DrawClientPercentText dc.DrawText(buffer, buffer.GetLength(),&cur_rec, ((MLC_DT_TEXT | DT_RIGHT) & ~DT_LEFT) | DT_CENTER) cur_rec.top-=1;cur_rec.bottom-=1; DrawClientPercentText;cur_rec.left+=1;cur_rec.right+=1; DrawClientPercentText;cur_rec.left+=1;cur_rec.right+=1; DrawClientPercentText;cur_rec.top+=1;cur_rec.bottom+=1; DrawClientPercentText;cur_rec.top+=1;cur_rec.bottom+=1; DrawClientPercentText;cur_rec.left-=1;cur_rec.right-=1; DrawClientPercentText;cur_rec.left-=1;cur_rec.right-=1; DrawClientPercentText;cur_rec.top-=1;cur_rec.bottom-=1; DrawClientPercentText;cur_rec.left++;cur_rec.right++; dc.SetTextColor(RGB(255,255,255)); DrawClientPercentText; dc.SelectObject(pOldFont); dc.SetBkMode(iOMode); dc.SetTextColor(oldclr); } } //Xman end cur_rec.bottom++; cur_rec.top--; } break; default: // ==> Design Settings [eWombat/Stulle] - Stulle /* //Xman PowerRelease //Xman show LowIDs if(iColumn == 1) { const CKnownFile *file = theApp.sharedfiles->GetFileByID(client->GetUploadFileID()); if(file && file->GetUpPriority()==PR_POWER) dc.SetBkColor(RGB(255,225,225)); } else if(iColumn == 10 && client->HasLowID()) dc.SetBkColor(RGB(255,250,200)); //Xman end */ // <== Design Settings [eWombat/Stulle] - Stulle dc.DrawText(szItem, -1, &cur_rec, MLC_DT_TEXT | uDrawTextAlignment); // ==> Design Settings [eWombat/Stulle] - Stulle /* dc.SetBkColor(crOldBackColor); //Xman PowerRelease //Xman show LowIDs */ // <== Design Settings [eWombat/Stulle] - Stulle break; } } cur_rec.left += iColumnWidth; } } DrawFocusRect(dc, lpDrawItemStruct->rcItem, lpDrawItemStruct->itemState & ODS_FOCUS, bCtrlFocused, lpDrawItemStruct->itemState & ODS_SELECTED); }
void CQueueListCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { if( !theApp.emuledlg->IsRunning() ) return; if (!lpDrawItemStruct->itemData) return; CDC* odc = CDC::FromHandle(lpDrawItemStruct->hDC); BOOL bCtrlFocused = ((GetFocus() == this ) || (GetStyle() & LVS_SHOWSELALWAYS)); if (lpDrawItemStruct->itemState & ODS_SELECTED) { if(bCtrlFocused) odc->SetBkColor(m_crHighlight); else odc->SetBkColor(m_crNoHighlight); } else odc->SetBkColor(GetBkColor()); const CUpDownClient* client = (CUpDownClient*)lpDrawItemStruct->itemData; CMemDC dc(odc, &lpDrawItemStruct->rcItem); CFont* pOldFont = dc.SelectObject(GetFont()); CRect cur_rec(lpDrawItemStruct->rcItem); COLORREF crOldTextColor = dc.SetTextColor((lpDrawItemStruct->itemState & ODS_SELECTED) ? m_crHighlightText : m_crWindowText); int iOldBkMode; if (m_crWindowTextBk == CLR_NONE) { DefWindowProc(WM_ERASEBKGND, (WPARAM)(HDC)dc, 0); iOldBkMode = dc.SetBkMode(TRANSPARENT); } else iOldBkMode = OPAQUE; CKnownFile* file = theApp.sharedfiles->GetFileByID(client->GetUploadFileID()); CHeaderCtrl *pHeaderCtrl = GetHeaderCtrl(); int iCount = pHeaderCtrl->GetItemCount(); cur_rec.right = cur_rec.left - 8; cur_rec.left += 4; CString Sbuffer; for(int iCurrent = 0; iCurrent < iCount; iCurrent++) { int iColumn = pHeaderCtrl->OrderToIndex(iCurrent); if( !IsColumnHidden(iColumn) ) { cur_rec.right += GetColumnWidth(iColumn); switch(iColumn) { case 0: { uint8 image; if (client->IsFriend()) image = 4; else if (client->GetClientSoft() == SO_EDONKEYHYBRID) { //==> Xman CreditSystem [shadow2004] if (client->credits->GetScoreRatio(client/*->GetIP()*/) > 1) image = 8; else image = 7; } else if (client->GetClientSoft() == SO_MLDONKEY) { if (client->credits->GetScoreRatio(client/*->GetIP()*/) > 1) image = 6; else image = 5; } else if (client->GetClientSoft() == SO_SHAREAZA) { if(client->credits->GetScoreRatio(client/*->GetIP()*/) > 1) image = 10; else image = 9; } else if (client->GetClientSoft() == SO_AMULE) { if(client->credits->GetScoreRatio(client/*->GetIP()*/) > 1) image = 12; else image = 11; } else if (client->GetClientSoft() == SO_LPHANT) { if(client->credits->GetScoreRatio(client/*->GetIP()*/) > 1) image = 14; else image = 13; } else if (client->ExtProtocolAvailable()) { if(client->credits->GetScoreRatio(client/*->GetIP()*/) > 1) //==>Modversion [shadow2004] #ifdef MODVERSION image = (client->IsNextEMF())?16:3; #else //Modversion image = 3; #endif //Modversion //<==Modversion [shadow2004] else //==>Modversion [shadow2004] #ifdef MODVERSION image = (client->IsNextEMF())?16:1; #else //Modversion image = 1; #endif //Modversion //<==Modversion [shadow2004] } else { if (client->credits->GetScoreRatio(client/*->GetIP()*/) > 1) //==> Xman CreditSystem [shadow2004] image = 2; else image = 0; } POINT point = {cur_rec.left, cur_rec.top+1}; imagelist.Draw(dc,image, point, ILD_NORMAL | ((client->Credits() && client->Credits()->GetCurrentIdentState(client->GetIP()) == IS_IDENTIFIED) ? INDEXTOOVERLAYMASK(1) : 0)); Sbuffer = client->GetUserName(); cur_rec.left +=20; dc.DrawText(Sbuffer,Sbuffer.GetLength(),&cur_rec,DLC_DT_TEXT); cur_rec.left -=20; break; } case 1: if(file) Sbuffer = file->GetFileName(); else Sbuffer = _T("?"); break; case 2: if(file) { switch (file->GetUpPriority()) { case PR_VERYLOW : { Sbuffer = GetResString(IDS_PRIOVERYLOW); break; } case PR_LOW : { if( file->IsAutoUpPriority() ) Sbuffer = GetResString(IDS_PRIOAUTOLOW); else Sbuffer = GetResString(IDS_PRIOLOW); break; } case PR_NORMAL : { if( file->IsAutoUpPriority() ) Sbuffer = GetResString(IDS_PRIOAUTONORMAL); else Sbuffer = GetResString(IDS_PRIONORMAL); break; } case PR_HIGH : { if( file->IsAutoUpPriority() ) Sbuffer = GetResString(IDS_PRIOAUTOHIGH); else Sbuffer = GetResString(IDS_PRIOHIGH); break; } case PR_VERYHIGH : { Sbuffer = GetResString(IDS_PRIORELEASE); break; } default: Sbuffer.Empty(); } } else Sbuffer = _T("?"); break; case 3: Sbuffer.Format(_T("%i"),client->GetScore(false,false,true)); break; case 4: if (client->HasLowID()) { if (client->m_bAddNextConnect) Sbuffer.Format(_T("%i ****"),client->GetScore(false)); else Sbuffer.Format(_T("%i LowID"),client->GetScore(false)); } else Sbuffer.Format(_T("%i"),client->GetScore(false)); break; case 5: Sbuffer.Format(_T("%i"),client->GetAskedCount()); break; case 6: Sbuffer = CastSecondsToHM((::GetTickCount() - client->GetLastUpRequest())/1000); break; case 7: Sbuffer = CastSecondsToHM((::GetTickCount() - client->GetWaitStartTime())/1000); break; case 8: if(client->IsBanned()) Sbuffer = GetResString(IDS_YES); else Sbuffer = GetResString(IDS_NO); break; case 9: if( client->GetUpPartCount()) { cur_rec.bottom--; cur_rec.top++; client->DrawUpStatusBar(dc,&cur_rec,false); cur_rec.bottom++; cur_rec.top--; } break; //==>Modversion [shadow2004] #ifdef MODVERSION case 10: Sbuffer = client->GetClientSoftVer(); break; #endif //Modversion //<==Modversion [shadow2004] }
void CUploadListCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { if (!theApp.emuledlg->IsRunning()) return; if (!lpDrawItemStruct->itemData) return; CDC* odc = CDC::FromHandle(lpDrawItemStruct->hDC); BOOL bCtrlFocused = ((GetFocus() == this) || (GetStyle() & LVS_SHOWSELALWAYS)); if (lpDrawItemStruct->itemState & ODS_SELECTED) { if (bCtrlFocused) odc->SetBkColor(m_crHighlight); else odc->SetBkColor(m_crNoHighlight); } else odc->SetBkColor(GetBkColor()); const CUpDownClient* client = (CUpDownClient*)lpDrawItemStruct->itemData; CMemDC dc(odc, &lpDrawItemStruct->rcItem); CFont* pOldFont = dc.SelectObject(GetFont()); CRect cur_rec(lpDrawItemStruct->rcItem); COLORREF crOldTextColor = dc.SetTextColor((lpDrawItemStruct->itemState & ODS_SELECTED) ? m_crHighlightText : m_crWindowText); if (client->GetSlotNumber() > theApp.uploadqueue->GetActiveUploadsCount()) { dc.SetTextColor(::GetSysColor(COLOR_GRAYTEXT)); } int iOldBkMode; if (m_crWindowTextBk == CLR_NONE){ DefWindowProc(WM_ERASEBKGND, (WPARAM)(HDC)dc, 0); iOldBkMode = dc.SetBkMode(TRANSPARENT); } else iOldBkMode = OPAQUE; CKnownFile* file = theApp.sharedfiles->GetFileByID(client->GetUploadFileID()); CHeaderCtrl *pHeaderCtrl = GetHeaderCtrl(); int iCount = pHeaderCtrl->GetItemCount(); cur_rec.right = cur_rec.left - 8; cur_rec.left += 4; CString Sbuffer; for (int iCurrent = 0; iCurrent < iCount; iCurrent++) { int iColumn = pHeaderCtrl->OrderToIndex(iCurrent); if (!IsColumnHidden(iColumn)) { cur_rec.right += GetColumnWidth(iColumn); switch (iColumn) { case 0:{ uint8 image; if (client->IsFriend()) image = 4; else if (client->GetClientSoft() == SO_EDONKEYHYBRID){ if (client->credits->GetScoreRatio(client->GetIP()) > 1) image = 8; else image = 7; } else if (client->GetClientSoft() == SO_MLDONKEY){ if (client->credits->GetScoreRatio(client->GetIP()) > 1) image = 6; else image = 5; } else if (client->GetClientSoft() == SO_SHAREAZA){ if(client->credits->GetScoreRatio(client->GetIP()) > 1) image = 10; else image = 9; } else if (client->GetClientSoft() == SO_AMULE){ if(client->credits->GetScoreRatio(client->GetIP()) > 1) image = 12; else image = 11; } else if (client->GetClientSoft() == SO_LPHANT){ if(client->credits->GetScoreRatio(client->GetIP()) > 1) image = 14; else image = 13; } else if (client->ExtProtocolAvailable()){ if(client->credits->GetScoreRatio(client->GetIP()) > 1) image = 3; else image = 1; } else{ if (client->credits->GetScoreRatio(client->GetIP()) > 1) image = 2; else image = 0; } POINT point = {cur_rec.left, cur_rec.top+1}; imagelist.Draw(dc,image, point, ILD_NORMAL | ((client->Credits() && client->Credits()->GetCurrentIdentState(client->GetIP()) == IS_IDENTIFIED) ? INDEXTOOVERLAYMASK(1) : 0)); Sbuffer = client->GetUserName(); cur_rec.left += 20; dc.DrawText(Sbuffer, Sbuffer.GetLength(), &cur_rec, DLC_DT_TEXT); cur_rec.left -= 20; break; } case 1: if (file) Sbuffer = file->GetFileName(); else Sbuffer = _T("?"); break; case 2: Sbuffer = CastItoXBytes(client->GetDatarate(), false, true); break; case 3: // NOTE: If you change (add/remove) anything which is displayed here, update also the sorting part.. if (thePrefs.m_bExtControls) Sbuffer.Format( _T("%s (%s)"), CastItoXBytes(client->GetSessionUp(), false, false), CastItoXBytes(client->GetQueueSessionPayloadUp(), false, false)); else Sbuffer = CastItoXBytes(client->GetSessionUp(), false, false); break; case 4: if (client->HasLowID()) Sbuffer.Format(_T("%s (%s)"), CastSecondsToHM(client->GetWaitTime()/1000), GetResString(IDS_IDLOW)); else Sbuffer = CastSecondsToHM(client->GetWaitTime()/1000); break; case 5: Sbuffer = CastSecondsToHM(client->GetUpStartTimeDelay()/1000); break; case 6: Sbuffer = client->GetUploadStateDisplayString(); break; case 7: cur_rec.bottom--; cur_rec.top++; client->DrawUpStatusBar(dc, &cur_rec, false, thePrefs.UseFlatBar()); cur_rec.bottom++; cur_rec.top--; break; } if (iColumn != 7 && iColumn != 0) dc.DrawText(Sbuffer, Sbuffer.GetLength(), &cur_rec, DLC_DT_TEXT); cur_rec.left += GetColumnWidth(iColumn); } } //draw rectangle around selected item(s) if (lpDrawItemStruct->itemState & ODS_SELECTED) { RECT outline_rec = lpDrawItemStruct->rcItem; outline_rec.top--; outline_rec.bottom++; dc.FrameRect(&outline_rec, &CBrush(GetBkColor())); outline_rec.top++; outline_rec.bottom--; outline_rec.left++; outline_rec.right--; if (bCtrlFocused) dc.FrameRect(&outline_rec, &CBrush(m_crFocusLine)); else dc.FrameRect(&outline_rec, &CBrush(m_crNoFocusLine)); } if (m_crWindowTextBk == CLR_NONE) dc.SetBkMode(iOldBkMode); dc.SelectObject(pOldFont); dc.SetTextColor(crOldTextColor); }
void CIrcChannelListCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { if (!theApp.emuledlg->IsRunning()) return; if (!lpDrawItemStruct->itemData) return; CDC* odc = CDC::FromHandle(lpDrawItemStruct->hDC); BOOL bCtrlFocused = ((GetFocus() == this) || (GetStyle() & LVS_SHOWSELALWAYS)); if (lpDrawItemStruct->itemState & ODS_SELECTED) { if (bCtrlFocused) odc->SetBkColor(m_crHighlight); else odc->SetBkColor(m_crNoHighlight); } else odc->SetBkColor(GetBkColor()); const ChannelName* pChannel = (ChannelName*)lpDrawItemStruct->itemData; CMemDC dc(odc, &lpDrawItemStruct->rcItem); CFont* pOldFont = dc.SelectObject(GetFont()); CRect cur_rec(lpDrawItemStruct->rcItem); COLORREF crOldTextColor = dc.SetTextColor(m_crWindowText); int iOldBkMode; if (m_crWindowTextBk == CLR_NONE) { DefWindowProc(WM_ERASEBKGND, (WPARAM)(HDC)dc, 0); iOldBkMode = dc.SetBkMode(TRANSPARENT); } else iOldBkMode = OPAQUE; CString strBuff; CHeaderCtrl *pHeaderCtrl = GetHeaderCtrl(); int iCount = pHeaderCtrl->GetItemCount(); cur_rec.right = cur_rec.left - 8; cur_rec.left += 4; for (int iCurrent = 0; iCurrent < iCount; iCurrent++) { int iColumn = pHeaderCtrl->OrderToIndex(iCurrent); if (!IsColumnHidden(iColumn)) { int cx = GetColumnWidth(iColumn); cur_rec.right += cx; switch (iColumn) { case 0: strBuff = pChannel->m_sName; break; case 1: strBuff.Format(_T("%u"), pChannel->m_uUsers); break; case 2: strBuff = pChannel->m_sDesc; break; } dc->DrawText(strBuff, strBuff.GetLength(), &cur_rec, DT_LEFT); cur_rec.left += cx; } } //draw rectangle around selected item(s) if (lpDrawItemStruct->itemState & ODS_SELECTED) { RECT outline_rec = lpDrawItemStruct->rcItem; outline_rec.top--; outline_rec.bottom++; dc->FrameRect(&outline_rec, &CBrush(GetBkColor())); outline_rec.top++; outline_rec.bottom--; outline_rec.left++; outline_rec.right--; if (bCtrlFocused) dc->FrameRect(&outline_rec, &CBrush(m_crFocusLine)); else dc->FrameRect(&outline_rec, &CBrush(m_crNoFocusLine)); } if (m_crWindowTextBk == CLR_NONE) dc.SetBkMode(iOldBkMode); dc.SelectObject(pOldFont); dc.SetTextColor(crOldTextColor); }
void CQueueListCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { if (!theApp.emuledlg->IsRunning()) return; if (!lpDrawItemStruct->itemData) return; CDC* odc = CDC::FromHandle(lpDrawItemStruct->hDC); BOOL bCtrlFocused = ((GetFocus() == this) || (GetStyle() & LVS_SHOWSELALWAYS)); if (lpDrawItemStruct->itemState & ODS_SELECTED) { if (bCtrlFocused) odc->SetBkColor(m_crHighlight); else odc->SetBkColor(m_crNoHighlight); } else odc->SetBkColor(GetBkColor()); const CUpDownClient* client = (CUpDownClient*)lpDrawItemStruct->itemData; CMemDC dc(odc, &lpDrawItemStruct->rcItem); CFont* pOldFont = dc.SelectObject(GetFont()); CRect cur_rec(lpDrawItemStruct->rcItem); COLORREF crOldTextColor = dc.SetTextColor((lpDrawItemStruct->itemState & ODS_SELECTED) ? m_crHighlightText : m_crWindowText); int iOldBkMode; if (m_crWindowTextBk == CLR_NONE){ DefWindowProc(WM_ERASEBKGND, (WPARAM)(HDC)dc, 0); iOldBkMode = dc.SetBkMode(TRANSPARENT); } else iOldBkMode = OPAQUE; CKnownFile* file = theApp.sharedfiles->GetFileByID(client->GetUploadFileID()); CHeaderCtrl *pHeaderCtrl = GetHeaderCtrl(); int iCount = pHeaderCtrl->GetItemCount(); cur_rec.right = cur_rec.left - 8; cur_rec.left += 4; CString Sbuffer; for(int iCurrent = 0; iCurrent < iCount; iCurrent++){ int iColumn = pHeaderCtrl->OrderToIndex(iCurrent); if( !IsColumnHidden(iColumn) ){ cur_rec.right += GetColumnWidth(iColumn); switch(iColumn){ case 0:{ uint8 image; if (client->IsFriend()) image = 4; else if (client->GetClientSoft() == SO_EDONKEYHYBRID){ if (client->credits->GetScoreRatio(client->GetIP()) > 1) image = 8; else image = 7; } else if (client->GetClientSoft() == SO_MLDONKEY){ if (client->credits->GetScoreRatio(client->GetIP()) > 1) image = 6; else image = 5; } else if (client->GetClientSoft() == SO_SHAREAZA){ if(client->credits->GetScoreRatio(client->GetIP()) > 1) image = 10; else image = 9; } else if (client->GetClientSoft() == SO_AMULE){ if(client->credits->GetScoreRatio(client->GetIP()) > 1) image = 12; else image = 11; } else if (client->GetClientSoft() == SO_LPHANT){ if(client->credits->GetScoreRatio(client->GetIP()) > 1) image = 14; else image = 13; } else if (client->ExtProtocolAvailable()){ if(client->credits->GetScoreRatio(client->GetIP()) > 1) image = 3; else image = 1; } else{ if (client->credits->GetScoreRatio(client->GetIP()) > 1) image = 2; else image = 0; } uint32 nOverlayImage = 0; if ((client->Credits() && client->Credits()->GetCurrentIdentState(client->GetIP()) == IS_IDENTIFIED)) nOverlayImage |= 1; if (client->IsObfuscatedConnectionEstablished()) nOverlayImage |= 2; int iIconPosY = (cur_rec.Height() > 16) ? ((cur_rec.Height() - 16) / 2) : 1; POINT point = {cur_rec.left, cur_rec.top + iIconPosY}; imagelist.Draw(dc,image, point, ILD_NORMAL | INDEXTOOVERLAYMASK(nOverlayImage)); Sbuffer = client->GetUserName(); cur_rec.left += 20; dc.DrawText(Sbuffer, Sbuffer.GetLength(), &cur_rec, DLC_DT_TEXT); cur_rec.left -= 20; break; } case 1: if(file) Sbuffer = file->GetFileName(); else Sbuffer = _T("?"); break; case 2: if(file){ switch (file->GetUpPriority()) { case PR_VERYLOW : { Sbuffer = GetResString(IDS_PRIOVERYLOW); break; } case PR_LOW : { if( file->IsAutoUpPriority() ) Sbuffer = GetResString(IDS_PRIOAUTOLOW); else Sbuffer = GetResString(IDS_PRIOLOW); break; } case PR_NORMAL : { if( file->IsAutoUpPriority() ) Sbuffer = GetResString(IDS_PRIOAUTONORMAL); else Sbuffer = GetResString(IDS_PRIONORMAL); break; } case PR_HIGH : { if( file->IsAutoUpPriority() ) Sbuffer = GetResString(IDS_PRIOAUTOHIGH); else Sbuffer = GetResString(IDS_PRIOHIGH); break; } case PR_VERYHIGH : { Sbuffer = GetResString(IDS_PRIORELEASE); break; } default: Sbuffer.Empty(); } } else Sbuffer = _T("?"); break; case 3: Sbuffer.Format(_T("%i"),client->GetScore(false,false,true)); break; case 4: if (client->HasLowID()){ if (client->m_bAddNextConnect) Sbuffer.Format(_T("%i ****"),client->GetScore(false)); else Sbuffer.Format(_T("%i (%s)"),client->GetScore(false), GetResString(IDS_IDLOW)); } else Sbuffer.Format(_T("%i"),client->GetScore(false)); break; case 5: Sbuffer.Format(_T("%i"),client->GetAskedCount()); break; case 6: Sbuffer = CastSecondsToHM((::GetTickCount() - client->GetLastUpRequest())/1000); break; case 7: Sbuffer = CastSecondsToHM((::GetTickCount() - client->GetWaitStartTime())/1000); break; case 8: if(client->IsBanned()) Sbuffer = GetResString(IDS_YES); else Sbuffer = GetResString(IDS_NO); break; case 9: if( client->GetUpPartCount()){ cur_rec.bottom--; cur_rec.top++; client->DrawUpStatusBar(dc,&cur_rec,false,thePrefs.UseFlatBar()); cur_rec.bottom++; cur_rec.top--; } break; } if( iColumn != 9 && iColumn != 0) dc.DrawText(Sbuffer,Sbuffer.GetLength(),&cur_rec,DLC_DT_TEXT); cur_rec.left += GetColumnWidth(iColumn); } } // draw rectangle around selected item(s) if (lpDrawItemStruct->itemState & ODS_SELECTED) { RECT outline_rec = lpDrawItemStruct->rcItem; outline_rec.top--; outline_rec.bottom++; dc.FrameRect(&outline_rec, &CBrush(GetBkColor())); outline_rec.top++; outline_rec.bottom--; outline_rec.left++; outline_rec.right--; if(bCtrlFocused) dc.FrameRect(&outline_rec, &CBrush(m_crFocusLine)); else dc.FrameRect(&outline_rec, &CBrush(m_crNoFocusLine)); } if (m_crWindowTextBk == CLR_NONE) dc.SetBkMode(iOldBkMode); dc.SelectObject(pOldFont); dc.SetTextColor(crOldTextColor); }
void CListCtrlEx::DrawItem(LPDRAWITEMSTRUCT lpDraw) {try{ int cCols = GetHeaderCtrl ()->GetItemCount (); CDC *dc = CDC::FromHandle (lpDraw->hDC); int xStart = lpDraw->rcItem.left; CImageList *pImages = GetImageList (LVSIL_SMALL); BOOL bNeedBorder = FALSE; CHeaderCtrl* pHdr = GetHeaderCtrl (); for (int i = 0; i < cCols; i++) { LVITEM item; TCHAR szItem [10000]; int colWidth = GetColumnWidth (pHdr->OrderToIndex (i)); xStart += 5; colWidth -= 5; item.iItem = lpDraw->itemID; item.iSubItem = i; item.pszText = szItem; item.cchTextMax = sizeof (szItem); item.mask = LVIF_IMAGE | LVIF_TEXT; GetItem (&item); if (i == 0) { item.state = GetItemState (lpDraw->itemID, LVIS_SELECTED|LVIS_FOCUSED); COLORREF clrBg = m_vInfo [lpDraw->itemID].clrBg; COLORREF clrText = m_vInfo [lpDraw->itemID].clrText; if (item.state & LVIS_FOCUSED) bNeedBorder = TRUE; if (item.state & LVIS_SELECTED) { clrBg = GetSysColor (COLOR_HIGHLIGHT); clrText = GetSysColor (COLOR_HIGHLIGHTTEXT); if (bNeedBorder == FALSE) { if (GetSelectionMark () == (int)lpDraw->itemID) bNeedBorder = TRUE; } } CBrush br; CPen pen; CBrush *oldBr; CPen *oldPen; if (RGBIsEqual (clrBg, clrText)) clrText = (~clrText) & 0x00FFFFFF; dc->SetTextColor (clrText); br.CreateSolidBrush (clrBg); pen.CreatePen (PS_SOLID, 1, clrBg); oldBr = dc->SelectObject (&br); oldPen = dc->SelectObject (&pen); dc->Rectangle (&lpDraw->rcItem); if (m_bGrid) { CPen pen1 (PS_SOLID, 1, m_clrGrid); dc->SelectObject (&pen1); dc->MoveTo (lpDraw->rcItem.left, lpDraw->rcItem.bottom-1); dc->LineTo (lpDraw->rcItem.right, lpDraw->rcItem.bottom-1); dc->SelectObject (oldPen); } dc->SelectObject (oldBr); dc->SelectObject (oldPen); if (pImages) { CPoint pt; pt.x = xStart; pt.y = lpDraw->rcItem.top; if (m_pSelImages && (item.state & LVIS_SELECTED)) m_pSelImages->Draw (dc, item.iImage, pt, ILD_TRANSPARENT); else pImages->Draw (dc, item.iImage, pt, ILD_TRANSPARENT); IMAGEINFO inf; pImages->GetImageInfo (item.iImage, &inf); xStart += inf.rcImage.right - inf.rcImage.left + 5; colWidth -= inf.rcImage.right - inf.rcImage.left + 5; } } if (*item.pszText) { int needX = GetStringWidth (item.pszText); BOOL bDrawText = TRUE; RECT rcText = lpDraw->rcItem; rcText.left = xStart; rcText.right = xStart + colWidth - 5; if (needX > colWidth-5) { RECT rc = rcText; int dx = GetStringWidth ("..."); if (dx <= colWidth-5) { rc.left = rc.right - dx; dc->DrawText ("...", &rc, DT_SINGLELINE | DT_LEFT | DT_VCENTER); rcText.right = rc.left - 5; } else bDrawText = FALSE; } if (bDrawText) dc->DrawText (szItem, &rcText, DT_SINGLELINE | DT_LEFT | DT_VCENTER | DT_NOPREFIX); } xStart += colWidth; if (m_bGrid) { CPen pen (PS_SOLID, 1, m_clrGrid); CPen *oldPen = dc->SelectObject (&pen); dc->MoveTo (xStart-1, lpDraw->rcItem.top); dc->LineTo (xStart-1, lpDraw->rcItem.bottom); dc->SelectObject (oldPen); } } if (bNeedBorder) { dc->SetTextColor (m_vInfo [lpDraw->itemID].clrText); RECT rc = lpDraw->rcItem; rc.bottom--; rc.right--; dc->DrawFocusRect (&rc); } }catch (...){} }
void CServerListCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) // 与 IP to Country 有关,不能注释掉 { if( !theApp.emuledlg->IsRunning() ) return; if (!lpDrawItemStruct->itemData) return; CDC* odc = CDC::FromHandle(lpDrawItemStruct->hDC); BOOL bCtrlFocused = ((GetFocus() == this ) || (GetStyle() & LVS_SHOWSELALWAYS)); if( (lpDrawItemStruct->itemAction | ODA_SELECT) && (lpDrawItemStruct->itemState & ODS_SELECTED )){ if(bCtrlFocused) odc->SetBkColor(m_crHighlight); else odc->SetBkColor(m_crNoHighlight); } else odc->SetBkColor(GetBkColor()); const CServer* server = (CServer*)lpDrawItemStruct->itemData; CRect rcItem(lpDrawItemStruct->rcItem); CMemDC dc(CDC::FromHandle(lpDrawItemStruct->hDC), &rcItem); CFont* pOldFont = dc.SelectObject(GetFont()); RECT cur_rec = rcItem; COLORREF crOldTextColor = dc.SetTextColor(m_crWindowText); int iOldBkMode; if (m_crWindowTextBk == CLR_NONE){ DefWindowProc(WM_ERASEBKGND, (WPARAM)(HDC)dc, 0); iOldBkMode = dc.SetBkMode(TRANSPARENT); } else iOldBkMode = OPAQUE; CString Sbuffer; CHeaderCtrl *pHeaderCtrl = GetHeaderCtrl(); int iCount = pHeaderCtrl->GetItemCount(); cur_rec.right = cur_rec.left - 8; cur_rec.left += 4; for(int iCurrent = 0; iCurrent < iCount; iCurrent++){ int iColumn = pHeaderCtrl->OrderToIndex(iCurrent); if( !IsColumnHidden(iColumn) ){ cur_rec.right += GetColumnWidth(iColumn); RECT cur_backup = cur_rec; Sbuffer = GetItemText(lpDrawItemStruct->itemID, iColumn); switch(iColumn) { case 0: { POINT point = {cur_rec.left, cur_rec.top};//check CServer* cur_srv; if (theApp.serverconnect->IsConnected() && (cur_srv = theApp.serverconnect->GetCurrentServer()) != NULL && cur_srv->GetPort() == server->GetPort() && _tcsicmp(cur_srv->GetAddress(), server->GetAddress()) == 0) { imagelist.Draw(dc,0, point, ILD_NORMAL | INDEXTOOVERLAYMASK(1)); } else { imagelist.Draw(dc,0, point, ILD_NORMAL); } cur_rec.left += 20; } //EastShare Start - added by AndCycle, IP to Country Sbuffer = server->GetCountryName() + Sbuffer; if(theApp.ip2country->ShowCountryFlag()){ POINT point = {cur_rec.left, cur_rec.top};//check theApp.ip2country->GetFlagImageList()->DrawIndirect(dc, server->GetCountryFlagIndex(), point, CSize(18,16), CPoint(0,0), ILD_NORMAL); cur_rec.left +=20; } //EastShare End - added by AndCycle, IP to Country break; } //get the text justification LV_COLUMN lvc; lvc.mask = LVCF_FMT | LVCF_WIDTH; GetColumn(iColumn, &lvc); UINT nJustify = DT_LEFT; switch(lvc.fmt & LVCFMT_JUSTIFYMASK) { case LVCFMT_RIGHT: nJustify = DT_RIGHT; break; case LVCFMT_CENTER: nJustify = DT_CENTER; break; default: break; } #define MLC_DT_TEXT (DT_SINGLELINE | DT_NOPREFIX | DT_VCENTER | DT_END_ELLIPSIS) dc->DrawText(Sbuffer,Sbuffer.GetLength(),&cur_rec,MLC_DT_TEXT | nJustify); cur_rec = cur_backup; cur_rec.left += GetColumnWidth(iColumn); } } //draw rectangle around selected item(s) if ((lpDrawItemStruct->itemAction | ODA_SELECT) && (lpDrawItemStruct->itemState & ODS_SELECTED)) { RECT outline_rec = lpDrawItemStruct->rcItem; outline_rec.top--; outline_rec.bottom++; dc->FrameRect(&outline_rec, &CBrush(GetBkColor())); outline_rec.top++; outline_rec.bottom--; outline_rec.left++; outline_rec.right--; if(bCtrlFocused) dc->FrameRect(&outline_rec, &CBrush(m_crFocusLine)); else dc->FrameRect(&outline_rec, &CBrush(m_crNoFocusLine)); } if (m_crWindowTextBk == CLR_NONE) dc.SetBkMode(iOldBkMode); dc.SelectObject(pOldFont); dc.SetTextColor(crOldTextColor); }
void CQueueListCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { #define LIST_CELL_PADDING 6 //should be even number if (!g_App.m_pMDlg->IsRunning() || !lpDrawItemStruct->itemData) return; CDC *odc = CDC::FromHandle(lpDrawItemStruct->hDC); BOOL bCtrlFocused = ((GetFocus() == this) || (GetStyle() & LVS_SHOWSELALWAYS)); COLORREF crBk, crWinBk; crWinBk = crBk = GetBkColor(); if (lpDrawItemStruct->itemState & ODS_SELECTED) crBk = (bCtrlFocused) ? m_crHighlight : m_crNoHighlight; CUpDownClient *pClient = reinterpret_cast<CUpDownClient*>(lpDrawItemStruct->itemData); CMemDC dc(odc, &lpDrawItemStruct->rcItem, crWinBk, crBk); CFont *pOldFont = dc.SelectObject(GetFont()); COLORREF crOldTextColor = dc->SetTextColor(::GetSysColor(COLOR_WINDOWTEXT)); int iWidth, iColumn; bool bMeasuring = (m_iMeasuringColumn >= 0); UINT iCalcFlag = bMeasuring ? (DT_LEFT|DT_SINGLELINE|DT_VCENTER|DT_NOPREFIX|DT_NOCLIP|DT_CALCRECT) : (DT_LEFT|DT_SINGLELINE|DT_VCENTER|DT_NOPREFIX|DT_NOCLIP|DT_END_ELLIPSIS); if (IsRightToLeftLanguage()) iCalcFlag |= DT_RTLREADING; RECT r = lpDrawItemStruct->rcItem; CString strBuffer; CKnownFile *pKnownFile = g_App.m_pSharedFilesList->GetFileByID(pClient->m_reqFileHash); CHeaderCtrl *pHeaderCtrl = GetHeaderCtrl(); int iNumColumns = pHeaderCtrl->GetItemCount(); r.right = r.left - LIST_CELL_PADDING / 2; r.left += LIST_CELL_PADDING / 2; iWidth = LIST_CELL_PADDING; for (int iCurrent = 0; iCurrent < iNumColumns; iCurrent++) { iColumn = pHeaderCtrl->OrderToIndex(iCurrent); if (IsColumnHidden(iColumn) || (bMeasuring && iColumn != m_iMeasuringColumn)) continue; r.right += CListCtrl::GetColumnWidth(iColumn); switch (iColumn) { case QLCOL_USERNAME: { if (!bMeasuring) { POINT point = {r.left, r.top + 1}; int iImgLstIdx = CLIENT_IMGLST_PLAIN; // Select corresponding image list depending on client properties if (pClient->IsBanned()) iImgLstIdx = CLIENT_IMGLST_BANNED; else if (pClient->IsFriend()) iImgLstIdx = CLIENT_IMGLST_FRIEND; else if (pClient->m_pCredits->HasHigherScoreRatio(pClient->GetIP())) iImgLstIdx = CLIENT_IMGLST_CREDITUP; // Display Client icon g_App.m_pMDlg->m_clientImgLists[iImgLstIdx].Draw(dc, pClient->GetClientIconIndex(), point, ILD_NORMAL); r.left += 20; if (g_App.m_pIP2Country->ShowCountryFlag()) { point.x += 20; point.y += 2; g_App.m_pIP2Country->GetFlagImageList()->Draw(dc, pClient->GetCountryIndex(), point, ILD_NORMAL); r.left += 22; } } else { iWidth += 20; if (g_App.m_pIP2Country->ShowCountryFlag()) iWidth += 22; } strBuffer = pClient->GetUserName(); break; } case QLCOL_FILENAME: if (pKnownFile) strBuffer = pKnownFile->GetFileName(); else strBuffer = _T("?"); break; case QLCOL_FILEPRIORITY: { if (pKnownFile) { UINT dwResStrId; switch (pKnownFile->GetULPriority()) { case PR_RELEASE: dwResStrId = IDS_PRIORELEASE; break; case PR_HIGH: dwResStrId = IDS_PRIOHIGH; break; case PR_LOW: dwResStrId = IDS_PRIOLOW; break; case PR_VERYLOW: dwResStrId = IDS_PRIOVERYLOW; break; default: dwResStrId = IDS_PRIONORMAL; break; } GetResString(&strBuffer, dwResStrId); } else strBuffer = _T("?"); break; } case QLCOL_PARTS: if (pClient->GetUpPartCount()) strBuffer.Format(_T("%u/%u"), pClient->GetAvailUpPartCount(), pClient->GetUpPartCount()); else strBuffer = _T(""); break; case QLCOL_PROGRESS: { if (pClient->GetUpPartCount() && g_App.m_pPrefs->IsUploadPartsEnabled()) { if (!bMeasuring) { RECT r2; r2.bottom = r.bottom - 1; r2.top = r.top + 1; r2.right = r.right + LIST_CELL_PADDING / 2; r2.left = r.left - LIST_CELL_PADDING / 2; pClient->DrawUpStatusBar(dc, &r2, g_App.m_pPrefs->UseFlatBar()); } iWidth = 300; } break; } case QLCOL_QLRATING: strBuffer.Format(_T("%u"), pClient->GetScore(true)); break; case QLCOL_SCORE: // Note: actually the client, which is downloading from us should be not in WaitingQueue if (pClient->IsDownloading()) strBuffer = _T("-"); else strBuffer.Format((pClient->IsAddNextConnect()) ? _T("%u*") : _T("%u"), pClient->GetScore()); break; case QLCOL_SFRATIO: if (pKnownFile != NULL) strBuffer.Format(_T("%.2f"), pKnownFile->GetSizeRatio()); else strBuffer = _T("-"); break; case QLCOL_RFRATIO: if (pKnownFile != NULL) strBuffer.Format(_T("%.2f"), pKnownFile->GetPopularityRatio()); else strBuffer = _T("-"); break; case QLCOL_TIMESASKED: strBuffer.Format(_T("%u"), pClient->GetAskedCount()); break; case QLCOL_LASTSEEN: strBuffer = CastSecondsToHM((GetTickCount() - pClient->GetLastUpRequest())/1000); break; case QLCOL_ENTEREDQUEUE: strBuffer = CastSecondsToHM((GetTickCount() - pClient->GetWaitStartTime())/1000); break; case QLCOL_BANNED: strBuffer = YesNoStr(pClient->IsBanned()); break; case QLCOL_COUNTRY: strBuffer = pClient->GetCountryName(); break; } if (iColumn != QLCOL_PROGRESS) { dc->DrawText(strBuffer, &r, iCalcFlag); if (bMeasuring && !strBuffer.IsEmpty()) iWidth += r.right - r.left + 1; } r.left = r.right + LIST_CELL_PADDING; if (bMeasuring) { // Pin the column widths at some reasonable value if (iWidth < 40) iWidth = 40; if (iWidth > m_iColumnMaxWidths[m_iMeasuringColumn]) m_iColumnMaxWidths[m_iMeasuringColumn] = iWidth; } } // Draw rectangle around selected item(s) if (lpDrawItemStruct->itemState & ODS_SELECTED) { RECT rOutline = lpDrawItemStruct->rcItem; CBrush FrmBrush((bCtrlFocused) ? m_crFocusLine : m_crNoFocusLine); rOutline.left++; rOutline.right--; dc->FrameRect(&rOutline, &FrmBrush); } if (pOldFont) dc.SelectObject(pOldFont); if (crOldTextColor) dc.SetTextColor(crOldTextColor); #undef LIST_CELL_PADDING }
void CDownloadClientsCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { if (!theApp.emuledlg->IsRunning()) return; if (!lpDrawItemStruct->itemData) return; CMemDC dc(CDC::FromHandle(lpDrawItemStruct->hDC), &lpDrawItemStruct->rcItem); BOOL bCtrlFocused; InitItemMemDC(dc, lpDrawItemStruct, bCtrlFocused); CRect cur_rec(lpDrawItemStruct->rcItem); CRect rcClient; GetClientRect(&rcClient); const CUpDownClient *client = (CUpDownClient *)lpDrawItemStruct->itemData; CHeaderCtrl *pHeaderCtrl = GetHeaderCtrl(); int iCount = pHeaderCtrl->GetItemCount(); cur_rec.right = cur_rec.left - sm_iLabelOffset; cur_rec.left += sm_iIconOffset; for (int iCurrent = 0; iCurrent < iCount; iCurrent++) { int iColumn = pHeaderCtrl->OrderToIndex(iCurrent); if (!IsColumnHidden(iColumn)) { UINT uDrawTextAlignment; int iColumnWidth = GetColumnWidth(iColumn, uDrawTextAlignment); cur_rec.right += iColumnWidth; if (cur_rec.left < cur_rec.right && HaveIntersection(rcClient, cur_rec)) { TCHAR szItem[1024]; GetItemDisplayText(client, iColumn, szItem, _countof(szItem)); switch (iColumn) { case 0:{ int iImage; if (client->credits != NULL) { if (client->IsFriend()) iImage = 4; else if (client->GetClientSoft() == SO_EDONKEYHYBRID) { if (client->credits->GetScoreRatio(client->GetIP()) > 1) iImage = 8; else iImage = 7; } else if (client->GetClientSoft() == SO_MLDONKEY) { if (client->credits->GetScoreRatio(client->GetIP()) > 1) iImage = 6; else iImage = 5; } else if (client->GetClientSoft() == SO_SHAREAZA) { if (client->credits->GetScoreRatio(client->GetIP()) > 1) iImage = 10; else iImage = 9; } else if (client->GetClientSoft() == SO_AMULE) { if (client->credits->GetScoreRatio(client->GetIP()) > 1) iImage = 12; else iImage = 11; } else if (client->GetClientSoft() == SO_LPHANT) { if (client->credits->GetScoreRatio(client->GetIP()) > 1) iImage = 14; else iImage = 13; } else if (client->ExtProtocolAvailable()) { if (client->credits->GetScoreRatio(client->GetIP()) > 1) iImage = 3; else iImage = 1; } else { if (client->credits->GetScoreRatio(client->GetIP()) > 1) iImage = 2; else iImage = 0; } } else iImage = 0; UINT nOverlayImage = 0; if ((client->Credits() && client->Credits()->GetCurrentIdentState(client->GetIP()) == IS_IDENTIFIED)) nOverlayImage |= 1; if (client->IsObfuscatedConnectionEstablished()) nOverlayImage |= 2; int iIconPosY = (cur_rec.Height() > 16) ? ((cur_rec.Height() - 16) / 2) : 1; POINT point = { cur_rec.left, cur_rec.top + iIconPosY }; m_ImageList.Draw(dc, iImage, point, ILD_NORMAL | INDEXTOOVERLAYMASK(nOverlayImage)); cur_rec.left += 16 + sm_iLabelOffset; dc.DrawText(szItem, -1, &cur_rec, MLC_DT_TEXT | uDrawTextAlignment); cur_rec.left -= 16; cur_rec.right -= sm_iSubItemInset; break; } case 4: cur_rec.bottom--; cur_rec.top++; client->DrawStatusBar(dc, &cur_rec, false, thePrefs.UseFlatBar()); cur_rec.bottom++; cur_rec.top--; break; default: dc.DrawText(szItem, -1, &cur_rec, MLC_DT_TEXT | uDrawTextAlignment); break; } } cur_rec.left += iColumnWidth; } } DrawFocusRect(dc, lpDrawItemStruct->rcItem, lpDrawItemStruct->itemState & ODS_FOCUS, bCtrlFocused, lpDrawItemStruct->itemState & ODS_SELECTED); }
void CClientListCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { if (!theApp.emuledlg->IsRunning()) return; if (!lpDrawItemStruct->itemData) return; CDC* odc = CDC::FromHandle(lpDrawItemStruct->hDC); BOOL bCtrlFocused = ((GetFocus() == this) || (GetStyle() & LVS_SHOWSELALWAYS)); if (lpDrawItemStruct->itemState & ODS_SELECTED) { if (bCtrlFocused) odc->SetBkColor(m_crHighlight); else odc->SetBkColor(m_crNoHighlight); } else odc->SetBkColor(GetBkColor()); const CUpDownClient* client = (CUpDownClient*)lpDrawItemStruct->itemData; CMemDC dc(odc, &lpDrawItemStruct->rcItem); CFont* pOldFont = dc.SelectObject(GetFont()); CRect cur_rec(lpDrawItemStruct->rcItem); COLORREF crOldTextColor = dc.SetTextColor((lpDrawItemStruct->itemState & ODS_SELECTED) ? m_crHighlightText : m_crWindowText); int iOldBkMode; if (m_crWindowTextBk == CLR_NONE){ DefWindowProc(WM_ERASEBKGND, (WPARAM)(HDC)dc, 0); iOldBkMode = dc.SetBkMode(TRANSPARENT); } else iOldBkMode = OPAQUE; CHeaderCtrl *pHeaderCtrl = GetHeaderCtrl(); int iCount = pHeaderCtrl->GetItemCount(); cur_rec.right = cur_rec.left - 8; cur_rec.left += 4; CString Sbuffer; for(int iCurrent = 0; iCurrent < iCount; iCurrent++){ int iColumn = pHeaderCtrl->OrderToIndex(iCurrent); if( !IsColumnHidden(iColumn) ){ cur_rec.right += GetColumnWidth(iColumn); switch(iColumn){ case 0:{ uint8 image; if (client->IsFriend()) image = 2; else if (client->GetClientSoft() == SO_EDONKEYHYBRID) image = 4; else if (client->GetClientSoft() == SO_MLDONKEY) image = 3; else if (client->GetClientSoft() == SO_SHAREAZA) image = 5; else if (client->GetClientSoft() == SO_URL) image = 6; else if (client->GetClientSoft() == SO_AMULE) image = 7; else if (client->GetClientSoft() == SO_LPHANT) image = 8; else if (client->ExtProtocolAvailable()) image = 1; else image = 0; uint32 nOverlayImage = 0; if ((client->Credits() && client->Credits()->GetCurrentIdentState(client->GetIP()) == IS_IDENTIFIED)) nOverlayImage |= 1; if (client->IsObfuscatedConnectionEstablished()) nOverlayImage |= 2; POINT point = {cur_rec.left, cur_rec.top+1}; imagelist.Draw(dc,image, point, ILD_NORMAL | ((client->Credits() && client->Credits()->GetCurrentIdentState(client->GetIP()) == IS_IDENTIFIED) ? INDEXTOOVERLAYMASK(1) : 0)); if (client->GetUserName()==NULL) Sbuffer.Format(_T("(%s)"), GetResString(IDS_UNKNOWN)); else Sbuffer = client->GetUserName(); //EastShare Start - added by AndCycle, IP to Country CString tempStr; tempStr.Format(_T("%s%s"), client->GetCountryName(), Sbuffer); Sbuffer = tempStr; if(CGlobalVariable::ip2country->ShowCountryFlag()){ cur_rec.left+=20; POINT point2= {cur_rec.left,cur_rec.top+1}; CGlobalVariable::ip2country->GetFlagImageList()->DrawIndirect(dc, client->GetCountryFlagIndex(), point2, CSize(18,16), CPoint(0,0), ILD_NORMAL); } //EastShare End - added by AndCycle, IP to Country cur_rec.left +=20; dc.DrawText(Sbuffer,Sbuffer.GetLength(),&cur_rec,DLC_DT_TEXT); cur_rec.left -=20; //EastShare Start - added by AndCycle, IP to Country if(CGlobalVariable::ip2country->ShowCountryFlag()){ cur_rec.left-=20; } //EastShare End - added by AndCycle, IP to Country break; } case 1:{ Sbuffer = client->GetUploadStateDisplayString(); break; } case 2:{ if(client->credits) Sbuffer = CastItoXBytes(client->credits->GetUploadedTotal(), false, false); else Sbuffer.Empty(); break; } case 3:{ Sbuffer = client->GetDownloadStateDisplayString(); break; } case 4:{ if(client->credits) Sbuffer = CastItoXBytes(client->credits->GetDownloadedTotal(), false, false); else Sbuffer.Empty(); break; } case 5:{ Sbuffer = client->GetClientSoftVer(); if (Sbuffer.IsEmpty()) Sbuffer = GetResString(IDS_UNKNOWN); break; } case 6:{ if(client->socket){ if(client->socket->IsConnected()){ Sbuffer = GetResString(IDS_YES); break; } } Sbuffer = GetResString(IDS_NO); break; } case 7: Sbuffer = md4str(client->GetUserHash()); break; } if( iColumn != 0) dc.DrawText(Sbuffer,Sbuffer.GetLength(),&cur_rec,DLC_DT_TEXT); cur_rec.left += GetColumnWidth(iColumn); } } // draw rectangle around selected item(s) if (lpDrawItemStruct->itemState & ODS_SELECTED) { RECT outline_rec = lpDrawItemStruct->rcItem; outline_rec.top--; outline_rec.bottom++; dc.FrameRect(&outline_rec, &CBrush(GetBkColor())); outline_rec.top++; outline_rec.bottom--; outline_rec.left++; outline_rec.right--; if(bCtrlFocused) dc.FrameRect(&outline_rec, &CBrush(m_crFocusLine)); else dc.FrameRect(&outline_rec, &CBrush(m_crNoFocusLine)); } if (m_crWindowTextBk == CLR_NONE) dc.SetBkMode(iOldBkMode); dc.SelectObject(pOldFont); dc.SetTextColor(crOldTextColor); }
void CUploadListCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) { if (!theApp.emuledlg->IsRunning()) return; if (!lpDrawItemStruct->itemData) return; CMemDC dc(CDC::FromHandle(lpDrawItemStruct->hDC), &lpDrawItemStruct->rcItem); BOOL bCtrlFocused; InitItemMemDC(dc, lpDrawItemStruct, bCtrlFocused); CRect cur_rec(lpDrawItemStruct->rcItem); CRect rcClient; GetClientRect(&rcClient); const CUpDownClient* client = (CUpDownClient*)lpDrawItemStruct->itemData; COLORREF crOldBackColor = dc->GetBkColor(); //Xman PowerRelease CKnownFile* file = CGlobalVariable::sharedfiles->GetFileByID(client->GetUploadFileID()); CHeaderCtrl *pHeaderCtrl = GetHeaderCtrl(); int iCount = pHeaderCtrl->GetItemCount(); cur_rec.right = cur_rec.left - 8; cur_rec.left += 4; CString Sbuffer; for (int iCurrent = 0; iCurrent < iCount; iCurrent++) { int iColumn = pHeaderCtrl->OrderToIndex(iCurrent); if (!IsColumnHidden(iColumn)) { cur_rec.right += GetColumnWidth(iColumn); switch (iColumn) { case 0: { uint8 image; if (client->IsFriend()) image = 4; else if (client->GetClientSoft() == SO_EDONKEYHYBRID) { if (client->credits && client->credits->GetScoreRatio(client->GetIP()) > 1) image = 8; else image = 7; } else if (client->GetClientSoft() == SO_MLDONKEY) { if (client->credits && client->credits->GetScoreRatio(client->GetIP()) > 1) image = 6; else image = 5; } else if (client->GetClientSoft() == SO_SHAREAZA) { if(client->credits && client->credits->GetScoreRatio(client->GetIP()) > 1) image = 10; else image = 9; } else if (client->GetClientSoft() == SO_AMULE) { if(client->credits && client->credits->GetScoreRatio(client->GetIP()) > 1) image = 12; else image = 11; } else if (client->GetClientSoft() == SO_LPHANT) { if(client->credits && client->credits->GetScoreRatio(client->GetIP()) > 1) image = 14; else image = 13; } else if (client->ExtProtocolAvailable()) { if(client->credits && client->credits->GetScoreRatio(client->GetIP()) > 1) image = 3; else image = 1; } else { if (client->credits && client->credits->GetScoreRatio(client->GetIP()) > 1) image = 2; else image = 0; } uint32 nOverlayImage = 0; if ((client->Credits() && client->Credits()->GetCurrentIdentState(client->GetIP()) == IS_IDENTIFIED)) nOverlayImage |= 1; if (client->IsObfuscatedConnectionEstablished()) nOverlayImage |= 2; POINT point = {cur_rec.left, cur_rec.top+1}; imagelist.Draw(dc,image, point, ILD_NORMAL | ((client->Credits() && client->Credits()->GetCurrentIdentState(client->GetIP()) == IS_IDENTIFIED) ? INDEXTOOVERLAYMASK(1) : 0)); Sbuffer = client->GetUserName(); //EastShare Start - added by AndCycle, IP to Country CString tempStr; tempStr.Format(_T("%s%s"), client->GetCountryName(), Sbuffer); Sbuffer = tempStr; if(CGlobalVariable::ip2country->ShowCountryFlag()) { cur_rec.left += 20; POINT point2= {cur_rec.left,cur_rec.top+1}; CGlobalVariable::ip2country->GetFlagImageList()->DrawIndirect(dc, client->GetCountryFlagIndex(), point2, CSize(18,16), CPoint(0,0), ILD_NORMAL); } //EastShare End - added by AndCycle, IP to Country cur_rec.left += 20; dc.DrawText(Sbuffer, Sbuffer.GetLength(), &cur_rec, DLC_DT_TEXT); cur_rec.left -= 20; //EastShare Start - added by AndCycle, IP to Country if(CGlobalVariable::ip2country->ShowCountryFlag()) { cur_rec.left-=20; } //EastShare End - added by AndCycle, IP to Country break; } case 1: if (file) Sbuffer = file->GetFileName(); else Sbuffer = _T("?"); if(file && file->GetUpPriority()==PR_POWER) ///PowerRelease dc->SetBkColor(RGB(255,225,225)); break; case 2: Sbuffer = CastItoXBytes(client->GetDatarate(), false, true); break; case 3: // NOTE: If you change (add/remove) anything which is displayed here, update also the sorting part.. if (thePrefs.m_bExtControls) Sbuffer.Format( _T("%s (%s)"), CastItoXBytes(client->GetSessionUp(), false, false), CastItoXBytes(client->GetQueueSessionPayloadUp(), false, false)); else Sbuffer = CastItoXBytes(client->GetSessionUp(), false, false); break; case 4: if (client->HasLowID()) Sbuffer.Format(_T("%s (%s)"), CastSecondsToHM(client->GetWaitTime()/1000), GetResString(IDS_IDLOW)); else Sbuffer = CastSecondsToHM(client->GetWaitTime()/1000); break; case 5: Sbuffer = CastSecondsToHM(client->GetUpStartTimeDelay()/1000); break; case 6: Sbuffer = client->GetUploadStateDisplayString(); break; case 7: cur_rec.bottom--; cur_rec.top++; client->DrawUpStatusBar(dc, &cur_rec, false, thePrefs.UseFlatBar()); cur_rec.bottom++; cur_rec.top--; break; } if (iColumn != 7 && iColumn != 0) dc.DrawText(Sbuffer, Sbuffer.GetLength(), &cur_rec, DLC_DT_TEXT); dc->SetBkColor( crOldBackColor ); cur_rec.left += GetColumnWidth(iColumn); } } //draw rectangle around selected item(s) if (lpDrawItemStruct->itemState & ODS_SELECTED) { RECT outline_rec = lpDrawItemStruct->rcItem; outline_rec.top--; outline_rec.bottom++; dc.FrameRect(&outline_rec, &CBrush(GetBkColor())); outline_rec.top++; outline_rec.bottom--; outline_rec.left++; outline_rec.right--; if (bCtrlFocused) dc.FrameRect(&outline_rec, &CBrush(m_crFocusLine)); else dc.FrameRect(&outline_rec, &CBrush(m_crNoFocusLine)); } /* if (m_crWindowTextBk == CLR_NONE) dc.SetBkMode(iOldBkMode); dc.SelectObject(pOldFont); dc.SetTextColor(crOldTextColor);*/ }