From 12996110fc375b5b57745127a864186b92e753eb Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Fri, 5 Sep 2014 15:13:58 +0200 Subject: [PATCH] Add new array entries with all their children. --- .../georges_editor/georgesform_model.cpp | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/code/studio/src/plugins/georges_editor/georgesform_model.cpp b/code/studio/src/plugins/georges_editor/georgesform_model.cpp index f00e090f2..454e8cdc0 100644 --- a/code/studio/src/plugins/georges_editor/georgesform_model.cpp +++ b/code/studio/src/plugins/georges_editor/georgesform_model.cpp @@ -494,7 +494,8 @@ void CGeorgesFormModel::arrayResized( const QString &name, int size ) else n = e.Name.c_str(); - item->add( CFormItem::Form, n.toUtf8().constData(), i, formName.toUtf8().constData(), 0, item->form(), false ); + NLGEORGES::CFormElmStruct *s = static_cast< NLGEORGES::CFormElmStruct* >( e.Element ); + addStruct( item, s, s->FormDfn, n.toUtf8().constData(), i, formName.toUtf8().constData(), 0 ); } if( celm->Elements.size() == 0 ) @@ -525,22 +526,22 @@ void CGeorgesFormModel::appendArray( QModelIndex idx ) item->form()->getRootNode().getNodeByName( &elm, item->formName().c_str() ); - const NLGEORGES::CFormDfn *parentDfn; - const NLGEORGES::CFormDfn *nodeDfn; - uint indexDfn; - const NLGEORGES::CType *type; - NLGEORGES::UFormDfn::TEntryType entryType; - NLGEORGES::CFormElm *node; + const NLGEORGES::CFormDfn *parentDfn; + const NLGEORGES::CFormDfn *nodeDfn; + uint indexDfn; + const NLGEORGES::CType *type; + NLGEORGES::UFormDfn::TEntryType entryType; + NLGEORGES::CFormElm *node; bool created; bool isArray; if( elm == NULL ) - { - NLGEORGES::UFormElm *uroot = &item->form()->getRootNode(); - NLGEORGES::CFormElm *croot = static_cast< NLGEORGES::CFormElm* >( uroot ); - - croot->createNodeByName( item->formName().c_str(), &parentDfn, indexDfn, &nodeDfn, &type, &node, entryType, isArray, created ); - + { + NLGEORGES::UFormElm *uroot = &item->form()->getRootNode(); + NLGEORGES::CFormElm *croot = static_cast< NLGEORGES::CFormElm* >( uroot ); + + croot->createNodeByName( item->formName().c_str(), &parentDfn, indexDfn, &nodeDfn, &type, &node, entryType, isArray, created ); + if( !created ) return; @@ -566,7 +567,8 @@ void CGeorgesFormModel::appendArray( QModelIndex idx ) std::string formName; node->getFormName( formName ); - item->add( CFormItem::Form, name.c_str(), s, formName.c_str(), 0, item->form(), false ); + NLGEORGES::CFormElmStruct *st = static_cast< NLGEORGES::CFormElmStruct* >( node ); + addStruct( item, st, st->FormDfn, name.c_str(), s, formName.c_str(), 0 ); } void CGeorgesFormModel::deleteArrayEntry( QModelIndex idx )