Pcbnew: fix bug1082146 (Keep-out areas get destroyed by "export settings to other zones" )

Eeschema: fix bug 1082107 (error message" component not found" when no component selected from select component dialog box)
This commit is contained in:
jean-pierre charras 2012-11-23 10:10:37 +01:00
parent eb3ba80643
commit 22645084bb
4 changed files with 37 additions and 7 deletions

View File

@ -121,7 +121,7 @@ wxString SCH_BASE_FRAME::SelectComponentFromLibrary( const wxString& aLibname,
DIALOG_GET_COMPONENT dlg( this, GetComponentDialogPosition(), aHistoryList,
msg, aUseLibBrowser );
if( aHistoryList.GetCount() )
if( aHistoryList.GetCount() )
dlg.SetComponentName( aHistoryList[0] );
if ( dlg.ShowModal() == wxID_CANCEL )
@ -144,6 +144,9 @@ wxString SCH_BASE_FRAME::SelectComponentFromLibrary( const wxString& aLibname,
if( cmpName.IsEmpty() )
return wxEmptyString;
// Here, cmpName contains the component name,
// or "*" if the Select All dialog button was pressed
#ifndef KICAD_KEEPCASE
cmpName.MakeUpper();
#endif
@ -175,7 +178,7 @@ wxString SCH_BASE_FRAME::SelectComponentFromLibrary( const wxString& aLibname,
libEntry = CMP_LIBRARY::FindLibraryComponent( cmpName, aLibname );
if( ( libEntry == NULL ) && allowWildSeach ) /* Search with wildcard */
if( ( libEntry == NULL ) && allowWildSeach ) // Search with wildcard
{
allowWildSeach = false;
wxString wildname = wxChar( '*' ) + cmpName + wxChar( '*' );
@ -191,7 +194,7 @@ wxString SCH_BASE_FRAME::SelectComponentFromLibrary( const wxString& aLibname,
if( libEntry == NULL )
{
msg = _( "Failed to find part " ) + cmpName + _( " in library" );
msg.Printf( _( "Failed to find part <%s> in library" ), GetChars( cmpName ) );
DisplayError( this, msg );
return wxEmptyString;
}

View File

@ -79,7 +79,7 @@ int GetNameOfPartToLoad( EDA_DRAW_FRAME* frame, CMP_LIBRARY* Library, wxString&
static wxString OldCmpName;
ii = DisplayComponentsNamesInLib( frame, Library, BufName, OldCmpName );
if( ii <= 0 )
if( ii <= 0 || BufName.IsEmpty() )
return 0;
OldCmpName = BufName;

View File

@ -641,6 +641,8 @@ void ZONE_CONTAINER::DisplayInfo( EDA_DRAW_FRAME* frame )
msg = _( "Zone Outline" );
// Display Cutout instead of Outline for holes inside a zone
// i.e. when num contour !=0
int ncont = m_Poly->GetContour( m_CornerSelection );
if( ncont )
@ -648,7 +650,27 @@ void ZONE_CONTAINER::DisplayInfo( EDA_DRAW_FRAME* frame )
frame->AppendMsgPanel( _( "Type" ), msg, DARKCYAN );
if( IsOnCopperLayer() )
if( GetIsKeepout() )
{
msg.Empty();
if( GetDoNotAllowVias() )
msg = _("No via");
if( GetDoNotAllowTracks() )
{
if( !msg.IsEmpty() )
msg += wxT(", ");
msg += _("No track");
}
if( GetDoNotAllowCopperPour() )
{
if( !msg.IsEmpty() )
msg += wxT(", ");
msg += _("No copper pour");
}
frame->AppendMsgPanel( _( "Keepout" ), msg, RED );
}
else if( IsOnCopperLayer() )
{
if( GetNet() >= 0 )
{

View File

@ -37,7 +37,7 @@
#include <zones.h>
#include <base_units.h>
#include <class_zone_settings.h>
#include <class_zone.h>
#include <class_board.h>
#include <dialog_copper_zones_base.h>
@ -545,11 +545,16 @@ void DIALOG_COPPER_ZONE::ExportSetupToOtherCopperZones( wxCommandEvent& event )
if( !AcceptOptions( true, true ) )
return;
// Export settings ( but layer and netcode ) to others zones:
// Export settings ( but layer and netcode ) to others copper zones
BOARD* pcb = m_Parent->GetBoard();
for( int ii = 0; ii < pcb->GetAreaCount(); ii++ )
{
ZONE_CONTAINER* zone = pcb->GetArea( ii );
// Cannot export settings from a copper zone
// to a zone keepout:
if( zone->GetIsKeepout() )
continue;
m_settings.ExportSetting( *zone, false ); // false = partial export
m_Parent->OnModify();
}