[LyX/master] Prevent branch background color from leaking out of the document

Jean-Marc Lasgouttes lasgouttes at lyx.org
Thu Jan 21 09:41:29 UTC 2021


Le 21/01/2021 à 09:55, Jürgen Spitzmüller a écrit :
> Am Donnerstag, dem 21.01.2021 um 09:52 +0100 schrieb Jean-Marc
> Lasgouttes:
>> This is why IMO declaring a name for such colors is a mistake. An
>> enum value generated on the fly would be enough.
> 
> And where would you store and access these enum values?

The color cache (is that ColorTable?) would give me one (that would be 
an extension of Color_Code) on request (code = 
colorCache.allocateColor("58bbF7")). The int value would be the id of 
the color in memory. When writing to file, one would get the rgb value 
and write that to file.

To me, as long as it does not get written to some file, a name is not 
useful.

And the good thing about an int is that it fits perfectly well in our 
current FontInfo scheme.

> (BTW the name now is as unique as it gets, as it consists of the string
> branch, a random integer which is assigned to the branchlist, and the
> branch name)

Doesn't it feel a bit complicated?

I agree though that with a loooooong running LyX instance (as some of 
our users have), the handling of allocation (and deallocation) of color 
may get more complicated. I have not thought a lot abpit it, but I 
suspect that there exists a data structure for that.

JMarc



More information about the lyx-devel mailing list