diff options
Diffstat (limited to 'src/core/stdmsg')
-rw-r--r-- | src/core/stdmsg/res/resource.rc | 6 | ||||
-rw-r--r-- | src/core/stdmsg/src/chat_window.cpp | 46 | ||||
-rw-r--r-- | src/core/stdmsg/src/globals.cpp | 2 | ||||
-rw-r--r-- | src/core/stdmsg/src/globals.h | 1 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgdialog.cpp | 153 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgoptions.cpp | 2 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgs.cpp | 51 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgs.h | 1 | ||||
-rw-r--r-- | src/core/stdmsg/src/resource.h | 4 | ||||
-rw-r--r-- | src/core/stdmsg/src/stdafx.h | 1 |
10 files changed, 89 insertions, 178 deletions
diff --git a/src/core/stdmsg/res/resource.rc b/src/core/stdmsg/res/resource.rc index 8871c47a48..4834654fa8 100644 --- a/src/core/stdmsg/res/resource.rc +++ b/src/core/stdmsg/res/resource.rc @@ -42,7 +42,6 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,86,289,10
CONTROL "Cascade new windows",IDC_CASCADE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,98,289,10
CONTROL "Show 'Send' button",IDC_SHOWSENDBTN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,166,135,10
- CONTROL "Show username on top row",IDC_SHOWINFOLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,179,138,10
CONTROL "Show toolbar buttons on top row",IDC_SHOWBUTTONLINE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,192,137,10
CONTROL "Send message on double 'Enter'",IDC_SENDONDBLENTER,
@@ -85,13 +84,11 @@ EXSTYLE WS_EX_NOPARENTNOTIFY | WS_EX_ACCEPTFILES | WS_EX_CONTROLPARENT CAPTION "Message session"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- CONTROL "",IDC_PROTOCOL,"Button",BS_OWNERDRAW,2,5,12,12
- CONTROL "User &details",IDC_NAME,"MButtonClass",WS_TABSTOP,15,2,95,14,WS_EX_NOACTIVATE | 0x10000000L
CONTROL "",IDC_MESSAGE,"RichEdit50W",ES_MULTILINE | ES_AUTOVSCROLL | ES_NOHIDESEL | ES_WANTRETURN | WS_VSCROLL | WS_TABSTOP,1,49,141,13,WS_EX_ACCEPTFILES | WS_EX_STATICEDGE
DEFPUSHBUTTON "&Send",IDOK,143,48,39,15
PUSHBUTTON "Close",IDCANCEL,129,0,54,15,NOT WS_VISIBLE
CONTROL "",IDC_LOG,"RichEdit50W",ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | WS_TABSTOP,1,18,183,26,WS_EX_STATICEDGE
- CONTROL "",IDC_SPLITTER,"Static",SS_ENHMETAFILE,0,45,183,2
+ CONTROL "",IDC_SPLITTERY,"Static",SS_ENHMETAFILE,0,45,183,2
CONTROL "",IDC_AVATAR,"Button",BS_OWNERDRAW | NOT WS_VISIBLE,1,50,1,13
END
@@ -151,7 +148,6 @@ BEGIN CONTROL "",IDC_POPLIST,"SysTreeView32",TVS_DISABLEDRAGDROP | TVS_NOTOOLTIPS | TVS_NONEVENHEIGHT | WS_BORDER | WS_HSCROLL | WS_TABSTOP,194,13,175,46
LTEXT "Automatically popup window when:",IDC_TXT_TITLE2,184,0,185,8
CONTROL "Show 'Send' button",IDC_SHOWSENDBTN,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,10,137,25,10
- CONTROL "Show username on top row",IDC_SHOWINFOLINE,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,11,161,26,10
CONTROL "Show toolbar buttons on top row",IDC_SHOWBUTTONLINE,
"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | WS_TABSTOP,11,174,28,10
CONTROL "Send message on double 'Enter'",IDC_SENDONDBLENTER,
diff --git a/src/core/stdmsg/src/chat_window.cpp b/src/core/stdmsg/src/chat_window.cpp index b10330eb3b..30f03c8421 100644 --- a/src/core/stdmsg/src/chat_window.cpp +++ b/src/core/stdmsg/src/chat_window.cpp @@ -153,7 +153,7 @@ static int RoomWndResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc) urc->rcItem.top = bTabs ? (bTabBottom ? 0 : rcTabs.top - 1) : 0; urc->rcItem.left = 0; urc->rcItem.right = bNick ? urc->dlgNewSize.cx - si->iSplitterX : urc->dlgNewSize.cx; - LBL_CalcBottom: +LBL_CalcBottom: urc->rcItem.bottom = urc->dlgNewSize.cy - si->iSplitterY; if (bTabs && bTabBottom) urc->rcItem.bottom += 6 - TabHeight; if (!bToolbar) urc->rcItem.bottom += 20; @@ -1070,48 +1070,6 @@ static void __cdecl phase2(void * lParam) PostMessage(si->hWnd, GC_REDRAWLOG3, 0, 0); } -static void SetButtonsPos(HWND hwndDlg) -{ - HDWP hdwp = BeginDeferWindowPos(Srmm_GetButtonCount()); - - RECT rc; - GetWindowRect(GetDlgItem(hwndDlg, IDC_SPLITTERY), &rc); - POINT pt = { 0, rc.bottom }; - ScreenToClient(hwndDlg, &pt); - pt.y -= 2; - - GetClientRect(hwndDlg, &rc); - int iLeftX = 2, iRightX = rc.right - 2; - - for (int i = 0;; i++) { - CustomButtonData *cbd = Srmm_GetNthButton(i); - if (cbd == NULL || cbd->m_bRSided) - break; - - HWND hwndButton = GetDlgItem(hwndDlg, cbd->m_dwButtonCID); - if (hwndButton == NULL) - continue; - - hdwp = DeferWindowPos(hdwp, hwndButton, NULL, iLeftX, pt.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE); - iLeftX += g_dat.iGap + cbd->m_iButtonWidth; - } - - for (int i = Srmm_GetButtonCount() - 1; i >= 0; i--) { - CustomButtonData *cbd = Srmm_GetNthButton(i); - if (!cbd->m_bRSided) - break; - - HWND hwndButton = GetDlgItem(hwndDlg, cbd->m_dwButtonCID); - if (hwndButton == NULL) - continue; - - iRightX -= g_dat.iGap + cbd->m_iButtonWidth; - hdwp = DeferWindowPos(hdwp, hwndButton, NULL, iRightX, pt.y, 0, 0, SWP_NOZORDER | SWP_NOSIZE); - } - - EndDeferWindowPos(hdwp); -} - INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { SESSION_INFO *s, *si = (SESSION_INFO*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); @@ -1349,7 +1307,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar SendMessage(si->hwndStatus, WM_SIZE, 0, 0); Utils_ResizeDialog(hwndDlg, g_hInst, MAKEINTRESOURCEA(IDD_CHANNEL), RoomWndResize, (LPARAM)si); - SetButtonsPos(hwndDlg); + SetButtonsPos(hwndDlg, true); InvalidateRect(si->hwndStatus, NULL, TRUE); RedrawWindow(GetDlgItem(hwndDlg, IDC_MESSAGE), NULL, NULL, RDW_INVALIDATE); diff --git a/src/core/stdmsg/src/globals.cpp b/src/core/stdmsg/src/globals.cpp index 4a591e99d9..e7ae4b7ffa 100644 --- a/src/core/stdmsg/src/globals.cpp +++ b/src/core/stdmsg/src/globals.cpp @@ -102,8 +102,6 @@ int AvatarChanged(WPARAM hContact, LPARAM lParam) void ReloadGlobals()
{
memset(&g_dat.flags, 0, sizeof(g_dat.flags));
- if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWINFOLINE, SRMSGDEFSET_SHOWINFOLINE))
- g_dat.flags.bShowInfo = true;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_SHOWBUTTONLINE, SRMSGDEFSET_SHOWBUTTONLINE))
g_dat.flags.bShowButtons = true;
if (db_get_b(NULL, SRMMMOD, SRMSGSET_SENDBUTTON, SRMSGDEFSET_SENDBUTTON))
diff --git a/src/core/stdmsg/src/globals.h b/src/core/stdmsg/src/globals.h index 39f6bf3c41..3809eed016 100644 --- a/src/core/stdmsg/src/globals.h +++ b/src/core/stdmsg/src/globals.h @@ -24,7 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct SrmmFlags
{
- bool bShowInfo : 1;
bool bShowButtons : 1;
bool bSendButton : 1;
bool bShowTyping : 1;
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 2f255f1bb2..1f91b2a80c 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -33,7 +33,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static void UpdateReadChars(HWND hwndDlg, HWND hwndStatus);
-static const UINT infoLineControls[] = { IDC_PROTOCOL, IDC_NAME };
static const UINT sendControls[] = { IDC_MESSAGE };
void NotifyLocalWinEvent(MCONTACT hContact, HWND hwnd, unsigned int type)
@@ -108,12 +107,6 @@ static void AddToFileList(wchar_t ***pppFiles, int *totalCount, const wchar_t* s }
}
-static void ShowMultipleControls(HWND hwndDlg, const UINT * controls, int cControls, int state)
-{
- for (int i = 0; i < cControls; i++)
- ShowWindow(GetDlgItem(hwndDlg, controls[i]), state);
-}
-
static void UpdateReadChars(HWND hwndDlg, HWND hwndStatus)
{
if (hwndStatus && g_dat.flags.bShowReadChar) {
@@ -170,10 +163,6 @@ static void SetupStatusBar(HWND hwndDlg, SrmmWindowData *dat) static void SetDialogToType(HWND hwndDlg)
{
SrmmWindowData *dat = (SrmmWindowData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- if (dat->hContact)
- ShowMultipleControls(hwndDlg, infoLineControls, _countof(infoLineControls), g_dat.flags.bShowInfo ? SW_SHOW : SW_HIDE);
- else
- ShowMultipleControls(hwndDlg, infoLineControls, _countof(infoLineControls), SW_HIDE);
CustomButtonData *cbd;
for (int i = 0; cbd = Srmm_GetNthButton(i); i++) {
@@ -181,13 +170,15 @@ static void SetDialogToType(HWND hwndDlg) if (hwndButton == NULL)
continue;
+ bool bShow = false;
if (dat->hContact) {
- if (cbd->m_dwButtonCID == IDC_ADD && !db_get_b(dat->hContact, "CList", "NotOnList", 0))
- ShowWindow(hwndButton, SW_HIDE);
- else
- ShowWindow(hwndButton, g_dat.flags.bShowButtons ? SW_SHOW : SW_HIDE);
+ if (cbd->m_dwButtonCID == IDC_ADD) {
+ bShow = 0 != db_get_b(dat->hContact, "CList", "NotOnList", 0);
+ cbd->m_bHidden = !bShow;
+ }
+ else bShow = g_dat.flags.bShowButtons;
}
- else ShowWindow(hwndButton, SW_HIDE);
+ ShowWindow(hwndButton, (bShow) ? SW_SHOW : SW_HIDE);
}
if (!dat->hwndStatus) {
@@ -197,7 +188,7 @@ static void SetDialogToType(HWND hwndDlg) }
ShowWindow(GetDlgItem(hwndDlg, IDCANCEL), SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_SPLITTER), SW_SHOW);
+ ShowWindow(GetDlgItem(hwndDlg, IDC_SPLITTERY), SW_SHOW);
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.bShowAvatar)
@@ -473,74 +464,18 @@ static LRESULT CALLBACK SplitterSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, return mir_callNextSubclass(hwnd, SplitterSubclassProc, msg, wParam, lParam);
}
-static void SetButtonsPos(SrmmWindowData *dat, HWND hwndDlg)
-{
- HDWP hdwp = BeginDeferWindowPos(Srmm_GetButtonCount());
-
- RECT rc;
- GetClientRect(GetDlgItem(hwndDlg, IDC_PROTOCOL), &rc);
- int iButtonY = rc.top + 4;
- if (!g_dat.flags.bShowInfo && !g_dat.flags.bShowButtons)
- iButtonY -= dat->lineHeight;
-
- GetClientRect(hwndDlg, &rc);
- int iButtonX = rc.right - 2;
- bool bIsRight = true;
-
- for (int i = Srmm_GetButtonCount()-1; i >= 0; i--) {
- CustomButtonData *cbd = Srmm_GetNthButton(i);
- iButtonX -= g_dat.iGap + cbd->m_iButtonWidth;
- if (cbd->m_bSeparator)
- continue;
-
- HWND hwndButton = GetDlgItem(hwndDlg, cbd->m_dwButtonCID);
- 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;
- iButtonX -= 8; // draw gap
- }
- }
-
- EndDeferWindowPos(hdwp);
-}
-
-static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc)
+static int MessageDialogResize(HWND, LPARAM lParam, UTILRESIZECONTROL *urc)
{
SrmmWindowData *dat = (SrmmWindowData*)lParam;
switch (urc->wId) {
- case IDC_NAME:
- {
- HWND h = GetDlgItem(hwndDlg, IDC_NAME);
- int len = GetWindowTextLength(h);
- if (len > 0) {
- wchar_t buf[256];
- GetWindowText(h, buf, _countof(buf));
-
- HDC hdc = GetDC(h);
- HFONT hFont = (HFONT)SelectObject(hdc, (HFONT)SendDlgItemMessage(hwndDlg, IDOK, WM_GETFONT, 0, 0));
-
- SIZE textSize;
- GetTextExtentPoint32(hdc, buf, (int)mir_wstrlen(buf), &textSize);
- urc->rcItem.right = urc->rcItem.left + textSize.cx + 10;
- 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);
- }
- }
- case IDC_PROTOCOL:
- return RD_ANCHORX_LEFT | RD_ANCHORY_TOP;
-
case IDC_LOG:
- if (!(g_dat.flags.bShowInfo) && !(g_dat.flags.bShowButtons))
+ if (!g_dat.flags.bShowButtons)
urc->rcItem.top -= dat->lineHeight;
urc->rcItem.bottom -= dat->splitterPos - dat->originalSplitterPos;
return RD_ANCHORX_WIDTH | RD_ANCHORY_HEIGHT;
- case IDC_SPLITTER:
+ case IDC_SPLITTERY:
urc->rcItem.top -= dat->splitterPos - dat->originalSplitterPos;
urc->rcItem.bottom -= dat->splitterPos - dat->originalSplitterPos;
return RD_ANCHORX_WIDTH | RD_ANCHORY_BOTTOM;
@@ -668,20 +603,14 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l dat->cmdListInd = -1;
dat->nTypeMode = PROTOTYPE_SELFTYPING_OFF;
SetTimer(hwndDlg, TIMERID_TYPE, 1000, NULL);
- {
- RECT rc, rc2;
- GetWindowRect(GetDlgItem(hwndDlg, IDC_PROTOCOL), &rc);
- GetWindowRect(hwndDlg, &rc2);
- dat->nLabelRight = rc2.right - rc.left;
-
- POINT pt;
- GetClientRect(GetDlgItem(hwndDlg, IDC_SPLITTER), &rc);
- pt.y = (rc.top + rc.bottom) / 2;
- pt.x = 0;
- dat->originalSplitterPos = pt.y;
- if (dat->splitterPos == -1)
- dat->splitterPos = dat->originalSplitterPos;// + 60;
- }
+
+ RECT rc;
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_SPLITTERY), &rc);
+ POINT pt = { 0, (rc.top + rc.bottom) / 2 };
+ ScreenToClient(hwndDlg, &pt);
+ dat->originalSplitterPos = pt.y;
+ if (dat->splitterPos == -1)
+ dat->splitterPos = dat->originalSplitterPos;
Srmm_CreateToolbarIcons(hwndDlg, BBBF_ISIMBUTTON);
@@ -689,9 +618,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l GetWindowRect(GetDlgItem(hwndDlg, IDC_MESSAGE), &dat->minEditInit);
SendMessage(hwndDlg, DM_UPDATESIZEBAR, 0, 0);
dat->hwndStatus = NULL;
- SendDlgItemMessage(hwndDlg, IDC_NAME, BUTTONSETASFLATBTN, TRUE, 0);
- EnableWindow(GetDlgItem(hwndDlg, IDC_PROTOCOL), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR), FALSE);
SendDlgItemMessage(hwndDlg, IDC_LOG, EM_SETOLECALLBACK, 0, (LPARAM)& reOleCallback);
@@ -709,7 +636,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l mir_subclassWindow(GetDlgItem(hwndDlg, IDC_MESSAGE), MessageEditSubclassProc);
SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SUBCLASSED, 0, 0);
- mir_subclassWindow(GetDlgItem(hwndDlg, IDC_SPLITTER), SplitterSubclassProc);
+ mir_subclassWindow(GetDlgItem(hwndDlg, IDC_SPLITTERY), SplitterSubclassProc);
if (dat->hContact) {
int historyMode = db_get_b(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, SRMSGDEFSET_LOADHISTORY);
@@ -897,7 +824,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l RECT rc;
GetWindowRect(GetDlgItem(hwndDlg, IDC_MESSAGE), &rc);
if (rc.bottom - rc.top < dat->minEditBoxSize.cy)
- SendMessage(hwndDlg, DM_SPLITTERMOVED, rc.top - (rc.bottom - rc.top - dat->minEditBoxSize.cy - 4), (LPARAM)GetDlgItem(hwndDlg, IDC_SPLITTER));
+ SendMessage(hwndDlg, DM_SPLITTERMOVED, rc.top - (rc.bottom - rc.top - dat->minEditBoxSize.cy - 4), (LPARAM)GetDlgItem(hwndDlg, IDC_SPLITTERY));
SendMessage(hwndDlg, WM_SIZE, 0, 0);
}
@@ -1021,9 +948,6 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l dat->wStatus = db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
wchar_t *contactName = pcli->pfnGetContactDisplayName(dat->hContact, 0);
- ptrW id(Contact_GetInfo(CNF_DISPLAYUID, dat->hContact, dat->szProto));
- SetDlgItemText(hwndDlg, IDC_NAME, (id) ? id : contactName);
-
wchar_t *szStatus = pcli->pfnGetStatusModeDescription(dat->szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE), 0);
if (statusIcon)
mir_snwprintf(newtitle, L"%s - %s", contactName, TranslateT("Message session"));
@@ -1032,7 +956,15 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)wParam;
if (!cws || (!mir_strcmp(cws->szModule, dat->szProto) && !mir_strcmp(cws->szSetting, "Status"))) {
- InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOCOL), NULL, TRUE);
+ if (dat->szProto) {
+ int dwStatus = db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
+ HICON hIcon = Skin_LoadProtoIcon(dat->szProto, dwStatus);
+ if (hIcon) {
+ SendDlgItemMessage(hwndDlg, IDC_USERMENU, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
+ IcoLib_ReleaseIcon(hIcon);
+ return TRUE;
+ }
+ }
if (statusIcon)
SendMessage(hwndDlg, DM_UPDATEWINICON, 0, 0);
}
@@ -1121,7 +1053,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l }
Utils_ResizeDialog(hwndDlg, g_hInst, MAKEINTRESOURCEA(IDD_MSG), MessageDialogResize, (LPARAM)dat);
- SetButtonsPos(dat, hwndDlg);
+ SetButtonsPos(hwndDlg, false);
// The statusbar sometimes draws over these 2 controls so
// redraw them
@@ -1138,7 +1070,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l break;
case DM_SPLITTERMOVED:
- if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SPLITTER)) {
+ if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_SPLITTERY)) {
HWND hwndLog = GetDlgItem(hwndDlg, IDC_LOG);
RECT rc, rcLog;
@@ -1299,29 +1231,13 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam;
if (dis->CtlType == ODT_MENU)
return Menu_DrawItem(lParam);
+
if (dis->hwndItem == dat->hwndStatus) {
DrawStatusIcons(dat->hContact, dis->hDC, dis->rcItem, 2);
return TRUE;
}
- if (dis->CtlID == IDC_PROTOCOL) {
- if (dat->szProto) {
- int dwStatus = db_get_w(dat->hContact, dat->szProto, "Status", ID_STATUS_OFFLINE);
- HICON hIcon = Skin_LoadProtoIcon(dat->szProto, dwStatus);
- if (hIcon) {
- if (db_get_dw(dat->hContact, dat->szProto, "IdleTS", 0)) {
- HIMAGELIST hImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 1, 0);
- ImageList_AddIcon(hImageList, hIcon);
- ImageList_DrawEx(hImageList, 0, dis->hDC, dis->rcItem.left, dis->rcItem.top, 0, 0, CLR_NONE, CLR_NONE, ILD_SELECTED);
- ImageList_Destroy(hImageList);
- }
- else DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL);
- IcoLib_ReleaseIcon(hIcon);
- return TRUE;
- }
- }
- }
- else if (dis->CtlID == IDC_AVATAR && dat->avatarPic && g_dat.flags.bShowAvatar) {
+ 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);
@@ -1392,7 +1308,6 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM l return TRUE;
case IDC_USERMENU:
- case IDC_NAME:
if (GetKeyState(VK_SHIFT) & 0x8000) // copy user name
SendMessage(hwndDlg, DM_USERNAMETOCLIP, 0, 0);
else {
diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp index c7b6095213..3b30ed1acb 100644 --- a/src/core/stdmsg/src/msgoptions.cpp +++ b/src/core/stdmsg/src/msgoptions.cpp @@ -196,7 +196,6 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP 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.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);
@@ -287,7 +286,6 @@ static INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LP db_set_dw(NULL, SRMMMOD, SRMSGSET_POPFLAGS, MakeCheckBoxTreeFlags(GetDlgItem(hwndDlg, IDC_POPLIST)));
db_set_b(NULL, SRMMMOD, SRMSGSET_DONOTSTEALFOCUS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DONOTSTEALFOCUS));
db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWBUTTONLINE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWBUTTONLINE));
- db_set_b(NULL, SRMMMOD, SRMSGSET_SHOWINFOLINE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWINFOLINE));
db_set_b(NULL, SRMMMOD, SRMSGSET_AUTOMIN, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOMIN));
db_set_b(NULL, SRMMMOD, SRMSGSET_AUTOCLOSE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_AUTOCLOSE));
db_set_b(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SAVEPERCONTACT));
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index bc41df08d5..a8ef67cecb 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -284,6 +284,9 @@ static void RestoreUnreadMessageAlerts(void) void RegisterSRMMFonts(void);
+/////////////////////////////////////////////////////////////////////////////////////////
+// toolbar buttons support
+
int RegisterToolbarIcons(WPARAM, LPARAM)
{
BBButton bbd = {};
@@ -380,6 +383,54 @@ int RegisterToolbarIcons(WPARAM, LPARAM) return 0;
}
+void SetButtonsPos(HWND hwndDlg, bool bIsChat)
+{
+ HDWP hdwp = BeginDeferWindowPos(Srmm_GetButtonCount());
+
+ int yPos;
+ RECT rc;
+ if (bIsChat) {
+ GetWindowRect(GetDlgItem(hwndDlg, IDC_SPLITTERY), &rc);
+ POINT pt = { 0, rc.top };
+ ScreenToClient(hwndDlg, &pt);
+ yPos = pt.y - 2;
+ }
+ else yPos = 2;
+
+ GetClientRect(hwndDlg, &rc);
+ int iLeftX = 2, iRightX = rc.right - 2;
+
+ for (int i = 0;; i++) {
+ CustomButtonData *cbd = Srmm_GetNthButton(i);
+ if (cbd == NULL || cbd->m_bRSided)
+ break;
+
+ HWND hwndButton = GetDlgItem(hwndDlg, cbd->m_dwButtonCID);
+ if (hwndButton == NULL || cbd->m_bHidden)
+ continue;
+
+ hdwp = DeferWindowPos(hdwp, hwndButton, NULL, iLeftX, yPos, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
+ iLeftX += g_dat.iGap + cbd->m_iButtonWidth;
+ }
+
+ for (int i = Srmm_GetButtonCount() - 1; i >= 0; i--) {
+ CustomButtonData *cbd = Srmm_GetNthButton(i);
+ if (!cbd->m_bRSided)
+ break;
+
+ HWND hwndButton = GetDlgItem(hwndDlg, cbd->m_dwButtonCID);
+ if (hwndButton == NULL || cbd->m_bHidden)
+ continue;
+
+ iRightX -= g_dat.iGap + cbd->m_iButtonWidth;
+ hdwp = DeferWindowPos(hdwp, hwndButton, NULL, iRightX, yPos, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
+ }
+
+ EndDeferWindowPos(hdwp);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
static int FontsChanged(WPARAM, LPARAM)
{
WindowList_Broadcast(pci->hWindowList, DM_OPTIONSAPPLIED, 0, 0);
diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index bdc3376f99..4d2439765c 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -49,7 +49,6 @@ struct SrmmWindowData : public MZeroedObject int lineHeight;
int windowWasCascaded;
DWORD nFlash;
- int nLabelRight;
int nTypeSecs;
int nTypeMode;
int avatarWidth;
diff --git a/src/core/stdmsg/src/resource.h b/src/core/stdmsg/src/resource.h index 3e90360cb3..03c73e2e25 100644 --- a/src/core/stdmsg/src/resource.h +++ b/src/core/stdmsg/src/resource.h @@ -68,8 +68,6 @@ #define IDC_AUTOMIN 1005
#define IDC_DONOTSTEALFOCUS 1006
#define IDC_SPLITTERY 1008
-#define IDC_SPLITTER 1008
-#define IDC_NAME 1009
#define IDC_BOLD 1010
#define IDC_ITALICS 1011
#define IDC_UNDERLINE 1012
@@ -95,7 +93,6 @@ #define IDC_SAVEPERCONTACT 1037
#define IDC_LOADCOUNTN 1039
#define IDC_LOADCOUNTSPIN 1040
-#define IDC_SHOWINFOLINE 1041
#define IDC_SHOWBUTTONLINE 1042
#define IDC_LOADUNREAD 1043
#define IDC_SENDONENTER 1043
@@ -150,7 +147,6 @@ #define IDC_DETAILS 1469
#define IDC_USERMENU 1471
#define IDC_STMSGLOGGROUP 1442
-#define IDC_PROTOCOL 1580
#define IDC_ERRORTEXT 1596
#define IDC_MSGTEXT 1597
#define IDC_SHOWNOTIFY 1600
diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h index 5ad3eaaf4a..92426c4a7a 100644 --- a/src/core/stdmsg/src/stdafx.h +++ b/src/core/stdmsg/src/stdafx.h @@ -155,6 +155,7 @@ int GetRichTextLength(HWND hwnd); UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *si, wchar_t* pszUID, wchar_t* pszWordText);
void DestroyGCMenu(HMENU *hMenu, int iIndex);
bool LoadMessageFont(LOGFONT *lf, COLORREF *colour);
+void SetButtonsPos(HWND hwndDlg, bool bIsChat);
// message.c
char* Message_GetFromStream(HWND hwndDlg, SESSION_INFO *si);
|