News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

indentation guilds highlight

Started by blueshake, July 20, 2009, 05:02:45 AM

Previous topic - Next topic

blueshake

#30
I just test the wxLIGHT_GREY
control->StyleSetForeground(wxSCI_STYLE_INDENTGUIDE, *wxLIGHT_GREY);

@rhf
Is this the style you talk about?

[attachment deleted by admin]
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

ollydbg

I think He(rhf) would like "a dimmer indentation guide lines", I personally prefer the indentation guide line color = color of comment text.

But I don't know how to get that color value from predefined user color option. :(
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

blueshake

maybe it is relative to mset.m_Colours in line 467 in editorcolourset.cpp.but I am not sure.
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

rhf

@ollydbg and blueshake,

Following your suggestions, I added the following to sdk\editorcolourset.cpp in Line 463:
control->StyleSetForeground(wxSCI_STYLE_INDENTGUIDE, *wxLIGHT_GREY);

This worked beautifully, doing exactly what I wanted, and it even changes color when the braces are highlighted.

Well done and thanks,
Bob

ollydbg

hi, I have found a better way, that is: I can set the indentation guild line's color =C++ Comment color.
By default, it was a gray line.

You can add these code in

sdk\editorcolourset.cpp  line 506-509.

        if (opt->name == _T("Comment (normal)") )
        {
            control->StyleSetForeground(wxSCI_STYLE_INDENTGUIDE,opt->fore);
        }


If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

rhf

Quote from: ollydbg on July 24, 2009, 04:57:14 PM
You can add these code in
sdk\editorcolourset.cpp  line 506-509.
        if (opt->name == _T("Comment (normal)") )
        {
            control->StyleSetForeground(wxSCI_STYLE_INDENTGUIDE,opt->fore);
        }

Very good, ollydbg, it is indeed a more general solution than using the fixed setting in my reply #33 above. Now if someone could just add "Indentation guideline" to the Configure editor Syntax highlighting list, everyone could use their own settings, and we would not have to use up one of the existing highlight options. I tried to do this but couldn't figure it out.

Jenna

#36
Quote from: rhf on July 24, 2009, 10:50:31 PM
Now if someone could just add "Indentation guideline" to the Configure editor Syntax highlighting list, everyone could use their own settings, and we would not have to use up one of the existing highlight options. I tried to do this but couldn't figure it out.

If I see it right the list is created from the lexer's content, so it can not easily be added to the list, without changing all lexers.

<Edit>
On the other hand that would be not such a hard work, because the style for the indendation guide already exists, so adding :
<Style name="Indendation guide"
index="37"
fg="55,55,55"/>

to sdk/resources/lexers/lexer_cpp.xml (and running update[.bat] afterwards to copy the changed file to the right place) makes the indendation guide's colour configurable at next start.
</Edit>

By the way the keyword "Comment (normal)" does not exist for all languages.

And the highlight-colour is always the same as used for matching braces:
Quote from: wxScintilla docu
void SetHighlightGuide (int column)
int GetHighlightGuide()


When brace highlighting occurs, the indentation guide corresponding to the braces may be highlighted with the brace highlighting style, wxSCI_STYLE_BRACELIGHT (34). Set column to 0 to cancel this highlight.
Quote from: sdk/wxscintilla/src/scintilla/src/Editor.cxx:2918
      pixmapIndentGuideHighlight->FillRectangle(rcIG, vs.styles[STYLE_BRACELIGHT].back.allocated);
      pixmapIndentGuideHighlight->PenColour(vs.styles[STYLE_BRACELIGHT].fore.allocated);

That means the highlight-style can never be different from the matching-braces highlight-style without patching scintillas-sources.

ollydbg

#37
Quote from: jens on July 24, 2009, 11:13:12 PM


<Edit>
On the other hand that would be not such a hard work, because the style for the indendation guide already exists, so adding :
<Style name="Indendation guide"
index="37"
fg="55,55,55"/>

to sdk/resources/lexers/lexer_cpp.xml (and running update[.bat] afterwards to copy the changed file to the right place) makes the indentation guide's colour configurable at next start.

Really good  catch!
Thanks jens!!!
That also make its color configurable in Editor->Syntax highlighting dialog.

Edit
If I change indentation guide's colour, will it be saved in my "F:\cb_svn\src\output\share\CodeBlocks\lexers\lexer_cpp.xml" ?

It seems even I close CB, this xml file leaves unchanged. But the next time I run CB, the color do persist.


So, where does the customized color configuration be saved?
Thanks.

Edit2
Well, I find the answer myself. the customized color setting was saved in "default.conf". :D


<editor>
<colour_sets>
               .........
<cc>
<style20>
<FORE>
<colour r="255" g="0" b="0" />
</FORE>
                ........

</colour_sets>

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

rhf

Thanks to all of you guys! This is nice work.

By the way Jens, yesterday I tried exactly the same mod to lexer_cpp.xml that you suggest in your Reply #36 and nothing happened - because, Duh!, I never ran update.

I really like having control over the style of the guide that this gives me.

Jenna

Quote from: rhf on July 25, 2009, 03:39:02 PM
Thanks to all of you guys! This is nice work.

By the way Jens, yesterday I tried exactly the same mod to lexer_cpp.xml that you suggest in your Reply #36 and nothing happened - because, Duh!, I never ran update.

I really like having control over the style of the guide that this gives me.

You should also be able to change the used lexer-xml directly.

On linux it's in /usr/share/codeblocks/lexers and on windows in <C::B-installation-directory>\share\CodeBlocks\lexers.

Or better create a subdirectory lexers in C::B's conf-dir copy the lexer-xml you want to change inside and change it (only tested on linux).

This has the advantage, that an update will not overwrite it, but of course the disadvantage that an update will not overwrite it
... even if some essentials have changed.

rhf


rhf

Hi Jens,

Regarding your suggestion in Reply #36 above:

Quote from: jens on July 24, 2009, 11:13:12 PM
...  so adding :
<Style name="Indentation guide"
index="37"
fg="55,55,55"/>

to sdk/resources/lexers/lexer_cpp.xml (and running update[.bat] afterwards to copy the changed file to the right place) makes the indendation guide's colour configurable at next start.

I suppose it was obvious to everyone but me that this change to lexer_cpp.xml gives the user control over the guide syntax highlighting without any code changes at all to sdk\editorcolourset.cpp.  Since the Indentation guides checkbox has been added to Configure editor -> General settings in the trunk, it seems reasonable to add this change to the trunk as well.

ollydbg

QuoteSince the Indentation guides checkbox has been added to Configure editor -> General settings in the trunk, it seems reasonable to add this change to the trunk as well.
I suggest this change should be added in trunk soon. :D
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Jenna

Quote from: ollydbg on July 28, 2009, 04:14:27 PM
QuoteSince the Indentation guides checkbox has been added to Configure editor -> General settings in the trunk, it seems reasonable to add this change to the trunk as well.
I suggest this change should be added in trunk soon. :D

The indendation guide checkbox is there since a long time, so I don't see the relationship.
At the moment (wx)Scintilla uses the default foreground-color for the indendation-guide, so I don't think it's an absolute must to make the style configurable.
There might be other changes (or issues) with a higher priority.

ollydbg

Quote from: jens on July 28, 2009, 04:34:58 PM
There might be other changes (or issues) with a higher priority.
Yes, other more important issues need to be fixed. You are a hard working dev!
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.