34 #include <wx/statline.h>
35 #include <wx/valgen.h>
45 #if wxCHECK_VERSION(3, 0, 0)
46 #define wxOPEN wxFD_OPEN
47 #define wxFILE_MUST_EXIST wxFD_FILE_MUST_EXIST
69 createContents(
this,
true,
true);
72 format_ = file_.format();
74 FindWindow(ID_PATH)->SetValidator(wxTextValidator(wxFILTER_ASCII, &path_));
75 FindWindow(ID_FORMAT)->SetValidator(wxGenericValidator(&format_));
77 TransferDataToWindow();
95 const HDBManager& manager = *wxGetApp().mainFrame().hdbManager();
96 std::string hdbPath = manager.
fileName();
101 this, _T(
"Choose a file"), defaultDir, _T(
""),
102 _T(
"VHDL files (*.vhd;*.vhdl)|*.vhd;*.vhdl|Verilog files (*.v)|*.v| All files (*.*)|*.*"),
103 (wxOPEN | wxFILE_MUST_EXIST));
105 wxChoice *hdl_type = (wxChoice *)
FindWindow(ID_FORMAT);
106 dialog.SetFilterIndex(hdl_type->GetCurrentSelection());
108 if (dialog.ShowModal() == wxID_OK) {
114 for (std::vector<std::string>::iterator it = vhdlPaths.begin();
115 it != vhdlPaths.end(); ++it) {
117 if (vhdlPath.substr(0, (*it).length()) == *it) {
119 filename = filename.substr((*it).length() + 1);
125 TransferDataToWindow();
136 TransferDataFromWindow();
138 path_ = path_.Trim(
true).Trim(
false);
140 if (path_.IsEmpty()) {
141 wxString message = _T(
"Path field must not be empty.");
148 const HDBManager& manager = *wxGetApp().mainFrame().hdbManager();
150 std::string hdbPath = manager.
fileName();
151 std::vector<std::string> vhdlPaths =
154 std::string filename =
158 for (std::vector<std::string>::iterator it = vhdlPaths.begin();
159 it != vhdlPaths.end(); ++it) {
160 if (filename.substr(0, (*it).length()) == *it) {
162 << filename <<
" in search path " << *it << std::endl;
163 filename = filename.substr((*it).length() + 1);
169 wxString message = _T(
"File not found from the VHDL search paths.");
186 wxWindow *parent,
bool call_fit,
bool set_sizer) {
188 wxBoxSizer *item0 =
new wxBoxSizer( wxVERTICAL );
190 wxFlexGridSizer *item1 =
new wxFlexGridSizer( 3, 0, 0 );
192 wxStaticText *item2 =
new wxStaticText( parent, ID_LABEL_PATH, wxT(
"Path:"), wxDefaultPosition, wxDefaultSize, 0 );
193 item1->Add( item2, 0, wxALIGN_RIGHT|wxALL, 5 );
195 wxTextCtrl *item3 =
new wxTextCtrl( parent, ID_PATH, wxT(
""), wxDefaultPosition, wxSize(200,-1), 0 );
196 item1->Add( item3, 0, wxALIGN_CENTER|wxALL, 5 );
198 wxButton *item4 =
new wxButton( parent, ID_BROWSE, wxT(
"Browse..."), wxDefaultPosition, wxDefaultSize, 0 );
199 item1->Add( item4, 0, wxALIGN_CENTER|wxALL, 5 );
201 wxStaticText *item5 =
new wxStaticText( parent, ID_LABEL_FORMAT, wxT(
"Format:"), wxDefaultPosition, wxDefaultSize, 0 );
202 item1->Add( item5, 0, wxALIGN_RIGHT|wxALL, 5 );
209 wxChoice *item6 =
new wxChoice( parent, ID_FORMAT, wxDefaultPosition, wxSize(100,-1), 2, strs6, 0 );
210 item1->Add( item6, 0, wxGROW|wxALL, 5 );
212 item0->Add( item1, 0, wxALIGN_CENTER|wxALL, 5 );
214 wxStaticLine *item7 =
new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
215 item0->Add( item7, 0, wxGROW|wxALL, 5 );
217 wxBoxSizer *item8 =
new wxBoxSizer( wxHORIZONTAL );
219 wxButton *item9 =
new wxButton( parent, wxID_CANCEL, wxT(
"&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
220 item8->Add( item9, 0, wxALL, 5 );
222 wxButton *item10 =
new wxButton( parent, wxID_OK, wxT(
"&OK"), wxDefaultPosition, wxDefaultSize, 0 );
223 item8->Add( item10, 0, wxALIGN_CENTER|wxALL, 5 );
225 item0->Add( item8, 0, wxALIGN_CENTER|wxALL, 5 );
229 parent->SetSizer( item0 );
231 item0->SetSizeHints( parent );