Commit 112adccb authored by Tomasz Włostowski's avatar Tomasz Włostowski

router: differential pairs & length tuning support

parent e5deafb4
......@@ -104,6 +104,10 @@ set( PCBNEW_DIALOGS
dialogs/dialog_pcb_text_properties_base.cpp
dialogs/dialog_pns_settings.cpp
dialogs/dialog_pns_settings_base.cpp
dialogs/dialog_pns_diff_pair_dimensions.cpp
dialogs/dialog_pns_diff_pair_dimensions_base.cpp
dialogs/dialog_pns_length_tuning_settings.cpp
dialogs/dialog_pns_length_tuning_settings_base.cpp
dialogs/dialog_non_copper_zones_properties.cpp
dialogs/dialog_non_copper_zones_properties_base.cpp
dialogs/dialog_pad_properties.cpp
......@@ -275,6 +279,7 @@ set( PCBNEW_CLASS_SRCS
tools/module_tools.cpp
tools/placement_tool.cpp
tools/common_actions.cpp
tools/grid_helper.cpp
tools/tools_common.cpp
)
......
/*
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2014-2015 CERN
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Push and Shove diff pair dimensions (gap) settings dialog.
*/
#include "dialog_pns_diff_pair_dimensions.h"
#include <router/pns_sizes_settings.h>
DIALOG_PNS_DIFF_PAIR_DIMENSIONS::DIALOG_PNS_DIFF_PAIR_DIMENSIONS( wxWindow* aParent, PNS_SIZES_SETTINGS& aSizes ) :
DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE( aParent ),
m_traceWidth ( this, m_traceWidthText, m_traceWidthUnit ),
m_traceGap (this, m_traceGapText, m_traceGapUnit ),
m_viaGap ( this, m_viaGapText, m_viaGapUnit ),
m_sizes( aSizes )
{
m_traceWidth.SetValue ( aSizes.DiffPairWidth() );
m_traceGap.SetValue ( aSizes.DiffPairGap() );
m_viaGap.SetValue ( aSizes.DiffPairViaGap() );
m_viaTraceGapEqual->SetValue ( m_sizes.DiffPairViaGapSameAsTraceGap() );
updateCheckbox();
}
void DIALOG_PNS_DIFF_PAIR_DIMENSIONS::updateCheckbox()
{
printf("Checked: %d", m_viaTraceGapEqual->GetValue());
if( m_viaTraceGapEqual->GetValue() )
{
m_sizes.SetDiffPairViaGapSameAsTraceGap( true );
m_viaGapText->Disable();
m_viaGapLabel->Disable();
m_viaGapUnit->Disable();
} else {
m_sizes.SetDiffPairViaGapSameAsTraceGap( false );
m_viaGapText->Enable();
m_viaGapLabel->Enable();
m_viaGapUnit->Enable();
}
}
void DIALOG_PNS_DIFF_PAIR_DIMENSIONS::OnClose( wxCloseEvent& aEvent )
{
// Do nothing, it is result of ESC pressing
EndModal( 0 );
}
void DIALOG_PNS_DIFF_PAIR_DIMENSIONS::OnOkClick( wxCommandEvent& aEvent )
{
// Save widgets' values to settings
m_sizes.SetDiffPairGap ( m_traceGap.GetValue() );
m_sizes.SetDiffPairViaGap ( m_viaGap.GetValue() );
m_sizes.SetDiffPairWidth ( m_traceWidth.GetValue() );
// todo: verify against design rules
EndModal( 1 );
}
void DIALOG_PNS_DIFF_PAIR_DIMENSIONS::OnCancelClick( wxCommandEvent& aEvent )
{
// Do nothing
EndModal( 0 );
}
void DIALOG_PNS_DIFF_PAIR_DIMENSIONS::OnViaTraceGapEqualCheck( wxCommandEvent& event )
{
event.Skip();
updateCheckbox();
}
\ No newline at end of file
/*
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2014-2015 CERN
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.or/licenses/>.
*/
/**
* Push and Shove diff pair dimensions (gap) settings dialog.
*/
#ifndef __dialog_diff_pair_dimensions_settings__
#define __dialog_diff_pair_dimensions_settings__
#include <wx_unit_binder.h>
#include "dialog_pns_diff_pair_dimensions_base.h"
class PNS_SIZES_SETTINGS;
class DIALOG_PNS_DIFF_PAIR_DIMENSIONS : public DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE
{
public:
DIALOG_PNS_DIFF_PAIR_DIMENSIONS( wxWindow* aParent, PNS_SIZES_SETTINGS& aSizes );
virtual void OnClose( wxCloseEvent& aEvent );
virtual void OnOkClick( wxCommandEvent& aEvent );
virtual void OnCancelClick( wxCommandEvent& aEvent );
virtual void OnViaTraceGapEqualCheck( wxCommandEvent& event );
private:
void updateCheckbox( );
WX_UNIT_BINDER m_traceWidth;
WX_UNIT_BINDER m_traceGap;
WX_UNIT_BINDER m_viaGap;
PNS_SIZES_SETTINGS& m_sizes;
};
#endif // __dialog_pns_settings__
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 6 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_pns_diff_pair_dimensions_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE::DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( 400,-1 ), wxDefaultSize );
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizer1->AddGrowableCol( 1 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_traceWidthLabel = new wxStaticText( this, wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_traceWidthLabel->Wrap( -1 );
fgSizer1->Add( m_traceWidthLabel, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_traceWidthText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_traceWidthText, 0, wxALL|wxEXPAND, 5 );
m_traceWidthUnit = new wxStaticText( this, wxID_ANY, _("u"), wxDefaultPosition, wxDefaultSize, 0 );
m_traceWidthUnit->Wrap( -1 );
fgSizer1->Add( m_traceWidthUnit, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_traceGapLabel = new wxStaticText( this, wxID_ANY, _("Trace gap:"), wxDefaultPosition, wxDefaultSize, 0 );
m_traceGapLabel->Wrap( -1 );
fgSizer1->Add( m_traceGapLabel, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_traceGapText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_traceGapText, 0, wxALL|wxEXPAND, 5 );
m_traceGapUnit = new wxStaticText( this, wxID_ANY, _("u"), wxDefaultPosition, wxDefaultSize, 0 );
m_traceGapUnit->Wrap( -1 );
m_traceGapUnit->SetMaxSize( wxSize( 40,-1 ) );
fgSizer1->Add( m_traceGapUnit, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_viaGapLabel = new wxStaticText( this, wxID_ANY, _("Via gap:"), wxDefaultPosition, wxDefaultSize, 0 );
m_viaGapLabel->Wrap( -1 );
m_viaGapLabel->Enable( false );
fgSizer1->Add( m_viaGapLabel, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 );
m_viaGapText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_viaGapText->Enable( false );
fgSizer1->Add( m_viaGapText, 0, wxALL|wxEXPAND, 5 );
m_viaGapUnit = new wxStaticText( this, wxID_ANY, _("u"), wxDefaultPosition, wxDefaultSize, 0 );
m_viaGapUnit->Wrap( -1 );
m_viaGapUnit->Enable( false );
m_viaGapUnit->SetMaxSize( wxSize( 40,-1 ) );
fgSizer1->Add( m_viaGapUnit, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
bSizer7->Add( fgSizer1, 0, wxEXPAND, 5 );
m_viaTraceGapEqual = new wxCheckBox( this, wxID_ANY, _("Via gap same as trace gap"), wxDefaultPosition, wxDefaultSize, 0 );
m_viaTraceGapEqual->SetValue(true);
bSizer7->Add( m_viaTraceGapEqual, 0, wxALL|wxEXPAND, 5 );
m_stdButtons = new wxStdDialogButtonSizer();
m_stdButtonsOK = new wxButton( this, wxID_OK );
m_stdButtons->AddButton( m_stdButtonsOK );
m_stdButtonsCancel = new wxButton( this, wxID_CANCEL );
m_stdButtons->AddButton( m_stdButtonsCancel );
m_stdButtons->Realize();
bSizer7->Add( m_stdButtons, 0, wxEXPAND, 5 );
this->SetSizer( bSizer7 );
this->Layout();
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE::OnClose ) );
m_viaTraceGapEqual->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE::onViaTraceGapEqualCheck ), NULL, this );
m_stdButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE::OnCancelClick ), NULL, this );
m_stdButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE::OnOkClick ), NULL, this );
}
DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE::~DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE::OnClose ) );
m_viaTraceGapEqual->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE::onViaTraceGapEqualCheck ), NULL, this );
m_stdButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE::OnCancelClick ), NULL, this );
m_stdButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE::OnOkClick ), NULL, this );
}
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 6 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE_H__
#define __DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE : public DIALOG_SHIM
{
private:
protected:
wxStaticText* m_traceWidthLabel;
wxTextCtrl* m_traceWidthText;
wxStaticText* m_traceWidthUnit;
wxStaticText* m_traceGapLabel;
wxTextCtrl* m_traceGapText;
wxStaticText* m_traceGapUnit;
wxStaticText* m_viaGapLabel;
wxTextCtrl* m_viaGapText;
wxStaticText* m_viaGapUnit;
wxCheckBox* m_viaTraceGapEqual;
wxStdDialogButtonSizer* m_stdButtons;
wxButton* m_stdButtonsOK;
wxButton* m_stdButtonsCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void onViaTraceGapEqualCheck( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Differential Pair Dimensions"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 400,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE();
};
#endif //__DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE_H__
/*
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2014-2015 CERN
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Length tuner settings dialog.
*/
#include "dialog_pns_length_tuning_settings.h"
#include <router/pns_meander_placer.h>
DIALOG_PNS_LENGTH_TUNING_SETTINGS::DIALOG_PNS_LENGTH_TUNING_SETTINGS( wxWindow* aParent, PNS_MEANDER_SETTINGS& aSettings, PNS_ROUTER_MODE aMode ) :
DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE( aParent ),
m_minAmpl ( this, m_minAmplText, m_minAmplUnit ),
m_maxAmpl (this, m_maxAmplText, m_maxAmplUnit ),
m_spacing ( this, m_spacingText, m_spacingUnit ),
m_targetLength ( this, m_targetLengthText, m_targetLengthUnit ),
m_settings( aSettings ),
m_mode ( aMode )
{
m_miterStyle->Enable ( false );
m_radiusText->Enable ( aMode != PNS_MODE_TUNE_DIFF_PAIR );
//m_minAmpl.Enable ( aMode != PNS_MODE_TUNE_DIFF_PAIR_SKEW );
m_minAmpl.SetValue ( m_settings.m_minAmplitude );
m_maxAmpl.SetValue ( m_settings.m_maxAmplitude );
m_spacing.SetValue ( m_settings.m_spacing );
m_radiusText->SetValue ( wxString::Format(wxT("%i"), m_settings.m_cornerRadiusPercentage) );
m_miterStyle->SetSelection ( m_settings.m_cornerType == PNS_MEANDER_SETTINGS::ROUND ? 1 : 0 );
switch( aMode )
{
case PNS_MODE_TUNE_SINGLE:
SetTitle ( _("Single track length tuning") );
m_legend->SetBitmap( KiBitmap( tune_single_track_length_legend_xpm ) );
m_targetLength.SetValue ( m_settings.m_targetLength );
break;
case PNS_MODE_TUNE_DIFF_PAIR:
SetTitle ( _("Differential pair length tuning") );
m_legend->SetBitmap( KiBitmap( tune_diff_pair_length_legend_xpm ) );
m_targetLength.SetValue ( m_settings.m_targetLength );
break;
case PNS_MODE_TUNE_DIFF_PAIR_SKEW:
SetTitle ( _("Differential pair skew tuning") );
m_legend->SetBitmap( KiBitmap( tune_diff_pair_skew_legend_xpm ) );
m_targetLengthLabel->SetLabel( _("Target skew: ") );
m_targetLength.SetValue ( m_settings.m_targetSkew );
break;
default:
break;
}
m_stdButtonsOK->SetDefault();
m_targetLengthText->SetSelection(-1, -1);
m_targetLengthText->SetFocus();
}
void DIALOG_PNS_LENGTH_TUNING_SETTINGS::OnClose( wxCloseEvent& aEvent )
{
// Do nothing, it is result of ESC pressing
EndModal( 0 );
}
void DIALOG_PNS_LENGTH_TUNING_SETTINGS::OnOkClick( wxCommandEvent& aEvent )
{
// fixme: use validators and TransferDataFromWindow
m_settings.m_minAmplitude = m_minAmpl.GetValue();
m_settings.m_maxAmplitude = m_maxAmpl.GetValue();
m_settings.m_spacing = m_spacing.GetValue();
m_settings.m_cornerRadiusPercentage = wxAtoi( m_radiusText->GetValue() );
if (m_mode == PNS_MODE_TUNE_DIFF_PAIR_SKEW)
m_settings.m_targetSkew = m_targetLength.GetValue();
else
m_settings.m_targetLength = m_targetLength.GetValue();
if ( m_settings.m_maxAmplitude < m_settings.m_minAmplitude )
m_settings.m_maxAmplitude = m_settings.m_maxAmplitude;
m_settings.m_cornerType = m_miterStyle->GetSelection( ) ? PNS_MEANDER_SETTINGS::CHAMFER : PNS_MEANDER_SETTINGS::ROUND;
EndModal( 1 );
}
void DIALOG_PNS_LENGTH_TUNING_SETTINGS::OnCancelClick( wxCommandEvent& aEvent )
{
// Do nothing
EndModal( 0 );
}
/*
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2014 CERN
* Author: Maciej Suminski <maciej.suminski@cern.ch>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.or/licenses/>.
*/
/**
* Push and Shove router settings dialog.
*/
#ifndef __dialog_pns_length_tuning_settings__
#define __dialog_pns_length_tuning_settings__
#include "dialog_pns_length_tuning_settings_base.h"
#include <wx_unit_binder.h>
#include <router/pns_router.h>
class PNS_MEANDER_SETTINGS;
class DIALOG_PNS_LENGTH_TUNING_SETTINGS : public DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE
{
public:
DIALOG_PNS_LENGTH_TUNING_SETTINGS( wxWindow* aParent, PNS_MEANDER_SETTINGS& aSettings, PNS_ROUTER_MODE aMode );
virtual void OnClose( wxCloseEvent& aEvent );
virtual void OnOkClick( wxCommandEvent& aEvent );
virtual void OnCancelClick( wxCommandEvent& aEvent );
private:
WX_UNIT_BINDER m_minAmpl;
WX_UNIT_BINDER m_maxAmpl;
WX_UNIT_BINDER m_spacing;
WX_UNIT_BINDER m_targetLength;
PNS_MEANDER_SETTINGS& m_settings;
PNS_ROUTER_MODE m_mode;
};
#endif // __dialog_pns_settings__
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 6 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_pns_length_tuning_settings_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE::DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( 345,668 ), wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizer1;
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Length/skew") ), wxVERTICAL );
wxFlexGridSizer* fgSizer4;
fgSizer4 = new wxFlexGridSizer( 0, 2, 0, 0 );
fgSizer4->AddGrowableCol( 1 );
fgSizer4->SetFlexibleDirection( wxBOTH );
fgSizer4->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText4 = new wxStaticText( this, wxID_ANY, _("Tune from:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText4->Wrap( -1 );
fgSizer4->Add( m_staticText4, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
wxArrayString m_choicePathFromChoices;
m_choicePathFrom = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choicePathFromChoices, 0 );
m_choicePathFrom->SetSelection( 0 );
fgSizer4->Add( m_choicePathFrom, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_staticText15 = new wxStaticText( this, wxID_ANY, _("Tune to:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText15->Wrap( -1 );
fgSizer4->Add( m_staticText15, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
wxArrayString m_choice4Choices;
m_choice4 = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choice4Choices, 0 );
m_choice4->SetSelection( 0 );
fgSizer4->Add( m_choice4, 0, wxALL, 5 );
m_staticText3 = new wxStaticText( this, wxID_ANY, _("Constraint:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText3->Wrap( -1 );
fgSizer4->Add( m_staticText3, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
wxString m_constraintSourceChoices[] = { _("from Design Rules"), _("manual") };
int m_constraintSourceNChoices = sizeof( m_constraintSourceChoices ) / sizeof( wxString );
m_constraintSource = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_constraintSourceNChoices, m_constraintSourceChoices, 0 );
m_constraintSource->SetSelection( 1 );
m_constraintSource->Enable( false );
fgSizer4->Add( m_constraintSource, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_targetLengthLabel = new wxStaticText( this, wxID_ANY, _("Target length:"), wxDefaultPosition, wxDefaultSize, 0 );
m_targetLengthLabel->Wrap( -1 );
fgSizer4->Add( m_targetLengthLabel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
wxGridSizer* gSizer2;
gSizer2 = new wxGridSizer( 0, 2, 0, 0 );
m_targetLengthText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gSizer2->Add( m_targetLengthText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_targetLengthUnit = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_targetLengthUnit->Wrap( -1 );
gSizer2->Add( m_targetLengthUnit, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
fgSizer4->Add( gSizer2, 1, wxEXPAND, 5 );
sbSizer1->Add( fgSizer4, 1, wxEXPAND, 5 );
bMainSizer->Add( sbSizer1, 0, wxEXPAND|wxALL, 5 );
wxStaticBoxSizer* sbSizer2;
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Meandering") ), wxVERTICAL );
m_legend = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
sbSizer2->Add( m_legend, 1, wxALL|wxEXPAND, 5 );
wxFlexGridSizer* fgSizer3;
fgSizer3 = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizer3->AddGrowableCol( 2 );
fgSizer3->SetFlexibleDirection( wxBOTH );
fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText9 = new wxStaticText( this, wxID_ANY, _("Min amplitude (Amin):"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText9->Wrap( -1 );
fgSizer3->Add( m_staticText9, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_minAmplText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3->Add( m_minAmplText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_minAmplUnit = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_minAmplUnit->Wrap( -1 );
fgSizer3->Add( m_minAmplUnit, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_staticText91 = new wxStaticText( this, wxID_ANY, _("Max amplitude (Amax):"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText91->Wrap( -1 );
fgSizer3->Add( m_staticText91, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_maxAmplText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3->Add( m_maxAmplText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_maxAmplUnit = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_maxAmplUnit->Wrap( -1 );
fgSizer3->Add( m_maxAmplUnit, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_staticText11 = new wxStaticText( this, wxID_ANY, _("Spacing (s):"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText11->Wrap( -1 );
fgSizer3->Add( m_staticText11, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_spacingText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3->Add( m_spacingText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_spacingUnit = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_spacingUnit->Wrap( -1 );
fgSizer3->Add( m_spacingUnit, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_staticText13 = new wxStaticText( this, wxID_ANY, _("Miter radius (r):"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText13->Wrap( -1 );
fgSizer3->Add( m_staticText13, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_radiusText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer3->Add( m_radiusText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_radiusUnit = new wxStaticText( this, wxID_ANY, _("%"), wxDefaultPosition, wxDefaultSize, 0 );
m_radiusUnit->Wrap( -1 );
fgSizer3->Add( m_radiusUnit, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_staticText14 = new wxStaticText( this, wxID_ANY, _("Miter style:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText14->Wrap( -1 );
m_staticText14->Enable( false );
fgSizer3->Add( m_staticText14, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
wxString m_miterStyleChoices[] = { _("45 degree"), _("arc") };
int m_miterStyleNChoices = sizeof( m_miterStyleChoices ) / sizeof( wxString );
m_miterStyle = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_miterStyleNChoices, m_miterStyleChoices, 0 );
m_miterStyle->SetSelection( 0 );
m_miterStyle->Enable( false );
fgSizer3->Add( m_miterStyle, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
sbSizer2->Add( fgSizer3, 1, wxEXPAND, 5 );
bMainSizer->Add( sbSizer2, 1, wxALL|wxEXPAND, 5 );
m_stdButtons = new wxStdDialogButtonSizer();
m_stdButtonsOK = new wxButton( this, wxID_OK );
m_stdButtons->AddButton( m_stdButtonsOK );
m_stdButtonsCancel = new wxButton( this, wxID_CANCEL );
m_stdButtons->AddButton( m_stdButtonsCancel );
m_stdButtons->Realize();
bMainSizer->Add( m_stdButtons, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
this->SetSizer( bMainSizer );
this->Layout();
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE::OnClose ) );
m_stdButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE::OnCancelClick ), NULL, this );
m_stdButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE::OnOkClick ), NULL, this );
}
DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE::~DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE::OnClose ) );
m_stdButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE::OnCancelClick ), NULL, this );
m_stdButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE::OnOkClick ), NULL, this );
}
This source diff could not be displayed because it is too large. You can view the blob instead.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 6 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE_H__
#define __DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/choice.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/statbmp.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE : public DIALOG_SHIM
{
private:
protected:
wxStaticText* m_staticText4;
wxChoice* m_choicePathFrom;
wxStaticText* m_staticText15;
wxChoice* m_choice4;
wxStaticText* m_staticText3;
wxChoice* m_constraintSource;
wxStaticText* m_targetLengthLabel;
wxTextCtrl* m_targetLengthText;
wxStaticText* m_targetLengthUnit;
wxStaticBitmap* m_legend;
wxStaticText* m_staticText9;
wxTextCtrl* m_minAmplText;
wxStaticText* m_minAmplUnit;
wxStaticText* m_staticText91;
wxTextCtrl* m_maxAmplText;
wxStaticText* m_maxAmplUnit;
wxStaticText* m_staticText11;
wxTextCtrl* m_spacingText;
wxStaticText* m_spacingUnit;
wxStaticText* m_staticText13;
wxTextCtrl* m_radiusText;
wxStaticText* m_radiusUnit;
wxStaticText* m_staticText14;
wxChoice* m_miterStyle;
wxStdDialogButtonSizer* m_stdButtons;
wxButton* m_stdButtonsOK;
wxButton* m_stdButtonsCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Trace length tuning"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 345,668 ), long style = wxDEFAULT_DIALOG_STYLE );
~DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE();
};
#endif //__DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE_H__
This diff is collapsed.
......@@ -31,15 +31,20 @@
DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE( wxWindow* aParent, BOARD_DESIGN_SETTINGS& aSettings ) :
DIALOG_TRACK_VIA_SIZE_BASE( aParent ),
m_trackWidth( aParent, m_trackWidthText, m_trackWidthLabel ),
m_viaDiameter( aParent, m_viaDiameterText, m_viaDiameterLabel ),
m_viaDrill( aParent, m_viaDrillText, m_viaDrillLabel ),
m_settings( aSettings )
{
// Load router settings to dialog fields
m_trackWidth->SetValue( To_User_Unit( m_trackWidth->GetUnits(), m_settings.GetCustomTrackWidth() ) );
m_viaDiameter->SetValue( To_User_Unit( m_viaDiameter->GetUnits(), m_settings.GetCustomViaSize() ) );
m_viaDrill->SetValue( To_User_Unit( m_viaDrill->GetUnits(), m_settings.GetCustomViaDrill() ) );
m_trackWidth->SetFocus();
m_trackWidth.SetValue( m_settings.GetCustomTrackWidth() );
m_viaDiameter.SetValue( m_settings.GetCustomViaSize() );
m_viaDrill.SetValue( m_settings.GetCustomViaDrill() );
m_trackWidthText->SetFocus();
m_trackWidthText->SetSelection(-1, -1);
m_stdButtonsOK->SetDefault();
// Pressing ENTER when any of the text input fields is active applies changes
#if wxCHECK_VERSION( 3, 0, 0 )
Connect( wxEVT_TEXT_ENTER, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE::onOkClick ), NULL, this );
......@@ -54,11 +59,11 @@ DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE( wxWindow* aParent, BOARD_DESIGN_SE
bool DIALOG_TRACK_VIA_SIZE::check()
{
// Wrong input
if( !m_trackWidth->GetValue() || !m_viaDiameter->GetValue() || !m_viaDrill->GetValue() )
if( m_trackWidth.GetValue() < 0 || m_viaDiameter.GetValue() < 0 || m_viaDrill.GetValue() < 0 )
return false;
// Via drill should be smaller than via diameter
if( m_viaDrill->GetValue() >= m_viaDiameter->GetValue() )
if( m_viaDrill.GetValue() >= m_viaDiameter.GetValue() )
return false;
return true;
......@@ -76,15 +81,15 @@ void DIALOG_TRACK_VIA_SIZE::onOkClick( wxCommandEvent& aEvent )
if( check() )
{
// Store dialog values to the router settings
m_settings.SetCustomTrackWidth( From_User_Unit( m_trackWidth->GetUnits(), *m_trackWidth->GetValue() ) );
m_settings.SetCustomViaSize( From_User_Unit( m_viaDiameter->GetUnits(), *m_viaDiameter->GetValue() ) );
m_settings.SetCustomViaDrill( From_User_Unit( m_viaDrill->GetUnits(), *m_viaDrill->GetValue() ) );
m_settings.SetCustomTrackWidth( m_trackWidth.GetValue() );
m_settings.SetCustomViaSize( m_viaDiameter.GetValue() );
m_settings.SetCustomViaDrill( m_viaDrill.GetValue() );
EndModal( 1 );
}
else
{
DisplayError( GetParent(), _( "Settings are incorrect" ) );
m_trackWidth->SetFocus();
m_trackWidthText->SetFocus();
}
}
......
......@@ -25,6 +25,8 @@
#ifndef __dialog_track_via_size__
#define __dialog_track_via_size__
#include <wx_unit_binder.h>
#include "dialog_track_via_size_base.h"
class BOARD_DESIGN_SETTINGS;
......@@ -37,6 +39,11 @@ class DIALOG_TRACK_VIA_SIZE : public DIALOG_TRACK_VIA_SIZE_BASE
DIALOG_TRACK_VIA_SIZE( wxWindow* aParent, BOARD_DESIGN_SETTINGS& aSettings );
protected:
WX_UNIT_BINDER m_trackWidth;
WX_UNIT_BINDER m_viaDiameter;
WX_UNIT_BINDER m_viaDrill;
// Routings settings that are modified by the dialog.
BOARD_DESIGN_SETTINGS& m_settings;
......
......@@ -16,14 +16,46 @@ DIALOG_TRACK_VIA_SIZE_BASE::DIALOG_TRACK_VIA_SIZE_BASE( wxWindow* parent, wxWind
wxBoxSizer* bSizes;
bSizes = new wxBoxSizer( wxVERTICAL );
m_trackWidth = new WX_UNIT_TEXT( this, _("Track width:") );
bSizes->Add( m_trackWidth, 0, wxALL|wxEXPAND, 5 );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_viaDiameter = new WX_UNIT_TEXT( this, _("Via diameter:") );
bSizes->Add( m_viaDiameter, 0, wxALL|wxEXPAND, 5 );
m_staticText3 = new wxStaticText( this, wxID_ANY, _("Track width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText3->Wrap( -1 );
fgSizer1->Add( m_staticText3, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_viaDrill = new WX_UNIT_TEXT( this, _("Via drill:") );
bSizes->Add( m_viaDrill, 0, wxALL|wxEXPAND, 5 );
m_trackWidthText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_trackWidthText, 1, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_trackWidthLabel = new wxStaticText( this, wxID_ANY, _("inch"), wxDefaultPosition, wxDefaultSize, 0 );
m_trackWidthLabel->Wrap( -1 );
fgSizer1->Add( m_trackWidthLabel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_staticText5 = new wxStaticText( this, wxID_ANY, _("Via diameter:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText5->Wrap( -1 );
fgSizer1->Add( m_staticText5, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_viaDiameterText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_viaDiameterText, 1, wxALL|wxEXPAND, 5 );
m_viaDiameterLabel = new wxStaticText( this, wxID_ANY, _("u"), wxDefaultPosition, wxDefaultSize, 0 );
m_viaDiameterLabel->Wrap( -1 );
fgSizer1->Add( m_viaDiameterLabel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_staticText7 = new wxStaticText( this, wxID_ANY, _("Via drill:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText7->Wrap( -1 );
fgSizer1->Add( m_staticText7, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_viaDrillText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_viaDrillText, 1, wxALL|wxEXPAND, 5 );
m_viaDrillLabel = new wxStaticText( this, wxID_ANY, _("u"), wxDefaultPosition, wxDefaultSize, 0 );
m_viaDrillLabel->Wrap( -1 );
fgSizer1->Add( m_viaDrillLabel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
bSizes->Add( fgSizer1, 1, wxEXPAND|wxALL, 5 );
m_stdButtons = new wxStdDialogButtonSizer();
m_stdButtonsOK = new wxButton( this, wxID_OK );
......
......@@ -11,12 +11,13 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wxunittext.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/dialog.h>
......@@ -32,9 +33,15 @@ class DIALOG_TRACK_VIA_SIZE_BASE : public wxDialog
private:
protected:
WX_UNIT_TEXT* m_trackWidth;
WX_UNIT_TEXT* m_viaDiameter;
WX_UNIT_TEXT* m_viaDrill;
wxStaticText* m_staticText3;
wxTextCtrl* m_trackWidthText;
wxStaticText* m_trackWidthLabel;
wxStaticText* m_staticText5;
wxTextCtrl* m_viaDiameterText;
wxStaticText* m_viaDiameterLabel;
wxStaticText* m_staticText7;
wxTextCtrl* m_viaDrillText;
wxStaticText* m_viaDrillLabel;
wxStdDialogButtonSizer* m_stdButtons;
wxButton* m_stdButtonsOK;
wxButton* m_stdButtonsCancel;
......
......@@ -433,6 +433,49 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
_( "Set the origin point for the grid" ),
KiBitmap( grid_select_axis_xpm ) );
wxMenu* routeMenu = new wxMenu;
AddMenuItem( routeMenu, ID_TRACK_BUTT,
_( "Single Track" ),
_( "Interactively route a single track" ),
KiBitmap( add_tracks_xpm ) );
AddMenuItem( routeMenu, ID_DIFF_PAIR_BUTT,
_( "Differential Pair" ),
_( "Interactively route a differential pair" ),
KiBitmap( add_tracks_xpm ) );
routeMenu->AppendSeparator();
AddMenuItem( routeMenu, ID_TUNE_SINGLE_TRACK_LEN_BUTT,
_( "Tune Track Length" ),
_( "Tune length of a single track" ),
KiBitmap( add_tracks_xpm ) );
AddMenuItem( routeMenu, ID_TUNE_DIFF_PAIR_LEN_BUTT,
_( "Tune Differential Pair Length" ),
_( "Tune length of a differential pair" ),
KiBitmap( add_tracks_xpm ) );
AddMenuItem( routeMenu, ID_TUNE_DIFF_PAIR_SKEW_BUTT,
_( "Tune Differential Pair Skew/Phase" ),
_( "Tune skew/phase of a differential pair" ),
KiBitmap( add_tracks_xpm ) );
/* Fixme: add icons & missing menu entries!
routeMenu->AppendSeparator();
AddMenuItem( routeMenu, ID_MENU_MITER_TRACES,
_( "Miter traces..." ),
_( "Miter trace corners with arcs" ),
KiBitmap( grid_select_axis_xpm ) );
AddMenuItem( routeMenu, ID_MENU_ADD_TEARDROPS,
_( "Teardrops..." ),
_( "Add teardrops to pads/vias" ),
KiBitmap( grid_select_axis_xpm ) );
*/
//----- Preferences and configuration menu------------------------------------
wxMenu* configmenu = new wxMenu;
......@@ -467,6 +510,12 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
_( "Select how items (pads, tracks texts ... ) are displayed" ),
KiBitmap( display_options_xpm ) );
AddMenuItem( configmenu, ID_MENU_INTERACTIVE_ROUTER_SETTINGS,
_( "Interactive Routing" ),
_( "Configure Interactive Routing." ),
KiBitmap( add_tracks_xpm ) ); // fixme: icon
//--- dimensions submenu ------------------------------------------------------
wxMenu* dimensionsMenu = new wxMenu;
......@@ -488,6 +537,11 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
_( "Adjust the global clearance between pads and the solder resist mask" ),
KiBitmap( pads_mask_layers_xpm ) );
AddMenuItem( dimensionsMenu, ID_MENU_DIFF_PAIR_DIMENSIONS,
_( "Differential Pairs" ),
_( "Define the global gap/width for differential pairs." ),
KiBitmap( add_tracks_xpm ) ); // fixme: icon
dimensionsMenu->AppendSeparator();
AddMenuItem( dimensionsMenu, ID_CONFIG_SAVE,
_( "&Save" ), _( "Save dimension preferences" ),
......@@ -592,6 +646,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
menuBar->Append( editMenu, _( "&Edit" ) );
menuBar->Append( viewMenu, _( "&View" ) );
menuBar->Append( placeMenu, _( "&Place" ) );
menuBar->Append( routeMenu, _( "&Route" ) );
menuBar->Append( configmenu, _( "P&references" ) );
menuBar->Append( dimensionsMenu, _( "D&imensions" ) );
menuBar->Append( toolsMenu, _( "&Tools" ) );
......
......@@ -13,12 +13,19 @@ set( PCBNEW_PNS_SRCS
time_limit.cpp
pns_algo_base.cpp
pns_diff_pair.cpp
pns_diff_pair_placer.cpp
pns_dp_meander_placer.cpp
pns_dragger.cpp
pns_item.cpp
pns_itemset.cpp
pns_line.cpp
pns_line_placer.cpp
pns_logger.cpp
pns_meander.cpp
pns_meander_placer.cpp
pns_meander_placer_base.cpp
pns_meander_skew_placer.cpp
pns_node.cpp
pns_optimizer.cpp
pns_router.cpp
......@@ -26,11 +33,15 @@ set( PCBNEW_PNS_SRCS
pns_shove.cpp
pns_sizes_settings.cpp
pns_solid.cpp
pns_tool_base.cpp
pns_topology.cpp
pns_tune_status_popup.cpp
pns_utils.cpp
pns_via.cpp
pns_walkaround.cpp
router_preview_item.cpp
router_tool.cpp
length_tuner_tool.cpp
)
add_library( pnsrouter STATIC ${PCBNEW_PNS_SRCS} )
......@@ -73,7 +73,7 @@ public:
*/
DIRECTION_45( const VECTOR2I& aVec )
{
construct( aVec );
construct_( aVec );
}
/**
......@@ -82,7 +82,7 @@ public:
*/
DIRECTION_45( const SEG& aSeg )
{
construct( aSeg.B - aSeg.A );
construct_( aSeg.B - aSeg.A );
}
/**
......@@ -309,6 +309,11 @@ public:
}
}
int Mask() const
{
return 1 << ( (int) m_dir );
}
private:
/**
......@@ -316,7 +321,7 @@ private:
* Calculates the direction from a vector. If the vector's angle is not a multiple of 45
* degrees, the direction is rounded to the nearest octant.
* @param aVec our vector */
void construct( const VECTOR2I& aVec )
void construct_( const VECTOR2I& aVec )
{
m_dir = UNDEFINED;
......
/*
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2015 CERN
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <boost/foreach.hpp>
#include <boost/optional.hpp>
#include "class_draw_panel_gal.h"
#include "class_board.h"
#include <wxPcbStruct.h>
#include <pcbnew_id.h>
#include <view/view_controls.h>
#include <pcb_painter.h>
#include <dialogs/dialog_pns_settings.h>
#include <dialogs/dialog_pns_length_tuning_settings.h>
#include <tool/context_menu.h>
#include <tools/common_actions.h>
#include "pns_segment.h"
#include "pns_router.h"
#include "pns_meander_placer.h" // fixme: move settings to separate header
#include "pns_tune_status_popup.h"
#include "length_tuner_tool.h"
#include "trace.h"
using namespace KIGFX;
using boost::optional;
static TOOL_ACTION ACT_StartTuning( "pcbnew.LengthTuner.StartTuning",
AS_CONTEXT, 'X',
"New Track", "Starts laying a new track.");
static TOOL_ACTION ACT_EndTuning( "pcbnew.LengthTuner.EndTuning",
AS_CONTEXT, WXK_END,
"End Track", "Stops laying the current meander.");
static TOOL_ACTION ACT_Settings( "pcbnew.LengthTuner.Settings",
AS_CONTEXT, 'L',
"Length Tuning Settings", "Sets the length tuning parameters for currently routed item.");
static TOOL_ACTION ACT_SpacingIncrease( "pcbnew.LengthTuner.SpacingIncrease",
AS_CONTEXT, '1',
"Increase spacing", "Increase meander spacing by one step.");
static TOOL_ACTION ACT_SpacingDecrease( "pcbnew.LengthTuner.SpacingDecrease",
AS_CONTEXT, '2',
"Decrease spacing ", "Decrease meander spacing by one step.");
static TOOL_ACTION ACT_AmplIncrease( "pcbnew.LengthTuner.AmplIncrease",
AS_CONTEXT, '3',
"Increase amplitude", "Increase meander amplitude by one step.");
static TOOL_ACTION ACT_AmplDecrease( "pcbnew.LengthTuner.AmplDecrease",
AS_CONTEXT, '4',
"Decrease amplitude", "Decrease meander amplitude by one step.");
LENGTH_TUNER_TOOL::LENGTH_TUNER_TOOL() :
PNS_TOOL_BASE( "pcbnew.LengthTuner" )
{
}
class TUNER_TOOL_MENU: public CONTEXT_MENU
{
public:
TUNER_TOOL_MENU( BOARD* aBoard )
{
SetTitle( wxT( "Length Tuner" ) );
//Add( ACT_StartTuning );
//Add( ACT_EndTuning );
//AppendSeparator();
Add( ACT_SpacingIncrease );
Add( ACT_SpacingDecrease );
Add( ACT_AmplIncrease );
Add( ACT_AmplDecrease );
Add( ACT_Settings );
}
};
LENGTH_TUNER_TOOL::~LENGTH_TUNER_TOOL()
{
delete m_router;
}
void LENGTH_TUNER_TOOL::Reset( RESET_REASON aReason )
{
PNS_TOOL_BASE::Reset( aReason );
Go( &LENGTH_TUNER_TOOL::TuneSingleTrace, COMMON_ACTIONS::routerActivateTuneSingleTrace.MakeEvent() );
Go( &LENGTH_TUNER_TOOL::TuneDiffPair, COMMON_ACTIONS::routerActivateTuneDiffPair.MakeEvent() );
Go( &LENGTH_TUNER_TOOL::TuneDiffPairSkew, COMMON_ACTIONS::routerActivateTuneDiffPairSkew.MakeEvent() );
}
void LENGTH_TUNER_TOOL::handleCommonEvents( const TOOL_EVENT& aEvent )
{
if( aEvent.IsAction( &ACT_RouterOptions ) )
{
DIALOG_PNS_SETTINGS settingsDlg( m_frame, m_router->Settings() );
if( settingsDlg.ShowModal() )
{
// FIXME: do we need an explicit update?
}
}
PNS_MEANDER_PLACER_BASE *placer = static_cast <PNS_MEANDER_PLACER_BASE *> ( m_router->Placer() );
if (!placer)
return;
if( aEvent.IsAction( &ACT_Settings ) )
{
PNS_MEANDER_SETTINGS settings = placer->MeanderSettings();
DIALOG_PNS_LENGTH_TUNING_SETTINGS settingsDlg( m_frame, settings, m_router->Mode() );
if( settingsDlg.ShowModal() )
{
placer->UpdateSettings ( settings );
}
m_savedMeanderSettings = placer->MeanderSettings( );
}
}
void LENGTH_TUNER_TOOL::performTuning()
{
bool saveUndoBuffer = true;
if(m_startItem)
{
m_frame->SetActiveLayer( ToLAYER_ID ( m_startItem->Layers().Start() ) );
if( m_startItem->Net() >= 0 )
highlightNet( true, m_startItem->Net() );
}
m_ctls->ForceCursorPosition( false );
m_ctls->SetAutoPan( true );
if ( !m_router->StartRouting( m_startSnapPoint, m_startItem, 0 ) )
{
wxMessageBox ( m_router->FailureReason(), _("Error") );
highlightNet ( false );
return;
}
PNS_TUNE_STATUS_POPUP statusPopup ( m_frame );
statusPopup.Popup();
PNS_MEANDER_PLACER *placer = static_cast <PNS_MEANDER_PLACER *> ( m_router->Placer() );
VECTOR2I end;
placer->UpdateSettings( m_savedMeanderSettings );
while( OPT_TOOL_EVENT evt = Wait() )
{
if( evt->IsCancel() || evt->IsActivate() )
break;
else if( evt->Action() == TA_UNDO_REDO )
{
saveUndoBuffer = false;
break;
}
else if( evt->IsMotion() )
{
end = evt->Position();
m_router->Move( end, NULL );
wxPoint p = wxGetMousePosition();
p.x+=20;
p.y+=20;
statusPopup.Update ( m_router );
statusPopup.Move( p );
}
else if( evt->IsClick( BUT_LEFT ) )
{
if( m_router->FixRoute( evt->Position(), NULL ) )
break;
}
else if( evt->IsAction( &ACT_EndTuning ) )
{
if( m_router->FixRoute( end, NULL ) )
break;
} else if (evt->IsAction ( &ACT_AmplDecrease ) ) {
placer->AmplitudeStep( -1 );
m_router->Move( end, NULL );
} else if (evt->IsAction ( &ACT_AmplIncrease ) ) {
placer->AmplitudeStep( 1 );
m_router->Move( end, NULL );
} else if (evt->IsAction ( &ACT_SpacingDecrease ) ) {
placer->SpacingStep( -1 );
m_router->Move( end, NULL );
} else if (evt->IsAction ( &ACT_SpacingIncrease ) ) {
placer->SpacingStep( 1 );
m_router->Move( end, NULL );
}
handleCommonEvents( *evt );
}
m_router->StopRouting();
if( saveUndoBuffer )
{
// Save the recent changes in the undo buffer
m_frame->SaveCopyInUndoList( m_router->GetUndoBuffer(), UR_UNSPECIFIED );
m_router->ClearUndoBuffer();
m_frame->OnModify();
}
else
{
// It was interrupted by TA_UNDO_REDO event, so we have to sync the world now
m_needsSync = true;
}
m_ctls->SetAutoPan( false );
m_ctls->ForceCursorPosition( false );
highlightNet( false );
}
int LENGTH_TUNER_TOOL::TuneSingleTrace ( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_TRACK_BUTT, wxCURSOR_PENCIL, _( "Tune Trace Length" ) );
return mainLoop( PNS_MODE_TUNE_SINGLE );
}
int LENGTH_TUNER_TOOL::TuneDiffPair ( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_TRACK_BUTT, wxCURSOR_PENCIL, _( "Tune Diff Pair Length" ) );
return mainLoop( PNS_MODE_TUNE_DIFF_PAIR );
}
int LENGTH_TUNER_TOOL::TuneDiffPairSkew ( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_TRACK_BUTT, wxCURSOR_PENCIL, _( "Tune Diff Pair Skew" ) );
return mainLoop( PNS_MODE_TUNE_DIFF_PAIR_SKEW );
}
int LENGTH_TUNER_TOOL::mainLoop( PNS_ROUTER_MODE aMode )
{
// Deselect all items
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
Activate();
m_router->SetMode ( aMode );
m_ctls->SetSnapping( true );
m_ctls->ShowCursor( true );
std::auto_ptr<TUNER_TOOL_MENU> ctxMenu ( new TUNER_TOOL_MENU( m_board ) );
SetContextMenu ( ctxMenu.get() );
// Main loop: keep receiving events
while( OPT_TOOL_EVENT evt = Wait() )
{
if( m_needsSync )
{
m_router->SyncWorld();
m_router->SetView( getView() );
m_needsSync = false;
}
if( evt->IsCancel() || evt->IsActivate() )
break; // Finish
else if( evt->Action() == TA_UNDO_REDO )
m_needsSync = true;
else if( evt->IsMotion() )
updateStartItem( *evt );
else if( evt->IsClick( BUT_LEFT ) || evt->IsAction( &ACT_StartTuning ) )
{
updateStartItem( *evt );
performTuning( );
}
handleCommonEvents( *evt );
}
// Restore the default settings
m_ctls->SetAutoPan( false );
m_ctls->ShowCursor( false );
m_frame->SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_DEFAULT, wxEmptyString );
// Store routing settings till the next invocation
m_savedSettings = m_router->Settings();
m_savedSizes = m_router->Sizes();
return 0;
}
\ No newline at end of file
/*
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2015 CERN
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* Author: Maciej Suminski <maciej.suminski@cern.ch>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __LENGTH_TUNER_TOOL_H
#define __LENGTH_TUNER_TOOL_H
#include "pns_tool_base.h"
#include "pns_meander.h"
class PNS_TUNE_STATUS_POPUP;
class APIEXPORT LENGTH_TUNER_TOOL : public PNS_TOOL_BASE
{
public:
LENGTH_TUNER_TOOL();
~LENGTH_TUNER_TOOL();
void Reset( RESET_REASON aReason );
int TuneSingleTrace ( const TOOL_EVENT& aEvent );
int TuneDiffPair ( const TOOL_EVENT& aEvent );
int TuneDiffPairSkew ( const TOOL_EVENT& aEvent );
int ClearMeanders ( const TOOL_EVENT& aEvent );
private:
void performTuning( );
int mainLoop( PNS_ROUTER_MODE aMode );
void handleCommonEvents( const TOOL_EVENT& evt );
PNS_MEANDER_SETTINGS m_savedMeanderSettings;
};
#endif
......@@ -21,6 +21,8 @@
#ifndef __PNS_ALGO_BASE_H
#define __PNS_ALGO_BASE_H
#include <wx/wx.h> // for wxString
#include "pns_routing_settings.h"
class PNS_ROUTER;
......@@ -53,6 +55,7 @@ public:
///> Returns the logger object, allowing to dump geometry to a file.
virtual PNS_LOGGER* Logger();
private:
PNS_ROUTER* m_router;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -36,7 +36,8 @@ class PNS_NODE;
enum LineMarker {
MK_HEAD = ( 1 << 0 ),
MK_VIOLATION = ( 1 << 3 ),
MK_LOCKED = ( 1 << 4 )
MK_LOCKED = ( 1 << 4 ),
MK_DP_COUPLED = ( 1 << 5 )
};
/**
......@@ -58,6 +59,7 @@ public:
JOINT = 4,
SEGMENT = 8,
VIA = 16,
DIFF_PAIR = 32,
ANY = 0xff
};
......
......@@ -22,12 +22,22 @@
#include "pns_itemset.h"
PNS_ITEMSET::PNS_ITEMSET( PNS_ITEM* aInitialItem )
PNS_ITEMSET::PNS_ITEMSET( PNS_ITEM* aInitialItem ) :
m_owner ( false )
{
if( aInitialItem )
m_items.push_back( aInitialItem );
}
PNS_ITEMSET::~PNS_ITEMSET()
{
if (m_owner)
{
BOOST_FOREACH ( PNS_ITEM *item, m_items )
delete item;
}
}
PNS_ITEMSET& PNS_ITEMSET::FilterLayers( int aStart, int aEnd, bool aInvert )
{
ITEMS newItems;
......@@ -64,6 +74,21 @@ PNS_ITEMSET& PNS_ITEMSET::FilterKinds( int aKindMask, bool aInvert )
return *this;
}
PNS_ITEMSET& PNS_ITEMSET::FilterMarker( int aMarker, bool aInvert )
{
ITEMS newItems;
BOOST_FOREACH( PNS_ITEM* item, m_items )
{
if( item->Marker() & aMarker )
newItems.push_back( item );
}
m_items = newItems;
return *this;
}
PNS_ITEMSET& PNS_ITEMSET::FilterNet( int aNet, bool aInvert )
{
......
......@@ -21,7 +21,7 @@
#ifndef __PNS_ITEMSET_H
#define __PNS_ITEMSET_H
#include <vector>
#include <deque>
#include <boost/foreach.hpp>
#include "pns_item.h"
......@@ -36,15 +36,23 @@
class PNS_ITEMSET
{
public:
typedef std::vector<PNS_ITEM*> ITEMS;
typedef std::deque<PNS_ITEM*> ITEMS;
PNS_ITEMSET( PNS_ITEM* aInitialItem = NULL );
PNS_ITEMSET( const PNS_ITEMSET& aOther )
PNS_ITEMSET( const PNS_ITEMSET& aOther ):
m_owner ( false )
{
m_items = aOther.m_items;
}
~PNS_ITEMSET();
void MakeOwner ( )
{
m_owner = true;
}
const PNS_ITEMSET& operator=( const PNS_ITEMSET& aOther )
{
m_items = aOther.m_items;
......@@ -68,6 +76,7 @@ public:
PNS_ITEMSET& FilterLayers( int aStart, int aEnd = -1, bool aInvert = false );
PNS_ITEMSET& FilterKinds( int aKindMask, bool aInvert = false );
PNS_ITEMSET& FilterNet( int aNet, bool aInvert = false );
PNS_ITEMSET& FilterMarker( int aMarker, bool aInvert = false );
PNS_ITEMSET& ExcludeLayers( int aStart, int aEnd = -1 )
{
......@@ -96,6 +105,11 @@ public:
m_items.push_back( aItem );
}
void Prepend ( PNS_ITEM *aItem )
{
m_items.push_front ( aItem );
}
PNS_ITEM* Get( int index ) const
{
return m_items[index];
......@@ -126,6 +140,7 @@ public:
private:
ITEMS m_items;
bool m_owner;
};
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -24,7 +24,7 @@
PNS_ROUTING_SETTINGS::PNS_ROUTING_SETTINGS()
{
m_routingMode = RM_Walkaround;
m_optimizerEffort = OE_FULL;
m_optimizerEffort = OE_MEDIUM;
m_removeLoops = true;
m_smartPads = true;
m_shoveVias = true;
......
......@@ -55,6 +55,11 @@ public:
m_rank = aParentLine.Rank();
};
static inline bool ClassOf( const PNS_ITEM* aItem )
{
return aItem && SEGMENT == aItem->Kind();
}
PNS_SEGMENT* Clone( ) const;
const SHAPE* Shape() const
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment