📄 settingsdlg.cpp
字号:
FindWindow(ecID_CONFLICT_OPTIONS_AUTOSUGGEST)->SetValidator(wxGenericValidator(& m_suggestFixes));}/* Run options dialog */IMPLEMENT_CLASS(ecRunOptionsDialog, wxPanel)BEGIN_EVENT_TABLE(ecRunOptionsDialog, wxPanel) EVT_UPDATE_UI(ecID_RUN_PROPERTIES_DOWNLOAD_TIMEOUT, ecRunOptionsDialog::OnUpdateDownloadTimeout) EVT_UPDATE_UI(ecID_RUN_PROPERTIES_RUNTIME_TIMEOUT, ecRunOptionsDialog::OnUpdateRuntimeTimeout) EVT_UPDATE_UI(ecID_RUN_PROPERTIES_SERIAL_PORT_ADDR, ecRunOptionsDialog::OnUpdateSerial) EVT_UPDATE_UI(ecID_RUN_PROPERTIES_SERIAL_PORT_SPEED, ecRunOptionsDialog::OnUpdateSerial) EVT_UPDATE_UI(ecID_RUN_PROPERTIES_TCPIP_HOST, ecRunOptionsDialog::OnUpdateTCPIP) EVT_UPDATE_UI(ecID_RUN_PROPERTIES_TCPIP_PORT, ecRunOptionsDialog::OnUpdateTCPIP)END_EVENT_TABLE()ecRunOptionsDialog::ecRunOptionsDialog(wxWindow* parent): wxPanel(parent, ecID_SETTINGS_RUN), m_serialOn(TRUE), m_TCPIPOn(FALSE){ CreateControls(this); SetHelpText(_("The run properties dialog allows you to change options related to running tests."));}bool ecRunOptionsDialog::TransferDataToWindow(){#if 0 // m_strTarget now set in ecConfigToolDoc::RunTests() ecConfigToolDoc* doc = wxGetApp().GetConfigToolDoc(); wxString hardware; if (doc) { hardware = doc->GetCdlConfig ()->get_hardware ().c_str(); } else { hardware = _("Unknown"); } wxGetApp().GetSettings().GetRunTestsSettings().m_strTarget = hardware;#endif // Serial/TCPIP m_serialOn = wxGetApp().GetSettings().GetRunTestsSettings().m_bSerial; m_TCPIPOn = !wxGetApp().GetSettings().GetRunTestsSettings().m_bSerial; switch (wxGetApp().GetSettings().GetRunTestsSettings().m_nDownloadTimeoutType) { case TIMEOUT_NONE: m_downloadTimeoutString = _("None"); break; case TIMEOUT_SPECIFIED: m_downloadTimeoutString = _("Specified"); break; default: case TIMEOUT_AUTOMATIC: m_downloadTimeoutString = _("Calculated from file size"); break; } switch (wxGetApp().GetSettings().GetRunTestsSettings().m_nTimeoutType) { case TIMEOUT_NONE: m_runtimeTimeoutString = _("None"); break; case TIMEOUT_SPECIFIED: m_runtimeTimeoutString = _("Specified"); break; default: case TIMEOUT_AUTOMATIC: m_runtimeTimeoutString = _("Default"); break; } m_baudString.Printf("%d", wxGetApp().GetSettings().GetRunTestsSettings().m_nBaud); wxPanel::TransferDataToWindow(); return TRUE;}bool ecRunOptionsDialog::TransferDataFromWindow(){ wxPanel::TransferDataFromWindow(); if (m_downloadTimeoutString == _("None")) wxGetApp().GetSettings().GetRunTestsSettings().m_nDownloadTimeoutType = TIMEOUT_NONE; else if (m_downloadTimeoutString == _("Specified")) wxGetApp().GetSettings().GetRunTestsSettings().m_nDownloadTimeoutType = TIMEOUT_SPECIFIED; else wxGetApp().GetSettings().GetRunTestsSettings().m_nDownloadTimeoutType = TIMEOUT_AUTOMATIC; if (m_runtimeTimeoutString == _("None")) wxGetApp().GetSettings().GetRunTestsSettings().m_nTimeoutType = TIMEOUT_NONE; else if (m_runtimeTimeoutString == _("Specified")) wxGetApp().GetSettings().GetRunTestsSettings().m_nTimeoutType = TIMEOUT_SPECIFIED; else wxGetApp().GetSettings().GetRunTestsSettings().m_nTimeoutType = TIMEOUT_AUTOMATIC; wxGetApp().GetSettings().GetRunTestsSettings().m_nBaud = (int) wxAtol(m_baudString); // Serial/TCPIP wxGetApp().GetSettings().GetRunTestsSettings().m_bSerial = m_serialOn; return TRUE;}void ecRunOptionsDialog::CreateControls( wxPanel *parent){ wxSizer *item0 = new wxBoxSizer( wxVERTICAL ); wxSizer *item1 = new wxBoxSizer( wxHORIZONTAL ); wxStaticText *item2 = new wxStaticText( parent, wxID_STATIC, _("Platform:"), wxDefaultPosition, wxDefaultSize, 0 ); item1->Add( item2, 0, wxALIGN_CENTRE|wxALL, 5 ); wxStaticText *item3 = new wxStaticText( parent, ecID_RUN_PROPERTIES_PLATFORM, _("xxxx"), wxDefaultPosition, wxDefaultSize, 0 ); item1->Add( item3, 0, wxALIGN_CENTRE|wxALL, 5 ); item0->Add( item1, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxTOP, 5 ); wxStaticBox *item5 = new wxStaticBox( parent, -1, _("Timeouts") ); wxSizer *item4 = new wxStaticBoxSizer( item5, wxVERTICAL ); wxSizer *item6 = new wxBoxSizer( wxHORIZONTAL ); wxStaticText *item7 = new wxStaticText( parent, wxID_STATIC, _("Download:"), wxDefaultPosition, wxSize(60,-1), 0 ); item6->Add( item7, 0, wxALIGN_CENTRE|wxALL, 5 ); wxString strs8[] = { _("None"), _("Specified"), _("Calculated from file size") }; wxChoice *item8 = new wxChoice( parent, ecID_RUN_PROPERTIES_DOWNLOAD_CHOICE, wxDefaultPosition, wxSize(100,-1), 3, strs8, 0 ); item6->Add( item8, 1, wxALIGN_CENTRE|wxALL, 5 ); wxSpinCtrl *item9 = new wxSpinCtrl( parent, ecID_RUN_PROPERTIES_DOWNLOAD_TIMEOUT, "0", wxDefaultPosition, wxSize(50,-1), 0, 0, 10000, 0 ); item6->Add( item9, 0, wxALIGN_CENTRE|wxALL, 5 ); item4->Add( item6, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxSizer *item10 = new wxBoxSizer( wxHORIZONTAL ); wxStaticText *item11 = new wxStaticText( parent, wxID_STATIC, _("Runtime:"), wxDefaultPosition, wxSize(60,-1), 0 ); item10->Add( item11, 0, wxALIGN_CENTRE|wxALL, 5 ); wxString strs12[] = { _("None"), _("Specified"), _("Default") }; wxChoice *item12 = new wxChoice( parent, ecID_RUN_PROPERTIES_RUNTIME_CHOICE, wxDefaultPosition, wxSize(100,-1), 3, strs12, 0 ); item10->Add( item12, 1, wxALIGN_CENTRE|wxALL, 5 ); wxSpinCtrl *item13 = new wxSpinCtrl( parent, ecID_RUN_PROPERTIES_RUNTIME_TIMEOUT, "0", wxDefaultPosition, wxSize(50,-1), 0, 0, 10000, 0 ); item10->Add( item13, 0, wxALIGN_CENTRE|wxALL, 5 ); item4->Add( item10, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item0->Add( item4, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticBox *item15 = new wxStaticBox( parent, -1, _("Connection") ); wxSizer *item14 = new wxStaticBoxSizer( item15, wxVERTICAL ); wxSizer *item16 = new wxBoxSizer( wxHORIZONTAL ); wxRadioButton *item17 = new wxRadioButton( parent, ecID_RUN_PROPERTIES_SERIAL, _("&Serial"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); item16->Add( item17, 0, wxALIGN_CENTRE|wxALL, 5 ); item16->Add( 2, 2, 1, wxALIGN_CENTRE|wxALL, 5 ); wxStaticText *item18 = new wxStaticText( parent, wxID_STATIC, _("&Port:"), wxDefaultPosition, wxDefaultSize, 0 ); item16->Add( item18, 0, wxALIGN_CENTRE|wxLEFT|wxTOP|wxBOTTOM, 5 ); wxString strs19[] = { _("COM1"), _("COM2"), _("COM3"), _("COM4"), _("COM5"), _("COM6"), _("COM7"), _("COM8") }; wxChoice *item19 = new wxChoice( parent, ecID_RUN_PROPERTIES_SERIAL_PORT_ADDR, wxDefaultPosition, wxSize(70,-1), 8, strs19, 0 ); item16->Add( item19, 0, wxALIGN_CENTRE|wxALL, 5 ); wxStaticText *item20 = new wxStaticText( parent, wxID_STATIC, _("&Baud:"), wxDefaultPosition, wxDefaultSize, 0 ); item16->Add( item20, 0, wxALIGN_CENTRE|wxLEFT|wxTOP|wxBOTTOM, 5 ); wxString strs21[] = { _("110"), _("300"), _("600"), _("1200"), _("2400"), _("4800"), _("9600"), _("14400"), _("19200"), _("38400"), _("56000"), _("57600"), _("115200"), _("128000"), _("256000") }; wxChoice *item21 = new wxChoice( parent, ecID_RUN_PROPERTIES_SERIAL_PORT_SPEED, wxDefaultPosition, wxSize(70,-1), 15, strs21, 0 ); item16->Add( item21, 0, wxALIGN_CENTRE|wxALL, 5 ); item14->Add( item16, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxSizer *item22 = new wxBoxSizer( wxHORIZONTAL ); wxRadioButton *item23 = new wxRadioButton( parent, ecID_RUN_PROPERTIES_TCPIP, _("&TCP/IP"), wxDefaultPosition, wxDefaultSize, 0 ); item22->Add( item23, 0, wxALIGN_CENTRE|wxALL, 5 ); item22->Add( 2, 2, 1, wxALIGN_CENTRE|wxALL, 5 ); wxStaticText *item24 = new wxStaticText( parent, wxID_STATIC, _("&Address:"), wxDefaultPosition, wxDefaultSize, 0 ); item22->Add( item24, 0, wxALIGN_CENTRE|wxALL, 5 ); wxTextCtrl *item25 = new wxTextCtrl( parent, ecID_RUN_PROPERTIES_TCPIP_HOST, _(""), wxDefaultPosition, wxSize(100,-1), 0 ); item22->Add( item25, 0, wxALIGN_CENTRE|wxALL, 5 ); wxStaticText *item26 = new wxStaticText( parent, wxID_STATIC, _(":"), wxDefaultPosition, wxDefaultSize, 0 ); item22->Add( item26, 0, wxALIGN_CENTRE, 5 ); wxTextCtrl *item27 = new wxTextCtrl( parent, ecID_RUN_PROPERTIES_TCPIP_PORT, _(""), wxDefaultPosition, wxSize(40,-1), 0 ); item22->Add( item27, 0, wxALIGN_CENTRE|wxALL, 5 ); item14->Add( item22, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item0->Add( item14, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); parent->SetAutoLayout( TRUE ); parent->SetSizer( item0 ); // Add context-sensitive help FindWindow(ecID_RUN_PROPERTIES_PLATFORM)->SetHelpText(_("Shows the hardware currently selected.")); FindWindow(ecID_RUN_PROPERTIES_DOWNLOAD_CHOICE)->SetHelpText(_("Specifies the kind of timeout to be applied to the download phase of test execution.")); FindWindow(ecID_RUN_PROPERTIES_DOWNLOAD_TIMEOUT)->SetHelpText(_("Specifies a fixed-period timeout (in seconds) to be applied to the download phase of test execution.")); FindWindow(ecID_RUN_PROPERTIES_RUNTIME_CHOICE)->SetHelpText(_("Specifies the kind of timeout to be applied to the run phase of test execution.")); FindWindow(ecID_RUN_PROPERTIES_RUNTIME_TIMEOUT)->SetHelpText(_("Specifies a fixed-period timeout (in seconds) to be applied to the run phase of test execution.")); FindWindow(ecID_RUN_PROPERTIES_SERIAL)->SetHelpText(_("Specifies that download is local, using a serial communications port.")); FindWindow(ecID_RUN_PROPERTIES_SERIAL_PORT_ADDR)->SetHelpText(_("Specifies the communication ports to be used for local download.")); FindWindow(ecID_RUN_PROPERTIES_SERIAL_PORT_SPEED)->SetHelpText(_("Specifies the baud rate at which the communications port is to operate.")); FindWindow(ecID_RUN_PROPERTIES_TCPIP)->SetHelpText(_("Specifies that download is remote, using GDB remote protocol via a TCP/IP port.")); FindWindow(ecID_RUN_PROPERTIES_TCPIP_HOST)->SetHelpText(_("Specifies the TCP/IP host to be used for remote download.")); FindWindow(ecID_RUN_PROPERTIES_TCPIP_PORT)->SetHelpText(_("Specifies the TCP/IP port number to be used for remote download.")); // Add validators FindWindow(ecID_RUN_PROPERTIES_PLATFORM)->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().GetRunTestsSettings().m_strTarget)); FindWindow(ecID_RUN_PROPERTIES_DOWNLOAD_CHOICE)->SetValidator(wxGenericValidator(& m_downloadTimeoutString)); FindWindow(ecID_RUN_PROPERTIES_DOWNLOAD_TIMEOUT)->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().GetRunTestsSettings().m_nDownloadTimeout)); FindWindow(ecID_RUN_PROPERTIES_RUNTIME_CHOICE)->SetValidator(wxGenericValidator(& m_runtimeTimeoutString)); FindWindow(ecID_RUN_PROPERTIES_RUNTIME_TIMEOUT)->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().GetRunTestsSettings().m_nTimeout)); FindWindow(ecID_RUN_PROPERTIES_SERIAL)->SetValidator(wxGenericValidator(& m_serialOn)); FindWindow(ecID_RUN_PROPERTIES_TCPIP)->SetValidator(wxGenericValidator(& m_TCPIPOn)); FindWindow(ecID_RUN_PROPERTIES_SERIAL_PORT_ADDR)->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().GetRunTestsSettings().m_strPort)); FindWindow(ecID_RUN_PROPERTIES_SERIAL_PORT_SPEED)->SetValidator(wxGenericValidator(& m_baudString)); FindWindow(ecID_RUN_PROPERTIES_TCPIP_HOST)->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().GetRunTestsSettings().m_strLocalTCPIPHost)); FindWindow(ecID_RUN_PROPERTIES_TCPIP_PORT)->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().GetRunTestsSettings().m_nLocalTCPIPPort));}void ecRunOptionsDialog::OnUpdateDownloadTimeout(wxUpdateUIEvent& event){ wxChoice* downloadTimeoutChoice = (wxChoice*) FindWindow(ecID_RUN_PROPERTIES_DOWNLOAD_CHOICE); wxString sel = downloadTimeoutChoice->GetStringSelection(); event.Enable( sel == _("Specified") );}void ecRunOptionsDialog::OnUpdateRuntimeTimeout(wxUpdateUIEvent& event){ wxChoice* runTimeoutChoice = (wxChoice*) FindWindow(ecID_RUN_PROPERTIES_RUNTIME_CHOICE); wxString sel = runTimeoutChoice->GetStringSelection(); event.Enable( sel == _("Specified") );}void ecRunOptionsDialog::OnUpdateSerial(wxUpdateUIEvent& event){ wxRadioButton* radio = (wxRadioButton*) FindWindow(ecID_RUN_PROPERTIES_SERIAL); event.Enable( radio->GetValue() );}void ecRunOptionsDialog::OnUpdateTCPIP(wxUpdateUIEvent& event){ wxRadioButton* radio = (wxRadioButton*) FindWindow(ecID_RUN_PROPERTIES_SERIAL); event.Enable( !radio->GetValue() );}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -