Allow hatch pattern in filled zones

the filled areas can use a hatch pattern (crossing lines) using square holes.
The zone filler removes too small holes (truncated holes) from hatch pattern.
It avoid to create small holes when a hole pattern is truncated by the filled area base shape.
This commit is contained in:
jean-pierre charras 2018-02-18 10:09:13 +01:00
parent b00413b7d6
commit 7170720f3c
18 changed files with 4628 additions and 3030 deletions

View File

@ -95,6 +95,11 @@ gr_line
gr_poly gr_poly
gr_text gr_text
hatch hatch
hatch_thickness
hatch_gap
hatch_orientation
hatch_smoothing_level
hatch_smoothing_value
hide hide
italic italic
justify justify

View File

@ -58,6 +58,12 @@ ZONE_CONTAINER::ZONE_CONTAINER( BOARD* aBoard ) :
m_hatchStyle = DIAGONAL_EDGE; m_hatchStyle = DIAGONAL_EDGE;
m_hatchPitch = GetDefaultHatchPitch(); m_hatchPitch = GetDefaultHatchPitch();
m_hv45 = false; m_hv45 = false;
m_HatchFillTypeThickness = 0;
m_HatchFillTypeGap = 0;
m_HatchFillTypeOrientation = 0.0;
m_HatchFillTypeSmoothingLevel = 0; // Grid pattern smoothing type. 0 = no smoothing
m_HatchFillTypeSmoothingValue = 0.1; // Grid pattern chamfer value relative to the gap value
// used only if m_HatchFillTypeSmoothingLevel > 0
m_priority = 0; m_priority = 0;
m_cornerSmoothingType = ZONE_SETTINGS::SMOOTHING_NONE; m_cornerSmoothingType = ZONE_SETTINGS::SMOOTHING_NONE;
SetIsKeepout( false ); SetIsKeepout( false );
@ -495,12 +501,12 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel,
} }
// Draw areas: // Draw areas:
if( m_FillMode == ZFM_POLYGONS && !outline_mode ) if( m_FillMode != ZFM_SEGMENTS && !outline_mode )
GRPoly( panel->GetClipBox(), DC, CornersBuffer.size(), &CornersBuffer[0], GRPoly( panel->GetClipBox(), DC, CornersBuffer.size(), &CornersBuffer[0],
true, 0, color, color ); true, 0, color, color );
} }
if( m_FillMode == 1 && !outline_mode ) // filled with segments if( m_FillMode == ZFM_SEGMENTS && !outline_mode ) // filled with segments
{ {
for( unsigned ic = 0; ic < m_FillSegmList.size(); ic++ ) for( unsigned ic = 0; ic < m_FillSegmList.size(); ic++ )
{ {
@ -871,12 +877,19 @@ void ZONE_CONTAINER::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), BROWN ) );
msg.Printf( wxT( "%d" ), (int) m_Poly->TotalVertices() ); msg.Printf( wxT( "%d" ), (int) m_Poly->TotalVertices() );
aList.push_back( MSG_PANEL_ITEM( _( "Corners" ), msg, BLUE ) ); aList.push_back( MSG_PANEL_ITEM( _( "Vertices" ), msg, BLUE ) );
if( m_FillMode ) switch( m_FillMode )
msg = _( "Segments" ); {
else case ZFM_POLYGONS:
msg = _( "Polygons" ); msg = _( "Polygons" ); break;
case ZFM_HATCH_PATTERN:
msg = _( "Hatch Fill" ); break;
case ZFM_SEGMENTS: // Deprecated: found in old boards
msg = _( "Segments" ); break;
default:
msg = _( "Unknown" ); break;
}
aList.push_back( MSG_PANEL_ITEM( _( "Fill Mode" ), msg, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Fill Mode" ), msg, BROWN ) );

View File

@ -1,8 +1,8 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -206,6 +206,21 @@ public:
m_ZoneMinThickness = aMinThickness; m_ZoneMinThickness = aMinThickness;
} }
int GetHatchFillTypeThickness() const { return m_HatchFillTypeThickness; }
void SetHatchFillTypeThickness( int aThickness ) { m_HatchFillTypeThickness = aThickness; }
int GetHatchFillTypeGap() const { return m_HatchFillTypeGap; }
void SetHatchFillTypeGap( int aStep ) { m_HatchFillTypeGap = aStep; }
double GetHatchFillTypeOrientation() const { return m_HatchFillTypeOrientation; }
void SetHatchFillTypeOrientation( double aStep ) { m_HatchFillTypeOrientation = aStep; }
int GetHatchFillTypeSmoothingLevel() const { return m_HatchFillTypeSmoothingLevel; }
void SetHatchFillTypeSmoothingLevel( int aLevel ) { m_HatchFillTypeSmoothingLevel = aLevel; }
double GetHatchFillTypeSmoothingValue() const { return m_HatchFillTypeSmoothingValue; }
void SetHatchFillTypeSmoothingValue( double aValue ) { m_HatchFillTypeSmoothingValue = aValue; }
int GetSelectedCorner() const int GetSelectedCorner() const
{ {
// Transform relative indices to global index // Transform relative indices to global index
@ -765,9 +780,30 @@ private:
int m_ThermalReliefCopperBridge; int m_ThermalReliefCopperBridge;
/// How to fill areas: ZFM_POLYGONS => use filled polygons, ZFM_SEGMENTS => fill with segments. /** How to fill areas:
* ZFM_POLYGONS => use solid polygons
* ZFM_SEGMENTS => fill by segments (deprecated).
* ZFM_HATCH_PATTERN => use a grid pattern as shape
*/
ZONE_FILL_MODE m_FillMode; ZONE_FILL_MODE m_FillMode;
/// Grid style shape: thickness of lines (if 0 -> solid shape)
int m_HatchFillTypeThickness;
/// Grid style shape: dist between center of lines (grid size) (0 -> solid shape)
int m_HatchFillTypeGap;
/// Grid style shape: orientation in degrees of the grid lines
double m_HatchFillTypeOrientation;
/// Grid pattern smoothing type, similar to corner smoothing type
///< 0 = no smoothing, 1 = fillet, >= 2 = arc
int m_HatchFillTypeSmoothingLevel;
/// Grid pattern smoothing value for smoothing shape size calculations
/// this is the ratio between the gap and the chamfer size
double m_HatchFillTypeSmoothingValue;
/// The index of the corner being moved or nullptr if no corner is selected. /// The index of the corner being moved or nullptr if no corner is selected.
SHAPE_POLY_SET::VERTEX_INDEX* m_CornerSelection; SHAPE_POLY_SET::VERTEX_INDEX* m_CornerSelection;

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2017 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr * Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
* *
@ -62,6 +62,10 @@ private:
UNIT_BINDER m_antipadClearance ; UNIT_BINDER m_antipadClearance ;
UNIT_BINDER m_spokeWidth; UNIT_BINDER m_spokeWidth;
UNIT_BINDER m_gridStyleRotation;
UNIT_BINDER m_gridStyleThickness;
UNIT_BINDER m_gridStyleGap;
bool TransferDataToWindow() override; bool TransferDataToWindow() override;
bool TransferDataFromWindow() override; bool TransferDataFromWindow() override;
@ -72,6 +76,7 @@ private:
*/ */
bool AcceptOptions( bool aUseExportableSetupOnly = false ); bool AcceptOptions( bool aUseExportableSetupOnly = false );
void OnStyleSelection( wxCommandEvent& event ) override;
void OnLayerSelection( wxDataViewEvent& event ) override; void OnLayerSelection( wxDataViewEvent& event ) override;
void OnNetSortingOptionSelected( wxCommandEvent& event ) override; void OnNetSortingOptionSelected( wxCommandEvent& event ) override;
void ExportSetupToOtherCopperZones( wxCommandEvent& event ) override; void ExportSetupToOtherCopperZones( wxCommandEvent& event ) override;
@ -95,6 +100,7 @@ int InvokeCopperZonesEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSettings )
return dlg.ShowModal(); return dlg.ShowModal();
} }
#define MIN_THICKNESS ZONE_THICKNESS_MIN_VALUE_MIL*IU_PER_MILS
DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* aSettings ) : DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* aSettings ) :
DIALOG_COPPER_ZONE_BASE( aParent ), DIALOG_COPPER_ZONE_BASE( aParent ),
@ -103,7 +109,12 @@ DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS*
m_clearance( aParent, m_clearanceLabel, m_clearanceCtrl, m_clearanceUnits, true ), m_clearance( aParent, m_clearanceLabel, m_clearanceCtrl, m_clearanceUnits, true ),
m_minWidth( aParent, m_minWidthLabel, m_minWidthCtrl, m_minWidthUnits, true ), m_minWidth( aParent, m_minWidthLabel, m_minWidthCtrl, m_minWidthUnits, true ),
m_antipadClearance( aParent, m_antipadLabel, m_antipadCtrl, m_antipadUnits, true ), m_antipadClearance( aParent, m_antipadLabel, m_antipadCtrl, m_antipadUnits, true ),
m_spokeWidth( aParent, m_spokeWidthLabel, m_spokeWidthCtrl, m_spokeWidthUnits, true ) m_spokeWidth( aParent, m_spokeWidthLabel, m_spokeWidthCtrl, m_spokeWidthUnits, true ),
m_gridStyleRotation( aParent, m_staticTextGrindOrient, m_tcGridStyleOrientation, m_staticTextRotUnits,
false ),
m_gridStyleThickness( aParent, m_staticTextStyleThickness,
m_tcGridStyleThickness, m_GridStyleThicknessUnits, false ),
m_gridStyleGap( aParent, m_staticTextGridGap, m_tcGridStyleGap, m_GridStyleGapUnits, false )
{ {
m_Parent = aParent; m_Parent = aParent;
m_Config = Kiface().KifaceSettings(); m_Config = Kiface().KifaceSettings();
@ -177,6 +188,44 @@ bool DIALOG_COPPER_ZONE::TransferDataToWindow()
SetInitialFocus( m_ListNetNameSelection ); SetInitialFocus( m_ListNetNameSelection );
switch( m_settings.m_FillMode )
{
case ZFM_HATCH_PATTERN:
m_GridStyleCtrl->SetSelection( 1 ); break;
default:
m_GridStyleCtrl->SetSelection( 0 ); break;
}
m_gridStyleRotation.SetUnits( DEGREES );
m_gridStyleRotation.SetValue( m_settings.m_HatchFillTypeOrientation*10 ); // IU is decidegree
// Gives a reasonable value to grid style parameters, if currently there are no defined
// parameters for grid pattern thickness and gap (if the value is 0)
// the grid pattern thickness default value is (arbitrary) m_ZoneMinThickness * 4
// or 1mm
// the grid pattern gap default value is (arbitrary) m_ZoneMinThickness * 6
// or 1.5 mm
int bestvalue = m_settings.m_HatchFillTypeThickness;
if( bestvalue <= 0 ) // No defined value for m_HatchFillTypeThickness
bestvalue = std::max( m_settings.m_ZoneMinThickness * 4, Millimeter2iu( 1.0 ) );
m_gridStyleThickness.SetValue( std::max( bestvalue, m_settings.m_ZoneMinThickness ) );
bestvalue = m_settings.m_HatchFillTypeGap;
if( bestvalue <= 0 ) // No defined value for m_HatchFillTypeGap
bestvalue = std::max( m_settings.m_ZoneMinThickness * 6, Millimeter2iu( 1.5 ) );
m_gridStyleGap.SetValue( std::max( bestvalue, m_settings.m_ZoneMinThickness ) );
m_spinCtrlSmoothLevel->SetValue( m_settings.m_HatchFillTypeSmoothingLevel );
m_spinCtrlSmoothValue->SetValue( m_settings.m_HatchFillTypeSmoothingValue );
// Enable/Disable some widgets
wxCommandEvent event;
OnStyleSelection( event );
return true; return true;
} }
@ -212,9 +261,20 @@ bool DIALOG_COPPER_ZONE::TransferDataFromWindow()
{ {
m_netNameShowFilter = m_ShowNetNameFilter->GetValue(); m_netNameShowFilter = m_ShowNetNameFilter->GetValue();
if( m_GridStyleCtrl->GetSelection() > 0 )
m_settings.m_FillMode = ZFM_HATCH_PATTERN;
else
m_settings.m_FillMode = ZFM_POLYGONS;
if( !AcceptOptions() ) if( !AcceptOptions() )
return false; return false;
m_settings.m_HatchFillTypeOrientation = m_gridStyleRotation.GetValue()/10.0; // value is returned in deci-degree
m_settings.m_HatchFillTypeThickness = m_gridStyleThickness.GetValue();
m_settings.m_HatchFillTypeGap = m_gridStyleGap.GetValue();
m_settings.m_HatchFillTypeSmoothingLevel = m_spinCtrlSmoothLevel->GetValue();
m_settings.m_HatchFillTypeSmoothingValue = m_spinCtrlSmoothValue->GetValue();
*m_ptr = m_settings; *m_ptr = m_settings;
return true; return true;
} }
@ -230,22 +290,28 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aUseExportableSetupOnly )
{ {
if( !m_clearance.Validate( 0, Mils2iu( ZONE_CLEARANCE_MAX_VALUE_MIL ) ) ) if( !m_clearance.Validate( 0, Mils2iu( ZONE_CLEARANCE_MAX_VALUE_MIL ) ) )
return false; return false;
if( !m_minWidth.Validate( Mils2iu( ZONE_THICKNESS_MIN_VALUE_MIL ), INT_MAX ) ) if( !m_minWidth.Validate( Mils2iu( ZONE_THICKNESS_MIN_VALUE_MIL ), INT_MAX ) )
return false; return false;
if( !m_cornerRadius.Validate( 0, INT_MAX ) ) if( !m_cornerRadius.Validate( 0, INT_MAX ) )
return false; return false;
if( !m_spokeWidth.Validate( 0, INT_MAX ) ) if( !m_spokeWidth.Validate( 0, INT_MAX ) )
return false; return false;
if( m_settings.m_FillMode == ZFM_SEGMENTS ) if( !m_gridStyleRotation.Validate( -1800, 1800 ) )
{ return false;
KIDIALOG dlg( this, _( "The legacy segment fill mode is not recommended."
"Convert zone to polygon fill? "), _( "Legacy Warning" ),
wxYES_NO | wxICON_WARNING );
dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
if( dlg.ShowModal() == wxYES ) if( m_settings.m_FillMode == ZFM_HATCH_PATTERN )
m_settings.m_FillMode = ZFM_POLYGONS; {
int minThickness = m_minWidth.GetValue();
if( !m_gridStyleThickness.Validate( minThickness, INT_MAX ) )
return false;
if( !m_gridStyleGap.Validate( minThickness, INT_MAX ) )
return false;
} }
switch( m_PadInZoneOpt->GetSelection() ) switch( m_PadInZoneOpt->GetSelection() )
@ -273,7 +339,6 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aUseExportableSetupOnly )
m_netNameShowFilter = m_ShowNetNameFilter->GetValue(); m_netNameShowFilter = m_ShowNetNameFilter->GetValue();
m_settings.m_ZoneClearance = m_clearance.GetValue(); m_settings.m_ZoneClearance = m_clearance.GetValue();
m_settings.m_ZoneMinThickness = m_minWidth.GetValue(); m_settings.m_ZoneMinThickness = m_minWidth.GetValue();
m_settings.SetCornerSmoothingType( m_cornerSmoothingChoice->GetSelection() ); m_settings.SetCornerSmoothingType( m_cornerSmoothingChoice->GetSelection() );
@ -338,6 +403,17 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aUseExportableSetupOnly )
} }
void DIALOG_COPPER_ZONE::OnStyleSelection( wxCommandEvent& event )
{
bool enable = m_GridStyleCtrl->GetSelection() >= 1;
m_tcGridStyleThickness->Enable( enable );
m_tcGridStyleGap->Enable( enable );
m_tcGridStyleOrientation->Enable( enable );
m_spinCtrlSmoothLevel->Enable( enable );
m_spinCtrlSmoothValue->Enable( enable );
}
void DIALOG_COPPER_ZONE::OnLayerSelection( wxDataViewEvent& event ) void DIALOG_COPPER_ZONE::OnLayerSelection( wxDataViewEvent& event )
{ {
if( event.GetColumn() != 0 ) if( event.GetColumn() != 0 )

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017) // C++ code generated with wxFormBuilder (version Dec 1 2018)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -12,246 +12,334 @@
DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{ {
this->SetSizeHints( wxDefaultSize, wxDefaultSize ); this->SetSizeHints( wxDefaultSize, wxDefaultSize );
m_MainBoxSizer = new wxBoxSizer( wxVERTICAL ); m_MainBoxSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* m_OptionsBoxSizer; wxBoxSizer* m_OptionsBoxSizer;
m_OptionsBoxSizer = new wxBoxSizer( wxHORIZONTAL ); m_OptionsBoxSizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* sbSizer2; wxStaticBoxSizer* sbSizer2;
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Layer") ), wxVERTICAL ); sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Layer") ), wxVERTICAL );
m_layers = new wxDataViewListCtrl( sbSizer2->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_NO_HEADER|wxBORDER_SIMPLE ); m_layers = new wxDataViewListCtrl( sbSizer2->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_NO_HEADER|wxBORDER_SIMPLE );
m_layers->SetMinSize( wxSize( 80,-1 ) ); m_layers->SetMinSize( wxSize( 80,-1 ) );
sbSizer2->Add( m_layers, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); sbSizer2->Add( m_layers, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_OptionsBoxSizer->Add( sbSizer2, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); m_OptionsBoxSizer->Add( sbSizer2, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
wxStaticBoxSizer* sbSizer3; wxStaticBoxSizer* sbSizer3;
sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Net") ), wxHORIZONTAL ); sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Net") ), wxHORIZONTAL );
m_ListNetNameSelection = new wxListBox( sbSizer3->GetStaticBox(), ID_NETNAME_SELECTION, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); m_ListNetNameSelection = new wxListBox( sbSizer3->GetStaticBox(), ID_NETNAME_SELECTION, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
sbSizer3->Add( m_ListNetNameSelection, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); sbSizer3->Add( m_ListNetNameSelection, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bFilteringSizer; wxBoxSizer* bFilteringSizer;
bFilteringSizer = new wxBoxSizer( wxVERTICAL ); bFilteringSizer = new wxBoxSizer( wxVERTICAL );
m_staticTextDisplay = new wxStaticText( sbSizer3->GetStaticBox(), wxID_ANY, _("Hide nets matching:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextDisplay = new wxStaticText( sbSizer3->GetStaticBox(), wxID_ANY, _("Hide nets matching:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextDisplay->Wrap( -1 ); m_staticTextDisplay->Wrap( -1 );
bFilteringSizer->Add( m_staticTextDisplay, 0, wxRIGHT|wxLEFT, 5 ); bFilteringSizer->Add( m_staticTextDisplay, 0, wxRIGHT|wxLEFT, 5 );
m_DoNotShowNetNameFilter = new wxTextCtrl( sbSizer3->GetStaticBox(), ID_TEXTCTRL_NETNAMES_FILTER, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); m_DoNotShowNetNameFilter = new wxTextCtrl( sbSizer3->GetStaticBox(), ID_TEXTCTRL_NETNAMES_FILTER, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
m_DoNotShowNetNameFilter->SetToolTip( _("Pattern to filter net names in filtered list.\nNet names matching this pattern are not displayed.") ); m_DoNotShowNetNameFilter->SetToolTip( _("Pattern to filter net names in filtered list.\nNet names matching this pattern are not displayed.") );
m_DoNotShowNetNameFilter->SetMinSize( wxSize( 180,-1 ) ); m_DoNotShowNetNameFilter->SetMinSize( wxSize( 180,-1 ) );
bFilteringSizer->Add( m_DoNotShowNetNameFilter, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); bFilteringSizer->Add( m_DoNotShowNetNameFilter, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticTextVFilter = new wxStaticText( sbSizer3->GetStaticBox(), wxID_ANY, _("Show nets matching:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextVFilter = new wxStaticText( sbSizer3->GetStaticBox(), wxID_ANY, _("Show nets matching:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextVFilter->Wrap( -1 ); m_staticTextVFilter->Wrap( -1 );
bFilteringSizer->Add( m_staticTextVFilter, 0, wxRIGHT|wxLEFT, 5 ); bFilteringSizer->Add( m_staticTextVFilter, 0, wxRIGHT|wxLEFT, 5 );
m_ShowNetNameFilter = new wxTextCtrl( sbSizer3->GetStaticBox(), ID_TEXTCTRL_NETNAMES_FILTER, _("*"), wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); m_ShowNetNameFilter = new wxTextCtrl( sbSizer3->GetStaticBox(), ID_TEXTCTRL_NETNAMES_FILTER, _("*"), wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
m_ShowNetNameFilter->SetToolTip( _("Pattern to filter net names in filtered list.\nOnly net names matching this pattern are displayed.") ); m_ShowNetNameFilter->SetToolTip( _("Pattern to filter net names in filtered list.\nOnly net names matching this pattern are displayed.") );
bFilteringSizer->Add( m_ShowNetNameFilter, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); bFilteringSizer->Add( m_ShowNetNameFilter, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_buttonRunFilter = new wxButton( sbSizer3->GetStaticBox(), wxID_APPLY_FILTERS, _("Apply Filters"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonRunFilter = new wxButton( sbSizer3->GetStaticBox(), wxID_APPLY_FILTERS, _("Apply Filters"), wxDefaultPosition, wxDefaultSize, 0 );
bFilteringSizer->Add( m_buttonRunFilter, 0, wxALL|wxEXPAND, 5 ); bFilteringSizer->Add( m_buttonRunFilter, 0, wxALL|wxEXPAND, 5 );
bFilteringSizer->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); bFilteringSizer->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_showAllNetsOpt = new wxCheckBox( sbSizer3->GetStaticBox(), wxID_ANY, _("Show all nets"), wxDefaultPosition, wxDefaultSize, 0 ); m_showAllNetsOpt = new wxCheckBox( sbSizer3->GetStaticBox(), wxID_ANY, _("Show all nets"), wxDefaultPosition, wxDefaultSize, 0 );
bFilteringSizer->Add( m_showAllNetsOpt, 0, wxALL, 5 ); bFilteringSizer->Add( m_showAllNetsOpt, 0, wxALL, 5 );
bFilteringSizer->Add( 0, 0, 0, wxEXPAND|wxTOP, 5 ); bFilteringSizer->Add( 0, 0, 0, wxEXPAND|wxTOP, 5 );
m_sortByPadsOpt = new wxCheckBox( sbSizer3->GetStaticBox(), wxID_ANY, _("Sort nets by pad count"), wxDefaultPosition, wxDefaultSize, 0 ); m_sortByPadsOpt = new wxCheckBox( sbSizer3->GetStaticBox(), wxID_ANY, _("Sort nets by pad count"), wxDefaultPosition, wxDefaultSize, 0 );
bFilteringSizer->Add( m_sortByPadsOpt, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); bFilteringSizer->Add( m_sortByPadsOpt, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_bNoNetWarning = new wxBoxSizer( wxHORIZONTAL ); m_bNoNetWarning = new wxBoxSizer( wxHORIZONTAL );
m_bitmapNoNetWarning = new wxStaticBitmap( sbSizer3->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); m_bitmapNoNetWarning = new wxStaticBitmap( sbSizer3->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
m_bNoNetWarning->Add( m_bitmapNoNetWarning, 0, wxTOP|wxBOTTOM|wxLEFT, 8 ); m_bNoNetWarning->Add( m_bitmapNoNetWarning, 0, wxTOP|wxBOTTOM|wxLEFT, 8 );
m_staticText18 = new wxStaticText( sbSizer3->GetStaticBox(), wxID_ANY, _("No net will result\nin an unconnected \ncopper island."), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText18 = new wxStaticText( sbSizer3->GetStaticBox(), wxID_ANY, _("No net will result\nin an unconnected \ncopper island."), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText18->Wrap( -1 ); m_staticText18->Wrap( -1 );
m_bNoNetWarning->Add( m_staticText18, 0, wxALL, 5 ); m_bNoNetWarning->Add( m_staticText18, 0, wxALL, 5 );
bFilteringSizer->Add( m_bNoNetWarning, 1, wxEXPAND|wxTOP, 20 ); bFilteringSizer->Add( m_bNoNetWarning, 1, wxEXPAND|wxRESERVE_SPACE_EVEN_IF_HIDDEN|wxTOP, 20 );
sbSizer3->Add( bFilteringSizer, 0, wxEXPAND, 20 ); sbSizer3->Add( bFilteringSizer, 0, wxEXPAND, 20 );
m_OptionsBoxSizer->Add( sbSizer3, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); m_OptionsBoxSizer->Add( sbSizer3, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_MainBoxSizer->Add( m_OptionsBoxSizer, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); m_MainBoxSizer->Add( m_OptionsBoxSizer, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizerMiddle;
bSizerMiddle = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* m_ExportableSetupSizer; wxStaticBoxSizer* m_ExportableSetupSizer;
m_ExportableSetupSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Settings") ), wxHORIZONTAL ); m_ExportableSetupSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Settings") ), wxHORIZONTAL );
wxGridBagSizer* gbSizer1; wxGridBagSizer* gbSizer1;
gbSizer1 = new wxGridBagSizer( 0, 0 ); gbSizer1 = new wxGridBagSizer( 0, 0 );
gbSizer1->SetFlexibleDirection( wxBOTH ); gbSizer1->SetFlexibleDirection( wxBOTH );
gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_constrainOutline = new wxCheckBox( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Constrain outline to H, V and 45 degrees"), wxDefaultPosition, wxDefaultSize, 0 ); m_constrainOutline = new wxCheckBox( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Constrain outline to H, V and 45 degrees"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_constrainOutline, wxGBPosition( 0, 0 ), wxGBSpan( 1, 3 ), wxBOTTOM|wxRIGHT, 5 ); gbSizer1->Add( m_constrainOutline, wxGBPosition( 0, 0 ), wxGBSpan( 1, 3 ), wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_staticTextSmoothing = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Corner smoothing:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextSmoothing = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Corner smoothing:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextSmoothing->Wrap( -1 ); m_staticTextSmoothing->Wrap( -1 );
gbSizer1->Add( m_staticTextSmoothing, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 ); gbSizer1->Add( m_staticTextSmoothing, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
wxString m_cornerSmoothingChoiceChoices[] = { _("None"), _("Chamfer"), _("Fillet") }; wxString m_cornerSmoothingChoiceChoices[] = { _("None"), _("Chamfer"), _("Fillet") };
int m_cornerSmoothingChoiceNChoices = sizeof( m_cornerSmoothingChoiceChoices ) / sizeof( wxString ); int m_cornerSmoothingChoiceNChoices = sizeof( m_cornerSmoothingChoiceChoices ) / sizeof( wxString );
m_cornerSmoothingChoice = new wxChoice( m_ExportableSetupSizer->GetStaticBox(), ID_CORNER_SMOOTHING, wxDefaultPosition, wxDefaultSize, m_cornerSmoothingChoiceNChoices, m_cornerSmoothingChoiceChoices, 0 ); m_cornerSmoothingChoice = new wxChoice( m_ExportableSetupSizer->GetStaticBox(), ID_CORNER_SMOOTHING, wxDefaultPosition, wxDefaultSize, m_cornerSmoothingChoiceNChoices, m_cornerSmoothingChoiceChoices, 0 );
m_cornerSmoothingChoice->SetSelection( 0 ); m_cornerSmoothingChoice->SetSelection( 0 );
gbSizer1->Add( m_cornerSmoothingChoice, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALL, 5 ); gbSizer1->Add( m_cornerSmoothingChoice, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALL, 5 );
m_cornerRadiusLabel = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Chamfer distance:"), wxDefaultPosition, wxDefaultSize, 0 ); m_cornerRadiusLabel = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Chamfer distance:"), wxDefaultPosition, wxDefaultSize, 0 );
m_cornerRadiusLabel->Wrap( -1 ); m_cornerRadiusLabel->Wrap( -1 );
gbSizer1->Add( m_cornerRadiusLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 ); gbSizer1->Add( m_cornerRadiusLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_cornerRadiusCtrl = new wxTextCtrl( m_ExportableSetupSizer->GetStaticBox(), ID_M_CORNERSMOOTHINGCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_cornerRadiusCtrl = new wxTextCtrl( m_ExportableSetupSizer->GetStaticBox(), ID_M_CORNERSMOOTHINGCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_cornerRadiusCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); gbSizer1->Add( m_cornerRadiusCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_cornerRadiusUnits = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 ); m_cornerRadiusUnits = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_cornerRadiusUnits->Wrap( -1 ); m_cornerRadiusUnits->Wrap( -1 );
gbSizer1->Add( m_cornerRadiusUnits, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 ); gbSizer1->Add( m_cornerRadiusUnits, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_staticTextPriorityLevel = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Zone priority level:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextPriorityLevel = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Zone priority level:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextPriorityLevel->Wrap( -1 ); m_staticTextPriorityLevel->Wrap( -1 );
m_staticTextPriorityLevel->SetToolTip( _("Zones are filled by priority level, level 3 has higher priority than level 2.\nWhen a zone is inside another zone:\n* If its priority is higher, its outlines are removed from the other zone.\n* If its priority is equal, a DRC error is set.") ); m_staticTextPriorityLevel->SetToolTip( _("Zones are filled by priority level, level 3 has higher priority than level 2.\nWhen a zone is inside another zone:\n* If its priority is higher, its outlines are removed from the other zone.\n* If its priority is equal, a DRC error is set.") );
gbSizer1->Add( m_staticTextPriorityLevel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 ); gbSizer1->Add( m_staticTextPriorityLevel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
m_PriorityLevelCtrl = new wxSpinCtrl( m_ExportableSetupSizer->GetStaticBox(), ID_M_PRIORITYLEVELCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 100, 0 ); m_PriorityLevelCtrl = new wxSpinCtrl( m_ExportableSetupSizer->GetStaticBox(), ID_M_PRIORITYLEVELCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 100, 0 );
gbSizer1->Add( m_PriorityLevelCtrl, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); gbSizer1->Add( m_PriorityLevelCtrl, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticTextStyle = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Outline display:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextStyle = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Outline display:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextStyle->Wrap( -1 ); m_staticTextStyle->Wrap( -1 );
gbSizer1->Add( m_staticTextStyle, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 ); gbSizer1->Add( m_staticTextStyle, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
wxString m_OutlineAppearanceCtrlChoices[] = { _("Line"), _("Hatched"), _("Fully hatched") }; wxString m_OutlineAppearanceCtrlChoices[] = { _("Line"), _("Hatched"), _("Fully hatched") };
int m_OutlineAppearanceCtrlNChoices = sizeof( m_OutlineAppearanceCtrlChoices ) / sizeof( wxString ); int m_OutlineAppearanceCtrlNChoices = sizeof( m_OutlineAppearanceCtrlChoices ) / sizeof( wxString );
m_OutlineAppearanceCtrl = new wxChoice( m_ExportableSetupSizer->GetStaticBox(), ID_M_OUTLINEAPPEARANCECTRL, wxDefaultPosition, wxDefaultSize, m_OutlineAppearanceCtrlNChoices, m_OutlineAppearanceCtrlChoices, 0 ); m_OutlineAppearanceCtrl = new wxChoice( m_ExportableSetupSizer->GetStaticBox(), ID_M_OUTLINEAPPEARANCECTRL, wxDefaultPosition, wxDefaultSize, m_OutlineAppearanceCtrlNChoices, m_OutlineAppearanceCtrlChoices, 0 );
m_OutlineAppearanceCtrl->SetSelection( 0 ); m_OutlineAppearanceCtrl->SetSelection( 0 );
gbSizer1->Add( m_OutlineAppearanceCtrl, wxGBPosition( 4, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); gbSizer1->Add( m_OutlineAppearanceCtrl, wxGBPosition( 4, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
gbSizer1->AddGrowableCol( 1 ); gbSizer1->AddGrowableCol( 1 );
m_ExportableSetupSizer->Add( gbSizer1, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); m_ExportableSetupSizer->Add( gbSizer1, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
wxGridBagSizer* gbSizerSettings;
m_ExportableSetupSizer->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); gbSizerSettings = new wxGridBagSizer( 0, 0 );
gbSizerSettings->SetFlexibleDirection( wxBOTH );
wxGridBagSizer* gbSizer2; gbSizerSettings->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
gbSizer2 = new wxGridBagSizer( 0, 0 );
gbSizer2->SetFlexibleDirection( wxBOTH );
gbSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_clearanceLabel = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Clearance:"), wxDefaultPosition, wxDefaultSize, 0 ); m_clearanceLabel = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Clearance:"), wxDefaultPosition, wxDefaultSize, 0 );
m_clearanceLabel->Wrap( -1 ); m_clearanceLabel->Wrap( -1 );
gbSizer2->Add( m_clearanceLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 ); gbSizerSettings->Add( m_clearanceLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 );
m_clearanceCtrl = new wxTextCtrl( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_clearanceCtrl = new wxTextCtrl( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer2->Add( m_clearanceCtrl, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); gbSizerSettings->Add( m_clearanceCtrl, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_clearanceUnits = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 ); m_clearanceUnits = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_clearanceUnits->Wrap( -1 ); m_clearanceUnits->Wrap( -1 );
gbSizer2->Add( m_clearanceUnits, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 ); gbSizerSettings->Add( m_clearanceUnits, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_minWidthLabel = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Minimum width:"), wxDefaultPosition, wxDefaultSize, 0 ); m_minWidthLabel = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Minimum width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_minWidthLabel->Wrap( -1 ); m_minWidthLabel->Wrap( -1 );
m_minWidthLabel->SetToolTip( _("Minimum thickness of filled areas.") ); m_minWidthLabel->SetToolTip( _("Minimum thickness of filled areas.") );
gbSizer2->Add( m_minWidthLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); gbSizerSettings->Add( m_minWidthLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_minWidthCtrl = new wxTextCtrl( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_minWidthCtrl = new wxTextCtrl( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer2->Add( m_minWidthCtrl, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); gbSizerSettings->Add( m_minWidthCtrl, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_minWidthUnits = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 ); m_minWidthUnits = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_minWidthUnits->Wrap( -1 ); m_minWidthUnits->Wrap( -1 );
gbSizer2->Add( m_minWidthUnits, wxGBPosition( 1, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 ); gbSizerSettings->Add( m_minWidthUnits, wxGBPosition( 1, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_connectionLabel = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Pad connections:"), wxDefaultPosition, wxDefaultSize, 0 ); m_connectionLabel = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Pad connections:"), wxDefaultPosition, wxDefaultSize, 0 );
m_connectionLabel->Wrap( -1 ); m_connectionLabel->Wrap( -1 );
m_connectionLabel->SetToolTip( _("Default pad connection type to zone.\nThis setting can be overridden by local pad settings") ); m_connectionLabel->SetToolTip( _("Default pad connection type to zone.\nThis setting can be overridden by local pad settings") );
gbSizer2->Add( m_connectionLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); gbSizerSettings->Add( m_connectionLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
wxString m_PadInZoneOptChoices[] = { _("Solid"), _("Thermal reliefs"), _("Reliefs for PTH only"), _("None") }; wxString m_PadInZoneOptChoices[] = { _("Solid"), _("Thermal reliefs"), _("Reliefs for PTH only"), _("None") };
int m_PadInZoneOptNChoices = sizeof( m_PadInZoneOptChoices ) / sizeof( wxString ); int m_PadInZoneOptNChoices = sizeof( m_PadInZoneOptChoices ) / sizeof( wxString );
m_PadInZoneOpt = new wxChoice( m_ExportableSetupSizer->GetStaticBox(), ID_M_PADINZONEOPT, wxDefaultPosition, wxDefaultSize, m_PadInZoneOptNChoices, m_PadInZoneOptChoices, 0 ); m_PadInZoneOpt = new wxChoice( m_ExportableSetupSizer->GetStaticBox(), ID_M_PADINZONEOPT, wxDefaultPosition, wxDefaultSize, m_PadInZoneOptNChoices, m_PadInZoneOptChoices, 0 );
m_PadInZoneOpt->SetSelection( 0 ); m_PadInZoneOpt->SetSelection( 0 );
gbSizer2->Add( m_PadInZoneOpt, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxRIGHT|wxLEFT, 5 ); gbSizerSettings->Add( m_PadInZoneOpt, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_antipadLabel = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Thermal clearance:"), wxDefaultPosition, wxDefaultSize, 0 ); m_antipadLabel = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Thermal clearance:"), wxDefaultPosition, wxDefaultSize, 0 );
m_antipadLabel->Wrap( -1 ); m_antipadLabel->Wrap( -1 );
gbSizer2->Add( m_antipadLabel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 ); gbSizerSettings->Add( m_antipadLabel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
m_antipadCtrl = new wxTextCtrl( m_ExportableSetupSizer->GetStaticBox(), wxID_ANTIPAD_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_antipadCtrl = new wxTextCtrl( m_ExportableSetupSizer->GetStaticBox(), wxID_ANTIPAD_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_antipadCtrl->SetToolTip( _("Clearance between pads and filled areas of the same net.") ); m_antipadCtrl->SetToolTip( _("Clearance between pads in the same net and filled areas.") );
gbSizer2->Add( m_antipadCtrl, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); gbSizerSettings->Add( m_antipadCtrl, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_antipadUnits = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 ); m_antipadUnits = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_antipadUnits->Wrap( -1 ); m_antipadUnits->Wrap( -1 );
gbSizer2->Add( m_antipadUnits, wxGBPosition( 3, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 ); gbSizerSettings->Add( m_antipadUnits, wxGBPosition( 3, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 );
m_spokeWidthLabel = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Thermal spoke width:"), wxDefaultPosition, wxDefaultSize, 0 ); m_spokeWidthLabel = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Thermal spoke width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_spokeWidthLabel->Wrap( -1 ); m_spokeWidthLabel->Wrap( -1 );
gbSizer2->Add( m_spokeWidthLabel, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 ); gbSizerSettings->Add( m_spokeWidthLabel, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_spokeWidthCtrl = new wxTextCtrl( m_ExportableSetupSizer->GetStaticBox(), wxID_COPPER_BRIDGE_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_spokeWidthCtrl = new wxTextCtrl( m_ExportableSetupSizer->GetStaticBox(), wxID_COPPER_BRIDGE_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_spokeWidthCtrl->SetToolTip( _("Width of copper in thermal reliefs.") ); m_spokeWidthCtrl->SetToolTip( _("Width of copper in thermal reliefs.") );
gbSizer2->Add( m_spokeWidthCtrl, wxGBPosition( 4, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALL, 5 ); gbSizerSettings->Add( m_spokeWidthCtrl, wxGBPosition( 4, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALL, 5 );
m_spokeWidthUnits = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 ); m_spokeWidthUnits = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_spokeWidthUnits->Wrap( -1 ); m_spokeWidthUnits->Wrap( -1 );
gbSizer2->Add( m_spokeWidthUnits, wxGBPosition( 4, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 ); gbSizerSettings->Add( m_spokeWidthUnits, wxGBPosition( 4, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
gbSizer2->AddGrowableCol( 1 ); gbSizerSettings->AddGrowableCol( 1 );
m_ExportableSetupSizer->Add( gbSizer2, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); m_ExportableSetupSizer->Add( gbSizerSettings, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_MainBoxSizer->Add( m_ExportableSetupSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 ); bSizerMiddle->Add( m_ExportableSetupSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
wxStaticBoxSizer* sbSizerZoneStyle;
sbSizerZoneStyle = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Style") ), wxVERTICAL );
wxFlexGridSizer* fgSizerZoneStyle;
fgSizerZoneStyle = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizerZoneStyle->AddGrowableCol( 1 );
fgSizerZoneStyle->SetFlexibleDirection( wxBOTH );
fgSizerZoneStyle->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTextGridFillType = new wxStaticText( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, _("Fill type:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGridFillType->Wrap( -1 );
fgSizerZoneStyle->Add( m_staticTextGridFillType, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
wxString m_GridStyleCtrlChoices[] = { _("Solid shape"), _("Hatch pattern") };
int m_GridStyleCtrlNChoices = sizeof( m_GridStyleCtrlChoices ) / sizeof( wxString );
m_GridStyleCtrl = new wxChoice( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_GridStyleCtrlNChoices, m_GridStyleCtrlChoices, 0 );
m_GridStyleCtrl->SetSelection( 0 );
fgSizerZoneStyle->Add( m_GridStyleCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
fgSizerZoneStyle->Add( 0, 0, 1, wxEXPAND, 5 );
m_staticTextGrindOrient = new wxStaticText( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, _("Orientation:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGrindOrient->Wrap( -1 );
fgSizerZoneStyle->Add( m_staticTextGrindOrient, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_tcGridStyleOrientation = new wxTextCtrl( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerZoneStyle->Add( m_tcGridStyleOrientation, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_staticTextRotUnits = new wxStaticText( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, _("degree"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextRotUnits->Wrap( -1 );
fgSizerZoneStyle->Add( m_staticTextRotUnits, 0, wxALL, 5 );
m_staticTextStyleThickness = new wxStaticText( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, _("Hatch width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextStyleThickness->Wrap( -1 );
fgSizerZoneStyle->Add( m_staticTextStyleThickness, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_tcGridStyleThickness = new wxTextCtrl( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerZoneStyle->Add( m_tcGridStyleThickness, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_GridStyleThicknessUnits = new wxStaticText( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_GridStyleThicknessUnits->Wrap( -1 );
fgSizerZoneStyle->Add( m_GridStyleThicknessUnits, 0, wxALL, 5 );
m_staticTextGridGap = new wxStaticText( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, _("Hatch gap:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGridGap->Wrap( -1 );
fgSizerZoneStyle->Add( m_staticTextGridGap, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_tcGridStyleGap = new wxTextCtrl( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerZoneStyle->Add( m_tcGridStyleGap, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_GridStyleGapUnits = new wxStaticText( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_GridStyleGapUnits->Wrap( -1 );
fgSizerZoneStyle->Add( m_GridStyleGapUnits, 0, wxALL, 5 );
m_staticTextGridSmoothingLevel = new wxStaticText( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, _("Smoothing effort:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGridSmoothingLevel->Wrap( -1 );
m_staticTextGridSmoothingLevel->SetToolTip( _("Value of smoothing effort\n0 = no smoothing\n1 = chamfer\n2 = round corners\n3 = round corners (finer shape)") );
fgSizerZoneStyle->Add( m_staticTextGridSmoothingLevel, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_spinCtrlSmoothLevel = new wxSpinCtrl( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 3, 0 );
fgSizerZoneStyle->Add( m_spinCtrlSmoothLevel, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
fgSizerZoneStyle->Add( 0, 0, 1, wxEXPAND, 5 );
m_staticTextGridSmootingVal = new wxStaticText( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, _("Smooth value (0..1):"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGridSmootingVal->Wrap( -1 );
m_staticTextGridSmootingVal->SetToolTip( _("Ratio between smoothed corners size and the gap between lines\n0 = no smoothing\n1.0 = max radius/chamfer size (half gap value)") );
fgSizerZoneStyle->Add( m_staticTextGridSmootingVal, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_spinCtrlSmoothValue = new wxSpinCtrlDouble( sbSizerZoneStyle->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 1, 0.100000, 0.1 );
m_spinCtrlSmoothValue->SetDigits( 2 );
fgSizerZoneStyle->Add( m_spinCtrlSmoothValue, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
fgSizerZoneStyle->Add( 0, 0, 1, wxEXPAND, 5 );
sbSizerZoneStyle->Add( fgSizerZoneStyle, 1, wxEXPAND, 5 );
bSizerMiddle->Add( sbSizerZoneStyle, 1, wxEXPAND|wxTOP|wxRIGHT, 10 );
m_MainBoxSizer->Add( bSizerMiddle, 0, wxEXPAND, 5 );
wxBoxSizer* bSizerbottom; wxBoxSizer* bSizerbottom;
bSizerbottom = new wxBoxSizer( wxHORIZONTAL ); bSizerbottom = new wxBoxSizer( wxHORIZONTAL );
m_ExportSetupButton = new wxButton( this, wxID_BUTTON_EXPORT, _("Export Settings to Other Zones"), wxDefaultPosition, wxDefaultSize, 0 ); m_ExportSetupButton = new wxButton( this, wxID_BUTTON_EXPORT, _("Export Settings to Other Zones"), wxDefaultPosition, wxDefaultSize, 0 );
m_ExportSetupButton->SetToolTip( _("Export this zone setup (excluding layer and net selection) to all other copper zones.") ); m_ExportSetupButton->SetToolTip( _("Export this zone setup (excluding layer and net selection) to all other copper zones.") );
bSizerbottom->Add( m_ExportSetupButton, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 10 ); bSizerbottom->Add( m_ExportSetupButton, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 10 );
m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK ); m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK ); m_sdbSizer->AddButton( m_sdbSizerOK );
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL ); m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel ); m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize(); m_sdbSizer->Realize();
bSizerbottom->Add( m_sdbSizer, 1, wxEXPAND|wxALL, 5 ); bSizerbottom->Add( m_sdbSizer, 1, wxALL|wxEXPAND, 5 );
m_MainBoxSizer->Add( bSizerbottom, 0, wxEXPAND|wxLEFT, 5 ); m_MainBoxSizer->Add( bSizerbottom, 0, wxEXPAND|wxLEFT, 5 );
this->SetSizer( m_MainBoxSizer ); this->SetSizer( m_MainBoxSizer );
this->Layout(); this->Layout();
m_MainBoxSizer->Fit( this );
// Connect Events // Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_COPPER_ZONE_BASE::OnClose ) ); this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_COPPER_ZONE_BASE::OnClose ) );
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_COPPER_ZONE_BASE::OnUpdateUI ) ); this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_COPPER_ZONE_BASE::OnUpdateUI ) );
@ -261,6 +349,7 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i
m_buttonRunFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnRunFiltersButtonClick ), NULL, this ); m_buttonRunFilter->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnRunFiltersButtonClick ), NULL, this );
m_showAllNetsOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnNetSortingOptionSelected ), NULL, this ); m_showAllNetsOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnNetSortingOptionSelected ), NULL, this );
m_sortByPadsOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnNetSortingOptionSelected ), NULL, this ); m_sortByPadsOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnNetSortingOptionSelected ), NULL, this );
m_GridStyleCtrl->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnStyleSelection ), NULL, this );
m_ExportSetupButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::ExportSetupToOtherCopperZones ), NULL, this ); m_ExportSetupButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::ExportSetupToOtherCopperZones ), NULL, this );
m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnButtonCancelClick ), NULL, this ); m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnButtonCancelClick ), NULL, this );
} }
@ -276,7 +365,8 @@ DIALOG_COPPER_ZONE_BASE::~DIALOG_COPPER_ZONE_BASE()
m_buttonRunFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnRunFiltersButtonClick ), NULL, this ); m_buttonRunFilter->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnRunFiltersButtonClick ), NULL, this );
m_showAllNetsOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnNetSortingOptionSelected ), NULL, this ); m_showAllNetsOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnNetSortingOptionSelected ), NULL, this );
m_sortByPadsOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnNetSortingOptionSelected ), NULL, this ); m_sortByPadsOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnNetSortingOptionSelected ), NULL, this );
m_GridStyleCtrl->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnStyleSelection ), NULL, this );
m_ExportSetupButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::ExportSetupToOtherCopperZones ), NULL, this ); m_ExportSetupButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::ExportSetupToOtherCopperZones ), NULL, this );
m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnButtonCancelClick ), NULL, this ); m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_COPPER_ZONE_BASE::OnButtonCancelClick ), NULL, this );
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,11 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017) // C++ code generated with wxFormBuilder (version Dec 1 2018)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_COPPER_ZONES_BASE_H__ #pragma once
#define __DIALOG_COPPER_ZONES_BASE_H__
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h> #include <wx/xrc/xmlres.h>
@ -23,11 +22,11 @@
#include <wx/listbox.h> #include <wx/listbox.h>
#include <wx/stattext.h> #include <wx/stattext.h>
#include <wx/textctrl.h> #include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/checkbox.h>
#include <wx/bitmap.h> #include <wx/bitmap.h>
#include <wx/image.h> #include <wx/image.h>
#include <wx/icon.h> #include <wx/icon.h>
#include <wx/button.h>
#include <wx/checkbox.h>
#include <wx/statbmp.h> #include <wx/statbmp.h>
#include <wx/choice.h> #include <wx/choice.h>
#include <wx/spinctrl.h> #include <wx/spinctrl.h>
@ -42,7 +41,7 @@
class DIALOG_COPPER_ZONE_BASE : public DIALOG_SHIM class DIALOG_COPPER_ZONE_BASE : public DIALOG_SHIM
{ {
private: private:
protected: protected:
enum enum
{ {
@ -59,7 +58,7 @@ class DIALOG_COPPER_ZONE_BASE : public DIALOG_SHIM
wxID_COPPER_BRIDGE_VALUE, wxID_COPPER_BRIDGE_VALUE,
wxID_BUTTON_EXPORT wxID_BUTTON_EXPORT
}; };
wxBoxSizer* m_MainBoxSizer; wxBoxSizer* m_MainBoxSizer;
wxDataViewListCtrl* m_layers; wxDataViewListCtrl* m_layers;
wxListBox* m_ListNetNameSelection; wxListBox* m_ListNetNameSelection;
@ -97,26 +96,41 @@ class DIALOG_COPPER_ZONE_BASE : public DIALOG_SHIM
wxStaticText* m_spokeWidthLabel; wxStaticText* m_spokeWidthLabel;
wxTextCtrl* m_spokeWidthCtrl; wxTextCtrl* m_spokeWidthCtrl;
wxStaticText* m_spokeWidthUnits; wxStaticText* m_spokeWidthUnits;
wxStaticText* m_staticTextGridFillType;
wxChoice* m_GridStyleCtrl;
wxStaticText* m_staticTextGrindOrient;
wxTextCtrl* m_tcGridStyleOrientation;
wxStaticText* m_staticTextRotUnits;
wxStaticText* m_staticTextStyleThickness;
wxTextCtrl* m_tcGridStyleThickness;
wxStaticText* m_GridStyleThicknessUnits;
wxStaticText* m_staticTextGridGap;
wxTextCtrl* m_tcGridStyleGap;
wxStaticText* m_GridStyleGapUnits;
wxStaticText* m_staticTextGridSmoothingLevel;
wxSpinCtrl* m_spinCtrlSmoothLevel;
wxStaticText* m_staticTextGridSmootingVal;
wxSpinCtrlDouble* m_spinCtrlSmoothValue;
wxButton* m_ExportSetupButton; wxButton* m_ExportSetupButton;
wxStdDialogButtonSizer* m_sdbSizer; wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK; wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel; wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); } virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnLayerSelection( wxDataViewEvent& event ) { event.Skip(); } virtual void OnLayerSelection( wxDataViewEvent& event ) { event.Skip(); }
virtual void OnRunFiltersButtonClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnRunFiltersButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnNetSortingOptionSelected( wxCommandEvent& event ) { event.Skip(); } virtual void OnNetSortingOptionSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnStyleSelection( wxCommandEvent& event ) { event.Skip(); }
virtual void ExportSetupToOtherCopperZones( wxCommandEvent& event ) { event.Skip(); } virtual void ExportSetupToOtherCopperZones( wxCommandEvent& event ) { event.Skip(); }
virtual void OnButtonCancelClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnButtonCancelClick( wxCommandEvent& event ) { event.Skip(); }
public: public:
DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID id = ID_DIALOG_COPPER_ZONE_BASE, const wxString& title = _("Copper Zone Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID id = ID_DIALOG_COPPER_ZONE_BASE, const wxString& title = _("Copper Zone Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 825,528 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_COPPER_ZONE_BASE(); ~DIALOG_COPPER_ZONE_BASE();
}; };
#endif //__DIALOG_COPPER_ZONES_BASE_H__

View File

@ -4,7 +4,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
* *
@ -44,10 +44,14 @@ private:
ZONE_SETTINGS* m_ptr; ZONE_SETTINGS* m_ptr;
ZONE_SETTINGS m_settings; // working copy of zone settings ZONE_SETTINGS m_settings; // working copy of zone settings
UNIT_BINDER m_minWidth; UNIT_BINDER m_minWidth;
UNIT_BINDER m_gridStyleRotation;
UNIT_BINDER m_gridStyleThickness;
UNIT_BINDER m_gridStyleGap;
bool TransferDataToWindow() override; bool TransferDataToWindow() override;
bool TransferDataFromWindow() override; bool TransferDataFromWindow() override;
void OnStyleSelection( wxCommandEvent& event ) override;
void OnLayerSelection( wxDataViewEvent& event ) override; void OnLayerSelection( wxDataViewEvent& event ) override;
public: public:
@ -62,11 +66,17 @@ int InvokeNonCopperZonesEditor( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* aSetting
return dlg.ShowModal(); return dlg.ShowModal();
} }
#define MIN_THICKNESS 10*IU_PER_MILS
DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR( PCB_BASE_FRAME* aParent, DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR( PCB_BASE_FRAME* aParent,
ZONE_SETTINGS* aSettings ) : ZONE_SETTINGS* aSettings ) :
DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE( aParent ), DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE( aParent ),
m_minWidth( aParent, m_MinWidthLabel, m_MinWidthCtrl, m_MinWidthUnits, true ) m_minWidth( aParent, m_MinWidthLabel, m_MinWidthCtrl, m_MinWidthUnits, true ),
m_gridStyleRotation( aParent, m_staticTextGrindOrient, m_tcGridStyleOrientation, m_staticTextRotUnits,
false ),
m_gridStyleThickness( aParent, m_staticTextStyleThickness,
m_tcGridStyleThickness, m_GridStyleThicknessUnits, false),
m_gridStyleGap( aParent, m_staticTextGridGap, m_tcGridStyleGap, m_GridStyleGapUnits, false )
{ {
m_parent = aParent; m_parent = aParent;
@ -94,10 +104,59 @@ bool DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataToWindow()
SetInitialFocus( m_OutlineAppearanceCtrl ); SetInitialFocus( m_OutlineAppearanceCtrl );
switch( m_settings.m_FillMode )
{
case ZFM_HATCH_PATTERN:
m_GridStyleCtrl->SetSelection( 1 ); break;
default:
m_GridStyleCtrl->SetSelection( 0 ); break;
}
m_gridStyleRotation.SetUnits( DEGREES );
m_gridStyleRotation.SetValue( m_settings.m_HatchFillTypeOrientation*10 ); // IU is decidegree
// Gives a reasonable value to grid style parameters, if currently there are no defined
// parameters for grid pattern thickness and gap (if the value is 0)
// the grid pattern thickness default value is (arbitrary) m_ZoneMinThickness * 4
// or 1mm
// the grid pattern gap default value is (arbitrary) m_ZoneMinThickness * 6
// or 1.5 mm
int bestvalue = m_settings.m_HatchFillTypeThickness;
if( bestvalue <= 0 ) // No defined value for m_HatchFillTypeThickness
bestvalue = std::max( m_settings.m_ZoneMinThickness * 4, Millimeter2iu( 1.0 ) );
m_gridStyleThickness.SetValue( std::max( bestvalue, m_settings.m_ZoneMinThickness ) );
bestvalue = m_settings.m_HatchFillTypeGap;
if( bestvalue <= 0 ) // No defined value for m_HatchFillTypeGap
bestvalue = std::max( m_settings.m_ZoneMinThickness * 6, Millimeter2iu( 1.5 ) );
m_gridStyleGap.SetValue( std::max( bestvalue, m_settings.m_ZoneMinThickness ) );
m_spinCtrlSmoothLevel->SetValue( m_settings.m_HatchFillTypeSmoothingLevel );
m_spinCtrlSmoothValue->SetValue( m_settings.m_HatchFillTypeSmoothingValue );
// Enable/Disable some widgets
wxCommandEvent event;
OnStyleSelection( event );
return true; return true;
} }
void DIALOG_NON_COPPER_ZONES_EDITOR::OnStyleSelection( wxCommandEvent& event )
{
bool enable = m_GridStyleCtrl->GetSelection() >= 1;
m_tcGridStyleThickness->Enable( enable );
m_tcGridStyleGap->Enable( enable );
m_tcGridStyleOrientation->Enable( enable );
m_spinCtrlSmoothLevel->Enable( enable );
m_spinCtrlSmoothValue->Enable( enable );
}
void DIALOG_NON_COPPER_ZONES_EDITOR::OnLayerSelection( wxDataViewEvent& event ) void DIALOG_NON_COPPER_ZONES_EDITOR::OnLayerSelection( wxDataViewEvent& event )
{ {
if( event.GetColumn() != 0 ) if( event.GetColumn() != 0 )
@ -123,9 +182,10 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::OnLayerSelection( wxDataViewEvent& event )
bool DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataFromWindow() bool DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataFromWindow()
{ {
m_settings.m_ZoneMinThickness = m_minWidth.GetValue(); if( !m_gridStyleRotation.Validate( -1800, 1800 ) )
return false;
m_settings.m_FillMode = ZFM_POLYGONS; // Use always polygon fill mode m_settings.m_ZoneMinThickness = m_minWidth.GetValue();
switch( m_OutlineAppearanceCtrl->GetSelection() ) switch( m_OutlineAppearanceCtrl->GetSelection() )
{ {
@ -134,6 +194,30 @@ bool DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataFromWindow()
case 2: m_settings.m_Zone_HatchingStyle = ZONE_CONTAINER::DIAGONAL_FULL; break; case 2: m_settings.m_Zone_HatchingStyle = ZONE_CONTAINER::DIAGONAL_FULL; break;
} }
if( m_GridStyleCtrl->GetSelection() > 0 )
m_settings.m_FillMode = ZFM_HATCH_PATTERN;
else
m_settings.m_FillMode = ZFM_POLYGONS;
if( m_settings.m_FillMode == ZFM_HATCH_PATTERN )
{
int minThickness = m_minWidth.GetValue();
if( !m_gridStyleThickness.Validate( minThickness, INT_MAX ) )
return false;
if( !m_gridStyleGap.Validate( minThickness, INT_MAX ) )
return false;
}
m_settings.m_HatchFillTypeOrientation = m_gridStyleRotation.GetValue()/10.0; // value is returned in deci-degree
m_settings.m_HatchFillTypeThickness = m_gridStyleThickness.GetValue();
m_settings.m_HatchFillTypeGap = m_gridStyleGap.GetValue();
m_settings.m_HatchFillTypeSmoothingLevel = m_spinCtrlSmoothLevel->GetValue();
m_settings.m_HatchFillTypeSmoothingValue = m_spinCtrlSmoothValue->GetValue();
wxConfigBase* cfg = Kiface().KifaceSettings(); wxConfigBase* cfg = Kiface().KifaceSettings();
wxASSERT( cfg ); wxASSERT( cfg );

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017) // C++ code generated with wxFormBuilder (version Dec 1 2018)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -12,95 +12,182 @@
DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{ {
this->SetSizeHints( wxDefaultSize, wxDefaultSize ); this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* m_MainSizer; wxBoxSizer* m_MainSizer;
m_MainSizer = new wxBoxSizer( wxVERTICAL ); m_MainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* m_UpperSizer; wxBoxSizer* m_UpperSizer;
m_UpperSizer = new wxBoxSizer( wxHORIZONTAL ); m_UpperSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizerLeft; wxBoxSizer* bSizerLeft;
bSizerLeft = new wxBoxSizer( wxVERTICAL ); bSizerLeft = new wxBoxSizer( wxVERTICAL );
m_staticTextLayerSelection = new wxStaticText( this, wxID_ANY, _("Layer:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextLayerSelection = new wxStaticText( this, wxID_ANY, _("Layer:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextLayerSelection->Wrap( -1 ); m_staticTextLayerSelection->Wrap( -1 );
bSizerLeft->Add( m_staticTextLayerSelection, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); bSizerLeft->Add( m_staticTextLayerSelection, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_layers = new wxDataViewListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_NO_HEADER|wxBORDER_SIMPLE ); m_layers = new wxDataViewListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_NO_HEADER|wxBORDER_SIMPLE );
m_layers->SetMinSize( wxSize( -1,200 ) ); m_layers->SetMinSize( wxSize( -1,200 ) );
bSizerLeft->Add( m_layers, 1, wxALL|wxEXPAND, 5 ); bSizerLeft->Add( m_layers, 1, wxALL|wxEXPAND, 5 );
m_UpperSizer->Add( bSizerLeft, 1, wxEXPAND, 5 ); m_UpperSizer->Add( bSizerLeft, 1, wxEXPAND, 5 );
wxBoxSizer* bSizerRight; wxBoxSizer* bSizerMiddle;
bSizerRight = new wxBoxSizer( wxVERTICAL ); bSizerMiddle = new wxBoxSizer( wxVERTICAL );
wxGridBagSizer* gbSizer1; wxGridBagSizer* gbSizer1;
gbSizer1 = new wxGridBagSizer( 0, 0 ); gbSizer1 = new wxGridBagSizer( 0, 0 );
gbSizer1->SetFlexibleDirection( wxBOTH ); gbSizer1->SetFlexibleDirection( wxBOTH );
gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_ConstrainOpt = new wxCheckBox( this, wxID_ANY, _("Constrain outline to H, V and 45 degrees"), wxDefaultPosition, wxDefaultSize, 0 ); m_ConstrainOpt = new wxCheckBox( this, wxID_ANY, _("Constrain outline to H, V and 45 degrees"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_ConstrainOpt, wxGBPosition( 0, 0 ), wxGBSpan( 1, 3 ), wxALL, 5 ); gbSizer1->Add( m_ConstrainOpt, wxGBPosition( 0, 0 ), wxGBSpan( 1, 3 ), wxALL, 5 );
m_staticTextStyle = new wxStaticText( this, wxID_ANY, _("Outline display:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextStyle = new wxStaticText( this, wxID_ANY, _("Outline style:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextStyle->Wrap( -1 ); m_staticTextStyle->Wrap( -1 );
gbSizer1->Add( m_staticTextStyle, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 ); gbSizer1->Add( m_staticTextStyle, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
wxString m_OutlineAppearanceCtrlChoices[] = { _("Line"), _("Hatched"), _("Fully hatched") }; wxString m_OutlineAppearanceCtrlChoices[] = { _("Line"), _("Hatched"), _("Fully hatched") };
int m_OutlineAppearanceCtrlNChoices = sizeof( m_OutlineAppearanceCtrlChoices ) / sizeof( wxString ); int m_OutlineAppearanceCtrlNChoices = sizeof( m_OutlineAppearanceCtrlChoices ) / sizeof( wxString );
m_OutlineAppearanceCtrl = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_OutlineAppearanceCtrlNChoices, m_OutlineAppearanceCtrlChoices, 0 ); m_OutlineAppearanceCtrl = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_OutlineAppearanceCtrlNChoices, m_OutlineAppearanceCtrlChoices, 0 );
m_OutlineAppearanceCtrl->SetSelection( 0 ); m_OutlineAppearanceCtrl->SetSelection( 0 );
gbSizer1->Add( m_OutlineAppearanceCtrl, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 ); gbSizer1->Add( m_OutlineAppearanceCtrl, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
m_MinWidthLabel = new wxStaticText( this, wxID_ANY, _("Minimum width:"), wxDefaultPosition, wxDefaultSize, 0 ); m_MinWidthLabel = new wxStaticText( this, wxID_ANY, _("Minimum width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_MinWidthLabel->Wrap( -1 ); m_MinWidthLabel->Wrap( -1 );
gbSizer1->Add( m_MinWidthLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 ); gbSizer1->Add( m_MinWidthLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_MinWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_MinWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_MinWidthCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 ); gbSizer1->Add( m_MinWidthCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALL|wxEXPAND, 5 );
m_MinWidthUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 ); m_MinWidthUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_MinWidthUnits->Wrap( -1 ); m_MinWidthUnits->Wrap( -1 );
gbSizer1->Add( m_MinWidthUnits, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 ); gbSizer1->Add( m_MinWidthUnits, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
bSizerRight->Add( gbSizer1, 1, wxEXPAND, 5 ); bSizerMiddle->Add( gbSizer1, 0, wxEXPAND, 5 );
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
m_UpperSizer->Add( bSizerRight, 0, wxEXPAND|wxALL, 10 ); bSizerMiddle->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 );
m_staticTextGridStyle = new wxStaticText( this, wxID_ANY, _("Grid Style:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGridStyle->Wrap( -1 );
m_staticTextGridStyle->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
bSizerMiddle->Add( m_staticTextGridStyle, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT, 5 );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizer1->AddGrowableCol( 1 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTextGridFillType = new wxStaticText( this, wxID_ANY, _("Fill type:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGridFillType->Wrap( -1 );
fgSizer1->Add( m_staticTextGridFillType, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
wxString m_GridStyleCtrlChoices[] = { _("Solid shape"), _("Hatch pattern") };
int m_GridStyleCtrlNChoices = sizeof( m_GridStyleCtrlChoices ) / sizeof( wxString );
m_GridStyleCtrl = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_GridStyleCtrlNChoices, m_GridStyleCtrlChoices, 0 );
m_GridStyleCtrl->SetSelection( 0 );
fgSizer1->Add( m_GridStyleCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
m_staticTextGrindOrient = new wxStaticText( this, wxID_ANY, _("Orientation:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGrindOrient->Wrap( -1 );
fgSizer1->Add( m_staticTextGrindOrient, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_tcGridStyleOrientation = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_tcGridStyleOrientation, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_staticTextRotUnits = new wxStaticText( this, wxID_ANY, _("degree"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextRotUnits->Wrap( -1 );
fgSizer1->Add( m_staticTextRotUnits, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_staticTextStyleThickness = new wxStaticText( this, wxID_ANY, _("Hatch width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextStyleThickness->Wrap( -1 );
fgSizer1->Add( m_staticTextStyleThickness, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_tcGridStyleThickness = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_tcGridStyleThickness, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_GridStyleThicknessUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_GridStyleThicknessUnits->Wrap( -1 );
fgSizer1->Add( m_GridStyleThicknessUnits, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_staticTextGridGap = new wxStaticText( this, wxID_ANY, _("Hatch gap:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGridGap->Wrap( -1 );
fgSizer1->Add( m_staticTextGridGap, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_tcGridStyleGap = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_tcGridStyleGap, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_GridStyleGapUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_GridStyleGapUnits->Wrap( -1 );
fgSizer1->Add( m_GridStyleGapUnits, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_staticTextGridSmoothingLevel = new wxStaticText( this, wxID_ANY, _("Smoothing effort:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGridSmoothingLevel->Wrap( -1 );
m_staticTextGridSmoothingLevel->SetToolTip( _("Value of smoothing effort\n0 = no smoothing\n1 = chamfer\n2 = round corners\n3 = round corners (finer shape)") );
fgSizer1->Add( m_staticTextGridSmoothingLevel, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_spinCtrlSmoothLevel = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 3, 0 );
fgSizer1->Add( m_spinCtrlSmoothLevel, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
m_staticTextGridSmootingVal = new wxStaticText( this, wxID_ANY, _("Smooth value (0..1):"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGridSmootingVal->Wrap( -1 );
m_staticTextGridSmootingVal->SetToolTip( _("Ratio between smoothed corners size and the gap between lines\n0 = no smoothing\n1.0 = max radius/chamfer size (half gap value)") );
fgSizer1->Add( m_staticTextGridSmootingVal, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_spinCtrlSmoothValue = new wxSpinCtrlDouble( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 1, 0.1, 0.1 );
m_spinCtrlSmoothValue->SetDigits( 2 );
fgSizer1->Add( m_spinCtrlSmoothValue, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
bSizerMiddle->Add( fgSizer1, 1, wxEXPAND, 5 );
m_UpperSizer->Add( bSizerMiddle, 0, wxEXPAND|wxALL, 10 );
m_MainSizer->Add( m_UpperSizer, 1, wxEXPAND|wxALL, 5 ); m_MainSizer->Add( m_UpperSizer, 1, wxEXPAND|wxALL, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
m_MainSizer->Add( m_staticline1, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); m_MainSizer->Add( m_staticline1, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_sdbSizerButtons = new wxStdDialogButtonSizer(); m_sdbSizerButtons = new wxStdDialogButtonSizer();
m_sdbSizerButtonsOK = new wxButton( this, wxID_OK ); m_sdbSizerButtonsOK = new wxButton( this, wxID_OK );
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsOK ); m_sdbSizerButtons->AddButton( m_sdbSizerButtonsOK );
m_sdbSizerButtonsCancel = new wxButton( this, wxID_CANCEL ); m_sdbSizerButtonsCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel ); m_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel );
m_sdbSizerButtons->Realize(); m_sdbSizerButtons->Realize();
m_MainSizer->Add( m_sdbSizerButtons, 0, wxEXPAND|wxALL, 5 ); m_MainSizer->Add( m_sdbSizerButtons, 0, wxEXPAND|wxALL, 5 );
this->SetSizer( m_MainSizer ); this->SetSizer( m_MainSizer );
this->Layout(); this->Layout();
m_MainSizer->Fit( this );
this->Centre( wxBOTH ); this->Centre( wxBOTH );
// Connect Events // Connect Events
m_layers->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, wxDataViewEventHandler( DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::OnLayerSelection ), NULL, this ); m_layers->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, wxDataViewEventHandler( DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::OnLayerSelection ), NULL, this );
m_GridStyleCtrl->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::OnStyleSelection ), NULL, this );
} }
DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::~DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE() DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::~DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE()
{ {
// Disconnect Events // Disconnect Events
m_layers->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, wxDataViewEventHandler( DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::OnLayerSelection ), NULL, this ); m_layers->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, wxDataViewEventHandler( DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::OnLayerSelection ), NULL, this );
m_GridStyleCtrl->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::OnStyleSelection ), NULL, this );
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,11 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017) // C++ code generated with wxFormBuilder (version Dec 1 2018)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_NON_COPPER_ZONES_PROPERTIES_BASE_H__ #pragma once
#define __DIALOG_NON_COPPER_ZONES_PROPERTIES_BASE_H__
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h> #include <wx/xrc/xmlres.h>
@ -25,6 +24,7 @@
#include <wx/textctrl.h> #include <wx/textctrl.h>
#include <wx/gbsizer.h> #include <wx/gbsizer.h>
#include <wx/statline.h> #include <wx/statline.h>
#include <wx/spinctrl.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/dialog.h> #include <wx/dialog.h>
@ -36,7 +36,7 @@
class DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE : public DIALOG_SHIM class DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE : public DIALOG_SHIM
{ {
private: private:
protected: protected:
wxStaticText* m_staticTextLayerSelection; wxStaticText* m_staticTextLayerSelection;
wxDataViewListCtrl* m_layers; wxDataViewListCtrl* m_layers;
@ -46,20 +46,37 @@ class DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE : public DIALOG_SHIM
wxStaticText* m_MinWidthLabel; wxStaticText* m_MinWidthLabel;
wxTextCtrl* m_MinWidthCtrl; wxTextCtrl* m_MinWidthCtrl;
wxStaticText* m_MinWidthUnits; wxStaticText* m_MinWidthUnits;
wxStaticLine* m_staticline2;
wxStaticText* m_staticTextGridStyle;
wxStaticText* m_staticTextGridFillType;
wxChoice* m_GridStyleCtrl;
wxStaticText* m_staticTextGrindOrient;
wxTextCtrl* m_tcGridStyleOrientation;
wxStaticText* m_staticTextRotUnits;
wxStaticText* m_staticTextStyleThickness;
wxTextCtrl* m_tcGridStyleThickness;
wxStaticText* m_GridStyleThicknessUnits;
wxStaticText* m_staticTextGridGap;
wxTextCtrl* m_tcGridStyleGap;
wxStaticText* m_GridStyleGapUnits;
wxStaticText* m_staticTextGridSmoothingLevel;
wxSpinCtrl* m_spinCtrlSmoothLevel;
wxStaticText* m_staticTextGridSmootingVal;
wxSpinCtrlDouble* m_spinCtrlSmoothValue;
wxStaticLine* m_staticline1; wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizerButtons; wxStdDialogButtonSizer* m_sdbSizerButtons;
wxButton* m_sdbSizerButtonsOK; wxButton* m_sdbSizerButtonsOK;
wxButton* m_sdbSizerButtonsCancel; wxButton* m_sdbSizerButtonsCancel;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnLayerSelection( wxDataViewEvent& event ) { event.Skip(); } virtual void OnLayerSelection( wxDataViewEvent& event ) { event.Skip(); }
virtual void OnStyleSelection( wxCommandEvent& event ) { event.Skip(); }
public: public:
DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Non-copper Zone Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxBORDER_SUNKEN ); DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Non Copper Zones Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 547,379 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxBORDER_SUNKEN );
~DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE(); ~DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE();
}; };
#endif //__DIALOG_NON_COPPER_ZONES_PROPERTIES_BASE_H__

View File

@ -1700,9 +1700,11 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
m_out->Print( 0, " (clearance %s))\n", m_out->Print( 0, " (clearance %s))\n",
FormatInternalUnits( aZone->GetZoneClearance() ).c_str() ); FormatInternalUnits( aZone->GetZoneClearance() ).c_str() );
m_out->Print( aNestLevel+1, "(min_thickness %s)\n", m_out->Print( aNestLevel+1, "(min_thickness %s)",
FormatInternalUnits( aZone->GetMinThickness() ).c_str() ); FormatInternalUnits( aZone->GetMinThickness() ).c_str() );
m_out->Print( 0, "\n" );
if( aZone->GetIsKeepout() ) if( aZone->GetIsKeepout() )
{ {
m_out->Print( aNestLevel+1, "(keepout (tracks %s) (vias %s) (copperpour %s))\n", m_out->Print( aNestLevel+1, "(keepout (tracks %s) (vias %s) (copperpour %s))\n",
@ -1718,8 +1720,10 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
m_out->Print( 0, " yes" ); m_out->Print( 0, " yes" );
// Default is polygon filled. // Default is polygon filled.
if( aZone->GetFillMode() ) if( aZone->GetFillMode() == ZFM_SEGMENTS ) // Now deprecated. Should not be used
m_out->Print( 0, " (mode segment)" ); m_out->Print( 0, " (mode segment)" );
else if( aZone->GetFillMode() == ZFM_HATCH_PATTERN )
m_out->Print( 0, " (mode hatch)" );
m_out->Print( 0, " (arc_segments %d) (thermal_gap %s) (thermal_bridge_width %s)", m_out->Print( 0, " (arc_segments %d) (thermal_gap %s) (thermal_bridge_width %s)",
aZone->GetArcSegmentCount(), aZone->GetArcSegmentCount(),
@ -1751,6 +1755,23 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, int aNestLevel ) const
FormatInternalUnits( aZone->GetCornerRadius() ).c_str() ); FormatInternalUnits( aZone->GetCornerRadius() ).c_str() );
} }
if( aZone->GetFillMode() == ZFM_HATCH_PATTERN )
{
m_out->Print( 0, "\n" );
m_out->Print( aNestLevel+2, "(hatch_thickness %s) (hatch_gap %s) (hatch_orientation %s)",
FormatInternalUnits( aZone->GetHatchFillTypeThickness() ).c_str(),
FormatInternalUnits( aZone->GetHatchFillTypeGap() ).c_str(),
Double2Str( aZone->GetHatchFillTypeOrientation() ).c_str() );
if( aZone->GetHatchFillTypeSmoothingLevel() > 0 )
{
m_out->Print( 0, "\n" );
m_out->Print( aNestLevel+2, "(hatch_smoothing_level %d) (hatch_smoothing_value %s)",
aZone->GetHatchFillTypeSmoothingLevel(),
Double2Str( aZone->GetHatchFillTypeSmoothingValue() ).c_str() );
}
}
m_out->Print( 0, ")\n" ); m_out->Print( 0, ")\n" );
int newLine = 0; int newLine = 0;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2012 CERN * Copyright (C) 2012 CERN
* Copyright (C) 2012-2018 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2012-2019 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -3116,11 +3116,40 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER()
case T_mode: case T_mode:
token = NextTok(); token = NextTok();
if( token != T_segment && token != T_polygon ) if( token != T_segment && token != T_hatch && token != T_polygon )
Expecting( "segment or polygon" ); Expecting( "segment, hatch or polygon" );
// @todo Create an enum for fill modes. if( token == T_segment ) // deprecated
zone->SetFillMode( token == T_polygon ? ZFM_POLYGONS : ZFM_SEGMENTS ); zone->SetFillMode( ZFM_SEGMENTS );
else if( token == T_hatch )
zone->SetFillMode( ZFM_HATCH_PATTERN );
else
zone->SetFillMode( ZFM_POLYGONS );
NeedRIGHT();
break;
case T_hatch_thickness:
zone->SetHatchFillTypeThickness( parseBoardUnits( T_hatch_thickness ) );
NeedRIGHT();
break;
case T_hatch_gap:
zone->SetHatchFillTypeGap( parseBoardUnits( T_hatch_gap ) );
NeedRIGHT();
break;
case T_hatch_orientation:
zone->SetHatchFillTypeOrientation( parseDouble( T_hatch_orientation ) );
NeedRIGHT();
break;
case T_hatch_smoothing_level:
zone->SetHatchFillTypeSmoothingLevel( parseDouble( T_hatch_smoothing_level ) );
NeedRIGHT();
break;
case T_hatch_smoothing_value:
zone->SetHatchFillTypeSmoothingValue( parseDouble( T_hatch_smoothing_value ) );
NeedRIGHT(); NeedRIGHT();
break; break;
@ -3171,7 +3200,8 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER()
default: default:
Expecting( "mode, arc_segments, thermal_gap, thermal_bridge_width, " Expecting( "mode, arc_segments, thermal_gap, thermal_bridge_width, "
"smoothing, or radius" ); "hatch_thickness, hatch_gap, hatch_orientation, "
"hatch_smoothing_level, hatch_smoothing_value, smoothing, or radius" );
} }
} }
break; break;
@ -3295,7 +3325,7 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER()
{ {
if( !zone->IsOnCopperLayer() ) if( !zone->IsOnCopperLayer() )
{ {
zone->SetFillMode( ZFM_POLYGONS ); //zone->SetFillMode( ZFM_POLYGONS );
zone->SetNetCode( NETINFO_LIST::UNCONNECTED ); zone->SetNetCode( NETINFO_LIST::UNCONNECTED );
} }

View File

@ -698,8 +698,8 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone )
if( GetPlotMode() == FILLED ) if( GetPlotMode() == FILLED )
{ {
// Plot the filled area polygon. // Plot the filled area polygon.
// The area can be filled by segments or uses solid polygons // The area can be filled by segments (outdated) or uses solid polygons
if( aZone->GetFillMode() == ZONE_FILL_MODE::ZFM_POLYGONS ) // We are using solid polygons if( aZone->GetFillMode() != ZONE_FILL_MODE::ZFM_SEGMENTS ) // We are using solid polygons
{ {
m_plotter->PlotPoly( cornerList, FILLED_SHAPE, aZone->GetMinThickness(), &gbr_metadata ); m_plotter->PlotPoly( cornerList, FILLED_SHAPE, aZone->GetMinThickness(), &gbr_metadata );
} }

View File

@ -53,15 +53,11 @@
extern void CreateThermalReliefPadPolygon( SHAPE_POLY_SET& aCornerBuffer, extern void CreateThermalReliefPadPolygon( SHAPE_POLY_SET& aCornerBuffer,
const D_PAD& aPad, const D_PAD& aPad, int aThermalGap, int aCopperThickness,
int aThermalGap, int aMinThicknessValue, int aCircleToSegmentsCount,
int aCopperThickness, double aCorrectionFactor, double aThermalRot );
int aMinThicknessValue,
int aCircleToSegmentsCount,
double aCorrectionFactor,
double aThermalRot );
static double s_thermalRot = 450; // angle of stubs in thermal reliefs for round pads static double s_thermalRot = 450; // angle of stubs in thermal reliefs for round pads
static const bool s_DumpZonesWhenFilling = false; static const bool s_DumpZonesWhenFilling = false;
ZONE_FILLER::ZONE_FILLER( BOARD* aBoard, COMMIT* aCommit ) : ZONE_FILLER::ZONE_FILLER( BOARD* aBoard, COMMIT* aCommit ) :
@ -751,9 +747,30 @@ void ZONE_FILLER::computeRawFilledAreas( const ZONE_CONTAINER* aZone,
// needed by Gerber files and Fracture() // needed by Gerber files and Fracture()
solidAreas.BooleanSubtract( holes, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); solidAreas.BooleanSubtract( holes, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
// Now remove the non filled areas due to the hatch pattern
if( aZone->GetFillMode() == ZFM_HATCH_PATTERN )
addHatchFillTypeOnZone( aZone, solidAreas );
if( s_DumpZonesWhenFilling ) if( s_DumpZonesWhenFilling )
dumper->Write( &solidAreas, "solid-areas-minus-holes" ); dumper->Write( &solidAreas, "solid-areas-minus-holes" );
if( !aZone->IsOnCopperLayer() )
{
SHAPE_POLY_SET areas_fractured = solidAreas;
areas_fractured.Fracture( SHAPE_POLY_SET::PM_FAST );
if( s_DumpZonesWhenFilling )
dumper->Write( &areas_fractured, "areas_fractured" );
aFinalPolys = areas_fractured;
aRawPolys = aFinalPolys;
if( s_DumpZonesWhenFilling )
dumper->EndGroup();
return;
}
// Test thermal stubs connections and add polygons to remove unconnected stubs. // Test thermal stubs connections and add polygons to remove unconnected stubs.
// (this is a refinement for thermal relief shapes) // (this is a refinement for thermal relief shapes)
// Note: we are using not fractured solid area polygons, to avoid a side effect of extra segments // Note: we are using not fractured solid area polygons, to avoid a side effect of extra segments
@ -824,6 +841,7 @@ bool ZONE_FILLER::fillSingleZone( ZONE_CONTAINER* aZone, SHAPE_POLY_SET& aRawPol
if ( !aZone->BuildSmoothedPoly( smoothedPoly ) ) if ( !aZone->BuildSmoothedPoly( smoothedPoly ) )
return false; return false;
#if 0
if( aZone->IsOnCopperLayer() ) if( aZone->IsOnCopperLayer() )
{ {
computeRawFilledAreas( aZone, smoothedPoly, aRawPolys, aFinalPolys ); computeRawFilledAreas( aZone, smoothedPoly, aRawPolys, aFinalPolys );
@ -835,7 +853,9 @@ bool ZONE_FILLER::fillSingleZone( ZONE_CONTAINER* aZone, SHAPE_POLY_SET& aRawPol
aFinalPolys.Inflate( -aZone->GetMinThickness() / 2, ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF ); aFinalPolys.Inflate( -aZone->GetMinThickness() / 2, ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF );
aFinalPolys.Fracture( SHAPE_POLY_SET::PM_FAST ); aFinalPolys.Fracture( SHAPE_POLY_SET::PM_FAST );
} }
#else
computeRawFilledAreas( aZone, smoothedPoly, aRawPolys, aFinalPolys );
#endif
aZone->SetNeedRefill( false ); aZone->SetNeedRefill( false );
return true; return true;
} }
@ -1177,3 +1197,149 @@ void ZONE_FILLER::buildUnconnectedThermalStubsPolygonList( SHAPE_POLY_SET& aCorn
} }
} }
} }
void ZONE_FILLER::addHatchFillTypeOnZone( const ZONE_CONTAINER* aZone, SHAPE_POLY_SET& aRawPolys ) const
{
// Build grid:
// obvously line thickness must be > zone min thickness. However, it should be
// the case because the zone dialog setup ensure that. However, it can happens
// if a board file was edited by hand by a python script
int thickness = std::max( aZone->GetHatchFillTypeThickness(), aZone->GetMinThickness()+2 );
int linethickness = thickness - aZone->GetMinThickness();
int gridsize = thickness + aZone->GetHatchFillTypeGap();
double orientation = aZone->GetHatchFillTypeOrientation();
SHAPE_POLY_SET filledPolys = aRawPolys;
// Use a area that contains the rotated bbox by orientation,
// and after rotate the result by -orientation.
if( orientation != 0.0 )
{
filledPolys.Rotate( M_PI/180.0 * orientation, VECTOR2I( 0,0 ) );
}
BOX2I bbox = filledPolys.BBox( 0 );
// Build hole shape
// the hole size is aZone->GetHatchFillTypeGap(), but because the outline thickness
// is aZone->GetMinThickness(), the hole shape size must be larger
SHAPE_LINE_CHAIN hole_base;
int hole_size = aZone->GetHatchFillTypeGap() + aZone->GetMinThickness();
VECTOR2I corner( 0, 0 );;
hole_base.Append( corner );
corner.x += hole_size;
hole_base.Append( corner );
corner.y += hole_size;
hole_base.Append( corner );
corner.x = 0;
hole_base.Append( corner );
hole_base.SetClosed( true );
// Calculate minimal area of a grid hole.
// All holes smaller than a threshold will be removed
double minimal_hole_area = hole_base.Area() / 2;
// Now convert this hole to a smoothed shape:
if( aZone->GetHatchFillTypeSmoothingLevel() > 0 )
{
// the actual size of chamfer, or rounded corner radius is the half size
// of the HatchFillTypeGap scaled by aZone->GetHatchFillTypeSmoothingValue()
// aZone->GetHatchFillTypeSmoothingValue() = 1.0 is the max value for the chamfer or the
// radius of corner (radius = half size of the hole)
int smooth_value = KiROUND( aZone->GetHatchFillTypeGap()
* aZone->GetHatchFillTypeSmoothingValue() / 2 );
// Minimal optimization:
// make smoothing only for reasonnable smooth values, to avoid a lot of useless segments
// and if the smooth value is small, use chamfer even if fillet is requested
#define SMOOTH_MIN_VAL_MM 0.02
#define SMOOTH_SMALL_VAL_MM 0.04
if( smooth_value > Millimeter2iu( SMOOTH_MIN_VAL_MM ) )
{
SHAPE_POLY_SET smooth_hole;
smooth_hole.AddOutline( hole_base );
int smooth_level = aZone->GetHatchFillTypeSmoothingLevel();
if( smooth_value < Millimeter2iu( SMOOTH_SMALL_VAL_MM ) && smooth_level > 1 )
smooth_level = 1;
// Use a larger smooth_value to compensate the outline tickness
// (chamfer is not visible is smooth value < outline thickess)
smooth_value += aZone->GetMinThickness()/2;
// smooth_value cannot be bigger than the half size oh the hole:
smooth_value = std::min( smooth_value, aZone->GetHatchFillTypeGap()/2 );
// the error to approximate a circle by segments when smoothing corners by a arc
int error_max = std::max( Millimeter2iu( 0.01), smooth_value/20 );
switch( smooth_level )
{
case 1:
// Chamfer() uses the distance from a corner to create a end point
// for the chamfer.
hole_base = smooth_hole.Chamfer( smooth_value ).Outline( 0 );
break;
default:
if( aZone->GetHatchFillTypeSmoothingLevel() > 2 )
error_max /= 2; // Force better smoothing
hole_base = smooth_hole.Fillet( smooth_value, error_max ).Outline( 0 );
break;
case 0:
break;
};
}
}
// Build holes
SHAPE_POLY_SET holes;
for( int xx = 0; ; xx++ )
{
int xpos = xx * gridsize;
if( xpos > bbox.GetWidth() )
break;
for( int yy = 0; ; yy++ )
{
int ypos = yy * gridsize;
if( ypos > bbox.GetHeight() )
break;
// Generate hole
SHAPE_LINE_CHAIN hole( hole_base );
hole.Move( VECTOR2I( xpos, ypos ) );
holes.AddOutline( hole );
}
}
holes.Move( bbox.GetPosition() );
// Clamp holes to the area of filled zones with a outline thickness
// > aZone->GetMinThickness() to be sure the thermal pads can be built
int outline_margin = std::max( (aZone->GetMinThickness()*10)/9, linethickness/2 );
filledPolys.Inflate( -outline_margin, 16 );
holes.BooleanIntersection( filledPolys, SHAPE_POLY_SET::PM_FAST );
if( orientation != 0.0 )
holes.Rotate( -M_PI/180.0 * orientation, VECTOR2I( 0,0 ) );
// Now filter truncated holes to avoid small holes in pattern
// It happens for holes near the zone outline
for( int ii = 0; ii < holes.OutlineCount(); )
{
double area = holes.Outline( ii ).Area();
if( area < minimal_hole_area ) // The current hole is too small: remove it
holes.DeletePolygon( ii );
else
++ii;
}
// create grid. Use SHAPE_POLY_SET::PM_STRICTLY_SIMPLE to
// generate strictly simple polygons needed by Gerber files and Fracture()
aRawPolys.BooleanSubtract( aRawPolys, holes, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
}

View File

@ -114,6 +114,15 @@ private:
bool fillSingleZone( ZONE_CONTAINER* aZone, bool fillSingleZone( ZONE_CONTAINER* aZone,
SHAPE_POLY_SET& aRawPolys, SHAPE_POLY_SET& aFinalPolys ) const; SHAPE_POLY_SET& aRawPolys, SHAPE_POLY_SET& aFinalPolys ) const;
/**
* for zones having the ZONE_FILL_MODE::ZFM_HATCH_PATTERN, create a grid pattern
* in filled areas of aZone, giving to the filled polygons a fill style like a grid
* @param aZone is the zone to modify
* @param aRawPolys: A reference to a SHAPE_POLY_SET buffer containing the initial
* filled areas, and after adding the grid pattern, the modified filled areas with holes
*/
void addHatchFillTypeOnZone( const ZONE_CONTAINER* aZone, SHAPE_POLY_SET& aRawPolys ) const;
BOARD* m_board; BOARD* m_board;
COMMIT* m_commit; COMMIT* m_commit;
WX_PROGRESS_REPORTER* m_progressReporter; WX_PROGRESS_REPORTER* m_progressReporter;

View File

@ -5,9 +5,9 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -47,9 +47,15 @@ ZONE_SETTINGS::ZONE_SETTINGS()
m_ZoneClearance = Mils2iu( ZONE_CLEARANCE_MIL ); m_ZoneClearance = Mils2iu( ZONE_CLEARANCE_MIL );
// Min thickness value in filled areas (this is the minimum width of copper to fill solid areas) : // Min thickness value in filled areas (this is the minimum width of copper to fill solid areas) :
m_ZoneMinThickness = Mils2iu( ZONE_THICKNESS_MIL ); m_ZoneMinThickness = Mils2iu( ZONE_THICKNESS_MIL );
m_NetcodeSelection = 0; // Net code selection for the current zone m_HatchFillTypeThickness = 0; // good value of grid line thickness if m_FillMode = ZFM_GRID_PATTERN
m_CurrentZone_Layer = F_Cu; // Layer used to create the current zone m_HatchFillTypeGap = 0; // good value of grid line gap if m_FillMode = ZFM_GRID_PATTERN
m_Zone_HatchingStyle = ZONE_CONTAINER::DIAGONAL_EDGE; // Option to show the zone area (outlines only, short hatches or full hatches m_HatchFillTypeOrientation = 0.0; // Grid style: orientation of grid lines in degrees
m_HatchFillTypeSmoothingLevel = 0; // Grid pattern smoothing type. 0 = no smoothing
m_HatchFillTypeSmoothingValue = 0.1; // Grid pattern chamfer value relative to the gap value
m_NetcodeSelection = 0; // Net code selection for the current zone
m_CurrentZone_Layer = F_Cu; // Layer used to create the current zone
m_Zone_HatchingStyle = ZONE_CONTAINER::DIAGONAL_EDGE; // Option to show the zone area (outlines only,
//short hatches or full hatches
m_ArcToSegmentsCount = ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF; // Option to select number of segments to approximate a circle m_ArcToSegmentsCount = ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF; // Option to select number of segments to approximate a circle
// ARC_APPROX_SEGMENTS_COUNT_LOW_DEF // ARC_APPROX_SEGMENTS_COUNT_LOW_DEF
@ -80,6 +86,11 @@ ZONE_SETTINGS& ZONE_SETTINGS::operator << ( const ZONE_CONTAINER& aSource )
m_FillMode = aSource.GetFillMode(); m_FillMode = aSource.GetFillMode();
m_ZoneClearance = aSource.GetZoneClearance(); m_ZoneClearance = aSource.GetZoneClearance();
m_ZoneMinThickness = aSource.GetMinThickness(); m_ZoneMinThickness = aSource.GetMinThickness();
m_HatchFillTypeThickness = aSource.GetHatchFillTypeThickness();
m_HatchFillTypeGap = aSource.GetHatchFillTypeGap();
m_HatchFillTypeOrientation = aSource.GetHatchFillTypeOrientation();
m_HatchFillTypeSmoothingLevel = aSource.GetHatchFillTypeSmoothingLevel();
m_HatchFillTypeSmoothingValue = aSource.GetHatchFillTypeSmoothingValue();
m_NetcodeSelection = aSource.GetNetCode(); m_NetcodeSelection = aSource.GetNetCode();
m_Zone_HatchingStyle = aSource.GetHatchStyle(); m_Zone_HatchingStyle = aSource.GetHatchStyle();
m_ArcToSegmentsCount = aSource.GetArcSegmentCount(); m_ArcToSegmentsCount = aSource.GetArcSegmentCount();
@ -106,6 +117,11 @@ void ZONE_SETTINGS::ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport ) c
aTarget.SetFillMode( m_FillMode ); aTarget.SetFillMode( m_FillMode );
aTarget.SetZoneClearance( m_ZoneClearance ); aTarget.SetZoneClearance( m_ZoneClearance );
aTarget.SetMinThickness( m_ZoneMinThickness ); aTarget.SetMinThickness( m_ZoneMinThickness );
aTarget.SetHatchFillTypeThickness( m_HatchFillTypeThickness );
aTarget.SetHatchFillTypeGap( m_HatchFillTypeGap );
aTarget.SetHatchFillTypeOrientation( m_HatchFillTypeOrientation );
aTarget.SetHatchFillTypeSmoothingLevel( m_HatchFillTypeSmoothingLevel );
aTarget.SetHatchFillTypeSmoothingValue( m_HatchFillTypeSmoothingValue );
aTarget.SetArcSegmentCount( m_ArcToSegmentsCount ); aTarget.SetArcSegmentCount( m_ArcToSegmentsCount );
aTarget.SetThermalReliefGap( m_ThermalReliefGap ); aTarget.SetThermalReliefGap( m_ThermalReliefGap );
aTarget.SetThermalReliefCopperBridge( m_ThermalReliefCopperBridge ); aTarget.SetThermalReliefCopperBridge( m_ThermalReliefCopperBridge );

View File

@ -1,8 +1,8 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2008-2014 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr * Copyright (C) 2008-2018 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -35,8 +35,9 @@
enum ZONE_FILL_MODE enum ZONE_FILL_MODE
{ {
ZFM_POLYGONS = 0, // fill zone with polygons ZFM_POLYGONS = 0, // fill zone with polygons
ZFM_SEGMENTS = 1 // fill zone with segments (legacy) ZFM_SEGMENTS = 1, // fill zone with segments (legacy)
ZFM_HATCH_PATTERN = 2 // fill zone using a grid pattern
}; };
/** /**
@ -62,6 +63,14 @@ public:
int m_ZoneClearance; ///< Clearance value int m_ZoneClearance; ///< Clearance value
int m_ZoneMinThickness; ///< Min thickness value in filled areas int m_ZoneMinThickness; ///< Min thickness value in filled areas
int m_HatchFillTypeThickness; ///< Grid style shape: thickness of lines (if 0 -> solid shape)
int m_HatchFillTypeGap; ///< Grid style shape: clearance between lines (0 -> solid shape)
double m_HatchFillTypeOrientation; ///< Grid style shape: orientation of grid lines in degrees
int m_HatchFillTypeSmoothingLevel; ///< Grid pattern smoothing type, similar to corner smoothing type
///< 0 = no smoothing, 1 = fillet, >= 2 = arc
double m_HatchFillTypeSmoothingValue; ///< Grid pattern chamfer distance/fillet value
///< this is the ratio between the gap and the chamfer size
int m_NetcodeSelection; ///< Net code selection for the current zone int m_NetcodeSelection; ///< Net code selection for the current zone
LSET m_Layers; LSET m_Layers;