Diff for /Amaya/amaya/XHTMLbuilder.c between versions 1.57 and 1.58

version 1.57, 2001/10/17 15:16:12 version 1.58, 2001/10/26 16:37:25
Line 953  void              XhtmlTypeAttrValue (ch Line 953  void              XhtmlTypeAttrValue (ch
    Create the corresponding attribute IntWidthPercent or IntWidthPxl.     Create the corresponding attribute IntWidthPercent or IntWidthPxl.
    oldWidth is -1 or the old image width.     oldWidth is -1 or the old image width.
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 void              CreateAttrWidthPercentPxl (char *buffer, Element el,  void CreateAttrWidthPercentPxl (char *buffer, Element el,
                                              Document doc, int oldWidth)                                  Document doc, int oldWidth)
   
 {  {
   AttributeType   attrTypePxl, attrTypePercent;    AttributeType   attrTypePxl, attrTypePercent;
   Attribute       attrOld, attrNew;    Attribute       attrOld, attrNew;
Line 1037  void              CreateAttrWidthPercent Line 1036  void              CreateAttrWidthPercent
 }  }
   
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
      CreateAttrHeightPercentPxl
      an HTML attribute "width" has been created for a Table of a HR.
      Create the corresponding attribute IntHeightPercent or IntHeightPxl.
      oldHeight is -1 or the old image width.
     ----------------------------------------------------------------------*/
   void CreateAttrHeightPercentPxl (char *buffer, Element el,
                                   Document doc, int oldHeight)
   {
     AttributeType   attrTypePxl, attrTypePercent;
     Attribute       attrOld, attrNew;
     int             length, val;
     char            msgBuffer[MaxMsgLength];
     ElementType     elType;
     int             w, h;
     ThotBool        isImage;
   
     elType = TtaGetElementType (el);
     isImage = (elType.ElTypeNum == HTML_EL_PICTURE_UNIT ||
                elType.ElTypeNum == HTML_EL_Data_cell ||
                elType.ElTypeNum == HTML_EL_Heading_cell);
   
     /* remove trailing spaces */
     length = strlen (buffer) - 1;
     while (length > 0 && buffer[length] <= SPACE)
       length--;
     attrTypePxl.AttrSSchema = TtaGetDocumentSSchema (doc);
     attrTypePercent.AttrSSchema = TtaGetDocumentSSchema (doc);
     attrTypePxl.AttrTypeNum = HTML_ATTR_IntHeightPxl;
     attrTypePercent.AttrTypeNum = HTML_ATTR_IntHeightPercent;
     /* is the last character a '%' ? */
     if (buffer[length] == '%')
       {
         /* remove IntHeightPxl */
         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
       {
         /* remove IntHeightPercent */
         attrOld = TtaGetAttribute (el, attrTypePercent);
         /* update IntHeightPxl */
         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;         
           }
       }
   
     if (attrOld != NULL)
       TtaRemoveAttribute (el, attrOld, doc);
     if (sscanf (buffer, "%d", &val))
       TtaSetAttributeValue (attrNew, val, el, doc);
     else
       /* 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);
       }
     if (isImage)
       UpdateImageMap (el, doc, oldHeight, -1);
   }
   
   /*----------------------------------------------------------------------
    CreateAttrIntSize     CreateAttrIntSize
    an HTML attribute "size" has been created for a Font element.     an HTML attribute "size" has been created for a Font element.
    Create the corresponding internal attribute.     Create the corresponding internal attribute.
Line 1319  void EndOfHTMLAttributeValue (char *attr Line 1406  void EndOfHTMLAttributeValue (char *attr
         /* create the corresponding attribute IntWidthPercent or */          /* create the corresponding attribute IntWidthPercent or */
         /* IntWidthPxl */          /* IntWidthPxl */
         CreateAttrWidthPercentPxl (attrValue, lastAttrElement, context->doc, -1);          CreateAttrWidthPercentPxl (attrValue, lastAttrElement, context->doc, -1);
         else if (lastMappedAttr->ThotAttribute == HTML_ATTR_Height_)
           /* HTML attribute "width" for a table or a hr */
           /* create the corresponding attribute IntHeightPercent or */
           /* IntHeightPxl */
           CreateAttrHeightPercentPxl (attrValue, lastAttrElement, context->doc, -1);
       else if (!strcmp (lastMappedAttr->XMLattribute, "size"))        else if (!strcmp (lastMappedAttr->XMLattribute, "size"))
         {          {
           TtaGiveAttributeType (currentAttribute, &attrType, &attrKind);            TtaGiveAttributeType (currentAttribute, &attrType, &attrKind);

Removed from v.1.57  
changed lines
  Added in v.1.58


Webmaster