Opened 10 years ago

Last modified 10 years ago

#13709 new defect

wxSTC marker lines should not have borders

Reported by: obfuscated Owned by:
Priority: normal Milestone:
Component: wxStyledText Version: stable-latest
Keywords: stc scintilla Cc:
Blocked By: Blocking:
Patch: yes

Description

I'm trying to implement svn blame kind of application using wxGTK-2.9 and wxStyledTextCtrl. What I want in my app is to set the background color for every revision differently. I've found that I need to add different markers for the lines and I should make the margins to ignore the marker. I've tried it and I think there is a bug in wxSTC, because every line has a border and it looks very bad. I've talked to the Scintilla's developer and he said that normal scintilla doesn't have this problem. Here is the thread in the mailing list: http://groups.google.com/group/scintilla-interest/browse_thread/thread/1402361e349894b9 .

Also I've dug the sources of wxSTC and I think, that I've found the problem.
I've attached a patch which fixes the problem and also adds some markers to the stctest sample to demonstrate that it is really fixed.

Attachments (2)

wxstc.patch download (1.2 KB) - added by obfuscated 10 years ago.
scintilla_markers.png download (25.4 KB) - added by obfuscated 10 years ago.
Broken screen shot

Download all attachments as: .zip

Change History (6)

Changed 10 years ago by obfuscated

Changed 10 years ago by obfuscated

Broken screen shot

comment:1 Changed 10 years ago by vadz

I'm not sure this patch is correct as outline argument is not used at all any longer. Perhaps we don't handle whichever value indicates "transparent" in it but I don't think we should simply ignore it completely.

Moreover, I don't see black borders with current wxGTK from svn with this patch:

  • samples/stc/edit.cpp

    diff --git a/samples/stc/edit.cpp b/samples/stc/edit.cpp
    index 8d33382..53c8ba8 100644
    a b  
    154154    MarkerDefine (wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_EMPTY,     wxT("BLACK"), wxT("BLACK"));
    155155    MarkerDefine (wxSTC_MARKNUM_FOLDERTAIL,    wxSTC_MARK_EMPTY,     wxT("BLACK"), wxT("BLACK"));
    156156
     157    // a custom marker using transparent red background
     158    MarkerDefine(1, wxSTC_MARK_CIRCLE, *wxRED, *wxGREEN);
     159    MarkerSetBackground(1, *wxRED);
     160    MarkerSetAlpha(1, 16);
     161
    157162    // miscelaneous
    158163    m_LineNrMargin = TextWidth (wxSTC_STYLE_LINENUMBER, wxT("_999999"));
    159164    m_FoldingMargin = 16;
    bool Edit::LoadFile (const wxString &filename) { 
    551556    wxFileName fname (m_filename);
    552557    InitializePrefs (DeterminePrefs (fname.GetFullName()));
    553558
     559    // mark these 3 lines with our special background marker just for testing
     560    MarkerAdd(10, 1);
     561    MarkerAdd(11, 1);
     562    MarkerAdd(12, 1);
     563
    554564    return true;
    555565}
    556566

so this probably needs to be debugged further.

FWIW I think we could/should use transparent pen when fill and outline colours are the same (including alpha) as this should be more efficient.

comment:2 Changed 10 years ago by obfuscated

I've not done some extensive testing of the patch and I guess it breaks a lot of things. I've just hacked it to show my point.

comment:3 Changed 10 years ago by robind

From the screenshot it looks like the borders may be due to the rectangles overlapping, and the alpha blending happening when drawing the next rectangle over the prior one. You may want to double check that the rectangle size is correct, perhaps it needs to be reduced by a pixel or two.

comment:4 Changed 10 years ago by obfuscated

robind: it is not caused by overlapping, I've tried this code:

wxRect r=wxRectFromPRectangle(rc);
r.height--;
dc.DrawRoundedRectangle(r, cornerSize);

and it draws rectangles with border and there is 1 pixel gap between the lines/rectangles.

Note: See TracTickets for help on using tickets.