version 1.94, 2008/11/06 16:36:20
|
version 1.95, 2008/11/07 16:44:14
|
Line 1344 void Template_PreInstantiateComponents (
|
Line 1344 void Template_PreInstantiateComponents (
|
Make it unique. |
Make it unique. |
Return TRUE if the name is not modified. |
Return TRUE if the name is not modified. |
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
ThotBool Template_SetName (Document doc, Element elem, const char* name, ThotBool withUndo) |
ThotBool Template_SetName (Document doc, Element el, const char *name, |
|
ThotBool withUndo) |
{ |
{ |
#ifdef TEMPLATES |
#ifdef TEMPLATES |
if(doc && elem && name) |
AttributeType attType; |
|
Attribute attr; |
|
|
|
if (doc && el && name) |
{ |
{ |
SetAttributeStringValue(elem, Template_ATTR_name, name); |
attType.AttrSSchema = TtaGetElementType(el).ElSSchema; |
return !MakeUniqueName(elem, doc, TRUE, withUndo); |
attType.AttrTypeNum = Template_ATTR_name; |
|
attr = TtaGetAttribute(el, attType); |
|
if (attr == NULL) |
|
{ |
|
attr = TtaNewAttribute (attType); |
|
TtaAttachAttribute (el, attr, doc); |
|
} |
|
TtaSetAttributeText (attr, name, el, doc); |
|
return TtaIsValidID (attr, TRUE); |
} |
} |
#endif /* TEMPLATES */ |
#endif /* TEMPLATES */ |
return FALSE; |
return FALSE; |