diff options
48 files changed, 367 insertions, 429 deletions
diff --git a/plugins/Clist_blind/src/clcpaint.cpp b/plugins/Clist_blind/src/clcpaint.cpp index 5dc248081c..1026d5d94d 100644 --- a/plugins/Clist_blind/src/clcpaint.cpp +++ b/plugins/Clist_blind/src/clcpaint.cpp @@ -434,7 +434,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) rc.top = y + ((dat->rowHeight - fontHeight) >> 1);
rc.right = (clRect.right - clRect.left);
rc.bottom = rc.top;
- DrawText(hdcMem, szText, mir_tstrlen(szText), &rc, DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS | DT_SINGLELINE);
+ DrawText(hdcMem, szText, -1, &rc, DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS | DT_SINGLELINE);
}
if (selected) {
if (group->cl.items[group->scanIndex]->type != CLCIT_DIVIDER) {
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index bb64d2635b..635dd4c997 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -2572,7 +2572,7 @@ LRESULT CLUI::OnDrawItem(UINT msg, WPARAM wParam, LPARAM lParam) mir_snprintf(buf, SIZEOF(buf), "Main,ID=StatusMenu,Selected=%s,Hot=%s", (dis->itemState&ODS_SELECTED) ? "True" : "False", (dis->itemState&ODS_HOTLIGHT) ? "True" : "False");
SkinDrawGlyph(dis->hDC, &dis->rcItem, &dis->rcItem, buf);
SetTextColor(dis->hDC, (dis->itemState&ODS_SELECTED/*|dis->itemState&ODS_HOTLIGHT*/) ? dat->MenuTextHiColor : dat->MenuTextColor);
- DrawText(dis->hDC, TranslateT("Status"), mir_tstrlen(TranslateT("Status")), &rc, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
+ DrawText(dis->hDC, TranslateT("Status"), -1, &rc, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
nStatusMenuState = dis->itemState;
}
else {
diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp index 2e144d30c4..076be367c1 100644 --- a/plugins/Clist_modern/src/modern_skinengine.cpp +++ b/plugins/Clist_modern/src/modern_skinengine.cpp @@ -2798,8 +2798,10 @@ BOOL ske_DrawText(HDC hdc, LPCTSTR lpString, int nCount, RECT *lpRect, UINT form DWORD form = 0, color = 0; RECT r = *lpRect; OffsetRect(&r, 1, 1); - if (format & DT_RTLREADING) SetTextAlign(hdc, TA_RTLREADING); - if (format & DT_CALCRECT) return DrawText(hdc, lpString, nCount, lpRect, format); + if (format & DT_RTLREADING) + SetTextAlign(hdc, TA_RTLREADING); + if (format & DT_CALCRECT) + return DrawText(hdc, lpString, nCount, lpRect, format); if (format & DT_FORCENATIVERENDER || g_CluiData.fDisableSkinEngine) return DrawText(hdc, lpString, nCount, lpRect, format&~DT_FORCENATIVERENDER); diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp index 304629c432..866827d377 100644 --- a/plugins/Clist_nicer/src/clcpaint.cpp +++ b/plugins/Clist_nicer/src/clcpaint.cpp @@ -230,8 +230,7 @@ void PaintNotifyArea(HDC hDC, RECT *rc) }
else {
HICON hIcon = reinterpret_cast<HICON>(LoadImage(g_hInst, MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, 16, 16, 0));
- TCHAR *ptszNoEvents = TranslateT("No events...");
- DrawText(hDC, ptszNoEvents, mir_tstrlen(ptszNoEvents), rc, DT_VCENTER | DT_SINGLELINE);
+ DrawText(hDC, TranslateT("No events..."), -1, rc, DT_VCENTER | DT_SINGLELINE);
DrawIconEx(hDC, 4, (rc->bottom + rc->top - 16) / 2, hIcon, 16, 16, 0, 0, DI_NORMAL | DI_COMPAT);
DestroyIcon(hIcon);
}
diff --git a/plugins/FavContacts/src/menu.cpp b/plugins/FavContacts/src/menu.cpp index 1400a0f09f..b23259b3e4 100644 --- a/plugins/FavContacts/src/menu.cpp +++ b/plugins/FavContacts/src/menu.cpp @@ -158,7 +158,7 @@ static BOOL sttDrawItem_Group(LPDRAWITEMSTRUCT lpdis, Options *options = NULL) TCHAR *name = sttGetGroupName(-INT_PTR(lpdis->itemData));
if (!options->bSysColors)
SelectObject(lpdis->hDC, g_Options.hfntName);
- DrawText(lpdis->hDC, name, mir_tstrlen(name), &lpdis->rcItem, DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_CENTER);
+ DrawText(lpdis->hDC, name, -1, &lpdis->rcItem, DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_CENTER);
SelectObject(lpdis->hDC, hfntSave);
@@ -306,7 +306,7 @@ static BOOL sttDrawItem_Contact(LPDRAWITEMSTRUCT lpdis, Options *options = NULL) if (!options->bSysColors)
SelectObject(hdcTemp, g_Options.hfntName);
SetTextColor(hdcTemp, clLine1);
- DrawText(hdcTemp, name, mir_tstrlen(name), &lpdis->rcItem, DT_NOPREFIX | DT_SINGLELINE | DT_TOP | DT_LEFT);
+ DrawText(hdcTemp, name, -1, &lpdis->rcItem, DT_NOPREFIX | DT_SINGLELINE | DT_TOP | DT_LEFT);
SIZE sz;
GetTextExtentPoint32(hdcTemp, name, mir_tstrlen(name), &sz);
@@ -324,7 +324,7 @@ static BOOL sttDrawItem_Contact(LPDRAWITEMSTRUCT lpdis, Options *options = NULL) if (!options->bSysColors) SelectObject(hdcTemp, g_Options.hfntSecond);
SetTextColor(hdcTemp, clLine2);
- DrawText(hdcTemp, title, mir_tstrlen(title), &lpdis->rcItem, DT_NOPREFIX | DT_SINGLELINE | DT_TOP | DT_LEFT);
+ DrawText(hdcTemp, title, -1, &lpdis->rcItem, DT_NOPREFIX | DT_SINGLELINE | DT_TOP | DT_LEFT);
if (bFree) mir_free(title);
}
diff --git a/plugins/FloatingContacts/src/bitmap_funcs.cpp b/plugins/FloatingContacts/src/bitmap_funcs.cpp index c585be916f..41b1b695cb 100644 --- a/plugins/FloatingContacts/src/bitmap_funcs.cpp +++ b/plugins/FloatingContacts/src/bitmap_funcs.cpp @@ -819,7 +819,7 @@ void MyBitmap::DrawText(TCHAR *str, int x, int y, int blur, int strength) SetTextColor(tmp.getDC(), RGB(255,255,255));
SetBkColor(tmp.getDC(), RGB(0,0,0));
ExtTextOutA(tmp.getDC(), 0, 0, ETO_OPAQUE, &rc, "", 0, NULL);
- ::DrawText(tmp.getDC(), str, mir_tstrlen(str), &rc, DT_CENTER|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER);
+ ::DrawText(tmp.getDC(), str, -1, &rc, DT_CENTER|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER);
SelectObject(tmp.getDC(), hfnTmp);
GdiFlush();
diff --git a/plugins/HistoryStats/src/bandctrlimpl.cpp b/plugins/HistoryStats/src/bandctrlimpl.cpp index feeabb2eb1..dee262eeff 100644 --- a/plugins/HistoryStats/src/bandctrlimpl.cpp +++ b/plugins/HistoryStats/src/bandctrlimpl.cpp @@ -370,16 +370,9 @@ void BandCtrlImpl::drawButton(HDC hDC, int nItem, int textHeight, bool bBandEnab if (!item.text.empty()) {
RECT rText = rItem;
-
rText.top += (rItem.bottom - rItem.top + m_IconSize.cy - textHeight) / 2;
rItem.bottom -= textHeight;
-
- DrawText(
- hDC,
- item.text.c_str(),
- item.text.length(),
- &rText,
- DT_TOP | DT_CENTER | DT_END_ELLIPSIS | DT_WORD_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE);
+ DrawText(hDC, item.text.c_str(), -1, &rText, DT_TOP | DT_CENTER | DT_END_ELLIPSIS | DT_WORD_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE);
}
if (item.nIcon != -1) {
diff --git a/plugins/MirandaG15/src/CContactList.cpp b/plugins/MirandaG15/src/CContactList.cpp index cf16976481..69e6165d38 100644 --- a/plugins/MirandaG15/src/CContactList.cpp +++ b/plugins/MirandaG15/src/CContactList.cpp @@ -401,29 +401,24 @@ void CContactList::DeleteGroup(CContactListGroup *pGroup) //************************************************************************
void CContactList::DrawEntry(CLCDGfx *pGfx,CContactListEntry *pEntry,bool bSelected)
{
- if(pEntry == NULL) {
+ if(pEntry == NULL)
return;
- }
int iOffset = 0;
tstring strText = _T("");
- if(pEntry->iMessages > 0)
- {
+ if(pEntry->iMessages > 0) {
strText = _T("[");
strText += pEntry->strMessages;
strText += _T("]");
}
strText += pEntry->strName;
- if(CConfig::GetBoolSetting(CLIST_SHOWPROTO) && !CConfig::GetBoolSetting(CLIST_COLUMNS))
- {
+ if(CConfig::GetBoolSetting(CLIST_SHOWPROTO) && !CConfig::GetBoolSetting(CLIST_COLUMNS)) {
int w = pGfx->GetClipWidth();
pGfx->DrawText(w-w*0.3,0,w*0.3,pEntry->strProto);
pGfx->DrawText(8,0,w*0.7-8,strText);
}
- else
- pGfx->DrawText(8,0,pGfx->GetClipWidth()-8,strText);
-
+ else pGfx->DrawText(8,0,pGfx->GetClipWidth()-8,strText);
pGfx->DrawBitmap(1,ceil((pGfx->GetClipHeight()-5)/2.0f),5,5,CAppletManager::GetInstance()->GetStatusBitmap(pEntry->iStatus));
diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp index 814410f9b8..9314bb52aa 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp @@ -22,12 +22,12 @@ CLCDGfx::CLCDGfx(void)
{
m_nWidth = 0;
- m_nHeight = 0;
- m_pBitmapInfo = NULL;
- m_hDC = NULL;
- m_hBitmap = NULL;
- m_hPrevBitmap = NULL;
- m_pBitmapBits = NULL;
+ m_nHeight = 0;
+ m_pBitmapInfo = NULL;
+ m_hDC = NULL;
+ m_hBitmap = NULL;
+ m_hPrevBitmap = NULL;
+ m_pBitmapBits = NULL;
m_pLcdBitmapBits = NULL;
m_pSavedBitmapBits = NULL;
m_bInitialized = false;
@@ -43,7 +43,7 @@ CLCDGfx::CLCDGfx(void) //************************************************************************
CLCDGfx::~CLCDGfx(void)
{
- Shutdown();
+ Shutdown();
}
//************************************************************************
@@ -53,40 +53,40 @@ bool CLCDGfx::Initialize(int nWidth, int nHeight, int nBPP, PBYTE pLcdBitmapBits {
m_pLcdBitmapBits = pLcdBitmapBits;
- m_nWidth = nWidth;
- m_nHeight = nHeight;
+ m_nWidth = nWidth;
+ m_nHeight = nHeight;
m_nBPP = nBPP;
- m_hDC = CreateCompatibleDC(NULL);
- if(NULL == m_hDC)
- {
- TRACE(_T("CLCDGfx::Initialize(): failed to create compatible DC.\n"));
- Shutdown();
- return false;
- }
-
- int nBMISize = sizeof(BITMAPINFO) + 256 * sizeof(RGBQUAD);
- m_pBitmapInfo = (BITMAPINFO *) new BYTE [nBMISize];
- if(NULL == m_pBitmapInfo)
- {
- TRACE(_T("CLCDGfx::Initialize(): failed to allocate bitmap info.\n"));
- Shutdown();
- return false;
- }
-
- memset(m_pBitmapInfo, 0, nBMISize);
- m_pBitmapInfo->bmiHeader.biSize = sizeof(m_pBitmapInfo->bmiHeader);
- m_pBitmapInfo->bmiHeader.biWidth = m_nWidth;
- m_pBitmapInfo->bmiHeader.biHeight = -m_nHeight;
- m_pBitmapInfo->bmiHeader.biPlanes = 1;
- m_pBitmapInfo->bmiHeader.biBitCount = 8*m_nBPP;
- m_pBitmapInfo->bmiHeader.biCompression = BI_RGB;
- m_pBitmapInfo->bmiHeader.biSizeImage = m_pBitmapInfo->bmiHeader.biWidth * m_pBitmapInfo->bmiHeader.biHeight * m_nBPP;
- m_pBitmapInfo->bmiHeader.biXPelsPerMeter = 3200;
- m_pBitmapInfo->bmiHeader.biYPelsPerMeter = 3200;
- m_pBitmapInfo->bmiHeader.biClrUsed = 256;
- m_pBitmapInfo->bmiHeader.biClrImportant = 256;
-
+ m_hDC = CreateCompatibleDC(NULL);
+ if(NULL == m_hDC)
+ {
+ TRACE(_T("CLCDGfx::Initialize(): failed to create compatible DC.\n"));
+ Shutdown();
+ return false;
+ }
+
+ int nBMISize = sizeof(BITMAPINFO) + 256 * sizeof(RGBQUAD);
+ m_pBitmapInfo = (BITMAPINFO *) new BYTE [nBMISize];
+ if(NULL == m_pBitmapInfo)
+ {
+ TRACE(_T("CLCDGfx::Initialize(): failed to allocate bitmap info.\n"));
+ Shutdown();
+ return false;
+ }
+
+ memset(m_pBitmapInfo, 0, nBMISize);
+ m_pBitmapInfo->bmiHeader.biSize = sizeof(m_pBitmapInfo->bmiHeader);
+ m_pBitmapInfo->bmiHeader.biWidth = m_nWidth;
+ m_pBitmapInfo->bmiHeader.biHeight = -m_nHeight;
+ m_pBitmapInfo->bmiHeader.biPlanes = 1;
+ m_pBitmapInfo->bmiHeader.biBitCount = 8*m_nBPP;
+ m_pBitmapInfo->bmiHeader.biCompression = BI_RGB;
+ m_pBitmapInfo->bmiHeader.biSizeImage = m_pBitmapInfo->bmiHeader.biWidth * m_pBitmapInfo->bmiHeader.biHeight * m_nBPP;
+ m_pBitmapInfo->bmiHeader.biXPelsPerMeter = 3200;
+ m_pBitmapInfo->bmiHeader.biYPelsPerMeter = 3200;
+ m_pBitmapInfo->bmiHeader.biClrUsed = 256;
+ m_pBitmapInfo->bmiHeader.biClrImportant = 256;
+
if(m_nBPP == 1) {
for(int nColor = 0; nColor < 256; ++nColor)
{
@@ -97,17 +97,17 @@ bool CLCDGfx::Initialize(int nWidth, int nHeight, int nBPP, PBYTE pLcdBitmapBits }
}
- m_hBitmap = CreateDIBSection(m_hDC, m_pBitmapInfo, DIB_RGB_COLORS, (PVOID *) &m_pBitmapBits, NULL, 0);
- if(NULL == m_hBitmap)
- {
- TRACE(_T("CLCDGfx::Initialize(): failed to create bitmap.\n"));
- Shutdown();
- return false;
- }
-
- m_bInitialized = true;
-
- return true;
+ m_hBitmap = CreateDIBSection(m_hDC, m_pBitmapInfo, DIB_RGB_COLORS, (PVOID *) &m_pBitmapBits, NULL, 0);
+ if(NULL == m_hBitmap)
+ {
+ TRACE(_T("CLCDGfx::Initialize(): failed to create bitmap.\n"));
+ Shutdown();
+ return false;
+ }
+
+ m_bInitialized = true;
+
+ return true;
}
//************************************************************************
@@ -125,31 +125,31 @@ bool CLCDGfx::Shutdown(void) {
EndTransition();
- if(NULL != m_hBitmap)
- {
- DeleteObject(m_hBitmap);
- m_hBitmap = NULL;
- m_pBitmapBits = NULL;
- }
-
- ASSERT(NULL == m_hPrevBitmap);
- m_hPrevBitmap = NULL;
-
- if(NULL != m_pBitmapInfo)
- {
- delete [] m_pBitmapInfo;
- m_pBitmapInfo = NULL;
- }
-
- if(NULL != m_hDC)
- {
- DeleteDC(m_hDC);
- m_hDC = NULL;
- }
-
- m_nWidth = 0;
- m_nHeight = 0;
-
+ if(NULL != m_hBitmap)
+ {
+ DeleteObject(m_hBitmap);
+ m_hBitmap = NULL;
+ m_pBitmapBits = NULL;
+ }
+
+ ASSERT(NULL == m_hPrevBitmap);
+ m_hPrevBitmap = NULL;
+
+ if(NULL != m_pBitmapInfo)
+ {
+ delete [] m_pBitmapInfo;
+ m_pBitmapInfo = NULL;
+ }
+
+ if(NULL != m_hDC)
+ {
+ DeleteDC(m_hDC);
+ m_hDC = NULL;
+ }
+
+ m_nWidth = 0;
+ m_nHeight = 0;
+
m_bInitialized = false;
return true;
@@ -160,7 +160,7 @@ bool CLCDGfx::Shutdown(void) void CLCDGfx::SetClipRegion(int iX,int iY,int iWidth,int iHeight)
{
ASSERT(NULL != m_hPrevBitmap);
-
+
m_rClipRegion.left = iX;
m_rClipRegion.right = iX+iWidth;
m_rClipRegion.top = iY;
@@ -184,16 +184,16 @@ RECT CLCDGfx::GetClipRegion() //************************************************************************
void CLCDGfx::BeginDraw(void)
{
- ASSERT(NULL != m_hBitmap);
+ ASSERT(NULL != m_hBitmap);
if(m_hPrevBitmap != NULL)
Sleep(1);
- ASSERT(NULL == m_hPrevBitmap);
- if(NULL == m_hPrevBitmap)
- {
- m_hPrevBitmap = (HBITMAP) SelectObject(m_hDC, m_hBitmap);
- SetTextColor(m_hDC, RGB(255, 255, 255));
- SetBkColor(m_hDC, RGB(0, 0, 0));
- }
+ ASSERT(NULL == m_hPrevBitmap);
+ if(NULL == m_hPrevBitmap)
+ {
+ m_hPrevBitmap = (HBITMAP) SelectObject(m_hDC, m_hBitmap);
+ SetTextColor(m_hDC, RGB(255, 255, 255));
+ SetBkColor(m_hDC, RGB(0, 0, 0));
+ }
}
//************************************************************************
@@ -201,10 +201,10 @@ void CLCDGfx::BeginDraw(void) //************************************************************************
void CLCDGfx::ClearScreen(void)
{
- // this means, we're inside BeginDraw()/EndDraw()
- ASSERT(NULL != m_hPrevBitmap);
- RECT rc = { 0, 0, m_nWidth, m_nHeight };
- FillRect(m_hDC, &rc, (HBRUSH) GetStockObject(BLACK_BRUSH));
+ // this means, we're inside BeginDraw()/EndDraw()
+ ASSERT(NULL != m_hPrevBitmap);
+ RECT rc = { 0, 0, m_nWidth, m_nHeight };
+ FillRect(m_hDC, &rc, (HBRUSH) GetStockObject(BLACK_BRUSH));
}
//************************************************************************
@@ -218,9 +218,9 @@ COLORREF CLCDGfx::GetPixel(int nX, int nY) { // CLCDGfx::SetPixel
//************************************************************************
void CLCDGfx::SetPixel(int nX, int nY, COLORREF color) {
- // this means, we're inside BeginDraw()/EndDraw()
- ASSERT(NULL != m_hPrevBitmap);
- ::SetPixel(m_hDC, nX, nY, color);
+ // this means, we're inside BeginDraw()/EndDraw()
+ ASSERT(NULL != m_hPrevBitmap);
+ ::SetPixel(m_hDC, nX, nY, color);
}
void CLCDGfx::SetPixel(int nX, int nY, BYTE r, BYTE g, BYTE b)
@@ -231,7 +231,7 @@ void CLCDGfx::SetPixel(int nX, int nY, BYTE r, BYTE g, BYTE b) } else {
ref = RGB(r,g,b);
}
- SetPixel(nX,nY,ref);
+ SetPixel(nX,nY,ref);
}
@@ -240,13 +240,13 @@ void CLCDGfx::SetPixel(int nX, int nY, BYTE r, BYTE g, BYTE b) //************************************************************************
void CLCDGfx::DrawLine(int nX1, int nY1, int nX2, int nY2)
{
- // this means, we're inside BeginDraw()/EndDraw()
- ASSERT(NULL != m_hPrevBitmap);
+ // this means, we're inside BeginDraw()/EndDraw()
+ ASSERT(NULL != m_hPrevBitmap);
- HPEN hPrevPen = (HPEN) SelectObject(m_hDC, GetStockObject(WHITE_PEN));
- ::MoveToEx(m_hDC, nX1, nY1, NULL);
- ::LineTo(m_hDC, nX2, nY2);
- SelectObject(m_hDC, hPrevPen);
+ HPEN hPrevPen = (HPEN) SelectObject(m_hDC, GetStockObject(WHITE_PEN));
+ ::MoveToEx(m_hDC, nX1, nY1, NULL);
+ ::LineTo(m_hDC, nX2, nY2);
+ SelectObject(m_hDC, hPrevPen);
}
@@ -257,13 +257,13 @@ void CLCDGfx::DrawLine(int nX1, int nY1, int nX2, int nY2) //************************************************************************
void CLCDGfx::DrawFilledRect(int nX, int nY, int nWidth, int nHeight)
{
- // this means, we're inside BeginDraw()/EndDraw()
- ASSERT(NULL != m_hPrevBitmap);
+ // this means, we're inside BeginDraw()/EndDraw()
+ ASSERT(NULL != m_hPrevBitmap);
- HBRUSH hPrevBrush = (HBRUSH) SelectObject(m_hDC, GetStockObject(WHITE_BRUSH));
- RECT r = { nX, nY, nX + nWidth, nY + nHeight };
- ::FillRect(m_hDC, &r, hPrevBrush);
- SelectObject(m_hDC, hPrevBrush);
+ HBRUSH hPrevBrush = (HBRUSH) SelectObject(m_hDC, GetStockObject(WHITE_BRUSH));
+ RECT r = { nX, nY, nX + nWidth, nY + nHeight };
+ ::FillRect(m_hDC, &r, hPrevBrush);
+ SelectObject(m_hDC, hPrevBrush);
}
//************************************************************************
@@ -272,10 +272,10 @@ void CLCDGfx::DrawFilledRect(int nX, int nY, int nWidth, int nHeight) void CLCDGfx::DrawRect(int iX, int iY, int iWidth, int iHeight)
{
// this means, we're inside BeginDraw()/EndDraw()
- ASSERT(NULL != m_hPrevBitmap);
+ ASSERT(NULL != m_hPrevBitmap);
+
+ HBRUSH hPrevBrush = (HBRUSH) SelectObject(m_hDC, GetStockObject(WHITE_BRUSH));
- HBRUSH hPrevBrush = (HBRUSH) SelectObject(m_hDC, GetStockObject(WHITE_BRUSH));
-
// top line
DrawLine(iX+1,iY,iX+iWidth-1,iY);
// bottom line
@@ -285,7 +285,7 @@ void CLCDGfx::DrawRect(int iX, int iY, int iWidth, int iHeight) // right line
DrawLine(iX+iWidth-1,iY,iX+iWidth-1,iY+iHeight);
- SelectObject(m_hDC, hPrevBrush);
+ SelectObject(m_hDC, hPrevBrush);
}
//************************************************************************
@@ -293,20 +293,20 @@ void CLCDGfx::DrawRect(int iX, int iY, int iWidth, int iHeight) //************************************************************************
void CLCDGfx::DrawText(int nX, int nY, LPCTSTR sText)
{
- // map mode text, with transparency
- int nOldMapMode = SetMapMode(m_hDC, MM_TEXT);
- int nOldBkMode = SetBkMode(m_hDC, TRANSPARENT);
-
+ // map mode text, with transparency
+ int nOldMapMode = SetMapMode(m_hDC, MM_TEXT);
+ int nOldBkMode = SetBkMode(m_hDC, TRANSPARENT);
+
DRAWTEXTPARAMS dtp;
memset(&dtp, 0, sizeof(DRAWTEXTPARAMS));
- dtp.cbSize = sizeof(DRAWTEXTPARAMS);
+ dtp.cbSize = sizeof(DRAWTEXTPARAMS);
RECT rBounds = {nX,nY,GetClipWidth(),GetClipHeight()};
DrawTextEx(m_hDC,(LPTSTR)sText,mir_tstrlen(sText),&rBounds,(DT_LEFT | DT_NOPREFIX),&dtp);
- // restores
- SetMapMode(m_hDC, nOldMapMode);
- SetBkMode(m_hDC, nOldBkMode);
+ // restores
+ SetMapMode(m_hDC, nOldMapMode);
+ SetBkMode(m_hDC, nOldBkMode);
}
//************************************************************************
@@ -319,23 +319,20 @@ void CLCDGfx::DrawText(int nX,int nY,int nWidth,tstring strText) SIZE sizeCutOff = {0, 0};
GetTextExtentPoint(GetHDC(),_T("..."),3,&sizeCutOff);
-
+
int *piWidths = new int[strText.length()];
int iMaxChars = 0;
GetTextExtentExPoint(GetHDC(),strText.c_str(),strText.length(),nWidth,&iMaxChars,piWidths,&sizeLine);
-
- if(iMaxChars < strText.length())
- {
+
+ if(iMaxChars < strText.length()) {
for(iMaxChars--;iMaxChars>0;iMaxChars--)
- {
if(piWidths[iMaxChars] + sizeCutOff.cx <= nWidth)
break;
- }
+
DrawText(nX,nY,(strText.substr(0,iMaxChars) + _T("...")).c_str());
}
- else
- DrawText(nX,nY,strText.c_str());
+ else DrawText(nX,nY,strText.c_str());
free(piWidths);
}
@@ -345,13 +342,13 @@ void CLCDGfx::DrawText(int nX,int nY,int nWidth,tstring strText) void CLCDGfx::DrawBitmap(int nX, int nY,int nWidth, int nHeight, HBITMAP hBitmap)
{
HDC hCompatibleDC = CreateCompatibleDC(GetHDC());
- HBITMAP hOldBitmap = (HBITMAP)SelectObject(hCompatibleDC, hBitmap);
-
- BitBlt(GetHDC(), nX, nY, nWidth, nHeight, hCompatibleDC, 0, 0, SRCCOPY);
-
- // restores
- SelectObject(hCompatibleDC, hOldBitmap);
- DeleteDC(hCompatibleDC);
+ HBITMAP hOldBitmap = (HBITMAP)SelectObject(hCompatibleDC, hBitmap);
+
+ BitBlt(GetHDC(), nX, nY, nWidth, nHeight, hCompatibleDC, 0, 0, SRCCOPY);
+
+ // restores
+ SelectObject(hCompatibleDC, hOldBitmap);
+ DeleteDC(hCompatibleDC);
}
//************************************************************************
@@ -359,15 +356,15 @@ void CLCDGfx::DrawBitmap(int nX, int nY,int nWidth, int nHeight, HBITMAP hBitmap //************************************************************************
void CLCDGfx::EndDraw(void)
{
- ASSERT(NULL != m_hPrevBitmap);
- if(NULL != m_hPrevBitmap)
- {
- GdiFlush();
- m_hPrevBitmap = (HBITMAP) SelectObject(m_hDC, m_hPrevBitmap);
+ ASSERT(NULL != m_hPrevBitmap);
+ if(NULL != m_hPrevBitmap)
+ {
+ GdiFlush();
+ m_hPrevBitmap = (HBITMAP) SelectObject(m_hDC, m_hPrevBitmap);
ASSERT(m_hPrevBitmap == m_hBitmap);
- m_hPrevBitmap = NULL;
- }
-
+ m_hPrevBitmap = NULL;
+ }
+
if(m_nBPP != 1 || !m_bTransition)
memcpy(m_pLcdBitmapBits, m_pBitmapBits, m_nWidth * m_nHeight * m_nBPP);
else
@@ -380,56 +377,56 @@ void CLCDGfx::EndDraw(void) PBYTE pScreen2 = m_pBitmapBits;
DWORD dwTimeElapsed = GetTickCount() - m_dwTransitionStart;
-
- /* if(m_eTransition == TRANSITION_BT || m_eTransition == TRANSITION_TB)
+
+ /* if(m_eTransition == TRANSITION_BT || m_eTransition == TRANSITION_TB)
{
- int iCols = ((float)dwTimeElapsed/(float)TRANSITION_DURATION)*m_nHeight;
-
- if(m_eTransition == TRANSITION_TB)
- {
- iCols = m_nHeight - iCols;
+ int iCols = ((float)dwTimeElapsed/(float)TRANSITION_DURATION)*m_nHeight;
- pScreen1 = m_pBitmapBits;
- pScreen2 = m_pSavedBitmapBits;
- }
+ if(m_eTransition == TRANSITION_TB)
+ {
+ iCols = m_nHeight - iCols;
- if(iCols > m_nHeight)
- iCols = m_nHeight;
- if(iCols < 0)
- iCols = 0;
+ pScreen1 = m_pBitmapBits;
+ pScreen2 = m_pSavedBitmapBits;
+ }
+
+ if(iCols > m_nHeight)
+ iCols = m_nHeight;
+ if(iCols < 0)
+ iCols = 0;
- memcpy(m_pLcdBitmapBits,pScreen1+(iCols*m_nWidth),((m_nHeight-iCols)*m_nWidth));
- memcpy(m_pLcdBitmapBits+((m_nHeight-iCols)*m_nWidth),pScreen2,iCols *m_nWidth);
+ memcpy(m_pLcdBitmapBits,pScreen1+(iCols*m_nWidth),((m_nHeight-iCols)*m_nWidth));
+ memcpy(m_pLcdBitmapBits+((m_nHeight-iCols)*m_nWidth),pScreen2,iCols *m_nWidth);
}
else if(m_eTransition == TRANSITION_LR || m_eTransition == TRANSITION_RL)
{
- int iCols = ((float)dwTimeElapsed/(float)TRANSITION_DURATION)*m_nWidth;
+ int iCols = ((float)dwTimeElapsed/(float)TRANSITION_DURATION)*m_nWidth;
- if(m_eTransition == TRANSITION_LR)
- {
- iCols = m_nWidth - iCols;
+ if(m_eTransition == TRANSITION_LR)
+ {
+ iCols = m_nWidth - iCols;
- pScreen1 = m_pBitmapBits;
- pScreen2 = m_pSavedBitmapBits;
- }
+ pScreen1 = m_pBitmapBits;
+ pScreen2 = m_pSavedBitmapBits;
+ }
- if(iCols > m_nWidth)
- iCols = m_nWidth;
- if(iCols < 0)
- iCols = 0;
+ if(iCols > m_nWidth)
+ iCols = m_nWidth;
+ if(iCols < 0)
+ iCols = 0;
- for(int i=0;i<m_nHeight;i++)
- {
- memcpy(m_pLcdBitmapBits+(i*m_nWidth),pScreen1+(i*m_nWidth)+iCols,m_nWidth-iCols);
- memcpy(m_pLcdBitmapBits+(i*m_nWidth)+(m_nWidth-iCols),pScreen2+(i*m_nWidth),iCols);
- }
+ for(int i=0;i<m_nHeight;i++)
+ {
+ memcpy(m_pLcdBitmapBits+(i*m_nWidth),pScreen1+(i*m_nWidth)+iCols,m_nWidth-iCols);
+ memcpy(m_pLcdBitmapBits+(i*m_nWidth)+(m_nWidth-iCols),pScreen2+(i*m_nWidth),iCols);
+ }
}
else*/ if(m_eTransition == TRANSITION_HLINES)
{
int iCols = ((float)dwTimeElapsed/(float)TRANSITION_DURATION)*m_nHeight;
if(iCols%2 == 1)
iCols--;
-
+
if(iCols > m_nHeight)
iCols = m_nHeight;
if(iCols < 2)
@@ -444,7 +441,7 @@ void CLCDGfx::EndDraw(void) int iCols = ((float)dwTimeElapsed/(float)TRANSITION_DURATION)*m_nWidth;
if(iCols%2 == 1)
iCols--;
-
+
if(iCols > m_nWidth)
iCols = m_nWidth;
if(iCols < 2)
@@ -462,16 +459,16 @@ void CLCDGfx::EndDraw(void) int iCols = ((float)dwTimeElapsed/(float)TRANSITION_DURATION)*m_nHeight;
if(iCols%2 == 1)
iCols--;
-
+
if(iCols > m_nHeight)
iCols = m_nHeight;
if(iCols < 2)
iCols = 2;
-
+
int iCols2 = ((float)dwTimeElapsed/(float)TRANSITION_DURATION)*m_nWidth;
if(iCols2%2 == 1)
iCols2--;
-
+
if(iCols2 > m_nWidth)
iCols2 = m_nWidth;
if(iCols2 < 2)
@@ -502,7 +499,7 @@ void CLCDGfx::EndDraw(void) pPixel = *iter;
if(pPixel->Position.x != pPixel->Destination.x ||pPixel->Position.y != pPixel->Destination.y) {
iMoved++;
-
+
dPixelPercent = dPercent * pPixel->dSpeed;
if(dPixelPercent > 1.0f)
dPixelPercent = 1.0f;
@@ -511,17 +508,17 @@ void CLCDGfx::EndDraw(void) pPixel->Position.x = pPixel->Start.x + dPixelPercent*(pPixel->Destination.x-pPixel->Start.x);
else if(pPixel->Start.x > pPixel->Destination.x)
pPixel->Position.x = pPixel->Start.x - dPixelPercent*(pPixel->Start.x-pPixel->Destination.x);
-
+
if(pPixel->Start.y < pPixel->Destination.y)
pPixel->Position.y = pPixel->Start.y + dPixelPercent*(pPixel->Destination.y-pPixel->Start.y);
else if(pPixel->Start.y > pPixel->Destination.y)
pPixel->Position.y = pPixel->Start.y - dPixelPercent*(pPixel->Start.y-pPixel->Destination.y);
}
- iIndex = pPixel->Position.y*m_nWidth + pPixel->Position.x;
- if(iIndex >= 0 && iIndex < m_nHeight * m_nWidth)
- m_pLcdBitmapBits[iIndex] = pPixel->cValue;
-
+ iIndex = pPixel->Position.y*m_nWidth + pPixel->Position.x;
+ if(iIndex >= 0 && iIndex < m_nHeight * m_nWidth)
+ m_pLcdBitmapBits[iIndex] = pPixel->cValue;
+
iter++;
}
@@ -549,8 +546,8 @@ void CLCDGfx::EndDraw(void) //************************************************************************
HDC CLCDGfx::GetHDC(void)
{
- ASSERT(NULL != m_hDC);
- return m_hDC;
+ ASSERT(NULL != m_hDC);
+ return m_hDC;
}
//************************************************************************
@@ -558,8 +555,8 @@ HDC CLCDGfx::GetHDC(void) //************************************************************************
BITMAPINFO *CLCDGfx::GetBitmapInfo(void)
{
- ASSERT(NULL != m_pBitmapInfo);
- return m_pBitmapInfo;
+ ASSERT(NULL != m_pBitmapInfo);
+ return m_pBitmapInfo;
}
//************************************************************************
@@ -568,8 +565,8 @@ BITMAPINFO *CLCDGfx::GetBitmapInfo(void) HBITMAP CLCDGfx::GetHBITMAP(void)
{
- ASSERT(NULL != m_hBitmap);
- return m_hBitmap;
+ ASSERT(NULL != m_hBitmap);
+ return m_hBitmap;
}
int CLCDGfx::findNearestMatch(PBYTE targetArray,int iSourceIndex) {
@@ -591,17 +588,17 @@ int CLCDGfx::findNearestMatch(PBYTE targetArray,int iSourceIndex) { if(targetArray[iIndex] != 0)
return iIndex;
}
- for(iX = startX-iPass;iX<=startX+iPass;iX+=iPass*2)
- for(iY=startY-iPass;iY<startY+iPass;iY++)
- {
- // skip illegal coordinates
- if(iY < 0 || iY >= m_nHeight || iX <0 || iX >= m_nWidth)
- continue;
+ for(iX = startX-iPass;iX<=startX+iPass;iX+=iPass*2)
+ for(iY=startY-iPass;iY<startY+iPass;iY++)
+ {
+ // skip illegal coordinates
+ if(iY < 0 || iY >= m_nHeight || iX <0 || iX >= m_nWidth)
+ continue;
- iIndex = iY*m_nWidth + iX;
- if(targetArray[iIndex] != 0)
- return iIndex;
- }
+ iIndex = iY*m_nWidth + iX;
+ if(targetArray[iIndex] != 0)
+ return iIndex;
+ }
}
return -1;
}
@@ -618,13 +615,13 @@ void CLCDGfx::Cache() {
SLCDPixel *pPixel = NULL;
SLCDPixel *pSource = NULL;
-
+
int iIndex = 0;
bool bBreak = false;
bool bSearch = true;
-
+
int iTransitionPixels = 0;
-
+
POINT pt;
for(int j=0;j<2;j++)
{
@@ -659,7 +656,7 @@ void CLCDGfx::Cache() bBreak = true;
}
}
-
+
if(j==0 || bBreak)
{
pPixel->Destination.y = iIndex/m_nWidth;
@@ -684,7 +681,7 @@ void CLCDGfx::Cache() }
bSearch = false;
}
-
+
if(j == 0)
m_LStaticPixels.push_back(pPixel);
else {
@@ -705,7 +702,7 @@ void CLCDGfx::Cache() pPixel = new SLCDPixel();
pPixel->dSpeed = GetRandomDouble()*0.5 + 1;
pPixel->cValue = m_pBitmapBits[iIndex];
-
+
if(!bRandom)
{
pSource = m_LMovingPixels[GetRandomInt(0,m_LMovingPixels.size()-1)];
@@ -725,7 +722,7 @@ void CLCDGfx::Cache() }
}
-
+
m_dwTransitionStart = GetTickCount();
TRACE(_T("Textmorphing: time consumed: %0.2f\n"),(double)(m_dwTransitionStart-dwStart)/(double)1000);
@@ -752,7 +749,7 @@ void CLCDGfx::StartTransition(ETransitionType eType,LPRECT rect) m_eTransition = static_cast<ETransitionType>(GetRandomInt(0,2));
else
m_eTransition = eType;
-
+
if(m_bTransition) {
EndTransition();
memcpy(m_pBitmapBits,m_pLcdBitmapBits,sizeof(BYTE)*m_nWidth*m_nHeight*m_nBPP);
@@ -760,7 +757,7 @@ void CLCDGfx::StartTransition(ETransitionType eType,LPRECT rect) if(m_pSavedBitmapBits == NULL)
m_pSavedBitmapBits = (BYTE*)malloc(sizeof(BYTE)*m_nWidth*m_nHeight*m_nBPP);
-
+
memcpy(m_pSavedBitmapBits, m_pBitmapBits,sizeof(BYTE)* m_nWidth * m_nHeight * m_nBPP);
m_dwTransitionStart = 0;
diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDGfx.h b/plugins/MirandaG15/src/LCDFramework/CLCDGfx.h index bdca950718..9ac2288262 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDGfx.h +++ b/plugins/MirandaG15/src/LCDFramework/CLCDGfx.h @@ -15,26 +15,25 @@ struct SLCDPixel class CLCDGfx
{
public:
- CLCDGfx(void);
- virtual ~CLCDGfx(void);
+ CLCDGfx(void);
+ virtual ~CLCDGfx(void);
- bool Initialize(int nWidth, int nHeight, int nBPP, PBYTE pBitmapBits);
+ bool Initialize(int nWidth, int nHeight, int nBPP, PBYTE pBitmapBits);
bool IsInitialized();
- bool Shutdown(void);
+ bool Shutdown(void);
- void BeginDraw(void);
- void ClearScreen(void);
+ void BeginDraw(void);
+ void ClearScreen(void);
COLORREF GetPixel(int nX, int nY);
void SetPixel(int nX, int nY, COLORREF color);
void SetPixel(int nX, int nY, BYTE r, BYTE g, BYTE b);
- void DrawLine(int nX1, int nY1, int nX2, int nY2);
- void DrawFilledRect(int nX, int nY, int nWidth, int nHeight);
+ void DrawLine(int nX1, int nY1, int nX2, int nY2);
+ void DrawFilledRect(int nX, int nY, int nWidth, int nHeight);
void DrawRect(int iX, int iY, int iWidth, int iHeight);
void DrawText(int nX, int nY, LPCTSTR sText);
void DrawText(int nX,int nY,int iWidth,tstring strText);
void DrawBitmap(int nX,int nY,int nWidth, int nHeight,HBITMAP hBitmap);
- void EndDraw(void);
-
+ void EndDraw(void);
void SetClipRegion(int iX,int iY,int iWidth,int iHeight);
RECT GetClipRegion();
@@ -42,12 +41,12 @@ public: inline int GetClipWidth() { return m_rClipRegion.right-m_rClipRegion.left; };
inline int GetClipHeight() { return m_rClipRegion.bottom-m_rClipRegion.top; };
- HDC GetHDC(void);
+ HDC GetHDC(void);
BITMAPINFO *GetBitmapInfo(void);
- HBITMAP GetHBITMAP(void);
-
+ HBITMAP GetHBITMAP(void);
+
void StartTransition(ETransitionType eType = TRANSITION_RANDOM,LPRECT rect = NULL);
-
+
protected:
void Cache();
int findNearestMatch(PBYTE targetArray,int iSourceIndex);
@@ -57,20 +56,20 @@ protected: RECT m_rClipRegion;
RECT m_rTransitionRegion;
- int m_nWidth;
- int m_nHeight;
+ int m_nWidth;
+ int m_nHeight;
int m_nBPP;
- BITMAPINFO *m_pBitmapInfo;
- HDC m_hDC;
- HBITMAP m_hBitmap;
- HBITMAP m_hPrevBitmap;
- PBYTE m_pBitmapBits,m_pLcdBitmapBits,m_pSavedBitmapBits;
+ BITMAPINFO *m_pBitmapInfo;
+ HDC m_hDC;
+ HBITMAP m_hBitmap;
+ HBITMAP m_hPrevBitmap;
+ PBYTE m_pBitmapBits,m_pLcdBitmapBits,m_pSavedBitmapBits;
bool m_bInitialized;
DWORD m_dwTransitionStart;
bool m_bTransition;
-
+
ETransitionType m_eTransition;
vector<SLCDPixel*> m_LMovingPixels;
vector<SLCDPixel*> m_LStaticPixels;
diff --git a/plugins/MyDetails/src/frame.cpp b/plugins/MyDetails/src/frame.cpp index d9dd63ddf0..0ebffc15bf 100644 --- a/plugins/MyDetails/src/frame.cpp +++ b/plugins/MyDetails/src/frame.cpp @@ -501,7 +501,7 @@ RECT GetRect(HDC hdc, RECT rc, const TCHAR *text, const TCHAR *def_text, Protoco if (smileys)
DRAW_TEXT(hdc, tmp2, (int)_tcslen(tmp2), &r_tmp, uFormat | DT_CALCRECT, proto->name);
else
- DrawText(hdc, tmp2, (int)_tcslen(tmp2), &r_tmp, uFormat | DT_CALCRECT);
+ DrawText(hdc, tmp2, -1, &r_tmp, uFormat | DT_CALCRECT);
free(tmp2);
@@ -807,7 +807,7 @@ void CalcRectangles(HWND hwnd) // Text size
RECT r_tmp = r;
- DrawText(hdc, proto->status_name, (int)_tcslen(proto->status_name), &r_tmp, DT_CALCRECT | (uFormat & ~DT_END_ELLIPSIS));
+ DrawText(hdc, proto->status_name, -1, &r_tmp, DT_CALCRECT | (uFormat & ~DT_END_ELLIPSIS));
SIZE s;
s.cy = max(r_tmp.bottom - r_tmp.top, ICON_SIZE);
@@ -901,7 +901,7 @@ void CalcRectangles(HWND hwnd) // Text size
RECT r_tmp = r;
- DrawText(hdc, proto->listening_to, (int)_tcslen(proto->listening_to), &r_tmp, DT_CALCRECT | (uFormat & ~DT_END_ELLIPSIS));
+ DrawText(hdc, proto->listening_to, -1, &r_tmp, DT_CALCRECT | (uFormat & ~DT_END_ELLIPSIS));
SIZE s;
s.cy = max(r_tmp.bottom - r_tmp.top, ICON_SIZE);
@@ -1221,7 +1221,7 @@ void Draw(HWND hwnd, HDC hdc_orig) SelectObject(hdc, hFont[FONT_PROTO]);
SetTextColor(hdc, font_colour[FONT_PROTO]);
- DrawText(hdc, proto->description, (int)_tcslen(proto->description), &rr, uFormat);
+ DrawText(hdc, proto->description, -1, &rr, uFormat);
// Clipping rgn
SelectClipRgn(hdc, NULL);
@@ -1336,7 +1336,7 @@ void Draw(HWND hwnd, HDC hdc_orig) SelectObject(hdc, hFont[FONT_LISTENING_TO]);
SetTextColor(hdc, font_colour[FONT_LISTENING_TO]);
- DrawText(hdc, proto->listening_to, (int)_tcslen(proto->listening_to), &rc, uFormat);
+ DrawText(hdc, proto->listening_to, -1, &rc, uFormat);
SelectClipRgn(hdc, NULL);
DeleteObject(rgn);
diff --git a/plugins/NotesAndReminders/src/notes.cpp b/plugins/NotesAndReminders/src/notes.cpp index e9d7fdae54..8daed58a4d 100644 --- a/plugins/NotesAndReminders/src/notes.cpp +++ b/plugins/NotesAndReminders/src/notes.cpp @@ -1059,15 +1059,13 @@ static void PaintColorPresetMenuItem(LPDRAWITEMSTRUCT lpDrawItem, struct ColorPr rect.right = lpDrawItem->rcItem.right; rect.bottom = lpDrawItem->rcItem.bottom; - if (lpDrawItem->itemState & ODS_SELECTED) - { + if (lpDrawItem->itemState & ODS_SELECTED) { SetDCBrushColor(lpDrawItem->hDC, GetSysColor(COLOR_MENUHILIGHT)); FillRect(lpDrawItem->hDC, &lpDrawItem->rcItem, (HBRUSH)GetStockObject(DC_BRUSH)); SetTextColor(lpDrawItem->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT)); } - else - { + else { SetDCBrushColor(lpDrawItem->hDC, GetSysColor(COLOR_MENU)); FillRect(lpDrawItem->hDC, &lpDrawItem->rcItem, (HBRUSH)GetStockObject(DC_BRUSH)); @@ -1075,21 +1073,19 @@ static void PaintColorPresetMenuItem(LPDRAWITEMSTRUCT lpDrawItem, struct ColorPr } SetBkMode(lpDrawItem->hDC, TRANSPARENT); - DrawText(lpDrawItem->hDC,clrPresets->szName,-1,&rect,DT_LEFT | DT_SINGLELINE | DT_END_ELLIPSIS | DT_VCENTER); - - { - int h = lpDrawItem->rcItem.bottom - lpDrawItem->rcItem.top; - rect.left = lpDrawItem->rcItem.left + 5; - rect.top = lpDrawItem->rcItem.top + ((h-14)>>1); - rect.right = rect.left + 40; - rect.bottom = rect.top + 14; - - FrameRect(lpDrawItem->hDC, &rect, (HBRUSH)GetStockObject(BLACK_BRUSH)); - rect.left++; rect.top++; - rect.right--; rect.bottom--; - SetDCBrushColor(lpDrawItem->hDC, clrPresets->color); - FillRect(lpDrawItem->hDC, &rect, (HBRUSH)GetStockObject(DC_BRUSH)); - } + DrawText(lpDrawItem->hDC, clrPresets->szName, -1, &rect, DT_LEFT | DT_SINGLELINE | DT_END_ELLIPSIS | DT_VCENTER); + + int h = lpDrawItem->rcItem.bottom - lpDrawItem->rcItem.top; + rect.left = lpDrawItem->rcItem.left + 5; + rect.top = lpDrawItem->rcItem.top + ((h-14)>>1); + rect.right = rect.left + 40; + rect.bottom = rect.top + 14; + + FrameRect(lpDrawItem->hDC, &rect, (HBRUSH)GetStockObject(BLACK_BRUSH)); + rect.left++; rect.top++; + rect.right--; rect.bottom--; + SetDCBrushColor(lpDrawItem->hDC, clrPresets->color); + FillRect(lpDrawItem->hDC, &rect, (HBRUSH)GetStockObject(DC_BRUSH)); } static BOOL GetClipboardText_Title(char *pOut, int size) @@ -1285,8 +1281,7 @@ INT_PTR CALLBACK StickyNoteWndProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM l // paint title bar contents (time stamp and buttons) - if (SN && SN->title) - { + if (SN && SN->title) { RECT R; SelectObject(hdc,hCaptionFont); R.top = 3+1; R.bottom = 3+11; R.left = 3+2; R.right = rect.right-3-1; @@ -1295,11 +1290,10 @@ INT_PTR CALLBACK StickyNoteWndProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM l SetTextColor(hdc,SN->FgColor ? (SN->FgColor&0xffffff) : CaptionFontColor); SetBkMode(hdc, TRANSPARENT); - DrawText(hdc,SN->title,-1,&R,DT_LEFT | DT_SINGLELINE | DT_END_ELLIPSIS | DT_VCENTER); + DrawText(hdc, SN->title, -1, &R, DT_LEFT | DT_SINGLELINE | DT_END_ELLIPSIS | DT_VCENTER); } - if (g_ShowNoteButtons) - { + if (g_ShowNoteButtons) { HICON hcIcon; if (SN->OnTop) hcIcon = Skin_GetIconByHandle(iconList[4].hIcolib); @@ -1318,13 +1312,12 @@ INT_PTR CALLBACK StickyNoteWndProc(HWND hdlg,UINT message,WPARAM wParam,LPARAM l } if (wParam && wParam != 1) - { SelectClipRgn(hdc, NULL); - } ReleaseDC(hdlg, hdc); - return TRUE; } + return TRUE; + case WM_NCCALCSIZE: { RECT *pRect = wParam ? &((NCCALCSIZE_PARAMS*)lParam)->rgrc[0] : (RECT*)lParam; diff --git a/plugins/Popup/src/bitmap_funcs.cpp b/plugins/Popup/src/bitmap_funcs.cpp index ae34336679..cf81ab37a0 100644 --- a/plugins/Popup/src/bitmap_funcs.cpp +++ b/plugins/Popup/src/bitmap_funcs.cpp @@ -599,7 +599,7 @@ void MyBitmap::Draw_Text(TCHAR *str, int x, int y) SIZE sz; GetTextExtentPoint32(this->getDC(), str, (int)mir_tstrlen(str), &sz);
RECT rc; SetRect(&rc, x, y, x + 10000, y + 10000);
this->saveAlpha(x, y, sz.cx, sz.cy);
- DrawText(this->getDC(), str, (int)mir_tstrlen(str), &rc, DT_LEFT | DT_TOP | DT_SINGLELINE | DT_NOPREFIX);
+ DrawText(this->getDC(), str, -1, &rc, DT_LEFT | DT_TOP | DT_SINGLELINE | DT_NOPREFIX);
this->restoreAlpha(x, y, sz.cx, sz.cy);
}
diff --git a/plugins/Popup/src/opt_skins.cpp b/plugins/Popup/src/opt_skins.cpp index 6fa00b6af1..9ec85d5921 100644 --- a/plugins/Popup/src/opt_skins.cpp +++ b/plugins/Popup/src/opt_skins.cpp @@ -559,12 +559,12 @@ static void BoxPreview_OnPaint(HWND hwnd, HDC mydc, int mode) rc.left += 30; // 10+16+4 -- icon
rc.right -= (rc.right-rc.left)/3;
rc.bottom -= (rc.bottom-rc.top)/3;
- DrawText(mydc, _T(MODULNAME_LONG), (int)mir_tstrlen(_T(MODULNAME_LONG)), &rc, DT_CENTER | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER);
+ DrawText(mydc, _T(MODULNAME_LONG), -1, &rc, DT_CENTER | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER);
GetClientRect(hwnd, &rc);
rc.left += 30; // 10+16+4 -- icon
rc.left += (rc.right-rc.left)/3;
rc.top += (rc.bottom-rc.top)/3;
- DrawText(mydc, _T(MODULNAME_LONG), (int)mir_tstrlen(_T(MODULNAME_LONG)), &rc, DT_CENTER | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER);
+ DrawText(mydc, _T(MODULNAME_LONG), -1, &rc, DT_CENTER | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER);
GetClientRect(hwnd, &rc);
FrameRect(mydc, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH));
SelectObject(mydc, hfnt);
diff --git a/plugins/QuickContacts/src/quickcontacts.cpp b/plugins/QuickContacts/src/quickcontacts.cpp index 3360e861eb..861e899084 100644 --- a/plugins/QuickContacts/src/quickcontacts.cpp +++ b/plugins/QuickContacts/src/quickcontacts.cpp @@ -1031,18 +1031,13 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA rc.bottom = rc.top + tm.tmHeight;
// Draw Protocol
- if (opts.num_protos > 1)
- {
- if (max_proto_width == 0)
- {
+ if (opts.num_protos > 1) {
+ if (max_proto_width == 0) {
// Has to be done, else the DC isnt the right one
// Dont ask me why
- for(int loop = 0; loop < contacts.getCount(); loop++)
- {
+ for (int loop = 0; loop < contacts.getCount(); loop++) {
RECT rcc = { 0, 0, 0x7FFF, 0x7FFF };
-
- DrawText(lpdis->hDC, contacts[loop]->proto, mir_tstrlen(contacts[loop]->proto),
- &rcc, DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE | DT_CALCRECT);
+ DrawText(lpdis->hDC, contacts[loop]->proto, -1, &rcc, DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE | DT_CALCRECT);
max_proto_width = max(max_proto_width, rcc.right - rcc.left);
}
@@ -1056,33 +1051,25 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA }
RECT rc_tmp = rc;
-
rc_tmp.left = rc_tmp.right - max_proto_width;
-
- DrawText(lpdis->hDC, contacts[lpdis->itemData]->proto, mir_tstrlen(contacts[lpdis->itemData]->proto),
- &rc_tmp, DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE);
-
+ DrawText(lpdis->hDC, contacts[lpdis->itemData]->proto, -1, &rc_tmp, DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE);
rc.right = rc_tmp.left - 5;
}
// Draw group
- if (opts.group_append && opts.group_column)
- {
+ if (opts.group_append && opts.group_column) {
RECT rc_tmp = rc;
- if (opts.group_column_left)
- {
+ if (opts.group_column_left) {
rc_tmp.right = rc_tmp.left + (rc.right - rc.left) / 3;
rc.left = rc_tmp.right + 5;
}
- else
- {
+ else {
rc_tmp.left = rc_tmp.right - (rc.right - rc.left) / 3;
rc.right = rc_tmp.left - 5;
}
- DrawText(lpdis->hDC, contacts[lpdis->itemData]->szgroup, mir_tstrlen(contacts[lpdis->itemData]->szgroup),
- &rc_tmp, DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE);
+ DrawText(lpdis->hDC, contacts[lpdis->itemData]->szgroup, -1, &rc_tmp, DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE);
}
// Draw text
@@ -1092,7 +1079,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA else
name = contacts[lpdis->itemData]->szname;
- DrawText(lpdis->hDC, name, mir_tstrlen(name), &rc, DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE);
+ DrawText(lpdis->hDC, name, -1, &rc, DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE);
// Restore old colors
SetTextColor(lpdis->hDC, clrfore);
diff --git a/plugins/Quotes/src/Chart.h b/plugins/Quotes/src/Chart.h index 8c40a4dfff..4e00d3cba4 100644 --- a/plugins/Quotes/src/Chart.h +++ b/plugins/Quotes/src/Chart.h @@ -91,7 +91,7 @@ public: HFONT hOldFont = static_cast<HFONT>(::SelectObject(hdc,hFont));
LPCTSTR pszText = TranslateT("There is no to show");
- int nDrawTextResult = ::DrawText(hdc,pszText,::mir_tstrlen(pszText),&rc,DT_SINGLELINE|DT_VCENTER|DT_CENTER);
+ int nDrawTextResult = ::DrawText(hdc, pszText, -1, &rc, DT_SINGLELINE | DT_VCENTER | DT_CENTER);
assert(0 != nDrawTextResult);
::SelectObject(hdc,hOldFont);
@@ -132,7 +132,7 @@ private: y_val = m_MinY + ((m_MaxY-m_MinY)/number_of_lines);
nXIndent += 2;
rc.left += nXIndent;
- for(int y = rc.bottom-step;y > rc.top;y-=step,y_val+=((m_MaxY-m_MinY)/number_of_lines))
+ for (int y = rc.bottom-step;y > rc.top;y-=step,y_val+=((m_MaxY-m_MinY)/number_of_lines))
{
tstring sY = TYConverter::ToString(y_val);
SIZE sizeText = {0,0};
@@ -140,7 +140,7 @@ private: assert(TRUE == bResult);
RECT rcText = {rc.left-nXIndent,y-(sizeText.cy/2),rc.left-1,y+(sizeText.cy/2)};
- int nDrawTextResult = ::DrawText(hdc, sY.c_str(), (int)sY.size(), &rcText, DT_SINGLELINE|DT_VCENTER|DT_RIGHT);
+ int nDrawTextResult = ::DrawText(hdc, sY.c_str(), -1, &rcText, DT_SINGLELINE|DT_VCENTER|DT_RIGHT);
assert(0 != nDrawTextResult);
bResult = ::MoveToEx(hdc,rc.left,y,NULL);
diff --git a/plugins/RemovePersonalSettings/src/rps.cpp b/plugins/RemovePersonalSettings/src/rps.cpp index c28ab865a9..c511356c36 100644 --- a/plugins/RemovePersonalSettings/src/rps.cpp +++ b/plugins/RemovePersonalSettings/src/rps.cpp @@ -537,7 +537,7 @@ BOOL GetSettingBool(const char *section, const char *key, BOOL defaultValue) BOOL GetSettings(const char *section, char *buffer, size_t bufferSize)
{
buffer[0] = '\0\0';
- return (BOOL)GetPrivateProfileSection(section, buffer, bufferSize, gIniFile) != 0;
+ return (BOOL)GetPrivateProfileSection(section, buffer, (DWORD)bufferSize, gIniFile) != 0;
}
diff --git a/plugins/SpellChecker/src/options.cpp b/plugins/SpellChecker/src/options.cpp index 38621eee1f..d1f765edff 100644 --- a/plugins/SpellChecker/src/options.cpp +++ b/plugins/SpellChecker/src/options.cpp @@ -152,7 +152,7 @@ static void DrawItem(HWND hwndDlg, LPDRAWITEMSTRUCT lpdis, Dictionary *dict) rc.right = lpdis->rcItem.right - 2;
rc.top = (lpdis->rcItem.bottom + lpdis->rcItem.top - tm.tmHeight) / 2;
rc.bottom = rc.top + tm.tmHeight;
- DrawText(lpdis->hDC, dict->full_name, mir_tstrlen(dict->full_name), &rc, DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE);
+ DrawText(lpdis->hDC, dict->full_name, -1, &rc, DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE);
// Restore old colors
SetTextColor(lpdis->hDC, clrfore);
diff --git a/plugins/SpellChecker/src/utils.cpp b/plugins/SpellChecker/src/utils.cpp index 86ea80d46e..060f05804a 100644 --- a/plugins/SpellChecker/src/utils.cpp +++ b/plugins/SpellChecker/src/utils.cpp @@ -1513,12 +1513,12 @@ LRESULT CALLBACK MenuWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) // Draw text
RECT rc_text = { 0, 0, 0xFFFF, 0xFFFF };
- DrawText(lpdis->hDC, dict->full_name, mir_tstrlen(dict->full_name), &rc_text, DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE | DT_LEFT | DT_TOP | DT_CALCRECT);
+ DrawText(lpdis->hDC, dict->full_name, -1, &rc_text, DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE | DT_LEFT | DT_TOP | DT_CALCRECT);
rc.right = lpdis->rcItem.right - 2;
rc.top = (lpdis->rcItem.bottom + lpdis->rcItem.top - (rc_text.bottom - rc_text.top)) / 2;
rc.bottom = rc.top + rc_text.bottom - rc_text.top;
- DrawText(lpdis->hDC, dict->full_name, mir_tstrlen(dict->full_name), &rc, DT_END_ELLIPSIS | DT_NOPREFIX | DT_LEFT | DT_TOP | DT_SINGLELINE);
+ DrawText(lpdis->hDC, dict->full_name, -1, &rc, DT_END_ELLIPSIS | DT_NOPREFIX | DT_LEFT | DT_TOP | DT_SINGLELINE);
// Restore old colors
SetTextColor(lpdis->hDC, clrfore);
@@ -1546,7 +1546,7 @@ LRESULT CALLBACK MenuWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) RECT rc = { 0, 0, 0xFFFF, 0xFFFF };
- DrawText(hdc, dict->full_name, mir_tstrlen(dict->full_name), &rc, DT_NOPREFIX | DT_SINGLELINE | DT_LEFT | DT_TOP | DT_CALCRECT);
+ DrawText(hdc, dict->full_name, -1, &rc, DT_NOPREFIX | DT_SINGLELINE | DT_LEFT | DT_TOP | DT_CALCRECT);
lpmis->itemHeight = max(ICON_SIZE, max(bmpChecked.bmHeight, rc.bottom));
lpmis->itemWidth = 2 + bmpChecked.bmWidth + 2 + ICON_SIZE + 4 + rc.right + 2;
diff --git a/plugins/SplashScreen/src/bitmap_funcs.cpp b/plugins/SplashScreen/src/bitmap_funcs.cpp index 18b3e7b108..b01a2aec2e 100644 --- a/plugins/SplashScreen/src/bitmap_funcs.cpp +++ b/plugins/SplashScreen/src/bitmap_funcs.cpp @@ -165,7 +165,7 @@ void MyBitmap::DrawText(TCHAR *str, int x, int y) SIZE sz; GetTextExtentPoint32(this->getDC(), str, mir_tstrlen(str), &sz);
RECT rc; SetRect(&rc, x, y, x+10000, y+10000);
this->saveAlpha(x-2,y-2,sz.cx+2,sz.cy+2);
- ::DrawText(this->getDC(), str, (int)_tcslen(str), &rc, DT_LEFT | DT_TOP | DT_SINGLELINE | DT_NOPREFIX);
+ ::DrawText(this->getDC(), str, -1, &rc, DT_LEFT | DT_TOP | DT_SINGLELINE | DT_NOPREFIX);
this->restoreAlpha(x-2,y-2,sz.cx+2,sz.cy+2);
//(x,y,sz.cx,sz.cy);
}
diff --git a/plugins/SplashScreen/src/splash.cpp b/plugins/SplashScreen/src/splash.cpp index 9738fe005b..d2ce106a7c 100644 --- a/plugins/SplashScreen/src/splash.cpp +++ b/plugins/SplashScreen/src/splash.cpp @@ -273,10 +273,8 @@ int SplashThread(void *arg) }
SetTextColor(SplashBmp->getDC(), (0xFFFFFFFFUL-SplashBmp->getRow(y)[x])&0x00FFFFFFUL);
- //SplashBmp->DrawText(verString,SplashBmp->getWidth()/2-(v_sz.cx/2),SplashBmp->getHeight()-30);
SetBkMode(SplashBmp->getDC(), TRANSPARENT);
SplashBmp->DrawText(verString, x, y);
- //free (ptr_verString);
}
SetWindowLongPtr(hwndSplash, GWL_EXSTYLE, GetWindowLongPtr(hwndSplash, GWL_EXSTYLE) | WS_EX_LAYERED);
diff --git a/plugins/TipperYM/src/mir_smileys.cpp b/plugins/TipperYM/src/mir_smileys.cpp index 2086ef13b8..35c55acf36 100644 --- a/plugins/TipperYM/src/mir_smileys.cpp +++ b/plugins/TipperYM/src/mir_smileys.cpp @@ -457,7 +457,6 @@ SortedList *ReplaceSmileys(const TCHAR *text, int text_size, const char *protoco List_Insert(plText, piece, plText->realCount);
word_start = word_end;
}
-
}
CallService(MS_SMILEYADD_BATCHFREE, 0, (LPARAM)spres);
@@ -467,22 +466,15 @@ SortedList *ReplaceSmileys(const TCHAR *text, int text_size, const char *protoco int DrawTextExt(HDC hdc, LPCTSTR lpString, int nCount, LPRECT lpRect, UINT uFormat, LPCSTR lpProto, SMILEYPARSEINFO spi)
{
- if ((opt.iSmileyAddFlags & SMILEYADD_ENABLE) && spi != NULL)
- {
+ if ((opt.iSmileyAddFlags & SMILEYADD_ENABLE) && spi != NULL) {
if (opt.iSmileyAddFlags & SMILEYADD_RESIZE)
uFormat |= DT_RESIZE_SMILEYS;
return Smileys_DrawText(hdc, lpString, nCount, lpRect, uFormat, lpProto, spi);
}
- else
- {
- if (uFormat & DT_CALCRECT)
- {
- return DrawText(hdc, lpString, nCount, lpRect, uFormat);
- }
- else
- {
- return DrawTextAlpha(hdc, lpString, nCount, lpRect, uFormat);
- }
- }
+
+ if (uFormat & DT_CALCRECT)
+ return DrawText(hdc, lpString, nCount, lpRect, uFormat);
+
+ return DrawTextAlpha(hdc, lpString, nCount, lpRect, uFormat);
}
diff --git a/plugins/TooltipNotify/src/Tooltip.cpp b/plugins/TooltipNotify/src/Tooltip.cpp index d55ad2c156..0ce9ce6d59 100644 --- a/plugins/TooltipNotify/src/Tooltip.cpp +++ b/plugins/TooltipNotify/src/Tooltip.cpp @@ -84,7 +84,7 @@ LRESULT CALLBACK CTooltip::WindowProc(HWND hWnd, UINT message, WPARAM wParam, LP SetBkMode(hDC, TRANSPARENT);
SetTextColor(hDC, m_dwTextColor);
SelectObject(hDC, m_hFont);
- DrawText(hDC, m_szText, mir_tstrlen(m_szText), &rect, DT_CENTER|DT_VCENTER|DT_SINGLELINE);
+ DrawText(hDC, m_szText, -1, &rect, DT_CENTER|DT_VCENTER|DT_SINGLELINE);
EndPaint(hWnd, &ps);
diff --git a/plugins/Utils/mir_smileys.cpp b/plugins/Utils/mir_smileys.cpp index 051f30f2fc..8837fa573b 100644 --- a/plugins/Utils/mir_smileys.cpp +++ b/plugins/Utils/mir_smileys.cpp @@ -213,54 +213,42 @@ SIZE GetTextSize(HDC hdcMem, const TCHAR *szText, SortedList *plText, UINT uText {
SIZE text_size;
- if (szText == NULL)
- {
+ if (szText == NULL) {
text_size.cy = 0;
text_size.cx = 0;
}
- else
- {
+ else {
RECT text_rc = {0, 0, 0x7FFFFFFF, 0x7FFFFFFF};
// Always need cy...
- DrawText(hdcMem,szText,mir_tstrlen(szText), &text_rc, DT_CALCRECT | uTextFormat);
+ DrawText(hdcMem, szText, -1, &text_rc, DT_CALCRECT | uTextFormat);
text_size.cy = text_rc.bottom - text_rc.top;
if (plText == NULL)
- {
text_size.cx = text_rc.right - text_rc.left;
- }
- else
- {
+ else {
if ( !(uTextFormat & DT_RESIZE_SMILEYS))
text_size.cy = max(text_size.cy, max_smiley_height);
text_size.cx = 0;
// See each item of list
- for (int i = 0; i < plText->realCount; i++)
- {
+ for (int i = 0; i < plText->realCount; i++) {
TextPiece *piece = (TextPiece *) plText->items[i];
- if (piece->type == TEXT_PIECE_TYPE_TEXT)
- {
+ if (piece->type == TEXT_PIECE_TYPE_TEXT) {
RECT text_rc = {0, 0, 0x7FFFFFFF, 0x7FFFFFFF};
DrawText(hdcMem, &szText[piece->start_pos], piece->len, &text_rc, DT_CALCRECT | uTextFormat);
text_size.cx = text_size.cx + text_rc.right - text_rc.left;
}
- else
- {
+ else {
double factor;
if ((uTextFormat & DT_RESIZE_SMILEYS) && piece->smiley_height > text_size.cy)
- {
factor = text_size.cy / (double) piece->smiley_height;
- }
else
- {
factor = 1;
- }
text_size.cx = text_size.cx + (LONG)(factor * piece->smiley_width);
}
diff --git a/plugins/WebView/src/webview.cpp b/plugins/WebView/src/webview.cpp index 6efe057862..560b577c2d 100644 --- a/plugins/WebView/src/webview.cpp +++ b/plugins/WebView/src/webview.cpp @@ -29,9 +29,9 @@ MSG messages; DWORD winheight;
int StartUpDelay = 0;
-DWORD Xposition, Yposition;
-DWORD BackgoundClr, TextClr;
-DWORD WindowHeight, WindowWidth;
+int Xposition, Yposition;
+int WindowHeight, WindowWidth;
+COLORREF BackgoundClr, TextClr;
UINT_PTR timerId;
UINT_PTR Countdown;
diff --git a/plugins/WebView/src/webview.h b/plugins/WebView/src/webview.h index 3aab03a26b..eea8f08c03 100644 --- a/plugins/WebView/src/webview.h +++ b/plugins/WebView/src/webview.h @@ -135,7 +135,8 @@ void ReadFromFile(void *hContact); * some globals for window settings
*/
-extern DWORD Xposition, Yposition, BackgoundClr, TextClr, WindowHeight, WindowWidth;
+extern int Xposition, Yposition, WindowHeight, WindowWidth;
+extern COLORREF BackgoundClr, TextClr;
extern UINT_PTR timerId, Countdown;
extern LOGFONT lf;
extern HFONT h_font;
diff --git a/plugins/WebView/src/webview_datawnd.cpp b/plugins/WebView/src/webview_datawnd.cpp index a552c52554..5af34f604a 100644 --- a/plugins/WebView/src/webview_datawnd.cpp +++ b/plugins/WebView/src/webview_datawnd.cpp @@ -62,10 +62,10 @@ INT_PTR CALLBACK DlgProcFind(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara free(tempbuffer);
Filter(buff);
- CharUpperBuffA(buff, mir_strlen(buff));
+ CharUpperBuffA(buff, (int)strlen(buff));
GetDlgItemTextA(hwndDlg, IDC_FINDWHAT, NewSearchstr, SIZEOF(NewSearchstr));
- CharUpperBuffA(NewSearchstr, mir_strlen(NewSearchstr));
+ CharUpperBuffA(NewSearchstr, (int)strlen(NewSearchstr));
OLDstartposition = startposition;
@@ -516,15 +516,15 @@ void ValidatePosition(HWND hwndDlg) MONITORINFO monitorInfo;
monitorInfo.cbSize = sizeof(MONITORINFO);
- if ( GetMonitorInfo(hMonitor, &monitorInfo))
+ if (GetMonitorInfo(hMonitor, &monitorInfo))
CopyMemory(&r, &monitorInfo.rcMonitor, sizeof(RECT));
// /window going off right of screen*
- if ((Xposition + WindowWidth) >= r.right)
+ if (Xposition + WindowWidth >= r.right)
Xposition = r.right - WindowWidth;
// window going off bottom of screen
- if ((Yposition + (WindowHeight)) >= r.bottom)
+ if (Yposition + WindowHeight >= r.bottom)
Yposition = r.bottom - WindowHeight;
// window going off left of screen
diff --git a/plugins/WebView/src/webview_getdata.cpp b/plugins/WebView/src/webview_getdata.cpp index 64bbd6c805..f2683750e1 100644 --- a/plugins/WebView/src/webview_getdata.cpp +++ b/plugins/WebView/src/webview_getdata.cpp @@ -149,7 +149,7 @@ void GetData(void *param) size_t cbLen = mir_strlen(nlhrReply->pData);
char *szInfo = (char*)malloc(cbLen + 2);
mir_strncpy(szInfo, nlhrReply->pData, cbLen);
- downloadsize = mir_strlen(nlhrReply->pData);
+ downloadsize = (ULONG)mir_strlen(nlhrReply->pData);
trunccount = 0;
mir_strncpy(truncated2, szInfo, MAXSIZE2);
@@ -202,13 +202,13 @@ void GetData(void *param) memset(&pos, 0, sizeof(pos)); // XXX: looks bad.
// end string
pos = strstr(truncated2, tempstring2);
- statposend = pos - truncated2 + strlen(tempstring2);
+ statposend = pos - truncated2 + (int)strlen(tempstring2);
if (statpos > statposend) {
memset(&truncated2, ' ', statpos);
memset(&pos, 0, sizeof(pos)); // XXX: looks bad.
pos = strstr(truncated2, tempstring2);
- statposend = pos - truncated2 + strlen(tempstring2);
+ statposend = pos - truncated2 + (int)strlen(tempstring2);
}
if (statpos < statposend) {
memset(&raw, 0, sizeof(raw));
diff --git a/plugins/YAPP/src/popwin.cpp b/plugins/YAPP/src/popwin.cpp index bf37ce97d9..b7e25d2a3a 100644 --- a/plugins/YAPP/src/popwin.cpp +++ b/plugins/YAPP/src/popwin.cpp @@ -400,7 +400,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (pwd->custom_col) SetTextColor(ps.hdc, pd->colorText);
else SetTextColor(ps.hdc, colTime);
if (hFontTime) SelectObject(hdc, (HGDIOBJ)hFontTime);
- DrawText(ps.hdc, pwd->tbuff, (int)_tcslen(pwd->tbuff), &avr, DT_VCENTER | DT_CENTER | DT_LEFT | DT_SINGLELINE | DT_NOPREFIX);
+ DrawText(ps.hdc, pwd->tbuff, -1, &avr, DT_VCENTER | DT_CENTER | DT_LEFT | DT_SINGLELINE | DT_NOPREFIX);
avr.top = avr.bottom + options.av_padding;
}
@@ -449,12 +449,12 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa case PT_LEFT:
ttr.left = textxmin; ttr.right = ttr.left + pwd->time_width;
textxmin += pwd->time_width + options.padding;
- DrawText(ps.hdc, pwd->tbuff, (int)_tcslen(pwd->tbuff), &ttr, DT_VCENTER | DT_LEFT | DT_SINGLELINE | DT_NOPREFIX);
+ DrawText(ps.hdc, pwd->tbuff, -1, &ttr, DT_VCENTER | DT_LEFT | DT_SINGLELINE | DT_NOPREFIX);
break;
case PT_RIGHT:
ttr.right = textxmax; ttr.left = ttr.right - pwd->time_width;
textxmax -= pwd->time_width + options.padding;
- DrawText(ps.hdc, pwd->tbuff, (int)_tcslen(pwd->tbuff), &ttr, DT_VCENTER | DT_LEFT | DT_SINGLELINE | DT_NOPREFIX);
+ DrawText(ps.hdc, pwd->tbuff, -1, &ttr, DT_VCENTER | DT_LEFT | DT_SINGLELINE | DT_NOPREFIX);
break;
}
}
@@ -469,7 +469,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (pwd->custom_col) SetTextColor(ps.hdc, pd->colorText);
else SetTextColor(ps.hdc, colFirstLine);
TCHAR *title = mir_u2t(pd->pwzTitle);
- DrawText(ps.hdc, title, (int)_tcslen(title), &tr, DT_VCENTER | DT_LEFT | DT_END_ELLIPSIS | DT_SINGLELINE | DT_NOPREFIX);
+ DrawText(ps.hdc, title, -1, &tr, DT_VCENTER | DT_LEFT | DT_END_ELLIPSIS | DT_SINGLELINE | DT_NOPREFIX);
mir_free(title);
// title underline
@@ -492,7 +492,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa TCHAR *text = mir_u2t(pd->pwzText);
tr.left = r.left + options.padding + options.text_indent; tr.right = r.right - options.padding; tr.top = tr.bottom + options.padding; tr.bottom = r.bottom - options.padding;
- DrawText(ps.hdc, text, (int)_tcslen(text), &tr, DT_NOPREFIX | DT_WORDBREAK | DT_EXTERNALLEADING | DT_TOP | DT_LEFT | DT_WORD_ELLIPSIS);
+ DrawText(ps.hdc, text, -1, &tr, DT_NOPREFIX | DT_WORDBREAK | DT_EXTERNALLEADING | DT_TOP | DT_LEFT | DT_WORD_ELLIPSIS);
mir_free(text);
}
@@ -630,7 +630,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (hFontSecondLine) SelectObject(hdc, (HGDIOBJ)hFontSecondLine);
TCHAR *text = mir_u2t(pd->pwzText);
- DrawText(hdc, text, (int)_tcslen(text), &r, DT_CALCRECT | DT_NOPREFIX | DT_WORDBREAK | DT_EXTERNALLEADING | DT_TOP | DT_LEFT | DT_WORD_ELLIPSIS);
+ DrawText(hdc, text, -1, &r, DT_CALCRECT | DT_NOPREFIX | DT_WORDBREAK | DT_EXTERNALLEADING | DT_TOP | DT_LEFT | DT_WORD_ELLIPSIS);
pwd->text_height = r.bottom;
mir_free(text);
}
diff --git a/plugins/wbOSD/src/wbOSD.cpp b/plugins/wbOSD/src/wbOSD.cpp index da5b031aad..88b770028a 100644 --- a/plugins/wbOSD/src/wbOSD.cpp +++ b/plugins/wbOSD/src/wbOSD.cpp @@ -37,9 +37,6 @@ int DrawMe(HWND hwnd, TCHAR *string, COLORREF color) HGDIOBJ oo=SelectObject(hdc, fh);
-// rect2.left=0;
-// rect2.top=0;
-// DrawText(hdc, string, -1, &rect2, DT_SINGLELINE|DT_CALCRECT);
rect2 = rect;
DrawText(hdc, string, -1, &rect2, DT_WORDBREAK|DT_CALCRECT);
@@ -77,21 +74,22 @@ int DrawMe(HWND hwnd, TCHAR *string, COLORREF color) OffsetRect(&rect, sxo, syo);
DrawText(hdc, string, -1, &rect2, DT_WORDBREAK|talign);
- } else {
- rect2=rect;
- rect2.left+=plgs.distance;
+ }
+ else {
+ rect2 = rect;
+ rect2.left += plgs.distance;
DrawText(hdc, string, -1, &rect2, DT_WORDBREAK|talign);
- rect2=rect;
- rect2.left-=plgs.distance;
+ rect2 = rect;
+ rect2.left -= plgs.distance;
DrawText(hdc, string, -1, &rect2, DT_WORDBREAK|talign);
- rect2=rect;
- rect2.top-=plgs.distance;
+ rect2 = rect;
+ rect2.top -= plgs.distance;
DrawText(hdc, string, -1, &rect2, DT_WORDBREAK|talign);
- rect2=rect;
- rect2.top+=plgs.distance;
+ rect2 = rect;
+ rect2.top += plgs.distance;
DrawText(hdc, string, -1, &rect2, DT_WORDBREAK|talign);
OffsetRect(&rect, sxo/2, syo/2);
diff --git a/protocols/GTalkExt/src/avatar.cpp b/protocols/GTalkExt/src/avatar.cpp index 4f3e848c4b..433ac0db65 100644 --- a/protocols/GTalkExt/src/avatar.cpp +++ b/protocols/GTalkExt/src/avatar.cpp @@ -33,21 +33,18 @@ LPTSTR CreateAvaFile(HANDLE *hFile)
{
TCHAR name[MAX_PATH + 2];
- TCHAR path[MAX_PATH + 2];
- TCHAR full[MAX_PATH + 2];
-
if (CallService(MS_DB_GETPROFILENAMET, (WPARAM)SIZEOF(name), (LPARAM)&name))
return NULL;
- for (int i = mir_tstrlen(name); i >= 0; i--)
- if ('.' == name[i]) {
- name[i] = 0;
- break;
- }
+ TCHAR *p = _tcsrchr(name, '.');
+ if (p)
+ *p = 0;
+ TCHAR path[MAX_PATH + 2];
if (CallService(MS_DB_GETPROFILEPATHT, (WPARAM)SIZEOF(path), (LPARAM)&path))
return NULL;
+ TCHAR full[MAX_PATH + 2];
mir_sntprintf(full, SIZEOF(full), AVA_FILE_NAME_FORMAT, path, name);
CreateDirectoryTreeT(full);
diff --git a/protocols/GTalkExt/src/handlers.cpp b/protocols/GTalkExt/src/handlers.cpp index 361c33463b..0bfbc8f980 100644 --- a/protocols/GTalkExt/src/handlers.cpp +++ b/protocols/GTalkExt/src/handlers.cpp @@ -45,7 +45,7 @@ GoogleTalkAcc* isGoogle(LPARAM lParam) void FormatMessageUrl(LPCTSTR format, LPTSTR buf, LPCTSTR mailbox, LPCTSTR tid)
{
ULARGE_INTEGER iTid; iTid.QuadPart = _tstoi64(tid);
- int l = mir_tstrlen(buf);
+ size_t l = mir_tstrlen(buf);
mir_sntprintf(buf, l, format, mailbox, iTid.HighPart, iTid.LowPart);
assert(l >= mir_tstrlen(buf));
}
diff --git a/protocols/GTalkExt/src/inbox.cpp b/protocols/GTalkExt/src/inbox.cpp index 6cf8958914..218c3d28bc 100644 --- a/protocols/GTalkExt/src/inbox.cpp +++ b/protocols/GTalkExt/src/inbox.cpp @@ -60,7 +60,7 @@ LPSTR HttpPost(HANDLE hUser, LPSTR reqUrl, LPSTR reqParams) nlhr.headers = (NETLIBHTTPHEADER*)&HEADER_URL_ENCODED;
nlhr.headersCount = 1;
nlhr.pData = reqParams;
- nlhr.dataLength = mir_strlen(reqParams);
+ nlhr.dataLength = (int)mir_strlen(reqParams);
NETLIBHTTPREQUEST *pResp = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hUser, (LPARAM)&nlhr);
if (!pResp) return NULL;
@@ -177,8 +177,8 @@ BOOL OpenUrlWithAuth(LPCSTR acc, LPCTSTR mailbox, LPCTSTR url) int pwdLen = GetMailboxPwd(acc, mailbox, NULL, 0);
if (!pwdLen++) return FALSE;
- int urlLen = mir_tstrlen(url) + 1;
- int mailboxLen = mir_tstrlen(mailbox) + 1;
+ size_t urlLen = mir_tstrlen(url) + 1;
+ size_t mailboxLen = mir_tstrlen(mailbox) + 1;
OPEN_URL_HEADER *data = (OPEN_URL_HEADER*)malloc(sizeof(OPEN_URL_HEADER) + urlLen + mailboxLen + pwdLen);
data->url = (LPSTR)data + sizeof(OPEN_URL_HEADER);
diff --git a/protocols/GTalkExt/src/notifications.cpp b/protocols/GTalkExt/src/notifications.cpp index ebd601737d..0cdbc1e3b4 100644 --- a/protocols/GTalkExt/src/notifications.cpp +++ b/protocols/GTalkExt/src/notifications.cpp @@ -231,8 +231,8 @@ void ShowNotification(LPCSTR acc, POPUPDATAT *data, LPCTSTR jid, LPCTSTR url, LP }
data->PluginWindowProc = PopupProc;
- int lurl = (mir_tstrlen(url) + 1) * sizeof(TCHAR);
- int ljid = (mir_tstrlen(jid) + 1) * sizeof(TCHAR);
+ size_t lurl = (mir_tstrlen(url) + 1) * sizeof(TCHAR);
+ size_t ljid = (mir_tstrlen(jid) + 1) * sizeof(TCHAR);
POPUP_DATA_HEADER *ppdh = (POPUP_DATA_HEADER*)malloc(sizeof(POPUP_DATA_HEADER) + lurl + ljid);
ppdh->MarkRead = FALSE;
diff --git a/protocols/Gadu-Gadu/src/sessions.cpp b/protocols/Gadu-Gadu/src/sessions.cpp index 411730e68d..e9e0205201 100644 --- a/protocols/Gadu-Gadu/src/sessions.cpp +++ b/protocols/Gadu-Gadu/src/sessions.cpp @@ -142,7 +142,7 @@ static BOOL IsOverAction(HWND hwndDlg) szText[0] = 0;
ListView_GetItemText(hList, hti.iItem, hti.iSubItem, szText, SIZEOF(szText));
hdc = GetDC(hList);
- GetTextExtentPoint32(hdc, szText, mir_tstrlen(szText), &textSize);
+ GetTextExtentPoint32(hdc, szText, (int)mir_tstrlen(szText), &textSize);
ReleaseDC(hList, hdc);
textPosX = rc.left + (((rc.right - rc.left) - textSize.cx) / 2);
return (hti.pt.x > textPosX && hti.pt.x < textPosX + textSize.cx);
@@ -241,18 +241,17 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w : TranslateT("You have to be logged in to view concurrent sessions.");
RECT rc;
HWND hwndHeader = ListView_GetHeader(nm->nmcd.hdr.hwndFrom);
- SIZE textSize;
- int textPosX;
GetClientRect(nm->nmcd.hdr.hwndFrom, &rc);
- if (hwndHeader != NULL)
- {
+ if (hwndHeader != NULL) {
RECT rcHeader;
GetClientRect(hwndHeader, &rcHeader);
rc.top += rcHeader.bottom;
}
- GetTextExtentPoint32(nm->nmcd.hdc, szText, mir_tstrlen(szText), &textSize);
- textPosX = rc.left + (((rc.right - rc.left) - textSize.cx) / 2);
- ExtTextOut(nm->nmcd.hdc, textPosX, rc.top + textSize.cy, ETO_OPAQUE, &rc, szText, mir_tstrlen(szText), NULL);
+ int cbLen = (int)mir_tstrlen(szText);
+ SIZE textSize;
+ GetTextExtentPoint32(nm->nmcd.hdc, szText, cbLen, &textSize);
+ int textPosX = rc.left + (((rc.right - rc.left) - textSize.cx) / 2);
+ ExtTextOut(nm->nmcd.hdc, textPosX, rc.top + textSize.cy, ETO_OPAQUE, &rc, szText, cbLen, NULL);
}
// FALL THROUGH
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp index 6ecc46abba..97396f1b32 100644 --- a/protocols/IRCG/src/irclib.cpp +++ b/protocols/IRCG/src/irclib.cpp @@ -279,7 +279,7 @@ int CIrcProto::NLSend(const unsigned char* buf, int cbBuf) if (!con || !buf) return 0; if (m_scriptingEnabled && cbBuf == 0) - cbBuf = mir_strlen((const char *)buf); + cbBuf = (int)mir_strlen((const char *)buf); return Netlib_Send(con, (const char*)buf, cbBuf, MSG_DUMPASTEXT); } diff --git a/protocols/JabberG/src/jabber_api.cpp b/protocols/JabberG/src/jabber_api.cpp index 9379e767b5..f23bdb1d6c 100644 --- a/protocols/JabberG/src/jabber_api.cpp +++ b/protocols/JabberG/src/jabber_api.cpp @@ -331,7 +331,7 @@ LPTSTR CJabberProto::GetResourceFeatures(LPCTSTR jid) mir_cslockfull lck(m_csLists);
int i;
- int iLen = 1; // 1 for extra zero terminator at the end of the string
+ size_t iLen = 1; // 1 for extra zero terminator at the end of the string
// calculate total necessary string length
for (i=0; g_JabberFeatCapPairs[i].szFeature; i++)
if (jcb & g_JabberFeatCapPairs[i].jcbCap)
diff --git a/protocols/JabberG/src/jabber_console.cpp b/protocols/JabberG/src/jabber_console.cpp index 11aae68660..97b027f82a 100644 --- a/protocols/JabberG/src/jabber_console.cpp +++ b/protocols/JabberG/src/jabber_console.cpp @@ -154,7 +154,7 @@ static void sttAppendBufRaw(StringBuf *buf, const char *str) {
if (!str) return;
- int length = mir_strlen(str);
+ size_t length = mir_strlen(str);
if (buf->size - buf->offset < length + 1) {
buf->size += (length + STRINGBUF_INCREMENT);
buf->buf = (char *)mir_realloc(buf->buf, buf->size);
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp index f22ea22984..1db2348c6e 100644 --- a/protocols/JabberG/src/jabber_file.cpp +++ b/protocols/JabberG/src/jabber_file.cpp @@ -298,7 +298,7 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft) mir_free(pFileName);
- int len = mir_tstrlen(ptszResource) + mir_tstrlen(ft->jid) + 2;
+ size_t len = mir_tstrlen(ptszResource) + mir_tstrlen(ft->jid) + 2;
TCHAR *fulljid = (TCHAR *)alloca(sizeof(TCHAR) * len);
mir_sntprintf(fulljid, len, _T("%s/%s"), ft->jid, ptszResource);
diff --git a/protocols/JabberG/src/jabber_form.cpp b/protocols/JabberG/src/jabber_form.cpp index 86dae77ec8..7afa2152b4 100644 --- a/protocols/JabberG/src/jabber_form.cpp +++ b/protocols/JabberG/src/jabber_form.cpp @@ -116,11 +116,12 @@ void JabberFormSetInstruction(HWND hwndForm, const TCHAR *text) {
if (!text) text = _T("");
- int len = mir_tstrlen(text);
- int fixedLen = len;
+ size_t len = mir_tstrlen(text);
+ size_t fixedLen = len;
for (int i = 1; i < len; i++)
if ((text[i - 1] == _T('\n')) && (text[i] != _T('\r')))
++fixedLen;
+
TCHAR *fixedText = NULL;
if (fixedLen != len) {
fixedText = (TCHAR *)mir_alloc(sizeof(TCHAR) * (fixedLen+1));
@@ -147,7 +148,7 @@ void JabberFormSetInstruction(HWND hwndForm, const TCHAR *text) SetRect(&rcText, 0, 0, rcText.right-rcText.left, 0);
HDC hdcEdit = GetDC(GetDlgItem(hwndForm, IDC_INSTRUCTION));
HFONT hfntSave = (HFONT)SelectObject(hdcEdit, (HFONT)SendDlgItemMessage(hwndForm, IDC_INSTRUCTION, WM_GETFONT, 0, 0));
- DrawTextEx(hdcEdit, (TCHAR *)text, mir_tstrlen(text), &rcText,
+ DrawTextEx(hdcEdit, (TCHAR *)text, (int)mir_tstrlen(text), &rcText,
DT_CALCRECT|DT_EDITCONTROL|DT_TOP|DT_WORDBREAK, NULL);
SelectObject(hdcEdit, hfntSave);
ReleaseDC(GetDlgItem(hwndForm, IDC_INSTRUCTION), hdcEdit);
diff --git a/protocols/JabberG/src/jabber_frame.cpp b/protocols/JabberG/src/jabber_frame.cpp index 57f88a79e1..5e0e19cb18 100644 --- a/protocols/JabberG/src/jabber_frame.cpp +++ b/protocols/JabberG/src/jabber_frame.cpp @@ -370,7 +370,7 @@ void CJabberInfoFrame::PaintCompact(HDC hdc) }
RECT rcText; SetRect(&rcText, cx_icon + SZ_FRAMEPADDING + SZ_ICONSPACING, 0, rc.right - SZ_FRAMEPADDING, rc.bottom);
- DrawText(hdc, item.m_pszText, mir_tstrlen(item.m_pszText), &rcText, DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS);
+ DrawText(hdc, item.m_pszText, -1, &rcText, DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_END_ELLIPSIS);
}
else {
if (item.m_hIcolibIcon) {
@@ -433,7 +433,7 @@ void CJabberInfoFrame::PaintNormal(HDC hdc) SetTextColor(hdc, depth ? m_clText : m_clTitle);
RECT rcText; SetRect(&rcText, cx, cy, rc.right - SZ_FRAMEPADDING, cy + line_height);
- DrawText(hdc, item.m_pszText, mir_tstrlen(item.m_pszText), &rcText, DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS);
+ DrawText(hdc, item.m_pszText, -1, &rcText, DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS);
RemoveTooltip(item.m_tooltipId);
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp index 3bdb6ee215..673332e484 100644 --- a/protocols/JabberG/src/jabber_groupchat.cpp +++ b/protocols/JabberG/src/jabber_groupchat.cpp @@ -546,13 +546,13 @@ INT_PTR CJabberDlgGcJoin::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) rc.bottom -= (rc.bottom - rc.top) / 2;
rc.left += 20;
SetTextColor(lpdis->hDC, clLine1);
- DrawText(lpdis->hDC, info->line1, mir_tstrlen(info->line1), &rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS);
+ DrawText(lpdis->hDC, info->line1, -1, &rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS);
rc = lpdis->rcItem;
rc.top += (rc.bottom - rc.top) / 2;
rc.left += 20;
SetTextColor(lpdis->hDC, clLine2);
- DrawText(lpdis->hDC, info->line2, mir_tstrlen(info->line2), &rc, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_WORD_ELLIPSIS);
+ DrawText(lpdis->hDC, info->line2, -1, &rc, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_WORD_ELLIPSIS);
DrawIconEx(lpdis->hDC, lpdis->rcItem.left + 1, lpdis->rcItem.top + 1, m_proto->LoadIconEx("group"), 16, 16, 0, NULL, DI_NORMAL);
switch (info->overlay) {
diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp index d8dfb66fb3..2d0cdc792f 100644 --- a/protocols/JabberG/src/jabber_privacy.cpp +++ b/protocols/JabberG/src/jabber_privacy.cpp @@ -1049,7 +1049,7 @@ void CJabberDlgPrivacyLists::ShowAdvancedList(CPrivacyList *pList) void CJabberDlgPrivacyLists::DrawNextRulePart(HDC hdc, COLORREF color, const TCHAR *text, RECT *rc)
{
SetTextColor(hdc, color);
- DrawText(hdc, text, mir_tstrlen(text), rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS);
+ DrawText(hdc, text, -1, rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS);
SIZE sz;
GetTextExtentPoint32(hdc, text, mir_tstrlen(text), &sz);
diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index 635463a261..96a661a942 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -513,7 +513,6 @@ int __cdecl CYahooProto::SetStatus(int iNewStatus) void __cdecl CYahooProto::get_status_thread(void *param)
{
- int l;
DBVARIANT dbv;
char *gm = NULL, *sm = NULL, *fm;
MCONTACT hContact = (MCONTACT)param;
@@ -538,7 +537,7 @@ void __cdecl CYahooProto::get_status_thread(void *param) if (sm) sm = strdup(sm); /* we need this to go global FREE later */
}
- l = 0;
+ size_t l = 0;
if (gm)
l += mir_strlen(gm) + 3;
diff --git a/src/core/stdclist/src/clcpaint.cpp b/src/core/stdclist/src/clcpaint.cpp index 809a369583..55e3da8354 100644 --- a/src/core/stdclist/src/clcpaint.cpp +++ b/src/core/stdclist/src/clcpaint.cpp @@ -470,7 +470,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) rc.top = y + ((dat->rowHeight - fontHeight) >> 1);
rc.right = (clRect.right - clRect.left);
rc.bottom = rc.top;
- DrawText(hdcMem, szText, (int)mir_tstrlen(szText), &rc, DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS | DT_SINGLELINE);
+ DrawText(hdcMem, szText, -1, &rc, DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS | DT_SINGLELINE);
}
if (selected) {
diff --git a/src/modules/clist/genmenuopt.cpp b/src/modules/clist/genmenuopt.cpp index f5ab36b727..b3ef89cb63 100644 --- a/src/modules/clist/genmenuopt.cpp +++ b/src/modules/clist/genmenuopt.cpp @@ -467,7 +467,7 @@ static int handleCustomDraw(HWND hWndTreeView, LPNMTVCUSTOMDRAW pNMTVCD) SetBkColor(pNMTVCD->nmcd.hdc, pNMTVCD->clrTextBk); FillRect(pNMTVCD->nmcd.hdc, &rc, br); DeleteObject(br); - DrawText(pNMTVCD->nmcd.hdc, tvi.pszText, (int)mir_tstrlen(tvi.pszText), &pNMTVCD->nmcd.rc, DT_LEFT | DT_VCENTER | DT_NOPREFIX); + DrawText(pNMTVCD->nmcd.hdc, tvi.pszText, -1, &pNMTVCD->nmcd.rc, DT_LEFT | DT_VCENTER | DT_NOPREFIX); retVal |= CDRF_SKIPDEFAULT; } diff --git a/src/modules/fonts/FontOptions.cpp b/src/modules/fonts/FontOptions.cpp index 3091965994..59b59e30af 100644 --- a/src/modules/fonts/FontOptions.cpp +++ b/src/modules/fonts/FontOptions.cpp @@ -1319,7 +1319,7 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar SetBkMode(dis->hDC, TRANSPARENT);
SetTextColor(dis->hDC, GetSysColor(COLOR_BTNTEXT));
FillRect(dis->hDC, &dis->rcItem, GetSysColorBrush(COLOR_BTNFACE));
- DrawText(dis->hDC, TranslateT("Sample text"), (int)_tcslen(TranslateT("Sample text")), &dis->rcItem, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS|DT_CENTER);
+ DrawText(dis->hDC, TranslateT("Sample text"), -1, &dis->rcItem, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS|DT_CENTER);
if (hoFont)
SelectObject(dis->hDC, hoFont);
return TRUE;
diff --git a/src/modules/skin/hotkey_opts.cpp b/src/modules/skin/hotkey_opts.cpp index baea80298e..7ade1f27d7 100644 --- a/src/modules/skin/hotkey_opts.cpp +++ b/src/modules/skin/hotkey_opts.cpp @@ -414,7 +414,7 @@ static void sttOptionsStartEdit(HWND hwndDlg, HWND hwndHotkey) static void sttOptionsDrawTextChunk(HDC hdc, TCHAR *text, RECT *rc) { int len = (int)mir_tstrlen(text); - DrawText(hdc, text, len, rc, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_WORD_ELLIPSIS); + DrawText(hdc, text, -1, rc, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_WORD_ELLIPSIS); SIZE sz; GetTextExtentPoint32(hdc, text, len, &sz); |