Commit c39385a5 authored by Dick Hollenbeck's avatar Dick Hollenbeck

improve help file finding after kiway breakage.

parent d2e56665
......@@ -172,6 +172,7 @@ set( COMMON_SRCS
eda_dde.cpp
eda_doc.cpp
filter_reader.cpp
# findkicadhelppath.cpp.notused deprecated, use searchhelpfilefullpath.cpp
gestfich.cpp
getrunningmicrosecs.cpp
grid_tricks.cpp
......@@ -189,6 +190,7 @@ set( COMMON_SRCS
ptree.cpp
reporter.cpp
richio.cpp
searchhelpfilefullpath.cpp
search_stack.cpp
selcolor.cpp
systemdirsappend.cpp
......
......@@ -271,6 +271,18 @@ wxConfigBase* EDA_BASE_FRAME::config()
}
const SEARCH_STACK& EDA_BASE_FRAME::sys_search()
{
return Kiface().KifaceSearch();
}
wxString EDA_BASE_FRAME::help_name()
{
return Kiface().GetHelpFileName();
}
void EDA_BASE_FRAME::PrintMsg( const wxString& text )
{
SetStatusText( text );
......@@ -327,33 +339,28 @@ wxString EDA_BASE_FRAME::GetFileFromHistory( int cmdId, const wxString& type,
void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event )
{
wxString msg;
const SEARCH_STACK& search = sys_search();
/* We have to get document for beginners,
* or the the full specific doc
* or the full specific doc
* if event id is wxID_INDEX, we want the document for beginners.
* else the specific doc file (its name is in Kiface().GetHelpFileName())
* The document for beginners is the same for all KiCad utilities
*/
if( event.GetId() == wxID_INDEX )
{
// Temporarily change the help filename
wxString tmp = Kiface().GetHelpFileName();
// Search for "getting_started_in_kicad.pdf" or "Getting_Started_in_KiCad.pdf"
Kiface().SetHelpFileName( wxT( "getting_started_in_kicad.pdf" ) );
wxString helpFile = Kiface().GetHelpFile();
wxString helpFile = SearchHelpFileFullPath( search, wxT( "getting_started_in_kicad.pdf" ) );
if( !helpFile )
{ // Try to find "Getting_Started_in_KiCad.pdf"
Kiface().SetHelpFileName( wxT( "Getting_Started_in_KiCad.pdf" ) );
helpFile = Kiface().GetHelpFile();
}
helpFile = SearchHelpFileFullPath( search, wxT( "Getting_Started_in_KiCad.pdf" ) );
if( !helpFile )
{
msg.Printf( _( "Help file %s could not be found." ),
GetChars( Kiface().GetHelpFileName() ) );
wxString msg = wxString::Format( _(
"Help file '%s' could not be found." ),
wxT( "getting_started_in_kicad.pdf" )
);
wxMessageBox( msg );
}
else
......@@ -361,36 +368,36 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event )
GetAssociatedDocument( this, helpFile );
}
Kiface().SetHelpFileName( tmp );
return;
}
wxString base_name = help_name();
#if defined ONLINE_HELP_FILES_FORMAT_IS_HTML
if( Kiface().GetHtmlHelpController() == NULL )
{
Kiface().InitOnLineHelp();
}
wxHtmlHelpController* hc = Pgm().GetHtmlHelpController();
wxString helpFile = SearchHelpFileFullPath( search, );
if( Kiface().GetHtmlHelpController() )
if( !!helpFile )
{
Kiface().GetHtmlHelpController()->DisplayContents();
Kiface().GetHtmlHelpController()->Display( Kiface().GetHelpFileName() );
}
else
{
msg.Printf( _( "Help file %s could not be found." ), GetChars( Kiface().GetHelpFileName() ) );
wxMessageBox( msg );
hc->UseConfig( Pgm().CommonSettings() );
hc->SetTitleFormat( wxT( "KiCad Help" ) );
hc->AddBook( helpFile );
}
hc->DisplayContents();
hc->Display( helpFile );
#elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF
wxString helpFile = Kiface().GetHelpFile();
wxString helpFile = SearchHelpFileFullPath( search, base_name );
if( !helpFile )
{
msg.Printf( _( "Help file %s could not be found." ),
GetChars( Kiface().GetHelpFileName() ) );
wxString msg = wxString::Format( _(
"Help file '%s' could not be found." ),
GetChars( base_name )
);
wxMessageBox( msg );
}
else
......
......@@ -64,15 +64,19 @@ bool GetAssociatedDocument( wxFrame* aFrame,
const wxPathList* aPaths)
{
wxString docname, fullfilename, file_ext;
wxString docname, fullfilename;
wxString msg;
wxString command;
bool success = false;
// Is an internet url
static const wxString url_header[3] = { wxT( "http:" ), wxT( "ftp:" ), wxT( "www." ) };
static const wxChar* url_header[3] = {
wxT( "http:" ),
wxT( "ftp:" ),
wxT( "www." )
};
for( int ii = 0; ii < 3; ii++ )
for( unsigned ii = 0; ii < DIM(url_header); ii++ )
{
if( aDocName.First( url_header[ii] ) == 0 ) //. seems an internet url
{
......@@ -133,8 +137,9 @@ bool GetAssociatedDocument( wxFrame* aFrame,
return false;
}
wxFileName CurrentFileName( fullfilename );
file_ext = CurrentFileName.GetExt();
wxFileName currentFileName( fullfilename );
wxString file_ext = currentFileName.GetExt();
if( file_ext == wxT( "pdf" ) )
{
......
#include <fctsys.h>
#include <pgm_base.h>
#include <macros.h>
#include <gestfich.h>
/**
* Function FindKicadHelpPath
* finds the absolute path for KiCad "help" (or "help/&ltlanguage&gt")
* Find path kicad/doc/help/xx/ or kicad/doc/help/:
* from BinDir
* else from environment variable KICAD
* else from one of s_HelpPathList
* 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):
* fr = french (or fr_FR)
* en = English (or en_GB or en_US ...)
* de = deutch
* es = spanish
* pt = portuguese (or pt_BR ...)
*
* default = en (if not found = fr)
*/
wxString FindKicadHelpPath()
{
bool found = false;
wxString bin_dir = Pgm().GetExecutablePath();
if( bin_dir.Last() == '/' )
bin_dir.RemoveLast();
wxString fullPath = bin_dir.BeforeLast( '/' ); // cd ..
fullPath += wxT( "/doc/help/" );
wxString localeString = Pgm().GetLocale()->GetCanonicalName();
wxString path_tmp = fullPath;
#ifdef __WINDOWS__
path_tmp.MakeLower();
#endif
if( path_tmp.Contains( wxT( "kicad" ) ) )
{
if( wxDirExists( fullPath ) )
found = true;
}
// find kicad/help/ from environment variable KICAD
if( !found && Pgm().IsKicadEnvVariableDefined() )
{
fullPath = Pgm().GetKicadEnvVariable() + wxT( "/doc/help/" );
if( wxDirExists( fullPath ) )
found = true;
}
if( !found )
{
// Possibilities online help
const static wxChar* possibilities[] = {
#ifdef __WINDOWS__
wxT( "c:/kicad/doc/help/" ),
wxT( "d:/kicad/doc/help/" ),
wxT( "c:/Program Files/kicad/doc/help/" ),
wxT( "d:/Program Files/kicad/doc/help/" ),
#else
wxT( "/usr/share/doc/kicad/help/" ),
wxT( "/usr/local/share/doc/kicad/help/" ),
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
};
for( unsigned i=0; i<DIM(possibilities); ++i )
{
fullPath = possibilities[i];
if( wxDirExists( fullPath ) )
{
found = true;
break;
}
}
}
if( found )
{
wxString langFullPath = fullPath + localeString + UNIX_STRING_DIR_SEP;
if( wxDirExists( langFullPath ) )
return langFullPath;
langFullPath = fullPath + localeString.Left( 2 ) + UNIX_STRING_DIR_SEP;
if( wxDirExists( langFullPath ) )
return langFullPath;
langFullPath = fullPath + wxT( "en/" );
if( wxDirExists( langFullPath ) )
{
return langFullPath;
}
else
{
langFullPath = fullPath + wxT( "fr/" );
if( wxDirExists( langFullPath ) )
return langFullPath;
}
return fullPath;
}
return wxEmptyString;
}
This diff is collapsed.
......@@ -55,10 +55,11 @@ static void setSearchPaths( SEARCH_STACK* aDst, KIWAY::FACE_T aId )
// we must add <kicad path>/library and <kicad path>/library/doc
if( aId == KIWAY::FACE_SCH )
{
// Add schematic doc file path (library/doc) to search path list.
fn.AppendDir( wxT( "library" ) );
aDst->AddPaths( fn.GetPath() );
// Add schematic doc file path (library/doc)to search path list.
fn.AppendDir( wxT( "doc" ) );
aDst->AddPaths( fn.GetPath() );
......@@ -85,8 +86,10 @@ static void setSearchPaths( SEARCH_STACK* aDst, KIWAY::FACE_T aId )
aDst->AddPaths( fn.GetPath() );
}
aDst->AddPaths( wxT( "/usr/local/share" ) );
#if 1 && defined(DEBUG)
aDst->Show( "kiway" );
aDst->Show( "kiface" );
#endif
}
......@@ -121,86 +124,3 @@ void KIFACE_I::end_common()
m_bm.End();
}
wxString KIFACE_I::GetHelpFile()
{
wxString fn;
wxArrayString subdirs;
wxArrayString altsubdirs;
// FIXME: This is not the ideal way to handle this. Unfortunately, the
// CMake install paths seem to be a moving target so this crude
// hack solves the problem of install path differences between
// Windows and non-Windows platforms.
// Partially fixed, but must be enhanced
// Create subdir tree for "standard" linux distributions, when KiCad comes
// from a distribution files are in /usr/share/doc/kicad/help and binaries
// in /usr/bin or /usr/local/bin
subdirs.Add( wxT( "share" ) );
subdirs.Add( wxT( "doc" ) );
subdirs.Add( wxT( "kicad" ) );
subdirs.Add( wxT( "help" ) );
// Create subdir tree for linux and Windows KiCad pack.
// Note the pack form under linux is also useful if a user wants to
// install KiCad to a server because there is only one path to mount
// or export (something like /usr/local/kicad).
// files are in <install dir>/kicad/doc/help
// (often /usr/local/kicad/kicad/doc/help)
// <install dir>/kicad/ is retrieved from m_BinDir
altsubdirs.Add( wxT( "doc" ) );
altsubdirs.Add( wxT( "help" ) );
/* Search for a help file.
* we *must* find a help file.
* so help is searched in directories in this order:
* help/<canonical name> like help/en_GB
* help/<short name> like help/en
* help/en
*/
wxLocale* i18n = Pgm().GetLocale();
// Step 1 : Try to find help file in help/<canonical name>
subdirs.Add( i18n->GetCanonicalName() );
altsubdirs.Add( i18n->GetCanonicalName() );
fn = m_bm.m_search.FindFileInSearchPaths( m_bm.m_help_file, &altsubdirs );
if( !fn )
fn = m_bm.m_search.FindFileInSearchPaths( m_bm.m_help_file, &subdirs );
// Step 2 : if not found Try to find help file in help/<short name>
if( !fn )
{
subdirs.RemoveAt( subdirs.GetCount() - 1 );
altsubdirs.RemoveAt( altsubdirs.GetCount() - 1 );
// wxLocale::GetName() does not return always the short name
subdirs.Add( i18n->GetName().BeforeLast( '_' ) );
altsubdirs.Add( i18n->GetName().BeforeLast( '_' ) );
fn = m_bm.m_search.FindFileInSearchPaths( m_bm.m_help_file, &altsubdirs );
if( !fn )
fn = m_bm.m_search.FindFileInSearchPaths( m_bm.m_help_file, &subdirs );
}
// Step 3 : if not found Try to find help file in help/en
if( !fn )
{
subdirs.RemoveAt( subdirs.GetCount() - 1 );
altsubdirs.RemoveAt( altsubdirs.GetCount() - 1 );
subdirs.Add( wxT( "en" ) );
altsubdirs.Add( wxT( "en" ) );
fn = m_bm.m_search.FindFileInSearchPaths( m_bm.m_help_file, &altsubdirs );
if( !fn )
fn = m_bm.m_search.FindFileInSearchPaths( m_bm.m_help_file, &subdirs );
}
return fn;
}
......@@ -297,6 +297,13 @@ void PGM_BASE::destroy()
delete m_locale;
m_locale = 0;
/*
// Close the help frame
if( m_html_ctrl && m_html_ctrl->GetFrame() ) // returns NULL if no help frame active
m_html_ctrl->GetFrame()->Close( true );
}
*/
delete m_html_ctrl;
m_html_ctrl = 0;
}
......@@ -415,30 +422,18 @@ bool PGM_BASE::initPgm()
}
void PGM_BASE::SetHtmlHelpController( wxHtmlHelpController* aController )
void PGM_BASE::initHtmlHelpController()
{
delete m_html_ctrl;
m_html_ctrl = aController;
}
void PGM_BASE::InitOnLineHelp()
{
wxString fullfilename = FindKicadHelpPath();
#if defined ONLINE_HELP_FILES_FORMAT_IS_HTML
m_HelpFileName = fullfilename + wxT( ".html" );
fullfilename += wxT( "kicad.hhp" );
if( wxFileExists( fullfilename ) )
{
m_html_ctrl = new wxHtmlHelpController( wxHF_TOOLBAR | wxHF_CONTENTS |
wxHF_PRINT | wxHF_OPEN_FILES
/*| wxHF_SEARCH */ );
m_html_ctrl->UseConfig( m_common_settings );
m_html_ctrl->SetTitleFormat( wxT( "KiCad Help" ) );
m_html_ctrl->AddBook( fullfilename );
}
if( !m_html_ctrl )
m_html_ctrl = new wxHtmlHelpController(
wxHF_TOOLBAR | wxHF_CONTENTS |
wxHF_PRINT | wxHF_OPEN_FILES
// | wxHF_SEARCH
);
wxASSERT( m_html_ctrl ); // may not leave here as NULL
#elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF
m_html_ctrl = NULL;
......@@ -449,10 +444,22 @@ void PGM_BASE::InitOnLineHelp()
}
wxHtmlHelpController* PGM_BASE::HtmlHelpController()
{
if( !m_html_ctrl )
initHtmlHelpController();
// there should not be calls to this unless ONLINE_HELP_FILES_FORMAT_IS_HTML is defined
wxASSERT( m_html_ctrl );
return m_html_ctrl;
}
bool PGM_BASE::setExecutablePath()
{
// Apple MacOSx
#ifdef __APPLE__
#ifdef __APPLE__ // Apple MacOSx
// Derive path from location of the app bundle
CFBundleRef mainBundle = CFBundleGetMainBundle();
......
......@@ -104,31 +104,6 @@ void SEARCH_STACK::AddPaths( const wxString& aPaths, int aIndex )
}
wxString SEARCH_STACK::FindFileInSearchPaths(
const wxString& aFilename, const wxArrayString* aSubdirs )
{
wxPathList paths;
for( unsigned i = 0; i < GetCount(); ++i )
{
wxFileName fn( (*this)[i] );
if( aSubdirs )
{
for( unsigned j = 0; j < aSubdirs->GetCount(); j++ )
fn.AppendDir( (*aSubdirs)[j] );
}
if( fn.DirExists() )
{
paths.Add( fn.GetPath() );
}
}
return paths.FindValidPath( aFilename );
}
void RETAINED_PATH::Clear()
{
m_retained_path.Clear();
......
#include <pgm_base.h>
#include <common.h>
/**
* Function FindFileInSearchPaths
* looks in "this" for \a aFilename, but first modifies every search
* path by appending a list of path fragments from aSubdirs. That modification
* is not rentative.
*/
wxString FindFileInSearchPaths( const SEARCH_STACK& aStack,
const wxString& aFilename, const wxArrayString* aSubdirs )
{
wxPathList paths;
for( unsigned i = 0; i < aStack.GetCount(); ++i )
{
wxFileName fn( aStack[i], wxEmptyString );
if( aSubdirs )
{
for( unsigned j = 0; j < aSubdirs->GetCount(); j++ )
fn.AppendDir( (*aSubdirs)[j] );
}
if( fn.DirExists() )
{
paths.Add( fn.GetPath() );
}
}
return paths.FindValidPath( aFilename );
}
// See also FindKicadHelpPath.cpp.notused.
wxString SearchHelpFileFullPath( const SEARCH_STACK& aSStack, const wxString& aBaseName )
{
wxArrayString subdirs;
wxArrayString altsubdirs;
SEARCH_STACK ss = aSStack;
// It might already be in aSStack, but why depend on other code
// far away when it's so easy to add it again (to our copy) as the first place to look.
// This is CMAKE_INSTALL_PREFIX:
ss.AddPaths( wxT( DEFAULT_INSTALL_PATH ), 0 );
// If there's a KICAD environment variable set, use that guy's path also
ss.AddPaths( Pgm().GetKicadEnvVariable(), 0 );
#if 1 // && defined(__linux__)
// Based on kicad-doc.bzr/CMakeLists.txt, line 20, the help files are
// installed into "<CMAKE_INSTALL_PREFIX>/share/doc/kicad/help" for linux.
// This is ${KICAD_HELP} var in that CMakeLists.txt file.
// Below we account for an international subdirectory.
subdirs.Add( wxT( "share" ) );
subdirs.Add( wxT( "doc" ) );
subdirs.Add( wxT( "kicad" ) );
subdirs.Add( wxT( "help" ) );
#endif
#if 1 // && defined(__WINDOWS__)
// Based on kicad-doc.bzr/CMakeLists.txt, line 35, the help files are
// installed into "<CMAKE_INSTALL_PREFIX>/doc/help" for Windows.
// This is ${KICAD_HELP} var in that CMakeLists.txt file.
// Below we account for an international subdirectory.
altsubdirs.Add( wxT( "doc" ) );
altsubdirs.Add( wxT( "help" ) );
#endif
/* Search for a help file.
* we *must* find a help file.
* so help is searched in directories in this order:
* help/<canonical name> like help/en_GB
* help/<short name> like help/en
* help/en
*/
wxLocale* i18n = Pgm().GetLocale();
// Step 1 : Try to find help file in help/<canonical name>
subdirs.Add( i18n->GetCanonicalName() );
altsubdirs.Add( i18n->GetCanonicalName() );
#if defined(DEBUG) && 0
ss.Show( __func__ );
printf( "%s: m_help_file:'%s'\n", __func__, TO_UTF8( aBaseName ) );
#endif
wxString fn = FindFileInSearchPaths( ss, aBaseName, &altsubdirs );
if( !fn )
fn = FindFileInSearchPaths( ss, aBaseName, &subdirs );
// Step 2 : if not found Try to find help file in help/<short name>
if( !fn )
{
subdirs.RemoveAt( subdirs.GetCount() - 1 );
altsubdirs.RemoveAt( altsubdirs.GetCount() - 1 );
// wxLocale::GetName() does not return always the short name
subdirs.Add( i18n->GetName().BeforeLast( '_' ) );
altsubdirs.Add( i18n->GetName().BeforeLast( '_' ) );
fn = FindFileInSearchPaths( ss, aBaseName, &altsubdirs );
if( !fn )
fn = FindFileInSearchPaths( ss, aBaseName, &subdirs );
}
// Step 3 : if not found Try to find help file in help/en
if( !fn )
{
subdirs.RemoveAt( subdirs.GetCount() - 1 );
altsubdirs.RemoveAt( altsubdirs.GetCount() - 1 );
subdirs.Add( wxT( "en" ) );
altsubdirs.Add( wxT( "en" ) );
fn = FindFileInSearchPaths( ss, aBaseName, &altsubdirs );
if( !fn )
fn = FindFileInSearchPaths( ss, aBaseName, &subdirs );
}
return fn;
}
......@@ -301,13 +301,6 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
}
}
// Close the help frame
if( Pgm().GetHtmlHelpController() )
{
if( Pgm().GetHtmlHelpController()->GetFrame() )// returns NULL if no help frame active
Pgm().GetHtmlHelpController()->GetFrame()->Close( true );
}
if( m_NetlistFileName.IsOk() )
{
UpdateFileHistory( m_NetlistFileName.GetFullPath() );
......
......@@ -59,6 +59,8 @@ struct BIN_MOD
wxString m_help_file;
SEARCH_STACK m_search;
};
#endif // BIN_MOD_H_
......@@ -589,4 +589,25 @@ wxString FormatDateLong( const wxDateTime &aDate );
*/
void SystemDirsAppend( SEARCH_STACK* aSearchStack );
/**
* Function SearchHelpFileFullPath
* returns the help file's full path.
* <p>
* Return the KiCad help file with path.
* If the help file for the current locale is not found, an attempt to find
* the English version of the help file is made.
* Help file is searched in directories in this order:
* help/\<canonical name\> like help/en_GB
* help/\<short name\> like help/en
* help/en
* </p>
* @param aSearchStack contains some possible base dirs that may be above the
* the one actually holding @a aBaseName. These are starting points for nested searches.
* @param aBaseName is the name of the help file to search for.
* @return wxEmptyString is returned if aBaseName is not found, else the full path & filename.
*/
wxString SearchHelpFileFullPath( const SEARCH_STACK& aSearchStack, const wxString& aBaseName );
#endif // INCLUDE__COMMON_H_
......@@ -89,28 +89,6 @@ int ExecuteFile( wxWindow* frame, const wxString& ExecFile,
*/
void AddDelimiterString( wxString& string );
/**
* Function FindKicadHelpPath
* finds the absolute path for KiCad "help" (or "help/&ltlanguage&gt")
* Find path kicad/doc/help/xx/ or kicad/doc/help/:
* from BinDir
* else from environment variable KICAD
* else from one of s_HelpPathList
* 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):
* fr = french (or fr_FR)
* en = English (or en_GB or en_US ...)
* de = deutch
* es = spanish
* pt = portuguese (or pt_BR ...)
*
* default = en (if not found = fr)
*/
wxString FindKicadHelpPath();
/**
* Function KicadDatasPath
* returns the data path common to KiCad.
......
......@@ -100,33 +100,17 @@ public:
wxConfigBase* KifaceSettings() const { return m_bm.m_config; }
const wxString& GetHelpFileName() const { return m_bm.m_help_file; }
void SetHelpFileName( const wxString& aFileName ) { m_bm.m_help_file = aFileName; }
/**
* Function GetHelpFile
* gets the help file path.
* <p>
* Return the KiCad help file with path. The base paths defined in
* m_searchPaths are tested for a valid file. The path returned can
* be relative depending on the paths added to m_searchPaths. See the
* documentation for wxPathList for more information. If the help file
* for the current locale is not found, an attempt to find the English
* version of the help file is made.
* wxEmptyString is returned if help file not found.
* Help file is searched in directories in this order:
* help/\<canonical name\> like help/en_GB
* help/\<short name\> like help/en
* help/en
* </p>
* Function GetHelpFileName
* returns just the basename portion of the current help file.
*/
wxString GetHelpFile();
const wxString& GetHelpFileName() const { return m_bm.m_help_file; }
wxFileHistory& GetFileHistory() { return m_bm.m_history; }
wxFileHistory& GetFileHistory() { return m_bm.m_history; }
/// Only for DSO specific 'non-library' files.
/// (The library search path is in the PROJECT class.)
SEARCH_STACK& KifaceSearch() { return m_bm.m_search; }
SEARCH_STACK& KifaceSearch() { return m_bm.m_search; }
private:
KIWAY::FACE_T m_id;
......
......@@ -86,9 +86,7 @@ public:
//----<Cross Module API>-----------------------------------------------------
VTBL_ENTRY wxHtmlHelpController* GetHtmlHelpController() { return m_html_ctrl; }
VTBL_ENTRY void SetHtmlHelpController( wxHtmlHelpController* aController );
VTBL_ENTRY wxHtmlHelpController* HtmlHelpController();
VTBL_ENTRY wxConfigBase* CommonSettings() const { return m_common_settings; }
......@@ -161,12 +159,6 @@ public:
VTBL_ENTRY void SetLanguagePath();
/**
* Function InitOnLineHelp
* initializes KiCad's online help.
*/
VTBL_ENTRY void InitOnLineHelp();
/**
* Function ReadPdfBrowserInfos
* reads the PDF browser choice from the common configuration.
......@@ -217,6 +209,8 @@ protected:
*/
bool initPgm();
void initHtmlHelpController();
/**
* Function loadCommonSettings
* loads the program (process) settings subset which are stored in .kicad_common
......
......@@ -57,15 +57,6 @@ public:
* ";" on windows, or ":" | ";" on unix.
*/
void RemovePaths( const wxString& aPaths );
/**
* Function FindFileInSearchPaths
* looks in "this" for \a aFilename, but first modifies every search
* path by appending a list of path fragments from aSubdirs. That modification
* is not rentative.
*/
wxString FindFileInSearchPaths( const wxString& aFilename,
const wxArrayString* aSubdirs = NULL );
};
......
......@@ -186,6 +186,15 @@ protected:
*/
virtual wxConfigBase* config();
/**
* Function sys_search
* returns a SEARCH_STACK pertaining to entire program, and is overloaded in
* KICAD_MANAGER_FRAME
*/
virtual const SEARCH_STACK& sys_search();
virtual wxString help_name();
public:
EDA_BASE_FRAME( wxWindow* aParent, ID_DRAWFRAME_TYPE aFrameType,
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
......
......@@ -123,6 +123,11 @@ class KICAD_MANAGER_FRAME : public EDA_BASE_FRAME
protected:
wxConfigBase* config(); // override EDA_BASE_FRAME virtual
const SEARCH_STACK& sys_search(); // override EDA_BASE_FRAME virtual
wxString help_name(); // override EDA_BASE_FRAME virtual
public:
TREE_PROJECT_FRAME* m_LeftWin;
LAUNCHER_PANEL* m_Launcher;
......
......@@ -123,6 +123,18 @@ wxConfigBase* KICAD_MANAGER_FRAME::config()
}
const SEARCH_STACK& KICAD_MANAGER_FRAME::sys_search()
{
return Pgm().SysSearch();
}
wxString KICAD_MANAGER_FRAME::help_name()
{
return Pgm().GetHelpFileName();
}
void KICAD_MANAGER_FRAME::PrintMsg( const wxString& aText )
{
m_MessagesBox->AppendText( aText );
......@@ -157,15 +169,6 @@ void KICAD_MANAGER_FRAME::OnCloseWindow( wxCloseEvent& Event )
Event.SetCanVeto( true );
// Close the help frame
if( Pgm().GetHtmlHelpController() )
{
if( Pgm().GetHtmlHelpController()->GetFrame() ) // returns NULL if no help frame active
Pgm().GetHtmlHelpController()->GetFrame()->Close( true );
Pgm().SetHtmlHelpController( NULL );
}
m_LeftWin->Show( false );
Destroy();
......
......@@ -58,6 +58,8 @@ public:
SEARCH_STACK& SysSearch() { return m_bm.m_search; }
wxString GetHelpFileName() { return m_bm.m_help_file; }
protected:
// The PGM_* classes can have difficulties at termination if they
......
......@@ -94,10 +94,10 @@ static const wxChar* s_allowedExtensionsToList[] =
*/
/* File extension definitions. */
const wxString TextFileExtension( wxT( "txt" ) );
const wxChar TextFileExtension[] = wxT( "txt" );
/* File wildcard definitions. */
const wxString TextFileWildcard( wxT( "Text files (*.txt)|*.txt" ) );
const wxChar TextFileWildcard[] = wxT( "Text files (*.txt)|*.txt" );
/**
......@@ -177,7 +177,6 @@ void TREE_PROJECT_FRAME::RemoveFilter( const wxString& filter )
}
/**
* Called by the popup menu in the tree frame
* Creates a new subdirectory inside the current kicad project directory
......
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