comparison src/gui_w32.c @ 5284:7ed1ec814daf v7.4b.018

updated for version 7.4b.018 Problem: Win32: Dialog can still be too big. Solution: Move the check for height further down. (Andrei Olsen)
author Bram Moolenaar <bram@vim.org>
date Wed, 07 Aug 2013 15:27:11 +0200
parents 47a09a572ea6
children 1bff71d20262
comparison
equal deleted inserted replaced
5283:08a7a7143d69 5284:7ed1ec814daf
3182 /* Leave some room for the taskbar. */ 3182 /* Leave some room for the taskbar. */
3183 maxDialogHeight = workarea_rect.bottom - workarea_rect.top - 150; 3183 maxDialogHeight = workarea_rect.bottom - workarea_rect.top - 150;
3184 } 3184 }
3185 else 3185 else
3186 { 3186 {
3187 /* Use our own window's client area for the size, unless it's very 3187 /* Use our own window for the size, unless it's very small. */
3188 * small. */ 3188 GetWindowRect(s_hwnd, &rect);
3189 GetClientRect(s_hwnd, &rect);
3190 maxDialogWidth = rect.right - rect.left 3189 maxDialogWidth = rect.right - rect.left
3191 - (GetSystemMetrics(SM_CXFRAME) + 3190 - (GetSystemMetrics(SM_CXFRAME) +
3192 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2; 3191 GetSystemMetrics(SM_CXPADDEDBORDER)) * 2;
3193 if (maxDialogWidth < DLG_MIN_MAX_WIDTH) 3192 if (maxDialogWidth < DLG_MIN_MAX_WIDTH)
3194 maxDialogWidth = DLG_MIN_MAX_WIDTH; 3193 maxDialogWidth = DLG_MIN_MAX_WIDTH;
3195 3194
3196 maxDialogHeight = rect.bottom - rect.top 3195 maxDialogHeight = rect.bottom - rect.top
3197 - (GetSystemMetrics(SM_CYFRAME) + 3196 - (GetSystemMetrics(SM_CYFRAME) +
3198 GetSystemMetrics(SM_CXPADDEDBORDER)) * 4; 3197 GetSystemMetrics(SM_CXPADDEDBORDER)) * 4
3198 - GetSystemMetrics(SM_CYCAPTION);
3199 if (maxDialogHeight < DLG_MIN_MAX_HEIGHT) 3199 if (maxDialogHeight < DLG_MIN_MAX_HEIGHT)
3200 maxDialogHeight = DLG_MIN_MAX_HEIGHT; 3200 maxDialogHeight = DLG_MIN_MAX_HEIGHT;
3201 } 3201 }
3202 3202
3203 /* Set dlgwidth to width of message. 3203 /* Set dlgwidth to width of message.
3260 if (ga.ga_data != NULL) 3260 if (ga.ga_data != NULL)
3261 message = ga.ga_data; 3261 message = ga.ga_data;
3262 3262
3263 messageWidth += 10; /* roundoff space */ 3263 messageWidth += 10; /* roundoff space */
3264 3264
3265 /* Restrict the size to a maximum. Causes a scrollbar to show up. */
3266 if (msgheight > maxDialogHeight)
3267 {
3268 msgheight = maxDialogHeight;
3269 scroll_flag = WS_VSCROLL;
3270 messageWidth += GetSystemMetrics(SM_CXVSCROLL);
3271 }
3272
3273 /* Add width of icon to dlgwidth, and some space */ 3265 /* Add width of icon to dlgwidth, and some space */
3274 dlgwidth = messageWidth + DLG_ICON_WIDTH + 3 * dlgPaddingX; 3266 dlgwidth = messageWidth + DLG_ICON_WIDTH + 3 * dlgPaddingX
3267 + GetSystemMetrics(SM_CXVSCROLL);
3275 3268
3276 if (msgheight < DLG_ICON_HEIGHT) 3269 if (msgheight < DLG_ICON_HEIGHT)
3277 msgheight = DLG_ICON_HEIGHT; 3270 msgheight = DLG_ICON_HEIGHT;
3278 3271
3279 /* 3272 /*
3343 add_word(10); // y 3336 add_word(10); // y
3344 add_word(PixelToDialogX(dlgwidth)); // cx 3337 add_word(PixelToDialogX(dlgwidth)); // cx
3345 3338
3346 // Dialog height. 3339 // Dialog height.
3347 if (vertical) 3340 if (vertical)
3348 dlgheight = msgheight + 2 * dlgPaddingY + 3341 dlgheight = msgheight + 2 * dlgPaddingY
3349 DLG_VERT_PADDING_Y + 2 * fontHeight * numButtons; 3342 + DLG_VERT_PADDING_Y + 2 * fontHeight * numButtons;
3350 else 3343 else
3351 dlgheight = msgheight + 3 * dlgPaddingY + 2 * fontHeight; 3344 dlgheight = msgheight + 3 * dlgPaddingY + 2 * fontHeight;
3352 3345
3353 // Dialog needs to be taller if contains an edit box. 3346 // Dialog needs to be taller if contains an edit box.
3354 editboxheight = fontHeight + dlgPaddingY + 4 * DLG_VERT_PADDING_Y; 3347 editboxheight = fontHeight + dlgPaddingY + 4 * DLG_VERT_PADDING_Y;
3355 if (textfield != NULL) 3348 if (textfield != NULL)
3356 dlgheight += editboxheight; 3349 dlgheight += editboxheight;
3350
3351 /* Restrict the size to a maximum. Causes a scrollbar to show up. */
3352 if (dlgheight > maxDialogHeight)
3353 {
3354 msgheight = msgheight - (dlgheight - maxDialogHeight);
3355 dlgheight = maxDialogHeight;
3356 scroll_flag = WS_VSCROLL;
3357 /* Make sure scrollbar doesn't appear in the middle of the dialog */
3358 messageWidth = dlgwidth - DLG_ICON_WIDTH - 3 * dlgPaddingX;
3359 }
3357 3360
3358 add_word(PixelToDialogY(dlgheight)); 3361 add_word(PixelToDialogY(dlgheight));
3359 3362
3360 add_word(0); // Menu 3363 add_word(0); // Menu
3361 add_word(0); // Class 3364 add_word(0); // Class