Don't police the user.

There are too many holes and the police-state just makes it harder to
get back from error conditions.

Fixes https://gitlab.com/kicad/code/kicad/issues/7867
This commit is contained in:
Jeff Young 2021-03-11 10:36:56 +00:00
parent 2bc22de1a5
commit 4b88d4beed
4 changed files with 3 additions and 39 deletions

View File

@ -76,8 +76,6 @@ private:
} }
bool Validate() override; bool Validate() override;
void onLayer( wxCommandEvent& event ) override;
}; };
DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent,
@ -189,27 +187,15 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow()
case S_ARC: case S_ARC:
SetTitle( _( "Arc Properties" ) ); SetTitle( _( "Arc Properties" ) );
m_AngleValue = m_item->GetAngle() / 10.0; m_AngleValue = m_item->GetAngle() / 10.0;
m_filledCtrl->Show( false ); m_filledCtrl->Show( false );
break; break;
case S_POLYGON: case S_POLYGON:
{
LSET graphicPolygonsLayers = LSET::AllLayersMask();
graphicPolygonsLayers.reset( Edge_Cuts ).reset( F_CrtYd ).reset( B_CrtYd );
SetTitle( _( "Polygon Properties" ) ); SetTitle( _( "Polygon Properties" ) );
m_sizerLeft->Show( false ); m_sizerLeft->Show( false );
m_filledCtrl->Show( true ); m_filledCtrl->Show( true );
m_filledCtrl->Enable( graphicPolygonsLayers.Contains( m_item->GetLayer() ) );
// Prevent courtyard/edge cuts from being filled
if( !graphicPolygonsLayers.Contains( m_item->GetLayer() ) )
m_filledCtrl->SetValue( false );
break; break;
}
case S_RECT: case S_RECT:
SetTitle( _( "Rectangle Properties" ) ); SetTitle( _( "Rectangle Properties" ) );
@ -217,13 +203,13 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataToWindow()
break; break;
case S_SEGMENT: case S_SEGMENT:
SetTitle( _( "Line Segment Properties" ) );
if( m_item->GetStart().x == m_item->GetEnd().x ) if( m_item->GetStart().x == m_item->GetEnd().x )
m_flipStartEnd = m_item->GetStart().y > m_item->GetEnd().y; m_flipStartEnd = m_item->GetStart().y > m_item->GetEnd().y;
else else
m_flipStartEnd = m_item->GetStart().x > m_item->GetEnd().x; m_flipStartEnd = m_item->GetStart().x > m_item->GetEnd().x;
SetTitle( _( "Line Segment Properties" ) );
m_filledCtrl->Show( false ); m_filledCtrl->Show( false );
break; break;
@ -378,24 +364,6 @@ bool DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow()
} }
void DIALOG_GRAPHIC_ITEM_PROPERTIES::onLayer( wxCommandEvent& event )
{
if( m_item->GetShape() == S_POLYGON )
{
LSET graphicPolygonsLayers = LSET::AllLayersMask();
graphicPolygonsLayers.reset( Edge_Cuts ).reset( F_CrtYd ).reset( B_CrtYd );
m_filledCtrl->Enable( graphicPolygonsLayers.Contains(
ToLAYER_ID( m_LayerSelectionCtrl->GetLayerSelection() ) ) );
// Prevent courtyard/edge cuts from being filled
if( !graphicPolygonsLayers.Contains(
ToLAYER_ID( m_LayerSelectionCtrl->GetLayerSelection() ) ) )
m_filledCtrl->SetValue( false );
}
}
bool DIALOG_GRAPHIC_ITEM_PROPERTIES::Validate() bool DIALOG_GRAPHIC_ITEM_PROPERTIES::Validate()
{ {
wxArrayString error_msgs; wxArrayString error_msgs;

View File

@ -223,7 +223,6 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE( wxWind
// Connect Events // Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::OnClose ) ); this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::OnClose ) );
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::OnInitDlg ) ); this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::OnInitDlg ) );
m_LayerSelectionCtrl->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::onLayer ), NULL, this );
} }
DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::~DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE() DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::~DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE()
@ -231,6 +230,5 @@ DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::~DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE()
// Disconnect Events // Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::OnClose ) ); this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::OnClose ) );
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::OnInitDlg ) ); this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::OnInitDlg ) );
m_LayerSelectionCtrl->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE::onLayer ), NULL, this );
} }

View File

@ -2591,7 +2591,6 @@
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
<event name="OnCombobox">onLayer</event>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">

View File

@ -86,7 +86,6 @@ class DIALOG_GRAPHIC_ITEM_PROPERTIES_BASE : public DIALOG_SHIM
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnInitDlg( wxInitDialogEvent& event ) { event.Skip(); } virtual void OnInitDlg( wxInitDialogEvent& event ) { event.Skip(); }
virtual void onLayer( wxCommandEvent& event ) { event.Skip(); }
public: public: