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

fix bug from launchpad

parents cddc8f36 c9d6d1f9
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#define BACKUP_FILE_EXT wxT( "000" ) #define BACKUP_FILE_EXT wxT( "000" )
void WinEDA_PcbFrame::OnFileHistory( wxCommandEvent& event ) void WinEDA_PcbFrame::OnFileHistory( wxCommandEvent& event )
{ {
wxString fn; wxString fn;
...@@ -128,7 +129,8 @@ bool WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append ...@@ -128,7 +129,8 @@ bool WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append
if( GetScreen()->IsModify() && !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; return false;
} }
...@@ -147,9 +149,8 @@ bool WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append ...@@ -147,9 +149,8 @@ bool WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append
{ {
wxFileName fn = GetScreen()->m_FileName; wxFileName fn = GetScreen()->m_FileName;
wxFileDialog dlg( this, _( "Open Board File" ), wxEmptyString, wxFileDialog dlg( this, _( "Open Board File" ), wxEmptyString, fn.GetFullName(),
fn.GetFullName(), PcbFileWildcard, PcbFileWildcard, wxFD_OPEN | wxFD_FILE_MUST_EXIST );
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return false; return false;
...@@ -170,8 +171,7 @@ bool WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append ...@@ -170,8 +171,7 @@ bool WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append
source = wxFopen( GetScreen()->m_FileName, wxT( "rt" ) ); source = wxFopen( GetScreen()->m_FileName, wxT( "rt" ) );
if( source == NULL ) if( source == NULL )
{ {
msg.Printf( _( "File <%s> not found" ), msg.Printf( _( "File <%s> not found" ), GetChars( GetScreen()->m_FileName ) );
GetChars( GetScreen()->m_FileName ) );
DisplayError( this, msg ); DisplayError( this, msg );
return false; return false;
} }
...@@ -191,13 +191,13 @@ bool WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append ...@@ -191,13 +191,13 @@ bool WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append
if ( ver > g_CurrentVersionPCB ) if ( ver > g_CurrentVersionPCB )
{ {
DisplayInfoMessage( this, _( "This file was created by a more recent \ DisplayInfoMessage( this, _( "This file was created by a more recent \
version of PCBnew and may not load correctly. Please consider updating!")); version of PCBnew and may not load correctly. Please consider updating!" ) );
} }
else if ( ver < g_CurrentVersionPCB ) else if ( ver < g_CurrentVersionPCB )
{ {
DisplayInfoMessage( this, _( "This file was created by an older \ DisplayInfoMessage( this, _( "This file was created by an older \
version of PCBnew. It will be stored in the new file format when you save \ version of PCBnew. It will be stored in the new file format when you save \
this file again.")); this file again." ) );
} }
// Reload the corresponding configuration file: // Reload the corresponding configuration file:
...@@ -206,8 +206,6 @@ this file again.")); ...@@ -206,8 +206,6 @@ this file again."));
ReadPcbFile( source, true ); ReadPcbFile( source, true );
else else
{ {
LoadProjectSettings( GetScreen()->m_FileName );
// Update the option toolbar // Update the option toolbar
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill; m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
m_DisplayModText = DisplayOpt.DisplayModText; m_DisplayModText = DisplayOpt.DisplayModText;
...@@ -216,6 +214,7 @@ this file again.")); ...@@ -216,6 +214,7 @@ this file again."));
m_DisplayViaFill = DisplayOpt.DisplayViaFill; m_DisplayViaFill = DisplayOpt.DisplayViaFill;
ReadPcbFile( source, false ); ReadPcbFile( source, false );
LoadProjectSettings( GetScreen()->m_FileName );
} }
fclose( source ); fclose( source );
...@@ -268,7 +267,7 @@ this file again.")); ...@@ -268,7 +267,7 @@ this file again."));
Zoom_Automatique( false ); Zoom_Automatique( false );
wxSafeYield(); // Needed if we want to see the board now. 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 ); Compile_Ratsnest( NULL, true );
GetBoard()->DisplayInfo( this ); GetBoard()->DisplayInfo( this );
...@@ -331,18 +330,16 @@ bool WinEDA_PcbFrame::SavePcbFile( const wxString& FileName ) ...@@ -331,18 +330,16 @@ bool WinEDA_PcbFrame::SavePcbFile( const wxString& FileName )
backupFileName.SetExt( BACKUP_FILE_EXT ); backupFileName.SetExt( BACKUP_FILE_EXT );
/* If an old backup file exists, delete it. /* 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() ) if( pcbFileName.FileExists() )
{ {
/* rename the "old" file" from xxx.brd to xxx.000 */ /* rename the "old" file" from xxx.brd to xxx.000 */
if( backupFileName.FileExists() ) /* Remove the old file xxx.000 (if exists) */ if( backupFileName.FileExists() ) /* Remove the old file xxx.000 (if exists) */
wxRemoveFile( backupFileName.GetFullPath() ); wxRemoveFile( backupFileName.GetFullPath() );
if( !wxRenameFile( pcbFileName.GetFullPath(), if( !wxRenameFile( pcbFileName.GetFullPath(), backupFileName.GetFullPath() ) )
backupFileName.GetFullPath() ) )
{ {
msg = _( "Warning: unable to create backup file " ) + msg = _( "Warning: unable to create backup file " ) + backupFileName.GetFullPath();
backupFileName.GetFullPath();
DisplayError( this, msg, 15 ); DisplayError( this, msg, 15 );
saveok = false; saveok = false;
} }
...@@ -386,7 +383,8 @@ bool WinEDA_PcbFrame::SavePcbFile( const wxString& FileName ) ...@@ -386,7 +383,8 @@ bool WinEDA_PcbFrame::SavePcbFile( const wxString& FileName )
lowerTxt = _( "Failed to create " ); lowerTxt = _( "Failed to create " );
lowerTxt += pcbFileName.GetFullPath(); 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 */ g_SaveTime = time( NULL ); /* Reset timer for the automatic saving */
......
...@@ -37,37 +37,36 @@ int g_DrawDefaultLineThickness = 60; /* Default line thickness in PCBNEW units u ...@@ -37,37 +37,36 @@ int g_DrawDefaultLineThickness = 60; /* Default line thickness in PCBNEW units u
* default thickness line value (Frame references) * default thickness line value (Frame references)
* (i.e. = 0 ). 0 = single pixel line width */ * (i.e. = 0 ). 0 = single pixel line width */
bool Drc_On = true; bool Drc_On = true;
bool g_AutoDeleteOldTrack = true; bool g_AutoDeleteOldTrack = true;
bool g_Drag_Pistes_On; bool g_Drag_Pistes_On;
bool g_Show_Module_Ratsnest; bool g_Show_Module_Ratsnest;
bool g_Show_Pads_Module_in_Move = true; bool g_Show_Pads_Module_in_Move = true;
bool g_Raccord_45_Auto = true; bool g_Raccord_45_Auto = true;
bool Track_45_Only; bool Track_45_Only;
bool Segments_45_Only; bool Segments_45_Only;
bool g_TwoSegmentTrackBuild = true; bool g_TwoSegmentTrackBuild = true;
bool g_HighLight_Status; bool g_HighLight_Status;
extern PARAM_CFG_BASE* ParamCfgList[];
int ModuleSegmentWidth;
int ModuleSegmentWidth; int ModuleTextWidth;
int ModuleTextWidth; int Route_Layer_TOP;
int Route_Layer_TOP; int Route_Layer_BOTTOM;
int Route_Layer_BOTTOM; int g_MaxLinksShowed;
int g_MaxLinksShowed; int g_MagneticPadOption = capture_cursor_in_track_tool;
int g_MagneticPadOption = capture_cursor_in_track_tool; int g_MagneticTrackOption = capture_cursor_in_track_tool;
int g_MagneticTrackOption = capture_cursor_in_track_tool; int g_HighLight_NetCode = -1;
int g_HighLight_NetCode = -1;
wxSize ModuleTextSize; /* Default footprint texts size */
wxSize ModuleTextSize; /* Default footprint texts size */ wxPoint g_Offset_Module; /* Offset de trace du modul en depl */
wxPoint g_Offset_Module; /* Offset de trace du modul en depl */ wxString g_Current_PadName; // Last used pad name (pad num)
wxString g_Current_PadName; // Last used pad name (pad num)
// Wildcard for footprint libraries filesnames // Wildcard for footprint libraries filesnames
const wxString g_FootprintLibFileWildcard( wxT( "Kicad footprint library file (*.mod)|*.mod" ) ); const wxString g_FootprintLibFileWildcard( wxT( "Kicad footprint library file (*.mod)|*.mod" ) );
/* Name of the document footprint list /* Name of the document footprint list
* usually located in share/modules/footprints_doc * 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 * if they want to have a list of footprints
*/ */
wxString g_DocModulesFileName = wxT( "footprints_doc/footprints.pdf" ); wxString g_DocModulesFileName = wxT( "footprints_doc/footprints.pdf" );
...@@ -89,9 +88,7 @@ void WinEDA_App::MacOpenFile( const wxString& fileName ) ...@@ -89,9 +88,7 @@ void WinEDA_App::MacOpenFile( const wxString& fileName )
} }
/****************************/
bool WinEDA_App::OnInit() bool WinEDA_App::OnInit()
/****************************/
{ {
/* WXMAC application specific */ /* WXMAC application specific */
#ifdef __WXMAC__ #ifdef __WXMAC__
...@@ -140,8 +137,7 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) ); ...@@ -140,8 +137,7 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) );
* real hotkeys in menus or tool tips */ * real hotkeys in menus or tool tips */
frame = new WinEDA_PcbFrame( NULL, wxT( "PcbNew" ), frame = new WinEDA_PcbFrame( NULL, wxT( "PcbNew" ), wxPoint( 0, 0 ), wxSize( 600, 400 ) );
wxPoint( 0, 0 ), wxSize( 600, 400 ) );
frame->SetTitle( GetTitle() + wxT( " " ) + GetBuildVersion() ); frame->SetTitle( GetTitle() + wxT( " " ) + GetBuildVersion() );
ActiveScreen = ScreenPcb; ActiveScreen = ScreenPcb;
...@@ -153,8 +149,6 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) ); ...@@ -153,8 +149,6 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) );
SetupServerFunction( RemoteCommand ); SetupServerFunction( RemoteCommand );
} }
frame->LoadProjectSettings( fn.GetFullPath() );
frame->Zoom_Automatique( true ); frame->Zoom_Automatique( true );
/* Load file specified in the command line. */ /* Load file specified in the command line. */
...@@ -166,6 +160,8 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) ); ...@@ -166,6 +160,8 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) );
frame->ReCreateLayerBox( NULL ); frame->ReCreateLayerBox( NULL );
} }
frame->LoadProjectSettings( fn.GetFullPath() );
/* For an obscure reason the focus is lost after loading a board file /* For an obscure reason the focus is lost after loading a board file
* when starting (i.e. only at this point) * when starting (i.e. only at this point)
* (seems due to the recreation of the layer manager after loading the file) * (seems due to the recreation of the layer manager after loading the file)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment