More uniform handling of state saving in global edit dialogs.

Includes Edit Text and Graphics Properties and Edit Track and Via
Properties.  It's also no longer board-specific as it turns out the
board timestamp is always 0 anyway.
This commit is contained in:
Jeff Young 2019-02-21 15:09:54 -07:00
parent dae7b03465
commit f14cf5cbc7
2 changed files with 42 additions and 19 deletions

View File

@ -60,8 +60,18 @@ enum
}; };
static wxString g_textAndGraphicsReferenceFilter; static bool g_modifyReferences;
static wxString g_textAndGraphicsFootprintFilter; static bool g_modifyValues;
static bool g_modifyOtherFields;
static bool g_modifyFootprintGraphics;
static bool g_modifyBoardText;
static bool g_modifyBoardGraphics;
static bool g_filterByLayer;
static LAYER_NUM g_layerFilter;
static bool g_filterByReference;
static wxString g_referenceFilter;
static bool g_filterByFootprint;
static wxString g_footprintFilter;
class DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS : public DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE class DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS : public DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE
@ -132,16 +142,39 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS( PCB_
DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::~DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS() DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::~DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS()
{ {
g_textAndGraphicsReferenceFilter = m_referenceFilter->GetValue(); g_modifyReferences = m_references->GetValue();
g_textAndGraphicsFootprintFilter = m_footprintFilter->GetValue(); g_modifyValues = m_values->GetValue();
g_modifyOtherFields = m_otherFields->GetValue();
g_modifyFootprintGraphics = m_footprintGraphics->GetValue();
g_modifyBoardText = m_boardText->GetValue();
g_modifyBoardGraphics = m_boardGraphics->GetValue();
g_filterByLayer = m_layerFilterOpt->GetValue();
g_layerFilter = m_layerFilter->GetLayerSelection();
g_filterByReference = m_referenceFilterOpt->GetValue();
g_referenceFilter = m_referenceFilter->GetValue();
g_filterByFootprint = m_footprintFilterOpt->GetValue();
g_footprintFilter = m_footprintFilter->GetValue();
} }
bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow() bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataToWindow()
{ {
m_references->SetValue( g_modifyReferences );
m_values->SetValue( g_modifyValues );
m_otherFields->SetValue( g_modifyOtherFields );
m_footprintGraphics->SetValue( g_modifyFootprintGraphics );
m_boardText->SetValue( g_modifyBoardText );
m_boardGraphics->SetValue( g_modifyBoardGraphics );
if( m_layerFilter->SetLayerSelection( g_layerFilter ) != wxNOT_FOUND )
m_layerFilterOpt->SetValue( g_filterByLayer );
// SetValue() generates events, ChangeValue() does not // SetValue() generates events, ChangeValue() does not
m_referenceFilter->ChangeValue( g_textAndGraphicsReferenceFilter ); m_referenceFilter->ChangeValue( g_referenceFilter );
m_footprintFilter->ChangeValue( g_textAndGraphicsFootprintFilter ); m_referenceFilterOpt->SetValue( g_filterByReference );
m_footprintFilter->ChangeValue( g_footprintFilter );
m_footprintFilterOpt->SetValue( g_filterByFootprint );
m_lineWidth.SetValue( INDETERMINATE ); m_lineWidth.SetValue( INDETERMINATE );
m_textWidth.SetValue( INDETERMINATE ); m_textWidth.SetValue( INDETERMINATE );

View File

@ -50,9 +50,6 @@ enum {
// Globals to remember control settings during a session // Globals to remember control settings during a session
static bool g_modifyTracks = true; static bool g_modifyTracks = true;
static bool g_modifyVias = true; static bool g_modifyVias = true;
// These settings go with a particular board, so we save the boardID.
static timestamp_t g_boardID;
static bool g_filterByNetclass; static bool g_filterByNetclass;
static wxString g_netclassFilter; static wxString g_netclassFilter;
static bool g_filterByNet; static bool g_filterByNet;
@ -141,7 +138,6 @@ DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS( PCB_EDIT
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::~DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS() DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::~DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS()
{ {
g_boardID = m_brd->GetTimeStamp();
g_modifyTracks = m_tracks->GetValue(); g_modifyTracks = m_tracks->GetValue();
g_modifyVias = m_vias->GetValue(); g_modifyVias = m_vias->GetValue();
g_filterByNetclass = m_netclassFilterOpt->GetValue(); g_filterByNetclass = m_netclassFilterOpt->GetValue();
@ -227,15 +223,12 @@ bool DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow()
m_tracks->SetValue( g_modifyTracks ); m_tracks->SetValue( g_modifyTracks );
m_vias->SetValue( g_modifyVias ); m_vias->SetValue( g_modifyVias );
if( g_filterByNetclass && g_boardID == m_brd->GetTimeStamp() ) if( g_filterByNetclass && m_netclassFilter->SetStringSelection( g_netclassFilter ) )
{
m_netclassFilter->SetStringSelection( g_netclassFilter );
m_netclassFilterOpt->SetValue( true ); m_netclassFilterOpt->SetValue( true );
}
else if( item ) else if( item )
m_netclassFilter->SetStringSelection( item->GetNet()->GetClassName() ); m_netclassFilter->SetStringSelection( item->GetNet()->GetClassName() );
if( g_filterByNet && g_boardID == m_brd->GetTimeStamp() ) if( g_filterByNet && m_brd->FindNet( g_netFilter ) != NULL )
{ {
m_netFilter->SetSelectedNet( g_netFilter ); m_netFilter->SetSelectedNet( g_netFilter );
m_netFilterOpt->SetValue( true ); m_netFilterOpt->SetValue( true );
@ -243,11 +236,8 @@ bool DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow()
else if( item ) else if( item )
m_netFilter->SetSelectedNetcode( item->GetNetCode() ); m_netFilter->SetSelectedNetcode( item->GetNetCode() );
if( g_filterByLayer && g_boardID == m_brd->GetTimeStamp() ) if( g_filterByLayer && m_layerFilter->SetLayerSelection( g_layerFilter ) != wxNOT_FOUND )
{
m_layerFilter->SetLayerSelection( g_layerFilter );
m_layerFilterOpt->SetValue( true ); m_layerFilterOpt->SetValue( true );
}
else if( item ) else if( item )
m_layerFilter->SetLayerSelection( item->GetLayer() ); m_layerFilter->SetLayerSelection( item->GetLayer() );