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

router: differential pairs & length tuning support

parent e5deafb4
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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
    )

+91 −0
Original line number Diff line number Diff line
/*
 * 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
+55 −0
Original line number Diff line number Diff line
/*
 * 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__
+102 −0
Original line number Diff line number Diff line
///////////////////////////////////////////////////////////////////////////
// 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 );
	
}
+1002 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading