2014-07-15 16:53:13 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2018-02-18 09:09:13 +00:00
|
|
|
* Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2014-07-15 16:53:13 +00:00
|
|
|
* Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
2023-01-09 13:49:20 +00:00
|
|
|
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2014-07-15 16:53:13 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
2008-09-26 19:51:36 +00:00
|
|
|
|
2021-09-14 22:45:14 +00:00
|
|
|
#include <kiface_base.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <confirm.h>
|
2018-01-29 20:58:58 +00:00
|
|
|
#include <pcb_edit_frame.h>
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <pcbnew_settings.h>
|
2018-05-25 14:56:04 +00:00
|
|
|
#include <widgets/unit_binder.h>
|
2022-07-29 19:56:55 +00:00
|
|
|
#include <wx/statbox.h>
|
2023-01-09 13:49:20 +00:00
|
|
|
#include <wx/statline.h>
|
2022-11-28 20:46:30 +00:00
|
|
|
#include <wx/radiobut.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <zones.h>
|
2008-09-26 19:51:36 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <dialog_non_copper_zones_properties_base.h>
|
2008-09-26 19:51:36 +00:00
|
|
|
|
|
|
|
|
2014-07-15 16:53:13 +00:00
|
|
|
class DIALOG_NON_COPPER_ZONES_EDITOR : public DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE
|
2008-09-26 19:51:36 +00:00
|
|
|
{
|
2022-07-29 19:56:55 +00:00
|
|
|
public:
|
|
|
|
DIALOG_NON_COPPER_ZONES_EDITOR( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* aSettings,
|
|
|
|
CONVERT_SETTINGS* aConvertSettings );
|
2008-09-26 19:51:36 +00:00
|
|
|
|
2022-07-29 19:56:55 +00:00
|
|
|
private:
|
2018-05-25 14:56:04 +00:00
|
|
|
bool TransferDataToWindow() override;
|
|
|
|
bool TransferDataFromWindow() override;
|
2008-09-26 19:51:36 +00:00
|
|
|
|
2018-02-18 09:09:13 +00:00
|
|
|
void OnStyleSelection( wxCommandEvent& event ) override;
|
2018-05-25 14:56:04 +00:00
|
|
|
void OnLayerSelection( wxDataViewEvent& event ) override;
|
2019-04-30 11:16:29 +00:00
|
|
|
void OnUpdateUI( wxUpdateUIEvent& ) override;
|
2014-07-15 16:53:13 +00:00
|
|
|
|
2022-07-29 19:56:55 +00:00
|
|
|
private:
|
|
|
|
PCB_BASE_FRAME* m_parent;
|
|
|
|
ZONE_SETTINGS* m_ptr;
|
|
|
|
ZONE_SETTINGS m_settings; // working copy of zone settings
|
|
|
|
UNIT_BINDER m_outlineHatchPitch;
|
|
|
|
UNIT_BINDER m_minWidth;
|
|
|
|
UNIT_BINDER m_hatchRotation;
|
|
|
|
UNIT_BINDER m_hatchWidth;
|
|
|
|
UNIT_BINDER m_hatchGap;
|
|
|
|
int m_cornerSmoothingType;
|
|
|
|
UNIT_BINDER m_cornerRadius;
|
|
|
|
|
|
|
|
CONVERT_SETTINGS* m_convertSettings;
|
2022-11-28 20:46:30 +00:00
|
|
|
wxRadioButton* m_rbCenterline;
|
|
|
|
wxRadioButton* m_rbEnvelope;
|
2022-07-29 19:56:55 +00:00
|
|
|
wxCheckBox* m_cbDeleteOriginals;
|
2008-09-26 19:51:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2022-07-29 19:56:55 +00:00
|
|
|
int InvokeNonCopperZonesEditor( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* aSettings,
|
|
|
|
CONVERT_SETTINGS* aConvertSettings )
|
2008-09-26 19:51:36 +00:00
|
|
|
{
|
2022-07-29 19:56:55 +00:00
|
|
|
DIALOG_NON_COPPER_ZONES_EDITOR dlg( aParent, aSettings, aConvertSettings );
|
2008-09-26 19:51:36 +00:00
|
|
|
|
2021-02-20 13:06:12 +00:00
|
|
|
return dlg.ShowQuasiModal();
|
2008-09-26 19:51:36 +00:00
|
|
|
}
|
|
|
|
|
2022-09-16 23:25:07 +00:00
|
|
|
#define MIN_THICKNESS 10*pcbIUScale.IU_PER_MILS
|
2009-05-01 16:46:56 +00:00
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR( PCB_BASE_FRAME* aParent,
|
2022-07-29 19:56:55 +00:00
|
|
|
ZONE_SETTINGS* aSettings,
|
|
|
|
CONVERT_SETTINGS* aConvertSettings ) :
|
2018-05-25 14:56:04 +00:00
|
|
|
DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE( aParent ),
|
2022-02-12 17:56:45 +00:00
|
|
|
m_outlineHatchPitch( aParent, m_stBorderHatchPitchText,
|
|
|
|
m_outlineHatchPitchCtrl, m_outlineHatchUnits ),
|
2021-03-12 15:12:49 +00:00
|
|
|
m_minWidth( aParent, m_MinWidthLabel, m_MinWidthCtrl, m_MinWidthUnits ),
|
2021-08-16 11:43:54 +00:00
|
|
|
m_hatchRotation( aParent, m_hatchOrientLabel, m_hatchOrientCtrl, m_hatchOrientUnits ),
|
|
|
|
m_hatchWidth( aParent, m_hatchWidthLabel, m_hatchWidthCtrl, m_hatchWidthUnits),
|
|
|
|
m_hatchGap( aParent, m_hatchGapLabel, m_hatchGapCtrl, m_hatchGapUnits ),
|
2019-04-30 11:16:29 +00:00
|
|
|
m_cornerSmoothingType( ZONE_SETTINGS::SMOOTHING_UNDEFINED ),
|
2022-07-29 19:56:55 +00:00
|
|
|
m_cornerRadius( aParent, m_cornerRadiusLabel, m_cornerRadiusCtrl, m_cornerRadiusUnits ),
|
2022-07-30 23:30:12 +00:00
|
|
|
m_convertSettings( aConvertSettings ),
|
2022-11-28 20:46:30 +00:00
|
|
|
m_rbCenterline( nullptr ),
|
|
|
|
m_rbEnvelope( nullptr ),
|
2022-07-30 23:30:12 +00:00
|
|
|
m_cbDeleteOriginals( nullptr )
|
2008-09-26 19:51:36 +00:00
|
|
|
{
|
2014-07-15 16:53:13 +00:00
|
|
|
m_parent = aParent;
|
2012-02-06 05:44:19 +00:00
|
|
|
|
|
|
|
m_ptr = aSettings;
|
|
|
|
m_settings = *aSettings;
|
2022-02-17 23:54:15 +00:00
|
|
|
|
2022-07-29 19:56:55 +00:00
|
|
|
if( aConvertSettings )
|
|
|
|
{
|
2022-11-28 20:46:30 +00:00
|
|
|
wxStaticBox* bConvertBox = new wxStaticBox( this, wxID_ANY, _( "Conversion Settings" ) );
|
2022-07-29 19:56:55 +00:00
|
|
|
wxStaticBoxSizer* bConvertSizer = new wxStaticBoxSizer( bConvertBox, wxVERTICAL );
|
|
|
|
|
2022-11-28 20:46:30 +00:00
|
|
|
m_rbCenterline = new wxRadioButton( this, wxID_ANY, _( "Use centerlines" ) );
|
|
|
|
bConvertSizer->Add( m_rbCenterline, 0, wxLEFT|wxRIGHT, 5 );
|
2022-07-29 19:56:55 +00:00
|
|
|
|
2022-11-28 20:46:30 +00:00
|
|
|
bConvertSizer->AddSpacer( 2 );
|
|
|
|
m_rbEnvelope = new wxRadioButton( this, wxID_ANY, _( "Create bounding hull" ) );
|
|
|
|
bConvertSizer->Add( m_rbEnvelope, 0, wxLEFT|wxRIGHT, 5 );
|
|
|
|
|
|
|
|
bConvertSizer->AddSpacer( 6 );
|
2023-01-09 13:49:20 +00:00
|
|
|
m_cbDeleteOriginals = new wxCheckBox( this, wxID_ANY,
|
|
|
|
_( "Delete source objects after conversion" ) );
|
2022-07-29 19:56:55 +00:00
|
|
|
bConvertSizer->Add( m_cbDeleteOriginals, 0, wxALL, 5 );
|
|
|
|
|
|
|
|
GetSizer()->Insert( 0, bConvertSizer, 0, wxALL|wxEXPAND, 10 );
|
|
|
|
|
|
|
|
wxStaticLine* line = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
|
|
|
|
wxLI_HORIZONTAL );
|
|
|
|
GetSizer()->Insert( 1, line, 0, wxLEFT|wxRIGHT|wxEXPAND, 10 );
|
|
|
|
|
|
|
|
SetTitle( _( "Convert to Non Copper Zone" ) );
|
|
|
|
}
|
|
|
|
|
2022-02-17 23:54:15 +00:00
|
|
|
bool fpEditorMode = m_parent->IsType( FRAME_FOOTPRINT_EDITOR );
|
|
|
|
|
2022-07-29 19:56:55 +00:00
|
|
|
m_staticTextLayerSelection->SetFont( KIUI::GetInfoFont( this ) );
|
|
|
|
|
2022-02-17 23:54:15 +00:00
|
|
|
m_settings.SetupLayersList( m_layers, m_parent, LSET::AllNonCuMask(), fpEditorMode );
|
2018-07-21 13:42:32 +00:00
|
|
|
|
2021-11-16 19:39:58 +00:00
|
|
|
SetupStandardButtons();
|
2019-03-04 12:06:19 +00:00
|
|
|
|
2020-11-16 11:16:44 +00:00
|
|
|
finishDialogSettings();
|
2008-09-26 19:51:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-04-30 11:16:29 +00:00
|
|
|
void DIALOG_NON_COPPER_ZONES_EDITOR::OnUpdateUI( wxUpdateUIEvent& )
|
|
|
|
{
|
|
|
|
if( m_cornerSmoothingType != m_cornerSmoothingChoice->GetSelection() )
|
|
|
|
{
|
|
|
|
m_cornerSmoothingType = m_cornerSmoothingChoice->GetSelection();
|
|
|
|
|
|
|
|
if( m_cornerSmoothingChoice->GetSelection() == ZONE_SETTINGS::SMOOTHING_CHAMFER )
|
|
|
|
m_cornerRadiusLabel->SetLabel( _( "Chamfer distance:" ) );
|
|
|
|
else
|
|
|
|
m_cornerRadiusLabel->SetLabel( _( "Fillet radius:" ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
m_cornerRadiusCtrl->Enable(m_cornerSmoothingType > ZONE_SETTINGS::SMOOTHING_NONE );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
bool DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataToWindow()
|
2008-09-26 19:51:36 +00:00
|
|
|
{
|
2022-07-29 19:56:55 +00:00
|
|
|
if( m_convertSettings )
|
|
|
|
{
|
2022-11-28 20:46:30 +00:00
|
|
|
if( m_convertSettings->m_Strategy == BOUNDING_HULL )
|
|
|
|
m_rbEnvelope->SetValue( true );
|
|
|
|
else
|
|
|
|
m_rbCenterline->SetValue( true );
|
|
|
|
|
2022-07-29 19:56:55 +00:00
|
|
|
m_cbDeleteOriginals->SetValue( m_convertSettings->m_DeleteOriginals );
|
|
|
|
}
|
|
|
|
|
2019-04-30 11:16:29 +00:00
|
|
|
m_cornerSmoothingChoice->SetSelection( m_settings.GetCornerSmoothingType() );
|
|
|
|
m_cornerRadius.SetValue( m_settings.GetCornerRadius() );
|
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
m_minWidth.SetValue( m_settings.m_ZoneMinThickness );
|
2021-05-06 21:49:07 +00:00
|
|
|
m_cbLocked->SetValue( m_settings.m_Locked );
|
2008-09-26 19:51:36 +00:00
|
|
|
|
2020-08-07 14:04:34 +00:00
|
|
|
switch( m_settings.m_ZoneBorderDisplayStyle )
|
2008-09-26 19:51:36 +00:00
|
|
|
{
|
2020-08-07 14:04:34 +00:00
|
|
|
case ZONE_BORDER_DISPLAY_STYLE::NO_HATCH: m_OutlineDisplayCtrl->SetSelection( 0 ); break;
|
|
|
|
case ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE: m_OutlineDisplayCtrl->SetSelection( 1 ); break;
|
|
|
|
case ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_FULL: m_OutlineDisplayCtrl->SetSelection( 2 ); break;
|
2023-10-13 07:57:21 +00:00
|
|
|
case ZONE_BORDER_DISPLAY_STYLE::INVISIBLE_BORDER: break; // Not used for standard zones
|
2008-09-26 19:51:36 +00:00
|
|
|
}
|
|
|
|
|
2022-02-12 17:56:45 +00:00
|
|
|
m_outlineHatchPitch.SetValue( m_settings.m_BorderHatchPitch );
|
|
|
|
|
2020-08-07 14:04:34 +00:00
|
|
|
SetInitialFocus( m_OutlineDisplayCtrl );
|
2019-03-04 16:34:04 +00:00
|
|
|
|
2018-02-18 09:09:13 +00:00
|
|
|
switch( m_settings.m_FillMode )
|
|
|
|
{
|
2020-08-07 14:04:34 +00:00
|
|
|
case ZONE_FILL_MODE::HATCH_PATTERN: m_GridStyleCtrl->SetSelection( 1 ); break;
|
|
|
|
default: m_GridStyleCtrl->SetSelection( 0 ); break;
|
2018-02-18 09:09:13 +00:00
|
|
|
}
|
|
|
|
|
2021-08-16 11:43:54 +00:00
|
|
|
m_hatchRotation.SetUnits( EDA_UNITS::DEGREES );
|
2022-01-19 00:22:40 +00:00
|
|
|
m_hatchRotation.SetAngleValue( m_settings.m_HatchOrientation );
|
2018-02-18 09:09:13 +00:00
|
|
|
|
|
|
|
// 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
|
2020-08-07 14:04:34 +00:00
|
|
|
int bestvalue = m_settings.m_HatchThickness;
|
2018-02-18 09:09:13 +00:00
|
|
|
|
2021-08-16 11:43:54 +00:00
|
|
|
if( bestvalue <= 0 ) // No defined value for m_hatchWidth
|
2022-09-16 11:33:56 +00:00
|
|
|
bestvalue = std::max( m_settings.m_ZoneMinThickness * 4, pcbIUScale.mmToIU( 1.0 ) );
|
2018-02-18 09:09:13 +00:00
|
|
|
|
2021-08-16 11:43:54 +00:00
|
|
|
m_hatchWidth.SetValue( std::max( bestvalue, m_settings.m_ZoneMinThickness ) );
|
2018-02-18 09:09:13 +00:00
|
|
|
|
2020-08-07 14:04:34 +00:00
|
|
|
bestvalue = m_settings.m_HatchGap;
|
2018-02-18 09:09:13 +00:00
|
|
|
|
2020-08-07 14:04:34 +00:00
|
|
|
if( bestvalue <= 0 ) // No defined value for m_hatchGap
|
2022-09-16 11:33:56 +00:00
|
|
|
bestvalue = std::max( m_settings.m_ZoneMinThickness * 6, pcbIUScale.mmToIU( 1.5 ) );
|
2018-02-18 09:09:13 +00:00
|
|
|
|
2021-08-16 11:43:54 +00:00
|
|
|
m_hatchGap.SetValue( std::max( bestvalue, m_settings.m_ZoneMinThickness ) );
|
2018-02-18 09:09:13 +00:00
|
|
|
|
2020-08-07 14:04:34 +00:00
|
|
|
m_spinCtrlSmoothLevel->SetValue( m_settings.m_HatchSmoothingLevel );
|
|
|
|
m_spinCtrlSmoothValue->SetValue( m_settings.m_HatchSmoothingValue );
|
2018-02-18 09:09:13 +00:00
|
|
|
|
|
|
|
// Enable/Disable some widgets
|
|
|
|
wxCommandEvent event;
|
|
|
|
OnStyleSelection( event );
|
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
return true;
|
|
|
|
}
|
2014-07-15 16:53:13 +00:00
|
|
|
|
|
|
|
|
2018-02-18 09:09:13 +00:00
|
|
|
void DIALOG_NON_COPPER_ZONES_EDITOR::OnStyleSelection( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
bool enable = m_GridStyleCtrl->GetSelection() >= 1;
|
2021-08-16 11:43:54 +00:00
|
|
|
m_hatchRotation.Enable( enable );
|
|
|
|
m_hatchWidth.Enable( enable );
|
|
|
|
m_hatchGap.Enable( enable );
|
|
|
|
m_smoothLevelLabel->Enable( enable );
|
2018-02-18 09:09:13 +00:00
|
|
|
m_spinCtrlSmoothLevel->Enable( enable );
|
2021-08-16 11:43:54 +00:00
|
|
|
m_smoothValueLabel->Enable( enable );
|
2018-02-18 09:09:13 +00:00
|
|
|
m_spinCtrlSmoothValue->Enable( enable );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
void DIALOG_NON_COPPER_ZONES_EDITOR::OnLayerSelection( wxDataViewEvent& event )
|
|
|
|
{
|
|
|
|
if( event.GetColumn() != 0 )
|
|
|
|
return;
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2020-06-24 02:19:08 +00:00
|
|
|
int row = m_layers->ItemToRow( event.GetItem() );
|
|
|
|
bool val = m_layers->GetToggleValue( row, 0 );
|
2014-09-25 07:07:17 +00:00
|
|
|
|
2020-06-24 02:19:08 +00:00
|
|
|
wxVariant layerID;
|
|
|
|
m_layers->GetValue( layerID, row, 2 );
|
|
|
|
m_settings.m_Layers.set( ToLAYER_ID( layerID.GetInteger() ), val );
|
2008-09-26 19:51:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
bool DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataFromWindow()
|
2008-09-26 19:51:36 +00:00
|
|
|
{
|
2022-07-29 19:56:55 +00:00
|
|
|
if( m_convertSettings )
|
|
|
|
{
|
2022-11-28 20:46:30 +00:00
|
|
|
if( m_rbEnvelope->GetValue() )
|
|
|
|
m_convertSettings->m_Strategy = BOUNDING_HULL;
|
|
|
|
else
|
|
|
|
m_convertSettings->m_Strategy = CENTERLINE;
|
|
|
|
|
2022-07-29 19:56:55 +00:00
|
|
|
m_convertSettings->m_DeleteOriginals = m_cbDeleteOriginals->GetValue();
|
|
|
|
}
|
|
|
|
|
2019-04-30 11:16:29 +00:00
|
|
|
m_settings.SetCornerSmoothingType( m_cornerSmoothingChoice->GetSelection() );
|
|
|
|
|
|
|
|
m_settings.SetCornerRadius( m_settings.GetCornerSmoothingType() == ZONE_SETTINGS::SMOOTHING_NONE
|
|
|
|
? 0 : m_cornerRadius.GetValue() );
|
|
|
|
|
2018-02-18 09:09:13 +00:00
|
|
|
m_settings.m_ZoneMinThickness = m_minWidth.GetValue();
|
2009-05-01 16:46:56 +00:00
|
|
|
|
2020-08-07 14:04:34 +00:00
|
|
|
switch( m_OutlineDisplayCtrl->GetSelection() )
|
2008-09-26 19:51:36 +00:00
|
|
|
{
|
2020-08-07 14:04:34 +00:00
|
|
|
case 0: m_settings.m_ZoneBorderDisplayStyle = ZONE_BORDER_DISPLAY_STYLE::NO_HATCH; break;
|
|
|
|
case 1: m_settings.m_ZoneBorderDisplayStyle = ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_EDGE; break;
|
|
|
|
case 2: m_settings.m_ZoneBorderDisplayStyle = ZONE_BORDER_DISPLAY_STYLE::DIAGONAL_FULL; break;
|
2008-09-26 19:51:36 +00:00
|
|
|
}
|
|
|
|
|
2022-09-16 11:33:56 +00:00
|
|
|
if( !m_outlineHatchPitch.Validate( pcbIUScale.mmToIU( ZONE_BORDER_HATCH_MINDIST_MM ),
|
|
|
|
pcbIUScale.mmToIU( ZONE_BORDER_HATCH_MAXDIST_MM ) ) )
|
2022-02-12 17:56:45 +00:00
|
|
|
return false;
|
|
|
|
|
|
|
|
m_settings.m_BorderHatchPitch = m_outlineHatchPitch.GetValue();
|
|
|
|
|
2018-02-18 09:09:13 +00:00
|
|
|
if( m_GridStyleCtrl->GetSelection() > 0 )
|
2019-12-20 14:11:39 +00:00
|
|
|
m_settings.m_FillMode = ZONE_FILL_MODE::HATCH_PATTERN;
|
2018-02-18 09:09:13 +00:00
|
|
|
else
|
2019-12-20 14:11:39 +00:00
|
|
|
m_settings.m_FillMode = ZONE_FILL_MODE::POLYGONS;
|
2018-02-18 09:09:13 +00:00
|
|
|
|
|
|
|
|
2019-12-20 14:11:39 +00:00
|
|
|
if( m_settings.m_FillMode == ZONE_FILL_MODE::HATCH_PATTERN )
|
2018-02-18 09:09:13 +00:00
|
|
|
{
|
|
|
|
int minThickness = m_minWidth.GetValue();
|
|
|
|
|
2021-08-16 11:43:54 +00:00
|
|
|
if( !m_hatchWidth.Validate( minThickness, INT_MAX ) )
|
2018-02-18 09:09:13 +00:00
|
|
|
return false;
|
|
|
|
|
2021-08-16 11:43:54 +00:00
|
|
|
if( !m_hatchGap.Validate( minThickness, INT_MAX ) )
|
2018-02-18 09:09:13 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-01-19 00:22:40 +00:00
|
|
|
m_settings.m_HatchOrientation = m_hatchRotation.GetAngleValue();
|
2021-08-16 11:43:54 +00:00
|
|
|
m_settings.m_HatchThickness = m_hatchWidth.GetValue();
|
|
|
|
m_settings.m_HatchGap = m_hatchGap.GetValue();
|
2020-08-07 14:04:34 +00:00
|
|
|
m_settings.m_HatchSmoothingLevel = m_spinCtrlSmoothLevel->GetValue();
|
|
|
|
m_settings.m_HatchSmoothingValue = m_spinCtrlSmoothValue->GetValue();
|
2018-02-18 09:09:13 +00:00
|
|
|
|
2021-05-06 21:49:07 +00:00
|
|
|
m_settings.m_Locked = m_cbLocked->GetValue();
|
2008-09-26 19:51:36 +00:00
|
|
|
|
2012-02-06 05:44:19 +00:00
|
|
|
// Get the layer selection for this zone
|
2018-05-25 14:56:04 +00:00
|
|
|
int layer = -1;
|
2018-07-04 12:28:48 +00:00
|
|
|
for( int ii = 0; ii < m_layers->GetItemCount(); ++ii )
|
2008-09-26 19:51:36 +00:00
|
|
|
{
|
2018-07-04 12:28:48 +00:00
|
|
|
if( m_layers->GetToggleValue( (unsigned) ii, 0 ) )
|
2018-05-25 14:56:04 +00:00
|
|
|
{
|
|
|
|
layer = ii;
|
|
|
|
break;
|
|
|
|
}
|
2008-09-26 19:51:36 +00:00
|
|
|
}
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2018-05-25 14:56:04 +00:00
|
|
|
if( layer < 0 )
|
|
|
|
{
|
|
|
|
DisplayError( this, _( "No layer selected." ) );
|
|
|
|
return false;
|
|
|
|
}
|
2012-02-06 05:44:19 +00:00
|
|
|
|
|
|
|
*m_ptr = m_settings;
|
2018-05-25 14:56:04 +00:00
|
|
|
return true;
|
2008-09-26 19:51:36 +00:00
|
|
|
}
|
2012-02-06 05:44:19 +00:00
|
|
|
|
2014-07-15 16:53:13 +00:00
|
|
|
|