load multiple files

This commit is contained in:
dickelbeck 2008-02-19 07:06:41 +00:00
parent 572c448796
commit c79c0d9c64
1 changed files with 56 additions and 42 deletions

View File

@ -24,14 +24,12 @@ IMPLEMENT_APP(WinEDA_App)
bool WinEDA_App::OnInit() bool WinEDA_App::OnInit()
{ {
wxString FFileName;
g_EDA_Appl = this; g_EDA_Appl = this;
InitEDA_Appl( wxT( "gerbview" ) ); InitEDA_Appl( wxT( "gerbview" ) );
if(argc > 1) FFileName = MakeFileName(wxEmptyString, argv[1], g_PhotoFilenameExt);
ScreenPcb = new PCB_SCREEN( PCB_FRAME ); ScreenPcb = new PCB_SCREEN( PCB_FRAME );
ActiveScreen = ScreenPcb; ActiveScreen = ScreenPcb;
GetSettings(); GetSettings();
if( m_Checker && m_Checker->IsAnotherRunning() ) if( m_Checker && m_Checker->IsAnotherRunning() )
@ -49,6 +47,7 @@ wxString FFileName;
m_GerberFrame = new WinEDA_GerberFrame( NULL, this, wxT( "GerbView" ), m_GerberFrame = new WinEDA_GerberFrame( NULL, this, wxT( "GerbView" ),
wxPoint( 0, 0 ), wxSize( 600, 400 ) ); wxPoint( 0, 0 ), wxSize( 600, 400 ) );
wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion(); wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
m_GerberFrame->SetTitle( Title ); m_GerberFrame->SetTitle( Title );
m_GerberFrame->m_Pcb = new BOARD( NULL, m_GerberFrame ); m_GerberFrame->m_Pcb = new BOARD( NULL, m_GerberFrame );
@ -57,24 +56,39 @@ wxString FFileName;
m_GerberFrame->Show( TRUE ); m_GerberFrame->Show( TRUE );
m_GerberFrame->m_Pcb = new BOARD( NULL, m_GerberFrame ); m_GerberFrame->m_Pcb = new BOARD( NULL, m_GerberFrame );
m_GerberFrame->Zoom_Automatique( TRUE ); m_GerberFrame->Zoom_Automatique( TRUE );
/* Load file specified in the command line. */ if( argc > 1 )
if( ! FFileName.IsEmpty() )
{ {
wxString path = wxPathOnly(FFileName); wxString fileName = MakeFileName( wxEmptyString, argv[1], g_PhotoFilenameExt );
wxSetWorkingDirectory(path);
Read_Config(); if( !fileName.IsEmpty() )
if ( wxFileExists(FFileName) )
{ {
wxClientDC dc( m_GerberFrame->DrawPanel ); wxClientDC dc( m_GerberFrame->DrawPanel );
m_GerberFrame->DrawPanel->PrepareGraphicContext( &dc ); m_GerberFrame->DrawPanel->PrepareGraphicContext( &dc );
m_GerberFrame->LoadOneGerberFile(FFileName, &dc, FALSE);
wxString path = wxPathOnly( fileName );
wxSetWorkingDirectory( path );
Read_Config();
// Load all files specified on the command line.
for( int i=1; i<argc; ++i )
{
fileName = MakeFileName( wxEmptyString, argv[i], g_PhotoFilenameExt );
if( wxFileExists( fileName ) )
{
((PCB_SCREEN*)m_GerberFrame->GetScreen())->m_Active_Layer = i-1;
m_GerberFrame->LoadOneGerberFile( fileName, &dc, FALSE );
} }
} }
else Read_Config(); }
}
else
Read_Config();
return TRUE; return TRUE;
} }