Debugger: Add expression prompt window handling.

TeamWindow now handles the messages for summoning/dismissing
the expression prompt window.
This commit is contained in:
Rene Gollent 2014-11-05 23:53:15 -05:00
parent 8336fb8168
commit 11832b28af
2 changed files with 50 additions and 1 deletions

View File

@ -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<void**>(&addTarget)) != B_OK) {
break;
}
if (fExpressionPromptWindow != NULL) {
AutoLocker<BWindow> 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) {

View File

@ -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;