Solved: eeschema crashes when create a new sheet. Added comments in gestfich.cpp to explain the default paths used by kicad to find help files and lib files
This commit is contained in:
parent
8d9b8a98f4
commit
0f54a686cc
|
@ -5,6 +5,15 @@ Started 2007-June-11
|
|||
Please add newer entries at the top, list the date and your name with
|
||||
email address.
|
||||
|
||||
2008-Mar-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
|
||||
================================================================================
|
||||
+eeschema
|
||||
Solved: eeschema crashes when create a new sheet, using the default filename and enter it.
|
||||
+all:
|
||||
Added comments in gestfich.cpp to explain the default paths used by kicad to find help files and lib files
|
||||
|
||||
|
||||
|
||||
2008-Mar-30 UPDATE Jonas Diemer <diemer-at-gmx.de>
|
||||
================================================================================
|
||||
+eeschema
|
||||
|
|
|
@ -32,6 +32,37 @@
|
|||
#include "wxstruct.h"
|
||||
#include "macros.h"
|
||||
|
||||
/* List of default paths used to locate help files and kicad library files.
|
||||
*
|
||||
* Under windows, kicad search its files from the binary path file (first argument when running "main")
|
||||
* So for a standard install, default paths are not mandatory, but they exist, just in case.
|
||||
* kicad is often installed in c:/Program Files/kicad or c:/kicad (or d: or e: ... )
|
||||
* and the directory "share" has no meaning under windows.
|
||||
*
|
||||
* Under linux, the problem is more complex.
|
||||
* In fact there are 3 cases:
|
||||
* 1 - When released in a distribution:
|
||||
* binaries are in /usr/bin, kicad libs in /usr/share/kicad/ and doc in /usr/share/doc/kicad/
|
||||
* 2 - When compiled by an user:
|
||||
* binaries also can be in /usr/local/bin, kicad libs in /usr/local/share/kicad/ and doc in /usr/local/share/doc/kicad/
|
||||
* 3 - When in an "universal tarball" or build for a server:
|
||||
* all files are in /usr/local/kicad
|
||||
* This is mandatory when kicad is installed on a server (in a school for instance) because one can export /usr/local/kicad
|
||||
* and obviously the others paths cannot be used
|
||||
* (cannot be mounted by the client, because they are already used).
|
||||
*
|
||||
* in cases 1 and 2 kicad files cannot be found from the binary path.
|
||||
* in case 3 kicad files can be found from the binary path only if this is a kicad binary file which is launched.
|
||||
* But if an user creates a symbolic link to the actual binary file to run kicad, the binary path is not good
|
||||
* and the defaults paths must be used
|
||||
*
|
||||
* Note:
|
||||
* kicad uses first the bin path lo locace kicad tree.
|
||||
* if not found kicad uses the environment variable KICAD to find its files
|
||||
* and at last kicad uses the default paths.
|
||||
* So we can export (linux and windows) the variable KICAD:
|
||||
* like export KICAD=/my_path/kicad if /my_path/kicad is not a default path
|
||||
*/
|
||||
|
||||
// Path list for online help
|
||||
static wxString s_HelpPathList[] = {
|
||||
|
@ -43,7 +74,7 @@ static wxString s_HelpPathList[] = {
|
|||
#else
|
||||
wxT( "/usr/share/doc/kicad/help/" ),
|
||||
wxT( "/usr/local/share/doc/kicad/help/" ),
|
||||
wxT( "/usr/local/kicad/share/doc/kicad/" ), // TODO: must be removed
|
||||
wxT( "/usr/local/kicad/" ), // default install for "universal tarballs" and build for a server
|
||||
#endif
|
||||
wxT( "end_list" ) // End of list symbol, do not change
|
||||
};
|
||||
|
@ -51,19 +82,18 @@ static wxString s_HelpPathList[] = {
|
|||
// Path list for kicad data files
|
||||
static wxString s_KicadDataPathList[] = {
|
||||
#ifdef __WINDOWS__
|
||||
wxT( "c:/kicad/" ), // TODO: must be removed
|
||||
wxT( "d:/kicad/" ), // TODO: must be removed
|
||||
wxT( "c:/kicad/" ),
|
||||
wxT( "d:/kicad/" ),
|
||||
wxT( "c:/kicad/share/" ),
|
||||
wxT( "d:/kicad/share/" ),
|
||||
wxT( "c:/Program Files/kicad/" ), // TODO: must be removed
|
||||
wxT( "d:/Program Files/kicad/" ), // TODO: must be removed
|
||||
wxT( "c:/Program Files/kicad/" ),
|
||||
wxT( "d:/Program Files/kicad/" ),
|
||||
wxT( "c:/Program Files/kicad/share/" ),
|
||||
wxT( "d:/Program Files/kicad/share/" ),
|
||||
#else
|
||||
wxT( "/usr/share/kicad/" ),
|
||||
wxT( "/usr/local/share/kicad/" ),
|
||||
wxT( "/usr/local/kicad/share/kicad/" ), // TODO: must be removed
|
||||
wxT( "/usr/local/kicad/" ), // TODO: must be removed
|
||||
wxT( "/usr/local/kicad/" ), // default install for "universal tarballs" and build for a server
|
||||
#endif
|
||||
wxT( "end_list" ) // End of list symbol, do not change
|
||||
};
|
||||
|
@ -124,6 +154,7 @@ wxString MakeReducedFileName( const wxString& fullfilename,
|
|||
path.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
|
||||
// names are case insensitive under windows
|
||||
path.MakeLower();
|
||||
Cwd.MakeLower();
|
||||
|
@ -318,7 +349,8 @@ wxString EDA_FileSelector( const wxString& Title, /* Dialog ti
|
|||
wxSetWorkingDirectory( defaultpath );
|
||||
|
||||
#if 0 && defined (DEBUG)
|
||||
printf("defaultpath=\"%s\" defaultname=\"%s\" Ext=\"%s\" Mask=\"%s\" flag=%d keep_working_directory=%d\n",
|
||||
printf(
|
||||
"defaultpath=\"%s\" defaultname=\"%s\" Ext=\"%s\" Mask=\"%s\" flag=%d keep_working_directory=%d\n",
|
||||
CONV_TO_UTF8( defaultpath ),
|
||||
CONV_TO_UTF8( defaultname ),
|
||||
CONV_TO_UTF8( Ext ),
|
||||
|
@ -347,6 +379,7 @@ wxString EDA_FileSelector( const wxString& Title, /* Dialog ti
|
|||
/********************************************************/
|
||||
wxString FindKicadHelpPath()
|
||||
/********************************************************/
|
||||
|
||||
/** Function FindKicadHelpPath
|
||||
* Find an absolute path for KiCad "help" (or "help/<language>")
|
||||
* Find path kicad/doc/help/xx/ or kicad/doc/help/:
|
||||
|
@ -371,6 +404,7 @@ wxString FindKicadHelpPath()
|
|||
wxString FullPath, LangFullPath, tmp;
|
||||
wxString LocaleString;
|
||||
bool PathFound = FALSE;
|
||||
|
||||
/* find kicad/help/ */
|
||||
tmp = g_EDA_Appl->m_BinDir;
|
||||
if( tmp.Last() == '/' )
|
||||
|
|
|
@ -372,8 +372,8 @@ bool DrawSheetStruct::LocatePathOfScreen( SCH_SCREEN* screen, DrawSheetPath* lis
|
|||
{
|
||||
//search the existing hierarchy for an instance of screen "FileName".
|
||||
//don't bother looking at the root sheet - it must be unique,
|
||||
//no other references to its m_s otherwise there would be loops
|
||||
//in the heirarchy.
|
||||
//no other references to its m_AssociatedScreen otherwise there would be loops
|
||||
//in the hierarchy.
|
||||
//search the existing hierarchy for an instance of screen "FileName".
|
||||
if( m_AssociatedScreen )
|
||||
{
|
||||
|
|
|
@ -300,16 +300,23 @@ void WinEDA_SheetPropertiesFrame::SheetPropertiesAccept( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
ChangeFileNameExt( FileName, g_SchExtBuffer );
|
||||
if ( (FileName != m_CurrentSheet->GetFileName()) )
|
||||
|
||||
/* m_CurrentSheet->m_AssociatedScreen must be a valide screen, and the sheet must have a valid associated filename,
|
||||
* so we must call m_CurrentSheet->ChangeFileName to set a filename,
|
||||
* AND always when a new sheet is created ( when m_CurrentSheet->m_AssociatedScreen is null ),
|
||||
* to create or set an Associated Screen
|
||||
*/
|
||||
if( ( FileName != m_CurrentSheet->GetFileName() )
|
||||
|| ( m_CurrentSheet->m_AssociatedScreen == NULL) )
|
||||
{
|
||||
msg = _( "Changing a Filename can change all the schematic structure and cannot be undone" );
|
||||
msg << wxT( "\n" );
|
||||
msg << _( "Ok to continue renaming?" );
|
||||
if( m_CurrentSheet->m_AssociatedScreen == 0 || IsOK( NULL, msg) )
|
||||
if( m_CurrentSheet->m_AssociatedScreen == NULL || IsOK( NULL, msg ) )
|
||||
{ //do not prompt on a new sheet. in fact, we should not allow a sheet to be created
|
||||
//without a valid associated filename to be read from.
|
||||
m_Parent->GetScreen()->ClearUndoRedoList();
|
||||
m_CurrentSheet->ChangeFileName(m_Parent, FileName);
|
||||
m_CurrentSheet->ChangeFileName( m_Parent, FileName ); // set filename and the associated screen
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue