OpenASIP  2.0
FUDialog.cc
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file FUDialog.cc
26  *
27  * Definition of FUDialog class.
28  *
29  * @author Veli-Pekka Jääskeläinen 2004 (vjaaskel-no.spam-cs.tut.fi)
30  * @note rating: red
31  */
32 
33 #include <set>
34 #include <string>
35 #include <wx/valtext.h>
36 #include <wx/valgen.h>
37 #include <boost/format.hpp>
38 
39 #include "Application.hh"
40 #include "FUDialog.hh"
41 #include "FUPortDialog.hh"
42 #include "Model.hh"
43 #include "WxConversion.hh"
44 #include "ProDeConstants.hh"
45 #include "Conversion.hh"
46 #include "WarningDialog.hh"
47 #include "ErrorDialog.hh"
48 #include "InformationDialog.hh"
49 #include "Machine.hh"
50 #include "AddressSpace.hh"
51 #include "FunctionUnit.hh"
52 #include "FUPort.hh"
53 #include "UserManualCmd.hh"
54 #include "WidgetTools.hh"
55 #include "OperationDialog.hh"
56 #include "HWOperation.hh"
57 #include "ModelConstants.hh"
58 #include "MachineTester.hh"
59 #include "GUITextGenerator.hh"
60 #include "ProDeTextGenerator.hh"
61 #include "OpsetDialog.hh"
62 #include "ObjectState.hh"
63 
64 using boost::format;
65 using std::string;
66 using namespace TTAMachine;
67 
68 BEGIN_EVENT_TABLE(FUDialog, wxDialog)
69  EVT_TEXT(ID_NAME, FUDialog::onName)
70  EVT_CHOICE(ID_ADDRESS_SPACE, FUDialog::onSetAddressSpace)
71  EVT_BUTTON(ID_ADD_PORT, FUDialog::onAddPort)
72  EVT_BUTTON(ID_DELETE_PORT, FUDialog::onDeletePort)
73  EVT_BUTTON(ID_EDIT_PORT, FUDialog::onEditPort)
74  EVT_MENU(ID_EDIT_PORT, FUDialog::onEditPort)
75  EVT_MENU(ID_DELETE_PORT, FUDialog::onDeletePort)
76  EVT_MENU(ID_EDIT_OPERATION, FUDialog::onEditOperation)
77  EVT_MENU(ID_DELETE_OPERATION, FUDialog::onDeleteOperation)
78 
80  EVT_LIST_ITEM_RIGHT_CLICK(ID_PORT_LIST, FUDialog::onPortRightClick)
82  EVT_LIST_ITEM_RIGHT_CLICK(ID_OPERATION_LIST, FUDialog::onOperationRightClick)
83 
84  EVT_BUTTON(ID_ADD_OPERATION, FUDialog::onAddOperation)
85  EVT_BUTTON(ID_ADD_OPERATION_FROM_OPSET, FUDialog::onAddOperationFromOpset)
86  EVT_BUTTON(ID_DELETE_OPERATION, FUDialog::onDeleteOperation)
87  EVT_BUTTON(ID_EDIT_OPERATION, FUDialog::onEditOperation)
88 
89  EVT_BUTTON(wxID_OK, FUDialog::onOK)
90 
91  EVT_LIST_ITEM_FOCUSED(ID_PORT_LIST, FUDialog::onPortSelection)
92  EVT_LIST_DELETE_ITEM(ID_PORT_LIST, FUDialog::onPortSelection)
95 
96  EVT_LIST_ITEM_FOCUSED(ID_OPERATION_LIST, FUDialog::onOperationSelection)
97  EVT_LIST_DELETE_ITEM(ID_OPERATION_LIST, FUDialog::onOperationSelection)
101 
102 
103 /**
104  * The Constructor.
105  *
106  * @param parent Parent window of the dialog.
107  * @param functionUnit A function unit to be shown in the dialog.
108  */
110  wxWindow* parent,
111  FunctionUnit* functionUnit):
112  wxDialog(parent, -1, _T(""), wxDefaultPosition),
113  functionUnit_(functionUnit),
114  name_(_T("")),
115  portListCtrl_(NULL),
116  operationListCtrl_(NULL),
117  addressSpaceChoice_(NULL) {
118 
119  createContents(this, true, true);
120 
121  portListCtrl_ = dynamic_cast<wxListCtrl*>(FindWindow(ID_PORT_LIST));
122  operationListCtrl_ =
123  dynamic_cast<wxListCtrl*>(FindWindow(ID_OPERATION_LIST));
124  addressSpaceChoice_ =
125  dynamic_cast<wxChoice*>(FindWindow(ID_ADDRESS_SPACE));
126 
127  FindWindow(ID_NAME)->SetValidator(wxTextValidator(wxFILTER_ASCII, &name_));
128 
129  FindWindow(wxID_OK)->Disable();
130 
131  // set widget texts
132  setTexts();
133 
134  TransferDataToWindow();
135 }
136 
137 
138 /**
139  * The Destructor.
140  */
142 }
143 
144 
145 /**
146  * Sets texts for widgets.
147  */
148 void
152 
153  // Dialog title
154  format fmt = prodeTexts->text(ProDeTextGenerator::TXT_FU_DIALOG_TITLE);
155  SetTitle(WxConversion::toWxString(fmt.str()));
156 
157  // buttons
158  WidgetTools::setLabel(generator, FindWindow(wxID_OK),
160 
161  WidgetTools::setLabel(generator, FindWindow(wxID_CANCEL),
163 
164  WidgetTools::setLabel(generator, FindWindow(ID_HELP),
166 
167  WidgetTools::setLabel(generator, FindWindow(ID_ADD_PORT),
169 
170  WidgetTools::setLabel(generator, FindWindow(ID_EDIT_PORT),
172 
173  WidgetTools::setLabel(generator, FindWindow(ID_DELETE_PORT),
175 
176  WidgetTools::setLabel(generator, FindWindow(ID_ADD_OPERATION),
178 
179  WidgetTools::setLabel(generator, FindWindow(ID_EDIT_OPERATION),
181 
182  WidgetTools::setLabel(generator, FindWindow(ID_DELETE_OPERATION),
184 
185  // widget labels
186  WidgetTools::setLabel(prodeTexts, FindWindow(ID_LABEL_NAME),
188 
189  WidgetTools::setLabel(prodeTexts, FindWindow(ID_LABEL_AS),
191 
192  // box sizer labels
193  fmt = prodeTexts->text(ProDeTextGenerator::TXT_FU_PORTS_BOX);
194  WidgetTools::setWidgetLabel(portsSizer_, fmt.str());
195 
197  WidgetTools::setWidgetLabel(operationsSizer_, fmt.str());
198 
199  // Create port list columns.
200  wxListCtrl* portList =
201  dynamic_cast<wxListCtrl*>(FindWindow(ID_PORT_LIST));
203  portList->InsertColumn(0, WxConversion::toWxString(fmt.str()),
204  wxLIST_FORMAT_CENTER, 30);
205  fmt = prodeTexts->text(ProDeTextGenerator::TXT_COLUMN_NAME);
206  portList->InsertColumn(1, WxConversion::toWxString(fmt.str()),
207  wxLIST_FORMAT_LEFT, 110);
208  fmt = prodeTexts->text(ProDeTextGenerator::TXT_COLUMN_WIDTH);
209  portList->InsertColumn(2, WxConversion::toWxString(fmt.str()),
210  wxLIST_FORMAT_LEFT, 110);
211 
212  // Create operation list column.
213  wxListCtrl* operationList =
214  dynamic_cast<wxListCtrl*>(FindWindow(ID_OPERATION_LIST));
215  fmt = prodeTexts->text(ProDeTextGenerator::TXT_COLUMN_NAME);
216  operationList->InsertColumn(0, WxConversion::toWxString(fmt.str()),
217  wxLIST_FORMAT_LEFT, 250);
218 
219  Layout();
220 }
221 
222 /**
223  * Transfers data from the MOM to the dialog widgets.
224  *
225  * @return False, if an error occured in the transfer, true otherwise.
226  */
227 bool
229 
230  name_ = WxConversion::toWxString(functionUnit_->name());
231  updatePortList();
232  updateOperationList();
233  updateAddressSpaceChoice();
234 
235  return wxWindow::TransferDataToWindow();
236 }
237 
238 
239 /**
240  * Validates input in the controls, and updates the FunctionUnit.
241  */
242 void
243 FUDialog::onOK(wxCommandEvent&) {
244 
245  if (!Validate()) {
246  return;
247  }
248 
249  if (!TransferDataFromWindow()) {
250  return;
251  }
252 
253  string trimmedName =
254  WxConversion::toString(name_.Trim(false).Trim(true));
255 
256  // Check the name validity.
257  if (!MachineTester::isValidComponentName(trimmedName)) {
259  format message =
261  InformationDialog warning(
262  this, WxConversion::toWxString(message.str()));
263  warning.ShowModal();
264  return;
265  }
266 
267  if (trimmedName != functionUnit_->name()) {
269  functionUnit_->machine()->functionUnitNavigator();
270  for (int i = 0; i < navigator.count(); i++) {
271  FunctionUnit* fu = navigator.item(i);
272  if (trimmedName == fu->name()) {
273  ProDeTextGenerator* prodeTexts =
275  format message =
277  format a_fu =
279  format machine =
281  format fu =
283  message % trimmedName % a_fu.str() % machine.str() % fu.str();
284  WarningDialog warning(
285  this, WxConversion::toWxString(message.str()));
286  warning.ShowModal();
287  return;
288  }
289  }
290  }
291  functionUnit_->setName(trimmedName);
292  EndModal(wxID_OK);
293 }
294 
295 /**
296  * Sets the function unit address space when user changes it.
297  */
298 void
299 FUDialog::onSetAddressSpace(wxCommandEvent&) {
300 
301  string asName =
302  WxConversion::toString(addressSpaceChoice_->GetStringSelection());
303 
305  functionUnit_->setAddressSpace(NULL);
306  } else {
307 
309  functionUnit_->machine()->addressSpaceNavigator();
310 
311  AddressSpace* as = navigator.item(asName);
312  functionUnit_->setAddressSpace(as);
313  }
314 }
315 
316 
317 /**
318  * Creates and shows an empty Function Unit Port Dialog for adding ports.
319  */
320 void
321 FUDialog::onAddPort(wxCommandEvent&) {
322 
323  // Generate name for the new port.
324  int i = 1;
327  while (functionUnit_->hasPort(newName)) {
330  i++;
331  }
332 
333  FUPort* port = new FUPort(
334  newName, ModelConstants::DEFAULT_WIDTH, *functionUnit_, false, false);
335  FUPortDialog portDialog(this, port);
336  if (portDialog.ShowModal() == wxID_CANCEL) {
337  // adding port was cancelled
338  delete port;
339  }
340  updatePortList();
341 }
342 
343 
344 
345 /**
346  * Deletes selected port from the port list.
347  */
348 void
349 FUDialog::onDeletePort(wxCommandEvent&) {
350  FUPort* selected = selectedPort();
351  if (selected == NULL) {
352  return;
353  }
354  assert(selected != NULL);
355  delete selected;
356  updatePortList();
357 }
358 
359 
360 /**
361  * Returns a pointer to the function unit port which is selected.
362  *
363  * @return Pointer to the port selected in the port list.
364  */
365 FUPort*
367  string name = WidgetTools::lcStringSelection(portListCtrl_, 1);
368  if (name == "") {
369  return NULL;
370  }
371  FUPort* port = functionUnit_->operationPort(name);
372  return port;
373 }
374 
375 
376 /**
377  * Handles left mouse button double clicks on the port list.
378  */
379 void
381  wxCommandEvent dummy;
382  onEditPort(dummy);
383 }
384 
385 
386 /**
387  * Handles the 'Edit Port' button event.
388  *
389  * Opens a FUPortDialog with the selected port set.
390  */
391 void
392 FUDialog::onEditPort(wxCommandEvent&) {
393  FUPort* port = selectedPort();
394  if (port == NULL) {
395  return;
396  }
397  FUPortDialog portDialog(this, port);
398  portDialog.ShowModal();
399  updatePortList();
400 }
401 
402 
403 /**
404  * Disables and enables Edit and Delete buttons under the port list.
405  *
406  * If a port is selected, buttons are enabled. If no port is selected the
407  * buttons will be disabled.
408  *
409  * @param event ListEvent, which may have changed the selection.
410  */
411 void
413  if (portListCtrl_->GetSelectedItemCount() != 1) {
414  FindWindow(ID_DELETE_PORT)->Disable();
415  FindWindow(ID_EDIT_PORT)->Disable();
416  return;
417  }
418  FindWindow(ID_DELETE_PORT)->Enable();
419  FindWindow(ID_EDIT_PORT)->Enable();
420 }
421 
422 
423 /**
424  * Creates and shows an empty Function Unit Operation Dialog for
425  * adding operations.
426  *
427  * Not Implemented.
428  */
429 void
430 FUDialog::onAddOperation(wxCommandEvent&) {
431  ObjectState* fu = functionUnit_->saveState();
432 
433  // Generate name for the new operation.
434  int i = 1;
437  while (functionUnit_->hasOperation(newName)) {
440  i++;
441  }
442  HWOperation* operation = NULL;
443  operation = new HWOperation(newName, *functionUnit_);
444 
445  OperationDialog dialog(this, operation);
446  if (dialog.ShowModal() == wxID_OK) {
447  delete fu;
448  } else {
449  functionUnit_->loadState(fu);
450  }
451  updateOperationList();
452 }
453 
454 /**
455  * Event handler for the add operation from opset button.
456  */
457 void
459 
460  try {
461  OpsetDialog opsetDialog(this);
462  if (opsetDialog.ShowModal() != wxID_OK) {
463  return;
464  }
465 
466  HWOperation* operation = opsetDialog.createOperation(*functionUnit_);
467 
468  if (operation == NULL) {
469  return;
470  }
471 
472  OperationDialog operationDialog(this, operation);
473  if (operationDialog.ShowModal() != wxID_OK) {
474  delete operation;
475  }
476 
477  updateOperationList();
478  } catch (Exception & e) {
479  wxString message = WxConversion::toWxString(e.errorMessage());
480  ErrorDialog dialog(this, message);
481  dialog.ShowModal();
482  return;
483  }
484 }
485 
486 /**
487  * Deletes selected operation from the operation list.
488  */
489 void
490 FUDialog::onDeleteOperation(wxCommandEvent&) {
491  string name = WidgetTools::lcStringSelection(operationListCtrl_, 0);
492  if (name == "") {
493  return;
494  }
495  delete functionUnit_->operation(name);
496  updateOperationList();
497 }
498 
499 
500 
501 /**
502  * Handles the 'Edit Operation' button event.
503  *
504  * Opens a FUOperationDialog with the selected operation's attributes set.
505  */
506 void
507 FUDialog::onEditOperation(wxCommandEvent&) {
508 
509  HWOperation* selected = selectedOperation();
510  if (selected == NULL) {
511  // No operation selected.
512  return;
513  }
514 
515  ObjectState* fu = functionUnit_->saveState();
516  OperationDialog dialog(this, selected);
517  if (dialog.ShowModal() == wxID_OK) {
518  delete fu;
519  } else {
520  functionUnit_->loadState(fu);
521  }
522  updateOperationList();
523 }
524 
525 
526 /**
527  * Checks whether name field is empty and disables OK button of the
528  * dialog if it is.
529  */
530 void
531 FUDialog::onName(wxCommandEvent&) {
532  if (!TransferDataFromWindow()) {
533  assert(false);
534  }
535  wxString trimmedName = name_.Trim(false).Trim(true);
536  if (trimmedName == _T("")) {
537  FindWindow(wxID_OK)->Disable();
538  } else {
539  FindWindow(wxID_OK)->Enable();
540  }
541 }
542 
543 
544 /**
545  * Returns pointer to the operation, which is selected on the operation list.
546  *
547  * @return Pointer to the selected operation.
548  */
551  string name = WidgetTools::lcStringSelection(operationListCtrl_, 0);
552  if (name == "") {
553  return NULL;
554  }
555  return functionUnit_->operation(name);
556 }
557 
558 
559 /**
560  * Disables and enables Edit and Delete buttons under the operation list.
561  *
562  * If a operation is selected, buttons are enabled. If no operation is
563  * selected the buttons will be disabled.
564  *
565  * @param event ListEvent, which may have changed the selection.
566  */
567 void
569  if (operationListCtrl_->GetSelectedItemCount() != 1) {
570  FindWindow(ID_DELETE_OPERATION)->Disable();
571  FindWindow(ID_EDIT_OPERATION)->Disable();
572  return;
573  }
574  FindWindow(ID_DELETE_OPERATION)->Enable();
575  FindWindow(ID_EDIT_OPERATION)->Enable();
576 }
577 
578 
579 /**
580  * Updates 'Address Space' choice control.
581  *
582  * Clears all items from the choicer and adds all address spaces plus
583  * an item 'NONE' indicating empty selection.
584  */
585 void
587 
588  addressSpaceChoice_->Clear();
589  addressSpaceChoice_->Append(ProDeConstants::NONE);
590 
592  functionUnit_->machine()->addressSpaceNavigator();
593 
594  // put each address space of the Machine to the control.
595  for (int i = 0; i < navigator.count(); i++) {
596  AddressSpace* as = navigator.item(i);
597  wxString name = WxConversion::toWxString(as->name());
598  addressSpaceChoice_->Append(name);
599  }
600 
601  // set address space selection
602  AddressSpace* as = functionUnit_->addressSpace();
603  if (as != NULL) {
604  wxString name = WxConversion::toWxString(as->name());
605  addressSpaceChoice_->SetStringSelection(name);
606  } else {
607  addressSpaceChoice_->SetStringSelection(ProDeConstants::NONE);
608  }
609 }
610 
611 
612 /**
613  * Updates 'Ports' list control.
614  *
615  * Clears all items from the choicer and adds all ports.
616  */
617 void
619 
620  portListCtrl_->DeleteAllItems();
621 
622  for (int i = 0; i < functionUnit_->portCount(); i++) {
623 
624  FUPort* port = functionUnit_->operationPort(i);
625 
626  bool triggers = port->isTriggering();
627  string width = Conversion::toString(port->width());
628  string name = port->name();
629 
630  // set asterisk symbol in the "T" column if port triggers
631  if (!triggers) {
632  portListCtrl_->InsertItem(i, _T(""), 0);
633  } else {
634  portListCtrl_->InsertItem(i, _T("*"), 0);
635  }
636 
637  portListCtrl_->SetItem(i, 1, WxConversion::toWxString(name));
638  portListCtrl_->SetItem(i, 2, WxConversion::toWxString(width));
639 
640  }
641  wxListEvent dummy;
642  onPortSelection(dummy);
643 }
644 
645 
646 /**
647  * Updates operation list.
648  */
649 void
651 
652  operationListCtrl_->DeleteAllItems();
653 
654  // Operation names are put in a set, which will sort the operation
655  // names automatically.
656  std::set<std::string> operations;
657  for (int i=0; i < functionUnit_->operationCount(); i++) {
658  operations.insert(functionUnit_->operation(i)->name());
659  }
660 
661  std::set<std::string>::reverse_iterator iter = operations.rbegin();
662  for (; iter != operations.rend(); iter++) {
663  wxString name = WxConversion::toWxString(*iter);
664  operationListCtrl_->InsertItem(0, name);
665  }
666 
667  wxListEvent dummy;
668  onOperationSelection(dummy);
669 }
670 
671 
672 /**
673  * Opens a pop-up menu when right mouse button was pressed.
674  *
675  * @param event Information about right mouse click event.
676  */
677 void
678 FUDialog::onPortRightClick(wxListEvent& event) {
679 
680  portListCtrl_->SetItemState(event.GetIndex(), wxLIST_STATE_SELECTED,
681  wxLIST_STATE_SELECTED);
682 
683  wxMenu* contextMenu = new wxMenu();
684 
686  format button = prodeTexts->text(
688  contextMenu->Append(
689  ID_EDIT_PORT, WxConversion::toWxString(button.str()));
690  button = prodeTexts->text(
692  contextMenu->Append(
693  ID_DELETE_PORT, WxConversion::toWxString(button.str()));
694  portListCtrl_->PopupMenu(contextMenu, event.GetPoint());
695 }
696 
697 
698 /**
699  * Opens a pop-up menu when right mouse button was pressed on the
700  * operation list.
701  *
702  * @param event Information about right mouse click event.
703  */
704 void
705 FUDialog::onOperationRightClick(wxListEvent& event) {
706 
707  operationListCtrl_->SetItemState(event.GetIndex(), wxLIST_STATE_SELECTED,
708  wxLIST_STATE_SELECTED);
709 
710  wxMenu* contextMenu = new wxMenu();
711 
713  format button = prodeTexts->text(
715  contextMenu->Append(
716  ID_EDIT_OPERATION, WxConversion::toWxString(button.str()));
717  button = prodeTexts->text(
719  contextMenu->Append(
720  ID_DELETE_OPERATION, WxConversion::toWxString(button.str()));
721  operationListCtrl_->PopupMenu(contextMenu, event.GetPoint());
722 }
723 
724 
725 /**
726  * Handles left mouse button double clicks on the operation list.
727  */
728 void
730  wxCommandEvent dummy;
731  onEditOperation(dummy);
732 }
733 
734 
735 /**
736  * Creates the dialog window contents.
737  *
738  * This method was initially generated with wxDesigner, code will be
739  * cleaned up later.
740  *
741  * @return Main sizer of the created contents.
742  * @param parent The dialog window.
743  * @param call_fit If true, fits the contents inside the dialog.
744  * @param set_sizer If true, sets the main sizer as dialog contents.
745  */
746 wxSizer*
747 FUDialog::createContents(wxWindow* parent, bool call_fit, bool set_sizer) {
748 
749  wxFlexGridSizer *item0 = new wxFlexGridSizer( 2, 0, 10 );
750 
751  wxBoxSizer *item1 = new wxBoxSizer( wxHORIZONTAL );
752 
753  wxStaticText *item2 = new wxStaticText( parent, ID_LABEL_NAME, wxT("Name:"), wxDefaultPosition, wxDefaultSize, 0 );
754  item1->Add( item2, 0, wxALIGN_CENTER|wxALL, 5 );
755 
756  wxTextCtrl *item3 = new wxTextCtrl( parent, ID_NAME, wxT(""), wxDefaultPosition, wxSize(150,-1), 0 );
757  item1->Add( item3, 0, wxALIGN_CENTER|wxALL, 5 );
758 
759  item0->Add( item1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
760 
761  wxBoxSizer *item4 = new wxBoxSizer( wxHORIZONTAL );
762 
763  wxStaticText *item5 = new wxStaticText( parent, ID_LABEL_AS, wxT("Address Space:"), wxDefaultPosition, wxDefaultSize, 0 );
764  item4->Add( item5, 0, wxALIGN_CENTER|wxALL, 5 );
765 
766  wxString *strs6 = (wxString*) NULL;
767  wxChoice *item6 = new wxChoice( parent, ID_ADDRESS_SPACE, wxDefaultPosition, wxSize(150,-1), 0, strs6, 0 );
768  item4->Add( item6, 0, wxALIGN_CENTER|wxALL, 5 );
769 
770  item0->Add( item4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
771 
772  wxStaticBox *item8 = new wxStaticBox( parent, -1, wxT("Operations:") );
773  wxStaticBoxSizer *item7 = new wxStaticBoxSizer( item8, wxVERTICAL );
774  operationsSizer_ = item7;
775 
776  wxListCtrl *item9 = new wxListCtrl( parent, ID_OPERATION_LIST, wxDefaultPosition, wxSize(160,200), wxLC_REPORT|wxSUNKEN_BORDER );
777  item7->Add( item9, 0, wxGROW|wxALL, 5 );
778 
779  wxBoxSizer *item10 = new wxBoxSizer( wxHORIZONTAL );
780 
781  wxButton *item11 = new wxButton( parent, ID_ADD_OPERATION, wxT("Add..."), wxDefaultPosition, wxDefaultSize, 0 );
782  item10->Add( item11, 0, wxALIGN_CENTER|wxALL, 5 );
783 
784  wxButton *item12 = new wxButton( parent, ID_EDIT_OPERATION, wxT("Edit..."), wxDefaultPosition, wxDefaultSize, 0 );
785  item10->Add( item12, 0, wxALIGN_CENTER|wxALL, 5 );
786 
787  wxButton *item13 = new wxButton( parent, ID_DELETE_OPERATION, wxT("Delete"), wxDefaultPosition, wxDefaultSize, 0 );
788  item10->Add( item13, 0, wxALIGN_CENTER|wxALL, 5 );
789 
790  item7->Add( item10, 0, wxALIGN_CENTER, 5 );
791 
792  wxButton *item14 = new wxButton( parent, ID_ADD_OPERATION_FROM_OPSET, wxT(" Add from Opset... "), wxDefaultPosition, wxDefaultSize, 0 );
793  item7->Add( item14, 0, wxALL, 5 );
794 
795  item0->Add( item7, 0, wxGROW|wxALL, 5 );
796 
797  wxStaticBox *item16 = new wxStaticBox( parent, -1, wxT("Ports:") );
798  wxStaticBoxSizer *item15 = new wxStaticBoxSizer( item16, wxVERTICAL );
799  portsSizer_ = item15;
800 
801  wxListCtrl *item17 = new wxListCtrl( parent, ID_PORT_LIST, wxDefaultPosition, wxSize(160,200), wxLC_REPORT|wxSUNKEN_BORDER );
802  item15->Add( item17, 0, wxGROW|wxALL, 5 );
803 
804  wxBoxSizer *item18 = new wxBoxSizer( wxHORIZONTAL );
805 
806  wxButton *item19 = new wxButton( parent, ID_ADD_PORT, wxT("Add..."), wxDefaultPosition, wxDefaultSize, 0 );
807  item18->Add( item19, 0, wxALIGN_CENTER|wxALL, 5 );
808 
809  wxButton *item20 = new wxButton( parent, ID_EDIT_PORT, wxT("Edit..."), wxDefaultPosition, wxDefaultSize, 0 );
810  item18->Add( item20, 0, wxALIGN_CENTER|wxALL, 5 );
811 
812  wxButton *item21 = new wxButton( parent, ID_DELETE_PORT, wxT("Delete"), wxDefaultPosition, wxDefaultSize, 0 );
813  item18->Add( item21, 0, wxALIGN_CENTER|wxALL, 5 );
814 
815  item15->Add( item18, 0, wxALIGN_CENTER|wxALL, 5 );
816 
817  item0->Add( item15, 0, wxGROW|wxALL, 5 );
818 
819  wxBoxSizer *item25 = new wxBoxSizer( wxHORIZONTAL );
820 
821  wxButton *item26 = new wxButton( parent, ID_HELP, wxT("&Help"), wxDefaultPosition, wxDefaultSize, 0 );
822  item25->Add( item26, 0, wxALIGN_CENTER|wxALL, 5 );
823 
824  item0->Add( item25, 0, wxALL, 5 );
825 
826  wxBoxSizer *item27 = new wxBoxSizer( wxHORIZONTAL );
827 
828  wxButton *item28 = new wxButton( parent, wxID_OK, wxT("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
829  item27->Add( item28, 0, wxALIGN_CENTER|wxALL, 5 );
830 
831  wxButton *item29 = new wxButton( parent, wxID_CANCEL, wxT("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
832  item27->Add( item29, 0, wxALIGN_CENTER|wxALL, 5 );
833 
834  item0->Add( item27, 0, wxALL, 5 );
835 
836  if (set_sizer)
837  {
838  parent->SetSizer( item0 );
839  if (call_fit)
840  item0->SetSizeHints( parent );
841  }
842 
843  return item0;
844 }
FUDialog::onPortSelection
void onPortSelection(wxListEvent &event)
Definition: FUDialog.cc:412
WarningDialog
Definition: WarningDialog.hh:42
FUDialog
Definition: FUDialog.hh:48
WxConversion::toWxString
static wxString toWxString(const std::string &source)
FUDialog::onActivatePort
void onActivatePort(wxListEvent &event)
Definition: FUDialog.cc:380
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
FUDialog.hh
EVT_LIST_ITEM_ACTIVATED
FUImplementationDialog::onAddExternalPort FUImplementationDialog::onDeleteExternalPort FUImplementationDialog::onArchPortSelection FUImplementationDialog::onArchPortActivation FUImplementationDialog::onExternalPortActivation FUImplementationDialog::onParameterSelection EVT_LIST_ITEM_ACTIVATED(ID_PARAMETER_LIST, FUImplementationDialog::onParameterActivation) EVT_LIST_ITEM_DESELECTED(ID_PARAMETER_LIST
ProDeTextGenerator::TXT_LABEL_BUTTON_DELETE
@ TXT_LABEL_BUTTON_DELETE
Label for &Delete button.
Definition: ProDeTextGenerator.hh:95
FUDialog::onEditPort
void onEditPort(wxCommandEvent &event)
Definition: FUDialog.cc:392
FUPortDialog.hh
ProDeTextGenerator::TXT_FU_DIALOG_TITLE
@ TXT_FU_DIALOG_TITLE
Function unit dialog title.
Definition: ProDeTextGenerator.hh:188
machine
TTAMachine::Machine * machine
the architecture definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:59
TTAMachine::HWOperation
Definition: HWOperation.hh:52
TTAMachine::AddressSpace
Definition: AddressSpace.hh:51
FUDialog::selectedOperation
TTAMachine::HWOperation * selectedOperation()
Definition: FUDialog.cc:550
FUDialog::updatePortList
void updatePortList()
Definition: FUDialog.cc:618
WidgetTools::setLabel
static void setLabel(Texts::TextGenerator *generator, wxWindow *widget, int textID)
Definition: WidgetTools.cc:92
GUITextGenerator::instance
static GUITextGenerator * instance()
Definition: GUITextGenerator.cc:67
FUDialog::onSetAddressSpace
void onSetAddressSpace(wxCommandEvent &event)
Definition: FUDialog.cc:299
AddressSpace.hh
FUDialog::onPortRightClick
void onPortRightClick(wxListEvent &event)
Definition: FUDialog.cc:678
GUITextGenerator
Definition: GUITextGenerator.hh:46
ObjectState
Definition: ObjectState.hh:59
GUITextGenerator::TXT_BUTTON_HELP
@ TXT_BUTTON_HELP
Label for help button.
Definition: GUITextGenerator.hh:60
WidgetTools.hh
FUDialog::setTexts
void setTexts()
Definition: FUDialog.cc:149
FUDialog::onOperationRightClick
void onOperationRightClick(wxListEvent &event)
Definition: FUDialog.cc:705
FindWindow
Definition: FindWindow.hh:49
ProDeTextGenerator::COMP_A_FUNCTION_UNIT
@ COMP_A_FUNCTION_UNIT
Name for FU (w/ article).
Definition: ProDeTextGenerator.hh:264
ProDeTextGenerator::TXT_COLUMN_WIDTH
@ TXT_COLUMN_WIDTH
Label for width column in a list.
Definition: ProDeTextGenerator.hh:109
ProDeConstants::COMP_NEW_NAME_PREFIX_PORT
static const std::string COMP_NEW_NAME_PREFIX_PORT
Prefix for new port names.
Definition: ProDeConstants.hh:373
TTAMachine::Machine::Navigator::count
int count() const
Texts::TextGenerator::text
virtual boost::format text(int textId)
Definition: TextGenerator.cc:94
TTAMachine::FUPort::isTriggering
virtual bool isTriggering() const
Definition: FUPort.cc:182
FUDialog::updateAddressSpaceChoice
void updateAddressSpaceChoice()
Definition: FUDialog.cc:586
ProDeTextGenerator.hh
Conversion::toString
static std::string toString(const T &source)
ProDeTextGenerator::TXT_LABEL_BUTTON_EDIT
@ TXT_LABEL_BUTTON_EDIT
Label for &Edit... button.
Definition: ProDeTextGenerator.hh:96
ProDeTextGenerator
Definition: ProDeTextGenerator.hh:49
ProDeTextGenerator::MSG_ERROR_ILLEGAL_NAME
@ MSG_ERROR_ILLEGAL_NAME
Error: Illegal component name.
Definition: ProDeTextGenerator.hh:223
ProDeTextGenerator::MSG_ERROR_SAME_NAME
@ MSG_ERROR_SAME_NAME
Error: Same name exists.
Definition: ProDeTextGenerator.hh:229
ProDeTextGenerator::COMP_FUNCTION_UNIT
@ COMP_FUNCTION_UNIT
Name for FU (w/o article).
Definition: ProDeTextGenerator.hh:263
assert
#define assert(condition)
Definition: Application.hh:86
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
ProDeConstants::COMP_NEW_NAME_PREFIX_OPERATION
static const std::string COMP_NEW_NAME_PREFIX_OPERATION
Prefix for new operation names.
Definition: ProDeConstants.hh:377
TTAMachine::FUPort
Definition: FUPort.hh:46
FUDialog::onEditOperation
void onEditOperation(wxCommandEvent &event)
Definition: FUDialog.cc:507
FUDialog::onAddOperation
void onAddOperation(wxCommandEvent &event)
Definition: FUDialog.cc:430
FUDialog::onAddOperationFromOpset
void onAddOperationFromOpset(wxCommandEvent &event)
Definition: FUDialog.cc:458
GUITextGenerator::TXT_BUTTON_CANCEL
@ TXT_BUTTON_CANCEL
Label for cancel button.
Definition: GUITextGenerator.hh:55
ModelConstants::DEFAULT_WIDTH
static const int DEFAULT_WIDTH
Default bit width.
Definition: ModelConstants.hh:46
HWOperation.hh
OpsetDialog.hh
ErrorDialog
Definition: ErrorDialog.hh:42
OperationDialog.hh
WarningDialog.hh
FUDialog::~FUDialog
virtual ~FUDialog()
Definition: FUDialog.cc:141
ErrorDialog.hh
Conversion.hh
dummy
SimValue dummy(32)
a dummy simvalue which is given for operands that are not bound
InformationDialog.hh
Application.hh
ProDeTextGenerator::TXT_COLUMN_TRIGGERS
@ TXT_COLUMN_TRIGGERS
Label for T column in a list.
Definition: ProDeTextGenerator.hh:119
WidgetTools::lcStringSelection
static std::string lcStringSelection(wxListCtrl *list, int column)
Definition: WidgetTools.cc:108
Model.hh
ObjectState.hh
ProDeTextGenerator::TXT_LABEL_NAME
@ TXT_LABEL_NAME
Label for component name widget.
Definition: ProDeTextGenerator.hh:56
FUDialog::TransferDataToWindow
virtual bool TransferDataToWindow()
Definition: FUDialog.cc:228
ModelConstants.hh
Machine.hh
Exception
Definition: Exception.hh:54
ProDeTextGenerator::TXT_FU_PORTS_BOX
@ TXT_FU_PORTS_BOX
Ports box title.
Definition: ProDeTextGenerator.hh:189
MachineTester::isValidComponentName
static bool isValidComponentName(const std::string &name)
Definition: MachineTester.cc:312
ProDeTextGenerator::TXT_FU_OPERATIONS_BOX
@ TXT_FU_OPERATIONS_BOX
Operations box title.
Definition: ProDeTextGenerator.hh:190
EVT_LIST_ITEM_SELECTED
FUImplementationDialog::onAddExternalPort FUImplementationDialog::onDeleteExternalPort FUImplementationDialog::onArchPortSelection FUImplementationDialog::onArchPortActivation EVT_LIST_ITEM_SELECTED(ID_EXTERNAL_PORT_LIST, FUImplementationDialog::onExternalPortSelection) EVT_LIST_ITEM_ACTIVATED(ID_EXTERNAL_PORT_LIST
FUDialog::onOK
void onOK(wxCommandEvent &event)
Definition: FUDialog.cc:243
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
GUITextGenerator::TXT_BUTTON_DELETE
@ TXT_BUTTON_DELETE
Label for delete button.
Definition: GUITextGenerator.hh:56
ProDeConstants.hh
GUITextGenerator.hh
FUDialog::onName
void onName(wxCommandEvent &event)
Definition: FUDialog.cc:531
MachineTester.hh
FUDialog::createContents
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
Definition: FUDialog.cc:747
FUDialog::onOperationSelection
void onOperationSelection(wxListEvent &event)
Definition: FUDialog.cc:568
ProDeTextGenerator::instance
static ProDeTextGenerator * instance()
Definition: ProDeTextGenerator.cc:382
FUDialog::onActivateOperation
void onActivateOperation(wxListEvent &event)
Definition: FUDialog.cc:729
EVT_LIST_ITEM_DESELECTED
FUImplementationDialog::onAddExternalPort FUImplementationDialog::onDeleteExternalPort FUImplementationDialog::onArchPortSelection EVT_LIST_ITEM_DESELECTED(ID_ARCH_PORT_LIST, FUImplementationDialog::onArchPortSelection) EVT_LIST_ITEM_ACTIVATED(ID_ARCH_PORT_LIST
EVT_BUTTON
EVT_BUTTON(ID_EDIT_ARCH_PORT, FUImplementationDialog::onEditArchitecturePort) EVT_BUTTON(ID_ADD_EXTERNAL_PORT
GUITextGenerator::TXT_BUTTON_ADD_DIALOG
@ TXT_BUTTON_ADD_DIALOG
Label for add button (with trailing ...).
Definition: GUITextGenerator.hh:54
GUITextGenerator::TXT_BUTTON_EDIT_DIALOG
@ TXT_BUTTON_EDIT_DIALOG
Label for edit button (with trailing ...).
Definition: GUITextGenerator.hh:58
FUDialog::onDeletePort
void onDeletePort(wxCommandEvent &event)
Definition: FUDialog.cc:349
TTAMachine::Port::name
virtual std::string name() const
Definition: Port.cc:141
FUPort.hh
ProDeTextGenerator::COMP_MACHINE
@ COMP_MACHINE
Text for machine description.
Definition: ProDeTextGenerator.hh:252
FUDialog::onAddPort
void onAddPort(wxCommandEvent &event)
Definition: FUDialog.cc:321
WxConversion.hh
TTAMachine::Machine::Navigator::item
ComponentType * item(int index) const
WidgetTools::setWidgetLabel
static void setWidgetLabel(wxWindow *widget, std::string text)
Definition: WidgetTools.cc:52
InformationDialog
Definition: InformationDialog.hh:42
OpsetDialog::createOperation
TTAMachine::HWOperation * createOperation(TTAMachine::FunctionUnit &fu)
Definition: OpsetDialog.cc:212
FUDialog::onDeleteOperation
void onDeleteOperation(wxCommandEvent &event)
Definition: FUDialog.cc:490
TTAMachine
Definition: Assembler.hh:48
ProDeConstants::NONE
static const wxString NONE
Constant for "None".
Definition: ProDeConstants.hh:56
WxConversion::toString
static std::string toString(const wxString &source)
ProDeTextGenerator::TXT_COLUMN_NAME
@ TXT_COLUMN_NAME
Label for name column in a list.
Definition: ProDeTextGenerator.hh:105
FUPortDialog
Definition: FUPortDialog.hh:44
TTAMachine::Machine::Navigator
Definition: Machine.hh:186
OpsetDialog
Definition: OpsetDialog.hh:50
UserManualCmd.hh
FUDialog::selectedPort
TTAMachine::FUPort * selectedPort()
Definition: FUDialog.cc:366
END_EVENT_TABLE
END_EVENT_TABLE() using namespace IDF
OperationDialog
Definition: OperationDialog.hh:49
ProDeTextGenerator::TXT_LABEL_ADDRESS_SPACE
@ TXT_LABEL_ADDRESS_SPACE
Label for address spave selector.
Definition: ProDeTextGenerator.hh:59
TTAMachine::BaseFUPort::width
virtual int width() const
Definition: BaseFUPort.cc:109
FunctionUnit.hh
FUDialog::updateOperationList
void updateOperationList()
Definition: FUDialog.cc:650
GUITextGenerator::TXT_BUTTON_OK
@ TXT_BUTTON_OK
Label for OK button.
Definition: GUITextGenerator.hh:59