diff options
author | George Hazan <ghazan@miranda.im> | 2016-12-12 13:52:10 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2016-12-12 13:52:10 +0300 |
commit | 514c05fc7c3a177918e91b88c391edf730465438 (patch) | |
tree | 4f7adbec3d84a82c0525031c0e84982f858c24c2 | |
parent | 9ebce88570a82cb4099a5e35f1861dcff9eb1a05 (diff) |
code cleaning
-rw-r--r-- | src/core/stdmsg/src/chat_window.cpp | 25 | ||||
-rw-r--r-- | src/core/stdmsg/src/globals.cpp | 1 | ||||
-rw-r--r-- | src/core/stdmsg/src/globals.h | 1 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgdialog.cpp | 13 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgs.h | 2 |
5 files changed, 21 insertions, 21 deletions
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp index 277f71b0d2..911c2deef9 100644 --- a/src/core/stdmsg/src/chat_window.cpp +++ b/src/core/stdmsg/src/chat_window.cpp @@ -723,7 +723,7 @@ static INT_PTR CALLBACK FilterWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP if (IsDlgButtonChecked(hwndDlg, IDC_11) == BST_CHECKED) iFlags |= GC_EVENT_NOTICE; - if (iFlags&GC_EVENT_ADDSTATUS) + if (iFlags & GC_EVENT_ADDSTATUS) iFlags |= GC_EVENT_REMOVESTATUS; SendMessage(GetParent(hwndDlg), GC_CHANGEFILTERFLAG, 0, (LPARAM)iFlags); @@ -763,17 +763,16 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR { switch (msg) { case WM_LBUTTONUP: - { - CHARRANGE sel; - SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel); - if (sel.cpMin != sel.cpMax) { - SendMessage(hwnd, WM_COPY, 0, 0); - sel.cpMin = sel.cpMax; - SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&sel); - } - SetFocus(GetDlgItem(GetParent(hwnd), IDC_MESSAGE)); + CHARRANGE sel; + SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel); + if (sel.cpMin != sel.cpMax) { + SendMessage(hwnd, WM_COPY, 0, 0); + sel.cpMin = sel.cpMax; + SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&sel); } + SetFocus(GetDlgItem(GetParent(hwnd), IDC_MESSAGE)); break; + case WM_KEYDOWN: if (wParam == 0x57 && GetKeyState(VK_CONTROL) & 0x8000) { // ctrl-w (close window) PostMessage(GetParent(hwnd), WM_CLOSE, 0, 0); @@ -783,7 +782,6 @@ static LRESULT CALLBACK LogSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR case WM_ACTIVATE: if (LOWORD(wParam) == WA_INACTIVE) { - CHARRANGE sel; SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel); if (sel.cpMin != sel.cpMax) { sel.cpMin = sel.cpMax; @@ -1084,7 +1082,6 @@ static void SetButtonsPos(HWND hwndDlg) GetClientRect(hwndDlg, &rc); int iLeftX = 2, iRightX = rc.right - 2; - int iGap = db_get_b(NULL, SRMSGMOD, "ButtonsBarGap", 1); for (int i = 0;; i++) { CustomButtonData *cbd = Srmm_GetNthButton(i); @@ -1096,7 +1093,7 @@ static void SetButtonsPos(HWND hwndDlg) continue; hdwp = DeferWindowPos(hdwp, hwndButton, NULL, iLeftX, pt.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE); - iLeftX += iGap + cbd->m_iButtonWidth; + iLeftX += g_dat.iGap + cbd->m_iButtonWidth; } for (int i = Srmm_GetButtonCount() - 1; i >= 0; i--) { @@ -1108,7 +1105,7 @@ static void SetButtonsPos(HWND hwndDlg) if (hwndButton == NULL) continue; - iRightX -= iGap + cbd->m_iButtonWidth; + iRightX -= g_dat.iGap + cbd->m_iButtonWidth; hdwp = DeferWindowPos(hdwp, hwndButton, NULL, iRightX, pt.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE); } diff --git a/src/core/stdmsg/src/globals.cpp b/src/core/stdmsg/src/globals.cpp index 55b2214d7f..4a591e99d9 100644 --- a/src/core/stdmsg/src/globals.cpp +++ b/src/core/stdmsg/src/globals.cpp @@ -147,6 +147,7 @@ void ReloadGlobals() g_dat.openFlags = db_get_dw(NULL, SRMMMOD, SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS);
g_dat.nFlashMax = db_get_b(NULL, SRMMMOD, SRMSGSET_FLASHCOUNT, SRMSGDEFSET_FLASHCOUNT);
+ g_dat.iGap = db_get_b(NULL, SRMSGMOD, SRMSGSET_BUTTONGAP, SRMSGDEFSET_BUTTONGAP);
g_dat.msgTimeout = db_get_dw(NULL, SRMMMOD, SRMSGSET_MSGTIMEOUT, SRMSGDEFSET_MSGTIMEOUT);
if (g_dat.msgTimeout < SRMSGSET_MSGTIMEOUT_MIN) g_dat.msgTimeout = SRMSGDEFSET_MSGTIMEOUT;
diff --git a/src/core/stdmsg/src/globals.h b/src/core/stdmsg/src/globals.h index 1b8dfb1aaa..39f6bf3c41 100644 --- a/src/core/stdmsg/src/globals.h +++ b/src/core/stdmsg/src/globals.h @@ -53,6 +53,7 @@ struct GlobalMessageData DWORD openFlags;
DWORD msgTimeout;
DWORD nFlashMax;
+ int iGap;
};
void InitGlobals();
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 840444681c..2f255f1bb2 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -485,18 +485,17 @@ static void SetButtonsPos(SrmmWindowData *dat, HWND hwndDlg) GetClientRect(hwndDlg, &rc);
int iButtonX = rc.right - 2;
- int iGap = db_get_b(NULL, SRMSGMOD, "ButtonsBarGap", 1);
bool bIsRight = true;
for (int i = Srmm_GetButtonCount()-1; i >= 0; i--) {
CustomButtonData *cbd = Srmm_GetNthButton(i);
- int width = iGap + cbd->m_iButtonWidth;
+ iButtonX -= g_dat.iGap + cbd->m_iButtonWidth;
+ if (cbd->m_bSeparator)
+ continue;
HWND hwndButton = GetDlgItem(hwndDlg, cbd->m_dwButtonCID);
- if (NULL != hwndButton) /* Wine fix. */ {
- iButtonX -= width;
+ if (NULL != hwndButton) /* Wine fix. */
hdwp = DeferWindowPos(hdwp, hwndButton, NULL, iButtonX, iButtonY, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
- }
if (bIsRight && !cbd->m_bRSided) {
bIsRight = false;
@@ -509,7 +508,7 @@ static void SetButtonsPos(SrmmWindowData *dat, HWND hwndDlg) static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc)
{
- SrmmWindowData *dat = (SrmmWindowData *)lParam;
+ SrmmWindowData *dat = (SrmmWindowData*)lParam;
switch (urc->wId) {
case IDC_NAME:
@@ -627,7 +626,7 @@ static void NotifyTyping(SrmmWindowData *dat, int mode) INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- SrmmWindowData *dat = (SrmmWindowData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ SrmmWindowData *dat = (SrmmWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (uMsg) {
case WM_INITDIALOG:
diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index c034551fa9..bdc3376f99 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -190,6 +190,8 @@ bool LoadMsgDlgFont(int i, LOGFONT* lf, COLORREF* colour); #define SRMSGSET_MSGTIMEOUT_MIN 5000 // minimum value (5 seconds)
#define SRMSGSET_FLASHCOUNT "FlashMax"
#define SRMSGDEFSET_FLASHCOUNT 5
+#define SRMSGSET_BUTTONGAP "ButtonsBarGap"
+#define SRMSGDEFSET_BUTTONGAP 1
#define SRMSGSET_LOADHISTORY "LoadHistory"
#define SRMSGDEFSET_LOADHISTORY LOADHISTORY_UNREAD
|