📄 settingsdlg.cpp
字号:
// item0->Add( 20, 20, 1, wxALIGN_CENTRE|wxALL, 5 ); wxStaticBox *item9 = new wxStaticBox( parent, -1, _("View documentation using") ); wxSizer *item8 = new wxStaticBoxSizer( item9, wxVERTICAL ); wxRadioButton *item10 = new wxRadioButton( parent, ecID_VIEWER_DIALOG_DOC_BUILTIN, _("&Built-in viewer"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP ); item8->Add( item10, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 ); wxRadioButton *item11 = new wxRadioButton( parent, ecID_VIEWER_DIALOG_DOC_ASSOCIATED, _("Associated browser"), wxDefaultPosition, wxDefaultSize, 0 ); item8->Add( item11, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxSizer *item12 = new wxBoxSizer( wxHORIZONTAL ); wxRadioButton *item13 = new wxRadioButton( parent, ecID_VIEWER_DIALOG_DOC_THIS, _("This &browser:"), wxDefaultPosition, wxDefaultSize, 0 ); item12->Add( item13, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxBOTTOM, 5 ); item12->Add( 20, 20, 1, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxBOTTOM, 5 ); wxButton *item14 = new wxButton( parent, ecID_VIEWER_DIALOG_BROWSE_DOC, _("Br&owse..."), wxDefaultPosition, wxDefaultSize, 0 ); item12->Add( item14, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxBOTTOM, 5 ); item8->Add( item12, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 0 ); wxTextCtrl *item15 = new wxTextCtrl( parent, ecID_VIEWER_DIALOG_DOC_TEXT, _(""), wxDefaultPosition, wxSize(80,-1), 0 ); item8->Add( item15, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item0->Add( item8, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );#endif // Disable this option because we don't yet have a built-in browser#if 0 // !ecUSE_EXPERIMENTAL_CODE FindWindow(ecID_VIEWER_DIALOG_DOC_BUILTIN)->Enable(FALSE);#endif // Add validators FindWindow(ecID_VIEWER_DIALOG_HEADER_TEXT)->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().m_strViewer)); FindWindow(ecID_VIEWER_DIALOG_DOC_TEXT)->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().m_strBrowser)); // Add context-sensitive help item2->SetHelpText(_("Allows you to select a viewer to display header files.")); FindWindow(ecID_VIEWER_DIALOG_HEADER_ASSOCIATED)->SetHelpText(_("Select the default viewer to display header files.")); FindWindow(ecID_VIEWER_DIALOG_HEADER_THIS)->SetHelpText(_("Select a viewer of your choice to display header files.")); FindWindow(ecID_VIEWER_DIALOG_BROWSE_HEADER)->SetHelpText(_("Browses for a viewer to be used to display header files.")); FindWindow(ecID_VIEWER_DIALOG_HEADER_TEXT)->SetHelpText(_("Specify the viewer executable to be used to display header files.")); item9->SetHelpText(_("Allows you to select a viewer to display documentation.")); FindWindow(ecID_VIEWER_DIALOG_DOC_BUILTIN)->SetHelpText(_("Select the internal HTML help mechanism to display HTML-based help.")); FindWindow(ecID_VIEWER_DIALOG_DOC_ASSOCIATED)->SetHelpText(_("Select the default browser to display HTML-based help.")); FindWindow(ecID_VIEWER_DIALOG_DOC_THIS)->SetHelpText(_("Select a browser of your choice to display HTML-based help.")); FindWindow(ecID_VIEWER_DIALOG_BROWSE_DOC)->SetHelpText(_("Browses for a browser to be used to display HTML-based help.")); FindWindow(ecID_VIEWER_DIALOG_ASSOC_INFO)->SetHelpText(_("Shows information about the associated viewer.")); parent->SetAutoLayout( TRUE ); parent->SetSizer( item0 );}void ecViewerOptionsDialog::OnUpdateViewerText(wxUpdateUIEvent& event){ event.Enable( FindWindow(ecID_VIEWER_DIALOG_HEADER_THIS) && ((wxRadioButton*) FindWindow(ecID_VIEWER_DIALOG_HEADER_THIS))->GetValue() );}void ecViewerOptionsDialog::OnUpdateBrowserText(wxUpdateUIEvent& event){ event.Enable( FindWindow(ecID_VIEWER_DIALOG_DOC_THIS) && ((wxRadioButton*) FindWindow(ecID_VIEWER_DIALOG_DOC_THIS))->GetValue() );}void ecViewerOptionsDialog::OnBrowseForViewer(wxCommandEvent& event){ wxString currentViewer = ((wxTextCtrl*) FindWindow(ecID_VIEWER_DIALOG_HEADER_TEXT))->GetValue(); wxFileDialog dialog(this, _("Choose a viewer executable"), wxPathOnly(currentViewer), wxFileNameFromPath(currentViewer), wxT("*.exe")); if (dialog.ShowModal() == wxID_OK) { ((wxTextCtrl*) FindWindow(ecID_VIEWER_DIALOG_HEADER_TEXT))->SetValue(dialog.GetPath()); }}void ecViewerOptionsDialog::OnBrowseForBrowser(wxCommandEvent& event){ wxString currentViewer = ((wxTextCtrl*) FindWindow(ecID_VIEWER_DIALOG_DOC_TEXT))->GetValue(); wxFileDialog dialog(this, _("Choose a browser executable"), wxPathOnly(currentViewer), wxFileNameFromPath(currentViewer), wxT("*.exe")); if (dialog.ShowModal() == wxID_OK) { ((wxTextCtrl*) FindWindow(ecID_VIEWER_DIALOG_DOC_TEXT))->SetValue(dialog.GetPath()); }}void ecViewerOptionsDialog::OnShowAssociatedViewerInfo(wxCommandEvent& event){ wxString msg; wxFileType *ft = wxTheMimeTypesManager->GetFileTypeFromExtension(wxT("html")); if ( !ft ) { msg += wxT("It is not possible to determine the associated browser for HTML documents.\n\n"); } else { msg += wxT("The associated MIME type for HTML is:\n"); wxString mimeType(wxT("Unknown")); ft->GetMimeType(& mimeType); msg += mimeType; msg += wxT("\n"); wxString descr; if (ft->GetDescription(& descr)) { msg += descr; msg += wxT("\n"); } msg += wxT("\n"); wxString cmd; wxString url(wxT("http://example-url.html")); bool ok = ft->GetOpenCommand(&cmd, wxFileType::MessageParameters(url, _T(""))); if (ok) { msg += wxT("The associated command is:\n"); msg += cmd; msg += wxT("\n"); } msg += wxT("\n"); } msg += wxT("If this MIME type is not defined or looks wrong, please consult your "); msg += wxT("Configuration Tool documentation for how to set up an association.\n");#if defined(__WXGTK__) msg += wxT("On Unix, this can be done by adding an entry to your ~/.mailcap file.");#endif delete ft; wxMessageBox(msg, wxGetApp().GetSettings().GetAppName(), wxICON_INFORMATION|wxOK);}/* Path options dialog */IMPLEMENT_CLASS(ecPathOptionsDialog, wxPanel)ecPathOptionsDialog::ecPathOptionsDialog(wxWindow* parent): wxPanel(parent, ecID_SETTINGS_PATH){ CreateControls(this); SetHelpText(_("The path options dialog allows you to change tool paths."));}bool ecPathOptionsDialog::TransferDataToWindow(){ wxPanel::TransferDataToWindow(); return TRUE;}bool ecPathOptionsDialog::TransferDataFromWindow(){ wxPanel::TransferDataFromWindow(); return TRUE;}void ecPathOptionsDialog::CreateControls( wxPanel *parent){ wxSizer *item0 = new wxBoxSizer( wxVERTICAL ); wxStaticBox *item2 = new wxStaticBox( parent, -1, _("Build Tools") ); wxSizer *item1 = new wxStaticBoxSizer( item2, wxVERTICAL ); wxStaticText *item3 = new wxStaticText( parent, ecID_PATHS_BUILD_MSG, _("Enter the location of the arm-elf build tools " "folder, which should contain arm-elf-gcc. You can " "type in a path or use the Browse button to " "navigate to a folder."), wxDefaultPosition, wxSize(-1,70), 0 ); item1->Add( item3, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxSizer *item4 = new wxBoxSizer( wxHORIZONTAL ); wxString *strs5 = (wxString*) NULL; wxComboBox *item5 = new wxComboBox( parent, ecID_PATHS_BUILD_COMBO, _(""), wxDefaultPosition, wxSize(100,-1), 0, strs5, wxCB_DROPDOWN ); item4->Add( item5, 20, wxALIGN_CENTRE|wxALL, 5 ); item1->Add( item4, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 0 ); wxButton *item6 = new wxButton( parent, ecID_PATHS_BUILD_BROWSE, _("&Browse..."), wxDefaultPosition, wxDefaultSize, 0 ); item1->Add( item6, 0, wxALIGN_CENTRE|wxALL, 5 ); item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxStaticBox *item8 = new wxStaticBox( parent, -1, _("User Tools") ); wxSizer *item7 = new wxStaticBoxSizer( item8, wxVERTICAL ); wxStaticText *item9 = new wxStaticText( parent, ecID_PATHS_USER_MSG, _("Enter the location of the user tools folder, " "which should contain cat and ls. You can type in " "a path or use the Browse button to navigate to a " "folder."), wxDefaultPosition, wxSize(-1,60), 0 ); item7->Add( item9, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxSizer *item10 = new wxBoxSizer( wxHORIZONTAL ); wxString *strs11 = (wxString*) NULL; wxComboBox *item11 = new wxComboBox( parent, ecID_PATHS_USER_COMBO, _(""), wxDefaultPosition, wxSize(100,-1), 0, strs11, wxCB_DROPDOWN ); item10->Add( item11, 20, wxALIGN_CENTRE|wxALL, 5 ); item7->Add( item10, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 0 ); wxButton *item12 = new wxButton( parent, ecID_PATHS_USER_BROWSE, _("&Browse..."), wxDefaultPosition, wxDefaultSize, 0 ); item7->Add( item12, 0, wxALIGN_CENTRE|wxALL, 5 ); item0->Add( item7, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); parent->SetAutoLayout( TRUE ); parent->SetSizer( item0 ); // Add context-sensitive help FindWindow( ecID_PATHS_BUILD_COMBO )->SetHelpText(_("Select the build tools folder.")); FindWindow( ecID_PATHS_BUILD_BROWSE )->SetHelpText(_("Browse for the build tools folder.")); FindWindow( ecID_PATHS_USER_COMBO )->SetHelpText(_("Select the user tools folder.")); FindWindow( ecID_PATHS_USER_BROWSE )->SetHelpText(_("Browse for the user tools folder."));}/* Conflict resolution options dialog */IMPLEMENT_CLASS(ecConflictResolutionOptionsDialog, wxPanel)ecConflictResolutionOptionsDialog::ecConflictResolutionOptionsDialog(wxWindow* parent): wxPanel(parent, ecID_SETTINGS_CONFLICT_RESOLUTION){ CreateControls(this); m_suggestFixes = ((wxGetApp().GetSettings().m_nRuleChecking & ecSettings::SuggestFixes) != 0); m_immediate = ((wxGetApp().GetSettings().m_nRuleChecking & ecSettings::Immediate) != 0); m_deferred = ((wxGetApp().GetSettings().m_nRuleChecking & ecSettings::Deferred) != 0); SetHelpText(_("The conflict resolution options dialog allows you to change options related to conflict resolution."));}bool ecConflictResolutionOptionsDialog::TransferDataToWindow(){ wxPanel::TransferDataToWindow(); return TRUE;}bool ecConflictResolutionOptionsDialog::TransferDataFromWindow(){ wxPanel::TransferDataFromWindow(); int& ruleChecking = wxGetApp().GetSettings().m_nRuleChecking; ruleChecking = 0; if (m_suggestFixes) ruleChecking |= ecSettings::SuggestFixes ; if (m_immediate) ruleChecking |= ecSettings::Immediate ; if (m_deferred) ruleChecking |= ecSettings::Deferred ; return TRUE;}void ecConflictResolutionOptionsDialog::CreateControls( wxPanel *parent){ wxSizer *item0 = new wxBoxSizer( wxVERTICAL ); wxStaticBox *item2 = new wxStaticBox( parent, -1, _("Check for conflicts:") ); wxSizer *item1 = new wxStaticBoxSizer( item2, wxVERTICAL ); wxCheckBox *item3 = new wxCheckBox( parent, ecID_CONFLICT_OPTIONS_AFTER_ITEM_CHANGED, _("After any item changed"), wxDefaultPosition, wxDefaultSize, 0 ); item1->Add( item3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxCheckBox *item4 = new wxCheckBox( parent, ecID_CONFLICT_OPTIONS_BEFORE_SAVING, _("Before &saving configuration"), wxDefaultPosition, wxDefaultSize, 0 ); item1->Add( item4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxCheckBox *item5 = new wxCheckBox( parent, ecID_CONFLICT_OPTIONS_AUTOSUGGEST, _("&Automatically suggest fixes"), wxDefaultPosition, wxDefaultSize, 0 ); item1->Add( item5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); parent->SetAutoLayout( TRUE ); parent->SetSizer( item0 ); // Add context-sensitive help item2->SetHelpText(_("Options related to conflict resolution.")); item3->SetHelpText(_("Check for configuration option conflicts after any configuration option value is changed.")); item4->SetHelpText(_("Check for configuration option conflicts before saving the configuration.")); item5->SetHelpText(_("When configuration conflicts are found, provide possible solutions.")); // Add validators FindWindow(ecID_CONFLICT_OPTIONS_AFTER_ITEM_CHANGED)->SetValidator(wxGenericValidator(& m_immediate)); FindWindow(ecID_CONFLICT_OPTIONS_BEFORE_SAVING)->SetValidator(wxGenericValidator(& m_deferred));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -