Miscellaneous => Suggestions => Topic started by: Pmknecht on February 12, 2013, 08:46:56 pm

Title: Code Map Suggestion
Post by: Pmknecht on February 12, 2013, 08:46:56 pm

i just wonder if somebody will add this code to the official lazarus ide? To get rid of the platform depency it is enough to replace the function which contains the StretchBlt with the regular canvas pendant.

Title: Re: Code Map Suggestion
Post by: Martin_fr on February 12, 2013, 10:21:59 pm
I doubt that code for the original SynEdit will work in Lazarus.
The Lazarus SynEdit is a fork, and heavily modified

The idea of such an overview is somewhere on the todo....
Title: Re: Code Map Suggestion
Post by: Pmknecht on February 13, 2013, 11:23:09 am
Well thats correct, but it is not that big deal to change the code. I did this yesterday, and besides the fact that the editor hook solution i made is lousy it runs okay.
I'm aware that it needs a bit more work to run fluently - especially since the bitmap is quite memory consuming on large code, but it is a proof of concept:

I would really like to have such a function inside lazarus, because it is easier to memorize a code structure than to search all the time through code.
Title: Re: Code Map Suggestion
Post by: wp on February 13, 2013, 12:58:33 pm
A similar thing already exists in Lazarus, although at a less detailed level. It is the gray bar next to the scrollbar. You can identify the interface and implementation sections, as well as the location of breakpoints, text bookmarks and modified text. Maybe this is sufficient?
Title: Re: Code Map Suggestion
Post by: Ask on February 13, 2013, 05:19:51 pm
I have always wondered about the usefulness of this feature.
It seems to me that if the shape of code is diverse enough to be distinguishable at such a small scale,
then the code is formatted inconsistently.

If I would take a single feature from Sublime, it would be "Goto anything (". Procedure list (http://Procedure list) is a good first step in this direction.
Title: Re: Code Map Suggestion
Post by: Martin_fr on February 13, 2013, 05:46:59 pm
The shape of code does not need to be that diverse. For example divider lines can add to the info. Same if markup (like selection is visible.

You can actually get an idea, if you use the editors zoom (ctrl mouse wheel).

This however does not use a big bitmap and then a stretchdraw. This makes a difference, in that for example divider lines, stay a full pixel in height. Stretchdraw would anti-alias / fade them,  I guess.

Imho diructly painting with a small font, looks better than scalling. But it means the size can only be set in certain steps.

Integrating the feature needs more than just painting.

Ideally it will (same as the overviewgutter) use a childwincontrol. So it get's it's own paint messages. That can reduce the paint over head a lot.


Also, I was unable to find a license on the code.

That said, if license is solved, it can be added as a component. It is always possible to later have both (stretchdraw and small font).

IDE integration can be looked at too....


Personally, I favour using the small font.

The current SynEdit & IDE has over 90% of the code in various places already. So it just needs to be put together.
Title: Re: Code Map Suggestion
Post by: Martin_fr on February 13, 2013, 06:47:46 pm
Just noticed, this module does not apply any highlights.

Also it does not expand tabs. So the overview display will look different from the original.
Same applies to none monospaced fonts, which should be enforced to grid. And even within monospaced fonts, some chars may not stick to the grid. This sometimes happens with "full width" chars, that should be exactly 2 cells in the grid. But may in some fonts only be 1.5 cells
TinyPortal © 2005-2018