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 "BreakConditionConfigWindow.h"
|
||||||
|
|
||||||
|
#include <Box.h>
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
#include <CheckBox.h>
|
#include <CheckBox.h>
|
||||||
#include <LayoutBuilder.h>
|
#include <LayoutBuilder.h>
|
||||||
|
#include <ListView.h>
|
||||||
|
#include <MenuField.h>
|
||||||
|
#include <ScrollView.h>
|
||||||
|
|
||||||
#include <AutoLocker.h>
|
#include <AutoLocker.h>
|
||||||
|
|
||||||
@@ -20,7 +24,12 @@
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
MSG_STOP_ON_THROWN_EXCEPTION_CHANGED = 'stec',
|
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),
|
fListener(listener),
|
||||||
fExceptionThrown(NULL),
|
fExceptionThrown(NULL),
|
||||||
fExceptionCaught(NULL),
|
fExceptionCaught(NULL),
|
||||||
|
fStopOnImageLoad(NULL),
|
||||||
|
fStopImageConstraints(NULL),
|
||||||
|
fStopImageNames(NULL),
|
||||||
|
fStopImageNameInput(NULL),
|
||||||
|
fAddImageNameButton(NULL),
|
||||||
|
fRemoveImageNameButton(NULL),
|
||||||
fCloseButton(NULL),
|
fCloseButton(NULL),
|
||||||
fTarget(target)
|
fTarget(target)
|
||||||
{
|
{
|
||||||
@@ -78,6 +93,43 @@ BreakConditionConfigWindow::MessageReceived(BMessage* message)
|
|||||||
{
|
{
|
||||||
break;
|
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:
|
default:
|
||||||
BWindow::MessageReceived(message);
|
BWindow::MessageReceived(message);
|
||||||
break;
|
break;
|
||||||
@@ -97,19 +149,19 @@ BreakConditionConfigWindow::Show()
|
|||||||
void
|
void
|
||||||
BreakConditionConfigWindow::_Init()
|
BreakConditionConfigWindow::_Init()
|
||||||
{
|
{
|
||||||
BLayoutBuilder::Group<>(this, B_VERTICAL)
|
BBox* exceptionSettingsBox = new BBox("exceptionBox");
|
||||||
.SetInsets(B_USE_DEFAULT_SPACING)
|
exceptionSettingsBox->SetLabel("Exceptions");
|
||||||
.Add(fExceptionThrown = new BCheckBox("exceptionThrown",
|
exceptionSettingsBox->AddChild(BLayoutBuilder::Group<>()
|
||||||
"Stop when an exception is thrown", new BMessage(
|
.AddGroup(B_VERTICAL)
|
||||||
MSG_STOP_ON_THROWN_EXCEPTION_CHANGED)))
|
.SetInsets(B_USE_DEFAULT_SPACING)
|
||||||
.Add(fExceptionCaught = new BCheckBox("exceptionCaught",
|
.Add(fExceptionThrown = new BCheckBox("exceptionThrown",
|
||||||
"Stop when an exception is caught", new BMessage(
|
"Stop when an exception is thrown",
|
||||||
MSG_STOP_ON_CAUGHT_EXCEPTION_CHANGED)))
|
new BMessage(MSG_STOP_ON_THROWN_EXCEPTION_CHANGED)))
|
||||||
.AddGroup(B_HORIZONTAL, 4.0f)
|
.Add(fExceptionCaught = new BCheckBox("exceptionCaught",
|
||||||
.AddGlue()
|
"Stop when an exception is caught",
|
||||||
.Add(fCloseButton = new BButton("Close", new BMessage(
|
new BMessage(MSG_STOP_ON_CAUGHT_EXCEPTION_CHANGED)))
|
||||||
B_QUIT_REQUESTED)))
|
.End()
|
||||||
.End();
|
.View());
|
||||||
|
|
||||||
fExceptionThrown->SetTarget(this);
|
fExceptionThrown->SetTarget(this);
|
||||||
fExceptionCaught->SetTarget(this);
|
fExceptionCaught->SetTarget(this);
|
||||||
@@ -117,8 +169,64 @@ BreakConditionConfigWindow::_Init()
|
|||||||
// TODO: enable once implemented
|
// TODO: enable once implemented
|
||||||
fExceptionCaught->SetEnabled(false);
|
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
|
// check if the exception breakpoints are already installed
|
||||||
AutoLocker< ::Team> teamLocker(fTeam);
|
AutoLocker< ::Team> teamLocker(fTeam);
|
||||||
|
|||||||
@@ -13,6 +13,9 @@
|
|||||||
|
|
||||||
class BButton;
|
class BButton;
|
||||||
class BCheckBox;
|
class BCheckBox;
|
||||||
|
class BListView;
|
||||||
|
class BMenuField;
|
||||||
|
class BTextControl;
|
||||||
class ImageDebugInfo;
|
class ImageDebugInfo;
|
||||||
class Team;
|
class Team;
|
||||||
class UserInterfaceListener;
|
class UserInterfaceListener;
|
||||||
@@ -47,6 +50,12 @@ private:
|
|||||||
UserInterfaceListener* fListener;
|
UserInterfaceListener* fListener;
|
||||||
BCheckBox* fExceptionThrown;
|
BCheckBox* fExceptionThrown;
|
||||||
BCheckBox* fExceptionCaught;
|
BCheckBox* fExceptionCaught;
|
||||||
|
BCheckBox* fStopOnImageLoad;
|
||||||
|
BMenuField* fStopImageConstraints;
|
||||||
|
BListView* fStopImageNames;
|
||||||
|
BTextControl* fStopImageNameInput;
|
||||||
|
BButton* fAddImageNameButton;
|
||||||
|
BButton* fRemoveImageNameButton;
|
||||||
BButton* fCloseButton;
|
BButton* fCloseButton;
|
||||||
BHandler* fTarget;
|
BHandler* fTarget;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user