← Back to team overview

kicad-developers team mailing list archive

Elements visibility


I think that the method of signaling the visibility of layers and classes of elements by the use of a bit in their colors a bit clumsy and makes harder to implement some ideas.

At first I thought that it would be too hard to change, but last night I dived into the KiCAD source code to understand it better, and found that it may not be that hard. Only 26 or so source files are involved in the procss.

1) The macro ITEM_NOT_SHOW is present in only 26 different files (less in newer revisions);
2) The member g_DesignSettings.m_LayerColor is present in only 25 source files;

Then I tentatively started to change things.
I created a member "int m_VisibleLayers" (intended to be a bit-mask) to theclass EDA_BoardDesignSettings and some accessor methods ( bool IsLayerVisible(int layer), void SetLayerVisibility(int layer, bool state) ) and replaced all the occurrences of expressions like "color & ITEM_NOT_SHOW" in the sources.

It worked well, there are just five files left to change to finish the job.

Some questions:

a) Would the accessor methods overhead make any difference in performance? If so, I could declare them inline or replace them by macros, it would lookalmost the same;

b) Would this break other's ongoing work? (If you think so, please let me know).

c) Do these changes violate any rules?

Best regards,


Follow ups