Use different Margin for markers

215 views
Skip to first unread message

Stefano Mtangoo

unread,
Nov 15, 2013, 12:16:46 PM11/15/13
to scintilla...@googlegroups.com
Hi,
I have an app acting as debugger and I need three markers
1. Marker to show erronous line in case of failed Lint check
2. Marker to show debug breakpoints
3. Marker to show current debugger line

The two are working fine but I want the third to be in its own margin and cannot get it to do it.
My problem is, I cannot find single method to assign a marker to a given Margin.
Is there such a method (since scintilla is said to have 5 margins)

I use wxSTC in case that will add anything and here is how I create them

   //Margin and Marker  Errors
    SetMarginType(1, wxSTC_MARGIN_SYMBOL);
    SetMarginWidth(1, 16);
    SetMarginSensitive(1, false);
 
    //fold margin
    SetMarginType(2, wxSTC_MARGIN_SYMBOL);
    SetMarginWidth(2, 16);   
    SetMarginSensitive(2, true);
    SetMarginMask(2, wxSTC_MASK_FOLDERS);
    SetFoldFlags(wxSTC_FOLDFLAG_LINEBEFORE_CONTRACTED | wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED);

    //Margin and Marker for Debug breakpoints currentline
    SetMarginType(3, wxSTC_MARGIN_SYMBOL);
    SetMarginWidth(3, 16);
    SetMarginSensitive(3, true);

and here is how I define them
   //debugger
    MarkerDefineBitmap(HMARGIN_DEBUG_BREAKPOINT, wxBitmap(ConfigManager::Instance()->GetIconPath()+wxT("breakpoint.png"), wxBITMAP_TYPE_PNG));
    //current debugger line
    MarkerDefine(HMARGIN_DEBUG_CURRENT, wxSTC_MARK_ARROW, wxT("green"), wxT("green"));
    //Marker for parsing errors
    MarkerDefine(HMARGIN_PARSE_ERROR, wxSTC_MARK_SHORTARROW, *wxRED, *wxRED);

And finally when Line changes here is how I change themarker (and does not work as I expect)
                    m_editorPage->MarkerDeleteAll(HMARGIN_DEBUG_CURRENT);
                    m_editorPage->MarkerAdd(HMARGIN_DEBUG_CURRENT, GetLineNo());
                    m_editorPage->GotoLine(GetLineNo());
                    m_editorPage->EnsureCaretVisible();

Thanks in Advace,
Stefano

Neil Hodgson

unread,
Nov 15, 2013, 4:27:32 PM11/15/13
to Scintilla mailing list
Stefano Mtangoo:

> The two are working fine but I want the third to be in its own margin and cannot get it to do it.
> My problem is, I cannot find single method to assign a marker to a given Margin.

Set the margin mask to the bits that match the markers you want displayed.
http://www.scintilla.org/ScintillaDoc.html#SCI_SETMARGINMASKN

Neil

Stefano Mtangoo

unread,
Nov 16, 2013, 11:44:47 AM11/16/13
to scintilla...@googlegroups.com, nyama...@me.com

Hi Neil,
can you give me a simple example that have three margin each with one independent symbol?
I have tried code below and many variation it does not work. It seems I'm ignorant of something here and I don't know it


//Margin and Marker  Errors
    SetMarginType(1, wxSTC_MARGIN_SYMBOL);
    SetMarginWidth(1, 16);
    SetMarginSensitive(1, true);

    //fold margin
    SetMarginType(HMARGIN_FOLD, wxSTC_MARGIN_SYMBOL);
    SetMarginWidth(HMARGIN_FOLD, 16);
    SetMarginSensitive(HMARGIN_FOLD, true);
    SetMarginMask(HMARGIN_FOLD, wxSTC_MASK_FOLDERS);
    SetFoldFlags(wxSTC_FOLDFLAG_LINEBEFORE_CONTRACTED | wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED);

    //Margin and Marker for Debug currentline
    SetMarginType(HMARGIN_DEBUG_CURRENT, wxSTC_MARGIN_SYMBOL);
    SetMarginWidth(HMARGIN_DEBUG_CURRENT, 16);
    SetMarginSensitive(HMARGIN_DEBUG_CURRENT, false);
    SetMarginMask(HMARGIN_DEBUG_CURRENT, wxSTC_MARK_ARROW);

Defines are here

#define HMARGIN_LINE_NUMBERS 0
#define HMARGIN_DEBUG_BREAKPOINT 1
#define HMARGIN_FOLD 2
#define HMARGIN_DEBUG_CURRENT 3
#define HMARGIN_PARSE_ERROR 4

   Neil

Neil Hodgson

unread,
Nov 19, 2013, 9:35:05 PM11/19/13
to scintilla...@googlegroups.com
Stefano Mtangoo:

> can you give me a simple example that have three margin each with one independent symbol?
> I have tried code below and many variation it does not work. It seems I'm ignorant of something here and I don't know it

I don't enjoy writing examples. You could search the web for uses of the API.

Neil

Stefano Mtangoo

unread,
Nov 21, 2013, 2:20:11 AM11/21/13
to scintilla...@googlegroups.com, nyama...@me.com
Actually before I  post I do a lot of googling. I finally found project that helped me
http://kldp.net/projects/mygdb


   Neil

Reply all
Reply to author
Forward
0 new messages