2007-12-01 03:42:52 +00:00
|
|
|
/***************************************************************/
|
|
|
|
/* Edition des pistes: Routines de modification de dimensions: */
|
|
|
|
/* Modif de largeurs de segment, piste, net , zone et diam Via */
|
|
|
|
/***************************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "gr_basic.h"
|
|
|
|
#include "common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
|
|
|
#include "confirm.h"
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "pcbnew.h"
|
|
|
|
#include "autorout.h"
|
|
|
|
#include "protos.h"
|
|
|
|
|
|
|
|
/* Routines Locales */
|
|
|
|
|
|
|
|
/*********************************************************************/
|
2007-12-01 03:42:52 +00:00
|
|
|
int WinEDA_PcbFrame::Edit_TrackSegm_Width( wxDC* DC, TRACK* pt_segm )
|
2007-06-05 12:10:51 +00:00
|
|
|
/*********************************************************************/
|
2007-12-01 03:42:52 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/* Routine to modify one track segment width or one via diameter.
|
2007-12-01 03:42:52 +00:00
|
|
|
* Basic routine used by other routines when editing tracks or vias
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-12-01 03:42:52 +00:00
|
|
|
int errdrc = OK_DRC;
|
|
|
|
int old_w, consigne;
|
|
|
|
|
|
|
|
DrawPanel->CursorOff( DC ); // Erase cursor shape
|
|
|
|
pt_segm->Draw( DrawPanel, DC, GR_XOR ); // Erase old track shape
|
|
|
|
|
|
|
|
/* Test DRC and width change */
|
|
|
|
old_w = pt_segm->m_Width;
|
|
|
|
consigne = pt_segm->m_Width = g_DesignSettings.m_CurrentTrackWidth;
|
2008-12-04 04:28:11 +00:00
|
|
|
if( pt_segm->Type() == TYPE_VIA )
|
2007-12-01 03:42:52 +00:00
|
|
|
{
|
|
|
|
consigne = pt_segm->m_Width = g_DesignSettings.m_CurrentViaSize;
|
2008-11-24 06:53:43 +00:00
|
|
|
if ( pt_segm->m_Shape == VIA_MICROVIA )
|
|
|
|
consigne = pt_segm->m_Width = g_DesignSettings.m_CurrentMicroViaSize;
|
2007-12-01 03:42:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( old_w < consigne ) /* DRC utile puisque augm de dimension */
|
|
|
|
{
|
|
|
|
if( Drc_On )
|
2009-01-05 05:21:35 +00:00
|
|
|
errdrc = m_drc->Drc( pt_segm, GetBoard()->m_Track );
|
2007-12-01 03:42:52 +00:00
|
|
|
if( errdrc == BAD_DRC )
|
|
|
|
pt_segm->m_Width = old_w;
|
|
|
|
else
|
|
|
|
GetScreen()->SetModify();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
GetScreen()->SetModify(); /* Correction systematiquement faite si reduction */
|
|
|
|
|
|
|
|
pt_segm->Draw( DrawPanel, DC, GR_OR ); // Display new track shape
|
|
|
|
DrawPanel->CursorOn( DC ); // Display cursor shape
|
|
|
|
return errdrc;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-12-01 03:42:52 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*****************************************************************/
|
2007-12-01 03:42:52 +00:00
|
|
|
void WinEDA_PcbFrame::Edit_Track_Width( wxDC* DC, TRACK* pt_segm )
|
2007-06-05 12:10:51 +00:00
|
|
|
/*****************************************************************/
|
|
|
|
{
|
2007-12-01 03:42:52 +00:00
|
|
|
int ii;
|
|
|
|
TRACK* pt_track;
|
|
|
|
int errdrc;
|
|
|
|
int nb_segm, nb_segm_modifies = 0, nb_segm_non_modifies = 0;
|
|
|
|
|
|
|
|
if( pt_segm == NULL )
|
|
|
|
return;
|
|
|
|
|
|
|
|
pt_track = Marque_Une_Piste( this, DC, pt_segm, &nb_segm, 0 );
|
2008-11-24 06:53:43 +00:00
|
|
|
for( ii = 0; ii < nb_segm; ii++, pt_track = pt_track->Next() )
|
2007-12-01 03:42:52 +00:00
|
|
|
{
|
|
|
|
pt_track->SetState( BUSY, OFF );
|
|
|
|
errdrc = Edit_TrackSegm_Width( DC, pt_track );
|
|
|
|
if( errdrc == BAD_DRC )
|
|
|
|
nb_segm_non_modifies++;
|
|
|
|
else
|
|
|
|
nb_segm_modifies++;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************/
|
2007-12-01 03:42:52 +00:00
|
|
|
void WinEDA_PcbFrame::Edit_Net_Width( wxDC* DC, int Netcode )
|
2007-06-05 12:10:51 +00:00
|
|
|
/***********************************************************/
|
|
|
|
{
|
2007-12-01 03:42:52 +00:00
|
|
|
TRACK* pt_segm;
|
|
|
|
int errdrc;
|
|
|
|
int nb_segm_modifies = 0;
|
|
|
|
int nb_segm_non_modifies = 0;
|
|
|
|
|
|
|
|
if( Netcode <= 0 )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if( !IsOK( this, _( "Change track width (entire NET) ?" ) ) )
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* balayage des segments */
|
2009-01-05 05:21:35 +00:00
|
|
|
for( pt_segm = GetBoard()->m_Track; pt_segm != NULL; pt_segm = pt_segm->Next() )
|
2007-12-01 03:42:52 +00:00
|
|
|
{
|
|
|
|
if( Netcode != pt_segm->GetNet() ) /* mauvaise piste */
|
|
|
|
continue;
|
|
|
|
/* piste d'un net trouvee */
|
|
|
|
errdrc = Edit_TrackSegm_Width( DC, pt_segm );
|
|
|
|
if( errdrc == BAD_DRC )
|
|
|
|
nb_segm_non_modifies++;
|
|
|
|
else
|
|
|
|
nb_segm_modifies++;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
2007-12-01 03:42:52 +00:00
|
|
|
bool WinEDA_PcbFrame::Resize_Pistes_Vias( wxDC* DC, bool Track, bool Via )
|
2007-06-05 12:10:51 +00:00
|
|
|
/*************************************************************************/
|
2007-12-01 03:42:52 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/* remet a jour la largeur des pistes et/ou le diametre des vias
|
2007-12-01 03:42:52 +00:00
|
|
|
* Si piste == 0 , pas de cht sur les pistes
|
|
|
|
* Si via == 0 , pas de cht sur les vias
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-12-01 03:42:52 +00:00
|
|
|
TRACK* pt_segm;
|
|
|
|
int errdrc;
|
|
|
|
int nb_segm_modifies = 0;
|
|
|
|
int nb_segm_non_modifies = 0;
|
|
|
|
|
|
|
|
if( Track && Via )
|
|
|
|
{
|
|
|
|
if( !IsOK( this, _( "Edit All Tracks and Vias Sizes" ) ) )
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else if( Via )
|
|
|
|
{
|
|
|
|
if( !IsOK( this, _( "Edit All Via Sizes" ) ) )
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else if( Track )
|
|
|
|
{
|
|
|
|
if( !IsOK( this, _( "Edit All Track Sizes" ) ) )
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
pt_segm = GetBoard()->m_Track;
|
2008-11-24 06:53:43 +00:00
|
|
|
for( ; pt_segm != NULL; pt_segm = pt_segm->Next() )
|
2007-12-01 03:42:52 +00:00
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
if( pt_segm->Type() == TYPE_VIA ) /* mise a jour du diametre de la via */
|
2007-12-01 03:42:52 +00:00
|
|
|
{
|
|
|
|
if( Via )
|
|
|
|
{
|
|
|
|
errdrc = Edit_TrackSegm_Width( DC, pt_segm );
|
|
|
|
if( errdrc == BAD_DRC )
|
|
|
|
nb_segm_non_modifies++;
|
|
|
|
else
|
|
|
|
nb_segm_modifies++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else /* mise a jour de la largeur du segment */
|
|
|
|
{
|
|
|
|
if( Track )
|
|
|
|
{
|
|
|
|
errdrc = Edit_TrackSegm_Width( DC, pt_segm );
|
|
|
|
if( errdrc == BAD_DRC )
|
|
|
|
nb_segm_non_modifies++;
|
|
|
|
else
|
|
|
|
nb_segm_modifies++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( nb_segm_modifies )
|
|
|
|
return TRUE;
|
|
|
|
return FALSE;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|