2007-08-10 19:14:51 +00:00
|
|
|
|
/********************************************************/
|
|
|
|
|
/* Modification de la place, orient, nombre des MODULES */
|
|
|
|
|
/********************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
/* Fichier MODULES.Cpp */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
|
#include "gr_basic.h"
|
|
|
|
|
#include "common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
|
#include "class_drawpanel.h"
|
|
|
|
|
#include "confirm.h"
|
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
#include "pcbnew.h"
|
|
|
|
|
#include "trigo.h"
|
|
|
|
|
|
|
|
|
|
#include "protos.h"
|
|
|
|
|
|
|
|
|
|
#include "drag.h"
|
|
|
|
|
|
|
|
|
|
/* fonctions externes */
|
|
|
|
|
|
|
|
|
|
/* Fonctions locales */
|
2007-08-10 19:14:51 +00:00
|
|
|
|
static int ChangeSideMaskLayer( int masque );
|
2008-08-06 07:46:03 +00:00
|
|
|
|
static void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
/* Variables locales : */
|
2007-08-10 19:14:51 +00:00
|
|
|
|
static int ModuleInitOrient; // Lors des moves, val init de l'orient (pour annulation)
|
|
|
|
|
static int ModuleInitLayer; // Lors des moves, val init de la couche (pour annulation)
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
2007-08-10 19:14:51 +00:00
|
|
|
|
void Show_Pads_On_Off( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/**************************************************************************/
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/* Fonction appelee lors de l'activation/desactivation de la visualisation
|
2007-08-10 19:14:51 +00:00
|
|
|
|
* des Pads du module en deplacement
|
|
|
|
|
* Effacement ou visu des Pads selon conditions initiales
|
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
2007-08-10 19:14:51 +00:00
|
|
|
|
D_PAD* pt_pad;
|
|
|
|
|
bool pad_fill_tmp;
|
|
|
|
|
|
|
|
|
|
if( module == 0 )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
pad_fill_tmp = DisplayOpt.DisplayPadFill;
|
2009-05-21 17:42:42 +00:00
|
|
|
|
DisplayOpt.DisplayPadFill = true; /* Trace en SKETCH */
|
2007-08-10 19:14:51 +00:00
|
|
|
|
pt_pad = module->m_Pads;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
|
2007-08-10 19:14:51 +00:00
|
|
|
|
{
|
2008-04-01 05:21:50 +00:00
|
|
|
|
pt_pad->Draw( panel, DC, GR_XOR, g_Offset_Module );
|
2007-08-10 19:14:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DisplayOpt.DisplayPadFill = pad_fill_tmp;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/***************************************************************************/
|
|
|
|
|
/* Fonction appelee lors de l'activation/desactivation de la visualisation */
|
|
|
|
|
/* du rastnest du module en deplacement */
|
|
|
|
|
/* Effacement ou visu du rastnest selon conditions initiales */
|
|
|
|
|
/***************************************************************************/
|
2007-08-10 19:14:51 +00:00
|
|
|
|
void Rastnest_On_Off( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
2007-08-10 19:14:51 +00:00
|
|
|
|
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->m_Parent;
|
|
|
|
|
|
|
|
|
|
frame->build_ratsnest_module( DC, module );
|
|
|
|
|
frame->trace_ratsnest_module( DC );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/***************************************************/
|
2007-09-01 12:00:30 +00:00
|
|
|
|
MODULE* WinEDA_BasePcbFrame::GetModuleByName()
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/***************************************************/
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/* Get a module name from user and return a pointer to the corresponding module
|
2007-08-10 19:14:51 +00:00
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
2007-08-10 19:14:51 +00:00
|
|
|
|
wxString modulename;
|
|
|
|
|
MODULE* module = NULL;
|
|
|
|
|
|
2008-10-05 10:56:43 +00:00
|
|
|
|
Get_Message( _( "Name:" ), _("Search footprint"), modulename, this );
|
2007-08-10 19:14:51 +00:00
|
|
|
|
if( !modulename.IsEmpty() )
|
|
|
|
|
{
|
2009-01-05 05:21:35 +00:00
|
|
|
|
module = GetBoard()->m_Modules;
|
2007-08-10 19:14:51 +00:00
|
|
|
|
while( module )
|
|
|
|
|
{
|
|
|
|
|
if( module->m_Reference->m_Text.CmpNoCase( modulename ) == 0 )
|
|
|
|
|
break;
|
|
|
|
|
module = module->Next();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return module;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/**********************************************************************/
|
2007-08-10 19:14:51 +00:00
|
|
|
|
void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/**********************************************************************/
|
|
|
|
|
{
|
2007-08-10 19:14:51 +00:00
|
|
|
|
if( module == NULL )
|
|
|
|
|
return;
|
|
|
|
|
|
2007-09-12 02:14:07 +00:00
|
|
|
|
SetCurItem( module );
|
2009-05-24 18:28:36 +00:00
|
|
|
|
GetBoard()->m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK;
|
2007-08-10 19:14:51 +00:00
|
|
|
|
module->m_Flags |= IS_MOVED;
|
|
|
|
|
ModuleInitOrient = module->m_Orient;
|
2007-08-23 04:28:46 +00:00
|
|
|
|
ModuleInitLayer = module->GetLayer();
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
|
|
|
|
/* Effacement chevelu general si necessaire */
|
|
|
|
|
if( g_Show_Ratsnest )
|
|
|
|
|
DrawGeneralRatsnest( DC );
|
|
|
|
|
|
|
|
|
|
if( g_DragSegmentList ) /* Anormal ! */
|
|
|
|
|
{
|
|
|
|
|
EraseDragListe();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( g_Drag_Pistes_On )
|
|
|
|
|
{
|
|
|
|
|
Build_Drag_Liste( DrawPanel, DC, module );
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
|
GetBoard()->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST;
|
2007-08-10 19:14:51 +00:00
|
|
|
|
DrawPanel->ManageCurseur = Montre_Position_Empreinte;
|
2008-08-06 07:46:03 +00:00
|
|
|
|
DrawPanel->ForceCloseManageCurseur = Abort_MoveOrCopyModule;
|
2007-08-10 19:14:51 +00:00
|
|
|
|
DrawPanel->m_AutoPAN_Request = TRUE;
|
|
|
|
|
|
|
|
|
|
// effacement module a l'ecran:
|
2008-08-06 07:46:03 +00:00
|
|
|
|
if( DC )
|
2008-04-01 05:21:50 +00:00
|
|
|
|
{
|
|
|
|
|
int tmp = module->m_Flags;
|
|
|
|
|
module->m_Flags |= DO_NOT_DRAW;
|
|
|
|
|
DrawPanel->PostDirtyRect( module->GetBoundingBox() );
|
|
|
|
|
module->m_Flags = tmp;
|
|
|
|
|
}
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
|
|
|
|
// Reaffichage
|
|
|
|
|
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
2008-08-06 07:46:03 +00:00
|
|
|
|
/**************************************************************/
|
|
|
|
|
void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC )
|
|
|
|
|
/****************************************************************/
|
|
|
|
|
|
|
|
|
|
/* Called on a move or copy module command abort
|
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
2007-08-10 19:14:51 +00:00
|
|
|
|
DRAG_SEGM* pt_drag;
|
|
|
|
|
TRACK* pt_segm;
|
|
|
|
|
MODULE* module;
|
|
|
|
|
WinEDA_BasePcbFrame* pcbframe = (WinEDA_BasePcbFrame*) Panel->m_Parent;
|
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
|
module = (MODULE*) pcbframe->GetScreen()->GetCurItem();
|
2009-05-24 18:28:36 +00:00
|
|
|
|
pcbframe->GetBoard()->m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK;
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
|
|
|
|
if( module )
|
|
|
|
|
{
|
2008-08-06 07:46:03 +00:00
|
|
|
|
// Erase the current footprint on screen
|
2007-08-10 19:14:51 +00:00
|
|
|
|
DrawModuleOutlines( Panel, DC, module );
|
2008-08-06 07:46:03 +00:00
|
|
|
|
|
|
|
|
|
/* If a move command: return to old position
|
|
|
|
|
* If a copy command, delete the new footprint
|
|
|
|
|
*/
|
|
|
|
|
if( module->m_Flags & IS_MOVED ) // Move command
|
2007-08-10 19:14:51 +00:00
|
|
|
|
{
|
|
|
|
|
if( g_Drag_Pistes_On )
|
|
|
|
|
{
|
2008-08-06 07:46:03 +00:00
|
|
|
|
/* Erase on screen dragged tracks */
|
2007-08-10 19:14:51 +00:00
|
|
|
|
pt_drag = g_DragSegmentList;
|
|
|
|
|
for( ; pt_drag != NULL; pt_drag = pt_drag->Pnext )
|
|
|
|
|
{
|
|
|
|
|
pt_segm = pt_drag->m_Segm;
|
|
|
|
|
pt_segm->Draw( Panel, DC, GR_XOR );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-08-06 07:46:03 +00:00
|
|
|
|
/* Go to old position for dragged tracks */
|
2007-08-10 19:14:51 +00:00
|
|
|
|
pt_drag = g_DragSegmentList;
|
|
|
|
|
for( ; pt_drag != NULL; pt_drag = pt_drag->Pnext )
|
|
|
|
|
{
|
|
|
|
|
pt_segm = pt_drag->m_Segm; pt_segm->SetState( EDIT, OFF );
|
|
|
|
|
pt_drag->SetInitialValues();
|
|
|
|
|
pt_segm->Draw( Panel, DC, GR_OR );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EraseDragListe();
|
|
|
|
|
module->m_Flags = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2009-06-11 14:26:17 +00:00
|
|
|
|
if( (module->m_Flags & IS_NEW) ) // Copy command: delete new footprint
|
2007-08-10 19:14:51 +00:00
|
|
|
|
{
|
2008-08-06 07:46:03 +00:00
|
|
|
|
module->DeleteStructure();
|
2007-08-10 19:14:51 +00:00
|
|
|
|
module = NULL;
|
2009-01-05 05:21:35 +00:00
|
|
|
|
pcbframe->GetBoard()->m_Status_Pcb = 0;
|
2009-06-11 14:26:17 +00:00
|
|
|
|
pcbframe->GetBoard()->m_NetInfo->BuildListOfNets();
|
2007-08-10 19:14:51 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Reaffichage du module a l'ecran */
|
|
|
|
|
if( module )
|
|
|
|
|
{
|
|
|
|
|
if( ModuleInitOrient != module->m_Orient )
|
|
|
|
|
pcbframe->Rotate_Module( NULL, module, ModuleInitOrient, FALSE );
|
2007-08-23 04:28:46 +00:00
|
|
|
|
if( ModuleInitLayer != module->GetLayer() )
|
2009-01-05 05:21:35 +00:00
|
|
|
|
pcbframe->GetBoard()->Change_Side_Module( module, NULL );
|
2008-04-01 05:21:50 +00:00
|
|
|
|
module->Draw( Panel, DC, GR_OR );
|
2007-08-10 19:14:51 +00:00
|
|
|
|
}
|
|
|
|
|
g_Drag_Pistes_On = FALSE;
|
|
|
|
|
Panel->ManageCurseur = NULL;
|
|
|
|
|
Panel->ForceCloseManageCurseur = NULL;
|
2007-09-12 02:14:07 +00:00
|
|
|
|
pcbframe->SetCurItem( NULL );
|
2008-08-06 07:46:03 +00:00
|
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
|
pcbframe->GetBoard()->m_Status_Pcb &= ~DO_NOT_SHOW_GENERAL_RASTNEST; // Display ratsnest is allowed
|
2008-08-06 07:46:03 +00:00
|
|
|
|
if( g_Show_Ratsnest )
|
|
|
|
|
pcbframe->DrawGeneralRatsnest( DC );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************/
|
2007-08-10 19:14:51 +00:00
|
|
|
|
MODULE* WinEDA_BasePcbFrame::Copie_Module( MODULE* module )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/**********************************************************/
|
2008-08-06 07:46:03 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Function Copie_Module
|
|
|
|
|
* Copy an existing footprint. The ne footprint is added in module list
|
|
|
|
|
* @param module = footprint to copy
|
|
|
|
|
* @return a pointer on the new footprint (the copy of the existing footprint)
|
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
2007-08-10 19:14:51 +00:00
|
|
|
|
MODULE* newmodule;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
if( module == NULL )
|
|
|
|
|
return NULL;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
|
GetScreen()->SetModify();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
/* Duplication du module */
|
2009-01-05 05:21:35 +00:00
|
|
|
|
GetBoard()->m_Status_Pcb = 0;
|
|
|
|
|
newmodule = new MODULE( GetBoard() );
|
2007-08-10 19:14:51 +00:00
|
|
|
|
newmodule->Copy( module );
|
2008-12-06 08:21:54 +00:00
|
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
|
GetBoard()->Add( newmodule, ADD_APPEND );
|
2008-12-06 08:21:54 +00:00
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
newmodule->m_Flags = IS_NEW;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2009-06-11 14:26:17 +00:00
|
|
|
|
GetBoard()->m_NetInfo->BuildListOfNets();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2009-04-17 08:51:02 +00:00
|
|
|
|
newmodule->DisplayInfo( this );
|
2009-05-24 18:28:36 +00:00
|
|
|
|
GetBoard()->m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK;
|
2007-08-10 19:14:51 +00:00
|
|
|
|
return newmodule;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/**********************************************************************************/
|
2007-08-10 19:14:51 +00:00
|
|
|
|
void Montre_Position_Empreinte( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/**********************************************************************************/
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/* redessin du contour de l'empreinte lors des deplacements de la souris
|
2007-08-10 19:14:51 +00:00
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
2008-04-17 16:25:29 +00:00
|
|
|
|
MODULE* module = (MODULE*) panel->GetScreen()->GetCurItem();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
if( module == NULL )
|
|
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
/* efface ancienne position */
|
|
|
|
|
if( erase )
|
|
|
|
|
{
|
|
|
|
|
DrawModuleOutlines( panel, DC, module );
|
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
/* Redessine le module a la nouvelle place */
|
2008-04-17 16:25:29 +00:00
|
|
|
|
g_Offset_Module = module->m_Pos - panel->GetScreen()->m_Curseur;
|
2007-08-10 19:14:51 +00:00
|
|
|
|
DrawModuleOutlines( panel, DC, module );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
Dessine_Segments_Dragges( panel, DC );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2008-03-22 18:08:44 +00:00
|
|
|
|
/*****************************************************************************************/
|
|
|
|
|
bool WinEDA_PcbFrame::Delete_Module( MODULE* module, wxDC* DC, bool aAskBeforeDeleting )
|
|
|
|
|
/******************************************************************************************/
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
2008-03-13 10:08:42 +00:00
|
|
|
|
/**
|
|
|
|
|
* Function Delete Module
|
|
|
|
|
* Remove a footprint from m_Modules linked list and put it in undelete buffer
|
|
|
|
|
* The net rastenes and pad list are recalcualed
|
|
|
|
|
* @param module = footprint to delete
|
|
|
|
|
* @param DC = currentDevice Context. if NULL: do not redraw new ratsnets and dirty rectange
|
2008-03-22 18:08:44 +00:00
|
|
|
|
* @param aPromptBeforeDeleting : if true: ask for confirmation before deleting
|
2007-08-10 19:14:51 +00:00
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
2007-08-10 19:14:51 +00:00
|
|
|
|
wxString msg;
|
|
|
|
|
|
|
|
|
|
/* Si l'empreinte est selectee , on ne peut pas l'effacer ! */
|
|
|
|
|
if( module == NULL )
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
/* Confirmation de l'effacement */
|
2009-04-17 08:51:02 +00:00
|
|
|
|
module->DisplayInfo( this );
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
2008-08-06 07:46:03 +00:00
|
|
|
|
if( aAskBeforeDeleting )
|
2007-08-10 19:14:51 +00:00
|
|
|
|
{
|
2008-03-22 18:08:44 +00:00
|
|
|
|
msg << _( "Delete Module" ) << wxT( " " ) << module->m_Reference->m_Text
|
|
|
|
|
<< wxT( " (" ) << _( "Value " ) << module->m_Value->m_Text
|
|
|
|
|
<< wxT( ") ?" );
|
|
|
|
|
if( !IsOK( this, msg ) )
|
|
|
|
|
{
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2007-08-10 19:14:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
|
GetScreen()->SetModify();
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
2008-03-13 10:08:42 +00:00
|
|
|
|
/* Erase rastnest if needed
|
2008-04-01 05:21:50 +00:00
|
|
|
|
* Dirty rectangle is not used here because usually using a XOR draw mode gives good results (very few artefacts) for ratsnest
|
|
|
|
|
*/
|
2007-08-10 19:14:51 +00:00
|
|
|
|
if( g_Show_Ratsnest )
|
|
|
|
|
DrawGeneralRatsnest( DC );
|
|
|
|
|
|
|
|
|
|
/* Sauvegarde en buffer des undelete */
|
|
|
|
|
SaveItemEfface( module, 1 );
|
|
|
|
|
|
2009-06-11 14:26:17 +00:00
|
|
|
|
Compile_Ratsnest( DC, true );
|
2008-08-06 07:46:03 +00:00
|
|
|
|
|
2008-03-13 10:08:42 +00:00
|
|
|
|
// redraw the area where the module was
|
2008-08-06 07:46:03 +00:00
|
|
|
|
if( DC )
|
2008-04-01 05:21:50 +00:00
|
|
|
|
DrawPanel->PostDirtyRect( module->GetBoundingBox() );
|
2007-08-10 19:14:51 +00:00
|
|
|
|
return TRUE;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
2008-01-25 13:16:24 +00:00
|
|
|
|
/****************************************************************************/
|
|
|
|
|
void BOARD::Change_Side_Module( MODULE* Module, wxDC* DC )
|
|
|
|
|
/****************************************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2008-03-22 18:08:44 +00:00
|
|
|
|
/**
|
2008-01-25 13:16:24 +00:00
|
|
|
|
* Function Change_Side_Module
|
|
|
|
|
* Filp a footprint (switch layer from component or component to copper)
|
|
|
|
|
* 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)
|
2008-03-13 21:18:05 +00:00
|
|
|
|
* @param Module the footprint to flip
|
2008-01-25 13:16:24 +00:00
|
|
|
|
* @param DC Current Device Context. if NULL, no redraw
|
2007-08-10 19:14:51 +00:00
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
2007-08-10 19:14:51 +00:00
|
|
|
|
D_PAD* pt_pad;
|
|
|
|
|
TEXTE_MODULE* pt_texte;
|
|
|
|
|
EDGE_MODULE* pt_edgmod;
|
|
|
|
|
EDA_BaseStruct* PtStruct;
|
|
|
|
|
|
|
|
|
|
if( Module == NULL )
|
|
|
|
|
return;
|
2007-10-07 18:24:15 +00:00
|
|
|
|
if( (Module->GetLayer() != CMP_N) && (Module->GetLayer() != COPPER_LAYER_N) )
|
2007-08-10 19:14:51 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2008-01-25 13:16:24 +00:00
|
|
|
|
m_PcbFrame->GetScreen()->SetModify();
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
|
|
|
|
if( !(Module->m_Flags & IS_MOVED) )
|
|
|
|
|
{
|
2009-05-24 18:28:36 +00:00
|
|
|
|
m_Status_Pcb &= ~( LISTE_RATSNEST_ITEM_OK | CONNEXION_OK);
|
2008-01-25 13:16:24 +00:00
|
|
|
|
if( DC && m_PcbFrame )
|
2008-04-01 05:21:50 +00:00
|
|
|
|
{
|
|
|
|
|
int tmp = Module->m_Flags;
|
|
|
|
|
Module->m_Flags |= DO_NOT_DRAW;
|
|
|
|
|
m_PcbFrame->DrawPanel->PostDirtyRect( Module->GetBoundingBox() );
|
|
|
|
|
Module->m_Flags = tmp;
|
|
|
|
|
}
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
|
|
|
|
/* Effacement chevelu general si necessaire */
|
|
|
|
|
if( DC && g_Show_Ratsnest )
|
2008-01-25 13:16:24 +00:00
|
|
|
|
m_PcbFrame->DrawGeneralRatsnest( DC );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
/* Init des variables utilisees dans la routine Dessine_Drag_segment() */
|
|
|
|
|
g_Offset_Module.x = 0;
|
|
|
|
|
g_Offset_Module.y = 0;
|
|
|
|
|
}
|
|
|
|
|
else // Module en deplacement
|
|
|
|
|
{
|
|
|
|
|
/* efface empreinte ( vue en contours) si elle a ete deja dessinee */
|
2008-01-25 13:16:24 +00:00
|
|
|
|
if( DC && m_PcbFrame )
|
2007-08-10 19:14:51 +00:00
|
|
|
|
{
|
2008-01-25 13:16:24 +00:00
|
|
|
|
DrawModuleOutlines( m_PcbFrame->DrawPanel, DC, Module );
|
|
|
|
|
Dessine_Segments_Dragges( m_PcbFrame->DrawPanel, DC );
|
2007-08-10 19:14:51 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* mise a jour du Flag de l'empreinte et des couches des contours et textes */
|
2007-08-23 04:28:46 +00:00
|
|
|
|
Module->SetLayer( ChangeSideNumLayer( Module->GetLayer() ) );
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
|
|
|
|
/* Inversion miroir de l'orientation */
|
|
|
|
|
Module->m_Orient = -Module->m_Orient;
|
|
|
|
|
NORMALIZE_ANGLE_POS( Module->m_Orient );
|
|
|
|
|
|
|
|
|
|
/* Inversion miroir + layers des pastilles */
|
|
|
|
|
pt_pad = Module->m_Pads;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
|
2007-08-10 19:14:51 +00:00
|
|
|
|
{
|
|
|
|
|
pt_pad->m_Pos.y -= Module->m_Pos.y;
|
|
|
|
|
pt_pad->m_Pos.y = -pt_pad->m_Pos.y;
|
|
|
|
|
pt_pad->m_Pos.y += Module->m_Pos.y;
|
|
|
|
|
pt_pad->m_Pos0.y = -pt_pad->m_Pos0.y;
|
|
|
|
|
pt_pad->m_Offset.y = -pt_pad->m_Offset.y;
|
|
|
|
|
pt_pad->m_DeltaSize.y = -pt_pad->m_DeltaSize.y;
|
|
|
|
|
NEGATE_AND_NORMALIZE_ANGLE_POS( pt_pad->m_Orient );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
/* change cote pour pastilles surfaciques */
|
|
|
|
|
pt_pad->m_Masque_Layer = ChangeSideMaskLayer( pt_pad->m_Masque_Layer );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Inversion miroir de la Reference et mise en miroir : */
|
|
|
|
|
pt_texte = Module->m_Reference;
|
|
|
|
|
pt_texte->m_Pos.y -= Module->m_Pos.y;
|
|
|
|
|
pt_texte->m_Pos.y = -pt_texte->m_Pos.y;
|
|
|
|
|
pt_texte->m_Pos.y += Module->m_Pos.y;
|
2008-12-22 21:06:44 +00:00
|
|
|
|
pt_texte->m_Pos0.y = -pt_texte->m_Pos0.y;
|
|
|
|
|
pt_texte->m_Mirror = false;
|
2007-08-10 19:14:51 +00:00
|
|
|
|
NEGATE_AND_NORMALIZE_ANGLE_POS( pt_texte->m_Orient );
|
2007-08-23 04:28:46 +00:00
|
|
|
|
pt_texte->SetLayer( Module->GetLayer() );
|
|
|
|
|
pt_texte->SetLayer( ChangeSideNumLayer( pt_texte->GetLayer() ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-10-07 18:24:15 +00:00
|
|
|
|
if( Module->GetLayer() == COPPER_LAYER_N )
|
2007-08-23 04:28:46 +00:00
|
|
|
|
pt_texte->SetLayer( SILKSCREEN_N_CU );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-08-23 04:28:46 +00:00
|
|
|
|
if( Module->GetLayer() == CMP_N )
|
|
|
|
|
pt_texte->SetLayer( SILKSCREEN_N_CMP );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-08-23 04:28:46 +00:00
|
|
|
|
if( (Module->GetLayer() == SILKSCREEN_N_CU)
|
2007-10-07 18:24:15 +00:00
|
|
|
|
|| (Module->GetLayer() == ADHESIVE_N_CU) || (Module->GetLayer() == COPPER_LAYER_N) )
|
2008-12-22 21:06:44 +00:00
|
|
|
|
pt_texte->m_Mirror = true;
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
|
|
|
|
/* Inversion miroir de la Valeur et mise en miroir : */
|
|
|
|
|
pt_texte = Module->m_Value;
|
|
|
|
|
pt_texte->m_Pos.y -= Module->m_Pos.y;
|
|
|
|
|
pt_texte->m_Pos.y = -pt_texte->m_Pos.y;
|
|
|
|
|
pt_texte->m_Pos.y += Module->m_Pos.y;
|
2008-12-22 21:06:44 +00:00
|
|
|
|
pt_texte->m_Pos0.y = -pt_texte->m_Pos0.y;
|
|
|
|
|
pt_texte->m_Mirror = false;
|
2007-08-10 19:14:51 +00:00
|
|
|
|
NEGATE_AND_NORMALIZE_ANGLE_POS( pt_texte->m_Orient );
|
2007-08-23 04:28:46 +00:00
|
|
|
|
pt_texte->SetLayer( Module->GetLayer() );
|
|
|
|
|
pt_texte->SetLayer( ChangeSideNumLayer( pt_texte->GetLayer() ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-10-07 18:24:15 +00:00
|
|
|
|
if( Module->GetLayer() == COPPER_LAYER_N )
|
2007-08-23 04:28:46 +00:00
|
|
|
|
pt_texte->SetLayer( SILKSCREEN_N_CU );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-08-23 04:28:46 +00:00
|
|
|
|
if( Module->GetLayer() == CMP_N )
|
|
|
|
|
pt_texte->SetLayer( SILKSCREEN_N_CMP );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-08-23 04:28:46 +00:00
|
|
|
|
if( (Module->GetLayer() == SILKSCREEN_N_CU)
|
2007-10-07 18:24:15 +00:00
|
|
|
|
|| (Module->GetLayer() == ADHESIVE_N_CU) || (Module->GetLayer() == COPPER_LAYER_N) )
|
2008-12-22 21:06:44 +00:00
|
|
|
|
pt_texte->m_Mirror = true;
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
|
|
|
|
/* Inversion miroir des dessins de l'empreinte : */
|
|
|
|
|
PtStruct = Module->m_Drawings;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
2007-08-10 19:14:51 +00:00
|
|
|
|
{
|
2007-09-01 12:00:30 +00:00
|
|
|
|
switch( PtStruct->Type() )
|
2007-08-10 19:14:51 +00:00
|
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
|
case TYPE_EDGE_MODULE:
|
2007-08-10 19:14:51 +00:00
|
|
|
|
pt_edgmod = (EDGE_MODULE*) PtStruct;
|
|
|
|
|
pt_edgmod->m_Start.y -= Module->m_Pos.y;
|
|
|
|
|
pt_edgmod->m_Start.y = -pt_edgmod->m_Start.y;
|
|
|
|
|
pt_edgmod->m_Start.y += Module->m_Pos.y;
|
|
|
|
|
pt_edgmod->m_End.y -= Module->m_Pos.y;
|
|
|
|
|
pt_edgmod->m_End.y = -pt_edgmod->m_End.y;
|
|
|
|
|
pt_edgmod->m_End.y += Module->m_Pos.y;
|
|
|
|
|
/* inversion des coords locales */
|
|
|
|
|
pt_edgmod->m_Start0.y = -pt_edgmod->m_Start0.y;
|
|
|
|
|
pt_edgmod->m_End0.y = -pt_edgmod->m_End0.y;
|
|
|
|
|
if( pt_edgmod->m_Shape == S_ARC )
|
|
|
|
|
{
|
|
|
|
|
pt_edgmod->m_Angle = -pt_edgmod->m_Angle;
|
|
|
|
|
}
|
|
|
|
|
|
2007-08-23 04:28:46 +00:00
|
|
|
|
pt_edgmod->SetLayer( ChangeSideNumLayer( pt_edgmod->GetLayer() ) );
|
2007-08-10 19:14:51 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
|
case TYPE_TEXTE_MODULE:
|
2007-08-10 19:14:51 +00:00
|
|
|
|
/* Inversion miroir de la position et mise en miroir : */
|
|
|
|
|
pt_texte = (TEXTE_MODULE*) PtStruct;
|
|
|
|
|
pt_texte->m_Pos.y -= Module->m_Pos.y;
|
|
|
|
|
pt_texte->m_Pos.y = -pt_texte->m_Pos.y;
|
|
|
|
|
pt_texte->m_Pos.y += Module->m_Pos.y;
|
2008-12-22 21:06:44 +00:00
|
|
|
|
pt_texte->m_Pos0.y = - pt_texte->m_Pos0.y;
|
|
|
|
|
pt_texte->m_Mirror = false;
|
2007-08-10 19:14:51 +00:00
|
|
|
|
NEGATE_AND_NORMALIZE_ANGLE_POS( pt_texte->m_Orient );
|
|
|
|
|
|
2008-03-22 18:08:44 +00:00
|
|
|
|
pt_texte->SetLayer( Module->GetLayer() );
|
2007-08-23 04:28:46 +00:00
|
|
|
|
pt_texte->SetLayer( ChangeSideNumLayer( pt_texte->GetLayer() ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-10-07 18:24:15 +00:00
|
|
|
|
if( Module->GetLayer() == COPPER_LAYER_N )
|
2007-08-23 04:28:46 +00:00
|
|
|
|
pt_texte->SetLayer( SILKSCREEN_N_CU );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-08-23 04:28:46 +00:00
|
|
|
|
if( Module->GetLayer() == CMP_N )
|
|
|
|
|
pt_texte->SetLayer( SILKSCREEN_N_CMP );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-08-23 04:28:46 +00:00
|
|
|
|
if( Module->GetLayer() == SILKSCREEN_N_CU
|
2008-08-06 07:46:03 +00:00
|
|
|
|
|| Module->GetLayer() == ADHESIVE_N_CU
|
|
|
|
|
|| Module->GetLayer() == COPPER_LAYER_N )
|
2007-08-23 04:28:46 +00:00
|
|
|
|
{
|
2008-12-22 21:06:44 +00:00
|
|
|
|
pt_texte->m_Mirror = true;
|
2007-08-23 04:28:46 +00:00
|
|
|
|
}
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
2008-01-25 13:16:24 +00:00
|
|
|
|
DisplayError( m_PcbFrame, wxT( "Unknown Draw Type" ) ); break;
|
2007-08-10 19:14:51 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* calcul du rectangle d'encadrement */
|
|
|
|
|
Module->Set_Rectangle_Encadrement();
|
|
|
|
|
|
2008-08-06 07:46:03 +00:00
|
|
|
|
if( m_PcbFrame )
|
2009-04-17 08:51:02 +00:00
|
|
|
|
Module->DisplayInfo( m_PcbFrame );
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
|
|
|
|
if( !(Module->m_Flags & IS_MOVED) ) /* Inversion simple */
|
|
|
|
|
{
|
2008-01-25 13:16:24 +00:00
|
|
|
|
if( DC && m_PcbFrame )
|
2007-08-10 19:14:51 +00:00
|
|
|
|
{
|
2008-04-01 05:21:50 +00:00
|
|
|
|
Module->Draw( m_PcbFrame->DrawPanel, DC, GR_OR );
|
2008-03-22 18:08:44 +00:00
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
/* affichage chevelu general si necessaire */
|
2009-06-11 14:26:17 +00:00
|
|
|
|
m_PcbFrame->Compile_Ratsnest( DC, true );
|
2007-08-10 19:14:51 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2008-01-25 13:16:24 +00:00
|
|
|
|
if( DC && m_PcbFrame )
|
2007-08-10 19:14:51 +00:00
|
|
|
|
{
|
2008-01-25 13:16:24 +00:00
|
|
|
|
DrawModuleOutlines( m_PcbFrame->DrawPanel, DC, Module );
|
|
|
|
|
Dessine_Segments_Dragges( m_PcbFrame->DrawPanel, DC );
|
2007-08-10 19:14:51 +00:00
|
|
|
|
}
|
2009-05-24 18:28:36 +00:00
|
|
|
|
m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK;
|
2007-08-10 19:14:51 +00:00
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************/
|
2007-08-10 19:14:51 +00:00
|
|
|
|
static int ChangeSideMaskLayer( int masque )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/*********************************************/
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/* Routine de recalcul du masque-layer lors des
|
2007-08-10 19:14:51 +00:00
|
|
|
|
* echanges cote cu/cmp pour les couches CU/CMP specialisees
|
|
|
|
|
* (cuivre, serigr., pate , soudure)
|
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
2007-08-10 19:14:51 +00:00
|
|
|
|
int newmasque;
|
|
|
|
|
|
|
|
|
|
newmasque = masque & ~(CUIVRE_LAYER | CMP_LAYER |
|
|
|
|
|
SILKSCREEN_LAYER_CU | SILKSCREEN_LAYER_CMP |
|
|
|
|
|
ADHESIVE_LAYER_CU | ADHESIVE_LAYER_CMP |
|
|
|
|
|
SOLDERMASK_LAYER_CU | SOLDERMASK_LAYER_CMP |
|
|
|
|
|
SOLDERPASTE_LAYER_CU | SOLDERPASTE_LAYER_CMP |
|
|
|
|
|
ADHESIVE_LAYER_CU | ADHESIVE_LAYER_CMP);
|
|
|
|
|
|
|
|
|
|
if( masque & CUIVRE_LAYER )
|
|
|
|
|
newmasque |= CMP_LAYER;
|
|
|
|
|
if( masque & CMP_LAYER )
|
|
|
|
|
newmasque |= CUIVRE_LAYER;
|
|
|
|
|
|
|
|
|
|
if( masque & SILKSCREEN_LAYER_CU )
|
|
|
|
|
newmasque |= SILKSCREEN_LAYER_CMP;
|
|
|
|
|
if( masque & SILKSCREEN_LAYER_CMP )
|
|
|
|
|
newmasque |= SILKSCREEN_LAYER_CU;
|
|
|
|
|
|
|
|
|
|
if( masque & ADHESIVE_LAYER_CU )
|
|
|
|
|
newmasque |= ADHESIVE_LAYER_CMP;
|
|
|
|
|
if( masque & ADHESIVE_LAYER_CMP )
|
|
|
|
|
newmasque |= ADHESIVE_LAYER_CU;
|
|
|
|
|
|
|
|
|
|
if( masque & SOLDERMASK_LAYER_CU )
|
|
|
|
|
newmasque |= SOLDERMASK_LAYER_CMP;
|
|
|
|
|
if( masque & SOLDERMASK_LAYER_CMP )
|
|
|
|
|
newmasque |= SOLDERMASK_LAYER_CU;
|
|
|
|
|
|
|
|
|
|
if( masque & SOLDERPASTE_LAYER_CU )
|
|
|
|
|
newmasque |= SOLDERPASTE_LAYER_CMP;
|
|
|
|
|
if( masque & SOLDERPASTE_LAYER_CMP )
|
|
|
|
|
newmasque |= SOLDERPASTE_LAYER_CU;
|
|
|
|
|
|
|
|
|
|
if( masque & ADHESIVE_LAYER_CU )
|
|
|
|
|
newmasque |= ADHESIVE_LAYER_CMP;
|
|
|
|
|
if( masque & ADHESIVE_LAYER_CMP )
|
|
|
|
|
newmasque |= ADHESIVE_LAYER_CU;
|
|
|
|
|
|
|
|
|
|
return newmasque;
|
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
/*************************************/
|
|
|
|
|
int ChangeSideNumLayer( int oldlayer )
|
|
|
|
|
/*************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
/* Routine de recalcul du numero de couche lors des
|
|
|
|
|
* echanges cote cu/cmp pour les couches CU/CMP specialisees
|
|
|
|
|
* (cuivre, serigr., pate , soudure)
|
|
|
|
|
*/
|
|
|
|
|
{
|
|
|
|
|
int newlayer;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
switch( oldlayer )
|
|
|
|
|
{
|
2007-10-07 18:24:15 +00:00
|
|
|
|
case COPPER_LAYER_N:
|
2007-08-10 19:14:51 +00:00
|
|
|
|
newlayer = CMP_N; break;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
case CMP_N:
|
2007-10-07 18:24:15 +00:00
|
|
|
|
newlayer = COPPER_LAYER_N; break;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
case SILKSCREEN_N_CU:
|
|
|
|
|
newlayer = SILKSCREEN_N_CMP; break;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
case SILKSCREEN_N_CMP:
|
|
|
|
|
newlayer = SILKSCREEN_N_CU; break;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
case ADHESIVE_N_CU:
|
|
|
|
|
newlayer = ADHESIVE_N_CMP; break;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
case ADHESIVE_N_CMP:
|
|
|
|
|
newlayer = ADHESIVE_N_CU; break;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
case SOLDERMASK_N_CU:
|
|
|
|
|
newlayer = SOLDERMASK_N_CMP; break;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
case SOLDERMASK_N_CMP:
|
|
|
|
|
newlayer = SOLDERMASK_N_CU; break;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
case SOLDERPASTE_N_CU:
|
|
|
|
|
newlayer = SOLDERPASTE_N_CMP; break;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
case SOLDERPASTE_N_CMP:
|
|
|
|
|
newlayer = SOLDERPASTE_N_CU; break;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
default:
|
|
|
|
|
newlayer = oldlayer;
|
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
return newlayer;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/*****************************************************************/
|
2009-06-20 19:09:43 +00:00
|
|
|
|
void WinEDA_BasePcbFrame::Place_Module( MODULE* module, wxDC* DC, bool aDoNotRecreateRatsnest )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/*****************************************************************/
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/* Place a l'endroit pointe par la souris le module deja existant selectionne
|
2007-08-10 19:14:51 +00:00
|
|
|
|
* auparavant.
|
|
|
|
|
* Entree: module = num du module a replacer
|
|
|
|
|
* DC ( si NULL: pas d'affichage a l'<EFBFBD>ran
|
|
|
|
|
* Sortie :
|
|
|
|
|
* mise a jour des nouvelles coord des differents elements du module
|
|
|
|
|
* affichage a l'ecran du module
|
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
2007-08-10 19:14:51 +00:00
|
|
|
|
TRACK* pt_segm;
|
|
|
|
|
DRAG_SEGM* pt_drag;
|
|
|
|
|
wxPoint newpos;
|
|
|
|
|
|
|
|
|
|
if( module == 0 )
|
|
|
|
|
return;
|
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
|
GetScreen()->SetModify();
|
2009-05-24 18:28:36 +00:00
|
|
|
|
GetBoard()->m_Status_Pcb &= ~( LISTE_RATSNEST_ITEM_OK | CONNEXION_OK);
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
|
if( g_Show_Module_Ratsnest && (GetBoard()->m_Status_Pcb & LISTE_PAD_OK) && DC )
|
2007-08-10 19:14:51 +00:00
|
|
|
|
trace_ratsnest_module( DC );
|
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
|
newpos = GetScreen()->m_Curseur;
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
|
|
|
|
module->SetPosition( newpos );
|
|
|
|
|
if( DC )
|
2008-04-01 05:21:50 +00:00
|
|
|
|
module->Draw( DrawPanel, DC, GR_OR );
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
|
|
|
|
/* Tracage des segments dragges et liberation memoire */
|
|
|
|
|
if( g_DragSegmentList )
|
|
|
|
|
{
|
|
|
|
|
pt_drag = g_DragSegmentList;
|
|
|
|
|
for( ; pt_drag != NULL; pt_drag = pt_drag->Pnext )
|
|
|
|
|
{
|
|
|
|
|
pt_segm = pt_drag->m_Segm;
|
|
|
|
|
pt_segm->SetState( EDIT, OFF );
|
|
|
|
|
if( DC )
|
|
|
|
|
pt_segm->Draw( DrawPanel, DC, GR_OR );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EraseDragListe();
|
|
|
|
|
}
|
|
|
|
|
|
2009-06-20 19:09:43 +00:00
|
|
|
|
if( !aDoNotRecreateRatsnest )
|
|
|
|
|
Compile_Ratsnest( DC, true );
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
2009-04-17 08:51:02 +00:00
|
|
|
|
module->DisplayInfo( this );
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
|
|
|
|
DrawPanel->ManageCurseur = NULL;
|
|
|
|
|
DrawPanel->ForceCloseManageCurseur = NULL;
|
|
|
|
|
module->m_Flags = 0;
|
|
|
|
|
g_Drag_Pistes_On = FALSE;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************/
|
2007-08-10 19:14:51 +00:00
|
|
|
|
void WinEDA_BasePcbFrame::Rotate_Module( wxDC* DC, MODULE* module,
|
|
|
|
|
int angle, bool incremental )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/***********************************************************************/
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/*
|
2007-08-10 19:14:51 +00:00
|
|
|
|
* Fait tourner l'empreinte de angle degres, dans le sens < 0.
|
|
|
|
|
* Si incremental == TRUE, la rotation est faite a partir de la derniere orientation,
|
|
|
|
|
* sinon le module est mis dans l'orientation absolue angle.
|
|
|
|
|
* Si DC == NULL, le composant n'est pas redessine.
|
|
|
|
|
* Sinon, il est efface, tourne et redessine
|
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
2007-08-10 19:14:51 +00:00
|
|
|
|
if( module == NULL )
|
|
|
|
|
return;
|
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
|
GetScreen()->SetModify();
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
|
|
|
|
/* efface ancienne position */
|
|
|
|
|
if( !(module->m_Flags & IS_MOVED) ) /* Rotation simple */
|
|
|
|
|
{
|
|
|
|
|
if( DC )
|
|
|
|
|
{
|
2008-04-01 05:21:50 +00:00
|
|
|
|
int tmp = module->m_Flags;
|
|
|
|
|
module->m_Flags |= DO_NOT_DRAW;
|
|
|
|
|
DrawPanel->PostDirtyRect( module->GetBoundingBox() );
|
|
|
|
|
module->m_Flags = tmp;
|
2008-03-13 21:18:05 +00:00
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
/* Reaffichage chevelu general si necessaire */
|
|
|
|
|
if( g_Show_Ratsnest )
|
|
|
|
|
DrawGeneralRatsnest( DC );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* reaffiche module en mouvement */
|
|
|
|
|
if( DC )
|
|
|
|
|
{
|
|
|
|
|
DrawModuleOutlines( DrawPanel, DC, module );
|
|
|
|
|
Dessine_Segments_Dragges( DrawPanel, DC );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-24 18:28:36 +00:00
|
|
|
|
GetBoard()->m_Status_Pcb &= ~(LISTE_RATSNEST_ITEM_OK | CONNEXION_OK);
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
|
|
|
|
if( incremental )
|
|
|
|
|
module->SetOrientation( module->m_Orient + angle );
|
|
|
|
|
else
|
|
|
|
|
module->SetOrientation( angle );
|
|
|
|
|
|
2009-04-17 08:51:02 +00:00
|
|
|
|
module->DisplayInfo( this );
|
2007-08-10 19:14:51 +00:00
|
|
|
|
|
|
|
|
|
if( DC )
|
|
|
|
|
{
|
|
|
|
|
if( !(module->m_Flags & IS_MOVED) ) /* Rotation simple */
|
|
|
|
|
{
|
2008-04-01 05:21:50 +00:00
|
|
|
|
module->Draw( DrawPanel, DC, GR_OR );
|
2008-03-22 18:08:44 +00:00
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
/* Reaffichage chevelu general si necessaire */
|
2009-06-11 14:26:17 +00:00
|
|
|
|
Compile_Ratsnest( DC, true );
|
2007-08-10 19:14:51 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* reaffiche module en mouvement */
|
|
|
|
|
DrawModuleOutlines( DrawPanel, DC, module );
|
|
|
|
|
Dessine_Segments_Dragges( DrawPanel, DC );
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************/
|
|
|
|
|
/* Redessine en mode XOR la silouhette du module */
|
|
|
|
|
/*************************************************/
|
|
|
|
|
|
2007-08-10 19:14:51 +00:00
|
|
|
|
void DrawModuleOutlines( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
2007-08-10 19:14:51 +00:00
|
|
|
|
int pad_fill_tmp;
|
|
|
|
|
D_PAD* pt_pad;
|
|
|
|
|
|
|
|
|
|
if( module == NULL )
|
|
|
|
|
return;
|
|
|
|
|
module->DrawEdgesOnly( panel, DC, g_Offset_Module, GR_XOR );
|
|
|
|
|
|
|
|
|
|
if( g_Show_Pads_Module_in_Move )
|
|
|
|
|
{
|
|
|
|
|
pad_fill_tmp = DisplayOpt.DisplayPadFill;
|
2009-06-25 20:45:27 +00:00
|
|
|
|
#ifndef __WXMAC__
|
2009-05-21 17:42:42 +00:00
|
|
|
|
DisplayOpt.DisplayPadFill = true; /* Trace en SKETCH en deplacement */
|
2009-06-25 20:45:27 +00:00
|
|
|
|
#else
|
|
|
|
|
DisplayOpt.DisplayPadFill = false;
|
|
|
|
|
#endif
|
2007-08-10 19:14:51 +00:00
|
|
|
|
pt_pad = module->m_Pads;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
|
2007-08-10 19:14:51 +00:00
|
|
|
|
{
|
2008-04-01 05:21:50 +00:00
|
|
|
|
pt_pad->Draw( panel, DC, GR_XOR, g_Offset_Module );
|
2007-08-10 19:14:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DisplayOpt.DisplayPadFill = pad_fill_tmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( g_Show_Module_Ratsnest && panel )
|
|
|
|
|
{
|
|
|
|
|
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->m_Parent;
|
|
|
|
|
frame->build_ratsnest_module( DC, module );
|
|
|
|
|
frame->trace_ratsnest_module( DC );
|
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
}
|