Dialog-ize CvPcb and implement proper Save.

Save now goes to disk (instead of just the in-memory schemaitc),
and the UI attempts to make this clear.
This commit is contained in:
Jeff Young 2018-03-24 18:28:35 +00:00
parent 8d8c422a19
commit b24b0d5dfe
10 changed files with 198 additions and 178 deletions

View File

@ -112,28 +112,39 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType,
}
DIALOG_SHIM* findQuasiModalDialog( wxWindowList& aList )
wxWindow* EDA_BASE_FRAME::findQuasiModalDialog()
{
for( wxWindowList::iterator iter = aList.begin(); iter != aList.end(); ++iter )
for( auto& iter : GetChildren() )
{
DIALOG_SHIM* dlg = dynamic_cast<DIALOG_SHIM*>( *iter );
DIALOG_SHIM* dlg = dynamic_cast<DIALOG_SHIM*>( iter );
if( dlg && dlg->IsQuasiModal() )
return dlg;
}
return NULL;
// FIXME: CvPcb is currently implemented on top of KIWAY_PLAYER rather than DIALOG_SHIM,
// so we have to look for it separately.
if( m_Ident == FRAME_SCH )
{
wxWindow* cvpcb = wxWindow::FindWindowByName( "CvpcbFrame" );
if( cvpcb )
return cvpcb;
}
return nullptr;
}
void EDA_BASE_FRAME::windowClosing( wxCloseEvent& event )
{
DIALOG_SHIM* dlg = findQuasiModalDialog( GetChildren() );
if( dlg )
// Don't allow closing when a quasi-modal is open.
wxWindow* quasiModal = findQuasiModalDialog();
if( quasiModal )
{
// Happens when a quasi modal dialog is currently open.
// For example: if the Kicad manager try to close Kicad.
wxMessageBox( _(
"The program cannot be closed\n"
"A quasi-modal dialog window is currently open, please close it first." ) );
// Raise and notify; don't give the user a warning regarding "quasi-modal dialogs"
// when they have no idea what those are.
quasiModal->Raise();
wxBell();
event.Veto();
return;
}
@ -182,7 +193,7 @@ bool EDA_BASE_FRAME::ProcessEvent( wxEvent& aEvent )
// them.
if( !IsEnabled() && IsActive() )
{
DIALOG_SHIM* dlg = findQuasiModalDialog( GetChildren() );
wxWindow* dlg = findQuasiModalDialog();
if( dlg )
dlg->Raise();
}

View File

@ -39,9 +39,7 @@
// specific IDs
enum id_cvpcb_frm
{
ID_CVPCB_QUIT = ID_END_LIST,
ID_CVPCB_SAVEQUITCVPCB,
ID_CVPCB_CREATE_SCREENCMP,
ID_CVPCB_CREATE_SCREENCMP = ID_END_LIST,
ID_CVPCB_GOTO_FIRSTNA,
ID_CVPCB_GOTO_PREVIOUSNA,
ID_CVPCB_DEL_ASSOCIATIONS,
@ -54,7 +52,6 @@ enum id_cvpcb_frm
ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST,
ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST,
ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME,
ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE,
ID_CVPCB_LIBRARY_LIST,
ID_CVPCB_EQUFILES_LIST_EDIT,
ID_CVPCB_LIB_TABLE_EDIT,

View File

@ -34,11 +34,8 @@
#include <kiface_i.h>
#include <macros.h>
#include <confirm.h>
#include <eda_doc.h>
#include <eda_dde.h>
#include <gestfich.h>
#include <html_messagebox.h>
#include <wildcards_and_files_ext.h>
#include <fp_lib_table.h>
#include <netlist_reader.h>
#include <bitmaps.h>
@ -58,26 +55,20 @@ wxSize const FRAME_DEFAULT_SIZE_DU( 450, 300 );
///@{
/// \ingroup config
/// Nonzero if cvpcb should be kept open after saving association in schematic
static const wxString KeepCvpcbOpenEntry = "KeepCvpcbOpen";
static const wxString FilterFootprintEntry = "FilterFootprint";
///@}
BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, KIWAY_PLAYER )
// Menu events
EVT_MENU( wxID_SAVE, CVPCB_MAINFRAME::SaveQuitCvpcb )
EVT_MENU( wxID_SAVE, CVPCB_MAINFRAME::OnSaveAndContinue )
EVT_MENU( wxID_EXIT, CVPCB_MAINFRAME::OnQuit )
EVT_MENU( wxID_HELP, CVPCB_MAINFRAME::GetKicadHelp )
EVT_MENU( wxID_ABOUT, CVPCB_MAINFRAME::GetKicadAbout )
EVT_MENU( ID_PREFERENCES_CONFIGURE_PATHS, CVPCB_MAINFRAME::OnConfigurePaths )
EVT_MENU( ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE, CVPCB_MAINFRAME::OnKeepOpenOnSave )
EVT_MENU( ID_CVPCB_EQUFILES_LIST_EDIT, CVPCB_MAINFRAME::OnEditEquFilesList )
// Toolbar events
EVT_TOOL( ID_CVPCB_QUIT, CVPCB_MAINFRAME::OnQuit )
EVT_TOOL( ID_CVPCB_LIB_TABLE_EDIT, CVPCB_MAINFRAME::OnEditFootprintLibraryTable )
EVT_TOOL( ID_CVPCB_CREATE_SCREENCMP, CVPCB_MAINFRAME::DisplayModule )
EVT_TOOL( ID_CVPCB_GOTO_FIRSTNA, CVPCB_MAINFRAME::ToFirstNA )
@ -94,12 +85,15 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, KIWAY_PLAYER )
CVPCB_MAINFRAME::OnSelectFilteringFootprint )
EVT_TEXT( ID_CVPCB_FILTER_TEXT_EDIT, CVPCB_MAINFRAME::OnEnterFilteringText )
// Button events
EVT_BUTTON( wxID_OK, CVPCB_MAINFRAME::OnOK )
EVT_BUTTON( wxID_CANCEL, CVPCB_MAINFRAME::OnCancel )
// Frame events
EVT_CLOSE( CVPCB_MAINFRAME::OnCloseWindow )
EVT_SIZE( CVPCB_MAINFRAME::OnSize )
// UI event handlers
EVT_UPDATE_UI( ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE, CVPCB_MAINFRAME::OnUpdateKeepOpenOnSave )
EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, CVPCB_MAINFRAME::OnFilterFPbyKeywords)
EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, CVPCB_MAINFRAME::OnFilterFPbyPinCount )
EVT_UPDATE_UI( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST, CVPCB_MAINFRAME::OnFilterFPbyLibrary )
@ -120,8 +114,6 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_libListBox = NULL;
m_mainToolBar = NULL;
m_modified = false;
m_keepCvpcbOpen = false;
m_undefinedComponentCnt = 0;
m_skipComponentSelect = false;
m_filteringOptions = 0;
m_tcFilterString = NULL;
@ -143,12 +135,6 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
// Frame size and position
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
// create the status bar
static const int dims[3] = { -1, -1, 250 };
CreateStatusBar( 3 );
SetStatusWidths( 3, dims );
ReCreateMenuBar();
ReCreateHToolbar();
@ -167,7 +153,6 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
EDA_PANEINFO info;
info.InfoToolbarPane();
if( m_mainToolBar )
m_auimgr.AddPane( m_mainToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top() );
@ -186,12 +171,55 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
wxAuiPaneInfo( info ).Name( wxT( "m_footprintListBox" ) ).
Right().BestSize( (int) ( m_FrameSize.x * 0.30 ), m_FrameSize.y ) );
auto bottomPanel = new wxPanel( this );
auto panelSizer = new wxBoxSizer( wxHORIZONTAL );
auto statusSizer = new wxBoxSizer( wxVERTICAL );
m_statusLine1 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
m_statusLine1->SetFont( wxFont( 10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
statusSizer->Add( m_statusLine1, 0, wxTOP, 5 );
m_statusLine2 = new wxStaticText( bottomPanel, wxID_ANY, wxEmptyString );
m_statusLine2->SetFont( wxFont( 10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
statusSizer->Add( m_statusLine2, 0, wxTOP, 4 );
panelSizer->Add( statusSizer, 1, wxEXPAND|wxLEFT, 5 );
m_saveAndContinue = new wxButton( bottomPanel, wxID_SAVE,
wxT("Apply, Save Schematic && Continue") );
panelSizer->Add( m_saveAndContinue, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
auto sdbSizer1 = new wxStdDialogButtonSizer();
auto sdbSizer1OK = new wxButton( bottomPanel, wxID_OK );
sdbSizer1->AddButton( sdbSizer1OK );
auto sdbSizer1Cancel = new wxButton( bottomPanel, wxID_CANCEL );
sdbSizer1->AddButton( sdbSizer1Cancel );
sdbSizer1->Realize();
panelSizer->Add( sdbSizer1, 0, wxEXPAND|wxLEFT, 10 );
bottomPanel->SetSizer( panelSizer );
bottomPanel->Fit();
sdbSizer1OK->SetDefault();
m_auimgr.AddPane( bottomPanel, wxAuiPaneInfo( horiz ).Name( wxT( "buttons" ) ).Bottom() );
m_auimgr.Update();
// Connect Events
m_saveAndContinue->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CVPCB_MAINFRAME::OnSaveAndContinue ), NULL, this );
}
CVPCB_MAINFRAME::~CVPCB_MAINFRAME()
{
// Disconnect Events
m_saveAndContinue->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( CVPCB_MAINFRAME::OnSaveAndContinue ), NULL, this );
m_auimgr.UnInit();
}
@ -205,7 +233,6 @@ void CVPCB_MAINFRAME::LoadSettings( wxConfigBase* aCfg )
if( m_FrameSize == wxDefaultSize )
m_FrameSize = frame_default;
aCfg->Read( KeepCvpcbOpenEntry, &m_keepCvpcbOpen, true );
aCfg->Read( FilterFootprintEntry, &m_filteringOptions, FOOTPRINTS_LISTBOX::UNFILTERED_FP_LIST );
}
@ -214,7 +241,6 @@ void CVPCB_MAINFRAME::SaveSettings( wxConfigBase* aCfg )
{
EDA_BASE_FRAME::SaveSettings( aCfg );
aCfg->Write( KeepCvpcbOpenEntry, m_keepCvpcbOpen );
aCfg->Write( FilterFootprintEntry, m_filteringOptions );
}
@ -225,17 +251,11 @@ void CVPCB_MAINFRAME::OnSize( wxSizeEvent& event )
}
void CVPCB_MAINFRAME::OnQuit( wxCommandEvent& event )
{
Close( false );
}
void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
{
if( m_modified )
{
wxString msg = _( "Component to Footprint links modified.\nSave before exit ?" );
wxString msg = _( "Component to Footprint links modified.\nSave before exit?" );
int ii = DisplayExitDialog( this, msg );
switch( ii )
@ -248,7 +268,7 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
break;
case wxID_YES:
SaveFootprintAssociation();
SaveFootprintAssociation( false );
break;
}
}
@ -260,7 +280,6 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
m_modified = false;
Destroy();
return;
}
@ -294,14 +313,14 @@ void CVPCB_MAINFRAME::ToFirstNA( wxCommandEvent& event )
if( m_netlist.IsEmpty() )
return;
long first_selected = m_compListBox->GetFirstSelected();
int first_selected = m_compListBox->GetFirstSelected();
if( first_selected < 0 )
first_selected = -1; // We will start to 0 for the first search , if no item selected
int candidate = -1;
for( unsigned jj = first_selected+1; jj < m_netlist.GetCount(); jj++ )
for( int jj = first_selected+1; jj < m_netlist.GetCount(); jj++ )
{
if( m_netlist.GetComponent( jj )->GetFPID().empty() )
{
@ -349,14 +368,36 @@ void CVPCB_MAINFRAME::ToPreviousNA( wxCommandEvent& event )
}
void CVPCB_MAINFRAME::SaveQuitCvpcb( wxCommandEvent& aEvent )
void CVPCB_MAINFRAME::OnOK( wxCommandEvent& aEvent )
{
SaveFootprintAssociation();
SaveFootprintAssociation( false );
m_modified = false;
if( !m_keepCvpcbOpen )
Close( true );
Close( true );
}
void CVPCB_MAINFRAME::OnSaveAndContinue( wxCommandEvent& aEvent )
{
SaveFootprintAssociation( true );
m_modified = false;
}
void CVPCB_MAINFRAME::OnCancel( wxCommandEvent& event )
{
// Throw away modifications on a Cancel
m_modified = false;
Close( false );
}
void CVPCB_MAINFRAME::OnQuit( wxCommandEvent& event )
{
Close( false );
}
@ -382,7 +423,6 @@ void CVPCB_MAINFRAME::DelAssociations( wxCommandEvent& event )
m_skipComponentSelect = false;
m_compListBox->SetSelection( 0 );
m_undefinedComponentCnt = m_netlist.GetCount();
}
DisplayStatus();
@ -449,12 +489,6 @@ void CVPCB_MAINFRAME::OnEditFootprintLibraryTable( wxCommandEvent& aEvent )
}
void CVPCB_MAINFRAME::OnKeepOpenOnSave( wxCommandEvent& event )
{
m_keepCvpcbOpen = event.IsChecked();
}
void CVPCB_MAINFRAME::DisplayModule( wxCommandEvent& event )
{
CreateScreenCmp();
@ -486,7 +520,10 @@ void CVPCB_MAINFRAME::refreshAfterComponentSearch( COMPONENT* component )
m_auimgr.Update();
if( component == NULL )
{
DisplayStatus();
return;
}
// Preview of the already assigned footprint.
// Find the footprint that was already chosen for this component and select it,
@ -567,12 +604,6 @@ void CVPCB_MAINFRAME::OnSelectFilteringFootprint( wxCommandEvent& event )
}
void CVPCB_MAINFRAME::OnUpdateKeepOpenOnSave( wxUpdateUIEvent& event )
{
event.Check( m_keepCvpcbOpen );
}
void CVPCB_MAINFRAME::OnFilterFPbyKeywords( wxUpdateUIEvent& event )
{
event.Check( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_COMPONENT_KEYWORD );
@ -614,19 +645,16 @@ void CVPCB_MAINFRAME::OnEnterFilteringText( wxCommandEvent& aEvent )
void CVPCB_MAINFRAME::DisplayStatus()
{
wxString msg;
COMPONENT* component;
if( !m_libListBox || !m_compListBox || !m_footprintListBox )
return; // still initializing; not ready for status yet
if( wxWindow::FindFocus() == m_compListBox || wxWindow::FindFocus() == m_libListBox )
wxString filters, msg;
COMPONENT* component = GetSelectedComponent();
if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_COMPONENT_KEYWORD ) )
{
msg.Printf( _( "Components: %d, unassigned: %d" ), (int) m_netlist.GetCount(),
m_undefinedComponentCnt );
SetStatusText( msg, 0 );
msg.Empty();
component = GetSelectedComponent();
if( component )
{
for( unsigned ii = 0; ii < component->GetFootprintFilters().GetCount(); ii++ )
@ -636,69 +664,65 @@ void CVPCB_MAINFRAME::DisplayStatus()
else
msg += wxT( ", " ) + component->GetFootprintFilters()[ii];
}
msg = _( "Filter list: " ) + msg;
}
SetStatusText( msg, 1 );
filters += _( "key words" ) + wxString::Format( wxT( " (%s)" ), msg );
}
else
if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_PIN_COUNT ) )
{
wxString footprintName = GetSelectedFootprint();
msg.Empty();
FOOTPRINT_INFO* module = m_FootprintsList->GetModuleInfo( footprintName );
if( component )
msg = wxString::Format( wxT( "%i" ), component->GetNetCount() );
if( module ) // can be NULL if no netlist loaded
{
msg = _( "Description: " ) + module->GetDoc();
SetStatusText( msg, 0 );
if( !filters.IsEmpty() )
filters += wxT( ", " );
msg = _( "Key words: " ) + module->GetKeywords();
SetStatusText( msg, 1 );
}
filters += _( "pin count" ) + wxString::Format( wxT( " (%s)" ), msg );
}
if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_LIBRARY ) )
{
msg = m_libListBox->GetSelectedLibrary();
if( !filters.IsEmpty() )
filters += wxT( ", " );
filters += _( "library" ) + wxString::Format( wxT( " (%s)" ), msg );
}
if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_NAME ) )
{
if( !filters.IsEmpty() )
filters += wxT( ", " );
filters += _( "search text" );
}
if( filters.IsEmpty() )
msg = _( "No filtering" );
else
msg.Printf( _( "Filtered by %s" ), GetChars( filters ) );
msg << wxT( ": " ) << m_footprintListBox->GetCount();
m_statusLine1->SetLabel( msg );
msg.Empty();
wxString filters;
wxString footprintName = GetSelectedFootprint();
if( m_footprintListBox )
FOOTPRINT_INFO* module = m_FootprintsList->GetModuleInfo( footprintName );
if( module ) // can be NULL if no netlist loaded
{
if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_COMPONENT_KEYWORD ) )
filters = _( "key words" );
if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_PIN_COUNT ) )
{
if( !filters.IsEmpty() )
filters += wxT( "+" );
filters += _( "pin count" );
}
if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_LIBRARY ) )
{
if( !filters.IsEmpty() )
filters += wxT( "+" );
filters += _( "library" );
}
if( ( m_filteringOptions & FOOTPRINTS_LISTBOX::FILTERING_BY_NAME ) )
{
if( !filters.IsEmpty() )
filters += wxT( "+" );
filters += _( "name" );
}
if( filters.IsEmpty() )
msg = _( "No filtering" );
else
msg.Printf( _( "Filtered by %s" ), GetChars( filters ) );
msg << wxT( ": " ) << m_footprintListBox->GetCount();
SetStatusText( msg, 2 );
msg = wxString::Format( _( "Description: %s; Key words: %s" ),
module->GetDoc(),
module->GetKeywords() );
}
m_statusLine2->SetLabel( msg );
}
@ -785,8 +809,8 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist( const std::string& aNetlist )
}
catch( const IO_ERROR& ioe )
{
wxString msg = wxString::Format( _( "Error loading netlist.\n%s" ), ioe.What().GetData() );
wxMessageBox( msg, _( "Netlist Load Error" ), wxOK | wxICON_ERROR );
wxString msg = wxString::Format( _( "Error loading schematic.\n%s" ), ioe.What().GetData() );
wxMessageBox( msg, _( "Load Error" ), wxOK | wxICON_ERROR );
return 1;
}
@ -977,6 +1001,10 @@ void CVPCB_MAINFRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
*/
break;
case MAIL_STATUS:
m_statusLine2->SetLabel( payload );
break;
default:
; // ignore most
}

View File

@ -58,9 +58,7 @@ class CVPCB_MAINFRAME : public KIWAY_PLAYER
{
friend struct CV::IFACE;
wxArrayString m_footprintListEntries;
wxString m_currentSearchPattern;
bool m_keepCvpcbOpen;
NETLIST m_netlist;
int m_filteringOptions;
wxAuiToolBar* m_mainToolBar;
@ -68,6 +66,9 @@ class CVPCB_MAINFRAME : public KIWAY_PLAYER
LIBRARY_LISTBOX* m_libListBox;
COMPONENTS_LISTBOX* m_compListBox;
wxTextCtrl* m_tcFilterString;
wxStaticText* m_statusLine1;
wxStaticText* m_statusLine2;
wxButton* m_saveAndContinue;
public:
wxArrayString m_ModuleLibNames;
@ -111,9 +112,13 @@ public:
*/
void OnEditFootprintLibraryTable( wxCommandEvent& event );
void OnCancel( wxCommandEvent& aEvent );
void OnOK( wxCommandEvent& aEvent );
void OnSaveAndContinue( wxCommandEvent& aEvent );
void OnQuit( wxCommandEvent& event );
void OnCloseWindow( wxCloseEvent& Event );
void OnSize( wxSizeEvent& SizeEvent );
void OnKeyDown( wxKeyEvent& aEvent );
void ReCreateHToolbar();
virtual void ReCreateMenuBar() override;
void ShowChangedLanguage() override;
@ -129,8 +134,6 @@ public:
*/
void DelAssociations( wxCommandEvent& event );
void SaveQuitCvpcb( wxCommandEvent& event );
void OnConfigurePaths( wxCommandEvent& aEvent );
/**
@ -139,7 +142,6 @@ public:
*/
void OnEditEquFilesList( wxCommandEvent& aEvent );
void OnKeepOpenOnSave( wxCommandEvent& event );
void DisplayModule( wxCommandEvent& event );
/**
@ -152,8 +154,6 @@ public:
*/
void AutomaticFootprintMatching( wxCommandEvent& event );
void DisplayDocFile( wxCommandEvent& event );
/**
* Function OnSelectFilteringFootprint
* is the command event handler for enabling and disabling footprint filtering.
@ -197,8 +197,9 @@ public:
* Function SaveFootprintAssociation
* saves the edits that the user has done by sending them back to eeschema
* via the kiway.
* Optionally saves the schematic to disk as well.
*/
void SaveFootprintAssociation();
void SaveFootprintAssociation( bool doSaveSchematic );
/**
* Function ReadNetListAndFpFiles
@ -305,7 +306,6 @@ public:
private:
// UI event handlers.
// Keep consistent the display state of toggle menus or tools in toolbar
void OnUpdateKeepOpenOnSave( wxUpdateUIEvent& event );
void OnFilterFPbyKeywords( wxUpdateUIEvent& event );
void OnFilterFPbyPinCount( wxUpdateUIEvent& event );
void OnFilterFPbyLibrary( wxUpdateUIEvent& event );

View File

@ -62,18 +62,10 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
// Save the footprints back into eeschema
AddMenuItem( filesMenu, wxID_SAVE,
_( "&Save Footprint Associations\tCtrl+S" ),
_( "&Save Schematic\tCtrl+S" ),
SAVE_HLP_MSG,
KiBitmap( save_xpm ) );
// Separator
filesMenu->AppendSeparator();
// Quit
AddMenuItem( filesMenu, wxID_EXIT,
_( "&Close" ), _( "Close CvPcb" ),
KiBitmap( exit_xpm ) );
// Preferences Menu :
wxMenu* preferencesMenu = new wxMenu;
@ -100,14 +92,6 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
// Language submenu
Pgm().AddMenuLanguageList( preferencesMenu );
// Keep open on save data
preferencesMenu->AppendSeparator();
AddMenuItem( preferencesMenu, ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE,
_( "&Keep Open On Save" ),
_( "Prevent CvPcb from exiting after saving netlist file" ),
KiBitmap( exit_xpm ),
wxITEM_CHECK );
// Menu Help:
wxMenu* helpMenu = new wxMenu;
@ -129,7 +113,7 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
KiBitmap( about_xpm ) );
// Create the menubar and append all submenus
menuBar->Append( filesMenu, _( "&Save" ) );
menuBar->Append( filesMenu, _( "&File" ) );
menuBar->Append( preferencesMenu, _( "&Preferences" ) );
menuBar->Append( helpMenu, _( "&Help" ) );

View File

@ -34,13 +34,11 @@
#include <macros.h>
#include <lib_id.h>
#include <fp_lib_table.h>
#include <reporter.h>
#include <html_messagebox.h>
#include <cvpcb.h>
#include <cvpcb_mainframe.h>
#include <listboxes.h>
#include <wildcards_and_files_ext.h>
#include <fp_conflict_assignment_selector.h>
@ -97,9 +95,6 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName, int aIndex )
if( component == NULL )
return;
// Check to see if the component has already a footprint set.
bool hasFootprint = !component->GetFPID().empty();
LIB_ID fpid;
if( !aFootprintName.IsEmpty() )
@ -117,12 +112,6 @@ void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName, int aIndex )
GetChars( component->GetValue() ),
GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
// If the component hasn't had a footprint associated with it
// it now has, so we decrement the count of components without
// a footprint assigned.
if( !hasFootprint )
m_undefinedComponentCnt -= 1;
// Set the new description and deselect the processed component
m_compListBox->SetString( aIndex, description );
@ -196,7 +185,6 @@ bool CVPCB_MAINFRAME::ReadNetListAndFpFiles( const std::string& aNetlist )
BuildLIBRARY_LISTBOX();
m_compListBox->Clear();
m_undefinedComponentCnt = 0;
if( m_netlist.AnyFootprintsLinked() )
{
@ -391,7 +379,7 @@ bool CVPCB_MAINFRAME::ReadNetListAndFpFiles( const std::string& aNetlist )
}
void CVPCB_MAINFRAME::SaveFootprintAssociation()
void CVPCB_MAINFRAME::SaveFootprintAssociation( bool doSaveSchematic )
{
STRING_FORMATTER sf;
@ -399,5 +387,6 @@ void CVPCB_MAINFRAME::SaveFootprintAssociation()
Kiway().ExpressMail( FRAME_SCH, MAIL_BACKANNOTATE_FOOTPRINTS, sf.GetString() );
SetStatusText( _("Footprint association sent to Eeschema") );
if( doSaveSchematic )
Kiway().ExpressMail( FRAME_SCH, MAIL_SCH_SAVE, std::string( "" ) );
}

View File

@ -28,12 +28,9 @@
#include <common.h>
#include <bitmaps.h>
#include <cvpcb.h>
#include <cvpcb_mainframe.h>
#include <cvpcb_id.h>
#include <common_help_msg.h>
void CVPCB_MAINFRAME::ReCreateHToolbar()
{
@ -43,9 +40,6 @@ void CVPCB_MAINFRAME::ReCreateHToolbar()
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
m_mainToolBar->AddTool( wxID_SAVE, wxEmptyString, KiScaledBitmap( save_xpm, this ), SAVE_HLP_MSG );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_CVPCB_LIB_TABLE_EDIT, wxEmptyString,
KiScaledBitmap( config_xpm, this ),
_( "Edit footprint library table" ) );

View File

@ -276,6 +276,17 @@ void SCH_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
if( importFormat >= 0 )
importFile( path, importFormat );
}
break;
case MAIL_SCH_SAVE:
{
wxCommandEvent dummyEvent;
OnSaveProject( dummyEvent );
if( !isAutoSaveRequired() ) // proxy for save completed
Kiway().ExpressMail( FRAME_CVPCB, MAIL_STATUS, _( "Schematic saved" ).ToStdString() );
}
break;
default:
;

View File

@ -129,6 +129,8 @@ class EDA_BASE_FRAME : public wxFrame
*/
void windowClosing( wxCloseEvent& event );
wxWindow* findQuasiModalDialog();
/**
* Removes border from wxAui panes.
*/

View File

@ -37,15 +37,19 @@
enum MAIL_T
{
MAIL_CROSS_PROBE, ///< PCB<->SCH, CVPCB->SCH cross-probing.
MAIL_BACKANNOTATE_FOOTPRINTS, ///< CVPCB->SCH footprint stuffing at cvpcb termination
MAIL_EESCHEMA_NETLIST, ///< EESCHEMA->CVPCB netlist immediately after launching CVPCB
MAIL_SCH_PCB_UPDATE, ///< Sch->PCB forward update
MAIL_BACKANNOTATE_FOOTPRINTS, ///< CVPCB->SCH footprint stuffing
MAIL_SCH_SAVE, ///< CVPCB->SCH save the schematic
MAIL_EESCHEMA_NETLIST, ///< SCH->CVPCB netlist immediately after launching CVPCB
MAIL_SCH_PCB_UPDATE, ///< SCH->PCB forward update
MAIL_IMPORT_FILE, ///< Import a different format file
///< Sch->PCB forward update, requests SCH to re-generate netlist and send it to PCB
///< via another mail (kind of bootstrap)
MAIL_SCH_PCB_UPDATE_REQUEST,
MAIL_SCH_REFRESH ///< The the schematic editor to refresh the display.
MAIL_SCH_REFRESH, ///< The the schematic editor to refresh the display.
///< General-puspose messages
MAIL_STATUS
};
#endif // MAIL_TYPE_H_