model_server/driver_aset/src/driver.cxx
//------------------------------------------
// create
//
// Function to insert a string into the application tree
//------------------------------------------
create
Function to insert a string into the application tree
create Function to insert a string into the application tree
void driver::create()
{
    Initialize(driver::create);
    genError*   exc;
    appPtr      root;
    OperPoint*  oper_pt;
    appTreePtr  ins_pt;
    objOperType type;
    appTreePtr  source_node = sel_list.top_node ();
    ostrstream  strm;
    char*       entity = NULL;
    if (current_dialog != NULL)
    {
	if (current_oper_pt != NULL) {
	    oper_pt = current_oper_pt;
	} else {
	    oper_pt = current_dialog->get_current_pt ();
	}
	if ( oper_pt != NULL ) {
	    ins_pt = oper_pt->node;
	    type = oper_pt->type;
	    current_dialog->send_string (strm);
	    entity = strm.str ();
	    clear_selection();
	    if (source_node == checked_cast(appTree,NULL)) {
		viewPtr vw = current_dialog->get_current_view ();
		ldrPtr ldr = vw->get_ldrHeader ();
		root = ldr->get_appHeader ();
	    } else {
		root = source_node->get_header ();
	    }
	    genTry {
		obj_insert (root, type, source_node, ins_pt, entity);
	    }
	    genCatch (exc) {
		driver::error ();
	    }
	    genEndtry;
	    free(entity);
	}
	current_dialog->set_string (NULL);
    }
void driver :: create ( ) { Initialize ( driver :: create ) ; genError * exc ; appPtr root ; OperPoint * oper_pt ; appTreePtr ins_pt ; objOperType type ; appTreePtr source_node = sel_list . top_node ( ) ; ostrstream strm ; char * entity = NULL ; if ( current_dialog != NULL ) { if ( current_oper_pt != NULL ) { oper_pt = current_oper_pt ; } else { oper_pt = current_dialog -> get_current_pt ( ) ; } if ( oper_pt != NULL ) { ins_pt = oper_pt -> node ; type = oper_pt -> type ; current_dialog -> send_string ( strm ) ; entity = strm . str ( ) ; clear_selection ( ) ; if ( source_node == checked_cast ( appTree , NULL ) ) { viewPtr vw = current_dialog -> get_current_view ( ) ; ldrPtr ldr = vw -> get_ldrHeader ( ) ; root = ldr -> get_appHeader ( ) ; } else { root = source_node -> get_header ( ) ; } genTry { obj_insert ( root , type , source_node , ins_pt , entity ) ; } genCatch ( exc ) { driver :: error ( ) ; } genEndtry ; free ( entity ) ; } current_dialog -> set_string ( NULL ) ; }
create
Function to insert a string into the application tree
create Function to insert a string into the application tree
// Calculate insertion point // If there is a current node, use that -- drag and drop // If there is a current insertion point, use that // Either entity or source_node should be defined for obj_insert