Changing the properties of the gutter lazarus / 69-SynEdit ---------------------------------------------------------------------- dg4fac · 2019-10-30 12:50 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 · 2019-10-30 13:57 Does something likeCode: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.FormCreate(Sender: TObject);begin  SynEdit1.Gutter.Parts.Part[0].Width := 90;       // or whatever you require  SynEdit1.Gutter.Parts.Part[0].AutoSize := False; // you may want this tooend;not do what you want (assuming Part[0] is TSynGutterMarks), combined with deletion of the Code Folding gutter part? ---------------------------------------------------------------------- dg4fac · 2019-10-30 14:11 Thanks for the hint, compiles fine. But: no reaction at all. Seems that this property is concrete and sacrosanct. brgs, gsc ---------------------------------------------------------------------- Martin_fr · 2019-10-30 14:51 To be sure you can use Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i if SynEdit.Gutter.Parts.ByClassCount[TSynGutterMarks] > 0 then  with TSynGutterMarks( SynEdit.Gutter.Parts.ByClass[TSynGutterMarks, 0] ) do begin    width := 100;    Autosize := false;  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 · 2019-10-30 15:28 > 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 · 2019-10-30 17:01 Quote from: dg4fac on October 30, 2019, 04:28:23 pmPerfect, 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. QuoteNearly 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 · 2019-10-30 22:44 > 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 · 2019-10-30 22:57 Quote from: dg4fac 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. 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 · 2019-10-31 11:59 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 · 2019-10-31 12:12 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 · 2019-10-31 12:29 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 · 2019-10-31 14:39 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 · 2019-10-31 16:20 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 · 2019-10-31 20:02 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 · 2019-10-31 20:11 Very hard to guess without source... What does the gutter part window from the object inspector say? ---------------------------------------------------------------------- dg4fac · 2019-11-03 10:46 Hi. I have attached my current gutter and enabled parts as from the object inspector. Of course, I have removed the blue background color from the gutter. I removed the autosize from the mark part, because I need exactly two marks with 16-by-16 (one for the bookmarks 0..9 and one for my linetype marks). I don't need that part to be flexible in size. Interestingly: I have made a new form with a naked SynEdit and adjusted it with my settings. It has the same strange thick line on the right. Then I changed the left offset from 10 to 0 and the thick line to the right is not there any more. I previously thought that the left offset makes some distance to the mark part, but it installs it on the right side. Case closed. Thanks again for your assistance. brgs, gsc ---------------------------------------------------------------------- Martin_fr · 2019-11-03 11:14 Just tested. The LeftOffset is indeed broken. Fixed in Revision: 62163