Commit 2075ac84 authored by charras's avatar charras

minor (and old) bugs fixed.

minor changes in search paths for help and translation files.
parent 3a618567
...@@ -735,13 +735,20 @@ void WinEDA_App::SetLanguagePath( void ) ...@@ -735,13 +735,20 @@ void WinEDA_App::SetLanguagePath( void )
for( i = 0; i < m_searchPaths.GetCount(); i++ ) for( i = 0; i < m_searchPaths.GetCount(); i++ )
{ {
wxFileName fn( m_searchPaths[i], wxEmptyString ); wxFileName fn( m_searchPaths[i], wxEmptyString );
// Append path for Windows and unix kicad pack install
fn.AppendDir( wxT( "share" ) ); fn.AppendDir( wxT( "share" ) );
#ifndef __WXMSW__ fn.AppendDir( wxT( "internat" ) );
if( fn.DirExists() )
{
wxLogDebug( wxT( "Adding locale lookup path: " ) +
fn.GetPath() );
wxLocale::AddCatalogLookupPathPrefix( fn.GetPath() );
}
fn.RemoveLastDir();
/* Up on level relative to binary path with "share/kicad" appended // Append path for unix standard install
* for all other platforms. */
fn.AppendDir( wxT( "kicad" ) ); fn.AppendDir( wxT( "kicad" ) );
#endif
fn.AppendDir( wxT( "internat" ) ); fn.AppendDir( wxT( "internat" ) );
if( fn.DirExists() ) if( fn.DirExists() )
{ {
...@@ -749,6 +756,7 @@ void WinEDA_App::SetLanguagePath( void ) ...@@ -749,6 +756,7 @@ void WinEDA_App::SetLanguagePath( void )
fn.GetPath() ); fn.GetPath() );
wxLocale::AddCatalogLookupPathPrefix( fn.GetPath() ); wxLocale::AddCatalogLookupPathPrefix( fn.GetPath() );
} }
} }
} }
} }
...@@ -854,21 +862,33 @@ wxString WinEDA_App::FindFileInSearchPaths( const wxString& filename, ...@@ -854,21 +862,33 @@ wxString WinEDA_App::FindFileInSearchPaths( const wxString& filename,
wxString WinEDA_App::GetHelpFile( void ) wxString WinEDA_App::GetHelpFile( void )
{ {
wxString fn; wxString fn;
wxArrayString subdirs; wxArrayString subdirs, altsubdirs;
/* FIXME: This is not the ideal way to handle this. Unfortunely, the /* FIXME: This is not the ideal way to handle this. Unfortunely, the
* CMake install paths seem to be a moving target so this crude * CMake install paths seem to be a moving target so this crude
* hack solve the problem of install path differences between * hack solve the problem of install path differences between
* Windows and non-Windows platforms. */ * Windows and non-Windows platforms. */
#ifndef __WXMSW__
// Partially fixed, but must be enhanced
// Create subdir tree for "standard" linux distributions, when kicad comes from a distribution
// files are in /usr/share/doc/kicad/help
// and binaries in /usr/bin or /usr/local/bin
subdirs.Add( wxT( "share" ) ); subdirs.Add( wxT( "share" ) );
#endif
subdirs.Add( _T( "doc" ) ); subdirs.Add( _T( "doc" ) );
#ifndef __WXMSW__
subdirs.Add( wxT( "kicad" ) ); subdirs.Add( wxT( "kicad" ) );
#endif
subdirs.Add( _T( "help" ) ); subdirs.Add( _T( "help" ) );
// Create subdir tree for linux and Windows kicad pack
// Note the pack form under linux is also useful if an user want to install kicad to a server.
// because there is only one path to mount or export (something like /usr/local/kicad).
// files are in <install dir>/kicad/doc/help
// (often /usr/local/kicad/kicad/doc/help)
// <install dir>/kicad/ is retrievered from m_BinDir
altsubdirs.Add( _T( "doc" ) );
altsubdirs.Add( _T( "help" ) );
/* Search for a help file. /* Search for a help file.
* we *must* find a help file. * we *must* find a help file.
* so help is searched in directories in this order: * so help is searched in directories in this order:
...@@ -879,13 +899,20 @@ wxString WinEDA_App::GetHelpFile( void ) ...@@ -879,13 +899,20 @@ wxString WinEDA_App::GetHelpFile( void )
// Step 1 : Try to find help file in help/<canonical name> // Step 1 : Try to find help file in help/<canonical name>
subdirs.Add( m_Locale->GetCanonicalName() ); subdirs.Add( m_Locale->GetCanonicalName() );
altsubdirs.Add( m_Locale->GetCanonicalName() );
fn = FindFileInSearchPaths( m_HelpFileName, &altsubdirs );
if( !fn )
fn = FindFileInSearchPaths( m_HelpFileName, &subdirs ); fn = FindFileInSearchPaths( m_HelpFileName, &subdirs );
// Step 2 : if not found Try to find help file in help/<short name> // Step 2 : if not found Try to find help file in help/<short name>
if( !fn ) if( !fn )
{ {
subdirs.RemoveAt( subdirs.GetCount() - 1 ); subdirs.RemoveAt( subdirs.GetCount() - 1 );
altsubdirs.RemoveAt( altsubdirs.GetCount() - 1 );
subdirs.Add( m_Locale->GetName().BeforeLast( '_' ) ); // GetName( ) does not return always the short name subdirs.Add( m_Locale->GetName().BeforeLast( '_' ) ); // GetName( ) does not return always the short name
altsubdirs.Add( m_Locale->GetName().BeforeLast( '_' ) ); // GetName( ) does not return always the short name
fn = FindFileInSearchPaths( m_HelpFileName, &altsubdirs );
if ( ! fn )
fn = FindFileInSearchPaths( m_HelpFileName, &subdirs ); fn = FindFileInSearchPaths( m_HelpFileName, &subdirs );
} }
...@@ -893,7 +920,11 @@ wxString WinEDA_App::GetHelpFile( void ) ...@@ -893,7 +920,11 @@ wxString WinEDA_App::GetHelpFile( void )
if( !fn ) if( !fn )
{ {
subdirs.RemoveAt( subdirs.GetCount() - 1 ); subdirs.RemoveAt( subdirs.GetCount() - 1 );
altsubdirs.RemoveAt( altsubdirs.GetCount() - 1 );
subdirs.Add( _T( "en" ) ); subdirs.Add( _T( "en" ) );
altsubdirs.Add( _T( "en" ) );
fn = FindFileInSearchPaths( m_HelpFileName, &altsubdirs );
if ( ! fn )
fn = FindFileInSearchPaths( m_HelpFileName, &subdirs ); fn = FindFileInSearchPaths( m_HelpFileName, &subdirs );
} }
...@@ -918,7 +949,7 @@ wxString WinEDA_App::GetLibraryFile( const wxString& filename ) ...@@ -918,7 +949,7 @@ wxString WinEDA_App::GetLibraryFile( const wxString& filename )
/** /**
* Run init scripts * Run init scripts
* @return the defualt OnRun() value (exit codes not used in kicad, so value has no special mening) * @return the default OnRun() value (exit codes not used in kicad, so value has no special mening)
*/ */
/**********************/ /**********************/
int WinEDA_App::OnRun() int WinEDA_App::OnRun()
......
...@@ -361,7 +361,10 @@ wxString FullLibName,ShortLibName, Mask; ...@@ -361,7 +361,10 @@ wxString FullLibName,ShortLibName, Mask;
wxEmptyString, Mask, wxEmptyString, Mask,
wxFD_DEFAULT_STYLE | wxFD_MULTIPLE); wxFD_DEFAULT_STYLE | wxFD_MULTIPLE);
FilesDialog.ShowModal(); int diag = FilesDialog.ShowModal();
if ( diag != wxID_OK )
return;
wxArrayString Filenames; wxArrayString Filenames;
FilesDialog.GetPaths(Filenames); FilesDialog.GetPaths(Filenames);
...@@ -372,7 +375,7 @@ wxString FullLibName,ShortLibName, Mask; ...@@ -372,7 +375,7 @@ wxString FullLibName,ShortLibName, Mask;
if ( ShortLibName.IsEmpty() ) //Just in case... if ( ShortLibName.IsEmpty() ) //Just in case...
continue; continue;
//Add or insert new library name //Add or insert new library name
if (FindLibrary(ShortLibName) == NULL) if ( g_LibName_List.Index(ShortLibName) == wxNOT_FOUND)
{ {
m_LibListChanged = TRUE; m_LibListChanged = TRUE;
g_LibName_List.Insert(ShortLibName, ii); g_LibName_List.Insert(ShortLibName, ii);
......
...@@ -360,7 +360,10 @@ wxString mask = wxT("*"); ...@@ -360,7 +360,10 @@ wxString mask = wxT("*");
wxEmptyString, mask, wxEmptyString, mask,
wxFD_DEFAULT_STYLE | wxFD_MULTIPLE); wxFD_DEFAULT_STYLE | wxFD_MULTIPLE);
FilesDialog.ShowModal(); int diag = FilesDialog.ShowModal();
if ( diag != wxID_OK )
return;
wxArrayString Filenames; wxArrayString Filenames;
FilesDialog.GetPaths(Filenames); FilesDialog.GetPaths(Filenames);
......
...@@ -37,7 +37,7 @@ void WinEDA_PcbGridFrame::AcceptPcbOptions(wxCommandEvent& event) ...@@ -37,7 +37,7 @@ void WinEDA_PcbGridFrame::AcceptPcbOptions(wxCommandEvent& event)
// If the user grid is the current selection , ensure grid size value = new user grid value // If the user grid is the current selection , ensure grid size value = new user grid value
int ii = m_Parent->m_SelGridBox->GetSelection(); int ii = m_Parent->m_SelGridBox->GetSelection();
if ( ii == m_Parent->m_SelGridBox->GetCount() - 1 ) if ( ii == (int)(m_Parent->m_SelGridBox->GetCount() - 1) )
m_Parent->GetScreen()->SetGrid( ID_POPUP_GRID_USER ); m_Parent->GetScreen()->SetGrid( ID_POPUP_GRID_USER );
m_Parent->DrawPanel->Refresh( TRUE ); m_Parent->DrawPanel->Refresh( TRUE );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment