# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1323822210 0 # Node ID 632346743f465f5586fca6ff2de79947fcbc79c5 # Parent 508dde3dc398d08c3ebc11dcd88ac59df7c35b8d Fixed dw_window_redraw() on Windows not recalculating notebook page contents if the notebook size didn't change. Remove notebook page subclass and do the redrawing in _resize_box() itself. Fixed expandable boxes with no contents not consuming any space on OS/2, Windows and Mac. Added invalidated window redraw on entering dw_main() on OS/2, Windows and Mac. diff -r 508dde3dc398 -r 632346743f46 mac/dw.m --- a/mac/dw.m Sat Dec 10 23:27:21 2011 +0000 +++ b/mac/dw.m Wed Dec 14 00:23:30 2011 +0000 @@ -2469,19 +2469,25 @@ if(pass == 1) { (*depth)++; - + /* Save the newly calculated values on the box */ _resize_box(tmp, depth, x, y, pass); - + /* Duplicate the values in the item list for use below */ thisbox->items[z].width = tmp->minwidth; thisbox->items[z].height = tmp->minheight; - + + /* If the box has no contents but is expandable... default the size to 1 */ + if(!thisbox->items[z].width && thisbox->items[z].hsize) + thisbox->items[z].width = 1; + if(!thisbox->items[z].height && thisbox->items[z].vsize) + thisbox->items[z].height = 1; + (*depth)--; } } } - + /* Precalculate these values, since they will * be used used repeatedly in the next section. */ @@ -2775,6 +2781,8 @@ { dw_mutex_lock(DWRunMutex); DWThread = dw_thread_id(); + /* Make sure any queued redraws are handled */ + _dw_redraw(0, FALSE); [DWApp run]; DWThread = (DWTID)-1; dw_mutex_unlock(DWRunMutex); @@ -2799,7 +2807,7 @@ dw_mutex_lock(DWRunMutex); DWThread = curr; } - /* Process any pending events */ + /* Process any pending events */ while(_dw_main_iteration(until)) { /* Just loop */ diff -r 508dde3dc398 -r 632346743f46 os2/dw.c --- a/os2/dw.c Sat Dec 10 23:27:21 2011 +0000 +++ b/os2/dw.c Wed Dec 14 00:23:30 2011 +0000 @@ -1131,6 +1131,12 @@ thisbox->items[z].width = tmp->minwidth; thisbox->items[z].height = tmp->minheight; + /* If the box has no contents but is expandable... default the size to 1 */ + if(!thisbox->items[z].width && thisbox->items[z].hsize) + thisbox->items[z].width = 1; + if(!thisbox->items[z].height && thisbox->items[z].vsize) + thisbox->items[z].height = 1; + (*depth)--; } } @@ -3997,6 +4003,8 @@ QMSG qmsg; _dwtid = dw_thread_id(); + /* Make sure any queued redraws are handled */ + _dw_redraw(0, FALSE); while(WinGetMsg(dwhab, &qmsg, 0, 0, 0)) { diff -r 508dde3dc398 -r 632346743f46 win/dw.c --- a/win/dw.c Sat Dec 10 23:27:21 2011 +0000 +++ b/win/dw.c Wed Dec 14 00:23:30 2011 +0000 @@ -1122,7 +1122,6 @@ _focus_check_box_back(thisbox, handle, 2, 0); } } - /* This function calculates how much space the widgets and boxes require * and does expansion as necessary. */ @@ -1200,6 +1199,12 @@ thisbox->items[z].width = tmp->minwidth; thisbox->items[z].height = tmp->minheight; + /* If the box has no contents but is expandable... default the size to 1 */ + if(!thisbox->items[z].width && thisbox->items[z].hsize) + thisbox->items[z].width = 1; + if(!thisbox->items[z].height && thisbox->items[z].vsize) + thisbox->items[z].height = 1; + (*depth)--; } } @@ -1407,7 +1412,7 @@ MoveWindow(handle, currentx + pad, currenty + pad, width, height, FALSE); - if(percent) + if(percent && width > 0 && height > 0) _handle_splitbar_resize(handle, *percent, type, width, height); } else if(strnicmp(tmpbuf, STATICCLASSNAME, strlen(STATICCLASSNAME)+1)==0) @@ -1477,6 +1482,7 @@ TabCtrl_AdjustRect(handle,FALSE,&rect); MoveWindow(array[pageid]->hwnd, rect.left, rect.top, rect.right - rect.left, rect.bottom-rect.top, FALSE); + dw_window_redraw(array[pageid]->hwnd); } } /* So does the List View... handle delayed cursoring */ @@ -2965,23 +2971,20 @@ void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y) { - HWND handle1, handle2; - Box *tmp; + HWND handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); + HWND handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright"); + Box *tmp = (Box *)GetWindowLongPtr(handle1, GWLP_USERDATA); + + ShowWindow(handle1, SW_HIDE); + ShowWindow(handle2, SW_HIDE); if(type == DW_HORZ) { int newx = x; float ratio = (float)percent/(float)100.0; - handle1 = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); - handle2 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright"); - tmp = (Box *)GetWindowLongPtr(handle1, GWLP_USERDATA); - newx = (int)((float)newx * ratio) - (SPLITBAR_WIDTH/2); - ShowWindow(handle1, SW_HIDE); - ShowWindow(handle2, SW_HIDE); - MoveWindow(handle1, 0, 0, newx, y, FALSE); _do_resize(tmp, newx - 1, y - 1); @@ -2999,15 +3002,8 @@ int newy = y; float ratio = (float)(100.0-percent)/(float)100.0; - handle1 = (HWND)dw_window_get_data(hwnd, "_dw_bottomright"); - handle2 = (HWND)dw_window_get_data(hwnd, "_dw_topleft"); - tmp = (Box *)GetWindowLongPtr(handle1, GWLP_USERDATA); - newy = (int)((float)newy * ratio) - (SPLITBAR_WIDTH/2); - ShowWindow(handle1, SW_HIDE); - ShowWindow(handle2, SW_HIDE); - MoveWindow(handle1, 0, y - newy, x, newy, FALSE); _do_resize(tmp, x - 1, newy - 1); @@ -3706,6 +3702,8 @@ MSG msg; _dwtid = dw_thread_id(); + /* Make sure any queued redraws are handled */ + _dw_redraw(0, FALSE); while(GetMessage(&msg, NULL, 0, 0)) { @@ -6387,7 +6385,7 @@ } GetClassName(box, tmpbuf, 99); - + /* If we are in a scrolled box... extract the interal box */ if(strnicmp(tmpbuf, ScrollClassName, strlen(ScrollClassName)+1)==0) { @@ -6867,7 +6865,6 @@ HWND tmpbox = dw_box_new(DW_VERT, 0); dw_box_pack_start(tmpbox, page, 0, 0, TRUE, TRUE, 0); - SubclassWindow(tmpbox, _wndproc); if(array[pageid]->hwnd) dw_window_destroy(array[pageid]->hwnd); array[pageid]->hwnd = tmpbox; @@ -10211,7 +10208,8 @@ dw_window_get_pos_size(handle, NULL, NULL, &width, &height); - _handle_splitbar_resize(handle, percent, type, width, height); + if(width > 0 && height > 0) + _handle_splitbar_resize(handle, percent, type, width, height); } /*