示例#1
0
void SyntaxHighlightDlg::SaveChanges()
{
    int max = m_lexersBook->GetPageCount();
    for (int i=0; i<max; i++) {
        wxWindow *win = m_lexersBook->GetPage((size_t)i);
        LexerPage *page = dynamic_cast<LexerPage*>( win );
        if ( page ) {
            page->SaveSettings();
        }
    }

    // Save all lexers once
    EditorConfigST::Get()->SaveLexers();

    wxString oldFg = EditorConfigST::Get()->GetCurrentOutputviewFgColour();
    wxString oldBg = EditorConfigST::Get()->GetCurrentOutputviewBgColour();

    wxString newFg = m_colourPickerOutputPanesFgColour->GetColour().GetAsString(wxC2S_HTML_SYNTAX);
    EditorConfigST::Get()->SetCurrentOutputviewFgColour(newFg);

    wxString newBg = m_colourPickerOutputPanesBgColour->GetColour().GetAsString(wxC2S_HTML_SYNTAX);
    EditorConfigST::Get()->SetCurrentOutputviewBgColour(newBg);

    // Check for conditions for sending the THEME_CHANGED event
    wxString curSelTheme = m_themes->GetStringSelection().IsEmpty() ? wxT("Default") : m_themes->GetStringSelection();

    if ( (oldBg != newBg) || (oldFg != newFg) || (m_startingTheme != curSelTheme) ) {
        wxCommandEvent evtThemeChanged(wxEVT_CL_THEME_CHANGED);
        EventNotifier::Get()->AddPendingEvent(evtThemeChanged);
    }
}
void OptionsDlg::SaveChanges()
{
	int max = m_lexersBook->GetPageCount();
	for(int i=0; i<max; i++){
		wxWindow *win = m_lexersBook->GetPage((size_t)i);
		LexerPage *page = dynamic_cast<LexerPage*>( win );
		if( page ){
			page->SaveSettings();
		}
	}

	// construct an OptionsConfig object and update the configuration
	OptionsConfigPtr options(new OptionsConfig(NULL));
	options->SetDisplayFoldMargin( m_checkBoxDisplayFoldMargin->IsChecked() );
	options->SetUnderlineFoldLine( m_checkBoxMarkFoldedLine->IsChecked() );
	options->SetFoldStyle(m_foldStyleChoice->GetStringSelection());
	options->SetDisplayBookmarkMargin(m_displayBookmarkMargin->IsChecked());
	options->SetBookmarkShape( m_bookmarkShape->GetStringSelection());
	options->SetBookmarkBgColour( m_bgColourPicker->GetColour() );
	options->SetBookmarkFgColour( m_fgColourPicker->GetColour() );
	options->SetHighlightCaretLine( m_highlighyCaretLine->IsChecked() );
	options->SetDisplayLineNumbers( m_displayLineNumbers->IsChecked() );
	options->SetShowIndentationGuidelines( m_showIndentationGuideLines->IsChecked() );
	
	EditorConfigST::Get()->SetOptions(options);
	ManagerST::Get()->ApplySettingsChanges();
}