doc update.
This commit is contained in:
parent
8c61ac42bd
commit
0cdcd78ba0
|
@ -277,14 +277,23 @@ void* MyMalloc( size_t nb_octets )
|
|||
}
|
||||
|
||||
|
||||
/**************************************************************/
|
||||
bool ProcessExecute( const wxString& aCommandLine, int aFlags )
|
||||
/**************************************************************/
|
||||
/**
|
||||
* Function ProcessExecute
|
||||
* runs a child process.
|
||||
* @param aCommandLine The process and any arguments to it all in a single string.
|
||||
* @param aFlags The same args as allowed for wxExecute()
|
||||
* @return bool - true if success, else false
|
||||
*/
|
||||
{
|
||||
#ifdef __WINDOWS__
|
||||
wxExecute(aCommandLine);
|
||||
return true;
|
||||
int pid = wxExecute(aCommandLine);
|
||||
return pid ? true : false;
|
||||
#else
|
||||
wxProcess* process = wxProcess::Open( aCommandLine, aFlags );
|
||||
return process != NULL;
|
||||
return (process != NULL) ? true : false;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -54,16 +54,10 @@ void WinEDA_App::WritePdfBrowserInfos()
|
|||
}
|
||||
|
||||
|
||||
// Mime type extensions
|
||||
// Mime type extensions (PDF files are not considered here)
|
||||
static wxMimeTypesManager* mimeDatabase;
|
||||
static const wxFileTypeInfo EDAfallbacks[] =
|
||||
{
|
||||
wxFileTypeInfo( wxT( "text/pdf" ),
|
||||
wxT( "xpdf %s" ),
|
||||
wxT( "xpdf -p %s" ),
|
||||
wxT( "pdf document (from Kicad)" ),
|
||||
wxT( "pdf" ), wxT( "PDF" ), NULL ),
|
||||
|
||||
wxFileTypeInfo( wxT( "text/html" ),
|
||||
wxT( "wxhtml %s" ),
|
||||
wxT( "wxhtml %s" ),
|
||||
|
@ -95,7 +89,7 @@ bool GetAssociatedDocument( wxFrame* frame, const wxString& LibPath,
|
|||
* if DocName is starting by http: or ftp: or www. the default internet browser is launched
|
||||
*/
|
||||
{
|
||||
wxString docpath, fullfilename;
|
||||
wxString docpath, fullfilename, file_ext;
|
||||
wxString Line;
|
||||
wxString command;
|
||||
bool success = FALSE;
|
||||
|
@ -158,22 +152,27 @@ bool GetAssociatedDocument( wxFrame* frame, const wxString& LibPath,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/* Try to launch some browser (usefull under linux) */
|
||||
g_EDA_Appl->ReadPdfBrowserInfos();
|
||||
if( g_EDA_Appl->m_PdfBrowserIsDefault )
|
||||
{
|
||||
wxFileType* filetype;
|
||||
wxFileName CurrentFileName( fullfilename );
|
||||
file_ext = CurrentFileName.GetExt();
|
||||
|
||||
wxString ext, type;
|
||||
ext = CurrentFileName.GetExt();
|
||||
filetype = wxTheMimeTypesManager->GetFileTypeFromExtension( ext );
|
||||
if( file_ext == wxT( "pdf" ) )
|
||||
{
|
||||
success = OpenPDF( fullfilename );
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
/* Try to launch some browser (usefull under linux) */
|
||||
wxFileType* filetype;
|
||||
|
||||
wxString type;
|
||||
filetype = wxTheMimeTypesManager->GetFileTypeFromExtension( file_ext );
|
||||
|
||||
if( !filetype ) // 2ieme tentative
|
||||
{
|
||||
mimeDatabase = new wxMimeTypesManager;
|
||||
mimeDatabase->AddFallbacks( EDAfallbacks );
|
||||
filetype = mimeDatabase->GetFileTypeFromExtension( ext );
|
||||
filetype = mimeDatabase->GetFileTypeFromExtension( file_ext );
|
||||
delete mimeDatabase;
|
||||
mimeDatabase = NULL;
|
||||
}
|
||||
|
@ -185,57 +184,15 @@ bool GetAssociatedDocument( wxFrame* frame, const wxString& LibPath,
|
|||
success = filetype->GetOpenCommand( &command, params );
|
||||
delete filetype;
|
||||
if( success )
|
||||
ProcessExecute( command );
|
||||
success = ProcessExecute( command );
|
||||
}
|
||||
|
||||
if( !success )
|
||||
{
|
||||
#ifdef __LINUX__
|
||||
if( ext == wxT( "pdf" ) )
|
||||
{
|
||||
success = TRUE; command.Empty();
|
||||
if( wxFileExists( wxT( "/usr/bin/kpdf" ) ) )
|
||||
command = wxT( "kpdf " ) + fullfilename;
|
||||
else if( wxFileExists( wxT( "/usr/bin/konqueror" ) ) )
|
||||
command = wxT( "konqueror " ) + fullfilename;
|
||||
else if( wxFileExists( wxT( "/usr/bin/gpdf" ) ) )
|
||||
command = wxT( "gpdf " ) + fullfilename;
|
||||
if( wxFileExists( wxT( "/usr/bin/xpdf" ) ) )
|
||||
command = wxT( "xpdf " ) + fullfilename;
|
||||
if( command.IsEmpty() ) // not started
|
||||
{
|
||||
DisplayError( frame,
|
||||
_( " Cannot find the PDF viewer (kpdf, gpdf, konqueror or xpdf) in /usr/bin/" ) );
|
||||
success = FALSE;
|
||||
}
|
||||
else
|
||||
ProcessExecute( command );
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
Line.Printf( _( "Unknown MIME type for Doc File [%s] (%s)" ),
|
||||
fullfilename.GetData(), ext.GetData() );
|
||||
Line.Printf( _( "Unknown MIME type for Doc File [%s]" ),
|
||||
fullfilename.GetData() );
|
||||
DisplayError( frame, Line );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
command = g_EDA_Appl->m_PdfBrowser;
|
||||
if( wxFileExists( command ) )
|
||||
{
|
||||
success = TRUE;
|
||||
AddDelimiterString( fullfilename );
|
||||
command += wxT( " " ) + fullfilename;
|
||||
ProcessExecute( command );
|
||||
}
|
||||
else
|
||||
{
|
||||
Line.Printf( _( "Cannot find Pdf viewer %s" ), command.GetData() );
|
||||
DisplayError( frame, Line );
|
||||
}
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
|
|
@ -74,8 +74,8 @@ static wxString s_HelpPathList[] = {
|
|||
#else
|
||||
wxT( "/usr/share/doc/kicad/help/" ),
|
||||
wxT( "/usr/local/share/doc/kicad/help/" ),
|
||||
wxT( "/usr/local/kicad/doc/" ), // default install for "universal tarballs" and build for a server (new)
|
||||
// wxT( "/usr/local/kicad/" ), // default install for "universal tarballs" and build for a server (old)
|
||||
wxT( "/usr/local/kicad/doc/help/" ), // default install for "universal tarballs" and build for a server (new)
|
||||
wxT( "/usr/local/kicad/help/" ), // default install for "universal tarballs" and build for a server (old)
|
||||
#endif
|
||||
wxT( "end_list" ) // End of list symbol, do not change
|
||||
};
|
||||
|
@ -701,64 +701,101 @@ wxString GetEditorName()
|
|||
return g_EditorName;
|
||||
}
|
||||
|
||||
|
||||
void OpenPDF( const wxString& file )
|
||||
/***********************************/
|
||||
bool OpenPDF( const wxString& file )
|
||||
/***********************************/
|
||||
/** Function OpenPDF
|
||||
* run the PDF viewer and display a PDF file
|
||||
* @param file = PDF file to open
|
||||
* @return true is success, false if no PDF viewer found
|
||||
*/
|
||||
{
|
||||
wxString command;
|
||||
wxString filename = file;
|
||||
wxString type;
|
||||
bool success = false;
|
||||
|
||||
g_EDA_Appl->ReadPdfBrowserInfos();
|
||||
if( !g_EDA_Appl->m_PdfBrowserIsDefault )
|
||||
if( !g_EDA_Appl->m_PdfBrowserIsDefault ) // Run the prefered PDF Browser
|
||||
{
|
||||
AddDelimiterString( filename );
|
||||
command = g_EDA_Appl->m_PdfBrowser + filename;
|
||||
command = g_EDA_Appl->m_PdfBrowser + wxT( " " ) + filename;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool success = false;
|
||||
wxFileType* filetype = NULL;
|
||||
|
||||
wxFileType::MessageParameters params( filename, type );
|
||||
|
||||
filetype = wxTheMimeTypesManager->GetFileTypeFromExtension( wxT( ".pdf" ) );
|
||||
filetype = wxTheMimeTypesManager->GetFileTypeFromExtension( wxT( "pdf" ) );
|
||||
if( filetype )
|
||||
success = filetype->GetOpenCommand( &command, params );
|
||||
delete filetype;
|
||||
#ifndef __WINDOWS__
|
||||
// Bug ? under linux wxWidgets returns acroread as PDF viewer,even it not exists
|
||||
if ( command.StartsWith(wxT("acroread")) ) // Workaround
|
||||
success = false;
|
||||
#endif
|
||||
if( success && !command.IsEmpty() )
|
||||
{
|
||||
success = ProcessExecute( command );
|
||||
}
|
||||
else
|
||||
success = false;
|
||||
|
||||
if( !success )
|
||||
{
|
||||
AddDelimiterString( filename );
|
||||
command.Empty();
|
||||
|
||||
#ifndef __WINDOWS__
|
||||
AddDelimiterString( filename );
|
||||
/* here is a list of PDF viewers candidates */
|
||||
const static wxString tries[] =
|
||||
{
|
||||
wxT( "/usr/bin/evince" ),
|
||||
wxT( "/usr/bin/xpdf" ),
|
||||
wxT( "/usr/bin/konqueror" ),
|
||||
wxT( "/usr/bin/gpdf" ),
|
||||
wxT( "/usr/bin/konqueror" ),
|
||||
wxT( "/usr/bin/kpdf" ),
|
||||
wxT( "/usr/bin/xpdf" ),
|
||||
wxT( "" ),
|
||||
};
|
||||
|
||||
for( int i = 0; ; i++ )
|
||||
for( int ii = 0; ; ii++ )
|
||||
{
|
||||
if( tries[i].IsEmpty() )
|
||||
if( tries[ii].IsEmpty() )
|
||||
break;
|
||||
|
||||
if( wxFileExists( tries[i] ) )
|
||||
if( wxFileExists( tries[ii] ) )
|
||||
{
|
||||
command = tries[i] + wxT( " " ) + filename;
|
||||
command = tries[ii] + wxT( " " ) + filename;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if( !command.IsEmpty() )
|
||||
ProcessExecute( command );
|
||||
{
|
||||
success = ProcessExecute( command );
|
||||
if ( !success )
|
||||
{
|
||||
wxString msg = _("Problem while running the PDF viewer");
|
||||
msg << wxT("\n command is") << command;
|
||||
DisplayError( NULL, msg );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wxString msg = _("Unable to find a PDF viewer for");
|
||||
msg << wxT(" ") << filename;
|
||||
DisplayError( NULL, msg );
|
||||
success = false;
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/*************************************/
|
||||
void OpenFile( const wxString& file )
|
||||
/*************************************/
|
||||
{
|
||||
wxString command;
|
||||
wxString filename = file;
|
||||
|
|
|
@ -309,7 +309,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
|
|||
* Function to move items in the current selected block
|
||||
*/
|
||||
{
|
||||
int deltaX, deltaY;
|
||||
wxPoint delta;
|
||||
wxPoint oldpos;
|
||||
|
||||
oldpos = GetScreen()->m_Curseur;
|
||||
|
@ -321,8 +321,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
|
|||
GetScreen()->BlockLocate.Normalize();
|
||||
|
||||
/* calcul du vecteur de deplacement pour les deplacements suivants */
|
||||
deltaX = GetScreen()->BlockLocate.m_MoveVector.x;
|
||||
deltaY = GetScreen()->BlockLocate.m_MoveVector.y;
|
||||
delta = GetScreen()->BlockLocate.m_MoveVector;
|
||||
|
||||
/* Move the Track segments in block */
|
||||
TRACK* track = m_Pcb->m_Track;
|
||||
|
@ -332,9 +331,13 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
|
|||
{
|
||||
m_Pcb->m_Status_Pcb = 0;
|
||||
track->Draw( DrawPanel, DC, GR_XOR ); // erase the display
|
||||
track->m_Start.x += deltaX; track->m_Start.y += deltaY;
|
||||
track->m_End.x += deltaX; track->m_End.y += deltaY;
|
||||
track->m_Param += deltaX; track->SetSubNet( track->GetSubNet() + deltaY );
|
||||
track->m_Start += delta;
|
||||
track->m_End += delta;
|
||||
// the two parameters are used in gerbview to store centre coordinates for arcs.
|
||||
// move this centre
|
||||
track->m_Param += delta.x;
|
||||
track->SetSubNet( track->GetSubNet() + delta.y );
|
||||
|
||||
track->Draw( DrawPanel, DC, GR_OR ); // redraw the moved track
|
||||
}
|
||||
track = track->Next();
|
||||
|
@ -344,12 +347,15 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
|
|||
SEGZONE * zsegment= m_Pcb->m_Zone;
|
||||
while( zsegment )
|
||||
{
|
||||
if( IsSegmentInBox( GetScreen()->BlockLocate, track ) )
|
||||
if( IsSegmentInBox( GetScreen()->BlockLocate, zsegment ) )
|
||||
{
|
||||
zsegment->Draw( DrawPanel, DC, GR_XOR ); // erase the display
|
||||
zsegment->m_Start.x += deltaX; track->m_Start.y += deltaY;
|
||||
zsegment->m_End.x += deltaX; track->m_End.y += deltaY;
|
||||
zsegment->m_Param += deltaX; track->SetSubNet( track->GetSubNet() + deltaY );
|
||||
zsegment->m_Start += delta;
|
||||
zsegment->m_End += delta;
|
||||
// the two parameters are used in gerbview to store centre coordinates for arcs.
|
||||
// move this centre
|
||||
zsegment->m_Param += delta.x;
|
||||
zsegment->SetSubNet( zsegment->GetSubNet() + delta.y );
|
||||
zsegment->Draw( DrawPanel, DC, GR_OR ); // redraw the moved zone zegment
|
||||
}
|
||||
zsegment = zsegment->Next();
|
||||
|
@ -407,7 +413,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
|
|||
while( zsegment )
|
||||
{
|
||||
SEGZONE * next_zsegment = zsegment->Next();
|
||||
if( IsSegmentInBox( GetScreen()->BlockLocate, track ) )
|
||||
if( IsSegmentInBox( GetScreen()->BlockLocate, zsegment ) )
|
||||
{
|
||||
/* this zone segment must be duplicated */
|
||||
SEGZONE * new_zsegment = (SEGZONE*) zsegment->Copy();
|
||||
|
|
|
@ -9,7 +9,7 @@ COMMON_GLOBL wxString g_BuildVersion
|
|||
# include "config.h"
|
||||
(wxT(KICAD_SVN_VERSION))
|
||||
# else
|
||||
(wxT("(20080530-r1107)"))
|
||||
(wxT("(20080622-r1138)"))
|
||||
# endif
|
||||
#endif
|
||||
;
|
||||
|
|
|
@ -448,9 +448,15 @@ int Get_Message( const wxString& titre, wxString& buffer, wxWindow* frame );
|
|||
/************************/
|
||||
|
||||
wxString GetEditorName(); // Return the prefered editor name
|
||||
void OpenPDF( const wxString& file );
|
||||
void OpenFile( const wxString& file );
|
||||
|
||||
/** Function OpenPDF
|
||||
* run the PDF viewer and display a PDF file
|
||||
* @param file = PDF file to open
|
||||
* @return true is success, false if no PDF viewer found
|
||||
*/
|
||||
bool OpenPDF( const wxString& file );
|
||||
|
||||
void OpenFile( const wxString& file );
|
||||
|
||||
bool EDA_DirectorySelector( const wxString& Title, /* Titre de la fenetre */
|
||||
wxString& Path, /* Chemin par defaut */
|
||||
|
|
Loading…
Reference in New Issue