diff options
author | George Hazan <ghazan@miranda.im> | 2016-11-29 11:25:20 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2016-11-29 11:25:20 +0300 |
commit | 16b38b3be1547e49655683a912fb18e84c67f312 (patch) | |
tree | fa257bfaf2b85751923812c1e2b6574998b0ba7a /src | |
parent | d5f5b695cb8311e7dbfcc0526777b2ce640782e2 (diff) |
code cleaning
Diffstat (limited to 'src')
-rw-r--r-- | src/core/stdmsg/src/globals.cpp | 44 | ||||
-rw-r--r-- | src/core/stdmsg/src/globals.h | 49 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgdialog.cpp | 64 | ||||
-rw-r--r-- | src/core/stdmsg/src/msglog.cpp | 14 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgoptions.cpp | 8 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgs.cpp | 6 |
6 files changed, 91 insertions, 94 deletions
diff --git a/src/core/stdmsg/src/globals.cpp b/src/core/stdmsg/src/globals.cpp index b4a27046b6..0523308b66 100644 --- a/src/core/stdmsg/src/globals.cpp +++ b/src/core/stdmsg/src/globals.cpp @@ -104,49 +104,49 @@ int AvatarChanged(WPARAM hContact, LPARAM lParam) void ReloadGlobals()
{
- g_dat.flags = 0;
+ memset(&g_dat.flags, 0, sizeof(g_dat.flags));
if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWINFOLINE, SRMSGDEFSET_SHOWINFOLINE))
- g_dat.flags |= SMF_SHOWINFO;
+ g_dat.flags.bShowInfo = true;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWBUTTONLINE, SRMSGDEFSET_SHOWBUTTONLINE))
- g_dat.flags |= SMF_SHOWBTNS;
+ g_dat.flags.bShowButtons = true;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_SENDBUTTON, SRMSGDEFSET_SENDBUTTON))
- g_dat.flags |= SMF_SENDBTN;
+ g_dat.flags.bSendButton = true;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPING, SRMSGDEFSET_SHOWTYPING))
- g_dat.flags |= SMF_SHOWTYPING;
+ g_dat.flags.bShowTyping = true;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGWIN, SRMSGDEFSET_SHOWTYPINGWIN))
- g_dat.flags |= SMF_SHOWTYPINGWIN;
+ g_dat.flags.bShowTypingWin = true;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGNOWIN, SRMSGDEFSET_SHOWTYPINGNOWIN))
- g_dat.flags |= SMF_SHOWTYPINGTRAY;
+ g_dat.flags.bShowTypingTray = true;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST))
- g_dat.flags |= SMF_SHOWTYPINGCLIST;
+ g_dat.flags.bShowTypingClist = true;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWLOGICONS, SRMSGDEFSET_SHOWLOGICONS))
- g_dat.flags |= SMF_SHOWICONS;
+ g_dat.flags.bShowIcons = true;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWTIME, SRMSGDEFSET_SHOWTIME))
- g_dat.flags |= SMF_SHOWTIME;
+ g_dat.flags.bShowTime = true;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_AVATARENABLE, SRMSGDEFSET_AVATARENABLE))
- g_dat.flags |= SMF_AVATAR;
+ g_dat.flags.bShowAvatar = true;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWDATE, SRMSGDEFSET_SHOWDATE))
- g_dat.flags |= SMF_SHOWDATE;
+ g_dat.flags.bShowDate = true;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWSECS, SRMSGDEFSET_SHOWSECS))
- g_dat.flags |= SMF_SHOWSECS;
+ g_dat.flags.bShowSecs = true;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_HIDENAMES, SRMSGDEFSET_HIDENAMES))
- g_dat.flags |= SMF_HIDENAMES;
+ g_dat.flags.bHideNames = true;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_CHARCOUNT, SRMSGDEFSET_CHARCOUNT))
- g_dat.flags |= SMF_SHOWREADCHAR;
+ g_dat.flags.bShowReadChar = true;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_SENDONENTER, SRMSGDEFSET_SENDONENTER))
- g_dat.flags |= SMF_SENDONENTER;
+ g_dat.flags.bSendOnEnter = true;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_SENDONDBLENTER, SRMSGDEFSET_SENDONDBLENTER))
- g_dat.flags |= SMF_SENDONDBLENTER;
+ g_dat.flags.bSendOnDblEnter = true;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_AUTOCLOSE, SRMSGDEFSET_AUTOCLOSE))
- g_dat.flags |= SMF_AUTOCLOSE;
+ g_dat.flags.bAutoClose = true;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_AUTOMIN, SRMSGDEFSET_AUTOMIN))
- g_dat.flags |= SMF_AUTOMIN;
+ g_dat.flags.bAutoMin = true;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN))
- g_dat.flags |= SMF_TYPINGUNKNOWN;
+ g_dat.flags.bTypingUnknown = true;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_CTRLSUPPORT, SRMSGDEFSET_CTRLSUPPORT))
- g_dat.flags |= SMF_CTRLSUPPORT;
+ g_dat.flags.bCtrlSupport = true;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWFORMAT, SRMSGDEFSET_SHOWFORMAT))
- g_dat.flags |= SMF_SHOWFORMAT;
+ g_dat.flags.bShowFormat = true;
g_dat.openFlags = db_get_dw(NULL, SRMMMOD, SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS);
g_dat.nFlashMax = db_get_b(NULL, SRMMMOD, SRMSGSET_FLASHCOUNT, SRMSGDEFSET_FLASHCOUNT);
diff --git a/src/core/stdmsg/src/globals.h b/src/core/stdmsg/src/globals.h index 8f9d28c113..a6e0c43682 100644 --- a/src/core/stdmsg/src/globals.h +++ b/src/core/stdmsg/src/globals.h @@ -22,33 +22,34 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef SRMM_GLOBALS_H
#define SRMM_GLOBALS_H
-#define SMF_SHOWINFO 0x00000001
-#define SMF_SHOWBTNS 0x00000002
-#define SMF_SENDBTN 0x00000004
-#define SMF_SHOWTYPING 0x00000008
-#define SMF_SHOWTYPINGWIN 0x00000010
-#define SMF_SHOWTYPINGTRAY 0x00000020
-#define SMF_SHOWTYPINGCLIST 0x00000040
-#define SMF_SHOWICONS 0x00000080
-#define SMF_SHOWTIME 0x00000100
-#define SMF_AVATAR 0x00000200
-#define SMF_SHOWDATE 0x00000400
-#define SMF_HIDENAMES 0x00000800
-#define SMF_SHOWSECS 0x00001000
-#define SMF_SHOWREADCHAR 0x00002000
-#define SMF_SENDONENTER 0x00004000
-#define SMF_SENDONDBLENTER 0x00008000
-#define SMF_AUTOCLOSE 0x00010000
-#define SMF_AUTOMIN 0x00020000
-#define SMF_TYPINGUNKNOWN 0x00040000
-#define SMF_CTRLSUPPORT 0x00080000
-#define SMF_SHOWFORMAT 0x00100000
-
-#define SMF_ICON_TYPING 0
+struct SrmmFlags
+{
+ bool bShowInfo : 1;
+ bool bShowButtons : 1;
+ bool bSendButton : 1;
+ bool bShowTyping : 1;
+ bool bShowTypingWin : 1;
+ bool bShowTypingTray : 1;
+ bool bShowTypingClist : 1;
+ bool bShowIcons : 1;
+ bool bShowTime : 1;
+ bool bShowDate : 1;
+ bool bShowAvatar : 1;
+ bool bHideNames : 1;
+ bool bShowSecs : 1;
+ bool bShowReadChar : 1;
+ bool bSendOnEnter : 1;
+ bool bSendOnDblEnter : 1;
+ bool bAutoClose : 1;
+ bool bAutoMin : 1;
+ bool bTypingUnknown : 1;
+ bool bCtrlSupport : 1;
+ bool bShowFormat : 1;
+};
struct GlobalMessageData
{
- unsigned int flags;
+ SrmmFlags flags;
MWindowList hMessageWindowList;
DWORD openFlags;
DWORD msgTimeout;
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index f119a3435a..28b1199d7d 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -118,7 +118,7 @@ static void ShowMultipleControls(HWND hwndDlg, const UINT * controls, int cContr static void UpdateReadChars(HWND hwndDlg, HWND hwndStatus)
{
- if (hwndStatus && (g_dat.flags & SMF_SHOWREADCHAR)) {
+ if (hwndStatus && g_dat.flags.bShowReadChar) {
wchar_t buf[32];
int len = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE));
@@ -134,7 +134,7 @@ static void ShowTime(SrmmWindowData *dat) GetSystemTime(&st);
if (dat->wMinute != st.wMinute) {
wchar_t buf[32];
- unsigned i = (g_dat.flags & SMF_SHOWREADCHAR) ? 2 : 1;
+ unsigned i = g_dat.flags.bShowReadChar ? 2 : 1;
TimeZone_PrintDateTime(dat->hTimeZone, L"t", buf, _countof(buf), 0);
SendMessage(dat->hwndStatus, SB_SETTEXT, i, (LPARAM)buf);
@@ -153,11 +153,11 @@ static void SetupStatusBar(HWND hwndDlg, SrmmWindowData *dat) int cx = rc.right - rc.left;
if (dat->hTimeZone) {
- if (g_dat.flags & SMF_SHOWREADCHAR)
+ if (g_dat.flags.bShowReadChar)
statwidths[i++] = cx - SB_TIME_WIDTH - SB_CHAR_WIDTH - icons_width;
statwidths[i++] = cx - SB_TIME_WIDTH - icons_width;
}
- else if (g_dat.flags & SMF_SHOWREADCHAR)
+ else if (g_dat.flags.bShowReadChar)
statwidths[i++] = cx - SB_CHAR_WIDTH - icons_width;
statwidths[i++] = cx - icons_width;
@@ -173,12 +173,12 @@ static void SetDialogToType(HWND hwndDlg) {
SrmmWindowData *dat = (SrmmWindowData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (dat->hContact)
- ShowMultipleControls(hwndDlg, infoLineControls, _countof(infoLineControls), (g_dat.flags&SMF_SHOWINFO) ? SW_SHOW : SW_HIDE);
+ ShowMultipleControls(hwndDlg, infoLineControls, _countof(infoLineControls), g_dat.flags.bShowInfo ? SW_SHOW : SW_HIDE);
else
ShowMultipleControls(hwndDlg, infoLineControls, _countof(infoLineControls), SW_HIDE);
if (dat->hContact) {
- ShowMultipleControls(hwndDlg, buttonLineControls, _countof(buttonLineControls), (g_dat.flags & SMF_SHOWBTNS) ? SW_SHOW : SW_HIDE);
+ ShowMultipleControls(hwndDlg, buttonLineControls, _countof(buttonLineControls), g_dat.flags.bShowButtons ? SW_SHOW : SW_HIDE);
if (!db_get_b(dat->hContact, "CList", "NotOnList", 0))
ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE);
}
@@ -193,9 +193,9 @@ static void SetDialogToType(HWND hwndDlg) ShowWindow(GetDlgItem(hwndDlg, IDCANCEL), SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_SPLITTER), SW_SHOW);
- ShowWindow(GetDlgItem(hwndDlg, IDOK), (g_dat.flags & SMF_SENDBTN) ? SW_SHOW : SW_HIDE);
+ ShowWindow(GetDlgItem(hwndDlg, IDOK), g_dat.flags.bSendButton ? SW_SHOW : SW_HIDE);
EnableWindow(GetDlgItem(hwndDlg, IDOK), GetWindowTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE)) != 0);
- if (dat->avatarPic == NULL || !(g_dat.flags & SMF_AVATAR))
+ if (dat->avatarPic == NULL || !g_dat.flags.bShowAvatar)
ShowWindow(GetDlgItem(hwndDlg, IDC_AVATAR), SW_HIDE);
SendMessage(hwndDlg, DM_UPDATETITLE, 0, 0);
SendMessage(hwndDlg, WM_SIZE, 0, 0);
@@ -247,12 +247,11 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar case WM_KEYDOWN:
if (wParam == VK_RETURN) {
- if (!(GetKeyState(VK_SHIFT) & 0x8000) &&
- ((GetKeyState(VK_CONTROL) & 0x8000) != 0) != ((g_dat.flags & SMF_SENDONENTER) != 0)) {
+ if (!(GetKeyState(VK_SHIFT) & 0x8000) && ((GetKeyState(VK_CONTROL) & 0x8000) != 0) != g_dat.flags.bSendOnEnter) {
PostMessage(GetParent(hwnd), WM_COMMAND, IDOK, 0);
return 0;
}
- if (g_dat.flags & SMF_SENDONDBLENTER) {
+ if (g_dat.flags.bSendOnDblEnter) {
if (dat->lastEnterTime + ENTERCLICKTIME < GetTickCount())
dat->lastEnterTime = GetTickCount();
else {
@@ -271,8 +270,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar return 0;
}
- if (wParam == VK_UP && (GetKeyState(VK_CONTROL) & 0x8000) &&
- ((g_dat.flags & (SMF_AUTOCLOSE | SMF_CTRLSUPPORT)) == SMF_CTRLSUPPORT)) {
+ if (wParam == VK_UP && (GetKeyState(VK_CONTROL) & 0x8000) && g_dat.flags.bCtrlSupport && !g_dat.flags.bAutoClose) {
if (pdat->cmdList.getCount()) {
if (pdat->cmdListInd < 0) {
pdat->cmdListInd = pdat->cmdList.getCount() - 1;
@@ -287,8 +285,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar return 0;
}
- if (wParam == VK_DOWN && (GetKeyState(VK_CONTROL) & 0x8000) &&
- ((g_dat.flags & (SMF_AUTOCLOSE | SMF_CTRLSUPPORT)) == SMF_CTRLSUPPORT)) {
+ if (wParam == VK_DOWN && (GetKeyState(VK_CONTROL) & 0x8000) && g_dat.flags.bCtrlSupport && !g_dat.flags.bAutoClose) {
if (pdat->cmdList.getCount() && pdat->cmdListInd >= 0) {
if (pdat->cmdListInd < (pdat->cmdList.getCount() - 1))
SetEditorText(hwnd, pdat->cmdList[++pdat->cmdListInd]);
@@ -475,7 +472,7 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * {
SrmmWindowData *dat = (SrmmWindowData *)lParam;
- if (!(g_dat.flags & SMF_SHOWINFO) && !(g_dat.flags & SMF_SHOWBTNS)) {
+ if (!g_dat.flags.bShowInfo && !g_dat.flags.bShowButtons) {
for (int i = 0; i < _countof(buttonLineControls); i++)
if (buttonLineControls[i] == urc->wId)
OffsetRect(&urc->rcItem, 0, -dat->lineHeight);
@@ -496,7 +493,7 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * SIZE textSize;
GetTextExtentPoint32(hdc, buf, (int)mir_wstrlen(buf), &textSize);
urc->rcItem.right = urc->rcItem.left + textSize.cx + 10;
- if ((g_dat.flags&SMF_SHOWBTNS) && urc->rcItem.right > urc->dlgNewSize.cx - dat->nLabelRight)
+ if (g_dat.flags.bShowButtons && urc->rcItem.right > urc->dlgNewSize.cx - dat->nLabelRight)
urc->rcItem.right = urc->dlgNewSize.cx - dat->nLabelRight;
SelectObject(hdc, hFont);
ReleaseDC(h, hdc);
@@ -512,7 +509,7 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * return RD_ANCHORX_RIGHT | RD_ANCHORY_TOP;
case IDC_LOG:
- if (!(g_dat.flags&SMF_SHOWINFO) && !(g_dat.flags&SMF_SHOWBTNS))
+ if (!(g_dat.flags.bShowInfo) && !(g_dat.flags.bShowButtons))
urc->rcItem.top -= dat->lineHeight;
urc->rcItem.bottom -= dat->splitterPos - dat->originalSplitterPos;
return RD_ANCHORX_WIDTH | RD_ANCHORY_HEIGHT;
@@ -523,13 +520,13 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * return RD_ANCHORX_WIDTH | RD_ANCHORY_BOTTOM;
case IDC_MESSAGE:
- if (!(g_dat.flags & SMF_SENDBTN))
+ if (!g_dat.flags.bSendButton)
urc->rcItem.right = urc->dlgNewSize.cx - urc->rcItem.left;
- if ((g_dat.flags & SMF_AVATAR) && dat->avatarPic)
+ if (g_dat.flags.bShowAvatar && dat->avatarPic)
urc->rcItem.left = dat->avatarWidth + 4;
urc->rcItem.top -= dat->splitterPos - dat->originalSplitterPos;
- if (!(g_dat.flags & SMF_SENDBTN))
+ if (!g_dat.flags.bSendButton)
return RD_ANCHORX_CUSTOM | RD_ANCHORY_BOTTOM;
return RD_ANCHORX_WIDTH | RD_ANCHORY_BOTTOM;
@@ -548,7 +545,7 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * void ShowAvatar(HWND hwndDlg, SrmmWindowData *dat)
{
- if (g_dat.flags & SMF_AVATAR) {
+ if (g_dat.flags.bShowAvatar) {
AVATARCACHEENTRY *ace = (AVATARCACHEENTRY *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)dat->getActiveContact(), 0);
if (ace && (INT_PTR)ace != CALLSERVICE_NOTFOUND && (ace->dwFlags & AVS_BITMAP_VALID) && !(ace->dwFlags & AVS_HIDEONCLIST))
dat->avatarPic = ace->hbmPic;
@@ -593,7 +590,7 @@ static void NotifyTyping(SrmmWindowData *dat, int mode) if (protoCaps & PF1_INVISLIST && protoStatus == ID_STATUS_INVISIBLE && db_get_w(dat->hContact, dat->szProto, "ApparentMode", 0) != ID_STATUS_ONLINE)
return;
- if (!(g_dat.flags & SMF_TYPINGUNKNOWN) && db_get_b(dat->hContact, "CList", "NotOnList", 0))
+ if (!g_dat.flags.bTypingUnknown && db_get_b(dat->hContact, "CList", "NotOnList", 0))
return;
// End user check
@@ -759,7 +756,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l SendMessage(hwndDlg, DM_OPTIONSAPPLIED, 1, 0);
- //restore saved msg if any...
+ // restore saved msg if any...
if (dat->hContact) {
DBVARIANT dbv;
if (!db_get_ws(dat->hContact, SRMSGMOD, DBSAVEDMSG, &dbv)) {
@@ -821,8 +818,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l }
break;
- // Mod from tabsrmm
- case WM_DROPFILES:
+ case WM_DROPFILES: // Mod from tabsrmm
if (dat->szProto == NULL) break;
if (!(CallProtoService(dat->szProto, PS_GETCAPS, PFLAGNUM_1, 0)&PF1_FILESEND)) break;
if (dat->wStatus == ID_STATUS_OFFLINE) break;
@@ -847,7 +843,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l break;
case DM_AVATARCALCSIZE:
- if (dat->avatarPic == NULL || !(g_dat.flags & SMF_AVATAR)) {
+ if (dat->avatarPic == NULL || !g_dat.flags.bShowAvatar) {
dat->avatarWidth = 50;
dat->avatarHeight = 50;
ShowWindow(GetDlgItem(hwndDlg, IDC_AVATAR), SW_HIDE);
@@ -869,7 +865,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l case DM_UPDATESIZEBAR:
dat->minEditBoxSize.cx = dat->minEditInit.right - dat->minEditInit.left;
dat->minEditBoxSize.cy = dat->minEditInit.bottom - dat->minEditInit.top;
- if (g_dat.flags&SMF_AVATAR) {
+ if (g_dat.flags.bShowAvatar) {
SendMessage(hwndDlg, DM_AVATARCALCSIZE, 0, 0);
if (dat->avatarPic && dat->minEditBoxSize.cy <= dat->avatarHeight)
dat->minEditBoxSize.cy = dat->avatarHeight;
@@ -1116,7 +1112,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l RedrawWindow(GetDlgItem(hwndDlg, IDOK), NULL, NULL, RDW_INVALIDATE);
RedrawWindow(GetDlgItem(hwndDlg, IDC_MESSAGE), NULL, NULL, RDW_INVALIDATE);
}
- if ((g_dat.flags & SMF_AVATAR) && dat->avatarPic)
+ if (g_dat.flags.bShowAvatar && dat->avatarPic)
RedrawWindow(GetDlgItem(hwndDlg, IDC_AVATAR), NULL, NULL, RDW_INVALIDATE);
if (bottomScroll)
@@ -1246,7 +1242,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l }
else {
SendMessage(hwndDlg, DM_UPDATELASTMESSAGE, 0, 0);
- if (g_dat.flags & SMF_SHOWTYPINGWIN)
+ if (g_dat.flags.bShowTypingWin)
SendMessage(hwndDlg, DM_UPDATEWINICON, 0, 0);
dat->showTyping = 0;
}
@@ -1262,7 +1258,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l SendMessage(dat->hwndStatus, SB_SETTEXT, 0, (LPARAM)szBuf);
SendMessage(dat->hwndStatus, SB_SETICON, 0, (LPARAM)hTyping);
- if ((g_dat.flags & SMF_SHOWTYPINGWIN) && GetForegroundWindow() != hwndDlg) {
+ if (g_dat.flags.bShowTypingWin && GetForegroundWindow() != hwndDlg) {
HICON hIcon = (HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0);
SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)hTyping);
IcoLib_ReleaseIcon(hIcon);
@@ -1308,7 +1304,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l }
}
}
- else if (dis->CtlID == IDC_AVATAR && dat->avatarPic && (g_dat.flags & SMF_AVATAR)) {
+ else if (dis->CtlID == IDC_AVATAR && dat->avatarPic && g_dat.flags.bShowAvatar) {
HPEN hPen = CreatePen(PS_SOLID, 1, RGB(0, 0, 0));
HPEN hOldPen = (HPEN)SelectObject(dis->hDC, hPen);
Rectangle(dis->hDC, 0, 0, dat->avatarWidth, dat->avatarHeight);
@@ -1358,9 +1354,9 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l SetDlgItemText(hwndDlg, IDC_MESSAGE, L"");
- if (g_dat.flags & SMF_AUTOCLOSE)
+ if (g_dat.flags.bAutoClose)
DestroyWindow(hwndDlg);
- else if (g_dat.flags & SMF_AUTOMIN)
+ else if (g_dat.flags.bAutoMin)
ShowWindow(hwndDlg, SW_MINIMIZE);
}
return TRUE;
diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index 51e8900b93..2a5b8e1d1f 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -84,7 +84,7 @@ static void AppendToBufferWithRTF(CMStringA &buf, const wchar_t *line) buf.AppendChar('\\');
buf.AppendChar(*line);
}
- else if (*line == '[' && (g_dat.flags & SMF_SHOWFORMAT)) {
+ else if (*line == '[' && (g_dat.flags.bShowFormat)) {
int i, found = 0;
for (i = 0; i < _countof(bbcodes); ++i) {
if (line[1] == bbcodes[i][1]) {
@@ -245,21 +245,21 @@ static char* CreateRTFFromDbEvent(SrmmWindowData *dat, MCONTACT hContact, MEVENT buffer.Append("\\rtlch\\ltrch");
}
- if (g_dat.flags & SMF_SHOWICONS) {
+ if (g_dat.flags.bShowIcons) {
int i = ((dbei.eventType == EVENTTYPE_MESSAGE) ? ((dbei.flags & DBEF_SENT) ? LOGICON_MSG_OUT : LOGICON_MSG_IN): LOGICON_MSG_NOTICE);
buffer.Append("\\f0\\fs14");
buffer.Append(pLogIconBmpBits[i]);
}
- if (g_dat.flags & SMF_SHOWTIME) {
+ if (g_dat.flags.bShowTime) {
const wchar_t* szFormat;
wchar_t str[64];
- if (g_dat.flags & SMF_SHOWSECS)
- szFormat = g_dat.flags & SMF_SHOWDATE ? L"d s" : L"s";
+ if (g_dat.flags.bShowSecs)
+ szFormat = g_dat.flags.bShowDate ? L"d s" : L"s";
else
- szFormat = g_dat.flags & SMF_SHOWDATE ? L"d t" : L"t";
+ szFormat = g_dat.flags.bShowDate ? L"d t" : L"t";
TimeZone_PrintTimeStamp(NULL, dbei.timestamp, szFormat, str, _countof(str), 0);
@@ -268,7 +268,7 @@ static char* CreateRTFFromDbEvent(SrmmWindowData *dat, MCONTACT hContact, MEVENT showColon = 1;
}
- if (!(g_dat.flags & SMF_HIDENAMES) && dbei.eventType != EVENTTYPE_JABBER_CHATSTATES && dbei.eventType != EVENTTYPE_JABBER_PRESENCE) {
+ if (!(g_dat.flags.bHideNames) && dbei.eventType != EVENTTYPE_JABBER_CHATSTATES && dbei.eventType != EVENTTYPE_JABBER_PRESENCE) {
wchar_t *szName;
if (dbei.flags & DBEF_SENT) {
diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp index 13af64a6e2..3f43915736 100644 --- a/src/core/stdmsg/src/msgoptions.cpp +++ b/src/core/stdmsg/src/msgoptions.cpp @@ -195,8 +195,8 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP FillCheckBoxTree(GetDlgItem(hwndDlg, IDC_POPLIST), statusValues, _countof(statusValues), db_get_dw(NULL, SRMMMOD, SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS));
CheckDlgButton(hwndDlg, IDC_DONOTSTEALFOCUS, db_get_b(NULL, SRMMMOD, SRMSGSET_DONOTSTEALFOCUS, SRMSGDEFSET_DONOTSTEALFOCUS) ? BST_CHECKED : BST_UNCHECKED);
SetDlgItemInt(hwndDlg, IDC_NFLASHES, db_get_b(NULL, SRMMMOD, SRMSGSET_FLASHCOUNT, SRMSGDEFSET_FLASHCOUNT), FALSE);
- CheckDlgButton(hwndDlg, IDC_SHOWBUTTONLINE, g_dat.flags&SMF_SHOWBTNS ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_SHOWINFOLINE, g_dat.flags&SMF_SHOWINFO ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SHOWBUTTONLINE, g_dat.flags.bShowButtons ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SHOWINFOLINE, g_dat.flags.bShowInfo ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_AUTOMIN, db_get_b(NULL, SRMMMOD, SRMSGSET_AUTOMIN, SRMSGDEFSET_AUTOMIN) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_AUTOCLOSE, db_get_b(NULL, SRMMMOD, SRMSGSET_AUTOCLOSE, SRMSGDEFSET_AUTOCLOSE) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_SAVEPERCONTACT, db_get_b(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT) ? BST_CHECKED : BST_UNCHECKED);
@@ -205,7 +205,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP CheckDlgButton(hwndDlg, IDC_SENDONDBLENTER, db_get_b(NULL, SRMMMOD, SRMSGSET_SENDONDBLENTER, SRMSGDEFSET_SENDONDBLENTER) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_STATUSWIN, db_get_b(NULL, SRMMMOD, SRMSGSET_STATUSICON, SRMSGDEFSET_STATUSICON) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_AVATARSUPPORT, g_dat.flags&SMF_AVATAR ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_AVATARSUPPORT, g_dat.flags.bShowAvatar ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_LIMITAVATARH, db_get_b(NULL, SRMMMOD, SRMSGSET_LIMITAVHEIGHT, SRMSGDEFSET_LIMITAVHEIGHT) ? BST_CHECKED : BST_UNCHECKED);
avatarHeight = db_get_dw(NULL, SRMMMOD, SRMSGSET_AVHEIGHT, SRMSGDEFSET_AVHEIGHT);
SetDlgItemInt(hwndDlg, IDC_AVATARHEIGHT, avatarHeight, FALSE);
@@ -213,7 +213,7 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_AVATARSUPPORT))
EnableWindow(GetDlgItem(hwndDlg, IDC_AVATARHEIGHT), FALSE);
else EnableWindow(GetDlgItem(hwndDlg, IDC_AVATARHEIGHT), IsDlgButtonChecked(hwndDlg, IDC_LIMITAVATARH));
- CheckDlgButton(hwndDlg, IDC_SHOWSENDBTN, g_dat.flags&SMF_SENDBTN ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_SHOWSENDBTN, g_dat.flags.bSendButton ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CHARCOUNT, db_get_b(NULL, SRMMMOD, SRMSGSET_CHARCOUNT, SRMSGDEFSET_CHARCOUNT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CTRLSUPPORT, db_get_b(NULL, SRMMMOD, SRMSGSET_CTRLSUPPORT, SRMSGDEFSET_CTRLSUPPORT) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_DELTEMP, db_get_b(NULL, SRMMMOD, SRMSGSET_DELTEMP, SRMSGDEFSET_DELTEMP) ? BST_CHECKED : BST_UNCHECKED);
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index a5c813baa8..7c68133a7c 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -157,7 +157,7 @@ static INT_PTR ReadMessageCommand(WPARAM, LPARAM lParam) static int TypingMessage(WPARAM hContact, LPARAM lParam)
{
- if (!(g_dat.flags & SMF_SHOWTYPING))
+ if (!g_dat.flags.bShowTyping)
return 0;
hContact = db_mc_tryMeta(hContact);
@@ -167,11 +167,11 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam) HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact);
if (hwnd)
SendMessage(hwnd, DM_TYPING, 0, lParam);
- else if (lParam && (g_dat.flags & SMF_SHOWTYPINGTRAY)) {
+ else if (lParam && g_dat.flags.bShowTypingTray) {
wchar_t szTip[256];
mir_snwprintf(szTip, TranslateT("%s is typing a message"), pcli->pfnGetContactDisplayName(hContact, 0));
- if (g_dat.flags & SMF_SHOWTYPINGCLIST) {
+ if (g_dat.flags.bShowTypingClist) {
pcli->pfnRemoveEvent(hContact, 1);
CLISTEVENT cle = {};
|