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