2007-08-20 01:20:48 +00:00
|
|
|
|
/************************************************/
|
|
|
|
|
/* Module editor: Dialog box for editing module */
|
|
|
|
|
/* properties and carateristics */
|
|
|
|
|
/************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
|
#include "gr_basic.h"
|
|
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
|
#include "pcbnew.h"
|
|
|
|
|
#include "autorout.h"
|
|
|
|
|
#include "trigo.h"
|
|
|
|
|
#include "bitmaps.h"
|
|
|
|
|
#include "3d_struct.h"
|
|
|
|
|
#include "3d_viewer.h"
|
|
|
|
|
|
|
|
|
|
#include "protos.h"
|
|
|
|
|
|
|
|
|
|
/* Variables locales: */
|
|
|
|
|
bool GoToEditor = FALSE;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
/**************************************/
|
|
|
|
|
/* class WinEDA_ModulePropertiesFrame */
|
|
|
|
|
/**************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
#include "dialog_edit_module.cpp"
|
|
|
|
|
|
|
|
|
|
/*******************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
void WinEDA_BasePcbFrame::InstallModuleOptionsFrame( MODULE* Module,
|
|
|
|
|
wxDC* DC, const wxPoint& pos )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/*******************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/* Fonction relai d'installation de la frame d'<27>dition des proprietes
|
2007-08-20 01:20:48 +00:00
|
|
|
|
* du module*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
|
WinEDA_ModulePropertiesFrame* frame = new WinEDA_ModulePropertiesFrame( this,
|
|
|
|
|
Module, DC, pos );
|
|
|
|
|
|
|
|
|
|
frame->ShowModal(); frame->Destroy();
|
|
|
|
|
|
|
|
|
|
if( GoToEditor && GetScreen()->GetCurItem() )
|
|
|
|
|
{
|
|
|
|
|
if( m_Parent->m_ModuleEditFrame == NULL )
|
|
|
|
|
{
|
|
|
|
|
m_Parent->m_ModuleEditFrame = new WinEDA_ModuleEditFrame( this,
|
|
|
|
|
m_Parent, _( "Module Editor" ),
|
|
|
|
|
wxPoint( -1,
|
|
|
|
|
-1 ),
|
|
|
|
|
wxSize( 600, 400 ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_Parent->m_ModuleEditFrame->Load_Module_Module_From_BOARD(
|
|
|
|
|
(MODULE*) GetScreen()->GetCurItem() );
|
2007-09-12 02:14:07 +00:00
|
|
|
|
SetCurItem( NULL );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
GoToEditor = FALSE;
|
|
|
|
|
m_Parent->m_ModuleEditFrame->Show( TRUE );
|
|
|
|
|
m_Parent->m_ModuleEditFrame->Iconize( FALSE );
|
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
void WinEDA_ModuleEditFrame::Place_Ancre( MODULE* pt_mod, wxDC* DC )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/*******************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/*
|
2007-08-20 01:20:48 +00:00
|
|
|
|
* Repositionne l'ancre sous le curseur souris
|
|
|
|
|
* Le module doit etre d'abort selectionne
|
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
|
int deltaX, deltaY;
|
|
|
|
|
EDA_BaseStruct* PtStruct;
|
|
|
|
|
D_PAD* pt_pad;
|
|
|
|
|
|
|
|
|
|
if( pt_mod == NULL )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
pt_mod->DrawAncre( DrawPanel, DC, wxPoint( 0, 0 ), DIM_ANCRE_MODULE, GR_XOR );
|
|
|
|
|
|
|
|
|
|
deltaX = pt_mod->m_Pos.x - GetScreen()->m_Curseur.x;
|
|
|
|
|
deltaY = pt_mod->m_Pos.y - GetScreen()->m_Curseur.y;
|
|
|
|
|
|
|
|
|
|
pt_mod->m_Pos = GetScreen()->m_Curseur;
|
|
|
|
|
|
|
|
|
|
/* Mise a jour des coord relatives des elements:
|
|
|
|
|
* les coordonnees relatives sont relatives a l'ancre, pour orient 0.
|
|
|
|
|
* il faut donc recalculer deltaX et deltaY en orientation 0 */
|
|
|
|
|
RotatePoint( &deltaX, &deltaY, -pt_mod->m_Orient );
|
|
|
|
|
|
|
|
|
|
/* Mise a jour des coord relatives des pads */
|
|
|
|
|
pt_pad = (D_PAD*) pt_mod->m_Pads;
|
|
|
|
|
for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Pnext )
|
|
|
|
|
{
|
|
|
|
|
pt_pad->m_Pos0.x += deltaX; pt_pad->m_Pos0.y += deltaY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Mise a jour des coord relatives contours .. */
|
|
|
|
|
PtStruct = pt_mod->m_Drawings;
|
|
|
|
|
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
|
|
|
|
|
{
|
2007-09-01 12:00:30 +00:00
|
|
|
|
switch( PtStruct->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
{
|
|
|
|
|
case TYPEEDGEMODULE:
|
|
|
|
|
#undef STRUCT
|
|
|
|
|
#define STRUCT ( (EDGE_MODULE*) PtStruct )
|
|
|
|
|
STRUCT->m_Start0.x += deltaX; STRUCT->m_Start0.y += deltaY;
|
|
|
|
|
STRUCT->m_End0.x += deltaX; STRUCT->m_End0.y += deltaY;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TYPETEXTEMODULE:
|
|
|
|
|
#undef STRUCT
|
|
|
|
|
#define STRUCT ( (TEXTE_MODULE*) PtStruct )
|
|
|
|
|
STRUCT->m_Pos0.x += deltaX; STRUCT->m_Pos0.y += deltaY;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pt_mod->Set_Rectangle_Encadrement();
|
|
|
|
|
pt_mod->DrawAncre( DrawPanel, DC, wxPoint( 0, 0 ), DIM_ANCRE_MODULE, GR_OR );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/**********************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
void WinEDA_ModuleEditFrame::RemoveStruct( EDA_BaseStruct* Item, wxDC* DC )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/**********************************************************************/
|
|
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
|
if( Item == NULL )
|
|
|
|
|
return;
|
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
|
switch( Item->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
{
|
|
|
|
|
case TYPEPAD:
|
|
|
|
|
DeletePad( (D_PAD*) Item, DC );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TYPETEXTEMODULE:
|
|
|
|
|
{
|
|
|
|
|
TEXTE_MODULE* text = (TEXTE_MODULE*) Item;
|
|
|
|
|
if( text->m_Type == TEXT_is_REFERENCE )
|
|
|
|
|
{
|
|
|
|
|
DisplayError( this, _( "Text is REFERENCE!" ) );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if( text->m_Type == TEXT_is_VALUE )
|
|
|
|
|
{
|
|
|
|
|
DisplayError( this, _( "Text is VALUE!" ) );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
DeleteTextModule( text, DC );
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TYPEEDGEMODULE:
|
|
|
|
|
Delete_Edge_Module( (EDGE_MODULE*) Item, DC );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case TYPEMODULE:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
{
|
|
|
|
|
wxString Line;
|
|
|
|
|
Line.Printf( wxT( " Remove: StructType %d Inattendu" ),
|
2007-09-01 12:00:30 +00:00
|
|
|
|
Item->Type() );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
DisplayError( this, Line );
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
}
|