2007-06-05 12:10:51 +00:00
|
|
|
/************************************************/
|
|
|
|
/* GERBVIEW main file */
|
|
|
|
/************************************************/
|
|
|
|
|
|
|
|
#define MAIN
|
|
|
|
#define eda_global
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
|
|
|
|
#include <wx/image.h>
|
|
|
|
#include <wx/file.h>
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
#include "gerbview.h"
|
|
|
|
#include "pcbplot.h"
|
|
|
|
#include "trigo.h"
|
|
|
|
#include "bitmaps.h"
|
|
|
|
#include "protos.h"
|
|
|
|
|
|
|
|
|
2007-06-22 08:13:42 +00:00
|
|
|
wxString g_Main_Title = wxT("GerbView");
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
IMPLEMENT_APP(WinEDA_App)
|
|
|
|
|
|
|
|
bool WinEDA_App::OnInit(void)
|
|
|
|
{
|
|
|
|
wxString FFileName;
|
|
|
|
|
|
|
|
EDA_Appl = this;
|
|
|
|
InitEDA_Appl( wxT("gerbview") );
|
|
|
|
|
|
|
|
if(argc > 1) FFileName = MakeFileName(wxEmptyString, argv[1], g_PhotoFilenameExt);
|
|
|
|
|
|
|
|
ScreenPcb = new PCB_SCREEN(PCB_FRAME);
|
|
|
|
ActiveScreen = ScreenPcb;
|
|
|
|
GetSettings();
|
|
|
|
if ( m_Checker && m_Checker->IsAnotherRunning() )
|
|
|
|
{
|
2007-06-22 08:13:42 +00:00
|
|
|
if ( ! IsOK(NULL, _("GerbView is already running. Continue?") ) )
|
2007-06-05 12:10:51 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
g_DrawBgColor = BLACK;
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
SetTopWindow(m_GerberFrame);
|
|
|
|
m_GerberFrame->Show(TRUE);
|
|
|
|
|
|
|
|
m_GerberFrame->m_Pcb = new BOARD(NULL, m_GerberFrame);
|
|
|
|
m_GerberFrame->Zoom_Automatique(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();
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|