Commit 7739cfef authored by Maciej Suminski's avatar Maciej Suminski
Browse files

Added support for multiple active layers (colored ones in the high contrast mode).

Added separate layers for pad netnames (now these are divided into multilayer/top/bottom pads).
More appropriate layers are selecting a copper layer in the high contrast mode (now it shows the copper layer itself, vias & multilayer pads and netnames).
parent 0544134a
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -39,7 +39,6 @@ RENDER_SETTINGS::RENDER_SETTINGS()
    m_highlightEnabled  = false;
    m_highlightEnabled  = false;
    m_hiContrastEnabled = false;
    m_hiContrastEnabled = false;
    m_hiContrastFactor  = 0.2;
    m_hiContrastFactor  = 0.2;
    m_activeLayer       = 0;
    m_outlineWidth      = 1;
    m_outlineWidth      = 1;


    // Store the predefined colors used in KiCad in format used by GAL
    // Store the predefined colors used in KiCad in format used by GAL
+3 −0
Original line number Original line Diff line number Diff line
@@ -431,6 +431,9 @@ void VIEW::EnableTopLayer( bool aEnable )
        for( it = m_topLayers.begin(); it != m_topLayers.end(); ++it )
        for( it = m_topLayers.begin(); it != m_topLayers.end(); ++it )
            m_layers[*it].renderingOrder -= TOP_LAYER_MODIFIER;
            m_layers[*it].renderingOrder -= TOP_LAYER_MODIFIER;
    }
    }

    UpdateAllLayersOrder();
    UpdateAllLayersColor();
}
}




+8 −2
Original line number Original line Diff line number Diff line
@@ -236,6 +236,8 @@ enum PCB_VISIBLE
    LAYER_14_NETNAMES_VISIBLE,
    LAYER_14_NETNAMES_VISIBLE,
    LAYER_15_NETNAMES_VISIBLE,
    LAYER_15_NETNAMES_VISIBLE,
    LAYER_16_NETNAMES_VISIBLE,  // Top layer
    LAYER_16_NETNAMES_VISIBLE,  // Top layer
    PAD_FR_NETNAMES_VISIBLE,
    PAD_BK_NETNAMES_VISIBLE,
    PADS_NETNAMES_VISIBLE,
    PADS_NETNAMES_VISIBLE,


    END_PCB_VISIBLE_LIST  // sentinel
    END_PCB_VISIBLE_LIST  // sentinel
@@ -264,7 +266,7 @@ const int GalLayerOrder[] =
    ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ),
    ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ),
    ITEM_GAL_LAYER( VIAS_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ),
    ITEM_GAL_LAYER( VIAS_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ),


    ITEM_GAL_LAYER( PAD_FR_VISIBLE ),
    ITEM_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ),
    ITEM_GAL_LAYER( LAYER_16_NETNAMES_VISIBLE ), LAYER_N_FRONT,
    ITEM_GAL_LAYER( LAYER_16_NETNAMES_VISIBLE ), LAYER_N_FRONT,
    ITEM_GAL_LAYER( LAYER_15_NETNAMES_VISIBLE ), LAYER_N_15,
    ITEM_GAL_LAYER( LAYER_15_NETNAMES_VISIBLE ), LAYER_N_15,
    ITEM_GAL_LAYER( LAYER_14_NETNAMES_VISIBLE ), LAYER_N_14,
    ITEM_GAL_LAYER( LAYER_14_NETNAMES_VISIBLE ), LAYER_N_14,
@@ -281,7 +283,7 @@ const int GalLayerOrder[] =
    ITEM_GAL_LAYER( LAYER_3_NETNAMES_VISIBLE ), LAYER_N_3,
    ITEM_GAL_LAYER( LAYER_3_NETNAMES_VISIBLE ), LAYER_N_3,
    ITEM_GAL_LAYER( LAYER_2_NETNAMES_VISIBLE ), LAYER_N_2,
    ITEM_GAL_LAYER( LAYER_2_NETNAMES_VISIBLE ), LAYER_N_2,
    ITEM_GAL_LAYER( LAYER_1_NETNAMES_VISIBLE ), LAYER_N_BACK,
    ITEM_GAL_LAYER( LAYER_1_NETNAMES_VISIBLE ), LAYER_N_BACK,
    ITEM_GAL_LAYER( PAD_BK_VISIBLE ),
    ITEM_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_BK_VISIBLE ),


    SOLDERMASK_N_BACK, ADHESIVE_N_BACK, SOLDERPASTE_N_BACK, SILKSCREEN_N_BACK,
    SOLDERMASK_N_BACK, ADHESIVE_N_BACK, SOLDERPASTE_N_BACK, SILKSCREEN_N_BACK,
    ITEM_GAL_LAYER( MOD_TEXT_BK_VISIBLE )
    ITEM_GAL_LAYER( MOD_TEXT_BK_VISIBLE )
@@ -408,6 +410,10 @@ inline LAYER_NUM GetNetnameLayer( LAYER_NUM aLayer )
    }
    }
    else if( aLayer == ITEM_GAL_LAYER( PADS_VISIBLE ) )
    else if( aLayer == ITEM_GAL_LAYER( PADS_VISIBLE ) )
        return ITEM_GAL_LAYER( PADS_NETNAMES_VISIBLE );
        return ITEM_GAL_LAYER( PADS_NETNAMES_VISIBLE );
    else if( aLayer == ITEM_GAL_LAYER( PAD_FR_VISIBLE ) )
            return ITEM_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE );
    else if( aLayer == ITEM_GAL_LAYER( PAD_BK_VISIBLE ) )
            return ITEM_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE );


    // Fallback
    // Fallback
    return COMMENT_N;
    return COMMENT_N;
+16 −7
Original line number Original line Diff line number Diff line
@@ -27,8 +27,8 @@
#ifndef __CLASS_PAINTER_H
#ifndef __CLASS_PAINTER_H
#define __CLASS_PAINTER_H
#define __CLASS_PAINTER_H


#include <vector>
#include <map>
#include <map>
#include <set>


#include <gal/color4d.h>
#include <gal/color4d.h>
#include <colors.h>
#include <colors.h>
@@ -51,8 +51,6 @@ class VIEW_ITEM;
 * - drawing quality control (sketch/outline mode)
 * - drawing quality control (sketch/outline mode)
 * The class acts as an interface between the PAINTER object and the GUI (i.e. Layers/Items
 * The class acts as an interface between the PAINTER object and the GUI (i.e. Layers/Items
 * widget or display options dialog).
 * widget or display options dialog).
 *
 * Todo: properties/introspection
 */
 */
class RENDER_SETTINGS
class RENDER_SETTINGS
{
{
@@ -81,9 +79,21 @@ public:
     * (eg. highlighted, so it differs from other layers).
     * (eg. highlighted, so it differs from other layers).
     * @param aLayerId is a layer number that should be displayed in a specific mode.
     * @param aLayerId is a layer number that should be displayed in a specific mode.
     */
     */
    inline void SetActiveLayer( int aLayerId )
    inline void SetActiveLayer( int aLayerId, bool aEnabled = true )
    {
    {
        m_activeLayer = aLayerId;
        if( aEnabled )
            m_activeLayers.insert( aLayerId );
        else
            m_activeLayers.erase( aLayerId );
    }

    /**
     * Function ClearActiveLayers
     * Clears the list of active layers.
     */
    inline void ClearActiveLayers()
    {
        m_activeLayers.clear();
    }
    }


    /**
    /**
@@ -112,8 +122,7 @@ public:
    }
    }


protected:
protected:

    std::set<unsigned int> m_activeLayers; /// Stores active layers number
    int     m_activeLayer;          /// Stores active layer number


    /// Parameters for display modes
    /// Parameters for display modes
    bool    m_hiContrastEnabled;    /// High contrast display mode on/off
    bool    m_hiContrastEnabled;    /// High contrast display mode on/off
+15 −1
Original line number Original line Diff line number Diff line
@@ -133,7 +133,15 @@ protected:
     * will change the currently active layer to \a aLayer and also
     * will change the currently active layer to \a aLayer and also
     * update the PCB_LAYER_WIDGET.
     * update the PCB_LAYER_WIDGET.
     */
     */
    void setActiveLayer( LAYER_NUM aLayer, bool doLayerWidgetUpdate = true );
    void setActiveLayer( LAYER_NUM aLayer, bool doLayerWidgetUpdate = true )
    {
        ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = aLayer;

        setHighContrastLayer( aLayer );

        if( doLayerWidgetUpdate )
            syncLayerWidgetLayer();
    }


    /**
    /**
     * Function getActiveLayer
     * Function getActiveLayer
@@ -144,6 +152,12 @@ protected:
        return ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer;
        return ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer;
    }
    }


    /**
     * Function setHighContrastLayer
     * takes care of display settings for the given layer to be displayed in high contrast mode.
     */
    void setHighContrastLayer( LAYER_NUM aLayer );

    /**
    /**
     * Function syncLayerWidgetLayer
     * Function syncLayerWidgetLayer
     * updates the currently layer "selection" within the PCB_LAYER_WIDGET.
     * updates the currently layer "selection" within the PCB_LAYER_WIDGET.
Loading