changeset 438:fac2afe7bda3

Only throw up the messagebox when expand and size are both 0 and the item being packed is not a box. Also moved some private OS/2 prototypes out of the header.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 29 May 2003 09:18:54 +0000
parents 903fb3085d42
children 7f39be80dec3
files dw.h gtk/dw.c os2/dw.c win/dw.c
diffstat 4 files changed, 74 insertions(+), 51 deletions(-) [+]
line wrap: on
line diff
--- a/dw.h	Wed May 28 08:00:11 2003 +0000
+++ b/dw.h	Thu May 29 09:18:54 2003 +0000
@@ -525,8 +525,6 @@
 	char bubbletext[BUBBLE_HELP_MAX];
 } BubbleButton;
 
-void dw_box_pack_start_stub(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad);
-void dw_box_pack_end_stub(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad);
 #else
 /* GTK Specific section */
 #include <gtk/gtk.h>
--- a/gtk/dw.c	Wed May 28 08:00:11 2003 +0000
+++ b/gtk/dw.c	Thu May 29 09:18:54 2003 +0000
@@ -6169,18 +6169,6 @@
 	if(!box)
 		return;
 
-/* Can't use dw_messagebox() !!! */
-if ( width == 0 && hsize == FALSE )
-		dw_messagebox("dw_box_pack_end()", DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item);
-if ( height == 0 && vsize == FALSE )
-		dw_messagebox("dw_box_pack_end()", DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item);
-/*
-if ( width == 0 && hsize == FALSE )
-		fprintf(stderr,"dw_box_pack_end() - Width and expand Horizonal both unset for box: %lx item: %lx",(long)box,(long)item);
-if ( height == 0 && vsize == FALSE )
-		fprintf(stderr,"dw_box_pack_end() - Height and expand Vertical both unset for box: %lx item: %lx",(long)box,(long)item);
-*/
-
 	DW_MUTEX_LOCK;
 
 	if((tmp  = gtk_object_get_data(GTK_OBJECT(box), "_dw_boxhandle")))
@@ -6213,6 +6201,14 @@
 				item = eventbox;
 			}
 		}
+		else
+		{
+            /* Only show warning if item is not a box */
+			if ( width == 0 && hsize == FALSE )
+				dw_messagebox("dw_box_pack_end()", DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item);
+			if ( height == 0 && vsize == FALSE )
+				dw_messagebox("dw_box_pack_end()", DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item);
+		}
 
 		if(boxtype == DW_VERT)
 			gtk_table_resize(GTK_TABLE(box), boxcount + 1, 1);
@@ -6251,6 +6247,14 @@
 				item = eventbox;
 			}
 		}
+		else
+		{
+            /* Only show warning if item is not a box */
+			if ( width == 0 && hsize == FALSE )
+				dw_messagebox("dw_box_pack_end()", DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item);
+			if ( height == 0 && vsize == FALSE )
+				dw_messagebox("dw_box_pack_end()", DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item);
+		}
 
 		gtk_container_border_width(GTK_CONTAINER(box), pad);
 		gtk_container_add(GTK_CONTAINER(box), vbox);
@@ -7342,11 +7346,6 @@
 	if(!box)
 		return;
 
-if ( width == 0 && hsize == FALSE )
-		dw_messagebox("dw_box_pack_start()", DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item);
-if ( height == 0 && vsize == FALSE )
-		dw_messagebox("dw_box_pack_start()", DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item);
-
 	DW_MUTEX_LOCK;
 
 	if((tmp  = gtk_object_get_data(GTK_OBJECT(box), "_dw_boxhandle")))
@@ -7380,6 +7379,14 @@
 				item = eventbox;
 			}
 		}
+		else
+		{
+            /* Only show warning if item is not a box */
+			if ( width == 0 && hsize == FALSE )
+				dw_messagebox("dw_box_pack_start()", DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item);
+			if ( height == 0 && vsize == FALSE )
+				dw_messagebox("dw_box_pack_start()", DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item);
+		}
 
 		if(boxtype == DW_VERT)
 		{
@@ -7426,6 +7433,14 @@
 				item = eventbox;
 			}
 		}
+		else
+		{
+            /* Only show warning if item is not a box */
+			if ( width == 0 && hsize == FALSE )
+				dw_messagebox("dw_box_pack_start()", DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item);
+			if ( height == 0 && vsize == FALSE )
+				dw_messagebox("dw_box_pack_start()", DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item);
+		}
 
 		gtk_container_border_width(GTK_CONTAINER(box), pad);
 		gtk_container_add(GTK_CONTAINER(box), vbox);
--- a/os2/dw.c	Wed May 28 08:00:11 2003 +0000
+++ b/os2/dw.c	Thu May 29 09:18:54 2003 +0000
@@ -34,6 +34,8 @@
 void _do_resize(Box *thisbox, int x, int y);
 void _handle_splitbar_resize(HWND hwnd, float percent, int type, int x, int y);
 int _load_bitmap_file(char *file, HWND handle, HBITMAP *hbm, HDC *hdc, HPS *hps, unsigned long *width, unsigned long *height);
+void _dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad, char *functionname);
+void _dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad, char *functionname);
 
 char ClassName[] = "dynamicwindows";
 char SplitbarClassName[] = "dwsplitbar";
@@ -4976,11 +4978,6 @@
 {
 	Box *thisbox;
 
-if ( width == 0 && hsize == FALSE )
-		dw_messagebox("dw_box_pack_end()", DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item);
-if ( height == 0 && vsize == FALSE )
-		dw_messagebox("dw_box_pack_end()", DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item);
-
 	if(WinWindowFromID(box, FID_CLIENT))
 	{
 		box = WinWindowFromID(box, FID_CLIENT);
@@ -4991,13 +4988,13 @@
 	if(thisbox)
 	{
 		if(thisbox->type == DW_HORZ)
-			dw_box_pack_start_stub(box, item, width, height, hsize, vsize, pad);
+			_dw_box_pack_start(box, item, width, height, hsize, vsize, pad, "dw_box_pack_end()");
 		else
-			dw_box_pack_end_stub(box, item, width, height, hsize, vsize, pad);
-	}
-}
-
-void dw_box_pack_end_stub(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad)
+			_dw_box_pack_end(box, item, width, height, hsize, vsize, pad, "dw_box_pack_end()");
+	}
+}
+
+void _dw_box_pack_end(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad, char *functionname)
 {
 	Box *thisbox;
 
@@ -5044,7 +5041,14 @@
 		if(strncmp(tmpbuf, "#1", 3)==0)
 			tmpitem[thisbox->count].type = TYPEBOX;
 		else
+		{
+			if ( width == 0 && hsize == FALSE )
+				dw_messagebox(functionname, DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item);
+			if ( height == 0 && vsize == FALSE )
+				dw_messagebox(functionname, DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item);
+
 			tmpitem[thisbox->count].type = TYPEITEM;
+		}
 
 		tmpitem[thisbox->count].hwnd = item;
 		tmpitem[thisbox->count].origwidth = tmpitem[thisbox->count].width = width;
@@ -7620,11 +7624,6 @@
 {
 	Box *thisbox;
 
-if ( width == 0 && hsize == FALSE )
-		dw_messagebox("dw_box_pack_start()", DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item);
-if ( height == 0 && vsize == FALSE )
-		dw_messagebox("dw_box_pack_start()", DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item);
-
 	if(WinWindowFromID(box, FID_CLIENT))
 	{
 		box = WinWindowFromID(box, FID_CLIENT);
@@ -7635,13 +7634,13 @@
 	if(thisbox)
 	{
 		if(thisbox->type == DW_HORZ)
-			dw_box_pack_end_stub(box, item, width, height, hsize, vsize, pad);
+			_dw_box_pack_end(box, item, width, height, hsize, vsize, pad, "dw_box_pack_start()");
 		else
-			dw_box_pack_start_stub(box, item, width, height, hsize, vsize, pad);
-	}
-}
-
-void dw_box_pack_start_stub(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad)
+			_dw_box_pack_start(box, item, width, height, hsize, vsize, pad, "dw_box_pack_start()");
+	}
+}
+
+void _dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad, char *functionname)
 {
 	Box *thisbox;
 
@@ -7678,7 +7677,14 @@
 		if(strncmp(tmpbuf, "#1", 3)==0)
 			tmpitem[0].type = TYPEBOX;
 		else
+		{
+			if ( width == 0 && hsize == FALSE )
+				dw_messagebox(functionname, DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item);
+			if ( height == 0 && vsize == FALSE )
+				dw_messagebox(functionname, DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item);
+
 			tmpitem[0].type = TYPEITEM;
+		}
 
 		tmpitem[0].hwnd = item;
 		tmpitem[0].origwidth = tmpitem[0].width = width;
--- a/win/dw.c	Wed May 28 08:00:11 2003 +0000
+++ b/win/dw.c	Thu May 29 09:18:54 2003 +0000
@@ -4733,11 +4733,6 @@
 {
 	Box *thisbox;
 
-if ( width == 0 && hsize == FALSE )
-		dw_messagebox("dw_box_pack_start()", DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item);
-if ( height == 0 && vsize == FALSE )
-		dw_messagebox("dw_box_pack_start()", DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item);
-
 	thisbox = (Box *)GetWindowLong(box, GWL_USERDATA);
 	if(thisbox)
 	{
@@ -4762,7 +4757,14 @@
 		if(strnicmp(tmpbuf, FRAMECLASSNAME, 2)==0)
 			tmpitem[thisbox->count].type = TYPEBOX;
 		else
+		{
+			if ( width == 0 && hsize == FALSE )
+				dw_messagebox("dw_box_pack_start()", DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item);
+			if ( height == 0 && vsize == FALSE )
+				dw_messagebox("dw_box_pack_start()", DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item);
+
 			tmpitem[thisbox->count].type = TYPEITEM;
+		}
 
 		tmpitem[thisbox->count].hwnd = item;
 		tmpitem[thisbox->count].origwidth = tmpitem[thisbox->count].width = width;
@@ -7530,11 +7532,6 @@
 {
 	Box *thisbox;
 
-if ( width == 0 && hsize == FALSE )
-		dw_messagebox("dw_box_pack_end()", DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item);
-if ( height == 0 && vsize == FALSE )
-		dw_messagebox("dw_box_pack_end()", DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item);
-
 	thisbox = (Box *)GetWindowLong(box, GWL_USERDATA);
 	if(thisbox)
 	{
@@ -7559,7 +7556,14 @@
 		if(strnicmp(tmpbuf, FRAMECLASSNAME, 2)==0)
 			tmpitem[0].type = TYPEBOX;
 		else
+		{
+			if ( width == 0 && hsize == FALSE )
+				dw_messagebox("dw_box_pack_end()", DW_MB_OK|DW_MB_ERROR, "Width and expand Horizonal both unset for box: %x item: %x",box,item);
+			if ( height == 0 && vsize == FALSE )
+				dw_messagebox("dw_box_pack_end()", DW_MB_OK|DW_MB_ERROR, "Height and expand Vertical both unset for box: %x item: %x",box,item);
+
 			tmpitem[0].type = TYPEITEM;
+		}
 
 		tmpitem[0].hwnd = item;
 		tmpitem[0].origwidth = tmpitem[0].width = width;