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

fix bug from launchpad

parents cddc8f36 c9d6d1f9
Loading
Loading
Loading
Loading
+15 −17
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@

#define BACKUP_FILE_EXT wxT( "000" )


void WinEDA_PcbFrame::OnFileHistory( wxCommandEvent& event )
{
    wxString fn;
@@ -128,7 +129,8 @@ bool WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append

    if( GetScreen()->IsModify() && !Append )
    {
        if( !IsOK( this, _( "Board Modified: Continue ?" ) ) )
        if( !IsOK( this, _( "The current board has been modified.  Do you wish to discard \
the changes?" ) ) )
            return false;
    }

@@ -147,9 +149,8 @@ bool WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append
    {
        wxFileName fn = GetScreen()->m_FileName;

        wxFileDialog dlg( this, _( "Open Board File" ), wxEmptyString,
                          fn.GetFullName(), PcbFileWildcard,
                          wxFD_OPEN | wxFD_FILE_MUST_EXIST );
        wxFileDialog dlg( this, _( "Open Board File" ), wxEmptyString, fn.GetFullName(),
                          PcbFileWildcard, wxFD_OPEN | wxFD_FILE_MUST_EXIST );

        if( dlg.ShowModal() == wxID_CANCEL )
            return false;
@@ -170,8 +171,7 @@ bool WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append
    source = wxFopen( GetScreen()->m_FileName, wxT( "rt" ) );
    if( source == NULL )
    {
        msg.Printf( _( "File <%s> not found" ),
                    GetChars( GetScreen()->m_FileName ) );
        msg.Printf( _( "File <%s> not found" ), GetChars( GetScreen()->m_FileName ) );
        DisplayError( this, msg );
        return false;
    }
@@ -206,8 +206,6 @@ this file again."));
        ReadPcbFile( source, true );
    else
    {
        LoadProjectSettings( GetScreen()->m_FileName );

        // Update the option toolbar
        m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
        m_DisplayModText = DisplayOpt.DisplayModText;
@@ -216,6 +214,7 @@ this file again."));
        m_DisplayViaFill = DisplayOpt.DisplayViaFill;

        ReadPcbFile( source, false );
        LoadProjectSettings( GetScreen()->m_FileName );
    }

    fclose( source );
@@ -268,7 +267,7 @@ this file again."));
    Zoom_Automatique( false );
    wxSafeYield();      // Needed if we want to see the board now.

    // Compile rastnest and displays net info
    // Compile ratsnest and displays net info
    Compile_Ratsnest( NULL, true );
    GetBoard()->DisplayInfo( this );

@@ -331,18 +330,16 @@ bool WinEDA_PcbFrame::SavePcbFile( const wxString& FileName )
    backupFileName.SetExt( BACKUP_FILE_EXT );

    /* If an old backup file exists, delete it.
    if an old board file existes, rename it to the backup file name
    if an old board file exists, rename it to the backup file name
    */
    if( pcbFileName.FileExists() )
    {
        /* rename the "old" file" from xxx.brd to xxx.000 */
        if( backupFileName.FileExists() )    /* Remove the old file xxx.000 (if exists) */
            wxRemoveFile( backupFileName.GetFullPath() );
        if( !wxRenameFile( pcbFileName.GetFullPath(),
                           backupFileName.GetFullPath() ) )
        if( !wxRenameFile( pcbFileName.GetFullPath(), backupFileName.GetFullPath() ) )
        {
            msg = _( "Warning: unable to create backup file " ) +
                backupFileName.GetFullPath();
            msg = _( "Warning: unable to create backup file " ) + backupFileName.GetFullPath();
            DisplayError( this, msg, 15 );
            saveok = false;
        }
@@ -386,7 +383,8 @@ bool WinEDA_PcbFrame::SavePcbFile( const wxString& FileName )
        lowerTxt = _( "Failed to create " );
    lowerTxt += pcbFileName.GetFullPath();

    Affiche_1_Parametre( this, 1, upperTxt, lowerTxt, CYAN );
    ClearMsgPanel();
    AppendMsgPanel( upperTxt, lowerTxt, CYAN );

    g_SaveTime = time( NULL );    /* Reset timer for the automatic saving */

+28 −32
Original line number Diff line number Diff line
@@ -47,7 +47,6 @@ bool Track_45_Only;
bool           Segments_45_Only;
bool           g_TwoSegmentTrackBuild = true;
bool           g_HighLight_Status;
extern PARAM_CFG_BASE* ParamCfgList[];

int            ModuleSegmentWidth;
int            ModuleTextWidth;
@@ -67,7 +66,7 @@ const wxString g_FootprintLibFileWildcard( wxT( "Kicad footprint library

/* Name of the document footprint list
 * usually located in share/modules/footprints_doc
 * this is of the responsability to users to create this file
 * this is of the responsibility to users to create this file
 * if they want to have a list of footprints
 */
wxString g_DocModulesFileName = wxT( "footprints_doc/footprints.pdf" );
@@ -89,9 +88,7 @@ void WinEDA_App::MacOpenFile( const wxString& fileName )
}


/****************************/
bool WinEDA_App::OnInit()
/****************************/
{
    /* WXMAC application specific */
#ifdef __WXMAC__
@@ -140,8 +137,7 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) );
                                          * real hotkeys in menus or tool tips */


    frame = new WinEDA_PcbFrame( NULL, wxT( "PcbNew" ),
                                 wxPoint( 0, 0 ), wxSize( 600, 400 ) );
    frame = new WinEDA_PcbFrame( NULL, wxT( "PcbNew" ), wxPoint( 0, 0 ), wxSize( 600, 400 ) );
    frame->SetTitle( GetTitle() + wxT( " " ) + GetBuildVersion() );
    ActiveScreen = ScreenPcb;

@@ -153,8 +149,6 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) );
        SetupServerFunction( RemoteCommand );
    }

    frame->LoadProjectSettings( fn.GetFullPath() );

    frame->Zoom_Automatique( true );

    /* Load file specified in the command line. */
@@ -166,6 +160,8 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) );
        frame->ReCreateLayerBox( NULL );
    }

    frame->LoadProjectSettings( fn.GetFullPath() );

    /* For an obscure reason the focus is lost after loading a board file
     * when starting (i.e. only at this point)
     * (seems due to the recreation of the layer manager after loading the file)