Eeschema fixes: fix Bug #1348983 save cmp file crashes cvpcb when eeschema is opened (backannotation crashes). Happens only when some footprint names are not set (blank names).

Also fix incorrect backannotation when footprint names contain spaces (put spaces in names is always a bad idea)
* Fix minor Bug #1349058 Choose component dialog: Search field loses focus after entering a character and internationalize the dialog.
* Fix a subtle bug which prevent eeschema to read the project config file when launched from kicad manager, and when kicad.pro is not found.
This commit is contained in:
jean-pierre charras 2014-07-28 11:24:15 +02:00
parent 37757b5283
commit 33605eaaec
8 changed files with 69 additions and 74 deletions

View File

@ -394,7 +394,7 @@ int CVPCB_MAINFRAME::SaveCmpLinkFile( const wxString& aFullFileName )
STRING_FORMATTER sf;
m_netlist.FormatBackAnnotation( &sf );
wxMessageBox(sf.GetString());
Kiway().ExpressMail( FRAME_SCH, MAIL_BACKANNOTATE_FOOTPRINTS, sf.GetString() );
}

View File

@ -70,13 +70,23 @@ void SCH_EDIT_FRAME::backAnnotateFootprints( const std::string& aChangedSetOfRef
#endif
CPTREE& back_anno = doc.get_child( "back_annotation" );
wxString footprint;
for( PTREE::const_iterator ref = back_anno.begin(); ref != back_anno.end(); ++ref )
{
wxASSERT( ref->first == "ref" );
wxString reference = (UTF8&) ref->second.front().first;
wxString footprint = (UTF8&) ref->second.get_child( "fpid" ).front().first;
// Ensure the "fpid" node contains a footprint name,
// and get it if exists
if( ref->second.get_child( "fpid" ).size() )
{
wxString tmp = (UTF8&) ref->second.get_child( "fpid" ).front().first;
footprint = tmp;
}
else
footprint.Empty();
DBG( printf( "%s: ref:%s fpid:%s\n", __func__, TO_UTF8( reference ), TO_UTF8( footprint ) ); )

View File

@ -77,6 +77,7 @@ void DIALOG_CHOOSE_COMPONENT::OnSearchBoxChange( wxCommandEvent& aEvent )
{
m_search_container->UpdateSearchTerm( m_searchBox->GetLineText(0) );
updateSelection();
m_searchBox->SetFocus();
}

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Feb 22 2014)
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -13,60 +13,54 @@ DIALOG_CHOOSE_COMPONENT_BASE::DIALOG_CHOOSE_COMPONENT_BASE( wxWindow* parent, wx
{
this->SetSizeHints( wxSize( 450,100 ), wxDefaultSize );
wxBoxSizer* bSizer1;
bSizer1 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSearchSizer;
bSearchSizer = new wxBoxSizer( wxHORIZONTAL );
m_searchLabel = new wxStaticText( this, wxID_ANY, wxT("Search"), wxDefaultPosition, wxDefaultSize, 0 );
m_searchLabel = new wxStaticText( this, wxID_ANY, _("Filter:"), wxDefaultPosition, wxDefaultSize, 0 );
m_searchLabel->Wrap( -1 );
bSearchSizer->Add( m_searchLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
bSearchSizer->Add( m_searchLabel, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_searchBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
bSearchSizer->Add( m_searchBox, 1, wxALL, 5 );
bSearchSizer->Add( m_searchBox, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
bSizer1->Add( bSearchSizer, 0, wxEXPAND, 5 );
bSizerMain->Add( bSearchSizer, 0, wxEXPAND, 5 );
m_libraryComponentTree = new wxTreeCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_DEFAULT_STYLE|wxTR_HIDE_ROOT );
m_libraryComponentTree->SetMinSize( wxSize( -1,50 ) );
bSizer1->Add( m_libraryComponentTree, 1, wxALL|wxEXPAND, 5 );
bSizerMain->Add( m_libraryComponentTree, 1, wxALL|wxEXPAND, 5 );
wxBoxSizer* bSizer3;
bSizer3 = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizerView;
bSizerView = new wxBoxSizer( wxHORIZONTAL );
m_componentView = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER );
m_componentView->SetMinSize( wxSize( 150,150 ) );
bSizer3->Add( m_componentView, 4, wxEXPAND | wxALL, 5 );
bSizerView->Add( m_componentView, 4, wxEXPAND | wxALL, 5 );
m_componentDetails = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1,-1 ), wxTE_MULTILINE );
m_componentDetails->SetMinSize( wxSize( -1,100 ) );
bSizer3->Add( m_componentDetails, 3, wxALL|wxEXPAND, 5 );
bSizerView->Add( m_componentDetails, 3, wxALL|wxEXPAND, 5 );
bSizer1->Add( bSizer3, 1, wxEXPAND, 5 );
bSizerMain->Add( bSizerView, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer5;
bSizer5 = new wxBoxSizer( wxVERTICAL );
m_stdButtons = new wxStdDialogButtonSizer();
m_stdButtonsOK = new wxButton( this, wxID_OK );
m_stdButtons->AddButton( m_stdButtonsOK );
m_stdButtonsCancel = new wxButton( this, wxID_CANCEL );
m_stdButtons->AddButton( m_stdButtonsCancel );
m_stdButtons->Realize();
m_button = new wxStdDialogButtonSizer();
m_buttonOK = new wxButton( this, wxID_OK );
m_button->AddButton( m_buttonOK );
m_buttonCancel = new wxButton( this, wxID_CANCEL );
m_button->AddButton( m_buttonCancel );
m_button->Realize();
bSizer5->Add( m_button, 0, wxALL|wxEXPAND, 5 );
bSizerMain->Add( m_stdButtons, 0, wxALL|wxEXPAND, 5 );
bSizer1->Add( bSizer5, 0, wxALIGN_RIGHT, 5 );
this->SetSizer( bSizer1 );
this->SetSizer( bSizerMain );
this->Layout();
this->Centre( wxBOTH );

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="11" />
<FileVersion major="1" minor="13" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
@ -14,7 +14,7 @@
<property name="file">dialog_choose_component_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="internationalize">0</property>
<property name="internationalize">1</property>
<property name="name">dialog_choose_component_base</property>
<property name="namespace"></property>
<property name="path">.</property>
@ -90,7 +90,7 @@
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer1</property>
<property name="name">bSizerMain</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
@ -104,7 +104,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="0">
<property name="BottomDockable">1</property>
@ -134,7 +134,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Search</property>
<property name="label">Filter:</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -187,7 +187,7 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">1</property>
<object class="wxTextCtrl" expanded="0">
<property name="BottomDockable">1</property>
@ -386,7 +386,7 @@
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer3</property>
<property name="name">bSizerView</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
@ -562,41 +562,30 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_RIGHT</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<object class="wxStdDialogButtonSizer" expanded="0">
<property name="Apply">0</property>
<property name="Cancel">1</property>
<property name="ContextHelp">0</property>
<property name="Help">0</property>
<property name="No">0</property>
<property name="OK">1</property>
<property name="Save">0</property>
<property name="Yes">0</property>
<property name="minimum_size"></property>
<property name="name">bSizer5</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="0">
<property name="Apply">0</property>
<property name="Cancel">1</property>
<property name="ContextHelp">0</property>
<property name="Help">0</property>
<property name="No">0</property>
<property name="OK">1</property>
<property name="Save">0</property>
<property name="Yes">0</property>
<property name="minimum_size"></property>
<property name="name">m_button</property>
<property name="permission">protected</property>
<event name="OnApplyButtonClick"></event>
<event name="OnCancelButtonClick"></event>
<event name="OnContextHelpButtonClick"></event>
<event name="OnHelpButtonClick"></event>
<event name="OnNoButtonClick"></event>
<event name="OnOKButtonClick"></event>
<event name="OnSaveButtonClick"></event>
<event name="OnYesButtonClick"></event>
</object>
</object>
<property name="name">m_stdButtons</property>
<property name="permission">protected</property>
<event name="OnApplyButtonClick"></event>
<event name="OnCancelButtonClick"></event>
<event name="OnContextHelpButtonClick"></event>
<event name="OnHelpButtonClick"></event>
<event name="OnNoButtonClick"></event>
<event name="OnOKButtonClick"></event>
<event name="OnSaveButtonClick"></event>
<event name="OnYesButtonClick"></event>
</object>
</object>
</object>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Feb 22 2014)
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -10,6 +10,7 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
@ -42,9 +43,9 @@ class DIALOG_CHOOSE_COMPONENT_BASE : public DIALOG_SHIM
wxTreeCtrl* m_libraryComponentTree;
wxPanel* m_componentView;
wxTextCtrl* m_componentDetails;
wxStdDialogButtonSizer* m_button;
wxButton* m_buttonOK;
wxButton* m_buttonCancel;
wxStdDialogButtonSizer* m_stdButtons;
wxButton* m_stdButtonsOK;
wxButton* m_stdButtonsCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnInterceptSearchBoxKey( wxKeyEvent& event ) { event.Skip(); }

View File

@ -358,7 +358,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
msg.Printf( _( "Ready\nWorking dir: '%s'\n" ), GetChars( wxGetCwd() ) );
PrintMsg( msg );
LoadProjectFile( wxEmptyString, false );
LoadProjectFile( wxEmptyString, true );
// Clear (if needed) the current active library in libedit because it could be
// removed from memory

View File

@ -95,7 +95,7 @@ void COMPONENT::Format( OUTPUTFORMATTER* aOut, int aNestLevel, int aCtl )
int nl = aNestLevel;
aOut->Print( nl, "(ref %s ", aOut->Quotew( m_reference ).c_str() );
aOut->Print( 0, "(fpid %s)\n", m_fpid.Format().c_str() );
aOut->Print( 0, "(fpid %s)\n", aOut->Quotew( m_fpid.Format() ).c_str() );
if( ! ( aCtl & CTL_OMIT_EXTRA ) )
{