You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
2.6 KiB

18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
18 years ago
  1. /*************************/
  2. /* PCBNEW: main program */
  3. /*************************/
  4. #define MAIN
  5. #define eda_global
  6. #include "fctsys.h"
  7. #include <wx/image.h>
  8. #include <wx/file.h>
  9. #include "common.h"
  10. #include "pcbnew.h"
  11. #include "plot_common.h"
  12. #include "pcbplot.h"
  13. #include "autorout.h"
  14. #include "trigo.h"
  15. #include "cell.h"
  16. #include "worksheet.h"
  17. #include "zones.h"
  18. #include "protos.h"
  19. #include "drag.h"
  20. #include "eda_dde.h"
  21. wxString g_Main_Title( wxT( "PCBnew" ) );
  22. IMPLEMENT_APP( WinEDA_App )
  23. /****************************/
  24. bool WinEDA_App::OnInit()
  25. /****************************/
  26. {
  27. wxString FFileName;
  28. g_EDA_Appl = this;
  29. InitEDA_Appl( wxT( "pcbnew" ) );
  30. if( m_Checker && m_Checker->IsAnotherRunning() )
  31. {
  32. if( !IsOK( NULL, _( "Pcbnew is already running, Continue?" ) ) )
  33. return false;
  34. }
  35. ScreenPcb = new PCB_SCREEN();
  36. GetSettings();
  37. if( argc > 1 )
  38. {
  39. FFileName = MakeFileName( wxEmptyString, argv[1], PcbExtBuffer );
  40. wxSetWorkingDirectory( wxPathOnly( FFileName ) );
  41. }
  42. Read_Config( FFileName );
  43. g_DrawBgColor = BLACK;
  44. Read_Hotkey_Config( m_PcbFrame, false ); /* Must be called before creating the main frame
  45. * in order to display the real hotkeys
  46. * in menus or tool tips */
  47. /* allocation de la memoire pour le fichier et autres buffers: */
  48. /* On reserve BUFMEMSIZE octets de ram pour calcul */
  49. buf_work = adr_lowmem = (char*) MyZMalloc( BUFMEMSIZE ); /* adresse de la zone de calcul */
  50. adr_himem = adr_lowmem + BUFMEMSIZE; /* adr limite haute */
  51. adr_max = adr_lowmem;
  52. if( adr_lowmem == NULL )
  53. {
  54. printf( "No Memory, Fatal err Memory alloc\n" );
  55. return FALSE;
  56. }
  57. m_PcbFrame = new WinEDA_PcbFrame( NULL, this, wxT( "PcbNew" ),
  58. wxPoint( 0, 0 ), wxSize( 600, 400 ) );
  59. wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
  60. m_PcbFrame->SetTitle( Title );
  61. ActiveScreen = ScreenPcb;
  62. SetTopWindow( m_PcbFrame );
  63. m_PcbFrame->Show( TRUE );
  64. if( CreateServer( m_PcbFrame, KICAD_PCB_PORT_SERVICE_NUMBER ) )
  65. {
  66. SetupServerFunction( RemoteCommand );
  67. }
  68. m_PcbFrame->Zoom_Automatique( TRUE );
  69. /* Load file specified in the command line. */
  70. if( !FFileName.IsEmpty() )
  71. {
  72. m_PcbFrame->LoadOnePcbFile( FFileName, FALSE );
  73. // update the layer names in the listbox
  74. m_PcbFrame->ReCreateLayerBox( NULL );
  75. }
  76. return TRUE;
  77. }