Commit 0ae31f3e authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Pcbnew: better dialogs to select the active layer or a layer pair. Add an...

Pcbnew: better dialogs to select the active layer or a layer pair. Add an option (hotkey+popup menu) to place a via and select the new active layer
(useful for boards having more than 2 layers)
Eeschema:fix compatibility with old schematic files, when they  contain ERC markers.
Pcbnew: better test for allowed layers when creating/editing Dimensions and some other Graphic items
Drc:  fix comments and messages for some drc tests.
Fix minor bugs in cleanup dialog options and plot solder mask function (thanks to Lorenzo to locate these bugs)
parents 1e8430d5 c029dc39
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -194,6 +194,7 @@ again." );
        case 'K':                       // It is a Marker item.
            // Markers are no more read from file. they are only created on
            // demand in schematic
            itemLoaded = true;          // Just skip descr and disable err message
            break;

        case 'N':                       // It is a NoConnect item.
@@ -242,6 +243,9 @@ again." );

        if( !itemLoaded )
        {
            msgDiag.Printf( _( "Eeschema file object not loaded at line %d, aborted" ),
                            reader.LineNumber() );
            msgDiag << wxT( "\n" ) << FROM_UTF8( line );
            DisplayError( this, msgDiag );
            break;
        }
+30 −9
Original line number Diff line number Diff line
@@ -139,14 +139,35 @@ typedef unsigned LAYER_MSK;

#define NO_LAYERS               0x00000000

/** return a one bit layer mask from a layer number
 * aLayerNumber = the layer number to convert (0 .. LAYERS-1)
/**
 * @return a one bit layer mask from a layer number
 * @param aLayerNumber = the layer number to convert (0 .. LAYERS-1)
 */
inline LAYER_MSK GetLayerMask( LAYER_NUM aLayerNumber )
{
    return 1 << aLayerNumber;
}

/**
 * @return bool if aLayerNumber is a layer contained in aMask
 * @param aMask = a layer mask
 * @param aLayerNumber is the layer id to test
 */
inline bool IsLayerInList( LAYER_MSK aMask, LAYER_NUM aLayerNumber )
{
    return (aMask & GetLayerMask( aLayerNumber )) != 0;
}

/**
 * @return bool if 2 layer masks have a comman layer
 * @param aMask1 = a layer mask
 * @param aMask2 = an other layer mask
 */
inline bool IsLayerMasksIntersect( LAYER_MSK aMask1, LAYER_MSK aMask2 )
{
    return (aMask1 & aMask2) != 0;
}

/**
 * Count the number of set layers in the mask
 */
+13 −5
Original line number Diff line number Diff line
@@ -639,11 +639,19 @@ public:
                                     const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) = 0;


    // layerhandling:
    // (See pcbnew/sel_layer.cpp for description of why null_layer parameter
    // is provided)
    LAYER_NUM SelectLayer( LAYER_NUM default_layer, LAYER_NUM min_layer, LAYER_NUM max_layer, bool null_layer = false );
    void SelectLayerPair();
    /** Install the dialog box for layer selection
     * @param aDefaultLayer = Preselection (NB_PCB_LAYERS for "(Deselect)" layer)
     * @param aNotAllowedLayersMask = a layer mask for not allowed layers
     *                            (= 0 to show all layers in use)
     * @return the selected layer id
     */
    LAYER_NUM SelectLayer( LAYER_NUM aDefaultLayer, LAYER_MSK aNotAllowedLayersMask = 0 );

    /* Display a list of two copper layers to choose a pair of copper layers
     * the layer pair is used to fast switch between copper layers when placing vias
     */
    void SelectCopperLayerPair();

    virtual void SwitchLayer( wxDC* DC, LAYER_NUM layer );

    /**
+3 −3
Original line number Diff line number Diff line
@@ -60,9 +60,9 @@ wxString DRC_ITEM::GetErrorText() const
    case DRCE_ENDS_PROBLEM3:
    case DRCE_ENDS_PROBLEM4:
    case DRCE_ENDS_PROBLEM5:
        return wxString( _("Two track ends") );
    case DRCE_TRACK_UNKNOWN1:
        return wxString( _("This looks bad") );  ///< @todo check source code and change this comment
        return wxString( _("Two track ends too close") );
    case DRCE_TRACK_SEGMENTS_TOO_CLOSE:
        return wxString( _("Two parallel track segments too close") );
    case DRCE_TRACKS_CROSSING:
        return wxString( _("Tracks crossing") );
    case DRCE_PAD_NEAR_PAD1:
+1 −0
Original line number Diff line number Diff line
@@ -165,6 +165,7 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::initDlg( )
    m_LayerSelectionCtrl->SetLayerMask( ALL_CU_LAYERS );
    m_LayerSelectionCtrl->SetBoardFrame( m_parent );
    m_LayerSelectionCtrl->Resync();

    if( m_LayerSelectionCtrl->SetLayerSelection( m_Item->GetLayer() ) < 0 )
    {
        wxMessageBox( _("This item has an illegal layer id.\n"
Loading