33#include <boost/format.hpp>
34#include <wx/statline.h>
35#include <wx/listctrl.h>
37#include <wx/imaglist.h>
54#if !wxCHECK_VERSION(3, 0, 0)
81 int sortColumn = (int)sortData;
83 if (sortColumn == 0) {
85 }
else if (sortColumn == 1) {
87 }
else if (sortColumn == 2) {
89 }
else if (sortColumn == 3) {
91 }
else if (sortColumn == 4) {
93 }
else if (sortColumn == 5) {
95 }
else if (sortColumn == 6) {
97 }
else if (sortColumn == 7) {
99 }
else if (sortColumn == 8) {
111 int sortColumn = (int)sortData;
113 if (sortColumn == 0) {
115 }
else if (sortColumn == 1) {
117 }
else if (sortColumn == 2) {
119 }
else if (sortColumn == 3) {
121 }
else if (sortColumn == 4) {
123 }
else if (sortColumn == 5) {
125 }
else if (sortColumn == 6) {
127 }
else if (sortColumn == 7) {
129 }
else if (sortColumn == 8) {
146 parent, -1, _T(
"HDB Register Files"), wxDefaultPosition, wxDefaultSize,
147 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
148 model_(model), sortColumn_(0), sortASC_(true) {
155 list_->InsertColumn(0, _T(
"Width"), wxLIST_FORMAT_LEFT, wxLIST_AUTOSIZE);
156 list_->InsertColumn(1, _T(
"Size"), wxLIST_FORMAT_LEFT, wxLIST_AUTOSIZE);
157 list_->InsertColumn(2, _T(
"Read ports"), wxLIST_FORMAT_LEFT, 100);
158 list_->InsertColumn(3, _T(
"Write ports"), wxLIST_FORMAT_LEFT, 100);
159 list_->InsertColumn(4, _T(
"Bidir ports"), wxLIST_FORMAT_LEFT, 100);
160 list_->InsertColumn(5, _T(
"Max Reads"), wxLIST_FORMAT_LEFT, 100);
161 list_->InsertColumn(6, _T(
"Max RW"), wxLIST_FORMAT_LEFT, 100);
162 list_->InsertColumn(7, _T(
"ID"), wxLIST_FORMAT_LEFT, wxLIST_AUTOSIZE);
163 list_->InsertColumn(8, _T(
"HDB"), wxLIST_FORMAT_LEFT, wxLIST_AUTOSIZE);
168 wxImageList* imageList =
new wxImageList(13, 17);
169 imageList->Add(wxIcon(
171 imageList->Add(wxIcon(
173 list_->SetImageList(imageList, wxIMAGE_LIST_SMALL);
196 list_->DeleteAllItems();
201 for (
int i = 0; i < registry.
hdbCount(); i++) {
205 wxString errorMessage;
209 errorMessage.Append(_T(
"\n"));
215 wxString message = _T(
"No HDBs found in HDB search paths.");
220 list_->SetColumnWidth(8, wxLIST_AUTOSIZE);
221 return wxDialog::TransferDataToWindow();
233 std::string path = manager.
fileName();
236 std::set<RowID>::iterator iter = rfArchIDs.begin();
240 for (; iter != rfArchIDs.end(); iter++) {
249 std::pair<int, RFArchitecture*>(
list_->GetItemCount(), arch));
254 list_->InsertItem(0, _T(
"param"));
261 list_->SetItem(0, 1, _T(
"param"));
282 lid->
id =
list_->GetItemCount() - 1;
283 list_->SetItemData(0, (
long)lid);
297 if (
list_->GetSelectedItemCount() == 1) {
312 item =
list_->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
313 if ( item == -1 )
return;
326 size = arch->
width();
337 string rfName = name;
388 wxWindow *parent,
bool call_fit,
bool set_sizer) {
390 wxFlexGridSizer *item0 =
new wxFlexGridSizer( 1, 0, 0 );
391 item0->AddGrowableCol( 0 );
392 item0->AddGrowableRow( 0 );
394 wxListCtrl *item1 =
new wxListCtrl( parent,
ID_LIST, wxDefaultPosition, wxSize(160,120), wxLC_REPORT|wxSUNKEN_BORDER );
395 item0->Add( item1, 0, wxGROW|wxALL, 5 );
397 wxButton *item2 =
new wxButton( parent,
ID_ADD, wxT(
"&Add"), wxDefaultPosition, wxDefaultSize, 0 );
398 item0->Add( item2, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
400 wxStaticLine *item3 =
new wxStaticLine( parent,
ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
401 item0->Add( item3, 0, wxGROW|wxALL, 5 );
403 wxButton *item4 =
new wxButton( parent,
ID_CLOSE, wxT(
"&Close"), wxDefaultPosition, wxDefaultSize, 0 );
404 item0->Add( item4, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
407 parent->SetSizer( item0 );
409 item0->SetSizeHints( parent );
423 int clickedColumn =
event.GetColumn();
452 item.SetMask(wxLIST_MASK_IMAGE);
453 item.SetImage(image);
454 list_->SetColumn(col, item);
int wxCALLBACK RFListCompareDESC(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData)
int wxCALLBACK RFListCompareASC(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData)
END_EVENT_TABLE() using namespace IDF
TTAMachine::Machine * machine
the architecture definition of the estimated processor
FUImplementationDialog::onAddExternalPort FUImplementationDialog::onDeleteExternalPort FUImplementationDialog::onArchPortSelection EVT_LIST_ITEM_DESELECTED(ID_ARCH_PORT_LIST, FUImplementationDialog::onArchPortSelection) EVT_LIST_ITEM_ACTIVATED(ID_ARCH_PORT_LIST
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
EVT_BUTTON(ID_EDIT_ARCH_PORT, FUImplementationDialog::onEditArchitecturePort) EVT_BUTTON(ID_ADD_EXTERNAL_PORT
const int DEFAULT_WIDTH
Default window width.
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
bool loadHDB(const HDB::HDBManager &manager)
AddRFFromHDBDialog(wxWindow *parent, Model *model)
void onColumnClick(wxListEvent &event)
void onAdd(wxCommandEvent &event)
static const int DEFAULT_SIZE
Default size for the rf, if the size is parameterized in the HDB.
static const int DEFAULT_WIDTH
Default bit width for the rf, if the size is parameterized in the HDB.
void onClose(wxCommandEvent &event)
wxListCtrl * list_
Immediate slot list widget.
void setColumnImage(int col, int image)
std::map< int, HDB::RFArchitecture * > rfArchitectures_
Map of rf architectures displayed in the dialog list.
Model * model_
Model of the current adf file.
virtual ~AddRFFromHDBDialog()
virtual bool TransferDataToWindow()
void onListSelectionChange(wxListEvent &event)
static std::string toString(const T &source)
static std::string iconDirPath()
static const std::string DIRECTORY_SEPARATOR
std::set< RowID > rfArchitectureIDs() const
std::string fileName() const
virtual RFArchitecture * rfArchitectureByID(RowID id) const
static HDBRegistry & instance()
CachedHDBManager & hdb(const std::string fileName)
void loadFromSearchPaths()
std::string hdbErrorMessage(unsigned int index)
int readPortCount() const
bool hasParameterizedWidth() const
int writePortCount() const
int bidirPortCount() const
bool zeroRegister() const
bool hasParameterizedSize() const
void notifyObservers(bool modified=true)
TTAMachine::Machine * getMachine()
static const std::string ICON_SORT_DESC
Icon location for descending sort.
static const std::string ICON_SORT_ASC
Icon location for ascending sort.
bool hasItem(const std::string &name) const
virtual RegisterFileNavigator registerFileNavigator() const
virtual void addRegisterFile(RegisterFile &unit)
@ NORMAL
Used for general register allocation.
static wxString toWxString(const std::string &source)