kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #09913
Re: m_colorsSettings in BOARD
On 4/11/2013 2:26 PM, Lorenzo Marcantonio wrote:
> I'm fixing #1167884 (pretty trivial) and I noticed a curious thing:
>
> BOARD has it's own m_colorsSettings, with accessors and simply
> initialized with a pointer to the global g_colorsSettings. After that
> it's never changed.
This isn't a bad thing unless the pointer to g_colorSettings changes.
It hides the fact the color settings in Pcbnew are a global variable (it
seems to me that they should be a member of PCB_EDIT_FRAME or one of the
classes it is derived from) and prevents the g_colorSettings variable
from littering the all the objects derived from BOARD_ITEM which I
believe use to be the case. The color settings could reside and be
changed anywhere. As long as the pointer to them in the BOARD object is
valid, all is well. Hopefully this will discourage other developers
from added more globals in the future.
>
> Other stuff in pcbnew instead goes directly to the g_colorsSettings.
>
> What is the meaning for the BOARD member? If there are plan to (for
> example) giving customized colors to the module editor/viewer then they
> should get their own m_colorsSettings member (then in the future it
> would point maybe somewhere else).
>
> Otherwise if colors in pcbnew are truly global, I think that the BOARD
> member is only confusing the code.
>
> What do you think of that?
>
Follow ups
References