OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
BreakpointPropertiesDialog Class Reference

#include <BreakpointPropertiesDialog.hh>

Inheritance diagram for BreakpointPropertiesDialog:
Inheritance graph
Collaboration diagram for BreakpointPropertiesDialog:
Collaboration graph

Public Member Functions

 BreakpointPropertiesDialog (wxWindow *parent, StopPointManager &manager, unsigned int handle)
 
virtual ~BreakpointPropertiesDialog ()
 

Private Types

enum  {
  ID_TEXT_BREAKPOINT = 10000 , ID_TEXT_BP_ID , ID_LABEL_CONDITION , ID_CONDITION ,
  ID_LABEL_IGNORE_COUNT , ID_IGNORE_CTRL , ID_LINE , ID_HELP ,
  ID_CLOSE
}
 Widget IDs. More...
 

Private Member Functions

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

Private Attributes

StopPointManagermanager_
 Stoppoint manager containing the breakpoint,.
 
unsigned int handle_
 Handle of the breakpoint to modify.
 

Detailed Description

Dialog for editing breakpoint properties in Proxim.

Definition at line 45 of file BreakpointPropertiesDialog.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

Constructor & Destructor Documentation

◆ BreakpointPropertiesDialog()

BreakpointPropertiesDialog::BreakpointPropertiesDialog ( wxWindow *  parent,
StopPointManager manager,
unsigned int  handle 
)

The Constructor.

Parameters
parentParent window of the dialog.
breakpointBreakpoint to edit.

Definition at line 57 of file BreakpointPropertiesDialog.cc.

58 :
59 wxDialog(parent, -1, _T("Breakpoint properties"), wxDefaultPosition),
60 manager_(manager), handle_(handle) {
61
62 createContents(this, true, true);
63
64}
StopPointManager & manager_
Stoppoint manager containing the breakpoint,.
unsigned int handle_
Handle of the breakpoint to modify.
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)

◆ ~BreakpointPropertiesDialog()

BreakpointPropertiesDialog::~BreakpointPropertiesDialog ( )
virtual

The Destructor.

Definition at line 70 of file BreakpointPropertiesDialog.cc.

70 {
71}

Member Function Documentation

◆ createContents()

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

Creates the dialog contents.

Definition at line 151 of file BreakpointPropertiesDialog.cc.

152 {
153
154 wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
155
156 wxFlexGridSizer *item1 = new wxFlexGridSizer( 2, 0, 0 );
157
158 wxStaticText *item2 = new wxStaticText( parent, ID_TEXT_BREAKPOINT, wxT("Breakpoint"), wxDefaultPosition, wxDefaultSize, 0 );
159 item1->Add( item2, 0, wxALIGN_CENTER|wxALL, 5 );
160
161 wxStaticText *item3 = new wxStaticText( parent, ID_TEXT_BP_ID, wxT(""), wxDefaultPosition, wxDefaultSize, 0 );
162 item1->Add( item3, 0, wxALL, 5 );
163
164 wxStaticText *item4 = new wxStaticText( parent, ID_LABEL_IGNORE_COUNT, wxT("Ignore count:"), wxDefaultPosition, wxDefaultSize, 0 );
165 item1->Add( item4, 0, wxALIGN_RIGHT|wxALL, 5 );
166
167 wxSpinCtrl *item5 = new wxSpinCtrl( parent, ID_IGNORE_CTRL, wxT("0"), wxDefaultPosition, wxSize(-1,-1), 0, 0, 100, 0 );
168 item1->Add( item5, 0, wxALL, 5 );
169
170 wxStaticText *item6 = new wxStaticText( parent, ID_LABEL_CONDITION, wxT("Condition:"), wxDefaultPosition, wxDefaultSize, 0 );
171 item1->Add( item6, 0, wxALIGN_RIGHT|wxALL, 5 );
172
173 wxTextCtrl *item7 = new wxTextCtrl( parent, ID_CONDITION, wxT(""), wxDefaultPosition, wxSize(250,-1));
174 item1->Add( item7, 0, wxALIGN_CENTER|wxALL, 5 );
175
176 item0->Add( item1, 0, wxGROW, 5 );
177
178 wxStaticLine *item8 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
179 item0->Add( item8, 0, wxGROW|wxALL, 5 );
180
181 wxGridSizer *item9 = new wxGridSizer( 2, 0, 0 );
182
183 wxButton *item10 = new wxButton( parent, wxID_CANCEL, wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
184 item9->Add( item10, 0, wxALIGN_CENTER|wxALL, 5 );
185
186 wxButton *item11 = new wxButton( parent, wxID_OK, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
187 item9->Add( item11, 0, wxALIGN_CENTER|wxALL, 5 );
188
189 item0->Add( item9, 0, wxGROW, 5 );
190
191 if (set_sizer)
192 {
193 parent->SetSizer( item0 );
194 if (call_fit)
195 item0->SetSizeHints( parent );
196 }
197
198 return item0;
199}

References ID_CONDITION, ID_IGNORE_CTRL, ID_LABEL_CONDITION, ID_LABEL_IGNORE_COUNT, ID_LINE, ID_TEXT_BP_ID, and ID_TEXT_BREAKPOINT.

◆ onOK()

void BreakpointPropertiesDialog::onOK ( wxCommandEvent &  event)
private

Handles the dialog OK-button event.

Breakpoint properties are checked for validity, and the breakpoint is modified if the properties are valid. An error dialog is displayed if the breakpoint properties are invalid.

Definition at line 110 of file BreakpointPropertiesDialog.cc.

110 {
111
112 wxTextCtrl* conditionCtrl =
113 dynamic_cast<wxTextCtrl*>(FindWindow(ID_CONDITION));
114
115 unsigned ignoreCount =
116 dynamic_cast<wxSpinCtrl*>(FindWindow(ID_IGNORE_CTRL))->GetValue();
117
118 string condition = WxConversion::toString(
119 conditionCtrl->GetValue().Trim(true).Trim(false));
120
121 // Check condition script.
122 if (condition != "" && !ProximToolbox::testCondition(this, condition)) {
123 // Invalid condition.
124 return;
125 }
126
128
129 // Set ignore count.
130 std::string ignoreCommand = ProximConstants::SCL_SET_IGNORE_COUNT +
132 " " + Conversion::toString(ignoreCount);
133
134 lineReader.input(ignoreCommand);
135
136 // Set Condition script.
137 std::string conditionCommand = ProximConstants::SCL_SET_CONDITION + " " +
139
140 lineReader.input(conditionCommand);
141 lineReader.input(condition);
142
143 EndModal(wxID_OK);
144}
static std::string toString(const T &source)
static const std::string SCL_SET_CONDITION
Command for setting stop point condition in simulator control language.
static const std::string SCL_SET_IGNORE_COUNT
Command for setting stop point ignore count.
void input(std::string command)
static ProximLineReader & lineReader()
static bool testCondition(wxWindow *parent, const std::string &condition)
static std::string toString(const wxString &source)

References handle_, ID_CONDITION, ID_IGNORE_CTRL, ProximLineReader::input(), ProximToolbox::lineReader(), ProximConstants::SCL_SET_CONDITION, ProximConstants::SCL_SET_IGNORE_COUNT, ProximToolbox::testCondition(), Conversion::toString(), and WxConversion::toString().

Here is the call graph for this function:

◆ TransferDataToWindow()

bool BreakpointPropertiesDialog::TransferDataToWindow ( )
privatevirtual

Sets the widget values when the dialog is opened.

Definition at line 78 of file BreakpointPropertiesDialog.cc.

78 {
79
80 const Breakpoint& breakpoint = dynamic_cast<const Breakpoint&>(
82
83 if (breakpoint.isConditional()) {
84 wxTextCtrl* conditionCtrl =
85 dynamic_cast<wxTextCtrl*>(FindWindow(ID_CONDITION));
86 for (unsigned i = 0; i < breakpoint.condition().script().size(); i++) {
87 string line = breakpoint.condition().script()[i];
88 conditionCtrl->AppendText(WxConversion::toWxString(line));
89 }
90 }
91
92 dynamic_cast<wxSpinCtrl*>(FindWindow(ID_IGNORE_CTRL))->SetValue(
93 breakpoint.ignoreCount());
94
95 dynamic_cast<wxStaticText*>(FindWindow(ID_TEXT_BP_ID))->SetLabel(
97
98 return wxDialog::TransferDataToWindow();
99}
virtual std::vector< std::string > script() const
Definition Script.cc:106
const StopPoint & stopPointWithHandleConst(unsigned int handle) const
virtual bool isConditional() const
Definition StopPoint.cc:173
virtual const ConditionScript & condition() const
Definition StopPoint.cc:156
virtual unsigned int ignoreCount() const
Definition StopPoint.cc:193
static wxString toWxString(const std::string &source)

References StopPoint::condition(), handle_, ID_CONDITION, ID_IGNORE_CTRL, ID_TEXT_BP_ID, StopPoint::ignoreCount(), StopPoint::isConditional(), manager_, Script::script(), StopPointManager::stopPointWithHandleConst(), and WxConversion::toWxString().

Here is the call graph for this function:

Member Data Documentation

◆ handle_

unsigned int BreakpointPropertiesDialog::handle_
private

Handle of the breakpoint to modify.

Definition at line 70 of file BreakpointPropertiesDialog.hh.

Referenced by onOK(), and TransferDataToWindow().

◆ manager_

StopPointManager& BreakpointPropertiesDialog::manager_
private

Stoppoint manager containing the breakpoint,.

Definition at line 68 of file BreakpointPropertiesDialog.hh.

Referenced by TransferDataToWindow().


The documentation for this class was generated from the following files: