Recent

Author Topic: Changing the properties of the gutter  (Read 1535 times)

dg4fac

  • New Member
  • *
  • Posts: 10
Changing the properties of the gutter
« on: October 30, 2019, 01:50:32 pm »
Help needed!
I tried for several hours now to change the number of digits (digitcount) to have more space in the gutter to display marks. It isn't possible >:(.
When I change the width of the gutter, the codefolding part takes all the rest of the space and the linenumber part stays as small as it is. Even by removing the coldefolding part completely from the items does not change this, the codefolding part remains enlarged. Changing the entry in the .lfm file also does not change something, the changes are overwritten by the damn designer (and not read back to the designer, as I would have expected).
The internet is not a help on this issue, I've found douzends of useless contributions.
I don't like to rewrite the whole synedit just for just changing the digitcount. Anybody a hint on how to achieve more space in the gutter and switching off the useless coldefolding part?
brgs, gsc

howardpc

  • Hero Member
  • *****
  • Posts: 3523
Re: Changing the properties of the gutter
« Reply #1 on: October 30, 2019, 02:57:04 pm »
Does something like
Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormCreate(Sender: TObject);
  2. begin
  3.   SynEdit1.Gutter.Parts.Part[0].Width := 90;       // or whatever you require
  4.   SynEdit1.Gutter.Parts.Part[0].AutoSize := False; // you may want this too
  5. end;
not do what you want (assuming Part[0] is TSynGutterMarks), combined with deletion of the Code Folding gutter part?

dg4fac

  • New Member
  • *
  • Posts: 10
Re: Changing the properties of the gutter
« Reply #2 on: October 30, 2019, 03:11:35 pm »
Thanks for the hint, compiles fine.
But: no reaction at all. Seems that this property is concrete and sacrosanct.

brgs, gsc

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6621
  • Debugger - SynEdit - and more
    • wiki
Re: Changing the properties of the gutter
« Reply #3 on: October 30, 2019, 03:51:50 pm »
To be sure you can use
Code: Pascal  [Select][+][-]
  1. if SynEdit.Gutter.Parts.ByClassCount[TSynGutterMarks] > 0 then
  2.   with TSynGutterMarks( SynEdit.Gutter.Parts.ByClass[TSynGutterMarks, 0] ) do begin
  3.     width := 100;
  4.     Autosize := false;
  5.   end;

This also works, if you changed the order of gutter parts.

You can also edit them in the Object Inspector, by going to Gutter > Parts and click the "..." button. Then select the part for the marks from the window that just opened.

dg4fac

  • New Member
  • *
  • Posts: 10
Re: Changing the properties of the gutter
« Reply #4 on: October 30, 2019, 04:28:23 pm »
> You can also edit them in the Object Inspector, by going to Gutter > Parts and click the "..." button. Then select the part for the marks from the window that just opened.

That worked fine, my symbol marks show up like a charm and there is enough space for them all. Perfect, thanks. But by increasing the number of DigitCount I completely lost the line numbers now.  Where are those configured?

brgs, gsc
BTW The SynEdit component is a very fine thing. Last week I wrote a Syntax-Highlighter for avr-assembler and it works nearly perfect. Nearly is because under Windows, setting a background color other than white, increases the line's height, while nothing like that happens in Linux.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6621
  • Debugger - SynEdit - and more
    • wiki
Re: Changing the properties of the gutter
« Reply #5 on: October 30, 2019, 06:01:19 pm »
Perfect, thanks. But by increasing the number of DigitCount I completely lost the line numbers now.  Where are those configured?
There is a gutter part (Object Inspector) for that too.

Make sure the Gutter itself can autosize. So it will fit all the parts, if you set your own widths to the parts.

Quote
Nearly is because under Windows, setting a background color other than white, increases the line's height, while nothing like that happens in Linux.
Do you have test code to reproduce?
Never had this issue myself.

dg4fac

  • New Member
  • *
  • Posts: 10
Re: Changing the properties of the gutter
« Reply #6 on: October 30, 2019, 11:44:04 pm »
> There is a gutter part (Object Inspector) for that too.
Yes, but it has no option for switching line-numbering on or off. The form designer shows numbers, but they do not appear at run-time.

> Make sure the Gutter itself can autosize. So it will fit all the parts, if you set your own widths to the parts.
I thought that I had to switch AutoSize Off to manipulate the width of the individual parts.

> Do you have test code to reproduce? Never had this issue myself.
Sorry, I have no short test code. The whole piece of software is as Lazarus source code available here:
http://www.avr-asm-tutorial.net/avr_sim/17/avr_sim_17_win_src.zip
The whole piece is rather large, so ignore all the other stuff: the SynEdit-Form is in avr_sim_u1.pas, the Syntax-Highlighter is in avrasmhl.pas.

The compiled Win64 version is here:
http://www.avr-asm-tutorial.net/avr_sim/17/avr_sim_17_win_src.zip
If you start the software, you are asked for a directory, select your Documents folder and click "Ok".

You can check the size issue by using the attached assembler source code file. Store that somewhere in your Directory folder, remove the .txt fronm the name (this site does not allow to attach assembler source code files even though there is nothing as save as .asm files), select "New from asm" in the "Project" menu. That should open the asm-file in the SynEdit-Editor (click OK on the package selection)-

Then rightclick in the editor window, select "Colors", in the opening settings dialog click the "Default" button. If you want to change the background color of the Comments click on the "Background" column of the line "Comment" and select its background color (if you want to test the effect with other colors than the default gray background). Then leave the dialog with "Ok", the editor should now display highlighting colors.

The yellow TMemo left to the SynEdit window has the same Font type and size like the SynEdit-Editor. After assembling (click on "Assemble" in the menu, then click on the tab with the original source code). The yellow TMemo window should show dots for pure comment lines and small "e"s for executable code lines. As you can see, the "e"s are on slightly different locations than the executable lines in the editor. If you select white as the comment's background color, the displacement disappears majorly. If you disable highlighting by leaving the colors dialog with the CANCEL button, and the "e" fits to the respective lines. It seems that highlighting increases the text height of the SynEdit.

If you maximize the window, the size of the fonts in TMemo and SynEdit increases, depending from your screen size. Then the effect is even increasing.

The Linux version does not have that effect. The Linux executable is at
http://www.avr-asm-tutorial.net/avr_sim/17/avr_sim_17_lin64.zip

With the gutter marks I'd like to replace the TMemo component, so the effect will be disappering then. The TMemo was a compromise because I did not know how to paint marks and what gutter is (the term "sidefield" would be more understandable for guys like me).

brgs, gsc
-
is

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6621
  • Debugger - SynEdit - and more
    • wiki
Re: Changing the properties of the gutter
« Reply #7 on: October 30, 2019, 11:57:19 pm »
> There is a gutter part (Object Inspector) for that too.
Yes, but it has no option for switching line-numbering on or off. The form designer shows numbers, but they do not appear at run-time.
property Visible  ?
Otherwise, maybe you left some code in your project (from when you played with the other gutter part.

Also ensure property Width and Autosize (should be true). Again the gutter itself must also have autosize=true.


Quote
> Make sure the Gutter itself can autosize. So it will fit all the parts, if you set your own widths to the parts.
I thought that I had to switch AutoSize Off to manipulate the width of the individual parts.
AutoSize for the part => false
AutoSize for the gutter => true  (otherwise you must increase the overall guttersize too, or some of the parts will not fit)


Have to defer looking at the examples... busy now.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6621
  • Debugger - SynEdit - and more
    • wiki
Re: Changing the properties of the gutter
« Reply #8 on: October 31, 2019, 12:59:17 pm »
According to my test, the line height is altered by the "bold" style, not the color.

And that is possible.

The editor measures the TextExtend (of certain sample text pieces), to find out how big one char is.
It does so for all styles that are used for some attribute, but not for un-used styles.

Come to think of it, since style can be returned by OnSpecialLineColor, maybe it should always measure bold too.

Why a bold font has more height in TextExtend is something I do not know.

dg4fac

  • New Member
  • *
  • Posts: 10
Re: Changing the properties of the gutter
« Reply #9 on: October 31, 2019, 01:12:56 pm »
Hi Martin,

as you can see in Editor.png I have it nearly perfect now. I have Autosized the Gutter and the linenumber part now, but I have fixed the marks part to fit exactly to two marks (a bookmark and a linetype mark. The only thing is that the linenumber is not at the right edge of the gutter, even though I have set the right offset to 0. Strange, but I can live with that, no need to save space here.

A different issue is that my imagelist editor (see listeditor.png) does not allow to change the transparent color. But, it also works perfect because it ignores its own setting completely and takes the transparency color from somewhere else in the image. Also perfect.

Now I can finally remove the ancient TMemo from the editor, after doing some further changes to other code, and the line height issue of the syntax highlighter is resolved then, too.

Thanks for your assistance.
brgs, gsc

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6621
  • Debugger - SynEdit - and more
    • wiki
Re: Changing the properties of the gutter
« Reply #10 on: October 31, 2019, 01:29:55 pm »
Well there would be the Changes (changed text indicator) and folding gutter parts.
You can always remove them if you do not need them.

Same for the separator part (though that is just a thin line)

dg4fac

  • New Member
  • *
  • Posts: 10
Re: Changing the properties of the gutter
« Reply #11 on: October 31, 2019, 03:39:46 pm »
I have no folding part enabled. Is that a hidden part, enabled even though not displayed by the part editor?
I have the vertical line part, and that is fine. I really have only these three parts.
Well, it works fine, so I can live with that.

Danke noch mal für die große Hilfe. Das TMemo ist schon weg.

brgs, gsc

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6621
  • Debugger - SynEdit - and more
    • wiki
Re: Changing the properties of the gutter
« Reply #12 on: October 31, 2019, 05:20:12 pm »
That may be outdated, but in the link you sent the gutter itself has
  SynEdit.Gutter.AutoSize := False;  // should be true
and that should be true. Else it will either cut things, or leave extra space (unless you really got it exactly right, but if your line number part changes size according to digit count, then this (outer gutter) must be autosized)

The GutterPart for Marks you do want   AutoSize := False;  and set your preferred size.

The part for linenumbers should have  AutoSize := True; 


Also in that linked example you do have a
SynGutterChanges part with width = 4
SynGutterSeparator  width = 2
SynGutterFolding  width = 0, but autosize = true. Not sure if that will take place at runtime.

To find out which gutterpart takes that space, set a diff back color for each of them. (property MarkupInfo)

dg4fac

  • New Member
  • *
  • Posts: 10
Re: Changing the properties of the gutter
« Reply #13 on: October 31, 2019, 09:02:18 pm »
Hi.
The previous 1.7 version of avr_sim did not have any gutter marks, I needed only the the linenumber and space for the bookmarks. So the linked version 1.7 is now outdated. That was before I knew how to edit the part items.

I have colored the gutter lightblue. The result is in gutter_blue.png. It seems that right to the linenumber part there is a hidden part, which takes the color of the gutter. Or the autosized gutter adds some hidden space at the end.

brgs, gsc

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6621
  • Debugger - SynEdit - and more
    • wiki
Re: Changing the properties of the gutter
« Reply #14 on: October 31, 2019, 09:11:03 pm »
Very hard to guess without source...

What does the gutter part window from the object inspector say?

 

TinyPortal © 2005-2018