Пример #1
0
void EditorSettingsLocal::DisplayHigherValues(const OptionsConfigPtr options)
{
    // There should be 'global' (or workspace if this will be a project setting) values for each setting
    // Insert them all, but leave the enabling checkboxes ticked, so the items will be disabled
    m_indentsUsesTabs->SetValue(options->GetIndentUsesTabs());
    m_indentWidth->SetValue(options->GetIndentWidth());
    m_tabWidth->SetValue(options->GetTabWidth());
    m_displayLineNumbers->SetValue(options->GetDisplayLineNumbers());
    m_showIndentationGuideLines->SetValue(options->GetShowIndentationGuidelines());

    m_highlightCaretLine->SetValue(options->GetHighlightCaretLine());
    m_checkBoxTrimLine->SetValue(options->GetTrimLine());
    m_checkBoxAppendLF->SetValue(options->GetAppendLF());

    m_checkBoxHideChangeMarkerMargin->SetValue(options->GetHideChangeMarkerMargin());
    m_checkBoxDisplayFoldMargin->SetValue(options->GetDisplayFoldMargin());
    m_displayBookmarkMargin->SetValue(options->GetDisplayBookmarkMargin());

    const wxString WhitespaceStyle[] = { wxTRANSLATE("Invisible"), wxTRANSLATE("Visible always"),
        wxTRANSLATE("Visible after indentation"), wxTRANSLATE("Indentation only") };
    wxString currentWhitespace;
    switch(options->GetShowWhitspaces()) {
    case wxSTC_WS_VISIBLEALWAYS:
        currentWhitespace = wxT("Visible always");
        break;
    case wxSTC_WS_VISIBLEAFTERINDENT:
        currentWhitespace = wxT("Visible after indentation");
        break;
    default:
        currentWhitespace = wxT("Invisible");
        break;
    }
    m_WSstringManager.AddStrings(
        sizeof(WhitespaceStyle) / sizeof(wxString), WhitespaceStyle, currentWhitespace, m_whitespaceStyle);

    const wxString EOLChoices[] = { wxTRANSLATE("Default"), wxT("Mac (CR)"), wxT("Windows (CRLF)"), wxT("Unix (LF)") };
    m_EOLstringManager.AddStrings(
        sizeof(EOLChoices) / sizeof(wxString), EOLChoices, options->GetEolMode(), m_choiceEOL);

    wxArrayString astrEncodings;
    wxFontEncoding fontEnc;
    int iCurrSelId = 0;
    size_t iEncCnt = wxFontMapper::GetSupportedEncodingsCount();
    for(size_t i = 0; i < iEncCnt; i++) {
        fontEnc = wxFontMapper::GetEncoding(i);
        if(wxFONTENCODING_SYSTEM == fontEnc) { // skip system, it is changed to UTF-8 in optionsconfig
            continue;
        }
        astrEncodings.Add(wxFontMapper::GetEncodingName(fontEnc));
        if(fontEnc == options->GetFileFontEncoding()) {
            iCurrSelId = i;
        }
    }
    m_fileEncoding->Append(astrEncodings);
    m_fileEncoding->SetSelection(iCurrSelId);
}
wxPanel *OptionsDlg::CreateGeneralPage()
{
	OptionsConfigPtr options = EditorConfigST::Get()->GetOptions();
	m_general = new wxPanel( m_book, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
	wxBoxSizer* vSz1;
	vSz1 = new wxBoxSizer( wxVERTICAL );
	
	wxStaticBoxSizer* sbSizer1;
	sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( m_general, -1, wxT("Folding:") ), wxVERTICAL );
	
	m_checkBoxDisplayFoldMargin = new wxCheckBox( m_general, wxID_ANY, wxT("Display Folding Margin"), wxDefaultPosition, wxDefaultSize, 0 );
	m_checkBoxDisplayFoldMargin->SetValue(options->GetDisplayFoldMargin());

	sbSizer1->Add( m_checkBoxDisplayFoldMargin, 0, wxALL, 5 );
	
	m_checkBoxMarkFoldedLine = new wxCheckBox( m_general, wxID_ANY, wxT("Underline Folded Line"), wxDefaultPosition, wxDefaultSize, 0 );
	m_checkBoxMarkFoldedLine->SetValue(options->GetUnderlineFoldLine());

	sbSizer1->Add( m_checkBoxMarkFoldedLine, 0, wxALL, 5 );
	
	m_staticText1 = new wxStaticText( m_general, wxID_ANY, wxT("Fold Style:"), wxDefaultPosition, wxDefaultSize, 0 );
	sbSizer1->Add( m_staticText1, 0, wxALL, 5 );
	
	wxString m_foldStyleChoiceChoices[] = { wxT("Simple"), wxT("Arrows"), wxT("Flatten Tree Square Headers"), wxT("Flatten Tree Circular Headers") };
	int m_foldStyleChoiceNChoices = sizeof( m_foldStyleChoiceChoices ) / sizeof( wxString );
	m_foldStyleChoice = new wxChoice( m_general, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_foldStyleChoiceNChoices, m_foldStyleChoiceChoices, 0 );
	sbSizer1->Add( m_foldStyleChoice, 0, wxALL|wxEXPAND, 5 );
	m_foldStyleChoice->SetStringSelection( options->GetFoldStyle() );
	
	vSz1->Add( sbSizer1, 0, wxEXPAND, 5 );
	
	wxStaticBoxSizer* sbSizer3;
	sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( m_general, -1, wxT("Bookmarks:") ), wxVERTICAL );
	
	m_displayBookmarkMargin = new wxCheckBox( m_general, wxID_ANY, wxT("Display Selection / Bookmark margin"), wxDefaultPosition, wxDefaultSize, 0 );
	m_displayBookmarkMargin->SetValue(options->GetDisplayBookmarkMargin());

	sbSizer3->Add( m_displayBookmarkMargin, 0, wxALL, 5 );
	
	m_staticText6 = new wxStaticText( m_general, wxID_ANY, wxT("Bookmark Shape:"), wxDefaultPosition, wxDefaultSize, 0 );
	sbSizer3->Add( m_staticText6, 0, wxALL, 5 );
	
	wxString m_bookmarkShapeChoices[] = { wxT("Small Rectangle"), wxT("Rounded Rectangle"), wxT("Circle"), wxT("Small Arrow") };
	int m_bookmarkShapeNChoices = sizeof( m_bookmarkShapeChoices ) / sizeof( wxString );
	m_bookmarkShape = new wxChoice( m_general, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_bookmarkShapeNChoices, m_bookmarkShapeChoices, 0 );
	sbSizer3->Add( m_bookmarkShape, 0, wxALL|wxEXPAND, 5 );
	m_bookmarkShape->SetStringSelection(options->GetBookmarkShape());

	wxGridSizer* gSizer1;
	gSizer1 = new wxGridSizer( 2, 2, 0, 0 );
	
	m_staticText4 = new wxStaticText( m_general, wxID_ANY, wxT("Select the bookmark background colour:"), wxDefaultPosition, wxDefaultSize, 0 );
	gSizer1->Add( m_staticText4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
	
	m_bgColourPicker = new wxColourPickerCtrl(m_general, wxID_ANY, options->GetBookmarkBgColour(), wxDefaultPosition, wxDefaultSize, wxCLRP_SHOW_LABEL);
	gSizer1->Add( m_bgColourPicker, 0, wxALIGN_RIGHT|wxALL, 5 );
	
	m_staticText5 = new wxStaticText( m_general, wxID_ANY, wxT("Select the bookmark forground colour:"), wxDefaultPosition, wxDefaultSize, 0 );
	gSizer1->Add( m_staticText5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
	
	m_fgColourPicker = new wxColourPickerCtrl( m_general, wxID_ANY, options->GetBookmarkFgColour(), wxDefaultPosition, wxDefaultSize, wxCLRP_SHOW_LABEL);
	gSizer1->Add( m_fgColourPicker, 0, wxALIGN_RIGHT|wxALL, 5 );
	
	sbSizer3->Add( gSizer1, 1, wxEXPAND, 5 );
	
	vSz1->Add( sbSizer3, 0, wxEXPAND, 5 );
	
	wxStaticBoxSizer* sbSizer4;
	sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( m_general, -1, wxT("General:") ), wxVERTICAL );
	
	wxFlexGridSizer* fgSizer;
	fgSizer = new wxFlexGridSizer( 3, 2, 0, 0 );
	
	m_highlighyCaretLine = new wxCheckBox( m_general, wxID_ANY, wxT("Highlight Caret Line"), wxDefaultPosition, wxDefaultSize, 0 );
	m_highlighyCaretLine->SetValue(options->GetHighlightCaretLine());
	fgSizer->Add( m_highlighyCaretLine, 0, wxALL, 5 );
	
	m_displayLineNumbers = new wxCheckBox( m_general, wxID_ANY, wxT("Dsiplay Line Numbers"), wxDefaultPosition, wxDefaultSize, 0 );
	m_displayLineNumbers->SetValue(options->GetDisplayLineNumbers());
	fgSizer->Add( m_displayLineNumbers, 0, wxALL, 5 );
	
	m_showIndentationGuideLines = new wxCheckBox( m_general, wxID_ANY, wxT("Show Indentation Guidelines"), wxDefaultPosition, wxDefaultSize, 0 );
	m_showIndentationGuideLines->SetValue(options->GetShowIndentationGuidelines());

	fgSizer->Add( m_showIndentationGuideLines, 0, wxALL, 5 );
	
	sbSizer4->Add( fgSizer, 1, wxEXPAND, 5 );
	
	vSz1->Add( sbSizer4, 0, wxEXPAND, 5 );
	
	m_general->SetSizer( vSz1 );
	m_general->Layout();
	vSz1->Fit( m_general );
	return m_general;
}