2007-05-06 16:03:28 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2008-01-26 02:02:27 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
// Name: dialog_track_options.cpp
|
|
|
|
// Author: jean-pierre Charras
|
2007-11-25 06:42:47 +00:00
|
|
|
// Modified by:
|
2009-02-17 09:03:45 +00:00
|
|
|
// Created: 17 feb 2009
|
|
|
|
// Licence: GPL
|
2007-05-06 16:03:28 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2009-02-17 09:03:45 +00:00
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
|
|
|
#include "pcbnew.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
#include "dialog_track_options.h"
|
|
|
|
|
|
|
|
|
2009-02-17 09:03:45 +00:00
|
|
|
/**
|
|
|
|
* DIALOG_TRACKS_OPTIONS, derived from DIALOG_TRACKS_OPTIONS_BASE
|
|
|
|
* @see dialog_track_options_base.h and dialog_track_options_base.cpp,
|
|
|
|
* automatically created by wxFormBuilder
|
2007-05-06 16:03:28 +00:00
|
|
|
*/
|
|
|
|
|
2009-02-17 09:03:45 +00:00
|
|
|
DIALOG_TRACKS_OPTIONS::DIALOG_TRACKS_OPTIONS( WinEDA_PcbFrame* parent )
|
|
|
|
: DIALOG_TRACKS_OPTIONS_BASE(parent)
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-02-17 09:03:45 +00:00
|
|
|
m_Parent = parent;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2008-01-26 02:02:27 +00:00
|
|
|
|
2009-02-17 09:03:45 +00:00
|
|
|
void DIALOG_TRACKS_OPTIONS::OnInitDialog( wxInitDialogEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-02-17 09:03:45 +00:00
|
|
|
SetFocus();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-02-17 09:03:45 +00:00
|
|
|
// deselect the existing text, seems SetFocus() wants to emulate Microsoft, which is not desireable here.
|
|
|
|
m_OptViaSize->SetSelection( 0, 0 );
|
2007-11-25 06:42:47 +00:00
|
|
|
|
2009-02-17 09:03:45 +00:00
|
|
|
SetDisplayValue();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2008-01-26 02:02:27 +00:00
|
|
|
if( GetSizer() )
|
2007-11-25 22:09:42 +00:00
|
|
|
{
|
2008-01-26 02:02:27 +00:00
|
|
|
GetSizer()->SetSizeHints( this );
|
2007-11-25 22:09:42 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-02-17 09:03:45 +00:00
|
|
|
event.Skip();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-01-26 02:02:27 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*************************************************/
|
2009-02-17 09:03:45 +00:00
|
|
|
void DIALOG_TRACKS_OPTIONS::SetDisplayValue()
|
2007-06-05 12:10:51 +00:00
|
|
|
/*************************************************/
|
|
|
|
{
|
2008-01-26 02:02:27 +00:00
|
|
|
AddUnitSymbol( *m_ViaSizeTitle );
|
|
|
|
AddUnitSymbol( *m_MicroViaSizeTitle );
|
|
|
|
AddUnitSymbol( *m_ViaDefaultDrillValueTitle );
|
|
|
|
AddUnitSymbol( *m_MicroViaDrillTitle );
|
|
|
|
AddUnitSymbol( *m_ViaAltDrillValueTitle );
|
|
|
|
AddUnitSymbol( *m_TrackWidthTitle );
|
|
|
|
AddUnitSymbol( *m_TrackClearanceTitle );
|
|
|
|
AddUnitSymbol( *m_MaskClearanceTitle );
|
|
|
|
|
|
|
|
int Internal_Unit = m_Parent->m_InternalUnits;
|
|
|
|
PutValueInLocalUnits( *m_OptViaSize, g_DesignSettings.m_CurrentViaSize, Internal_Unit );
|
|
|
|
PutValueInLocalUnits( *m_MicroViaSizeCtrl,
|
|
|
|
g_DesignSettings.m_CurrentMicroViaSize,
|
|
|
|
Internal_Unit );
|
|
|
|
PutValueInLocalUnits( *m_OptViaDrill, g_DesignSettings.m_ViaDrill, Internal_Unit );
|
|
|
|
PutValueInLocalUnits( *m_MicroViaDrillCtrl, g_DesignSettings.m_MicroViaDrill, Internal_Unit );
|
2009-02-17 09:03:45 +00:00
|
|
|
PutValueInLocalUnits( *m_OptCustomViaDrill,
|
|
|
|
g_DesignSettings.m_ViaDrillCustomValue,
|
|
|
|
Internal_Unit );
|
2008-01-26 02:02:27 +00:00
|
|
|
PutValueInLocalUnits( *m_OptTrackWidth, g_DesignSettings.m_CurrentTrackWidth, Internal_Unit );
|
|
|
|
PutValueInLocalUnits( *m_OptTrackClearance, g_DesignSettings.m_TrackClearence, Internal_Unit );
|
|
|
|
PutValueInLocalUnits( *m_OptMaskMargin, g_DesignSettings.m_MaskMargin, Internal_Unit );
|
|
|
|
if( g_DesignSettings.m_CurrentViaType != VIA_THROUGH )
|
|
|
|
m_OptViaType->SetSelection( 1 );
|
|
|
|
|
|
|
|
m_MicroViaSizeTitle->Enable( g_DesignSettings.m_MicroViasAllowed );
|
|
|
|
m_MicroViaSizeCtrl->Enable( g_DesignSettings.m_MicroViasAllowed );
|
|
|
|
|
|
|
|
m_MicroViaDrillTitle->Enable( g_DesignSettings.m_MicroViasAllowed );
|
|
|
|
m_MicroViaDrillCtrl->Enable( g_DesignSettings.m_MicroViasAllowed );
|
2009-02-17 09:03:45 +00:00
|
|
|
|
|
|
|
m_AllowMicroViaCtrl->SetValue( g_DesignSettings.m_MicroViasAllowed );
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2008-01-26 02:02:27 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
/*******************************************************************/
|
2009-02-17 09:03:45 +00:00
|
|
|
void DIALOG_TRACKS_OPTIONS::OnButtonOkClick( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
/*******************************************************************/
|
|
|
|
{
|
2008-01-26 02:02:27 +00:00
|
|
|
g_DesignSettings.m_CurrentViaType = VIA_THROUGH;
|
|
|
|
if( m_OptViaType->GetSelection() > 0 )
|
|
|
|
g_DesignSettings.m_CurrentViaType = VIA_BLIND_BURIED;
|
|
|
|
|
|
|
|
g_DesignSettings.m_CurrentViaSize =
|
|
|
|
ReturnValueFromTextCtrl( *m_OptViaSize, m_Parent->m_InternalUnits );
|
|
|
|
g_DesignSettings.m_CurrentMicroViaSize =
|
|
|
|
ReturnValueFromTextCtrl( *m_MicroViaSizeCtrl, m_Parent->m_InternalUnits );
|
|
|
|
|
|
|
|
g_DesignSettings.m_MicroViaDrill =
|
|
|
|
ReturnValueFromTextCtrl( *m_MicroViaDrillCtrl, m_Parent->m_InternalUnits );
|
|
|
|
g_DesignSettings.m_ViaDrill =
|
|
|
|
ReturnValueFromTextCtrl( *m_OptViaDrill, m_Parent->m_InternalUnits );
|
2008-01-28 18:44:14 +00:00
|
|
|
g_DesignSettings.m_ViaDrillCustomValue =
|
2008-01-26 02:02:27 +00:00
|
|
|
ReturnValueFromTextCtrl( *m_OptCustomViaDrill, m_Parent->m_InternalUnits );
|
2008-01-12 20:31:56 +00:00
|
|
|
g_DesignSettings.m_MicroViasAllowed = m_AllowMicroViaCtrl->IsChecked();
|
|
|
|
|
2008-01-26 02:02:27 +00:00
|
|
|
g_DesignSettings.m_CurrentTrackWidth =
|
|
|
|
ReturnValueFromTextCtrl( *m_OptTrackWidth, m_Parent->m_InternalUnits );
|
|
|
|
g_DesignSettings.m_TrackClearence =
|
|
|
|
ReturnValueFromTextCtrl( *m_OptTrackClearance, m_Parent->m_InternalUnits );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2008-01-26 02:02:27 +00:00
|
|
|
g_DesignSettings.m_MaskMargin =
|
|
|
|
ReturnValueFromTextCtrl( *m_OptMaskMargin, m_Parent->m_InternalUnits );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2008-01-26 02:02:27 +00:00
|
|
|
m_Parent->DisplayTrackSettings();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
m_Parent->AddHistory( g_DesignSettings.m_CurrentViaSize, TYPE_VIA );
|
|
|
|
m_Parent->AddHistory( g_DesignSettings.m_CurrentTrackWidth, TYPE_TRACK );
|
2009-06-19 20:13:22 +00:00
|
|
|
m_Parent->AddHistory( g_DesignSettings.m_TrackClearence, TYPE_CLR );
|
2008-01-26 02:02:27 +00:00
|
|
|
EndModal( 1 );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************************************/
|
2008-01-26 02:02:27 +00:00
|
|
|
void WinEDA_BasePcbFrame::AddHistory( int value, KICAD_T type )
|
2007-05-06 16:03:28 +00:00
|
|
|
/**********************************************************************/
|
2008-01-26 02:02:27 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
// Mise a jour des listes des dernieres epaisseurs de via et track utilisées
|
|
|
|
{
|
2008-01-26 02:02:27 +00:00
|
|
|
bool addhistory = TRUE;
|
|
|
|
int ii;
|
|
|
|
|
|
|
|
switch( type )
|
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_TRACK:
|
2008-01-26 02:02:27 +00:00
|
|
|
for( ii = 0; ii < HISTORY_NUMBER; ii++ )
|
|
|
|
{
|
|
|
|
if( g_DesignSettings.m_TrackWidthHistory[ii] == value )
|
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
addhistory = FALSE;
|
2008-01-26 02:02:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !addhistory )
|
|
|
|
break;
|
2008-12-04 04:28:11 +00:00
|
|
|
|
2009-02-17 09:03:45 +00:00
|
|
|
for( ii = HISTORY_NUMBER - 1; ii > 0; ii-- )
|
2008-01-26 02:02:27 +00:00
|
|
|
{
|
2009-02-17 09:03:45 +00:00
|
|
|
g_DesignSettings.m_TrackWidthHistory[ii] =
|
|
|
|
g_DesignSettings.m_TrackWidthHistory[ii - 1];
|
2008-01-26 02:02:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_DesignSettings.m_TrackWidthHistory[0] = value;
|
|
|
|
|
|
|
|
// Reclassement par valeur croissante
|
2009-02-17 09:03:45 +00:00
|
|
|
for( ii = 0; ii < HISTORY_NUMBER - 1; ii++ )
|
2008-01-26 02:02:27 +00:00
|
|
|
{
|
2009-02-17 09:03:45 +00:00
|
|
|
if( g_DesignSettings.m_TrackWidthHistory[ii + 1] == 0 )
|
2008-01-26 02:02:27 +00:00
|
|
|
break; // Fin de liste
|
2008-12-04 04:28:11 +00:00
|
|
|
|
2008-01-26 02:02:27 +00:00
|
|
|
if( g_DesignSettings.m_TrackWidthHistory[ii] >
|
2009-02-17 09:03:45 +00:00
|
|
|
g_DesignSettings.m_TrackWidthHistory[ii + 1] )
|
2008-01-26 02:02:27 +00:00
|
|
|
{
|
|
|
|
EXCHG( g_DesignSettings.m_TrackWidthHistory[ii],
|
|
|
|
g_DesignSettings.m_TrackWidthHistory[ii + 1] );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
2009-06-19 20:13:22 +00:00
|
|
|
case TYPE_CLR:
|
|
|
|
for( ii = 0; ii < HISTORY_NUMBER; ii++ )
|
|
|
|
{
|
|
|
|
if( g_DesignSettings.m_TrackClearenceHistory[ii] == value )
|
|
|
|
{
|
|
|
|
addhistory = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !addhistory )
|
|
|
|
break;
|
|
|
|
|
|
|
|
for( ii = HISTORY_NUMBER - 1; ii > 0; ii-- )
|
|
|
|
{
|
|
|
|
g_DesignSettings.m_TrackClearenceHistory[ii] =
|
|
|
|
g_DesignSettings.m_TrackClearenceHistory[ii - 1];
|
|
|
|
}
|
|
|
|
|
|
|
|
g_DesignSettings.m_TrackClearenceHistory[0] = value;
|
|
|
|
|
|
|
|
// Reclassement par valeur croissante
|
|
|
|
for( ii = 0; ii < HISTORY_NUMBER - 1; ii++ )
|
|
|
|
{
|
|
|
|
if( g_DesignSettings.m_TrackClearenceHistory[ii + 1] == 0 )
|
|
|
|
break; // Fin de liste
|
|
|
|
|
|
|
|
if( g_DesignSettings.m_TrackClearenceHistory[ii] >
|
|
|
|
g_DesignSettings.m_TrackClearenceHistory[ii + 1] )
|
|
|
|
{
|
|
|
|
EXCHG( g_DesignSettings.m_TrackClearenceHistory[ii],
|
|
|
|
g_DesignSettings.m_TrackClearenceHistory[ii + 1] );
|
|
|
|
}
|
|
|
|
}
|
2008-01-26 02:02:27 +00:00
|
|
|
|
2009-06-19 20:13:22 +00:00
|
|
|
break;
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_VIA:
|
2008-01-26 02:02:27 +00:00
|
|
|
for( ii = 0; ii < HISTORY_NUMBER; ii++ )
|
|
|
|
{
|
|
|
|
if( g_DesignSettings.m_ViaSizeHistory[ii] == value )
|
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
addhistory = FALSE;
|
2008-01-26 02:02:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !addhistory )
|
|
|
|
break;
|
|
|
|
|
2009-02-17 09:03:45 +00:00
|
|
|
for( ii = HISTORY_NUMBER - 1; ii > 0; ii-- )
|
2008-01-26 02:02:27 +00:00
|
|
|
{
|
2009-02-17 09:03:45 +00:00
|
|
|
g_DesignSettings.m_ViaSizeHistory[ii] = g_DesignSettings.m_ViaSizeHistory[ii - 1];
|
2008-01-26 02:02:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_DesignSettings.m_ViaSizeHistory[0] = value;
|
|
|
|
|
|
|
|
// Reclassement par valeur croissante
|
2009-02-17 09:03:45 +00:00
|
|
|
for( ii = 0; ii < HISTORY_NUMBER - 1; ii++ )
|
2008-01-26 02:02:27 +00:00
|
|
|
{
|
2009-02-17 09:03:45 +00:00
|
|
|
if( g_DesignSettings.m_ViaSizeHistory[ii + 1] == 0 )
|
2008-01-26 02:02:27 +00:00
|
|
|
break; // Fin de liste
|
2008-12-04 04:28:11 +00:00
|
|
|
|
2009-02-17 09:03:45 +00:00
|
|
|
if( g_DesignSettings.m_ViaSizeHistory[ii] > g_DesignSettings.m_ViaSizeHistory[ii + 1] )
|
2008-01-26 02:02:27 +00:00
|
|
|
{
|
|
|
|
EXCHG( g_DesignSettings.m_ViaSizeHistory[ii],
|
2009-02-17 09:03:45 +00:00
|
|
|
g_DesignSettings.m_ViaSizeHistory[ii + 1] );
|
2008-01-26 02:02:27 +00:00
|
|
|
}
|
|
|
|
}
|
2009-02-17 09:03:45 +00:00
|
|
|
|
2008-01-26 02:02:27 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*!
|
|
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
|
|
|
|
*/
|
|
|
|
|
2009-02-17 09:03:45 +00:00
|
|
|
void DIALOG_TRACKS_OPTIONS::OnButtonCancelClick( wxCommandEvent& event )
|
2007-11-25 22:09:42 +00:00
|
|
|
{
|
2009-02-17 09:03:45 +00:00
|
|
|
EndModal( 0 );
|
2007-11-25 22:09:42 +00:00
|
|
|
}
|
|
|
|
|
2008-01-12 20:31:56 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX_ALLOWS_MICROVIA
|
|
|
|
*/
|
|
|
|
|
2009-02-17 09:03:45 +00:00
|
|
|
void DIALOG_TRACKS_OPTIONS::OnCheckboxAllowsMicroviaClick( wxCommandEvent& event )
|
2008-01-12 20:31:56 +00:00
|
|
|
{
|
2008-01-26 02:02:27 +00:00
|
|
|
bool state = m_AllowMicroViaCtrl->IsChecked();
|
2008-01-12 20:31:56 +00:00
|
|
|
|
2008-01-26 02:02:27 +00:00
|
|
|
m_MicroViaSizeTitle->Enable( state );
|
|
|
|
m_MicroViaSizeCtrl->Enable( state );
|
|
|
|
m_MicroViaDrillTitle->Enable( state );
|
|
|
|
m_MicroViaDrillCtrl->Enable( state );
|
|
|
|
}
|