Fix footprint type memory

The flags don't map quite right, so we keep the memory of the drop-down
and translate to flags.  This protects against flag values changing
This commit is contained in:
Seth Hillbrand 2021-10-07 11:29:51 -07:00
parent 51d3440c38
commit f9c83dbc44
1 changed files with 8 additions and 5 deletions

View File

@ -1127,6 +1127,7 @@ FOOTPRINT* PCB_BASE_FRAME::CreateNewFootprint( const wxString& aFootprintName, b
// Static to store user preference for a session // Static to store user preference for a session
static int footprintType = 1; static int footprintType = 1;
int footprintTranslated = FP_SMD;
// Ask for the new footprint name // Ask for the new footprint name
if( footprintName.IsEmpty() && !aQuiet ) if( footprintName.IsEmpty() && !aQuiet )
@ -1139,16 +1140,18 @@ FOOTPRINT* PCB_BASE_FRAME::CreateNewFootprint( const wxString& aFootprintName, b
if( dlg.ShowModal() != wxID_OK ) if( dlg.ShowModal() != wxID_OK )
return nullptr; //Aborted by user return nullptr; //Aborted by user
switch( dlg.GetChoice() ) footprintType = dlg.GetChoice();
switch( footprintType )
{ {
case 0: case 0:
footprintType = FP_THROUGH_HOLE; footprintTranslated = FP_THROUGH_HOLE;
break; break;
case 1: case 1:
footprintType = FP_SMD; footprintTranslated = FP_SMD;
break; break;
default: default:
footprintType = 0; footprintTranslated = 0;
} }
} }
@ -1172,7 +1175,7 @@ FOOTPRINT* PCB_BASE_FRAME::CreateNewFootprint( const wxString& aFootprintName, b
// Update its name in lib // Update its name in lib
footprint->SetFPID( LIB_ID( wxEmptyString, footprintName ) ); footprint->SetFPID( LIB_ID( wxEmptyString, footprintName ) );
footprint->SetAttributes( footprintType ); footprint->SetAttributes( footprintTranslated );
PCB_LAYER_ID txt_layer; PCB_LAYER_ID txt_layer;
wxPoint default_pos; wxPoint default_pos;