Beispiel #1
0
void CGeorgesEditDoc::updateDocumentStructure ()
{
	RootObject.clean ();

	// Get left view
	CLeftView *leftView = getLeftView ();

	// Backup current selection
	uint selection = 0xffffffff;
	if (IsWindow (*leftView))
		selection = leftView->getCurrentSelectionId ();

	// Read the file
	if (isType())
	{
		// Setup sub object tree 
		RootObject.create (CGeorgesEditDocSub::Null, "Type", 0xffffffff, "NULL", 0xffffffff);
		RootObject.add (CGeorgesEditDocSub::Header, "Header", 0xffffffff, "NULL", 0xffffffff);
		RootObject.add (CGeorgesEditDocSub::Type, "Content", 0xffffffff, "NULL", 0xffffffff);
	}
	else if (isDfn ())
	{
		// Setup sub object tree 
		RootObject.create (CGeorgesEditDocSub::Null, "Dfn", 0xffffffff, "NULL", 0xffffffff);
		RootObject.add (CGeorgesEditDocSub::Header, "Header", 0xffffffff, "NULL", 0xffffffff);
		RootObject.add (CGeorgesEditDocSub::Dfn, "Content", 0xffffffff, "NULL", 0xffffffff);
	}
	else
	{
		// Setup sub object tree 
		RootObject.create (CGeorgesEditDocSub::Null, "Form", 0xffffffff, "NULL", 0xffffffff);
		RootObject.add (CGeorgesEditDocSub::Header, "Header", 0xffffffff, "NULL", 0xffffffff);

		// Get the parents
		CFormElmStruct *rootstruct = &((CForm*)(UForm*)Form)->Elements;
		addStruct (&RootObject, rootstruct, rootstruct->FormDfn, "Content", 0xffffffff, "", 0);

		// Get held objects

		// Write held elements
		uint i;
		for (i=0; i<CForm::HeldElementCount; i++)
		{
			rootstruct = ((CForm*)(UForm*)Form)->HeldElements[i];
			addStruct (&RootObject, rootstruct, rootstruct->FormDfn, ("Hold " + toString (1+i)).c_str (), 0xffffffff, "", i+1);
		}
	}

	// Update left view structure
	leftView->getFromDocument ();

	// Set the old selction flag
	if (selection != 0xffffffff)
	{
		// Reselect backuped node
		leftView->setCurrentSelectionId (selection);
	}
	else
	{
		// Select the content
		leftView->setCurrentSelectionId (2);
	}
}