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

#include <OperationPropertyDialog.hh>

Inheritance diagram for OperationPropertyDialog:
Inheritance graph
Collaboration diagram for OperationPropertyDialog:
Collaboration graph

Public Member Functions

 OperationPropertyDialog (wxWindow *parent, Operation *op, OperationModule &module, const std::string &path)
 
virtual ~OperationPropertyDialog ()
 
Operationoperation () const
 

Private Types

enum  {
  ID_TEXT_NAME = 1000 , ID_NAME , ID_READS_MEMORY , ID_WRITES_MEMORY ,
  ID_CAN_TRAP , ID_HAS_SIDE_EFFECTS , ID_CLOCKED , ID_AFFECTED_BY ,
  ID_OPERATION_AFFECTED_BY , ID_AFFECTED_ADD_BUTTON , ID_AFFECTED_DELETE_BUTTON , ID_INPUT_OPERANDS ,
  ID_INPUT_UP_BUTTON , ID_INPUT_DOWN_BUTTON , ID_INPUT_ADD_BUTTON , ID_INPUT_MODIFY_BUTTON ,
  ID_INPUT_DELETE_BUTTON , ID_AFFECTS , ID_OPERATION_AFFECTS , ID_AFFECTS_ADD_BUTTON ,
  ID_AFFECTS_DELETE_BUTTON , ID_OUTPUT_OPERANDS , ID_OUTPUT_UP_BUTTON , ID_OUTPUT_DOWN_BUTTON ,
  ID_OUTPUT_ADD_BUTTON , ID_OUTPUT_MODIFY_BUTTON , ID_OUTPUT_DELETE_BUTTON , ID_OPEN_BUTTON ,
  ID_DAG_BUTTON , ID_OK_BUTTON , ID_TEXT_CTRL , ID_TEXT_OPEN ,
  ID_EDIT_DESCRIPTION
}
 

Private Member Functions

 OperationPropertyDialog (const OperationPropertyDialog &)
 Copying not allowed.
 
OperationPropertyDialogoperator= (const OperationPropertyDialog &)
 Assignment not allowed.
 
wxSizer * createContents (wxWindow *parent, bool call_fit, bool set_sizer)
 
wxBitmap createBitmaps (size_t index)
 
virtual bool TransferDataToWindow ()
 
void updateOperands ()
 
void updateIndex ()
 
void updateDAG ()
 
void updateAffected ()
 
void updateTypes ()
 
void onSelection (wxListEvent &event)
 
void onAddAffectedBy (wxCommandEvent &event)
 
void onDeleteAffectedBy (wxCommandEvent &event)
 
void onAddAffects (wxCommandEvent &event)
 
void onDeleteAffects (wxCommandEvent &event)
 
void onAddInputOperand (wxCommandEvent &event)
 
void onModifyInputOperand (wxCommandEvent &event)
 
void onDeleteInputOperand (wxCommandEvent &event)
 
void onAddOutputOperand (wxCommandEvent &event)
 
void onModifyOutputOperand (wxCommandEvent &event)
 
void onDeleteOutputOperand (wxCommandEvent &event)
 
void onMoveInputUp (wxCommandEvent &event)
 
void onMoveInputDown (wxCommandEvent &event)
 
void onMoveOutputUp (wxCommandEvent &event)
 
void onMoveOutputDown (wxCommandEvent &event)
 
void onOpen (wxCommandEvent &event)
 
void onOpenDAG (wxCommandEvent &event)
 
void onSaveDAG (wxCommandEvent &event)
 
void onUndoDAG (wxCommandEvent &event)
 
void onDeleteDAG (wxCommandEvent &event)
 
void onNewDAG (wxCommandEvent &event)
 
void onDAGChange (wxCommandEvent &event)
 
void onComboBoxChange (wxCommandEvent &event)
 
void moveUp (std::vector< Operand * > &ops, int id, wxListCtrl *list)
 
void moveDown (std::vector< Operand * > &ops, int id, wxListCtrl *list)
 
std::vector< std::string > getSelectedItems (wxListCtrl *listCtrl)
 
void onOk (wxCommandEvent &event)
 
ObjectStatesaveOperation ()
 
void setTexts ()
 
void setBehaviorLabel ()
 
void launchEditor (const std::string &cmd)
 
void updateSwapLists (std::vector< std::string > deletedOperands)
 
void updateOperation (bool newOpDag)
 

Private Attributes

wxStaticBoxSizer * inputSizer_
 Input operand sizer.
 
wxStaticBoxSizer * outputSizer_
 Output operand sizer.
 
wxStaticBoxSizer * affectsSizer_
 Affects sizer.
 
wxStaticBoxSizer * affectedBySizer_
 Affected by sizer.
 
wxListCtrl * affectedByList_
 List of affected by operations.
 
wxListCtrl * affectsList_
 List of affects operations.
 
wxListCtrl * inputOperandList_
 List of input operands.
 
wxListCtrl * outputOperandList_
 List of output operands.
 
wxComboBox * affectedByChoice_
 Choice box for new affected by operations.
 
wxComboBox * affectsChoice_
 Choice box for new affects operations.
 
wxCheckBox * readMemoryCB_
 Read memory check box.
 
wxCheckBox * writeMemoryCB_
 Write memory check box.
 
wxCheckBox * canTrapCB_
 Can trap check box.
 
wxCheckBox * sideEffectsCB_
 Has side effects check box.
 
wxCheckBox * clockedCB_
 Clocked check box.
 
Operationoperation_
 Operation to be created or to be modified.
 
ObjectStateorig_
 Original operation's ObjectState tree.
 
wxString name_
 Name of the operation.
 
OperationModulemodule_
 Module in which operation belongs to.
 
std::string path_
 Path in which module belongs to.
 
bool readMemory_
 Does operation read memory?
 
bool writeMemory_
 Does operation write memory?
 
bool canTrap_
 Can operation trap?
 
bool hasSideEffects_
 Does operation has side effects?
 
bool clocked_
 Is operation clocked?
 
bool controlFlow_
 Can operation can change program flow.
 
bool isCall_
 Operation performs function call.
 
bool isBranch_
 Operation is branch.
 
wxTextCtrl * editDescription_
 
std::vector< Operand * > inputOperands_
 Input operands.
 
std::vector< Operand * > outputOperands_
 Output operands.
 
std::vector< std::string > affects_
 Operations that affects this operation.
 
std::vector< std::string > affectedBy_
 Operations that are affected by this operation.
 
bool operationWasCreatedHere_
 

Detailed Description

Dialog which is used to create or modify an operation.

Definition at line 51 of file OperationPropertyDialog.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

Component ids.

Enumerator
ID_TEXT_NAME 
ID_NAME 
ID_READS_MEMORY 
ID_WRITES_MEMORY 
ID_CAN_TRAP 
ID_HAS_SIDE_EFFECTS 
ID_CLOCKED 
ID_AFFECTED_BY 
ID_OPERATION_AFFECTED_BY 
ID_AFFECTED_ADD_BUTTON 
ID_AFFECTED_DELETE_BUTTON 
ID_INPUT_OPERANDS 
ID_INPUT_UP_BUTTON 
ID_INPUT_DOWN_BUTTON 
ID_INPUT_ADD_BUTTON 
ID_INPUT_MODIFY_BUTTON 
ID_INPUT_DELETE_BUTTON 
ID_AFFECTS 
ID_OPERATION_AFFECTS 
ID_AFFECTS_ADD_BUTTON 
ID_AFFECTS_DELETE_BUTTON 
ID_OUTPUT_OPERANDS 
ID_OUTPUT_UP_BUTTON 
ID_OUTPUT_DOWN_BUTTON 
ID_OUTPUT_ADD_BUTTON 
ID_OUTPUT_MODIFY_BUTTON 
ID_OUTPUT_DELETE_BUTTON 
ID_OPEN_BUTTON 
ID_DAG_BUTTON 
ID_OK_BUTTON 
ID_TEXT_CTRL 
ID_TEXT_OPEN 
ID_EDIT_DESCRIPTION 

Definition at line 118 of file OperationPropertyDialog.hh.

118 {
119 ID_TEXT_NAME = 1000,
120 ID_NAME,
152 };

Constructor & Destructor Documentation

◆ OperationPropertyDialog() [1/2]

OperationPropertyDialog::OperationPropertyDialog ( wxWindow *  parent,
Operation op,
OperationModule module,
const std::string &  path 
)

Constructor.

Parameters
parentThe parent window.
opOperation to be created or modified.
moduleModule in which operation belongs to.
pathPath in which module belongs to.

Definition at line 122 of file OperationPropertyDialog.cc.

126 :
127 wxDialog(
128 parent, -1, _T(""),
130 wxDefaultSize, wxRESIZE_BORDER),
131 operation_(op), name_(_T("")), module_(module), path_(path),
133
134 createContents(this, true, true);
135
136 affectedByList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_AFFECTED_BY));
137 affectsList_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_AFFECTS));
139 dynamic_cast<wxListCtrl*>(FindWindow(ID_INPUT_OPERANDS));
141 dynamic_cast<wxListCtrl*>(FindWindow(ID_OUTPUT_OPERANDS));
143 dynamic_cast<wxComboBox*>(FindWindow(ID_OPERATION_AFFECTED_BY));
145 dynamic_cast<wxComboBox*>(FindWindow(ID_OPERATION_AFFECTS));
146 readMemoryCB_ = dynamic_cast<wxCheckBox*>(FindWindow(ID_READS_MEMORY));
147 writeMemoryCB_ = dynamic_cast<wxCheckBox*>(FindWindow(ID_WRITES_MEMORY));
148 canTrapCB_ = dynamic_cast<wxCheckBox*>(FindWindow(ID_CAN_TRAP));
150 dynamic_cast<wxCheckBox*>(FindWindow(ID_HAS_SIDE_EFFECTS));
151 clockedCB_ =
152 dynamic_cast<wxCheckBox*>(FindWindow(ID_CLOCKED));
153
154 editDescription_ = dynamic_cast<wxTextCtrl*>(FindWindow(ID_EDIT_DESCRIPTION));
155
156 FindWindow(ID_NAME)->SetValidator(
157 wxTextValidator(wxFILTER_ASCII, &name_));
158
159 FindWindow(ID_READS_MEMORY)->SetValidator(
160 wxGenericValidator(&readMemory_));
161
162 FindWindow(ID_WRITES_MEMORY)->SetValidator(
163 wxGenericValidator(&writeMemory_));
164
165 FindWindow(ID_CAN_TRAP)->SetValidator(wxGenericValidator(&canTrap_));
166
167 FindWindow(ID_HAS_SIDE_EFFECTS)->SetValidator(
168 wxGenericValidator(&hasSideEffects_));
169
170 FindWindow(ID_CLOCKED)->SetValidator(
171 wxGenericValidator(&clocked_));
172
173 // set OK button as default choice
174 FindWindow(ID_OK_BUTTON)->SetFocus();
175
176 if (operation_ != NULL) {
177 for (int i = 1; i <= operation_->numberOfInputs(); i++) {
178 Operand* op = new Operand(operation_->operand(i));
179 inputOperands_.push_back(op);
180 }
181
182 for (int i = operation_->numberOfInputs() + 1;
184
185 Operand* op = new Operand(operation_->operand(i));
186 outputOperands_.push_back(op);
187 }
188
189 for (int i = 0; i < operation_->affectsCount(); i++) {
190 affects_.push_back(operation_->affects(i));
191 }
192
193 for (int i = 0; i < operation_->affectedByCount(); i++) {
194 affectedBy_.push_back(operation_->affectedBy(i));
195 }
196 } else {
199 }
200
201 orig_ = operation_->saveState(); // save original operation's state
202
203 setTexts();
204}
static wxPoint getPosition(Dialogs dialog)
@ DIALOG_PROPERTIES
Operation properties dialog.
static NullOperationBehavior & instance()
OperationModule & module_
Module in which operation belongs to.
wxListCtrl * outputOperandList_
List of output operands.
bool hasSideEffects_
Does operation has side effects?
bool writeMemory_
Does operation write memory?
wxString name_
Name of the operation.
Operation * operation_
Operation to be created or to be modified.
bool readMemory_
Does operation read memory?
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
std::vector< Operand * > outputOperands_
Output operands.
wxCheckBox * sideEffectsCB_
Has side effects check box.
std::string path_
Path in which module belongs to.
bool canTrap_
Can operation trap?
wxCheckBox * readMemoryCB_
Read memory check box.
wxCheckBox * clockedCB_
Clocked check box.
ObjectState * orig_
Original operation's ObjectState tree.
wxCheckBox * writeMemoryCB_
Write memory check box.
wxListCtrl * inputOperandList_
List of input operands.
wxListCtrl * affectedByList_
List of affected by operations.
bool clocked_
Is operation clocked?
std::vector< Operand * > inputOperands_
Input operands.
std::vector< std::string > affects_
Operations that affects this operation.
wxComboBox * affectsChoice_
Choice box for new affects operations.
std::vector< std::string > affectedBy_
Operations that are affected by this operation.
wxListCtrl * affectsList_
List of affects operations.
wxCheckBox * canTrapCB_
Can trap check box.
wxComboBox * affectedByChoice_
Choice box for new affected by operations.
virtual int affectedByCount() const
Definition Operation.cc:416
virtual ObjectState * saveState() const
Definition Operation.cc:490
virtual TCEString affectedBy(unsigned int i) const
Definition Operation.cc:447
virtual int affectsCount() const
Definition Operation.cc:402
virtual int numberOfInputs() const
Definition Operation.cc:192
virtual TCEString affects(unsigned int i) const
Definition Operation.cc:431
virtual int numberOfOutputs() const
Definition Operation.cc:202
virtual Operand & operand(int id) const
Definition Operation.cc:541

References NullOperationBehavior::instance().

Here is the call graph for this function:

◆ ~OperationPropertyDialog()

OperationPropertyDialog::~OperationPropertyDialog ( )
virtual

Destructor.

Definition at line 209 of file OperationPropertyDialog.cc.

209 {
210
211 for (unsigned int i = 0; i < inputOperands_.size(); i++) {
212 delete inputOperands_[i];
213 }
214
215 for (unsigned int i = 0; i < outputOperands_.size(); i++) {
216 delete outputOperands_[i];
217 }
218
219 int x, y;
220 GetPosition(&x, &y);
221 wxPoint point(x, y);
223
225 delete operation_;
226 operation_ = NULL;
227 }
228}
static void setPosition(Dialogs dialog, wxPoint point)

References DialogPosition::DIALOG_PROPERTIES, inputOperands_, operation_, operationWasCreatedHere_, outputOperands_, and DialogPosition::setPosition().

Here is the call graph for this function:

◆ OperationPropertyDialog() [2/2]

OperationPropertyDialog::OperationPropertyDialog ( const OperationPropertyDialog )
private

Copying not allowed.

Member Function Documentation

◆ createBitmaps()

wxBitmap OperationPropertyDialog::createBitmaps ( size_t  index)
private

Creates the bitmaps.

NOTE! This function was created by wxDesigner.

Parameters
indexIndex of the bitmap.
Returns
The bitmap.

Definition at line 1507 of file OperationPropertyDialog.cc.

1507 {
1508 if (index == 0)
1509 {
1510 /* XPM */
1511 static const char *xpm_data[] = {
1512 /* columns rows colors chars-per-pixel */
1513 "16 30 2 1",
1514 " c None",
1515 "a c Black",
1516 /* pixels */
1517 " ",
1518 " ",
1519 " ",
1520 " aa ",
1521 " aaaa ",
1522 " aaaaaa ",
1523 " aa aa aa ",
1524 " aa aa aa ",
1525 " aa aa aa ",
1526 " aa aa aa ",
1527 " a aa a ",
1528 " aa ",
1529 " aa ",
1530 " aa ",
1531 " aa ",
1532 " aa ",
1533 " aa ",
1534 " aa ",
1535 " aa ",
1536 " aa ",
1537 " aa ",
1538 " aa ",
1539 " aa ",
1540 " aa ",
1541 " aa ",
1542 " aa ",
1543 " aa ",
1544 " aa ",
1545 " aa ",
1546 " "
1547 };
1548 wxBitmap bitmap(xpm_data);
1549 return bitmap;
1550 }
1551 if (index == 1)
1552 {
1553 /* XPM */
1554 static const char *xpm_data[] = {
1555 /* columns rows colors chars-per-pixel */
1556 "16 30 2 1",
1557 " c None",
1558 "a c Black",
1559 /* pixels */
1560 " ",
1561 " aa ",
1562 " aa ",
1563 " aa ",
1564 " aa ",
1565 " aa ",
1566 " aa ",
1567 " aa ",
1568 " aa ",
1569 " aa ",
1570 " aa ",
1571 " aa ",
1572 " aa ",
1573 " aa ",
1574 " aa ",
1575 " aa ",
1576 " aa ",
1577 " aa ",
1578 " aa ",
1579 " aa ",
1580 " a aa a ",
1581 " aa aa aa ",
1582 " aa aa aa ",
1583 " aa aa aa ",
1584 " aaaaaa ",
1585 " aaaa ",
1586 " aa ",
1587 " ",
1588 " ",
1589 " "
1590 };
1591 wxBitmap bitmap(xpm_data);
1592 return bitmap;
1593 }
1594 return wxNullBitmap;
1595}

Referenced by createContents().

◆ createContents()

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

Creates the contents of the dialog.

NOTE! This function was generated by wxDesigner, that's why it is so ugly.

Parameters
parentParent window.
call_fitIf true, fits the contents inside the dialog.
set_sizerIf true, sets the main sizer as dialog contents.
Returns
The created sizer.

Definition at line 1271 of file OperationPropertyDialog.cc.

1274 {
1275
1276 wxBoxSizer *item0 = new wxBoxSizer(wxVERTICAL);
1277
1278 wxGridSizer *item1 = new wxGridSizer(2, 0, 0);
1279
1280 wxBoxSizer *opHeaderSizer = new wxBoxSizer(wxHORIZONTAL);
1281
1282 wxBoxSizer *nameSizer = new wxBoxSizer(wxHORIZONTAL);
1283
1284 wxStaticText *item2 = new wxStaticText(parent, ID_TEXT_NAME, wxT("Name:"), wxDefaultPosition, wxDefaultSize, 0);
1285 nameSizer->Add(item2, 0, wxALL, 5);
1286
1287 wxTextCtrl *item3 = new wxTextCtrl(parent, ID_NAME, wxT(""), wxDefaultPosition, wxSize(200,-1), 0);
1288 nameSizer->Add(item3, 0, wxALL, 5);
1289
1290 wxStaticBox *opProperties = new wxStaticBox(parent, -1, wxT("Operation properties"));
1291 wxStaticBoxSizer *opPropertiesContainer = new wxStaticBoxSizer(opProperties, wxVERTICAL);
1292
1293 opPropertiesContainer->Add(nameSizer, 0, wxGROW, 5);
1294 opPropertiesContainer->Add(item1, 0, wxGROW, 5);
1295
1296 wxStaticBox *opDescription = new wxStaticBox(parent, -1, wxT("Operation description"));
1297 wxTextCtrl* editDescription = new wxTextCtrl(parent, ID_EDIT_DESCRIPTION, wxT(""), wxDefaultPosition, wxSize(250,50), wxTE_MULTILINE);
1298 wxStaticBoxSizer *opDescriptionContainer = new wxStaticBoxSizer(opDescription, wxHORIZONTAL);
1299
1300 opDescriptionContainer->Add(editDescription, 0, wxALL|wxEXPAND, 5);
1301
1302 opHeaderSizer->Add(opPropertiesContainer, 0, wxALL, 5);
1303 opHeaderSizer->Add(opDescriptionContainer, 0, wxALL|wxGROW, 5);
1304
1305 wxCheckBox *item4 = new wxCheckBox(parent, ID_READS_MEMORY, wxT("Reads memory"), wxDefaultPosition, wxDefaultSize, 0);
1306 item1->Add(item4, 0, wxALL, 5);
1307
1308 wxCheckBox *item5 = new wxCheckBox(parent, ID_WRITES_MEMORY, wxT("Writes memory"), wxDefaultPosition, wxDefaultSize, 0);
1309 item1->Add(item5, 0, wxALL, 5);
1310
1311 wxCheckBox *item6 = new wxCheckBox(parent, ID_CAN_TRAP, wxT("Can trap"), wxDefaultPosition, wxDefaultSize, 0);
1312 item1->Add(item6, 0, wxALL, 5);
1313
1314 wxCheckBox *item7 = new wxCheckBox(parent, ID_HAS_SIDE_EFFECTS, wxT("Has side effects"), wxDefaultPosition, wxDefaultSize, 0);
1315 item1->Add(item7, 0, wxALL, 5);
1316
1317 wxCheckBox *clocked = new wxCheckBox(parent, ID_CLOCKED, wxT("Clocked"), wxDefaultPosition, wxDefaultSize, 0);
1318 item1->Add(clocked, 0, wxALL, 5);
1319
1320 item0->Add(opHeaderSizer, 0, wxALIGN_CENTER|wxALL, 5);
1321
1322 wxGridSizer *item8 = new wxGridSizer(2, 0, 0);
1323
1324 wxStaticBox *item10 = new wxStaticBox(parent, -1, wxT("Affected by"));
1325 wxStaticBoxSizer *item9 = new wxStaticBoxSizer(item10, wxVERTICAL);
1326 affectedBySizer_ = item9;
1327
1328 wxListCtrl *item11 = new wxListCtrl(parent, ID_AFFECTED_BY, wxDefaultPosition, wxSize(160,120), wxLC_REPORT|wxSUNKEN_BORDER);
1329 item9->Add(item11, 0, wxGROW|wxALL, 10);
1330
1331 wxBoxSizer *item12 = new wxBoxSizer(wxHORIZONTAL);
1332
1333 wxString strs13[] =
1334 {
1335 wxT("ComboItem")
1336 };
1337 wxComboBox *item13 = new wxComboBox(parent, ID_OPERATION_AFFECTED_BY, wxT(""), wxDefaultPosition, wxSize(100,-1), 1, strs13, wxCB_SORT);
1338 item12->Add(item13, 0, wxALIGN_CENTER|wxALL, 5);
1339
1340 wxButton *item14 = new wxButton(parent, ID_AFFECTED_ADD_BUTTON, wxT("Add"), wxDefaultPosition, wxDefaultSize, 0);
1341 item12->Add(item14, 0, wxALIGN_CENTER|wxALL, 5);
1342
1343 wxButton *item15 = new wxButton(parent, ID_AFFECTED_DELETE_BUTTON, wxT("Delete"), wxDefaultPosition, wxDefaultSize, 0);
1344 item12->Add(item15, 0, wxALIGN_CENTER|wxALL, 5);
1345
1346 item9->Add(item12, 0, wxGROW|wxALL, 5);
1347
1348 item8->Add(item9, 0, wxGROW|wxALL, 5);
1349
1350 // Operation inputs
1351 wxStaticBox *item17 = new wxStaticBox(parent, -1, wxT("Input operands"));
1352 wxStaticBoxSizer *item16 = new wxStaticBoxSizer(item17, wxVERTICAL);
1353 inputSizer_ = item16;
1354
1355 wxBoxSizer *item18 = new wxBoxSizer(wxHORIZONTAL);
1356
1357 wxListCtrl *item19 = new wxListCtrl(parent, ID_INPUT_OPERANDS, wxDefaultPosition, wxSize(335,120), wxLC_REPORT|wxSUNKEN_BORDER);
1358 item18->Add(item19, 0, wxALIGN_CENTER|wxALL, 5);
1359
1360 // BoxSizer for up and down buttons
1361 wxBoxSizer *item20 = new wxBoxSizer(wxVERTICAL);
1362
1363 // Move up and down buttons
1364 wxBitmapButton *item21 = new wxBitmapButton(parent, ID_INPUT_UP_BUTTON, createBitmaps(0), wxDefaultPosition, wxDefaultSize);
1365 item20->Add(item21, 0, wxALL, 5);
1366
1367 wxBitmapButton *item22 = new wxBitmapButton(parent, ID_INPUT_DOWN_BUTTON, createBitmaps(1), wxDefaultPosition, wxDefaultSize);
1368 item20->Add(item22, 0, wxALIGN_CENTER|wxALL, 5);
1369
1370 item18->Add(item20, 0, wxALIGN_CENTER|wxALL, 5);
1371
1372 item16->Add(item18, 0, wxGROW|wxALL, 5);
1373
1374 wxBoxSizer *item23 = new wxBoxSizer(wxHORIZONTAL);
1375
1376 wxButton *item24 = new wxButton(parent, ID_INPUT_ADD_BUTTON, wxT("Add..."), wxDefaultPosition, wxDefaultSize, 0);
1377 item23->Add(item24, 0, wxALIGN_CENTER|wxALL, 5);
1378
1379 wxButton *item25 = new wxButton(parent, ID_INPUT_MODIFY_BUTTON, wxT("Modify..."), wxDefaultPosition, wxDefaultSize, 0);
1380 item23->Add(item25, 0, wxALIGN_CENTER|wxALL, 5);
1381
1382 wxButton *item26 = new wxButton(parent, ID_INPUT_DELETE_BUTTON, wxT("Delete"), wxDefaultPosition, wxDefaultSize, 0);
1383 item23->Add(item26, 0, wxALIGN_CENTER|wxALL, 5);
1384
1385 item16->Add(item23, 0, wxALIGN_CENTER|wxALL, 5);
1386
1387 item8->Add(item16, 0, wxGROW|wxALL, 5);
1388
1389 wxStaticBox *item28 = new wxStaticBox(parent, -1, wxT("Affects"));
1390 wxStaticBoxSizer *item27 = new wxStaticBoxSizer(item28, wxVERTICAL);
1391 affectsSizer_ = item27;
1392
1393 wxListCtrl *item29 = new wxListCtrl(parent, ID_AFFECTS, wxDefaultPosition, wxSize(160,120), wxLC_REPORT|wxSUNKEN_BORDER);
1394 item27->Add(item29, 0, wxGROW|wxALL, 10);
1395
1396 wxBoxSizer *item30 = new wxBoxSizer(wxHORIZONTAL);
1397
1398 wxString strs31[] =
1399 {
1400 wxT("ComboItem")
1401 };
1402 wxComboBox *item31 = new wxComboBox(parent, ID_OPERATION_AFFECTS, wxT(""), wxDefaultPosition, wxSize(100,-1), 1, strs31, wxCB_SORT);
1403 item30->Add(item31, 0, wxALIGN_CENTER|wxALL, 5);
1404
1405 wxButton *item32 = new wxButton(parent, ID_AFFECTS_ADD_BUTTON, wxT("Add"), wxDefaultPosition, wxDefaultSize, 0);
1406 item30->Add(item32, 0, wxALIGN_CENTER|wxALL, 5);
1407
1408 wxButton *item33 = new wxButton(parent, ID_AFFECTS_DELETE_BUTTON, wxT("Delete"), wxDefaultPosition, wxDefaultSize, 0);
1409 item30->Add(item33, 0, wxALIGN_CENTER|wxALL, 5);
1410
1411 item27->Add(item30, 0, wxGROW|wxALL, 5);
1412
1413 item8->Add(item27, 0, wxGROW|wxALL, 5);
1414
1415 wxStaticBox *item35 = new wxStaticBox(parent, -1, wxT("Output operands"));
1416 wxStaticBoxSizer *item34 = new wxStaticBoxSizer(item35, wxVERTICAL);
1417 outputSizer_ = item34;
1418
1419 wxBoxSizer *item36 = new wxBoxSizer(wxHORIZONTAL);
1420
1421 wxListCtrl *item37 = new wxListCtrl(parent, ID_OUTPUT_OPERANDS, wxDefaultPosition, wxSize(335,120), wxLC_REPORT|wxSUNKEN_BORDER);
1422 item36->Add(item37, 0, wxALIGN_CENTER|wxALL, 5);
1423
1424 wxBoxSizer *item38 = new wxBoxSizer(wxVERTICAL);
1425
1426 wxBitmapButton *item39 = new wxBitmapButton(parent, ID_OUTPUT_UP_BUTTON, createBitmaps(0), wxDefaultPosition, wxDefaultSize);
1427 item38->Add(item39, 0, wxALIGN_CENTER|wxALL, 5);
1428
1429 wxBitmapButton *item40 = new wxBitmapButton(parent, ID_OUTPUT_DOWN_BUTTON, createBitmaps(1), wxDefaultPosition, wxDefaultSize);
1430 item38->Add(item40, 0, wxALIGN_CENTER|wxALL, 5);
1431
1432 item36->Add(item38, 0, wxALIGN_CENTER|wxALL, 5);
1433
1434 item34->Add(item36, 0, wxGROW|wxALL, 5);
1435
1436 wxBoxSizer *item41 = new wxBoxSizer(wxHORIZONTAL);
1437
1438 wxButton *item42 = new wxButton(parent, ID_OUTPUT_ADD_BUTTON, wxT("Add..."), wxDefaultPosition, wxDefaultSize, 0);
1439 item41->Add(item42, 0, wxALIGN_CENTER|wxALL, 5);
1440
1441 wxButton *item43 = new wxButton(parent, ID_OUTPUT_MODIFY_BUTTON, wxT("Modify..."), wxDefaultPosition, wxDefaultSize, 0);
1442 item41->Add(item43, 0, wxALIGN_CENTER|wxALL, 5);
1443
1444 wxButton *item44 = new wxButton(parent, ID_OUTPUT_DELETE_BUTTON, wxT("Delete"), wxDefaultPosition, wxDefaultSize, 0);
1445 item41->Add(item44, 0, wxALIGN_CENTER|wxALL, 5);
1446
1447 item34->Add(item41, 0, wxALIGN_CENTER|wxALL, 5);
1448
1449 item8->Add(item34, 0, wxALIGN_CENTER|wxALL, 5);
1450
1451 wxBoxSizer *pageSizer = new wxBoxSizer(wxHORIZONTAL);
1452 pageSizer->Add(item8, 0, wxALL, 5);
1453
1454 item0->Add(pageSizer, 0, wxALIGN_CENTER|wxALL, 5);
1455
1456 wxGridSizer *item45 = new wxGridSizer(2, 0, 0);
1457
1458 wxBoxSizer *item46 = new wxBoxSizer(wxHORIZONTAL);
1459
1460 wxStaticText *item47 = NULL;
1461 if (module_.hasBehaviorSource()) {
1462 item47 = new wxStaticText(parent, ID_TEXT_OPEN, _T("Operation behavior module defined."), wxDefaultPosition, wxDefaultSize, 0);
1463 } else {
1464 item47 = new wxStaticText(parent, ID_TEXT_OPEN, wxT("Operation behavior module not defined."), wxDefaultPosition, wxDefaultSize, 0);
1465 }
1466 item46->Add(item47, 0, wxALIGN_CENTER|wxALL, 5);
1467
1468 wxButton *item48 = new wxButton(parent, ID_OPEN_BUTTON, wxT("Open"), wxDefaultPosition, wxDefaultSize, 0);
1469 item46->Add(item48, 0, wxALIGN_CENTER|wxALL, 5);
1470
1471 wxButton *OpenDAG = new wxButton(parent, ID_DAG_BUTTON, wxT("Open DAG"), wxDefaultPosition, wxDefaultSize, 0);
1472 item46->Add(OpenDAG, 0, wxALIGN_CENTER|wxALL, 5);
1473
1474 item45->Add(item46, 0, wxALL, 5);
1475
1476 wxBoxSizer *item49 = new wxBoxSizer(wxHORIZONTAL);
1477
1478 wxButton *item50 = new wxButton(parent, ID_OK_BUTTON, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0);
1479 item49->Add(item50, 0, wxALIGN_CENTER|wxALL, 5);
1480
1481 wxButton *item51 = new wxButton(parent, wxID_CANCEL, wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0);
1482 item49->Add(item51, 0, wxALIGN_CENTER|wxALL, 5);
1483
1484 item45->Add(item49, 0, wxALL, 5);
1485
1486 item0->Add(item45, 0, wxGROW|wxALL, 5);
1487
1488 if (set_sizer)
1489 {
1490 parent->SetSizer(item0);
1491 if (call_fit)
1492 item0->SetSizeHints(parent);
1493 }
1494
1495 return item0;
1496}
virtual bool hasBehaviorSource() const
wxBitmap createBitmaps(size_t index)
wxStaticBoxSizer * affectsSizer_
Affects sizer.
wxStaticBoxSizer * affectedBySizer_
Affected by sizer.
wxStaticBoxSizer * outputSizer_
Output operand sizer.
wxStaticBoxSizer * inputSizer_
Input operand sizer.

References affectedBySizer_, affectsSizer_, createBitmaps(), OperationModule::hasBehaviorSource(), ID_AFFECTED_ADD_BUTTON, ID_AFFECTED_BY, ID_AFFECTED_DELETE_BUTTON, ID_AFFECTS, ID_AFFECTS_ADD_BUTTON, ID_AFFECTS_DELETE_BUTTON, ID_CAN_TRAP, ID_CLOCKED, ID_DAG_BUTTON, ID_EDIT_DESCRIPTION, ID_HAS_SIDE_EFFECTS, ID_INPUT_ADD_BUTTON, ID_INPUT_DELETE_BUTTON, ID_INPUT_DOWN_BUTTON, ID_INPUT_MODIFY_BUTTON, ID_INPUT_OPERANDS, ID_INPUT_UP_BUTTON, ID_NAME, ID_OK_BUTTON, ID_OPEN_BUTTON, ID_OPERATION_AFFECTED_BY, ID_OPERATION_AFFECTS, ID_OUTPUT_ADD_BUTTON, ID_OUTPUT_DELETE_BUTTON, ID_OUTPUT_DOWN_BUTTON, ID_OUTPUT_MODIFY_BUTTON, ID_OUTPUT_OPERANDS, ID_OUTPUT_UP_BUTTON, ID_READS_MEMORY, ID_TEXT_NAME, ID_TEXT_OPEN, ID_WRITES_MEMORY, inputSizer_, module_, and outputSizer_.

Here is the call graph for this function:

◆ getSelectedItems()

vector< string > OperationPropertyDialog::getSelectedItems ( wxListCtrl *  listCtrl)
private

Returns all the selected items of the list control.

Parameters
listCtrlList control which is investigated.
Returns
All selected items as a vector.

Definition at line 998 of file OperationPropertyDialog.cc.

998 {
999 vector<string> selected;
1000 long item = -1;
1001 for (;;) {
1002 item = listCtrl->GetNextItem(
1003 item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
1004 if (item == -1) {
1005 break;
1006 }
1007 wxListItem info;
1008 info.SetId(item);
1009 info.SetColumn(0);
1010 listCtrl->GetItem(info);
1011 selected.push_back(WxConversion::toString(info.GetText()));
1012 }
1013 return selected;
1014}
static std::string toString(const wxString &source)

References WxConversion::toString().

Referenced by onDeleteAffectedBy(), onDeleteAffects(), onDeleteInputOperand(), and onDeleteOutputOperand().

Here is the call graph for this function:

◆ launchEditor()

void OperationPropertyDialog::launchEditor ( const std::string &  cmd)
private

Launches editor for editing operation behavior.

Parameters
cmdCommand for launching the editor.

Definition at line 1203 of file OperationPropertyDialog.cc.

1203 {
1204 CommandThread* thread = new CommandThread(cmd);
1205 thread->Create();
1206 thread->Run();
1207}

Referenced by onOpen().

◆ moveDown()

void OperationPropertyDialog::moveDown ( std::vector< Operand * > &  ops,
int  id,
wxListCtrl *  list 
)
private

Moves operand down.

Parameters
listList from which operand is selected.
opsOperands.
idId of the operand.

Definition at line 974 of file OperationPropertyDialog.cc.

977 {
978
979 if (static_cast<unsigned int>(id) != ops.size()) {
980 Operand* temp = ops[id - 1];
981 ops[id - 1] = ops[id];
982 ops[id] = temp;
983 long item = -1;
984 item = list->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
985 list->SetItemState(
986 item + 1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
987 list->SetItemState(item, 0, wxLIST_STATE_SELECTED);
988 }
989}

Referenced by onMoveInputDown(), and onMoveOutputDown().

◆ moveUp()

void OperationPropertyDialog::moveUp ( std::vector< Operand * > &  ops,
int  id,
wxListCtrl *  list 
)
private

Moves operand up.

Parameters
listList from which operand is selected.
idId of the operand.
opsOperands.

Definition at line 949 of file OperationPropertyDialog.cc.

952 {
953
954 if (id != 1) {
955 Operand* temp = ops[id - 2];
956 ops[id - 2] = ops[id - 1];
957 ops[id - 1] = temp;
958 long item = -1;
959 item = list->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
960 list->SetItemState(
961 item - 1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
962 list->SetItemState(item, 0, wxLIST_STATE_SELECTED);
963 }
964}

Referenced by onMoveInputUp(), and onMoveOutputUp().

◆ onAddAffectedBy()

void OperationPropertyDialog::onAddAffectedBy ( wxCommandEvent &  event)
private

Handles adding new item to affected by list.

Definition at line 634 of file OperationPropertyDialog.cc.

634 {
635
636 wxString name = affectedByChoice_->GetValue();
638
640 format fmt = texts.text(
642 fmt % name;
643 ErrorDialog dialog(this, WxConversion::toWxString(fmt.str()));
644 dialog.ShowModal();
645 } else {
646 affectedBy_.push_back(WxConversion::toString(name));
648 }
649}
static OSEdTextGenerator & instance()
@ TXT_ERROR_NON_EXISTING_OPERATION
Error when operation does not exist.
static bool operationExists(const std::string &name)
virtual boost::format text(int textId)
static wxString toWxString(const std::string &source)

References affectedBy_, affectedByChoice_, OSEdTextGenerator::instance(), OperationContainer::operationExists(), Texts::TextGenerator::text(), WxConversion::toString(), WxConversion::toWxString(), OSEdTextGenerator::TXT_ERROR_NON_EXISTING_OPERATION, and updateAffected().

Here is the call graph for this function:

◆ onAddAffects()

void OperationPropertyDialog::onAddAffects ( wxCommandEvent &  event)
private

Handles event of adding new item to affects list.

Definition at line 676 of file OperationPropertyDialog.cc.

676 {
677
678 wxString name = affectsChoice_->GetValue();
680
682 format fmt = texts.text(
684 fmt % name;
685 ErrorDialog dialog(this, WxConversion::toWxString(fmt.str()));
686 dialog.ShowModal();
687 } else {
688 affects_.push_back(WxConversion::toString(name));
690 }
691}

References affects_, affectsChoice_, OSEdTextGenerator::instance(), OperationContainer::operationExists(), Texts::TextGenerator::text(), WxConversion::toString(), WxConversion::toWxString(), OSEdTextGenerator::TXT_ERROR_NON_EXISTING_OPERATION, and updateAffected().

Here is the call graph for this function:

◆ onAddInputOperand()

void OperationPropertyDialog::onAddInputOperand ( wxCommandEvent &  event)
private

Handles event for adding new operand to input operand list.

Definition at line 718 of file OperationPropertyDialog.cc.

718 {
719 Operand* input =
720 new Operand(true, inputOperands_.size() + 1, Operand::SINT_WORD);
721
722 InputOperandDialog dialog(
723 this, input, inputOperands_.size(), inputOperands_.size() + 1);
724
725 if (dialog.ShowModal() == wxID_OK) {
726 inputOperands_.push_back(input);
728 } else {
729 delete input;
730 }
732}
@ SINT_WORD
Definition Operand.hh:59

References inputOperands_, Operand::SINT_WORD, and updateOperands().

Here is the call graph for this function:

◆ onAddOutputOperand()

void OperationPropertyDialog::onAddOutputOperand ( wxCommandEvent &  event)
private

Handles the event of adding new output operand.

Definition at line 779 of file OperationPropertyDialog.cc.

779 {
780 unsigned int id = inputOperands_.size() + outputOperands_.size() + 1;
781 Operand* output = new Operand(false, id, Operand::SINT_WORD);
782 OutputOperandDialog dialog(this, output, id);
783 if (dialog.ShowModal() == wxID_OK) {
784 outputOperands_.push_back(output);
786 } else {
787 delete output;
788 }
790}

References inputOperands_, outputOperands_, Operand::SINT_WORD, and updateOperands().

Here is the call graph for this function:

◆ onComboBoxChange()

void OperationPropertyDialog::onComboBoxChange ( wxCommandEvent &  event)
private

◆ onDAGChange()

void OperationPropertyDialog::onDAGChange ( wxCommandEvent &  event)
private

◆ onDeleteAffectedBy()

void OperationPropertyDialog::onDeleteAffectedBy ( wxCommandEvent &  event)
private

Handles deleting an item from affected by list.

Definition at line 655 of file OperationPropertyDialog.cc.

655 {
656
657 vector<string> toBeDeleted = getSelectedItems(affectedByList_);
658
659 for (size_t i = 0; i < toBeDeleted.size(); i++) {
660 vector<string>::iterator it = affectedBy_.begin();
661 while (it != affectedBy_.end()) {
662 if (*it == toBeDeleted[i]) {
663 affectedBy_.erase(it);
664 break;
665 }
666 it++;
667 }
668 }
670}
std::vector< std::string > getSelectedItems(wxListCtrl *listCtrl)

References affectedBy_, affectedByList_, getSelectedItems(), and updateAffected().

Here is the call graph for this function:

◆ onDeleteAffects()

void OperationPropertyDialog::onDeleteAffects ( wxCommandEvent &  event)
private

Handles event of deleting item from affects list.

Definition at line 697 of file OperationPropertyDialog.cc.

697 {
698
699 vector<string> toBeDeleted = getSelectedItems(affectsList_);
700
701 for (size_t i = 0; i < toBeDeleted.size(); i++) {
702 vector<string>::iterator it = affects_.begin();
703 while (it != affects_.end()) {
704 if (*it == toBeDeleted[i]) {
705 affects_.erase(it);
706 break;
707 }
708 it++;
709 }
710 }
712}

References affects_, affectsList_, getSelectedItems(), and updateAffected().

Here is the call graph for this function:

◆ onDeleteDAG()

void OperationPropertyDialog::onDeleteDAG ( wxCommandEvent &  event)
private

◆ onDeleteInputOperand()

void OperationPropertyDialog::onDeleteInputOperand ( wxCommandEvent &  event)
private

Handles the event of deleting input operand.

Definition at line 753 of file OperationPropertyDialog.cc.

753 {
754
755 vector<string> toBeDeleted = getSelectedItems(inputOperandList_);
756 size_t i = 0;
757 vector<Operand*>::iterator it = inputOperands_.begin();
758 int index = 1;
759
760 updateSwapLists(toBeDeleted);
761 while (it != inputOperands_.end() && i < toBeDeleted.size()) {
762 int id = Conversion::toInt(toBeDeleted[i]);
763 while (index < id) {
764 it++;
765 index++;
766 }
767 delete *it;
768 it = inputOperands_.erase(it);
769 index++;
770 i++;
771 }
773}
static int toInt(const T &source)
void updateSwapLists(std::vector< std::string > deletedOperands)

References getSelectedItems(), inputOperandList_, inputOperands_, Conversion::toInt(), updateOperands(), and updateSwapLists().

Here is the call graph for this function:

◆ onDeleteOutputOperand()

void OperationPropertyDialog::onDeleteOutputOperand ( wxCommandEvent &  event)
private

Handles the event of deleting output operand.

Definition at line 812 of file OperationPropertyDialog.cc.

812 {
813
814 vector<string> toBeDeleted = getSelectedItems(outputOperandList_);
815 size_t i = 0;
816 vector<Operand*>::iterator it = outputOperands_.begin();
817 int index = inputOperands_.size() + 1;
818
819 while (it != outputOperands_.end() && i < toBeDeleted.size()) {
820 int id = Conversion::toInt(toBeDeleted[i]);
821 while (index < id) {
822 it++;
823 index++;
824 }
825 delete *it;
826 it = outputOperands_.erase(it);
827 index++;
828 i++;
829 }
831}

References getSelectedItems(), inputOperands_, outputOperandList_, outputOperands_, Conversion::toInt(), and updateOperands().

Here is the call graph for this function:

◆ onModifyInputOperand()

void OperationPropertyDialog::onModifyInputOperand ( wxCommandEvent &  event)
private

Handles the event for modifying input operand.

Definition at line 738 of file OperationPropertyDialog.cc.

738 {
740 int id = Conversion::toInt(idString);
741 Operand* operand = NULL;
742 operand = inputOperands_[id - 1];
743 assert(operand != NULL);
744 InputOperandDialog dialog(this, operand, inputOperands_.size(), id);
745 dialog.ShowModal();
747}
#define assert(condition)
static std::string lcStringSelection(wxListCtrl *list, int column)

References assert, inputOperandList_, inputOperands_, WidgetTools::lcStringSelection(), Conversion::toInt(), and updateOperands().

Here is the call graph for this function:

◆ onModifyOutputOperand()

void OperationPropertyDialog::onModifyOutputOperand ( wxCommandEvent &  event)
private

Handles the event for mofifying output operand.

Definition at line 796 of file OperationPropertyDialog.cc.

796 {
798 int realId = Conversion::toInt(idString);
799 int id = realId - static_cast<int>(inputOperands_.size());
800 Operand* operand = NULL;
801 operand = outputOperands_[id - 1];
802 assert(operand != NULL);
803 OutputOperandDialog dialog(this, operand, realId);
804 dialog.ShowModal();
806}

References assert, inputOperands_, WidgetTools::lcStringSelection(), outputOperandList_, outputOperands_, Conversion::toInt(), and updateOperands().

Here is the call graph for this function:

◆ onMoveInputDown()

void OperationPropertyDialog::onMoveInputDown ( wxCommandEvent &  event)
private

Handles the event when input operand is moved down.

Definition at line 847 of file OperationPropertyDialog.cc.

847 {
849 int id = Conversion::toInt(idString);
851}
void moveDown(std::vector< Operand * > &ops, int id, wxListCtrl *list)

References inputOperandList_, inputOperands_, WidgetTools::lcStringSelection(), moveDown(), and Conversion::toInt().

Here is the call graph for this function:

◆ onMoveInputUp()

void OperationPropertyDialog::onMoveInputUp ( wxCommandEvent &  event)
private

Handles the event when input operand is moved up.

Definition at line 837 of file OperationPropertyDialog.cc.

837 {
839 int id = Conversion::toInt(idString);
841}
void moveUp(std::vector< Operand * > &ops, int id, wxListCtrl *list)

References inputOperandList_, inputOperands_, WidgetTools::lcStringSelection(), moveUp(), and Conversion::toInt().

Here is the call graph for this function:

◆ onMoveOutputDown()

void OperationPropertyDialog::onMoveOutputDown ( wxCommandEvent &  event)
private

Handles the event when output operand is moved down.

Definition at line 868 of file OperationPropertyDialog.cc.

868 {
870 int id = Conversion::toInt(idString) -
871 static_cast<int>(inputOperands_.size());
873}

References inputOperands_, WidgetTools::lcStringSelection(), moveDown(), outputOperandList_, outputOperands_, and Conversion::toInt().

Here is the call graph for this function:

◆ onMoveOutputUp()

void OperationPropertyDialog::onMoveOutputUp ( wxCommandEvent &  event)
private

Handles the event when output operand is moved up.

Definition at line 857 of file OperationPropertyDialog.cc.

857 {
859 int id = Conversion::toInt(idString) -
860 static_cast<int>(inputOperands_.size());
862}

References inputOperands_, WidgetTools::lcStringSelection(), moveUp(), outputOperandList_, outputOperands_, and Conversion::toInt().

Here is the call graph for this function:

◆ onNewDAG()

void OperationPropertyDialog::onNewDAG ( wxCommandEvent &  event)
private

◆ onOk()

void OperationPropertyDialog::onOk ( wxCommandEvent &  event)
private

Handles the event when OK button is pushed.

Definition at line 1020 of file OperationPropertyDialog.cc.

1020 {
1021 updateOperation(false);
1022}

References updateOperation().

Here is the call graph for this function:

◆ onOpen()

void OperationPropertyDialog::onOpen ( wxCommandEvent &  event)
private

Handles the event when Open button is pushed.

Definition at line 879 of file OperationPropertyDialog.cc.

879 {
880
882 OSEdOptions* options = wxGetApp().options();
883 string editor = options->editor();
884 if (editor == "") {
886 ErrorDialog error(this, WxConversion::toWxString(fmt.str()));
887 error.ShowModal();
888 } else {
889 if (FileSystem::fileExists(editor)) {
891 string code = module_.behaviorSourceModule();
892 string cmd = editor + " " + code;
893
894 launchEditor(cmd);
895 } else {
896 // new behavior is added for the module
897 string code = module_.propertiesModule();
898 size_t pos = code.find_last_of(".");
899 code.erase(pos);
900 code += ".cc";
901
902 // copy template file as new file
903 string dir =
907
908 string templateFile = dir + FileSystem::DIRECTORY_SEPARATOR +
910
911 FileSystem::copy(templateFile, code);
912
913 string cmd = editor + " " + code;
914 launchEditor(cmd);
915 }
916 } else {
917 format fmt = texts.text(OSEdTextGenerator::TXT_ERROR_OPEN);
918 fmt % editor;
919 ErrorDialog error(this, WxConversion::toWxString(fmt.str()));
920 error.ShowModal();
921 }
922 }
923
925}
static MachInfoCmdLineOptions options
Definition MachInfo.cc:46
static std::string dataDirPath(const std::string &prog)
static const std::string DIRECTORY_SEPARATOR
static void copy(const std::string &source, const std::string &target)
static bool fileExists(const std::string fileName)
static const wxString APPLICATION_NAME
The name of the application.
static const std::string BEHAVIOR_TEMPLATE_FILE_NAME
Name of the behavior template file name.
@ TXT_ERROR_OPEN
Error when opening fails.
@ TXT_ERROR_NO_EDITOR
Error when no editor is given.
virtual std::string behaviorSourceModule() const
virtual std::string propertiesModule() const
void launchEditor(const std::string &cmd)

References OSEdConstants::APPLICATION_NAME, OSEdConstants::BEHAVIOR_TEMPLATE_FILE_NAME, OperationModule::behaviorSourceModule(), FileSystem::copy(), Environment::dataDirPath(), FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), OperationModule::hasBehaviorSource(), OSEdTextGenerator::instance(), launchEditor(), module_, options, OperationModule::propertiesModule(), setBehaviorLabel(), Texts::TextGenerator::text(), WxConversion::toString(), WxConversion::toWxString(), OSEdTextGenerator::TXT_ERROR_NO_EDITOR, and OSEdTextGenerator::TXT_ERROR_OPEN.

Here is the call graph for this function:

◆ onOpenDAG()

void OperationPropertyDialog::onOpenDAG ( wxCommandEvent &  event)
private

Handles the event when Open DAG button is pushed.

Definition at line 931 of file OperationPropertyDialog.cc.

931 {
932
934 updateOperation(true);
935 }
936 // TODO: here set the number of operands of new operation.
937 OperationDAGDialog dialog(this, operation_);
938 dialog.ShowModal();
939}

References operation_, operationWasCreatedHere_, and updateOperation().

Here is the call graph for this function:

◆ onSaveDAG()

void OperationPropertyDialog::onSaveDAG ( wxCommandEvent &  event)
private

◆ onSelection()

void OperationPropertyDialog::onSelection ( wxListEvent &  event)
private

Handles the event when an item is selected from a list.

Item selection affects statuses of several buttons.

Definition at line 556 of file OperationPropertyDialog.cc.

556 {
557
558 if (affectedByList_->GetSelectedItemCount() < 1) {
560 } else {
562 }
563
564 if (affectsList_->GetSelectedItemCount() < 1) {
566 } else {
568 }
569
570 if (inputOperandList_->GetSelectedItemCount() < 1) {
572 } else {
574 }
575
576 if (outputOperandList_->GetSelectedItemCount() < 1) {
578 } else {
580 }
581
582 if (inputOperandList_->GetSelectedItemCount() != 1) {
584 FindWindow(ID_INPUT_UP_BUTTON)->Disable();
586 } else {
588
590 int id = Conversion::toInt(idString);
591
592 if (id != 1) {
594 } else {
595 FindWindow(ID_INPUT_UP_BUTTON)->Disable();
596 }
597
598 if (id != static_cast<int>(inputOperands_.size())) {
600 } else {
602 }
603 }
604
605 if (outputOperandList_->GetSelectedItemCount() != 1) {
609 } else {
611
613 int id = Conversion::toInt(idString);
614
615 if (id != static_cast<int>(inputOperands_.size()) + 1) {
617 } else {
619 }
620
621 if (id != static_cast<int>(inputOperands_.size()) +
622 static_cast<int>(outputOperands_.size())) {
624 } else {
626 }
627 }
628}

References affectedByList_, affectsList_, ID_AFFECTED_DELETE_BUTTON, ID_AFFECTS_DELETE_BUTTON, ID_INPUT_DELETE_BUTTON, ID_INPUT_DOWN_BUTTON, ID_INPUT_MODIFY_BUTTON, ID_INPUT_UP_BUTTON, ID_OUTPUT_DELETE_BUTTON, ID_OUTPUT_DOWN_BUTTON, ID_OUTPUT_MODIFY_BUTTON, ID_OUTPUT_UP_BUTTON, inputOperandList_, inputOperands_, WidgetTools::lcStringSelection(), outputOperandList_, outputOperands_, and Conversion::toInt().

Referenced by updateAffected(), and updateOperands().

Here is the call graph for this function:

◆ onUndoDAG()

void OperationPropertyDialog::onUndoDAG ( wxCommandEvent &  event)
private

◆ operation()

Operation * OperationPropertyDialog::operation ( ) const

Returns operation object of dialog.

Returns
Operation object of dialog.

Definition at line 236 of file OperationPropertyDialog.cc.

236 {
237 return operation_;
238}

References operation_.

Referenced by OSEdAddOperationCmd::Do().

◆ operator=()

OperationPropertyDialog & OperationPropertyDialog::operator= ( const OperationPropertyDialog )
private

Assignment not allowed.

◆ saveOperation()

ObjectState * OperationPropertyDialog::saveOperation ( )
private

Returns the operation properties as ObjectState tree.

Returns
Operation properties as ObjectState tree.

Definition at line 1105 of file OperationPropertyDialog.cc.

1105 {
1106
1109
1110 std::string description("");
1111 wxString wxTemp;
1112
1113 for (int i = 0; i < editDescription_->GetNumberOfLines(); ++i)
1114 {
1115 wxTemp = editDescription_->GetLineText(i);
1116#if wxCHECK_VERSION(2, 6, 0)
1117 std::string stdTemp(wxTemp.mb_str());
1118#else
1119 std::string stdTemp(wxTemp.c_str());
1120#endif
1121 if (!StringTools::endsWith(stdTemp, "\n"))
1122 stdTemp = stdTemp + "\n";
1123 description += stdTemp;
1124 }
1125
1126 description = StringTools::trim(description);
1127
1128 root->setAttribute(Operation::OPRN_DESCRIPTION, description);
1129
1130 int inputs = inputOperands_.size();
1131 int outputs = outputOperands_.size();
1132
1133 root->setAttribute(Operation::OPRN_INPUTS, inputs);
1134 root->setAttribute(Operation::OPRN_OUTPUTS, outputs);
1135
1144
1145 if (affectedBy_.size() > 0) {
1147 for (unsigned int i = 0; i < affectedBy_.size(); i++) {
1148 ObjectState* affectedByChild =
1150 affectedByChild->setAttribute(Operation::OPRN_NAME, affectedBy_[i]);
1151 affectedBy->addChild(affectedByChild);
1152 }
1153 root->addChild(affectedBy);
1154 }
1155
1156 if (affects_.size() > 0) {
1158 for (unsigned int i = 0; i < affects_.size(); i++) {
1159 ObjectState* affectsChild =
1161 affectsChild->setAttribute(Operation::OPRN_NAME, affects_[i]);
1162 affects->addChild(affectsChild);
1163 }
1164 root->addChild(affects);
1165 }
1166
1167 for (unsigned int i = 0; i < inputOperands_.size(); i++) {
1168 ObjectState* operand = inputOperands_[i]->saveState();
1169 operand->setName(Operation::OPRN_IN);
1170 int index = i + 1;
1171 operand->setAttribute(Operand::OPRND_ID, index);
1172 std::string type = inputOperands_.at(i)->typeString();
1173 operand->setAttribute(Operand::OPRND_TYPE, type);
1174 root->addChild(operand);
1175 }
1176
1177 for (unsigned int i = 0; i < outputOperands_.size(); i++) {
1178 ObjectState* operand = outputOperands_[i]->saveState();
1179 operand->setName(Operation::OPRN_OUT);
1180 int index = inputOperands_.size() + i + 1;
1181 operand->setAttribute(Operand::OPRND_ID, index);
1182 std::string type = outputOperands_.at(i)->typeString();
1183 operand->setAttribute(Operand::OPRND_TYPE, type);
1184 root->addChild(operand);
1185 }
1186
1187 // copy dags from operation to objectState tree
1188 for (int i = 0; i < operation_->dagCount(); i++) {
1190 trigger->setValue(operation_->dagCode(i));
1191 root->addChild(trigger);
1192 }
1193
1194 return root;
1195}
void setName(const std::string &name)
void setAttribute(const std::string &name, const std::string &value)
void setValue(const std::string &value)
void addChild(ObjectState *child)
static const std::string OPRND_TYPE
Object state name for operand type.
Definition Operand.hh:84
static const std::string OPRND_ID
Object state name for operand id.
Definition Operand.hh:82
bool controlFlow_
Can operation can change program flow.
bool isCall_
Operation performs function call.
bool isBranch_
Operation is branch.
static const char * OPRN_CONTROL_FLOW
Object state name for control flow property.
Definition Operation.hh:81
static const char * OPRN_ISBRANCH
Object state name for branch property.
Definition Operation.hh:99
static const char * OPRN_DESCRIPTION
Object state name for description.
Definition Operation.hh:69
virtual TCEString dagCode(int index) const
Definition Operation.cc:159
static const char * OPRN_IN
Object state name for input operand.
Definition Operation.hh:91
static const char * OPRN_CLOCKED
Object state name for clockedness.
Definition Operation.hh:79
static const char * OPRN_TRAP
Object state name for trap.
Definition Operation.hh:75
static const char * OPRN_AFFECTED_BY
Object state name for affected by.
Definition Operation.hh:89
static const char * OPRN_OPERATION
Object state name for operation.
Definition Operation.hh:65
static const char * OPRN_TRIGGER
Object state name for trigger semantics.
Definition Operation.hh:95
static const char * OPRN_ISCALL
Object state name for call property.
Definition Operation.hh:97
static const char * OPRN_SIDE_EFFECTS
Object state name for side effects.
Definition Operation.hh:77
static const char * OPRN_READS_MEMORY
Object state name for reads memory.
Definition Operation.hh:83
static const char * OPRN_OUT
Object state name for output operand.
Definition Operation.hh:93
virtual int dagCount() const
Definition Operation.cc:134
static const char * OPRN_OUTPUTS
Object state name for outputs.
Definition Operation.hh:73
static const char * OPRN_NAME
Object state name for name.
Definition Operation.hh:67
static const char * OPRN_INPUTS
Object state name for inputs.
Definition Operation.hh:71
static const char * OPRN_AFFECTS
Object state name for affects.
Definition Operation.hh:87
static const char * OPRN_WRITES_MEMORY
Object state name for writes memory.
Definition Operation.hh:85
static bool endsWith(const std::string &source, const std::string &searchString)
static std::string trim(const std::string &source)

References ObjectState::addChild(), affectedBy_, affects_, canTrap_, clocked_, controlFlow_, Operation::dagCode(), Operation::dagCount(), editDescription_, StringTools::endsWith(), hasSideEffects_, inputOperands_, isBranch_, isCall_, name_, operation_, Operation::OPRN_AFFECTED_BY, Operation::OPRN_AFFECTS, Operation::OPRN_CLOCKED, Operation::OPRN_CONTROL_FLOW, Operation::OPRN_DESCRIPTION, Operation::OPRN_IN, Operation::OPRN_INPUTS, Operation::OPRN_ISBRANCH, Operation::OPRN_ISCALL, Operation::OPRN_NAME, Operation::OPRN_OPERATION, Operation::OPRN_OUT, Operation::OPRN_OUTPUTS, Operation::OPRN_READS_MEMORY, Operation::OPRN_SIDE_EFFECTS, Operation::OPRN_TRAP, Operation::OPRN_TRIGGER, Operation::OPRN_WRITES_MEMORY, Operand::OPRND_ID, Operand::OPRND_TYPE, outputOperands_, readMemory_, ObjectState::setAttribute(), ObjectState::setName(), ObjectState::setValue(), WxConversion::toString(), StringTools::trim(), and writeMemory_.

Referenced by updateOperation().

Here is the call graph for this function:

◆ setBehaviorLabel()

void OperationPropertyDialog::setBehaviorLabel ( )
private

Sets the has behavior label.

Definition at line 393 of file OperationPropertyDialog.cc.

393 {
398 } else {
401 }
402}
@ TXT_LABEL_HAS_BEHAVIOR
Has behavior label.
@ TXT_LABEL_NO_BEHAVIOR
No behavior label.
static void setLabel(Texts::TextGenerator *generator, wxWindow *widget, int textID)

References OperationModule::hasBehaviorSource(), ID_TEXT_OPEN, OSEdTextGenerator::instance(), module_, WidgetTools::setLabel(), OSEdTextGenerator::TXT_LABEL_HAS_BEHAVIOR, and OSEdTextGenerator::TXT_LABEL_NO_BEHAVIOR.

Referenced by onOpen(), and setTexts().

Here is the call graph for this function:

◆ setTexts()

void OperationPropertyDialog::setTexts ( )
private

Set texts to all widgets.

Definition at line 244 of file OperationPropertyDialog.cc.

244 {
245
248
249 // title
251 SetTitle(WxConversion::toWxString(fmt.str()));
252
255
256 // buttons
259
260 WidgetTools::setLabel(&guiText, FindWindow(wxID_CANCEL),
262
265
268
271
274
277
280
283
286
289
292
295
296
298
299 // column titles
301 affectedByList_->InsertColumn(
302 0, WxConversion::toWxString(fmt.str()), wxLIST_FORMAT_LEFT,
304
305 affectsList_->InsertColumn(
306 0, WxConversion::toWxString(fmt.str()), wxLIST_FORMAT_LEFT,
308
310
311 inputOperandList_->InsertColumn(
312 0, WxConversion::toWxString(fmt.str()), wxLIST_FORMAT_LEFT,
313 110);
314
316
317 inputOperandList_->InsertColumn(
318 0, WxConversion::toWxString(fmt.str()), wxLIST_FORMAT_LEFT,
319 110);
320
322
323 inputOperandList_->InsertColumn(
324 0, WxConversion::toWxString(fmt.str()), wxLIST_FORMAT_LEFT,
325 110);
326
328
329 inputOperandList_->InsertColumn(
330 0, WxConversion::toWxString(fmt.str()), wxLIST_FORMAT_LEFT,
331 70);
332
334
335 outputOperandList_->InsertColumn(
336 0, WxConversion::toWxString(fmt.str()), wxLIST_FORMAT_LEFT,
337 110);
338
340
341 outputOperandList_->InsertColumn(
342 0, WxConversion::toWxString(fmt.str()), wxLIST_FORMAT_LEFT,
343 110);
344
346
347 outputOperandList_->InsertColumn(
348 0, WxConversion::toWxString(fmt.str()), wxLIST_FORMAT_LEFT,
349 110);
350
352
353 outputOperandList_->InsertColumn(
354 0, WxConversion::toWxString(fmt.str()), wxLIST_FORMAT_LEFT,
355 70);
356
357 // check boxes
360
363
366
369
372
373 // box sizers
376
379
382
385
386
387}
@ TXT_BUTTON_ADD_DIALOG
Label for add button (with trailing ...).
@ TXT_BUTTON_DELETE
Label for delete button.
@ TXT_BUTTON_CANCEL
Label for cancel button.
@ TXT_BUTTON_OK
Label for OK button.
@ TXT_BUTTON_ADD
Label for an add button.
static GUITextGenerator * instance()
static const int DEFAULT_COLUMN_WIDTH
Default column width.
@ TXT_PROPERTY_DIALOG_TITLE
Property dialog title.
@ TXT_BUTTON_MODIFY
Modify button label.
@ TXT_COLUMN_ELEMENT_WIDTH
Operand element width header.
@ TXT_CHECKBOX_WRITES_MEMORY
Writes memory label.
@ TXT_CHECKBOX_CLOCKED
Clocked label.
@ TXT_BOX_OUTPUT_OPERANDS
Output operand sizer label.
@ TXT_CHECKBOX_CAN_TRAP
Can trap label.
@ TXT_COLUMN_ELEMENT_COUNT
Operand element count header.
@ TXT_LABEL_OPERATION_NAME
Operation name label.
@ TXT_COLUMN_OPERAND
Operand column header.
@ TXT_COLUMN_OPERATION
Operation column header.
@ TXT_BOX_AFFECTS
Affects sizer label.
@ TXT_COLUMN_TYPE
Type column header.
@ TXT_BOX_INPUT_OPERANDS
Input operand sizer label.
@ TXT_CHECKBOX_READS_MEMORY
Reads memory label.
@ TXT_BOX_AFFECTED_BY
Affected by sizer label.
@ TXT_CHECKBOX_HAS_SIDE_EFFECTS
Has side effects label.
@ TXT_BUTTON_OPEN
Open button label.
static void setWidgetLabel(wxWindow *widget, std::string text)

References affectedByList_, affectedBySizer_, affectsList_, affectsSizer_, OSEdConstants::DEFAULT_COLUMN_WIDTH, ID_AFFECTED_ADD_BUTTON, ID_AFFECTED_DELETE_BUTTON, ID_AFFECTS_ADD_BUTTON, ID_AFFECTS_DELETE_BUTTON, ID_CAN_TRAP, ID_CLOCKED, ID_HAS_SIDE_EFFECTS, ID_INPUT_ADD_BUTTON, ID_INPUT_DELETE_BUTTON, ID_INPUT_MODIFY_BUTTON, ID_OK_BUTTON, ID_OPEN_BUTTON, ID_OUTPUT_ADD_BUTTON, ID_OUTPUT_DELETE_BUTTON, ID_OUTPUT_MODIFY_BUTTON, ID_READS_MEMORY, ID_TEXT_NAME, ID_WRITES_MEMORY, inputOperandList_, inputSizer_, GUITextGenerator::instance(), OSEdTextGenerator::instance(), outputOperandList_, outputSizer_, setBehaviorLabel(), WidgetTools::setLabel(), WidgetTools::setWidgetLabel(), Texts::TextGenerator::text(), WxConversion::toWxString(), OSEdTextGenerator::TXT_BOX_AFFECTED_BY, OSEdTextGenerator::TXT_BOX_AFFECTS, OSEdTextGenerator::TXT_BOX_INPUT_OPERANDS, OSEdTextGenerator::TXT_BOX_OUTPUT_OPERANDS, GUITextGenerator::TXT_BUTTON_ADD, GUITextGenerator::TXT_BUTTON_ADD_DIALOG, GUITextGenerator::TXT_BUTTON_CANCEL, GUITextGenerator::TXT_BUTTON_DELETE, OSEdTextGenerator::TXT_BUTTON_MODIFY, GUITextGenerator::TXT_BUTTON_OK, OSEdTextGenerator::TXT_BUTTON_OPEN, OSEdTextGenerator::TXT_CHECKBOX_CAN_TRAP, OSEdTextGenerator::TXT_CHECKBOX_CLOCKED, OSEdTextGenerator::TXT_CHECKBOX_HAS_SIDE_EFFECTS, OSEdTextGenerator::TXT_CHECKBOX_READS_MEMORY, OSEdTextGenerator::TXT_CHECKBOX_WRITES_MEMORY, OSEdTextGenerator::TXT_COLUMN_ELEMENT_COUNT, OSEdTextGenerator::TXT_COLUMN_ELEMENT_WIDTH, OSEdTextGenerator::TXT_COLUMN_OPERAND, OSEdTextGenerator::TXT_COLUMN_OPERATION, OSEdTextGenerator::TXT_COLUMN_TYPE, OSEdTextGenerator::TXT_LABEL_OPERATION_NAME, and OSEdTextGenerator::TXT_PROPERTY_DIALOG_TITLE.

Here is the call graph for this function:

◆ TransferDataToWindow()

bool OperationPropertyDialog::TransferDataToWindow ( )
privatevirtual

Transfers data to window.

Returns
True if transfer is successful.

Definition at line 410 of file OperationPropertyDialog.cc.

410 {
411 if (operation_ != NULL) {
413 editDescription_->Clear();
425 } else {
426 readMemory_ = false;
427 writeMemory_ = false;
428 canTrap_ = false;
429 hasSideEffects_ = false;
430 clocked_ = false;
431 controlFlow_ = false;
432 isCall_ = false;
433 isBranch_ = false;
434 }
435
436 return wxWindow::TransferDataToWindow();
437}
virtual bool readsMemory() const
Definition Operation.cc:242
virtual TCEString name() const
Definition Operation.cc:93
virtual TCEString description() const
Definition Operation.cc:103
virtual bool isCall() const
Definition Operation.cc:318
virtual bool isControlFlowOperation() const
Definition Operation.cc:294
virtual bool canTrap() const
Definition Operation.cc:262
virtual bool hasSideEffects() const
Definition Operation.cc:272
virtual bool isBranch() const
Definition Operation.cc:306
virtual bool isClocked() const
Definition Operation.cc:282
virtual bool writesMemory() const
Definition Operation.cc:252

References Operation::canTrap(), canTrap_, clocked_, controlFlow_, Operation::description(), editDescription_, Operation::hasSideEffects(), hasSideEffects_, Operation::isBranch(), isBranch_, Operation::isCall(), isCall_, Operation::isClocked(), Operation::isControlFlowOperation(), Operation::name(), name_, operation_, readMemory_, Operation::readsMemory(), WxConversion::toWxString(), updateAffected(), updateOperands(), writeMemory_, and Operation::writesMemory().

Here is the call graph for this function:

◆ updateAffected()

void OperationPropertyDialog::updateAffected ( )
private

Updates the affects and affected by lists.

Definition at line 485 of file OperationPropertyDialog.cc.

485 {
486
487 affectedByList_->DeleteAllItems();
488 affectsList_->DeleteAllItems();
489
490 for (unsigned int i = 0; i < affectedBy_.size(); i++) {
491 wxString oper = WxConversion::toWxString(affectedBy_[i]);
492 affectedByList_->InsertItem(i, oper);
493 }
494
495 for (unsigned int i = 0; i < affects_.size(); i++) {
496 wxString oper = WxConversion::toWxString(affects_[i]);
497 affectsList_->InsertItem(i, oper);
498 }
499
501 affectsChoice_->Clear();
502 affectedByChoice_->Clear();
503 for (int i = 0; i < index.pathCount(); i++) {
504 string path = index.path(i);
505 int modules = index.moduleCount(path);
506 for (int j = 0; j < modules; j++) {
507 OperationModule& module = index.module(j, path);
508 int operations = 0;
509 try {
510 operations = index.operationCount(module);
511 } catch (const Exception& e) {
512 continue;
513 }
514 for (int k = 0; k < operations; k++) {
515 string name = index.operationName(k, module);
516 if (affectsList_->
517 FindItem(-1, WxConversion::toWxString(name)) == -1) {
518
520 }
521 if (affectedByList_->
522 FindItem(-1, WxConversion::toWxString(name)) == -1) {
523
525 }
526 }
527
528 }
529 }
530 affectsChoice_->SetSelection(0);
531 affectedByChoice_->SetSelection(0);
532
533 if (affectsChoice_->GetCount() == 0) {
535 } else {
537 }
538
539 if (affectedByChoice_->GetCount() == 0) {
541 } else {
543 }
544
545 wxListEvent dummy;
547}
SimValue dummy(32)
a dummy simvalue which is given for operands that are not bound
static OperationIndex & operationIndex()
std::string operationName(int i, const OperationModule &om)
std::string path(int i) const
int operationCount(const OperationModule &om)
int pathCount() const
int moduleCount() const
void onSelection(wxListEvent &event)

References affectedBy_, affectedByChoice_, affectedByList_, affects_, affectsChoice_, affectsList_, dummy, ID_AFFECTED_ADD_BUTTON, ID_AFFECTS_ADD_BUTTON, OperationIndex::moduleCount(), onSelection(), OperationIndex::operationCount(), OperationContainer::operationIndex(), OperationIndex::operationName(), OperationIndex::path(), OperationIndex::pathCount(), and WxConversion::toWxString().

Referenced by onAddAffectedBy(), onAddAffects(), onDeleteAffectedBy(), onDeleteAffects(), and TransferDataToWindow().

Here is the call graph for this function:

◆ updateDAG()

void OperationPropertyDialog::updateDAG ( )
private

◆ updateIndex()

void OperationPropertyDialog::updateIndex ( )
private

◆ updateOperands()

void OperationPropertyDialog::updateOperands ( )
private

Updates the operand lists.

Definition at line 443 of file OperationPropertyDialog.cc.

443 {
444
445 inputOperandList_->DeleteAllItems();
446 outputOperandList_->DeleteAllItems();
447
448 for (unsigned int i = 0; i < inputOperands_.size(); i++) {
449 wxString id = WxConversion::toWxString(i + 1);
450 inputOperandList_->InsertItem(i, id);
451 std::string type = inputOperands_.at(i)->typeString();
452 inputOperandList_->SetItem(i, 1, WxConversion::toWxString(type));
453 std::string elemWidth = Conversion::toString(
454 inputOperands_.at(i)->elementWidth());
455 inputOperandList_->SetItem(i, 2, WxConversion::toWxString(elemWidth));
456 std::string elemCount = Conversion::toString(
457 inputOperands_.at(i)->elementCount());
458 inputOperandList_->SetItem(i, 3, WxConversion::toWxString(elemCount));
459 }
460 int k = 0;
461 for (unsigned int i = inputOperands_.size() + 1;
462 i <= inputOperands_.size() + outputOperands_.size(); i++) {
463
464 wxString id = WxConversion::toWxString(i);
465 outputOperandList_->InsertItem(k, id);
466 std::string type = outputOperands_.at(k)->typeString();
467 outputOperandList_->SetItem(k, 1, WxConversion::toWxString(type));
468 std::string elemWidth = Conversion::toString(
469 outputOperands_.at(k)->elementWidth());
470 outputOperandList_->SetItem(k, 2, WxConversion::toWxString(elemWidth));
471 std::string elemCount = Conversion::toString(
472 outputOperands_.at(k)->elementCount());
473 outputOperandList_->SetItem(k, 3, WxConversion::toWxString(elemCount));
474 k++;
475 }
476
477 wxListEvent dummy;
479}
static std::string toString(const T &source)

References dummy, inputOperandList_, inputOperands_, onSelection(), outputOperandList_, outputOperands_, Conversion::toString(), and WxConversion::toWxString().

Referenced by onAddInputOperand(), onAddOutputOperand(), onDeleteInputOperand(), onDeleteOutputOperand(), onModifyInputOperand(), onModifyOutputOperand(), and TransferDataToWindow().

Here is the call graph for this function:

◆ updateOperation()

void OperationPropertyDialog::updateOperation ( bool  newOpDag)
private

Definition at line 1025 of file OperationPropertyDialog.cc.

1025 {
1026 TransferDataFromWindow();
1027 string opName =
1029
1030 if (newOpDag && opName == "") {
1031 opName = "__UnnamedNewOperation";
1032 }
1033
1035
1036 if (opName == "" && operation_->name() == "") {
1037 format fmt = texts.text(OSEdTextGenerator::TXT_ERROR_NO_NAME);
1038 fmt % "operation";
1039 WarningDialog dialog(this, WxConversion::toWxString(fmt.str()));
1040 dialog.ShowModal();
1041 } else {
1042
1043 // let's check there isn't already an operation by the same name.
1044 // Do the check only if we are renaming this op.
1045 if (operation_ != NULL && operation_->name() != opName) {
1046
1047 Operation* op =
1049
1050 // there was old operation with same name
1051 if (op != NULL) {
1052 format fmt =
1055 WarningDialog dialog(this, WxConversion::toWxString(fmt.str()));
1056 dialog.ShowModal();
1057 return;
1058 }
1059 }
1060
1061 ObjectState* mod = saveOperation(); // load modified operation's settings from gui
1062 ObjectState* orig = orig_;
1063
1064 if (newOpDag) {
1065 operation_->loadState(mod);
1066 } else {
1067 if (*orig != *mod) {
1068 format fmt = texts.text(
1070 ConfirmDialog dialog(this, WxConversion::toWxString(fmt.str()));
1071 int ans = dialog.ShowModal();
1072 if (ans == wxID_YES) {
1073 try {
1074 operation_->loadState(mod);
1075 } catch (ObjectStateLoadingException& e) {
1076 std::cerr << "Exception caught: " << e.errorMessage()
1077 << std::endl;
1078 assert(false);
1079 }
1080 }
1081
1082 delete mod;
1083
1084 if (ans == wxID_YES) {
1085 delete orig;
1086 EndModal(wxID_OK);
1087 } else if (ans == wxID_NO) {
1088 EndModal(wxID_CANCEL);
1089 }
1090 } else {
1091 delete orig;
1092 delete mod;
1093 EndModal(wxID_OK);
1094 }
1095 }
1096 }
1097}
std::string errorMessage() const
Definition Exception.cc:123
@ TXT_ERROR_OPERATION_EXISTS
Operation exists error.
@ TXT_ERROR_NO_NAME
Error when no name is given.
@ TXT_QUESTION_SAVE_PROPERTIES
Save properties question.
static Operation * operation(const std::string &path, const std::string &module, const std::string &oper)
virtual std::string name() const
virtual void loadState(const ObjectState *state)
Definition Operation.cc:480
static std::string stringToUpper(const std::string &source)

References assert, Exception::errorMessage(), OSEdTextGenerator::instance(), Operation::loadState(), module_, Operation::name(), OperationModule::name(), name_, OperationContainer::operation(), operation_, orig_, path_, saveOperation(), StringTools::stringToUpper(), Texts::TextGenerator::text(), WxConversion::toString(), WxConversion::toWxString(), OSEdTextGenerator::TXT_ERROR_NO_NAME, OSEdTextGenerator::TXT_ERROR_OPERATION_EXISTS, and OSEdTextGenerator::TXT_QUESTION_SAVE_PROPERTIES.

Referenced by onOk(), and onOpenDAG().

Here is the call graph for this function:

◆ updateSwapLists()

void OperationPropertyDialog::updateSwapLists ( std::vector< std::string >  deletedOperands)
private

Deletes deleted operands from swap lists.

Parameters
deletedOperandsDeleted operands.

Definition at line 1215 of file OperationPropertyDialog.cc.

1215 {
1216
1217 for (size_t i = 0; i < inputOperands_.size(); i++) {
1218 Operand* operand = inputOperands_[i];
1219 ObjectState* state = operand->saveState();
1220 for (int j = 0; j < state->childCount(); j++) {
1221 if (state->child(j)->name() == Operand::OPRND_CAN_SWAP) {
1222 ObjectState* canSwap = state->child(j);
1223
1224 int k = 0;
1225 while (k < canSwap->childCount()) {
1226 ObjectState* child = canSwap->child(k);
1227 int id = child->intAttribute(Operand::OPRND_ID);
1228 string idString = Conversion::toString(id);
1229
1230 bool deleted = false;
1231 for (size_t r = 0; r < deletedOperands.size(); r++) {
1232 if (deletedOperands[r] == idString) {
1233 delete child;
1234 child = NULL;
1235 k--;
1236 deleted = true;
1237 break;
1238 }
1239 }
1240
1241 if (!deleted) {
1242 int dec = 0;
1243 for (size_t r = 0; r < deletedOperands.size(); r++) {
1244 int delId = Conversion::toInt(deletedOperands[r]);
1245 if (delId < id) {
1246 dec++;
1247 }
1248 }
1249 id = id - dec;
1250 child->setAttribute(Operand::OPRND_ID, id);
1251 }
1252 k++;
1253 }
1254 }
1255 }
1256 operand->loadState(state);
1257 }
1258}
ObjectState * child(int index) const
int intAttribute(const std::string &name) const
std::string name() const
int childCount() const
static const std::string OPRND_CAN_SWAP
Object state name for can swap.
Definition Operand.hh:92
virtual ObjectState * saveState() const
Definition Operand.cc:490
virtual void loadState(const ObjectState *state)
Definition Operand.cc:383

References ObjectState::child(), ObjectState::childCount(), inputOperands_, ObjectState::intAttribute(), Operand::loadState(), ObjectState::name(), Operand::OPRND_CAN_SWAP, Operand::OPRND_ID, Operand::saveState(), ObjectState::setAttribute(), Conversion::toInt(), and Conversion::toString().

Referenced by onDeleteInputOperand().

Here is the call graph for this function:

◆ updateTypes()

void OperationPropertyDialog::updateTypes ( )
private

Member Data Documentation

◆ affectedBy_

std::vector<std::string> OperationPropertyDialog::affectedBy_
private

Operations that are affected by this operation.

Definition at line 223 of file OperationPropertyDialog.hh.

Referenced by onAddAffectedBy(), onDeleteAffectedBy(), saveOperation(), and updateAffected().

◆ affectedByChoice_

wxComboBox* OperationPropertyDialog::affectedByChoice_
private

Choice box for new affected by operations.

Definition at line 172 of file OperationPropertyDialog.hh.

Referenced by onAddAffectedBy(), and updateAffected().

◆ affectedByList_

wxListCtrl* OperationPropertyDialog::affectedByList_
private

List of affected by operations.

Definition at line 164 of file OperationPropertyDialog.hh.

Referenced by onDeleteAffectedBy(), onSelection(), setTexts(), and updateAffected().

◆ affectedBySizer_

wxStaticBoxSizer* OperationPropertyDialog::affectedBySizer_
private

Affected by sizer.

Definition at line 161 of file OperationPropertyDialog.hh.

Referenced by createContents(), and setTexts().

◆ affects_

std::vector<std::string> OperationPropertyDialog::affects_
private

Operations that affects this operation.

Definition at line 221 of file OperationPropertyDialog.hh.

Referenced by onAddAffects(), onDeleteAffects(), saveOperation(), and updateAffected().

◆ affectsChoice_

wxComboBox* OperationPropertyDialog::affectsChoice_
private

Choice box for new affects operations.

Definition at line 174 of file OperationPropertyDialog.hh.

Referenced by onAddAffects(), and updateAffected().

◆ affectsList_

wxListCtrl* OperationPropertyDialog::affectsList_
private

List of affects operations.

Definition at line 166 of file OperationPropertyDialog.hh.

Referenced by onDeleteAffects(), onSelection(), setTexts(), and updateAffected().

◆ affectsSizer_

wxStaticBoxSizer* OperationPropertyDialog::affectsSizer_
private

Affects sizer.

Definition at line 159 of file OperationPropertyDialog.hh.

Referenced by createContents(), and setTexts().

◆ canTrap_

bool OperationPropertyDialog::canTrap_
private

Can operation trap?

Definition at line 201 of file OperationPropertyDialog.hh.

Referenced by saveOperation(), and TransferDataToWindow().

◆ canTrapCB_

wxCheckBox* OperationPropertyDialog::canTrapCB_
private

Can trap check box.

Definition at line 180 of file OperationPropertyDialog.hh.

◆ clocked_

bool OperationPropertyDialog::clocked_
private

Is operation clocked?

Definition at line 205 of file OperationPropertyDialog.hh.

Referenced by saveOperation(), and TransferDataToWindow().

◆ clockedCB_

wxCheckBox* OperationPropertyDialog::clockedCB_
private

Clocked check box.

Definition at line 184 of file OperationPropertyDialog.hh.

◆ controlFlow_

bool OperationPropertyDialog::controlFlow_
private

Can operation can change program flow.

Definition at line 207 of file OperationPropertyDialog.hh.

Referenced by saveOperation(), and TransferDataToWindow().

◆ editDescription_

wxTextCtrl* OperationPropertyDialog::editDescription_
private

Definition at line 214 of file OperationPropertyDialog.hh.

Referenced by saveOperation(), and TransferDataToWindow().

◆ hasSideEffects_

bool OperationPropertyDialog::hasSideEffects_
private

Does operation has side effects?

Definition at line 203 of file OperationPropertyDialog.hh.

Referenced by saveOperation(), and TransferDataToWindow().

◆ inputOperandList_

wxListCtrl* OperationPropertyDialog::inputOperandList_
private

◆ inputOperands_

std::vector<Operand*> OperationPropertyDialog::inputOperands_
private

◆ inputSizer_

wxStaticBoxSizer* OperationPropertyDialog::inputSizer_
private

Input operand sizer.

Definition at line 155 of file OperationPropertyDialog.hh.

Referenced by createContents(), and setTexts().

◆ isBranch_

bool OperationPropertyDialog::isBranch_
private

Operation is branch.

Definition at line 211 of file OperationPropertyDialog.hh.

Referenced by saveOperation(), and TransferDataToWindow().

◆ isCall_

bool OperationPropertyDialog::isCall_
private

Operation performs function call.

Definition at line 209 of file OperationPropertyDialog.hh.

Referenced by saveOperation(), and TransferDataToWindow().

◆ module_

OperationModule& OperationPropertyDialog::module_
private

Module in which operation belongs to.

Definition at line 193 of file OperationPropertyDialog.hh.

Referenced by createContents(), onOpen(), setBehaviorLabel(), and updateOperation().

◆ name_

wxString OperationPropertyDialog::name_
private

Name of the operation.

Definition at line 191 of file OperationPropertyDialog.hh.

Referenced by saveOperation(), TransferDataToWindow(), and updateOperation().

◆ operation_

Operation* OperationPropertyDialog::operation_
private

Operation to be created or to be modified.

Definition at line 186 of file OperationPropertyDialog.hh.

Referenced by onOpenDAG(), operation(), saveOperation(), TransferDataToWindow(), updateOperation(), and ~OperationPropertyDialog().

◆ operationWasCreatedHere_

bool OperationPropertyDialog::operationWasCreatedHere_
private

Definition at line 225 of file OperationPropertyDialog.hh.

Referenced by onOpenDAG(), and ~OperationPropertyDialog().

◆ orig_

ObjectState* OperationPropertyDialog::orig_
private

Original operation's ObjectState tree.

Definition at line 188 of file OperationPropertyDialog.hh.

Referenced by updateOperation().

◆ outputOperandList_

wxListCtrl* OperationPropertyDialog::outputOperandList_
private

◆ outputOperands_

std::vector<Operand*> OperationPropertyDialog::outputOperands_
private

◆ outputSizer_

wxStaticBoxSizer* OperationPropertyDialog::outputSizer_
private

Output operand sizer.

Definition at line 157 of file OperationPropertyDialog.hh.

Referenced by createContents(), and setTexts().

◆ path_

std::string OperationPropertyDialog::path_
private

Path in which module belongs to.

Definition at line 195 of file OperationPropertyDialog.hh.

Referenced by updateOperation().

◆ readMemory_

bool OperationPropertyDialog::readMemory_
private

Does operation read memory?

Definition at line 197 of file OperationPropertyDialog.hh.

Referenced by saveOperation(), and TransferDataToWindow().

◆ readMemoryCB_

wxCheckBox* OperationPropertyDialog::readMemoryCB_
private

Read memory check box.

Definition at line 176 of file OperationPropertyDialog.hh.

◆ sideEffectsCB_

wxCheckBox* OperationPropertyDialog::sideEffectsCB_
private

Has side effects check box.

Definition at line 182 of file OperationPropertyDialog.hh.

◆ writeMemory_

bool OperationPropertyDialog::writeMemory_
private

Does operation write memory?

Definition at line 199 of file OperationPropertyDialog.hh.

Referenced by saveOperation(), and TransferDataToWindow().

◆ writeMemoryCB_

wxCheckBox* OperationPropertyDialog::writeMemoryCB_
private

Write memory check box.

Definition at line 178 of file OperationPropertyDialog.hh.


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