Cvpcb: fix SaveAssociations. Save association to disk only from the Apply button.
Previously, the association was saved to disk also on OK button click. From master branch
This commit is contained in:
parent
7890d78801
commit
ea1a1a43c0
|
@ -276,9 +276,10 @@ void CVPCB_MAINFRAME::setupUIConditions()
|
|||
#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
|
||||
#define CHECK( x ) ACTION_CONDITIONS().Check( x )
|
||||
|
||||
mgr->SetConditions( CVPCB_ACTIONS::saveAssociations, ENABLE( cond.ContentModified() ) );
|
||||
mgr->SetConditions( ACTIONS::undo, ENABLE( cond.UndoAvailable() ) );
|
||||
mgr->SetConditions( ACTIONS::redo, ENABLE( cond.RedoAvailable() ) );
|
||||
mgr->SetConditions( CVPCB_ACTIONS::saveAssociationsToSchematic, ENABLE( cond.ContentModified() ) );
|
||||
mgr->SetConditions( CVPCB_ACTIONS::saveAssociationsToFile, ENABLE( cond.ContentModified() ) );
|
||||
mgr->SetConditions( ACTIONS::undo, ENABLE( cond.UndoAvailable() ) );
|
||||
mgr->SetConditions( ACTIONS::redo, ENABLE( cond.RedoAvailable() ) );
|
||||
|
||||
auto compFilter =
|
||||
[this] ( const SELECTION& )
|
||||
|
@ -327,7 +328,7 @@ void CVPCB_MAINFRAME::setupEventHandlers()
|
|||
[this]( wxCommandEvent& )
|
||||
{
|
||||
// saveAssociations must be run immediately
|
||||
GetToolManager()->RunAction( CVPCB_ACTIONS::saveAssociations, true );
|
||||
GetToolManager()->RunAction( CVPCB_ACTIONS::saveAssociationsToFile, true );
|
||||
} );
|
||||
|
||||
// Connect the handlers for the ok/cancel buttons
|
||||
|
@ -335,7 +336,7 @@ void CVPCB_MAINFRAME::setupEventHandlers()
|
|||
[this]( wxCommandEvent& )
|
||||
{
|
||||
// saveAssociations must be run immediately, before running Close( true )
|
||||
GetToolManager()->RunAction( CVPCB_ACTIONS::saveAssociations, true );
|
||||
GetToolManager()->RunAction( CVPCB_ACTIONS::saveAssociationsToSchematic, true );
|
||||
Close( true );
|
||||
}, wxID_OK );
|
||||
Bind( wxEVT_BUTTON,
|
||||
|
|
|
@ -46,7 +46,7 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
|
|||
//
|
||||
ACTION_MENU* fileMenu = new ACTION_MENU( false, tool );
|
||||
|
||||
fileMenu->Add( CVPCB_ACTIONS::saveAssociations );
|
||||
fileMenu->Add( CVPCB_ACTIONS::saveAssociationsToSchematic );
|
||||
fileMenu->AppendSeparator();
|
||||
fileMenu->AddClose( _( "Assign Footprints" ) );
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ void CVPCB_MAINFRAME::ReCreateHToolbar()
|
|||
m_mainToolBar->SetAuiManager( &m_auimgr );
|
||||
}
|
||||
|
||||
m_mainToolBar->Add( CVPCB_ACTIONS::saveAssociations );
|
||||
m_mainToolBar->Add( CVPCB_ACTIONS::saveAssociationsToSchematic );
|
||||
|
||||
m_mainToolBar->AddScaledSeparator( this );
|
||||
m_mainToolBar->Add( ACTIONS::showFootprintLibTable );
|
||||
|
|
|
@ -61,13 +61,20 @@ TOOL_ACTION CVPCB_ACTIONS::showEquFileTable( "cvpcb.Control.ShowEquFileTable",
|
|||
_( "Configure footprint association file (.equ) list. These files are "
|
||||
"used to automatically assign footprint names from symbol values." ) );
|
||||
|
||||
TOOL_ACTION CVPCB_ACTIONS::saveAssociations( "cvpcb.Control.SaveAssociations",
|
||||
TOOL_ACTION CVPCB_ACTIONS::saveAssociationsToSchematic( "cvpcb.Control.SaveAssociationsToSchematic",
|
||||
AS_GLOBAL,
|
||||
MD_CTRL + 'S', LEGACY_HK_NAME( "Save" ),
|
||||
_( "Save to Schematic" ),
|
||||
_( "Save footprint associations in schematic symbol footprint fields" ),
|
||||
BITMAPS::save );
|
||||
|
||||
TOOL_ACTION CVPCB_ACTIONS::saveAssociationsToFile( "cvpcb.Control.SaveAssociationsToFile",
|
||||
AS_GLOBAL,
|
||||
MD_CTRL + 'S', LEGACY_HK_NAME( "Save" ),
|
||||
_( "Save to Schematic and File" ),
|
||||
_( "Save footprint associations in schematic symbol footprint fields and schematic files" ),
|
||||
BITMAPS::save );
|
||||
|
||||
// Actions to navigate the display
|
||||
TOOL_ACTION CVPCB_ACTIONS::changeFocusRight( "cvpcb.Control.changeFocusRight",
|
||||
AS_GLOBAL,
|
||||
|
|
|
@ -53,7 +53,8 @@ public:
|
|||
static TOOL_ACTION gotoNextNA;
|
||||
|
||||
/// Management actions
|
||||
static TOOL_ACTION saveAssociations;
|
||||
static TOOL_ACTION saveAssociationsToSchematic;
|
||||
static TOOL_ACTION saveAssociationsToFile;
|
||||
static TOOL_ACTION showEquFileTable;
|
||||
|
||||
/// Footprint Association actions
|
||||
|
|
|
@ -210,13 +210,20 @@ int CVPCB_CONTROL::ShowEquFileTable( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
int CVPCB_CONTROL::SaveAssociations( const TOOL_EVENT& aEvent )
|
||||
int CVPCB_CONTROL::SaveAssociationsToFile( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
m_frame->SaveFootprintAssociation( true );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int CVPCB_CONTROL::SaveAssociationsToSchematic( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
m_frame->SaveFootprintAssociation( false );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int CVPCB_CONTROL::ToNA( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
int tmp = aEvent.Parameter<intptr_t>();
|
||||
|
@ -315,7 +322,8 @@ void CVPCB_CONTROL::setTransitions()
|
|||
|
||||
// Management actions
|
||||
Go( &CVPCB_CONTROL::ShowEquFileTable, CVPCB_ACTIONS::showEquFileTable.MakeEvent() );
|
||||
Go( &CVPCB_CONTROL::SaveAssociations, CVPCB_ACTIONS::saveAssociations.MakeEvent() );
|
||||
Go( &CVPCB_CONTROL::SaveAssociationsToSchematic, CVPCB_ACTIONS::saveAssociationsToSchematic.MakeEvent() );
|
||||
Go( &CVPCB_CONTROL::SaveAssociationsToFile,CVPCB_ACTIONS::saveAssociationsToFile.MakeEvent() );
|
||||
|
||||
// Navigation actions
|
||||
Go( &CVPCB_CONTROL::ToNA, CVPCB_ACTIONS::gotoNextNA.MakeEvent() );
|
||||
|
|
|
@ -75,7 +75,14 @@ public:
|
|||
*
|
||||
* @param aEvent is the event generated by the tool framework
|
||||
*/
|
||||
int SaveAssociations( const TOOL_EVENT& aEvent );
|
||||
int SaveAssociationsToSchematic( const TOOL_EVENT& aEvent );
|
||||
|
||||
/**
|
||||
* Save the associations to the schematic and save schematic to file.
|
||||
*
|
||||
* @param aEvent is the event generated by the tool framework
|
||||
*/
|
||||
int SaveAssociationsToFile( const TOOL_EVENT& aEvent );
|
||||
|
||||
/**
|
||||
* Create or Update the frame showing the current highlighted footprint
|
||||
|
|
Loading…
Reference in New Issue