2008-01-12 20:31:56 +00:00
|
|
|
|
/**********************************************/
|
|
|
|
|
/* vi_edit.cpp: som editing function for vias */
|
|
|
|
|
/**********************************************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
|
#include "gr_basic.h"
|
|
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
|
#include "pcbnew.h"
|
|
|
|
|
|
|
|
|
|
#include "id.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************************/
|
2008-01-12 20:31:56 +00:00
|
|
|
|
void WinEDA_PcbFrame::Via_Edit_Control( wxDC* DC, int command_type, SEGVIA* via )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/**********************************************************************************/
|
2008-01-12 20:31:56 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*
|
2008-01-12 20:31:56 +00:00
|
|
|
|
* Execute edit commands relative to vias
|
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2008-01-12 20:31:56 +00:00
|
|
|
|
int ii;
|
|
|
|
|
TRACK* via_struct;
|
|
|
|
|
|
|
|
|
|
switch( command_type )
|
|
|
|
|
{
|
|
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE1:
|
|
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE2:
|
|
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE3:
|
|
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE4:
|
|
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE5:
|
|
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE6:
|
|
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE7:
|
|
|
|
|
case ID_POPUP_PCB_SELECT_VIASIZE8: // selec the new current value for via size (via diameter)
|
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
|
ii = command_type - ID_POPUP_PCB_SELECT_VIASIZE1;
|
|
|
|
|
g_DesignSettings.m_CurrentViaSize = g_DesignSettings.m_ViaSizeHistory[ii];
|
|
|
|
|
DisplayTrackSettings();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_VIA_HOLE_ENTER_VALUE: // Enter a new alternate value for drill via
|
|
|
|
|
InstallPcbOptionsFrame( wxDefaultPosition, DC, ID_PCB_TRACK_SIZE_SETUP );
|
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_VIA_HOLE_TO_VALUE: // Set the drill via to custom
|
2008-01-28 18:44:14 +00:00
|
|
|
|
if( (g_DesignSettings.m_ViaDrillCustomValue > 0) && (g_DesignSettings.m_ViaDrillCustomValue < via->m_Width) )
|
2008-01-12 20:31:56 +00:00
|
|
|
|
{
|
|
|
|
|
via->Draw( DrawPanel, DC, GR_XOR );
|
2008-01-28 18:44:14 +00:00
|
|
|
|
via->SetDrillValue( g_DesignSettings.m_ViaDrillCustomValue );
|
2008-01-12 20:31:56 +00:00
|
|
|
|
via->Draw( DrawPanel, DC, GR_OR );
|
|
|
|
|
GetScreen()->SetModify();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
DisplayError( this, _( "Incorrect value for Via drill. No via drill change" ) );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_VIA_HOLE_EXPORT: // Export the current drill value as the new custom value
|
|
|
|
|
if( via->GetDrillValue() > 0 )
|
2008-01-28 18:44:14 +00:00
|
|
|
|
g_DesignSettings.m_ViaDrillCustomValue = via->GetDrillValue();
|
2008-01-12 20:31:56 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_VIA_HOLE_EXPORT_TO_OTHERS: // Export the current drill value to via which h<>ave the same size
|
|
|
|
|
if( via->GetDrillValue() > 0 )
|
2008-01-28 18:44:14 +00:00
|
|
|
|
g_DesignSettings.m_ViaDrillCustomValue = via->GetDrillValue();
|
2008-01-12 20:31:56 +00:00
|
|
|
|
via_struct = m_Pcb->m_Track;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
for( ; via_struct != NULL; via_struct = via_struct->Next() )
|
2008-01-12 20:31:56 +00:00
|
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
|
if( via_struct->Type() == TYPE_VIA ) /* mise a jour du diametre de la via */
|
2008-01-12 20:31:56 +00:00
|
|
|
|
{
|
|
|
|
|
if( via_struct->m_Width != via->m_Width )
|
|
|
|
|
continue;
|
|
|
|
|
via_struct->Draw( DrawPanel, DC, GR_XOR );
|
|
|
|
|
via_struct->SetDrillValue( via->GetDrillValue() );
|
|
|
|
|
via_struct->Draw( DrawPanel, DC, GR_OR );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GetScreen()->SetModify();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_VIA_HOLE_TO_DEFAULT:
|
|
|
|
|
via->Draw( DrawPanel, DC, GR_XOR );
|
|
|
|
|
via->SetDrillDefault();
|
|
|
|
|
via->Draw( DrawPanel, DC, GR_OR );
|
|
|
|
|
GetScreen()->SetModify();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_VIA_HOLE_RESET_TO_DEFAULT: // Reset all via hole to default value
|
|
|
|
|
via_struct = m_Pcb->m_Track;
|
2008-08-29 12:14:45 +00:00
|
|
|
|
for( ; via_struct != NULL; via_struct = via_struct->Next() )
|
2008-01-12 20:31:56 +00:00
|
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
|
if( via_struct->Type() == TYPE_VIA ) /* mise a jour du diametre de la via */
|
2008-01-12 20:31:56 +00:00
|
|
|
|
{
|
2008-08-29 12:14:45 +00:00
|
|
|
|
if( ! via_struct->IsDrillDefault() )
|
2008-01-12 20:31:56 +00:00
|
|
|
|
{
|
|
|
|
|
via_struct->Draw( DrawPanel, DC, GR_XOR );
|
|
|
|
|
via_struct->SetDrillDefault();
|
|
|
|
|
via_struct->Draw( DrawPanel, DC, GR_OR );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GetScreen()->SetModify();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
DisplayError( this, wxT( "WinEDA_PcbFrame::Via_Edition() error: unknown command" ) );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|