version 1.143, 2007/03/28 14:32:51
|
version 1.144, 2007/06/28 11:56:52
|
Line 1483 void CreateAttrWidthPercentPxl (char *bu
|
Line 1483 void CreateAttrWidthPercentPxl (char *bu
|
attrTypePercent.AttrSSchema = elType.ElSSchema; |
attrTypePercent.AttrSSchema = elType.ElSSchema; |
attrTypePxl.AttrTypeNum = HTML_ATTR_IntWidthPxl; |
attrTypePxl.AttrTypeNum = HTML_ATTR_IntWidthPxl; |
attrTypePercent.AttrTypeNum = HTML_ATTR_IntWidthPercent; |
attrTypePercent.AttrTypeNum = HTML_ATTR_IntWidthPercent; |
/* is the last character a '%' ? */ |
do |
if (buffer[length] == '%') |
|
{ |
{ |
/* remove IntWidthPxl */ |
/* is the last character a '%' ? */ |
attrOld = TtaGetAttribute (el, attrTypePxl); |
if (buffer[length] == '%') |
/* update IntWidthPercent */ |
|
attrNew = TtaGetAttribute (el, attrTypePercent); |
|
if (attrNew == NULL) |
|
{ |
{ |
attrNew = TtaNewAttribute (attrTypePercent); |
/* remove IntWidthPxl */ |
TtaAttachAttribute (el, attrNew, doc); |
attrOld = TtaGetAttribute (el, attrTypePxl); |
|
/* update IntWidthPercent */ |
|
attrNew = TtaGetAttribute (el, attrTypePercent); |
|
if (attrNew == NULL) |
|
{ |
|
attrNew = TtaNewAttribute (attrTypePercent); |
|
TtaAttachAttribute (el, attrNew, doc); |
|
} |
|
else if (isImage && oldWidth == -1) |
|
{ |
|
if (attrOld == NULL) |
|
oldWidth = TtaGetAttributeValue (attrNew); |
|
else |
|
oldWidth = TtaGetAttributeValue (attrOld); |
|
} |
} |
} |
else if (isImage && oldWidth == -1) |
else |
{ |
{ |
if (attrOld == NULL) |
/* remove IntWidthPercent */ |
oldWidth = TtaGetAttributeValue (attrNew); |
attrOld = TtaGetAttribute (el, attrTypePercent); |
else |
/* update IntWidthPxl */ |
oldWidth = TtaGetAttributeValue (attrOld); |
attrNew = TtaGetAttribute (el, attrTypePxl); |
|
if (attrNew == NULL) |
|
{ |
|
attrNew = TtaNewAttribute (attrTypePxl); |
|
TtaAttachAttribute (el, attrNew, doc); |
|
} |
|
else if (isImage && oldWidth == -1) |
|
{ |
|
TtaGiveBoxSize (el, doc, 1, UnPixel, &w, &h); |
|
if (attrOld == NULL) |
|
oldWidth = w * TtaGetAttributeValue (attrNew) / 100; |
|
else |
|
oldWidth = w * TtaGetAttributeValue (attrOld) / 100; |
|
} |
} |
} |
} |
|
else |
if (attrOld) |
{ |
TtaRemoveAttribute (el, attrOld, doc); |
/* remove IntWidthPercent */ |
if (sscanf (buffer, "%d", &val)) |
attrOld = TtaGetAttribute (el, attrTypePercent); |
TtaSetAttributeValue (attrNew, val, el, doc); |
/* update IntWidthPxl */ |
else |
attrNew = TtaGetAttribute (el, attrTypePxl); |
/* its not a number. Delete attribute and send an error message */ |
if (attrNew == NULL) |
{ |
{ |
TtaRemoveAttribute (el, attrNew, doc); |
attrNew = TtaNewAttribute (attrTypePxl); |
if (strlen (buffer) > MaxMsgLength - 30) |
TtaAttachAttribute (el, attrNew, doc); |
buffer[MaxMsgLength - 30] = EOS; |
} |
sprintf (msgBuffer, "Invalid attribute value \"%s\"", buffer); |
else if (isImage && oldWidth == -1) |
HTMLParseError (doc, msgBuffer, 0); |
{ |
|
TtaGiveBoxSize (el, doc, 1, UnPixel, &w, &h); |
|
if (attrOld == NULL) |
|
oldWidth = w * TtaGetAttributeValue (attrNew) / 100; |
|
else |
|
oldWidth = w * TtaGetAttributeValue (attrOld) / 100; |
|
} |
} |
} |
|
|
|
if (attrOld != NULL) |
if (el != origEl) |
TtaRemoveAttribute (el, attrOld, doc); |
// apply the attribute to the object itself |
if (sscanf (buffer, "%d", &val)) |
el = origEl; |
TtaSetAttributeValue (attrNew, val, el, doc); |
else |
else |
el = NULL; |
/* its not a number. Delete attribute and send an error message */ |
|
{ |
|
TtaRemoveAttribute (el, attrNew, doc); |
|
if (strlen (buffer) > MaxMsgLength - 30) |
|
buffer[MaxMsgLength - 30] = EOS; |
|
sprintf (msgBuffer, "Invalid attribute value \"%s\"", buffer); |
|
HTMLParseError (doc, msgBuffer, 0); |
|
} |
} |
|
while (el); |
|
|
if (isImage) |
if (isImage) |
UpdateImageMap (origEl, doc, oldWidth, -1); |
UpdateImageMap (origEl, doc, oldWidth, -1); |
else if (isSVG && oldWidth != -1) |
if (isSVG && oldWidth != -1) |
{ |
{ |
// force the redisplay of the SVG element |
// force the redisplay of the SVG element |
el = TtaGetParent (child); |
el = TtaGetParent (child); |
Line 1615 void CreateAttrHeightPercentPxl (char *b
|
Line 1626 void CreateAttrHeightPercentPxl (char *b
|
attrTypePercent.AttrSSchema = elType.ElSSchema; |
attrTypePercent.AttrSSchema = elType.ElSSchema; |
attrTypePxl.AttrTypeNum = HTML_ATTR_IntHeightPxl; |
attrTypePxl.AttrTypeNum = HTML_ATTR_IntHeightPxl; |
attrTypePercent.AttrTypeNum = HTML_ATTR_IntHeightPercent; |
attrTypePercent.AttrTypeNum = HTML_ATTR_IntHeightPercent; |
/* is the last character a '%' ? */ |
do |
if (buffer[length] == '%') |
|
{ |
{ |
/* remove IntHeightPxl */ |
/* is the last character a '%' ? */ |
attrOld = TtaGetAttribute (el, attrTypePxl); |
if (buffer[length] == '%') |
/* update IntHeightPercent */ |
|
attrNew = TtaGetAttribute (el, attrTypePercent); |
|
if (attrNew == NULL) |
|
{ |
{ |
attrNew = TtaNewAttribute (attrTypePercent); |
/* remove IntHeightPxl */ |
TtaAttachAttribute (el, attrNew, doc); |
attrOld = TtaGetAttribute (el, attrTypePxl); |
|
/* update IntHeightPercent */ |
|
attrNew = TtaGetAttribute (el, attrTypePercent); |
|
if (attrNew == NULL) |
|
{ |
|
attrNew = TtaNewAttribute (attrTypePercent); |
|
TtaAttachAttribute (el, attrNew, doc); |
|
} |
|
else if (isImage && oldHeight == -1) |
|
{ |
|
if (attrOld == NULL) |
|
oldHeight = TtaGetAttributeValue (attrNew); |
|
else |
|
oldHeight = TtaGetAttributeValue (attrOld); |
|
} |
} |
} |
else if (isImage && oldHeight == -1) |
else |
{ |
{ |
if (attrOld == NULL) |
/* remove IntHeightPercent */ |
oldHeight = TtaGetAttributeValue (attrNew); |
attrOld = TtaGetAttribute (el, attrTypePercent); |
else |
/* update IntHeightPxl */ |
oldHeight = TtaGetAttributeValue (attrOld); |
attrNew = TtaGetAttribute (el, attrTypePxl); |
|
if (attrNew == NULL) |
|
{ |
|
attrNew = TtaNewAttribute (attrTypePxl); |
|
TtaAttachAttribute (el, attrNew, doc); |
|
} |
|
else if (isImage && oldHeight == -1) |
|
{ |
|
TtaGiveBoxSize (el, doc, 1, UnPixel, &w, &h); |
|
if (attrOld == NULL) |
|
oldHeight = w * TtaGetAttributeValue (attrNew) / 100; |
|
else |
|
oldHeight = w * TtaGetAttributeValue (attrOld) / 100; |
|
} |
} |
} |
} |
|
else |
if (attrOld) |
{ |
TtaRemoveAttribute (el, attrOld, doc); |
/* remove IntHeightPercent */ |
if (sscanf (buffer, "%d", &val)) |
attrOld = TtaGetAttribute (el, attrTypePercent); |
TtaSetAttributeValue (attrNew, val, el, doc); |
/* update IntHeightPxl */ |
else |
attrNew = TtaGetAttribute (el, attrTypePxl); |
/* its not a number. Delete attribute and send an error message */ |
if (attrNew == NULL) |
{ |
{ |
TtaRemoveAttribute (el, attrNew, doc); |
attrNew = TtaNewAttribute (attrTypePxl); |
if (strlen (buffer) > MaxMsgLength - 30) |
TtaAttachAttribute (el, attrNew, doc); |
buffer[MaxMsgLength - 30] = EOS; |
} |
sprintf (msgBuffer, "Invalid attribute value \"%s\"", buffer); |
else if (isImage && oldHeight == -1) |
HTMLParseError (doc, msgBuffer, 0); |
{ |
|
TtaGiveBoxSize (el, doc, 1, UnPixel, &w, &h); |
|
if (attrOld == NULL) |
|
oldHeight = w * TtaGetAttributeValue (attrNew) / 100; |
|
else |
|
oldHeight = w * TtaGetAttributeValue (attrOld) / 100; |
|
} |
} |
} |
|
|
|
if (attrOld != NULL) |
if (el != origEl) |
TtaRemoveAttribute (el, attrOld, doc); |
// apply the attribute to the object itself |
if (sscanf (buffer, "%d", &val)) |
el = origEl; |
TtaSetAttributeValue (attrNew, val, el, doc); |
else |
else |
el = NULL; |
/* its not a number. Delete attribute and send an error message */ |
|
{ |
|
TtaRemoveAttribute (el, attrNew, doc); |
|
if (strlen (buffer) > MaxMsgLength - 30) |
|
buffer[MaxMsgLength - 30] = EOS; |
|
sprintf (msgBuffer, "Invalid attribute value \"%s\"", buffer); |
|
HTMLParseError (doc, msgBuffer, 0); |
|
} |
} |
|
while (el); |
|
|
if (isImage) |
if (isImage) |
UpdateImageMap (origEl, doc, oldHeight, -1); |
UpdateImageMap (origEl, doc, oldHeight, -1); |
else if (isSVG && oldHeight != -1) |
if (isSVG && oldHeight != -1) |
{ |
{ |
// force the redisplay of the SVG element |
// force the redisplay of the SVG element |
el = TtaGetParent (child); |
el = TtaGetParent (child); |