Loading gerbview/tracepcb.cpp +34 −79 Original line number Original line Diff line number Diff line Loading @@ -22,11 +22,6 @@ /* tracepcb.cpp */ /* tracepcb.cpp */ /***************/ /***************/ static void Draw_Track_Buffer( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int drawmode, int printmasklayer ); static void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, wxDC* DC, static void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int drawmode ); BOARD* Pcb, int drawmode ); Loading @@ -39,7 +34,7 @@ static void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, wxDC* DC, * @param aPrintMirrorMode = true to plot mirrored * @param aPrintMirrorMode = true to plot mirrored * @param aData = a pointer to an optional data (not used here: can be NULL) * @param aData = a pointer to an optional data (not used here: can be NULL) */ */ void WinEDA_GerberFrame::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintmasklayer, void WinEDA_GerberFrame::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintMasklayer, bool aPrintMirrorMode, void * aData ) bool aPrintMirrorMode, void * aData ) { { DISPLAY_OPTIONS save_opt; DISPLAY_OPTIONS save_opt; Loading @@ -57,7 +52,7 @@ void WinEDA_GerberFrame::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrint DrawPanel->m_PrintIsMirrored = aPrintMirrorMode; DrawPanel->m_PrintIsMirrored = aPrintMirrorMode; Trace_Gerber( aDC, GR_COPY, aPrintmasklayer ); Trace_Gerber( aDC, GR_COPY, aPrintMasklayer ); if( aPrint_Sheet_Ref ) if( aPrint_Sheet_Ref ) TraceWorkSheet( aDC, GetScreen(), 0 ); TraceWorkSheet( aDC, GetScreen(), 0 ); Loading Loading @@ -110,20 +105,21 @@ void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC, /***********************************************************************************/ /***********************************************************************************/ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklayer ) void WinEDA_GerberFrame::Trace_Gerber( wxDC* aDC, int aDraw_mode, int aPrintMasklayer ) /***********************************************************************************/ /***********************************************************************************/ /* Trace all elements of PCBs (i.e Spots, filled polygons or lines) on the active screen /* Trace all elements of PCBs (i.e Spots, filled polygons or lines) on the active screen * @param DC = current device context * @param aDC = current device context * @param draw_mode = draw mode for the device context (GR_COPY, GR_OR, GR_XOR ..) * @param aDraw_mode = draw mode for the device context (GR_COPY, GR_OR, GR_XOR ..) * @param printmasklayer = mask for allowed layer (=-1 to draw all layers) * @param aPrintMasklayer = mask for allowed layer (=-1 to draw all layers) */ */ { { if( !GetBoard() ) if( !GetBoard() ) return; return; bool erase = false; bool erase = false; int Color; int color; bool filled; bool filled; int layer = GetScreen()->m_Active_Layer; // Draw filled polygons // Draw filled polygons std::vector<wxPoint> points; std::vector<wxPoint> points; Loading @@ -131,102 +127,61 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay // minimize reallocations of the vector's internal array by starting with a good sized one. // minimize reallocations of the vector's internal array by starting with a good sized one. points.reserve(10000); points.reserve(10000); for( TRACK* track = GetBoard()->m_Zone; track; track = track->Next() ) TRACK* next_track; for( TRACK* track = GetBoard()->m_Zone; track; track = next_track ) { { if( !(track->ReturnMaskLayer() & printmasklayer) ) next_track = track->Next(); if( !(track->ReturnMaskLayer() & aPrintMasklayer) ) continue; continue; if( track->GetNet() == 0 ) // StartPoint if( (points.size() == 0) && (track->GetNet() == 0) ) // first point of a new polygon { if( points.size() ) // we have found a new polygon: Draw the old polygon { { if( erase ) { Color = g_DrawBgColor; filled = true; } else { Color = g_ColorsSettings.GetLayerColor( track->GetLayer() ); filled = (g_DisplayPolygonsModeSketch == 0); } GRClosedPoly( &DrawPanel->m_ClipBox, DC, points.size(), &points[0], filled, Color, Color ); } erase = ( track->m_Flags & DRAW_ERASED ); erase = ( track->m_Flags & DRAW_ERASED ); points.clear(); points.push_back( track->m_Start ); points.push_back( track->m_Start ); points.push_back( track->m_End ); } } else { points.push_back( track->m_End ); points.push_back( track->m_End ); } if( track->Next() == NULL ) // Last point if( (next_track == NULL ) || (next_track->GetNet() == 0) ) // EndPoint of the current polygon { { color = g_ColorsSettings.GetLayerColor( track->GetLayer() ); filled = (g_DisplayPolygonsModeSketch == 0); if( erase ) if( erase ) { { Color = g_DrawBgColor; color = g_DrawBgColor; filled = true; filled = true; } } else { Color = g_ColorsSettings.GetLayerColor( track->GetLayer() ); filled = (g_DisplayPolygonsModeSketch == 0); } GRClosedPoly( &DrawPanel->m_ClipBox, DC, points.size(), &points[0], GRClosedPoly( &DrawPanel->m_ClipBox, aDC, points.size(), &points[0], filled, Color, Color ); filled, color, color ); } points.clear(); } } // Draw tracks and flashes down here. This will probably not be a final solution to drawing order issues Draw_Track_Buffer( DrawPanel, DC, GetBoard(), draw_mode, printmasklayer ); if( IsElementVisible( DCODES_VISIBLE) ) Affiche_DCodes_Pistes( DrawPanel, DC, GetBoard(), GR_COPY ); GetScreen()->ClrRefreshReq(); } } /***************************************************************************************************/ // Draw tracks and flashes down here. void Draw_Track_Buffer( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int draw_mode, // This will probably not be a final solution to drawing order issues int printmasklayer ) /***************************************************************************************************/ /* Function to draw the tracks (i.e Spots or lines) in gerbview * Polygons are not handled here (there are in Pcb->m_Zone) * @param DC = device context to draw * @param Pcb = Board to draw (only Pcb->m_Track is used) * @param draw_mode = draw mode for the device context (GR_COPY, GR_OR, GR_XOR ..) * @param printmasklayer = mask for allowed layer (=-1 to draw all layers) */ { int layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; GERBER* gerber = g_GERBER_List[layer]; GERBER* gerber = g_GERBER_List[layer]; int dcode_hightlight = 0; int dcode_hightlight = 0; if( gerber ) if( gerber ) dcode_hightlight = gerber->m_Selected_Tool; dcode_hightlight = gerber->m_Selected_Tool; for( TRACK* track = Pcb->m_Track; track; track = track->Next() ) for( TRACK* track = GetBoard()->m_Track; track; track = track->Next() ) { { if( !(track->ReturnMaskLayer() & printmasklayer) ) if( !(track->ReturnMaskLayer() & aPrintMasklayer) ) continue; continue; // D(printf("D:%p\n", track );) if( dcode_hightlight == track->GetNet() && track->GetLayer()==layer ) if( dcode_hightlight == track->GetNet() && track->GetLayer()==layer ) Trace_Segment( Pcb, panel, DC, track, draw_mode | GR_SURBRILL ); Trace_Segment( GetBoard(), DrawPanel, aDC, track, aDraw_mode | GR_SURBRILL ); else else Trace_Segment( Pcb, panel, DC, track, draw_mode ); Trace_Segment( GetBoard(), DrawPanel, aDC, track, aDraw_mode ); } } } if( IsElementVisible( DCODES_VISIBLE) ) Affiche_DCodes_Pistes( DrawPanel, aDC, GetBoard(), GR_COPY ); GetScreen()->ClrRefreshReq(); } #if 1 #if 1 Loading Loading
gerbview/tracepcb.cpp +34 −79 Original line number Original line Diff line number Diff line Loading @@ -22,11 +22,6 @@ /* tracepcb.cpp */ /* tracepcb.cpp */ /***************/ /***************/ static void Draw_Track_Buffer( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int drawmode, int printmasklayer ); static void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, wxDC* DC, static void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int drawmode ); BOARD* Pcb, int drawmode ); Loading @@ -39,7 +34,7 @@ static void Affiche_DCodes_Pistes( WinEDA_DrawPanel* panel, wxDC* DC, * @param aPrintMirrorMode = true to plot mirrored * @param aPrintMirrorMode = true to plot mirrored * @param aData = a pointer to an optional data (not used here: can be NULL) * @param aData = a pointer to an optional data (not used here: can be NULL) */ */ void WinEDA_GerberFrame::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintmasklayer, void WinEDA_GerberFrame::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrintMasklayer, bool aPrintMirrorMode, void * aData ) bool aPrintMirrorMode, void * aData ) { { DISPLAY_OPTIONS save_opt; DISPLAY_OPTIONS save_opt; Loading @@ -57,7 +52,7 @@ void WinEDA_GerberFrame::PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, int aPrint DrawPanel->m_PrintIsMirrored = aPrintMirrorMode; DrawPanel->m_PrintIsMirrored = aPrintMirrorMode; Trace_Gerber( aDC, GR_COPY, aPrintmasklayer ); Trace_Gerber( aDC, GR_COPY, aPrintMasklayer ); if( aPrint_Sheet_Ref ) if( aPrint_Sheet_Ref ) TraceWorkSheet( aDC, GetScreen(), 0 ); TraceWorkSheet( aDC, GetScreen(), 0 ); Loading Loading @@ -110,20 +105,21 @@ void BOARD::Draw( WinEDA_DrawPanel* aPanel, wxDC* DC, /***********************************************************************************/ /***********************************************************************************/ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklayer ) void WinEDA_GerberFrame::Trace_Gerber( wxDC* aDC, int aDraw_mode, int aPrintMasklayer ) /***********************************************************************************/ /***********************************************************************************/ /* Trace all elements of PCBs (i.e Spots, filled polygons or lines) on the active screen /* Trace all elements of PCBs (i.e Spots, filled polygons or lines) on the active screen * @param DC = current device context * @param aDC = current device context * @param draw_mode = draw mode for the device context (GR_COPY, GR_OR, GR_XOR ..) * @param aDraw_mode = draw mode for the device context (GR_COPY, GR_OR, GR_XOR ..) * @param printmasklayer = mask for allowed layer (=-1 to draw all layers) * @param aPrintMasklayer = mask for allowed layer (=-1 to draw all layers) */ */ { { if( !GetBoard() ) if( !GetBoard() ) return; return; bool erase = false; bool erase = false; int Color; int color; bool filled; bool filled; int layer = GetScreen()->m_Active_Layer; // Draw filled polygons // Draw filled polygons std::vector<wxPoint> points; std::vector<wxPoint> points; Loading @@ -131,102 +127,61 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay // minimize reallocations of the vector's internal array by starting with a good sized one. // minimize reallocations of the vector's internal array by starting with a good sized one. points.reserve(10000); points.reserve(10000); for( TRACK* track = GetBoard()->m_Zone; track; track = track->Next() ) TRACK* next_track; for( TRACK* track = GetBoard()->m_Zone; track; track = next_track ) { { if( !(track->ReturnMaskLayer() & printmasklayer) ) next_track = track->Next(); if( !(track->ReturnMaskLayer() & aPrintMasklayer) ) continue; continue; if( track->GetNet() == 0 ) // StartPoint if( (points.size() == 0) && (track->GetNet() == 0) ) // first point of a new polygon { if( points.size() ) // we have found a new polygon: Draw the old polygon { { if( erase ) { Color = g_DrawBgColor; filled = true; } else { Color = g_ColorsSettings.GetLayerColor( track->GetLayer() ); filled = (g_DisplayPolygonsModeSketch == 0); } GRClosedPoly( &DrawPanel->m_ClipBox, DC, points.size(), &points[0], filled, Color, Color ); } erase = ( track->m_Flags & DRAW_ERASED ); erase = ( track->m_Flags & DRAW_ERASED ); points.clear(); points.push_back( track->m_Start ); points.push_back( track->m_Start ); points.push_back( track->m_End ); } } else { points.push_back( track->m_End ); points.push_back( track->m_End ); } if( track->Next() == NULL ) // Last point if( (next_track == NULL ) || (next_track->GetNet() == 0) ) // EndPoint of the current polygon { { color = g_ColorsSettings.GetLayerColor( track->GetLayer() ); filled = (g_DisplayPolygonsModeSketch == 0); if( erase ) if( erase ) { { Color = g_DrawBgColor; color = g_DrawBgColor; filled = true; filled = true; } } else { Color = g_ColorsSettings.GetLayerColor( track->GetLayer() ); filled = (g_DisplayPolygonsModeSketch == 0); } GRClosedPoly( &DrawPanel->m_ClipBox, DC, points.size(), &points[0], GRClosedPoly( &DrawPanel->m_ClipBox, aDC, points.size(), &points[0], filled, Color, Color ); filled, color, color ); } points.clear(); } } // Draw tracks and flashes down here. This will probably not be a final solution to drawing order issues Draw_Track_Buffer( DrawPanel, DC, GetBoard(), draw_mode, printmasklayer ); if( IsElementVisible( DCODES_VISIBLE) ) Affiche_DCodes_Pistes( DrawPanel, DC, GetBoard(), GR_COPY ); GetScreen()->ClrRefreshReq(); } } /***************************************************************************************************/ // Draw tracks and flashes down here. void Draw_Track_Buffer( WinEDA_DrawPanel* panel, wxDC* DC, BOARD* Pcb, int draw_mode, // This will probably not be a final solution to drawing order issues int printmasklayer ) /***************************************************************************************************/ /* Function to draw the tracks (i.e Spots or lines) in gerbview * Polygons are not handled here (there are in Pcb->m_Zone) * @param DC = device context to draw * @param Pcb = Board to draw (only Pcb->m_Track is used) * @param draw_mode = draw mode for the device context (GR_COPY, GR_OR, GR_XOR ..) * @param printmasklayer = mask for allowed layer (=-1 to draw all layers) */ { int layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; GERBER* gerber = g_GERBER_List[layer]; GERBER* gerber = g_GERBER_List[layer]; int dcode_hightlight = 0; int dcode_hightlight = 0; if( gerber ) if( gerber ) dcode_hightlight = gerber->m_Selected_Tool; dcode_hightlight = gerber->m_Selected_Tool; for( TRACK* track = Pcb->m_Track; track; track = track->Next() ) for( TRACK* track = GetBoard()->m_Track; track; track = track->Next() ) { { if( !(track->ReturnMaskLayer() & printmasklayer) ) if( !(track->ReturnMaskLayer() & aPrintMasklayer) ) continue; continue; // D(printf("D:%p\n", track );) if( dcode_hightlight == track->GetNet() && track->GetLayer()==layer ) if( dcode_hightlight == track->GetNet() && track->GetLayer()==layer ) Trace_Segment( Pcb, panel, DC, track, draw_mode | GR_SURBRILL ); Trace_Segment( GetBoard(), DrawPanel, aDC, track, aDraw_mode | GR_SURBRILL ); else else Trace_Segment( Pcb, panel, DC, track, draw_mode ); Trace_Segment( GetBoard(), DrawPanel, aDC, track, aDraw_mode ); } } } if( IsElementVisible( DCODES_VISIBLE) ) Affiche_DCodes_Pistes( DrawPanel, aDC, GetBoard(), GR_COPY ); GetScreen()->ClrRefreshReq(); } #if 1 #if 1 Loading