void Change_Side_Module( MODULE* Module, wxDC* DC ) is now member of class BOARD (as asked in todo list)

This commit is contained in:
CHARRAS 2008-01-25 13:16:24 +00:00
parent f50ec6e0b8
commit 9ba9be706e
13 changed files with 57 additions and 48 deletions

View File

@ -4,6 +4,14 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2008-Jan-25 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+pcbnew:
void Change_Side_Module( MODULE* Module, wxDC* DC ) is now member of class BOARD.
2008-Jan-24 UPDATE Dick Hollenbeck <dick@softplc.com> 2008-Jan-24 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
+pcbnew: +pcbnew:

View File

@ -187,7 +187,6 @@ public:
MODULE* module, MODULE* module,
int angle, int angle,
bool incremental ); bool incremental );
void Change_Side_Module( MODULE* Module, wxDC* DC );
void Place_Module( MODULE* module, wxDC* DC ); void Place_Module( MODULE* module, wxDC* DC );
void InstallExchangeModuleFrame( MODULE* ExchangeModuleModule, void InstallExchangeModuleFrame( MODULE* ExchangeModuleModule,
wxDC* DC, const wxPoint& pos ); wxDC* DC, const wxPoint& pos );

View File

@ -801,7 +801,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
Place_Module( module, NULL ); Place_Module( module, NULL );
/* inversion du module */ /* inversion du module */
Change_Side_Module( module, DC ); m_Pcb->Change_Side_Module( module, DC );
/* regeneration des valeurs originelles */ /* regeneration des valeurs originelles */
GetScreen()->m_Curseur = memo; GetScreen()->m_Curseur = memo;

View File

@ -246,6 +246,11 @@ public:
#endif #endif
/**************************/
/* footprint operations : */
/**************************/
void Change_Side_Module( MODULE* Module, wxDC* DC );
/*************************/ /*************************/
/* Copper Areas handling */ /* Copper Areas handling */
/*************************/ /*************************/

View File

@ -525,7 +525,7 @@ void WinEDA_ModulePropertiesFrame::OnOkClick( wxCommandEvent& event )
if( change_layer ) if( change_layer )
{ {
m_Parent->Change_Side_Module( m_CurrentModule, m_DC ); m_Parent->m_Pcb->Change_Side_Module( m_CurrentModule, m_DC );
} }
if( m_AutoPlaceCtrl->GetSelection() == 1 ) if( m_AutoPlaceCtrl->GetSelection() == 1 )

View File

@ -618,7 +618,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
SetCurItem( GetCurItem()->GetParent() ); SetCurItem( GetCurItem()->GetParent() );
if( !GetCurItem() || GetCurItem()->Type() != TYPEMODULE ) if( !GetCurItem() || GetCurItem()->Type() != TYPEMODULE )
break; break;
Change_Side_Module( (MODULE*) GetCurItem(), &dc ); m_Pcb->Change_Side_Module( (MODULE*) GetCurItem(), &dc );
break; break;
case ID_POPUP_PCB_EDIT_MODULE: case ID_POPUP_PCB_EDIT_MODULE:

View File

@ -103,7 +103,7 @@ void WinEDA_PcbFrame::ExportToGenCAD( wxCommandEvent& event )
module->flag = 0; module->flag = 0;
if( module->GetLayer() == COPPER_LAYER_N ) if( module->GetLayer() == COPPER_LAYER_N )
{ {
Change_Side_Module( module, NULL ); m_Pcb->Change_Side_Module( module, NULL );
module->flag = 1; module->flag = 1;
} }
} }
@ -135,7 +135,7 @@ void WinEDA_PcbFrame::ExportToGenCAD( wxCommandEvent& event )
{ {
if( module->flag ) if( module->flag )
{ {
Change_Side_Module( module, NULL ); m_Pcb->Change_Side_Module( module, NULL );
module->flag = 0; module->flag = 0;
} }
} }

View File

@ -507,7 +507,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
break; break;
case HK_FLIP_FOOTPRINT: // move to other side case HK_FLIP_FOOTPRINT: // move to other side
Change_Side_Module( module, DC ); m_Pcb->Change_Side_Module( module, DC );
break; break;
case HK_DRAG_FOOTPRINT: // Start move (and drag) module case HK_DRAG_FOOTPRINT: // Start move (and drag) module

View File

@ -80,7 +80,7 @@ void WinEDA_ModuleEditFrame::Load_Module_Module_From_BOARD( MODULE* Module )
m_CurrentScreen->m_Curseur.x = m_CurrentScreen->m_Curseur.y = 0; m_CurrentScreen->m_Curseur.x = m_CurrentScreen->m_Curseur.y = 0;
Place_Module( Module, NULL ); Place_Module( Module, NULL );
if( Module->GetLayer() != CMP_N ) if( Module->GetLayer() != CMP_N )
Change_Side_Module( Module, NULL ); m_Pcb->Change_Side_Module( Module, NULL );
Rotate_Module( NULL, Module, 0, FALSE ); Rotate_Module( NULL, Module, 0, FALSE );
m_CurrentScreen->ClrModify(); m_CurrentScreen->ClrModify();
Zoom_Automatique( TRUE ); Zoom_Automatique( TRUE );

View File

@ -193,7 +193,7 @@ void Exit_Module( WinEDA_DrawPanel* Panel, wxDC* DC )
if( ModuleInitOrient != module->m_Orient ) if( ModuleInitOrient != module->m_Orient )
pcbframe->Rotate_Module( NULL, module, ModuleInitOrient, FALSE ); pcbframe->Rotate_Module( NULL, module, ModuleInitOrient, FALSE );
if( ModuleInitLayer != module->GetLayer() ) if( ModuleInitLayer != module->GetLayer() )
pcbframe->Change_Side_Module( module, NULL ); pcbframe->m_Pcb->Change_Side_Module( module, NULL );
module->Draw( Panel, DC, wxPoint( 0, 0 ), GR_OR ); module->Draw( Panel, DC, wxPoint( 0, 0 ), GR_OR );
} }
g_Drag_Pistes_On = FALSE; g_Drag_Pistes_On = FALSE;
@ -320,14 +320,18 @@ bool WinEDA_PcbFrame::Delete_Module( MODULE* module, wxDC* DC )
} }
/**********************************************************************/ /****************************************************************************/
void WinEDA_BasePcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC ) void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC )
/**********************************************************************/ /****************************************************************************/
/* Change de cote un composant : il y a inversion MIROIR autour de l'axe X /**
* Le changement n'est fait que si la couche est * Function Change_Side_Module
* - CUIVRE ou CMP * Filp a footprint (switch layer from component or component to copper)
* Si DC == NULL, il n'y a pas de redessin du composant et du chevelu * The mirroring is made from X axis
* if a footprint is not on copper or component layer it is not flipped
* (it could be on an adhesive layer, not supported at this time)
* @param Module the footprint to fli^p
* @param DC Current Device Context. if NULL, no redraw
*/ */
{ {
D_PAD* pt_pad; D_PAD* pt_pad;
@ -340,17 +344,17 @@ void WinEDA_BasePcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
if( (Module->GetLayer() != CMP_N) && (Module->GetLayer() != COPPER_LAYER_N) ) if( (Module->GetLayer() != CMP_N) && (Module->GetLayer() != COPPER_LAYER_N) )
return; return;
m_CurrentScreen->SetModify(); m_PcbFrame->GetScreen()->SetModify();
if( !(Module->m_Flags & IS_MOVED) ) if( !(Module->m_Flags & IS_MOVED) )
{ {
m_Pcb->m_Status_Pcb &= ~( LISTE_CHEVELU_OK | CONNEXION_OK); m_Status_Pcb &= ~( LISTE_CHEVELU_OK | CONNEXION_OK);
if( DC ) if( DC && m_PcbFrame )
Module->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR ); Module->Draw( m_PcbFrame->DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
/* Effacement chevelu general si necessaire */ /* Effacement chevelu general si necessaire */
if( DC && g_Show_Ratsnest ) if( DC && g_Show_Ratsnest )
DrawGeneralRatsnest( DC ); m_PcbFrame->DrawGeneralRatsnest( DC );
/* Init des variables utilisees dans la routine Dessine_Drag_segment() */ /* Init des variables utilisees dans la routine Dessine_Drag_segment() */
g_Offset_Module.x = 0; g_Offset_Module.x = 0;
@ -359,10 +363,10 @@ void WinEDA_BasePcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
else // Module en deplacement else // Module en deplacement
{ {
/* efface empreinte ( vue en contours) si elle a ete deja dessinee */ /* efface empreinte ( vue en contours) si elle a ete deja dessinee */
if( DC ) if( DC && m_PcbFrame )
{ {
DrawModuleOutlines( DrawPanel, DC, Module ); DrawModuleOutlines( m_PcbFrame->DrawPanel, DC, Module );
Dessine_Segments_Dragges( DrawPanel, DC ); Dessine_Segments_Dragges( m_PcbFrame->DrawPanel, DC );
} }
} }
@ -485,33 +489,34 @@ void WinEDA_BasePcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
break; break;
default: default:
DisplayError( this, wxT( "Unknown Draw Type" ) ); break; DisplayError( m_PcbFrame, wxT( "Unknown Draw Type" ) ); break;
} }
} }
/* calcul du rectangle d'encadrement */ /* calcul du rectangle d'encadrement */
Module->Set_Rectangle_Encadrement(); Module->Set_Rectangle_Encadrement();
Module->Display_Infos( this ); if ( m_PcbFrame )
Module->Display_Infos( m_PcbFrame );
if( !(Module->m_Flags & IS_MOVED) ) /* Inversion simple */ if( !(Module->m_Flags & IS_MOVED) ) /* Inversion simple */
{ {
if( DC ) if( DC && m_PcbFrame )
{ {
Module->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR ); Module->Draw( m_PcbFrame->DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
/* affichage chevelu general si necessaire */ /* affichage chevelu general si necessaire */
ReCompile_Ratsnest_After_Changes( DC ); m_PcbFrame->ReCompile_Ratsnest_After_Changes( DC );
} }
} }
else else
{ {
if( DC ) if( DC && m_PcbFrame )
{ {
DrawModuleOutlines( DrawPanel, DC, Module ); DrawModuleOutlines( m_PcbFrame->DrawPanel, DC, Module );
Dessine_Segments_Dragges( DrawPanel, DC ); Dessine_Segments_Dragges( m_PcbFrame->DrawPanel, DC );
} }
m_Pcb->m_Status_Pcb &= ~CHEVELU_LOCAL_OK; m_Status_Pcb &= ~CHEVELU_LOCAL_OK;
} }
} }

View File

@ -76,7 +76,7 @@ void WinEDA_PcbFrame::ExportToSPECCTRA( wxCommandEvent& event )
module->flag = 0; module->flag = 0;
if( module->GetLayer() == COPPER_LAYER_N ) if( module->GetLayer() == COPPER_LAYER_N )
{ {
Change_Side_Module( module, NULL ); m_Pcb->Change_Side_Module( module, NULL );
module->flag = 1; module->flag = 1;
} }
} }
@ -103,7 +103,7 @@ void WinEDA_PcbFrame::ExportToSPECCTRA( wxCommandEvent& event )
{ {
if( module->flag ) if( module->flag )
{ {
Change_Side_Module( module, NULL ); m_Pcb->Change_Side_Module( module, NULL );
module->flag = 0; module->flag = 0;
} }
} }
@ -242,7 +242,8 @@ static void makePADSTACKs( BOARD* aBoard, TYPE_COLLECTOR& aPads,
{ {
if( aPads.GetCount() ) if( aPads.GetCount() )
{ {
qsort( (void*) aPads.BasePtr(), aPads.GetCount(), sizeof(D_PAD*), Pad_list_Sort_by_Shapes ); #warning "uncomment next line asap"
//JPC qsort( (void*) aPads.BasePtr(), aPads.GetCount(), sizeof(D_PAD*), Pad_list_Sort_by_Shapes );
} }
D_PAD* old_pad = NULL; D_PAD* old_pad = NULL;
@ -591,8 +592,10 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
makePADSTACKs( aBoard, pads, pcb->library, pcb->library->padstacks ); makePADSTACKs( aBoard, pads, pcb->library, pcb->library->padstacks );
#if defined(DEBUG)
for( int p=0; p<pads.GetCount(); ++p ) for( int p=0; p<pads.GetCount(); ++p )
pads[p]->Show( 0, std::cout ); pads[p]->Show( 0, std::cout );
#endif
/* /*
static const KICAD_T scanMODULEs[] = { TYPEMODULE, EOT }; static const KICAD_T scanMODULEs[] = { TYPEMODULE, EOT };

View File

@ -538,7 +538,7 @@ MODULE* WinEDA_BasePcbFrame::Exchange_Module( wxWindow* winaff,
/* Changement eventuel de couche */ /* Changement eventuel de couche */
if( OldModule->GetLayer() != NewModule->GetLayer() ) if( OldModule->GetLayer() != NewModule->GetLayer() )
{ {
Change_Side_Module( NewModule, NULL ); m_Pcb->Change_Side_Module( NewModule, NULL );
} }
/* Rotation eventuelle du module */ /* Rotation eventuelle du module */

View File

@ -71,14 +71,3 @@ asked by: jp Charras
Use the collector classes in eeschema. Use the collector classes in eeschema.
2008-Jan-24 Assigned To: nobody
asked by: Dick Hollenbeck
================================================================================
See specctra.h's such comment
* @todo
* I would have liked to put the flipping logic into the ExportToSPECCTRA()
* function directly, but for some strange reason,
* void Change_Side_Module( MODULE* Module, wxDC* DC ) is a member of
* of class WinEDA_BasePcbFrame rather than class BOARD.
*