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 maxAscent = maxTextAscent = 0;
470 for (p = p_start; p && p != p_end; p = p->
fPNext) {
473 dx = lMargin + (
width - actualWidth) / 2;
475 dx = lMargin + (
width - actualWidth);
488 int ascent2 =
text->fAscent;
489 int delta = (ascent2 +
text->fDescent) * ss / 2;
492 if (ascent2 > maxAscent) maxAscent = ascent2;
493 if (ascent2 > maxTextAscent) maxTextAscent = ascent2;
495 int descent2 =
text->fDescent;
496 int delta = (descent2 +
text->fAscent) * (-ss) / 2;
500 if (
text->fAscent > maxAscent) maxAscent =
text->fAscent;
501 if (
text->fAscent > maxTextAscent) maxTextAscent =
text->fAscent;
515 if (li->
fX > max) max = li->
fX;
522 max = image->
fX + image->
fW;
565 max = input->
fX + input->
fW;
567 input->
fY = dy2center - input->
fH / 2;
569 if (ascent > maxAscent) maxAscent = ascent;
580 y = maxAscent + mbottom;
583 for (p = p_start; p && p != p_end; p = p->
fPNext) {
589 if (
text->fDescent > maxDescent) maxDescent =
text->fDescent;
610 image->
fAscent = maxTextAscent;
630 descent = input->
fY + input->
fH;
632 if (descent > maxDescent) maxDescent = descent;
651 return y + maxDescent;
665 headroom =
text->fAscent +
text->fDescent;
668 headroom =
text->fAscent +
text->fDescent;
674 if (font == 0)
return;
678 if (fHeadRoom < headroom && fBottom >
fTop)
fHeadRoom = headroom;
748 if (newBottom < fLeftMargin->
fBottom) {
764 if (newBottom < fRightMargin->
fBottom) {
782 if (newBottom < fRightMargin->
fBottom) {
787 if (newBottom < fLeftMargin->
fBottom) {
860 if (fMaxY < y + image->fH)
fMaxY =
y + image->
fH;
861 if (fMaxX < x + image->fW)
fMaxX =
x + image->
fW;
866 image->
fX =
x + w - image->
fW;
871 if (fMaxY < y + image->fH)
fMaxY =
y + image->
fH;
872 if (fMaxX < x + image->fW)
fMaxX =
x + image->
fW;
929 hr->
fH = (hrsz < 0) ? 2 : hrsz;
947 zl = z ? strlen(z) : 0;
948 if (zl > 0 && z[zl-1] ==
'%') {
949 wd = (atoi(z) * w) / 100;
951 wd = z ? atoi(z) : w;
958 hr->
fX += (w - wd) / 2;
969 if (fMaxX < wd + hr->fX)
fMaxX = wd + hr->
fX;
1007 if (strcasecmp(z,
"left") == 0) {
1009 }
else if (strcasecmp(z,
"right") == 0) {
1068#ifdef TABLE_TRIM_BLANK
1069int HtmlLineWasBlank = 0;
1088 while (p && p !=
fPEnd) {
1090 if (pNext == p)
break;
1099 if (p == 0 || p ==
fPEnd)
break;
1101#ifdef TABLE_TRIM_BLANK
1102 HtmlLineWasBlank = 0;
1128 y =
FixLine(p, pNext,
y, lineWidth, actualWidth, lMargin, &max_x);
1132#ifdef TABLE_TRIM_BLANK
1138 if (actualWidth <= 0) HtmlLineWasBlank = 1;
1143 if (pNext && actualWidth > 0 &&
y >
fBottom) {
static void indent(ostringstream &buf, int indent_level)
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
Encapsulate fonts used in the GUI system.
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
TGLongPosition fVisible
position of visible region
TGViewFrame * fCanvas
frame containing the text
Double_t fY
Y position of text (left,center,etc..)
Double_t fX
X position of text (left,center,etc..)