ReplaceInFilesPanel::ReplaceInFilesPanel(wxWindow* parent, int id, const wxString& name)
    : FindResultsTab(parent, id, name)
{
    Bind(wxEVT_UPDATE_UI, &ReplaceInFilesPanel::OnHoldOpenUpdateUI, this, XRCID("hold_pane_open"));
    wxBoxSizer* horzSizer = new wxBoxSizer(wxHORIZONTAL);

    wxButton* unmark = new wxButton(this, wxID_ANY, _("&Unmark All"));
    horzSizer->Add(unmark, 0, wxRIGHT | wxLEFT | wxALIGN_CENTER_VERTICAL, 5);
    unmark->Bind(wxEVT_BUTTON, &ReplaceInFilesPanel::OnUnmarkAll, this);
    unmark->Bind(wxEVT_UPDATE_UI, &ReplaceInFilesPanel::OnUnmarkAllUI, this);

    wxButton* mark = new wxButton(this, wxID_ANY, _("Mark &All"));
    horzSizer->Add(mark, 0, wxRIGHT | wxLEFT | wxALIGN_CENTER_VERTICAL, 5);
    mark->Bind(wxEVT_BUTTON, &ReplaceInFilesPanel::OnMarkAll, this);
    mark->Bind(wxEVT_UPDATE_UI, &ReplaceInFilesPanel::OnMarkAllUI, this);

    m_replaceWithText = new wxStaticText(this, wxID_ANY, _("Replace With:"));
    horzSizer->Add(m_replaceWithText, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5);
    m_replaceWithText->Bind(wxEVT_UPDATE_UI, &ReplaceInFilesPanel::OnReplaceWithComboUI, this);

    m_replaceWith = new wxComboBox(this, wxID_ANY);
    horzSizer->Add(m_replaceWith, 2, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxLEFT, 5);
    m_replaceWith->Bind(wxEVT_UPDATE_UI, &ReplaceInFilesPanel::OnReplaceWithComboUI, this);

    wxButton* repl = new wxButton(this, wxID_ANY, _("&Replace Marked"));
    horzSizer->Add(repl, 0, wxRIGHT | wxLEFT | wxALIGN_CENTER_VERTICAL, 5);
    repl->Bind(wxEVT_BUTTON, &ReplaceInFilesPanel::OnReplace, this);
    repl->Bind(wxEVT_UPDATE_UI, &ReplaceInFilesPanel::OnReplaceUI, this);

    m_progress = new wxGauge(this, wxID_ANY, 1, wxDefaultPosition, wxSize(-1, 15), wxGA_HORIZONTAL);
    horzSizer->Add(m_progress, 1, wxALIGN_CENTER_VERTICAL | wxALL | wxGA_SMOOTH, 5);

    wxBoxSizer* vertSizer = new wxBoxSizer(wxVERTICAL);
    vertSizer->Add(horzSizer, 0, wxEXPAND | wxTOP | wxBOTTOM);

    // grab the base class scintilla and put our sizer in its place
    wxSizer* mainSizer = m_vSizer;
    mainSizer->Detach(m_sci);
    vertSizer->Add(m_sci, 1, wxEXPAND | wxALL, 1);

    m_tb->DeleteTool(XRCID("repeat_output"));
    m_tb->DeleteTool(XRCID("recent_searches"));
    m_tb->Realize();

#ifdef __WXMAC__
    mainSizer->Insert(0, vertSizer, 1, wxEXPAND);
#else
    mainSizer->Add(vertSizer, 1, wxEXPAND);
#endif
    mainSizer->Layout();

    m_sci->SetMarginMask(4, 7 << 0x7 | wxSTC_MASK_FOLDERS);
    DefineMarker(
        m_sci, 0x7, wxSTC_MARK_SMALLRECT, wxColor(0x00, 0x80, 0x00), wxColor(0x00, 0xc0, 0x00));       // user selection
    DefineMarker(m_sci, 0x8, wxSTC_MARK_CIRCLE, wxColor(0x80, 0x00, 0x00), wxColor(0xff, 0x00, 0x00)); // error occurred
    DefineMarker(
        m_sci, 0x9, wxSTC_MARK_EMPTY, wxColor(0x00, 0x00, 0x00), wxColor(0x00, 0x00, 0x00)); // replacement successful
}
示例#2
0
/**
 * Init some default values
 */
void CScintillaBibWnd::Init()
{
	CScintillaWnd::Init();

	SetDisplayFolding(TRUE);
	SetDisplayLinenumbers(TRUE);
	SetDisplaySelection(FALSE);

	// BibTeX
	LoadLexerLib(LEXBIB_LIB);
	SetLexer(LEXBIB_NAME);
	SetWrap(SC_WRAP_WORD);
	// Setup some BibTeX styles
	SetForeground(SCE_L_COMMAND, RGB(0, 0, 160));
	SetForeground(SCE_L_MATH, RGB(150, 150, 40));
	SetForeground(SCE_L_COMMENT, RGB(0, 128, 0));
	SetForeground(SCE_L_TAG, RGB(0, 0, 255));
	SetItalic(SCE_L_COMMENT, TRUE);
	SetBold(SCE_BIB_ITEM, TRUE);
	SetBold(SCE_BIB_END, TRUE);
	SetForeground(SCE_BIB_END, RGB(255, 0, 0));
	SetBold(SCE_BIB_START, TRUE);
	SetForeground(SCE_BIB_START, RGB(255, 0, 0));
	SetForeground(SCE_BIB_FIELD, RGB(140, 0, 70));
	SetForeground(SCE_BIB_KEY, RGB(140, 0, 0));
	SetBold(SCE_BIB_KEY, TRUE);
	// We also need HTML
	SetBold(SCE_H_ATTRIBUTEUNKNOWN, FALSE);
	SetBold(SCE_H_ATTRIBUTE, FALSE);
	SetBold(SCE_H_SINGLESTRING, FALSE);
	SetBold(SCE_H_DOUBLESTRING, FALSE);
	SetBold(SCE_H_TAG, TRUE);
	SetBold(SCE_H_TAGUNKNOWN, TRUE);
	SetForeground(SCE_H_TAGUNKNOWN, RGB(255, 0, 0));
//	SetItalic(SCE_H_COMMENT, TRUE);

	// Marker
	DefineMarker(SC_MARKNUM_FOLDEROPEN, SC_MARK_MINUS, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0xFF));
	DefineMarker(SC_MARKNUM_FOLDER, SC_MARK_PLUS, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0));
	DefineMarker(SC_MARKNUM_FOLDERSUB, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0));
	DefineMarker(SC_MARKNUM_FOLDERTAIL, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0));
	DefineMarker(SC_MARKNUM_FOLDEREND, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0));
	DefineMarker(SC_MARKNUM_FOLDEROPENMID, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0));
	DefineMarker(SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0));
}
示例#3
0
void CCsgIdeView::OnInitialUpdate()
{
	CScintillaView::OnInitialUpdate();

	CScintillaCtrl& rCtrl = GetCtrl();

	//Setup the Lexer
	rCtrl.SetLexer(SCLEX_LUA);
	rCtrl.StyleSetFont(STYLE_DEFAULT, "Consolas");
	rCtrl.StyleSetSize(STYLE_DEFAULT, 10);
	rCtrl.SetKeyWords(0, LuaKeywords);

	//Setup styles
	SetAStyle(STYLE_DEFAULT, RGB(0, 0, 0), RGB(0xff, 0xff, 0xff), 11, "Consolas");
	rCtrl.StyleClearAll();
	SetAStyle(SCE_LUA_DEFAULT, RGB(0, 0, 0));
	SetAStyle(SCE_LUA_COMMENT, RGB(0, 0x80, 0));
	SetAStyle(SCE_LUA_COMMENTLINE, RGB(0, 0x80, 0));
	SetAStyle(SCE_LUA_COMMENTDOC, RGB(0, 0x80, 0));
	SetAStyle(SCE_LUA_NUMBER, RGB(0, 0x80, 0x80));
	SetAStyle(SCE_LUA_WORD, RGB(0, 0, 0x80));
	//rCtrl.StyleSetBold(SCE_LUA_WORD, 1);
	SetAStyle(SCE_LUA_STRING, RGB(0x80, 0, 0x80));
	SetAStyle(SCE_LUA_IDENTIFIER, RGB(0, 0, 0));
	SetAStyle(SCE_LUA_PREPROCESSOR, RGB(0x80, 0, 0));
	SetAStyle(SCE_LUA_OPERATOR, RGB(0x80, 0x80, 0));

	rCtrl.SetKeyWords(1, LuaFunctions);
	SetAStyle(SCE_LUA_WORD2, RGB(0x20, 0x20, 0x80));
	//rCtrl.StyleSetBold(SCE_LUA_WORD2, 1);

	rCtrl.SetKeyWords(2, UserFunctions);
	SetAStyle(SCE_LUA_WORD3, RGB(150, 0, 50));
	//rCtrl.StyleSetBold(SCE_LUA_WORD3, 1);

	rCtrl.SetKeyWords(3, UserConstants);
	SetAStyle(SCE_LUA_WORD4, RGB(255, 0, 0));
	//rCtrl.StyleSetBold(SCE_LUA_WORD4, 1);

	rCtrl.SetKeyWords(4, UserVariables);
	SetAStyle(SCE_LUA_WORD5, RGB(200, 50, 0));
	//rCtrl.StyleSetBold(SCE_LUA_WORD5, 1);

	//Setup folding
	rCtrl.SetMarginWidthN(2, 16);
	rCtrl.SetMarginSensitiveN(2, TRUE);
	rCtrl.SetMarginTypeN(2, SC_MARGIN_SYMBOL);
	rCtrl.SetMarginMaskN(2, SC_MASK_FOLDERS);
	rCtrl.SetProperty(_T("fold"), _T("1"));

	rCtrl.SetTabWidth(4);

	//Setup markers
	DefineMarker(SC_MARKNUM_FOLDEROPEN, SC_MARK_MINUS, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0xFF));
	DefineMarker(SC_MARKNUM_FOLDER, SC_MARK_PLUS, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0));
	DefineMarker(SC_MARKNUM_FOLDERSUB, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0));
	DefineMarker(SC_MARKNUM_FOLDERTAIL, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0));
	DefineMarker(SC_MARKNUM_FOLDEREND, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0));
	DefineMarker(SC_MARKNUM_FOLDEROPENMID, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0));
	DefineMarker(SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0));

	//Setup auto completion
	rCtrl.AutoCSetSeparator(10); //Use a separator of line feed

	//Setup call tips
	rCtrl.SetMouseDwellTime(1000);

	//Enable Multiple selection
	rCtrl.SetMultipleSelection(TRUE);

	CDocument *pDoc = GetDocument();
	LoadFile(pDoc->GetPathName());
}
示例#4
0
void OutputTabWindow::InitStyle(wxStyledTextCtrl* sci, int lexer, bool folding)
{
    sci->SetLexer(lexer);
    sci->StyleClearAll();

    for(int i = 0; i <= wxSTC_STYLE_DEFAULT; i++) {
        sci->StyleSetBackground(i, DrawingUtils::GetOutputPaneBgColour());
        sci->StyleSetForeground(i, DrawingUtils::GetOutputPaneFgColour());
    }

    wxFont defFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
    wxFont font = EditorConfigST::Get()->GetLexer("text")->GetFontForSyle(0);
    sci->StyleSetFont(0, font);

    sci->SetIndicatorCurrent(1);
#ifdef __WXMSW__
    int facttor = 2;
#else
    int facttor = 5;
#endif
    sci->IndicatorSetForeground(1, MakeColourLighter(wxT("GOLD"), facttor));
    sci->IndicatorSetForeground(2, MakeColourLighter(wxT("RED"), 4));
    sci->IndicatorSetStyle(1, wxSTC_INDIC_ROUNDBOX);
    sci->IndicatorSetStyle(2, wxSTC_INDIC_ROUNDBOX);
    sci->IndicatorSetUnder(1, true);
    sci->IndicatorSetUnder(2, true);

    // sci->IndicatorSetAlpha(1, 70);
    // sci->IndicatorSetAlpha(2, 70);

    sci->SetHotspotActiveUnderline(true);
    sci->SetHotspotActiveForeground(true, wxT("BLUE"));
    sci->SetHotspotSingleLine(true);
    sci->SetMarginType(1, wxSTC_MARGIN_SYMBOL);
    sci->SetMarginMask(4, wxSTC_MASK_FOLDERS);

    sci->SetMarginWidth(0, 0);
    sci->SetMarginWidth(1, 0);
    sci->SetMarginWidth(2, 0);

    if(folding) {
        sci->SetMarginWidth(4, 16);
        sci->SetProperty(wxT("fold"), wxT("1"));
        sci->SetMarginSensitive(4, true);
    }

    // current line marker
    DefineMarker(sci, 0x7, wxSTC_MARK_ARROW, wxColor(0x00, 0x00, 0x00), wxColor(0xff, 0xc8, 0xc8));

    wxColor fore(0xff, 0xff, 0xff);
    wxColor back(0x80, 0x80, 0x80);
    DefineMarker(sci, wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_ARROWDOWN, fore, back);
    DefineMarker(sci, wxSTC_MARKNUM_FOLDER, wxSTC_MARK_ARROW, fore, back);
    DefineMarker(sci, wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_BACKGROUND, fore, back);
    DefineMarker(sci, wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_BACKGROUND, fore, back);
    DefineMarker(sci, wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_ARROW, fore, back);
    DefineMarker(sci, wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_ARROWDOWN, fore, back);
    DefineMarker(sci, wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_BACKGROUND, fore, back);

    sci->SetWrapStartIndent(4);
    sci->SetWrapVisualFlags(2);

    sci->SetScrollWidthTracking(true);

    sci->SetReadOnly(true);
}
示例#5
0
void CCppDocContentView::OnInitialUpdate()
{
	//Let the base class do its thing
	CScintillaView::OnInitialUpdate();

	CScintillaCtrl& rCtrl = GetCtrl();

	//Setup the Lexer
	rCtrl.SetLexer(SCLEX_CPP);
	rCtrl.SetKeyWords(0, cppKeyWords);

	//Setup styles
	SetAStyle(STYLE_DEFAULT, RGB(0, 0, 0), RGB(0xff, 0xff, 0xff), 10, "Verdana");
	rCtrl.StyleClearAll();
	SetAStyle(SCE_C_DEFAULT, RGB(0, 0, 0));
	SetAStyle(SCE_C_COMMENT, RGB(0, 0x80, 0));
	SetAStyle(SCE_C_COMMENTLINE, RGB(0, 0x80, 0));
	SetAStyle(SCE_C_COMMENTDOC, RGB(0, 0x80, 0));
	SetAStyle(SCE_C_COMMENTLINEDOC, RGB(0, 0x80, 0));
	SetAStyle(SCE_C_COMMENTDOCKEYWORD, RGB(0, 0x80, 0));
	SetAStyle(SCE_C_COMMENTDOCKEYWORDERROR, RGB(0, 0x80, 0));
	SetAStyle(SCE_C_NUMBER, RGB(0, 0x80, 0x80));
	SetAStyle(SCE_C_WORD, RGB(0, 0, 0x80));
	rCtrl.StyleSetBold(SCE_C_WORD, 1);
	SetAStyle(SCE_C_STRING, RGB(0x80, 0, 0x80));
	SetAStyle(SCE_C_IDENTIFIER, RGB(0, 0, 0));
	SetAStyle(SCE_C_PREPROCESSOR, RGB(0x80, 0, 0));
	SetAStyle(SCE_C_OPERATOR, RGB(0x80, 0x80, 0));

	//Setup folding
	rCtrl.SetMarginWidthN(2, 16);
	rCtrl.SetMarginSensitiveN(2, TRUE);
	rCtrl.SetMarginTypeN(2, SC_MARGIN_SYMBOL);
	rCtrl.SetMarginMaskN(2, SC_MASK_FOLDERS);
	rCtrl.SetProperty(_T("fold"), _T("1"));

	//Setup markers
	DefineMarker(SC_MARKNUM_FOLDEROPEN, SC_MARK_MINUS, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0xFF));
	DefineMarker(SC_MARKNUM_FOLDER, SC_MARK_PLUS, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0));
	DefineMarker(SC_MARKNUM_FOLDERSUB, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0));
	DefineMarker(SC_MARKNUM_FOLDERTAIL, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0));
	DefineMarker(SC_MARKNUM_FOLDEREND, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0));
	DefineMarker(SC_MARKNUM_FOLDEROPENMID, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0));
	DefineMarker(SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0));

	//Setup auto completion
	rCtrl.AutoCSetSeparator(10); //Use a separator of line feed

	//Setup call tips
	rCtrl.SetMouseDwellTime(1000);

	//Enable Multiple selection
	rCtrl.SetMultipleSelection(TRUE);

	//Set Tab width to 2 characters
	rCtrl.SetTabWidth(2);

	//Turn off default context menu
	rCtrl.SendMessage(SCI_USEPOPUP, 0, 0);

	//Turn on line numbers
	rCtrl.SetMarginWidthN(0, 32);

#ifdef _DEBUG
	AfxDump(this);
#endif
}