37 #include <wx/checklst.h>
38 #include <wx/statline.h>
39 #include <wx/valgen.h>
64 wxDialog(parent,
id, _T("Register File Port")),
65 port_(port), rf_(rf), depList_(NULL) {
82 createContents(
this,
true,
true);
84 depList_ =
dynamic_cast<wxCheckListBox*
>(
90 direction_ = port_.direction();
92 FindWindow(ID_NAME)->SetValidator(wxTextValidator(wxFILTER_ASCII, &name_));
94 wxTextValidator(wxFILTER_ASCII, &widthFormula_));
95 FindWindow(ID_DIRECTION)->SetValidator(wxGenericValidator(&direction_));
97 wxTextValidator(wxFILTER_ASCII, &description_));
100 for (
int i = 0; i < rf_.parameterCount(); i++) {
101 string parameter = rf_.parameter(i).name;
104 for (
int dep = 0; dep < port_.parameterDependencyCount(); dep++) {
105 if (port_.parameterDependency(dep) == parameter) {
119 TransferDataFromWindow();
121 name_ = name_.Trim(
true).Trim(
false);
122 widthFormula_ = widthFormula_.Trim(
true).Trim(
false);
123 description_ = description_.Trim(
true).Trim(
false);
125 if (name_.IsEmpty()) {
126 wxString message = _T(
"Name field must not be empty.");
132 if (widthFormula_.IsEmpty()) {
134 _T(
"Width formula field must not be empty.");
144 if (direction_ == 0) {
145 port_.setDirection(
IN);
146 }
else if (direction_ == 1) {
147 port_.setDirection(
OUT);
148 }
else if (direction_ == 2) {
149 port_.setDirection(
BIDIR);
154 for (
int i = 0; i < rf_.parameterCount(); i++) {
156 if (depList_->IsChecked(i)) {
157 port_.setParameterDependency(parameter);
159 port_.unsetParameterDependency(parameter);
172 wxWindow *parent,
bool call_fit,
bool set_sizer) {
173 wxBoxSizer *item0 =
new wxBoxSizer( wxVERTICAL );
175 wxBoxSizer *item1 =
new wxBoxSizer( wxVERTICAL );
177 wxFlexGridSizer *item2 =
new wxFlexGridSizer( 2, 0, 0 );
179 wxStaticText *item3 =
new wxStaticText( parent, ID_LABEL_NAME, wxT(
"Name:"), wxDefaultPosition, wxDefaultSize, 0 );
180 item2->Add( item3, 0, wxALIGN_RIGHT|wxALL, 5 );
182 wxTextCtrl *item4 =
new wxTextCtrl( parent, ID_NAME, wxT(
""), wxDefaultPosition, wxSize(300,-1), 0 );
183 item2->Add( item4, 0, wxALIGN_CENTER|wxALL, 5 );
185 wxStaticText *item5 =
new wxStaticText( parent, ID_LABEL_WIDTH, wxT(
"Width formula:"), wxDefaultPosition, wxDefaultSize, 0 );
186 item2->Add( item5, 0, wxALIGN_RIGHT|wxALL, 5 );
188 wxTextCtrl *item6 =
new wxTextCtrl( parent, ID_WIDTH, wxT(
""), wxDefaultPosition, wxSize(200,-1), 0 );
189 item2->Add( item6, 0, wxGROW|wxALL, 5 );
191 wxStaticText *item7 =
new wxStaticText( parent, ID_LABEL_DESCRIPTION, wxT(
"Description:"), wxDefaultPosition, wxDefaultSize, 0 );
192 item2->Add( item7, 0, wxALIGN_RIGHT|wxALL, 5 );
194 wxTextCtrl *item8 =
new wxTextCtrl( parent, ID_DESCRIPTION, wxT(
""), wxDefaultPosition, wxSize(300,-1), 0 );
195 item2->Add( item8, 0, wxALIGN_CENTER|wxALL, 5 );
197 item1->Add( item2, 0, wxGROW|wxALL, 5 );
199 wxGridSizer *item9 =
new wxGridSizer( 2, 0, 0 );
207 wxRadioBox *item10 =
new wxRadioBox( parent, ID_DIRECTION, wxT(
"Direction:"), wxDefaultPosition, wxDefaultSize, 3, strs10, 1, wxRA_SPECIFY_COLS );
208 item9->Add( item10, 0, wxGROW|wxALL, 5 );
210 wxStaticBox *item12 =
new wxStaticBox( parent, -1, wxT(
"Parameter dependency:") );
211 wxStaticBoxSizer *item11 =
new wxStaticBoxSizer( item12, wxVERTICAL );
213 wxWindow *item13 =
new wxCheckListBox(parent, ID_PARAMETER_DEPS, wxDefaultPosition, wxSize(200, 150));
215 item11->Add( item13, 0, wxGROW|wxALL, 5 );
217 item9->Add( item11, 0, wxGROW|wxALL, 5 );
219 item1->Add( item9, 0, wxGROW|wxALL, 5 );
221 item0->Add( item1, 0, wxALIGN_CENTER|wxALL, 5 );
223 wxStaticLine *item14 =
new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
224 item0->Add( item14, 0, wxGROW|wxALL, 5 );
226 wxBoxSizer *item15 =
new wxBoxSizer( wxHORIZONTAL );
228 wxButton *item16 =
new wxButton( parent, wxID_CANCEL, wxT(
"&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
229 item15->Add( item16, 0, wxALIGN_CENTER|wxALL, 5 );
231 wxButton *item17 =
new wxButton( parent, wxID_OK, wxT(
"&OK"), wxDefaultPosition, wxDefaultSize, 0 );
232 item15->Add( item17, 0, wxALIGN_CENTER|wxALL, 5 );
234 item0->Add( item15, 0, wxALL, 5 );
238 parent->SetSizer( item0 );
240 item0->SetSizeHints( parent );