Commit ef1ed964 authored by Maciej Suminski's avatar Maciej Suminski
Browse files

DRC markers are drawn in GAL canvases.

parent e1ce30d8
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -239,6 +239,7 @@ enum PCB_VISIBLE
    PADS_HOLES_VISIBLE,
    PADS_HOLES_VISIBLE,
    VIAS_HOLES_VISIBLE,
    VIAS_HOLES_VISIBLE,


    DRC_VISIBLE,                ///< drc markers
    WORKSHEET,                  ///< worksheet frame
    WORKSHEET,                  ///< worksheet frame
    GP_OVERLAY,                 ///< general purpose overlay
    GP_OVERLAY,                 ///< general purpose overlay


+2 −0
Original line number Original line Diff line number Diff line
@@ -75,6 +75,7 @@ static const wxString FastGrid2Entry( wxT( "FastGrid2" ) );
const LAYER_NUM PCB_BASE_FRAME::GAL_LAYER_ORDER[] =
const LAYER_NUM PCB_BASE_FRAME::GAL_LAYER_ORDER[] =
{
{
    ITEM_GAL_LAYER( GP_OVERLAY ),
    ITEM_GAL_LAYER( GP_OVERLAY ),
    ITEM_GAL_LAYER( DRC_VISIBLE ),
    NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ),
    NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ),
    DRAW_N, COMMENT_N, ECO1_N, ECO2_N, EDGE_N,
    DRAW_N, COMMENT_N, ECO1_N, ECO2_N, EDGE_N,
    UNUSED_LAYER_29, UNUSED_LAYER_30, UNUSED_LAYER_31,
    UNUSED_LAYER_29, UNUSED_LAYER_30, UNUSED_LAYER_31,
@@ -817,6 +818,7 @@ void PCB_BASE_FRAME::LoadSettings()


    view->SetLayerTarget( ITEM_GAL_LAYER( GP_OVERLAY ), KIGFX::TARGET_OVERLAY );
    view->SetLayerTarget( ITEM_GAL_LAYER( GP_OVERLAY ), KIGFX::TARGET_OVERLAY );
    view->SetLayerTarget( ITEM_GAL_LAYER( RATSNEST_VISIBLE ), KIGFX::TARGET_OVERLAY );
    view->SetLayerTarget( ITEM_GAL_LAYER( RATSNEST_VISIBLE ), KIGFX::TARGET_OVERLAY );
    view->SetLayerTarget( ITEM_GAL_LAYER( DRC_VISIBLE ), KIGFX::TARGET_NONCACHED );


    // Apply layer coloring scheme & display options
    // Apply layer coloring scheme & display options
    if( view->GetPainter() )
    if( view->GetPainter() )
+10 −4
Original line number Original line Diff line number Diff line
@@ -46,7 +46,7 @@


MARKER_PCB::MARKER_PCB( BOARD_ITEM* aParent ) :
MARKER_PCB::MARKER_PCB( BOARD_ITEM* aParent ) :
    BOARD_ITEM( aParent, PCB_MARKER_T ),
    BOARD_ITEM( aParent, PCB_MARKER_T ),
    MARKER_BASE( )
    MARKER_BASE(), m_item( NULL )
{
{
    m_Color = WHITE;
    m_Color = WHITE;
    m_ScalingFactor = SCALING_FACTOR;
    m_ScalingFactor = SCALING_FACTOR;
@@ -57,8 +57,7 @@ MARKER_PCB::MARKER_PCB( int aErrorCode, const wxPoint& aMarkerPos,
                        const wxString& aText, const wxPoint& aPos,
                        const wxString& aText, const wxPoint& aPos,
                        const wxString& bText, const wxPoint& bPos ) :
                        const wxString& bText, const wxPoint& bPos ) :
    BOARD_ITEM( NULL, PCB_MARKER_T ),  // parent set during BOARD::Add()
    BOARD_ITEM( NULL, PCB_MARKER_T ),  // parent set during BOARD::Add()
    MARKER_BASE( aErrorCode, aMarkerPos, aText, aPos, bText, bPos )
    MARKER_BASE( aErrorCode, aMarkerPos, aText, aPos, bText, bPos ), m_item( NULL )

{
{
    m_Color = WHITE;
    m_Color = WHITE;
    m_ScalingFactor = SCALING_FACTOR;
    m_ScalingFactor = SCALING_FACTOR;
@@ -67,7 +66,7 @@ MARKER_PCB::MARKER_PCB( int aErrorCode, const wxPoint& aMarkerPos,
MARKER_PCB::MARKER_PCB( int aErrorCode, const wxPoint& aMarkerPos,
MARKER_PCB::MARKER_PCB( int aErrorCode, const wxPoint& aMarkerPos,
                        const wxString& aText, const wxPoint& aPos ) :
                        const wxString& aText, const wxPoint& aPos ) :
    BOARD_ITEM( NULL, PCB_MARKER_T ),  // parent set during BOARD::Add()
    BOARD_ITEM( NULL, PCB_MARKER_T ),  // parent set during BOARD::Add()
    MARKER_BASE( aErrorCode, aMarkerPos, aText,  aPos )
    MARKER_BASE( aErrorCode, aMarkerPos, aText,  aPos ), m_item( NULL )
{
{
    m_Color = WHITE;
    m_Color = WHITE;
    m_ScalingFactor = SCALING_FACTOR;
    m_ScalingFactor = SCALING_FACTOR;
@@ -136,3 +135,10 @@ wxString MARKER_PCB::GetSelectMenuText() const


    return text;
    return text;
}
}


void MARKER_PCB::ViewGetLayers( int aLayers[], int& aCount ) const
{
    aCount = 1;
    aLayers[0] = ITEM_GAL_LAYER( DRC_VISIBLE );
}
+23 −0
Original line number Original line Diff line number Diff line
@@ -64,6 +64,16 @@ public:
    const wxPoint& GetPosition() const          { return m_Pos; }
    const wxPoint& GetPosition() const          { return m_Pos; }
    void SetPosition( const wxPoint& aPos )     { m_Pos = aPos; }
    void SetPosition( const wxPoint& aPos )     { m_Pos = aPos; }


    void SetItem( const BOARD_ITEM* aItem )
    {
        m_item = aItem;
    }

    const BOARD_ITEM* GetItem() const
    {
        return m_item;
    }

    bool HitTest( const wxPoint& aPosition )
    bool HitTest( const wxPoint& aPosition )
    {
    {
        return HitTestMarker( aPosition );
        return HitTestMarker( aPosition );
@@ -77,9 +87,22 @@ public:


    BITMAP_DEF GetMenuImage() const { return  drc_xpm; }
    BITMAP_DEF GetMenuImage() const { return  drc_xpm; }


    ///> @copydoc VIEW_ITEM::ViewBBox()
    virtual const BOX2I ViewBBox() const
    {
        return GetParent()->ViewBBox();
    }

    ///> @copydoc VIEW_ITEM::ViewGetLayers()
    virtual void ViewGetLayers( int aLayers[], int& aCount ) const;

#if defined(DEBUG)
#if defined(DEBUG)
    void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
    void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
#endif
#endif

protected:
    ///> Pointer to BOARD_ITEM that causes DRC error.
    const BOARD_ITEM* m_item;
};
};


#endif      //  CLASS_MARKER_PCB_H
#endif      //  CLASS_MARKER_PCB_H
+13 −0
Original line number Original line Diff line number Diff line
@@ -38,6 +38,8 @@
#include <class_track.h>
#include <class_track.h>
#include <class_pad.h>
#include <class_pad.h>
#include <class_zone.h>
#include <class_zone.h>
#include <class_drawpanel_gal.h>
#include <view/view.h>


#include <pcbnew.h>
#include <pcbnew.h>
#include <drc_stuff.h>
#include <drc_stuff.h>
@@ -312,6 +314,7 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )


        m_currentMarker = fillMarker( DRCE_NETCLASS_CLEARANCE, msg, m_currentMarker );
        m_currentMarker = fillMarker( DRCE_NETCLASS_CLEARANCE, msg, m_currentMarker );
        m_pcb->Add( m_currentMarker );
        m_pcb->Add( m_currentMarker );
        m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker );
        m_currentMarker = 0;
        m_currentMarker = 0;
        ret = false;
        ret = false;
    }
    }
@@ -327,6 +330,7 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )


        m_currentMarker = fillMarker( DRCE_NETCLASS_TRACKWIDTH, msg, m_currentMarker );
        m_currentMarker = fillMarker( DRCE_NETCLASS_TRACKWIDTH, msg, m_currentMarker );
        m_pcb->Add( m_currentMarker );
        m_pcb->Add( m_currentMarker );
        m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker );
        m_currentMarker = 0;
        m_currentMarker = 0;
        ret = false;
        ret = false;
    }
    }
@@ -341,6 +345,7 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )


        m_currentMarker = fillMarker( DRCE_NETCLASS_VIASIZE, msg, m_currentMarker );
        m_currentMarker = fillMarker( DRCE_NETCLASS_VIASIZE, msg, m_currentMarker );
        m_pcb->Add( m_currentMarker );
        m_pcb->Add( m_currentMarker );
        m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker );
        m_currentMarker = 0;
        m_currentMarker = 0;
        ret = false;
        ret = false;
    }
    }
@@ -355,6 +360,7 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )


        m_currentMarker = fillMarker( DRCE_NETCLASS_VIADRILLSIZE, msg, m_currentMarker );
        m_currentMarker = fillMarker( DRCE_NETCLASS_VIADRILLSIZE, msg, m_currentMarker );
        m_pcb->Add( m_currentMarker );
        m_pcb->Add( m_currentMarker );
        m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker );
        m_currentMarker = 0;
        m_currentMarker = 0;
        ret = false;
        ret = false;
    }
    }
@@ -369,6 +375,7 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )


        m_currentMarker = fillMarker( DRCE_NETCLASS_uVIASIZE, msg, m_currentMarker );
        m_currentMarker = fillMarker( DRCE_NETCLASS_uVIASIZE, msg, m_currentMarker );
        m_pcb->Add( m_currentMarker );
        m_pcb->Add( m_currentMarker );
        m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker );
        m_currentMarker = 0;
        m_currentMarker = 0;
        ret = false;
        ret = false;
    }
    }
@@ -383,6 +390,7 @@ bool DRC::doNetClass( NETCLASS* nc, wxString& msg )


        m_currentMarker = fillMarker( DRCE_NETCLASS_uVIADRILLSIZE, msg, m_currentMarker );
        m_currentMarker = fillMarker( DRCE_NETCLASS_uVIADRILLSIZE, msg, m_currentMarker );
        m_pcb->Add( m_currentMarker );
        m_pcb->Add( m_currentMarker );
        m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker );
        m_currentMarker = 0;
        m_currentMarker = 0;
        ret = false;
        ret = false;
    }
    }
@@ -447,6 +455,7 @@ void DRC::testPad2Pad()
        {
        {
            wxASSERT( m_currentMarker );
            wxASSERT( m_currentMarker );
            m_pcb->Add( m_currentMarker );
            m_pcb->Add( m_currentMarker );
            m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker );
            m_currentMarker = 0;
            m_currentMarker = 0;
        }
        }
    }
    }
@@ -493,6 +502,7 @@ void DRC::testTracks( bool aShowProgressBar )
        {
        {
            wxASSERT( m_currentMarker );
            wxASSERT( m_currentMarker );
            m_pcb->Add( m_currentMarker );
            m_pcb->Add( m_currentMarker );
            m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker );
            m_currentMarker = 0;
            m_currentMarker = 0;
        }
        }
    }
    }
@@ -554,6 +564,7 @@ void DRC::testZones()
            m_currentMarker = fillMarker( test_area,
            m_currentMarker = fillMarker( test_area,
                                          DRCE_NON_EXISTANT_NET_FOR_ZONE_OUTLINE, m_currentMarker );
                                          DRCE_NON_EXISTANT_NET_FOR_ZONE_OUTLINE, m_currentMarker );
            m_pcb->Add( m_currentMarker );
            m_pcb->Add( m_currentMarker );
            m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker );
            m_currentMarker = 0;
            m_currentMarker = 0;
        }
        }
    }
    }
@@ -589,6 +600,7 @@ void DRC::testKeepoutAreas()
                    m_currentMarker = fillMarker( segm, NULL,
                    m_currentMarker = fillMarker( segm, NULL,
                                                  DRCE_TRACK_INSIDE_KEEPOUT, m_currentMarker );
                                                  DRCE_TRACK_INSIDE_KEEPOUT, m_currentMarker );
                    m_pcb->Add( m_currentMarker );
                    m_pcb->Add( m_currentMarker );
                    m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker );
                    m_currentMarker = 0;
                    m_currentMarker = 0;
                }
                }
            }
            }
@@ -605,6 +617,7 @@ void DRC::testKeepoutAreas()
                    m_currentMarker = fillMarker( segm, NULL,
                    m_currentMarker = fillMarker( segm, NULL,
                                                  DRCE_VIA_INSIDE_KEEPOUT, m_currentMarker );
                                                  DRCE_VIA_INSIDE_KEEPOUT, m_currentMarker );
                    m_pcb->Add( m_currentMarker );
                    m_pcb->Add( m_currentMarker );
                    m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker );
                    m_currentMarker = 0;
                    m_currentMarker = 0;
                }
                }
            }
            }
Loading