| 480 | //----------------------------------------------------------------------------- |
| 481 | |
| 482 | void GuiTreeViewCtrl::Item::getDisplayText(U32 bufLen, char *buf) |
| 483 | { |
| 484 | FrameAllocatorMarker txtAlloc; |
| 485 | |
| 486 | //if we're doing the special case of forcing the item text, just skip the rest of this junk |
| 487 | if (mState.test(ForceItemName)) |
| 488 | { |
| 489 | StringTableEntry text = (mScriptInfo.mText) ? mScriptInfo.mText : StringTable->EmptyString(); |
| 490 | dStrncpy(buf, text, bufLen); |
| 491 | return; |
| 492 | } |
| 493 | |
| 494 | if( mState.test( InspectorData ) ) |
| 495 | { |
| 496 | SimObject *pObject = getObject(); |
| 497 | if( pObject ) |
| 498 | { |
| 499 | const char* pObjName = pObject->getName(); |
| 500 | const char* pInternalName = pObject->getInternalName(); |
| 501 | |
| 502 | bool hasInternalName = pInternalName && pInternalName[0]; |
| 503 | bool hasObjectName = pObjName && pObjName[0]; |
| 504 | |
| 505 | const char* pClassName = pObject->getClassName(); |
| 506 | |
| 507 | if( showInternalNameOnly() ) |
| 508 | dSprintf( buf, bufLen, "%s", hasInternalName ? pInternalName : "(none)" ); |
| 509 | else if( showObjectNameOnly() ) |
| 510 | { |
| 511 | if( !hasObjectName && mState.test( ShowClassNameForUnnamed ) ) |
| 512 | dSprintf( buf, bufLen, "%s", pClassName ); |
| 513 | else |
| 514 | dSprintf( buf, bufLen, "%s", hasObjectName ? pObjName : "(none)" ); |
| 515 | } |
| 516 | else |
| 517 | { |
| 518 | char* ptr = buf; |
| 519 | int len = bufLen; |
| 520 | |
| 521 | if( mState.test( ShowObjectId ) ) |
| 522 | { |
| 523 | S32 n = dSprintf( ptr, len, "%d: ", pObject->getId() ); |
| 524 | ptr += n; |
| 525 | len -= n; |
| 526 | } |
| 527 | |
| 528 | if( mState.test( ShowClassName ) ) |
| 529 | { |
| 530 | S32 n; |
| 531 | if( hasObjectName && mState.test( ShowObjectName ) ) |
| 532 | n = dSprintf( ptr, len, "%s - ", pClassName ); |
| 533 | else |
| 534 | n = dSprintf( ptr, len, "%s", pClassName ); |
| 535 | |
| 536 | ptr += n; |
| 537 | len -= n; |
| 538 | } |
| 539 |
no test coverage detected