From 43177ef97c1421502b5a2be9b8b62a6809fb29bf Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 8 Mar 2017 16:57:24 +0300 Subject: cosmetic code cleaning --- include/m_chat_int.h | 16 ++++++++-------- plugins/Scriver/src/chat/window.cpp | 2 +- plugins/TabSRMM/src/buttonsbar.cpp | 6 ++---- plugins/TabSRMM/src/chat_log.cpp | 7 +++---- plugins/TabSRMM/src/chat_main.cpp | 2 +- plugins/TabSRMM/src/chat_tools.cpp | 2 +- plugins/TabSRMM/src/chat_window.cpp | 6 +++--- src/core/stdmsg/src/chat_window.cpp | 2 +- src/mir_app/src/chat_manager.cpp | 2 +- src/mir_app/src/chat_svc.cpp | 8 ++++---- src/mir_app/src/chat_tools.cpp | 10 +++++----- src/mir_app/src/colorchooser.cpp | 4 ++-- 12 files changed, 32 insertions(+), 35 deletions(-) diff --git a/include/m_chat_int.h b/include/m_chat_int.h index 5136809d18..886c83d22f 100644 --- a/include/m_chat_int.h +++ b/include/m_chat_int.h @@ -174,12 +174,13 @@ struct GCSessionInfoBase { HWND hWnd; - BOOL bFGSet; - BOOL bBGSet; - BOOL bFilterEnabled; - BOOL bNicklistEnabled; - BOOL bInitDone; - BOOL bTrimmed; + bool bFGSet; + bool bBGSet; + bool bFilterEnabled; + bool bNicklistEnabled; + bool bInitDone; + bool bHasToolTip; + bool bTrimmed; char* pszModule; wchar_t* ptszID; @@ -200,11 +201,10 @@ struct GCSessionInfoBase WORD wStatus; WORD wState; WORD wCommandsNum; - void *pItemData; + void* pItemData; MCONTACT hContact; time_t LastTime; - BOOL isToolTip; int currentHovered; COMMANDINFO* lpCommands; diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp index 518e818200..251bb7acf1 100644 --- a/plugins/Scriver/src/chat/window.cpp +++ b/plugins/Scriver/src/chat/window.cpp @@ -304,7 +304,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, u = IsDlgButtonChecked(GetParent(hwnd), IDC_COLOR); if (index >= 0) { - si->bFGSet = TRUE; + si->bFGSet = true; si->iFG = index; } diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp index a911db110a..eb52e2f727 100644 --- a/plugins/TabSRMM/src/buttonsbar.cpp +++ b/plugins/TabSRMM/src/buttonsbar.cpp @@ -206,8 +206,6 @@ BOOL CTabBaseDlg::BB_SetButtonsPos() if (!m_hwnd || !IsWindowVisible(m_hwnd)) return 0; - HWND hwndButton = 0; - BYTE gap = DPISCALEX_S(db_get_b(0, SRMSGMOD, "ButtonsBarGap", 1)); bool showToolbar = !(m_pContainer->dwFlags & CNT_HIDETOOLBAR); bool bBottomToolbar = (m_pContainer->dwFlags & CNT_BOTTOMTOOLBAR) != 0; @@ -247,7 +245,7 @@ BOOL CTabBaseDlg::BB_SetButtonsPos() continue; if (((m_bType == SESSIONTYPE_IM) && cbd->m_bIMButton) || ((m_bType == SESSIONTYPE_CHAT) && cbd->m_bChatButton)) { - hwndButton = GetDlgItem(m_hwnd, cbd->m_dwButtonCID); + HWND hwndButton = GetDlgItem(m_hwnd, cbd->m_dwButtonCID); if (!showToolbar) { ShowWindow(hwndButton, SW_HIDE); @@ -297,7 +295,7 @@ BOOL CTabBaseDlg::BB_SetButtonsPos() continue; if (((m_bType == SESSIONTYPE_IM) && cbd->m_bIMButton) || ((m_bType == SESSIONTYPE_CHAT) && cbd->m_bChatButton)) { - hwndButton = GetDlgItem(m_hwnd, cbd->m_dwButtonCID); + HWND hwndButton = GetDlgItem(m_hwnd, cbd->m_dwButtonCID); if (!showToolbar) { ShowWindow(hwndButton, SW_HIDE); diff --git a/plugins/TabSRMM/src/chat_log.cpp b/plugins/TabSRMM/src/chat_log.cpp index a1fdf98a11..38d6a0d134 100644 --- a/plugins/TabSRMM/src/chat_log.cpp +++ b/plugins/TabSRMM/src/chat_log.cpp @@ -895,7 +895,7 @@ void CChatRoomDlg::StreamInEvents(LOGINFO *lin, SESSION_INFO *si, bool bRedraw) if (oldsel.cpMax != oldsel.cpMin) SendMessage(hwndRich, WM_SETREDRAW, FALSE, 0); - //set the insertion point at the bottom + // set the insertion point at the bottom sel.cpMin = sel.cpMax = GetRichTextLength(hwndRich); SendMessage(hwndRich, EM_EXSETSEL, 0, (LPARAM)&sel); @@ -906,7 +906,7 @@ void CChatRoomDlg::StreamInEvents(LOGINFO *lin, SESSION_INFO *si, bool bRedraw) // should the event(s) be appended to the current log WPARAM wp = bRedraw ? SF_RTF : SFF_SELECTION | SF_RTF; - //get the number of pixels per logical inch + // get the number of pixels per logical inch if (bRedraw) { HDC hdc = GetDC(nullptr); pci->logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY); @@ -914,7 +914,6 @@ void CChatRoomDlg::StreamInEvents(LOGINFO *lin, SESSION_INFO *si, bool bRedraw) ReleaseDC(nullptr, hdc); SendMessage(hwndRich, WM_SETREDRAW, FALSE, 0); bFlag = true; - // SetCursor(LoadCursor(nullptr, IDC_ARROW)); } // stream in the event(s) @@ -997,7 +996,7 @@ void CChatRoomDlg::StreamInEvents(LOGINFO *lin, SESSION_INFO *si, bool bRedraw) SendMessage(hwndRich, EM_SETSEL, 0, fi.chrgText.cpMax + 1); SendMessage(hwndRich, EM_REPLACESEL, TRUE, (LPARAM)L""); } - si->bTrimmed = FALSE; + si->bTrimmed = false; } // scroll log to bottom if the log was previously scrolled to bottom, else restore old position diff --git a/plugins/TabSRMM/src/chat_main.cpp b/plugins/TabSRMM/src/chat_main.cpp index aeac520800..570dd311be 100644 --- a/plugins/TabSRMM/src/chat_main.cpp +++ b/plugins/TabSRMM/src/chat_main.cpp @@ -36,7 +36,7 @@ TMUCSettings g_Settings; static void OnCreateSession(SESSION_INFO *si, MODULEINFO *mi) { - si->bFilterEnabled = db_get_b(si->hContact, "Chat", "FilterEnabled", M.GetByte("Chat", "FilterEnabled", 0)); + si->bFilterEnabled = db_get_b(si->hContact, "Chat", "FilterEnabled", M.GetByte("Chat", "FilterEnabled", 0)) != 0; Chat_SetFilters(si); if (mi) { diff --git a/plugins/TabSRMM/src/chat_tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp index 68c5cf40a9..0292d434bc 100644 --- a/plugins/TabSRMM/src/chat_tools.cpp +++ b/plugins/TabSRMM/src/chat_tools.cpp @@ -649,7 +649,7 @@ void Chat_SetFilters(SESSION_INFO *si) } if (si->iLogFilterFlags == 0) - si->bFilterEnabled = 0; + si->bFilterEnabled = false; } char GetIndicator(SESSION_INFO *si, LPCTSTR ptszNick, int *iNickIndex) diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp index 90d1f524c2..25cd8b3d65 100644 --- a/plugins/TabSRMM/src/chat_window.cpp +++ b/plugins/TabSRMM/src/chat_window.cpp @@ -868,7 +868,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, UINT u = IsDlgButtonChecked(GetParent(hwnd), IDC_COLOR); if (index >= 0) { - mwdat->si->bFGSet = TRUE; + mwdat->si->bFGSet = true; mwdat->si->iFG = index; } @@ -884,7 +884,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, UINT u = IsDlgButtonChecked(hwndParent, IDC_BKGCOLOR); if (index >= 0) { - mwdat->si->bBGSet = TRUE; + mwdat->si->bBGSet = true; mwdat->si->iBG = index; } @@ -1776,7 +1776,7 @@ void CChatRoomDlg::OnClick_Filter(CCtrlButton *pButton) if (si->iLogFilterFlags == 0 && !si->bFilterEnabled) { MessageBox(0, TranslateT("The filter cannot be enabled, because there are no event types selected either global or for this chat room"), TranslateT("Event filter error"), MB_OK); - si->bFilterEnabled = 0; + si->bFilterEnabled = false; } else si->bFilterEnabled = !si->bFilterEnabled; diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp index 9e2e472961..8af9e7db0c 100644 --- a/src/core/stdmsg/src/chat_window.cpp +++ b/src/core/stdmsg/src/chat_window.cpp @@ -494,7 +494,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, UINT u = IsDlgButtonChecked(hwndDlg, IDC_COLOR); if (index >= 0) { - dat->si->bFGSet = TRUE; + dat->si->bFGSet = true; dat->si->iFG = index; } diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp index e98e0cbe87..9c373c376a 100644 --- a/src/mir_app/src/chat_manager.cpp +++ b/src/mir_app/src/chat_manager.cpp @@ -161,7 +161,7 @@ BOOL SM_SetOffline(const wchar_t *pszID, const char *pszModule) si->pMe = NULL; si->nUsersInNicklist = 0; if (si->iType != GCW_SERVER) - si->bInitDone = FALSE; + si->bInitDone = false; if (chatApi.OnOfflineSession) chatApi.OnOfflineSession(si); if (pszID) diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp index 3d8317e20f..2d8dc7cb24 100644 --- a/src/mir_app/src/chat_svc.cpp +++ b/src/mir_app/src/chat_svc.cpp @@ -235,17 +235,17 @@ EXTERN_C MIR_APP_DLL(GCSessionInfoBase*) Chat_NewSession( si->iType = iType; si->ptszName = mir_wstrdup(ptszName); si->iLogFilterFlags = db_get_dw(NULL, CHAT_MODULE, "FilterFlags", 0x03E0); - si->bFilterEnabled = db_get_b(NULL, CHAT_MODULE, "FilterEnabled", 0); - si->bNicklistEnabled = db_get_b(NULL, CHAT_MODULE, "ShowNicklist", 1); + si->bFilterEnabled = db_get_b(NULL, CHAT_MODULE, "FilterEnabled", 0) != 0; + si->bNicklistEnabled = db_get_b(NULL, CHAT_MODULE, "ShowNicklist", 1) != 0; si->currentHovered = -1; if (mi->bColor) { si->iFG = 4; - si->bFGSet = TRUE; + si->bFGSet = true; } if (mi->bBkgColor) { si->iBG = 2; - si->bBGSet = TRUE; + si->bBGSet = true; } wchar_t szTemp[256]; diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp index 5dc9bd26f2..39ad6f98a4 100644 --- a/src/mir_app/src/chat_tools.cpp +++ b/src/mir_app/src/chat_tools.cpp @@ -868,7 +868,7 @@ static void CALLBACK ChatTimerProc(HWND hwnd, UINT, UINT_PTR idEvent, DWORD) CLCINFOTIP ti = { sizeof(ti) }; if (CallService("mToolTip/ShowTipW", (WPARAM)tszBuf, (LPARAM)&ti)) - si->isToolTip = TRUE; + si->bHasToolTip = true; } KillTimer(hwnd, idEvent); } @@ -894,9 +894,9 @@ MIR_APP_DLL(void) Chat_HoverMouse(SESSION_INFO *si, HWND hwnd, LPARAM lParam, bo KillTimer(hwnd, 1); - if (si->isToolTip) { + if (si->bHasToolTip) { CallService("mToolTip/HideTip", 0, 0); - si->isToolTip = FALSE; + si->bHasToolTip = false; } if (nItemUnderMouse != -1) @@ -907,9 +907,9 @@ MIR_APP_DLL(void) Chat_HoverMouse(SESSION_INFO *si, HWND hwnd, LPARAM lParam, bo else { if (bUseToolTip) { KillTimer(hwnd, 1); - if (si->isToolTip) { + if (si->bHasToolTip) { CallService("mToolTip/HideTip", 0, 0); - si->isToolTip = FALSE; + si->bHasToolTip = false; } } else ProcessNickListHovering(hwnd, -1, NULL); diff --git a/src/mir_app/src/colorchooser.cpp b/src/mir_app/src/colorchooser.cpp index f885658b8a..b33d296a81 100644 --- a/src/mir_app/src/colorchooser.cpp +++ b/src/mir_app/src/colorchooser.cpp @@ -140,7 +140,7 @@ public: int ctrlId = GetDlgCtrlID(m_hwndChooser); if (m_bForeground) { - m_si->bFGSet = TRUE; + m_si->bFGSet = true; m_si->iFG = iCurrentHotTrack; if (IsDlgButtonChecked(hWindow, ctrlId)) { cf.dwMask = CFM_COLOR; @@ -149,7 +149,7 @@ public: } } else { - m_si->bBGSet = TRUE; + m_si->bBGSet = true; m_si->iBG = iCurrentHotTrack; if (IsDlgButtonChecked(hWindow, ctrlId)) { cf.dwMask = CFM_BACKCOLOR; -- cgit v1.2.3