Add save item to cvpcb toolbar and make it conditional

ADD: Save icon to cvpcb toolbar and make it conditional
This commit is contained in:
Ian McInerney 2019-12-19 15:35:11 +00:00
parent b9d8849b28
commit 4f7430f476
2 changed files with 12 additions and 3 deletions

View File

@ -45,7 +45,12 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
//
CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, tool );
fileMenu->AddItem( CVPCB_ACTIONS::saveAssociations, SELECTION_CONDITIONS::ShowAlways );
auto enableSaveCondition = [ this ] ( const SELECTION& sel )
{
return IsContentModified();
};
fileMenu->AddItem( CVPCB_ACTIONS::saveAssociations, enableSaveCondition );
fileMenu->AddSeparator();
fileMenu->AddClose( _( "Assign Footprints" ) );

View File

@ -40,6 +40,9 @@ void CVPCB_MAINFRAME::ReCreateHToolbar()
m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
m_mainToolBar->Add( CVPCB_ACTIONS::saveAssociations );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->Add( ACTIONS::showFootprintLibTable );
KiScaledSeparator( m_mainToolBar, this );
@ -85,6 +88,7 @@ void CVPCB_MAINFRAME::SyncToolbars()
{
#define filterActive( filter ) ( m_filteringOptions & filter )
m_mainToolBar->Toggle( CVPCB_ACTIONS::saveAssociations, IsContentModified() );
m_mainToolBar->Toggle( ACTIONS::undo, m_undoList.size() > 0 );
m_mainToolBar->Toggle( ACTIONS::redo, m_redoList.size() > 0 );