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

#include <OperationDAGDialog.hh>

Inheritance diagram for OperationDAGDialog:
Inheritance graph
Collaboration diagram for OperationDAGDialog:
Collaboration graph

Public Member Functions

 OperationDAGDialog (wxWindow *parent, Operation *op)
 
virtual ~OperationDAGDialog ()
 
Operationoperation () const
 

Private Types

enum  {
  ID_EDIT_DAG = 1000, ID_SAVE_DAG_BUTTON, ID_UNDO_DAG_BUTTON, ID_DELETE_DAG_BUTTON,
  ID_NEW_DAG_BUTTON, ID_DAG_IMAGE, ID_INDEX_DAG, ID_OK_BUTTON,
  ID_CANCEL_BUTTON
}
 

Private Member Functions

 OperationDAGDialog (const OperationDAGDialog &)
 Copying not allowed. More...
 
OperationDAGDialogoperator= (const OperationDAGDialog &)
 Assignment not allowed. More...
 
wxSizer * createContents (wxWindow *parent, bool call_fit, bool set_sizer)
 
virtual bool TransferDataToWindow ()
 
void updateIndex ()
 
bool hasDot ()
 
void updateDAG ()
 
void onOK (wxCommandEvent &event)
 
void onCancel (wxCommandEvent &event)
 
void doSaveDAG (int index)
 
void onSaveDAG (wxCommandEvent &event)
 
void onUndoDAG (wxCommandEvent &event)
 
void onDeleteDAG (wxCommandEvent &event)
 
void onNewDAG (wxCommandEvent &event)
 
void onDAGChange (wxCommandEvent &event)
 
void onComboBoxChange (wxCommandEvent &event)
 
ObjectStatesaveOperation ()
 
void setTexts ()
 
void setBehaviorLabel ()
 

Private Attributes

Operationoperation_
 Operation to be created or to be modified. More...
 
ObjectStateorig_
 Original operation's ObjectState tree. More...
 
wxTextCtrl * dagEdit_
 
wxTextCtrl * editDescription_
 
wxChoice * dagIndex_
 
wxBitmap * dotImage_
 
wxStaticBitmap * dagStaticBitmap_
 
wxStaticBoxSizer * dagImageStaticBoxSizer_
 
wxScrolledWindow * dagWindow_
 
bool dotInstalled_
 

Detailed Description

Dialog which is used to create or modify an operation.

Definition at line 51 of file OperationDAGDialog.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

Component ids.

Enumerator
ID_EDIT_DAG 
ID_SAVE_DAG_BUTTON 
ID_UNDO_DAG_BUTTON 
ID_DELETE_DAG_BUTTON 
ID_NEW_DAG_BUTTON 
ID_DAG_IMAGE 
ID_INDEX_DAG 
ID_OK_BUTTON 
ID_CANCEL_BUTTON 

Definition at line 92 of file OperationDAGDialog.hh.

Constructor & Destructor Documentation

◆ OperationDAGDialog() [1/2]

OperationDAGDialog::OperationDAGDialog ( wxWindow *  parent,
Operation op 
)

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 91 of file OperationDAGDialog.cc.

93  :
94  wxDialog(
95  parent, -1, _T(""),
97  wxDefaultSize, wxRESIZE_BORDER),
98  operation_(op),
99  dotInstalled_(false) {
100 
101  createContents(this, true, true);
102 
103 
104  dagEdit_ = dynamic_cast<wxTextCtrl*>(FindWindow(ID_EDIT_DAG));
105 
106  dagIndex_ =
107  dynamic_cast<wxChoice*>(FindWindow(ID_INDEX_DAG));
108 
109  //FindWindow(ID_NAME)->SetValidator(
110  // wxTextValidator(wxFILTER_ASCII, &name_));
111 
112  // set OK button as default choice
113  // FindWindow(ID_OK_BUTTON)->SetFocus();
114 
115  orig_ = operation_->saveState(); // save original operation's state
116 
117  setTexts();
118 
119  FindWindow(ID_SAVE_DAG_BUTTON)->Disable();
120  FindWindow(ID_UNDO_DAG_BUTTON)->Disable();
121  FindWindow(ID_DELETE_DAG_BUTTON)->Disable();
122  FindWindow(ID_NEW_DAG_BUTTON)->Disable();
123 
124  updateIndex();
125 
126  dotInstalled_ = hasDot();
127 
128  updateDAG();
129 }

◆ ~OperationDAGDialog()

OperationDAGDialog::~OperationDAGDialog ( )
virtual

Destructor.

Definition at line 134 of file OperationDAGDialog.cc.

134  {
135 
136  // set dialog position
137  int x, y;
138  GetPosition(&x, &y);
139  wxPoint point(x, y);
141 }

References DialogPosition::DIALOG_PROPERTIES, and DialogPosition::setPosition().

Here is the call graph for this function:

◆ OperationDAGDialog() [2/2]

OperationDAGDialog::OperationDAGDialog ( const OperationDAGDialog )
private

Copying not allowed.

Member Function Documentation

◆ createContents()

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

Creates the contents of the dialog.

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 516 of file OperationDAGDialog.cc.

519  {
520 
521  // Window for scrolling DAG image
522  wxSize size(300, 400);
523  dagWindow_ = new wxScrolledWindow(parent, -1, wxDefaultPosition, size);
524 
525  // Window sizers
526  wxBoxSizer *item0 = new wxBoxSizer(wxVERTICAL);
527 
528  // Static box for DAG code
529  wxStaticBox *dagStaticBox = new wxStaticBox(parent, -1, wxT("Code"));
530  wxStaticBoxSizer *dagStaticBoxSizer =
531  new wxStaticBoxSizer(dagStaticBox, wxVERTICAL);
532 
533  // DAG editor
534  wxTextCtrl* editDAG =
535  new wxTextCtrl(
536  parent, ID_EDIT_DAG, wxT(""), wxDefaultPosition,
537  wxSize(250,-1), wxTE_MULTILINE);
538 
539  // Static box for DAG image
540  wxStaticBox *dagImageStaticBox = new wxStaticBox(parent, -1, wxT("DAG"));
542  new wxStaticBoxSizer(dagImageStaticBox, wxVERTICAL);
543 
544  dagImageStaticBoxSizer_->Add(dagWindow_, 1, wxALL|wxGROW, 5);
545  dagImageStaticBoxSizer_->SetDimension(-1, -1, 550, 550);
546 
547  // DAG image
548  dotImage_ = new wxBitmap(300,100);
550  new wxStaticBitmap(dagWindow_, ID_DAG_IMAGE, *dotImage_);
551 
552  dagWindow_->SetSize(-1, -1, 50, 50);
553  dagWindow_->SetScrollbars(20, 20, 20, 20);
554  dagImageStaticBoxSizer_->Show(true);
555 
556  // Add DAG editor to DAG code sizer
557  dagStaticBoxSizer->Add(editDAG, 1, wxALL|wxGROW, 5);
558 
559  // Add DAG code to page sizer
560  wxBoxSizer *pageSizer = new wxBoxSizer(wxHORIZONTAL);
561  pageSizer->Add(dagStaticBoxSizer, 1, wxGROW|wxTOP, 10);
562  pageSizer->Add(dagImageStaticBoxSizer_, 2, wxGROW|wxTOP, 10);
563 
564  // Add page sizer to window sizer
565  item0->Add(pageSizer, 1, wxEXPAND|wxALL, 5);
566 
567  wxString strs9[] =
568  {
569  wxT("id: 1")
570  };
571 
572 
573  // ComboBox for choosing DAG
574  wxChoice *indexDAG =
575  new wxChoice(
576  parent, ID_INDEX_DAG, wxDefaultPosition, wxSize(150,-1), 1,
577  strs9);
578  wxButton *saveDAG =
579  new wxButton(
580  parent, ID_SAVE_DAG_BUTTON, wxT("Save"), wxDefaultPosition,
581  wxDefaultSize, 0);
582  wxButton *undoDAG =
583  new wxButton(
584  parent, ID_UNDO_DAG_BUTTON, wxT("Undo"), wxDefaultPosition,
585  wxDefaultSize, 0);
586  wxButton *deleteDAG =
587  new wxButton(
588  parent, ID_DELETE_DAG_BUTTON, wxT("Delete"), wxDefaultPosition,
589  wxDefaultSize, 0);
590  wxButton *newDAG =
591  new wxButton(
592  parent, ID_NEW_DAG_BUTTON, wxT("New"), wxDefaultPosition,
593  wxDefaultSize, 0);
594 
595  wxBoxSizer *dagToolsSizer = new wxBoxSizer(wxHORIZONTAL);
596  dagToolsSizer->Add(indexDAG, 0, wxALIGN_CENTER|wxALL, 5);
597 
598  wxGridSizer *dagButtonSizer = new wxGridSizer(2, 0, 0);
599 
600  dagButtonSizer->Add(saveDAG, 0, wxALIGN_CENTER|wxALL, 5);
601  dagButtonSizer->Add(undoDAG, 0, wxALIGN_CENTER|wxALL, 5);
602  dagButtonSizer->Add(deleteDAG, 0, wxALIGN_CENTER|wxALL, 5);
603  dagButtonSizer->Add(newDAG, 0, wxALIGN_CENTER|wxALL, 5);
604 
605  dagToolsSizer->Add(dagButtonSizer, 0, wxALIGN_CENTER|wxALL, 5);
606  dagStaticBoxSizer->Add(dagToolsSizer, 0, wxALL, 5);
607 
608  wxBoxSizer *controlButtonSizer = new wxBoxSizer(wxHORIZONTAL);
609  wxButton *OK =
610  new wxButton(
611  parent, ID_OK_BUTTON, wxT("Ok"), wxDefaultPosition,
612  wxDefaultSize, 0);
613  wxButton *Cancel =
614  new wxButton(
615  parent, wxID_CANCEL, wxT("Cancel"), wxDefaultPosition,
616  wxDefaultSize, 0);
617 
618  controlButtonSizer->Add(OK, 0, wxALL, 5);
619  controlButtonSizer->Add(Cancel, 0, wxALL, 5);
620  item0->Add(
621  controlButtonSizer, 0,
622  wxALL, 5);
623 
624  if (set_sizer) {
625  parent->SetSizer(item0);
626  if (call_fit) {
627  item0->SetSizeHints(parent);
628  }
629  }
630 
631 
632  return item0;
633 }

References dagImageStaticBoxSizer_, dagStaticBitmap_, dagWindow_, dotImage_, ID_DAG_IMAGE, ID_DELETE_DAG_BUTTON, ID_EDIT_DAG, ID_INDEX_DAG, ID_NEW_DAG_BUTTON, ID_OK_BUTTON, ID_SAVE_DAG_BUTTON, and ID_UNDO_DAG_BUTTON.

◆ doSaveDAG()

void OperationDAGDialog::doSaveDAG ( int  index)
private

Definition at line 389 of file OperationDAGDialog.cc.

389  {
390  std::string code("");
391  wxString wxTemp;
392 
393  for (int i = 0; i < dagEdit_->GetNumberOfLines(); ++i) {
394  wxTemp = dagEdit_->GetLineText(i);
395 
396 #if wxCHECK_VERSION(2, 6, 0)
397  std::string stdTemp(wxTemp.mb_str());
398 #else
399  std::string stdTemp(wxTemp.c_str());
400 #endif
401 
402  code += stdTemp;
403  code += '\n';
404  }
405 
406  if (operation_->dagCount() == index) {
407  operation_->addDag(code);
408  } else {
409  operation_->setDagCode(index, code.c_str());
410  }
411 
412  updateIndex();
413  dagIndex_->SetSelection(index);
414  updateDAG();
415 }

References Operation::addDag(), Operation::dagCount(), dagEdit_, dagIndex_, operation_, Operation::setDagCode(), updateDAG(), and updateIndex().

Referenced by onOK(), and onSaveDAG().

Here is the call graph for this function:

◆ hasDot()

bool OperationDAGDialog::hasDot ( )
private

Tests whether user has program dot is installed.

Returns
True if dot is installed.

Definition at line 223 of file OperationDAGDialog.cc.

223  {
224 
225  if (system("which dot > /dev/null 2>&1") != 0) {
226  wxString caption(wxString::FromAscii("Warning"));
227  wxString message(
228  wxString::FromAscii(
229  "You must have dot installed to display DAGs."));
230  wxMessageBox(message, caption);
231  dagImageStaticBoxSizer_->Show(false);
232  Layout();
233  return false; // cannot display DAG without dot
234  } else {
235  return true;
236  }
237 }

References dagImageStaticBoxSizer_.

◆ onCancel()

void OperationDAGDialog::onCancel ( wxCommandEvent &  event)
private

Handles the event when Cancel button is pushed.

Definition at line 383 of file OperationDAGDialog.cc.

383  {
385  EndModal(wxID_CANCEL);
386 }

References Operation::loadState(), operation_, and orig_.

Here is the call graph for this function:

◆ onComboBoxChange()

void OperationDAGDialog::onComboBoxChange ( wxCommandEvent &  event)
private

Handles the event when ComboBox is changed

Definition at line 503 of file OperationDAGDialog.cc.

503  {
504  updateDAG();
505 }

References updateDAG().

Here is the call graph for this function:

◆ onDAGChange()

void OperationDAGDialog::onDAGChange ( wxCommandEvent &  event)
private

Handles the event when DAG is changed

Definition at line 494 of file OperationDAGDialog.cc.

494  {
495  FindWindow(ID_UNDO_DAG_BUTTON)->Enable();
496  FindWindow(ID_SAVE_DAG_BUTTON)->Enable();
497 }

References ID_SAVE_DAG_BUTTON, and ID_UNDO_DAG_BUTTON.

◆ onDeleteDAG()

void OperationDAGDialog::onDeleteDAG ( wxCommandEvent &  event)
private

Handles the event when Delete button is pushed.

Definition at line 458 of file OperationDAGDialog.cc.

458  {
459  int index = dagIndex_->GetSelection();
460  if (operation_->dagCount() > index) {
461  dagEdit_->Clear();
462  operation_->removeDag(index);
463  }
464 
465  updateIndex();
466 
467  if (index > 0) {
468  index--;
469  }
470 
471  dagIndex_->SetSelection(index);
472  updateDAG();
473 }

References Operation::dagCount(), dagEdit_, dagIndex_, operation_, Operation::removeDag(), updateDAG(), and updateIndex().

Here is the call graph for this function:

◆ onNewDAG()

void OperationDAGDialog::onNewDAG ( wxCommandEvent &  event)
private

Handles the event when New button is pushed.

Definition at line 479 of file OperationDAGDialog.cc.

479  {
480  int index = operation_->dagCount();
481  dagEdit_->Clear();
482  dagIndex_->SetSelection(index);
483  FindWindow(ID_SAVE_DAG_BUTTON)->Disable();
484  FindWindow(ID_UNDO_DAG_BUTTON)->Disable();
485  FindWindow(ID_DELETE_DAG_BUTTON)->Disable();
486  FindWindow(ID_NEW_DAG_BUTTON)->Disable();
487  dagImageStaticBoxSizer_->Show(false);
488 }

References Operation::dagCount(), dagEdit_, dagImageStaticBoxSizer_, dagIndex_, ID_DELETE_DAG_BUTTON, ID_NEW_DAG_BUTTON, ID_SAVE_DAG_BUTTON, ID_UNDO_DAG_BUTTON, and operation_.

Here is the call graph for this function:

◆ onOK()

void OperationDAGDialog::onOK ( wxCommandEvent &  event)
private

Handles the event when OK button is pushed.

Definition at line 371 of file OperationDAGDialog.cc.

371  {
372  for (int i = 0; i < operation_->dagCount(); i++) {
373  doSaveDAG(i);
374  }
375  EndModal(wxID_OK);
376 }

References Operation::dagCount(), doSaveDAG(), and operation_.

Here is the call graph for this function:

◆ onSaveDAG()

void OperationDAGDialog::onSaveDAG ( wxCommandEvent &  event)
private

Handles the event when Save button is pushed.

Definition at line 421 of file OperationDAGDialog.cc.

421  {
422  if(operation_ == NULL) {
423  return;
424  }
425 
426  int index = dagIndex_->GetSelection();
427 
428  doSaveDAG(index);
429 
430  FindWindow(ID_SAVE_DAG_BUTTON)->Disable();
431  FindWindow(ID_UNDO_DAG_BUTTON)->Disable();
432  FindWindow(ID_DELETE_DAG_BUTTON)->Enable();
433 }

References dagIndex_, doSaveDAG(), ID_DELETE_DAG_BUTTON, ID_SAVE_DAG_BUTTON, ID_UNDO_DAG_BUTTON, and operation_.

Here is the call graph for this function:

◆ onUndoDAG()

void OperationDAGDialog::onUndoDAG ( wxCommandEvent &  event)
private

Handles the event when Undo button is pushed.

Definition at line 439 of file OperationDAGDialog.cc.

439  {
440  std::iostream dagCode(dagEdit_);
441 
442  int index = dagIndex_->GetSelection();
443  if (operation_->dagCount() == index) { // new operation
444  dagEdit_->Clear();
445  FindWindow(ID_DELETE_DAG_BUTTON)->Disable();
446  } else {
447  updateDAG();
448  FindWindow(ID_DELETE_DAG_BUTTON)->Enable();
449  }
450  FindWindow(ID_SAVE_DAG_BUTTON)->Disable();
451  FindWindow(ID_UNDO_DAG_BUTTON)->Disable();
452 }

References Operation::dagCount(), dagEdit_, dagIndex_, ID_DELETE_DAG_BUTTON, ID_SAVE_DAG_BUTTON, ID_UNDO_DAG_BUTTON, operation_, and updateDAG().

Here is the call graph for this function:

◆ operation()

Operation * OperationDAGDialog::operation ( ) const

Returns operation object of dialog.

Returns
Operation object of dialog.

Definition at line 149 of file OperationDAGDialog.cc.

149  {
150  return operation_;
151 }

References operation_.

◆ operator=()

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

Assignment not allowed.

◆ saveOperation()

ObjectState* OperationDAGDialog::saveOperation ( )
private

◆ setBehaviorLabel()

void OperationDAGDialog::setBehaviorLabel ( )
private

◆ setTexts()

void OperationDAGDialog::setTexts ( )
private

◆ TransferDataToWindow()

bool OperationDAGDialog::TransferDataToWindow ( )
privatevirtual

Transfers data to window.

Returns
True if transfer is successful.

Definition at line 187 of file OperationDAGDialog.cc.

187  {
188  return wxWindow::TransferDataToWindow();
189 }

◆ updateDAG()

void OperationDAGDialog::updateDAG ( )
private

Updates TextCtrl for DAG

Definition at line 243 of file OperationDAGDialog.cc.

243  {
244 
245  dagEdit_->Clear();
246 
247  // get selected item from ComboBox
248  int index = dagIndex_->GetSelection();
249 
250  // check that index is legal
251  if (operation_ != NULL && index < operation_->dagCount()) {
252  std::string code = operation_->dagCode(index);
253  std::ostream dagCode(dagEdit_);
254  dagCode << code;
255  dagCode.flush();
256 
257  FindWindow(ID_UNDO_DAG_BUTTON)->Disable();
258  FindWindow(ID_SAVE_DAG_BUTTON)->Disable();
259  FindWindow(ID_DELETE_DAG_BUTTON)->Enable();
260  FindWindow(ID_NEW_DAG_BUTTON)->Enable();
261 
262  OperationDAG& currentDAG = operation_->dag(index);
263  if (operation_->dagError(index) != "") {
264  wxString message(
265  wxString::FromAscii(
266  operation_->dagError(index).c_str()));
267  wxString caption(wxString::FromAscii("Warning"));
268  wxMessageBox(message, caption);
269  dagImageStaticBoxSizer_->Show(false);
270  Layout();
271  }
272 
273  std::string temp = FileSystem::createTempDirectory();
274  std::string pngDag = temp + "/dag.png";
275  std::string dotDag = temp + "/dag.dot";
276 
277  if( !dotInstalled_ )
278  {
279  // cannot show DAG without dot
280  dagImageStaticBoxSizer_->Show(false);
281  Layout();
282  return;
283  }
284 
285  if (currentDAG.isNull() == true) { // compile error
286 
287  std::string errText = operation_->dagError(index);
288 
289  // strip carriage returns from errText
290  while (true) {
291  const int pos = errText.find('\n');
292  if (pos == -1) {
293  break;
294  }
295  errText.replace(pos, 1,"\\n");
296  }
297 
298  // command to generate error message
299  std::string dotCmd =
300  std::string("echo 'digraph G {n140545368 [label=\"") + errText +
301  "\", shape=plaintext, fontsize=12]; }' | dot -Tpng > " + pngDag;
302 
303  if (system(dotCmd.c_str()) != 0) {
304  debugLog("Error executing dot.");
305  }
306 
307  delete dotImage_;
308  dotImage_ = new wxBitmap(100,100);
309  wxString wxTemp(wxString::FromAscii(pngDag.c_str()));
310  dotImage_->LoadFile(wxTemp, wxBITMAP_TYPE_PNG);
311  dagStaticBitmap_->SetBitmap(*dotImage_);
312 
313  unsigned int width = dotImage_->GetWidth();
314  unsigned int height = dotImage_->GetHeight();
315 
316  // calculate virtual area and rounding the result up
317  width = static_cast<unsigned int>(float(width) / 20 + 0.5);
318  height = static_cast<unsigned int>(float(height) / 20 + 0.5);
319 
320  dagWindow_->SetSize(-1, -1, width, height);
321  dagWindow_->SetScrollbars(20, 20, -1, -1);
322  dagImageStaticBoxSizer_->Show(true);
323 
324  } else {
325 
326  // generate dot
327  currentDAG.writeToDotFile(dotDag);
328 
329  // generate png from dot
330  std::string dotCmd = "dot -Tpng " + dotDag + " > " + pngDag;
331  if (system(dotCmd.c_str()) != 0) {
332  debugLog("Error executing dot.");
333  }
334 
335  delete dotImage_;
336  dotImage_ = new wxBitmap(300,100);
337  wxString wxTemp(wxString::FromAscii(pngDag.c_str()));
338  dotImage_->LoadFile(wxTemp, wxBITMAP_TYPE_PNG);
339  dagStaticBitmap_->SetBitmap(*dotImage_);
340  dagImageStaticBoxSizer_->Show(true);
341 
342  unsigned int width = dotImage_->GetWidth();
343  unsigned int height = dotImage_->GetHeight();
344 
345  // calculate virtual area and rounding the result up
346  width = static_cast<unsigned int>(float(width) / 20 + 0.5);
347  height = static_cast<unsigned int>(float(height) / 20 + 0.5);
348 
349  dagWindow_->SetSize(50, 50);
350  dagWindow_->SetScrollbars(20, 20, width, height);
351  }
353 
354  } else {
355 
356  // new dag => do not update, just disable the buttons
357  FindWindow(ID_UNDO_DAG_BUTTON)->Disable();
358  FindWindow(ID_SAVE_DAG_BUTTON)->Disable();
359  FindWindow(ID_DELETE_DAG_BUTTON)->Disable();
360  FindWindow(ID_NEW_DAG_BUTTON)->Disable();
361 
362  dagImageStaticBoxSizer_->Show(false);
363  }
364  Layout();
365 }

References FileSystem::createTempDirectory(), Operation::dag(), Operation::dagCode(), dagEdit_, Operation::dagError(), dagImageStaticBoxSizer_, dagIndex_, dagStaticBitmap_, dagWindow_, debugLog, dotImage_, dotInstalled_, ID_DELETE_DAG_BUTTON, ID_NEW_DAG_BUTTON, ID_SAVE_DAG_BUTTON, ID_UNDO_DAG_BUTTON, OperationDAG::isNull(), operation_, FileSystem::removeFileOrDirectory(), TCEString::replace(), and GraphBase< GraphNode, GraphEdge >::writeToDotFile().

Referenced by doSaveDAG(), onComboBoxChange(), onDeleteDAG(), and onUndoDAG().

Here is the call graph for this function:

◆ updateIndex()

void OperationDAGDialog::updateIndex ( )
private

Updates the DAG list.

Definition at line 195 of file OperationDAGDialog.cc.

195  {
196 
197  dagIndex_->Clear();
198 
199  if (operation_ == NULL) {
200  return;
201  }
202 
203  if (operation_->dagCount() > 0) {
204  for (int i = 0; i < operation_->dagCount(); i++) {
205  wxString oper = WxConversion::toWxString(i+1);
206  dagIndex_->Append(oper);
207  }
208  }
209 
210  // last item is "New Dag"-option
211  wxString oper = wxT("New DAG");
212  dagIndex_->Append(oper);
213  dagIndex_->SetSelection(0);
214 
215 }

References Operation::dagCount(), dagIndex_, operation_, and WxConversion::toWxString().

Referenced by doSaveDAG(), and onDeleteDAG().

Here is the call graph for this function:

Member Data Documentation

◆ dagEdit_

wxTextCtrl* OperationDAGDialog::dagEdit_
private

Definition at line 110 of file OperationDAGDialog.hh.

Referenced by doSaveDAG(), onDeleteDAG(), onNewDAG(), onUndoDAG(), and updateDAG().

◆ dagImageStaticBoxSizer_

wxStaticBoxSizer* OperationDAGDialog::dagImageStaticBoxSizer_
private

Definition at line 123 of file OperationDAGDialog.hh.

Referenced by createContents(), hasDot(), onNewDAG(), and updateDAG().

◆ dagIndex_

wxChoice* OperationDAGDialog::dagIndex_
private

◆ dagStaticBitmap_

wxStaticBitmap* OperationDAGDialog::dagStaticBitmap_
private

Definition at line 122 of file OperationDAGDialog.hh.

Referenced by createContents(), and updateDAG().

◆ dagWindow_

wxScrolledWindow* OperationDAGDialog::dagWindow_
private

Definition at line 126 of file OperationDAGDialog.hh.

Referenced by createContents(), and updateDAG().

◆ dotImage_

wxBitmap* OperationDAGDialog::dotImage_
private

Definition at line 119 of file OperationDAGDialog.hh.

Referenced by createContents(), and updateDAG().

◆ dotInstalled_

bool OperationDAGDialog::dotInstalled_
private

Definition at line 128 of file OperationDAGDialog.hh.

Referenced by updateDAG().

◆ editDescription_

wxTextCtrl* OperationDAGDialog::editDescription_
private

Definition at line 113 of file OperationDAGDialog.hh.

◆ operation_

Operation* OperationDAGDialog::operation_
private

Operation to be created or to be modified.

Definition at line 105 of file OperationDAGDialog.hh.

Referenced by doSaveDAG(), onCancel(), onDeleteDAG(), onNewDAG(), onOK(), onSaveDAG(), onUndoDAG(), operation(), updateDAG(), and updateIndex().

◆ orig_

ObjectState* OperationDAGDialog::orig_
private

Original operation's ObjectState tree.

Definition at line 107 of file OperationDAGDialog.hh.

Referenced by onCancel().


The documentation for this class was generated from the following files:
OperationDAGDialog::ID_SAVE_DAG_BUTTON
@ ID_SAVE_DAG_BUTTON
Definition: OperationDAGDialog.hh:94
WxConversion::toWxString
static wxString toWxString(const std::string &source)
FileSystem::removeFileOrDirectory
static bool removeFileOrDirectory(const std::string &path)
Definition: FileSystem.cc:493
OperationDAG::isNull
bool isNull() const
Definition: OperationDAG.hh:48
OperationDAGDialog::ID_EDIT_DAG
@ ID_EDIT_DAG
Definition: OperationDAGDialog.hh:93
Operation::removeDag
virtual void removeDag(int index)
Definition: Operation.cc:123
OSEdTextGenerator::TXT_BUTTON_NEW
@ TXT_BUTTON_NEW
New button label.
Definition: OSEdTextGenerator.hh:78
Operation::dagError
virtual TCEString dagError(int index) const
Definition: Operation.cc:182
OperationDAGDialog::updateIndex
void updateIndex()
Definition: OperationDAGDialog.cc:195
OperationDAGDialog::dagStaticBitmap_
wxStaticBitmap * dagStaticBitmap_
Definition: OperationDAGDialog.hh:122
WidgetTools::setLabel
static void setLabel(Texts::TextGenerator *generator, wxWindow *widget, int textID)
Definition: WidgetTools.cc:92
DialogPosition::getPosition
static wxPoint getPosition(Dialogs dialog)
Definition: DialogPosition.cc:49
TCEString::replace
static unsigned replace(std::string &str, const std::string &oldPattern, const std::string &newPattern)
Definition: TCEString.cc:251
OperationDAGDialog::hasDot
bool hasDot()
Definition: OperationDAGDialog.cc:223
OperationDAGDialog::ID_DELETE_DAG_BUTTON
@ ID_DELETE_DAG_BUTTON
Definition: OperationDAGDialog.hh:96
OperationDAGDialog::createContents
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
Definition: OperationDAGDialog.cc:516
FindWindow
Definition: FindWindow.hh:49
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
OSEdTextGenerator::TXT_BUTTON_DELETE
@ TXT_BUTTON_DELETE
Delete button label.
Definition: OSEdTextGenerator.hh:77
DialogPosition::setPosition
static void setPosition(Dialogs dialog, wxPoint point)
Definition: DialogPosition.cc:63
Operation::dagCode
virtual TCEString dagCode(int index) const
Definition: Operation.cc:159
OperationDAGDialog::ID_DAG_IMAGE
@ ID_DAG_IMAGE
Definition: OperationDAGDialog.hh:98
OperationDAGDialog::dagIndex_
wxChoice * dagIndex_
Definition: OperationDAGDialog.hh:116
OSEdTextGenerator::TXT_BUTTON_UNDO
@ TXT_BUTTON_UNDO
Undo button label.
Definition: OSEdTextGenerator.hh:76
OperationDAG
Definition: OperationDAG.hh:43
OperationDAGDialog::dotImage_
wxBitmap * dotImage_
Definition: OperationDAGDialog.hh:119
OperationDAGDialog::ID_NEW_DAG_BUTTON
@ ID_NEW_DAG_BUTTON
Definition: OperationDAGDialog.hh:97
Operation::loadState
virtual void loadState(const ObjectState *state)
Definition: Operation.cc:480
Operation::addDag
virtual void addDag(const TCEString &code)
Definition: Operation.cc:113
OperationDAGDialog::orig_
ObjectState * orig_
Original operation's ObjectState tree.
Definition: OperationDAGDialog.hh:107
OperationDAGDialog::ID_CANCEL_BUTTON
@ ID_CANCEL_BUTTON
Definition: OperationDAGDialog.hh:101
Operation::saveState
virtual ObjectState * saveState() const
Definition: Operation.cc:490
OperationDAGDialog::doSaveDAG
void doSaveDAG(int index)
Definition: OperationDAGDialog.cc:389
OperationDAGDialog::dagEdit_
wxTextCtrl * dagEdit_
Definition: OperationDAGDialog.hh:110
GraphBase::writeToDotFile
virtual void writeToDotFile(const TCEString &fileName) const
OperationDAGDialog::dagWindow_
wxScrolledWindow * dagWindow_
Definition: OperationDAGDialog.hh:126
OperationDAGDialog::setTexts
void setTexts()
Definition: OperationDAGDialog.cc:157
OperationDAGDialog::updateDAG
void updateDAG()
Definition: OperationDAGDialog.cc:243
OperationDAGDialog::ID_INDEX_DAG
@ ID_INDEX_DAG
Definition: OperationDAGDialog.hh:99
Operation::dagCount
virtual int dagCount() const
Definition: Operation.cc:134
DialogPosition::DIALOG_PROPERTIES
@ DIALOG_PROPERTIES
Operation properties dialog.
Definition: DialogPosition.hh:48
OperationDAGDialog::operation_
Operation * operation_
Operation to be created or to be modified.
Definition: OperationDAGDialog.hh:105
OperationDAGDialog::ID_OK_BUTTON
@ ID_OK_BUTTON
Definition: OperationDAGDialog.hh:100
OperationDAGDialog::dotInstalled_
bool dotInstalled_
Definition: OperationDAGDialog.hh:128
OperationDAGDialog::dagImageStaticBoxSizer_
wxStaticBoxSizer * dagImageStaticBoxSizer_
Definition: OperationDAGDialog.hh:123
Operation::setDagCode
virtual void setDagCode(int index, const TCEString &code)
Definition: Operation.cc:171
OSEdTextGenerator::instance
static OSEdTextGenerator & instance()
Definition: OSEdTextGenerator.cc:214
OSEdTextGenerator
Definition: OSEdTextGenerator.hh:42
OperationDAGDialog::ID_UNDO_DAG_BUTTON
@ ID_UNDO_DAG_BUTTON
Definition: OperationDAGDialog.hh:95
debugLog
#define debugLog(text)
Definition: Application.hh:95
OSEdTextGenerator::TXT_BUTTON_SAVE
@ TXT_BUTTON_SAVE
Save button label.
Definition: OSEdTextGenerator.hh:75
FileSystem::createTempDirectory
static std::string createTempDirectory(const std::string &path="/tmp", const std::string &tempDirPrefix="tmp_tce_")
Definition: FileSystem.cc:441
Operation::dag
virtual OperationDAG & dag(int index) const
Definition: Operation.cc:148
OSEdTextGenerator::TXT_PROPERTY_DIALOG_TITLE
@ TXT_PROPERTY_DIALOG_TITLE
Property dialog title.
Definition: OSEdTextGenerator.hh:109