Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
575d743
Changed pixel formatting cues to percentage
CarlYunghans Jun 9, 2020
67a8259
Testing
CarlYunghans Jun 10, 2020
fc20125
Update ht_render.c
CarlYunghans Jun 10, 2020
aeb1ebd
Changed formatting of scale and location values from pixel to percentage
CarlYunghans Jun 10, 2020
5c8ae62
Changed formatting of scale and location items from pixel to percentage
CarlYunghans Jun 10, 2020
2e17c29
Changed formatting of scale and location values from pixel to percentage
CarlYunghans Jun 10, 2020
4e7ca8b
Reversed some careless errors from last edit
CarlYunghans Jun 10, 2020
fc8cd90
Reversed some careless errors from last edit
CarlYunghans Jun 10, 2020
9fc4766
Changed scale and position formatting from pixel to percentage
CarlYunghans Jun 10, 2020
78b9de7
Remedied gaps in previous edit
CarlYunghans Jun 10, 2020
4923ca9
Fixed a minor spelling error
CarlYunghans Jun 16, 2020
d5b359b
Added total horizontal flexibility as a JS global
CarlYunghans Jun 29, 2020
09c61a7
Added the page's minimum flexibility as a JS global
CarlYunghans Jun 29, 2020
f3e01bb
Added min-width to the stylesheet output
CarlYunghans Jun 30, 2020
c7de132
Revert "Changed pixel formatting cues to percentage"
CarlYunghans Jul 2, 2020
ff9eec9
Merge pull request #11 from CarlYunghans/autoscale
CarlYunghans Jul 2, 2020
f456897
Reverted some unhelpful changes
CarlYunghans Jul 2, 2020
94420a5
Reversed another batch of unhelpful changes
CarlYunghans Jul 2, 2020
a4cff01
Restored to previous condition
CarlYunghans Jul 2, 2020
001edfb
Revoked previous alterations
CarlYunghans Jul 2, 2020
ea92155
Repealed some more unhelpful changes
CarlYunghans Jul 2, 2020
4312349
One toe in the water
CarlYunghans Jul 2, 2020
743f2ba
Launched first attempt at a calc() function for width
CarlYunghans Jul 2, 2020
176b947
Resolved some oversights
CarlYunghans Jul 2, 2020
a168b3b
Another test
CarlYunghans Jul 2, 2020
548cccd
Revoked last commit
CarlYunghans Jul 2, 2020
56c9596
Added spaces to the calc() function
CarlYunghans Jul 2, 2020
22c5551
Escaped the percentage signs in the calc() function
CarlYunghans Jul 2, 2020
e2952c6
Removed escape characters from percentages in calc()
CarlYunghans Jul 2, 2020
01d0361
Deliberately sabotaged the code to make the source of the issue visible
CarlYunghans Jul 6, 2020
2e0fa3c
Revised the sabotage for more consistency
CarlYunghans Jul 6, 2020
bee2374
Reversed the aforesaid sabotage, and added a space between "width:" a…
CarlYunghans Jul 7, 2020
1277a6a
Altered function calls to hopefully bypass the error
CarlYunghans Jul 7, 2020
4c60dd3
Removed redundant units
CarlYunghans Jul 7, 2020
455d40a
Removed spaces that may be interrupting the syntax
CarlYunghans Jul 7, 2020
93b9e9f
Changed flexibilities' formatting cues from %POS to %INT
CarlYunghans Jul 7, 2020
ada9604
Temporarily removed calc() to see if it's the troublemaker
CarlYunghans Jul 7, 2020
c8776cb
Escaped the forward slashes
CarlYunghans Jul 7, 2020
12b85d3
Rearranged some of the syntax
CarlYunghans Jul 7, 2020
ad00c01
Escaped the parentheses in the calc() function
CarlYunghans Jul 8, 2020
b329362
Resolved another careless error
CarlYunghans Jul 8, 2020
b8b581a
Removed some escape characters that probably weren't necessary
CarlYunghans Jul 8, 2020
fa88e06
Amended a syntactic faux pas
CarlYunghans Jul 8, 2020
0082842
Resolved the same insconsistency a third time
CarlYunghans Jul 8, 2020
77a95ee
Restored file to last condition that didn't prevent the page from loa…
CarlYunghans Jul 8, 2020
189c648
Added a comment labeling the next changes to be made
CarlYunghans Jul 8, 2020
ac019c2
Reworked part of the formula that was incorrect
CarlYunghans Jul 9, 2020
2b5d335
Changed flexW and treeFlexW's formatting cues to %POS
CarlYunghans Jul 9, 2020
18ca2d7
Changed another set of formatting cues
CarlYunghans Jul 9, 2020
fa45445
Revert "Changed another set of formatting cues"
CarlYunghans Jul 9, 2020
016899b
Added a missing semicolon
CarlYunghans Jul 9, 2020
645bd8f
A revert of a reversion to be reverted forthwith
CarlYunghans Jul 9, 2020
4af6e42
Revert last commit ("A revert of a reversion to be reverted forthwith")
CarlYunghans Jul 9, 2020
7d0f75a
Merge branch 'autoscale' of https://github.com/LightSys/centrallix in…
CarlYunghans Jul 9, 2020
74da82e
Restored file once again to last condition that enabled page to load
CarlYunghans Jul 9, 2020
a42afb5
Merge branch 'autoscale' of https://github.com/LightSys/centrallix in…
CarlYunghans Jul 9, 2020
53050c0
Escaped the percent sign after the 100 in calc()
CarlYunghans Jul 10, 2020
f56b80b
Escaped the percent sign. Merge branch 'autoscale' of https://github.…
CarlYunghans Jul 10, 2020
196b695
Removed a misplaced character
CarlYunghans Jul 10, 2020
c8889ac
Removed a misplaced character. Merge branch 'autoscale' of https://gi…
CarlYunghans Jul 10, 2020
df6230a
Corrected the calc() formula
CarlYunghans Jul 10, 2020
525f1db
Corrected the calc() formula
CarlYunghans Jul 10, 2020
4d2381b
Changed default flex values to 1 (formerly 0)
CarlYunghans Jul 10, 2020
beb374f
Changed default flex values to 1. Merge branch 'autoscale' of https:…
CarlYunghans Jul 10, 2020
45c57e9
Replaced width with min_width in calc()
CarlYunghans Jul 10, 2020
ea8d4c2
Replaced width with min_width in calc(). Merge branch 'autoscale' of …
CarlYunghans Jul 10, 2020
f618bfe
Revert "Replaced width with min_width in calc()" (It just caused issues)
CarlYunghans Jul 10, 2020
0674176
Another attempt to eradicate division by zero
CarlYunghans Jul 10, 2020
05dbedd
Added a version of calc() for height
CarlYunghans Jul 10, 2020
1b94a0c
Cleaned up a vestigial instance of the variable h
CarlYunghans Jul 10, 2020
7b6c86b
Changed flex formatting cues from %INT to %POS
CarlYunghans Jul 10, 2020
06fce09
Ensured that the calc() function for height never incurs division by …
CarlYunghans Jul 10, 2020
6f0cd84
Added further measures to prevent wonky widths
CarlYunghans Jul 10, 2020
255039c
Corrected dodgy syntax of last commit
CarlYunghans Jul 10, 2020
57900f5
Experimentally subbed in min_width and min_height for width and height
CarlYunghans Jul 10, 2020
8344f95
Well, it didn't work. Revert "Experimentally subbed in min_width and …
CarlYunghans Jul 10, 2020
0c9f4c3
auto-scaling width for al%POSbase
AustenCombs Jul 13, 2020
5c62db1
auto-scaling for inner content of panes
AustenCombs Jul 13, 2020
c3fbddf
auto-scaling paragraph text
AustenCombs Jul 13, 2020
f8fe452
Attempted to remedy the issue that's trampling min-width
CarlYunghans Jul 13, 2020
498d76a
Added separate min-width and min-height constraints
CarlYunghans Jul 13, 2020
49ad00d
Measures to prevent min-widths and min-heights of 0
CarlYunghans Jul 13, 2020
81f0882
Corrected some syntax errors
CarlYunghans Jul 13, 2020
cd401a4
Streamlined out some needless complexities
CarlYunghans Jul 13, 2020
d9731ad
Corrected comments and removed superfluous vars
CarlYunghans Jul 13, 2020
1d0ecc8
test for pane positional adjustments
AustenCombs Jul 13, 2020
37e6126
edit for flexibility calculation
AustenCombs Jul 13, 2020
a7dc411
further flex width edits
AustenCombs Jul 13, 2020
66fe789
flex width edit; fixed flex height change
AustenCombs Jul 13, 2020
f814f6e
removed min_width & min_height values
AustenCombs Jul 14, 2020
d50a4cd
revert back to positional additions
AustenCombs Jul 14, 2020
a142b23
Replaced wgtr root refs with parent node refs
CarlYunghans Jul 14, 2020
678a88f
Fixed some troublesome capitalizations
CarlYunghans Jul 14, 2020
9c0f33e
Added contingency for widgets without a parent
CarlYunghans Jul 14, 2020
9db2612
Adapted error checking to accomodate top-level widgets
CarlYunghans Jul 14, 2020
8687e3e
auto-scaling widths and left position
AustenCombs Jul 15, 2020
a4a7991
removed clip rect
AustenCombs Jul 15, 2020
dfa2d38
New function to identify main container
CarlYunghans Jul 15, 2020
a551a29
Remedied some oversights from last commit
CarlYunghans Jul 15, 2020
5accf92
Remedied another error from two commits ago
CarlYunghans Jul 15, 2020
38f1bae
Fixed some more issues (or tried to)
CarlYunghans Jul 15, 2020
99409de
Changed default box_offset to 10px
CarlYunghans Jul 15, 2020
2cff8bb
Minor alterations for consistency
CarlYunghans Jul 15, 2020
fb3f23d
revert clip rect delete
AustenCombs Jul 15, 2020
a81d87a
Minorly altered methodology
CarlYunghans Jul 15, 2020
2dc1115
Corrected a careless error on line 145
CarlYunghans Jul 15, 2020
e6da4db
Changed "right" CSS value from hardcoded to softcoded
CarlYunghans Jul 15, 2020
e76bd9b
Changed determinant value of right to x
CarlYunghans Jul 15, 2020
673377e
Another attempt to accomodate padding in width
CarlYunghans Jul 15, 2020
60b623a
Corrected the strategy of the previous commit
CarlYunghans Jul 15, 2020
9e51472
Applied the same process to height
CarlYunghans Jul 15, 2020
66eb07a
Corrected what appears to be a problematic snippet in calc()
CarlYunghans Jul 15, 2020
2281f87
Corrected another oversight for consistency
CarlYunghans Jul 15, 2020
5d0bd2b
Something in this commit went screwy. Revert "Corrected another overs…
CarlYunghans Jul 15, 2020
0dd5471
Made some other tentative changes
CarlYunghans Jul 15, 2020
3f7774d
Made some other alterations for main containers
CarlYunghans Jul 16, 2020
4ce532f
Increased leniency of main container detector
CarlYunghans Jul 16, 2020
231f2f4
Well, that didn't work. Revert "Increased leniency of main container …
CarlYunghans Jul 16, 2020
4aabefd
Let's take a few steps back... Revert "Made some other alterations fo…
CarlYunghans Jul 16, 2020
dfb0859
Fine-tuned isMainContainer()
CarlYunghans Jul 16, 2020
f5eacf9
Resolved two oversights from last commit
CarlYunghans Jul 16, 2020
9e520f2
More minor tweaks
CarlYunghans Jul 16, 2020
d4de314
Made some other tweaks to conditionals
CarlYunghans Jul 16, 2020
a0d4d5a
More tweaks and corrections
CarlYunghans Jul 16, 2020
423cf1e
Corrected a contingent inconsistency
CarlYunghans Jul 17, 2020
bd0120c
Supplemented and refined the documentation
CarlYunghans Jul 17, 2020
5ffaf40
Further supplemented documentation
CarlYunghans Jul 17, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion centrallix-os/apps/widget_demo/app_info.struct
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ $Version=2$
app_info "system/structure"
{
app_name="Widget Demo";
app_info="A demo application showing the uses fo a few of the many widgets that Centrallix supports, using components.";
app_info="A demo application showing the uses of a few of the many widgets that Centrallix supports, using components.";
}
2 changes: 1 addition & 1 deletion centrallix/htmlgen/htdrv_autolayout.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ htalRender(pHtSession s, pWgtrNode tree, int z)
strtcpy(name,wgtrGetName(tree),sizeof(name));

/** Add the stylesheet for the layer **/
htrAddStylesheetItem_va(s,"\t#al%POSbase { POSITION:absolute; VISIBILITY:inherit; OVERFLOW:visible; LEFT:%INTpx; TOP:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",
htrAddStylesheetItem_va(s,"\t#al%POSbase { POSITION:absolute; VISIBILITY:inherit; OVERFLOW:visible; LEFT:%INTpx; TOP:%INTpx; WIDTH:100%%; HEIGHT:%POSpx; Z-INDEX:%POS; }\n",
//htrAddStylesheetItem_va(s,"\t#al%POSbase { POSITION:absolute; VISIBILITY:inherit; OVERFLOW:visible; LEFT:%INTpx; TOP:%INTpx; WIDTH:%POSpx; HEIGHT:%POSpx; CLIP:rect(%INTpx,%INTpx,%INTpx,%INTpx); Z-INDEX:%POS; }\n",
id,x,y,w,h,
//-1, w+1, h+1, -1,
Expand Down
6 changes: 3 additions & 3 deletions centrallix/htmlgen/htdrv_label.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,17 +197,17 @@ htlblRender(pHtSession s, pWgtrNode tree, int z)
form[0]='\0';

/** Ok, write the style header items. **/
htrAddStylesheetItem_va(s,"\t#lbl%POS { POSITION:absolute; VISIBILITY:inherit; LEFT:%INTpx; TOP:%INTpx; %[HEIGHT:%POSpx; %]WIDTH:%POSpx; Z-INDEX:%POS; cursor:default; %[font-weight:bold; %]%[color:%STR&CSSVAL; %]%[font-size:%POSpx; %]text-align:%STR&CSSVAL; vertical-align:%STR&CSSVAL; %[white-space:nowrap; %]%[text-overflow:ellipsis; overflow:hidden; %]%[font-style:italic; %]}\n",
htrAddStylesheetItem_va(s,"\t#lbl%POS { POSITION:absolute; VISIBILITY:inherit; LEFT:%INTpx; TOP:%INTpx; %[HEIGHT:%POSpx; %]WIDTH:Calc(100%% - %POSpx); Z-INDEX:%POS; cursor:default; %[font-weight:bold; %]%[color:%STR&CSSVAL; %]%[font-size:%POSpx; %]text-align:%STR&CSSVAL; vertical-align:%STR&CSSVAL; %[white-space:nowrap; %]%[text-overflow:ellipsis; overflow:hidden; %]%[font-style:italic; %]}\n",
id,x,y,
!auto_height, h,
w,z,
x,z,
is_bold, *fgcolor, fgcolor, font_size > 0, font_size, align, valign,
!allow_break, overflow_ellipsis, is_italic);
if (is_link)
htrAddStylesheetItem_va(s,"\t#lbl%POS:hover { %[color:%STR&CSSVAL; %]text-decoration:underline; cursor:pointer; }\n", id, *pfgcolor, pfgcolor);
if (is_link && *cfgcolor)
htrAddStylesheetItem_va(s,"\t#lbl%POS:active { color:%STR&CSSVAL; text-decoration:underline; cursor:pointer; }\n", id, cfgcolor);
htrAddStylesheetItem_va(s,"\t#lbl%POS p { text-align:%STR&CSSVAL; %[position:relative; top:50%%; transform:translateY(-50%%); %]padding:0px; margin:0px; border-spacing:0px; width:%POSpx; }\n", id, align, !strcmp(valign, "middle"), w);
htrAddStylesheetItem_va(s,"\t#lbl%POS p { text-align:%STR&CSSVAL; %[position:relative; top:50%%; transform:translateY(-50%%); %]padding:0px; margin:0px; border-spacing:0px; width:100%%; }\n", id, align, !strcmp(valign, "middle"), w);

htrAddWgtrObjLinkage_va(s, tree, "lbl%POS",id);
stylestr[0] = '\0';
Expand Down
9 changes: 9 additions & 0 deletions centrallix/htmlgen/htdrv_page.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ htpageRender(pHtSession s, pWgtrNode tree, int z)
XArray endorsements;
XArray contexts;
int max_requests = 1;
int pgflexw = 0; /* stores horizontal flexibility of page in pixels */
int pgminw = 0; /* stores minimum width of page in pixels */

if(!((s->Capabilities.Dom0NS || s->Capabilities.Dom0IE || (s->Capabilities.Dom1HTML && s->Capabilities.Dom2Events)) && s->Capabilities.CSS1) )
{
Expand Down Expand Up @@ -243,6 +245,8 @@ htpageRender(pHtSession s, pWgtrNode tree, int z)
htrAddScriptGlobal(s, "pg_scripts", "[]", 0);
htrAddScriptGlobal(s, "pg_endorsements", "[]", 0);
htrAddScriptGlobal(s, "pg_max_requests", "1", 0);
htrAddScriptGlobal(s, "pg_flex_w", "0", 0);
htrAddScriptGlobal(s, "pg_min_w", "0", 0);

/** Add script include to get function declarations **/
if(s->Capabilities.JS15 && s->Capabilities.Dom1HTML)
Expand Down Expand Up @@ -279,6 +283,9 @@ htpageRender(pHtSession s, pWgtrNode tree, int z)
}
}

wgtrGetPropertyValue(tree, "fl_width", DATA_T_INTEGER, POD(&pgflexw));
wgtrGetPropertyValue(tree, "min_width", DATA_T_INTEGER, POD(&pgminw));

/** Page init **/
htrAddScriptInit(s, " if(typeof(pg_status_init)=='function')pg_status_init();\n");
htrAddScriptInit_va(s, " pg_init(wgtrGetNodeRef(ns,'%STR&SYM'),%INT);\n", name, attract);
Expand All @@ -289,6 +296,8 @@ htpageRender(pHtSession s, pWgtrNode tree, int z)
htrAddScriptInit_va(s, " pg_charw = %INT;\n", s->ClientInfo->CharWidth);
htrAddScriptInit_va(s, " pg_charh = %INT;\n", s->ClientInfo->CharHeight);
htrAddScriptInit_va(s, " pg_parah = %INT;\n", s->ClientInfo->ParagraphHeight);
htrAddScriptInit_va(s, " pg_flex_w = %INT;\n", pgflexw);
htrAddScriptInit_va(s, " pg_min_w = %INT;\n", pgminw);

c_param = stLookup_ne(s->Params, "cx__obscure");
if (c_param && !strcasecmp(c_param->StrVal,"yes"))
Expand Down
129 changes: 119 additions & 10 deletions centrallix/htmlgen/htdrv_pane.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,29 @@ static struct
}
HTPN;

/* Function to determine whether stranger is a "main container" - a widget whose width spans the page and whose immediate children are smaller than it */
int
isMainContainer(pWgtrNode stranger, int latitude)
{
pWgtrNode theWholeShebang = wgtrGetRoot(stranger); //Lay hold of the top level of stranger's tree
int shebangWidth; //Variable to store top-level width
int mandatoryInt = wgtrGetPropertyValue(theWholeShebang,"width",DATA_T_INTEGER,POD(&shebangWidth)); //Load top-level width into shebangWidth (mandatoryInt is necessary but unrelated to the logic)
int strangerWidth; //Variable to store stranger's width
mandatoryInt = wgtrGetPropertyValue(stranger,"width",DATA_T_INTEGER,POD(&strangerWidth)); //Load stranger's width into strangerWidth
pWgtrNode strangerFirstborn = xaGetItem(&(stranger->Children), 0); //Detain stranger's first child for questioning
int firstbornWidth; //Variable to store first child's width
mandatoryInt = wgtrGetPropertyValue(strangerFirstborn,"width",DATA_T_INTEGER,POD(&firstbornWidth)); //Measure him width-wise

if (strangerWidth >= (shebangWidth - (2 * latitude))) //If stranger's width spans the whole tree... (allow for lateral spacing)
{
if (firstbornWidth <= strangerWidth - (2 * latitude))//And his first child is thinner than he... (once again, allowing for lateral spacing)
{
return 1; //We have ourselves a winner!
}
}
return 0; //Nope.
}


/*** htpnRender - generate the HTML code for the page.
***/
Expand All @@ -58,7 +81,10 @@ 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;
//int minW, minH; //Minimum width and height -- these variables were removed because they interfered with other calculations. They were introduced as a means of resolving an issue that caused widgets' widths to shrink to 0px as the window approached its minimal width.
int preH, parentPreH, flexH, parentFlexH; //Widget's baseline width, parent node's baseline width, widget's lateral flexibility, parent node's lateral flexibility
int preW, parentPreW, flexW, parentFlexW; /* Some variables to facilitate dynamic resizing - preW replaces the variable w */
int id;
int style = 1; /* 0 = lowered, 1 = raised, 2 = none, 3 = bordered */
char* c1;
Expand All @@ -77,20 +103,54 @@ htpnRender(pHtSession s, pWgtrNode tree, int z)
/** Get an id for this. **/
id = (HTPN.idcnt++);

/** Get x,y,w,h of this object **/
/** Get x,y,preW,flexW,preH,flexW,flexH of this object **/
if (wgtrGetPropertyValue(tree,"x",DATA_T_INTEGER,POD(&x)) != 0) x=0;
if (wgtrGetPropertyValue(tree,"y",DATA_T_INTEGER,POD(&y)) != 0) y=0;
if (wgtrGetPropertyValue(tree,"width",DATA_T_INTEGER,POD(&w)) != 0)
if (wgtrGetPropertyValue(tree,"width",DATA_T_INTEGER,POD(&preW)) != 0)
{
mssError(1,"HTPN","Pane widget must have a 'width' property");
return -1;
}
if (wgtrGetPropertyValue(tree,"height",DATA_T_INTEGER,POD(&h)) != 0)
if (wgtrGetPropertyValue(tree,"height",DATA_T_INTEGER,POD(&preH)) != 0)
{
mssError(1,"HTPN","Pane widget must have a 'height' property");
return -1;
}

if (wgtrGetPropertyValue(tree,"fl_width",DATA_T_INTEGER,POD(&flexW)) != 0) flexW=1;
if (wgtrGetPropertyValue(tree,"fl_height",DATA_T_INTEGER,POD(&flexH)) != 0) flexH=1;

//Below are the retired functions that formerly initialized min_width and min_height. These variables appeared to be interfering with other calculations, so they've been shelved.
/* if (wgtrGetPropertyValue(tree,"min_width",DATA_T_INTEGER,POD(&minW)) != 0) //If there's no min-width value to load in...
{
if (wgtrGetPropertyValue(tree,"r_width",DATA_T_INTEGER,POD(&minW)) != 0) //And no r-width value to load in...
{
minW = preW / 2; //Try half the baseline width
}
}

if (wgtrGetPropertyValue(tree,"min_height",DATA_T_INTEGER,POD(&minH)) != 0)
{
if (wgtrGetPropertyValue(tree,"r_height",DATA_T_INTEGER,POD(&minH)) != 0)
{
minH = preH / 2;
}
}
*/

if (isMainContainer(tree, x) != 0) //Top-level widgets get special treatment
{
parentPreW=preW; //A top-level widget's width equals that of the page (minus spacing, of course -- but the calc function will take care of that later)
parentFlexW=flexW; //A top-level widget's lateral flexibility equals that of the page
}
else
{
if (wgtrGetPropertyValue(tree,"width",DATA_T_INTEGER,POD(&parentPreW)) != 0) parentPreW=0; //If the widget doesn't have a width assigned to it, assume a width of 0
if (wgtrGetPropertyValue(tree,"fl_width",DATA_T_INTEGER,POD(&parentFlexW)) != 0) parentFlexW=1; //If the widget doesn't have a lateral flexibility assigned to it, mark it down as 1
}

if (wgtrGetPropertyValue(tree->Parent,"height",DATA_T_INTEGER,POD(&parentPreH)) != 0) parentPreH=0;
if (wgtrGetPropertyValue(tree->Parent,"fl_height",DATA_T_INTEGER,POD(&parentFlexH)) != 0) parentFlexH=1;

/** Border radius, for raised/lowered/bordered panes **/
if (wgtrGetPropertyValue(tree,"border_radius",DATA_T_INTEGER,POD(&border_radius)) != 0)
border_radius=0;
Expand Down Expand Up @@ -153,20 +213,70 @@ htpnRender(pHtSession s, pWgtrNode tree, int z)
strtcpy(bdr,ptr,sizeof(bdr));
}


/* Some checks to prevent dodgy eventualities: */

/* Important Note:
Thus far, the below calls to the function isMainContainer - and indeed, all other calls to that function - have not been returning any values.
This became apparent when I changed the conditional on line 140 from "if (isMainContainer(tree, x) == 1)" to "if (isMainContainer(tree, x) != 0)".
The resulting changes indicated that the expression now evaluated to true. The source of this problem remains a mystery, but the result is that
any conditional which expects a return value from isMainContainer will evaluate to false (0), and any conditional which expects no return value
(like the one below) will evaluate to true (1). This doesn't cause any issues for the Centrallix main page (or hasn't so far), but it probably will
on any page where one or more widgets of the pane class serve in a capacity other than that of "main container".
*/

if (parentFlexW == 0 && (isMainContainer(tree, x)) != 1) //If future denominator of flexibility quotient (see calc function) is 0, and we're not at the top level...
{
parentFlexW = 1; //Prevent division by zero
}
else if (parentFlexW == 0 && (isMainContainer(tree, x)) != 0) //If future denominator of flexibility (see calc function) is 0, and we are at the top level...
{
parentFlexW = flexW = 1; //Prevent division by zero, and balance the quotient so that it evaluates to 1
}
else if (parentFlexW < 0) //We don't want negative values here; they'll make widgets expand as the window contracts and vis versa
{
parentFlexW = -1 * parentFlexW; //Turn that negative into a positive
}

if (parentFlexH == 0 && parentFlexH != flexH)
{
parentFlexH = 1; //Prevent division by zero
}
else if (parentFlexH == 0 && parentFlexH == flexH) //If future denominator of flexibility (see calc function) is 0, and we are at the top level...
{
parentFlexH = flexH = 1; //Prevent division by zero, and balance the quotient so that it evaluates to 1
}
else if (parentFlexH < 0) //We don't want negative values here; they'll make widgets expand as the window contracts and vis versa
{
parentFlexH = -1 * parentFlexH; //Turn that negative into a positive
}

/** 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 + (100%% - %POSpx) * (%POS / %POS)); HEIGHT:calc(%POSpx + (100%% - %POSpx) * (%POS / %POS)); Z-INDEX:%POS;}\n",id,x,y,preW-2*x,parentPreW,flexW,parentFlexW,preH,parentPreH,flexH,parentFlexH,z);
if(x > 12)
{
htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; RIGHT:%INTpx; TOP:%INTpx; WIDTH:calc(%POSpx + (100%% - %POSpx) * (%POS / %POS)); HEIGHT:calc(%POSpx + (100%% - %POSpx) * (%POS / %POS)); Z-INDEX:%POS;}\n",id,x,y,preW-2*x,parentPreW,flexW,parentFlexW,preH-2*y,parentPreH,flexH,parentFlexH,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 + (100%% - %POSpx) * (%POS / %POS)); HEIGHT:calc(%POSpx + (100%% - %POSpx) * (%POS / %POS)); Z-INDEX:%POS;}\n",id,x,y,preW-2*x,parentPreW,flexW,parentFlexW,preH-2*x,parentPreH,flexH,parentFlexH,z);
if(x > 12)
{
htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; RIGHT:%INTpx; TOP:%INTpx; WIDTH:calc(%POSpx + (100%% - %POSpx) * (%POS / %POS)); HEIGHT:calc(%POSpx + (100%% - %POSpx) * (%POS / %POS)); Z-INDEX:%POS;}\n",id,x,y,preW-2*x,parentPreW,flexW,parentFlexW,preH-2*y,parentPreH,flexH,parentFlexH,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 + (100%% - %POSpx) * (%POS / %POS)); HEIGHT:calc(%POSpx + (100%% - %POSpx) * (%POS / %POS)); Z-INDEX:%POS;}\n",id,x,y,preW-2*x,parentPreW,flexW,parentFlexW,preH-2*x,parentPreH,flexH,parentFlexH,z);
if(x > 12)
{
htrAddStylesheetItem_va(s,"\t#pn%POSmain { POSITION:absolute; VISIBILITY:inherit; overflow:hidden; RIGHT:%INTpx; TOP:%INTpx; WIDTH:calc(%POSpx + (100%% - %POSpx) * (%POS / %POS)); HEIGHT:calc(%POSpx + (100%% - %POSpx) * (%POS / %POS)); Z-INDEX:%POS;}\n",id,x,y,preW-2*x,parentPreW,flexW,parentFlexW,preH-2*y,parentPreH,flexH,parentFlexH,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)
Expand Down Expand Up @@ -194,7 +304,7 @@ htpnRender(pHtSession s, pWgtrNode tree, int z)

/** HTML body <DIV> element for the base layer. **/
//htrAddBodyItem_va(s,"<DIV ID=\"pn%POSmain\"><table width=%POS height=%POS cellspacing=0 cellpadding=0 border=0><tr><td></td></tr></table>\n",id, w-2, h-2);
htrAddBodyItem_va(s,"<DIV ID=\"pn%POSmain\">\n",id, w-2, h-2);
htrAddBodyItem_va(s,"<DIV ID=\"pn%POSmain\">\n",id, preW-2, preH-2);

/** Check for objects within the pane. **/
htrRenderSubwidgets(s, tree, z+2);
Expand All @@ -205,7 +315,6 @@ htpnRender(pHtSession s, pWgtrNode tree, int z)
return 0;
}


/*** htpnInitialize - register with the ht_render module.
***/
int
Expand Down
Loading