2011-10-13 19:56:32 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2012-06-08 09:56:42 +00:00
|
|
|
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
|
|
|
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
|
|
|
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-10-13 19:56:32 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2011-09-26 20:32:56 +00:00
|
|
|
/**
|
|
|
|
* @file pcbnew.cpp
|
2011-09-30 18:15:37 +00:00
|
|
|
* @brief Pcbnew main program.
|
2011-09-26 20:32:56 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-07-16 05:53:22 +00:00
|
|
|
#ifdef KICAD_SCRIPTING
|
2012-08-02 07:47:30 +00:00
|
|
|
#include <python_scripting.h>
|
2012-04-23 06:59:37 +00:00
|
|
|
#include <pcbnew_scripting_helpers.h>
|
2012-07-16 05:53:22 +00:00
|
|
|
#endif
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <appl_wxstruct.h>
|
|
|
|
#include <confirm.h>
|
|
|
|
#include <macros.h>
|
|
|
|
#include <class_drawpanel.h>
|
|
|
|
#include <wxPcbStruct.h>
|
|
|
|
#include <eda_dde.h>
|
|
|
|
#include <pcbcommon.h>
|
|
|
|
#include <colors_selection.h>
|
|
|
|
#include <gr_basic.h>
|
2014-02-08 10:44:55 +00:00
|
|
|
#include <3d_viewer.h>
|
2014-02-07 18:53:54 +00:00
|
|
|
#include <wx/stdpaths.h>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include <wx/file.h>
|
2009-02-04 15:25:03 +00:00
|
|
|
#include <wx/snglinst.h>
|
2013-05-20 14:49:20 +00:00
|
|
|
#include <wx/dir.h>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <pcbnew.h>
|
|
|
|
#include <protos.h>
|
|
|
|
#include <hotkeys.h>
|
2012-02-16 20:03:33 +00:00
|
|
|
#include <wildcards_and_files_ext.h>
|
2012-03-01 07:21:53 +00:00
|
|
|
#include <class_board.h>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-08-01 11:54:20 +00:00
|
|
|
|
2010-01-29 20:36:12 +00:00
|
|
|
// Colors for layers and items
|
|
|
|
COLORS_DESIGN_SETTINGS g_ColorsSettings;
|
|
|
|
|
2013-03-27 18:32:12 +00:00
|
|
|
bool g_Drc_On = true;
|
2010-04-28 14:06:14 +00:00
|
|
|
bool g_AutoDeleteOldTrack = true;
|
|
|
|
bool g_Show_Module_Ratsnest;
|
|
|
|
bool g_Raccord_45_Auto = true;
|
2010-06-16 15:01:45 +00:00
|
|
|
bool g_Alternate_Track_Posture = false;
|
2010-05-01 09:22:12 +00:00
|
|
|
bool g_Track_45_Only_Allowed = true; // True to allow horiz, vert. and 45deg only tracks
|
2013-05-08 20:47:23 +00:00
|
|
|
bool g_Segments_45_Only; // True to allow horiz, vert. and 45deg only graphic segments
|
2010-04-28 14:06:14 +00:00
|
|
|
bool g_TwoSegmentTrackBuild = true;
|
|
|
|
|
2013-03-31 13:27:46 +00:00
|
|
|
LAYER_NUM g_Route_Layer_TOP;
|
|
|
|
LAYER_NUM g_Route_Layer_BOTTOM;
|
2010-04-28 14:06:14 +00:00
|
|
|
int g_MaxLinksShowed;
|
|
|
|
int g_MagneticPadOption = capture_cursor_in_track_tool;
|
|
|
|
int g_MagneticTrackOption = capture_cursor_in_track_tool;
|
|
|
|
|
2011-09-26 20:32:56 +00:00
|
|
|
wxPoint g_Offset_Module; /* Distance to offset module trace when moving. */
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2009-04-19 15:03:48 +00:00
|
|
|
/* Name of the document footprint list
|
|
|
|
* usually located in share/modules/footprints_doc
|
2010-04-28 14:06:14 +00:00
|
|
|
* this is of the responsibility to users to create this file
|
2009-04-19 15:03:48 +00:00
|
|
|
* if they want to have a list of footprints
|
|
|
|
*/
|
2013-05-08 20:47:23 +00:00
|
|
|
wxString g_DocModulesFileName = wxT( "footprints_doc/footprints.pdf" );
|
2009-04-19 15:03:48 +00:00
|
|
|
|
2012-08-01 11:54:20 +00:00
|
|
|
// wxWindow* DoPythonStuff(wxWindow* parent); // declaration
|
2011-09-27 20:43:18 +00:00
|
|
|
|
2011-09-06 14:09:40 +00:00
|
|
|
IMPLEMENT_APP( EDA_APP )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-09-26 20:32:56 +00:00
|
|
|
|
2010-01-16 19:42:58 +00:00
|
|
|
/* MacOSX: Needed for file association
|
2010-01-24 13:46:01 +00:00
|
|
|
* http://wiki.wxwidgets.org/WxMac-specific_topics
|
2010-01-16 19:42:58 +00:00
|
|
|
*/
|
2014-02-03 15:10:37 +00:00
|
|
|
void EDA_APP::MacOpenFile( const wxString& aFileName )
|
2010-02-24 18:36:01 +00:00
|
|
|
{
|
2011-03-01 19:26:17 +00:00
|
|
|
PCB_EDIT_FRAME* frame = ( (PCB_EDIT_FRAME*) GetTopWindow() );
|
2014-02-03 15:10:37 +00:00
|
|
|
wxFileName filename = aFileName;
|
2010-02-24 15:33:03 +00:00
|
|
|
|
2010-02-24 18:36:01 +00:00
|
|
|
if( !filename.FileExists() )
|
2010-02-21 20:23:16 +00:00
|
|
|
return;
|
|
|
|
|
2014-02-03 15:10:37 +00:00
|
|
|
frame->LoadOnePcbFile( aFileName, false );
|
2010-01-16 19:42:58 +00:00
|
|
|
}
|
|
|
|
|
2013-05-08 20:47:23 +00:00
|
|
|
|
2011-09-06 14:09:40 +00:00
|
|
|
bool EDA_APP::OnInit()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2011-03-01 19:26:17 +00:00
|
|
|
wxFileName fn;
|
|
|
|
PCB_EDIT_FRAME* frame = NULL;
|
2013-05-08 20:47:23 +00:00
|
|
|
wxString msg;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2013-07-19 18:27:22 +00:00
|
|
|
InitEDA_Appl( wxT( "Pcbnew" ), APP_PCBNEW_T );
|
|
|
|
|
2012-09-11 07:33:17 +00:00
|
|
|
#ifdef KICAD_SCRIPTING
|
2013-07-19 18:27:22 +00:00
|
|
|
msg.Empty();
|
|
|
|
#ifdef __WINDOWS__
|
2013-11-01 13:02:10 +00:00
|
|
|
// force python environment under Windows:
|
|
|
|
const wxString python_us("python27_us");
|
|
|
|
|
|
|
|
// Build our python path inside kicad
|
|
|
|
wxString kipython = m_BinDir + python_us;
|
|
|
|
|
|
|
|
// If our python install is existing inside kicad, use it
|
|
|
|
if( wxDirExists( kipython ) )
|
|
|
|
{
|
|
|
|
wxString ppath;
|
|
|
|
if( !wxGetEnv( wxT( "PYTHONPATH" ), &ppath ) || !ppath.Contains( python_us ) )
|
|
|
|
{
|
|
|
|
ppath << kipython << wxT("/pylib;");
|
|
|
|
ppath << kipython << wxT("/lib;");
|
|
|
|
ppath << kipython << wxT("/dll");
|
|
|
|
wxSetEnv( wxT( "PYTHONPATH" ), ppath );
|
|
|
|
DBG( std::cout << "set PYTHONPATH to " << TO_UTF8(ppath) << "\n"; )
|
|
|
|
|
|
|
|
// Add python executable path:
|
|
|
|
wxGetEnv( wxT( "PATH" ), &ppath );
|
|
|
|
if( !ppath.Contains( python_us ) )
|
|
|
|
{
|
|
|
|
kipython << wxT(";") << ppath;
|
|
|
|
wxSetEnv( wxT( "PATH" ), kipython );
|
|
|
|
DBG( std::cout << "set PATH to " << TO_UTF8(kipython) << "\n"; )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-19 18:27:22 +00:00
|
|
|
// TODO: make this path definable by the user, and set more than one path
|
|
|
|
// (and remove the fixed paths from <src>/scripting/kicadplugins.i)
|
|
|
|
|
|
|
|
// wizard plugins are stored in kicad/bin/plugins.
|
|
|
|
// so add this path to python scripting defualt search paths
|
|
|
|
// which are ( [KICAD_PATH] is an environment variable to define)
|
|
|
|
// [KICAD_PATH]/scripting/plugins
|
|
|
|
// Add this default search path:
|
|
|
|
msg = wxGetApp().GetExecutablePath() + wxT("scripting/plugins");
|
|
|
|
#else
|
|
|
|
// Add this default search path:
|
|
|
|
msg = wxT("/usr/local/kicad/bin/scripting/plugins");
|
2014-02-07 19:19:53 +00:00
|
|
|
|
|
|
|
#ifdef __WXMAC__
|
2014-02-07 18:53:54 +00:00
|
|
|
// OSX
|
|
|
|
// System Library first
|
|
|
|
// User Library then
|
|
|
|
// (TODO) Bundle package ? where to place ? Shared Support ?
|
|
|
|
msg = wxT("/Library/Application Support/kicad/scripting");
|
|
|
|
msg = wxString( wxGetenv("HOME") ) + wxT("/Library/Application Support/kicad/scripting");
|
|
|
|
|
|
|
|
// Get pcbnew.app/Contents directory
|
|
|
|
wxFileName bundledir( wxStandardPaths::Get().GetExecutablePath() ) ;
|
|
|
|
bundledir.RemoveLastDir();
|
|
|
|
|
|
|
|
// Prepend in PYTHONPATH the content of the bundle libraries !
|
2014-02-14 21:09:48 +00:00
|
|
|
wxSetEnv("PYTHONPATH",((wxGetenv("PYTHONPATH") != NULL ) ? (wxString(wxGetenv("PYTHONPATH")) + ":") : wxString("")) +
|
|
|
|
bundledir.GetPath() +
|
2014-02-15 10:01:27 +00:00
|
|
|
"/Frameworks/wxPython/lib/python2.6/site-packages/wx-3.0-osx_cocoa" + ":" +
|
|
|
|
"/Library/Application Support/kicad/" + ":" +
|
|
|
|
bundledir.GetPath() + "/PlugIns" + ":" +
|
|
|
|
wxString( wxGetenv("HOME") ) + "/Library/Application Support/kicad/"
|
2014-02-14 21:09:48 +00:00
|
|
|
);
|
2014-02-08 10:44:55 +00:00
|
|
|
#endif
|
2013-07-19 18:27:22 +00:00
|
|
|
#endif
|
|
|
|
// On linux and osx, 2 others paths are
|
|
|
|
// [HOME]/.kicad_plugins/
|
|
|
|
// [HOME]/.kicad/scripting/plugins/
|
|
|
|
if ( !pcbnewInitPythonScripting( TO_UTF8(msg) ) )
|
2012-08-01 11:54:20 +00:00
|
|
|
{
|
2012-12-16 13:48:54 +00:00
|
|
|
wxMessageBox( wxT( "pcbnewInitPythonScripting() fails" ) );
|
|
|
|
return false;
|
2012-08-01 11:54:20 +00:00
|
|
|
}
|
2012-09-11 07:33:17 +00:00
|
|
|
#endif
|
|
|
|
|
2007-08-04 00:47:36 +00:00
|
|
|
if( argc > 1 )
|
|
|
|
{
|
2009-04-05 20:49:15 +00:00
|
|
|
fn = argv[1];
|
|
|
|
|
2013-03-11 19:30:58 +00:00
|
|
|
// Be sure the filename is absolute, to avoid issues
|
|
|
|
// when the filename is relative,
|
|
|
|
// for instance when stored in history list without path,
|
|
|
|
// and when building the config filename ( which should have a path )
|
|
|
|
if( fn.IsRelative() )
|
|
|
|
fn.MakeAbsolute();
|
|
|
|
|
2012-12-16 13:48:54 +00:00
|
|
|
if( fn.GetExt() != PcbFileExtension && fn.GetExt() != LegacyPcbFileExtension )
|
2009-04-05 20:49:15 +00:00
|
|
|
{
|
2013-05-08 20:47:23 +00:00
|
|
|
msg.Printf( _( "Pcbnew file <%s> has a wrong extension.\n"
|
|
|
|
"Changing extension to .%s." ),
|
|
|
|
GetChars( fn.GetFullPath() ),
|
|
|
|
GetChars( PcbFileExtension ) );
|
2010-05-17 20:35:46 +00:00
|
|
|
fn.SetExt( PcbFileExtension );
|
2012-12-16 13:48:54 +00:00
|
|
|
wxMessageBox( msg );
|
2009-04-05 20:49:15 +00:00
|
|
|
}
|
|
|
|
|
2013-01-04 17:47:59 +00:00
|
|
|
if( !wxGetApp().LockFile( fn.GetFullPath() ) )
|
|
|
|
{
|
|
|
|
DisplayError( NULL, _( "This file is already open." ) );
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( m_Checker && m_Checker->IsAnotherRunning() )
|
|
|
|
{
|
|
|
|
if( !IsOK( NULL, _( "Pcbnew is already running, Continue?" ) ) )
|
|
|
|
return false;
|
2007-08-04 00:47:36 +00:00
|
|
|
}
|
|
|
|
|
2013-01-04 17:47:59 +00:00
|
|
|
// read current setup and reopen last directory if no filename to open in command line
|
|
|
|
bool reopenLastUsedDirectory = argc == 1;
|
|
|
|
GetSettings( reopenLastUsedDirectory );
|
|
|
|
|
|
|
|
if( fn.IsOk() && fn.DirExists() )
|
|
|
|
wxSetWorkingDirectory( fn.GetPath() );
|
|
|
|
|
2007-08-04 00:47:36 +00:00
|
|
|
g_DrawBgColor = BLACK;
|
2007-08-30 08:15:05 +00:00
|
|
|
|
2011-08-26 17:01:17 +00:00
|
|
|
/* Must be called before creating the main frame in order to
|
|
|
|
* display the real hotkeys in menus or tool tips */
|
2011-09-26 20:32:56 +00:00
|
|
|
ReadHotkeyConfig( wxT( "PcbFrame" ), g_Board_Editor_Hokeys_Descr );
|
2007-08-04 00:47:36 +00:00
|
|
|
|
2013-10-13 21:33:58 +00:00
|
|
|
// Set any environment variables before loading FP_LIB_TABLE
|
|
|
|
SetFootprintLibTablePath();
|
|
|
|
|
2014-02-08 10:44:55 +00:00
|
|
|
// Set 3D shape path from environment variable KISYS3DMOD
|
|
|
|
Set3DShapesPath( wxT(KISYS3DMOD) );
|
|
|
|
|
2011-09-30 18:15:37 +00:00
|
|
|
frame = new PCB_EDIT_FRAME( NULL, wxT( "Pcbnew" ), wxPoint( 0, 0 ), wxSize( 600, 400 ) );
|
2012-03-17 15:17:13 +00:00
|
|
|
|
2014-02-03 15:10:37 +00:00
|
|
|
#ifdef KICAD_SCRIPTING
|
2012-03-18 09:09:51 +00:00
|
|
|
ScriptingSetPcbEditFrame(frame); /* give the scripting helpers access to our frame */
|
2014-02-03 15:10:37 +00:00
|
|
|
#endif
|
2012-09-11 07:33:17 +00:00
|
|
|
|
2011-08-26 17:01:17 +00:00
|
|
|
frame->UpdateTitle();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-12-08 15:27:13 +00:00
|
|
|
SetTopWindow( frame );
|
2009-10-01 16:46:13 +00:00
|
|
|
frame->Show( true );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2014-01-08 14:18:51 +00:00
|
|
|
CreateServer( frame, KICAD_PCB_PORT_SERVICE_NUMBER );
|
2007-08-04 00:47:36 +00:00
|
|
|
|
2009-10-01 16:46:13 +00:00
|
|
|
frame->Zoom_Automatique( true );
|
|
|
|
|
2012-03-06 14:08:59 +00:00
|
|
|
// Load config and default values before loading a board file
|
|
|
|
// Some will be overwritten after loading the board file
|
|
|
|
frame->LoadProjectSettings( fn.GetFullPath() );
|
|
|
|
|
2007-08-04 00:47:36 +00:00
|
|
|
/* Load file specified in the command line. */
|
2009-04-05 20:49:15 +00:00
|
|
|
if( fn.IsOk() )
|
2007-08-04 00:47:36 +00:00
|
|
|
{
|
2011-09-30 18:15:37 +00:00
|
|
|
/* Note the first time Pcbnew is called after creating a new project
|
|
|
|
* the board file may not exist so we load settings only.
|
2012-12-15 13:39:36 +00:00
|
|
|
* However, because legacy board files are named *.brd,
|
|
|
|
* and new files are named *.kicad_pcb,
|
|
|
|
* for all previous projects ( before 2012, december 14 ),
|
2012-12-16 13:48:54 +00:00
|
|
|
* because KiCad manager ask to load a .kicad_pcb file
|
2012-12-15 13:39:36 +00:00
|
|
|
* if this file does not exist, it is certainly useful
|
|
|
|
* to test if a legacy file is existing,
|
|
|
|
* under the same name, and therefore if the user want to load it
|
2011-08-26 17:01:17 +00:00
|
|
|
*/
|
2012-12-15 13:39:36 +00:00
|
|
|
bool file_exists = false;
|
|
|
|
|
2010-05-30 09:46:37 +00:00
|
|
|
if( fn.FileExists() )
|
2011-09-06 14:09:40 +00:00
|
|
|
{
|
2012-12-15 13:39:36 +00:00
|
|
|
file_exists = true;
|
2010-05-30 09:46:37 +00:00
|
|
|
frame->LoadOnePcbFile( fn.GetFullPath() );
|
2011-09-06 14:09:40 +00:00
|
|
|
}
|
2012-12-15 13:39:36 +00:00
|
|
|
else if( fn.GetExt() == KiCadPcbFileExtension )
|
|
|
|
{
|
|
|
|
// Try to find a legacy file with the same name:
|
|
|
|
wxFileName fn_legacy = fn;
|
|
|
|
fn_legacy.SetExt( LegacyPcbFileExtension );
|
2013-05-08 20:47:23 +00:00
|
|
|
|
2012-12-15 13:39:36 +00:00
|
|
|
if( fn_legacy.FileExists() )
|
|
|
|
{
|
2013-05-08 20:47:23 +00:00
|
|
|
msg.Printf( _( "File <%s> does not exist.\n"
|
|
|
|
"However a legacy file <%s> exists.\n"
|
|
|
|
"Do you want to load it?\n"
|
|
|
|
"It will be saved under the new file format." ),
|
2012-12-15 13:39:36 +00:00
|
|
|
GetChars( fn.GetFullPath() ),
|
|
|
|
GetChars( fn_legacy.GetFullPath() ) );
|
2013-05-08 20:47:23 +00:00
|
|
|
|
2012-12-15 13:39:36 +00:00
|
|
|
if( IsOK( frame, msg ) )
|
|
|
|
{
|
|
|
|
file_exists = true;
|
|
|
|
frame->LoadOnePcbFile( fn_legacy.GetFullPath() );
|
|
|
|
wxString filename = fn.GetFullPath();
|
|
|
|
filename.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
|
|
|
frame->GetBoard()->SetFileName( filename );
|
|
|
|
frame->UpdateTitle();
|
2013-05-08 20:47:23 +00:00
|
|
|
frame->OnModify(); // Ready to save the board under the new format
|
2012-12-15 13:39:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( ! file_exists )
|
2014-02-03 15:10:37 +00:00
|
|
|
{
|
|
|
|
// File does not exists: prepare an empty board
|
2012-12-16 13:48:54 +00:00
|
|
|
if( ! fn.GetPath().IsEmpty() )
|
|
|
|
wxSetWorkingDirectory( fn.GetPath() );
|
2013-05-08 20:47:23 +00:00
|
|
|
|
2012-08-29 16:59:50 +00:00
|
|
|
frame->GetBoard()->SetFileName( fn.GetFullPath( wxPATH_UNIX ) );
|
2011-08-26 17:01:17 +00:00
|
|
|
frame->UpdateTitle();
|
2012-08-29 16:59:50 +00:00
|
|
|
frame->UpdateFileHistory( frame->GetBoard()->GetFileName() );
|
2011-05-16 19:32:57 +00:00
|
|
|
frame->OnModify(); // Ready to save the new empty board
|
2010-05-30 09:46:37 +00:00
|
|
|
|
2011-04-12 14:19:59 +00:00
|
|
|
msg.Printf( _( "File <%s> does not exist.\nThis is normal for a new project" ),
|
2012-08-29 16:59:50 +00:00
|
|
|
GetChars( frame->GetBoard()->GetFileName() ) );
|
2010-05-30 09:46:37 +00:00
|
|
|
wxMessageBox( msg );
|
|
|
|
}
|
2007-08-04 00:47:36 +00:00
|
|
|
}
|
|
|
|
|
2012-11-12 16:19:10 +00:00
|
|
|
else
|
|
|
|
// No file to open: initialize a new empty board
|
|
|
|
// using default values for design settings:
|
|
|
|
frame->Clear_Pcb( false );
|
|
|
|
|
2010-05-30 09:46:37 +00:00
|
|
|
// update the layer names in the listbox
|
2013-09-02 15:26:52 +00:00
|
|
|
frame->ReCreateLayerBox( false );
|
2010-04-28 14:06:14 +00:00
|
|
|
|
2010-02-24 18:36:01 +00:00
|
|
|
/* For an obscure reason the focus is lost after loading a board file
|
|
|
|
* when starting (i.e. only at this point)
|
|
|
|
* (seems due to the recreation of the layer manager after loading the file)
|
|
|
|
* give focus to main window and Drawpanel
|
|
|
|
* must be done for these 2 windows (for an obscure reason ...)
|
|
|
|
* Linux specific
|
|
|
|
* This is more a workaround than a fix.
|
|
|
|
*/
|
|
|
|
frame->SetFocus();
|
2011-12-22 13:28:11 +00:00
|
|
|
frame->GetCanvas()->SetFocus();
|
2012-08-02 07:47:30 +00:00
|
|
|
|
2012-08-01 11:54:20 +00:00
|
|
|
return true;
|
|
|
|
}
|
2012-08-02 17:24:53 +00:00
|
|
|
|
2013-05-08 20:47:23 +00:00
|
|
|
|
2012-08-01 11:54:20 +00:00
|
|
|
#if 0
|
|
|
|
// for some reason KiCad classes do not implement OnExit
|
|
|
|
// if I add it in the declaration, I need to fix it in every application
|
|
|
|
// so for now make a note TODO TODO
|
|
|
|
// we need to clean up python when the application exits
|
2013-05-08 20:47:23 +00:00
|
|
|
int EDA_APP::OnExit()
|
|
|
|
{
|
2012-08-01 11:54:20 +00:00
|
|
|
// Restore the thread state and tell Python to cleanup after itself.
|
|
|
|
// wxPython will do its own cleanup as part of that process. This is done
|
|
|
|
// in OnExit instead of ~MyApp because OnExit is only called if OnInit is
|
|
|
|
// successful.
|
2012-08-02 17:24:53 +00:00
|
|
|
#if KICAD_SCRIPTING_WXPYTHON
|
2012-08-02 07:47:30 +00:00
|
|
|
pcbnewFinishPythonScripting();
|
2012-08-01 11:54:20 +00:00
|
|
|
#endif
|
2012-09-11 07:33:17 +00:00
|
|
|
return 0;
|
2012-08-01 11:54:20 +00:00
|
|
|
}
|
|
|
|
|
2012-08-02 17:24:53 +00:00
|
|
|
#endif
|