Commit 71c4f49d authored by jean-pierre charras's avatar jean-pierre charras

Kicad manager: fix Bug #1385953 (unable to open .PDF files with spaces in...

Kicad manager: fix Bug #1385953 (unable to open .PDF files with spaces in name/path when using default PDF browser).
Fix also an issue when selecting preferred browser.
parent e273a48d
......@@ -43,7 +43,6 @@
#include <cvstruct.h>
#include <wildcards_and_files_ext.h>
#define titleComponentLibErr _( "Component Library Error" )
void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
{
......
......@@ -116,14 +116,7 @@ bool TREEPROJECT_ITEM::Rename( const wxString& name, bool check )
return false;
}
#if ( ( wxMAJOR_VERSION < 2 ) || ( ( wxMAJOR_VERSION == 2 ) \
&& ( wxMINOR_VERSION < 7 ) ) )
if( !wxRenameFile( GetFileName(), newFile ) )
#else
if( !wxRenameFile( GetFileName(), newFile, false ) )
#endif
{
wxMessageDialog( m_parent, _( "Unable to rename file ... " ),
_( "Permission error ?" ), wxICON_ERROR | wxOK );
......@@ -225,7 +218,6 @@ void TREEPROJECT_ITEM::Activate( TREE_PROJECT_FRAME* prjframe )
break;
case TREE_PDF:
AddDelimiterString( fullFileName );
OpenPDF( fullFileName );
break;
......
......@@ -516,15 +516,12 @@ void KICAD_MANAGER_FRAME::SaveSettings( wxConfigBase* aCfg )
/**
* a minor helper function:
* Prints the Current Working Dir name and the projet name on the text panel.
* Prints the Current Project full name on the text panel.
*/
void KICAD_MANAGER_FRAME::PrintPrjInfo()
{
wxString msg = wxString::Format( _(
"Working dir: %s\nProject: %s\n" ),
GetChars( wxGetCwd() ),
GetChars( GetProjectFileName() )
);
wxString msg = wxString::Format( _( "Project name:\n%s\n" ),
GetChars( GetProjectFileName() ) );
PrintMsg( msg );
}
......@@ -58,33 +58,39 @@ void KICAD_MANAGER_FRAME::OnUpdatePreferredPdfBrowser( wxUpdateUIEvent& event )
void KICAD_MANAGER_FRAME::OnSelectPreferredPdfBrowser( wxCommandEvent& event )
{
bool select = event.GetId() == ID_SELECT_PREFERED_PDF_BROWSER_NAME;
bool setPdfBrowserName = event.GetId() == ID_SELECT_PREFERED_PDF_BROWSER_NAME;
if( !Pgm().GetPdfBrowserName() && !select )
if( !Pgm().GetPdfBrowserName() && !setPdfBrowserName )
{
DisplayError( this,
_( "You must choose a PDF viewer before using this option." ) );
setPdfBrowserName = true;
}
wxString mask( wxT( "*" ) );
if( setPdfBrowserName )
{
wxString mask( wxT( "*" ) );
#ifdef __WINDOWS__
mask += wxT( ".exe" );
#endif
#ifdef __WINDOWS__
mask += wxT( ".exe" );
#endif
wxString wildcard = _( "Executable files (" ) + mask + wxT( ")|" ) + mask;
wxString wildcard = _( "Executable files (" ) + mask + wxT( ")|" ) + mask;
Pgm().ReadPdfBrowserInfos();
wxFileName fn = Pgm().GetPdfBrowserName();
Pgm().ReadPdfBrowserInfos();
wxFileName fn = Pgm().GetPdfBrowserName();
wxFileDialog dlg( this, _( "Select Preferred Pdf Browser" ), fn.GetPath(),
fn.GetFullPath(), wildcard,
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
wxFileDialog dlg( this, _( "Select Preferred Pdf Browser" ), fn.GetPath(),
fn.GetFullPath(), wildcard,
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL )
return;
if( dlg.ShowModal() == wxID_CANCEL )
return;
Pgm().SetPdfBrowserName( dlg.GetPath() );
}
Pgm().SetPdfBrowserName( dlg.GetPath() );
Pgm().ForceSystemPdfBrowser( false );
Pgm().WritePdfBrowserInfos();
}
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