Commit 4861daa6 authored by charras's avatar charras

Online doc format changed to PDF format. See changelog

parent 777076c8
...@@ -5,6 +5,21 @@ Started 2007-June-11 ...@@ -5,6 +5,21 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2008-June-06 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+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 <jean-pierre.charras@inpg.fr> 2008-June-06 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
+all: +all:
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "fctsys.h" #include "fctsys.h"
#include <wx/fontdlg.h> #include <wx/fontdlg.h>
#include "common.h" #include "common.h"
#include "online_help.h"
#include "id.h" #include "id.h"
...@@ -220,6 +221,7 @@ wxString WinEDA_BasicFrame::GetLastProject( int rang ) ...@@ -220,6 +221,7 @@ wxString WinEDA_BasicFrame::GetLastProject( int rang )
void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event ) void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event )
/**************************************************************/ /**************************************************************/
{ {
#if defined ONLINE_HELP_FILES_FORMAT_IS_HTML
if( m_Parent->m_HtmlCtrl == NULL ) if( m_Parent->m_HtmlCtrl == NULL )
{ {
m_Parent->InitOnLineHelp(); m_Parent->InitOnLineHelp();
...@@ -237,6 +239,19 @@ void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event ) ...@@ -237,6 +239,19 @@ void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event )
msg.Printf( _( "Help file %s not found" ), m_Parent->m_HelpFileName.GetData() ); msg.Printf( _( "Help file %s not found" ), m_Parent->m_HelpFileName.GetData() );
DisplayError( this, msg ); 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
} }
......
...@@ -195,15 +195,17 @@ bool GetAssociatedDocument( wxFrame* frame, const wxString& LibPath, ...@@ -195,15 +195,17 @@ bool GetAssociatedDocument( wxFrame* frame, const wxString& LibPath,
{ {
success = TRUE; command.Empty(); success = TRUE; command.Empty();
if( wxFileExists( wxT( "/usr/bin/kpdf" ) ) ) if( wxFileExists( wxT( "/usr/bin/kpdf" ) ) )
command = wxT( "xpdf " ) + fullfilename; command = wxT( "kpdf " ) + fullfilename;
else if( wxFileExists( wxT( "/usr/bin/konqueror" ) ) ) else if( wxFileExists( wxT( "/usr/bin/konqueror" ) ) )
command = wxT( "konqueror " ) + fullfilename; command = wxT( "konqueror " ) + fullfilename;
else if( wxFileExists( wxT( "/usr/bin/gpdf" ) ) ) else if( wxFileExists( wxT( "/usr/bin/gpdf" ) ) )
command = wxT( "gpdf " ) + fullfilename; command = wxT( "gpdf " ) + fullfilename;
if( wxFileExists( wxT( "/usr/bin/xpdf" ) ) )
command = wxT( "xpdf " ) + fullfilename;
if( command.IsEmpty() ) // not started if( command.IsEmpty() ) // not started
{ {
DisplayError( frame, 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; success = FALSE;
} }
else else
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "build_version.h" #include "build_version.h"
#include "hotkeys_basic.h" #include "hotkeys_basic.h"
#include "macros.h" #include "macros.h"
#include "online_help.h"
#include "bitmaps.h" #include "bitmaps.h"
...@@ -223,7 +224,13 @@ void WinEDA_App::InitEDA_Appl( const wxString& name ) ...@@ -223,7 +224,13 @@ void WinEDA_App::InitEDA_Appl( const wxString& name )
} }
/* Prepare On Line Help */ /* Prepare On Line Help */
#if defined ONLINE_HELP_FILES_FORMAT_IS_HTML
m_HelpFileName = name + wxT( ".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 // Init parameters for configuration
SetVendorName( wxT( "kicad" ) ); SetVendorName( wxT( "kicad" ) );
...@@ -281,6 +288,8 @@ void WinEDA_App::InitOnLineHelp() ...@@ -281,6 +288,8 @@ void WinEDA_App::InitOnLineHelp()
{ {
wxString fullfilename = FindKicadHelpPath(); wxString fullfilename = FindKicadHelpPath();
#if defined ONLINE_HELP_FILES_FORMAT_IS_HTML
m_HelpFileName = fullfilename + wxT( ".html" );
fullfilename += wxT( "kicad.hhp" ); fullfilename += wxT( "kicad.hhp" );
if( wxFileExists( fullfilename ) ) if( wxFileExists( fullfilename ) )
{ {
...@@ -291,6 +300,11 @@ void WinEDA_App::InitOnLineHelp() ...@@ -291,6 +300,11 @@ void WinEDA_App::InitOnLineHelp()
m_HtmlCtrl->SetTitleFormat( wxT( "Kicad Help" ) ); m_HtmlCtrl->SetTitleFormat( wxT( "Kicad Help" ) );
m_HtmlCtrl->AddBook( fullfilename ); m_HtmlCtrl->AddBook( fullfilename );
} }
#elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF
m_HtmlCtrl = NULL;
#else
#error Help files format not defined
#endif
} }
......
...@@ -74,7 +74,8 @@ static wxString s_HelpPathList[] = { ...@@ -74,7 +74,8 @@ static wxString s_HelpPathList[] = {
#else #else
wxT( "/usr/share/doc/kicad/help/" ), wxT( "/usr/share/doc/kicad/help/" ),
wxT( "/usr/local/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 #endif
wxT( "end_list" ) // End of list symbol, do not change wxT( "end_list" ) // End of list symbol, do not change
}; };
...@@ -103,18 +104,12 @@ static wxString s_KicadBinaryPathList[] = { ...@@ -103,18 +104,12 @@ static wxString s_KicadBinaryPathList[] = {
#ifdef __WINDOWS__ #ifdef __WINDOWS__
wxT( "c:/kicad/bin/" ), wxT( "c:/kicad/bin/" ),
wxT( "d:/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( "c:/Program Files/kicad/bin/" ),
wxT( "d:/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 #else
wxT( "/usr/bin/" ), wxT( "/usr/bin/" ),
wxT( "/usr/local/bin/" ), wxT( "/usr/local/bin/" ),
wxT( "/usr/local/kicad/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 #endif
wxT( "end_list" ) // End of list symbol, do not change wxT( "end_list" ) // End of list symbol, do not change
}; };
...@@ -386,8 +381,8 @@ wxString FindKicadHelpPath() ...@@ -386,8 +381,8 @@ wxString FindKicadHelpPath()
* from BinDir * from BinDir
* else from environment variable KICAD * else from environment variable KICAD
* else from one of s_HelpPathList * else from one of s_HelpPathList
* typically c:\kicad\doc\help or /usr/share/doc/kicad/help * typically c:\kicad\doc\help or /usr/share/kicad/help
* or /usr/local/share/doc/kicad/help * or /usr/local/share/kicad/help
* (must have kicad in path name) * (must have kicad in path name)
* *
* xx = iso639-1 language id (2 letters (generic) or 4 letters): * xx = iso639-1 language id (2 letters (generic) or 4 letters):
...@@ -410,7 +405,7 @@ wxString FindKicadHelpPath() ...@@ -410,7 +405,7 @@ wxString FindKicadHelpPath()
if( tmp.Last() == '/' ) if( tmp.Last() == '/' )
tmp.RemoveLast(); tmp.RemoveLast();
FullPath = tmp.BeforeLast( '/' ); // cd .. FullPath = tmp.BeforeLast( '/' ); // cd ..
FullPath += wxT( "/help/" ); FullPath += wxT( "/doc/help/" );
LocaleString = g_EDA_Appl->m_Locale->GetCanonicalName(); LocaleString = g_EDA_Appl->m_Locale->GetCanonicalName();
wxString path_tmp = FullPath; wxString path_tmp = FullPath;
...@@ -426,7 +421,7 @@ wxString FindKicadHelpPath() ...@@ -426,7 +421,7 @@ wxString FindKicadHelpPath()
/* find kicad/help/ from environment variable KICAD */ /* find kicad/help/ from environment variable KICAD */
if( !PathFound && g_EDA_Appl->m_Env_Defined ) 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 ) ) if( wxDirExists( FullPath ) )
PathFound = TRUE; PathFound = TRUE;
} }
......
...@@ -69,6 +69,8 @@ void WinEDA_SchematicFrame::ReCreateMenuBar() ...@@ -69,6 +69,8 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
item->SetBitmap( save_as_xpm ); item->SetBitmap( save_as_xpm );
m_FilesMenu->Append( item ); m_FilesMenu->Append( item );
// Print and Plot section:
m_FilesMenu->AppendSeparator();
item = new wxMenuItem( m_FilesMenu, ID_GEN_PRINT, item = new wxMenuItem( m_FilesMenu, ID_GEN_PRINT,
_( "P&rint" ), _( "Print on current printer" ) ); _( "P&rint" ), _( "Print on current printer" ) );
item->SetBitmap( print_button ); item->SetBitmap( print_button );
...@@ -99,7 +101,6 @@ void WinEDA_SchematicFrame::ReCreateMenuBar() ...@@ -99,7 +101,6 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
choice_plot_fmt->Append( item ); choice_plot_fmt->Append( item );
#endif #endif
m_FilesMenu->AppendSeparator();
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( m_FilesMenu, choice_plot_fmt, ADD_MENUITEM_WITH_HELP_AND_SUBMENU( m_FilesMenu, choice_plot_fmt,
ID_GEN_PLOT, _( "&Plot" ), ID_GEN_PLOT, _( "&Plot" ),
_( "Plot HPGL, PostScript, SVG" ), plot_xpm ); _( "Plot HPGL, PostScript, SVG" ), plot_xpm );
......
/******************************************************/
/* 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
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