DescriptionPaint::DescriptionPaint( WBRWindow * prnt, const WRect & r, Symbol * sym ) : _parent( prnt ) , _rect( r ) , _current( -1 ) //-------------------------------------------------------------------- { int i; WVList desc; Description * entry; WString buf; const char * uDefSymName; int x = r.x(); int w; int h; _parts = new WCPtrOrderedVector<DescriptionPart>; sym->description( desc ); for( i = 0; i < desc.count(); i += 1 ) { entry = (Description *) desc[i]; if( entry->symbol() ) { if( sym->isEqual( entry->symbol() ) ) { // don't hilight the symbol we're describing buf.concat( entry->name() ); delete entry->symbol(); } else { if( buf != "" ) { // flush buf w = prnt->getTextExtentX( buf ); h = prnt->getTextExtentY( buf ); _parts->append( new DescriptionPart( buf.gets(), NULL, WRect(x,r.y(),w, h ) ) ); buf=""; x+=w; } uDefSymName = entry->name(); w = prnt->getTextExtentX( uDefSymName ); h = prnt->getTextExtentY( uDefSymName ); _parts->append( new DescriptionPart( uDefSymName, entry->symbol(), WRect(x,r.y(),w, h ) ) ); x+=w; } } else { buf.concat( entry->name() ); } } desc.deleteContents(); if( buf != "" ) { // flush buf w = prnt->getTextExtentX( buf ); h = prnt->getTextExtentY( buf ); _parts->append( new DescriptionPart( buf, NULL, WRect(x,r.y(),w, h ) ) ); buf=""; x+=w; } _rect.w( x - abs( _rect.x() ) ); }
ClassType * StrucViewItem::flattenTypeDesc( Symbol * sym, WString & desc ) //------------------------------------------------------------------------ { ClassType * classType = NULL; char * str = NULL; WVList typeParts; Description * entry; int i; REQUIRE( sym != NULL, "strucview::flatten passed null symbol!" ); dr_sym_type stype = sym->symtype(); REQUIRE( stype != DR_SYM_NOT_SYM,"strucview::flatten bad set"); switch( stype ) { case DR_SYM_VARIABLE: // need to find out the type of the data member ((VariableSym *) sym)->loadTypeInfo( typeParts ); for( i = 0; i < typeParts.count(); i++ ) { entry = (Description *) typeParts[i]; if( entry->_nameGoesHere ) { desc.concat( entry->u.text ); } else { if( !sym->isEqual( entry->u.sym ) ){ if( classType == NULL ) { classType = flattenTypeDesc( entry->u.sym, desc ); } else { desc.concat( entry->u.sym->name() ); } } } } break; case DR_SYM_TYPEDEF: case DR_SYM_ENUM: sym->description( typeParts ); for( i = 0; i < typeParts.count(); i++ ) { entry = (Description *) typeParts[ i ]; if( entry->_isUserDefined ) { if( entry->u.sym->symtype() == DR_SYM_CLASS && classType == NULL ) { classType = (ClassType *) entry->u.sym; } } } desc.concat( sym->name() ); break; case DR_SYM_CLASS: if( _parent->isSeen( sym ) ) { desc.concat( sym->name() ); classType = NULL; } else { classType = (ClassType *) sym; desc.concat( classType->name() ); } break; default: {} } for( i=0; i < typeParts.count(); i++ ) { entry = (Description *) typeParts[ i ]; if( entry->_isUserDefined && entry->u.sym != classType && entry->u.sym != sym ) { delete entry->u.sym; } } typeParts.deleteContents(); return classType; }