PCB: add fields checkbox to Edit Text and Graphics

Also add missing saves for dimensions checkboxes.
This commit is contained in:
Mike Williams 2024-06-05 11:32:27 -04:00
parent 82b310f666
commit f3d2f4af01
4 changed files with 111 additions and 18 deletions

View File

@ -67,8 +67,10 @@ enum
static bool g_modifyReferences;
static bool g_modifyValues;
static bool g_modifyOtherFields;
static bool g_modifyFootprintFields;
static bool g_modifyFootprintGraphics;
static bool g_modifyFootprintDimensions;
static bool g_modifyOtherFootprintTexts;
static bool g_modifyBoardText;
static bool g_modifyBoardGraphics;
static bool g_filterByLayer;
@ -135,7 +137,7 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS( PCB_
if( !m_isBoardEditor )
{
m_otherFields->SetLabel( _( "Other text items" ) );
m_otherFootprintTexts->SetLabel( _( "Other footprint text items" ) );
m_footprintGraphics->SetLabel( _( "Graphic items" ) );
m_footprintDimensions->SetLabel( _( "Dimension items" ) );
@ -170,8 +172,10 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::~DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS()
{
g_modifyReferences = m_references->GetValue();
g_modifyValues = m_values->GetValue();
g_modifyOtherFields = m_otherFields->GetValue();
g_modifyFootprintFields = m_footprintFields->GetValue();
g_modifyFootprintGraphics = m_footprintGraphics->GetValue();
g_modifyFootprintDimensions = m_footprintDimensions->GetValue();
g_modifyOtherFootprintTexts = m_otherFootprintTexts->GetValue();
if( m_isBoardEditor )
{
@ -201,8 +205,10 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow()
m_references->SetValue( g_modifyReferences );
m_values->SetValue( g_modifyValues );
m_otherFields->SetValue( g_modifyOtherFields );
m_footprintFields->SetValue( g_modifyFootprintFields );
m_footprintGraphics->SetValue( g_modifyFootprintGraphics );
m_footprintDimensions->SetValue( g_modifyFootprintDimensions );
m_otherFootprintTexts->SetValue( g_modifyOtherFootprintTexts );
if( m_isBoardEditor )
{
@ -534,14 +540,28 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow()
if( m_values->GetValue() )
visitItem( commit, &fp->Value() );
if( m_footprintFields->GetValue() )
{
for( PCB_FIELD* field : fp->GetFields() )
{
if( field->IsReference() )
continue;
if( field->IsValue() )
continue;
visitItem( commit, field );
}
}
// Go through all other footprint items
for( BOARD_ITEM* boardItem : fp->GraphicalItems() )
{
KICAD_T itemType = boardItem->Type();
if( itemType == PCB_FIELD_T || itemType == PCB_TEXT_T || itemType == PCB_TEXTBOX_T )
if( itemType == PCB_TEXT_T || itemType == PCB_TEXTBOX_T )
{
if( m_otherFields->GetValue() )
if( m_otherFootprintTexts->GetValue() )
visitItem( commit, boardItem );
}
else if( BaseType( itemType ) == PCB_DIMENSION_T )

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf-dirty)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -31,8 +31,10 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_
m_values = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("Values"), wxDefaultPosition, wxDefaultSize, 0 );
sbScope->Add( m_values, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 );
m_otherFields = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("Other footprint text items"), wxDefaultPosition, wxDefaultSize, 0 );
sbScope->Add( m_otherFields, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 );
m_footprintFields = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("Footprint fields"), wxDefaultPosition, wxDefaultSize, 0 );
m_footprintFields->SetToolTip( _("Footprint fields that are not the reference designator or value field") );
sbScope->Add( m_footprintFields, 0, wxALL, 5 );
m_footprintGraphics = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("Footprint graphic items"), wxDefaultPosition, wxDefaultSize, 0 );
sbScope->Add( m_footprintGraphics, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 );
@ -40,6 +42,11 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_
m_footprintDimensions = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("Footprint dimension items"), wxDefaultPosition, wxDefaultSize, 0 );
sbScope->Add( m_footprintDimensions, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 );
m_otherFootprintTexts = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("Other footprint text items"), wxDefaultPosition, wxDefaultSize, 0 );
m_otherFootprintTexts->SetToolTip( _("Footprint text items not associated with a field") );
sbScope->Add( m_otherFootprintTexts, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 );
sbScope->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );

View File

@ -213,11 +213,11 @@
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="false">
<property name="border">4</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<object class="sizeritem" expanded="true">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="false">
<object class="wxCheckBox" expanded="true">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -247,7 +247,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Other footprint text items</property>
<property name="label">Footprint fields</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -255,7 +255,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_otherFields</property>
<property name="name">m_footprintFields</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -268,7 +268,7 @@
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="tooltip">Footprint fields that are not the reference designator or value field</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
@ -409,6 +409,71 @@
<event name="OnCheckBox">onDimensionItemCheckbox</event>
</object>
</object>
<object class="sizeritem" expanded="false">
<property name="border">4</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="false">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="drag_accept_files">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Other footprint text items</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_otherFootprintTexts</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Footprint text items not associated with a field</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="false">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf-dirty)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -47,9 +47,10 @@ class DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE : public DIALOG_SHIM
protected:
wxCheckBox* m_references;
wxCheckBox* m_values;
wxCheckBox* m_otherFields;
wxCheckBox* m_footprintFields;
wxCheckBox* m_footprintGraphics;
wxCheckBox* m_footprintDimensions;
wxCheckBox* m_otherFootprintTexts;
wxCheckBox* m_boardGraphics;
wxCheckBox* m_boardText;
wxCheckBox* m_boardDimensions;