Commit afb63f10 authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Pcbnew: Better dialog when starting pcbnew in a new project, when the .brd file does not exists.

fixed bugs 587175 and 587176
parents 4a11fb36 13ddd1b4
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -369,6 +369,7 @@ void WinEDA_SchematicFrame::EditComponentFootprint( SCH_COMPONENT* Cmp, wxDC* DC
        return;

    SCH_FIELD* TextField = Cmp->GetField( FOOTPRINT );
    message = TextField->m_Text;

    if( Get_Message( _( "Footprint" ), _( "Component footprint" ), message, this ) )
        return;    // edition cancelled by user.
+4 −3
Original line number Diff line number Diff line
@@ -496,18 +496,19 @@ public:
    void OnFileHistory( wxCommandEvent& event );
    void Files_io( wxCommandEvent& event );

    /**
    /** Function LoadOnePcbFile
     *  Load a Kicad board (.brd) file.
     *
     *  @param aFileName - File name including path. If empty, a file dialog will
     *                     be displayed.
     *  @param aAppend - Append board file aFileName to the currently loaded file if true.
     *                   Default = false.
     *  @param aForceFileDialog - Display the file open dialog even if aFullFileName is
     *                            valid if true.
     *                            valid if true; Default = false.
     *
     *  @return False if file load fails or is cancelled by the user, otherwise true.
     */
    bool LoadOnePcbFile( const wxString& aFileName, bool aAppend,
    bool LoadOnePcbFile( const wxString& aFileName, bool aAppend = false,
                         bool aForceFileDialog = false );


+1 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@

#include "build_version.h"

const wxString g_KicadPrjFilenameExtension(wxT(".pro") );

/* Import functions */
char* GetFileName( char* FullPathName );
+2 −0
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
#include "wxstruct.h"
#include "appl_wxstruct.h"

extern const wxString g_KicadPrjFilenameExtension;

class RIGHT_KM_FRAME;
class TREEPROJECTFILES;
class TREE_PROJECT_FRAME;
+11 −2
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ void WinEDA_MainFrame::CreateNewProject( const wxString PrjFullFileName )
    wxFileName newProjectName = PrjFullFileName;

    /* Init default config filename */
    filename = wxGetApp().FindLibraryPath( wxT( "kicad.pro" ) );
    filename = wxGetApp().FindLibraryPath( wxT( "kicad" ) + g_KicadPrjFilenameExtension);

    /* Check if file kicad.pro exist in template directory */
    if( wxFileName::FileExists( filename ) )
@@ -86,7 +86,16 @@ void WinEDA_MainFrame::OnLoadProject( wxCommandEvent& event )
        m_ProjectFileName = dlg.GetPath();

        if( event.GetId() == ID_NEW_PROJECT )
        {
            // Ensure project filename extension is .pro
            wxString fullname = m_ProjectFileName.GetFullPath();
            if ( !fullname.EndsWith( g_KicadPrjFilenameExtension ) )
            {
                fullname += g_KicadPrjFilenameExtension;
                m_ProjectFileName.SetFullName( fullname );
            }
            CreateNewProject( m_ProjectFileName.GetFullPath() );
        }

        SetLastProject( m_ProjectFileName.GetFullPath() );
    }
@@ -98,7 +107,7 @@ void WinEDA_MainFrame::OnLoadProject( wxCommandEvent& event )
    wxString filename = m_ProjectFileName.GetFullName();

    wxString nameless_prj = NAMELESS_PROJECT;
    nameless_prj += wxT(".pro");
    nameless_prj += g_KicadPrjFilenameExtension;
    if( !m_ProjectFileName.FileExists() && !filename.IsSameAs(nameless_prj))
    {
        DisplayError( this, _( "Kicad project file <" ) +
Loading