From 6c0a4e3a07f07ae80e554249814e4e5eef446427 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 17 Dec 2013 20:55:35 +0000 Subject: minor code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@7264 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- .../Clist_modern/src/hdr/modern_commonheaders.h | 2 - .../Clist_modern/src/hdr/modern_commonprototypes.h | 14 +- plugins/Clist_modern/src/hdr/modern_skinengine.h | 5 +- plugins/Clist_modern/src/hdr/modern_static_clui.h | 2 +- plugins/Clist_modern/src/modern_clcidents.cpp | 2 +- plugins/Clist_modern/src/modern_clcitems.cpp | 4 +- plugins/Clist_modern/src/modern_clcopts.cpp | 10 +- plugins/Clist_modern/src/modern_clcpaint.cpp | 266 +-- plugins/Clist_modern/src/modern_clisttray.cpp | 2 +- plugins/Clist_modern/src/modern_clui.cpp | 2 +- plugins/Clist_modern/src/modern_cluiframes.cpp | 64 +- plugins/Clist_modern/src/modern_contact.cpp | 2 +- plugins/Clist_modern/src/modern_newrowopts.cpp | 2 +- plugins/Clist_modern/src/modern_skinengine.cpp | 2021 +++++++++----------- plugins/Clist_modern/src/modern_skinselector.cpp | 6 +- plugins/Clist_modern/src/modern_viewmodebar.cpp | 2 +- 16 files changed, 1049 insertions(+), 1357 deletions(-) (limited to 'plugins/Clist_modern') diff --git a/plugins/Clist_modern/src/hdr/modern_commonheaders.h b/plugins/Clist_modern/src/hdr/modern_commonheaders.h index 284b5c2d15..982f51d51f 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonheaders.h +++ b/plugins/Clist_modern/src/hdr/modern_commonheaders.h @@ -195,8 +195,6 @@ void MakeButtonSkinned(HWND hWnd); extern void TRACE_ERROR(); extern BOOL DebugDeleteObject(HGDIOBJ a); -extern BOOL ske_ResetTextEffect(HDC hdc); -extern BOOL ske_SelectTextEffect(HDC hdc, BYTE EffectID, DWORD FirstColor, DWORD SecondColor); extern void IvalidateDisplayNameCache(DWORD mode); extern SortedList *clistCache; diff --git a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h index 328552b6ce..150bb33395 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h +++ b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h @@ -138,7 +138,7 @@ int RowHeight_CalcRowHeight(ClcData *dat, HWND hwnd, ClcContact *contact, in /* SkinEngine */ BOOL ske_AlphaBlend(HDC hdcDest,int nXOriginDest,int nYOriginDest,int nWidthDest,int nHeightDest,HDC hdcSrc,int nXOriginSrc,int nYOriginSrc,int nWidthSrc,int nHeightSrc,BLENDFUNCTION blendFunction); -void ske_ApplyTransluency(void); +void ske_ApplyTranslucency(void); int ske_BltBackImage (HWND destHWND, HDC destDC, RECT *BltClientRect); HBITMAP ske_CreateDIB32(int cx, int cy); HBITMAP ske_CreateDIB32Point(int cx, int cy, void ** bits); @@ -148,7 +148,6 @@ int ske_DrawImageAt(HDC hdc, RECT *rc); BOOL ske_DrawIconEx(HDC hdc,int xLeft,int yTop,HICON hIcon,int cxWidth,int cyWidth, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags); int ske_DrawNonFramedObjects(BOOL Erase,RECT *r); BOOL ske_DrawText(HDC hdc, LPCTSTR lpString, int nCount, RECT *lpRect, UINT format); -BOOL ske_DrawTextA(HDC hdc, char * lpString, int nCount, RECT *lpRect, UINT format); LPSKINOBJECTDESCRIPTOR ske_FindObjectByName(const char * szName, BYTE objType, SKINOBJECTSLIST* Skin); HBITMAP ske_GetCurrentWindowImage(); int ske_GetFullFilename(TCHAR *buf, const TCHAR *file, TCHAR *skinfolder,BOOL madeAbsolute); @@ -161,22 +160,25 @@ HRESULT SkinEngineLoadModule(); void ske_LoadSkinFromDB(void); int ske_LoadSkinFromIniFile(TCHAR*, BOOL); TCHAR* ske_ParseText(TCHAR *stzText); -int ske_PrepeareImageButDontUpdateIt(RECT *r); +int ske_PrepareImageButDontUpdateIt(RECT *r); int ske_ReCreateBackImage(BOOL Erase,RECT *w); int ske_RedrawCompleteWindow(); -BOOL ske_ResetTextEffect(HDC); -BOOL ske_SelectTextEffect(HDC hdc, BYTE EffectID, DWORD FirstColor, DWORD SecondColor); +bool ske_ResetTextEffect(HDC); +bool ske_SelectTextEffect(HDC hdc, BYTE EffectID, DWORD FirstColor, DWORD SecondColor); INT_PTR ske_Service_DrawGlyph(WPARAM wParam,LPARAM lParam); BOOL ske_SetRectOpaque(HDC memdc,RECT *fr, BOOL force = FALSE ); BOOL ske_SetRgnOpaque(HDC memdc,HRGN hrgn, BOOL force = FALSE ); BOOL ske_TextOut(HDC hdc, int x, int y, LPCTSTR lpString, int nCount); -BOOL ske_TextOutA(HDC hdc, int x, int y, char * lpString, int nCount); int ske_UnloadGlyphImage(HBITMAP hbmp); int SkinEngineUnloadModule(); int ske_UpdateWindowImage(); int ske_UpdateWindowImageRect(RECT *lpRect); int ske_ValidateFrameImageProc(RECT *r); +__forceinline BOOL ske_DrawTextA(HDC hdc, char *lpString, int nCount, RECT *lpRect, UINT format) +{ return ske_DrawText(hdc, _A2T(lpString), nCount, lpRect, format); +} + /* CLUIFrames.c PROXIED */ int CLUIFrames_ActivateSubContainers(BOOL wParam); diff --git a/plugins/Clist_modern/src/hdr/modern_skinengine.h b/plugins/Clist_modern/src/hdr/modern_skinengine.h index 87fd769f40..7ada5601b3 100644 --- a/plugins/Clist_modern/src/hdr/modern_skinengine.h +++ b/plugins/Clist_modern/src/hdr/modern_skinengine.h @@ -86,11 +86,12 @@ struct tga_header_t class IniParser { public: - enum { FLAG_WITH_SETTINGS = 0, + enum { + FLAG_WITH_SETTINGS = 0, FLAG_ONLY_OBJECTS = 1, }; - enum { IT_UNKNOWN, IT_FILE, IT_RESOURCE }; + enum { IT_UNKNOWN, IT_FILE, IT_RESOURCE }; typedef HRESULT (*ParserCallback_t)( const char * szSection, const char * szKey, const char * szValue, IniParser * This ); diff --git a/plugins/Clist_modern/src/hdr/modern_static_clui.h b/plugins/Clist_modern/src/hdr/modern_static_clui.h index 357f3967e9..3f31975f3c 100644 --- a/plugins/Clist_modern/src/hdr/modern_static_clui.h +++ b/plugins/Clist_modern/src/hdr/modern_static_clui.h @@ -79,7 +79,7 @@ void GroupMenus_Init(); int ModernSkinButtonLoadModule(); int ModernSkinButton_ReposButtons(HWND parent, BYTE draw,RECT *r); -void ske_ApplyTransluency(); +void ske_ApplyTranslucency(); HBITMAP ske_CreateDIB32(int cx, int cy); HBITMAP ske_CreateDIB32Point(int cx, int cy, void ** bits); int ske_JustUpdateWindowImage(); diff --git a/plugins/Clist_modern/src/modern_clcidents.cpp b/plugins/Clist_modern/src/modern_clcidents.cpp index bc60e77465..a443492ac6 100644 --- a/plugins/Clist_modern/src/modern_clcidents.cpp +++ b/plugins/Clist_modern/src/modern_clcidents.cpp @@ -239,7 +239,7 @@ int cliGetRowByIndex(ClcData *dat,int testindex,ClcContact **contact,ClcGroup ** if (group->cl.items[group->scanIndex]->SubAllocated) if (group->cl.items[group->scanIndex]->SubExpanded && dat->expandMeta) { - for (i=0;i < group->cl.items[group->scanIndex]->SubAllocated;i++) + for (i=0; i < group->cl.items[group->scanIndex]->SubAllocated; i++) { if ((index>0) && (index < CacheArrSize)) { diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index e8dcc382e2..cecc7ff49a 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -236,7 +236,7 @@ void * AddTempGroup(HWND hwnd,ClcData *dat,const TCHAR *szName,DWORD flags,int g if ( wildcmp( _T2A(szName), "-@-HIDDEN-GROUP-@-")) return NULL; - for (i = 1;;i++) { + for (i = 1;; i++) { szGroupName = pcli->pfnGetGroupName(i,&groupFlags); if (szGroupName == NULL) break; if ( !mir_tstrcmpi(szGroupName,szName)) f = 1; @@ -360,7 +360,7 @@ void cliRebuildEntireList(HWND hwnd,ClcData *dat) dat->selection = -1; dat->HiLightMode = db_get_b(NULL,"CLC","HiLightMode",SETTING_HILIGHTMODE_DEFAULT); { - for (int i = 1;;i++) { + for (int i = 1;; i++) { DWORD groupFlags; TCHAR *szGroupName = pcli->pfnGetGroupName(i,&groupFlags); //UNICODE if (szGroupName == NULL) diff --git a/plugins/Clist_modern/src/modern_clcopts.cpp b/plugins/Clist_modern/src/modern_clcopts.cpp index f2a201be96..9e4103d8b2 100644 --- a/plugins/Clist_modern/src/modern_clcopts.cpp +++ b/plugins/Clist_modern/src/modern_clcopts.cpp @@ -352,7 +352,7 @@ static void FillCheckBoxTree(HWND hwndTree,const struct CheckBoxValues_t *values tvis.hParent = NULL; tvis.hInsertAfter = TVI_LAST; tvis.item.mask = TVIF_PARAM|TVIF_TEXT|TVIF_STATE|TVIF_IMAGE; - for (i=0;i < nValues;i++) { + for (i=0; i < nValues; i++) { tvis.item.lParam = values[i].style; tvis.item.pszText = TranslateTS(values[i].szDescr); tvis.item.stateMask = TVIS_STATEIMAGEMASK; @@ -477,7 +477,7 @@ static INT_PTR CALLBACK DlgProcClistListOpts(HWND hwndDlg, UINT msg, WPARAM wPar TreeView_SetImageList(GetDlgItem(hwndDlg,IDC_HIDEOFFLINEOPTS),himlCheckBoxes,TVSIL_NORMAL); DWORD exStyle = db_get_dw(NULL,"CLC","ExStyle",GetDefaultExStyle()); - for (int i=0;i < SIZEOF(checkBoxToStyleEx);i++) + for (int i=0; i < SIZEOF(checkBoxToStyleEx); i++) CheckDlgButton(hwndDlg,checkBoxToStyleEx[i].id,(exStyle&checkBoxToStyleEx[i].flag)^(checkBoxToStyleEx[i].flag*checkBoxToStyleEx[i].neg)?BST_CHECKED:BST_UNCHECKED); UDACCEL accel[2] = {{0, 10},{2,50}}; @@ -538,7 +538,7 @@ static INT_PTR CALLBACK DlgProcClistListOpts(HWND hwndDlg, UINT msg, WPARAM wPar case PSN_APPLY: { DWORD exStyle = 0; - for (int i=0;i < SIZEOF(checkBoxToStyleEx);i++) + for (int i=0; i < SIZEOF(checkBoxToStyleEx); i++) if ((IsDlgButtonChecked(hwndDlg,checkBoxToStyleEx[i].id) == 0) == checkBoxToStyleEx[i].neg) exStyle |= checkBoxToStyleEx[i].flag; db_set_dw(NULL,"CLC","ExStyle",exStyle); @@ -712,7 +712,7 @@ static int _GetNetVisibleProtoCount() int i,count,netProtoCount; PROTOACCOUNT **accs; ProtoEnumAccounts( &count, &accs ); - for (i=0, netProtoCount = 0;i < count;i++) + for (i=0, netProtoCount = 0;i < count; i++) { if ( pcli->pfnGetProtocolVisibility(accs[i]->szModuleName) == 0 ) continue; @@ -873,7 +873,7 @@ static INT_PTR CALLBACK DlgProcTrayOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L ProtoEnumAccounts( &count, &accs ); item = SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_ADDSTRING, 0, (LPARAM)TranslateT("Global")); SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_SETITEMDATA,item,0); - for (i=0;i < count;i++) { + for (i=0; i < count; i++) { if ( !IsAccountEnabled( accs[i] ) || CallProtoService(accs[i]->szModuleName,PS_GETCAPS,PFLAGNUM_2,0) == 0) continue; diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp index 6a36c8978a..180c4b4995 100644 --- a/plugins/Clist_modern/src/modern_clcpaint.cpp +++ b/plugins/Clist_modern/src/modern_clcpaint.cpp @@ -212,7 +212,7 @@ void CLCPaint::GetTextSize( SIZE *text_size, HDC hdcMem, RECT free_row_rc, TCHA free_height = text_rc.bottom - text_rc.top; // Always need cy... - text_size->cy = ske_DrawText( hdcMem, szText, lstrlen( szText ), &text_rc, DT_CALCRECT | uTextFormat ); + text_size->cy = ske_DrawText(hdcMem, szText, lstrlen( szText ), &text_rc, DT_CALCRECT | uTextFormat ); text_size->cy = min( text_size->cy, free_height ); if ( plText == NULL ) text_size->cx = min( text_rc.right - text_rc.left + 2, free_width ); @@ -230,7 +230,7 @@ void CLCPaint::GetTextSize( SIZE *text_size, HDC hdcMem, RECT free_row_rc, TCHA if ( piece->type == TEXT_PIECE_TYPE_TEXT ) { text_rc = free_row_rc; - ske_DrawText( hdcMem, &szText[piece->start_pos], piece->len, &text_rc, DT_CALCRECT | uTextFormat ); + ske_DrawText(hdcMem, &szText[piece->start_pos], piece->len, &text_rc, DT_CALCRECT | uTextFormat ); text_size->cx = min( text_size->cx + text_rc.right - text_rc.left + 2, free_width ); } else { @@ -274,7 +274,7 @@ tPaintCallbackProc CLCPaint::PaintCallbackProc( HWND hWnd, HDC hDC, RECT *rcPain void CLCPaint::_FillQuickHash() { int i; - for ( i=0;i < hi_LastItem;i++ ) + for ( i=0; i < hi_LastItem; i++ ) HASH[i] = mod_CalcHash( HASHTEXT[i] ); } @@ -432,7 +432,7 @@ void CLCPaint::_DrawTextSmiley( HDC hdcMem, RECT *free_rc, SIZE * text_size, TC free_rc->left += size.cx; } - ske_DrawText( hdcMem, szText + start, len, free_rc, uTextFormat ); + ske_DrawText(hdcMem, szText + start, len, free_rc, uTextFormat ); } else { @@ -448,12 +448,12 @@ void CLCPaint::_DrawTextSmiley( HDC hdcMem, RECT *free_rc, SIZE * text_size, TC i=0; // Get real height of the line - row_height = ske_DrawText( hdcMem, _T("A"), 1, &tmp_rc, DT_CALCRECT | uTextFormat ); + row_height = ske_DrawText(hdcMem, _T("A"), 1, &tmp_rc, DT_CALCRECT | uTextFormat ); // Just draw ellipsis if ( free_rc->right <= free_rc->left ) { - if ( gl_TrimText ) ske_DrawText( hdcMem, _T("..."), 3, free_rc, uTextFormat & ~DT_END_ELLIPSIS ); + if ( gl_TrimText ) ske_DrawText(hdcMem, _T("..."), 3, free_rc, uTextFormat & ~DT_END_ELLIPSIS ); } else { @@ -472,13 +472,13 @@ void CLCPaint::_DrawTextSmiley( HDC hdcMem, RECT *free_rc, SIZE * text_size, TC { tmp_rc = text_rc; tmp_rc.right += 50; - ske_DrawText( hdcMem, &szText[piece->start_pos + start], min( len, piece->len ), &tmp_rc, DT_CALCRECT | ( uTextFormat & ~DT_END_ELLIPSIS )); + ske_DrawText(hdcMem, &szText[piece->start_pos + start], min( len, piece->len ), &tmp_rc, DT_CALCRECT | ( uTextFormat & ~DT_END_ELLIPSIS )); pos_x += tmp_rc.right - tmp_rc.left + 2; if ( uTextFormat & DT_RTLREADING ) text_rc.left = max( text_rc.left, text_rc.right - ( tmp_rc.right - tmp_rc.left )); - ske_DrawText( hdcMem, &szText[piece->start_pos + start], min( len, piece->len ), &text_rc, uTextFormat ); + ske_DrawText(hdcMem, &szText[piece->start_pos + start], min( len, piece->len ), &text_rc, uTextFormat ); len -= piece->len; } else @@ -513,12 +513,12 @@ void CLCPaint::_DrawTextSmiley( HDC hdcMem, RECT *free_rc, SIZE * text_size, TC { text_rc.top += ( row_height - fac_height ) >> 1; - ske_DrawIconEx( hdcMem, text_rc.left, text_rc.top, piece->smiley, + ske_DrawIconEx(hdcMem, text_rc.left, text_rc.top, piece->smiley, fac_width, fac_height, 0, NULL, DI_NORMAL|(( factor < 1 )?128:0 )); //TO DO enchance drawing quality } else { - ske_DrawText( hdcMem, _T("..."), 3, &text_rc, uTextFormat ); + ske_DrawText(hdcMem, _T("..."), 3, &text_rc, uTextFormat ); } pos_x += fac_width; @@ -647,7 +647,7 @@ MODERNMASK *CLCPaint::_GetCLCContactRowBackModernMask( ClcGroup *group, ClcConta TCHAR * b2 = mir_tstrdup( Drawing->szText ); int i, m; m = lstrlen( b2 ); - for ( i=0; i < m;i++ ) + for ( i=0; i < m; i++ ) if ( b2[i] == _T( ',' )) b2[i] = _T( '.' ); { char* b3 = mir_utf8encodeT( b2 ); @@ -662,7 +662,7 @@ MODERNMASK *CLCPaint::_GetCLCContactRowBackModernMask( ClcGroup *group, ClcConta TCHAR * b2 = mir_tstrdup( group->parent->cl.items[0]->szText ); int i, m; m = lstrlen( b2 ); - for ( i=0; i < m;i++ ) + for ( i=0; i < m; i++ ) if ( b2[i] == _T( ',' )) b2[i] = _T( '.' ); { char * b3 = mir_utf8encodeT( b2 ); @@ -833,7 +833,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact UINT uTextFormat = DT_LEFT|DT_VCENTER|( gl_TrimText?DT_END_ELLIPSIS:0 )|DT_SINGLELINE; uTextFormat |= dat->text_rtl?DT_RTLREADING:0; // Select font - ChangeToFont( hdcMem, dat, GetBasicFontID( Drawing ), NULL ); + ChangeToFont(hdcMem, dat, GetBasicFontID( Drawing ), NULL ); // Get text size GetTextSize( &text_size, hdcMem, fr_rc, Drawing->szText, Drawing->ssText.plText, uTextFormat, @@ -851,13 +851,13 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact if ( szCounts && strlen( szCounts )>0 ) { // calc width and height - ChangeToFont( hdcMem, dat, Drawing->group->expanded?FONTID_OPENGROUPCOUNTS:FONTID_CLOSEDGROUPCOUNTS, NULL ); - ske_DrawText( hdcMem, _T(" "), 1, &count_rc, DT_CALCRECT | DT_NOPREFIX ); + ChangeToFont(hdcMem, dat, Drawing->group->expanded?FONTID_OPENGROUPCOUNTS:FONTID_CLOSEDGROUPCOUNTS, NULL ); + ske_DrawText(hdcMem, _T(" "), 1, &count_rc, DT_CALCRECT | DT_NOPREFIX ); count_size.cx = count_rc.right-count_rc.left; space_width = count_size.cx; count_rc.right = 0; count_rc.left = 0; - ske_DrawTextA( hdcMem, szCounts, lstrlenA( szCounts ), &count_rc, DT_CALCRECT ); + ske_DrawTextA(hdcMem, szCounts, lstrlenA( szCounts ), &count_rc, DT_CALCRECT ); count_size.cx += count_rc.right-count_rc.left; count_size.cy = count_rc.bottom-count_rc.top; } @@ -866,7 +866,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact { SIZE text_size = {0}; int wid = fr_rc.right-fr_rc.left; - ChangeToFont( hdcMem, dat, Drawing->group->expanded?FONTID_OPENGROUPS:FONTID_CLOSEDGROUPS, NULL ); + ChangeToFont(hdcMem, dat, Drawing->group->expanded?FONTID_OPENGROUPS:FONTID_CLOSEDGROUPS, NULL ); GetTextSize( &text_size, hdcMem, fr_rc, Drawing->szText, Drawing->ssText.plText, 0, dat->text_resize_smileys ? 0 : Drawing->ssText.iMaxSmileyHeight ); if ( wid-count_size.cx > text_size.cx ) @@ -906,27 +906,27 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact //uTextFormat |= ( dat->row_align_group_mode == 2 )?DT_RIGHT:( dat->row_align_group_mode == 1 )?DT_CENTER:DT_LEFT; uTextFormat |= DT_VCENTER; - ChangeToFont( hdcMem, dat, Drawing->group->expanded?FONTID_OPENGROUPS:FONTID_CLOSEDGROUPS, NULL ); + ChangeToFont(hdcMem, dat, Drawing->group->expanded?FONTID_OPENGROUPS:FONTID_CLOSEDGROUPS, NULL ); if ( selected ) - SetTextColor( hdcMem, dat->selTextColour ); + SetTextColor(hdcMem, dat->selTextColour ); else if ( hottrack ) - _SetHotTrackColour( hdcMem, dat ); + _SetHotTrackColour(hdcMem, dat ); if ( dat->text_rtl != 0 ) _RTLRect( &nameRect, free_row_rc.right, dx ); - _DrawTextSmiley( hdcMem, &nameRect, &text_size, Drawing->szText, 0, lstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); + _DrawTextSmiley(hdcMem, &nameRect, &text_size, Drawing->szText, 0, lstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); if (selected && !dat->filterSearch) { - SetTextColor( hdcMem, dat->quickSearchColour ); - _DrawTextSmiley( hdcMem, &nameRect, &text_size, Drawing->szText, 0, lstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); + SetTextColor(hdcMem, dat->quickSearchColour ); + _DrawTextSmiley(hdcMem, &nameRect, &text_size, Drawing->szText, 0, lstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); } if ( szCounts && strlen( szCounts )>0 ) { - ChangeToFont( hdcMem, dat, Drawing->group->expanded?FONTID_OPENGROUPCOUNTS:FONTID_CLOSEDGROUPCOUNTS, NULL ); + ChangeToFont(hdcMem, dat, Drawing->group->expanded?FONTID_OPENGROUPCOUNTS:FONTID_CLOSEDGROUPCOUNTS, NULL ); if ( selected ) - SetTextColor( hdcMem, dat->selTextColour ); + SetTextColor(hdcMem, dat->selTextColour ); else if ( hottrack ) - _SetHotTrackColour( hdcMem, dat ); + _SetHotTrackColour(hdcMem, dat ); if ( dat->text_rtl != 0 ) _RTLRect( &countRect, free_row_rc.right, dx ); - ske_DrawTextA( hdcMem, szCounts, lstrlenA( szCounts ), &countRect, uTextFormat ); + ske_DrawTextA(hdcMem, szCounts, lstrlenA( szCounts ), &countRect, uTextFormat ); } { RECT rc = fr_rc; @@ -950,13 +950,13 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact SIZE counts_size = {0}; // Get widths counts_rc = fr_rc; - DrawText( hdcMem, _T(" "), 1, &space_rc, DT_CALCRECT | DT_NOPREFIX ); + DrawText(hdcMem, _T(" "), 1, &space_rc, DT_CALCRECT | DT_NOPREFIX ); space_size.cx = space_rc.right - space_rc.left; space_size.cy = min( space_rc.bottom - space_rc.top, fr_rc.bottom-fr_rc.top ); - ChangeToFont( hdcMem, dat, Drawing->group->expanded?FONTID_OPENGROUPCOUNTS:FONTID_CLOSEDGROUPCOUNTS, NULL ); - DrawTextA( hdcMem, szCounts, lstrlenA( szCounts ), &counts_rc, DT_CALCRECT ); + ChangeToFont(hdcMem, dat, Drawing->group->expanded?FONTID_OPENGROUPCOUNTS:FONTID_CLOSEDGROUPCOUNTS, NULL ); + DrawTextA(hdcMem, szCounts, lstrlenA( szCounts ), &counts_rc, DT_CALCRECT ); counts_size.cx = counts_rc.right - counts_rc.left; counts_size.cy = min( counts_rc.bottom - counts_rc.top, fr_rc.bottom-fr_rc.top ); @@ -980,15 +980,15 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact counts_rc.right = counts_rc.left+counts_size.cx; } } - ChangeToFont( hdcMem, dat, GetBasicFontID( Drawing ), NULL ); + ChangeToFont(hdcMem, dat, GetBasicFontID( Drawing ), NULL ); // Set color if ( selected ) - SetTextColor( hdcMem, dat->selTextColour ); + SetTextColor(hdcMem, dat->selTextColour ); else if ( hottrack ) - _SetHotTrackColour( hdcMem, dat ); + _SetHotTrackColour(hdcMem, dat ); if ( dat->text_rtl != 0 ) _RTLRect( &text_rect, free_row_rc.right, dx ); - _DrawTextSmiley( hdcMem, &text_rect, &text_size, Drawing->szText, 0, lstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); + _DrawTextSmiley(hdcMem, &text_rect, &text_size, Drawing->szText, 0, lstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); if ( ((dat->filterSearch && Drawing->type != CLCIT_GROUP) || selected) && dat->szQuickSearch[0] != '\0' ) { int idx = 0; @@ -999,14 +999,14 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact if (p1) idx = int(p1 - lowered); } - SetTextColor( hdcMem, dat->quickSearchColour ); - _DrawTextSmiley( hdcMem, &text_rect, &text_size, Drawing->szText, idx, lstrlen( dat->szQuickSearch ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); + SetTextColor(hdcMem, dat->quickSearchColour ); + _DrawTextSmiley(hdcMem, &text_rect, &text_size, Drawing->szText, idx, lstrlen( dat->szQuickSearch ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); } if ( Drawing->type == CLCIT_GROUP && szCounts && szCounts[0] && counts_rc.right-counts_rc.left>0 ) { - ChangeToFont( hdcMem, dat, Drawing->group->expanded?FONTID_OPENGROUPCOUNTS:FONTID_CLOSEDGROUPCOUNTS, NULL ); + ChangeToFont(hdcMem, dat, Drawing->group->expanded?FONTID_OPENGROUPCOUNTS:FONTID_CLOSEDGROUPCOUNTS, NULL ); if ( dat->text_rtl != 0 ) _RTLRect( &counts_rc, free_row_rc.right, dx ); - ske_DrawTextA( hdcMem, szCounts, lstrlenA( szCounts ), &counts_rc, uTextFormat ); + ske_DrawTextA(hdcMem, szCounts, lstrlenA( szCounts ), &counts_rc, uTextFormat ); if ( dat->text_rtl == 0 ) text_rect.right = counts_rc.right; else @@ -1034,8 +1034,8 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact { rc.top += (( rc.bottom-rc.top )>>1 )-1; rc.bottom = rc.top+2; - DrawEdge( hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT ); - ske_SetRectOpaque( hdcMem, &rc ); + DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT ); + ske_SetRectOpaque(hdcMem, &rc ); } } @@ -1065,7 +1065,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact UINT uTextFormat = ( dat->text_rtl ? DT_RTLREADING : 0 ) ; text_size.cx = p_rect.right-p_rect.left; text_size.cy = p_rect.bottom-p_rect.top; - ChangeToFont( hdcMem, dat, GetBasicFontID( Drawing ), NULL ); + ChangeToFont(hdcMem, dat, GetBasicFontID( Drawing ), NULL ); uTextFormat |= ( gl_RowTabAccess[i]->valign == TC_VCENTER )?DT_VCENTER:( gl_RowTabAccess[i]->valign == TC_BOTTOM )?DT_BOTTOM:0; uTextFormat |= ( gl_RowTabAccess[i]->halign == TC_HCENTER )?DT_CENTER:( gl_RowTabAccess[i]->halign == TC_RIGHT )?DT_RIGHT:0; @@ -1074,10 +1074,10 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact if ( Drawing->type == CLCIT_CONTACT ) { if ( selected ) - SetTextColor( hdcMem, dat->selTextColour ); + SetTextColor(hdcMem, dat->selTextColour ); else if ( hottrack ) - _SetHotTrackColour( hdcMem, dat ); - _DrawTextSmiley( hdcMem, &p_rect, &text_size, Drawing->szText, 0, lstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); + _SetHotTrackColour(hdcMem, dat ); + _DrawTextSmiley(hdcMem, &p_rect, &text_size, Drawing->szText, 0, lstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); if ( (dat->filterSearch || selected) && dat->szQuickSearch[0] != '\0' ) { int idx = 0; @@ -1088,8 +1088,8 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact if (p1) idx = int(p1 - lowered); } - SetTextColor( hdcMem, dat->quickSearchColour ); - _DrawTextSmiley( hdcMem, &p_rect, &text_size, Drawing->szText, idx, lstrlen( dat->szQuickSearch ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); + SetTextColor(hdcMem, dat->quickSearchColour ); + _DrawTextSmiley(hdcMem, &p_rect, &text_size, Drawing->szText, idx, lstrlen( dat->szQuickSearch ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); } Drawing->pos_rename_rect = p_rect; { @@ -1114,13 +1114,13 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact // calc width and height - ChangeToFont( hdcMem, dat, Drawing->group->expanded?FONTID_OPENGROUPCOUNTS:FONTID_CLOSEDGROUPCOUNTS, NULL ); - ske_DrawText( hdcMem, _T(" "), 1, &count_rc, DT_CALCRECT | DT_NOPREFIX ); + ChangeToFont(hdcMem, dat, Drawing->group->expanded?FONTID_OPENGROUPCOUNTS:FONTID_CLOSEDGROUPCOUNTS, NULL ); + ske_DrawText(hdcMem, _T(" "), 1, &count_rc, DT_CALCRECT | DT_NOPREFIX ); count_size.cx = count_rc.right-count_rc.left; space_width = count_size.cx; count_rc.right = 0; count_rc.left = 0; - ske_DrawTextA( hdcMem, szCounts, lstrlenA( szCounts ), &count_rc, DT_CALCRECT ); + ske_DrawTextA(hdcMem, szCounts, lstrlenA( szCounts ), &count_rc, DT_CALCRECT ); count_size.cx += count_rc.right-count_rc.left; count_size.cy = count_rc.bottom-count_rc.top; } @@ -1129,7 +1129,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact { SIZE text_size = {0}; int wid = p_rect.right-p_rect.left; - ChangeToFont( hdcMem, dat, Drawing->group->expanded?FONTID_OPENGROUPS:FONTID_CLOSEDGROUPS, NULL ); + ChangeToFont(hdcMem, dat, Drawing->group->expanded?FONTID_OPENGROUPS:FONTID_CLOSEDGROUPS, NULL ); GetTextSize( &text_size, hdcMem, p_rect, Drawing->szText, Drawing->ssText.plText, 0, dat->text_resize_smileys ? 0 : Drawing->ssText.iMaxSmileyHeight ); if ( wid-count_size.cx > text_size.cx ) @@ -1169,24 +1169,24 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact //uTextFormat |= ( dat->row_align_group_mode == 2 )?DT_RIGHT:( dat->row_align_group_mode == 1 )?DT_CENTER:DT_LEFT; uTextFormat |= DT_VCENTER; - ChangeToFont( hdcMem, dat, Drawing->group->expanded?FONTID_OPENGROUPS:FONTID_CLOSEDGROUPS, NULL ); + ChangeToFont(hdcMem, dat, Drawing->group->expanded?FONTID_OPENGROUPS:FONTID_CLOSEDGROUPS, NULL ); if ( selected ) - SetTextColor( hdcMem, dat->selTextColour ); + SetTextColor(hdcMem, dat->selTextColour ); else if ( hottrack ) - _SetHotTrackColour( hdcMem, dat ); - _DrawTextSmiley( hdcMem, &nameRect, &text_size, Drawing->szText, 0, lstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); + _SetHotTrackColour(hdcMem, dat ); + _DrawTextSmiley(hdcMem, &nameRect, &text_size, Drawing->szText, 0, lstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); if (selected && !dat->filterSearch) { - SetTextColor( hdcMem, dat->quickSearchColour ); - _DrawTextSmiley( hdcMem, &nameRect, &text_size, Drawing->szText, 0, lstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); + SetTextColor(hdcMem, dat->quickSearchColour ); + _DrawTextSmiley(hdcMem, &nameRect, &text_size, Drawing->szText, 0, lstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); } if ( szCounts && strlen( szCounts )>0 ) { - ChangeToFont( hdcMem, dat, Drawing->group->expanded?FONTID_OPENGROUPCOUNTS:FONTID_CLOSEDGROUPCOUNTS, NULL ); + ChangeToFont(hdcMem, dat, Drawing->group->expanded?FONTID_OPENGROUPCOUNTS:FONTID_CLOSEDGROUPCOUNTS, NULL ); if ( selected ) - SetTextColor( hdcMem, dat->selTextColour ); + SetTextColor(hdcMem, dat->selTextColour ); else if ( hottrack ) - _SetHotTrackColour( hdcMem, dat ); - ske_DrawTextA( hdcMem, szCounts, lstrlenA( szCounts ), &countRect, uTextFormat ); + _SetHotTrackColour(hdcMem, dat ); + ske_DrawTextA(hdcMem, szCounts, lstrlenA( szCounts ), &countRect, uTextFormat ); } Drawing->pos_rename_rect = p_rect; Drawing->pos_label = nameRect; @@ -1217,10 +1217,10 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact text_size.cx = p_rect.right-p_rect.left; text_size.cy = p_rect.bottom-p_rect.top; - ChangeToFont( hdcMem, dat, FONTID_SECONDLINE, NULL ); + ChangeToFont(hdcMem, dat, FONTID_SECONDLINE, NULL ); uTextFormat = uTextFormat | ( gl_TrimText?DT_END_ELLIPSIS:0 )|DT_SINGLELINE; if ( Drawing->type == CLCIT_CONTACT ) - _DrawTextSmiley( hdcMem, &p_rect, &text_size, pdnce->szSecondLineText, 0, lstrlen( pdnce->szSecondLineText ), pdnce->ssSecondLine.plText, uTextFormat, dat->text_resize_smileys ); + _DrawTextSmiley(hdcMem, &p_rect, &text_size, pdnce->szSecondLineText, 0, lstrlen( pdnce->szSecondLineText ), pdnce->ssSecondLine.plText, uTextFormat, dat->text_resize_smileys ); break; } case TC_TEXT3: @@ -1246,10 +1246,10 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact text_size.cx = p_rect.right-p_rect.left; text_size.cy = p_rect.bottom-p_rect.top; - ChangeToFont( hdcMem, dat, FONTID_THIRDLINE, NULL ); + ChangeToFont(hdcMem, dat, FONTID_THIRDLINE, NULL ); uTextFormat = uTextFormat | ( gl_TrimText?DT_END_ELLIPSIS:0 )|DT_SINGLELINE; if ( Drawing->type == CLCIT_CONTACT ) - _DrawTextSmiley( hdcMem, &p_rect, &text_size, pdnce->szThirdLineText, 0, lstrlen( pdnce->szThirdLineText ), pdnce->ssThirdLine.plText, uTextFormat, dat->text_resize_smileys ); + _DrawTextSmiley(hdcMem, &p_rect, &text_size, pdnce->szThirdLineText, 0, lstrlen( pdnce->szThirdLineText ), pdnce->ssThirdLine.plText, uTextFormat, dat->text_resize_smileys ); break; } case TC_STATUS: @@ -1363,7 +1363,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact // Store pos Drawing->pos_avatar = p_rect; oldrgn = CreateRectRgn( 0, 0, 0, 0 ); - GetClipRgn( hdcMem, oldrgn ); + GetClipRgn(hdcMem, oldrgn ); // Round corners if ( dat->avatars_round_corners ) @@ -1380,15 +1380,15 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact if ( dat->avatars_draw_border ) { HBRUSH hBrush = CreateSolidBrush( dat->avatars_border_color ); - HBRUSH hOldBrush = ( HBRUSH )SelectObject( hdcMem, hBrush ); + HBRUSH hOldBrush = ( HBRUSH )SelectObject(hdcMem, hBrush ); HRGN rgn2; rgn = CreateRoundRectRgn( p_rect.left, p_rect.top, p_rect.right+1, p_rect.bottom+1, round_radius << 1, round_radius << 1 ); rgn2 = CreateRoundRectRgn( p_rect.left+1, p_rect.top+1, p_rect.right, p_rect.bottom, round_radius << 1, round_radius << 1 ); CombineRgn( rgn2, rgn, rgn2, RGN_DIFF ); - // FrameRgn( hdcMem, rgn, hBrush, 1, 1 ); - FillRgn( hdcMem, rgn2, hBrush ); - ske_SetRgnOpaque( hdcMem, rgn2 ); - SelectObject( hdcMem, hOldBrush ); + // FrameRgn(hdcMem, rgn, hBrush, 1, 1 ); + FillRgn(hdcMem, rgn2, hBrush ); + ske_SetRgnOpaque(hdcMem, rgn2 ); + SelectObject(hdcMem, hOldBrush ); DeleteObject( hBrush ); DeleteObject( rgn ); DeleteObject( rgn2 ); @@ -1397,7 +1397,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact { int k = dat->avatars_draw_border?1:0; rgn = CreateRoundRectRgn( p_rect.left+k, p_rect.top+k, p_rect.right+1-k, p_rect.bottom+1-k, round_radius * 2, round_radius * 2 ); - ExtSelectClipRgn( hdcMem, rgn, RGN_AND ); + ExtSelectClipRgn(hdcMem, rgn, RGN_AND ); } // Draw avatar @@ -1405,7 +1405,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact { int w = width; int h = height; - _DrawContactAvatar( hdcMem, dat, Drawing, &row_rc, selected, hottrack, p_rect, &p_rect ); + _DrawContactAvatar(hdcMem, dat, Drawing, &row_rc, selected, hottrack, p_rect, &p_rect ); } else { @@ -1416,7 +1416,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact { DeleteObject( rgn ); } - SelectClipRgn( hdcMem, oldrgn ); + SelectClipRgn(hdcMem, oldrgn ); DeleteObject( oldrgn ); @@ -1448,7 +1448,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact CLR_NONE, CLR_NONE, ( blendmode == 255 )?ILD_NORMAL:( blendmode == 128 )?ILD_BLEND50:ILD_BLEND25 ); - //ske_DrawIconEx( hdcMem, p_rect.left, p_rect.top, g_pAvatarOverlayIcons[GetContactCachedStatus( Drawing->hContact ) - ID_STATUS_OFFLINE].icon, + //ske_DrawIconEx(hdcMem, p_rect.left, p_rect.top, g_pAvatarOverlayIcons[GetContactCachedStatus( Drawing->hContact ) - ID_STATUS_OFFLINE].icon, // ICON_HEIGHT, ICON_HEIGHT, 0, NULL, DI_NORMAL|a ); break; } @@ -1572,8 +1572,8 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact if ( !tmi.printDateTime(pdnce->hTimeZone, _T("t"), szResult, SIZEOF(szResult), 0)) { // Select font - ChangeToFont( hdcMem, dat, FONTID_CONTACT_TIME, NULL ); - ske_DrawText( hdcMem, szResult, lstrlen( szResult ), &p_rect, DT_NOPREFIX | DT_SINGLELINE|( dat->text_rtl ? DT_RTLREADING : 0 )); + ChangeToFont(hdcMem, dat, FONTID_CONTACT_TIME, NULL ); + ske_DrawText(hdcMem, szResult, lstrlen( szResult ), &p_rect, DT_NOPREFIX | DT_SINGLELINE|( dat->text_rtl ? DT_RTLREADING : 0 )); } break; } @@ -1622,11 +1622,11 @@ BOOL CLCPaint::_DrawNonEnginedBackground( HWND hwnd, HDC hdcMem, RECT *rcPaint, return FALSE; // XXX: Halftone isnt supported on 9x, however the scretch problems dont happen on 98. - SetStretchBltMode( hdcMem, HALFTONE ); + SetStretchBltMode(hdcMem, HALFTONE ); BITMAP bmp; GetObject(dat->hBmpBackground, sizeof(bmp), &bmp); - HDC hdcBmp = CreateCompatibleDC( hdcMem ); + HDC hdcBmp = CreateCompatibleDC(hdcMem ); HBITMAP oldbm = ( HBITMAP )SelectObject( hdcBmp, dat->hBmpBackground ); int x, y = dat->backgroundBmpUse&CLBF_SCROLL?-dat->yScroll:0; int maxx = dat->backgroundBmpUse&CLBF_TILEH?clRect.right:1; @@ -1691,7 +1691,7 @@ BOOL CLCPaint::_DrawNonEnginedBackground( HWND hwnd, HDC hdcMem, RECT *rcPaint, for ( ;y < maxy;y += desth ) { if ( y < rcPaint->top-desth ) continue; for ( x = 0;x < maxx;x += destw ) - StretchBlt( hdcMem, x, y, destw, desth, hdcBmp, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY ); + StretchBlt(hdcMem, x, y, destw, desth, hdcBmp, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY ); } SelectObject( hdcBmp, oldbm ); DeleteDC( hdcBmp ); @@ -2400,10 +2400,10 @@ void CLCPaint::_CalcItemsPos( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact *D RECT rc; // Select font - ChangeToFont( hdcMem, dat, FONTID_CONTACT_TIME, NULL ); + ChangeToFont(hdcMem, dat, FONTID_CONTACT_TIME, NULL ); // Get text size - text_size.cy = ske_DrawText( hdcMem, szResult, lstrlen( szResult ), &rc, DT_CALCRECT | DT_NOPREFIX | DT_SINGLELINE ); + text_size.cy = ske_DrawText(hdcMem, szResult, lstrlen( szResult ), &rc, DT_CALCRECT | DT_NOPREFIX | DT_SINGLELINE ); text_size.cy = min( text_size.cy, free_row_rc.bottom - free_row_rc.top ); text_size.cx = rc.right - rc.left; @@ -2486,7 +2486,7 @@ void CLCPaint::_CalcItemsPos( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact *D free_height = free_row_rc.bottom - free_row_rc.top; // Select font - ChangeToFont( hdcMem, dat, GetBasicFontID( Drawing ), NULL ); + ChangeToFont(hdcMem, dat, GetBasicFontID( Drawing ), NULL ); // Get text size GetTextSize( &text_size, hdcMem, free_row_rc, Drawing->szText, Drawing->ssText.plText, uTextFormat, @@ -2523,12 +2523,12 @@ void CLCPaint::_CalcItemsPos( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact *D free_height = free_row_rc.bottom - free_row_rc.top; // Get widths - ske_DrawText( hdcMem, _T(" "), 1, &space_rc, DT_CALCRECT | DT_NOPREFIX ); + ske_DrawText(hdcMem, _T(" "), 1, &space_rc, DT_CALCRECT | DT_NOPREFIX ); space_size.cx = space_rc.right - space_rc.left; space_size.cy = min( space_rc.bottom - space_rc.top, free_height ); - ChangeToFont( hdcMem, dat, Drawing->group->expanded?FONTID_OPENGROUPCOUNTS:FONTID_CLOSEDGROUPCOUNTS, NULL ); - DrawTextA( hdcMem, szCounts, lstrlenA( szCounts ), &counts_rc, DT_CALCRECT ); + ChangeToFont(hdcMem, dat, Drawing->group->expanded?FONTID_OPENGROUPCOUNTS:FONTID_CLOSEDGROUPCOUNTS, NULL ); + DrawTextA(hdcMem, szCounts, lstrlenA( szCounts ), &counts_rc, DT_CALCRECT ); //Store position //StoreItemPos( Drawing, CIT_SUBTEXT1, &counts_rc ); // Or not to comment? @@ -2564,7 +2564,7 @@ void CLCPaint::_CalcItemsPos( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact *D selection_text_rc = text_rc; full_text_width = text_width; - ChangeToFont( hdcMem, dat, Drawing->group->expanded?FONTID_OPENGROUPS:FONTID_CLOSEDGROUPS, NULL ); + ChangeToFont(hdcMem, dat, Drawing->group->expanded?FONTID_OPENGROUPS:FONTID_CLOSEDGROUPS, NULL ); } if ( dat->row_align_group_mode == 1 ) //center @@ -2607,7 +2607,7 @@ void CLCPaint::_CalcItemsPos( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact *D { //RECT rc_tmp = free_row_rc; - ChangeToFont( hdcMem, dat, FONTID_SECONDLINE, NULL ); + ChangeToFont(hdcMem, dat, FONTID_SECONDLINE, NULL ); // Get sizes GetTextSize( &second_line_text_size, hdcMem, free_row_rc, pdnce->szSecondLineText, pdnce->ssSecondLine.plText, @@ -2643,7 +2643,7 @@ void CLCPaint::_CalcItemsPos( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact *D { //RECT rc_tmp = free_row_rc; - ChangeToFont( hdcMem, dat, FONTID_THIRDLINE, NULL ); + ChangeToFont(hdcMem, dat, FONTID_THIRDLINE, NULL ); // Get sizes GetTextSize( &third_line_text_size, hdcMem, free_row_rc, pdnce->szThirdLineText, pdnce->ssThirdLine.plText, @@ -2667,7 +2667,7 @@ void CLCPaint::_CalcItemsPos( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact *D max_bottom_selection_border = min( max_bottom_selection_border, dat->third_line_top_space / 2 ); } - ChangeToFont( hdcMem, dat, GetBasicFontID( Drawing ), NULL ); + ChangeToFont(hdcMem, dat, GetBasicFontID( Drawing ), NULL ); } @@ -2925,13 +2925,13 @@ void CLCPaint::_DrawContactAvatar( HDC hdcMem, ClcData *dat, ClcContact *Drawing if ( dat->avatars_draw_border ) { HBRUSH hBrush = CreateSolidBrush( dat->avatars_border_color ); - HBRUSH hOldBrush = ( HBRUSH )SelectObject( hdcMem, hBrush ); + HBRUSH hOldBrush = ( HBRUSH )SelectObject(hdcMem, hBrush ); HRGN rgnOutside = CreateRoundRectRgn( prcItem->left, prcItem->top, prcItem->right+1, prcItem->bottom+1, round_radius << 1, round_radius << 1 ); HRGN rgnInside = CreateRoundRectRgn( prcItem->left+1, prcItem->top+1, prcItem->right, prcItem->bottom, round_radius << 1, round_radius << 1 ); CombineRgn( rgnOutside, rgnOutside, rgnInside, RGN_DIFF ); - FillRgn( hdcMem, rgnOutside, hBrush ); - ske_SetRgnOpaque( hdcMem, rgnOutside ); - SelectObject( hdcMem, hOldBrush ); + FillRgn(hdcMem, rgnOutside, hBrush ); + ske_SetRgnOpaque(hdcMem, rgnOutside ); + SelectObject(hdcMem, hOldBrush ); DeleteObject( hBrush ); DeleteObject( rgnInside ); DeleteObject( rgnOutside ); @@ -2946,14 +2946,14 @@ void CLCPaint::_DrawContactAvatar( HDC hdcMem, ClcData *dat, ClcContact *Drawing } else rgn = CreateRectRgn( prcItem->left, prcItem->top, prcItem->right, prcItem->bottom ); - ExtSelectClipRgn( hdcMem, rgn, RGN_AND ); + ExtSelectClipRgn(hdcMem, rgn, RGN_AND ); // Draw avatar ImageArray_DrawImage( &dat->avatar_cache, Drawing->avatar_pos, hdcMem, prcItem->left, prcItem->top, blendmode ); // Restore region DeleteObject( rgn ); rgn = CreateRectRgn( row_rc->left, row_rc->top, row_rc->right, row_rc->bottom ); - SelectClipRgn( hdcMem, rgn ); + SelectClipRgn(hdcMem, rgn ); DeleteObject( rgn ); // Draw overlays if (dat->avatars_draw_overlay && dat->avatars_maxheight_size >= ICON_HEIGHT + (dat->avatars_draw_border ? 2 : 0) @@ -3019,18 +3019,18 @@ void CLCPaint::_DrawContactIcon( HDC hdcMem, ClcData *dat, ClcContact *Drawing, void CLCPaint::_DrawContactText( HDC hdcMem, ClcData *dat, ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT *prcItem, UINT uTextFormat ) { - ChangeToFont( hdcMem, dat, GetBasicFontID( Drawing ), NULL ); + ChangeToFont(hdcMem, dat, GetBasicFontID( Drawing ), NULL ); if ( selected ) - SetTextColor( hdcMem, dat->force_in_dialog ? GetSysColor( COLOR_HIGHLIGHTTEXT ) : dat->selTextColour ); + SetTextColor(hdcMem, dat->force_in_dialog ? GetSysColor( COLOR_HIGHLIGHTTEXT ) : dat->selTextColour ); else if ( hottrack || (dat->filterSearch && dat->szQuickSearch[0] != '\0' && Drawing->type != CLCIT_GROUP) ) - _SetHotTrackColour( hdcMem, dat ); + _SetHotTrackColour(hdcMem, dat ); if ( Drawing->type == CLCIT_GROUP ) { - ske_DrawText( hdcMem, Drawing->szText, -1, prcItem, uTextFormat ); + ske_DrawText(hdcMem, Drawing->szText, -1, prcItem, uTextFormat ); if (selected && !dat->filterSearch) { - SetTextColor( hdcMem, dat->quickSearchColour ); - ske_DrawText( hdcMem, Drawing->szText, lstrlen( dat->szQuickSearch ), prcItem, uTextFormat ); + SetTextColor(hdcMem, dat->quickSearchColour ); + ske_DrawText(hdcMem, Drawing->szText, lstrlen( dat->szQuickSearch ), prcItem, uTextFormat ); } } else if ( Drawing->type == CLCIT_CONTACT ) @@ -3040,7 +3040,7 @@ void CLCPaint::_DrawContactText( HDC hdcMem, ClcData *dat, ClcContact *Drawing, text_size.cy = _rcHeight( prcItem ); uTextFormat |= DT_VCENTER; //get font - _DrawTextSmiley( hdcMem, prcItem, &text_size, Drawing->szText, 0, -1, Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); + _DrawTextSmiley(hdcMem, prcItem, &text_size, Drawing->szText, 0, -1, Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); if ( (dat->filterSearch || selected) && dat->szQuickSearch[0] != '\0' ) { int idx = 0; @@ -3051,13 +3051,13 @@ void CLCPaint::_DrawContactText( HDC hdcMem, ClcData *dat, ClcContact *Drawing, if (p1) idx = int(p1 - lowered); } - SetTextColor( hdcMem, dat->quickSearchColour ); - _DrawTextSmiley( hdcMem, prcItem, &text_size, Drawing->szText, idx, lstrlen( dat->szQuickSearch ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); + SetTextColor(hdcMem, dat->quickSearchColour ); + _DrawTextSmiley(hdcMem, prcItem, &text_size, Drawing->szText, idx, lstrlen( dat->szQuickSearch ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys ); } } else { - ske_DrawText( hdcMem, Drawing->szText, -1, prcItem, uTextFormat ); + ske_DrawText(hdcMem, Drawing->szText, -1, prcItem, uTextFormat ); } text_rc.right = max( text_rc.right, prcItem->right ); text_rc.left = min( text_rc.left, prcItem->left ); @@ -3071,13 +3071,13 @@ void CLCPaint::_DrawContactSubText( HDC hdcMem, ClcData *dat, ClcContact *Drawin // Has to draw the count? if ( szCounts && szCounts[0] ) { - ChangeToFont( hdcMem, dat, Drawing->group->expanded?FONTID_OPENGROUPCOUNTS:FONTID_CLOSEDGROUPCOUNTS, NULL ); + ChangeToFont(hdcMem, dat, Drawing->group->expanded?FONTID_OPENGROUPCOUNTS:FONTID_CLOSEDGROUPCOUNTS, NULL ); if ( selected ) - SetTextColor( hdcMem, dat->selTextColour ); + SetTextColor(hdcMem, dat->selTextColour ); else if ( hottrack ) - _SetHotTrackColour( hdcMem, dat ); - ske_DrawTextA( hdcMem, szCounts, -1, prcItem, uTextFormat ); - ske_ResetTextEffect( hdcMem ); + _SetHotTrackColour(hdcMem, dat ); + ske_DrawTextA(hdcMem, szCounts, -1, prcItem, uTextFormat ); + ske_ResetTextEffect(hdcMem ); } } else if ( Drawing->type == CLCIT_CONTACT ) @@ -3085,17 +3085,17 @@ void CLCPaint::_DrawContactSubText( HDC hdcMem, ClcData *dat, ClcContact *Drawin SIZE text_size = { _rcWidth( prcItem ), _rcHeight( prcItem ) }; ClcCacheEntry *pdnce = (Drawing->type == CLCIT_CONTACT) ? pcli->pfnGetCacheEntry(Drawing->hContact) : NULL; if ( pdnce ) { - ChangeToFont( hdcMem, dat, itemType == CIT_SUBTEXT1 ? FONTID_SECONDLINE : FONTID_THIRDLINE, NULL ); + ChangeToFont(hdcMem, dat, itemType == CIT_SUBTEXT1 ? FONTID_SECONDLINE : FONTID_THIRDLINE, NULL ); //draw second and third line if ( selected ) - SetTextColor( hdcMem, dat->selTextColour ); + SetTextColor(hdcMem, dat->selTextColour ); else if ( hottrack ) - _SetHotTrackColour( hdcMem, dat ); + _SetHotTrackColour(hdcMem, dat ); uTextFormat |= DT_VCENTER; if ( itemType == CIT_SUBTEXT1 ) - _DrawTextSmiley( hdcMem, prcItem, &text_size, pdnce->szSecondLineText, 0, -1, pdnce->ssSecondLine.plText, uTextFormat, dat->text_resize_smileys ); + _DrawTextSmiley(hdcMem, prcItem, &text_size, pdnce->szSecondLineText, 0, -1, pdnce->ssSecondLine.plText, uTextFormat, dat->text_resize_smileys ); else - _DrawTextSmiley( hdcMem, prcItem, &text_size, pdnce->szThirdLineText, 0, -1, pdnce->ssThirdLine.plText, uTextFormat, dat->text_resize_smileys ); + _DrawTextSmiley(hdcMem, prcItem, &text_size, pdnce->szThirdLineText, 0, -1, pdnce->ssThirdLine.plText, uTextFormat, dat->text_resize_smileys ); } } text_rc.right = max( text_rc.right, prcItem->right ); @@ -3111,8 +3111,8 @@ void CLCPaint::_DrawContactTime( HDC hdcMem, ClcData *dat, ClcContact *Drawing, if ( !tmi.printDateTime(pdnce->hTimeZone, _T("t"), szResult, SIZEOF(szResult), 0)) { // Select font - ChangeToFont( hdcMem, dat, FONTID_CONTACT_TIME, NULL ); - ske_DrawText( hdcMem, szResult, lstrlen( szResult ), prcItem, DT_NOPREFIX | DT_SINGLELINE ); + ChangeToFont(hdcMem, dat, FONTID_CONTACT_TIME, NULL ); + ske_DrawText(hdcMem, szResult, lstrlen( szResult ), prcItem, DT_NOPREFIX | DT_SINGLELINE ); } } @@ -3121,9 +3121,9 @@ void CLCPaint::_DrawContactSelection( HDC hdcMem, ClcData *dat, ClcContact *Draw // Selection background if (( selected || hottrack ) && dat->HiLightMode == 0) { if ( selected ) - SkinDrawGlyph( hdcMem, prcItem, rcPaint, "Contact List/Selection"); + SkinDrawGlyph(hdcMem, prcItem, rcPaint, "Contact List/Selection"); else if ( hottrack ) - SkinDrawGlyph( hdcMem, prcItem, rcPaint, "Contact List/HotTracking"); + SkinDrawGlyph(hdcMem, prcItem, rcPaint, "Contact List/HotTracking"); } } @@ -3165,8 +3165,8 @@ void CLCPaint::_DrawContactLine( HDC hdcMem, ClcData *dat, ClcContact *Drawing, if ( rc1.right-rc1.left >= 6 && !IsRectEmpty( &rc1 )) { - DrawEdge( hdcMem, &rc1, BDR_SUNKENOUTER, BF_RECT ); - ske_SetRectOpaque( hdcMem, &rc1 ); + DrawEdge(hdcMem, &rc1, BDR_SUNKENOUTER, BF_RECT ); + ske_SetRectOpaque(hdcMem, &rc1 ); } { RECT rcTemp = rc2; @@ -3174,8 +3174,8 @@ void CLCPaint::_DrawContactLine( HDC hdcMem, ClcData *dat, ClcContact *Drawing, } if ( rc2.right-rc2.left >= 6 && !IsRectEmpty( &rc2 )) { - DrawEdge( hdcMem, &rc2, BDR_SUNKENOUTER, BF_RECT ); - ske_SetRectOpaque( hdcMem, &rc2 ); + DrawEdge(hdcMem, &rc2, BDR_SUNKENOUTER, BF_RECT ); + ske_SetRectOpaque(hdcMem, &rc2 ); } } @@ -3202,38 +3202,38 @@ void CLCPaint::_DrawContactItems( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContac switch( Drawing->ext_mpItemsDesc[i].itemType ) { case CIT_AVATAR: - _DrawContactAvatar( hdcMem, dat, Drawing, row_rc, selected, hottrack, text_rc, prcItem ); + _DrawContactAvatar(hdcMem, dat, Drawing, row_rc, selected, hottrack, text_rc, prcItem ); break; case CIT_ICON: - _DrawContactIcon( hdcMem, dat, Drawing, selected, hottrack, text_rc, prcItem ); + _DrawContactIcon(hdcMem, dat, Drawing, selected, hottrack, text_rc, prcItem ); break; case CIT_TEXT: - _DrawContactText( hdcMem, dat, Drawing, selected, hottrack, text_rc, prcItem, uTextFormat ); + _DrawContactText(hdcMem, dat, Drawing, selected, hottrack, text_rc, prcItem, uTextFormat ); break; case CIT_SUBTEXT1: case CIT_SUBTEXT2: - _DrawContactSubText( hdcMem, dat, Drawing, selected, hottrack, text_rc, prcItem, uTextFormat, Drawing->ext_mpItemsDesc[i].itemType ); + _DrawContactSubText(hdcMem, dat, Drawing, selected, hottrack, text_rc, prcItem, uTextFormat, Drawing->ext_mpItemsDesc[i].itemType ); break; case CIT_TIME: - _DrawContactTime( hdcMem, dat, Drawing, selected, hottrack, text_rc, prcItem ); + _DrawContactTime(hdcMem, dat, Drawing, selected, hottrack, text_rc, prcItem ); break; case CIT_CHECKBOX: //_DrawNothing no check boxes in skinned mode break; //other here case CIT_SELECTION: - _DrawContactSelection( hdcMem, dat, Drawing, selected, hottrack, rcPaint, prcItem ); + _DrawContactSelection(hdcMem, dat, Drawing, selected, hottrack, rcPaint, prcItem ); break; default: if ( Drawing->ext_mpItemsDesc[i].itemType&CIT_EXTRA ) - _DrawContactExtraIcon( hdcMem, dat, Drawing, selected, hottrack, text_rc, prcItem, Drawing->ext_mpItemsDesc[i].itemType&0x3F ); + _DrawContactExtraIcon(hdcMem, dat, Drawing, selected, hottrack, text_rc, prcItem, Drawing->ext_mpItemsDesc[i].itemType&0x3F ); break; } } } if (( Drawing->type == CLCIT_GROUP && dat->exStyle&CLS_EX_LINEWITHGROUPS ) || ( Drawing->type == CLCIT_DIVIDER )) - _DrawContactLine( hdcMem, dat, Drawing, free_row_rc, rcPaint, text_rc ); + _DrawContactLine(hdcMem, dat, Drawing, free_row_rc, rcPaint, text_rc ); } void CLCPaint::_PaintRowItems ( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT row_rc, RECT free_row_rc, int left_pos, int right_pos, int selected, int hottrack, RECT *rcPaint ) { @@ -3241,13 +3241,13 @@ void CLCPaint::_PaintRowItems ( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact if ( gl_RowRoot && ( dat->hWnd == pcli->hwndContactTree )) { _PaintRowItemsEx( hwnd, hdcMem, dat, Drawing, row_rc, free_row_rc, left_pos, right_pos, selected, hottrack, rcPaint ); - ske_ResetTextEffect( hdcMem ); + ske_ResetTextEffect(hdcMem ); return; } //END OFF Extended LAYOUT if ( !Drawing->ext_fItemsValid ) _CalcItemsPos( hwnd, hdcMem, dat, Drawing, &row_rc, &free_row_rc, left_pos, right_pos, selected, hottrack ); _DrawContactItems( hwnd, hdcMem, dat, Drawing, &row_rc, &free_row_rc, left_pos, right_pos, selected, hottrack, rcPaint ); - ske_ResetTextEffect( hdcMem ); + ske_ResetTextEffect(hdcMem ); } /* TODO Render items diff --git a/plugins/Clist_modern/src/modern_clisttray.cpp b/plugins/Clist_modern/src/modern_clisttray.cpp index a5ff7ee804..7d463c2307 100644 --- a/plugins/Clist_modern/src/modern_clisttray.cpp +++ b/plugins/Clist_modern/src/modern_clisttray.cpp @@ -97,7 +97,7 @@ INT_PTR CListTray_GetGlobalStatus(WPARAM wparam,LPARAM lparam) int curstatus = 0; int i; int connectingCount = 0; - for (i=0;i < pcli->hClcProtoCount;i++) + for (i=0; i < pcli->hClcProtoCount; i++) { if ( !pcli->pfnGetProtocolVisibility(pcli->clcProto[i].szProto)) continue; if (pcli->clcProto[i].dwStatus >= ID_STATUS_CONNECTING && diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index 0081ff777d..ea52ee2b54 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -1763,7 +1763,7 @@ LRESULT CLUI::OnSizingMoving(UINT msg, WPARAM wParam, LPARAM lParam) //reposition buttons and new size applying { ModernSkinButton_ReposButtons( m_hWnd, SBRF_DO_NOT_DRAW, &work_rect ); - ske_PrepeareImageButDontUpdateIt(&work_rect); + ske_PrepareImageButDontUpdateIt(&work_rect); g_CluiData.mutexPreventDockMoving = 0; ske_UpdateWindowImageRect(&work_rect); EndDeferWindowPos(PosBatch); diff --git a/plugins/Clist_modern/src/modern_cluiframes.cpp b/plugins/Clist_modern/src/modern_cluiframes.cpp index 45bd5f9ee0..68d10d9549 100644 --- a/plugins/Clist_modern/src/modern_cluiframes.cpp +++ b/plugins/Clist_modern/src/modern_cluiframes.cpp @@ -110,7 +110,7 @@ int CLUIFrames_OnMoving( HWND hwnd, RECT *r) { int i; g_CluiData.mutexPreventDockMoving = 0; - for (i=0;i < g_nFramesCount;i++) { + for (i=0; i < g_nFramesCount; i++) { if ( !g_pfwFrames[i].floating && g_pfwFrames[i].OwnerWindow != NULL && g_pfwFrames[i].OwnerWindow != (HWND)-2) { @@ -140,7 +140,7 @@ int SetAlpha(BYTE Alpha) { int i; - for (i=0;i < g_nFramesCount;i++) { + for (i=0; i < g_nFramesCount; i++) { if ( !g_pfwFrames[i].floating && g_pfwFrames[i].OwnerWindow != NULL && g_pfwFrames[i].OwnerWindow != (HWND)-2 && g_pfwFrames[i].visible && !g_pfwFrames[i].needhide ) { @@ -174,7 +174,7 @@ int SetAlpha(BYTE Alpha) int CLUIFrames_RepaintSubContainers() { int i; - for (i=0;i < g_nFramesCount;i++) + for (i=0; i < g_nFramesCount; i++) if ( !g_pfwFrames[i].floating && g_pfwFrames[i].OwnerWindow != (HWND)0 && g_pfwFrames[i].OwnerWindow != (HWND)-2 && g_pfwFrames[i].visible && !g_pfwFrames[i].needhide ) { RedrawWindow(g_pfwFrames[i].hWnd,NULL,NULL,RDW_ALLCHILDREN|RDW_UPDATENOW|RDW_INVALIDATE|RDW_FRAME); @@ -185,7 +185,7 @@ int CLUIFrames_RepaintSubContainers() int CLUIFrames_ActivateSubContainers( BOOL active) { int i; - for (i=0;i < g_nFramesCount;i++) + for (i=0; i < g_nFramesCount; i++) if (active && !g_pfwFrames[i].floating && g_pfwFrames[i].OwnerWindow != (HWND)0 && g_pfwFrames[i].OwnerWindow != (HWND)-2 && g_pfwFrames[i].visible && !g_pfwFrames[i].needhide ) { if ( db_get_b(NULL,"CList","OnDesktop",SETTING_ONDESKTOP_DEFAULT)) @@ -204,7 +204,7 @@ int CLUIFrames_SetParentForContainers( HWND parent ) g_CluiData.fOnDesktop = 1; else g_CluiData.fOnDesktop = 0; - for (i=0;i < g_nFramesCount;i++) { + for (i=0; i < g_nFramesCount; i++) { if ( !g_pfwFrames[i].floating && g_pfwFrames[i].OwnerWindow != (HWND)0 && g_pfwFrames[i].OwnerWindow != (HWND)-2 && g_pfwFrames[i].visible && !g_pfwFrames[i].needhide ) { HWND hwnd = g_pfwFrames[i].OwnerWindow; @@ -218,7 +218,7 @@ int CLUIFrames_OnShowHide( HWND hwnd, int mode ) { int i; int prevFrameCount; - for (i=0;i < g_nFramesCount;i++) { + for (i=0; i < g_nFramesCount; i++) { if ( !g_pfwFrames[i].floating && g_pfwFrames[i].OwnerWindow != (HWND)0 && g_pfwFrames[i].OwnerWindow != (HWND)-2) { { @@ -261,7 +261,7 @@ static int id2pos(int id) { int i; if (_fCluiFramesModuleNotStarted) return -1; - for (i=0;i < g_nFramesCount;i++) + for (i=0; i < g_nFramesCount; i++) if (g_pfwFrames[i].id == id) return(i); return(-1); }; @@ -279,7 +279,7 @@ static FRAMEWND* FindFrameByWnd( HWND hwnd ) if ( hwnd == NULL ) return( NULL ); - for (i=0;i < g_nFramesCount;i++) + for (i=0; i < g_nFramesCount; i++) if ((g_pfwFrames[i].floating) && (g_pfwFrames[i].ContainerWnd == hwnd)) return(&g_pfwFrames[i]); @@ -290,7 +290,7 @@ static FRAMEWND* FindFrameByWnd( HWND hwnd ) int QueueAllFramesUpdating(BYTE queue) { int i; - for (i=0;i < g_nFramesCount;i++) + for (i=0; i < g_nFramesCount; i++) { if ( !g_CluiData.fLayered) { @@ -326,7 +326,7 @@ FRAMEWND * FindFrameByItsHWND(HWND FrameHwnd) { int i; if ( FrameHwnd == NULL ) return( NULL ); - for (i=0;i < g_nFramesCount;i++) + for (i=0; i < g_nFramesCount; i++) { if (g_pfwFrames[i].hWnd == FrameHwnd){return(&g_pfwFrames[i]);}; }; @@ -784,7 +784,7 @@ static int CLUIFramesStoreAllFrames() { int i; if (_fCluiFramesModuleNotStarted) return -1; - for (i=0;i < g_nFramesCount;i++) + for (i=0; i < g_nFramesCount; i++) CLUIFramesStoreFrameSettings(i); return 0; } @@ -804,7 +804,7 @@ static int CLUIFramesGetalClientFrame(void) } } - for (i=0;i < g_nFramesCount;i++) + for (i=0; i < g_nFramesCount; i++) if (g_pfwFrames[i].align == alClient) { _nClientFrameId = i; return i; @@ -1356,7 +1356,7 @@ static int _us_DoShowAllFrames(WPARAM wParam,LPARAM lParam) if (_fCluiFramesModuleNotStarted) return -1; - for (i=0;i < g_nFramesCount;i++) + for (i=0; i < g_nFramesCount; i++) g_pfwFrames[i].visible = TRUE; CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,0); return 0; @@ -1369,7 +1369,7 @@ static int _us_DoShowTitles(WPARAM wParam,LPARAM lParam) if (_fCluiFramesModuleNotStarted) return -1; - for (i=0;i < g_nFramesCount;i++) + for (i=0; i < g_nFramesCount; i++) g_pfwFrames[i].TitleBar.ShowTitleBar = TRUE; CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,0); return 0; @@ -1382,7 +1382,7 @@ static int _us_DoHideTitles(WPARAM wParam,LPARAM lParam) if (_fCluiFramesModuleNotStarted) return -1; - for (i=0;i < g_nFramesCount;i++) + for (i=0; i < g_nFramesCount; i++) g_pfwFrames[i].TitleBar.ShowTitleBar = FALSE; CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,0); return 0; @@ -1447,7 +1447,7 @@ static int _us_DoMoveFrame(WPARAM wParam,LPARAM lParam) v = 0; sd = (SortData*)malloc(sizeof(SortData)*g_nFramesCount); memset(sd, 0, sizeof(SortData)*g_nFramesCount); - for (i=0;i < g_nFramesCount;i++) + for (i=0; i < g_nFramesCount; i++) { if (g_pfwFrames[i].floating || (!g_pfwFrames[i].visible) || (g_pfwFrames[i].align != curalign)){continue;}; @@ -1457,9 +1457,9 @@ static int _us_DoMoveFrame(WPARAM wParam,LPARAM lParam) }; if (v == 0){return 0;}; qsort(sd,v,sizeof(SortData),sortfunc); - for (i=0;i < v;i++) + for (i=0; i < v; i++) g_pfwFrames[sd[i].realpos].order = i+1; //to be sure that order is incremental - for (i=0;i < v;i++) { + for (i=0; i < v; i++) { if (sd[i].realpos == pos) { if (lParam == -1) { if (i >= v-1) break; @@ -1646,7 +1646,7 @@ static int _us_DoCollapseFrame(WPARAM wParam,LPARAM lParam) }else { int i,sumheight = 0; - for (i=0;i < g_nFramesCount;i++) { + for (i=0; i < g_nFramesCount; i++) { if ((g_pfwFrames[i].align != alClient) && (!g_pfwFrames[i].floating) && (g_pfwFrames[i].visible) && (!g_pfwFrames[i].needhide)) { sumheight += (g_pfwFrames[i].height)+(g_nTitleBarHeight*btoint(g_pfwFrames[i].TitleBar.ShowTitleBar))+2; return FALSE; @@ -2096,7 +2096,7 @@ static BOOL CLUIFramesFitInSize(void) if (clientfrm != -1) tbh = g_nTitleBarHeight*btoint(g_pfwFrames[clientfrm].TitleBar.ShowTitleBar); - for (i=0;i < g_nFramesCount;i++) { + for (i=0; i < g_nFramesCount; i++) { if ((g_pfwFrames[i].align != alClient) && (!g_pfwFrames[i].floating) && (g_pfwFrames[i].visible) && (!g_pfwFrames[i].needhide)) { sumheight += (g_pfwFrames[i].height)+(g_nTitleBarHeight*btoint(g_pfwFrames[i].TitleBar.ShowTitleBar))+2/*+btoint(Frames[i].UseBorder)*2*/; if (sumheight>_nContactListHeight-tbh-2) @@ -2118,7 +2118,7 @@ int CLUIFrames_GetTotalHeight() RECT border; if (pcli->hwndContactList == NULL) return 0; - for (i=0;i < g_nFramesCount;i++) + for (i=0; i < g_nFramesCount; i++) { if ((g_pfwFrames[i].visible) && (!g_pfwFrames[i].needhide) && (!g_pfwFrames[i].floating) && (pcli->hwndContactTree) && (g_pfwFrames[i].hWnd != pcli->hwndContactTree)) sumheight += (g_pfwFrames[i].height)+(g_nTitleBarHeight*btoint(g_pfwFrames[i].TitleBar.ShowTitleBar)); @@ -2153,7 +2153,7 @@ int CLUIFramesGetMinHeight() if (clientfrm != -1) tbh = g_nTitleBarHeight*btoint(g_pfwFrames[clientfrm].TitleBar.ShowTitleBar); - for (i=0;i < g_nFramesCount;i++) + for (i=0; i < g_nFramesCount; i++) { if ((g_pfwFrames[i].align != alClient) && (g_pfwFrames[i].visible) && (!g_pfwFrames[i].needhide) && (!g_pfwFrames[i].floating)) { @@ -2208,7 +2208,7 @@ static int CLUIFramesResizeFrames(const RECT newsize) if (clientfrm != -1) tbh = (g_nTitleBarHeight+g_CluiData.nGapBetweenTitlebar)*btoint(g_pfwFrames[clientfrm].TitleBar.ShowTitleBar); - for (i=0;i < g_nFramesCount;i++) + for (i=0; i < g_nFramesCount; i++) { if ( !g_pfwFrames[i].floating) { @@ -2222,7 +2222,7 @@ static int CLUIFramesResizeFrames(const RECT newsize) //sorting stuff sdarray = (SortData*)malloc(sizeof(SortData)*g_nFramesCount); if (sdarray == NULL){return(-1);}; - for (i=0;i < g_nFramesCount;i++) + for (i=0; i < g_nFramesCount; i++) {sdarray[i].order = g_pfwFrames[i].order; sdarray[i].realpos = i; }; @@ -2235,7 +2235,7 @@ static int CLUIFramesResizeFrames(const RECT newsize) while(sumheight>(newheight-tbh) && drawitems>0) { sumheight = 0; drawitems = 0; - for (i=0;i < g_nFramesCount;i++) { + for (i=0; i < g_nFramesCount; i++) { if (((g_pfwFrames[i].align != alClient)) && (!g_pfwFrames[i].floating) && (g_pfwFrames[i].visible) && (!g_pfwFrames[i].needhide)) { drawitems++; curfrmtbh = (g_nTitleBarHeight+g_CluiData.nGapBetweenTitlebar)*btoint(g_pfwFrames[i].TitleBar.ShowTitleBar); @@ -2311,7 +2311,7 @@ static int CLUIFramesResizeFrames(const RECT newsize) } } } - for (i=0;i < g_nFramesCount;i++) + for (i=0; i < g_nFramesCount; i++) if (g_pfwFrames[i].TitleBar.ShowTitleBar) SetRect(&g_pfwFrames[i].TitleBar.wndSize,g_pfwFrames[i].wndSize.left,g_pfwFrames[i].wndSize.top-g_nTitleBarHeight-g_CluiData.nGapBetweenTitlebar,g_pfwFrames[i].wndSize.right,g_pfwFrames[i].wndSize.top-g_CluiData.nGapBetweenTitlebar); if (sdarray != NULL){free(sdarray);sdarray = NULL;}; @@ -2324,7 +2324,7 @@ static int CLUIFramesResizeFrames(const RECT newsize) static int SizeMoveNewSizes() { int i; - for (i=0;i < g_nFramesCount;i++) + for (i=0; i < g_nFramesCount; i++) { if (g_pfwFrames[i].floating){ @@ -2348,7 +2348,7 @@ int CLUIFrames_ApplyNewSizes(int mode) { int i; g_CluiData.mutexPreventDockMoving = 0; - for (i=0;i < g_nFramesCount;i++) { + for (i=0; i < g_nFramesCount; i++) { if ((mode == 1 && g_pfwFrames[i].OwnerWindow != (HWND)-2 && g_pfwFrames[i].OwnerWindow) || (mode == 2 && g_pfwFrames[i].OwnerWindow == (HWND)-2) || (mode == 3)) @@ -2428,7 +2428,7 @@ int SizeFramesByWindowRect(RECT *r, HDWP * PosBatch, int mode) CLUIFramesResizeFrames(nRect); { int i; - for (i=0;i < g_nFramesCount;i++) + for (i=0; i < g_nFramesCount; i++) { int dx; int dy; @@ -2505,7 +2505,7 @@ int CheckFramesPos(RECT *wr) g_CluiData.nGapBetweenTitlebar = (int)db_get_dw(NULL,"CLUIFrames","GapBetweenTitleBar",SETTING_GAPTITLEBAR_DEFAULT); GapBetweenFrames = db_get_dw(NULL,"CLUIFrames","GapBetweenFrames",SETTING_GAPFRAMES_DEFAULT); - for (i=0;i < g_nFramesCount;i++) + for (i=0; i < g_nFramesCount; i++) { int dx; int dy; @@ -3920,7 +3920,7 @@ int UnLoadCLUIFramesModule(void) UnitFramesMenu(); UnloadMainMenu(); - for (i=0;i < g_nFramesCount;i++) + for (i=0; i < g_nFramesCount; i++) { if (g_pfwFrames[i].hWnd != pcli->hwndContactTree) DestroyWindow(g_pfwFrames[i].hWnd); @@ -3972,7 +3972,7 @@ static int _us_DoSetFramePaintProc(WPARAM wParam, LPARAM lParam) int CLUIFrames_SetLayeredMode( BOOL fLayeredMode, HWND hwnd ) { int i; - for (i=0;i < g_nFramesCount;i++) + for (i=0; i < g_nFramesCount; i++) { if (fLayeredMode) { diff --git a/plugins/Clist_modern/src/modern_contact.cpp b/plugins/Clist_modern/src/modern_contact.cpp index 52eeef32fc..fdf0191a84 100644 --- a/plugins/Clist_modern/src/modern_contact.cpp +++ b/plugins/Clist_modern/src/modern_contact.cpp @@ -54,7 +54,7 @@ void cli_ChangeContactIcon(HANDLE hContact,int iIcon,int add) static int GetStatusModeOrdering(int statusMode) { int i; - for (i=0;i < SIZEOF(statusModeOrder);i++) + for (i=0; i < SIZEOF(statusModeOrder); i++) if (statusModeOrder[i].m_cache_nStatus == statusMode) return statusModeOrder[i].order; return 1000; } diff --git a/plugins/Clist_modern/src/modern_newrowopts.cpp b/plugins/Clist_modern/src/modern_newrowopts.cpp index 79d6b8be58..15bb235bea 100644 --- a/plugins/Clist_modern/src/modern_newrowopts.cpp +++ b/plugins/Clist_modern/src/modern_newrowopts.cpp @@ -124,7 +124,7 @@ void TraceTreeLevel(NodeList * node) TRACE(buf); } ident += 5; - for (i=0; i < node->AllocatedChilds;i++) + for (i=0; i < node->AllocatedChilds; i++) { if (node->childNodes[i].AllocatedChilds>0) diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp index cba4682996..9bef1bb2b5 100644 --- a/plugins/Clist_modern/src/modern_skinengine.cpp +++ b/plugins/Clist_modern/src/modern_skinengine.cpp @@ -40,35 +40,35 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /* Global variables */ SKINOBJECTSLIST g_SkinObjectList = {0}; -CURRWNDIMAGEDATA * g_pCachedWindow = NULL; +CURRWNDIMAGEDATA *g_pCachedWindow = NULL; -BOOL g_flag_bPostWasCanceled = FALSE; -BOOL g_flag_bFullRepaint = FALSE; -BOOL g_mutex_bLockUpdating = FALSE; +BOOL g_flag_bPostWasCanceled = FALSE; +BOOL g_flag_bFullRepaint = FALSE; +BOOL g_mutex_bLockUpdating = FALSE; -SortedList * gl_plGlyphTexts = NULL; -SortedList * gl_plSkinFonts = NULL; +SortedList *gl_plGlyphTexts = NULL; +SortedList *gl_plSkinFonts = NULL; /* Private module variables */ static HANDLE hSkinLoadedEvent; -static GLYPHIMAGE * pLoadedImages = NULL; -static DWORD dwLoadedImagesCount = 0; -static DWORD dwLoadedImagesAlocated = 0; +static GLYPHIMAGE *pLoadedImages = NULL; +static DWORD dwLoadedImagesCount = 0; +static DWORD dwLoadedImagesAlocated = 0; static BOOL flag_bUpdateQueued = FALSE; static BOOL flag_bJustDrawNonFramedObjects = FALSE; static BOOL mutex_bLockUpdate = FALSE; -static SortedList * pEffectStack = NULL; -static SKINOBJECTSLIST * pCurrentSkin = NULL; -static char ** pszSettingName = NULL; -static int nArrayLen = 0; +static LIST arEffectStack(10, HandleKeySortT); +static SKINOBJECTSLIST *pCurrentSkin = NULL; +static char **pszSettingName = NULL; +static int nArrayLen = 0; -static BYTE pbGammaWeight[256] = {0}; -static BYTE pbGammaWeightAdv[256] = {0}; -static BOOL bGammaWeightFilled = FALSE; +static BYTE pbGammaWeight[256] = {0}; +static BYTE pbGammaWeightAdv[256] = {0}; +static BOOL bGammaWeightFilled = FALSE; static CRITICAL_SECTION cs_SkinChanging = {0}; @@ -98,39 +98,39 @@ static MODERNEFFECT meCurrentEffect = {-1,{0}, 0, 0}; ////////////////////////////////////////////////////////////////////////// // Ini file parser ////////////////////////////////////////////////////////////////////////// -IniParser::IniParser( TCHAR * tcsFileName, BYTE flags ) : _Flags( flags ) +IniParser::IniParser(TCHAR * tcsFileName, BYTE flags) : _Flags(flags) { _DoInit(); - if ( !tcsFileName ) return; + if (!tcsFileName) return; - if ( tcsFileName[0] == _T('%')) + if (tcsFileName[0] == _T('%')) { //TODO: Add parser of resource filename here - _LoadResourceIni( g_hInst, MAKEINTRESOURCEA(IDR_MSF_DEFAULT_SKIN), "MSF"); + _LoadResourceIni(g_hInst, MAKEINTRESOURCEA(IDR_MSF_DEFAULT_SKIN), "MSF"); return; } - _hFile = _tfopen( tcsFileName, _T("r")); + _hFile = _tfopen(tcsFileName, _T("r")); - if ( _hFile != NULL ) + if (_hFile != NULL) { _eType = IT_FILE; _isValid = true; } } -IniParser::IniParser( HINSTANCE hInst, const char * resourceName, const char * resourceType, BYTE flags ) : _Flags( flags ) +IniParser::IniParser(HINSTANCE hInst, const char * resourceName, const char * resourceType, BYTE flags) : _Flags(flags) { _DoInit(); - _LoadResourceIni( hInst, resourceName, resourceType ); + _LoadResourceIni(hInst, resourceName, resourceType); } IniParser::~IniParser() { - mir_free( _szSection ); - if ( _hFile ) fclose( _hFile ); - if ( _hGlobalRes ) { - UnlockResource( _hGlobalRes ); + mir_free(_szSection); + if (_hFile) fclose(_hFile); + if (_hGlobalRes) { + UnlockResource(_hGlobalRes); FreeResource(_hGlobalRes); } @@ -141,14 +141,13 @@ IniParser::~IniParser() _eType = IT_UNKNOWN; } -HRESULT IniParser::Parse( ParserCallback_t pLineCallBackProc, LPARAM SecCheck ) +HRESULT IniParser::Parse(ParserCallback_t pLineCallBackProc, LPARAM SecCheck) { - if ( _isValid && pLineCallBackProc ) + if (_isValid && pLineCallBackProc) { _pLineCallBackProc = pLineCallBackProc; _SecCheck = SecCheck; - switch ( _eType ) - { + switch (_eType) { case IT_FILE: return _DoParseFile(); case IT_RESOURCE: @@ -158,47 +157,40 @@ HRESULT IniParser::Parse( ParserCallback_t pLineCallBackProc, LPARAM SecCheck ) return E_FAIL; } - HRESULT IniParser::WriteStrToDb( const char * szSection, const char * szName, const char * szValue, IniParser * This ) { - if ( This->_SecCheck) - { + if ( This->_SecCheck) { //TODO check security here - if ( wildcmp( szSection,"Skin_Description_Section")) return S_OK; + if ( wildcmp( szSection,"Skin_Description_Section")) + return S_OK; } if (( This->_Flags == IniParser::FLAG_ONLY_OBJECTS ) && !wildcmp( szSection, DEFAULTSKINSECTION)) return S_OK; // skip not objects - -// if ( strlen(szValue)>0 && szValue[strlen(szValue)-1] == '\n' ) -// szValue[strlen(szValue)-1] = '\0'; //kill linefeed at the end - - switch(szValue[0]) { + switch (szValue[0]) { case 'b': - db_set_b(NULL, szSection, szName, (BYTE)atoi(szValue+1)); + db_set_b(NULL, szSection, szName, (BYTE)atoi(szValue + 1)); break; case 'w': - db_set_w(NULL, szSection, szName, (WORD)atoi(szValue+1)); + db_set_w(NULL, szSection, szName, (WORD)atoi(szValue + 1)); break; case 'd': - db_set_dw(NULL, szSection, szName, (DWORD)atoi(szValue+1)); + db_set_dw(NULL, szSection, szName, (DWORD)atoi(szValue + 1)); break; case 's': - db_set_s(NULL,szSection,szName,szValue+1); + db_set_s(NULL, szSection, szName, szValue + 1); break; } return S_OK; } + int IniParser::GetSkinFolder( IN const TCHAR * szFileName, OUT TCHAR * pszFolderName ) { - TCHAR *pszPos; - TCHAR *szBuff; - - szBuff = mir_tstrdup( szFileName ); - pszPos = szBuff + _tcslen( szBuff ); + TCHAR *szBuff = mir_tstrdup(szFileName); + TCHAR *pszPos = szBuff + _tcslen(szBuff); while ( pszPos > szBuff && *pszPos != _T('.')) { pszPos--; } *pszPos = _T('\0'); _tcscpy( pszFolderName, szBuff ); @@ -222,54 +214,49 @@ int IniParser::GetSkinFolder( IN const TCHAR * szFileName, OUT TCHAR * pszFolder void IniParser::_DoInit() { - _isValid = false; - _eType = IT_UNKNOWN; - _szSection = NULL; - _hFile = NULL; - _hGlobalRes = NULL; + _isValid = false; + _eType = IT_UNKNOWN; + _szSection = NULL; + _hFile = NULL; + _hGlobalRes = NULL; _dwSizeOfRes = 0; - _pPosition = NULL; + _pPosition = NULL; _pLineCallBackProc = NULL; - _SecCheck = 0; - + _SecCheck = 0; } void IniParser::_LoadResourceIni( HINSTANCE hInst, const char * resourceName, const char * resourceType ) { + if (_eType != IT_UNKNOWN) + return; - if ( _eType != IT_UNKNOWN ) return; - - HRSRC hRSrc = FindResourceA( hInst, resourceName, resourceType ); - if ( !hRSrc ) return; + HRSRC hRSrc = FindResourceA(hInst, resourceName, resourceType); + if (!hRSrc) + return; - _hGlobalRes = LoadResource( hInst, hRSrc ); - if ( !_hGlobalRes ) return; + _hGlobalRes = LoadResource(hInst, hRSrc); + if (!_hGlobalRes) + return; - _dwSizeOfRes = SizeofResource( hInst, hRSrc ); - _pPosition = (char*) LockResource( _hGlobalRes ); + _dwSizeOfRes = SizeofResource(hInst, hRSrc); + _pPosition = (char*)LockResource(_hGlobalRes); _isValid = true; - _eType = IT_RESOURCE; - + _eType = IT_RESOURCE; } - - HRESULT IniParser::_DoParseFile() { char szLine[MAX_LINE_LEN]; _nLine = 0; - while ( fgets( szLine, SIZEOF(szLine), _hFile ) != NULL ) - { + while (fgets(szLine, SIZEOF(szLine), _hFile) != NULL) { size_t len = 0; - char * pLine = (char*)_RemoveTailings( szLine, len ); - if ( len > 0 ) - { + char * pLine = (char*)_RemoveTailings(szLine, len); + if (len > 0) { pLine[len] = '\0'; - if ( !_DoParseLine( pLine )) return E_FAIL; + if (!_DoParseLine(pLine)) return E_FAIL; } - else - _nLine++; + else _nLine++; }; return S_OK; @@ -279,29 +266,25 @@ HRESULT IniParser::_DoParseResource() { _nLine = 0; char szLine[MAX_LINE_LEN]; - char * pos = ( char* ) _pPosition; + char * pos = (char*)_pPosition; - while ( pos < _pPosition + _dwSizeOfRes ) - { - int i=0; - while ( pos < _pPosition + _dwSizeOfRes && *pos != '\n' && *pos != '\0' && i < MAX_LINE_LEN - 1 ) - { - if ((*pos) != '\r' ) - szLine[ i++ ] = *pos; + while (pos < _pPosition + _dwSizeOfRes) { + int i = 0; + while (pos < _pPosition + _dwSizeOfRes && *pos != '\n' && *pos != '\0' && i < MAX_LINE_LEN - 1) { + if ((*pos) != '\r') + szLine[i++] = *pos; pos++; } - szLine[ i ] = '\0'; + szLine[i] = '\0'; pos++; size_t len = 0; - char * pLine = (char*) _RemoveTailings( szLine, len ); - if ( len > 0 ) - { + char * pLine = (char*)_RemoveTailings(szLine, len); + if (len > 0) { pLine[len] = '\0'; - if ( !_DoParseLine( pLine )) return E_FAIL; + if (!_DoParseLine(pLine)) return E_FAIL; } - else - _nLine++; + else _nLine++; } return S_OK; } @@ -309,9 +292,11 @@ HRESULT IniParser::_DoParseResource() const char * IniParser::_RemoveTailings( const char * szLine, size_t& len ) { const char * pStart = szLine; - while( *pStart == ' ' || *pStart == '\t' ) pStart++; //skip spaces at begin - const char * pEnd = pStart + strlen( pStart ); - while( pEnd > pStart && ( *pEnd == ' ' || *pEnd == '\t' || *pEnd == '\n' || *pEnd == '\r' )) pEnd--; + while (*pStart == ' ' || *pStart == '\t') + pStart++; //skip spaces at begin + const char * pEnd = pStart + strlen(pStart); + while (pEnd > pStart && (*pEnd == ' ' || *pEnd == '\t' || *pEnd == '\n' || *pEnd == '\r')) + pEnd--; len = pEnd - pStart; return pStart; @@ -322,29 +307,28 @@ BOOL IniParser::_DoParseLine( char * szLine ) _nLine++; DWORD len = strlen( szLine ); - if ( len == 0 ) return TRUE; + if (len == 0) return TRUE; - switch( szLine[0] ) - { + switch( szLine[0] ) { case ';': return TRUE; // start of comment is found + case '[': + //New section start here + mir_free(_szSection); + _szSection = NULL; { - //New section start here - mir_free( _szSection ); - _szSection = NULL; - char *tbuf = szLine + 1; // skip [ char *ebuf = tbuf; - while ( *ebuf != ']' && *ebuf != '\0' ) ebuf++; - if ( *ebuf == '\0' ) + while (*ebuf != ']' && *ebuf != '\0') ebuf++; + if (*ebuf == '\0') return FALSE; // no close bracket DWORD sectionLen = ebuf - tbuf; - _szSection = (char*) mir_alloc( sectionLen + 1 ); - strncpy( _szSection, tbuf, sectionLen ); + _szSection = (char*)mir_alloc(sectionLen + 1); + strncpy(_szSection, tbuf, sectionLen); _szSection[sectionLen] = '\0'; } return TRUE; @@ -435,16 +419,10 @@ int SkinEngineUnloadModule() mir_free_and_nil(g_SkinObjectList.pMaskList); mir_free_and_nil(MainModernMaskList); - if (pEffectStack) - { - for (int i=0; i < pEffectStack->realCount; i++) - if (pEffectStack->items[i]) { - EFFECTSSTACKITEM * effect = (EFFECTSSTACKITEM*)(pEffectStack->items[i]); - mir_free(effect); - } - List_Destroy(pEffectStack); - mir_free_and_nil(pEffectStack); - } + for (int i=0; i < arEffectStack.getCount(); i++) + mir_free(arEffectStack[i]); + arEffectStack.destroy(); + if (g_pCachedWindow) { SelectObject(g_pCachedWindow->hBackDC,g_pCachedWindow->hBackOld); SelectObject(g_pCachedWindow->hImageDC,g_pCachedWindow->hImageOld); @@ -1489,7 +1467,7 @@ int ske_AddDescriptorToSkinObjectList (LPSKINOBJECTDESCRIPTOR lpDescr, SKINOBJEC if (mir_bool_strcmpi(lpDescr->szObjectID,"_HEADER_")) return 0; {//check if new object allready presents. DWORD i=0; - for (i=0; i < sk->dwObjLPAlocated;i++) + for (i=0; i < sk->dwObjLPAlocated; i++) if ( !mir_strcmp(sk->pObjects[i].szObjectID,lpDescr->szObjectID)) return 0; } if (sk->dwObjLPAlocated+1>sk->dwObjLPReserved) @@ -2253,14 +2231,13 @@ void ske_LoadSkinFromDB(void) static int ske_LoadSkinFromResource(BOOL bOnlyObjects) { - - IniParser parser(g_hInst, MAKEINTRESOURCEA(IDR_MSF_DEFAULT_SKIN), "MSF", bOnlyObjects ? IniParser::FLAG_ONLY_OBJECTS : IniParser::FLAG_WITH_SETTINGS ); - if ( !parser.CheckOK()) return 0; - - ske_DeleteAllSettingInSection("ModernSkin"); - db_set_s(NULL,SKIN,"SkinFolder","%Default%"); - db_set_s(NULL,SKIN,"SkinFile","%Default%"); - parser.Parse( IniParser::WriteStrToDb, 0 ); + IniParser parser(g_hInst, MAKEINTRESOURCEA(IDR_MSF_DEFAULT_SKIN), "MSF", bOnlyObjects ? IniParser::FLAG_ONLY_OBJECTS : IniParser::FLAG_WITH_SETTINGS); + if (parser.CheckOK()) { + ske_DeleteAllSettingInSection("ModernSkin"); + db_set_s(NULL, SKIN, "SkinFolder", "%Default%"); + db_set_s(NULL, SKIN, "SkinFile", "%Default%"); + parser.Parse(IniParser::WriteStrToDb, 0); + } return 0; } @@ -2270,8 +2247,9 @@ int ske_LoadSkinFromIniFile(TCHAR *szFileName, BOOL bOnlyObjects) if (_tcschr(szFileName,_T('%'))) return ske_LoadSkinFromResource( bOnlyObjects ); - IniParser parser( szFileName, bOnlyObjects ? IniParser::FLAG_ONLY_OBJECTS : IniParser::FLAG_WITH_SETTINGS ); - if ( !parser.CheckOK()) return 0; + IniParser parser(szFileName, bOnlyObjects ? IniParser::FLAG_ONLY_OBJECTS : IniParser::FLAG_WITH_SETTINGS); + if (!parser.CheckOK()) + return 0; ske_DeleteAllSettingInSection("ModernSkin"); @@ -2282,8 +2260,7 @@ int ske_LoadSkinFromIniFile(TCHAR *szFileName, BOOL bOnlyObjects) db_set_ts(NULL,SKIN,"SkinFolder", skinFolder); db_set_ts(NULL,SKIN,"SkinFile", skinFile); - parser.Parse( IniParser::WriteStrToDb, 1 ); - + parser.Parse(IniParser::WriteStrToDb, 1); return 0; } @@ -2293,7 +2270,7 @@ static int ske_enumdb_SkinSectionDeletionProc (const char *szSetting,LPARAM lPar return 0; nArrayLen++; - pszSettingName = (char **)realloc(pszSettingName,nArrayLen*sizeof(char *)); + pszSettingName = (char **)realloc(pszSettingName, nArrayLen*sizeof(char *)); pszSettingName[nArrayLen-1] = _strdup(szSetting); return 0; } @@ -2323,41 +2300,30 @@ static int ske_DeleteAllSettingInSection(char * SectionName) return 0; } -BOOL ske_TextOutA(HDC hdc, int x, int y, char * lpString, int nCount) -{ - TCHAR *buf = (TCHAR *)mir_alloc((2+nCount)*sizeof(TCHAR)); - BOOL res; - MultiByteToWideChar(CallService(MS_LANGPACK_GETCODEPAGE, 0, 0 ), 0, lpString, -1, buf, (2+nCount)*sizeof(TCHAR)); - res = ske_TextOut(hdc,x,y,buf,nCount); - mir_free(buf); - return res; -} - BOOL ske_TextOut(HDC hdc, int x, int y, LPCTSTR lpString, int nCount) { SIZE sz; - GetTextExtentPoint32(hdc,lpString,nCount,&sz); + GetTextExtentPoint32(hdc, lpString, nCount, &sz); int ta = GetTextAlign(hdc); - RECT rc = {0}; - SetRect(&rc,x,y,x+sz.cx,y+sz.cy); - ske_DrawText(hdc,lpString,nCount,&rc,DT_NOCLIP|DT_SINGLELINE|DT_LEFT); + RECT rc = { 0 }; + SetRect(&rc, x, y, x + sz.cx, y + sz.cy); + ske_DrawText(hdc, lpString, nCount, &rc, DT_NOCLIP | DT_SINGLELINE | DT_LEFT); return 1; } static INT_PTR ske_Service_AlphaTextOut(WPARAM wParam,LPARAM lParam) { if ( !wParam) return 0; - { - AlphaTextOutParams ap = *(AlphaTextOutParams*)wParam; - return ske_AlphaTextOut(ap.hDC,ap.lpString,ap.nCount,ap.lpRect,ap.format,ap.ARGBcolor); - } + + AlphaTextOutParams ap = *(AlphaTextOutParams*)wParam; + return ske_AlphaTextOut(ap.hDC,ap.lpString,ap.nCount,ap.lpRect,ap.format,ap.ARGBcolor); } static __inline void ske_SetMatrix( sbyte * matrix, - sbyte a, sbyte b, sbyte c, - sbyte d, sbyte e, sbyte f, - sbyte g, sbyte h, sbyte i) + sbyte a, sbyte b, sbyte c, + sbyte d, sbyte e, sbyte f, + sbyte g, sbyte h, sbyte i) { matrix[0] = a; matrix[1] = b; matrix[2] = c; matrix[3] = d; matrix[4] = e; matrix[5] = f; @@ -2366,10 +2332,9 @@ static __inline void ske_SetMatrix( sbyte * matrix, static void ske_SetTextEffect(BYTE EffectID, DWORD FirstColor, DWORD SecondColor) { - if (EffectID>MAXPREDEFINEDEFFECTS) return; + if (EffectID > MAXPREDEFINEDEFFECTS) return; if (EffectID == -1) meCurrentEffect.EffectID = -1; - else - { + else { meCurrentEffect.EffectID = EffectID; meCurrentEffect.EffectMatrix = ModernEffectsEnum[EffectID]; meCurrentEffect.EffectColor1 = FirstColor; @@ -2377,72 +2342,55 @@ static void ske_SetTextEffect(BYTE EffectID, DWORD FirstColor, DWORD SecondColor } } -BOOL ske_ResetTextEffect(HDC hdc) +bool ske_ResetTextEffect(HDC hdc) { - int i; - if ( !pEffectStack || !pEffectStack->realCount) return TRUE; - for (i=0; i < pEffectStack->realCount; i++) - if (pEffectStack->items[i] && ((EFFECTSSTACKITEM*)(pEffectStack->items[i]))->hdc == hdc) - { - EFFECTSSTACKITEM * effect = (EFFECTSSTACKITEM*)(pEffectStack->items[i]); - mir_free(effect); - List_Remove(pEffectStack,i); - return TRUE; - } - return FALSE; -}; + int idx = arEffectStack.getIndex((EFFECTSSTACKITEM*)&hdc); + if (idx == -1) + return false; -BOOL ske_SelectTextEffect(HDC hdc, BYTE EffectID, DWORD FirstColor, DWORD SecondColor) + mir_free(arEffectStack[idx]); + arEffectStack.remove(idx); + return true; +} + +bool ske_SelectTextEffect(HDC hdc, BYTE EffectID, DWORD FirstColor, DWORD SecondColor) { - if (EffectID>MAXPREDEFINEDEFFECTS) return 0; - if (EffectID == -1) return ske_ResetTextEffect(hdc); - if ( !pEffectStack) - { - pEffectStack = List_Create(0, 1); - } - { - int i; - for (i=0; i < pEffectStack->realCount; i++) - if (pEffectStack->items[i] && ((EFFECTSSTACKITEM*)(pEffectStack->items[i]))->hdc == hdc) - { - EFFECTSSTACKITEM * effect = (EFFECTSSTACKITEM*)(pEffectStack->items[i]); - effect->EffectID = EffectID; - effect->FirstColor = FirstColor; - effect->SecondColor = SecondColor; - return TRUE; - } - } - { - EFFECTSSTACKITEM * effect = (EFFECTSSTACKITEM *) mir_alloc(sizeof(EFFECTSSTACKITEM)); + if (EffectID > MAXPREDEFINEDEFFECTS) + return false; + + if (EffectID == -1) + return ske_ResetTextEffect(hdc); + + EFFECTSSTACKITEM *effect = arEffectStack.find((EFFECTSSTACKITEM*)&hdc); + if (effect == NULL) { + effect = (EFFECTSSTACKITEM *)mir_alloc(sizeof(EFFECTSSTACKITEM)); effect->hdc = hdc; - effect->EffectID = EffectID; - effect->FirstColor = FirstColor; - effect->SecondColor = SecondColor; - List_Insert(pEffectStack, effect, 0); - return TRUE; + arEffectStack.insert(effect); } - return FALSE; + + effect->EffectID = EffectID; + effect->FirstColor = FirstColor; + effect->SecondColor = SecondColor; + return true; } -static BOOL ske_GetTextEffect(HDC hdc, MODERNEFFECT * modernEffect) +static bool ske_GetTextEffect(HDC hdc, MODERNEFFECT *modernEffect) { - int i=0; - if ( !pEffectStack || !pEffectStack->realCount) return FALSE; - if ( !modernEffect) return FALSE; - for (i=0; i < pEffectStack->realCount; i++) - if (pEffectStack->items[i] && ((EFFECTSSTACKITEM*)(pEffectStack->items[i]))->hdc == hdc) - { - EFFECTSSTACKITEM * effect = (EFFECTSSTACKITEM*)(pEffectStack->items[i]); - modernEffect->EffectID = effect->EffectID; - modernEffect->EffectColor1 = effect->FirstColor; - modernEffect->EffectColor2 = effect->SecondColor; - modernEffect->EffectMatrix = ModernEffectsEnum[effect->EffectID]; - return TRUE; - } - return FALSE; + if (!modernEffect) + return false; + + EFFECTSSTACKITEM *effect = arEffectStack.find((EFFECTSSTACKITEM*)&hdc); + if (effect == NULL) + return false; + + modernEffect->EffectID = effect->EffectID; + modernEffect->EffectColor1 = effect->FirstColor; + modernEffect->EffectColor2 = effect->SecondColor; + modernEffect->EffectMatrix = ModernEffectsEnum[effect->EffectID]; + return true; } -static BOOL ske_DrawTextEffect(BYTE* destPt,BYTE* maskPt, DWORD width, DWORD height, MODERNEFFECT *effect) +static bool ske_DrawTextEffect(BYTE* destPt, BYTE* maskPt, DWORD width, DWORD height, MODERNEFFECT *effect) { sbyte *buf; sbyte *outbuf; @@ -2462,9 +2410,9 @@ static BOOL ske_DrawTextEffect(BYTE* destPt,BYTE* maskPt, DWORD width, DWORD hei int maxX = 0; int minY = height; int maxY = 0; - if (effect->EffectID == 0xFF) return FALSE; - if ( !width || ! height) return FALSE; - if ( !destPt) return FALSE; + if (effect->EffectID == 0xFF) return false; + if (!width || !height) return false; + if (!destPt) return false; buf = (sbyte*)malloc(width*height*sizeof(BYTE)); { matrix = effect->EffectMatrix.matrix; @@ -2581,12 +2529,12 @@ static BOOL ske_DrawTextEffect(BYTE* destPt,BYTE* maskPt, DWORD width, DWORD hei } free(buf); } - return FALSE; + return false; } static int ske_AlphaTextOut (HDC hDC, LPCTSTR lpString, int nCount, RECT *lpRect, UINT format, DWORD ARGBcolor) { - if ( !( lpString && lpRect )) + if (!(lpString && lpRect)) return 0; // Step first fill fast calc correction tables: @@ -2603,8 +2551,7 @@ static int ske_AlphaTextOut (HDC hDC, LPCTSTR lpString, int nCount, RECT *lpRect BYTE redCf = db_get_b(NULL,"ModernData","AlphaTextOutRed Correction", 77 ); BYTE greenCf = db_get_b(NULL,"ModernData","AlphaTextOutGreen Correction", 151 ); - for ( int i=0; i < 256; i++ ) - { + for ( int i=0; i < 256; i++ ) { gammaTbl[i] = (BYTE)( 255 * pow((double)i / 255, gammaCfPw )); blueMulTbl[i] = i * blueCf; redMulTbl[i] = i * redCf; @@ -2613,40 +2560,37 @@ static int ske_AlphaTextOut (HDC hDC, LPCTSTR lpString, int nCount, RECT *lpRect } // Calc len of input string - if ( nCount == -1 ) nCount = lstrlen( lpString ); + if (nCount == -1) + nCount = lstrlen(lpString); // retrieve destination bitmap bits - HBITMAP hDestBitmap = (HBITMAP) GetCurrentObject( hDC, OBJ_BITMAP ); + HBITMAP hDestBitmap = (HBITMAP)GetCurrentObject(hDC, OBJ_BITMAP); BITMAP bmpDest; - GetObject( hDestBitmap, sizeof(BITMAP), &bmpDest ); + GetObject(hDestBitmap, sizeof(BITMAP), &bmpDest); BOOL destHasNotDIB = FALSE; - BYTE * pDestBits = NULL; - if ( bmpDest.bmBits == NULL ) - { + BYTE *pDestBits = NULL; + if (bmpDest.bmBits == NULL) { destHasNotDIB = TRUE; pDestBits = (BYTE*) malloc ( bmpDest.bmHeight * bmpDest.bmWidthBytes ); GetBitmapBits( hDestBitmap, bmpDest.bmHeight*bmpDest.bmWidthBytes, pDestBits ); } - else - pDestBits = (BYTE*)bmpDest.bmBits; - - BOOL isDest16bit = ( bmpDest.bmBitsPixel ) != 32; + else pDestBits = (BYTE*)bmpDest.bmBits; + BOOL isDest16bit = (bmpDest.bmBitsPixel) != 32; // Creating offscreen buffer - HDC hOffscreenDC = CreateCompatibleDC( hDC ); + HDC hOffscreenDC = CreateCompatibleDC(hDC); // Font to be used to draw text - HFONT hFont = (HFONT)GetCurrentObject( hDC, OBJ_FONT); - HFONT hOldOffscreenFont = (HFONT)SelectObject( hOffscreenDC, hFont ); + HFONT hFont = (HFONT)GetCurrentObject(hDC, OBJ_FONT); + HFONT hOldOffscreenFont = (HFONT)SelectObject(hOffscreenDC, hFont); // Calculating text geometric size RECT workRect = *lpRect; - int workRectWidth = workRect.right - workRect.left; - int workRectHeight = workRect.bottom - workRect.top; - - if ( workRectWidth <= 0 || workRectHeight <= 0 ) + int workRectWidth = workRect.right - workRect.left; + int workRectHeight = workRect.bottom - workRect.top; + if (workRectWidth <= 0 || workRectHeight <= 0) return 0; SIZE textSize; @@ -2656,8 +2600,7 @@ static int ske_AlphaTextOut (HDC hDC, LPCTSTR lpString, int nCount, RECT *lpRect BOOL bNeedFreeWorkString = FALSE; // if we need to cut the text with ellipsis - if (( format&DT_END_ELLIPSIS ) && textSize.cx > workRectWidth ) - { + if ((format & DT_END_ELLIPSIS) && textSize.cx > workRectWidth) { // Calc geometric width of ellipsis SIZE szEllipsis; GetTextExtentPoint32A(hOffscreenDC,"...",3,&szEllipsis); @@ -2665,17 +2608,10 @@ static int ske_AlphaTextOut (HDC hDC, LPCTSTR lpString, int nCount, RECT *lpRect // Calc count of visible chars int visibleCharCount = nCount; - if ( workRectWidth > szEllipsis.cx) - { - GetTextExtentExPoint( hOffscreenDC, lpString, nCount, - workRectWidth - szEllipsis.cx, - &visibleCharCount, NULL, &textSize ); - } + if (workRectWidth > szEllipsis.cx) + GetTextExtentExPoint(hOffscreenDC, lpString, nCount, workRectWidth - szEllipsis.cx, &visibleCharCount, NULL, &textSize); else - { - GetTextExtentExPoint( hOffscreenDC, lpString, nCount, - 0, &visibleCharCount, NULL, &textSize); - } + GetTextExtentExPoint(hOffscreenDC, lpString, nCount, 0, &visibleCharCount, NULL, &textSize); // replace end of string by elipsis bNeedFreeWorkString = TRUE; @@ -2693,104 +2629,82 @@ static int ske_AlphaTextOut (HDC hDC, LPCTSTR lpString, int nCount, RECT *lpRect int drx = 0; // x-axis offset of draw point - if ( workRectWidth > textSize.cx ) - { + if (workRectWidth > textSize.cx) { if ( format & ( DT_RIGHT | DT_RTLREADING )) - { drx = workRectWidth - textSize.cx; - } else if ( format & DT_CENTER ) - { drx = ( workRectWidth - textSize.cx ) >> 1; - } - } - else - { - textSize.cx = workRectWidth; } + else textSize.cx = workRectWidth; int dry = 0; // y-axis offset of draw point - if ( workRectHeight > textSize.cy ) - { - if ( format & DT_BOTTOM ) - { + if (workRectHeight > textSize.cy) { + if (format & DT_BOTTOM) dry = workRectHeight - textSize.cy; - } - else if ( format & DT_VCENTER ) - { - dry = ( workRectHeight - textSize.cy ) >> 1; - } - } - else - { - textSize.cy = workRectHeight; + else if (format & DT_VCENTER) + dry = (workRectHeight - textSize.cy) >> 1; } + else textSize.cy = workRectHeight; textSize.cx += 4; // CORRECTION: for effects ??? textSize.cy += 4; // CORRECTION: for effects ??? - if ( textSize.cx > 0 && textSize.cy > 0 ) // Ok we need to paint - { + if (textSize.cx > 0 && textSize.cy > 0) { // Ok we need to paint // probably here are mess ofscreen and temp buff dc //Create bitmap image for offscreen - BYTE * bits = NULL; - HBITMAP hbmp = ske_CreateDIB32Point( textSize.cx, textSize.cy, (void**)&bits ); - if ( bits != NULL ) - { + BYTE *bits = NULL; + HBITMAP hbmp = ske_CreateDIB32Point(textSize.cx, textSize.cy, (void**)&bits); + if (bits != NULL) { HBITMAP holdbmp = (HBITMAP)SelectObject( hOffscreenDC, hbmp ); //Create buffer bitmap image for temp text - BYTE * bufbits = NULL; - HBITMAP bufbmp = ske_CreateDIB32Point( textSize.cx, textSize.cy, (void**)&bufbits ); - if ( bufbits != NULL ) - { - HDC bufDC = CreateCompatibleDC( hDC ); - HBITMAP bufoldbmp = (HBITMAP)SelectObject( bufDC, bufbmp ); - HFONT hOldBufFont = (HFONT)SelectObject( bufDC, hFont ); - SetBkColor( bufDC, RGB( 0, 0, 0 )); - SetTextColor( bufDC,RGB(255,255,255)); + BYTE *bufbits = NULL; + HBITMAP bufbmp = ske_CreateDIB32Point(textSize.cx, textSize.cy, (void**)&bufbits); + if ( bufbits != NULL ) { + HDC bufDC = CreateCompatibleDC(hDC); + HBITMAP bufoldbmp = (HBITMAP)SelectObject(bufDC, bufbmp); + HFONT hOldBufFont = (HFONT)SelectObject(bufDC, hFont); + SetBkColor(bufDC, RGB(0, 0, 0)); + SetTextColor(bufDC, RGB(255, 255, 255)); // Copy from destination to temp buffer - BitBlt( hOffscreenDC, 0, 0, textSize.cx, textSize.cy, hDC, workRect.left + drx - 2, workRect.top + dry - 2, SRCCOPY ); + BitBlt(hOffscreenDC, 0, 0, textSize.cx, textSize.cy, hDC, workRect.left + drx - 2, workRect.top + dry - 2, SRCCOPY); //Draw text on offscreen bitmap - TextOut( bufDC, 2, 2, lpWorkString, nCount); + TextOut(bufDC, 2, 2, lpWorkString, nCount); MODERNEFFECT effect; - if (ske_GetTextEffect( hDC, &effect )) - ske_DrawTextEffect( bits, bufbits, textSize.cx, textSize.cy, &effect ); + if (ske_GetTextEffect(hDC, &effect)) + ske_DrawTextEffect(bits, bufbits, textSize.cx, textSize.cy, &effect); - //RenderText + // RenderText RECT drawRect; drawRect.left = 0; drawRect.top = 0; drawRect.right = textSize.cx; drawRect.bottom = textSize.cy; - DWORD x,y; DWORD width = textSize.cx; DWORD heigh = textSize.cy; - BYTE * pDestScanLine; - BYTE * pBufScanLine; - BYTE * pix; - BYTE * bufpix; + BYTE *pDestScanLine; + BYTE *pBufScanLine; + BYTE *pix; + BYTE *bufpix; BYTE al = 255 - ((BYTE)( ARGBcolor >> 24 )); BYTE r = GetRValue( ARGBcolor ); BYTE g = GetGValue( ARGBcolor ); BYTE b = GetBValue( ARGBcolor ); - for ( y = 2; y < heigh - 2; y++ ) - { + for (DWORD y = 2; y < heigh - 2; y++) { int lineBytes = y * (width << 2); pDestScanLine = bits + lineBytes; pBufScanLine = bufbits + lineBytes; - for ( x = 2; x < width - 2; x++) - { + for (DWORD x = 2; x < width - 2; x++) { pix = pDestScanLine + ( x << 2 ); bufpix = pBufScanLine + ( x << 2 ); @@ -2799,16 +2713,14 @@ static int ske_AlphaTextOut (HDC hDC, LPCTSTR lpString, int nCount, RECT *lpRect BYTE gx = gammaTbl[ bufpix[1] ]; BYTE rx = gammaTbl[ bufpix[2] ]; - if ( al != 255 ) - { + if ( al != 255 ) { bx *= al/255; gx *= al/255; rx *= al/255; } - BYTE ax = (BYTE)(( (DWORD)rx*77 + (DWORD)gx * 151 + (DWORD)bx *28 + 128 ) / 256 ); - if (ax) - { + BYTE ax = (BYTE)(( (DWORD)rx*77 + (DWORD)gx * 151 + (DWORD)bx *28 + 128 ) / 256 ); + if (ax) { //Normalize components to gray BYTE axx = 255 - (( r + g + b ) >> 2 ) ; // Coefficient of grayance, more white font - more gray edges WORD atx = ax * (255 - axx); @@ -2816,10 +2728,9 @@ static int ske_AlphaTextOut (HDC hDC, LPCTSTR lpString, int nCount, RECT *lpRect gx = ( atx + gx * axx )/255; rx = ( atx + rx * axx )/255; - short rrx, grx, brx; - brx = (short)((b-pix[0])*bx/255); - grx = (short)((g-pix[1])*gx/255); - rrx = (short)((r-pix[2])*rx/255); + short brx = (short)((b - pix[0])*bx / 255); + short grx = (short)((g - pix[1])*gx / 255); + short rrx = (short)((r - pix[2])*rx / 255); pix[0] += brx; pix[1] += grx; @@ -2829,92 +2740,84 @@ static int ske_AlphaTextOut (HDC hDC, LPCTSTR lpString, int nCount, RECT *lpRect } } - //Blit to destination - BitBlt( hDC, workRect.left + drx - 2, workRect.top + dry - 2, textSize.cx, textSize.cy, hOffscreenDC, 0, 0, SRCCOPY ); + // Blit to destination + BitBlt(hDC, workRect.left + drx - 2, workRect.top + dry - 2, textSize.cx, textSize.cy, hOffscreenDC, 0, 0, SRCCOPY); //free resources - SelectObject(bufDC,bufoldbmp); + SelectObject(bufDC, bufoldbmp); DeleteObject(bufbmp); - SelectObject(bufDC, hOldBufFont ); + SelectObject(bufDC, hOldBufFont); DeleteDC(bufDC); } - SelectObject(hOffscreenDC,holdbmp); + SelectObject(hOffscreenDC, holdbmp); DeleteObject(hbmp); } } // Final cleanup - SelectObject( hOffscreenDC, hOldOffscreenFont ); - DeleteDC( hOffscreenDC ); + SelectObject(hOffscreenDC, hOldOffscreenFont); + DeleteDC(hOffscreenDC); - if ( destHasNotDIB ) - free( pDestBits ); + if (destHasNotDIB) + free(pDestBits); - if ( bNeedFreeWorkString ) - free((void*)lpWorkString ); + if (bNeedFreeWorkString) + free((void*)lpWorkString); return 0; } static int ske_DrawTextWithEffectWorker( HDC hdc, LPCTSTR lpString, int nCount, RECT *lpRect, UINT format, MODERNFONTEFFECT * effect ) { - if (format&DT_CALCRECT) return DrawText(hdc,lpString,nCount,lpRect,format); + if (format & DT_CALCRECT) + return DrawText(hdc, lpString, nCount, lpRect, format); - if (format&DT_RTLREADING) SetTextAlign(hdc,TA_RTLREADING); - DWORD color = GetTextColor(hdc); + if (format & DT_RTLREADING) + SetTextAlign(hdc, TA_RTLREADING); - RECT r = *lpRect; - OffsetRect(&r,1,1); - DWORD form = format; - if ( effect && effect->effectIndex ) - ske_SelectTextEffect( hdc, effect->effectIndex - 1, effect->baseColour, effect->secondaryColour ); + DWORD color = GetTextColor(hdc); + RECT r = *lpRect; + OffsetRect(&r, 1, 1); + DWORD form = format; + if (effect && effect->effectIndex) + ske_SelectTextEffect(hdc, effect->effectIndex - 1, effect->baseColour, effect->secondaryColour); - int res = ske_AlphaTextOut(hdc, lpString, nCount, lpRect, form, color ); + int res = ske_AlphaTextOut(hdc, lpString, nCount, lpRect, form, color); - if ( effect && effect->effectIndex ) - ske_ResetTextEffect( hdc ); + if (effect && effect->effectIndex) + ske_ResetTextEffect(hdc); - return res; + return res; } INT_PTR ske_Service_DrawTextWithEffect(WPARAM wParam, LPARAM lParam) { - DrawTextWithEffectParam * p = ( DrawTextWithEffectParam * ) wParam; - if ( p->cbSize != sizeof(DrawTextWithEffectParam)) - return FALSE; - return ske_DrawTextWithEffectWorker( p->hdc, p->lpchText, p->cchText, p->lprc, p->dwDTFormat, p->pEffect ); -} - -BOOL ske_DrawTextA(HDC hdc, char * lpString, int nCount, RECT *lpRect, UINT format) -{ - TCHAR *buf = mir_a2u(lpString); - BOOL res; - res = ske_DrawText(hdc,buf,nCount,lpRect,format); - mir_free(buf); - return res; + DrawTextWithEffectParam *p = (DrawTextWithEffectParam *)wParam; + if (p->cbSize != sizeof(DrawTextWithEffectParam)) + return FALSE; + return ske_DrawTextWithEffectWorker(p->hdc, p->lpchText, p->cchText, p->lprc, p->dwDTFormat, p->pEffect); } - BOOL ske_DrawText(HDC hdc, LPCTSTR lpString, int nCount, RECT *lpRect, UINT format) { 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_FORCENATIVERENDER || g_CluiData.fDisableSkinEngine) - return DrawText(hdc,lpString,nCount,lpRect,format&~DT_FORCENATIVERENDER); + 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_FORCENATIVERENDER || g_CluiData.fDisableSkinEngine) + return DrawText(hdc, lpString, nCount, lpRect, format&~DT_FORCENATIVERENDER); + form = format; color = GetTextColor(hdc); - return ske_AlphaTextOut(hdc,lpString,nCount,lpRect,form,color); + return ske_AlphaTextOut(hdc, lpString, nCount, lpRect, form, color); } HICON ske_ImageList_GetIcon(HIMAGELIST himl, int i, UINT fStyle) { IMAGEINFO imi = {0}; BITMAP bm = {0}; - if (i != -1) - { + if (i != -1) { ImageList_GetImageInfo(himl,i,&imi); GetObject(imi.hbmImage,sizeof(bm),&bm); if (bm.bmBitsPixel == 32) //stupid bug of Microsoft @@ -2926,50 +2829,42 @@ HICON ske_ImageList_GetIcon(HIMAGELIST himl, int i, UINT fStyle) // TODO: Direct draw Icon from imagelist without // extracting of icon { - BYTE * bits = NULL; - bits = (BYTE*)bm.bmBits; - if ( !bits) - { + BYTE *bits = (BYTE*)bm.bmBits; + if (!bits) { bits = (BYTE*)malloc(bm.bmWidthBytes*bm.bmHeight); GetBitmapBits(imi.hbmImage,bm.bmWidthBytes*bm.bmHeight,bits); } - { - int iy; - BYTE *bcbits; - int wb = ((imi.rcImage.right-imi.rcImage.left)*bm.bmBitsPixel>>3); - bcbits = bits+(bm.bmHeight-imi.rcImage.bottom)*bm.bmWidthBytes+(imi.rcImage.left*bm.bmBitsPixel>>3); - for (iy = 0; iy < imi.rcImage.bottom-imi.rcImage.top; iy++) - { - int x; - // Dummy microsoft fix - alpha can be less than r,g or b - // Looks like color channels in icons should be non-premultiplied with alpha - // But AddIcon store it premultiplied (incorrectly cause can be Alpha == 7F, but R,G or B == 80 - // So i check that alpha is 0x7F and set it to 0x80 - DWORD *c = ((DWORD*)bcbits); - for (x = 0;x < imi.rcImage.right-imi.rcImage.left; x++) - { - DWORD val = *c; - BYTE a = (BYTE)((val)>>24); - if (a != 0) + + int wb = ((imi.rcImage.right - imi.rcImage.left)*bm.bmBitsPixel >> 3); + BYTE *bcbits = bits + (bm.bmHeight - imi.rcImage.bottom)*bm.bmWidthBytes + (imi.rcImage.left*bm.bmBitsPixel >> 3); + for (int iy = 0; iy < imi.rcImage.bottom - imi.rcImage.top; iy++) { + int x; + // Dummy microsoft fix - alpha can be less than r,g or b + // Looks like color channels in icons should be non-premultiplied with alpha + // But AddIcon store it premultiplied (incorrectly cause can be Alpha == 7F, but R,G or B == 80 + // So i check that alpha is 0x7F and set it to 0x80 + DWORD *c = ((DWORD*)bcbits); + for (x = 0; x < imi.rcImage.right - imi.rcImage.left; x++) { + DWORD val = *c; + BYTE a = (BYTE)((val) >> 24); + if (a != 0) { + BYTE r = (BYTE)((val & 0xFF0000) >> 16); + BYTE g = (BYTE)((val & 0xFF00) >> 8); + BYTE b = (BYTE)(val & 0xFF); + if (a < r || a < g || a < b) { - BYTE r = (BYTE)((val&0xFF0000)>>16); - BYTE g = (BYTE)((val&0xFF00)>>8); - BYTE b = (BYTE)(val&0xFF); - if (a < r || a < g || a < b) - { - a = max(max(r,g),b); - val = a << 24|r << 16|g << 8|b; - *c = val; - } + a = max(max(r, g), b); + val = a << 24 | r << 16 | g << 8 | b; + *c = val; } - c++; } - bcbits += bm.bmWidthBytes; + c++; } + bcbits += bm.bmWidthBytes; } - if ( !bm.bmBits) - { - SetBitmapBits(imi.hbmImage,bm.bmWidthBytes*bm.bmHeight,bits); + + if (!bm.bmBits) { + SetBitmapBits(imi.hbmImage, bm.bmWidthBytes*bm.bmHeight, bits); free(bits); } } @@ -2988,39 +2883,38 @@ HBITMAP ske_ExtractDIBFromImagelistIcon( HIMAGELIST himl,int index, int * outWid BOOL ske_ImageList_DrawEx( HIMAGELIST himl,int i,HDC hdcDst,int x,int y,int dx,int dy,COLORREF rgbBk,COLORREF rgbFg,UINT fStyle) { //the routine to directly draw icon from image list without creating icon from there - should be some faster - - if (i < 0) return FALSE; + if (i < 0) + return FALSE; if (g_CluiData.fDisableSkinEngine) - return ImageList_DrawEx( himl, i, hdcDst, x, y, dx, dy, rgbBk, rgbFg, fStyle); + return ImageList_DrawEx(himl, i, hdcDst, x, y, dx, dy, rgbBk, rgbFg, fStyle); BYTE alpha; if (fStyle&ILD_BLEND25) alpha = 64; else if (fStyle&ILD_BLEND50) alpha = 128; else alpha = 255; - HICON hIcon = ske_ImageList_GetIcon(himl,i,ILD_NORMAL); - if (hIcon) - { - ske_DrawIconEx(hdcDst,x,y,hIcon,dx?dx:GetSystemMetrics(SM_CXSMICON),dy?dy:GetSystemMetrics(SM_CYSMICON), 0, NULL,DI_NORMAL|(alpha << 24)); - DestroyIcon(hIcon); - return TRUE; - } - return FALSE; -} + HICON hIcon = ske_ImageList_GetIcon(himl, i, ILD_NORMAL); + if (hIcon == NULL) + return FALSE; + ske_DrawIconEx(hdcDst, x, y, hIcon, dx ? dx : GetSystemMetrics(SM_CXSMICON), dy ? dy : GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL | (alpha << 24)); + DestroyIcon(hIcon); + return TRUE; +} static INT_PTR ske_Service_DrawIconEx(WPARAM wParam,LPARAM lParam) { DrawIconFixParam *p = (DrawIconFixParam*)wParam; - if ( !p) return 0; + if (!p) + return 0; + return ske_DrawIconEx(p->hdc,p->xLeft,p->yTop,p->hIcon,p->cxWidth,p->cyWidth,p->istepIfAniCur,p->hbrFlickerFreeDraw,p->diFlags); } BOOL ske_DrawIconEx(HDC hdcDst,int xLeft,int yTop,HICON hIcon,int cxWidth,int cyWidth, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags) { - ICONINFO ici; BYTE alpha = (BYTE)((diFlags&0xFF000000)>>24); @@ -3045,11 +2939,11 @@ BOOL ske_DrawIconEx(HDC hdcDst,int xLeft,int yTop,HICON hIcon,int cxWidth,int cy if ( g_CluiData.fDisableSkinEngine && !(diFlags&0x80)) return DrawIconEx(hdcDst,xLeft,yTop,hIcon,cxWidth,cyWidth,istepIfAniCur,hbrFlickerFreeDraw,diFlags&0xFFFF7F); - if ( !GetIconInfo(hIcon,&ici)) return 0; + if (!GetIconInfo(hIcon, &ici)) + return 0; GetObject(ici.hbmColor,sizeof(BITMAP),&imbt); - if (imbt.bmWidth*imbt.bmHeight == 0) - { + if (imbt.bmWidth*imbt.bmHeight == 0) { DeleteObject(ici.hbmColor); DeleteObject(ici.hbmMask); return 0; @@ -3057,98 +2951,85 @@ BOOL ske_DrawIconEx(HDC hdcDst,int xLeft,int yTop,HICON hIcon,int cxWidth,int cy GetObject(ici.hbmMask,sizeof(BITMAP),&immaskbt); cy = imbt.bmHeight; - if (imbt.bmBitsPixel != 32) - { - HDC tempDC1; + if (imbt.bmBitsPixel != 32) { HBITMAP otBmp; no32bit = TRUE; - tempDC1 = CreateCompatibleDC(hdcDst); - tBmp = ske_CreateDIB32(imbt.bmWidth,imbt.bmHeight); - if (tBmp) - { - GetObject(tBmp,sizeof(BITMAP),&imbt); - otBmp = (HBITMAP)SelectObject(tempDC1,tBmp); - DrawIconEx(tempDC1, 0, 0, hIcon,imbt.bmWidth,imbt.bmHeight,istepIfAniCur,hbrFlickerFreeDraw,DI_IMAGE); + HDC tempDC1 = CreateCompatibleDC(hdcDst); + tBmp = ske_CreateDIB32(imbt.bmWidth, imbt.bmHeight); + if (tBmp) { + GetObject(tBmp, sizeof(BITMAP), &imbt); + otBmp = (HBITMAP)SelectObject(tempDC1, tBmp); + DrawIconEx(tempDC1, 0, 0, hIcon, imbt.bmWidth, imbt.bmHeight, istepIfAniCur, hbrFlickerFreeDraw, DI_IMAGE); noMirrorMask = TRUE; } - SelectObject(tempDC1,otBmp); + SelectObject(tempDC1, otBmp); DeleteDC(tempDC1); } - if (imbt.bmBits == NULL) - { + + if (imbt.bmBits == NULL) { NoDIBImage = TRUE; imimagbits = (BYTE*)malloc(cy*imbt.bmWidthBytes); - GetBitmapBits(ici.hbmColor,cy*imbt.bmWidthBytes,(void*)imimagbits); + GetBitmapBits(ici.hbmColor, cy*imbt.bmWidthBytes, (void*)imimagbits); } else imimagbits = (BYTE*)imbt.bmBits; - - if (immaskbt.bmBits == NULL) - { + if (immaskbt.bmBits == NULL) { immaskbits = (BYTE*)malloc(cy*immaskbt.bmWidthBytes); - GetBitmapBits(ici.hbmMask,cy*immaskbt.bmWidthBytes,(void*)immaskbits); + GetBitmapBits(ici.hbmMask, cy*immaskbt.bmWidthBytes, (void*)immaskbits); } - else - immaskbits = (BYTE*)immaskbt.bmBits; + else immaskbits = (BYTE*)immaskbt.bmBits; + icy = imbt.bmHeight; cx = imbt.bmWidth; imDC = CreateCompatibleDC(hdcDst); - imBmp = ske_CreateDIB32Point(cx,icy,(void**)&imbits); - oldBmp = (HBITMAP)SelectObject(imDC,imBmp); - if (imbits != NULL && imimagbits != NULL && immaskbits != NULL) - { + imBmp = ske_CreateDIB32Point(cx, icy, (void**)&imbits); + oldBmp = (HBITMAP)SelectObject(imDC, imBmp); + if (imbits != NULL && imimagbits != NULL && immaskbits != NULL) { int x; int y; - int bottom,right,top,h; - int mwb,mwb2; + int bottom, right, top, h; + int mwb, mwb2; mwb = immaskbt.bmWidthBytes; mwb2 = imbt.bmWidthBytes; bottom = icy; right = cx; top = 0; h = icy; - for (y = top;(y < bottom) && !hasmask; y++) - { - t1 = immaskbits+y*mwb; + for (y = top; (y < bottom) && !hasmask; y++) { + t1 = immaskbits + y*mwb; for (x = 0; (x < mwb) && !hasmask; x++) - hasmask |= (*(t1+x) != 0); + hasmask |= (*(t1 + x) != 0); } - for (y = top;(y < bottom) && !hasalpha; y++) - { - t1 = imimagbits+(cy-y-1)*mwb2; + for (y = top; (y < bottom) && !hasalpha; y++) { + t1 = imimagbits + (cy - y - 1)*mwb2; for (x = 0; (x < right) && !hasalpha; x++) hasalpha |= (*(t1+(x << 2)+3) != 0); } - for (y = 0; y < (int)icy; y++) - { + for (y = 0; y < (int)icy; y++) { t1 = imimagbits+(h-y-1-top)*mwb2; t2 = imbits+(!no32bit?y:(icy-y-1))*mwb2; t3 = immaskbits+(noMirrorMask?y:(h-y-1-top))*mwb; - for (x = 0; x < right; x++) - { - DWORD * src, *dest; + for (x = 0; x < right; x++) { BYTE mask = 0; BYTE a = 0; - src = (DWORD*)(t1+(x << 2)); - dest = (DWORD*)(t2+(x << 2)); + DWORD *src = (DWORD*)(t1 + (x << 2)); + DWORD *dest = (DWORD*)(t2 + (x << 2)); if (hasalpha && !hasmask) a = ((BYTE*)src)[3]; - else - { - mask = ((1 << (7-x%8))&(*(t3+(x>>3)))) != 0; - if (mask)// && !hasalpha) - { - if ( !hasalpha) - { *dest = 0; continue; } - else - { - if (((BYTE*)src)[3]>0 ) - a = ((BYTE*)src)[3]; - else - a = 0; + else { + mask = ((1 << (7 - x % 8))&(*(t3 + (x >> 3)))) != 0; + if (mask) { + if (!hasalpha) { + *dest = 0; + continue; } + + if (((BYTE*)src)[3]>0 ) + a = ((BYTE*)src)[3]; + else + a = 0; } else if (hasalpha || hasmask) a = (((BYTE*)src)[3]>0?((BYTE*)src)[3]:255); @@ -3156,66 +3037,55 @@ BOOL ske_DrawIconEx(HDC hdcDst,int xLeft,int yTop,HICON hIcon,int cxWidth,int cy a = 255; else { *dest = 0; continue; } } - if (a>0) - { + if (a > 0) { ((BYTE*)dest)[3] = a; - ((BYTE*)dest)[0] = ((BYTE*)src)[0]*a/255; - ((BYTE*)dest)[1] = ((BYTE*)src)[1]*a/255; - ((BYTE*)dest)[2] = ((BYTE*)src)[2]*a/255; + ((BYTE*)dest)[0] = ((BYTE*)src)[0] * a / 255; + ((BYTE*)dest)[1] = ((BYTE*)src)[1] * a / 255; + ((BYTE*)dest)[2] = ((BYTE*)src)[2] * a / 255; } - else - *dest = 0; + else *dest = 0; } } } - { - BLENDFUNCTION bf = {AC_SRC_OVER, diFlags&128, alpha, AC_SRC_ALPHA }; - ske_AlphaBlend(hdcDst,xLeft,yTop,cxWidth, cyWidth, imDC, 0, 0, cx,icy,bf); - } + + BLENDFUNCTION bf = { AC_SRC_OVER, diFlags & 128, alpha, AC_SRC_ALPHA }; + ske_AlphaBlend(hdcDst, xLeft, yTop, cxWidth, cyWidth, imDC, 0, 0, cx, icy, bf); + if (immaskbt.bmBits == NULL) free(immaskbits); if (imbt.bmBits == NULL) free(imimagbits); - SelectObject(imDC,oldBmp); + SelectObject(imDC, oldBmp); DeleteObject(imBmp); if (no32bit)DeleteObject(tBmp); DeleteObject(ici.hbmColor); DeleteObject(ici.hbmMask); - SelectObject(imDC,GetStockObject(DEFAULT_GUI_FONT)); + SelectObject(imDC, GetStockObject(DEFAULT_GUI_FONT)); DeleteDC(imDC); - return 1;// DrawIconExS(hdc,xLeft,yTop,hIcon,cxWidth,cyWidth,istepIfAniCur,hbrFlickerFreeDraw,diFlags); + return 1; } - - -int ske_PrepeareImageButDontUpdateIt(RECT *r) +int ske_PrepareImageButDontUpdateIt(RECT *r) { - if (g_CluiData.fLayered) - { - mutex_bLockUpdate = 1; - ske_DrawNonFramedObjects(TRUE,r); - ske_ValidateFrameImageProc(r); - mutex_bLockUpdate = 0; - return 0; - } - else - { - return ske_ReCreateBackImage(FALSE,r); - } + if (!g_CluiData.fLayered) + return ske_ReCreateBackImage(FALSE, r); + + mutex_bLockUpdate = 1; + ske_DrawNonFramedObjects(TRUE, r); + ske_ValidateFrameImageProc(r); + mutex_bLockUpdate = 0; return 0; } int ske_RedrawCompleteWindow() { - if (g_CluiData.fLayered) - { + if (g_CluiData.fLayered) { ske_DrawNonFramedObjects(TRUE,0); CallService(MS_SKINENG_INVALIDATEFRAMEIMAGE, 0, 0); } - else - { - RedrawWindow(pcli->hwndContactList,NULL,NULL,RDW_ALLCHILDREN|RDW_ERASE|RDW_INVALIDATE|RDW_FRAME); - } + else RedrawWindow(pcli->hwndContactList,NULL,NULL,RDW_ALLCHILDREN|RDW_ERASE|RDW_INVALIDATE|RDW_FRAME); + return 0; } + // Request to repaint frame or change/drop callback data // wParam = hWnd of called frame // lParam = pointer to sPaintRequest (or NULL to redraw all) @@ -3223,7 +3093,8 @@ int ske_RedrawCompleteWindow() static INT_PTR ske_Service_UpdateFrameImage(WPARAM wParam, LPARAM lParam) // Immideately recall paint routines for frame and refresh image { - if ( MirandaLoading()) return 0; + if ( MirandaLoading()) + return 0; RECT wnd; FRAMEWND *frm; @@ -3233,42 +3104,40 @@ static INT_PTR ske_Service_UpdateFrameImage(WPARAM wParam, LPARAM lParam) GetWindowRect(pcli->hwndContactList,&wnd); else wnd = g_rcEdgeSizingRect; - if ( !g_CluiData.fLayered) - { + + if (!g_CluiData.fLayered) { RedrawWindow((HWND)wParam,NULL,NULL,RDW_UPDATENOW|RDW_ERASE|RDW_INVALIDATE|RDW_FRAME); return 0; } + if (g_pCachedWindow == NULL) ske_ValidateFrameImageProc(&wnd); else if (g_pCachedWindow->Width != wnd.right-wnd.left || g_pCachedWindow->Height != wnd.bottom-wnd.top) ske_ValidateFrameImageProc(&wnd); else if (wParam == 0) ske_ValidateFrameImageProc(&wnd); - else // all Ok Update Single Frame - { + else { // all Ok Update Single Frame // TO BE LOCKED OR PROXIED frm = FindFrameByItsHWND((HWND)wParam); - if ( !frm) ske_ValidateFrameImageProc(&wnd); + if (!frm) + ske_ValidateFrameImageProc(&wnd); // Validate frame, update window image and remove it from queue - else - { - if (frm->UpdateRgn) - { + else { + if (frm->UpdateRgn) { DeleteObject(frm->UpdateRgn); frm->UpdateRgn = 0; } - ske_ValidateSingleFrameImage(frm,0); + ske_ValidateSingleFrameImage(frm, 0); ske_UpdateWindowImage(); NoCancelPost = 1; //-- Remove frame from queue - if (flag_bUpdateQueued) - { - int i; + if (flag_bUpdateQueued) { frm->bQueued = 0; - for (i=0;i < g_nFramesCount;i++) - if (IsAnyQueued |= g_pfwFrames[i].bQueued) break; + for (int i = 0; i < g_nFramesCount; i++) + if (IsAnyQueued |= g_pfwFrames[i].bQueued) + break; } } } - if ((!NoCancelPost || !IsAnyQueued) && flag_bUpdateQueued) // no any queued updating cancel post or need to cancel post - { + + if ((!NoCancelPost || !IsAnyQueued) && flag_bUpdateQueued) { // no any queued updating cancel post or need to cancel post flag_bUpdateQueued = 0; g_flag_bPostWasCanceled = 1; } @@ -3276,240 +3145,216 @@ static INT_PTR ske_Service_UpdateFrameImage(WPARAM wParam, LPARAM lParam) } static INT_PTR ske_Service_InvalidateFrameImage(WPARAM wParam, LPARAM lParam) // Post request for updating { - if ( MirandaLoading()) return 0; - if (wParam) - { + if (MirandaLoading()) return 0; + + if (wParam) { FRAMEWND *frm = FindFrameByItsHWND((HWND)wParam); - sPaintRequest * pr = (sPaintRequest*)lParam; - if ( !g_CluiData.fLayered || (frm && frm->floating)) return InvalidateRect((HWND)wParam,pr?(RECT*)&(pr->rcUpdate):NULL,FALSE); - if (frm) - { - if (frm->PaintCallbackProc != NULL) - { + sPaintRequest *pr = (sPaintRequest*)lParam; + if (!g_CluiData.fLayered || (frm && frm->floating)) + return InvalidateRect((HWND)wParam, pr ? (RECT*)&(pr->rcUpdate) : NULL, FALSE); + + if (frm) { + if (frm->PaintCallbackProc != NULL) { frm->PaintData = (sPaintRequest *)pr; frm->bQueued = 1; - if (pr) - { + if (pr) { HRGN r2; - if ( !IsRectEmpty(&pr->rcUpdate)) - { + if (!IsRectEmpty(&pr->rcUpdate)) { RECT rcClient; RECT rcUpdate; - GetClientRect(frm->hWnd,&rcClient); - IntersectRect( &rcUpdate, &rcClient, &pr->rcUpdate ); - if ( IsRectEmpty( &rcUpdate )) + GetClientRect(frm->hWnd, &rcClient); + IntersectRect(&rcUpdate, &rcClient, &pr->rcUpdate); + if (IsRectEmpty(&rcUpdate)) return 0; - r2 = CreateRectRgn( rcUpdate.left, rcUpdate.top, rcUpdate.right, rcUpdate.bottom ); + r2 = CreateRectRgn(rcUpdate.left, rcUpdate.top, rcUpdate.right, rcUpdate.bottom); } - else - { + else { RECT r; - GetClientRect(frm->hWnd,&r); - r2 = CreateRectRgn(r.left,r.top,r.right,r.bottom); + GetClientRect(frm->hWnd, &r); + r2 = CreateRectRgn(r.left, r.top, r.right, r.bottom); } - if ( !frm->UpdateRgn) - { - frm->UpdateRgn = CreateRectRgn(0, 0, 1,1); - CombineRgn(frm->UpdateRgn,r2, 0, RGN_COPY); + + if (!frm->UpdateRgn) { + frm->UpdateRgn = CreateRectRgn(0, 0, 1, 1); + CombineRgn(frm->UpdateRgn, r2, 0, RGN_COPY); } - else CombineRgn(frm->UpdateRgn,frm->UpdateRgn,r2,RGN_OR); + else CombineRgn(frm->UpdateRgn, frm->UpdateRgn, r2, RGN_OR); DeleteObject(r2); } - } } - else - { - Sync( QueueAllFramesUpdating, (BYTE)1 ); - } + else Sync(QueueAllFramesUpdating, 1); } - else - Sync( QueueAllFramesUpdating , (BYTE)1 ); + else Sync(QueueAllFramesUpdating, 1); + if ( !flag_bUpdateQueued || g_flag_bPostWasCanceled) - if (PostMessage(pcli->hwndContactList,UM_UPDATE, 0, 0)) - { - flag_bUpdateQueued = 1; - g_flag_bPostWasCanceled = 0; - } - return 1; + if (PostMessage(pcli->hwndContactList, UM_UPDATE, 0, 0)) { + flag_bUpdateQueued = 1; + g_flag_bPostWasCanceled = 0; + } + return 1; } - static int ske_ValidateSingleFrameImage(FRAMEWND * Frame, BOOL SkipBkgBlitting) // Calling frame paint proc { if ( !g_pCachedWindow) { TRACE("ske_ValidateSingleFrameImage calling without cached\n"); return 0;} if (Frame->hWnd == (HWND)-1 && !Frame->PaintCallbackProc) { TRACE("ske_ValidateSingleFrameImage calling without FrameProc\n"); return 0;} - { // if ok update image - HDC hdc; - HBITMAP o,n; - RECT rcPaint,wnd; - RECT ru = {0}; - int w,h,x,y; - int w1,h1,x1,y1; - - CLUI_SizingGetWindowRect(pcli->hwndContactList,&wnd); - rcPaint = Frame->wndSize; - { - int dx,dy,bx,by; - if (g_CluiData.mutexOnEdgeSizing) - { - dx = rcPaint.left-wnd.left; - dy = rcPaint.top-wnd.top; - bx = rcPaint.right-wnd.right; - by = rcPaint.bottom-wnd.bottom; - wnd = g_rcEdgeSizingRect; - rcPaint.left = wnd.left+dx; - rcPaint.top = wnd.top+dy; - rcPaint.right = wnd.right+bx; - rcPaint.bottom = wnd.bottom+by; - } - } - //OffsetRect(&rcPaint,-wnd.left,-wnd.top); - w = rcPaint.right-rcPaint.left; - h = rcPaint.bottom-rcPaint.top; - if (w <= 0 || h <= 0) + + // if ok update image + HDC hdc; + HBITMAP o,n; + RECT rcPaint,wnd; + RECT ru = {0}; + int w,h,x,y; + int w1,h1,x1,y1; + + CLUI_SizingGetWindowRect(pcli->hwndContactList,&wnd); + rcPaint = Frame->wndSize; + { + int dx,dy,bx,by; + if (g_CluiData.mutexOnEdgeSizing) { - TRACE("Frame size smaller than 0\n"); - return 0; + dx = rcPaint.left-wnd.left; + dy = rcPaint.top-wnd.top; + bx = rcPaint.right-wnd.right; + by = rcPaint.bottom-wnd.bottom; + wnd = g_rcEdgeSizingRect; + rcPaint.left = wnd.left+dx; + rcPaint.top = wnd.top+dy; + rcPaint.right = wnd.right+bx; + rcPaint.bottom = wnd.bottom+by; } - x = rcPaint.left; - y = rcPaint.top; - hdc = CreateCompatibleDC(g_pCachedWindow->hImageDC); - n = ske_CreateDIB32(w,h); - o = (HBITMAP)SelectObject(hdc,n); + } + //OffsetRect(&rcPaint,-wnd.left,-wnd.top); + w = rcPaint.right-rcPaint.left; + h = rcPaint.bottom-rcPaint.top; + if (w <= 0 || h <= 0) + { + TRACE("Frame size smaller than 0\n"); + return 0; + } + x = rcPaint.left; + y = rcPaint.top; + hdc = CreateCompatibleDC(g_pCachedWindow->hImageDC); + n = ske_CreateDIB32(w,h); + o = (HBITMAP)SelectObject(hdc,n); + { + if (Frame->UpdateRgn && !SkipBkgBlitting) { - if (Frame->UpdateRgn && !SkipBkgBlitting) + GetRgnBox(Frame->UpdateRgn,&ru); { - GetRgnBox(Frame->UpdateRgn,&ru); - { - RECT rc; - GetClientRect(Frame->hWnd,&rc); - if (ru.top < 0) ru.top = 0; - if (ru.left < 0) ru.left = 0; - if (ru.right>rc.right) ru.right = rc.right; - if (ru.bottom>rc.bottom) ru.bottom = rc.bottom; - } - if ( !IsRectEmpty(&ru)) - { - x1 = ru.left; - y1 = ru.top; - w1 = ru.right-ru.left; - h1 = ru.bottom-ru.top; - } - else - {x1 = 0; y1 = 0; w1 = w; h1 = h;} - // copy image at hdc - if (SkipBkgBlitting) //image already at foreground - { - BitBlt(hdc,x1,y1,w1,h1,g_pCachedWindow->hImageDC,x+x1,y+y1,SRCCOPY); - } - else - { - BitBlt(hdc,x1,y1,w1,h1,g_pCachedWindow->hBackDC,x+x1,y+y1,SRCCOPY); - } - Frame->PaintCallbackProc(Frame->hWnd,hdc,&ru,Frame->UpdateRgn, Frame->dwFlags,Frame->PaintData); + RECT rc; + GetClientRect(Frame->hWnd,&rc); + if (ru.top < 0) ru.top = 0; + if (ru.left < 0) ru.left = 0; + if (ru.right>rc.right) ru.right = rc.right; + if (ru.bottom>rc.bottom) ru.bottom = rc.bottom; + } + if ( !IsRectEmpty(&ru)) + { + x1 = ru.left; + y1 = ru.top; + w1 = ru.right-ru.left; + h1 = ru.bottom-ru.top; } else + {x1 = 0; y1 = 0; w1 = w; h1 = h;} + // copy image at hdc + if (SkipBkgBlitting) //image already at foreground { - HRGN rgnUpdate; - RECT r; - GetClientRect(Frame->hWnd,&r); - rgnUpdate = CreateRectRgn(r.left,r.top,r.right,r.bottom); - ru = r; - if ( !IsRectEmpty(&ru)) - { - x1 = ru.left; - y1 = ru.top; - w1 = ru.right-ru.left; - h1 = ru.bottom-ru.top; - } - else - {x1 = 0; y1 = 0; w1 = w; h1 = h;} - // copy image at hdc - if (SkipBkgBlitting) //image already at foreground - { - BitBlt(hdc,x1,y1,w1,h1,g_pCachedWindow->hImageDC,x+x1,y+y1,SRCCOPY); - } - else - { - BitBlt(hdc,x1,y1,w1,h1,g_pCachedWindow->hBackDC,x+x1,y+y1,SRCCOPY); - } - Frame->PaintCallbackProc(Frame->hWnd,hdc,&r,rgnUpdate, Frame->dwFlags,Frame->PaintData); - ru = r; - DeleteObject(rgnUpdate); + BitBlt(hdc,x1,y1,w1,h1,g_pCachedWindow->hImageDC,x+x1,y+y1,SRCCOPY); } - DeleteObject(Frame->UpdateRgn); - Frame->UpdateRgn = 0; - } - if ( !IsRectEmpty(&ru)) - { - x1 = ru.left; - y1 = ru.top; - w1 = ru.right-ru.left; - h1 = ru.bottom-ru.top; + else + { + BitBlt(hdc,x1,y1,w1,h1,g_pCachedWindow->hBackDC,x+x1,y+y1,SRCCOPY); + } + Frame->PaintCallbackProc(Frame->hWnd,hdc,&ru,Frame->UpdateRgn, Frame->dwFlags,Frame->PaintData); } else - {x1 = 0; y1 = 0; w1 = w; h1 = h;} - /* if ( !SkipBkgBlitting) { - BitBlt(g_pCachedWindow->hImageDC,x+x1,y+y1,w1,h1,g_pCachedWindow->hBackDC,x+x1,y+y1,SRCCOPY); - } - - */ - { - //BLENDFUNCTION bf = {AC_SRC_OVER, 0, 255, AC_SRC_ALPHA }; - BitBlt(g_pCachedWindow->hImageDC,x+x1,y+y1,w1,h1,hdc,x1,y1,SRCCOPY); - //BLENDFUNCTION bf = {AC_SRC_OVER, 0, 255, AC_SRC_ALPHA }; - //MyAlphaBlend(g_pCachedWindow->hImageDC,x+x1,y+y1,w1,h1,hdc,x1,y1,w1,h1,bf); - } - - if (GetWindowLongPtr(Frame->hWnd,GWL_STYLE) & WS_VSCROLL) - { - //Draw vertical scroll bar - // - RECT rThumb; - RECT rUpBtn; - RECT rDnBtn; - RECT rLine; - int dx,dy; - SCROLLBARINFO si = {0}; - si.cbSize = sizeof(SCROLLBARINFO); - GetScrollBarInfo(Frame->hWnd, OBJID_VSCROLL, &si); - rLine = (si.rcScrollBar); - rUpBtn = rLine; - rDnBtn = rLine; - rThumb = rLine; - - rUpBtn.bottom = rUpBtn.top+si.dxyLineButton; - rDnBtn.top = rDnBtn.bottom-si.dxyLineButton; - rThumb.top = rLine.top+si.xyThumbTop; - rThumb.bottom = rLine.top+si.xyThumbBottom; + HRGN rgnUpdate; + RECT r; + GetClientRect(Frame->hWnd,&r); + rgnUpdate = CreateRectRgn(r.left,r.top,r.right,r.bottom); + ru = r; + if ( !IsRectEmpty(&ru)) + { + x1 = ru.left; + y1 = ru.top; + w1 = ru.right-ru.left; + h1 = ru.bottom-ru.top; + } + else + {x1 = 0; y1 = 0; w1 = w; h1 = h;} + // copy image at hdc + if (SkipBkgBlitting) //image already at foreground { - dx = Frame->wndSize.right-rLine.right; - dy = -rLine.top+Frame->wndSize.top; + BitBlt(hdc,x1,y1,w1,h1,g_pCachedWindow->hImageDC,x+x1,y+y1,SRCCOPY); } - OffsetRect(&rLine,dx,dy); - OffsetRect(&rUpBtn,dx,dy); - OffsetRect(&rDnBtn,dx,dy); - OffsetRect(&rThumb,dx,dy); - BitBlt(g_pCachedWindow->hImageDC,rLine.left,rLine.top,rLine.right-rLine.left,rLine.bottom-rLine.top,g_pCachedWindow->hBackDC,rLine.left,rLine.top,SRCCOPY); + else { - char req[255]; - mir_snprintf(req, sizeof(req), "Main,ID=ScrollBar,Frame=%s,Part=Back", Frame->szName); - SkinDrawGlyph(g_pCachedWindow->hImageDC,&rLine,&rLine,req); - mir_snprintf(req, sizeof(req), "Main,ID=ScrollBar,Frame=%s,Part=Thumb", Frame->szName); - SkinDrawGlyph(g_pCachedWindow->hImageDC,&rThumb,&rThumb,req); - mir_snprintf(req, sizeof(req), "Main,ID=ScrollBar, Frame=%s,Part=UpLineButton", Frame->szName); - SkinDrawGlyph(g_pCachedWindow->hImageDC,&rUpBtn,&rUpBtn,req); - mir_snprintf(req, sizeof(req), "Main,ID=ScrollBar,Frame=%s,Part=DownLineButton", Frame->szName); - SkinDrawGlyph(g_pCachedWindow->hImageDC,&rDnBtn,&rDnBtn,req); + BitBlt(hdc,x1,y1,w1,h1,g_pCachedWindow->hBackDC,x+x1,y+y1,SRCCOPY); } + Frame->PaintCallbackProc(Frame->hWnd,hdc,&r,rgnUpdate, Frame->dwFlags,Frame->PaintData); + ru = r; + DeleteObject(rgnUpdate); } - - SelectObject(hdc,o); - DeleteObject(n); - DeleteDC(hdc); + DeleteObject(Frame->UpdateRgn); + Frame->UpdateRgn = 0; + } + if ( !IsRectEmpty(&ru)) + { + x1 = ru.left; + y1 = ru.top; + w1 = ru.right-ru.left; + h1 = ru.bottom-ru.top; } + else { + x1 = 0; y1 = 0; w1 = w; h1 = h; + } + + BitBlt(g_pCachedWindow->hImageDC,x+x1,y+y1,w1,h1,hdc,x1,y1,SRCCOPY); + + if (GetWindowLongPtr(Frame->hWnd, GWL_STYLE) & WS_VSCROLL) { + //Draw vertical scroll bar + // + SCROLLBARINFO si = {0}; + si.cbSize = sizeof(SCROLLBARINFO); + GetScrollBarInfo(Frame->hWnd, OBJID_VSCROLL, &si); + + RECT rLine = (si.rcScrollBar); + RECT rUpBtn = rLine; + RECT rDnBtn = rLine; + RECT rThumb = rLine; + + rUpBtn.bottom = rUpBtn.top+si.dxyLineButton; + rDnBtn.top = rDnBtn.bottom-si.dxyLineButton; + rThumb.top = rLine.top+si.xyThumbTop; + rThumb.bottom = rLine.top+si.xyThumbBottom; + + int dx = Frame->wndSize.right-rLine.right; + int dy = -rLine.top + Frame->wndSize.top; + + OffsetRect(&rLine, dx, dy); + OffsetRect(&rUpBtn, dx, dy); + OffsetRect(&rDnBtn, dx, dy); + OffsetRect(&rThumb, dx, dy); + BitBlt(g_pCachedWindow->hImageDC, rLine.left, rLine.top, rLine.right - rLine.left, rLine.bottom - rLine.top, g_pCachedWindow->hBackDC, rLine.left, rLine.top, SRCCOPY); + + char req[255]; + mir_snprintf(req, sizeof(req), "Main,ID=ScrollBar,Frame=%s,Part=Back", Frame->szName); + SkinDrawGlyph(g_pCachedWindow->hImageDC,&rLine,&rLine,req); + mir_snprintf(req, sizeof(req), "Main,ID=ScrollBar,Frame=%s,Part=Thumb", Frame->szName); + SkinDrawGlyph(g_pCachedWindow->hImageDC,&rThumb,&rThumb,req); + mir_snprintf(req, sizeof(req), "Main,ID=ScrollBar, Frame=%s,Part=UpLineButton", Frame->szName); + SkinDrawGlyph(g_pCachedWindow->hImageDC,&rUpBtn,&rUpBtn,req); + mir_snprintf(req, sizeof(req), "Main,ID=ScrollBar,Frame=%s,Part=DownLineButton", Frame->szName); + SkinDrawGlyph(g_pCachedWindow->hImageDC,&rDnBtn,&rDnBtn,req); + } + + SelectObject(hdc, o); + DeleteObject(n); + DeleteDC(hdc); return 1; } @@ -3519,8 +3364,7 @@ int ske_BltBackImage (HWND destHWND, HDC destDC, RECT *BltClientRect) POINT ptChildWnd = {0}; RECT from = {0}; RECT w = {0}; - if (g_CluiData.fDisableSkinEngine) - { + if (g_CluiData.fDisableSkinEngine) { FillRect(destDC,BltClientRect,GetSysColorBrush(COLOR_3DFACE)); return 0; } @@ -3544,40 +3388,34 @@ int ske_ReCreateBackImage(BOOL Erase,RECT *w) GetClientRect(pcli->hwndContactList,&wnd); if (w) wnd = *w; //-- Check cached. - if (g_pCachedWindow == NULL) - { + if (g_pCachedWindow == NULL) { //-- Create New Cache - { - g_pCachedWindow = (CURRWNDIMAGEDATA*)mir_calloc(sizeof(CURRWNDIMAGEDATA)); - g_pCachedWindow->hScreenDC = GetDC(NULL); - g_pCachedWindow->hBackDC = CreateCompatibleDC(g_pCachedWindow->hScreenDC); - g_pCachedWindow->hImageDC = CreateCompatibleDC(g_pCachedWindow->hScreenDC); - g_pCachedWindow->Width = wnd.right-wnd.left; - g_pCachedWindow->Height = wnd.bottom-wnd.top; - if (g_pCachedWindow->Width != 0 && g_pCachedWindow->Height != 0) - { - g_pCachedWindow->hImageDIB = ske_CreateDIB32Point(g_pCachedWindow->Width,g_pCachedWindow->Height,(void**)&(g_pCachedWindow->hImageDIBByte)); - g_pCachedWindow->hBackDIB = ske_CreateDIB32Point(g_pCachedWindow->Width,g_pCachedWindow->Height,(void**)&(g_pCachedWindow->hBackDIBByte)); - g_pCachedWindow->hImageOld = (HBITMAP)SelectObject(g_pCachedWindow->hImageDC,g_pCachedWindow->hImageDIB); - g_pCachedWindow->hBackOld = (HBITMAP)SelectObject(g_pCachedWindow->hBackDC,g_pCachedWindow->hBackDIB); - } + g_pCachedWindow = (CURRWNDIMAGEDATA*)mir_calloc(sizeof(CURRWNDIMAGEDATA)); + g_pCachedWindow->hScreenDC = GetDC(NULL); + g_pCachedWindow->hBackDC = CreateCompatibleDC(g_pCachedWindow->hScreenDC); + g_pCachedWindow->hImageDC = CreateCompatibleDC(g_pCachedWindow->hScreenDC); + g_pCachedWindow->Width = wnd.right-wnd.left; + g_pCachedWindow->Height = wnd.bottom-wnd.top; + if (g_pCachedWindow->Width != 0 && g_pCachedWindow->Height != 0) { + g_pCachedWindow->hImageDIB = ske_CreateDIB32Point(g_pCachedWindow->Width,g_pCachedWindow->Height,(void**)&(g_pCachedWindow->hImageDIBByte)); + g_pCachedWindow->hBackDIB = ske_CreateDIB32Point(g_pCachedWindow->Width,g_pCachedWindow->Height,(void**)&(g_pCachedWindow->hBackDIBByte)); + g_pCachedWindow->hImageOld = (HBITMAP)SelectObject(g_pCachedWindow->hImageDC,g_pCachedWindow->hImageDIB); + g_pCachedWindow->hBackOld = (HBITMAP)SelectObject(g_pCachedWindow->hBackDC,g_pCachedWindow->hBackDIB); } IsNewCache = 1; } - if (g_pCachedWindow->Width != wnd.right-wnd.left || g_pCachedWindow->Height != wnd.bottom-wnd.top) - { + + if (g_pCachedWindow->Width != wnd.right-wnd.left || g_pCachedWindow->Height != wnd.bottom-wnd.top) { HBITMAP hb1 = NULL,hb2 = NULL; g_pCachedWindow->Width = wnd.right-wnd.left; g_pCachedWindow->Height = wnd.bottom-wnd.top; - if (g_pCachedWindow->Width != 0 && g_pCachedWindow->Height != 0) - { + if (g_pCachedWindow->Width != 0 && g_pCachedWindow->Height != 0) { hb1 = ske_CreateDIB32Point(g_pCachedWindow->Width,g_pCachedWindow->Height,(void**)&(g_pCachedWindow->hImageDIBByte)); hb2 = ske_CreateDIB32Point(g_pCachedWindow->Width,g_pCachedWindow->Height,(void**)&(g_pCachedWindow->hBackDIBByte)); SelectObject(g_pCachedWindow->hImageDC,hb1); SelectObject(g_pCachedWindow->hBackDC,hb2); } - else - { + else { SelectObject(g_pCachedWindow->hImageDC,g_pCachedWindow->hImageOld); SelectObject(g_pCachedWindow->hBackDC,g_pCachedWindow->hBackOld); } @@ -3587,9 +3425,8 @@ int ske_ReCreateBackImage(BOOL Erase,RECT *w) g_pCachedWindow->hBackDIB = hb2; IsNewCache = 1; } - if ((Erase || IsNewCache ) && (g_pCachedWindow->Width != 0 && g_pCachedWindow->Height != 0)) - { + if ((Erase || IsNewCache ) && (g_pCachedWindow->Width != 0 && g_pCachedWindow->Height != 0)) { hb2 = ske_CreateDIB32(g_pCachedWindow->Width,g_pCachedWindow->Height); SelectObject(g_pCachedWindow->hBackDC,hb2); DeleteObject(g_pCachedWindow->hBackDIB); @@ -3600,45 +3437,42 @@ int ske_ReCreateBackImage(BOOL Erase,RECT *w) } return 1; } + int ske_DrawNonFramedObjects(BOOL Erase,RECT *r) { - RECT w,wnd; + RECT w, wnd; if (r) w = *r; - else CLUI_SizingGetWindowRect(pcli->hwndContactList,&w); - if ( !g_CluiData.fLayered) return ske_ReCreateBackImage(FALSE,0); + else CLUI_SizingGetWindowRect(pcli->hwndContactList, &w); + if (!g_CluiData.fLayered) return ske_ReCreateBackImage(FALSE, 0); if (g_pCachedWindow == NULL) return ske_ValidateFrameImageProc(&w); wnd = w; OffsetRect(&w, -w.left, -w.top); - if (Erase) - { + if (Erase) { HBITMAP hb2; - hb2 = ske_CreateDIB32(g_pCachedWindow->Width,g_pCachedWindow->Height); - SelectObject(g_pCachedWindow->hBackDC,hb2); + hb2 = ske_CreateDIB32(g_pCachedWindow->Width, g_pCachedWindow->Height); + SelectObject(g_pCachedWindow->hBackDC, hb2); DeleteObject(g_pCachedWindow->hBackDIB); g_pCachedWindow->hBackDIB = hb2; } - SkinDrawGlyph(g_pCachedWindow->hBackDC,&w,&w,"Main,ID=Background"); + SkinDrawGlyph(g_pCachedWindow->hBackDC, &w, &w, "Main,ID=Background"); + //--Draw frames captions - { - int i; - for (i=0;i < g_nFramesCount;i++) - if (g_pfwFrames[i].TitleBar.ShowTitleBar && g_pfwFrames[i].visible && !g_pfwFrames[i].floating) - { - RECT rc; - SetRect(&rc,g_pfwFrames[i].wndSize.left,g_pfwFrames[i].wndSize.top-g_nTitleBarHeight-g_CluiData.nGapBetweenTitlebar,g_pfwFrames[i].wndSize.right,g_pfwFrames[i].wndSize.top-g_CluiData.nGapBetweenTitlebar); - //GetWindowRect(Frames[i].TitleBar.hwnd,&rc); - //OffsetRect(&rc,-wnd.left,-wnd.top); - Sync( DrawTitleBar, g_pCachedWindow->hBackDC, &rc, g_pfwFrames[i].id ); - } + for (int i = 0; i < g_nFramesCount; i++) { + if (g_pfwFrames[i].TitleBar.ShowTitleBar && g_pfwFrames[i].visible && !g_pfwFrames[i].floating) { + RECT rc; + SetRect(&rc, g_pfwFrames[i].wndSize.left, g_pfwFrames[i].wndSize.top - g_nTitleBarHeight - g_CluiData.nGapBetweenTitlebar, g_pfwFrames[i].wndSize.right, g_pfwFrames[i].wndSize.top - g_CluiData.nGapBetweenTitlebar); + Sync(DrawTitleBar, g_pCachedWindow->hBackDC, &rc, g_pfwFrames[i].id); + } } g_mutex_bLockUpdating = 1; flag_bJustDrawNonFramedObjects = 1; return 0; } + int ske_ValidateFrameImageProc(RECT *r) // Calling queued frame paint procs and refresh image { RECT wnd = {0}; @@ -3646,28 +3480,27 @@ int ske_ValidateFrameImageProc(RECT *r) // Callin BOOL IsForceAllPainting = 0; if (r) wnd = *r; else GetWindowRect(pcli->hwndContactList,&wnd); - if (wnd.right-wnd.left == 0 || wnd.bottom-wnd.top == 0) return 0; + if (wnd.right-wnd.left == 0 || wnd.bottom-wnd.top == 0) + return 0; + g_mutex_bLockUpdating = 1; + //-- Check cached. - if (g_pCachedWindow == NULL) - { + if (g_pCachedWindow == NULL) { //-- Create New Cache - { - g_pCachedWindow = (CURRWNDIMAGEDATA*)mir_calloc(sizeof(CURRWNDIMAGEDATA)); - g_pCachedWindow->hScreenDC = GetDC(NULL); - g_pCachedWindow->hBackDC = CreateCompatibleDC(g_pCachedWindow->hScreenDC); - g_pCachedWindow->hImageDC = CreateCompatibleDC(g_pCachedWindow->hScreenDC); - g_pCachedWindow->Width = wnd.right-wnd.left; - g_pCachedWindow->Height = wnd.bottom-wnd.top; - g_pCachedWindow->hImageDIB = ske_CreateDIB32Point(g_pCachedWindow->Width,g_pCachedWindow->Height,(void**)&(g_pCachedWindow->hImageDIBByte)); - g_pCachedWindow->hBackDIB = ske_CreateDIB32Point(g_pCachedWindow->Width,g_pCachedWindow->Height,(void**)&(g_pCachedWindow->hBackDIBByte)); - g_pCachedWindow->hImageOld = (HBITMAP)SelectObject(g_pCachedWindow->hImageDC,g_pCachedWindow->hImageDIB); - g_pCachedWindow->hBackOld = (HBITMAP)SelectObject(g_pCachedWindow->hBackDC,g_pCachedWindow->hBackDIB); - } + g_pCachedWindow = (CURRWNDIMAGEDATA*)mir_calloc(sizeof(CURRWNDIMAGEDATA)); + g_pCachedWindow->hScreenDC = GetDC(NULL); + g_pCachedWindow->hBackDC = CreateCompatibleDC(g_pCachedWindow->hScreenDC); + g_pCachedWindow->hImageDC = CreateCompatibleDC(g_pCachedWindow->hScreenDC); + g_pCachedWindow->Width = wnd.right-wnd.left; + g_pCachedWindow->Height = wnd.bottom-wnd.top; + g_pCachedWindow->hImageDIB = ske_CreateDIB32Point(g_pCachedWindow->Width,g_pCachedWindow->Height,(void**)&(g_pCachedWindow->hImageDIBByte)); + g_pCachedWindow->hBackDIB = ske_CreateDIB32Point(g_pCachedWindow->Width,g_pCachedWindow->Height,(void**)&(g_pCachedWindow->hBackDIBByte)); + g_pCachedWindow->hImageOld = (HBITMAP)SelectObject(g_pCachedWindow->hImageDC,g_pCachedWindow->hImageDIB); + g_pCachedWindow->hBackOld = (HBITMAP)SelectObject(g_pCachedWindow->hBackDC,g_pCachedWindow->hBackDIB); IsNewCache = 1; } - if (g_pCachedWindow->Width != wnd.right-wnd.left || g_pCachedWindow->Height != wnd.bottom-wnd.top) - { + if (g_pCachedWindow->Width != wnd.right-wnd.left || g_pCachedWindow->Height != wnd.bottom-wnd.top) { HBITMAP hb1,hb2; g_pCachedWindow->Width = wnd.right-wnd.left; g_pCachedWindow->Height = wnd.bottom-wnd.top; @@ -3681,39 +3514,34 @@ int ske_ValidateFrameImageProc(RECT *r) // Callin g_pCachedWindow->hBackDIB = hb2; IsNewCache = 1; } - if (IsNewCache) - { + if (IsNewCache) { ske_DrawNonFramedObjects(0, &wnd); IsForceAllPainting = 1; } - if (flag_bJustDrawNonFramedObjects) - { + if (flag_bJustDrawNonFramedObjects) { IsForceAllPainting = 1; flag_bJustDrawNonFramedObjects = 0; } - if (IsForceAllPainting) - { + if (IsForceAllPainting) { BitBlt(g_pCachedWindow->hImageDC, 0, 0, g_pCachedWindow->Width,g_pCachedWindow->Height,g_pCachedWindow->hBackDC, 0, 0, SRCCOPY); Sync( QueueAllFramesUpdating, (BYTE)1 ); } //-- Validating frames - { - int i; - for (i=0;i < g_nFramesCount;i++) - if (g_pfwFrames[i].PaintCallbackProc && g_pfwFrames[i].visible && !g_pfwFrames[i].floating ) - if (g_pfwFrames[i].bQueued || IsForceAllPainting) - ske_ValidateSingleFrameImage(&g_pfwFrames[i],IsForceAllPainting); - } + for (int i=0; i < g_nFramesCount; i++) + if (g_pfwFrames[i].PaintCallbackProc && g_pfwFrames[i].visible && !g_pfwFrames[i].floating) + if (g_pfwFrames[i].bQueued || IsForceAllPainting) + ske_ValidateSingleFrameImage(&g_pfwFrames[i], IsForceAllPainting); + g_mutex_bLockUpdating = 1; ModernSkinButtonRedrawAll(0); g_mutex_bLockUpdating = 0; - if ( !mutex_bLockUpdate) ske_UpdateWindowImageRect(&wnd); + if ( !mutex_bLockUpdate) + ske_UpdateWindowImageRect(&wnd); + //-- Clear queue - { - Sync( QueueAllFramesUpdating, (BYTE)0 ); - flag_bUpdateQueued = 0; - g_flag_bPostWasCanceled = 0; - } + Sync(QueueAllFramesUpdating, 0); + flag_bUpdateQueued = 0; + g_flag_bPostWasCanceled = 0; return 1; } @@ -3721,30 +3549,27 @@ int ske_UpdateWindowImage() { if (MirandaExiting()) return 0; - if (g_CluiData.fLayered) - { + + if (g_CluiData.fLayered) { RECT r; GetWindowRect(pcli->hwndContactList,&r); return ske_UpdateWindowImageRect(&r); } - else - ske_ReCreateBackImage(FALSE,0); - ske_ApplyTransluency(); + else ske_ReCreateBackImage(FALSE,0); + ske_ApplyTranslucency(); return 0; } - int ske_UpdateWindowImageRect(RECT *r) // Update window with current image and { //if not validity -> ValidateImageProc //else Update using current alpha RECT wnd = *r; - if ( !g_CluiData.fLayered) return ske_ReCreateBackImage(FALSE,0); + if (!g_CluiData.fLayered) return ske_ReCreateBackImage(FALSE, 0); if (g_pCachedWindow == NULL) return ske_ValidateFrameImageProc(&wnd); if (g_pCachedWindow->Width != wnd.right-wnd.left || g_pCachedWindow->Height != wnd.bottom-wnd.top) return ske_ValidateFrameImageProc(&wnd); - if (g_flag_bFullRepaint) - { + if (g_flag_bFullRepaint) { g_flag_bFullRepaint = 0; return ske_ValidateFrameImageProc(&wnd); } @@ -3752,7 +3577,7 @@ int ske_UpdateWindowImageRect(RECT *r) // Up return 0; } -void ske_ApplyTransluency() +void ske_ApplyTranslucency() { int IsTransparancy; HWND hwnd = pcli->hwndContactList; @@ -3761,9 +3586,10 @@ void ske_ApplyTransluency() IsTransparancy = g_CluiData.fSmoothAnimation || g_bTransparentFlag; if ( !g_bTransparentFlag && !g_CluiData.fSmoothAnimation && g_CluiData.bCurrentAlpha != 0) g_CluiData.bCurrentAlpha = 255; - if ( !g_CluiData.fLayered && IsTransparancy) - { - if ( !layered) SetWindowLongPtr(hwnd, GWL_EXSTYLE, GetWindowLongPtr(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED); + + if ( !g_CluiData.fLayered && IsTransparancy) { + if (!layered) + SetWindowLongPtr(hwnd, GWL_EXSTYLE, GetWindowLongPtr(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED); SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (BYTE)g_CluiData.bCurrentAlpha, LWA_ALPHA); } @@ -3774,43 +3600,37 @@ void ske_ApplyTransluency() int ske_JustUpdateWindowImage() { RECT r; - if ( !g_CluiData.fLayered) - { - ske_ApplyTransluency(); + if (!g_CluiData.fLayered) { + ske_ApplyTranslucency(); return 0; } GetWindowRect(pcli->hwndContactList,&r); return ske_JustUpdateWindowImageRect(&r); } + +// Update window image int ske_JustUpdateWindowImageRect(RECT *rty) -//Update window image { - BLENDFUNCTION bf = {AC_SRC_OVER, 0, g_CluiData.bCurrentAlpha, AC_SRC_ALPHA }; - POINT dest = {0}, src = {0}; - int res; - RECT wnd = *rty; - - RECT rect; - SIZE sz = {0}; - - if ( !g_CluiData.fLayered) - { - ske_ApplyTransluency(); + if (!g_CluiData.fLayered) { + ske_ApplyTranslucency(); return 0; } - if ( !pcli->hwndContactList) return 0; - rect = wnd; + if (!pcli->hwndContactList) + return 0; + + RECT wnd = *rty; + RECT rect = wnd; + POINT dest = { 0 }, src = { 0 }; dest.x = rect.left; dest.y = rect.top; - sz.cx = rect.right-rect.left; - sz.cy = rect.bottom-rect.top; - if (g_CluiData.fLayered) - { - if ( !(GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE)&WS_EX_LAYERED)) - SetWindowLongPtr(pcli->hwndContactList,GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) |WS_EX_LAYERED); - Sync( SetAlpha, g_CluiData.bCurrentAlpha ); - - res = UpdateLayeredWindow(pcli->hwndContactList,g_pCachedWindow->hScreenDC,&dest,&sz,g_pCachedWindow->hImageDC,&src,RGB(1,1,1),&bf,ULW_ALPHA); + SIZE sz = { rect.right - rect.left, rect.bottom - rect.top }; + if (g_CluiData.fLayered) { + if (!(GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE)&WS_EX_LAYERED)) + SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED); + Sync(SetAlpha, g_CluiData.bCurrentAlpha); + + BLENDFUNCTION bf = { AC_SRC_OVER, 0, g_CluiData.bCurrentAlpha, AC_SRC_ALPHA }; + UpdateLayeredWindow(pcli->hwndContactList, g_pCachedWindow->hScreenDC, &dest, &sz, g_pCachedWindow->hImageDC, &src, RGB(1, 1, 1), &bf, ULW_ALPHA); g_CluiData.fAeroGlass = false; CLUI_UpdateAeroGlass(); } @@ -3841,17 +3661,16 @@ static DWORD ske_HexToARGB(char * Hex) { char buf[10] = {0}; char buf2[11] = {0}; - char * st; - BYTE alpha; - DWORD AARRGGBB = 0; mir_snprintf(buf, SIZEOF(buf), "%s\n", Hex); if (buf[1] == 'x' || buf[1] == 'X') mir_snprintf(buf2, SIZEOF(buf2), "0x%s\n", buf+2); else mir_snprintf(buf2, SIZEOF(buf2), "0x%s\n", buf); buf2[10] = '\0'; - AARRGGBB = strtoul(buf2,&st,16); - alpha = (BYTE)((AARRGGBB&0xFF000000)>>24); + + char *st; + DWORD AARRGGBB = strtoul(buf2, &st, 16); + BYTE alpha = (BYTE)((AARRGGBB & 0xFF000000) >> 24); alpha = 255-((alpha == 0)?255:alpha); AARRGGBB = (alpha << 24)+((AARRGGBB&0x00FF0000)>>16)+((AARRGGBB&0x000000FF) << 16)+(AARRGGBB&0x0000FF00); return AARRGGBB; @@ -3872,15 +3691,14 @@ static TCHAR *ske_ReAppend(TCHAR *lfirst, TCHAR * lsecond, int len) TCHAR* ske_ReplaceVar(TCHAR *var) { if ( !var) return mir_tstrdup(_T("")); - if ( !lstrcmpi(var,_T("Profile"))) - { + if ( !lstrcmpi(var,_T("Profile"))) { char buf[MAX_PATH] = {0}; CallService(MS_DB_GETPROFILENAME,(WPARAM)MAX_PATH,(LPARAM)buf); - { - int i = strlen(buf); - while (buf[i] != '.' && i>0) i--; - buf[i] = '\0'; - } + + int i = strlen(buf); + while (buf[i] != '.' && i>0) i--; + buf[i] = '\0'; + mir_free(var); return mir_a2u(buf); } @@ -3888,6 +3706,7 @@ TCHAR* ske_ReplaceVar(TCHAR *var) mir_free(var); return mir_tstrdup(_T("")); } + TCHAR *ske_ParseText(TCHAR *stzText) { int len = lstrlen(stzText); @@ -3895,45 +3714,36 @@ TCHAR *ske_ParseText(TCHAR *stzText) int stpos = 0; int curpos = 0; - while(curpos < len) - { + while (curpos < len) { //1 find first % - while(curpos < len && stzText[curpos] != (TCHAR)'%') curpos++; - if (curpos < len) //% found - { + while (curpos < len && stzText[curpos] != (TCHAR)'%') + curpos++; + if (curpos < len) { //% found if (curpos-stpos>0) result = ske_ReAppend(result,stzText+stpos,curpos-stpos); stpos = curpos+1; curpos++; //3 find second % - while(curpos < len && stzText[curpos] != (TCHAR)'%') curpos++; - if (curpos < len) - { - if (curpos-stpos>0) - { - TCHAR *var = (TCHAR *)mir_alloc((curpos-stpos+1)*sizeof(TCHAR)); - memmove(var,stzText+stpos,(curpos-stpos)*sizeof(TCHAR)); - var[curpos-stpos] = (TCHAR)'\0'; - var = ske_ReplaceVar(var); - result = ske_ReAppend(result,var,0); - mir_free(var); - } - else result = ske_ReAppend(result,_T("%"),0); - + while(curpos < len && stzText[curpos] != (TCHAR)'%') curpos++; - stpos = curpos; - } - else - { - // if (curpos-stpos>0) - // result = ske_ReAppend(result,stzText+stpos,curpos-stpos); + if (curpos >= len) break; + if (curpos - stpos > 0) { + TCHAR *var = (TCHAR *)mir_alloc((curpos - stpos + 1)*sizeof(TCHAR)); + memmove(var, stzText + stpos, (curpos - stpos)*sizeof(TCHAR)); + var[curpos - stpos] = (TCHAR)'\0'; + var = ske_ReplaceVar(var); + result = ske_ReAppend(result, var, 0); + mir_free(var); } + else result = ske_ReAppend(result, _T("%"), 0); + + curpos++; + stpos = curpos; } - else - { - if (curpos-stpos>0) - result = ske_ReAppend(result,stzText+stpos,curpos-stpos); + else { + if (curpos - stpos > 0) + result = ske_ReAppend(result, stzText + stpos, curpos - stpos); break; } } @@ -3944,98 +3754,43 @@ TCHAR *ske_ParseText(TCHAR *stzText) * szGlyphTextID and Define string is: * t[szGlyphTextID] = s[HostObjectID],[Left],[Top],[Right],[Bottom],[LTRBHV],[FontID],[Color1],[reservedforColor2],[Text] */ -static void OLDske_AddParseTextGlyphObject(char * szGlyphTextID,char * szDefineString,SKINOBJECTSLIST *Skin) -{ - - GLYPHOBJECT *globj = NULL; - { - char buf[255] = {0}; - GetParamN(szDefineString,buf,sizeof(buf), 0, ',',TRUE); - if (strlen(buf)) - { - SKINOBJECTDESCRIPTOR * lpobj; - lpobj = ske_FindObjectByName(buf,OT_GLYPHOBJECT,Skin); - if (lpobj) - globj = (GLYPHOBJECT*)lpobj->Data; - } - if (globj) - { - GLYPHTEXT * glText; - - if ( !globj->plTextList) - { - globj->plTextList = List_Create(0, 1); - globj->plTextList->sortFunc = ske_SortTextGlyphObjectFunc; - } - glText = (GLYPHTEXT*)mir_calloc(sizeof(GLYPHTEXT)); - glText->szGlyphTextID = mir_strdup(szGlyphTextID); - glText->szObjectName = mir_strdup(buf); - glText->iLeft = atoi(GetParamN(szDefineString,buf,sizeof(buf),1,',',TRUE)); - glText->iTop = atoi(GetParamN(szDefineString,buf,sizeof(buf),2,',',TRUE)); - glText->iRight = atoi(GetParamN(szDefineString,buf,sizeof(buf),3,',',TRUE)); - glText->iBottom = atoi(GetParamN(szDefineString,buf,sizeof(buf),4,',',TRUE)); - { - memset(buf, 0, 6); - GetParamN(szDefineString,buf,sizeof(buf),5,',',TRUE); - buf[0] &= 95; buf[1] &= 95; buf[2] &= 95; buf[3] &= 95; buf[4] &= 95; buf[5] &= 95; //to uppercase: &01011111 (0-95) - glText->RelativeFlags = - (buf[0] == 'C'?1:((buf[0] == 'R')?2:0)) //[BC][RC][BC][RC] --- Left relative - |(buf[1] == 'C'?4:((buf[1] == 'B')?8:0)) // | | |--------- Top relative - |(buf[2] == 'C'?16:((buf[2] == 'R')?32:0)) // | |--------------Right relative - |(buf[3] == 'C'?64:((buf[3] == 'B')?128:0)); // |------------------Bottom relative - glText->dwFlags = (buf[4] == 'C'?DT_CENTER:((buf[4] == 'R')?DT_RIGHT:DT_LEFT)) - |(buf[5] == 'C'?DT_VCENTER:((buf[5] == 'B')?DT_BOTTOM:DT_TOP)); - } - glText->szFontID = mir_strdup(GetParamN(szDefineString,buf,sizeof(buf),6,',',TRUE)); - - glText->dwColor = ske_HexToARGB(GetParamN(szDefineString,buf,sizeof(buf),7,',',TRUE)); - glText->dwShadow = ske_HexToARGB(GetParamN(szDefineString,buf,sizeof(buf),8,',',TRUE)); - glText->stValueText = mir_a2u(GetParamN(szDefineString,buf,sizeof(buf),9,',',TRUE)); - glText->stText = ske_ParseText(glText->stValueText); - List_Insert(globj->plTextList,(void*)glText,globj->plTextList->realCount); - qsort(globj->plTextList->items,globj->plTextList->realCount,sizeof(void*),(int(*)(const void*, const void*))globj->plTextList->sortFunc); - } - } -} - static void ske_AddParseTextGlyphObject(char * szGlyphTextID,char * szDefineString,SKINOBJECTSLIST *Skin) { char buf[255] = {0}; GetParamN(szDefineString,buf,sizeof(buf), 0, ',',TRUE); - if (strlen(buf)) - { - GLYPHTEXT * glText; - glText = (GLYPHTEXT*)mir_calloc(sizeof(GLYPHTEXT)); - glText->szGlyphTextID = mir_strdup(szGlyphTextID); - glText->szObjectName = mir_strdup(buf); - glText->iLeft = atoi(GetParamN(szDefineString,buf,sizeof(buf),1,',',TRUE)); - glText->iTop = atoi(GetParamN(szDefineString,buf,sizeof(buf),2,',',TRUE)); - glText->iRight = atoi(GetParamN(szDefineString,buf,sizeof(buf),3,',',TRUE)); - glText->iBottom = atoi(GetParamN(szDefineString,buf,sizeof(buf),4,',',TRUE)); - { - memset(buf, 0, 6); - GetParamN(szDefineString,buf,sizeof(buf),5,',',TRUE); - buf[0] &= 95; buf[1] &= 95; buf[2] &= 95; buf[3] &= 95; buf[4] &= 95; buf[5] &= 95; //to uppercase: &01011111 (0-95) - glText->RelativeFlags = - (buf[0] == 'C'?1:((buf[0] == 'R')?2:0)) //[BC][RC][BC][RC] --- Left relative - |(buf[1] == 'C'?4:((buf[1] == 'B')?8:0)) // | | |--------- Top relative - |(buf[2] == 'C'?16:((buf[2] == 'R')?32:0)) // | |--------------Right relative - |(buf[3] == 'C'?64:((buf[3] == 'B')?128:0)); // |------------------Bottom relative - glText->dwFlags = (buf[4] == 'C'?DT_CENTER:((buf[4] == 'R')?DT_RIGHT:DT_LEFT)) - |(buf[5] == 'C'?DT_VCENTER:((buf[5] == 'B')?DT_BOTTOM:DT_TOP)); - } - glText->szFontID = mir_strdup(GetParamN(szDefineString,buf,sizeof(buf),6,',',TRUE)); - - glText->dwColor = ske_HexToARGB(GetParamN(szDefineString,buf,sizeof(buf),7,',',TRUE)); - glText->dwShadow = ske_HexToARGB(GetParamN(szDefineString,buf,sizeof(buf),8,',',TRUE)); - glText->stValueText = mir_a2u(GetParamN(szDefineString,buf,sizeof(buf),9,',',TRUE)); - glText->stText = ske_ParseText(glText->stValueText); + if (buf[0] == 0) + return; - if ( !Skin->pTextList) - Skin->pTextList = List_Create(0, 1); - List_InsertPtr(Skin->pTextList,glText); - } + GLYPHTEXT *glText = (GLYPHTEXT*)mir_calloc(sizeof(GLYPHTEXT)); + glText->szGlyphTextID = mir_strdup(szGlyphTextID); + glText->szObjectName = mir_strdup(buf); + glText->iLeft = atoi(GetParamN(szDefineString,buf,sizeof(buf),1,',',TRUE)); + glText->iTop = atoi(GetParamN(szDefineString,buf,sizeof(buf),2,',',TRUE)); + glText->iRight = atoi(GetParamN(szDefineString,buf,sizeof(buf),3,',',TRUE)); + glText->iBottom = atoi(GetParamN(szDefineString,buf,sizeof(buf),4,',',TRUE)); + { + memset(buf, 0, 6); + GetParamN(szDefineString,buf,sizeof(buf),5,',',TRUE); + buf[0] &= 95; buf[1] &= 95; buf[2] &= 95; buf[3] &= 95; buf[4] &= 95; buf[5] &= 95; //to uppercase: &01011111 (0-95) + glText->RelativeFlags = + (buf[0] == 'C'?1:((buf[0] == 'R')?2:0)) //[BC][RC][BC][RC] --- Left relative + |(buf[1] == 'C'?4:((buf[1] == 'B')?8:0)) // | | |--------- Top relative + |(buf[2] == 'C'?16:((buf[2] == 'R')?32:0)) // | |--------------Right relative + |(buf[3] == 'C'?64:((buf[3] == 'B')?128:0)); // |------------------Bottom relative + glText->dwFlags = (buf[4] == 'C'?DT_CENTER:((buf[4] == 'R')?DT_RIGHT:DT_LEFT)) + |(buf[5] == 'C'?DT_VCENTER:((buf[5] == 'B')?DT_BOTTOM:DT_TOP)); + } + glText->szFontID = mir_strdup(GetParamN(szDefineString,buf,sizeof(buf),6,',',TRUE)); + + glText->dwColor = ske_HexToARGB(GetParamN(szDefineString,buf,sizeof(buf),7,',',TRUE)); + glText->dwShadow = ske_HexToARGB(GetParamN(szDefineString,buf,sizeof(buf),8,',',TRUE)); + glText->stValueText = mir_a2u(GetParamN(szDefineString,buf,sizeof(buf),9,',',TRUE)); + glText->stText = ske_ParseText(glText->stValueText); + + if ( !Skin->pTextList) + Skin->pTextList = List_Create(0, 1); + List_InsertPtr(Skin->pTextList,glText); } @@ -4085,97 +3840,49 @@ static void ske_AddParseSkinFont(char * szFontID,char * szDefineString,SKINOBJEC } /* -HICON ske_CreateJoinedIcon_Old(HICON hBottom, HICON hTop,BYTE alpha) -{ -HDC tempDC; -HICON res = NULL; -HBITMAP oImage,nImage; -HBITMAP nMask; -ICONINFO iNew = {0}; -ICONINFO iciBottom = {0}; -ICONINFO iciTop = {0}; -BITMAP bmp = {0}; -SIZE sz = {0}; -{ -if ( !GetIconInfo(hBottom,&iciBottom)) return NULL; -GetObject(iciBottom.hbmColor,sizeof(BITMAP),&bmp); -sz.cx = bmp.bmWidth; sz.cy = bmp.bmHeight; -if (iciBottom.hbmColor) DeleteObject(iciBottom.hbmColor); -if (iciBottom.hbmMask) DeleteObject(iciBottom.hbmMask); -} -if (sz.cx == 0 || sz.cy == 0) return NULL; -tempDC = CreateCompatibleDC(NULL); -nImage = ske_CreateDIB32(sz.cx,sz.cy); -oImage = SelectObject(tempDC,nImage); -ske_DrawIconEx(tempDC, 0, 0, hBottom,sz.cx,sz.cy, 0, NULL,DI_NORMAL); -ske_DrawIconEx(tempDC, 0, 0, hTop,sz.cx,sz.cy, 0, NULL,DI_NORMAL|(alpha << 24)); -SelectObject(tempDC,oImage); -DeleteDC(tempDC); -{ -BYTE * p = malloc(sz.cx*sz.cy/8+10); -nMask = CreateBitmap(sz.cx,sz.cy,1,1,(void*)p); -iNew.fIcon = TRUE; -iNew.hbmColor = nImage; -iNew.hbmMask = nMask; -res = CreateIconIndirect(&iNew); -if ( !res) -TRACE_ERROR(); -DeleteObject(nImage); -DeleteObject(nMask); -free(p); -} -return res; -} -*/ - - -/* -* ske_CheckHasAlfaChannel - checks if image has at least one BYTE in alpha chennel -* that is not a 0. (is image real 32 bit or just 24 bit) -*/ + * ske_CheckHasAlfaChannel - checks if image has at least one BYTE in alpha chennel + * that is not a 0. (is image real 32 bit or just 24 bit) + */ static BOOL ske_CheckHasAlfaChannel(BYTE * from, int widthByte, int height) { - int i=0, j = 0; - DWORD * pt = (DWORD*)from; - while (j < height) - { - BYTE * add = (BYTE*)pt+widthByte; - while (pt < (DWORD*)add) - { - if ((*pt&0xFF000000) != 0) return TRUE; + DWORD *pt = (DWORD*)from; + for (int j = 0; j < height; j++) { + BYTE *add = (BYTE*)pt+widthByte; + while (pt < (DWORD*)add) { + if ((*pt & 0xFF000000) != 0) + return TRUE; pt++; } pt = (DWORD*)(from+widthByte*j); - j++; } return FALSE; } /* -* ske_CheckIconHasMask - checks if mask image has at least one that is not a 0. -* Not sure is ir required or not -*/ + * ske_CheckIconHasMask - checks if mask image has at least one that is not a 0. + * Not sure is ir required or not + */ static BOOL ske_CheckIconHasMask(BYTE * from) { - int i=0; - for (i=0; i < 16*16/8; i++) - { - if (from[i] != 0) return TRUE; - } + for (int i=0; i < 16*16/8; i++) + if (from[i] != 0) + return TRUE; + return FALSE; } /* -* ske_GetMaskBit - return value of apropriate mask bit in line at x position -*/ + * ske_GetMaskBit - return value of apropriate mask bit in line at x position + */ static BOOL ske_GetMaskBit(BYTE *line, int x) { return ((*(line+(x>>3)))&(0x01 << (7-(x&0x07)))) != 0; } + /* -* ske_Blend - alpha ske_Blend ARGB values of 2 pixels. X1 - underlaying, -* X2 - overlaying points. -*/ + * ske_Blend - alpha ske_Blend ARGB values of 2 pixels. X1 - underlaying, + * X2 - overlaying points. + */ static DWORD ske_Blend(DWORD X1,DWORD X2, BYTE alpha) { @@ -4204,145 +3911,130 @@ static DWORD ske_Blend(DWORD X1,DWORD X2, BYTE alpha) if (ar == 0) return 0; - //else - { - WORD arm = ar*255; - WORD rr = (((WORD)r1*am+(WORD)r2*a2*255))/arm; - WORD gr = (((WORD)g1*am+(WORD)g2*a2*255))/arm; - WORD br = (((WORD)b1*am+(WORD)b2*a2*255))/arm; - return (ar << 24)|(rr << 16)|(gr << 8)|br; - } - + WORD arm = ar*255; + WORD rr = (((WORD)r1*am+(WORD)r2*a2*255))/arm; + WORD gr = (((WORD)g1*am+(WORD)g2*a2*255))/arm; + WORD br = (((WORD)b1*am+(WORD)b2*a2*255))/arm; + return (ar << 24)|(rr << 16)|(gr << 8)|br; } + /* -* CreateJoinedIcon - creates new icon by drawing hTop over hBottom. -*/ + * CreateJoinedIcon - creates new icon by drawing hTop over hBottom. + */ + HICON ske_CreateJoinedIcon(HICON hBottom, HICON hTop, BYTE alpha) { - HDC tempDC; - HICON res = NULL; - HBITMAP oImage,nImage; HBITMAP nMask; - BITMAP bmp = {0}; + BITMAP bmp = { 0 }; BYTE *ptPixels; - ICONINFO iNew = {0}; - ICONINFO iciBottom = {0}; - ICONINFO iciTop = {0}; + ICONINFO iNew = { 0 }; + ICONINFO iciBottom = { 0 }; + ICONINFO iciTop = { 0 }; - BITMAP bmp_top = {0}; - BITMAP bmp_top_mask = {0}; + BITMAP bmp_top = { 0 }; + BITMAP bmp_top_mask = { 0 }; - BITMAP bmp_bottom = {0}; - BITMAP bmp_bottom_mask = {0}; + BITMAP bmp_bottom = { 0 }; + BITMAP bmp_bottom_mask = { 0 }; - tempDC = CreateCompatibleDC(NULL); - nImage = ske_CreateDIB32Point(16,16,(void**)&ptPixels); - oImage = (HBITMAP)SelectObject(tempDC,nImage); + HDC tempDC = CreateCompatibleDC(NULL); + HBITMAP nImage = ske_CreateDIB32Point(16, 16, (void**)&ptPixels); + HBITMAP oImage = (HBITMAP)SelectObject(tempDC, nImage); - GetIconInfo(hBottom,&iciBottom); - GetObject(iciBottom.hbmColor,sizeof(BITMAP),&bmp_bottom); - GetObject(iciBottom.hbmMask,sizeof(BITMAP),&bmp_bottom_mask); + GetIconInfo(hBottom, &iciBottom); + GetObject(iciBottom.hbmColor, sizeof(BITMAP), &bmp_bottom); + GetObject(iciBottom.hbmMask, sizeof(BITMAP), &bmp_bottom_mask); - GetIconInfo(hTop,&iciTop); - GetObject(iciTop.hbmColor,sizeof(BITMAP),&bmp_top); - GetObject(iciTop.hbmMask,sizeof(BITMAP),&bmp_top_mask); + GetIconInfo(hTop, &iciTop); + GetObject(iciTop.hbmColor, sizeof(BITMAP), &bmp_top); + GetObject(iciTop.hbmMask, sizeof(BITMAP), &bmp_top_mask); - if (bmp_bottom.bmBitsPixel == 32 && bmp_top.bmBitsPixel == 32) - { - BYTE * BottomBuffer, * TopBuffer, * BottomMaskBuffer, * TopMaskBuffer; - BYTE * bb, * tb, * bmb, * tmb; - BYTE * db = ptPixels; - int vstep_d = 16*4; + if (bmp_bottom.bmBitsPixel == 32 && bmp_top.bmBitsPixel == 32) { + BYTE *BottomBuffer, *TopBuffer, *BottomMaskBuffer, *TopMaskBuffer; + BYTE *bb, *tb, *bmb, *tmb; + BYTE *db = ptPixels; + int vstep_d = 16 * 4; int vstep_b = bmp_bottom.bmWidthBytes; int vstep_t = bmp_top.bmWidthBytes; int vstep_bm = bmp_bottom_mask.bmWidthBytes; int vstep_tm = bmp_top_mask.bmWidthBytes; - alpha = alpha?alpha:255; + alpha = alpha ? alpha : 255; if (bmp_bottom.bmBits) bb = BottomBuffer = (BYTE*)bmp_bottom.bmBits; - else - { + else { BottomBuffer = (BYTE*)malloc(bmp_bottom.bmHeight*bmp_bottom.bmWidthBytes); - GetBitmapBits(iciBottom.hbmColor,bmp_bottom.bmHeight*bmp_bottom.bmWidthBytes,BottomBuffer); - bb = BottomBuffer+vstep_b*(bmp_bottom.bmHeight-1); + GetBitmapBits(iciBottom.hbmColor, bmp_bottom.bmHeight*bmp_bottom.bmWidthBytes, BottomBuffer); + bb = BottomBuffer + vstep_b*(bmp_bottom.bmHeight - 1); vstep_b = -vstep_b; } + if (bmp_top.bmBits) tb = TopBuffer = (BYTE*)bmp_top.bmBits; - else - { + else { TopBuffer = (BYTE*)malloc(bmp_top.bmHeight*bmp_top.bmWidthBytes); GetBitmapBits(iciTop.hbmColor,bmp_top.bmHeight*bmp_top.bmWidthBytes,TopBuffer); tb = TopBuffer+vstep_t*(bmp_top.bmHeight-1); vstep_t = -vstep_t; } - if (bmp_bottom_mask.bmBits) - { + + if (bmp_bottom_mask.bmBits) { BottomMaskBuffer = (BYTE*)bmp_bottom_mask.bmBits; bmb = BottomMaskBuffer; } - else - { + else { BottomMaskBuffer = (BYTE*)malloc(bmp_bottom_mask.bmHeight*bmp_bottom_mask.bmWidthBytes); GetBitmapBits(iciBottom.hbmMask,bmp_bottom_mask.bmHeight*bmp_bottom_mask.bmWidthBytes,BottomMaskBuffer); bmb = BottomMaskBuffer+vstep_bm*(bmp_bottom_mask.bmHeight-1); vstep_bm = -vstep_bm; } - if (bmp_top_mask.bmBits) - { + + if (bmp_top_mask.bmBits) { TopMaskBuffer = (BYTE*)bmp_top_mask.bmBits; tmb = TopMaskBuffer; - } - else - { + else { TopMaskBuffer = (BYTE*)malloc(bmp_top_mask.bmHeight*bmp_top_mask.bmWidthBytes); GetBitmapBits(iciTop.hbmMask,bmp_top_mask.bmHeight*bmp_top_mask.bmWidthBytes,TopMaskBuffer); tmb = TopMaskBuffer+vstep_tm*(bmp_top_mask.bmHeight-1); vstep_tm = -vstep_tm; } - { - int x = 0; int y = 0; - BOOL topHasAlpha = ske_CheckHasAlfaChannel(TopBuffer,bmp_top.bmWidthBytes,bmp_top.bmHeight); - BOOL bottomHasAlpha = ske_CheckHasAlfaChannel(BottomBuffer,bmp_bottom.bmWidthBytes,bmp_bottom.bmHeight); - BOOL topHasMask = ske_CheckIconHasMask(TopMaskBuffer); - BOOL bottomHasMask = ske_CheckIconHasMask(BottomMaskBuffer); - for (y = 0; y < 16; y++) - { - for (x = 0; x < 16; x++) - { - BOOL mask_b = ske_GetMaskBit(bmb,x); - BOOL mask_t = ske_GetMaskBit(tmb,x); - DWORD bottom_d = ((DWORD*)bb)[x]; - DWORD top_d = ((DWORD*)tb)[x]; - if (topHasMask) - { - if (mask_t == 1 && !topHasAlpha ) top_d &= 0xFFFFFF; - else if ( !topHasAlpha) top_d |= 0xFF000000; - } - if (bottomHasMask) - { - if (mask_b == 1 && !bottomHasAlpha) bottom_d &= 0xFFFFFF; - else if ( !bottomHasAlpha) bottom_d |= 0xFF000000; - } - ((DWORD*)db)[x] = ske_Blend(bottom_d,top_d,alpha); + + BOOL topHasAlpha = ske_CheckHasAlfaChannel(TopBuffer, bmp_top.bmWidthBytes, bmp_top.bmHeight); + BOOL bottomHasAlpha = ske_CheckHasAlfaChannel(BottomBuffer, bmp_bottom.bmWidthBytes, bmp_bottom.bmHeight); + BOOL topHasMask = ske_CheckIconHasMask(TopMaskBuffer); + BOOL bottomHasMask = ske_CheckIconHasMask(BottomMaskBuffer); + for (int y = 0; y < 16; y++) { + for (int x = 0; x < 16; x++) { + BOOL mask_b = ske_GetMaskBit(bmb, x); + BOOL mask_t = ske_GetMaskBit(tmb, x); + DWORD bottom_d = ((DWORD*)bb)[x]; + DWORD top_d = ((DWORD*)tb)[x]; + if (topHasMask) { + if (mask_t == 1 && !topHasAlpha) top_d &= 0xFFFFFF; + else if (!topHasAlpha) top_d |= 0xFF000000; } - bb += vstep_b; - tb += vstep_t; - bmb += vstep_bm; - tmb += vstep_tm; - db += vstep_d; + if (bottomHasMask) { + if (mask_b == 1 && !bottomHasAlpha) bottom_d &= 0xFFFFFF; + else if (!bottomHasAlpha) bottom_d |= 0xFF000000; + } + ((DWORD*)db)[x] = ske_Blend(bottom_d, top_d, alpha); } + bb += vstep_b; + tb += vstep_t; + bmb += vstep_bm; + tmb += vstep_tm; + db += vstep_d; } - if ( !bmp_bottom.bmBits) free(BottomBuffer); - if ( !bmp_top.bmBits) free(TopBuffer); - if ( !bmp_bottom_mask.bmBits) free(BottomMaskBuffer); - if ( !bmp_top_mask.bmBits) free(TopMaskBuffer); + + if (!bmp_bottom.bmBits) free(BottomBuffer); + if (!bmp_top.bmBits) free(TopBuffer); + if (!bmp_bottom_mask.bmBits) free(BottomMaskBuffer); + if (!bmp_top_mask.bmBits) free(TopMaskBuffer); } - else - { + else { ske_DrawIconEx(tempDC, 0, 0, hBottom,16,16, 0, NULL,DI_NORMAL); ske_DrawIconEx(tempDC, 0, 0, hTop,16,16, 0, NULL,DI_NORMAL|(alpha << 24)); } + DeleteObject(iciBottom.hbmColor); DeleteObject(iciTop.hbmColor); DeleteObject(iciBottom.hbmMask); @@ -4350,33 +4042,30 @@ HICON ske_CreateJoinedIcon(HICON hBottom, HICON hTop, BYTE alpha) SelectObject(tempDC,oImage); DeleteDC(tempDC); + + BYTE p[32] = {0}; + nMask = CreateBitmap(16,16,1,1,(void*)&p); { - //BYTE *p = malloc(32); - //memset(p, 0, 32); - BYTE p[32] = {0}; - nMask = CreateBitmap(16,16,1,1,(void*)&p); - { - HDC tempDC2 = CreateCompatibleDC(NULL); - HDC tempDC3 = CreateCompatibleDC(NULL); - HBITMAP hbm = CreateCompatibleBitmap(tempDC3,16,16); - HBITMAP obmp = (HBITMAP)SelectObject(tempDC2,nMask); - HBITMAP obmp2 = (HBITMAP)SelectObject(tempDC3,hbm); - DrawIconEx(tempDC2, 0, 0, hBottom,16,16, 0, NULL,DI_MASK); - DrawIconEx(tempDC3, 0, 0, hTop,16,16, 0, NULL,DI_MASK); - BitBlt(tempDC2, 0, 0, 16,16,tempDC3, 0, 0, SRCAND); - SelectObject(tempDC2,obmp); - SelectObject(tempDC3,obmp2); - DeleteObject(hbm); - DeleteDC(tempDC2); - DeleteDC(tempDC3); - } - iNew.fIcon = TRUE; - iNew.hbmColor = nImage; - iNew.hbmMask = nMask; - res = CreateIconIndirect(&iNew); - DeleteObject(nImage); - DeleteObject(nMask); - } + HDC tempDC2 = CreateCompatibleDC(NULL); + HDC tempDC3 = CreateCompatibleDC(NULL); + HBITMAP hbm = CreateCompatibleBitmap(tempDC3,16,16); + HBITMAP obmp = (HBITMAP)SelectObject(tempDC2,nMask); + HBITMAP obmp2 = (HBITMAP)SelectObject(tempDC3,hbm); + DrawIconEx(tempDC2, 0, 0, hBottom,16,16, 0, NULL,DI_MASK); + DrawIconEx(tempDC3, 0, 0, hTop,16,16, 0, NULL,DI_MASK); + BitBlt(tempDC2, 0, 0, 16,16,tempDC3, 0, 0, SRCAND); + SelectObject(tempDC2,obmp); + SelectObject(tempDC3,obmp2); + DeleteObject(hbm); + DeleteDC(tempDC2); + DeleteDC(tempDC3); + } + iNew.fIcon = TRUE; + iNew.hbmColor = nImage; + iNew.hbmMask = nMask; + HICON res = CreateIconIndirect(&iNew); + DeleteObject(nImage); + DeleteObject(nMask); return res; } @@ -4391,33 +4080,35 @@ HICON ske_CreateJoinedIcon(HICON hBottom, HICON hTop, BYTE alpha) #define SKINSETSECTION "SkinnedSettings" -BOOL SkinDBGetContactSetting(HANDLE hContact, const char* szSection, const char*szKey, DBVARIANT * retdbv, BOOL * bSkined ) +BOOL SkinDBGetContactSetting(HANDLE hContact, const char* szSection, const char*szKey, DBVARIANT * retdbv, BOOL * bSkinned ) { - if ( !hContact) { //only for not contact settings - char * szSkinKey; - NEWJOINEDSTR(szSkinKey,szSection,"@",szKey); - if ( !db_get(hContact, SKINSETSECTION, szSkinKey, retdbv)) { - if (bSkined) *bSkined = TRUE; + if (!hContact) { //only for not contact settings + char *szSkinKey; + NEWJOINEDSTR(szSkinKey, szSection, "@", szKey); + if (!db_get(hContact, SKINSETSECTION, szSkinKey, retdbv)) { + if (bSkinned) *bSkinned = TRUE; return FALSE; - } } + } + } // not skinned - if (bSkined) bSkined = FALSE; + if (bSkinned) bSkinned = FALSE; return db_get(hContact, szSection, szKey, retdbv); } BYTE SkinDBGetContactSettingByte(HANDLE hContact, const char* szSection, const char*szKey, BYTE bDefault) { - DBVARIANT dbv = {0}; - BOOL bSkined = FALSE; - if ( !SkinDBGetContactSetting(hContact, szSection, szKey, &dbv, &bSkined)) { - if (dbv.type == DBVT_BYTE) - { + DBVARIANT dbv = { 0 }; + BOOL bSkinned = FALSE; + if (!SkinDBGetContactSetting(hContact, szSection, szKey, &dbv, &bSkinned)) { + if (dbv.type == DBVT_BYTE) { BYTE retVal = dbv.bVal; db_free(&dbv); return retVal; - } else { + } + else { db_free(&dbv); - if ( !bSkined) return db_get_b(hContact, szSection, szKey, bDefault); + if (!bSkinned) + return db_get_b(hContact, szSection, szKey, bDefault); } } return bDefault; @@ -4425,34 +4116,34 @@ BYTE SkinDBGetContactSettingByte(HANDLE hContact, const char* szSection, const c WORD SkinDBGetContactSettingWord(HANDLE hContact, const char* szSection, const char*szKey, WORD wDefault) { - BOOL bSkined = FALSE; - DBVARIANT dbv = {0}; - if ( !SkinDBGetContactSetting(hContact, szSection, szKey, &dbv, &bSkined)) { + BOOL bSkinned = FALSE; + DBVARIANT dbv = { 0 }; + if (!SkinDBGetContactSetting(hContact, szSection, szKey, &dbv, &bSkinned)) { if (dbv.type == DBVT_WORD) { WORD retVal = dbv.wVal; db_free(&dbv); return retVal; - } else { - db_free(&dbv); - if ( !bSkined) return db_get_w(hContact, szSection, szKey, wDefault); } + db_free(&dbv); + if (!bSkinned) + return db_get_w(hContact, szSection, szKey, wDefault); } return wDefault; } DWORD SkinDBGetContactSettingDword(HANDLE hContact, const char* szSection, const char*szKey, DWORD dwDefault) { - DBVARIANT dbv = {0}; - BOOL bSkined = FALSE; - if ( !SkinDBGetContactSetting(hContact, szSection, szKey, &dbv, &bSkined)) { + DBVARIANT dbv = { 0 }; + BOOL bSkinned = FALSE; + if (!SkinDBGetContactSetting(hContact, szSection, szKey, &dbv, &bSkinned)) { if (dbv.type == DBVT_DWORD) { DWORD retVal = dbv.dVal; db_free(&dbv); return retVal; - } else { - db_free(&dbv); - if ( !bSkined) return db_get_dw(hContact, szSection, szKey, dwDefault); } + db_free(&dbv); + if (!bSkinned) + return db_get_dw(hContact, szSection, szKey, dwDefault); } return dwDefault; } diff --git a/plugins/Clist_modern/src/modern_skinselector.cpp b/plugins/Clist_modern/src/modern_skinselector.cpp index 759b1a5193..2e242807b6 100644 --- a/plugins/Clist_modern/src/modern_skinselector.cpp +++ b/plugins/Clist_modern/src/modern_skinselector.cpp @@ -35,7 +35,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. char * ModernMaskToString(MODERNMASK *mm, char * buf, UINT bufsize) { int i=0; - for (i=0; i < (int)mm->dwParamCnt;i++) + for (i=0; i < (int)mm->dwParamCnt; i++) { if (mm->pl_Params[i].bMaskParamFlag) { @@ -54,7 +54,7 @@ int SkinSelector_DeleteMask(MODERNMASK *mm) { int i; if ( !mm->pl_Params) return 0; - for (i=0;i < (int)mm->dwParamCnt;i++) + for (i=0; i < (int)mm->dwParamCnt; i++) { free(mm->pl_Params[i].szName); free(mm->pl_Params[i].szValue); @@ -121,7 +121,7 @@ lph_top: //only 4 of 9 instructions in here don't use AL, so optimal pipe use i DWORD hash = 0; int i; int shift = 0; - for (i=0;szStr[i];i++) { + for (i=0;szStr[i]; i++) { hash ^= szStr[i] << shift; if (shift>24) hash ^= (szStr[i]>>(32-shift))&0x7F; shift = (shift+5)&0x1F; diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp index cb2bf5bc63..928b8a0d59 100644 --- a/plugins/Clist_modern/src/modern_viewmodebar.cpp +++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp @@ -711,7 +711,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETGREYOUTFLAGS, 0, 0); SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETLEFTMARGIN,2,0); SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETINDENT,10, 0); - for (i=0;i <= FONTID_MAX;i++) + for (i=0; i <= FONTID_MAX; i++) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETTEXTCOLOR,i,GetSysColor(COLOR_WINDOWTEXT)); CLCINFOITEM cii = { sizeof(cii) }; -- cgit v1.2.3