diff options
author | George Hazan <ghazan@miranda.im> | 2018-04-25 21:24:05 +0200 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-04-25 21:24:05 +0200 |
commit | a31fe673e91b64f994dc84f6ff9a9640b9306b60 (patch) | |
tree | 38a7022dc991e622daba210742425d56264a2118 /src | |
parent | 9e1808cd8b15596103cc6d4447740d0840d7d7f0 (diff) |
fixes #1302 (multiple problems with StdMsg window resizer)
Diffstat (limited to 'src')
-rw-r--r-- | src/core/stdmsg/res/resource.rc | 69 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgdialog.cpp | 77 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgs.h | 3 |
3 files changed, 96 insertions, 53 deletions
diff --git a/src/core/stdmsg/res/resource.rc b/src/core/stdmsg/res/resource.rc index b8656e01ac..dc3abac474 100644 --- a/src/core/stdmsg/res/resource.rc +++ b/src/core/stdmsg/res/resource.rc @@ -79,17 +79,17 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,104,91,61,14
END
-IDD_MSG DIALOGEX 0, 0, 185, 79
+IDD_MSG DIALOGEX 0, 0, 252, 140
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- CONTROL "",IDC_SRMM_MESSAGE,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x1144,1,49,141,29,WS_EX_ACCEPTFILES | WS_EX_STATICEDGE
- DEFPUSHBUTTON "&Send",IDOK,143,49,39,29
- PUSHBUTTON "Close",IDCANCEL,129,0,54,15,NOT WS_VISIBLE
- CONTROL "",IDC_SRMM_LOG,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x844,1,18,183,26,WS_EX_STATICEDGE
- CONTROL "",IDC_SPLITTERY,"Static",SS_ENHMETAFILE,0,45,183,2
- CONTROL "",IDC_AVATAR,"Button",BS_OWNERDRAW | NOT WS_VISIBLE,1,66,1,13
+ CONTROL "",IDC_SRMM_MESSAGE,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x1144,2,111,208,29,WS_EX_ACCEPTFILES | WS_EX_STATICEDGE
+ DEFPUSHBUTTON "&Send",IDOK,212,111,39,29
+ PUSHBUTTON "Close",IDCANCEL,197,0,54,15,NOT WS_VISIBLE
+ CONTROL "",IDC_SRMM_LOG,"RichEdit50W",WS_VSCROLL | WS_TABSTOP | 0x844,1,16,250,91,WS_EX_STATICEDGE
+ CONTROL "",IDC_SPLITTERY,"Static",SS_ENHMETAFILE,0,108,251,2
+ CONTROL "",IDC_AVATAR,"Button",BS_OWNERDRAW | NOT WS_VISIBLE,1,127,6,13
END
IDD_OPT_MSGLOG DIALOGEX 0, 0, 311, 164
@@ -158,11 +158,11 @@ BEGIN LISTBOX IDC_SRMM_NICKLIST,182,2,69,94,LBS_OWNERDRAWFIXED | LBS_NOINTEGRALHEIGHT | LBS_NODATA | NOT WS_BORDER | WS_VSCROLL | WS_TABSTOP,WS_EX_STATICEDGE
END
-IDD_CONTAINER DIALOGEX 0, 0, 252, 140
+IDD_CONTAINER DIALOGEX 0, 0, 275, 200
STYLE DS_SETFONT | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- CONTROL "Tab1",IDC_TAB,"SysTabControl32",TCS_MULTILINE,0,0,251,140
+ CONTROL "Tab1",IDC_TAB,"SysTabControl32",TCS_MULTILINE,0,0,275,200
END
IDD_FILTER DIALOGEX 0, 0, 83, 125
@@ -278,7 +278,7 @@ BEGIN IDD_MSG, DIALOG
BEGIN
- RIGHTMARGIN, 183
+ RIGHTMARGIN, 251
TOPMARGIN, 5
HORZGUIDE, 16
HORZGUIDE, 53
@@ -410,56 +410,100 @@ END // Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_BUNDERLINE ICON "underline.ico"
+
IDI_INCOMING ICON "incoming.ico"
+
IDI_OUTGOING ICON "outgoing.ico"
+
IDI_NOTICE ICON "notice.ico"
+
IDI_TAG1 ICON "tag1.ico"
+
IDI_TAG2 ICON "tag2.ico"
+
IDI_BBOLD ICON "bold.ico"
+
IDI_BITALICS ICON "italics.ico"
+
IDI_BSMILEY ICON "smiley.ico"
+
IDI_JOIN ICON "join.ico"
+
IDI_TOPIC ICON "topic.ico"
+
IDI_ADDSTATUS ICON "addmode.ico"
+
IDI_INFO ICON "info.ico"
+
IDI_KICK ICON "kick.ico"
+
IDI_MESSAGE ICON "message.ico"
+
IDI_NICK ICON "nick.ico"
+
IDI_EXCL ICON "excl.ico"
+
IDI_PART ICON "part.ico"
+
IDI_QUIT ICON "quit.ico"
+
IDI_REMSTATUS ICON "removestatus.ico"
+
IDI_HIGHLIGHT ICON "highlight.ico"
+
IDI_MESSAGEOUT ICON "messageout.ico"
+
IDI_ACTION ICON "action.ico"
+
IDI_TOPICBUT ICON "topicbut.ico"
+
IDI_BKGCOLOR ICON "bkgcolor.ico"
+
IDI_CHANMGR ICON "window.ico"
+
IDI_COLOR ICON "color.ico"
+
IDI_FILTER ICON "filter.ico"
+
IDI_HISTORY ICON "history.ico"
+
IDI_NICKLIST ICON "nicklist.ico"
+
IDI_BLANK ICON "blank.ico"
+
IDI_STATUS3 ICON "4.ico"
+
IDI_STATUS2 ICON "3.ico"
+
IDI_STATUS4 ICON "5.ico"
+
IDI_STATUS1 ICON "2.ico"
+
IDI_STATUS0 ICON "1.ico"
+
IDI_STATUS5 ICON "6.ico"
+
IDI_CLOSE ICON "close.ico"
+
IDI_OVERLAY ICON "overlay.ico"
+
IDI_NICKLIST2 ICON "nicklist2.ico"
+
IDI_FILTER2 ICON "filter2.ico"
+
/////////////////////////////////////////////////////////////////////////////
//
// Cursor
//
IDC_HYPERLINKHAND CURSOR "hyperlin.cur"
+
IDC_DROP CURSOR "dragcopy.cur"
+
IDC_DROPUSER CURSOR "dropuser.cur"
+
/////////////////////////////////////////////////////////////////////////////
//
// Menu
@@ -527,6 +571,11 @@ BEGIN 0
END
+IDD_MSG AFX_DIALOG_LAYOUT
+BEGIN
+ 0
+END
+
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 391788b319..3a47ac9689 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -125,20 +125,12 @@ void CSrmmWindow::OnInitDialog() else
m_wStatus = ID_STATUS_OFFLINE;
m_wOldStatus = m_wStatus;
- m_splitterPos = (int)db_get_dw(g_dat.bSavePerContact ? m_hContact : 0, SRMMMOD, "splitterPos", (DWORD)-1);
m_cmdListInd = -1;
m_nTypeMode = PROTOTYPE_SELFTYPING_OFF;
SetTimer(m_hwnd, TIMERID_TYPE, 1000, nullptr);
- RECT rc;
- GetWindowRect(GetDlgItem(m_hwnd, IDC_SPLITTERY), &rc);
- POINT pt = { 0, (rc.top + rc.bottom) / 2 };
- ScreenToClient(m_hwnd, &pt);
- m_originalSplitterPos = pt.y;
- if (m_splitterPos == -1)
- m_splitterPos = m_originalSplitterPos;
-
GetWindowRect(m_message.GetHwnd(), &m_minEditInit);
+ m_iSplitterY = (int)db_get_dw(g_dat.bSavePerContact ? m_hContact : 0, SRMMMOD, "splitterPos", m_minEditInit.bottom - m_minEditInit.top);
SendMessage(m_hwnd, DM_UPDATESIZEBAR, 0, 0);
m_avatar.Enable(false);
@@ -283,7 +275,7 @@ void CSrmmWindow::OnDestroy() m_cmdList.destroy();
MCONTACT hContact = (g_dat.bSavePerContact) ? m_hContact : 0;
- db_set_dw(hContact ? m_hContact : 0, SRMMMOD, "splitterPos", m_splitterPos);
+ db_set_dw(hContact ? m_hContact : 0, SRMMMOD, "splitterPos", m_iSplitterY);
if (m_hFont) {
DeleteObject(m_hFont);
@@ -429,15 +421,18 @@ void CSrmmWindow::OnOptionsApplied(bool bUpdateAvatar) void CSrmmWindow::OnSplitterMoved(CSplitter *pSplitter)
{
- RECT rc, rcLog;
+ RECT rc;
GetClientRect(m_hwnd, &rc);
- GetWindowRect(m_log.GetHwnd(), &rcLog);
+ m_iSplitterY = rc.bottom - pSplitter->GetPos();
+
+ int toplimit = 63;
+ if (!g_dat.bShowButtons)
+ toplimit += 22;
- int oldSplitterY = m_splitterPos;
- m_splitterPos = rc.bottom - pSplitter->GetPos() + 23;
- GetWindowRect(m_message.GetHwnd(), &rc);
- if (rc.bottom - rc.top + (m_splitterPos - oldSplitterY) < m_minEditBoxSize.cy)
- m_splitterPos = oldSplitterY + m_minEditBoxSize.cy - (rc.bottom - rc.top);
+ if (m_iSplitterY < m_minEditBoxSize.cy)
+ m_iSplitterY = m_minEditBoxSize.cy;
+ if (m_iSplitterY > rc.bottom - rc.top - toplimit)
+ m_iSplitterY = rc.bottom - rc.top - toplimit;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -644,30 +639,29 @@ int CSrmmWindow::Resizer(UTILRESIZECONTROL *urc) switch (urc->wId) {
case IDC_SRMM_LOG:
if (!g_dat.bShowButtons)
- urc->rcItem.top -= m_lineHeight;
- urc->rcItem.bottom -= m_splitterPos - m_originalSplitterPos;
- return RD_ANCHORX_WIDTH | RD_ANCHORY_HEIGHT;
+ urc->rcItem.top = 22;
+ urc->rcItem.bottom = urc->dlgNewSize.cy - m_iSplitterY;
+ return RD_ANCHORX_WIDTH | RD_ANCHORY_TOP;
case IDC_SPLITTERY:
- urc->rcItem.top -= m_splitterPos - m_originalSplitterPos;
- urc->rcItem.bottom -= m_splitterPos - m_originalSplitterPos;
- return RD_ANCHORX_WIDTH | RD_ANCHORY_BOTTOM;
+ urc->rcItem.top = urc->dlgNewSize.cy - m_iSplitterY;
+ urc->rcItem.bottom = urc->rcItem.top + 3;
+ return RD_ANCHORX_WIDTH | RD_ANCHORY_CUSTOM;
case IDC_SRMM_MESSAGE:
- if (!g_dat.bSendButton)
- urc->rcItem.right = urc->dlgNewSize.cx - urc->rcItem.left;
+ urc->rcItem.right = (g_dat.bSendButton) ? urc->dlgNewSize.cx - 64 : urc->dlgNewSize.cx;
if (g_dat.bShowAvatar && m_avatarPic)
urc->rcItem.left = m_avatarWidth + 4;
- urc->rcItem.top -= m_splitterPos - m_originalSplitterPos;
- if (!g_dat.bSendButton)
- return RD_ANCHORX_CUSTOM | RD_ANCHORY_BOTTOM;
- return RD_ANCHORX_WIDTH | RD_ANCHORY_BOTTOM;
+ urc->rcItem.top = urc->dlgNewSize.cy - m_iSplitterY + 3;
+ urc->rcItem.bottom = urc->dlgNewSize.cy - 1;
+ return RD_ANCHORX_CUSTOM | RD_ANCHORY_CUSTOM;
case IDCANCEL:
case IDOK:
- urc->rcItem.top -= m_splitterPos - m_originalSplitterPos;
- return RD_ANCHORX_RIGHT | RD_ANCHORY_BOTTOM;
+ urc->rcItem.top = urc->dlgNewSize.cy - m_iSplitterY + 3;
+ urc->rcItem.bottom = urc->dlgNewSize.cy - 1;
+ return RD_ANCHORX_RIGHT | RD_ANCHORY_CUSTOM;
case IDC_AVATAR:
urc->rcItem.top = urc->rcItem.bottom - (m_avatarHeight + 2);
@@ -986,16 +980,18 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) m_minEditBoxSize.cy = m_minEditInit.bottom - m_minEditInit.top;
if (g_dat.bShowAvatar) {
SendMessage(m_hwnd, DM_AVATARCALCSIZE, 0, 0);
- if (m_avatarPic && m_minEditBoxSize.cy <= m_avatarHeight)
- m_minEditBoxSize.cy = m_avatarHeight;
+ if (m_avatarPic && m_minEditBoxSize.cy <= m_avatarHeight) {
+ m_minEditBoxSize.cy = m_avatarHeight + 8;
+ if (m_iSplitterY < m_minEditBoxSize.cy) {
+ m_iSplitterY = m_minEditBoxSize.cy;
+ Resize();
+ }
+ }
}
break;
case DM_AVATARSIZECHANGE:
GetWindowRect(m_message.GetHwnd(), &rc);
- if (rc.bottom - rc.top < m_minEditBoxSize.cy)
- m_splitter.OnChange(&m_splitter);
-
Resize();
break;
@@ -1095,11 +1091,10 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_GETMINMAXINFO:
{
MINMAXINFO *mmi = (MINMAXINFO *)lParam;
- RECT rcWindow, rcLog;
- GetWindowRect(m_hwnd, &rcWindow);
- GetWindowRect(m_log.GetHwnd(), &rcLog);
- mmi->ptMinTrackSize.x = rcWindow.right - rcWindow.left - ((rcLog.right - rcLog.left) - m_minEditBoxSize.cx);
- mmi->ptMinTrackSize.y = rcWindow.bottom - rcWindow.top - ((rcLog.bottom - rcLog.top) - m_minEditBoxSize.cy);
+ if (mmi->ptMinTrackSize.x < 350)
+ mmi->ptMinTrackSize.x = 350;
+
+ mmi->ptMinTrackSize.y = m_iSplitterY + 80;
}
return 0;
diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index cc1c72b125..57acc69dd6 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -102,8 +102,7 @@ public: MEVENT m_hDbEventFirst, m_hDbEventLast;
int m_avatarWidth, m_avatarHeight;
- int m_splitterPos, m_originalSplitterPos;
- int m_lineHeight;
+ int m_iSplitterY;
int m_cmdListInd;
LIST<wchar_t> m_cmdList;
|