From 6ba9eb829a0b95bf9e6c6bdc9ed37d1d3947b87b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 7 Jul 2012 07:42:40 +0000 Subject: correct mir_free usage git-svn-id: http://svn.miranda-ng.org/main/trunk@808 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/modern_aniavatars.cpp | 19 +- plugins/Clist_modern/modern_awaymsg.cpp | 2 +- plugins/Clist_modern/modern_cachefuncs.cpp | 1130 ++++++++++----------- plugins/Clist_modern/modern_clc.cpp | 26 +- plugins/Clist_modern/modern_clcidents.cpp | 8 +- plugins/Clist_modern/modern_clcitems.cpp | 12 +- plugins/Clist_modern/modern_clcopts.cpp | 58 +- plugins/Clist_modern/modern_clcpaint.cpp | 62 +- plugins/Clist_modern/modern_clcutils.cpp | 26 +- plugins/Clist_modern/modern_clistmod.cpp | 6 +- plugins/Clist_modern/modern_clistopts.cpp | 38 +- plugins/Clist_modern/modern_clistsettings.cpp | 111 +- plugins/Clist_modern/modern_clisttray.cpp | 20 +- plugins/Clist_modern/modern_clui.cpp | 82 +- plugins/Clist_modern/modern_cluiframes.cpp | 175 ++-- plugins/Clist_modern/modern_commonheaders.cpp | 2 +- plugins/Clist_modern/modern_docking.cpp | 8 +- plugins/Clist_modern/modern_extraimage.cpp | 12 +- plugins/Clist_modern/modern_framesmenu.cpp | 2 +- plugins/Clist_modern/modern_groupmenu.cpp | 6 +- plugins/Clist_modern/modern_row.cpp | 10 +- plugins/Clist_modern/modern_rowheight_funcs.cpp | 16 +- plugins/Clist_modern/modern_skinbutton.cpp | 23 +- plugins/Clist_modern/modern_skineditor.cpp | 20 +- plugins/Clist_modern/modern_skinengine.cpp | 51 +- plugins/Clist_modern/modern_skinopt.cpp | 19 +- plugins/Clist_modern/modern_skinselector.cpp | 6 +- plugins/Clist_modern/modern_statusbar.cpp | 14 +- plugins/Clist_modern/modern_statusbar_options.cpp | 381 +++---- plugins/Clist_modern/modern_tbbutton.cpp | 22 +- plugins/Clist_modern/modern_toolbar.cpp | 23 +- plugins/Clist_modern/modern_viewmodebar.cpp | 79 +- plugins/Clist_modern/modern_xptheme.cpp | 1 + plugins/Clist_modern/resource.rc | 2 +- 34 files changed, 1141 insertions(+), 1331 deletions(-) diff --git a/plugins/Clist_modern/modern_aniavatars.cpp b/plugins/Clist_modern/modern_aniavatars.cpp index 7e5d2e773f..7c4b166eca 100644 --- a/plugins/Clist_modern/modern_aniavatars.cpp +++ b/plugins/Clist_modern/modern_aniavatars.cpp @@ -194,8 +194,8 @@ int AniAva_InitModule() { memset(&AniAva,0,sizeof(AniAva)); if (g_CluiData.fGDIPlusFail) return 0; - if (!( db_get_b(NULL,"CList","AvatarsAnimated",(ServiceExists(MS_AV_GETAVATARBITMAP)&&!g_CluiData.fGDIPlusFail)) - && db_get_b(NULL,"CList","AvatarsShow",SETTINGS_SHOWAVATARS_DEFAULT)) ) return 0; + if (!( db_get_b(NULL,"CList","AvatarsAnimated",(ServiceExists(MS_AV_GETAVATARBITMAP) && !g_CluiData.fGDIPlusFail)) + && db_get_b(NULL,"CList","AvatarsShow",SETTINGS_SHOWAVATARS_DEFAULT)) ) return 0; { WNDCLASSEX wc; ZeroMemory(&wc, sizeof(wc)); @@ -233,9 +233,8 @@ int AniAva_UnloadModule() for (i=0; i < AniAva.Objects->realCount; i++) { if (AniAva.Objects->items[i]) - { _AniAva_DestroyAvatarWindow(((ANIAVA_OBJECT*)AniAva.Objects->items[i])->hWindow); - } + mir_free(AniAva.Objects->items[i]); } List_Destroy(AniAva.Objects); @@ -244,7 +243,7 @@ int AniAva_UnloadModule() for (i=0; i < AniAva.AniAvatarList->realCount; i++) { ANIAVA_INFO * aai = (ANIAVA_INFO *)AniAva.AniAvatarList->items[i]; - if (aai->tcsFilename) mir_free(aai->tcsFilename); + mir_free(aai->tcsFilename); if (aai->pFrameDelays) free(aai->pFrameDelays); mir_free(aai); } @@ -263,8 +262,8 @@ int AniAva_UpdateOptions() { BOOL bReloadAvatars = FALSE; BOOL bBeEnabled = (!g_CluiData.fGDIPlusFail - && db_get_b(NULL,"CList","AvatarsAnimated",(ServiceExists(MS_AV_GETAVATARBITMAP)&&!g_CluiData.fGDIPlusFail)) - && db_get_b(NULL,"CList","AvatarsShow",SETTINGS_SHOWAVATARS_DEFAULT)); + && db_get_b(NULL,"CList","AvatarsAnimated",(ServiceExists(MS_AV_GETAVATARBITMAP) && !g_CluiData.fGDIPlusFail)) + && db_get_b(NULL,"CList","AvatarsShow",SETTINGS_SHOWAVATARS_DEFAULT)); if (bBeEnabled && !AniAva.bModuleStarted) { AniAva_InitModule(); @@ -574,7 +573,7 @@ static void _AniAva_RealRemoveAvatar(DWORD UniqueID) #ifdef _DEBUG __AniAva_DebugRenderStrip(); #endif - if (aai->tcsFilename) mir_free(aai->tcsFilename); + mir_free(aai->tcsFilename); if (aai->pFrameDelays) free(aai->pFrameDelays); _AniAva_ReduceAvatarImages(aai->nStripTop,aai->FrameSize.cx*aai->nFrameCount, FALSE); for (k = 0; k < AniAva.AniAvatarList->realCount; k++) @@ -1071,7 +1070,7 @@ static int _AniAva_SortAvatarInfo(void * first, void * last) int res = 0; ANIAVA_INFO * aai1 = (ANIAVA_INFO *)first; ANIAVA_INFO * aai2 = (ANIAVA_INFO *)last; - if (aai1 && aai1->tcsFilename && + if (aai1 && aai1->tcsFilename && aai2 && aai2->tcsFilename) { res = _tcsicmp(aai2->tcsFilename, aai1->tcsFilename); @@ -1105,7 +1104,7 @@ void _AniAva_InvalidateParent(ANIAVA_WINDOWINFO * dat) static LRESULT CALLBACK _AniAva_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { ANIAVA_WINDOWINFO * dat = NULL; - if (msg == WM_TIMER || msg == WM_DESTROY || (msg>AAM_FIRST && msg < AAM_LAST)) + if (msg == WM_TIMER || msg == WM_DESTROY || (msg>AAM_FIRST && msg < AAM_LAST)) dat = (ANIAVA_WINDOWINFO *)GetWindowLongPtr(hwnd, GWLP_USERDATA); switch (msg) diff --git a/plugins/Clist_modern/modern_awaymsg.cpp b/plugins/Clist_modern/modern_awaymsg.cpp index b9575a39f6..387662caac 100644 --- a/plugins/Clist_modern/modern_awaymsg.cpp +++ b/plugins/Clist_modern/modern_awaymsg.cpp @@ -166,7 +166,7 @@ static int amThreadProc(HWND hwnd) { i++; SleepEx(50,TRUE); - } while (i < AMASKPERIOD/50&&!MirandaExiting()); + } while (i < AMASKPERIOD/50 && !MirandaExiting()); } else break; if (MirandaExiting()) diff --git a/plugins/Clist_modern/modern_cachefuncs.cpp b/plugins/Clist_modern/modern_cachefuncs.cpp index fa3850c66a..343321d503 100644 --- a/plugins/Clist_modern/modern_cachefuncs.cpp +++ b/plugins/Clist_modern/modern_cachefuncs.cpp @@ -62,8 +62,7 @@ void Cache_GetTimezone(struct ClcData *dat, HANDLE hContact) if (dat == NULL && pcli->hwndContactTree) dat = (struct ClcData *)GetWindowLongPtr(pcli->hwndContactTree,0); - if (dat && dat->hWnd == pcli->hwndContactTree) - { + if (dat && dat->hWnd == pcli->hwndContactTree) { DWORD flags = dat->contact_time_show_only_if_different ? TZF_DIFONLY : 0; pdnce->hTimeZone = tmi.createByContact ? tmi.createByContact(hContact, flags) : 0; } @@ -75,74 +74,71 @@ void Cache_GetTimezone(struct ClcData *dat, HANDLE hContact) void Cache_GetText(struct ClcData *dat, struct ClcContact *contact, BOOL forceRenew) { - Cache_GetFirstLineText(dat, contact); - if (!dat->force_in_dialog)// && !dat->isStarting) - { - PDNCE pdnce = (PDNCE)pcli->pfnGetCacheEntry(contact->hContact); - if ( (dat->second_line_show&&(forceRenew||pdnce->szSecondLineText == NULL)) - ||(dat->third_line_show&&(forceRenew||pdnce->szThirdLineText == NULL)) ) - { - gtaAddRequest(dat,contact, contact->hContact); - } - } + Cache_GetFirstLineText(dat, contact); + if (!dat->force_in_dialog) { + PDNCE pdnce = (PDNCE)pcli->pfnGetCacheEntry(contact->hContact); + + if ((dat->second_line_show && (forceRenew || pdnce->szSecondLineText == NULL)) || (dat->third_line_show && (forceRenew || pdnce->szThirdLineText == NULL))) + gtaAddRequest(dat,contact, contact->hContact); + } } void CSmileyString::AddListeningToIcon(struct SHORTDATA *dat, PDNCE pdnce, TCHAR *szText, BOOL replace_smileys) { - iMaxSmileyHeight = 0; + iMaxSmileyHeight = 0; DestroySmileyList(); - if (szText == NULL) return; + if (szText == NULL) return; int text_size = (int)_tcslen( szText ); - - plText = List_Create( 0, 1 ); - - // Add Icon - { - BITMAP bm; - - ICONINFO icon; - ClcContactTextPiece *piece = (ClcContactTextPiece *) mir_alloc(sizeof(ClcContactTextPiece)); - - piece->type = TEXT_PIECE_TYPE_SMILEY; - piece->len = 0; - piece->smiley = g_hListeningToIcon; - - piece->smiley_width = 16; - piece->smiley_height = 16; - if (GetIconInfo(piece->smiley, &icon)) - { - if (GetObject(icon.hbmColor,sizeof(BITMAP),&bm)) - { - piece->smiley_width = bm.bmWidth; - piece->smiley_height = bm.bmHeight; - } - - DeleteObject(icon.hbmMask); - DeleteObject(icon.hbmColor); - } - - dat->text_smiley_height = max(piece->smiley_height, dat->text_smiley_height); - iMaxSmileyHeight = max(piece->smiley_height, iMaxSmileyHeight); - - List_Insert( plText, piece, plText->realCount); - } - - // Add text - { - ClcContactTextPiece *piece = (ClcContactTextPiece *) mir_alloc(sizeof(ClcContactTextPiece)); - - piece->type = TEXT_PIECE_TYPE_TEXT; - piece->start_pos = 0; - piece->len = text_size; - List_Insert( plText, piece, plText->realCount); - } + + plText = List_Create( 0, 1 ); + + // Add Icon + { + BITMAP bm; + + ICONINFO icon; + ClcContactTextPiece *piece = (ClcContactTextPiece *) mir_alloc(sizeof(ClcContactTextPiece)); + + piece->type = TEXT_PIECE_TYPE_SMILEY; + piece->len = 0; + piece->smiley = g_hListeningToIcon; + + piece->smiley_width = 16; + piece->smiley_height = 16; + if (GetIconInfo(piece->smiley, &icon)) + { + if (GetObject(icon.hbmColor,sizeof(BITMAP),&bm)) + { + piece->smiley_width = bm.bmWidth; + piece->smiley_height = bm.bmHeight; + } + + DeleteObject(icon.hbmMask); + DeleteObject(icon.hbmColor); + } + + dat->text_smiley_height = max(piece->smiley_height, dat->text_smiley_height); + iMaxSmileyHeight = max(piece->smiley_height, iMaxSmileyHeight); + + List_Insert( plText, piece, plText->realCount); + } + + // Add text + { + ClcContactTextPiece *piece = (ClcContactTextPiece *) mir_alloc(sizeof(ClcContactTextPiece)); + + piece->type = TEXT_PIECE_TYPE_TEXT; + piece->start_pos = 0; + piece->len = text_size; + List_Insert( plText, piece, plText->realCount); + } } void CSmileyString::_CopySmileyList( SortedList *plInput ) { -// ASSERT( plText == NULL ); + // ASSERT( plText == NULL ); if ( !plInput || plInput->realCount == 0 ) return; plText = List_Create( 0, 1 ); @@ -159,29 +155,24 @@ void CSmileyString::_CopySmileyList( SortedList *plInput ) } } } + void CSmileyString::DestroySmileyList() { //ASSERT( plText == NULL ); if ( plText == NULL ) return; - if ( IsBadReadPtr( plText, sizeof(SortedList)) ) - { + if ( IsBadReadPtr( plText, sizeof(SortedList))) { plText = NULL; return; } - if ( plText->realCount != 0 ) - { - int i; - for ( i=0 ; i < plText->realCount ; i++ ) - { - if ( plText->items[i] != NULL ) - { + if ( plText->realCount != 0 ) { + for ( int i=0 ; i < plText->realCount ; i++ ) { + if ( plText->items[i] != NULL ) { ClcContactTextPiece *piece = (ClcContactTextPiece *) plText->items[i]; - if ( !IsBadWritePtr(piece, sizeof(ClcContactTextPiece)) ) - { + if ( !IsBadWritePtr(piece, sizeof(ClcContactTextPiece))) { if (piece->type == TEXT_PIECE_TYPE_SMILEY && piece->smiley != g_hListeningToIcon) DestroyIcon_protect(piece->smiley); mir_free(piece); @@ -194,122 +185,107 @@ void CSmileyString::DestroySmileyList() plText = NULL; } + /* * Parsing of text for smiley */ + void CSmileyString::ReplaceSmileys(struct SHORTDATA *dat, PDNCE pdnce, TCHAR * szText, BOOL replace_smileys) { SMADD_BATCHPARSE2 sp = {0}; SMADD_BATCHPARSERES *spr; int last_pos = 0; - iMaxSmileyHeight = 0; + iMaxSmileyHeight = 0; DestroySmileyList(); - if (!dat->text_replace_smileys || !replace_smileys || szText == NULL) - { - return; - } + if (!dat->text_replace_smileys || !replace_smileys || szText == NULL) + return; int text_size = (int)_tcslen( szText ); - // Call service for the first time to see if needs to be used... - sp.cbSize = sizeof(sp); - - if (dat->text_use_protocol_smileys) - { - sp.Protocolname = pdnce->m_cache_cszProto; - - if (db_get_b(NULL,"CLC","Meta",SETTING_USEMETAICON_DEFAULT) != 1 && pdnce->m_cache_cszProto != NULL && g_szMetaModuleName && strcmp(pdnce->m_cache_cszProto, g_szMetaModuleName) == 0) - { - HANDLE hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (LPARAM)pdnce->m_cache_hContact, 0); - if (hContact != 0) - { - sp.Protocolname = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (LPARAM)hContact, 0); - } - } - } - else - { - sp.Protocolname = "clist"; - } - - sp.str = szText; + // Call service for the first time to see if needs to be used... + sp.cbSize = sizeof(sp); + + if (dat->text_use_protocol_smileys) { + sp.Protocolname = pdnce->m_cache_cszProto; + + if (db_get_b(NULL,"CLC","Meta",SETTING_USEMETAICON_DEFAULT) != 1 && pdnce->m_cache_cszProto != NULL && g_szMetaModuleName && strcmp(pdnce->m_cache_cszProto, g_szMetaModuleName) == 0) { + HANDLE hContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (LPARAM)pdnce->m_cache_hContact, 0); + if (hContact != 0) + sp.Protocolname = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (LPARAM)hContact, 0); + } + } + else sp.Protocolname = "clist"; + + sp.str = szText; sp.flag = SAFL_TCHAR; spr = (SMADD_BATCHPARSERES*)CallService(MS_SMILEYADD_BATCHPARSE, 0, (LPARAM)&sp); - if (spr == NULL || (INT_PTR)spr == CALLSERVICE_NOTFOUND) - { - // Did not find a simley - return; - } - - // Lets add smileys - plText = List_Create( 0, 1 ); - - for (unsigned i=0; i < sp.numSmileys; ++i) - { - if (spr[i].hIcon != NULL) // For deffective smileypacks - { - // Add text - if (spr[i].startChar - last_pos > 0) - { - ClcContactTextPiece *piece = (ClcContactTextPiece *) mir_alloc(sizeof(ClcContactTextPiece)); - - piece->type = TEXT_PIECE_TYPE_TEXT; - piece->start_pos = last_pos ;//sp.str - text; - piece->len = spr[i].startChar - last_pos; - List_Insert(plText, piece, plText->realCount); - } - - // Add smiley - { - BITMAP bm; - ICONINFO icon; - ClcContactTextPiece *piece = (ClcContactTextPiece *) mir_alloc(sizeof(ClcContactTextPiece)); - - piece->type = TEXT_PIECE_TYPE_SMILEY; - piece->len = spr[i].size; - piece->smiley = spr[i].hIcon; - - piece->smiley_width = 16; - piece->smiley_height = 16; - if (GetIconInfo(piece->smiley, &icon)) - { - if (GetObject(icon.hbmColor,sizeof(BITMAP),&bm)) - { - piece->smiley_width = bm.bmWidth; - piece->smiley_height = bm.bmHeight; - } - - DeleteObject(icon.hbmMask); - DeleteObject(icon.hbmColor); - } - - dat->text_smiley_height = max( piece->smiley_height, dat->text_smiley_height ); - iMaxSmileyHeight = max( piece->smiley_height, iMaxSmileyHeight ); - - List_Insert(plText, piece, plText->realCount); - } - } - // Get next - last_pos = spr[i].startChar + spr[i].size; - } + // Did not find a simley + if (spr == NULL || (INT_PTR)spr == CALLSERVICE_NOTFOUND) + return; + + // Lets add smileys + plText = List_Create( 0, 1 ); + + for (unsigned i=0; i < sp.numSmileys; ++i) { + if (spr[i].hIcon != NULL) { // For deffective smileypacks + // Add text + if (spr[i].startChar - last_pos > 0) { + ClcContactTextPiece *piece = (ClcContactTextPiece *) mir_alloc(sizeof(ClcContactTextPiece)); + + piece->type = TEXT_PIECE_TYPE_TEXT; + piece->start_pos = last_pos ;//sp.str - text; + piece->len = spr[i].startChar - last_pos; + List_Insert(plText, piece, plText->realCount); + } + + // Add smiley + { + BITMAP bm; + ICONINFO icon; + ClcContactTextPiece *piece = (ClcContactTextPiece *) mir_alloc(sizeof(ClcContactTextPiece)); + + piece->type = TEXT_PIECE_TYPE_SMILEY; + piece->len = spr[i].size; + piece->smiley = spr[i].hIcon; + + piece->smiley_width = 16; + piece->smiley_height = 16; + if (GetIconInfo(piece->smiley, &icon)) { + if (GetObject(icon.hbmColor,sizeof(BITMAP),&bm)) { + piece->smiley_width = bm.bmWidth; + piece->smiley_height = bm.bmHeight; + } + + DeleteObject(icon.hbmMask); + DeleteObject(icon.hbmColor); + } + + dat->text_smiley_height = max( piece->smiley_height, dat->text_smiley_height ); + iMaxSmileyHeight = max( piece->smiley_height, iMaxSmileyHeight ); + + List_Insert(plText, piece, plText->realCount); + } + } + // Get next + last_pos = spr[i].startChar + spr[i].size; + } CallService(MS_SMILEYADD_BATCHFREE, 0, (LPARAM)spr); - // Add rest of text - if (last_pos < text_size) - { - ClcContactTextPiece *piece = (ClcContactTextPiece *) mir_alloc(sizeof(ClcContactTextPiece)); + // Add rest of text + if (last_pos < text_size) { + ClcContactTextPiece *piece = (ClcContactTextPiece *) mir_alloc(sizeof(ClcContactTextPiece)); - piece->type = TEXT_PIECE_TYPE_TEXT; - piece->start_pos = last_pos; - piece->len = text_size-last_pos; + piece->type = TEXT_PIECE_TYPE_TEXT; + piece->start_pos = last_pos; + piece->len = text_size-last_pos; - List_Insert(plText, piece, plText->realCount); - } + List_Insert(plText, piece, plText->realCount); + } } /* @@ -318,132 +294,123 @@ void CSmileyString::ReplaceSmileys(struct SHORTDATA *dat, PDNCE pdnce, TCHAR * s */ int GetStatusName(TCHAR *text, int text_size, PDNCE pdnce, BOOL xstatus_has_priority) { - BOOL noAwayMsg = FALSE; - BOOL noXstatus = FALSE; - // Hide status text if Offline /// no offline + BOOL noAwayMsg = FALSE; + BOOL noXstatus = FALSE; + // Hide status text if Offline /// no offline WORD nStatus = pdnce___GetStatus( pdnce ); - if ((nStatus == ID_STATUS_OFFLINE || nStatus == 0) && g_CluiData.bRemoveAwayMessageForOffline) noAwayMsg = TRUE; - if (nStatus == ID_STATUS_OFFLINE || nStatus == 0) noXstatus = TRUE; - text[0] = '\0'; - // Get XStatusName - if (!noAwayMsg&& !noXstatus&& xstatus_has_priority && pdnce->m_cache_hContact && pdnce->m_cache_cszProto) - { - DBVARIANT dbv = {0}; - if (!DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) - { - //lstrcpyn(text, dbv.pszVal, text_size); - CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1); - db_free(&dbv); - - if (text[0] != '\0') - return -1; - } - } - - // Get Status name - { - TCHAR *tmp = (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)nStatus, GSMDF_TCHAR_MY); - lstrcpyn(text, tmp, text_size); - //CopySkipUnprintableChars(text, dbv.pszVal, text_size-1); - if (text[0] != '\0') - return 1; - } - - // Get XStatusName - if (!noAwayMsg && !noXstatus && !xstatus_has_priority && pdnce->m_cache_hContact && pdnce->m_cache_cszProto) - { - DBVARIANT dbv = {0}; - if (!DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) - { - //lstrcpyn(text, dbv.pszVal, text_size); - CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1); - db_free(&dbv); - - if (text[0] != '\0') - return -1; - } - } - - return 1; + if ((nStatus == ID_STATUS_OFFLINE || nStatus == 0) && g_CluiData.bRemoveAwayMessageForOffline) noAwayMsg = TRUE; + if (nStatus == ID_STATUS_OFFLINE || nStatus == 0) noXstatus = TRUE; + text[0] = '\0'; + // Get XStatusName + if (!noAwayMsg && !noXstatus && xstatus_has_priority && pdnce->m_cache_hContact && pdnce->m_cache_cszProto) { + DBVARIANT dbv = {0}; + if (!DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) { + //lstrcpyn(text, dbv.pszVal, text_size); + CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1); + db_free(&dbv); + + if (text[0] != '\0') + return -1; + } + } + + // Get Status name + { + TCHAR *tmp = (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)nStatus, GSMDF_TCHAR_MY); + lstrcpyn(text, tmp, text_size); + //CopySkipUnprintableChars(text, dbv.pszVal, text_size-1); + if (text[0] != '\0') + return 1; + } + + // Get XStatusName + if (!noAwayMsg && !noXstatus && !xstatus_has_priority && pdnce->m_cache_hContact && pdnce->m_cache_cszProto) { + DBVARIANT dbv = {0}; + if (!DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) { + //lstrcpyn(text, dbv.pszVal, text_size); + CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1); + db_free(&dbv); + + if (text[0] != '\0') + return -1; + } + } + + return 1; } /* * Get Listening to information */ + void GetListeningTo(TCHAR *text, int text_size, PDNCE pdnce) { - DBVARIANT dbv = {0}; + DBVARIANT dbv = {0}; WORD wStatus = pdnce___GetStatus( pdnce ); - text[0] = _T('\0'); - - if (wStatus == ID_STATUS_OFFLINE || wStatus == 0) - return; - - if (!DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "ListeningTo", &dbv)) - { - CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1); - db_free(&dbv); - } + text[0] = _T('\0'); + + if (wStatus == ID_STATUS_OFFLINE || wStatus == 0) + return; + + if (!DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "ListeningTo", &dbv)) { + CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1); + db_free(&dbv); + } } /* * Getting Status message (Away message) * -1 for XStatus, 1 for Status */ + int GetStatusMessage(TCHAR *text, int text_size, PDNCE pdnce, BOOL xstatus_has_priority) { - DBVARIANT dbv = {0}; - BOOL noAwayMsg = FALSE; + DBVARIANT dbv = {0}; + BOOL noAwayMsg = FALSE; WORD wStatus = pdnce___GetStatus( pdnce ); - text[0] = '\0'; + text[0] = '\0'; // Hide status text if Offline /// no offline - + if (wStatus == ID_STATUS_OFFLINE || wStatus == 0) noAwayMsg = TRUE; - // Get XStatusMsg - if (!noAwayMsg &&xstatus_has_priority && pdnce->m_cache_hContact && pdnce->m_cache_cszProto) - { - // Try to get XStatusMsg - if (!DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) - { - //lstrcpyn(text, dbv.pszVal, text_size); - CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1); - db_free(&dbv); - - if (text[0] != '\0') - return -1; - } - } - - // Get StatusMsg - if (pdnce->m_cache_hContact && text[0] == '\0') - { - if (!DBGetContactSettingTString(pdnce->m_cache_hContact, "CList", "StatusMsg", &dbv)) - { - //lstrcpyn(text, dbv.pszVal, text_size); - CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1); - db_free(&dbv); - - if (text[0] != '\0') - return 1; - } - } - - // Get XStatusMsg - if (!noAwayMsg && !xstatus_has_priority && pdnce->m_cache_hContact && pdnce->m_cache_cszProto && text[0] == '\0') - { - // Try to get XStatusMsg - if (!DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) - { - //lstrcpyn(text, dbv.pszVal, text_size); - CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1); - db_free(&dbv); - - if (text[0] != '\0') - return -1; - } - } - - return 1; + // Get XStatusMsg + if (!noAwayMsg && xstatus_has_priority && pdnce->m_cache_hContact && pdnce->m_cache_cszProto) { + // Try to get XStatusMsg + if (!DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) { + //lstrcpyn(text, dbv.pszVal, text_size); + CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1); + db_free(&dbv); + + if (text[0] != '\0') + return -1; + } + } + + // Get StatusMsg + if (pdnce->m_cache_hContact && text[0] == '\0') { + if (!DBGetContactSettingTString(pdnce->m_cache_hContact, "CList", "StatusMsg", &dbv)) { + //lstrcpyn(text, dbv.pszVal, text_size); + CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1); + db_free(&dbv); + + if (text[0] != '\0') + return 1; + } + } + + // Get XStatusMsg + if (!noAwayMsg && !xstatus_has_priority && pdnce->m_cache_hContact && pdnce->m_cache_cszProto && text[0] == '\0') { + // Try to get XStatusMsg + if (!DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) { + //lstrcpyn(text, dbv.pszVal, text_size); + CopySkipUnprintableChars(text, dbv.ptszVal, text_size-1); + db_free(&dbv); + + if (text[0] != '\0') + return -1; + } + } + + return 1; } @@ -535,8 +502,7 @@ int Cache_GetLineText(PDNCE pdnce, int type, LPTSTR text, int text_size, TCHAR * { TCHAR *tmp = variables_parsedup(variable_text, pdnce->m_cache_tcsName, pdnce->m_cache_hContact); lstrcpyn(text, tmp, text_size); - if (tmp) - mir_free(tmp); + mir_free(tmp); CopySkipUnprintableChars(text, text, text_size-1); } return TEXT_TEXT; @@ -559,79 +525,71 @@ int Cache_GetLineText(PDNCE pdnce, int type, LPTSTR text, int text_size, TCHAR * */ void Cache_GetFirstLineText(struct ClcData *dat, struct ClcContact *contact) { - if (GetCurrentThreadId() != g_dwMainThreadID) return; + PDNCE pdnce = (PDNCE)pcli->pfnGetCacheEntry(contact->hContact); + TCHAR *name = pcli->pfnGetContactDisplayName(contact->hContact,0); + if (dat->first_line_append_nick && (!dat->force_in_dialog)) { + DBVARIANT dbv = {0}; + if (!DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "Nick", &dbv)) { + TCHAR nick[SIZEOF(contact->szText)]; + lstrcpyn(nick, dbv.ptszVal, SIZEOF(contact->szText)); + db_free(&dbv); + + // They are the same -> use the name to keep the case + if (_tcsicmp(name, nick) == 0) + lstrcpyn(contact->szText, name, SIZEOF(contact->szText)); + else + // Append then + mir_sntprintf(contact->szText, SIZEOF(contact->szText), _T("%s - %s"), name, nick); + } + else lstrcpyn(contact->szText, name, SIZEOF(contact->szText)); + } + else lstrcpyn(contact->szText, name, SIZEOF(contact->szText)); - PDNCE pdnce = (PDNCE)pcli->pfnGetCacheEntry(contact->hContact); - TCHAR *name = pcli->pfnGetContactDisplayName(contact->hContact,0); - if (dat->first_line_append_nick && (!dat->force_in_dialog)) { - DBVARIANT dbv = {0}; - if (!DBGetContactSettingTString(pdnce->m_cache_hContact, pdnce->m_cache_cszProto, "Nick", &dbv)) - { - TCHAR nick[SIZEOF(contact->szText)]; - lstrcpyn(nick, dbv.ptszVal, SIZEOF(contact->szText)); - db_free(&dbv); - - if (_tcsicmp(name, nick) == 0) { - // They are the same -> use the name to keep the case - lstrcpyn(contact->szText, name, SIZEOF(contact->szText)); - } else { - // Append then - mir_sntprintf(contact->szText, SIZEOF(contact->szText), _T("%s - %s"), name, nick); - } - } else { - lstrcpyn(contact->szText, name, SIZEOF(contact->szText)); - } - } else { - lstrcpyn(contact->szText, name, SIZEOF(contact->szText)); - } - if (!dat->force_in_dialog) - { - struct SHORTDATA data = {0}; - Sync(CLUI_SyncGetShortData,(WPARAM)pcli->hwndContactTree,(LPARAM)&data); - contact->ssText.ReplaceSmileys(&data, pdnce, contact->szText, dat->first_line_draw_smileys); - } + if (!dat->force_in_dialog) { + struct SHORTDATA data = {0}; + Sync(CLUI_SyncGetShortData,(WPARAM)pcli->hwndContactTree,(LPARAM)&data); + contact->ssText.ReplaceSmileys(&data, pdnce, contact->szText, dat->first_line_draw_smileys); + } } /* * Get the text for Second Line */ - - void Cache_GetSecondLineText(struct SHORTDATA *dat, PDNCE pdnce) { - TCHAR Text[240-MAXEXTRACOLUMNS] = {0}; - int type = TEXT_EMPTY; - - if (dat->second_line_show) - type = Cache_GetLineText(pdnce, dat->second_line_type, (TCHAR*)Text, SIZEOF(Text), dat->second_line_text, - dat->second_line_xstatus_has_priority,dat->second_line_show_status_if_no_away,dat->second_line_show_listening_if_no_away, - dat->second_line_use_name_and_message_for_xstatus, dat->contact_time_show_only_if_different); - Text[SIZEOF(Text)-1] = _T('\0'); //to be sure that it is null terminated string - //LockCacheItem(hContact, __FILE__,__LINE__); - - if (pdnce->szSecondLineText) mir_free(pdnce->szSecondLineText); - - if (dat->second_line_show)// Text[0] != '\0') - pdnce->szSecondLineText = mir_tstrdup((TCHAR*)Text); - else - pdnce->szSecondLineText = NULL; - - if (pdnce->szSecondLineText) - { - if (type == TEXT_LISTENING_TO && pdnce->szSecondLineText[0] != _T('\0')) - { - pdnce->ssSecondLine.AddListeningToIcon(dat, pdnce, pdnce->szSecondLineText, dat->second_line_draw_smileys); - } - else - { - pdnce->ssSecondLine.ReplaceSmileys(dat, pdnce, pdnce->szSecondLineText, dat->second_line_draw_smileys); - } - } - //UnlockCacheItem(hContact); + TCHAR Text[240-MAXEXTRACOLUMNS] = {0}; + int type = TEXT_EMPTY; + + if (dat->second_line_show) + type = Cache_GetLineText(pdnce, dat->second_line_type, (TCHAR*)Text, SIZEOF(Text), dat->second_line_text, + dat->second_line_xstatus_has_priority,dat->second_line_show_status_if_no_away,dat->second_line_show_listening_if_no_away, + dat->second_line_use_name_and_message_for_xstatus, dat->contact_time_show_only_if_different); + Text[SIZEOF(Text)-1] = _T('\0'); //to be sure that it is null terminated string + //LockCacheItem(hContact, __FILE__,__LINE__); + + mir_free(pdnce->szSecondLineText); + + if (dat->second_line_show)// Text[0] != '\0') + pdnce->szSecondLineText = mir_tstrdup((TCHAR*)Text); + else + pdnce->szSecondLineText = NULL; + + if (pdnce->szSecondLineText) + { + if (type == TEXT_LISTENING_TO && pdnce->szSecondLineText[0] != _T('\0')) + { + pdnce->ssSecondLine.AddListeningToIcon(dat, pdnce, pdnce->szSecondLineText, dat->second_line_draw_smileys); + } + else + { + pdnce->ssSecondLine.ReplaceSmileys(dat, pdnce, pdnce->szSecondLineText, dat->second_line_draw_smileys); + } + } + //UnlockCacheItem(hContact); } /* @@ -639,48 +597,48 @@ void Cache_GetSecondLineText(struct SHORTDATA *dat, PDNCE pdnce) */ void Cache_GetThirdLineText(struct SHORTDATA *dat, PDNCE pdnce) { - TCHAR Text[240-MAXEXTRACOLUMNS] = {0}; - int type = TEXT_EMPTY; - if (dat->third_line_show) - type = Cache_GetLineText(pdnce, dat->third_line_type,(TCHAR*)Text, SIZEOF(Text), dat->third_line_text, - dat->third_line_xstatus_has_priority,dat->third_line_show_status_if_no_away,dat->third_line_show_listening_if_no_away, - dat->third_line_use_name_and_message_for_xstatus, dat->contact_time_show_only_if_different); - - // LockCacheItem(hContact, __FILE__,__LINE__); - Text[SIZEOF(Text)-1] = _T('\0'); //to be sure that it is null terminated string - - if (pdnce->szThirdLineText) mir_free(pdnce->szThirdLineText); - - if (dat->third_line_show)//Text[0] != '\0') - pdnce->szThirdLineText = mir_tstrdup((TCHAR*)Text); - else - pdnce->szThirdLineText = NULL; - - if (pdnce->szThirdLineText) - { - if (type == TEXT_LISTENING_TO && pdnce->szThirdLineText[0] != _T('\0')) - { - pdnce->ssThirdLine.AddListeningToIcon(dat, pdnce, pdnce->szThirdLineText, dat->third_line_draw_smileys); - } - else - { + TCHAR Text[240-MAXEXTRACOLUMNS] = {0}; + int type = TEXT_EMPTY; + if (dat->third_line_show) + type = Cache_GetLineText(pdnce, dat->third_line_type,(TCHAR*)Text, SIZEOF(Text), dat->third_line_text, + dat->third_line_xstatus_has_priority,dat->third_line_show_status_if_no_away,dat->third_line_show_listening_if_no_away, + dat->third_line_use_name_and_message_for_xstatus, dat->contact_time_show_only_if_different); + + // LockCacheItem(hContact, __FILE__,__LINE__); + Text[SIZEOF(Text)-1] = _T('\0'); //to be sure that it is null terminated string + + mir_free(pdnce->szThirdLineText); + + if (dat->third_line_show)//Text[0] != '\0') + pdnce->szThirdLineText = mir_tstrdup((TCHAR*)Text); + else + pdnce->szThirdLineText = NULL; + + if (pdnce->szThirdLineText) + { + if (type == TEXT_LISTENING_TO && pdnce->szThirdLineText[0] != _T('\0')) + { + pdnce->ssThirdLine.AddListeningToIcon(dat, pdnce, pdnce->szThirdLineText, dat->third_line_draw_smileys); + } + else + { pdnce->ssThirdLine.ReplaceSmileys(dat, pdnce, pdnce->szThirdLineText, dat->third_line_draw_smileys); - } - } - // UnlockCacheItem(hContact); + } + } + // UnlockCacheItem(hContact); } void RemoveTag(TCHAR *to, TCHAR *tag) { - TCHAR * st = to; - int len = (int)_tcslen(tag); - int lastsize = (int)_tcslen(to)+1; - while (st = _tcsstr(st,tag)) - { - lastsize -= len; - memmove((void*)st,(void*)(st+len),(lastsize)*sizeof(TCHAR)); - } + TCHAR * st = to; + int len = (int)_tcslen(tag); + int lastsize = (int)_tcslen(to)+1; + while (st = _tcsstr(st,tag)) + { + lastsize -= len; + memmove((void*)st,(void*)(st+len),(lastsize)*sizeof(TCHAR)); + } } /* @@ -689,96 +647,96 @@ void RemoveTag(TCHAR *to, TCHAR *tag) */ static int CopySkipUnprintableChars(TCHAR *to, TCHAR * buf, DWORD size) { - DWORD i; - BOOL keep = 0; - TCHAR * cp = to; - if (!to) return 0; - if (!buf) - { - to[0] = '\0'; - return 0; - } - for (i=0; i < size; i++) - { - if (buf[i] == 0) break; - if (buf[i]>0 && buf[i] < ' ') - { - *cp = ' '; - if (!keep) cp++; - keep = 1; - } - else - { - keep = 0; - *cp = buf[i]; - cp++; - } - } - *cp = 0; - { - //remove bbcodes: [b] [i] [u] - RemoveTag(to,_T("[b]")); RemoveTag(to,_T("[/b]")); - RemoveTag(to,_T("[u]")); RemoveTag(to,_T("[/u]")); - RemoveTag(to,_T("[i]")); RemoveTag(to,_T("[/i]")); - - RemoveTag(to,_T("")); RemoveTag(to,_T("")); - RemoveTag(to,_T("")); RemoveTag(to,_T("")); - RemoveTag(to,_T("")); RemoveTag(to,_T("")); - - RemoveTag(to,_T("[B]")); RemoveTag(to,_T("[/b]")); - RemoveTag(to,_T("[U]")); RemoveTag(to,_T("[/u]")); - RemoveTag(to,_T("[I]")); RemoveTag(to,_T("[/i]")); - - RemoveTag(to,_T("")); RemoveTag(to,_T("")); - RemoveTag(to,_T("")); RemoveTag(to,_T("")); - RemoveTag(to,_T("")); RemoveTag(to,_T("")); - } - return i; + DWORD i; + BOOL keep = 0; + TCHAR * cp = to; + if (!to) return 0; + if (!buf) + { + to[0] = '\0'; + return 0; + } + for (i=0; i < size; i++) + { + if (buf[i] == 0) break; + if (buf[i]>0 && buf[i] < ' ') + { + *cp = ' '; + if (!keep) cp++; + keep = 1; + } + else + { + keep = 0; + *cp = buf[i]; + cp++; + } + } + *cp = 0; + { + //remove bbcodes: [b] [i] [u] + RemoveTag(to,_T("[b]")); RemoveTag(to,_T("[/b]")); + RemoveTag(to,_T("[u]")); RemoveTag(to,_T("[/u]")); + RemoveTag(to,_T("[i]")); RemoveTag(to,_T("[/i]")); + + RemoveTag(to,_T("")); RemoveTag(to,_T("")); + RemoveTag(to,_T("")); RemoveTag(to,_T("")); + RemoveTag(to,_T("")); RemoveTag(to,_T("")); + + RemoveTag(to,_T("[B]")); RemoveTag(to,_T("[/b]")); + RemoveTag(to,_T("[U]")); RemoveTag(to,_T("[/u]")); + RemoveTag(to,_T("[I]")); RemoveTag(to,_T("[/i]")); + + RemoveTag(to,_T("")); RemoveTag(to,_T("")); + RemoveTag(to,_T("")); RemoveTag(to,_T("")); + RemoveTag(to,_T("")); RemoveTag(to,_T("")); + } + return i; } // If ExecuteOnAllContactsFuncPtr returns FALSE, stop loop // Return TRUE if finished, FALSE if was stoped static BOOL ExecuteOnAllContacts(struct ClcData *dat, ExecuteOnAllContactsFuncPtr func, void *param) { - BOOL res; - res = ExecuteOnAllContactsOfGroup(&dat->list, func, param); - return res; + BOOL res; + res = ExecuteOnAllContactsOfGroup(&dat->list, func, param); + return res; } static BOOL ExecuteOnAllContactsOfGroup(struct ClcGroup *group, ExecuteOnAllContactsFuncPtr func, void *param) { - int scanIndex, i; - if (group) - for(scanIndex = 0 ; scanIndex < group->cl.count ; scanIndex++) - { - if (group->cl.items[scanIndex]->type == CLCIT_CONTACT) - { - if (!func(group->cl.items[scanIndex], FALSE, param)) - { - return FALSE; - } - - if (group->cl.items[scanIndex]->SubAllocated > 0) - { - for (i=0 ; i < group->cl.items[scanIndex]->SubAllocated ; i++) - { - if (!func(&group->cl.items[scanIndex]->subcontacts[i], TRUE, param)) - { - return FALSE; - } - } - } - } - else if (group->cl.items[scanIndex]->type == CLCIT_GROUP) - { - if (!ExecuteOnAllContactsOfGroup(group->cl.items[scanIndex]->group, func, param)) - { - return FALSE; - } - } - } - - return TRUE; + int scanIndex, i; + if (group) + for(scanIndex = 0 ; scanIndex < group->cl.count ; scanIndex++) + { + if (group->cl.items[scanIndex]->type == CLCIT_CONTACT) + { + if (!func(group->cl.items[scanIndex], FALSE, param)) + { + return FALSE; + } + + if (group->cl.items[scanIndex]->SubAllocated > 0) + { + for (i=0 ; i < group->cl.items[scanIndex]->SubAllocated ; i++) + { + if (!func(&group->cl.items[scanIndex]->subcontacts[i], TRUE, param)) + { + return FALSE; + } + } + } + } + else if (group->cl.items[scanIndex]->type == CLCIT_GROUP) + { + if (!ExecuteOnAllContactsOfGroup(group->cl.items[scanIndex]->group, func, param)) + { + return FALSE; + } + } + } + + return TRUE; } @@ -787,23 +745,23 @@ static BOOL ExecuteOnAllContactsOfGroup(struct ClcGroup *group, ExecuteOnAllCont */ BOOL UpdateAllAvatarsProxy(struct ClcContact *contact, BOOL subcontact, void *param) { - Cache_GetAvatar((struct ClcData *)param, contact); - return TRUE; + Cache_GetAvatar((struct ClcData *)param, contact); + return TRUE; } void UpdateAllAvatars(struct ClcData *dat) { - ExecuteOnAllContacts(dat,UpdateAllAvatarsProxy,dat); + ExecuteOnAllContacts(dat,UpdateAllAvatarsProxy,dat); } BOOL ReduceAvatarPosition(struct ClcContact *contact, BOOL subcontact, void *param) { - if (contact->avatar_pos >= *((int *)param)) - { - contact->avatar_pos--; - } + if (contact->avatar_pos >= *((int *)param)) + { + contact->avatar_pos--; + } - return TRUE; + return TRUE; } @@ -813,8 +771,8 @@ void Cache_ProceedAvatarInList(struct ClcData *dat, struct ClcContact *contact) int old_pos = contact->avatar_pos; if ( ace == NULL - || ace->dwFlags == AVS_BITMAP_EXPIRED - || ace->hbmPic == NULL) + || ace->dwFlags == AVS_BITMAP_EXPIRED + || ace->hbmPic == NULL) { //Avatar was not ready or removed - need to remove it from cache if (old_pos >= 0) @@ -874,15 +832,15 @@ void Cache_ProceedAvatarInList(struct ClcData *dat, struct ClcContact *contact) /* if (ServiceExists(MS_AV_BLENDDRAWAVATAR)) { - AVATARDRAWREQUEST adr; - - adr.cbSize = sizeof(AVATARDRAWREQUEST); - adr.hContact = contact->hContact; - adr.hTargetDC = hdc; - adr.rcDraw = real_rc; - adr.dwFlags = 0; - adr.alpha = 255; - CallService(MS_AV_BLENDDRAWAVATAR, 0, (LPARAM) &adr); + AVATARDRAWREQUEST adr; + + adr.cbSize = sizeof(AVATARDRAWREQUEST); + adr.hContact = contact->hContact; + adr.hTargetDC = hdc; + adr.rcDraw = real_rc; + adr.dwFlags = 0; + adr.alpha = 255; + CallService(MS_AV_BLENDDRAWAVATAR, 0, (LPARAM) &adr); } else */ @@ -955,137 +913,137 @@ void Cache_ProceedAvatarInList(struct ClcData *dat, struct ClcContact *contact) void Cache_GetAvatar(struct ClcData *dat, struct ClcContact *contact) { int old_pos = contact->avatar_pos; - if (g_CluiData.bSTATE != STATE_NORMAL - || (dat->use_avatar_service && !ServiceExists(MS_AV_GETAVATARBITMAP))) // workaround for avatar service and other wich destroys service on OK_TOEXIT - { - contact->avatar_pos = AVATAR_POS_DONT_HAVE; - contact->avatar_data = NULL; - return; - } - if (dat->use_avatar_service && ServiceExists(MS_AV_GETAVATARBITMAP)) - { - if (dat->avatars_show && !db_get_b(contact->hContact, "CList", "HideContactAvatar", 0)) - { - contact->avatar_data = (struct avatarCacheEntry *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)contact->hContact, 0); - if (contact->avatar_data == NULL || contact->avatar_data->cbSize != sizeof(struct avatarCacheEntry) - || contact->avatar_data->dwFlags == AVS_BITMAP_EXPIRED) - { - contact->avatar_data = NULL; - } - - if (contact->avatar_data != NULL) + if (g_CluiData.bSTATE != STATE_NORMAL + || (dat->use_avatar_service && !ServiceExists(MS_AV_GETAVATARBITMAP))) // workaround for avatar service and other wich destroys service on OK_TOEXIT + { + contact->avatar_pos = AVATAR_POS_DONT_HAVE; + contact->avatar_data = NULL; + return; + } + if (dat->use_avatar_service && ServiceExists(MS_AV_GETAVATARBITMAP)) + { + if (dat->avatars_show && !db_get_b(contact->hContact, "CList", "HideContactAvatar", 0)) + { + contact->avatar_data = (struct avatarCacheEntry *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)contact->hContact, 0); + if (contact->avatar_data == NULL || contact->avatar_data->cbSize != sizeof(struct avatarCacheEntry) + || contact->avatar_data->dwFlags == AVS_BITMAP_EXPIRED) + { + contact->avatar_data = NULL; + } + + if (contact->avatar_data != NULL) { - contact->avatar_data->t_lastAccess = (DWORD)time(NULL); + contact->avatar_data->t_lastAccess = (DWORD)time(NULL); } - } - else - { - contact->avatar_data = NULL; - } + } + else + { + contact->avatar_data = NULL; + } Cache_ProceedAvatarInList(dat, contact); - } - else - { - contact->avatar_pos = AVATAR_POS_DONT_HAVE; - if (dat->avatars_show && !db_get_b(contact->hContact, "CList", "HideContactAvatar", 0)) - { - DBVARIANT dbv; - if (!DBGetContactSettingTString(contact->hContact, "ContactPhoto", "File", &dbv)) - { - HBITMAP hBmp = (HBITMAP) CallService(MS_UTILS_LOADBITMAPT, 0, (LPARAM)dbv.ptszVal); - if (hBmp != NULL) - { - // Make bounds - BITMAP bm; - if (GetObject(hBmp,sizeof(BITMAP),&bm)) - { - // Create data... - HDC hdc; - HBITMAP hDrawBmp,oldBmp; - - // Make bounds -> keep aspect radio - LONG width_clip; - LONG height_clip; - RECT rc = {0}; - - // Clipping width and height - width_clip = dat->avatars_maxheight_size; - height_clip = dat->avatars_maxheight_size; - - if (height_clip * bm.bmWidth / bm.bmHeight <= width_clip) - { - width_clip = height_clip * bm.bmWidth / bm.bmHeight; - } - else - { - height_clip = width_clip * bm.bmHeight / bm.bmWidth; - } - - // Create objs - hdc = CreateCompatibleDC(dat->avatar_cache.hdc); - hDrawBmp = ske_CreateDIB32(width_clip, height_clip); + } + else + { + contact->avatar_pos = AVATAR_POS_DONT_HAVE; + if (dat->avatars_show && !db_get_b(contact->hContact, "CList", "HideContactAvatar", 0)) + { + DBVARIANT dbv; + if (!DBGetContactSettingTString(contact->hContact, "ContactPhoto", "File", &dbv)) + { + HBITMAP hBmp = (HBITMAP) CallService(MS_UTILS_LOADBITMAPT, 0, (LPARAM)dbv.ptszVal); + if (hBmp != NULL) + { + // Make bounds + BITMAP bm; + if (GetObject(hBmp,sizeof(BITMAP),&bm)) + { + // Create data... + HDC hdc; + HBITMAP hDrawBmp,oldBmp; + + // Make bounds -> keep aspect radio + LONG width_clip; + LONG height_clip; + RECT rc = {0}; + + // Clipping width and height + width_clip = dat->avatars_maxheight_size; + height_clip = dat->avatars_maxheight_size; + + if (height_clip * bm.bmWidth / bm.bmHeight <= width_clip) + { + width_clip = height_clip * bm.bmWidth / bm.bmHeight; + } + else + { + height_clip = width_clip * bm.bmHeight / bm.bmWidth; + } + + // Create objs + hdc = CreateCompatibleDC(dat->avatar_cache.hdc); + hDrawBmp = ske_CreateDIB32(width_clip, height_clip); oldBmp = (HBITMAP)SelectObject(hdc, hDrawBmp); - SetBkMode(hdc,TRANSPARENT); - { - POINT org; - GetBrushOrgEx(hdc, &org); - SetStretchBltMode(hdc, HALFTONE); - SetBrushOrgEx(hdc, org.x, org.y, NULL); - } - - rc.right = width_clip - 1; - rc.bottom = height_clip - 1; - - // Draw bitmap 8//8 - { - HDC dcMem = CreateCompatibleDC(hdc); + SetBkMode(hdc,TRANSPARENT); + { + POINT org; + GetBrushOrgEx(hdc, &org); + SetStretchBltMode(hdc, HALFTONE); + SetBrushOrgEx(hdc, org.x, org.y, NULL); + } + + rc.right = width_clip - 1; + rc.bottom = height_clip - 1; + + // Draw bitmap 8//8 + { + HDC dcMem = CreateCompatibleDC(hdc); HBITMAP obmp = (HBITMAP)SelectObject(dcMem, hBmp); - StretchBlt(hdc, 0, 0, width_clip, height_clip,dcMem, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY); - SelectObject(dcMem,obmp); - mod_DeleteDC(dcMem); - } - { - RECT rtr = {0}; - rtr.right = width_clip+1; - rtr.bottom = height_clip+1; - ske_SetRectOpaque(hdc,&rtr); - } + StretchBlt(hdc, 0, 0, width_clip, height_clip,dcMem, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY); + SelectObject(dcMem,obmp); + mod_DeleteDC(dcMem); + } + { + RECT rtr = {0}; + rtr.right = width_clip+1; + rtr.bottom = height_clip+1; + ske_SetRectOpaque(hdc,&rtr); + } hDrawBmp = (HBITMAP)GetCurrentObject(hdc, OBJ_BITMAP); - SelectObject(hdc,oldBmp); - mod_DeleteDC(hdc); - - // Add to list - if (old_pos >= 0) - { - ImageArray_ChangeImage(&dat->avatar_cache, hDrawBmp, old_pos); - contact->avatar_pos = old_pos; - } - else - { - contact->avatar_pos = ImageArray_AddImage(&dat->avatar_cache, hDrawBmp, -1); - } - - DeleteObject(hDrawBmp); - } // if (GetObject(hBmp,sizeof(BITMAP),&bm)) - DeleteObject(hBmp); - } //if (hBmp != NULL) - } - db_free(&dbv); - } - - // Remove avatar if needed - if (old_pos >= 0 && contact->avatar_pos == AVATAR_POS_DONT_HAVE) - { - ImageArray_RemoveImage(&dat->avatar_cache, old_pos); - // Update all items - ExecuteOnAllContacts(dat, ReduceAvatarPosition, (void *)&old_pos); - } + SelectObject(hdc,oldBmp); + mod_DeleteDC(hdc); + + // Add to list + if (old_pos >= 0) + { + ImageArray_ChangeImage(&dat->avatar_cache, hDrawBmp, old_pos); + contact->avatar_pos = old_pos; + } + else + { + contact->avatar_pos = ImageArray_AddImage(&dat->avatar_cache, hDrawBmp, -1); + } + + DeleteObject(hDrawBmp); + } // if (GetObject(hBmp,sizeof(BITMAP),&bm)) + DeleteObject(hBmp); + } //if (hBmp != NULL) + } + db_free(&dbv); + } + + // Remove avatar if needed + if (old_pos >= 0 && contact->avatar_pos == AVATAR_POS_DONT_HAVE) + { + ImageArray_RemoveImage(&dat->avatar_cache, old_pos); + // Update all items + ExecuteOnAllContacts(dat, ReduceAvatarPosition, (void *)&old_pos); + } if (old_pos == AVATAR_POS_ANIMATED && contact->avatar_pos != AVATAR_POS_ANIMATED) { AniAva_RemoveAvatar( contact->hContact ); } - } + } } diff --git a/plugins/Clist_modern/modern_clc.cpp b/plugins/Clist_modern/modern_clc.cpp index 90b63f2c37..21b252abce 100644 --- a/plugins/Clist_modern/modern_clc.cpp +++ b/plugins/Clist_modern/modern_clc.cpp @@ -265,8 +265,8 @@ static int clcHookSettingChanged(WPARAM wParam,LPARAM lParam) // if (!strcmp(cws->szSetting,"UIN")) // pcli->pfnClcBroadcast( INTM_NAMECHANGED,wParam,lParam); // else if (!strcmp(cws->szSetting,"Nick") || !strcmp(cws->szSetting,"FirstName") - // || !strcmp(cws->szSetting,"e-mail") || !strcmp(cws->szSetting,"LastName") - // || !strcmp(cws->szSetting,"JID")) + // || !strcmp(cws->szSetting,"e-mail") || !strcmp(cws->szSetting,"LastName") + // || !strcmp(cws->szSetting,"JID")) // pcli->pfnClcBroadcast( INTM_NAMECHANGED,wParam,lParam); // else if (!strcmp(cws->szSetting,"ApparentMode")) // pcli->pfnClcBroadcast( INTM_APPARENTMODECHANGED,wParam,lParam); @@ -377,7 +377,7 @@ static int clcSearchNextContact(HWND hwnd, struct ClcData *dat, int index, const } if (group->cl.items[group->scanIndex]->type != CLCIT_DIVIDER) { - if ((prefixOk && CSTR_EQUAL == CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, text, -1, group->cl.items[group->scanIndex]->szText, testlen)) || + if ((prefixOk && CSTR_EQUAL == CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, text, -1, group->cl.items[group->scanIndex]->szText, testlen)) || (!prefixOk && !lstrcmpi(text, group->cl.items[group->scanIndex]->szText))) { struct ClcGroup *contactGroup = group; @@ -453,7 +453,7 @@ static LRESULT clcOnCreate(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wPar dat->NeedResort = 1; dat->MetaIgnoreEmptyExtra = db_get_b(NULL,"CLC","MetaIgnoreEmptyExtra",SETTING_METAIGNOREEMPTYEXTRA_DEFAULT); - dat->IsMetaContactsEnabled = (!(GetWindowLongPtr(hwnd,GWL_STYLE)&CLS_MANUALUPDATE)) && + dat->IsMetaContactsEnabled = (!(GetWindowLongPtr(hwnd,GWL_STYLE)&CLS_MANUALUPDATE)) && g_szMetaModuleName && db_get_b(NULL,g_szMetaModuleName,"Enabled",1) && ServiceExists(MS_MC_GETDEFAULTCONTACT); dat->expandMeta = db_get_b(NULL,"CLC","MetaExpanding",SETTING_METAEXPANDING_DEFAULT); @@ -712,7 +712,7 @@ static LRESULT clcOnKeyDown(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM wPa hit = cliGetRowByIndex(dat,dat->selection,&contact,&group); if (hit != -1) { - if (contact->type == CLCIT_CONTACT &&(contact->isSubcontact || contact->SubAllocated>0)) + if (contact->type == CLCIT_CONTACT && (contact->isSubcontact || contact->SubAllocated>0)) { if (contact->isSubcontact && changeGroupExpand == 1) { @@ -1012,7 +1012,7 @@ static LRESULT clcOnLButtonDown(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM HitPoint.x = (short)LOWORD(lParam); HitPoint.y = (short)HIWORD(lParam); fMouseUpped = FALSE; - if ((GetKeyState(VK_SHIFT)&0x8000)||(GetKeyState(VK_CONTROL)&0x8000) || (GetKeyState(VK_MENU)&0x8000)) + if ((GetKeyState(VK_SHIFT)&0x8000) || (GetKeyState(VK_CONTROL)&0x8000) || (GetKeyState(VK_MENU)&0x8000)) { fMouseUpped = TRUE; hitcontact = contact; @@ -1131,7 +1131,7 @@ static LRESULT clcOnMouseMove(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM w pt.x = (short)LOWORD(lParam); pt.y = (short)HIWORD(lParam); if ( abs(pt.x-dat->ptDragStart.x)>GetSystemMetrics(SM_CXDOUBLECLK) - ||abs(pt.y-dat->ptDragStart.y)>GetSystemMetrics(SM_CYDOUBLECLK)) + || abs(pt.y-dat->ptDragStart.y)>GetSystemMetrics(SM_CYDOUBLECLK)) { KillTimer( hwnd, TIMERID_RENAME ); dat->dragStage &= (~DRAGSTAGEF_MAYBERENAME); @@ -1593,7 +1593,7 @@ static LRESULT clcOnLButtonUp(struct ClcData *dat, HWND hwnd, UINT msg, WPARAM w if (groupName) mir_free_and_nill(groupName); if (sourceGrName) mir_free_and_nill(sourceGrName); } - newIndex = CallService(MS_CLIST_GROUPMOVEBEFORE, contact->groupId, (destcontact&&i != -1)?destcontact->groupId:0); + newIndex = CallService(MS_CLIST_GROUPMOVEBEFORE, contact->groupId, (destcontact && i != -1)?destcontact->groupId:0); newIndex = newIndex?newIndex:contact->groupId; if (NeedRename) pcli->pfnRenameGroup(newIndex,newName); break; @@ -1717,7 +1717,7 @@ static LRESULT clcOnIntmIconChanged(struct ClcData *dat, HWND hwnd, UINT msg, WP bool isVisible = g_CluiData.bFilterEffective&CLVM_FILTER_STATUS ? TRUE : ifVisibleByClui; bool isIconChanged = CallService(MS_CLIST_GETCONTACTICON, wParam, 0) != LOWORD(lParam); - shouldShow = isVisiblebyFilter && ( isVisible || isIconChanged ) ; + shouldShow = isVisiblebyFilter && ( isVisible || isIconChanged ) ; // XXX CLVM changed - this means an offline msg is flashing, so the contact should be shown @@ -1921,7 +1921,7 @@ static LRESULT clcOnIntmStatusChanged(struct ClcData *dat, HWND hwnd, UINT msg, pdnce___SetStatus( pdnce, GetStatusForContact(pdnce->m_cache_hContact,pdnce->m_cache_cszProto)); if (!dat->force_in_dialog && ( (dat->second_line_show)// && dat->second_line_type == TEXT_STATUS) - || (dat->third_line_show)// && dat->third_line_type == TEXT_STATUS) + || (dat->third_line_show)// && dat->third_line_type == TEXT_STATUS) )) gtaRenewText(pdnce->m_cache_hContact); SendMessage(hwnd,INTM_ICONCHANGED, wParam, (LPARAM) CallService(MS_CLIST_GETCONTACTICON, wParam, 1)); @@ -1932,8 +1932,8 @@ static LRESULT clcOnIntmStatusChanged(struct ClcData *dat, HWND hwnd, UINT msg, if (!contact->image_is_special && pdnce___GetStatus( pdnce )>ID_STATUS_OFFLINE) contact->iImage = CallService(MS_CLIST_GETCONTACTICON, wParam, 1); if (contact->isSubcontact - && contact->subcontacts - && contact->subcontacts->type == CLCIT_CONTACT) + && contact->subcontacts + && contact->subcontacts->type == CLCIT_CONTACT) pcli->pfnClcBroadcast( INTM_STATUSCHANGED,(WPARAM)contact->subcontacts->hContact,0); //forward status changing to host meta contact } } @@ -2078,7 +2078,7 @@ int ClcDoProtoAck(HANDLE wParam,ACKDATA * ack) int ClcGetShortData(struct ClcData* pData, struct SHORTDATA *pShortData) { - if (!pData|| !pShortData) return -1; + if (!pData || !pShortData) return -1; pShortData->hWnd = pData->hWnd; pShortData->text_replace_smileys = pData->text_replace_smileys; pShortData->text_smiley_height = pData->text_smiley_height; diff --git a/plugins/Clist_modern/modern_clcidents.cpp b/plugins/Clist_modern/modern_clcidents.cpp index ed19eded5b..5da5d16ab3 100644 --- a/plugins/Clist_modern/modern_clcidents.cpp +++ b/plugins/Clist_modern/modern_clcidents.cpp @@ -137,8 +137,8 @@ int FindItem(HWND hwnd,struct ClcData *dat,HANDLE hItem,struct ClcContact **cont continue; } if (nowVisible) index++; - if ((IsHContactGroup(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_GROUP && ((UINT_PTR)hItem&~HCONTACT_ISGROUP) == group->cl.items[group->scanIndex]->groupId) || - (IsHContactContact(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->hContact == hItem) || + if ((IsHContactGroup(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_GROUP && ((UINT_PTR)hItem&~HCONTACT_ISGROUP) == group->cl.items[group->scanIndex]->groupId) || + (IsHContactContact(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->hContact == hItem) || (IsHContactInfo(hItem) && group->cl.items[group->scanIndex]->type == CLCIT_INFO && group->cl.items[group->scanIndex]->hContact == (HANDLE)((UINT_PTR)hItem&~HCONTACT_ISINFO))) { if (isVisible) { @@ -161,8 +161,8 @@ int FindItem(HWND hwnd,struct ClcData *dat,HANDLE hItem,struct ClcContact **cont return 1; } if (!isIgnoreSubcontacts && - IsHContactContact(hItem) && - group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && + IsHContactContact(hItem) && + group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->SubAllocated > 0) { for (i=0; i < group->cl.items[group->scanIndex]->SubAllocated; i++) diff --git a/plugins/Clist_modern/modern_clcitems.cpp b/plugins/Clist_modern/modern_clcitems.cpp index 319766c139..a2d2e2b50c 100644 --- a/plugins/Clist_modern/modern_clcitems.cpp +++ b/plugins/Clist_modern/modern_clcitems.cpp @@ -44,7 +44,7 @@ void AddSubcontacts(struct ClcData *dat, struct ClcContact * cont, BOOL showOffl } cont->isSubcontact = 0; - mir_free(cont->subcontacts); + mir_free(cont->subcontacts); cont->subcontacts = (struct ClcContact *) mir_calloc(sizeof(struct ClcContact)*subcount); cont->SubAllocated = subcount; i=0; @@ -54,9 +54,9 @@ void AddSubcontacts(struct ClcData *dat, struct ClcContact * cont, BOOL showOffl hsub = (HANDLE)CallService(MS_MC_GETSUBCONTACT,(WPARAM)cont->hContact,j); cacheEntry = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hsub); wStatus = pdnce___GetStatus( cacheEntry ); - if (showOfflineHereGroup||(!(db_get_b(NULL,"CLC","MetaHideOfflineSub",SETTING_METAHIDEOFFLINESUB_DEFAULT) && db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)) || + if (showOfflineHereGroup || (!(db_get_b(NULL,"CLC","MetaHideOfflineSub",SETTING_METAHIDEOFFLINESUB_DEFAULT) && db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)) || wStatus != ID_STATUS_OFFLINE ) - //&& + // && //(!cacheEntry->Hidden || style&CLS_SHOWHIDDEN) ) @@ -190,7 +190,7 @@ static void _LoadDataToContact(struct ClcContact * cont, struct ClcGroup *group, szProto = cacheEntry->m_cache_cszProto; cont->proto = szProto; - if (szProto != NULL&&!pcli->pfnIsHiddenMode(dat,pdnce___GetStatus( cacheEntry ))) + if (szProto != NULL && !pcli->pfnIsHiddenMode(dat,pdnce___GetStatus( cacheEntry ))) cont->flags |= CONTACTF_ONLINE; apparentMode = szProto != NULL?cacheEntry->ApparentMode:0; @@ -424,11 +424,11 @@ void cliRebuildEntireList(HWND hwnd,struct ClcData *dat) if (!(style&CLS_NOHIDEOFFLINE) && (style&CLS_HIDEOFFLINE || group->hideOffline)) { if (cacheEntry->m_cache_cszProto == NULL) { - if (!pcli->pfnIsHiddenMode(dat,ID_STATUS_OFFLINE)||cacheEntry->m_cache_nNoHiddenOffline || CLCItems_IsShowOfflineGroup(group)) + if (!pcli->pfnIsHiddenMode(dat,ID_STATUS_OFFLINE) || cacheEntry->m_cache_nNoHiddenOffline || CLCItems_IsShowOfflineGroup(group)) cont = AddContactToGroup(dat,group,cacheEntry); } else - if (!pcli->pfnIsHiddenMode(dat,wStatus)||cacheEntry->m_cache_nNoHiddenOffline || CLCItems_IsShowOfflineGroup(group)) + if (!pcli->pfnIsHiddenMode(dat,wStatus) || cacheEntry->m_cache_nNoHiddenOffline || CLCItems_IsShowOfflineGroup(group)) cont = AddContactToGroup(dat,group,cacheEntry); } else cont = AddContactToGroup(dat,group,cacheEntry); diff --git a/plugins/Clist_modern/modern_clcopts.cpp b/plugins/Clist_modern/modern_clcopts.cpp index 8c8c5bd400..077fe882e5 100644 --- a/plugins/Clist_modern/modern_clcopts.cpp +++ b/plugins/Clist_modern/modern_clcopts.cpp @@ -535,7 +535,7 @@ static INT_PTR CALLBACK DlgProcClistListOpts(HWND hwndDlg, UINT msg, WPARAM wPar EnableWindow(GetDlgItem(hwndDlg,IDC_SMOOTHTIME),IsDlgButtonChecked(hwndDlg,IDC_NOTNOSMOOTHSCROLLING)); if (LOWORD(wParam) == IDC_GREYOUT) EnableWindow(GetDlgItem(hwndDlg,IDC_GREYOUTOPTS),IsDlgButtonChecked(hwndDlg,IDC_GREYOUT)); - if ((/*LOWORD(wParam) == IDC_LEFTMARGIN ||*/ LOWORD(wParam) == IDC_SMOOTHTIME || LOWORD(wParam) == IDC_GROUPINDENT) && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0; + if ((/*LOWORD(wParam) == IDC_LEFTMARGIN || */ LOWORD(wParam) == IDC_SMOOTHTIME || LOWORD(wParam) == IDC_GROUPINDENT) && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0; SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0); break; case WM_NOTIFY: @@ -882,7 +882,7 @@ static INT_PTR CALLBACK DlgProcTrayOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L CheckDlgButton(hwndDlg, IDC_TRANSPARENTOVERLAY, (trayOption&4) ? BST_CHECKED : BST_UNCHECKED); EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWNORMAL),IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS)); - EnableWindow(GetDlgItem(hwndDlg,IDC_TRANSPARENTOVERLAY),IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS)&&IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL)); + EnableWindow(GetDlgItem(hwndDlg,IDC_TRANSPARENTOVERLAY),IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS) && IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL)); } CheckDlgButton(hwndDlg, IDC_ALWAYSSTATUS, db_get_b(NULL,"CList","AlwaysStatus",SETTING_ALWAYSSTATUS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); @@ -895,7 +895,7 @@ static INT_PTR CALLBACK DlgProcTrayOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L CheckDlgButton(hwndDlg, IDC_MULTITRAY, db_get_b(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_DISABLEBLINK, db_get_b(NULL,"CList","DisableTrayFlash",SETTING_DISABLETRAYFLASH_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_SHOW_AVATARS, db_get_b(NULL,"CList","AvatarsShow",SETTINGS_SHOWAVATARS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED ); - CheckDlgButton(hwndDlg, IDC_SHOW_ANIAVATARS, db_get_b(NULL,"CList","AvatarsAnimated",(ServiceExists(MS_AV_GETAVATARBITMAP)&&!g_CluiData.fGDIPlusFail)) == 1 ? BST_CHECKED : BST_UNCHECKED ); + CheckDlgButton(hwndDlg, IDC_SHOW_ANIAVATARS, db_get_b(NULL,"CList","AvatarsAnimated",(ServiceExists(MS_AV_GETAVATARBITMAP) && !g_CluiData.fGDIPlusFail)) == 1 ? BST_CHECKED : BST_UNCHECKED ); if (IsDlgButtonChecked(hwndDlg,IDC_DONTCYCLE)) { EnableWindow(GetDlgItem(hwndDlg,IDC_CYCLETIMESPIN),FALSE); @@ -929,7 +929,7 @@ static INT_PTR CALLBACK DlgProcTrayOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L item = SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_ADDSTRING,0,(LPARAM)accs[i]->tszAccountName); SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_SETITEMDATA,item,(LPARAM)accs[i]); - if ((dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_UTF8)&& !strcmp(dbv.pszVal,accs[i]->szModuleName)) + if ((dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_UTF8) && !strcmp(dbv.pszVal,accs[i]->szModuleName)) SendDlgItemMessage(hwndDlg,IDC_PRIMARYSTATUS,CB_SETCURSEL,item,0); } db_free(&dbv); @@ -958,10 +958,10 @@ static INT_PTR CALLBACK DlgProcTrayOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_COMMAND: { - if (LOWORD(wParam) == IDC_SHOWXSTATUS||LOWORD(wParam) == IDC_SHOWNORMAL) + if (LOWORD(wParam) == IDC_SHOWXSTATUS || LOWORD(wParam) == IDC_SHOWNORMAL) { EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWNORMAL),IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS)); - EnableWindow(GetDlgItem(hwndDlg,IDC_TRANSPARENTOVERLAY),IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS)&&IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL)); + EnableWindow(GetDlgItem(hwndDlg,IDC_TRANSPARENTOVERLAY),IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS) && IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL)); } if (LOWORD(wParam) == IDC_DONTCYCLE || LOWORD(wParam) == IDC_CYCLE || LOWORD(wParam) == IDC_MULTITRAY) { @@ -1049,7 +1049,7 @@ static INT_PTR CALLBACK DlgProcClistBehaviourOpts(HWND hwndDlg, UINT msg, WPARAM TranslateDialogDefault(hwndDlg); CheckDlgButton(hwndDlg, IDC_CLIENTDRAG, db_get_b(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_DRAGTOSCROLL, (db_get_b(NULL,"CLUI","DragToScroll",SETTING_DRAGTOSCROLL_DEFAULT)&&!db_get_b(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT)) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_DRAGTOSCROLL, (db_get_b(NULL,"CLUI","DragToScroll",SETTING_DRAGTOSCROLL_DEFAULT) && !db_get_b(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT)) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_AUTOSIZE, g_CluiData.fAutoSize ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_LOCKSIZING, db_get_b(NULL,"CLUI","LockSize",SETTING_LOCKSIZE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_BRINGTOFRONT, db_get_b(NULL,"CList","BringToFront",SETTING_BRINGTOFRONT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); @@ -1151,7 +1151,7 @@ static INT_PTR CALLBACK DlgProcClistBehaviourOpts(HWND hwndDlg, UINT msg, WPARAM EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC10),mode != 0); EnableWindow(GetDlgItem(hwndDlg,IDC_STATIC13),mode != 0); } - if ((LOWORD(wParam) == IDC_HIDETIME || LOWORD(wParam) == IDC_HIDEDELAY2 ||LOWORD(wParam) == IDC_HIDEDELAY ||LOWORD(wParam) == IDC_SHOWDELAY || LOWORD(wParam) == IDC_MAXSIZEHEIGHT || LOWORD(wParam) == IDC_MINSIZEHEIGHT) && + if ((LOWORD(wParam) == IDC_HIDETIME || LOWORD(wParam) == IDC_HIDEDELAY2 || LOWORD(wParam) == IDC_HIDEDELAY || LOWORD(wParam) == IDC_SHOWDELAY || LOWORD(wParam) == IDC_MAXSIZEHEIGHT || LOWORD(wParam) == IDC_MINSIZEHEIGHT) && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0; // Enable apply button @@ -1276,7 +1276,7 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP CheckDlgButton(hwndDlg, IDC_AEROGLASS, db_get_b(NULL,"ModernData","AeroGlass",SETTING_AEROGLASS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); EnableWindow(GetDlgItem(hwndDlg,IDC_LAYERENGINE),(g_proc_UpdateLayeredWindow != NULL && !db_get_b(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT))?TRUE:FALSE); - CheckDlgButton(hwndDlg, IDC_LAYERENGINE, ((db_get_b(NULL,"ModernData","EnableLayering",SETTING_ENABLELAYERING_DEFAULT)&&g_proc_UpdateLayeredWindow != NULL) && !db_get_b(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT)) ? BST_UNCHECKED:BST_CHECKED); + CheckDlgButton(hwndDlg, IDC_LAYERENGINE, ((db_get_b(NULL,"ModernData","EnableLayering",SETTING_ENABLELAYERING_DEFAULT) && g_proc_UpdateLayeredWindow != NULL) && !db_get_b(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT)) ? BST_UNCHECKED:BST_CHECKED); { DBVARIANT dbv = {0}; @@ -1348,10 +1348,10 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP { // == == == Activate/Deactivate Non-Layered items == == == = fEnabled = !(IsWindowEnabled(GetDlgItem(hwndDlg,IDC_LAYERENGINE)) && !IsDlgButtonChecked(hwndDlg,IDC_LAYERENGINE) && !IsDlgButtonChecked(hwndDlg,IDC_DISABLEENGINE)); - EnableWindow(GetDlgItem(hwndDlg,IDC_TOOLWND),fEnabled&&(IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION))&&!(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND)||IsDlgButtonChecked(hwndDlg,IDC_BORDER))); - EnableWindow(GetDlgItem(hwndDlg,IDC_MIN2TRAY),fEnabled&&(IsDlgButtonChecked(hwndDlg,IDC_TOOLWND) && IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)) && !(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND)||IsDlgButtonChecked(hwndDlg,IDC_BORDER))); - EnableWindow(GetDlgItem(hwndDlg,IDC_TITLETEXT),fEnabled&&(IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION))&&!(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND)||IsDlgButtonChecked(hwndDlg,IDC_BORDER))); - EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWCAPTION),fEnabled&&!(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND)||IsDlgButtonChecked(hwndDlg,IDC_BORDER))); + EnableWindow(GetDlgItem(hwndDlg,IDC_TOOLWND),fEnabled && (IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)) && !(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND) || IsDlgButtonChecked(hwndDlg,IDC_BORDER))); + EnableWindow(GetDlgItem(hwndDlg,IDC_MIN2TRAY),fEnabled && (IsDlgButtonChecked(hwndDlg,IDC_TOOLWND) && IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)) && !(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND) || IsDlgButtonChecked(hwndDlg,IDC_BORDER))); + EnableWindow(GetDlgItem(hwndDlg,IDC_TITLETEXT),fEnabled && (IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)) && !(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND) || IsDlgButtonChecked(hwndDlg,IDC_BORDER))); + EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWCAPTION),fEnabled && !(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND) || IsDlgButtonChecked(hwndDlg,IDC_BORDER))); EnableWindow(GetDlgItem(hwndDlg,IDC_BORDER),fEnabled); EnableWindow(GetDlgItem(hwndDlg,IDC_NOBORDERWND),fEnabled); EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWMAINMENU),fEnabled); @@ -1381,19 +1381,19 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP EnableWindow(GetDlgItem(hwndDlg,IDC_MIN2TRAY),!IsDlgButtonChecked(hwndDlg,IDC_TOOLWND) && IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)); EnableWindow(GetDlgItem(hwndDlg,IDC_TITLETEXT),IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)); } - else if (LOWORD(wParam) == IDC_NOBORDERWND ||LOWORD(wParam) == IDC_BORDER) + else if (LOWORD(wParam) == IDC_NOBORDERWND || LOWORD(wParam) == IDC_BORDER) { - EnableWindow(GetDlgItem(hwndDlg,IDC_TOOLWND),(IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION))&&!(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND)||IsDlgButtonChecked(hwndDlg,IDC_BORDER))); - EnableWindow(GetDlgItem(hwndDlg,IDC_MIN2TRAY),(IsDlgButtonChecked(hwndDlg,IDC_TOOLWND) && IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)) && !(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND)||IsDlgButtonChecked(hwndDlg,IDC_BORDER))); - EnableWindow(GetDlgItem(hwndDlg,IDC_TITLETEXT),(IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION))&&!(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND)||IsDlgButtonChecked(hwndDlg,IDC_BORDER))); - EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWCAPTION),!(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND)||IsDlgButtonChecked(hwndDlg,IDC_BORDER))); + EnableWindow(GetDlgItem(hwndDlg,IDC_TOOLWND),(IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)) && !(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND) || IsDlgButtonChecked(hwndDlg,IDC_BORDER))); + EnableWindow(GetDlgItem(hwndDlg,IDC_MIN2TRAY),(IsDlgButtonChecked(hwndDlg,IDC_TOOLWND) && IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)) && !(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND) || IsDlgButtonChecked(hwndDlg,IDC_BORDER))); + EnableWindow(GetDlgItem(hwndDlg,IDC_TITLETEXT),(IsDlgButtonChecked(hwndDlg,IDC_SHOWCAPTION)) && !(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND) || IsDlgButtonChecked(hwndDlg,IDC_BORDER))); + EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWCAPTION),!(IsDlgButtonChecked(hwndDlg,IDC_NOBORDERWND) || IsDlgButtonChecked(hwndDlg,IDC_BORDER))); if (LOWORD(wParam) == IDC_BORDER) CheckDlgButton(hwndDlg, IDC_NOBORDERWND,BST_UNCHECKED); else CheckDlgButton(hwndDlg, IDC_BORDER,BST_UNCHECKED); } - if ((LOWORD(wParam) == IDC_TITLETEXT || LOWORD(wParam) == IDC_MAXSIZEHEIGHT || LOWORD(wParam) == IDC_MINSIZEHEIGHT || LOWORD(wParam) == IDC_FRAMESGAP || LOWORD(wParam) == IDC_CAPTIONSGAP || - LOWORD(wParam) == IDC_LEFTMARGIN || LOWORD(wParam) == IDC_RIGHTMARGIN|| LOWORD(wParam) == IDC_TOPMARGIN || LOWORD(wParam) == IDC_BOTTOMMARGIN) - &&(HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) + if ((LOWORD(wParam) == IDC_TITLETEXT || LOWORD(wParam) == IDC_MAXSIZEHEIGHT || LOWORD(wParam) == IDC_MINSIZEHEIGHT || LOWORD(wParam) == IDC_FRAMESGAP || LOWORD(wParam) == IDC_CAPTIONSGAP || + LOWORD(wParam) == IDC_LEFTMARGIN || LOWORD(wParam) == IDC_RIGHTMARGIN || LOWORD(wParam) == IDC_TOPMARGIN || LOWORD(wParam) == IDC_BOTTOMMARGIN) + && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0; // Enable apply button SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0); @@ -1471,7 +1471,7 @@ static INT_PTR CALLBACK DlgProcClistWindowOpts(HWND hwndDlg, UINT msg, WPARAM wP } AniAva_UpdateParent(); db_set_b(NULL,"CLUI","FadeInOut",(BYTE)IsDlgButtonChecked(hwndDlg,IDC_FADEINOUT)); - g_CluiData.fSmoothAnimation = IsWinVer2000Plus()&&(BYTE)IsDlgButtonChecked(hwndDlg,IDC_FADEINOUT); + g_CluiData.fSmoothAnimation = IsWinVer2000Plus() && (BYTE)IsDlgButtonChecked(hwndDlg,IDC_FADEINOUT); { int i1; int i2; @@ -1600,9 +1600,8 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, return TRUE; } case WM_DESTROY: - if (dat) - { - if (dat->item) mir_free(dat->item); + if (dat) { + mir_free(dat->item); mir_free(dat); } @@ -1829,8 +1828,7 @@ static INT_PTR BkgrCfg_Register(WPARAM wParam,LPARAM lParam) value = (char *)mir_alloc(len + 4); // add room for flags (DWORD) memcpy(value, szSetting, len); tok = strchr(value, '/'); - if (tok == NULL) - { + if (tok == NULL) { mir_free(value); return 1; } @@ -1853,10 +1851,8 @@ HRESULT BackgroundsLoadModule() int BackgroundsUnloadModule(void) { - if (bkgrList != NULL) - { - int indx; - for(indx = 0; indx < bkgrCount; indx++) + if (bkgrList != NULL) { + for(int indx = 0; indx < bkgrCount; indx++) if (bkgrList[indx] != NULL) mir_free(bkgrList[indx]); mir_free(bkgrList); diff --git a/plugins/Clist_modern/modern_clcpaint.cpp b/plugins/Clist_modern/modern_clcpaint.cpp index eb9a8ae937..72445c2b39 100644 --- a/plugins/Clist_modern/modern_clcpaint.cpp +++ b/plugins/Clist_modern/modern_clcpaint.cpp @@ -181,10 +181,10 @@ int CLCPaint::GetBasicFontID( struct ClcContact * contact ) if ( contact->flags & CONTACTF_NOTONLIST ) return FONTID_NOTONLIST; else if ( ( contact->flags&CONTACTF_INVISTO - && _GetRealStatus( contact, ID_STATUS_OFFLINE ) != ID_STATUS_INVISIBLE ) - || + && _GetRealStatus( contact, ID_STATUS_OFFLINE ) != ID_STATUS_INVISIBLE ) + || ( contact->flags&CONTACTF_VISTO - && _GetRealStatus( contact, ID_STATUS_OFFLINE ) == ID_STATUS_INVISIBLE )) + && _GetRealStatus( contact, ID_STATUS_OFFLINE ) == ID_STATUS_INVISIBLE )) { // the contact is in the always visible list and the proto is invisible // the contact is in the always invisible and the proto is in any other mode @@ -284,8 +284,8 @@ void CLCPaint::AddParam( MODERNMASK * mpModernMask, DWORD dwParamHash, const ch BOOL CLCPaint::CheckMiniMode( struct ClcData *dat, BOOL selected, BOOL hot ) { if ( ( !dat->bCompactMode /* not mini*/ ) - ||( ( dat->bCompactMode&0x01 ) && selected /*mini on selected*/ ) - /*||( TRUE && hot )*/ ) return FALSE; + || ( ( dat->bCompactMode&0x01 ) && selected /*mini on selected*/ ) + /* || ( TRUE && hot )*/ ) return FALSE; return TRUE; } @@ -727,8 +727,8 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, str if ( Drawing->type == CLCIT_CONTACT ) pdnce = ( PDNCE )pcli->pfnGetCacheEntry( Drawing->hContact ); - if ( Drawing->type == CLCIT_GROUP && - Drawing->group->parent->groupId == 0 && + if ( Drawing->type == CLCIT_GROUP && + Drawing->group->parent->groupId == 0 && Drawing->group->parent->cl.items[0] != Drawing ) { dg = dat->row_before_group_space; @@ -779,7 +779,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, str mode = ILD_NORMAL; } - if ( Drawing->type == CLCIT_CONTACT && dat->showIdle && ( Drawing->flags&CONTACTF_IDLE ) && + if ( Drawing->type == CLCIT_CONTACT && dat->showIdle && ( Drawing->flags&CONTACTF_IDLE ) && _GetRealStatus( Drawing, ID_STATUS_OFFLINE ) != ID_STATUS_OFFLINE ) { mode = ILD_SELECTED; @@ -1041,7 +1041,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, str Drawing->pos_rename_rect = rc; } - if ( ( !InClistWindow || !g_CluiData.fLayered )&& ( ( Drawing->type == CLCIT_DIVIDER ) || ( Drawing->type == CLCIT_GROUP && dat->exStyle&CLS_EX_LINEWITHGROUPS )) ) + if ( ( !InClistWindow || !g_CluiData.fLayered ) && ( ( Drawing->type == CLCIT_DIVIDER ) || ( Drawing->type == CLCIT_GROUP && dat->exStyle&CLS_EX_LINEWITHGROUPS )) ) { //??? RECT rc = fr_rc; @@ -1273,7 +1273,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, str if ( ( Drawing->type == CLCIT_GROUP && !dat->row_hide_group_icon ) || ( Drawing->type == CLCIT_CONTACT && Drawing->iImage != -1 && !( dat->icon_hide_on_avatar && dat->avatars_show - && ( ( dat->use_avatar_service && Drawing->avatar_data != NULL ) || + && ( ( dat->use_avatar_service && Drawing->avatar_data != NULL ) || ( !dat->use_avatar_service && Drawing->avatar_pos != AVATAR_POS_DONT_HAVE ) ) && !Drawing->image_is_special )) ) @@ -1309,7 +1309,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, str mode = ILD_NORMAL; } - if ( Drawing->type == CLCIT_CONTACT && dat->showIdle && ( Drawing->flags&CONTACTF_IDLE ) && + if ( Drawing->type == CLCIT_CONTACT && dat->showIdle && ( Drawing->flags&CONTACTF_IDLE ) && _GetRealStatus( Drawing, ID_STATUS_OFFLINE ) != ID_STATUS_OFFLINE ) { mode = ILD_SELECTED; @@ -1324,13 +1324,13 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, str } case TC_AVATAR: { - BOOL hasAvatar = ( dat->use_avatar_service && Drawing->avatar_data != NULL ) ||( !dat->use_avatar_service && Drawing->avatar_pos != AVATAR_POS_DONT_HAVE ); + BOOL hasAvatar = ( dat->use_avatar_service && Drawing->avatar_data != NULL ) || ( !dat->use_avatar_service && Drawing->avatar_pos != AVATAR_POS_DONT_HAVE ); BYTE blendmode = 255; if ( hottrack ) blendmode = 255; else if ( Drawing->type == CLCIT_CONTACT && Drawing->flags&CONTACTF_NOTONLIST ) blendmode = 128; - if ( Drawing->type == CLCIT_CONTACT && dat->showIdle && ( Drawing->flags&CONTACTF_IDLE ) && + if ( Drawing->type == CLCIT_CONTACT && dat->showIdle && ( Drawing->flags&CONTACTF_IDLE ) && _GetRealStatus( Drawing, ID_STATUS_OFFLINE ) != ID_STATUS_OFFLINE ) blendmode = 128; if ( !hasAvatar ) //if no avatar then paint icon image @@ -1358,7 +1358,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, str mode = ILD_NORMAL; } - if ( Drawing->type == CLCIT_CONTACT && dat->showIdle && ( Drawing->flags&CONTACTF_IDLE ) && + if ( Drawing->type == CLCIT_CONTACT && dat->showIdle && ( Drawing->flags&CONTACTF_IDLE ) && _GetRealStatus( Drawing, ID_STATUS_OFFLINE ) != ID_STATUS_OFFLINE ) { mode = ILD_SELECTED; @@ -1552,7 +1552,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, str case TC_EXTRA: { - if ( Drawing->type == CLCIT_CONTACT && + if ( Drawing->type == CLCIT_CONTACT && ( !Drawing->isSubcontact || dat->dbbMetaHideExtra == 0 && dat->extraColumnsCount > 0 )) { int BlendedInActiveState = dat->dbbBlendInActiveState; @@ -1615,7 +1615,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, str case TC_EXTRA8: case TC_EXTRA9: { - if ( Drawing->type == CLCIT_CONTACT && + if ( Drawing->type == CLCIT_CONTACT && ( !Drawing->isSubcontact || dat->dbbMetaHideExtra == 0 && dat->extraColumnsCount > 0 )) { int eNum = gl_RowTabAccess[i]->type-TC_EXTRA1; @@ -2036,8 +2036,8 @@ void CLCPaint::_DrawLines( HWND hWnd, struct ClcData * dat, HDC hdc, int paintMo if ( selected || hottrack ) { RECT mrc = row_rc; - if ( Drawing->type == CLCIT_GROUP && - Drawing->group->parent->groupId == 0 && + if ( Drawing->type == CLCIT_GROUP && + Drawing->group->parent->groupId == 0 && Drawing->group->parent->cl.items[0] != Drawing ) { mrc.top += dat->row_before_group_space; @@ -2063,8 +2063,8 @@ void CLCPaint::_DrawLines( HWND hWnd, struct ClcData * dat, HDC hdc, int paintMo else { int checkboxWidth; - if ( ( lStyle&CLS_CHECKBOXES && Drawing->type == CLCIT_CONTACT ) || - ( lStyle&CLS_GROUPCHECKBOXES && Drawing->type == CLCIT_GROUP ) || + if ( ( lStyle&CLS_CHECKBOXES && Drawing->type == CLCIT_CONTACT ) || + ( lStyle&CLS_GROUPCHECKBOXES && Drawing->type == CLCIT_GROUP ) || ( Drawing->type == CLCIT_INFO && Drawing->flags&CLCIIF_CHECKBOX )) checkboxWidth = dat->checkboxSize+2; else checkboxWidth = 0; @@ -2105,8 +2105,8 @@ void CLCPaint::_DrawLines( HWND hWnd, struct ClcData * dat, HDC hdc, int paintMo } //**** Checkboxes - if ( ( lStyle&CLS_CHECKBOXES && Drawing->type == CLCIT_CONTACT ) || - ( lStyle&CLS_GROUPCHECKBOXES && Drawing->type == CLCIT_GROUP ) || + if ( ( lStyle&CLS_CHECKBOXES && Drawing->type == CLCIT_CONTACT ) || + ( lStyle&CLS_GROUPCHECKBOXES && Drawing->type == CLCIT_GROUP ) || ( Drawing->type == CLCIT_INFO && Drawing->flags&CLCIIF_CHECKBOX )) { //RECT rc; @@ -2137,8 +2137,8 @@ void CLCPaint::_DrawLines( HWND hWnd, struct ClcData * dat, HDC hdc, int paintMo mpRequest->pl_Params[1].dwValueHash = mod_CalcHash( "Ovl" ); { RECT mrc = row_rc; - if ( Drawing->type == CLCIT_GROUP && - Drawing->group->parent->groupId == 0 && + if ( Drawing->type == CLCIT_GROUP && + Drawing->group->parent->groupId == 0 && Drawing->group->parent->cl.items[0] != Drawing ) { mrc.top += dat->row_before_group_space; @@ -2435,7 +2435,7 @@ void CLCPaint::_CalcItemsPos( HWND hwnd, HDC hdcMem, struct ClcData *dat, struct { RECT rc; int iImage = -1; - BOOL has_avatar = ( ( dat->use_avatar_service && Drawing->avatar_data != NULL ) || + BOOL has_avatar = ( ( dat->use_avatar_service && Drawing->avatar_data != NULL ) || ( !dat->use_avatar_service && Drawing->avatar_pos != AVATAR_POS_DONT_HAVE )) && !( CheckMiniMode( dat, selected, hottrack )); @@ -2461,7 +2461,7 @@ void CLCPaint::_CalcItemsPos( HWND hwnd, HDC hdcMem, struct ClcData *dat, struct if ( Drawing->type == CLCIT_CONTACT && dat->icon_hide_on_avatar && dat->icon_draw_on_avatar_space - && ( !Drawing->image_is_special || !has_avatar || + && ( !Drawing->image_is_special || !has_avatar || ( dat->avatars_draw_overlay && dat->avatars_maxheight_size >= ICON_HEIGHT + ( dat->avatars_draw_border ? 2 : 0 ) @@ -2977,8 +2977,8 @@ void CLCPaint::_GetBlendMode( IN struct ClcData *dat, IN struct ClcContact * Dra colourFg = dat->selBkColour; mode = ILD_NORMAL; } - if ( Drawing->type == CLCIT_CONTACT && dat->showIdle && ( Drawing->flags&CONTACTF_IDLE ) && - _GetRealStatus( Drawing, ID_STATUS_OFFLINE ) != ID_STATUS_OFFLINE && + if ( Drawing->type == CLCIT_CONTACT && dat->showIdle && ( Drawing->flags&CONTACTF_IDLE ) && + _GetRealStatus( Drawing, ID_STATUS_OFFLINE ) != ID_STATUS_OFFLINE && ( bFlag&GIM_IDLE_AFFECT ) ) mode = ILD_SELECTED; @@ -3000,7 +3000,7 @@ void CLCPaint::_DrawContactAvatar( HDC hdcMem, struct ClcData *dat, struct ClcCo int overlayIdx = -1; int blendmode = 255; if ( dat->avatars_draw_overlay && dat->avatars_maxheight_size >= ICON_HEIGHT + ( dat->avatars_draw_border ? 2 : 0 ) - && GetContactCachedStatus( Drawing->hContact ) - ID_STATUS_OFFLINE < MAX_REGS( g_pAvatarOverlayIcons )) + && GetContactCachedStatus( Drawing->hContact ) - ID_STATUS_OFFLINE < MAX_REGS( g_pAvatarOverlayIcons )) { switch( dat->avatars_overlay_type ) { @@ -3072,7 +3072,7 @@ void CLCPaint::_DrawContactAvatar( HDC hdcMem, struct ClcData *dat, struct ClcCo DeleteObject( rgn ); // Draw overlays if ( dat->avatars_draw_overlay && dat->avatars_maxheight_size >= ICON_HEIGHT + ( dat->avatars_draw_border ? 2 : 0 ) - && GetContactCachedStatus( Drawing->hContact ) - ID_STATUS_OFFLINE < MAX_REGS( g_pAvatarOverlayIcons )) + && GetContactCachedStatus( Drawing->hContact ) - ID_STATUS_OFFLINE < MAX_REGS( g_pAvatarOverlayIcons )) { POINT ptOverlay = { prcItem->right-ICON_HEIGHT, prcItem->bottom-ICON_HEIGHT }; if ( dat->avatars_draw_border ) @@ -3357,7 +3357,7 @@ void CLCPaint::_DrawContactItems( HWND hwnd, HDC hdcMem, struct ClcData *dat, st } } if ( ( Drawing->type == CLCIT_GROUP && dat->exStyle&CLS_EX_LINEWITHGROUPS ) - ||( Drawing->type == CLCIT_DIVIDER )) + || ( Drawing->type == CLCIT_DIVIDER )) _DrawContactLine( hdcMem, dat, Drawing, free_row_rc, rcPaint, text_rc ); } void CLCPaint::_PaintRowItems ( HWND hwnd, HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, RECT row_rc, RECT free_row_rc, int left_pos, int right_pos, int selected, int hottrack, RECT *rcPaint ) diff --git a/plugins/Clist_modern/modern_clcutils.cpp b/plugins/Clist_modern/modern_clcutils.cpp index c08c57bacd..38ce06fcee 100644 --- a/plugins/Clist_modern/modern_clcutils.cpp +++ b/plugins/Clist_modern/modern_clcutils.cpp @@ -74,7 +74,7 @@ int cliHitTest(HWND hwnd,struct ClcData *dat,int testx,int testy,struct ClcConta if (group) *group = hitgroup; ///////// - if ( ((testx < hitcontact->pos_indent) && !dat->text_rtl) || + if ( ((testx < hitcontact->pos_indent) && !dat->text_rtl) || ((testx>clRect.right-hitcontact->pos_indent) && dat->text_rtl)) { if (flags) *flags |= CLCHT_ONITEMINDENT; @@ -168,7 +168,7 @@ void cliScrollTo(HWND hwnd,struct ClcData *dat,int desty,int noSmooth) nowTick = GetTickCount(); if (nowTick >= startTick+dat->scrollTime) break; dat->yScroll = oldy+(desty-oldy)*(int)(nowTick-startTick)/dat->scrollTime; - if (/*dat->backgroundBmpUse&CLBF_SCROLL || dat->hBmpBackground == NULL &&*/FALSE) + if (/*dat->backgroundBmpUse&CLBF_SCROLL || dat->hBmpBackground == NULL && */FALSE) ScrollWindowEx(hwnd,0,previousy-dat->yScroll,NULL,NULL,NULL,NULL,SW_INVALIDATE); else { @@ -387,7 +387,7 @@ int GetDropTargetInformation(HWND hwnd,struct ClcData *dat,POINT pt) topItem = cliGetRowByIndex(dat,topItem,&topcontact,&topgroup); ok = 1; } else if ((pt.y+dat->yScroll >= cliGetRowTopY(dat,hit+1)-dat->insertionMarkHitHeight) - ||(contact->type == CLCIT_GROUP && contact->group->expanded && contact->group->cl.count>0)) + || (contact->type == CLCIT_GROUP && contact->group->expanded && contact->group->cl.count>0)) { //could be insertion mark (below) topItem = hit; bottomItem = hit+1; @@ -462,7 +462,7 @@ int GetDropTargetInformation(HWND hwnd,struct ClcData *dat,POINT pt) } dat->selection = hit; - if (g_szMetaModuleName && !mir_strcmp(contact->proto,g_szMetaModuleName)&& (ServiceExists(MS_MC_ADDTOMETA))) return DROPTARGET_ONMETACONTACT; + if (g_szMetaModuleName && !mir_strcmp(contact->proto,g_szMetaModuleName) && (ServiceExists(MS_MC_ADDTOMETA))) return DROPTARGET_ONMETACONTACT; if (contact->isSubcontact && (ServiceExists(MS_MC_ADDTOMETA))) return DROPTARGET_ONSUBCONTACT; return DROPTARGET_ONCONTACT; } @@ -519,8 +519,8 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat ) // Row dat->row_min_heigh = db_get_w(NULL,"CList","MinRowHeight",CLCDEFAULT_ROWHEIGHT); dat->row_border = db_get_w(NULL,"CList","RowBorder",SETTING_ROWBORDER_DEFAULT); - dat->row_before_group_space = ((hwnd != pcli->hwndContactTree&&pcli->hwndContactTree != NULL) - || !db_get_b(NULL,"ModernData","UseAdvancedRowLayout",SETTING_ROW_ADVANCEDLAYOUT_DEFAULT))?0:db_get_w(NULL,"ModernSkin","SpaceBeforeGroup",SKIN_SPACEBEFOREGROUP_DEFAULT); + dat->row_before_group_space = ((hwnd != pcli->hwndContactTree && pcli->hwndContactTree != NULL) + || !db_get_b(NULL,"ModernData","UseAdvancedRowLayout",SETTING_ROW_ADVANCEDLAYOUT_DEFAULT))?0:db_get_w(NULL,"ModernSkin","SpaceBeforeGroup",SKIN_SPACEBEFOREGROUP_DEFAULT); dat->row_variable_height = db_get_b(NULL,"CList","VariableRowHeight",SETTING_VARIABLEROWHEIGHT_DEFAULT); dat->row_align_left_items_to_left = db_get_b(NULL,"CList","AlignLeftItemsToLeft",SETTING_ALIGNLEFTTOLEFT_DEFAULT); dat->row_hide_group_icon = db_get_b(NULL,"CList","HideGroupsIcon",SETTING_HIDEGROUPSICON_DEFAULT); @@ -576,7 +576,7 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat ) } // Icon - if (pcli->hwndContactTree == hwnd|| pcli->hwndContactTree == NULL) + if (pcli->hwndContactTree == hwnd || pcli->hwndContactTree == NULL) { dat->icon_hide_on_avatar = db_get_b(NULL,"CList","IconHideOnAvatar",SETTING_HIDEICONONAVATAR_DEFAULT); dat->icon_draw_on_avatar_space = db_get_b(NULL,"CList","IconDrawOnAvatarSpace",SETTING_ICONONAVATARPLACE_DEFAULT); @@ -590,7 +590,7 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat ) } // Contact time - if (pcli->hwndContactTree == hwnd|| pcli->hwndContactTree == NULL) + if (pcli->hwndContactTree == hwnd || pcli->hwndContactTree == NULL) { dat->contact_time_show = db_get_b(NULL,"CList","ContactTimeShow",SETTING_SHOWTIME_DEFAULT); dat->contact_time_show_only_if_different = db_get_b(NULL,"CList","ContactTimeShowOnlyIfDifferent",SETTING_SHOWTIMEIFDIFF_DEFAULT); @@ -609,7 +609,7 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat ) dat->text_smiley_height = 0; dat->text_use_protocol_smileys = db_get_b(NULL,"CList","TextUseProtocolSmileys",SETTING_TEXT_PROTOSMILEY_DEFAULT); - if (pcli->hwndContactTree == hwnd|| pcli->hwndContactTree == NULL) + if (pcli->hwndContactTree == hwnd || pcli->hwndContactTree == NULL) { dat->text_ignore_size_for_row_height = db_get_b(NULL,"CList","TextIgnoreSizeForRownHeight",SETTING_TEXT_IGNORESIZE_DEFAULT); } @@ -756,7 +756,7 @@ void LoadCLCOptions(HWND hwnd, struct ClcData *dat ) dat->hotTextColour = db_get_dw(NULL,"CLC","HotTextColour",CLCDEFAULT_MODERN_HOTTEXTCOLOUR); dat->quickSearchColour = db_get_dw(NULL,"CLC","QuickSearchColour",CLCDEFAULT_MODERN_QUICKSEARCHCOLOUR); if (!g_szMetaModuleName && ServiceExists(MS_MC_GETPROTOCOLNAME)) g_szMetaModuleName = (char *)CallService(MS_MC_GETPROTOCOLNAME, 0, 0); - dat->IsMetaContactsEnabled = (!(GetWindowLongPtr(hwnd,GWL_STYLE)&CLS_MANUALUPDATE)) && + dat->IsMetaContactsEnabled = (!(GetWindowLongPtr(hwnd,GWL_STYLE)&CLS_MANUALUPDATE)) && g_szMetaModuleName && db_get_b(NULL,g_szMetaModuleName,"Enabled",1) && ServiceExists(MS_MC_GETDEFAULTCONTACT); if (pcli->hwndContactTree == NULL || dat->hWnd == pcli->hwndContactTree) @@ -794,7 +794,7 @@ int ExpandMetaContact(HWND hwnd, struct ClcContact * contact, struct ClcData * d { struct ClcContact * ht = NULL; KillTimer(hwnd,TIMERID_SUBEXPAND); - if (contact->type != CLCIT_CONTACT ||contact->SubAllocated == 0 || contact->SubExpanded == bExpand || !db_get_b(NULL,"CLC","MetaExpanding",SETTING_METAEXPANDING_DEFAULT)) return 0; + if (contact->type != CLCIT_CONTACT || contact->SubAllocated == 0 || contact->SubExpanded == bExpand || !db_get_b(NULL,"CLC","MetaExpanding",SETTING_METAEXPANDING_DEFAULT)) return 0; contact->SubExpanded = bExpand; db_set_b(contact->hContact,"CList","Expanded",contact->SubExpanded); dat->NeedResort = 1; @@ -822,7 +822,7 @@ int cliFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int pref contact = group->cl.items[group->scanIndex]; if (contact->type != CLCIT_DIVIDER) { - if ((prefixOk && !_tcsnicmp(text, contact->szText, testlen)) || + if ((prefixOk && !_tcsnicmp(text, contact->szText, testlen)) || (!prefixOk && !lstrcmpi(text, contact->szText))) { struct ClcGroup *contactGroup = group; @@ -849,7 +849,7 @@ int cliFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int pref for (i=0; i < contact->SubAllocated; i++) { struct ClcContact * subcontact = &(contact->subcontacts[i]); - if ((prefixOk && !_tcsnicmp(text, subcontact->szText, testlen)) || + if ((prefixOk && !_tcsnicmp(text, subcontact->szText, testlen)) || (!prefixOk && !lstrcmpi(text, subcontact->szText))) { struct ClcGroup *contactGroup = group; diff --git a/plugins/Clist_modern/modern_clistmod.cpp b/plugins/Clist_modern/modern_clistmod.cpp index 27216b7797..9837c2aeac 100644 --- a/plugins/Clist_modern/modern_clistmod.cpp +++ b/plugins/Clist_modern/modern_clistmod.cpp @@ -373,7 +373,7 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) { BYTE *ptr = NULL; HRGN rgn = NULL; WindowImage = g_CluiData.fLayered?ske_GetCurrentWindowImage():0; - if (WindowImage&&g_CluiData.fLayered) + if (WindowImage && g_CluiData.fLayered) { GetObject(WindowImage,sizeof(BITMAP),&bmp); ptr = (BYTE*)bmp.bmBits; @@ -425,7 +425,7 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) { a = ((a*g_CluiData.bCurrentAlpha)>>8); po = (a>16); } - if (po||(!rgn&&ptr == 0)) + if (po || (!rgn && ptr == 0)) { BOOL hWndFound = FALSE; HWND hAuxOld = NULL; @@ -450,7 +450,7 @@ int GetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) { break; } } - }while(hAux != NULL &&hAuxOld != hAux); + }while(hAux != NULL && hAuxOld != hAux); if (hWndFound) //There's window! iNotCoveredDots++; //Let's count the not covered dots. diff --git a/plugins/Clist_modern/modern_clistopts.cpp b/plugins/Clist_modern/modern_clistopts.cpp index eb3701a75a..28a3cbe975 100644 --- a/plugins/Clist_modern/modern_clistopts.cpp +++ b/plugins/Clist_modern/modern_clistopts.cpp @@ -355,7 +355,7 @@ static INT_PTR CALLBACK DlgProcItemAvatarOpts(HWND hwndDlg, UINT msg, WPARAM wPa { TranslateDialogDefault(hwndDlg); CheckDlgButton(hwndDlg, IDC_SHOW_AVATARS, db_get_b(NULL,"CList","AvatarsShow",SETTINGS_SHOWAVATARS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED ); - CheckDlgButton(hwndDlg, IDC_SHOW_ANIAVATARS, db_get_b(NULL,"CList","AvatarsAnimated",(ServiceExists(MS_AV_GETAVATARBITMAP)&&!g_CluiData.fGDIPlusFail)) == 1 ? BST_CHECKED : BST_UNCHECKED ); + CheckDlgButton(hwndDlg, IDC_SHOW_ANIAVATARS, db_get_b(NULL,"CList","AvatarsAnimated",(ServiceExists(MS_AV_GETAVATARBITMAP) && !g_CluiData.fGDIPlusFail)) == 1 ? BST_CHECKED : BST_UNCHECKED ); CheckDlgButton(hwndDlg, IDC_AVATAR_FASTDRAW, db_get_b(NULL,"CList","AvatarsInSeparateWnd",SETTINGS_AVATARINSEPARATE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_AVATAR_DRAW_BORDER, db_get_b(NULL,"CList","AvatarsDrawBorders",SETTINGS_AVATARDRAWBORDER_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED ); CheckDlgButton(hwndDlg, IDC_AVATAR_ROUND_CORNERS, db_get_b(NULL,"CList","AvatarsRoundCorners",SETTINGS_AVATARROUNDCORNERS_DEFAULT) == 1 ? BST_CHECKED : BST_UNCHECKED ); @@ -445,7 +445,7 @@ static INT_PTR CALLBACK DlgProcItemAvatarOpts(HWND hwndDlg, UINT msg, WPARAM wPa EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_OVERLAY_ICON_PROTOCOL),FALSE); EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_OVERLAY_ICON_CONTACT),FALSE); } - if (!ServiceExists(MS_AV_GETAVATARBITMAP)||g_CluiData.fGDIPlusFail) + if (!ServiceExists(MS_AV_GETAVATARBITMAP) || g_CluiData.fGDIPlusFail) { EnableWindow(GetDlgItem(hwndDlg,IDC_SHOW_ANIAVATARS),FALSE); SetDlgItemText(hwndDlg, IDC_SHOW_ANIAVATARS, TranslateT("Animate Avatars (GDI+ and Avatar Service module (avs.dll) are required)")); @@ -473,7 +473,7 @@ static INT_PTR CALLBACK DlgProcItemAvatarOpts(HWND hwndDlg, UINT msg, WPARAM wPa EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_SIZE_SPIN),enabled); EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_SIZE_PIXELS2),enabled); EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_SIZE_PIXELS3),enabled); - EnableWindow(GetDlgItem(hwndDlg,IDC_SHOW_ANIAVATARS),enabled && (ServiceExists(MS_AV_GETAVATARBITMAP)&&!g_CluiData.fGDIPlusFail)); + EnableWindow(GetDlgItem(hwndDlg,IDC_SHOW_ANIAVATARS),enabled && (ServiceExists(MS_AV_GETAVATARBITMAP) && !g_CluiData.fGDIPlusFail)); // if (DBGetContactSettingByte(NULL,"ModernData","UseAdvancedRowLayout",SETTING_ROW_ADVANCEDLAYOUT_DEFAULT) == 1) // { @@ -514,8 +514,8 @@ static INT_PTR CALLBACK DlgProcItemAvatarOpts(HWND hwndDlg, UINT msg, WPARAM wPa { BOOL enabled = IsDlgButtonChecked(hwndDlg,IDC_AVATAR_ROUND_CORNERS); EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK),enabled); - EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_CUSTOM_CORNER_SIZE),enabled&&IsDlgButtonChecked(hwndDlg,IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK)); - EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_CUSTOM_CORNER_SIZE_SPIN),enabled&&IsDlgButtonChecked(hwndDlg,IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK)); + EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_CUSTOM_CORNER_SIZE),enabled && IsDlgButtonChecked(hwndDlg,IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK)); + EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_CUSTOM_CORNER_SIZE_SPIN),enabled && IsDlgButtonChecked(hwndDlg,IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK)); } else if (LOWORD(wParam) == IDC_AVATAR_OVERLAY_ICONS) { @@ -878,22 +878,22 @@ static INT_PTR CALLBACK DlgProcItemSecondLineOpts(HWND hwndDlg, UINT msg, WPARAM case WM_COMMAND: { if (LOWORD(wParam) == IDC_TEXT || LOWORD(wParam) == IDC_STATUS || LOWORD(wParam) == IDC_NICKNAME || LOWORD(wParam) == IDC_STATUS_MESSAGE - || LOWORD(wParam) == IDC_LISTENING_TO || LOWORD(wParam) == IDC_CONTACT_TIME) + || LOWORD(wParam) == IDC_LISTENING_TO || LOWORD(wParam) == IDC_CONTACT_TIME) { EnableWindow(GetDlgItem(hwndDlg,IDC_VARIABLE_TEXT), IsDlgButtonChecked(hwndDlg,IDC_TEXT) - && IsDlgButtonChecked(hwndDlg,IDC_SHOW)); + && IsDlgButtonChecked(hwndDlg,IDC_SHOW)); EnableWindow(GetDlgItem(hwndDlg,IDC_VARIABLES_L), IsDlgButtonChecked(hwndDlg,IDC_TEXT) - && IsDlgButtonChecked(hwndDlg,IDC_SHOW)); + && IsDlgButtonChecked(hwndDlg,IDC_SHOW)); EnableWindow(GetDlgItem(hwndDlg,IDC_XSTATUS_HAS_PRIORITY), IsDlgButtonChecked(hwndDlg,IDC_SHOW) && (IsDlgButtonChecked(hwndDlg,IDC_STATUS) - || IsDlgButtonChecked(hwndDlg,IDC_STATUS_MESSAGE))); + || IsDlgButtonChecked(hwndDlg,IDC_STATUS_MESSAGE))); EnableWindow(GetDlgItem(hwndDlg,IDC_SHOW_STATUS_IF_NOAWAY), IsDlgButtonChecked(hwndDlg,IDC_SHOW) && (IsDlgButtonChecked(hwndDlg,IDC_STATUS_MESSAGE))); EnableWindow(GetDlgItem(hwndDlg,IDC_SHOW_LISTENING_IF_NOAWAY), IsDlgButtonChecked(hwndDlg,IDC_SHOW) && (IsDlgButtonChecked(hwndDlg,IDC_STATUS_MESSAGE))); EnableWindow(GetDlgItem(hwndDlg,IDC_USE_NAME_AND_MESSAGE), IsDlgButtonChecked(hwndDlg,IDC_SHOW) && (IsDlgButtonChecked(hwndDlg,IDC_STATUS) - || IsDlgButtonChecked(hwndDlg,IDC_STATUS_MESSAGE))); + || IsDlgButtonChecked(hwndDlg,IDC_STATUS_MESSAGE))); } else if (LOWORD(wParam) == IDC_SHOW) { @@ -916,11 +916,11 @@ static INT_PTR CALLBACK DlgProcItemSecondLineOpts(HWND hwndDlg, UINT msg, WPARAM EnableWindow(GetDlgItem(hwndDlg,IDC_VARIABLE_TEXT), enabled && IsDlgButtonChecked(hwndDlg,IDC_TEXT)); EnableWindow(GetDlgItem(hwndDlg,IDC_VARIABLES_L), enabled && IsDlgButtonChecked(hwndDlg,IDC_TEXT)); EnableWindow(GetDlgItem(hwndDlg,IDC_XSTATUS_HAS_PRIORITY), enabled && (IsDlgButtonChecked(hwndDlg,IDC_STATUS) - || IsDlgButtonChecked(hwndDlg,IDC_STATUS_MESSAGE))); + || IsDlgButtonChecked(hwndDlg,IDC_STATUS_MESSAGE))); EnableWindow(GetDlgItem(hwndDlg,IDC_SHOW_STATUS_IF_NOAWAY), enabled && IsDlgButtonChecked(hwndDlg,IDC_STATUS_MESSAGE)); EnableWindow(GetDlgItem(hwndDlg,IDC_SHOW_LISTENING_IF_NOAWAY), enabled && IsDlgButtonChecked(hwndDlg,IDC_STATUS_MESSAGE)); EnableWindow(GetDlgItem(hwndDlg,IDC_USE_NAME_AND_MESSAGE), enabled && (IsDlgButtonChecked(hwndDlg,IDC_STATUS) - || IsDlgButtonChecked(hwndDlg,IDC_STATUS_MESSAGE))); + || IsDlgButtonChecked(hwndDlg,IDC_STATUS_MESSAGE))); } if (LOWORD(wParam) == IDC_TOP_SPACE && HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return 0; // dont make apply enabled during buddy set crap @@ -1075,15 +1075,15 @@ static INT_PTR CALLBACK DlgProcItemThirdLineOpts(HWND hwndDlg, UINT msg, WPARAM case WM_COMMAND: { if (LOWORD(wParam) == IDC_TEXT || LOWORD(wParam) == IDC_STATUS || LOWORD(wParam) == IDC_NICKNAME || LOWORD(wParam) == IDC_STATUS_MESSAGE - || LOWORD(wParam) == IDC_LISTENING_TO || LOWORD(wParam) == IDC_CONTACT_TIME) + || LOWORD(wParam) == IDC_LISTENING_TO || LOWORD(wParam) == IDC_CONTACT_TIME) { EnableWindow(GetDlgItem(hwndDlg,IDC_VARIABLE_TEXT), IsDlgButtonChecked(hwndDlg,IDC_TEXT) - && IsDlgButtonChecked(hwndDlg,IDC_SHOW)); + && IsDlgButtonChecked(hwndDlg,IDC_SHOW)); EnableWindow(GetDlgItem(hwndDlg,IDC_VARIABLES_L), IsDlgButtonChecked(hwndDlg,IDC_TEXT) - && IsDlgButtonChecked(hwndDlg,IDC_SHOW)); + && IsDlgButtonChecked(hwndDlg,IDC_SHOW)); EnableWindow(GetDlgItem(hwndDlg,IDC_XSTATUS_HAS_PRIORITY), IsDlgButtonChecked(hwndDlg,IDC_SHOW) && (IsDlgButtonChecked(hwndDlg,IDC_STATUS) - || IsDlgButtonChecked(hwndDlg,IDC_STATUS_MESSAGE))); + || IsDlgButtonChecked(hwndDlg,IDC_STATUS_MESSAGE))); EnableWindow(GetDlgItem(hwndDlg,IDC_USE_NAME_AND_MESSAGE), IsDlgButtonChecked(hwndDlg,IDC_SHOW) && (IsDlgButtonChecked(hwndDlg,IDC_STATUS) || IsDlgButtonChecked(hwndDlg,IDC_STATUS_MESSAGE))); EnableWindow(GetDlgItem(hwndDlg,IDC_SHOW_STATUS_IF_NOAWAY), IsDlgButtonChecked(hwndDlg,IDC_SHOW) && (IsDlgButtonChecked(hwndDlg,IDC_STATUS_MESSAGE))); EnableWindow(GetDlgItem(hwndDlg,IDC_SHOW_LISTENING_IF_NOAWAY), IsDlgButtonChecked(hwndDlg,IDC_SHOW) && (IsDlgButtonChecked(hwndDlg,IDC_STATUS_MESSAGE))); @@ -1109,9 +1109,9 @@ static INT_PTR CALLBACK DlgProcItemThirdLineOpts(HWND hwndDlg, UINT msg, WPARAM EnableWindow(GetDlgItem(hwndDlg,IDC_VARIABLE_TEXT), enabled && IsDlgButtonChecked(hwndDlg,IDC_TEXT)); EnableWindow(GetDlgItem(hwndDlg,IDC_VARIABLES_L), enabled && IsDlgButtonChecked(hwndDlg,IDC_TEXT)); EnableWindow(GetDlgItem(hwndDlg,IDC_XSTATUS_HAS_PRIORITY), enabled && (IsDlgButtonChecked(hwndDlg,IDC_STATUS) - || IsDlgButtonChecked(hwndDlg,IDC_STATUS_MESSAGE))); + || IsDlgButtonChecked(hwndDlg,IDC_STATUS_MESSAGE))); EnableWindow(GetDlgItem(hwndDlg,IDC_USE_NAME_AND_MESSAGE), enabled && (IsDlgButtonChecked(hwndDlg,IDC_STATUS) - || IsDlgButtonChecked(hwndDlg,IDC_STATUS_MESSAGE))); + || IsDlgButtonChecked(hwndDlg,IDC_STATUS_MESSAGE))); EnableWindow(GetDlgItem(hwndDlg,IDC_SHOW_STATUS_IF_NOAWAY), enabled && IsDlgButtonChecked(hwndDlg,IDC_STATUS_MESSAGE)); EnableWindow(GetDlgItem(hwndDlg,IDC_SHOW_LISTENING_IF_NOAWAY), enabled && IsDlgButtonChecked(hwndDlg,IDC_STATUS_MESSAGE)); } @@ -1497,7 +1497,7 @@ INT_PTR CALLBACK DlgProcExtraIconsOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP tvi.mask = TVIF_HANDLE|TVIF_PARAM; tvi.hItem = (HTREEITEM)hDragItem; TreeView_GetItem(GetDlgItem(hwndDlg,IDC_EXTRAORDER),&tvi); - if (hti.flags&(TVHT_ONITEM|TVHT_ONITEMRIGHT)||(hti.hItem == TVI_FIRST)) + if (hti.flags&(TVHT_ONITEM|TVHT_ONITEMRIGHT) || (hti.hItem == TVI_FIRST)) { TVINSERTSTRUCT tvis; TCHAR name[128]; diff --git a/plugins/Clist_modern/modern_clistsettings.cpp b/plugins/Clist_modern/modern_clistsettings.cpp index 80491b030b..a39982c385 100644 --- a/plugins/Clist_modern/modern_clistsettings.cpp +++ b/plugins/Clist_modern/modern_clistsettings.cpp @@ -141,11 +141,10 @@ int CListSettings_SetToCache(pdisplayNameCacheEntry pSrc, DWORD flag); void CListSettings_CopyCacheItems(pdisplayNameCacheEntry pDst, pdisplayNameCacheEntry pSrc, DWORD flag) { - if (!pDst||!pSrc) return; + if (!pDst || !pSrc) return; CListSettings_FreeCacheItemDataOption(pDst, flag); - if ( flag & CCI_NAME ) - { + if ( flag & CCI_NAME ) { pDst->isUnknown = pSrc->isUnknown; if (pSrc->isUnknown) pDst->m_cache_tcsName = pSrc->m_cache_tcsName; @@ -153,78 +152,70 @@ void CListSettings_CopyCacheItems(pdisplayNameCacheEntry pDst, pdisplayNameCache pDst->m_cache_tcsName = mir_tstrdup(pSrc->m_cache_tcsName); pDst->m_cache_szName = mir_strdup(pSrc->m_cache_szName); } + if ( flag & CCI_GROUP ) pDst->m_cache_tcsGroup = mir_tstrdup(pSrc->m_cache_tcsGroup); if ( flag & CCI_PROTO ) pDst->m_cache_cszProto = pSrc->m_cache_cszProto; if ( flag & CCI_STATUS ) pDst->m_cache_nStatus = pSrc->m_cache_nStatus; - if ( flag & CCI_LINES ) - { - if ( pDst->szThirdLineText ) mir_free( pDst->szThirdLineText ); - pDst->szThirdLineText = NULL; - if ( pSrc->szThirdLineText ) pDst->szThirdLineText = mir_tstrdup( pSrc->szThirdLineText ); - if ( pDst->szSecondLineText ) mir_free( pDst->szSecondLineText ); - pDst->szSecondLineText = NULL; - if ( pSrc->szSecondLineText ) pDst->szSecondLineText = mir_tstrdup( pSrc->szSecondLineText ); + if ( flag & CCI_LINES ) { + mir_free( pDst->szThirdLineText ); + pDst->szThirdLineText = mir_tstrdup( pSrc->szThirdLineText ); + + mir_free( pDst->szSecondLineText ); + pDst->szSecondLineText = mir_tstrdup( pSrc->szSecondLineText ); pDst->ssThirdLine = pSrc->ssThirdLine; pDst->ssSecondLine = pSrc->ssSecondLine; } + if ( flag & CCI_TIME) - { pDst->hTimeZone = pSrc->hTimeZone; - } - if ( flag & CCI_OTHER) - { -// if ( flag & CCI_HIDDEN) - pDst->m_cache_nHidden = pSrc->m_cache_nHidden; -// if ( flag & CCI_NOHIDEOFFLINE) - pDst->m_cache_nNoHiddenOffline = pSrc->m_cache_nNoHiddenOffline; -// if ( flag & CCI_NOPROTO) - pDst->m_cache_bProtoNotExists = pSrc->m_cache_bProtoNotExists; - -// if ( flag & CCI_HIDESUBCONTACT) - pDst->m_cache_nHiddenSubcontact = pSrc->m_cache_nHiddenSubcontact; -// if ( flag & CCI_I) - pDst->i = pSrc->i; -// if ( flag & CCI_APPARENT) - pDst->ApparentMode = pSrc->ApparentMode; -// if ( flag & CCI_NOTONLIST) - pDst->NotOnList = pSrc->NotOnList; -// if ( flag & CCI_IDLETS) - pDst->IdleTS = pSrc->IdleTS; -// if ( flag & CCI_CCONTACT) - pDst->ClcContact = pSrc->ClcContact; -// if ( flag & CCI_EXPAND) - pDst->IsExpanded = pSrc->IsExpanded; -// if ( flag & CCI_UNKNOWN) -// pDst->isUnknown = pSrc->isUnknown; + + if ( flag & CCI_OTHER) { + pDst->m_cache_nHidden = pSrc->m_cache_nHidden; + pDst->m_cache_nNoHiddenOffline = pSrc->m_cache_nNoHiddenOffline; + pDst->m_cache_bProtoNotExists = pSrc->m_cache_bProtoNotExists; + + pDst->m_cache_nHiddenSubcontact = pSrc->m_cache_nHiddenSubcontact; + pDst->i = pSrc->i; + pDst->ApparentMode = pSrc->ApparentMode; + pDst->NotOnList = pSrc->NotOnList; + pDst->IdleTS = pSrc->IdleTS; + pDst->ClcContact = pSrc->ClcContact; + pDst->IsExpanded = pSrc->IsExpanded; } } int CListSettings_GetCopyFromCache(pdisplayNameCacheEntry pDest, DWORD flag) { - pdisplayNameCacheEntry pSource; - if (!pDest || !pDest->m_cache_hContact) return -1; - pSource = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(pDest->m_cache_hContact); - if (!pSource) return -1; - CListSettings_CopyCacheItems(pDest, pSource, flag); - return 0; + if (!pDest || !pDest->m_cache_hContact) + return -1; + + pdisplayNameCacheEntry pSource = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(pDest->m_cache_hContact); + if (!pSource) + return -1; + + CListSettings_CopyCacheItems(pDest, pSource, flag); + return 0; } int CListSettings_SetToCache(pdisplayNameCacheEntry pSrc, DWORD flag) { - pdisplayNameCacheEntry pDst; - if (!pSrc || !pSrc->m_cache_hContact) return -1; - pDst = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(pSrc->m_cache_hContact); - if (!pDst) return -1; - CListSettings_CopyCacheItems(pDst, pSrc, flag); + if (!pSrc || !pSrc->m_cache_hContact) + return -1; + + pdisplayNameCacheEntry pDst = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(pSrc->m_cache_hContact); + if (!pDst) + return -1; + + CListSettings_CopyCacheItems(pDst, pSrc, flag); return 0; } void cliFreeCacheItem( pdisplayNameCacheEntry p ) { HANDLE hContact = p->m_cache_hContact; - TRACEVAR("cliFreeCacheItem hContact = %d",hContact); + TRACEVAR("cliFreeCacheItem hContact = %d",hContact); if ( !p->isUnknown) free_and_nil_tcsName(p->m_cache_tcsName); p->m_cache_tcsName = NULL; @@ -260,11 +251,11 @@ void cliCheckCacheItem(pdisplayNameCacheEntry pdnce) return; } - if (pdnce->m_cache_cszProto == NULL&&pdnce->m_cache_bProtoNotExists == FALSE) { + if (pdnce->m_cache_cszProto == NULL && pdnce->m_cache_bProtoNotExists == FALSE) { pdnce->m_cache_cszProto = GetProtoForContact(pdnce->m_cache_hContact); if (pdnce->m_cache_cszProto == NULL) pdnce->m_cache_bProtoNotExists = FALSE; - else if (CallService(MS_PROTO_ISPROTOCOLLOADED,0,(LPARAM)pdnce->m_cache_cszProto) == (int)NULL &&0) + else if (CallService(MS_PROTO_ISPROTOCOLLOADED,0,(LPARAM)pdnce->m_cache_cszProto) == (int)NULL && 0) pdnce->m_cache_bProtoNotExists = TRUE; else if (pdnce->m_cache_cszProto && pdnce->m_cache_tcsName) { if (!pdnce->isUnknown) @@ -294,7 +285,7 @@ void cliCheckCacheItem(pdisplayNameCacheEntry pdnce) } else { - if (pdnce->isUnknown&&pdnce->m_cache_cszProto&&pdnce->m_cache_bProtoNotExists == TRUE&&g_flag_bOnModulesLoadedCalled) + if (pdnce->isUnknown && pdnce->m_cache_cszProto && pdnce->m_cache_bProtoNotExists == TRUE && g_flag_bOnModulesLoadedCalled) { if (CallService(MS_PROTO_ISPROTOCOLLOADED,0,(LPARAM)pdnce->m_cache_cszProto) == (int)NULL) { @@ -384,7 +375,7 @@ void InvalidateDNCEbyPointer(HANDLE hContact,pdisplayNameCacheEntry pdnce,int Se SettingType &= ~16; } - if (SettingType == -1||SettingType == DBVT_DELETED) + if (SettingType == -1 || SettingType == DBVT_DELETED) { if (!pdnce->isUnknown) free_and_nil_tcsName(pdnce->m_cache_tcsName); @@ -435,7 +426,7 @@ char *GetContactCachedProtocol(HANDLE hContact) { pdisplayNameCacheEntry cacheEntry = NULL; cacheEntry = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(hContact); - if (cacheEntry&&cacheEntry->m_cache_cszProto) return cacheEntry->m_cache_cszProto; + if (cacheEntry && cacheEntry->m_cache_cszProto) return cacheEntry->m_cache_cszProto; return (NULL); } @@ -527,7 +518,7 @@ int ContactSettingChanged(WPARAM wParam,LPARAM lParam) { PostMessage(pcli->hwndContactTree,CLM_AUTOREBUILD,0,0); } - if (!mir_strcmp(cws->szSetting, "Status") || + if (!mir_strcmp(cws->szSetting, "Status") || wildcmp((char*)cws->szSetting, (char*) "Status?",2)) { @@ -537,7 +528,7 @@ int ContactSettingChanged(WPARAM wParam,LPARAM lParam) //InvalidateDisplayNameCacheEntryByPDNE((HANDLE)wParam,pdnce,cws->value.type); if (pcli->hwndContactTree && g_flag_bOnModulesLoadedCalled) res = PostAutoRebuidMessage(pcli->hwndContactTree); - if ((db_get_w(NULL,"CList","SecondLineType",SETTING_SECONDLINE_TYPE_DEFAULT) == TEXT_STATUS_MESSAGE||db_get_w(NULL,"CList","ThirdLineType",SETTING_THIRDLINE_TYPE_DEFAULT) == TEXT_STATUS_MESSAGE) &&pdnce->m_cache_hContact && pdnce->m_cache_cszProto) + if ((db_get_w(NULL,"CList","SecondLineType",SETTING_SECONDLINE_TYPE_DEFAULT) == TEXT_STATUS_MESSAGE || db_get_w(NULL,"CList","ThirdLineType",SETTING_THIRDLINE_TYPE_DEFAULT) == TEXT_STATUS_MESSAGE) && pdnce->m_cache_hContact && pdnce->m_cache_cszProto) { // if (pdnce->status != ID_STATUS_OFFLINE) amRequestAwayMsg((HANDLE)wParam); @@ -555,7 +546,7 @@ int ContactSettingChanged(WPARAM wParam,LPARAM lParam) db_set_s((HANDLE)wParam,"CList","StatusMsg",""); } } - if ((db_get_w(NULL,"CList","SecondLineType",0) == TEXT_STATUS_MESSAGE||db_get_w(NULL,"CList","ThirdLineType",0) == TEXT_STATUS_MESSAGE) &&pdnce->m_cache_hContact && pdnce->m_cache_cszProto) + if ((db_get_w(NULL,"CList","SecondLineType",0) == TEXT_STATUS_MESSAGE || db_get_w(NULL,"CList","ThirdLineType",0) == TEXT_STATUS_MESSAGE) && pdnce->m_cache_hContact && pdnce->m_cache_cszProto) { // if (pdnce->status != ID_STATUS_OFFLINE) amRequestAwayMsg((HANDLE)wParam); @@ -567,8 +558,8 @@ int ContactSettingChanged(WPARAM wParam,LPARAM lParam) else { if (!(!mir_strcmp(cws->szSetting, "LogonTS") - ||!mir_strcmp(cws->szSetting, "TickTS") - ||!mir_strcmp(cws->szSetting, "InfoTS") + || !mir_strcmp(cws->szSetting, "TickTS") + || !mir_strcmp(cws->szSetting, "InfoTS") )) { pcli->pfnSortContacts(); diff --git a/plugins/Clist_modern/modern_clisttray.cpp b/plugins/Clist_modern/modern_clisttray.cpp index b3e87dd814..7385ab6754 100644 --- a/plugins/Clist_modern/modern_clisttray.cpp +++ b/plugins/Clist_modern/modern_clisttray.cpp @@ -100,7 +100,7 @@ INT_PTR CListTray_GetGlobalStatus(WPARAM wparam,LPARAM lparam) for (i=0;i < pcli->hClcProtoCount;i++) { if (!pcli->pfnGetProtocolVisibility(pcli->clcProto[i].szProto)) continue; - if (pcli->clcProto[i].dwStatus >= ID_STATUS_CONNECTING && + if (pcli->clcProto[i].dwStatus >= ID_STATUS_CONNECTING && pcli->clcProto[i].dwStatus < ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES) { connectingCount++; @@ -195,7 +195,7 @@ void cliTrayIconUpdateBase(const char *szChangedProto) else { if (db_get_b(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_SINGLE - && db_get_b(NULL,"CList","AlwaysPrimary",SETTING_ALWAYSPRIMARY_DEFAULT)) + && db_get_b(NULL,"CList","AlwaysPrimary",SETTING_ALWAYSPRIMARY_DEFAULT)) { DBVARIANT dbv = {DBVT_DELETED}; char *szProto; @@ -219,7 +219,7 @@ void cliTrayIconUpdateBase(const char *szChangedProto) else szProto = dbv.pszVal; status = CallProtoService(szChangedProto,PS_GETSTATUS,0,0); - if ((g_StatusBarData.connectingIcon == 1)&&status >= ID_STATUS_CONNECTING&&status <= ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES) { + if ((g_StatusBarData.connectingIcon == 1) && status >= ID_STATUS_CONNECTING && status <= ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES) { // HICON hIcon; // 1 check if multi connecting icon @@ -248,7 +248,7 @@ void cliTrayIconUpdateBase(const char *szChangedProto) { int status = szChangedProto ? CallProtoService(szChangedProto,PS_GETSTATUS,0,0) : averageMode; if ((g_StatusBarData.connectingIcon == 1 && CListTray_GetGlobalStatus(0,0) - && ((status >= ID_STATUS_CONNECTING && status <= ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES)|| g_bMultiConnectionMode ))) + && ((status >= ID_STATUS_CONNECTING && status <= ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES) || g_bMultiConnectionMode ))) { //connecting status = status; @@ -288,7 +288,7 @@ void cliTrayIconUpdateBase(const char *szChangedProto) int status; status = CallProtoService(szChangedProto,PS_GETSTATUS,0,0); - if ((g_StatusBarData.connectingIcon == 1)&&status >= ID_STATUS_CONNECTING&&status <= ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES) + if ((g_StatusBarData.connectingIcon == 1) && status >= ID_STATUS_CONNECTING && status <= ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES) { // HICON hIcon; @@ -305,7 +305,7 @@ void cliTrayIconUpdateBase(const char *szChangedProto) int avg; avg = GetAverageMode(); i = pcli->pfnTrayIconSetBaseInfo(cliGetIconFromStatusMode(NULL,szChangedProto,CallProtoService(szChangedProto,PS_GETSTATUS,0,0)),szChangedProto); - if (i < 0 /*|| (avg != -1)*/) { + if (i < 0 /* || (avg != -1)*/) { pcli->pfnTrayIconDestroy(hwnd); pcli->pfnTrayIconInit(hwnd); } @@ -313,7 +313,7 @@ void cliTrayIconUpdateBase(const char *szChangedProto) int status; changed = i; status = CallProtoService(szChangedProto,PS_GETSTATUS,0,0); - if ((g_StatusBarData.connectingIcon == 1)&&status >= ID_STATUS_CONNECTING&&status <= ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES) { + if ((g_StatusBarData.connectingIcon == 1) && status >= ID_STATUS_CONNECTING && status <= ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES) { // HICON hIcon; hIcon = (HICON)CLUI_GetConnectingIconService((WPARAM)szChangedProto,0);; @@ -329,7 +329,7 @@ void cliTrayIconUpdateBase(const char *szChangedProto) char *szProto; int status = CallProtoService(szChangedProto,PS_GETSTATUS,0,0); - if ((g_StatusBarData.connectingIcon == 1)&&status >= ID_STATUS_CONNECTING&&status <= ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES) + if ((g_StatusBarData.connectingIcon == 1) && status >= ID_STATUS_CONNECTING && status <= ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES) { HICON hIcon = ( HICON )CLUI_GetConnectingIconService((WPARAM)szChangedProto,0);; if (hIcon) @@ -373,7 +373,7 @@ INT_PTR TrayIconPauseAutoHide(WPARAM wParam,LPARAM lParam) if (db_get_b(NULL,"CList","AutoHide",SETTING_AUTOHIDE_DEFAULT)) { if (GetActiveWindow() != pcli->hwndContactList - && GetWindow(GetParent(GetActiveWindow()),GW_OWNER) != pcli->hwndContactList) + && GetWindow(GetParent(GetActiveWindow()),GW_OWNER) != pcli->hwndContactList) { KillTimer(NULL,autoHideTimerId); autoHideTimerId = CLUI_SafeSetTimer(NULL,0,1000*db_get_w(NULL,"CList","HideTime",SETTING_HIDETIME_DEFAULT),TrayIconAutoHideTimer); @@ -448,7 +448,7 @@ INT_PTR cli_TrayIconProcessMessage(WPARAM wParam,LPARAM lParam) g_mutex_bOnTrayRightClick = 0; IS_WM_MOUSE_DOWN_IN_TRAY = 0; } - else if (msg->lParam == WM_MBUTTONDOWN ||msg->lParam == WM_LBUTTONDOWN ||msg->lParam == WM_RBUTTONDOWN) { + else if (msg->lParam == WM_MBUTTONDOWN || msg->lParam == WM_LBUTTONDOWN || msg->lParam == WM_RBUTTONDOWN) { IS_WM_MOUSE_DOWN_IN_TRAY = 1; } else if (msg->lParam == WM_RBUTTONUP) { diff --git a/plugins/Clist_modern/modern_clui.cpp b/plugins/Clist_modern/modern_clui.cpp index e4e8e1d550..b1f9018f1a 100644 --- a/plugins/Clist_modern/modern_clui.cpp +++ b/plugins/Clist_modern/modern_clui.cpp @@ -176,12 +176,12 @@ int CLUI::OnEvent_DBSettingChanging(WPARAM wParam,LPARAM lParam) if (dbcws == NULL) return(0); if (MirandaExiting()) return 0; - if ( ( dbcws->value.type == DBVT_WORD && !mir_strcmp(dbcws->szSetting,"ApparentMode")) || + if ( ( dbcws->value.type == DBVT_WORD && !mir_strcmp(dbcws->szSetting,"ApparentMode")) || ( dbcws->value.type == DBVT_ASCIIZ && - ( ( !mir_strcmp(dbcws->szSetting,"e-mail") || - !mir_strcmp(dbcws->szSetting,"Mye-mail0") || - !mir_strcmp(dbcws->szSetting,"Cellular")) || - ( !mir_strcmp(dbcws->szModule,"UserInfo") && + ( ( !mir_strcmp(dbcws->szSetting,"e-mail") || + !mir_strcmp(dbcws->szSetting,"Mye-mail0") || + !mir_strcmp(dbcws->szSetting,"Cellular")) || + ( !mir_strcmp(dbcws->szModule,"UserInfo") && ( !mir_strcmp(dbcws->szSetting,"MyPhone0") || !mir_strcmp(dbcws->szSetting,"Mye-mail0")) )) )) ExtraImage_SetAllExtraIcons(pcli->hwndContactTree,(HANDLE)wParam); @@ -305,8 +305,8 @@ HRESULT CLUI::LoadDllsRuntime() g_proc_AnimateWindow = (BOOL (WINAPI*)(HWND,DWORD,DWORD))GetProcAddress(m_hUserDll,"AnimateWindow"); g_CluiData.fLayered = (g_proc_UpdateLayeredWindow != NULL) && !db_get_b(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT); - g_CluiData.fSmoothAnimation = IsWinVer2000Plus()&&db_get_b(NULL, "CLUI", "FadeInOut", SETTING_FADEIN_DEFAULT); - g_CluiData.fLayered = (g_CluiData.fLayered*db_get_b(NULL, "ModernData", "EnableLayering", g_CluiData.fLayered))&&!db_get_b(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT); + g_CluiData.fSmoothAnimation = IsWinVer2000Plus() && db_get_b(NULL, "CLUI", "FadeInOut", SETTING_FADEIN_DEFAULT); + g_CluiData.fLayered = (g_CluiData.fLayered*db_get_b(NULL, "ModernData", "EnableLayering", g_CluiData.fLayered)) && !db_get_b(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT); } if (IsWinVerVistaPlus()) @@ -535,22 +535,22 @@ int CLUI_ShowWindowMod(HWND hWnd, int nCmd) } if (hWnd == pcli->hwndContactList - && !g_mutex_bChangingMode - && nCmd == SW_HIDE - && !g_CluiData.fLayered - && IsWinVerXPPlus() - && db_get_b(NULL,"CList","WindowShadow",SETTING_WINDOWSHADOW_DEFAULT)) + && !g_mutex_bChangingMode + && nCmd == SW_HIDE + && !g_CluiData.fLayered + && IsWinVerXPPlus() + && db_get_b(NULL,"CList","WindowShadow",SETTING_WINDOWSHADOW_DEFAULT)) { ShowWindow(hWnd,SW_MINIMIZE); //removing of shadow return ShowWindow(hWnd,nCmd); } if (hWnd == pcli->hwndContactList - && !g_mutex_bChangingMode - && nCmd == SW_RESTORE - && !g_CluiData.fLayered - && IsWinVerXPPlus() - && g_CluiData.fSmoothAnimation - && !g_bTransparentFlag + && !g_mutex_bChangingMode + && nCmd == SW_RESTORE + && !g_CluiData.fLayered + && IsWinVerXPPlus() + && g_CluiData.fSmoothAnimation + && !g_bTransparentFlag ) { if (db_get_b(NULL,"CList","WindowShadow",SETTING_WINDOWSHADOW_DEFAULT)) @@ -574,13 +574,13 @@ static BOOL CLUI_WaitThreadsCompletion(HWND hwnd) static const BYTE bcMAX_AWAITING_RETRY = 10; //repeat awaiting only 10 times TRACE("CLUI_WaitThreadsCompletion Enter"); if (bEntersCount < bcMAX_AWAITING_RETRY - &&( g_mutex_nCalcRowHeightLock || + && ( g_mutex_nCalcRowHeightLock || g_CluiData.mutexPaintLock || g_dwAwayMsgThreadID || g_dwGetTextAsyncThreadID || g_dwSmoothAnimationThreadID || g_dwFillFontListThreadID) - &&!Miranda_Terminated()) + && !Miranda_Terminated()) { TRACE("Waiting threads"); TRACEVAR("g_mutex_nCalcRowHeightLock: %x",g_mutex_nCalcRowHeightLock); @@ -667,8 +667,8 @@ void CLUI_ChangeWindowMode() if (!pcli->hwndContactList) return; g_mutex_bChangingMode = TRUE; - g_bTransparentFlag = IsWinVer2000Plus()&&db_get_b( NULL,"CList","Transparent",SETTING_TRANSPARENT_DEFAULT); - g_CluiData.fSmoothAnimation = IsWinVer2000Plus()&&db_get_b(NULL, "CLUI", "FadeInOut", SETTING_FADEIN_DEFAULT); + g_bTransparentFlag = IsWinVer2000Plus() && db_get_b( NULL,"CList","Transparent",SETTING_TRANSPARENT_DEFAULT); + g_CluiData.fSmoothAnimation = IsWinVer2000Plus() && db_get_b(NULL, "CLUI", "FadeInOut", SETTING_FADEIN_DEFAULT); if (g_bTransparentFlag == 0 && g_CluiData.bCurrentAlpha != 0) g_CluiData.bCurrentAlpha = 255; //2- Calculate STYLES and STYLESEX @@ -706,7 +706,7 @@ void CLUI_ChangeWindowMode() styleMaskEx |= WS_EX_APPWINDOW; } //3- TODO Update Layered mode - if (g_bTransparentFlag&&g_CluiData.fLayered) + if (g_bTransparentFlag && g_CluiData.fLayered) styleEx |= WS_EX_LAYERED; //4- Set Title @@ -761,7 +761,7 @@ void CLUI_ChangeWindowMode() else SetMenu(pcli->hwndContactList,g_hMenuMain); - if (g_CluiData.fLayered&&(db_get_b(NULL,"CList","OnDesktop", SETTING_ONDESKTOP_DEFAULT))) + if (g_CluiData.fLayered && (db_get_b(NULL,"CList","OnDesktop", SETTING_ONDESKTOP_DEFAULT))) ske_UpdateWindowImage(); @@ -1086,7 +1086,7 @@ HICON CLUI_LoadIconFromExternalFile(char *filename,int i,boolean UseLibrary,bool sid.cbSize = sizeof(sid); sid.cx = 16; sid.cy = 16; - sid.hDefaultIcon = (has_proto_icon||!(UseLibrary&2))?NULL:(HICON)CallService(MS_SKIN_LOADPROTOICON,(WPARAM)NULL,(LPARAM)(-internalidx)); + sid.hDefaultIcon = (has_proto_icon || !(UseLibrary&2))?NULL:(HICON)CallService(MS_SKIN_LOADPROTOICON,(WPARAM)NULL,(LPARAM)(-internalidx)); sid.pszSection = SectName; sid.pszName = IconName; sid.pszDescription = Description; @@ -1160,7 +1160,7 @@ INT_PTR CLUI_GetConnectingIconService(WPARAM wParam,LPARAM lParam) } if (pt != NULL) { - if (pt->nCycleStartTick != 0&&pt->nIconsCount != 0) + if (pt->nCycleStartTick != 0 && pt->nIconsCount != 0) { b = ((GetTickCount()-pt->nCycleStartTick)/(nAnimatedIconStep))%(pt->nIconsCount); // if (lParam) @@ -1187,7 +1187,7 @@ static int CLUI_CreateTimerForConnectingIcon(WPARAM wParam,LPARAM lParam) if (!szProto) return (0); if (!status) return (0); - if ((g_StatusBarData.connectingIcon == 1)&&status >= ID_STATUS_CONNECTING&&status <= ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES) + if ((g_StatusBarData.connectingIcon == 1) && status >= ID_STATUS_CONNECTING && status <= ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES) { PROTOTICKS *pt = NULL; @@ -1585,7 +1585,7 @@ int CLUI_TestCursorOnBorders() { case 1: case 2: - if (!g_CluiData.fDocked||(g_CluiData.fDocked == 2 && k == 1)||(g_CluiData.fDocked == 1 && k == 2)){hCurs1 = LoadCursor(NULL, IDC_SIZEWE); break;} + if (!g_CluiData.fDocked || (g_CluiData.fDocked == 2 && k == 1) || (g_CluiData.fDocked == 1 && k == 2)){hCurs1 = LoadCursor(NULL, IDC_SIZEWE); break;} case 3: if (!g_CluiData.fDocked) {hCurs1 = LoadCursor(NULL, IDC_SIZENS); break;} case 4: if (!g_CluiData.fDocked) {hCurs1 = LoadCursor(NULL, IDC_SIZENWSE); break;} case 5: if (!g_CluiData.fDocked) {hCurs1 = LoadCursor(NULL, IDC_SIZENESW); break;} @@ -1705,7 +1705,7 @@ int CLUI_SmoothAlphaTransition(HWND hwnd, BYTE GoalAlpha, BOOL wParam) { if ((!g_CluiData.fLayered - && (!g_CluiData.fSmoothAnimation && !g_bTransparentFlag))||!g_proc_SetLayeredWindowAttributesNew) + && (!g_CluiData.fSmoothAnimation && !g_bTransparentFlag)) || !g_proc_SetLayeredWindowAttributesNew) { if (GoalAlpha>0 && wParam != 2) { @@ -1734,7 +1734,7 @@ int CLUI_SmoothAlphaTransition(HWND hwnd, BYTE GoalAlpha, BOOL wParam) } return 0; } - if (g_CluiData.bCurrentAlpha == GoalAlpha &&0) + if (g_CluiData.bCurrentAlpha == GoalAlpha && 0) { if (mutex_bAnimationInProgress) { @@ -1749,7 +1749,7 @@ int CLUI_SmoothAlphaTransition(HWND hwnd, BYTE GoalAlpha, BOOL wParam) bAlphaEnd = GoalAlpha; if (!mutex_bAnimationInProgress) { - if ((!IsWindowVisible(hwnd)||g_CluiData.bCurrentAlpha == 0) && bAlphaEnd>0 ) + if ((!IsWindowVisible(hwnd) || g_CluiData.bCurrentAlpha == 0) && bAlphaEnd>0 ) { mutex_bShowHideCalledFromAnimation = 1; CLUI_ShowWindowMod(pcli->hwndContactList,SW_SHOWNA); @@ -1926,7 +1926,7 @@ LRESULT CLUI::OnSizingMoving( UINT msg, WPARAM wParam, LPARAM lParam ) { static int a = 0; RECT* wp = (RECT*)lParam; - if (bNeedFixSizingRect && (rcCorrectSizeRect.bottom != 0||rcCorrectSizeRect.top != 0)) + if (bNeedFixSizingRect && (rcCorrectSizeRect.bottom != 0 || rcCorrectSizeRect.top != 0)) { if (wParam != WMSZ_BOTTOM) wp->bottom = rcCorrectSizeRect.bottom; if (wParam != WMSZ_TOP) wp->top = rcCorrectSizeRect.top; @@ -1951,7 +1951,7 @@ LRESULT CLUI::OnSizingMoving( UINT msg, WPARAM wParam, LPARAM lParam ) // Прилипание к краям by ZorG CLUI::SnappingToEdge(wp); - if ((rcOldWindowRect.bottom-rcOldWindowRect.top != wp->cy || rcOldWindowRect.right-rcOldWindowRect.left != wp->cx)&&!(wp->flags&SWP_NOSIZE)) + if ((rcOldWindowRect.bottom-rcOldWindowRect.top != wp->cy || rcOldWindowRect.right-rcOldWindowRect.left != wp->cx) && !(wp->flags&SWP_NOSIZE)) { { if (!(wp->flags&SWP_NOMOVE)) @@ -2058,7 +2058,7 @@ LRESULT CLUI::OnSizingMoving( UINT msg, WPARAM wParam, LPARAM lParam ) { RECT rc; if (g_mutex_bSizing) return 0; - if (wParam != SIZE_MINIMIZED /*&& IsWindowVisible(m_hWnd)*/) + if (wParam != SIZE_MINIMIZED /* && IsWindowVisible(m_hWnd)*/) { if ( pcli->hwndContactList == NULL ) return 0; @@ -2234,7 +2234,7 @@ LRESULT CLUI::OnPaint( UINT msg, WPARAM wParam, LPARAM lParam ) ValidateRect(m_hWnd,NULL); } - if (0&&(db_get_dw(NULL,"CLUIFrames","GapBetweenFrames",SETTING_GAPFRAMES_DEFAULT) || db_get_dw(NULL,"CLUIFrames","GapBetweenTitleBar",SETTING_GAPTITLEBAR_DEFAULT))) + if (0 && (db_get_dw(NULL,"CLUIFrames","GapBetweenFrames",SETTING_GAPFRAMES_DEFAULT) || db_get_dw(NULL,"CLUIFrames","GapBetweenTitleBar",SETTING_GAPTITLEBAR_DEFAULT))) { if (IsWindowVisible(m_hWnd)) if (g_CluiData.fLayered) @@ -2361,14 +2361,14 @@ LRESULT CLUI::OnStatusBarUpdateTimer( UINT msg, WPARAM wParam, LPARAM lParam ) pt = &CycleStartTick[i]; - if (pt->szProto != NULL&&pt->bTimerCreated == 1) + if (pt->szProto != NULL && pt->bTimerCreated == 1) { if (pt->bGlobal) status = g_bMultiConnectionMode?ID_STATUS_CONNECTING:0; else status = CallProtoService(pt->szProto,PS_GETSTATUS,0,0); - if (!(status >= ID_STATUS_CONNECTING&&status <= ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES)) + if (!(status >= ID_STATUS_CONNECTING && status <= ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES)) { pt->nCycleStartTick = 0; ImageList_Destroy(pt->himlIconList); @@ -2549,7 +2549,7 @@ LRESULT CLUI::OnActivate( UINT msg, WPARAM wParam, LPARAM lParam ) if (g_bTransparentFlag) { BYTE alpha; - if (wParam != WA_INACTIVE || CLUI_CheckOwnedByClui((HWND)lParam)|| IsOption || ((HWND)lParam == m_hWnd) || GetParent((HWND)lParam) == m_hWnd) alpha = db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT); + if (wParam != WA_INACTIVE || CLUI_CheckOwnedByClui((HWND)lParam) || IsOption || ((HWND)lParam == m_hWnd) || GetParent((HWND)lParam) == m_hWnd) alpha = db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT); else alpha = g_bTransparentFlag?db_get_b(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT):255; CLUI_SmoothAlphaTransition(m_hWnd, alpha, 1); @@ -2618,7 +2618,7 @@ LRESULT CLUI::OnNcHitTest( UINT msg, WPARAM wParam, LPARAM lParam ) result = DefWindowProc(m_hWnd,WM_NCHITTEST,wParam,lParam); if ( (g_CluiData.fAutoSize) && ( result == HTSIZE || result == HTTOP || - result == HTTOPLEFT || result == HTTOPRIGHT || + result == HTTOPLEFT || result == HTTOPRIGHT || result == HTBOTTOM || result == HTBOTTOMRIGHT || result == HTBOTTOMLEFT)) return HTCLIENT; @@ -2826,7 +2826,7 @@ LRESULT CLUI::OnClickNotify( NMCLISTCONTROL * pnmc ) if (hitFlags&CLCHT_ONITEMEXTRA) { - if (!IsHContactGroup(hItem)&&!IsHContactInfo(hItem)) + if (!IsHContactGroup(hItem) && !IsHContactInfo(hItem)) { pdisplayNameCacheEntry pdnce = (pdisplayNameCacheEntry)pcli->pfnGetCacheEntry(pnmc->hItem); if (pdnce == NULL) return 0; @@ -3029,7 +3029,7 @@ LRESULT CLUI::OnDrawItem( UINT msg, WPARAM wParam, LPARAM lParam ) CLUI_DrawMenuBackGround(m_hWnd, dis->hDC, 3, dis->itemState); mir_snprintf(buf,SIZEOF(buf),"Main,ID = MainMenu,Selected = %s,Hot = %s",(dis->itemState&ODS_SELECTED)?"True":"False",(dis->itemState&ODS_HOTLIGHT)?"True":"False"); SkinDrawGlyph(dis->hDC,&dis->rcItem,&dis->rcItem,buf); - DrawState(dis->hDC,NULL,NULL,(LPARAM)hIcon,0,(dis->rcItem.right+dis->rcItem.left-GetSystemMetrics(SM_CXSMICON))/2+dx,(dis->rcItem.bottom+dis->rcItem.top-GetSystemMetrics(SM_CYSMICON))/2+dx,0,0,DST_ICON|(dis->itemState&ODS_INACTIVE&&FALSE?DSS_DISABLED:DSS_NORMAL)); + DrawState(dis->hDC,NULL,NULL,(LPARAM)hIcon,0,(dis->rcItem.right+dis->rcItem.left-GetSystemMetrics(SM_CXSMICON))/2+dx,(dis->rcItem.bottom+dis->rcItem.top-GetSystemMetrics(SM_CYSMICON))/2+dx,0,0,DST_ICON|(dis->itemState&ODS_INACTIVE && FALSE?DSS_DISABLED:DSS_NORMAL)); CallService(MS_SKIN2_RELEASEICON, (WPARAM)hIcon, 0); nMirMenuState = dis->itemState; } diff --git a/plugins/Clist_modern/modern_cluiframes.cpp b/plugins/Clist_modern/modern_cluiframes.cpp index e58122b1c0..605ef0faf5 100644 --- a/plugins/Clist_modern/modern_cluiframes.cpp +++ b/plugins/Clist_modern/modern_cluiframes.cpp @@ -123,7 +123,7 @@ int CLUIFrames_OnMoving( HWND hwnd, RECT * r) g_CluiData.mutexPreventDockMoving = 0; for(i=0;i < g_nFramesCount;i++) { - if (!g_pfwFrames[i].floating && g_pfwFrames[i].OwnerWindow != NULL &&g_pfwFrames[i].OwnerWindow != (HWND)-2) + if (!g_pfwFrames[i].floating && g_pfwFrames[i].OwnerWindow != NULL && g_pfwFrames[i].OwnerWindow != (HWND)-2) { int x; int y; @@ -153,7 +153,7 @@ int SetAlpha(BYTE Alpha) 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 ) + if (!g_pfwFrames[i].floating && g_pfwFrames[i].OwnerWindow != NULL && g_pfwFrames[i].OwnerWindow != (HWND)-2 && g_pfwFrames[i].visible && !g_pfwFrames[i].needhide ) { HWND hwnd = g_pfwFrames[i].OwnerWindow; if (g_proc_SetLayeredWindowAttributesNew) @@ -189,7 +189,7 @@ int CLUIFrames_RepaintSubContainers() { int 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 ) + 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); }; @@ -200,7 +200,7 @@ int CLUIFrames_ActivateSubContainers( BOOL active) { int 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 (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 ) { HWND hwnd = g_pfwFrames[i].OwnerWindow; hwnd = g_pfwFrames[i].hWnd;//OwnerWindow; @@ -216,12 +216,12 @@ int CLUIFrames_ActivateSubContainers( BOOL active) int CLUIFrames_SetParentForContainers( HWND parent ) { int i; - if (parent&&parent != pcli->hwndContactList) + if (parent && parent != pcli->hwndContactList) g_CluiData.fOnDesktop = 1; else g_CluiData.fOnDesktop = 0; 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 ) + 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; SetParent(hwnd,parent); @@ -235,7 +235,7 @@ int CLUIFrames_OnShowHide( HWND hwnd, int mode ) int i; int prevFrameCount; for(i=0;i < g_nFramesCount;i++) { - if (!g_pfwFrames[i].floating && g_pfwFrames[i].OwnerWindow != (HWND)0 &&g_pfwFrames[i].OwnerWindow != (HWND)-2) + if (!g_pfwFrames[i].floating && g_pfwFrames[i].OwnerWindow != (HWND)0 && g_pfwFrames[i].OwnerWindow != (HWND)-2) { { //Try to avoid crash on exit due to unlock. @@ -245,8 +245,8 @@ int CLUIFrames_OnShowHide( HWND hwnd, int mode ) BOOL needhide = g_pfwFrames[i].needhide; needhide |= (!g_pfwFrames[i].collapsed || g_pfwFrames[i].height == 0 ); prevFrameCount = g_nFramesCount; - ShowWindow(owner,(mode == SW_HIDE||!visible||needhide)?SW_HIDE:mode); - ShowWindow(Frmhwnd,(mode == SW_HIDE||!visible||needhide)?SW_HIDE:mode); + ShowWindow(owner,(mode == SW_HIDE || !visible || needhide)?SW_HIDE:mode); + ShowWindow(Frmhwnd,(mode == SW_HIDE || !visible || needhide)?SW_HIDE:mode); } if (mode != SW_HIDE) @@ -296,7 +296,7 @@ static FRAMEWND* FindFrameByWnd( HWND hwnd ) if ( hwnd == NULL ) return( NULL ); for(i=0;i < g_nFramesCount;i++) - if ((g_pfwFrames[i].floating)&&(g_pfwFrames[i].ContainerWnd == hwnd)) + if ((g_pfwFrames[i].floating) && (g_pfwFrames[i].ContainerWnd == hwnd)) return(&g_pfwFrames[i]); return( NULL); @@ -767,7 +767,7 @@ static int CLUIFramesLoadFrameSettings(int Frameid) if (_fCluiFramesModuleNotStarted) return -1; - if (Frameid < 0||Frameid >= g_nFramesCount) return -1; + if (Frameid < 0 || Frameid >= g_nFramesCount) return -1; maxstored = db_get_w(0,CLUIFrameModule,"StoredFrames",-1); if (maxstored == -1) return 0; @@ -785,7 +785,7 @@ static int CLUIFramesStoreFrameSettings(int Frameid) if (_fCluiFramesModuleNotStarted) return -1; - if (Frameid < 0||Frameid >= g_nFramesCount) return -1; + if (Frameid < 0 || Frameid >= g_nFramesCount) return -1; maxstored = db_get_w(0,CLUIFrameModule,"StoredFrames",-1); if (maxstored == -1) maxstored = 0; @@ -1015,7 +1015,7 @@ static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam,LPARAM lParam) if (MirandaExiting()) return 0; if (_fCluiFramesModuleNotStarted) return -1; pos = id2pos(wParam); - if (pos >= 0&&pos < g_nFramesCount) { + if (pos >= 0 && pos < g_nFramesCount) { memset(&mi,0,sizeof(mi)); mi.cbSize = sizeof(mi); mi.flags = CMIM_FLAGS|CMIM_NAME|CMIF_CHILDPOPUP|CMIF_TCHAR; @@ -1055,7 +1055,7 @@ static int CLUIFramesModifyContextMenuForFrame(WPARAM wParam,LPARAM lParam) mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; if (g_pfwFrames[pos].collapsed) mi.flags |= CMIF_CHECKED; - if ((!g_pfwFrames[pos].visible)||(g_pfwFrames[pos].Locked)||(pos == CLUIFramesGetalClientFrame())) mi.flags |= CMIF_GRAYED; + if ((!g_pfwFrames[pos].visible) || (g_pfwFrames[pos].Locked) || (pos == CLUIFramesGetalClientFrame())) mi.flags |= CMIF_GRAYED; ModifyMItem((WPARAM)_hmiColl,(LPARAM)&mi); } return 0; @@ -1073,7 +1073,7 @@ static int CLUIFramesModifyMainMenuItems(WPARAM wParam,LPARAM lParam) pos = id2pos(wParam); - if (pos >= 0&&pos < g_nFramesCount) { + if (pos >= 0 && pos < g_nFramesCount) { memset(&mi,0,sizeof(mi)); mi.cbSize = sizeof(mi); mi.flags = CMIM_FLAGS|CMIM_NAME|CMIF_CHILDPOPUP|CMIF_TCHAR; @@ -1130,7 +1130,7 @@ static int CLUIFramesModifyMainMenuItems(WPARAM wParam,LPARAM lParam) mi.flags = CMIM_FLAGS|CMIF_CHILDPOPUP; if (g_pfwFrames[pos].collapsed) mi.flags |= CMIF_CHECKED; - if ((!g_pfwFrames[pos].visible)||g_pfwFrames[pos].Locked||(pos == CLUIFramesGetalClientFrame())) mi.flags |= CMIF_GRAYED; + if ((!g_pfwFrames[pos].visible) || g_pfwFrames[pos].Locked || (pos == CLUIFramesGetalClientFrame())) mi.flags |= CMIF_GRAYED; CallService(MS_CLIST_MODIFYMENUITEM,(WPARAM)g_pfwFrames[pos].MenuHandles.MIColl,(LPARAM)&mi); } @@ -1149,7 +1149,7 @@ static INT_PTR _us_DoGetFrameOptions(WPARAM wParam,LPARAM lParam) pos = id2pos(HIWORD(wParam)); - if (pos < 0||pos >= g_nFramesCount) { + if (pos < 0 || pos >= g_nFramesCount) { return -1; } @@ -1251,7 +1251,7 @@ static int _us_DoSetFrameOptions(WPARAM wParam,LPARAM lParam) pos = id2pos(HIWORD(wParam)); - if (pos < 0||pos >= g_nFramesCount) { + if (pos < 0 || pos >= g_nFramesCount) { return -1; } @@ -1297,16 +1297,16 @@ static int _us_DoSetFrameOptions(WPARAM wParam,LPARAM lParam) } case FO_NAME: - if (lParam == (LPARAM)NULL) { return -1;} - if (g_pfwFrames[pos].Name != NULL) mir_free(g_pfwFrames[pos].Name); - if (g_pfwFrames[pos].szName != NULL) mir_free(g_pfwFrames[pos].szName); - if (bUnicodeText) - { + if (lParam == (LPARAM)NULL) + return -1; + + mir_free(g_pfwFrames[pos].Name); + mir_free(g_pfwFrames[pos].szName); + if (bUnicodeText) { g_pfwFrames[pos].Name = mir_tstrdup((LPTSTR)lParam); g_pfwFrames[pos].szName = mir_t2a((LPTSTR)lParam); } - else - { + else { g_pfwFrames[pos].szName = mir_strdup((char*)lParam); g_pfwFrames[pos].Name = mir_a2t((char *)lParam); } @@ -1315,20 +1315,19 @@ static int _us_DoSetFrameOptions(WPARAM wParam,LPARAM lParam) case FO_TBNAME: if (lParam == (LPARAM)NULL) { return(-1);} - if (g_pfwFrames[pos].TitleBar.tbname != NULL) mir_free(g_pfwFrames[pos].TitleBar.tbname); - if (g_pfwFrames[pos].TitleBar.sztbname != NULL) mir_free(g_pfwFrames[pos].TitleBar.sztbname); - if (bUnicodeText) - { + mir_free(g_pfwFrames[pos].TitleBar.tbname); + mir_free(g_pfwFrames[pos].TitleBar.sztbname); + if (bUnicodeText) { g_pfwFrames[pos].TitleBar.tbname = mir_tstrdup((LPTSTR)lParam); g_pfwFrames[pos].TitleBar.sztbname = mir_t2a((LPTSTR)lParam); } - else - { + else { g_pfwFrames[pos].TitleBar.sztbname = mir_strdup((char*)lParam); g_pfwFrames[pos].TitleBar.tbname = mir_a2t((char*)lParam); } - if (g_pfwFrames[pos].floating&&(g_pfwFrames[pos].TitleBar.tbname != NULL)){SetWindowText(g_pfwFrames[pos].ContainerWnd,g_pfwFrames[pos].TitleBar.tbname);}; + if (g_pfwFrames[pos].floating && (g_pfwFrames[pos].TitleBar.tbname != NULL)) + SetWindowText(g_pfwFrames[pos].ContainerWnd,g_pfwFrames[pos].TitleBar.tbname); return 0; case FO_TBTIPNAME: @@ -1400,13 +1399,13 @@ static int _us_DoSetFrameOptions(WPARAM wParam,LPARAM lParam) } case FO_ALIGN: - if (!(lParam&alTop||lParam&alBottom||lParam&alClient)) + if (!(lParam&alTop || lParam&alBottom || lParam&alClient)) { TRACE("Wrong align option \r\n"); return (-1); }; - if ((lParam&alClient)&&(CLUIFramesGetalClientFrame() >= 0)) { //only one alClient frame possible + if ((lParam&alClient) && (CLUIFramesGetalClientFrame() >= 0)) { //only one alClient frame possible _nClientFrameId = eUnknownId;//recalc it return -1; @@ -1472,13 +1471,13 @@ static int _us_DoShowHideFrame(WPARAM wParam,LPARAM lParam) } else { pos = id2pos(wParam); } - if (pos >= 0&&(int)pos < g_nFramesCount) + if (pos >= 0 && (int)pos < g_nFramesCount) { g_pfwFrames[pos].visible = !g_pfwFrames[pos].visible; if (g_pfwFrames[pos].OwnerWindow != (HWND)-2) { if (g_pfwFrames[pos].OwnerWindow) - CLUI_ShowWindowMod(g_pfwFrames[pos].OwnerWindow,(g_pfwFrames[pos].visible&& g_pfwFrames[pos].collapsed && IsWindowVisible(pcli->hwndContactList))?SW_SHOW/*NOACTIVATE*/:SW_HIDE); + CLUI_ShowWindowMod(g_pfwFrames[pos].OwnerWindow,(g_pfwFrames[pos].visible && g_pfwFrames[pos].collapsed && IsWindowVisible(pcli->hwndContactList))?SW_SHOW/*NOACTIVATE*/:SW_HIDE); else if (g_pfwFrames[pos].visible) { g_pfwFrames[pos].OwnerWindow = CreateSubContainerWindow(pcli->hwndContactList,g_pfwFrames[pos].FloatingPos.x,g_pfwFrames[pos].FloatingPos.y,10,10); @@ -1505,7 +1504,7 @@ static int _us_DoShowHideFrameTitle(WPARAM wParam,LPARAM lParam) } else { pos = id2pos(wParam); } - if (pos >= 0&&(int)pos < g_nFramesCount) + if (pos >= 0 && (int)pos < g_nFramesCount) g_pfwFrames[pos].TitleBar.ShowTitleBar = !g_pfwFrames[pos].TitleBar.ShowTitleBar; //if (Frames[pos].height> @@ -1526,7 +1525,7 @@ static int _us_DoMoveFrame(WPARAM wParam,LPARAM lParam) if (_fCluiFramesModuleNotStarted) return -1; pos = id2pos(wParam); - if (pos >= 0&&(int)pos < g_nFramesCount) { + if (pos >= 0 && (int)pos < g_nFramesCount) { SortData *sd; curpos = g_pfwFrames[pos].order; curalign = g_pfwFrames[pos].align; @@ -1535,7 +1534,7 @@ static int _us_DoMoveFrame(WPARAM wParam,LPARAM lParam) memset(sd,0,sizeof(SortData)*g_nFramesCount); for (i=0;i < g_nFramesCount;i++) { - if (g_pfwFrames[i].floating||(!g_pfwFrames[i].visible)||(g_pfwFrames[i].align != curalign)){continue;}; + if (g_pfwFrames[i].floating || (!g_pfwFrames[i].visible) || (g_pfwFrames[i].align != curalign)){continue;}; sd[v].order = g_pfwFrames[i].order; sd[v].realpos = i; @@ -1631,7 +1630,7 @@ static int _us_DoLockFrame(WPARAM wParam,LPARAM lParam) } else { pos = id2pos(wParam); } - if (pos >= 0&&(int)pos < g_nFramesCount) { + if (pos >= 0 && (int)pos < g_nFramesCount) { g_pfwFrames[pos].Locked = !g_pfwFrames[pos].Locked; CLUIFramesStoreFrameSettings(pos); } @@ -1687,12 +1686,12 @@ static int _us_DoCollapseFrame(WPARAM wParam,LPARAM lParam) } else { FrameId = id2pos(wParam); } - if (FrameId >= 0&&FrameId < g_nFramesCount) + if (FrameId >= 0 && FrameId < g_nFramesCount) { int oldHeight; // do not collapse/uncollapse client/locked/invisible frames - if (g_pfwFrames[FrameId].align == alClient&&!(g_pfwFrames[FrameId].Locked||(!g_pfwFrames[FrameId].visible)||g_pfwFrames[FrameId].floating)) + if (g_pfwFrames[FrameId].align == alClient && !(g_pfwFrames[FrameId].Locked || (!g_pfwFrames[FrameId].visible) || g_pfwFrames[FrameId].floating)) { RECT rc; if (CallService(MS_CLIST_DOCKINGISDOCKED,0,0)) {return 0;}; @@ -1720,7 +1719,7 @@ static int _us_DoCollapseFrame(WPARAM wParam,LPARAM lParam) return 0; } - if (g_pfwFrames[FrameId].Locked||(!g_pfwFrames[FrameId].visible)) return 0; + if (g_pfwFrames[FrameId].Locked || (!g_pfwFrames[FrameId].visible)) return 0; oldHeight = g_pfwFrames[FrameId].height; @@ -1753,7 +1752,7 @@ static int _us_DoCollapseFrame(WPARAM wParam,LPARAM lParam) { int i,sumheight = 0; 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)) { + 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; } @@ -1930,7 +1929,7 @@ static int _us_DoAddFrame(WPARAM wParam,LPARAM lParam) }; g_pfwFrames[g_nFramesCount].dwFlags = clfrm->Flags; - if (clfrm->name == NULL||((clfrm->Flags&F_UNICODE) ? lstrlenW(clfrm->wname) : lstrlenA(clfrm->name)) == 0) { + if (clfrm->name == NULL || ((clfrm->Flags&F_UNICODE) ? lstrlenW(clfrm->wname) : lstrlenA(clfrm->name)) == 0) { g_pfwFrames[g_nFramesCount].Name = (LPTSTR)mir_alloc(255 * sizeof(TCHAR)); GetClassName(g_pfwFrames[g_nFramesCount].hWnd,g_pfwFrames[g_nFramesCount].Name,255); } @@ -1955,7 +1954,7 @@ static int _us_DoAddFrame(WPARAM wParam,LPARAM lParam) g_pfwFrames[g_nFramesCount].Locked = clfrm->Flags&F_LOCKED?TRUE:FALSE; g_pfwFrames[g_nFramesCount].visible = clfrm->Flags&F_VISIBLE?TRUE:FALSE; - g_pfwFrames[g_nFramesCount].UseBorder = ((clfrm->Flags&F_NOBORDER)||g_CluiData.fLayered)?FALSE:TRUE; + g_pfwFrames[g_nFramesCount].UseBorder = ((clfrm->Flags&F_NOBORDER) || g_CluiData.fLayered)?FALSE:TRUE; //Frames[nFramescount].OwnerWindow = 0; @@ -2019,7 +2018,7 @@ static int _us_DoAddFrame(WPARAM wParam,LPARAM lParam) style = GetWindowLongPtr(g_pfwFrames[g_nFramesCount-1].hWnd,GWL_STYLE); style &= (~WS_BORDER); - style |= (((g_pfwFrames[g_nFramesCount-1].UseBorder)&&!g_CluiData.fLayered)?WS_BORDER:0); + style |= (((g_pfwFrames[g_nFramesCount-1].UseBorder) && !g_CluiData.fLayered)?WS_BORDER:0); SetWindowLongPtr(g_pfwFrames[g_nFramesCount-1].hWnd,GWL_STYLE,style); SetWindowLongPtr(g_pfwFrames[g_nFramesCount-1].TitleBar.hwnd,GWL_STYLE,style& ~(WS_VSCROLL | WS_HSCROLL)); SetWindowLongPtr(g_pfwFrames[g_nFramesCount-1].TitleBar.hwnd,GWL_STYLE,GetWindowLongPtr(g_pfwFrames[g_nFramesCount-1].TitleBar.hwnd,GWL_STYLE)&~(WS_VSCROLL|WS_HSCROLL)); @@ -2037,7 +2036,7 @@ static int _us_DoAddFrame(WPARAM wParam,LPARAM lParam) if (mainHeight < minHeight) { BOOL Upward = FALSE; - Upward = !g_CluiData.fDocked&&g_CluiData.fAutoSize&&db_get_b(NULL,"CLUI","AutoSizeUpward",SETTING_AUTOSIZEUPWARD_DEFAULT); + Upward = !g_CluiData.fDocked && g_CluiData.fAutoSize && db_get_b(NULL,"CLUI","AutoSizeUpward",SETTING_AUTOSIZEUPWARD_DEFAULT); if (Upward) mainRect.top = mainRect.bottom-minHeight; @@ -2076,7 +2075,7 @@ static int _us_DoRemoveFrame(WPARAM wParam,LPARAM lParam) pos = id2pos(wParam); - if (pos < 0||pos>g_nFramesCount){return(-1);}; + if (pos < 0 || pos>g_nFramesCount){return(-1);}; if (g_pfwFrames[pos].Name != NULL) mir_free_and_nill(g_pfwFrames[pos].Name); if (g_pfwFrames[pos].szName != NULL) mir_free_and_nill(g_pfwFrames[pos].szName); @@ -2097,8 +2096,8 @@ static int _us_DoRemoveFrame(WPARAM wParam,LPARAM lParam) if (g_pfwFrames[pos].UpdateRgn) DeleteObject(g_pfwFrames[pos].UpdateRgn); if (g_pfwFrames[pos].OwnerWindow != (HWND)-1 - && g_pfwFrames[pos].OwnerWindow != (HWND)-2 - && g_pfwFrames[pos].OwnerWindow != (HWND)0) + && g_pfwFrames[pos].OwnerWindow != (HWND)-2 + && g_pfwFrames[pos].OwnerWindow != (HWND)0) DestroyWindow(g_pfwFrames[pos].OwnerWindow); g_pfwFrames[pos].OwnerWindow = NULL; @@ -2137,8 +2136,8 @@ static int CLUIFramesForceUpdateFrame(const FRAMEWND *Frame) static int CLUIFrameMoveResize(const FRAMEWND *Frame) { // we need to show or hide the frame? - if (Frame->visible&&(!Frame->needhide)) { - if (Frame->OwnerWindow != (HWND)-2 &&Frame->OwnerWindow) + if (Frame->visible && (!Frame->needhide)) { + if (Frame->OwnerWindow != (HWND)-2 && Frame->OwnerWindow) { // CLUI_ShowWindowMod(Frame->OwnerWindow,SW_SHOW); } @@ -2146,7 +2145,7 @@ static int CLUIFrameMoveResize(const FRAMEWND *Frame) CLUI_ShowWindowMod(Frame->TitleBar.hwnd,Frame->TitleBar.ShowTitleBar == TRUE?SW_SHOW/*NOACTIVATE*/:SW_HIDE); } else { - if (Frame->OwnerWindow && Frame->OwnerWindow != (HWND)(-1)&& Frame->OwnerWindow != (HWND)(-2)) + if (Frame->OwnerWindow && Frame->OwnerWindow != (HWND)(-1) && Frame->OwnerWindow != (HWND)(-2)) { CLUI_ShowWindowMod(Frame->OwnerWindow,SW_HIDE); } @@ -2155,7 +2154,7 @@ static int CLUIFrameMoveResize(const FRAMEWND *Frame) return(0); } - if (Frame->OwnerWindow&&Frame->OwnerWindow != (HWND)-2 ) + if (Frame->OwnerWindow && Frame->OwnerWindow != (HWND)-2 ) { RECT pr; POINT Off = {0}; @@ -2220,7 +2219,7 @@ static BOOL CLUIFramesFitInSize(void) tbh = g_nTitleBarHeight*btoint(g_pfwFrames[clientfrm].TitleBar.ShowTitleBar); 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)) { + 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) { @@ -2243,7 +2242,7 @@ int CLUIFrames_GetTotalHeight() 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)) + 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)); }; @@ -2278,7 +2277,7 @@ int CLUIFramesGetMinHeight() 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)) + if ((g_pfwFrames[i].align != alClient) && (g_pfwFrames[i].visible) && (!g_pfwFrames[i].needhide) && (!g_pfwFrames[i].floating)) { RECT wsize; @@ -2356,14 +2355,14 @@ static int CLUIFramesResizeFrames(const RECT newsize) drawitems = g_nFramesCount; - while(sumheight>(newheight-tbh)&&drawitems>0) { + while(sumheight>(newheight-tbh) && drawitems>0) { sumheight = 0; drawitems = 0; 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)) { + 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); - sumheight += (g_pfwFrames[i].height)+curfrmtbh+(i > 0 ? sepw : 0)+( (g_pfwFrames[i].UseBorder &&!g_CluiData.fLayered)?2:0); + sumheight += (g_pfwFrames[i].height)+curfrmtbh+(i > 0 ? sepw : 0)+( (g_pfwFrames[i].UseBorder && !g_CluiData.fLayered)?2:0); if (sumheight>newheight-tbh) { sumheight -= (g_pfwFrames[i].height)+curfrmtbh + (i > 0 ? sepw : 0); g_pfwFrames[i].needhide = !g_CluiData.fDocked && g_CluiData.fAutoSize?FALSE:TRUE; @@ -2379,10 +2378,10 @@ static int CLUIFramesResizeFrames(const RECT newsize) for(j = 0;j < g_nFramesCount;j++) { //move all alTop frames i = sdarray[j].realpos; - if ((!g_pfwFrames[i].needhide)&&(!g_pfwFrames[i].floating)&&(g_pfwFrames[i].visible)&&(g_pfwFrames[i].align == alTop)) { + if ((!g_pfwFrames[i].needhide) && (!g_pfwFrames[i].floating) && (g_pfwFrames[i].visible) && (g_pfwFrames[i].align == alTop)) { curfrmtbh = (g_nTitleBarHeight+g_CluiData.nGapBetweenTitlebar)*btoint(g_pfwFrames[i].TitleBar.ShowTitleBar); g_pfwFrames[i].wndSize.top = prevframebottomline+(i > 0 ? sepw : 0)+(curfrmtbh); - g_pfwFrames[i].wndSize.bottom = g_pfwFrames[i].height+g_pfwFrames[i].wndSize.top+((g_pfwFrames[i].UseBorder &&!g_CluiData.fLayered)?2:0); + g_pfwFrames[i].wndSize.bottom = g_pfwFrames[i].height+g_pfwFrames[i].wndSize.top+((g_pfwFrames[i].UseBorder && !g_CluiData.fLayered)?2:0); g_pfwFrames[i].prevvisframe = prevframe; prevframe = i; prevframebottomline = g_pfwFrames[i].wndSize.bottom; @@ -2397,7 +2396,7 @@ static int CLUIFramesResizeFrames(const RECT newsize) for(j = 0;j < g_nFramesCount;j++) { //move alClient frame i = sdarray[j].realpos; - if ((!g_pfwFrames[i].needhide)&&(!g_pfwFrames[i].floating)&&(g_pfwFrames[i].visible)&&(g_pfwFrames[i].align == alClient)) { + if ((!g_pfwFrames[i].needhide) && (!g_pfwFrames[i].floating) && (g_pfwFrames[i].visible) && (g_pfwFrames[i].align == alClient)) { int oldh; g_pfwFrames[i].wndSize.top = prevframebottomline+(j > 0 ? sepw : 0)+(tbh); g_pfwFrames[i].wndSize.bottom = g_pfwFrames[i].wndSize.top+newheight-sumheight-tbh-(j > 0 ? sepw : 0); @@ -2422,11 +2421,11 @@ static int CLUIFramesResizeFrames(const RECT newsize) for(j = g_nFramesCount-1;j >= 0;j--) { //move all alBottom frames i = sdarray[j].realpos; - if ((g_pfwFrames[i].visible)&&(!g_pfwFrames[i].floating)&&(!g_pfwFrames[i].needhide)&&(g_pfwFrames[i].align == alBottom)) { + if ((g_pfwFrames[i].visible) && (!g_pfwFrames[i].floating) && (!g_pfwFrames[i].needhide) && (g_pfwFrames[i].align == alBottom)) { curfrmtbh = (g_nTitleBarHeight+g_CluiData.nGapBetweenTitlebar)*btoint(g_pfwFrames[i].TitleBar.ShowTitleBar); g_pfwFrames[i].wndSize.bottom = prevframebottomline-(j > 0 ? sepw : 0); - g_pfwFrames[i].wndSize.top = g_pfwFrames[i].wndSize.bottom-g_pfwFrames[i].height-((g_pfwFrames[i].UseBorder &&!g_CluiData.fLayered)?2:0); + g_pfwFrames[i].wndSize.top = g_pfwFrames[i].wndSize.bottom-g_pfwFrames[i].height-((g_pfwFrames[i].UseBorder && !g_CluiData.fLayered)?2:0); g_pfwFrames[i].prevvisframe = prevframe; prevframe = i; prevframebottomline = g_pfwFrames[i].wndSize.top/*-1*/-curfrmtbh; @@ -2473,8 +2472,8 @@ int CLUIFrames_ApplyNewSizes(int mode) int i; g_CluiData.mutexPreventDockMoving = 0; 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) || + if ( (mode == 1 && g_pfwFrames[i].OwnerWindow != (HWND)-2 && g_pfwFrames[i].OwnerWindow) || + (mode == 2 && g_pfwFrames[i].OwnerWindow == (HWND)-2) || (mode == 3)) if (g_pfwFrames[i].floating){ CLUIFrameResizeFloatingFrame(i); @@ -2635,13 +2634,13 @@ int CheckFramesPos(RECT *wr) int dy; dx = 0;//rcNewWindowRect.left-rcOldWindowRect.left; dy = 0;//_window_rect.top-rcOldWindowRect.top; - if (!g_pfwFrames[i].floating&&g_pfwFrames[i].visible) + if (!g_pfwFrames[i].floating && g_pfwFrames[i].visible) { if (!(g_pfwFrames[i].OwnerWindow && (INT_PTR)(g_pfwFrames[i].OwnerWindow) != -2)) { RECT r; GetWindowRect(g_pfwFrames[i].hWnd,&r); - if (r.top-wr->top != g_pfwFrames[i].wndSize.top ||r.left-wr->left != g_pfwFrames[i].wndSize.left) + if (r.top-wr->top != g_pfwFrames[i].wndSize.top || r.left-wr->left != g_pfwFrames[i].wndSize.left) SetWindowPos(g_pfwFrames[i].hWnd,NULL,g_pfwFrames[i].wndSize.left, g_pfwFrames[i].wndSize.top,0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE); } if (g_pfwFrames[i].TitleBar.ShowTitleBar) @@ -2680,7 +2679,7 @@ int CLUIFramesOnClistResize(WPARAM wParam,LPARAM lParam) if (mainHeight < minHeight) { BOOL Upward = FALSE; - Upward = !g_CluiData.fDocked && g_CluiData.fAutoSize&&db_get_b(NULL,"CLUI","AutoSizeUpward",SETTING_AUTOSIZEUPWARD_DEFAULT); + Upward = !g_CluiData.fDocked && g_CluiData.fAutoSize && db_get_b(NULL,"CLUI","AutoSizeUpward",SETTING_AUTOSIZEUPWARD_DEFAULT); if (Upward) mainRect.top = mainRect.bottom-minHeight; @@ -2829,7 +2828,7 @@ void DrawBackGround(HWND hwnd,HDC mhdc, HBITMAP hBmpBackground, COLORREF bkColou GetClientRect(hwnd,&clRect); if (rcPaint == NULL) rcPaint = &clRect; - if (rcPaint->right-rcPaint->left == 0||rcPaint->top-rcPaint->bottom == 0) rcPaint = &clRect; + if (rcPaint->right-rcPaint->left == 0 || rcPaint->top-rcPaint->bottom == 0) rcPaint = &clRect; y = -yScroll; hdcMem = CreateCompatibleDC(hdc); hBmpOsb = CreateBitmap(clRect.right,clRect.bottom,1,GetDeviceCaps(hdc,BITSPIXEL),NULL); @@ -2945,7 +2944,7 @@ int DrawTitleBar(HDC hdcMem2,RECT * rect,int Frameid) pos = id2pos(Frameid); - if (pos >= 0&&pos < g_nFramesCount) + if (pos >= 0 && pos < g_nFramesCount) { GetClientRect(g_pfwFrames[pos].TitleBar.hwnd,&rc); if (g_pfwFrames[pos].floating) @@ -3197,7 +3196,7 @@ static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam //ScreenToClient(Frames[framepos].ContainerWnd,&Frames[framepos].TitleBar.oldpos); - if ((!(wParam&MK_CONTROL))&&g_pfwFrames[framepos].Locked&&(!(g_pfwFrames[framepos].floating))) + if ((!(wParam&MK_CONTROL)) && g_pfwFrames[framepos].Locked && (!(g_pfwFrames[framepos].floating))) { if (db_get_b(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT)) { POINT pt; @@ -3262,7 +3261,7 @@ static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam } // - if ((wParam&MK_LBUTTON)/*&&(wParam&MK_CONTROL)*/) + if ((wParam&MK_LBUTTON)/* && (wParam&MK_CONTROL)*/) { RECT rcMiranda; RECT rcwnd,rcOverlap; @@ -3283,7 +3282,7 @@ static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam GetWindowRect(pcli->hwndContactList, &rcMiranda ); //GetWindowRect( Frames[pos].ContainerWnd, &rcwnd ); //IntersectRect( &rcOverlap, &rcwnd, &rcMiranda ) - if (IsWindowVisible(pcli->hwndContactList) &&IntersectRect( &rcOverlap, &rcwnd, &rcMiranda )) + if (IsWindowVisible(pcli->hwndContactList) && IntersectRect( &rcOverlap, &rcwnd, &rcMiranda )) { int id = g_pfwFrames[pos].id; @@ -3372,7 +3371,7 @@ static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam if (g_pfwFrames[pos].floating) { GetCursorPos(&pt); - if ((g_pfwFrames[pos].TitleBar.oldpos.x != pt.x)||(g_pfwFrames[pos].TitleBar.oldpos.y != pt.y)) + if ((g_pfwFrames[pos].TitleBar.oldpos.x != pt.x) || (g_pfwFrames[pos].TitleBar.oldpos.y != pt.y)) { pt2 = pt; @@ -3426,7 +3425,7 @@ static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam if (g_pfwFrames[pos].prevvisframe != -1) { GetCursorPos(&pt); - if ((g_pfwFrames[pos].TitleBar.oldpos.x == pt.x)&&(g_pfwFrames[pos].TitleBar.oldpos.y == pt.y)) + if ((g_pfwFrames[pos].TitleBar.oldpos.x == pt.x) && (g_pfwFrames[pos].TitleBar.oldpos.y == pt.y)) {break;}; ypos = rect.top+pt.y;xpos = rect.left+pt.x; @@ -3441,7 +3440,7 @@ static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam Framemod = g_pfwFrames[pos].prevvisframe; } if (g_pfwFrames[Framemod].Locked) {break;}; - if (s_nCurDragBar != -1&&s_nCurDragBar != pos) {break;}; + if (s_nCurDragBar != -1 && s_nCurDragBar != pos) {break;}; if (s_nLastByPos == -1) { s_nCurDragBar = pos; @@ -3710,7 +3709,7 @@ static LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wP framepos = id2pos(Frameid); - if (framepos < 0||framepos >= g_nFramesCount){break;}; + if (framepos < 0 || framepos >= g_nFramesCount){break;}; if (!g_pfwFrames[framepos].minmaxenabled){break;}; if (g_pfwFrames[framepos].ContainerWnd == 0){break;}; @@ -3734,7 +3733,7 @@ static LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wP RECT border; int tbh = g_nTitleBarHeight*btoint(g_pfwFrames[framepos].TitleBar.ShowTitleBar); GetBorderSize(hwnd,&border); - if (minmax.ptMaxTrackSize.x != 0&&minmax.ptMaxTrackSize.y != 0){ + if (minmax.ptMaxTrackSize.x != 0 && minmax.ptMaxTrackSize.y != 0){ ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = minmax.ptMinTrackSize.x; ((LPMINMAXINFO)lParam)->ptMinTrackSize.y = minmax.ptMinTrackSize.y; @@ -3762,7 +3761,7 @@ static LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wP framepos = id2pos(Frameid); - if (framepos < 0||framepos >= g_nFramesCount){break;}; + if (framepos < 0 || framepos >= g_nFramesCount){break;}; if (g_pfwFrames[framepos].ContainerWnd == 0){return(0);}; GetWindowRect(g_pfwFrames[framepos].ContainerWnd,&rect); @@ -3839,7 +3838,7 @@ static LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wP framepos = id2pos(Frameid); - if (framepos < 0||framepos >= g_nFramesCount){break;}; + if (framepos < 0 || framepos >= g_nFramesCount){break;}; if (g_pfwFrames[framepos].ContainerWnd == 0){return(0);}; CLUIFrameResizeFloatingFrame(framepos); @@ -3896,11 +3895,11 @@ static int _us_DoSetFrameFloat(WPARAM wParam,LPARAM lParam) int pos = id2pos( wParam ); - if ( pos >= 0&& pos < g_nFramesCount ) + if ( pos >= 0 && pos < g_nFramesCount ) if (g_pfwFrames[pos].floating || (lParam&2)) { - if (g_pfwFrames[pos].OwnerWindow != (HWND)-2 &&g_pfwFrames[pos].visible) + if (g_pfwFrames[pos].OwnerWindow != (HWND)-2 && g_pfwFrames[pos].visible) { if (g_pfwFrames[pos].OwnerWindow == 0) g_pfwFrames[pos].OwnerWindow = CreateSubContainerWindow(pcli->hwndContactList,g_pfwFrames[pos].FloatingPos.x,g_pfwFrames[pos].FloatingPos.y,10,10); CLUI_ShowWindowMod(g_pfwFrames[pos].OwnerWindow,(g_pfwFrames[pos].visible && g_pfwFrames[pos].collapsed && IsWindowVisible(pcli->hwndContactList))?SW_SHOW/*NOACTIVATE*/:SW_HIDE); @@ -3961,7 +3960,7 @@ static int _us_DoSetFrameFloat(WPARAM wParam,LPARAM lParam) SetWindowLongPtr(g_pfwFrames[pos].ContainerWnd,GWLP_USERDATA,g_pfwFrames[pos].id); if ((lParam == 1)) { - //if ((Frames[pos].FloatingPos.x != 0)&&(Frames[pos].FloatingPos.y != 0)) + //if ((Frames[pos].FloatingPos.x != 0) && (Frames[pos].FloatingPos.y != 0)) { if (g_pfwFrames[pos].FloatingPos.x < 0){g_pfwFrames[pos].FloatingPos.x = 0;}; if (g_pfwFrames[pos].FloatingPos.y < 0){g_pfwFrames[pos].FloatingPos.y = 0;}; @@ -4149,10 +4148,10 @@ int UnLoadCLUIFramesModule(void) g_pfwFrames[i].hWnd = (HWND)-1; DestroyWindow(g_pfwFrames[i].TitleBar.hwnd); g_pfwFrames[i].TitleBar.hwnd = (HWND)-1; - if (g_pfwFrames[i].ContainerWnd && g_pfwFrames[i].ContainerWnd != (HWND)(-2)&& g_pfwFrames[i].ContainerWnd != (HWND)(-1)) DestroyWindow(g_pfwFrames[i].ContainerWnd); + if (g_pfwFrames[i].ContainerWnd && g_pfwFrames[i].ContainerWnd != (HWND)(-2) && g_pfwFrames[i].ContainerWnd != (HWND)(-1)) DestroyWindow(g_pfwFrames[i].ContainerWnd); g_pfwFrames[i].ContainerWnd = (HWND)-1; if (g_pfwFrames[i].TitleBar.hmenu) DestroyMenu(g_pfwFrames[i].TitleBar.hmenu); - if (g_pfwFrames[i].OwnerWindow && g_pfwFrames[i].OwnerWindow != (HWND)(-2)&& g_pfwFrames[i].OwnerWindow != (HWND)(-1)) + if (g_pfwFrames[i].OwnerWindow && g_pfwFrames[i].OwnerWindow != (HWND)(-2) && g_pfwFrames[i].OwnerWindow != (HWND)(-1)) DestroyWindow(g_pfwFrames[i].OwnerWindow ); g_pfwFrames[i].OwnerWindow = (HWND)-2; if (g_pfwFrames[i].UpdateRgn) DeleteObject(g_pfwFrames[i].UpdateRgn); diff --git a/plugins/Clist_modern/modern_commonheaders.cpp b/plugins/Clist_modern/modern_commonheaders.cpp index 17e611dcd6..c5d9a7408e 100644 --- a/plugins/Clist_modern/modern_commonheaders.cpp +++ b/plugins/Clist_modern/modern_commonheaders.cpp @@ -57,7 +57,7 @@ BOOL __cdecl mir_bool_tstrcmpi(const TCHAR *a, const TCHAR *b) int __cdecl mir_strcmp (const char *a, const char *b) { - if (!(a&&b)) return a != b; + if (!(a && b)) return a != b; return (strcmp(a,b)); }; diff --git a/plugins/Clist_modern/modern_docking.cpp b/plugins/Clist_modern/modern_docking.cpp index ff45c0eeda..eda88ce4fc 100644 --- a/plugins/Clist_modern/modern_docking.cpp +++ b/plugins/Clist_modern/modern_docking.cpp @@ -186,8 +186,8 @@ int Docking_ProcessWindowMessage(WPARAM wParam,LPARAM lParam) Docking_GetMonitorRectFromPoint(ptCursor,&rcMonitor); if (((ptCursor.x < rcMonitor.left+EDGESENSITIVITY) - || (ptCursor.x >= rcMonitor.right-EDGESENSITIVITY)) - && db_get_b(NULL,"CLUI","DockToSides",SETTING_DOCKTOSIDES_DEFAULT)) + || (ptCursor.x >= rcMonitor.right-EDGESENSITIVITY)) + && db_get_b(NULL,"CLUI","DockToSides",SETTING_DOCKTOSIDES_DEFAULT)) { ZeroMemory(&abd,sizeof(abd)); abd.cbSize = sizeof(abd); @@ -296,7 +296,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam,LPARAM lParam) case WM_NCHITTEST: { LONG result; result = DefWindowProc(msg->hwnd,WM_NCHITTEST,msg->wParam,msg->lParam); - if (result == HTSIZE || result == HTTOP || result == HTTOPLEFT || result == HTTOPRIGHT || + if (result == HTSIZE || result == HTTOP || result == HTTOPLEFT || result == HTTOPRIGHT || result == HTBOTTOM || result == HTBOTTOMRIGHT || result == HTBOTTOMLEFT) {*((LRESULT*)lParam) = HTCLIENT; return TRUE;} if (g_CluiData.fDocked == DOCKED_LEFT && result == HTLEFT) {*((LRESULT*)lParam) = HTCLIENT; return TRUE;} if (g_CluiData.fDocked == DOCKED_RIGHT && result == HTRIGHT) {*((LRESULT*)lParam) = HTCLIENT; return TRUE;} @@ -317,7 +317,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam,LPARAM lParam) { RECT rc; POINT pt; GetClientRect(msg->hwnd,&rc); - if (((g_CluiData.fDocked == DOCKED_LEFT || g_CluiData.fDocked == -DOCKED_LEFT) && (short)LOWORD(msg->lParam)>rc.right) || + if (((g_CluiData.fDocked == DOCKED_LEFT || g_CluiData.fDocked == -DOCKED_LEFT) && (short)LOWORD(msg->lParam)>rc.right) || ((g_CluiData.fDocked == DOCKED_RIGHT || g_CluiData.fDocked == -DOCKED_RIGHT) && (short)LOWORD(msg->lParam) < 0)) { ReleaseCapture(); draggingTitle = 0; diff --git a/plugins/Clist_modern/modern_extraimage.cpp b/plugins/Clist_modern/modern_extraimage.cpp index 77f805d20d..f0a5799355 100644 --- a/plugins/Clist_modern/modern_extraimage.cpp +++ b/plugins/Clist_modern/modern_extraimage.cpp @@ -85,8 +85,8 @@ __inline int bti(boolean b) int colsum(int from,int to) { int i,sum; - if (from < 0||from >= EXTRACOLUMNCOUNT){return(-1);}; - if (to < 0||to >= EXTRACOLUMNCOUNT){return(-1);}; + if (from < 0 || from >= EXTRACOLUMNCOUNT){return(-1);}; + if (to < 0 || to >= EXTRACOLUMNCOUNT){return(-1);}; if (to < from){return(-1);}; sum = 0; @@ -134,7 +134,7 @@ INT_PTR SetIconForExtraColumn(WPARAM wParam,LPARAM lParam) HANDLE hItem; if (pcli->hwndContactTree == 0){return(-1);}; - if (wParam == 0||lParam == 0){return(-1);}; + if (wParam == 0 || lParam == 0){return(-1);}; piec = (pIconExtraColumn)lParam; if (piec->cbSize != sizeof(IconExtraColumn)){return(-1);}; @@ -152,7 +152,7 @@ INT_PTR SetIconForExtraColumn(WPARAM wParam,LPARAM lParam) INT_PTR AddIconToExtraImageList(WPARAM wParam,LPARAM lParam) { int res = -1; - if (hExtraImageList == 0||wParam == 0){return(-1);}; + if (hExtraImageList == 0 || wParam == 0){return(-1);}; res = ((int)ImageList_AddIcon(hExtraImageList,(HICON)wParam)); if (res>254) return -1; return res; @@ -464,7 +464,7 @@ INT_PTR WideSetIconForExtraColumn(WPARAM wParam,LPARAM lParam) HANDLE hItem; if (pcli->hwndContactTree == 0){return(-1);}; - if (wParam == 0||lParam == 0){return(-1);}; + if (wParam == 0 || lParam == 0){return(-1);}; piec = (pIconExtraColumn)lParam; if (piec->cbSize != sizeof(IconExtraColumn)){return(-1);}; @@ -484,7 +484,7 @@ INT_PTR WideSetIconForExtraColumn(WPARAM wParam,LPARAM lParam) INT_PTR WideAddIconToExtraImageList(WPARAM wParam,LPARAM lParam) { int res = -1; - if (hWideExtraImageList == 0||wParam == 0){return(-1);}; + if (hWideExtraImageList == 0 || wParam == 0){return(-1);}; res = ((int)ImageList_AddIcon(hWideExtraImageList,(HICON)wParam)); if (res == 0xFF) res = ((int)ImageList_AddIcon(hWideExtraImageList,(HICON)wParam)); if (res>0xFFFE) return -1; diff --git a/plugins/Clist_modern/modern_framesmenu.cpp b/plugins/Clist_modern/modern_framesmenu.cpp index cc838470a3..27ec830d9f 100644 --- a/plugins/Clist_modern/modern_framesmenu.cpp +++ b/plugins/Clist_modern/modern_framesmenu.cpp @@ -87,7 +87,7 @@ INT_PTR FrameMenuCheckService(WPARAM wParam,LPARAM lParam) { if (fmep != NULL) { //pcpp->wParam - frameid - if (((WPARAM)fmep->Frameid == pcpp->wParam)||fmep->Frameid == -1) return(TRUE); + if (((WPARAM)fmep->Frameid == pcpp->wParam) || fmep->Frameid == -1) return(TRUE); }; }; diff --git a/plugins/Clist_modern/modern_groupmenu.cpp b/plugins/Clist_modern/modern_groupmenu.cpp index f36ec10135..481239feb3 100644 --- a/plugins/Clist_modern/modern_groupmenu.cpp +++ b/plugins/Clist_modern/modern_groupmenu.cpp @@ -488,12 +488,12 @@ static int OnBuildSubGroupMenu(WPARAM wParam,LPARAM lParam) gray1 = (showOfflineinGroup != FALSE); gray2 = (group->hideOffline != FALSE); - if (gray1&&gray2) gray1 = FALSE; //should not be cause CLCItems_IsShowOfflineGroup return false if group->hideOffline + if (gray1 && gray2) gray1 = FALSE; //should not be cause CLCItems_IsShowOfflineGroup return false if group->hideOffline - mi.flags = CMIM_FLAGS | ((group->hideOffline&&!gray1)?CMIF_CHECKED:0)| (gray1?CMIF_GRAYED:0); + mi.flags = CMIM_FLAGS | ((group->hideOffline && !gray1)?CMIF_CHECKED:0)| (gray1?CMIF_GRAYED:0); CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hHideOfflineUsersHereMenuItem, (LPARAM)&mi); - mi.flags = CMIM_FLAGS | ((showOfflineinGroup&&!gray2) ? CMIF_CHECKED:0)| (gray2?CMIF_GRAYED:0); + mi.flags = CMIM_FLAGS | ((showOfflineinGroup && !gray2) ? CMIF_CHECKED:0)| (gray2?CMIF_GRAYED:0); CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hShowOfflineUsersHereMenuItem, (LPARAM)&mi); return 0; diff --git a/plugins/Clist_modern/modern_row.cpp b/plugins/Clist_modern/modern_row.cpp index ac6bd221e2..e1b9a9d81a 100644 --- a/plugins/Clist_modern/modern_row.cpp +++ b/plugins/Clist_modern/modern_row.cpp @@ -328,10 +328,10 @@ BOOL rowParse(ROWCELL* &cell, ROWCELL* parent, char *tbuf, int &hbuf, int &seque word = rowParserGetNextWord(tbuf, hbuf); int cont; - if (!_strnicmp(word, "", strlen(word))) cont = TC_ROW; - else if (!_strnicmp(word, "", strlen(word))) cont = TC_COL; - else if (!_strnicmp(word, "/>", strlen(word))|| - !_strnicmp(word, "", strlen(word))|| + if (!_strnicmp(word, "", strlen(word))) cont = TC_ROW; + else if (!_strnicmp(word, "", strlen(word))) cont = TC_COL; + else if (!_strnicmp(word, "/>", strlen(word)) || + !_strnicmp(word, "", strlen(word)) || !_strnicmp(word, "", strlen(word))) return TRUE; else return FALSE; @@ -694,7 +694,7 @@ void rowPositioning(pROWCELL cell, int &dist) } else size = w; /* пока отключено ибо параметр влияет на выравнивание включается по левому краю - if (0 &&!curchild->fitwidth) + if (0 && !curchild->fitwidth) if (size>max(curchild->full_width,curchild->w)) size = max(curchild->full_width,curchild->w); */ diff --git a/plugins/Clist_modern/modern_rowheight_funcs.cpp b/plugins/Clist_modern/modern_rowheight_funcs.cpp index 36078db950..03de2da063 100644 --- a/plugins/Clist_modern/modern_rowheight_funcs.cpp +++ b/plugins/Clist_modern/modern_rowheight_funcs.cpp @@ -111,7 +111,7 @@ int mod_CalcRowHeight_worker(struct ClcData *dat, HWND hwnd, struct ClcContact * if (item != -1) dat->row_heights[item] = tmp; return tmp; } - hasAvatar = (dat->use_avatar_service && contact->avatar_data != NULL) ||(!dat->use_avatar_service && contact->avatar_pos != AVATAR_POS_DONT_HAVE); + hasAvatar = (dat->use_avatar_service && contact->avatar_data != NULL) || (!dat->use_avatar_service && contact->avatar_pos != AVATAR_POS_DONT_HAVE); while (gl_RowTabAccess[i] != NULL) { if (gl_RowTabAccess[i]->type != TC_SPACE) @@ -217,9 +217,9 @@ int mod_CalcRowHeight_worker(struct ClcData *dat, HWND hwnd, struct ClcContact * case TC_STATUS: { if ( - (contact->type == CLCIT_GROUP && !dat->row_hide_group_icon)|| - ( contact->type == CLCIT_CONTACT && contact->iImage != -1 && - !(dat->icon_hide_on_avatar && dat->avatars_show && (hasAvatar|| (!hasAvatar && dat->icon_draw_on_avatar_space && contact->iImage != -1)) && !contact->image_is_special)) + (contact->type == CLCIT_GROUP && !dat->row_hide_group_icon) || + ( contact->type == CLCIT_CONTACT && contact->iImage != -1 && + !(dat->icon_hide_on_avatar && dat->avatars_show && (hasAvatar || (!hasAvatar && dat->icon_draw_on_avatar_space && contact->iImage != -1)) && !contact->image_is_special)) ) { gl_RowTabAccess[i]->h = ICON_HEIGHT; @@ -672,7 +672,7 @@ int RowHeights_GetRowHeight_worker(struct ClcData *dat, HWND hwnd, struct ClcCon if (dat->avatars_show && !dat->avatars_ignore_size_for_row_height && contact->type == CLCIT_CONTACT && ( - (dat->use_avatar_service && contact->avatar_data != NULL) || + (dat->use_avatar_service && contact->avatar_data != NULL) || (!dat->use_avatar_service && contact->avatar_pos != AVATAR_POS_DONT_HAVE) ) && !minimalistic ) { @@ -680,8 +680,8 @@ int RowHeights_GetRowHeight_worker(struct ClcData *dat, HWND hwnd, struct ClcCon } // Checkbox size - if ((style&CLS_CHECKBOXES && contact->type == CLCIT_CONTACT) || - (style&CLS_GROUPCHECKBOXES && contact->type == CLCIT_GROUP) || + if ((style&CLS_CHECKBOXES && contact->type == CLCIT_CONTACT) || + (style&CLS_GROUPCHECKBOXES && contact->type == CLCIT_GROUP) || (contact->type == CLCIT_INFO && contact->flags&CLCIIF_CHECKBOX)) { height = max(height, dat->checkboxSize); @@ -693,7 +693,7 @@ int RowHeights_GetRowHeight_worker(struct ClcData *dat, HWND hwnd, struct ClcCon if (contact->type == CLCIT_GROUP || (contact->type == CLCIT_CONTACT && contact->iImage != -1 && !(dat->icon_hide_on_avatar && dat->avatars_show - && ( (dat->use_avatar_service && contact->avatar_data != NULL) || + && ( (dat->use_avatar_service && contact->avatar_data != NULL) || (!dat->use_avatar_service && contact->avatar_pos != AVATAR_POS_DONT_HAVE) ) && !contact->image_is_special))) diff --git a/plugins/Clist_modern/modern_skinbutton.cpp b/plugins/Clist_modern/modern_skinbutton.cpp index 5d985b6a6e..b87cd7eaf5 100644 --- a/plugins/Clist_modern/modern_skinbutton.cpp +++ b/plugins/Clist_modern/modern_skinbutton.cpp @@ -246,7 +246,7 @@ static int ModernSkinButtonToggleDBValue(char * ValueDBSection,char *ValueTypeDe case 's': { Value = db_get_sa(NULL,section,key); - if (!Value ||(Value && mir_bool_strcmpi(Value,val2))) + if (!Value || (Value && mir_bool_strcmpi(Value,val2))) Value = mir_strdup(val); else Value = mir_strdup(val2); @@ -314,8 +314,7 @@ static int _CallServiceStrParams(IN char * toParce, OUT int *Return) if (strlen(param1) == 0) param1 = NULL; } if (!pszService) return 0; - if (strlen(pszService) == 0) - { + if (strlen(pszService) == 0) { mir_free(pszService); return 0; } @@ -502,7 +501,7 @@ static LRESULT CALLBACK ModernSkinButtonWndProc(HWND hwndDlg, UINT msg, WPARAM if (bct->CommandService) { - if (!_CallServiceStrParams(bct->CommandService, NULL)&& (bct->ValueDBSection && bct->ValueTypeDef)) + if (!_CallServiceStrParams(bct->CommandService, NULL) && (bct->ValueDBSection && bct->ValueTypeDef)) ModernSkinButtonToggleDBValue(bct->ValueDBSection,bct->ValueTypeDef); } bct->down = 0; @@ -668,8 +667,8 @@ static int ModernSkinButtonErase(int l,int t,int r, int b) if (!ModernSkinButtonModuleIsLoaded) return 0; if (!g_CluiData.fLayered) return 0; if (!g_pCachedWindow) return 0; - if (!g_pCachedWindow->hImageDC ||!g_pCachedWindow->hBackDC) return 0; - if (!(l||r||t||b)) + if (!g_pCachedWindow->hImageDC || !g_pCachedWindow->hBackDC) return 0; + if (!(l || r || t || b)) { for(i=0; i < ButtonsCount; i++) { @@ -789,15 +788,15 @@ int ModernSkinButton_ReposButtons(HWND parent, BYTE draw, RECT * r) ( rc.top + Buttons[i].OrB ); SetWindowPos(Buttons[i].hwnd,HWND_TOP,l,t,r-l,b-t,0); - if ( (rc.right-rc.left < Buttons[i].minW /*&& Buttons[i].minW != 0*/) - ||(rc.bottom-rc.top < Buttons[i].minH /*&& Buttons[i].minH != 0*/)) + if ( (rc.right-rc.left < Buttons[i].minW /* && Buttons[i].minW != 0*/) + || (rc.bottom-rc.top < Buttons[i].minH /* && Buttons[i].minH != 0*/)) CLUI_ShowWindowMod(Buttons[i].hwnd,SW_HIDE); else CLUI_ShowWindowMod(Buttons[i].hwnd,SW_SHOW); - if ((1 || altDraw)&& - (Buttons[i].bct->Left != l || - Buttons[i].bct->Top != t || - Buttons[i].bct->Right != r|| + if ((1 || altDraw) && + (Buttons[i].bct->Left != l || + Buttons[i].bct->Top != t || + Buttons[i].bct->Right != r || Buttons[i].bct->Bottom != b)) { //Need to erase in old location diff --git a/plugins/Clist_modern/modern_skineditor.cpp b/plugins/Clist_modern/modern_skineditor.cpp index 3d532c53b4..38c9e8bc98 100644 --- a/plugins/Clist_modern/modern_skineditor.cpp +++ b/plugins/Clist_modern/modern_skineditor.cpp @@ -128,7 +128,7 @@ int TreeAddObject(HWND hwndDlg, int ID, OPT_OBJECT_DATA * data) int enumDB_SkinObjectsForEditorProc(const char *szSetting,LPARAM lParam) { - if (wildcmp((char *)szSetting,gl_Mask,0)||wildcmp((char *)szSetting,"$*",0)) + if (wildcmp((char *)szSetting,gl_Mask,0) || wildcmp((char *)szSetting,"$*",0)) { char * value; char *desc; @@ -722,16 +722,16 @@ INT_PTR CALLBACK DlgSkinEditorOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM } else if (( (LOWORD(wParam) == IDC_E_TOP - ||LOWORD(wParam) == IDC_E_BOTTOM - ||LOWORD(wParam) == IDC_E_LEFT - ||LOWORD(wParam) == IDC_E_RIGHT - ||LOWORD(wParam) == IDC_E_X - ||LOWORD(wParam) == IDC_E_Y - ||LOWORD(wParam) == IDC_E_W - ||LOWORD(wParam) == IDC_E_H - ||LOWORD(wParam) == IDC_EDIT_ALPHA + || LOWORD(wParam) == IDC_E_BOTTOM + || LOWORD(wParam) == IDC_E_LEFT + || LOWORD(wParam) == IDC_E_RIGHT + || LOWORD(wParam) == IDC_E_X + || LOWORD(wParam) == IDC_E_Y + || LOWORD(wParam) == IDC_E_W + || LOWORD(wParam) == IDC_E_H + || LOWORD(wParam) == IDC_EDIT_ALPHA ) - && HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) + && HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) { return 0; } diff --git a/plugins/Clist_modern/modern_skinengine.cpp b/plugins/Clist_modern/modern_skinengine.cpp index 1e0e1ab1ee..81db118868 100644 --- a/plugins/Clist_modern/modern_skinengine.cpp +++ b/plugins/Clist_modern/modern_skinengine.cpp @@ -150,10 +150,9 @@ IniParser::IniParser( HINSTANCE hInst, const char * resourceName, const char * IniParser::~IniParser() { - if ( _szSection ) mir_free( _szSection ); + mir_free( _szSection ); if ( _hFile ) fclose( _hFile ); - if ( _hGlobalRes ) - { + if ( _hGlobalRes ) { UnlockResource( _hGlobalRes ); FreeResource(_hGlobalRes); } @@ -381,7 +380,7 @@ BOOL IniParser::_DoParseLine( char * szLine ) case '[': { //New section start here - if ( _szSection ) mir_free( _szSection ); + mir_free( _szSection ); _szSection = NULL; char *tbuf = szLine + 1; // skip [ @@ -826,7 +825,7 @@ static BOOL ske_SkinFillRectByGlyph(HDC hDest, HDC hSource, RECT * rFill, RECT * } return 1; } - else if (mode == FM_TILE_VERT && (rGlyph->bottom-rGlyph->top>0)&& (rGlyph->right-rGlyph->left>0)) + else if (mode == FM_TILE_VERT && (rGlyph->bottom-rGlyph->top>0) && (rGlyph->right-rGlyph->left>0)) { HDC mem2dc; HBITMAP mem2bmp,oldbmp; @@ -925,7 +924,7 @@ static BOOL ske_SkinFillRectByGlyph(HDC hDest, HDC hSource, RECT * rFill, RECT * DeleteObject(mem2bmp); mod_DeleteDC(mem2dc); } - else if (mode == FM_TILE_HORZ && (rGlyph->right-rGlyph->left>0)&& (rGlyph->bottom-rGlyph->top>0)&&(rFill->bottom-rFill->top)>0 && (rFill->right-rFill->left)>0) + else if (mode == FM_TILE_HORZ && (rGlyph->right-rGlyph->left>0) && (rGlyph->bottom-rGlyph->top>0) && (rFill->bottom-rFill->top)>0 && (rFill->right-rFill->left)>0) { HDC mem2dc; RECT wr; @@ -1240,12 +1239,12 @@ static int ske_DrawSkinObject(SKINDRAWREQUEST * preq, GLYPHOBJECT * pobj) int mode = 0; //0-FastDraw, 1-DirectAlphaDraw, 2-BufferedAlphaDraw if (!(preq && pobj)) return -1; - if ((!pobj->hGlyph || pobj->hGlyph == (HBITMAP)-1) && ((pobj->Style&7) == ST_IMAGE ||(pobj->Style&7) == ST_FRAGMENT|| (pobj->Style&7) == ST_SOLARIZE)) return 0; + if ((!pobj->hGlyph || pobj->hGlyph == (HBITMAP)-1) && ((pobj->Style&7) == ST_IMAGE || (pobj->Style&7) == ST_FRAGMENT || (pobj->Style&7) == ST_SOLARIZE)) return 0; // Determine painting mode depth = GetDeviceCaps(preq->hDC,BITSPIXEL); depth = depth < 16?16:depth; Is32Bit = pobj->bmBitsPixel == 32; - if ((!Is32Bit && pobj->dwAlpha == 255)&& pobj->Style != ST_BRUSH) mode = 0; + if ((!Is32Bit && pobj->dwAlpha == 255) && pobj->Style != ST_BRUSH) mode = 0; else if (pobj->dwAlpha == 255 && pobj->Style != ST_BRUSH) mode = 1; else mode = 2; // End painting mode @@ -1706,10 +1705,10 @@ INT_PTR ske_Service_DrawGlyph(WPARAM wParam,LPARAM lParam) if (pgl->Data == NULL) return -1; gl = (LPGLYPHOBJECT)pgl->Data; if ((gl->Style&7) == ST_SKIP) return ST_SKIP; - if (gl->hGlyph == NULL && gl->hGlyph != (HBITMAP)-1 && + if (gl->hGlyph == NULL && gl->hGlyph != (HBITMAP)-1 && ( (gl->Style&7) == ST_IMAGE - ||(gl->Style&7) == ST_FRAGMENT - ||(gl->Style&7) == ST_SOLARIZE )) + || (gl->Style&7) == ST_FRAGMENT + || (gl->Style&7) == ST_SOLARIZE )) if (gl->szFileName) { gl->hGlyph = ske_LoadGlyphImage(gl->szFileName); @@ -1825,8 +1824,8 @@ static BOOL ske_ReadTGAImageData(void * From, DWORD fromSize, BYTE * destBuf, DW DWORD fromCount = 0; if (!RLE) { - while (((from&&fromCount < fromSize) || (fp&& fromCount < bufSize)) - &&(destCount < bufSize)) + while (((from && fromCount < fromSize) || (fp && fromCount < bufSize)) + && (destCount < bufSize)) { BYTE r = from?from[fromCount++]:(BYTE)fgetc(fp); BYTE g = from?from[fromCount++]:(BYTE)fgetc(fp); @@ -1906,7 +1905,7 @@ static HBITMAP ske_LoadGlyphImage_TGA(char * szFilename) /* read header */ fread (&header, sizeof (tga_header_t), 1, fp); if ( (header.pixel_depth != 32) - ||((header.image_type != 10)&&(header.image_type != 2)) + || ((header.image_type != 10) && (header.image_type != 2)) ) { fclose(fp); @@ -1939,7 +1938,7 @@ static HBITMAP ske_LoadGlyphImage_TGA(char * szFilename) if (size>sizeof(header)) { tga_header_t * header = (tga_header_t *)mem; - if (header->pixel_depth == 32&& (header->image_type == 2 ||header->image_type == 10)) + if (header->pixel_depth == 32 && (header->image_type == 2 || header->image_type == 10)) { colormap = (BYTE*)malloc(header->width*header->height*4); cx = header->width; @@ -2696,7 +2695,7 @@ BOOL ske_TextOut(HDC hdc, int x, int y, LPCTSTR lpString, int nCount) int ta; SIZE sz; RECT rc = {0}; - if (!g_CluiData.fGDIPlusFail &&0) ///text via gdi+ + if (!g_CluiData.fGDIPlusFail && 0) ///text via gdi+ { TextOutWithGDIp(hdc,x,y,lpString,nCount); return 0; @@ -3281,7 +3280,7 @@ BOOL ske_DrawText(HDC hdc, LPCTSTR lpString, int nCount, RECT * lpRect, UINT for return DrawText(hdc,lpString,nCount,lpRect,format&~DT_FORCENATIVERENDER); form = format; color = GetTextColor(hdc); - if (!g_CluiData.fGDIPlusFail &&0) ///text via gdi+ + if (!g_CluiData.fGDIPlusFail && 0) ///text via gdi+ { TextOutWithGDIp(hdc,lpRect->left,lpRect->top,lpString,nCount); return 0; @@ -3502,17 +3501,17 @@ BOOL ske_DrawIconEx(HDC hdcDst,int xLeft,int yTop,HICON hIcon,int cxWidth,int cy right = cx; top = 0; h = icy; - for (y = top;(y < bottom)&&!hasmask; y++) + for (y = top;(y < bottom) && !hasmask; y++) { t1 = immaskbits+y*mwb; - for (x = 0; (x < mwb)&&!hasmask; x++) + for (x = 0; (x < mwb) && !hasmask; x++) hasmask |= (*(t1+x) != 0); } - for (y = top;(y < bottom)&&!hasalpha; y++) + for (y = top;(y < bottom) && !hasalpha; y++) { t1 = imimagbits+(cy-y-1)*mwb2; - for (x = 0; (x < right)&&!hasalpha; x++) + for (x = 0; (x < right) && !hasalpha; x++) hasalpha |= (*(t1+(x << 2)+3) != 0); } @@ -3720,7 +3719,7 @@ static INT_PTR ske_Service_InvalidateFrameImage(WPARAM wParam, LPARAM lParam) } else Sync( QueueAllFramesUpdating , (BYTE)1 ); - if (!flag_bUpdateQueued||g_flag_bPostWasCanceled) + if (!flag_bUpdateQueued || g_flag_bPostWasCanceled) if (PostMessage(pcli->hwndContactList,UM_UPDATE,0,0)) { flag_bUpdateQueued = 1; @@ -3982,7 +3981,7 @@ 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); @@ -4156,7 +4155,7 @@ 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 && (/*(g_CluiData.bCurrentAlpha == 255)||*/(g_proc_SetLayeredWindowAttributesNew && IsTransparancy))) + if (!g_CluiData.fLayered && (/*(g_CluiData.bCurrentAlpha == 255) || */(g_proc_SetLayeredWindowAttributesNew && IsTransparancy))) { if (!layered) SetWindowLongPtr(hwnd, GWL_EXSTYLE, GetWindowLongPtr(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED); if (g_proc_SetLayeredWindowAttributesNew) g_proc_SetLayeredWindowAttributesNew(hwnd, RGB(0,0,0), (BYTE)g_CluiData.bCurrentAlpha, LWA_ALPHA); @@ -4259,7 +4258,7 @@ static TCHAR *ske_ReAppend(TCHAR *lfirst, TCHAR * lsecond, int len) TCHAR *buf = (TCHAR *)mir_alloc((l1+l2+1)*sizeof(TCHAR)); if (lfirst) memmove(buf,lfirst,l1*sizeof(TCHAR)); memmove(buf+l1,lsecond,l2*sizeof(TCHAR)); - if (lfirst) mir_free(lfirst); + mir_free(lfirst); if (len) buf[l1+l2] = _T('\0'); return buf; } @@ -4652,7 +4651,7 @@ HICON ske_CreateJoinedIcon(HICON hBottom, HICON hTop, BYTE alpha) GetObject(iciTop.hbmColor,sizeof(BITMAP),&bmp_top); GetObject(iciTop.hbmMask,sizeof(BITMAP),&bmp_top_mask); - if (bmp_bottom.bmBitsPixel == 32 &&bmp_top.bmBitsPixel == 32 && IsWinVerXPPlus()) + if (bmp_bottom.bmBitsPixel == 32 && bmp_top.bmBitsPixel == 32 && IsWinVerXPPlus()) { BYTE * BottomBuffer, * TopBuffer, * BottomMaskBuffer, * TopMaskBuffer; BYTE * bb, * tb, * bmb, * tmb; diff --git a/plugins/Clist_modern/modern_skinopt.cpp b/plugins/Clist_modern/modern_skinopt.cpp index 13f68037d7..9cdc929fc7 100644 --- a/plugins/Clist_modern/modern_skinopt.cpp +++ b/plugins/Clist_modern/modern_skinopt.cpp @@ -323,7 +323,7 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara NMTREEVIEW * nmtv = ( NMTREEVIEW * ) lParam; if ( !nmtv ) return 0; if ( nmtv->hdr.code == TVN_SELCHANGEDA - || nmtv->hdr.code == TVN_SELCHANGEDW ) + || nmtv->hdr.code == TVN_SELCHANGEDW ) { SkinListData * sd = NULL; if ( hPreviewBitmap ) @@ -458,7 +458,7 @@ int SearchSkinFiles( HWND hwndDlg, TCHAR * Folder ) hFile = _tfindfirst( mask, &fd ); { do { - if ( fd.attrib&_A_SUBDIR && !( _tcsicmp( fd.name, _T(".")) == 0 ||_tcsicmp( fd.name, _T("..")) == 0 )) + if ( fd.attrib&_A_SUBDIR && !( _tcsicmp( fd.name, _T(".")) == 0 || _tcsicmp( fd.name, _T("..")) == 0 )) {//Next level of subfolders TCHAR path[MAX_PATH]; _sntprintf( path, SIZEOF( path ), _T("%s\\%s"), Folder, fd.name ); @@ -664,25 +664,12 @@ HTREEITEM AddItemToTree( HWND hTree, TCHAR * folder, TCHAR * itemName, void * da return 0; } - - - - - - - - - - - - INT_PTR SvcActiveSkin(WPARAM wParam, LPARAM lParam) { TCHAR *skinfile; TCHAR skinfull[MAX_PATH]; skinfile = DBGetStringT( NULL, SKIN, "SkinFile" ); - if ( skinfile ) - { + if ( skinfile ) { CallService( MS_UTILS_PATHTOABSOLUTET, ( WPARAM )skinfile, ( LPARAM )skinfull ); mir_free(skinfile); return (INT_PTR)mir_tstrdup(skinfull); diff --git a/plugins/Clist_modern/modern_skinselector.cpp b/plugins/Clist_modern/modern_skinselector.cpp index 770ae4ae8d..3b4f00ba23 100644 --- a/plugins/Clist_modern/modern_skinselector.cpp +++ b/plugins/Clist_modern/modern_skinselector.cpp @@ -235,7 +235,7 @@ int ClearMaskList(LISTMODERNMASK * mmTemplateList) int DeleteMaskByItID(DWORD mID,LISTMODERNMASK * mmTemplateList) { if (!mmTemplateList) return -1; - if (mID < 0|| mID >= mmTemplateList->dwMaskCnt) return -1; + if (mID < 0 || mID >= mmTemplateList->dwMaskCnt) return -1; if (mmTemplateList->dwMaskCnt == 1) { SkinSelector_DeleteMask(&(mmTemplateList->pl_Masks[0])); @@ -266,8 +266,8 @@ int DeleteMaskByItID(DWORD mID,LISTMODERNMASK * mmTemplateList) int ExchangeMasksByID(DWORD mID1, DWORD mID2, LISTMODERNMASK * mmTemplateList) { if (!mmTemplateList) return 0; - if (mID1 < 0|| mID1 >= mmTemplateList->dwMaskCnt) return 0; - if (mID2 < 0|| mID2 >= mmTemplateList->dwMaskCnt) return 0; + if (mID1 < 0 || mID1 >= mmTemplateList->dwMaskCnt) return 0; + if (mID2 < 0 || mID2 >= mmTemplateList->dwMaskCnt) return 0; if (mID1 == mID2) return 0; { MODERNMASK mm; diff --git a/plugins/Clist_modern/modern_statusbar.cpp b/plugins/Clist_modern/modern_statusbar.cpp index 391ea24465..a147d1b955 100644 --- a/plugins/Clist_modern/modern_statusbar.cpp +++ b/plugins/Clist_modern/modern_statusbar.cpp @@ -477,7 +477,7 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) if ( ( ProtosData[i].showProtoName) || (ProtosData[i].showProtoEmails && ProtosData[i].ProtoEMailCount ) || - (ProtosData[i].showStatusName) || + (ProtosData[i].showStatusName) || ((ProtosData[i].xStatusMode&8) && ProtosData[i].ProtoXStatus)) w -= spaceWidth; @@ -570,7 +570,7 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) } if (hIcon == NULL && (hxIcon == NULL || (((ProtosData[i].xStatusMode)&3) == 3))) { - if (hIcon == NULL && (ProtosData[i].connectingIcon == 1) && ProtosData[i].ProtoStatus >= ID_STATUS_CONNECTING&&ProtosData[i].ProtoStatus <= ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES) + if (hIcon == NULL && (ProtosData[i].connectingIcon == 1) && ProtosData[i].ProtoStatus >= ID_STATUS_CONNECTING && ProtosData[i].ProtoStatus <= ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES) { hIcon = (HICON)CLUI_GetConnectingIconService((WPARAM)ProtosData[i].AccountName,0); if (hIcon) NeedDestroy = TRUE; @@ -613,12 +613,12 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) mod_DrawIconEx_helper(hDC,x+GetSystemMetrics(SM_CXSMICON)+1,iconY,hxIcon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL|dim); x += GetSystemMetrics(SM_CXSMICON)+1; } - ProtosData[i].DoubleIcons = hIcon&&hxIcon; + ProtosData[i].DoubleIcons = hIcon && hxIcon; } else { if (hxIcon) mod_DrawIconEx_helper(hDC,x,iconY,hxIcon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL|dim); - if (hIcon) mod_DrawIconEx_helper(hDC,x,iconY,hIcon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL| ((hxIcon&&(ProtosData[i].xStatusMode&4))?(192 << 24):0 ) | dim ); + if (hIcon) mod_DrawIconEx_helper(hDC,x,iconY,hIcon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL| ((hxIcon && (ProtosData[i].xStatusMode&4))?(192 << 24):0 ) | dim ); } if ( ( hxIcon || hIcon) && TRUE /* TODO g_StatusBarData.bDrawLockOverlay options to draw locked proto*/ ) @@ -889,7 +889,7 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam POINT pt; KillTimer(hwnd,TM_STATUSBAR); GetCursorPos(&pt); - if (pt.x == lastpnt.x&&pt.y == lastpnt.y) + if (pt.x == lastpnt.x && pt.y == lastpnt.y) { int i; RECT rc; @@ -934,7 +934,7 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam POINT pt; GetCursorPos(&pt); SendMessage(GetParent(hwnd),msg,wParam,lParam); - if (pt.x == lastpnt.x&&pt.y == lastpnt.y) + if (pt.x == lastpnt.x && pt.y == lastpnt.y) { return(CLUI_TestCursorOnBorders()); }; @@ -978,7 +978,7 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam rc1 = rc; rc1.left = rc.left+16; rc1.right = rc1.left+16; - if (PtInRect(&rc,pt) && PtInRect(&rc1,pt)&&ProtosData[i].DoubleIcons) + if (PtInRect(&rc,pt) && PtInRect(&rc1,pt) && ProtosData[i].DoubleIcons) isOnExtra = TRUE; if (PtInRect(&rc,pt)) { diff --git a/plugins/Clist_modern/modern_statusbar_options.cpp b/plugins/Clist_modern/modern_statusbar_options.cpp index a70fa2387c..4f6c1072ce 100644 --- a/plugins/Clist_modern/modern_statusbar_options.cpp +++ b/plugins/Clist_modern/modern_statusbar_options.cpp @@ -39,7 +39,8 @@ typedef struct _StatusBarProtocolOptions BYTE ShowXStatus; int PaddingLeft; int PaddingRight; -} StatusBarProtocolOptions; +} + StatusBarProtocolOptions; static StatusBarProtocolOptions _GlobalOptions = {0}; @@ -51,29 +52,22 @@ static void UpdateXStatusIconOptions(HWND hwndDlg, BOOL perProto, StatusBarProto EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWBOTH),en && IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS) && !IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL)); if (IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL)) CheckDlgButton(hwndDlg,IDC_SHOWBOTH,FALSE); - EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWNORMAL),en && IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS)&& !IsDlgButtonChecked(hwndDlg,IDC_SHOWBOTH)); + EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWNORMAL),en && IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS) && !IsDlgButtonChecked(hwndDlg,IDC_SHOWBOTH)); - EnableWindow(GetDlgItem(hwndDlg,IDC_TRANSPARENTOVERLAY),en && IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS) && IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL)&& !IsDlgButtonChecked(hwndDlg,IDC_SHOWBOTH)); + EnableWindow(GetDlgItem(hwndDlg,IDC_TRANSPARENTOVERLAY),en && IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS) && IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL) && !IsDlgButtonChecked(hwndDlg,IDC_SHOWBOTH)); - { - BYTE val = 0; - if (IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS)) - { - if (IsDlgButtonChecked(hwndDlg,IDC_SHOWBOTH)) val = 3; - else if (IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL)) val = 2; - else val = 1; - val += IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENTOVERLAY)?4:0; - } - val += IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUSNAME)?8:0; - if (perProto) - { - dat[curSelProto].ShowXStatus = val; - } - else - { - _GlobalOptions.ShowXStatus = val; - } + BYTE val = 0; + if (IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS)) { + if (IsDlgButtonChecked(hwndDlg,IDC_SHOWBOTH)) val = 3; + else if (IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL)) val = 2; + else val = 1; + val += IsDlgButtonChecked(hwndDlg,IDC_TRANSPARENTOVERLAY)?4:0; } + val += IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUSNAME)?8:0; + if (perProto) + dat[curSelProto].ShowXStatus = val; + else + _GlobalOptions.ShowXStatus = val; } static void UpdateStatusBarOptionsDisplay(HWND hwndDlg) @@ -87,23 +81,15 @@ static void UpdateStatusBarOptionsDisplay(HWND hwndDlg) perProto = FALSE; if (perProto) - { sbpo = dat[curSelProto]; - } else - { sbpo = _GlobalOptions; - } - if (perProto) - { + if (perProto) { EnableWindow(GetDlgItem(hwndDlg, IDC_SBAR_USE_ACCOUNT_SETTINGS), TRUE); CheckDlgButton(hwndDlg, IDC_SBAR_USE_ACCOUNT_SETTINGS, sbpo.AccountIsCustomized ? BST_CHECKED : BST_UNCHECKED); } - else - { - EnableWindow(GetDlgItem(hwndDlg, IDC_SBAR_USE_ACCOUNT_SETTINGS), FALSE); - } + else EnableWindow(GetDlgItem(hwndDlg, IDC_SBAR_USE_ACCOUNT_SETTINGS), FALSE); CheckDlgButton(hwndDlg, IDC_SBAR_HIDE_ACCOUNT_COMPLETELY, sbpo.HideAccount ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_USECONNECTINGICON, sbpo.UseConnectingIcon ? BST_CHECKED : BST_UNCHECKED); @@ -139,8 +125,7 @@ static void UpdateStatusBarOptionsDisplay(HWND hwndDlg) EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWXSTATUSNAME), enableOptions); EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWXSTATUS), enableOptions && enableIcons); - if (!enableOptions) - { + if (!enableOptions) { EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWNORMAL), enableOptions && enableIcons); EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWBOTH), enableOptions && enableIcons ); EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSPARENTOVERLAY), enableOptions && enableIcons); @@ -162,7 +147,7 @@ static void UpdateStatusBarOptionsDisplay(HWND hwndDlg) UpdateXStatusIconOptions(hwndDlg, perProto, dat, curSelProto); } - INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { StatusBarProtocolOptions *dat = (StatusBarProtocolOptions*)GetWindowLongPtr(GetDlgItem(hwndDlg,IDC_STATUSBAR_PROTO_LIST),GWLP_USERDATA); LOGFONTA lf; @@ -172,173 +157,163 @@ static void UpdateStatusBarOptionsDisplay(HWND hwndDlg) if (curSelProto < 0) perProto = FALSE; - switch (msg) - { - case WM_DESTROY: - mir_free(dat); - break; + switch (msg) { case WM_INITDIALOG: - { - perProto = (BOOL)db_get_b(NULL,"CLUI","SBarPerProto",SETTING_SBARPERPROTO_DEFAULT); - - TranslateDialogDefault(hwndDlg); + perProto = (BOOL)db_get_b(NULL,"CLUI","SBarPerProto",SETTING_SBARPERPROTO_DEFAULT); - CheckDlgButton(hwndDlg, IDC_SHOWSBAR, db_get_b(NULL,"CLUI","ShowSBar",SETTING_SHOWSBAR_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_STATUSBAR_PER_PROTO, perProto ? BST_CHECKED : BST_UNCHECKED); + TranslateDialogDefault(hwndDlg); + CheckDlgButton(hwndDlg, IDC_SHOWSBAR, db_get_b(NULL,"CLUI","ShowSBar",SETTING_SHOWSBAR_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_STATUSBAR_PER_PROTO, perProto ? BST_CHECKED : BST_UNCHECKED); + { + // populate per-proto list box. + char *szName; + char buf[256]; + int count; - { // populate per-proto list box. - char *szName; - char buf[256]; - int i,count; - - SendMessage(hwndComboBox, CB_RESETCONTENT, 0, 0); + SendMessage(hwndComboBox, CB_RESETCONTENT, 0, 0); - PROTOACCOUNT **accs; - ProtoEnumAccounts( &count, &accs ); + PROTOACCOUNT **accs; + ProtoEnumAccounts( &count, &accs ); - dat = (StatusBarProtocolOptions*)mir_alloc(sizeof(StatusBarProtocolOptions)*count); - SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_STATUSBAR_PROTO_LIST),GWLP_USERDATA,(LONG_PTR)dat); + dat = (StatusBarProtocolOptions*)mir_alloc(sizeof(StatusBarProtocolOptions)*count); + SetWindowLongPtr(GetDlgItem(hwndDlg,IDC_STATUSBAR_PROTO_LIST),GWLP_USERDATA,(LONG_PTR)dat); - SendMessage(hwndComboBox, CB_ADDSTRING, 0, (LPARAM)TranslateT( " << Global>>" )); - SendMessage(hwndComboBox, CB_SETITEMDATA, 0, (LPARAM)0); + SendMessage(hwndComboBox, CB_ADDSTRING, 0, (LPARAM)TranslateT( " << Global>>" )); + SendMessage(hwndComboBox, CB_SETITEMDATA, 0, (LPARAM)0); - for ( i=0; i < count; i++ ) - { - szName = accs[i]->szModuleName; - dat[i].szName = szName; + for (int i=0; i < count; i++ ) { + szName = accs[i]->szModuleName; + dat[i].szName = szName; - DWORD dwNewId = SendMessage(hwndComboBox, CB_ADDSTRING, 0, (LPARAM)accs[i]->tszAccountName); - SendMessage(hwndComboBox, CB_SETITEMDATA, dwNewId, (LPARAM)(i+1)); + DWORD dwNewId = SendMessage(hwndComboBox, CB_ADDSTRING, 0, (LPARAM)accs[i]->tszAccountName); + SendMessage(hwndComboBox, CB_SETITEMDATA, dwNewId, (LPARAM)(i+1)); - mir_snprintf(buf, SIZEOF(buf), "SBarAccountIsCustom_%s", szName); - dat[i].AccountIsCustomized = db_get_b(NULL,"CLUI", buf, SETTING_SBARACCOUNTISCUSTOM_DEFAULT); + mir_snprintf(buf, SIZEOF(buf), "SBarAccountIsCustom_%s", szName); + dat[i].AccountIsCustomized = db_get_b(NULL,"CLUI", buf, SETTING_SBARACCOUNTISCUSTOM_DEFAULT); - mir_snprintf(buf, SIZEOF(buf), "HideAccount_%s", szName); - dat[i].HideAccount = db_get_b(NULL,"CLUI", buf, SETTING_SBARHIDEACCOUNT_DEFAULT); + mir_snprintf(buf, SIZEOF(buf), "HideAccount_%s", szName); + dat[i].HideAccount = db_get_b(NULL,"CLUI", buf, SETTING_SBARHIDEACCOUNT_DEFAULT); - mir_snprintf(buf, SIZEOF(buf), "SBarShow_%s", szName); - dat[i].SBarShow = db_get_b(NULL,"CLUI", buf, SETTING_SBARSHOW_DEFAULT); + mir_snprintf(buf, SIZEOF(buf), "SBarShow_%s", szName); + dat[i].SBarShow = db_get_b(NULL,"CLUI", buf, SETTING_SBARSHOW_DEFAULT); - mir_snprintf(buf, SIZEOF(buf), "SBarRightClk_%s", szName); - dat[i].SBarRightClk = db_get_b(NULL,"CLUI", buf, SETTING_SBARRIGHTCLK_DEFAULT); + mir_snprintf(buf, SIZEOF(buf), "SBarRightClk_%s", szName); + dat[i].SBarRightClk = db_get_b(NULL,"CLUI", buf, SETTING_SBARRIGHTCLK_DEFAULT); - mir_snprintf(buf, SIZEOF(buf), "ShowUnreadEmails_%s", szName); - dat[i].ShowUnreadEmails = db_get_b(NULL,"CLUI", buf, SETTING_SHOWUNREADEMAILS_DEFAULT); + mir_snprintf(buf, SIZEOF(buf), "ShowUnreadEmails_%s", szName); + dat[i].ShowUnreadEmails = db_get_b(NULL,"CLUI", buf, SETTING_SHOWUNREADEMAILS_DEFAULT); - mir_snprintf(buf, SIZEOF(buf), "ShowXStatus_%s", szName); - dat[i].ShowXStatus = db_get_b(NULL,"CLUI", buf, SETTING_SHOWXSTATUS_DEFAULT); + mir_snprintf(buf, SIZEOF(buf), "ShowXStatus_%s", szName); + dat[i].ShowXStatus = db_get_b(NULL,"CLUI", buf, SETTING_SHOWXSTATUS_DEFAULT); - mir_snprintf(buf, SIZEOF(buf), "UseConnectingIcon_%s", szName); - dat[i].UseConnectingIcon = db_get_b(NULL,"CLUI", buf, SETTING_USECONNECTINGICON_DEFAULT); + mir_snprintf(buf, SIZEOF(buf), "UseConnectingIcon_%s", szName); + dat[i].UseConnectingIcon = db_get_b(NULL,"CLUI", buf, SETTING_USECONNECTINGICON_DEFAULT); - mir_snprintf(buf, SIZEOF(buf), "PaddingLeft_%s", szName); - dat[i].PaddingLeft = db_get_dw(NULL,"CLUI", buf, SETTING_PADDINGLEFT_DEFAULT); + mir_snprintf(buf, SIZEOF(buf), "PaddingLeft_%s", szName); + dat[i].PaddingLeft = db_get_dw(NULL,"CLUI", buf, SETTING_PADDINGLEFT_DEFAULT); - mir_snprintf(buf, SIZEOF(buf), "PaddingRight_%s", szName); - dat[i].PaddingRight = db_get_dw(NULL,"CLUI", buf, SETTING_PADDINGRIGHT_DEFAULT); - } - - if (count) - { - SendMessage(hwndComboBox, CB_SETCURSEL, 0, 0); - } + mir_snprintf(buf, SIZEOF(buf), "PaddingRight_%s", szName); + dat[i].PaddingRight = db_get_dw(NULL,"CLUI", buf, SETTING_PADDINGRIGHT_DEFAULT); } - _GlobalOptions.AccountIsCustomized = TRUE; - _GlobalOptions.SBarRightClk = db_get_b(NULL,"CLUI", "SBarRightClk", SETTING_SBARRIGHTCLK_DEFAULT); - _GlobalOptions.ShowUnreadEmails = db_get_b(NULL,"CLUI", "ShowUnreadEmails", SETTING_SHOWUNREADEMAILS_DEFAULT); - _GlobalOptions.ShowXStatus = db_get_b(NULL,"CLUI", "ShowXStatus", SETTING_SHOWXSTATUS_DEFAULT); - _GlobalOptions.UseConnectingIcon = db_get_b(NULL,"CLUI", "UseConnectingIcon", SETTING_USECONNECTINGICON_DEFAULT); - _GlobalOptions.SBarShow = db_get_b(NULL,"CLUI","SBarShow",SETTING_SBARSHOW_DEFAULT); + if (count) + SendMessage(hwndComboBox, CB_SETCURSEL, 0, 0); + } - CheckDlgButton(hwndDlg, IDC_EQUALSECTIONS, db_get_b(NULL,"CLUI","EqualSections",SETTING_EQUALSECTIONS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); + _GlobalOptions.AccountIsCustomized = TRUE; + _GlobalOptions.SBarRightClk = db_get_b(NULL,"CLUI", "SBarRightClk", SETTING_SBARRIGHTCLK_DEFAULT); + _GlobalOptions.ShowUnreadEmails = db_get_b(NULL,"CLUI", "ShowUnreadEmails", SETTING_SHOWUNREADEMAILS_DEFAULT); + _GlobalOptions.ShowXStatus = db_get_b(NULL,"CLUI", "ShowXStatus", SETTING_SHOWXSTATUS_DEFAULT); + _GlobalOptions.UseConnectingIcon = db_get_b(NULL,"CLUI", "UseConnectingIcon", SETTING_USECONNECTINGICON_DEFAULT); + _GlobalOptions.SBarShow = db_get_b(NULL,"CLUI","SBarShow",SETTING_SBARSHOW_DEFAULT); - SendDlgItemMessage(hwndDlg,IDC_MULTI_SPIN,UDM_SETRANGE,0,MAKELONG(50,0)); - SendDlgItemMessage(hwndDlg,IDC_MULTI_SPIN,UDM_SETPOS,0,MAKELONG(db_get_b(NULL,"CLUI","StatusBarProtosPerLine",SETTING_PROTOSPERLINE_DEFAULT),0)); + CheckDlgButton(hwndDlg, IDC_EQUALSECTIONS, db_get_b(NULL,"CLUI","EqualSections",SETTING_EQUALSECTIONS_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); - SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN,UDM_SETRANGE,0,MAKELONG(50,0)); - SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN,UDM_SETPOS,0,MAKELONG(db_get_dw(NULL,"CLUI","LeftOffset",SETTING_LEFTOFFSET_DEFAULT),0)); + SendDlgItemMessage(hwndDlg,IDC_MULTI_SPIN,UDM_SETRANGE,0,MAKELONG(50,0)); + SendDlgItemMessage(hwndDlg,IDC_MULTI_SPIN,UDM_SETPOS,0,MAKELONG(db_get_b(NULL,"CLUI","StatusBarProtosPerLine",SETTING_PROTOSPERLINE_DEFAULT),0)); - SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN2,UDM_SETRANGE,0,MAKELONG(50,0)); - SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN2,UDM_SETPOS,0,MAKELONG(db_get_dw(NULL,"CLUI","RightOffset",SETTING_RIGHTOFFSET_DEFAULT),0)); + SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN,UDM_SETRANGE,0,MAKELONG(50,0)); + SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN,UDM_SETPOS,0,MAKELONG(db_get_dw(NULL,"CLUI","LeftOffset",SETTING_LEFTOFFSET_DEFAULT),0)); - SendDlgItemMessage(hwndDlg,IDC_SBAR_BORDER_TOP_SPIN,UDM_SETRANGE,0,MAKELONG(50,0)); - SendDlgItemMessage(hwndDlg,IDC_SBAR_BORDER_TOP_SPIN,UDM_SETPOS,0,MAKELONG(db_get_dw(NULL,"CLUI","TopOffset",SETTING_TOPOFFSET_DEFAULT),0)); + SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN2,UDM_SETRANGE,0,MAKELONG(50,0)); + SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN2,UDM_SETPOS,0,MAKELONG(db_get_dw(NULL,"CLUI","RightOffset",SETTING_RIGHTOFFSET_DEFAULT),0)); - SendDlgItemMessage(hwndDlg,IDC_SBAR_BORDER_BOTTOM_SPIN,UDM_SETRANGE,0,MAKELONG(50,0)); - SendDlgItemMessage(hwndDlg,IDC_SBAR_BORDER_BOTTOM_SPIN,UDM_SETPOS,0,MAKELONG(db_get_dw(NULL,"CLUI","BottomOffset",SETTING_BOTTOMOFFSET_DEFAULT),0)); + SendDlgItemMessage(hwndDlg,IDC_SBAR_BORDER_TOP_SPIN,UDM_SETRANGE,0,MAKELONG(50,0)); + SendDlgItemMessage(hwndDlg,IDC_SBAR_BORDER_TOP_SPIN,UDM_SETPOS,0,MAKELONG(db_get_dw(NULL,"CLUI","TopOffset",SETTING_TOPOFFSET_DEFAULT),0)); - SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN3,UDM_SETRANGE,0,MAKELONG(50,0)); - SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN3,UDM_SETPOS,0,MAKELONG(db_get_dw(NULL,"CLUI","SpaceBetween",SETTING_SPACEBETWEEN_DEFAULT),2)); + SendDlgItemMessage(hwndDlg,IDC_SBAR_BORDER_BOTTOM_SPIN,UDM_SETRANGE,0,MAKELONG(50,0)); + SendDlgItemMessage(hwndDlg,IDC_SBAR_BORDER_BOTTOM_SPIN,UDM_SETPOS,0,MAKELONG(db_get_dw(NULL,"CLUI","BottomOffset",SETTING_BOTTOMOFFSET_DEFAULT),0)); - { - int i, item; - TCHAR *align[] = {_T("Left"), _T("Center"), _T("Right")}; - for (i=0; i < SIZEOF(align); i++) { - item = SendDlgItemMessage(hwndDlg,IDC_SBAR_HORIZ_ALIGN,CB_ADDSTRING,0,(LPARAM)TranslateTS(align[i])); - } + SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN3,UDM_SETRANGE,0,MAKELONG(50,0)); + SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN3,UDM_SETPOS,0,MAKELONG(db_get_dw(NULL,"CLUI","SpaceBetween",SETTING_SPACEBETWEEN_DEFAULT),2)); - SendDlgItemMessage(hwndDlg, IDC_SBAR_HORIZ_ALIGN, CB_SETCURSEL, db_get_b(NULL, "CLUI", "Align", SETTING_ALIGN_DEFAULT), 0); + { + int i, item; + TCHAR *align[] = {_T("Left"), _T("Center"), _T("Right")}; + for (i=0; i < SIZEOF(align); i++) { + item = SendDlgItemMessage(hwndDlg,IDC_SBAR_HORIZ_ALIGN,CB_ADDSTRING,0,(LPARAM)TranslateTS(align[i])); } - { - int i, item; - TCHAR *align[] = {_T("Top"), _T("Center"), _T("Bottom")}; - for (i=0; i < SIZEOF(align); i++) { - item = SendDlgItemMessage(hwndDlg,IDC_SBAR_VERT_ALIGN,CB_ADDSTRING,0,(LPARAM)TranslateTS(align[i])); - } + SendDlgItemMessage(hwndDlg, IDC_SBAR_HORIZ_ALIGN, CB_SETCURSEL, db_get_b(NULL, "CLUI", "Align", SETTING_ALIGN_DEFAULT), 0); + } - SendDlgItemMessage(hwndDlg, IDC_SBAR_VERT_ALIGN, CB_SETCURSEL, db_get_b(NULL, "CLUI", "VAlign", SETTING_VALIGN_DEFAULT), 0); + { + int i, item; + TCHAR *align[] = {_T("Top"), _T("Center"), _T("Bottom")}; + for (i=0; i < SIZEOF(align); i++) { + item = SendDlgItemMessage(hwndDlg,IDC_SBAR_VERT_ALIGN,CB_ADDSTRING,0,(LPARAM)TranslateTS(align[i])); } - { - int en = IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR); - int en_icons = IsDlgButtonChecked(hwndDlg,IDC_SHOWICON ); - - EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWICON),en); - EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWPROTO),en); - EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWSTATUS),en); - EnableWindow(GetDlgItem(hwndDlg,IDC_RIGHTSTATUS),en); - EnableWindow(GetDlgItem(hwndDlg,IDC_RIGHTMIRANDA),en); - EnableWindow(GetDlgItem(hwndDlg,IDC_EQUALSECTIONS),en); - EnableWindow(GetDlgItem(hwndDlg,IDC_USECONNECTINGICON),en && en_icons); - EnableWindow(GetDlgItem(hwndDlg,IDC_USEOWNERDRAW),en); - EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETSPIN),en); - EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETICON),en); - EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETSPIN2),en); - EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETICON2),en); - EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETSPIN3),en); - EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETICON3),en); - EnableWindow(GetDlgItem(hwndDlg,IDC_BUTTON_BROWSE),en); - EnableWindow(GetDlgItem(hwndDlg,IDC_SHOW_ONLY_IF_DIFFERENT),en); - EnableWindow(GetDlgItem(hwndDlg,IDC_COLOUR),en); - EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWXSTATUSNAME),en); - EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWXSTATUS),en && en_icons); - EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWBOTH),en && en_icons && IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS) && !IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL)); - EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWNORMAL),en && en_icons && IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS)&& !IsDlgButtonChecked(hwndDlg,IDC_SHOWBOTH)); - EnableWindow(GetDlgItem(hwndDlg,IDC_TRANSPARENTOVERLAY),en && en_icons && IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS) && IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL)&& !IsDlgButtonChecked(hwndDlg,IDC_SHOWBOTH)); - EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWUNREADEMAIL),en); - - EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETICON_LEFT),en); - EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETSPIN_LEFT),en); - EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETICON_RIGHT),en); - EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETSPIN_RIGHT),en); - - EnableWindow(GetDlgItem(hwndDlg,IDC_MULTI),en); - EnableWindow(GetDlgItem(hwndDlg,IDC_MULTI_2),en); - EnableWindow(GetDlgItem(hwndDlg,IDC_MULTI_COUNT),en); - EnableWindow(GetDlgItem(hwndDlg,IDC_MULTI_SPIN),en); - - EnableWindow(GetDlgItem(hwndDlg,IDC_STATUSBAR_PER_PROTO),en); - EnableWindow(GetDlgItem(hwndDlg, IDC_STATUSBAR_PROTO_LIST), en && IsDlgButtonChecked(hwndDlg, IDC_STATUSBAR_PER_PROTO)); - EnableWindow(GetDlgItem(hwndDlg, IDC_SBAR_USE_ACCOUNT_SETTINGS), FALSE); - } + SendDlgItemMessage(hwndDlg, IDC_SBAR_VERT_ALIGN, CB_SETCURSEL, db_get_b(NULL, "CLUI", "VAlign", SETTING_VALIGN_DEFAULT), 0); + } - UpdateStatusBarOptionsDisplay(hwndDlg); + { + int en = IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR); + int en_icons = IsDlgButtonChecked(hwndDlg,IDC_SHOWICON ); - return TRUE; + EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWICON),en); + EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWPROTO),en); + EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWSTATUS),en); + EnableWindow(GetDlgItem(hwndDlg,IDC_RIGHTSTATUS),en); + EnableWindow(GetDlgItem(hwndDlg,IDC_RIGHTMIRANDA),en); + EnableWindow(GetDlgItem(hwndDlg,IDC_EQUALSECTIONS),en); + EnableWindow(GetDlgItem(hwndDlg,IDC_USECONNECTINGICON),en && en_icons); + EnableWindow(GetDlgItem(hwndDlg,IDC_USEOWNERDRAW),en); + EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETSPIN),en); + EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETICON),en); + EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETSPIN2),en); + EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETICON2),en); + EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETSPIN3),en); + EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETICON3),en); + EnableWindow(GetDlgItem(hwndDlg,IDC_BUTTON_BROWSE),en); + EnableWindow(GetDlgItem(hwndDlg,IDC_SHOW_ONLY_IF_DIFFERENT),en); + EnableWindow(GetDlgItem(hwndDlg,IDC_COLOUR),en); + EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWXSTATUSNAME),en); + EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWXSTATUS),en && en_icons); + EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWBOTH),en && en_icons && IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS) && !IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL)); + EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWNORMAL),en && en_icons && IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS) && !IsDlgButtonChecked(hwndDlg,IDC_SHOWBOTH)); + EnableWindow(GetDlgItem(hwndDlg,IDC_TRANSPARENTOVERLAY),en && en_icons && IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS) && IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL) && !IsDlgButtonChecked(hwndDlg,IDC_SHOWBOTH)); + EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWUNREADEMAIL),en); + + EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETICON_LEFT),en); + EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETSPIN_LEFT),en); + EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETICON_RIGHT),en); + EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETSPIN_RIGHT),en); + + EnableWindow(GetDlgItem(hwndDlg,IDC_MULTI),en); + EnableWindow(GetDlgItem(hwndDlg,IDC_MULTI_2),en); + EnableWindow(GetDlgItem(hwndDlg,IDC_MULTI_COUNT),en); + EnableWindow(GetDlgItem(hwndDlg,IDC_MULTI_SPIN),en); + + EnableWindow(GetDlgItem(hwndDlg,IDC_STATUSBAR_PER_PROTO),en); + EnableWindow(GetDlgItem(hwndDlg, IDC_STATUSBAR_PROTO_LIST), en && IsDlgButtonChecked(hwndDlg, IDC_STATUSBAR_PER_PROTO)); + EnableWindow(GetDlgItem(hwndDlg, IDC_SBAR_USE_ACCOUNT_SETTINGS), FALSE); } + + UpdateStatusBarOptionsDisplay(hwndDlg); + return TRUE; + case WM_COMMAND: if (LOWORD(wParam) == IDC_BUTTON1) { @@ -355,7 +330,7 @@ static void UpdateStatusBarOptionsDisplay(HWND hwndDlg) return 0; } } - else if (LOWORD(wParam) == IDC_COLOUR ||(LOWORD(wParam) == IDC_SBAR_HORIZ_ALIGN && HIWORD(wParam) == CBN_SELCHANGE)) SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0); + else if (LOWORD(wParam) == IDC_COLOUR || (LOWORD(wParam) == IDC_SBAR_HORIZ_ALIGN && HIWORD(wParam) == CBN_SELCHANGE)) SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0); else if (LOWORD(wParam) == IDC_SHOWSBAR) { int en = IsDlgButtonChecked(hwndDlg,IDC_SHOWSBAR); int en_icons = IsDlgButtonChecked(hwndDlg,IDC_SHOWICON ); @@ -384,15 +359,6 @@ static void UpdateStatusBarOptionsDisplay(HWND hwndDlg) EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWXSTATUS),en && en_icons); EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWUNREADEMAIL),en); -// EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWBOTH),en && IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS) && !IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL)); -// EnableWindow(GetDlgItem(hwndDlg,IDC_SHOWNORMAL),en && IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS)&& !IsDlgButtonChecked(hwndDlg,IDC_SHOWBOTH)); -// EnableWindow(GetDlgItem(hwndDlg,IDC_TRANSPARENTOVERLAY),en && IsDlgButtonChecked(hwndDlg,IDC_SHOWXSTATUS) && IsDlgButtonChecked(hwndDlg,IDC_SHOWNORMAL)&& !IsDlgButtonChecked(hwndDlg,IDC_SHOWBOTH)); - -// EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETICON_LEFT),en); -// EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETSPIN_LEFT),en); -// EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETICON_RIGHT),en); -// EnableWindow(GetDlgItem(hwndDlg,IDC_OFFSETSPIN_RIGHT),en); - EnableWindow(GetDlgItem(hwndDlg,IDC_MULTI),en); EnableWindow(GetDlgItem(hwndDlg,IDC_MULTI_2),en); EnableWindow(GetDlgItem(hwndDlg,IDC_MULTI_COUNT),en); @@ -418,10 +384,10 @@ static void UpdateStatusBarOptionsDisplay(HWND hwndDlg) SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0); } else if ( - LOWORD(wParam) == IDC_SHOWXSTATUS || - LOWORD(wParam) == IDC_SHOWBOTH || - LOWORD(wParam) == IDC_SHOWNORMAL || - LOWORD(wParam) == IDC_TRANSPARENTOVERLAY || + LOWORD(wParam) == IDC_SHOWXSTATUS || + LOWORD(wParam) == IDC_SHOWBOTH || + LOWORD(wParam) == IDC_SHOWNORMAL || + LOWORD(wParam) == IDC_TRANSPARENTOVERLAY || LOWORD(wParam) == IDC_SHOWXSTATUSNAME ) { @@ -429,102 +395,71 @@ static void UpdateStatusBarOptionsDisplay(HWND hwndDlg) } else if (LOWORD(wParam) == IDC_SBAR_USE_ACCOUNT_SETTINGS) { - if (perProto) - { + if (perProto) { dat[curSelProto].AccountIsCustomized = IsDlgButtonChecked(hwndDlg, IDC_SBAR_USE_ACCOUNT_SETTINGS); - UpdateStatusBarOptionsDisplay(hwndDlg); } } else if (LOWORD(wParam) == IDC_SBAR_HIDE_ACCOUNT_COMPLETELY) { if (perProto) - { dat[curSelProto].HideAccount = IsDlgButtonChecked(hwndDlg, IDC_SBAR_HIDE_ACCOUNT_COMPLETELY); - } } else if (LOWORD(wParam) == IDC_USECONNECTINGICON) { if (perProto) - { dat[curSelProto].UseConnectingIcon = IsDlgButtonChecked(hwndDlg, IDC_USECONNECTINGICON); - } else - { _GlobalOptions.UseConnectingIcon = IsDlgButtonChecked(hwndDlg, IDC_USECONNECTINGICON); - } } else if (LOWORD(wParam) == IDC_SHOWUNREADEMAIL) { if (perProto) - { dat[curSelProto].ShowUnreadEmails = IsDlgButtonChecked(hwndDlg, IDC_SHOWUNREADEMAIL); - } else - { _GlobalOptions.ShowUnreadEmails = IsDlgButtonChecked(hwndDlg, IDC_SHOWUNREADEMAIL); - } } - else if ( - LOWORD(wParam) == IDC_SHOWICON || - LOWORD(wParam) == IDC_SHOWPROTO || - LOWORD(wParam) == IDC_SHOWSTATUS - ) + else if (LOWORD(wParam) == IDC_SHOWICON || LOWORD(wParam) == IDC_SHOWPROTO || LOWORD(wParam) == IDC_SHOWSTATUS) { BYTE val = (IsDlgButtonChecked(hwndDlg, IDC_SHOWICON)?1:0)|(IsDlgButtonChecked(hwndDlg, IDC_SHOWPROTO)?2:0)|(IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUS)?4:0); if (perProto) - { dat[curSelProto].SBarShow = val; - } else - { _GlobalOptions.SBarShow = val; - } + UpdateStatusBarOptionsDisplay(hwndDlg); } else if (LOWORD(wParam) == IDC_RIGHTSTATUS || LOWORD(wParam) == IDC_RIGHTMIRANDA) { if (perProto) - { dat[curSelProto].SBarRightClk = IsDlgButtonChecked(hwndDlg,IDC_RIGHTMIRANDA); - } else - { _GlobalOptions.SBarRightClk = IsDlgButtonChecked(hwndDlg,IDC_RIGHTMIRANDA); - } } else if (LOWORD(wParam) == IDC_OFFSETICON_LEFT) { if (perProto) - { dat[curSelProto].PaddingLeft = (DWORD)SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN_LEFT,UDM_GETPOS,0,0); - } else - { _GlobalOptions.PaddingLeft = (DWORD)SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN_LEFT,UDM_GETPOS,0,0); - } } else if (LOWORD(wParam) == IDC_OFFSETICON_RIGHT) { if (perProto) - { dat[curSelProto].PaddingRight = (DWORD)SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN_RIGHT,UDM_GETPOS,0,0); - } else - { _GlobalOptions.PaddingRight = (DWORD)SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN_RIGHT,UDM_GETPOS,0,0); - } } else if ( ( - LOWORD(wParam) == IDC_MULTI_COUNT || - LOWORD(wParam) == IDC_OFFSETICON || - LOWORD(wParam) == IDC_OFFSETICON2 || - LOWORD(wParam) == IDC_OFFSETICON3 || - LOWORD(wParam) == IDC_SBAR_BORDER_BOTTOM || + LOWORD(wParam) == IDC_MULTI_COUNT || + LOWORD(wParam) == IDC_OFFSETICON || + LOWORD(wParam) == IDC_OFFSETICON2 || + LOWORD(wParam) == IDC_OFFSETICON3 || + LOWORD(wParam) == IDC_SBAR_BORDER_BOTTOM || LOWORD(wParam) == IDC_SBAR_BORDER_TOP ) && ( - HIWORD(wParam) != EN_CHANGE || + HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus() )) return 0; // dont make apply enabled during buddy set crap @@ -536,15 +471,13 @@ static void UpdateStatusBarOptionsDisplay(HWND hwndDlg) SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0); break; case WM_NOTIFY: - switch (((LPNMHDR)lParam)->code) - { + switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: { int count = db_get_dw(0,"Protocols","ProtoCount",-1); db_set_b(NULL, "CLUI", "SBarPerProto", IsDlgButtonChecked(hwndDlg, IDC_STATUSBAR_PER_PROTO)); - for (int i=0; i < count; i++) - { + for (int i=0; i < count; i++) { HWND hwndComboBox = GetDlgItem( hwndDlg, IDC_STATUSBAR_PROTO_LIST ); StatusBarProtocolOptions sbpo = dat[i]; char *defProto = sbpo.szName; @@ -599,6 +532,10 @@ static void UpdateStatusBarOptionsDisplay(HWND hwndDlg) } } break; + + case WM_DESTROY: + mir_free(dat); + break; } return FALSE; } diff --git a/plugins/Clist_modern/modern_tbbutton.cpp b/plugins/Clist_modern/modern_tbbutton.cpp index 3082ecf317..bdb09be349 100644 --- a/plugins/Clist_modern/modern_tbbutton.cpp +++ b/plugins/Clist_modern/modern_tbbutton.cpp @@ -431,7 +431,7 @@ static LRESULT CALLBACK TollbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam { LRESULT lr = SendMessage(GetParent(hwndDlg), WM_NCHITTEST, wParam, lParam); if (lr == HTLEFT || lr == HTRIGHT || lr == HTBOTTOM || lr == HTTOP || lr == HTTOPLEFT || lr == HTTOPRIGHT - || lr == HTBOTTOMLEFT || lr == HTBOTTOMRIGHT) + || lr == HTBOTTOMLEFT || lr == HTBOTTOMRIGHT) return HTTRANSPARENT; break; } @@ -638,7 +638,7 @@ static void PaintWorker(TBBUTTONDATA *lpSBData, HDC hdcPaint , POINT * pOffset) { HBRUSH hbr = NULL; - if (lpSBData->nStateId == PBS_PRESSED||lpSBData->nStateId == PBS_HOT) + if (lpSBData->nStateId == PBS_PRESSED || lpSBData->nStateId == PBS_HOT) hbr = GetSysColorBrush(COLOR_3DLIGHT); else { RECT btnRect; @@ -673,7 +673,7 @@ static void PaintWorker(TBBUTTONDATA *lpSBData, HDC hdcPaint , POINT * pOffset) FillRect(hdcMem, &rcClient, hbr); DeleteObject(hbr); } - if (lpSBData->nStateId == PBS_HOT||lpSBData->fFocused) { + if (lpSBData->nStateId == PBS_HOT || lpSBData->fFocused) { if (lpSBData->pbState) DrawEdge(hdcMem,&rcClient, EDGE_ETCHED,BF_RECT|BF_SOFT); else DrawEdge(hdcMem,&rcClient, BDR_RAISEDOUTER,BF_RECT|BF_SOFT|BF_FLAT); @@ -724,16 +724,16 @@ static void PaintWorker(TBBUTTONDATA *lpSBData, HDC hdcPaint , POINT * pOffset) { /* Check sizes*/ - if (hHasIcon && - (rcIcon.right>rcTemp.right || - rcIcon.bottom>rcTemp.bottom || - rcIcon.left < rcTemp.left || + if (hHasIcon && + (rcIcon.right>rcTemp.right || + rcIcon.bottom>rcTemp.bottom || + rcIcon.left < rcTemp.left || rcIcon.top < rcTemp.top)) hHasIcon = NULL; - if (fHasText && - (rcText.right>rcTemp.right || - rcText.bottom>rcTemp.bottom || - rcText.left < rcTemp.left || + if (fHasText && + (rcText.right>rcTemp.right || + rcText.bottom>rcTemp.bottom || + rcText.left < rcTemp.left || rcText.top < rcTemp.top)) fHasText = FALSE; } diff --git a/plugins/Clist_modern/modern_toolbar.cpp b/plugins/Clist_modern/modern_toolbar.cpp index 6e79d560b7..b71d7208c6 100644 --- a/plugins/Clist_modern/modern_toolbar.cpp +++ b/plugins/Clist_modern/modern_toolbar.cpp @@ -482,7 +482,7 @@ static int sttReposButtons(MTBINFO * mti) y += mti->nButtonHeight+mti->nButtonSpace; nextX = 0; if (mti->fSingleLine) break; - } while (iFirstButtonId < mti->pButtonList->realCount && y >= 0 &&(mti->fAutoSize || (y+mti->nButtonHeight <= rcClient.bottom-rcClient.top))); + } while (iFirstButtonId < mti->pButtonList->realCount && y >= 0 && (mti->fAutoSize || (y+mti->nButtonHeight <= rcClient.bottom-rcClient.top))); for (i = iFirstButtonId; i < mti->pButtonList->realCount; i++) { MTB_BUTTONINFO * mtbi = (MTB_BUTTONINFO *)mti->pButtonList->items[i]; @@ -496,14 +496,12 @@ static int sttReposButtons(MTBINFO * mti) } -static HWND sttCreateToolBarFrame( HWND hwndParent, char * szCaption, int nHeight ) +static HWND sttCreateToolBarFrame( HWND hwndParent, char * szCaption, int nHeight ) { - TCHAR * Caption = mir_a2t(szCaption); - HWND hwnd = CreateWindow(_T(MIRANDATOOLBARCLASSNAME), TranslateTS(Caption), WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN,0,0,0,nHeight,hwndParent,NULL,g_hInst, (void*) szCaption); - mir_free(Caption); - return hwnd; + return CreateWindow( _T(MIRANDATOOLBARCLASSNAME), TranslateTS( _A2T(szCaption)), WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN,0,0,0,nHeight,hwndParent,NULL,g_hInst, (void*) szCaption); } -static int sttButtonPressed(MTBINFO * pMTBInfo, HWND hwndbutton) + +static int sttButtonPressed(MTBINFO * pMTBInfo, HWND hwndbutton) { MTB_BUTTONINFO * mtbi = (MTB_BUTTONINFO *)GetWindowLongPtr(hwndbutton, GWLP_USERDATA); if (mtbi && mtbi->hWindow == hwndbutton && mtbi->hwndToolBar == pMTBInfo->hWnd) @@ -513,7 +511,8 @@ static int sttButtonPressed(MTBINFO * pMTBInfo, HWND hwndbutton) } return 0; } -static BOOL sttDrawToolBarBackground(HWND hwnd, HDC hdc, RECT * rect, MTBINFO * pMTBInfo) + +static BOOL sttDrawToolBarBackground(HWND hwnd, HDC hdc, RECT * rect, MTBINFO * pMTBInfo) { BOOL bFloat = (GetParent(hwnd) != pcli->hwndContactList); if (g_CluiData.fDisableSkinEngine || !g_CluiData.fLayered || bFloat) @@ -979,7 +978,7 @@ static LRESULT CALLBACK ToolBar_WndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM BOOL ret = FALSE; PAINTSTRUCT ps; BOOL bFloat = (GetParent(hwnd) != pcli->hwndContactList); - if (g_CluiData.fDisableSkinEngine|| !g_CluiData.fLayered || bFloat ) + if (g_CluiData.fDisableSkinEngine || !g_CluiData.fLayered || bFloat ) { BeginPaint(hwnd,&ps); if ((!g_CluiData.fLayered || bFloat) && !g_CluiData.fDisableSkinEngine) @@ -1290,7 +1289,7 @@ static LRESULT CALLBACK ToolBar_OptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,L tvi.mask = TVIF_HANDLE|TVIF_PARAM; tvi.hItem = (HTREEITEM)hDragItem; TreeView_GetItem(GetDlgItem(hwndDlg,IDC_BTNORDER),&tvi); - if (hti.flags&(TVHT_ONITEM|TVHT_ONITEMRIGHT)||(hti.hItem == TVI_FIRST)) + if (hti.flags&(TVHT_ONITEM|TVHT_ONITEMRIGHT) || (hti.hItem == TVI_FIRST)) { TVINSERTSTRUCT tvis; TCHAR name[128]; @@ -1320,9 +1319,9 @@ static LRESULT CALLBACK ToolBar_OptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,L } SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0); } else if ( (LOWORD(wParam) == IDC_TEXT_W || - LOWORD(wParam) == IDC_TEXT_H || + LOWORD(wParam) == IDC_TEXT_H || LOWORD(wParam) == IDC_TEXT_S ) - && HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return 0; // dont make apply enabled during buddy set crap + && HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()) return 0; // dont make apply enabled during buddy set crap SendMessage(GetParent(hwndDlg), PSM_CHANGED, (WPARAM)hwndDlg, 0); break; } diff --git a/plugins/Clist_modern/modern_viewmodebar.cpp b/plugins/Clist_modern/modern_viewmodebar.cpp index a81ccad076..13221b057d 100644 --- a/plugins/Clist_modern/modern_viewmodebar.cpp +++ b/plugins/Clist_modern/modern_viewmodebar.cpp @@ -338,12 +338,12 @@ static void SetIconsForColumn(HWND hwndList,HANDLE hItem,HANDLE hItemAll,int iCo itemType = SendMessage(hwndList,CLM_GETITEMTYPE,(WPARAM)hItem,0); if (itemType == CLCIT_CONTACT) { int oldiImage = SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,iColumn); - if (oldiImage != 0xFF&&oldiImage != iImage) + if (oldiImage != 0xFF && oldiImage != iImage) SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(iColumn,iImage)); } else if (itemType == CLCIT_INFO) { int oldiImage = SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,iColumn); - if (oldiImage != 0xFF&&oldiImage != iImage) + if (oldiImage != 0xFF && oldiImage != iImage) SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(iColumn,iImage)); if (hItem == hItemAll) SetAllChildIcons(hwndList,hItem,iColumn,iImage); @@ -352,7 +352,7 @@ static void SetIconsForColumn(HWND hwndList,HANDLE hItem,HANDLE hItemAll,int iCo } else if (itemType == CLCIT_GROUP) { int oldiImage = SendMessage(hwndList,CLM_GETEXTRAIMAGE,(WPARAM)hItem,iColumn); - if (oldiImage != 0xFF&&oldiImage != iImage) + if (oldiImage != 0xFF && oldiImage != iImage) SendMessage(hwndList,CLM_SETEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(iColumn,iImage)); hItem = (HANDLE)SendMessage(hwndList,CLM_GETNEXTITEM,CLGN_CHILD,(LPARAM)hItem); if (hItem) @@ -516,8 +516,7 @@ void SaveState() //free(vastring); if (szModeName && szModeName != (char*)szTempModeName) mir_free(szModeName); - if (szTempModeName) - mir_free(szTempModeName); + mir_free(szTempModeName); szTempModeName = NULL; szModeName = NULL; } @@ -767,8 +766,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP TCHAR * temp = mir_utf8decodeW( g_CluiData.current_viewmode ); - if (temp) - { + if (temp) { index = SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_FINDSTRING, -1, (LPARAM)temp ); mir_free(temp); } @@ -852,7 +850,6 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP else clvm_curItem = -1; - if (szBuf && szBuf != (char*)szTempBuf) mir_free(szBuf); if (szTempBuf) free(szTempBuf); szTempBuf = NULL; @@ -873,8 +870,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (lstrlen(szBuf) > 0) { - char *szUTF8Buf = NULL; - szUTF8Buf = mir_utf8encodeT(szBuf); + char *szUTF8Buf = mir_utf8encodeT(szBuf); if (db_get_dw(NULL, CLVM_MODULE, szUTF8Buf, -1) != -1) MessageBox(0, TranslateT("A view mode with this name does alredy exist"), TranslateT("Duplicate name"), MB_OK); @@ -1018,15 +1014,11 @@ static int FillMenuCallback(char *szSetting) if (szSetting[0] == (char)13) return 1; - { - TCHAR * temp; - //temp = alloca((strlen(szSetting)+1)*sizeof(TCHAR)); - mir_utf8decode(szSetting,&temp); - if (temp) - { - AppendMenu(hViewModeMenu, MFT_STRING, menuCounter++, temp); - mir_free(temp); - } + TCHAR * temp; + mir_utf8decode(szSetting,&temp); + if (temp) { + AppendMenu(hViewModeMenu, MFT_STRING, menuCounter++, temp); + mir_free(temp); } return 1; } @@ -1113,7 +1105,7 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM while(_buttons[i] != 0) { //SendMessage(GetDlgItem(hwnd, _buttons[i]), BM_SETSKINNED, 0, bSkinned); - if (1&&bSkinned) { + if (1 && bSkinned) { SendDlgItemMessage(hwnd, _buttons[i], BUTTONSETASFLATBTN, TRUE, 0); SendDlgItemMessage(hwnd, _buttons[i], BUTTONSETASFLATBTN + 10, 0, 0); } @@ -1501,53 +1493,6 @@ void ApplyViewMode(const char *Name, bool onlySelector ) if (g_CluiData.stickyMaskFilter != -1) g_CluiData.bFilterEffective |= CLVM_FILTER_STICKYSTATUS; - /* - mir_snprintf(szSetting, 256, "%c%s_VA", 246, name); - if (!DBGetContactSetting(NULL, CLVM_MODULE, szSetting, &dbv)) { - strncpy(g_CluiData.varFilter, dbv.pszVal, sizeof(g_CluiData.varFilter)); - g_CluiData.varFilter[sizeof(g_CluiData.varFilter) - 1] = 0; - if (lstrlenA(g_CluiData.varFilter) > 10 && ServiceExists(MS_VARS_FORMATSTRING)) - g_CluiData.bFilterEffective |= CLVM_FILTER_VARIABLES; - mir_free(dbv.ptszVal); - if (g_CluiData.bFilterEffective & CLVM_FILTER_VARIABLES) { - HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); - char UIN[256]; - char *id, *szProto; - const char *varstring; - char *temp; - FORMATINFO fi; - - while(hContact) { - szProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); - if (szProto) { - id = (char*) CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); - if (id) { - if (!DBGetContactSetting(hContact, szProto, id, &dbv)) { - if (dbv.type == DBVT_ASCIIZ) { - mir_snprintf(UIN, 256, "<%s:%s>", szProto, dbv.pszVal); - } - else { - mir_snprintf(UIN, 256, "<%s:%d>", szProto, dbv.dVal); - } - varstring = MakeVariablesString(g_CluiData.varFilter, UIN); - ZeroMemory(&fi, sizeof(fi)); - fi.cbSize = sizeof(fi); - fi.szFormat = varstring; - fi.szSource = ""; - fi.hContact = 0; - temp = (char *)CallService(MS_VARS_FORMATSTRING, (WPARAM)&fi, 0); - if (temp && atol(temp) > 0) - _DebugPopup(hContact, "%s, %d, %d, %d", temp, temp, fi.pCount, fi.eCount); - variables_free(temp); - DBFreeVariant(&dbv); - } - } - } - hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0); - } - } - }*/ - g_CluiData.filterFlags = db_get_dw(NULL, CLVM_MODULE, name, 0); KillTimer(g_hwndViewModeFrame, TIMERID_VIEWMODEEXPIRE); diff --git a/plugins/Clist_modern/modern_xptheme.cpp b/plugins/Clist_modern/modern_xptheme.cpp index 79b54ee4c1..29d1112e9c 100644 --- a/plugins/Clist_modern/modern_xptheme.cpp +++ b/plugins/Clist_modern/modern_xptheme.cpp @@ -39,6 +39,7 @@ static void _sttXptObjectDestructor (void * pt) { mir_free(pt); } + static int _xpt_ThemeSupport() { if (IsWinVerXPPlus()) { diff --git a/plugins/Clist_modern/resource.rc b/plugins/Clist_modern/resource.rc index 9bdb0e174e..db74c2a10b 100644 --- a/plugins/Clist_modern/resource.rc +++ b/plugins/Clist_modern/resource.rc @@ -362,7 +362,7 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN GROUPBOX "Toolbar settings",IDC_STATIC,7,5,290,204 CONTROL "",IDC_BTNORDER,"SysTreeView32",TVS_NOTOOLTIPS | TVS_CHECKBOXES | WS_BORDER | WS_TABSTOP,29,39,120,123 - LTEXT "Hints:\n* Use Drag&&Drop feature to change buttons order.\n* You can change button icons at Customize->Icons Toolbar section",IDC_STATIC,18,174,278,29 + LTEXT "Hints:\n* Use Drag && Drop feature to change buttons order.\n* You can change button icons at Customize->Icons Toolbar section",IDC_STATIC,18,174,278,29 CONTROL "Show Toolbar with next buttons:",IDC_TBSHOW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,20,268,10 EDITTEXT IDC_TEXT_W,240,118,35,12,ES_NUMBER CONTROL "",IDC_SPIN_W,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,276,118,11,12 -- cgit v1.2.3