mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-11 00:30:01 +00:00
Comment translations.
* Completed translation of all kicad source. * Translated source files A through C in pcbnew.
This commit is contained in:
parent
cb24fb2588
commit
4611bfd58c
kicad
pcbnew
ar_protos.hattribut.cppautomove.cppautoplac.cppautorout.cppautorout.hbasepcbframe.cppblock.cppblock_module_editor.cppboard.cppcell.hclass_board.cppclass_board.hclass_cotation.cppclass_cotation.hclass_drawsegment.cppclass_edge_mod.cppclass_edge_mod.hclass_mire.cppclass_mire.hclass_module.cppclass_module.hclass_module_transform_functions.cppclass_netinfo.hclass_netinfo_item.cppclass_pad.cppclass_pad.hclass_pad_draw_functions.cppclass_pcb_text.cppclass_pcb_text.hclass_text_mod.cppclass_text_mod.hclass_track.cppclasspcb.cpp
@ -126,7 +126,7 @@ void WinEDA_MainFrame::OnArchiveFiles( wxCommandEvent& event )
|
||||
|
||||
wxFileName zip = dlg.GetPath();
|
||||
|
||||
/* Liste des extensions des fichiers à sauver */
|
||||
/* List of file extensions to save. */
|
||||
static const wxChar* extList[] = {
|
||||
wxT( "*.sch" ), wxT( "*.lib" ), wxT( "*.cmp" ), wxT( "*.brd" ),
|
||||
wxT( "*.net" ), wxT( "*.pro" ), wxT( "*.pho" ), wxT( "*.py" ),
|
||||
|
@ -28,7 +28,7 @@ class WinEDA_PrjFrame;
|
||||
/**
|
||||
* Command IDs for Kicad.
|
||||
*
|
||||
* Please add IDs that are unique to Kica here and not in the global id.h
|
||||
* Please add IDs that are unique to Kicad here and not in the global id.h
|
||||
* file. This will prevent the entire project from being rebuilt when adding
|
||||
* new commands to Kicad.
|
||||
*/
|
||||
@ -64,10 +64,6 @@ enum id_kicad_frm
|
||||
};
|
||||
|
||||
|
||||
/*******************************************/
|
||||
/* classe pour la Fenetre generale de kicad*/
|
||||
/*******************************************/
|
||||
|
||||
/* class WinEDA_MainFrame
|
||||
* This is the main kicad frame
|
||||
*/
|
||||
@ -80,7 +76,7 @@ public:
|
||||
WinEDA_PrjFrame* m_LeftWin;
|
||||
wxSashLayoutWindow* m_BottomWin;
|
||||
wxTextCtrl* m_DialogWin;
|
||||
WinEDA_Toolbar* m_VToolBar; // Verticam Toolbar (not used)
|
||||
WinEDA_Toolbar* m_VToolBar; // Vertical toolbar (not used)
|
||||
wxString m_BoardFileName;
|
||||
wxString m_SchematicRootFileName;
|
||||
wxFileName m_ProjectFileName;
|
||||
@ -90,7 +86,6 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
// Constructor and destructor
|
||||
WinEDA_MainFrame( wxWindow* parent, const wxString& title,
|
||||
const wxPoint& pos, const wxSize& size );
|
||||
|
||||
@ -207,9 +202,9 @@ private:
|
||||
};
|
||||
|
||||
|
||||
/***********************************************************/
|
||||
/* Classes pour l'arbre de hierarchie de gestion du projet */
|
||||
/***********************************************************/
|
||||
/*********************************/
|
||||
/* Classes for the project tree. */
|
||||
/*********************************/
|
||||
|
||||
/** class TreePrjItemData
|
||||
* Handle one item (a file or a directory name) for the tree file
|
||||
@ -414,7 +409,7 @@ public:
|
||||
WinEDA_TreePrj( WinEDA_PrjFrame* parent );
|
||||
~WinEDA_TreePrj();
|
||||
private:
|
||||
/* overlayed sort function */
|
||||
/* overridden sort function */
|
||||
int OnCompareItems( const wxTreeItemId& item1, const wxTreeItemId& item2 );
|
||||
};
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/******************************************************************/
|
||||
/* mdiframe.cpp - fonctions de la classe du type WinEDA_MainFrame */
|
||||
/******************************************************************/
|
||||
/*******************/
|
||||
/* preferences.cpp */
|
||||
/*******************/
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
static const wxString GeneralGroupName( wxT( "/general" ) );
|
||||
|
||||
/* Kicad project file entry namse. */
|
||||
/* Kicad project file entry names. */
|
||||
static const wxString SchematicRootNameEntry( wxT( "RootSch" ) );
|
||||
static const wxString BoardFileNameEntry( wxT( "BoardNm" ) );
|
||||
|
||||
@ -130,7 +130,6 @@ void WinEDA_MainFrame::OnSaveProject( wxCommandEvent& event )
|
||||
|
||||
m_ProjectFileName = dlg.GetPath();
|
||||
|
||||
/* ecriture de la configuration */
|
||||
wxGetApp().WriteProjectConfig( m_ProjectFileName.GetFullPath(),
|
||||
GeneralGroupName, NULL );
|
||||
}
|
||||
|
@ -1,10 +1,9 @@
|
||||
/**********************************************************/
|
||||
/* prjconfig.h : configuration: definition des structures */
|
||||
/**********************************************************/
|
||||
/**********************************************************/
|
||||
/* prjconfig.h : configuration: definition des structures */
|
||||
/**********************************************************/
|
||||
|
||||
#include "param_config.h"
|
||||
|
||||
|
||||
/* Liste des parametres */
|
||||
extern PARAM_CFG_BASE* CfgParamList[];
|
||||
|
||||
|
@ -22,12 +22,9 @@
|
||||
#include "wx/dir.h"
|
||||
|
||||
|
||||
/********************************************/
|
||||
/* Methodes pour l'arbre gestion du projet */
|
||||
/********************************************/
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS( WinEDA_TreePrj, wxTreeCtrl )
|
||||
|
||||
|
||||
WinEDA_TreePrj::WinEDA_TreePrj( WinEDA_PrjFrame* parent ) :
|
||||
wxTreeCtrl( parent, ID_PROJECT_TREE,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
@ -61,16 +58,13 @@ WinEDA_TreePrj::~WinEDA_TreePrj()
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************************/
|
||||
int WinEDA_TreePrj::OnCompareItems( const wxTreeItemId& item1, const wxTreeItemId& item2 )
|
||||
/***************************************************************************************/
|
||||
|
||||
/* sort function for tree items.
|
||||
* items are sorted :
|
||||
* directory names first by alphabetic order
|
||||
* root file names after
|
||||
* file names last by alphabetic order
|
||||
*/
|
||||
int WinEDA_TreePrj::OnCompareItems( const wxTreeItemId& item1, const wxTreeItemId& item2 )
|
||||
{
|
||||
TreePrjItemData* myitem1 = (TreePrjItemData*) GetItemData( item1 );
|
||||
TreePrjItemData* myitem2 = (TreePrjItemData*) GetItemData( item2 );
|
||||
@ -89,11 +83,9 @@ int WinEDA_TreePrj::OnCompareItems( const wxTreeItemId& item1, const wxTreeItemI
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************************************/
|
||||
TreePrjItemData::TreePrjItemData( enum TreeFileType type, const wxString& data,
|
||||
wxTreeCtrl* parent ) :
|
||||
wxTreeItemData()
|
||||
/****************************************************************************************************/
|
||||
{
|
||||
m_Type = type;
|
||||
m_Parent = parent;
|
||||
@ -105,26 +97,23 @@ TreePrjItemData::TreePrjItemData( enum TreeFileType type, const wxString& data,
|
||||
#ifdef KICAD_PYTHON
|
||||
using namespace boost::python;
|
||||
|
||||
/**************************************/
|
||||
object TreePrjItemData::GetIdPy() const
|
||||
/**************************************/
|
||||
|
||||
// Convert the data to an id
|
||||
object TreePrjItemData::GetIdPy() const
|
||||
{
|
||||
wxTreeItemId* id = new wxTreeItemId();
|
||||
|
||||
*id = GetId();
|
||||
return object( handle<>( borrowed( wxPyConstructObject( id, wxT( "wxTreeItemId" ), true ) ) ) );
|
||||
return object( handle<>( borrowed( wxPyConstructObject( id,
|
||||
wxT( "wxTreeItemId" ),
|
||||
true ) ) ) );
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/*******************************************/
|
||||
void TreePrjItemData::SetState( int state )
|
||||
/*******************************************/
|
||||
|
||||
// Set the state used in the icon list
|
||||
void TreePrjItemData::SetState( int state )
|
||||
{
|
||||
wxImageList* imglist = m_Parent->GetImageList();
|
||||
|
||||
@ -137,10 +126,8 @@ void TreePrjItemData::SetState( int state )
|
||||
}
|
||||
|
||||
|
||||
/*******************************************/
|
||||
wxString TreePrjItemData::GetDir() const
|
||||
/*******************************************/
|
||||
/* Get the directory containing the file */
|
||||
wxString TreePrjItemData::GetDir() const
|
||||
{
|
||||
if( TREE_DIRECTORY == m_Type )
|
||||
return m_FileName;
|
||||
@ -161,28 +148,25 @@ wxString TreePrjItemData::GetDir() const
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************/
|
||||
void TreePrjItemData::OnRename( wxTreeEvent& event, bool check )
|
||||
/****************************************************************/
|
||||
/* Called upon tree item rename */
|
||||
void TreePrjItemData::OnRename( wxTreeEvent& event, bool check )
|
||||
{
|
||||
//this segfaults on linux (in wxEvtHandler::ProcessEvent), wx version 2.8.7
|
||||
//therefore, until it is fixed, we must cancel the rename.
|
||||
event.Veto();
|
||||
return;
|
||||
|
||||
if( !Rename( event.GetLabel(), check ) )
|
||||
event.Veto();
|
||||
}
|
||||
|
||||
|
||||
/****************************************************/
|
||||
void TreePrjItemData::Move( TreePrjItemData* dest )
|
||||
/****************************************************/
|
||||
|
||||
// Move the object to dest
|
||||
void TreePrjItemData::Move( TreePrjItemData* dest )
|
||||
{
|
||||
//function not safe.
|
||||
return;
|
||||
|
||||
const wxString sep = wxFileName().GetPathSeparator();
|
||||
|
||||
if( m_Type == TREE_DIRECTORY )
|
||||
@ -213,7 +197,8 @@ void TreePrjItemData::Move( TreePrjItemData* dest )
|
||||
return; // Same place ??
|
||||
|
||||
// Move the file on the disk:
|
||||
#if ( ( wxMAJOR_VERSION < 2) || ( ( wxMAJOR_VERSION == 2)&& (wxMINOR_VERSION < 7 ) ) )
|
||||
#if ( ( wxMAJOR_VERSION < 2 ) || ( ( wxMAJOR_VERSION == 2 ) \
|
||||
&& ( wxMINOR_VERSION < 7 ) ) )
|
||||
if( !wxRenameFile( GetFileName(), destName ) )
|
||||
#else
|
||||
if( !wxRenameFile( GetFileName(), destName, false ) )
|
||||
@ -226,7 +211,7 @@ void TreePrjItemData::Move( TreePrjItemData* dest )
|
||||
|
||||
#ifdef KICAD_PYTHON
|
||||
object param = make_tuple( PyHandler::Convert( m_FileName ),
|
||||
PyHandler::Convert( destName ) );
|
||||
PyHandler::Convert( destName ) );
|
||||
PyHandler::GetInstance()->TriggerEvent( wxT( "kicad::MoveFile" ), param );
|
||||
#endif
|
||||
|
||||
@ -255,10 +240,8 @@ void TreePrjItemData::Move( TreePrjItemData* dest )
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************/
|
||||
bool TreePrjItemData::Rename( const wxString& name, bool check )
|
||||
/****************************************************************/
|
||||
/* rename the file checking if extension change occurs */
|
||||
bool TreePrjItemData::Rename( const wxString& name, bool check )
|
||||
{
|
||||
//this is broken & unsafe to use on linux.
|
||||
if( m_Type == TREE_DIRECTORY )
|
||||
@ -286,15 +269,17 @@ bool TreePrjItemData::Rename( const wxString& name, bool check )
|
||||
if( check && !ext.IsEmpty() && !reg.Matches( newFile ) )
|
||||
{
|
||||
wxMessageDialog dialog( m_Parent,
|
||||
_( "Changing file extension will change file type.\n Do you want to continue ?" ),
|
||||
_( "Rename File" ),
|
||||
wxYES_NO | wxICON_QUESTION );
|
||||
_( "Changing file extension will change file \
|
||||
type.\n Do you want to continue ?" ),
|
||||
_( "Rename File" ),
|
||||
wxYES_NO | wxICON_QUESTION );
|
||||
|
||||
if( wxID_YES != dialog.ShowModal() )
|
||||
return false;
|
||||
}
|
||||
|
||||
#if ( ( wxMAJOR_VERSION < 2) || ( ( wxMAJOR_VERSION == 2) && (wxMINOR_VERSION < 7 ) ) )
|
||||
#if ( ( wxMAJOR_VERSION < 2 ) || ( ( wxMAJOR_VERSION == 2 ) \
|
||||
&& ( wxMINOR_VERSION < 7 ) ) )
|
||||
if( !wxRenameFile( m_FileName, newFile ) )
|
||||
#else
|
||||
if( !wxRenameFile( m_FileName, newFile, false ) )
|
||||
@ -320,7 +305,8 @@ bool TreePrjItemData::Delete( bool check )
|
||||
/*******************************************/
|
||||
/* delete a file */
|
||||
{
|
||||
wxMessageDialog dialog( m_Parent, _ ("Do you really want to delete ") + GetFileName(),
|
||||
wxMessageDialog dialog( m_Parent,
|
||||
_ ("Do you really want to delete ") + GetFileName(),
|
||||
_( "Delete File" ), wxYES_NO | wxICON_QUESTION );
|
||||
|
||||
if( !check || wxID_YES == dialog.ShowModal() )
|
||||
@ -344,7 +330,7 @@ bool TreePrjItemData::Delete( bool check )
|
||||
|
||||
#ifdef KICAD_PYTHON
|
||||
PyHandler::GetInstance()->TriggerEvent( wxT( "kicad::DeleteFile" ),
|
||||
PyHandler::Convert( m_FileName ) );
|
||||
PyHandler::Convert( m_FileName ) );
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
@ -352,10 +338,8 @@ bool TreePrjItemData::Delete( bool check )
|
||||
}
|
||||
|
||||
|
||||
/**********************************/
|
||||
void TreePrjItemData::Activate( WinEDA_PrjFrame* prjframe )
|
||||
/**********************************/
|
||||
/* Called under item activation */
|
||||
void TreePrjItemData::Activate( WinEDA_PrjFrame* prjframe )
|
||||
{
|
||||
wxString sep = wxFileName().GetPathSeparator();
|
||||
wxString FullFileName = GetFileName();
|
||||
@ -390,12 +374,12 @@ void TreePrjItemData::Activate( WinEDA_PrjFrame* prjframe )
|
||||
|
||||
if( count == 0 )
|
||||
{
|
||||
/* The AddFile() text below should match the filter added to handle
|
||||
it in treeprj_frame.cpp in the line looking like this:
|
||||
m_Filters.push_back( wxT( "^no kicad files found" ) );
|
||||
*/
|
||||
prjframe->AddFile(
|
||||
_( "no kicad files found in this directory" ), id );
|
||||
/* The AddFile() text below should match the filter added to
|
||||
* handle it in treeprj_frame.cpp in the line looking like this:
|
||||
* m_Filters.push_back( wxT( "^no kicad files found" ) );
|
||||
*/
|
||||
prjframe->AddFile( _( "no kicad files found in this directory" ),
|
||||
id );
|
||||
}
|
||||
|
||||
/* Sort filenames by alphabetic order */
|
||||
@ -450,9 +434,7 @@ void TreePrjItemData::Activate( WinEDA_PrjFrame* prjframe )
|
||||
}
|
||||
|
||||
|
||||
/***************************************************/
|
||||
TreePrjItemData* WinEDA_PrjFrame::GetSelectedData()
|
||||
/***************************************************/
|
||||
{
|
||||
return dynamic_cast<TreePrjItemData*>( m_TreeProject->GetItemData( m_TreeProject->GetSelection() ) );
|
||||
}
|
||||
|
@ -1,55 +1,53 @@
|
||||
/*************************************/
|
||||
/* ar-proto.h: Fichier entete pour l'autorouteur */
|
||||
/*************************************/
|
||||
|
||||
/**************/
|
||||
/* AUTOROUT.H */
|
||||
/* ar-proto.h */
|
||||
/**************/
|
||||
|
||||
MODULE ** GenListeModules( BOARD * Pcb, int * NbModules );
|
||||
|
||||
/***************/
|
||||
/****************/
|
||||
/* GRAPHPCB.CPP */
|
||||
/***************/
|
||||
/* Rem: op_logique done le type d'ecriture ( WRITE, OR , XOR , AND ) */
|
||||
|
||||
void Place_1_Pad_Board(BOARD * Pcb, D_PAD * pt_pad, int type, int marge, int op_logique);
|
||||
/* Initialise a la valeur type, les cellules du Board comprises dans la
|
||||
surface du pad pointe par pt_pad, avec la marge reservee pour l'isolement */
|
||||
|
||||
void TraceSegmentPcb(BOARD * Pcb, TRACK * pt_segm, int type, int marge, int op_logique);
|
||||
/* trace un Segment de piste sur le BOARD */
|
||||
|
||||
void TraceLignePcb( int x0, int y0, int x1, int y1, int layer, int type, int op_logique );
|
||||
|
||||
void TraceFilledRectangle(BOARD * Pcb, int ux0, int uy0, int ux1, int uy1 ,int side,
|
||||
int color, int op_logique);
|
||||
/* Met a la valeur color l'ensemble des cellules du board inscrites dans
|
||||
le rectangle de coord ux0,uy0 ( angle haut a droite )
|
||||
a ux1,uy1 ( angle bas a gauche ) (coord PCB)
|
||||
Le rectangle est horizontal ( ou vertical )
|
||||
masque_layer = masque des couches;
|
||||
op_logique = WRITE_CELL, WRITE_OR_CELL, WRITE_XOR_CELL, WRITE_AND_CELL
|
||||
*/
|
||||
|
||||
/* fonction surchargee: */
|
||||
void TraceFilledRectangle(BOARD * Pcb, int ux0, int uy0, int ux1, int uy1, int angle,
|
||||
int masque_layer, int color, int op_logique);
|
||||
/* Identique a precedemment, mais le rectangle est
|
||||
incline de l'angle angle */
|
||||
/****************/
|
||||
|
||||
|
||||
void TraceArc(int ux0,int uy0,int ux1,int uy1, int ArcAngle, int lg,int layer,
|
||||
int color, int op_logique);
|
||||
/* Remplit toutes les cellules du BOARD contenues dans l'arc de "longueur" angle
|
||||
de demi-largeur lg, centre ux,y0 commencant en ux,y1 a la valeur color .
|
||||
coord en unites PCB (0.1 mil) relatives a l'origine pt_pcb->Pcb_oX,Y du board.
|
||||
*/
|
||||
/* Initialize a value type, the cells included in the board surface of the
|
||||
* pad edge by pt_pad, with the margin reserved for isolation. */
|
||||
void Place_1_Pad_Board( BOARD * Pcb, D_PAD * pt_pad, int type, int marge,
|
||||
int op_logique );
|
||||
|
||||
/* Draws a segment of track on the board. */
|
||||
void TraceSegmentPcb( BOARD * Pcb, TRACK * pt_segm, int type, int marge,
|
||||
int op_logique );
|
||||
|
||||
void TraceLignePcb( int x0, int y0, int x1, int y1, int layer, int type,
|
||||
int op_logique );
|
||||
|
||||
/* Uses the color value of all cells included in the board
|
||||
* coord of the rectangle ux0, uy0 (top right corner)
|
||||
* a ux1, uy1 (lower left corner) (coord PCB)
|
||||
* the rectangle is horizontal (or vertical)
|
||||
* masque_layer = mask layers;
|
||||
* op_logique = WRITE_CELL, WRITE_OR_CELL, WRITE_XOR_CELL, WRITE_AND_CELL
|
||||
*/
|
||||
void TraceFilledRectangle( BOARD * Pcb, int ux0, int uy0, int ux1, int uy1,
|
||||
int side, int color, int op_logique);
|
||||
|
||||
|
||||
/* Same as above, but the rectangle is inclined angle angle. */
|
||||
void TraceFilledRectangle( BOARD * Pcb, int ux0, int uy0, int ux1, int uy1,
|
||||
int angle, int masque_layer, int color,
|
||||
int op_logique );
|
||||
|
||||
/* Fills all BOARD cells contained in the arc of "L" angle half-width lg
|
||||
* ux center, starting in ux y0, y1 is set to color. Coordinates are in
|
||||
* PCB units (0.1 mil) relating to the origin pt_pcb-> Pcb_oX, Y's board.
|
||||
*/
|
||||
void TraceArc( int ux0,int uy0, int ux1, int uy1, int ArcAngle, int lg,
|
||||
int layer, int color, int op_logique);
|
||||
|
||||
/* SOLVE.CPP */
|
||||
|
||||
/* QUEUE.CPP */
|
||||
void FreeQueue(); /* Libere la memoire de la queue de recherche */
|
||||
void FreeQueue();
|
||||
void InitQueue();
|
||||
void GetQueue( int *, int *, int *, int *, int * );
|
||||
int SetQueue( int, int, int, int, int, int, int );
|
||||
@ -68,9 +66,9 @@ int GetApxDist( int, int, int, int );
|
||||
int CalcDist( int, int, int ,int );
|
||||
|
||||
/* BOARD.CPP */
|
||||
bool ComputeMatriceSize(WinEDA_BasePcbFrame * frame, int pas_route);
|
||||
int Build_Work(BOARD * Pcb);
|
||||
void PlaceCells(BOARD * Pcb, int net_code, int flag = 0);
|
||||
bool ComputeMatriceSize( WinEDA_BasePcbFrame * frame, int pas_route );
|
||||
int Build_Work( BOARD * Pcb );
|
||||
void PlaceCells( BOARD * Pcb, int net_code, int flag = 0 );
|
||||
|
||||
BoardCell GetCell( int, int, int );
|
||||
void SetCell( int, int, int, BoardCell );
|
||||
@ -82,4 +80,3 @@ DistCell GetDist( int, int, int );
|
||||
void SetDist( int, int, int, DistCell );
|
||||
int GetDir( int, int, int );
|
||||
void SetDir( int, int, int, int );
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/******************************************/
|
||||
/* Track editing: attribute flags edition */
|
||||
/* Track editing: attribute flags editing */
|
||||
/******************************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
@ -12,15 +12,12 @@
|
||||
#include "protos.h"
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
void WinEDA_PcbFrame::Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On )
|
||||
/*****************************************************************************/
|
||||
|
||||
/* Attribute change for 1 track segment.
|
||||
* Attributes are
|
||||
* SEGM_FIXE protection against global delete
|
||||
* SEGM_AR AutoRouted segment
|
||||
* SEGM_FIXE protection against global delete
|
||||
* SEGM_AR AutoRouted segment
|
||||
*/
|
||||
void WinEDA_PcbFrame::Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On )
|
||||
{
|
||||
if( track == NULL )
|
||||
return;
|
||||
@ -34,10 +31,8 @@ void WinEDA_PcbFrame::Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On )
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
void WinEDA_PcbFrame::Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On )
|
||||
/***************************************************************************/
|
||||
/* Attribute change for an entire track */
|
||||
void WinEDA_PcbFrame::Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On )
|
||||
{
|
||||
TRACK* Track;
|
||||
int nb_segm;
|
||||
@ -62,14 +57,11 @@ void WinEDA_PcbFrame::Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On )
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
void WinEDA_PcbFrame::Attribut_net( wxDC* DC, int net_code, bool Flag_On )
|
||||
/***********************************************************************/
|
||||
|
||||
/* Modify the flag SEGM_FIXE according to Flag_On value,
|
||||
* for all the segments related to net_code.
|
||||
* if net_code < 0 all the segments are modified.
|
||||
*/
|
||||
void WinEDA_PcbFrame::Attribut_net( wxDC* DC, int net_code, bool Flag_On )
|
||||
{
|
||||
TRACK* Track = GetBoard()->m_Track;
|
||||
|
||||
|
@ -1,10 +1,7 @@
|
||||
/****************************************************************/
|
||||
/* Routines de deplacement automatique et rotation des MODULES */
|
||||
/* routines et menu d'autoplacement */
|
||||
/* Routines for automatic displacement and rotation of modules. */
|
||||
/****************************************************************/
|
||||
|
||||
/* Fichier automove.cpp */
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
#include "common.h"
|
||||
@ -19,8 +16,6 @@
|
||||
#include "protos.h"
|
||||
|
||||
|
||||
/* variables locales */
|
||||
|
||||
typedef enum {
|
||||
FIXE_MODULE,
|
||||
FREE_MODULE,
|
||||
@ -29,19 +24,15 @@ typedef enum {
|
||||
} SelectFixeFct;
|
||||
|
||||
|
||||
/* Fonctions locales */
|
||||
static int tri_modules( MODULE** pt_ref, MODULE** pt_compare );
|
||||
|
||||
/* Variables locales */
|
||||
|
||||
wxString ModulesMaskSelection = wxT( "*" );
|
||||
|
||||
|
||||
/******************************************************/
|
||||
void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event )
|
||||
/******************************************************/
|
||||
|
||||
/* Called on events (popup menus) relative to automove and autoplace footprints
|
||||
*/
|
||||
void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event )
|
||||
{
|
||||
int id = event.GetId();
|
||||
wxPoint pos;
|
||||
@ -79,7 +70,7 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event )
|
||||
break;
|
||||
}
|
||||
|
||||
/* Erase rastnest if needed */
|
||||
/* Erase ratsnest if needed */
|
||||
if( g_Show_Ratsnest )
|
||||
DrawGeneralRatsnest( &dc );
|
||||
GetBoard()->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST;
|
||||
@ -150,7 +141,7 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event )
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_REORIENT_ALL_MODULES:
|
||||
OnOrientFootprints( );
|
||||
OnOrientFootprints();
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_AUTOROUTE_ALL_MODULES:
|
||||
@ -187,33 +178,31 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event )
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
void WinEDA_PcbFrame::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
|
||||
/*****************************************************************************/
|
||||
|
||||
/* Routine de repartition des composants dans un rectangle de format 4 / 3,
|
||||
* partant du curseur souris
|
||||
* Les composants ayant le status FIXE ne sont normalement pas bouges
|
||||
* Selon les flags:
|
||||
* Tous les modules (non fixes) seront repartis
|
||||
* Seuls les modules Hors PCB seront repartis
|
||||
/* Routine allocation of components in a rectangular format 4 / 3,
|
||||
* Starting from the mouse cursor
|
||||
* The components with the FIXED status are not normally dives
|
||||
* According to the flags:
|
||||
* All modules (not fixed) will be left
|
||||
* Only PCB modules are not left
|
||||
*/
|
||||
void WinEDA_PcbFrame::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
|
||||
{
|
||||
MODULE** pt_Dmod, ** BaseListeModules;
|
||||
MODULE* Module;
|
||||
wxPoint start, current;
|
||||
int Ymax_size, Xsize_allowed;
|
||||
int pas_grille = (int)GetScreen()->GetGridSize().x;
|
||||
int pas_grille = (int) GetScreen()->GetGridSize().x;
|
||||
bool EdgeExists;
|
||||
float surface;
|
||||
|
||||
if( GetBoard()->m_Modules == NULL )
|
||||
{
|
||||
DisplayError( this, _( "No Modules!" ), 10 ); return;
|
||||
DisplayError( this, _( "No modules found!" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
/* Confirmation */
|
||||
if( !IsOK( this, _( "Move Modules ?" ) ) )
|
||||
if( !IsOK( this, _( "Move modules?" ) ) )
|
||||
return;
|
||||
|
||||
EdgeExists = SetBoardBoundaryBoxFromEdgesOnly();
|
||||
@ -221,13 +210,13 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
|
||||
if( PlaceModulesHorsPcb && !EdgeExists )
|
||||
{
|
||||
DisplayError( this,
|
||||
_( "Autoplace modules: No board edges detected. Unable to place modules" ),
|
||||
20 );
|
||||
_( "Could not automatically place modules. No board \
|
||||
edges detected." ) );
|
||||
return;
|
||||
}
|
||||
|
||||
Module = GetBoard()->m_Modules;
|
||||
for( ; Module != NULL; Module = Module->Next() ) // remise a jour du rect d'encadrement
|
||||
for( ; Module != NULL; Module = Module->Next() )
|
||||
{
|
||||
Module->Set_Rectangle_Encadrement();
|
||||
Module->SetRectangleExinscrit();
|
||||
@ -235,16 +224,18 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
|
||||
|
||||
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 allocation of modules not PCBs, the cursor is placed below
|
||||
* PCB, to avoid placing components in PCB area.
|
||||
*/
|
||||
if( PlaceModulesHorsPcb && EdgeExists )
|
||||
{
|
||||
if( GetScreen()->m_Curseur.y < (GetBoard()->m_BoundaryBox.GetBottom() + 2000) )
|
||||
GetScreen()->m_Curseur.y = GetBoard()->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 */
|
||||
/* calculating the area occupied by the circuits */
|
||||
surface = 0.0;
|
||||
for( pt_Dmod = BaseListeModules; *pt_Dmod != NULL; pt_Dmod++ )
|
||||
{
|
||||
@ -257,7 +248,7 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
|
||||
surface += Module->m_Surface;
|
||||
}
|
||||
|
||||
Xsize_allowed = (int) (sqrt( surface ) * 4.0 / 3.0);
|
||||
Xsize_allowed = (int) ( sqrt( surface ) * 4.0 / 3.0 );
|
||||
|
||||
start = current = GetScreen()->m_Curseur;
|
||||
Ymax_size = 0;
|
||||
@ -299,15 +290,12 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************/
|
||||
void WinEDA_PcbFrame::FixeModule( MODULE* Module, bool Fixe )
|
||||
/***********************************************************/
|
||||
|
||||
/* Met a jour (FALSE ou TRUE) l'attribut FIXE sur le module Module,
|
||||
* ou sur tous les modules si Modulle == NULL
|
||||
/* Update (TRUE or FALSE) FIXED attribute on the module Module
|
||||
* or all the modules if Module == NULL
|
||||
*/
|
||||
void WinEDA_PcbFrame::FixeModule( MODULE* Module, bool Fixe )
|
||||
{
|
||||
if( Module ) /* Traitement du module */
|
||||
if( Module )
|
||||
{
|
||||
Module->SetLocked( Fixe );
|
||||
|
||||
@ -319,7 +307,8 @@ void WinEDA_PcbFrame::FixeModule( MODULE* Module, bool Fixe )
|
||||
Module = GetBoard()->m_Modules;
|
||||
for( ; Module != NULL; Module = Module->Next() )
|
||||
{
|
||||
if( WildCompareString( ModulesMaskSelection, Module->m_Reference->m_Text ) )
|
||||
if( WildCompareString( ModulesMaskSelection,
|
||||
Module->m_Reference->m_Text ) )
|
||||
{
|
||||
Module->SetLocked( Fixe );
|
||||
GetScreen()->SetModify();
|
||||
@ -329,29 +318,25 @@ void WinEDA_PcbFrame::FixeModule( MODULE* Module, bool Fixe )
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************/
|
||||
MODULE** GenListeModules( BOARD* Pcb, int* NbModules )
|
||||
/*********************************************************/
|
||||
|
||||
/* Cree par allocation memoire la liste ordonnee des structures D_MODULES
|
||||
* decrivant les modules a deplacer
|
||||
* la fin de la liste est signalee par NULL
|
||||
* Retourne egalement le nombre de modules par *NbModules
|
||||
* Penser a desallouer la memoire apres usage
|
||||
/* Create memory allocation by the ordered list of structures D_MODULES
|
||||
* Describing the module to move
|
||||
* The end of the list is indicated by NULL
|
||||
* Also returns the number of modules per NbModules *
|
||||
* Deallocates memory after use
|
||||
*/
|
||||
MODULE** GenListeModules( BOARD* Pcb, int* NbModules )
|
||||
{
|
||||
MODULE* Module;
|
||||
MODULE** ListeMod, ** PtList;
|
||||
int NbMod;
|
||||
|
||||
/* Reservation de la memoire pour description des modules que l'on
|
||||
* peut deplacer */
|
||||
/* Reserve memory for descriptions of modules that are to be moved. */
|
||||
Module = Pcb->m_Modules;
|
||||
NbMod = 0;
|
||||
for( ; Module != NULL; Module = Module->Next() )
|
||||
NbMod++;
|
||||
|
||||
ListeMod = (MODULE**) MyZMalloc( (NbMod + 1) * sizeof(MODULE *) );
|
||||
ListeMod = (MODULE**) MyZMalloc( (NbMod + 1) * sizeof(MODULE*) );
|
||||
if( ListeMod == NULL )
|
||||
{
|
||||
if( NbModules != NULL )
|
||||
@ -367,9 +352,9 @@ MODULE** GenListeModules( BOARD* Pcb, int* NbModules )
|
||||
Module->SetRectangleExinscrit();
|
||||
}
|
||||
|
||||
/* Tri par surface decroissante des modules ( on place les plus gros en 1er) */
|
||||
/* Sort by surface area module largest to smallest */
|
||||
qsort( ListeMod, NbMod, sizeof(MODULE * *),
|
||||
( int( * ) ( const void*, const void* ) )tri_modules );
|
||||
( int ( * )( const void*, const void* ) )tri_modules );
|
||||
|
||||
if( NbModules != NULL )
|
||||
*NbModules = NbMod;
|
||||
@ -377,10 +362,6 @@ MODULE** GenListeModules( BOARD* Pcb, int* NbModules )
|
||||
}
|
||||
|
||||
|
||||
/**************************************************/
|
||||
/* Routine de tri de modules, utilisee par qsort: */
|
||||
/**************************************************/
|
||||
|
||||
static int tri_modules( MODULE** pt_ref, MODULE** pt_compare )
|
||||
{
|
||||
float ff;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -17,8 +17,8 @@
|
||||
#include "protos.h"
|
||||
|
||||
|
||||
int E_scale; /* facteur d'echelle des tables de distance */
|
||||
int Nb_Sides; /* Nombre de couches pour autoroutage (0 ou 1) */
|
||||
int E_scale; /* Scaling factor of distance tables. */
|
||||
int Nb_Sides; /* Number of layer for autorouting (0 or 1) */
|
||||
int Nrows = ILLEGAL;
|
||||
int Ncols = ILLEGAL;
|
||||
int Ntotal;
|
||||
@ -30,10 +30,8 @@ int MaxNodes; /* maximum number of nodes opened at one time */
|
||||
BOARDHEAD Board; /* 2-sided board */
|
||||
|
||||
|
||||
/********************************************************/
|
||||
void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
|
||||
/********************************************************/
|
||||
/* init board, route traces*/
|
||||
void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
|
||||
{
|
||||
int start, stop;
|
||||
MODULE* Module = NULL;
|
||||
@ -78,7 +76,8 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
|
||||
Module = (MODULE*) GetScreen()->GetCurItem();
|
||||
if( (Module == NULL) || (Module->Type() != TYPE_MODULE) )
|
||||
{
|
||||
DisplayError( this, _( "Module not selected" ) ); return;
|
||||
DisplayError( this, _( "Module not selected" ) );
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -86,7 +85,8 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
|
||||
Pad = (D_PAD*) GetScreen()->GetCurItem();
|
||||
if( (Pad == NULL) || (Pad->Type() != TYPE_PAD) )
|
||||
{
|
||||
DisplayError( this, _( "Pad not selected" ) ); return;
|
||||
DisplayError( this, _( "Pad not selected" ) );
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -94,16 +94,17 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
|
||||
if( (GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK ) == 0 )
|
||||
Compile_Ratsnest( DC, TRUE );
|
||||
|
||||
/* Placement du flag CH_ROUTE_REQ sur les chevelus demandes */
|
||||
/* Set the flag on the ratsnest to CH_ROUTE_REQ. */
|
||||
for( unsigned ii = 0; ii < GetBoard()->GetRatsnestsCount(); ii++ )
|
||||
{
|
||||
RATSNEST_ITEM* ptmp = &GetBoard()->m_FullRatsnest[ii];
|
||||
RATSNEST_ITEM* ptmp = &GetBoard()->m_FullRatsnest[ii];
|
||||
ptmp->m_Status &= ~CH_ROUTE_REQ;
|
||||
|
||||
switch( mode )
|
||||
{
|
||||
case ROUTE_ALL:
|
||||
ptmp->m_Status |= CH_ROUTE_REQ; break;
|
||||
ptmp->m_Status |= CH_ROUTE_REQ;
|
||||
break;
|
||||
|
||||
case ROUTE_NET:
|
||||
if( autoroute_net_code == ptmp->GetNet() )
|
||||
@ -125,7 +126,7 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
|
||||
}
|
||||
|
||||
case ROUTE_PAD:
|
||||
if( (ptmp->m_PadStart == Pad) || (ptmp->m_PadEnd == Pad) )
|
||||
if( ( ptmp->m_PadStart == Pad ) || ( ptmp->m_PadEnd == Pad ) )
|
||||
ptmp->m_Status |= CH_ROUTE_REQ;
|
||||
break;
|
||||
}
|
||||
@ -133,19 +134,19 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
|
||||
|
||||
start = time( NULL );
|
||||
|
||||
/* Calcul du pas de routage fixe a 5 mils et plus */
|
||||
/* Calculation of no fixed routing to 5 mils and more. */
|
||||
g_GridRoutingSize = (int)GetScreen()->GetGridSize().x;
|
||||
if( g_GridRoutingSize < 50 )
|
||||
g_GridRoutingSize = 50;
|
||||
E_scale = g_GridRoutingSize / 50; if( E_scale < 1 )
|
||||
E_scale = 1;
|
||||
|
||||
/* calcule de Ncols et Nrow, taille de la matrice de routage */
|
||||
/* Calculated ncol and nrow, matrix size for routing. */
|
||||
ComputeMatriceSize( this, g_GridRoutingSize );
|
||||
|
||||
MsgPanel->EraseMsgBox();
|
||||
|
||||
/* Creation du mapping du board */
|
||||
/* Map the board */
|
||||
Nb_Sides = ONE_SIDE;
|
||||
if( Route_Layer_TOP != Route_Layer_BOTTOM )
|
||||
Nb_Sides = TWO_SIDES;
|
||||
@ -153,14 +154,14 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
|
||||
if( Board.InitBoard() < 0 )
|
||||
{
|
||||
DisplayError( this, _( "No memory for autorouting" ) );
|
||||
Board.UnInitBoard(); /* Libere la memoire BitMap */
|
||||
Board.UnInitBoard(); /* Free memory. */
|
||||
return;
|
||||
}
|
||||
|
||||
Affiche_Message( _( "Place Cells" ) );
|
||||
PlaceCells( GetBoard(), -1, FORCE_PADS );
|
||||
|
||||
/* Construction de la liste des pistes a router */
|
||||
/* Construction of the track list for router. */
|
||||
Build_Work( GetBoard() );
|
||||
|
||||
// DisplayBoard(DrawPanel, DC);
|
||||
@ -170,26 +171,24 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
|
||||
else
|
||||
Solve( DC, ONE_SIDE ); /* simple face */
|
||||
|
||||
/* Liberation de la memoire */
|
||||
FreeQueue(); /* Libere la memoire de routage */
|
||||
InitWork(); /* Libere la memoire de la liste des connexions a router */
|
||||
Board.UnInitBoard(); /* Libere la memoire BitMap */
|
||||
/* Free memory. */
|
||||
FreeQueue();
|
||||
InitWork(); /* Free memory for the list of router connections. */
|
||||
Board.UnInitBoard();
|
||||
stop = time( NULL ) - start;
|
||||
msg.Printf( wxT( "time = %d second%s" ), stop, (stop == 1) ? wxT( "" ) : wxT( "s" ) );
|
||||
msg.Printf( wxT( "time = %d second%s" ), stop,
|
||||
( stop == 1 ) ? wxT( "" ) : wxT( "s" ) );
|
||||
Affiche_Message( msg );
|
||||
}
|
||||
|
||||
|
||||
/************************************************/
|
||||
void WinEDA_PcbFrame::Reset_Noroutable( wxDC* DC )
|
||||
/*************************************************/
|
||||
|
||||
/* Remet a 0 le flag CH_NOROUTABLE qui est positionne a 1 par Solve()
|
||||
* lorsque un chevelu n'a pas ete route.
|
||||
* Si ce flag est a 1 il n'est pas reroute
|
||||
/* Clear the flag has CH_NOROUTABLE which is set to 1 by Solve()
|
||||
* When a ratsnets has not been routed.
|
||||
* If this flag is 1 it is not reroute
|
||||
*/
|
||||
void WinEDA_PcbFrame::Reset_Noroutable( wxDC* DC )
|
||||
{
|
||||
if( (GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK )== 0 )
|
||||
if( ( GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK )== 0 )
|
||||
Compile_Ratsnest( DC, TRUE );
|
||||
|
||||
for( unsigned ii = 0; ii < GetBoard()->GetRatsnestsCount(); ii++ )
|
||||
@ -199,17 +198,15 @@ void WinEDA_PcbFrame::Reset_Noroutable( wxDC* DC )
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************/
|
||||
/* Function DEBUG: displays filling cells TOP and BOTTOM */
|
||||
void DisplayBoard( WinEDA_DrawPanel* panel, wxDC* DC )
|
||||
/****************************************************/
|
||||
/* Fonction de DEBUG : affiche le remplissage des cellules TOP et BOTTOM */
|
||||
{
|
||||
int row, col, i, j;
|
||||
int dcell0, dcell1 = 0, color;
|
||||
int maxi;
|
||||
|
||||
maxi = 600 / Ncols;
|
||||
maxi = (maxi * 3 ) / 4;
|
||||
maxi = ( maxi * 3 ) / 4;
|
||||
if( !maxi )
|
||||
maxi = 1;
|
||||
|
||||
@ -227,7 +224,7 @@ void DisplayBoard( WinEDA_DrawPanel* panel, wxDC* DC )
|
||||
if( dcell1 & HOLE )
|
||||
color |= RED;
|
||||
// dcell0 |= dcell1;
|
||||
if( !color && (dcell0 & VIA_IMPOSSIBLE) )
|
||||
if( !color && ( dcell0 & VIA_IMPOSSIBLE ) )
|
||||
color = BLUE;
|
||||
if( dcell0 & CELL_is_EDGE )
|
||||
color = YELLOW;
|
||||
@ -241,8 +238,8 @@ void DisplayBoard( WinEDA_DrawPanel* panel, wxDC* DC )
|
||||
for( i = 0; i < maxi; i++ )
|
||||
for( j = 0; j < maxi; j++ )
|
||||
GRSPutPixel( &panel->m_ClipBox, DC,
|
||||
(col * maxi) + i + DRAW_OFFSET_X,
|
||||
(row * maxi) + j + DRAW_OFFSET_Y, color );
|
||||
( col * maxi ) + i + DRAW_OFFSET_X,
|
||||
( row * maxi ) + j + DRAW_OFFSET_Y, color );
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
/****************************************************/
|
||||
/* AUTOROUT.H */
|
||||
/* declarations communes relative au routage */
|
||||
/* et placement automatique des composants */
|
||||
/****************************************************/
|
||||
|
||||
#ifndef AUTOROUT_H
|
||||
@ -14,11 +12,7 @@
|
||||
#define ILLEGAL -1
|
||||
|
||||
|
||||
/***********************************************/
|
||||
/* description d'un segment de chevelu general */
|
||||
/***********************************************/
|
||||
|
||||
/* Commandes d'autoplacement / autorouage possibles */
|
||||
/* Autorouter commands. */
|
||||
enum CommandOpt {
|
||||
PLACE_ALL,
|
||||
PLACE_OUT_OF_BOARD,
|
||||
@ -32,17 +26,14 @@ enum CommandOpt {
|
||||
};
|
||||
|
||||
|
||||
/* Variables et structures d'autoroutage */
|
||||
|
||||
extern int E_scale; /* facteur d'echelle des tables de distance */
|
||||
extern int E_scale; /* Scaling factor of distance tables. */
|
||||
|
||||
#define ONE_SIDE 0
|
||||
#define TWO_SIDES 1
|
||||
|
||||
extern int Nb_Sides; /* Nombre de couches pour autoroutage (0 ou 1) */
|
||||
extern int Nb_Sides; /* Number of layers for autorouting (0 or 1) */
|
||||
|
||||
/* Bits Flags de gestion de remplissage du BOARD */
|
||||
#define FORCE_PADS 1 /* pour forcage placement pads quel que soit le netcode */
|
||||
#define FORCE_PADS 1 /* Force placement of pads for any Netcode */
|
||||
|
||||
/* board dimensions */
|
||||
extern int Nrows;
|
||||
@ -55,8 +46,7 @@ extern int ClosNodes; /* total number of nodes closed */
|
||||
extern int MoveNodes; /* total number of nodes moved */
|
||||
extern int MaxNodes; /* maximum number of nodes opened at one time */
|
||||
|
||||
/* Structures utiles a la generation du board en Bit Map */
|
||||
|
||||
/* Structures useful to the generation of board as bitmap. */
|
||||
|
||||
typedef char BoardCell;
|
||||
typedef int DistCell;
|
||||
@ -65,8 +55,10 @@ class BOARDHEAD /* header of blocks of BoardCell */
|
||||
{
|
||||
public:
|
||||
BoardCell* m_BoardSide[2]; /* ptr to block of memory: 2-sided board */
|
||||
DistCell* m_DistSide[2]; /* ptr to block of memory: path distance to cells */
|
||||
char* m_DirSide[2]; /* header of blocks of chars:pointers back to source */
|
||||
DistCell* m_DistSide[2]; /* ptr to block of memory: path distance to
|
||||
* cells */
|
||||
char* m_DirSide[2]; /* header of blocks of chars:pointers back to
|
||||
* source */
|
||||
bool m_InitBoardDone;
|
||||
int m_Layers;
|
||||
int m_Nrows, m_Ncols;
|
||||
@ -82,7 +74,7 @@ public:
|
||||
extern BOARDHEAD Board; /* 2-sided board */
|
||||
|
||||
|
||||
/* Constantes utilisees pour le trace des cellules sur le BOARD */
|
||||
/* Constants used to trace the cells on the BOARD */
|
||||
#define WRITE_CELL 0
|
||||
#define WRITE_OR_CELL 1
|
||||
#define WRITE_XOR_CELL 2
|
||||
|
@ -1,6 +1,6 @@
|
||||
/************************************************************************/
|
||||
/* basepcbframe.cpp - fonctions des classes du type WinEDA_BasePcbFrame */
|
||||
/************************************************************************/
|
||||
/********************/
|
||||
/* basepcbframe.cpp */
|
||||
/********************/
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
@ -44,10 +44,6 @@ BEGIN_EVENT_TABLE( WinEDA_BasePcbFrame, WinEDA_DrawFrame )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
/****************/
|
||||
/* Constructeur */
|
||||
/****************/
|
||||
|
||||
WinEDA_BasePcbFrame::WinEDA_BasePcbFrame( wxWindow* father,
|
||||
int idtype,
|
||||
const wxString& title,
|
||||
@ -95,12 +91,10 @@ void WinEDA_BasePcbFrame::SetBoard( BOARD* aBoard )
|
||||
}
|
||||
|
||||
|
||||
/**************************************/
|
||||
int WinEDA_BasePcbFrame::BestZoom( void )
|
||||
/**************************************/
|
||||
/**
|
||||
* Return the "best" zoom, i.e. the zoom which shows the entire board on screen
|
||||
*/
|
||||
int WinEDA_BasePcbFrame::BestZoom( void )
|
||||
{
|
||||
int dx, dy, ii, jj;
|
||||
int bestzoom;
|
||||
@ -124,9 +118,7 @@ int WinEDA_BasePcbFrame::BestZoom( void )
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************/
|
||||
void WinEDA_BasePcbFrame::CursorGoto( const wxPoint& aPos )
|
||||
/***********************************************************/
|
||||
{
|
||||
// factored out of pcbnew/find.cpp
|
||||
|
||||
@ -134,7 +126,7 @@ void WinEDA_BasePcbFrame::CursorGoto( const wxPoint& aPos )
|
||||
|
||||
wxClientDC dc( DrawPanel );
|
||||
|
||||
/* Il y a peut-etre necessite de recadrer le dessin: */
|
||||
/* There may be need to reframe the drawing. */
|
||||
if( !DrawPanel->IsPointOnDisplay( aPos ) )
|
||||
{
|
||||
screen->m_Curseur = aPos;
|
||||
@ -151,27 +143,21 @@ void WinEDA_BasePcbFrame::CursorGoto( const wxPoint& aPos )
|
||||
}
|
||||
|
||||
|
||||
/*************************************************/
|
||||
void WinEDA_BasePcbFrame::ReCreateMenuBar( void )
|
||||
/*************************************************/
|
||||
|
||||
// Virtual function
|
||||
void WinEDA_BasePcbFrame::ReCreateMenuBar( void )
|
||||
{
|
||||
}
|
||||
|
||||
/* Virtual functions: Do nothing for WinEDA_BasePcbFrame window */
|
||||
|
||||
/* Virtual functions: Do nothing for WinEDA_BasePcbFrame window */
|
||||
void WinEDA_BasePcbFrame::Show3D_Frame( wxCommandEvent& event )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****************************************************************/
|
||||
void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer )
|
||||
/*****************************************************************/
|
||||
|
||||
// Note: virtual, overridden in WinEDA_PcbFrame;
|
||||
void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer )
|
||||
{
|
||||
int preslayer = ((PCB_SCREEN*)GetScreen())->m_Active_Layer;
|
||||
|
||||
@ -200,8 +186,8 @@ void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer )
|
||||
// layers are also capable of being selected.
|
||||
else
|
||||
{
|
||||
if( (layer != COPPER_LAYER_N) && (layer != LAYER_CMP_N)
|
||||
&& (layer >= m_Pcb->m_BoardSettings->GetCopperLayerCount() - 1) )
|
||||
if( ( layer != COPPER_LAYER_N ) && ( layer != LAYER_CMP_N )
|
||||
&& ( layer >= m_Pcb->m_BoardSettings->GetCopperLayerCount() - 1 ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -244,9 +230,7 @@ void WinEDA_BasePcbFrame::ProcessItemSelection( wxCommandEvent& event )
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
void WinEDA_BasePcbFrame::SetCurItem( BOARD_ITEM* aItem, bool aDisplayInfo )
|
||||
/*****************************************************************/
|
||||
{
|
||||
GetScreen()->SetCurItem( aItem );
|
||||
|
||||
@ -275,20 +259,16 @@ void WinEDA_BasePcbFrame::SetCurItem( BOARD_ITEM* aItem, bool aDisplayInfo )
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
BOARD_ITEM* WinEDA_BasePcbFrame::GetCurItem()
|
||||
/*****************************************************************/
|
||||
{
|
||||
return GetScreen()->GetCurItem();
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************/
|
||||
GENERAL_COLLECTORS_GUIDE WinEDA_BasePcbFrame::GetCollectorsGuide()
|
||||
/****************************************************************/
|
||||
{
|
||||
GENERAL_COLLECTORS_GUIDE guide( m_Pcb->m_BoardSettings->GetVisibleLayers(),
|
||||
((PCB_SCREEN*)GetScreen())->m_Active_Layer );
|
||||
( (PCB_SCREEN*)GetScreen())->m_Active_Layer );
|
||||
|
||||
// account for the globals
|
||||
guide.SetIgnoreMTextsMarkedNoShow( ! g_DesignSettings.IsElementVisible( MODULE_TEXT_NOV_VISIBLE ));
|
||||
@ -324,10 +304,11 @@ void WinEDA_BasePcbFrame::SetToolID( int id, int new_cursor_id,
|
||||
DrawPanel->Refresh();
|
||||
}
|
||||
|
||||
void WinEDA_BasePcbFrame::UpdateStatusBar()
|
||||
|
||||
/*
|
||||
* Update the status bar information.
|
||||
*/
|
||||
void WinEDA_BasePcbFrame::UpdateStatusBar()
|
||||
{
|
||||
WinEDA_DrawFrame::UpdateStatusBar();
|
||||
|
||||
@ -351,7 +332,8 @@ void WinEDA_BasePcbFrame::UpdateStatusBar()
|
||||
theta = theta * 180.0 / M_PI;
|
||||
|
||||
ro = sqrt( ( (double) dx * dx ) + ( (double) dy * dy ) );
|
||||
Line.Printf( g_UnitMetric ? wxT( "Ro %.3f Th %.1f" ) : wxT( "Ro %.4f Th %.1f" ),
|
||||
Line.Printf( g_UnitMetric ? wxT( "Ro %.3f Th %.1f" ) :
|
||||
wxT( "Ro %.4f Th %.1f" ),
|
||||
To_User_Unit( g_UnitMetric, ro, m_InternalUnits ),
|
||||
theta );
|
||||
|
||||
@ -381,21 +363,24 @@ void WinEDA_BasePcbFrame::LoadSettings()
|
||||
wxConfig* cfg = wxGetApp().m_EDA_Config;
|
||||
|
||||
WinEDA_DrawFrame::LoadSettings();
|
||||
// Ensure grid id is an existant grid id:
|
||||
// Ensure grid id is an existent grid id:
|
||||
if( (m_LastGridSizeId <= 0) ||
|
||||
(m_LastGridSizeId > (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000)) )
|
||||
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_500 - ID_POPUP_GRID_LEVEL_1000;
|
||||
|
||||
cfg->Read( m_FrameName + UserGridSizeXEntry, &m_UserGridSize.x, 0.01 );
|
||||
cfg->Read( m_FrameName + UserGridSizeYEntry, &m_UserGridSize.y, 0.01 );
|
||||
cfg->Read( m_FrameName + UserGridUnitsEntry, &m_UserGridUnits, ( long )INCHES );
|
||||
cfg->Read( m_FrameName + UserGridUnitsEntry, &m_UserGridUnits,
|
||||
( long )INCHES );
|
||||
cfg->Read( m_FrameName + DisplayPadFillEntry, &m_DisplayPadFill, true );
|
||||
cfg->Read( m_FrameName + DisplayViaFillEntry, &m_DisplayViaFill, true );
|
||||
cfg->Read( m_FrameName + DisplayPadNumberEntry, &m_DisplayPadNum, true );
|
||||
cfg->Read( m_FrameName + DisplayModuleEdgeEntry, &m_DisplayModEdge, ( long )FILLED );
|
||||
cfg->Read( m_FrameName + DisplayModuleEdgeEntry, &m_DisplayModEdge,
|
||||
( long )FILLED );
|
||||
if( m_DisplayModEdge < FILAIRE || m_DisplayModEdge > SKETCH )
|
||||
m_DisplayModEdge = FILLED;
|
||||
cfg->Read( m_FrameName + DisplayModuleTextEntry, &m_DisplayModText, ( long )FILLED );
|
||||
cfg->Read( m_FrameName + DisplayModuleTextEntry, &m_DisplayModText,
|
||||
( long )FILLED );
|
||||
if( m_DisplayModText < FILAIRE || m_DisplayModText > SKETCH )
|
||||
m_DisplayModText = FILLED;
|
||||
}
|
||||
|
195
pcbnew/block.cpp
195
pcbnew/block.cpp
@ -1,6 +1,6 @@
|
||||
/*****************************************************************/
|
||||
/* Operations sur Blocks : deplacement, rotation, effacement ... */
|
||||
/*****************************************************************/
|
||||
/*************/
|
||||
/* block.cpp */
|
||||
/*************/
|
||||
|
||||
|
||||
#include "fctsys.h"
|
||||
@ -21,12 +21,11 @@
|
||||
|
||||
#define BLOCK_COLOR BROWN
|
||||
|
||||
/* Routines Locales */
|
||||
|
||||
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
||||
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||
bool erase );
|
||||
|
||||
|
||||
/* Variables locales :*/
|
||||
static bool Block_Include_Modules = TRUE;
|
||||
static bool Block_Include_Tracks = TRUE;
|
||||
static bool Block_Include_Zones = TRUE;
|
||||
@ -34,6 +33,7 @@ static bool Block_Include_Draw_Items = TRUE;
|
||||
static bool Block_Include_Edges_Items = TRUE;
|
||||
static bool Block_Include_PcbTextes = TRUE;
|
||||
|
||||
|
||||
/************************************/
|
||||
/* class WinEDA_ExecBlockCmdFrame */
|
||||
/************************************/
|
||||
@ -52,7 +52,6 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
// Constructor and destructor
|
||||
WinEDA_ExecBlockCmdFrame( WinEDA_BasePcbFrame* parent,
|
||||
const wxString& title );
|
||||
~WinEDA_ExecBlockCmdFrame()
|
||||
@ -67,22 +66,22 @@ private:
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE( WinEDA_ExecBlockCmdFrame, wxDialog )
|
||||
EVT_BUTTON( wxID_OK, WinEDA_ExecBlockCmdFrame::ExecuteCommand )
|
||||
EVT_BUTTON( wxID_CANCEL, WinEDA_ExecBlockCmdFrame::Cancel )
|
||||
EVT_BUTTON( wxID_OK, WinEDA_ExecBlockCmdFrame::ExecuteCommand )
|
||||
EVT_BUTTON( wxID_CANCEL, WinEDA_ExecBlockCmdFrame::Cancel )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
/**************************************************************/
|
||||
static bool InstallBlockCmdFrame( WinEDA_BasePcbFrame* parent,
|
||||
const wxString& title )
|
||||
/**************************************************************/
|
||||
{
|
||||
int nocmd;
|
||||
wxPoint oldpos = parent->GetScreen()->m_Curseur;
|
||||
|
||||
parent->DrawPanel->m_IgnoreMouseEvents = TRUE;
|
||||
WinEDA_ExecBlockCmdFrame* frame = new WinEDA_ExecBlockCmdFrame( parent, title );
|
||||
WinEDA_ExecBlockCmdFrame* frame =
|
||||
new WinEDA_ExecBlockCmdFrame( parent, title );
|
||||
|
||||
nocmd = frame->ShowModal();
|
||||
frame->Destroy();
|
||||
@ -92,19 +91,17 @@ static bool InstallBlockCmdFrame( WinEDA_BasePcbFrame* parent,
|
||||
parent->DrawPanel->MouseToCursorSchema();
|
||||
parent->DrawPanel->m_IgnoreMouseEvents = FALSE;
|
||||
|
||||
parent->DrawPanel->SetCursor(
|
||||
parent->DrawPanel->m_PanelCursor = parent->DrawPanel->m_PanelDefaultCursor );
|
||||
parent->DrawPanel->SetCursor( parent->DrawPanel->m_PanelCursor =
|
||||
parent->DrawPanel->m_PanelDefaultCursor );
|
||||
|
||||
return nocmd ? FALSE : TRUE;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
WinEDA_ExecBlockCmdFrame::WinEDA_ExecBlockCmdFrame( WinEDA_BasePcbFrame* parent,
|
||||
const wxString& title ) :
|
||||
wxDialog( parent, -1, title, wxPoint( -1, -1 ), wxDefaultSize,
|
||||
DIALOG_STYLE )
|
||||
/******************************************************************************/
|
||||
{
|
||||
wxPoint pos;
|
||||
wxButton* m_button1;
|
||||
@ -122,38 +119,38 @@ WinEDA_ExecBlockCmdFrame::WinEDA_ExecBlockCmdFrame( WinEDA_BasePcbFrame* parent,
|
||||
fgSizer1->SetFlexibleDirection( wxBOTH );
|
||||
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
// Selection des options :
|
||||
m_Include_Modules = new wxCheckBox( this, -1, _(
|
||||
"Include Modules" ), wxDefaultPosition, wxDefaultSize,
|
||||
m_Include_Modules = new wxCheckBox( this, -1, _( "Include Modules" ),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
0 );
|
||||
m_Include_Modules->SetValue( Block_Include_Modules );
|
||||
fgSizer1->Add( m_Include_Modules, 0, wxALL, 5 );
|
||||
|
||||
m_Include_Tracks = new wxCheckBox( this, -1, _(
|
||||
"Include tracks" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_Include_Tracks = new wxCheckBox( this, -1, _( "Include tracks" ),
|
||||
wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_Include_Tracks->SetValue( Block_Include_Tracks );
|
||||
fgSizer1->Add( m_Include_Tracks, 0, wxALL, 5 );
|
||||
|
||||
m_Include_Zones = new wxCheckBox( this, -1, _(
|
||||
"Include zones" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_Include_Zones = new wxCheckBox( this, -1, _( "Include zones" ),
|
||||
wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_Include_Zones->SetValue( Block_Include_Zones );
|
||||
fgSizer1->Add( m_Include_Zones, 0, wxALL, 5 );
|
||||
|
||||
m_Include_PcbTextes = new wxCheckBox( this, -1,
|
||||
_(
|
||||
"Include Text on copper layers" ), wxDefaultPosition,
|
||||
_( "Include Text on copper layers" ),
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize, 0 );
|
||||
m_Include_PcbTextes->SetValue( Block_Include_PcbTextes );
|
||||
fgSizer1->Add( m_Include_PcbTextes, 0, wxALL, 5 );
|
||||
|
||||
m_Include_Draw_Items = new wxCheckBox( this, -1, _(
|
||||
"Include drawings" ), wxDefaultPosition,
|
||||
m_Include_Draw_Items = new wxCheckBox( this, -1, _( "Include drawings" ),
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize, 0 );
|
||||
m_Include_Draw_Items->SetValue( Block_Include_Draw_Items );
|
||||
fgSizer1->Add( m_Include_Draw_Items, 0, wxALL, 5 );
|
||||
|
||||
m_Include_Edges_Items = new wxCheckBox( this, -1, _(
|
||||
"Include board outline layer" ), wxDefaultPosition,
|
||||
m_Include_Edges_Items = new wxCheckBox( this, -1,
|
||||
_( "Include board outline layer" ),
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize, 0 );
|
||||
m_Include_Edges_Items->SetValue( Block_Include_Edges_Items );
|
||||
fgSizer1->Add( m_Include_Edges_Items, 0, wxALL, 5 );
|
||||
@ -164,11 +161,11 @@ WinEDA_ExecBlockCmdFrame::WinEDA_ExecBlockCmdFrame( WinEDA_BasePcbFrame* parent,
|
||||
fgSizer2->SetFlexibleDirection( wxBOTH );
|
||||
fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
/* Creation des boutons de commande */
|
||||
m_button2 = new wxButton( this, wxID_CANCEL, _(
|
||||
"Cancel" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_button2 = new wxButton( this, wxID_CANCEL, _( "Cancel" ),
|
||||
wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgSizer2->Add( m_button2, 0, wxALL, 5 );
|
||||
m_button1 = new wxButton( this, wxID_OK, _( "OK" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_button1 = new wxButton( this, wxID_OK, _( "OK" ), wxDefaultPosition,
|
||||
wxDefaultSize, 0 );
|
||||
m_button1->SetDefault();
|
||||
fgSizer2->Add( m_button1, 0, wxALL, 5 );
|
||||
|
||||
@ -179,17 +176,13 @@ WinEDA_ExecBlockCmdFrame::WinEDA_ExecBlockCmdFrame( WinEDA_BasePcbFrame* parent,
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
void WinEDA_ExecBlockCmdFrame::Cancel( wxCommandEvent& WXUNUSED (event) )
|
||||
/**********************************************************************/
|
||||
{
|
||||
EndModal( -1 );
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************/
|
||||
void WinEDA_ExecBlockCmdFrame::ExecuteCommand( wxCommandEvent& event )
|
||||
/*******************************************************************/
|
||||
{
|
||||
Block_Include_Modules = m_Include_Modules->GetValue();
|
||||
Block_Include_Tracks = m_Include_Tracks->GetValue();
|
||||
@ -202,13 +195,10 @@ void WinEDA_ExecBlockCmdFrame::ExecuteCommand( wxCommandEvent& event )
|
||||
}
|
||||
|
||||
|
||||
/*************************************************/
|
||||
int WinEDA_PcbFrame::ReturnBlockCommand( int key )
|
||||
/*************************************************/
|
||||
|
||||
/* Return the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to
|
||||
* the key (ALT, SHIFT ALT ..)
|
||||
*/
|
||||
int WinEDA_PcbFrame::ReturnBlockCommand( int key )
|
||||
{
|
||||
int cmd = 0;
|
||||
|
||||
@ -247,10 +237,8 @@ int WinEDA_PcbFrame::ReturnBlockCommand( int key )
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************/
|
||||
/* Routine to handle the BLOCK PLACE command */
|
||||
void WinEDA_PcbFrame::HandleBlockPlace( wxDC* DC )
|
||||
/*****************************************************/
|
||||
/* Routine to handle the BLOCK PLACE commande */
|
||||
{
|
||||
bool err = FALSE;
|
||||
|
||||
@ -308,16 +296,13 @@ void WinEDA_PcbFrame::HandleBlockPlace( wxDC* DC )
|
||||
}
|
||||
|
||||
|
||||
/**********************************************/
|
||||
int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
|
||||
/**********************************************/
|
||||
|
||||
/* Routine de gestion de la commande BLOCK END
|
||||
* returne :
|
||||
* 0 si aucun composant selectionne
|
||||
* 1 sinon
|
||||
* -1 si commande terminée et composants trouvés (block delete, block save)
|
||||
/* Handle END BLOCK command.
|
||||
* Returns:
|
||||
* 0 if no features selected
|
||||
* 1 otherwise
|
||||
* -1 If order is completed and components found (block delete, block save)
|
||||
*/
|
||||
int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
|
||||
{
|
||||
int endcommande = TRUE;
|
||||
|
||||
@ -372,7 +357,7 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
|
||||
{
|
||||
DrawAndSizingBlockOutlines( DrawPanel, DC, FALSE );
|
||||
|
||||
// TODO (if useful) Save_Block( );
|
||||
// TODO (if useful) Save_Block( );
|
||||
}
|
||||
break;
|
||||
|
||||
@ -381,7 +366,7 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
|
||||
|
||||
case BLOCK_ZOOM: /* Window Zoom */
|
||||
|
||||
//Turn off the redraw block routine now so it is not displayed
|
||||
// Turn off the redraw block routine now so it is not displayed
|
||||
// with one corner at the new center of the screen
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
Window_Zoom( GetScreen()->m_BlockLocate );
|
||||
@ -424,10 +409,10 @@ void WinEDA_PcbFrame::Block_SelectItems()
|
||||
PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.m_ItemsSelection;
|
||||
ITEM_PICKER picker( NULL, UR_UNSPECIFIED );
|
||||
|
||||
/* Effacement des modules */
|
||||
if( Block_Include_Modules )
|
||||
{
|
||||
for( MODULE* module = m_Pcb->m_Modules; module != NULL; module = module->Next() )
|
||||
for( MODULE* module = m_Pcb->m_Modules; module != NULL;
|
||||
module = module->Next() )
|
||||
{
|
||||
if( module->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
{
|
||||
@ -441,7 +426,8 @@ void WinEDA_PcbFrame::Block_SelectItems()
|
||||
/* Remove tracks and vias */
|
||||
if( Block_Include_Tracks )
|
||||
{
|
||||
for( TRACK* pt_segm = m_Pcb->m_Track; pt_segm != NULL; pt_segm = pt_segm->Next() )
|
||||
for( TRACK* pt_segm = m_Pcb->m_Track; pt_segm != NULL;
|
||||
pt_segm = pt_segm->Next() )
|
||||
{
|
||||
if( pt_segm->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
{
|
||||
@ -461,7 +447,8 @@ void WinEDA_PcbFrame::Block_SelectItems()
|
||||
if( !Block_Include_Edges_Items )
|
||||
masque_layer &= ~EDGE_LAYER;
|
||||
|
||||
for( BOARD_ITEM* PtStruct = m_Pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
||||
for( BOARD_ITEM* PtStruct = m_Pcb->m_Drawings; PtStruct != NULL;
|
||||
PtStruct = PtStruct->Next() )
|
||||
{
|
||||
bool select_me = false;
|
||||
switch( PtStruct->Type() )
|
||||
@ -483,7 +470,7 @@ void WinEDA_PcbFrame::Block_SelectItems()
|
||||
break;
|
||||
|
||||
case TYPE_MIRE:
|
||||
if( (g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer) == 0 )
|
||||
if( ( g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer ) == 0 )
|
||||
break;
|
||||
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
break;
|
||||
@ -491,7 +478,7 @@ void WinEDA_PcbFrame::Block_SelectItems()
|
||||
break;
|
||||
|
||||
case TYPE_COTATION:
|
||||
if( (g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer) == 0 )
|
||||
if( ( g_TabOneLayerMask[PtStruct->GetLayer()] & masque_layer ) == 0 )
|
||||
break;
|
||||
if( !PtStruct->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
break;
|
||||
@ -518,7 +505,8 @@ void WinEDA_PcbFrame::Block_SelectItems()
|
||||
* m_Pcb->m_Zone can have a *lot* of items (100 000 is easily possible)
|
||||
* so it is not selected (and TODO: will be removed, one day)
|
||||
*/
|
||||
for( SEGZONE* pt_segm = m_Pcb->m_Zone; pt_segm != NULL; pt_segm = pt_segm->Next() )
|
||||
for( SEGZONE* pt_segm = m_Pcb->m_Zone; pt_segm != NULL;
|
||||
pt_segm = pt_segm->Next() )
|
||||
{ /* Segments used in Zone filling selection */
|
||||
|
||||
if( pt_segm->HitTest( GetScreen()->m_BlockLocate ) )
|
||||
@ -543,23 +531,22 @@ void WinEDA_PcbFrame::Block_SelectItems()
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||
/**************************************************************************/
|
||||
|
||||
/* Retrace le contour du block de repositionnement des structures a déplacer
|
||||
/* Traces the outline of the block structures during move.
|
||||
*/
|
||||
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||
bool erase )
|
||||
{
|
||||
int Color;
|
||||
BASE_SCREEN* screen = panel->GetScreen();
|
||||
|
||||
Color = YELLOW;
|
||||
|
||||
/* Effacement ancien cadre */
|
||||
if( erase )
|
||||
{
|
||||
screen->m_BlockLocate.Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode, Color );
|
||||
if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y )
|
||||
screen->m_BlockLocate.Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode,
|
||||
Color );
|
||||
if( screen->m_BlockLocate.m_MoveVector.x
|
||||
|| screen->m_BlockLocate.m_MoveVector.y )
|
||||
{
|
||||
screen->m_BlockLocate.Draw( panel,
|
||||
DC,
|
||||
@ -578,7 +565,8 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool era
|
||||
}
|
||||
|
||||
screen->m_BlockLocate.Draw( panel, DC, wxPoint( 0, 0 ), g_XorMode, Color );
|
||||
if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y )
|
||||
if( screen->m_BlockLocate.m_MoveVector.x
|
||||
|| screen->m_BlockLocate.m_MoveVector.y )
|
||||
{
|
||||
screen->m_BlockLocate.Draw( panel,
|
||||
DC,
|
||||
@ -589,13 +577,10 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool era
|
||||
}
|
||||
|
||||
|
||||
/************************************************/
|
||||
void WinEDA_PcbFrame::Block_Delete()
|
||||
/************************************************/
|
||||
|
||||
/*
|
||||
* routine d'effacement du block deja selectionne
|
||||
* Erase selected block.
|
||||
*/
|
||||
void WinEDA_PcbFrame::Block_Delete()
|
||||
{
|
||||
if( !InstallBlockCmdFrame( this, _( "Delete Block" ) ) )
|
||||
return;
|
||||
@ -626,22 +611,22 @@ void WinEDA_PcbFrame::Block_Delete()
|
||||
}
|
||||
break;
|
||||
|
||||
case TYPE_ZONE_CONTAINER: // a zone area
|
||||
case TYPE_ZONE_CONTAINER: // a zone area
|
||||
m_Pcb->Remove( item );
|
||||
break;
|
||||
|
||||
case TYPE_DRAWSEGMENT: // a segment not on copper layers
|
||||
case TYPE_TEXTE: // a text on a layer
|
||||
case TYPE_TRACK: // a track segment (segment on a copper layer)
|
||||
case TYPE_VIA: // a via (like atrack segment on a copper layer)
|
||||
case TYPE_COTATION: // a dimension (graphic item)
|
||||
case TYPE_MIRE: // a target (graphic item)
|
||||
case TYPE_DRAWSEGMENT: // a segment not on copper layers
|
||||
case TYPE_TEXTE: // a text on a layer
|
||||
case TYPE_TRACK: // a track segment (segment on a copper layer)
|
||||
case TYPE_VIA: // a via (like atrack segment on a copper layer)
|
||||
case TYPE_COTATION: // a dimension (graphic item)
|
||||
case TYPE_MIRE: // a target (graphic item)
|
||||
item->UnLink();
|
||||
break;
|
||||
|
||||
// These items are deleted, but not put in undo list
|
||||
case TYPE_MARKER_PCB: // a marker used to show something
|
||||
case TYPE_ZONE: // SEG_ZONE items are now deprecated
|
||||
case TYPE_MARKER_PCB: // a marker used to show something
|
||||
case TYPE_ZONE: // SEG_ZONE items are now deprecated
|
||||
item->UnLink();
|
||||
itemsList->RemovePicker( ii );
|
||||
ii--;
|
||||
@ -664,14 +649,14 @@ void WinEDA_PcbFrame::Block_Delete()
|
||||
/**
|
||||
* Function Block_Rotate
|
||||
* Rotate all items within the selected block.
|
||||
* The rotation centre is the centre of the block
|
||||
* The rotation center is the center of the block
|
||||
* @param none
|
||||
*/
|
||||
void WinEDA_PcbFrame::Block_Rotate()
|
||||
{
|
||||
wxPoint oldpos;
|
||||
wxPoint centre; // rotation centre for the rotation transform
|
||||
int rotAngle = 900; // rottaion angle in 0.1 deg.
|
||||
wxPoint centre; // rotation cent-re for the rotation transform
|
||||
int rotAngle = 900; // rotation angle in 0.1 deg.
|
||||
|
||||
if( !InstallBlockCmdFrame( this, _( "Rotate Block" ) ) )
|
||||
return;
|
||||
@ -681,7 +666,7 @@ void WinEDA_PcbFrame::Block_Rotate()
|
||||
return;
|
||||
|
||||
oldpos = GetScreen()->m_Curseur;
|
||||
centre = GetScreen()->m_BlockLocate.Centre(); // This is the rotation centre
|
||||
centre = GetScreen()->m_BlockLocate.Centre();
|
||||
|
||||
GetScreen()->SetModify();
|
||||
|
||||
@ -702,8 +687,8 @@ void WinEDA_PcbFrame::Block_Rotate()
|
||||
break;
|
||||
|
||||
/* Move and rotate the track segments */
|
||||
case TYPE_TRACK: // a track segment (segment on a copper layer)
|
||||
case TYPE_VIA: // a via (like atrack segment on a copper layer)
|
||||
case TYPE_TRACK: // a track segment (segment on a copper layer)
|
||||
case TYPE_VIA: // a via (like atrack segment on a copper layer)
|
||||
m_Pcb->m_Status_Pcb = 0;
|
||||
break;
|
||||
|
||||
@ -715,7 +700,7 @@ void WinEDA_PcbFrame::Block_Rotate()
|
||||
break;
|
||||
|
||||
// This item is not put in undo list
|
||||
case TYPE_ZONE: // SEG_ZONE items are now deprecated
|
||||
case TYPE_ZONE: // SEG_ZONE items are now deprecated
|
||||
itemsList->RemovePicker( ii );
|
||||
ii--;
|
||||
break;
|
||||
@ -736,14 +721,14 @@ void WinEDA_PcbFrame::Block_Rotate()
|
||||
/**
|
||||
* Function Block_Flip
|
||||
* Flip items within the selected block.
|
||||
* The flip centre is the centre of the block
|
||||
* The flip center is the center of the block
|
||||
* @param none
|
||||
*/
|
||||
void WinEDA_PcbFrame::Block_Flip()
|
||||
{
|
||||
#define INVERT( pos ) (pos) = center.y - ( (pos) - center.y )
|
||||
wxPoint memo;
|
||||
wxPoint center; /* position de l'axe d'inversion de l'ensemble des elements */
|
||||
wxPoint center; /* Position of the axis for inversion of all elements */
|
||||
|
||||
Block_SelectItems();
|
||||
if( GetScreen()->m_BlockLocate.GetCount() == 0 )
|
||||
@ -756,7 +741,6 @@ void WinEDA_PcbFrame::Block_Flip()
|
||||
|
||||
memo = GetScreen()->m_Curseur;
|
||||
|
||||
/* calcul du centre d'inversion */
|
||||
center = GetScreen()->m_BlockLocate.Centre();
|
||||
|
||||
for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
|
||||
@ -773,8 +757,8 @@ void WinEDA_PcbFrame::Block_Flip()
|
||||
break;
|
||||
|
||||
/* Move and rotate the track segments */
|
||||
case TYPE_TRACK: // a track segment (segment on a copper layer)
|
||||
case TYPE_VIA: // a via (like atrack segment on a copper layer)
|
||||
case TYPE_TRACK: // a track segment (segment on a copper layer)
|
||||
case TYPE_VIA: // a via (like atrack segment on a copper layer)
|
||||
m_Pcb->m_Status_Pcb = 0;
|
||||
break;
|
||||
|
||||
@ -786,7 +770,7 @@ void WinEDA_PcbFrame::Block_Flip()
|
||||
break;
|
||||
|
||||
// This item is not put in undo list
|
||||
case TYPE_ZONE: // SEG_ZONE items are now deprecated
|
||||
case TYPE_ZONE: // SEG_ZONE items are now deprecated
|
||||
itemsList->RemovePicker( ii );
|
||||
ii--;
|
||||
break;
|
||||
@ -807,7 +791,8 @@ void WinEDA_PcbFrame::Block_Flip()
|
||||
/**
|
||||
* Function Block_Move
|
||||
* moves all tracks and segments within the selected block.
|
||||
* New location is determined by the current offset from the selected block's original location.
|
||||
* New location is determined by the current offset from the selected block's
|
||||
* original location.
|
||||
* @param none
|
||||
*/
|
||||
void WinEDA_PcbFrame::Block_Move()
|
||||
@ -840,8 +825,8 @@ void WinEDA_PcbFrame::Block_Move()
|
||||
break;
|
||||
|
||||
/* Move track segments */
|
||||
case TYPE_TRACK: // a track segment (segment on a copper layer)
|
||||
case TYPE_VIA: // a via (like a track segment on a copper layer)
|
||||
case TYPE_TRACK: // a track segment (segment on a copper layer)
|
||||
case TYPE_VIA: // a via (like a track segment on a copper layer)
|
||||
m_Pcb->m_Status_Pcb = 0;
|
||||
break;
|
||||
|
||||
@ -853,7 +838,7 @@ void WinEDA_PcbFrame::Block_Move()
|
||||
break;
|
||||
|
||||
// This item is not put in undo list
|
||||
case TYPE_ZONE: // SEG_ZONE items are now deprecated
|
||||
case TYPE_ZONE: // SEG_ZONE items are now deprecated
|
||||
itemsList->RemovePicker( ii );
|
||||
ii--;
|
||||
break;
|
||||
@ -874,7 +859,8 @@ void WinEDA_PcbFrame::Block_Move()
|
||||
/**
|
||||
* Function Block_Duplicate
|
||||
* Duplicate all items within the selected block.
|
||||
* New location is determined by the current offset from the selected block's original location.
|
||||
* New location is determined by the current offset from the selected block's
|
||||
* original location.
|
||||
* @param none
|
||||
*/
|
||||
void WinEDA_PcbFrame::Block_Duplicate()
|
||||
@ -933,7 +919,8 @@ void WinEDA_PcbFrame::Block_Duplicate()
|
||||
|
||||
case TYPE_ZONE_CONTAINER:
|
||||
{
|
||||
ZONE_CONTAINER* new_zone = new ZONE_CONTAINER( (BOARD*) item->GetParent() );
|
||||
ZONE_CONTAINER* new_zone =
|
||||
new ZONE_CONTAINER( (BOARD*) item->GetParent() );
|
||||
new_zone->Copy( (ZONE_CONTAINER*) item );
|
||||
new_zone->m_TimeStamp = GetTimeStamp();
|
||||
newitem = new_zone;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************/
|
||||
/* block_module_editor.cpp */
|
||||
/* Handle block commands for the footprint editor */
|
||||
/* block_module_editor.cpp */
|
||||
/* Handle block commands for the footprint editor */
|
||||
/****************************************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
@ -23,11 +23,7 @@
|
||||
#define BLOCK_COLOR BROWN
|
||||
#define IS_SELECTED 1
|
||||
|
||||
/* Variables Locales */
|
||||
|
||||
/* Fonctions exportees */
|
||||
|
||||
/* Fonctions Locales */
|
||||
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel,
|
||||
wxDC* DC,
|
||||
bool erase );
|
||||
@ -42,14 +38,11 @@ static void RotateMarkedItems( MODULE* module, wxPoint offset );
|
||||
static void DeleteMarkedItems( MODULE* module );
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
int WinEDA_ModuleEditFrame::ReturnBlockCommand( int key )
|
||||
/*************************************************************************/
|
||||
|
||||
/* Return the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to
|
||||
* the key (ALT, SHIFT ALT ..) pressed when dragging mouse and left or middle button
|
||||
* pressed
|
||||
* the key (ALT, SHIFT ALT ..) pressed when dragging mouse and left or
|
||||
* middle button pressed
|
||||
*/
|
||||
int WinEDA_ModuleEditFrame::ReturnBlockCommand( int key )
|
||||
{
|
||||
int cmd;
|
||||
|
||||
@ -92,15 +85,13 @@ int WinEDA_ModuleEditFrame::ReturnBlockCommand( int key )
|
||||
}
|
||||
|
||||
|
||||
/****************************************************/
|
||||
int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
|
||||
/****************************************************/
|
||||
|
||||
/* Command BLOCK END (end of block sizing)
|
||||
* return :
|
||||
* 0 if command finished (zoom, delete ...)
|
||||
* 1 if HandleBlockPlace must follow (items found, and a block place command must follow)
|
||||
* 1 if HandleBlockPlace must follow (items found, and a block place command
|
||||
* must follow)
|
||||
*/
|
||||
int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
|
||||
{
|
||||
int ItemsCount = 0, MustDoPlace = 0;
|
||||
MODULE* Currentmodule = GetBoard()->m_Modules;
|
||||
@ -128,7 +119,8 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
|
||||
case BLOCK_DRAG: /* Drag */
|
||||
case BLOCK_MOVE: /* Move */
|
||||
case BLOCK_COPY: /* Copy */
|
||||
ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->m_BlockLocate );
|
||||
ItemsCount = MarkItemsInBloc( Currentmodule,
|
||||
GetScreen()->m_BlockLocate );
|
||||
if( ItemsCount )
|
||||
{
|
||||
MustDoPlace = 1;
|
||||
@ -200,7 +192,8 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
DrawPanel->ForceCloseManageCurseur = NULL;
|
||||
SetCurItem( NULL );
|
||||
SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor, wxEmptyString );
|
||||
SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor,
|
||||
wxEmptyString );
|
||||
DrawPanel->Refresh( TRUE );
|
||||
}
|
||||
|
||||
@ -213,10 +206,10 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
|
||||
void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
|
||||
/******************************************************/
|
||||
|
||||
/* Routine to handle the BLOCK PLACE commande
|
||||
/* Routine to handle the BLOCK PLACE command
|
||||
* Last routine for block operation for:
|
||||
* - block move & drag
|
||||
* - block copie & paste
|
||||
* - block copy & paste
|
||||
*/
|
||||
{
|
||||
bool err = FALSE;
|
||||
@ -251,7 +244,7 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
|
||||
CopyMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.m_MoveVector );
|
||||
break;
|
||||
|
||||
case BLOCK_PASTE: /* Paste (recopie du dernier bloc sauve */
|
||||
case BLOCK_PASTE: /* Paste */
|
||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||
break;
|
||||
|
||||
@ -291,16 +284,13 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* Traces the outline of the search block structures
|
||||
* The entire block follows the cursor
|
||||
*/
|
||||
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||
bool erase )
|
||||
/************************************************************************/
|
||||
|
||||
/* Retrace le contour du block de recherche de structures
|
||||
* L'ensemble du block suit le curseur
|
||||
*/
|
||||
{
|
||||
BLOCK_SELECTOR* PtBlock;
|
||||
BLOCK_SELECTOR* PtBlock;
|
||||
BASE_SCREEN* screen = panel->GetScreen();
|
||||
BOARD_ITEM* item;
|
||||
wxPoint move_offset;
|
||||
@ -310,10 +300,10 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||
PtBlock = &screen->m_BlockLocate;
|
||||
GRSetDrawMode( DC, g_XorMode );
|
||||
|
||||
/* Effacement ancien cadre */
|
||||
if( erase )
|
||||
{
|
||||
PtBlock->Draw( panel, DC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color );
|
||||
PtBlock->Draw( panel, DC, PtBlock->m_MoveVector, g_XorMode,
|
||||
PtBlock->m_Color );
|
||||
|
||||
if( Currentmodule )
|
||||
{
|
||||
@ -347,10 +337,12 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||
}
|
||||
}
|
||||
|
||||
/* Redessin nouvel affichage */
|
||||
PtBlock->m_MoveVector = screen->m_Curseur - PtBlock->m_BlockLastCursorPosition;
|
||||
/* Repaint new view. */
|
||||
PtBlock->m_MoveVector =
|
||||
screen->m_Curseur - PtBlock->m_BlockLastCursorPosition;
|
||||
|
||||
PtBlock->Draw( panel, DC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color );
|
||||
PtBlock->Draw( panel, DC, PtBlock->m_MoveVector, g_XorMode,
|
||||
PtBlock->m_Color );
|
||||
|
||||
|
||||
if( Currentmodule )
|
||||
@ -385,12 +377,9 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
void CopyMarkedItems( MODULE* module, wxPoint offset )
|
||||
/****************************************************************************/
|
||||
|
||||
/* Copy marked items, at new position = old position + offset
|
||||
*/
|
||||
void CopyMarkedItems( MODULE* module, wxPoint offset )
|
||||
{
|
||||
if( module == NULL )
|
||||
return;
|
||||
@ -432,8 +421,7 @@ void CopyMarkedItems( MODULE* module, wxPoint offset )
|
||||
break;
|
||||
|
||||
default:
|
||||
DisplayError( NULL,
|
||||
wxT( "Internal Err: CopyMarkedItems: type indefini" ) );
|
||||
DisplayError( NULL, wxT( "CopyMarkedItems: type undefined" ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -442,12 +430,9 @@ void CopyMarkedItems( MODULE* module, wxPoint offset )
|
||||
}
|
||||
|
||||
|
||||
/****************************************************/
|
||||
void MoveMarkedItems( MODULE* module, wxPoint offset )
|
||||
/****************************************************/
|
||||
|
||||
/* Move marked items, at new position = old position + offset
|
||||
*/
|
||||
void MoveMarkedItems( MODULE* module, wxPoint offset )
|
||||
{
|
||||
EDA_BaseStruct* item;
|
||||
|
||||
@ -493,12 +478,9 @@ void MoveMarkedItems( MODULE* module, wxPoint offset )
|
||||
}
|
||||
|
||||
|
||||
/******************************************************/
|
||||
void DeleteMarkedItems( MODULE* module )
|
||||
/******************************************************/
|
||||
|
||||
/* Delete marked items
|
||||
*/
|
||||
void DeleteMarkedItems( MODULE* module )
|
||||
{
|
||||
BOARD_ITEM* item;
|
||||
BOARD_ITEM* next_item;
|
||||
@ -528,12 +510,9 @@ void DeleteMarkedItems( MODULE* module )
|
||||
}
|
||||
|
||||
|
||||
/******************************************************/
|
||||
void MirrorMarkedItems( MODULE* module, wxPoint offset )
|
||||
/******************************************************/
|
||||
|
||||
/* Mirror marked items, refer to a Vertical axis at position offset
|
||||
*/
|
||||
void MirrorMarkedItems( MODULE* module, wxPoint offset )
|
||||
{
|
||||
#define SETMIRROR( z ) (z) -= offset.x; (z) = -(z); (z) += offset.x;
|
||||
EDA_BaseStruct* item;
|
||||
@ -588,12 +567,9 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
|
||||
}
|
||||
|
||||
|
||||
/******************************************************/
|
||||
void RotateMarkedItems( MODULE* module, wxPoint offset )
|
||||
/******************************************************/
|
||||
|
||||
/* Rotate marked items, refer to a Vertical axis at position offset
|
||||
*/
|
||||
void RotateMarkedItems( MODULE* module, wxPoint offset )
|
||||
{
|
||||
#define ROTATE( z ) RotatePoint( (&z), offset, 900 )
|
||||
EDA_BaseStruct* item;
|
||||
@ -644,9 +620,7 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************/
|
||||
void ClearMarkItems( MODULE* module )
|
||||
/*********************************************************/
|
||||
{
|
||||
EDA_BaseStruct* item;
|
||||
|
||||
@ -663,13 +637,10 @@ void ClearMarkItems( MODULE* module )
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************/
|
||||
int MarkItemsInBloc( MODULE* module, EDA_Rect& Rect )
|
||||
/***************************************************************/
|
||||
|
||||
/* Mark items inside rect.
|
||||
* Items are inside rect when an end point is inside rect
|
||||
*/
|
||||
int MarkItemsInBloc( MODULE* module, EDA_Rect& Rect )
|
||||
{
|
||||
EDA_BaseStruct* item;
|
||||
int ItemsCount = 0;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Fichier BOARD.CPP : functions for autorouting */
|
||||
/* BOARD.CPP : functions for autorouting */
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
@ -11,9 +11,7 @@
|
||||
|
||||
#include "protos.h"
|
||||
|
||||
/* routines externes : */
|
||||
|
||||
/* Routines definies ici: */
|
||||
int Build_Work( BOARD* Pcb );
|
||||
void PlaceCells( BOARD* Pcb, int net_code, int flag );
|
||||
int InitBoard();
|
||||
@ -29,14 +27,12 @@ void SetDist( int, int, int, DistCell );
|
||||
int GetDir( int, int, int );
|
||||
void SetDir( int, int, int, int );
|
||||
|
||||
/*****************************************************************/
|
||||
bool ComputeMatriceSize( WinEDA_BasePcbFrame* frame, int g_GridRoutingSize )
|
||||
/*****************************************************************/
|
||||
|
||||
/*
|
||||
* Calcule Nrows et Ncols, dimensions de la matrice de representation du BOARD
|
||||
* pour les routages automatiques et calculs de zone
|
||||
* Calculates nrows and ncols, dimensions of the matrix representation of BOARD
|
||||
* for routing and automatic calculation of area.
|
||||
*/
|
||||
bool ComputeMatriceSize( WinEDA_BasePcbFrame* frame, int g_GridRoutingSize )
|
||||
{
|
||||
BOARD* pcb = frame->GetBoard();
|
||||
|
||||
@ -81,13 +77,10 @@ BOARDHEAD::~BOARDHEAD()
|
||||
}
|
||||
|
||||
|
||||
/******************************/
|
||||
int BOARDHEAD::InitBoard()
|
||||
/*****************************/
|
||||
|
||||
/* initialize the data structures
|
||||
* retourne la taille RAM utilisee, ou -1 si defaut
|
||||
* returns the RAM size used, or -1 if default
|
||||
*/
|
||||
int BOARDHEAD::InitBoard()
|
||||
{
|
||||
int ii, kk;
|
||||
|
||||
@ -128,10 +121,7 @@ int BOARDHEAD::InitBoard()
|
||||
}
|
||||
|
||||
|
||||
/*********************************/
|
||||
void BOARDHEAD::UnInitBoard()
|
||||
/*********************************/
|
||||
/* deallocation de la memoire */
|
||||
{
|
||||
int ii;
|
||||
|
||||
@ -162,21 +152,17 @@ void BOARDHEAD::UnInitBoard()
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************/
|
||||
void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
||||
/*****************************************************/
|
||||
|
||||
/* Initialise les cellules du board a la valeur HOLE et VIA_IMPOSSIBLE
|
||||
* selon les marges d'isolement
|
||||
* les elements de net_code = net_code ne seront pas places comme occupe
|
||||
* mais en VIA_IMPOSSIBLE uniquement
|
||||
* Pour Routage 1 seule face:
|
||||
* le plan BOTTOM est utilise
|
||||
* et Route_Layer_BOTTOM = Route_Layer_TOP
|
||||
/* Initialize the cell board is set and VIA_IMPOSSIBLE HOLE according to
|
||||
* the setbacks
|
||||
* The elements of net_code = net_code will not be occupied as places
|
||||
* but only VIA_IMPOSSIBLE
|
||||
* For single-sided Routing 1:
|
||||
* BOTTOM side is used and Route_Layer_BOTTOM = Route_Layer_TOP
|
||||
*
|
||||
* Selon les bits = 1 du parametre flag:
|
||||
* si FORCE_PADS : tous les pads seront places meme ceux de meme net_code
|
||||
* According to the bits = 1 parameter flag:
|
||||
* If FORCE_PADS: all pads will be placed even those same net_code.
|
||||
*/
|
||||
void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
||||
{
|
||||
int ux0 = 0, uy0 = 0, ux1, uy1, dx, dy;
|
||||
int marge, via_marge;
|
||||
@ -192,9 +178,9 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
||||
marge = clearance + (trackWidth / 2);
|
||||
via_marge = clearance + (viaSize / 2);
|
||||
|
||||
/////////////////////////////////////
|
||||
// Placement des PADS sur le board //
|
||||
/////////////////////////////////////
|
||||
//////////////////////////
|
||||
// Place PADS on board. //
|
||||
//////////////////////////
|
||||
|
||||
for( unsigned i=0; i < aPcb->GetPadsCount(); ++i )
|
||||
{
|
||||
@ -207,9 +193,9 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
||||
Place_1_Pad_Board( aPcb, pad, VIA_IMPOSSIBLE, via_marge, WRITE_OR_CELL );
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// Placement des elements de modules sur PCB //
|
||||
///////////////////////////////////////////////
|
||||
////////////////////////////////////////////
|
||||
// Placing the elements of modules on PCB //
|
||||
////////////////////////////////////////////
|
||||
for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
|
||||
{
|
||||
for( BOARD_ITEM* item = module->m_Drawings; item; item = item->Next() )
|
||||
@ -247,9 +233,9 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
||||
}
|
||||
|
||||
////////////////////////////////////////////
|
||||
// Placement des contours et segments PCB //
|
||||
// Placement contours and segments on PCB //
|
||||
////////////////////////////////////////////
|
||||
for( BOARD_ITEM* item = aPcb->m_Drawings; item; item = item->Next() )
|
||||
for( BOARD_ITEM* item = aPcb->m_Drawings; item; item = item->Next() )
|
||||
{
|
||||
switch( item->Type() )
|
||||
{
|
||||
@ -276,7 +262,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
||||
|
||||
TraceSegmentPcb( aPcb, TmpSegm, type_cell, marge, WRITE_CELL );
|
||||
|
||||
// TraceSegmentPcb(Pcb, TmpSegm, VIA_IMPOSSIBLE, via_marge,WRITE_OR_CELL );
|
||||
// TraceSegmentPcb(Pcb, TmpSegm, VIA_IMPOSSIBLE, via_marge,WRITE_OR_CELL );
|
||||
delete TmpSegm;
|
||||
}
|
||||
break;
|
||||
@ -296,7 +282,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
||||
|
||||
/* Put bounding box (rectangle) on matrix */
|
||||
dx /= 2;
|
||||
dy /= 2; /* dx et dy = demi dimensionx X et Y */
|
||||
dy /= 2;
|
||||
|
||||
ux1 = ux0 + dx;
|
||||
uy1 = uy0 + dy;
|
||||
@ -306,8 +292,8 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
||||
|
||||
masque_layer = g_TabOneLayerMask[PtText->GetLayer()];
|
||||
|
||||
TraceFilledRectangle( aPcb, ux0 - marge, uy0 - marge, ux1 + marge, uy1 + marge,
|
||||
(int) (PtText->m_Orient),
|
||||
TraceFilledRectangle( aPcb, ux0 - marge, uy0 - marge, ux1 + marge,
|
||||
uy1 + marge, (int) (PtText->m_Orient),
|
||||
masque_layer, HOLE, WRITE_CELL );
|
||||
|
||||
TraceFilledRectangle( aPcb, ux0 - via_marge, uy0 - via_marge,
|
||||
@ -344,10 +330,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
||||
}
|
||||
|
||||
|
||||
/******************************************************/
|
||||
int Build_Work( BOARD* Pcb )
|
||||
/*****************************************************/
|
||||
/* Build liste conn */
|
||||
{
|
||||
RATSNEST_ITEM* pt_rats;
|
||||
D_PAD* pt_pad;
|
||||
@ -361,7 +344,7 @@ int Build_Work( BOARD* Pcb )
|
||||
for( unsigned ii = 0; ii < Pcb->GetRatsnestsCount(); ii++ )
|
||||
{
|
||||
pt_rats = &Pcb->m_FullRatsnest[ii];
|
||||
/* On ne route que les chevelus actifs et routables */
|
||||
/* ??? On ne route que les chevelus actifs et routables */
|
||||
if( (pt_rats->m_Status & CH_ACTIF) == 0 )
|
||||
continue;
|
||||
if( pt_rats->m_Status & CH_UNROUTABLE )
|
||||
@ -373,18 +356,20 @@ int Build_Work( BOARD* Pcb )
|
||||
current_net_code = pt_pad->GetNet();
|
||||
pt_ch = pt_rats;
|
||||
|
||||
r1 = (pt_pad->GetPosition().y - Pcb->m_BoundaryBox.m_Pos.y + demi_pas ) / g_GridRoutingSize;
|
||||
r1 = ( pt_pad->GetPosition().y - Pcb->m_BoundaryBox.m_Pos.y
|
||||
+ demi_pas ) / g_GridRoutingSize;
|
||||
if( r1 < 0 || r1 >= Nrows )
|
||||
{
|
||||
msg.Printf( wxT( "erreur : row = %d ( padY %d pcbY %d) " ), r1,
|
||||
msg.Printf( wxT( "error : row = %d ( padY %d pcbY %d) " ), r1,
|
||||
pt_pad->GetPosition().y, Pcb->m_BoundaryBox.m_Pos.y );
|
||||
DisplayError( NULL, msg );
|
||||
return 0;
|
||||
}
|
||||
c1 = (pt_pad->GetPosition().x - Pcb->m_BoundaryBox.m_Pos.x + demi_pas ) / g_GridRoutingSize;
|
||||
c1 = ( pt_pad->GetPosition().x - Pcb->m_BoundaryBox.m_Pos.x
|
||||
+ demi_pas ) / g_GridRoutingSize;
|
||||
if( c1 < 0 || c1 >= Ncols )
|
||||
{
|
||||
msg.Printf( wxT( "erreur : col = %d ( padX %d pcbX %d) " ), c1,
|
||||
msg.Printf( wxT( "error : col = %d ( padX %d pcbX %d) " ), c1,
|
||||
pt_pad->GetPosition().x, Pcb->m_BoundaryBox.m_Pos.x );
|
||||
DisplayError( NULL, msg );
|
||||
return 0;
|
||||
@ -392,18 +377,20 @@ int Build_Work( BOARD* Pcb )
|
||||
|
||||
pt_pad = pt_rats->m_PadEnd;
|
||||
|
||||
r2 = (pt_pad->GetPosition().y - Pcb->m_BoundaryBox.m_Pos.y + demi_pas ) / g_GridRoutingSize;
|
||||
r2 = ( pt_pad->GetPosition().y - Pcb->m_BoundaryBox.m_Pos.y
|
||||
+ demi_pas ) / g_GridRoutingSize;
|
||||
if( r2 < 0 || r2 >= Nrows )
|
||||
{
|
||||
msg.Printf( wxT( "erreur : row = %d ( padY %d pcbY %d) " ), r2,
|
||||
msg.Printf( wxT( "error : row = %d ( padY %d pcbY %d) " ), r2,
|
||||
pt_pad->GetPosition().y, Pcb->m_BoundaryBox.m_Pos.y );
|
||||
DisplayError( NULL, msg );
|
||||
return 0;
|
||||
}
|
||||
c2 = (pt_pad->GetPosition().x - Pcb->m_BoundaryBox.m_Pos.x + demi_pas ) / g_GridRoutingSize;
|
||||
c2 = ( pt_pad->GetPosition().x - Pcb->m_BoundaryBox.m_Pos.x
|
||||
+ demi_pas ) / g_GridRoutingSize;
|
||||
if( c2 < 0 || c2 >= Ncols )
|
||||
{
|
||||
msg.Printf( wxT( "erreur : col = %d ( padX %d pcbX %d) " ), c2,
|
||||
msg.Printf( wxT( "error : col = %d ( padX %d pcbX %d) " ), c2,
|
||||
pt_pad->GetPosition().x, Pcb->m_BoundaryBox.m_Pos.x );
|
||||
DisplayError( NULL, msg );
|
||||
return 0;
|
||||
@ -418,12 +405,7 @@ int Build_Work( BOARD* Pcb )
|
||||
}
|
||||
|
||||
|
||||
/*******************************************/
|
||||
BoardCell GetCell( int row, int col, int side )
|
||||
/*******************************************/
|
||||
|
||||
/* fetch board cell :
|
||||
*/
|
||||
{
|
||||
BoardCell* p;
|
||||
|
||||
|
@ -1,13 +1,15 @@
|
||||
/* Bits caracterisant une cellule */
|
||||
#define HOLE (char)0x01 /* a conducting hole, ou obstacle */
|
||||
#define CELL_is_MODULE (char)0x02 /* autoplacement: occupe par un module */
|
||||
#define CELL_is_EDGE (char)0x20 /* zone et autoplacement: cellule limitant un contour (Board, Zone) */
|
||||
#define CELL_is_FRIEND (char)0x40 /* zone et autoplacement: cellule faisant partie du net */
|
||||
#define CELL_is_ZONE (char)0x80 /* zone et autoplacement: cellule disponible */
|
||||
/* Bits characterizing cell */
|
||||
#define HOLE (char)0x01 /* a conducting hole or obstacle */
|
||||
#define CELL_is_MODULE (char)0x02 /* auto placement occupied by a module */
|
||||
#define CELL_is_EDGE (char)0x20 /* Area and auto-placement: limiting cell
|
||||
* contour (Board, Zone) */
|
||||
#define CELL_is_FRIEND (char)0x40 /* Area and auto-placement: cell part of the
|
||||
* net */
|
||||
#define CELL_is_ZONE (char)0x80 /* Area and auto-placement: cell available */
|
||||
|
||||
/* Bits Masques de presence d'obstacles pour autoroutage */
|
||||
#define OCCUPE 1 /* autoroutage : obstacle pour pistes et vias */
|
||||
#define VIA_IMPOSSIBLE 2 /* autoroutage : obsacle pour vias */
|
||||
/* Bit masks for presence of obstacles to autorouting */
|
||||
#define OCCUPE 1 /* Autorouting: obstacle tracks and vias. */
|
||||
#define VIA_IMPOSSIBLE 2 /* Autorouting: obstacle for vias. */
|
||||
#define CURRENT_PAD 4
|
||||
|
||||
|
||||
|
@ -18,41 +18,46 @@ wxPoint BOARD_ITEM::ZeroOffset( 0, 0 );
|
||||
/* Class BOARD: */
|
||||
/*****************/
|
||||
|
||||
/* Constructor */
|
||||
BOARD::BOARD( EDA_BaseStruct* parent, WinEDA_BasePcbFrame* frame ) :
|
||||
BOARD_ITEM( (BOARD_ITEM*)parent, TYPE_PCB ),
|
||||
m_NetClasses( this )
|
||||
{
|
||||
m_PcbFrame = frame;
|
||||
m_Status_Pcb = 0; // Mot d'etat: Bit 1 = Chevelu calcule
|
||||
m_PcbFrame = frame;
|
||||
m_Status_Pcb = 0; // Status word: bit 1 = calculate.
|
||||
m_BoardSettings = &g_DesignSettings;
|
||||
m_NbNodes = 0; // nombre de pads connectes
|
||||
m_NbNoconnect = 0; // nombre de chevelus actifs
|
||||
m_NbNodes = 0; // Number of connected pads.
|
||||
m_NbNoconnect = 0; // Number of unconnected nets.
|
||||
|
||||
m_CurrentZoneContour = NULL; // This ZONE_CONTAINER handle the zone contour cuurently in progress
|
||||
m_NetInfo = new NETINFO_LIST( this ); // handle nets info list (name, design constraints ..
|
||||
m_NetInfo->BuildListOfNets(); // prepare pads and nets lists containers.
|
||||
m_CurrentZoneContour = NULL; // This ZONE_CONTAINER handle the
|
||||
// zone contour currently in
|
||||
// progress
|
||||
m_NetInfo = new NETINFO_LIST( this ); // handle nets info list (name,
|
||||
// design constraints ..
|
||||
m_NetInfo->BuildListOfNets(); // prepare pads and nets lists
|
||||
// containers.
|
||||
|
||||
for( int layer = 0; layer < NB_COPPER_LAYERS; ++layer )
|
||||
for( int layer = 0; layer < NB_COPPER_LAYERS; ++layer )
|
||||
{
|
||||
m_Layer[layer].m_Name = ReturnPcbLayerName( layer, true );
|
||||
m_Layer[layer].m_Type = LT_SIGNAL;
|
||||
}
|
||||
|
||||
// Initial parameters for the default NETCLASS come from the global preferences
|
||||
// Initial parameters for the default NETCLASS come from the global
|
||||
// preferences
|
||||
// within g_DesignSettings via the NETCLASS() constructor.
|
||||
// Should user eventually load a board from a disk file, then these defaults
|
||||
// Should user eventually load a board from a disk file, then these
|
||||
// defaults
|
||||
// will get overwritten during load.
|
||||
m_NetClasses.GetDefault()->SetDescription( _( "This is the default net class." ) );
|
||||
m_ViaSizeSelector = 0;
|
||||
m_NetClasses.GetDefault()->SetDescription(
|
||||
_( "This is the default net class." ) );
|
||||
m_ViaSizeSelector = 0;
|
||||
m_TrackWidthSelector = 0;
|
||||
SetCurrentNetClass(m_NetClasses.GetDefault()->GetName( )); // Initialize default values
|
||||
|
||||
// Initialize default values.
|
||||
SetCurrentNetClass( m_NetClasses.GetDefault()->GetName() );
|
||||
}
|
||||
|
||||
|
||||
/***************/
|
||||
/* Destructeur */
|
||||
/***************/
|
||||
BOARD::~BOARD()
|
||||
{
|
||||
if( m_PcbFrame->GetScreen() )
|
||||
@ -77,21 +82,23 @@ BOARD::~BOARD()
|
||||
delete m_NetInfo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function SetCurrentNetClass
|
||||
* Must be called after a netclass selection (or after a netclass parameter change
|
||||
* Initialise vias and tracks values displayed in combo boxs of the auxiliary toolbar
|
||||
* and some others parametres (netclass name ....)
|
||||
* Must be called after a netclass selection (or after a netclass parameter
|
||||
* change
|
||||
* Initialize vias and tracks values displayed in combo boxes of the auxiliary
|
||||
* toolbar and some other parameters (netclass name ....)
|
||||
* @param aNetClassName = the new netclass name
|
||||
* @return true if lists of tracks and vias sizes are modified
|
||||
*/
|
||||
bool BOARD::SetCurrentNetClass( const wxString & aNetClassName)
|
||||
bool BOARD::SetCurrentNetClass( const wxString& aNetClassName )
|
||||
{
|
||||
NETCLASS * netClass = m_NetClasses.Find(aNetClassName);
|
||||
bool lists_sizes_modified = false;
|
||||
NETCLASS* netClass = m_NetClasses.Find( aNetClassName );
|
||||
bool lists_sizes_modified = false;
|
||||
|
||||
// if not found (should not happen) use the default
|
||||
if ( netClass == NULL )
|
||||
if( netClass == NULL )
|
||||
netClass = m_NetClasses.GetDefault();
|
||||
|
||||
m_CurrentNetClassName = netClass->GetName();
|
||||
@ -101,12 +108,12 @@ BOARD::~BOARD()
|
||||
{
|
||||
VIA_DIMENSION viadim;
|
||||
lists_sizes_modified = true;
|
||||
m_ViasDimensionsList.push_back(viadim);
|
||||
m_ViasDimensionsList.push_back( viadim );
|
||||
}
|
||||
if( m_TrackWidthList.size() == 0 )
|
||||
{
|
||||
lists_sizes_modified = true;
|
||||
m_TrackWidthList.push_back(0);
|
||||
m_TrackWidthList.push_back( 0 );
|
||||
}
|
||||
|
||||
/* note the m_ViasDimensionsList[0] and m_TrackWidthList[0] values
|
||||
@ -128,21 +135,27 @@ BOARD::~BOARD()
|
||||
return lists_sizes_modified;
|
||||
}
|
||||
|
||||
|
||||
/** function GetBiggestClearanceValue
|
||||
* @return the biggest clerance value found in NetClasses list
|
||||
* @return the biggest clearance value found in NetClasses list
|
||||
*/
|
||||
int BOARD::GetBiggestClearanceValue()
|
||||
{
|
||||
int clearance = m_NetClasses.GetDefault()->GetClearance();
|
||||
|
||||
//Read list of Net Classes
|
||||
for( NETCLASSES::const_iterator nc = m_NetClasses.begin(); nc != m_NetClasses.end(); nc++ )
|
||||
for( NETCLASSES::const_iterator nc = m_NetClasses.begin();
|
||||
nc != m_NetClasses.end();
|
||||
nc++ )
|
||||
{
|
||||
NETCLASS* netclass = nc->second;
|
||||
clearance = MAX( clearance, netclass->GetClearance() );
|
||||
}
|
||||
|
||||
return clearance;
|
||||
}
|
||||
|
||||
|
||||
/** function GetCurrentMicroViaSize
|
||||
* @return the current micro via size,
|
||||
* that is the current netclass value
|
||||
@ -150,9 +163,11 @@ int BOARD::GetBiggestClearanceValue()
|
||||
int BOARD::GetCurrentMicroViaSize()
|
||||
{
|
||||
NETCLASS* netclass = m_NetClasses.Find( m_CurrentNetClassName );
|
||||
|
||||
return netclass->GetuViaDiameter();
|
||||
}
|
||||
|
||||
|
||||
/** function GetCurrentMicroViaDrill
|
||||
* @return the current micro via drill,
|
||||
* that is the current netclass value
|
||||
@ -160,16 +175,19 @@ int BOARD::GetCurrentMicroViaSize()
|
||||
int BOARD::GetCurrentMicroViaDrill()
|
||||
{
|
||||
NETCLASS* netclass = m_NetClasses.Find( m_CurrentNetClassName );
|
||||
|
||||
return netclass->GetuViaDrill();
|
||||
}
|
||||
|
||||
|
||||
wxString BOARD::GetLayerName( int aLayerIndex ) const
|
||||
{
|
||||
if( ! IsValidLayerIndex( aLayerIndex ))
|
||||
if( !IsValidLayerIndex( aLayerIndex ) )
|
||||
return wxEmptyString;
|
||||
|
||||
// copper layer names are stored in the BOARD.
|
||||
if( IsValidCopperLayerIndex( aLayerIndex ) && m_BoardSettings->IsLayerEnabled( aLayerIndex ))
|
||||
if( IsValidCopperLayerIndex( aLayerIndex )
|
||||
&& m_BoardSettings->IsLayerEnabled( aLayerIndex ) )
|
||||
{
|
||||
// default names were set in BOARD::BOARD() but they may be
|
||||
// over-ridden by BOARD::SetLayerName()
|
||||
@ -182,7 +200,7 @@ wxString BOARD::GetLayerName( int aLayerIndex ) const
|
||||
|
||||
bool BOARD::SetLayerName( int aLayerIndex, const wxString& aLayerName )
|
||||
{
|
||||
if( ! IsValidCopperLayerIndex( aLayerIndex ))
|
||||
if( !IsValidCopperLayerIndex( aLayerIndex ) )
|
||||
return false;
|
||||
|
||||
if( aLayerName == wxEmptyString || aLayerName.Len() > 20 )
|
||||
@ -197,11 +215,12 @@ bool BOARD::SetLayerName( int aLayerIndex, const wxString& aLayerName )
|
||||
// replace any spaces with underscores before we do any comparing
|
||||
NameTemp.Replace( wxT( " " ), wxT( "_" ) );
|
||||
|
||||
if( m_BoardSettings->IsLayerEnabled( aLayerIndex ))
|
||||
if( m_BoardSettings->IsLayerEnabled( aLayerIndex ) )
|
||||
{
|
||||
for( int i = 0; i < NB_COPPER_LAYERS; i++ )
|
||||
{
|
||||
if( i != aLayerIndex && m_BoardSettings->IsLayerEnabled( i ) && NameTemp == m_Layer[i].m_Name )
|
||||
if( i != aLayerIndex && m_BoardSettings->IsLayerEnabled( i )
|
||||
&& NameTemp == m_Layer[i].m_Name )
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -216,12 +235,12 @@ bool BOARD::SetLayerName( int aLayerIndex, const wxString& aLayerName )
|
||||
|
||||
LAYER_T BOARD::GetLayerType( int aLayerIndex ) const
|
||||
{
|
||||
if( ! IsValidCopperLayerIndex( aLayerIndex ))
|
||||
if( !IsValidCopperLayerIndex( aLayerIndex ) )
|
||||
return LT_SIGNAL;
|
||||
|
||||
//@@IMB: The original test was broken due to the discontinuity
|
||||
// in the layer sequence.
|
||||
if( m_BoardSettings->IsLayerEnabled( aLayerIndex ))
|
||||
if( m_BoardSettings->IsLayerEnabled( aLayerIndex ) )
|
||||
return m_Layer[aLayerIndex].m_Type;
|
||||
return LT_SIGNAL;
|
||||
}
|
||||
@ -229,12 +248,12 @@ LAYER_T BOARD::GetLayerType( int aLayerIndex ) const
|
||||
|
||||
bool BOARD::SetLayerType( int aLayerIndex, LAYER_T aLayerType )
|
||||
{
|
||||
if( ! IsValidCopperLayerIndex( aLayerIndex ))
|
||||
if( !IsValidCopperLayerIndex( aLayerIndex ) )
|
||||
return false;
|
||||
|
||||
//@@IMB: The original test was broken due to the discontinuity
|
||||
// in the layer sequence.
|
||||
if( m_BoardSettings->IsLayerEnabled( aLayerIndex ))
|
||||
if( m_BoardSettings->IsLayerEnabled( aLayerIndex ) )
|
||||
{
|
||||
m_Layer[aLayerIndex].m_Type = aLayerType;
|
||||
return true;
|
||||
@ -251,16 +270,20 @@ const char* LAYER::ShowType( LAYER_T aType )
|
||||
{
|
||||
default:
|
||||
case LT_SIGNAL:
|
||||
cp = "signal"; break;
|
||||
cp = "signal";
|
||||
break;
|
||||
|
||||
case LT_POWER:
|
||||
cp = "power"; break;
|
||||
cp = "power";
|
||||
break;
|
||||
|
||||
case LT_MIXED:
|
||||
cp = "mixed"; break;
|
||||
cp = "mixed";
|
||||
break;
|
||||
|
||||
case LT_JUMPER:
|
||||
cp = "jumper"; break;
|
||||
cp = "jumper";
|
||||
break;
|
||||
}
|
||||
|
||||
return cp;
|
||||
@ -287,32 +310,38 @@ int BOARD::GetCopperLayerCount() const
|
||||
return m_BoardSettings->GetCopperLayerCount();
|
||||
}
|
||||
|
||||
|
||||
int BOARD::GetEnabledLayers() const
|
||||
{
|
||||
return m_BoardSettings->GetEnabledLayers();
|
||||
}
|
||||
|
||||
|
||||
int BOARD::GetVisibleLayers() const
|
||||
{
|
||||
return m_BoardSettings->GetVisibleLayers();
|
||||
}
|
||||
|
||||
|
||||
void BOARD::SetEnabledLayers( int aLayerMask )
|
||||
{
|
||||
m_BoardSettings->SetEnabledLayers( aLayerMask );
|
||||
}
|
||||
|
||||
|
||||
void BOARD::SetVisibleLayers( int aLayerMask )
|
||||
{
|
||||
m_BoardSettings->SetVisibleLayers( aLayerMask );
|
||||
}
|
||||
|
||||
|
||||
void BOARD::SetVisibleElements( int aMask )
|
||||
{
|
||||
m_BoardSettings->SetVisibleElements( aMask );
|
||||
}
|
||||
|
||||
int BOARD::GetVisibleElements() const
|
||||
|
||||
int BOARD::GetVisibleElements() const
|
||||
{
|
||||
return m_BoardSettings->GetVisibleElements();
|
||||
}
|
||||
@ -372,7 +401,8 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl )
|
||||
aBoardItem->SetParent( this );
|
||||
|
||||
// Because the list of pads has changed, reset the status
|
||||
// This indicate the list of pad and nets must be recalculated before use
|
||||
// This indicate the list of pad and nets must be recalculated before
|
||||
// use
|
||||
m_Status_Pcb = 0;
|
||||
break;
|
||||
|
||||
@ -412,7 +442,7 @@ BOARD_ITEM* BOARD::Remove( BOARD_ITEM* aBoardItem )
|
||||
case TYPE_MARKER_PCB:
|
||||
|
||||
// find the item in the vector, then remove it
|
||||
for( unsigned i = 0; i<m_markers.size(); ++i )
|
||||
for( unsigned i = 0; i<m_markers.size(); ++i )
|
||||
{
|
||||
if( m_markers[i] == (MARKER_PCB*) aBoardItem )
|
||||
{
|
||||
@ -425,7 +455,7 @@ BOARD_ITEM* BOARD::Remove( BOARD_ITEM* aBoardItem )
|
||||
|
||||
case TYPE_ZONE_CONTAINER: // this one uses a vector
|
||||
// find the item in the vector, then delete then erase it.
|
||||
for( unsigned i = 0; i<m_ZoneDescriptorList.size(); ++i )
|
||||
for( unsigned i = 0; i<m_ZoneDescriptorList.size(); ++i )
|
||||
{
|
||||
if( m_ZoneDescriptorList[i] == (ZONE_CONTAINER*) aBoardItem )
|
||||
{
|
||||
@ -469,7 +499,7 @@ BOARD_ITEM* BOARD::Remove( BOARD_ITEM* aBoardItem )
|
||||
void BOARD::DeleteMARKERs()
|
||||
{
|
||||
// the vector does not know how to delete the MARKER_PCB, it holds pointers
|
||||
for( unsigned i = 0; i<m_markers.size(); ++i )
|
||||
for( unsigned i = 0; i<m_markers.size(); ++i )
|
||||
delete m_markers[i];
|
||||
|
||||
m_markers.clear();
|
||||
@ -478,8 +508,9 @@ void BOARD::DeleteMARKERs()
|
||||
|
||||
void BOARD::DeleteZONEOutlines()
|
||||
{
|
||||
// the vector does not know how to delete the ZONE Outlines, it holds pointers
|
||||
for( unsigned i = 0; i<m_ZoneDescriptorList.size(); ++i )
|
||||
// the vector does not know how to delete the ZONE Outlines, it holds
|
||||
// pointers
|
||||
for( unsigned i = 0; i<m_ZoneDescriptorList.size(); ++i )
|
||||
delete m_ZoneDescriptorList[i];
|
||||
|
||||
m_ZoneDescriptorList.clear();
|
||||
@ -514,10 +545,6 @@ unsigned BOARD::GetNodesCount()
|
||||
}
|
||||
|
||||
|
||||
/***********************************/
|
||||
bool BOARD::ComputeBoundaryBox()
|
||||
/***********************************/
|
||||
|
||||
/** Function ComputeBoundaryBox()
|
||||
* Calculate the bounding box of the board
|
||||
* This box contains pcb edges, pads , vias and tracks
|
||||
@ -525,6 +552,7 @@ bool BOARD::ComputeBoundaryBox()
|
||||
*
|
||||
* @return 0 for an empty board (no items), else 1
|
||||
*/
|
||||
bool BOARD::ComputeBoundaryBox()
|
||||
{
|
||||
int rayon, cx, cy, d, xmin, ymin, xmax, ymax;
|
||||
bool hasItems = FALSE;
|
||||
@ -534,7 +562,7 @@ bool BOARD::ComputeBoundaryBox()
|
||||
xmin = ymin = 0x7FFFFFFFl;
|
||||
xmax = ymax = -0x7FFFFFFFl;
|
||||
|
||||
/* Analyse PCB edges*/
|
||||
/* Analyze PCB edges*/
|
||||
PtStruct = m_Drawings;
|
||||
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
||||
{
|
||||
@ -546,8 +574,9 @@ bool BOARD::ComputeBoundaryBox()
|
||||
|
||||
if( ptr->m_Shape == S_CIRCLE )
|
||||
{
|
||||
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 ) );
|
||||
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;
|
||||
xmin = MIN( xmin, cx - rayon );
|
||||
ymin = MIN( ymin, cy - rayon );
|
||||
@ -557,8 +586,8 @@ bool BOARD::ComputeBoundaryBox()
|
||||
}
|
||||
else
|
||||
{
|
||||
cx = MIN( ptr->m_Start.x, ptr->m_End.x );
|
||||
cy = MIN( ptr->m_Start.y, ptr->m_End.y );
|
||||
cx = MIN( ptr->m_Start.x, ptr->m_End.x );
|
||||
cy = MIN( ptr->m_Start.y, ptr->m_End.y );
|
||||
xmin = MIN( xmin, cx - d );
|
||||
ymin = MIN( ymin, cy - d );
|
||||
cx = MAX( ptr->m_Start.x, ptr->m_End.x );
|
||||
@ -569,18 +598,22 @@ bool BOARD::ComputeBoundaryBox()
|
||||
}
|
||||
}
|
||||
|
||||
/* Analyse footprints */
|
||||
/* Analise footprints */
|
||||
|
||||
for( MODULE* module = m_Modules; module; module = module->Next() )
|
||||
for( MODULE* module = m_Modules; module; module = module->Next() )
|
||||
{
|
||||
hasItems = TRUE;
|
||||
xmin = MIN( xmin, ( module->m_Pos.x + module->m_BoundaryBox.GetX() ) );
|
||||
ymin = MIN( ymin, ( module->m_Pos.y + module->m_BoundaryBox.GetY() ) );
|
||||
xmax = MAX( xmax, module->m_Pos.x + module->m_BoundaryBox.GetRight() );
|
||||
ymax = MAX( ymax, module->m_Pos.y + module->m_BoundaryBox.GetBottom() );
|
||||
xmin = MIN( xmin, ( module->m_Pos.x
|
||||
+ module->m_BoundaryBox.GetX() ) );
|
||||
ymin = MIN( ymin, ( module->m_Pos.y
|
||||
+ module->m_BoundaryBox.GetY() ) );
|
||||
xmax = MAX( xmax, module->m_Pos.x
|
||||
+ module->m_BoundaryBox.GetRight() );
|
||||
ymax = MAX( ymax,
|
||||
module->m_Pos.y + module->m_BoundaryBox.GetBottom() );
|
||||
|
||||
|
||||
for( D_PAD* pt_pad = module->m_Pads; pt_pad; pt_pad = pt_pad->Next() )
|
||||
for( D_PAD* pt_pad = module->m_Pads; pt_pad; pt_pad = pt_pad->Next() )
|
||||
{
|
||||
const wxPoint& pos = pt_pad->GetPosition();
|
||||
|
||||
@ -592,12 +625,12 @@ bool BOARD::ComputeBoundaryBox()
|
||||
}
|
||||
}
|
||||
|
||||
/* Analyse track and zones */
|
||||
for( TRACK* track = m_Track; track; track = track->Next() )
|
||||
/* Analise track and zones */
|
||||
for( TRACK* track = m_Track; track; track = track->Next() )
|
||||
{
|
||||
d = (track->m_Width / 2) + 1;
|
||||
cx = MIN( track->m_Start.x, track->m_End.x );
|
||||
cy = MIN( track->m_Start.y, track->m_End.y );
|
||||
d = ( track->m_Width / 2 ) + 1;
|
||||
cx = MIN( track->m_Start.x, track->m_End.x );
|
||||
cy = MIN( track->m_Start.y, track->m_End.y );
|
||||
xmin = MIN( xmin, cx - d );
|
||||
ymin = MIN( ymin, cy - d );
|
||||
cx = MAX( track->m_Start.x, track->m_End.x );
|
||||
@ -607,11 +640,11 @@ bool BOARD::ComputeBoundaryBox()
|
||||
hasItems = TRUE;
|
||||
}
|
||||
|
||||
for( TRACK* track = m_Zone; track; track = track->Next() )
|
||||
for( TRACK* track = m_Zone; track; track = track->Next() )
|
||||
{
|
||||
d = (track->m_Width / 2) + 1;
|
||||
cx = MIN( track->m_Start.x, track->m_End.x );
|
||||
cy = MIN( track->m_Start.y, track->m_End.y );
|
||||
d = ( track->m_Width / 2 ) + 1;
|
||||
cx = MIN( track->m_Start.x, track->m_End.x );
|
||||
cy = MIN( track->m_Start.y, track->m_End.y );
|
||||
xmin = MIN( xmin, cx - d );
|
||||
ymin = MIN( ymin, cy - d );
|
||||
cx = MAX( track->m_Start.x, track->m_End.x );
|
||||
@ -648,17 +681,17 @@ bool BOARD::ComputeBoundaryBox()
|
||||
|
||||
|
||||
// virtual, see pcbstruct.h
|
||||
|
||||
/* Display board statistics: pads, nets, connections.. count
|
||||
*/
|
||||
void BOARD::DisplayInfo( WinEDA_DrawFrame* frame )
|
||||
{
|
||||
/* Display board statistics: pads, nets, connections.. count
|
||||
*/
|
||||
|
||||
wxString txt;
|
||||
|
||||
frame->ClearMsgPanel();
|
||||
|
||||
int viasCount = 0;
|
||||
for( BOARD_ITEM* item = m_Track; item; item = item->Next() )
|
||||
for( BOARD_ITEM* item = m_Track; item; item = item->Next() )
|
||||
{
|
||||
if( item->Type() == TYPE_VIA )
|
||||
viasCount++;
|
||||
@ -688,7 +721,7 @@ void BOARD::DisplayInfo( WinEDA_DrawFrame* frame )
|
||||
frame->AppendMsgPanel( _( "Connect" ), txt, DARKGREEN );
|
||||
|
||||
txt.Printf( wxT( "%d" ), GetNoconnectCount() );
|
||||
frame->AppendMsgPanel( _( "NoConn" ), txt, BLUE );
|
||||
frame->AppendMsgPanel( _( "Unconnected" ), txt, BLUE );
|
||||
}
|
||||
}
|
||||
|
||||
@ -779,19 +812,23 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
|
||||
;
|
||||
break;
|
||||
|
||||
#if 0 // both these are on same list, so we must scan it twice in order to get VIA priority,
|
||||
// using new #else code below.
|
||||
// But we are not using separte lists for TRACKs and SEGVIAs, because items are ordered (sortered) in the linked
|
||||
#if 0 // both these are on same list, so we must scan it twice in order
|
||||
// to get VIA priority, using new #else code below.
|
||||
// But we are not using separate lists for TRACKs and SEGVIAs, because
|
||||
// items are ordered (sorted) in the linked
|
||||
// list by netcode AND by physical distance:
|
||||
// when created, if a track or via is connected to an existing track or via, it is put in linked list
|
||||
// after this existing track or via
|
||||
// when created, if a track or via is connected to an existing track or
|
||||
// via, it is put in linked list after this existing track or via
|
||||
// So usually, connected tracks or vias are grouped in this list
|
||||
// So the algorithm (used in rastnest computations) which computes the track connectivity is faster (more than 100 time regarding to
|
||||
// a non ordered list) because when it searchs for a connexion, first it tests the near (near in term of linked list) 50 items
|
||||
// So the algorithm (used in rastnest computations) which computes the
|
||||
// track connectivity is faster (more than 100 time regarding to
|
||||
// a non ordered list) because when it searches for a connexion, first
|
||||
// it tests the near (near in term of linked list) 50 items
|
||||
// from the current item (track or via) in test.
|
||||
// Usually, because of this sort, a connected item (if exists) is found.
|
||||
// If not found (and only in this case) an exhaustive (and time consumming) search is made,
|
||||
// but this case is statistically rare.
|
||||
// Usually, because of this sort, a connected item (if exists) is
|
||||
// found.
|
||||
// If not found (and only in this case) an exhaustive (and time
|
||||
// consuming) search is made, but this case is statistically rare.
|
||||
case TYPE_VIA:
|
||||
case TYPE_TRACK:
|
||||
result = IterateForward( m_Track, inspector, testData, p );
|
||||
@ -829,7 +866,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
|
||||
case TYPE_MARKER_PCB:
|
||||
|
||||
// MARKER_PCBS are in the m_markers std::vector
|
||||
for( unsigned i = 0; i<m_markers.size(); ++i )
|
||||
for( unsigned i = 0; i<m_markers.size(); ++i )
|
||||
{
|
||||
result = m_markers[i]->Visit( inspector, testData, p );
|
||||
if( result == SEARCH_QUIT )
|
||||
@ -842,9 +879,11 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
|
||||
case TYPE_ZONE_CONTAINER:
|
||||
|
||||
// TYPE_ZONE_CONTAINER are in the m_ZoneDescriptorList std::vector
|
||||
for( unsigned i = 0; i< m_ZoneDescriptorList.size(); ++i )
|
||||
for( unsigned i = 0; i< m_ZoneDescriptorList.size(); ++i )
|
||||
{
|
||||
result = m_ZoneDescriptorList[i]->Visit( inspector, testData, p );
|
||||
result = m_ZoneDescriptorList[i]->Visit( inspector,
|
||||
testData,
|
||||
p );
|
||||
if( result == SEARCH_QUIT )
|
||||
break;
|
||||
}
|
||||
@ -886,7 +925,8 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
|
||||
* found(0), layer(alayer), layer_mask( g_TabOneLayerMask[alayer] )
|
||||
* {}
|
||||
*
|
||||
* SEARCH_RESULT Inspect( EDA_BaseStruct* testItem, const void* testData )
|
||||
* SEARCH_RESULT Inspect( EDA_BaseStruct* testItem, const void* testData
|
||||
* )
|
||||
* {
|
||||
* BOARD_ITEM* item = (BOARD_ITEM*) testItem;
|
||||
* const wxPoint& refPos = *(const wxPoint*) testData;
|
||||
@ -967,8 +1007,8 @@ NETINFO_ITEM* BOARD::FindNet( int anetcode ) const
|
||||
{
|
||||
if( anetcode != net->GetNet() )
|
||||
{
|
||||
printf("FindNet() anetcode %d != GetNet() %d (net: %s)\n",
|
||||
anetcode, net->GetNet(), CONV_TO_UTF8(net->GetNetname()));
|
||||
printf( "FindNet() anetcode %d != GetNet() %d (net: %s)\n",
|
||||
anetcode, net->GetNet(), CONV_TO_UTF8( net->GetNetname() ) );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -978,7 +1018,7 @@ NETINFO_ITEM* BOARD::FindNet( int anetcode ) const
|
||||
|
||||
|
||||
/**
|
||||
* Function FindNet overlayed
|
||||
* Function FindNet overlaid
|
||||
* searches for a net with the given name.
|
||||
* @param aNetname A Netname to search for.
|
||||
* @return NETINFO_ITEM* - the net or NULL if not found.
|
||||
@ -995,8 +1035,8 @@ NETINFO_ITEM* BOARD::FindNet( const wxString& aNetname ) const
|
||||
// Search for a netname = aNetname
|
||||
#if 0
|
||||
|
||||
// Use a sequencial search: easy to understand, but slow
|
||||
for( int ii = 1; ii < ncount; ii++ )
|
||||
// Use a sequential search: easy to understand, but slow
|
||||
for( int ii = 1; ii < ncount; ii++ )
|
||||
{
|
||||
NETINFO_ITEM* item = m_NetInfo->GetNetItem( ii );
|
||||
if( item && item->GetNetname() == aNetname )
|
||||
@ -1009,7 +1049,8 @@ NETINFO_ITEM* BOARD::FindNet( const wxString& aNetname ) const
|
||||
|
||||
// Use a fast binary search,
|
||||
// this is possible because Nets are alphabetically ordered in list
|
||||
// see NETINFO_LIST::BuildListOfNets() and NETINFO_LIST::Build_Pads_Full_List()
|
||||
// see NETINFO_LIST::BuildListOfNets() and
|
||||
// NETINFO_LIST::Build_Pads_Full_List()
|
||||
int imax = ncount - 1;
|
||||
int index = imax;
|
||||
while( ncount > 0 )
|
||||
@ -1093,10 +1134,12 @@ static bool s_SortByNodes( const NETINFO_ITEM* a, const NETINFO_ITEM* b )
|
||||
/**
|
||||
* Function ReturnSortedNetnamesList
|
||||
* @param aNames An array string to fill with net names.
|
||||
* @param aSortbyPadsCount : true = sort by active pads count, false = no sort (i.e. leave the sort by net names)
|
||||
* @param aSortbyPadsCount : true = sort by active pads count, false = no sort
|
||||
* (i.e. leave the sort by net names)
|
||||
* @return int - net names count.
|
||||
*/
|
||||
int BOARD::ReturnSortedNetnamesList( wxArrayString& aNames, bool aSortbyPadsCount )
|
||||
int BOARD::ReturnSortedNetnamesList( wxArrayString& aNames,
|
||||
bool aSortbyPadsCount )
|
||||
{
|
||||
if( m_NetInfo->GetCount() == 0 )
|
||||
return 0;
|
||||
@ -1123,9 +1166,7 @@ int BOARD::ReturnSortedNetnamesList( wxArrayString& aNames, bool aSortbyPadsCoun
|
||||
}
|
||||
|
||||
|
||||
/************************************/
|
||||
bool BOARD::Save( FILE* aFile ) const
|
||||
/************************************/
|
||||
{
|
||||
bool rc = false;
|
||||
BOARD_ITEM* item;
|
||||
@ -1139,11 +1180,11 @@ bool BOARD::Save( FILE* aFile ) const
|
||||
m_NetClasses.Save( aFile );
|
||||
|
||||
// save the modules
|
||||
for( item = m_Modules; item; item = item->Next() )
|
||||
for( item = m_Modules; item; item = item->Next() )
|
||||
if( !item->Save( aFile ) )
|
||||
goto out;
|
||||
|
||||
for( item = m_Drawings; item; item = item->Next() )
|
||||
for( item = m_Drawings; item; item = item->Next() )
|
||||
{
|
||||
switch( item->Type() )
|
||||
{
|
||||
@ -1159,7 +1200,8 @@ bool BOARD::Save( FILE* aFile ) const
|
||||
|
||||
// future: throw exception here
|
||||
#if defined(DEBUG)
|
||||
printf( "BOARD::Save() ignoring m_Drawings type %d\n", item->Type() );
|
||||
printf( "BOARD::Save() ignoring m_Drawings type %d\n",
|
||||
item->Type() );
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@ -1169,7 +1211,7 @@ bool BOARD::Save( FILE* aFile ) const
|
||||
|
||||
// save the tracks & vias
|
||||
fprintf( aFile, "$TRACK\n" );
|
||||
for( item = m_Track; item; item = item->Next() )
|
||||
for( item = m_Track; item; item = item->Next() )
|
||||
if( !item->Save( aFile ) )
|
||||
goto out;
|
||||
|
||||
@ -1177,7 +1219,7 @@ bool BOARD::Save( FILE* aFile ) const
|
||||
|
||||
// save the zones
|
||||
fprintf( aFile, "$ZONE\n" );
|
||||
for( item = m_Zone; item; item = item->Next() )
|
||||
for( item = m_Zone; item; item = item->Next() )
|
||||
if( !item->Save( aFile ) )
|
||||
goto out;
|
||||
|
||||
@ -1201,14 +1243,14 @@ out:
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************/
|
||||
void BOARD::RedrawAreasOutlines( WinEDA_DrawPanel* panel, wxDC* aDC, int aDrawMode, int aLayer )
|
||||
/***********************************************************************************************/
|
||||
|
||||
/**
|
||||
* Function RedrawAreasOutlines
|
||||
* Redraw all areas outlines on layer aLayer ( redraw all if aLayer < 0 )
|
||||
*/
|
||||
void BOARD::RedrawAreasOutlines( WinEDA_DrawPanel* panel,
|
||||
wxDC* aDC,
|
||||
int aDrawMode,
|
||||
int aLayer )
|
||||
{
|
||||
if( !aDC )
|
||||
return;
|
||||
@ -1222,14 +1264,14 @@ void BOARD::RedrawAreasOutlines( WinEDA_DrawPanel* panel, wxDC* aDC, int aDrawMo
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************************************/
|
||||
void BOARD::RedrawFilledAreas( WinEDA_DrawPanel* panel, wxDC* aDC, int aDrawMode, int aLayer )
|
||||
/***********************************************************************************************/
|
||||
|
||||
/**
|
||||
* Function RedrawFilledAreas
|
||||
* Redraw all areas outlines on layer aLayer ( redraw all if aLayer < 0 )
|
||||
*/
|
||||
void BOARD::RedrawFilledAreas( WinEDA_DrawPanel* panel,
|
||||
wxDC* aDC,
|
||||
int aDrawMode,
|
||||
int aLayer )
|
||||
{
|
||||
if( !aDC )
|
||||
return;
|
||||
@ -1245,13 +1287,15 @@ void BOARD::RedrawFilledAreas( WinEDA_DrawPanel* panel, wxDC* aDC, int aDrawMode
|
||||
|
||||
/**
|
||||
* Function HitTestForAnyFilledArea
|
||||
* tests if the given wxPoint is within the bounds of a filled area of this zone.
|
||||
* tests if the given wxPoint is within the bounds of a filled area of this
|
||||
* zone.
|
||||
* the test is made on zones on layer from aStartLayer to aEndLayer
|
||||
* Note: if a zone has its flag BUSY (in .m_State) is set, it is ignored.
|
||||
* @param refPos A wxPoint to test
|
||||
* @param aStartLayer the first layer to test
|
||||
* @param aEndLayer the last layer (-1 to ignore it) to test
|
||||
* @return ZONE_CONTAINER* return a pointer to the ZONE_CONTAINER found, else NULL
|
||||
* @return ZONE_CONTAINER* return a pointer to the ZONE_CONTAINER found, else
|
||||
* NULL
|
||||
*/
|
||||
ZONE_CONTAINER* BOARD::HitTestForAnyFilledArea( const wxPoint& aRefPos,
|
||||
int aStartLayer,
|
||||
@ -1268,7 +1312,8 @@ ZONE_CONTAINER* BOARD::HitTestForAnyFilledArea( const wxPoint& aRefPos,
|
||||
int layer = area->GetLayer();
|
||||
if( (layer < aStartLayer) || (layer > aEndLayer) )
|
||||
continue;
|
||||
if( area->GetState( BUSY ) ) // In locate functions we must skip tagged items with BUSY flag set.
|
||||
if( area->GetState( BUSY ) ) // In locate functions we must skip
|
||||
// tagged items with BUSY flag set.
|
||||
continue;
|
||||
if( area->HitTestFilledArea( aRefPos ) )
|
||||
return area;
|
||||
@ -1280,9 +1325,12 @@ ZONE_CONTAINER* BOARD::HitTestForAnyFilledArea( const wxPoint& aRefPos,
|
||||
|
||||
/**
|
||||
* Function SetAreasNetCodesFromNetNames
|
||||
* Set the .m_NetCode member of all copper areas, according to the area Net Name
|
||||
* The SetNetCodesFromNetNames is an equivalent to net name, for fast comparisons.
|
||||
* However the Netcode is an arbitrary equivalence, it must be set after each netlist read
|
||||
* Set the .m_NetCode member of all copper areas, according to the area Net
|
||||
* Name
|
||||
* The SetNetCodesFromNetNames is an equivalent to net name, for fast
|
||||
* comparisons.
|
||||
* However the Netcode is an arbitrary equivalence, it must be set after each
|
||||
* netlist read
|
||||
* or net change
|
||||
* Must be called after pad netcodes are calculated
|
||||
* @return : error count
|
||||
@ -1300,7 +1348,8 @@ int BOARD::SetAreasNetCodesFromNetNames( void )
|
||||
continue;
|
||||
}
|
||||
|
||||
if( GetArea( ii )->GetNet() != 0 ) // i.e. if this zone is connected to a net
|
||||
if( GetArea( ii )->GetNet() != 0 ) // i.e. if this zone is
|
||||
// connected to a net
|
||||
{
|
||||
const NETINFO_ITEM* net = FindNet( GetArea( ii )->m_Netname );
|
||||
if( net )
|
||||
@ -1310,7 +1359,8 @@ int BOARD::SetAreasNetCodesFromNetNames( void )
|
||||
else
|
||||
{
|
||||
error_count++;
|
||||
GetArea( ii )->SetNet( -1 ); //keep Net Name ane set m_NetCode to -1 : error flag
|
||||
GetArea( ii )->SetNet( -1 ); // keep Net Name and set
|
||||
// m_NetCode to -1 : error flag
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1333,7 +1383,8 @@ void BOARD::Show( int nestLevel, std::ostream& os )
|
||||
BOARD_ITEM* p;
|
||||
|
||||
// for now, make it look like XML:
|
||||
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n";
|
||||
NestedSpace( nestLevel,
|
||||
os ) << '<' << GetClass().Lower().mb_str() << ">\n";
|
||||
|
||||
// specialization of the output:
|
||||
NestedSpace( nestLevel + 1, os ) << "<modules>\n";
|
||||
@ -1366,18 +1417,20 @@ void BOARD::Show( int nestLevel, std::ostream& os )
|
||||
|
||||
/*
|
||||
* NestedSpace( nestLevel+1, os ) << "<zone_container>\n";
|
||||
* for( ZONE_CONTAINERS::iterator i=m_ZoneDescriptorList.begin(); i!=m_ZoneDescriptorList.end(); ++i )
|
||||
* for( ZONE_CONTAINERS::iterator i=m_ZoneDescriptorList.begin();
|
||||
* i!=m_ZoneDescriptorList.end(); ++i )
|
||||
* (*i)->Show( nestLevel+2, os );
|
||||
* NestedSpace( nestLevel+1, os ) << "</zone_container>\n";
|
||||
*/
|
||||
|
||||
p = (BOARD_ITEM*) m_Son;
|
||||
for( ; p; p = p->Next() )
|
||||
for( ; p; p = p->Next() )
|
||||
{
|
||||
p->Show( nestLevel + 1, os );
|
||||
}
|
||||
|
||||
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
|
||||
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str()
|
||||
<< ">\n";
|
||||
}
|
||||
|
||||
|
||||
|
@ -106,12 +106,12 @@ private:
|
||||
LAYER m_Layer[NB_COPPER_LAYERS];
|
||||
|
||||
public:
|
||||
WinEDA_BasePcbFrame* m_PcbFrame; // Window de visualisation
|
||||
WinEDA_BasePcbFrame* m_PcbFrame; // Window of visualization
|
||||
EDA_Rect m_BoundaryBox; // Board size and position
|
||||
int m_Status_Pcb; // Flags used in ratsnet calculation and update
|
||||
EDA_BoardDesignSettings* m_BoardSettings; // Link to current design settings
|
||||
int m_NbNodes; // Active pads (pads attached to a net ) count
|
||||
int m_NbNoconnect; // Active ratsnet count (rastnests not alraedy connected by tracks)
|
||||
int m_NbNoconnect; // Active ratsnet count (rastnests not already connected by tracks)
|
||||
|
||||
DLIST<BOARD_ITEM> m_Drawings; // linked list of lines & texts
|
||||
DLIST<MODULE> m_Modules; // linked list of MODULEs
|
||||
@ -327,7 +327,7 @@ public:
|
||||
/* Functions to get some items count */
|
||||
int GetNumSegmTrack();
|
||||
int GetNumSegmZone();
|
||||
unsigned GetNoconnectCount(); // retourne le nombre de connexions manquantes
|
||||
unsigned GetNoconnectCount(); // Return the number of missing links.
|
||||
|
||||
/**
|
||||
* Function GetNumRatsnests
|
||||
@ -353,7 +353,6 @@ public:
|
||||
}
|
||||
|
||||
|
||||
// Calcul du rectangle d'encadrement:
|
||||
bool ComputeBoundaryBox();
|
||||
|
||||
|
||||
@ -448,8 +447,8 @@ public:
|
||||
/**
|
||||
* Function SetCurrentNetClass
|
||||
* Must be called after a netclass selection (or after a netclass parameter change
|
||||
* Initialise vias and tracks values displayed in comb boxs of the auxiliary toolbar
|
||||
* and some others parametres (netclass name ....)
|
||||
* Initialise vias and tracks values displayed in comb boxes of the auxiliary toolbar
|
||||
* and some others parameters (netclass name ....)
|
||||
* @param aNetClassName = the new netclass name
|
||||
* @return true if lists of tracks and vias sizes are modified
|
||||
*/
|
||||
@ -461,7 +460,7 @@ public:
|
||||
int GetBiggestClearanceValue();
|
||||
|
||||
/** function GetCurrentTrackWidth
|
||||
* @return the current track width, accordint to the selected options
|
||||
* @return the current track width, according to the selected options
|
||||
* ( using the default netclass value or a preset value )
|
||||
* the default netclass is always in m_TrackWidthList[0]
|
||||
*/
|
||||
@ -471,7 +470,7 @@ public:
|
||||
}
|
||||
|
||||
/** function GetCurrentViaSize
|
||||
* @return the current via size, accordint to the selected options
|
||||
* @return the current via size, according to the selected options
|
||||
* ( using the default netclass value or a preset value )
|
||||
* the default netclass is always in m_TrackWidthList[0]
|
||||
*/
|
||||
@ -481,7 +480,7 @@ public:
|
||||
}
|
||||
|
||||
/** function GetCurrentViaDrill
|
||||
* @return the current via size, accordint to the selected options
|
||||
* @return the current via size, according to the selected options
|
||||
* ( using the default netclass value or a preset value )
|
||||
* the default netclass is always in m_TrackWidthList[0]
|
||||
*/
|
||||
@ -577,8 +576,8 @@ public:
|
||||
/**
|
||||
* Function SetAreasNetCodesFromNetNames
|
||||
* Set the .m_NetCode member of all copper areas, according to the area Net Name
|
||||
* The SetNetCodesFromNetNames is an equivalent to net name, for fas comparisons.
|
||||
* However the Netcode is an arbitrary equyivalence, it must be set after each netlist read
|
||||
* The SetNetCodesFromNetNames is an equivalent to net name, for fast comparisons.
|
||||
* However the Netcode is an arbitrary equivalence, it must be set after each netlist read
|
||||
* or net change
|
||||
* Must be called after pad netcodes are calculated
|
||||
* @return : error count
|
||||
@ -761,7 +760,7 @@ public:
|
||||
* If possible, combine 2 copper areas
|
||||
* @param aDeletedList = a PICKED_ITEMS_LIST * where to store deleted areas (useful in undo commands
|
||||
* can be NULL
|
||||
* @param area_ref = tje main area (zone)
|
||||
* @param area_ref = the main area (zone)
|
||||
* @param area_to_combine = the zone that can be merged with area_ref
|
||||
* area_ref must be BEFORE area_to_combine
|
||||
* area_to_combine will be deleted, if areas are combined
|
||||
@ -778,7 +777,7 @@ public:
|
||||
* Test Areas outlines for DRC:
|
||||
* Test areas inside other areas
|
||||
* Test areas too close
|
||||
* @param aArea_To_Examine: area to compare with other areas. if NULL: all areas are compared tp all others
|
||||
* @param aArea_To_Examine: area to compare with other areas. if NULL: all areas are compared to all others
|
||||
* @param aCreate_Markers: if true create DRC markers. False: do not creates anything
|
||||
* @return errors count
|
||||
*/
|
||||
@ -790,7 +789,7 @@ public:
|
||||
/**
|
||||
* Function Test_Connection_To_Copper_Areas
|
||||
* init .m_ZoneSubnet parameter in tracks and pads according to the connections to areas found
|
||||
* @param aNetcode = netcode to analyse. if -1, analyse all nets
|
||||
* @param aNetcode = netcode to analyze. if -1, analyze all nets
|
||||
*/
|
||||
void Test_Connections_To_Copper_Areas( int aNetcode = -1 );
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/************************************/
|
||||
/* fonctions de la classe COTATION */
|
||||
/************************************/
|
||||
/*****************************/
|
||||
/* COTATION class definition */
|
||||
/*****************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
@ -25,7 +25,6 @@ COTATION::COTATION( BOARD_ITEM* aParent ) :
|
||||
}
|
||||
|
||||
|
||||
/* Effacement memoire de la structure */
|
||||
COTATION::~COTATION()
|
||||
{
|
||||
delete m_Text;
|
||||
@ -39,11 +38,9 @@ void COTATION:: SetText( const wxString& NewText )
|
||||
}
|
||||
|
||||
|
||||
/**********************************/
|
||||
wxString COTATION::GetText( void )
|
||||
/**********************************/
|
||||
/* Reutun the dimension text
|
||||
/* Return the dimension text
|
||||
*/
|
||||
wxString COTATION::GetText( void )
|
||||
{
|
||||
return m_Text->m_Text;
|
||||
}
|
||||
@ -59,9 +56,8 @@ void COTATION::SetLayer( int aLayer )
|
||||
m_Text->SetLayer( aLayer);
|
||||
}
|
||||
|
||||
/*************************************/
|
||||
|
||||
void COTATION::Copy( COTATION* source )
|
||||
/*************************************/
|
||||
{
|
||||
m_Value = source->m_Value;
|
||||
SetLayer( source->GetLayer() );
|
||||
@ -72,26 +68,38 @@ void COTATION::Copy( COTATION* source )
|
||||
m_TimeStamp = GetTimeStamp();
|
||||
m_Text->Copy( source->m_Text );
|
||||
|
||||
Barre_ox = source->Barre_ox; Barre_oy = source->Barre_oy;
|
||||
Barre_fx = source->Barre_fx; Barre_fy = source->Barre_fy;
|
||||
TraitG_ox = source->TraitG_ox; TraitG_oy = source->TraitG_oy;
|
||||
TraitG_fx = source->TraitG_fx; TraitG_fy = source->TraitG_fy;
|
||||
TraitD_ox = source->TraitD_ox; TraitD_oy = source->TraitD_oy;
|
||||
TraitD_fx = source->TraitD_fx; TraitD_fy = source->TraitD_fy;
|
||||
FlecheD1_ox = source->FlecheD1_ox; FlecheD1_oy = source->FlecheD1_oy;
|
||||
FlecheD1_fx = source->FlecheD1_fx; FlecheD1_fy = source->FlecheD1_fy;
|
||||
FlecheD2_ox = source->FlecheD2_ox; FlecheD2_oy = source->FlecheD2_oy;
|
||||
FlecheD2_fx = source->FlecheD2_fx; FlecheD2_fy = source->FlecheD2_fy;
|
||||
FlecheG1_ox = source->FlecheG1_ox; FlecheG1_oy = source->FlecheG1_oy;
|
||||
FlecheG1_fx = source->FlecheG1_fx; FlecheG1_fy = source->FlecheG1_fy;
|
||||
FlecheG2_ox = source->FlecheG2_ox; FlecheG2_oy = source->FlecheG2_oy;
|
||||
FlecheG2_fx = source->FlecheG2_fx; FlecheG2_fy = source->FlecheG2_fy;
|
||||
Barre_ox = source->Barre_ox;
|
||||
Barre_oy = source->Barre_oy;
|
||||
Barre_fx = source->Barre_fx;
|
||||
Barre_fy = source->Barre_fy;
|
||||
TraitG_ox = source->TraitG_ox;
|
||||
TraitG_oy = source->TraitG_oy;
|
||||
TraitG_fx = source->TraitG_fx;
|
||||
TraitG_fy = source->TraitG_fy;
|
||||
TraitD_ox = source->TraitD_ox;
|
||||
TraitD_oy = source->TraitD_oy;
|
||||
TraitD_fx = source->TraitD_fx;
|
||||
TraitD_fy = source->TraitD_fy;
|
||||
FlecheD1_ox = source->FlecheD1_ox;
|
||||
FlecheD1_oy = source->FlecheD1_oy;
|
||||
FlecheD1_fx = source->FlecheD1_fx;
|
||||
FlecheD1_fy = source->FlecheD1_fy;
|
||||
FlecheD2_ox = source->FlecheD2_ox;
|
||||
FlecheD2_oy = source->FlecheD2_oy;
|
||||
FlecheD2_fx = source->FlecheD2_fx;
|
||||
FlecheD2_fy = source->FlecheD2_fy;
|
||||
FlecheG1_ox = source->FlecheG1_ox;
|
||||
FlecheG1_oy = source->FlecheG1_oy;
|
||||
FlecheG1_fx = source->FlecheG1_fx;
|
||||
FlecheG1_fy = source->FlecheG1_fy;
|
||||
FlecheG2_ox = source->FlecheG2_ox;
|
||||
FlecheG2_oy = source->FlecheG2_oy;
|
||||
FlecheG2_fx = source->FlecheG2_fx;
|
||||
FlecheG2_fy = source->FlecheG2_fy;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************/
|
||||
bool COTATION::ReadCotationDescr( FILE* File, int* LineNum )
|
||||
/***************************************************************/
|
||||
{
|
||||
char Line[2048], Text[2048];
|
||||
|
||||
@ -112,7 +120,6 @@ bool COTATION::ReadCotationDescr( FILE* File, int* LineNum )
|
||||
|
||||
sscanf( Line + 2, " %d %d %lX", &m_Shape, &layer, &m_TimeStamp );
|
||||
|
||||
/* Mise a jour des param .layer des sous structures */
|
||||
if( layer < FIRST_NO_COPPER_LAYER )
|
||||
layer = FIRST_NO_COPPER_LAYER;
|
||||
if( layer > LAST_NO_COPPER_LAYER )
|
||||
@ -132,14 +139,14 @@ bool COTATION::ReadCotationDescr( FILE* File, int* LineNum )
|
||||
|
||||
if( Line[0] == 'P' )
|
||||
{
|
||||
int normal_display = 1;
|
||||
int normal_display = 1;
|
||||
sscanf( Line + 2, " %d %d %d %d %d %d %d",
|
||||
&m_Text->m_Pos.x, &m_Text->m_Pos.y,
|
||||
&m_Text->m_Size.x, &m_Text->m_Size.y,
|
||||
&m_Text->m_Width, &m_Text->m_Orient,
|
||||
&normal_display );
|
||||
|
||||
m_Text->m_Mirror = normal_display ? false : true;
|
||||
m_Text->m_Mirror = normal_display ? false : true;
|
||||
m_Pos = m_Text->m_Pos;
|
||||
continue;
|
||||
}
|
||||
@ -214,41 +221,52 @@ bool COTATION::ReadCotationDescr( FILE* File, int* LineNum )
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/****************************************/
|
||||
void COTATION::Move(const wxPoint& offset)
|
||||
/****************************************/
|
||||
|
||||
/**
|
||||
* Function Move
|
||||
* @param offset : moving vector
|
||||
*/
|
||||
void COTATION::Move(const wxPoint& offset)
|
||||
{
|
||||
m_Pos += offset;
|
||||
m_Text->m_Pos += offset;
|
||||
Barre_ox += offset.x; Barre_oy += offset.y;
|
||||
Barre_fx += offset.x; Barre_fy += offset.y;
|
||||
TraitG_ox += offset.x; TraitG_oy += offset.y;
|
||||
TraitG_fx += offset.x; TraitG_fy += offset.y;
|
||||
TraitD_ox += offset.x; TraitD_oy += offset.y;
|
||||
TraitD_fx += offset.x; TraitD_fy += offset.y;
|
||||
FlecheG1_ox += offset.x; FlecheG1_oy += offset.y;
|
||||
FlecheG1_fx += offset.x; FlecheG1_fy += offset.y;
|
||||
FlecheG2_ox += offset.x; FlecheG2_oy += offset.y;
|
||||
FlecheG2_fx += offset.x; FlecheG2_fy += offset.y;
|
||||
FlecheD1_ox += offset.x; FlecheD1_oy += offset.y;
|
||||
FlecheD1_fx += offset.x; FlecheD1_fy += offset.y;
|
||||
FlecheD2_ox += offset.x; FlecheD2_oy += offset.y;
|
||||
FlecheD2_fx += offset.x; FlecheD2_fy += offset.y;
|
||||
Barre_ox += offset.x;
|
||||
Barre_oy += offset.y;
|
||||
Barre_fx += offset.x;
|
||||
Barre_fy += offset.y;
|
||||
TraitG_ox += offset.x;
|
||||
TraitG_oy += offset.y;
|
||||
TraitG_fx += offset.x;
|
||||
TraitG_fy += offset.y;
|
||||
TraitD_ox += offset.x;
|
||||
TraitD_oy += offset.y;
|
||||
TraitD_fx += offset.x;
|
||||
TraitD_fy += offset.y;
|
||||
FlecheG1_ox += offset.x;
|
||||
FlecheG1_oy += offset.y;
|
||||
FlecheG1_fx += offset.x;
|
||||
FlecheG1_fy += offset.y;
|
||||
FlecheG2_ox += offset.x;
|
||||
FlecheG2_oy += offset.y;
|
||||
FlecheG2_fx += offset.x;
|
||||
FlecheG2_fy += offset.y;
|
||||
FlecheD1_ox += offset.x;
|
||||
FlecheD1_oy += offset.y;
|
||||
FlecheD1_fx += offset.x;
|
||||
FlecheD1_fy += offset.y;
|
||||
FlecheD2_ox += offset.x;
|
||||
FlecheD2_oy += offset.y;
|
||||
FlecheD2_fx += offset.x;
|
||||
FlecheD2_fy += offset.y;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************/
|
||||
void COTATION::Rotate(const wxPoint& centre, int angle)
|
||||
/******************************************************/
|
||||
/**
|
||||
* Function Rotate
|
||||
* @param centre : Rotation point
|
||||
* @param center : Rotation point
|
||||
* @param angle : Rotation angle in 0.1 degrees
|
||||
*/
|
||||
void COTATION::Rotate(const wxPoint& centre, int angle)
|
||||
{
|
||||
RotatePoint( &m_Pos, centre, angle );
|
||||
|
||||
@ -256,8 +274,7 @@ void COTATION::Rotate(const wxPoint& centre, int angle)
|
||||
m_Text->m_Orient += angle;
|
||||
if( m_Text->m_Orient >= 3600 )
|
||||
m_Text->m_Orient -= 3600;
|
||||
if( (m_Text->m_Orient > 900)
|
||||
&& (m_Text->m_Orient <2700) )
|
||||
if( ( m_Text->m_Orient > 900 ) && ( m_Text->m_Orient <2700 ) )
|
||||
m_Text->m_Orient -= 1800;
|
||||
|
||||
RotatePoint( &Barre_ox, &Barre_oy, centre.x, centre.y, angle );
|
||||
@ -276,6 +293,7 @@ void COTATION::Rotate(const wxPoint& centre, int angle)
|
||||
RotatePoint( &FlecheD2_fx, &FlecheD2_fy, centre.x, centre.y, angle );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function Flip
|
||||
* Flip this object, i.e. change the board side for this object
|
||||
@ -287,9 +305,7 @@ void COTATION::Flip(const wxPoint& aCentre )
|
||||
SetLayer( ChangeSideNumLayer( GetLayer() ) );
|
||||
}
|
||||
|
||||
/**********************************************/
|
||||
void COTATION::Mirror(const wxPoint& axis_pos)
|
||||
/**********************************************/
|
||||
|
||||
/**
|
||||
* Function Mirror
|
||||
* Mirror the Dimension , relative to a given horizontal axis
|
||||
@ -297,6 +313,7 @@ void COTATION::Mirror(const wxPoint& axis_pos)
|
||||
* the layer is not changed
|
||||
* @param axis_pos : vertical axis position
|
||||
*/
|
||||
void COTATION::Mirror(const wxPoint& axis_pos)
|
||||
{
|
||||
#define INVERT( pos ) (pos) = axis_pos.y - ( (pos) - axis_pos.y )
|
||||
#define INVERT_ANGLE( phi ) (phi) = -(phi)
|
||||
@ -305,7 +322,7 @@ void COTATION::Mirror(const wxPoint& axis_pos)
|
||||
INVERT_ANGLE( m_Text->m_Orient );
|
||||
if( m_Text->m_Orient >= 3600 )
|
||||
m_Text->m_Orient -= 3600;
|
||||
if( (m_Text->m_Orient > 900) && (m_Text->m_Orient <2700) )
|
||||
if( ( m_Text->m_Orient > 900 ) && ( m_Text->m_Orient < 2700 ) )
|
||||
m_Text->m_Orient -= 1800;
|
||||
|
||||
INVERT( Barre_oy );
|
||||
@ -324,9 +341,8 @@ void COTATION::Mirror(const wxPoint& axis_pos)
|
||||
INVERT( FlecheD2_fy );
|
||||
}
|
||||
|
||||
/****************************************/
|
||||
|
||||
bool COTATION::Save( FILE* aFile ) const
|
||||
/****************************************/
|
||||
{
|
||||
if( GetState( DELETED ) )
|
||||
return true;
|
||||
@ -392,13 +408,10 @@ out:
|
||||
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* Print 1 dimension: series of n + 1 segments text
|
||||
*/
|
||||
void COTATION::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||
int mode_color, const wxPoint& offset )
|
||||
/************************************************************************/
|
||||
|
||||
/* impression de 1 cotation : serie de n segments + 1 texte
|
||||
*/
|
||||
{
|
||||
int ox, oy, typeaff, width, gcolor;
|
||||
|
||||
@ -504,11 +517,11 @@ bool COTATION::HitTest( const wxPoint& ref_pos )
|
||||
if( m_Text && m_Text->TextHitTest( ref_pos ) )
|
||||
return true;
|
||||
|
||||
/* Localisation des SEGMENTS ?) */
|
||||
/* Locate SEGMENTS? */
|
||||
ux0 = Barre_ox;
|
||||
uy0 = Barre_oy;
|
||||
|
||||
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
|
||||
/* Recalculate coordinates with ux0, uy0 = origin. */
|
||||
dx = Barre_fx - ux0;
|
||||
dy = Barre_fy - uy0;
|
||||
|
||||
@ -521,49 +534,42 @@ bool COTATION::HitTest( const wxPoint& ref_pos )
|
||||
ux0 = TraitG_ox;
|
||||
uy0 = TraitG_oy;
|
||||
|
||||
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
|
||||
dx = TraitG_fx - ux0;
|
||||
dy = TraitG_fy - uy0;
|
||||
|
||||
spot_cX = ref_pos.x - ux0;
|
||||
spot_cY = ref_pos.y - uy0;
|
||||
|
||||
/* detection : */
|
||||
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
|
||||
return true;
|
||||
|
||||
ux0 = TraitD_ox;
|
||||
uy0 = TraitD_oy;
|
||||
|
||||
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
|
||||
dx = TraitD_fx - ux0;
|
||||
dy = TraitD_fy - uy0;
|
||||
|
||||
spot_cX = ref_pos.x - ux0;
|
||||
spot_cY = ref_pos.y - uy0;
|
||||
|
||||
/* detection : */
|
||||
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
|
||||
return true;
|
||||
|
||||
ux0 = FlecheD1_ox;
|
||||
uy0 = FlecheD1_oy;
|
||||
|
||||
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
|
||||
dx = FlecheD1_fx - ux0;
|
||||
dy = FlecheD1_fy - uy0;
|
||||
|
||||
spot_cX = ref_pos.x - ux0;
|
||||
spot_cY = ref_pos.y - uy0;
|
||||
|
||||
/* detection : */
|
||||
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
|
||||
return true;
|
||||
|
||||
ux0 = FlecheD2_ox;
|
||||
uy0 = FlecheD2_oy;
|
||||
|
||||
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
|
||||
dx = FlecheD2_fx - ux0;
|
||||
dy = FlecheD2_fy - uy0;
|
||||
|
||||
@ -576,7 +582,6 @@ bool COTATION::HitTest( const wxPoint& ref_pos )
|
||||
ux0 = FlecheG1_ox;
|
||||
uy0 = FlecheG1_oy;
|
||||
|
||||
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
|
||||
dx = FlecheG1_fx - ux0;
|
||||
dy = FlecheG1_fy - uy0;
|
||||
|
||||
@ -589,7 +594,6 @@ bool COTATION::HitTest( const wxPoint& ref_pos )
|
||||
ux0 = FlecheG2_ox;
|
||||
uy0 = FlecheG2_oy;
|
||||
|
||||
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
|
||||
dx = FlecheG2_fx - ux0;
|
||||
dy = FlecheG2_fy - uy0;
|
||||
|
||||
@ -602,13 +606,14 @@ bool COTATION::HitTest( const wxPoint& ref_pos )
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function HitTest (overlayed)
|
||||
* Function HitTest (overlaid)
|
||||
* tests if the given EDA_Rect intersect this object.
|
||||
* @param EDA_Rect : the given EDA_Rect
|
||||
* @return bool - true if a hit, else false
|
||||
*/
|
||||
bool COTATION::HitTest( EDA_Rect& refArea )
|
||||
bool COTATION::HitTest( EDA_Rect& refArea )
|
||||
{
|
||||
if( refArea.Inside( m_Pos ) )
|
||||
return true;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/************************************/
|
||||
/* fonctions de la classe COTATION */
|
||||
/************************************/
|
||||
/*****************************/
|
||||
/* COTATION class definition */
|
||||
/*****************************/
|
||||
#ifndef COTATION_H
|
||||
#define COTATION_H
|
||||
|
||||
@ -13,9 +13,9 @@ public:
|
||||
wxPoint m_Pos;
|
||||
int m_Shape;
|
||||
int m_Unit; /* 0 = inches, 1 = mm */
|
||||
int m_Value; /* valeur en unites PCB de la cote */
|
||||
int m_Value; /* value of PCB dimensions. */
|
||||
|
||||
TEXTE_PCB* m_Text; /* pour affichage du texte */
|
||||
TEXTE_PCB* m_Text;
|
||||
int Barre_ox, Barre_oy, Barre_fx, Barre_fy;
|
||||
int TraitG_ox, TraitG_oy, TraitG_fx, TraitG_fy;
|
||||
int TraitD_ox, TraitD_oy, TraitD_fx, TraitD_fy;
|
||||
@ -54,7 +54,6 @@ public:
|
||||
*/
|
||||
bool Save( FILE* aFile ) const;
|
||||
|
||||
/* Modification du texte de la cotation */
|
||||
void SetText( const wxString& NewText );
|
||||
wxString GetText( void );
|
||||
|
||||
@ -111,7 +110,7 @@ public:
|
||||
bool HitTest( const wxPoint& ref_pos );
|
||||
|
||||
/**
|
||||
* Function HitTest (overlayed)
|
||||
* Function HitTest (overlaid)
|
||||
* tests if the given EDA_Rect intersect this object.
|
||||
* For now, the anchor must be inside this rect.
|
||||
* @param refArea : the given EDA_Rect
|
||||
|
@ -138,40 +138,40 @@ bool DRAWSEGMENT::ReadDrawSegmentDescr( FILE* File, int* LineNum )
|
||||
int status;
|
||||
char* token=0;
|
||||
|
||||
token = strtok(Line," ");
|
||||
token = strtok(Line," ");
|
||||
|
||||
for(int i=0; (token = strtok(NULL," ")) != NULL; i++){
|
||||
switch(i){
|
||||
case 0:
|
||||
sscanf(token,"%d",&m_Layer);
|
||||
break;
|
||||
case 1:
|
||||
sscanf(token,"%d",&m_Type);
|
||||
break;
|
||||
case 2:
|
||||
sscanf(token,"%d",&m_Angle);
|
||||
break;
|
||||
case 3:
|
||||
sscanf(token,"%lX",&m_TimeStamp);
|
||||
break;
|
||||
case 4:
|
||||
sscanf(token,"%X",&status);
|
||||
break;
|
||||
/* Bezier Control Points*/
|
||||
case 5:
|
||||
sscanf(token,"%d",&m_BezierC1.x);
|
||||
break;
|
||||
case 6:
|
||||
sscanf(token,"%d",&m_BezierC1.y);
|
||||
break;
|
||||
case 7:
|
||||
sscanf(token,"%d",&m_BezierC2.x);
|
||||
break;
|
||||
case 8:
|
||||
sscanf(token,"%d",&m_BezierC2.y);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
switch(i){
|
||||
case 0:
|
||||
sscanf(token,"%d",&m_Layer);
|
||||
break;
|
||||
case 1:
|
||||
sscanf(token,"%d",&m_Type);
|
||||
break;
|
||||
case 2:
|
||||
sscanf(token,"%d",&m_Angle);
|
||||
break;
|
||||
case 3:
|
||||
sscanf(token,"%lX",&m_TimeStamp);
|
||||
break;
|
||||
case 4:
|
||||
sscanf(token,"%X",&status);
|
||||
break;
|
||||
/* Bezier Control Points*/
|
||||
case 5:
|
||||
sscanf(token,"%d",&m_BezierC1.x);
|
||||
break;
|
||||
case 6:
|
||||
sscanf(token,"%d",&m_BezierC1.y);
|
||||
break;
|
||||
case 7:
|
||||
sscanf(token,"%d",&m_BezierC2.x);
|
||||
break;
|
||||
case 8:
|
||||
sscanf(token,"%d",&m_BezierC2.y);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -241,13 +241,11 @@ void DRAWSEGMENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||
color = g_DesignSettings.m_LayerColor[GetLayer()];
|
||||
|
||||
GRSetDrawMode( DC, draw_mode );
|
||||
l_piste = m_Width >> 1; /* l_piste = demi largeur piste */
|
||||
l_piste = m_Width >> 1; /* half trace width */
|
||||
|
||||
/* coord de depart */
|
||||
ux0 = m_Start.x;
|
||||
uy0 = m_Start.y;
|
||||
|
||||
/* coord d'arrivee */
|
||||
dx = m_End.x;
|
||||
dy = m_End.y;
|
||||
|
||||
@ -287,7 +285,7 @@ void DRAWSEGMENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||
if( StAngle > EndAngle )
|
||||
EXCHG( StAngle, EndAngle );
|
||||
}
|
||||
else //Mirrored mode: arc orientation is reversed
|
||||
else // Mirrored mode: arc orientation is reversed
|
||||
{
|
||||
if( StAngle < EndAngle )
|
||||
EXCHG( StAngle, EndAngle );
|
||||
@ -317,20 +315,21 @@ void DRAWSEGMENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||
for (unsigned int i=1; i < m_BezierPoints.size(); i++) {
|
||||
if( mode == FILAIRE )
|
||||
GRLine( &panel->m_ClipBox, DC,
|
||||
m_BezierPoints[i].x, m_BezierPoints[i].y,
|
||||
m_BezierPoints[i-1].x, m_BezierPoints[i-1].y, 0, color );
|
||||
m_BezierPoints[i].x, m_BezierPoints[i].y,
|
||||
m_BezierPoints[i-1].x, m_BezierPoints[i-1].y, 0,
|
||||
color );
|
||||
else if( mode == SKETCH )
|
||||
{
|
||||
GRCSegm( &panel->m_ClipBox, DC,
|
||||
m_BezierPoints[i].x, m_BezierPoints[i].y,
|
||||
m_BezierPoints[i-1].x, m_BezierPoints[i-1].y,
|
||||
m_BezierPoints[i].x, m_BezierPoints[i].y,
|
||||
m_BezierPoints[i-1].x, m_BezierPoints[i-1].y,
|
||||
m_Width, color );
|
||||
}
|
||||
else
|
||||
{
|
||||
GRFillCSegm( &panel->m_ClipBox, DC,
|
||||
m_BezierPoints[i].x, m_BezierPoints[i].y,
|
||||
m_BezierPoints[i-1].x, m_BezierPoints[i-1].y,
|
||||
m_BezierPoints[i].x, m_BezierPoints[i].y,
|
||||
m_BezierPoints[i-1].x, m_BezierPoints[i-1].y,
|
||||
m_Width, color );
|
||||
}
|
||||
}
|
||||
@ -418,7 +417,7 @@ bool DRAWSEGMENT::HitTest( const wxPoint& ref_pos )
|
||||
int ux0 = m_Start.x;
|
||||
int uy0 = m_Start.y;
|
||||
|
||||
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
|
||||
/* Calculate coordinates with ux0, uy0 = origin. */
|
||||
int dx = m_End.x - ux0;
|
||||
int dy = m_End.y - uy0;
|
||||
|
||||
@ -439,7 +438,6 @@ bool DRAWSEGMENT::HitTest( const wxPoint& ref_pos )
|
||||
if( m_Shape == S_CIRCLE )
|
||||
return true;
|
||||
|
||||
/* pour un arc, controle complementaire */
|
||||
mouseAngle = (int) ArcTangente( spot_cY, spot_cX );
|
||||
stAngle = (int) ArcTangente( dy, dx );
|
||||
endAngle = stAngle + m_Angle;
|
||||
@ -458,7 +456,8 @@ bool DRAWSEGMENT::HitTest( const wxPoint& ref_pos )
|
||||
case S_CURVE:
|
||||
for( unsigned int i= 1; i < m_BezierPoints.size(); i++)
|
||||
{
|
||||
if( TestSegmentHit( ref_pos,m_BezierPoints[i-1],m_BezierPoints[i-1], m_Width / 2 ) )
|
||||
if( TestSegmentHit( ref_pos,m_BezierPoints[i-1],
|
||||
m_BezierPoints[i-1], m_Width / 2 ) )
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************/
|
||||
/* class_module.cpp : fonctions de la classe MODULE */
|
||||
/* class_module.cpp : EDGE_MODULE class definition. */
|
||||
/****************************************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
@ -14,11 +14,12 @@
|
||||
#include "pcbnew.h"
|
||||
#include "class_board_design_settings.h"
|
||||
|
||||
#define MAX_WIDTH 10000 // Epaisseur (en 1/10000 ") max raisonnable des traits, textes...
|
||||
#define MAX_WIDTH 10000 /* Thickness (in 1 / 10000 ") of maximum reasonable
|
||||
* features, text... */
|
||||
|
||||
/******************************************/
|
||||
/* class EDGE_MODULE ( contour de module ) */
|
||||
/******************************************/
|
||||
/*********************/
|
||||
/* class EDGE_MODULE */
|
||||
/*********************/
|
||||
|
||||
EDGE_MODULE::EDGE_MODULE( MODULE* parent ) :
|
||||
BOARD_ITEM( parent, TYPE_EDGE_MODULE )
|
||||
@ -35,10 +36,7 @@ EDGE_MODULE::~EDGE_MODULE()
|
||||
}
|
||||
|
||||
|
||||
/********************************************/
|
||||
void EDGE_MODULE::Copy( EDGE_MODULE* source )
|
||||
/********************************************/
|
||||
// copy structure
|
||||
{
|
||||
if( source == NULL )
|
||||
return;
|
||||
@ -46,18 +44,17 @@ void EDGE_MODULE::Copy( EDGE_MODULE* source )
|
||||
m_Start = source->m_Start;
|
||||
m_End = source->m_End;
|
||||
m_Shape = source->m_Shape;
|
||||
m_Start0 = source->m_Start0; // coord relatives a l'ancre du point de depart(Orient 0)
|
||||
m_End0 = source->m_End0; // coord relatives a l'ancre du point de fin (Orient 0)
|
||||
m_Angle = source->m_Angle; // pour les arcs de cercle: longueur de l'arc en 0,1 degres
|
||||
m_Start0 = source->m_Start0;
|
||||
m_End0 = source->m_End0;
|
||||
m_Angle = source->m_Angle;
|
||||
m_Layer = source->m_Layer;
|
||||
m_Width = source->m_Width;
|
||||
|
||||
m_PolyPoints = source->m_PolyPoints; // std::vector copy
|
||||
}
|
||||
|
||||
/***********************************/
|
||||
|
||||
void EDGE_MODULE::SetDrawCoord()
|
||||
/***********************************/
|
||||
{
|
||||
MODULE* Module = (MODULE*) m_Parent;
|
||||
|
||||
@ -74,19 +71,16 @@ void EDGE_MODULE::SetDrawCoord()
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************************/
|
||||
/* Draw EDGE_MODULE:
|
||||
* Entry: offset = offset trace
|
||||
* Draw_mode mode = trace (GR_OR, GR_XOR, GR_AND)
|
||||
* The contours are of different types:
|
||||
* - Segment
|
||||
* - Circles
|
||||
* - Arcs
|
||||
*/
|
||||
void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||
int draw_mode, const wxPoint& offset )
|
||||
/********************************************************************************/
|
||||
|
||||
/* Affichage d'un segment contour de module :
|
||||
* Entree : ox, oy = offset de trace
|
||||
* draw_mode = mode de trace ( GR_OR, GR_XOR, GR_AND)
|
||||
* Les contours sont de differents type:
|
||||
* - Segment
|
||||
* - Cercles
|
||||
* - Arcs
|
||||
*/
|
||||
{
|
||||
int ux0, uy0, dx, dy, rayon, StAngle, EndAngle;
|
||||
int color, type_trace;
|
||||
@ -95,7 +89,7 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||
WinEDA_BasePcbFrame* frame;
|
||||
MODULE* Module = NULL;
|
||||
|
||||
if( m_Parent && (m_Parent->Type() == TYPE_MODULE) )
|
||||
if( m_Parent && ( m_Parent->Type() == TYPE_MODULE ) )
|
||||
Module = (MODULE*) m_Parent;
|
||||
|
||||
if( g_DesignSettings.IsLayerVisible( m_Layer ) == false )
|
||||
@ -190,7 +184,7 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||
// We must compute true coordinates from m_PolyPoints
|
||||
// which are relative to module position, orientation 0
|
||||
|
||||
std::vector<wxPoint> points = m_PolyPoints;
|
||||
std::vector<wxPoint> points = m_PolyPoints;
|
||||
|
||||
for( unsigned ii = 0; ii < points.size(); ii++ )
|
||||
{
|
||||
@ -231,15 +225,18 @@ void EDGE_MODULE::DisplayInfo( WinEDA_DrawFrame* frame )
|
||||
|
||||
frame->AppendMsgPanel( _( "Graphic Item" ), wxEmptyString, DARKCYAN );
|
||||
|
||||
frame->AppendMsgPanel( _( "Module" ), module->m_Reference->m_Text, DARKCYAN );
|
||||
frame->AppendMsgPanel( _( "Module" ), module->m_Reference->m_Text,
|
||||
DARKCYAN );
|
||||
frame->AppendMsgPanel( _( "Value" ), module->m_Value->m_Text, BLUE );
|
||||
|
||||
msg.Printf( wxT( "%8.8lX" ), module->m_TimeStamp );
|
||||
frame->AppendMsgPanel( _( "TimeStamp" ), msg, BROWN );
|
||||
|
||||
frame->AppendMsgPanel( _( "Mod Layer" ), board->GetLayerName( module->GetLayer() ), RED );
|
||||
frame->AppendMsgPanel( _( "Mod Layer" ),
|
||||
board->GetLayerName( module->GetLayer() ), RED );
|
||||
|
||||
frame->AppendMsgPanel( _( "Seg Layer" ), board->GetLayerName( GetLayer() ), RED );
|
||||
frame->AppendMsgPanel( _( "Seg Layer" ),
|
||||
board->GetLayerName( GetLayer() ), RED );
|
||||
|
||||
valeur_param( m_Width, msg );
|
||||
frame->AppendMsgPanel( _( "Width" ), msg, BLUE );
|
||||
@ -256,24 +253,24 @@ bool EDGE_MODULE::Save( FILE* aFile ) const
|
||||
{
|
||||
case S_SEGMENT:
|
||||
ret = fprintf( aFile, "DS %d %d %d %d %d %d\n",
|
||||
m_Start0.x, m_Start0.y,
|
||||
m_End0.x, m_End0.y,
|
||||
m_Width, m_Layer );
|
||||
m_Start0.x, m_Start0.y,
|
||||
m_End0.x, m_End0.y,
|
||||
m_Width, m_Layer );
|
||||
break;
|
||||
|
||||
case S_CIRCLE:
|
||||
ret = fprintf( aFile, "DC %d %d %d %d %d %d\n",
|
||||
m_Start0.x, m_Start0.y,
|
||||
m_End0.x, m_End0.y,
|
||||
m_Width, m_Layer );
|
||||
m_Start0.x, m_Start0.y,
|
||||
m_End0.x, m_End0.y,
|
||||
m_Width, m_Layer );
|
||||
break;
|
||||
|
||||
case S_ARC:
|
||||
ret = fprintf( aFile, "DA %d %d %d %d %d %d %d\n",
|
||||
m_Start0.x, m_Start0.y,
|
||||
m_End0.x, m_End0.y,
|
||||
m_Angle,
|
||||
m_Width, m_Layer );
|
||||
m_Start0.x, m_Start0.y,
|
||||
m_End0.x, m_End0.y,
|
||||
m_Angle,
|
||||
m_Width, m_Layer );
|
||||
break;
|
||||
|
||||
case S_POLYGON:
|
||||
@ -284,7 +281,8 @@ bool EDGE_MODULE::Save( FILE* aFile ) const
|
||||
m_Width, m_Layer );
|
||||
|
||||
for( unsigned i=0; i<m_PolyPoints.size(); ++i )
|
||||
fprintf( aFile, "Dl %d %d\n", m_PolyPoints[i].x, m_PolyPoints[i].y );
|
||||
fprintf( aFile, "Dl %d %d\n", m_PolyPoints[i].x,
|
||||
m_PolyPoints[i].y );
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -299,13 +297,6 @@ bool EDGE_MODULE::Save( FILE* aFile ) const
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/****************************************************************/
|
||||
int EDGE_MODULE::ReadDescr( char* Line, FILE* File,
|
||||
int* LineNum )
|
||||
/***************************************************************/
|
||||
|
||||
/* Read a description line like:
|
||||
* DS 2600 0 2600 -600 120 21
|
||||
* this description line is in Line
|
||||
@ -316,6 +307,8 @@ int EDGE_MODULE::ReadDescr( char* Line, FILE* File,
|
||||
* - Polygon
|
||||
*
|
||||
*/
|
||||
int EDGE_MODULE::ReadDescr( char* Line, FILE* File,
|
||||
int* LineNum )
|
||||
{
|
||||
int ii;
|
||||
int error = 0;
|
||||
@ -409,13 +402,13 @@ int EDGE_MODULE::ReadDescr( char* Line, FILE* File,
|
||||
break;
|
||||
}
|
||||
|
||||
// Check for a reasonnable width:
|
||||
// Check for a reasonable width:
|
||||
if( m_Width <= 1 )
|
||||
m_Width = 1;
|
||||
if( m_Width > MAX_WIDTH )
|
||||
m_Width = MAX_WIDTH;
|
||||
|
||||
// Check for a reasonnable layer:
|
||||
// Check for a reasonable layer:
|
||||
// m_Layer must be >= FIRST_NON_COPPER_LAYER, but because microwave footprints
|
||||
// can use the copper layers m_Layer < FIRST_NON_COPPER_LAYER is allowed.
|
||||
// @todo: changes use of EDGE_MODULE these footprints and allows only m_Layer >= FIRST_NON_COPPER_LAYER
|
||||
@ -447,7 +440,6 @@ bool EDGE_MODULE::HitTest( const wxPoint& ref_pos )
|
||||
switch( m_Shape )
|
||||
{
|
||||
case S_SEGMENT:
|
||||
/* recalcul des coordonnees avec ux0,uy0 = origine des coord. */
|
||||
spot_cX = ref_pos.x - ux0;
|
||||
spot_cY = ref_pos.y - uy0;
|
||||
|
||||
@ -459,19 +451,20 @@ bool EDGE_MODULE::HitTest( const wxPoint& ref_pos )
|
||||
|
||||
case S_CIRCLE:
|
||||
rayon = (int) hypot( (double) (uxf - ux0), (double) (uyf - uy0) );
|
||||
dist = (int) hypot( (double) (ref_pos.x - ux0), (double) (ref_pos.y - uy0) );
|
||||
dist = (int) hypot( (double) (ref_pos.x - ux0),
|
||||
(double) (ref_pos.y - uy0) );
|
||||
if( abs( rayon - dist ) <= m_Width )
|
||||
return true;
|
||||
break;
|
||||
|
||||
case S_ARC:
|
||||
rayon = (int) hypot( (double) (uxf - ux0), (double) (uyf - uy0) );
|
||||
dist = (int) hypot( (double) (ref_pos.x - ux0), (double) (ref_pos.y - uy0) );
|
||||
dist = (int) hypot( (double) (ref_pos.x - ux0),
|
||||
(double) (ref_pos.y - uy0) );
|
||||
|
||||
if( abs( rayon - dist ) > m_Width )
|
||||
break;
|
||||
|
||||
/* pour un arc, controle complementaire */
|
||||
int mouseAngle = (int) ArcTangente( ref_pos.y - uy0, ref_pos.x - ux0 );
|
||||
int stAngle = (int) ArcTangente( uyf - uy0, uxf - ux0 );
|
||||
int endAngle = stAngle + m_Angle;
|
||||
@ -494,6 +487,7 @@ bool EDGE_MODULE::HitTest( const wxPoint& ref_pos )
|
||||
|
||||
#if defined(DEBUG)
|
||||
|
||||
|
||||
/**
|
||||
* Function Show
|
||||
* is used to output the object tree, currently for debugging only.
|
||||
|
@ -1,12 +1,10 @@
|
||||
/**************************************************************/
|
||||
/* class_edge_module.h : description des contours d'un module */
|
||||
/**************************************************************/
|
||||
/*******************************************************/
|
||||
/* class_edge_module.h : EDGE_MODULE class definition. */
|
||||
/*******************************************************/
|
||||
|
||||
class Pcb3D_GLCanvas;
|
||||
|
||||
|
||||
/* description des contours (empreintes ) et TYPES des CONTOURS : */
|
||||
|
||||
class EDGE_MODULE : public BOARD_ITEM
|
||||
{
|
||||
public:
|
||||
@ -14,13 +12,13 @@ public:
|
||||
wxPoint m_Start; // Line start point
|
||||
wxPoint m_End; // Line end point
|
||||
|
||||
int m_Shape; // voir "enum Track_Shapes"
|
||||
wxPoint m_Start0; // coord relatives a l'ancre du point de depart(Orient 0)
|
||||
wxPoint m_End0; // coord relatives a l'ancre du point de fin (Orient 0)
|
||||
int m_Shape; // enum Track_Shapes
|
||||
wxPoint m_Start0; // Start point.
|
||||
wxPoint m_End0; // End point.
|
||||
|
||||
int m_Angle; // pour les arcs de cercle: longueur de l'arc en 0,1 degres
|
||||
int m_Angle; // Arcs: angle in 0.1 degrees
|
||||
|
||||
std::vector<wxPoint> m_PolyPoints; // For polygons: number of points (> 2)
|
||||
std::vector<wxPoint> m_PolyPoints; // For polygons: number of points (> 2)
|
||||
// Coord are relative to Origin, orient 0
|
||||
|
||||
public:
|
||||
@ -54,12 +52,11 @@ public:
|
||||
|
||||
int ReadDescr( char* Line, FILE* File, int* LineNum = NULL );
|
||||
|
||||
// Mise a jour des coordon<6F>s pour l'affichage
|
||||
void SetDrawCoord();
|
||||
|
||||
/* drawing functions */
|
||||
void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||
int aDrawMode, const wxPoint& offset = ZeroOffset );
|
||||
int aDrawMode, const wxPoint& offset = ZeroOffset );
|
||||
|
||||
void Draw3D( Pcb3D_GLCanvas* glcanvas );
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************/
|
||||
/* fonctions de la classe MIRE (targets for photos) */
|
||||
/* MIRE class definition (targets for photos) */
|
||||
/****************************************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
@ -27,9 +27,7 @@ MIREPCB::~MIREPCB()
|
||||
}
|
||||
|
||||
|
||||
/**********************************/
|
||||
void MIREPCB::Copy( MIREPCB* source )
|
||||
/**********************************/
|
||||
{
|
||||
m_Layer = source->m_Layer;
|
||||
m_Width = source->m_Width;
|
||||
@ -40,19 +38,16 @@ void MIREPCB::Copy( MIREPCB* source )
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************/
|
||||
bool MIREPCB::ReadMirePcbDescr( FILE* File, int* LineNum )
|
||||
/**************************************************************/
|
||||
|
||||
/* Lecture de la description de 1 segment type Drawing PCB
|
||||
/* Read the description from the PCB file.
|
||||
*/
|
||||
bool MIREPCB::ReadMirePcbDescr( FILE* File, int* LineNum )
|
||||
{
|
||||
char Line[256];
|
||||
|
||||
while( GetLine( File, Line, LineNum ) != NULL )
|
||||
{
|
||||
if( strnicmp( Line, "$End", 4 ) == 0 )
|
||||
return TRUE; /* fin de liste */
|
||||
return TRUE;
|
||||
if( Line[0] == 'P' )
|
||||
{
|
||||
sscanf( Line + 2, " %X %d %d %d %d %d %lX",
|
||||
@ -69,9 +64,8 @@ bool MIREPCB::ReadMirePcbDescr( FILE* File, int* LineNum )
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**************************************/
|
||||
|
||||
bool MIREPCB::Save( FILE* aFile ) const
|
||||
/**************************************/
|
||||
{
|
||||
if( GetState( DELETED ) )
|
||||
return true;
|
||||
@ -98,15 +92,12 @@ out:
|
||||
|
||||
|
||||
|
||||
/**********************************************************/
|
||||
/* Draw MIREPCB object: 2 segments + 1 circle
|
||||
* The circle radius is half the radius of the target
|
||||
* 2 lines have length the diameter of the target
|
||||
*/
|
||||
void MIREPCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||
int mode_color, const wxPoint& offset )
|
||||
/**********************************************************/
|
||||
|
||||
/* Affichage de 1 mire : 2 segments + 1 cercle
|
||||
* le cercle a pour rayon le demi rayon de la mire
|
||||
* les 2 traits ont pour longueur le diametre de la mire
|
||||
*/
|
||||
{
|
||||
int rayon, ox, oy, gcolor, width;
|
||||
int dx1, dx2, dy1, dy2;
|
||||
@ -126,7 +117,6 @@ void MIREPCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||
if( panel->GetScreen()->Scale( width ) < 2 )
|
||||
typeaff = FILAIRE;
|
||||
|
||||
/* Trace du cercle: */
|
||||
rayon = m_Size / 4;
|
||||
|
||||
switch( typeaff )
|
||||
@ -145,15 +135,17 @@ void MIREPCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||
}
|
||||
|
||||
|
||||
/* Trace des 2 traits */
|
||||
rayon = m_Size / 2;
|
||||
dx1 = rayon, dy1 = 0;
|
||||
dx2 = 0, dy2 = rayon;
|
||||
dx1 = rayon;
|
||||
dy1 = 0;
|
||||
dx2 = 0;
|
||||
dy2 = rayon;
|
||||
|
||||
if( m_Shape ) /* Forme X */
|
||||
if( m_Shape ) /* Form X */
|
||||
{
|
||||
dx1 = dy1 = (rayon * 7) / 5;
|
||||
dx2 = dx1; dy2 = -dy1;
|
||||
dx1 = dy1 = ( rayon * 7 ) / 5;
|
||||
dx2 = dx1;
|
||||
dy2 = -dy1;
|
||||
}
|
||||
|
||||
switch( typeaff )
|
||||
@ -189,9 +181,10 @@ bool MIREPCB::HitTest( const wxPoint& refPos )
|
||||
int dX = refPos.x - m_Pos.x;
|
||||
int dY = refPos.y - m_Pos.y;
|
||||
int rayon = m_Size / 2;
|
||||
return abs(dX)<=rayon && abs(dY)<=rayon;
|
||||
return abs( dX ) <= rayon && abs( dY ) <= rayon;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function HitTest (overlayed)
|
||||
* tests if the given EDA_Rect intersect this object.
|
||||
@ -205,6 +198,7 @@ bool MIREPCB::HitTest( EDA_Rect& refArea )
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function Rotate
|
||||
* Rotate this object.
|
||||
@ -216,6 +210,7 @@ void MIREPCB::Rotate(const wxPoint& aRotCentre, int aAngle)
|
||||
RotatePoint( &m_Pos, aRotCentre, aAngle );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function Flip
|
||||
* Flip this object, i.e. change the board side for this object
|
||||
@ -223,7 +218,6 @@ void MIREPCB::Rotate(const wxPoint& aRotCentre, int aAngle)
|
||||
*/
|
||||
void MIREPCB::Flip(const wxPoint& aCentre )
|
||||
{
|
||||
m_Pos.y = aCentre.y - (m_Pos.y - aCentre.y);
|
||||
m_Pos.y = aCentre.y - ( m_Pos.y - aCentre.y );
|
||||
SetLayer( ChangeSideNumLayer( GetLayer() ) );
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user