Diff for /Amaya/amaya/MathMLbuilder.c between versions 1.131 and 1.132

version 1.131, 2001/12/03 08:27:54 version 1.132, 2001/12/03 16:04:29
Line 303  ThotBool     ElementNeedsPlaceholder (El Line 303  ThotBool     ElementNeedsPlaceholder (El
         }          }
   return ret;    return ret;
 }  }
    
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
   CreatePlaceholders    CreatePlaceholders
   ----------------------------------------------------------------------*/    ----------------------------------------------------------------------*/
 static void     CreatePlaceholders (Element el, Document doc)  static void     CreatePlaceholders (Element el, Document doc)
 {  {
    Element      sibling, prev, constr, child;     Element       sibling, prev, constr, child;
    Attribute    attr;     Attribute     attr;
    ElementType  elType;     ElementType   elType;
    AttributeType        attrType;     AttributeType attrType;
    ThotBool     create;     ThotBool      create, stretchableSubsup;
   
    if (!el)     if (!el)
       return;        return;
Line 368  static void CreatePlaceholders (Element Line 368  static void CreatePlaceholders (Element
       }        }
    if (prev != NULL && create)     if (prev != NULL && create)
       {        {
           stretchableSubsup = FALSE;
         elType = TtaGetElementType (prev);          elType = TtaGetElementType (prev);
         /* don't insert a placeholder after the last element if it's a MF */          /* don't insert a placeholder after the last element if it's a MF */
         if (elType.ElTypeNum == MathML_EL_MF)          if (elType.ElTypeNum == MathML_EL_MF)
Line 385  static void CreatePlaceholders (Element Line 386  static void CreatePlaceholders (Element
                  create = FALSE;                   create = FALSE;
               }                }
            }             }
           else if (elType.ElTypeNum == MathML_EL_MSUBSUP ||
                    elType.ElTypeNum == MathML_EL_MSUB ||
                    elType.ElTypeNum == MathML_EL_MSUP ||
                    elType.ElTypeNum == MathML_EL_MUNDEROVER ||
                    elType.ElTypeNum == MathML_EL_MUNDER ||
                    elType.ElTypeNum == MathML_EL_MUNDEROVER)
             {
               attrType.AttrSSchema = elType.ElSSchema;
               attrType.AttrTypeNum = MathML_ATTR_IntVertStretch;
               if (TtaGetAttribute (prev, attrType))
                 stretchableSubsup = TRUE;
             }
   
         if (create)          if (create)
            {             {
            elType.ElTypeNum = MathML_EL_Construct;             if (stretchableSubsup)
                elType.ElTypeNum = MathML_EL_Construct1;
              else
                elType.ElTypeNum = MathML_EL_Construct;
            constr = TtaNewElement (doc, elType);             constr = TtaNewElement (doc, elType);
            TtaInsertSibling (constr, prev, FALSE, doc);             TtaInsertSibling (constr, prev, FALSE, doc);
            attrType.AttrSSchema = elType.ElSSchema;             attrType.AttrSSchema = elType.ElSSchema;
Line 396  static void CreatePlaceholders (Element Line 413  static void CreatePlaceholders (Element
            TtaAttachAttribute (constr, attr, doc);             TtaAttachAttribute (constr, attr, doc);
            TtaSetAttributeValue (attr, MathML_ATTR_IntPlaceholder_VAL_yes_,             TtaSetAttributeValue (attr, MathML_ATTR_IntPlaceholder_VAL_yes_,
                                  constr, doc);                                   constr, doc);
            }              }
       }        }
 }  }
   
Line 705  static void SetIntHorizStretchAttr (Elem Line 722  static void SetIntHorizStretchAttr (Elem
    Put a IntVertStretch attribute on element el if its base element     Put a IntVertStretch attribute on element el if its base element
    (Base for a MSUBSUP, MSUP or MSUB; UnderOverBase for a MUNDEROVER,     (Base for a MSUBSUP, MSUP or MSUB; UnderOverBase for a MUNDEROVER,
    a MUNDER of a MOVER) contains only a MO element that is a vertically     a MUNDER of a MOVER) contains only a MO element that is a vertically
    stretchable symbol.     stretchable symbol (integral).
  -----------------------------------------------------------------------*/   -----------------------------------------------------------------------*/
 void SetIntVertStretchAttr (Element el, Document doc, int base, Element* selEl)  void SetIntVertStretchAttr (Element el, Document doc, int base, Element* selEl)
 {  {
   Element       child, sibling, textEl, symbolEl, parent, operator;    Element       child, sibling, textEl, symbolEl, parent, operator, next;
   ElementType   elType;    ElementType   elType;
   Attribute     attr;    Attribute     attr;
   AttributeType attrType;    AttributeType attrType;
Line 891  void SetIntVertStretchAttr (Element el, Line 908  void SetIntVertStretchAttr (Element el,
                           {                            {
                             sibling = parent;                              sibling = parent;
                             TtaNextSibling (&sibling);                              TtaNextSibling (&sibling);
                             if (!sibling)                              if (sibling)
                               /* the msubsup or munderover has no next sibling.                                /* the msubsup of munderover element has a next
                                  Add a Construct1 element as the next sibling,                                   sibling */
                                  to allow P rules to operate correctly */  
                               {  
                                 elType.ElTypeNum = MathML_EL_Construct1;  
                                 elType.ElSSchema = MathMLSSchema;  
                                 sibling = TtaNewElement (doc, elType);  
                                 TtaInsertSibling (sibling, parent, FALSE, doc);  
                                 TtaRegisterElementCreate (sibling, doc);  
                               }  
                             else  
                               {                                {
                                 elType = TtaGetElementType (sibling);                                  elType = TtaGetElementType (sibling);
                                 if (elType.ElTypeNum == MathML_EL_Construct &&                                  if (elType.ElTypeNum == MathML_EL_Construct &&
                                     elType.ElSSchema == MathMLSSchema)                                      elType.ElSSchema == MathMLSSchema)
                                     /* the next sibling is a Construct */
                                   {                                    {
                                     TtaRegisterElementDelete (sibling, doc);                                      next = sibling;
                                     TtaRemoveTree (sibling, doc);                                      TtaNextSibling (&next);
                                     ChangeElementType (sibling,                                      if (!next)
                                                        MathML_EL_Construct1);                                        /* there is no other sibling after the
                                     TtaInsertSibling (sibling, parent, FALSE,                                           Construct. Change it into Construct1*/
                                                       doc);                                        {
                                     TtaRegisterElementCreate (sibling, doc);                                         TtaRegisterElementDelete (sibling, doc);
                                          TtaRemoveTree (sibling, doc);
                                          ChangeElementType (sibling,
                                                            MathML_EL_Construct1);
                                          TtaInsertSibling (sibling, parent,
                                                            FALSE, doc);
                                          TtaRegisterElementCreate (sibling, doc);
                                          /* force the msubsup element to be
                                             reformatted and to take into account
                                             its new next sibling */
                                          TtaRemoveTree (parent, doc);
                                          TtaInsertSibling (parent, sibling, TRUE,
                                                            doc);
                                         }
                                   }                                    }
                               }                                }
                             /* force the msubsup element to be reformatted and  
                                take into account its new next sibling */  
                             TtaRemoveTree (parent, doc);  
                             TtaInsertSibling (parent, sibling, TRUE, doc);  
                           }                             } 
                       }                        }
                     }                      }
Line 2003  void      MathMLElementComplete (Element Line 2021  void      MathMLElementComplete (Element
        case MathML_EL_MathML:         case MathML_EL_MathML:
           /* Create placeholders within the MathML element */            /* Create placeholders within the MathML element */
           CreatePlaceholders (TtaGetFirstChild (el), doc);            CreatePlaceholders (TtaGetFirstChild (el), doc);
             break;
        case MathML_EL_MI:         case MathML_EL_MI:
           SetFontstyleAttr (el, doc);            SetFontstyleAttr (el, doc);
           break;            break;

Removed from v.1.131  
changed lines
  Added in v.1.132


Webmaster