2008-12-08 15:27:13 +00:00
|
|
|
/*******************/
|
|
|
|
/* File: cvpcb.cpp */
|
|
|
|
/*******************/
|
2007-06-05 12:10:51 +00:00
|
|
|
#define MAIN
|
|
|
|
#define eda_global
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "appl_wxstruct.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "confirm.h"
|
|
|
|
#include "gestfich.h"
|
|
|
|
#include "id.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "cvpcb.h"
|
2008-10-20 05:59:58 +00:00
|
|
|
#include "zones.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "bitmaps.h"
|
|
|
|
#include "protos.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "cvstruct.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
#include <wx/snglinst.h>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-12-08 15:27:13 +00:00
|
|
|
wxString g_Main_Title = wxT( "CVpcb" );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
// Create a new application object
|
2008-12-08 15:27:13 +00:00
|
|
|
IMPLEMENT_APP( WinEDA_App )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
/* fonctions locales */
|
|
|
|
|
2008-12-08 15:27:13 +00:00
|
|
|
/************************************/
|
|
|
|
/* Called to initialize the program */
|
|
|
|
/************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
bool WinEDA_App::OnInit()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-12-08 15:27:13 +00:00
|
|
|
wxString msg;
|
|
|
|
wxString currCWD = wxGetCwd();
|
|
|
|
WinEDA_CvpcbFrame* frame = NULL;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-12-08 15:27:13 +00:00
|
|
|
InitEDA_Appl( wxT( "cvpcb" ) );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-12-08 15:27:13 +00:00
|
|
|
if( m_Checker && m_Checker->IsAnotherRunning() )
|
|
|
|
{
|
|
|
|
if( !IsOK( NULL, _( "Cvpcb is already running, Continue?" ) ) )
|
|
|
|
return false;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-12-08 15:27:13 +00:00
|
|
|
GetSettings(); // read current setup
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-12-08 15:27:13 +00:00
|
|
|
wxSetWorkingDirectory( currCWD ); // mofifie par GetSetting
|
|
|
|
SetRealLibraryPath( wxT( "modules" ) );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-12-08 15:27:13 +00:00
|
|
|
if( argc > 1 )
|
|
|
|
{
|
|
|
|
NetInNameBuffer = argv[1];
|
|
|
|
NetNameBuffer = argv[1];
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-12-08 15:27:13 +00:00
|
|
|
if( !NetInNameBuffer.IsEmpty() )
|
|
|
|
wxSetWorkingDirectory( wxPathOnly( NetInNameBuffer ) );
|
|
|
|
g_DrawBgColor = BLACK;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-12-08 15:27:13 +00:00
|
|
|
Read_Config( NetInNameBuffer );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-12-08 15:27:13 +00:00
|
|
|
wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
|
|
|
|
frame = new WinEDA_CvpcbFrame( Title );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-12-08 15:27:13 +00:00
|
|
|
msg.Printf( wxT( "Modules: %d" ), nblib );
|
|
|
|
frame->SetStatusText( msg, 2 );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-12-08 15:27:13 +00:00
|
|
|
// Show the frame
|
|
|
|
SetTopWindow( frame );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-12-08 15:27:13 +00:00
|
|
|
frame->Show( TRUE );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-12-08 15:27:13 +00:00
|
|
|
listlib();
|
|
|
|
frame->BuildFootprintListBox();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-12-08 15:27:13 +00:00
|
|
|
if( !NetInNameBuffer.IsEmpty() ) /* nom de fichier passe a la commande */
|
|
|
|
{
|
|
|
|
FFileName = MakeFileName( NetDirBuffer,
|
|
|
|
NetInNameBuffer, NetInExtBuffer );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-12-08 15:27:13 +00:00
|
|
|
frame->ReadNetListe();
|
|
|
|
}
|
|
|
|
else /* Mise a jour du titre de la fenetre principale */
|
|
|
|
{
|
|
|
|
wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
|
|
|
|
msg.Printf( wxT( "%s {%s%c} [no file]" ),
|
|
|
|
Title.GetData(), wxGetCwd().GetData(), DIR_SEP );
|
|
|
|
frame->SetTitle( msg );
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-12-08 15:27:13 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|