Mercurial > dwindows
comparison os2/dw.c @ 1442:02a329b2b0cd
Added groupbox perfomance improvement to Windows and OS/2 that was missed when importing from the Mac.
Only calculate the groupbox border size on the first pass.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 08 Dec 2011 21:58:02 +0000 |
parents | 09fa437d6a5f |
children | 914ac25f7d37 |
comparison
equal
deleted
inserted
replaced
1441:b9577d1f0411 | 1442:02a329b2b0cd |
---|---|
1073 /* Reset the box sizes */ | 1073 /* Reset the box sizes */ |
1074 thisbox->minwidth = thisbox->minheight = thisbox->usedpadx = thisbox->usedpady = thisbox->pad * 2; | 1074 thisbox->minwidth = thisbox->minheight = thisbox->usedpadx = thisbox->usedpady = thisbox->pad * 2; |
1075 | 1075 |
1076 if(thisbox->grouphwnd) | 1076 if(thisbox->grouphwnd) |
1077 { | 1077 { |
1078 char *text = dw_window_get_text(thisbox->grouphwnd); | 1078 /* Only calculate the size on the first pass... |
1079 | 1079 * use the cached values on second. |
1080 thisbox->grouppady = 9; | |
1081 | |
1082 if(text) | |
1083 { | |
1084 if(*text) | |
1085 dw_font_text_extents_get(thisbox->grouphwnd, 0, text, NULL, &thisbox->grouppady); | |
1086 dw_free(text); | |
1087 } | |
1088 /* If the string height is less than 9... | |
1089 * set it to 9 anyway since that is the minimum. | |
1090 */ | 1080 */ |
1091 if(thisbox->grouppady < 9) | 1081 if(pass == 1) |
1082 { | |
1083 char *text = dw_window_get_text(thisbox->grouphwnd); | |
1084 | |
1092 thisbox->grouppady = 9; | 1085 thisbox->grouppady = 9; |
1093 | 1086 |
1094 if(thisbox->grouppady) | 1087 if(text) |
1095 thisbox->grouppady += 3; | 1088 { |
1096 else | 1089 if(*text) |
1097 thisbox->grouppady = 6; | 1090 dw_font_text_extents_get(thisbox->grouphwnd, 0, text, NULL, &thisbox->grouppady); |
1098 | 1091 dw_free(text); |
1099 thisbox->grouppadx = 6; | 1092 } |
1100 | 1093 /* If the string height is less than 9... |
1094 * set it to 9 anyway since that is the minimum. | |
1095 */ | |
1096 if(thisbox->grouppady < 9) | |
1097 thisbox->grouppady = 9; | |
1098 | |
1099 if(thisbox->grouppady) | |
1100 thisbox->grouppady += 3; | |
1101 else | |
1102 thisbox->grouppady = 6; | |
1103 | |
1104 thisbox->grouppadx = 6; | |
1105 } | |
1106 | |
1101 thisbox->minwidth += thisbox->grouppadx; | 1107 thisbox->minwidth += thisbox->grouppadx; |
1102 thisbox->usedpadx += thisbox->grouppadx; | 1108 thisbox->usedpadx += thisbox->grouppadx; |
1103 thisbox->minheight += thisbox->grouppady; | 1109 thisbox->minheight += thisbox->grouppady; |
1104 thisbox->usedpady += thisbox->grouppady; | 1110 thisbox->usedpady += thisbox->grouppady; |
1105 } | 1111 } |