82 int indent,
int mbottom,
int tag)
125 for (pM = *ppMargin; pM && pM->
fTag != tag; pM = pM->
fPNext) {}
130 while ((pM = *ppMargin) != 0) {
134 if (oldTag == tag)
break;
154 while (*ppMarginStack && (**ppMarginStack).
fBottom >= 0 &&
155 (**ppMarginStack).fBottom <=
y) {
224 if (
x < minX)
x = minX;
240 for (; p && p != p_end; p = p ? p->
fPNext : 0) {
247 if (lastBreak &&
x + spaceWanted +
text->fW >
width)
252 x +=
text->fW + spaceWanted;
262 *actualWidth = (
x <= 0) ? 1 :
x;
270 *actualWidth = ((
x <= 0) && !isEmpty) ? 1 :
x;
273 if (spaceWanted < w && x > origin) spaceWanted = w;
283 *actualWidth = ((
x <= 0) && !isEmpty) ? 1 :
x;
288 image->
fX =
x + spaceWanted;
290 if (lastBreak &&
x + spaceWanted + image->
fW >
width) {
296 x += image->
fW + spaceWanted;
299 *actualWidth = ((
x <= 0) && !isEmpty) ? 1 :
x;
314 if (lastBreak &&
x + spaceWanted + input->
fW >
width) {
320 x = input->
fX + input->
fW;
323 *actualWidth = ((
x <= 0) && !isEmpty) ? 1 :
x;
342 x + spaceWanted >= 0) {
343 *actualWidth = ((
x <= 0) && !isEmpty) ? 1 :
x;
352 *actualWidth = ((
x <= 0) && !isEmpty) ? 1 :
x;
353 if (
x + spaceWanted >=
width) {
413 *actualWidth = ((
x <= 0) && !isEmpty) ? 1 :
x;
420 *actualWidth = ((
x <= 0) && !isEmpty) ? 1 :
x;
430 while (p && p != p_end) {
455 int actualWidth,
int lMargin,
int *max_x)
467 if (actualWidth > 0) {
469 if (p == p_end || p == 0) p = p_start;
470 maxAscent = maxTextAscent = 0;
471 for (p = p_start; p && p != p_end; p = p->
fPNext) {
474 dx = lMargin + (
width - actualWidth) / 2;
476 dx = lMargin + (
width - actualWidth);
489 int ascent2 =
text->fAscent;
490 int delta = (ascent2 +
text->fDescent) * ss / 2;
493 if (ascent2 > maxAscent) maxAscent = ascent2;
494 if (ascent2 > maxTextAscent) maxTextAscent = ascent2;
496 int descent2 =
text->fDescent;
497 int delta = (descent2 +
text->fAscent) * (-ss) / 2;
502 if (
text->fAscent > maxAscent) maxAscent =
text->fAscent;
503 if (
text->fAscent > maxTextAscent) maxTextAscent =
text->fAscent;
517 if (li->
fX > max) max = li->
fX;
524 max = image->
fX + image->
fW;
567 max = input->
fX + input->
fW;
569 input->
fY = dy2center - input->
fH / 2;
571 if (ascent > maxAscent) maxAscent = ascent;
582 y = maxAscent + mbottom;
585 for (p = p_start; p && p != p_end; p = p->
fPNext) {
591 if (
text->fDescent > maxDescent) maxDescent =
text->fDescent;
612 image->
fAscent = maxTextAscent;
632 descent = input->
fY + input->
fH;
634 if (descent > maxDescent) maxDescent = descent;
653 return y + maxDescent;
667 headroom =
text->fAscent +
text->fDescent;
670 headroom =
text->fAscent +
text->fDescent;
676 if (font == 0)
return;
680 if (fHeadRoom < headroom && fBottom >
fTop)
fHeadRoom = headroom;
750 if (newBottom < fLeftMargin->
fBottom) {
766 if (newBottom < fRightMargin->
fBottom) {
784 if (newBottom < fRightMargin->
fBottom) {
789 if (newBottom < fLeftMargin->
fBottom) {
862 if (fMaxY < y + image->fH)
fMaxY =
y + image->
fH;
863 if (fMaxX < x + image->fW)
fMaxX =
x + image->
fW;
868 image->
fX =
x + w - image->
fW;
873 if (fMaxY < y + image->fH)
fMaxY =
y + image->
fH;
874 if (fMaxX < x + image->fW)
fMaxX =
x + image->
fW;
931 hr->
fH = (hrsz < 0) ? 2 : hrsz;
949 zl = z ? strlen(z) : 0;
950 if (zl > 0 && z[zl-1] ==
'%') {
951 wd = (atoi(z) * w) / 100;
953 wd = z ? atoi(z) : w;
960 hr->
fX += (w - wd) / 2;
971 if (fMaxX < wd + hr->fX)
fMaxX = wd + hr->
fX;
1009 if (strcasecmp(z,
"left") == 0) {
1011 }
else if (strcasecmp(z,
"right") == 0) {
1070#ifdef TABLE_TRIM_BLANK
1071int HtmlLineWasBlank = 0;
1090 while (p && p !=
fPEnd) {
1092 if (pNext == p)
break;
1101 if (p == 0 || p ==
fPEnd)
break;
1103#ifdef TABLE_TRIM_BLANK
1104 HtmlLineWasBlank = 0;
1130 y =
FixLine(p, pNext,
y, lineWidth, actualWidth, lMargin, &max_x);
1134#ifdef TABLE_TRIM_BLANK
1140 if (actualWidth <= 0) HtmlLineWasBlank = 1;
1145 if (pNext && actualWidth > 0 &&
y >
fBottom) {
include TDocParser_001 C image html pict1_TDocParser_001 png width
#define HTML_RELIEF_SUNKEN
#define HTML_RELIEF_RAISED
#define IMAGE_ALIGN_Bottom
#define IMAGE_ALIGN_AbsMiddle
#define IMAGE_ALIGN_Right
#define IMAGE_ALIGN_TextTop
#define IMAGE_ALIGN_AbsBottom
#define IMAGE_ALIGN_Middle
void GetFontMetrics(FontMetrics_t *m) const
Get font metrics.
virtual int IsMarkup() const
int InWrapAround()
Return TRUE (non-zero) if we are currently wrapping text around one or more images.
TGHtmlElement * GetLine(TGHtmlElement *pStart, TGHtmlElement *pEnd, int width, int minX, int *actualWidth)
This routine gathers as many tokens as will fit on one line.
TGHtmlLayoutContext()
Html Layout Context constructor.
void ComputeMargins(int *pX, int *pY, int *pW)
Compute the current margins for layout.
TGHtmlElement * TableLayout(TGHtmlTable *p)
Do all layout for a single table.
void PopOneMargin(SHtmlMargin_t **ppMargin)
Pop one margin off of the given margin stack.
void PopMargin(SHtmlMargin_t **ppMargin, int tag)
Pop as many margins as necessary until the margin that was created with "tag" is popped off.
void LayoutBlock()
Do as much layout as possible on the block of text defined by the HtmlLayoutContext.
SHtmlMargin_t * fRightMargin
void PushMargin(SHtmlMargin_t **ppMargin, int indent, int bottom, int tag)
Push a new margin onto the given margin stack.
void ClearMarginStack(SHtmlMargin_t **ppMargin)
Clear a margin stack to reclaim memory.
TGHtmlElement * DoBreakMarkup(TGHtmlElement *p)
Break markup is any kind of markup that might force a line-break.
void Paragraph(TGHtmlElement *p)
Increase the headroom to create a paragraph break at the current token.
int FixLine(TGHtmlElement *pStart, TGHtmlElement *pEnd, int bottom, int width, int actualWidth, int leftMargin, int *maxX)
This routine computes the X and Y coordinates for all elements of a line that has been gathered using...
void PopIndent()
Adjust (pop) ident.
void ClearObstacle(int mode)
Clear a wrap-around obstacle.
void WidenLine(int reqWidth, int *pX, int *pY, int *pW)
Move past obstacles until a linewidth of reqWidth is obtained, or until all obstacles are cleared.
void PopExpiredMargins(SHtmlMargin_t **ppMarginStack, int y)
Pop all expired margins from the stack.
void FixAnchors(TGHtmlElement *p, TGHtmlElement *pEnd, int y)
Set the y coordinate for every anchor in the given list.
SHtmlMargin_t * fLeftMargin
void Reset()
Reset the layout context.
void PushIndent()
Adjust (push) ident.
virtual const char * MarkupArg(const char *tag, const char *zDefault)
Lookup an argument in the given markup with the name given.
virtual TGFont * GetFont(int iFont)
The rendering and layout routines should call this routine in order to get a font structure.
void LayoutDoc()
Advance the layout as far as possible.
int NextMarkupType(TGHtmlElement *p)
Return the next markup type [TGHtmlElement::NextMarkupType].
void RedrawText(int y)
Call this routine to cause all of the rendered HTML at the virtual canvas coordinate of Y and beyond ...
void Sizer()
Compute the size of all elements in the widget.
TGHtmlElement * AttrElem(const char *name, char *value)
Returns html element matching attribute name and value.
int GetRulePadding() const
TGHtmlElement * fNextPlaced
TGHtmlLayoutContext fLayoutContext
int GetRuleRelief() const
Double_t fY
Y position of text (left,center,etc..)
Double_t fX
X position of text (left,center,etc..)