hrev44206 adds 1 changeset to branch 'master' old head: 028ad0311cbf31c75dfa6da3f7f912a98969ce14 new head: c2d1fc4ffa7236283061c6358c31f9067c672ca6 ---------------------------------------------------------------------------- c2d1fc4: Fix updating of source path. Factor out updating of the source path view into a dedicated function, and fix some errors that would sometimes result in the text not updating properly when switching stack frames, particularly if the target frame didn't have source code available. [ Rene Gollent <anevilyak@xxxxxxxxx> ] ---------------------------------------------------------------------------- Revision: hrev44206 Commit: c2d1fc4ffa7236283061c6358c31f9067c672ca6 URL: http://cgit.haiku-os.org/haiku/commit/?id=c2d1fc4 Author: Rene Gollent <anevilyak@xxxxxxxxx> Date: Mon May 28 01:46:50 2012 UTC ---------------------------------------------------------------------------- 2 files changed, 35 insertions(+), 25 deletions(-) .../user_interface/gui/team_window/TeamWindow.cpp | 59 +++++++++------- .../user_interface/gui/team_window/TeamWindow.h | 1 + ---------------------------------------------------------------------------- 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 c499dfe..e527184 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(); } @@ -1050,6 +1051,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() { // Scroll to the active function, if it has been selected manually. @@ -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<SourceCode> 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 3732ed0..14635d4 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);