code cleanup

This commit is contained in:
charras 2009-05-25 16:07:33 +00:00
parent b13267f496
commit 497cb9f7d0
4 changed files with 19 additions and 21 deletions

View File

@ -442,6 +442,11 @@ void GRLine( EDA_Rect* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int wi
width ), Color ); width ), Color );
} }
void GRLine(EDA_Rect * aClipBox, wxDC * aDC, wxPoint aStart, wxPoint aEnd, int aWidth, int aColor)
{
GRSLine( aClipBox, aDC, GRMapX( aStart.x ), GRMapY( aStart.y ), GRMapX( aEnd.x ), GRMapY( aEnd.y ),
ZoomValue( aWidth ), aColor );
}
/***************************************************/ /***************************************************/
/* Routine to draw a Dashed line, in Screen space. */ /* Routine to draw a Dashed line, in Screen space. */

View File

@ -70,6 +70,7 @@ void GRForceBlackPen(bool flagforce );
bool GetGRForceBlackPenState( void ); bool GetGRForceBlackPenState( void );
void SetPenMinWidth(int minwidth); /* ajustage de la largeur mini de plume */ void SetPenMinWidth(int minwidth); /* ajustage de la largeur mini de plume */
void GRLine(EDA_Rect * aClipBox, wxDC * aDC, wxPoint aStart, wxPoint aEnd, int aWidth, int aColor);
void GRLine(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int width, int Color); void GRLine(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int width, int Color);
void GRMixedLine(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int width, int Color); void GRMixedLine(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int width, int Color);
void GRSMixedLine(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int width, int Color); void GRSMixedLine(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int width, int Color);

View File

@ -174,15 +174,12 @@ void NETINFO_ITEM::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const
/* class RATSNEST_ITEM */ /* class RATSNEST_ITEM */
/***********************/ /***********************/
/** function Draw /** function Draw
* Draws a line (a ratsnest) from the starting pad to the ending pad * Draws a line (a ratsnest) from the starting pad to the ending pad
*/ */
void RATSNEST_ITEM::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPoint& aOffset ) void RATSNEST_ITEM::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPoint& aOffset )
{ {
GRLine( &panel->m_ClipBox, DC, m_PadStart->m_Pos.x + aOffset.x, GRLine( &panel->m_ClipBox, DC, m_PadStart->m_Pos - aOffset,
m_PadStart->m_Pos.y + aOffset.y, m_PadEnd->m_Pos - aOffset, 0, g_DesignSettings.m_RatsnestColor );
m_PadEnd->m_Pos.x + aOffset.x,
m_PadEnd->m_Pos.y + aOffset.y,
0, g_DesignSettings.m_RatsnestColor );
} }

View File

@ -767,7 +767,7 @@ void WinEDA_BasePcbFrame::Tst_Ratsnest( wxDC* DC, int ref_netcode )
int WinEDA_BasePcbFrame::Test_1_Net_Ratsnest( wxDC* DC, int ref_netcode ) int WinEDA_BasePcbFrame::Test_1_Net_Ratsnest( wxDC* DC, int ref_netcode )
/**************************************************************************/ /**************************************************************************/
/** /** function Test_1_Net_Ratsnest
* Compute the rastnest relative to the net "net_code" * Compute the rastnest relative to the net "net_code"
* @param ref_netcode = netcode used to compute the rastnest. * @param ref_netcode = netcode used to compute the rastnest.
*/ */
@ -1043,27 +1043,24 @@ void WinEDA_BasePcbFrame::trace_ratsnest_module( wxDC* DC )
GRSetDrawMode( DC, GR_XOR ); GRSetDrawMode( DC, GR_XOR );
int tmpcolor = g_DesignSettings.m_RatsnestColor; int tmpcolor = g_DesignSettings.m_RatsnestColor;
wxPoint offset = -g_Offset_Module;
while( ii-- > 0 ) while( ii-- > 0 )
{ {
if( local_chevelu->m_Status & LOCAL_RATSNEST_ITEM ) if( local_chevelu->m_Status & LOCAL_RATSNEST_ITEM )
{ {
g_DesignSettings.m_RatsnestColor = YELLOW; g_DesignSettings.m_RatsnestColor = YELLOW;
local_chevelu->Draw( DrawPanel, DC, GR_XOR, offset ); local_chevelu->Draw( DrawPanel, DC, GR_XOR, g_Offset_Module );
} }
else else
{ {
g_DesignSettings.m_RatsnestColor = tmpcolor; g_DesignSettings.m_RatsnestColor = tmpcolor;
GRLine( &DrawPanel->m_ClipBox, DC, wxPoint tmp = local_chevelu->m_PadStart->m_Pos;
local_chevelu->m_PadStart->m_Pos.x + offset.x, local_chevelu->m_PadStart->m_Pos -= g_Offset_Module;
local_chevelu->m_PadStart->m_Pos.y + offset.y, local_chevelu->Draw( DrawPanel, DC, GR_XOR, wxPoint(0,0) );
local_chevelu->m_PadEnd->m_Pos.x, local_chevelu->m_PadStart->m_Pos = tmp;
local_chevelu->m_PadEnd->m_Pos.y,
0, g_DesignSettings.m_RatsnestColor );
} }
local_chevelu++; local_chevelu++;
} }
g_DesignSettings.m_RatsnestColor = tmpcolor; g_DesignSettings.m_RatsnestColor = tmpcolor;
} }
@ -1154,7 +1151,7 @@ void WinEDA_BasePcbFrame::build_ratsnest_pad( BOARD_ITEM* ref,
NETINFO_ITEM * net = m_Pcb->FindNet(current_net_code); NETINFO_ITEM * net = m_Pcb->FindNet(current_net_code);
if ( net == NULL ) if ( net == NULL )
return; return;
// Create a list of pads candidates ( pads not already connected to the current track: // Create a list of pads candidates ( pads not already connected to the current track:
for( unsigned ii = 0; ii < net->m_ListPad.size(); ii++ ) for( unsigned ii = 0; ii < net->m_ListPad.size(); ii++ )
{ {
@ -1186,15 +1183,13 @@ void WinEDA_BasePcbFrame::trace_ratsnest_pad( wxDC* DC )
if( s_RatsnestMouseToPads.size() == 0) if( s_RatsnestMouseToPads.size() == 0)
return; return;
GRSetDrawMode( DC, GR_XOR ); GRSetDrawMode( DC, GR_XOR );
for( int ii = 0; ii < (int)s_RatsnestMouseToPads.size(); ii++ ) for( int ii = 0; ii < (int)s_RatsnestMouseToPads.size(); ii++ )
{ {
if( ii >= g_MaxLinksShowed ) if( ii >= g_MaxLinksShowed )
break; break;
GRLine( &DrawPanel->m_ClipBox, DC, s_CursorPos.x, s_CursorPos.y, GRLine( &DrawPanel->m_ClipBox, DC, s_CursorPos, s_RatsnestMouseToPads[ii], 0, YELLOW );
s_RatsnestMouseToPads[ii].x, s_RatsnestMouseToPads[ii].y,
0, YELLOW );
} }
} }