From c79c0d9c6430d69fa26eb2df3c0cc15c304ce2a2 Mon Sep 17 00:00:00 2001 From: dickelbeck Date: Tue, 19 Feb 2008 07:06:41 +0000 Subject: [PATCH] load multiple files --- gerbview/gerbview.cpp | 98 ++++++++++++++++++++++++------------------- 1 file changed, 56 insertions(+), 42 deletions(-) diff --git a/gerbview/gerbview.cpp b/gerbview/gerbview.cpp index 02176607ba..8289cf3037 100644 --- a/gerbview/gerbview.cpp +++ b/gerbview/gerbview.cpp @@ -1,6 +1,6 @@ - /************************************************/ - /* GERBVIEW main file */ - /************************************************/ +/************************************************/ +/* GERBVIEW main file */ +/************************************************/ #define MAIN #define eda_global @@ -18,63 +18,77 @@ #include "protos.h" -wxString g_Main_Title = wxT("GerbView"); +wxString g_Main_Title = wxT( "GerbView" ); -IMPLEMENT_APP(WinEDA_App) +IMPLEMENT_APP( WinEDA_App ) 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; - GetSettings(); - if ( m_Checker && m_Checker->IsAnotherRunning() ) + ActiveScreen = ScreenPcb; + GetSettings(); + if( m_Checker && m_Checker->IsAnotherRunning() ) { - if ( ! IsOK(NULL, _("GerbView is already running. Continue?") ) ) - return false; + if( !IsOK( NULL, _( "GerbView is already running. Continue?" ) ) ) + return false; } - g_DrawBgColor = BLACK; + g_DrawBgColor = BLACK; Read_Hotkey_Config( m_PcbFrame, false ); /* Must be called before creating the main frame * in order to display the real hotkeys * in menus or tool tips */ - m_GerberFrame = new WinEDA_GerberFrame(NULL, this, wxT("GerbView"), - wxPoint(0,0), wxSize(600,400) ); - wxString Title = g_Main_Title + wxT(" ") + GetBuildVersion(); - m_GerberFrame->SetTitle(Title); - m_GerberFrame->m_Pcb = new BOARD(NULL, m_GerberFrame); + m_GerberFrame = new WinEDA_GerberFrame( NULL, this, wxT( "GerbView" ), + wxPoint( 0, 0 ), wxSize( 600, 400 ) ); - SetTopWindow(m_GerberFrame); - m_GerberFrame->Show(TRUE); + wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion(); + m_GerberFrame->SetTitle( Title ); + m_GerberFrame->m_Pcb = new BOARD( NULL, m_GerberFrame ); - m_GerberFrame->m_Pcb = new BOARD(NULL, m_GerberFrame); - m_GerberFrame->Zoom_Automatique(TRUE); + SetTopWindow( m_GerberFrame ); + m_GerberFrame->Show( TRUE ); - /* Load file specified in the command line. */ - if( ! FFileName.IsEmpty() ) - { - wxString path = wxPathOnly(FFileName); - wxSetWorkingDirectory(path); - Read_Config(); - if ( wxFileExists(FFileName) ) - { - wxClientDC dc(m_GerberFrame->DrawPanel); - m_GerberFrame->DrawPanel->PrepareGraphicContext(&dc); - m_GerberFrame->LoadOneGerberFile(FFileName, &dc, FALSE); - } - } - else Read_Config(); + m_GerberFrame->m_Pcb = new BOARD( NULL, m_GerberFrame ); - return TRUE; + m_GerberFrame->Zoom_Automatique( TRUE ); + + if( argc > 1 ) + { + wxString fileName = MakeFileName( wxEmptyString, argv[1], g_PhotoFilenameExt ); + + if( !fileName.IsEmpty() ) + { + wxClientDC dc( m_GerberFrame->DrawPanel ); + m_GerberFrame->DrawPanel->PrepareGraphicContext( &dc ); + + wxString path = wxPathOnly( fileName ); + + wxSetWorkingDirectory( path ); + + Read_Config(); + + // Load all files specified on the command line. + for( int i=1; iGetScreen())->m_Active_Layer = i-1; + m_GerberFrame->LoadOneGerberFile( fileName, &dc, FALSE ); + } + } + } + } + else + Read_Config(); + + return TRUE; } - -