Commit 073d0767 authored by dickelbeck's avatar dickelbeck
Browse files

fix markers on pads when pads are high-lighted

parent 6d91cdd6
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -5,6 +5,14 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
Please add newer entries at the top, list the date and your name with
email address.
email address.


2009-Feb-25 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++pcbnew
    Markers were now shown when on top of a high-lighted pad.  Moved highlight
    drawing function into class BOARD and out of Frame.  Call BOARD::DrawHighLight() from
    within BOARD::Draw() to fix.


2009-Feb-24 UPDATE Dick Hollenbeck <dick@softplc.com>
2009-Feb-24 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
================================================================================
++pcbnew
++pcbnew
+0 −1
Original line number Original line Diff line number Diff line
@@ -495,7 +495,6 @@ public:
    // Hightlight functions:
    // Hightlight functions:
    int              Select_High_Light( wxDC* DC );
    int              Select_High_Light( wxDC* DC );
    void             Hight_Light( wxDC* DC );
    void             Hight_Light( wxDC* DC );
    void             DrawHightLight( wxDC* DC, int NetCode );


    // Track and via edition:
    // Track and via edition:
    void             DisplayTrackSettings();
    void             DisplayTrackSettings();
+9 −0
Original line number Original line Diff line number Diff line
@@ -263,6 +263,15 @@ public:
    void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
    void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
                      int aDrawMode, const wxPoint& offset = ZeroOffset );
                      int aDrawMode, const wxPoint& offset = ZeroOffset );


    /**
     * Function DrawHighLight
     * redraws the objects in the board that are associated with the given aNetCode
     * and turns on or off the brilliance associated with that net according to the
     * current value of global g_HightLigt_Status
     * @param aDrawPanel is needed for the clipping support.
     * @param aNetCode is the net number to highlight or to dim.
     */
    void DrawHighLight( WinEDA_DrawPanel* aDrawPanel, wxDC* DC, int aNetCode );


    /**
    /**
     * Function Visit
     * Function Visit
+5 −5
Original line number Original line Diff line number Diff line
@@ -60,8 +60,7 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )


    Panel->GetScreen()->m_Curseur = oldpos;
    Panel->GetScreen()->m_Curseur = oldpos;
    g_HightLigt_Status = FALSE;
    g_HightLigt_Status = FALSE;

    ( (WinEDA_PcbFrame*) Panel->m_Parent )->GetBoard()->DrawHighLight( Panel, DC, g_HightLigth_NetCode );
    ( (WinEDA_PcbFrame*) Panel->m_Parent )->DrawHightLight( DC, g_HightLigth_NetCode );


    if( NewTrack )
    if( NewTrack )
    {
    {
@@ -119,7 +118,7 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
    g_HightLigth_NetCode = Old_HightLigth_NetCode;
    g_HightLigth_NetCode = Old_HightLigth_NetCode;
    g_HightLigt_Status   = Old_HightLigt_Status;
    g_HightLigt_Status   = Old_HightLigt_Status;
    if( g_HightLigt_Status )
    if( g_HightLigt_Status )
        ( (WinEDA_PcbFrame*) Panel->m_Parent )->DrawHightLight( DC, g_HightLigth_NetCode );
        ( (WinEDA_PcbFrame*) Panel->m_Parent )->GetBoard()->DrawHighLight( Panel, DC, g_HightLigth_NetCode );


    EraseDragListe();
    EraseDragListe();
}
}
@@ -688,7 +687,8 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int co


    g_HightLigth_NetCode = track->GetNet();
    g_HightLigth_NetCode = track->GetNet();
    g_HightLigt_Status   = TRUE;
    g_HightLigt_Status   = TRUE;
    DrawHightLight( DC, g_HightLigth_NetCode );

    GetBoard()->DrawHighLight( DrawPanel, DC, g_HightLigth_NetCode );
    DrawPanel->ManageCurseur( DrawPanel, DC, TRUE );
    DrawPanel->ManageCurseur( DrawPanel, DC, TRUE );
}
}
void SortTrackEndPoints(TRACK* track)
void SortTrackEndPoints(TRACK* track)
@@ -844,7 +844,7 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC


    g_HightLigth_NetCode = track->GetNet();
    g_HightLigth_NetCode = track->GetNet();
    g_HightLigt_Status   = TRUE;
    g_HightLigt_Status   = TRUE;
    DrawHightLight( DC, g_HightLigth_NetCode );
    GetBoard()->DrawHighLight( DrawPanel, DC, g_HightLigth_NetCode );


    if( !InitialiseDragParameters() )
    if( !InitialiseDragParameters() )
    {
    {
+2 −76
Original line number Original line Diff line number Diff line
@@ -15,11 +15,6 @@


#define Pad_fill (Pad_Fill_Item.State == RUN)
#define Pad_fill (Pad_Fill_Item.State == RUN)


static void Pad_Surbrillance( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* Module, int NetCode );

/* variables locales : */
static int draw_mode;



/*********************************************************/
/*********************************************************/
void WinEDA_PcbFrame::Liste_Equipot( wxCommandEvent& event )
void WinEDA_PcbFrame::Liste_Equipot( wxCommandEvent& event )
@@ -99,16 +94,14 @@ int WinEDA_PcbFrame::Select_High_Light( wxDC* DC )
    if( g_HightLigt_Status )
    if( g_HightLigt_Status )
        Hight_Light( DC );
        Hight_Light( DC );


    // use this scheme because of pad is higher priority than tracks in the
    // use this scheme because a pad is a higher priority than a track in the
    // search, and finding a pad, instead of a track on a pad,
    // search, and finding a pad, instead of a track on a pad,
    // allows us to fire a message to eeschema.
    // allows us to fire a message to eeschema.


    GENERAL_COLLECTORS_GUIDE guide = GetCollectorsGuide();
    GENERAL_COLLECTORS_GUIDE guide = GetCollectorsGuide();



    // optionally, modify the "guide" here as needed using its member functions
    // optionally, modify the "guide" here as needed using its member functions



    m_Collector->Collect( GetBoard(), GENERAL_COLLECTOR::PadsTracksOrZones,
    m_Collector->Collect( GetBoard(), GENERAL_COLLECTOR::PadsTracksOrZones,
                         GetScreen()->RefPos( true ), guide );
                         GetScreen()->RefPos( true ), guide );


@@ -158,74 +151,7 @@ void WinEDA_PcbFrame::Hight_Light( wxDC* DC )
 */
 */
{
{
    g_HightLigt_Status = !g_HightLigt_Status;
    g_HightLigt_Status = !g_HightLigt_Status;
    DrawHightLight( DC, g_HightLigth_NetCode );
}


/****************************************************************/
void WinEDA_PcbFrame::DrawHightLight( wxDC* DC, int NetCode )
/****************************************************************/

/* Turn On or OFF the HightLight for trcak and pads with the netcode "NetCode'
 */
{
    if( g_HightLigt_Status )
        draw_mode = GR_SURBRILL | GR_OR;
    else
        draw_mode = GR_AND | GR_SURBRILL;

#if 0   // does not unhighlight properly
    // redraw the zones with the NetCode
    for( SEGZONE* zone = GetBoard()->m_Zone;   zone;   zone = zone->Next() )
    {
        if( zone->GetNet() == NetCode )
        {
            zone->Draw( DrawPanel, DC, draw_mode );
        }
    }
#endif

    // Redraw ZONE_CONTAINERS
    BOARD::ZONE_CONTAINERS& zones = GetBoard()->m_ZoneDescriptorList;
    for( BOARD::ZONE_CONTAINERS::iterator zc = zones.begin();  zc!=zones.end();  ++zc )
    {
        if( (*zc)->GetNet() == NetCode )
        {
            (*zc)->Draw( DrawPanel, DC, draw_mode );
        }
    }


    /* Redraw pads */
    GetBoard()->DrawHighLight( DrawPanel, DC, g_HightLigth_NetCode );
    for( MODULE* module = GetBoard()->m_Modules;  module;   module = module->Next() )
    {
        Pad_Surbrillance( DrawPanel, DC, module, NetCode );
    }

    /* Redraw track and vias: */
    for( TRACK* pts = GetBoard()->m_Track;   pts;   pts = pts->Next() )
    {
        if( pts->GetNet() == NetCode )
        {
            pts->Draw( DrawPanel, DC, draw_mode );
        }
}
}
}

/*******************************************************/
static void Pad_Surbrillance( WinEDA_DrawPanel* panel,
                              wxDC* DC, MODULE* Module, int NetCode )
/*******************************************************/
/* Mise en Surbrillance des Pads */
{
    D_PAD* pt_pad;

    /* trace des pastilles */
    for( pt_pad = Module->m_Pads;  pt_pad;  pt_pad = pt_pad->Next() )
    {
        if( pt_pad->GetNet() == NetCode )
        {
            pt_pad->Draw( panel, DC, draw_mode );
        }
    }
}
Loading