Beispiel #1
0
/* TextEditor::onUpdateUI
 * Called when anything is modified in the text editor (cursor
 * position, styling, text, etc)
 *******************************************************************/
void TextEditor::onUpdateUI(wxStyledTextEvent& e)
{
	// Check for brace match
	if (txed_brace_match)
		checkBraceMatch();

	// If a calltip is open, update it
	if (call_tip->IsShown())
		updateCalltip();

	// Do word matching if appropriate
	if (txed_match_cursor_word && language)
	{
		int word_start = WordStartPosition(GetCurrentPos(), true);
		int word_end = WordEndPosition(GetCurrentPos(), true);
		string current_word = GetTextRange(word_start, word_end);
		if (!current_word.IsEmpty() && HasFocus())
		{
			if (current_word != prev_word_match)
			{
				prev_word_match = current_word;

				SetIndicatorCurrent(8);
				IndicatorClearRange(0, GetTextLength());
				SetTargetStart(0);
				SetTargetEnd(GetTextLength());
				SetSearchFlags(0);
				while (SearchInTarget(current_word) != -1)
				{
					IndicatorFillRange(GetTargetStart(), GetTargetEnd() - GetTargetStart());
					SetTargetStart(GetTargetEnd());
					SetTargetEnd(GetTextLength());
				}
			}
		}
		else
		{
			SetIndicatorCurrent(8);
			IndicatorClearRange(0, GetTextLength());
			prev_word_match = "";
		}
	}

	// Hilight current line
	MarkerDeleteAll(1);
	MarkerDeleteAll(2);
	if (txed_hilight_current_line > 0 && HasFocus())
	{
		int line = LineFromPosition(GetCurrentPos());
		MarkerAdd(line, 1);
		if (txed_hilight_current_line > 1)
			MarkerAdd(line, 2);
	}

	e.Skip();
}
void MiniStyledTextCtrl::Init()
{
    SetMargins(0,0);
    for (unsigned int i = 0 ; i < wxSCI_MAX_MARGIN ; ++i)
        SetMarginWidth(i,0);

    SetZoom(-10); // this is the smallest allowed zoom factor

    SetUseHorizontalScrollBar(false);

    backgroundColour_ = Manager::Get()->GetColourManager()->GetColour(wxT("minidoc_background"));
    ConfigManager *cfg = Manager::Get()->GetConfigManager(_T("editor"));
    inverseMarker_ = cfg->ReadBool(_T("/mini_doc/inverse_designator"), false);
    doScrollToPosition_ = cfg->ReadBool(_T("/mini_doc/sync_to_main_doc"), true);

    bool showVertScrollbar = cfg->ReadBool(_T("/mini_doc/show_vertical_scrollbar"), true);
    SetUseVerticalScrollBar(showVertScrollbar);

    wxColor color = Manager::Get()->GetColourManager()->GetColour(wxT("minidoc_background"));

    MarkerDeleteAll(GetOurMarkerNumber());
    MarkerSetBackground(GetOurMarkerNumber(), color);
    const int alpha = 100;
    MarkerSetAlpha(GetOurMarkerNumber(), alpha);
}
void MiniStyledTextCtrl::Init()
{
    ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("editor"));

    SetMargins(0,0);
    for (unsigned int i = 0 ; i < wxSCI_MAX_MARGIN ; ++i)
        SetMarginWidth(i,0);

    SetZoom(-10); // smallest allowed zoom factor
//    StyleSetSize(wxSCI_STYLE_DEFAULT, 2);
//    for (unsigned int style = 0 ; style < wxSCI_STYLE_MAX ; ++style)
//        StyleSetSize(style, 2);

    SetUseHorizontalScrollBar(false);

    bool showVertScrollbar = cfg->ReadBool(_T("/mini_doc/show_vertical_scrollbar"), true);
    SetUseVerticalScrollBar(showVertScrollbar);

    wxColor color = Manager::Get()->GetColourManager()->GetColour(wxT("minidoc_background"));

    MarkerDeleteAll(GetOurMarkerNumber());
    MarkerSetBackground(GetOurMarkerNumber(), color);
    const int alpha = 100;
    MarkerSetAlpha(GetOurMarkerNumber(), alpha);
}
Beispiel #4
0
/* TextEditor::onFocusLoss
 * Called when the text editor loses focus
 *******************************************************************/
void TextEditor::onFocusLoss(wxFocusEvent& e)
{
	// Hide calltip+autocomplete box
	hideCalltip();
	AutoCompCancel();

	// Hide current line marker
	MarkerDeleteAll(1);
	MarkerDeleteAll(2);

	// Clear word matches
	SetIndicatorCurrent(8);
	IndicatorClearRange(0, GetTextLength());
	prev_word_match = "";

	e.Skip();
}
Beispiel #5
0
	/// Refresh the breakpoint marks.
	void OnChangedBreakpoints(wxDebugEvent &/*event*/) {
		MarkerDeleteAll(MARKNUM_BREAKPOINT);

		BreakpointList &bps = Mediator::Get()->GetBreakpoints();
		Breakpoint bp;
		for (bp = bps.First(GetKey()); bp.IsOk(); bp = bps.Next(bp)) {
			MarkerAdd(bp.GetLine(), MARKNUM_BREAKPOINT);
		}
	}
void DisassemblyTextCtrl::OnDclick(wxMouseEvent& event)
{

        if(GetStatus())
        {
            SetStatus(0);
           PluginsArray plugins = Manager::Get()->GetPluginManager()->GetDebuggerOffers();
            if (plugins.GetCount())
            {
                cbDebuggerPlugin* dbg = (cbDebuggerPlugin*)plugins[0];
                if (dbg)
                {
                    // is the debugger running?
                    if (dbg->IsRunning())
                    {
                        dbg->StepByStep();
                    }
                }
            }
        }
        int LineNum = GetCurrentLine();
        int L2 = GetCurrentLine();
        wxString LineText,SourceFile;
       unsigned long SourceLine=0;

        while(LineNum > 0)
        {
            LineText = GetLine(LineNum--);
            if(reRelativePath.Matches(LineText))
            break;
        }

        if(LineText.IsEmpty())
        return ;

        LineText.AfterLast(_T(':')).ToULong(&SourceLine,10);
        SourceFile = Manager::Get()->GetProjectManager()->GetActiveProject()->GetBasePath();
        SourceFile  <<  LineText.Before(_T(':'));



        SyncEditor(LineText.Before(_T(':')),SourceLine,true);

        SetReadOnly(false);
        MarkerDeleteAll(DEBUG_MARKER);
        MarkerAdd(SourceLine,DEBUG_MARKER);


        SetReadOnly(true);
    //wxMessageBox(wxString::Format(_T("%s:%d"),SourceFile.c_str(),SourceLine));
     event.Skip();

}
Beispiel #7
0
void ZoomText::HighlightLines(int start, int end)
{
    int nLineCount = end - start;
    int lastLine = LineFromPosition(GetLength());
    if(lastLine < end) {
        end = lastLine;
        start = end - nLineCount;
        if(start < 0) start = 0;
    }

    MarkerDeleteAll(1);
    for(int i = start; i <= end; ++i) {
        MarkerAdd(i, 1);
    }
}
void MiniStyledTextCtrl::SetMarker()
{

    Freeze();
    MarkerDeleteAll(GetOurMarkerNumber());
    MarkerSetBackground(GetOurMarkerNumber(), backgroundColour_);
    if (inverseMarker_)
    {
        for (int l = visibleFrom; l < visibleFrom+visibleLength ; ++l)
            MarkerAdd(l, GetOurMarkerNumber());
    }
    else
    {
        for (int l = 0; l < visibleFrom ; ++l)
            MarkerAdd(l, GetOurMarkerNumber());
        for (int l = visibleFrom+visibleLength; l < GetLineCount() ; ++l)
            MarkerAdd(l, GetOurMarkerNumber());
    }
    Thaw();
}
void MiniStyledTextCtrl::SetMarker()
{
    ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("editor"));
    bool inverse = cfg->ReadBool(_T("/mini_doc/inverse_designator"), false);
    Freeze();
    wxColor color = Manager::Get()->GetColourManager()->GetColour(wxT("minidoc_background"));
    MarkerDeleteAll(GetOurMarkerNumber());
    MarkerSetBackground(GetOurMarkerNumber(), color);
    if (inverse)
    {
        for (int l = visibleFrom; l < visibleFrom+visibleLength ; ++l)
            MarkerAdd(l, GetOurMarkerNumber());
    }
    else
    {
        for (int l = 0; l < visibleFrom ; ++l)
            MarkerAdd(l, GetOurMarkerNumber());
        for (int l = visibleFrom+visibleLength; l < GetLineCount() ; ++l)
            MarkerAdd(l, GetOurMarkerNumber());
    }
    Thaw();
}