# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1047915231 0 # Node ID 54aafc134652d7a2dbdbfa519e72b9a987ba44f5 # Parent 9160459247844d627ca1fcc5228d9af6ea219233 BOXVERT is now DW_VERT and BOXHORZ is now DW_HORZ. Also code cleanups, and fixed SHIFT-TAB through splitbars. Simplified the TAB and SHIFT-TAB handling code on OS/2. diff -r 916045924784 -r 54aafc134652 dw.h --- a/dw.h Mon Mar 17 14:45:08 2003 +0000 +++ b/dw.h Mon Mar 17 15:33:51 2003 +0000 @@ -319,18 +319,18 @@ #endif typedef struct _item { - /* Item type - Box or Item */ + /* Item type - Box or Item */ int type; - /* Handle to Frame or Window */ + /* Handle to Frame or Window */ HWND hwnd; - /* Width and Height of static size */ + /* Width and Height of static size */ int width, height, origwidth, origheight; - /* Size Type - Static or Expand */ + /* Size Type - Static or Expand */ int hsize, vsize; /* Padding */ int pad; /* Ratio of current item */ - float xratio, yratio; + float xratio, yratio; } Item; typedef struct _box { @@ -342,7 +342,7 @@ HWND hwndtitle; int titlebar; #endif - /* Number of items in the box */ + /* Number of items in the box */ int count; /* Box type - horizontal or vertical */ int type; @@ -353,7 +353,7 @@ /* Default item */ HWND defaultitem; /* Used as temporary storage in the calculation stage */ - int upx, upy, minheight, minwidth; + int upx, upy, minheight, minwidth; /* Ratio in this box */ float xratio, yratio, parentxratio, parentyratio; /* Used for calculating individual item ratios */ @@ -566,7 +566,7 @@ pthread_cond_t event; pthread_t thread; int alive; - int posted; + int posted; } *HEV; typedef pthread_t DWTID; typedef void * HMOD; @@ -574,7 +574,7 @@ typedef struct _hpixmap { unsigned long width, height; GdkPixmap *pixmap; - HWND handle; + HWND handle; } *HPIXMAP; typedef GtkWidget *HMENUI; @@ -597,18 +597,18 @@ #if !defined(__OS2__) && !defined(__EMX__) typedef struct _CDATE { - UCHAR day; - UCHAR month; - USHORT year; + UCHAR day; + UCHAR month; + USHORT year; } CDATE; typedef CDATE *PCDATE; typedef struct _CTIME { - UCHAR hours; - UCHAR minutes; - UCHAR seconds; - UCHAR ucReserved; + UCHAR hours; + UCHAR minutes; + UCHAR seconds; + UCHAR ucReserved; } CTIME; typedef CTIME *PCTIME; #endif @@ -653,8 +653,12 @@ #define DW_FILE_OPEN 0 #define DW_FILE_SAVE 1 -#define BOXHORZ 0 -#define BOXVERT 1 +#define DW_HORZ 0 +#define DW_VERT 1 + +/* Obsolete, should disappear sometime */ +#define BOXHORZ DW_HORZ +#define BOXVERT DW_VERT #define DW_SCROLL_UP 0 #define DW_SCROLL_DOWN 1 diff -r 916045924784 -r 54aafc134652 gtk/dw.c --- a/gtk/dw.c Mon Mar 17 14:45:08 2003 +0000 +++ b/gtk/dw.c Mon Mar 17 15:33:51 2003 +0000 @@ -3,7 +3,7 @@ * A GTK like implementation of the PM GUI * GTK forwarder module for portabilty. * - * (C) 2000-2002 Brian Smith + * (C) 2000-2003 Brian Smith * */ #include "dw.h" @@ -1006,7 +1006,7 @@ va_end(args); entrywindow = dw_window_new(HWND_DESKTOP, title, flStyle); - mainbox = dw_box_new(BOXVERT, 10); + mainbox = dw_box_new(DW_VERT, 10); dw_box_pack_start(entrywindow, mainbox, 0, 0, TRUE, TRUE, 0); /* Archive Name */ @@ -1016,7 +1016,7 @@ dw_box_pack_start(mainbox, stext, 205, 50, TRUE, TRUE, 2); /* Buttons */ - buttonbox = dw_box_new(BOXHORZ, 10); + buttonbox = dw_box_new(DW_HORZ, 10); dw_box_pack_start(mainbox, buttonbox, 0, 0, TRUE, FALSE, 0); @@ -1081,7 +1081,7 @@ entrywindow = dw_window_new(HWND_DESKTOP, title, flStyle); - mainbox = dw_box_new(BOXVERT, 10); + mainbox = dw_box_new(DW_VERT, 10); dw_box_pack_start(entrywindow, mainbox, 0, 0, TRUE, TRUE, 0); @@ -1092,7 +1092,7 @@ dw_box_pack_start(mainbox, stext, 205, 50, TRUE, TRUE, 2); /* Buttons */ - buttonbox = dw_box_new(BOXHORZ, 10); + buttonbox = dw_box_new(DW_HORZ, 10); dw_box_pack_start(mainbox, buttonbox, 0, 0, TRUE, FALSE, 0); @@ -1625,7 +1625,7 @@ /* * Create a new Box to be packed. * Parameters: - * type: Either BOXVERT (vertical) or BOXHORZ (horizontal). + * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). * pad: Number of pixels to pad around the box. */ HWND dw_box_new(int type, int pad) @@ -1649,7 +1649,7 @@ /* * Create a new Group Box to be packed. * Parameters: - * type: Either BOXVERT (vertical) or BOXHORZ (horizontal). + * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). * pad: Number of pixels to pad around the box. * title: Text to be displayined in the group outline. */ @@ -5892,7 +5892,7 @@ } } - if(boxtype == BOXVERT) + if(boxtype == DW_VERT) gtk_table_resize(GTK_TABLE(box), boxcount + 1, 1); else gtk_table_resize(GTK_TABLE(box), 1, boxcount + 1); @@ -6942,7 +6942,7 @@ /* * Creates a splitbar window (widget) with given parameters. * Parameters: - * type: Value can be BOXVERT or BOXHORZ. + * type: Value can be DW_VERT or DW_HORZ. * topleft: Handle to the window to be top or left. * bottomright: Handle to the window to be bottom or right. * Returns: @@ -6955,7 +6955,7 @@ float *percent = malloc(sizeof(float)); DW_MUTEX_LOCK; - if(type == BOXHORZ) + if(type == DW_HORZ) tmp = gtk_hpaned_new(); else tmp = gtk_vpaned_new(); @@ -7069,7 +7069,7 @@ } } - if(boxtype == BOXVERT) + if(boxtype == DW_VERT) { x = 0; y = boxcount; diff -r 916045924784 -r 54aafc134652 os2/dw.c --- a/os2/dw.c Mon Mar 17 14:45:08 2003 +0000 +++ b/os2/dw.c Mon Mar 17 15:33:51 2003 +0000 @@ -2,7 +2,7 @@ * Dynamic Windows: * A GTK like implementation of the PM GUI * - * (C) 2000-2002 Brian Smith + * (C) 2000-2003 Brian Smith * (C) 2000 Achim Hasenmueller * (C) 2000 Peter Nielsen * (C) 1998 Sergey I. Yevtushenko (some code borrowed from cell toolkit) @@ -366,7 +366,7 @@ int _focus_check_box(Box *box, HWND handle, int start, HWND defaultitem) { - int z; + int z, n; static HWND lasthwnd, firsthwnd; static int finish_searching; @@ -392,166 +392,98 @@ firsthwnd = 0; } - /* Vertical boxes are inverted on OS/2 */ - if(box->type == BOXVERT) - { - for(z=0;zcount;z++) + for(n=0;ncount;n++) + { + /* Vertical boxes are inverted on OS/2 */ + if(box->type == DW_VERT) + z = n; + else + z = box->count - n - 1; + + if(box->items[z].type == TYPEBOX) + { + Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER); + + if(thisbox && _focus_check_box(thisbox, handle, start == 3 ? 3 : 0, defaultitem)) + return 1; + } + else { - if(box->items[z].type == TYPEBOX) + if(box->items[z].hwnd == handle) + { + if(lasthwnd == handle && firsthwnd) + WinSetFocus(HWND_DESKTOP, firsthwnd); + else if(lasthwnd == handle && !firsthwnd) + finish_searching = 1; + else + WinSetFocus(HWND_DESKTOP, lasthwnd); + + /* If we aren't looking for the last handle, + * return immediately. + */ + if(!finish_searching) + return 1; + } + if(_validate_focus(box->items[z].hwnd)) { - Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER); - - if(thisbox && _focus_check_box(thisbox, handle, start == 3 ? 3 : 0, defaultitem)) - return 1; + /* Start is 3 when we are looking for the + * first valid item in the layout. + */ + if(start == 3) + { + if(!defaultitem || (defaultitem && defaultitem == box->items[z].hwnd)) + { + WinSetFocus(HWND_DESKTOP, box->items[z].hwnd); + return 1; + } + } + + if(!firsthwnd) + firsthwnd = box->items[z].hwnd; + + lasthwnd = box->items[z].hwnd; } else { - if(box->items[z].hwnd == handle) - { - if(lasthwnd == handle && firsthwnd) - WinSetFocus(HWND_DESKTOP, firsthwnd); - else if(lasthwnd == handle && !firsthwnd) - finish_searching = 1; - else - WinSetFocus(HWND_DESKTOP, lasthwnd); - - /* If we aren't looking for the last handle, - * return immediately. - */ - if(!finish_searching) - return 1; - } - if(_validate_focus(box->items[z].hwnd)) - { - /* Start is 3 when we are looking for the - * first valid item in the layout. - */ - if(start == 3) - { - if(!defaultitem || (defaultitem && defaultitem == box->items[z].hwnd)) - { - WinSetFocus(HWND_DESKTOP, box->items[z].hwnd); - return 1; - } - } - - if(!firsthwnd) - firsthwnd = box->items[z].hwnd; - - lasthwnd = box->items[z].hwnd; - } - else + char tmpbuf[100] = ""; + + WinQueryClassName(box->items[z].hwnd, 99, tmpbuf); + if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) { - char tmpbuf[100] = ""; - - WinQueryClassName(box->items[z].hwnd, 99, tmpbuf); - if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) + /* Then try the bottom or right box */ + HWND mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_bottomright"); + + if(mybox) { - /* Then try the bottom or right box */ - HWND mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_bottomright"); - - if(mybox) - { - Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER); - - if(splitbox && _focus_check_box(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) - return 1; - } - - /* Try the top or left box */ - mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_topleft"); - - if(mybox) - { - Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER); - - if(splitbox && _focus_check_box(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) - return 1; - } + Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER); + + if(splitbox && _focus_check_box(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) + return 1; } - else if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */ + + /* Try the top or left box */ + mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_topleft"); + + if(mybox) { - Box *notebox; - HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND, - (MPARAM)dw_notebook_page_query(box->items[z].hwnd), 0); - - if(page) - { - notebox = (Box *)WinQueryWindowPtr(page, QWP_USER); - - if(notebox && _focus_check_box(notebox, handle, start == 3 ? 3 : 0, defaultitem)) - return 1; - } + Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER); + + if(splitbox && _focus_check_box(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) + return 1; } } - } - } - } - else - { - for(z=box->count-1;z>-1;z--) - { - if(box->items[z].type == TYPEBOX) - { - Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER); - - if(thisbox && _focus_check_box(thisbox, handle, start == 3 ? 3 : 0, defaultitem)) - return 1; - } - else - { - if(box->items[z].hwnd == handle) - { - if(lasthwnd == handle && firsthwnd) - WinSetFocus(HWND_DESKTOP, firsthwnd); - else if(lasthwnd == handle && !firsthwnd) - finish_searching = 1; - else - WinSetFocus(HWND_DESKTOP, lasthwnd); - - /* If we aren't looking for the last handle, - * return immediately. - */ - if(!finish_searching) - return 1; - } - if(_validate_focus(box->items[z].hwnd)) + else if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */ { - /* Start is 3 when we are looking for the - * first valid item in the layout. - */ - if(start == 3) + Box *notebox; + HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND, + (MPARAM)dw_notebook_page_query(box->items[z].hwnd), 0); + + if(page) { - if(!defaultitem || (defaultitem && defaultitem == box->items[z].hwnd)) - { - WinSetFocus(HWND_DESKTOP, box->items[z].hwnd); + notebox = (Box *)WinQueryWindowPtr(page, QWP_USER); + + if(notebox && _focus_check_box(notebox, handle, start == 3 ? 3 : 0, defaultitem)) return 1; - } - } - - if(!firsthwnd) - firsthwnd = box->items[z].hwnd; - - lasthwnd = box->items[z].hwnd; - } - else - { - char tmpbuf[100] = ""; - - WinQueryClassName(box->items[z].hwnd, 99, tmpbuf); - if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */ - { - Box *notebox; - HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND, - (MPARAM)dw_notebook_page_query(box->items[z].hwnd), 0); - - if(page) - { - notebox = (Box *)WinQueryWindowPtr(page, QWP_USER); - - if(notebox && _focus_check_box(notebox, handle, start == 3 ? 3 : 0, defaultitem)) - return 1; - } } } } @@ -562,7 +494,7 @@ int _focus_check_box_back(Box *box, HWND handle, int start, HWND defaultitem) { - int z; + int z, n; static HWND lasthwnd, firsthwnd; static int finish_searching; @@ -588,142 +520,98 @@ firsthwnd = 0; } - /* Vertical boxes are inverted on OS/2 */ - if(box->type == BOXVERT) - { - for(z=box->count-1;z>-1;z--) + for(n=0;ncount;n++) + { + /* Vertical boxes are inverted on OS/2 */ + if(box->type == DW_VERT) + z = box->count - n - 1; + else + z = n; + + if(box->items[z].type == TYPEBOX) + { + Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER); + + if(thisbox && _focus_check_box_back(thisbox, handle, start == 3 ? 3 : 0, defaultitem)) + return 1; + } + else { - if(box->items[z].type == TYPEBOX) + if(box->items[z].hwnd == handle) + { + if(lasthwnd == handle && firsthwnd) + WinSetFocus(HWND_DESKTOP, firsthwnd); + else if(lasthwnd == handle && !firsthwnd) + finish_searching = 1; + else + WinSetFocus(HWND_DESKTOP, lasthwnd); + + /* If we aren't looking for the last handle, + * return immediately. + */ + if(!finish_searching) + return 1; + } + if(_validate_focus(box->items[z].hwnd)) { - Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER); - - if(thisbox && _focus_check_box_back(thisbox, handle, start == 3 ? 3 : 0, defaultitem)) - return 1; + /* Start is 3 when we are looking for the + * first valid item in the layout. + */ + if(start == 3) + { + if(!defaultitem || (defaultitem && defaultitem == box->items[z].hwnd)) + { + WinSetFocus(HWND_DESKTOP, box->items[z].hwnd); + return 1; + } + } + + if(!firsthwnd) + firsthwnd = box->items[z].hwnd; + + lasthwnd = box->items[z].hwnd; } else { - if(box->items[z].hwnd == handle) + char tmpbuf[100] = ""; + + WinQueryClassName(box->items[z].hwnd, 99, tmpbuf); + if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) { - if(lasthwnd == handle && firsthwnd) - WinSetFocus(HWND_DESKTOP, firsthwnd); - else if(lasthwnd == handle && !firsthwnd) - finish_searching = 1; - else - WinSetFocus(HWND_DESKTOP, lasthwnd); - - /* If we aren't looking for the last handle, - * return immediately. - */ - if(!finish_searching) - return 1; - } - if(_validate_focus(box->items[z].hwnd)) - { - /* Start is 3 when we are looking for the - * first valid item in the layout. - */ - if(start == 3) + /* Try the top or left box */ + HWND mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_topleft"); + + if(mybox) { - if(!defaultitem || (defaultitem && defaultitem == box->items[z].hwnd)) - { - WinSetFocus(HWND_DESKTOP, box->items[z].hwnd); + Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER); + + if(splitbox && _focus_check_box_back(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) return 1; - } } - if(!firsthwnd) - firsthwnd = box->items[z].hwnd; - - lasthwnd = box->items[z].hwnd; - } - else - { - char tmpbuf[100] = ""; - - WinQueryClassName(box->items[z].hwnd, 99, tmpbuf); - if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */ + /* Then try the bottom or right box */ + mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_bottomright"); + + if(mybox) { - Box *notebox; - HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND, - (MPARAM)dw_notebook_page_query(box->items[z].hwnd), 0); - - if(page) - { - notebox = (Box *)WinQueryWindowPtr(page, QWP_USER); - - if(notebox && _focus_check_box_back(notebox, handle, start == 3 ? 3 : 0, defaultitem)) - return 1; - } + Box *splitbox = (Box *)WinQueryWindowPtr(mybox, QWP_USER); + + if(splitbox && _focus_check_box_back(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) + return 1; } } - } - } - } - else - { - for(z=0;zcount;z++) - { - if(box->items[z].type == TYPEBOX) - { - Box *thisbox = WinQueryWindowPtr(box->items[z].hwnd, QWP_USER); - - if(thisbox && _focus_check_box_back(thisbox, handle, start == 3 ? 3 : 0, defaultitem)) - return 1; - } - else - { - if(box->items[z].hwnd == handle) - { - if(lasthwnd == handle && firsthwnd) - WinSetFocus(HWND_DESKTOP, firsthwnd); - else if(lasthwnd == handle && !firsthwnd) - finish_searching = 1; - else - WinSetFocus(HWND_DESKTOP, lasthwnd); - - /* If we aren't looking for the last handle, - * return immediately. - */ - if(!finish_searching) - return 1; - } - if(_validate_focus(box->items[z].hwnd)) + else if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */ { - /* Start is 3 when we are looking for the - * first valid item in the layout. - */ - if(start == 3) + Box *notebox; + HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND, + (MPARAM)dw_notebook_page_query(box->items[z].hwnd), 0); + + if(page) { - if(!defaultitem || (defaultitem && defaultitem == box->items[z].hwnd)) - { - WinSetFocus(HWND_DESKTOP, box->items[z].hwnd); + notebox = (Box *)WinQueryWindowPtr(page, QWP_USER); + + if(notebox && _focus_check_box_back(notebox, handle, start == 3 ? 3 : 0, defaultitem)) return 1; - } - } - - if(!firsthwnd) - firsthwnd = box->items[z].hwnd; - - lasthwnd = box->items[z].hwnd; - } - else - { - char tmpbuf[100] = ""; - - WinQueryClassName(box->items[z].hwnd, 99, tmpbuf); - if(strncmp(tmpbuf, "#40", 4)==0) /* Notebook */ - { - Box *notebox; - HWND page = (HWND)WinSendMsg(box->items[z].hwnd, BKM_QUERYPAGEWINDOWHWND, - (MPARAM)dw_notebook_page_query(box->items[z].hwnd), 0); - - if(page) - { - notebox = (Box *)WinQueryWindowPtr(page, QWP_USER); - - if(notebox && _focus_check_box_back(notebox, handle, start == 3 ? 3 : 0, defaultitem)) - return 1; - } } } } @@ -762,7 +650,7 @@ box = WinWindowFromID(lastbox, FID_CLIENT); if(box) thisbox = WinQueryWindowPtr(box, QWP_USER); - else + else thisbox = WinQueryWindowPtr(lastbox, QWP_USER); if(thisbox) @@ -783,7 +671,7 @@ box = WinWindowFromID(lastbox, FID_CLIENT); if(box) thisbox = WinQueryWindowPtr(box, QWP_USER); - else + else thisbox = WinQueryWindowPtr(lastbox, QWP_USER); if(thisbox) @@ -822,8 +710,8 @@ } else { - size += (type == BOXHORZ ? tmp->items[z].width : tmp->items[z].height); - origsize += (type == BOXHORZ ? tmp->items[z].origwidth : tmp->items[z].origheight); + size += (type == DW_HORZ ? tmp->items[z].width : tmp->items[z].height); + origsize += (type == DW_HORZ ? tmp->items[z].origwidth : tmp->items[z].origheight); } } } @@ -840,8 +728,8 @@ _count_size(tmp->items[z].hwnd, type, &tmpsize, &tmporigsize); else { - tmpsize = (type == BOXHORZ ? tmp->items[z].width : tmp->items[z].height); - tmporigsize = (type == BOXHORZ ? tmp->items[z].origwidth : tmp->items[z].origheight); + tmpsize = (type == DW_HORZ ? tmp->items[z].width : tmp->items[z].height); + tmporigsize = (type == DW_HORZ ? tmp->items[z].origwidth : tmp->items[z].origheight); } if(tmpsize > size) @@ -1019,7 +907,7 @@ tmp->xratio = thisbox->xratio; tmp->yratio = thisbox->yratio; - if(thisbox->type == BOXVERT) + if(thisbox->type == DW_VERT) { if((thisbox->items[z].width-((thisbox->items[z].pad*2)+(tmp->pad*2)))!=0) tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+(tmp->pad*2))))/((float)(thisbox->items[z].width-((thisbox->items[z].pad*2)+(tmp->pad*2)))); @@ -1029,7 +917,7 @@ if((thisbox->items[z].width-tmp->upx)!=0) tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-tmp->upx))/((float)(thisbox->items[z].width-tmp->upx)); } - if(thisbox->type == BOXHORZ) + if(thisbox->type == DW_HORZ) { if((thisbox->items[z].height-((thisbox->items[z].pad*2)+(tmp->pad*2)))!=0) tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+(tmp->pad*2))))/((float)(thisbox->items[z].height-((thisbox->items[z].pad*2)+(tmp->pad*2)))); @@ -1060,7 +948,7 @@ if(pass > 1 && *depth > 0) { - if(thisbox->type == BOXVERT) + if(thisbox->type == DW_VERT) { if((thisbox->minwidth-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))) == 0) thisbox->items[z].xratio = 1.0; @@ -1075,7 +963,7 @@ thisbox->items[z].xratio = ((float)((thisbox->width * thisbox->parentxratio)-thisbox->upx))/((float)(thisbox->minwidth-thisbox->upx)); } - if(thisbox->type == BOXHORZ) + if(thisbox->type == DW_HORZ) { if((thisbox->minheight-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))) == 0) thisbox->items[z].yratio = 1.0; @@ -1107,7 +995,7 @@ thisbox->items[z].yratio = thisbox->yratio; } - if(thisbox->type == BOXVERT) + if(thisbox->type == DW_VERT) { if((thisbox->items[z].width + (thisbox->items[z].pad*2)) > uxmax) uxmax = (thisbox->items[z].width + (thisbox->items[z].pad*2)); @@ -1138,7 +1026,7 @@ (*usedpadx) += thisbox->items[z].pad*2; } } - if(thisbox->type == BOXHORZ) + if(thisbox->type == DW_HORZ) { if((thisbox->items[z].height + (thisbox->items[z].pad*2)) > uymax) uymax = (thisbox->items[z].height + (thisbox->items[z].pad*2)); @@ -1185,9 +1073,9 @@ /* Any SIZEEXPAND items should be set to uxmax/uymax */ for(z=0;zcount;z++) { - if(thisbox->items[z].hsize == SIZEEXPAND && thisbox->type == BOXVERT) + if(thisbox->items[z].hsize == SIZEEXPAND && thisbox->type == DW_VERT) thisbox->items[z].width = uxmax-(thisbox->items[z].pad*2); - if(thisbox->items[z].vsize == SIZEEXPAND && thisbox->type == BOXHORZ) + if(thisbox->items[z].vsize == SIZEEXPAND && thisbox->type == DW_HORZ) thisbox->items[z].height = uymax-(thisbox->items[z].pad*2); /* Run this code segment again to finalize the sized after setting uxmax/uymax values. */ if(thisbox->items[z].type == TYPEBOX) @@ -1198,12 +1086,12 @@ { if(*depth > 0) { - if(thisbox->type == BOXVERT) + if(thisbox->type == DW_VERT) { tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/((float)(tmp->minwidth-((thisbox->items[z].pad*2)+(thisbox->pad*2)))); tmp->width = thisbox->items[z].width; } - if(thisbox->type == BOXHORZ) + if(thisbox->type == DW_HORZ) { tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/((float)(tmp->minheight-((thisbox->items[z].pad*2)+(thisbox->pad*2)))); tmp->height = thisbox->items[z].height; @@ -1298,9 +1186,9 @@ } - if(thisbox->type == BOXHORZ) + if(thisbox->type == DW_HORZ) currentx += width + vectorx + (pad * 2); - if(thisbox->type == BOXVERT) + if(thisbox->type == DW_VERT) currenty += height + vectory + (pad * 2); } } @@ -2615,7 +2503,7 @@ } else { - if(type == BOXHORZ) + if(type == DW_HORZ) { if(thisbox->items[z].hsize == SIZEEXPAND) thisbox->items[z].width = (int)(((float)thisbox->items[z].origwidth) * (((float)percent)/((float)100.0))); @@ -2631,7 +2519,7 @@ void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y) { - if(type == BOXHORZ) + if(type == DW_HORZ) { int newx = x; float ratio = (float)percent/(float)100.0; @@ -2713,7 +2601,7 @@ WinQueryWindowRect(hwnd, &rcl); - if(type == BOXHORZ) + if(type == DW_HORZ) { ptl[0].x = rcl.xLeft + start; ptl[0].y = rcl.yBottom; @@ -2738,7 +2626,7 @@ case WM_MOUSEMOVE: { - if(type == BOXHORZ) + if(type == DW_HORZ) WinSetPointer(HWND_DESKTOP, WinQuerySysPointer(HWND_DESKTOP, SPTR_SIZEWE, @@ -2763,7 +2651,7 @@ (PPOINTL)&rclBounds, 2); - if(type == BOXHORZ) + if(type == DW_HORZ) { rclFrame.xLeft = start; rclFrame.xRight = start + SPLITBAR_WIDTH; @@ -2783,7 +2671,7 @@ int width = (rclBounds.xRight - rclBounds.xLeft); int height = (rclBounds.yTop - rclBounds.yBottom); - if(type == BOXHORZ) + if(type == DW_HORZ) { start = rclFrame.xLeft - rclBounds.xLeft; if(width - SPLITBAR_WIDTH > 1 && start < width - SPLITBAR_WIDTH) @@ -3679,7 +3567,7 @@ WindowData *blah = calloc(1, sizeof(WindowData)); newbox->pad = 0; - newbox->type = BOXVERT; + newbox->type = DW_VERT; newbox->count = 0; flStyle |= FCF_NOBYTEALIGN; @@ -3706,7 +3594,7 @@ /* * Create a new Box to be packed. * Parameters: - * type: Either BOXVERT (vertical) or BOXHORZ (horizontal). + * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). * pad: Number of pixels to pad around the box. */ HWND API dw_box_new(int type, int pad) @@ -3740,7 +3628,7 @@ /* * Create a new Group Box to be packed. * Parameters: - * type: Either BOXVERT (vertical) or BOXHORZ (horizontal). + * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). * pad: Number of pixels to pad around the box. * title: Text to be displayined in the group outline. */ @@ -4914,7 +4802,7 @@ thisbox = WinQueryWindowPtr(box, QWP_USER); if(thisbox) { - if(thisbox->type == BOXHORZ) + if(thisbox->type == DW_HORZ) dw_box_pack_start_stub(box, item, width, height, hsize, vsize, pad); else dw_box_pack_end_stub(box, item, width, height, hsize, vsize, pad); @@ -5182,7 +5070,7 @@ */ void API dw_notebook_pack(HWND handle, ULONG pageid, HWND page) { - HWND tmpbox = dw_box_new(BOXVERT, 0); + HWND tmpbox = dw_box_new(DW_VERT, 0); dw_box_pack_start(tmpbox, page, 0, 0, TRUE, TRUE, 0); WinSubclassWindow(tmpbox, _wndproc); @@ -7396,7 +7284,7 @@ /* * Creates a splitbar window (widget) with given parameters. * Parameters: - * type: Value can be BOXVERT or BOXHORZ. + * type: Value can be DW_VERT or DW_HORZ. * topleft: Handle to the window to be top or left. * bottomright: Handle to the window to be bottom or right. * Returns: @@ -7416,14 +7304,14 @@ NULL); if(tmp) { - HWND tmpbox = dw_box_new(BOXVERT, 0); + HWND tmpbox = dw_box_new(DW_VERT, 0); float *percent = malloc(sizeof(float)); dw_box_pack_start(tmpbox, topleft, 1, 1, TRUE, TRUE, 0); WinSetParent(tmpbox, tmp, FALSE); dw_window_set_data(tmp, "_dw_topleft", (void *)tmpbox); - tmpbox = dw_box_new(BOXVERT, 0); + tmpbox = dw_box_new(DW_VERT, 0); dw_box_pack_start(tmpbox, bottomright, 1, 1, TRUE, TRUE, 0); WinSetParent(tmpbox, tmp, FALSE); *percent = 50.0; @@ -7491,7 +7379,7 @@ thisbox = WinQueryWindowPtr(box, QWP_USER); if(thisbox) { - if(thisbox->type == BOXHORZ) + if(thisbox->type == DW_HORZ) dw_box_pack_end_stub(box, item, width, height, hsize, vsize, pad); else dw_box_pack_start_stub(box, item, width, height, hsize, vsize, pad); diff -r 916045924784 -r 54aafc134652 win/dw.c --- a/win/dw.c Mon Mar 17 14:45:08 2003 +0000 +++ b/win/dw.c Mon Mar 17 15:33:51 2003 +0000 @@ -1,8 +1,9 @@ /* +/* * Dynamic Windows: * A GTK like implementation of the Win32 GUI * - * (C) 2000-2002 Brian Smith + * (C) 2000-2003 Brian Smith * */ #define _WIN32_IE 0x0500 @@ -547,8 +548,8 @@ if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) { - /* Then try the bottom or right box */ - HWND mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_bottomright"); + /* Try the top or left box */ + HWND mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_topleft"); if(mybox) { @@ -558,8 +559,8 @@ return 1; } - /* Try the top or left box */ - mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_topleft"); + /* Then try the bottom or right box */ + mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_bottomright"); if(mybox) { @@ -672,7 +673,31 @@ GetClassName(box->items[z].hwnd, tmpbuf, 99); - if(strnicmp(tmpbuf, WC_TABCONTROL, strlen(WC_TABCONTROL))==0) /* Notebook */ + if(strncmp(tmpbuf, SplitbarClassName, strlen(SplitbarClassName)+1)==0) + { + /* Then try the bottom or right box */ + HWND mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_bottomright"); + + if(mybox) + { + Box *splitbox = (Box *)GetWindowLong(mybox, GWL_USERDATA); + + if(splitbox && _focus_check_box_back(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) + return 1; + } + + /* Try the top or left box */ + mybox = (HWND)dw_window_get_data(box->items[z].hwnd, "_dw_topleft"); + + if(mybox) + { + Box *splitbox = (Box *)GetWindowLong(mybox, GWL_USERDATA); + + if(splitbox && _focus_check_box_back(splitbox, handle, start == 3 ? 3 : 0, defaultitem)) + return 1; + } + } + else if(strnicmp(tmpbuf, WC_TABCONTROL, strlen(WC_TABCONTROL))==0) /* Notebook */ { NotebookPage **array = (NotebookPage **)dw_window_get_data(box->items[z].hwnd, "_dw_array"); int pageid = TabCtrl_GetCurSel(box->items[z].hwnd); @@ -842,7 +867,7 @@ tmp->xratio = thisbox->xratio; tmp->yratio = thisbox->yratio; - if(thisbox->type == BOXVERT) + if(thisbox->type == DW_VERT) { if((thisbox->items[z].width-((thisbox->items[z].pad*2)+(tmp->pad*2)))!=0) tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+(tmp->pad*2))))/((float)(thisbox->items[z].width-((thisbox->items[z].pad*2)+(tmp->pad*2)))); @@ -852,7 +877,7 @@ if((thisbox->items[z].width-tmp->upx)!=0) tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-tmp->upx))/((float)(thisbox->items[z].width-tmp->upx)); } - if(thisbox->type == BOXHORZ) + if(thisbox->type == DW_HORZ) { if((thisbox->items[z].height-((thisbox->items[z].pad*2)+(tmp->pad*2)))!=0) tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+(tmp->pad*2))))/((float)(thisbox->items[z].height-((thisbox->items[z].pad*2)+(tmp->pad*2)))); @@ -883,7 +908,7 @@ if(pass > 1 && *depth > 0) { - if(thisbox->type == BOXVERT) + if(thisbox->type == DW_VERT) { if((thisbox->minwidth-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))) == 0) thisbox->items[z].xratio = 1.0; @@ -898,7 +923,7 @@ thisbox->items[z].xratio = ((float)((thisbox->width * thisbox->parentxratio)-thisbox->upx))/((float)(thisbox->minwidth-thisbox->upx)); } - if(thisbox->type == BOXHORZ) + if(thisbox->type == DW_HORZ) { if((thisbox->minheight-((thisbox->items[z].pad*2)+(thisbox->parentpad*2))) == 0) thisbox->items[z].yratio = 1.0; @@ -930,7 +955,7 @@ thisbox->items[z].yratio = thisbox->yratio; } - if(thisbox->type == BOXVERT) + if(thisbox->type == DW_VERT) { if((thisbox->items[z].width + (thisbox->items[z].pad*2)) > uxmax) uxmax = (thisbox->items[z].width + (thisbox->items[z].pad*2)); @@ -961,7 +986,7 @@ (*usedpadx) += thisbox->items[z].pad*2; } } - if(thisbox->type == BOXHORZ) + if(thisbox->type == DW_HORZ) { if((thisbox->items[z].height + (thisbox->items[z].pad*2)) > uymax) uymax = (thisbox->items[z].height + (thisbox->items[z].pad*2)); @@ -1008,9 +1033,9 @@ /* Any SIZEEXPAND items should be set to uxmax/uymax */ for(z=0;zcount;z++) { - if(thisbox->items[z].hsize == SIZEEXPAND && thisbox->type == BOXVERT) + if(thisbox->items[z].hsize == SIZEEXPAND && thisbox->type == DW_VERT) thisbox->items[z].width = uxmax-(thisbox->items[z].pad*2); - if(thisbox->items[z].vsize == SIZEEXPAND && thisbox->type == BOXHORZ) + if(thisbox->items[z].vsize == SIZEEXPAND && thisbox->type == DW_HORZ) thisbox->items[z].height = uymax-(thisbox->items[z].pad*2); /* Run this code segment again to finalize the sized after setting uxmax/uymax values. */ if(thisbox->items[z].type == TYPEBOX) @@ -1021,12 +1046,12 @@ { if(*depth > 0) { - if(thisbox->type == BOXVERT) + if(thisbox->type == DW_VERT) { tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/((float)(tmp->minwidth-((thisbox->items[z].pad*2)+(thisbox->pad*2)))); tmp->width = thisbox->items[z].width; } - if(thisbox->type == BOXHORZ) + if(thisbox->type == DW_HORZ) { tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-((thisbox->items[z].pad*2)+(thisbox->pad*2))))/((float)(tmp->minheight-((thisbox->items[z].pad*2)+(thisbox->pad*2)))); tmp->height = thisbox->items[z].height; @@ -1166,9 +1191,9 @@ } } - if(thisbox->type == BOXHORZ) + if(thisbox->type == DW_HORZ) currentx += width + vectorx + (pad * 2); - if(thisbox->type == BOXVERT) + if(thisbox->type == DW_VERT) currenty += height + vectory + (pad * 2); } } @@ -2405,7 +2430,7 @@ } else { - if(type == BOXHORZ) + if(type == DW_HORZ) { if(thisbox->items[z].hsize == SIZEEXPAND) thisbox->items[z].width = (int)(((float)thisbox->items[z].origwidth) * (((float)percent)/((float)100.0))); @@ -2421,7 +2446,7 @@ void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y) { - if(type == BOXHORZ) + if(type == DW_HORZ) { int newx = x; float ratio = (float)percent/(float)100.0; @@ -2507,7 +2532,7 @@ dw_window_get_pos_size(hwnd, NULL, NULL, &cx, &cy); - if(type == BOXHORZ) + if(type == DW_HORZ) Rectangle(hdcPaint, cx - start - SPLITBAR_WIDTH, 0, cx - start, cy); else Rectangle(hdcPaint, 0, start, cx, start + SPLITBAR_WIDTH); @@ -2532,7 +2557,7 @@ break; case WM_MOUSEMOVE: { - if(type == BOXHORZ) + if(type == DW_HORZ) SetCursor(LoadCursor(NULL, IDC_SIZEWE)); else SetCursor(LoadCursor(NULL, IDC_SIZENS)); @@ -2553,7 +2578,7 @@ int width = (rect.right - rect.left); int height = (rect.bottom - rect.top); - if(type == BOXHORZ) + if(type == DW_HORZ) { start = point.x - rect.left; if(width - SPLITBAR_WIDTH > 1 && start < width - SPLITBAR_WIDTH) @@ -3513,7 +3538,7 @@ ULONG flStyleEx = 0; newbox->pad = 0; - newbox->type = BOXVERT; + newbox->type = DW_VERT; newbox->count = 0; newbox->cinfo.fore = newbox->cinfo.back = -1; @@ -3550,7 +3575,7 @@ /* * Create a new Box to be packed. * Parameters: - * type: Either BOXVERT (vertical) or BOXHORZ (horizontal). + * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). * pad: Number of pixels to pad around the box. */ HWND API dw_box_new(int type, int pad) @@ -3583,7 +3608,7 @@ /* * Create a new Group Box to be packed. * Parameters: - * type: Either BOXVERT (vertical) or BOXHORZ (horizontal). + * type: Either DW_VERT (vertical) or DW_HORZ (horizontal). * pad: Number of pixels to pad around the box. * title: Text to be displayined in the group outline. */ @@ -4948,7 +4973,7 @@ if(pageid > -1 && array[pageid]) { - HWND tmpbox = dw_box_new(BOXVERT, 0); + HWND tmpbox = dw_box_new(DW_VERT, 0); dw_box_pack_start(tmpbox, page, 0, 0, TRUE, TRUE, 0); SubclassWindow(tmpbox, _wndproc); @@ -7211,7 +7236,7 @@ /* * Creates a splitbar window (widget) with given parameters. * Parameters: - * type: Value can be BOXVERT or BOXHORZ. + * type: Value can be DW_VERT or DW_HORZ. * topleft: Handle to the window to be top or left. * bottomright: Handle to the window to be bottom or right. * Returns: @@ -7230,14 +7255,14 @@ if(tmp) { - HWND tmpbox = dw_box_new(BOXVERT, 0); + HWND tmpbox = dw_box_new(DW_VERT, 0); float *percent = (float *)malloc(sizeof(float)); dw_box_pack_start(tmpbox, topleft, 1, 1, TRUE, TRUE, 0); SetParent(tmpbox, tmp); dw_window_set_data(tmp, "_dw_topleft", (void *)tmpbox); - tmpbox = dw_box_new(BOXVERT, 0); + tmpbox = dw_box_new(DW_VERT, 0); dw_box_pack_start(tmpbox, bottomright, 1, 1, TRUE, TRUE, 0); SetParent(tmpbox, tmp); dw_window_set_data(tmp, "_dw_bottomright", (void *)tmpbox);