Rework layout of BreakConditionConfigWindow.
- Place exception-related settings into their own BBox. - Add another box for image load-related settings. This will eventually allow one to constrain the stop on image load option to limit itself to specific image names. Not yet functional.
This commit is contained in:
@@ -4,9 +4,13 @@
|
||||
*/
|
||||
#include "BreakConditionConfigWindow.h"
|
||||
|
||||
#include <Box.h>
|
||||
#include <Button.h>
|
||||
#include <CheckBox.h>
|
||||
#include <LayoutBuilder.h>
|
||||
#include <ListView.h>
|
||||
#include <MenuField.h>
|
||||
#include <ScrollView.h>
|
||||
|
||||
#include <AutoLocker.h>
|
||||
|
||||
@@ -20,7 +24,12 @@
|
||||
|
||||
enum {
|
||||
MSG_STOP_ON_THROWN_EXCEPTION_CHANGED = 'stec',
|
||||
MSG_STOP_ON_CAUGHT_EXCEPTION_CHANGED = 'scec'
|
||||
MSG_STOP_ON_CAUGHT_EXCEPTION_CHANGED = 'scec',
|
||||
MSG_SET_STOP_FOR_ALL_IMAGES = 'sfai',
|
||||
MSG_SET_STOP_FOR_CUSTOM_IMAGES = 'sfci',
|
||||
MSG_IMAGE_NAME_SELECTION_CHANGED = 'insc',
|
||||
MSG_ADD_IMAGE_NAME = 'anin',
|
||||
MSG_REMOVE_IMAGE_NAME = 'arin'
|
||||
};
|
||||
|
||||
|
||||
@@ -33,6 +42,12 @@ BreakConditionConfigWindow::BreakConditionConfigWindow(::Team* team,
|
||||
fListener(listener),
|
||||
fExceptionThrown(NULL),
|
||||
fExceptionCaught(NULL),
|
||||
fStopOnImageLoad(NULL),
|
||||
fStopImageConstraints(NULL),
|
||||
fStopImageNames(NULL),
|
||||
fStopImageNameInput(NULL),
|
||||
fAddImageNameButton(NULL),
|
||||
fRemoveImageNameButton(NULL),
|
||||
fCloseButton(NULL),
|
||||
fTarget(target)
|
||||
{
|
||||
@@ -78,6 +93,43 @@ BreakConditionConfigWindow::MessageReceived(BMessage* message)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
case MSG_SET_STOP_FOR_ALL_IMAGES:
|
||||
{
|
||||
for (int32 i = 0; i < fStopImageNames->CountItems(); i++)
|
||||
fStopImageNames->ItemAt(i)->SetEnabled(false);
|
||||
fStopImageNameInput->SetEnabled(false);
|
||||
fAddImageNameButton->SetEnabled(false);
|
||||
fRemoveImageNameButton->SetEnabled(false);
|
||||
break;
|
||||
}
|
||||
|
||||
case MSG_SET_STOP_FOR_CUSTOM_IMAGES:
|
||||
{
|
||||
for (int32 i = 0; i < fStopImageNames->CountItems(); i++)
|
||||
fStopImageNames->ItemAt(i)->SetEnabled(true);
|
||||
fStopImageNameInput->SetEnabled(true);
|
||||
fAddImageNameButton->SetEnabled(
|
||||
fStopImageNameInput->TextView()->TextLength() > 0);
|
||||
fRemoveImageNameButton->SetEnabled(
|
||||
fStopImageNames->CurrentSelection() >= 0);
|
||||
break;
|
||||
}
|
||||
|
||||
case MSG_IMAGE_NAME_SELECTION_CHANGED:
|
||||
{
|
||||
fRemoveImageNameButton->SetEnabled(
|
||||
fStopImageNames->CurrentSelection() >= 0);
|
||||
break;
|
||||
}
|
||||
|
||||
case MSG_STOP_ON_IMAGE_LOAD:
|
||||
{
|
||||
fListener->SetStopOnImageLoadRequested(
|
||||
fStopOnImageLoad->Value() == B_CONTROL_ON);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
BWindow::MessageReceived(message);
|
||||
break;
|
||||
@@ -97,19 +149,19 @@ BreakConditionConfigWindow::Show()
|
||||
void
|
||||
BreakConditionConfigWindow::_Init()
|
||||
{
|
||||
BLayoutBuilder::Group<>(this, B_VERTICAL)
|
||||
.SetInsets(B_USE_DEFAULT_SPACING)
|
||||
.Add(fExceptionThrown = new BCheckBox("exceptionThrown",
|
||||
"Stop when an exception is thrown", new BMessage(
|
||||
MSG_STOP_ON_THROWN_EXCEPTION_CHANGED)))
|
||||
.Add(fExceptionCaught = new BCheckBox("exceptionCaught",
|
||||
"Stop when an exception is caught", new BMessage(
|
||||
MSG_STOP_ON_CAUGHT_EXCEPTION_CHANGED)))
|
||||
.AddGroup(B_HORIZONTAL, 4.0f)
|
||||
.AddGlue()
|
||||
.Add(fCloseButton = new BButton("Close", new BMessage(
|
||||
B_QUIT_REQUESTED)))
|
||||
.End();
|
||||
BBox* exceptionSettingsBox = new BBox("exceptionBox");
|
||||
exceptionSettingsBox->SetLabel("Exceptions");
|
||||
exceptionSettingsBox->AddChild(BLayoutBuilder::Group<>()
|
||||
.AddGroup(B_VERTICAL)
|
||||
.SetInsets(B_USE_DEFAULT_SPACING)
|
||||
.Add(fExceptionThrown = new BCheckBox("exceptionThrown",
|
||||
"Stop when an exception is thrown",
|
||||
new BMessage(MSG_STOP_ON_THROWN_EXCEPTION_CHANGED)))
|
||||
.Add(fExceptionCaught = new BCheckBox("exceptionCaught",
|
||||
"Stop when an exception is caught",
|
||||
new BMessage(MSG_STOP_ON_CAUGHT_EXCEPTION_CHANGED)))
|
||||
.End()
|
||||
.View());
|
||||
|
||||
fExceptionThrown->SetTarget(this);
|
||||
fExceptionCaught->SetTarget(this);
|
||||
@@ -117,8 +169,64 @@ BreakConditionConfigWindow::_Init()
|
||||
// TODO: enable once implemented
|
||||
fExceptionCaught->SetEnabled(false);
|
||||
|
||||
fCloseButton->SetTarget(this);
|
||||
|
||||
BBox* imageSettingsBox = new BBox("imageBox");
|
||||
imageSettingsBox->SetLabel("Images");
|
||||
BMenu* stopImageMenu = new BMenu("stopImageTypesMenu");
|
||||
|
||||
stopImageMenu->AddItem(new BMenuItem("All",
|
||||
new BMessage(MSG_SET_STOP_FOR_ALL_IMAGES)));
|
||||
stopImageMenu->AddItem(new BMenuItem("Custom",
|
||||
new BMessage(MSG_SET_STOP_FOR_CUSTOM_IMAGES)));
|
||||
|
||||
BListView* fStopImageNames = new BListView("customImageList",
|
||||
B_MULTIPLE_SELECTION_LIST);
|
||||
fStopImageNames->SetSelectionMessage(
|
||||
new BMessage(MSG_IMAGE_NAME_SELECTION_CHANGED));
|
||||
|
||||
imageSettingsBox->AddChild(BLayoutBuilder::Group<>()
|
||||
.AddGroup(B_VERTICAL)
|
||||
.SetInsets(B_USE_DEFAULT_SPACING)
|
||||
.Add(fStopOnImageLoad = new BCheckBox("stopOnImage",
|
||||
"Stop when an image is loaded",
|
||||
new BMessage(MSG_STOP_ON_IMAGE_LOAD)))
|
||||
.Add(fStopImageConstraints = new BMenuField(
|
||||
"stopTypes", "Types:", stopImageMenu))
|
||||
.Add(new BScrollView("stopImageScroll", fStopImageNames,
|
||||
0, false, true))
|
||||
.Add(fStopImageNameInput = new BTextControl("stopImageName",
|
||||
"Image:", NULL, NULL))
|
||||
.AddGroup(B_HORIZONTAL)
|
||||
.AddGlue()
|
||||
.Add(fAddImageNameButton = new BButton("Add",
|
||||
new BMessage(MSG_ADD_IMAGE_NAME)))
|
||||
.Add(fRemoveImageNameButton = new BButton("Remove",
|
||||
new BMessage(MSG_REMOVE_IMAGE_NAME)))
|
||||
.End()
|
||||
.End()
|
||||
.View());
|
||||
|
||||
font_height fontHeight;
|
||||
be_plain_font->GetHeight(&fontHeight);
|
||||
float minListHeight = 5 * (fontHeight.ascent + fontHeight.descent
|
||||
+ fontHeight.leading);
|
||||
fStopImageNames->SetExplicitMinSize(BSize(B_SIZE_UNSET, minListHeight));
|
||||
|
||||
BLayoutBuilder::Group<>(this, B_VERTICAL)
|
||||
.SetInsets(B_USE_DEFAULT_SPACING)
|
||||
.Add(exceptionSettingsBox)
|
||||
.Add(imageSettingsBox)
|
||||
.AddGroup(B_HORIZONTAL)
|
||||
.AddGlue()
|
||||
.Add(fCloseButton = new BButton("Close", new BMessage(
|
||||
B_QUIT_REQUESTED)))
|
||||
.End();
|
||||
|
||||
|
||||
fCloseButton->SetTarget(this);
|
||||
stopImageMenu->SetTargetForItems(this);
|
||||
stopImageMenu->SetLabelFromMarked(true);
|
||||
stopImageMenu->ItemAt(0L)->SetMarked(true);
|
||||
|
||||
// check if the exception breakpoints are already installed
|
||||
AutoLocker< ::Team> teamLocker(fTeam);
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
|
||||
class BButton;
|
||||
class BCheckBox;
|
||||
class BListView;
|
||||
class BMenuField;
|
||||
class BTextControl;
|
||||
class ImageDebugInfo;
|
||||
class Team;
|
||||
class UserInterfaceListener;
|
||||
@@ -47,6 +50,12 @@ private:
|
||||
UserInterfaceListener* fListener;
|
||||
BCheckBox* fExceptionThrown;
|
||||
BCheckBox* fExceptionCaught;
|
||||
BCheckBox* fStopOnImageLoad;
|
||||
BMenuField* fStopImageConstraints;
|
||||
BListView* fStopImageNames;
|
||||
BTextControl* fStopImageNameInput;
|
||||
BButton* fAddImageNameButton;
|
||||
BButton* fRemoveImageNameButton;
|
||||
BButton* fCloseButton;
|
||||
BHandler* fTarget;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user