Mercurial > dwindows
comparison os2/dw.c @ 457:e6b00c3e5086
Merging layout engine fix from the windows code.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 25 Jun 2003 04:43:33 +0000 |
parents | f1f188c678f3 |
children | 768f3546c4b5 |
comparison
equal
deleted
inserted
replaced
456:935436731b41 | 457:e6b00c3e5086 |
---|---|
880 int uymax = 0, uxmax = 0; | 880 int uymax = 0, uxmax = 0; |
881 int upymax = 0, upxmax = 0; | 881 int upymax = 0, upxmax = 0; |
882 /* Used for the SIZEEXPAND */ | 882 /* Used for the SIZEEXPAND */ |
883 int nux = *usedx, nuy = *usedy; | 883 int nux = *usedx, nuy = *usedy; |
884 int nupx = *usedpadx, nupy = *usedpady; | 884 int nupx = *usedpadx, nupy = *usedpady; |
885 int textheight = 0; | |
886 | 885 |
887 (*usedx) += (thisbox->pad * 2); | 886 (*usedx) += (thisbox->pad * 2); |
888 (*usedy) += (thisbox->pad * 2); | 887 (*usedy) += (thisbox->pad * 2); |
889 | 888 |
890 if(thisbox->grouphwnd) | 889 if(thisbox->grouphwnd) |
891 { | 890 { |
892 char *text = dw_window_get_text(thisbox->grouphwnd); | 891 char *text = dw_window_get_text(thisbox->grouphwnd); |
893 | 892 |
893 thisbox->grouppady = 0; | |
894 | |
894 if(text) | 895 if(text) |
895 { | 896 { |
896 dw_font_text_extents(thisbox->grouphwnd, 0, text, NULL, &textheight); | 897 dw_font_text_extents(thisbox->grouphwnd, 0, text, NULL, &thisbox->grouppady); |
897 dw_free(text); | 898 dw_free(text); |
898 } | 899 } |
899 | 900 |
900 (*usedx) += 6; | 901 if(thisbox->grouppady) |
901 (*usedpadx) += 6; | 902 thisbox->grouppady += 3; |
902 (*usedy) += textheight ? (3 + textheight) : 6; | 903 else |
903 (*usedpady) += textheight ? (3 + textheight) : 6; | 904 thisbox->grouppady = 6; |
905 | |
906 thisbox->grouppadx = 6; | |
907 | |
908 (*usedx) += thisbox->grouppadx; | |
909 (*usedpadx) += thisbox->grouppadx; | |
910 (*usedy) += thisbox->grouppady; | |
911 (*usedpady) += thisbox->grouppady; | |
904 } | 912 } |
905 | 913 |
906 for(z=0;z<thisbox->count;z++) | 914 for(z=0;z<thisbox->count;z++) |
907 { | 915 { |
908 if(thisbox->items[z].type == TYPEBOX) | 916 if(thisbox->items[z].type == TYPEBOX) |
944 | 952 |
945 /* Just in case */ | 953 /* Just in case */ |
946 tmp->xratio = thisbox->xratio; | 954 tmp->xratio = thisbox->xratio; |
947 tmp->yratio = thisbox->yratio; | 955 tmp->yratio = thisbox->yratio; |
948 | 956 |
949 if((thisbox->items[z].width-tmp->upx)!=0) | 957 if(thisbox->type == DW_VERT) |
950 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-tmp->upx))/((float)(thisbox->items[z].width-tmp->upx)); | 958 { |
951 if((thisbox->items[z].height-tmp->upy)!=0) | 959 int tmppad = (thisbox->items[z].pad*2)+(tmp->pad*2)+tmp->grouppady; |
952 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-tmp->upy))/((float)(thisbox->items[z].height-tmp->upy)); | 960 |
961 if((thisbox->items[z].width - tmppad)!=0) | |
962 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-tmppad))/((float)(thisbox->items[z].width-tmppad)); | |
963 } | |
964 else | |
965 { | |
966 if((thisbox->items[z].width-tmp->upx)!=0) | |
967 tmp->xratio = ((float)((thisbox->items[z].width * thisbox->xratio)-tmp->upx))/((float)(thisbox->items[z].width-tmp->upx)); | |
968 } | |
969 if(thisbox->type == DW_HORZ) | |
970 { | |
971 int tmppad = (thisbox->items[z].pad*2)+(tmp->pad*2)+tmp->grouppadx; | |
972 | |
973 if((thisbox->items[z].height-tmppad)!=0) | |
974 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-tmppad))/((float)(thisbox->items[z].height-tmppad)); | |
975 } | |
976 else | |
977 { | |
978 if((thisbox->items[z].height-tmp->upy)!=0) | |
979 tmp->yratio = ((float)((thisbox->items[z].height * thisbox->yratio)-tmp->upy))/((float)(thisbox->items[z].height-tmp->upy)); | |
980 } | |
953 | 981 |
954 nux = *usedx; nuy = *usedy; | 982 nux = *usedx; nuy = *usedy; |
955 upx = *usedpadx + (tmp->pad*2); upy = *usedpady + (tmp->pad*2); | 983 upx = *usedpadx + (tmp->pad*2); upy = *usedpady + (tmp->pad*2); |
956 } | 984 } |
957 | 985 |
969 } | 997 } |
970 } | 998 } |
971 | 999 |
972 if(pass > 1 && *depth > 0) | 1000 if(pass > 1 && *depth > 0) |
973 { | 1001 { |
974 if(thisbox->minwidth-thisbox->upx == 0) | 1002 if(thisbox->type == DW_VERT) |
975 thisbox->items[z].xratio = 1.0; | 1003 { |
1004 int tmppad = (thisbox->items[z].pad*2)+(thisbox->parentpad*2)+thisbox->grouppadx; | |
1005 | |
1006 if((thisbox->minwidth-tmppad) == 0) | |
1007 thisbox->items[z].xratio = 1.0; | |
1008 else | |
1009 thisbox->items[z].xratio = ((float)((thisbox->width * thisbox->parentxratio)-tmppad))/((float)(thisbox->minwidth-tmppad)); | |
1010 } | |
976 else | 1011 else |
977 thisbox->items[z].xratio = ((float)((thisbox->width * thisbox->parentxratio)-thisbox->upx))/((float)(thisbox->minwidth-thisbox->upx)); | 1012 { |
978 if(thisbox->minheight-thisbox->upy == 0) | 1013 if(thisbox->minwidth-thisbox->upx == 0) |
979 thisbox->items[z].yratio = 1.0; | 1014 thisbox->items[z].xratio = 1.0; |
1015 else | |
1016 thisbox->items[z].xratio = ((float)((thisbox->width * thisbox->parentxratio)-thisbox->upx))/((float)(thisbox->minwidth-thisbox->upx)); | |
1017 } | |
1018 | |
1019 if(thisbox->type == DW_HORZ) | |
1020 { | |
1021 int tmppad = (thisbox->items[z].pad*2)+(thisbox->parentpad*2)+thisbox->grouppady; | |
1022 | |
1023 if((thisbox->minheight-tmppad) == 0) | |
1024 thisbox->items[z].yratio = 1.0; | |
1025 else | |
1026 thisbox->items[z].yratio = ((float)((thisbox->height * thisbox->parentyratio)-tmppad))/((float)(thisbox->minheight-tmppad)); | |
1027 } | |
980 else | 1028 else |
981 thisbox->items[z].yratio = ((float)((thisbox->height * thisbox->parentyratio)-thisbox->upy))/((float)(thisbox->minheight-thisbox->upy)); | 1029 { |
1030 if(thisbox->minheight-thisbox->upy == 0) | |
1031 thisbox->items[z].yratio = 1.0; | |
1032 else | |
1033 thisbox->items[z].yratio = ((float)((thisbox->height * thisbox->parentyratio)-thisbox->upy))/((float)(thisbox->minheight-thisbox->upy)); | |
1034 } | |
982 | 1035 |
983 if(thisbox->items[z].type == TYPEBOX) | 1036 if(thisbox->items[z].type == TYPEBOX) |
984 { | 1037 { |
985 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER); | 1038 Box *tmp = WinQueryWindowPtr(thisbox->items[z].hwnd, QWP_USER); |
986 | 1039 |