35 #include <wx/statline.h>
36 #include <wx/spinctrl.h>
80 wxWindow* parent, wxWindowID
id,
Watch* ) :
81 wxDialog(parent,
id, _T("
Watch point"), wxDefaultPosition) {
83 createContents(
this,
true,
true);
86 asChoice_ =
dynamic_cast<wxChoice*
>(
FindWindow(ID_ADDRESS_SPACE));
87 rfChoice_ =
dynamic_cast<wxChoice*
>(
FindWindow(ID_RF_CHOICE));
88 indexChoice_ =
dynamic_cast<wxChoice*
>(
FindWindow(ID_INDEX_CHOICE));
89 fuChoice_ =
dynamic_cast<wxChoice*
>(
FindWindow(ID_FU_CHOICE));
90 portChoice_ =
dynamic_cast<wxChoice*
>(
FindWindow(ID_PORT_CHOICE));
91 busChoice_ =
dynamic_cast<wxChoice*
>(
FindWindow(ID_BUS_CHOICE));
93 endAddressCtrl_ =
dynamic_cast<wxSpinCtrl*
>(
FindWindow(ID_END_ADDRESS));
95 dynamic_cast<wxSpinCtrl*
>(
FindWindow(ID_START_ADDRESS));
118 for (
int i = 0; i < asNavigator.
count(); i++) {
119 string asName = asNavigator.
item(i)->name();
126 for (
int i = 0; i < rfNavigator.
count(); i++) {
127 string rfName = rfNavigator.
item(i)->name();
134 for (
int i = 0; i < fuNavigator.
count(); i++) {
135 string fuName = fuNavigator.
item(i)->name();
141 for (
int i = 0; i < busNavigator.
count(); i++) {
142 string busName = busNavigator.
item(i)->name();
146 wxCommandEvent
dummy;
147 dummy.SetId(ID_RB_PORT);
148 onWatchTypeChange(
dummy);
165 FindWindow(ID_LABEL_START_ADDRESS)->Disable();
180 if (event.GetId() == ID_RB_MEMORY) {
187 if (event.GetId() == ID_RB_PORT) {
193 if (event.GetId() == ID_RB_REGISTER) {
199 if (event.GetId() == ID_RB_BUS) {
203 if (event.GetId() == ID_RB_EXPRESSION) {
227 portChoice_->Clear();
228 for (
int i = 0; i < fu->
portCount(); i++) {
229 string portName = fu->
port(i)->
name();
232 portChoice_->SetSelection(0);
254 indexChoice_->Clear();
258 indexChoice_->SetSelection(0);
280 startAddressCtrl_->SetRange(as->
start(), as->
end());
281 endAddressCtrl_->SetRange(as->
start(), as->
end());
283 startAddressCtrl_->SetValue(as->
start());
284 endAddressCtrl_->SetValue(as->
end());
296 if (
dynamic_cast<wxRadioButton*
>(
FindWindow(ID_RB_MEMORY))->GetValue()) {
301 unsigned start = startAddressCtrl_->GetValue();
302 unsigned end = endAddressCtrl_->GetValue();
303 int count = end - start + 1;
309 wxString message = _T(
"Invalid address space.");
315 wxString message = _T(
"The memory watch end address must be\n");
316 message.Append(_T(
"greater than the start address."));
322 expression =
"x " " /a " + asName +
" /n " + countStr +
" " + startStr;
326 if (
dynamic_cast<wxRadioButton*
>(
FindWindow(ID_RB_PORT))->GetValue()) {
332 if (fuName ==
"" || portName ==
"") {
333 wxString message = _T(
"Invalid port.");
338 expression =
"info ports " + fuName +
" " + portName;
342 if (
dynamic_cast<wxRadioButton*
>(
FindWindow(ID_RB_REGISTER))->GetValue()) {
349 wxString message = _T(
"Invalid register.");
354 expression =
"info registers " + rfName +
" " + index;
358 if (
dynamic_cast<wxRadioButton*
>(
FindWindow(ID_RB_BUS))->GetValue()) {
364 wxString message = _T(
"Invalid bus.");
369 expression =
"info segments " + busName;
373 bool expressionWatch =
374 dynamic_cast<wxRadioButton*
>(
FindWindow(ID_RB_EXPRESSION))->GetValue();
375 if (expressionWatch) {
376 wxTextCtrl* expressionCtrl =
377 dynamic_cast<wxTextCtrl*
>(
FindWindow(ID_EXPRESSION));
380 expressionCtrl->GetValue().Trim(
true).Trim(
false));
383 if (expression ==
"") {
384 wxString message = _T(
"No expression defined for the watch");
398 lineReader.
input(expression);
417 wxBoxSizer *item0 =
new wxBoxSizer( wxVERTICAL );
419 wxBoxSizer *item1 =
new wxBoxSizer( wxVERTICAL );
421 wxBoxSizer *item2 =
new wxBoxSizer( wxHORIZONTAL );
423 wxRadioButton *item3 =
new wxRadioButton( parent, ID_RB_PORT, wxT(
"Port watch"), wxDefaultPosition, wxDefaultSize, 0 );
424 item2->Add( item3, 0, wxALL, 5 );
426 wxBoxSizer *item4 =
new wxBoxSizer( wxHORIZONTAL );
428 item4->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
430 wxStaticText *item5 =
new wxStaticText( parent, ID_LABEL_UNIT, wxT(
"Unit:"), wxDefaultPosition, wxDefaultSize, 0 );
431 item4->Add( item5, 0, wxALIGN_CENTER|wxALL, 5 );
433 wxString *strs6 = (wxString*) NULL;
434 wxChoice *item6 =
new wxChoice( parent, ID_FU_CHOICE, wxDefaultPosition, wxSize(100,-1), 0, strs6, 0 );
435 item4->Add( item6, 0, wxALIGN_CENTER|wxALL, 5 );
437 wxStaticText *item7 =
new wxStaticText( parent, ID_LABEL_PORT, wxT(
"Port:"), wxDefaultPosition, wxDefaultSize, 0 );
438 item4->Add( item7, 0, wxALIGN_CENTER|wxALL, 5 );
440 wxString *strs8 = (wxString*) NULL;
441 wxChoice *item8 =
new wxChoice( parent, ID_PORT_CHOICE, wxDefaultPosition, wxSize(100,-1), 0, strs8, 0 );
442 item4->Add( item8, 0, wxALIGN_CENTER|wxALL, 5 );
444 item2->Add( item4, 0, wxALIGN_CENTER|wxALL, 5 );
446 item1->Add( item2, 0, wxALL, 5 );
448 wxBoxSizer *item9 =
new wxBoxSizer( wxHORIZONTAL );
450 wxRadioButton *item10 =
new wxRadioButton( parent, ID_RB_REGISTER, wxT(
"Register watch"), wxDefaultPosition, wxDefaultSize, 0 );
451 item9->Add( item10, 0, wxALL, 5 );
453 wxBoxSizer *item11 =
new wxBoxSizer( wxHORIZONTAL );
455 item11->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
457 wxStaticText *item12 =
new wxStaticText( parent, ID_LABEL_RF, wxT(
"Register file:"), wxDefaultPosition, wxDefaultSize, 0 );
458 item11->Add( item12, 0, wxALIGN_CENTER|wxALL, 5 );
460 wxString *strs13 = (wxString*) NULL;
461 wxChoice *item13 =
new wxChoice( parent, ID_RF_CHOICE, wxDefaultPosition, wxSize(100,-1), 0, strs13, 0 );
462 item11->Add( item13, 0, wxALIGN_CENTER|wxALL, 5 );
464 wxStaticText *item14 =
new wxStaticText( parent, ID_LABEL_INDEX, wxT(
"Index:"), wxDefaultPosition, wxDefaultSize, 0 );
465 item11->Add( item14, 0, wxALIGN_CENTER|wxALL, 5 );
467 wxString *strs15 = (wxString*) NULL;
468 wxChoice *item15 =
new wxChoice( parent, ID_INDEX_CHOICE, wxDefaultPosition, wxSize(100,-1), 0, strs15, 0 );
469 item11->Add( item15, 0, wxALIGN_CENTER|wxALL, 5 );
471 item9->Add( item11, 0, wxALIGN_CENTER|wxALL, 5 );
473 item1->Add( item9, 0, wxALL, 5 );
475 wxBoxSizer *item16 =
new wxBoxSizer( wxHORIZONTAL );
477 wxRadioButton *item17 =
new wxRadioButton( parent, ID_RB_BUS, wxT(
"Bus watch"), wxDefaultPosition, wxDefaultSize, 0 );
478 item16->Add( item17, 0, wxALL, 5 );
480 wxBoxSizer *item18 =
new wxBoxSizer( wxHORIZONTAL );
482 item18->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
484 wxStaticText *item19 =
new wxStaticText( parent, ID_LABEL_BUS, wxT(
"Bus:"), wxDefaultPosition, wxDefaultSize, 0 );
485 item18->Add( item19, 0, wxALIGN_CENTER|wxALL, 5 );
487 wxString *strs20 = (wxString*) NULL;
488 wxChoice *item20 =
new wxChoice( parent, ID_BUS_CHOICE, wxDefaultPosition, wxSize(100,-1), 0, strs20, 0 );
489 item18->Add( item20, 0, wxALIGN_CENTER|wxALL, 5 );
491 item16->Add( item18, 0, wxALIGN_CENTER|wxALL, 5 );
493 item1->Add( item16, 0, wxALL, 5 );
495 wxBoxSizer *item21 =
new wxBoxSizer( wxVERTICAL );
497 wxRadioButton *item22 =
new wxRadioButton( parent, ID_RB_MEMORY, wxT(
"Memory watch"), wxDefaultPosition, wxDefaultSize, 0 );
498 item21->Add( item22, 0, wxALL, 5 );
500 wxBoxSizer *item23 =
new wxBoxSizer( wxHORIZONTAL );
502 item23->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );
504 wxStaticText *item24 =
new wxStaticText( parent, ID_LABEL_AS, wxT(
"Address space:"), wxDefaultPosition, wxDefaultSize, 0 );
505 item23->Add( item24, 0, wxALIGN_CENTER|wxALL, 5 );
507 wxString *strs25 = (wxString*) NULL;
508 wxChoice *item25 =
new wxChoice( parent, ID_ADDRESS_SPACE, wxDefaultPosition, wxSize(100,-1), 0, strs25, 0 );
509 item23->Add( item25, 0, wxALIGN_CENTER|wxALL, 5 );
511 wxStaticText *item26 =
new wxStaticText( parent, ID_LABEL_START_ADDRESS, wxT(
"Start address:"), wxDefaultPosition, wxDefaultSize, 0 );
512 item23->Add( item26, 0, wxALIGN_CENTER|wxALL, 5 );
514 wxSpinCtrl *item27 =
new wxSpinCtrl( parent, ID_START_ADDRESS, wxT(
"0"), wxDefaultPosition, wxSize(-1,-1), 0, 0, 100, 0 );
515 item23->Add( item27, 0, wxALIGN_CENTER|wxALL, 5 );
517 wxStaticText *item28 =
new wxStaticText( parent, ID_LABEL_END_ADDRESS, wxT(
"End address:"), wxDefaultPosition, wxDefaultSize, 0 );
518 item23->Add( item28, 0, wxALIGN_CENTER|wxALL, 5 );
520 wxSpinCtrl *item29 =
new wxSpinCtrl( parent, ID_END_ADDRESS, wxT(
"0"), wxDefaultPosition, wxSize(-1,-1), 0, 0, 100, 0 );
521 item23->Add( item29, 0, wxALIGN_CENTER|wxALL, 5 );
523 item21->Add( item23, 0, wxALIGN_CENTER|wxALL, 5 );
525 item1->Add( item21, 0, wxALL, 5 );
527 wxBoxSizer *item30 =
new wxBoxSizer( wxHORIZONTAL );
529 wxRadioButton *item31 =
new wxRadioButton( parent, ID_RB_EXPRESSION, wxT(
"Experession:"), wxDefaultPosition, wxDefaultSize, 0 );
530 item30->Add( item31, 0, wxALL, 5 );
532 wxTextCtrl *item32 =
new wxTextCtrl( parent, ID_EXPRESSION, wxT(
""), wxDefaultPosition, wxSize(500,-1), 0 );
533 item30->Add( item32, 0, wxALIGN_CENTER|wxALL, 5 );
535 item1->Add( item30, 0, wxGROW|wxALL, 5 );
537 item0->Add( item1, 0, wxGROW|wxALL, 5 );
539 wxBoxSizer *item33 =
new wxBoxSizer( wxVERTICAL );
541 wxStaticLine *item34 =
new wxStaticLine( parent, ID_LINE, wxDefaultPosition, wxSize(20,-1), wxLI_HORIZONTAL );
542 item33->Add( item34, 0, wxGROW|wxALL, 5 );
544 wxBoxSizer *item35 =
new wxBoxSizer( wxHORIZONTAL );
546 wxButton *item36 =
new wxButton( parent, wxID_OK, wxT(
"&OK"), wxDefaultPosition, wxDefaultSize, 0 );
547 item35->Add( item36, 0, wxALIGN_CENTER|wxALL, 5 );
549 wxButton *item37 =
new wxButton( parent, wxID_CANCEL, wxT(
"&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
550 item35->Add( item37, 0, wxALIGN_CENTER|wxALL, 5 );
552 item33->Add( item35, 0, wxALL, 5 );
554 item0->Add( item33, 0, wxGROW|wxALL, 5 );
558 parent->SetSizer( item0 );
560 item0->SetSizeHints( parent );