From 68d1f98c5bf16306dfa4673ef5c9bb1afa22b0bd Mon Sep 17 00:00:00 2001 From: Dmitry Kuzkin Date: Mon, 20 Aug 2012 12:16:59 +0000 Subject: - autoresize: max height of msg area is limited to history log height - rare crash fix git-svn-id: http://svn.miranda-ng.org/main/trunk@1506 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Scriver/src/msgdialog.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'plugins/Scriver/src') diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index a5bb8d92dd..6324cc3e62 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -524,18 +524,27 @@ static void MessageDialogResize(HWND hwndDlg, struct SrmmWindowData *dat, int w, ParentWindowData *pdat = dat->parent; int hSplitterPos = dat->splitterPos, toolbarHeight = pdat->flags2&SMF2_SHOWTOOLBAR ? IsToolbarVisible(SIZEOF(toolbarButtons), g_dat->buttonVisibility) ? dat->toolbarSize.cy : dat->toolbarSize.cy / 3 : 0; int hSplitterMinTop = toolbarHeight + dat->windowData.minLogBoxHeight, hSplitterMinBottom = dat->windowData.minEditBoxHeight; - int infobarHeight = INFO_BAR_INNER_HEIGHT; + int infobarInnerHeight = INFO_BAR_INNER_HEIGHT; + int infobarHeight = INFO_BAR_HEIGHT; int avatarWidth = 0, avatarHeight = 0; int toolbarWidth = w; int messageEditWidth = w - 2; int logY, logH; + if (!dat->infobarData) + return; + if (!(pdat->flags2 & SMF2_SHOWINFOBAR)) { infobarHeight = 0; + infobarInnerHeight = 0; } hSplitterPos = dat->desiredInputAreaHeight + SPLITTER_HEIGHT + 3; - if (h - hSplitterPos - INFO_BAR_HEIGHT< hSplitterMinTop) { - hSplitterPos = h - hSplitterMinTop - INFO_BAR_HEIGHT; + + if (hSplitterPos > ( h - toolbarHeight - infobarHeight + SPLITTER_HEIGHT + 1 ) / 2) + hSplitterPos = ( h - toolbarHeight - infobarHeight + SPLITTER_HEIGHT + 1 ) / 2; + + if (h - hSplitterPos - infobarHeight < hSplitterMinTop) { + hSplitterPos = h - hSplitterMinTop - infobarHeight; } if (hSplitterPos < avatarHeight) { hSplitterPos = avatarHeight; @@ -567,10 +576,10 @@ static void MessageDialogResize(HWND hwndDlg, struct SrmmWindowData *dat, int w, dat->splitterPos = hSplitterPos; - logY = infobarHeight; - logH = h-hSplitterPos-toolbarHeight - infobarHeight; + logY = infobarInnerHeight; + logH = h-hSplitterPos-toolbarHeight - infobarInnerHeight; hdwp = BeginDeferWindowPos(15); - hdwp = DeferWindowPos(hdwp, dat->infobarData->hWnd, 0, 1, 0, w - 2, infobarHeight - 2, SWP_NOZORDER); + hdwp = DeferWindowPos(hdwp, dat->infobarData->hWnd, 0, 1, 0, w - 2, infobarInnerHeight - 2, SWP_NOZORDER); hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_LOG), 0, 1, logY, w-2, logH, SWP_NOZORDER); hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_MESSAGE), 0, 1, h - hSplitterPos + SPLITTER_HEIGHT, messageEditWidth, hSplitterPos - SPLITTER_HEIGHT - 1, SWP_NOZORDER); hdwp = DeferWindowPos(hdwp, GetDlgItem(hwndDlg, IDC_AVATAR), 0, w-avatarWidth - 1, h - (avatarHeight + avatarWidth) / 2 - 1, avatarWidth, avatarWidth, SWP_NOZORDER); -- cgit v1.2.3