Martin Vermeer wrote:
>> The branches code enable the user to create a custom color for each
>> branch. That is, new colors are defined for a particular buffer.
>> However, these colors are stored in the system-wide lcolors
>> variable. That's a design flaw.
>> 
>> It seems to me that there are two possible solutions.
>> 1. Add an LColor member variable to Buffer and use it rather than
>> the system-wide lcolor variable.
>> Advantages: easy to code.
>> Disadvantages: expensive. Every Buffer will have to store the 57 or
>> so color entries in the system-wide lcolor, just so that the user
>> _might_ add his own custom colors.
>> 
>> Moreover, any changes in the system-wide store must be propogated
>> to the Buffer stores. Maybe it's not so easy to code after all.
>> 
>> 2. Return LColor to its original form, where new colors could not
>> be added. (I've just cleaned up the LColor API, which is now
>> identical to the original form; all changes enabling us to add new
>> colors are 'behind the scenes'.)
>> Create a new class BufferColor which is empty by default but which
>> will enable the user to add new colors as he defines branches (and
>> one day colors for the character dialog.)
>> Advantages: clean code.
>> Disadvantages: more code.
>> 
>> I do think that somethng should be done, however. Moving forward
>> with a flawed design is a bad idea IMO.

> 3. Make the colours defined by the user in one buffer available for
> use in the others (how? We need to use the name of the colour, i.e.,
> the name of the branch. Extra logic, but perhaps not as much as 1 or
> 2)

Actually, I don't think that (2) is much work really and is obviously 
the 'correct' solution.

BufferColors would have the same API as LColor, so the outside world 
would use it as 'buffer().color()' rather than as 'lcolor'. We might 
move the LColor::color enum out of LColor and rename it as ColorID or 
somesuch. Maybe rename LColor as SystemColors.

Internally, BufferColors would have a similar structure to today's 
LColor. LColor would revert to pre-Martin days ;-)

I think that that is it. It'll work automatically for user-defined 
character dialog colors too. Or CharStyle-based ones...

-- 
Angus

Reply via email to