Add label fields to Edit Text and Graphics Properties dialog.

Fixes https://gitlab.com/kicad/code/kicad/issues/13632
This commit is contained in:
Jeff Young 2023-01-23 19:58:53 +00:00
parent 8eae75e8d6
commit 25783f3b7e
4 changed files with 93 additions and 8 deletions

View File

@ -47,6 +47,7 @@ static bool g_modifyWires;
static bool g_modifyBuses;
static bool g_modifyGlobalLabels;
static bool g_modifyHierLabels;
static bool g_modifyLabelFields;
static bool g_modifySheetTitles;
static bool g_modifyOtherSheetFields;
static bool g_modifySheetPins;
@ -145,6 +146,7 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::~DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS()
g_modifyBuses = m_buses->GetValue();
g_modifyGlobalLabels = m_globalLabels->GetValue();
g_modifyHierLabels = m_hierLabels->GetValue();
g_modifyLabelFields = m_labelFields->GetValue();
g_modifySheetTitles = m_sheetTitles->GetValue();
g_modifyOtherSheetFields = m_sheetFields->GetValue();
g_modifySheetPins = m_sheetPins->GetValue();
@ -177,6 +179,7 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow()
m_buses->SetValue( g_modifyBuses );
m_globalLabels->SetValue( g_modifyGlobalLabels );
m_hierLabels->SetValue( g_modifyHierLabels );
m_labelFields->SetValue( g_modifyLabelFields );
m_sheetTitles->SetValue( g_modifySheetTitles );
m_sheetFields->SetValue( g_modifyOtherSheetFields );
m_sheetPins->SetValue( g_modifySheetPins );
@ -486,6 +489,28 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( const SCH_SHEET_PATH& aShe
processItem( aSheetPath, pin );
}
}
else if( aItem->IsType( { SCH_LABEL_LOCATE_ANY_T } ) )
{
if( m_globalLabels->GetValue() && aItem->Type() == SCH_GLOBAL_LABEL_T )
processItem( aSheetPath, aItem );
if( m_hierLabels->GetValue() && aItem->Type() == SCH_HIER_LABEL_T )
processItem( aSheetPath, aItem );
if( m_labelFields->GetValue() )
{
for( SCH_FIELD& field : static_cast<SCH_LABEL_BASE*>( aItem )->GetFields() )
{
const wxString& fieldName = field.GetName();
if( !m_fieldnameFilterOpt->GetValue() || m_fieldnameFilter->GetValue().IsEmpty()
|| WildCompareString( m_fieldnameFilter->GetValue(), fieldName, false ) )
{
processItem( aSheetPath, &field );
}
}
}
}
else if( aItem->Type() == SCH_JUNCTION_T )
{
SCH_JUNCTION* junction = static_cast<SCH_JUNCTION*>( aItem );
@ -514,14 +539,6 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( const SCH_SHEET_PATH& aShe
{
processItem( aSheetPath, aItem );
}
else if( m_globalLabels->GetValue() && aItem->Type() == SCH_GLOBAL_LABEL_T )
{
processItem( aSheetPath, aItem );
}
else if( m_hierLabels->GetValue() && aItem->Type() == SCH_HIER_LABEL_T )
{
processItem( aSheetPath, aItem );
}
else if( m_schTextAndGraphics->GetValue() && aItem->IsType( { SCH_TEXT_T, SCH_TEXTBOX_T,
SCH_ITEM_LOCATE_GRAPHIC_LINE_T,
SCH_SHAPE_T } ) )

View File

@ -48,6 +48,9 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_
m_hierLabels = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("Hierarchical labels"), wxDefaultPosition, wxDefaultSize, 0 );
sbScope->Add( m_hierLabels, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 );
m_labelFields = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("Label fields"), wxDefaultPosition, wxDefaultSize, 0 );
sbScope->Add( m_labelFields, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 );
sbScope->Add( 0, 0, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );

View File

@ -541,6 +541,70 @@
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">4</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<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="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">Label fields</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_labelFields</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"></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="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>

View File

@ -48,6 +48,7 @@ class DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE : public DIALOG_SHIM
wxCheckBox* m_buses;
wxCheckBox* m_globalLabels;
wxCheckBox* m_hierLabels;
wxCheckBox* m_labelFields;
wxCheckBox* m_sheetTitles;
wxCheckBox* m_sheetFields;
wxCheckBox* m_sheetPins;