33 #include <wx/statline.h>
34 #include <wx/valgen.h>
55 wxDialog(parent,
id, _T("Register File Port Implementation")),
58 createContents(
this,
true,
true);
66 direction_ = port_.direction();
68 FindWindow(ID_NAME)->SetValidator(wxTextValidator(wxFILTER_ASCII, &name_));
70 wxTextValidator(wxFILTER_ASCII, &loadPort_));
72 wxTextValidator(wxFILTER_ASCII, &opcodePort_));
73 FindWindow(ID_OPCODE_PORT_WIDTH)->SetValidator(
74 wxTextValidator(wxFILTER_ASCII, &opcodePortWidth_));
75 FindWindow(ID_DIRECTION)->SetValidator(wxGenericValidator(&direction_));
77 TransferDataToWindow();
92 TransferDataFromWindow();
94 name_ = name_.Trim(
true).Trim(
false);
95 loadPort_ = loadPort_.Trim(
true).Trim(
false);
96 opcodePort_ = opcodePort_.Trim(
true).Trim(
false);
97 opcodePortWidth_ = opcodePortWidth_.Trim(
true).Trim(
false);
99 if (name_.IsEmpty()) {
100 wxString message = _T(
"Name field must not be empty.");
111 if (direction_ == 0) {
112 port_.setDirection(
IN);
113 }
else if (direction_ == 1) {
114 port_.setDirection(
OUT);
115 }
else if (direction_ == 2) {
116 port_.setDirection(
BIDIR);
129 wxWindow *parent,
bool call_fit,
bool set_sizer) {
131 wxBoxSizer *item0 =
new wxBoxSizer( wxVERTICAL );
133 wxBoxSizer *item1 =
new wxBoxSizer( wxHORIZONTAL );
135 wxFlexGridSizer *item2 =
new wxFlexGridSizer( 2, 0, 0 );
137 wxStaticText *item3 =
new wxStaticText( parent, ID_LABEL_NAME, wxT(
"Name:"), wxDefaultPosition, wxDefaultSize, 0 );
138 item2->Add( item3, 0, wxALL, 5 );
140 wxTextCtrl *item4 =
new wxTextCtrl( parent, ID_NAME, wxT(
""), wxDefaultPosition, wxSize(200,-1), 0 );
141 item2->Add( item4, 0, wxALIGN_CENTER|wxALL, 5 );
143 wxStaticText *item5 =
new wxStaticText( parent, ID_LABEL_LOAD_PORT, wxT(
"Load port:"), wxDefaultPosition, wxDefaultSize, 0 );
144 item2->Add( item5, 0, wxALL, 5 );
146 wxTextCtrl *item6 =
new wxTextCtrl( parent, ID_LOAD_PORT, wxT(
""), wxDefaultPosition, wxSize(200,-1), 0 );
147 item2->Add( item6, 0, wxGROW|wxALL, 5 );
149 wxStaticText *item7 =
new wxStaticText( parent, ID_LABEL_OPCODE_PORT, wxT(
"Opcode port:"), wxDefaultPosition, wxDefaultSize, 0 );
150 item2->Add( item7, 0, wxALL, 5 );
152 wxTextCtrl *item8 =
new wxTextCtrl( parent, ID_OPCODE_PORT, wxT(
""), wxDefaultPosition, wxSize(200,-1), 0 );
153 item2->Add( item8, 0, wxALIGN_CENTER|wxALL, 5 );
155 wxStaticText *item9 =
new wxStaticText( parent, ID_LABEL_OPCODE_PORT_WIDTH, wxT(
"Opcode port width formula:"), wxDefaultPosition, wxDefaultSize, 0 );
156 item2->Add( item9, 0, wxALIGN_CENTER|wxALL, 5 );
158 wxTextCtrl *item10 =
new wxTextCtrl( parent, ID_OPCODE_PORT_WIDTH, wxT(
""), wxDefaultPosition, wxSize(80,-1), 0 );
159 item2->Add( item10, 0, wxGROW|wxALL, 5 );
161 item1->Add( item2, 0, wxGROW|wxALL, 5 );
169 wxRadioBox *item11 =
new wxRadioBox( parent, ID_DIRECTION, wxT(
"Direction:"), wxDefaultPosition, wxDefaultSize, 3, strs11, 1, wxRA_SPECIFY_COLS );
170 item1->Add( item11, 0, wxGROW|wxALL, 5 );
172 item0->Add( item1, 0, wxALIGN_CENTER|wxALL, 5 );
174 wxStaticLine *item12 =
new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
175 item0->Add( item12, 0, wxGROW|wxALL, 5 );
177 wxBoxSizer *item13 =
new wxBoxSizer( wxHORIZONTAL );
179 wxButton *item14 =
new wxButton( parent, wxID_CANCEL, wxT(
"&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
180 item13->Add( item14, 0, wxALIGN_CENTER|wxALL, 5 );
182 wxButton *item15 =
new wxButton( parent, wxID_OK, wxT(
"&OK"), wxDefaultPosition, wxDefaultSize, 0 );
183 item13->Add( item15, 0, wxALIGN_CENTER|wxALL, 5 );
185 item0->Add( item13, 0, wxALL, 5 );
189 parent->SetSizer( item0 );
191 item0->SetSizeHints( parent );