Diff for /Amaya/amaya/templateInstantiate.c between versions 1.117 and 1.118

version 1.117, 2009/08/27 16:12:57 version 1.118, 2009/08/28 09:02:27
Line 55  Element Template_InsertRepeatChildAfter Line 55  Element Template_InsertRepeatChildAfter
   Element     use, parent; /* xt:use to insert.*/    Element     use, parent; /* xt:use to insert.*/
   ElementType useType;  /* type of xt:use.*/    ElementType useType;  /* type of xt:use.*/
   char       *types = NULL;    char       *types = NULL;
     ThotBool    isInstance;
   
   if (!TtaGetDocumentAccessMode (doc))    if (!TtaGetDocumentAccessMode (doc))
     return NULL;      return NULL;
Line 64  Element Template_InsertRepeatChildAfter Line 65  Element Template_InsertRepeatChildAfter
   useType = TtaGetElementType (child);    useType = TtaGetElementType (child);
   use = TtaCopyElement (child, doc, doc, el);    use = TtaCopyElement (child, doc, doc, el);
   types = GetAttributeStringValueFromNum (child, Template_ATTR_types, NULL);    types = GetAttributeStringValueFromNum (child, Template_ATTR_types, NULL);
   if (IsTemplateInstanceDocument(doc) && useType.ElTypeNum != Template_EL_useSimple)    isInstance = IsTemplateInstanceDocument(doc);
     if (isInstance && useType.ElTypeNum != Template_EL_useSimple)
     TtaChangeElementType (use, Template_EL_useSimple);      TtaChangeElementType (use, Template_EL_useSimple);
   if (types)    if (types)
     {      {
Line 80  Element Template_InsertRepeatChildAfter Line 82  Element Template_InsertRepeatChildAfter
     TtaInsertSibling (use, child, TRUE, doc);      TtaInsertSibling (use, child, TRUE, doc);
   // look for the enclosing target element    // look for the enclosing target element
   parent = GetParentLine (use, useType.ElSSchema);    parent = GetParentLine (use, useType.ElSSchema);
   Template_InsertUseChildren(doc, use, decl, parent, TRUE);    if (isInstance)
       Template_InsertUseChildren (doc, use, decl, parent, TRUE);
     else
       {
         child = Template_FillEmpty (use,doc);
         TtaSelectElement (doc, child);
       }
   SetAttributeStringValueWithUndo (use, Template_ATTR_title, decl->name);    SetAttributeStringValueWithUndo (use, Template_ATTR_title, decl->name);
   SetAttributeStringValueWithUndo (use, Template_ATTR_currentType, decl->name);    SetAttributeStringValueWithUndo (use, Template_ATTR_currentType, decl->name);
   TtaRegisterElementCreate (use, doc);    TtaRegisterElementCreate (use, doc);
Line 871  Element InsertWithNotify (Element el, El Line 879  Element InsertWithNotify (Element el, El
   
   
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
     Template_FillEmpty generates an empty contents
     ----------------------------------------------------------------------*/
   Element Template_FillEmpty (Element el, Document doc)
   {
   #ifdef TEMPLATES
     Element         child;
     ElementType     elType;
   
     // generate a content
     child = TtaGetFirstChild (el);
     if (child == NULL)
       {
         elType = TtaGetElementType (el);
         elType.ElTypeNum = Template_EL_TemplateObject;
         child = TtaNewElement (doc, elType);
         TtaInsertFirstChild (&child, el, doc);
       }
     return child;
   #endif /* TEMPLATES */
     return NULL;
   }
   
   /*----------------------------------------------------------------------
   Template_InsertUseChildren    Template_InsertUseChildren
   Insert children to a xt:use    Insert children to a xt:use
   The dec parameter must be valid and will not be verified. It must be a    The dec parameter must be valid and will not be verified. It must be a

Removed from v.1.117  
changed lines
  Added in v.1.118


Webmaster