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.
This commit is contained in:
Rene Gollent
2014-10-26 22:30:19 -04:00
parent ed04ffb598
commit 23153211e5
@@ -68,6 +68,7 @@ ExpressionEvaluationWindow::_Init()
new BMessage(MSG_EVALUATE_EXPRESSION)); new BMessage(MSG_EVALUATE_EXPRESSION));
BLayoutItem* labelItem = fExpressionInput->CreateLabelLayoutItem(); BLayoutItem* labelItem = fExpressionInput->CreateLabelLayoutItem();
BLayoutItem* inputItem = fExpressionInput->CreateTextViewLayoutItem(); BLayoutItem* inputItem = fExpressionInput->CreateTextViewLayoutItem();
inputItem->SetExplicitMinSize(BSize(200.0, B_SIZE_UNSET));
inputItem->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); inputItem->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
labelItem->View()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); labelItem->View()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
@@ -121,22 +122,20 @@ ExpressionEvaluationWindow::MessageReceived(BMessage* message)
case MSG_EVALUATE_EXPRESSION: case MSG_EVALUATE_EXPRESSION:
{ {
Value* value = NULL; Value* value = NULL;
BString outputText;
status_t error = fLanguage->EvaluateExpression( status_t error = fLanguage->EvaluateExpression(
fExpressionInput->TextView()->Text(), value); fExpressionInput->TextView()->Text(), value);
if (error != B_OK) { if (error != B_OK) {
BString errorText; if (value != NULL)
errorText.SetToFormat("Failed to evaluate expression: %s", value->ToString(outputText);
strerror(error)); else {
BAlert* alert = new(std::nothrow) BAlert("Evaluate Expression", outputText.SetToFormat("Failed to evaluate expression: %s",
errorText.String(), "Close"); strerror(error));
if (alert != NULL) }
alert->Go(); } else
break; value->ToString(outputText);
}
BString valueText; fExpressionOutput->SetText(outputText);
value->ToString(valueText);
fExpressionOutput->SetText(valueText);
break; break;
} }
default: default: