From 2c1dfe99a104bfa3299ad386e542a572690a9fb1 Mon Sep 17 00:00:00 2001 From: Austen Combs <42984470+AustenCombs@users.noreply.github.com> Date: Wed, 8 Jul 2020 11:02:23 -0600 Subject: [PATCH 1/9] positional dependencies --- centrallix/htmlgen/htdrv_pane.c | 48 ++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/centrallix/htmlgen/htdrv_pane.c b/centrallix/htmlgen/htdrv_pane.c index 0683cc6e6..e08379396 100644 --- a/centrallix/htmlgen/htdrv_pane.c +++ b/centrallix/htmlgen/htdrv_pane.c @@ -156,17 +156,59 @@ htpnRender(pHtSession s, pWgtrNode tree, int z) /** Ok, write the style header items. **/ if (style == 2) /* flat */ { - htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w,h,z); + if (x > w && y > h) { + htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; RIGHT:%INTpx; BOTTOM:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w,h,z); + } + else if (x > w) + { + htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; RIGHT:%INTpx; TOP:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w,h,z); + } + else if (y > h) + { + htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; LEFT:%INTpx; BOTTOM:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w,h,z); + } + else + { + htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w,h,z); + } htrAddStylesheetItem_va(s,"\t#pn%POSmain { border-radius: %INTpx; %STR}\n",id,border_radius,main_bg); } else if (style == 0 || style == 1) /* lowered or raised */ { - htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow: hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w-2*box_offset,h-2*box_offset,z); + if (x > w && y > h) { + htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; RIGHT:%INTpx; BOTTOM:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w,h,z); + } + else if (x > w) + { + htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; RIGHT:%INTpx; TOP:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w,h,z); + } + else if (y > h) + { + htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; LEFT:%INTpx; BOTTOM:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w,h,z); + } + else + { + htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow: hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w-2*box_offset,h-2*box_offset,z); + } htrAddStylesheetItem_va(s,"\t#pn%POSmain { border-style: solid; border-width: 1px; border-color: %STR %STR %STR %STR; border-radius: %INTpx; %STR}\n",id,c1,c2,c2,c1,border_radius,main_bg); } else if (style == 3) /* bordered */ { - htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow: hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w-2*box_offset,h-2*box_offset,z); + if (x > w && y > h) { + htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; RIGHT:%INTpx; BOTTOM:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w,h,z); + } + else if (x > w) + { + htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; RIGHT:%INTpx; TOP:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w,h,z); + } + else if (y > h) + { + htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; LEFT:%INTpx; BOTTOM:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w,h,z); + } + else + { + htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow: hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w-2*box_offset,h-2*box_offset,z); + } htrAddStylesheetItem_va(s,"\t#pn%POSmain { border-style: solid; border-width: 1px; border-color:%STR&CSSVAL; border-radius: %INTpx; %STR}\n",id,bdr,border_radius,main_bg); } if (shadow_radius > 0) From e06a7618745722e973fe818cf5f6ea3f5b743d1c Mon Sep 17 00:00:00 2001 From: Austen Combs <42984470+AustenCombs@users.noreply.github.com> Date: Wed, 8 Jul 2020 11:39:22 -0600 Subject: [PATCH 2/9] revert previous position changes --- centrallix/htmlgen/htdrv_pane.c | 48 +++------------------------------ 1 file changed, 3 insertions(+), 45 deletions(-) diff --git a/centrallix/htmlgen/htdrv_pane.c b/centrallix/htmlgen/htdrv_pane.c index e08379396..0683cc6e6 100644 --- a/centrallix/htmlgen/htdrv_pane.c +++ b/centrallix/htmlgen/htdrv_pane.c @@ -156,59 +156,17 @@ htpnRender(pHtSession s, pWgtrNode tree, int z) /** Ok, write the style header items. **/ if (style == 2) /* flat */ { - if (x > w && y > h) { - htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; RIGHT:%INTpx; BOTTOM:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w,h,z); - } - else if (x > w) - { - htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; RIGHT:%INTpx; TOP:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w,h,z); - } - else if (y > h) - { - htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; LEFT:%INTpx; BOTTOM:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w,h,z); - } - else - { - htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w,h,z); - } + htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w,h,z); htrAddStylesheetItem_va(s,"\t#pn%POSmain { border-radius: %INTpx; %STR}\n",id,border_radius,main_bg); } else if (style == 0 || style == 1) /* lowered or raised */ { - if (x > w && y > h) { - htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; RIGHT:%INTpx; BOTTOM:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w,h,z); - } - else if (x > w) - { - htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; RIGHT:%INTpx; TOP:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w,h,z); - } - else if (y > h) - { - htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; LEFT:%INTpx; BOTTOM:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w,h,z); - } - else - { - htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow: hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w-2*box_offset,h-2*box_offset,z); - } + htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow: hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w-2*box_offset,h-2*box_offset,z); htrAddStylesheetItem_va(s,"\t#pn%POSmain { border-style: solid; border-width: 1px; border-color: %STR %STR %STR %STR; border-radius: %INTpx; %STR}\n",id,c1,c2,c2,c1,border_radius,main_bg); } else if (style == 3) /* bordered */ { - if (x > w && y > h) { - htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; RIGHT:%INTpx; BOTTOM:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w,h,z); - } - else if (x > w) - { - htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; RIGHT:%INTpx; TOP:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w,h,z); - } - else if (y > h) - { - htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; LEFT:%INTpx; BOTTOM:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w,h,z); - } - else - { - htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow: hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w-2*box_offset,h-2*box_offset,z); - } + htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow: hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w-2*box_offset,h-2*box_offset,z); htrAddStylesheetItem_va(s,"\t#pn%POSmain { border-style: solid; border-width: 1px; border-color:%STR&CSSVAL; border-radius: %INTpx; %STR}\n",id,bdr,border_radius,main_bg); } if (shadow_radius > 0) From 470b3b2be40880bc05fb7ca6f17bc917c77bbb11 Mon Sep 17 00:00:00 2001 From: Austen Combs <42984470+AustenCombs@users.noreply.github.com> Date: Thu, 9 Jul 2020 11:31:24 -0600 Subject: [PATCH 3/9] slow addition of calc() in width --- centrallix/htmlgen/htdrv_pane.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/centrallix/htmlgen/htdrv_pane.c b/centrallix/htmlgen/htdrv_pane.c index 0683cc6e6..971a0340d 100644 --- a/centrallix/htmlgen/htdrv_pane.c +++ b/centrallix/htmlgen/htdrv_pane.c @@ -156,17 +156,17 @@ htpnRender(pHtSession s, pWgtrNode tree, int z) /** Ok, write the style header items. **/ if (style == 2) /* flat */ { - htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w,h,z); + htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:calc(%POSpx); HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w,h,z); htrAddStylesheetItem_va(s,"\t#pn%POSmain { border-radius: %INTpx; %STR}\n",id,border_radius,main_bg); } else if (style == 0 || style == 1) /* lowered or raised */ { - htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow: hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w-2*box_offset,h-2*box_offset,z); + htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow: hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:calc(%POSpx); HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w-2*box_offset,h-2*box_offset,z); htrAddStylesheetItem_va(s,"\t#pn%POSmain { border-style: solid; border-width: 1px; border-color: %STR %STR %STR %STR; border-radius: %INTpx; %STR}\n",id,c1,c2,c2,c1,border_radius,main_bg); } else if (style == 3) /* bordered */ { - htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow: hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w-2*box_offset,h-2*box_offset,z); + htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow: hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:calc(%POSpx); HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w-2*box_offset,h-2*box_offset,z); htrAddStylesheetItem_va(s,"\t#pn%POSmain { border-style: solid; border-width: 1px; border-color:%STR&CSSVAL; border-radius: %INTpx; %STR}\n",id,bdr,border_radius,main_bg); } if (shadow_radius > 0) From 7dcc21d5c7e1989fa9b33054fde36149b10ae5c4 Mon Sep 17 00:00:00 2001 From: Austen Combs <42984470+AustenCombs@users.noreply.github.com> Date: Mon, 20 Jul 2020 11:48:23 -0600 Subject: [PATCH 4/9] initial calc function formation --- centrallix/htmlgen/htdrv_pane.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/centrallix/htmlgen/htdrv_pane.c b/centrallix/htmlgen/htdrv_pane.c index 971a0340d..9f82ab3f2 100644 --- a/centrallix/htmlgen/htdrv_pane.c +++ b/centrallix/htmlgen/htdrv_pane.c @@ -58,7 +58,7 @@ htpnRender(pHtSession s, pWgtrNode tree, int z) char name[64]; char main_bg[128]; char bdr[64]; - int x=-1,y=-1,w,h; + int x=-1,y=-1,w,h,parentW,parentH; int id; int style = 1; /* 0 = lowered, 1 = raised, 2 = none, 3 = bordered */ char* c1; @@ -91,6 +91,19 @@ htpnRender(pHtSession s, pWgtrNode tree, int z) return -1; } + pWgtrNode parentTree = wgtrGetRoot(tree); + + if (wgtrGetPropertyValue(parentTree,"width",DATA_T_INTEGER,POD(&parentW)) != 0) + { + mssError(1,"HTPN","Pane widget must have a 'width' property"); + return -1; + } + if (wgtrGetPropertyValue(parentTree,"height",DATA_T_INTEGER,POD(&parentH)) != 0) + { + mssError(1,"HTPN","Pane widget must have a 'height' property"); + return -1; + } + /** Border radius, for raised/lowered/bordered panes **/ if (wgtrGetPropertyValue(tree,"border_radius",DATA_T_INTEGER,POD(&border_radius)) != 0) border_radius=0; @@ -156,17 +169,17 @@ htpnRender(pHtSession s, pWgtrNode tree, int z) /** Ok, write the style header items. **/ if (style == 2) /* flat */ { - htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:calc(%POSpx); HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w,h,z); + htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:calc(%POSpx + (100%% - %POSpx)); HEIGHT:calc(%POSpx + (100%% - %POSpx)); Z-INDEX:%POS; }\n",id,x,y,w,parentW,h,parentH,z); htrAddStylesheetItem_va(s,"\t#pn%POSmain { border-radius: %INTpx; %STR}\n",id,border_radius,main_bg); } else if (style == 0 || style == 1) /* lowered or raised */ { - htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow: hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:calc(%POSpx); HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w-2*box_offset,h-2*box_offset,z); + htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow: hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:calc(%POSpx + (100%% - %POSpx)); HEIGHT:calc(%POSpx + (100%% - %POSpx)); Z-INDEX:%POS; }\n",id,x,y,w-2*box_offset,parentW,h-2*box_offset,parentH,z); htrAddStylesheetItem_va(s,"\t#pn%POSmain { border-style: solid; border-width: 1px; border-color: %STR %STR %STR %STR; border-radius: %INTpx; %STR}\n",id,c1,c2,c2,c1,border_radius,main_bg); } else if (style == 3) /* bordered */ { - htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow: hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:calc(%POSpx); HEIGHT:%POSpx; Z-INDEX:%POS; }\n",id,x,y,w-2*box_offset,h-2*box_offset,z); + htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow: hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:calc(%POSpx + (100%% - %POSpx)); HEIGHT:calc(%POSpx + (100%% - %POSpx)); Z-INDEX:%POS; }\n",id,x,y,w-2*box_offset,parentW,h-2*box_offset,parentH,z); htrAddStylesheetItem_va(s,"\t#pn%POSmain { border-style: solid; border-width: 1px; border-color:%STR&CSSVAL; border-radius: %INTpx; %STR}\n",id,bdr,border_radius,main_bg); } if (shadow_radius > 0) From 371edeb4e9333ebcdf117a13a196e57e1f058aa6 Mon Sep 17 00:00:00 2001 From: Austen Combs <42984470+AustenCombs@users.noreply.github.com> Date: Wed, 29 Jul 2020 14:56:01 -0600 Subject: [PATCH 5/9] new parameter for total width/height container flexibility --- centrallix/wgtr/wgtr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/centrallix/wgtr/wgtr.c b/centrallix/wgtr/wgtr.c index e2fd2c07c..f65f3b0a5 100755 --- a/centrallix/wgtr/wgtr.c +++ b/centrallix/wgtr/wgtr.c @@ -1515,7 +1515,8 @@ wgtrSetProperty(pWgtrNode widget, char* name, int datatype, pObjData val) pWgtrNode wgtrNewNode( char* name, char* type, pObjSession s, int rx, int ry, int rwidth, int rheight, - int flx, int fly, int flwidth, int flheight) + int flx, int fly, int flwidth, int flheight, + int flwidthTotal, int flheightTotal) { pWgtrNode node; @@ -1538,6 +1539,8 @@ wgtrNewNode( char* name, char* type, pObjSession s, node->fl_y = fly; node->fl_width = flwidth; node->fl_height = flheight; + node->total_flexW = flwidthTotal; /* added for total flexible width of container */ + node->total_flexH = flheightTotal; /* added for total flexible height of container */ node->ObjSession = s; node->Parent = NULL; node->min_height = 0; From 9fdeea85a765a34608311c10152aaba77be0040a Mon Sep 17 00:00:00 2001 From: Austen Combs <42984470+AustenCombs@users.noreply.github.com> Date: Wed, 29 Jul 2020 15:02:05 -0600 Subject: [PATCH 6/9] section and container flexibility gather flexibility information from the widget objects --- centrallix/htmlgen/htdrv_pane.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/centrallix/htmlgen/htdrv_pane.c b/centrallix/htmlgen/htdrv_pane.c index 9f82ab3f2..7d3269f38 100644 --- a/centrallix/htmlgen/htdrv_pane.c +++ b/centrallix/htmlgen/htdrv_pane.c @@ -58,7 +58,7 @@ htpnRender(pHtSession s, pWgtrNode tree, int z) char name[64]; char main_bg[128]; char bdr[64]; - int x=-1,y=-1,w,h,parentW,parentH; + int x=-1,y=-1,w,h,totalW,totalH,flexW,totalFlexW,flexH,totalFlexH; int id; int style = 1; /* 0 = lowered, 1 = raised, 2 = none, 3 = bordered */ char* c1; @@ -90,15 +90,35 @@ htpnRender(pHtSession s, pWgtrNode tree, int z) mssError(1,"HTPN","Pane widget must have a 'height' property"); return -1; } + if (wgtrGetPropertyValue(tree, "fl_width",DATA_T_INTEGER,POD(&flexW)) != 0) + { + mssError(1,"HTPN","Pane widget must have a 'fl_width' property"); + return -1; + } + if (wgtrGetPropertyValue(tree, "fl_height",DATA_T_INTEGER,POD(&flexH)) != 0) + { + mssError(1,"HTPN","Pane widget must have a 'fl_height' property"); + return -1; + } + if (wgtrGetPropertyValue(tree, "total_flexW",DATA_T_INTEGER,POD(&totalFlexW)) != 0) + { + mssError(1,"HTPN","Pane widget must have a 'total_flexW' property"); + return -1; + } + if (wgtrGetPropertyValue(tree, "total_flexH",DATA_T_INTEGER,POD(&totalFlexH)) != 0) + { + mssError(1,"HTPN","Pane widget must have a 'total_flexH' property"); + return -1; + } pWgtrNode parentTree = wgtrGetRoot(tree); - if (wgtrGetPropertyValue(parentTree,"width",DATA_T_INTEGER,POD(&parentW)) != 0) + if (wgtrGetPropertyValue(parentTree,"width",DATA_T_INTEGER,POD(&totalW)) != 0) { mssError(1,"HTPN","Pane widget must have a 'width' property"); return -1; } - if (wgtrGetPropertyValue(parentTree,"height",DATA_T_INTEGER,POD(&parentH)) != 0) + if (wgtrGetPropertyValue(parentTree,"height",DATA_T_INTEGER,POD(&totalH)) != 0) { mssError(1,"HTPN","Pane widget must have a 'height' property"); return -1; @@ -169,17 +189,17 @@ htpnRender(pHtSession s, pWgtrNode tree, int z) /** Ok, write the style header items. **/ if (style == 2) /* flat */ { - htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:calc(%POSpx + (100%% - %POSpx)); HEIGHT:calc(%POSpx + (100%% - %POSpx)); Z-INDEX:%POS; }\n",id,x,y,w,parentW,h,parentH,z); + htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:calc(%POSpx + (100%% - %POSpx) * (%POS/%POS)); HEIGHT:calc(%POSpx + (100%% - %POSpx) * (%POS/%POS)); Z-INDEX:%POS; }\n",id,x,y,w,totalW,flexW,totalFlexW,h,totalH,flexH,totalFlexH,totalz); htrAddStylesheetItem_va(s,"\t#pn%POSmain { border-radius: %INTpx; %STR}\n",id,border_radius,main_bg); } else if (style == 0 || style == 1) /* lowered or raised */ { - htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow: hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:calc(%POSpx + (100%% - %POSpx)); HEIGHT:calc(%POSpx + (100%% - %POSpx)); Z-INDEX:%POS; }\n",id,x,y,w-2*box_offset,parentW,h-2*box_offset,parentH,z); + htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow: hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:calc(%POSpx + (100%% - %POSpx) * (%POS/%POS)); HEIGHT:calc(%POSpx + (100%% - %POSpx) * (%POS/%POS)); Z-INDEX:%POS; }\n",id,x,y,w-2*box_offset,totalW,flexW,totalFlexW,h-2*box_offset,totalH,flexH,totalFlexH,totalz); htrAddStylesheetItem_va(s,"\t#pn%POSmain { border-style: solid; border-width: 1px; border-color: %STR %STR %STR %STR; border-radius: %INTpx; %STR}\n",id,c1,c2,c2,c1,border_radius,main_bg); } else if (style == 3) /* bordered */ { - htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow: hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:calc(%POSpx + (100%% - %POSpx)); HEIGHT:calc(%POSpx + (100%% - %POSpx)); Z-INDEX:%POS; }\n",id,x,y,w-2*box_offset,parentW,h-2*box_offset,parentH,z); + htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow: hidden; LEFT:%INTpx; TOP:%INTpx; WIDTH:calc(%POSpx + (100%% - %POSpx) * (%POS/%POS)); HEIGHT:calc(%POSpx + (100%% - %POSpx) * (%POS/%POS)); Z-INDEX:%POS; }\n",id,x,y,w-2*box_offset,totalW,flexW,totalFlexW,h-2*box_offset,totalH,flexH,totalFlexH,totalz); htrAddStylesheetItem_va(s,"\t#pn%POSmain { border-style: solid; border-width: 1px; border-color:%STR&CSSVAL; border-radius: %INTpx; %STR}\n",id,bdr,border_radius,main_bg); } if (shadow_radius > 0) From b04d1c6876a3a4f635ce2646df06f1a17dfc2178 Mon Sep 17 00:00:00 2001 From: Austen Combs <42984470+AustenCombs@users.noreply.github.com> Date: Wed, 29 Jul 2020 15:12:25 -0600 Subject: [PATCH 7/9] add fields for flexible width/height --- centrallix/include/wgtr.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/centrallix/include/wgtr.h b/centrallix/include/wgtr.h index 99f8c3760..2635e550d 100644 --- a/centrallix/include/wgtr.h +++ b/centrallix/include/wgtr.h @@ -101,6 +101,7 @@ typedef struct _WN int r_x, r_y, r_width, r_height; /** Requested geometry **/ int pre_x, pre_y, pre_width, pre_height; /** pre-layout geom. **/ int fl_x, fl_y, fl_width, fl_height;/** Flexibility **/ + int total_flexW, total_flexH; /** container flexibility **/ double fx, fy, fw, fh; /** internal flexibility calculations **/ int min_width, min_height; /** absolute minimums **/ int x, y, width, height; /** actual geometry **/ @@ -170,7 +171,8 @@ pWgtrNode wgtrParseOpenObject(pObject obj, pStruct app_params, pWgtrClientInfo c void wgtrFree(pWgtrNode tree); /** frees memory associated with a widget tree **/ pWgtrNode wgtrNewNode( char* name, char* type, pObjSession s, int rx, int ry, int rwidth, int rheight, - int flx, int fly, int flwidth, int flheight); /** create a new widget node **/ + int flx, int fly, int flwidth, int flheight + int flwidthTotal, int flheightTotal); /** create a new widget node **/ int wgtrSetupNode(pWgtrNode node); int wgtrMergeOverlays(pWgtrNode node, char* objpath, char* app_path, char* overlays[], char* templates[]); @@ -206,6 +208,8 @@ int wgtrSetDMPrivateData(pWgtrNode tree, void* data); void* wgtrGetDMPrivateData(pWgtrNode tree); int wgtrGetContainerHeight(pWgtrNode tree); int wgtrGetContainerWidth(pWgtrNode tree); +int wgtrGetContainerFlexWidth(pWgtrNode tree); /** get widget container flexible width **/ +int wgtrGetContainerFlexHeight(pWgtrNode tree); /** get widget container flexible height **/ int wgtrMoveChildren(pWgtrNode tree, int x_offset, int y_offset); /** misc. functions **/ From 6a5b3252bbb1eb658e89fca35c217e904c8271ca Mon Sep 17 00:00:00 2001 From: Austen Combs <42984470+AustenCombs@users.noreply.github.com> Date: Wed, 29 Jul 2020 15:24:11 -0600 Subject: [PATCH 8/9] add node property for width/height flexibility --- centrallix/wgtr/wgtr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/centrallix/wgtr/wgtr.c b/centrallix/wgtr/wgtr.c index f65f3b0a5..12294d5dc 100755 --- a/centrallix/wgtr/wgtr.c +++ b/centrallix/wgtr/wgtr.c @@ -624,6 +624,8 @@ wgtr_internal_LoadAttrs(pObject obj, char* name, char* type, pWgtrNode templates else if (!strcmp(prop_name,"fl_y")) this_node->fl_y = val.Integer; else if (!strcmp(prop_name,"fl_width")) this_node->fl_width = val.Integer; else if (!strcmp(prop_name,"fl_height")) this_node->fl_height = val.Integer; + else if (!strcmp(prop_name,"total_flexW")) this_node->total_flexW = val.Integer; + else if (!strcmp(prop_name,"total_flexH")) this_node->total_flexH = val.Integer; else wgtrAddProperty(this_node, prop_name, prop_type, &val, rval == 1); } else wgtrAddProperty(this_node, prop_name, prop_type, &val, rval == 1); From 979de6ef27eff8afb8b94aeb8d0ab5b2768a4a46 Mon Sep 17 00:00:00 2001 From: Austen Combs <42984470+AustenCombs@users.noreply.github.com> Date: Wed, 29 Jul 2020 15:41:47 -0600 Subject: [PATCH 9/9] total flex width/height properties --- centrallix/wgtr/wgtr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/centrallix/wgtr/wgtr.c b/centrallix/wgtr/wgtr.c index 12294d5dc..0b63e87b1 100755 --- a/centrallix/wgtr/wgtr.c +++ b/centrallix/wgtr/wgtr.c @@ -288,6 +288,8 @@ wgtrCopyInTemplate(pWgtrNode tree, pObject tree_obj, pWgtrNode match, char* base if (match->fl_y >= 0) tree->fl_y = match->fl_y; if (match->fl_width >= 0) tree->fl_width = match->fl_width; if (match->fl_height >= 0) tree->fl_height = match->fl_height; + if (match->total_flexW >= 0) tree->total_flexW = match->total_flexW; + if (match->total_flexH >= 0) tree->total_flexH = match->total_flexH; /** Check for substitutions **/ for(prop=objGetFirstAttr(tree_obj);prop;prop=objGetNextAttr(tree_obj)) @@ -352,7 +354,8 @@ wgtrCopyInTemplate(pWgtrNode tree, pObject tree_obj, pWgtrNode match, char* base snprintf(new_name, sizeof(new_name), "%s_%s", base_name, subtree->Name); if ((new_node = wgtrNewNode(new_name, subtree->Type, subtree->ObjSession, subtree->r_x, subtree->r_y, subtree->r_width, subtree->r_height, - subtree->fl_x, subtree->fl_y, subtree->fl_width, subtree->fl_height)) == NULL) + subtree->fl_x, subtree->fl_y, subtree->fl_width, subtree->fl_height, + subtree->total_flexW, subtree->total_flexH)) == NULL) return -1; if (wgtrSetupNode(new_node) < 0) @@ -624,8 +627,6 @@ wgtr_internal_LoadAttrs(pObject obj, char* name, char* type, pWgtrNode templates else if (!strcmp(prop_name,"fl_y")) this_node->fl_y = val.Integer; else if (!strcmp(prop_name,"fl_width")) this_node->fl_width = val.Integer; else if (!strcmp(prop_name,"fl_height")) this_node->fl_height = val.Integer; - else if (!strcmp(prop_name,"total_flexW")) this_node->total_flexW = val.Integer; - else if (!strcmp(prop_name,"total_flexH")) this_node->total_flexH = val.Integer; else wgtrAddProperty(this_node, prop_name, prop_type, &val, rval == 1); } else wgtrAddProperty(this_node, prop_name, prop_type, &val, rval == 1);