Truncate the message to locate the source path if it currently wouldn't fit within

the string view's bounds. Partially resolves #8094.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@43207 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent
2011-11-07 02:10:35 +00:00
parent 58f5b04b3b
commit a2db8c5653
@@ -1108,6 +1108,7 @@ TeamWindow::_HandleSourceCodeChanged()
SourceCode* sourceCode = fActiveFunction->GetFunction()->GetSourceCode(); SourceCode* sourceCode = fActiveFunction->GetFunction()->GetSourceCode();
LocatableFile* sourceFile = NULL; LocatableFile* sourceFile = NULL;
BString sourceText; BString sourceText;
BString truncatedText;
if (sourceCode == NULL) if (sourceCode == NULL)
sourceCode = fActiveFunction->GetSourceCode(); sourceCode = fActiveFunction->GetSourceCode();
@@ -1121,7 +1122,12 @@ TeamWindow::_HandleSourceCodeChanged()
&& sourceFile != NULL) { && sourceFile != NULL) {
sourceText.Prepend("Click to locate source file '"); sourceText.Prepend("Click to locate source file '");
sourceText += "'"; sourceText += "'";
fSourcePathView->SetText(sourceText.String()); truncatedText = sourceText;
fSourcePathView->TruncateString(&truncatedText, B_TRUNCATE_MIDDLE,
fSourcePathView->Bounds().Width());
if (sourceText != truncatedText)
fSourcePathView->SetToolTip(sourceText.String());
fSourcePathView->SetText(truncatedText.String());
} else if (sourceFile != NULL) { } else if (sourceFile != NULL) {
sourceText.Prepend("File: "); sourceText.Prepend("File: ");
fSourcePathView->SetText(sourceText.String()); fSourcePathView->SetText(sourceText.String());