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.
This commit is contained in:
parent
e273a48ddc
commit
71c4f49d1d
|
@ -43,7 +43,6 @@
|
||||||
#include <cvstruct.h>
|
#include <cvstruct.h>
|
||||||
#include <wildcards_and_files_ext.h>
|
#include <wildcards_and_files_ext.h>
|
||||||
|
|
||||||
#define titleComponentLibErr _( "Component Library Error" )
|
|
||||||
|
|
||||||
void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
|
void CVPCB_MAINFRAME::SetNewPkg( const wxString& aFootprintName )
|
||||||
{
|
{
|
||||||
|
|
|
@ -116,14 +116,7 @@ bool TREEPROJECT_ITEM::Rename( const wxString& name, bool check )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ( ( wxMAJOR_VERSION < 2 ) || ( ( wxMAJOR_VERSION == 2 ) \
|
|
||||||
&& ( wxMINOR_VERSION < 7 ) ) )
|
|
||||||
|
|
||||||
if( !wxRenameFile( GetFileName(), newFile ) )
|
|
||||||
#else
|
|
||||||
|
|
||||||
if( !wxRenameFile( GetFileName(), newFile, false ) )
|
if( !wxRenameFile( GetFileName(), newFile, false ) )
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
wxMessageDialog( m_parent, _( "Unable to rename file ... " ),
|
wxMessageDialog( m_parent, _( "Unable to rename file ... " ),
|
||||||
_( "Permission error ?" ), wxICON_ERROR | wxOK );
|
_( "Permission error ?" ), wxICON_ERROR | wxOK );
|
||||||
|
@ -225,7 +218,6 @@ void TREEPROJECT_ITEM::Activate( TREE_PROJECT_FRAME* prjframe )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TREE_PDF:
|
case TREE_PDF:
|
||||||
AddDelimiterString( fullFileName );
|
|
||||||
OpenPDF( fullFileName );
|
OpenPDF( fullFileName );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -516,15 +516,12 @@ void KICAD_MANAGER_FRAME::SaveSettings( wxConfigBase* aCfg )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* a minor helper function:
|
* 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()
|
void KICAD_MANAGER_FRAME::PrintPrjInfo()
|
||||||
{
|
{
|
||||||
wxString msg = wxString::Format( _(
|
wxString msg = wxString::Format( _( "Project name:\n%s\n" ),
|
||||||
"Working dir: %s\nProject: %s\n" ),
|
GetChars( GetProjectFileName() ) );
|
||||||
GetChars( wxGetCwd() ),
|
|
||||||
GetChars( GetProjectFileName() )
|
|
||||||
);
|
|
||||||
PrintMsg( msg );
|
PrintMsg( msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,19 +58,22 @@ void KICAD_MANAGER_FRAME::OnUpdatePreferredPdfBrowser( wxUpdateUIEvent& event )
|
||||||
|
|
||||||
void KICAD_MANAGER_FRAME::OnSelectPreferredPdfBrowser( wxCommandEvent& 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,
|
DisplayError( this,
|
||||||
_( "You must choose a PDF viewer before using this option." ) );
|
_( "You must choose a PDF viewer before using this option." ) );
|
||||||
|
setPdfBrowserName = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( setPdfBrowserName )
|
||||||
|
{
|
||||||
wxString mask( wxT( "*" ) );
|
wxString mask( wxT( "*" ) );
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
mask += wxT( ".exe" );
|
mask += wxT( ".exe" );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxString wildcard = _( "Executable files (" ) + mask + wxT( ")|" ) + mask;
|
wxString wildcard = _( "Executable files (" ) + mask + wxT( ")|" ) + mask;
|
||||||
|
|
||||||
|
@ -85,6 +88,9 @@ void KICAD_MANAGER_FRAME::OnSelectPreferredPdfBrowser( wxCommandEvent& event )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Pgm().SetPdfBrowserName( dlg.GetPath() );
|
Pgm().SetPdfBrowserName( dlg.GetPath() );
|
||||||
|
}
|
||||||
|
|
||||||
|
Pgm().ForceSystemPdfBrowser( false );
|
||||||
Pgm().WritePdfBrowserInfos();
|
Pgm().WritePdfBrowserInfos();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue