Commit 295b5b5d authored by Jacobo Aragunde Perez's avatar Jacobo Aragunde Perez Committed by jean-pierre charras
Browse files

Add patch from Jacobo Aragunde Perez <Log of opened and closed applications in KiCad launcher>

parent 07273ac4
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -313,15 +313,9 @@ wxString GenDate()
}


bool ProcessExecute( const wxString& aCommandLine, int aFlags )
int ProcessExecute( const wxString& aCommandLine, int aFlags, wxProcess *callback )
{
#ifdef __WINDOWS__
    int        pid = wxExecute( aCommandLine );
    return pid ? true : false;
#else
    wxProcess* process = wxProcess::Open( aCommandLine, aFlags );
    return (process != NULL) ? true : false;
#endif
    return wxExecute( aCommandLine, aFlags, callback );
}


+10 −7
Original line number Diff line number Diff line
@@ -415,7 +415,8 @@ 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 )
{
    wxString FullFileName;

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

        ProcessExecute( FullFileName );
        return 0;
        return ProcessExecute( FullFileName, wxEXEC_ASYNC, callback );
    }
#endif
    wxString msg;
+6 −2
Original line number Diff line number Diff line
@@ -555,9 +555,13 @@ bool EnsureTextCtrlWidth( wxTextCtrl* aCtrl, const wxString* aString = NULL );
 * @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
 * @param callback wxProcess implementing OnTerminate to be run when the
                   child process finishes
 * @return int - pid of process, 0 in case of error (like return values of
 *               wxExecute())
 */
bool ProcessExecute( const wxString& aCommandLine, int aFlags = wxEXEC_ASYNC );
int ProcessExecute( const wxString& aCommandLine, int aFlags = wxEXEC_ASYNC,
                     wxProcess *callback = NULL );


/*******************/
+2 −1
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@
#define __INCLUDE__GESTFICH_H__ 1

#include <wx/filename.h>
#include <wx/process.h>


/* Forward class declarations. */
@@ -79,7 +80,7 @@ EDA_LIST_DIALOG* GetFileNames( char* Directory, char* Mask );
 * calls the executable file \a ExecFile with the command line parameters \a param.
 */
int ExecuteFile( wxWindow* frame, const wxString& ExecFile,
                 const wxString& param = wxEmptyString );
                 const wxString& param = wxEmptyString, wxProcess *callback = NULL );

/**
 * Function AddDelimiterString
+8 −5
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@
#include <macros.h>

#include <kicad.h>
#include <appl_wxstruct.h>
#include <tree_project_frame.h>
#include <class_treeprojectfiles.h>
#include <class_treeproject_item.h>
@@ -188,6 +189,7 @@ void TREEPROJECT_ITEM::Activate( TREE_PROJECT_FRAME* prjframe )
    wxString        sep = wxFileName().GetPathSeparator();
    wxString        FullFileName = GetFileName();
    wxTreeItemId    id = GetId();
    KICAD_MANAGER_FRAME* mainFrame = (KICAD_MANAGER_FRAME*) wxGetApp().GetTopWindow();

    AddDelimiterString( FullFileName );

@@ -201,16 +203,16 @@ void TREEPROJECT_ITEM::Activate( TREE_PROJECT_FRAME* prjframe )
        break;

    case TREE_SCHEMA:
        ExecuteFile( m_parent, EESCHEMA_EXE, FullFileName );
        mainFrame->Execute( m_parent, EESCHEMA_EXE, FullFileName );
        break;

    case TREE_LEGACY_PCB:
    case TREE_SEXP_PCB:
        ExecuteFile( m_parent, PCBNEW_EXE, FullFileName );
        mainFrame->Execute( m_parent, PCBNEW_EXE, FullFileName );
        break;

    case TREE_GERBER:
        ExecuteFile( m_parent, GERBVIEW_EXE, FullFileName );
        mainFrame->Execute( m_parent, GERBVIEW_EXE, FullFileName );
        break;

    case TREE_PDF:
@@ -218,7 +220,7 @@ void TREEPROJECT_ITEM::Activate( TREE_PROJECT_FRAME* prjframe )
        break;

    case TREE_NET:
        ExecuteFile( m_parent, CVPCB_EXE, FullFileName );
        mainFrame->Execute( m_parent, CVPCB_EXE, FullFileName );
        break;

    case TREE_TXT:
@@ -226,7 +228,7 @@ void TREEPROJECT_ITEM::Activate( TREE_PROJECT_FRAME* prjframe )
            wxString editorname = wxGetApp().GetEditorName();

            if( !editorname.IsEmpty() )
                ExecuteFile( m_parent, editorname, FullFileName );
                mainFrame->Execute( m_parent, editorname, FullFileName );

            break;
        }
@@ -235,4 +237,5 @@ void TREEPROJECT_ITEM::Activate( TREE_PROJECT_FRAME* prjframe )
        OpenFile( FullFileName );
        break;
    }

}
Loading