Example #1
0
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);
}
Example #2
0
void ZoomText::UpdateLexer(IEditor* editor)
{
    if(!editor) {
        editor = clGetManager()->GetActiveEditor();
    }
    if(!editor) {
        DoClear();
        return;
    }

    znConfigItem data;
    clConfig conf("zoom-navigator.conf");
    conf.ReadItem(&data);

    m_filename = editor->GetFileName().GetFullPath();
    LexerConf::Ptr_t lexer = EditorConfigST::Get()->GetLexerForFile(m_filename);
    if(!lexer) {
        lexer = EditorConfigST::Get()->GetLexer("Text");
    }
    lexer->Apply(this, true);

    if(lexer->IsDark()) {
        MarkerSetAlpha(1, 10);
    } else {
        MarkerSetAlpha(1, 20);
    }

    SetZoom(m_zoomFactor);
    SetEditable(false);
    SetUseHorizontalScrollBar(false);
    SetUseVerticalScrollBar(data.IsUseScrollbar());
    HideSelection(true);
    MarkerSetBackground(1, m_colour);
}
Example #3
0
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);
}
Example #4
0
ZoomText::ZoomText(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style,
                   const wxString& name)
{
    Hide();
    if(!wxStyledTextCtrl::Create(parent, id, pos, size, style | wxNO_BORDER, name)) {
        return;
    }

    wxColour bgColour = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX);
    for(int i = 0; i < wxSTC_STYLE_MAX; ++i) {
        StyleSetBackground(i, bgColour);
    }

    znConfigItem data;
    clConfig conf("zoom-navigator.conf");
    conf.ReadItem(&data);

    SetEditable(false);
    SetUseHorizontalScrollBar(false);
    SetUseVerticalScrollBar(data.IsUseScrollbar());
    HideSelection(true);

    SetMarginWidth(1, 0);
    SetMarginWidth(2, 0);
    SetMarginWidth(3, 0);

    m_zoomFactor = data.GetZoomFactor();
    m_colour = data.GetHighlightColour();
    MarkerSetBackground(1, m_colour);
    SetZoom(m_zoomFactor);
    EventNotifier::Get()->Connect(wxEVT_ZN_SETTINGS_UPDATED, wxCommandEventHandler(ZoomText::OnSettingsChanged), NULL,
                                  this);
    EventNotifier::Get()->Connect(wxEVT_CL_THEME_CHANGED, wxCommandEventHandler(ZoomText::OnThemeChanged), NULL, this);
    MarkerDefine(1, wxSTC_MARK_BACKGROUND, m_colour, m_colour);

#ifndef __WXMSW__
    SetTwoPhaseDraw(false);
    SetBufferedDraw(false);
    SetLayoutCache(wxSTC_CACHE_DOCUMENT);
#endif
    MarkerSetAlpha(1, 10);

    m_timer = new wxTimer(this);
    Bind(wxEVT_TIMER, &ZoomText::OnTimer, this, m_timer->GetId());
    Show();
}
Example #5
0
ZoomText::ZoomText(wxWindow* parent,
                   wxWindowID id,
                   const wxPoint& pos,
                   const wxSize& size,
                   long style,
                   const wxString& name)
    : wxStyledTextCtrl(parent, id, pos, size, style | wxNO_BORDER, name)
{
    znConfigItem data;
    clConfig conf("zoom-navigator.conf");
    conf.ReadItem(&data);
    
    SetEditable(false);
    SetUseHorizontalScrollBar(false);
    SetUseVerticalScrollBar(data.IsUseScrollbar());
    HideSelection(true);

    SetMarginWidth(1, 0);
    SetMarginWidth(2, 0);
    SetMarginWidth(3, 0);


    m_zoomFactor = data.GetZoomFactor();
    m_colour = data.GetHighlightColour();
    MarkerSetBackground(1, m_colour);
    SetZoom(m_zoomFactor);
    EventNotifier::Get()->Connect(
        wxEVT_ZN_SETTINGS_UPDATED, wxCommandEventHandler(ZoomText::OnSettingsChanged), NULL, this);
    EventNotifier::Get()->Connect(wxEVT_CL_THEME_CHANGED, wxCommandEventHandler(ZoomText::OnThemeChanged), NULL, this);
    MarkerDefine(1, wxSTC_MARK_BACKGROUND, m_colour, m_colour);

#ifndef __WXMSW__
    SetTwoPhaseDraw(false);
    SetBufferedDraw(false);
    SetLayoutCache(wxSTC_CACHE_DOCUMENT);
#endif
    MarkerSetAlpha(1, 10);
    wxTheApp->Bind(wxEVT_IDLE, &ZoomText::OnIdle, this);
}