Commit 5b3c5861 authored by stambaughw's avatar stambaughw
Browse files

More search path, compiler warning, and bug fixes.

Added template subdirectory to library search path list.
Removed PARAM_CFG_BASE empty destructor to prevent GCC warning.
Set timeout to 0 on DisplayInfo call to prevent debug assertion in eeschema/files-io.cpp.
Declare PARAM_CFG_ARRAY for future project file object implementation.
Removed unnecessary COMMON_GLOBL definition in gr_basic.h and param_config.h.
parent 0706234d
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -105,7 +105,8 @@ void DisplayInfo( wxWindow* parent, const wxString& text, int displaytime )
    dialog = new WinEDA_MessageDialog( parent, text, _( "Info:" ),
                                       wxOK | wxICON_INFORMATION, displaytime );

    dialog->ShowModal(); dialog->Destroy();
    dialog->ShowModal();
    dialog->Destroy();
}


+15 −4
Original line number Diff line number Diff line
@@ -528,14 +528,21 @@ void WinEDA_App::SetDefaultSearchPaths( void )
        }
        else
        {
            /* Build schematic, PCB, and 3D module library file search path
             * list based on the known existing default search paths. */
            /* Add schematic library file path to search path list. */
            fn.Clear();
            fn.SetPath( m_searchPaths[i] );
            fn.AppendDir( wxT( "library") );

            wxLogDebug( wxT( "Checking if search path <%s> exists." ),
            if( fn.IsDirReadable() )
            {
                wxLogDebug( wxT( "Adding <%s> to library search path list" ),
                            fn.GetPath().c_str() );
                m_libSearchPaths.Add( fn.GetPath() );
            }

            /* Add kicad template file path to search path list. */
            fn.RemoveLastDir();
            fn.AppendDir( wxT( "template" ) );

            if( fn.IsDirReadable() )
            {
@@ -543,6 +550,8 @@ void WinEDA_App::SetDefaultSearchPaths( void )
                            fn.GetPath().c_str() );
                m_libSearchPaths.Add( fn.GetPath() );
            }

            /* Add PCB library file path to search path list. */
            fn.RemoveLastDir();
            fn.AppendDir( wxT( "modules" ) );

@@ -552,6 +561,8 @@ void WinEDA_App::SetDefaultSearchPaths( void )
                            fn.GetPath().c_str() );
                m_libSearchPaths.Add( fn.GetPath() );
            }

            /* Add 3D module library file path to search path list. */
            fn.AppendDir( wxT( "packages3d" ) );

            if( fn.IsDirReadable() )
+0 −42
Original line number Diff line number Diff line
@@ -447,48 +447,6 @@ int ExecuteFile( wxWindow* frame, const wxString& ExecFile,
}


/****************************************************/
void SetRealLibraryPath( const wxString& shortlibname )
/****************************************************/

/* met a jour le chemin des librairies g_RealLibDirBuffer (global)
 *  a partir de UserLibDirBuffer (global):
 *  Si UserLibDirBuffer non vide g_RealLibDirBuffer = g_UserLibDirBuffer.
 *  Sinon si variable d'environnement KICAD definie (KICAD = chemin pour kicad),
 *      g_UserLibDirBuffer = <KICAD>/shortlibname;
 *  Sinon g_UserLibDirBuffer = <Chemin des binaires>../shortlibname/
 *  Sinon g_UserLibDirBuffer = /usr/share/kicad/shortlibname/
 *
 *  Remarque:
 *  Les \ sont remplaces par / (a la mode Unix)
 */
{
    bool PathFound = FALSE;

    if( !g_UserLibDirBuffer.IsEmpty() )   // Chemin impose par la configuration
    {
        g_RealLibDirBuffer = g_UserLibDirBuffer;
        PathFound = TRUE;
    }
    else
    {
        g_RealLibDirBuffer = ReturnKicadDatasPath();
        if( wxGetApp().m_Env_Defined )  // Chemin impose par la variable d'environnement
        {
            PathFound = TRUE;
        }
        g_RealLibDirBuffer += shortlibname;
        if( wxDirExists( g_RealLibDirBuffer ) )
            PathFound = TRUE;
    }


    g_RealLibDirBuffer.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
    if( g_RealLibDirBuffer.Last() != '/' )
        g_RealLibDirBuffer += UNIX_STRING_DIR_SEP;
}


/***********************************/
wxString ReturnKicadDatasPath()
/***********************************/
+12 −2
Original line number Diff line number Diff line
@@ -17,6 +17,9 @@
#include "gestfich.h"
#include "wxstruct.h"

#include <wx/apptrait.h>
#include <wx/stdpaths.h>


wxString g_CommonSectionTag( wxT( "[common]" ) );
wxString g_SchematicSectionTag( wxT( "[eeschema]" ) );
@@ -597,14 +600,21 @@ wxString ReturnHotkeyConfigFilePath( int choice )
 */
{
    wxString path;
    wxAppTraits* traits = wxGetApp().GetTraits();

    switch( choice )
    {
    case 0:
        path = wxGetHomeDir() + wxT( "/" );
        break;
        path = traits->GetStandardPaths().GetUserConfigDir() +
            wxFileName::GetPathSeparator();

    case 1:
        /* TODO: This is broken under a normal Poxis system.  Users
         *       generally do no have write permissions to this path
         *       and there is no provision for prompting for the root
         *       password.  Suggest we remove this unless someone has
         *       a workable solution (Wayne).
         */
        path = ReturnKicadDatasPath() + wxT( "template/" );
        break;

+19 −3
Original line number Diff line number Diff line
@@ -11,12 +11,19 @@
#include "wxstruct.h"
#include "param_config.h"

#include <wx/apptrait.h>
#include <wx/stdpaths.h>


#define CONFIG_VERSION 1

#define FORCE_LOCAL_CONFIG true


#include <wx/arrimpl.cpp>
WX_DEFINE_OBJARRAY( PARAM_CFG_ARRAY );


/**
 * Cree ou recree la configuration locale de kicad (filename.pro)
 * initialise:
@@ -93,13 +100,22 @@ bool WinEDA_App::ReCreatePrjConfig( const wxString& fileName,
        }
    }

    defaultFileName = m_libSearchPaths.FindValidPath( wxT( "kicad.pro" ) );

    defaultFileName = ReturnKicadDatasPath() + wxT( "template/kicad" ) +
        wxT( "." ) + ProjectFileExtension;
    if( !defaultFileName )
    {
        wxLogDebug( wxT( "Template file <kicad.pro> not found." ) );
        fn = wxFileName( GetTraits()->GetStandardPaths().GetDocumentsDir(),
                         wxT( "kicad" ), ProjectFileExtension );
    }
    else
    {
        fn = defaultFileName;
    }

    // Create new project file using the default name.
    m_ProjectConfig = new wxFileConfig( wxEmptyString, wxEmptyString,
                                        wxEmptyString, defaultFileName );
                                        wxEmptyString, fn.GetFullPath() );
    m_ProjectConfig->DontCreateOnDemand();

    return false;
Loading