From 5ec1359a91348cc850c2329a649334a9dbcfc995 Mon Sep 17 00:00:00 2001 From: charras Date: Mon, 31 Mar 2008 08:00:15 +0000 Subject: [PATCH] removed use of a DC in WinEDA_PcbFrame::LoadOnePcbFile(). --- include/wxPcbStruct.h | 4 ++-- pcbnew/files.cpp | 23 ++++++++++++----------- pcbnew/ioascii.cpp | 5 ++--- pcbnew/pcbnew.cpp | 5 +---- 4 files changed, 17 insertions(+), 20 deletions(-) diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index c7b3893a79..ccc01e4e87 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -378,8 +378,8 @@ public: void ToPostProcess( wxCommandEvent& event ); void Files_io( wxCommandEvent& event ); - int LoadOnePcbFile( const wxString& FileName, wxDC* DC, bool Append ); - int ReadPcbFile( wxDC* DC, FILE* File, bool Append ); + int LoadOnePcbFile( const wxString& FileName, bool Append ); + int ReadPcbFile( FILE* File, bool Append ); bool SavePcbFile( const wxString& FileName ); int SavePcbFormatAscii( FILE* File ); bool WriteGeneralDescrPcb( FILE* File ); diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index 816adf4744..661b7aa80b 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -18,14 +18,14 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event ) */ { int id = event.GetId(); - wxClientDC dc( DrawPanel ); wxString msg; - DrawPanel->PrepareGraphicContext( &dc ); // If an edition is in progress, stop it if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur ) { + wxClientDC dc( DrawPanel ); + DrawPanel->PrepareGraphicContext( &dc ); DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc ); } SetToolID( 0, wxCURSOR_ARROW, wxEmptyString ); @@ -35,7 +35,7 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event ) case ID_MENU_LOAD_FILE: case ID_LOAD_FILE: Clear_Pcb(TRUE ); - LoadOnePcbFile( wxEmptyString, &dc, FALSE ); + LoadOnePcbFile( wxEmptyString,FALSE ); ReCreateAuxiliaryToolbar(); break; @@ -65,7 +65,7 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event ) break; } Clear_Pcb( TRUE ); - LoadOnePcbFile( filename, &dc, FALSE ); + LoadOnePcbFile( filename, FALSE ); GetScreen()->m_FileName = oldfilename; SetTitle( GetScreen()->m_FileName ); ReCreateAuxiliaryToolbar(); @@ -74,7 +74,7 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event ) case ID_MENU_APPEND_FILE: case ID_APPEND_FILE: - LoadOnePcbFile( wxEmptyString, &dc, TRUE ); + LoadOnePcbFile( wxEmptyString, TRUE ); break; case ID_MENU_NEW_BOARD: @@ -98,7 +98,7 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event ) Clear_Pcb(TRUE ); wxSetWorkingDirectory( wxPathOnly( GetLastProject( id - ID_LOAD_FILE_1 ) ) ); LoadOnePcbFile( GetLastProject( id - ID_LOAD_FILE_1 ).GetData(), - &dc, FALSE ); + FALSE ); ReCreateAuxiliaryToolbar(); break; @@ -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 @@ -200,7 +200,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, wxDC * DC, bo // Reload the corresponding configuration file: wxSetWorkingDirectory( wxPathOnly( GetScreen()->m_FileName ) ); if( Append ) - ReadPcbFile( DC, source, TRUE ); + ReadPcbFile( source, TRUE ); else { Read_Config( GetScreen()->m_FileName ); @@ -211,7 +211,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, wxDC * DC, bo m_DisplayModEdge = DisplayOpt.DisplayModEdge; m_DisplayPadFill = DisplayOpt.DisplayPadFill; - ReadPcbFile( DC, source, FALSE ); + ReadPcbFile( source, FALSE ); } fclose( source ); @@ -229,6 +229,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, wxDC * DC, bo build_liste_pads(); m_Pcb->Display_Infos( this ); + DrawPanel->Refresh( true); /* reset the auto save timer */ g_SaveTime = time( NULL ); diff --git a/pcbnew/ioascii.cpp b/pcbnew/ioascii.cpp index 2092883b85..5c068ce66f 100644 --- a/pcbnew/ioascii.cpp +++ b/pcbnew/ioascii.cpp @@ -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 @@ -1026,10 +1026,9 @@ int WinEDA_PcbFrame::ReadPcbFile( wxDC* DC, FILE* File, bool Append ) Affiche_Message( wxEmptyString ); BestZoom(); - DrawPanel->ReDraw(DC, true); #ifdef PCBNEW - Compile_Ratsnest( DC, TRUE ); + Compile_Ratsnest( NULL, TRUE ); #endif return 1; } diff --git a/pcbnew/pcbnew.cpp b/pcbnew/pcbnew.cpp index bda296217f..2fac845464 100644 --- a/pcbnew/pcbnew.cpp +++ b/pcbnew/pcbnew.cpp @@ -89,10 +89,7 @@ bool WinEDA_App::OnInit() /* Load file specified in the command line. */ if( !FFileName.IsEmpty() ) { - wxClientDC dc( m_PcbFrame->DrawPanel ); - - m_PcbFrame->DrawPanel->PrepareGraphicContext( &dc ); - m_PcbFrame->LoadOnePcbFile( FFileName, &dc, FALSE ); + m_PcbFrame->LoadOnePcbFile( FFileName, FALSE ); } return TRUE;