From 92af5531bc493502c864409a80b0534c3141ed5f Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 11 Feb 2020 15:47:04 +0100 Subject: [PATCH] Fp editor: fix: Reference and Value default values aren't saved in Footprint Editor preferences Fixes #3889 https://gitlab.com/kicad/code/kicad/issues/3889 --- pcbnew/dialogs/panel_modedit_defaults.cpp | 10 + .../dialogs/panel_modedit_defaults_base.cpp | 82 ++-- .../dialogs/panel_modedit_defaults_base.fbp | 368 +----------------- pcbnew/dialogs/panel_modedit_defaults_base.h | 18 +- 4 files changed, 72 insertions(+), 406 deletions(-) diff --git a/pcbnew/dialogs/panel_modedit_defaults.cpp b/pcbnew/dialogs/panel_modedit_defaults.cpp index a1add09a30..c9532f870d 100644 --- a/pcbnew/dialogs/panel_modedit_defaults.cpp +++ b/pcbnew/dialogs/panel_modedit_defaults.cpp @@ -194,6 +194,16 @@ bool PANEL_MODEDIT_DEFAULTS::TransferDataFromWindow() wxGridCellBoolEditor::IsTrueValue( m_grid->GetCellValue( i, COL_TEXT_ITALIC ) ); } + // Footprint defaults + m_brdSettings.m_RefDefaultText = m_textCtrlRefText->GetValue(); + m_brdSettings.m_RefDefaultlayer = (m_choiceLayerReference->GetSelection() == 0) ? F_SilkS : F_Fab; + m_brdSettings.m_RefDefaultVisibility = m_choiceVisibleReference->GetSelection() == 0; + + + m_brdSettings.m_ValueDefaultText = m_textCtrlValueText->GetValue(); + m_brdSettings.m_ValueDefaultlayer = (m_choiceLayerValue->GetSelection() == 0) ? F_SilkS : F_Fab; + m_brdSettings.m_ValueDefaultVisibility = m_choiceVisibleValue->GetSelection() == 0; + m_frame->SetDesignSettings( m_brdSettings ); return true; diff --git a/pcbnew/dialogs/panel_modedit_defaults_base.cpp b/pcbnew/dialogs/panel_modedit_defaults_base.cpp index 7a34d822bd..ccdf0c2bb6 100644 --- a/pcbnew/dialogs/panel_modedit_defaults_base.cpp +++ b/pcbnew/dialogs/panel_modedit_defaults_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Dec 30 2017) +// C++ code generated with wxFormBuilder (version Jul 10 2019) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -11,98 +11,98 @@ /////////////////////////////////////////////////////////////////////////// -PANEL_MODEDIT_DEFAULTS_BASE::PANEL_MODEDIT_DEFAULTS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style ) +PANEL_MODEDIT_DEFAULTS_BASE::PANEL_MODEDIT_DEFAULTS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name ) { wxBoxSizer* bSizerMain; bSizerMain = new wxBoxSizer( wxVERTICAL ); - + wxBoxSizer* bSizerMargins; bSizerMargins = new wxBoxSizer( wxVERTICAL ); - + m_staticText13 = new wxStaticText( this, wxID_ANY, _("Default values for new footprints:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText13->Wrap( -1 ); bSizerMargins->Add( m_staticText13, 0, wxTOP|wxLEFT, 5 ); - + wxFlexGridSizer* defaultValuesSizer; defaultValuesSizer = new wxFlexGridSizer( 0, 4, 5, 5 ); defaultValuesSizer->AddGrowableCol( 1 ); defaultValuesSizer->SetFlexibleDirection( wxBOTH ); defaultValuesSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - + m_staticTextRef = new wxStaticText( this, wxID_ANY, _("&Reference:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextRef->Wrap( -1 ); defaultValuesSizer->Add( m_staticTextRef, 0, wxALIGN_CENTER_VERTICAL|wxTOP, 5 ); - + m_textCtrlRefText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_textCtrlRefText->SetToolTip( _("Default text for reference\nLeave blank to use the footprint name") ); - + defaultValuesSizer->Add( m_textCtrlRefText, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT, 5 ); - + wxString m_choiceLayerReferenceChoices[] = { _("SilkScreen"), _("Fab. Layer") }; int m_choiceLayerReferenceNChoices = sizeof( m_choiceLayerReferenceChoices ) / sizeof( wxString ); m_choiceLayerReference = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceLayerReferenceNChoices, m_choiceLayerReferenceChoices, 0 ); m_choiceLayerReference->SetSelection( 0 ); defaultValuesSizer->Add( m_choiceLayerReference, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 ); - + wxString m_choiceVisibleReferenceChoices[] = { _("Visible"), _("Invisible") }; int m_choiceVisibleReferenceNChoices = sizeof( m_choiceVisibleReferenceChoices ) / sizeof( wxString ); m_choiceVisibleReference = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceVisibleReferenceNChoices, m_choiceVisibleReferenceChoices, 0 ); m_choiceVisibleReference->SetSelection( 0 ); defaultValuesSizer->Add( m_choiceVisibleReference, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 ); - + m_staticTextValue = new wxStaticText( this, wxID_ANY, _("V&alue:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextValue->Wrap( -1 ); defaultValuesSizer->Add( m_staticTextValue, 0, wxALIGN_CENTER_VERTICAL, 5 ); - + m_textCtrlValueText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_textCtrlValueText->SetToolTip( _("Default text for value\nLeave blank to use the footprint name") ); m_textCtrlValueText->SetMinSize( wxSize( 160,-1 ) ); - + defaultValuesSizer->Add( m_textCtrlValueText, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT, 5 ); - + wxString m_choiceLayerValueChoices[] = { _("SilkScreen"), _("Fab. Layer") }; int m_choiceLayerValueNChoices = sizeof( m_choiceLayerValueChoices ) / sizeof( wxString ); m_choiceLayerValue = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceLayerValueNChoices, m_choiceLayerValueChoices, 0 ); m_choiceLayerValue->SetSelection( 1 ); defaultValuesSizer->Add( m_choiceLayerValue, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - + wxString m_choiceVisibleValueChoices[] = { _("Visible"), _("Invisible") }; int m_choiceVisibleValueNChoices = sizeof( m_choiceVisibleValueChoices ) / sizeof( wxString ); m_choiceVisibleValue = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceVisibleValueNChoices, m_choiceVisibleValueChoices, 0 ); m_choiceVisibleValue->SetSelection( 0 ); defaultValuesSizer->Add( m_choiceVisibleValue, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - - + + bSizerMargins->Add( defaultValuesSizer, 0, wxEXPAND|wxLEFT, 25 ); - - + + bSizerMargins->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); - + m_staticTextInfo = new wxStaticText( this, wxID_ANY, _("Leave reference and/or value blank to use footprint name."), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextInfo->Wrap( -1 ); - m_staticTextInfo->SetFont( wxFont( 12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) ); - + m_staticTextInfo->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) ); + bSizerMargins->Add( m_staticTextInfo, 0, wxBOTTOM|wxLEFT, 25 ); - - + + bSizerMargins->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 10 ); - + wxBoxSizer* defaultSizesSizer1; defaultSizesSizer1 = new wxBoxSizer( wxVERTICAL ); - + m_staticText1 = new wxStaticText( this, wxID_ANY, _("Default properties for new graphic items:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText1->Wrap( -1 ); defaultSizesSizer1->Add( m_staticText1, 0, wxBOTTOM|wxRIGHT, 5 ); - + m_grid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - + // Grid m_grid->CreateGrid( 5, 5 ); m_grid->EnableEditing( true ); m_grid->EnableGridLines( true ); m_grid->EnableDragGridSize( false ); m_grid->SetMargins( 0, 0 ); - + // Columns m_grid->SetColSize( 0, 110 ); m_grid->SetColSize( 1, 100 ); @@ -117,8 +117,8 @@ PANEL_MODEDIT_DEFAULTS_BASE::PANEL_MODEDIT_DEFAULTS_BASE( wxWindow* parent, wxWi m_grid->SetColLabelValue( 2, _("Text Height") ); m_grid->SetColLabelValue( 3, _("Text Thickness") ); m_grid->SetColLabelValue( 4, _("Italic") ); - m_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); - + m_grid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER ); + // Rows m_grid->EnableDragRowSize( false ); m_grid->SetRowLabelSize( 125 ); @@ -127,23 +127,23 @@ PANEL_MODEDIT_DEFAULTS_BASE::PANEL_MODEDIT_DEFAULTS_BASE( wxWindow* parent, wxWi m_grid->SetRowLabelValue( 2, _("Edge Cuts") ); m_grid->SetRowLabelValue( 3, _("Courtyards") ); m_grid->SetRowLabelValue( 4, _("Other Layers") ); - m_grid->SetRowLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE ); - + m_grid->SetRowLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTER ); + // Label Appearance - + // Cell Defaults m_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); m_grid->SetToolTip( _("Net Class parameters") ); - + defaultSizesSizer1->Add( m_grid, 1, wxBOTTOM|wxLEFT, 20 ); - - + + bSizerMargins->Add( defaultSizesSizer1, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - - + + bSizerMain->Add( bSizerMargins, 1, wxRIGHT|wxLEFT, 5 ); - - + + this->SetSizer( bSizerMain ); this->Layout(); bSizerMain->Fit( this ); diff --git a/pcbnew/dialogs/panel_modedit_defaults_base.fbp b/pcbnew/dialogs/panel_modedit_defaults_base.fbp index 99e893a61f..1d7a837ec3 100644 --- a/pcbnew/dialogs/panel_modedit_defaults_base.fbp +++ b/pcbnew/dialogs/panel_modedit_defaults_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -14,6 +14,8 @@ panel_modedit_defaults_base 1000 none + + 1 PanelModeditDefaults @@ -24,6 +26,7 @@ 1 1 UI + 0 0 0 @@ -48,36 +51,6 @@ wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bSizerMain @@ -125,6 +98,7 @@ 0 wxID_ANY Default values for new footprints: + 0 0 @@ -150,29 +124,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - @@ -224,6 +175,7 @@ 0 wxID_ANY &Reference: + 0 0 @@ -249,29 +201,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - @@ -336,33 +265,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -427,30 +329,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - @@ -515,30 +393,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - @@ -574,6 +428,7 @@ 0 wxID_ANY V&alue: + 0 0 @@ -599,29 +454,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - @@ -686,33 +518,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -777,30 +582,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - @@ -865,30 +646,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - @@ -931,11 +688,12 @@ 1 1 - ,90,90,12,70,0 + ,90,92,-1,70,0 0 0 wxID_ANY Leave reference and/or value blank to use footprint name. + 0 0 @@ -961,29 +719,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - @@ -1038,6 +773,7 @@ 0 wxID_ANY Default properties for new graphic items: + 0 0 @@ -1063,29 +799,6 @@ -1 - - - - - - - - - - - - - - - - - - - - - - - @@ -1114,10 +827,10 @@ wxALIGN_TOP 0 1 - wxALIGN_CENTRE + wxALIGN_CENTER 22 "Line Thickness" "Text Width" "Text Height" "Text Thickness" "Italic" - wxALIGN_CENTRE + wxALIGN_CENTER 5 110,100,100,100,60 @@ -1163,7 +876,7 @@ wxALIGN_LEFT 125 "Silk Layers" "Copper Layers" "Edge Cuts" "Courtyards" "Other Layers" - wxALIGN_CENTRE + wxALIGN_CENTER 5 1 @@ -1174,61 +887,6 @@ wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pcbnew/dialogs/panel_modedit_defaults_base.h b/pcbnew/dialogs/panel_modedit_defaults_base.h index 7ac259d139..cd759ab233 100644 --- a/pcbnew/dialogs/panel_modedit_defaults_base.h +++ b/pcbnew/dialogs/panel_modedit_defaults_base.h @@ -1,12 +1,11 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Dec 30 2017) +// C++ code generated with wxFormBuilder (version Jul 10 2019) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// -#ifndef __PANEL_MODEDIT_DEFAULTS_BASE_H__ -#define __PANEL_MODEDIT_DEFAULTS_BASE_H__ +#pragma once #include #include @@ -31,10 +30,10 @@ class WX_GRID; /////////////////////////////////////////////////////////////////////////////// /// Class PANEL_MODEDIT_DEFAULTS_BASE /////////////////////////////////////////////////////////////////////////////// -class PANEL_MODEDIT_DEFAULTS_BASE : public wxPanel +class PANEL_MODEDIT_DEFAULTS_BASE : public wxPanel { private: - + protected: wxStaticText* m_staticText13; wxStaticText* m_staticTextRef; @@ -48,12 +47,11 @@ class PANEL_MODEDIT_DEFAULTS_BASE : public wxPanel wxStaticText* m_staticTextInfo; wxStaticText* m_staticText1; WX_GRID* m_grid; - + public: - - PANEL_MODEDIT_DEFAULTS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL ); + + PANEL_MODEDIT_DEFAULTS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); ~PANEL_MODEDIT_DEFAULTS_BASE(); - + }; -#endif //__PANEL_MODEDIT_DEFAULTS_BASE_H__