OpenASIP  2.0
Public Member Functions | Private Types | Private Member Functions | List of all members
AddBreakpointDialog Class Reference

#include <AddBreakpointDialog.hh>

Inheritance diagram for AddBreakpointDialog:
Inheritance graph
Collaboration diagram for AddBreakpointDialog:
Collaboration graph

Public Member Functions

 AddBreakpointDialog (wxWindow *parent, wxWindowID id)
 
virtual ~AddBreakpointDialog ()
 

Private Types

enum  { ID_LABEL_NEW_BP, ID_ADDRESS, ID_LINE }
 Widget IDs. More...
 

Private Member Functions

void onOK (wxCommandEvent &event)
 
wxSizer * createContents (wxWindow *parent, bool call_fit, bool set_sizer)
 

Detailed Description

Dialog for adding new breakpoints.

Definition at line 41 of file AddBreakpointDialog.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

Widget IDs.

Enumerator
ID_LABEL_NEW_BP 
ID_ADDRESS 
ID_LINE 

Definition at line 50 of file AddBreakpointDialog.hh.

50  {
52  ID_ADDRESS,
53  ID_LINE
54  };

Constructor & Destructor Documentation

◆ AddBreakpointDialog()

AddBreakpointDialog::AddBreakpointDialog ( wxWindow *  parent,
wxWindowID  id 
)

The Constructor.

@paran parent Parent window of the dialog.

Parameters
idIdentifier of the window.

Definition at line 55 of file AddBreakpointDialog.cc.

55  :
56  wxDialog(parent, id, _T("Add Breakpoint"), wxDefaultPosition) {
57 
58  createContents(this, true, true);
59 }

◆ ~AddBreakpointDialog()

AddBreakpointDialog::~AddBreakpointDialog ( )
virtual

The Destructor.

Definition at line 64 of file AddBreakpointDialog.cc.

64  {
65 }

Member Function Documentation

◆ createContents()

wxSizer * AddBreakpointDialog::createContents ( wxWindow *  parent,
bool  call_fit,
bool  set_sizer 
)
private

Creates the dialog widgets.

Definition at line 99 of file AddBreakpointDialog.cc.

100  {
101 
102  wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
103 
104  wxStaticText *item1 = new wxStaticText( parent, ID_LABEL_NEW_BP, wxT("Set Breakpoint at"), wxDefaultPosition, wxDefaultSize, 0 );
105  item0->Add( item1, 0, wxALIGN_CENTER|wxALL, 5 );
106 
107  wxTextCtrl *item2 = new wxTextCtrl( parent, ID_ADDRESS, wxT(""), wxDefaultPosition, wxSize(200,-1), 0 );
108  item0->Add( item2, 0, wxALIGN_CENTER|wxALL, 5 );
109 
110  wxStaticLine *item3 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
111  item0->Add( item3, 0, wxGROW|wxALL, 5 );
112 
113  wxGridSizer *item4 = new wxGridSizer( 2, 0, 0 );
114 
115  wxButton *item5 = new wxButton( parent, wxID_OK, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
116  item4->Add( item5, 0, wxALIGN_CENTER|wxALL, 5 );
117 
118  wxButton *item6 = new wxButton( parent, wxID_CANCEL, wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
119  item4->Add( item6, 0, wxALIGN_CENTER|wxALL, 5 );
120 
121  item0->Add( item4, 0, wxALIGN_CENTER|wxALL, 5 );
122 
123  if (set_sizer)
124  {
125  parent->SetSizer( item0 );
126  if (call_fit)
127  item0->SetSizeHints( parent );
128  }
129 
130  return item0;
131 }

References ID_ADDRESS, ID_LABEL_NEW_BP, and ID_LINE.

◆ onOK()

void AddBreakpointDialog::onOK ( wxCommandEvent &  event)
private

Event handler for the OK-button.

Adds a breakpoint at the address defined in the address field.

Definition at line 74 of file AddBreakpointDialog.cc.

74  {
75 
76  wxString addressString =
77  dynamic_cast<wxTextCtrl*>(FindWindow(ID_ADDRESS))->GetValue();
78 
79  unsigned address = 0;
80  try {
81  address =
83  } catch (NumberFormatException& e) {
84  wxString message = _T("Invalid address");
85  ErrorDialog errorDialog(this, message);
86  errorDialog.ShowModal();
87  return;
88  }
89  std::string command = ProximConstants::SCL_SET_BREAKPOINT + " " +
90  Conversion::toString(address);
92  EndModal(wxID_OK);
93 }

References ID_ADDRESS, ProximLineReader::input(), ProximToolbox::lineReader(), ProximConstants::SCL_SET_BREAKPOINT, WxConversion::toString(), Conversion::toString(), and Conversion::toUnsignedInt().

Here is the call graph for this function:

The documentation for this class was generated from the following files:
NumberFormatException
Definition: Exception.hh:421
AddBreakpointDialog::ID_LABEL_NEW_BP
@ ID_LABEL_NEW_BP
Definition: AddBreakpointDialog.hh:51
FindWindow
Definition: FindWindow.hh:49
AddBreakpointDialog::ID_LINE
@ ID_LINE
Definition: AddBreakpointDialog.hh:53
ProximLineReader::input
void input(std::string command)
Definition: ProximLineReader.cc:131
Conversion::toString
static std::string toString(const T &source)
ErrorDialog
Definition: ErrorDialog.hh:42
AddBreakpointDialog::ID_ADDRESS
@ ID_ADDRESS
Definition: AddBreakpointDialog.hh:52
Conversion::toUnsignedInt
static unsigned int toUnsignedInt(const T &source)
ProximConstants::SCL_SET_BREAKPOINT
static const std::string SCL_SET_BREAKPOINT
Command for setting breakpoints in the simulator control language.
Definition: ProximConstants.hh:151
AddBreakpointDialog::createContents
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
Definition: AddBreakpointDialog.cc:99
WxConversion::toString
static std::string toString(const wxString &source)
ProximToolbox::lineReader
static ProximLineReader & lineReader()
Definition: ProximToolbox.cc:238