diff --git a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp index c499dfeedf..e52718472e 100644 --- a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp @@ -990,6 +990,7 @@ TeamWindow::_SetActiveSourceCode(SourceCode* sourceCode) fSourceView->SetSourceCode(fActiveSourceCode); + _UpdateSourcePathState(); _ScrollToActiveFunction(); } @@ -1049,6 +1050,39 @@ TeamWindow::_UpdateRunButtons() } +void +TeamWindow::_UpdateSourcePathState() +{ + LocatableFile* sourceFile = NULL; + BString sourceText = "Source file unavailable."; + BString truncatedText; + + if (fActiveSourceCode != NULL) { + sourceFile = fActiveFunction->GetFunctionDebugInfo()->SourceFile(); + + if (sourceFile != NULL && !sourceFile->GetLocatedPath(sourceText)) + sourceFile->GetPath(sourceText); + + if (fActiveSourceCode->GetSourceFile() == NULL && sourceFile != NULL) { + sourceText.Prepend("Click to locate source file '"); + sourceText += "'"; + truncatedText = sourceText; + fSourcePathView->TruncateString(&truncatedText, B_TRUNCATE_MIDDLE, + fSourcePathView->Bounds().Width()); + } else if (sourceFile != NULL) { + sourceText.Prepend("File: "); + } + } + + if (!truncatedText.IsEmpty() && truncatedText != sourceText) { + fSourcePathView->SetToolTip(sourceText.String()); + fSourcePathView->SetText(truncatedText); + } + else + fSourcePathView->SetText(sourceText); +} + + void TeamWindow::_ScrollToActiveFunction() { @@ -1183,34 +1217,9 @@ TeamWindow::_HandleSourceCodeChanged() AutoLocker< ::Team> locker(fTeam); SourceCode* sourceCode = fActiveFunction->GetFunction()->GetSourceCode(); - LocatableFile* sourceFile = NULL; - BString sourceText; - BString truncatedText; if (sourceCode == NULL) sourceCode = fActiveFunction->GetSourceCode(); - if (sourceCode != NULL) - sourceFile = fActiveFunction->GetFunctionDebugInfo()->SourceFile(); - - if (sourceFile != NULL && !sourceFile->GetLocatedPath(sourceText)) - sourceFile->GetPath(sourceText); - - if (sourceCode != NULL && sourceCode->GetSourceFile() == NULL - && sourceFile != NULL) { - sourceText.Prepend("Click to locate source file '"); - sourceText += "'"; - 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) { - sourceText.Prepend("File: "); - fSourcePathView->SetText(sourceText.String()); - } else - fSourcePathView->SetText("Source file unavailable."); - BReference sourceCodeReference(sourceCode); locker.Unlock(); diff --git a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.h b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.h index 3732ed0870..14635d4a77 100644 --- a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.h +++ b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.h @@ -132,6 +132,7 @@ private: void _SetActiveSourceCode(SourceCode* sourceCode); void _UpdateCpuState(); void _UpdateRunButtons(); + void _UpdateSourcePathState(); void _ScrollToActiveFunction(); void _HandleThreadStateChanged(thread_id threadID);