From 23153211e5194283af2835f757a8dcd7233304d0 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sun, 26 Oct 2014 21:57:25 -0400 Subject: [PATCH] Debugger: More tweaks to expression window. - If expression evaluation fails in some way, report it in the result view, rather than popping up a BAlert for it. - Set minimum size on input field. --- .../ExpressionEvaluationWindow.cpp | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/apps/debugger/user_interface/gui/team_window/ExpressionEvaluationWindow.cpp b/src/apps/debugger/user_interface/gui/team_window/ExpressionEvaluationWindow.cpp index a764557c13..1e2985082a 100644 --- a/src/apps/debugger/user_interface/gui/team_window/ExpressionEvaluationWindow.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/ExpressionEvaluationWindow.cpp @@ -68,6 +68,7 @@ ExpressionEvaluationWindow::_Init() new BMessage(MSG_EVALUATE_EXPRESSION)); BLayoutItem* labelItem = fExpressionInput->CreateLabelLayoutItem(); BLayoutItem* inputItem = fExpressionInput->CreateTextViewLayoutItem(); + inputItem->SetExplicitMinSize(BSize(200.0, B_SIZE_UNSET)); inputItem->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); labelItem->View()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); @@ -121,22 +122,20 @@ ExpressionEvaluationWindow::MessageReceived(BMessage* message) case MSG_EVALUATE_EXPRESSION: { Value* value = NULL; + BString outputText; status_t error = fLanguage->EvaluateExpression( fExpressionInput->TextView()->Text(), value); if (error != B_OK) { - BString errorText; - errorText.SetToFormat("Failed to evaluate expression: %s", - strerror(error)); - BAlert* alert = new(std::nothrow) BAlert("Evaluate Expression", - errorText.String(), "Close"); - if (alert != NULL) - alert->Go(); - break; - } + if (value != NULL) + value->ToString(outputText); + else { + outputText.SetToFormat("Failed to evaluate expression: %s", + strerror(error)); + } + } else + value->ToString(outputText); - BString valueText; - value->ToString(valueText); - fExpressionOutput->SetText(valueText); + fExpressionOutput->SetText(outputText); break; } default: