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) {
245 text->
fX = x + spaceWanted;
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;
312 input->
fX = x + spaceWanted + input->
fPadLeft;
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);
486 max = text->
fX + text->
fW;
490 int delta = (ascent2 + text->
fDescent) * ss / 2;
493 if (ascent2 > maxAscent) maxAscent = ascent2;
494 if (ascent2 > maxTextAscent) maxTextAscent = ascent2;
497 int delta = (descent2 + text->
fAscent) * (-ss) / 2;
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) {
612 image->
fAscent = maxTextAscent;
632 descent = input->
fY + input->
fH;
634 if (descent > maxDescent) maxDescent = descent;
653 return y + maxDescent;
676 if (font == 0)
return;
680 if (fHeadRoom < headroom && fBottom >
fTop)
fHeadRoom = headroom;
720 #define CLEAR_Right 1 722 #define CLEAR_First 3 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 1071 int HtmlLineWasBlank = 0;
1072 #endif // TABLE_TRIM_BLANK 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;
1105 #endif // TABLE_TRIM_BLANK 1130 y =
FixLine(p, pNext, y, lineWidth, actualWidth, lMargin, &max_x);
1134 #ifdef TABLE_TRIM_BLANK 1140 if (actualWidth <= 0) HtmlLineWasBlank = 1;
1142 #endif // TABLE_TRIM_BLANK 1145 if (pNext && actualWidth > 0 && y >
fBottom) {
1184 if (fPFirst == 0)
return;
1186 fLayoutContext.fHtml =
this;
1188 fLayoutContext.PushIndent();
1189 fLayoutContext.fPageWidth = fCanvas->GetWidth();
1190 fLayoutContext.fLeft = 0;
1193 fLayoutContext.fPageWidth = fCanvas->GetWidth() -
HTML_INDENT/4;
1196 fLayoutContext.fRight = 0;
1197 fLayoutContext.fPStart = fNextPlaced;
1198 if (fLayoutContext.fPStart == 0) fLayoutContext.fPStart = fPFirst;
1199 if (fLayoutContext.fPStart) {
1202 fLayoutContext.fMaxX =
fMaxX;
1203 fLayoutContext.fMaxY =
fMaxY;
1204 btm = fLayoutContext.fBottom;
1205 fLayoutContext.LayoutBlock();
1206 fMaxX = fLayoutContext.fMaxX;
1208 fMaxY = fLayoutContext.fMaxY;
1210 fMaxY = fLayoutContext.fMaxY + fYMargin;
1212 fNextPlaced = fLayoutContext.fPStart;
1214 if (fZGoto && (p = AttrElem(
"name", fZGoto+1))) {
TGHtmlElement * GetLine(TGHtmlElement *pStart, TGHtmlElement *pEnd, int width, int minX, int *actualWidth)
This routine gathers as many tokens as will fit on one line.
#define IMAGE_ALIGN_TextTop
void Paragraph(TGHtmlElement *p)
Increase the headroom to create a paragraph break at the current token.
image html pict1_TGaxis_012 png width
Define new text attributes for the label number "labNum".
void LayoutBlock()
Do as much layout as possible on the block of text defined by the HtmlLayoutContext.
void ClearObstacle(int mode)
Clear a wrap-around obstacle.
void PushIndent()
Adjust (push) ident.
SHtmlMargin_t * fLeftMargin
TGHtmlLayoutContext()
Html Layout Context constructor.
virtual TGFont * GetFont(int iFont)
The rendering and layout routines should call this routine in order to get a font structure...
TGHtmlElement * TableLayout(TGHtmlTable *p)
Do all layout for a single table.
TGHtmlElement * DoBreakMarkup(TGHtmlElement *p)
Break markup is any kind of markup that might force a line-break.
void PushMargin(SHtmlMargin_t **ppMargin, int indent, int bottom, int tag)
Push a new margin onto the given margin stack.
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.
void LayoutDoc()
Advance the layout as far as possible.
int GetRuleRelief() const
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...
#define HTML_RELIEF_SUNKEN
#define IMAGE_ALIGN_AbsBottom
virtual int IsMarkup() const
void PopOneMargin(SHtmlMargin_t **ppMargin)
Pop one margin off of the given margin stack.
#define IMAGE_ALIGN_Middle
void PopMargin(SHtmlMargin_t **ppMargin, int tag)
Pop as many margins as necessary until the margin that was created with "tag" is popped off...
#define IMAGE_ALIGN_AbsMiddle
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...
you should not use this method at all Int_t Int_t z
#define HTML_RELIEF_RAISED
#define IMAGE_ALIGN_Bottom
int InWrapAround()
Return TRUE (non-zero) if we are currently wrapping text around one or more images.
void ComputeMargins(int *pX, int *pY, int *pW)
Compute the current margins for layout.
void GetFontMetrics(FontMetrics_t *m) const
Get font metrics.
void ClearMarginStack(SHtmlMargin_t **ppMargin)
Clear a margin stack to reclaim memory.
#define IMAGE_ALIGN_Right
virtual const char * MarkupArg(const char *tag, const char *zDefault)
Lookup an argument in the given markup with the name given.
int GetRulePadding() const
SHtmlMargin_t * fRightMargin
void PopIndent()
Adjust (pop) ident.
void Reset()
Reset the layout context.
int NextMarkupType(TGHtmlElement *p)
Return the next markup type [TGHtmlElement::NextMarkupType].