Allow separate processing of dimensions in Edit Text & Graphics Properties.

This commit is contained in:
Jeff Young 2023-03-05 15:18:24 +00:00
parent 461def2719
commit 2994fa26cd
4 changed files with 191 additions and 18 deletions

View File

@ -101,6 +101,7 @@ public:
protected:
void onActionButtonChange( wxCommandEvent& event ) override;
void onSpecifiedValueUpdateUI( wxUpdateUIEvent& event ) override;
void onDimensionItemCheckbox( wxCommandEvent& aEvent ) override;
void OnLayerFilterSelect( wxCommandEvent& event ) override
{
@ -138,6 +139,7 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS( PCB_
{
m_otherFields->SetLabel( _( "Other text items" ) );
m_footprintGraphics->SetLabel( _( "Graphic items" ) );
m_footprintDimensions->SetLabel( _( "Dimension items" ) );
m_boardText->Show( false );
m_boardGraphics->Show( false );
@ -323,6 +325,15 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::onSpecifiedValueUpdateUI( wxUpdateUIE
}
void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::onDimensionItemCheckbox( wxCommandEvent& aEvent )
{
if( m_footprintDimensions->GetValue() || m_boardDimensions->GetValue() )
m_setToLayerDefaults->SetLabel( _( "Set to layer and dimension default values:" ) );
else
m_setToLayerDefaults->SetLabel( _( "Set to layer default values:" ) );
}
void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( BOARD_COMMIT& aCommit, BOARD_ITEM* aItem )
{
aCommit.Modify( aItem );
@ -418,7 +429,16 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( BOARD_COMMIT& aCommit, B
}
if( dimension )
{
dimension->SetLineThickness( m_brdSettings->GetLineThickness( layer ) );
dimension->SetUnitsMode( m_brdSettings->m_DimensionUnitsMode );
dimension->SetUnitsFormat( m_brdSettings->m_DimensionUnitsFormat );
dimension->SetPrecision( m_brdSettings->m_DimensionPrecision );
dimension->SetSuppressZeroes( m_brdSettings->m_DimensionSuppressZeroes );
dimension->SetTextPositionMode( m_brdSettings->m_DimensionTextPosition );
dimension->SetKeepTextAligned( m_brdSettings->m_DimensionKeepTextAligned );
dimension->Update(); // refresh text & geometry
}
}
}
@ -475,7 +495,7 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( BOARD_COMMIT& aCommit, BOA
if( !WildCompareString( m_footprintFilter->GetValue(), fp->GetFPID().Format(), false ) )
return;
}
}
}
}
processItem( aCommit, aItem );
@ -511,7 +531,12 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow()
if( m_otherFields->GetValue() )
visitItem( commit, boardItem );
}
else if( itemType == PCB_FP_SHAPE_T || BaseType( itemType ) == PCB_DIMENSION_T )
else if( BaseType( itemType ) == PCB_DIMENSION_T )
{
if( m_footprintDimensions->GetValue() )
visitItem( commit, boardItem );
}
else if( itemType == PCB_FP_SHAPE_T )
{
if( m_footprintGraphics->GetValue() )
visitItem( commit, boardItem );
@ -531,6 +556,11 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow()
if( m_boardText->GetValue() )
visitItem( commit, boardItem );
}
else if( BaseType( itemType ) == PCB_DIMENSION_T )
{
if( m_boardDimensions->GetValue() )
visitItem( commit, boardItem );
}
else if( itemType == PCB_SHAPE_T || BaseType( itemType ) == PCB_DIMENSION_T )
{
if( m_boardGraphics->GetValue() )

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.0)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -26,25 +26,31 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_
sbScope = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Scope") ), wxVERTICAL );
m_references = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("Reference designators"), wxDefaultPosition, wxDefaultSize, 0 );
sbScope->Add( m_references, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
sbScope->Add( m_references, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 );
m_values = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("Values"), wxDefaultPosition, wxDefaultSize, 0 );
sbScope->Add( m_values, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
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, 5 );
sbScope->Add( m_otherFields, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 );
m_footprintGraphics = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("Footprint graphic items"), wxDefaultPosition, wxDefaultSize, 0 );
sbScope->Add( m_footprintGraphics, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
sbScope->Add( m_footprintGraphics, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 );
m_footprintDimensions = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("Footprint dimension items"), wxDefaultPosition, wxDefaultSize, 0 );
sbScope->Add( m_footprintDimensions, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 );
sbScope->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_boardGraphics = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("PCB graphic items"), wxDefaultPosition, wxDefaultSize, 0 );
sbScope->Add( m_boardGraphics, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
sbScope->Add( m_boardGraphics, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 );
m_boardText = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("PCB text items"), wxDefaultPosition, wxDefaultSize, 0 );
sbScope->Add( m_boardText, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
sbScope->Add( m_boardText, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 );
m_boardDimensions = new wxCheckBox( sbScope->GetStaticBox(), wxID_ANY, _("PCB dimension items"), wxDefaultPosition, wxDefaultSize, 0 );
sbScope->Add( m_boardDimensions, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 );
bSizerTop->Add( sbScope, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
@ -244,7 +250,7 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_
sbAction->Add( m_specifiedValues, 0, wxEXPAND|wxBOTTOM|wxLEFT, 12 );
m_setToLayerDefaults = new wxRadioButton( sbAction->GetStaticBox(), ID_ALL_TRACKS_VIAS, _("Set to layer default values:"), wxDefaultPosition, wxDefaultSize, 0 );
sbAction->Add( m_setToLayerDefaults, 0, wxTOP|wxBOTTOM, 5 );
sbAction->Add( m_setToLayerDefaults, 0, wxTOP|wxBOTTOM|wxEXPAND, 5 );
m_grid = new wxGrid( sbAction->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE );
@ -304,6 +310,8 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_
bMainSizer->Fit( this );
// Connect Events
m_footprintDimensions->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::onDimensionItemCheckbox ), NULL, this );
m_boardDimensions->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::onDimensionItemCheckbox ), NULL, this );
m_layerFilter->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnLayerFilterSelect ), NULL, this );
m_referenceFilter->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnReferenceFilterText ), NULL, this );
m_footprintFilter->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnFootprintFilterText ), NULL, this );
@ -322,6 +330,8 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_
DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::~DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE()
{
// Disconnect Events
m_footprintDimensions->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::onDimensionItemCheckbox ), NULL, this );
m_boardDimensions->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::onDimensionItemCheckbox ), NULL, this );
m_layerFilter->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnLayerFilterSelect ), NULL, this );
m_referenceFilter->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnReferenceFilterText ), NULL, this );
m_footprintFilter->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::OnFootprintFilterText ), NULL, this );

View File

@ -83,7 +83,7 @@
<property name="parent">1</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="border">4</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
@ -147,7 +147,7 @@
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="border">4</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
@ -211,7 +211,7 @@
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="border">4</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
@ -275,7 +275,7 @@
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="border">4</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
@ -338,6 +338,71 @@
<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">Footprint dimension 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_footprintDimensions</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>
<event name="OnCheckBox">onDimensionItemCheckbox</event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
@ -349,7 +414,7 @@
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="border">4</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
@ -413,7 +478,7 @@
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="border">4</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
@ -476,6 +541,71 @@
<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">PCB dimension 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_boardDimensions</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>
<event name="OnCheckBox">onDimensionItemCheckbox</event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
@ -2552,7 +2682,7 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxTOP|wxBOTTOM</property>
<property name="flag">wxTOP|wxBOTTOM|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxRadioButton" expanded="0">
<property name="BottomDockable">1</property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.0)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -49,8 +49,10 @@ class DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE : public DIALOG_SHIM
wxCheckBox* m_values;
wxCheckBox* m_otherFields;
wxCheckBox* m_footprintGraphics;
wxCheckBox* m_footprintDimensions;
wxCheckBox* m_boardGraphics;
wxCheckBox* m_boardText;
wxCheckBox* m_boardDimensions;
wxCheckBox* m_layerFilterOpt;
PCB_LAYER_BOX_SELECTOR* m_layerFilter;
wxCheckBox* m_referenceFilterOpt;
@ -88,6 +90,7 @@ class DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE : public DIALOG_SHIM
wxButton* m_sdbSizerButtonsCancel;
// Virtual event handlers, override them in your derived class
virtual void onDimensionItemCheckbox( wxCommandEvent& event ) { event.Skip(); }
virtual void OnLayerFilterSelect( wxCommandEvent& event ) { event.Skip(); }
virtual void OnReferenceFilterText( wxCommandEvent& event ) { event.Skip(); }
virtual void OnFootprintFilterText( wxCommandEvent& event ) { event.Skip(); }