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

#include <WatchPropertiesDialog.hh>

Inheritance diagram for WatchPropertiesDialog:
Inheritance graph
Collaboration diagram for WatchPropertiesDialog:
Collaboration graph

Public Member Functions

 WatchPropertiesDialog (wxWindow *parent, wxWindowID id, StopPointManager &manager, int handle)
 
 ~WatchPropertiesDialog ()
 

Private Types

enum  {
  ID_LABEL_WATCH = 10000 , ID_LABEL_EXPRESSION , ID_LABEL_CONDITION , ID_LABEL_IGNORE_COUNT ,
  ID_WATCH_HANDLE , ID_EXPRESSION , ID_CONDITION , ID_IGNORE_COUNT ,
  ID_LINE
}
 Widget IDs. More...
 

Private Member Functions

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

Private Attributes

StopPointManagermanager_
 Stop point manager of the simulator.
 
int handle_
 Handle of the watch to modify.
 
wxTextCtrl * expressionCtrl_
 Text widget for the watch expression script.
 
wxTextCtrl * conditionCtrl_
 Text widget fot the watch condition script.
 
wxSpinCtrl * ignoreCtrl_
 Spin button widget for the watch ignore count.
 

Detailed Description

Dialog for modifying watchpoint properties.

Definition at line 43 of file WatchPropertiesDialog.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

Widget IDs.

Enumerator
ID_LABEL_WATCH 
ID_LABEL_EXPRESSION 
ID_LABEL_CONDITION 
ID_LABEL_IGNORE_COUNT 
ID_WATCH_HANDLE 
ID_EXPRESSION 
ID_CONDITION 
ID_IGNORE_COUNT 
ID_LINE 

Definition at line 55 of file WatchPropertiesDialog.hh.

Constructor & Destructor Documentation

◆ WatchPropertiesDialog()

WatchPropertiesDialog::WatchPropertiesDialog ( wxWindow *  parent,
wxWindowID  id,
StopPointManager manager,
int  handle 
)

The Constructor.

Parameters
parentParent window of the dialog.
idWindow identifier for the dialog.
managerStoppoint manager of the simulator.
handleWatch handle.

Definition at line 58 of file WatchPropertiesDialog.cc.

59 :
60 wxDialog(parent, id, _T("Watch point properties"), wxDefaultPosition),
61 manager_(manager), handle_(handle){
62
63 createContents(this, true, true);
64
65 expressionCtrl_ = dynamic_cast<wxTextCtrl*>(FindWindow(ID_EXPRESSION));
66 conditionCtrl_ = dynamic_cast<wxTextCtrl*>(FindWindow(ID_CONDITION));
67 ignoreCtrl_ = dynamic_cast<wxSpinCtrl*>(FindWindow(ID_IGNORE_COUNT));
68}
StopPointManager & manager_
Stop point manager of the simulator.
int handle_
Handle of the watch to modify.
wxTextCtrl * conditionCtrl_
Text widget fot the watch condition script.
wxSpinCtrl * ignoreCtrl_
Spin button widget for the watch ignore count.
wxSizer * createContents(wxWindow *parent, bool call_fit, bool call_sizer)
wxTextCtrl * expressionCtrl_
Text widget for the watch expression script.

◆ ~WatchPropertiesDialog()

WatchPropertiesDialog::~WatchPropertiesDialog ( )

The Destructor.

Definition at line 74 of file WatchPropertiesDialog.cc.

74 {
75}

Member Function Documentation

◆ createContents()

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

Creates the dialog contents.

Code generated by wxDesgigner. Do not modify manually.

Parameters
parentParent window of the widgets.
call_fitIf true, the dialog is resized to fit the widgets.
set_sizerIf true, the created widgets are set as the parent window contents.

Definition at line 156 of file WatchPropertiesDialog.cc.

157 {
158
159 wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );
160
161 wxFlexGridSizer *item1 = new wxFlexGridSizer( 2, 0, 0 );
162
163 wxStaticText *item2 = new wxStaticText( parent, ID_LABEL_WATCH, wxT("Watch:"), wxDefaultPosition, wxDefaultSize, 0 );
164 item1->Add( item2, 0, wxALIGN_RIGHT|wxALL, 5 );
165
166 wxStaticText *item3 = new wxStaticText( parent, ID_WATCH_HANDLE, wxT("??????"), wxDefaultPosition, wxDefaultSize, 0 );
167 item1->Add( item3, 0, wxALL, 5 );
168
169 wxStaticText *item4 = new wxStaticText( parent, ID_LABEL_EXPRESSION, wxT("Expression:"), wxDefaultPosition, wxDefaultSize, 0 );
170 item1->Add( item4, 0, wxALIGN_RIGHT|wxALL, 5 );
171
172 wxTextCtrl *item5 = new wxTextCtrl( parent, ID_EXPRESSION, wxT(""), wxDefaultPosition, wxSize(400,-1), wxTE_READONLY );
173 item1->Add( item5, 0, wxALIGN_CENTER|wxALL, 5 );
174
175 wxStaticText *item6 = new wxStaticText( parent, ID_LABEL_CONDITION, wxT("Condition:"), wxDefaultPosition, wxDefaultSize, 0 );
176 item1->Add( item6, 0, wxALIGN_RIGHT|wxALL, 5 );
177
178 wxTextCtrl *item7 = new wxTextCtrl( parent, ID_CONDITION, wxT(""), wxDefaultPosition, wxSize(400,-1), 0 );
179 item1->Add( item7, 0, wxGROW|wxALL, 5 );
180
181 wxStaticText *item8 = new wxStaticText( parent, ID_LABEL_IGNORE_COUNT, wxT("Ignore count:"), wxDefaultPosition, wxDefaultSize, 0 );
182 item1->Add( item8, 0, wxALIGN_RIGHT|wxALL, 5 );
183
184 wxSpinCtrl *item9 = new wxSpinCtrl( parent, ID_IGNORE_COUNT, wxT("0"), wxDefaultPosition, wxSize(-1,-1), 0, 0, 10000, 0 );
185 item1->Add( item9, 0, wxALL, 5 );
186
187 item0->Add( item1, 0, wxALIGN_CENTER|wxALL, 5 );
188
189 wxStaticLine *item10 = new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
190 item0->Add( item10, 0, wxGROW|wxALL, 5 );
191
192 wxBoxSizer *item11 = new wxBoxSizer( wxHORIZONTAL );
193
194 wxButton *item12 = new wxButton( parent, wxID_CANCEL, wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
195 item11->Add( item12, 0, wxALL, 5 );
196
197 wxButton *item13 = new wxButton( parent, wxID_OK, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
198 item11->Add( item13, 0, wxALL, 5 );
199
200 item0->Add( item11, 0, wxALIGN_CENTER, 5 );
201
202 if (set_sizer)
203 {
204 parent->SetSizer( item0 );
205 if (call_fit)
206 item0->SetSizeHints( parent );
207 }
208
209 return item0;
210}

References ID_CONDITION, ID_EXPRESSION, ID_IGNORE_COUNT, ID_LABEL_CONDITION, ID_LABEL_EXPRESSION, ID_LABEL_IGNORE_COUNT, ID_LABEL_WATCH, ID_LINE, and ID_WATCH_HANDLE.

◆ onOK()

void WatchPropertiesDialog::onOK ( wxCommandEvent &  event)
private

Event handler for the OK-button.

Updates the watch properties accordign to the values in the dialog widgets.

Definition at line 113 of file WatchPropertiesDialog.cc.

113 {
114
115 wxTextCtrl* conditionCtrl =
116 dynamic_cast<wxTextCtrl*>(FindWindow(ID_CONDITION));
117 std::string condition = WxConversion::toString(
118 conditionCtrl->GetValue().Trim(true).Trim(false));
119
120 // Test condition script.
121 if (condition != "" && !ProximToolbox::testCondition(this, condition)) {
122 // Invalid condition script.
123 return;
124 }
125
126 // Set watch condition script.
127 std::string conditionCommand = ProximConstants::SCL_SET_CONDITION +
130 lineReader.input(conditionCommand);
131 lineReader.input(condition);
132
133 // Set watch ignore count.
134 unsigned ignoreCount = ignoreCtrl_->GetValue();
135 std::string ignoreCommand = ProximConstants::SCL_SET_IGNORE_COUNT +
137 " " + Conversion::toString(ignoreCount);
138 lineReader.input(ignoreCommand);
139
140 // Close dialog.
141 EndModal(wxID_OK);
142}
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, ignoreCtrl_, 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 WatchPropertiesDialog::TransferDataToWindow ( )
privatevirtual

Initializes watch properties in the dialog widgets.

Returns
True, if the watch properties were succesfully transfered to the dialog widgets.

Definition at line 85 of file WatchPropertiesDialog.cc.

85 {
86
88 const Watch& watch = dynamic_cast<const Watch&>(stoppoint);
89
90 dynamic_cast<wxStaticText*>(FindWindow(ID_WATCH_HANDLE))->SetLabel(
92
93 expressionCtrl_->SetValue(
95
96 if (watch.isConditional()) {
97 conditionCtrl_->SetValue(
99 }
100
101 ignoreCtrl_->SetValue(watch.ignoreCount());
102
103 return wxDialog::TransferDataToWindow();
104}
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
Definition Watch.hh:48
virtual const ExpressionScript & expression() const
Definition Watch.cc:88
static wxString toWxString(const std::string &source)

References StopPoint::condition(), conditionCtrl_, Watch::expression(), expressionCtrl_, handle_, ID_WATCH_HANDLE, StopPoint::ignoreCount(), ignoreCtrl_, StopPoint::isConditional(), manager_, Script::script(), StopPointManager::stopPointWithHandleConst(), and WxConversion::toWxString().

Here is the call graph for this function:

Member Data Documentation

◆ conditionCtrl_

wxTextCtrl* WatchPropertiesDialog::conditionCtrl_
private

Text widget fot the watch condition script.

Definition at line 76 of file WatchPropertiesDialog.hh.

Referenced by TransferDataToWindow().

◆ expressionCtrl_

wxTextCtrl* WatchPropertiesDialog::expressionCtrl_
private

Text widget for the watch expression script.

Definition at line 74 of file WatchPropertiesDialog.hh.

Referenced by TransferDataToWindow().

◆ handle_

int WatchPropertiesDialog::handle_
private

Handle of the watch to modify.

Definition at line 71 of file WatchPropertiesDialog.hh.

Referenced by onOK(), and TransferDataToWindow().

◆ ignoreCtrl_

wxSpinCtrl* WatchPropertiesDialog::ignoreCtrl_
private

Spin button widget for the watch ignore count.

Definition at line 78 of file WatchPropertiesDialog.hh.

Referenced by onOK(), and TransferDataToWindow().

◆ manager_

StopPointManager& WatchPropertiesDialog::manager_
private

Stop point manager of the simulator.

Definition at line 69 of file WatchPropertiesDialog.hh.

Referenced by TransferDataToWindow().


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