model_server/gra/src/graSymbol.h.cxx
// Reports update of text to application
Reports update of text to application
Reports update of text to application
int graParametricSymbol::report_text_update()
{
    Initialize (graParametricSymbol::report_text_update);
    int reported = 0;
    if (text_focus == 0)
	return reported;
    ldrTreePtr ldrnode = viewnode->get_ldrTree();
    if (ldrnode)
    {
	appTreePtr appnode = ldrnode->get_appTree();
	if (appnode == NULL)
	{
	    ldrnode = checked_cast(ldrTree,ldrnode->get_parent());
	    appnode = ldrnode->get_appTree();
	}
	if (appnode)
	{
	    app*  apphead = checked_cast(app, appnode->get_header());
	    view* viewhead = checked_cast(view, viewnode->get_header());
	    if (apphead == NULL)
		return reported;
	    switch (apphead->get_type())
	    {
	      case App_SMT:
	      case App_STE:
	      case App_PROJECT:
		if (modified_token)
		{
		    const char*const text = (char*) editbuffer->Text();
		    if (modification_end > modification_start)
		    {
			const int span = modification_end - modification_start;
			ostrstream ostr;
			RelationalPtr(modified_token)->send_string(ostr);
			const int orig_str_len = ostr.pcount();
			ostr << ends;
			const char*const orig_str = ostr.str();
			ostr.rdbuf()->freeze(0);
			if (orig_str_len != span ||
			    strncmp (orig_str, text + modification_start, span))
			{
			    char* new_str = new char[span + 1];
			    strncpy (new_str, text + modification_start, span);
			    new_str[span]='\0';
			    if (apphead->get_type () == App_SMT)
				checked_cast(smtHeader,apphead)->
				    suspend_parsing();
			    obj_insert(
				appnode->get_header(), REPLACE, NULL,
				checked_cast(appTree, modified_token), new_str);
			    reported = 1;
			    delete [] new_str;
			}
		    }
		    else
		    {
			obj_remove (
			    apphead, checked_cast(appTree, modified_token));
			reported = 1;
		    }
		}
		break;
	      case App_RTL:
	      case App_LAST:
		break;
	    }
	}
    }
    return reported;
}
int graParametricSymbol :: report_text_update ( ) { Initialize ( graParametricSymbol :: report_text_update ) ; int reported = 0 ; if ( text_focus == 0 ) return reported ; ldrTreePtr ldrnode = viewnode -> get_ldrTree ( ) ; if ( ldrnode ) { appTreePtr appnode = ldrnode -> get_appTree ( ) ; if ( appnode == NULL ) { ldrnode = checked_cast ( ldrTree , ldrnode -> get_parent ( ) ) ; appnode = ldrnode -> get_appTree ( ) ; } if ( appnode ) { app * apphead = checked_cast ( app , appnode -> get_header ( ) ) ; view * viewhead = checked_cast ( view , viewnode -> get_header ( ) ) ; if ( apphead == NULL ) return reported ; switch ( apphead -> get_type ( ) ) { case App_SMT : case App_STE : case App_PROJECT : if ( modified_token ) { const char * const text = ( char * ) editbuffer -> Text ( ) ; if ( modification_end > modification_start ) { const int span = modification_end - modification_start ; ostrstream ostr ; RelationalPtr ( modified_token ) -> send_string ( ostr ) ; const int orig_str_len = ostr . pcount ( ) ; ostr << ends ; const char * const orig_str = ostr . str ( ) ; ostr . rdbuf ( ) -> freeze ( 0 ) ; if ( orig_str_len != span || strncmp ( orig_str , text + modification_start , span ) ) { char * new_str = new char [ span + 1 ] ; strncpy ( new_str , text + modification_start , span ) ; new_str [ span ] = ' \0 ' ; if ( apphead -> get_type ( ) == App_SMT ) checked_cast ( smtHeader , apphead ) -> suspend_parsing ( ) ; obj_insert ( appnode -> get_header ( ) , REPLACE , NULL , checked_cast ( appTree , modified_token ) , new_str ) ; reported = 1 ; delete [ ] new_str ; } } else { obj_remove ( apphead , checked_cast ( appTree , modified_token ) ) ; reported = 1 ; } } break ; case App_RTL : case App_LAST : break ; } } } return reported ; }
Reports update of text to application
Reports update of text to application
// Get app node // Reporting depends on apptype and possibly viewtype // Let the ostrstream delete its buffer. // suspend smt parsing