DIALOG_GLOBAL_EDIT_TEARDROPS: save teardrop scope in board design settings.

These parameters were already in board design settings, but never used.
This commit is contained in:
jean-pierre charras 2024-10-15 18:02:02 +02:00
parent 4089735c28
commit bff4ab5cfe
3 changed files with 39 additions and 12 deletions

View File

@ -488,8 +488,9 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
nlohmann::json js = nlohmann::json::array(); nlohmann::json js = nlohmann::json::array();
nlohmann::json entry = {}; nlohmann::json entry = {};
entry["td_onviapad"] = m_TeardropParamsList.m_TargetViasPads; entry["td_onvia"] = m_TeardropParamsList.m_TargetVias;
entry["td_onpadsmd"] = m_TeardropParamsList.m_TargetPadsWithNoHole; entry["td_onpthpad"] = m_TeardropParamsList.m_TargetPTHPads;
entry["td_onsmdpad"] = m_TeardropParamsList.m_TargetSMDPads;
entry["td_ontrackend"] = m_TeardropParamsList.m_TargetTrack2Track; entry["td_ontrackend"] = m_TeardropParamsList.m_TargetTrack2Track;
entry["td_onroundshapesonly"] = m_TeardropParamsList.m_UseRoundShapesOnly; entry["td_onroundshapesonly"] = m_TeardropParamsList.m_UseRoundShapesOnly;
@ -507,11 +508,14 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
if( entry.empty() || !entry.is_object() ) if( entry.empty() || !entry.is_object() )
continue; continue;
if( entry.contains( "td_onviapad" ) ) if( entry.contains( "td_onvia" ) )
m_TeardropParamsList.m_TargetViasPads = entry["td_onviapad"].get<bool>(); m_TeardropParamsList.m_TargetVias = entry["td_onvia"].get<bool>();
if( entry.contains( "td_onpadsmd" ) ) if( entry.contains( "td_onpthpad" ) )
m_TeardropParamsList.m_TargetPadsWithNoHole = entry["td_onpadsmd"].get<bool>(); m_TeardropParamsList.m_TargetPTHPads = entry["td_onpthpad"].get<bool>();
if( entry.contains( "td_onsmdpad" ) )
m_TeardropParamsList.m_TargetSMDPads = entry["td_onsmdpad"].get<bool>();
if( entry.contains( "td_ontrackend" ) ) if( entry.contains( "td_ontrackend" ) )
m_TeardropParamsList.m_TargetTrack2Track = entry["td_ontrackend"].get<bool>(); m_TeardropParamsList.m_TargetTrack2Track = entry["td_ontrackend"].get<bool>();

View File

@ -236,6 +236,17 @@ void DIALOG_GLOBAL_EDIT_TEARDROPS::buildFilterLists()
bool DIALOG_GLOBAL_EDIT_TEARDROPS::TransferDataToWindow() bool DIALOG_GLOBAL_EDIT_TEARDROPS::TransferDataToWindow()
{ {
BOARD_DESIGN_SETTINGS& bds = m_brd->GetDesignSettings();
g_vias = bds.m_TeardropParamsList.m_TargetVias;
g_pthPads = bds.m_TeardropParamsList.m_TargetPTHPads;
g_smdPads = bds.m_TeardropParamsList.m_TargetSMDPads;
g_trackToTrack = bds.m_TeardropParamsList.m_TargetTrack2Track;
#if 0 // I am not sure this is useful
g_filterRoundPads = bds.m_TeardropParamsList.m_UseRoundShapesOnly;
#endif
PCB_SELECTION_TOOL* selTool = m_parent->GetToolManager()->GetTool<PCB_SELECTION_TOOL>(); PCB_SELECTION_TOOL* selTool = m_parent->GetToolManager()->GetTool<PCB_SELECTION_TOOL>();
m_selection = selTool->GetSelection(); m_selection = selTool->GetSelection();
BOARD_CONNECTED_ITEM* item = dynamic_cast<BOARD_CONNECTED_ITEM*>( m_selection.Front() ); BOARD_CONNECTED_ITEM* item = dynamic_cast<BOARD_CONNECTED_ITEM*>( m_selection.Front() );
@ -434,6 +445,15 @@ bool DIALOG_GLOBAL_EDIT_TEARDROPS::TransferDataFromWindow()
BOARD_COMMIT commit( m_parent ); BOARD_COMMIT commit( m_parent );
wxBusyCursor dummy; wxBusyCursor dummy;
// Save some dialog options
BOARD_DESIGN_SETTINGS& bds = m_brd->GetDesignSettings();
bds.m_TeardropParamsList.m_TargetVias = m_vias->GetValue();
bds.m_TeardropParamsList.m_TargetPTHPads = m_pthPads->GetValue();;
bds.m_TeardropParamsList.m_TargetSMDPads = m_smdPads->GetValue();
bds.m_TeardropParamsList.m_TargetTrack2Track = m_trackToTrack->GetValue();
bds.m_TeardropParamsList.m_UseRoundShapesOnly = m_roundPadsFilter->GetValue();
if( m_vias->GetValue() ) if( m_vias->GetValue() )
{ {
for( PCB_TRACK* track : m_brd->Tracks() ) for( PCB_TRACK* track : m_brd->Tracks() )

View File

@ -143,10 +143,12 @@ class TEARDROP_PARAMETERS_LIST
std::vector<TEARDROP_PARAMETERS> m_params_list; std::vector<TEARDROP_PARAMETERS> m_params_list;
public: public:
/// True to create teardrops for vias and pads with holes /// True to create teardrops for vias
bool m_TargetViasPads; bool m_TargetVias;
/// True to create teardrops for pads without holes (SMD and others /// True to create teardrops for pads with holes
bool m_TargetPadsWithNoHole; bool m_TargetPTHPads;
/// True to create teardrops for pads SMD, edge connectors,
bool m_TargetSMDPads;
/// True to create teardrops at the end of a track connected to the end of /// True to create teardrops at the end of a track connected to the end of
/// another track having a different width /// another track having a different width
bool m_TargetTrack2Track; bool m_TargetTrack2Track;
@ -155,8 +157,9 @@ public:
public: public:
TEARDROP_PARAMETERS_LIST() : TEARDROP_PARAMETERS_LIST() :
m_TargetViasPads( true ), m_TargetVias( true ),
m_TargetPadsWithNoHole( true ), m_TargetPTHPads( true ),
m_TargetSMDPads( true ),
m_TargetTrack2Track( false ), m_TargetTrack2Track( false ),
m_UseRoundShapesOnly( false ) m_UseRoundShapesOnly( false )
{ {