Commit 5ec1359a authored by charras's avatar charras

removed use of a DC in WinEDA_PcbFrame::LoadOnePcbFile().

parent 3e06ab44
...@@ -378,8 +378,8 @@ public: ...@@ -378,8 +378,8 @@ public:
void ToPostProcess( wxCommandEvent& event ); void ToPostProcess( wxCommandEvent& event );
void Files_io( wxCommandEvent& event ); void Files_io( wxCommandEvent& event );
int LoadOnePcbFile( const wxString& FileName, wxDC* DC, bool Append ); int LoadOnePcbFile( const wxString& FileName, bool Append );
int ReadPcbFile( wxDC* DC, FILE* File, bool Append ); int ReadPcbFile( FILE* File, bool Append );
bool SavePcbFile( const wxString& FileName ); bool SavePcbFile( const wxString& FileName );
int SavePcbFormatAscii( FILE* File ); int SavePcbFormatAscii( FILE* File );
bool WriteGeneralDescrPcb( FILE* File ); bool WriteGeneralDescrPcb( FILE* File );
......
...@@ -18,14 +18,14 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event ) ...@@ -18,14 +18,14 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
*/ */
{ {
int id = event.GetId(); int id = event.GetId();
wxClientDC dc( DrawPanel );
wxString msg; wxString msg;
DrawPanel->PrepareGraphicContext( &dc );
// If an edition is in progress, stop it // If an edition is in progress, stop it
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur ) if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
{ {
wxClientDC dc( DrawPanel );
DrawPanel->PrepareGraphicContext( &dc );
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc ); DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
} }
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString ); SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
...@@ -35,7 +35,7 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event ) ...@@ -35,7 +35,7 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
case ID_MENU_LOAD_FILE: case ID_MENU_LOAD_FILE:
case ID_LOAD_FILE: case ID_LOAD_FILE:
Clear_Pcb(TRUE ); Clear_Pcb(TRUE );
LoadOnePcbFile( wxEmptyString, &dc, FALSE ); LoadOnePcbFile( wxEmptyString,FALSE );
ReCreateAuxiliaryToolbar(); ReCreateAuxiliaryToolbar();
break; break;
...@@ -65,7 +65,7 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event ) ...@@ -65,7 +65,7 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
break; break;
} }
Clear_Pcb( TRUE ); Clear_Pcb( TRUE );
LoadOnePcbFile( filename, &dc, FALSE ); LoadOnePcbFile( filename, FALSE );
GetScreen()->m_FileName = oldfilename; GetScreen()->m_FileName = oldfilename;
SetTitle( GetScreen()->m_FileName ); SetTitle( GetScreen()->m_FileName );
ReCreateAuxiliaryToolbar(); ReCreateAuxiliaryToolbar();
...@@ -74,7 +74,7 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event ) ...@@ -74,7 +74,7 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
case ID_MENU_APPEND_FILE: case ID_MENU_APPEND_FILE:
case ID_APPEND_FILE: case ID_APPEND_FILE:
LoadOnePcbFile( wxEmptyString, &dc, TRUE ); LoadOnePcbFile( wxEmptyString, TRUE );
break; break;
case ID_MENU_NEW_BOARD: case ID_MENU_NEW_BOARD:
...@@ -98,7 +98,7 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event ) ...@@ -98,7 +98,7 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
Clear_Pcb(TRUE ); Clear_Pcb(TRUE );
wxSetWorkingDirectory( wxPathOnly( GetLastProject( id - ID_LOAD_FILE_1 ) ) ); wxSetWorkingDirectory( wxPathOnly( GetLastProject( id - ID_LOAD_FILE_1 ) ) );
LoadOnePcbFile( GetLastProject( id - ID_LOAD_FILE_1 ).GetData(), LoadOnePcbFile( GetLastProject( id - ID_LOAD_FILE_1 ).GetData(),
&dc, FALSE ); FALSE );
ReCreateAuxiliaryToolbar(); ReCreateAuxiliaryToolbar();
break; break;
...@@ -121,9 +121,9 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event ) ...@@ -121,9 +121,9 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
} }
/*****************************************************************************************/ /*******************************************************************************/
int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, wxDC * DC, bool Append ) int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append )
/******************************************************************************************/ /*******************************************************************************/
/** /**
* Read a board file * Read a board file
...@@ -200,7 +200,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, wxDC * DC, bo ...@@ -200,7 +200,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, wxDC * DC, bo
// Reload the corresponding configuration file: // Reload the corresponding configuration file:
wxSetWorkingDirectory( wxPathOnly( GetScreen()->m_FileName ) ); wxSetWorkingDirectory( wxPathOnly( GetScreen()->m_FileName ) );
if( Append ) if( Append )
ReadPcbFile( DC, source, TRUE ); ReadPcbFile( source, TRUE );
else else
{ {
Read_Config( GetScreen()->m_FileName ); Read_Config( GetScreen()->m_FileName );
...@@ -211,7 +211,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, wxDC * DC, bo ...@@ -211,7 +211,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, wxDC * DC, bo
m_DisplayModEdge = DisplayOpt.DisplayModEdge; m_DisplayModEdge = DisplayOpt.DisplayModEdge;
m_DisplayPadFill = DisplayOpt.DisplayPadFill; m_DisplayPadFill = DisplayOpt.DisplayPadFill;
ReadPcbFile( DC, source, FALSE ); ReadPcbFile( source, FALSE );
} }
fclose( source ); fclose( source );
...@@ -229,6 +229,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, wxDC * DC, bo ...@@ -229,6 +229,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, wxDC * DC, bo
build_liste_pads(); build_liste_pads();
m_Pcb->Display_Infos( this ); m_Pcb->Display_Infos( this );
DrawPanel->Refresh( true);
/* reset the auto save timer */ /* reset the auto save timer */
g_SaveTime = time( NULL ); g_SaveTime = time( NULL );
......
...@@ -771,7 +771,7 @@ static bool ReadSheetDescr( BASE_SCREEN* screen, FILE* File, int* LineNum ) ...@@ -771,7 +771,7 @@ static bool ReadSheetDescr( BASE_SCREEN* screen, FILE* File, int* LineNum )
/********************************************************************/ /********************************************************************/
int WinEDA_PcbFrame::ReadPcbFile( wxDC* DC, FILE* File, bool Append ) int WinEDA_PcbFrame::ReadPcbFile( FILE* File, bool Append )
/********************************************************************/ /********************************************************************/
/** ReadPcbFile /** ReadPcbFile
...@@ -1026,10 +1026,9 @@ int WinEDA_PcbFrame::ReadPcbFile( wxDC* DC, FILE* File, bool Append ) ...@@ -1026,10 +1026,9 @@ int WinEDA_PcbFrame::ReadPcbFile( wxDC* DC, FILE* File, bool Append )
Affiche_Message( wxEmptyString ); Affiche_Message( wxEmptyString );
BestZoom(); BestZoom();
DrawPanel->ReDraw(DC, true);
#ifdef PCBNEW #ifdef PCBNEW
Compile_Ratsnest( DC, TRUE ); Compile_Ratsnest( NULL, TRUE );
#endif #endif
return 1; return 1;
} }
......
...@@ -89,10 +89,7 @@ bool WinEDA_App::OnInit() ...@@ -89,10 +89,7 @@ bool WinEDA_App::OnInit()
/* Load file specified in the command line. */ /* Load file specified in the command line. */
if( !FFileName.IsEmpty() ) if( !FFileName.IsEmpty() )
{ {
wxClientDC dc( m_PcbFrame->DrawPanel ); m_PcbFrame->LoadOnePcbFile( FFileName, FALSE );
m_PcbFrame->DrawPanel->PrepareGraphicContext( &dc );
m_PcbFrame->LoadOnePcbFile( FFileName, &dc, FALSE );
} }
return TRUE; return TRUE;
......
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