From 11832b28af25aef0bd53510cdc81f41efd88b88a Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Wed, 5 Nov 2014 23:53:15 -0500 Subject: [PATCH] Debugger: Add expression prompt window handling. TeamWindow now handles the messages for summoning/dismissing the expression prompt window. --- .../gui/team_window/TeamWindow.cpp | 45 +++++++++++++++++++ .../gui/team_window/TeamWindow.h | 6 ++- 2 files changed, 50 insertions(+), 1 deletion(-) 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 d820398629..f1e54b7352 100644 --- a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.cpp @@ -42,6 +42,7 @@ #include "DisassembledCode.h" #include "BreakpointEditWindow.h" #include "ExpressionEvaluationWindow.h" +#include "ExpressionPromptWindow.h" #include "FileSourceCode.h" #include "GuiSettingsUtils.h" #include "GuiTeamUiSettings.h" @@ -141,6 +142,7 @@ TeamWindow::TeamWindow(::Team* team, UserInterfaceListener* listener) fBreakpointEditWindow(NULL), fInspectorWindow(NULL), fExpressionWindow(NULL), + fExpressionPromptWindow(NULL), fFilePanel(NULL), fActiveSourceWorker(-1) { @@ -374,6 +376,49 @@ TeamWindow::MessageReceived(BMessage* message) fExpressionWindow = NULL; break; } + case MSG_SHOW_EXPRESSION_PROMPT_WINDOW: + { + BHandler* addTarget; + if (message->FindPointer("target", + reinterpret_cast(&addTarget)) != B_OK) { + break; + } + + if (fExpressionPromptWindow != NULL) { + AutoLocker lock(fExpressionPromptWindow); + if (lock.IsLocked()) + fExpressionPromptWindow->Activate(true); + } else { + try { + fExpressionPromptWindow = ExpressionPromptWindow::Create( + addTarget, this); + if (fExpressionPromptWindow != NULL) + fExpressionPromptWindow->Show(); + } catch (...) { + // TODO: notify user + } + } + break; + } + case MSG_EXPRESSION_PROMPT_WINDOW_CLOSED: + { + fExpressionPromptWindow = NULL; + + const char* expression; + int32 type; + BMessenger targetMessenger; + if (message->FindString("expression", &expression) == B_OK + && message->FindInt32("type", &type) == B_OK + && message->FindMessenger("target", &targetMessenger) + == B_OK) { + BMessage addMessage(MSG_ADD_NEW_EXPRESSION); + addMessage.AddString("expression", expression); + addMessage.AddInt32("type", type); + + targetMessenger.SendMessage(&addMessage); + } + break; + } case MSG_SHOW_BREAK_CONDITION_CONFIG_WINDOW: { if (fBreakConditionConfigWindow != NULL) { 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 ec0cd5c5e4..617187eea7 100644 --- a/src/apps/debugger/user_interface/gui/team_window/TeamWindow.h +++ b/src/apps/debugger/user_interface/gui/team_window/TeamWindow.h @@ -35,12 +35,14 @@ class ConsoleOutputView; class BreakConditionConfigWindow; class BreakpointEditWindow; class ExpressionEvaluationWindow; +class ExpressionPromptWindow; class Image; class InspectorWindow; class RegistersView; class SourceCode; class SourceLanguage; class StackFrame; +class Type; class UserBreakpoint; class UserInterfaceListener; class VariablesView; @@ -185,7 +187,8 @@ private: const BMessage* settings); status_t _GetActiveSourceLanguage( - SourceLanguage*& language); + SourceLanguage*& _language); + private: ::Team* fTeam; ::Thread* fActiveThread; @@ -224,6 +227,7 @@ private: BreakpointEditWindow* fBreakpointEditWindow; InspectorWindow* fInspectorWindow; ExpressionEvaluationWindow* fExpressionWindow; + ExpressionPromptWindow* fExpressionPromptWindow; GuiTeamUiSettings fUiSettings; BFilePanel* fFilePanel; thread_id fActiveSourceWorker;