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)
84 int sortColumn = (int)sortData;
86 if (sortColumn == 0) {
88 }
else if (sortColumn == 1) {
90 }
else if (sortColumn == 2) {
92 }
else if (sortColumn == 3) {
94 }
else if (sortColumn == 4) {
96 }
else if (sortColumn == 5) {
108 int sortColumn = (int)sortData;
110 if (sortColumn == 0) {
112 }
else if (sortColumn == 1) {
114 }
else if (sortColumn == 2) {
116 }
else if (sortColumn == 3) {
118 }
else if (sortColumn == 4) {
120 }
else if (sortColumn == 5) {
137 parent, -1, _T(
"HDB Immediate Units"),
138 wxDefaultPosition, wxDefaultSize,
139 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
140 model_(model), sortColumn_(0), sortASC_(true) {
147 list_->InsertColumn(0, _T(
"Width"), wxLIST_FORMAT_LEFT, wxLIST_AUTOSIZE);
148 list_->InsertColumn(1, _T(
"Size"), wxLIST_FORMAT_LEFT, wxLIST_AUTOSIZE);
149 list_->InsertColumn(2, _T(
"Read ports"), wxLIST_FORMAT_LEFT, 100);
152 list_->InsertColumn(3, _T(
"Latency"), wxLIST_FORMAT_LEFT, wxLIST_AUTOSIZE);
153 list_->InsertColumn(4, _T(
"ID"), wxLIST_FORMAT_LEFT, wxLIST_AUTOSIZE);
154 list_->InsertColumn(5, _T(
"HDB"), wxLIST_FORMAT_LEFT, wxLIST_AUTOSIZE);
159 wxImageList* imageList =
new wxImageList(13, 17);
160 imageList->Add(wxIcon(
162 imageList->Add(wxIcon(
164 list_->SetImageList(imageList, wxIMAGE_LIST_SMALL);
188 list_->DeleteAllItems();
192 std::vector<string>::const_iterator hdbIter = hdbPaths.begin();
195 bool hdbsFound =
false;
198 for(; hdbIter != hdbPaths.end(); hdbIter++) {
202 paths.Append(hdbPath);
203 paths.Append(_T(
"\n"));
206 if (dir.Exists(hdbPath) &&
217 }
while (dir.GetNext(&file));
224 wxString message = _T(
"No HDBs found in HDB search paths:\n");
225 message.Append(paths);
230 list_->SetColumnWidth(5, wxLIST_AUTOSIZE);
231 return wxDialog::TransferDataToWindow();
248 wxString message = _T(
"Unable to open HDB '");
250 message.Append(_T(
"':'"));
258 std::set<RowID>::iterator iter = rfArchIDs.begin();
262 for (; iter != rfArchIDs.end(); iter++) {
276 std::pair<int, RFArchitecture*>(
list_->GetItemCount(), arch));
281 list_->InsertItem(0, _T(
"param"));
288 list_->SetItem(0, 1, _T(
"param"));
302 lid->
id =
list_->GetItemCount() - 1;
303 list_->SetItemData(0, (
long)lid);
318 if (
list_->GetSelectedItemCount() == 1) {
333 item =
list_->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
334 if ( item == -1 )
return;
348 size = arch->
width();
359 string iuName = name;
403 wxWindow *parent,
bool call_fit,
bool set_sizer) {
405 wxFlexGridSizer *item0 =
new wxFlexGridSizer( 1, 0, 0 );
406 item0->AddGrowableCol( 0 );
407 item0->AddGrowableRow( 0 );
409 wxListCtrl *item1 =
new wxListCtrl( parent,
ID_LIST, wxDefaultPosition, wxSize(160,120), wxLC_REPORT|wxSUNKEN_BORDER );
410 item0->Add( item1, 0, wxGROW|wxALL, 5 );
412 wxButton *item2 =
new wxButton( parent,
ID_ADD, wxT(
"&Add"), wxDefaultPosition, wxDefaultSize, 0 );
413 item0->Add( item2, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
415 wxStaticLine *item3 =
new wxStaticLine( parent,
ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
416 item0->Add( item3, 0, wxGROW|wxALL, 5 );
418 wxButton *item4 =
new wxButton( parent,
ID_CLOSE, wxT(
"&Close"), wxDefaultPosition, wxDefaultSize, 0 );
419 item0->Add( item4, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
422 parent->SetSizer( item0 );
424 item0->SetSizeHints( parent );
438 int clickedColumn =
event.GetColumn();
467 item.SetMask(wxLIST_MASK_IMAGE);
468 item.SetImage(image);
469 list_->SetColumn(col, item);
int wxCALLBACK IUListCompareASC(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData)
int wxCALLBACK IUListCompareDESC(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.
AddIUFromHDBDialog(wxWindow *parent, Model *model)
static const wxString HDB_FILE_FILTER
File filter for HDB files.
void setColumnImage(int col, int image)
virtual bool TransferDataToWindow()
wxSizer * createContents(wxWindow *parent, bool call_fit, bool set_sizer)
void onColumnClick(wxListEvent &event)
void onClose(wxCommandEvent &event)
static const int DEFAULT_SIZE
Default size for the IU, if the size is parameterized in the HDB.
bool loadHDB(const std::string &path)
void onListSelectionChange(wxListEvent &event)
std::map< int, HDB::RFArchitecture * > iuArchitectures_
Map of iu architectures displayed in the dialog list.
static const int DEFAULT_WIDTH
Default width for the IU, if the size is parameterized in the HDB.
static const TTAMachine::Machine::Extension DEFAULT_EXTENSION_MODE
Default extension mode for the immediate unit.
void onAdd(wxCommandEvent &event)
Model * model_
Model of the current adf file.
virtual ~AddIUFromHDBDialog()
wxListCtrl * list_
Immediate slot list widget.
static std::string toString(const T &source)
static std::vector< std::string > hdbPaths(bool libraryPathsOnly=false)
static std::string iconDirPath()
std::string errorMessage() const
static const std::string DIRECTORY_SEPARATOR
std::set< RowID > rfArchitectureIDs() const
virtual RFArchitecture * rfArchitectureByID(RowID id) const
static HDBRegistry & instance()
CachedHDBManager & hdb(const std::string fileName)
int readPortCount() const
bool hasParameterizedWidth() const
int writePortCount() const
int bidirPortCount() 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 ImmediateUnitNavigator immediateUnitNavigator() const
virtual void addImmediateUnit(ImmediateUnit &unit)
static wxString toWxString(const std::string &source)
static std::string toString(const wxString &source)