diff --git a/change_log.txt b/change_log.txt index db4d5ea9dc..43ffcd2daa 100644 --- a/change_log.txt +++ b/change_log.txt @@ -5,6 +5,21 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. + +2008-June-06 UPDATE Jean-Pierre Charras +================================================================================ ++all: + Online doc format changed to PDF format. + This is **very** easier to handle, because : + - Openoffice has a very good pdf export function. + - Only one file for application + - Is standart (The old html format used a zipped archive, not standart) + - the doc tree is less complex (see doc/help/fr or doc/help/en for the new tree). + + If a localized doc file is not found, the english version is automatically loaded instead. + No need to copy the same pdf file in subdirectory. + + 2008-June-06 UPDATE Jean-Pierre Charras ================================================================================ +all: diff --git a/common/basicframe.cpp b/common/basicframe.cpp index 409d2b700d..c9839bfd98 100644 --- a/common/basicframe.cpp +++ b/common/basicframe.cpp @@ -9,6 +9,7 @@ #include "fctsys.h" #include #include "common.h" +#include "online_help.h" #include "id.h" @@ -220,6 +221,7 @@ wxString WinEDA_BasicFrame::GetLastProject( int rang ) void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event ) /**************************************************************/ { +#if defined ONLINE_HELP_FILES_FORMAT_IS_HTML if( m_Parent->m_HtmlCtrl == NULL ) { m_Parent->InitOnLineHelp(); @@ -237,6 +239,19 @@ void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event ) msg.Printf( _( "Help file %s not found" ), m_Parent->m_HelpFileName.GetData() ); DisplayError( this, msg ); } +#elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF + wxString fullfilename = FindKicadHelpPath() + m_Parent->m_HelpFileName; + if ( wxFileExists(fullfilename) ) + GetAssociatedDocument( this, wxEmptyString, fullfilename ); + else // Try to find file in English format: + { + fullfilename = FindKicadHelpPath() + wxT("../en/") + m_Parent->m_HelpFileName;; + GetAssociatedDocument( this, wxEmptyString, fullfilename ); + } + +#else + #error Help files format not defined +#endif } diff --git a/common/eda_doc.cpp b/common/eda_doc.cpp index a02ddfcef9..7a7c04735d 100644 --- a/common/eda_doc.cpp +++ b/common/eda_doc.cpp @@ -195,15 +195,17 @@ bool GetAssociatedDocument( wxFrame* frame, const wxString& LibPath, { success = TRUE; command.Empty(); if( wxFileExists( wxT( "/usr/bin/kpdf" ) ) ) - command = wxT( "xpdf " ) + fullfilename; + 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 or konqueror) in /usr/bin/" ) ); + _( " Cannot find the PDF viewer (kpdf, gpdf, konqueror or xpdf) in /usr/bin/" ) ); success = FALSE; } else diff --git a/common/edaappl.cpp b/common/edaappl.cpp index 0527a96ac3..5b2ddf83f7 100644 --- a/common/edaappl.cpp +++ b/common/edaappl.cpp @@ -28,6 +28,7 @@ #include "build_version.h" #include "hotkeys_basic.h" #include "macros.h" +#include "online_help.h" #include "bitmaps.h" @@ -223,7 +224,13 @@ void WinEDA_App::InitEDA_Appl( const wxString& name ) } /* Prepare On Line Help */ +#if defined ONLINE_HELP_FILES_FORMAT_IS_HTML m_HelpFileName = name + wxT( ".html" ); +#elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF + m_HelpFileName = name + wxT( ".pdf" ); +#else + #error Help files format not defined +#endif // Init parameters for configuration SetVendorName( wxT( "kicad" ) ); @@ -263,7 +270,7 @@ void WinEDA_App::InitEDA_Appl( const wxString& name ) if( !succes ) { } - + SetLocaleTo_Default( ); // Set locale option for separator used in float numbers #ifdef KICAD_PYTHON @@ -281,6 +288,8 @@ void WinEDA_App::InitOnLineHelp() { wxString fullfilename = FindKicadHelpPath(); +#if defined ONLINE_HELP_FILES_FORMAT_IS_HTML + m_HelpFileName = fullfilename + wxT( ".html" ); fullfilename += wxT( "kicad.hhp" ); if( wxFileExists( fullfilename ) ) { @@ -291,6 +300,11 @@ void WinEDA_App::InitOnLineHelp() m_HtmlCtrl->SetTitleFormat( wxT( "Kicad Help" ) ); m_HtmlCtrl->AddBook( fullfilename ); } +#elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF + m_HtmlCtrl = NULL; +#else + #error Help files format not defined +#endif } diff --git a/common/gestfich.cpp b/common/gestfich.cpp index a5c3420a1b..792e1f1852 100644 --- a/common/gestfich.cpp +++ b/common/gestfich.cpp @@ -74,7 +74,8 @@ static wxString s_HelpPathList[] = { #else wxT( "/usr/share/doc/kicad/help/" ), wxT( "/usr/local/share/doc/kicad/help/" ), - wxT( "/usr/local/kicad/" ), // default install for "universal tarballs" and build for a server + 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) #endif wxT( "end_list" ) // End of list symbol, do not change }; @@ -103,18 +104,12 @@ static wxString s_KicadBinaryPathList[] = { #ifdef __WINDOWS__ wxT( "c:/kicad/bin/" ), wxT( "d:/kicad/bin/" ), - wxT( "c:/kicad/winexe/" ), // TODO: must be removed - wxT( "d:/kicad/winexe/" ), // TODO: must be removed wxT( "c:/Program Files/kicad/bin/" ), wxT( "d:/Program Files/kicad/bin/" ), - wxT( "c:/Program Files/kicad/winexe/" ), // TODO: must be removed - wxT( "d:/Program Files/kicad/winexe/" ), // TODO: must be removed #else wxT( "/usr/bin/" ), wxT( "/usr/local/bin/" ), wxT( "/usr/local/kicad/bin/" ), - wxT( "/usr/local/kicad/linux/" ), // TODO: must be removed - wxT( "/usr/local/kicad/linux-non_unicode/" ), // TODO: must be removed #endif wxT( "end_list" ) // End of list symbol, do not change }; @@ -386,8 +381,8 @@ wxString FindKicadHelpPath() * from BinDir * else from environment variable KICAD * else from one of s_HelpPathList - * typically c:\kicad\doc\help or /usr/share/doc/kicad/help - * or /usr/local/share/doc/kicad/help + * typically c:\kicad\doc\help or /usr/share/kicad/help + * or /usr/local/share/kicad/help * (must have kicad in path name) * * xx = iso639-1 language id (2 letters (generic) or 4 letters): @@ -410,7 +405,7 @@ wxString FindKicadHelpPath() if( tmp.Last() == '/' ) tmp.RemoveLast(); FullPath = tmp.BeforeLast( '/' ); // cd .. - FullPath += wxT( "/help/" ); + FullPath += wxT( "/doc/help/" ); LocaleString = g_EDA_Appl->m_Locale->GetCanonicalName(); wxString path_tmp = FullPath; @@ -426,7 +421,7 @@ wxString FindKicadHelpPath() /* find kicad/help/ from environment variable KICAD */ if( !PathFound && g_EDA_Appl->m_Env_Defined ) { - FullPath = g_EDA_Appl->m_KicadEnv + wxT( "/help/" ); + FullPath = g_EDA_Appl->m_KicadEnv + wxT( "/doc/help/" ); if( wxDirExists( FullPath ) ) PathFound = TRUE; } diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index c6e16cef41..40fe72c75d 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -69,6 +69,8 @@ void WinEDA_SchematicFrame::ReCreateMenuBar() item->SetBitmap( save_as_xpm ); m_FilesMenu->Append( item ); + // Print and Plot section: + m_FilesMenu->AppendSeparator(); item = new wxMenuItem( m_FilesMenu, ID_GEN_PRINT, _( "P&rint" ), _( "Print on current printer" ) ); item->SetBitmap( print_button ); @@ -99,7 +101,6 @@ void WinEDA_SchematicFrame::ReCreateMenuBar() choice_plot_fmt->Append( item ); #endif - m_FilesMenu->AppendSeparator(); ADD_MENUITEM_WITH_HELP_AND_SUBMENU( m_FilesMenu, choice_plot_fmt, ID_GEN_PLOT, _( "&Plot" ), _( "Plot HPGL, PostScript, SVG" ), plot_xpm ); diff --git a/include/online_help.h b/include/online_help.h new file mode 100644 index 0000000000..c492d6dbf0 --- /dev/null +++ b/include/online_help.h @@ -0,0 +1,16 @@ +/******************************************************/ +/* definitions relatives to the online help for kicad */ +/******************************************************/ + +#ifndef ONLINE_HELP_H +#define ONLINE_HELP_H +/* Kicad uses HTML or PDF file format in the online help (help command) + * Comment one of these 2 lines +*/ + +#define ONLINE_HELP_FILES_FORMAT_IS_PDF + +//#define ONLINE_HELP_FILES_FORMAT_IS_HTML + + +#endif // #ifndef ONLINE_HELP_H