To: [email protected]
Subject: Patch 7.4b.018
Fcc: outbox
From: Bram Moolenaar <[email protected]>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.4b.018 (after 7.4b.001)
Problem:    Win32: Dialog can still be too big.
Solution:   Move the check for height further down. (Andrei Olsen)
Files:      src/gui_w32.c


*** ../vim-7.4b.017/src/gui_w32.c       2013-08-01 13:20:23.000000000 +0200
--- src/gui_w32.c       2013-08-04 16:15:37.000000000 +0200
***************
*** 3184,3192 ****
     }
     else
     {
!       /* Use our own window's client area for the size, unless it's very
!        * small. */
!       GetClientRect(s_hwnd, &rect);
       maxDialogWidth = rect.right - rect.left
                                  - (GetSystemMetrics(SM_CXFRAME) +
                                       GetSystemMetrics(SM_CXPADDEDBORDER)) * 2;
--- 3184,3191 ----
     }
     else
     {
!       /* Use our own window for the size, unless it's very small. */
!       GetWindowRect(s_hwnd, &rect);
       maxDialogWidth = rect.right - rect.left
                                  - (GetSystemMetrics(SM_CXFRAME) +
                                       GetSystemMetrics(SM_CXPADDEDBORDER)) * 2;
***************
*** 3195,3201 ****

       maxDialogHeight = rect.bottom - rect.top
                                  - (GetSystemMetrics(SM_CYFRAME) +
!                                       GetSystemMetrics(SM_CXPADDEDBORDER)) * 4;
       if (maxDialogHeight < DLG_MIN_MAX_HEIGHT)
           maxDialogHeight = DLG_MIN_MAX_HEIGHT;
     }
--- 3194,3201 ----

       maxDialogHeight = rect.bottom - rect.top
                                  - (GetSystemMetrics(SM_CYFRAME) +
!                                       GetSystemMetrics(SM_CXPADDEDBORDER)) * 4
!                                  - GetSystemMetrics(SM_CYCAPTION);
       if (maxDialogHeight < DLG_MIN_MAX_HEIGHT)
           maxDialogHeight = DLG_MIN_MAX_HEIGHT;
     }
***************
*** 3262,3277 ****

     messageWidth += 10;               /* roundoff space */

-     /* Restrict the size to a maximum.  Causes a scrollbar to show up. */
-     if (msgheight > maxDialogHeight)
-     {
-       msgheight = maxDialogHeight;
-       scroll_flag = WS_VSCROLL;
-       messageWidth += GetSystemMetrics(SM_CXVSCROLL);
-     }
-
     /* Add width of icon to dlgwidth, and some space */
!     dlgwidth = messageWidth + DLG_ICON_WIDTH + 3 * dlgPaddingX;

     if (msgheight < DLG_ICON_HEIGHT)
       msgheight = DLG_ICON_HEIGHT;
--- 3262,3270 ----

     messageWidth += 10;               /* roundoff space */

     /* Add width of icon to dlgwidth, and some space */
!     dlgwidth = messageWidth + DLG_ICON_WIDTH + 3 * dlgPaddingX
!                                            + GetSystemMetrics(SM_CXVSCROLL);

     if (msgheight < DLG_ICON_HEIGHT)
       msgheight = DLG_ICON_HEIGHT;
***************
*** 3345,3352 ****

     // Dialog height.
     if (vertical)
!       dlgheight = msgheight + 2 * dlgPaddingY +
!                             DLG_VERT_PADDING_Y + 2 * fontHeight * numButtons;
     else
       dlgheight = msgheight + 3 * dlgPaddingY + 2 * fontHeight;

--- 3338,3345 ----

     // Dialog height.
     if (vertical)
!       dlgheight = msgheight + 2 * dlgPaddingY
!                          + DLG_VERT_PADDING_Y + 2 * fontHeight * numButtons;
     else
       dlgheight = msgheight + 3 * dlgPaddingY + 2 * fontHeight;

***************
*** 3355,3360 ****
--- 3348,3363 ----
     if (textfield != NULL)
       dlgheight += editboxheight;

+     /* Restrict the size to a maximum.  Causes a scrollbar to show up. */
+     if (dlgheight > maxDialogHeight)
+     {
+         msgheight = msgheight - (dlgheight - maxDialogHeight);
+         dlgheight = maxDialogHeight;
+         scroll_flag = WS_VSCROLL;
+         /* Make sure scrollbar doesn't appear in the middle of the dialog */
+         messageWidth = dlgwidth - DLG_ICON_WIDTH - 3 * dlgPaddingX;
+     }
+
     add_word(PixelToDialogY(dlgheight));

     add_word(0);      // Menu
*** ../vim-7.4b.017/src/version.c       2013-08-07 15:24:36.000000000 +0200
--- src/version.c       2013-08-07 15:25:41.000000000 +0200
***************
*** 729,730 ****
--- 729,732 ----
 {   /* Add new patch number below this line */
+ /**/
+     18,
 /**/

--
Over the years, I've developed my sense of deja vu so acutely that now
I can remember things that *have* happened before ...

/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
\\\            help me help AIDS victims -- http://ICCF-Holland.org    ///