eeschema: problem when attempting to load a non existing file

This commit is contained in:
charras 2008-07-18 07:04:43 +00:00
parent 59c9f72ba2
commit e898427b52
4 changed files with 1043 additions and 347 deletions

View File

@ -80,6 +80,7 @@ bool WinEDA_App::OnInit()
SetupServerFunction( RemoteCommand );
}
ActiveScreen = m_SchematicFrame->GetScreen();
m_SchematicFrame->Zoom_Automatique( TRUE );
/* Load file specified in the command line. */
@ -93,7 +94,7 @@ bool WinEDA_App::OnInit()
}
else
{
Read_Config( wxEmptyString, TRUE ); // Read config file ici si pas de fichier a charger
Read_Config( wxEmptyString, TRUE ); // Read a default config file if no file to load
if( m_SchematicFrame->DrawPanel )
m_SchematicFrame->DrawPanel->Refresh( TRUE );
}

View File

@ -89,12 +89,14 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, bool IsNe
TRUE
);
if( FullFileName.IsEmpty() )
return FALSE;
return 0;
}
if(g_RootSheet){
if( g_RootSheet )
{
SAFE_DELETE( g_RootSheet );
}
CreateScreens();
ActiveScreen = GetScreen();
screen = (SCH_SCREEN*) GetScreen();
wxSetWorkingDirectory( wxPathOnly( FullFileName ) );
@ -106,6 +108,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, bool IsNe
memset( &g_EESchemaVar, 0, sizeof(g_EESchemaVar) );
GetScreen()->ClrModify();
//m_CurrentSheet->m_AssociatedScreen->Pnext = NULL; should be by default
if( IsNew )
@ -143,7 +146,8 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, bool IsNe
if( IsNew )
{
ReDrawPanel();
if( DrawPanel )
DrawPanel->Refresh( true );
return 1;
}
@ -173,6 +177,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, bool IsNe
if( !wxFileExists( g_RootSheet->m_AssociatedScreen->m_FileName ) && !LibCacheExist ) // Nouveau projet prpbablement
{
Zoom_Automatique( FALSE );
msg.Printf( _( "File %s not found (new project ?)" ),
g_RootSheet->m_AssociatedScreen->m_FileName.GetData() );
DisplayInfo( this, msg, 20 );
@ -187,16 +192,19 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName, bool IsNe
ActiveScreen = GetScreen();
Zoom_Automatique( FALSE );
SetSheetNumberAndCount();
DrawPanel->Refresh( TRUE );
DrawPanel->Refresh( true );
return diag;
}
/**********************************************************/
SCH_SCREEN* WinEDA_SchematicFrame::CreateNewScreen(
SCH_SCREEN* OldScreen, int TimeStamp )
/**********************************************************/
/* Routine de creation ( par allocation memoire ) d'un nouvel ecran
cet ecran est en chainage arriere avec OldScreen
la valeur TimeStamp est attribuee au parametre NewScreen->TimeStamp
* cet ecran est en chainage arriere avec OldScreen
* la valeur TimeStamp est attribuee au parametre NewScreen->TimeStamp
*/
{
SCH_SCREEN* NewScreen;
@ -204,14 +212,16 @@ SCH_SCREEN * WinEDA_SchematicFrame::CreateNewScreen(
NewScreen = new SCH_SCREEN( SCHEMATIC_FRAME );
NewScreen->SetRefreshReq();
if(OldScreen) NewScreen->m_Company = OldScreen->m_Company;
if( OldScreen )
NewScreen->m_Company = OldScreen->m_Company;
NewScreen->m_TimeStamp = TimeStamp;
NewScreen->Pback = OldScreen;
return(NewScreen);
return NewScreen;
}
/****************************************************/
void WinEDA_SchematicFrame::SaveProject()
/****************************************************/
@ -250,29 +260,30 @@ int CountCmpNumber()
* powers non comprises */
{
return g_RootSheet->ComponentCount();
/*
BASE_SCREEN* Window;
EDA_BaseStruct* Phead;
int Nb = 0;
Window = ScreenSch;
while( Window )
{
for( Phead = Window->EEDrawList; Phead != NULL; Phead = Phead->Pnext )
{
if( Phead->Type() == TYPE_SCH_COMPONENT )
{
DrawPartStruct* Cmp = (DrawPartStruct*) Phead;
if( Cmp->m_Field[VALUE].m_Text.GetChar( 0 ) != '#' )
Nb++;
}
}
Window = (BASE_SCREEN*) Window->Pnext;
}
return Nb;
* BASE_SCREEN* Window;
* EDA_BaseStruct* Phead;
* int Nb = 0;
*
*
*
* Window = ScreenSch;
* while( Window )
* {
* for( Phead = Window->EEDrawList; Phead != NULL; Phead = Phead->Pnext )
* {
* if( Phead->Type() == TYPE_SCH_COMPONENT )
* {
* DrawPartStruct* Cmp = (DrawPartStruct*) Phead;
* if( Cmp->m_Field[VALUE].m_Text.GetChar( 0 ) != '#' )
* Nb++;
* }
* }
*
* Window = (BASE_SCREEN*) Window->Pnext;
* }
*
* return Nb;
*/
}

Binary file not shown.

File diff suppressed because it is too large Load Diff