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() )
/* Up on level relative to binary path with "share/kicad" appended {
* for all other platforms. */ wxLogDebug( wxT( "Adding locale lookup path: " ) +
fn.GetPath() );
wxLocale::AddCatalogLookupPathPrefix( fn.GetPath() );
}
fn.RemoveLastDir();
// Append path for unix standard install
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,20 +862,32 @@ wxString WinEDA_App::FindFileInSearchPaths( const wxString& filename, ...@@ -854,20 +862,32 @@ 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.
...@@ -879,22 +899,33 @@ wxString WinEDA_App::GetHelpFile( void ) ...@@ -879,22 +899,33 @@ 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() );
fn = FindFileInSearchPaths( m_HelpFileName, &subdirs ); altsubdirs.Add( m_Locale->GetCanonicalName() );
fn = FindFileInSearchPaths( m_HelpFileName, &altsubdirs );
if( !fn )
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
fn = FindFileInSearchPaths( m_HelpFileName, &subdirs ); 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 );
} }
// Step 3 : if not found Try to find help file in help/en // Step 3 : if not found Try to find help file in help/en
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" ) );
fn = FindFileInSearchPaths( m_HelpFileName, &subdirs ); altsubdirs.Add( _T( "en" ) );
fn = FindFileInSearchPaths( m_HelpFileName, &altsubdirs );
if ( ! fn )
fn = FindFileInSearchPaths( m_HelpFileName, &subdirs );
} }
return fn; return fn;
...@@ -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);
......
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: dialog_pcbnew_config.cpp // Name: dialog_pcbnew_config.cpp
// Purpose: // Purpose:
// Author: jean-pierre Charras // Author: jean-pierre Charras
// Modified by: // Modified by:
// Created: 18/02/2006 16:41:57 // Created: 18/02/2006 16:41:57
// RCS-ID: // RCS-ID:
// Copyright: License GNU // Copyright: License GNU
// Licence: // Licence:
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/* Handle the pcbnew libary config (library list, and default lib path) /* Handle the pcbnew libary config (library list, and default lib path)
...@@ -125,9 +125,9 @@ bool KiConfigPcbnewFrame::Create( wxWindow* parent, wxWindowID id, const wxStrin ...@@ -125,9 +125,9 @@ bool KiConfigPcbnewFrame::Create( wxWindow* parent, wxWindowID id, const wxStrin
*/ */
void KiConfigPcbnewFrame::CreateControls() void KiConfigPcbnewFrame::CreateControls()
{ {
SetFont(*g_DialogFont); SetFont(*g_DialogFont);
////@begin KiConfigPcbnewFrame content construction ////@begin KiConfigPcbnewFrame content construction
// Generated by DialogBlocks, 18/02/2006 17:19:54 (unregistered) // Generated by DialogBlocks, 18/02/2006 17:19:54 (unregistered)
...@@ -208,15 +208,15 @@ void KiConfigPcbnewFrame::CreateControls() ...@@ -208,15 +208,15 @@ void KiConfigPcbnewFrame::CreateControls()
wxString msg = _("Board ext: ") + PcbExtBuffer; wxString msg = _("Board ext: ") + PcbExtBuffer;
wxStaticText * text = new wxStaticText( itemDialog1, -1, msg, wxDefaultPosition, wxDefaultSize, 0 ); wxStaticText * text = new wxStaticText( itemDialog1, -1, msg, wxDefaultPosition, wxDefaultSize, 0 );
m_FileExtList->Add(text, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5); m_FileExtList->Add(text, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5);
msg = _("Cmp ext: ") + NetCmpExtBuffer; msg = _("Cmp ext: ") + NetCmpExtBuffer;
text = new wxStaticText( itemDialog1, -1, msg, wxDefaultPosition, wxDefaultSize, 0 ); text = new wxStaticText( itemDialog1, -1, msg, wxDefaultPosition, wxDefaultSize, 0 );
m_FileExtList->Add(text, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5); m_FileExtList->Add(text, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5);
msg = _("Lib ext: ") + LibExtBuffer; msg = _("Lib ext: ") + LibExtBuffer;
text = new wxStaticText( itemDialog1, -1, msg, wxDefaultPosition, wxDefaultSize, 0 ); text = new wxStaticText( itemDialog1, -1, msg, wxDefaultPosition, wxDefaultSize, 0 );
m_FileExtList->Add(text, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5); m_FileExtList->Add(text, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5);
msg = _("Net ext: ") + NetExtBuffer; msg = _("Net ext: ") + NetExtBuffer;
text = new wxStaticText( itemDialog1, -1, msg, wxDefaultPosition, wxDefaultSize, 0 ); text = new wxStaticText( itemDialog1, -1, msg, wxDefaultPosition, wxDefaultSize, 0 );
m_FileExtList->Add(text, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5); m_FileExtList->Add(text, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5);
...@@ -360,10 +360,13 @@ wxString mask = wxT("*"); ...@@ -360,10 +360,13 @@ 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);
for ( unsigned jj = 0; jj < Filenames.GetCount(); jj ++ ) for ( unsigned jj = 0; jj < Filenames.GetCount(); jj ++ )
{ {
fullfilename = Filenames[jj]; fullfilename = Filenames[jj];
......
...@@ -34,10 +34,10 @@ void WinEDA_PcbGridFrame::AcceptPcbOptions(wxCommandEvent& event) ...@@ -34,10 +34,10 @@ void WinEDA_PcbGridFrame::AcceptPcbOptions(wxCommandEvent& event)
m_Parent->GetScreen()->AddGrid( g_UserGrid, g_UserGrid_Unit, ID_POPUP_GRID_USER ); m_Parent->GetScreen()->AddGrid( g_UserGrid, g_UserGrid_Unit, ID_POPUP_GRID_USER );
EndModal(1); EndModal(1);
// 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