Commit c39385a5 authored by Dick Hollenbeck's avatar Dick Hollenbeck
Browse files

improve help file finding after kiway breakage.

parent d2e56665
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -172,6 +172,7 @@ set( COMMON_SRCS
    eda_dde.cpp
    eda_dde.cpp
    eda_doc.cpp
    eda_doc.cpp
    filter_reader.cpp
    filter_reader.cpp
#    findkicadhelppath.cpp.notused      deprecated, use searchhelpfilefullpath.cpp
    gestfich.cpp
    gestfich.cpp
    getrunningmicrosecs.cpp
    getrunningmicrosecs.cpp
    grid_tricks.cpp
    grid_tricks.cpp
@@ -189,6 +190,7 @@ set( COMMON_SRCS
    ptree.cpp
    ptree.cpp
    reporter.cpp
    reporter.cpp
    richio.cpp
    richio.cpp
    searchhelpfilefullpath.cpp
    search_stack.cpp
    search_stack.cpp
    selcolor.cpp
    selcolor.cpp
    systemdirsappend.cpp
    systemdirsappend.cpp
+36 −29
Original line number Original line Diff line number Diff line
@@ -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 )
void EDA_BASE_FRAME::PrintMsg( const wxString& text )
{
{
    SetStatusText( text );
    SetStatusText( text );
@@ -327,33 +339,28 @@ wxString EDA_BASE_FRAME::GetFileFromHistory( int cmdId, const wxString& type,


void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event )
void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event )
{
{
    wxString msg;
    const SEARCH_STACK& search = sys_search();


    /* We have to get document for beginners,
    /* 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.
     * if event id is wxID_INDEX, we want the document for beginners.
     * else the specific doc file (its name is in Kiface().GetHelpFileName())
     * else the specific doc file (its name is in Kiface().GetHelpFileName())
     * The document for beginners is the same for all KiCad utilities
     * The document for beginners is the same for all KiCad utilities
     */
     */
    if( event.GetId() == wxID_INDEX )
    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"
        // Search for "getting_started_in_kicad.pdf" or "Getting_Started_in_KiCad.pdf"
        Kiface().SetHelpFileName( wxT( "getting_started_in_kicad.pdf" ) );
        wxString helpFile = SearchHelpFileFullPath( search, wxT( "getting_started_in_kicad.pdf" ) );
        wxString helpFile = Kiface().GetHelpFile();


        if( !helpFile )
        if( !helpFile )
        {   // Try to find "Getting_Started_in_KiCad.pdf"
            helpFile = SearchHelpFileFullPath( search, wxT( "Getting_Started_in_KiCad.pdf" ) );
            Kiface().SetHelpFileName( wxT( "Getting_Started_in_KiCad.pdf" ) );
            helpFile = Kiface().GetHelpFile();
        }


        if( !helpFile )
        if( !helpFile )
        {
        {
            msg.Printf( _( "Help file %s could not be found." ),
            wxString msg = wxString::Format( _(
                        GetChars( Kiface().GetHelpFileName() ) );
                "Help file '%s' could not be found." ),
                wxT( "getting_started_in_kicad.pdf" )
                );
            wxMessageBox( msg );
            wxMessageBox( msg );
        }
        }
        else
        else
@@ -361,36 +368,36 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event )
            GetAssociatedDocument( this, helpFile );
            GetAssociatedDocument( this, helpFile );
        }
        }


        Kiface().SetHelpFileName( tmp );
        return;
        return;
    }
    }


    wxString base_name = help_name();

#if defined ONLINE_HELP_FILES_FORMAT_IS_HTML
#if defined ONLINE_HELP_FILES_FORMAT_IS_HTML


    if( Kiface().GetHtmlHelpController() == NULL )
    wxHtmlHelpController* hc = Pgm().GetHtmlHelpController();
    {
        Kiface().InitOnLineHelp();
    }


    wxString helpFile = SearchHelpFileFullPath( search,   );


    if( Kiface().GetHtmlHelpController() )
    if( !!helpFile )
    {
    {
        Kiface().GetHtmlHelpController()->DisplayContents();
        hc->UseConfig( Pgm().CommonSettings() );
        Kiface().GetHtmlHelpController()->Display( Kiface().GetHelpFileName() );
        hc->SetTitleFormat( wxT( "KiCad Help" ) );
    }
        hc->AddBook( helpFile );
    else
    {
        msg.Printf( _( "Help file %s could not be found." ), GetChars( Kiface().GetHelpFileName() ) );
        wxMessageBox( msg );
    }
    }


    hc->DisplayContents();
    hc->Display( helpFile );

#elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF
#elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF
    wxString helpFile = Kiface().GetHelpFile();
    wxString helpFile = SearchHelpFileFullPath( search, base_name );


    if( !helpFile )
    if( !helpFile )
    {
    {
        msg.Printf( _( "Help file %s could not be found." ),
        wxString msg = wxString::Format( _(
                    GetChars( Kiface().GetHelpFileName() ) );
            "Help file '%s' could not be found." ),
            GetChars( base_name )
            );
        wxMessageBox( msg );
        wxMessageBox( msg );
    }
    }
    else
    else
+10 −5
Original line number Original line Diff line number Diff line
@@ -64,15 +64,19 @@ bool GetAssociatedDocument( wxFrame* aFrame,
                            const wxPathList* aPaths)
                            const wxPathList* aPaths)


{
{
    wxString docname, fullfilename, file_ext;
    wxString docname, fullfilename;
    wxString msg;
    wxString msg;
    wxString command;
    wxString command;
    bool     success = false;
    bool     success = false;


    // Is an internet url
    // 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
        if( aDocName.First( url_header[ii] ) == 0 )   //. seems an internet url
        {
        {
@@ -133,8 +137,9 @@ bool GetAssociatedDocument( wxFrame* aFrame,
        return false;
        return false;
    }
    }


    wxFileName CurrentFileName( fullfilename );
    wxFileName currentFileName( fullfilename );
    file_ext = CurrentFileName.GetExt();

    wxString file_ext = currentFileName.GetExt();


    if( file_ext == wxT( "pdf" ) )
    if( file_ext == wxT( "pdf" ) )
    {
    {
+126 −0
Original line number Original line Diff line number Diff line

#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;
}
+86 −200
Original line number Original line Diff line number Diff line
@@ -78,66 +78,6 @@
 *  like export KICAD=/my_path/kicad if /my_path/kicad is not a default path
 *  like export KICAD=/my_path/kicad if /my_path/kicad is not a default path
 */
 */


// Path list for online help
static wxString    s_HelpPathList[] = {
#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
    wxT( "end_list" )                       // End of list symbol, do not change
};


// Path list for KiCad data files
static wxString    s_KicadDataPathList[] = {
#ifdef __WINDOWS__
    wxT( "c:/kicad/share/" ),
    wxT( "d:/kicad/share/" ),
    wxT( "c:/kicad/" ),
    wxT( "d:/kicad/" ),
    wxT( "c:/Program Files/kicad/share/" ),
    wxT( "d:/Program Files/kicad/share/" ),
    wxT( "c:/Program Files/kicad/" ),
    wxT( "d:/Program Files/kicad/" ),
#else
    wxT( "/usr/share/kicad/" ),
    wxT( "/usr/local/share/kicad/" ),
    wxT( "/usr/local/kicad/share/" ),   // default data path for "universal
                                        // tarballs" and build for a server
                                        // (new)
    wxT( "/usr/local/kicad/" ),         // default data path for "universal
                                        // tarballs" and build for a server
                                        // (old)
#endif
    wxT( "end_list" )                   // End of list symbol, do not change
};

// Path list for KiCad binary files
static wxString    s_KicadBinaryPathList[] = {
#ifdef __WINDOWS__
    wxT( "c:/kicad/bin/" ),
    wxT( "d:/kicad/bin/" ),
    wxT( "c:/Program Files/kicad/bin/" ),
    wxT( "d:/Program Files/kicad/bin/" ),
#else
    wxT( "/usr/bin/" ),
    wxT( "/usr/local/bin/" ),
    wxT( "/usr/local/kicad/bin/" ),
#endif
    wxT( "end_list" )                   // End of list symbol, do not change
};



wxString MakeReducedFileName( const wxString& fullfilename,
wxString MakeReducedFileName( const wxString& fullfilename,
                              const wxString& default_path,
                              const wxString& default_path,
@@ -281,7 +221,7 @@ wxString EDA_FileSelector( const wxString& Title,
                                   defaultname,
                                   defaultname,
                                   dotted_Ext,
                                   dotted_Ext,
                                   Mask,
                                   Mask,
                                   flag, /* open mode wxFD_OPEN, wxFD_SAVE .. */
                                   flag, // open mode wxFD_OPEN, wxFD_SAVE ..
                                   Frame,
                                   Frame,
                                   Pos.x, Pos.y );
                                   Pos.x, Pos.y );


@@ -292,123 +232,48 @@ wxString EDA_FileSelector( const wxString& Title,
}
}




wxString FindKicadHelpPath()
{
    wxString FullPath, LangFullPath, tmp;
    wxString LocaleString;
    bool     PathFound = false;

    /* find kicad/help/ */
    tmp = Pgm().GetExecutablePath();

    if( tmp.Last() == '/' )
        tmp.RemoveLast();

    FullPath     = tmp.BeforeLast( '/' ); // cd ..
    FullPath    += wxT( "/doc/help/" );
    LocaleString = Pgm().GetLocale()->GetCanonicalName();

    wxString path_tmp = FullPath;
#ifdef __WINDOWS__
    path_tmp.MakeLower();
#endif
    if( path_tmp.Contains( wxT( "kicad" ) ) )
    {
        if( wxDirExists( FullPath ) )
            PathFound = true;
    }

    /* find kicad/help/ from environment variable  KICAD */
    if( !PathFound && Pgm().IsKicadEnvVariableDefined() )
    {
        FullPath = Pgm().GetKicadEnvVariable() + wxT( "/doc/help/" );

        if( wxDirExists( FullPath ) )
            PathFound = true;
    }

    /* find kicad/help/ from "s_HelpPathList" */
    int ii = 0;

    while( !PathFound )
    {
        FullPath = s_HelpPathList[ii++];

        if( FullPath == wxT( "end_list" ) )
            break;

        if( wxDirExists( FullPath ) )
            PathFound = true;
    }

    if( PathFound )
    {
        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;
}


wxString FindKicadFile( const wxString& shortname )
wxString FindKicadFile( const wxString& shortname )
{
{
    wxString FullFileName;
    // Test the presence of the file in the directory shortname of
    // the KiCad binary path.
    wxString fullFileName = Pgm().GetExecutablePath() + shortname;


    /* Test the presence of the file in the directory shortname of
    if( wxFileExists( fullFileName ) )
     * the KiCad binary path.
        return fullFileName;
     */
    FullFileName = Pgm().GetExecutablePath() + shortname;

    if( wxFileExists( FullFileName ) )
        return FullFileName;


    /* Test the presence of the file in the directory shortname
    // Test the presence of the file in the directory shortname
     * defined by the environment variable KiCad.
    // defined by the environment variable KiCad.
     */
    if( Pgm().IsKicadEnvVariableDefined() )
    if( Pgm().IsKicadEnvVariableDefined() )
    {
    {
        FullFileName = Pgm().GetKicadEnvVariable() + shortname;
        fullFileName = Pgm().GetKicadEnvVariable() + shortname;


        if( wxFileExists( FullFileName ) )
        if( wxFileExists( fullFileName ) )
            return FullFileName;
            return fullFileName;
    }
    }


    /* find binary file from default path list:
    // find binary file from possibilities list:
     *  /usr/local/kicad/linux or c:/kicad/winexe
    //  /usr/local/kicad/linux or c:/kicad/winexe
     *  (see s_KicadDataPathList) */
    int ii = 0;


    while( 1 )
    // Path list for KiCad binary files
    {
    const static wxChar* possibilities[] = {
        if( s_KicadBinaryPathList[ii] == wxT( "end_list" ) )
#ifdef __WINDOWS__
            break;
        wxT( "c:/kicad/bin/" ),
        wxT( "d:/kicad/bin/" ),
        wxT( "c:/Program Files/kicad/bin/" ),
        wxT( "d:/Program Files/kicad/bin/" ),
#else
        wxT( "/usr/bin/" ),
        wxT( "/usr/local/bin/" ),
        wxT( "/usr/local/kicad/bin/" ),
#endif
    };


        FullFileName = s_KicadBinaryPathList[ii++] + shortname;
    for( unsigned i=0;  i<DIM(possibilities);  ++i )
    {
        fullFileName = possibilities[i] + shortname;


        if( wxFileExists( FullFileName ) )
        if( wxFileExists( fullFileName ) )
            return FullFileName;
            return fullFileName;
    }
    }


    return shortname;
    return shortname;
@@ -418,13 +283,13 @@ wxString FindKicadFile( const wxString& shortname )
int ExecuteFile( wxWindow* frame, const wxString& ExecFile, const wxString& param,
int ExecuteFile( wxWindow* frame, const wxString& ExecFile, const wxString& param,
                 wxProcess *callback )
                 wxProcess *callback )
{
{
    wxString FullFileName;
    wxString fullFileName;




    FullFileName = FindKicadFile( ExecFile );
    fullFileName = FindKicadFile( ExecFile );


#ifdef __WXMAC__
#ifdef __WXMAC__
    if( wxFileExists( FullFileName ) || wxDir::Exists( FullFileName ) )
    if( wxFileExists( fullFileName ) || wxDir::Exists( fullFileName ) )
    {
    {
        return ProcessExecute( Pgm().GetExecutablePath() + wxT( "/" )
        return ProcessExecute( Pgm().GetExecutablePath() + wxT( "/" )
                               + ExecFile + wxT( " " )
                               + ExecFile + wxT( " " )
@@ -435,16 +300,16 @@ int ExecuteFile( wxWindow* frame, const wxString& ExecFile, const wxString& para
        return ProcessExecute( wxT( "/usr/bin/open " ) + param, wxEXEC_ASYNC, callback );
        return ProcessExecute( wxT( "/usr/bin/open " ) + param, wxEXEC_ASYNC, callback );
    }
    }
#else
#else
    if( wxFileExists( FullFileName ) )
    if( wxFileExists( fullFileName ) )
    {
    {
        if( !param.IsEmpty() )
        if( !param.IsEmpty() )
            FullFileName += wxT( " " ) + param;
            fullFileName += wxT( " " ) + param;


        return ProcessExecute( FullFileName, wxEXEC_ASYNC, callback );
        return ProcessExecute( fullFileName, wxEXEC_ASYNC, callback );
    }
    }
#endif
#endif
    wxString msg;
    wxString msg;
    msg.Printf( _( "Command <%s> could not found" ), GetChars( FullFileName ) );
    msg.Printf( _( "Command <%s> could not found" ), GetChars( fullFileName ) );
    DisplayError( frame, msg, 20 );
    DisplayError( frame, msg, 20 );
    return -1;
    return -1;
}
}
@@ -452,13 +317,13 @@ int ExecuteFile( wxWindow* frame, const wxString& ExecFile, const wxString& para


wxString KicadDatasPath()
wxString KicadDatasPath()
{
{
    bool     PathFound = false;
    bool     found = false;
    wxString data_path;
    wxString data_path;


    if( Pgm().IsKicadEnvVariableDefined() ) // Path defined by the KICAD environment variable.
    if( Pgm().IsKicadEnvVariableDefined() ) // Path defined by the KICAD environment variable.
    {
    {
        data_path = Pgm().GetKicadEnvVariable();
        data_path = Pgm().GetKicadEnvVariable();
        PathFound = true;
        found = true;
    }
    }
    else    // Path of executables.
    else    // Path of executables.
    {
    {
@@ -485,33 +350,56 @@ wxString KicadDatasPath()


            if( wxDirExists( data_path ) )
            if( wxDirExists( data_path ) )
            {
            {
                PathFound = true;
                found = true;
            }
            }
            else if( wxDirExists( old_path ) )
            else if( wxDirExists( old_path ) )
            {
            {
                data_path = old_path;
                data_path = old_path;
                PathFound = true;
                found = true;
            }
            }
        }
        }
    }
    }


    /* find KiCad from default path list:
    if( !found )
     *  /usr/local/kicad/ or c:/kicad/
     *  (see s_KicadDataPathList) */
    int ii = 0;

    while( !PathFound )
    {
    {
        if( s_KicadDataPathList[ii] == wxT( "end_list" ) )
        // find KiCad from possibilities list:
            break;
        //  /usr/local/kicad/ or c:/kicad/


        data_path = s_KicadDataPathList[ii++];
        const static wxChar*  possibilities[] = {
#ifdef __WINDOWS__
            wxT( "c:/kicad/share/" ),
            wxT( "d:/kicad/share/" ),
            wxT( "c:/kicad/" ),
            wxT( "d:/kicad/" ),
            wxT( "c:/Program Files/kicad/share/" ),
            wxT( "d:/Program Files/kicad/share/" ),
            wxT( "c:/Program Files/kicad/" ),
            wxT( "d:/Program Files/kicad/" ),
#else
            wxT( "/usr/share/kicad/" ),
            wxT( "/usr/local/share/kicad/" ),
            wxT( "/usr/local/kicad/share/" ),   // default data path for "universal
                                                // tarballs" and build for a server
                                                // (new)
            wxT( "/usr/local/kicad/" ),         // default data path for "universal
                                                // tarballs" and build for a server
                                                // (old)
#endif
        };

        for( unsigned i=0;  i<DIM(possibilities);  ++i )
        {
            data_path = possibilities[i];


            if( wxDirExists( data_path ) )
            if( wxDirExists( data_path ) )
            PathFound = true;
            {
                found = true;
                break;
            }
        }
    }
    }


    if( PathFound )
    if( found )
    {
    {
        data_path.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
        data_path.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );


@@ -569,38 +457,36 @@ bool OpenPDF( const wxString& file )
        }
        }


        success = false;
        success = false;
        command.Empty();
        command.clear();


        if( !success )
        if( !success )
        {
        {
#ifndef __WINDOWS__
#if !defined(__WINDOWS__)
            AddDelimiterString( filename );
            AddDelimiterString( filename );


            /* here is a list of PDF viewers candidates */
            // here is a list of PDF viewers candidates
            const static wxString tries[] =
            static const wxChar* tries[] =
            {
            {
                wxT( "/usr/bin/evince" ),
                wxT( "/usr/bin/evince" ),
                wxT( "/usr/bin/okular" ),
                wxT( "/usr/bin/gpdf" ),
                wxT( "/usr/bin/gpdf" ),
                wxT( "/usr/bin/konqueror" ),
                wxT( "/usr/bin/konqueror" ),
                wxT( "/usr/bin/kpdf" ),
                wxT( "/usr/bin/kpdf" ),
                wxT( "/usr/bin/xpdf" ),
                wxT( "/usr/bin/xpdf" ),
                wxT( "/usr/bin/open" ),     // BSD and OSX file & dir opener
                wxT( "/usr/bin/open" ),     // BSD and OSX file & dir opener
                wxT( "/usr/bin/xdg-open" ), // Freedesktop file & dir opener
                wxT( "/usr/bin/xdg-open" ), // Freedesktop file & dir opener
                wxT( "" ),
            };
            };


            for( int ii = 0; ; ii++ )
            for( unsigned ii = 0;  ii<DIM(tries);  ii++ )
            {
            {
                if( tries[ii].IsEmpty() )
                    break;

                if( wxFileExists( tries[ii] ) )
                if( wxFileExists( tries[ii] ) )
                {
                {
                    command = tries[ii] + wxT( " " ) + filename;
                    command = tries[ii];
                    command += wxT( ' ' );
                    command += filename;
                    break;
                    break;
                }
                }
            }
            }

#endif
#endif
        }
        }
    }
    }
Loading