GNOME Bugzilla – Bug 742148
gtksourceview should support grid lines in style schemes
Last modified: 2015-01-25 09:10:49 UTC
I think the grid lines we added to Builder have turned out really nice. It might be time to consider making grid lines an option in the style schemes. I don't know if we need to have horizontal vs vertical an option. I also don't know if we want to support different color lines every Nth line (so you see blocks of blocks). Obviously this was a hack. But hey, it worked. https://git.gnome.org/browse/gnome-builder/tree/src/editor/gb-source-view.c#n1923
Do you envision this being part of the style scheme only or a property on the view? I mean, do you expect: <background-pattern-color>pink</background-pattern-color> and then gtk_source_view_set_background_pattern(view, GRID) or do you expect the style schemes to have <background-pattern>grid</background-pattern> <background-pattern-color>pink</background-pattern-color>
That's a good question. Personally, I was thinking of adding properties to the <style> elements. <style name="text" background-line-vertical="pink" background-line-horizontal="purple"/> But that probably isn't enough if we want to support multiple levels of highlight. It's not very visible, but mozilla has a good example of what i mean with two highlight colors for the grid. https://developer.mozilla.org/en-US/docs/Web/CSS/filter And afranke mentioned that he wanted to be able to turn it on for any style scheme. See https://bugzilla.gnome.org/show_bug.cgi?id=741739 for that bug. So I'm not totally sure yet what the right answer is.
My guess would be to just have a property on the view, with an expandable enum for the patterns we want Then have the colors in the scheme, maybe even with a reasonable default (e.g. darker(bgcolor) if the scheme does not specify one
(In reply to comment #3) > My guess would be to just have a property on the view, with an expandable enum > for the patterns we want > > Then have the colors in the scheme, maybe even with a reasonable default (e.g. > darker(bgcolor) if the scheme does not specify one Agreed, I'd be happy to see it implemented as such.
Created attachment 295096 [details] [review] Provide a way to draw background patterns A new property background-pattern is added to support different kind of patterns. For now only Grid is supported. Also a new background-pattern style has been added so it can be used by the style schemes, if this is not provided a default style is used by picking the background color and making it a bit darker.
Created attachment 295097 [details] [review] Provide a way to draw background patterns A new property background-pattern is added to support different kind of patterns. For now only Grid is supported. Also a new background-pattern style has been added so it can be used by the style schemes.
Created attachment 295098 [details] [review] Provide a way to draw background patterns A new property background-pattern is added to support different kind of patterns. For now only Grid is supported. Also a new background-pattern style has been added so it can be used by the style schemes.
Review of attachment 295098 [details] [review]: Implementation looks good to me (one mini nit-pick below) I am not a native english speaker, but when I looked for the translation of "foglio a quadretti" in english, it suggests "checked", so I wonder if we should call the enum value _CHECKED instead of _GRID... Christian? I am marking as commit now, but maybe let's hold off until we can get Christian or another native speaker to comment on the term ::: gtksourceview/gtksourceview.c @@ +2727,3 @@ + + /* + pango_layout_set_text (layout, "X", 1); indentation here is off by one
(In reply to comment #8) > I am marking as commit now, but maybe let's hold off until we can get Christian > or another native speaker to comment on the term "Checked" to me would be interpreted like a checkered flag at the end of a F1 race. Or the rendered background when viewing a transparent image. My vote would be to keep grid. One thing we might want to consider in the future, is if we should outline ever Nth line slightly darker. This was more work than I felt it was worth in Builder, but might be something to consider now that this is shared burden :) Patchwise, everything looks good, happy to see this merge upstream!
Attachment 295098 [details] pushed as eabb2d0 - Provide a way to draw background patterns
It looks like the grid lines are drawn in the wrong order. They are drawn above the highlight line instead of below.
I wondered if that was intentional yesterday... I guess it is not :) Fixed on master. By the way, I added colors for the grid to the color schemes shipped with gtksourceview. Let me know if any of them does not look ok.