Commit 920186dd authored by dickelbeck's avatar dickelbeck
Browse files

more layer widget incorporation

parent 2bae7624
Loading
Loading
Loading
Loading
+11 −14
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ public:
            return false;

        // If a layer is disabled, it is automatically invisible
        return (bool) ( m_VisibleLayers & m_EnabledLayers & 1 << aLayerIndex );
        return (bool) ( m_VisibleLayers & m_EnabledLayers & (1 << aLayerIndex) );
    }


@@ -111,28 +111,27 @@ public:
        m_VisibleElements = aMask;
    }


    /**
     * Function IsElementVisible
     * tests whether a given element category is visible
     * @param aCategoryIndex = The index of the element category to be tested.
     * tests whether a given element category is visible. Keep this as an
     * inline function.
     * @param aPCB_VISIBLE is from the enum by the same name
     * @return bool - true if the element is visible.
     * @see enum PCB_VISIBLE
     */
    bool IsElementVisible( int aCategoryIndex ) const
    bool IsElementVisible( int aPCB_VISIBLE ) const
    {
        if( aCategoryIndex < 0 || aCategoryIndex > PAD_CMP_VISIBLE )
            return false;
        return (bool) ( m_VisibleElements & (1 << aCategoryIndex) );
        return bool( m_VisibleElements & (1 << aPCB_VISIBLE) );
    }


    /**
     * Function SetElementVisibility
     * changes the visibility of an element category
     * @param aCategoryIndex = The index of the element category to be changed
     * @param aPCB_VISIBLE is from the enum by the same name
     * @param aNewState = The new visibility state of the element category
     * @see enum PCB_VISIBLE
     */
    void SetElementVisibility( int aCategoryIndex, bool aNewState );
    void SetElementVisibility( int aPCB_VISIBLE, bool aNewState );

    /**
     * Function GetEnabledLayers
@@ -144,7 +143,6 @@ public:
        return m_EnabledLayers;
    }


    /**
     * Function SetEnabledLayers
     * changes the bit-mask of enabled layers
@@ -152,7 +150,6 @@ public:
     */
    void SetEnabledLayers( int aMask );


    /**
     * Function IsLayerEnabled
     * tests whether a given layer is enabled
@@ -161,7 +158,7 @@ public:
     */
    bool IsLayerEnabled( int aLayerIndex )
    {
        return (bool) ( m_EnabledLayers & 1 << aLayerIndex );
        return bool( m_EnabledLayers & (1 << aLayerIndex) );
    }


+33 −17
Original line number Diff line number Diff line
@@ -152,21 +152,37 @@ class RATSNEST_ITEM;
/* Class to handle a board */
#include "class_board.h"

enum ELEMENTS_NUMBERS

/**
 * Enum PCB_VISIBLE
 * is a set of visible PCB elements.
 * @see BOARD::SetVisibleElementColor()
 * @see BOARD::SetVisibleElement()
 */
enum PCB_VISIBLE
{
    VIAS_VISIBLE                = 0,
    VIA_NOT_DEFINED_VISIBLE     =  VIAS_VISIBLE,
    VIAS_VISIBLE,
    VIA_MICROVIA_VISIBLE,
    VIA_BLIND_BURIED_VISIBLE,
    VIA_BBLIND_VISIBLE,
    VIA_THROUGH_VISIBLE,
    MODULE_TEXT_CMP_VISIBLE,
    MODULE_TEXT_CU_VISIBLE,
    MODULE_TEXT_NOV_VISIBLE,
    MOD_TEXT_FR_VISIBLE,
    MOD_TEXT_BK_VISIBLE,
    MOD_TEXT_INVISIBLE,         ///< text marked as invisible
    ANCHOR_VISIBLE,
    PAD_CU_VISIBLE,
    PAD_CMP_VISIBLE
    PAD_FR_VISIBLE,
    PAD_BK_VISIBLE,
    RATSNEST_VISIBLE,
    GRID_VISIBLE,

    // the rest of these do not currently support color changes:
    NO_CONNECTS_VISIBLE,        ///< show a marker on pads with no nets
    MOD_FR_VISIBLE,             ///< show modules on front
    MOD_BK_VISIBLE,             ///< show modules on back

    END_VISIBLE  // sentinel
};


/**
 * Function IsValidLayerIndex
 * tests whether a given integer is a valid layer index
+9 −13
Original line number Diff line number Diff line
@@ -67,28 +67,17 @@ protected:
        {
        }

        //-----<implement LAYER_WIDGET abstract functions>---
        //-----<implement LAYER_WIDGET abstract callback functions>-----------
        void OnLayerColorChange( int aLayer, int aColor );
        bool OnLayerSelect( int aLayer );
        void OnLayerVisible( int aLayer, bool isVisible, bool isFinal );
        void OnRenderColorChange( int aId, int aColor );
        void OnRenderEnable( int aId, bool isEnabled );
        //-----</implement LAYER_WIDGET abstract functions>---------------
        //-----</implement LAYER_WIDGET abstract callback functions>----------
    };

    /// render rows are fixed, layer rows are dynamically determined.
    static LAYER_WIDGET::ROW renderRows[];

    LYRS*            m_Layers;              // established in constructor

    /**
     * Function ReFillLayerWidget
     * changes out all the layers in m_Layers and may be called upon
     * loading a new BOARD.
     */
    void ReFillLayerWidget();


public:
    WinEDAChoiceBox* m_SelLayerBox;         // a combo box to display and
                                            // select active layer
@@ -177,6 +166,13 @@ public:
    void             ReCreateMenuBar();
    WinEDAChoiceBox* ReCreateLayerBox( WinEDA_Toolbar* parent );

    /**
     * Function ReFillLayerWidget
     * changes out all the layers in m_Layers and may be called upon
     * loading a new BOARD.
     */
    void             ReFillLayerWidget();

    void             Show3D_Frame( wxCommandEvent& event );
    void             GeneralControle( wxDC* DC, wxPoint Mouse );

+3 −3
Original line number Diff line number Diff line
@@ -277,9 +277,9 @@ GENERAL_COLLECTORS_GUIDE WinEDA_BasePcbFrame::GetCollectorsGuide()
                                    ( (PCB_SCREEN*)GetScreen())->m_Active_Layer );

    // account for the globals
    guide.SetIgnoreMTextsMarkedNoShow( ! g_DesignSettings.IsElementVisible( MODULE_TEXT_NOV_VISIBLE ));
    guide.SetIgnoreMTextsOnCopper( ! g_DesignSettings.IsElementVisible( MODULE_TEXT_CU_VISIBLE ));
    guide.SetIgnoreMTextsOnCmp( ! g_DesignSettings.IsElementVisible( MODULE_TEXT_CMP_VISIBLE ));
    guide.SetIgnoreMTextsMarkedNoShow( ! g_DesignSettings.IsElementVisible( MOD_TEXT_INVISIBLE ));
    guide.SetIgnoreMTextsOnCopper( ! g_DesignSettings.IsElementVisible( MOD_TEXT_BK_VISIBLE ));
    guide.SetIgnoreMTextsOnCmp( ! g_DesignSettings.IsElementVisible( MOD_TEXT_FR_VISIBLE ));
    guide.SetIgnoreModulesOnCu( !DisplayOpt.Show_Modules_Cu );
    guide.SetIgnoreModulesOnCmp( !DisplayOpt.Show_Modules_Cmp );

+52 −0
Original line number Diff line number Diff line
@@ -396,11 +396,63 @@ int BOARD::GetVisibleElements() const
    return m_BoardSettings->GetVisibleElements();
}


int BOARD::GetVisibleElementColor( int aPCB_VISIBLE )
{
    int color = -1;

    // @todo move these globals into the board.
    switch( aPCB_VISIBLE )
    {
    case VIAS_VISIBLE:              color = m_BoardSettings->m_ViaColor[VIA_THROUGH];       break;
    case VIA_MICROVIA_VISIBLE:      color = m_BoardSettings->m_ViaColor[VIA_MICROVIA];      break;
    case VIA_BBLIND_VISIBLE:        color = m_BoardSettings->m_ViaColor[VIA_BLIND_BURIED];  break;
    case VIA_THROUGH_VISIBLE:       color = g_ModuleTextCUColor;    break;
    case MOD_TEXT_FR_VISIBLE:       color = g_ModuleTextCUColor;    break;
    case MOD_TEXT_BK_VISIBLE:       color = g_ModuleTextCUColor;    break;
    case MOD_TEXT_INVISIBLE:   color = g_ModuleTextNOVColor;   break;
    case ANCHOR_VISIBLE:            color = g_AnchorColor;          break;
    case PAD_FR_VISIBLE:            color = g_PadCMPColor;          break;
    case PAD_BK_VISIBLE:            color = g_PadCUColor;           break;
    case RATSNEST_VISIBLE:          color = m_BoardSettings->m_RatsnestColor; break;
    case GRID_VISIBLE:              color = g_GridColor;            break;
    default:
        wxLogDebug("BOARD::GetVisibleElementColor(): bad arg %d", aPCB_VISIBLE );
    }

    return color;
}


void BOARD::SetVisibleElementColor( int aPCB_VISIBLE, int aColor )
{
    // @todo move these globals into the board.
    switch( aPCB_VISIBLE )
    {
    case VIAS_VISIBLE:              m_BoardSettings->m_ViaColor[VIA_THROUGH] = aColor;       break;
    case VIA_MICROVIA_VISIBLE:      m_BoardSettings->m_ViaColor[VIA_MICROVIA] = aColor;      break;
    case VIA_BBLIND_VISIBLE:        m_BoardSettings->m_ViaColor[VIA_BLIND_BURIED] = aColor;  break;
    case VIA_THROUGH_VISIBLE:       g_ModuleTextCUColor = aColor;       break;
    case MOD_TEXT_FR_VISIBLE:       g_ModuleTextCUColor = aColor;       break;
    case MOD_TEXT_BK_VISIBLE:  g_ModuleTextCUColor = aColor;            break;
    case MOD_TEXT_INVISIBLE:   g_ModuleTextNOVColor = aColor;      break;
    case ANCHOR_VISIBLE:            g_AnchorColor = aColor;             break;
    case PAD_FR_VISIBLE:            g_PadCMPColor = aColor;             break;
    case PAD_BK_VISIBLE:            g_PadCUColor = aColor;                      break;
    case RATSNEST_VISIBLE:          m_BoardSettings->m_RatsnestColor = aColor;  break;
    case GRID_VISIBLE:              g_GridColor = aColor;                       break;
    default:
        wxLogDebug("BOARD::SetVisibleElementColor(): bad arg %d", aPCB_VISIBLE );
    }
}


void BOARD::SetLayerColor( int aLayer, int aColor )
{
    m_BoardSettings->SetLayerColor( aLayer, aColor );
}


int BOARD::GetLayerColor( int aLayer )
{
    return m_BoardSettings->GetLayerColor( aLayer );
Loading