⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 settingsdlg.cpp

📁 ecos实时嵌入式操作系统
💻 CPP
📖 第 1 页 / 共 4 页
字号:
{    m_displayOptions->TransferDataFromWindow();    m_viewerOptions->TransferDataFromWindow();#if ecUSE_PATHS_PAGE    m_pathOptions->TransferDataFromWindow();#endif    m_conflictResolutionOptions->TransferDataFromWindow();#if ecUSE_RUN_PAGE    m_runOptions->TransferDataFromWindow();#endif    return TRUE;}/* Display options dialog */// For now, disable some unnecessary features#define ecUSE_FONT_SELECTION 1IMPLEMENT_CLASS(ecDisplayOptionsDialog, wxPanel)BEGIN_EVENT_TABLE(ecDisplayOptionsDialog, wxPanel)    EVT_BUTTON(ecID_DISPLAY_OPTIONS_CHANGE_FONT, ecDisplayOptionsDialog::OnChangeFont)END_EVENT_TABLE()ecDisplayOptionsDialog::ecDisplayOptionsDialog(wxWindow* parent):    wxPanel(parent, ecID_SETTINGS_DISPLAY){    CreateControls(this);        SetHelpText(_("The display options dialog allows you to change display-related options"));}void ecDisplayOptionsDialog::CreateControls( wxPanel *parent){    wxSizer *item0 = new wxBoxSizer( wxVERTICAL );    wxStaticBox *item2 = new wxStaticBox( parent, -1, _("Configuration Pane") );    wxSizer *item1 = new wxStaticBoxSizer( item2, wxHORIZONTAL );    wxString strs3[] =     {        _("Use &macro names"),        _("Use descriptive &names")    };    wxRadioBox *item3 = new wxRadioBox( parent, ecID_DISPLAY_OPTIONS_LABELS, _("Labels"), wxDefaultPosition, wxDefaultSize, 2, strs3, 1, wxRA_SPECIFY_COLS );    item1->Add( item3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );    item1->Add( 20, 20, 1, wxALIGN_CENTRE|wxALL, 5 );    wxString strs4[] =     {        _("&Decimal"),        _("He&xadecimal")    };    wxRadioBox *item4 = new wxRadioBox( parent, ecID_DISPLAY_OPTIONS_INTEGER_ITEMS, _("Integer items"), wxDefaultPosition, wxDefaultSize, 2, strs4, 1, wxRA_SPECIFY_COLS );    item1->Add( item4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );    item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );#if ecUSE_FONT_SELECTION    wxStaticBox *item6 = new wxStaticBox( parent, -1, _("Font") );    wxSizer *item5 = new wxStaticBoxSizer( item6, wxHORIZONTAL );    wxStaticText *item7 = new wxStaticText( parent, wxID_STATIC, _("&Window:"), wxDefaultPosition, wxDefaultSize, 0 );    item5->Add( item7, 0, wxALIGN_CENTRE|wxALL, 5 );    wxChoice *item8 = new wxChoice( parent, ecID_DISPLAY_OPTIONS_FONT_CHOICE, wxDefaultPosition, wxSize(120,-1), 0, NULL, 0 );    item5->Add( item8, 0, wxALIGN_CENTRE|wxALL, 5 );    item5->Add( 20, 20, 1, wxALIGN_CENTRE|wxALL, 5 );    wxButton *item9 = new wxButton( parent, ecID_DISPLAY_OPTIONS_CHANGE_FONT, _("Change &Font..."), wxDefaultPosition, wxDefaultSize, 0 );    item5->Add( item9, 0, wxALIGN_CENTRE|wxALL, 5 );    item0->Add( item5, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );#endif    wxStaticBox *item11 = new wxStaticBox( parent, -1, _("Miscellaneous") );    wxSizer *item10 = new wxStaticBoxSizer( item11, wxVERTICAL );    wxCheckBox *item12 = new wxCheckBox( parent, ecID_DISPLAY_OPTIONS_SHOW_SPLASH, _("Show initial &splash screen"), wxDefaultPosition, wxDefaultSize, 0 );    item10->Add( item12, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );    item0->Add( item10, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );    // Add validators    FindWindow(ecID_DISPLAY_OPTIONS_SHOW_SPLASH)->SetValidator(wxGenericValidator(& wxGetApp().GetSettings().m_showSplashScreen));    // Add context-sensitive help    item2->SetHelpText(_("Options relating to the configuration pane."));    FindWindow(ecID_DISPLAY_OPTIONS_LABELS)->SetHelpText(_("Display macro or descriptive names in the configuration pane."));    FindWindow(ecID_DISPLAY_OPTIONS_INTEGER_ITEMS)->SetHelpText(_("View integer items in the configuration pane in either decimal or hexadecimal."));    #if ecUSE_FONT_SELECTION    FindWindow(ecID_DISPLAY_OPTIONS_FONT_CHOICE)->SetHelpText(_("Selects a window for which the font is to be changed."));    FindWindow(ecID_DISPLAY_OPTIONS_CHANGE_FONT)->SetHelpText(_("Changes the font of the chosen window."));    // Init the choice control    unsigned int i;    for (i = 0; i < wxGetApp().GetSettings().GetWindowSettings().GetCount(); i++)    {        ((wxChoice*) FindWindow(ecID_DISPLAY_OPTIONS_FONT_CHOICE))->Append(wxGetApp().GetSettings().GetWindowSettings().GetName(i));    }    ((wxChoice*) FindWindow(ecID_DISPLAY_OPTIONS_FONT_CHOICE))->SetSelection(0);#endif    FindWindow(ecID_DISPLAY_OPTIONS_SHOW_SPLASH)->SetHelpText(_("Selects whether a splash screen will be shown as the application starts."));    parent->SetAutoLayout( TRUE );    parent->SetSizer( item0 );}bool ecDisplayOptionsDialog::TransferDataToWindow(){    wxPanel::TransferDataToWindow();    ((wxRadioBox*) FindWindow(ecID_DISPLAY_OPTIONS_INTEGER_ITEMS))->SetSelection( wxGetApp().GetSettings().m_bHex ? 1 : 0 ) ;    ((wxRadioBox*) FindWindow(ecID_DISPLAY_OPTIONS_LABELS))->SetSelection( wxGetApp().GetSettings().m_showMacroNames ? 0 : 1 ) ;    return TRUE;}bool ecDisplayOptionsDialog::TransferDataFromWindow(){    wxPanel::TransferDataFromWindow();    wxGetApp().GetSettings().m_bHex = ((wxRadioBox*) FindWindow(ecID_DISPLAY_OPTIONS_INTEGER_ITEMS))->GetSelection() == 1;    wxGetApp().GetSettings().m_showMacroNames = ((wxRadioBox*) FindWindow(ecID_DISPLAY_OPTIONS_LABELS))->GetSelection() == 0 ;    if (!wxGetApp().GetSettings().GetWindowSettings().GetUseDefaults())        wxGetApp().GetSettings().GetWindowSettings().ApplyFontsToWindows();    return TRUE;}void ecDisplayOptionsDialog::OnChangeFont(wxCommandEvent& event){    wxChoice* choice = (wxChoice*) FindWindow(ecID_DISPLAY_OPTIONS_FONT_CHOICE);    wxString str = choice->GetStringSelection();    if (!str.IsEmpty())    {        wxFontData data;        data.SetInitialFont(wxGetApp().GetSettings().GetWindowSettings().GetFont(str));        wxFontDialog dlg(this, & data);        if (dlg.ShowModal() == wxID_OK)        {            wxGetApp().GetSettings().GetWindowSettings().SetFont(str, dlg.GetFontData().GetChosenFont()) ;            // Changed a font, so start using specified fonts.            wxGetApp().GetSettings().GetWindowSettings().SetUseDefaults(FALSE) ;        }    }}/* Viewer options dialog */IMPLEMENT_CLASS(ecViewerOptionsDialog, wxPanel)BEGIN_EVENT_TABLE(ecViewerOptionsDialog, wxPanel)    EVT_BUTTON(ecID_VIEWER_DIALOG_BROWSE_HEADER, ecViewerOptionsDialog::OnBrowseForViewer)    EVT_BUTTON(ecID_VIEWER_DIALOG_BROWSE_DOC, ecViewerOptionsDialog::OnBrowseForBrowser)    EVT_BUTTON(ecID_VIEWER_DIALOG_ASSOC_INFO, ecViewerOptionsDialog::OnShowAssociatedViewerInfo)    EVT_UPDATE_UI(ecID_VIEWER_DIALOG_HEADER_TEXT, ecViewerOptionsDialog::OnUpdateViewerText)    EVT_UPDATE_UI(ecID_VIEWER_DIALOG_BROWSE_HEADER, ecViewerOptionsDialog::OnUpdateViewerText)    EVT_UPDATE_UI(ecID_VIEWER_DIALOG_DOC_TEXT, ecViewerOptionsDialog::OnUpdateBrowserText)    EVT_UPDATE_UI(ecID_VIEWER_DIALOG_BROWSE_DOC, ecViewerOptionsDialog::OnUpdateBrowserText)END_EVENT_TABLE()ecViewerOptionsDialog::ecViewerOptionsDialog(wxWindow* parent):    wxPanel(parent, ecID_SETTINGS_VIEWER){    CreateControls(this);        SetHelpText(_("The viewer options dialog allows you to configure viewers."));}bool ecViewerOptionsDialog::TransferDataToWindow(){    wxPanel::TransferDataToWindow();    ((wxRadioButton*) FindWindow(ecID_VIEWER_DIALOG_HEADER_ASSOCIATED))->SetValue(! wxGetApp().GetSettings().m_bUseCustomViewer);    ((wxRadioButton*) FindWindow(ecID_VIEWER_DIALOG_HEADER_THIS))->SetValue(wxGetApp().GetSettings().m_bUseCustomViewer);    ((wxRadioButton*) FindWindow(ecID_VIEWER_DIALOG_DOC_BUILTIN))->SetValue(wxGetApp().GetSettings().m_eUseCustomBrowser == ecInternal);    ((wxRadioButton*) FindWindow(ecID_VIEWER_DIALOG_DOC_THIS))->SetValue(wxGetApp().GetSettings().m_eUseCustomBrowser == ecCustomExternal);    ((wxRadioButton*) FindWindow(ecID_VIEWER_DIALOG_DOC_ASSOCIATED))->SetValue(wxGetApp().GetSettings().m_eUseCustomBrowser == ecAssociatedExternal);    return TRUE;}bool ecViewerOptionsDialog::TransferDataFromWindow(){    wxPanel::TransferDataFromWindow();    wxGetApp().GetSettings().m_bUseCustomViewer = ! ((wxRadioButton*) FindWindow(ecID_VIEWER_DIALOG_HEADER_ASSOCIATED))->GetValue();    if (((wxRadioButton*) FindWindow(ecID_VIEWER_DIALOG_DOC_BUILTIN))->GetValue())        wxGetApp().GetSettings().m_eUseCustomBrowser = ecInternal;    else if (((wxRadioButton*) FindWindow(ecID_VIEWER_DIALOG_DOC_THIS))->GetValue())        wxGetApp().GetSettings().m_eUseCustomBrowser = ecCustomExternal;    else if (((wxRadioButton*) FindWindow(ecID_VIEWER_DIALOG_DOC_ASSOCIATED))->GetValue())        wxGetApp().GetSettings().m_eUseCustomBrowser = ecAssociatedExternal;    return TRUE;}void ecViewerOptionsDialog::CreateControls( wxPanel *parent){    wxSizer *item0 = new wxBoxSizer( wxVERTICAL );    wxStaticBox *item2 = new wxStaticBox( parent, -1, _("View header files using") );    wxSizer *item1 = new wxStaticBoxSizer( item2, wxVERTICAL );    wxRadioButton *item3 = new wxRadioButton( parent, ecID_VIEWER_DIALOG_HEADER_ASSOCIATED, _("Associated viewer"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );    item1->Add( item3, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );    wxSizer *item4 = new wxBoxSizer( wxHORIZONTAL );    wxRadioButton *item5 = new wxRadioButton( parent, ecID_VIEWER_DIALOG_HEADER_THIS, _("This &viewer:"), wxDefaultPosition, wxDefaultSize, 0 );    item4->Add( item5, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxBOTTOM, 5 );    item4->Add( 20, 20, 1, wxALIGN_CENTRE|wxALL, 5 );    wxButton *item6 = new wxButton( parent, ecID_VIEWER_DIALOG_BROWSE_HEADER, _("&Browse..."), wxDefaultPosition, wxDefaultSize, 0 );    item4->Add( item6, 0, wxALIGN_CENTRE|wxALL, 5 );    item1->Add( item4, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 0 );    wxTextCtrl *item7 = new wxTextCtrl( parent, ecID_VIEWER_DIALOG_HEADER_TEXT, _(""), wxDefaultPosition, wxSize(80,-1), 0 );    item1->Add( item7, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );    item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );    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 );    wxSizer *item11 = new wxBoxSizer( wxHORIZONTAL );    wxRadioButton *item12 = new wxRadioButton( parent, ecID_VIEWER_DIALOG_DOC_ASSOCIATED, _("Associated browser"), wxDefaultPosition, wxDefaultSize, 0 );    item11->Add( item12, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );    item11->Add( 20, 20, 1, wxALIGN_CENTRE|wxALL, 5 );    wxButton *item13 = new wxButton( parent, ecID_VIEWER_DIALOG_ASSOC_INFO, _("&About..."), wxDefaultPosition, wxDefaultSize, 0 );    item11->Add( item13, 0, wxALIGN_CENTRE|wxALL, 5 );    item8->Add( item11, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 0 );    wxSizer *item14 = new wxBoxSizer( wxHORIZONTAL );    wxRadioButton *item15 = new wxRadioButton( parent, ecID_VIEWER_DIALOG_DOC_THIS, _("This &browser:"), wxDefaultPosition, wxDefaultSize, 0 );    item14->Add( item15, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxBOTTOM, 5 );    item14->Add( 20, 20, 1, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxBOTTOM, 5 );    wxButton *item16 = new wxButton( parent, ecID_VIEWER_DIALOG_BROWSE_DOC, _("Br&owse..."), wxDefaultPosition, wxDefaultSize, 0 );    item14->Add( item16, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxBOTTOM, 5 );    item8->Add( item14, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 0 );    wxTextCtrl *item17 = new wxTextCtrl( parent, ecID_VIEWER_DIALOG_DOC_TEXT, _(""), wxDefaultPosition, wxSize(80,-1), 0 );    item8->Add( item17, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );    item0->Add( item8, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );#if 0    wxSizer *item0 = new wxBoxSizer( wxVERTICAL );    wxStaticBox *item2 = new wxStaticBox( parent, -1, _("View header files using") );    wxSizer *item1 = new wxStaticBoxSizer( item2, wxVERTICAL );    wxRadioButton *item3 = new wxRadioButton( parent, ecID_VIEWER_DIALOG_HEADER_ASSOCIATED, _("Associated viewer"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );    item1->Add( item3, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 );    wxSizer *item4 = new wxBoxSizer( wxHORIZONTAL );    wxRadioButton *item5 = new wxRadioButton( parent, ecID_VIEWER_DIALOG_HEADER_THIS, _("This &viewer:"), wxDefaultPosition, wxDefaultSize, 0 );    item4->Add( item5, 0, wxALIGN_CENTRE|wxLEFT|wxRIGHT|wxBOTTOM, 5 );    item4->Add( 20, 20, 1, wxALIGN_CENTRE|wxALL, 5 );    wxButton *item6 = new wxButton( parent, ecID_VIEWER_DIALOG_BROWSE_HEADER, _("&Browse..."), wxDefaultPosition, wxDefaultSize, 0 );    item4->Add( item6, 0, wxALIGN_CENTRE|wxALL, 5 );    item1->Add( item4, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxBOTTOM, 0 );    wxTextCtrl *item7 = new wxTextCtrl( parent, ecID_VIEWER_DIALOG_HEADER_TEXT, _(""), wxDefaultPosition, wxSize(80,-1), 0 );    item1->Add( item7, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );    item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -