diff --git a/3d-viewer/3d_draw.cpp b/3d-viewer/3d_draw.cpp index 5914af384d..ca53103f33 100644 --- a/3d-viewer/3d_draw.cpp +++ b/3d-viewer/3d_draw.cpp @@ -92,7 +92,7 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List() */ { WinEDA_BasePcbFrame* pcbframe = m_Parent->m_Parent; - BOARD* pcb = pcbframe->m_Pcb; + BOARD* pcb = pcbframe->GetBoard(); TRACK* track; SEGZONE* segzone; int ii; diff --git a/CHANGELOG.txt b/CHANGELOG.txt index d2bf297ea8..0f2339fb10 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -5,6 +5,13 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. +2009-Jan-04 UPDATE Dick Hollenbeck +================================================================================ +++all + wxPcbStruct.h: made m_Pcb private, added GetBoard(). Am considering + putting each gerber layer into its own BOARD. + + 2009-Jan-02 UPDATE Jean-Pierre Charras ================================================================================ ++Eeschema: @@ -13,7 +20,6 @@ email address. DrawPolylineStruct uses now std::vector to handle corners. - 2008-Dec-31 UPDATE Jean-Pierre Charras ================================================================================ ++Eeschema: diff --git a/cvpcb/displayframe.cpp b/cvpcb/displayframe.cpp index d53e1cb3c9..9dca9b3e8f 100644 --- a/cvpcb/displayframe.cpp +++ b/cvpcb/displayframe.cpp @@ -51,7 +51,7 @@ WinEDA_DisplayFrame::WinEDA_DisplayFrame( wxWindow* father, #endif SetTitle( title ); - m_Pcb = new BOARD( NULL, this ); + SetBoard( new BOARD( NULL, this ) ); SetBaseScreen( new PCB_SCREEN() ); @@ -70,7 +70,7 @@ WinEDA_DisplayFrame::~WinEDA_DisplayFrame() delete GetBaseScreen(); SetBaseScreen( 0 ); - delete m_Pcb; + delete GetBoard(); ( (WinEDA_CvpcbFrame*) wxGetApp().GetTopWindow() )->DrawFrame = NULL; } diff --git a/cvpcb/loadcmp.cpp b/cvpcb/loadcmp.cpp index cc06582feb..f59ca69d87 100644 --- a/cvpcb/loadcmp.cpp +++ b/cvpcb/loadcmp.cpp @@ -1,6 +1,6 @@ - /***************************************************/ - /* Localisation des elements pointes par la souris */ - /***************************************************/ +/***************************************************/ +/* Localisation des elements pointes par la souris */ +/***************************************************/ #include "fctsys.h" @@ -10,94 +10,107 @@ #include "protos.h" +/*****************************************************************/ +MODULE* WinEDA_DisplayFrame::Get_Module( const wxString& CmpName ) +/*****************************************************************/ -/*****************************************************************/ -MODULE * WinEDA_DisplayFrame::Get_Module(const wxString & CmpName) -/*****************************************************************/ /* - Analyse les LIBRAIRIES pour trouver le module demande - Si ce module est trouve, le copie en memoire, et le - chaine en fin de liste des modules - - Entree: - name_cmp = nom du module - - Retour: - Pointeur sur le nouveau module. -*/ + * Analyse les LIBRAIRIES pour trouver le module demande + * Si ce module est trouve, le copie en memoire, et le + * chaine en fin de liste des modules + * - Entree: + * name_cmp = nom du module + * - Retour: + * Pointeur sur le nouveau module. + */ { -int LineNum, Found = 0; -unsigned ii; -char Line[1024], Name[255]; -wxString libname; -MODULE * Module = NULL; + int LineNum, Found = 0; + unsigned ii; + char Line[1024], Name[255]; + wxString libname; + MODULE* Module = NULL; - for( ii= 0 ; ii < g_LibName_List.GetCount(); ii++) - { - /* Calcul du nom complet de la librairie */ - libname = MakeFileName(g_RealLibDirBuffer, g_LibName_List[ii], LibExtBuffer); + for( ii = 0; ii < g_LibName_List.GetCount(); ii++ ) + { + /* Calcul du nom complet de la librairie */ + libname = MakeFileName( g_RealLibDirBuffer, g_LibName_List[ii], LibExtBuffer ); - if ((lib_module = wxFopen(libname, wxT("rt"))) == NULL ) - { - continue ; - } + if( ( lib_module = wxFopen( libname, wxT( "rt" ) ) ) == NULL ) + { + continue; + } - /* lecture entete chaine definie par ENTETE_LIBRAIRIE */ - LineNum = 0; - GetLine(lib_module, Line, &LineNum) ; - StrPurge(Line); - if(strnicmp( Line,ENTETE_LIBRAIRIE, L_ENTETE_LIB) != 0) - { - DisplayError(this, _("This file is NOT a library file") ); - return(NULL); - } + /* lecture entete chaine definie par ENTETE_LIBRAIRIE */ + LineNum = 0; + GetLine( lib_module, Line, &LineNum ); + StrPurge( Line ); - /* Lecture de la liste des composants de la librairie */ - Found = 0; - while( !Found && GetLine(lib_module,Line, &LineNum) ) - { - if( strncmp( Line, "$MODULE",6) == 0 ) break; - if( strnicmp( Line,"$INDEX",6) == 0 ) - { - while( GetLine(lib_module,Line, &LineNum) ) - { - if( strnicmp( Line,"$EndINDEX",9) == 0 ) break; - StrPurge(Line); - if( stricmp(Line, CONV_TO_UTF8(CmpName)) == 0 ) - { - Found = 1; break; /* Trouve! */ - } - } - } - } + if( strnicmp( Line, ENTETE_LIBRAIRIE, L_ENTETE_LIB ) != 0 ) + { + DisplayError( this, _( "This file is NOT a library file" ) ); + return NULL; + } - /* Lecture de la librairie */ - while( Found && GetLine(lib_module,Line, &LineNum) ) - { - if( Line[0] != '$' ) continue; - if( Line[1] != 'M' ) continue; - if( strnicmp( Line, "$MODULE",7) != 0 ) continue; - /* Lecture du nom du composant */ - sscanf(Line+7," %s",Name); - if( stricmp(Name,CONV_TO_UTF8(CmpName)) == 0 ) /* composant localise */ - { - Module = new MODULE(m_Pcb); - // Switch the locale to standard C (needed to print floating point numbers like 1.3) - SetLocaleTo_C_standard( ); - Module->ReadDescr(lib_module, &LineNum); - SetLocaleTo_Default( ); // revert to the current locale - Module->SetPosition(wxPoint(0,0) ); - fclose(lib_module); - return(Module) ; - } - } - fclose(lib_module) ; lib_module = 0; - } + /* Lecture de la liste des composants de la librairie */ + Found = 0; + while( !Found && GetLine( lib_module, Line, &LineNum ) ) + { + if( strncmp( Line, "$MODULE", 6 ) == 0 ) + break; - if( lib_module ) fclose(lib_module) ; + if( strnicmp( Line, "$INDEX", 6 ) == 0 ) + { + while( GetLine( lib_module, Line, &LineNum ) ) + { + if( strnicmp( Line, "$EndINDEX", 9 ) == 0 ) + break; - wxString msg; - msg.Printf(_("Module %s not found"),CmpName.GetData()); - DisplayError(this, msg); - return(NULL) ; + StrPurge( Line ); + if( stricmp( Line, CONV_TO_UTF8( CmpName ) ) == 0 ) + { + Found = 1; + break; /* Trouve! */ + } + } + } + } + + /* Lecture de la librairie */ + while( Found && GetLine( lib_module, Line, &LineNum ) ) + { + if( Line[0] != '$' ) + continue; + + if( Line[1] != 'M' ) + continue; + + if( strnicmp( Line, "$MODULE", 7 ) != 0 ) + continue; + + /* Lecture du nom du composant */ + sscanf( Line + 7, " %s", Name ); + if( stricmp( Name, CONV_TO_UTF8( CmpName ) ) == 0 ) /* composant localise */ + { + Module = new MODULE( GetBoard() ); + + // Switch the locale to standard C (needed to print floating point numbers like 1.3) + SetLocaleTo_C_standard(); + Module->ReadDescr( lib_module, &LineNum ); + SetLocaleTo_Default(); // revert to the current locale + Module->SetPosition( wxPoint( 0, 0 ) ); + fclose( lib_module ); + return Module; + } + } + + fclose( lib_module ); lib_module = 0; + } + + if( lib_module ) + fclose( lib_module ); + + wxString msg; + msg.Printf( _( "Module %s not found" ), CmpName.GetData() ); + DisplayError( this, msg ); + return NULL; } - - diff --git a/cvpcb/setvisu.cpp b/cvpcb/setvisu.cpp index d15b3e785b..f717d61a77 100644 --- a/cvpcb/setvisu.cpp +++ b/cvpcb/setvisu.cpp @@ -50,13 +50,13 @@ void WinEDA_CvpcbFrame::CreateScreenCmp() DrawFrame->SetStatusText( msg, 0 ); - if( DrawFrame->m_Pcb->m_Modules.GetCount() ) + if( DrawFrame->GetBoard()->m_Modules.GetCount() ) { // there is only one module in the list - DrawFrame->m_Pcb->m_Modules.DeleteAll(); + DrawFrame->GetBoard()->m_Modules.DeleteAll(); } - DrawFrame->m_Pcb->m_Modules.PushBack( DrawFrame->Get_Module( FootprintName ) ); + DrawFrame->GetBoard()->m_Modules.PushBack( DrawFrame->Get_Module( FootprintName ) ); DrawFrame->Zoom_Automatique( FALSE ); if( DrawFrame->m_Draw3DFrame ) @@ -77,7 +77,7 @@ void WinEDA_DisplayFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) /*******************************************************************/ /* Draws the current highlighted footprint */ { - if( !m_Pcb ) + if( !GetBoard() ) return; ActiveScreen = (PCB_SCREEN*) GetScreen(); @@ -86,9 +86,9 @@ void WinEDA_DisplayFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) DrawPanel->EraseScreen( DC ); DrawPanel->DrawBackGround( DC ); - m_Pcb->Draw( DrawPanel, DC, GR_COPY, wxPoint(0,0) ); + GetBoard()->Draw( DrawPanel, DC, GR_COPY ); - MODULE* Module = m_Pcb->m_Modules; + MODULE* Module = GetBoard()->m_Modules; if ( Module ) Module->Display_Infos( this ); Affiche_Status_Box(); diff --git a/gerbview/dcode.cpp b/gerbview/dcode.cpp index d4a5f0ef99..99ae97e71b 100644 --- a/gerbview/dcode.cpp +++ b/gerbview/dcode.cpp @@ -78,6 +78,8 @@ GERBER::GERBER( int aLayer ) for( unsigned ii = 0; ii < DIM( m_Aperture_List ); ii++ ) m_Aperture_List[ii] = 0; + + m_Pcb = 0; } @@ -88,6 +90,8 @@ GERBER::~GERBER() delete m_Aperture_List[ii]; // m_Aperture_List[ii] = NULL; } + + delete m_Pcb; } @@ -381,7 +385,7 @@ void WinEDA_GerberFrame::CopyDCodesSizeToItems() { static D_CODE dummy(999); //Used if D_CODE not found in list - for( TRACK* track = m_Pcb->m_Track; track; track = track->Next() ) + for( TRACK* track = GetBoard()->m_Track; track; track = track->Next() ) { GERBER* gerber = g_GERBER_List[track->GetLayer()]; wxASSERT( gerber ); diff --git a/gerbview/deltrack.cpp b/gerbview/deltrack.cpp index df7aa6b317..c411a98046 100644 --- a/gerbview/deltrack.cpp +++ b/gerbview/deltrack.cpp @@ -23,15 +23,18 @@ void WinEDA_GerberFrame::Delete_DCode_Items( wxDC* DC, int dcode_value, int laye { if( dcode_value < FIRST_DCODE ) // No tool selected return; - BOARD* Pcb = m_Pcb; - TRACK* track = Pcb->m_Track, * next_track; - for( ; track != NULL; track = next_track ) + + TRACK* next; + for( TRACK* track = GetBoard()->m_Track; track; track = next ) { - next_track = track->Next(); + next = track->Next(); + if( dcode_value != track->GetNet() ) continue; + if( layer_number >= 0 && layer_number != track->GetLayer() ) continue; + Delete_Segment( DC, track ); } diff --git a/gerbview/edit.cpp b/gerbview/edit.cpp index 40f01eb678..5b82b9d259 100644 --- a/gerbview/edit.cpp +++ b/gerbview/edit.cpp @@ -225,11 +225,9 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event ) break; case ID_TOOLBARH_PCB_SELECT_LAYER: - { ((PCB_SCREEN*)GetScreen())->m_Active_Layer = m_SelLayerBox->GetChoice(); DrawPanel->Refresh( TRUE ); break; - } case ID_TOOLBARH_GERBER_SELECT_TOOL: if( gerber_layer ) diff --git a/gerbview/export_to_pcbnew.cpp b/gerbview/export_to_pcbnew.cpp index 6f9327449b..be8b0391ef 100644 --- a/gerbview/export_to_pcbnew.cpp +++ b/gerbview/export_to_pcbnew.cpp @@ -138,7 +138,7 @@ static int SavePcbFormatAscii( WinEDA_GerberFrame* frame, FILE* aFile, { char line[256]; TRACK* track; - BOARD* gerberPcb = frame->m_Pcb; + BOARD* gerberPcb = frame->GetBoard(); BOARD* pcb; wxBeginBusyCursor(); diff --git a/gerbview/gerberframe.cpp b/gerbview/gerberframe.cpp index a1bd411ea6..bb806d9388 100644 --- a/gerbview/gerberframe.cpp +++ b/gerbview/gerberframe.cpp @@ -312,10 +312,10 @@ int WinEDA_GerberFrame::BestZoom() wxSize size; /* calcul du zoom montrant tout le dessim */ - m_Pcb->ComputeBoundaryBox(); + GetBoard()->ComputeBoundaryBox(); size = DrawPanel->GetClientSize(); - ii = m_Pcb->m_BoundaryBox.GetWidth() / size.x; - jj = m_Pcb->m_BoundaryBox.GetHeight() / size.y; + ii = GetBoard()->m_BoundaryBox.GetWidth() / size.x; + jj = GetBoard()->m_BoundaryBox.GetHeight() / size.y; bestzoom = MAX( ii, jj ) + 1; /* determination du zoom existant le plus proche */ @@ -327,7 +327,7 @@ int WinEDA_GerberFrame::BestZoom() bestzoom = ii; - GetScreen()->m_Curseur = m_Pcb->m_BoundaryBox.Centre(); + GetScreen()->m_Curseur = GetBoard()->m_BoundaryBox.Centre(); return bestzoom; } diff --git a/gerbview/gerbview.cpp b/gerbview/gerbview.cpp index a37db9f80c..61eea6a950 100644 --- a/gerbview/gerbview.cpp +++ b/gerbview/gerbview.cpp @@ -53,7 +53,7 @@ bool WinEDA_App::OnInit() /* Gerbview mainframe title */ wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion(); frame->SetTitle( Title ); - frame->m_Pcb = new BOARD( NULL, frame ); + frame->SetBoard( new BOARD( NULL, frame ) ); SetTopWindow( frame ); // Set GerbView mainframe on top frame->Show( TRUE ); // Show GerbView mainframe diff --git a/gerbview/gerbview.h b/gerbview/gerbview.h index 8500f9ac28..22afad1d87 100644 --- a/gerbview/gerbview.h +++ b/gerbview/gerbview.h @@ -316,6 +316,7 @@ class GERBER D_CODE* m_Aperture_List[MAX_TOOLS]; ///< Dcode (Aperture) List for this layer bool m_Exposure; ///< whether an aperture macro tool is flashed on or off + BOARD* m_Pcb; public: wxString m_FileName; // Full File Name for this layer diff --git a/gerbview/initpcb.cpp b/gerbview/initpcb.cpp index 711a09cd36..28fcd824ae 100644 --- a/gerbview/initpcb.cpp +++ b/gerbview/initpcb.cpp @@ -24,23 +24,23 @@ bool WinEDA_GerberFrame::Clear_Pcb( bool query ) { int layer; - if( m_Pcb == NULL ) + if( GetBoard() == NULL ) return FALSE; if( query ) { - if( m_Pcb->m_Drawings || m_Pcb->m_Track || m_Pcb->m_Zone ) + if( GetBoard()->m_Drawings || GetBoard()->m_Track || GetBoard()->m_Zone ) { if( !IsOK( this, _( "Current Data will be lost ?" ) ) ) return FALSE; } } - m_Pcb->m_Drawings.DeleteAll(); + GetBoard()->m_Drawings.DeleteAll(); - m_Pcb->m_Track.DeleteAll(); + GetBoard()->m_Track.DeleteAll(); - m_Pcb->m_Zone.DeleteAll(); + GetBoard()->m_Zone.DeleteAll(); for( ; g_UnDeleteStackPtr != 0; ) { @@ -56,13 +56,13 @@ bool WinEDA_GerberFrame::Clear_Pcb( bool query ) } /* remise a 0 ou a une valeur initiale des variables de la structure */ - m_Pcb->m_BoundaryBox.SetOrigin( 0, 0 ); - m_Pcb->m_BoundaryBox.SetSize( 0, 0 ); - m_Pcb->m_Status_Pcb = 0; - m_Pcb->m_NbLoclinks = 0; - m_Pcb->m_NbLinks = 0; - m_Pcb->m_NbNodes = 0; - m_Pcb->m_NbNoconnect = 0; + GetBoard()->m_BoundaryBox.SetOrigin( 0, 0 ); + GetBoard()->m_BoundaryBox.SetSize( 0, 0 ); + GetBoard()->m_Status_Pcb = 0; + GetBoard()->m_NbLoclinks = 0; + GetBoard()->m_NbLinks = 0; + GetBoard()->m_NbNodes = 0; + GetBoard()->m_NbNoconnect = 0; /* Init parametres de gestion des ecrans PAD et PCB */ SetBaseScreen( ActiveScreen = ScreenPcb ); @@ -79,7 +79,7 @@ void WinEDA_GerberFrame::Erase_Zones( bool query ) if( query && !IsOK( this, _( "Delete zones ?" ) ) ) return; - m_Pcb->m_Zone.DeleteAll(); + GetBoard()->m_Zone.DeleteAll(); ScreenPcb->SetModify(); } @@ -95,7 +95,7 @@ void WinEDA_GerberFrame::Erase_Segments_Pcb( bool all_layers, bool query ) layer = -1; BOARD_ITEM* next; - for( BOARD_ITEM* item = m_Pcb->m_Drawings; item; item = next ) + for( BOARD_ITEM* item = GetBoard()->m_Drawings; item; item = next ) { next = item->Next(); @@ -106,7 +106,7 @@ void WinEDA_GerberFrame::Erase_Segments_Pcb( bool all_layers, bool query ) case TYPE_COTATION: case TYPE_MIRE: if( item->GetLayer() == layer || layer < 0 ) - m_Pcb->Delete( item ); + GetBoard()->Delete( item ); break; default: @@ -136,7 +136,7 @@ void WinEDA_GerberFrame::Erase_Pistes( int masque_type, bool query ) return; /* Marquage des pistes a effacer */ - for( pt_segm = m_Pcb->m_Track; pt_segm != NULL; pt_segm = (TRACK*) PtNext ) + for( pt_segm = GetBoard()->m_Track; pt_segm != NULL; pt_segm = (TRACK*) PtNext ) { PtNext = pt_segm->Next(); if( pt_segm->GetState( SEGM_FIXE | SEGM_AR ) & masque_type ) @@ -158,7 +158,7 @@ void WinEDA_GerberFrame::Erase_Textes_Pcb( bool query ) if( query && !IsOK( this, _( "Delete Pcb Texts" ) ) ) return; - PtStruct = m_Pcb->m_Drawings; + PtStruct = GetBoard()->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtNext ) { PtNext = PtStruct->Next(); @@ -183,7 +183,7 @@ void WinEDA_GerberFrame::Erase_Current_Layer( bool query ) /* Delete tracks (spots and lines) */ TRACK* PtNext; - for( TRACK* pt_segm = m_Pcb->m_Track; pt_segm != NULL; pt_segm = (TRACK*) PtNext ) + for( TRACK* pt_segm = GetBoard()->m_Track; pt_segm != NULL; pt_segm = (TRACK*) PtNext ) { PtNext = pt_segm->Next(); if( pt_segm->GetLayer() != layer ) @@ -193,7 +193,7 @@ void WinEDA_GerberFrame::Erase_Current_Layer( bool query ) /* Delete polygons */ SEGZONE* Nextzone; - for( SEGZONE* zone = m_Pcb->m_Zone; zone != NULL; zone = Nextzone ) + for( SEGZONE* zone = GetBoard()->m_Zone; zone != NULL; zone = Nextzone ) { Nextzone = zone->Next(); if( zone->GetLayer() != layer ) diff --git a/gerbview/locate.cpp b/gerbview/locate.cpp index 3290525dc1..00ee99f645 100644 --- a/gerbview/locate.cpp +++ b/gerbview/locate.cpp @@ -49,7 +49,7 @@ BOARD_ITEM* WinEDA_GerberFrame::Locate( int typeloc ) /* Localistion des pistes et vias, avec priorite aux vias */ layer = GetScreen()->m_Active_Layer; - Track = Locate_Pistes( m_Pcb->m_Track, -1, typeloc ); + Track = Locate_Pistes( GetBoard()->m_Track, -1, typeloc ); if( Track != NULL ) { TrackLocate = Track; /* Reperage d'une piste ou via */ @@ -67,19 +67,19 @@ BOARD_ITEM* WinEDA_GerberFrame::Locate( int typeloc ) } - pt_texte_pcb = Locate_Texte_Pcb( (TEXTE_PCB*) m_Pcb->m_Drawings.GetFirst(), typeloc ); + pt_texte_pcb = Locate_Texte_Pcb( (TEXTE_PCB*) GetBoard()->m_Drawings.GetFirst(), typeloc ); if( pt_texte_pcb ) // texte type PCB localise { pt_texte_pcb->Display_Infos( this ); return pt_texte_pcb; } - if( ( DrawSegm = Locate_Segment_Pcb( m_Pcb, typeloc ) ) != NULL ) + if( ( DrawSegm = Locate_Segment_Pcb( GetBoard(), typeloc ) ) != NULL ) { return DrawSegm; } - if( ( TrackLocate = Locate_Zone( m_Pcb->m_Zone, + if( ( TrackLocate = Locate_Zone( GetBoard()->m_Zone, GetScreen()->m_Active_Layer, typeloc ) ) != NULL ) { TrackLocate->Display_Infos( this ); diff --git a/gerbview/rs274d.cpp b/gerbview/rs274d.cpp index 1b3550e75f..f39c0d8e9d 100644 --- a/gerbview/rs274d.cpp +++ b/gerbview/rs274d.cpp @@ -837,7 +837,7 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, wxDC* DC, APERTURE_T aperture = APT_CIRCLE; TRACK* track; - BOARD* pcb = frame->m_Pcb; + BOARD* pcb = frame->GetBoard(); int activeLayer = frame->GetScreen()->m_Active_Layer; diff --git a/gerbview/tracepcb.cpp b/gerbview/tracepcb.cpp index 80e601956a..f8f12d69fd 100644 --- a/gerbview/tracepcb.cpp +++ b/gerbview/tracepcb.cpp @@ -71,7 +71,7 @@ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) { PCB_SCREEN* screen = (PCB_SCREEN*)GetScreen(); - if( !m_Pcb ) + if( !GetBoard() ) return; ActiveScreen = screen; GRSetDrawMode( DC, GR_COPY ); @@ -110,7 +110,7 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay * @param printmasklayer = mask for allowed layer (=-1 to draw all layers) */ { - if( !m_Pcb ) + if( !GetBoard() ) return; bool erase; @@ -123,7 +123,7 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay // minimize reallocations of the vector's internal array by starting with a good sized one. points.reserve(10000); - for( TRACK* track = m_Pcb->m_Zone; track; track = track->Next() ) + for( TRACK* track = GetBoard()->m_Zone; track; track = track->Next() ) { if( !(track->ReturnMaskLayer() & printmasklayer) ) continue; @@ -179,10 +179,10 @@ void WinEDA_GerberFrame::Trace_Gerber( wxDC* DC, int draw_mode, int printmasklay } // Draw tracks and flashes down here. This will probably not be a final solution to drawing order issues - Draw_Track_Buffer( DrawPanel, DC, m_Pcb, draw_mode, printmasklayer ); + Draw_Track_Buffer( DrawPanel, DC, GetBoard(), draw_mode, printmasklayer ); if( DisplayOpt.DisplayPadNum ) - Affiche_DCodes_Pistes( DrawPanel, DC, m_Pcb, GR_COPY ); + Affiche_DCodes_Pistes( DrawPanel, DC, GetBoard(), GR_COPY ); GetScreen()->ClrRefreshReq(); } diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 0330603585..3c2f9c324a 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -51,9 +51,10 @@ class ZONE_CONTAINER; class WinEDA_BasePcbFrame : public WinEDA_DrawFrame { -public: BOARD* m_Pcb; +public: + bool m_DisplayPadFill; // How show pads bool m_DisplayPadNum; // show pads numbers @@ -76,13 +77,18 @@ public: ~WinEDA_BasePcbFrame(); /** - * Function SetBOARD + * Function SetBoard * sets the m_Pcb member in such as way as to ensure deleting any previous * BOARD. * @param aBoard The BOARD to put into the frame. */ - void SetBOARD( BOARD* aBoard ); + void SetBoard( BOARD* aBoard ); + BOARD* GetBoard() + { + wxASSERT( m_Pcb ); // phasing out m_Pcb for gerbview + return m_Pcb; + } // General virtual void OnCloseWindow( wxCloseEvent& Event ) = 0; @@ -209,10 +215,10 @@ public: void Place_Module( MODULE* module, wxDC* DC ); void InstallExchangeModuleFrame( MODULE* ExchangeModuleModule, wxDC* DC, const wxPoint& pos ); - // Graphic items edition: - void InstallGraphicItemPropertiesDialog(DRAWSEGMENT * aItem, wxDC* aDC); + // Graphic items edition: + void InstallGraphicItemPropertiesDialog(DRAWSEGMENT * aItem, wxDC* aDC); - // module texts + // module texts void RotateTextModule( TEXTE_MODULE* Text, wxDC* DC ); void DeleteTextModule( TEXTE_MODULE* Text, wxDC* DC ); void PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC ); diff --git a/pcbnew/affiche.cpp b/pcbnew/affiche.cpp index 16fb1137b0..cb1ec5acad 100644 --- a/pcbnew/affiche.cpp +++ b/pcbnew/affiche.cpp @@ -30,7 +30,7 @@ void Affiche_Infos_Equipot( int netcode, WinEDA_BasePcbFrame* frame ) frame->MsgPanel->EraseMsgBox(); - equipot = frame->m_Pcb->FindNet( netcode ); + equipot = frame->GetBoard()->FindNet( netcode ); if( equipot ) Affiche_1_Parametre( frame, 1, _( "Net Name" ), equipot->GetNetname(), RED ); else @@ -39,7 +39,7 @@ void Affiche_Infos_Equipot( int netcode, WinEDA_BasePcbFrame* frame ) txt.Printf( wxT( "%d" ), netcode ); Affiche_1_Parametre( frame, 30, _( "Net Code" ), txt, RED ); - for( ii = 0, module = frame->m_Pcb->m_Modules; module != 0; + for( ii = 0, module = frame->GetBoard()->m_Modules; module != 0; module = module->Next() ) { for( pad = module->m_Pads; pad != 0; pad = pad->Next() ) @@ -52,7 +52,7 @@ void Affiche_Infos_Equipot( int netcode, WinEDA_BasePcbFrame* frame ) txt.Printf( wxT( "%d" ), ii ); Affiche_1_Parametre( frame, 40, _( "Pads" ), txt, DARKGREEN ); - for( ii = 0, Struct = frame->m_Pcb->m_Track; Struct != NULL; Struct = Struct->Next() ) + for( ii = 0, Struct = frame->GetBoard()->m_Track; Struct != NULL; Struct = Struct->Next() ) { ii++; if( Struct->Type() == TYPE_VIA ) diff --git a/pcbnew/attribut.cpp b/pcbnew/attribut.cpp index b2f947c223..00e8faab8b 100644 --- a/pcbnew/attribut.cpp +++ b/pcbnew/attribut.cpp @@ -69,7 +69,7 @@ void WinEDA_PcbFrame::Attribut_net( wxDC* DC, int net_code, bool Flag_On ) * if net_code < 0 all the segments are modified. */ { - TRACK* Track = m_Pcb->m_Track; + TRACK* Track = GetBoard()->m_Track; /* search the first segment for the selected net_code */ if( net_code >= 0 ) @@ -86,6 +86,7 @@ void WinEDA_PcbFrame::Attribut_net( wxDC* DC, int net_code, bool Flag_On ) { if( (net_code >= 0 ) && (net_code != Track->GetNet()) ) break; + GetScreen()->SetModify(); Track->SetState( SEGM_FIXE, Flag_On ); Track->Draw( DrawPanel, DC, GR_OR | GR_SURBRILL ); diff --git a/pcbnew/automove.cpp b/pcbnew/automove.cpp index 6c4705baaf..e3042b14c6 100644 --- a/pcbnew/automove.cpp +++ b/pcbnew/automove.cpp @@ -77,7 +77,7 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event ) /* Erase rastnest if needed */ if( g_Show_Ratsnest ) DrawGeneralRatsnest( &dc ); - m_Pcb->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST; + GetBoard()->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST; switch( id ) // Traitement des commandes { @@ -176,7 +176,7 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event ) break; } - m_Pcb->m_Status_Pcb &= ~DO_NOT_SHOW_GENERAL_RASTNEST; + GetBoard()->m_Status_Pcb &= ~DO_NOT_SHOW_GENERAL_RASTNEST; ReCompile_Ratsnest_After_Changes( &dc ); SetToolbars(); } @@ -202,7 +202,7 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( wxDC* DC, bool PlaceModulesHorsPcb ) bool EdgeExists; float surface; - if( m_Pcb->m_Modules == NULL ) + if( GetBoard()->m_Modules == NULL ) { DisplayError( this, _( "No Modules!" ), 10 ); return; } @@ -222,22 +222,22 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( wxDC* DC, bool PlaceModulesHorsPcb ) return; } - Module = m_Pcb->m_Modules; + Module = GetBoard()->m_Modules; for( ; Module != NULL; Module = Module->Next() ) // remise a jour du rect d'encadrement { Module->Set_Rectangle_Encadrement(); Module->SetRectangleExinscrit(); } - BaseListeModules = GenListeModules( m_Pcb, NULL ); + BaseListeModules = GenListeModules( GetBoard(), NULL ); /* Si repartition de modules Hors PCB, le curseur est mis au dessous * du PCB, pour eviter de placer des composants dans la zone PCB */ if( PlaceModulesHorsPcb && EdgeExists ) { - if( GetScreen()->m_Curseur.y < (m_Pcb->m_BoundaryBox.GetBottom() + 2000) ) - GetScreen()->m_Curseur.y = m_Pcb->m_BoundaryBox.GetBottom() + 2000; + if( GetScreen()->m_Curseur.y < (GetBoard()->m_BoundaryBox.GetBottom() + 2000) ) + GetScreen()->m_Curseur.y = GetBoard()->m_BoundaryBox.GetBottom() + 2000; } /* calcul de la surface occupee par les circuits */ @@ -247,7 +247,7 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( wxDC* DC, bool PlaceModulesHorsPcb ) Module = *pt_Dmod; if( PlaceModulesHorsPcb && EdgeExists ) { - if( m_Pcb->m_BoundaryBox.Inside( Module->m_Pos ) ) + if( GetBoard()->m_BoundaryBox.Inside( Module->m_Pos ) ) continue; } surface += Module->m_Surface; @@ -267,7 +267,7 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( wxDC* DC, bool PlaceModulesHorsPcb ) if( PlaceModulesHorsPcb && EdgeExists ) { - if( m_Pcb->m_BoundaryBox.Inside( Module->m_Pos ) ) + if( GetBoard()->m_BoundaryBox.Inside( Module->m_Pos ) ) continue; } @@ -314,7 +314,7 @@ void WinEDA_PcbFrame::FixeModule( MODULE* Module, bool Fixe ) } else { - Module = m_Pcb->m_Modules; + Module = GetBoard()->m_Modules; for( ; Module != NULL; Module = Module->Next() ) { if( WildCompareString( ModulesMaskSelection, Module->m_Reference->m_Text ) ) diff --git a/pcbnew/autoplac.cpp b/pcbnew/autoplac.cpp index 5574292f8d..ca97f13df2 100644 --- a/pcbnew/autoplac.cpp +++ b/pcbnew/autoplac.cpp @@ -85,7 +85,7 @@ void WinEDA_PcbFrame::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC float Pas; int lay_tmp_TOP, lay_tmp_BOTTOM, OldPasRoute; - if( m_Pcb->m_Modules == NULL ) + if( GetBoard()->m_Modules == NULL ) return; DrawPanel->m_AbortRequest = FALSE; @@ -126,7 +126,7 @@ void WinEDA_PcbFrame::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC g_GridRoutingSize = 10; // Min value = 1/1000 inch /* Compute module parmeters used in auto place */ - Module = m_Pcb->m_Modules; + Module = GetBoard()->m_Modules; for( ; Module != NULL; Module = Module->Next() ) // remise a jour du rect d'encadrement { Module->Set_Rectangle_Encadrement(); @@ -138,11 +138,11 @@ void WinEDA_PcbFrame::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC return; /* Mise a jour des parametres modules utiles au placement */ - BaseListeModules = GenListeModules( m_Pcb, &NbTotalModules ); + BaseListeModules = GenListeModules( GetBoard(), &NbTotalModules ); MyFree( BaseListeModules ); /* Placement des modules fixes sur le plan de placement */ - Module = m_Pcb->m_Modules; + Module = GetBoard()->m_Modules; for( ; Module != NULL; Module = Module->Next() ) { Module->m_ModuleStatus &= ~MODULE_to_PLACE; @@ -158,7 +158,7 @@ void WinEDA_PcbFrame::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC Module->m_ModuleStatus &= ~MODULE_is_PLACED; if( Module->m_ModuleStatus & MODULE_is_LOCKED ) break; - if( !m_Pcb->m_BoundaryBox.Inside( Module->m_Pos ) ) + if( !GetBoard()->m_BoundaryBox.Inside( Module->m_Pos ) ) Module->m_ModuleStatus |= MODULE_to_PLACE; break; @@ -305,14 +305,15 @@ end_of_tst: Route_Layer_BOTTOM = lay_tmp_BOTTOM; g_GridRoutingSize = OldPasRoute; - Module = m_Pcb->m_Modules; + Module = GetBoard()->m_Modules; for( ; Module != NULL; Module = Module->Next() ) { Module->Set_Rectangle_Encadrement(); } /* Recalcul de la liste des pads, detruite par les calculs precedents */ - m_Pcb->m_Status_Pcb = 0; build_liste_pads(); + GetBoard()->m_Status_Pcb = 0; + build_liste_pads(); DrawPanel->ReDraw( DC, TRUE ); @@ -333,11 +334,11 @@ void WinEDA_PcbFrame::DrawInfoPlace( wxDC* DC ) GRSetDrawMode( DC, GR_COPY ); for( ii = 0; ii < Nrows; ii++ ) { - oy = m_Pcb->m_BoundaryBox.m_Pos.y + (ii * g_GridRoutingSize); + oy = GetBoard()->m_BoundaryBox.m_Pos.y + (ii * g_GridRoutingSize); for( jj = 0; jj < Ncols; jj++ ) { - ox = m_Pcb->m_BoundaryBox.m_Pos.x + (jj * g_GridRoutingSize); + ox = GetBoard()->m_BoundaryBox.m_Pos.x + (jj * g_GridRoutingSize); /* surface de placement : */ color = BLACK; @@ -405,16 +406,16 @@ int WinEDA_PcbFrame::GenPlaceBoard() } /* The boundary box must have its start point on placing grid: */ - m_Pcb->m_BoundaryBox.m_Pos.x -= m_Pcb->m_BoundaryBox.m_Pos.x % g_GridRoutingSize; - m_Pcb->m_BoundaryBox.m_Pos.y -= m_Pcb->m_BoundaryBox.m_Pos.y % g_GridRoutingSize; + GetBoard()->m_BoundaryBox.m_Pos.x -= GetBoard()->m_BoundaryBox.m_Pos.x % g_GridRoutingSize; + GetBoard()->m_BoundaryBox.m_Pos.y -= GetBoard()->m_BoundaryBox.m_Pos.y % g_GridRoutingSize; /* The boundary box must have its end point on placing grid: */ - wxPoint end = m_Pcb->m_BoundaryBox.GetEnd(); + wxPoint end = GetBoard()->m_BoundaryBox.GetEnd(); end.x -= end.x % g_GridRoutingSize; end.x += g_GridRoutingSize; end.y -= end.y % g_GridRoutingSize; end.y += g_GridRoutingSize; - m_Pcb->m_BoundaryBox.SetEnd( end ); + GetBoard()->m_BoundaryBox.SetEnd( end ); - Nrows = m_Pcb->m_BoundaryBox.GetHeight() / g_GridRoutingSize; - Ncols = m_Pcb->m_BoundaryBox.GetWidth() / g_GridRoutingSize; + Nrows = GetBoard()->m_BoundaryBox.GetHeight() / g_GridRoutingSize; + Ncols = GetBoard()->m_BoundaryBox.GetWidth() / g_GridRoutingSize; /* get a small margin for memory allocation: */ Ncols += 2; Nrows += 2; NbCells = Ncols * Nrows; @@ -446,7 +447,7 @@ int WinEDA_PcbFrame::GenPlaceBoard() Route_Layer_TOP = CMP_N; /* Place the edge layer segments */ - PtStruct = m_Pcb->m_Drawings; + PtStruct = GetBoard()->m_Drawings; TRACK TmpSegm( NULL ); TmpSegm.SetLayer( -1 ); @@ -468,7 +469,7 @@ int WinEDA_PcbFrame::GenPlaceBoard() TmpSegm.m_Shape = DrawSegm->m_Shape; TmpSegm.m_Param = DrawSegm->m_Angle; - TraceSegmentPcb( m_Pcb, &TmpSegm, HOLE | CELL_is_EDGE, g_GridRoutingSize, WRITE_CELL ); + TraceSegmentPcb( GetBoard(), &TmpSegm, HOLE | CELL_is_EDGE, g_GridRoutingSize, WRITE_CELL ); break; case TYPE_TEXTE: @@ -516,25 +517,25 @@ void WinEDA_PcbFrame::GenModuleOnBoard( MODULE* Module ) oy = Module->m_RealBoundaryBox.m_Pos.y - marge; fy = Module->m_RealBoundaryBox.GetBottom() + marge; - if( ox < m_Pcb->m_BoundaryBox.m_Pos.x ) - ox = m_Pcb->m_BoundaryBox.m_Pos.x; - if( ox > m_Pcb->m_BoundaryBox.GetRight() ) - ox = m_Pcb->m_BoundaryBox.GetRight(); + if( ox < GetBoard()->m_BoundaryBox.m_Pos.x ) + ox = GetBoard()->m_BoundaryBox.m_Pos.x; + if( ox > GetBoard()->m_BoundaryBox.GetRight() ) + ox = GetBoard()->m_BoundaryBox.GetRight(); - if( fx < m_Pcb->m_BoundaryBox.m_Pos.x ) - fx = m_Pcb->m_BoundaryBox.m_Pos.x; - if( fx > m_Pcb->m_BoundaryBox.GetRight() ) - fx = m_Pcb->m_BoundaryBox.GetRight(); + if( fx < GetBoard()->m_BoundaryBox.m_Pos.x ) + fx = GetBoard()->m_BoundaryBox.m_Pos.x; + if( fx > GetBoard()->m_BoundaryBox.GetRight() ) + fx = GetBoard()->m_BoundaryBox.GetRight(); - if( oy < m_Pcb->m_BoundaryBox.m_Pos.y ) - oy = m_Pcb->m_BoundaryBox.m_Pos.y; - if( oy > m_Pcb->m_BoundaryBox.GetBottom() ) - oy = m_Pcb->m_BoundaryBox.GetBottom(); + if( oy < GetBoard()->m_BoundaryBox.m_Pos.y ) + oy = GetBoard()->m_BoundaryBox.m_Pos.y; + if( oy > GetBoard()->m_BoundaryBox.GetBottom() ) + oy = GetBoard()->m_BoundaryBox.GetBottom(); - if( fy < m_Pcb->m_BoundaryBox.m_Pos.y ) - fy = m_Pcb->m_BoundaryBox.m_Pos.y; - if( fy > m_Pcb->m_BoundaryBox.GetBottom() ) - fy = m_Pcb->m_BoundaryBox.GetBottom(); + if( fy < GetBoard()->m_BoundaryBox.m_Pos.y ) + fy = GetBoard()->m_BoundaryBox.m_Pos.y; + if( fy > GetBoard()->m_BoundaryBox.GetBottom() ) + fy = GetBoard()->m_BoundaryBox.GetBottom(); masque_layer = 0; if( Module->GetLayer() == CMP_N ) @@ -542,7 +543,7 @@ void WinEDA_PcbFrame::GenModuleOnBoard( MODULE* Module ) if( Module->GetLayer() == COPPER_LAYER_N ) masque_layer = CUIVRE_LAYER; - TraceFilledRectangle( m_Pcb, ox, oy, fx, fy, masque_layer, + TraceFilledRectangle( GetBoard(), ox, oy, fx, fy, masque_layer, CELL_is_MODULE, WRITE_OR_CELL ); /* Trace des pads et leur surface de securite */ @@ -550,13 +551,13 @@ void WinEDA_PcbFrame::GenModuleOnBoard( MODULE* Module ) for( Pad = Module->m_Pads; Pad != NULL; Pad = Pad->Next() ) { - Place_1_Pad_Board( m_Pcb, Pad, CELL_is_MODULE, marge, WRITE_OR_CELL ); + Place_1_Pad_Board( GetBoard(), Pad, CELL_is_MODULE, marge, WRITE_OR_CELL ); } /* Trace de la penalite */ marge = (g_GridRoutingSize * Module->m_PadNum ) / GAIN; Penalite = PENALITE; - TracePenaliteRectangle( m_Pcb, ox, oy, fx, fy, marge, Penalite, + TracePenaliteRectangle( GetBoard(), ox, oy, fx, fy, marge, Penalite, masque_layer ); } @@ -585,10 +586,10 @@ int WinEDA_PcbFrame::RecherchePlacementModule( MODULE* Module, wxDC* DC ) Module->Display_Infos( this ); - Build_PlacedPads_List( m_Pcb ); + Build_PlacedPads_List( GetBoard() ); - LastPosOK.x = m_Pcb->m_BoundaryBox.m_Pos.x; - LastPosOK.y = m_Pcb->m_BoundaryBox.m_Pos.y; + LastPosOK.x = GetBoard()->m_BoundaryBox.m_Pos.x; + LastPosOK.y = GetBoard()->m_BoundaryBox.m_Pos.y; cx = Module->m_Pos.x; cy = Module->m_Pos.y; ox = Module->m_RealBoundaryBox.m_Pos.x - cx; @@ -596,15 +597,15 @@ int WinEDA_PcbFrame::RecherchePlacementModule( MODULE* Module, wxDC* DC ) oy = Module->m_RealBoundaryBox.m_Pos.y - cy; fy = Module->m_RealBoundaryBox.m_Size.y + oy; - CurrPosition.x = m_Pcb->m_BoundaryBox.m_Pos.x - ox; - CurrPosition.y = m_Pcb->m_BoundaryBox.m_Pos.y - oy; + CurrPosition.x = GetBoard()->m_BoundaryBox.m_Pos.x - ox; + CurrPosition.y = GetBoard()->m_BoundaryBox.m_Pos.y - oy; /* remise sur la grille de placement: */ CurrPosition.x -= CurrPosition.x % g_GridRoutingSize; CurrPosition.y -= CurrPosition.y % g_GridRoutingSize; g_Offset_Module.x = cx - CurrPosition.x; g_Offset_Module.y = cy - CurrPosition.y; - m_Pcb->m_Status_Pcb &= ~CHEVELU_LOCAL_OK; + GetBoard()->m_Status_Pcb &= ~CHEVELU_LOCAL_OK; /* tst des pastilles traversantes, qui pour un circuit imprime ayant des * composants des 2 cotes, peuvent tomber sur un composant de cote oppose: @@ -634,7 +635,7 @@ int WinEDA_PcbFrame::RecherchePlacementModule( MODULE* Module, wxDC* DC ) mincout = -1.0; Affiche_Message( wxT( "Score ??, pos ??" ) ); - for( ; CurrPosition.x < m_Pcb->m_BoundaryBox.GetRight() - fx; + for( ; CurrPosition.x < GetBoard()->m_BoundaryBox.GetRight() - fx; CurrPosition.x += g_GridRoutingSize ) { wxYield(); @@ -653,13 +654,13 @@ int WinEDA_PcbFrame::RecherchePlacementModule( MODULE* Module, wxDC* DC ) DrawModuleOutlines( DrawPanel, DC, Module ); g_Offset_Module.x = cx - CurrPosition.x; - CurrPosition.y = m_Pcb->m_BoundaryBox.m_Pos.y - oy; + CurrPosition.y = GetBoard()->m_BoundaryBox.m_Pos.y - oy; /* remise sur la grille de placement: */ CurrPosition.y -= CurrPosition.y % g_GridRoutingSize; DrawModuleOutlines( DrawPanel, DC, Module ); - for( ; CurrPosition.y < m_Pcb->m_BoundaryBox.GetBottom() - fy; + for( ; CurrPosition.y < GetBoard()->m_BoundaryBox.GetBottom() - fy; CurrPosition.y += g_GridRoutingSize ) { /* effacement des traces */ @@ -672,7 +673,7 @@ int WinEDA_PcbFrame::RecherchePlacementModule( MODULE* Module, wxDC* DC ) g_Offset_Module.y = cy - CurrPosition.y; DrawModuleOutlines( DrawPanel, DC, Module ); - Penalite = TstModuleOnBoard( m_Pcb, Module, TstOtherSide ); + Penalite = TstModuleOnBoard( GetBoard(), Module, TstOtherSide ); if( Penalite >= 0 ) /* c a d si le module peut etre place */ { error = 0; @@ -707,7 +708,7 @@ int WinEDA_PcbFrame::RecherchePlacementModule( MODULE* Module, wxDC* DC ) Module->m_RealBoundaryBox.m_Pos.y = oy + cy; CurrPosition = LastPosOK; - m_Pcb->m_Status_Pcb &= ~(CHEVELU_LOCAL_OK | LISTE_PAD_OK ); + GetBoard()->m_Status_Pcb &= ~(CHEVELU_LOCAL_OK | LISTE_PAD_OK ); MinCout = mincout; return error; @@ -870,7 +871,7 @@ float WinEDA_PcbFrame::Compute_Ratsnest_PlaceModule( wxDC* DC ) int fx, fy; int dx, dy; - if( (m_Pcb->m_Status_Pcb & CHEVELU_LOCAL_OK) == 0 ) + if( (GetBoard()->m_Status_Pcb & CHEVELU_LOCAL_OK) == 0 ) return -1; pt_local_chevelu = local_liste_chevelu; @@ -1103,11 +1104,11 @@ static MODULE* PickModule( WinEDA_PcbFrame* pcbframe, wxDC* DC ) CHEVELU* pt_local_chevelu; int NbModules, ii; - BaseListeModules = GenListeModules( pcbframe->m_Pcb, &NbModules ); + BaseListeModules = GenListeModules( pcbframe->GetBoard(), &NbModules ); if( BaseListeModules == NULL ) return NULL; - Build_PlacedPads_List( pcbframe->m_Pcb ); + Build_PlacedPads_List( pcbframe->GetBoard() ); /* Tri par surface decroissante des modules * (on place les plus gros en 1er), surface ponderee par le nombre de pads */ @@ -1120,7 +1121,7 @@ static MODULE* PickModule( WinEDA_PcbFrame* pcbframe, wxDC* DC ) (*pt_Dmod)->flag = 0; if( !( (*pt_Dmod)->m_ModuleStatus & MODULE_to_PLACE ) ) continue; - pcbframe->m_Pcb->m_Status_Pcb &= ~CHEVELU_LOCAL_OK; + pcbframe->GetBoard()->m_Status_Pcb &= ~CHEVELU_LOCAL_OK; adr_lowmem = buf_work; (*pt_Dmod)->Display_Infos( pcbframe ); pcbframe->build_ratsnest_module( DC, *pt_Dmod ); @@ -1136,7 +1137,7 @@ static MODULE* PickModule( WinEDA_PcbFrame* pcbframe, wxDC* DC ) } } - pcbframe->m_Pcb->m_Status_Pcb &= ~CHEVELU_LOCAL_OK; + pcbframe->GetBoard()->m_Status_Pcb &= ~CHEVELU_LOCAL_OK; qsort( BaseListeModules, NbModules, sizeof(MODULE * *), ( int (*)( const void*, const void* ) )Tri_RatsModules ); @@ -1169,7 +1170,7 @@ bool WinEDA_PcbFrame::SetBoardBoundaryBoxFromEdgesOnly() /* Determine le rectangle d'encadrement du pcb, selon les contours * (couche EDGE) uniquement * Sortie: - * m_Pcb->m_BoundaryBox mis a jour + * GetBoard()->m_BoundaryBox mis a jour * Retourne FALSE si pas de contour */ { @@ -1179,14 +1180,14 @@ bool WinEDA_PcbFrame::SetBoardBoundaryBoxFromEdgesOnly() DRAWSEGMENT* ptr; bool succes = FALSE; - if( m_Pcb == NULL ) + if( GetBoard() == NULL ) return FALSE; - m_Pcb->m_BoundaryBox.m_Pos.x = m_Pcb->m_BoundaryBox.m_Pos.y = 0x7FFFFFFFl; + GetBoard()->m_BoundaryBox.m_Pos.x = GetBoard()->m_BoundaryBox.m_Pos.y = 0x7FFFFFFFl; xmax = ymax = -0x7FFFFFFFl; /* Analyse des Contours PCB */ - PtStruct = m_Pcb->m_Drawings; + PtStruct = GetBoard()->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) { if( PtStruct->Type() != TYPE_DRAWSEGMENT ) @@ -1199,8 +1200,8 @@ bool WinEDA_PcbFrame::SetBoardBoundaryBoxFromEdgesOnly() cx = ptr->m_Start.x; cy = ptr->m_Start.y; rayon = (int) hypot( (double) (ptr->m_End.x - cx), (double) (ptr->m_End.y - cy) ); rayon += d; - m_Pcb->m_BoundaryBox.m_Pos.x = MIN( m_Pcb->m_BoundaryBox.m_Pos.x, cx - rayon ); - m_Pcb->m_BoundaryBox.m_Pos.y = MIN( m_Pcb->m_BoundaryBox.m_Pos.y, cy - rayon ); + GetBoard()->m_BoundaryBox.m_Pos.x = MIN( GetBoard()->m_BoundaryBox.m_Pos.x, cx - rayon ); + GetBoard()->m_BoundaryBox.m_Pos.y = MIN( GetBoard()->m_BoundaryBox.m_Pos.y, cy - rayon ); xmax = MAX( xmax, cx + rayon ); ymax = MAX( ymax, cy + rayon ); } @@ -1208,8 +1209,8 @@ bool WinEDA_PcbFrame::SetBoardBoundaryBoxFromEdgesOnly() { cx = MIN( ptr->m_Start.x, ptr->m_End.x ); cy = MIN( ptr->m_Start.y, ptr->m_End.y ); - m_Pcb->m_BoundaryBox.m_Pos.x = MIN( m_Pcb->m_BoundaryBox.m_Pos.x, cx - d ); - m_Pcb->m_BoundaryBox.m_Pos.y = MIN( m_Pcb->m_BoundaryBox.m_Pos.y, cy - d ); + GetBoard()->m_BoundaryBox.m_Pos.x = MIN( GetBoard()->m_BoundaryBox.m_Pos.x, cx - d ); + GetBoard()->m_BoundaryBox.m_Pos.y = MIN( GetBoard()->m_BoundaryBox.m_Pos.y, cy - d ); cx = MAX( ptr->m_Start.x, ptr->m_End.x ); cy = MAX( ptr->m_Start.y, ptr->m_End.y ); xmax = MAX( xmax, cx + d ); @@ -1217,7 +1218,7 @@ bool WinEDA_PcbFrame::SetBoardBoundaryBoxFromEdgesOnly() } } - m_Pcb->m_BoundaryBox.SetWidth( xmax - m_Pcb->m_BoundaryBox.m_Pos.x ); - m_Pcb->m_BoundaryBox.SetHeight( ymax - m_Pcb->m_BoundaryBox.m_Pos.y ); + GetBoard()->m_BoundaryBox.SetWidth( xmax - GetBoard()->m_BoundaryBox.m_Pos.x ); + GetBoard()->m_BoundaryBox.SetHeight( ymax - GetBoard()->m_BoundaryBox.m_Pos.y ); return succes; } diff --git a/pcbnew/autorout.cpp b/pcbnew/autorout.cpp index bf16b92fed..04c479e415 100644 --- a/pcbnew/autorout.cpp +++ b/pcbnew/autorout.cpp @@ -78,12 +78,12 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode ) break; } - if( (m_Pcb->m_Status_Pcb & LISTE_CHEVELU_OK ) == 0 ) + if( (GetBoard()->m_Status_Pcb & LISTE_CHEVELU_OK ) == 0 ) Compile_Ratsnest( DC, TRUE ); /* Placement du flag CH_ROUTE_REQ sur les chevelus demandes */ - ptmp = (CHEVELU*) m_Pcb->m_Ratsnest; - for( ii = m_Pcb->GetNumRatsnests(); ii > 0; ii--, ptmp++ ) + ptmp = (CHEVELU*) GetBoard()->m_Ratsnest; + for( ii = GetBoard()->GetNumRatsnests(); ii > 0; ii--, ptmp++ ) { ptmp->status &= ~CH_ROUTE_REQ; @@ -118,7 +118,7 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode ) } } - ptmp = (CHEVELU*) m_Pcb->m_Ratsnest; + ptmp = (CHEVELU*) GetBoard()->m_Ratsnest; start = time( NULL ); @@ -147,10 +147,10 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode ) } Affiche_Message( _( "Place Cells" ) ); - PlaceCells( m_Pcb, -1, FORCE_PADS ); + PlaceCells( GetBoard(), -1, FORCE_PADS ); /* Construction de la liste des pistes a router */ - Build_Work( m_Pcb, ptmp ); + Build_Work( GetBoard(), ptmp ); // DisplayBoard(DrawPanel, DC); @@ -181,14 +181,14 @@ void WinEDA_PcbFrame::Reset_Noroutable( wxDC* DC ) int ii; CHEVELU* pt_rats; - if( (m_Pcb->m_Status_Pcb & LISTE_CHEVELU_OK )== 0 ) + if( (GetBoard()->m_Status_Pcb & LISTE_CHEVELU_OK )== 0 ) Compile_Ratsnest( DC, TRUE ); - pt_rats = (CHEVELU*) m_Pcb->m_Ratsnest; + pt_rats = (CHEVELU*) GetBoard()->m_Ratsnest; if( pt_rats == NULL ) return; - for( ii = m_Pcb->GetNumRatsnests(); ii > 0; ii--, pt_rats++ ) + for( ii = GetBoard()->GetNumRatsnests(); ii > 0; ii--, pt_rats++ ) { pt_rats->status &= ~CH_UNROUTABLE; } diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index faed866e50..13cac09acd 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -58,7 +58,7 @@ WinEDA_BasePcbFrame::WinEDA_BasePcbFrame( wxWindow* father, } -WinEDA_BasePcbFrame::~WinEDA_BasePcbFrame( void ) +WinEDA_BasePcbFrame::~WinEDA_BasePcbFrame() { delete m_Collector; } @@ -70,9 +70,9 @@ BASE_SCREEN* WinEDA_BasePcbFrame::GetBaseScreen() const } -void WinEDA_BasePcbFrame::SetBOARD( BOARD* aBoard ) +void WinEDA_BasePcbFrame::SetBoard( BOARD* aBoard ) { - if(m_Pcb != g_ModuleEditor_Pcb) + if( m_Pcb != g_ModuleEditor_Pcb ) delete m_Pcb; m_Pcb = aBoard; } diff --git a/pcbnew/block_module_editor.cpp b/pcbnew/block_module_editor.cpp index 0b6a94f800..e1f1f29680 100644 --- a/pcbnew/block_module_editor.cpp +++ b/pcbnew/block_module_editor.cpp @@ -97,7 +97,7 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC ) */ { int ItemsCount = 0, MustDoPlace = 0; - MODULE* Currentmodule = m_Pcb->m_Modules; + MODULE* Currentmodule = GetBoard()->m_Modules; if( GetScreen()->BlockLocate.m_BlockDrawStruct ) { @@ -216,7 +216,7 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC ) */ { bool err = FALSE; - MODULE* Currentmodule = m_Pcb->m_Modules; + MODULE* Currentmodule = GetBoard()->m_Modules; if( DrawPanel->ManageCurseur == NULL ) { @@ -301,7 +301,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, BOARD_ITEM* item; wxPoint move_offset; MODULE* Currentmodule = - ( (WinEDA_BasePcbFrame*) wxGetApp().GetTopWindow() )->m_ModuleEditFrame->m_Pcb->m_Modules; + ( (WinEDA_BasePcbFrame*) wxGetApp().GetTopWindow() )->m_ModuleEditFrame->GetBoard()->m_Modules; PtBlock = &screen->BlockLocate; GRSetDrawMode( DC, g_XorMode ); diff --git a/pcbnew/board.cpp b/pcbnew/board.cpp index ab1886fb77..cbdc424348 100644 --- a/pcbnew/board.cpp +++ b/pcbnew/board.cpp @@ -42,7 +42,7 @@ bool ComputeMatriceSize( WinEDA_BasePcbFrame* frame, int g_GridRoutingSize ) * pour les routages automatiques et calculs de zone */ { - BOARD* pcb = frame->m_Pcb; + BOARD* pcb = frame->GetBoard(); pcb->ComputeBoundaryBox(); diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index 54a9a211b8..ef18d55b81 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -842,7 +842,7 @@ void TRACK::Display_Infos( WinEDA_DrawFrame* frame ) { wxString msg; int text_pos; - BOARD* board = ( (WinEDA_PcbFrame*) frame )->m_Pcb; + BOARD* board = ( (WinEDA_PcbFrame*) frame )->GetBoard(); #ifdef RATSNET_DEBUG DbgDisplayTrackInfos( this ); diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index 87da492914..dc34800817 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -472,9 +472,10 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel, { static vector CornersTypeBuffer; static vector CornersBuffer; + // outline_mode is false to show filled polys, // and true to show polygons outlines only (test and debug purposes) - bool outline_mode = DisplayOpt.DisplayZonesMode == 2 ? true : false; + bool outline_mode = DisplayOpt.DisplayZonesMode == 2 ? true : false; if( DC == NULL ) return; @@ -522,14 +523,15 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel, for( int ic = 0; ic <= imax; ic++ ) { CPolyPt* corner = &m_FilledPolysList[ic]; - wxPoint coord; - coord.x = corner->x + offset.x; - coord.y = corner->y + offset.y; + + wxPoint coord( corner->x + offset.x, corner->y + offset.y ); + CornersBuffer.push_back(coord); + CornersTypeBuffer.push_back((char) corner->utility); - + if( (corner->end_contour) || (ic == imax) ) // the last corner of a filled area is found: draw it - { + { /* Draw the current filled area: draw segments ouline first * Curiously, draw segments ouline first and after draw filled polygons * with oulines thickness = 0 is a faster than @@ -539,19 +541,19 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel, */ { // Draw outlines: - if ( (m_ZoneMinThickness > 1) || outline_mode ) + if( (m_ZoneMinThickness > 1) || outline_mode ) { int ilim = CornersBuffer.size()-1; - for ( int is = 0, ie = ilim; is <= ilim; ie = is, is++ ) + for( int is = 0, ie = ilim; is <= ilim; ie = is, is++ ) { int x0 = CornersBuffer[is].x; int y0 = CornersBuffer[is].y; int x1 = CornersBuffer[ie].x; int y1 = CornersBuffer[ie].y; - - if ( CornersTypeBuffer[ie] == 0 ) // Draw only basic outlines, not extra segments + + if( CornersTypeBuffer[ie] == 0 ) // Draw only basic outlines, not extra segments { - if( (!DisplayOpt.DisplayPcbTrackFill) || GetState( FORCE_SKETCH ) ) + if( !DisplayOpt.DisplayPcbTrackFill || GetState( FORCE_SKETCH ) ) GRCSegm( &panel->m_ClipBox, DC, x0, y0, x1 , y1, m_ZoneMinThickness, color ); @@ -562,8 +564,9 @@ void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel, } } } + // Draw areas: - if( (m_FillMode == 0 ) && ! outline_mode ) + if( m_FillMode==0 && !outline_mode ) GRPoly( &panel->m_ClipBox, DC, CornersBuffer.size(), &CornersBuffer[0], true, 0, color, color ); } @@ -862,7 +865,7 @@ void ZONE_CONTAINER::Display_Infos( WinEDA_DrawFrame* frame ) { if( GetNet() >= 0 ) { - EQUIPOT* equipot = ( (WinEDA_PcbFrame*) frame )->m_Pcb->FindNet( GetNet() ); + EQUIPOT* equipot = ( (WinEDA_PcbFrame*) frame )->GetBoard()->FindNet( GetNet() ); if( equipot ) msg = equipot->GetNetname(); diff --git a/pcbnew/clean.cpp b/pcbnew/clean.cpp index a05b611f56..80320faacf 100644 --- a/pcbnew/clean.cpp +++ b/pcbnew/clean.cpp @@ -73,10 +73,10 @@ void Clean_Pcb_Items( WinEDA_PcbFrame* frame, wxDC* DC ) */ { frame->MsgPanel->EraseMsgBox(); - frame->m_Pcb->GetNumSegmTrack(); // update the count + frame->GetBoard()->GetNumSegmTrack(); // update the count /* Rebuild the pad infos (pad list and netcodes) to ensure an up to date info */ - frame->m_Pcb->m_Status_Pcb = 0; + frame->GetBoard()->m_Status_Pcb = 0; frame->build_liste_pads(); frame->recalcule_pad_net_code(); @@ -84,7 +84,7 @@ void Clean_Pcb_Items( WinEDA_PcbFrame* frame, wxDC* DC ) { TRACK* track; TRACK* next_track; - for( track = frame->m_Pcb->m_Track; track; track = track->Next() ) + for( track = frame->GetBoard()->m_Track; track; track = track->Next() ) { if( track->Shape() != VIA_THROUGH ) continue; @@ -107,13 +107,13 @@ void Clean_Pcb_Items( WinEDA_PcbFrame* frame, wxDC* DC ) } /* Delete Via on pads at same location */ - for( track = frame->m_Pcb->m_Track; track != NULL; track = next_track ) + for( track = frame->GetBoard()->m_Track; track != NULL; track = next_track ) { next_track = track->Next(); if( track->m_Shape != VIA_THROUGH ) continue; - D_PAD* pad = Fast_Locate_Pad_Connecte( frame->m_Pcb, track->m_Start, ALL_CU_LAYERS ); + D_PAD* pad = Fast_Locate_Pad_Connecte( frame->GetBoard(), track->m_Start, ALL_CU_LAYERS ); if( pad && (pad->m_Masque_Layer & EXTERNAL_LAYERS) == EXTERNAL_LAYERS ) // redundant Via { /* delete via */ @@ -137,7 +137,7 @@ void Clean_Pcb_Items( WinEDA_PcbFrame* frame, wxDC* DC ) /* Create missing segments when a track end covers a via, but is not on the via center */ if( s_ConnectToPads ) - ConnectDanglingEndToVia( frame->m_Pcb ); + ConnectDanglingEndToVia( frame->GetBoard() ); } #endif @@ -182,7 +182,7 @@ static void DeleteUnconnectedTracks( WinEDA_PcbFrame* frame, wxDC* DC ) // correct via m_End defects ii = 0; - for( segment = frame->m_Pcb->m_Track; segment; segment = next ) + for( segment = frame->GetBoard()->m_Track; segment; segment = next ) { next = segment->Next(); @@ -205,19 +205,19 @@ static void DeleteUnconnectedTracks( WinEDA_PcbFrame* frame, wxDC* DC ) oldpercent = -1; oldnetcode = 0; - segment = startNetcode = frame->m_Pcb->m_Track; + segment = startNetcode = frame->GetBoard()->m_Track; for( ii = 0; segment; segment = next, ii++ ) { next = segment->Next(); // display activity - percent = (100 * ii) / frame->m_Pcb->m_Track.GetCount(); + percent = (100 * ii) / frame->GetBoard()->m_Track.GetCount(); if( percent != oldpercent ) { oldpercent = percent; frame->DisplayActivity( percent, wxT( "No Conn: " ) ); - msg.Printf( wxT( "%d " ), frame->m_Pcb->m_Track.GetCount() ); + msg.Printf( wxT( "%d " ), frame->GetBoard()->m_Track.GetCount() ); Affiche_1_Parametre( frame, POS_AFF_MAX, wxT( "Max" ), msg, GREEN ); msg.Printf( wxT( "%d " ), ii ); @@ -242,14 +242,14 @@ static void DeleteUnconnectedTracks( WinEDA_PcbFrame* frame, wxDC* DC ) D_PAD* pad; - pad = Fast_Locate_Pad_Connecte( frame->m_Pcb, segment->m_Start, masklayer ); + pad = Fast_Locate_Pad_Connecte( frame->GetBoard(), segment->m_Start, masklayer ); if( pad != NULL ) { segment->start = pad; type_end |= START_ON_PAD; } - pad = Fast_Locate_Pad_Connecte( frame->m_Pcb, segment->m_End, masklayer ); + pad = Fast_Locate_Pad_Connecte( frame->GetBoard(), segment->m_End, masklayer ); if( pad != NULL ) { segment->end = pad; @@ -262,19 +262,19 @@ static void DeleteUnconnectedTracks( WinEDA_PcbFrame* frame, wxDC* DC ) int top_layer, bottom_layer; if( (type_end & START_ON_PAD ) == 0 ) { - other = Locate_Piste_Connectee( segment, frame->m_Pcb->m_Track, NULL, START ); + other = Locate_Piste_Connectee( segment, frame->GetBoard()->m_Track, NULL, START ); if( other == NULL ) // Test a connection to zones { if( segment->Type() != TYPE_VIA ) { - zone = frame->m_Pcb->HitTestForAnyFilledArea(segment->m_Start, segment->GetLayer() ); + zone = frame->GetBoard()->HitTestForAnyFilledArea(segment->m_Start, segment->GetLayer() ); } else { ((SEGVIA*)segment)->ReturnLayerPair( &top_layer, &bottom_layer ); - zone = frame->m_Pcb->HitTestForAnyFilledArea(segment->m_Start, top_layer, bottom_layer ); + zone = frame->GetBoard()->HitTestForAnyFilledArea(segment->m_Start, top_layer, bottom_layer ); } } @@ -293,12 +293,12 @@ static void DeleteUnconnectedTracks( WinEDA_PcbFrame* frame, wxDC* DC ) segment->SetState( BUSY, ON ); SEGVIA* via = (SEGVIA*) other; - other = Locate_Piste_Connectee( via, frame->m_Pcb->m_Track, + other = Locate_Piste_Connectee( via, frame->GetBoard()->m_Track, NULL, START ); if( other == NULL ) { via->ReturnLayerPair( &top_layer, &bottom_layer ); - zone = frame->m_Pcb->HitTestForAnyFilledArea(via->m_Start, bottom_layer, top_layer ); + zone = frame->GetBoard()->HitTestForAnyFilledArea(via->m_Start, bottom_layer, top_layer ); } if( (other == NULL) && (zone == NULL) ) @@ -312,17 +312,17 @@ static void DeleteUnconnectedTracks( WinEDA_PcbFrame* frame, wxDC* DC ) // if not connected to a pad, test if segment's END is connected to another track if( (type_end & END_ON_PAD ) == 0 ) { - other = Locate_Piste_Connectee( segment, frame->m_Pcb->m_Track, + other = Locate_Piste_Connectee( segment, frame->GetBoard()->m_Track, NULL, END ); if( other == NULL ) // Test a connection to zones { if( segment->Type() != TYPE_VIA ) - zone = frame->m_Pcb->HitTestForAnyFilledArea(segment->m_End, segment->GetLayer() ); + zone = frame->GetBoard()->HitTestForAnyFilledArea(segment->m_End, segment->GetLayer() ); else { ((SEGVIA*)segment)->ReturnLayerPair( &top_layer, &bottom_layer ); - zone = frame->m_Pcb->HitTestForAnyFilledArea(segment->m_End,top_layer, bottom_layer ); + zone = frame->GetBoard()->HitTestForAnyFilledArea(segment->m_End,top_layer, bottom_layer ); } } @@ -342,12 +342,12 @@ static void DeleteUnconnectedTracks( WinEDA_PcbFrame* frame, wxDC* DC ) segment->SetState( BUSY, ON ); SEGVIA* via = (SEGVIA*) other; - other = Locate_Piste_Connectee( via, frame->m_Pcb->m_Track, + other = Locate_Piste_Connectee( via, frame->GetBoard()->m_Track, NULL, END ); if( other == NULL ) { via->ReturnLayerPair( &top_layer, &bottom_layer ); - zone = frame->m_Pcb->HitTestForAnyFilledArea(via->m_End, bottom_layer, top_layer ); + zone = frame->GetBoard()->HitTestForAnyFilledArea(via->m_End, bottom_layer, top_layer ); } if( (other == NULL) && (zone == NULL) ) @@ -415,7 +415,7 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC ) Affiche_1_Parametre( frame, POS_AFF_VAR, wxT( "NullSeg" ), wxT( "0" ), a_color ); - for( segment = frame->m_Pcb->m_Track; segment; segment = segment->Next() ) + for( segment = frame->GetBoard()->m_Track; segment; segment = segment->Next() ) { if( !segment->IsNull() ) continue; @@ -438,16 +438,16 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC ) percent = 0; oldpercent = -1; - for( segment = frame->m_Pcb->m_Track, ii = 0; segment; segment = segment->Next(), ii++ ) + for( segment = frame->GetBoard()->m_Track, ii = 0; segment; segment = segment->Next(), ii++ ) { /* Display activity */ - percent = (100 * ii) / frame->m_Pcb->m_Track.GetCount(); + percent = (100 * ii) / frame->GetBoard()->m_Track.GetCount(); if( percent != oldpercent ) { frame->DisplayActivity( percent, wxT( "Id segm: " ) ); oldpercent = percent; - msg.Printf( wxT( "%d" ), frame->m_Pcb->m_Track.GetCount() ); + msg.Printf( wxT( "%d" ), frame->GetBoard()->m_Track.GetCount() ); Affiche_1_Parametre( frame, POS_AFF_MAX, wxT( "Max" ), msg, GREEN ); msg.Printf( wxT( "%d" ), ii ); @@ -509,7 +509,7 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC ) ii = 0; TRACK* next; - for( segment = frame->m_Pcb->m_Track; segment; segment = next ) + for( segment = frame->GetBoard()->m_Track; segment; segment = next ) { TRACK* segStart; TRACK* segEnd; @@ -518,13 +518,13 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC ) next = segment->Next(); ii++; - percent = (100 * ii) / frame->m_Pcb->m_Track.GetCount(); + percent = (100 * ii) / frame->GetBoard()->m_Track.GetCount(); if( percent != oldpercent ) { frame->DisplayActivity( percent, _( "Merge: " ) ); oldpercent = percent; - msg.Printf( wxT( "%d" ), frame->m_Pcb->m_Track.GetCount() ); + msg.Printf( wxT( "%d" ), frame->GetBoard()->m_Track.GetCount() ); Affiche_1_Parametre( frame, POS_AFF_MAX, wxT( "Max" ), msg, GREEN ); msg.Printf( wxT( "%d" ), ii ); @@ -556,7 +556,7 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC ) /* We must have only one segment connected */ segStart->SetState( BUSY, ON ); - other = Locate_Piste_Connectee( segment, frame->m_Pcb->m_Track, + other = Locate_Piste_Connectee( segment, frame->GetBoard()->m_Track, NULL, START ); segStart->SetState( BUSY, OFF ); @@ -570,7 +570,7 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC ) if( flag ) /* We have the starting point of the segment is connecte to an other segment */ { - segDelete = AlignSegment( frame->m_Pcb, segment, segStart, START ); + segDelete = AlignSegment( frame->GetBoard(), segment, segStart, START ); if( segDelete ) { nbpoints_supprimes++; no_inc = 1; @@ -592,7 +592,7 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC ) /* We must have only one segment connected */ segEnd->SetState( BUSY, ON ); - other = Locate_Piste_Connectee( segment, frame->m_Pcb->m_Track, + other = Locate_Piste_Connectee( segment, frame->GetBoard()->m_Track, NULL, END ); segEnd->SetState( BUSY, OFF ); @@ -607,7 +607,7 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC ) if( flag & 2 ) /* We have the ending point of the segment is connecte to an other segment */ { - segDelete = AlignSegment( frame->m_Pcb, segment, segEnd, END ); + segDelete = AlignSegment( frame->GetBoard(), segment, segEnd, END ); if( segDelete ) { nbpoints_supprimes++; @@ -759,20 +759,20 @@ int Netliste_Controle_piste( WinEDA_PcbFrame* frame, wxDC* DC, int affiche ) Affiche_1_Parametre( frame, POS_AFF_VAR, _( "NetCtr" ), wxT( "0 " ), a_color ); int ii = 0; - for( segment = frame->m_Pcb->m_Track; segment; segment = (TRACK*) segment->Next() ) + for( segment = frame->GetBoard()->m_Track; segment; segment = (TRACK*) segment->Next() ) { // display activity ii++; - percent = (100 * ii) / frame->m_Pcb->m_Track.GetCount(); + percent = (100 * ii) / frame->GetBoard()->m_Track.GetCount(); if( percent != oldpercent ) { frame->DisplayActivity( percent, wxT( "Drc: " ) ); oldpercent = percent; - msg.Printf( wxT( "%d" ), frame->m_Pcb->m_Track.GetCount() ); + msg.Printf( wxT( "%d" ), frame->GetBoard()->m_Track.GetCount() ); Affiche_1_Parametre( frame, POS_AFF_MAX, wxT( "Max" ), msg, GREEN ); - msg.Printf( wxT( "%d" ), frame->m_Pcb->m_Track.GetCount() ); + msg.Printf( wxT( "%d" ), frame->GetBoard()->m_Track.GetCount() ); Affiche_1_Parametre( frame, POS_AFF_NUMSEGM, wxT( "Segm" ), msg, CYAN ); if( frame->DrawPanel->m_AbortRequest ) @@ -790,7 +790,7 @@ int Netliste_Controle_piste( WinEDA_PcbFrame* frame, wxDC* DC, int affiche ) } else { - other = Locate_Piste_Connectee( segment, frame->m_Pcb->m_Track, + other = Locate_Piste_Connectee( segment, frame->GetBoard()->m_Track, NULL, START ); if( other ) net_code_s = other->GetNet(); @@ -807,7 +807,7 @@ int Netliste_Controle_piste( WinEDA_PcbFrame* frame, wxDC* DC, int affiche ) } else { - other = Locate_Piste_Connectee( segment, frame->m_Pcb->m_Track, + other = Locate_Piste_Connectee( segment, frame->GetBoard()->m_Track, NULL, END ); if( other ) net_code_e = other->GetNet(); @@ -824,7 +824,7 @@ int Netliste_Controle_piste( WinEDA_PcbFrame* frame, wxDC* DC, int affiche ) } // Removal of flagged segments - for( segment = frame->m_Pcb->m_Track; segment; segment = next ) + for( segment = frame->GetBoard()->m_Track; segment; segment = next ) { next = (TRACK*) segment->Next(); @@ -834,11 +834,11 @@ int Netliste_Controle_piste( WinEDA_PcbFrame* frame, wxDC* DC, int affiche ) flag = 1; oldpercent = -1; - frame->m_Pcb->m_Status_Pcb = 0; + frame->GetBoard()->m_Status_Pcb = 0; frame->Remove_One_Track( DC, segment ); - next = frame->m_Pcb->m_Track; /* NextS a peut etre ete efface */ + next = frame->GetBoard()->m_Track; /* NextS a peut etre ete efface */ if( affiche ) { nbpoints_modifies++; @@ -874,23 +874,23 @@ static void Gen_Raccord_Track( WinEDA_PcbFrame* frame, wxDC* DC ) wxString msg; frame->Affiche_Message( wxT( "Gen Raccords sur Pistes:" ) ); - if( frame->m_Pcb->GetNumSegmTrack() == 0 ) + if( frame->GetBoard()->GetNumSegmTrack() == 0 ) return; frame->DrawPanel->m_AbortRequest = FALSE; oldpercent = -1; ii = 0; - for( segment = frame->m_Pcb->m_Track; segment; segment = segment->Next() ) + for( segment = frame->GetBoard()->m_Track; segment; segment = segment->Next() ) { // display activity ii++; - percent = (100 * ii) / frame->m_Pcb->m_Track.GetCount(); + percent = (100 * ii) / frame->GetBoard()->m_Track.GetCount(); if( percent != oldpercent ) { frame->DisplayActivity( percent, wxT( "Tracks: " ) ); oldpercent = percent; - msg.Printf( wxT( "%d" ), frame->m_Pcb->m_Track.GetCount() ); + msg.Printf( wxT( "%d" ), frame->GetBoard()->m_Track.GetCount() ); Affiche_1_Parametre( frame, POS_AFF_MAX, wxT( "Max" ), msg, GREEN ); msg.Printf( wxT( "%d" ), ii ); @@ -903,7 +903,7 @@ static void Gen_Raccord_Track( WinEDA_PcbFrame* frame, wxDC* DC ) masquelayer = segment->ReturnMaskLayer(); // look at the "start" of the "segment" - for( other = frame->m_Pcb->m_Track; other; other = other->Next() ) + for( other = frame->GetBoard()->m_Track; other; other = other->Next() ) { TRACK* newTrack; @@ -939,7 +939,7 @@ static void Gen_Raccord_Track( WinEDA_PcbFrame* frame, wxDC* DC ) // create a new segment and insert it next to "other", then shorten other. newTrack = other->Copy(); - frame->m_Pcb->m_Track.Insert( newTrack, other->Next() ); + frame->GetBoard()->m_Track.Insert( newTrack, other->Next() ); other->m_End = segment->m_Start; newTrack->m_Start = segment->m_Start; @@ -951,7 +951,7 @@ static void Gen_Raccord_Track( WinEDA_PcbFrame* frame, wxDC* DC ) } // look at the "end" of the "segment" - for( other = frame->m_Pcb->m_Track; other; other = other->Next() ) + for( other = frame->GetBoard()->m_Track; other; other = other->Next() ) { TRACK* newTrack; @@ -985,7 +985,7 @@ static void Gen_Raccord_Track( WinEDA_PcbFrame* frame, wxDC* DC ) // create a new segment and insert it next to "other", then shorten other. newTrack = other->Copy(); - frame->m_Pcb->m_Track.Insert( newTrack, other->Next() ); + frame->GetBoard()->m_Track.Insert( newTrack, other->Next() ); other->m_End = segment->m_End; newTrack->m_Start = segment->m_End; @@ -1104,18 +1104,18 @@ void ConnectDanglingEndToPad( WinEDA_PcbFrame* frame, wxDC* DC ) Affiche_1_Parametre( frame, POS_AFF_VAR, _( "Centre" ), _( "0 " ), a_color ); int ii = 0; - for( segment = frame->m_Pcb->m_Track; segment; segment = segment->Next() ) + for( segment = frame->GetBoard()->m_Track; segment; segment = segment->Next() ) { D_PAD* pad; ii++; - percent = (100 * ii) / frame->m_Pcb->m_Track.GetCount(); + percent = (100 * ii) / frame->GetBoard()->m_Track.GetCount(); if( percent != oldpercent ) { frame->DisplayActivity( percent, _( "Pads: " ) ); oldpercent = percent; - msg.Printf( wxT( "%d" ), frame->m_Pcb->m_Track.GetCount() ); + msg.Printf( wxT( "%d" ), frame->GetBoard()->m_Track.GetCount() ); Affiche_1_Parametre( frame, POS_AFF_MAX, _( "Max" ), msg, GREEN ); msg.Printf( wxT( "%d" ), ii ); @@ -1125,18 +1125,18 @@ void ConnectDanglingEndToPad( WinEDA_PcbFrame* frame, wxDC* DC ) return; } - pad = Locate_Pad_Connecte( frame->m_Pcb, segment, START ); + pad = Locate_Pad_Connecte( frame->GetBoard(), segment, START ); if( pad ) { // test if the track is not precisely starting on the found pad if( segment->m_Start != pad->m_Pos ) { - if( Locate_Piste_Connectee( segment, frame->m_Pcb->m_Track, + if( Locate_Piste_Connectee( segment, frame->GetBoard()->m_Track, NULL, START ) == NULL ) { TRACK* newTrack = segment->Copy(); - frame->m_Pcb->m_Track.Insert( newTrack, segment->Next() ); + frame->GetBoard()->m_Track.Insert( newTrack, segment->Next() ); newTrack->m_End = pad->m_Pos; @@ -1151,18 +1151,18 @@ void ConnectDanglingEndToPad( WinEDA_PcbFrame* frame, wxDC* DC ) } } - pad = Locate_Pad_Connecte( frame->m_Pcb, segment, END ); + pad = Locate_Pad_Connecte( frame->GetBoard(), segment, END ); if( pad ) { // test if the track is not precisely ending on the found pad if( segment->m_End != pad->m_Pos ) { - if( Locate_Piste_Connectee( segment, frame->m_Pcb->m_Track, + if( Locate_Piste_Connectee( segment, frame->GetBoard()->m_Track, NULL, END ) == NULL ) { TRACK* newTrack = segment->Copy(); - frame->m_Pcb->m_Track.Insert( newTrack, segment->Next() ); + frame->GetBoard()->m_Track.Insert( newTrack, segment->Next() ); newTrack->m_Start = pad->m_Pos; diff --git a/pcbnew/cotation.cpp b/pcbnew/cotation.cpp index 3ee387098c..803ad562a8 100644 --- a/pcbnew/cotation.cpp +++ b/pcbnew/cotation.cpp @@ -138,7 +138,7 @@ WinEDA_CotationPropertiesFrame::WinEDA_CotationPropertiesFrame( WinEDA_PcbFrame* for( int layer = FIRST_NO_COPPER_LAYER; layerAppend( parent->m_Pcb->GetLayerName( layer ) ); + m_SelLayerBox->Append( parent->GetBoard()->GetLayerName( layer ) ); } m_SelLayerBox->SetSelection( Cotation->GetLayer() - FIRST_NO_COPPER_LAYER ); @@ -226,7 +226,7 @@ COTATION* WinEDA_PcbFrame::Begin_Cotation( COTATION* Cotation, wxDC* DC ) status_cotation = 1; pos = GetScreen()->m_Curseur; - Cotation = new COTATION( m_Pcb ); + Cotation = new COTATION( GetBoard() ); Cotation->m_Flags = IS_NEW; Cotation->SetLayer( ((PCB_SCREEN*)GetScreen())->m_Active_Layer ); @@ -277,7 +277,7 @@ COTATION* WinEDA_PcbFrame::Begin_Cotation( COTATION* Cotation, wxDC* DC ) Cotation->m_Flags = 0; /* Insertion de la structure dans le Chainage .Drawings du PCB */ - m_Pcb->Add( Cotation ); + GetBoard()->Add( Cotation ); GetScreen()->SetModify(); DrawPanel->ManageCurseur = NULL; diff --git a/pcbnew/cross-probing.cpp b/pcbnew/cross-probing.cpp index 6c64d6c7e7..a10144b568 100644 --- a/pcbnew/cross-probing.cpp +++ b/pcbnew/cross-probing.cpp @@ -55,7 +55,7 @@ void RemoteCommand( const char* cmdline ) { modName = CONV_FROM_UTF8( text ); - module = frame->m_Pcb->FindModuleByReference( modName ); + module = frame->GetBoard()->FindModuleByReference( modName ); if( module ) msg.Printf( _( "%s found" ), modName.GetData() ); @@ -80,7 +80,7 @@ void RemoteCommand( const char* cmdline ) modName = CONV_FROM_UTF8( text ); - module = frame->m_Pcb->FindModuleByReference( modName ); + module = frame->GetBoard()->FindModuleByReference( modName ); if( module ) pad = module->FindPadByName( pinName ); diff --git a/pcbnew/deltrack.cpp b/pcbnew/deltrack.cpp index e4d20f117a..7d12b9f495 100644 --- a/pcbnew/deltrack.cpp +++ b/pcbnew/deltrack.cpp @@ -116,7 +116,7 @@ TRACK* WinEDA_PcbFrame::Delete_Segment( wxDC* DC, TRACK* aTrack ) GetScreen()->SetModify(); test_1_net_connexion( DC, current_net_code ); - m_Pcb->Display_Infos( this ); + GetBoard()->Display_Infos( this ); return NULL; } @@ -147,7 +147,7 @@ void WinEDA_PcbFrame::Delete_net( wxDC* DC, TRACK* aTrack ) int net_code_delete = aTrack->GetNet(); /* Recherche du debut de la zone des pistes du net_code courant */ - TRACK* trackList = m_Pcb->m_Track->GetStartNetCode( net_code_delete ); + TRACK* trackList = GetBoard()->m_Track->GetStartNetCode( net_code_delete ); /* Decompte du nombre de segments de la sous-chaine */ @@ -163,7 +163,7 @@ void WinEDA_PcbFrame::Delete_net( wxDC* DC, TRACK* aTrack ) SaveItemEfface( trackList, ii ); GetScreen()->SetModify(); test_1_net_connexion( DC, net_code_delete ); - m_Pcb->Display_Infos( this ); + GetBoard()->Display_Infos( this ); } } diff --git a/pcbnew/dialog_copper_zones.cpp b/pcbnew/dialog_copper_zones.cpp index 7d1b3b7fd0..b7aa5d79da 100644 --- a/pcbnew/dialog_copper_zones.cpp +++ b/pcbnew/dialog_copper_zones.cpp @@ -58,7 +58,7 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event ) // Initialise all dialog options and values in wxTextCtrl { - BOARD* board = m_Parent->m_Pcb; + BOARD* board = m_Parent->GetBoard(); SetFont( *g_DialogFont ); @@ -167,7 +167,7 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event ) m_NetNameFilter->SetValue( NetNameFilter ); wxArrayString ListNetName; - m_Parent->m_Pcb->ReturnSortedNetnamesList( ListNetName, + m_Parent->GetBoard()->ReturnSortedNetnamesList( ListNetName, m_NetSorting == 0 ? BOARD::ALPHA_SORT : BOARD::PAD_CNT_SORT ); if( m_NetSorting != 0 ) @@ -190,7 +190,7 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event ) if( net_select > 0 ) { - EQUIPOT* equipot = m_Parent->m_Pcb->FindNet( net_select ); + EQUIPOT* equipot = m_Parent->GetBoard()->FindNet( net_select ); if( equipot ) // Search net in list and select it { for( unsigned ii = 0; ii < ListNetName.GetCount(); ii++ ) @@ -338,7 +338,7 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab /* Search net_code for this net */ EQUIPOT* net; g_Zone_Default_Setting.m_NetcodeSelection = 0; - for( net = m_Parent->m_Pcb->m_Equipots; net; net = net->Next() ) + for( net = m_Parent->GetBoard()->m_Equipots; net; net = net->Next() ) { if( net->GetNetname() == net_name ) { @@ -358,7 +358,7 @@ void dialog_copper_zone::OnNetSortingOptionSelected( wxCommandEvent& event ) wxArrayString ListNetName; m_NetSorting = m_NetSortingOption->GetSelection(); - m_Parent->m_Pcb->ReturnSortedNetnamesList( + m_Parent->GetBoard()->ReturnSortedNetnamesList( ListNetName, m_NetSorting == 0 ? BOARD::ALPHA_SORT : BOARD::PAD_CNT_SORT ); @@ -387,7 +387,7 @@ void dialog_copper_zone::OnNetSortingOptionSelected( wxCommandEvent& event ) int net_select = m_Zone_Setting->m_NetcodeSelection; if( net_select > 0 ) { - EQUIPOT* equipot = m_Parent->m_Pcb->FindNet( net_select ); + EQUIPOT* equipot = m_Parent->GetBoard()->FindNet( net_select ); if( equipot ) // Search net in list and select it { for( unsigned ii = 0; ii < ListNetName.GetCount(); ii++ ) @@ -421,7 +421,7 @@ void dialog_copper_zone::ExportSetupToOtherCopperZones( wxCommandEvent& event ) return; // Export settings ( but layer and netcode ) to others zones: - BOARD* pcb = m_Parent->m_Pcb; + BOARD* pcb = m_Parent->GetBoard(); for( int ii = 0; ii < pcb->GetAreaCount(); ii++ ) { ZONE_CONTAINER* zone = pcb->GetArea( ii ); diff --git a/pcbnew/dialog_edit_module.cpp b/pcbnew/dialog_edit_module.cpp index cfd926c882..71fed7352f 100644 --- a/pcbnew/dialog_edit_module.cpp +++ b/pcbnew/dialog_edit_module.cpp @@ -562,7 +562,7 @@ void WinEDA_ModulePropertiesFrame::OnOkClick( wxCommandEvent& event ) if( change_layer ) { - m_Parent->m_Pcb->Change_Side_Module( m_CurrentModule, m_DC ); + m_Parent->GetBoard()->Change_Side_Module( m_CurrentModule, m_DC ); } if( m_AutoPlaceCtrl->GetSelection() == 1 ) diff --git a/pcbnew/dialog_edit_module_text.cpp b/pcbnew/dialog_edit_module_text.cpp index 894d4b98dd..112091d561 100644 --- a/pcbnew/dialog_edit_module_text.cpp +++ b/pcbnew/dialog_edit_module_text.cpp @@ -27,13 +27,13 @@ private: TEXTE_MODULE* m_CurrentTextMod; public: - DialogEditModuleText( WinEDA_BasePcbFrame* parent, TEXTE_MODULE* TextMod, wxDC* DC ); - ~DialogEditModuleText() {}; + DialogEditModuleText( WinEDA_BasePcbFrame* parent, TEXTE_MODULE* TextMod, wxDC* DC ); + ~DialogEditModuleText() {}; private: - void OnInitDialog( wxInitDialogEvent& event ); - void OnOkClick( wxCommandEvent& event ); - void OnCancelClick( wxCommandEvent& event ); + void OnInitDialog( wxInitDialogEvent& event ); + void OnOkClick( wxCommandEvent& event ); + void OnCancelClick( wxCommandEvent& event ); }; /***************************************************************************/ @@ -53,7 +53,7 @@ void WinEDA_BasePcbFrame::InstallTextModOptionsFrame( TEXTE_MODULE* TextMod, DialogEditModuleText::DialogEditModuleText( WinEDA_BasePcbFrame* parent, TEXTE_MODULE* TextMod, wxDC* DC ) : - DialogEditModuleText_base(parent) + DialogEditModuleText_base(parent) { m_Parent = parent; @@ -78,7 +78,7 @@ void DialogEditModuleText::OnInitDialog( wxInitDialogEvent& event ) /********************************************************/ { SetFont( *g_DialogFont ); - SetFocus(); + SetFocus(); wxString msg; @@ -123,8 +123,8 @@ void DialogEditModuleText::OnInitDialog( wxInitDialogEvent& event ) PutValueInLocalUnits( *m_TxtWidthCtlr, m_CurrentTextMod->m_Width, m_Parent->m_InternalUnits ); - int text_orient = m_CurrentTextMod->m_Orient; - NORMALIZE_ANGLE_90(text_orient) + int text_orient = m_CurrentTextMod->m_Orient; + NORMALIZE_ANGLE_90(text_orient) if( (text_orient != 0) ) m_Orient->SetSelection( 1 ); @@ -142,7 +142,7 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event ) { wxString msg; - m_Parent->SaveCopyInUndoList( m_Parent->m_Pcb->m_Modules ); + m_Parent->SaveCopyInUndoList( m_Parent->GetBoard()->m_Modules ); if( m_DC ) //Erase old text on screen { m_CurrentTextMod->Draw( m_Parent->DrawPanel, m_DC, GR_XOR, @@ -150,7 +150,7 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event ) } m_CurrentTextMod->m_Text = m_Name->GetValue(); - m_CurrentTextMod->m_Italic = m_Style->GetSelection() == 1 ? true : false; + m_CurrentTextMod->m_Italic = m_Style->GetSelection() == 1 ? true : false; msg = m_TxtPosCtrlX->GetValue(); @@ -179,13 +179,13 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event ) // Test for a reasonnable width: if( width <= 1 ) width = 1; - int minthickness = min(m_CurrentTextMod->m_Size.x, m_CurrentTextMod->m_Size.y) / 4; + int minthickness = min(m_CurrentTextMod->m_Size.x, m_CurrentTextMod->m_Size.y) / 4; if( width > minthickness ) width = minthickness; m_CurrentTextMod->SetWidth( width ); m_CurrentTextMod->m_NoShow = (m_Show->GetSelection() == 0) ? 0 : 1; - int text_orient = (m_Orient->GetSelection() == 0) ? 0 : 900; + int text_orient = (m_Orient->GetSelection() == 0) ? 0 : 900; m_CurrentTextMod->m_Orient = text_orient; m_CurrentTextMod->SetDrawCoord(); diff --git a/pcbnew/dialog_graphic_item_properties.cpp b/pcbnew/dialog_graphic_item_properties.cpp index 72fe370cfd..50be139f14 100644 --- a/pcbnew/dialog_graphic_item_properties.cpp +++ b/pcbnew/dialog_graphic_item_properties.cpp @@ -28,22 +28,22 @@ private: DRAWSEGMENT* m_Item; public: - DialogGraphicItemProperties( WinEDA_BasePcbFrame* aParent, DRAWSEGMENT * aItem, wxDC * aDC); - ~DialogGraphicItemProperties() {}; + DialogGraphicItemProperties( WinEDA_BasePcbFrame* aParent, DRAWSEGMENT * aItem, wxDC * aDC); + ~DialogGraphicItemProperties() {}; private: - void OnInitDialog( wxInitDialogEvent& event ); - void OnOkClick( wxCommandEvent& event ); - void OnCancelClick( wxCommandEvent& event ); - void OnLayerChoice( wxCommandEvent& event ); + void OnInitDialog( wxInitDialogEvent& event ); + void OnOkClick( wxCommandEvent& event ); + void OnCancelClick( wxCommandEvent& event ); + void OnLayerChoice( wxCommandEvent& event ); }; DialogGraphicItemProperties::DialogGraphicItemProperties( WinEDA_BasePcbFrame* aParent, DRAWSEGMENT * aItem, wxDC * aDC): - DialogGraphicItemProperties_base( aParent ) + DialogGraphicItemProperties_base( aParent ) { - m_Parent = aParent; - m_DC = aDC; - m_Item = aItem; + m_Parent = aParent; + m_DC = aDC; + m_Item = aItem; } @@ -67,40 +67,40 @@ void DialogGraphicItemProperties::OnInitDialog( wxInitDialogEvent& event ) */ { SetFont( *g_DialogFont ); - SetFocus(); + SetFocus(); - wxString msg; - // Change texts according to the segment shape: - switch ( m_Item->m_Shape ) - { - case S_CIRCLE: - m_Start_Center_XText->SetLabel(_("Center X")); - m_Start_Center_YText->SetLabel(_("Center Y")); - m_EndX_Radius_Text->SetLabel(_("Point X")); - m_EndY_Text->SetLabel(_("Point Y")); - m_Angle_Text->Show(false); - m_Angle_Ctrl->Show(false); - break; + wxString msg; + // Change texts according to the segment shape: + switch ( m_Item->m_Shape ) + { + case S_CIRCLE: + m_Start_Center_XText->SetLabel(_("Center X")); + m_Start_Center_YText->SetLabel(_("Center Y")); + m_EndX_Radius_Text->SetLabel(_("Point X")); + m_EndY_Text->SetLabel(_("Point Y")); + m_Angle_Text->Show(false); + m_Angle_Ctrl->Show(false); + break; - case S_ARC: - m_Start_Center_XText->SetLabel(_("Center X")); - m_Start_Center_YText->SetLabel(_("Center Y")); - m_EndX_Radius_Text->SetLabel(_("Start Point X")); - m_EndY_Text->SetLabel(_("Start Point Y")); - msg << m_Item->m_Angle; - m_Angle_Ctrl->SetValue(msg); - break; + case S_ARC: + m_Start_Center_XText->SetLabel(_("Center X")); + m_Start_Center_YText->SetLabel(_("Center Y")); + m_EndX_Radius_Text->SetLabel(_("Start Point X")); + m_EndY_Text->SetLabel(_("Start Point Y")); + msg << m_Item->m_Angle; + m_Angle_Ctrl->SetValue(msg); + break; - default: - m_Angle_Text->Show(false); - m_Angle_Ctrl->Show(false); - break; - } + default: + m_Angle_Text->Show(false); + m_Angle_Ctrl->Show(false); + break; + } AddUnitSymbol( *m_Start_Center_XText ); PutValueInLocalUnits( *m_Center_StartXCtrl, m_Item->m_Start.x, m_Parent->m_InternalUnits ); - AddUnitSymbol( *m_Start_Center_YText ); + AddUnitSymbol( *m_Start_Center_YText ); PutValueInLocalUnits( *m_Center_StartYCtrl, m_Item->m_Start.y, m_Parent->m_InternalUnits ); @@ -108,16 +108,16 @@ void DialogGraphicItemProperties::OnInitDialog( wxInitDialogEvent& event ) PutValueInLocalUnits( *m_EndX_Radius_Ctrl, m_Item->m_End.x, m_Parent->m_InternalUnits ); - AddUnitSymbol( *m_EndY_Text ); + AddUnitSymbol( *m_EndY_Text ); PutValueInLocalUnits( *m_EndY_Ctrl, m_Item->m_End.y, m_Parent->m_InternalUnits ); - AddUnitSymbol( *m_ItemThicknessText ); + AddUnitSymbol( *m_ItemThicknessText ); PutValueInLocalUnits( *m_ThicknessCtrl, m_Item->m_Width, m_Parent->m_InternalUnits ); - AddUnitSymbol( *m_DefaultThicknessText ); - int thickness; + AddUnitSymbol( *m_DefaultThicknessText ); + int thickness; if( m_Item->GetLayer() == EDGE_N ) thickness = g_DesignSettings.m_EdgeSegmentWidth; else @@ -127,15 +127,15 @@ void DialogGraphicItemProperties::OnInitDialog( wxInitDialogEvent& event ) for( int layer=FIRST_NO_COPPER_LAYER; layer <= LAST_NO_COPPER_LAYER; ++layer ) { - m_LayerSelection->Append( m_Parent->m_Pcb->GetLayerName( layer ) ); + m_LayerSelection->Append( m_Parent->GetBoard()->GetLayerName( layer ) ); } - int layer = m_Item->GetLayer(); - // Control: - if ( layer < FIRST_NO_COPPER_LAYER ) - layer = FIRST_NO_COPPER_LAYER; - if ( layer > LAST_NO_COPPER_LAYER ) - layer = LAST_NO_COPPER_LAYER; + int layer = m_Item->GetLayer(); + // Control: + if ( layer < FIRST_NO_COPPER_LAYER ) + layer = FIRST_NO_COPPER_LAYER; + if ( layer > LAST_NO_COPPER_LAYER ) + layer = LAST_NO_COPPER_LAYER; m_LayerSelection->SetSelection( layer - FIRST_NO_COPPER_LAYER ); @@ -146,7 +146,7 @@ void DialogGraphicItemProperties::OnInitDialog( wxInitDialogEvent& event ) void DialogGraphicItemProperties::OnLayerChoice( wxCommandEvent& event ) /*******************************************************************/ { - int thickness; + int thickness; if( (m_LayerSelection->GetCurrentSelection() + FIRST_NO_COPPER_LAYER) == EDGE_N ) thickness = g_DesignSettings.m_EdgeSegmentWidth; else @@ -161,9 +161,9 @@ void DialogGraphicItemProperties::OnOkClick( wxCommandEvent& event ) /* Copy values in text contro to the item parameters */ { - wxString msg; + wxString msg; if ( m_DC ) - m_Item->Draw( m_Parent->DrawPanel, m_DC, GR_XOR ); + m_Item->Draw( m_Parent->DrawPanel, m_DC, GR_XOR ); msg = m_Center_StartXCtrl->GetValue(); m_Item->m_Start.x = ReturnValueFromString( g_UnitMetric, msg, @@ -191,29 +191,29 @@ void DialogGraphicItemProperties::OnOkClick( wxCommandEvent& event ) m_Item->SetLayer( m_LayerSelection->GetCurrentSelection() + FIRST_NO_COPPER_LAYER); - if( m_Item->GetLayer() == EDGE_N ) + if( m_Item->GetLayer() == EDGE_N ) g_DesignSettings.m_EdgeSegmentWidth = thickness; else g_DesignSettings.m_DrawSegmentWidth = thickness; - if ( m_Item->m_Shape == S_ARC ) - { - long angle; - m_Angle_Ctrl->GetValue().ToLong(&angle); - NORMALIZE_ANGLE(angle); - m_Item->m_Angle = angle; - } + if ( m_Item->m_Shape == S_ARC ) + { + long angle; + m_Angle_Ctrl->GetValue().ToLong(&angle); + NORMALIZE_ANGLE(angle); + m_Item->m_Angle = angle; + } m_Parent->GetScreen()->SetModify(); if ( m_DC ) - m_Item->Draw( m_Parent->DrawPanel, m_DC, GR_OR ); + m_Item->Draw( m_Parent->DrawPanel, m_DC, GR_OR ); m_Item->Display_Infos( m_Parent ); - Close( TRUE ); + Close( TRUE ); } void DialogGraphicItemProperties::OnCancelClick( wxCommandEvent& event ) { - event.Skip(); + event.Skip(); } diff --git a/pcbnew/dialog_netlist.cpp b/pcbnew/dialog_netlist.cpp index 4845af21b6..a76692ab09 100644 --- a/pcbnew/dialog_netlist.cpp +++ b/pcbnew/dialog_netlist.cpp @@ -356,7 +356,7 @@ void WinEDA_NetlistFrame::OnReadNetlistFileClick( wxCommandEvent& event ) void WinEDA_NetlistFrame::OnTestNetlistClick( wxCommandEvent& event ) { - TestFor_Duplicate_Missing_And_Extra_Footprints( this, m_NetlistFilenameCtrl->GetValue(), m_Parent->m_Pcb); + TestFor_Duplicate_Missing_And_Extra_Footprints( this, m_NetlistFilenameCtrl->GetValue(), m_Parent->GetBoard() ); } diff --git a/pcbnew/dialog_orient_footprints.cpp b/pcbnew/dialog_orient_footprints.cpp index 4c84c9b5ef..b92e0fc8a9 100644 --- a/pcbnew/dialog_orient_footprints.cpp +++ b/pcbnew/dialog_orient_footprints.cpp @@ -248,7 +248,6 @@ void WinEDA_PcbFrame::ReOrientModules( const wxString& ModuleMask, * @param include_fixe = true to orient locked footprints */ { - MODULE* Module; wxString line; bool redraw = false; @@ -256,17 +255,16 @@ void WinEDA_PcbFrame::ReOrientModules( const wxString& ModuleMask, if( !IsOK( this, line ) ) return; - Module = m_Pcb->m_Modules; - for( ; Module != NULL; Module = Module->Next() ) + for( MODULE* module = GetBoard()->m_Modules; module; module = module->Next() ) { - if( Module->IsLocked() && !include_fixe ) + if( module->IsLocked() && !include_fixe ) continue; - if( WildCompareString( ModuleMask, Module->m_Reference->m_Text, FALSE ) ) + if( WildCompareString( ModuleMask, module->m_Reference->m_Text, FALSE ) ) { GetScreen()->SetModify(); redraw = true; - Rotate_Module( NULL, Module, Orient, FALSE ); + Rotate_Module( NULL, module, Orient, FALSE ); } } diff --git a/pcbnew/dialog_pad_properties.cpp b/pcbnew/dialog_pad_properties.cpp index 5bb09d38a7..a1407b2d4a 100644 --- a/pcbnew/dialog_pad_properties.cpp +++ b/pcbnew/dialog_pad_properties.cpp @@ -475,7 +475,7 @@ void DialogPadProperties::PadPropertiesAccept( wxCommandEvent& event ) if( m_CurrentPad ) // Set Pad Name & Num { - m_Parent->SaveCopyInUndoList( m_Parent->m_Pcb->m_Modules ); + m_Parent->SaveCopyInUndoList( m_Parent->GetBoard()->m_Modules ); MODULE* Module = (MODULE*) m_CurrentPad->GetParent(); Module->m_LastEdit_Time = time( NULL ); @@ -515,13 +515,13 @@ void DialogPadProperties::PadPropertiesAccept( wxCommandEvent& event ) if( m_CurrentPad->GetNetname() != Current_PadNetName ) { if( Current_PadNetName.IsEmpty() ) - { + { m_CurrentPad->SetNet( 0 ); m_CurrentPad->SetNetname( Current_PadNetName ); - } + } else { - const EQUIPOT* net = m_Parent->m_Pcb->FindNet( Current_PadNetName ); + const EQUIPOT* net = m_Parent->GetBoard()->FindNet( Current_PadNetName ); if( net ) { RastnestIsChanged = true; @@ -585,5 +585,5 @@ void DialogPadProperties::PadPropertiesAccept( wxCommandEvent& event ) if( m_DC ) m_Parent->DrawPanel->CursorOn( m_DC ); if( RastnestIsChanged ) // The net ratsnest must be recalculated - m_Parent->m_Pcb->m_Status_Pcb = 0; + m_Parent->GetBoard()->m_Status_Pcb = 0; } diff --git a/pcbnew/dialog_pcb_text_properties.cpp b/pcbnew/dialog_pcb_text_properties.cpp index 2c79e03de3..506358e743 100644 --- a/pcbnew/dialog_pcb_text_properties.cpp +++ b/pcbnew/dialog_pcb_text_properties.cpp @@ -75,7 +75,7 @@ WinEDA_TextPCBPropertiesFrame::WinEDA_TextPCBPropertiesFrame( WinEDA_PcbFrame* p /************************************************************************************/ { wxButton* Button; - BOARD* board = parent->m_Pcb; + BOARD* board = parent->GetBoard(); m_Parent = parent; @@ -170,14 +170,14 @@ WinEDA_TextPCBPropertiesFrame::WinEDA_TextPCBPropertiesFrame( WinEDA_PcbFrame* p m_Mirror->SetSelection( 1 ); MiddleBoxSizer->Add( m_Mirror, 0, wxGROW | wxALL, 5 ); - int style = 0; - if (CurrentTextPCB->m_Italic ) - style = 1; + int style = 0; + if (CurrentTextPCB->m_Italic ) + style = 1; wxString style_msg[] = { _( "Normal" ), _( "Italic" ) }; m_Style = new wxRadioBox( this, -1, _( "Style" ), wxDefaultPosition, wxSize( -1, -1 ), 2, style_msg, 1, wxRA_SPECIFY_COLS ); - m_Style->SetSelection(style); + m_Style->SetSelection(style); MiddleBoxSizer->Add( m_Style, 0, wxGROW | wxALL, 5 ); GetSizer()->Fit( this ); @@ -222,15 +222,15 @@ void WinEDA_TextPCBPropertiesFrame::OnOkClick( wxCommandEvent& event ) CurrentTextPCB->m_Width = m_TxtWidthCtlr->GetValue(); // test for acceptable values for parameters: - int max_tickness = min( CurrentTextPCB->m_Size.x, CurrentTextPCB->m_Size.y); - max_tickness /= 4; + int max_tickness = min( CurrentTextPCB->m_Size.x, CurrentTextPCB->m_Size.y); + max_tickness /= 4; if ( CurrentTextPCB->m_Width > max_tickness) CurrentTextPCB->m_Width = max_tickness; CurrentTextPCB->m_Mirror = (m_Mirror->GetSelection() == 1) ? true : false; CurrentTextPCB->m_Orient = m_Orient->GetSelection() * 900; CurrentTextPCB->SetLayer( m_SelLayerBox->GetChoice() ); - CurrentTextPCB->m_Italic = m_Style->GetSelection() ? 1 : 0; + CurrentTextPCB->m_Italic = m_Style->GetSelection() ? 1 : 0; if( m_DC ) // Displya new text { diff --git a/pcbnew/dragsegm.cpp b/pcbnew/dragsegm.cpp index 8812f479f2..5c72d8af0d 100644 --- a/pcbnew/dragsegm.cpp +++ b/pcbnew/dragsegm.cpp @@ -123,7 +123,7 @@ void Build_1_Pad_SegmentsToDrag( WinEDA_DrawPanel* panel, wxDC* DC, D_PAD* PtPad int net_code = PtPad->GetNet(); int MasqueLayer; wxPoint pos; - BOARD* pcb = ( (WinEDA_BasePcbFrame*) (panel->m_Parent) )->m_Pcb; + BOARD* pcb = ( (WinEDA_BasePcbFrame*) (panel->m_Parent) )->GetBoard(); Track = pcb->m_Track->GetStartNetCode( net_code ); @@ -196,7 +196,7 @@ void Collect_TrackSegmentsToDrag( WinEDA_DrawPanel* panel, wxDC* DC, * Les net_codes sont supposes a jour. */ { - BOARD* pcb = ( (WinEDA_BasePcbFrame*) (panel->m_Parent) )->m_Pcb; + BOARD* pcb = ( (WinEDA_BasePcbFrame*) (panel->m_Parent) )->GetBoard(); TRACK* track = pcb->m_Track->GetStartNetCode( net_code ); for( ; track; track = track->Next() ) diff --git a/pcbnew/drc.cpp b/pcbnew/drc.cpp index 93585cfbbe..b1f8514308 100644 --- a/pcbnew/drc.cpp +++ b/pcbnew/drc.cpp @@ -101,7 +101,7 @@ DRC::DRC( WinEDA_PcbFrame* aPcbWindow ) { m_mainWindow = aPcbWindow; m_drawPanel = aPcbWindow->DrawPanel; - m_pcb = aPcbWindow->m_Pcb; + m_pcb = aPcbWindow->GetBoard(); m_ui = 0; // establish initial values for everything: @@ -227,7 +227,7 @@ void DRC::updatePointers() { // update my pointers, m_mainWindow is the only unchangable one m_drawPanel = m_mainWindow->DrawPanel; - m_pcb = m_mainWindow->m_Pcb; + m_pcb = m_mainWindow->GetBoard(); if ( m_ui ) // Use diag list boxes only in DRC dialog { diff --git a/pcbnew/edgemod.cpp b/pcbnew/edgemod.cpp index 61f8f28e13..0041c45437 100644 --- a/pcbnew/edgemod.cpp +++ b/pcbnew/edgemod.cpp @@ -153,7 +153,7 @@ void WinEDA_ModuleEditFrame::Edit_Edge_Width( EDGE_MODULE* Edge, wxDC* DC ) * @param DC = current Device Context */ { - MODULE* Module = m_Pcb->m_Modules; + MODULE* Module = GetBoard()->m_Modules; SaveCopyInUndoList( Module ); @@ -187,7 +187,7 @@ void WinEDA_ModuleEditFrame::Edit_Edge_Layer( EDGE_MODULE* Edge, wxDC* DC ) * @param DC = current Device Context */ { - MODULE* Module = m_Pcb->m_Modules; + MODULE* Module = GetBoard()->m_Modules; int new_layer = SILKSCREEN_N_CMP; if( Edge != NULL ) new_layer = Edge->GetLayer(); @@ -255,7 +255,7 @@ void WinEDA_ModuleEditFrame::Enter_Edge_Width( EDGE_MODULE* Edge, wxDC* DC ) } if( Edge ) { - MODULE* Module = m_Pcb->m_Modules; + MODULE* Module = GetBoard()->m_Modules; Module->DrawEdgesOnly( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR ); Edge->m_Width = ModuleSegmentWidth; Module->DrawEdgesOnly( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR ); @@ -335,7 +335,7 @@ EDGE_MODULE* WinEDA_ModuleEditFrame::Begin_Edge_Module( EDGE_MODULE* Edge, * @return the new created edge. */ { - MODULE* module = m_Pcb->m_Modules; + MODULE* module = GetBoard()->m_Modules; int angle = 0; if( module == NULL ) @@ -439,7 +439,7 @@ void WinEDA_ModuleEditFrame::End_Edge_Module( EDGE_MODULE* Edge, wxDC* DC ) /* Terminate a move or create edge function */ { - MODULE* Module = m_Pcb->m_Modules; + MODULE* Module = GetBoard()->m_Modules; /* If last segment length is 0: deletion */ if( Edge ) diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index e956c73e3b..8bfed61c14 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -257,7 +257,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_TRACK_BUTT: SetToolID( id, wxCURSOR_PENCIL, _( "Add Tracks" ) ); DisplayTrackSettings(); - if( (m_Pcb->m_Status_Pcb & LISTE_CHEVELU_OK) == 0 ) + if( (GetBoard()->m_Status_Pcb & LISTE_CHEVELU_OK) == 0 ) { Compile_Ratsnest( &dc, TRUE ); } @@ -307,7 +307,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_PCB_SHOW_1_RATSNEST_BUTT: SetToolID( id, wxCURSOR_HAND, _( "Local Ratsnest" ) ); - if( (m_Pcb->m_Status_Pcb & LISTE_CHEVELU_OK) == 0 ) + if( (GetBoard()->m_Status_Pcb & LISTE_CHEVELU_OK) == 0 ) Compile_Ratsnest( &dc, TRUE ); break; @@ -564,10 +564,10 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES: // Remove all zones : - m_Pcb->m_Zone.DeleteAll(); - for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ ) + GetBoard()->m_Zone.DeleteAll(); + for( int ii = 0; ii < GetBoard()->GetAreaCount(); ii++ ) { - ZONE_CONTAINER* zone_container = m_Pcb->GetArea( ii ); + ZONE_CONTAINER* zone_container = GetBoard()->GetArea( ii ); zone_container->m_FilledPolysList.clear();; } @@ -666,7 +666,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) SetCurItem( GetCurItem()->GetParent() ); if( !GetCurItem() || GetCurItem()->Type() != TYPE_MODULE ) break; - m_Pcb->Change_Side_Module( (MODULE*) GetCurItem(), &dc ); + GetBoard()->Change_Side_Module( (MODULE*) GetCurItem(), &dc ); break; case ID_POPUP_PCB_EDIT_MODULE: @@ -842,7 +842,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_PCB_EDIT_DRAWING: - InstallGraphicItemPropertiesDialog( (DRAWSEGMENT*)GetCurItem(), &dc); + InstallGraphicItemPropertiesDialog( (DRAWSEGMENT*)GetCurItem(), &dc); DrawPanel->MouseToCursorSchema(); break; @@ -1107,7 +1107,7 @@ void WinEDA_PcbFrame::RemoveStruct( BOARD_ITEM* Item, wxDC* DC ) ( (MARKER*) Item )->Draw( DrawPanel, DC, GR_XOR ); // delete the marker, and free memory. Don't use undelete stack. - m_Pcb->Delete( Item ); + GetBoard()->Delete( Item ); break; case TYPE_PAD: @@ -1147,7 +1147,7 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer ) // If only one copper layer is enabled, the only such layer // that can be selected to is the "Copper" layer (so the // selection of any other copper layer is disregarded). - if( m_Pcb->m_BoardSettings->m_CopperLayerCount < 2 ) + if( GetBoard()->m_BoardSettings->m_CopperLayerCount < 2 ) { if( layer != COPPER_LAYER_N ) { @@ -1166,7 +1166,7 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer ) else { if( (layer != COPPER_LAYER_N) && (layer != LAYER_CMP_N) - && (layer >= m_Pcb->m_BoardSettings->m_CopperLayerCount - 1) ) + && (layer >= GetBoard()->m_BoardSettings->m_CopperLayerCount - 1) ) { // Uncomment following command (and line 17) to beep // the speaker. (Doing that would provide feedback to diff --git a/pcbnew/edit_pcb_text.cpp b/pcbnew/edit_pcb_text.cpp index 368cea7484..10be58c49f 100644 --- a/pcbnew/edit_pcb_text.cpp +++ b/pcbnew/edit_pcb_text.cpp @@ -130,10 +130,10 @@ TEXTE_PCB* WinEDA_PcbFrame::Create_Texte_Pcb( wxDC* DC ) { TEXTE_PCB* TextePcb; - TextePcb = new TEXTE_PCB( m_Pcb ); + TextePcb = new TEXTE_PCB( GetBoard() ); /* Chainage de la nouvelle structure en debut de liste */ - m_Pcb->Add( TextePcb ); + GetBoard()->Add( TextePcb ); /* Mise a jour des caracteristiques */ TextePcb->m_Flags = IS_NEW; diff --git a/pcbnew/edit_track_width.cpp b/pcbnew/edit_track_width.cpp index 7fb605ea03..6d073e6f95 100644 --- a/pcbnew/edit_track_width.cpp +++ b/pcbnew/edit_track_width.cpp @@ -41,7 +41,7 @@ int WinEDA_PcbFrame::Edit_TrackSegm_Width( wxDC* DC, TRACK* pt_segm ) if( old_w < consigne ) /* DRC utile puisque augm de dimension */ { if( Drc_On ) - errdrc = m_drc->Drc( pt_segm, m_Pcb->m_Track ); + errdrc = m_drc->Drc( pt_segm, GetBoard()->m_Track ); if( errdrc == BAD_DRC ) pt_segm->m_Width = old_w; else @@ -97,7 +97,7 @@ void WinEDA_PcbFrame::Edit_Net_Width( wxDC* DC, int Netcode ) return; /* balayage des segments */ - for( pt_segm = m_Pcb->m_Track; pt_segm != NULL; pt_segm = pt_segm->Next() ) + for( pt_segm = GetBoard()->m_Track; pt_segm != NULL; pt_segm = pt_segm->Next() ) { if( Netcode != pt_segm->GetNet() ) /* mauvaise piste */ continue; @@ -141,7 +141,7 @@ bool WinEDA_PcbFrame::Resize_Pistes_Vias( wxDC* DC, bool Track, bool Via ) return FALSE; } - pt_segm = m_Pcb->m_Track; + pt_segm = GetBoard()->m_Track; for( ; pt_segm != NULL; pt_segm = pt_segm->Next() ) { if( pt_segm->Type() == TYPE_VIA ) /* mise a jour du diametre de la via */ diff --git a/pcbnew/editedge.cpp b/pcbnew/editedge.cpp index dcba4d142d..2f8bb2899a 100644 --- a/pcbnew/editedge.cpp +++ b/pcbnew/editedge.cpp @@ -144,12 +144,12 @@ void WinEDA_PcbFrame::Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC return; } - wxString msg = _( "Delete Layer " ) + m_Pcb->GetLayerName( layer ); + wxString msg = _( "Delete Layer " ) + GetBoard()->GetLayerName( layer ); if( !IsOK( this, msg ) ) return; BOARD_ITEM* PtNext; - for( BOARD_ITEM* item = m_Pcb->m_Drawings; item; item = PtNext ) + for( BOARD_ITEM* item = GetBoard()->m_Drawings; item; item = PtNext ) { GetScreen()->SetModify(); PtNext = item->Next(); @@ -227,7 +227,7 @@ DRAWSEGMENT* WinEDA_PcbFrame::Begin_DrawSegment( DRAWSEGMENT* Segment, if( Segment == NULL ) /* debut reel du trace */ { - SetCurItem( Segment = new DRAWSEGMENT( m_Pcb ) ); + SetCurItem( Segment = new DRAWSEGMENT( GetBoard() ) ); Segment->m_Flags = IS_NEW; Segment->SetLayer( ((PCB_SCREEN*)GetScreen())->m_Active_Layer ); Segment->m_Width = s_large; @@ -244,7 +244,7 @@ DRAWSEGMENT* WinEDA_PcbFrame::Begin_DrawSegment( DRAWSEGMENT* Segment, { if( Segment->m_Shape == S_SEGMENT ) { - m_Pcb->Add( Segment ); + GetBoard()->Add( Segment ); GetScreen()->SetModify(); Segment->m_Flags = 0; @@ -253,7 +253,7 @@ DRAWSEGMENT* WinEDA_PcbFrame::Begin_DrawSegment( DRAWSEGMENT* Segment, DrawItem = Segment; - SetCurItem( Segment = new DRAWSEGMENT( m_Pcb ) ); + SetCurItem( Segment = new DRAWSEGMENT( GetBoard() ) ); Segment->m_Flags = IS_NEW; Segment->SetLayer( DrawItem->GetLayer() ); @@ -292,7 +292,7 @@ void WinEDA_PcbFrame::End_Edge( DRAWSEGMENT* Segment, wxDC* DC ) { Segment->m_Flags = 0; - m_Pcb->Add( Segment ); + GetBoard()->Add( Segment ); GetScreen()->SetModify(); } diff --git a/pcbnew/editrack-part2.cpp b/pcbnew/editrack-part2.cpp index c3ba165ab1..6f53374216 100644 --- a/pcbnew/editrack-part2.cpp +++ b/pcbnew/editrack-part2.cpp @@ -46,7 +46,7 @@ void WinEDA_PcbFrame::Ratsnest_On_Off( wxDC* DC ) int ii; CHEVELU* pt_chevelu; - if( (m_Pcb->m_Status_Pcb & LISTE_CHEVELU_OK) == 0 ) + if( (GetBoard()->m_Status_Pcb & LISTE_CHEVELU_OK) == 0 ) { if( g_Show_Ratsnest ) Compile_Ratsnest( DC, TRUE ); @@ -55,13 +55,13 @@ void WinEDA_PcbFrame::Ratsnest_On_Off( wxDC* DC ) DrawGeneralRatsnest( DC, 0 ); /* effacement eventuel du chevelu affiche */ - pt_chevelu = m_Pcb->m_Ratsnest; + pt_chevelu = GetBoard()->m_Ratsnest; if( pt_chevelu == NULL ) return; if( g_Show_Ratsnest ) { - for( ii = m_Pcb->GetNumRatsnests(); ii > 0; pt_chevelu++, ii-- ) + for( ii = GetBoard()->GetNumRatsnests(); ii > 0; pt_chevelu++, ii-- ) { pt_chevelu->status |= CH_VISIBLE; } @@ -70,7 +70,7 @@ void WinEDA_PcbFrame::Ratsnest_On_Off( wxDC* DC ) } else { - for( ii = m_Pcb->GetNumRatsnests(); ii > 0; pt_chevelu++, ii-- ) + for( ii = GetBoard()->GetNumRatsnests(); ii > 0; pt_chevelu++, ii-- ) { pt_chevelu->status &= ~CH_VISIBLE; } @@ -123,7 +123,7 @@ void WinEDA_PcbFrame::ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC ) else if( pt_segm->GetLayer() == l2 ) pt_segm->SetLayer( l1 ); - if( Drc_On && BAD_DRC==m_drc->Drc( pt_segm, m_Pcb->m_Track ) ) + if( Drc_On && BAD_DRC==m_drc->Drc( pt_segm, GetBoard()->m_Track ) ) { /* Annulation du changement */ ii = 0; pt_segm = pt_track; @@ -143,8 +143,8 @@ void WinEDA_PcbFrame::ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC ) ii = 0; pt_segm = pt_track; for( ; ii < nb_segm; pt_segm = pt_segm->Next(), ii++ ) { - pt_segm->start = Locate_Pad_Connecte( m_Pcb, pt_segm, START ); - pt_segm->end = Locate_Pad_Connecte( m_Pcb, pt_segm, END ); + pt_segm->start = Locate_Pad_Connecte( GetBoard(), pt_segm, START ); + pt_segm->end = Locate_Pad_Connecte( GetBoard(), pt_segm, END ); } test_1_net_connexion( DC, pt_track->GetNet() ); @@ -173,7 +173,7 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) } /* Avoid more than one via on the current location: */ - if( Locate_Via( m_Pcb, g_CurrentTrackSegment->m_End, g_CurrentTrackSegment->GetLayer() ) ) + if( Locate_Via( GetBoard(), g_CurrentTrackSegment->m_End, g_CurrentTrackSegment->GetLayer() ) ) return false; for( TRACK* segm = g_FirstTrackSegment; segm; segm = segm->Next() ) @@ -185,13 +185,13 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) /* Is the current segment Ok (no DRC error) ? */ if( Drc_On ) { - if( BAD_DRC==m_drc->Drc( g_CurrentTrackSegment, m_Pcb->m_Track ) ) + if( BAD_DRC==m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) ) /* DRC error, the change layer is not made */ return false; if( g_TwoSegmentTrackBuild && g_CurrentTrackSegment->Back() ) // We must handle 2 segments { - if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment->Back(), m_Pcb->m_Track ) ) + if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment->Back(), GetBoard()->m_Track ) ) return false; } } @@ -205,7 +205,7 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); /* create the via */ - SEGVIA* via = new SEGVIA( m_Pcb ); + SEGVIA* via = new SEGVIA( GetBoard() ); via->m_Flags = IS_NEW; via->m_Shape = g_DesignSettings.m_CurrentViaType; via->m_Width = g_DesignSettings.m_CurrentViaSize; @@ -230,10 +230,10 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) if ( old_layer == COPPER_LAYER_N ) ((PCB_SCREEN*)GetScreen())->m_Active_Layer = LAYER_N_2; else if ( old_layer == LAYER_CMP_N ) - ((PCB_SCREEN*)GetScreen())->m_Active_Layer = m_Pcb->m_BoardSettings->m_CopperLayerCount - 2; + ((PCB_SCREEN*)GetScreen())->m_Active_Layer = GetBoard()->m_BoardSettings->m_CopperLayerCount - 2; else if ( old_layer == LAYER_N_2 ) ((PCB_SCREEN*)GetScreen())->m_Active_Layer = COPPER_LAYER_N; - else if ( old_layer == m_Pcb->m_BoardSettings->m_CopperLayerCount - 2 ) + else if ( old_layer == GetBoard()->m_BoardSettings->m_CopperLayerCount - 2 ) ((PCB_SCREEN*)GetScreen())->m_Active_Layer = LAYER_CMP_N; // else error via->SetLayerPair( old_layer, ((PCB_SCREEN*)GetScreen())->m_Active_Layer ); @@ -246,7 +246,7 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) break; } - if( Drc_On && BAD_DRC==m_drc->Drc( via, m_Pcb->m_Track ) ) + if( Drc_On && BAD_DRC==m_drc->Drc( via, GetBoard()->m_Track ) ) { /* DRC fault: the Via cannot be placed here ... */ delete via; @@ -326,9 +326,9 @@ void WinEDA_PcbFrame::Affiche_Status_Net( wxDC* DC ) TRACK* pt_segm; int masquelayer = g_TabOneLayerMask[((PCB_SCREEN*)GetScreen())->m_Active_Layer]; - pt_segm = Locate_Pistes( m_Pcb->m_Track, masquelayer, CURSEUR_OFF_GRILLE ); + pt_segm = Locate_Pistes( GetBoard()->m_Track, masquelayer, CURSEUR_OFF_GRILLE ); if( pt_segm == NULL ) - m_Pcb->Display_Infos( this ); + GetBoard()->Display_Infos( this ); else test_1_net_connexion( DC, pt_segm->GetNet() ); } @@ -352,7 +352,7 @@ void WinEDA_PcbFrame::Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC ) if( g_Show_Ratsnest ) return; // Deja Affich� - if( (m_Pcb->m_Status_Pcb & LISTE_CHEVELU_OK) == 0 ) + if( (GetBoard()->m_Status_Pcb & LISTE_CHEVELU_OK) == 0 ) { Compile_Ratsnest( DC, TRUE ); } @@ -368,8 +368,8 @@ void WinEDA_PcbFrame::Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC ) if( pt_pad ) /* Affichage du chevelu du net correspondant */ { pt_pad->Display_Infos( this ); - pt_chevelu = (CHEVELU*) m_Pcb->m_Ratsnest; - for( ii = m_Pcb->GetNumRatsnests(); ii > 0; pt_chevelu++, ii-- ) + pt_chevelu = (CHEVELU*) GetBoard()->m_Ratsnest; + for( ii = GetBoard()->GetNumRatsnests(); ii > 0; pt_chevelu++, ii-- ) { if( pt_chevelu->GetNet() == pt_pad->GetNet() ) { @@ -407,8 +407,8 @@ void WinEDA_PcbFrame::Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC ) pt_pad = Module->m_Pads; for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Next() ) { - pt_chevelu = (CHEVELU*) m_Pcb->m_Ratsnest; - for( ii = m_Pcb->GetNumRatsnests(); ii > 0; pt_chevelu++, ii-- ) + pt_chevelu = (CHEVELU*) GetBoard()->m_Ratsnest; + for( ii = GetBoard()->GetNumRatsnests(); ii > 0; pt_chevelu++, ii-- ) { if( (pt_chevelu->pad_start == pt_pad) || (pt_chevelu->pad_end == pt_pad) ) @@ -441,9 +441,9 @@ void WinEDA_PcbFrame::Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC ) if( (pt_pad == NULL) && (Module == NULL) ) { DrawGeneralRatsnest( DC ); - pt_chevelu = (CHEVELU*) m_Pcb->m_Ratsnest; + pt_chevelu = (CHEVELU*) GetBoard()->m_Ratsnest; - for( ii = m_Pcb->GetNumRatsnests(); (ii > 0) && pt_chevelu; pt_chevelu++, ii-- ) + for( ii = GetBoard()->GetNumRatsnests(); (ii > 0) && pt_chevelu; pt_chevelu++, ii-- ) pt_chevelu->status &= ~CH_VISIBLE; } } @@ -461,8 +461,8 @@ void WinEDA_PcbFrame::Affiche_PadsNoConnect( wxDC* DC ) CHEVELU* pt_chevelu; D_PAD* pt_pad; - pt_chevelu = (CHEVELU*) m_Pcb->m_Ratsnest; - for( ii = m_Pcb->GetNumRatsnests(); ii > 0; pt_chevelu++, ii-- ) + pt_chevelu = (CHEVELU*) GetBoard()->m_Ratsnest; + for( ii = GetBoard()->GetNumRatsnests(); ii > 0; pt_chevelu++, ii-- ) { if( (pt_chevelu->status & CH_ACTIF) == 0 ) continue; diff --git a/pcbnew/editrack.cpp b/pcbnew/editrack.cpp index 19dfc713fb..891f676ecc 100644 --- a/pcbnew/editrack.cpp +++ b/pcbnew/editrack.cpp @@ -107,13 +107,13 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC ) InitialTrackWidthValue = -1; // Set to "no value" - g_CurrentTrackList.PushBack( new TRACK( m_Pcb ) ); + g_CurrentTrackList.PushBack( new TRACK( GetBoard() ) ); g_CurrentTrackSegment->m_Flags = IS_NEW; g_HightLigth_NetCode = 0; // Search for a starting point of the new track, a track or pad - LockPoint = LocateLockPoint( m_Pcb, pos, masquelayer ); + LockPoint = LocateLockPoint( GetBoard(), pos, masquelayer ); if( LockPoint ) // An item (pad or track) is found { @@ -135,7 +135,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC ) else // no starting point, but a filled zone area can exist. This is also a good starting point. { - ZONE_CONTAINER* zone = m_Pcb->HitTestForAnyFilledArea( pos, GetScreen()->m_Active_Layer ); + ZONE_CONTAINER* zone = GetBoard()->HitTestForAnyFilledArea( pos, GetScreen()->m_Active_Layer ); if( zone ) g_HightLigth_NetCode = zone->GetNet(); } @@ -197,7 +197,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC ) if( Drc_On ) { - if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment, m_Pcb->m_Track ) ) + if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) ) { return g_CurrentTrackSegment; } @@ -210,13 +210,13 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC ) /* Tst for a D.R.C. error: */ if( Drc_On ) { - if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment, m_Pcb->m_Track ) ) + if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) ) return NULL; // We must handle 2 segments if( g_TwoSegmentTrackBuild && g_CurrentTrackSegment->Back() ) { - if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment->Back(), m_Pcb->m_Track ) ) + if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment->Back(), GetBoard()->m_Track ) ) return NULL; } } @@ -254,7 +254,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC ) newTrack->SetState( BEGIN_ONPAD | END_ONPAD, OFF ); - oneBeforeLatest->end = Locate_Pad_Connecte( m_Pcb, oneBeforeLatest, END ); + oneBeforeLatest->end = Locate_Pad_Connecte( GetBoard(), oneBeforeLatest, END ); if( oneBeforeLatest->end ) { oneBeforeLatest->SetState( END_ONPAD, ON ); @@ -365,7 +365,7 @@ bool WinEDA_PcbFrame::Add_45_degrees_Segment( wxDC* DC ) else newTrack->m_End.x -= pas_45; - if( Drc_On && BAD_DRC==m_drc->Drc( curTrack, m_Pcb->m_Track ) ) + if( Drc_On && BAD_DRC==m_drc->Drc( curTrack, GetBoard()->m_Track ) ) { delete newTrack; return false; @@ -402,7 +402,7 @@ bool WinEDA_PcbFrame::Add_45_degrees_Segment( wxDC* DC ) else newTrack->m_End.y -= pas_45; - if( Drc_On && BAD_DRC==m_drc->Drc( newTrack, m_Pcb->m_Track ) ) + if( Drc_On && BAD_DRC==m_drc->Drc( newTrack, GetBoard()->m_Track ) ) { delete newTrack; return false; @@ -432,7 +432,7 @@ void WinEDA_PcbFrame::End_Route( TRACK* aTrack, wxDC* DC ) if( aTrack == NULL ) return; - if( Drc_On && BAD_DRC==m_drc->Drc( g_CurrentTrackSegment, m_Pcb->m_Track ) ) + if( Drc_On && BAD_DRC==m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) ) return; /* Sauvegarde des coord du point terminal de la piste */ @@ -464,7 +464,7 @@ void WinEDA_PcbFrame::End_Route( TRACK* aTrack, wxDC* DC ) * ceci contribue a la reduction du temps de calcul */ /* Accrochage de la fin de la piste */ - EDA_BaseStruct* LockPoint = LocateLockPoint( m_Pcb, pos, masquelayer ); + EDA_BaseStruct* LockPoint = LocateLockPoint( GetBoard(), pos, masquelayer ); if( LockPoint ) /* La fin de la piste est sur un PAD */ { @@ -487,7 +487,7 @@ void WinEDA_PcbFrame::End_Route( TRACK* aTrack, wxDC* DC ) } // Delete Null segments: - DeleteNullTrackSegments( m_Pcb, g_CurrentTrackList ); + DeleteNullTrackSegments( GetBoard(), g_CurrentTrackList ); // Insert new segments if they exist. This can be NULL on a double click on the start point if( g_FirstTrackSegment != NULL ) @@ -498,10 +498,10 @@ void WinEDA_PcbFrame::End_Route( TRACK* aTrack, wxDC* DC ) // Put entire new current segment list in BOARD TRACK* track; - TRACK* insertBeforeMe = g_CurrentTrackSegment->GetBestInsertPoint( m_Pcb ); + TRACK* insertBeforeMe = g_CurrentTrackSegment->GetBestInsertPoint( GetBoard() ); while( (track = g_CurrentTrackList.PopFront()) != NULL ) { - m_Pcb->m_Track.Insert( track, insertBeforeMe ); + GetBoard()->m_Track.Insert( track, insertBeforeMe ); } trace_ratsnest_pad( DC ); @@ -517,14 +517,14 @@ void WinEDA_PcbFrame::End_Route( TRACK* aTrack, wxDC* DC ) // erase the old track, if exists if( g_AutoDeleteOldTrack ) { - EraseOldTrack( this, m_Pcb, DC, firstTrack, newCount ); + EraseOldTrack( this, GetBoard(), DC, firstTrack, newCount ); } /* compute the new rastnest : */ test_1_net_connexion( DC, netcode ); GetScreen()->SetModify(); - m_Pcb->Display_Infos( this ); + GetBoard()->Display_Infos( this ); } wxASSERT( g_FirstTrackSegment==NULL ); @@ -605,7 +605,7 @@ TRACK* LocateIntrusion( TRACK* start, int net, int width ) */ static void PushTrack( WinEDA_DrawPanel* panel ) { - BOARD* pcb = ( (WinEDA_BasePcbFrame*) (panel->m_Parent) )->m_Pcb; + BOARD* pcb = ( (WinEDA_BasePcbFrame*) (panel->m_Parent) )->GetBoard(); wxPoint cursor = ActiveScreen->m_Curseur; wxPoint cv, vec, n; TRACK* track = g_CurrentTrackSegment; diff --git a/pcbnew/export_gencad.cpp b/pcbnew/export_gencad.cpp index f58358531b..0bd6fccd75 100644 --- a/pcbnew/export_gencad.cpp +++ b/pcbnew/export_gencad.cpp @@ -85,7 +85,7 @@ void WinEDA_PcbFrame::ExportToGenCAD( wxCommandEvent& event ) } /* Mise a jour des infos PCB: */ - m_Pcb->ComputeBoundaryBox(); + GetBoard()->ComputeBoundaryBox(); offsetX = m_Auxiliary_Axis_Position.x; offsetY = m_Auxiliary_Axis_Position.y; @@ -98,44 +98,44 @@ void WinEDA_PcbFrame::ExportToGenCAD( wxCommandEvent& event ) * (necessaire pour decrire les formes sous GenCAD, * qui sont decrites en vue normale, orientation 0)) */ MODULE* module; - for( module = m_Pcb->m_Modules; module != NULL; module = module->Next() ) + for( module = GetBoard()->m_Modules; module != NULL; module = module->Next() ) { module->flag = 0; if( module->GetLayer() == COPPER_LAYER_N ) { - m_Pcb->Change_Side_Module( module, NULL ); + GetBoard()->Change_Side_Module( module, NULL ); module->flag = 1; } } // Creation de l'entete: CreateHeaderInfoData( file, this ); - CreateBoardSection( file, m_Pcb ); + CreateBoardSection( file, GetBoard() ); /* Creation liste des TRACKS * (section $TRACK) id liste des outils de tracage de pistes */ - CreateTracksInfoData( file, m_Pcb ); + CreateTracksInfoData( file, GetBoard() ); /* Creation de la liste des formes utilisees * (formes des composants principalement */ - CreatePadsShapesSection( file, m_Pcb ); // doit etre appele avant CreateShapesSection() - CreateShapesSection( file, m_Pcb ); + CreatePadsShapesSection( file, GetBoard() ); // doit etre appele avant CreateShapesSection() + CreateShapesSection( file, GetBoard() ); /* Creation de la liste des equipotentielles: */ - CreateSignalsSection( file, m_Pcb ); + CreateSignalsSection( file, GetBoard() ); - CreateDevicesSection( file, m_Pcb ); - CreateComponentsSection( file, m_Pcb ); - CreateRoutesSection( file, m_Pcb ); + CreateDevicesSection( file, GetBoard() ); + CreateComponentsSection( file, GetBoard() ); + CreateRoutesSection( file, GetBoard() ); fclose( file ); /* Remise en place des modules vus en miroir */ - for( module = m_Pcb->m_Modules; module != NULL; module = module->Next() ) + for( module = GetBoard()->m_Modules; module != NULL; module = module->Next() ) { if( module->flag ) { - m_Pcb->Change_Side_Module( module, NULL ); + GetBoard()->Change_Side_Module( module, NULL ); module->flag = 0; } } diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index 4997a546fc..5ac8e9dbde 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -149,7 +149,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append ) { GetScreen()->m_FileName = wxEmptyString; GetScreen()->SetModify(); - m_Pcb->m_Status_Pcb = 0; + GetBoard()->m_Status_Pcb = 0; } wxString fileName; @@ -253,7 +253,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append ) /* Rebuild the new pad list (for drc and ratsnet control ...) */ build_liste_pads(); - m_Pcb->Display_Infos( this ); + GetBoard()->Display_Infos( this ); DrawPanel->Refresh( true); /* reset the auto save timer */ @@ -268,7 +268,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append ) // the pcbnew program when the pipe it is writing to gets full. // Output the board object tree to stdout, but please run from command prompt: - m_Pcb->Show( 0, std::cout ); + GetBoard()->Show( 0, std::cout ); #endif return 1; diff --git a/pcbnew/find.cpp b/pcbnew/find.cpp index fb69c77b93..dca58a352d 100644 --- a/pcbnew/find.cpp +++ b/pcbnew/find.cpp @@ -33,7 +33,7 @@ void WinEDA_PcbFrame::InstallFindFrame( const wxPoint& pos, wxDC* DC ) { WinEDA_PcbFindFrame* frame = new WinEDA_PcbFindFrame( this, DC, pos ); - frame->ShowModal(); + frame->ShowModal(); frame->Destroy(); } @@ -42,7 +42,7 @@ void WinEDA_PcbFrame::InstallFindFrame( const wxPoint& pos, wxDC* DC ) void WinEDA_PcbFindFrame::FindItem( wxCommandEvent& event ) /********************************************************/ { - PCB_SCREEN* screen = (PCB_SCREEN*)(m_Parent->GetScreen()); + PCB_SCREEN* screen = (PCB_SCREEN*)(m_Parent->GetScreen()); wxPoint locate_pos; wxString msg; bool FindMarker = FALSE; @@ -69,7 +69,7 @@ void WinEDA_PcbFindFrame::FindItem( wxCommandEvent& event ) if( FindMarker ) { - MARKER* marker = m_Parent->m_Pcb->GetMARKER( s_MarkerCount++ ); + MARKER* marker = m_Parent->GetBoard()->GetMARKER( s_MarkerCount++ ); if( marker ) { foundItem = marker; @@ -79,7 +79,7 @@ void WinEDA_PcbFindFrame::FindItem( wxCommandEvent& event ) else { int StartCount = 0; - for( MODULE* module = m_Parent->m_Pcb->m_Modules; module; module = module->Next() ) + for( MODULE* module = m_Parent->GetBoard()->m_Modules; module; module = module->Next() ) { if( WildCompareString( s_OldStringFound, module->GetReference().GetData(), FALSE ) ) { @@ -109,27 +109,27 @@ void WinEDA_PcbFindFrame::FindItem( wxCommandEvent& event ) if( foundItem ) { m_Parent->SetCurItem( foundItem ); - + if( FindMarker ) msg = _( "Marker found" ); else - msg.Printf( _( "<%s> Found" ), s_OldStringFound.GetData() ); + msg.Printf( _( "<%s> Found" ), s_OldStringFound.GetData() ); m_Parent->Affiche_Message( msg ); - + m_Parent->CursorGoto( locate_pos ); - + EndModal( 1 ); } else { m_Parent->Affiche_Message( wxEmptyString ); - + if( FindMarker ) msg = _( "Marker not found" ); else msg.Printf( _( "<%s> Not Found" ), s_OldStringFound.GetData() ); - + DisplayError( this, msg, 10 ); EndModal( 0 ); } diff --git a/pcbnew/gen_modules_placefile.cpp b/pcbnew/gen_modules_placefile.cpp index 5e905385dd..1dc4b28792 100644 --- a/pcbnew/gen_modules_placefile.cpp +++ b/pcbnew/gen_modules_placefile.cpp @@ -94,7 +94,7 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event ) /* Calcul du nombre de modules utiles ( Attribut CMS, non VIRTUAL ) ) */ int moduleCount = 0; - for( module = m_Pcb->m_Modules; module; module = module->Next() ) + for( module = GetBoard()->m_Modules; module; module = module->Next() ) { if( module->m_Attributs & MOD_VIRTUAL ) { @@ -134,7 +134,7 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event ) fnFront = GetScreen()->m_FileName; - frontLayerName = m_Pcb->GetLayerName( CMP_N ); + frontLayerName = GetBoard()->GetLayerName( CMP_N ); extension.Printf( wxT("-%s.pos"), frontLayerName.GetData() ); ChangeFileNameExt( fnFront, extension ); @@ -151,7 +151,7 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event ) { fnBack = GetScreen()->m_FileName; - backLayerName = m_Pcb->GetLayerName( COPPER_LAYER_N ); + backLayerName = GetBoard()->GetLayerName( COPPER_LAYER_N ); extension.Printf( wxT("-%s.pos"), backLayerName.GetData() ); ChangeFileNameExt( fnBack, extension ); @@ -182,7 +182,7 @@ void WinEDA_PcbFrame::GenModulesPosition( wxCommandEvent& event ) /* Etablissement de la liste des modules par ordre alphabetique */ Liste = (LIST_MOD*) MyZMalloc( moduleCount * sizeof(LIST_MOD) ); - module = m_Pcb->m_Modules; + module = GetBoard()->m_Modules; for( int ii = 0; module; module = module->Next() ) { if( module->m_Attributs & MOD_VIRTUAL ) @@ -347,22 +347,22 @@ void WinEDA_PcbFrame::GenModuleReport( wxCommandEvent& event ) fputs( "##\n", rptfile ); fputs( "\n$BeginDESCRIPTION\n", rptfile ); - m_Pcb->ComputeBoundaryBox(); + GetBoard()->ComputeBoundaryBox(); fputs( "\n$BOARD\n", rptfile ); fputs( "unit INCH\n", rptfile ); sprintf( line, "upper_left_corner %9.6f %9.6f\n", - (float) m_Pcb->m_BoundaryBox.GetX() * conv_unit, - (float) m_Pcb->m_BoundaryBox.GetY() * conv_unit ); + (float) GetBoard()->m_BoundaryBox.GetX() * conv_unit, + (float) GetBoard()->m_BoundaryBox.GetY() * conv_unit ); fputs( line, rptfile ); sprintf( line, "lower_right_corner %9.6f %9.6f\n", - (float) ( m_Pcb->m_BoundaryBox.GetRight() ) * conv_unit, - (float) ( m_Pcb->m_BoundaryBox.GetBottom() ) * conv_unit ); + (float) ( GetBoard()->m_BoundaryBox.GetRight() ) * conv_unit, + (float) ( GetBoard()->m_BoundaryBox.GetBottom() ) * conv_unit ); fputs( line, rptfile ); fputs( "$EndBOARD\n\n", rptfile ); - Module = (MODULE*) m_Pcb->m_Modules; + Module = (MODULE*) GetBoard()->m_Modules; for( ; Module != NULL; Module = Module->Next() ) { sprintf( line, "$MODULE \"%s\"\n", CONV_TO_UTF8( Module->m_Reference->m_Text ) ); @@ -447,7 +447,7 @@ void WinEDA_PcbFrame::GenModuleReport( wxCommandEvent& event ) /* Write board Edges */ EDA_BaseStruct* PtStruct; - for( PtStruct = m_Pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() ) + for( PtStruct = GetBoard()->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() ) { if( PtStruct->Type() != TYPE_DRAWSEGMENT ) continue; diff --git a/pcbnew/gen_self.h b/pcbnew/gen_self.h index 68ca599f56..3f55ba27c4 100644 --- a/pcbnew/gen_self.h +++ b/pcbnew/gen_self.h @@ -280,7 +280,7 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC ) if( Create_1_Module( DC, wxEmptyString ) == NULL ) return NULL; - Module = m_Pcb->m_Modules; + Module = GetBoard()->m_Modules; Module->m_LibRef = wxT( "MuSelf" ); Module->m_Attributs = MOD_VIRTUAL | MOD_CMS; Module->m_Flags = 0; diff --git a/pcbnew/gendrill.cpp b/pcbnew/gendrill.cpp index 929b5984d0..b159c110c7 100644 --- a/pcbnew/gendrill.cpp +++ b/pcbnew/gendrill.cpp @@ -106,7 +106,7 @@ void WinEDA_DrillFrame::InitDisplayParams( void ) m_ThroughViasCount = 0; m_MicroViasCount = 0; m_BlindOrBuriedViasCount = 0; - for( TRACK* track = m_Parent->m_Pcb->m_Track; track != NULL; track = track->Next() ) + for( TRACK* track = m_Parent->GetBoard()->m_Track; track != NULL; track = track->Next() ) { if( track->Type() != TYPE_VIA ) continue; @@ -123,7 +123,7 @@ void WinEDA_DrillFrame::InitDisplayParams( void ) // Pads holes cound: m_PadsHoleCount = 0; - for( MODULE* module = m_Parent->m_Pcb->m_Modules; module != NULL; module = module->Next() ) + for( MODULE* module = m_Parent->GetBoard()->m_Modules; module != NULL; module = module->Next() ) { for( D_PAD* pad = module->m_Pads; pad != NULL; pad = pad->Next() ) { @@ -284,7 +284,7 @@ void WinEDA_DrillFrame::GenDrillFiles( wxCommandEvent& event ) Mask += Ext; for( ; ; ) { - Build_Holes_List( m_Parent->m_Pcb, s_HoleListBuffer, s_ToolListBuffer, + Build_Holes_List( m_Parent->GetBoard(), s_HoleListBuffer, s_ToolListBuffer, layer1, layer2, gen_through_holes ? false : true ); if( s_ToolListBuffer.size() > 0 ) //holes? { @@ -766,7 +766,7 @@ void WinEDA_DrillFrame::GenDrillMap( const wxString aFileName, DisplayError( this, msg ); return; } - GenDrillMapFile( m_Parent->m_Pcb, + GenDrillMapFile( m_Parent->GetBoard(), dest, FullFileName, m_Parent->GetScreen()->m_CurrentSheetDesc->m_Size, @@ -811,7 +811,7 @@ void WinEDA_DrillFrame::GenDrillReport( const wxString aFileName ) DisplayError( this, msg ); return; } - GenDrillReportFile( dest, m_Parent->m_Pcb, + GenDrillReportFile( dest, m_Parent->GetBoard(), m_Parent->GetScreen()->m_FileName, s_Unit_Drill_is_Inch, s_HoleListBuffer, diff --git a/pcbnew/hotkeys.cpp b/pcbnew/hotkeys.cpp index 11903587c8..097f419fc1 100644 --- a/pcbnew/hotkeys.cpp +++ b/pcbnew/hotkeys.cpp @@ -210,10 +210,10 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, ll = GetScreen()->m_Active_Layer; if( (ll <= COPPER_LAYER_N) || (ll > CMP_N) ) break; - if( m_Pcb->m_BoardSettings->m_CopperLayerCount < 2 ) // Single layer + if( GetBoard()->m_BoardSettings->m_CopperLayerCount < 2 ) // Single layer ll = COPPER_LAYER_N; else if( ll == CMP_N ) - ll = MAX( COPPER_LAYER_N, m_Pcb->m_BoardSettings->m_CopperLayerCount - 2 ); + ll = MAX( COPPER_LAYER_N, GetBoard()->m_BoardSettings->m_CopperLayerCount - 2 ); else ll--; SwitchLayer( DC, ll ); @@ -223,9 +223,9 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, ll = GetScreen()->m_Active_Layer; if( (ll < COPPER_LAYER_N) || (ll >= CMP_N) ) break; - if( m_Pcb->m_BoardSettings->m_CopperLayerCount < 2 ) // Single layer + if( GetBoard()->m_BoardSettings->m_CopperLayerCount < 2 ) // Single layer ll = COPPER_LAYER_N; - else if( ll >= m_Pcb->m_BoardSettings->m_CopperLayerCount - 2 ) + else if( ll >= GetBoard()->m_BoardSettings->m_CopperLayerCount - 2 ) ll = CMP_N; else ll++; @@ -425,7 +425,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, case HK_LOCK_UNLOCK_FOOTPRINT: // toggle module "MODULE_is_LOCKED" status: // get any module, locked or not locked and toggle its locked status if( ItemFree ) - module = Locate_Prefered_Module( m_Pcb, CURSEUR_OFF_GRILLE | VISIBLE_ONLY ); + module = Locate_Prefered_Module( GetBoard(), CURSEUR_OFF_GRILLE | VISIBLE_ONLY ); else if( GetCurItem()->Type() == TYPE_MODULE ) module = (MODULE*) GetCurItem(); if( module ) @@ -445,7 +445,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, case HK_FLIP_FOOTPRINT: // move to other side if( ItemFree ) { - module = Locate_Prefered_Module( m_Pcb, + module = Locate_Prefered_Module( GetBoard(), CURSEUR_OFF_GRILLE | IGNORE_LOCKED | VISIBLE_ONLY #if defined (USE_MATCH_LAYER) | MATCH_LAYER @@ -454,7 +454,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, if( module == NULL ) // no footprint found { - module = Locate_Prefered_Module( m_Pcb, CURSEUR_OFF_GRILLE | VISIBLE_ONLY ); + module = Locate_Prefered_Module( GetBoard(), CURSEUR_OFF_GRILLE | VISIBLE_ONLY ); if( module ) { // a footprint is found, but locked or on an other layer @@ -504,7 +504,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, break; case HK_FLIP_FOOTPRINT: // move to other side - m_Pcb->Change_Side_Module( module, DC ); + GetBoard()->Change_Side_Module( module, DC ); break; case HK_DRAG_FOOTPRINT: // Start move (and drag) module @@ -624,7 +624,7 @@ bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct ) case ID_COMPONENT_BUTT: if( ItemFree ) { - MODULE* module = Locate_Prefered_Module( m_Pcb, CURSEUR_ON_GRILLE ); + MODULE* module = Locate_Prefered_Module( GetBoard(), CURSEUR_ON_GRILLE ); if( module == NULL ) return FALSE; if( !IsOK( this, _( "Delete module?" ) ) ) diff --git a/pcbnew/initpcb.cpp b/pcbnew/initpcb.cpp index 425f1a35fc..c9814a162d 100644 --- a/pcbnew/initpcb.cpp +++ b/pcbnew/initpcb.cpp @@ -114,13 +114,13 @@ bool WinEDA_BasePcbFrame::Clear_Pcb( bool query ) * Si query == FALSE, il n'y aura pas de confirmation */ { - if( m_Pcb == NULL ) + if( GetBoard() == NULL ) return FALSE; if( query && GetScreen()->IsModify() ) { - if( m_Pcb->m_Drawings || m_Pcb->m_Modules - || m_Pcb->m_Track || m_Pcb->m_Zone ) + if( GetBoard()->m_Drawings || GetBoard()->m_Modules + || GetBoard()->m_Track || GetBoard()->m_Zone ) { if( !IsOK( this, _( "Current Board will be lost ?" ) ) ) return FALSE; @@ -129,7 +129,7 @@ bool WinEDA_BasePcbFrame::Clear_Pcb( bool query ) // delete the old BOARD and create a new BOARD so that the default // layer names are put into the BOARD. - SetBOARD( new BOARD( NULL, this ) ); + SetBoard( new BOARD( NULL, this ) ); while( g_UnDeleteStackPtr > 0 ) { @@ -161,7 +161,7 @@ bool WinEDA_BasePcbFrame::Clear_Pcb( bool query ) g_DesignSettings.m_TrackWidthHistory[0] = g_DesignSettings.m_CurrentTrackWidth; g_DesignSettings.m_ViaSizeHistory[0] = g_DesignSettings.m_CurrentViaSize; - g_DesignSettings.m_CopperLayerCount = 2; // Default copper layers count set to 2: double layer board + g_DesignSettings.m_CopperLayerCount = 2; // Default copper layers count set to 2: double layer board Zoom_Automatique( TRUE ); @@ -176,8 +176,8 @@ void WinEDA_PcbFrame::Erase_Zones( bool query ) if( query && !IsOK( this, _( "Delete Zones ?" ) ) ) return; - m_Pcb->m_Zone.DeleteAll(); - m_Pcb->DeleteZONEOutlines(); + GetBoard()->m_Zone.DeleteAll(); + GetBoard()->DeleteZONEOutlines(); GetScreen()->SetModify(); } @@ -203,7 +203,7 @@ void WinEDA_PcbFrame::Erase_Segments_Pcb( bool is_edges, bool query ) return; } - PtStruct = m_Pcb->m_Drawings; + PtStruct = GetBoard()->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtNext ) { PtNext = PtStruct->Next(); @@ -215,7 +215,7 @@ void WinEDA_PcbFrame::Erase_Segments_Pcb( bool is_edges, bool query ) case TYPE_COTATION: case TYPE_MIRE: if( g_TabOneLayerMask[ PtStruct->GetLayer()] & masque_layer ) - m_Pcb->Delete( PtStruct ); + GetBoard()->Delete( PtStruct ); break; default: @@ -245,7 +245,7 @@ void WinEDA_PcbFrame::Erase_Pistes( wxDC * DC, int masque_type, bool query ) return; /* Marquage des pistes a effacer */ - for( pt_segm = m_Pcb->m_Track; pt_segm != NULL; pt_segm = (TRACK*) PtNext ) + for( pt_segm = GetBoard()->m_Track; pt_segm != NULL; pt_segm = (TRACK*) PtNext ) { PtNext = pt_segm->Next(); @@ -267,12 +267,12 @@ void WinEDA_PcbFrame::Erase_Modules( bool query ) if( query && !IsOK( this, _( "Delete Modules?" ) ) ) return; - m_Pcb->m_Modules.DeleteAll(); + GetBoard()->m_Modules.DeleteAll(); - m_Pcb->m_Status_Pcb = 0; - m_Pcb->m_NbNodes = 0; - m_Pcb->m_NbLinks = 0; - m_Pcb->m_NbNoconnect = 0; + GetBoard()->m_Status_Pcb = 0; + GetBoard()->m_NbNodes = 0; + GetBoard()->m_NbLinks = 0; + GetBoard()->m_NbNoconnect = 0; GetScreen()->SetModify(); } @@ -287,7 +287,7 @@ void WinEDA_PcbFrame::Erase_Textes_Pcb( bool query ) if( query && !IsOK( this, _( "Delete Pcb Texts" ) ) ) return; - PtStruct = m_Pcb->m_Drawings; + PtStruct = GetBoard()->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtNext ) { PtNext = PtStruct->Next(); @@ -305,7 +305,7 @@ void WinEDA_PcbFrame::Erase_Textes_Pcb( bool query ) void WinEDA_PcbFrame::Erase_Marqueurs() /*******************************************/ { - m_Pcb->DeleteMARKERs(); + GetBoard()->DeleteMARKERs(); GetScreen()->SetModify(); // @todo : why mark this if MARKERs are not saved in the *.brd file? } diff --git a/pcbnew/ioascii.cpp b/pcbnew/ioascii.cpp index 711ec52223..ae6926e989 100644 --- a/pcbnew/ioascii.cpp +++ b/pcbnew/ioascii.cpp @@ -129,18 +129,18 @@ int WinEDA_BasePcbFrame::ReadListeSegmentDescr( FILE* File, { default: case TYPE_TRACK: - newTrack = new TRACK( m_Pcb ); - m_Pcb->m_Track.Insert( newTrack, insertBeforeMe ); + newTrack = new TRACK( GetBoard() ); + GetBoard()->m_Track.Insert( newTrack, insertBeforeMe ); break; case TYPE_VIA: - newTrack = new SEGVIA( m_Pcb ); - m_Pcb->m_Track.Insert( newTrack, insertBeforeMe ); + newTrack = new SEGVIA( GetBoard() ); + GetBoard()->m_Track.Insert( newTrack, insertBeforeMe ); break; case TYPE_ZONE: - newTrack = new SEGZONE( m_Pcb ); - m_Pcb->m_Zone.Insert( (SEGZONE*)newTrack, (SEGZONE*)insertBeforeMe ); + newTrack = new SEGZONE( GetBoard() ); + GetBoard()->m_Zone.Insert( (SEGZONE*)newTrack, (SEGZONE*)insertBeforeMe ); break; } @@ -188,11 +188,11 @@ int WinEDA_BasePcbFrame::ReadGeneralDescrPcb( FILE* File, int* LineNum ) sscanf( data, "%X", &Masque_Layer ); // Setup layer count - m_Pcb->m_BoardSettings->m_CopperLayerCount = 0; + GetBoard()->m_BoardSettings->m_CopperLayerCount = 0; for( ii = 0; ii < NB_COPPER_LAYERS; ii++ ) { if( Masque_Layer & 1 ) - m_Pcb->m_BoardSettings->m_CopperLayerCount++; + GetBoard()->m_BoardSettings->m_CopperLayerCount++; Masque_Layer >>= 1; } @@ -202,14 +202,14 @@ int WinEDA_BasePcbFrame::ReadGeneralDescrPcb( FILE* File, int* LineNum ) if( strnicmp( data, "Links", 5 ) == 0 ) { data = strtok( NULL, " =\n\r" ); - m_Pcb->m_NbLinks = atoi( data ); + GetBoard()->m_NbLinks = atoi( data ); continue; } if( strnicmp( data, "NoConn", 6 ) == 0 ) { data = strtok( NULL, " =\n\r" ); - m_Pcb->m_NbNoconnect = atoi( data ); + GetBoard()->m_NbNoconnect = atoi( data ); continue; } @@ -217,13 +217,13 @@ int WinEDA_BasePcbFrame::ReadGeneralDescrPcb( FILE* File, int* LineNum ) { wxSize pcbsize, screensize; data = strtok( NULL, " =\n\r" ); - m_Pcb->m_BoundaryBox.SetX( atoi( data ) ); + GetBoard()->m_BoundaryBox.SetX( atoi( data ) ); data = strtok( NULL, " =\n\r" ); - m_Pcb->m_BoundaryBox.SetY( atoi( data ) ); + GetBoard()->m_BoundaryBox.SetY( atoi( data ) ); data = strtok( NULL, " =\n\r" ); - m_Pcb->m_BoundaryBox.SetWidth( atoi( data ) - m_Pcb->m_BoundaryBox.GetX() ); + GetBoard()->m_BoundaryBox.SetWidth( atoi( data ) - GetBoard()->m_BoundaryBox.GetX() ); data = strtok( NULL, " =\n\r" ); - m_Pcb->m_BoundaryBox.SetHeight( atoi( data ) - m_Pcb->m_BoundaryBox.GetY() ); + GetBoard()->m_BoundaryBox.SetHeight( atoi( data ) - GetBoard()->m_BoundaryBox.GetY() ); continue; } @@ -300,7 +300,7 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum ) { int tmp; sscanf( data, "%d", &tmp ); - m_Pcb->m_BoardSettings->m_CopperLayerCount = tmp; + GetBoard()->m_BoardSettings->m_CopperLayerCount = tmp; continue; } @@ -317,13 +317,13 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum ) if( data ) { wxString layerName = CONV_FROM_UTF8( data ); - m_Pcb->SetLayerName( layer, layerName ); + GetBoard()->SetLayerName( layer, layerName ); data = strtok( NULL, " " ); if( data ) { LAYER_T type = LAYER::ParseType( data ); - m_Pcb->SetLayerType( layer, type ); + GetBoard()->SetLayerType( layer, type ); } } continue; @@ -583,41 +583,41 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard ) bool WinEDA_PcbFrame::WriteGeneralDescrPcb( FILE* File ) /******************************************************/ { - EDA_BaseStruct* PtStruct = m_Pcb->m_Modules; + EDA_BaseStruct* PtStruct = GetBoard()->m_Modules; int NbModules, NbDrawItem, NbLayers; /* Write copper layer count */ - NbLayers = m_Pcb->m_BoardSettings->m_CopperLayerCount; + NbLayers = GetBoard()->m_BoardSettings->m_CopperLayerCount; fprintf( File, "$GENERAL\n" ); fprintf( File, "LayerCount %d\n", NbLayers ); // Write old format for Layer count (for compatibility with old versions of pcbnew fprintf( File, "Ly %8X\n", g_TabAllCopperLayerMask[NbLayers - 1] | ALL_NO_CU_LAYERS ); // For compatibility with old version of pcbnew - fprintf( File, "Links %d\n", m_Pcb->m_NbLinks ); - fprintf( File, "NoConn %d\n", m_Pcb->m_NbNoconnect ); + fprintf( File, "Links %d\n", GetBoard()->m_NbLinks ); + fprintf( File, "NoConn %d\n", GetBoard()->m_NbNoconnect ); /* Write Bounding box info */ - m_Pcb->ComputeBoundaryBox(); + GetBoard()->ComputeBoundaryBox(); fprintf( File, "Di %d %d %d %d\n", - m_Pcb->m_BoundaryBox.GetX(), m_Pcb->m_BoundaryBox.GetY(), - m_Pcb->m_BoundaryBox.GetRight(), - m_Pcb->m_BoundaryBox.GetBottom() ); + GetBoard()->m_BoundaryBox.GetX(), GetBoard()->m_BoundaryBox.GetY(), + GetBoard()->m_BoundaryBox.GetRight(), + GetBoard()->m_BoundaryBox.GetBottom() ); /* Write segment count for footprints, drawings, track and zones */ /* Calculate the footprint count */ for( NbModules = 0; PtStruct != NULL; PtStruct = PtStruct->Next() ) NbModules++; - PtStruct = m_Pcb->m_Drawings; NbDrawItem = 0; + PtStruct = GetBoard()->m_Drawings; NbDrawItem = 0; for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) NbDrawItem++; fprintf( File, "Ndraw %d\n", NbDrawItem ); - fprintf( File, "Ntrack %d\n", m_Pcb->GetNumSegmTrack() ); - fprintf( File, "Nzone %d\n", m_Pcb->GetNumSegmZone() ); + fprintf( File, "Ntrack %d\n", GetBoard()->GetNumSegmTrack() ); + fprintf( File, "Nzone %d\n", GetBoard()->GetNumSegmZone() ); fprintf( File, "Nmodule %d\n", NbModules ); - fprintf( File, "Nnets %d\n", m_Pcb->m_Equipots.GetCount() ); + fprintf( File, "Nnets %d\n", GetBoard()->m_Equipots.GetCount() ); fprintf( File, "$EndGENERAL\n\n" ); return TRUE; @@ -770,7 +770,7 @@ int WinEDA_PcbFrame::ReadPcbFile( FILE* File, bool Append ) SetLocaleTo_C_standard( ); NbDraw = NbTrack = NbZone = NbMod = NbNets = -1; - m_Pcb->m_Status_Pcb = 0; + GetBoard()->m_Status_Pcb = 0; while( GetLine( File, Line, &LineNum ) != NULL ) { @@ -806,62 +806,62 @@ int WinEDA_PcbFrame::ReadPcbFile( FILE* File, bool Append ) if( strnicmp( Line, "$EQUIPOT", 7 ) == 0 ) { - EQUIPOT* Equipot = new EQUIPOT( m_Pcb ); - m_Pcb->m_Equipots.PushBack( Equipot ); + EQUIPOT* Equipot = new EQUIPOT( GetBoard() ); + GetBoard()->m_Equipots.PushBack( Equipot ); Equipot->ReadDescr( File, &LineNum ); continue; } if( strnicmp( Line, "$CZONE_OUTLINE", 7 ) == 0 ) { - ZONE_CONTAINER * zone_descr = new ZONE_CONTAINER(m_Pcb); + ZONE_CONTAINER * zone_descr = new ZONE_CONTAINER(GetBoard()); zone_descr->ReadDescr( File, &LineNum ); if ( zone_descr->GetNumCorners( ) > 2 ) // should not occur - m_Pcb->Add(zone_descr); + GetBoard()->Add(zone_descr); else delete zone_descr; continue; } if( strnicmp( Line, "$MODULE", 7 ) == 0 ) { - MODULE* Module = new MODULE( m_Pcb ); + MODULE* Module = new MODULE( GetBoard() ); if( Module == NULL ) continue; - m_Pcb->Add( Module, ADD_APPEND ); + GetBoard()->Add( Module, ADD_APPEND ); Module->ReadDescr( File, &LineNum ); continue; } if( strnicmp( Line, "$TEXTPCB", 8 ) == 0 ) { - TEXTE_PCB* pcbtxt = new TEXTE_PCB( m_Pcb ); - m_Pcb->Add( pcbtxt, ADD_APPEND ); + TEXTE_PCB* pcbtxt = new TEXTE_PCB( GetBoard() ); + GetBoard()->Add( pcbtxt, ADD_APPEND ); pcbtxt->ReadTextePcbDescr( File, &LineNum ); continue; } if( strnicmp( Line, "$DRAWSEGMENT", 10 ) == 0 ) { - DRAWSEGMENT* DrawSegm = new DRAWSEGMENT( m_Pcb ); - m_Pcb->Add( DrawSegm, ADD_APPEND ); + DRAWSEGMENT* DrawSegm = new DRAWSEGMENT( GetBoard() ); + GetBoard()->Add( DrawSegm, ADD_APPEND ); DrawSegm->ReadDrawSegmentDescr( File, &LineNum ); continue; } if( strnicmp( Line, "$COTATION", 9 ) == 0 ) { - COTATION* Cotation = new COTATION( m_Pcb ); - m_Pcb->Add( Cotation, ADD_APPEND ); + COTATION* Cotation = new COTATION( GetBoard() ); + GetBoard()->Add( Cotation, ADD_APPEND ); Cotation->ReadCotationDescr( File, &LineNum ); continue; } if( strnicmp( Line, "$MIREPCB", 8 ) == 0 ) { - MIREPCB* Mire = new MIREPCB( m_Pcb ); - m_Pcb->Add( Mire, ADD_APPEND ); + MIREPCB* Mire = new MIREPCB( GetBoard() ); + GetBoard()->Add( Mire, ADD_APPEND ); Mire->ReadMirePcbDescr( File, &LineNum ); continue; } @@ -869,10 +869,9 @@ int WinEDA_PcbFrame::ReadPcbFile( FILE* File, bool Append ) if( strnicmp( Line, "$TRACK", 6 ) == 0 ) { #ifdef PCBNEW - TRACK* insertBeforeMe = Append ? NULL : m_Pcb->m_Track.GetFirst(); + TRACK* insertBeforeMe = Append ? NULL : GetBoard()->m_Track.GetFirst(); ReadListeSegmentDescr( File, insertBeforeMe, TYPE_TRACK, &LineNum, NbTrack ); - D( m_Pcb->m_Track.VerifyListIntegrity(); ) #endif continue; } @@ -880,11 +879,10 @@ int WinEDA_PcbFrame::ReadPcbFile( FILE* File, bool Append ) if( strnicmp( Line, "$ZONE", 5 ) == 0 ) { #ifdef PCBNEW - SEGZONE* insertBeforeMe = Append ? NULL : m_Pcb->m_Zone.GetFirst(); + SEGZONE* insertBeforeMe = Append ? NULL : GetBoard()->m_Zone.GetFirst(); ReadListeSegmentDescr( File, insertBeforeMe, TYPE_ZONE, &LineNum, NbZone ); - D( m_Pcb->m_Zone.VerifyListIntegrity(); ) #endif continue; } @@ -918,7 +916,7 @@ int WinEDA_PcbFrame::SavePcbFormatAscii( FILE* aFile ) bool rc; char line[256]; - m_Pcb->m_Status_Pcb &= ~CONNEXION_OK; + GetBoard()->m_Status_Pcb &= ~CONNEXION_OK; wxBeginBusyCursor(); @@ -931,9 +929,9 @@ int WinEDA_PcbFrame::SavePcbFormatAscii( FILE* aFile ) WriteGeneralDescrPcb( aFile ); WriteSheetDescr( GetScreen(), aFile ); - WriteSetup( aFile, this, m_Pcb ); + WriteSetup( aFile, this, GetBoard() ); - rc = m_Pcb->Save( aFile ); + rc = GetBoard()->Save( aFile ); SetLocaleTo_Default( ); // revert to the current locale wxEndBusyCursor(); diff --git a/pcbnew/librairi.cpp b/pcbnew/librairi.cpp index 6fe66ddd32..854bd626a8 100644 --- a/pcbnew/librairi.cpp +++ b/pcbnew/librairi.cpp @@ -108,7 +108,7 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC ) } } - module = new MODULE( m_Pcb ); + module = new MODULE( GetBoard() ); if ( Footprint_Is_GPCB_Format ) { @@ -122,12 +122,12 @@ MODULE* WinEDA_ModuleEditFrame::Import_Module( wxDC* DC ) } /* Insert footprint in list*/ - m_Pcb->Add( module ); + GetBoard()->Add( module ); /* Display info : */ module->Display_Infos( this ); Place_Module( module, DC ); - m_Pcb->m_Status_Pcb = 0; + GetBoard()->m_Status_Pcb = 0; build_liste_pads(); return module; @@ -210,7 +210,7 @@ void WinEDA_ModuleEditFrame::Export_Module( MODULE* ptmod, bool createlib ) fprintf( dest, "%s\n", CONV_TO_UTF8( ptmod->m_LibRef ) ); fputs( "$EndINDEX\n", dest ); - m_Pcb->m_Modules->Save( dest ); + GetBoard()->m_Modules->Save( dest ); fputs( "$EndLIBRARY\n", dest ); fclose( dest ); @@ -404,7 +404,7 @@ void WinEDA_BasePcbFrame::Archive_Modules( const wxString& LibName, MODULE* Module; wxString FullFileName = LibName; - if( m_Pcb->m_Modules == NULL ) + if( GetBoard()->m_Modules == NULL ) { DisplayInfo( this, _( " No modules to archive!" ) ); return; @@ -457,14 +457,14 @@ void WinEDA_BasePcbFrame::Archive_Modules( const wxString& LibName, } /* Calcul du nombre de modules */ - Module = (MODULE*) m_Pcb->m_Modules; + Module = (MODULE*) GetBoard()->m_Modules; for( ; Module != NULL; Module = (MODULE*) Module->Next() ) NbModules++; Pas = (float) 100 / NbModules; DisplayActivity( 0, wxEmptyString ); - Module = (MODULE*) m_Pcb->m_Modules; + Module = (MODULE*) GetBoard()->m_Modules; for( ii = 1; Module != NULL; ii++, Module = (MODULE*) Module->Next() ) { if( Save_1_Module( FullFileName, Module, @@ -725,9 +725,9 @@ MODULE* WinEDA_BasePcbFrame::Create_1_Module( wxDC* DC, const wxString& module_n Line.Trim( FALSE ); // Creates the new module and add it to the head of the linked list of modules - Module = new MODULE( m_Pcb ); + Module = new MODULE( GetBoard() ); - m_Pcb->Add( Module ); + GetBoard()->Add( Module ); /* Update parameters: position, timestamp ... */ newpos = GetScreen()->m_Curseur; diff --git a/pcbnew/loadcmp.cpp b/pcbnew/loadcmp.cpp index 10cf1fe8ed..8ed7677c7e 100644 --- a/pcbnew/loadcmp.cpp +++ b/pcbnew/loadcmp.cpp @@ -47,10 +47,10 @@ void WinEDA_ModuleEditFrame::Load_Module_Module_From_BOARD( MODULE* Module ) if( Module == NULL ) { - if( parent->m_Pcb == NULL || parent->m_Pcb->m_Modules == NULL ) + if( parent->GetBoard() == NULL || parent->GetBoard()->m_Modules == NULL ) return; - Module = Select_1_Module_From_BOARD( parent->m_Pcb ); + Module = Select_1_Module_From_BOARD( parent->GetBoard() ); } if( Module == NULL ) @@ -60,14 +60,14 @@ void WinEDA_ModuleEditFrame::Load_Module_Module_From_BOARD( MODULE* Module ) Clear_Pcb( TRUE ); - m_Pcb->m_Status_Pcb = 0; - NewModule = new MODULE( m_Pcb ); + GetBoard()->m_Status_Pcb = 0; + NewModule = new MODULE( GetBoard() ); NewModule->Copy( Module ); NewModule->m_Link = Module->m_TimeStamp; Module = NewModule; - m_Pcb->Add( Module ); + GetBoard()->Add( Module ); Module->m_Flags = 0; @@ -76,7 +76,7 @@ void WinEDA_ModuleEditFrame::Load_Module_Module_From_BOARD( MODULE* Module ) GetScreen()->m_Curseur.x = GetScreen()->m_Curseur.y = 0; Place_Module( Module, NULL ); if( Module->GetLayer() != CMP_N ) - m_Pcb->Change_Side_Module( Module, NULL ); + GetBoard()->Change_Side_Module( Module, NULL ); Rotate_Module( NULL, Module, 0, FALSE ); GetScreen()->ClrModify(); Zoom_Automatique( TRUE ); @@ -154,7 +154,7 @@ MODULE* WinEDA_BasePcbFrame::Load_Module_From_Library( const wxString& library, module->m_Flags = IS_NEW; module->m_Link = 0; module->m_TimeStamp = GetTimeStamp(); - m_Pcb->m_Status_Pcb = 0; + GetBoard()->m_Status_Pcb = 0; module->SetPosition( curspos ); build_liste_pads(); @@ -254,14 +254,14 @@ MODULE* WinEDA_BasePcbFrame::Get_Librairie_Module( wxWindow* winaff, Name = CONV_FROM_UTF8( Line + 8 ); if( Name.CmpNoCase( ComponentName ) == 0 ) /* composant localise */ { - NewModule = new MODULE( m_Pcb ); + NewModule = new MODULE( GetBoard() ); // Switch the locale to standard C (needed to print floating point numbers like 1.3) SetLocaleTo_C_standard( ); NewModule->ReadDescr( lib_module, &LineNum ); SetLocaleTo_Default( ); // revert to the current locale - m_Pcb->Add( NewModule, ADD_APPEND ); + GetBoard()->Add( NewModule, ADD_APPEND ); fclose( lib_module ); Affiche_Message( wxEmptyString ); return NewModule; diff --git a/pcbnew/mirepcb.cpp b/pcbnew/mirepcb.cpp index f662625776..22f9bfa43f 100644 --- a/pcbnew/mirepcb.cpp +++ b/pcbnew/mirepcb.cpp @@ -206,9 +206,9 @@ MIREPCB* WinEDA_PcbFrame::Create_Mire( wxDC* DC ) /* Routine de creation d'un Draw Symbole Pcb type MIRE */ { - MIREPCB* MirePcb = new MIREPCB( m_Pcb ); + MIREPCB* MirePcb = new MIREPCB( GetBoard() ); - m_Pcb->Add( MirePcb ); + GetBoard()->Add( MirePcb ); MirePcb->SetLayer( EDGE_N ); MirePcb->m_Width = g_DesignSettings.m_EdgeSegmentWidth; diff --git a/pcbnew/modedit.cpp b/pcbnew/modedit.cpp index c7b7ba2829..56f041bdc4 100644 --- a/pcbnew/modedit.cpp +++ b/pcbnew/modedit.cpp @@ -25,7 +25,7 @@ BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode ) { BOARD_ITEM* item = GetCurItem(); - if( m_Pcb->m_Modules == NULL ) + if( GetBoard()->m_Modules == NULL ) return NULL; GENERAL_COLLECTORS_GUIDE guide = GetCollectorsGuide(); @@ -45,7 +45,7 @@ BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode ) scanList = GENERAL_COLLECTOR::ModulesAndTheirItems; } - m_Collector->Collect( m_Pcb, scanList, GetScreen()->RefPos( true ), guide ); + m_Collector->Collect( GetBoard(), scanList, GetScreen()->RefPos( true ), guide ); /* Remove redundancies: when an item is found, we can remove the * module from list @@ -92,7 +92,7 @@ BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode ) item = (*m_Collector)[ii]; - text = item->MenuText( m_Pcb ); + text = item->MenuText( GetBoard() ); xpm = item->MenuIcon(); ADD_MENUITEM( &itemMenu, ID_POPUP_PCB_ITEM_SELECTION_START + ii, text, xpm ); @@ -218,8 +218,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) if ( module ) // i.e. if create module command not aborted { module->SetPosition( wxPoint(0, 0) ); - if( m_Pcb->m_Modules ) - m_Pcb->m_Modules->m_Flags = 0; + if( GetBoard()->m_Modules ) + GetBoard()->m_Modules->m_Flags = 0; Zoom_Automatique( TRUE ); } } @@ -229,7 +229,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) { wxString Line; Line = MakeFileName( g_RealLibDirBuffer, m_CurrentLib.GetData(), LibExtBuffer ); - Save_1_Module( Line, m_Pcb->m_Modules, TRUE, TRUE ); + Save_1_Module( Line, GetBoard()->m_Modules, TRUE, TRUE ); GetScreen()->ClrModify(); } break; @@ -248,9 +248,9 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) // update module in the current board, // not just add it to the board with total disregard for the netlist... WinEDA_PcbFrame* pcbframe = (WinEDA_PcbFrame*) GetParent(); - BOARD* mainpcb = pcbframe->m_Pcb; + BOARD* mainpcb = pcbframe->GetBoard(); MODULE* source_module = NULL; - MODULE* module_in_edit = m_Pcb->m_Modules; + MODULE* module_in_edit = GetBoard()->m_Modules; // Search the old module (source) if exists // Because this source could be deleted when editing the main board... @@ -318,8 +318,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) Clear_Pcb( TRUE ); GetScreen()->m_Curseur = wxPoint( 0, 0 ); Import_Module( &dc ); - if( m_Pcb->m_Modules ) - m_Pcb->m_Modules->m_Flags = 0; + if( GetBoard()->m_Modules ) + GetBoard()->m_Modules->m_Flags = 0; GetScreen()->ClrModify(); Zoom_Automatique( TRUE ); if( m_Draw3DFrame ) @@ -327,13 +327,13 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) break; case ID_LIBEDIT_EXPORT_PART: - if( m_Pcb->m_Modules ) - Export_Module( m_Pcb->m_Modules, FALSE ); + if( GetBoard()->m_Modules ) + Export_Module( GetBoard()->m_Modules, FALSE ); break; case ID_LIBEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART: - if( m_Pcb->m_Modules ) - Export_Module( m_Pcb->m_Modules, TRUE ); + if( GetBoard()->m_Modules ) + Export_Module( GetBoard()->m_Modules, TRUE ); break; case ID_MODEDIT_SHEET_SET: @@ -345,15 +345,15 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) Clear_Pcb( TRUE ); GetScreen()->m_Curseur = wxPoint( 0, 0 ); Load_Module_From_Library( m_CurrentLib, &dc ); - if( m_Pcb->m_Modules ) - m_Pcb->m_Modules->m_Flags = 0; + if( GetBoard()->m_Modules ) + GetBoard()->m_Modules->m_Flags = 0; //if either m_Reference or m_Value are gone, reinstate them - //otherwise it becomes hard to see what you are working with in the layout! - if( m_Pcb && m_Pcb->m_Modules ) + if( GetBoard() && GetBoard()->m_Modules ) { - TEXTE_MODULE* ref = m_Pcb->m_Modules->m_Reference; - TEXTE_MODULE* val = m_Pcb->m_Modules->m_Value; + TEXTE_MODULE* ref = GetBoard()->m_Modules->m_Reference; + TEXTE_MODULE* val = GetBoard()->m_Modules->m_Value; if( val && ref ) { ref->m_Type = TEXT_is_REFERENCE; // just in case ... @@ -378,9 +378,9 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) break; case ID_MODEDIT_EDIT_MODULE_PROPERTIES: - if( m_Pcb->m_Modules ) + if( GetBoard()->m_Modules ) { - SetCurItem( m_Pcb->m_Modules ); + SetCurItem( GetBoard()->m_Modules ); InstallModuleOptionsFrame( (MODULE*) GetScreen()->GetCurItem(), &dc, pos ); GetScreen()->GetCurItem()->m_Flags = 0; @@ -388,7 +388,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) break; case ID_MODEDIT_ADD_PAD: - if( m_Pcb->m_Modules ) + if( GetBoard()->m_Modules ) SetToolID( id, wxCURSOR_PENCIL, _( "Add Pad" ) ); else { @@ -452,20 +452,20 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_PCB_DELETE_PAD: - SaveCopyInUndoList( m_Pcb->m_Modules ); + SaveCopyInUndoList( GetBoard()->m_Modules ); DeletePad( (D_PAD*) GetScreen()->GetCurItem(), &dc ); SetCurItem( NULL ); DrawPanel->MouseToCursorSchema(); break; case ID_POPUP_PCB_IMPORT_PAD_SETTINGS: - SaveCopyInUndoList( m_Pcb->m_Modules ); + SaveCopyInUndoList( GetBoard()->m_Modules ); DrawPanel->MouseToCursorSchema(); Import_Pad_Settings( (D_PAD*) GetScreen()->GetCurItem(), true ); break; case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS: - SaveCopyInUndoList( m_Pcb->m_Modules ); + SaveCopyInUndoList( GetBoard()->m_Modules ); Global_Import_Pad_Settings( (D_PAD*) GetScreen()->GetCurItem(), true ); DrawPanel->MouseToCursorSchema(); break; @@ -494,7 +494,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_PCB_DELETE_TEXTMODULE: - SaveCopyInUndoList( m_Pcb->m_Modules ); + SaveCopyInUndoList( GetBoard()->m_Modules ); DeleteTextModule( (TEXTE_MODULE*) GetScreen()->GetCurItem(), &dc ); SetCurItem( NULL ); @@ -550,7 +550,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_PCB_DELETE_EDGE: - SaveCopyInUndoList( m_Pcb->m_Modules ); + SaveCopyInUndoList( GetBoard()->m_Modules ); DrawPanel->MouseToCursorSchema(); RemoveStruct( GetScreen()->GetCurItem(), &dc ); SetCurItem( NULL ); @@ -561,7 +561,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) case ID_MODEDIT_MODULE_SCALE: case ID_MODEDIT_MODULE_SCALEX: case ID_MODEDIT_MODULE_SCALEY: - SaveCopyInUndoList( m_Pcb->m_Modules ); + SaveCopyInUndoList( GetBoard()->m_Modules ); Transform( (MODULE*) GetScreen()->GetCurItem(), &dc, id ); break; diff --git a/pcbnew/modedit_onclick.cpp b/pcbnew/modedit_onclick.cpp index e192de9226..b41ee92d2d 100644 --- a/pcbnew/modedit_onclick.cpp +++ b/pcbnew/modedit_onclick.cpp @@ -32,12 +32,12 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) switch( DrawStruct->Type() ) { case TYPE_TEXTE_MODULE: - SaveCopyInUndoList( m_Pcb->m_Modules ); + SaveCopyInUndoList( GetBoard()->m_Modules ); PlaceTexteModule( (TEXTE_MODULE*) DrawStruct, DC ); break; case TYPE_EDGE_MODULE: - SaveCopyInUndoList( m_Pcb->m_Modules ); + SaveCopyInUndoList( GetBoard()->m_Modules ); Place_EdgeMod( (EDGE_MODULE*) DrawStruct, DC ); break; @@ -119,7 +119,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) DrawStruct = ModeditLocateAndDisplay(); if( DrawStruct && (DrawStruct->m_Flags == 0) ) { - SaveCopyInUndoList( m_Pcb->m_Modules ); + SaveCopyInUndoList( GetBoard()->m_Modules ); RemoveStruct( DrawStruct, DC ); SetCurItem( DrawStruct = NULL ); } @@ -127,27 +127,27 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) break; case ID_MODEDIT_PLACE_ANCHOR: - SaveCopyInUndoList( m_Pcb->m_Modules ); - Place_Ancre( m_Pcb->m_Modules, DC ); - m_Pcb->m_Modules->m_Flags = 0; + SaveCopyInUndoList( GetBoard()->m_Modules ); + Place_Ancre( GetBoard()->m_Modules, DC ); + GetBoard()->m_Modules->m_Flags = 0; GetScreen()->m_Curseur = wxPoint( 0, 0 ); Recadre_Trace( TRUE ); - Place_Module( m_Pcb->m_Modules, DC ); + Place_Module( GetBoard()->m_Modules, DC ); RedrawActiveWindow( DC, TRUE ); SetToolID( 0, wxCURSOR_ARROW, wxEmptyString ); SetCurItem( NULL ); break; case ID_TEXT_COMMENT_BUTT: - SaveCopyInUndoList( m_Pcb->m_Modules ); - CreateTextModule( m_Pcb->m_Modules, DC ); + SaveCopyInUndoList( GetBoard()->m_Modules ); + CreateTextModule( GetBoard()->m_Modules, DC ); break; case ID_MODEDIT_ADD_PAD: - if( m_Pcb->m_Modules ) + if( GetBoard()->m_Modules ) { - SaveCopyInUndoList( m_Pcb->m_Modules ); - AddPad( m_Pcb->m_Modules, true ); + SaveCopyInUndoList( GetBoard()->m_Modules ); + AddPad( GetBoard()->m_Modules, true ); } break; diff --git a/pcbnew/modedit_undo_redo.cpp b/pcbnew/modedit_undo_redo.cpp index 2f19578542..5a65cb4a60 100644 --- a/pcbnew/modedit_undo_redo.cpp +++ b/pcbnew/modedit_undo_redo.cpp @@ -20,9 +20,9 @@ void WinEDA_ModuleEditFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, EDA_BaseStruct* item; MODULE* CopyItem; - CopyItem = new MODULE( m_Pcb ); + CopyItem = new MODULE( GetBoard() ); CopyItem->Copy( (MODULE*) ItemToCopy ); - CopyItem->SetParent( m_Pcb ); + CopyItem->SetParent( GetBoard() ); GetScreen()->AddItemToUndoList( (EDA_BaseStruct*) CopyItem ); /* Clear current flags (which can be temporary set by a current edit command) */ @@ -51,9 +51,9 @@ void WinEDA_ModuleEditFrame::GetComponentFromRedoList() if( GetScreen()->m_RedoList == NULL ) return; - GetScreen()->AddItemToUndoList( m_Pcb->m_Modules.PopFront() ); + GetScreen()->AddItemToUndoList( GetBoard()->m_Modules.PopFront() ); - m_Pcb->Add( (MODULE*) GetScreen()->GetItemFromRedoList() ); + GetBoard()->Add( (MODULE*) GetScreen()->GetItemFromRedoList() ); SetCurItem( NULL );; GetScreen()->SetModify(); @@ -74,15 +74,15 @@ void WinEDA_ModuleEditFrame::GetComponentFromUndoList() if( GetScreen()->m_UndoList == NULL ) return; - GetScreen()->AddItemToRedoList( m_Pcb->m_Modules.PopFront() ); + GetScreen()->AddItemToRedoList( GetBoard()->m_Modules.PopFront() ); MODULE* module = (MODULE*) GetScreen()->GetItemFromUndoList(); if( module ) - m_Pcb->Add( module, ADD_APPEND ); + GetBoard()->Add( module, ADD_APPEND ); /* Add() calls PushBack(), no need for this - if( m_Pcb->m_Modules ) - m_Pcb->m_Modules->SetNext( NULL ); + if( GetBoard()->m_Modules ) + GetBoard()->m_Modules->SetNext( NULL ); */ GetScreen()->SetModify(); diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index 30d59cb733..74fa7ab2e4 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -176,9 +176,10 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father, if( g_ModuleEditor_Pcb == NULL ) g_ModuleEditor_Pcb = new BOARD( NULL, this ); - m_Pcb = g_ModuleEditor_Pcb; + SetBoard( g_ModuleEditor_Pcb ); + + GetBoard()->m_PcbFrame = this; - m_Pcb->m_PcbFrame = this; SetBaseScreen( ScreenModule ); GetScreen()->SetCurItem( NULL ); GetSettings(); @@ -260,7 +261,7 @@ void WinEDA_ModuleEditFrame::SetToolbars() m_HToolBar->EnableTool( ID_MODEDIT_SAVE_LIBMODULE, islib ); m_HToolBar->EnableTool( ID_LIBEDIT_DELETE_PART, islib ); - if( m_Pcb->m_Modules == NULL ) + if( GetBoard()->m_Modules == NULL ) active = FALSE; else active = TRUE; @@ -269,10 +270,10 @@ void WinEDA_ModuleEditFrame::SetToolbars() m_HToolBar->EnableTool( ID_LIBEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, active ); m_HToolBar->EnableTool( ID_MODEDIT_SAVE_LIBMODULE, active && islib ); - MODULE* module_in_edit = m_Pcb->m_Modules; + MODULE* module_in_edit = GetBoard()->m_Modules; if( module_in_edit && module_in_edit->m_Link ) // this is not a new module ... { - BOARD* mainpcb = frame->m_Pcb; + BOARD* mainpcb = frame->GetBoard(); MODULE* source_module = mainpcb->m_Modules; // search if the source module was not deleted: @@ -305,7 +306,7 @@ void WinEDA_ModuleEditFrame::SetToolbars() m_HToolBar->EnableTool( ID_MODEDIT_REDO, GetScreen()->m_RedoList && active ); } - if( frame->m_Pcb->m_Modules ) + if( frame->GetBoard()->m_Modules ) { m_HToolBar->EnableTool( ID_MODEDIT_LOAD_MODULE_FROM_BOARD, TRUE ); } diff --git a/pcbnew/modules.cpp b/pcbnew/modules.cpp index e34c339ea5..dccf6a89ca 100644 --- a/pcbnew/modules.cpp +++ b/pcbnew/modules.cpp @@ -81,7 +81,7 @@ MODULE* WinEDA_BasePcbFrame::GetModuleByName() Get_Message( _( "Name:" ), _("Search footprint"), modulename, this ); if( !modulename.IsEmpty() ) { - module = m_Pcb->m_Modules; + module = GetBoard()->m_Modules; while( module ) { if( module->m_Reference->m_Text.CmpNoCase( modulename ) == 0 ) @@ -101,7 +101,7 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC ) return; SetCurItem( module ); - m_Pcb->m_Status_Pcb &= ~CHEVELU_LOCAL_OK; + GetBoard()->m_Status_Pcb &= ~CHEVELU_LOCAL_OK; module->m_Flags |= IS_MOVED; ModuleInitOrient = module->m_Orient; ModuleInitLayer = module->GetLayer(); @@ -120,7 +120,7 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC ) Build_Drag_Liste( DrawPanel, DC, module ); } - m_Pcb->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST; + GetBoard()->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST; DrawPanel->ManageCurseur = Montre_Position_Empreinte; DrawPanel->ForceCloseManageCurseur = Abort_MoveOrCopyModule; DrawPanel->m_AutoPAN_Request = TRUE; @@ -152,7 +152,7 @@ void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC ) WinEDA_BasePcbFrame* pcbframe = (WinEDA_BasePcbFrame*) Panel->m_Parent; module = (MODULE*) pcbframe->GetScreen()->GetCurItem(); - pcbframe->m_Pcb->m_Status_Pcb &= ~CHEVELU_LOCAL_OK; + pcbframe->GetBoard()->m_Status_Pcb &= ~CHEVELU_LOCAL_OK; if( module ) { @@ -192,7 +192,7 @@ void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC ) { module->DeleteStructure(); module = NULL; - pcbframe->m_Pcb->m_Status_Pcb = 0; + pcbframe->GetBoard()->m_Status_Pcb = 0; pcbframe->build_liste_pads(); } } @@ -203,7 +203,7 @@ void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC ) if( ModuleInitOrient != module->m_Orient ) pcbframe->Rotate_Module( NULL, module, ModuleInitOrient, FALSE ); if( ModuleInitLayer != module->GetLayer() ) - pcbframe->m_Pcb->Change_Side_Module( module, NULL ); + pcbframe->GetBoard()->Change_Side_Module( module, NULL ); module->Draw( Panel, DC, GR_OR ); } g_Drag_Pistes_On = FALSE; @@ -211,7 +211,7 @@ void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC ) Panel->ForceCloseManageCurseur = NULL; pcbframe->SetCurItem( NULL ); - pcbframe->m_Pcb->m_Status_Pcb &= ~DO_NOT_SHOW_GENERAL_RASTNEST; // Display ratsnest is allowed + pcbframe->GetBoard()->m_Status_Pcb &= ~DO_NOT_SHOW_GENERAL_RASTNEST; // Display ratsnest is allowed if( g_Show_Ratsnest ) pcbframe->DrawGeneralRatsnest( DC ); } @@ -236,22 +236,22 @@ MODULE* WinEDA_BasePcbFrame::Copie_Module( MODULE* module ) GetScreen()->SetModify(); /* Duplication du module */ - m_Pcb->m_Status_Pcb = 0; - newmodule = new MODULE( m_Pcb ); + GetBoard()->m_Status_Pcb = 0; + newmodule = new MODULE( GetBoard() ); newmodule->Copy( module ); /* no, Add() below does this - newmodule->SetParent( m_Pcb ); + newmodule->SetParent( GetBoard() ); */ - m_Pcb->Add( newmodule, ADD_APPEND ); + GetBoard()->Add( newmodule, ADD_APPEND ); newmodule->m_Flags = IS_NEW; build_liste_pads(); newmodule->Display_Infos( this ); - m_Pcb->m_Status_Pcb &= ~CHEVELU_LOCAL_OK; + GetBoard()->m_Status_Pcb &= ~CHEVELU_LOCAL_OK; return newmodule; } @@ -326,7 +326,7 @@ bool WinEDA_PcbFrame::Delete_Module( MODULE* module, wxDC* DC, bool aAskBeforeDe /* Sauvegarde en buffer des undelete */ SaveItemEfface( module, 1 ); - m_Pcb->m_Status_Pcb = 0; + GetBoard()->m_Status_Pcb = 0; build_liste_pads(); ReCompile_Ratsnest_After_Changes( DC ); @@ -667,9 +667,9 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module, wxDC* DC ) return; GetScreen()->SetModify(); - m_Pcb->m_Status_Pcb &= ~( LISTE_CHEVELU_OK | CONNEXION_OK); + GetBoard()->m_Status_Pcb &= ~( LISTE_CHEVELU_OK | CONNEXION_OK); - if( g_Show_Module_Ratsnest && (m_Pcb->m_Status_Pcb & LISTE_PAD_OK) && DC ) + if( g_Show_Module_Ratsnest && (GetBoard()->m_Status_Pcb & LISTE_PAD_OK) && DC ) trace_ratsnest_module( DC ); newpos = GetScreen()->m_Curseur; @@ -748,7 +748,7 @@ void WinEDA_BasePcbFrame::Rotate_Module( wxDC* DC, MODULE* module, } } - m_Pcb->m_Status_Pcb &= ~(LISTE_CHEVELU_OK | CONNEXION_OK); + GetBoard()->m_Status_Pcb &= ~(LISTE_CHEVELU_OK | CONNEXION_OK); if( incremental ) module->SetOrientation( module->m_Orient + angle ); diff --git a/pcbnew/move_or_drag_track.cpp b/pcbnew/move_or_drag_track.cpp index 0f31e49a7d..318f325b2d 100644 --- a/pcbnew/move_or_drag_track.cpp +++ b/pcbnew/move_or_drag_track.cpp @@ -715,7 +715,7 @@ bool WinEDA_PcbFrame::MergeCollinearTracks( TRACK* track, wxDC* DC, int end ) { TRACK* testtrack = NULL; - testtrack = (TRACK*) Locate_Piste_Connectee( track, m_Pcb->m_Track, NULL, end ); + testtrack = (TRACK*) Locate_Piste_Connectee( track, GetBoard()->m_Track, NULL, end ); if( testtrack ) { SortTrackEndPoints(track); @@ -767,25 +767,25 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC s_StartSegmentPresent = s_EndSegmentPresent = TRUE; if( (track->start == NULL) || (track->start->Type() == TYPE_TRACK) ) - TrackToStartPoint = (TRACK*) Locate_Piste_Connectee( track, m_Pcb->m_Track, NULL, START ); + TrackToStartPoint = (TRACK*) Locate_Piste_Connectee( track, GetBoard()->m_Track, NULL, START ); // Test if more than one segment is connected to this point if( TrackToStartPoint ) { TrackToStartPoint->SetState( BUSY, ON ); - if( Locate_Piste_Connectee( track, m_Pcb->m_Track, NULL, START ) ) + if( Locate_Piste_Connectee( track, GetBoard()->m_Track, NULL, START ) ) error = TRUE; TrackToStartPoint->SetState( BUSY, OFF ); } if( (track->end == NULL) || (track->end->Type() == TYPE_TRACK) ) - TrackToEndPoint = (TRACK*) Locate_Piste_Connectee( track, m_Pcb->m_Track, NULL, END ); + TrackToEndPoint = (TRACK*) Locate_Piste_Connectee( track, GetBoard()->m_Track, NULL, END ); // Test if more than one segment is connected to this point if( TrackToEndPoint ) { TrackToEndPoint->SetState( BUSY, ON ); - if( Locate_Piste_Connectee( track, m_Pcb->m_Track, NULL, END ) ) + if( Locate_Piste_Connectee( track, GetBoard()->m_Track, NULL, END ) ) error = TRUE; TrackToEndPoint->SetState( BUSY, OFF ); } @@ -870,14 +870,14 @@ bool WinEDA_PcbFrame::PlaceDraggedTrackSegment( TRACK* Track, wxDC* DC ) // DRC control: if( Drc_On ) { - errdrc = m_drc->Drc( Track, m_Pcb->m_Track ); + errdrc = m_drc->Drc( Track, GetBoard()->m_Track ); if( errdrc == BAD_DRC ) return FALSE; /* Redraw the dragged segments */ pt_drag = g_DragSegmentList; for( ; pt_drag != NULL; pt_drag = pt_drag->Pnext ) { - errdrc = m_drc->Drc( pt_drag->m_Segm, m_Pcb->m_Track ); + errdrc = m_drc->Drc( pt_drag->m_Segm, GetBoard()->m_Track ); if( errdrc == BAD_DRC ) return FALSE; } @@ -902,8 +902,8 @@ bool WinEDA_PcbFrame::PlaceDraggedTrackSegment( TRACK* Track, wxDC* DC ) /* Test the connections modified by the move * (only pad connection must be tested, track connection will be tested by test_1_net_connexion() ) */ int masque_layer = g_TabOneLayerMask[Track->GetLayer()]; - Track->start = Fast_Locate_Pad_Connecte( m_Pcb, Track->m_Start, masque_layer ); - Track->end = Fast_Locate_Pad_Connecte( m_Pcb, Track->m_End, masque_layer ); + Track->start = Fast_Locate_Pad_Connecte( GetBoard(), Track->m_Start, masque_layer ); + Track->end = Fast_Locate_Pad_Connecte( GetBoard(), Track->m_End, masque_layer ); } EraseDragListe(); diff --git a/pcbnew/muonde.cpp b/pcbnew/muonde.cpp index 39dd2e7dda..cd9d238ced 100644 --- a/pcbnew/muonde.cpp +++ b/pcbnew/muonde.cpp @@ -258,7 +258,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( int shape_type ) } Module->Set_Rectangle_Encadrement(); - m_Pcb->m_Status_Pcb = 0; + GetBoard()->m_Status_Pcb = 0; GetScreen()->SetModify(); return Module; } @@ -612,7 +612,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWavePolygonShape( ) PolyEdges = NULL; Module->Set_Rectangle_Encadrement(); - m_Pcb->m_Status_Pcb = 0; + GetBoard()->m_Status_Pcb = 0; GetScreen()->SetModify(); return Module; } diff --git a/pcbnew/netlist.cpp b/pcbnew/netlist.cpp index d02eea318a..b3f5ea3628 100644 --- a/pcbnew/netlist.cpp +++ b/pcbnew/netlist.cpp @@ -188,7 +188,7 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame, aMessageWindow->AppendText( msg ); aFrame->GetScreen()->SetModify(); - aFrame->m_Pcb->m_Status_Pcb = 0; State = 0; LineNum = 0; Comment = 0; + aFrame->GetBoard()->m_Status_Pcb = 0; State = 0; LineNum = 0; Comment = 0; s_NbNewModules = 0; wxBusyCursor dummy; // Shows an hourglass while calculating @@ -323,7 +323,7 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame, if( NbModulesNetListe ) { MODULE * NextModule; - Module = aFrame->m_Pcb->m_Modules; + Module = aFrame->GetBoard()->m_Modules; bool ask_for_confirmation = true; for( ; Module != NULL; Module = NextModule ) { @@ -357,7 +357,7 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame, /* Rebuild the connectivity */ aFrame->Compile_Ratsnest( NULL, TRUE ); - if( aFrame->m_Pcb->m_Track ) + if( aFrame->GetBoard()->m_Track ) { if( aDeleteBadTracks ) // Remove erroneous tracks { @@ -367,7 +367,7 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame, } aFrame->DrawPanel->Refresh(); - aFrame->m_Pcb->Display_Infos( aFrame ); + aFrame->GetBoard()->Display_Infos( aFrame ); } @@ -442,7 +442,7 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame, LocalTimeStamp.ToULong( &TimeStamp, 16 ); /* Tst si composant deja charge */ - Module = aFrame->m_Pcb->m_Modules; + Module = aFrame->GetBoard()->m_Modules; MODULE* NextModule; for( Found = FALSE; Module != NULL; Module = NextModule ) { @@ -631,18 +631,18 @@ MODULE* WinEDA_PcbFrame::ListAndSelectModuleName( void ) WinEDAListBox* ListBox; const wxChar** ListNames = NULL; - if( m_Pcb->m_Modules == NULL ) + if( GetBoard()->m_Modules == NULL ) { DisplayError( this, _( "No Modules" ) ); return 0; } /* Calcul du nombre des modules */ - nb_empr = 0; Module = (MODULE*) m_Pcb->m_Modules; + nb_empr = 0; Module = (MODULE*) GetBoard()->m_Modules; for( ; Module != NULL; Module = (MODULE*) Module->Next() ) nb_empr++; ListNames = (const wxChar**) MyZMalloc( (nb_empr + 1) * sizeof(wxChar*) ); - Module = (MODULE*) m_Pcb->m_Modules; + Module = (MODULE*) GetBoard()->m_Modules; for( ii = 0; Module != NULL; Module = (MODULE*) Module->Next(), ii++ ) { ListNames[ii] = Module->m_Reference->m_Text.GetData(); @@ -659,7 +659,7 @@ MODULE* WinEDA_PcbFrame::ListAndSelectModuleName( void ) } else /* Recherche du module selectionne */ { - Module = (MODULE*) m_Pcb->m_Modules; + Module = (MODULE*) GetBoard()->m_Modules; for( jj = 0; Module != NULL; Module = (MODULE*) Module->Next(), jj++ ) { if( Module->m_Reference->m_Text.Cmp( ListNames[ii] ) == 0 ) @@ -1015,9 +1015,9 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame, wxDC* DC ) // Calculate the footprint "best" position: if( aPcbFrame->SetBoardBoundaryBoxFromEdgesOnly() ) { - aPcbFrame->GetScreen()->m_Curseur.x = aPcbFrame->m_Pcb->m_BoundaryBox.GetRight() + + aPcbFrame->GetScreen()->m_Curseur.x = aPcbFrame->GetBoard()->m_BoundaryBox.GetRight() + 5000; - aPcbFrame->GetScreen()->m_Curseur.y = aPcbFrame->m_Pcb->m_BoundaryBox.GetBottom() + + aPcbFrame->GetScreen()->m_Curseur.y = aPcbFrame->GetBoard()->m_BoundaryBox.GetBottom() + 10000; } else @@ -1054,10 +1054,10 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame, wxDC* DC ) if( Module == NULL ) continue; /* module non existant en libr */ - newmodule = new MODULE( aPcbFrame->m_Pcb ); + newmodule = new MODULE( aPcbFrame->GetBoard() ); newmodule->Copy( Module ); - aPcbFrame->m_Pcb->Add( newmodule, ADD_APPEND ); + aPcbFrame->GetBoard()->Add( newmodule, ADD_APPEND ); Module = newmodule; Module->m_Reference->m_Text = cmp->m_CmpName; diff --git a/pcbnew/onleftclick.cpp b/pcbnew/onleftclick.cpp index c762ad62e0..2d63587783 100644 --- a/pcbnew/onleftclick.cpp +++ b/pcbnew/onleftclick.cpp @@ -133,7 +133,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) { int netcode = Select_High_Light( DC ); if( netcode < 0 ) - m_Pcb->Display_Infos( this ); + GetBoard()->Display_Infos( this ); else Affiche_Infos_Equipot( netcode, this ); } @@ -225,7 +225,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) { if ( Begin_Zone( DC ) ) { - DrawStruct = m_Pcb->m_CurrentZoneContour; + DrawStruct = GetBoard()->m_CurrentZoneContour; GetScreen()->SetCurItem( DrawStruct ); } } @@ -234,7 +234,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) && (DrawStruct->m_Flags & IS_NEW) ) { Begin_Zone( DC ); - DrawStruct = m_Pcb->m_CurrentZoneContour; + DrawStruct = GetBoard()->m_CurrentZoneContour; GetScreen()->SetCurItem( DrawStruct ); } else @@ -402,8 +402,8 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) break; case TYPE_DRAWSEGMENT: - InstallGraphicItemPropertiesDialog((DRAWSEGMENT*)DrawStruct, &dc); - break; + InstallGraphicItemPropertiesDialog((DRAWSEGMENT*)DrawStruct, &dc); + break; case TYPE_ZONE_CONTAINER: if( DrawStruct->m_Flags ) diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp index d5f215168e..c4d7b30739 100644 --- a/pcbnew/onrightclick.cpp +++ b/pcbnew/onrightclick.cpp @@ -336,7 +336,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) switch( m_ID_current_state ) { case ID_PCB_ZONES_BUTT: - if( m_Pcb->m_ZoneDescriptorList.size() > 0 ) + if( GetBoard()->m_ZoneDescriptorList.size() > 0 ) { aPopMenu->AppendSeparator(); ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_FILL_ALL_ZONES, @@ -413,7 +413,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) commands->Append( ID_POPUP_PCB_AUTOROUTE_ALL_MODULES, _( "Autoroute All Modules" ) ); commands->AppendSeparator(); commands->Append( ID_POPUP_PCB_AUTOROUTE_RESET_UNROUTED, _( "Reset Unrouted" ) ); - if( m_Pcb->m_Modules ) + if( GetBoard()->m_Modules ) { commands->AppendSeparator(); commands->Append( ID_POPUP_PCB_AUTOROUTE_GET_AUTOROUTER, @@ -710,7 +710,7 @@ void WinEDA_PcbFrame::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* men sub_menu_footprint = new wxMenu; - msg = aModule->MenuText( m_Pcb ); + msg = aModule->MenuText( GetBoard() ); ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_footprint, -1, msg, module_xpm ); if( !flags ) { @@ -751,7 +751,7 @@ void WinEDA_PcbFrame::createPopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* m wxMenu* sub_menu_Fp_text; int flags = FpText->m_Flags; - wxString msg = FpText->MenuText( m_Pcb ); + wxString msg = FpText->MenuText( GetBoard() ); sub_menu_Fp_text = new wxMenu; @@ -790,7 +790,7 @@ void WinEDA_PcbFrame::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu ) wxMenu* sub_menu_Pad; int flags = Pad->m_Flags; - wxString msg = Pad->MenuText( m_Pcb ); + wxString msg = Pad->MenuText( GetBoard() ); sub_menu_Pad = new wxMenu; ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_Pad, -1, msg, pad_xpm ); @@ -854,7 +854,7 @@ void WinEDA_PcbFrame::createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu ) wxMenu* sub_menu_Text; int flags = Text->m_Flags; - wxString msg = Text->MenuText( m_Pcb ); + wxString msg = Text->MenuText( GetBoard() ); sub_menu_Text = new wxMenu; diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 7721b1a5e8..cd774c989d 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -214,7 +214,7 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, m_drc = new DRC( this ); // these 2 objects point to each other - SetBOARD( new BOARD( NULL, this ) ); + SetBoard( new BOARD( NULL, this ) ); m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill; m_DisplayPadFill = DisplayOpt.DisplayPadFill; @@ -273,8 +273,8 @@ WinEDA_PcbFrame::~WinEDA_PcbFrame() delete m_drc; - if( m_Pcb != g_ModuleEditor_Pcb ) - delete m_Pcb; + if( GetBoard() != g_ModuleEditor_Pcb ) + delete GetBoard(); } diff --git a/pcbnew/pcbplot.cpp b/pcbnew/pcbplot.cpp index 29bd27633b..c3b7b7ba6f 100644 --- a/pcbnew/pcbplot.cpp +++ b/pcbnew/pcbplot.cpp @@ -163,7 +163,7 @@ void WinEDA_PlotFrame::OnInitDialog( wxInitDialogEvent& event ) wxButton* button; - BOARD* board = m_Parent->m_Pcb; + BOARD* board = m_Parent->GetBoard(); wxConfig* config = wxGetApp().m_EDA_Config; // Current config used by application @@ -641,7 +641,7 @@ void WinEDA_PlotFrame::Plot( wxCommandEvent& event ) wxString FullFileName, BaseFileName; wxString ext; - BOARD* board = m_Parent->m_Pcb; + BOARD* board = m_Parent->GetBoard(); SaveOptPlot( event ); diff --git a/pcbnew/print_board_functions.cpp b/pcbnew/print_board_functions.cpp index fde95fef42..843d43670b 100644 --- a/pcbnew/print_board_functions.cpp +++ b/pcbnew/print_board_functions.cpp @@ -30,7 +30,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl DISPLAY_OPTIONS save_opt; TRACK* pt_piste; WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) m_Parent; - BOARD* Pcb = frame->m_Pcb; + BOARD* Pcb = frame->GetBoard(); save_opt = DisplayOpt; if( printmasklayer & ALL_CU_LAYERS ) diff --git a/pcbnew/router.cpp b/pcbnew/router.cpp index c169f21020..11bf2800b7 100644 --- a/pcbnew/router.cpp +++ b/pcbnew/router.cpp @@ -67,27 +67,27 @@ void WinEDA_PcbFrame::GlobalRoute( wxDC* DC ) SetStatusText( msg ); /* calcul ratsnest */ - m_Pcb->m_Status_Pcb = 0; + GetBoard()->m_Status_Pcb = 0; Compile_Ratsnest( DC, TRUE ); - m_Pcb->ComputeBoundaryBox(); + GetBoard()->ComputeBoundaryBox(); g_GridRoutingSize = GetScreen()->GetGrid().x; // Sortie de la dimension hors tout du pcb (dimensions + marge + g_GridRoutingSize) #define B_MARGE 1000 // en 1/10000 inch fprintf( outfile, "j %d %d %d %d", - ( -B_MARGE - g_GridRoutingSize + m_Pcb->m_BoundaryBox.GetX() ) / PSCALE, - ( -B_MARGE - g_GridRoutingSize + m_Pcb->m_BoundaryBox.GetY() ) / PSCALE, - ( B_MARGE + g_GridRoutingSize + m_Pcb->m_BoundaryBox.GetRight() ) / PSCALE, - ( B_MARGE + g_GridRoutingSize + m_Pcb->m_BoundaryBox.GetBottom() ) / PSCALE ); + ( -B_MARGE - g_GridRoutingSize + GetBoard()->m_BoundaryBox.GetX() ) / PSCALE, + ( -B_MARGE - g_GridRoutingSize + GetBoard()->m_BoundaryBox.GetY() ) / PSCALE, + ( B_MARGE + g_GridRoutingSize + GetBoard()->m_BoundaryBox.GetRight() ) / PSCALE, + ( B_MARGE + g_GridRoutingSize + GetBoard()->m_BoundaryBox.GetBottom() ) / PSCALE ); /* calcul du nombre de couches cuivre */ min_layer = 1; /* -> couche soudure = min layer */ - max_layer = m_Pcb->m_BoardSettings->m_CopperLayerCount; + max_layer = GetBoard()->m_BoardSettings->m_CopperLayerCount; fprintf( outfile, " %d %d", min_layer, max_layer ); - net_number = m_Pcb->m_Equipots.GetCount(); + net_number = GetBoard()->m_Equipots.GetCount(); fprintf( outfile, " %d", net_number ); @@ -126,8 +126,8 @@ void WinEDA_PcbFrame::GlobalRoute( wxDC* DC ) fprintf( outfile, "l %d %d\n", ii, dir ); /* layer direction record */ } - Out_Pads( m_Pcb, outfile ); - GenEdges( m_Pcb, outfile ); + Out_Pads( GetBoard(), outfile ); + GenEdges( GetBoard(), outfile ); fclose( outfile ); @@ -557,7 +557,7 @@ void WinEDA_PcbFrame::ReadAutoroutedTracks( wxDC* DC ) int track_count, track_layer, image, track_width; int via_layer1, via_layer2, via_size; wxPoint track_start, track_end; - int max_layer = m_Pcb->m_BoardSettings->m_CopperLayerCount; + int max_layer = GetBoard()->m_BoardSettings->m_CopperLayerCount; /* Calcule du nom du fichier intermediaire de communication */ FullFileName = GetScreen()->m_FileName; @@ -600,7 +600,7 @@ void WinEDA_PcbFrame::ReadAutoroutedTracks( wxDC* DC ) via_layer1 = CMP_N; if( via_layer2 == max_layer - 1 ) via_layer2 = CMP_N; - newVia = new SEGVIA( m_Pcb ); + newVia = new SEGVIA( GetBoard() ); newVia->m_Start = newVia->m_End = track_start; newVia->m_Width = via_size; @@ -610,7 +610,7 @@ void WinEDA_PcbFrame::ReadAutoroutedTracks( wxDC* DC ) else newVia->m_Shape = VIA_BLIND_BURIED; - m_Pcb->m_Track.PushFront( newVia ); + GetBoard()->m_Track.PushFront( newVia ); NbTrack++; break; @@ -632,7 +632,7 @@ void WinEDA_PcbFrame::ReadAutoroutedTracks( wxDC* DC ) else { sscanf( Line + 2, "%d %d", &track_end.x, &track_end.y ); - newTrack = new TRACK( m_Pcb ); + newTrack = new TRACK( GetBoard() ); newTrack->m_Width = track_width; newTrack->SetLayer( track_layer ); @@ -640,7 +640,7 @@ void WinEDA_PcbFrame::ReadAutoroutedTracks( wxDC* DC ) newTrack->m_End = track_end; track_start = track_end; - m_Pcb->m_Track.PushFront( newTrack ); + GetBoard()->m_Track.PushFront( newTrack ); NbTrack++; } } @@ -663,7 +663,7 @@ void WinEDA_PcbFrame::ReadAutoroutedTracks( wxDC* DC ) DisplayError( this, wxT( "Warning: No tracks" ), 10 ); else { - m_Pcb->m_Status_Pcb = 0; + GetBoard()->m_Status_Pcb = 0; GetScreen()->SetModify(); } diff --git a/pcbnew/sel_layer.cpp b/pcbnew/sel_layer.cpp index d59127800d..e9781dff4b 100644 --- a/pcbnew/sel_layer.cpp +++ b/pcbnew/sel_layer.cpp @@ -101,7 +101,7 @@ WinEDA_SelLayerFrame::WinEDA_SelLayerFrame( WinEDA_BasePcbFrame* parent, * to the right of that radiobox. */ { - BOARD* board = parent->m_Pcb; + BOARD* board = parent->GetBoard(); wxButton* Button; int ii; wxString LayerList[NB_LAYERS + 1]; // One extra element for "(Deselect)" radiobutton @@ -233,7 +233,7 @@ void WinEDA_BasePcbFrame::SelectLayerPair() // Check whether more than one copper layer has been enabled for the // current PCB file, as Layer Pairs can only meaningfully be defined // within PCB files which contain at least two copper layers. - if( m_Pcb->m_BoardSettings->m_CopperLayerCount < 2 ) + if( GetBoard()->m_BoardSettings->m_CopperLayerCount < 2 ) { wxString InfoMsg; InfoMsg = _( "Less than two copper layers are being used." ); @@ -265,7 +265,7 @@ WinEDA_SelLayerPairFrame::WinEDA_SelLayerPairFrame( WinEDA_BasePcbFrame* parent wxSize( 470, 250 ), DIALOG_STYLE ) /*******************************************************************************/ { - BOARD* board = parent->m_Pcb; + BOARD* board = parent->GetBoard(); wxButton* Button; int ii, LayerCount; wxString LayerList[NB_COPPER_LAYERS]; diff --git a/pcbnew/set_color.cpp b/pcbnew/set_color.cpp index 5a0c1295ab..4b9b39352a 100644 --- a/pcbnew/set_color.cpp +++ b/pcbnew/set_color.cpp @@ -225,7 +225,7 @@ void WinEDA_SetColorsFrame::CreateControls() if( laytool_list[lyr]->m_Title == wxT( "*" ) ) msg = g_ViaType_Name[laytool_list[lyr]->m_LayerNumber]; else - msg = m_Parent->m_Pcb->GetLayerName( laytool_list[lyr]->m_LayerNumber ); + msg = m_Parent->GetBoard()->GetLayerName( laytool_list[lyr]->m_LayerNumber ); } else msg = wxGetTranslation( laytool_list[lyr]->m_Title.GetData() ); diff --git a/pcbnew/solve.cpp b/pcbnew/solve.cpp index 028357c988..aea45614b7 100644 --- a/pcbnew/solve.cpp +++ b/pcbnew/solve.cpp @@ -215,7 +215,7 @@ int WinEDA_PcbFrame::Solve( wxDC* DC, int two_sides ) Ncurrent = 0; MsgPanel->EraseMsgBox(); - msg.Printf( wxT( "%d " ), m_Pcb->m_NbNoconnect ); + msg.Printf( wxT( "%d " ), GetBoard()->m_NbNoconnect ); Affiche_1_Parametre( this, 72, wxT( "NoConn" ), msg, CYAN ); @@ -242,7 +242,7 @@ int WinEDA_PcbFrame::Solve( wxDC* DC, int two_sides ) } Ncurrent++; - pt_equipot = m_Pcb->FindNet( current_net_code ); + pt_equipot = GetBoard()->FindNet( current_net_code ); if( pt_equipot ) { msg.Printf( wxT( "[%8.8s]" ), pt_equipot->GetNetname().GetData() ); @@ -252,10 +252,10 @@ int WinEDA_PcbFrame::Solve( wxDC* DC, int two_sides ) } pt_cur_ch = pt_cur_ch; - segm_oX = m_Pcb->m_BoundaryBox.m_Pos.x + (g_GridRoutingSize * col_source); - segm_oY = m_Pcb->m_BoundaryBox.m_Pos.y + (g_GridRoutingSize * row_source); - segm_fX = m_Pcb->m_BoundaryBox.m_Pos.x + (g_GridRoutingSize * col_target); - segm_fY = m_Pcb->m_BoundaryBox.m_Pos.y + (g_GridRoutingSize * row_target); + segm_oX = GetBoard()->m_BoundaryBox.m_Pos.x + (g_GridRoutingSize * col_source); + segm_oY = GetBoard()->m_BoundaryBox.m_Pos.y + (g_GridRoutingSize * row_source); + segm_fX = GetBoard()->m_BoundaryBox.m_Pos.x + (g_GridRoutingSize * col_target); + segm_fY = GetBoard()->m_BoundaryBox.m_Pos.y + (g_GridRoutingSize * row_target); /* Affiche Liaison */ GRLine( &DrawPanel->m_ClipBox, DC, segm_oX, segm_oY, segm_fX, segm_fY, 0, WHITE | GR_XOR ); @@ -289,7 +289,7 @@ int WinEDA_PcbFrame::Solve( wxDC* DC, int two_sides ) Affiche_1_Parametre( this, 22, wxT( "Ok" ), msg, GREEN ); msg.Printf( wxT( "%d " ), nbunsucces ); Affiche_1_Parametre( this, 30, wxT( "Fail" ), msg, RED ); - msg.Printf( wxT( "%d " ), m_Pcb->m_NbNoconnect ); + msg.Printf( wxT( "%d " ), GetBoard()->m_NbNoconnect ); Affiche_1_Parametre( this, 38, wxT( "NoConn" ), msg, CYAN ); /* Effacement des affichages de routage sur l'ecran */ @@ -381,8 +381,8 @@ static int Route_1_Trace( WinEDA_PcbFrame* pcbframe, wxDC* DC, /* Test 2 Si routage possible c.a.d si les pads sont accessibles * sur la grille de routage ( 1 point de grille doit etre dans le pad)*/ { - int cX = (g_GridRoutingSize * col_source) + pcbframe->m_Pcb->m_BoundaryBox.m_Pos.x; - int cY = (g_GridRoutingSize * row_source) + pcbframe->m_Pcb->m_BoundaryBox.m_Pos.y; + int cX = (g_GridRoutingSize * col_source) + pcbframe->GetBoard()->m_BoundaryBox.m_Pos.x; + int cY = (g_GridRoutingSize * row_source) + pcbframe->GetBoard()->m_BoundaryBox.m_Pos.y; int dx = pt_cur_ch->pad_start->m_Size.x / 2; int dy = pt_cur_ch->pad_start->m_Size.y / 2; int px = pt_cur_ch->pad_start->GetPosition().x; @@ -393,8 +393,8 @@ static int Route_1_Trace( WinEDA_PcbFrame* pcbframe, wxDC* DC, if( (abs( cX - px ) > dx ) || (abs( cY - py ) > dy) ) goto end_of_route; - cX = (g_GridRoutingSize * col_target) + pcbframe->m_Pcb->m_BoundaryBox.m_Pos.x; - cY = (g_GridRoutingSize * row_target) + pcbframe->m_Pcb->m_BoundaryBox.m_Pos.y; + cX = (g_GridRoutingSize * col_target) + pcbframe->GetBoard()->m_BoundaryBox.m_Pos.x; + cY = (g_GridRoutingSize * row_target) + pcbframe->GetBoard()->m_BoundaryBox.m_Pos.y; dx = pt_cur_ch->pad_end->m_Size.x / 2; dy = pt_cur_ch->pad_end->m_Size.y / 2; px = pt_cur_ch->pad_end->GetPosition().x; @@ -419,18 +419,18 @@ static int Route_1_Trace( WinEDA_PcbFrame* pcbframe, wxDC* DC, /* Placement du bit de suppression d'obstacle relative aux 2 pads a relier */ pcbframe->Affiche_Message( wxT( "Gen Cells" ) ); - Place_1_Pad_Board( pcbframe->m_Pcb, pt_cur_ch->pad_start, CURRENT_PAD, marge, WRITE_OR_CELL ); - Place_1_Pad_Board( pcbframe->m_Pcb, pt_cur_ch->pad_end, CURRENT_PAD, marge, WRITE_OR_CELL ); + Place_1_Pad_Board( pcbframe->GetBoard(), pt_cur_ch->pad_start, CURRENT_PAD, marge, WRITE_OR_CELL ); + Place_1_Pad_Board( pcbframe->GetBoard(), pt_cur_ch->pad_end, CURRENT_PAD, marge, WRITE_OR_CELL ); /* Regenere les barrieres restantes (qui peuvent empieter sur le placement * des bits precedents) */ - ptr = (LISTE_PAD*) &pcbframe->m_Pcb->m_Pads[0]; - i = pcbframe->m_Pcb->m_Pads.size(); + ptr = (LISTE_PAD*) &pcbframe->GetBoard()->m_Pads[0]; + i = pcbframe->GetBoard()->m_Pads.size(); for( ; i > 0; i--, ptr++ ) { if( (pt_cur_ch->pad_start != *ptr) && (pt_cur_ch->pad_end != *ptr) ) { - Place_1_Pad_Board( pcbframe->m_Pcb, *ptr, ~CURRENT_PAD, marge, WRITE_AND_CELL ); + Place_1_Pad_Board( pcbframe->GetBoard(), *ptr, ~CURRENT_PAD, marge, WRITE_AND_CELL ); } } @@ -678,8 +678,8 @@ static int Route_1_Trace( WinEDA_PcbFrame* pcbframe, wxDC* DC, } end_of_route: - Place_1_Pad_Board( pcbframe->m_Pcb, pt_cur_ch->pad_start, ~CURRENT_PAD, marge, WRITE_AND_CELL ); - Place_1_Pad_Board( pcbframe->m_Pcb, pt_cur_ch->pad_end, ~CURRENT_PAD, marge, WRITE_AND_CELL ); + Place_1_Pad_Board( pcbframe->GetBoard(), pt_cur_ch->pad_start, ~CURRENT_PAD, marge, WRITE_AND_CELL ); + Place_1_Pad_Board( pcbframe->GetBoard(), pt_cur_ch->pad_end, ~CURRENT_PAD, marge, WRITE_AND_CELL ); return result; } @@ -827,7 +827,7 @@ static int Retrace( WinEDA_PcbFrame* pcbframe, wxDC* DC, return 0; } - OrCell_Trace( pcbframe->m_Pcb, r1, c1, s1, p_dir, current_net_code ); + OrCell_Trace( pcbframe->GetBoard(), r1, c1, s1, p_dir, current_net_code ); } else { @@ -842,9 +842,9 @@ static int Retrace( WinEDA_PcbFrame* pcbframe, wxDC* DC, || x == FROM_OTHERSIDE) && ( (b = bit[y - 1][x - 1]) != 0 ) ) { - OrCell_Trace( pcbframe->m_Pcb, r1, c1, s1, b, current_net_code ); + OrCell_Trace( pcbframe->GetBoard(), r1, c1, s1, b, current_net_code ); if( b & HOLE ) - OrCell_Trace( pcbframe->m_Pcb, r2, c2, s2, HOLE, current_net_code ); + OrCell_Trace( pcbframe->GetBoard(), r2, c2, s2, HOLE, current_net_code ); } else { @@ -889,7 +889,7 @@ static int Retrace( WinEDA_PcbFrame* pcbframe, wxDC* DC, return 0; } - OrCell_Trace( pcbframe->m_Pcb, r2, c2, s2, p_dir, current_net_code ); + OrCell_Trace( pcbframe->GetBoard(), r2, c2, s2, p_dir, current_net_code ); } /* move to next cell */ r0 = r1; c0 = c1; s0 = s1; @@ -1047,16 +1047,16 @@ static void Place_Piste_en_Buffer( WinEDA_PcbFrame* pcbframe, wxDC* DC ) g_CurrentTrackList.PushBack( newTrack ); } - g_FirstTrackSegment->start = Locate_Pad_Connecte( pcbframe->m_Pcb, g_FirstTrackSegment, START ); + g_FirstTrackSegment->start = Locate_Pad_Connecte( pcbframe->GetBoard(), g_FirstTrackSegment, START ); if( g_FirstTrackSegment->start ) g_FirstTrackSegment->SetState( BEGIN_ONPAD, ON ); - g_CurrentTrackSegment->end = Locate_Pad_Connecte( pcbframe->m_Pcb, g_CurrentTrackSegment, END ); + g_CurrentTrackSegment->end = Locate_Pad_Connecte( pcbframe->GetBoard(), g_CurrentTrackSegment, END ); if( g_CurrentTrackSegment->end ) g_CurrentTrackSegment->SetState( END_ONPAD, ON ); /* recherche de la zone de rangement et insertion de la nouvelle piste */ - pcbframe->m_Pcb->Add( g_FirstTrackSegment ); + pcbframe->GetBoard()->Add( g_FirstTrackSegment ); Trace_Une_Piste( panel, DC, g_FirstTrackSegment, g_CurrentTrackList.GetCount(), GR_OR ); @@ -1065,8 +1065,8 @@ static void Place_Piste_en_Buffer( WinEDA_PcbFrame* pcbframe, wxDC* DC ) /* Trace de la forme exacte de la piste en BOARD */ for( TRACK* track = g_FirstTrackSegment; track; track = track->Next() ) { - TraceSegmentPcb( pcbframe->m_Pcb, track, HOLE, marge, WRITE_CELL ); - TraceSegmentPcb( pcbframe->m_Pcb, track, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL ); + TraceSegmentPcb( pcbframe->GetBoard(), track, HOLE, marge, WRITE_CELL ); + TraceSegmentPcb( pcbframe->GetBoard(), track, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL ); } ActiveScreen->SetModify(); diff --git a/pcbnew/specctra_export.cpp b/pcbnew/specctra_export.cpp index af492f0a12..51d9c7f087 100644 --- a/pcbnew/specctra_export.cpp +++ b/pcbnew/specctra_export.cpp @@ -87,11 +87,11 @@ void WinEDA_PcbFrame::ExportToSpecctra( wxCommandEvent& event ) // DSN Images (=Kicad MODULES and pads) must be presented from the // top view. So we temporarily flip any modules which are on the back // side of the board to the front, and record this in the MODULE's flag field. - db.FlipMODULEs( m_Pcb ); + db.FlipMODULEs( GetBoard() ); try { - db.FromBOARD( m_Pcb ); + db.FromBOARD( GetBoard() ); db.ExportPCB( fullFileName, true ); // if an exception is thrown by FromBOARD or ExportPCB(), then @@ -108,7 +108,7 @@ void WinEDA_PcbFrame::ExportToSpecctra( wxCommandEvent& event ) SetLocaleTo_Default( ); // revert to the current locale // done assuredly, even if an exception was thrown and caught. - db.RevertMODULEs( m_Pcb ); + db.RevertMODULEs( GetBoard() ); // The two calls below to BOARD::Change_Side_Module(), both set the diff --git a/pcbnew/specctra_import.cpp b/pcbnew/specctra_import.cpp index ff8eff6ec9..6acbe30f8d 100644 --- a/pcbnew/specctra_import.cpp +++ b/pcbnew/specctra_import.cpp @@ -90,7 +90,7 @@ void WinEDA_PcbFrame::ImportSpecctraSession( wxCommandEvent& event ) try { db.LoadSESSION( fullFileName ); - db.FromSESSION( m_Pcb ); + db.FromSESSION( GetBoard() ); } catch( IOError ioe ) { @@ -111,7 +111,7 @@ void WinEDA_PcbFrame::ImportSpecctraSession( wxCommandEvent& event ) m_SelViaSizeBox_Changed = TRUE; GetScreen()->SetModify(); - m_Pcb->m_Status_Pcb = 0; + GetBoard()->m_Status_Pcb = 0; Affiche_Message( wxString( _("Session file imported and merged OK.")) ); diff --git a/pcbnew/surbrill.cpp b/pcbnew/surbrill.cpp index 00070096d0..16b8a7e8ab 100644 --- a/pcbnew/surbrill.cpp +++ b/pcbnew/surbrill.cpp @@ -40,7 +40,7 @@ void WinEDA_PcbFrame::Liste_Equipot( wxCommandEvent& event ) List = new WinEDA_TextFrame( this, _( "List Nets" ) ); - Equipot = (EQUIPOT*) m_Pcb->m_Equipots; + Equipot = (EQUIPOT*) GetBoard()->m_Equipots; for( ; Equipot != NULL; Equipot = (EQUIPOT*) Equipot->Next() ) { wxString Line; @@ -61,7 +61,7 @@ void WinEDA_PcbFrame::Liste_Equipot( wxCommandEvent& event ) return; /* Recherche du numero de net rellement selectionn�*/ - Equipot = (EQUIPOT*) m_Pcb->m_Equipots; + Equipot = (EQUIPOT*) GetBoard()->m_Equipots; for( jj = 0; Equipot != NULL; Equipot = (EQUIPOT*) Equipot->Next() ) { /* calcul adr relative du nom de la pastille reference de la piste */ @@ -108,7 +108,7 @@ int WinEDA_PcbFrame::Select_High_Light( wxDC* DC ) // optionally, modify the "guide" here as needed using its member functions - m_Collector->Collect( m_Pcb, GENERAL_COLLECTOR::PadsTracksOrZones, + m_Collector->Collect( GetBoard(), GENERAL_COLLECTOR::PadsTracksOrZones, GetScreen()->RefPos( true ), guide ); BOARD_ITEM* item = (*m_Collector)[0]; @@ -175,7 +175,7 @@ void WinEDA_PcbFrame::DrawHightLight( wxDC* DC, int NetCode ) #if 0 // does not unhighlight properly // redraw the zones with the NetCode - for( SEGZONE* zone = m_Pcb->m_Zone; zone; zone = zone->Next() ) + for( SEGZONE* zone = GetBoard()->m_Zone; zone; zone = zone->Next() ) { if( zone->GetNet() == NetCode ) { @@ -185,7 +185,7 @@ void WinEDA_PcbFrame::DrawHightLight( wxDC* DC, int NetCode ) #endif // Redraw ZONE_CONTAINERS - BOARD::ZONE_CONTAINERS& zones = m_Pcb->m_ZoneDescriptorList; + BOARD::ZONE_CONTAINERS& zones = GetBoard()->m_ZoneDescriptorList; for( BOARD::ZONE_CONTAINERS::iterator zc = zones.begin(); zc!=zones.end(); ++zc ) { if( (*zc)->GetNet() == NetCode ) @@ -195,13 +195,13 @@ void WinEDA_PcbFrame::DrawHightLight( wxDC* DC, int NetCode ) } /* Redraw pads */ - for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() ) + for( MODULE* module = GetBoard()->m_Modules; module; module = module->Next() ) { Pad_Surbrillance( DrawPanel, DC, module, NetCode ); } /* Redraw track and vias: */ - for( TRACK* pts = m_Pcb->m_Track; pts; pts = pts->Next() ) + for( TRACK* pts = GetBoard()->m_Track; pts; pts = pts->Next() ) { if( pts->GetNet() == NetCode ) { diff --git a/pcbnew/swap_layers.cpp b/pcbnew/swap_layers.cpp index 8cdb25d542..6118e07e60 100644 --- a/pcbnew/swap_layers.cpp +++ b/pcbnew/swap_layers.cpp @@ -71,7 +71,7 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( WinEDA_BasePcbFrame* parent ) : wxDefaultSize, wxDEFAULT_DIALOG_STYLE|MAYBE_RESIZE_BORDER ) /*************************************************************************/ { - BOARD* board = parent->m_Pcb; + BOARD* board = parent->GetBoard(); OuterBoxSizer = NULL; MainBoxSizer = NULL; @@ -283,7 +283,7 @@ void WinEDA_SwapLayerFrame::Sel_Layer( wxCommandEvent& event ) } else { - layer_list[ii]->SetLabel( m_Parent->m_Pcb->GetLayerName( jj ) ); + layer_list[ii]->SetLabel( m_Parent->GetBoard()->GetLayerName( jj ) ); // Change the text color to fushia (to highlight // that this layer *is* being swapped) layer_list[ii]->SetForegroundColour( wxColour(255, 0, 128) ); @@ -332,7 +332,7 @@ void WinEDA_PcbFrame::Swap_Layers( wxCommandEvent& event ) return; // (Cancelled dialog box returns -1 instead) /* Modifications des pistes */ - pt_segm = m_Pcb->m_Track; + pt_segm = GetBoard()->m_Track; for( ; pt_segm != NULL; pt_segm = pt_segm->Next() ) { GetScreen()->SetModify(); @@ -358,7 +358,7 @@ void WinEDA_PcbFrame::Swap_Layers( wxCommandEvent& event ) } /* Modifications des zones */ - for( pt_segm = m_Pcb->m_Zone; pt_segm; pt_segm = pt_segm->Next() ) + for( pt_segm = GetBoard()->m_Zone; pt_segm; pt_segm = pt_segm->Next() ) { GetScreen()->SetModify(); jj = pt_segm->GetLayer(); @@ -367,7 +367,7 @@ void WinEDA_PcbFrame::Swap_Layers( wxCommandEvent& event ) } /* Modifications des autres segments */ - PtStruct = m_Pcb->m_Drawings; + PtStruct = GetBoard()->m_Drawings; for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) { if( PtStruct->Type() == TYPE_DRAWSEGMENT ) diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp index fcf4acc6ae..9ee108f8b3 100644 --- a/pcbnew/tool_pcb.cpp +++ b/pcbnew/tool_pcb.cpp @@ -749,7 +749,7 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent ) if( g_TabOneLayerMask[layer] & layer_mask ) { - wxString msg = m_Pcb->GetLayerName( layer ); + wxString msg = GetBoard()->GetLayerName( layer ); msg = AddHotkeyName( msg, s_Board_Editor_Hokeys_Descr, HK_SwitchLayer[layer] ); m_SelLayerBox->Append( msg ); diff --git a/pcbnew/tracepcb.cpp b/pcbnew/tracepcb.cpp index 75a9a3fa4f..7ef8abf367 100644 --- a/pcbnew/tracepcb.cpp +++ b/pcbnew/tracepcb.cpp @@ -31,7 +31,7 @@ void WinEDA_ModuleEditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) { PCB_SCREEN* screen = (PCB_SCREEN*)GetScreen(); - if( !m_Pcb || !screen ) + if( !GetBoard() || !screen ) return; ActiveScreen = screen; @@ -44,7 +44,7 @@ void WinEDA_ModuleEditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) TraceWorkSheet( DC, screen, 0 ); /* Redraw the footprint */ - for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() ) + for( MODULE* module = GetBoard()->m_Modules; module; module = module->Next() ) { module->Draw( DrawPanel, DC, GR_OR ); } @@ -70,7 +70,7 @@ void WinEDA_PcbFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) { PCB_SCREEN* screen = GetScreen(); - if( !m_Pcb || !screen ) + if( !GetBoard() || !screen ) return; ActiveScreen = screen; @@ -83,7 +83,7 @@ void WinEDA_PcbFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) TraceWorkSheet( DC, GetScreen(), 0 ); - m_Pcb->Draw( DrawPanel, DC, GR_OR ); + GetBoard()->Draw( DrawPanel, DC, GR_OR ); if( g_HightLigt_Status ) DrawHightLight( DC, g_HightLigth_NetCode ); diff --git a/pcbnew/track.cpp b/pcbnew/track.cpp index 0632277b21..8a2044245f 100644 --- a/pcbnew/track.cpp +++ b/pcbnew/track.cpp @@ -71,7 +71,7 @@ TRACK* Marque_Une_Piste( WinEDA_BasePcbFrame* frame, wxDC* DC, if( aTrackList->Type() == TYPE_VIA ) { TRACK* Segm1, * Segm2 = NULL, * Segm3 = NULL; - Segm1 = Fast_Locate_Piste( frame->m_Pcb->m_Track, NULL, + Segm1 = Fast_Locate_Piste( frame->GetBoard()->m_Track, NULL, aTrackList->m_Start, masque_layer ); if( Segm1 ) { @@ -91,19 +91,19 @@ TRACK* Marque_Une_Piste( WinEDA_BasePcbFrame* frame, wxDC* DC, if( Segm1 ) { masque_layer = Segm1->ReturnMaskLayer(); - Marque_Chaine_segments( frame->m_Pcb, aTrackList->m_Start, masque_layer, &trackList ); + Marque_Chaine_segments( frame->GetBoard(), aTrackList->m_Start, masque_layer, &trackList ); } if( Segm2 ) { masque_layer = Segm2->ReturnMaskLayer(); - Marque_Chaine_segments( frame->m_Pcb, aTrackList->m_Start, masque_layer, &trackList ); + Marque_Chaine_segments( frame->GetBoard(), aTrackList->m_Start, masque_layer, &trackList ); } } else // mark the chain using both ends of the initial segment { - Marque_Chaine_segments( frame->m_Pcb, aTrackList->m_Start, masque_layer, &trackList ); - Marque_Chaine_segments( frame->m_Pcb, aTrackList->m_End, masque_layer, &trackList ); + Marque_Chaine_segments( frame->GetBoard(), aTrackList->m_Start, masque_layer, &trackList ); + Marque_Chaine_segments( frame->GetBoard(), aTrackList->m_End, masque_layer, &trackList ); } // marquage des vias (vias non connectees ou inutiles @@ -122,7 +122,7 @@ TRACK* Marque_Une_Piste( WinEDA_BasePcbFrame* frame, wxDC* DC, masque_layer = via->ReturnMaskLayer(); - TRACK* track = Fast_Locate_Piste( frame->m_Pcb->m_Track, + TRACK* track = Fast_Locate_Piste( frame->GetBoard()->m_Track, NULL, via->m_Start, masque_layer ); if( track == NULL ) continue; @@ -144,7 +144,7 @@ TRACK* Marque_Une_Piste( WinEDA_BasePcbFrame* frame, wxDC* DC, /* Reclassement des segments marques en une chaine */ NbSegmBusy = 0; TRACK* firstTrack; - for( firstTrack = frame->m_Pcb->m_Track; firstTrack; firstTrack = firstTrack->Next() ) + for( firstTrack = frame->GetBoard()->m_Track; firstTrack; firstTrack = firstTrack->Next() ) { // recherche du debut de la liste des segments marques a BUSY if( firstTrack->GetState( BUSY ) ) diff --git a/pcbnew/via_edit.cpp b/pcbnew/via_edit.cpp index 490750889d..cec6e1efae 100644 --- a/pcbnew/via_edit.cpp +++ b/pcbnew/via_edit.cpp @@ -63,7 +63,7 @@ void WinEDA_PcbFrame::Via_Edit_Control( wxDC* DC, int command_type, SEGVIA* via case ID_POPUP_PCB_VIA_HOLE_EXPORT_TO_OTHERS: // Export the current drill value to via which héave the same size if( via->GetDrillValue() > 0 ) g_DesignSettings.m_ViaDrillCustomValue = via->GetDrillValue(); - via_struct = m_Pcb->m_Track; + via_struct = GetBoard()->m_Track; for( ; via_struct != NULL; via_struct = via_struct->Next() ) { if( via_struct->Type() == TYPE_VIA ) /* mise a jour du diametre de la via */ @@ -87,7 +87,7 @@ void WinEDA_PcbFrame::Via_Edit_Control( wxDC* DC, int command_type, SEGVIA* via break; case ID_POPUP_PCB_VIA_HOLE_RESET_TO_DEFAULT: // Reset all via hole to default value - via_struct = m_Pcb->m_Track; + via_struct = GetBoard()->m_Track; for( ; via_struct != NULL; via_struct = via_struct->Next() ) { if( via_struct->Type() == TYPE_VIA ) /* mise a jour du diametre de la via */ diff --git a/pcbnew/xchgmod.cpp b/pcbnew/xchgmod.cpp index 12c599862e..4b4d917cf8 100644 --- a/pcbnew/xchgmod.cpp +++ b/pcbnew/xchgmod.cpp @@ -302,7 +302,7 @@ void WinEDA_ExchangeModuleFrame::Change_Module( wxCommandEvent& event ) if( Change_1_Module( m_CurrentModule, newmodulename, TRUE ) ) { - m_Parent->m_Pcb->m_Status_Pcb = 0; + m_Parent->GetBoard()->m_Status_Pcb = 0; m_Parent->build_liste_pads(); } } @@ -331,7 +331,7 @@ void WinEDA_ExchangeModuleFrame::Change_ModuleId( wxCommandEvent& event ) bool check_module_value = FALSE; int ShowErr = 5; // Affiche 5 messages d'err maxi - if( m_Parent->m_Pcb->m_Modules == NULL ) + if( m_Parent->GetBoard()->m_Modules == NULL ) return; if( newmodulename == wxEmptyString ) return; @@ -359,7 +359,7 @@ void WinEDA_ExchangeModuleFrame::Change_ModuleId( wxCommandEvent& event ) * Change_1_Module() modifie le dernier module de la liste */ - PtModule = m_Parent->m_Pcb->m_Modules; + PtModule = m_Parent->GetBoard()->m_Modules; for( ; PtModule != NULL; PtModule = PtModule->Next() ) { if( PtModule->Next() == NULL ) @@ -367,7 +367,7 @@ void WinEDA_ExchangeModuleFrame::Change_ModuleId( wxCommandEvent& event ) } /* Ici PtModule pointe le dernier module de la liste */ - for( ; (BOARD*) PtModule != m_Parent->m_Pcb; PtModule = PtBack ) + for( ; (BOARD*) PtModule != m_Parent->GetBoard(); PtModule = PtBack ) { MODULE* module; PtBack = PtModule->Back(); @@ -387,7 +387,7 @@ void WinEDA_ExchangeModuleFrame::Change_ModuleId( wxCommandEvent& event ) if( change ) { - m_Parent->m_Pcb->m_Status_Pcb = 0; + m_Parent->GetBoard()->m_Status_Pcb = 0; m_Parent->build_liste_pads(); } } @@ -409,7 +409,7 @@ void WinEDA_ExchangeModuleFrame::Change_ModuleAll( wxCommandEvent& event ) bool change = FALSE; int ShowErr = 5; // Affiche 5 messages d'err maxi - if( m_Parent->m_Pcb->m_Modules == NULL ) + if( m_Parent->GetBoard()->m_Modules == NULL ) return; if( !IsOK( this, _( "Change ALL modules ?" ) ) ) @@ -419,7 +419,7 @@ void WinEDA_ExchangeModuleFrame::Change_ModuleAll( wxCommandEvent& event ) * Change_1_Module() modifie le dernier module de la liste */ - PtModule = m_Parent->m_Pcb->m_Modules; + PtModule = m_Parent->GetBoard()->m_Modules; for( ; PtModule != NULL; PtModule = PtModule->Next() ) { if( PtModule->Next() == NULL ) @@ -427,7 +427,7 @@ void WinEDA_ExchangeModuleFrame::Change_ModuleAll( wxCommandEvent& event ) } /* Ici PtModule pointe le dernier module de la liste */ - for( ; (BOARD*) PtModule != m_Parent->m_Pcb; PtModule = PtBack ) + for( ; (BOARD*) PtModule != m_Parent->GetBoard(); PtModule = PtBack ) { PtBack = PtModule->Back(); if( Change_1_Module( PtModule, PtModule->m_LibRef.GetData(), ShowErr ) ) @@ -438,7 +438,7 @@ void WinEDA_ExchangeModuleFrame::Change_ModuleAll( wxCommandEvent& event ) if( change ) { - m_Parent->m_Pcb->m_Status_Pcb = 0; + m_Parent->GetBoard()->m_Status_Pcb = 0; m_Parent->build_liste_pads(); } } @@ -524,9 +524,9 @@ MODULE* WinEDA_BasePcbFrame::Exchange_Module( wxWindow* winaff, DisplayError( winaff, wxT( "WinEDA_BasePcbFrame::Exchange_Module() StuctType error" ) ); } - NewModule->SetParent( m_Pcb ); + NewModule->SetParent( GetBoard() ); - m_Pcb->m_Status_Pcb = 0; + GetBoard()->m_Status_Pcb = 0; oldpos = GetScreen()->m_Curseur; GetScreen()->m_Curseur = OldModule->m_Pos; Place_Module( NewModule, NULL ); @@ -535,7 +535,7 @@ MODULE* WinEDA_BasePcbFrame::Exchange_Module( wxWindow* winaff, /* Changement eventuel de couche */ if( OldModule->GetLayer() != NewModule->GetLayer() ) { - m_Pcb->Change_Side_Module( NewModule, NULL ); + GetBoard()->Change_Side_Module( NewModule, NULL ); } /* Rotation eventuelle du module */ @@ -573,7 +573,7 @@ MODULE* WinEDA_BasePcbFrame::Exchange_Module( wxWindow* winaff, /* Effacement de l'ancien module */ OldModule ->DeleteStructure(); - m_Pcb->m_Status_Pcb = 0; + GetBoard()->m_Status_Pcb = 0; NewModule->m_Flags = 0; GetScreen()->SetModify(); @@ -604,7 +604,7 @@ bool WinEDA_PcbFrame::RecreateCmpFileFromBoard() wxString FullFileNameCmp, mask; FILE* FichCmp; char Line[1024]; - MODULE* Module = m_Pcb->m_Modules; + MODULE* Module = GetBoard()->m_Modules; wxString msg; if( Module == NULL ) diff --git a/pcbnew/zone_filling_algorithm.cpp b/pcbnew/zone_filling_algorithm.cpp index b5ccfa2804..7d6cea2171 100644 --- a/pcbnew/zone_filling_algorithm.cpp +++ b/pcbnew/zone_filling_algorithm.cpp @@ -137,7 +137,7 @@ int ZONE_CONTAINER::Fill_Zone_Areas_With_Segments( WinEDA_PcbFrame* aFrame ) int seg_startY = m_FilledPolysList[ics].y; int seg_endX = m_FilledPolysList[ice].x; int seg_endY = m_FilledPolysList[ice].y; - + /* Trivial cases: skip if ref above or below the segment to test */ if( ( seg_startY > refy ) && (seg_endY > refy ) ) @@ -185,7 +185,7 @@ int ZONE_CONTAINER::Fill_Zone_Areas_With_Segments( WinEDA_PcbFrame* aFrame ) wxMessageBox(msg ); error = true; } - + if ( error ) break; int iimax = x_coordinates.size()-1; for (int ii = 0; ii < iimax; ii +=2 ) @@ -196,14 +196,14 @@ int ZONE_CONTAINER::Fill_Zone_Areas_With_Segments( WinEDA_PcbFrame* aFrame ) seg_start.y = refy; seg_end.x = x_coordinates[ii+1]; seg_end.y = refy; - SEGZONE* segment = new SEGZONE( aFrame->m_Pcb ); + SEGZONE* segment = new SEGZONE( aFrame->GetBoard() ); segment->m_Start = seg_start; segment->m_End = seg_end; segment->SetNet( GetNet() ); segment->m_TimeStamp = m_TimeStamp; segment->m_Width = m_ZoneMinThickness; segment->SetLayer( GetLayer() ); - aFrame->m_Pcb->Add( segment ); + aFrame->GetBoard()->Add( segment ); } } //End examine segments in one area if ( error ) break; diff --git a/pcbnew/zones_by_polygon.cpp b/pcbnew/zones_by_polygon.cpp index b79b0d5c06..ed99200104 100644 --- a/pcbnew/zones_by_polygon.cpp +++ b/pcbnew/zones_by_polygon.cpp @@ -124,7 +124,7 @@ void WinEDA_PcbFrame::Delete_Zone_Fill( wxDC* DC, SEGZONE* aZone, long aTimestam TimeStamp = aZone->m_TimeStamp; // Save reference time stamp (aZone will be deleted) SEGZONE* next; - for( SEGZONE* zone = m_Pcb->m_Zone; zone != NULL; zone = next ) + for( SEGZONE* zone = GetBoard()->m_Zone; zone != NULL; zone = next ) { next = zone->Next(); if( zone->m_TimeStamp == TimeStamp ) @@ -157,7 +157,7 @@ int WinEDA_PcbFrame::Delete_LastCreatedCorner( wxDC* DC ) * if no corner in list, close the outline creation */ { - ZONE_CONTAINER* zone = m_Pcb->m_CurrentZoneContour; + ZONE_CONTAINER* zone = GetBoard()->m_CurrentZoneContour; if( zone == NULL ) return 0; @@ -195,7 +195,7 @@ static void Abort_Zone_Create_Outline( WinEDA_DrawPanel* Panel, wxDC* DC ) */ { WinEDA_PcbFrame* pcbframe = (WinEDA_PcbFrame*) Panel->m_Parent; - ZONE_CONTAINER* zone = pcbframe->m_Pcb->m_CurrentZoneContour; + ZONE_CONTAINER* zone = pcbframe->GetBoard()->m_CurrentZoneContour; if( zone ) { @@ -321,15 +321,15 @@ void WinEDA_PcbFrame::End_Move_Zone_Corner_Or_Outlines( wxDC* DC, ZONE_CONTAINER /* Combine zones if possible */ wxBusyCursor dummy; - m_Pcb->AreaPolygonModified( zone_container, true, verbose ); + GetBoard()->AreaPolygonModified( zone_container, true, verbose ); DrawPanel->Refresh(); - int ii = m_Pcb->GetAreaIndex( zone_container ); // test if zone_container exists + int ii = GetBoard()->GetAreaIndex( zone_container ); // test if zone_container exists if( ii < 0 ) zone_container = NULL; // was removed by combining zones - int error_count = m_Pcb->Test_Drc_Areas_Outlines_To_Areas_Outlines( zone_container, true ); + int error_count = GetBoard()->Test_Drc_Areas_Outlines_To_Areas_Outlines( zone_container, true ); if( error_count ) { DisplayError( this, _( "Area: DRC outline error" ) ); @@ -360,7 +360,7 @@ void WinEDA_PcbFrame::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_contain Delete_Zone_Fill( DC, NULL, zone_container->m_TimeStamp ); zone_container->DrawFilledArea( DrawPanel, DC, GR_XOR ); } - m_Pcb->Delete( zone_container ); + GetBoard()->Delete( zone_container ); return; } @@ -368,24 +368,24 @@ void WinEDA_PcbFrame::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_contain if( DC ) { - m_Pcb->RedrawAreasOutlines( DrawPanel, DC, GR_XOR, layer ); - m_Pcb->RedrawFilledAreas( DrawPanel, DC, GR_XOR, layer ); + GetBoard()->RedrawAreasOutlines( DrawPanel, DC, GR_XOR, layer ); + GetBoard()->RedrawFilledAreas( DrawPanel, DC, GR_XOR, layer ); } zone_container->m_Poly->DeleteCorner( zone_container->m_CornerSelection ); // modify zones outlines according to the new zone_container shape - m_Pcb->AreaPolygonModified( zone_container, true, verbose ); + GetBoard()->AreaPolygonModified( zone_container, true, verbose ); if( DC ) { - m_Pcb->RedrawAreasOutlines( DrawPanel, DC, GR_OR, layer ); - m_Pcb->RedrawFilledAreas( DrawPanel, DC, GR_OR, layer ); + GetBoard()->RedrawAreasOutlines( DrawPanel, DC, GR_OR, layer ); + GetBoard()->RedrawFilledAreas( DrawPanel, DC, GR_OR, layer ); } - int ii = m_Pcb->GetAreaIndex( zone_container ); // test if zone_container exists + int ii = GetBoard()->GetAreaIndex( zone_container ); // test if zone_container exists if( ii < 0 ) zone_container = NULL; // zone_container does not exist anymaore, after combining zones - int error_count = m_Pcb->Test_Drc_Areas_Outlines_To_Areas_Outlines( zone_container, true ); + int error_count = GetBoard()->Test_Drc_Areas_Outlines_To_Areas_Outlines( zone_container, true ); if( error_count ) { DisplayError( this, _( "Area: DRC outline error" ) ); @@ -498,23 +498,23 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC ) { // verify if s_CurrentZone exists (could be deleted since last selection) : int ii; - for( ii = 0; ii < m_Pcb->GetAreaCount(); ii++ ) + for( ii = 0; ii < GetBoard()->GetAreaCount(); ii++ ) { - if( s_CurrentZone == m_Pcb->GetArea( ii ) ) + if( s_CurrentZone == GetBoard()->GetArea( ii ) ) break; } - if( ii >= m_Pcb->GetAreaCount() ) // Not found: could be deleted since last selection + if( ii >= GetBoard()->GetAreaCount() ) // Not found: could be deleted since last selection { s_AddCutoutToCurrentZone = false; s_CurrentZone = NULL; } // If no zone contour in progress, a new zone is beeing created: - if( m_Pcb->m_CurrentZoneContour == NULL ) - m_Pcb->m_CurrentZoneContour = new ZONE_CONTAINER( m_Pcb ); + if( GetBoard()->m_CurrentZoneContour == NULL ) + GetBoard()->m_CurrentZoneContour = new ZONE_CONTAINER( GetBoard() ); - ZONE_CONTAINER* zone = m_Pcb->m_CurrentZoneContour; + ZONE_CONTAINER* zone = GetBoard()->m_CurrentZoneContour; if( zone->GetNumCorners() == 0 ) /* Start a new contour: init zone params (net, layer ...) */ { if( s_CurrentZone == NULL ) // A new outline is created, from scratch @@ -639,10 +639,10 @@ bool WinEDA_PcbFrame::End_Zone( wxDC* DC ) * terminates (if no DRC error ) the zone edge creation process * @param DC = current Device Context * @return true if Ok, false if DRC error - * if ok, put it in the main list m_Pcb->m_ZoneDescriptorList (a vector) + * if ok, put it in the main list GetBoard()->m_ZoneDescriptorList (a vector) */ { - ZONE_CONTAINER* zone = m_Pcb->m_CurrentZoneContour; + ZONE_CONTAINER* zone = GetBoard()->m_CurrentZoneContour; if( zone == NULL ) return true; @@ -678,15 +678,15 @@ bool WinEDA_PcbFrame::End_Zone( wxDC* DC ) // Undraw old drawings, because they can have important changes int layer = zone->GetLayer(); - m_Pcb->RedrawAreasOutlines( DrawPanel, DC, GR_XOR, layer ); - m_Pcb->RedrawFilledAreas( DrawPanel, DC, GR_XOR, layer ); + GetBoard()->RedrawAreasOutlines( DrawPanel, DC, GR_XOR, layer ); + GetBoard()->RedrawFilledAreas( DrawPanel, DC, GR_XOR, layer ); /* Put edges in list */ if( s_CurrentZone == NULL ) { zone->m_Poly->Close(); // Close the current corner list - m_Pcb->Add( zone ); - m_Pcb->m_CurrentZoneContour = NULL; + GetBoard()->Add( zone ); + GetBoard()->m_CurrentZoneContour = NULL; } else // Append this outline as a cutout to an existing zone { @@ -706,16 +706,16 @@ bool WinEDA_PcbFrame::End_Zone( wxDC* DC ) GetScreen()->SetCurItem( NULL ); // This outine can be deleted when merging outlines // Combine zones if possible : - m_Pcb->AreaPolygonModified( zone, true, verbose ); + GetBoard()->AreaPolygonModified( zone, true, verbose ); // Redraw the real edge zone : - m_Pcb->RedrawAreasOutlines( DrawPanel, DC, GR_OR, layer ); - m_Pcb->RedrawFilledAreas( DrawPanel, DC, GR_OR, layer ); + GetBoard()->RedrawAreasOutlines( DrawPanel, DC, GR_OR, layer ); + GetBoard()->RedrawFilledAreas( DrawPanel, DC, GR_OR, layer ); - int ii = m_Pcb->GetAreaIndex( zone ); // test if zone_container exists + int ii = GetBoard()->GetAreaIndex( zone ); // test if zone_container exists if( ii < 0 ) zone = NULL; // was removed by combining zones - int error_count = m_Pcb->Test_Drc_Areas_Outlines_To_Areas_Outlines( zone, true ); + int error_count = GetBoard()->Test_Drc_Areas_Outlines_To_Areas_Outlines( zone, true ); if( error_count ) { DisplayError( this, _( "Area: DRC outline error" ) ); @@ -735,7 +735,7 @@ static void Show_New_Edge_While_Move_Mouse( WinEDA_DrawPanel* panel, wxDC* DC, b { WinEDA_PcbFrame* pcbframe = (WinEDA_PcbFrame*) panel->m_Parent; wxPoint c_pos = pcbframe->GetScreen()->m_Curseur; - ZONE_CONTAINER* zone = pcbframe->m_Pcb->m_CurrentZoneContour; + ZONE_CONTAINER* zone = pcbframe->GetBoard()->m_CurrentZoneContour; if( zone == NULL ) return; @@ -792,23 +792,23 @@ void WinEDA_PcbFrame::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container return; // Undraw old zone outlines - for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ ) + for( int ii = 0; ii < GetBoard()->GetAreaCount(); ii++ ) { - ZONE_CONTAINER* edge_zone = m_Pcb->GetArea( ii ); + ZONE_CONTAINER* edge_zone = GetBoard()->GetArea( ii ); edge_zone->Draw( DrawPanel, DC, GR_XOR ); } g_Zone_Default_Setting.ExportSetting( *zone_container); - EQUIPOT* net = m_Pcb->FindNet( g_Zone_Default_Setting.m_NetcodeSelection ); + EQUIPOT* net = GetBoard()->FindNet( g_Zone_Default_Setting.m_NetcodeSelection ); if( net ) // net === NULL should not occur zone_container->m_Netname = net->GetNetname(); // Combine zones if possible : - m_Pcb->AreaPolygonModified( zone_container, true, verbose ); + GetBoard()->AreaPolygonModified( zone_container, true, verbose ); // Redraw the real new zone outlines: - m_Pcb->RedrawAreasOutlines( DrawPanel, DC, GR_OR, -1 ); + GetBoard()->RedrawAreasOutlines( DrawPanel, DC, GR_OR, -1 ); GetScreen()->SetModify(); } @@ -835,7 +835,7 @@ void WinEDA_PcbFrame::Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_contai Delete_Zone_Fill( DC, NULL, zone_container->m_TimeStamp ); // Remove fill segments if( ncont == 0 ) // This is the main outline: remove all - m_Pcb->Delete( zone_container ); + GetBoard()->Delete( zone_container ); else { @@ -866,7 +866,7 @@ int WinEDA_PcbFrame::Fill_Zone( wxDC* DC, ZONE_CONTAINER* zone_container, bool v wxString msg; MsgPanel->EraseMsgBox(); - if( m_Pcb->ComputeBoundaryBox() == FALSE ) + if( GetBoard()->ComputeBoundaryBox() == FALSE ) { if( verbose ) DisplayError( this, wxT( "Board is empty!" ), 10 ); @@ -886,7 +886,7 @@ int WinEDA_PcbFrame::Fill_Zone( wxDC* DC, ZONE_CONTAINER* zone_container, bool v if( g_HightLigth_NetCode > 0 ) { - EQUIPOT* net = m_Pcb->FindNet( g_HightLigth_NetCode ); + EQUIPOT* net = GetBoard()->FindNet( g_HightLigth_NetCode ); if( net == NULL ) { if( g_HightLigth_NetCode > 0 ) @@ -908,7 +908,7 @@ int WinEDA_PcbFrame::Fill_Zone( wxDC* DC, ZONE_CONTAINER* zone_container, bool v int error_level = 0; zone_container->m_FilledPolysList.clear(); Delete_Zone_Fill( NULL, NULL, zone_container->m_TimeStamp ); - zone_container->BuildFilledPolysListData( m_Pcb ); + zone_container->BuildFilledPolysListData( GetBoard() ); if ( DC ) DrawPanel->Refresh(); @@ -933,11 +933,11 @@ int WinEDA_PcbFrame::Fill_All_Zones( bool verbose ) int error_level = 0; // Remove all zones : - m_Pcb->m_Zone.DeleteAll(); + GetBoard()->m_Zone.DeleteAll(); - for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ ) + for( int ii = 0; ii < GetBoard()->GetAreaCount(); ii++ ) { - zone_container = m_Pcb->GetArea( ii ); + zone_container = GetBoard()->GetArea( ii ); error_level = Fill_Zone( NULL, zone_container, verbose ); if( error_level && !verbose ) break; diff --git a/pcbnew/zones_non_copper_type_functions.cpp b/pcbnew/zones_non_copper_type_functions.cpp index 6b585e3798..761a4c8622 100644 --- a/pcbnew/zones_non_copper_type_functions.cpp +++ b/pcbnew/zones_non_copper_type_functions.cpp @@ -95,7 +95,7 @@ void DialogNonCopperZonesEditor::InitDialog( wxInitDialogEvent& event ) { wxString msg; - msg = m_Parent->m_Pcb->GetLayerName( layer_number ).Trim(); + msg = m_Parent->GetBoard()->GetLayerName( layer_number ).Trim(); m_LayerSelectionCtrl->InsertItems( 1, &msg, ii ); if( m_Zone_Container ) diff --git a/share/wxprint.cpp b/share/wxprint.cpp index a6652d7edb..9d48babbae 100644 --- a/share/wxprint.cpp +++ b/share/wxprint.cpp @@ -200,7 +200,7 @@ void WinEDA_PrintFrame::SetOthersDatas() { m_BoxSelecLayer[ii] = new wxCheckBox( this, -1, #if defined (PCBNEW) - ( (WinEDA_PcbFrame*) m_Parent )->m_Pcb->GetLayerName( + ( (WinEDA_PcbFrame*) m_Parent )->GetBoard()->GetLayerName( ii ) ); #else ReturnLayerName( ii ) ); @@ -690,22 +690,22 @@ void EDA_Printout::DrawPage() #ifdef PCBNEW WinEDA_BasePcbFrame* pcbframe = (WinEDA_BasePcbFrame*) m_Parent; - pcbframe->m_Pcb->ComputeBoundaryBox(); + pcbframe->GetBoard()->ComputeBoundaryBox(); /* Compute the PCB size in internal units*/ userscale = s_ScaleList[s_Scale_Select]; if( userscale == 0 ) // fit in page { int extra_margin = 8000; // Margin = 8000/2 units pcb = 0,4 inch - SheetSize.x = pcbframe->m_Pcb->m_BoundaryBox.GetWidth() + extra_margin; - SheetSize.y = pcbframe->m_Pcb->m_BoundaryBox.GetHeight() + extra_margin; + SheetSize.x = pcbframe->GetBoard()->m_BoundaryBox.GetWidth() + extra_margin; + SheetSize.y = pcbframe->GetBoard()->m_BoundaryBox.GetHeight() + extra_margin; userscale = 0.99; } if( (s_ScaleList[s_Scale_Select] > 1.0) // scale > 1 -> Recadrage || (s_ScaleList[s_Scale_Select] == 0) ) // fit in page { - DrawOffset.x += pcbframe->m_Pcb->m_BoundaryBox.Centre().x; - DrawOffset.y += pcbframe->m_Pcb->m_BoundaryBox.Centre().y; + DrawOffset.x += pcbframe->GetBoard()->m_BoundaryBox.Centre().x; + DrawOffset.y += pcbframe->GetBoard()->m_BoundaryBox.Centre().y; } #else userscale = 1; @@ -818,7 +818,7 @@ void EDA_Printout::DrawPage() * for scales > 1, the DrawOffset was already computed to have the board centre * to the middle of the page. */ - wxPoint pcb_centre = pcbframe->m_Pcb->m_BoundaryBox.Centre(); + wxPoint pcb_centre = pcbframe->GetBoard()->m_BoundaryBox.Centre(); if( userscale <= 1.0 ) DrawOffset.y += pcb_centre.y - (ysize / 2); ActiveScreen->m_DrawOrg = DrawOffset;