2007-08-04 00:47:36 +00:00
|
|
|
/*************************/
|
|
|
|
/* PCBNEW: main program */
|
|
|
|
/*************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#define MAIN
|
|
|
|
#define eda_global
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
|
|
|
|
#include <wx/file.h>
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
#include "pcbnew.h"
|
2008-08-06 07:46:03 +00:00
|
|
|
#include "plot_common.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "pcbplot.h"
|
|
|
|
#include "autorout.h"
|
|
|
|
#include "trigo.h"
|
|
|
|
#include "cell.h"
|
|
|
|
#include "worksheet.h"
|
2008-09-26 19:51:36 +00:00
|
|
|
#include "zones.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "protos.h"
|
|
|
|
|
|
|
|
#include "drag.h"
|
|
|
|
|
|
|
|
#include "eda_dde.h"
|
|
|
|
|
2008-08-17 10:10:20 +00:00
|
|
|
wxString g_Main_Title( wxT( "PCBnew" ) );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-04 00:47:36 +00:00
|
|
|
IMPLEMENT_APP( WinEDA_App )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
/****************************/
|
2007-09-01 12:00:30 +00:00
|
|
|
bool WinEDA_App::OnInit()
|
2007-06-05 12:10:51 +00:00
|
|
|
/****************************/
|
|
|
|
{
|
2008-12-08 15:27:13 +00:00
|
|
|
wxString FFileName;
|
|
|
|
WinEDA_PcbFrame* frame = NULL;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-04 00:47:36 +00:00
|
|
|
InitEDA_Appl( wxT( "pcbnew" ) );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-04 00:47:36 +00:00
|
|
|
if( m_Checker && m_Checker->IsAnotherRunning() )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-04 00:47:36 +00:00
|
|
|
if( !IsOK( NULL, _( "Pcbnew is already running, Continue?" ) ) )
|
|
|
|
return false;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-12-05 16:03:05 +00:00
|
|
|
ScreenPcb = new PCB_SCREEN();
|
2007-08-04 00:47:36 +00:00
|
|
|
GetSettings();
|
|
|
|
|
|
|
|
if( argc > 1 )
|
|
|
|
{
|
|
|
|
FFileName = MakeFileName( wxEmptyString, argv[1], PcbExtBuffer );
|
|
|
|
wxSetWorkingDirectory( wxPathOnly( FFileName ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
Read_Config( FFileName );
|
|
|
|
g_DrawBgColor = BLACK;
|
2008-12-08 15:27:13 +00:00
|
|
|
Read_Hotkey_Config( frame, false ); /* Must be called before creating the
|
|
|
|
* main frame in order to display the
|
|
|
|
* real hotkeys in menus or tool tips */
|
2007-08-30 08:15:05 +00:00
|
|
|
|
2007-08-04 00:47:36 +00:00
|
|
|
|
|
|
|
/* allocation de la memoire pour le fichier et autres buffers: */
|
|
|
|
/* On reserve BUFMEMSIZE octets de ram pour calcul */
|
|
|
|
buf_work = adr_lowmem = (char*) MyZMalloc( BUFMEMSIZE ); /* adresse de la zone de calcul */
|
|
|
|
adr_himem = adr_lowmem + BUFMEMSIZE; /* adr limite haute */
|
|
|
|
adr_max = adr_lowmem;
|
|
|
|
|
|
|
|
if( adr_lowmem == NULL )
|
|
|
|
{
|
|
|
|
printf( "No Memory, Fatal err Memory alloc\n" );
|
|
|
|
return FALSE;
|
|
|
|
}
|
2008-12-08 15:27:13 +00:00
|
|
|
frame = new WinEDA_PcbFrame( NULL, wxT( "PcbNew" ),
|
|
|
|
wxPoint( 0, 0 ), wxSize( 600, 400 ) );
|
2007-08-04 00:47:36 +00:00
|
|
|
wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
|
2008-12-08 15:27:13 +00:00
|
|
|
frame->SetTitle( Title );
|
|
|
|
ActiveScreen = ScreenPcb;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-12-08 15:27:13 +00:00
|
|
|
SetTopWindow( frame );
|
|
|
|
frame->Show( TRUE );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-12-08 15:27:13 +00:00
|
|
|
if( CreateServer( frame, KICAD_PCB_PORT_SERVICE_NUMBER ) )
|
2007-08-04 00:47:36 +00:00
|
|
|
{
|
|
|
|
SetupServerFunction( RemoteCommand );
|
|
|
|
}
|
|
|
|
|
2008-12-08 15:27:13 +00:00
|
|
|
frame->Zoom_Automatique( TRUE );
|
2007-08-04 00:47:36 +00:00
|
|
|
|
|
|
|
/* Load file specified in the command line. */
|
|
|
|
if( !FFileName.IsEmpty() )
|
|
|
|
{
|
2008-12-08 15:27:13 +00:00
|
|
|
frame->LoadOnePcbFile( FFileName, FALSE );
|
2008-04-29 15:43:28 +00:00
|
|
|
|
|
|
|
// update the layer names in the listbox
|
2008-12-08 15:27:13 +00:00
|
|
|
frame->ReCreateLayerBox( NULL );
|
2007-08-04 00:47:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|