OpenASIP  2.0
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,. More...
 
unsigned int handle_
 Handle of the breakpoint to modify. More...
 

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

Widget IDs.

Enumerator
ID_TEXT_BREAKPOINT 
ID_TEXT_BP_ID 
ID_LABEL_CONDITION 
ID_CONDITION 
ID_LABEL_IGNORE_COUNT 
ID_IGNORE_CTRL 
ID_LINE 
ID_HELP 
ID_CLOSE 

Definition at line 56 of file BreakpointPropertiesDialog.hh.

56  {
57  ID_TEXT_BREAKPOINT = 10000,
63  ID_LINE,
64  ID_HELP,
65  ID_CLOSE
66  };

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 }

◆ ~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 }

References handle_, ID_CONDITION, ID_IGNORE_CTRL, ProximLineReader::input(), ProximToolbox::lineReader(), ProximConstants::SCL_SET_CONDITION, ProximConstants::SCL_SET_IGNORE_COUNT, ProximToolbox::testCondition(), WxConversion::toString(), and Conversion::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 }

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:
Script::script
virtual std::vector< std::string > script() const
Definition: Script.cc:106
BreakpointPropertiesDialog::ID_LABEL_IGNORE_COUNT
@ ID_LABEL_IGNORE_COUNT
Definition: BreakpointPropertiesDialog.hh:61
BreakpointPropertiesDialog::ID_TEXT_BREAKPOINT
@ ID_TEXT_BREAKPOINT
Definition: BreakpointPropertiesDialog.hh:57
WxConversion::toWxString
static wxString toWxString(const std::string &source)
Breakpoint
Definition: Breakpoint.hh:50
ProximToolbox::testCondition
static bool testCondition(wxWindow *parent, const std::string &condition)
Definition: ProximToolbox.cc:280
StopPoint::ignoreCount
virtual unsigned int ignoreCount() const
Definition: StopPoint.cc:193
BreakpointPropertiesDialog::ID_IGNORE_CTRL
@ ID_IGNORE_CTRL
Definition: BreakpointPropertiesDialog.hh:62
FindWindow
Definition: FindWindow.hh:49
ProximConstants::SCL_SET_IGNORE_COUNT
static const std::string SCL_SET_IGNORE_COUNT
Command for setting stop point ignore count.
Definition: ProximConstants.hh:159
ProximLineReader::input
void input(std::string command)
Definition: ProximLineReader.cc:131
Conversion::toString
static std::string toString(const T &source)
StopPoint::condition
virtual const ConditionScript & condition() const
Definition: StopPoint.cc:156
StopPointManager::stopPointWithHandleConst
const StopPoint & stopPointWithHandleConst(unsigned int handle) const
Definition: StopPointManager.cc:248
BreakpointPropertiesDialog::handle_
unsigned int handle_
Handle of the breakpoint to modify.
Definition: BreakpointPropertiesDialog.hh:70
BreakpointPropertiesDialog::ID_HELP
@ ID_HELP
Definition: BreakpointPropertiesDialog.hh:64
ProximLineReader
Definition: ProximLineReader.hh:60
BreakpointPropertiesDialog::ID_LINE
@ ID_LINE
Definition: BreakpointPropertiesDialog.hh:63
StopPoint::isConditional
virtual bool isConditional() const
Definition: StopPoint.cc:173
BreakpointPropertiesDialog::createContents
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
Definition: BreakpointPropertiesDialog.cc:151
BreakpointPropertiesDialog::ID_CONDITION
@ ID_CONDITION
Definition: BreakpointPropertiesDialog.hh:60
BreakpointPropertiesDialog::ID_TEXT_BP_ID
@ ID_TEXT_BP_ID
Definition: BreakpointPropertiesDialog.hh:58
BreakpointPropertiesDialog::ID_LABEL_CONDITION
@ ID_LABEL_CONDITION
Definition: BreakpointPropertiesDialog.hh:59
BreakpointPropertiesDialog::ID_CLOSE
@ ID_CLOSE
Definition: BreakpointPropertiesDialog.hh:65
BreakpointPropertiesDialog::manager_
StopPointManager & manager_
Stoppoint manager containing the breakpoint,.
Definition: BreakpointPropertiesDialog.hh:68
WxConversion::toString
static std::string toString(const wxString &source)
ProximToolbox::lineReader
static ProximLineReader & lineReader()
Definition: ProximToolbox.cc:238
ProximConstants::SCL_SET_CONDITION
static const std::string SCL_SET_CONDITION
Command for setting stop point condition in simulator control language.
Definition: ProximConstants.hh:157