Commit 4611bfd5 authored by stambaughw's avatar stambaughw

Comment translations.

* Completed translation of all kicad source.
* Translated source files A through C in pcbnew.
parent cb24fb25
...@@ -126,7 +126,7 @@ void WinEDA_MainFrame::OnArchiveFiles( wxCommandEvent& event ) ...@@ -126,7 +126,7 @@ void WinEDA_MainFrame::OnArchiveFiles( wxCommandEvent& event )
wxFileName zip = dlg.GetPath(); wxFileName zip = dlg.GetPath();
/* Liste des extensions des fichiers sauver */ /* List of file extensions to save. */
static const wxChar* extList[] = { static const wxChar* extList[] = {
wxT( "*.sch" ), wxT( "*.lib" ), wxT( "*.cmp" ), wxT( "*.brd" ), wxT( "*.sch" ), wxT( "*.lib" ), wxT( "*.cmp" ), wxT( "*.brd" ),
wxT( "*.net" ), wxT( "*.pro" ), wxT( "*.pho" ), wxT( "*.py" ), wxT( "*.net" ), wxT( "*.pro" ), wxT( "*.pho" ), wxT( "*.py" ),
......
...@@ -28,7 +28,7 @@ class WinEDA_PrjFrame; ...@@ -28,7 +28,7 @@ class WinEDA_PrjFrame;
/** /**
* Command IDs for Kicad. * 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 * file. This will prevent the entire project from being rebuilt when adding
* new commands to Kicad. * new commands to Kicad.
*/ */
...@@ -64,10 +64,6 @@ enum id_kicad_frm ...@@ -64,10 +64,6 @@ enum id_kicad_frm
}; };
/*******************************************/
/* classe pour la Fenetre generale de kicad*/
/*******************************************/
/* class WinEDA_MainFrame /* class WinEDA_MainFrame
* This is the main kicad frame * This is the main kicad frame
*/ */
...@@ -80,7 +76,7 @@ public: ...@@ -80,7 +76,7 @@ public:
WinEDA_PrjFrame* m_LeftWin; WinEDA_PrjFrame* m_LeftWin;
wxSashLayoutWindow* m_BottomWin; wxSashLayoutWindow* m_BottomWin;
wxTextCtrl* m_DialogWin; wxTextCtrl* m_DialogWin;
WinEDA_Toolbar* m_VToolBar; // Verticam Toolbar (not used) WinEDA_Toolbar* m_VToolBar; // Vertical toolbar (not used)
wxString m_BoardFileName; wxString m_BoardFileName;
wxString m_SchematicRootFileName; wxString m_SchematicRootFileName;
wxFileName m_ProjectFileName; wxFileName m_ProjectFileName;
...@@ -90,7 +86,6 @@ public: ...@@ -90,7 +86,6 @@ public:
public: public:
// Constructor and destructor
WinEDA_MainFrame( wxWindow* parent, const wxString& title, WinEDA_MainFrame( wxWindow* parent, const wxString& title,
const wxPoint& pos, const wxSize& size ); const wxPoint& pos, const wxSize& size );
...@@ -207,9 +202,9 @@ private: ...@@ -207,9 +202,9 @@ private:
}; };
/***********************************************************/ /*********************************/
/* Classes pour l'arbre de hierarchie de gestion du projet */ /* Classes for the project tree. */
/***********************************************************/ /*********************************/
/** class TreePrjItemData /** class TreePrjItemData
* Handle one item (a file or a directory name) for the tree file * Handle one item (a file or a directory name) for the tree file
...@@ -414,7 +409,7 @@ public: ...@@ -414,7 +409,7 @@ public:
WinEDA_TreePrj( WinEDA_PrjFrame* parent ); WinEDA_TreePrj( WinEDA_PrjFrame* parent );
~WinEDA_TreePrj(); ~WinEDA_TreePrj();
private: private:
/* overlayed sort function */ /* overridden sort function */
int OnCompareItems( const wxTreeItemId& item1, const wxTreeItemId& item2 ); int OnCompareItems( const wxTreeItemId& item1, const wxTreeItemId& item2 );
}; };
......
/******************************************************************/ /*******************/
/* mdiframe.cpp - fonctions de la classe du type WinEDA_MainFrame */ /* preferences.cpp */
/******************************************************************/ /*******************/
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
static const wxString GeneralGroupName( wxT( "/general" ) ); 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 SchematicRootNameEntry( wxT( "RootSch" ) );
static const wxString BoardFileNameEntry( wxT( "BoardNm" ) ); static const wxString BoardFileNameEntry( wxT( "BoardNm" ) );
...@@ -130,7 +130,6 @@ void WinEDA_MainFrame::OnSaveProject( wxCommandEvent& event ) ...@@ -130,7 +130,6 @@ void WinEDA_MainFrame::OnSaveProject( wxCommandEvent& event )
m_ProjectFileName = dlg.GetPath(); m_ProjectFileName = dlg.GetPath();
/* ecriture de la configuration */
wxGetApp().WriteProjectConfig( m_ProjectFileName.GetFullPath(), wxGetApp().WriteProjectConfig( m_ProjectFileName.GetFullPath(),
GeneralGroupName, NULL ); GeneralGroupName, NULL );
} }
/**********************************************************/ /**********************************************************/
/* prjconfig.h : configuration: definition des structures */ /* prjconfig.h : configuration: definition des structures */
/**********************************************************/ /**********************************************************/
#include "param_config.h" #include "param_config.h"
/* Liste des parametres */
extern PARAM_CFG_BASE* CfgParamList[]; extern PARAM_CFG_BASE* CfgParamList[];
...@@ -22,12 +22,9 @@ ...@@ -22,12 +22,9 @@
#include "wx/dir.h" #include "wx/dir.h"
/********************************************/
/* Methodes pour l'arbre gestion du projet */
/********************************************/
IMPLEMENT_ABSTRACT_CLASS( WinEDA_TreePrj, wxTreeCtrl ) IMPLEMENT_ABSTRACT_CLASS( WinEDA_TreePrj, wxTreeCtrl )
WinEDA_TreePrj::WinEDA_TreePrj( WinEDA_PrjFrame* parent ) : WinEDA_TreePrj::WinEDA_TreePrj( WinEDA_PrjFrame* parent ) :
wxTreeCtrl( parent, ID_PROJECT_TREE, wxTreeCtrl( parent, ID_PROJECT_TREE,
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
...@@ -61,16 +58,13 @@ WinEDA_TreePrj::~WinEDA_TreePrj() ...@@ -61,16 +58,13 @@ WinEDA_TreePrj::~WinEDA_TreePrj()
} }
/***************************************************************************************/
int WinEDA_TreePrj::OnCompareItems( const wxTreeItemId& item1, const wxTreeItemId& item2 )
/***************************************************************************************/
/* sort function for tree items. /* sort function for tree items.
* items are sorted : * items are sorted :
* directory names first by alphabetic order * directory names first by alphabetic order
* root file names after * root file names after
* file names last by alphabetic order * file names last by alphabetic order
*/ */
int WinEDA_TreePrj::OnCompareItems( const wxTreeItemId& item1, const wxTreeItemId& item2 )
{ {
TreePrjItemData* myitem1 = (TreePrjItemData*) GetItemData( item1 ); TreePrjItemData* myitem1 = (TreePrjItemData*) GetItemData( item1 );
TreePrjItemData* myitem2 = (TreePrjItemData*) GetItemData( item2 ); TreePrjItemData* myitem2 = (TreePrjItemData*) GetItemData( item2 );
...@@ -89,11 +83,9 @@ int WinEDA_TreePrj::OnCompareItems( const wxTreeItemId& item1, const wxTreeItemI ...@@ -89,11 +83,9 @@ int WinEDA_TreePrj::OnCompareItems( const wxTreeItemId& item1, const wxTreeItemI
} }
/****************************************************************************************************/
TreePrjItemData::TreePrjItemData( enum TreeFileType type, const wxString& data, TreePrjItemData::TreePrjItemData( enum TreeFileType type, const wxString& data,
wxTreeCtrl* parent ) : wxTreeCtrl* parent ) :
wxTreeItemData() wxTreeItemData()
/****************************************************************************************************/
{ {
m_Type = type; m_Type = type;
m_Parent = parent; m_Parent = parent;
...@@ -105,26 +97,23 @@ TreePrjItemData::TreePrjItemData( enum TreeFileType type, const wxString& data, ...@@ -105,26 +97,23 @@ TreePrjItemData::TreePrjItemData( enum TreeFileType type, const wxString& data,
#ifdef KICAD_PYTHON #ifdef KICAD_PYTHON
using namespace boost::python; using namespace boost::python;
/**************************************/
object TreePrjItemData::GetIdPy() const
/**************************************/
// Convert the data to an id // Convert the data to an id
object TreePrjItemData::GetIdPy() const
{ {
wxTreeItemId* id = new wxTreeItemId(); wxTreeItemId* id = new wxTreeItemId();
*id = GetId(); *id = GetId();
return object( handle<>( borrowed( wxPyConstructObject( id, wxT( "wxTreeItemId" ), true ) ) ) ); return object( handle<>( borrowed( wxPyConstructObject( id,
wxT( "wxTreeItemId" ),
true ) ) ) );
} }
#endif #endif
/*******************************************/
void TreePrjItemData::SetState( int state )
/*******************************************/
// Set the state used in the icon list // Set the state used in the icon list
void TreePrjItemData::SetState( int state )
{ {
wxImageList* imglist = m_Parent->GetImageList(); wxImageList* imglist = m_Parent->GetImageList();
...@@ -137,10 +126,8 @@ void TreePrjItemData::SetState( int state ) ...@@ -137,10 +126,8 @@ void TreePrjItemData::SetState( int state )
} }
/*******************************************/
wxString TreePrjItemData::GetDir() const
/*******************************************/
/* Get the directory containing the file */ /* Get the directory containing the file */
wxString TreePrjItemData::GetDir() const
{ {
if( TREE_DIRECTORY == m_Type ) if( TREE_DIRECTORY == m_Type )
return m_FileName; return m_FileName;
...@@ -161,28 +148,25 @@ wxString TreePrjItemData::GetDir() const ...@@ -161,28 +148,25 @@ wxString TreePrjItemData::GetDir() const
} }
/****************************************************************/
void TreePrjItemData::OnRename( wxTreeEvent& event, bool check )
/****************************************************************/
/* Called upon tree item rename */ /* Called upon tree item rename */
void TreePrjItemData::OnRename( wxTreeEvent& event, bool check )
{ {
//this segfaults on linux (in wxEvtHandler::ProcessEvent), wx version 2.8.7 //this segfaults on linux (in wxEvtHandler::ProcessEvent), wx version 2.8.7
//therefore, until it is fixed, we must cancel the rename. //therefore, until it is fixed, we must cancel the rename.
event.Veto(); event.Veto();
return; return;
if( !Rename( event.GetLabel(), check ) ) if( !Rename( event.GetLabel(), check ) )
event.Veto(); event.Veto();
} }
/****************************************************/
void TreePrjItemData::Move( TreePrjItemData* dest )
/****************************************************/
// Move the object to dest // Move the object to dest
void TreePrjItemData::Move( TreePrjItemData* dest )
{ {
//function not safe. //function not safe.
return; return;
const wxString sep = wxFileName().GetPathSeparator(); const wxString sep = wxFileName().GetPathSeparator();
if( m_Type == TREE_DIRECTORY ) if( m_Type == TREE_DIRECTORY )
...@@ -213,7 +197,8 @@ void TreePrjItemData::Move( TreePrjItemData* dest ) ...@@ -213,7 +197,8 @@ void TreePrjItemData::Move( TreePrjItemData* dest )
return; // Same place ?? return; // Same place ??
// Move the file on the disk: // 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 ) ) if( !wxRenameFile( GetFileName(), destName ) )
#else #else
if( !wxRenameFile( GetFileName(), destName, false ) ) if( !wxRenameFile( GetFileName(), destName, false ) )
...@@ -255,10 +240,8 @@ void TreePrjItemData::Move( TreePrjItemData* dest ) ...@@ -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 */ /* rename the file checking if extension change occurs */
bool TreePrjItemData::Rename( const wxString& name, bool check )
{ {
//this is broken & unsafe to use on linux. //this is broken & unsafe to use on linux.
if( m_Type == TREE_DIRECTORY ) if( m_Type == TREE_DIRECTORY )
...@@ -286,7 +269,8 @@ bool TreePrjItemData::Rename( const wxString& name, bool check ) ...@@ -286,7 +269,8 @@ bool TreePrjItemData::Rename( const wxString& name, bool check )
if( check && !ext.IsEmpty() && !reg.Matches( newFile ) ) if( check && !ext.IsEmpty() && !reg.Matches( newFile ) )
{ {
wxMessageDialog dialog( m_Parent, wxMessageDialog dialog( m_Parent,
_( "Changing file extension will change file type.\n Do you want to continue ?" ), _( "Changing file extension will change file \
type.\n Do you want to continue ?" ),
_( "Rename File" ), _( "Rename File" ),
wxYES_NO | wxICON_QUESTION ); wxYES_NO | wxICON_QUESTION );
...@@ -294,7 +278,8 @@ bool TreePrjItemData::Rename( const wxString& name, bool check ) ...@@ -294,7 +278,8 @@ bool TreePrjItemData::Rename( const wxString& name, bool check )
return false; 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 ) ) if( !wxRenameFile( m_FileName, newFile ) )
#else #else
if( !wxRenameFile( m_FileName, newFile, false ) ) if( !wxRenameFile( m_FileName, newFile, false ) )
...@@ -320,7 +305,8 @@ bool TreePrjItemData::Delete( bool check ) ...@@ -320,7 +305,8 @@ bool TreePrjItemData::Delete( bool check )
/*******************************************/ /*******************************************/
/* delete a file */ /* 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 ); _( "Delete File" ), wxYES_NO | wxICON_QUESTION );
if( !check || wxID_YES == dialog.ShowModal() ) if( !check || wxID_YES == dialog.ShowModal() )
...@@ -352,10 +338,8 @@ bool TreePrjItemData::Delete( bool check ) ...@@ -352,10 +338,8 @@ bool TreePrjItemData::Delete( bool check )
} }
/**********************************/
void TreePrjItemData::Activate( WinEDA_PrjFrame* prjframe )
/**********************************/
/* Called under item activation */ /* Called under item activation */
void TreePrjItemData::Activate( WinEDA_PrjFrame* prjframe )
{ {
wxString sep = wxFileName().GetPathSeparator(); wxString sep = wxFileName().GetPathSeparator();
wxString FullFileName = GetFileName(); wxString FullFileName = GetFileName();
...@@ -390,12 +374,12 @@ void TreePrjItemData::Activate( WinEDA_PrjFrame* prjframe ) ...@@ -390,12 +374,12 @@ void TreePrjItemData::Activate( WinEDA_PrjFrame* prjframe )
if( count == 0 ) if( count == 0 )
{ {
/* The AddFile() text below should match the filter added to handle /* The AddFile() text below should match the filter added to
it in treeprj_frame.cpp in the line looking like this: * handle it in treeprj_frame.cpp in the line looking like this:
m_Filters.push_back( wxT( "^no kicad files found" ) ); * m_Filters.push_back( wxT( "^no kicad files found" ) );
*/ */
prjframe->AddFile( prjframe->AddFile( _( "no kicad files found in this directory" ),
_( "no kicad files found in this directory" ), id ); id );
} }
/* Sort filenames by alphabetic order */ /* Sort filenames by alphabetic order */
...@@ -450,9 +434,7 @@ void TreePrjItemData::Activate( WinEDA_PrjFrame* prjframe ) ...@@ -450,9 +434,7 @@ void TreePrjItemData::Activate( WinEDA_PrjFrame* prjframe )
} }
/***************************************************/
TreePrjItemData* WinEDA_PrjFrame::GetSelectedData() TreePrjItemData* WinEDA_PrjFrame::GetSelectedData()
/***************************************************/
{ {
return dynamic_cast<TreePrjItemData*>( m_TreeProject->GetItemData( m_TreeProject->GetSelection() ) ); return dynamic_cast<TreePrjItemData*>( m_TreeProject->GetItemData( m_TreeProject->GetSelection() ) );
} }
/*************************************/
/* ar-proto.h: Fichier entete pour l'autorouteur */
/*************************************/
/**************/ /**************/
/* AUTOROUT.H */ /* ar-proto.h */
/**************/ /**************/
MODULE ** GenListeModules( BOARD * Pcb, int * NbModules ); MODULE ** GenListeModules( BOARD * Pcb, int * NbModules );
/***************/ /****************/
/* GRAPHPCB.CPP */ /* 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); /* Initialize a value type, the cells included in the board surface of the
/* Initialise a la valeur type, les cellules du Board comprises dans la * pad edge by pt_pad, with the margin reserved for isolation. */
surface du pad pointe par pt_pad, avec la marge reservee pour l'isolement */ void Place_1_Pad_Board( BOARD * Pcb, D_PAD * pt_pad, int type, int marge,
int op_logique );
void TraceSegmentPcb(BOARD * Pcb, TRACK * pt_segm, int type, int marge, int op_logique);
/* trace un Segment de piste sur le BOARD */ /* Draws a segment of track on the board. */
void TraceSegmentPcb( BOARD * Pcb, TRACK * pt_segm, int type, int marge,
void TraceLignePcb( int x0, int y0, int x1, int y1, int layer, int type, int op_logique ); int op_logique );
void TraceFilledRectangle(BOARD * Pcb, int ux0, int uy0, int ux1, int uy1 ,int side, void TraceLignePcb( int x0, int y0, int x1, int y1, int layer, int type,
int color, int op_logique); 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 ) /* Uses the color value of all cells included in the board
a ux1,uy1 ( angle bas a gauche ) (coord PCB) * coord of the rectangle ux0, uy0 (top right corner)
Le rectangle est horizontal ( ou vertical ) * a ux1, uy1 (lower left corner) (coord PCB)
masque_layer = masque des couches; * the rectangle is horizontal (or vertical)
op_logique = WRITE_CELL, WRITE_OR_CELL, WRITE_XOR_CELL, WRITE_AND_CELL * 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);
/* 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 */
/* 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 );
void TraceArc(int ux0,int uy0,int ux1,int uy1, int ArcAngle, int lg,int layer, /* Fills all BOARD cells contained in the arc of "L" angle half-width lg
int color, int op_logique); * ux center, starting in ux y0, y1 is set to color. Coordinates are in
/* Remplit toutes les cellules du BOARD contenues dans l'arc de "longueur" angle * PCB units (0.1 mil) relating to the origin pt_pcb-> Pcb_oX, Y's board.
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. void TraceArc( int ux0,int uy0, int ux1, int uy1, int ArcAngle, int lg,
*/ int layer, int color, int op_logique);
/* SOLVE.CPP */ /* SOLVE.CPP */
/* QUEUE.CPP */ /* QUEUE.CPP */
void FreeQueue(); /* Libere la memoire de la queue de recherche */ void FreeQueue();
void InitQueue(); void InitQueue();
void GetQueue( int *, int *, int *, int *, int * ); void GetQueue( int *, int *, int *, int *, int * );
int SetQueue( int, int, int, int, int, int, int ); int SetQueue( int, int, int, int, int, int, int );
...@@ -68,9 +66,9 @@ int GetApxDist( int, int, int, int ); ...@@ -68,9 +66,9 @@ int GetApxDist( int, int, int, int );
int CalcDist( int, int, int ,int ); int CalcDist( int, int, int ,int );
/* BOARD.CPP */ /* BOARD.CPP */
bool ComputeMatriceSize(WinEDA_BasePcbFrame * frame, int pas_route); bool ComputeMatriceSize( WinEDA_BasePcbFrame * frame, int pas_route );
int Build_Work(BOARD * Pcb); int Build_Work( BOARD * Pcb );
void PlaceCells(BOARD * Pcb, int net_code, int flag = 0); void PlaceCells( BOARD * Pcb, int net_code, int flag = 0 );
BoardCell GetCell( int, int, int ); BoardCell GetCell( int, int, int );
void SetCell( int, int, int, BoardCell ); void SetCell( int, int, int, BoardCell );
...@@ -82,4 +80,3 @@ DistCell GetDist( int, int, int ); ...@@ -82,4 +80,3 @@ DistCell GetDist( int, int, int );
void SetDist( int, int, int, DistCell ); void SetDist( int, int, int, DistCell );
int GetDir( int, int, int ); int GetDir( int, int, int );
void SetDir( int, int, int, int ); void SetDir( int, int, int, int );
/******************************************/ /******************************************/
/* Track editing: attribute flags edition */ /* Track editing: attribute flags editing */
/******************************************/ /******************************************/
#include "fctsys.h" #include "fctsys.h"
...@@ -12,15 +12,12 @@ ...@@ -12,15 +12,12 @@
#include "protos.h" #include "protos.h"
/*****************************************************************************/
void WinEDA_PcbFrame::Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On )
/*****************************************************************************/
/* Attribute change for 1 track segment. /* Attribute change for 1 track segment.
* Attributes are * Attributes are
* SEGM_FIXE protection against global delete * SEGM_FIXE protection against global delete
* SEGM_AR AutoRouted segment * SEGM_AR AutoRouted segment
*/ */
void WinEDA_PcbFrame::Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On )
{ {
if( track == NULL ) if( track == NULL )
return; return;
...@@ -34,10 +31,8 @@ void WinEDA_PcbFrame::Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On ) ...@@ -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 */ /* Attribute change for an entire track */
void WinEDA_PcbFrame::Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On )
{ {
TRACK* Track; TRACK* Track;
int nb_segm; int nb_segm;
...@@ -62,14 +57,11 @@ void WinEDA_PcbFrame::Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On ) ...@@ -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, /* Modify the flag SEGM_FIXE according to Flag_On value,
* for all the segments related to net_code. * for all the segments related to net_code.
* if net_code < 0 all the segments are modified. * 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; TRACK* Track = GetBoard()->m_Track;
......
/****************************************************************/ /****************************************************************/
/* Routines de deplacement automatique et rotation des MODULES */ /* Routines for automatic displacement and rotation of modules. */
/* routines et menu d'autoplacement */
/****************************************************************/ /****************************************************************/
/* Fichier automove.cpp */
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
...@@ -19,8 +16,6 @@ ...@@ -19,8 +16,6 @@
#include "protos.h" #include "protos.h"
/* variables locales */
typedef enum { typedef enum {
FIXE_MODULE, FIXE_MODULE,
FREE_MODULE, FREE_MODULE,
...@@ -29,19 +24,15 @@ typedef enum { ...@@ -29,19 +24,15 @@ typedef enum {
} SelectFixeFct; } SelectFixeFct;
/* Fonctions locales */
static int tri_modules( MODULE** pt_ref, MODULE** pt_compare ); static int tri_modules( MODULE** pt_ref, MODULE** pt_compare );
/* Variables locales */
wxString ModulesMaskSelection = wxT( "*" );
wxString ModulesMaskSelection = wxT( "*" );
/******************************************************/
void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event )
/******************************************************/
/* Called on events (popup menus) relative to automove and autoplace footprints /* Called on events (popup menus) relative to automove and autoplace footprints
*/ */
void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event )
{ {
int id = event.GetId(); int id = event.GetId();
wxPoint pos; wxPoint pos;
...@@ -79,7 +70,7 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event ) ...@@ -79,7 +70,7 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event )
break; break;
} }
/* Erase rastnest if needed */ /* Erase ratsnest if needed */
if( g_Show_Ratsnest ) if( g_Show_Ratsnest )
DrawGeneralRatsnest( &dc ); DrawGeneralRatsnest( &dc );
GetBoard()->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST; GetBoard()->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST;
...@@ -150,7 +141,7 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event ) ...@@ -150,7 +141,7 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_REORIENT_ALL_MODULES: case ID_POPUP_PCB_REORIENT_ALL_MODULES:
OnOrientFootprints( ); OnOrientFootprints();
break; break;
case ID_POPUP_PCB_AUTOROUTE_ALL_MODULES: case ID_POPUP_PCB_AUTOROUTE_ALL_MODULES:
...@@ -187,33 +178,31 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event ) ...@@ -187,33 +178,31 @@ void WinEDA_PcbFrame::AutoPlace( wxCommandEvent& event )
} }
/*****************************************************************************/ /* Routine allocation of components in a rectangular format 4 / 3,
void WinEDA_PcbFrame::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb ) * Starting from the mouse cursor
/*****************************************************************************/ * The components with the FIXED status are not normally dives
* According to the flags:
/* Routine de repartition des composants dans un rectangle de format 4 / 3, * All modules (not fixed) will be left
* partant du curseur souris * Only PCB modules are not left
* 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
*/ */
void WinEDA_PcbFrame::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
{ {
MODULE** pt_Dmod, ** BaseListeModules; MODULE** pt_Dmod, ** BaseListeModules;
MODULE* Module; MODULE* Module;
wxPoint start, current; wxPoint start, current;
int Ymax_size, Xsize_allowed; int Ymax_size, Xsize_allowed;
int pas_grille = (int)GetScreen()->GetGridSize().x; int pas_grille = (int) GetScreen()->GetGridSize().x;
bool EdgeExists; bool EdgeExists;
float surface; float surface;
if( GetBoard()->m_Modules == NULL ) if( GetBoard()->m_Modules == NULL )
{ {
DisplayError( this, _( "No Modules!" ), 10 ); return; DisplayError( this, _( "No modules found!" ) );
return;
} }
/* Confirmation */ /* Confirmation */
if( !IsOK( this, _( "Move Modules ?" ) ) ) if( !IsOK( this, _( "Move modules?" ) ) )
return; return;
EdgeExists = SetBoardBoundaryBoxFromEdgesOnly(); EdgeExists = SetBoardBoundaryBoxFromEdgesOnly();
...@@ -221,13 +210,13 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb ) ...@@ -221,13 +210,13 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
if( PlaceModulesHorsPcb && !EdgeExists ) if( PlaceModulesHorsPcb && !EdgeExists )
{ {
DisplayError( this, DisplayError( this,
_( "Autoplace modules: No board edges detected. Unable to place modules" ), _( "Could not automatically place modules. No board \
20 ); edges detected." ) );
return; return;
} }
Module = GetBoard()->m_Modules; 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->Set_Rectangle_Encadrement();
Module->SetRectangleExinscrit(); Module->SetRectangleExinscrit();
...@@ -235,16 +224,18 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb ) ...@@ -235,16 +224,18 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
BaseListeModules = GenListeModules( GetBoard(), NULL ); BaseListeModules = GenListeModules( GetBoard(), NULL );
/* Si repartition de modules Hors PCB, le curseur est mis au dessous /* If allocation of modules not PCBs, the cursor is placed below
* du PCB, pour eviter de placer des composants dans la zone PCB * PCB, to avoid placing components in PCB area.
*/ */
if( PlaceModulesHorsPcb && EdgeExists ) if( PlaceModulesHorsPcb && EdgeExists )
{ {
if( GetScreen()->m_Curseur.y < (GetBoard()->m_BoundaryBox.GetBottom() + 2000) ) if( GetScreen()->m_Curseur.y <
GetScreen()->m_Curseur.y = GetBoard()->m_BoundaryBox.GetBottom() + 2000; (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; surface = 0.0;
for( pt_Dmod = BaseListeModules; *pt_Dmod != NULL; pt_Dmod++ ) for( pt_Dmod = BaseListeModules; *pt_Dmod != NULL; pt_Dmod++ )
{ {
...@@ -257,7 +248,7 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb ) ...@@ -257,7 +248,7 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
surface += Module->m_Surface; 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; start = current = GetScreen()->m_Curseur;
Ymax_size = 0; Ymax_size = 0;
...@@ -299,15 +290,12 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb ) ...@@ -299,15 +290,12 @@ void WinEDA_PcbFrame::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
} }
/***********************************************************/ /* Update (TRUE or FALSE) FIXED attribute on the module Module
void WinEDA_PcbFrame::FixeModule( MODULE* Module, bool Fixe ) * or all the modules if Module == NULL
/***********************************************************/
/* Met a jour (FALSE ou TRUE) l'attribut FIXE sur le module Module,
* ou sur tous les modules si Modulle == NULL
*/ */
void WinEDA_PcbFrame::FixeModule( MODULE* Module, bool Fixe )
{ {
if( Module ) /* Traitement du module */ if( Module )
{ {
Module->SetLocked( Fixe ); Module->SetLocked( Fixe );
...@@ -319,7 +307,8 @@ void WinEDA_PcbFrame::FixeModule( MODULE* Module, bool Fixe ) ...@@ -319,7 +307,8 @@ void WinEDA_PcbFrame::FixeModule( MODULE* Module, bool Fixe )
Module = GetBoard()->m_Modules; Module = GetBoard()->m_Modules;
for( ; Module != NULL; Module = Module->Next() ) 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 ); Module->SetLocked( Fixe );
GetScreen()->SetModify(); GetScreen()->SetModify();
...@@ -329,29 +318,25 @@ void WinEDA_PcbFrame::FixeModule( MODULE* Module, bool Fixe ) ...@@ -329,29 +318,25 @@ void WinEDA_PcbFrame::FixeModule( MODULE* Module, bool Fixe )
} }
/*********************************************************/ /* Create memory allocation by the ordered list of structures D_MODULES
MODULE** GenListeModules( BOARD* Pcb, int* NbModules ) * Describing the module to move
/*********************************************************/ * The end of the list is indicated by NULL
* Also returns the number of modules per NbModules *
/* Cree par allocation memoire la liste ordonnee des structures D_MODULES * Deallocates memory after use
* 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
*/ */
MODULE** GenListeModules( BOARD* Pcb, int* NbModules )
{ {
MODULE* Module; MODULE* Module;
MODULE** ListeMod, ** PtList; MODULE** ListeMod, ** PtList;
int NbMod; int NbMod;
/* Reservation de la memoire pour description des modules que l'on /* Reserve memory for descriptions of modules that are to be moved. */
* peut deplacer */
Module = Pcb->m_Modules; Module = Pcb->m_Modules;
NbMod = 0; NbMod = 0;
for( ; Module != NULL; Module = Module->Next() ) for( ; Module != NULL; Module = Module->Next() )
NbMod++; NbMod++;
ListeMod = (MODULE**) MyZMalloc( (NbMod + 1) * sizeof(MODULE *) ); ListeMod = (MODULE**) MyZMalloc( (NbMod + 1) * sizeof(MODULE*) );
if( ListeMod == NULL ) if( ListeMod == NULL )
{ {
if( NbModules != NULL ) if( NbModules != NULL )
...@@ -367,9 +352,9 @@ MODULE** GenListeModules( BOARD* Pcb, int* NbModules ) ...@@ -367,9 +352,9 @@ MODULE** GenListeModules( BOARD* Pcb, int* NbModules )
Module->SetRectangleExinscrit(); 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 * *), qsort( ListeMod, NbMod, sizeof(MODULE * *),
( int( * ) ( const void*, const void* ) )tri_modules ); ( int ( * )( const void*, const void* ) )tri_modules );
if( NbModules != NULL ) if( NbModules != NULL )
*NbModules = NbMod; *NbModules = NbMod;
...@@ -377,10 +362,6 @@ MODULE** GenListeModules( BOARD* Pcb, int* NbModules ) ...@@ -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 ) static int tri_modules( MODULE** pt_ref, MODULE** pt_compare )
{ {
float ff; float ff;
......
This diff is collapsed.
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
#include "protos.h" #include "protos.h"
int E_scale; /* facteur d'echelle des tables de distance */ int E_scale; /* Scaling factor of distance tables. */
int Nb_Sides; /* Nombre de couches pour autoroutage (0 ou 1) */ int Nb_Sides; /* Number of layer for autorouting (0 or 1) */
int Nrows = ILLEGAL; int Nrows = ILLEGAL;
int Ncols = ILLEGAL; int Ncols = ILLEGAL;
int Ntotal; int Ntotal;
...@@ -30,10 +30,8 @@ int MaxNodes; /* maximum number of nodes opened at one time */ ...@@ -30,10 +30,8 @@ int MaxNodes; /* maximum number of nodes opened at one time */
BOARDHEAD Board; /* 2-sided board */ BOARDHEAD Board; /* 2-sided board */
/********************************************************/
void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
/********************************************************/
/* init board, route traces*/ /* init board, route traces*/
void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
{ {
int start, stop; int start, stop;
MODULE* Module = NULL; MODULE* Module = NULL;
...@@ -78,7 +76,8 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode ) ...@@ -78,7 +76,8 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
Module = (MODULE*) GetScreen()->GetCurItem(); Module = (MODULE*) GetScreen()->GetCurItem();
if( (Module == NULL) || (Module->Type() != TYPE_MODULE) ) if( (Module == NULL) || (Module->Type() != TYPE_MODULE) )
{ {
DisplayError( this, _( "Module not selected" ) ); return; DisplayError( this, _( "Module not selected" ) );
return;
} }
break; break;
...@@ -86,7 +85,8 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode ) ...@@ -86,7 +85,8 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
Pad = (D_PAD*) GetScreen()->GetCurItem(); Pad = (D_PAD*) GetScreen()->GetCurItem();
if( (Pad == NULL) || (Pad->Type() != TYPE_PAD) ) if( (Pad == NULL) || (Pad->Type() != TYPE_PAD) )
{ {
DisplayError( this, _( "Pad not selected" ) ); return; DisplayError( this, _( "Pad not selected" ) );
return;
} }
break; break;
} }
...@@ -94,7 +94,7 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode ) ...@@ -94,7 +94,7 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
if( (GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK ) == 0 ) if( (GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK ) == 0 )
Compile_Ratsnest( DC, TRUE ); 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++ ) for( unsigned ii = 0; ii < GetBoard()->GetRatsnestsCount(); ii++ )
{ {
RATSNEST_ITEM* ptmp = &GetBoard()->m_FullRatsnest[ii]; RATSNEST_ITEM* ptmp = &GetBoard()->m_FullRatsnest[ii];
...@@ -103,7 +103,8 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode ) ...@@ -103,7 +103,8 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
switch( mode ) switch( mode )
{ {
case ROUTE_ALL: case ROUTE_ALL:
ptmp->m_Status |= CH_ROUTE_REQ; break; ptmp->m_Status |= CH_ROUTE_REQ;
break;
case ROUTE_NET: case ROUTE_NET:
if( autoroute_net_code == ptmp->GetNet() ) if( autoroute_net_code == ptmp->GetNet() )
...@@ -125,7 +126,7 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode ) ...@@ -125,7 +126,7 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
} }
case ROUTE_PAD: 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; ptmp->m_Status |= CH_ROUTE_REQ;
break; break;
} }
...@@ -133,19 +134,19 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode ) ...@@ -133,19 +134,19 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
start = time( NULL ); 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; g_GridRoutingSize = (int)GetScreen()->GetGridSize().x;
if( g_GridRoutingSize < 50 ) if( g_GridRoutingSize < 50 )
g_GridRoutingSize = 50; g_GridRoutingSize = 50;
E_scale = g_GridRoutingSize / 50; if( E_scale < 1 ) E_scale = g_GridRoutingSize / 50; if( E_scale < 1 )
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 ); ComputeMatriceSize( this, g_GridRoutingSize );
MsgPanel->EraseMsgBox(); MsgPanel->EraseMsgBox();
/* Creation du mapping du board */ /* Map the board */
Nb_Sides = ONE_SIDE; Nb_Sides = ONE_SIDE;
if( Route_Layer_TOP != Route_Layer_BOTTOM ) if( Route_Layer_TOP != Route_Layer_BOTTOM )
Nb_Sides = TWO_SIDES; Nb_Sides = TWO_SIDES;
...@@ -153,14 +154,14 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode ) ...@@ -153,14 +154,14 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
if( Board.InitBoard() < 0 ) if( Board.InitBoard() < 0 )
{ {
DisplayError( this, _( "No memory for autorouting" ) ); DisplayError( this, _( "No memory for autorouting" ) );
Board.UnInitBoard(); /* Libere la memoire BitMap */ Board.UnInitBoard(); /* Free memory. */
return; return;
} }
Affiche_Message( _( "Place Cells" ) ); Affiche_Message( _( "Place Cells" ) );
PlaceCells( GetBoard(), -1, FORCE_PADS ); PlaceCells( GetBoard(), -1, FORCE_PADS );
/* Construction de la liste des pistes a router */ /* Construction of the track list for router. */
Build_Work( GetBoard() ); Build_Work( GetBoard() );
// DisplayBoard(DrawPanel, DC); // DisplayBoard(DrawPanel, DC);
...@@ -170,26 +171,24 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode ) ...@@ -170,26 +171,24 @@ void WinEDA_PcbFrame::Autoroute( wxDC* DC, int mode )
else else
Solve( DC, ONE_SIDE ); /* simple face */ Solve( DC, ONE_SIDE ); /* simple face */
/* Liberation de la memoire */ /* Free memory. */
FreeQueue(); /* Libere la memoire de routage */ FreeQueue();
InitWork(); /* Libere la memoire de la liste des connexions a router */ InitWork(); /* Free memory for the list of router connections. */
Board.UnInitBoard(); /* Libere la memoire BitMap */ Board.UnInitBoard();
stop = time( NULL ) - start; 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 ); Affiche_Message( msg );
} }
/************************************************/ /* Clear the flag has CH_NOROUTABLE which is set to 1 by Solve()
void WinEDA_PcbFrame::Reset_Noroutable( wxDC* DC ) * When a ratsnets has not been routed.
/*************************************************/ * If this flag is 1 it is not reroute
/* 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
*/ */
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 ); Compile_Ratsnest( DC, TRUE );
for( unsigned ii = 0; ii < GetBoard()->GetRatsnestsCount(); ii++ ) for( unsigned ii = 0; ii < GetBoard()->GetRatsnestsCount(); ii++ )
...@@ -199,17 +198,15 @@ void WinEDA_PcbFrame::Reset_Noroutable( wxDC* DC ) ...@@ -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 ) void DisplayBoard( WinEDA_DrawPanel* panel, wxDC* DC )
/****************************************************/
/* Fonction de DEBUG : affiche le remplissage des cellules TOP et BOTTOM */
{ {
int row, col, i, j; int row, col, i, j;
int dcell0, dcell1 = 0, color; int dcell0, dcell1 = 0, color;
int maxi; int maxi;
maxi = 600 / Ncols; maxi = 600 / Ncols;
maxi = (maxi * 3 ) / 4; maxi = ( maxi * 3 ) / 4;
if( !maxi ) if( !maxi )
maxi = 1; maxi = 1;
...@@ -227,7 +224,7 @@ void DisplayBoard( WinEDA_DrawPanel* panel, wxDC* DC ) ...@@ -227,7 +224,7 @@ void DisplayBoard( WinEDA_DrawPanel* panel, wxDC* DC )
if( dcell1 & HOLE ) if( dcell1 & HOLE )
color |= RED; color |= RED;
// dcell0 |= dcell1; // dcell0 |= dcell1;
if( !color && (dcell0 & VIA_IMPOSSIBLE) ) if( !color && ( dcell0 & VIA_IMPOSSIBLE ) )
color = BLUE; color = BLUE;
if( dcell0 & CELL_is_EDGE ) if( dcell0 & CELL_is_EDGE )
color = YELLOW; color = YELLOW;
...@@ -241,8 +238,8 @@ void DisplayBoard( WinEDA_DrawPanel* panel, wxDC* DC ) ...@@ -241,8 +238,8 @@ void DisplayBoard( WinEDA_DrawPanel* panel, wxDC* DC )
for( i = 0; i < maxi; i++ ) for( i = 0; i < maxi; i++ )
for( j = 0; j < maxi; j++ ) for( j = 0; j < maxi; j++ )
GRSPutPixel( &panel->m_ClipBox, DC, GRSPutPixel( &panel->m_ClipBox, DC,
(col * maxi) + i + DRAW_OFFSET_X, ( col * maxi ) + i + DRAW_OFFSET_X,
(row * maxi) + j + DRAW_OFFSET_Y, color ); ( row * maxi ) + j + DRAW_OFFSET_Y, color );
} }
} }
......
/****************************************************/ /****************************************************/
/* AUTOROUT.H */ /* AUTOROUT.H */
/* declarations communes relative au routage */
/* et placement automatique des composants */
/****************************************************/ /****************************************************/
#ifndef AUTOROUT_H #ifndef AUTOROUT_H
...@@ -14,11 +12,7 @@ ...@@ -14,11 +12,7 @@
#define ILLEGAL -1 #define ILLEGAL -1
/***********************************************/ /* Autorouter commands. */
/* description d'un segment de chevelu general */
/***********************************************/
/* Commandes d'autoplacement / autorouage possibles */
enum CommandOpt { enum CommandOpt {
PLACE_ALL, PLACE_ALL,
PLACE_OUT_OF_BOARD, PLACE_OUT_OF_BOARD,
...@@ -32,17 +26,14 @@ enum CommandOpt { ...@@ -32,17 +26,14 @@ enum CommandOpt {
}; };
/* Variables et structures d'autoroutage */ extern int E_scale; /* Scaling factor of distance tables. */
extern int E_scale; /* facteur d'echelle des tables de distance */
#define ONE_SIDE 0 #define ONE_SIDE 0
#define TWO_SIDES 1 #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 /* Force placement of pads for any Netcode */
#define FORCE_PADS 1 /* pour forcage placement pads quel que soit le netcode */
/* board dimensions */ /* board dimensions */
extern int Nrows; extern int Nrows;
...@@ -55,8 +46,7 @@ extern int ClosNodes; /* total number of nodes closed */ ...@@ -55,8 +46,7 @@ extern int ClosNodes; /* total number of nodes closed */
extern int MoveNodes; /* total number of nodes moved */ extern int MoveNodes; /* total number of nodes moved */
extern int MaxNodes; /* maximum number of nodes opened at one time */ 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 char BoardCell;
typedef int DistCell; typedef int DistCell;
...@@ -65,8 +55,10 @@ class BOARDHEAD /* header of blocks of BoardCell */ ...@@ -65,8 +55,10 @@ class BOARDHEAD /* header of blocks of BoardCell */
{ {
public: public:
BoardCell* m_BoardSide[2]; /* ptr to block of memory: 2-sided board */ 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 */ DistCell* m_DistSide[2]; /* ptr to block of memory: path distance to
char* m_DirSide[2]; /* header of blocks of chars:pointers back to source */ * cells */
char* m_DirSide[2]; /* header of blocks of chars:pointers back to
* source */
bool m_InitBoardDone; bool m_InitBoardDone;
int m_Layers; int m_Layers;
int m_Nrows, m_Ncols; int m_Nrows, m_Ncols;
...@@ -82,7 +74,7 @@ public: ...@@ -82,7 +74,7 @@ public:
extern BOARDHEAD Board; /* 2-sided board */ 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_CELL 0
#define WRITE_OR_CELL 1 #define WRITE_OR_CELL 1
#define WRITE_XOR_CELL 2 #define WRITE_XOR_CELL 2
......
/************************************************************************/ /********************/
/* basepcbframe.cpp - fonctions des classes du type WinEDA_BasePcbFrame */ /* basepcbframe.cpp */
/************************************************************************/ /********************/
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
...@@ -44,10 +44,6 @@ BEGIN_EVENT_TABLE( WinEDA_BasePcbFrame, WinEDA_DrawFrame ) ...@@ -44,10 +44,6 @@ BEGIN_EVENT_TABLE( WinEDA_BasePcbFrame, WinEDA_DrawFrame )
END_EVENT_TABLE() END_EVENT_TABLE()
/****************/
/* Constructeur */
/****************/
WinEDA_BasePcbFrame::WinEDA_BasePcbFrame( wxWindow* father, WinEDA_BasePcbFrame::WinEDA_BasePcbFrame( wxWindow* father,
int idtype, int idtype,
const wxString& title, const wxString& title,
...@@ -95,12 +91,10 @@ void WinEDA_BasePcbFrame::SetBoard( BOARD* aBoard ) ...@@ -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 * 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 dx, dy, ii, jj;
int bestzoom; int bestzoom;
...@@ -124,9 +118,7 @@ int WinEDA_BasePcbFrame::BestZoom( void ) ...@@ -124,9 +118,7 @@ int WinEDA_BasePcbFrame::BestZoom( void )
} }
/***********************************************************/
void WinEDA_BasePcbFrame::CursorGoto( const wxPoint& aPos ) void WinEDA_BasePcbFrame::CursorGoto( const wxPoint& aPos )
/***********************************************************/
{ {
// factored out of pcbnew/find.cpp // factored out of pcbnew/find.cpp
...@@ -134,7 +126,7 @@ void WinEDA_BasePcbFrame::CursorGoto( const wxPoint& aPos ) ...@@ -134,7 +126,7 @@ void WinEDA_BasePcbFrame::CursorGoto( const wxPoint& aPos )
wxClientDC dc( DrawPanel ); 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 ) ) if( !DrawPanel->IsPointOnDisplay( aPos ) )
{ {
screen->m_Curseur = aPos; screen->m_Curseur = aPos;
...@@ -151,27 +143,21 @@ void WinEDA_BasePcbFrame::CursorGoto( const wxPoint& aPos ) ...@@ -151,27 +143,21 @@ void WinEDA_BasePcbFrame::CursorGoto( const wxPoint& aPos )
} }
/*************************************************/
void WinEDA_BasePcbFrame::ReCreateMenuBar( void )
/*************************************************/
// Virtual function // 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::Show3D_Frame( wxCommandEvent& event )
{ {
} }
/****************************************************************/
void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer )
/*****************************************************************/
// Note: virtual, overridden in WinEDA_PcbFrame; // Note: virtual, overridden in WinEDA_PcbFrame;
void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer )
{ {
int preslayer = ((PCB_SCREEN*)GetScreen())->m_Active_Layer; int preslayer = ((PCB_SCREEN*)GetScreen())->m_Active_Layer;
...@@ -200,8 +186,8 @@ void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer ) ...@@ -200,8 +186,8 @@ void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer )
// layers are also capable of being selected. // layers are also capable of being selected.
else else
{ {
if( (layer != COPPER_LAYER_N) && (layer != LAYER_CMP_N) if( ( layer != COPPER_LAYER_N ) && ( layer != LAYER_CMP_N )
&& (layer >= m_Pcb->m_BoardSettings->GetCopperLayerCount() - 1) ) && ( layer >= m_Pcb->m_BoardSettings->GetCopperLayerCount() - 1 ) )
{ {
return; return;
} }
...@@ -244,9 +230,7 @@ void WinEDA_BasePcbFrame::ProcessItemSelection( wxCommandEvent& event ) ...@@ -244,9 +230,7 @@ void WinEDA_BasePcbFrame::ProcessItemSelection( wxCommandEvent& event )
} }
/*****************************************************************/
void WinEDA_BasePcbFrame::SetCurItem( BOARD_ITEM* aItem, bool aDisplayInfo ) void WinEDA_BasePcbFrame::SetCurItem( BOARD_ITEM* aItem, bool aDisplayInfo )
/*****************************************************************/
{ {
GetScreen()->SetCurItem( aItem ); GetScreen()->SetCurItem( aItem );
...@@ -275,20 +259,16 @@ void WinEDA_BasePcbFrame::SetCurItem( BOARD_ITEM* aItem, bool aDisplayInfo ) ...@@ -275,20 +259,16 @@ void WinEDA_BasePcbFrame::SetCurItem( BOARD_ITEM* aItem, bool aDisplayInfo )
} }
/*****************************************************************/
BOARD_ITEM* WinEDA_BasePcbFrame::GetCurItem() BOARD_ITEM* WinEDA_BasePcbFrame::GetCurItem()
/*****************************************************************/
{ {
return GetScreen()->GetCurItem(); return GetScreen()->GetCurItem();
} }
/****************************************************************/
GENERAL_COLLECTORS_GUIDE WinEDA_BasePcbFrame::GetCollectorsGuide() GENERAL_COLLECTORS_GUIDE WinEDA_BasePcbFrame::GetCollectorsGuide()
/****************************************************************/
{ {
GENERAL_COLLECTORS_GUIDE guide( m_Pcb->m_BoardSettings->GetVisibleLayers(), 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 // account for the globals
guide.SetIgnoreMTextsMarkedNoShow( ! g_DesignSettings.IsElementVisible( MODULE_TEXT_NOV_VISIBLE )); guide.SetIgnoreMTextsMarkedNoShow( ! g_DesignSettings.IsElementVisible( MODULE_TEXT_NOV_VISIBLE ));
...@@ -324,10 +304,11 @@ void WinEDA_BasePcbFrame::SetToolID( int id, int new_cursor_id, ...@@ -324,10 +304,11 @@ void WinEDA_BasePcbFrame::SetToolID( int id, int new_cursor_id,
DrawPanel->Refresh(); DrawPanel->Refresh();
} }
void WinEDA_BasePcbFrame::UpdateStatusBar()
/* /*
* Update the status bar information. * Update the status bar information.
*/ */
void WinEDA_BasePcbFrame::UpdateStatusBar()
{ {
WinEDA_DrawFrame::UpdateStatusBar(); WinEDA_DrawFrame::UpdateStatusBar();
...@@ -351,7 +332,8 @@ void WinEDA_BasePcbFrame::UpdateStatusBar() ...@@ -351,7 +332,8 @@ void WinEDA_BasePcbFrame::UpdateStatusBar()
theta = theta * 180.0 / M_PI; theta = theta * 180.0 / M_PI;
ro = sqrt( ( (double) dx * dx ) + ( (double) dy * dy ) ); 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 ), To_User_Unit( g_UnitMetric, ro, m_InternalUnits ),
theta ); theta );
...@@ -381,21 +363,24 @@ void WinEDA_BasePcbFrame::LoadSettings() ...@@ -381,21 +363,24 @@ void WinEDA_BasePcbFrame::LoadSettings()
wxConfig* cfg = wxGetApp().m_EDA_Config; wxConfig* cfg = wxGetApp().m_EDA_Config;
WinEDA_DrawFrame::LoadSettings(); WinEDA_DrawFrame::LoadSettings();
// Ensure grid id is an existant grid id: // Ensure grid id is an existent grid id:
if( (m_LastGridSizeId <= 0) || if( (m_LastGridSizeId <= 0) ||
(m_LastGridSizeId > (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000)) ) (m_LastGridSizeId > (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000)) )
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_500 - 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 + UserGridSizeXEntry, &m_UserGridSize.x, 0.01 );
cfg->Read( m_FrameName + UserGridSizeYEntry, &m_UserGridSize.y, 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 + DisplayPadFillEntry, &m_DisplayPadFill, true );
cfg->Read( m_FrameName + DisplayViaFillEntry, &m_DisplayViaFill, true ); cfg->Read( m_FrameName + DisplayViaFillEntry, &m_DisplayViaFill, true );
cfg->Read( m_FrameName + DisplayPadNumberEntry, &m_DisplayPadNum, 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 ) if( m_DisplayModEdge < FILAIRE || m_DisplayModEdge > SKETCH )
m_DisplayModEdge = FILLED; 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 ) if( m_DisplayModText < FILAIRE || m_DisplayModText > SKETCH )
m_DisplayModText = FILLED; m_DisplayModText = FILLED;
} }
......
This diff is collapsed.
...@@ -23,11 +23,7 @@ ...@@ -23,11 +23,7 @@
#define BLOCK_COLOR BROWN #define BLOCK_COLOR BROWN
#define IS_SELECTED 1 #define IS_SELECTED 1
/* Variables Locales */
/* Fonctions exportees */
/* Fonctions Locales */
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel,
wxDC* DC, wxDC* DC,
bool erase ); bool erase );
...@@ -42,14 +38,11 @@ static void RotateMarkedItems( MODULE* module, wxPoint offset ); ...@@ -42,14 +38,11 @@ static void RotateMarkedItems( MODULE* module, wxPoint offset );
static void DeleteMarkedItems( MODULE* module ); static void DeleteMarkedItems( MODULE* module );
/*************************************************************************/
int WinEDA_ModuleEditFrame::ReturnBlockCommand( int key )
/*************************************************************************/
/* Return the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to /* Return the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to
* the key (ALT, SHIFT ALT ..) pressed when dragging mouse and left or middle button * the key (ALT, SHIFT ALT ..) pressed when dragging mouse and left or
* pressed * middle button pressed
*/ */
int WinEDA_ModuleEditFrame::ReturnBlockCommand( int key )
{ {
int cmd; int cmd;
...@@ -92,15 +85,13 @@ int WinEDA_ModuleEditFrame::ReturnBlockCommand( int key ) ...@@ -92,15 +85,13 @@ int WinEDA_ModuleEditFrame::ReturnBlockCommand( int key )
} }
/****************************************************/
int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
/****************************************************/
/* Command BLOCK END (end of block sizing) /* Command BLOCK END (end of block sizing)
* return : * return :
* 0 if command finished (zoom, delete ...) * 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; int ItemsCount = 0, MustDoPlace = 0;
MODULE* Currentmodule = GetBoard()->m_Modules; MODULE* Currentmodule = GetBoard()->m_Modules;
...@@ -128,7 +119,8 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC ) ...@@ -128,7 +119,8 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
case BLOCK_DRAG: /* Drag */ case BLOCK_DRAG: /* Drag */
case BLOCK_MOVE: /* Move */ case BLOCK_MOVE: /* Move */
case BLOCK_COPY: /* Copy */ case BLOCK_COPY: /* Copy */
ItemsCount = MarkItemsInBloc( Currentmodule, GetScreen()->m_BlockLocate ); ItemsCount = MarkItemsInBloc( Currentmodule,
GetScreen()->m_BlockLocate );
if( ItemsCount ) if( ItemsCount )
{ {
MustDoPlace = 1; MustDoPlace = 1;
...@@ -200,7 +192,8 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC ) ...@@ -200,7 +192,8 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
SetCurItem( NULL ); SetCurItem( NULL );
SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor, wxEmptyString ); SetToolID( m_ID_current_state, DrawPanel->m_PanelDefaultCursor,
wxEmptyString );
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
} }
...@@ -213,10 +206,10 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC ) ...@@ -213,10 +206,10 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
void WinEDA_ModuleEditFrame::HandleBlockPlace( 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: * Last routine for block operation for:
* - block move & drag * - block move & drag
* - block copie & paste * - block copy & paste
*/ */
{ {
bool err = FALSE; bool err = FALSE;
...@@ -251,7 +244,7 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC ) ...@@ -251,7 +244,7 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
CopyMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.m_MoveVector ); CopyMarkedItems( Currentmodule, GetScreen()->m_BlockLocate.m_MoveVector );
break; break;
case BLOCK_PASTE: /* Paste (recopie du dernier bloc sauve */ case BLOCK_PASTE: /* Paste */
GetScreen()->m_BlockLocate.ClearItemsList(); GetScreen()->m_BlockLocate.ClearItemsList();
break; break;
...@@ -291,14 +284,11 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC ) ...@@ -291,14 +284,11 @@ 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, static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
bool erase ) 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(); BASE_SCREEN* screen = panel->GetScreen();
...@@ -310,10 +300,10 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -310,10 +300,10 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
PtBlock = &screen->m_BlockLocate; PtBlock = &screen->m_BlockLocate;
GRSetDrawMode( DC, g_XorMode ); GRSetDrawMode( DC, g_XorMode );
/* Effacement ancien cadre */
if( erase ) 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 ) if( Currentmodule )
{ {
...@@ -347,10 +337,12 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -347,10 +337,12 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
} }
} }
/* Redessin nouvel affichage */ /* Repaint new view. */
PtBlock->m_MoveVector = screen->m_Curseur - PtBlock->m_BlockLastCursorPosition; 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 ) if( Currentmodule )
...@@ -385,12 +377,9 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -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 /* Copy marked items, at new position = old position + offset
*/ */
void CopyMarkedItems( MODULE* module, wxPoint offset )
{ {
if( module == NULL ) if( module == NULL )
return; return;
...@@ -432,8 +421,7 @@ void CopyMarkedItems( MODULE* module, wxPoint offset ) ...@@ -432,8 +421,7 @@ void CopyMarkedItems( MODULE* module, wxPoint offset )
break; break;
default: default:
DisplayError( NULL, DisplayError( NULL, wxT( "CopyMarkedItems: type undefined" ) );
wxT( "Internal Err: CopyMarkedItems: type indefini" ) );
break; break;
} }
} }
...@@ -442,12 +430,9 @@ void CopyMarkedItems( MODULE* module, wxPoint offset ) ...@@ -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 /* Move marked items, at new position = old position + offset
*/ */
void MoveMarkedItems( MODULE* module, wxPoint offset )
{ {
EDA_BaseStruct* item; EDA_BaseStruct* item;
...@@ -493,12 +478,9 @@ void MoveMarkedItems( MODULE* module, wxPoint offset ) ...@@ -493,12 +478,9 @@ void MoveMarkedItems( MODULE* module, wxPoint offset )
} }
/******************************************************/
void DeleteMarkedItems( MODULE* module )
/******************************************************/
/* Delete marked items /* Delete marked items
*/ */
void DeleteMarkedItems( MODULE* module )
{ {
BOARD_ITEM* item; BOARD_ITEM* item;
BOARD_ITEM* next_item; BOARD_ITEM* next_item;
...@@ -528,12 +510,9 @@ void DeleteMarkedItems( MODULE* module ) ...@@ -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 /* 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; #define SETMIRROR( z ) (z) -= offset.x; (z) = -(z); (z) += offset.x;
EDA_BaseStruct* item; EDA_BaseStruct* item;
...@@ -588,12 +567,9 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset ) ...@@ -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 /* Rotate marked items, refer to a Vertical axis at position offset
*/ */
void RotateMarkedItems( MODULE* module, wxPoint offset )
{ {
#define ROTATE( z ) RotatePoint( (&z), offset, 900 ) #define ROTATE( z ) RotatePoint( (&z), offset, 900 )
EDA_BaseStruct* item; EDA_BaseStruct* item;
...@@ -644,9 +620,7 @@ void RotateMarkedItems( MODULE* module, wxPoint offset ) ...@@ -644,9 +620,7 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
} }
/*********************************************************/
void ClearMarkItems( MODULE* module ) void ClearMarkItems( MODULE* module )
/*********************************************************/
{ {
EDA_BaseStruct* item; EDA_BaseStruct* item;
...@@ -663,13 +637,10 @@ void ClearMarkItems( MODULE* module ) ...@@ -663,13 +637,10 @@ void ClearMarkItems( MODULE* module )
} }
/***************************************************************/
int MarkItemsInBloc( MODULE* module, EDA_Rect& Rect )
/***************************************************************/
/* Mark items inside rect. /* Mark items inside rect.
* Items are inside rect when an end point is inside rect * Items are inside rect when an end point is inside rect
*/ */
int MarkItemsInBloc( MODULE* module, EDA_Rect& Rect )
{ {
EDA_BaseStruct* item; EDA_BaseStruct* item;
int ItemsCount = 0; int ItemsCount = 0;
......
/* Fichier BOARD.CPP : functions for autorouting */ /* BOARD.CPP : functions for autorouting */
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
...@@ -11,9 +11,7 @@ ...@@ -11,9 +11,7 @@
#include "protos.h" #include "protos.h"
/* routines externes : */
/* Routines definies ici: */
int Build_Work( BOARD* Pcb ); int Build_Work( BOARD* Pcb );
void PlaceCells( BOARD* Pcb, int net_code, int flag ); void PlaceCells( BOARD* Pcb, int net_code, int flag );
int InitBoard(); int InitBoard();
...@@ -29,14 +27,12 @@ void SetDist( int, int, int, DistCell ); ...@@ -29,14 +27,12 @@ void SetDist( int, int, int, DistCell );
int GetDir( int, int, int ); int GetDir( int, int, int );
void SetDir( int, 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 * Calculates nrows and ncols, dimensions of the matrix representation of BOARD
* pour les routages automatiques et calculs de zone * for routing and automatic calculation of area.
*/ */
bool ComputeMatriceSize( WinEDA_BasePcbFrame* frame, int g_GridRoutingSize )
{ {
BOARD* pcb = frame->GetBoard(); BOARD* pcb = frame->GetBoard();
...@@ -81,13 +77,10 @@ BOARDHEAD::~BOARDHEAD() ...@@ -81,13 +77,10 @@ BOARDHEAD::~BOARDHEAD()
} }
/******************************/
int BOARDHEAD::InitBoard()
/*****************************/
/* initialize the data structures /* 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; int ii, kk;
...@@ -128,10 +121,7 @@ int BOARDHEAD::InitBoard() ...@@ -128,10 +121,7 @@ int BOARDHEAD::InitBoard()
} }
/*********************************/
void BOARDHEAD::UnInitBoard() void BOARDHEAD::UnInitBoard()
/*********************************/
/* deallocation de la memoire */
{ {
int ii; int ii;
...@@ -162,21 +152,17 @@ void BOARDHEAD::UnInitBoard() ...@@ -162,21 +152,17 @@ void BOARDHEAD::UnInitBoard()
} }
/*****************************************************/ /* Initialize the cell board is set and VIA_IMPOSSIBLE HOLE according to
void PlaceCells( BOARD* aPcb, int net_code, int flag ) * the setbacks
/*****************************************************/ * The elements of net_code = net_code will not be occupied as places
* but only VIA_IMPOSSIBLE
/* Initialise les cellules du board a la valeur HOLE et VIA_IMPOSSIBLE * For single-sided Routing 1:
* selon les marges d'isolement * BOTTOM side is used and Route_Layer_BOTTOM = Route_Layer_TOP
* 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
* *
* Selon les bits = 1 du parametre flag: * According to the bits = 1 parameter flag:
* si FORCE_PADS : tous les pads seront places meme ceux de meme net_code * 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 ux0 = 0, uy0 = 0, ux1, uy1, dx, dy;
int marge, via_marge; int marge, via_marge;
...@@ -192,9 +178,9 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag ) ...@@ -192,9 +178,9 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
marge = clearance + (trackWidth / 2); marge = clearance + (trackWidth / 2);
via_marge = clearance + (viaSize / 2); via_marge = clearance + (viaSize / 2);
///////////////////////////////////// //////////////////////////
// Placement des PADS sur le board // // Place PADS on board. //
///////////////////////////////////// //////////////////////////
for( unsigned i=0; i < aPcb->GetPadsCount(); ++i ) for( unsigned i=0; i < aPcb->GetPadsCount(); ++i )
{ {
...@@ -207,9 +193,9 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag ) ...@@ -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 ); 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( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
{ {
for( BOARD_ITEM* item = module->m_Drawings; item; item = item->Next() ) for( BOARD_ITEM* item = module->m_Drawings; item; item = item->Next() )
...@@ -247,7 +233,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag ) ...@@ -247,7 +233,7 @@ 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() )
{ {
...@@ -296,7 +282,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag ) ...@@ -296,7 +282,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
/* Put bounding box (rectangle) on matrix */ /* Put bounding box (rectangle) on matrix */
dx /= 2; dx /= 2;
dy /= 2; /* dx et dy = demi dimensionx X et Y */ dy /= 2;
ux1 = ux0 + dx; ux1 = ux0 + dx;
uy1 = uy0 + dy; uy1 = uy0 + dy;
...@@ -306,8 +292,8 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag ) ...@@ -306,8 +292,8 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
masque_layer = g_TabOneLayerMask[PtText->GetLayer()]; masque_layer = g_TabOneLayerMask[PtText->GetLayer()];
TraceFilledRectangle( aPcb, ux0 - marge, uy0 - marge, ux1 + marge, uy1 + marge, TraceFilledRectangle( aPcb, ux0 - marge, uy0 - marge, ux1 + marge,
(int) (PtText->m_Orient), uy1 + marge, (int) (PtText->m_Orient),
masque_layer, HOLE, WRITE_CELL ); masque_layer, HOLE, WRITE_CELL );
TraceFilledRectangle( aPcb, ux0 - via_marge, uy0 - via_marge, TraceFilledRectangle( aPcb, ux0 - via_marge, uy0 - via_marge,
...@@ -344,10 +330,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag ) ...@@ -344,10 +330,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
} }
/******************************************************/
int Build_Work( BOARD* Pcb ) int Build_Work( BOARD* Pcb )
/*****************************************************/
/* Build liste conn */
{ {
RATSNEST_ITEM* pt_rats; RATSNEST_ITEM* pt_rats;
D_PAD* pt_pad; D_PAD* pt_pad;
...@@ -361,7 +344,7 @@ int Build_Work( BOARD* Pcb ) ...@@ -361,7 +344,7 @@ int Build_Work( BOARD* Pcb )
for( unsigned ii = 0; ii < Pcb->GetRatsnestsCount(); ii++ ) for( unsigned ii = 0; ii < Pcb->GetRatsnestsCount(); ii++ )
{ {
pt_rats = &Pcb->m_FullRatsnest[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 ) if( (pt_rats->m_Status & CH_ACTIF) == 0 )
continue; continue;
if( pt_rats->m_Status & CH_UNROUTABLE ) if( pt_rats->m_Status & CH_UNROUTABLE )
...@@ -373,18 +356,20 @@ int Build_Work( BOARD* Pcb ) ...@@ -373,18 +356,20 @@ int Build_Work( BOARD* Pcb )
current_net_code = pt_pad->GetNet(); current_net_code = pt_pad->GetNet();
pt_ch = pt_rats; 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 ) 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 ); pt_pad->GetPosition().y, Pcb->m_BoundaryBox.m_Pos.y );
DisplayError( NULL, msg ); DisplayError( NULL, msg );
return 0; 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 ) 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 ); pt_pad->GetPosition().x, Pcb->m_BoundaryBox.m_Pos.x );
DisplayError( NULL, msg ); DisplayError( NULL, msg );
return 0; return 0;
...@@ -392,18 +377,20 @@ int Build_Work( BOARD* Pcb ) ...@@ -392,18 +377,20 @@ int Build_Work( BOARD* Pcb )
pt_pad = pt_rats->m_PadEnd; 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 ) 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 ); pt_pad->GetPosition().y, Pcb->m_BoundaryBox.m_Pos.y );
DisplayError( NULL, msg ); DisplayError( NULL, msg );
return 0; 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 ) 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 ); pt_pad->GetPosition().x, Pcb->m_BoundaryBox.m_Pos.x );
DisplayError( NULL, msg ); DisplayError( NULL, msg );
return 0; return 0;
...@@ -418,12 +405,7 @@ int Build_Work( BOARD* Pcb ) ...@@ -418,12 +405,7 @@ int Build_Work( BOARD* Pcb )
} }
/*******************************************/
BoardCell GetCell( int row, int col, int side ) BoardCell GetCell( int row, int col, int side )
/*******************************************/
/* fetch board cell :
*/
{ {
BoardCell* p; BoardCell* p;
......
/* Bits caracterisant une cellule */ /* Bits characterizing cell */
#define HOLE (char)0x01 /* a conducting hole, ou obstacle */ #define HOLE (char)0x01 /* a conducting hole or obstacle */
#define CELL_is_MODULE (char)0x02 /* autoplacement: occupe par un module */ #define CELL_is_MODULE (char)0x02 /* auto placement occupied by a module */
#define CELL_is_EDGE (char)0x20 /* zone et autoplacement: cellule limitant un contour (Board, Zone) */ #define CELL_is_EDGE (char)0x20 /* Area and auto-placement: limiting cell
#define CELL_is_FRIEND (char)0x40 /* zone et autoplacement: cellule faisant partie du net */ * contour (Board, Zone) */
#define CELL_is_ZONE (char)0x80 /* zone et autoplacement: cellule disponible */ #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 */ /* Bit masks for presence of obstacles to autorouting */
#define OCCUPE 1 /* autoroutage : obstacle pour pistes et vias */ #define OCCUPE 1 /* Autorouting: obstacle tracks and vias. */
#define VIA_IMPOSSIBLE 2 /* autoroutage : obsacle pour vias */ #define VIA_IMPOSSIBLE 2 /* Autorouting: obstacle for vias. */
#define CURRENT_PAD 4 #define CURRENT_PAD 4
......
This diff is collapsed.
...@@ -106,12 +106,12 @@ private: ...@@ -106,12 +106,12 @@ private:
LAYER m_Layer[NB_COPPER_LAYERS]; LAYER m_Layer[NB_COPPER_LAYERS];
public: public:
WinEDA_BasePcbFrame* m_PcbFrame; // Window de visualisation WinEDA_BasePcbFrame* m_PcbFrame; // Window of visualization
EDA_Rect m_BoundaryBox; // Board size and position EDA_Rect m_BoundaryBox; // Board size and position
int m_Status_Pcb; // Flags used in ratsnet calculation and update int m_Status_Pcb; // Flags used in ratsnet calculation and update
EDA_BoardDesignSettings* m_BoardSettings; // Link to current design settings EDA_BoardDesignSettings* m_BoardSettings; // Link to current design settings
int m_NbNodes; // Active pads (pads attached to a net ) count 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<BOARD_ITEM> m_Drawings; // linked list of lines & texts
DLIST<MODULE> m_Modules; // linked list of MODULEs DLIST<MODULE> m_Modules; // linked list of MODULEs
...@@ -327,7 +327,7 @@ public: ...@@ -327,7 +327,7 @@ public:
/* Functions to get some items count */ /* Functions to get some items count */
int GetNumSegmTrack(); int GetNumSegmTrack();
int GetNumSegmZone(); int GetNumSegmZone();
unsigned GetNoconnectCount(); // retourne le nombre de connexions manquantes unsigned GetNoconnectCount(); // Return the number of missing links.
/** /**
* Function GetNumRatsnests * Function GetNumRatsnests
...@@ -353,7 +353,6 @@ public: ...@@ -353,7 +353,6 @@ public:
} }
// Calcul du rectangle d'encadrement:
bool ComputeBoundaryBox(); bool ComputeBoundaryBox();
...@@ -448,8 +447,8 @@ public: ...@@ -448,8 +447,8 @@ public:
/** /**
* Function SetCurrentNetClass * Function SetCurrentNetClass
* Must be called after a netclass selection (or after a netclass parameter change * 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 * Initialise vias and tracks values displayed in comb boxes of the auxiliary toolbar
* and some others parametres (netclass name ....) * and some others parameters (netclass name ....)
* @param aNetClassName = the new netclass name * @param aNetClassName = the new netclass name
* @return true if lists of tracks and vias sizes are modified * @return true if lists of tracks and vias sizes are modified
*/ */
...@@ -461,7 +460,7 @@ public: ...@@ -461,7 +460,7 @@ public:
int GetBiggestClearanceValue(); int GetBiggestClearanceValue();
/** function GetCurrentTrackWidth /** 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 ) * ( using the default netclass value or a preset value )
* the default netclass is always in m_TrackWidthList[0] * the default netclass is always in m_TrackWidthList[0]
*/ */
...@@ -471,7 +470,7 @@ public: ...@@ -471,7 +470,7 @@ public:
} }
/** function GetCurrentViaSize /** 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 ) * ( using the default netclass value or a preset value )
* the default netclass is always in m_TrackWidthList[0] * the default netclass is always in m_TrackWidthList[0]
*/ */
...@@ -481,7 +480,7 @@ public: ...@@ -481,7 +480,7 @@ public:
} }
/** function GetCurrentViaDrill /** 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 ) * ( using the default netclass value or a preset value )
* the default netclass is always in m_TrackWidthList[0] * the default netclass is always in m_TrackWidthList[0]
*/ */
...@@ -577,8 +576,8 @@ public: ...@@ -577,8 +576,8 @@ public:
/** /**
* Function SetAreasNetCodesFromNetNames * Function SetAreasNetCodesFromNetNames
* Set the .m_NetCode member of all copper areas, according to the area Net Name * 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. * The SetNetCodesFromNetNames is an equivalent to net name, for fast comparisons.
* However the Netcode is an arbitrary equyivalence, it must be set after each netlist read * However the Netcode is an arbitrary equivalence, it must be set after each netlist read
* or net change * or net change
* Must be called after pad netcodes are calculated * Must be called after pad netcodes are calculated
* @return : error count * @return : error count
...@@ -761,7 +760,7 @@ public: ...@@ -761,7 +760,7 @@ public:
* If possible, combine 2 copper areas * If possible, combine 2 copper areas
* @param aDeletedList = a PICKED_ITEMS_LIST * where to store deleted areas (useful in undo commands * @param aDeletedList = a PICKED_ITEMS_LIST * where to store deleted areas (useful in undo commands
* can be NULL * 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 * @param area_to_combine = the zone that can be merged with area_ref
* area_ref must be BEFORE area_to_combine * area_ref must be BEFORE area_to_combine
* area_to_combine will be deleted, if areas are combined * area_to_combine will be deleted, if areas are combined
...@@ -778,7 +777,7 @@ public: ...@@ -778,7 +777,7 @@ public:
* Test Areas outlines for DRC: * Test Areas outlines for DRC:
* Test areas inside other areas * Test areas inside other areas
* Test areas too close * 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 * @param aCreate_Markers: if true create DRC markers. False: do not creates anything
* @return errors count * @return errors count
*/ */
...@@ -790,7 +789,7 @@ public: ...@@ -790,7 +789,7 @@ public:
/** /**
* Function Test_Connection_To_Copper_Areas * Function Test_Connection_To_Copper_Areas
* init .m_ZoneSubnet parameter in tracks and pads according to the connections to areas found * 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 ); void Test_Connections_To_Copper_Areas( int aNetcode = -1 );
......
This diff is collapsed.
/************************************/ /*****************************/
/* fonctions de la classe COTATION */ /* COTATION class definition */
/************************************/ /*****************************/
#ifndef COTATION_H #ifndef COTATION_H
#define COTATION_H #define COTATION_H
...@@ -13,9 +13,9 @@ public: ...@@ -13,9 +13,9 @@ public:
wxPoint m_Pos; wxPoint m_Pos;
int m_Shape; int m_Shape;
int m_Unit; /* 0 = inches, 1 = mm */ 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 Barre_ox, Barre_oy, Barre_fx, Barre_fy;
int TraitG_ox, TraitG_oy, TraitG_fx, TraitG_fy; int TraitG_ox, TraitG_oy, TraitG_fx, TraitG_fy;
int TraitD_ox, TraitD_oy, TraitD_fx, TraitD_fy; int TraitD_ox, TraitD_oy, TraitD_fx, TraitD_fy;
...@@ -54,7 +54,6 @@ public: ...@@ -54,7 +54,6 @@ public:
*/ */
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/* Modification du texte de la cotation */
void SetText( const wxString& NewText ); void SetText( const wxString& NewText );
wxString GetText( void ); wxString GetText( void );
...@@ -111,7 +110,7 @@ public: ...@@ -111,7 +110,7 @@ public:
bool HitTest( const wxPoint& ref_pos ); bool HitTest( const wxPoint& ref_pos );
/** /**
* Function HitTest (overlayed) * Function HitTest (overlaid)
* tests if the given EDA_Rect intersect this object. * tests if the given EDA_Rect intersect this object.
* For now, the anchor must be inside this rect. * For now, the anchor must be inside this rect.
* @param refArea : the given EDA_Rect * @param refArea : the given EDA_Rect
......
...@@ -241,13 +241,11 @@ void DRAWSEGMENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -241,13 +241,11 @@ void DRAWSEGMENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
color = g_DesignSettings.m_LayerColor[GetLayer()]; color = g_DesignSettings.m_LayerColor[GetLayer()];
GRSetDrawMode( DC, draw_mode ); 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; ux0 = m_Start.x;
uy0 = m_Start.y; uy0 = m_Start.y;
/* coord d'arrivee */
dx = m_End.x; dx = m_End.x;
dy = m_End.y; dy = m_End.y;
...@@ -287,7 +285,7 @@ void DRAWSEGMENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -287,7 +285,7 @@ void DRAWSEGMENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
if( StAngle > EndAngle ) if( StAngle > EndAngle )
EXCHG( StAngle, EndAngle ); EXCHG( StAngle, EndAngle );
} }
else //Mirrored mode: arc orientation is reversed else // Mirrored mode: arc orientation is reversed
{ {
if( StAngle < EndAngle ) if( StAngle < EndAngle )
EXCHG( StAngle, EndAngle ); EXCHG( StAngle, EndAngle );
...@@ -318,7 +316,8 @@ void DRAWSEGMENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -318,7 +316,8 @@ void DRAWSEGMENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
if( mode == FILAIRE ) if( mode == FILAIRE )
GRLine( &panel->m_ClipBox, DC, GRLine( &panel->m_ClipBox, DC,
m_BezierPoints[i].x, m_BezierPoints[i].y, m_BezierPoints[i].x, m_BezierPoints[i].y,
m_BezierPoints[i-1].x, m_BezierPoints[i-1].y, 0, color ); m_BezierPoints[i-1].x, m_BezierPoints[i-1].y, 0,
color );
else if( mode == SKETCH ) else if( mode == SKETCH )
{ {
GRCSegm( &panel->m_ClipBox, DC, GRCSegm( &panel->m_ClipBox, DC,
...@@ -418,7 +417,7 @@ bool DRAWSEGMENT::HitTest( const wxPoint& ref_pos ) ...@@ -418,7 +417,7 @@ bool DRAWSEGMENT::HitTest( const wxPoint& ref_pos )
int ux0 = m_Start.x; int ux0 = m_Start.x;
int uy0 = m_Start.y; 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 dx = m_End.x - ux0;
int dy = m_End.y - uy0; int dy = m_End.y - uy0;
...@@ -439,7 +438,6 @@ bool DRAWSEGMENT::HitTest( const wxPoint& ref_pos ) ...@@ -439,7 +438,6 @@ bool DRAWSEGMENT::HitTest( const wxPoint& ref_pos )
if( m_Shape == S_CIRCLE ) if( m_Shape == S_CIRCLE )
return true; return true;
/* pour un arc, controle complementaire */
mouseAngle = (int) ArcTangente( spot_cY, spot_cX ); mouseAngle = (int) ArcTangente( spot_cY, spot_cX );
stAngle = (int) ArcTangente( dy, dx ); stAngle = (int) ArcTangente( dy, dx );
endAngle = stAngle + m_Angle; endAngle = stAngle + m_Angle;
...@@ -458,7 +456,8 @@ bool DRAWSEGMENT::HitTest( const wxPoint& ref_pos ) ...@@ -458,7 +456,8 @@ bool DRAWSEGMENT::HitTest( const wxPoint& ref_pos )
case S_CURVE: case S_CURVE:
for( unsigned int i= 1; i < m_BezierPoints.size(); i++) 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; return true;
} }
break; break;
......
/****************************************************/ /****************************************************/
/* class_module.cpp : fonctions de la classe MODULE */ /* class_module.cpp : EDGE_MODULE class definition. */
/****************************************************/ /****************************************************/
#include "fctsys.h" #include "fctsys.h"
...@@ -14,11 +14,12 @@ ...@@ -14,11 +14,12 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "class_board_design_settings.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 ) : EDGE_MODULE::EDGE_MODULE( MODULE* parent ) :
BOARD_ITEM( parent, TYPE_EDGE_MODULE ) BOARD_ITEM( parent, TYPE_EDGE_MODULE )
...@@ -35,10 +36,7 @@ EDGE_MODULE::~EDGE_MODULE() ...@@ -35,10 +36,7 @@ EDGE_MODULE::~EDGE_MODULE()
} }
/********************************************/
void EDGE_MODULE::Copy( EDGE_MODULE* source ) void EDGE_MODULE::Copy( EDGE_MODULE* source )
/********************************************/
// copy structure
{ {
if( source == NULL ) if( source == NULL )
return; return;
...@@ -46,18 +44,17 @@ void EDGE_MODULE::Copy( EDGE_MODULE* source ) ...@@ -46,18 +44,17 @@ void EDGE_MODULE::Copy( EDGE_MODULE* source )
m_Start = source->m_Start; m_Start = source->m_Start;
m_End = source->m_End; m_End = source->m_End;
m_Shape = source->m_Shape; m_Shape = source->m_Shape;
m_Start0 = source->m_Start0; // coord relatives a l'ancre du point de depart(Orient 0) m_Start0 = source->m_Start0;
m_End0 = source->m_End0; // coord relatives a l'ancre du point de fin (Orient 0) m_End0 = source->m_End0;
m_Angle = source->m_Angle; // pour les arcs de cercle: longueur de l'arc en 0,1 degres m_Angle = source->m_Angle;
m_Layer = source->m_Layer; m_Layer = source->m_Layer;
m_Width = source->m_Width; m_Width = source->m_Width;
m_PolyPoints = source->m_PolyPoints; // std::vector copy m_PolyPoints = source->m_PolyPoints; // std::vector copy
} }
/***********************************/
void EDGE_MODULE::SetDrawCoord() void EDGE_MODULE::SetDrawCoord()
/***********************************/
{ {
MODULE* Module = (MODULE*) m_Parent; MODULE* Module = (MODULE*) m_Parent;
...@@ -74,19 +71,16 @@ void EDGE_MODULE::SetDrawCoord() ...@@ -74,19 +71,16 @@ void EDGE_MODULE::SetDrawCoord()
} }
/********************************************************************************/ /* Draw EDGE_MODULE:
void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, * Entry: offset = offset trace
int draw_mode, const wxPoint& offset ) * Draw_mode mode = trace (GR_OR, GR_XOR, GR_AND)
/********************************************************************************/ * The contours are of different types:
/* 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 * - Segment
* - Cercles * - Circles
* - Arcs * - Arcs
*/ */
void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
int draw_mode, const wxPoint& offset )
{ {
int ux0, uy0, dx, dy, rayon, StAngle, EndAngle; int ux0, uy0, dx, dy, rayon, StAngle, EndAngle;
int color, type_trace; int color, type_trace;
...@@ -95,7 +89,7 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -95,7 +89,7 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
WinEDA_BasePcbFrame* frame; WinEDA_BasePcbFrame* frame;
MODULE* Module = NULL; MODULE* Module = NULL;
if( m_Parent && (m_Parent->Type() == TYPE_MODULE) ) if( m_Parent && ( m_Parent->Type() == TYPE_MODULE ) )
Module = (MODULE*) m_Parent; Module = (MODULE*) m_Parent;
if( g_DesignSettings.IsLayerVisible( m_Layer ) == false ) if( g_DesignSettings.IsLayerVisible( m_Layer ) == false )
...@@ -231,15 +225,18 @@ void EDGE_MODULE::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -231,15 +225,18 @@ void EDGE_MODULE::DisplayInfo( WinEDA_DrawFrame* frame )
frame->AppendMsgPanel( _( "Graphic Item" ), wxEmptyString, DARKCYAN ); 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 ); frame->AppendMsgPanel( _( "Value" ), module->m_Value->m_Text, BLUE );
msg.Printf( wxT( "%8.8lX" ), module->m_TimeStamp ); msg.Printf( wxT( "%8.8lX" ), module->m_TimeStamp );
frame->AppendMsgPanel( _( "TimeStamp" ), msg, BROWN ); 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 ); valeur_param( m_Width, msg );
frame->AppendMsgPanel( _( "Width" ), msg, BLUE ); frame->AppendMsgPanel( _( "Width" ), msg, BLUE );
...@@ -284,7 +281,8 @@ bool EDGE_MODULE::Save( FILE* aFile ) const ...@@ -284,7 +281,8 @@ bool EDGE_MODULE::Save( FILE* aFile ) const
m_Width, m_Layer ); m_Width, m_Layer );
for( unsigned i=0; i<m_PolyPoints.size(); ++i ) 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; break;
default: default:
...@@ -299,13 +297,6 @@ bool EDGE_MODULE::Save( FILE* aFile ) const ...@@ -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: /* Read a description line like:
* DS 2600 0 2600 -600 120 21 * DS 2600 0 2600 -600 120 21
* this description line is in Line * this description line is in Line
...@@ -316,6 +307,8 @@ int EDGE_MODULE::ReadDescr( char* Line, FILE* File, ...@@ -316,6 +307,8 @@ int EDGE_MODULE::ReadDescr( char* Line, FILE* File,
* - Polygon * - Polygon
* *
*/ */
int EDGE_MODULE::ReadDescr( char* Line, FILE* File,
int* LineNum )
{ {
int ii; int ii;
int error = 0; int error = 0;
...@@ -409,13 +402,13 @@ int EDGE_MODULE::ReadDescr( char* Line, FILE* File, ...@@ -409,13 +402,13 @@ int EDGE_MODULE::ReadDescr( char* Line, FILE* File,
break; break;
} }
// Check for a reasonnable width: // Check for a reasonable width:
if( m_Width <= 1 ) if( m_Width <= 1 )
m_Width = 1; m_Width = 1;
if( m_Width > MAX_WIDTH ) if( m_Width > MAX_WIDTH )
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 // 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. // 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 // @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 ) ...@@ -447,7 +440,6 @@ bool EDGE_MODULE::HitTest( const wxPoint& ref_pos )
switch( m_Shape ) switch( m_Shape )
{ {
case S_SEGMENT: case S_SEGMENT:
/* recalcul des coordonnees avec ux0,uy0 = origine des coord. */
spot_cX = ref_pos.x - ux0; spot_cX = ref_pos.x - ux0;
spot_cY = ref_pos.y - uy0; spot_cY = ref_pos.y - uy0;
...@@ -459,19 +451,20 @@ bool EDGE_MODULE::HitTest( const wxPoint& ref_pos ) ...@@ -459,19 +451,20 @@ bool EDGE_MODULE::HitTest( const wxPoint& ref_pos )
case S_CIRCLE: case S_CIRCLE:
rayon = (int) hypot( (double) (uxf - ux0), (double) (uyf - uy0) ); 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 ) if( abs( rayon - dist ) <= m_Width )
return true; return true;
break; break;
case S_ARC: case S_ARC:
rayon = (int) hypot( (double) (uxf - ux0), (double) (uyf - uy0) ); 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 ) if( abs( rayon - dist ) > m_Width )
break; break;
/* pour un arc, controle complementaire */
int mouseAngle = (int) ArcTangente( ref_pos.y - uy0, ref_pos.x - ux0 ); int mouseAngle = (int) ArcTangente( ref_pos.y - uy0, ref_pos.x - ux0 );
int stAngle = (int) ArcTangente( uyf - uy0, uxf - ux0 ); int stAngle = (int) ArcTangente( uyf - uy0, uxf - ux0 );
int endAngle = stAngle + m_Angle; int endAngle = stAngle + m_Angle;
...@@ -494,6 +487,7 @@ bool EDGE_MODULE::HitTest( const wxPoint& ref_pos ) ...@@ -494,6 +487,7 @@ bool EDGE_MODULE::HitTest( const wxPoint& ref_pos )
#if defined(DEBUG) #if defined(DEBUG)
/** /**
* Function Show * Function Show
* is used to output the object tree, currently for debugging only. * is used to output the object tree, currently for debugging only.
......
/**************************************************************/ /*******************************************************/
/* class_edge_module.h : description des contours d'un module */ /* class_edge_module.h : EDGE_MODULE class definition. */
/**************************************************************/ /*******************************************************/
class Pcb3D_GLCanvas; class Pcb3D_GLCanvas;
/* description des contours (empreintes ) et TYPES des CONTOURS : */
class EDGE_MODULE : public BOARD_ITEM class EDGE_MODULE : public BOARD_ITEM
{ {
public: public:
...@@ -14,11 +12,11 @@ public: ...@@ -14,11 +12,11 @@ public:
wxPoint m_Start; // Line start point wxPoint m_Start; // Line start point
wxPoint m_End; // Line end point wxPoint m_End; // Line end point
int m_Shape; // voir "enum Track_Shapes" int m_Shape; // enum Track_Shapes
wxPoint m_Start0; // coord relatives a l'ancre du point de depart(Orient 0) wxPoint m_Start0; // Start point.
wxPoint m_End0; // coord relatives a l'ancre du point de fin (Orient 0) 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 // Coord are relative to Origin, orient 0
...@@ -54,7 +52,6 @@ public: ...@@ -54,7 +52,6 @@ public:
int ReadDescr( char* Line, FILE* File, int* LineNum = NULL ); int ReadDescr( char* Line, FILE* File, int* LineNum = NULL );
// Mise a jour des coordon�s pour l'affichage
void SetDrawCoord(); void SetDrawCoord();
/* drawing functions */ /* drawing functions */
......
/****************************************************/ /****************************************************/
/* fonctions de la classe MIRE (targets for photos) */ /* MIRE class definition (targets for photos) */
/****************************************************/ /****************************************************/
#include "fctsys.h" #include "fctsys.h"
...@@ -27,9 +27,7 @@ MIREPCB::~MIREPCB() ...@@ -27,9 +27,7 @@ MIREPCB::~MIREPCB()
} }
/**********************************/
void MIREPCB::Copy( MIREPCB* source ) void MIREPCB::Copy( MIREPCB* source )
/**********************************/
{ {
m_Layer = source->m_Layer; m_Layer = source->m_Layer;
m_Width = source->m_Width; m_Width = source->m_Width;
...@@ -40,19 +38,16 @@ void MIREPCB::Copy( MIREPCB* source ) ...@@ -40,19 +38,16 @@ void MIREPCB::Copy( MIREPCB* source )
} }
/**************************************************************/ /* Read the description from the PCB file.
bool MIREPCB::ReadMirePcbDescr( FILE* File, int* LineNum )
/**************************************************************/
/* Lecture de la description de 1 segment type Drawing PCB
*/ */
bool MIREPCB::ReadMirePcbDescr( FILE* File, int* LineNum )
{ {
char Line[256]; char Line[256];
while( GetLine( File, Line, LineNum ) != NULL ) while( GetLine( File, Line, LineNum ) != NULL )
{ {
if( strnicmp( Line, "$End", 4 ) == 0 ) if( strnicmp( Line, "$End", 4 ) == 0 )
return TRUE; /* fin de liste */ return TRUE;
if( Line[0] == 'P' ) if( Line[0] == 'P' )
{ {
sscanf( Line + 2, " %X %d %d %d %d %d %lX", sscanf( Line + 2, " %X %d %d %d %d %d %lX",
...@@ -69,9 +64,8 @@ bool MIREPCB::ReadMirePcbDescr( FILE* File, int* LineNum ) ...@@ -69,9 +64,8 @@ bool MIREPCB::ReadMirePcbDescr( FILE* File, int* LineNum )
return FALSE; return FALSE;
} }
/**************************************/
bool MIREPCB::Save( FILE* aFile ) const bool MIREPCB::Save( FILE* aFile ) const
/**************************************/
{ {
if( GetState( DELETED ) ) if( GetState( DELETED ) )
return true; return true;
...@@ -98,15 +92,12 @@ out: ...@@ -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, void MIREPCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
int mode_color, const wxPoint& offset ) 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 rayon, ox, oy, gcolor, width;
int dx1, dx2, dy1, dy2; int dx1, dx2, dy1, dy2;
...@@ -126,7 +117,6 @@ void MIREPCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -126,7 +117,6 @@ void MIREPCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
if( panel->GetScreen()->Scale( width ) < 2 ) if( panel->GetScreen()->Scale( width ) < 2 )
typeaff = FILAIRE; typeaff = FILAIRE;
/* Trace du cercle: */
rayon = m_Size / 4; rayon = m_Size / 4;
switch( typeaff ) switch( typeaff )
...@@ -145,15 +135,17 @@ void MIREPCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -145,15 +135,17 @@ void MIREPCB::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
} }
/* Trace des 2 traits */
rayon = m_Size / 2; rayon = m_Size / 2;
dx1 = rayon, dy1 = 0; dx1 = rayon;
dx2 = 0, dy2 = rayon; dy1 = 0;
dx2 = 0;
dy2 = rayon;
if( m_Shape ) /* Forme X */ if( m_Shape ) /* Form X */
{ {
dx1 = dy1 = (rayon * 7) / 5; dx1 = dy1 = ( rayon * 7 ) / 5;
dx2 = dx1; dy2 = -dy1; dx2 = dx1;
dy2 = -dy1;
} }
switch( typeaff ) switch( typeaff )
...@@ -189,9 +181,10 @@ bool MIREPCB::HitTest( const wxPoint& refPos ) ...@@ -189,9 +181,10 @@ bool MIREPCB::HitTest( const wxPoint& refPos )
int dX = refPos.x - m_Pos.x; int dX = refPos.x - m_Pos.x;
int dY = refPos.y - m_Pos.y; int dY = refPos.y - m_Pos.y;
int rayon = m_Size / 2; int rayon = m_Size / 2;
return abs(dX)<=rayon && abs(dY)<=rayon; return abs( dX ) <= rayon && abs( dY ) <= rayon;
} }
/** /**
* Function HitTest (overlayed) * Function HitTest (overlayed)
* tests if the given EDA_Rect intersect this object. * tests if the given EDA_Rect intersect this object.
...@@ -205,6 +198,7 @@ bool MIREPCB::HitTest( EDA_Rect& refArea ) ...@@ -205,6 +198,7 @@ bool MIREPCB::HitTest( EDA_Rect& refArea )
return false; return false;
} }
/** /**
* Function Rotate * Function Rotate
* Rotate this object. * Rotate this object.
...@@ -216,6 +210,7 @@ void MIREPCB::Rotate(const wxPoint& aRotCentre, int aAngle) ...@@ -216,6 +210,7 @@ void MIREPCB::Rotate(const wxPoint& aRotCentre, int aAngle)
RotatePoint( &m_Pos, aRotCentre, aAngle ); RotatePoint( &m_Pos, aRotCentre, aAngle );
} }
/** /**
* Function Flip * Function Flip
* Flip this object, i.e. change the board side for this object * Flip this object, i.e. change the board side for this object
...@@ -223,7 +218,6 @@ void MIREPCB::Rotate(const wxPoint& aRotCentre, int aAngle) ...@@ -223,7 +218,6 @@ void MIREPCB::Rotate(const wxPoint& aRotCentre, int aAngle)
*/ */
void MIREPCB::Flip(const wxPoint& aCentre ) 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() ) ); SetLayer( ChangeSideNumLayer( GetLayer() ) );
} }
/****************************************************/ /****************************************************/
/* fonctions de la classe MIRE (targets for photos) */ /* MIREPCB class definition. (targets for photos) */
/****************************************************/ /****************************************************/
#ifndef MIRE_H #ifndef MIRE_H
#define MIRE_H #define MIRE_H
...@@ -12,7 +12,7 @@ class MIREPCB : public BOARD_ITEM ...@@ -12,7 +12,7 @@ class MIREPCB : public BOARD_ITEM
public: public:
int m_Width; int m_Width;
wxPoint m_Pos; wxPoint m_Pos;
int m_Shape; // bit 0 : 0 = forme +, 1 = forme X int m_Shape; // bit 0 : 0 = draw +, 1 = draw X
int m_Size; int m_Size;
public: public:
...@@ -77,7 +77,7 @@ public: ...@@ -77,7 +77,7 @@ public:
bool HitTest( const wxPoint& refPos ); bool HitTest( const wxPoint& refPos );
/** /**
* Function HitTest (overlayed) * Function HitTest (overlaid)
* tests if the given EDA_Rect intersect this object. * tests if the given EDA_Rect intersect this object.
* For now, the anchor must be inside this rect. * For now, the anchor must be inside this rect.
* @param refArea : the given EDA_Rect * @param refArea : the given EDA_Rect
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/************************************/ /********************************/
/* fonctions de la classe TEXTE_PCB */ /* TEXTE_PCB class definition. */
/************************************/ /********************************/
#ifndef CLASS_PCB_TEXT_H #ifndef CLASS_PCB_TEXT_H
#define CLASS_PCB_TEXT_H #define CLASS_PCB_TEXT_H
...@@ -52,14 +52,16 @@ public: ...@@ -52,14 +52,16 @@ public:
/* duplicate structure */ /* duplicate structure */
void Copy( TEXTE_PCB* source ); void Copy( TEXTE_PCB* source );
void Draw( WinEDA_DrawPanel * panel, wxDC* DC, int aDrawMode, const wxPoint& offset = ZeroOffset ); void Draw( WinEDA_DrawPanel * panel, wxDC* DC, int aDrawMode,
const wxPoint& offset = ZeroOffset );
// File Operations: // File Operations:
int ReadTextePcbDescr( FILE* File, int* LineNum ); int ReadTextePcbDescr( FILE* File, int* LineNum );
/** /**
* Function Save * Function Save
* writes the data structures for this object out to a FILE in "*.brd" format. * writes the data structures for this object out to a FILE in "*.brd"
* format.
* @param aFile The FILE to write to. * @param aFile The FILE to write to.
* @return bool - true if success writing else false. * @return bool - true if success writing else false.
*/ */
...@@ -88,7 +90,7 @@ public: ...@@ -88,7 +90,7 @@ public:
/** /**
* Function HitTest (overlayed) * Function HitTest (overlaid)
* tests if the given EDA_Rect intersect this object. * tests if the given EDA_Rect intersect this object.
* @param refArea the given EDA_Rect to test * @param refArea the given EDA_Rect to test
* @return bool - true if a hit, else false * @return bool - true if a hit, else false
......
This diff is collapsed.
This diff is collapsed.
...@@ -1067,7 +1067,7 @@ bool TRACK::HitTest( const wxPoint& ref_pos ) ...@@ -1067,7 +1067,7 @@ bool TRACK::HitTest( const wxPoint& ref_pos )
int spot_cX = ref_pos.x - m_Start.x; int spot_cX = ref_pos.x - m_Start.x;
int spot_cY = ref_pos.y - m_Start.y; int spot_cY = ref_pos.y - m_Start.y;
if( Type() == TYPE_VIA ) /* VIA rencontree */ if( Type() == TYPE_VIA )
{ {
return (double) spot_cX * spot_cX + (double) spot_cY * spot_cY <= return (double) spot_cX * spot_cX + (double) spot_cY * spot_cY <=
(double) radius * radius; (double) radius * radius;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment