Browse Source

Set board modify bit only when necessary after Board Setup.

Fixes https://gitlab.com/kicad/code/kicad/issues/5685
6.0.7
Jeff Young 5 years ago
parent
commit
505d764f25
  1. 22
      pcbnew/board_stackup_manager/panel_board_stackup.cpp
  2. 5
      pcbnew/dialogs/panel_setup_feature_constraints.cpp
  3. 42
      pcbnew/dialogs/panel_setup_layers.cpp
  4. 2
      pcbnew/dialogs/panel_setup_mask_and_paste.cpp
  5. 2
      pcbnew/dialogs/panel_setup_text_and_graphics.cpp
  6. 6
      pcbnew/dialogs/panel_setup_tracks_and_vias.cpp
  7. 2
      pcbnew/pcb_edit_frame.cpp

22
pcbnew/board_stackup_manager/panel_board_stackup.cpp

@ -1082,6 +1082,9 @@ bool PANEL_SETUP_BOARD_STACKUP::TransferDataFromWindow()
BOARD_STACKUP& brd_stackup = m_brdSettings->GetStackupDescriptor(); BOARD_STACKUP& brd_stackup = m_brdSettings->GetStackupDescriptor();
STRING_FORMATTER old_stackup;
brd_stackup.FormatBoardStackup( &old_stackup, m_board, 0 );
brd_stackup.m_FinishType = m_stackup.m_FinishType; brd_stackup.m_FinishType = m_stackup.m_FinishType;
brd_stackup.m_HasDielectricConstrains = m_stackup.m_HasDielectricConstrains; brd_stackup.m_HasDielectricConstrains = m_stackup.m_HasDielectricConstrains;
brd_stackup.m_EdgeConnectorConstraints = m_stackup.m_EdgeConnectorConstraints; brd_stackup.m_EdgeConnectorConstraints = m_stackup.m_EdgeConnectorConstraints;
@ -1091,14 +1094,31 @@ bool PANEL_SETUP_BOARD_STACKUP::TransferDataFromWindow()
// copy enabled items to the new board stackup // copy enabled items to the new board stackup
brd_stackup.RemoveAll(); brd_stackup.RemoveAll();
for( auto item : m_stackup.GetList() )
for( BOARD_STACKUP_ITEM* item : m_stackup.GetList() )
{ {
if( item->IsEnabled() ) if( item->IsEnabled() )
brd_stackup.Add( new BOARD_STACKUP_ITEM( *item ) ); brd_stackup.Add( new BOARD_STACKUP_ITEM( *item ) );
} }
STRING_FORMATTER new_stackup;
brd_stackup.FormatBoardStackup( &new_stackup, m_board, 0 );
bool modified = old_stackup.GetString() != new_stackup.GetString();
if( m_brdSettings->GetBoardThickness() != GetPcbThickness() )
{
m_brdSettings->SetBoardThickness( GetPcbThickness() ); m_brdSettings->SetBoardThickness( GetPcbThickness() );
modified = true;
}
if( !m_brdSettings->m_HasStackup )
{
m_brdSettings->m_HasStackup = true; m_brdSettings->m_HasStackup = true;
modified = true;
}
if( modified )
m_frame->OnModify();
return true; return true;
} }

5
pcbnew/dialogs/panel_setup_feature_constraints.cpp

@ -110,11 +110,14 @@ bool PANEL_SETUP_FEATURE_CONSTRAINTS::TransferDataFromWindow()
if( !m_holeToHoleMin.Validate( 0, 10, EDA_UNITS::INCHES ) ) if( !m_holeToHoleMin.Validate( 0, 10, EDA_UNITS::INCHES ) )
return false; return false;
// These are all stored in project file, not board, so no need for OnModify()
m_BrdSettings->m_BlindBuriedViaAllowed = m_OptAllowBlindBuriedVias->GetValue(); m_BrdSettings->m_BlindBuriedViaAllowed = m_OptAllowBlindBuriedVias->GetValue();
m_BrdSettings->m_MicroViasAllowed = m_OptAllowMicroVias->GetValue(); m_BrdSettings->m_MicroViasAllowed = m_OptAllowMicroVias->GetValue();
m_BrdSettings->m_MaxError = Clamp<int>( IU_PER_MM * MINIMUM_ERROR_SIZE_MM, m_BrdSettings->m_MaxError = Clamp<int>( IU_PER_MM * MINIMUM_ERROR_SIZE_MM,
m_maxError.GetValue(), IU_PER_MM * MAXIMUM_ERROR_SIZE_MM );
m_maxError.GetValue(),
IU_PER_MM * MAXIMUM_ERROR_SIZE_MM );
m_BrdSettings->m_ZoneFillVersion = m_rbOutlinePolygonFastest->GetValue() ? 6 : 5; m_BrdSettings->m_ZoneFillVersion = m_rbOutlinePolygonFastest->GetValue() ? 6 : 5;
m_BrdSettings->m_ZoneKeepExternalFillets = m_allowExternalFilletsOpt->GetValue(); m_BrdSettings->m_ZoneKeepExternalFillets = m_allowExternalFilletsOpt->GetValue();

42
pcbnew/dialogs/panel_setup_layers.cpp

@ -536,6 +536,7 @@ bool PANEL_SETUP_LAYERS::TransferDataFromWindow()
return false; return false;
wxString msg; wxString msg;
bool modified = false;
// Check for removed layers with items which will get deleted from the board. // Check for removed layers with items which will get deleted from the board.
LSEQ removedLayers = getRemovedLayersWithItems(); LSEQ removedLayers = getRemovedLayersWithItems();
@ -552,14 +553,18 @@ bool PANEL_SETUP_LAYERS::TransferDataFromWindow()
"%s\n" "%s\n"
"These items will be no longer accessible\n" "These items will be no longer accessible\n"
"Do you wish to continue?" ), msg ) ) ) "Do you wish to continue?" ), msg ) ) )
{
return false; return false;
} }
}
if( !removedLayers.empty() &&
!IsOK( this, _( "Items have been found on removed layers. This operation will delete "
"all items from removed layers and cannot be undone. Do you wish to "
"continue?" ) ) )
if( !removedLayers.empty()
&& !IsOK( this, _( "Items have been found on removed layers. This operation will "
"delete all items from removed layers and cannot be undone.\n"
"Do you wish to continue?" ) ) )
{
return false; return false;
}
// Delete all objects on layers that have been removed. Leaving them in copper layers // Delete all objects on layers that have been removed. Leaving them in copper layers
// can (will?) result in DRC errors and it pollutes the board file with cruft. // can (will?) result in DRC errors and it pollutes the board file with cruft.
@ -582,6 +587,7 @@ bool PANEL_SETUP_LAYERS::TransferDataFromWindow()
layers.reset( layer_id ); layers.reset( layer_id );
hasRemovedBoardItems = true; hasRemovedBoardItems = true;
modified = true;
if( layers.any() ) if( layers.any() )
{ {
@ -607,6 +613,8 @@ bool PANEL_SETUP_LAYERS::TransferDataFromWindow()
* layers are not visible when exiting this dialog * layers are not visible when exiting this dialog
*/ */
m_pcb->SetVisibleLayers( m_enabledLayers ); m_pcb->SetVisibleLayers( m_enabledLayers );
modified = true;
} }
for( LSEQ seq = LSET::AllLayersMask().Seq(); seq; ++seq ) for( LSEQ seq = LSET::AllLayersMask().Seq(); seq; ++seq )
@ -615,21 +623,38 @@ bool PANEL_SETUP_LAYERS::TransferDataFromWindow()
if( m_enabledLayers[layer] ) if( m_enabledLayers[layer] )
{ {
m_pcb->SetLayerName( layer, GetLayerName( layer ) );
const wxString& newLayerName = GetLayerName( layer );
if( m_pcb->GetLayerName( layer ) != newLayerName )
{
m_pcb->SetLayerName( layer, newLayerName );
modified = true;
}
// Only copper layers have a definable type. // Only copper layers have a definable type.
if( LSET::AllCuMask().Contains( layer ) ) if( LSET::AllCuMask().Contains( layer ) )
{ {
LAYER_T t = (LAYER_T) getLayerTypeIndex( layer ); LAYER_T t = (LAYER_T) getLayerTypeIndex( layer );
if( m_pcb->GetLayerType( layer ) != t )
{
m_pcb->SetLayerType( layer, t ); m_pcb->SetLayerType( layer, t );
modified = true;
}
} }
} }
} }
for( LSEQ seq = LSET::UserDefinedLayers().Seq(); seq; ++seq ) for( LSEQ seq = LSET::UserDefinedLayers().Seq(); seq; ++seq )
{ {
if( m_enabledLayers[*seq] )
m_pcb->SetLayerName( *seq, GetLayerName( *seq ) );
PCB_LAYER_ID layer = *seq;
const wxString& newLayerName = GetLayerName( layer );
if( m_enabledLayers[ layer ] && m_pcb->GetLayerName( layer ) != newLayerName )
{
m_pcb->SetLayerName( layer, newLayerName );
modified = true;
}
} }
// If some board items are deleted: Rebuild the connectivity, // If some board items are deleted: Rebuild the connectivity,
@ -641,6 +666,9 @@ bool PANEL_SETUP_LAYERS::TransferDataFromWindow()
m_frame->Compile_Ratsnest( true ); m_frame->Compile_Ratsnest( true );
} }
if( modified )
m_frame->OnModify();
return true; return true;
} }

2
pcbnew/dialogs/panel_setup_mask_and_paste.cpp

@ -67,6 +67,8 @@ bool PANEL_SETUP_MASK_AND_PASTE::TransferDataToWindow()
bool PANEL_SETUP_MASK_AND_PASTE::TransferDataFromWindow() bool PANEL_SETUP_MASK_AND_PASTE::TransferDataFromWindow()
{ {
// These are all stored in project file, not board, so no need for OnModify()
m_BrdSettings->m_SolderMaskMargin = m_maskMargin.GetValue(); m_BrdSettings->m_SolderMaskMargin = m_maskMargin.GetValue();
m_BrdSettings->m_SolderMaskMinWidth = m_maskMinWidth.GetValue(); m_BrdSettings->m_SolderMaskMinWidth = m_maskMinWidth.GetValue();

2
pcbnew/dialogs/panel_setup_text_and_graphics.cpp

@ -207,6 +207,8 @@ bool PANEL_SETUP_TEXT_AND_GRAPHICS::TransferDataFromWindow()
wxGridCellBoolEditor::IsTrueValue( m_grid->GetCellValue( i, COL_TEXT_UPRIGHT ) ); wxGridCellBoolEditor::IsTrueValue( m_grid->GetCellValue( i, COL_TEXT_UPRIGHT ) );
} }
// These are all stored in project file, not board, so no need for OnModify()
int mode = m_dimensionUnits->GetSelection(); int mode = m_dimensionUnits->GetSelection();
m_BrdSettings->m_DimensionUnitsMode = static_cast<DIM_UNITS_MODE>( mode ); m_BrdSettings->m_DimensionUnitsMode = static_cast<DIM_UNITS_MODE>( mode );
int format = m_dimensionUnitsFormat->GetSelection(); int format = m_dimensionUnitsFormat->GetSelection();

6
pcbnew/dialogs/panel_setup_tracks_and_vias.cpp

@ -51,8 +51,8 @@ enum DIFF_VAR_GRID_COLUMNS
}; };
PANEL_SETUP_TRACKS_AND_VIAS::PANEL_SETUP_TRACKS_AND_VIAS(
PAGED_DIALOG* aParent, PCB_EDIT_FRAME* aFrame,
PANEL_SETUP_TRACKS_AND_VIAS::PANEL_SETUP_TRACKS_AND_VIAS( PAGED_DIALOG* aParent,
PCB_EDIT_FRAME* aFrame,
PANEL_SETUP_FEATURE_CONSTRAINTS* aConstraintsPanel ) : PANEL_SETUP_FEATURE_CONSTRAINTS* aConstraintsPanel ) :
PANEL_SETUP_TRACKS_AND_VIAS_BASE( aParent->GetTreebook() ) PANEL_SETUP_TRACKS_AND_VIAS_BASE( aParent->GetTreebook() )
{ {
@ -197,6 +197,8 @@ bool PANEL_SETUP_TRACKS_AND_VIAS::TransferDataFromWindow()
sort( vias.begin(), vias.end() ); sort( vias.begin(), vias.end() );
sort( diffPairs.begin(), diffPairs.end() ); sort( diffPairs.begin(), diffPairs.end() );
// These are all stored in project file, not board, so no need for OnModify()
trackWidths.insert( trackWidths.begin(), 0 ); // dummy value for "use netclass" trackWidths.insert( trackWidths.begin(), 0 ); // dummy value for "use netclass"
m_BrdSettings->m_TrackWidthList = trackWidths; m_BrdSettings->m_TrackWidthList = trackWidths;

2
pcbnew/pcb_edit_frame.cpp

@ -909,8 +909,6 @@ void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage, const w
TOOL_EVENT toolEvent( TC_COMMAND, TA_MODEL_CHANGE, AS_ACTIVE ); TOOL_EVENT toolEvent( TC_COMMAND, TA_MODEL_CHANGE, AS_ACTIVE );
toolEvent.SetHasPosition( false ); toolEvent.SetHasPosition( false );
m_toolManager->ProcessEvent( toolEvent ); m_toolManager->ProcessEvent( toolEvent );
OnModify();
} }
GetCanvas()->SetFocus(); GetCanvas()->SetFocus();

Loading…
Cancel
Save