diff --git a/pcbnew/dialogs/dialog_copper_zones.cpp b/pcbnew/dialogs/dialog_copper_zones.cpp index 3247dcd849..43888f3730 100644 --- a/pcbnew/dialogs/dialog_copper_zones.cpp +++ b/pcbnew/dialogs/dialog_copper_zones.cpp @@ -1,13 +1,9 @@ -/** - * @file dialog_copper_zones.cpp - */ - /* * 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) 2012 SoftPLC Corporation, Dick Hollenbeck - * 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 * modify it under the terms of the GNU General Public License @@ -27,31 +23,19 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include #include #include #include -#include -#include #include #include -#include -#include #include -#include - +#include #include #include + #include -#include // needed for wx/listctrl.h, in wxGTK 2.8.12 -#include -#include -/** - * Class DIALOG_COPPER_ZONE - * is the derived class from dialog_copper_zone_frame created by wxFormBuilder - */ class DIALOG_COPPER_ZONE : public DIALOG_COPPER_ZONE_BASE { public: @@ -59,97 +43,77 @@ public: private: PCB_BASE_FRAME* m_Parent; - wxConfigBase* m_Config; ///< Current config + wxConfigBase* m_Config; // Current config - ZONE_EDIT_T m_OnExitCode; ///< exit code: ZONE_ABORT if no change, - ///< ZONE_OK if new values accepted - ///< ZONE_EXPORT_VALUES if values are exported to others zones + bool m_settingsExported; // settings were written to all other zones ZONE_SETTINGS m_settings; ZONE_SETTINGS* m_ptr; - bool m_NetSortingByPadCount; ///< false = alphabetic sort. - ///< true = pad count sort. - + bool m_NetSortingByPadCount; long m_NetFiltering; + static wxString m_netNameShowFilter; // the filter to show nets (default * "*"). + // static to keep this pattern for an entire Pcbnew session + UNIT_BINDER m_cornerRadius; + UNIT_BINDER m_clearance; + UNIT_BINDER m_minWidth; + UNIT_BINDER m_antipadClearance ; + UNIT_BINDER m_spokeWidth; - std::vector m_LayerId; ///< Handle the real layer number from layer - ///< name position in m_LayerSelectionCtrl - - static wxString m_netNameShowFilter; ///< the filter to show nets (default * "*"). - ///< static to keep this pattern for an entire Pcbnew session - - /** - * Function initDialog - * fills in the dialog controls using the current settings. - */ - void initDialog(); - - void OnButtonOkClick( wxCommandEvent& event ) override; - void OnButtonCancelClick( wxCommandEvent& event ) override; - void OnClose( wxCloseEvent& event ) override; - void OnCornerSmoothingModeChoice( wxCommandEvent& event ) override; - void OnUpdateUI( wxUpdateUIEvent& ) override; + bool TransferDataToWindow() override; + bool TransferDataFromWindow() override; /** * Function AcceptOptions - * @param aPromptForErrors is true to prompt user on incorrect params. * @param aUseExportableSetupOnly is true to use exportable parameters only (used to export this setup to other zones). * @return bool - false if incorrect options, true if ok. */ - bool AcceptOptions( bool aPromptForErrors, bool aUseExportableSetupOnly = false ); + bool AcceptOptions( bool aUseExportableSetupOnly = false ); + void OnLayerSelection( wxDataViewEvent& event ) override; void OnNetSortingOptionSelected( wxCommandEvent& event ) override; void ExportSetupToOtherCopperZones( wxCommandEvent& event ) override; - void OnPadsInZoneClick( wxCommandEvent& event ) override; void OnRunFiltersButtonClick( wxCommandEvent& event ) override; + void OnUpdateUI( wxUpdateUIEvent& ) override; + void OnButtonCancelClick( wxCommandEvent& event ) override; + void OnClose( wxCloseEvent& event ) override; void buildAvailableListOfNets(); - - /** - * Function initListNetsParams - * initializes m_NetSortingByPadCount and m_NetFiltering values - * according to m_NetDisplayOption selection. - */ - void initListNetsParams(); }; -const static wxSize LAYER_BITMAP_SIZE( 20, 14 ); - // Initialize static member variables wxString DIALOG_COPPER_ZONE::m_netNameShowFilter( wxT( "*" ) ); -ZONE_EDIT_T InvokeCopperZonesEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSettings ) +int InvokeCopperZonesEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSettings ) { DIALOG_COPPER_ZONE dlg( aCaller, aSettings ); - ZONE_EDIT_T result = ZONE_EDIT_T( dlg.ShowModal() ); - return result; + return dlg.ShowModal(); } DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* aSettings ) : - DIALOG_COPPER_ZONE_BASE( aParent ) + DIALOG_COPPER_ZONE_BASE( aParent ), + m_cornerRadius( aParent, m_cornerRadiusLabel, m_cornerRadiusCtrl, m_cornerRadiusUnits, true, 0 ), + m_clearance( aParent, m_clearanceLabel, m_clearanceCtrl, m_clearanceUnits, true, 0, ZONE_CLEARANCE_MAX_VALUE_MIL*IU_PER_MILS ), + m_minWidth( aParent, m_minWidthLabel, m_minWidthCtrl, m_minWidthUnits, true, ZONE_THICKNESS_MIN_VALUE_MIL*IU_PER_MILS ), + m_antipadClearance( aParent, m_antipadLabel, m_antipadCtrl, m_antipadUnits, true, 0 ), + m_spokeWidth( aParent, m_spokeWidthLabel, m_spokeWidthCtrl, m_spokeWidthUnits, true, 0 ) { m_Parent = aParent; m_Config = Kiface().KifaceSettings(); + m_bitmapNoNetWarning->SetBitmap( KiBitmap( dialog_warning_xpm ) ); m_ptr = aSettings; m_settings = *aSettings; + m_settings.SetupLayersList( m_layers, m_Parent, true ); + m_settingsExported = false; + + m_NetFiltering = false; m_NetSortingByPadCount = true; // false = alphabetic sort, true = pad count sort - m_OnExitCode = ZONE_ABORT; - - SetReturnCode( ZONE_ABORT ); // Will be changed on buttons click - - // Fix static text widget minimum width to a suitable value so that - // resizing the dialog is not necessary when changing the corner smoothing type. - // Depends on the default text in the widget. - m_cornerSmoothingValue->SetMinSize( m_cornerSmoothingValue->GetSize() ); - - initDialog(); m_sdbSizerOK->SetDefault(); @@ -157,294 +121,165 @@ DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* } -void DIALOG_COPPER_ZONE::initDialog() +bool DIALOG_COPPER_ZONE::TransferDataToWindow() { - BOARD* board = m_Parent->GetBoard(); - - m_bitmapNoNetWarning->SetBitmap( KiBitmap( dialog_warning_xpm ) ); - - wxString msg; - - if( m_settings.m_Zone_45_Only ) - m_OrientEdgesOpt->SetSelection( 1 ); - - m_FillModeCtrl->SetSelection( m_settings.m_FillMode == ZFM_SEGMENTS ? 1 : 0 ); - - AddUnitSymbol( *m_ClearanceValueTitle, g_UserUnit ); - msg = StringFromValue( g_UserUnit, m_settings.m_ZoneClearance ); - m_ZoneClearanceCtrl->SetValue( msg ); - - AddUnitSymbol( *m_MinThicknessValueTitle, g_UserUnit ); - msg = StringFromValue( g_UserUnit, m_settings.m_ZoneMinThickness ); - m_ZoneMinThicknessCtrl->SetValue( msg ); - - switch( m_settings.GetPadConnection() ) - { - case PAD_ZONE_CONN_THT_THERMAL: // Thermals only for THT pads - m_PadInZoneOpt->SetSelection( 2 ); - break; - - case PAD_ZONE_CONN_NONE: // Pads are not covered - m_PadInZoneOpt->SetSelection( 3 ); - break; - - default: - case PAD_ZONE_CONN_THERMAL: // Use thermal relief for pads - m_PadInZoneOpt->SetSelection( 1 ); - break; - - case PAD_ZONE_CONN_FULL: // pads are covered by copper - m_PadInZoneOpt->SetSelection( 0 ); - break; - } - - m_PriorityLevelCtrl->SetValue( m_settings.m_ZonePriority ); - - AddUnitSymbol( *m_AntipadSizeText, g_UserUnit ); - AddUnitSymbol( *m_CopperBridgeWidthText, g_UserUnit ); - PutValueInLocalUnits( *m_AntipadSizeValue, m_settings.m_ThermalReliefGap ); - PutValueInLocalUnits( *m_CopperWidthValue, m_settings.m_ThermalReliefCopperBridge ); - + m_constrainOutline->SetValue( m_settings.m_Zone_45_Only ); m_cornerSmoothingChoice->SetSelection( m_settings.GetCornerSmoothingType() ); - - PutValueInLocalUnits( *m_cornerSmoothingCtrl, m_settings.GetCornerRadius() ); + m_cornerRadius.SetValue( m_settings.GetCornerRadius() ); + m_PriorityLevelCtrl->SetValue( m_settings.m_ZonePriority ); switch( m_settings.m_Zone_HatchingStyle ) { - case ZONE_CONTAINER::NO_HATCH: - m_OutlineAppearanceCtrl->SetSelection( 0 ); - break; - - case ZONE_CONTAINER::DIAGONAL_EDGE: - m_OutlineAppearanceCtrl->SetSelection( 1 ); - break; - - case ZONE_CONTAINER::DIAGONAL_FULL: - m_OutlineAppearanceCtrl->SetSelection( 2 ); - break; + case ZONE_CONTAINER::NO_HATCH: m_OutlineAppearanceCtrl->SetSelection( 0 ); break; + case ZONE_CONTAINER::DIAGONAL_EDGE: m_OutlineAppearanceCtrl->SetSelection( 1 ); break; + case ZONE_CONTAINER::DIAGONAL_FULL: m_OutlineAppearanceCtrl->SetSelection( 2 ); break; } - m_ArcApproximationOpt->SetSelection( - m_settings.m_ArcToSegmentsCount == ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF ? 1 : 0 ); + m_clearance.SetValue( m_settings.m_ZoneClearance ); + m_minWidth.SetValue( m_settings.m_ZoneMinThickness ); - // Create one column in m_LayerSelectionCtrl - wxListItem column0; - column0.SetId( 0 ); - m_LayerSelectionCtrl->InsertColumn( 0, column0 ); - - wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE.x, LAYER_BITMAP_SIZE.y ); - m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL ); - - int ctrlWidth = 0; // Min width for m_LayerSelectionCtrl to show the layers names - int imgIdx = 0; - - LSET cu_set = LSET::AllCuMask( board->GetCopperLayerCount() ); - - COLOR4D backgroundColor = m_Parent->Settings().Colors().GetLayerColor( LAYER_PCB_BACKGROUND ); - for( LSEQ cu_stack = cu_set.UIOrder(); cu_stack; ++cu_stack, imgIdx++ ) + switch( m_settings.GetPadConnection() ) { - PCB_LAYER_ID layer = *cu_stack; - - m_LayerId.push_back( layer ); - - msg = board->GetLayerName( layer ); - msg.Trim(); - wxSize tsize( GetTextSize( msg, m_LayerSelectionCtrl ) ); - ctrlWidth = std::max( ctrlWidth, tsize.x ); - - COLOR4D layerColor = m_Parent->Settings().Colors().GetLayerColor( layer ); - imageList->Add( COLOR_SWATCH::MakeBitmap( layerColor, backgroundColor, LAYER_BITMAP_SIZE ) ); - - int itemIndex = m_LayerSelectionCtrl->GetItemCount(); - m_LayerSelectionCtrl->InsertItem( itemIndex, msg, imgIdx ); - - if( m_settings.m_CurrentZone_Layer == layer ) - m_LayerSelectionCtrl->Select( itemIndex ); + default: + case PAD_ZONE_CONN_THERMAL: m_PadInZoneOpt->SetSelection( 1 ); break; + case PAD_ZONE_CONN_THT_THERMAL: m_PadInZoneOpt->SetSelection( 2 ); break; + case PAD_ZONE_CONN_NONE: m_PadInZoneOpt->SetSelection( 3 ); break; + case PAD_ZONE_CONN_FULL: m_PadInZoneOpt->SetSelection( 0 ); break; } - // The most easy way to ensure the right size is to use wxLIST_AUTOSIZE - // unfortunately this option does not work well both on - // wxWidgets 2.8 ( column width too small), and - // wxWidgets 2.9 ( column width too large) - ctrlWidth += LAYER_BITMAP_SIZE.x + 25; // Add bitmap width + margin before text - m_LayerSelectionCtrl->SetColumnWidth( 0, ctrlWidth ); - - ctrlWidth += 25; // Add margin after text + width for scroll bar - m_LayerSelectionCtrl->SetMinSize( wxSize( ctrlWidth, -1 ) ); + // Do not enable/disable antipad clearance and spoke width. They might be needed if + // a module or pad overrides the zone to specify a thermal connection. + m_antipadClearance.SetValue( m_settings.m_ThermalReliefGap ); + m_spokeWidth.SetValue( m_settings.m_ThermalReliefCopperBridge ); wxString netNameDoNotShowFilter = wxT( "Net-*" ); + m_NetFiltering = false; + m_NetSortingByPadCount = true; + if( m_Config ) { int opt = m_Config->Read( ZONE_NET_SORT_OPTION_KEY, 1l ); - m_NetDisplayOption->SetSelection( opt ); + m_NetFiltering = opt >= 2; + m_NetSortingByPadCount = opt % 2; m_Config->Read( ZONE_NET_FILTER_STRING_KEY, netNameDoNotShowFilter ); } - else - m_NetDisplayOption->SetSelection( 1 ); m_ShowNetNameFilter->SetValue( m_netNameShowFilter ); - initListNetsParams(); + m_DoNotShowNetNameFilter->SetValue( netNameDoNotShowFilter ); + m_showAllNetsOpt->SetValue( !m_NetFiltering ); + m_sortByPadsOpt->SetValue( m_NetSortingByPadCount ); // Build list of nets: - m_DoNotShowNetNameFilter->SetValue( netNameDoNotShowFilter ); buildAvailableListOfNets(); - wxCommandEvent event; - OnCornerSmoothingModeChoice( event ); + return true; } void DIALOG_COPPER_ZONE::OnUpdateUI( wxUpdateUIEvent& ) { + if( m_ListNetNameSelection->GetSelection() < 0 ) + m_ListNetNameSelection->SetSelection( 0 ); + m_bNoNetWarning->Show( m_ListNetNameSelection->GetSelection() == 0 ); + + if( m_cornerSmoothingChoice->GetSelection() == ZONE_SETTINGS::SMOOTHING_CHAMFER ) + m_cornerRadiusLabel->SetLabel( _( "Chamfer distance:" ) ); + else + m_cornerRadiusLabel->SetLabel( _( "Fillet radius:" ) ); } + void DIALOG_COPPER_ZONE::OnButtonCancelClick( wxCommandEvent& event ) { + // After an "Export Settings to Other Zones" cancel and close must return + // ZONE_EXPORT_VALUES instead of wxID_CANCEL. Close( true ); } -void DIALOG_COPPER_ZONE::OnButtonOkClick( wxCommandEvent& event ) + +bool DIALOG_COPPER_ZONE::TransferDataFromWindow() { m_netNameShowFilter = m_ShowNetNameFilter->GetValue(); - if( AcceptOptions( true ) ) - { - *m_ptr = m_settings; - EndModal( ZONE_OK ); - } + if( !AcceptOptions() ) + return false; + + *m_ptr = m_settings; + return true; } - -// called on system close button void DIALOG_COPPER_ZONE::OnClose( wxCloseEvent& event ) { - if( m_OnExitCode != ZONE_ABORT ) - *m_ptr = m_settings; - - EndModal( m_OnExitCode ); + EndModal( m_settingsExported ? ZONE_EXPORT_VALUES : wxID_CANCEL ); } -bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportableSetupOnly ) +bool DIALOG_COPPER_ZONE::AcceptOptions( bool aUseExportableSetupOnly ) { + if( m_settings.m_FillMode == ZFM_SEGMENTS ) + { + KIDIALOG dlg( this, _( "The legacy segment fill mode is not recommended." + "Convert zone to polygon fill? "), _( "Legacy Warning" ), + wxYES_NO | wxICON_WARNING ); + dlg.DoNotShowCheckbox(); + + if( dlg.ShowModal() == wxYES ) + m_settings.m_FillMode = ZFM_POLYGONS; + } + switch( m_PadInZoneOpt->GetSelection() ) { - case 3: - // Pads are not covered - m_settings.SetPadConnection( PAD_ZONE_CONN_NONE ); - break; - - case 2: - // Use thermal relief for THT pads - m_settings.SetPadConnection( PAD_ZONE_CONN_THT_THERMAL ); - break; - - case 1: - // Use thermal relief for pads - m_settings.SetPadConnection( PAD_ZONE_CONN_THERMAL ); - break; - - case 0: - // pads are covered by copper - m_settings.SetPadConnection( PAD_ZONE_CONN_FULL ); - break; + case 3: m_settings.SetPadConnection( PAD_ZONE_CONN_NONE ); break; + case 2: m_settings.SetPadConnection( PAD_ZONE_CONN_THT_THERMAL ); break; + case 1: m_settings.SetPadConnection( PAD_ZONE_CONN_THERMAL ); break; + case 0: m_settings.SetPadConnection( PAD_ZONE_CONN_FULL ); break; } switch( m_OutlineAppearanceCtrl->GetSelection() ) { - case 0: - m_settings.m_Zone_HatchingStyle = ZONE_CONTAINER::NO_HATCH; - break; - - case 1: - m_settings.m_Zone_HatchingStyle = ZONE_CONTAINER::DIAGONAL_EDGE; - break; - - case 2: - m_settings.m_Zone_HatchingStyle = ZONE_CONTAINER::DIAGONAL_FULL; - break; + case 0: m_settings.m_Zone_HatchingStyle = ZONE_CONTAINER::NO_HATCH; break; + case 1: m_settings.m_Zone_HatchingStyle = ZONE_CONTAINER::DIAGONAL_EDGE; break; + case 2: m_settings.m_Zone_HatchingStyle = ZONE_CONTAINER::DIAGONAL_FULL; break; } - m_settings.m_ArcToSegmentsCount = m_ArcApproximationOpt->GetSelection() == 1 ? - ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF : - ARC_APPROX_SEGMENTS_COUNT_LOW_DEF; - if( m_Config ) { - m_Config->Write( ZONE_NET_OUTLINES_HATCH_OPTION_KEY, - (long) m_settings.m_Zone_HatchingStyle ); + m_Config->Write( ZONE_NET_OUTLINES_STYLE_KEY, (long) m_settings.m_Zone_HatchingStyle ); wxString filter = m_DoNotShowNetNameFilter->GetValue(); m_Config->Write( ZONE_NET_FILTER_STRING_KEY, filter ); } m_netNameShowFilter = m_ShowNetNameFilter->GetValue(); - m_settings.m_FillMode = (m_FillModeCtrl->GetSelection() == 0) ? ZFM_POLYGONS : ZFM_SEGMENTS; - wxString txtvalue = m_ZoneClearanceCtrl->GetValue(); - m_settings.m_ZoneClearance = ValueFromString( g_UserUnit, txtvalue ); - - // Test if this is a reasonable value for this parameter - // A too large value can hang Pcbnew - #define CLEARANCE_MAX_VALUE ZONE_CLEARANCE_MAX_VALUE_MIL*IU_PER_MILS - - if( m_settings.m_ZoneClearance > CLEARANCE_MAX_VALUE ) - { - wxString msg; - msg.Printf( _( "Clearance must be smaller than %f\" / %f mm." ), - ZONE_CLEARANCE_MAX_VALUE_MIL / 1000.0, ZONE_CLEARANCE_MAX_VALUE_MIL * 0.0254 ); - DisplayError( this, msg ); + if( !m_clearance.Validate( true ) ) return false; - } + m_settings.m_ZoneClearance = m_clearance.GetValue(); - txtvalue = m_ZoneMinThicknessCtrl->GetValue(); - m_settings.m_ZoneMinThickness = ValueFromString( g_UserUnit, txtvalue ); - - if( m_settings.m_ZoneMinThickness < (ZONE_THICKNESS_MIN_VALUE_MIL*IU_PER_MILS) ) - { - wxString msg; - msg.Printf( _( "Minimum width must be larger than %f\" / %f mm." ), - ZONE_THICKNESS_MIN_VALUE_MIL / 1000.0, ZONE_THICKNESS_MIN_VALUE_MIL * 0.0254 ); - DisplayError( this, msg ); + if( !m_minWidth.Validate( true ) ) return false; - } + m_settings.m_ZoneMinThickness = m_minWidth.GetValue(); m_settings.SetCornerSmoothingType( m_cornerSmoothingChoice->GetSelection() ); - txtvalue = m_cornerSmoothingCtrl->GetValue(); - m_settings.SetCornerRadius( ValueFromString( g_UserUnit, txtvalue ) ); + m_settings.SetCornerRadius( m_cornerRadius.GetValue() ); m_settings.m_ZonePriority = m_PriorityLevelCtrl->GetValue(); - if( m_OrientEdgesOpt->GetSelection() == 0 ) - m_settings.m_Zone_45_Only = false; - else - m_settings.m_Zone_45_Only = true; + m_settings.m_Zone_45_Only = m_constrainOutline->GetValue(); - m_settings.m_ThermalReliefGap = ValueFromTextCtrl( *m_AntipadSizeValue ); - m_settings.m_ThermalReliefCopperBridge = ValueFromTextCtrl( *m_CopperWidthValue ); + m_settings.m_ThermalReliefGap = m_antipadClearance.GetValue(); + m_settings.m_ThermalReliefCopperBridge = m_spokeWidth.GetValue(); if( m_Config ) { ConfigBaseWriteDouble( m_Config, ZONE_CLEARANCE_WIDTH_STRING_KEY, (double) m_settings.m_ZoneClearance / IU_PER_MILS ); - ConfigBaseWriteDouble( m_Config, ZONE_MIN_THICKNESS_WIDTH_STRING_KEY, - (double) m_settings.m_ZoneMinThickness / IU_PER_MILS ); - + (double) m_settings.m_ZoneMinThickness / IU_PER_MILS ); ConfigBaseWriteDouble( m_Config, ZONE_THERMAL_RELIEF_GAP_STRING_KEY, - (double) m_settings.m_ThermalReliefGap / IU_PER_MILS ); - + (double) m_settings.m_ThermalReliefGap / IU_PER_MILS ); ConfigBaseWriteDouble( m_Config, ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY, - (double) m_settings.m_ThermalReliefCopperBridge / IU_PER_MILS ); - } - - if( ( m_settings.GetPadConnection() == PAD_ZONE_CONN_THT_THERMAL - || m_settings.GetPadConnection() == PAD_ZONE_CONN_THERMAL ) - && m_settings.m_ThermalReliefCopperBridge <= m_settings.m_ZoneMinThickness ) - { - DisplayError( this, - _( "Thermal relief spoke must be greater than the minimum width." ) ); - return false; + (double) m_settings.m_ThermalReliefCopperBridge / IU_PER_MILS ); } // If we use only exportable to others zones parameters, exit here: @@ -452,78 +287,73 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab return true; // Get the layer selection for this zone - int ii = m_LayerSelectionCtrl->GetFirstSelected(); + int layer = -1; + for( int ii = 0; ii < m_layers->GetItemCount(); ++ii ) + { + if( m_layers->GetToggleValue( (unsigned) ii, 0 ) ) + { + layer = ii; + break; + } + } - if( ii < 0 && aPromptForErrors ) + if( layer < 0 ) { DisplayError( this, _( "No layer selected." ) ); return false; } - m_settings.m_CurrentZone_Layer = ToLAYER_ID( m_LayerId[ii] ); - - // Get the net name selection for this zone - ii = m_ListNetNameSelection->GetSelection(); - - if( ii < 0 && aPromptForErrors ) - { - DisplayError( this, _( "No net selected." ) ); - return false; - } - - wxString net_name = m_ListNetNameSelection->GetString( ii ); - - m_settings.m_NetcodeSelection = 0; + NETINFO_ITEM* net = nullptr; // Search net_code for this net, if a net was selected if( m_ListNetNameSelection->GetSelection() > 0 ) - { - NETINFO_ITEM* net = m_Parent->GetBoard()->FindNet( net_name ); + net = m_Parent->GetBoard()->FindNet( m_ListNetNameSelection->GetStringSelection() ); - if( net ) - m_settings.m_NetcodeSelection = net->GetNet(); - } + m_settings.m_NetcodeSelection = net ? net->GetNet() : 0; return true; } -void DIALOG_COPPER_ZONE::OnCornerSmoothingModeChoice( wxCommandEvent& event ) +void DIALOG_COPPER_ZONE::OnLayerSelection( wxDataViewEvent& event ) { - int selection = m_cornerSmoothingChoice->GetSelection(); + if( event.GetColumn() != 0 ) + return; - switch( selection ) + int row = m_layers->ItemToRow( event.GetItem() ); + + if( m_layers->GetToggleValue( row, 0 ) ) { - case ZONE_SETTINGS::SMOOTHING_NONE: - m_cornerSmoothingValue->Enable( false ); - m_cornerSmoothingCtrl->Enable( false ); - break; - case ZONE_SETTINGS::SMOOTHING_CHAMFER: - m_cornerSmoothingValue->Enable( true ); - m_cornerSmoothingCtrl->Enable( true ); - m_cornerSmoothingValue->SetLabel( _( "Chamfer distance" ) ); - AddUnitSymbol( *m_cornerSmoothingValue, g_UserUnit ); - break; - case ZONE_SETTINGS::SMOOTHING_FILLET: - m_cornerSmoothingValue->Enable( true ); - m_cornerSmoothingCtrl->Enable( true ); - m_cornerSmoothingValue->SetLabel( _( "Fillet radius" ) ); - AddUnitSymbol( *m_cornerSmoothingValue, g_UserUnit ); - break; + wxVariant layerID; + m_layers->GetValue( layerID, row, 2 ); + m_settings.m_CurrentZone_Layer = ToLAYER_ID( layerID.GetInteger() ); + + // Turn all other checkboxes off. + for( int ii = 0; ii < m_layers->GetItemCount(); ++ii ) + { + if( ii != row ) + m_layers->SetToggleValue( false, ii, 0 ); + } } } void DIALOG_COPPER_ZONE::OnNetSortingOptionSelected( wxCommandEvent& event ) { - initListNetsParams(); - buildAvailableListOfNets(); - + m_NetFiltering = !m_showAllNetsOpt->GetValue(); + m_NetSortingByPadCount = m_sortByPadsOpt->GetValue(); m_netNameShowFilter = m_ShowNetNameFilter->GetValue(); + buildAvailableListOfNets(); + if( m_Config ) { - m_Config->Write( ZONE_NET_SORT_OPTION_KEY, (long) m_NetDisplayOption->GetSelection() ); + long configValue = m_NetFiltering ? 2 : 0; + + if( m_NetSortingByPadCount ) + configValue += 1; + + m_Config->Write( ZONE_NET_SORT_OPTION_KEY, configValue ); wxString Filter = m_DoNotShowNetNameFilter->GetValue(); m_Config->Write( ZONE_NET_FILTER_STRING_KEY, Filter ); } @@ -532,7 +362,7 @@ void DIALOG_COPPER_ZONE::OnNetSortingOptionSelected( wxCommandEvent& event ) void DIALOG_COPPER_ZONE::ExportSetupToOtherCopperZones( wxCommandEvent& event ) { - if( !AcceptOptions( true, true ) ) + if( !AcceptOptions( true ) ) return; // Export settings ( but layer and netcode ) to others copper zones @@ -548,61 +378,17 @@ void DIALOG_COPPER_ZONE::ExportSetupToOtherCopperZones( wxCommandEvent& event ) continue; m_settings.ExportSetting( *zone, false ); // false = partial export + m_settingsExported = true; m_Parent->OnModify(); } - - m_OnExitCode = ZONE_EXPORT_VALUES; // values are exported to others zones -} - - -void DIALOG_COPPER_ZONE::OnPadsInZoneClick( wxCommandEvent& event ) -{ - // Antipad and spokes are significant only for thermals - // However, even if thermals are disabled, these parameters must be set - // for pads which have local settings with thermal enabled - // Previously, wxTextCtrl widgets related to thermal settings were disabled, - // but this is not a good idea. We leave them always enabled. -} - - -void DIALOG_COPPER_ZONE::initListNetsParams() -{ - switch( m_NetDisplayOption->GetSelection() ) - { - case 0: - m_NetSortingByPadCount = false; - m_NetFiltering = false; - break; - - case 1: - m_NetSortingByPadCount = true; - m_NetFiltering = false; - break; - - case 2: - m_NetSortingByPadCount = false; - m_NetFiltering = true; - break; - - case 3: - m_NetSortingByPadCount = true; - m_NetFiltering = true; - break; - } } void DIALOG_COPPER_ZONE::OnRunFiltersButtonClick( wxCommandEvent& event ) { - m_netNameShowFilter = m_ShowNetNameFilter->GetValue(); + m_NetFiltering = true; + m_showAllNetsOpt->SetValue( false ); - // Ensure filtered option for nets - if( m_NetDisplayOption->GetSelection() == 0 ) - m_NetDisplayOption->SetSelection( 2 ); - else if( m_NetDisplayOption->GetSelection() == 1 ) - m_NetDisplayOption->SetSelection( 3 ); - - initListNetsParams(); buildAvailableListOfNets(); } @@ -636,40 +422,29 @@ void DIALOG_COPPER_ZONE::buildAvailableListOfNets() listNetName.Insert( wxT( "" ), 0 ); // Ensure currently selected net for the zone is visible, regardless of filters - int selectedNetListNdx = -1; + int selectedNetListNdx = 0; int net_select = m_settings.m_NetcodeSelection; if( net_select > 0 ) { - NETINFO_ITEM* equipot = m_Parent->GetBoard()->FindNet( net_select ); - if( equipot ) + NETINFO_ITEM* selectedNet = m_Parent->GetBoard()->FindNet( net_select ); + if( selectedNet ) { - selectedNetListNdx = listNetName.Index( equipot->GetNetname() ); + selectedNetListNdx = listNetName.Index( selectedNet->GetNetname() ); if( wxNOT_FOUND == selectedNetListNdx ) { // the currently selected net must *always* be visible. - // is the zero'th index, so pick next lowest - listNetName.Insert( equipot->GetNetname(), 1 ); + // is the zero'th index, so pick next lowest + listNetName.Insert( selectedNet->GetNetname(), 1 ); selectedNetListNdx = 1; } } } - else if( net_select == 0 ) - selectedNetListNdx = 0; // SetSelection() on "" - else - { - // selectedNetListNdx remains -1, no net selected. - } m_ListNetNameSelection->Clear(); m_ListNetNameSelection->InsertItems( listNetName, 0 ); - m_ListNetNameSelection->SetSelection( 0 ); - - if( selectedNetListNdx >= 0 ) - { - m_ListNetNameSelection->SetSelection( selectedNetListNdx ); - m_ListNetNameSelection->EnsureVisible( selectedNetListNdx ); - } + m_ListNetNameSelection->SetSelection( selectedNetListNdx ); + m_ListNetNameSelection->EnsureVisible( selectedNetListNdx ); } diff --git a/pcbnew/dialogs/dialog_copper_zones_base.cpp b/pcbnew/dialogs/dialog_copper_zones_base.cpp index cade1975db..4e23b7a530 100644 --- a/pcbnew/dialogs/dialog_copper_zones_base.cpp +++ b/pcbnew/dialogs/dialog_copper_zones_base.cpp @@ -1,28 +1,25 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 19 2018) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// -#include "widgets/text_ctrl_eval.h" - #include "dialog_copper_zones_base.h" /////////////////////////////////////////////////////////////////////////// BEGIN_EVENT_TABLE( DIALOG_COPPER_ZONE_BASE, DIALOG_SHIM ) EVT_CLOSE( DIALOG_COPPER_ZONE_BASE::_wxFB_OnClose ) - EVT_UPDATE_UI( ID_NETNAME_SELECTION, DIALOG_COPPER_ZONE_BASE::_wxFB_OnUpdateUI ) - EVT_CHOICE( ID_M_NETDISPLAYOPTION, DIALOG_COPPER_ZONE_BASE::_wxFB_OnNetSortingOptionSelected ) + EVT_UPDATE_UI( ID_DIALOG_COPPER_ZONE_BASE, DIALOG_COPPER_ZONE_BASE::_wxFB_OnUpdateUI ) + EVT_DATAVIEW_ITEM_VALUE_CHANGED( wxID_ANY, DIALOG_COPPER_ZONE_BASE::_wxFB_OnLayerSelection ) EVT_TEXT_ENTER( ID_TEXTCTRL_NETNAMES_FILTER, DIALOG_COPPER_ZONE_BASE::_wxFB_OnRunFiltersButtonClick ) EVT_TEXT_ENTER( ID_TEXTCTRL_NETNAMES_FILTER, DIALOG_COPPER_ZONE_BASE::_wxFB_OnRunFiltersButtonClick ) EVT_BUTTON( wxID_APPLY_FILTERS, DIALOG_COPPER_ZONE_BASE::_wxFB_OnRunFiltersButtonClick ) - EVT_CHOICE( ID_CORNER_SMOOTHING, DIALOG_COPPER_ZONE_BASE::_wxFB_OnCornerSmoothingModeChoice ) - EVT_CHOICE( ID_M_PADINZONEOPT, DIALOG_COPPER_ZONE_BASE::_wxFB_OnPadsInZoneClick ) + EVT_CHECKBOX( wxID_ANY, DIALOG_COPPER_ZONE_BASE::_wxFB_OnNetSortingOptionSelected ) + EVT_CHECKBOX( wxID_ANY, DIALOG_COPPER_ZONE_BASE::_wxFB_OnNetSortingOptionSelected ) EVT_BUTTON( wxID_BUTTON_EXPORT, DIALOG_COPPER_ZONE_BASE::_wxFB_ExportSetupToOtherCopperZones ) EVT_BUTTON( wxID_CANCEL, DIALOG_COPPER_ZONE_BASE::_wxFB_OnButtonCancelClick ) - EVT_BUTTON( wxID_OK, DIALOG_COPPER_ZONE_BASE::_wxFB_OnButtonOkClick ) END_EVENT_TABLE() 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 ) @@ -39,13 +36,13 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i m_staticTextLayers = new wxStaticText( this, wxID_ANY, _("Layer:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextLayers->Wrap( -1 ); - m_layerSizer->Add( m_staticTextLayers, 0, wxTOP|wxRIGHT, 5 ); + m_layerSizer->Add( m_staticTextLayers, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - m_LayerSelectionCtrl = new wxListView( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_ALIGN_LEFT|wxLC_NO_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL ); - m_layerSizer->Add( m_LayerSelectionCtrl, 1, wxRIGHT, 5 ); + m_layers = new wxDataViewListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_NO_HEADER|wxSUNKEN_BORDER ); + m_layerSizer->Add( m_layers, 1, wxEXPAND|wxRIGHT, 5 ); - m_OptionsBoxSizer->Add( m_layerSizer, 0, wxEXPAND, 5 ); + m_OptionsBoxSizer->Add( m_layerSizer, 0, wxEXPAND|wxTOP|wxRIGHT, 5 ); wxBoxSizer* bSizerNets; bSizerNets = new wxBoxSizer( wxVERTICAL ); @@ -55,210 +52,196 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i bSizerNets->Add( m_staticTextNets, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_ListNetNameSelection = new wxListBox( this, ID_NETNAME_SELECTION, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - bSizerNets->Add( m_ListNetNameSelection, 1, wxEXPAND, 5 ); + bSizerNets->Add( m_ListNetNameSelection, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - m_OptionsBoxSizer->Add( bSizerNets, 1, wxEXPAND, 5 ); + m_OptionsBoxSizer->Add( bSizerNets, 1, wxEXPAND|wxTOP|wxLEFT, 5 ); - wxStaticBoxSizer* m_NetSortOptSizer; - m_NetSortOptSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Net Filtering:") ), wxVERTICAL ); + wxBoxSizer* bFilteringSizer; + bFilteringSizer = new wxBoxSizer( wxVERTICAL ); - m_staticTextDisplay = new wxStaticText( m_NetSortOptSizer->GetStaticBox(), wxID_ANY, _("Display:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextDisplay = new wxStaticText( this, wxID_ANY, _("Hide nets matching:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextDisplay->Wrap( -1 ); - m_NetSortOptSizer->Add( m_staticTextDisplay, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); + bFilteringSizer->Add( m_staticTextDisplay, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); - wxString m_NetDisplayOptionChoices[] = { _("Show all (alphabetical)"), _("Show all (pad count)"), _("Filtered (alphabetical)"), _("Filtered (pad count)") }; - int m_NetDisplayOptionNChoices = sizeof( m_NetDisplayOptionChoices ) / sizeof( wxString ); - m_NetDisplayOption = new wxChoice( m_NetSortOptSizer->GetStaticBox(), ID_M_NETDISPLAYOPTION, wxDefaultPosition, wxDefaultSize, m_NetDisplayOptionNChoices, m_NetDisplayOptionChoices, 0 ); - m_NetDisplayOption->SetSelection( 0 ); - m_NetSortOptSizer->Add( m_NetDisplayOption, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - - m_staticTextHfilter = new wxStaticText( m_NetSortOptSizer->GetStaticBox(), wxID_ANY, _("Hidden net filter:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextHfilter->Wrap( -1 ); - m_NetSortOptSizer->Add( m_staticTextHfilter, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_DoNotShowNetNameFilter = new wxTextCtrl( m_NetSortOptSizer->GetStaticBox(), ID_TEXTCTRL_NETNAMES_FILTER, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); + m_DoNotShowNetNameFilter = new wxTextCtrl( this, 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->SetMinSize( wxSize( 180,-1 ) ); - m_NetSortOptSizer->Add( m_DoNotShowNetNameFilter, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bFilteringSizer->Add( m_DoNotShowNetNameFilter, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - m_staticTextVFilter = new wxStaticText( m_NetSortOptSizer->GetStaticBox(), wxID_ANY, _("Visible net filter:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextVFilter = new wxStaticText( this, wxID_ANY, _("Show nets matching:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextVFilter->Wrap( -1 ); - m_NetSortOptSizer->Add( m_staticTextVFilter, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + bFilteringSizer->Add( m_staticTextVFilter, 0, wxRIGHT|wxLEFT, 5 ); - m_ShowNetNameFilter = new wxTextCtrl( m_NetSortOptSizer->GetStaticBox(), ID_TEXTCTRL_NETNAMES_FILTER, _("*"), wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); + m_ShowNetNameFilter = new wxTextCtrl( this, 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_NetSortOptSizer->Add( m_ShowNetNameFilter, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + bFilteringSizer->Add( m_ShowNetNameFilter, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - m_buttonRunFilter = new wxButton( m_NetSortOptSizer->GetStaticBox(), wxID_APPLY_FILTERS, _("Apply Filters"), wxDefaultPosition, wxDefaultSize, 0 ); - m_NetSortOptSizer->Add( m_buttonRunFilter, 0, wxALL|wxEXPAND, 5 ); + m_buttonRunFilter = new wxButton( this, wxID_APPLY_FILTERS, _("Apply Filters"), wxDefaultPosition, wxDefaultSize, 0 ); + bFilteringSizer->Add( m_buttonRunFilter, 0, wxALL|wxEXPAND, 5 ); - m_OptionsBoxSizer->Add( m_NetSortOptSizer, 0, wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + bFilteringSizer->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + + m_showAllNetsOpt = new wxCheckBox( this, wxID_ANY, _("Show all nets"), wxDefaultPosition, wxDefaultSize, 0 ); + bFilteringSizer->Add( m_showAllNetsOpt, 0, wxALL, 5 ); - m_MainBoxSizer->Add( m_OptionsBoxSizer, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + bFilteringSizer->Add( 0, 0, 0, wxEXPAND|wxTOP, 5 ); + + m_sortByPadsOpt = new wxCheckBox( this, wxID_ANY, _("Sort nets by pad count"), wxDefaultPosition, wxDefaultSize, 0 ); + bFilteringSizer->Add( m_sortByPadsOpt, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_bNoNetWarning = new wxBoxSizer( wxHORIZONTAL ); + + m_bitmapNoNetWarning = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); + m_bNoNetWarning->Add( m_bitmapNoNetWarning, 0, wxTOP|wxBOTTOM|wxLEFT, 8 ); + + m_staticText18 = new wxStaticText( this, wxID_ANY, _("No net will result\nin an unconnected \ncopper island."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText18->Wrap( -1 ); + m_bNoNetWarning->Add( m_staticText18, 0, wxALL, 5 ); + + + bFilteringSizer->Add( m_bNoNetWarning, 1, wxEXPAND|wxTOP, 20 ); + + + m_OptionsBoxSizer->Add( bFilteringSizer, 0, wxEXPAND|wxTOP, 20 ); + + + m_MainBoxSizer->Add( m_OptionsBoxSizer, 1, wxEXPAND|wxRIGHT|wxLEFT, 10 ); 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 ); - wxBoxSizer* bSizerSettings; - bSizerSettings = new wxBoxSizer( wxVERTICAL ); + wxGridBagSizer* gbSizer1; + gbSizer1 = new wxGridBagSizer( 0, 0 ); + gbSizer1->SetFlexibleDirection( wxBOTH ); + gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - m_ClearanceValueTitle = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Clearance:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_ClearanceValueTitle->Wrap( -1 ); - bSizerSettings->Add( m_ClearanceValueTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_ZoneClearanceCtrl = new TEXT_CTRL_EVAL( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bSizerSettings->Add( m_ZoneClearanceCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - m_MinThicknessValueTitle = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Minimum width:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_MinThicknessValueTitle->Wrap( -1 ); - m_MinThicknessValueTitle->SetToolTip( _("Minimum thickness of filled areas.") ); - - bSizerSettings->Add( m_MinThicknessValueTitle, 0, wxRIGHT|wxLEFT, 5 ); - - m_ZoneMinThicknessCtrl = new TEXT_CTRL_EVAL( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bSizerSettings->Add( m_ZoneMinThicknessCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + 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 ); m_staticTextSmoothing = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Corner smoothing:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextSmoothing->Wrap( -1 ); - bSizerSettings->Add( m_staticTextSmoothing, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); + gbSizer1->Add( m_staticTextSmoothing, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 ); wxString m_cornerSmoothingChoiceChoices[] = { _("None"), _("Chamfer"), _("Fillet") }; 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->SetSelection( 0 ); - bSizerSettings->Add( m_cornerSmoothingChoice, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + gbSizer1->Add( m_cornerSmoothingChoice, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxALL, 5 ); - m_cornerSmoothingValue = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Chamfer distance (mm):"), wxDefaultPosition, wxDefaultSize, 0 ); - m_cornerSmoothingValue->Wrap( -1 ); - bSizerSettings->Add( m_cornerSmoothingValue, 0, wxRIGHT|wxLEFT, 5 ); + m_cornerRadiusLabel = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Chamfer distance:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_cornerRadiusLabel->Wrap( -1 ); + gbSizer1->Add( m_cornerRadiusLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 ); - m_cornerSmoothingCtrl = new TEXT_CTRL_EVAL( m_ExportableSetupSizer->GetStaticBox(), ID_M_CORNERSMOOTHINGCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bSizerSettings->Add( m_cornerSmoothingCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + 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 ); - - m_ExportableSetupSizer->Add( bSizerSettings, 0, wxEXPAND, 5 ); - - wxBoxSizer* bSizerPadsConnection; - bSizerPadsConnection = new wxBoxSizer( wxVERTICAL ); - - m_staticTextPadConnection = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Default pad connection:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextPadConnection->Wrap( -1 ); - m_staticTextPadConnection->SetToolTip( _("Default pad connection type to zone.\nThis setting can be overridden by local pad settings") ); - - bSizerPadsConnection->Add( m_staticTextPadConnection, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); - - wxString m_PadInZoneOptChoices[] = { _("Solid"), _("Thermal relief"), _("THT thermal"), _("None") }; - 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->SetSelection( 0 ); - bSizerPadsConnection->Add( m_PadInZoneOpt, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - - wxStaticBoxSizer* m_ThermalShapesParamsSizer; - m_ThermalShapesParamsSizer = new wxStaticBoxSizer( new wxStaticBox( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Thermal Reliefs:") ), wxVERTICAL ); - - m_AntipadSizeText = new wxStaticText( m_ThermalShapesParamsSizer->GetStaticBox(), wxID_ANY, _("Antipad clearance:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_AntipadSizeText->Wrap( -1 ); - m_ThermalShapesParamsSizer->Add( m_AntipadSizeText, 0, wxTOP|wxRIGHT, 5 ); - - m_AntipadSizeValue = new TEXT_CTRL_EVAL( m_ThermalShapesParamsSizer->GetStaticBox(), wxID_ANTIPAD_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_AntipadSizeValue->SetToolTip( _("Clearance between pads in the same net and filled areas.") ); - - m_ThermalShapesParamsSizer->Add( m_AntipadSizeValue, 0, wxEXPAND|wxBOTTOM, 5 ); - - m_CopperBridgeWidthText = new wxStaticText( m_ThermalShapesParamsSizer->GetStaticBox(), wxID_ANY, _("Spoke width:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_CopperBridgeWidthText->Wrap( -1 ); - m_ThermalShapesParamsSizer->Add( m_CopperBridgeWidthText, 0, wxTOP|wxRIGHT, 5 ); - - m_CopperWidthValue = new TEXT_CTRL_EVAL( m_ThermalShapesParamsSizer->GetStaticBox(), wxID_COPPER_BRIDGE_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_CopperWidthValue->SetToolTip( _("Width of copper in thermal reliefs.") ); - - m_ThermalShapesParamsSizer->Add( m_CopperWidthValue, 0, wxEXPAND|wxBOTTOM, 5 ); - - - bSizerPadsConnection->Add( m_ThermalShapesParamsSizer, 0, wxALL|wxEXPAND, 5 ); - - - m_ExportableSetupSizer->Add( bSizerPadsConnection, 0, wxEXPAND, 5 ); - - wxBoxSizer* m_MiddleBox; - m_MiddleBox = new wxBoxSizer( wxVERTICAL ); + m_cornerRadiusUnits = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 ); + m_cornerRadiusUnits->Wrap( -1 ); + 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->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_MiddleBox->Add( m_staticTextPriorityLevel, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + gbSizer1->Add( m_staticTextPriorityLevel, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT, 5 ); m_PriorityLevelCtrl = new wxSpinCtrl( m_ExportableSetupSizer->GetStaticBox(), ID_M_PRIORITYLEVELCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 100, 0 ); - m_MiddleBox->Add( m_PriorityLevelCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + gbSizer1->Add( m_PriorityLevelCtrl, wxGBPosition( 3, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - m_staticTextFillMode = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Fill mode:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextFillMode->Wrap( -1 ); - m_MiddleBox->Add( m_staticTextFillMode, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); - - wxString m_FillModeCtrlChoices[] = { _("Polygon"), _("Segment") }; - int m_FillModeCtrlNChoices = sizeof( m_FillModeCtrlChoices ) / sizeof( wxString ); - m_FillModeCtrl = new wxChoice( m_ExportableSetupSizer->GetStaticBox(), ID_M_FILLMODECTRL, wxDefaultPosition, wxDefaultSize, m_FillModeCtrlNChoices, m_FillModeCtrlChoices, 0 ); - m_FillModeCtrl->SetSelection( 0 ); - m_MiddleBox->Add( m_FillModeCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - - m_staticTextSegmCnt = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Boundary mode:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextSegmCnt->Wrap( -1 ); - m_MiddleBox->Add( m_staticTextSegmCnt, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); - - wxString m_ArcApproximationOptChoices[] = { _("Low Resolution"), _("High Resolution") }; - int m_ArcApproximationOptNChoices = sizeof( m_ArcApproximationOptChoices ) / sizeof( wxString ); - m_ArcApproximationOpt = new wxChoice( m_ExportableSetupSizer->GetStaticBox(), ID_M_ARCAPPROXIMATIONOPT, wxDefaultPosition, wxDefaultSize, m_ArcApproximationOptNChoices, m_ArcApproximationOptChoices, 0 ); - m_ArcApproximationOpt->SetSelection( 0 ); - m_MiddleBox->Add( m_ArcApproximationOpt, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - - - m_ExportableSetupSizer->Add( m_MiddleBox, 0, wxEXPAND, 5 ); - - wxBoxSizer* bSizerLowerRight; - bSizerLowerRight = new wxBoxSizer( wxVERTICAL ); - - m_staticTextSlope = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Outline slope:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextSlope->Wrap( -1 ); - bSizerLowerRight->Add( m_staticTextSlope, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); - - wxString m_OrientEdgesOptChoices[] = { _("Arbitrary"), _("H, V, and 45 deg only") }; - int m_OrientEdgesOptNChoices = sizeof( m_OrientEdgesOptChoices ) / sizeof( wxString ); - m_OrientEdgesOpt = new wxChoice( m_ExportableSetupSizer->GetStaticBox(), ID_M_ORIENTEDGESOPT, wxDefaultPosition, wxDefaultSize, m_OrientEdgesOptNChoices, m_OrientEdgesOptChoices, 0 ); - m_OrientEdgesOpt->SetSelection( 0 ); - bSizerLowerRight->Add( m_OrientEdgesOpt, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - - m_staticTextStyle = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Outline style:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextStyle = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("Outline display:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextStyle->Wrap( -1 ); - bSizerLowerRight->Add( m_staticTextStyle, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); + gbSizer1->Add( m_staticTextStyle, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 ); wxString m_OutlineAppearanceCtrlChoices[] = { _("Line"), _("Hatched"), _("Fully hatched") }; 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->SetSelection( 0 ); - bSizerLowerRight->Add( m_OutlineAppearanceCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - - m_bNoNetWarning = new wxBoxSizer( wxHORIZONTAL ); - - m_bitmapNoNetWarning = new wxStaticBitmap( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); - m_bNoNetWarning->Add( m_bitmapNoNetWarning, 0, wxTOP|wxBOTTOM|wxLEFT, 8 ); - - m_staticText18 = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("No net will result\nin an unconnected \ncopper island."), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText18->Wrap( -1 ); - m_bNoNetWarning->Add( m_staticText18, 0, wxALL, 5 ); + gbSizer1->Add( m_OutlineAppearanceCtrl, wxGBPosition( 4, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - bSizerLowerRight->Add( m_bNoNetWarning, 1, wxEXPAND|wxTOP, 25 ); + gbSizer1->AddGrowableCol( 1 ); + + m_ExportableSetupSizer->Add( gbSizer1, 1, wxEXPAND|wxRIGHT, 20 ); + + wxGridBagSizer* gbSizer2; + 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->Wrap( -1 ); + gbSizer2->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 ); + gbSizer2->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->Wrap( -1 ); + gbSizer2->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->Wrap( -1 ); + m_minWidthLabel->SetToolTip( _("Minimum thickness of filled areas.") ); + + gbSizer2->Add( m_minWidthLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + 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 ); + + m_minWidthUnits = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 ); + m_minWidthUnits->Wrap( -1 ); + gbSizer2->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->Wrap( -1 ); + 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 ); + + wxString m_PadInZoneOptChoices[] = { _("Solid"), _("Thermal reliefs"), _("Reliefs for PTH only"), _("None") }; + 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->SetSelection( 0 ); + gbSizer2->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->Wrap( -1 ); + gbSizer2->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->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 ); + + m_antipadUnits = new wxStaticText( m_ExportableSetupSizer->GetStaticBox(), wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 ); + m_antipadUnits->Wrap( -1 ); + gbSizer2->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->Wrap( -1 ); + gbSizer2->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->SetToolTip( _("Width of copper in thermal reliefs.") ); + + gbSizer2->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->Wrap( -1 ); + gbSizer2->Add( m_spokeWidthUnits, wxGBPosition( 4, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 ); - m_ExportableSetupSizer->Add( bSizerLowerRight, 0, wxEXPAND, 5 ); + gbSizer2->AddGrowableCol( 1 ); + + m_ExportableSetupSizer->Add( gbSizer2, 1, wxEXPAND|wxLEFT, 5 ); - m_MainBoxSizer->Add( m_ExportableSetupSizer, 0, wxALL|wxEXPAND, 5 ); + m_MainBoxSizer->Add( m_ExportableSetupSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 ); wxBoxSizer* bSizerbottom; bSizerbottom = new wxBoxSizer( wxHORIZONTAL ); @@ -266,7 +249,7 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i 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.") ); - bSizerbottom->Add( m_ExportSetupButton, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + bSizerbottom->Add( m_ExportSetupButton, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 ); m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizerOK = new wxButton( this, wxID_OK ); @@ -275,10 +258,10 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i m_sdbSizer->AddButton( m_sdbSizerCancel ); m_sdbSizer->Realize(); - bSizerbottom->Add( m_sdbSizer, 1, wxEXPAND, 5 ); + bSizerbottom->Add( m_sdbSizer, 1, wxEXPAND|wxALL, 5 ); - m_MainBoxSizer->Add( bSizerbottom, 0, wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + m_MainBoxSizer->Add( bSizerbottom, 0, wxALIGN_RIGHT|wxEXPAND|wxLEFT, 5 ); this->SetSizer( m_MainBoxSizer ); diff --git a/pcbnew/dialogs/dialog_copper_zones_base.fbp b/pcbnew/dialogs/dialog_copper_zones_base.fbp index 3252c03b69..a71e534112 100644 --- a/pcbnew/dialogs/dialog_copper_zones_base.fbp +++ b/pcbnew/dialogs/dialog_copper_zones_base.fbp @@ -14,7 +14,6 @@ dialog_copper_zones_base 1000 none - 1 dialog_copper_zones_base @@ -88,15 +87,15 @@ - + OnUpdateUI m_MainBoxSizer wxVERTICAL protected - 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 10 + wxEXPAND|wxRIGHT|wxLEFT 1 @@ -105,7 +104,7 @@ none 5 - wxEXPAND + wxEXPAND|wxTOP|wxRIGHT 0 @@ -114,7 +113,7 @@ none 5 - wxTOP|wxRIGHT + wxTOP|wxRIGHT|wxLEFT 0 1 @@ -197,65 +196,48 @@ 5 - wxRIGHT + wxEXPAND|wxRIGHT 1 - - 1 - 1 - 1 - 1 - - - - - + - - 1 - 0 - 1 1 - 0 - Dock - 0 - Left 1 - 1 - 0 0 wxID_ANY - - 0 - - 0 - 1 - m_LayerSelectionCtrl - 1 - - + m_layers protected - 1 - Resizable - 1 - wxLC_ALIGN_LEFT|wxLC_NO_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL - wxListView; - 0 + wxDV_NO_HEADER + ; forward_declare - - wxFILTER_NONE - wxDefaultValidator - - + wxSUNKEN_BORDER + + + + + + + + + + + + + + + + + OnLayerSelection + @@ -265,26 +247,6 @@ - - - - - - - - - - - - - - - - - - - - @@ -304,7 +266,7 @@ 5 - wxEXPAND + wxEXPAND|wxTOP|wxLEFT 1 @@ -394,11 +356,11 @@ - + 5 - wxEXPAND + wxEXPAND|wxRIGHT|wxLEFT 1 - + 1 1 1 @@ -432,7 +394,7 @@ 0 - -1,-1 + 1 m_ListNetNameSelection 1 @@ -445,7 +407,7 @@ 1 - + ; forward_declare 0 @@ -479,24 +441,20 @@ - OnUpdateUI + - - 5 - wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + + 20 + wxEXPAND|wxTOP 0 - - wxID_ANY - Net Filtering: + - m_NetSortOptSizer + bFilteringSizer wxVERTICAL - 1 none - 5 wxLEFT|wxRIGHT|wxTOP @@ -529,7 +487,7 @@ 0 0 wxID_ANY - Display: + Hide nets matching: 0 @@ -580,177 +538,6 @@ - - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Show all (alphabetical)" "Show all (pad count)" "Filtered (alphabetical)" "Filtered (pad count)" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_M_NETDISPLAYOPTION - - 0 - - - 0 - - 1 - m_NetDisplayOption - 1 - - - protected - 1 - - Resizable - 0 - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - OnNetSortingOptionSelected - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Hidden net filter: - - 0 - - - 0 - - 1 - m_staticTextHfilter - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - 5 wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT @@ -789,7 +576,7 @@ 0 0 - + 180,-1 1 m_DoNotShowNetNameFilter 1 @@ -844,7 +631,7 @@ 5 - wxTOP|wxRIGHT|wxLEFT + wxRIGHT|wxLEFT 0 1 @@ -874,7 +661,7 @@ 0 0 wxID_ANY - Visible net filter: + Show nets matching: 0 @@ -1104,37 +891,119 @@ - - - - - - 5 - wxALL|wxEXPAND - 0 - - wxID_ANY - Settings: - - m_ExportableSetupSizer - wxHORIZONTAL - 1 - none - - - 5 - wxEXPAND - 0 - - - bSizerSettings - wxVERTICAL - none - + + 5 + wxEXPAND|wxTOP|wxBOTTOM + 0 + + 0 + protected + 0 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Show all nets + + 0 + + + 0 + + 1 + m_showAllNetsOpt + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + OnNetSortingOptionSelected + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxTOP + 0 + + 0 + protected + 0 + + + 5 wxTOP|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -1148,6 +1017,7 @@ 1 0 + 0 1 1 @@ -1162,7 +1032,7 @@ 0 0 wxID_ANY - Clearance: + Sort nets by pad count 0 @@ -1170,7 +1040,7 @@ 0 1 - m_ClearanceValueTitle + m_sortByPadsOpt 1 @@ -1181,439 +1051,7 @@ 1 - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - - 0 - - 1 - m_ZoneClearanceCtrl - 1 - - - protected - 1 - - Resizable - 1 - - - TEXT_CTRL_EVAL; widgets/text_ctrl_eval.h - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Minimum width: - - 0 - - - 0 - - 1 - m_MinThicknessValueTitle - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Minimum thickness of filled areas. - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - - 0 - - 1 - m_ZoneMinThicknessCtrl - 1 - - - protected - 1 - - Resizable - 1 - - - TEXT_CTRL_EVAL; widgets/text_ctrl_eval.h - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxLEFT|wxRIGHT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Corner smoothing: - - 0 - - - 0 - - 1 - m_staticTextSmoothing - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "None" "Chamfer" "Fillet" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_CORNER_SMOOTHING - - 0 - - - 0 - - 1 - m_cornerSmoothingChoice - 1 - - - protected - 1 - - Resizable - 0 - 1 - - - + ; forward_declare 0 @@ -1624,7 +1062,7 @@ - OnCornerSmoothingModeChoice + OnNetSortingOptionSelected @@ -1650,1603 +1088,7 @@ - 5 - wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Chamfer distance (mm): - - 0 - - - 0 - - 1 - m_cornerSmoothingValue - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_M_CORNERSMOOTHINGCTRL - - 0 - - 0 - - 0 - - 1 - m_cornerSmoothingCtrl - 1 - - - protected - 1 - - Resizable - 1 - - - TEXT_CTRL_EVAL; widgets/text_ctrl_eval.h - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 0 - - - bSizerPadsConnection - wxVERTICAL - none - - 5 - wxLEFT|wxRIGHT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Default pad connection: - - 0 - - - 0 - - 1 - m_staticTextPadConnection - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Default pad connection type to zone. This setting can be overridden by local pad settings - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Solid" "Thermal relief" "THT thermal" "None" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_M_PADINZONEOPT - - 0 - - - 0 - - 1 - m_PadInZoneOpt - 1 - - - protected - 1 - - Resizable - 0 - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - OnPadsInZoneClick - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - wxID_ANY - Thermal Reliefs: - - m_ThermalShapesParamsSizer - wxVERTICAL - 1 - none - - - 5 - wxTOP|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Antipad clearance: - - 0 - - - 0 - - 1 - m_AntipadSizeText - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxBOTTOM - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANTIPAD_SIZE - - 0 - - 0 - - 0 - - 1 - m_AntipadSizeValue - 1 - - - protected - 1 - - Resizable - 1 - - - TEXT_CTRL_EVAL; widgets/text_ctrl_eval.h - 0 - Clearance between pads in the same net and filled areas. - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxTOP|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Spoke width: - - 0 - - - 0 - - 1 - m_CopperBridgeWidthText - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxBOTTOM - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_COPPER_BRIDGE_VALUE - - 0 - - 0 - - 0 - - 1 - m_CopperWidthValue - 1 - - - protected - 1 - - Resizable - 1 - - - TEXT_CTRL_EVAL; widgets/text_ctrl_eval.h - 0 - Width of copper in thermal reliefs. - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 0 - - - m_MiddleBox - wxVERTICAL - none - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Zone priority level: - - 0 - - - 0 - - 1 - m_staticTextPriorityLevel - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Zones are filled by priority level, level 3 has higher priority than level 2. When a zone is inside another zone: * If its priority is higher, its outlines are removed from the other zone. * If its priority is equal, a DRC error is set. - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_M_PRIORITYLEVELCTRL - 0 - 100 - - 0 - - 0 - - 0 - - 1 - m_PriorityLevelCtrl - 1 - - - protected - 1 - - Resizable - 1 - - wxSP_ARROW_KEYS - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxLEFT|wxRIGHT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Fill mode: - - 0 - - - 0 - - 1 - m_staticTextFillMode - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Polygon" "Segment" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_M_FILLMODECTRL - - 0 - - - 0 - - 1 - m_FillModeCtrl - 1 - - - protected - 1 - - Resizable - 0 - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxLEFT|wxRIGHT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Boundary mode: - - 0 - - - 0 - - 1 - m_staticTextSegmCnt - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Low Resolution" "High Resolution" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_M_ARCAPPROXIMATIONOPT - - 0 - - - 0 - - 1 - m_ArcApproximationOpt - 1 - - - protected - 1 - - Resizable - 0 - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 0 - - - bSizerLowerRight - wxVERTICAL - none - - 5 - wxLEFT|wxRIGHT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Outline slope: - - 0 - - - 0 - - 1 - m_staticTextSlope - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Arbitrary" "H, V, and 45 deg only" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_M_ORIENTEDGESOPT - - 0 - - - 0 - - 1 - m_OrientEdgesOpt - 1 - - - protected - 1 - - Resizable - 0 - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxLEFT|wxRIGHT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Outline style: - - 0 - - - 0 - - 1 - m_staticTextStyle - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Line" "Hatched" "Fully hatched" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_M_OUTLINEAPPEARANCECTRL - - 0 - - - 0 - - 1 - m_OutlineAppearanceCtrl - 1 - - - protected - 1 - - Resizable - 0 - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 25 + 20 wxEXPAND|wxTOP 1 @@ -3424,9 +1266,2187 @@ + + 10 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 0 + + wxID_ANY + Settings + + m_ExportableSetupSizer + wxHORIZONTAL + 1 + none + + + 20 + wxEXPAND|wxRIGHT + 1 + + + wxBOTH + 1 + + 0 + + gbSizer1 + wxFLEX_GROWMODE_SPECIFIED + none + 0 + + 5 + 3 + 0 + wxBOTTOM|wxRIGHT + 0 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Constrain outline to H, V and 45 degrees + + 0 + + + 0 + + 1 + m_constrainOutline + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 0 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT + 1 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Corner smoothing: + + 0 + + + 0 + + 1 + m_staticTextSmoothing + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 1 + wxEXPAND|wxALL + 1 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "None" "Chamfer" "Fillet" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_CORNER_SMOOTHING + + 0 + + + 0 + + 1 + m_cornerSmoothingChoice + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 0 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT + 2 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Chamfer distance: + + 0 + + + 0 + + 1 + m_cornerRadiusLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 1 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 2 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_M_CORNERSMOOTHINGCTRL + + 0 + + 0 + + 0 + -1,-1 + 1 + m_cornerRadiusCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 2 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT + 2 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + units + + 0 + + + 0 + + 1 + m_cornerRadiusUnits + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 0 + wxBOTTOM|wxRIGHT + 3 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Zone priority level: + + 0 + + + 0 + + 1 + m_staticTextPriorityLevel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Zones are filled by priority level, level 3 has higher priority than level 2. When a zone is inside another zone: * If its priority is higher, its outlines are removed from the other zone. * If its priority is equal, a DRC error is set. + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 1 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 3 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_M_PRIORITYLEVELCTRL + 0 + 100 + + 0 + + 0 + + 0 + + 1 + m_PriorityLevelCtrl + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 0 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT + 4 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Outline display: + + 0 + + + 0 + + 1 + m_staticTextStyle + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 1 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 4 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Line" "Hatched" "Fully hatched" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_M_OUTLINEAPPEARANCECTRL + + 0 + + + 0 + + 1 + m_OutlineAppearanceCtrl + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxLEFT + 1 + + + wxBOTH + 1 + + 0 + + gbSizer2 + wxFLEX_GROWMODE_SPECIFIED + none + 0 + + 5 + 1 + 0 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT + 0 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Clearance: + + 0 + + + 0 + + 1 + m_clearanceLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 1 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 0 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + -1,-1 + 1 + m_clearanceCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 2 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT + 0 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + units + + 0 + + + 0 + + 1 + m_clearanceUnits + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 0 + wxBOTTOM|wxRIGHT|wxLEFT + 1 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Minimum width: + + 0 + + + 0 + + 1 + m_minWidthLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Minimum thickness of filled areas. + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 1 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 1 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_minWidthCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 2 + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT + 1 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + units + + 0 + + + 0 + + 1 + m_minWidthUnits + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 0 + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + 2 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Pad connections: + + 0 + + + 0 + + 1 + m_connectionLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Default pad connection type to zone. This setting can be overridden by local pad settings + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 1 + wxEXPAND|wxRIGHT|wxLEFT + 2 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Solid" "Thermal reliefs" "Reliefs for PTH only" "None" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_M_PADINZONEOPT + + 0 + + + 0 + + 1 + m_PadInZoneOpt + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 0 + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + 3 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Thermal clearance: + + 0 + + + 0 + + 1 + m_antipadLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 1 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 3 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANTIPAD_SIZE + + 0 + + 0 + + 0 + + 1 + m_antipadCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Clearance between pads in the same net and filled areas. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 2 + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT + 3 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + units + + 0 + + + 0 + + 1 + m_antipadUnits + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 0 + wxALIGN_CENTER_VERTICAL|wxALL + 4 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Thermal spoke width: + + 0 + + + 0 + + 1 + m_spokeWidthLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 1 + wxEXPAND|wxALL + 4 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_COPPER_BRIDGE_VALUE + + 0 + + 0 + + 0 + + 1 + m_spokeWidthCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Width of copper in thermal reliefs. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 2 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT + 4 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + units + + 0 + + + 0 + + 1 + m_spokeWidthUnits + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 - wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT + wxALIGN_RIGHT|wxEXPAND|wxLEFT 0 @@ -3434,7 +3454,7 @@ wxHORIZONTAL none - 5 + 10 wxEXPAND|wxRIGHT|wxLEFT 0 @@ -3523,7 +3543,7 @@ 5 - wxEXPAND + wxEXPAND|wxALL 1 0 @@ -3542,7 +3562,7 @@ - OnButtonOkClick + diff --git a/pcbnew/dialogs/dialog_copper_zones_base.h b/pcbnew/dialogs/dialog_copper_zones_base.h index 4cca190940..7ca7fc1c20 100644 --- a/pcbnew/dialogs/dialog_copper_zones_base.h +++ b/pcbnew/dialogs/dialog_copper_zones_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 19 2018) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -11,8 +11,6 @@ #include #include #include -class TEXT_CTRL_EVAL; - #include "dialog_shim.h" #include #include @@ -20,18 +18,20 @@ class TEXT_CTRL_EVAL; #include #include #include -#include +#include #include #include -#include #include #include -#include -#include +#include #include #include #include #include +#include +#include +#include +#include #include /////////////////////////////////////////////////////////////////////////// @@ -47,13 +47,11 @@ class DIALOG_COPPER_ZONE_BASE : public DIALOG_SHIM // Private event handlers void _wxFB_OnClose( wxCloseEvent& event ){ OnClose( event ); } void _wxFB_OnUpdateUI( wxUpdateUIEvent& event ){ OnUpdateUI( event ); } - void _wxFB_OnNetSortingOptionSelected( wxCommandEvent& event ){ OnNetSortingOptionSelected( event ); } + void _wxFB_OnLayerSelection( wxDataViewEvent& event ){ OnLayerSelection( event ); } void _wxFB_OnRunFiltersButtonClick( wxCommandEvent& event ){ OnRunFiltersButtonClick( event ); } - void _wxFB_OnCornerSmoothingModeChoice( wxCommandEvent& event ){ OnCornerSmoothingModeChoice( event ); } - void _wxFB_OnPadsInZoneClick( wxCommandEvent& event ){ OnPadsInZoneClick( event ); } + void _wxFB_OnNetSortingOptionSelected( wxCommandEvent& event ){ OnNetSortingOptionSelected( event ); } void _wxFB_ExportSetupToOtherCopperZones( wxCommandEvent& event ){ ExportSetupToOtherCopperZones( event ); } void _wxFB_OnButtonCancelClick( wxCommandEvent& event ){ OnButtonCancelClick( event ); } - void _wxFB_OnButtonOkClick( wxCommandEvent& event ){ OnButtonOkClick( event ); } protected: @@ -61,61 +59,57 @@ class DIALOG_COPPER_ZONE_BASE : public DIALOG_SHIM { ID_DIALOG_COPPER_ZONE_BASE = 1000, ID_NETNAME_SELECTION, - ID_M_NETDISPLAYOPTION, ID_TEXTCTRL_NETNAMES_FILTER, wxID_APPLY_FILTERS, ID_CORNER_SMOOTHING, ID_M_CORNERSMOOTHINGCTRL, + ID_M_PRIORITYLEVELCTRL, + ID_M_OUTLINEAPPEARANCECTRL, ID_M_PADINZONEOPT, wxID_ANTIPAD_SIZE, wxID_COPPER_BRIDGE_VALUE, - ID_M_PRIORITYLEVELCTRL, - ID_M_FILLMODECTRL, - ID_M_ARCAPPROXIMATIONOPT, - ID_M_ORIENTEDGESOPT, - ID_M_OUTLINEAPPEARANCECTRL, wxID_BUTTON_EXPORT }; wxBoxSizer* m_MainBoxSizer; wxStaticText* m_staticTextLayers; - wxListView* m_LayerSelectionCtrl; + wxDataViewListCtrl* m_layers; wxStaticText* m_staticTextNets; wxListBox* m_ListNetNameSelection; wxStaticText* m_staticTextDisplay; - wxChoice* m_NetDisplayOption; - wxStaticText* m_staticTextHfilter; wxTextCtrl* m_DoNotShowNetNameFilter; wxStaticText* m_staticTextVFilter; wxTextCtrl* m_ShowNetNameFilter; wxButton* m_buttonRunFilter; - wxStaticText* m_ClearanceValueTitle; - TEXT_CTRL_EVAL* m_ZoneClearanceCtrl; - wxStaticText* m_MinThicknessValueTitle; - TEXT_CTRL_EVAL* m_ZoneMinThicknessCtrl; - wxStaticText* m_staticTextSmoothing; - wxChoice* m_cornerSmoothingChoice; - wxStaticText* m_cornerSmoothingValue; - TEXT_CTRL_EVAL* m_cornerSmoothingCtrl; - wxStaticText* m_staticTextPadConnection; - wxChoice* m_PadInZoneOpt; - wxStaticText* m_AntipadSizeText; - TEXT_CTRL_EVAL* m_AntipadSizeValue; - wxStaticText* m_CopperBridgeWidthText; - TEXT_CTRL_EVAL* m_CopperWidthValue; - wxStaticText* m_staticTextPriorityLevel; - wxSpinCtrl* m_PriorityLevelCtrl; - wxStaticText* m_staticTextFillMode; - wxChoice* m_FillModeCtrl; - wxStaticText* m_staticTextSegmCnt; - wxChoice* m_ArcApproximationOpt; - wxStaticText* m_staticTextSlope; - wxChoice* m_OrientEdgesOpt; - wxStaticText* m_staticTextStyle; - wxChoice* m_OutlineAppearanceCtrl; + wxCheckBox* m_showAllNetsOpt; + wxCheckBox* m_sortByPadsOpt; wxBoxSizer* m_bNoNetWarning; wxStaticBitmap* m_bitmapNoNetWarning; wxStaticText* m_staticText18; + wxCheckBox* m_constrainOutline; + wxStaticText* m_staticTextSmoothing; + wxChoice* m_cornerSmoothingChoice; + wxStaticText* m_cornerRadiusLabel; + wxTextCtrl* m_cornerRadiusCtrl; + wxStaticText* m_cornerRadiusUnits; + wxStaticText* m_staticTextPriorityLevel; + wxSpinCtrl* m_PriorityLevelCtrl; + wxStaticText* m_staticTextStyle; + wxChoice* m_OutlineAppearanceCtrl; + wxStaticText* m_clearanceLabel; + wxTextCtrl* m_clearanceCtrl; + wxStaticText* m_clearanceUnits; + wxStaticText* m_minWidthLabel; + wxTextCtrl* m_minWidthCtrl; + wxStaticText* m_minWidthUnits; + wxStaticText* m_connectionLabel; + wxChoice* m_PadInZoneOpt; + wxStaticText* m_antipadLabel; + wxTextCtrl* m_antipadCtrl; + wxStaticText* m_antipadUnits; + wxStaticText* m_spokeWidthLabel; + wxTextCtrl* m_spokeWidthCtrl; + wxStaticText* m_spokeWidthUnits; wxButton* m_ExportSetupButton; wxStdDialogButtonSizer* m_sdbSizer; wxButton* m_sdbSizerOK; @@ -124,13 +118,11 @@ class DIALOG_COPPER_ZONE_BASE : public DIALOG_SHIM // Virtual event handlers, overide them in your derived class virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); } - virtual void OnNetSortingOptionSelected( wxCommandEvent& event ) { event.Skip(); } + virtual void OnLayerSelection( wxDataViewEvent& event ) { event.Skip(); } virtual void OnRunFiltersButtonClick( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCornerSmoothingModeChoice( wxCommandEvent& event ) { event.Skip(); } - virtual void OnPadsInZoneClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnNetSortingOptionSelected( wxCommandEvent& event ) { event.Skip(); } virtual void ExportSetupToOtherCopperZones( wxCommandEvent& event ) { event.Skip(); } virtual void OnButtonCancelClick( wxCommandEvent& event ) { event.Skip(); } - virtual void OnButtonOkClick( wxCommandEvent& event ) { event.Skip(); } public: diff --git a/pcbnew/dialogs/dialog_keepout_area_properties.cpp b/pcbnew/dialogs/dialog_keepout_area_properties.cpp index d6411e67ef..4621dcc128 100644 --- a/pcbnew/dialogs/dialog_keepout_area_properties.cpp +++ b/pcbnew/dialogs/dialog_keepout_area_properties.cpp @@ -1,13 +1,9 @@ -/** - * @file dialog_keepout_area_properties.cpp - */ - /* * 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) 2014 SoftPLC Corporation, Dick Hollenbeck - * 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 * modify it under the terms of the GNU General Public License @@ -27,29 +23,16 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include #include #include #include -#include #include #include #include -#include -#include - #include -#include #include -#include // needed for wx/listctrl.h, in wxGTK 2.8.12 -#include -/** - * Class DIALOG_KEEPOUT_AREA_PROPERTIES - * is the derived class from dialog_copper_zone_frame created by wxFormBuilder - */ class DIALOG_KEEPOUT_AREA_PROPERTIES : public DIALOG_KEEPOUT_AREA_PROPERTIES_BASE { public: @@ -62,47 +45,18 @@ private: ZONE_SETTINGS* m_ptr; ///< the pointer to the zone settings ///< of the zone to edit - /** - * Function initDialog - * fills in the dialog controls using the current settings. - */ - void initDialog(); - - /** - * automatically called by wxWidgets before closing the dialog - */ + bool TransferDataToWindow() override; bool TransferDataFromWindow() override; void OnLayerSelection( wxDataViewEvent& event ) override; - - void OnSizeLayersList( wxSizeEvent& event ) override; - - /** - * Function AcceptOptionsForKeepOut - * Test validity of options, and copy options in m_zonesettings, for keepout zones - * @return bool - false if incorrect options, true if ok. - */ - bool AcceptOptionsForKeepOut(); }; -#ifdef __WXMAC__ -const static wxSize LAYER_BITMAP_SIZE( 28, 28 ); // Things get wonky if this isn't square... -#else -const static wxSize LAYER_BITMAP_SIZE( 20, 14 ); -#endif - - -ZONE_EDIT_T InvokeKeepoutAreaEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSettings ) +int InvokeKeepoutAreaEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSettings ) { DIALOG_KEEPOUT_AREA_PROPERTIES dlg( aCaller, aSettings ); - ZONE_EDIT_T result = ZONE_ABORT; - - if( dlg.ShowModal() == wxID_OK ) - result = ZONE_OK; - - return result; + return dlg.ShowModal(); } @@ -116,123 +70,49 @@ DIALOG_KEEPOUT_AREA_PROPERTIES::DIALOG_KEEPOUT_AREA_PROPERTIES( PCB_BASE_FRAME* m_ptr = aSettings; m_zonesettings = *aSettings; - initDialog(); + m_zonesettings.SetupLayersList( m_layers, m_parent, true ); + m_sdbSizerButtonsOK->SetDefault(); FinishDialogSettings(); } -void DIALOG_KEEPOUT_AREA_PROPERTIES::initDialog() +bool DIALOG_KEEPOUT_AREA_PROPERTIES::TransferDataToWindow() { - BOARD* board = m_parent->GetBoard(); - COLOR4D backgroundColor = m_parent->Settings().Colors().GetLayerColor( LAYER_PCB_BACKGROUND ); - wxString msg; - - if( m_zonesettings.m_Zone_45_Only ) - m_OrientEdgesOpt->SetSelection( 1 ); - - switch( m_zonesettings.m_Zone_HatchingStyle ) - { - case ZONE_CONTAINER::NO_HATCH: - m_OutlineAppearanceCtrl->SetSelection( 0 ); - break; - - case ZONE_CONTAINER::DIAGONAL_EDGE: - m_OutlineAppearanceCtrl->SetSelection( 1 ); - break; - - case ZONE_CONTAINER::DIAGONAL_FULL: - m_OutlineAppearanceCtrl->SetSelection( 2 ); - break; - } - - // Build copper layer list and append to layer widget - LSET show = LSET::AllCuMask( board->GetCopperLayerCount() ); - - auto* checkColumn = m_layers->AppendToggleColumn( wxEmptyString ); - auto* layerColumn = m_layers->AppendIconTextColumn( wxEmptyString ); - - wxVector row; - int minNamesWidth = 0; - - for( LSEQ cu_stack = show.UIOrder(); cu_stack; ++cu_stack ) - { - PCB_LAYER_ID layer = *cu_stack; - - msg = board->GetLayerName( layer ); - wxSize tsize( GetTextSize( msg, m_layers ) ); - minNamesWidth = std::max( minNamesWidth, tsize.x ); - - COLOR4D layerColor = m_parent->Settings().Colors().GetLayerColor( layer ); - wxBitmap bitmap = COLOR_SWATCH::MakeBitmap( layerColor, backgroundColor, LAYER_BITMAP_SIZE ); - wxIcon icon; - icon.CopyFromBitmap( bitmap ); - - row.clear(); - row.push_back( m_zonesettings.m_Layers.test( layer ) ); - row.push_back( wxVariant( wxDataViewIconText( msg, icon ) ) ); - m_layers->AppendItem( row ); - } - // Init keepout parameters: m_cbTracksCtrl->SetValue( m_zonesettings.GetDoNotAllowTracks() ); m_cbViasCtrl->SetValue( m_zonesettings.GetDoNotAllowVias() ); m_cbCopperPourCtrl->SetValue( m_zonesettings.GetDoNotAllowCopperPour() ); - checkColumn->SetWidth( 25 ); // if only wxCOL_WIDTH_AUTOSIZE worked on all platforms... - layerColumn->SetMinWidth( minNamesWidth + LAYER_BITMAP_SIZE.x + 25 ); + m_cbConstrainCtrl->SetValue( m_zonesettings.m_Zone_45_Only ); - // You'd think the fact that m_layers is a list would encourage wxWidgets not to save room - // for the tree expanders... but you'd be wrong. Force indent to 0. - m_layers->SetIndent( 0 ); - m_layers->SetMinSize( wxSize( checkColumn->GetWidth() + layerColumn->GetWidth(), -1 ) ); - - m_layers->Update(); - - Update(); - - m_sdbSizerButtonsOK->Enable( m_zonesettings.m_Layers.count() > 0 ); -} - - -bool DIALOG_KEEPOUT_AREA_PROPERTIES::TransferDataFromWindow() -{ - if( AcceptOptionsForKeepOut() ) + switch( m_zonesettings.m_Zone_HatchingStyle ) { - *m_ptr = m_zonesettings; - return true; + case ZONE_CONTAINER::NO_HATCH: m_OutlineAppearanceCtrl->SetSelection( 0 ); break; + case ZONE_CONTAINER::DIAGONAL_EDGE: m_OutlineAppearanceCtrl->SetSelection( 1 ); break; + case ZONE_CONTAINER::DIAGONAL_FULL: m_OutlineAppearanceCtrl->SetSelection( 2 ); break; } - return false; + return true; } void DIALOG_KEEPOUT_AREA_PROPERTIES::OnLayerSelection( wxDataViewEvent& event ) { if( event.GetColumn() != 0 ) - { return; - } - wxDataViewItem item = event.GetItem(); - - int row = m_layers->ItemToRow( item ); + int row = m_layers->ItemToRow( event.GetItem() ); + wxVariant layerID; + m_layers->GetValue( layerID, row, 2 ); bool selected = m_layers->GetToggleValue( row, 0 ); - BOARD* board = m_parent->GetBoard(); - LSEQ cu_stack = LSET::AllCuMask( board->GetCopperLayerCount() ).UIOrder(); - - if( row >= 0 && row < (int)cu_stack.size() ) - { - m_zonesettings.m_Layers.set( cu_stack[ row ], selected ); - } - - m_sdbSizerButtonsOK->Enable( m_zonesettings.m_Layers.count() > 0 ); + m_zonesettings.m_Layers.set( ToLAYER_ID( layerID.GetInteger() ), selected ); } -bool DIALOG_KEEPOUT_AREA_PROPERTIES::AcceptOptionsForKeepOut() +bool DIALOG_KEEPOUT_AREA_PROPERTIES::TransferDataFromWindow() { // Init keepout parameters: m_zonesettings.SetIsKeepout( true ); @@ -245,8 +125,7 @@ bool DIALOG_KEEPOUT_AREA_PROPERTIES::AcceptOptionsForKeepOut() ! m_zonesettings.GetDoNotAllowVias() && ! m_zonesettings.GetDoNotAllowCopperPour() ) { - DisplayError( NULL, - _("Tracks, vias, and pads are allowed. The keepout is useless" ) ); + DisplayError( NULL, _("Tracks, vias, and pads are allowed. The keepout will have no effect." ) ); return false; } @@ -258,43 +137,19 @@ bool DIALOG_KEEPOUT_AREA_PROPERTIES::AcceptOptionsForKeepOut() switch( m_OutlineAppearanceCtrl->GetSelection() ) { - case 0: - m_zonesettings.m_Zone_HatchingStyle = ZONE_CONTAINER::NO_HATCH; - break; - - case 1: - m_zonesettings.m_Zone_HatchingStyle = ZONE_CONTAINER::DIAGONAL_EDGE; - break; - - case 2: - m_zonesettings.m_Zone_HatchingStyle = ZONE_CONTAINER::DIAGONAL_FULL; - break; + case 0: m_zonesettings.m_Zone_HatchingStyle = ZONE_CONTAINER::NO_HATCH; break; + case 1: m_zonesettings.m_Zone_HatchingStyle = ZONE_CONTAINER::DIAGONAL_EDGE; break; + case 2: m_zonesettings.m_Zone_HatchingStyle = ZONE_CONTAINER::DIAGONAL_FULL; break; } if( m_config ) - { - m_config->Write( ZONE_NET_OUTLINES_HATCH_OPTION_KEY, - (long) m_zonesettings.m_Zone_HatchingStyle ); - } - - if( m_OrientEdgesOpt->GetSelection() == 0 ) - m_zonesettings.m_Zone_45_Only = false; - else - m_zonesettings.m_Zone_45_Only = true; + m_config->Write( ZONE_NET_OUTLINES_STYLE_KEY, (long) m_zonesettings.m_Zone_HatchingStyle ); + m_zonesettings.m_Zone_45_Only = m_cbConstrainCtrl->GetValue(); m_zonesettings.m_ZonePriority = 0; // for a keepout, this param is not used. - // set it to 0 + + *m_ptr = m_zonesettings; return true; } -void DIALOG_KEEPOUT_AREA_PROPERTIES::OnSizeLayersList( wxSizeEvent& event ) -{ - int nameColWidth = event.GetSize().GetX() - m_layers->GetColumn( 0 )->GetWidth() - 8; - - m_layers->GetColumn( 1 )->SetWidth( nameColWidth ); - - event.Skip(); -} - - diff --git a/pcbnew/dialogs/dialog_keepout_area_properties_base.cpp b/pcbnew/dialogs/dialog_keepout_area_properties_base.cpp index 1f1587aee4..e85d96a076 100644 --- a/pcbnew/dialogs/dialog_keepout_area_properties_base.cpp +++ b/pcbnew/dialogs/dialog_keepout_area_properties_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 20 2018) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -24,10 +24,9 @@ DIALOG_KEEPOUT_AREA_PROPERTIES_BASE::DIALOG_KEEPOUT_AREA_PROPERTIES_BASE( wxWind m_staticTextLayerSelection = new wxStaticText( this, wxID_ANY, _("Layers:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextLayerSelection->Wrap( -1 ); - bLayersListSizer->Add( m_staticTextLayerSelection, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - m_layers = new wxDataViewListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_NO_HEADER ); + m_layers = new wxDataViewListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_NO_HEADER|wxSUNKEN_BORDER ); bLayersListSizer->Add( m_layers, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); @@ -36,54 +35,45 @@ DIALOG_KEEPOUT_AREA_PROPERTIES_BASE::DIALOG_KEEPOUT_AREA_PROPERTIES_BASE( wxWind wxBoxSizer* bSizerRight; bSizerRight = new wxBoxSizer( wxVERTICAL ); - m_cbTracksCtrl = new wxCheckBox( this, wxID_ANY, _("Keepout tracks"), wxDefaultPosition, wxDefaultSize, 0 ); + m_cbTracksCtrl = new wxCheckBox( this, wxID_ANY, _("Keep out tracks"), wxDefaultPosition, wxDefaultSize, 0 ); bSizerRight->Add( m_cbTracksCtrl, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - m_cbViasCtrl = new wxCheckBox( this, wxID_ANY, _("Keepout vias"), wxDefaultPosition, wxDefaultSize, 0 ); + m_cbViasCtrl = new wxCheckBox( this, wxID_ANY, _("Keep out vias"), wxDefaultPosition, wxDefaultSize, 0 ); bSizerRight->Add( m_cbViasCtrl, 0, wxTOP|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - m_cbCopperPourCtrl = new wxCheckBox( this, wxID_ANY, _("Keepout copper pours"), wxDefaultPosition, wxDefaultSize, 0 ); + m_cbCopperPourCtrl = new wxCheckBox( this, wxID_ANY, _("Keep out copper pours"), wxDefaultPosition, wxDefaultSize, 0 ); bSizerRight->Add( m_cbCopperPourCtrl, 0, wxALL|wxEXPAND, 5 ); bSizerRight->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + m_cbConstrainCtrl = new wxCheckBox( this, wxID_ANY, _("Constrain outline to H, V and 45 deg"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerRight->Add( m_cbConstrainCtrl, 0, wxALL, 5 ); + wxBoxSizer* bSizerLowerRight; - bSizerLowerRight = new wxBoxSizer( wxVERTICAL ); + bSizerLowerRight = new wxBoxSizer( wxHORIZONTAL ); - m_staticTextSlope = new wxStaticText( this, wxID_ANY, _("Outline slope:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticTextSlope->Wrap( -1 ); - - bSizerLowerRight->Add( m_staticTextSlope, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); - - wxString m_OrientEdgesOptChoices[] = { _("Arbitrary"), _("H, V, and 45 deg only") }; - int m_OrientEdgesOptNChoices = sizeof( m_OrientEdgesOptChoices ) / sizeof( wxString ); - m_OrientEdgesOpt = new wxChoice( this, ID_M_ORIENTEDGESOPT, wxDefaultPosition, wxDefaultSize, m_OrientEdgesOptNChoices, m_OrientEdgesOptChoices, 0 ); - m_OrientEdgesOpt->SetSelection( 0 ); - bSizerLowerRight->Add( m_OrientEdgesOpt, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - - m_staticTextStyle = new wxStaticText( this, wxID_ANY, _("Outline style:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextStyle = new wxStaticText( this, wxID_ANY, _("Outline display:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextStyle->Wrap( -1 ); - - bSizerLowerRight->Add( m_staticTextStyle, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); + bSizerLowerRight->Add( m_staticTextStyle, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); wxString m_OutlineAppearanceCtrlChoices[] = { _("Line"), _("Hatched"), _("Fully hatched") }; int m_OutlineAppearanceCtrlNChoices = sizeof( m_OutlineAppearanceCtrlChoices ) / sizeof( wxString ); m_OutlineAppearanceCtrl = new wxChoice( this, ID_M_OUTLINEAPPEARANCECTRL, wxDefaultPosition, wxDefaultSize, m_OutlineAppearanceCtrlNChoices, m_OutlineAppearanceCtrlChoices, 0 ); m_OutlineAppearanceCtrl->SetSelection( 0 ); - bSizerLowerRight->Add( m_OutlineAppearanceCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + bSizerLowerRight->Add( m_OutlineAppearanceCtrl, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); bSizerRight->Add( bSizerLowerRight, 1, wxEXPAND, 5 ); - bUpperSizer->Add( bSizerRight, 0, wxEXPAND|wxALL, 5 ); + bUpperSizer->Add( bSizerRight, 0, wxEXPAND|wxALL, 10 ); - bMainSizer->Add( bUpperSizer, 1, wxEXPAND, 5 ); + bMainSizer->Add( bUpperSizer, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bMainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); + bMainSizer->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); m_sdbSizerButtons = new wxStdDialogButtonSizer(); m_sdbSizerButtonsOK = new wxButton( this, wxID_OK ); @@ -92,7 +82,7 @@ DIALOG_KEEPOUT_AREA_PROPERTIES_BASE::DIALOG_KEEPOUT_AREA_PROPERTIES_BASE( wxWind m_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel ); m_sdbSizerButtons->Realize(); - bMainSizer->Add( m_sdbSizerButtons, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + bMainSizer->Add( m_sdbSizerButtons, 0, wxEXPAND|wxALL, 5 ); this->SetSizer( bMainSizer ); diff --git a/pcbnew/dialogs/dialog_keepout_area_properties_base.fbp b/pcbnew/dialogs/dialog_keepout_area_properties_base.fbp index 2bc8d5bedb..2e35b9ede3 100644 --- a/pcbnew/dialogs/dialog_keepout_area_properties_base.fbp +++ b/pcbnew/dialogs/dialog_keepout_area_properties_base.fbp @@ -14,7 +14,6 @@ dialog_keepout_area_properties_base 1000 none - 1 dialog_keepout_areas_properties_base @@ -96,7 +95,7 @@ none 5 - wxEXPAND + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 1 @@ -145,7 +144,6 @@ 0 wxID_ANY Layers: - 0 0 @@ -220,7 +218,7 @@ - + wxSUNKEN_BORDER @@ -267,7 +265,7 @@ - 5 + 10 wxEXPAND|wxALL 0 @@ -308,7 +306,7 @@ 0 0 wxID_ANY - Keepout tracks + Keep out tracks 0 @@ -396,7 +394,7 @@ 0 0 wxID_ANY - Keepout vias + Keep out vias 0 @@ -484,7 +482,7 @@ 0 0 wxID_ANY - Keepout copper pours + Keep out copper pours 0 @@ -549,6 +547,94 @@ 0 + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Constrain outline to H, V and 45 deg + + 0 + + + 0 + + 1 + m_cbConstrainCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 wxEXPAND @@ -556,11 +642,11 @@ bSizerLowerRight - wxVERTICAL + wxHORIZONTAL none 5 - wxLEFT|wxRIGHT|wxTOP + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT 0 1 @@ -590,180 +676,7 @@ 0 0 wxID_ANY - Outline slope: - 0 - - 0 - - - 0 - - 1 - m_staticTextSlope - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Arbitrary" "H, V, and 45 deg only" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_M_ORIENTEDGESOPT - - 0 - - - 0 - - 1 - m_OrientEdgesOpt - 1 - - - protected - 1 - - Resizable - 0 - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxLEFT|wxRIGHT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Outline style: - 0 + Outline display: 0 @@ -816,7 +729,7 @@ 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT + wxEXPAND|wxRIGHT|wxLEFT 0 1 @@ -910,7 +823,7 @@ 5 - wxEXPAND | wxALL + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 1 @@ -991,7 +904,7 @@ 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT + wxEXPAND|wxALL 0 0 diff --git a/pcbnew/dialogs/dialog_keepout_area_properties_base.h b/pcbnew/dialogs/dialog_keepout_area_properties_base.h index 265d06eefe..d2392a4dc8 100644 --- a/pcbnew/dialogs/dialog_keepout_area_properties_base.h +++ b/pcbnew/dialogs/dialog_keepout_area_properties_base.h @@ -1,68 +1,66 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 20 2018) -// http://www.wxformbuilder.org/ -// -// PLEASE DO *NOT* EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#ifndef __DIALOG_KEEPOUT_AREA_PROPERTIES_BASE_H__ -#define __DIALOG_KEEPOUT_AREA_PROPERTIES_BASE_H__ - -#include -#include -#include -#include "dialog_shim.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/////////////////////////////////////////////////////////////////////////// - -#define ID_M_ORIENTEDGESOPT 1000 -#define ID_M_OUTLINEAPPEARANCECTRL 1001 - -/////////////////////////////////////////////////////////////////////////////// -/// Class DIALOG_KEEPOUT_AREA_PROPERTIES_BASE -/////////////////////////////////////////////////////////////////////////////// -class DIALOG_KEEPOUT_AREA_PROPERTIES_BASE : public DIALOG_SHIM -{ - private: - - protected: - wxStaticText* m_staticTextLayerSelection; - wxDataViewListCtrl* m_layers; - wxCheckBox* m_cbTracksCtrl; - wxCheckBox* m_cbViasCtrl; - wxCheckBox* m_cbCopperPourCtrl; - wxStaticText* m_staticTextSlope; - wxChoice* m_OrientEdgesOpt; - wxStaticText* m_staticTextStyle; - wxChoice* m_OutlineAppearanceCtrl; - wxStaticLine* m_staticline1; - wxStdDialogButtonSizer* m_sdbSizerButtons; - wxButton* m_sdbSizerButtonsOK; - wxButton* m_sdbSizerButtonsCancel; - - // Virtual event handlers, overide them in your derived class - virtual void OnLayerSelection( wxDataViewEvent& event ) { event.Skip(); } - virtual void OnSizeLayersList( wxSizeEvent& event ) { event.Skip(); } - - - public: - - DIALOG_KEEPOUT_AREA_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Keepout Area Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER ); - ~DIALOG_KEEPOUT_AREA_PROPERTIES_BASE(); - -}; - -#endif //__DIALOG_KEEPOUT_AREA_PROPERTIES_BASE_H__ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Dec 30 2017) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOG_KEEPOUT_AREA_PROPERTIES_BASE_H__ +#define __DIALOG_KEEPOUT_AREA_PROPERTIES_BASE_H__ + +#include +#include +#include +#include "dialog_shim.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + +#define ID_M_OUTLINEAPPEARANCECTRL 1000 + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_KEEPOUT_AREA_PROPERTIES_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_KEEPOUT_AREA_PROPERTIES_BASE : public DIALOG_SHIM +{ + private: + + protected: + wxStaticText* m_staticTextLayerSelection; + wxDataViewListCtrl* m_layers; + wxCheckBox* m_cbTracksCtrl; + wxCheckBox* m_cbViasCtrl; + wxCheckBox* m_cbCopperPourCtrl; + wxCheckBox* m_cbConstrainCtrl; + wxStaticText* m_staticTextStyle; + wxChoice* m_OutlineAppearanceCtrl; + wxStaticLine* m_staticline1; + wxStdDialogButtonSizer* m_sdbSizerButtons; + wxButton* m_sdbSizerButtonsOK; + wxButton* m_sdbSizerButtonsCancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnLayerSelection( wxDataViewEvent& event ) { event.Skip(); } + virtual void OnSizeLayersList( wxSizeEvent& event ) { event.Skip(); } + + + public: + + DIALOG_KEEPOUT_AREA_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Keepout Area Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER ); + ~DIALOG_KEEPOUT_AREA_PROPERTIES_BASE(); + +}; + +#endif //__DIALOG_KEEPOUT_AREA_PROPERTIES_BASE_H__ diff --git a/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp b/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp index 2f286930dd..825a7d80ae 100644 --- a/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp +++ b/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp @@ -6,7 +6,7 @@ * * Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 1992-2014 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 * modify it under the terms of the GNU General Public License @@ -30,240 +30,133 @@ #include #include #include -#include - -#include +#include #include - -#include #include -#include // needed for wx/listctrl.h, in wxGTK 2.8.12 - #include -#define LAYER_BITMAP_SIZE_X 20 -#define LAYER_BITMAP_SIZE_Y 10 -/** - * Class DIALOG_NON_COPPER_ZONES_EDITOR - * is a dialog editor for non copper zones properties, - * derived from DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE, which is maintained and - * created by wxFormBuilder - */ class DIALOG_NON_COPPER_ZONES_EDITOR : public DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE { private: PCB_BASE_FRAME* m_parent; - ZONE_CONTAINER* m_zone; ZONE_SETTINGS* m_ptr; ZONE_SETTINGS m_settings; // working copy of zone settings + UNIT_BINDER m_minWidth; - void OnOkClick( wxCommandEvent& event ) override; - void OnCancelClick( wxCommandEvent& event ) override; - void Init(); + bool TransferDataToWindow() override; + bool TransferDataFromWindow() override; + + void OnLayerSelection( wxDataViewEvent& event ) override; public: - DIALOG_NON_COPPER_ZONES_EDITOR( PCB_BASE_FRAME* aParent, - ZONE_CONTAINER* aZone, ZONE_SETTINGS* aSettings ); - -private: - /** - * Function makeLayerBitmap - * creates the colored rectangle bitmaps used in the layer selection widget. - * @param aColor is the color to fill the rectangle with. - */ - wxBitmap makeLayerBitmap( COLOR4D aColor ); + DIALOG_NON_COPPER_ZONES_EDITOR( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* aSettings ); }; -ZONE_EDIT_T InvokeNonCopperZonesEditor( PCB_BASE_FRAME* aParent, - ZONE_CONTAINER* aZone, ZONE_SETTINGS* aSettings ) +int InvokeNonCopperZonesEditor( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* aSettings ) { - DIALOG_NON_COPPER_ZONES_EDITOR dlg( aParent, aZone, aSettings ); + DIALOG_NON_COPPER_ZONES_EDITOR dlg( aParent, aSettings ); - ZONE_EDIT_T result = ZONE_EDIT_T( dlg.ShowModal() ); - - return result; + return dlg.ShowModal(); } DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR( PCB_BASE_FRAME* aParent, - ZONE_CONTAINER* aZone, 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, 10*IU_PER_MILS ) { m_parent = aParent; - m_zone = aZone; m_ptr = aSettings; m_settings = *aSettings; - Init(); + m_settings.SetupLayersList( m_layers, m_parent, false ); - // the size of some items has changed, so we must call SetSizeHints() - GetSizer()->SetSizeHints( this ); + FinishDialogSettings(); } -void DIALOG_NON_COPPER_ZONES_EDITOR::Init() +bool DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataToWindow() { - BOARD* board = m_parent->GetBoard(); - - SetReturnCode( ZONE_ABORT ); // Will be changed on button click - - AddUnitSymbol( *m_MinThicknessValueTitle, g_UserUnit ); - wxString msg = StringFromValue( g_UserUnit, m_settings.m_ZoneMinThickness ); - m_ZoneMinThicknessCtrl->SetValue( msg ); - - if( m_settings.m_Zone_45_Only ) - m_OrientEdgesOpt->SetSelection( 1 ); + m_minWidth.SetValue( m_settings.m_ZoneMinThickness ); + m_ConstrainOpt->SetValue( m_settings.m_Zone_45_Only ); switch( m_settings.m_Zone_HatchingStyle ) { - case ZONE_CONTAINER::NO_HATCH: - m_OutlineAppearanceCtrl->SetSelection( 0 ); - break; - - case ZONE_CONTAINER::DIAGONAL_EDGE: - m_OutlineAppearanceCtrl->SetSelection( 1 ); - break; - - case ZONE_CONTAINER::DIAGONAL_FULL: - m_OutlineAppearanceCtrl->SetSelection( 2 ); - break; + case ZONE_CONTAINER::NO_HATCH: m_OutlineAppearanceCtrl->SetSelection( 0 ); break; + case ZONE_CONTAINER::DIAGONAL_EDGE: m_OutlineAppearanceCtrl->SetSelection( 1 ); break; + case ZONE_CONTAINER::DIAGONAL_FULL: m_OutlineAppearanceCtrl->SetSelection( 2 ); break; } - // Create one column in m_LayerSelectionCtrl - wxListItem column0; - column0.SetId( 0 ); - m_LayerSelectionCtrl->InsertColumn( 0, column0 ); - - // Create an icon list: - wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y ); - m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL ); - - PCB_LAYER_ID lyrSelect = m_parent->GetActiveLayer(); - - if( m_zone ) - lyrSelect = m_zone->GetLayer(); - - int ctrlWidth = 0; // Min width for m_LayerSelectionCtrl to show the layers names - int imgIdx = 0; - - for( LSEQ seq = LSET::AllNonCuMask().Seq(); seq; ++seq, ++imgIdx ) - { - PCB_LAYER_ID layer = *seq; - - COLOR4D layerColor = m_parent->Settings().Colors().GetLayerColor( layer ); - - imageList->Add( makeLayerBitmap( layerColor ) ); - - msg = board->GetLayerName( layer ); - msg.Trim(); - - int itemIndex = m_LayerSelectionCtrl->InsertItem( - m_LayerSelectionCtrl->GetItemCount(), msg, imgIdx ); - - if(lyrSelect == layer ) - m_LayerSelectionCtrl->Select( itemIndex ); - - wxSize tsize( GetTextSize( msg, m_LayerSelectionCtrl ) ); - ctrlWidth = std::max( ctrlWidth, tsize.x ); - } - - // The most easy way to ensure the right size is to use wxLIST_AUTOSIZE - // unfortunately this option does not work well both on - // wxWidgets 2.8 ( column witdth too small), and - // wxWidgets 2.9 ( column witdth too large) - ctrlWidth += LAYER_BITMAP_SIZE_X + 25; // Add bitmap width + margin between bitmap and text - m_LayerSelectionCtrl->SetColumnWidth( 0, ctrlWidth ); - - ctrlWidth += 25; // add small margin between text and window borders - // and room for vertical scroll bar - m_LayerSelectionCtrl->SetMinSize( wxSize( ctrlWidth, -1 ) ); + return true; } -void DIALOG_NON_COPPER_ZONES_EDITOR::OnOkClick( wxCommandEvent& event ) +void DIALOG_NON_COPPER_ZONES_EDITOR::OnLayerSelection( wxDataViewEvent& event ) { - wxString txtvalue = m_ZoneMinThicknessCtrl->GetValue(); - - m_settings.m_ZoneMinThickness = ValueFromString( g_UserUnit, txtvalue ); - - if( m_settings.m_ZoneMinThickness < 10 ) - { - DisplayError( this, - _( "Error :\nyou must choose a min thickness value bigger than 0.001 inch (or 0.0254 mm)" ) ); + if( event.GetColumn() != 0 ) return; + + int row = m_layers->ItemToRow( event.GetItem() ); + + if( m_layers->GetToggleValue( row, 0 ) ) + { + wxVariant layerID; + m_layers->GetValue( layerID, row, 2 ); + m_settings.m_CurrentZone_Layer = ToLAYER_ID( layerID.GetInteger() ); + + // Turn all other checkboxes off. + for( int ii = 0; ii < m_layers->GetItemCount(); ++ii ) + { + if( ii != row ) + m_layers->SetToggleValue( false, ii, 0 ); + } } +} + + +bool DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataFromWindow() +{ + m_settings.m_ZoneMinThickness = m_minWidth.GetValue(); m_settings.m_FillMode = ZFM_POLYGONS; // Use always polygon fill mode switch( m_OutlineAppearanceCtrl->GetSelection() ) { - case 0: - m_settings.m_Zone_HatchingStyle = ZONE_CONTAINER::NO_HATCH; - break; - - case 1: - m_settings.m_Zone_HatchingStyle = ZONE_CONTAINER::DIAGONAL_EDGE; - break; - - case 2: - m_settings.m_Zone_HatchingStyle = ZONE_CONTAINER::DIAGONAL_FULL; - break; + case 0: m_settings.m_Zone_HatchingStyle = ZONE_CONTAINER::NO_HATCH; break; + case 1: m_settings.m_Zone_HatchingStyle = ZONE_CONTAINER::DIAGONAL_EDGE; break; + case 2: m_settings.m_Zone_HatchingStyle = ZONE_CONTAINER::DIAGONAL_FULL; break; } wxConfigBase* cfg = Kiface().KifaceSettings(); wxASSERT( cfg ); - cfg->Write( ZONE_NET_OUTLINES_HATCH_OPTION_KEY, (long) m_settings.m_Zone_HatchingStyle ); + cfg->Write( ZONE_NET_OUTLINES_STYLE_KEY, (long) m_settings.m_Zone_HatchingStyle ); - if( m_OrientEdgesOpt->GetSelection() == 0 ) - m_settings.m_Zone_45_Only = false; - else - m_settings.m_Zone_45_Only = true; + m_settings.m_Zone_45_Only = m_ConstrainOpt->GetValue(); // Get the layer selection for this zone - int ii = m_LayerSelectionCtrl->GetFirstSelected(); - - if( ii < 0 ) + int layer = -1; + for( unsigned int ii = 0; ii < (int) m_layers->GetItemCount(); ++ii ) { - DisplayError( this, _( "Error : you must choose a layer" ) ); - return; + if( m_layers->GetToggleValue( ii, 0 ) ) + { + layer = ii; + break; + } } - LSEQ seq = LSET::AllNonCuMask().Seq(); - - m_settings.m_CurrentZone_Layer = seq[ii]; + if( layer < 0 ) + { + DisplayError( this, _( "No layer selected." ) ); + return false; + } *m_ptr = m_settings; - - EndModal( ZONE_OK ); + return true; } -void DIALOG_NON_COPPER_ZONES_EDITOR::OnCancelClick( wxCommandEvent& event ) -{ - // do not save the edits. - - EndModal( ZONE_ABORT ); -} - - -wxBitmap DIALOG_NON_COPPER_ZONES_EDITOR::makeLayerBitmap( COLOR4D aColor ) -{ - wxBitmap bitmap( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y ); - wxBrush brush; - wxMemoryDC iconDC; - - iconDC.SelectObject( bitmap ); - brush.SetColour( aColor.ToColour() ); - brush.SetStyle( wxBRUSHSTYLE_SOLID ); - - iconDC.SetBrush( brush ); - iconDC.DrawRectangle( 0, 0, LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y ); - - return bitmap; -} diff --git a/pcbnew/dialogs/dialog_non_copper_zones_properties_base.cpp b/pcbnew/dialogs/dialog_non_copper_zones_properties_base.cpp index 5b35777790..2dc89b8fd7 100644 --- a/pcbnew/dialogs/dialog_non_copper_zones_properties_base.cpp +++ b/pcbnew/dialogs/dialog_non_copper_zones_properties_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 19 2018) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -9,11 +9,6 @@ /////////////////////////////////////////////////////////////////////////// -BEGIN_EVENT_TABLE( DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE, DIALOG_SHIM ) - EVT_BUTTON( wxID_CANCEL, DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::_wxFB_OnCancelClick ) - EVT_BUTTON( wxID_OK, DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::_wxFB_OnOkClick ) -END_EVENT_TABLE() - 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 ); @@ -27,52 +22,61 @@ DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE( wxBoxSizer* bSizerLeft; bSizerLeft = new wxBoxSizer( wxVERTICAL ); - m_staticTextLayerSelection = new wxStaticText( this, wxID_ANY, _("Layer selection:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextLayerSelection = new wxStaticText( this, wxID_ANY, _("Layer:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextLayerSelection->Wrap( -1 ); bSizerLeft->Add( m_staticTextLayerSelection, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - m_LayerSelectionCtrl = new wxListView( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_ALIGN_LEFT|wxLC_NO_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL ); - bSizerLeft->Add( m_LayerSelectionCtrl, 1, wxALL|wxEXPAND, 5 ); + m_layers = new wxDataViewListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_NO_HEADER|wxSUNKEN_BORDER ); + m_layers->SetMinSize( wxSize( -1,200 ) ); + + bSizerLeft->Add( m_layers, 0, wxALL, 5 ); - m_UpperSizer->Add( bSizerLeft, 1, wxEXPAND, 5 ); + m_UpperSizer->Add( bSizerLeft, 0, wxEXPAND, 5 ); wxBoxSizer* bSizerRight; bSizerRight = new wxBoxSizer( wxVERTICAL ); - wxStaticBoxSizer* m_OutilinesBoxOpt; - m_OutilinesBoxOpt = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Outlines Options:") ), wxVERTICAL ); + wxGridBagSizer* gbSizer1; + gbSizer1 = new wxGridBagSizer( 0, 0 ); + gbSizer1->SetFlexibleDirection( wxBOTH ); + gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - wxString m_OrientEdgesOptChoices[] = { _("Any"), _("H, V and 45 deg") }; - int m_OrientEdgesOptNChoices = sizeof( m_OrientEdgesOptChoices ) / sizeof( wxString ); - m_OrientEdgesOpt = new wxRadioBox( m_OutilinesBoxOpt->GetStaticBox(), wxID_ANY, _("Zone Edge Orientation:"), wxDefaultPosition, wxDefaultSize, m_OrientEdgesOptNChoices, m_OrientEdgesOptChoices, 1, wxRA_SPECIFY_COLS ); - m_OrientEdgesOpt->SetSelection( 0 ); - m_OutilinesBoxOpt->Add( m_OrientEdgesOpt, 0, wxALL|wxEXPAND, 5 ); + 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 ); - wxString m_OutlineAppearanceCtrlChoices[] = { _("Line"), _("Hatched outline"), _("Full hatched") }; + m_staticTextStyle = new wxStaticText( this, wxID_ANY, _("Outline display:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextStyle->Wrap( -1 ); + gbSizer1->Add( m_staticTextStyle, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + wxString m_OutlineAppearanceCtrlChoices[] = { _("Line"), _("Hatched"), _("Fully hatched") }; int m_OutlineAppearanceCtrlNChoices = sizeof( m_OutlineAppearanceCtrlChoices ) / sizeof( wxString ); - m_OutlineAppearanceCtrl = new wxRadioBox( m_OutilinesBoxOpt->GetStaticBox(), wxID_ANY, _("Outline Appearance:"), wxDefaultPosition, wxDefaultSize, m_OutlineAppearanceCtrlNChoices, m_OutlineAppearanceCtrlChoices, 1, wxRA_SPECIFY_COLS ); - m_OutlineAppearanceCtrl->SetSelection( 1 ); - m_OutilinesBoxOpt->Add( m_OutlineAppearanceCtrl, 0, wxALL|wxEXPAND, 5 ); + m_OutlineAppearanceCtrl = new wxChoice( this, ID_M_OUTLINEAPPEARANCECTRL, wxDefaultPosition, wxDefaultSize, m_OutlineAppearanceCtrlNChoices, m_OutlineAppearanceCtrlChoices, 0 ); + m_OutlineAppearanceCtrl->SetSelection( 0 ); + 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->Wrap( -1 ); + 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 ); + 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->Wrap( -1 ); + gbSizer1->Add( m_MinWidthUnits, wxGBPosition( 2, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 ); - bSizerRight->Add( m_OutilinesBoxOpt, 0, wxEXPAND|wxALL, 5 ); - - m_MinThicknessValueTitle = new wxStaticText( this, wxID_ANY, _("Zone min thickness value:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_MinThicknessValueTitle->Wrap( -1 ); - bSizerRight->Add( m_MinThicknessValueTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_ZoneMinThicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bSizerRight->Add( m_ZoneMinThicknessCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bSizerRight->Add( gbSizer1, 1, wxEXPAND, 5 ); - m_UpperSizer->Add( bSizerRight, 0, wxEXPAND, 5 ); + m_UpperSizer->Add( bSizerRight, 0, wxEXPAND|wxALL, 10 ); - m_MainSizer->Add( m_UpperSizer, 1, wxEXPAND, 5 ); + m_MainSizer->Add( m_UpperSizer, 0, wxEXPAND|wxALL, 5 ); m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - m_MainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); + m_MainSizer->Add( m_staticline1, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); m_sdbSizerButtons = new wxStdDialogButtonSizer(); m_sdbSizerButtonsOK = new wxButton( this, wxID_OK ); @@ -81,7 +85,7 @@ DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE( m_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel ); m_sdbSizerButtons->Realize(); - m_MainSizer->Add( m_sdbSizerButtons, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + m_MainSizer->Add( m_sdbSizerButtons, 0, wxEXPAND|wxALL, 5 ); this->SetSizer( m_MainSizer ); @@ -89,8 +93,14 @@ DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE( m_MainSizer->Fit( this ); this->Centre( wxBOTH ); + + // Connect Events + m_layers->Connect( wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, wxDataViewEventHandler( DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::OnLayerSelection ), NULL, this ); } DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::~DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE() { + // Disconnect Events + m_layers->Disconnect( wxEVT_COMMAND_DATAVIEW_ITEM_VALUE_CHANGED, wxDataViewEventHandler( DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE::OnLayerSelection ), NULL, this ); + } diff --git a/pcbnew/dialogs/dialog_non_copper_zones_properties_base.fbp b/pcbnew/dialogs/dialog_non_copper_zones_properties_base.fbp index 42e1fcfdf8..eff67c2e42 100644 --- a/pcbnew/dialogs/dialog_non_copper_zones_properties_base.fbp +++ b/pcbnew/dialogs/dialog_non_copper_zones_properties_base.fbp @@ -10,11 +10,10 @@ 0 res UTF-8 - table + connect dialog_non_copper_zones_properties_base 1000 none - 1 dialog_non_copper_zones_properties_base @@ -96,8 +95,8 @@ none 5 - wxEXPAND - 1 + wxEXPAND|wxALL + 0 m_UpperSizer @@ -106,7 +105,7 @@ 5 wxEXPAND - 1 + 0 bSizerLeft @@ -144,7 +143,7 @@ 0 0 wxID_ANY - Layer selection: + Layer: 0 @@ -197,65 +196,48 @@ 5 - wxALL|wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - + wxALL + 0 + - - 1 - 0 - 1 1 - 0 - Dock - 0 - Left 1 - 1 - 0 0 wxID_ANY - - 0 - - 0 - - 1 - m_LayerSelectionCtrl - 1 - - + -1,200 + m_layers protected - 1 - Resizable - 1 - wxLC_ALIGN_LEFT|wxLC_NO_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL - wxListView; - 0 + wxDV_NO_HEADER + - - wxFILTER_NONE - wxDefaultValidator - - + wxSUNKEN_BORDER + + + + + + + + + + + + + + + + + OnLayerSelection + @@ -265,26 +247,6 @@ - - - - - - - - - - - - - - - - - - - - @@ -303,8 +265,8 @@ - 5 - wxEXPAND + 10 + wxEXPAND|wxALL 0 @@ -313,22 +275,27 @@ none 5 - wxEXPAND|wxALL - 0 - - wxID_ANY - Outlines Options: + wxEXPAND + 1 + + + wxBOTH + + + 0 - m_OutilinesBoxOpt - wxVERTICAL - 1 + gbSizer1 + wxFLEX_GROWMODE_SPECIFIED none - - + 0 + 5 - wxALL|wxEXPAND - 0 - + 3 + 0 + wxALL + 0 + 1 + 1 1 1 @@ -342,7 +309,7 @@ 1 0 - "Any" "H, V and 45 deg" + 0 1 1 @@ -357,8 +324,7 @@ 0 0 wxID_ANY - Zone Edge Orientation: - 1 + Constrain outline to H, V and 45 degrees 0 @@ -366,7 +332,7 @@ 0 1 - m_OrientEdgesOpt + m_ConstrainOpt 1 @@ -374,11 +340,10 @@ 1 Resizable - 0 1 - wxRA_SPECIFY_COLS - + + ; forward_declare 0 @@ -389,6 +354,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 0 + wxALIGN_CENTER_VERTICAL|wxALL + 1 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Outline display: + + 0 + + + 0 + + 1 + m_staticTextStyle + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + @@ -405,7 +457,6 @@ - @@ -414,11 +465,14 @@ - + 5 + 1 + 1 wxALL|wxEXPAND - 0 - + 1 + 1 + 1 1 1 @@ -432,7 +486,7 @@ 1 0 - "Line" "Hatched outline" "Full hatched" + "Line" "Hatched" "Fully hatched" 1 1 @@ -446,9 +500,7 @@ 0 0 - wxID_ANY - Outline Appearance: - 1 + ID_M_OUTLINEAPPEARANCECTRL 0 @@ -464,10 +516,10 @@ 1 Resizable - 1 + 0 1 - wxRA_SPECIFY_COLS + 0 @@ -479,6 +531,273 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 0 + wxALIGN_CENTER_VERTICAL|wxALL + 2 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Minimum width: + + 0 + + + 0 + + 1 + m_MinWidthLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 1 + wxALL|wxEXPAND + 2 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + + 0 + + 1 + m_MinWidthCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 2 + wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT + 2 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + units + + 0 + + + 0 + + 1 + m_MinWidthUnits + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 + @@ -495,7 +814,6 @@ - @@ -506,187 +824,13 @@ - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Zone min thickness value: - - 0 - - - 0 - - 1 - m_MinThicknessValueTitle - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - - 0 - - 1 - m_ZoneMinThicknessCtrl - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND | wxALL + wxEXPAND|wxRIGHT|wxLEFT 0 1 @@ -767,7 +911,7 @@ 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT + wxEXPAND|wxALL 0 0 @@ -782,11 +926,11 @@ m_sdbSizerButtons protected - OnCancelClick + - OnOkClick + diff --git a/pcbnew/dialogs/dialog_non_copper_zones_properties_base.h b/pcbnew/dialogs/dialog_non_copper_zones_properties_base.h index 200118e1da..44e166bbdf 100644 --- a/pcbnew/dialogs/dialog_non_copper_zones_properties_base.h +++ b/pcbnew/dialogs/dialog_non_copper_zones_properties_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 19 2018) +// C++ code generated with wxFormBuilder (version Dec 30 2017) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -18,11 +18,12 @@ #include #include #include -#include +#include #include -#include -#include +#include +#include #include +#include #include #include #include @@ -34,29 +35,29 @@ /////////////////////////////////////////////////////////////////////////////// class DIALOG_NONCOPPER_ZONES_PROPERTIES_BASE : public DIALOG_SHIM { - DECLARE_EVENT_TABLE() private: - - // Private event handlers - void _wxFB_OnCancelClick( wxCommandEvent& event ){ OnCancelClick( event ); } - void _wxFB_OnOkClick( wxCommandEvent& event ){ OnOkClick( event ); } - protected: + enum + { + ID_M_OUTLINEAPPEARANCECTRL = 1000 + }; + wxStaticText* m_staticTextLayerSelection; - wxListView* m_LayerSelectionCtrl; - wxRadioBox* m_OrientEdgesOpt; - wxRadioBox* m_OutlineAppearanceCtrl; - wxStaticText* m_MinThicknessValueTitle; - wxTextCtrl* m_ZoneMinThicknessCtrl; + wxDataViewListCtrl* m_layers; + wxCheckBox* m_ConstrainOpt; + wxStaticText* m_staticTextStyle; + wxChoice* m_OutlineAppearanceCtrl; + wxStaticText* m_MinWidthLabel; + wxTextCtrl* m_MinWidthCtrl; + wxStaticText* m_MinWidthUnits; wxStaticLine* m_staticline1; wxStdDialogButtonSizer* m_sdbSizerButtons; wxButton* m_sdbSizerButtonsOK; wxButton* m_sdbSizerButtonsCancel; // Virtual event handlers, overide them in your derived class - virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } - virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnLayerSelection( wxDataViewEvent& event ) { event.Skip(); } public: diff --git a/pcbnew/tools/pcb_editor_control.cpp b/pcbnew/tools/pcb_editor_control.cpp index 9395dae90a..67f10ed19b 100644 --- a/pcbnew/tools/pcb_editor_control.cpp +++ b/pcbnew/tools/pcb_editor_control.cpp @@ -764,9 +764,8 @@ int PCB_EDITOR_CONTROL::ZoneDuplicate( const TOOL_EVENT& aEvent ) auto selTool = m_toolMgr->GetTool(); const auto& selection = selTool->GetSelection(); - // because this pops up the zone editor, it would be confusing - // to handle multiple zones, so just handle single selections - // containing exactly one zone + // because this pops up the zone editor, it would be confusing to handle multiple zones, + // so just handle single selections containing exactly one zone if( selection.Size() != 1 ) return 0; @@ -775,37 +774,37 @@ int PCB_EDITOR_CONTROL::ZoneDuplicate( const TOOL_EVENT& aEvent ) if( !oldZone ) return 0; + ZONE_SETTINGS zoneSettings; + zoneSettings << *oldZone; + int dialogResult; + + if( oldZone->GetIsKeepout() ) + dialogResult = InvokeKeepoutAreaEditor( m_frame, &zoneSettings ); + else if( oldZone->IsOnCopperLayer() ) + dialogResult = InvokeCopperZonesEditor( m_frame, &zoneSettings ); + else + dialogResult = InvokeNonCopperZonesEditor( m_frame, &zoneSettings ); + + if( dialogResult != wxID_OK ) + return 0; + + // duplicate the zone + BOARD_COMMIT commit( m_frame ); + auto newZone = std::make_unique( *oldZone ); newZone->ClearSelected(); newZone->UnFill(); - ZONE_SETTINGS zoneSettings; - zoneSettings << *oldZone; + zoneSettings.ExportSetting( *newZone ); - bool success = false; + // If the new zone is on the same layer(s) as the the initial zone, + // offset it a bit so it can more easily be picked. + if( oldZone->GetIsKeepout() && ( oldZone->GetLayerSet() == zoneSettings.m_Layers ) ) + newZone->Move( wxPoint( IU_PER_MM, IU_PER_MM ) ); + else if( !oldZone->GetIsKeepout() && ( oldZone->GetLayer() == zoneSettings.m_CurrentZone_Layer ) ) + newZone->Move( wxPoint( IU_PER_MM, IU_PER_MM ) ); - if( oldZone->GetIsKeepout() ) - success = InvokeKeepoutAreaEditor( m_frame, &zoneSettings ); - else if( oldZone->IsOnCopperLayer() ) - success = InvokeCopperZonesEditor( m_frame, &zoneSettings ); - else - success = InvokeNonCopperZonesEditor( m_frame, oldZone, &zoneSettings ); - - // duplicate the zone - if( success ) - { - BOARD_COMMIT commit( m_frame ); - zoneSettings.ExportSetting( *newZone ); - - // If the new zone is on the same layer(s) as the the initial zone, - // offset it a bit so it can more easily be picked. - if( oldZone->GetIsKeepout() && ( oldZone->GetLayerSet() == zoneSettings.m_Layers ) ) - newZone->Move( wxPoint( IU_PER_MM, IU_PER_MM ) ); - else if( !oldZone->GetIsKeepout() && ( oldZone->GetLayer() == zoneSettings.m_CurrentZone_Layer ) ) - newZone->Move( wxPoint( IU_PER_MM, IU_PER_MM ) ); - - commit.Add( newZone.release() ); - commit.Push( _( "Duplicate zone" ) ); - } + commit.Add( newZone.release() ); + commit.Push( _( "Duplicate zone" ) ); return 0; } diff --git a/pcbnew/tools/zone_create_helper.cpp b/pcbnew/tools/zone_create_helper.cpp index 933a56a3d0..a9c7b70c2f 100644 --- a/pcbnew/tools/zone_create_helper.cpp +++ b/pcbnew/tools/zone_create_helper.cpp @@ -36,8 +36,7 @@ #include -ZONE_CREATE_HELPER::ZONE_CREATE_HELPER( DRAWING_TOOL& aTool, - const PARAMS& aParams ): +ZONE_CREATE_HELPER::ZONE_CREATE_HELPER( DRAWING_TOOL& aTool, const PARAMS& aParams ): m_tool( aTool ), m_params( aParams ), m_parentView( *aTool.getView() ) @@ -70,7 +69,7 @@ std::unique_ptr ZONE_CREATE_HELPER::createNewZone( bool aKeepout // Get the current default settings for zones // Show options dialog - ZONE_EDIT_T dialogResult; + int dialogResult; if( m_params.m_keepout ) dialogResult = InvokeKeepoutAreaEditor( &frame, &zoneInfo ); @@ -79,13 +78,11 @@ std::unique_ptr ZONE_CREATE_HELPER::createNewZone( bool aKeepout if( IsCopperLayer( zoneInfo.m_CurrentZone_Layer ) ) dialogResult = InvokeCopperZonesEditor( &frame, &zoneInfo ); else - dialogResult = InvokeNonCopperZonesEditor( &frame, nullptr, &zoneInfo ); + dialogResult = InvokeNonCopperZonesEditor( &frame, &zoneInfo ); } - if( dialogResult == ZONE_ABORT ) - { + if( dialogResult == wxID_CANCEL ) return nullptr; - } } auto newZone = std::make_unique( &board ); @@ -113,29 +110,28 @@ std::unique_ptr ZONE_CREATE_HELPER::createZoneFromExisting( } -void ZONE_CREATE_HELPER::performZoneCutout( ZONE_CONTAINER& aExistingZone, - ZONE_CONTAINER& aCutout ) +void ZONE_CREATE_HELPER::performZoneCutout( ZONE_CONTAINER& aZone, ZONE_CONTAINER& aCutout ) { BOARD* board = m_tool.getModel(); - int curr_hole = aExistingZone.Outline()->NewHole( 0 ); + int curr_hole = aZone.Outline()->NewHole( 0 ); // Copy cutout corners into existing zone, in the new hole for( int ii = 0; ii < aCutout.GetNumCorners(); ii++ ) { - aExistingZone.Outline()->Append( aCutout.GetCornerPosition( ii ), 0, curr_hole ); + aZone.Outline()->Append( aCutout.GetCornerPosition( ii ), 0, curr_hole ); } // Be sure the current corner list is closed - aExistingZone.Outline()->Hole( 0, curr_hole ).SetClosed( true ); + aZone.Outline()->Hole( 0, curr_hole ).SetClosed( true ); // Combine holes and simplify the new outline: - board->OnAreaPolygonModified( nullptr, &aExistingZone ); + board->OnAreaPolygonModified( nullptr, &aZone ); // Re-fill if needed - if( aExistingZone.IsFilled() ) + if( aZone.IsFilled() ) { ZONE_FILLER filler( board ); - filler.Fill( { &aExistingZone } ); + filler.Fill( { &aZone } ); } } diff --git a/pcbnew/tools/zone_create_helper.h b/pcbnew/tools/zone_create_helper.h index fb4d90a2e8..2fbadffebf 100644 --- a/pcbnew/tools/zone_create_helper.h +++ b/pcbnew/tools/zone_create_helper.h @@ -104,10 +104,10 @@ public: * Cut one zone out of another one (i.e. subtraction) and * update the zone. * - * @param aExistingZone the zone to removed area from + * @param aZone the zone to removed area from * @param aCutout the area to remove */ - void performZoneCutout( ZONE_CONTAINER& aExistingZone, ZONE_CONTAINER& aCutout ); + void performZoneCutout( ZONE_CONTAINER& aZone, ZONE_CONTAINER& aCutout ); /** * Commit the current zone-in-progress to the BOARD. This might diff --git a/pcbnew/zone_settings.cpp b/pcbnew/zone_settings.cpp index 3f2db005d8..21cf5b5d51 100644 --- a/pcbnew/zone_settings.cpp +++ b/pcbnew/zone_settings.cpp @@ -31,9 +31,13 @@ #include #include +#include +#include #include #include +#include +#include ZONE_SETTINGS::ZONE_SETTINGS() { @@ -145,3 +149,59 @@ void ZONE_SETTINGS::SetCornerRadius( int aRadius ) else m_cornerRadius = aRadius; } + + +const static wxSize LAYER_BITMAP_SIZE( 28, 28 ); // Mac unhappy if this isn't square... + +// A helper for setting up a dialog list for specifying zone layers. Used by all three +// zone settings dialogs. +void ZONE_SETTINGS::SetupLayersList( wxDataViewListCtrl* aList, PCB_BASE_FRAME* aFrame, + bool aShowCopper ) +{ + BOARD* board = aFrame->GetBoard(); + COLOR4D backgroundColor = aFrame->Settings().Colors().GetLayerColor( LAYER_PCB_BACKGROUND ); + LSET layers = aShowCopper ? LSET::AllCuMask( board->GetCopperLayerCount() ) + : LSET::AllNonCuMask(); + + wxDataViewColumn* checkColumn = aList->AppendToggleColumn( wxEmptyString ); + wxDataViewColumn* layerColumn = aList->AppendIconTextColumn( wxEmptyString ); + wxDataViewColumn* layerIDColumn = aList->AppendIconTextColumn( wxEmptyString ); + layerIDColumn->SetHidden( true ); + + int minWidth = 0; + + for( LSEQ layer = layers.UIOrder(); layer; ++layer ) + { + PCB_LAYER_ID layerID = *layer; + wxString layerName = board->GetLayerName( layerID ); + + // wxCOL_WIDTH_AUTOSIZE doesn't work on all platforms, so we calculate width here + minWidth = std::max( minWidth, GetTextSize( layerName, aList ).x ); + + COLOR4D layerColor = aFrame->Settings().Colors().GetLayerColor( layerID ); + auto bitmap = COLOR_SWATCH::MakeBitmap( layerColor, backgroundColor, LAYER_BITMAP_SIZE ); + wxIcon icon; + icon.CopyFromBitmap( bitmap ); + + wxVector row; + row.push_back( wxVariant( m_Layers.test( layerID ) ) ); + row.push_back( wxVariant( wxDataViewIconText( layerName, icon ) ) ); + row.push_back( wxVariant( layerID ) ); + aList->AppendItem( row ); + + if( m_CurrentZone_Layer == layerID ) + aList->SetToggleValue( true, (unsigned) aList->GetItemCount() - 1, 0 ); + } + + checkColumn->SetWidth( 25 ); + layerColumn->SetMinWidth( minWidth + LAYER_BITMAP_SIZE.x + 25 ); + + // You'd think the fact that m_layers is a list would encourage wxWidgets not to save room + // for the tree expanders... but you'd be wrong. Force indent to 0. + aList->SetIndent( 0 ); + + minWidth = checkColumn->GetWidth() + layerColumn->GetWidth(); + aList->SetMinSize( wxSize( minWidth, aList->GetMinSize().GetHeight() ) ); +} + + diff --git a/pcbnew/zone_settings.h b/pcbnew/zone_settings.h index 4fbe98550e..ea4ddf6ccb 100644 --- a/pcbnew/zone_settings.h +++ b/pcbnew/zone_settings.h @@ -30,7 +30,8 @@ #ifndef ZONE_SETTINGS_H_ #define ZONE_SETTINGS_H_ -#include "zones.h" +#include +#include #define MAX_ZONE_CORNER_RADIUS_MILS 400 @@ -108,6 +109,12 @@ public: */ ZONE_SETTINGS& operator << ( const ZONE_CONTAINER& aSource ); + /** + * A helper routine for the various zone dialogs (copper, non-copper, keepout). + * @param aShowCopper indicates whether copper or technical layers should be shown + */ + void SetupLayersList( wxDataViewListCtrl* aList, PCB_BASE_FRAME* aFrame, bool aShowCopper ); + /** * Function ExportSetting * copy settings to a given zone diff --git a/pcbnew/zones.h b/pcbnew/zones.h index c08a3008d3..ec4be16631 100644 --- a/pcbnew/zones.h +++ b/pcbnew/zones.h @@ -26,7 +26,7 @@ #define ZONES_H_ // keys used to store net sort option in config file : -#define ZONE_NET_OUTLINES_HATCH_OPTION_KEY wxT( "Zone_Ouline_Hatch_Opt" ) +#define ZONE_NET_OUTLINES_STYLE_KEY wxT( "Zone_Ouline_Hatch_Opt" ) #define ZONE_NET_SORT_OPTION_KEY wxT( "Zone_NetSort_Opt" ) #define ZONE_NET_FILTER_STRING_KEY wxT( "Zone_Filter_Opt" ) #define ZONE_THERMAL_RELIEF_GAP_STRING_KEY wxT( "Zone_TH_Gap" ) @@ -43,13 +43,8 @@ #define ZONE_CLEARANCE_MAX_VALUE_MIL 500 // maximum acceptable value for ZONE_SETTINGS::m_ZoneClearance -/// Exit codes for zone editing dialogs -enum ZONE_EDIT_T { - ZONE_ABORT, ///< if no change - ZONE_OK, ///< if new values were accepted - ZONE_EXPORT_VALUES ///< if values were exported to others zones -}; - +#define ZONE_EXPORT_VALUES 1004 // Copper zone dialog reports wxID_OK, wxID_CANCEL or + // ZONE_EXPORT_VALUES /// How pads are covered by copper in zone enum ZoneConnection { @@ -70,12 +65,10 @@ class PCB_BASE_FRAME; * * @param aParent is the PCB_BASE_FRAME calling parent window for the modal dialog, * and it gives access to the BOARD through PCB_BASE_FRAME::GetBoard(). - * @param aZone is the ZONE_CONTAINER to edit. * @param aSettings points to the ZONE_SETTINGS to edit. - * @return ZONE_EDIT_T - tells if user aborted, changed only one zone, or all of them. + * @return int - tells if user aborted, changed only one zone, or all of them. */ -ZONE_EDIT_T InvokeNonCopperZonesEditor( PCB_BASE_FRAME* aParent, ZONE_CONTAINER* aZone, - ZONE_SETTINGS* aSettings ); +int InvokeNonCopperZonesEditor( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* aSettings ); /** * Function InvokeCopperZonesEditor @@ -84,9 +77,9 @@ ZONE_EDIT_T InvokeNonCopperZonesEditor( PCB_BASE_FRAME* aParent, ZONE_CONTAINER* * @param aCaller is the PCB_BASE_FRAME calling parent window for the modal dialog, * and it gives access to the BOARD through PCB_BASE_FRAME::GetBoard(). * @param aSettings points to the ZONE_SETTINGS to edit. - * @return ZONE_EDIT_T - tells if user aborted, changed only one zone, or all of them. + * @return int - tells if user aborted, changed only one zone, or all of them. */ -ZONE_EDIT_T InvokeCopperZonesEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSettings ); +int InvokeCopperZonesEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSettings ); /** * Function InvokeKeepoutAreaEditor @@ -95,8 +88,8 @@ ZONE_EDIT_T InvokeCopperZonesEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSe * @param aCaller is the PCB_BASE_FRAME calling parent window for the modal dialog, * and it gives access to the BOARD through PCB_BASE_FRAME::GetBoard(). * @param aSettings points to the ZONE_SETTINGS to edit. - * @return ZONE_EDIT_T - tells if user aborted, changed only one zone, or all of them. + * @return int - tells if user aborted, changed only one zone, or all of them. */ -ZONE_EDIT_T InvokeKeepoutAreaEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSettings ); +int InvokeKeepoutAreaEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSettings ); #endif // ZONES_H_ diff --git a/pcbnew/zones_by_polygon.cpp b/pcbnew/zones_by_polygon.cpp index d6ef348b88..890174286b 100644 --- a/pcbnew/zones_by_polygon.cpp +++ b/pcbnew/zones_by_polygon.cpp @@ -115,76 +115,65 @@ void PCB_EDIT_FRAME::Add_Zone_Cutout( wxDC* DC, ZONE_CONTAINER* aZone ) void PCB_EDIT_FRAME::duplicateZone( wxDC* aDC, ZONE_CONTAINER* aZone ) { - ZONE_CONTAINER* newZone = new ZONE_CONTAINER( *aZone ); - newZone->UnFill(); ZONE_SETTINGS zoneSettings; zoneSettings << *aZone; - - bool success; + int dialogResult; if( aZone->GetIsKeepout() ) - success = InvokeKeepoutAreaEditor( this, &zoneSettings ); + dialogResult = InvokeKeepoutAreaEditor( this, &zoneSettings ); else if( aZone->IsOnCopperLayer() ) - success = InvokeCopperZonesEditor( this, &zoneSettings ); + dialogResult = InvokeCopperZonesEditor( this, &zoneSettings ); else - success = InvokeNonCopperZonesEditor( this, aZone, &zoneSettings ); + dialogResult = InvokeNonCopperZonesEditor( this, &zoneSettings ); + + if( dialogResult != wxID_OK ) + return; // If the new zone is on the same layer as the the initial zone we'll end up combining // them which will result in a no-op. Might as well exit here. - if( success ) + if( aZone->GetIsKeepout() && ( aZone->GetLayerSet() == zoneSettings.m_Layers ) ) { - if( aZone->GetIsKeepout() && ( aZone->GetLayerSet() == zoneSettings.m_Layers ) ) - { - DisplayErrorMessage( - this, _( "The duplicated zone cannot be on the same layers as the original zone." ) ); - success = false; - } - else if( !aZone->GetIsKeepout() && ( aZone->GetLayer() == zoneSettings.m_CurrentZone_Layer ) ) - { - DisplayErrorMessage( - this, _( "The duplicated zone cannot be on the same layer as the original zone." ) ); - success = false; - } + DisplayErrorMessage( this, _( "The duplicated zone cannot be on the same layers as the original zone." ) ); + return; + } + else if( !aZone->GetIsKeepout() && ( aZone->GetLayer() == zoneSettings.m_CurrentZone_Layer ) ) + { + DisplayErrorMessage( this, _( "The duplicated zone cannot be on the same layer as the original zone." ) ); + return; } - if( success ) - { - zoneSettings.ExportSetting( *newZone ); - newZone->Hatch(); + ZONE_CONTAINER* newZone = new ZONE_CONTAINER( *aZone ); + newZone->UnFill(); + zoneSettings.ExportSetting( *newZone ); + newZone->Hatch(); - s_AuxiliaryList.ClearListAndDeleteItems(); - s_PickedList.ClearListAndDeleteItems(); - SaveCopyOfZones( s_PickedList, GetBoard(), newZone->GetNetCode(), newZone->GetLayer() ); - GetBoard()->Add( newZone ); + s_AuxiliaryList.ClearListAndDeleteItems(); + s_PickedList.ClearListAndDeleteItems(); + SaveCopyOfZones( s_PickedList, GetBoard(), newZone->GetNetCode(), newZone->GetLayer() ); + GetBoard()->Add( newZone ); - ITEM_PICKER picker( newZone, UR_NEW ); - s_PickedList.PushItem( picker ); + ITEM_PICKER picker( newZone, UR_NEW ); + s_PickedList.PushItem( picker ); - GetScreen()->SetCurItem( NULL ); // This outline may be deleted when merging outlines + GetScreen()->SetCurItem( NULL ); // This outline may be deleted when merging outlines - // Combine zones if possible - GetBoard()->OnAreaPolygonModified( &s_AuxiliaryList, newZone ); + // Combine zones if possible + GetBoard()->OnAreaPolygonModified( &s_AuxiliaryList, newZone ); - // Redraw zones - GetBoard()->RedrawAreasOutlines( m_canvas, aDC, GR_OR, newZone->GetLayer() ); - GetBoard()->RedrawFilledAreas( m_canvas, aDC, GR_OR, newZone->GetLayer() ); + // Redraw zones + GetBoard()->RedrawAreasOutlines( m_canvas, aDC, GR_OR, newZone->GetLayer() ); + GetBoard()->RedrawFilledAreas( m_canvas, aDC, GR_OR, newZone->GetLayer() ); - DRC drc( this ); + DRC drc( this ); - if( GetBoard()->GetAreaIndex( newZone ) >= 0 - && drc.TestZoneToZoneOutline( newZone, true ) ) - { - DisplayInfoMessage( this, _( "Warning: The new zone fails DRC" ) ); - } + if( GetBoard()->GetAreaIndex( newZone ) >= 0 && drc.TestZoneToZoneOutline( newZone, true ) ) + DisplayInfoMessage( this, _( "Warning: The new zone fails DRC" ) ); - UpdateCopyOfZonesList( s_PickedList, s_AuxiliaryList, GetBoard() ); - SaveCopyInUndoList( s_PickedList, UR_UNSPECIFIED ); - s_PickedList.ClearItemsList(); + UpdateCopyOfZonesList( s_PickedList, s_AuxiliaryList, GetBoard() ); + SaveCopyInUndoList( s_PickedList, UR_UNSPECIFIED ); + s_PickedList.ClearItemsList(); - OnModify(); - } - else - delete newZone; + OnModify(); } @@ -567,7 +556,7 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ) { if( !s_CurrentZone ) // A new outline is created, from scratch { - ZONE_EDIT_T edited; + int dialogResult; // Prompt user for parameters: m_canvas->SetIgnoreMouseEvents( true ); @@ -608,27 +597,27 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ) zoneInfo.SetCornerSmoothingType( ZONE_SETTINGS::SMOOTHING_NONE ); zoneInfo.SetCornerRadius( 0 ); - edited = InvokeKeepoutAreaEditor( this, &zoneInfo ); + dialogResult = InvokeKeepoutAreaEditor( this, &zoneInfo ); } else { zoneInfo.m_CurrentZone_Layer = GetActiveLayer(); // Preselect a layer zoneInfo.SetIsKeepout( false ); - edited = InvokeCopperZonesEditor( this, &zoneInfo ); + dialogResult = InvokeCopperZonesEditor( this, &zoneInfo ); } } else // Put a zone on a non copper layer (technical layer) { - zone->SetLayer( GetActiveLayer() ); // Preselect a layer + zoneInfo.m_CurrentZone_Layer = GetActiveLayer(); // Preselect a layer zoneInfo.SetIsKeepout( false ); - zoneInfo.m_NetcodeSelection = 0; // No net for non copper zones - edited = InvokeNonCopperZonesEditor( this, zone, &zoneInfo ); + zoneInfo.m_NetcodeSelection = 0; // No net for non copper zones + dialogResult = InvokeNonCopperZonesEditor( this, &zoneInfo ); } m_canvas->MoveCursorToCrossHair(); m_canvas->SetIgnoreMouseEvents( false ); - if( edited == ZONE_ABORT ) + if( dialogResult == wxID_CANCEL ) { GetBoard()->m_CurrentZoneContour = NULL; delete zone; @@ -697,8 +686,7 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ) // SCREEN::SetCurItem(), so the DRC error remains on screen. // PCB_EDIT_FRAME::SetCurItem() calls DisplayInfo(). GetScreen()->SetCurItem( NULL ); - DisplayErrorMessage( this, - _( "DRC error: this start point is inside or too close another area" ) ); + DisplayErrorMessage( this, _( "DRC error: this start point is inside or too close another area" ) ); return 0; } @@ -765,8 +753,7 @@ bool PCB_EDIT_FRAME::End_Zone( wxDC* DC ) if( Settings().m_legacyDrcOn && m_drc->DrcOnCreatingZone( zone, icorner ) == BAD_DRC ) // we can't validate the closing edge { - DisplayErrorMessage( this, - _( "DRC error: closing this area creates a DRC error with another area" ) ); + DisplayErrorMessage( this, _( "DRC error: closing this area creates a DRC error with another area" ) ); m_canvas->MoveCursorToCrossHair(); return false; } @@ -877,8 +864,8 @@ static void Show_New_Edge_While_Move_Mouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC, void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* aZone ) { - ZONE_EDIT_T edited; - ZONE_SETTINGS zoneInfo = GetZoneSettings(); + int dialogResult; + ZONE_SETTINGS zoneInfo = GetZoneSettings(); BOARD_COMMIT commit( this ); m_canvas->SetIgnoreMouseEvents( true ); @@ -893,24 +880,24 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* aZone ) { // edit a keepout area on a copper layer zoneInfo << *aZone; - edited = InvokeKeepoutAreaEditor( this, &zoneInfo ); + dialogResult = InvokeKeepoutAreaEditor( this, &zoneInfo ); } else if( IsCopperLayer( aZone->GetLayer() ) ) { // edit a zone on a copper layer zoneInfo << *aZone; - edited = InvokeCopperZonesEditor( this, &zoneInfo ); + dialogResult = InvokeCopperZonesEditor( this, &zoneInfo ); } else { zoneInfo << *aZone; - edited = InvokeNonCopperZonesEditor( this, aZone, &zoneInfo ); + dialogResult = InvokeNonCopperZonesEditor( this, &zoneInfo ); } m_canvas->MoveCursorToCrossHair(); m_canvas->SetIgnoreMouseEvents( false ); - if( edited == ZONE_ABORT ) + if( dialogResult == wxID_CANCEL ) { s_AuxiliaryList.ClearListAndDeleteItems(); s_PickedList.ClearListAndDeleteItems(); @@ -920,7 +907,7 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* aZone ) SetZoneSettings( zoneInfo ); OnModify(); - if( edited == ZONE_EXPORT_VALUES ) + if( dialogResult == ZONE_EXPORT_VALUES ) { UpdateCopyOfZonesList( s_PickedList, s_AuxiliaryList, GetBoard() ); commit.Stage( s_PickedList );