2011-09-30 18:15:37 +00:00
|
|
|
/**
|
|
|
|
* @file dialog_design_rules.cpp
|
|
|
|
*/
|
2009-07-18 11:44:19 +00:00
|
|
|
|
2009-09-11 06:18:55 +00:00
|
|
|
/*
|
2011-09-30 18:15:37 +00:00
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
2009-09-11 06:18:55 +00:00
|
|
|
*
|
2015-11-29 14:19:22 +00:00
|
|
|
* Copyright (C) 2004-2009 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2009-09-11 06:18:55 +00:00
|
|
|
* Copyright (C) 2009 Dick Hollenbeck, dick@softplc.com
|
2015-10-02 19:11:33 +00:00
|
|
|
* Copyright (C) 2009-2015 KiCad Developers, see change_log.txt for contributors.
|
2009-09-11 06:18:55 +00:00
|
|
|
*
|
|
|
|
* 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 2
|
|
|
|
* 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, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2014-01-28 01:29:26 +00:00
|
|
|
/* functions relative to the design rules editor
|
2009-07-18 11:44:19 +00:00
|
|
|
*/
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <class_drawpanel.h>
|
2012-04-13 18:51:24 +00:00
|
|
|
#include <base_units.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <confirm.h>
|
|
|
|
#include <pcbnew.h>
|
2018-01-29 20:58:58 +00:00
|
|
|
#include <pcb_edit_frame.h>
|
2018-02-02 20:57:12 +00:00
|
|
|
#include <board_design_settings.h>
|
2009-07-18 11:44:19 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <pcbnew_id.h>
|
|
|
|
#include <class_track.h>
|
2013-05-02 18:06:58 +00:00
|
|
|
#include <macros.h>
|
2015-10-02 19:11:33 +00:00
|
|
|
#include <html_messagebox.h>
|
2018-03-12 22:45:17 +00:00
|
|
|
#include <dialog_text_entry.h>
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <dialog_design_rules.h>
|
|
|
|
#include <wx/generic/gridctrl.h>
|
|
|
|
#include <dialog_design_rules_aux_helper_class.h>
|
2009-09-10 15:22:26 +00:00
|
|
|
|
2018-01-07 02:42:04 +00:00
|
|
|
#include <tool/tool_event.h>
|
|
|
|
#include <tool/tool_manager.h>
|
|
|
|
|
2011-04-16 15:03:21 +00:00
|
|
|
// Column labels for net lists
|
2014-01-28 01:29:26 +00:00
|
|
|
#define NET_TITLE _( "Net" )
|
|
|
|
#define CLASS_TITLE _( "Class" )
|
2011-04-16 15:03:21 +00:00
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
// Field Positions on rules grid
|
|
|
|
enum {
|
|
|
|
GRID_CLEARANCE,
|
|
|
|
GRID_TRACKSIZE,
|
|
|
|
GRID_VIASIZE,
|
|
|
|
GRID_VIADRILL,
|
|
|
|
GRID_uVIASIZE,
|
2016-08-15 15:16:49 +00:00
|
|
|
GRID_uVIADRILL,
|
|
|
|
GRID_DIFF_PAIR_WIDTH,
|
|
|
|
GRID_DIFF_PAIR_GAP
|
2009-09-10 15:22:26 +00:00
|
|
|
};
|
|
|
|
|
2010-09-02 13:10:48 +00:00
|
|
|
const wxString DIALOG_DESIGN_RULES::wildCard = _( "* (Any)" );
|
2009-09-10 15:22:26 +00:00
|
|
|
|
2009-11-02 22:08:22 +00:00
|
|
|
// dialog should remember its previously selected tab
|
2012-10-03 11:25:30 +00:00
|
|
|
int DIALOG_DESIGN_RULES::s_LastTabSelection = -1;
|
2010-09-02 13:10:48 +00:00
|
|
|
|
|
|
|
// methods for the helper class NETS_LIST_CTRL
|
|
|
|
|
|
|
|
wxString NETS_LIST_CTRL::OnGetItemText( long item, long column ) const
|
|
|
|
{
|
|
|
|
if( column == 0 )
|
|
|
|
{
|
|
|
|
if( item < (long) m_Netnames.GetCount() )
|
|
|
|
return m_Netnames[item];
|
|
|
|
else
|
|
|
|
return wxEmptyString;
|
|
|
|
}
|
|
|
|
else if( item < (long) m_Classnames.GetCount() )
|
|
|
|
return m_Classnames[item];
|
|
|
|
|
|
|
|
return wxEmptyString;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-11-12 00:17:27 +00:00
|
|
|
void NETS_LIST_CTRL::SetRowItems( unsigned aRow,
|
2010-09-02 13:10:48 +00:00
|
|
|
const wxString& aNetname,
|
|
|
|
const wxString& aNetclassName )
|
|
|
|
{
|
|
|
|
// insert blanks if aRow is larger than existing row count
|
|
|
|
unsigned cnt = m_Netnames.GetCount();
|
|
|
|
|
|
|
|
if( cnt <= aRow )
|
|
|
|
m_Netnames.Add( wxEmptyString, aRow - cnt + 1 );
|
|
|
|
|
|
|
|
cnt = m_Classnames.GetCount();
|
2014-09-19 23:58:32 +00:00
|
|
|
|
2010-09-02 13:10:48 +00:00
|
|
|
if( cnt <= aRow )
|
|
|
|
m_Classnames.Add( wxEmptyString, aRow - cnt + 1 );
|
2009-11-02 05:20:58 +00:00
|
|
|
|
2010-09-02 13:10:48 +00:00
|
|
|
if( (int)aRow <= GetItemCount() )
|
|
|
|
SetItemCount( aRow + 1 );
|
|
|
|
|
|
|
|
m_Netnames[aRow] = aNetname;
|
|
|
|
m_Classnames[aRow] = aNetclassName;
|
|
|
|
}
|
2009-11-02 05:20:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function EnsureGridColumnWidths
|
|
|
|
* resizes all the columns in a wxGrid based only on the requirements of the
|
|
|
|
* column titles and not on the grid cell requirements, assuming that the grid
|
|
|
|
* cell width requirements are narrower than the column title requirements.
|
|
|
|
*/
|
2010-09-02 13:10:48 +00:00
|
|
|
|
2009-11-02 05:20:58 +00:00
|
|
|
// @todo: maybe move this to common.cpp if it works.
|
2016-08-25 07:35:35 +00:00
|
|
|
static void EnsureGridColumnWidths( wxWindow* aShower, wxGrid* aGrid )
|
2009-11-02 05:20:58 +00:00
|
|
|
{
|
2016-08-25 07:35:35 +00:00
|
|
|
wxWindowDC sDC( aShower );
|
2009-11-02 05:20:58 +00:00
|
|
|
|
|
|
|
sDC.SetFont( aGrid->GetLabelFont() );
|
|
|
|
|
|
|
|
int colCount = aGrid->GetNumberCols();
|
2014-09-19 23:58:32 +00:00
|
|
|
|
2016-08-25 07:35:35 +00:00
|
|
|
for( int col = 0; col < colCount; ++col )
|
2009-11-02 05:20:58 +00:00
|
|
|
{
|
|
|
|
// add two spaces to the text and size it.
|
2009-11-02 10:06:42 +00:00
|
|
|
wxString colText = aGrid->GetColLabelValue( col ) + wxT( " " );
|
2009-11-02 05:20:58 +00:00
|
|
|
|
2010-09-02 13:10:48 +00:00
|
|
|
wxSize needed = sDC.GetTextExtent( colText );
|
2009-11-02 05:20:58 +00:00
|
|
|
|
|
|
|
// set the width of this column
|
|
|
|
aGrid->SetColSize( col, needed.x );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-25 07:35:35 +00:00
|
|
|
static void EnsureGridRowTitleWidth( wxWindow* aShower, wxGrid* aGrid, int aMinWidth )
|
|
|
|
{
|
|
|
|
wxWindowDC sDC( aShower );
|
|
|
|
sDC.SetFont( aGrid->GetLabelFont() );
|
|
|
|
|
|
|
|
int minsize = aMinWidth;
|
|
|
|
int rowCount = aGrid->GetNumberRows();
|
|
|
|
|
|
|
|
for( int row = 0; row < rowCount; ++row )
|
|
|
|
{
|
|
|
|
// add two spaces to the text and size it.
|
|
|
|
wxString rowText = aGrid->GetRowLabelValue( row ) + wxT( " " );
|
|
|
|
|
|
|
|
wxSize needed = sDC.GetTextExtent( rowText );
|
|
|
|
|
|
|
|
minsize = std::max( minsize, needed.x );
|
|
|
|
}
|
|
|
|
|
|
|
|
// set the width of the row laberls
|
|
|
|
aGrid->SetRowLabelSize( minsize );
|
|
|
|
}
|
|
|
|
|
2009-07-18 11:44:19 +00:00
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
DIALOG_DESIGN_RULES::DIALOG_DESIGN_RULES( PCB_EDIT_FRAME* parent ) :
|
2009-07-18 11:44:19 +00:00
|
|
|
DIALOG_DESIGN_RULES_BASE( parent )
|
|
|
|
{
|
|
|
|
m_Parent = parent;
|
2009-10-21 19:16:25 +00:00
|
|
|
SetAutoLayout( true );
|
2009-07-18 11:44:19 +00:00
|
|
|
|
2016-08-25 07:35:35 +00:00
|
|
|
m_initialRowLabelsSize = m_grid->GetRowLabelSize();
|
|
|
|
EnsureGridColumnWidths( this, m_grid ); // override any column widths set by wxformbuilder.
|
2009-11-02 05:20:58 +00:00
|
|
|
|
2010-09-02 13:10:48 +00:00
|
|
|
wxListItem column0;
|
|
|
|
wxListItem column1;
|
2009-09-10 15:22:26 +00:00
|
|
|
|
|
|
|
column0.Clear();
|
|
|
|
column1.Clear();
|
|
|
|
|
2010-09-02 13:10:48 +00:00
|
|
|
column0.SetMask( wxLIST_MASK_TEXT );
|
|
|
|
column1.SetMask( wxLIST_MASK_TEXT );
|
2009-09-10 15:22:26 +00:00
|
|
|
|
2011-04-16 15:03:21 +00:00
|
|
|
column0.SetText( NET_TITLE );
|
|
|
|
column1.SetText( CLASS_TITLE );
|
2009-09-10 15:22:26 +00:00
|
|
|
|
2016-11-30 07:47:25 +00:00
|
|
|
SetDataValidators();
|
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
m_leftListCtrl->InsertColumn( 0, column0 );
|
|
|
|
m_leftListCtrl->InsertColumn( 1, column1 );
|
|
|
|
m_leftListCtrl->SetColumnWidth( 0, wxLIST_AUTOSIZE );
|
|
|
|
m_leftListCtrl->SetColumnWidth( 1, wxLIST_AUTOSIZE );
|
|
|
|
|
|
|
|
m_rightListCtrl->InsertColumn( 0, column0 );
|
|
|
|
m_rightListCtrl->InsertColumn( 1, column1 );
|
|
|
|
m_rightListCtrl->SetColumnWidth( 0, wxLIST_AUTOSIZE );
|
|
|
|
m_rightListCtrl->SetColumnWidth( 1, wxLIST_AUTOSIZE );
|
|
|
|
|
2009-11-02 05:20:58 +00:00
|
|
|
// if user has been into the dialog before, go back to same tab
|
|
|
|
if( s_LastTabSelection != -1 )
|
|
|
|
{
|
|
|
|
m_DRnotebook->SetSelection( s_LastTabSelection );
|
|
|
|
}
|
2009-09-10 15:22:26 +00:00
|
|
|
|
2009-10-06 18:58:51 +00:00
|
|
|
InitDialogRules();
|
2016-08-25 07:35:35 +00:00
|
|
|
EnsureGridRowTitleWidth( this, m_grid, m_initialRowLabelsSize );
|
|
|
|
|
2015-10-02 19:11:33 +00:00
|
|
|
m_sdbSizer1OK->SetDefault();
|
2009-11-02 05:20:58 +00:00
|
|
|
|
2015-10-14 07:20:28 +00:00
|
|
|
// Allow tabbing out of grid controls.
|
2014-09-19 23:58:32 +00:00
|
|
|
m_grid->SetTabBehaviour( wxGrid::Tab_Leave );
|
|
|
|
m_gridViaSizeList->SetTabBehaviour( wxGrid::Tab_Leave );
|
|
|
|
m_gridTrackWidthList->SetTabBehaviour( wxGrid::Tab_Leave );
|
|
|
|
|
2016-07-14 14:25:35 +00:00
|
|
|
Layout();
|
|
|
|
|
|
|
|
// Now all widgets have the size fixed, call FinishDialogSettings
|
|
|
|
FinishDialogSettings();
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
|
|
|
|
2016-11-30 07:47:25 +00:00
|
|
|
void DIALOG_DESIGN_RULES::SetDataValidators()
|
|
|
|
{
|
|
|
|
// Set floating-point validators for numerical inputs
|
|
|
|
wxFloatingPointValidator< double > fpValidator( NULL, wxNUM_VAL_ZERO_AS_BLANK | wxNUM_VAL_NO_TRAILING_ZEROES );
|
|
|
|
|
|
|
|
int maxDimension = 1000 * IU_PER_MILS; // One-inch
|
|
|
|
|
|
|
|
fpValidator.SetRange( 0, To_User_Unit( g_UserUnit, maxDimension ) );
|
|
|
|
fpValidator.SetPrecision( 10 );
|
|
|
|
|
|
|
|
m_SetViasMinSizeCtrl->SetValidator( fpValidator );
|
|
|
|
m_SetViasMinDrillCtrl->SetValidator( fpValidator );
|
|
|
|
m_SetMicroViasMinSizeCtrl->SetValidator( fpValidator );
|
|
|
|
m_SetMicroViasMinDrillCtrl->SetValidator( fpValidator );
|
|
|
|
m_SetTrackMinWidthCtrl->SetValidator( fpValidator );
|
|
|
|
}
|
|
|
|
|
2009-07-18 11:44:19 +00:00
|
|
|
|
2009-10-06 18:58:51 +00:00
|
|
|
void DIALOG_DESIGN_RULES::InitDialogRules()
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
2015-10-02 19:11:33 +00:00
|
|
|
// @todo: Move the initialization code into TransferDataToWindow() to follow wxWidgets
|
|
|
|
// dialog data transfer convention.
|
2009-07-18 11:44:19 +00:00
|
|
|
SetFocus();
|
2009-07-18 16:06:48 +00:00
|
|
|
SetReturnCode( 0 );
|
2009-07-18 11:44:19 +00:00
|
|
|
|
2009-07-18 16:06:48 +00:00
|
|
|
m_Pcb = m_Parent->GetBoard();
|
2014-05-13 09:22:51 +00:00
|
|
|
m_BrdSettings = &m_Pcb->GetDesignSettings();
|
2009-07-18 11:44:19 +00:00
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
// Initialize the Rules List
|
|
|
|
InitRulesList();
|
2009-07-18 11:44:19 +00:00
|
|
|
|
2018-03-02 10:46:31 +00:00
|
|
|
// Reassure that all nets have net classes assigned
|
|
|
|
m_Pcb->BuildListOfNets();
|
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
// copy all NETs into m_AllNets by adding them as NETCUPs.
|
2009-07-18 11:44:19 +00:00
|
|
|
|
2015-10-02 19:11:33 +00:00
|
|
|
// @todo go fix m_Pcb->SynchronizeNetsAndNetClasses() so that the netcode==0 is not
|
|
|
|
// present in the BOARD::m_NetClasses
|
2014-05-13 09:22:51 +00:00
|
|
|
NETCLASSES& netclasses = m_BrdSettings->m_NetClasses;
|
2014-05-20 09:29:37 +00:00
|
|
|
NETCLASSPTR netclass = netclasses.GetDefault();
|
2009-09-10 15:22:26 +00:00
|
|
|
|
2009-09-23 05:53:12 +00:00
|
|
|
// Initialize list of nets for Default Net Class
|
2014-05-20 09:29:37 +00:00
|
|
|
for( NETCLASS::iterator name = netclass->begin(); name != netclass->end(); ++name )
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
2009-09-10 15:22:26 +00:00
|
|
|
m_AllNets.push_back( NETCUP( *name, netclass->GetName() ) );
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
|
|
|
|
2009-09-23 05:53:12 +00:00
|
|
|
// Initialize list of nets for others (custom) Net Classes
|
2009-09-10 15:22:26 +00:00
|
|
|
for( NETCLASSES::const_iterator nc = netclasses.begin(); nc != netclasses.end(); ++nc )
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
2009-09-10 15:22:26 +00:00
|
|
|
netclass = nc->second;
|
|
|
|
|
|
|
|
for( NETCLASS::const_iterator name = netclass->begin(); name != netclass->end(); ++name )
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
2009-09-10 15:22:26 +00:00
|
|
|
m_AllNets.push_back( NETCUP( *name, netclass->GetName() ) );
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
InitializeRulesSelectionBoxes();
|
2009-10-21 19:16:25 +00:00
|
|
|
InitGlobalRules();
|
2009-09-10 15:22:26 +00:00
|
|
|
}
|
2009-07-18 11:44:19 +00:00
|
|
|
|
2010-09-02 13:10:48 +00:00
|
|
|
|
2009-10-21 19:16:25 +00:00
|
|
|
void DIALOG_DESIGN_RULES::InitGlobalRules()
|
|
|
|
{
|
2016-11-30 07:47:25 +00:00
|
|
|
// Set unit labels
|
2017-03-14 23:06:48 +00:00
|
|
|
const wxString units = GetAbbreviatedUnitsLabel( g_UserUnit );
|
2016-11-30 07:47:25 +00:00
|
|
|
|
|
|
|
m_ViaMinUnits->SetLabel( units );
|
|
|
|
m_ViaMinDrillUnits->SetLabel( units );
|
|
|
|
m_MicroViaMinSizeUnits->SetLabel( units );
|
|
|
|
m_MicroViaMinDrillUnits->SetLabel( units );
|
|
|
|
m_TrackMinWidthUnits->SetLabel( units );
|
2009-10-21 19:16:25 +00:00
|
|
|
|
2014-05-13 09:22:51 +00:00
|
|
|
PutValueInLocalUnits( *m_SetViasMinSizeCtrl, m_BrdSettings->m_ViasMinSize );
|
|
|
|
PutValueInLocalUnits( *m_SetViasMinDrillCtrl, m_BrdSettings->m_ViasMinDrill );
|
2011-11-24 17:32:51 +00:00
|
|
|
|
2016-11-30 07:47:25 +00:00
|
|
|
m_OptAllowBlindBuriedVias->SetValue( m_BrdSettings->m_BlindBuriedViaAllowed );
|
|
|
|
m_OptAllowMicroVias->SetValue( m_BrdSettings->m_MicroViasAllowed );
|
2017-08-28 19:45:50 +00:00
|
|
|
CheckAllowMicroVias();
|
2009-10-21 19:16:25 +00:00
|
|
|
|
2014-05-13 09:22:51 +00:00
|
|
|
PutValueInLocalUnits( *m_SetMicroViasMinSizeCtrl, m_BrdSettings->m_MicroViasMinSize );
|
|
|
|
PutValueInLocalUnits( *m_SetMicroViasMinDrillCtrl, m_BrdSettings->m_MicroViasMinDrill );
|
|
|
|
PutValueInLocalUnits( *m_SetTrackMinWidthCtrl, m_BrdSettings->m_TrackMinWidth );
|
2009-10-26 19:00:46 +00:00
|
|
|
|
|
|
|
// Initialize Vias and Tracks sizes lists.
|
|
|
|
// note we display only extra values, never the current netclass value.
|
2013-08-28 16:14:39 +00:00
|
|
|
// (the first value in history list)
|
2014-05-13 09:22:51 +00:00
|
|
|
m_TracksWidthList = m_BrdSettings->m_TrackWidthList;
|
2010-09-02 13:10:48 +00:00
|
|
|
m_TracksWidthList.erase( m_TracksWidthList.begin() ); // remove the netclass value
|
2014-05-13 09:22:51 +00:00
|
|
|
m_ViasDimensionsList = m_BrdSettings->m_ViasDimensionsList;
|
2009-10-30 17:58:15 +00:00
|
|
|
m_ViasDimensionsList.erase( m_ViasDimensionsList.begin() ); // remove the netclass value
|
2009-10-26 19:00:46 +00:00
|
|
|
InitDimensionsLists();
|
2009-10-21 19:16:25 +00:00
|
|
|
}
|
|
|
|
|
2010-09-02 13:10:48 +00:00
|
|
|
|
2009-10-26 19:00:46 +00:00
|
|
|
void DIALOG_DESIGN_RULES::InitDimensionsLists()
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
|
2011-01-21 14:19:06 +00:00
|
|
|
// Compute the column widths here, after setting texts
|
|
|
|
msg = wxT("000000.000000"); // This is a very long text to display values.
|
|
|
|
// Actual values are shorter.
|
|
|
|
m_gridViaSizeList->SetCellValue( 0, 0, msg );
|
|
|
|
m_gridViaSizeList->SetCellValue( 0, 1, msg );
|
|
|
|
m_gridTrackWidthList->SetCellValue( 0, 0, msg );
|
2014-09-19 23:58:32 +00:00
|
|
|
m_gridViaSizeList->SetColMinimalWidth( 0, 150 );
|
|
|
|
m_gridViaSizeList->SetColMinimalWidth( 1, 150 );
|
|
|
|
m_gridViaSizeList->AutoSizeColumns( true );
|
|
|
|
m_gridTrackWidthList->SetColMinimalWidth( 0, 150 );
|
|
|
|
m_gridTrackWidthList->AutoSizeColumns( true );
|
2015-11-29 14:19:22 +00:00
|
|
|
m_gridViaSizeList->SetColMinimalWidth( 1, 150 );
|
2011-01-21 14:19:06 +00:00
|
|
|
|
|
|
|
// Fill cells with actual values:
|
|
|
|
m_gridViaSizeList->SetCellValue( 0, 0, wxEmptyString );
|
|
|
|
m_gridViaSizeList->SetCellValue( 0, 1, wxEmptyString );
|
2015-11-29 15:17:47 +00:00
|
|
|
m_gridTrackWidthList->SetCellValue( 0, 0, wxEmptyString );
|
2015-11-29 14:19:22 +00:00
|
|
|
|
|
|
|
// Give a correct size to row labels column
|
|
|
|
m_gridViaSizeList->SetRowLabelSize( wxGRID_AUTOSIZE );
|
|
|
|
m_gridTrackWidthList->SetRowLabelSize( wxGRID_AUTOSIZE );
|
2011-01-21 14:19:06 +00:00
|
|
|
|
2009-10-26 19:00:46 +00:00
|
|
|
for( unsigned ii = 0; ii < m_TracksWidthList.size(); ii++ )
|
|
|
|
{
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
msg = StringFromValue( g_UserUnit, m_TracksWidthList[ii], false );
|
2009-10-26 19:00:46 +00:00
|
|
|
m_gridTrackWidthList->SetCellValue( ii, 0, msg );
|
|
|
|
}
|
|
|
|
|
2009-10-30 17:58:15 +00:00
|
|
|
for( unsigned ii = 0; ii < m_ViasDimensionsList.size(); ii++ )
|
2009-10-26 19:00:46 +00:00
|
|
|
{
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
msg = StringFromValue( g_UserUnit, m_ViasDimensionsList[ii].m_Diameter, false );
|
2009-10-26 19:00:46 +00:00
|
|
|
m_gridViaSizeList->SetCellValue( ii, 0, msg );
|
2014-09-19 23:58:32 +00:00
|
|
|
|
2011-11-24 17:32:51 +00:00
|
|
|
if( m_ViasDimensionsList[ii].m_Drill > 0 )
|
2009-10-30 17:58:15 +00:00
|
|
|
{
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
msg = StringFromValue( g_UserUnit, m_ViasDimensionsList[ii].m_Drill, false );
|
2009-10-30 17:58:15 +00:00
|
|
|
m_gridViaSizeList->SetCellValue( ii, 1, msg );
|
|
|
|
}
|
2009-10-26 19:00:46 +00:00
|
|
|
}
|
|
|
|
}
|
2009-10-21 19:16:25 +00:00
|
|
|
|
2010-09-02 13:10:48 +00:00
|
|
|
|
2009-10-21 19:16:25 +00:00
|
|
|
// Sort comparison function (helper for makePointers() )
|
2009-09-10 15:22:26 +00:00
|
|
|
static bool sortByClassThenName( NETCUP* a, NETCUP* b )
|
|
|
|
{
|
|
|
|
// return a < b
|
|
|
|
if( a->clazz < b->clazz )
|
|
|
|
return true;
|
|
|
|
|
2010-04-29 09:06:01 +00:00
|
|
|
// inside the same class, sort by net name:
|
|
|
|
if( a->clazz == b->clazz )
|
|
|
|
{
|
|
|
|
if( a->net < b->net )
|
|
|
|
return true;
|
|
|
|
}
|
2009-07-18 11:44:19 +00:00
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2010-09-02 13:10:48 +00:00
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
void DIALOG_DESIGN_RULES::makePointers( PNETCUPS* aList, const wxString& aNetClassName )
|
|
|
|
{
|
|
|
|
aList->clear();
|
|
|
|
|
|
|
|
if( wildCard == aNetClassName )
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
2009-09-10 15:22:26 +00:00
|
|
|
for( NETCUPS::iterator n = m_AllNets.begin(); n != m_AllNets.end(); ++n )
|
|
|
|
{
|
|
|
|
aList->push_back( &*n );
|
|
|
|
}
|
2009-07-18 16:06:48 +00:00
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
sort( aList->begin(), aList->end(), sortByClassThenName );
|
|
|
|
|
|
|
|
// could use a different sort order for wildCard case.
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for( NETCUPS::iterator n = m_AllNets.begin(); n != m_AllNets.end(); ++n )
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
2009-09-10 15:22:26 +00:00
|
|
|
if( n->clazz == aNetClassName )
|
|
|
|
aList->push_back( &*n );
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
2009-07-18 16:06:48 +00:00
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
sort( aList->begin(), aList->end(), sortByClassThenName );
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
2009-09-10 15:22:26 +00:00
|
|
|
}
|
2009-07-18 11:44:19 +00:00
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
|
2010-09-02 13:10:48 +00:00
|
|
|
void DIALOG_DESIGN_RULES::FillListBoxWithNetNames( NETS_LIST_CTRL* aListCtrl,
|
|
|
|
const wxString& aNetClass )
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
2010-09-02 13:10:48 +00:00
|
|
|
aListCtrl->ClearList();
|
2009-09-10 15:30:30 +00:00
|
|
|
|
2010-09-02 13:10:48 +00:00
|
|
|
PNETCUPS ptrList;
|
2009-09-10 15:22:26 +00:00
|
|
|
|
2009-09-10 15:30:30 +00:00
|
|
|
// get a subset of m_AllNets in pointer form, sorted as desired.
|
2009-09-10 15:22:26 +00:00
|
|
|
makePointers( &ptrList, aNetClass );
|
|
|
|
|
2009-09-10 17:28:38 +00:00
|
|
|
#if 0 && defined(DEBUG)
|
2009-09-10 15:22:26 +00:00
|
|
|
int r = 0;
|
|
|
|
for( PNETCUPS::iterator i = ptrList.begin(); i!=ptrList.end(); ++i, ++r )
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
2011-02-28 18:36:19 +00:00
|
|
|
printf( "[%d]: %s %s\n", r, TO_UTF8( (*i)->net ), TO_UTF8( (*i)->clazz ) );
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
2010-09-02 13:10:48 +00:00
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
#endif
|
|
|
|
|
2011-04-16 15:03:21 +00:00
|
|
|
// Add netclass info to m_Netnames and m_Classnames wxArrayString buffers
|
|
|
|
// aListCtrl uses wxLC_VIRTUAL option, so this is fast
|
2014-09-19 23:58:32 +00:00
|
|
|
wxClientDC sDC( aListCtrl );
|
2009-09-10 15:22:26 +00:00
|
|
|
int row = 0;
|
2011-04-16 15:03:21 +00:00
|
|
|
// recompute the column widths here, after setting texts
|
|
|
|
int net_colsize = sDC.GetTextExtent( NET_TITLE ).x;
|
|
|
|
int class_colsize = sDC.GetTextExtent( CLASS_TITLE ).x;
|
2014-09-19 23:58:32 +00:00
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
for( PNETCUPS::iterator i = ptrList.begin(); i!=ptrList.end(); ++i, ++row )
|
|
|
|
{
|
2011-04-16 15:03:21 +00:00
|
|
|
wxSize net_needed = sDC.GetTextExtent( (*i)->net );
|
|
|
|
wxSize class_needed = sDC.GetTextExtent( (*i)->clazz );
|
2012-09-22 11:19:37 +00:00
|
|
|
net_colsize = std::max( net_colsize, net_needed.x );
|
|
|
|
class_colsize = std::max( class_colsize, class_needed.x );
|
2013-11-12 00:17:27 +00:00
|
|
|
aListCtrl->SetRowItems( row, (*i)->net, (*i)->clazz );
|
2009-09-10 15:22:26 +00:00
|
|
|
}
|
|
|
|
|
2014-09-19 23:58:32 +00:00
|
|
|
int margin = sDC.GetTextExtent( wxT( "XX" ) ).x;
|
|
|
|
aListCtrl->SetColumnWidth( 0, net_colsize + margin );
|
|
|
|
aListCtrl->SetColumnWidth( 1, class_colsize + margin );
|
2011-04-16 15:03:21 +00:00
|
|
|
aListCtrl->Refresh();
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
|
|
|
|
2009-07-18 16:06:48 +00:00
|
|
|
|
2011-04-16 15:03:21 +00:00
|
|
|
/* Populates combo boxes with the list of existing net classes
|
2009-07-18 11:44:19 +00:00
|
|
|
*/
|
|
|
|
void DIALOG_DESIGN_RULES::InitializeRulesSelectionBoxes()
|
|
|
|
{
|
2009-09-10 15:22:26 +00:00
|
|
|
m_rightClassChoice->Clear();
|
|
|
|
m_leftClassChoice->Clear();
|
|
|
|
|
|
|
|
m_rightClassChoice->Append( wildCard );
|
|
|
|
m_leftClassChoice->Append( wildCard );
|
|
|
|
|
|
|
|
for( int ii = 0; ii < m_grid->GetNumberRows(); ii++ )
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
2009-09-10 15:22:26 +00:00
|
|
|
m_rightClassChoice->Append( m_grid->GetRowLabelValue( ii ) );
|
|
|
|
m_leftClassChoice->Append( m_grid->GetRowLabelValue( ii ) );
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
2009-07-18 16:06:48 +00:00
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
m_rightClassChoice->Select( 0 );
|
|
|
|
m_leftClassChoice->Select( 0 );
|
|
|
|
|
2009-07-18 16:06:48 +00:00
|
|
|
m_buttonRightToLeft->Enable( false );
|
2015-01-17 08:01:16 +00:00
|
|
|
m_buttonLeftToRight->Enable( false );
|
2009-09-10 15:22:26 +00:00
|
|
|
|
|
|
|
FillListBoxWithNetNames( m_leftListCtrl, m_leftClassChoice->GetStringSelection() );
|
|
|
|
FillListBoxWithNetNames( m_rightListCtrl, m_rightClassChoice->GetStringSelection() );
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
/* Initialize the rules list from board
|
2009-07-18 11:44:19 +00:00
|
|
|
*/
|
2009-09-10 15:22:26 +00:00
|
|
|
|
2017-09-23 09:20:10 +00:00
|
|
|
static void class2gridRow( wxGrid* grid, int row, const NETCLASSPTR& nc )
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
2009-09-10 15:22:26 +00:00
|
|
|
wxString msg;
|
2009-07-18 11:44:19 +00:00
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
// label is netclass name
|
|
|
|
grid->SetRowLabelValue( row, nc->GetName() );
|
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
msg = StringFromValue( g_UserUnit, nc->GetClearance() );
|
2011-11-24 17:32:51 +00:00
|
|
|
grid->SetCellValue( row, GRID_CLEARANCE, msg );
|
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
msg = StringFromValue( g_UserUnit, nc->GetTrackWidth() );
|
2011-11-24 17:32:51 +00:00
|
|
|
grid->SetCellValue( row, GRID_TRACKSIZE, msg );
|
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
msg = StringFromValue( g_UserUnit, nc->GetViaDiameter() );
|
2011-11-24 17:32:51 +00:00
|
|
|
grid->SetCellValue( row, GRID_VIASIZE, msg );
|
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
msg = StringFromValue( g_UserUnit, nc->GetViaDrill() );
|
2011-11-24 17:32:51 +00:00
|
|
|
grid->SetCellValue( row, GRID_VIADRILL, msg );
|
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
msg = StringFromValue( g_UserUnit, nc->GetuViaDiameter() );
|
2011-11-24 17:32:51 +00:00
|
|
|
grid->SetCellValue( row, GRID_uVIASIZE, msg );
|
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
msg = StringFromValue( g_UserUnit, nc->GetuViaDrill() );
|
2011-11-24 17:32:51 +00:00
|
|
|
grid->SetCellValue( row, GRID_uVIADRILL, msg );
|
2016-08-15 15:16:49 +00:00
|
|
|
|
|
|
|
msg = StringFromValue( g_UserUnit, nc->GetDiffPairGap() );
|
|
|
|
grid->SetCellValue( row, GRID_DIFF_PAIR_GAP, msg );
|
|
|
|
|
|
|
|
msg = StringFromValue( g_UserUnit, nc->GetDiffPairWidth() );
|
|
|
|
grid->SetCellValue( row, GRID_DIFF_PAIR_WIDTH, msg );
|
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
}
|
2009-07-18 16:06:48 +00:00
|
|
|
|
2010-09-02 13:10:48 +00:00
|
|
|
|
2009-07-18 11:44:19 +00:00
|
|
|
void DIALOG_DESIGN_RULES::InitRulesList()
|
|
|
|
{
|
2014-05-13 09:22:51 +00:00
|
|
|
NETCLASSES& netclasses = m_BrdSettings->m_NetClasses;
|
2009-08-17 02:59:38 +00:00
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
// the +1 is for the Default NETCLASS.
|
2010-09-02 13:10:48 +00:00
|
|
|
if( netclasses.GetCount() + 1 > (unsigned) m_grid->GetNumberRows() )
|
2009-09-10 15:22:26 +00:00
|
|
|
{
|
2010-09-02 13:10:48 +00:00
|
|
|
m_grid->AppendRows( netclasses.GetCount() + 1 - m_grid->GetNumberRows() );
|
2009-09-10 15:22:26 +00:00
|
|
|
}
|
|
|
|
|
2009-09-17 17:48:40 +00:00
|
|
|
// enter the Default NETCLASS.
|
2012-04-16 23:31:29 +00:00
|
|
|
class2gridRow( m_grid, 0, netclasses.GetDefault() );
|
2009-09-10 15:22:26 +00:00
|
|
|
|
2009-09-17 17:48:40 +00:00
|
|
|
// enter others netclasses
|
2009-09-10 15:22:26 +00:00
|
|
|
int row = 1;
|
2014-09-19 23:58:32 +00:00
|
|
|
|
2010-09-02 13:10:48 +00:00
|
|
|
for( NETCLASSES::iterator i = netclasses.begin(); i!=netclasses.end(); ++i, ++row )
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
2014-05-20 09:29:37 +00:00
|
|
|
NETCLASSPTR netclass = i->second;
|
2009-07-18 16:06:48 +00:00
|
|
|
|
2012-04-16 23:31:29 +00:00
|
|
|
class2gridRow( m_grid, row, netclass );
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-18 16:06:48 +00:00
|
|
|
|
2017-09-23 09:20:10 +00:00
|
|
|
static void gridRow2class( wxGrid* grid, int row, const NETCLASSPTR& nc )
|
2009-09-10 15:22:26 +00:00
|
|
|
{
|
2011-11-24 17:32:51 +00:00
|
|
|
#define MYCELL( col ) \
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
ValueFromString( g_UserUnit, grid->GetCellValue( row, col ) )
|
2011-11-24 17:32:51 +00:00
|
|
|
|
|
|
|
nc->SetClearance( MYCELL( GRID_CLEARANCE ) );
|
|
|
|
nc->SetTrackWidth( MYCELL( GRID_TRACKSIZE ) );
|
|
|
|
nc->SetViaDiameter( MYCELL( GRID_VIASIZE ) );
|
|
|
|
nc->SetViaDrill( MYCELL( GRID_VIADRILL ) );
|
|
|
|
nc->SetuViaDiameter( MYCELL( GRID_uVIASIZE ) );
|
|
|
|
nc->SetuViaDrill( MYCELL( GRID_uVIADRILL ) );
|
2016-08-15 15:16:49 +00:00
|
|
|
nc->SetDiffPairGap( MYCELL( GRID_DIFF_PAIR_GAP ) );
|
|
|
|
nc->SetDiffPairWidth( MYCELL( GRID_DIFF_PAIR_WIDTH ) );
|
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-18 11:44:19 +00:00
|
|
|
void DIALOG_DESIGN_RULES::CopyRulesListToBoard()
|
|
|
|
{
|
2017-12-27 18:42:26 +00:00
|
|
|
// Commit any pending in-place edits first
|
|
|
|
m_grid->SaveEditControlValue();
|
|
|
|
|
2014-05-13 09:22:51 +00:00
|
|
|
NETCLASSES& netclasses = m_BrdSettings->m_NetClasses;
|
2009-08-17 02:59:38 +00:00
|
|
|
|
2009-09-28 16:14:45 +00:00
|
|
|
// Remove all netclasses from board. We'll copy new list after
|
2009-08-17 02:59:38 +00:00
|
|
|
netclasses.Clear();
|
|
|
|
|
2009-09-28 16:14:45 +00:00
|
|
|
// Copy the default NetClass:
|
2012-04-16 23:31:29 +00:00
|
|
|
gridRow2class( m_grid, 0, netclasses.GetDefault() );
|
2009-09-10 15:22:26 +00:00
|
|
|
|
2009-09-28 16:14:45 +00:00
|
|
|
// Copy other NetClasses :
|
2009-09-10 15:22:26 +00:00
|
|
|
for( int row = 1; row < m_grid->GetNumberRows(); ++row )
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
2016-06-29 15:09:55 +00:00
|
|
|
NETCLASSPTR nc = std::make_shared<NETCLASS>( m_grid->GetRowLabelValue( row ) );
|
2009-09-10 15:22:26 +00:00
|
|
|
|
2014-05-13 09:22:51 +00:00
|
|
|
if( !m_BrdSettings->m_NetClasses.Add( nc ) )
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
2009-09-28 16:14:45 +00:00
|
|
|
// this netclass cannot be added because an other netclass with the same name exists
|
|
|
|
// Should not occur because OnAddNetclassClick() tests for existing NetClass names
|
|
|
|
wxString msg;
|
2010-09-02 13:10:48 +00:00
|
|
|
msg.Printf( wxT( "CopyRulesListToBoard(): The NetClass \"%s\" already exists. Skip" ),
|
2012-04-16 23:31:29 +00:00
|
|
|
GetChars( m_grid->GetRowLabelValue( row ) ) );
|
2009-09-28 16:14:45 +00:00
|
|
|
wxMessageBox( msg );
|
2014-05-20 09:29:37 +00:00
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
continue;
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
2009-08-17 02:59:38 +00:00
|
|
|
|
2012-04-16 23:31:29 +00:00
|
|
|
gridRow2class( m_grid, row, nc );
|
2009-09-10 15:22:26 +00:00
|
|
|
}
|
|
|
|
|
2009-09-28 16:14:45 +00:00
|
|
|
// Now read all nets and push them in the corresponding netclass net buffer
|
|
|
|
for( NETCUPS::const_iterator netcup = m_AllNets.begin(); netcup != m_AllNets.end(); ++netcup )
|
2009-09-10 15:22:26 +00:00
|
|
|
{
|
2014-05-20 09:29:37 +00:00
|
|
|
NETCLASSPTR nc = netclasses.Find( netcup->clazz );
|
2009-09-10 15:22:26 +00:00
|
|
|
wxASSERT( nc );
|
|
|
|
nc->Add( netcup->net );
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
|
|
|
|
2009-08-17 02:59:38 +00:00
|
|
|
m_Pcb->SynchronizeNetsAndNetClasses();
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
|
|
|
|
2010-09-02 13:10:48 +00:00
|
|
|
|
2009-10-26 19:00:46 +00:00
|
|
|
void DIALOG_DESIGN_RULES::CopyGlobalRulesToBoard()
|
2009-10-21 19:16:25 +00:00
|
|
|
{
|
2016-11-30 07:47:25 +00:00
|
|
|
m_BrdSettings->m_BlindBuriedViaAllowed = m_OptAllowBlindBuriedVias->GetValue();
|
2009-10-21 19:16:25 +00:00
|
|
|
|
|
|
|
// Update vias minimum values for DRC
|
2014-05-13 09:22:51 +00:00
|
|
|
m_BrdSettings->m_ViasMinSize = ValueFromTextCtrl( *m_SetViasMinSizeCtrl );
|
|
|
|
m_BrdSettings->m_ViasMinDrill = ValueFromTextCtrl( *m_SetViasMinDrillCtrl );
|
2011-11-24 17:32:51 +00:00
|
|
|
|
2016-11-30 07:47:25 +00:00
|
|
|
m_BrdSettings->m_MicroViasAllowed = m_OptAllowMicroVias->GetValue();
|
2009-10-21 19:16:25 +00:00
|
|
|
|
|
|
|
// Update microvias minimum values for DRC
|
2014-05-13 09:22:51 +00:00
|
|
|
m_BrdSettings->m_MicroViasMinSize = ValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl );
|
|
|
|
m_BrdSettings->m_MicroViasMinDrill = ValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl );
|
2011-11-24 17:32:51 +00:00
|
|
|
|
2009-10-21 19:16:25 +00:00
|
|
|
// Update tracks minimum values for DRC
|
2014-05-13 09:22:51 +00:00
|
|
|
m_BrdSettings->m_TrackMinWidth = ValueFromTextCtrl( *m_SetTrackMinWidthCtrl );
|
2009-10-26 19:00:46 +00:00
|
|
|
}
|
2009-10-21 19:16:25 +00:00
|
|
|
|
2010-09-02 13:10:48 +00:00
|
|
|
|
|
|
|
void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard()
|
2009-10-26 19:00:46 +00:00
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
|
2017-12-12 17:33:34 +00:00
|
|
|
// Commit any pending in-place edits from grid controls
|
|
|
|
m_gridTrackWidthList->SaveEditControlValue();
|
|
|
|
m_gridViaSizeList->SaveEditControlValue();
|
|
|
|
|
2009-10-26 19:00:46 +00:00
|
|
|
// Reinitialize m_TrackWidthList
|
|
|
|
m_TracksWidthList.clear();
|
2014-09-19 23:58:32 +00:00
|
|
|
|
2009-10-26 19:00:46 +00:00
|
|
|
for( int row = 0; row < m_gridTrackWidthList->GetNumberRows(); ++row )
|
|
|
|
{
|
|
|
|
msg = m_gridTrackWidthList->GetCellValue( row, 0 );
|
2012-04-16 17:39:32 +00:00
|
|
|
|
2009-10-26 19:00:46 +00:00
|
|
|
if( msg.IsEmpty() )
|
|
|
|
continue;
|
2012-04-16 17:39:32 +00:00
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
int value = ValueFromString( g_UserUnit, msg );
|
2011-11-24 17:32:51 +00:00
|
|
|
m_TracksWidthList.push_back( value );
|
2009-10-26 19:00:46 +00:00
|
|
|
}
|
2010-09-02 13:10:48 +00:00
|
|
|
|
2009-10-26 19:00:46 +00:00
|
|
|
// Sort new list by by increasing value
|
|
|
|
sort( m_TracksWidthList.begin(), m_TracksWidthList.end() );
|
|
|
|
|
2017-12-12 17:33:34 +00:00
|
|
|
// Reinitialize m_ViasDimensionsList
|
2009-10-30 17:58:15 +00:00
|
|
|
m_ViasDimensionsList.clear();
|
2012-04-16 17:39:32 +00:00
|
|
|
|
2009-10-26 19:00:46 +00:00
|
|
|
for( int row = 0; row < m_gridViaSizeList->GetNumberRows(); ++row )
|
|
|
|
{
|
|
|
|
msg = m_gridViaSizeList->GetCellValue( row, 0 );
|
2012-04-16 17:39:32 +00:00
|
|
|
|
2009-10-26 19:00:46 +00:00
|
|
|
if( msg.IsEmpty() )
|
|
|
|
continue;
|
2012-04-16 17:39:32 +00:00
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
int value = ValueFromString( g_UserUnit, msg );
|
2009-10-30 17:58:15 +00:00
|
|
|
VIA_DIMENSION via_dim;
|
2011-11-24 17:32:51 +00:00
|
|
|
via_dim.m_Diameter = value;
|
2009-10-30 17:58:15 +00:00
|
|
|
msg = m_gridViaSizeList->GetCellValue( row, 1 );
|
2012-04-16 17:39:32 +00:00
|
|
|
|
2010-09-02 13:10:48 +00:00
|
|
|
if( !msg.IsEmpty() )
|
2009-10-30 17:58:15 +00:00
|
|
|
{
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
value = ValueFromString( g_UserUnit, msg );
|
2011-11-24 17:32:51 +00:00
|
|
|
via_dim.m_Drill = value;
|
2009-10-30 17:58:15 +00:00
|
|
|
}
|
2012-04-16 17:39:32 +00:00
|
|
|
|
2010-09-02 13:10:48 +00:00
|
|
|
m_ViasDimensionsList.push_back( via_dim );
|
2009-10-26 19:00:46 +00:00
|
|
|
}
|
2010-09-02 13:10:48 +00:00
|
|
|
|
2009-10-26 19:00:46 +00:00
|
|
|
// Sort new list by by increasing value
|
2009-10-30 17:58:15 +00:00
|
|
|
sort( m_ViasDimensionsList.begin(), m_ViasDimensionsList.end() );
|
2009-10-26 19:00:46 +00:00
|
|
|
|
2014-05-13 09:22:51 +00:00
|
|
|
std::vector<int>* tlist = &m_BrdSettings->m_TrackWidthList;
|
2014-09-19 23:58:32 +00:00
|
|
|
|
|
|
|
// Remove old "custom" sizes
|
|
|
|
tlist->erase( tlist->begin() + 1, tlist->end() );
|
|
|
|
|
|
|
|
// Add new "custom" sizes
|
|
|
|
tlist->insert( tlist->end(), m_TracksWidthList.begin(), m_TracksWidthList.end() );
|
2009-10-26 19:00:46 +00:00
|
|
|
|
|
|
|
// Reinitialize m_ViaSizeList
|
2014-05-13 09:22:51 +00:00
|
|
|
std::vector<VIA_DIMENSION>* vialist = &m_BrdSettings->m_ViasDimensionsList;
|
2009-10-30 17:58:15 +00:00
|
|
|
vialist->erase( vialist->begin() + 1, vialist->end() );
|
|
|
|
vialist->insert( vialist->end(), m_ViasDimensionsList.begin(), m_ViasDimensionsList.end() );
|
2009-10-21 19:16:25 +00:00
|
|
|
}
|
|
|
|
|
2009-07-18 16:06:48 +00:00
|
|
|
|
2015-10-02 19:11:33 +00:00
|
|
|
void DIALOG_DESIGN_RULES::OnNotebookPageChanged( wxNotebookEvent& event )
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
2015-10-02 19:11:33 +00:00
|
|
|
s_LastTabSelection = event.GetSelection();
|
2015-10-07 14:15:24 +00:00
|
|
|
|
|
|
|
// Skip() allows OSX to properly refresh controls.
|
|
|
|
event.Skip();
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-10-02 19:11:33 +00:00
|
|
|
bool DIALOG_DESIGN_RULES::TransferDataFromWindow()
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
2015-10-02 19:11:33 +00:00
|
|
|
if( !wxDialog::TransferDataFromWindow() )
|
|
|
|
return false;
|
2009-11-02 05:20:58 +00:00
|
|
|
|
2015-10-02 19:11:33 +00:00
|
|
|
wxString errorMsg;
|
|
|
|
|
|
|
|
if( !TestDataValidity( &errorMsg ) )
|
2009-07-18 16:06:48 +00:00
|
|
|
{
|
2015-10-02 19:11:33 +00:00
|
|
|
HTML_MESSAGE_BOX dlg( this, _( "Design Rule Setting Error" ) );
|
|
|
|
dlg.MessageSet( errorMsg );
|
|
|
|
dlg.ShowModal();
|
|
|
|
return false;
|
2009-07-18 16:06:48 +00:00
|
|
|
}
|
|
|
|
|
2009-07-18 11:44:19 +00:00
|
|
|
CopyRulesListToBoard();
|
2009-10-21 19:16:25 +00:00
|
|
|
CopyGlobalRulesToBoard();
|
2010-09-02 13:10:48 +00:00
|
|
|
CopyDimensionsListsToBoard();
|
2014-05-13 09:22:51 +00:00
|
|
|
m_BrdSettings->SetCurrentNetClass( NETCLASS::Default );
|
2018-01-07 02:42:04 +00:00
|
|
|
|
|
|
|
//this event causes the routing tool to reload its design rules information
|
|
|
|
TOOL_MANAGER* toolManager = m_Parent->GetToolManager();
|
|
|
|
TOOL_EVENT event( TC_COMMAND, TA_MODEL_CHANGE, AS_ACTIVE );
|
|
|
|
toolManager->ProcessEvent( event );
|
|
|
|
|
|
|
|
|
2015-10-02 19:11:33 +00:00
|
|
|
return true;
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_DESIGN_RULES::OnAddNetclassClick( wxCommandEvent& event )
|
|
|
|
{
|
2010-09-02 13:10:48 +00:00
|
|
|
wxString class_name;
|
|
|
|
|
2015-10-07 14:15:24 +00:00
|
|
|
// @todo set validator to ensure net class name is valid rather than all of the checks
|
|
|
|
// after the OK button has been selected.
|
2018-03-12 22:45:17 +00:00
|
|
|
WX_TEXT_ENTRY_DIALOG dlg( this, _( "New Net Class Name:" ), wxEmptyString, class_name );
|
2009-07-18 16:06:48 +00:00
|
|
|
|
2010-07-20 10:30:40 +00:00
|
|
|
if( dlg.ShowModal() != wxID_OK )
|
2015-10-07 14:15:24 +00:00
|
|
|
return; // canceled by user
|
2010-07-20 10:30:40 +00:00
|
|
|
|
2010-09-02 13:10:48 +00:00
|
|
|
class_name = dlg.GetValue();
|
2010-07-21 08:15:54 +00:00
|
|
|
class_name.Trim( true );
|
|
|
|
class_name.Trim( false );
|
2014-09-19 23:58:32 +00:00
|
|
|
|
2010-07-20 10:30:40 +00:00
|
|
|
if( class_name.IsEmpty() )
|
|
|
|
return; // empty name not allowed
|
2009-07-18 11:44:19 +00:00
|
|
|
|
|
|
|
// The name must dot exists:
|
2009-09-10 15:22:26 +00:00
|
|
|
for( int ii = 0; ii < m_grid->GetNumberRows(); ii++ )
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
|
|
|
wxString value;
|
2009-09-10 15:22:26 +00:00
|
|
|
value = m_grid->GetRowLabelValue( ii );
|
2014-09-19 23:58:32 +00:00
|
|
|
|
2009-07-18 16:06:48 +00:00
|
|
|
if( class_name.CmpNoCase( value ) == 0 ) // Already exists!
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
2015-10-07 14:15:24 +00:00
|
|
|
DisplayError( this, _( "Duplicate net class names are not allowed." ) );
|
2009-07-18 11:44:19 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
m_grid->AppendRows();
|
2014-09-19 23:58:32 +00:00
|
|
|
m_grid->SetRowLabelValue( m_grid->GetNumberRows() - 1, class_name );
|
2009-07-18 16:06:48 +00:00
|
|
|
|
2009-10-21 19:16:25 +00:00
|
|
|
// Copy values of the default class:
|
2009-09-10 15:22:26 +00:00
|
|
|
int irow = m_grid->GetNumberRows() - 1;
|
2014-09-19 23:58:32 +00:00
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
for( int icol = 0; icol < m_grid->GetNumberCols(); icol++ )
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
|
|
|
wxString value;
|
2009-10-21 19:16:25 +00:00
|
|
|
value = m_grid->GetCellValue( 0, icol );
|
2009-09-10 15:22:26 +00:00
|
|
|
m_grid->SetCellValue( irow, icol, value );
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
2009-07-18 16:06:48 +00:00
|
|
|
|
2016-08-25 07:35:35 +00:00
|
|
|
EnsureGridRowTitleWidth( this, m_grid, m_initialRowLabelsSize );
|
|
|
|
|
2009-07-18 11:44:19 +00:00
|
|
|
InitializeRulesSelectionBoxes();
|
|
|
|
}
|
|
|
|
|
2010-09-02 13:10:48 +00:00
|
|
|
|
2009-10-21 19:16:25 +00:00
|
|
|
// Sort function for wxArrayInt. Items (ints) are sorted by decreasing value
|
2009-10-14 18:14:58 +00:00
|
|
|
// used in DIALOG_DESIGN_RULES::OnRemoveNetclassClick
|
2010-09-02 13:10:48 +00:00
|
|
|
int sort_int( int* first, int* second )
|
2009-10-14 18:14:58 +00:00
|
|
|
{
|
2010-09-02 13:10:48 +00:00
|
|
|
return *second - *first;
|
2009-10-14 18:14:58 +00:00
|
|
|
}
|
2010-09-02 13:10:48 +00:00
|
|
|
|
|
|
|
|
2009-07-18 11:44:19 +00:00
|
|
|
void DIALOG_DESIGN_RULES::OnRemoveNetclassClick( wxCommandEvent& event )
|
|
|
|
{
|
2009-09-10 15:22:26 +00:00
|
|
|
wxArrayInt select = m_grid->GetSelectedRows();
|
2010-09-02 13:10:48 +00:00
|
|
|
|
2009-10-14 18:14:58 +00:00
|
|
|
// Sort selection by decreasing index order:
|
2010-09-02 13:10:48 +00:00
|
|
|
select.Sort( sort_int );
|
2009-10-14 18:14:58 +00:00
|
|
|
bool reinit = false;
|
2010-09-02 13:10:48 +00:00
|
|
|
|
2009-10-14 18:30:51 +00:00
|
|
|
// rows labels are not removed when deleting rows: they are not deleted.
|
2013-03-04 16:04:53 +00:00
|
|
|
// So we must store them, remove corresponding labels and reinit them
|
2009-10-14 18:14:58 +00:00
|
|
|
wxArrayString labels;
|
2014-09-19 23:58:32 +00:00
|
|
|
|
2009-10-14 18:14:58 +00:00
|
|
|
for( int ii = 0; ii < m_grid->GetNumberRows(); ii++ )
|
2010-09-02 13:10:48 +00:00
|
|
|
labels.Add( m_grid->GetRowLabelValue( ii ) );
|
|
|
|
|
2009-10-14 18:14:58 +00:00
|
|
|
// Delete rows from last to first (this is the order wxArrayInt select after sorting) )
|
|
|
|
// This order is Ok when removing rows
|
|
|
|
for( unsigned ii = 0; ii < select.GetCount(); ii++ )
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
2009-09-28 16:14:45 +00:00
|
|
|
int grid_row = select[ii];
|
2014-09-19 23:58:32 +00:00
|
|
|
|
2014-05-13 09:22:51 +00:00
|
|
|
if( grid_row != 0 ) // Do not remove the default class
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
2009-09-28 16:14:45 +00:00
|
|
|
wxString classname = m_grid->GetRowLabelValue( grid_row );
|
|
|
|
m_grid->DeleteRows( grid_row );
|
2010-09-02 13:10:48 +00:00
|
|
|
labels.RemoveAt( grid_row ); // Remove corresponding row label
|
2009-10-14 18:14:58 +00:00
|
|
|
reinit = true;
|
2009-07-18 11:44:19 +00:00
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
// reset the net class to default for members of the removed class
|
|
|
|
swapNetClass( classname, NETCLASS::Default );
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
2009-10-14 18:14:58 +00:00
|
|
|
else
|
2015-10-07 14:15:24 +00:00
|
|
|
wxMessageBox( _( "The default net class cannot be removed" ) );
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
2010-09-02 13:10:48 +00:00
|
|
|
|
2009-10-14 18:14:58 +00:00
|
|
|
if( reinit )
|
|
|
|
{
|
2009-10-14 18:30:51 +00:00
|
|
|
// Reinit labels :
|
2009-10-14 18:14:58 +00:00
|
|
|
for( unsigned ii = 1; ii < labels.GetCount(); ii++ )
|
2010-09-02 13:10:48 +00:00
|
|
|
m_grid->SetRowLabelValue( ii, labels[ii] );
|
2009-07-18 16:06:48 +00:00
|
|
|
|
2009-10-14 18:14:58 +00:00
|
|
|
InitializeRulesSelectionBoxes();
|
2016-08-25 07:35:35 +00:00
|
|
|
EnsureGridRowTitleWidth( this, m_grid, m_initialRowLabelsSize );
|
2009-10-14 18:14:58 +00:00
|
|
|
}
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
|
|
|
|
2017-08-28 19:45:50 +00:00
|
|
|
void DIALOG_DESIGN_RULES::CheckAllowMicroVias()
|
|
|
|
{
|
|
|
|
bool enabled = m_OptAllowMicroVias->GetValue();
|
|
|
|
m_SetMicroViasMinSizeCtrl->Enable( enabled );
|
|
|
|
m_SetMicroViasMinDrillCtrl->Enable( enabled );
|
|
|
|
}
|
|
|
|
|
2016-11-30 07:47:25 +00:00
|
|
|
/**
|
|
|
|
* Function OnAllowMicroVias
|
|
|
|
* is called whenever the AllowMicroVias checkbox is toggled
|
|
|
|
*/
|
|
|
|
void DIALOG_DESIGN_RULES::OnAllowMicroVias( wxCommandEvent& event )
|
|
|
|
{
|
2017-08-28 19:45:50 +00:00
|
|
|
CheckAllowMicroVias();
|
2016-11-30 07:47:25 +00:00
|
|
|
}
|
2010-09-02 13:10:48 +00:00
|
|
|
|
2009-09-17 17:48:40 +00:00
|
|
|
void DIALOG_DESIGN_RULES::OnMoveUpSelectedNetClass( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
// Cannot move up rules if we have 1 or 2 rules only
|
|
|
|
if( m_grid->GetNumberRows() < 3 )
|
|
|
|
return;
|
|
|
|
|
2014-09-19 23:58:32 +00:00
|
|
|
wxArrayInt select = m_grid->GetSelectedRows();
|
2010-09-02 13:10:48 +00:00
|
|
|
bool reinit = false;
|
2014-09-19 23:58:32 +00:00
|
|
|
|
2009-09-17 17:48:40 +00:00
|
|
|
for( unsigned irow = 0; irow < select.GetCount(); irow++ )
|
|
|
|
{
|
|
|
|
int ii = select[irow];
|
2010-09-02 13:10:48 +00:00
|
|
|
if( ii < 2 ) // The default netclass *must* be the first netclass
|
2009-09-17 17:48:40 +00:00
|
|
|
continue; // so we cannot move up line 0 and 1
|
2014-09-19 23:58:32 +00:00
|
|
|
|
2009-09-17 17:48:40 +00:00
|
|
|
// Swap the rule and the previous rule
|
|
|
|
wxString curr_value, previous_value;
|
2014-09-19 23:58:32 +00:00
|
|
|
|
2009-09-17 17:48:40 +00:00
|
|
|
for( int icol = 0; icol < m_grid->GetNumberCols(); icol++ )
|
|
|
|
{
|
2010-09-02 13:10:48 +00:00
|
|
|
reinit = true;
|
|
|
|
curr_value = m_grid->GetCellValue( ii, icol );
|
|
|
|
previous_value = m_grid->GetCellValue( ii - 1, icol );
|
2009-09-17 17:48:40 +00:00
|
|
|
m_grid->SetCellValue( ii, icol, previous_value );
|
2010-09-02 13:10:48 +00:00
|
|
|
m_grid->SetCellValue( ii - 1, icol, curr_value );
|
2009-09-17 17:48:40 +00:00
|
|
|
}
|
2010-09-02 13:10:48 +00:00
|
|
|
|
|
|
|
curr_value = m_grid->GetRowLabelValue( ii );
|
|
|
|
previous_value = m_grid->GetRowLabelValue( ii - 1 );
|
|
|
|
m_grid->SetRowLabelValue( ii, previous_value );
|
|
|
|
m_grid->SetRowLabelValue( ii - 1, curr_value );
|
2009-09-17 17:48:40 +00:00
|
|
|
}
|
2009-09-29 04:53:02 +00:00
|
|
|
|
2009-09-17 17:48:40 +00:00
|
|
|
if( reinit )
|
|
|
|
InitializeRulesSelectionBoxes();
|
|
|
|
}
|
|
|
|
|
2009-07-18 16:06:48 +00:00
|
|
|
|
2009-07-18 11:44:19 +00:00
|
|
|
void DIALOG_DESIGN_RULES::OnLeftCBSelection( wxCommandEvent& event )
|
|
|
|
{
|
2009-09-10 15:22:26 +00:00
|
|
|
FillListBoxWithNetNames( m_leftListCtrl, m_leftClassChoice->GetStringSelection() );
|
2014-09-19 23:58:32 +00:00
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
if( m_leftClassChoice->GetStringSelection() == m_rightClassChoice->GetStringSelection() )
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
2009-07-18 16:06:48 +00:00
|
|
|
m_buttonRightToLeft->Enable( false );
|
|
|
|
m_buttonLeftToRight->Enable( false );
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-07-18 16:06:48 +00:00
|
|
|
m_buttonRightToLeft->Enable( true );
|
|
|
|
m_buttonLeftToRight->Enable( true );
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-18 16:06:48 +00:00
|
|
|
|
2009-07-18 11:44:19 +00:00
|
|
|
void DIALOG_DESIGN_RULES::OnRightCBSelection( wxCommandEvent& event )
|
|
|
|
{
|
2009-09-10 15:22:26 +00:00
|
|
|
FillListBoxWithNetNames( m_rightListCtrl, m_rightClassChoice->GetStringSelection() );
|
2014-09-19 23:58:32 +00:00
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
if( m_leftClassChoice->GetStringSelection() == m_rightClassChoice->GetStringSelection() )
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
2009-07-18 16:06:48 +00:00
|
|
|
m_buttonRightToLeft->Enable( false );
|
2015-01-17 08:01:16 +00:00
|
|
|
m_buttonLeftToRight->Enable( false );
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-07-18 16:06:48 +00:00
|
|
|
m_buttonRightToLeft->Enable( true );
|
|
|
|
m_buttonLeftToRight->Enable( true );
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-09-02 13:10:48 +00:00
|
|
|
void DIALOG_DESIGN_RULES::moveSelectedItems( NETS_LIST_CTRL* src, const wxString& newClassName )
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
2010-09-02 13:10:48 +00:00
|
|
|
wxListItem item;
|
|
|
|
wxString netName;
|
|
|
|
|
|
|
|
item.m_mask |= wxLIST_MASK_TEXT; // Validate the member m_text of the wxListItem item
|
2009-09-10 15:22:26 +00:00
|
|
|
|
2009-09-10 17:28:38 +00:00
|
|
|
for( int row = 0; row < src->GetItemCount(); ++row )
|
2009-07-18 11:44:19 +00:00
|
|
|
{
|
2009-09-10 17:28:38 +00:00
|
|
|
if( !src->GetItemState( row, wxLIST_STATE_SELECTED ) )
|
2009-07-18 11:44:19 +00:00
|
|
|
continue;
|
|
|
|
|
2009-09-10 17:28:38 +00:00
|
|
|
item.SetColumn( 0 );
|
|
|
|
item.SetId( row );
|
|
|
|
|
|
|
|
src->GetItem( item );
|
|
|
|
netName = item.GetText();
|
2009-09-10 15:22:26 +00:00
|
|
|
|
|
|
|
setNetClass( netName, newClassName == wildCard ? NETCLASS::Default : newClassName );
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
2009-09-10 17:28:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_DESIGN_RULES::OnRightToLeftCopyButton( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
wxString newClassName = m_leftClassChoice->GetStringSelection();
|
|
|
|
|
|
|
|
moveSelectedItems( m_rightListCtrl, newClassName );
|
2009-07-18 11:44:19 +00:00
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
FillListBoxWithNetNames( m_leftListCtrl, m_leftClassChoice->GetStringSelection() );
|
|
|
|
FillListBoxWithNetNames( m_rightListCtrl, m_rightClassChoice->GetStringSelection() );
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
|
|
|
|
2010-09-02 13:10:48 +00:00
|
|
|
|
2009-07-18 11:44:19 +00:00
|
|
|
void DIALOG_DESIGN_RULES::OnLeftToRightCopyButton( wxCommandEvent& event )
|
|
|
|
{
|
2009-09-10 17:28:38 +00:00
|
|
|
wxString newClassName = m_rightClassChoice->GetStringSelection();
|
|
|
|
|
|
|
|
moveSelectedItems( m_leftListCtrl, newClassName );
|
2009-07-18 16:06:48 +00:00
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
FillListBoxWithNetNames( m_leftListCtrl, m_leftClassChoice->GetStringSelection() );
|
|
|
|
FillListBoxWithNetNames( m_rightListCtrl, m_rightClassChoice->GetStringSelection() );
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
|
|
|
|
2009-07-18 16:06:48 +00:00
|
|
|
|
2009-07-18 11:44:19 +00:00
|
|
|
void DIALOG_DESIGN_RULES::OnLeftSelectAllButton( wxCommandEvent& event )
|
|
|
|
{
|
2009-09-10 15:22:26 +00:00
|
|
|
for( int ii = 0; ii < m_leftListCtrl->GetItemCount(); ii++ )
|
|
|
|
m_leftListCtrl->SetItemState( ii, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
|
|
|
|
2009-07-18 16:06:48 +00:00
|
|
|
|
2009-07-18 11:44:19 +00:00
|
|
|
void DIALOG_DESIGN_RULES::OnRightSelectAllButton( wxCommandEvent& event )
|
|
|
|
{
|
2009-09-10 15:22:26 +00:00
|
|
|
for( int ii = 0; ii < m_rightListCtrl->GetItemCount(); ii++ )
|
|
|
|
m_rightListCtrl->SetItemState( ii, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_DESIGN_RULES::setNetClass( const wxString& aNetName, const wxString& aClassName )
|
|
|
|
{
|
|
|
|
for( NETCUPS::iterator i = m_AllNets.begin(); i != m_AllNets.end(); ++i )
|
|
|
|
{
|
|
|
|
if( i->net == aNetName )
|
|
|
|
{
|
|
|
|
i->clazz = aClassName;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2009-07-18 11:44:19 +00:00
|
|
|
}
|
|
|
|
|
2009-07-18 16:06:48 +00:00
|
|
|
|
2015-10-02 19:11:33 +00:00
|
|
|
bool DIALOG_DESIGN_RULES::TestDataValidity( wxString* aErrorMsg )
|
2009-07-18 16:06:48 +00:00
|
|
|
{
|
2015-10-02 19:11:33 +00:00
|
|
|
bool result = true;
|
2009-07-18 16:06:48 +00:00
|
|
|
|
2010-09-02 13:10:48 +00:00
|
|
|
wxString msg;
|
2015-10-02 19:11:33 +00:00
|
|
|
wxString errorMsg;
|
2009-07-18 16:06:48 +00:00
|
|
|
|
2016-11-30 07:47:25 +00:00
|
|
|
wxString netclassLabel; // Name of a given netclass
|
|
|
|
wxString netclassError; // Error message particular to a given netclass
|
|
|
|
|
2017-01-09 13:19:02 +00:00
|
|
|
wxString units = ReturnUnitSymbol( g_UserUnit, "%s" );
|
2016-11-30 07:47:25 +00:00
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
int minViaDia = ValueFromTextCtrl( *m_SetViasMinSizeCtrl );
|
|
|
|
int minViaDrill = ValueFromTextCtrl( *m_SetViasMinDrillCtrl );
|
|
|
|
int minUViaDia = ValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl );
|
|
|
|
int minUViaDrill = ValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl );
|
|
|
|
int minTrackWidth = ValueFromTextCtrl( *m_SetTrackMinWidthCtrl );
|
2012-05-24 06:51:52 +00:00
|
|
|
int maxval = 1000 * IU_PER_MILS; // a max value for tracks and vias sizes (1 inch)
|
|
|
|
|
2015-10-02 19:11:33 +00:00
|
|
|
// @todo Change this code to set the focus to the control where the first error occurs
|
|
|
|
// so the user doesn't have to figure out where the issue is.
|
2009-10-21 19:16:25 +00:00
|
|
|
|
2015-10-02 19:11:33 +00:00
|
|
|
// Test net class parameters.
|
2009-09-10 15:22:26 +00:00
|
|
|
for( int row = 0; row < m_grid->GetNumberRows(); row++ )
|
2009-07-18 16:06:48 +00:00
|
|
|
{
|
2016-11-30 07:47:25 +00:00
|
|
|
netclassLabel = GetChars( m_grid->GetRowLabelValue( row ) );
|
2017-01-09 13:19:02 +00:00
|
|
|
netclassError.Clear(); // Clear the error for this netclass
|
2016-11-30 07:47:25 +00:00
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
int tracksize = ValueFromString( g_UserUnit,
|
2014-09-19 23:58:32 +00:00
|
|
|
m_grid->GetCellValue( row, GRID_TRACKSIZE ) );
|
2009-10-21 19:16:25 +00:00
|
|
|
if( tracksize < minTrackWidth )
|
2009-09-28 16:14:45 +00:00
|
|
|
{
|
|
|
|
result = false;
|
2016-11-30 07:47:25 +00:00
|
|
|
msg.Printf( _( " - <b>Track Size</b> (%f %s) < <b>Min Track Size</b> (%f %s)<br>" ),
|
|
|
|
To_User_Unit( g_UserUnit, tracksize ), units,
|
|
|
|
To_User_Unit( g_UserUnit, minTrackWidth ), units );
|
|
|
|
|
|
|
|
netclassError += msg;
|
2009-09-28 16:14:45 +00:00
|
|
|
}
|
2009-09-29 04:53:02 +00:00
|
|
|
|
2016-08-15 15:16:49 +00:00
|
|
|
int dpsize = ValueFromString( g_UserUnit,
|
|
|
|
m_grid->GetCellValue( row, GRID_DIFF_PAIR_WIDTH ) );
|
|
|
|
|
|
|
|
if( dpsize < minTrackWidth )
|
|
|
|
{
|
|
|
|
result = false;
|
2016-11-30 07:47:25 +00:00
|
|
|
msg.Printf( _( " - <b>Differential Pair Size</b> (%f %s) < <b>Min Track Size</b> (%f %s)<br>" ),
|
|
|
|
To_User_Unit( g_UserUnit, dpsize ), units,
|
|
|
|
To_User_Unit( g_UserUnit, minTrackWidth ), units );
|
|
|
|
netclassError += msg;
|
2016-08-15 15:16:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-28 16:14:45 +00:00
|
|
|
// Test vias
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
int viadia = ValueFromString( g_UserUnit,
|
2014-09-19 23:58:32 +00:00
|
|
|
m_grid->GetCellValue( row, GRID_VIASIZE ) );
|
2009-07-18 16:06:48 +00:00
|
|
|
|
2009-10-26 19:00:46 +00:00
|
|
|
if( viadia < minViaDia )
|
2009-09-28 16:14:45 +00:00
|
|
|
{
|
|
|
|
result = false;
|
2016-11-30 07:47:25 +00:00
|
|
|
msg.Printf( _( " - <b>Via Diameter</b> (%f %s) < <b>Minimum Via Diameter</b> (%f %s)<br>" ),
|
|
|
|
To_User_Unit( g_UserUnit, viadia ), units,
|
|
|
|
To_User_Unit( g_UserUnit, minViaDia ), units );
|
|
|
|
netclassError += msg;
|
2009-09-28 16:14:45 +00:00
|
|
|
}
|
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
int viadrill = ValueFromString( g_UserUnit,
|
2014-09-19 23:58:32 +00:00
|
|
|
m_grid->GetCellValue( row, GRID_VIADRILL ) );
|
|
|
|
|
2009-10-21 19:16:25 +00:00
|
|
|
if( viadrill >= viadia )
|
2009-07-18 16:06:48 +00:00
|
|
|
{
|
2009-09-10 15:22:26 +00:00
|
|
|
result = false;
|
2016-11-30 07:47:25 +00:00
|
|
|
msg.Printf( _( " - <b>Via Drill</b> (%f %s) ≥ <b>Via Dia</b> (%f %s)<br>" ),
|
|
|
|
To_User_Unit( g_UserUnit, viadrill ), units,
|
|
|
|
To_User_Unit( g_UserUnit, viadia ), units );
|
|
|
|
netclassError += msg;
|
2009-07-18 16:06:48 +00:00
|
|
|
}
|
2009-09-28 16:14:45 +00:00
|
|
|
|
2009-10-21 19:16:25 +00:00
|
|
|
if( viadrill < minViaDrill )
|
|
|
|
{
|
|
|
|
result = false;
|
2016-11-30 07:47:25 +00:00
|
|
|
msg.Printf( _( " - <b>Via Drill</b> (%f %s) < <b>Min Via Drill</b> (%f %s)<br>" ),
|
|
|
|
To_User_Unit( g_UserUnit, viadrill ), units,
|
|
|
|
To_User_Unit( g_UserUnit, minViaDrill ), units );
|
|
|
|
netclassError += msg;
|
2009-10-21 19:16:25 +00:00
|
|
|
}
|
|
|
|
|
2009-09-28 16:14:45 +00:00
|
|
|
// Test Micro vias
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
int muviadia = ValueFromString( g_UserUnit,
|
2014-09-19 23:58:32 +00:00
|
|
|
m_grid->GetCellValue( row, GRID_uVIASIZE ) );
|
2009-09-28 16:14:45 +00:00
|
|
|
|
2009-10-26 19:00:46 +00:00
|
|
|
if( muviadia < minUViaDia )
|
2009-09-28 16:14:45 +00:00
|
|
|
{
|
|
|
|
result = false;
|
2016-11-30 07:47:25 +00:00
|
|
|
msg.Printf( _( " - <b>MicroVia Diameter</b> (%f %s) < <b>MicroVia Min Diameter</b> (%f %s)<br>" ),
|
|
|
|
To_User_Unit( g_UserUnit, muviadia ), units,
|
|
|
|
To_User_Unit( g_UserUnit, minUViaDia ), units );
|
|
|
|
netclassError += msg;
|
2009-09-28 16:14:45 +00:00
|
|
|
}
|
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
int muviadrill = ValueFromString( g_UserUnit,
|
2014-09-19 23:58:32 +00:00
|
|
|
m_grid->GetCellValue( row, GRID_uVIADRILL ) );
|
|
|
|
|
2009-10-21 19:16:25 +00:00
|
|
|
if( muviadrill >= muviadia )
|
2009-09-28 16:14:45 +00:00
|
|
|
{
|
|
|
|
result = false;
|
2016-11-30 07:47:25 +00:00
|
|
|
msg.Printf( _( " - <b>MicroVia Drill</b> (%f %s) ≥ <b>MicroVia Dia</b> (%f %s)<br>" ),
|
|
|
|
To_User_Unit( g_UserUnit, muviadrill ), units,
|
|
|
|
To_User_Unit( g_UserUnit, muviadia ), units );
|
|
|
|
netclassError += msg;
|
2009-09-28 16:14:45 +00:00
|
|
|
}
|
2009-10-21 19:16:25 +00:00
|
|
|
|
|
|
|
if( muviadrill < minUViaDrill )
|
|
|
|
{
|
|
|
|
result = false;
|
2016-11-30 07:47:25 +00:00
|
|
|
msg.Printf( _( " - <b>MicroVia Drill</b> (%f %s) < <b>MicroVia Min Drill</b> (%f %s)<br>" ),
|
|
|
|
To_User_Unit( g_UserUnit, muviadrill ), units,
|
|
|
|
To_User_Unit( g_UserUnit, minUViaDrill ), units );
|
|
|
|
netclassError += msg;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If this netclass contains errors, add it to the error message
|
|
|
|
if ( !netclassError.IsEmpty() )
|
|
|
|
{
|
|
|
|
msg.Printf( _( "Netclass: <b>%s</b><br>" ), netclassLabel );
|
2015-10-02 19:11:33 +00:00
|
|
|
errorMsg += msg;
|
2016-11-30 07:47:25 +00:00
|
|
|
errorMsg += netclassError;
|
2017-01-09 13:19:02 +00:00
|
|
|
errorMsg += "<br>";
|
2009-10-21 19:16:25 +00:00
|
|
|
}
|
2009-07-18 16:06:48 +00:00
|
|
|
}
|
|
|
|
|
2015-10-02 19:11:33 +00:00
|
|
|
// Test custom tracks
|
2011-01-16 12:49:58 +00:00
|
|
|
for( int row = 0; row < m_gridTrackWidthList->GetNumberRows(); ++row )
|
2009-10-26 19:00:46 +00:00
|
|
|
{
|
2010-09-02 13:10:48 +00:00
|
|
|
wxString tvalue = m_gridTrackWidthList->GetCellValue( row, 0 );
|
2014-09-19 23:58:32 +00:00
|
|
|
|
2009-10-26 19:00:46 +00:00
|
|
|
if( tvalue.IsEmpty() )
|
|
|
|
continue;
|
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
int tracksize = ValueFromString( g_UserUnit, tvalue );
|
2012-04-16 17:39:32 +00:00
|
|
|
|
2009-10-26 19:00:46 +00:00
|
|
|
if( tracksize < minTrackWidth )
|
|
|
|
{
|
|
|
|
result = false;
|
|
|
|
msg.Printf( _( "<b>Extra Track %d Size</b> %s < <b>Min Track Size</b><br>" ),
|
2012-04-16 17:39:32 +00:00
|
|
|
row + 1, GetChars( tvalue ) );
|
2009-10-26 19:00:46 +00:00
|
|
|
|
2015-10-02 19:11:33 +00:00
|
|
|
errorMsg += msg;
|
2009-10-26 19:00:46 +00:00
|
|
|
}
|
2014-09-19 23:58:32 +00:00
|
|
|
|
2012-05-23 14:25:15 +00:00
|
|
|
if( tracksize > maxval )
|
2009-10-26 19:00:46 +00:00
|
|
|
{
|
|
|
|
result = false;
|
2009-10-27 04:00:23 +00:00
|
|
|
msg.Printf( _( "<b>Extra Track %d Size</b> %s > <b>1 inch!</b><br>" ),
|
2014-09-19 23:58:32 +00:00
|
|
|
row + 1, GetChars( tvalue ) );
|
2009-10-26 19:00:46 +00:00
|
|
|
|
2015-10-02 19:11:33 +00:00
|
|
|
errorMsg += msg;
|
2009-10-26 19:00:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-02 19:11:33 +00:00
|
|
|
// Test custom vias
|
2011-01-16 12:49:58 +00:00
|
|
|
for( int row = 0; row < m_gridViaSizeList->GetNumberRows(); ++row )
|
2009-10-26 19:00:46 +00:00
|
|
|
{
|
2010-09-02 13:10:48 +00:00
|
|
|
wxString tvalue = m_gridViaSizeList->GetCellValue( row, 0 );
|
2014-09-19 23:58:32 +00:00
|
|
|
|
2009-10-26 19:00:46 +00:00
|
|
|
if( tvalue.IsEmpty() )
|
|
|
|
continue;
|
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
int viadia = ValueFromString( g_UserUnit, tvalue );
|
2012-04-16 17:39:32 +00:00
|
|
|
|
2009-10-26 19:00:46 +00:00
|
|
|
if( viadia < minViaDia )
|
|
|
|
{
|
|
|
|
result = false;
|
|
|
|
msg.Printf( _( "<b>Extra Via %d Size</b> %s < <b>Min Via Size</b><br>" ),
|
2012-04-16 17:39:32 +00:00
|
|
|
row + 1, GetChars( tvalue ) );
|
2015-10-02 19:11:33 +00:00
|
|
|
errorMsg += msg;
|
|
|
|
}
|
|
|
|
|
|
|
|
wxString drlvalue = m_gridViaSizeList->GetCellValue( row, 1 );
|
2009-10-26 19:00:46 +00:00
|
|
|
|
2015-10-02 19:11:33 +00:00
|
|
|
if( drlvalue.IsEmpty() )
|
|
|
|
{
|
|
|
|
result = false;
|
|
|
|
msg.Printf( _( "<b>No via drill size define in row %d</b><br>" ), row + 1 );
|
|
|
|
errorMsg += msg;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
int viadrill = ValueFromString( g_UserUnit, drlvalue );
|
|
|
|
|
|
|
|
if( viadrill < minViaDrill )
|
|
|
|
{
|
|
|
|
result = false;
|
|
|
|
msg.Printf( _( "<b>Extra Via %d Drill</b> %s < <b>Min Via Drill %s</b><br>" ),
|
|
|
|
row + 1, GetChars( drlvalue ),
|
|
|
|
GetChars( m_SetViasMinDrillCtrl->GetValue() ) );
|
|
|
|
errorMsg += msg;
|
2009-10-26 19:00:46 +00:00
|
|
|
}
|
2011-01-16 12:49:58 +00:00
|
|
|
|
2011-01-25 14:06:17 +00:00
|
|
|
if( viadia <= viadrill )
|
2011-01-16 12:49:58 +00:00
|
|
|
{
|
|
|
|
result = false;
|
2011-01-25 14:06:17 +00:00
|
|
|
msg.Printf( _( "<b>Extra Via %d Size</b> %s ≤ <b> Drill Size</b> %s<br>" ),
|
2012-04-16 17:39:32 +00:00
|
|
|
row + 1, GetChars( tvalue ), GetChars( drlvalue ) );
|
2015-10-02 19:11:33 +00:00
|
|
|
errorMsg += msg;
|
2011-01-16 12:49:58 +00:00
|
|
|
}
|
|
|
|
|
2013-03-04 16:04:53 +00:00
|
|
|
// Test for a reasonable via size:
|
2012-05-23 14:25:15 +00:00
|
|
|
if( viadia > maxval ) // 1 inch!
|
2009-10-26 19:00:46 +00:00
|
|
|
{
|
|
|
|
result = false;
|
|
|
|
msg.Printf( _( "<b>Extra Via %d Size</b>%s > <b>1 inch!</b><br>" ),
|
2012-04-16 17:39:32 +00:00
|
|
|
row + 1, GetChars( tvalue ) );
|
2015-10-02 19:11:33 +00:00
|
|
|
errorMsg += msg;
|
2009-10-26 19:00:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-02 19:11:33 +00:00
|
|
|
if( !result && aErrorMsg )
|
|
|
|
*aErrorMsg = errorMsg;
|
|
|
|
|
2009-09-10 15:22:26 +00:00
|
|
|
return result;
|
2009-07-18 16:06:48 +00:00
|
|
|
}
|
2018-01-07 02:42:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|